stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main(){

    

    int x, arr[200005], max1 = 0, max2 = 0, imax=0;

    cin >> x;

    for(int i=1; i<=x; i++){

        cin >> arr[i];

        if(arr[i]>max1){

            max1=arr[i];

            imax = i;

        }

    }

    for(int i=1; i<=x; i++){

        if(arr[i]>max2 && imax!=i)

        max2=arr[i];

    }

    for(int i=1; i<=x; i++){

        if(arr[i]==max1){

            cout << max2 << endl;

        }

        else{

            cout << max1 << endl;

        }

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

int a[300008],b[2000008];

int main(){

    int n;

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

        scanf("%d",a+i),b[i]=a[i];

        sort(b+1,b+n+1);

    for(int i=1;i<=n;i++){

        if(a[i]==b[n]){

            printf("%d\n",b[n-1]);

        }

        else

            printf("%d\n",b[n]);

    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
/*

 Shahadat Hossain

 I.C.T Department

 Comilla University

 Session: 2013-2014

 */



#include<iostream>

#include<map>

#include<queue>

#include<vector>

#include<string>

#include<cstring>



using namespace std;



int const N = 1e6 + 5;

int const MOD = 1e9 + 7;



int ar[N];

int l[N], r[N];



int main(){

    

    int n;

    cin >> n;

    

    int mx = 0;

    for(int i = 1; i <= n; i++){

        cin >> ar[i];

        mx = max(ar[i], mx);

        l[i] = mx;

    }

    

    mx = 0;

    for(int i = n; i >= 1; i--){

        mx = max(ar[i], mx);

        r[i] = mx;

    }

    

    for(int i = 1; i <= n; i++){

        cout << max(l[i - 1], r[i + 1]) << endl;

    }

    

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

int a[300008],b[2000008];

int main(){

    int n;

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

        scanf("%d",a+i),b[i]=a[i];

        sort(b+1,b+n+1);

    for(int i=1;i<=n;i++){

        if(a[i]==b[n]){

            printf("%d\n",b[n-1]);

        }

        else

            printf("%d\n",b[n]);

    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<algorithm>

using namespace std;



int main()

{

    int n,i,j,p,x;

    cin>>n;

    int a[n],b[n];



    for(i=0;i<n;i++)

    {

        scanf("%d",&a[i]);

        b[i] = a[i];

    }

    sort(a,a+n,greater<int>());

    p=a[0];x=a[1];

    for(i=0;i<n;i++)

    {

        if(p== b[i]) printf("%d\n",x);

        else printf("%d\n",p);

    }





    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

int a[300008],b[2000008];

int main(){

    int n;

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

        scanf("%d",a+i),b[i]=a[i];

        sort(b+1,b+n+1);

    for(int i=1;i<=n;i++){

        if(a[i]==b[n]){

            printf("%d\n",b[n-1]);

        }

        else

            printf("%d\n",b[n]);

    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n;

	while(~scanf("%d",&n))

	{

	int i,j;

	int a[200010],b[200010];

	for(i=0;i<=n-1;i++)

	   {

	    scanf("%d",&a[i]);

	    b[i]=a[i];

	   }

	sort(b,b+n);

	if(b[n-1]==b[n-2])

	  for(i=1;i<=n;i++)

	      printf("%d\n",b[n-1]);

	else

	  for(i=0;i<=n-1;i++)

	    {

	      if(a[i]!=b[n-1])

	      printf("%d\n",b[n-1]);

	      else

	      printf("%d\n",b[n-2]);

	    }

    }

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

int a[300008],b[2000008];

int main(){

    int n;

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

        scanf("%d",a+i),b[i]=a[i];

        sort(b+1,b+n+1);

    for(int i=1;i<=n;i++){

        if(a[i]==b[n]){

            printf("%d\n",b[n-1]);

        }

        else

            printf("%d\n",b[n]);

    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;

const int N = 200005;

int arr[N];



int main() {

    //  freopen("in.txt", "rt", stdin);

    int n;

    scanf("%d", &n);

    multiset<int> st;

    for (int i = 0; i < n; ++i) {

        scanf("%d", arr + i);

        st.insert(arr[i]);

    }

    for (int i = 0; i < n; ++i) {

        st.erase(st.find(arr[i]));

        printf("%d\n", *st.rbegin());

        st.insert(arr[i]);

    }

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#define sz 200009

typedef long long ll;

int ar[sz],br[sz];

int i,j,n,r,max=0;

int main()

{

	

	scanf("%d",&n);

	for (i=1; i<=n; i++)

	{

		scanf("%d",&r);

		if (r>max) max=r;

		br[i]=r;

		ar[r]++;

	}

	for (i=1; i<=n; i++)

	{

		for (j=max; ; j-- )

		{

			if (ar[j]>0)

			{

				if (j==br[i]){

			if (br[i]==max && ar[max]==1) continue;}

	         printf("%d\n",j);

	         break;

			}

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;

#define ll long long

const int N=2e5+5;

int a[N];

bool ball[N];

int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);cout.tie(0);

    multiset<int>st;

    int n;

    cin>>n;

    for(int i=0;i<n;i++)

        cin>>a[i],st.insert(a[i]);

    for(int i=0;i<n;i++)

    {

       st.erase(st.find(a[i]));

       cout<<*st.rbegin()<<'\n';

       st.insert(a[i]);

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#define sz 200009

typedef long long ll;

int ar[sz],br[sz];

int i,j,n,r,max=0;

int main()

{

	

	scanf("%d",&n);

	for (i=1; i<=n; i++)

	{

		scanf("%d",&r);

		if (r>max) max=r;

		br[i]=r;

		ar[r]++;

	}

	for (i=1; i<=n; i++)

	{

		for (j=max; ; j-- )

		{

			if (ar[j]>0)

			{

				if (j==br[i]){

			if (br[i]==max && ar[max]==1) continue;}

	         printf("%d\n",j);

	         break;

			}

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



const int max_n = 2e5;



int main()

{

    int n;

    cin >> n;

    pair<int, int> a[max_n];

    for (int i = 0; i < n; ++i)

    {

        int x;

        cin >> x;

        a[i] = make_pair(x, i);

    }



    sort(a, a + n, greater<pair<int, int>>());

    for (int i = 0; i < n; ++i)

    {

        if(a[0].second == i)

        {

            cout << a[1].first << endl;

        } else

        {

            cout << a[0].first << endl;

        }

    }

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using pint = pair<int, int>;

ll N;

vector<ll> A;

vector<ll> B;

const ll INF = 1e12;



int main()

{

    cin >> N;

    A.resize(N);

    for (int i = 0; i < N; ++i)

        cin >> A[i];

    B = A;

    sort(B.begin(), B.end(), greater<ll>());

    for (ll a : A)

    {

        if (B[0] == a)

        {

            cout << B[1] << endl;

        }

        else

        {

            cout << B[0] << endl;

        }

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define me(a,x) memset(a,x,sizeof(a))

#define sc scanf

#define itn int

using namespace std;

const int N=1e6;

const long long mod=1e9+7;

const int oo=0x7fffffff;

const int sup=0x80000000;

typedef long long ll;

typedef unsigned long long ull;

template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}

template <typename it>

string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}

template <typename it>int o(it a){cout<<a<<endl;return 0;}

ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}

ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}

int n;

int a[N];

int pre[N]={0},suf[N]={0};

int main(){

	//freopen("in.txt","r",stdin);

	cin>>n;

	for(itn i=1;i<=n;i++)cin>>a[i];

	for(itn i=1;i<=n;i++){

		pre[i]=max(pre[i-1],a[i]);

	}

	for(int i=n;i>=1;i--)suf[i]=max(suf[i+1],a[i]);

	for(int i=1;i<=n;i++){

		o(max(pre[i-1],suf[i+1]));

	}

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <algorithm>

using namespace std;

const int N=200010;

inline char get()

{

    static char buf[1024];

    static int pos=0,size=0;

    if(pos==size)

    {

        size=fread(buf,1,1024,stdin);

        pos=0;

        if(!size) return EOF;

        else return buf[pos++];

    }

    else return buf[pos++];     

}

int read()

{

    int sum=0,fh=1;

    char ch=get();

    while(!(ch>='0' && ch<='9'))

    {

        if(ch=='-') fh=-1;

        ch=get();

    }

    while(ch>='0' && ch<='9' && ch!=EOF) sum=sum*10+ch-48,ch=get();

    return sum*fh;

}

int n,d[N],ma[N][2];

int main()

{

	n=read();

	for(int i=1;i<=n;i++)

	{

		d[i]=read();

		ma[i][0]=max(ma[i-1][0],d[i]);

	}

	for(int i=n;i>=1;i--)

		ma[i][1]=max(ma[i+1][1],d[i]);

	for(int i=1;i<=n;i++)

		printf("%d\n",max(ma[i-1][0],ma[i+1][1]));

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <algorithm>

#include <iostream>

using namespace std;



const int N = 200003;



int n, a[N], b[N];

int maxx=-1, maxi;

signed main(void)

{

	cin >> n;

	for(int i=1; i<=n; ++i) 

	{



	cin >> a[i];b[i]=a[i];

	if(maxx < a[i])

	{

		maxx = a[i];

		maxi=i;

	 } 

}

sort(b+1, b+n+1);

for(int i=1; i<=n; ++i)

{

	if(i != maxi)printf("%d\n", b[n]);

	else 	printf("%d\n", b[n-1]);

}

	



	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <algorithm>

using namespace std;

const int N=200010;

inline char get()

{

    static char buf[1024];

    static int pos=0,size=0;

    if(pos==size)

    {

        size=fread(buf,1,1024,stdin);

        pos=0;

        if(!size) return EOF;

        else return buf[pos++];

    }

    else return buf[pos++];     

}

int read()

{

    int sum=0,fh=1;

    char ch=get();

    while(!(ch>='0' && ch<='9'))

    {

        if(ch=='-') fh=-1;

        ch=get();

    }

    while(ch>='0' && ch<='9' && ch!=EOF) sum=sum*10+ch-48,ch=get();

    return sum*fh;

}

int n,d[N],ma[N][2];

int main()

{

	n=read();

	for(int i=1;i<=n;i++)

	{

		d[i]=read();

		ma[i][0]=max(ma[i-1][0],d[i]);

	}

	for(int i=n;i>=1;i--)

		ma[i][1]=max(ma[i+1][1],d[i]);

	for(int i=1;i<=n;i++)

		printf("%d\n",max(ma[i-1][0],ma[i+1][1]));

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

using namespace std;

int a[200005];

int b[200005];

int main(void)

{

    int n,mx1,mx2;

    cin >> n;

    for(int i=0;i<n;i++)

    {

        cin >> a[i];

        b[i]=a[i];

    }

    sort(b,b+n);

    mx1=b[n-1];

    mx2=b[n-2];

    for(int i=0;i<n;i++)

    {

        if(a[i]==mx1)

            cout << mx2 << '\n';

        else cout << mx1 << '\n';

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

int a[200005];

int lm[200005];

int rm[200005];

int main(void)

{

    int n;

    scanf("%d" ,&n);

    for(int i=1;i<=n;i++)

    {

        scanf("%d" ,&a[i]);

        lm[i]=max(lm[i-1],a[i-1]);

    }

    for(int i=n;i>=1;i--)

        rm[i]=max(rm[i+1],a[i+1]);

    for(int i=1;i<=n;i++)

        printf("%d\n" ,max(lm[i],rm[i]));

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int a[200005];

int lmax[200005];

int rmax[200005];

int main(void)

{

    int n;

    cin >> n;

    for(int i=1;i<=n;i++)

        cin >> a[i];

    for(int i=1;i<=n;i++)

        lmax[i]=max(lmax[i-1],a[i-1]);

    for(int i=n;i>=1;i--)

        rmax[i]=max(rmax[i+1],a[i+1]);

    for(int i=1;i<=n;i++)

        cout << max(lmax[i],rmax[i]) << '\n';

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

int a[200005];

int lm[200005];

int rm[200005];

int main(void)

{

    int n;

    scanf("%d" ,&n);

    for(int i=1;i<=n;i++)

    {

        scanf("%d" ,&a[i]);

        lm[i]=max(lm[i-1],a[i-1]);

    }

    for(int i=n;i>=1;i--)

        rm[i]=max(rm[i+1],a[i+1]);

    for(int i=1;i<=n;i++)

        printf("%d\n" ,max(lm[i],rm[i]));

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <algorithm>

#include <cmath>

#include <vector>

#include <stdio.h>

#include <set>

#include <map>

#include <unordered_set>

#include <unordered_map>

#include <queue>

#include <ctime>

#include <cassert>

#include <complex>

#include <string>

#include <cstring>

#include <chrono>

#include <random>

#include <queue>

#include <bitset>

#include <iomanip>

using namespace std;





typedef long long ll;

//typedef pair<string, int> pii;

//typedef pair<ll, ll> pll;

typedef vector<int> vi;

//typedef vector<pii> vpi;

typedef vector<vi> vvi;

typedef pair <int,int> pii;

typedef pair <int,pii> pi;

#define fi first

#define se second

#define pb push_back

#define szz(x) (int)x.size()

#define rep(i,n) for(int i=0;i<n;i++)

#define all(x) x.begin(),x.end()

#define sv(v) sort(v.begin(),v.end())

#define floop(a,n) for(int i=a; i<n; i++)

#define max3(a,b,c) max(a, max(b,c))

#define max4(a,b,c,d) max(a, max(b,max(c,d)))

#define min3(a,b,c) min(a, min(b,c))

#define min4(a,b,c,d) min(a, min(b,min(c,d)))

vector <int> v;

string int_to_string(int a){return to_string(a);}

int string_to_int(string s){stringstream x(s);int a=0; x>>a; return a;}

//long long int gcd(long long int a, long long int b){if(a%b==0)return b;return gcd(b, a%b);}

//long long int lcm(long long int a, long long int b){return (a*b)/gcd(a, b);}



//long long int factorial(int a){if(a==0)return 1;elsereturn a*factorial(a-1);}







int main()

{

    map <string,int>mp;

    

    int a,b,c,max=0;

    string s,p;

    

    cin >> a;

    while(a--)

    {

        cin >> s;

        mp[s]++;

    }

    

    cin >> a;

    while(a--)

    {

        cin >> s;

        mp[s]--;

    }

    

    for(auto it = mp.cbegin(); it!=mp.cend(); ++it)

    {

        if(it -> second > max)

            max = it -> second;

    }

    

    cout << max << endl;

    

}




// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

char ch[205][11],str[11];

int s[205];

int main()

{

	int a,b,k=0;

	scanf("%d",&a);

	getchar();

	for(int i=0;i<a;i++)

	{

		scanf("%s",str);

		int flag=0;

		for(int j=0;j<k;j++)

		{

			if(strcmp(ch[j],str)==0)

			{

				flag=1;

				s[j]++;

				break;

			}

		}

		if(flag==0)

		{

			strcpy(ch[k],str);

			s[k]++;

			k++;

		}

	}

	scanf("%d",&b);

	getchar();

	for(int i=0;i<b;i++)

	{

		scanf("%s",str);

		int flag=0;

		for(int j=0;j<k;j++)

		{

			if(strcmp(ch[j],str)==0)

			{

				flag=1;

				s[j]--;

				break;

			}

		}

		if(flag==0)

		{

			strcpy(ch[k],str);

			s[k]--;

			k++;

		}

	}

	int max=0;

	for(int i=0;i<k;i++)if(s[i]>max)max=s[i];

	printf("%d\n",max);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <cstdio>

#include <cstring>

#include <map>

using namespace std;



int main(){

    int n,m;

    map <string,int> ans;

    cin>>n;

    getchar();

    string St;

    for(int i = 0; i < n;i++){

        cin>>St;

        ans[St] ++;

    }

    cin>>m;

    getchar();

    for (int i = 0;i < m;i++){

        cin>>St;

        ans[St]--;

    }

    int result = 0;

    map<string,int> ::iterator iter;

    for (iter = ans.begin();iter!=ans.end();iter++){

        result = max(result,iter->second);

    }

    cout<<result<<endl;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

char ch[205][11],str[11];

int s[205];

int main()

{

	int a,b,k=0;

	scanf("%d",&a);

	getchar();

	for(int i=0;i<a;i++)

	{

		scanf("%s",str);

		int flag=0;

		for(int j=0;j<k;j++)

		{

			if(strcmp(ch[j],str)==0)

			{

				flag=1;

				s[j]++;

				break;

			}

		}

		if(flag==0)

		{

			strcpy(ch[k],str);

			s[k]++;

			k++;

		}

	}

	scanf("%d",&b);

	getchar();

	for(int i=0;i<b;i++)

	{

		scanf("%s",str);

		int flag=0;

		for(int j=0;j<k;j++)

		{

			if(strcmp(ch[j],str)==0)

			{

				flag=1;

				s[j]--;

				break;

			}

		}

		if(flag==0)

		{

			strcpy(ch[k],str);

			s[k]--;

			k++;

		}

	}

	int max=0;

	for(int i=0;i<k;i++)if(s[i]>max)max=s[i];

	printf("%d\n",max);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//https://blog.csdn.net/hesorchen

// #include <bits/stdc++.h>

#include <algorithm>

#include <iostream>

#include <cstring>

#include <map>

#include <cmath>

using namespace std;

#define ll long long

#define endl "\n"

#define mod 1000000007

#define MAX 200005

map<string, int> p;

string a[100005];

int ct;

int main()

{

    int n, m;

    cin >> n;

    string temp;

    while (n--)

    {

        cin >> temp;

        a[ct++] = temp;

        p[temp]++;

    }

    cin >> m;

    while (m--)

    {

        cin >> temp;

        a[ct++] = temp;

        p[temp]--;

    }

    int ans = 0;

    for (int i = 0; i < ct; i++)

        ans = max(ans, p[a[i]]);

    cout << ans << endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

vector<ll>vi;

vector<ll> :: iterator vt;

ll arr[200009];

int main()

{

    ll n,t,x,y,z,j,i,k,m,flag =0,maxi=LONG_LONG_MIN ,mini=LONG_LONG_MAX,sum=0,c=0;

    map<string,ll>mp;

    map<string,ll> :: iterator mt;

    string s, ss;

    cin>>n;

    for(i = 0 ;i<n ;i++)

    {

        cin>>s;

        mp[s]++;

    }

    cin>>m;

    for(i  = 0;i<m ;i++)

    {

        cin>>s;

        mp[s]--;

    }

    for(mt = mp.begin() ;mt!= mp.end() ;mt++)

    {

        maxi = max(mt->second,maxi);

    }

    if(maxi<0)

        maxi = 0;

    cout<<maxi<<endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <map>

using namespace std;

int max(int a, int b) {

    if (a > b) return a;

    return b;

}

typedef long long ll;

map<string, int> m1, m2;

int main() {

    int N, M;

    cin >> N;

    string str;

    for (int i = 0; i < N; ++i) {

        cin >> str;

        m1[str] += 1;

    }

    cin >> M;

    for (int i = 0; i < M; ++i) {

        cin >> str;

        m2[str] += 1;

    }

    int res = 0;



    for (auto it = m1.begin(); it != m1.end(); ++it) {

        str = (*it).first;

        if (m1[str] > m2[str]) {

            res = max((m1[str] - m2[str]), res);

        }

    }



    cout << res;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

char ch[205][11],str[11];

int s[205];

int main()

{

	int a,b,k=0;

	scanf("%d",&a);

	getchar();

	for(int i=0;i<a;i++)

	{

		scanf("%s",str);

		int flag=0;

		for(int j=0;j<k;j++)

		{

			if(strcmp(ch[j],str)==0)

			{

				flag=1;

				s[j]++;

				break;

			}

		}

		if(flag==0)

		{

			strcpy(ch[k],str);

			s[k]++;

			k++;

		}

	}

	scanf("%d",&b);

	getchar();

	for(int i=0;i<b;i++)

	{

		scanf("%s",str);

		int flag=0;

		for(int j=0;j<k;j++)

		{

			if(strcmp(ch[j],str)==0)

			{

				flag=1;

				s[j]--;

				break;

			}

		}

		if(flag==0)

		{

			strcpy(ch[k],str);

			s[k]--;

			k++;

		}

	}

	int max=0;

	for(int i=0;i<k;i++)if(s[i]>max)max=s[i];

	printf("%d\n",max);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define  ll   long long int

#define  sz   20010



using namespace std;





string ss[sz];

string sx[sz];

map<string,ll>mp;

map<string,ll>mp2;



set<string>st;

set<string> :: iterator it;



int main()

{





    ll n,m,i,j,a,b,p;



    cin>>n;



    for(i=1;i<=n;i++)

    {

        cin>>ss[i];

        mp2[ss[i]]++;

        st.insert(ss[i]);

    }





    cin>>m;



    for(i=1;i<=m;i++)

    {

        cin>>sx[i];

        mp[sx[i]]++;

        st.insert(sx[i]);

    }



    ll c=0;





    for(it=st.begin();it!=st.end();it++)

    {

        string s=*it;

        a=mp[s];

        b=mp2[s];

        ll x=(b-a);

        c=max(c,x);

    }



    cout<<c<<endl;



    return 0;

}




// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define ll long long int

using namespace std;



int main()

{

    ll n,m,i,j;

    cin>>n;

    string a;

    map<string,ll>ma;

    map<string,ll>:: iterator it;

    for(i=0; i<n; i++)

    {

        cin>>a;

        ma[a]++;

    }

    cin>>m;

    for(i=0; i<m; i++)

    {

        cin>>a;

        ma[a]--;

    }

    ll x=-999999999999;

    for(it=ma.begin(); it!=ma.end(); it++)

    {

        x=max(x,it->second);

    }

    if(x<0)

    {

        cout<<0<<endl;

    }

    else{

    cout<<x<<endl;}

    return 0;

}


// Fastest known solution for this problem: