Solution for Runtime Error in GIT01

I wrote the following code as a solution of the problem named as " Chef and his cake" with the tag GIT01. It runs fine and I checked it with some test runs with different inputs. But after submitting it says…" Runtime Error". I am quite new in programming and looking for a help from an expart one…

  //GIT01
    
    #include<stdio.h>
    int main()
    {
    	int c,t=0;
    	scanf("%d\n",&c);
    	for(t=0;t<c;t++)
    	{
    		int a,b,t,c1=0,c2=0,ans;
    		int i,j,m,n,o,x,y;
    		scanf("%d",&a);
    		scanf("%d",&b);
    		char s1[a][b];
    		char s2[a][b];
    		char s3[a][b];
    		for(i=0;i<a;i++)
    		{
    			scanf("%s",s1[i]);
    			printf("\n");
    		}
    		for(x=0;x<a;x++)
    			{
    			if(x%2==0)
    			{	
    				for(y=0;y<b;y=y+2)
    				{
    					s2[x][y]='R';
    					s3[x][y]='G';
    				}
    			}
    			else
    			{
    				for(y=1;y<b;y=y+2)
    				{
    					s2[x][y]='R';
    					s3[x][y]='G';
    				}
    			
    			}
    		}
    		for(x=0;x<a;x++)
    		{
    			if(x%2==0)
    			{	
    				for(y=1;y<b;y=y+2)
    				{
    					s2[x][y]='G';
    					s3[x][y]='R';
    				}
    			}
    			else
    			{
    				for(y=0;y<b;y=y+2)
    				{
    					s2[x][y]='G';
    					s3[x][y]='R';
    				}
    			
    			}	
    		}
    		for(i=0;i<a;i++)
    		{
    			for(j=0;j<b;j++)
    			{
    				if(s1[i][j]!=s2[i][j])
    				{
    					if(s1[i][j]=='R')
    					{
    						c1=c1+5;
    					}
    					else if(s1[i][j]=='G')
    					{
    						c1=c1+3;
    					}
    				}
    			}
    		}
    		for(i=0;i<a;i++)
    		{
    			for(j=0;j<b;j++)
    			{
    				if(s1[i][j]!=s3[i][j])
    				{
    					if(s1[i][j]=='R')
    					{
    						c2=c2+5;
    					}
    					else
    					{
    						c2=c2+3;
    					}
    				}
    			}
    		}
    		if(c1<=c2)
    		{
    			ans=c1;
    		}
    		else
    		{
    			ans=c2;
    		}
    		printf("%d",ans);
    	}
    	return 0;
    }