Help me in solving AIRM problem

My issue

what is fault in my code

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	while(n--){
	    int s,c=0;
	    cin>>s;
	    int a[s],b[s];
	    for(int i=0;i<s;i++){
	        cin>>a[i];
	    }
	    for(int i=0;i<s;i++){
	        cin>>b[i];
	    }
	    for(int i=0;i<s-1;i++){
	        for(int j=i+1;j<s;j++){
	            if(a[i]==a[j] || b[i]==b[j] || a[i]==b[j] || a[j]==b[i]){
	                c++;
	            }
	        }
	    }
	    if(c!=0)    cout<<c<<endl;
	    else    cout<<1<<endl;
	}
	return 0;
}

Problem Link: Airport Management Practice Coding Problem

@cse_05d9
hey , plzz refer my c++ code for better understanding

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t ;
	cin>>t ;
	while(t--){
	    
	   // vector<int> d ;
	   int m = 1 , c =1  ;
	    int n ;
	    cin>>n ;
	    vector<int> a(n*2) ;
	    for(int i=0 ; i<(n*2) ; i++){
	        cin>>a[i];
	    }
	    sort(a.begin(), a.end());
	    for(int i=1 ; i<(n*2) ; i++){
	        if(a[i]==a[i-1]){
	            c++ ;
	        }
	        else {
	            c = 1 ;
	        }
	        if(c>m){
	            m = c ;
	        }
	    }
	    
	    cout<<m<<endl ;
	}
	return 0;
}