Can anybody explain!

I’ve seen the codes of some good programmer… they always go for fastinput and for that they have defined the functions like this…
char strd[1000009];
char ibuffer[BS];
int ibuffer_offset=0;
int ibuffer_size=0;

static unsigned long inline fastread() {
unsigned long r=0, s=1;
while(1) {
if(ibuffer_offset >= ibuffer_size) {
ibuffer_size = read(0, ibuffer, BS);
ibuffer_offset = 0;
if(ibuffer[ibuffer_offset] < 48) {
if(s) ibuffer_offset++;
else return r;
else {
s = 0;
r = r * 10 + ibuffer[ibuffer_offset++]-48;

Can andybody define me what is going in this code and how input will be fast in that case!! Thanks in advance!!

Hey,I too were curious in the beginning,when i saw such code’s for fast input.But then,somebody told me and that’s even correct,rather than focusing on the fast i/o,one should focus on good implementation of algorithms.Its the algorithm that will truly make a great amount of difference during execution.
Even if you use fast




with a proper implementation of algorithm.You’ll get it ACd. :slight_smile:
Although,its good to know such types of technique’s,but i feel we learn while we code.Definitely,will get to learn it by our own.Things learn’t on our own are the best when it come to implementing those :):slight_smile:

Thanks ansh1star033 for ur valuable suggestions!!

Please use “code sample” option in wysiwyg editor for code formatting…