stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):


//y09-6 ビンゴ(2回目)

#include <iostream>

#include <fstream>

#include <stdio.h>

#include <math.h>

#include <time.h>

#include <string>

#include <vector>

#include <map>

#include <list>

#include <set>

#include <stack>

#include <queue>

#include <cstdlib>

#include <algorithm>

#include <random>

#include <cassert>

using namespace std;

#define LL long long

#undef INT_MIN

#undef INT_MAX

#define INT_MIN -2147483648

#define INT_MAX 2147483647

#define LL_MIN -9223372036854775808

#define LL_MAX 9223372036854775807

#define segment_size 65536

#define ROOP() while (true)



int main(){

    ROOP(){

        int N,M,S;

        cin >> N >> M >> S;

        if(N==0) return 0;



        int dp[50][3001];

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

            for(int j=0; j<3001; j++){

                dp[i][j] = 0;

            }

        }

        dp[0][0] = 1;



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

            for(int j=N*N; j>=1; j--){

                for(int k=i; k<=S; k++){

                    dp[j][k] += dp[j-1][k-i];

                    dp[j][k] %= 100000;

                }

            }

        }

        cout << dp[N*N][S] << endl;



    }

    return 0;

}






// Optimized solution to the same problem (faster):


//y09-6 ビンゴ(2回目)

#include <iostream>

#include <fstream>

#include <stdio.h>

#include <math.h>

#include <time.h>

#include <string>

#include <vector>

#include <map>

#include <list>

#include <set>

#include <stack>

#include <queue>

#include <cstdlib>

#include <algorithm>

#include <random>

#include <cassert>

using namespace std;

#define LL long long

#undef INT_MIN

#undef INT_MAX

#define INT_MIN -2147483648

#define INT_MAX 2147483647

#define LL_MIN -9223372036854775808

#define LL_MAX 9223372036854775807

#define segment_size 65536

#define ROOP() while (true)



int main(){

    ROOP(){

        int N,M,S;

        cin >> N >> M >> S;

        if(N==0) return 0;

        M = min(M,S);



        int dp[50][3001];

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

            for(int j=0; j<3001; j++){

                dp[i][j] = 0;

            }

        }

        dp[0][0] = 1;



        for(int i=1; i<=N*N; i++){

            for(int j=1; j<=S; j++){

                if(j>=i) dp[i][j] = dp[i-1][j-i] + dp[i][j-i];

                if(j>M) dp[i][j] -= dp[i-1][j-M-1];

                dp[i][j] %= 100000;

                if(dp[i][j]<0) dp[i][j]+=100000;

            }

        }

        cout << dp[N*N][S] << endl;



    }

    return 0;

}






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



using namespace std;



using int64 = long long;

const int64 INF = 1LL << 62;



struct UnionFind

{

  vector< int > data;



  UnionFind(int sz)

  {

    data.assign(sz, -1);

  }



  bool unite(int x, int y)

  {

    x = find(x), y = find(y);

    if(x == y) return (false);

    if(data[x] > data[y]) swap(x, y);

    data[x] += data[y];

    data[y] = x;

    return (true);

  }



  int find(int k)

  {

    if(data[k] < 0) return (k);

    return (data[k] = find(data[k]));

  }



  int size(int k)

  {

    return (-data[find(k)]);

  }

};



int main()

{

  int N, M, A[100000], B[100000];



  cin >> N >> M;

  UnionFind uf(N);

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

    cin >> A[i] >> B[i];

    --A[i], --B[i];

    uf.unite(A[i], B[i]);

  }



  bitset< 100001 > dp;

  dp[uf.size(0)] = true;

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

    if(uf.find(i) == uf.find(1)) continue;

    if(uf.find(i) == uf.find(0)) continue;

    if(uf.find(i) != i) continue;

    dp |= dp << uf.size(i);

  }



  int64 ret = -INF;

  for(int64 i = 1; i < N; i++) {

    if(dp[i]) {

      int64 j = N - i;

      ret = max(ret, i * (i - 1) / 2 + j * (j - 1) / 2);

    }

  }



  cout << ret - M << endl;

}

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

using namespace std;



int main() {

    int n, m;

    cin >> n >> m;

    vector<vector<int>> adj(n);

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

        int a, b;

        cin >> a >> b;

        a--, b--;

        adj[a].push_back(b);

        adj[b].push_back(a);

    }



    vector<bool> visited(n);



    function<void(int)> dfs = [&](int v) {

        visited[v] = true;

        for (int a : adj[v]) {

            if (!visited[a]) {

                dfs(a);

            }

        }

    };



    int cnt1 = 0, cnt2 = 0;

    dfs(0);

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

        if (visited[i]) cnt1++;

    }

    dfs(1);

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

        if (visited[i]) cnt2++;

    }

    cnt2 -= cnt1;

    int rem = n - (cnt1 + cnt2);

    (cnt1 >= cnt2 ? cnt1 : cnt2) += rem;

    long long es = 1ll * cnt1 * (cnt1 - 1) / 2 + 1ll * cnt2 * (cnt2 - 1) / 2;

    cout << es - m << endl;

}

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

using namespace std;

#define endl '\n'

#define pb push_back

#define mp make_pair

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

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

#define mem0(s) memset(s,0,sizeof(s))

#define meminf(s) memset(s,0x3f,sizeof(s))

#define mp_insert(a,b,c) mp.insert(map<pair<int,int>,int>::value_type(make_pair(a,b),c))

double pi=acos(-1);

typedef long long ll;

typedef unsigned long long ull;

inline ll lowbit(ll x){return x&(-x);}

inline ll min(ll a,ll b){return a<b?a:b;}

inline ll max(ll a,ll b){return a>b?a:b;}

const int INF=0x3f3f3f3f,max_n=200005,mod=19260817;

inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}

inline ll pow(ll a,ll b,ll mod){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

ll a[max_n],b[max_n];int x;

vector<int>v[max_n];

ll ans1;

int main()

{

	int n;cin>>n;

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

	{

		cin>>x;

		a[i]=x+i;

		b[i]=i-x;

	}

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

	{

		if(b[i]>=2&&b[i]<=199999)

		{

			v[b[i]].push_back(i);

		}

	}

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

	{

		x=a[i];

		if(x>=2&&x<=199999)

		{

			if(v[x].size()!=0)

			{

				//¶þ·ÖµØÕÒµÚÒ»¸ö´óÓÚiµÄÊý×Ö

				int ll=upper_bound(v[x].begin(),v[x].end(),i)-v[x].begin();

				//cout<<ll<<endl;

				ans1+=v[x].size()-ll;

			}

		}

	}

	cout<<ans1<<endl;

    return 0;

}

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

#include<algorithm>

#define ll long long

using namespace std;

int a[200005],b[200005];

int main()

{

    int n;

    cin>>n;

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

        cin>>a[i];

    ll ans=0;

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

    {

        if(i+a[i]<=n)

            b[a[i]+i]++;

        if(i-a[i]>=0)

            ans+=b[i-a[i]];

    }

    cout<<ans<<endl;

    return 0;

}


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

#include <iostream>

#include <vector>

#include <map>

using namespace std;

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

typedef long long int64;

int P[400000];

int M[200000];



int main() {

	memset(P, 0, sizeof(P));

	memset(P, 0, sizeof(M));

	int N;

	cin >> N;

	int tmp;

	int64 ans = 0;

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

		cin >> tmp;

		if (tmp < 200000) {

			++P[i+tmp];

			if (i-tmp > 0) ++M[i-tmp];

		}

	}

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

		ans += (int64)P[i] * M[i];

	}

	cout << ans << "\n";

	return 0;

}


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

#include <iostream>

#include <vector>

#include <map>

using namespace std;

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

typedef long long int64;

int P[200000] = {0,};

int M[200000] = {0,};



int main() {

	//memset(P, 0, sizeof(P));

	//memset(P, 0, sizeof(M));

	int N;

	cin >> N;

	int tmp;

	int64 ans = 0;

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

		cin >> tmp;

		if (i+tmp < 200000) ++P[i+tmp];

		if (i-tmp > 0) ++M[i-tmp];

	}

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

		ans += (int64)P[i] * M[i];

	}

	cout << ans << "\n";

	return 0;

}


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

#include <iostream>

#include <vector>

#include <map>

using namespace std;

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

typedef long long int64;

int P[200000];

int M[200000];



int main() {

	memset(P, 0, sizeof(P));

	memset(P, 0, sizeof(M));

	int N;

	cin >> N;

	int tmp;

	int64 ans = 0;

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

		cin >> tmp;

		if (i+tmp < 200000) ++P[i+tmp];

		if (i-tmp > 0) ++M[i-tmp];

	}

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

		ans += (int64)P[i] * M[i];

	}

	cout << ans << "\n";

	return 0;

}


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

#include <iostream>

#include <vector>

#include <map>

using namespace std;

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

typedef long long int64;

int P[200000] = {0,};

int M[200000] = {0,};



int main() {

	//memset(P, 0, sizeof(P));

	//memset(P, 0, sizeof(M));

	int N;

	cin >> N;

	int tmp;

	int64 ans = 0;

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

		cin >> tmp;

		if (i+tmp < 200000) ++P[i+tmp];

		if (i-tmp > 0) ++M[i-tmp];

	}

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

		ans += (int64)P[i] * M[i];

	}

	cout << ans << "\n";

	return 0;

}


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

#define ll long long

#define N 5010

#define mod 1000000007

using namespace std;

ll jc[N],inv[N];

ll K(ll x,int y=mod-2){

	ll t=1; for (;y;y>>=1,x=x*x%mod) if (y&1) t=t*x%mod; return t;

}

ll C(int x,int y){

	return jc[x]* inv[y]%mod *inv[x-y]%mod;

}

void U(ll &x,int y){

	if ((x+=y)>=mod) x-=mod;

}



int a[N],tot,cnt; ll f[N],g[N];

ll doit(int cc=cnt){

	memset(f,0,sizeof f); f[0]=1; tot=0;

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

		memset(g,0,sizeof g);

		for (int j=0;j<=a[i];++j)

			for (int k=tot;~k;--k)

				U(g[k+j],f[k]*C(a[i],j)%mod*C(a[i],j)%mod*jc[j]%mod);

		tot+=a[i];

		memcpy(f,g,sizeof g);

	}

	for (int i=tot;~i;--i) f[i]=f[i]*jc[tot-i]%mod;

	for (int i=tot;~i;--i){

		for (int j=i-1;~j;--j)

			U(f[j],mod-f[i]*C(i,j)%mod);

	}

	return f[0];

}



int n,x,y,sz[N]; vector<int>G[N];

void dfs(int x,int fff){

	int mx=0; sz[x]=1;

	for (auto y:G[x]) if (y-fff){

		dfs(y,x); sz[x]+=sz[y];

		mx=max(mx,sz[y]);

	}

	mx=max(mx,n-sz[x]);

	if (mx*2==n) exit(0*printf("%lld",jc[mx]*jc[mx]%mod));

	if (mx*2>n) return;

	for (auto y:G[x]) if (y-fff) a[++cnt]=sz[y];

	if (x-1) a[++cnt]=n-sz[x]; a[++cnt]=1;

	exit(0*printf("%lld",(doit()+doit(cnt-1))%mod));

}



int main(){

	jc[0]=1; for (int i=1;i<N;++i) jc[i]=jc[i-1]*i%mod;

	inv[N-1]=K(jc[N-1]); for (int i=N;i--;) inv[i-1]=inv[i]*i%mod;

	cin>>n;

	for (int i=n;--i;) cin>>x>>y, G[x].push_back(y), G[y].push_back(x);

	dfs(1,0);

}

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

#define ll long long

#define N 5010

#define mod 1000000007

#define rep(i,l,r) for (int i=l;i<=r;++i)

using namespace std;

ll jc[N],inv[N],f[N],g[N],res;

int n,x,y,sz[N],a[N],tot,cnt;

vector<int>G[N];

ll K(ll x,int y=mod-2){

	ll t=1; for (;y;y>>=1,x=x*x%mod) if (y&1) t=t*x%mod; return t;

}

ll C(int x,int y){

	return jc[x]* inv[y]%mod *inv[x-y]%mod;

}

void U(ll &x,ll y){

	if ((x+=y)>=mod) x%=mod;

}



void dfs(int x,int fa){

	int mx=0; sz[x]=1;

	for (auto y:G[x]) if (y-fa)

		dfs(y,x), sz[x]+=sz[y], mx=max(mx,sz[y]);

	mx=max(mx,n-sz[x]);

	if (mx*2==n) exit(!(cout<<jc[mx]*jc[mx]%mod));

	if (mx*2>n) return;

	for (auto y:G[x]) if (y-fa) a[++cnt]=sz[y];

	if (x-1) a[++cnt]=n-sz[x];

	memset(f,0,sizeof f); f[tot=0]=1;

	rep(i,1,cnt){

		memset(g,0,sizeof g);

		rep(j,0,a[i]) rep(k,0,tot)

			U(g[k+j],f[k]*C(a[i],j)%mod*C(a[i],j)%mod*jc[j]%mod);

		memcpy(f,g,sizeof g);

		tot+=a[i];

	}

	rep(i,0,tot) U(res,mod+(i&1?-1:1)*f[i]*jc[n-i]%mod);

	exit(!(cout<<res));

}



int main(){

	jc[0]=1; rep(i,1,N-1) jc[i]=jc[i-1]*i%mod;

	inv[N-1]=K(jc[N-1]); for(int i=N;i--;) inv[i-1]=inv[i]*i%mod;

	cin>>n;

	rep(i,1,n-1) cin>>x>>y, G[x].push_back(y), G[y].push_back(x);

	dfs(1,0);

}

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

#include <vector>

#include <utility>

#include <algorithm>



int main() {

  int N;

  scanf("%d", &N);



  std::vector<std::pair<int, int>> AB(N);

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

    scanf("%d %d", &AB[i].first, &AB[i].second);



  std::sort(AB.begin(), AB.end());

  printf("%d\n", AB.back().first+AB.back().second);

  

  return 0;

}


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



int main() {

  int n;

  scanf("%d", &n);



  int max_a = 0;

  int res = 0;

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

    int a, b;

    scanf("%d %d", &a, &b);

    if (a > max_a) {

      max_a = a;

      res = a + b;

    }

  }

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

}


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

#include <string>

#include <algorithm>

#include <iomanip>

#include <vector>

#include <map>

#include <cmath>

#include <queue>

#include <utility>

#include <functional>

#include <deque>

#include <cctype>

#include <stack>

#include <bitset>



using ll = long long;

typedef unsigned long long ull;

typedef std::pair<ll, ll>P;

struct edge { ll to, cost; };

std::vector<edge>v[100010], w[100010];

typedef std::vector<std::vector<int>>ma;



ll min(ll a, ll b) {

	if (a >= b)return b;

	else return a;

}

ll max(ll a, ll b) {

	if (a >= b)return a;

	else return b;

}

ll gcd(ll a, ll b) {

	if (b == 0) return a;

	return gcd(b, a%b);

}

ll lcm(ll a, ll b) {

	ll g = gcd(a, b);

	return a / g * b;

}



const ll Z = 1000000007;

const ll INF = 1 << 30;

const ll INF2 = 9000000000000000000LL;

bool flag = true;

bool fl = true;

bool f = true;

int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

std::string abc = "abcdefghijklmnopqrstuvwxyz";



int main() {

	int n, a[100000], b[100000], ans = 0, ma = 0, mi = INF;

	std::cin >> n;

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

		std::cin >> a[i] >> b[i];

		mi = min(b[i], mi);

		if (mi == b[i])ma = a[i];

	}

	std::cout << ma + mi << std::endl;

}

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



using namespace std;

using ll=long long;

using ull=unsigned long long;



typedef pair<int,int>Pi;

typedef pair<long long,long long>P;

typedef pair<long long,P>PP;

typedef pair<P,P>PPP;



const long long MOD=1e9+7;

const long long INF=5e18;

const int di[4]={1,0,-1,0};

const int dj[4]={0,1,0,-1};



#define fr first

#define sc second

#define pb push_back

#define eb emplace_back

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

#define ALLR(x) (x).rbegin(),(x).rend()



int n,a,b,mx,le;



void input(){

	cin>>n;

	return;

}



void solve(){

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

		cin>>a>>b;

		if(a>=mx)mx=a,le=b;

	}

	cout<<le+mx<<endl;

	return;

}



int main(){

	input();

	solve();

	return 0;

}

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

using namespace std;

string f="snuke";

int main()

{

	int h,w;

	int x,y;

	string n[100][100];

	cin>>h>>w;

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

	{

		for(int j=1;j<=w;j++)

		{

			cin>>n[i][j];

			if(n[i][j]==f)

			{

				x=i;

				y=j;

			}

		}

	}

	char z='A'+y-1;

	cout<<z<<x<<endl;

 	return 0;

}


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

using namespace std;

string s;

int a,b,c,sum=0;

int main(){

    scanf("%d %d",&a,&b);

    for(int i=1;i<=a*b;i++){

        cin>>s;sum++;

        if(s=="snuke")break;

    }

    c=sum%b==0?b:sum%b;

    printf("%c%.0lf",64+c,ceil((sum+0.00)/b));

    return 0;

}

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

#include<string>

#include<string.h>

#include<algorithm>

#include<stdio.h>

#include<cmath>

#include<vector>

#include<utility>

#include<stack>

#include<queue>

#include<list>

#include<bitset>

#include<functional>



#define FOR(i, a, b) for(int i=(a);i<=(b);i++)

#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)

#define MOD 1000000007

#define INF 1000000000



using namespace std;





int main(void) {

	int n;

	int a, dp[100001] = {};

	int count = 0;



	cin >> n;

	FOR(i, 1, n) {

		cin >> a;

		dp[a]++;

	}

	FOR(i, 1, 100000) {

		if (dp[i] != 0) {

			count++;

		}

	}



	if (count % 2 == 0) {

		cout << count - 1 << endl;

	}

	else {

		cout << count << endl;

	}

	return 0;

}

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

#include<vector>

#include<algorithm>



using namespace std;



int main(void) {

	int n;



	cin >> n;



	vector<int> a(n);



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

		cin >> a[i];

	}



	sort(a.begin(), a.end());

	

	a.erase(unique(a.begin(), a.end()),a.end());



	if (a.size() % 2 == 0) {

		cout << a.size()-1 << endl;

	}

	else {

		cout << a.size() << endl;

	}

	return 0;

}

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



using namespace std;



int main() {

  int n;

  set<int> st;

  scanf("%d", &n);

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

    int x;

    scanf("%d", &x);

    st.insert(x);

  }

  int dd = n - (int)st.size();

  if (dd & 1) dd ++;

  printf("%d\n", n - dd);

  return 0;

}


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

#define N (100010)

int s[N];

int main(){	

	int n;

	scanf("%d",&n);

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

		scanf("%d",&a);

		s[a]++;

	}

	int cnt=0;

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

		if (s[i]>1) cnt+=s[i]-1;

	}

	printf("%d\n",n-cnt-(cnt&1));

}

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



typedef long long LL;



using namespace std;



int N,S[100010],A[100010];

int L = 0, R = 0;



int main()

{

	scanf("%d",&N);

	int ans = 0;

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

	{

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

		if (!S[A[i]]) ans++;

		S[A[i]]++;

	}

	if ((N-ans)&1) ans--;

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

}

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

#define N (100010)

int s[N];

int main(){	

	int n;

	scanf("%d",&n);

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

		scanf("%d",&a);

		s[a]++;

	}

	int cnt=0;

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

		if (s[i]>1) cnt+=s[i]-1;

	}

	printf("%d\n",n-cnt-(cnt&1));

}

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

#include<map>

#include<stack>

#include<queue>

#include<deque>

#include<cmath>

#include<cstdio>

#include<cctype>

#include<string>

#include<vector>

#include<cstdlib>

#include<cstring>

#include<sstream>

#include<iostream>

#include<algorithm>

#define MAXN 100000



using namespace std;

int a[MAXN+80];

deque<int>q;

int main()

{

	int n,i,j,ans=0;

	scanf("%d",&n);

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

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

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

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

		q.push_back(a[i]);

	while(q.size())

	{

		do{

			i=q.front();

			q.pop_front();

			ans++;

		}while(q.size()&&i^q.front());

		if(q.empty())

			break;

		do{

			j=q.back();

			q.pop_back();

			ans++;

		}while(q.size()&&j^q.back());

		if(q.empty()||(i==q.front()&&j==q.back()))

			ans-=2;

	}

	printf("%d",ans);

	return 0;

}

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

#define N (100010)

int s[N];

int main(){	

	int n;

	scanf("%d",&n);

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

		scanf("%d",&a);

		s[a]++;

	}

	int cnt=0;

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

		if (s[i]>1) cnt+=s[i]-1;

	}

	printf("%d\n",n-cnt-(cnt&1));

}

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

#include<iostream>  

#include<algorithm>  

#include<cstdlib>  

#include<cstring>

#include<string>

#include<climits>

#include<vector>

#include<cmath>

#define LL long long



using namespace std;



int wt,ss[19];

inline void print(int x){

	if (x<0) x=-x,putchar('-'); 

	if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}

}

inline void print(LL x){

	if (x<0) x=-x,putchar('-');

	if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}

}



 int n,a[100010];



int main()

{

	cin>>n;

    int x=0,y=0,ans=0;

    memset(a,0,sizeof(a));

    while(n--)

    {

        cin>>y;

        if(a[y]) x++;else a[y]++,ans++;

    }

    if(x%2) ans--;

    cout<<ans<<endl;

}

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

#include<cstdlib>

#include<algorithm>

using namespace std;



const int N=100005;



int n,a[N];

int cnt[N];



int main(){

  int ans=0,tot=0;

  scanf("%d",&n);

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

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

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

    if (cnt[i]){

      ans++;

      if (cnt[i]>3)

	cnt[i]=cnt[i]&1?1:2;

      if (cnt[i]==2)

	tot++;

    }

  if (tot&1)

    printf("%d\n",ans-1);

  else

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

  return 0;

}


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

#include <map>

#include <queue>

#include <ctime>

#include <cmath>

#include <cstdio>

#include <vector>

#include <string>

#include <cctype>

#include <bitset>

#include <cstring>

#include <cstdlib>

#include <utility>

#include <iostream>

#include <algorithm>

#define REP(i,a,b) for(int i=(a);i<=(b);i++)

#define PER(i,a,b) for(int i=(a);i>=(b);i--)

#define RVC(i,S) for(int i=0;i<(S).size();i++)

#define RAL(i,u) for(int i=fr[u];i!=-1;i=e[i].next)

using namespace std;

typedef long long LL;

typedef pair<int,int> pii;

     

template<class T> inline

void read(T& num) {

    bool start=false,neg=false;

    char c;

    num=0;

    while((c=getchar())!=EOF) {

        if(c=='-') start=neg=true;

        else if(c>='0' && c<='9') {

            start=true;

            num=num*10+c-'0';

        } else if(start) break;

    }

    if(neg) num=-num;

}

/*============ Header Template ============*/

 

const int maxn=(int)(1e5)+5;

int cnt[maxn],now[2];

 

int main() {

    int n;

    read(n);

    REP(i,1,n) {

        int x;

        read(x);

        cnt[x]++;

    }

    int mx=(int)(1e5);

    REP(i,1,mx) if(cnt[i]) {

        if(cnt[i]&1) now[1]++;

        else now[0]++;

    }

    if(now[0]&1) now[1]--;

    printf("%d\n",now[1]+now[0]);

    return 0;

}

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

using namespace std;

int a[100005]={0};

int main(){

    int t;

    cin>>t;

    int cnt=0;

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

        int q;

        cin>>q;

        a[q]++;

        if(a[q]>1) cnt++;

    }

    int ans=0;

    if(cnt%2==0) ans=t-cnt;

    else if(cnt%2==1) ans=t-cnt-1;

    cout<<ans;

    return 0;

}

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

#include <cstdio>

#include <algorithm>

using namespace std;



int barrel[200000];



int main() {

    int n;

    cin >> n;

    int t;

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

        scanf("%d", &t);

        barrel[t]++;

    }

    int cnt = 0;

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

        if(barrel[i] > 1) {

            cnt += barrel[i] - 1;

        }

    }

    if(cnt % 2 == 1) {

        cnt++;

    }

    cout << n-cnt << endl;

}


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

#include<string.h>

#include<algorithm>

#include<map>

#include<stdio.h>

using namespace std;

int main() {

	int tmp;

	int n;

	scanf("%d", &n);

		map<int, int> a;

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

			scanf("%d", &tmp);

			a[tmp]++;

		}

		int k = a.size();

		if (k % 2 == 1)printf("%d\n", k);

		else printf("%d\n", k - 1);



	return 0;

}


// Fastest known solution for this problem: