Runtime ERROR

#include<stdio.h>
int main(){
int arr[10][6]={1,1,1,0,0,0,2,4,2,4,8,6,3,4,3,9,7,1,4,2,4,6,0,0,5,1,5,0,0,0,6,1,6,0,0,0,7,4,7,9,3,1,8,4,8,4,2,6,9,2,9,1,0,0,10,1,0,0,0,0};

   int t,x,last;
   long int y,u;

   scanf("%d",&t);
    while(t--){
      scanf("%d%ld",&x,&y);

        if(x!=10&&x!=20)
        x=x%10;
        if(x==20)
        x=10;

        u=arr[x-1][1];

        y=(u==1)?y%u+1:y%u;

        last=arr[x-1][y+1];
  printf("%d\n",last);
        }
 return 0;
  }

Check with problem constraints and make sure that you are not going out of bounds at any index.

Also, if u is 0, then y=(u==1)?y%u+1:y%u; will give DivisionByZero error, as modulo operation involves, basically, a division.

As far as I can see, these are the two sources of run-time error in your pgm.