Getting MLE as compiler message

question -MAX Query-1
my code-https://ide.codingblocks.com/s/241633

@vaibhav5147,
long long f[1000000001]={0};
You cannot make this big array, try to use map instead, and also, why is GCD required in this problem…??