Help me in solving TREATS problem

My issue

include <stdio.h>

int main(void) {
// your code goes here
int t,n,m,a[50];
scanf(“%d”,t);
while(t–){
scanf(“%d”,n);
scanf(“%d”,m);
for(i=0;i<n;i++)
scanf(“%d”,&a[i]);
for(i=0;i<n;i++)
scanf(“%d”,&b[i]);
}

}

My code

#include <stdio.h>

int main(void) {
	// your code goes here
	int t,n,m,a[50];
	scanf("%d",t);
	while(t--){
	    scanf("%d",n);
	    scanf("%d",m);
	    for(i=0;i<n;i++)
	        scanf("%d",&a[i]);
	    for(i=0;i<n;i++)
	        scanf("%d",&b[i]);
	}
	

}


Problem Link: Trick Or Treat Practice Coding Problem

@bhavya_sree13
Hint :- think are some solution that includes % operation and maintaining their frequency.

Think like if a%5 gives you 3 and b%5 gives you 2 then (a+b)%5 will gives you 0 … and if a%5 = 0 and b%5 = 0 then (a+b)%5 is also 0.