akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define A first
#define B second
#define MOD 1000000007

typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;

int mulmd(ll a, ll b){
    ll ret = (a * b) % MOD;
    return (int)ret;
}

inline int power(ll x, ll y, int p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = mulmd(res, x);
        y = y >> 1;
        x = mulmd(x, x);
    }
    return (int)res;
}

int submd(ll a, ll b){
    ll ret = a - b;
    if(ret < 0){
        ret += MOD;
    }
    return (int)ret;
}

int addmd(ll a, ll b){
    ll ret = (a + b) % MOD;
    return (int)ret;
}

int invPow(ll a){
    return power(a, MOD - 2, MOD);
}

const int N = 1e5 + 5;

int arr[N];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    int f = 0;
    REP(i, s.size()){
        if(i % 2 == 0){
            if(s[i] == 'L') {
                f = 1;
                break;
            }
        }
        else {
            if(s[i] == 'R'){
                f = 1;
                break;
            }
        }
    }
    if(f == 1){
        cout << "No";
    }
    else {
        cout << "Yes";
    }

}

/**
    Check out for boundary cases, (n = 1 or n = 0)
    check for integer overflow

**/



Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;

int main()
{
	long long sum = 0;
	int N, a, b, g, s, bai, q, m, h, u;
	scanf("%d %d %d", &N, &a, &b);
	if(a > b) { u = a; a = b; b = u;} 
	m = N / 10;
	if(m == 0) {
		for(int i = 1; i <= N; i++) {
			if(i <= b && i >= a) sum = sum + i;
		}
	}
	else if(m < 10) {
		for(int i = 1; i < 10; i++)
			if(i <= b && i >= a) sum = sum + i;
		for(int i = 10;i <= N; i++) {
			int k , w;
			k = w = i;
			s = w / 10;
			g = k % 10;
			h = s + g;
			if(h <= b && h >= a) sum = sum + i;
		}
	}
	else if(m < 100) {
		for(int i = 1; i < 10; i++)
			if(i <= b && i >= a) sum = sum + i;
		for(int i = 10; i < 100; i++) {
			int w, t;
			w = t = i;
			s = w / 10;
			g = t % 10;
			h = s + g;
			if(h <= b && h >= a) sum = sum + i;
		}
		for(int i = 100; i <= N; i++) {
			int w,t,r;
			w = r = t = i;
			g = w % 10;
			s = (t / 10) % 10;
			bai = r / 100;
			h = g + s + bai;
			if(h <= b && h >= a) sum = sum + i;
		}
	}
	else if(m >= 100) {
		for(int i = 1; i < 10; i++)
			if(i <= b && i >= a) sum = sum + i;
		for(int i = 10; i < 100; i++) {
			int w,t;
			w = t = i;
			s = w / 10;
			g = t % 10;
			h = s + g;
			if(h <= b && h >= a) sum = sum + i;
		}
		for(int i = 100; i < 1000; i++) {
			int w,r,t;
			w = r = t = i;
			g = w % 10;
			s = (r / 10) % 10;
			bai = t / 100;
			h = g + s + bai;
			if(h <= b && h >= a) sum = sum + i;
		}
		if(m != 1000) {
		for(int i = 1000; i <= N; i++) {
			int w, r, t, z;
			w = r = t = z = i;
			g = w % 10;
			s = (r / 10) % 10;
			bai = t / 100 % 10;
			q = z / 1000;
			h = g + s + bai + q;
			if(h <= b && h >= a) sum = sum + i;
		}
		}
		if(m == 1000) {
			for(int i = 1000; i <= 9999; i++) {
			int w, r, t, z;
			w = r = t = z = i;
			g = w % 10;
			s = (r / 10) % 10;
			bai = t / 100 % 10;
			q = z / 1000;
			h = g + s + bai + q;
			if(h <= b && h >= a) sum = sum + i;
			}
			if(1 >= a && a <= b) sum = sum + 10000;
		}
	}
	printf("%lld\n", sum);
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        System.out.println(str);
    }

    public static void main(String[] args) {

        String S;


        try (Scanner sc = new Scanner(System.in)) {
            S = sc.next();
        }
        char[] clist = S.toCharArray();
        int result = 0;
        for(int i = 1;i < clist.length;i++){
            if(clist[i] != clist[i-1]){
                result++;
            }
        }


        System.out.println(result);
    }

}


Measured memory_bytes: 26056
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++) 

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<char> Vc;
typedef vector<double> Vd;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int>> VVi;
typedef vector<vector<ll>> VVl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }
inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

const int inf = 1 << 30;
const ll linf = 1LL << 60;
const int MOD = 1000000007;

#include <set>
ll n;
Vl vi;

void init()
{
	cin >> n;
	vi.resize(n + 1);

	REP(i, n)
	{
		ll x;
		cin >> x;
		vi[x] = i + 1;
	}
}


int main()
{
	init();

	ll ans = 0;
	multiset<ll> s;

	s.insert(0); s.insert(0);
	s.insert(n + 1); s.insert(n + 1);

	for (ll x = n; x >= 1; --x)
	{
		auto it = s.lower_bound(vi[x]);
		ll i_r = *it++;
		ll i_rr = *it--;
		ll i_l = *(--it);
		ll i_ll = *(--it);

		ans += (vi[x] - i_l) * (i_rr - i_r) * x;
		ans += (i_r - vi[x]) * (i_l - i_ll) * x;

		s.insert(vi[x]);
	}

	cout << ans << endl;
}


Measured memory_bytes: 5760
#include <stdio.h>
#include <string.h>
int main(void){
    char c[100];
    int flag=0;
    scanf("%s",c);
    for(int i=0;c[i]!='\0';i++){
        if(i%2==0 && c[i]=='L' || i%2==1 && c[i]=='R'){
            flag = 1;
            break;
        }
    }
    if(flag) printf("No\n");
    else printf("Yes\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

struct Task
{
	Task() {}
	Task(string& name, int time) : name(name), time(time) {}

	string name;
	int time;
};

class Queue
{
private:
	struct Data
	{
		Task data;
		Data* pNext;
		Data* pPrev;
	};

public:
	Queue()
	{
		m_size = 0;
		m_pHead = new Data();
		m_pHead->pPrev = 0;
		m_pTail = new Data();
		m_pTail->pNext = 0;

		m_pHead->pNext = m_pTail;
		m_pTail->pPrev = m_pHead;
	}

	~Queue()
	{
		Data* pCurrent = m_pHead;
		while (pCurrent)
		{
			Data* pTemp = pCurrent;
			pCurrent = pCurrent->pNext;
			delete pTemp;
		}
		m_pHead = 0;
		m_pTail = 0;
	}

	void Push(const Task& value)
	{
		Data* pTemp = new Data();
		pTemp->data = value;

		m_pTail->pPrev->pNext = pTemp;
		pTemp->pPrev = m_pTail->pPrev;
		pTemp->pNext = m_pTail;
		m_pTail->pPrev = pTemp;

		++m_size;
	}

	void Pop()
	{
		if (!m_pHead || !m_pHead->pNext) return;
		
		Data* pTop = m_pHead->pNext;
		Data* pNext = pTop->pNext;
		delete pTop;
		m_pHead->pNext = pNext;
		pNext->pPrev = m_pHead;

		--m_size;
	}

	Task& Top()
	{
		return m_pHead->pNext->data;
	}

	bool IsEmpty()
	{
		return m_size == 0;
	}

private:
	Data* m_pHead;
	Data* m_pTail;
	int m_size;
};

int main()
{
	Queue tasks;

	int n, q;
	cin >> n >> q;
	string name;
	int time;
	for (int i = 0; i < n; ++i)
	{
		cin >> name;
		cin >> time;
		tasks.Push(Task(name, time));
	}

	int overtime = 0;
	while (!tasks.IsEmpty())
	{
		if (tasks.Top().time <= q)//执行时间小于等于规定时间
		{
			overtime += tasks.Top().time;
			cout << tasks.Top().name << " " << overtime << endl;
			tasks.Pop();
		}
		else
		{
			overtime += q;
			tasks.Top().time -= q;
			Task t = tasks.Top();
			tasks.Pop();
			tasks.Push(t);
		}
	}

	return 0;
}


Measured memory_bytes: 7804
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    string t = "";
    for (auto c : s)
    {
        if (c == 'S')
        {
            t += c;
        }
        else
        {
            if (!t.empty() && t.back() == 'S') t.pop_back();
            else t += c;
        }
    }
    cout << t.size() << '\n';
}


Measured memory_bytes: 916
def comb(n, m, p=10**9+7):
    if n < m:
        return 0
    if n < 0 or m < 0:
        return 0
    m = min(m, n-m)
    top = bot = 1
    for i in range(m):
        top = top*(n-i) % p
        bot = bot*(i+1) % p
    bot = pow(bot, p-2, p)
    return top*bot % p


x, y = map(int, input().split())

j = 2*x-y
if j % 3:
    print(0)
    exit()
j //= 3
i = x - 2*j
if i < 0 or j < 0:
    print(0)
    exit()

ans = comb(i+j, i)
print(ans)


Measured memory_bytes: 38512
import std.stdio;
import std.math;

void main(){
	int n, id, ans;
	double h, w, best, diff;
	while (readf("%d\n", &n), n) {
		best = 99999999;
		foreach (i; 0..n) {
			readf("%d %s %s\n", &id, &h, &w);
			diff = abs(22.0-w*100*100/(h*h));
			if (diff < best || (diff == best && ans > id)) {
				ans = id;
				best = diff;
			}
		}
		writeln(ans);
	}
}

Measured memory_bytes: 1012
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    //vector<pair<int,int> > v;
    int b[n];
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        //v.pb(make_pair(a,i));
        b[i]=a[i];
    }
    sort(b,b+n);
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]!=b[i]){
            ans++;
        }

    }
    if(ans==0||ans==2){
        cout << "YES"<<endl;
    }
    else{
        cout << "NO"<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string.h>

using namespace std;

int main(void)
{
	int a[5], k;
	for(int i=0; i < 5; i++) cin >> a[i];
	cin >> k;

	for (int i = 0; i < 5; i++)
	{
		for (int j = 0; i < 5; i++)
		{
			if (abs(a[i] - a[j]) > k) goto ERR;
		}
	}

	cout << "Yay!" << endl;
	return 0;

	ERR:
	cout << ":(" << endl;

}


Measured memory_bytes: 256
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<algorithm>
#include<unordered_map>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
//#include<ext/rope>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;
const double PI=acos(-1.0);
const double eps=1e-6;
int ans[100005];
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
template<typename T> void debug(T x)
{
    cout<<"value="<<x<<endl;
    return;
}
signed main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    for(int x=1;x<=100;x++){
        for(int y=1;y<=100;y++){
            for(int z=1;z<=100;z++){
                ans[x*x+y*y+z*z+x*y+y*z+z*x]++;
            }
        }
    }
	int n=read();
	for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
	return 0;
}


Measured memory_bytes: 3952
#include <bits/stdc++.h>

using namespace std;

int main()
{

    string S;
    cin >> S;
    long long int L = S.length();

    long long int maxi = 100005;

    long long int T  = 1;

    for (long long int i=0;i<L;i++)
    {
        if (S[i]!=S[i+1])
        {
            maxi = min(maxi,max(T,L-T));
        }
        T++;
    }

    cout << maxi <<"\n";



    return 0;
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;



int main() {
	int n, m; cin >> n >> m;
	vector<int> dp(n + 1, 0);
	dp[0] = 1;
	rep(i, 0, m) {
		int p; cin >> p;
		dp[p] = -1;
	}
	if (dp[1] >= 0) dp[1] = 1;
	rep(i, 2, n + 1) {
		if (dp[i] >= 0) {
			if (dp[i - 1] >= 0 && dp[i - 2] >= 0)dp[i] = (dp[i - 1] + dp[i - 2])%mod;
			else if (dp[i - 1] >= 0) dp[i] = dp[i - 1];
			else if (dp[i - 2] >= 0) dp[i] = dp[i - 2];
		}
	}
	printf("%d", dp[n]);
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
    int q;
    cin >> q;
    map<string, int> map;
    while (q--)
    {
        int c;
        cin >> c;
        if (c == 0)
        {
            string key;
            int x;
            cin >> key >> x;
            map[key] = x;
        } else if (c == 1)
        {
            string key;
            cin >> key;
            auto it = map.find(key);
            if (it != map.end())
            {
                cout << it->second << endl;
            } else cout << 0 << endl;
        } else if(c==2)
        {
            string key;
            cin>>key;
            map.erase(key);
        } else
        {
            string L,R;
            cin>>L>>R;
            auto its=map.lower_bound(L);
            auto ite=map.upper_bound(R);
            for (auto i = its; i !=ite ; ++i)
            {
                cout<<i->first<<" "<<i->second<<endl;
            }
        }

    }

}


Measured memory_bytes: 27820
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int dp[500001][4]; // 0 のこってない。1ひとつのこっている。2 -1個のこっている。3まるまるのこっている
const int INF = 1e9;

int main(){
    
    int N;
    cin >> N;
    int S[500000];
    for(int i = 0; i < N; i++){
        char c;
        cin >> c;
        S[i] = c - '0';
    }
    vector<int> v;
    int ans = 0;
    int cnt = 0;
    for(int i = 0; i < N; i++){
        if(S[i] == 1) cnt++;
        if(i == 0) continue;
        if((S[i-1] == 0 && S[i] == 0) || i == N-1){
            if(i == N-1 && cnt != 0) v.push_back(cnt);
            if(S[i-1] == 0 || i ==  N-1){
                if(v.size() > 1){ 
                    if(v[1] == 1){
                        dp[1][0] = v[0];
                        dp[1][1] = 0;
                        dp[1][2] = -INF;
                        dp[1][3] = 0;
                    }else{
                        dp[1][0] = v[1];
                        dp[1][1] = v[1]-1;
                        dp[1][2] = v[0];
                        dp[1][3] = 0;
                    }
                    for(int j = 2; j < v.size(); j++){
                        if(v[j] == 1){
                            dp[j][0] = max({dp[j-1][1]+1,   dp[j-1][2]+v[j-1]-1,    dp[j-1][3]+v[j-1]});
                            dp[j][1] = max({dp[j-1][0],     dp[j-1][1],             dp[j-1][2],         dp[j-1][3]});
                            dp[j][2] = -INF;
                            dp[j][3] = max({dp[j-1][0], dp[j-1][1], dp[j-1][2], dp[j-1][3]});
                        }else{
                            dp[j][0] = max({dp[j-1][1]+v[j],    dp[j-1][2]+v[j],        dp[j-1][3]+v[j]});
                            dp[j][1] = max({dp[j-1][1]+v[j]-1,  dp[j-1][2]+v[j]-1,      dp[j-1][3]+v[j]-1});
                            dp[j][2] = max({dp[j-1][1]+1,       dp[j-1][2]+v[j-1]-1,    dp[j-1][3]+v[j-1]});
                            dp[j][3] = max({dp[j-1][0],         dp[j-1][1],             dp[j-1][2],             dp[j-1][3]});
                        }
                    }
                    // for(int j = 0; j < v.size(); j++){
                    //     cout << v[j] << ' ';
                    // }
                    // cout << endl;
                    int s = v.size();
                    ans += max({dp[s-1][0], dp[s-1][1], dp[s-1][2], dp[s-1][3]});
                    // cout << ans << endl;
                }   
                v.clear();
            }
        }
        if(S[i-1] == 1 && S[i] == 0){
            v.push_back(cnt);
            cnt = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 19;
const lint linf = 0x3f3f3f3f3f3f3f3f;

int n;
lint val[_];

inline lint dfs(int l,int r,lint lx,lint rx)
{
	if(l+1>=r)return 0;
	lint sx=lx+rx,mi=linf;
	for(int i=l+1;i<r;i++)mi=min(mi,dfs(l,i,lx,sx)+dfs(i,r,sx,rx)+sx*val[i]);
	return mi;
}

int main()
{
	n=ty();
	for(int i=1;i<=n;i++)val[i]=ty();
	printf("%lld\n",dfs(1,n,1,1)+val[1]+val[n]);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define MAP map<int,int>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e17;

void ANS(bool flag){
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Ans(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void ans(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	int A ,B ,C;
	cin >> A >> B >> C;
	Ans(A + B >= C);
	return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct ii {
    int a, b;
    bool operator < (ii o) const {
        return tie(a, b) < tie(o.a, o.b);
    }
};
struct iii {
    int a, b, c;
    bool operator < (iii o) const {
        return tie(a, b, c) < tie(o.a, o.b, o.c);
    }
};

const int MOD = 1000000007;
const int INF = 1000000000;
const int MAXN = 1000005;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    int N;
    cin >> N;
    string s;
    cin >> s;
    int cntR= 0;
    for (int i =0; i < N; i++) {
        if (s[i] == 'R') cntR++;
    }
    int cntWinR = 0;
    for (int i = 0; i < cntR; i++) {
        if (s[i] == 'W') cntWinR++;
    }
    cout << cntWinR << "\n";
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

struct point {
  ll x, y;
  point(){};
  point(ll a, ll b) {
    x = a;
    y = b;
  }
};

bool comp_x(point p, point q) {
  if (p.x != q.x) {
    return p.x < q.x;
  } else {
    return p.y < q.y;
  }
}

bool comp_y(point p, point q) {
  if (p.y != q.y) {
    return p.y < q.y;
  } else {
    return p.x < q.x;
  }
}

ll N, M;
priority_queue<ll> A;
priority_queue<ll, vector<ll>, greater<ll>> A2;
vector<point> P;

void solve() {
  sort(P.rbegin(), P.rend(), comp_y);
  ll res = 0;
  for (int i = 0; i < N; i++) {
    ll a = A.top();
    if (a >= P[0].y) {
      res += a;
      A.pop();
    } else {
      break;
    }
  }
  while (!A.empty()) {
    ll a = A.top();
    A.pop();
    A2.push(a);
  }

  for (int i = 0; i < M; i++) {
    if (A2.empty()) {
      break;
    }
    ll a = A2.top();
    while (!A2.empty() && a <= P[i].y && P[i].x > 0) {
      A2.pop();
      res += P[i].y;
      P[i].x--;
      a = A2.top();
    }
  }

  while (!A2.empty()) {
    ll a = A2.top();
    res += a;
    A2.pop();
  }
  cout << res << "\n";
  return;
}

int main() {
  cin >> N >> M;
  P.resize(M);
  for (int i = 0; i < N; i++) {
    ll a;
    cin >> a;
    A.push(a);
  }
  for (int i = 0; i < M; i++) {
    cin >> P[i].x >> P[i].y;
  }

  solve();
  return 0;
}


Measured memory_bytes: 4084
#include <bits/stdc++.h>
#define maxN 100002
using namespace std;

//FILE *fin = freopen("a.in", "r", stdin);

int n, k, a[maxN];

int ans, ok;

int gcd(int d, int i)
{
    if (d < i) swap(d, i);
    int r = d % i;
    while (r)
    {
        d = i;
        i = r;
        r = d % i;
    }
    return i;
}

int main()
{
    scanf("%d %d", &n, &k);
    for (int i = 1; i <= n; ++ i)
    {
        scanf("%d", &a[i]);
        ans = (i == 1) ? a[i] : gcd(ans, a[i]);
        if (a[i] >= k)
            ok = 1;
    }
    if (ok && (k % ans == 0))
        printf("POSSIBLE\n");
    else
        printf("IMPOSSIBLE\n");
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
    int n=0,k=0,h=0,count=0;
    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%d",&h);
        if(h>=k) count+=1;
    }
    printf("%d",count);
    return 0;
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using big_int = boost::multiprecision::cpp_int;
#define ll long long
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define MAX_CHAR 128
using namespace boost::multiprecision;
using namespace std;

ll recur(ll h,ll cnt)
{
    if(h==1)
    return 1;
    else return 1+2*recur(h/2,cnt);
}
int main() 
{
	ll h;
	cin>>h;
	ll cnt=0;
	ll ans=recur(h,cnt);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9+7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1e9+7

int main(){
    ll n; cin >> n;
    string s; cin >> s;
    if(s.size()%2==1) puts("No");
    else {
        string t = s.substr(0, s.size() / 2);
        string u = s.substr(s.size() / 2, s.size() / 2);
        if(t==u) puts("Yes");
        else puts("No");
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(j,n) for(int i=(int)(j);i<(int)(n);i++)
int main(){
  int L,R;
  cin>>L>>R;
  int ans=2019;
  if(L/2019==R/2019){
    int x=L%2019;
    int y=R%2019;
  rep(x,y){ for(int j=i+1;j<=y;j++)
    ans=min(ans,i*j%2019);
            }
  }
  else ans=0;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
'use strict';
function main(input) {
  input = input.split(" ");
  const a = parseInt(input[0], 10);
  const b = parseInt(input[1], 10);

  if (a > 9) {
    console.log(b);
  } else {
    console.log(b + (100 * (10 -a)));
  }
  
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21192
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=acos(-1);
const ll INF=1e18;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll a,b;
  cin >> a >> b;
  cout << a*b << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7,INF=mod*mod*3;//M_PI
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define f first
#define s second
#define pb push_back
#define mp make_pair

ll N;
ll p[200005];
ll ans;

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>N;
rep(i,N) cin>>p[i];
ll pm=INF;
rep(i,N){
	if(pm>=p[i]){
		ans++;
		pm=p[i];
	}
}
cout<<ans<<endl;

}
	

Measured memory_bytes: 5064
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0].split(" ")[0]);
  var T = parseInt(input[0].split(" ")[1]);
  n = new Array(N);
  t = new Array(N);
  var ans=1001;
  for(i=0;i<N;i++){
    tmp=input[i+1].split(" ");
    n[i]=parseInt(tmp[0]);
    t[i]=parseInt(tmp[1]);
    if(t[i]<=T){
      ans=Math.min(ans,n[i]);
    }
  }
  if(ans==1001){
    ans="TLE";
  }
  var ans;
  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>
 
#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>
 
#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}
 
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

typedef __int128 BS;

const int N = 110, LIM = 20, P = 998244353;

int n;
char s[N];
//int dp[2 << LIM];

map<BS, int> dp1;

int dfs(BS bs) {
  if (bs == 1) return 1;/*
  if (bs < (2 << LIM))
    return dp[bs];*/
  if (dp1.count(bs))
    return dp1[bs];
  int ret = dfs(bs >> 1) * ((bs & 1) + 1) % P;
  int i = 100;
  while (!((bs >> i) & 1)) --i;
  BS j = bs ^ (BS(1) << i);
  for (int l = 1; l <= i; ++l) {
    BS mask = j & ((BS(1) << l) - 1);
    for (int k = 2; k * l <= i; ++k) {
      mask &= j >> ((k - 1) * l);
      ret = (ret + dfs((BS(1) << l) | mask) * (ll)dfs((BS(1) << (i - k * l)) | (j >> (k * l)))) % P;
    }
  }
  return dp1[bs] = ret;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  cin >> (s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; ++i)
    s[i] -= '0';
  BS bs(1);
  bs <<= n;
  for (int i = 0; i < n; ++i)
    if (s[i + 1])
      bs |= BS(1) << i;
  /*dp[1] = 1;
  for (int i = 1; i <= LIM; ++i)
    for (int j = 0; j < 1 << i; ++j) {
      dp[j | (1 << i)] = dp[(j >> 1) | (1 << (i - 1))] * ((j & 1) + 1) % P;
      for (int l = 1; l <= i; ++l) {
        int mask = j & ((1 << l) - 1);
        for (int k = 2; k * l <= i; ++k) {
          mask &= j >> ((k - 1) * l);
          dp[j | (1 << i)] = (dp[j | (1 << i)] + dp[(1 << l) | mask] * (ll)dp[(1 << (i - k * l)) | (j >> (k * l))]) % P;
        }
      }
    }*/
  cout << dfs(bs) << '\n';

  return 0;
}


Measured memory_bytes: 3840
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)
#define MAX 1000000007
using namespace std;

/*
n

n 10^5

10^9+7
 */

ll f(int n){
  return n==0 ? 1 : n * f(n-1) % MAX;
}

int main(){
  int n;
  cin>>n;
  cout << f(n)%MAX << endl;

  return 0;
}


Measured memory_bytes: 1792
import sys
from collections import Counter
from functools import lru_cache

c = None

@lru_cache(maxsize=200000)
def _num_of_ways_to_choose(x):
    v = c[x]
    return (v * (v - 1)) // 2


def resolve(in_, out):
    n = int(in_.readline())
    a = tuple(map(int, in_.readline().split()))
    global c
    c = dict(Counter(a))

    _num_of_ways_to_choose.cache_clear()
    total = sum(map(_num_of_ways_to_choose, c.keys()))

    for ai in a:
        ans = total - _num_of_ways_to_choose(ai) + ((c[ai] - 1) * (c[ai] - 2)) // 2
        print(ans, file=out)


def main():
    resolve(sys.stdin.buffer, sys.stdout)


if __name__ == '__main__':
    main()


Measured memory_bytes: 40864
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

//container util
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQUE(a)  (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,n,0)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";

VI alp[26];

int main() {
	string a;
	cin >> a;
	ll ans = 1;
	int n = a.size();
	REP(i,n){
		alp[a[i]-'a'].push_back(i);
	}
	REP(i, 26)REP(k, (int)alp[i].size())REP(j,26)if(i!=j){
		int p = alp[i][k];
		ans += alp[j].end() - lower_bound(ALL(alp[j]),p);
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1908
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	fsc := NewFastScanner()
	N := fsc.Next()
	ok := false
	if N[0] == N[1] && N[1] == N[2] {
		ok = true
	}
	if N[1] == N[2] && N[2] == N[3] {
		ok = true
	}
	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


Measured memory_bytes: 640
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int n;
    cin >> n;
    set<char> h;
    rep(i, n){
        char c;
        cin >> c;
        h.insert(c);
    }
    cout << (h.size() == 4 ? "Four" : "Three") << endl;
    return 0;
}


Measured memory_bytes: 256
N,M=map(int, input().split())
AB=[]
for _ in range(M):
    a,b=map(lambda x:int(x)-1, input().split())
    AB.append((a,b,b*10**6+a))
AB.sort(key=lambda x:x[2])
ans=0
i=0
k=0
while i<N-1 and k<M:
    a,b,c=AB[k]
    i=b-1
    ans+=1
    j=k+1
    while j<M:
        a,b,c=AB[j]
        if i<a: break
        j+=1
    k=j
print(ans)

Measured memory_bytes: 65496
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    long n, a, b;
    scan(n, a, b);
    auto ans = n / (a + b) * a + min(a, (n % (a + b)));
    writeln(ans);
}




void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int n;
    string a, b, c;
    cin >> n >> a >> b >> c;
    int ans = 0;
    REP(i, n){
        if(a[i] == b[i] && b[i] == c[i]){
            continue;
        }else if(a[i] == b[i] || b[i] == c[i] || c[i] == a[i]){
            ans++;
        }else{
            ans += 2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
using namespace std;

long long A[100000];
long long B[100000];
int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i] >> B[i];
    }

    long long op_num = 0;
    for(int i = N - 1; i >= 0; i--){
        long long cur_A = A[i] + op_num;
        if((cur_A % B[i]) == 0){
            continue;
        } else {
            op_num += (cur_A / B[i] + 1) * B[i] - cur_A; 
        }
    }
    cout << op_num << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int cnt[100010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[100010];
    rep(i, N) cin >> A[i];
    rep(i, N) cnt[A[i]]++;
    vector<int> v;
    rep(i, 100010) if(cnt[i] > 0) v.push_back(cnt[i]);
    int ans = 0;
    sort(v.begin(), v.end());
    int cnt = 0;
    for(auto& e: v) {
        cnt += max(0, e - 1);
    }
    if(cnt % 2 == 0) {
        cout << v.size() << endl;
    } else {
        cout << v.size() - 1 << endl;
    }
    //cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 1660
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <iomanip>
#include <numeric>
#include <bitset>

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

using namespace std;

typedef long long ll;

int main () {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;

  int n; cin >> n;
  vector<int> a(n);

  int cnt[3] = {0};
  rep(i, n) {
    cin >> a[i];
    if (a[i]%4 == 0) {
      cnt[0]++;
    } else if (a[i]%2 == 0) {
      cnt[1]++;
    } else {
      cnt[2]++;
    }
  }

  if (cnt[1] == 0) {
    cout << ( cnt[2]-1 <= cnt[0] ? "Yes" : "No") << endl;
  } else {
    cout << ( cnt[2] <= cnt[0] ? "Yes" : "No") << endl;
  }
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  rep(i, h) cin >> a[i];
  
  vector<bool> row(h, false);
  vector<bool> col(w, false);

  rep(i, h){
    rep(j, w){
      if(a[i][j] == '#'){
        row[i] = true;
        col[j] = true;
      }
    }
  }

  rep(i, h){
    if(row[i]){
      rep(j, w){
        if(col[j]) cout << a[i][j];
      }
      cout << endl;
    }
  }
}


Measured memory_bytes: 3588
from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


while True:
    N = int(input())
    if N == 0:
        break
    table = list(map(int,input().split()))

    tmp_sum = 0
    for i in range(len(table)):
        tmp_sum += table[i]
    B = tmp_sum/len(table) #平均

    squared_sum = 0
    for i in range(len(table)):
        squared_sum += table[i]*table[i]
    A = squared_sum/len(table)

    print("%.10f"%(math.sqrt(A-B*B)))





 




Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
//
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mx 100010
#define pi acos(-1)
#define endl '\n'
#define Fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0)
//
int main()
{
    ll a, s = 0, x;

    cin >> a;
    x = a;
    while (x > 0)
    {
        s += x % 10;
        x /= 10;
    }
    if (a % s == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3556
#pragma GCC optimize("O3,inline,unroll-loops")
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(void)
{
    string a;

    cin >> a;
    cout << (a[0] <= 'Z' ? 'A' : 'a') << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>

/* prototype declaration */
void init(int w);
void shuffle(int n);
void swap(int *x, int *y);

int *lots;

int main(int argc, const char *argv[])
{
	int i, w, n;
	scanf("%d", &w);
	scanf("%d", &n);
	init(w);	

	shuffle(n);
	
	for(i=0; i<w; i++) printf("%d\n", lots[i]);	
	return 0;
}

void init(int w)
{
	int i;
	
	lots = malloc(sizeof(int)*w);
	for(i=0; i<w; i++) lots[i] = i+1;
}

void shuffle(int n)
{
	int i, j, k;
	for(i=0; i<n; i++){
		scanf("%d,%d", &j, &k);
		swap(&lots[j-1], &lots[k-1]);
	}	
}

void swap(int *x, int *y)
{
	int tmp = *x;
	*x = *y;
	*y = tmp;
}

Measured memory_bytes: 0
import java.util.*;
public class Main{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        System.out.println( a * b + " " + 2 * (a + b));
    }
}


Measured memory_bytes: 26132
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    rep(i, N) cin >> L[i];
    sort(L.begin(), L.end());
    int ans = 0;
    int length = sz(L);
    for (int i = 0; i < length; i++) {
        for (int j = i+1; j < length; j++) {
            if (L[i] == L[j]) continue;
            for (int k = j+1; k < length; k++) {
                if (L[j] == L[k]) continue;
                if (L[i] + L[j] > L[k]) ans++;
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll, ll>
#define ppi pair<int, pii>
#define vpi vector<pii>
#define vpl vector<pll>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const ll N = 2e5 + 5, mod = 1e9 + 7;
const ll inf = 1e18;
void solve(){
    string s, t;
    cin >> s >> t;
    int n = s.length();
    int m = t.length();
    int ans = 2000;
    for(int i = 0; i < n - m + 1; i++){
        int cnt = 0;
        for(int j = i; j < m + i; j++){
            if(s[j] != t[j - i]){
                cnt++;
            }
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //cout.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("Input.txt", "r", stdin);
    #endif*/
    //freopen("running_on_fumes_chapter_1_input (1).txt", "r", stdin);
    //freopen("Output.txt", "w", stdout);
    int t = 1, p;
    //cin >> t;
    for(p = 1; p <= t; p++){
        //cout << "Case #" << p << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 3660
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
typedef pair<int, bool> sP;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

void solve() {
	int n; cin >> n;
	vector<P> v(n);
	rep(i, n) {
		cin >> v[i].first >> v[i].second;
	}
	sort(v.begin(), v.end());
	vector<int> lma(n + 1), rmi(n + 1);
	lma[0] = 1, rmi[0] = 1000000000;
	rep(i, n) {
		lma[i + 1] = max(lma[i], v[i].first);
		rmi[i + 1] = min(rmi[i], v[i].second);
	}
	int l = 1, r = 1000000000;
	int ans = 0;
	per(i, n) {
		if (i == 0)break;
		l = max(l, v[i].first);
		r = min(r, v[i].second);
		int score = max(0, (r - l + 1)) + max(0, (rmi[i] - lma[i] + 1));
		ans = max(ans, score);
	}
	vector<int> rlma(n + 1), rlmi(n + 1);
	rlma[n] = 1;
	rlmi[n] = 1000000000;
	per(i, n) {
		rlma[i] = max(rlma[i + 1], v[i].first);
		rlmi[i] = min(rlmi[i + 1], v[i].second);
	}
	rep(i, n) {
		int score = v[i].second - v[i].first + 1;
		int l = max(lma[i], rlma[i + 1]);
		int r = min(rmi[i], rlmi[i + 1]);
		score += max(0, r - l + 1);
		ans = max(ans, score);
	}
	cout << ans << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(7);
	//init();
	solve();
	//stop
	return 0;
}



Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int A, B, C;
	cin >> A >> B >> C;

	if(A==B&&A!=C || B==C&&A!=B || C==A&&A!=B){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256