fast input function

This tip submitted by Yashpreet singh on 2013-02-18 10:11:40. It has been viewed 1013 times.
Rating of 0.0 with 0 votes



this function helps to take input faster

inline int read_int() {
char c;
while ((c=getchar_unlocked()) < 48 || c > 57);
int p = c-48;
while ((c=getchar_unlocked()) >= 48 && c <= 57) p=p*10+c-48;
return p;
}

e.g

int main(){
int n;
n=read_int();
}



More tips

Help your fellow programmers! Add a tip!