Showing wrong answer for correct input

I was solving problem TRUEDARE: https://www.codechef.com/problems/TRUEDARE
I am entering all the test cases and it works on gcc but is showing wrong answer in Code Chef
Below is my code:

 #include<stdio.h>

int main()
{
    int testcount,test=0,c=0;
    int res=0,res_arr[100];
    
    scanf("%d",&testcount); //number of test cases

    while(test!=testcount)
    {
        
        test++; //counter for test case

        int tr,ts,dr,ds;

        //TOTAL NUMBER OF TRUTH TASKS RAM CAN PERFORM
        scanf("%d",&tr);
        int arrtr[100];
        
        //READING TRUTH TASKS OF RAM THAT HE CAN PERFORM
        for(int i = 0; i < tr; i++)
        {
            scanf("%d",&arrtr[i]);
        }

        //TOTAL NUMBER OF DARE TASKS RAM CAN PERFORM
        scanf("%d",&dr);
        int arrdr[100];
        
        //READING DARE TASKS OF RAM THAT HE CAN PERFORM
        for(int i = 0; i < dr; i++)
        {
            scanf("%d",&arrdr[i]);
        }
        
        //TOTAL NUMBER OF TRUTH TASKS SHAM CAN PERFORM
        scanf("%d",&ts);
        int arrts[100];
        
        //READING TRUTH TASKS OF SHAM  THAT HE CAN PERFORM
        for(int i = 0; i < ts; i++)
        {
            scanf("%d",&arrts[i]);
        }

        //TOTAL NUMBER OF DARE TASKS SHAM CAN PERFORM
        scanf("%d",&ds);
        int arrds[100];
        
        //READING DARE TASKS OF SHAM THAT HE CAN PERFORM
        for(int i = 0; i < ds; i++)
        {
            scanf("%d",&arrds[i]);
        }


        //MAIN ALGORITHM
    
        for(int i = 0; i < tr; i++)
        {
            for(int j = 0; j < ts; j++)
            {

                if(arrtr[i]==arrts[j])
                { 
                    res=1;
                    
                }

                else
                { 
                    res=0;
                }
            }


        for(int i = 0; i < dr; i++)
        {
            for(int j = 0; j < ds; j++)
            {   
                if(arrdr[i]==arrds[j])
                { 
                    res=1;               
                }

                else
                { 
                    res=0;
                }
            }
        }
    
    } 

        if(res==1)
        res_arr[c]=1;
        else res_arr[c]=0; 
        c++;
        
    }

    
    for(int i = 0; i < testcount; i++)
    {
        if (res_arr[i]==1)
        printf("yes");
        else printf("no");
        
        if(i < testcount-1)
        printf("\n");
    }
    

    return 0;
}