Wrong Answer
/in/foo.cc: In function 'int main()': /in/foo.cc:8:20: warning: 'n' is used uninitialized in this function [-Wuninitialized] for(int i=1;i<=n;i++) cin>>a[i]; ~^~~ /in/foo.cc:13:17: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized] if(j==r+1) j=1; ~^~