I am trying to solve one codechef practice problem subtraction game 1 with c programming and Code Blocks as IDE. I found one way of reading input faster than scanf() function but when I run my program I am getting error "undefined reference to 'getchar_unlocked' error". Can you guys tell me what I am doing wrong and is there any other method for reading input faster?
#include<stdio.h>
inline int fastread()
{
int noRead=0;
char p=getchar_unlocked();
for(; p<33;) {
p=getchar_unlocked();
};
while(p>32) {
noRead = (noRead << 3) + (noRead << 1) + (p - '0');
p=getchar_unlocked();
}
return noRead;
};
unsigned int gcd(unsigned int a, unsigned int b)
{
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int main()
{
int t,i,answer=0;
unsigned int n;
t = fastread();
while(t--)
{
n = fastread();
unsigned int a[n];
for(i=0;i<n;i++)
a[i]=fastread();
answer = gcd(a[0],a[1]);
for(i=2;i<n;i++)
answer = gcd(a[i],answer);
printf("%u\n",answer);
}
return 0;
}