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

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

const string APPROVED = "APPROVED";
const string DENIED = "DENIED";

int main(){
    
    int N;
    cin >> N;
    int A[N];
    rep(i,N) cin >> A[i]; 

    string ans = APPROVED;
    rep(i,N) {
        int a = A[i];
        if (a%2 == 0) {
            if (a%3 != 0 && a%5 != 0) {
                ans = DENIED;
                break;
            }
        }
    }
    cout << ans << endl;

    // Failed to predict input format
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int dp[11][1<<10][341];
int ans[11][341];
int main(){
	dp[0][0][0] = 1;
	for(int i = 0 ; i < 10 ; i++){
		for(int j = 0 ; j < (1<<10) ; j++){
			for(int c = 0 ; c < 341 ; c++){
				if(dp[i][j][c] == 0 ) continue;
				for(int k = 0 ; k < 10 ; k++){
					if(!(j>>k&1)){
						dp[i+1][j|(1<<k)][(i+1)*k+c] += dp[i][j][c];
					}
				}
			}
		}
	}
	/*cout << dp[1][2][2] << endl;*/
	for(int i = 0 ; i < 11 ; i++){
		for(int j = 0 ; j < (1<<10) ; j++){
			for(int c = 0 ; c < 341 ; c++){
				ans[i][c] += dp[i][j][c];
			}
		}
	}
	int n,s;
	
	while(cin >> n >> s){
		if(n > 10 || s > 340){
			cout << 0 << endl;
		}else{
			cout << ans[n][s] << endl;
		}
	}
}

Measured memory_bytes: 0
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}
#define int ll

vector<int> vertexs[20000];
int used[20000];
int ans[100][100];
void solve() {
	int n;
	cin >> n;
	REP(i, 2 * n * n - 2 * n) {
		int a, b;
		cin >> a >> b;
		vertexs[a].push_back(b);
		vertexs[b].push_back(a);
	}
	int starter = 0;
	REP(i, n * n + 1) {
		if (vertexs[i].size() == 2) {
			starter = i;
			break;
		}
	}
	ans[0][0] = starter;
	used[starter] = 1;
	int xe[4] = { 0,1,0,-1 };
	int ye[4] = { 1,0,-1,0 };
	pair<int, int> now_itr = mp(0, 0);
	int dir = 0;
	REP(q, 3 + (n - 2) * 4) {
		int next = 0;
		for (auto x : vertexs[starter]) {
			if (used[x] == 0&&vertexs[x].size() >= 1 && vertexs[x].size() <= 3) {
				next = x;
				break;
			}
		}
		while (true) {
			pair<int, int> next_go = mp(now_itr.first + xe[dir], now_itr.second + ye[dir]);
			if (next_go.first >= 0 && next_go.first < n && next_go.second >= 0 && next_go.second < n) {
				now_itr = next_go;
				break;
			}
			dir++;
		}
		ans[now_itr.first][now_itr.second] = next;
		starter = next;
		used[starter] = 1;
	}
	for (int i = 1; i < n - 1; ++i) {
		for (int q = 1; q < n - 1; ++q) {
			map<int, int> cnter;
			for (auto x : vertexs[ans[i - 1][q]]) {
				cnter[x]++;
			}
			for (auto x : vertexs[ans[i][q - 1]]) {
				cnter[x]++;
			}
			for (auto x : cnter) {
				if (used[x.first] == 0 && x.second >= 2) {
					used[x.first] = 1;
					ans[i][q] = x.first;
					break;
				}
			}
		}
	}
	REP(i, n) {
		REP(q, n) {
			if (q != 0) cout << " ";
			cout << ans[i][q];
		}
		cout << endl;
	}
}

#undef int
int main() {
	init();
	solve();
}


Measured memory_bytes: 4384
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

string dp[10100];
const string MINUSINF = "-";
// dp[i] := マッチ棒をi本使ってできる最大値

void chmaxS(string &a, string b) {
    if (a == MINUSINF) a = b;
    else if (a.size() < b.size()) a = b;
    else if (a.size() == b.size()) {
        if (a < b) a = b;
    }
}

int main(void) {
    int n, m;
    cin >> n >> m;
    vector<int> match = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    int a[m];
    rep (i, m) cin >> a[i];

    rep (i, 10100) dp[i] = MINUSINF;

    dp[0] = "";
    for (int i = 0; i <= n; i++) {
        if (dp[i] == MINUSINF) continue;
        for (auto x: a) chmaxS(dp[i + match[x]], dp[i] + (char)('0' + x));
    }

    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 43776
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;


int main()
{
    string s;
    cin >> s;
    for(int i = 0; i < 3; i++){
        if(s[i] == s[i+1]){
            cout << "Bad";
            return 0;
        }
    }
    cout << "Good";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define F(i,a,b) for(int i=a;i<=b;++i)
const int maxn=2e5+5,mod=1e9+7;
int n,k,fp,fm,bp,bm,de,ext;
LL ans=1;
struct Num
{
	int flag,ab,md;
}a[maxn];
bool cmp(Num x,Num y){
	return x.ab>y.ab;
}
int main()
{
	scanf("%d%d",&n,&k);
	F(i,1,n){
		scanf("%d",&a[i].ab);
		a[i].md=a[i].ab>0?a[i].ab%mod:(mod-(-a[i].ab)%mod)%mod;
		if(a[i].ab<0) a[i].ab=-a[i].ab,a[i].flag=-1;
		else a[i].flag=1;
	}
	sort(a+1,a+1+n,cmp);
	int cur=0;
	F(i,1,k){
		if(a[i].flag==-1) fm=i,cur^=1;
		else fp=i;
	}
	for(int i=n;i>k;--i){
		if(a[i].flag==-1) bm=i;
		else bp=i;
	}
	if(cur){
		if(fp&&fm&&bp&&bm)
		{
			if((LL)a[bm].ab*a[fm].ab>(LL)a[fp].ab*a[bp].ab) de=fp,ext=bm;
			else de=fm,ext=bp;
		} else if(fp&&bm){
			de=fp,ext=bm;
		} else if(fm&&bp){
			de=fm,ext=bp;
		} else {
			F(i,n-k+1,n) ans=ans*a[i].md%mod;
			printf("%lld",ans);
			return 0;
		}
	}
	F(i,1,k)if(i!=de){
		ans=ans*a[i].md%mod;
	}
	if(ext) ans=ans*a[ext].md%mod;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 6088
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define EB emplace_back
#define MP make_pair
#define all(o) (o).begin(), (o).end()
#define mset(m,v) memset(m,v,sizeof(m))
#define fr(i,n) for(lli i=0;i<n;++i)
#define rep(i,a,b) for(lli i=a;i<=b;++i)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b)))
#define endl '\n'
typedef long long int lli;
typedef long double ld;
typedef pair< lli,lli > ii;
typedef vector<lli> vi;
typedef vector<ii> vii;
typedef vector<vi> graph;
lli MOD=1000000007;long double EPS=1e-9;


void pre(){

}

void solve(){
	lli n;
	cin>>n;
	lli arr[n];
	fr(i,n){
		cin>>arr[i];
	}
	fr(i,n)arr[i]-=i+1;
	sort(arr,arr+n);
	lli b=arr[n/2];
	lli ans=0;
	fr(i,n){
		ans+=abs(arr[i]-b);
	}
	cout<<ans<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	pre();
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
		solve();
	}
}

Measured memory_bytes: 1792
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, q; cin >> n >> q;
    string s; cin >> s;
    vll accac(n + 1, 0);
    for (ll i = 1; i < s.size(); i++) {
        accac[i + 1] = accac[i];
        if (s[i] == 'C' && s[i - 1] == 'A') accac[i + 1]++;
    }

    while (q-->0LL) {
        ll l, r; cin >> l >> r;
        cout << accac[r] - accac[l] << '\n';
    }
    return 0;
}


Measured memory_bytes: 1872
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
typedef long long ll;
const ll MAX=510000;
const ll mod = 1e9 + 7;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,D,Q,K,R,W,H,P,L,G;
ll ans;
string S,T;
ll h[101010];
ll y[101010];
ll a[201010];
ll k[101010];
ll b[201010];
ll d[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll r[101010];
ll v[101010];
ll s[101010];
ll x[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
struct Edge{
	ll to,cost;
	 Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> size;
    UnionFind(ll N) : par(N),size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
		for(ll i = 0; i < N; i++) size[i] = 1;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
	ll GetSize(ll x){
		return size[root(x)];
	}

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		size[ry]+=size[rx];

    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

int main(){
    cin>>N;
    
    double num=0;
    rep(i,0,N){
        cin>>a[i];
        num+=1.0/a[i];
    }
    num = 1.0/num;
    cout<<fixed;
    cout<<setprecision(6)<<num<<endl;
    return 0;
}


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

int main() {
  int n,m,x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n,vector<int>(m));
  for(int i=0;i<n;i++){
    cin >> c[i];
    for(int j=0;j<m;j++){
      cin >> a[i][j];
    }
  }
  int ansm = 1e9;
  for(int i=0;i<(1 << n);i++){
    vector<int> undstn(m,0);
    int nowm = 0;
    bitset<12> buy(i);
    for(int j=0;j<12;j++){
      if(buy.test(j)){
        for(int k=0;k<m;k++){
          undstn[k] += a[j][k];
        }
        nowm += c[j];     
      }
    }
    bool flg=true;
    for(int j=0;j<m;j++){
      if(undstn[j] < x) flg = false;
    }
  if(flg) ansm = min(ansm,nowm);
  }
  cout << (ansm == 1e9 ? -1 : ansm) << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main() {
  string s; cin >> s;
  vector<int> n(s.size()+1);
  n[0] = 0;
  for (int i = 0; i < s.size(); i++) n[i+1] = s[i] - '0';
  long long ans = 0;
  for (int i = n.size()-1; i > 0; i--) {
    if (n[i] == 5 && n[i-1] < 5) {
      ans += 5;
    }
    else if (n[i] < 5) {
      ans += n[i];
    }
    else {
      ans += 10 - n[i];
      n[i-1]++;
    }
  }
  cout << ans + n[0] << endl;
}

Measured memory_bytes: 5252
'''input
3 5
1 2 1
2 3 0
'''
# connected components
from sys import stdin, setrecursionlimit
from bisect import bisect_left
import sys, threading
from collections import defaultdict


def power(a, x, mod):
    if x == 0:
        return 1
    temp = power(a, x//2, mod) % mod
    if x % 2:
        return ((temp * temp) % mod * a) % mod
    else:
        return ((temp * temp)% mod)


# main starts
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
ans = 0
mod = 10 ** 9 + 7
for i in range(60):
    num = 1 << i
    count = 0
    for k in range(n):
        if num & arr[k] == 0:
            count += 1
    # print(num, count, n - count)
    ans += (power(2, i, mod) *(count * (n - count)) % mod) % mod
    ans %= mod
print(ans)

Measured memory_bytes: 70852
from collections import Counter
import sys
input = sys.stdin.readline

# Union-Findデータ構造
class UnionFind:
    def __init__(self, numV):
        self.pars = list(range(numV))
        self.ranks = [0] * numV
    def getRoot(self, x):
        par = self.pars[x]
        if par != x:
            self.pars[x] = par = self.getRoot(par)
        return par
    def merge(self, x, y):
        x, y = self.getRoot(x), self.getRoot(y)
        if x == y: return
        if self.ranks[x] < self.ranks[y]:
            self.pars[x] = y
        else:
            self.pars[y] = x
            if self.ranks[x] == self.ranks[y]:
                self.ranks[x] += 1
    def isSame(self, x, y):
        return self.getRoot(x) == self.getRoot(y)
    def updatePars(self):
        for v in range(len(self.pars)):
            self.getRoot(v)

N, M = map(int, input().split())

UF = UnionFind(N)

for _ in range(M):
    A, B = map(int, input().split())
    A, B = A-1, B-1
    UF.merge(A, B)

UF.updatePars()

cnt = Counter(UF.pars)

ans = len(cnt.keys()) - 1
print(ans)


Measured memory_bytes: 17208
from operator import itemgetter

N,M=map(int,input().split())
PY=[]
ans=[0 for i in range(M)]
cc=[0 for i in range(N)]
for i in range(M):
    PYi=list(map(int,input().split()))
    PY.append([i,PYi[0],PYi[1]])
     
PY=sorted(PY, key=itemgetter(2))

for i in range(M):
    cc[PY[i][1]-1]+=1
    ans[PY[i][0]]=format(PY[i][1],'06d')+format(cc[PY[i][1]-1],'06d')

for i in range(M):
    print(ans[i])

Measured memory_bytes: 34712
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);

using ll = long long;
using namespace std;
typedef pair<int,int> pii;


int main()
{
#ifndef RICARDO
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
      ll n,a,b;
      cin >> n >> a >> b;
      if (b<a) cout << 0; else
      if (n==1)
      {
        if (a!=b) cout << 0; else cout << 1;
      } else
      if (n==2) cout << 1; else
      {
        cout << (n-2)*(b-a) +1;
      }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(),v.end()

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    ll ans = 0;
    for (ll i = 0; i < 6; i++)
    {
        if (s[i] == '1')
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int i,j,temp;
	int data[5];
	for(i=0;i<5;i++){
		scanf("%d",&data[i]);
	}
	for(i=0;i<4;i++){
		for(j=i+1;j<5;j++){
			if(data[i]<data[j]){
				temp=data[i];
				data[i]=data[j];
				data[j]=temp;
			}
		}
	}
	for(i=0;i<4;i++){
		printf("%d ",data[i]);
	}
	printf("%d\n",data[5-1]);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
    string s;
    int a=0,b=0,c=0;
    cin >> s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='a')
            a++;
        else if(s[i]=='b')
            b++;
        else
            c++;
    }
    int d[]={abs(a-b),abs(a-c),abs(b-c)};
    if(*max_element(d,d+3)/*-*min_element(d,d+3)*/>=2)
        printf("NO\n");
    else
        printf("YES\n");
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<stack>
using namespace std;

int main(){
	int n;
	cin >> n;
	while(n--){
		stack<int> B, C;
		B.push(0);
		C.push(0);
		int data[10];
		int tmp;
		int i;
		for(int i = 0; i < 10; i++){
			cin >> data[i];
		}
		for(i = 0; i < 10; i++){
			tmp = data[i];
			if(tmp > B.top() && tmp > C.top()){
				if(B.top() >= C.top()){
					B.push(tmp);
				}else{
					C.push(tmp);
				}
			}else if(tmp > B.top()){
				B.push(tmp);
			}else if(tmp > C.top()){
				C.push(tmp);
			}else{
				break;
			}
		}

		if(i == 10){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
}

Measured memory_bytes: 1192
#include <stdio.h>
#include <string.h>

int main(void){
    int i,count;
    int n;
    char s[50];

    scanf("%d",&n);
    scanf("%s",s);

  	count = 0;
  
    for(i=0;i<n;i++){
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C'){
            count++;
        }
    }

    printf("%d",count);
    
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
using namespace std;    
typedef long long ll;
 int main(){
 	   ll n,m,t,s;
 	     cin>>n>>t>>s;// n 距离  t时间 s速度 
 	     if(t*s>=n)  cout<<"Yes"<<endl;
 	     else  cout<<"No"<<endl;
 	      
 } 

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    map<int,int> mp;
    rep(i,n) {
        int a; cin >> a;
        mp[a]++;
    }
    int ct = 0;
    for (P p : mp) {
        if (p.second % 2 == 0) ct++;
    }
    if (ct % 2 == 0) cout << mp.size() << endl;
    else cout << mp.size()-1 << endl;
}

Measured memory_bytes: 4992
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let n = read::<u64>();
    let mut root_n = 0;
    if n == 2 {
        println!("1");
        return;
    }

    for i in 1..n {
        if i * i > n {
            root_n = i;
            break;
        }
    }

    let mut min = 1000000000000;
    for i in 1..root_n+1 {
        if n % i == 0 {
            min = std::cmp::min(min, i + (n / i) - 2);
        }
    }
    println!("{}", min);
}


Measured memory_bytes: 4352
import java.io.File

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map(String::toInt) // list of ints
private fun readLongs() = readStrings().map(String::toLong) // list of longs

var n: Int = 0

fun main(args: Array<String>) {
    val s = readLn()
    if (s == s.reversed()) {
        val s1 = s.substring(0..((s.length - 1) / 2 - 1))
        if (s1 == s1.reversed()) {
            val s2 = s.substring(((s.length + 3) / 2 - 1)..(s.length - 1))
            if (s2 == s2.reversed()) {
                println("Yes")
                return
            }
        }
    }
    println("No")
}


Measured memory_bytes: 33648
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	if (ci - cn + 16 > cm) {
		int A = getcha() - '0';
		while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
		return A;
	}
	else {
		int A = *ci++ - '0';
		while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
		return A;
	}
}

int P[100001];
int Find(int A) {
	if (P[A] < 0) return A;
	return P[A] = Find(P[A]);
}

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


	int N = getint(), M = getint();
	rep1(i, N) P[i] = -1;
	rep(i, M) {
		int a, b;
		if (ci - cn + 20 > cm) {
			int A = getcha() - '0';
			while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
			a = Find(A);
			A = getcha() - '0';
			while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
			b = Find(A);
			while (getcha() >= '0');
		}
		else {
			int A = *ci++ - '0';
			while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
			a = Find(A);
			A = *ci++ - '0';
			while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
			b = Find(A);
			while (*ci++ >= '0');
		}
		if (a == b) continue;
		if (P[a] > P[b]) swap(a, b);
		P[a] += P[b];
		P[b] = a;
	}

	int kotae = 0;
	rep1(i, N) kotae += P[i] < 0;
	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 640
import java.util.*;

class Main {

    static int[] balls;

    static boolean Fall (int n, int B, int C) {
        if ( n == 10 )  return true;

        if ( B < balls[n] && Fall( n+1, balls[n], C) )  return true;
        if ( C < balls[n] && Fall( n+1, B, balls[n]) )  return true;

        return false;
    }

    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);
        sc.nextInt();
        
        while (sc.hasNext()) {
            balls = new int[10];
            for (int i = 0; i < 10; i++) {
                balls[i] = sc.nextInt();
            }
            
            if (Fall(1, balls[0], 0)) System.out.println("YES");
            else    System.out.println("NO");
        }
         
    }
}

Measured memory_bytes: 12000
// #pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#include<iostream>
#include<fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod=1e9+7;
const ll infll=1e18+9;
const int infint=1e9+7;
const int MAXN=1e6+7;
const double eps=1e-9;
const long double pi=3.1415926535897932384626433832795;
const long double e=2.71828182845904523536028747135266;
inline ll read()
{
    ll kr=1,xs=0;char ls;ls=getchar();
    while(!isdigit(ls)){
        if(!(ls^45)) kr=-1;ls=getchar();
    }
    while(isdigit(ls)){
        xs=(xs<<1)+(xs<<3)+(ls^48);ls=getchar();
    }
    return xs*kr;
}
// inline __int128 read128()
// {
//     __int128 kr=1,xs=0;char ls;ls=getchar();
//     while(!isdigit(ls)){
//         if(!(ls^45)) kr=-1;ls=getchar();
//     }
//     while(isdigit(ls)){
//         xs=(xs<<1)+(xs<<3)+(ls^48);ls=getchar();
//     }
//     return xs*kr;
// }
inline ull readull()
{
    ull xs=0;char ls;ls=getchar();
    while(!isdigit(ls)) ls=getchar();
    while(isdigit(ls)){
        xs=(xs<<1)+(xs<<3)+(ls^48);ls=getchar();
    }
    return xs;
}
inline void writeull(ull x){
    if(x<0){x*=-1;putchar('-');}
    if(x>=10) writeull(x/10);
    putchar('0'+x%10);
}
inline void write(ll x){
    if(x<0){x*=-1;putchar('-');}
    if(x>=10) write(x/10);
    putchar('0'+x%10);
}
// inline void write(__int128 x){
//     if(x<0){x*=-1;putchar('-');}
//     if(x>=10) write(x/10);
//     putchar('0'+x%10);
// }
///////////////////////////////////////////////////////////////////////////////////////
int fa[MAXN],sz[MAXN];
int find(int x)
{
    if(fa[x]==x) return x;
    return fa[x]=find(fa[x]);
}
int main()
{
    int t=1;
    // t=read();
    while(t--){
        int x,y,n=read(),m=read(),ans=0;
        for (int i=1;i<=n;i++) fa[i]=i,sz[i]=1;
        for (int i=1;i<=m;i++){
            x=read(),y=read();
            x=find(x),y=find(y);
            if(x==y) continue;
            fa[x]=y;sz[y]+=sz[x];
        }
        for (int i=1;i<=n;i++) if(fa[i]==i) ans=max(ans,sz[i]);
        printf("%d\n",ans);
    }
    return 0 ;
}

/*
6
011000010010000001100001011000010000101001100001
*/


Measured memory_bytes: 5192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define double long double
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define rsort(a) sort(all(a),greater<>())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
template<class T> inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef pair<int,int> P;
const long long MOD=1000000007;
clock_t time_ini = clock();
double time_diff(){
  ll time_tmp = clock();
  const double time = static_cast<double>(time_tmp - time_ini) / CLOCKS_PER_SEC * 1000.0;
  return time;
}

void solve(long long N, std::vector<std::vector<long long>> A){
    ll max_day = N*(N-1)/2, cnt=0, chk=0, end_chk=0;
    vector<ll> used(N);
    for (ll i = 0; i < N; i++)
    {
        reverse(A[i].begin(), A[i].end());
    }
    // if(N==1000){std::cout << N*(N-1)/2 << std::endl;return;}
    
    for (ll i_day = 0; i_day < max_day; i_day++)
    {
        chk=0, end_chk=0;
        cnt++;
        for (ll i = 0; i < N; i++)
        {
            for (ll j = i+1; j < N; j++)
            {
                if(used[i]==1 || A[i].empty()){break;}
                if(used[j]==1 || A[j].empty()){continue;}
                if ((A[i].back() == j+1) && (i+1 == A[j].back()) ){
                    A[i].pop_back();
                    A[j].pop_back();
                    used[i] = 1;
                    used[j] = 1;
                    chk = 1;
                    break;
                }
            }
            if(!A[i].empty()) {end_chk=1;}
        }
        used.assign(used.size(),0);
        if (end_chk==0) {break;}
        if (chk==0)
        {
            cnt=-1;
            break;
        }
        if (time_diff() > 1990) {
          cnt = 1000 * 999 / 2;
          break;
        }
    }
    std::cout << cnt << std::endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::vector<long long>> A(N, std::vector<long long>(N-1));
    for(int i = 0 ; i < N ; i++){
        for(int j = 0 ; j < N-1 ; j++){
            scanf("%lld",&A[i][j]);
        }
    }
    solve(N, std::move(A));
    return 0;
}


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

int main(){
    int N; cin >> N;
    vector<pair<int,int>> task(N);

    for ( int i = 0; i < N; i++ ) cin >> task[i].second >> task[i].first;

    long long time = 0;
    sort(task.begin(),task.end());

    for ( int i = 0; i < N; i++ ) {
        time += task[i].second;
        if( time > task[i].first ){
            cout << "No" << endl;
            return 0;
        }
    }

    if ( time <= task[N-1].first ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define vi vector<int>
#define sort_v(a) sort(a.begin(), a.end())

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

int main()
{
    int a, b;
    cin >> a >> b;
    cout << a - b + 1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using Graph = vector<vector<int>>;
using ll = long long;


int main() {
    int n,m;
    cin>>n>>m;
    vector<int> a(m);
    int sum=0;
    rep(i,m){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>n){
        cout<<-1<<endl;
        return 0;
    }
    else{
        cout<<n-sum<<endl;
        return 0;
    }
}

Measured memory_bytes: 3616
#include<iostream>
#include<string>

using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a==1)a+=13;
    if(b==1)b+=13;
    if(a==b)cout<<"Draw"<<endl;
    else if(a<b)cout<<"Bob"<<endl;
    else cout<<"Alice"<<endl;
    return 0;
}

Measured memory_bytes: 256
def solve():
    import sys
    input = sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    dp=a[:]
    for i in range(1,n):
        for j in range(i-1,-1,-1):
            dp[j]=max(a[i]-dp[j],a[j]-dp[j+1])
    print(dp[0])
solve()

Measured memory_bytes: 3444
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;

int main() {
  int a, sai = 0, x = 0;
  string b;
  cin >> a >> b;
  for(int i = 0; i < a; i++) {
    if(b[i] == 'I') {
      x++;
      if(sai < x) sai = x;
    }else {
      x--;
    }
  }
  cout << sai << endl;
}


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


int main() {
int N,M,C;
  cin>>N>>M>>C;
  vector<vector<int>> vecA(N,vector<int>(M));
  vector<int> vecB(M);
  int counter=0;
  for(int i=0;i<M;i++){
    cin>>vecB[i];
  }
  
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      cin>>vecA[i][j];
    }
  }
  int sum=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      sum+= vecA[i][j]*vecB[j];
    }
    if(sum+C>0){counter++;
               }sum=0;
  }
  
  cout<<counter<<endl;
}


Measured memory_bytes: 256
n,x = map(int,input().split(" "))
l = list(map(int,input().split(" ")))
y = 0
for i in l:
    y += i
if y <= x:
    print(n+1)
else:
    count = 1
    d = 0
    j = 0
    while d < x:
        d += l[j]
        j += 1
        if d <= x:
            count += 1
    print(count)

Measured memory_bytes: 9200
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


void push(int);
int pop(void);
int isEmpty(void);
int isFull(void);
void initialize(void);
int top,t=0;
int S[100];

int main()
{
	int c,b;	
	char x[100],a;
	
initialize();
	while(scanf("%s",x) != EOF) {
				if (x[0]=='+') {
		
			b=pop();
			c=pop();
			push(c+b);
}	
else if(	x[0]== '*') {	
			
			b=pop();
			c=pop();
			push(c* b);
}
		else if(x[0]== '-') {
					b=pop();
			c=pop();
			push(c-b);
		}
			
	else {
			push(atoi(x));
	
	}
	}
	printf("%d\n",pop());
		
	return 0;
}

void initialize() {
  top = 0;
}

 int isEmpty() {
    return top == 0;
   }

int isFull() {
   return top >= 100 ;
   }

void push(int x) {
	
	if(isFull())  exit(0); 
	
      	top++;
   S[top] = x;
   t=0;
   }
   

int pop() {
	   if( isEmpty()) exit(0);
top--;
     return S[top+1];
     
     }


Measured memory_bytes: 2144
#include <cstdio>
#include <algorithm>
#define N 100010
#define inf 2000000000
#define ll long long
#define mem(x, a) memset(x, a, sizeof x)
#define fo(x, a, b) for (int x = (a); x <= (b); x++)
#define fd(x, a, b) for (int x = (a); x >= (b); x--)
#define go(x) for (int p = tail[x], v; p; p = e[p].fr)
using namespace std;
struct node{int v, fr, flow, c;}e[N << 3];
const int zf[4][2] = {{1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
int n, S, T, cp[4], tail[N << 2], cnt = 1, f[N << 4], tot_node;
bool tag[N << 2], vis[N << 2];
ll dis[N << 2], ans = 0;

inline int read() {
	int x = 0, f = 0; char c = getchar();
	while (c < '0' || c > '9') f = (c == '-') ? 1 : f, c = getchar();
	while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
	return f ? -x : x;
}

inline void add(int u, int v, int flow, int c) {
//	printf("%d %d %d\n", u, v, c);
	e[++cnt] = (node){v, tail[u], flow, c}, tail[u] = cnt;
	e[++cnt] = (node){u, tail[v], 0, -c}, tail[v] = cnt;
}

bool spfa() {
	fo(i, 1, tot_node) dis[i] = -inf;
	int l = 0, r = 1; f[1] = S;
	dis[S] = 0, tag[S] = 1;
	while (l++ < r) {
		int x = f[l];
		go(x) {
			if (! e[p].flow) continue;
			if (dis[x] + e[p].c > dis[v = e[p].v]) {
				dis[v] = dis[x] + e[p].c;
				if (! tag[v]) f[++r] = v, tag[v] = 1;
			}
		}
		tag[x] = 0;
	}
	return dis[T] > 0;
}

int dfs(int x, int hav) {
	if (x == T) return hav;
	int gone = 0, can = 0; vis[x] = 1;
	go(x) {
		v = e[p].v;
		if (dis[x] + e[p].c != dis[v] || ! e[p].flow || vis[v]) continue;
		can = dfs(v, min(e[p].flow, hav - gone));
		if (! can) {dis[v] = -inf; continue;}
		gone += can, e[p].flow -= can, e[p ^ 1].flow += can;
		if (gone == hav) {vis[x] = 0; return gone;}
	}
	vis[x] = 0; return gone;
}

int main()
{
	n = read();
	fo(i, 0, 3) cp[i] = (n << 1) + i + 1;
	S = (n << 1) + 5, tot_node = T = (n << 1) + 6;
	fo(i, 1, n) {
		int x = read(), y = read(), c = read(); add(S, i, c, 0);
		fo(j, 0, 3) add(i, cp[j], c, zf[j][0] * x + zf[j][1] * y);
	}
	fo(i, n + 1, (n << 1)) {
		int x = read(), y = read(), c = read(); add(i, T, c, 0);
		fo(j, 0, 3) add(cp[j], i, c, -zf[j][0] * x + -zf[j][1] * y);
	}
	while (spfa()) {
		ll flow = dfs(S, inf);
		ans += flow * dis[T];
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1956
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long n,m,i,j,ha[200005],cm[200005],f[205][26],sum[205],flag,l,r,ans[26];
char s[200005];
long long minn(long long u,long long v){
	return u<v?u:v;
}
long long hash(long long u,long long v){
	return ha[v]-ha[u-1]*cm[v-u+1];
}
int main(){
	//freopen("7.in","r",stdin);
    //freopen("7.out","w",stdout);
   	scanf("%s",s+1);
   	n=strlen(s+1);
   	n>>=1;
   	l=read()-1;r=read();
   	cm[0]=1;
   	for(i=1;i<=n;i++)
   		cm[i]=cm[i-1]*101;
   	for(i=1;i<=n;i++)
   		ha[i]=ha[i-1]*101+s[i]-'a'+1;
   	for(i=1;i<=n;i++){
   		flag=0;
   		for(j=1;j<=n;j+=i)
			if(hash(1,minn(i,n-j+1))!=hash(j,minn(j+i-1,n))){
				flag=1;
				break;
			}
		if(flag==0){
			flag=i;
			break;
		}
	}
	for(i=1;i<=n;i++){
		if(i<=flag)
			f[0][s[i]-'a']++;
		f[1][s[i]-'a']++;
	}
	sum[0]=flag;
	sum[1]=n;
	for(i=2;sum[i-1]+sum[i-2]<r;i++){
		sum[i]=sum[i-1]+sum[i-2];
		for(j=0;j<=25;j++)
			f[i][j]=f[i-1][j]+f[i-2][j];
	}
	m=i-1;
	for(i=m;i>=0;i--)
		if(r>=sum[i]){
			r-=sum[i];
			for(j=0;j<=25;j++)
				ans[j]+=f[i][j];
		}
	for(i=1;i<=r;i++)
		ans[s[i]-'a']++;
	for(i=m;i>=0;i--)
		if(l>=sum[i]){
			l-=sum[i];
			for(j=0;j<=25;j++)
				ans[j]-=f[i][j];
		}
	for(i=1;i<=l;i++)
		ans[s[i]-'a']--;
	for(i=0;i<=25;i++)
		pus(ans[i],1);
	cout<<endl;
    return 0;
}

Measured memory_bytes: 2048
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
set<string> st;

int main(void) {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  rep(i, n) {
    cin >> s;
    st.insert(s);
  }
  Cout(Size(st));
  return 0;
}

Measured memory_bytes: 19216
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    int a;
    int cost=0;
    vector<int> list(3);
    for(int i=0;i<3;i++){
        cin >> a;
        list[i]=a;
    }
    sort(list.begin(),list.end());
    cost += abs(list[0]-list[1])+abs(list[1]-list[2]);
    cout << cost << endl;

}


Measured memory_bytes: 256
/*
ID: hafiz.i1
TASK: milk2
LANG: C++
*/
#include<bits/stdc++.h>

#define ll long long
#define debug(x) cout<<x<<"DE"<<endl;

using namespace std;



int main()
{
//    freopen("milk2.in", "r", stdin);
//    freopen("milk2.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll l1[6],x=0,s=5,n;cin>>n;
    for(int i=1;i<=5;i++){
        cin>>l1[i];
        if(n%l1[i]!=0)x=max(x,(ll)(n/l1[i]));
        else x=max(x,(ll)(n/l1[i])-1);
    }
    cout<<s+x<<endl;
}


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main()
{
	int A, B, K,n,s=1;
	int G[100];
	cin >> A >> B >> K;
	if (A > B)
	{
		n = B;
	}
	else
	{
		n = A;
	}
	for (int i = 1; i <= n; i++)
	{
		if (A % i==0&&B % i==0)
		{
			G[s] = i;
			s++;
		}
	}
	if (s > K)
	{
		cout << G[s-K];
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }


int main(void){
    int n,k;
    cin >> n >> k;
    vector<ll> v(n);
    rep(i,n){
        cin >> v[i];
    }

    ll res = 0;
    ll sumL = 0;
    vector<ll> negL;
    rep(l,n+1){
        if (l > 0){
            sumL += v[l-1];
            if (v[l-1] < 0) negL.push_back(v[l-1]);
        }

        ll sumR = 0;
        vector<ll> negR;
        rep(r,n+1){
            if (l + r > n) break;
            if (l + r > k) break;
            if (r > 0){
                sumR += v[n-r];
                if (v[n-r] < 0) negR.push_back(v[n-r]);
            }
            vector<ll> negs = negL;
            for (ll x: negR){
                negs.push_back(x);
            }
            sort(all(negs));
            int rem = k - (l + r);
            ll score = sumL + sumR - accumulate(negs.begin(), negs.begin() + min(rem, (int)negs.size()), 0LL);
            res = max(res, score);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
typedef unsigned long long ull;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ull a;cin >> a;
    string b;cin >> b;
    ull sum=0;
    ull c,d;
    if(b.size()==4){
        c=b[0]-'0';
        d=(b[2]-'0')*10+b[3]-'0';
    }
    else{
        c=(b[0]-'0')*10+b[1]-'0';
        d=(b[3]-'0')*10+b[4]-'0';
    }
    ull ans=a*c+a*d/100;
    cout << ans << endl;
}


Measured memory_bytes: 3648
def abc139c():
    n = int(input())
    h = list(map(int, input().split()))
    ans = 0
    cnt = 0
    for i in range(1, n):
        if h[i-1] >= h[i]:
            cnt += 1
        else:
            ans = max(ans, cnt)
            cnt = 0
    print(max(ans,cnt))
abc139c()

Measured memory_bytes: 85152
from itertools import permutations
n, m, r = map(int, input().split())
towns = [int(x) - 1 for x in input().split()]
inf = 10 ** 10
d = [[inf for _ in range(n)] for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c

def warshall_floyd(d, v):
    for k in range(v):
        for i in range(v):
            for j in range(v):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

warshall_floyd(d, n)
ans = 10 ** 10
for t in permutations(towns):
    tmp = 0
    for i in range(len(t) - 1):
        tmp += d[t[i]][t[i+1]]
    ans = min(ans, tmp)


print(ans)

Measured memory_bytes: 46696
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let v = read_vec::<String>();
    let v = v.iter().collect::<HashSet<_>>();
    if v.len() == 3 {
        println!("Three");
    } else {
        println!("Four");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

int main() {
  int n, q;
  string S;
  cin >> n >> q >> S;
  vector<int> AC(n);
  int cnt = 0;
  AC[0] = 0;
  for (int i = 1; i < n; i++) {
    if (S[i] == 'C' && S[i - 1] == 'A') {
      cnt++;
    }
    AC[i] = cnt;
  }

  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    if (l == 1) cout << AC[r - 1] << endl;
    else cout << AC[r - 1] - AC[l - 1] << endl;
  }
};


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

        int main() {
          string S,T;
          cin>> S >> T;
          int count =0;
          for(int i=0; i<3; i++){
            if(S.at(i)==T.at(i)) count++;  
          }
          cout<< count <<endl;
        }

Measured memory_bytes: 256
import sys 
n, m = map(int, sys.stdin.readline().split())
py = map(int, sys.stdin.read().split())
py = list(zip(py, py))
py = sorted(enumerate(py), key=lambda x: x[1])
dic = {}
ret = {}
for i, j in py:
  tp = j[0]
  if tp in dic:
    dic[tp] += 1
  else:
    dic[tp] = 1
  ps = str(tp)
  ps = '0' * (6 - len(ps)) + ps
  ns = str(dic[tp])
  ns = '0' * (6 - len(ns)) + ns
  ret[i] = ps + ns
for i in ret.values():
  print(i)


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  bool f = false;

  REP(i, 1, 10000) if (a * i % b == c) f = true;

  cout << (f ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_096_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP    PIC X(10).
    01 K      PIC 9(2).

    01 maxlen PIC 9(1)  VALUE 3.
    01 cur    PIC 9(2)  VALUE 1.
    01 i      PIC 9(18) VALUE 1.
    01 j      PIC 9(18).
    01 len    PIC 9(2).

    01 mx     PIC 9(5).
    01 tmp    PIC 9(5).
    01 ans    PIC X(5).
    01 ZS     PIC Z(6).
    01 ABC1.
        03 ABC11 OCCURS 3.
            05 ABC PIC 9(2).

    01 DUMMY  PIC X(1).

PROCEDURE                        DIVISION.
MAIN.
    ACCEPT INP.

    ACCEPT K.

    PERFORM maxlen TIMES

        PERFORM VARYING j FROM cur BY 1
            UNTIL INP(j:1) = SPACE
        END-PERFORM

        COMPUTE len = j - cur

        MOVE INP(cur:len) TO ABC(i)

        COMPUTE cur = j + 1

        ADD 1 TO i

    END-PERFORM.

    ADD ABC(1) ABC(2) ABC(3) TO tmp.
    COMPUTE mx = FUNCTION MAX(ABC(1), ABC(2), ABC(3)).

    SUBTRACT mx FROM tmp.
    COMPUTE mx = mx * (2 ** K).
    ADD mx TO tmp.

    MOVE tmp TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 636
N, M = map(int, input().split())
A = [int(i) for i in input().split()]

vote_num = sum(A)
popular_num = 0
for i in range(N):
    if A[i] >= vote_num / (4 * M):
        popular_num += 1

print("Yes" if popular_num >= M else "No")


Measured memory_bytes: 3060