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

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

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; }}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; }}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector< vector<int> > c(10, vector<int>(10));
    int N; cin >> N;
    if (N < 10) {
        cout << N << endl;
        return 0;
    }
    for (int i = 1; i <= N; ++i) {
        int d = floor(log10(i));
        int l = i / pow(10, d);
        int r = i % 10;
        c[l][r]++;
    }
    ll ans = 0;
    rep(i, 10) rep(j, 10) {
        ans += c[i][j] * c[j][i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
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<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
#define MN 100005
int n;
int q[MN*2],p[MN*2];
int l,r;
bool vis[MN];
int main(){
	n=read();
	q[l=r=MN]=1;p[MN]=1;
	while(l<=r){
		int Q=q[l],P=p[l++];
		if(vis[Q]) continue;vis[Q]=1;
		if(Q==0){printf("%d\n",P);return 0;}
	//	if(!vis[(Q*10)%n]){
	//		vis[(Q*10)%n]=true;
			q[--l]=(Q*10)%n;
			p[l]=P;
	//	}
	//	if(!vis[(Q+1)%n]){
	//		vis[(Q+1)%n]=true;
			q[++r]=(Q+1)%n;
			p[r]=P+1;
	//	}
	}
	return 0;
}

Measured memory_bytes: 1152
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        FastReader fr = new FastReader();
        int n = fr.nextInt();
        System.out.println((int)Math.pow(n, 3));
    }

}

class FastReader {
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public FastReader() {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public FastReader(String file_name) throws IOException {
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException {
        byte[] buf = new byte[64]; // line length
        int cnt = 0, c;
        while ((c = read()) != -1) {
            if (c == '\n')
                break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException {
        int ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0' && c <= '9');

        if (neg)
            return -ret;
        return ret;
    }

    public long nextLong() throws IOException {
        long ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0' && c <= '9');
        if (neg)
            return -ret;
        return ret;
    }

    public double nextDouble() throws IOException {
        double ret = 0, div = 1;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();

        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0' && c <= '9');

        if (c == '.') {
            while ((c = read()) >= '0' && c <= '9') {
                ret += (c - '0') / (div *= 10);
            }
        }

        if (neg)
            return -ret;
        return ret;
    }

    private void fillBuffer() throws IOException {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1)
            buffer[0] = -1;
    }

    private byte read() throws IOException {
        if (bufferPointer == bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException {
        if (din == null)
            return;
        din.close();
    }
}

Measured memory_bytes: 22612
#include<iostream>

using namespace std;

int main (void)
{
  int n,a,b;
  cin >> n >> a >> b;
  
  int train = n*a;
  int taxi = b;
  
  if(train > taxi)
  {
    cout << taxi;
  }
  else
  {
    cout << train;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
//#include<bits/stdc++.h>
#include<tuple>
#include<queue>
#include<map>
#include<algorithm>
//#include <bits/stdc++.h>


#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

bool _predicate(int a,const int& element) {
	return (element == a); // This will cause all elements to be deleted that are larger than 3
}

int main() {
	int n;
	cin >> n;
	ll a[n];
	ll m = 1000;
	rep(i, n) {
		cin >> a[i];
		if (i > 0) {
			if (a[i] > a[i - 1]) {
				m = (m / a[i - 1]) * a[i] + m % a[i - 1];
			}
		}
	}
	cout << m << endl;

	
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return 1; }
  return 0; }
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return 1; }
  return 0; }

int main(void){
  ll n; cin >> n;
  ll a[n];
  int check = 0; 
  rep(i,n){
    ll b;
    cin >>b;
    if(b >= 0) a[i] = b;
    else{
      a[i] = -1*b;
      check++;
    }
  }
  sort(a,a+n);
  if(check % 2 == 1){
    a[0] = a[0]*-1;
  }
  ll sum = 0;
  rep(i,n){
    sum += a[i];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int r, g, b; cin >> r >> g >> b;
    if((10*g+b)%4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> P(N), Q(N);
  for (int i = 0; i < N; i++) {
    cin >> P[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> Q[i];
  }
  vector<int> X(N);
  iota(X.begin(), X.end(), 1);
  int res = 0, cnt = 0;
  do {
    if (P == X) res = abs(res - cnt);
    if (Q == X) res = abs(res - cnt);
    cnt++;
  } while (next_permutation(X.begin(), X.end()));
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        if(s.equals(t.substring(0,t.length()-1))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define azazax x1
#define azazay y1
#define azazaz prev

using namespace std;

typedef long long ll;
typedef long double ld;

const int max_n = 2e9, inf = 1000111222;

int main() {
    ll a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+";
        return 0;
    }
    if (a*b == 15) {
        cout << "*";
        return 0;
    }
    cout << "x";

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void swap(int *a, int *b){
    int temp;
    temp = *a;
    *a = *b;
    *b = temp;
    return;
}

int selectionsort(int n, int* r){
    int i,j,minj;
    int cnt=0;
    for(i=0;i<n;i++){
        minj = i;
        for(j=i;j<n;j++){
            if(r[j]<r[minj]) minj = j;
        }
        swap(&r[i], &r[minj]);
        if(i!=minj) cnt++;
    }
    return cnt;
}

int main(){
    int n, r[100];
    int i, res;

    scanf("%d", &n);
    for(i=0;i<n;i++) scanf("%d", &r[i]);

    res = selectionsort(n, r);
    for(i=0;i<n;i++){
        printf("%d", r[i]);
        if(i+1<n) printf(" ");
    }
    printf("\n%d\n", res);
    return 0;
}

Measured memory_bytes: 604
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <numeric>
#include <queue>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first) {
        return a.first < b.first;
    } else {
        return a.second < b.second;
    }
}
const int MAX = 2000000;
const long long MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k) {
    if(n < k)
        return 0;
    if(n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int N, K, R, S, P;
    string T;
    int res = 0;
    cin >> N >> K >> R >> S >> P >> T;
    vector<char> te(N);
    rep(i, 0, N) {
        if(i + 1 <= K) {
            if(T[i] == 'r') {
                res += P;
            } else if(T[i] == 's') {
                res += R;
            } else {
                res += S;
            }
            te[i] = T[i];
        } else {
            if(T[i] == 'r') {
                if(te[i - K] != 'r') {
                    res += P;
                    te[i] = T[i];
                } else {
                    if(i + K < N && T[i + K] == 's') {
                        te[i] = 'p';
                    } else {
                        te[i] = 's';
                    }
                }
            } else if(T[i] == 's') {
                if(te[i - K] != 's') {
                    res += R;
                    te[i] = T[i];
                } else {
                    if(i + K < N && T[i + K] == 'r') {
                        te[i] = 'p';
                    } else {
                        te[i] = 'r';
                    }
                }
            } else {
                if(te[i - K] != 'p') {
                    res += S;
                    te[i] = T[i];
                } else {
                    if(i + K < N && T[i + K] == 'r') {
                        te[i] = 's';
                    } else {
                        te[i] = 'r';
                    }
                }
            }
        }
        // cout << te[i] << "," << res << endl;
    }
    cout << res << endl;
}


Measured memory_bytes: 512
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 1; i <= (int)(n); i++)
using namespace std;

int main() {
    int N;
    cin >> N;
    cout << N * 3.1415 * 2 << endl;
    return 0;
}


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

Measured memory_bytes: 128
n=int(input())
s=str(input())
al=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
t=''
for i in range(len(s)):
  x=(al.index(s[i])+n)%26
  t=t+al[x]
print(t)

Measured memory_bytes: 3064
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){

    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){

    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){

    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){

    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
void Yay(bool condition){

    if(condition){
        p("Yay!");
    }else{
        p(":(");
    }
    return;
}

//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
	rfact[800000] = rui(fact[800000],mod - 2);
	for(ll i=800000; i>=1; i--){
	   rfact[i-1] = rfact[i] * i;
	   rfact[i-1] %= mod;
	}
	return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/

ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,k,q;
ll x[500005],y[500005],z[500005];
long double l[5000];
char s[500005],t[500005];
ll ans;

bool flag,dame;
ll timesize = 0;
ll xmin = INF,xmax = -INF,ymin = INF,ymax = -INF;
ll flag_num = 0;
bool float_flag = false;

int main(){
	cin >> a >> b;
	if(a < b){
		p(0);
	}else{
		p(10);
	}
	
	return 0;
}


Measured memory_bytes: 12416
#include<iostream>
#include<vector>
using namespace std;
class DisjointSet{
    public:
        vector<int> rank,p;
    DisjointSet(){}
    DisjointSet(int size){
        rank.resize(size,0);
        p.resize(size,0);
        for(int i=0;i<size;i++){
            makeSet(i);
        }
    }
    void makeSet(int x){
        p[x]=x;
        rank[x]=0;
    }
    bool same(int x,int y){
        return(findSet(x)==findSet(y));
    }
    void unite(int x,int y){
        link(findSet(x),findSet(y));
    }
    void link(int x,int y){
        if(rank[x]>rank[y]){
            p[y]=x;
        }else{
            p[x]=y;
            if(rank[x]==rank[y]){
                rank[y]++;
            }
        }
    }
    int findSet(int x){
        if(x!=p[x]){
            p[x]=findSet(p[x]);
        }
        return(p[x]);
    }
};
int main(){
    int n,q,x,y,com;
    cin>>n>>q;
    DisjointSet uni=DisjointSet(n);
    for(int i=0;i<q;i++){
        cin>>com>>x>>y;
        if(com==0){
            uni.unite(x,y);
        }else{
            if(uni.same(x,y)){
                cout<<"1\n";
            }else{
                cout<<"0\n";
            }
        }
    }
    return(0);
}


Measured memory_bytes: 3172
import java.util.*;
class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String sra = sc.next();
      String wk = "";
        String pre = "";
        int ret = 0;
        for (int i =0;i<n;i++){
            wk = sra.substring(i,i+1);
            if(! wk.equals(pre)) ret ++;
            pre = wk;
        }
        System.out.println(ret);
        sc.close();
    }
}



Measured memory_bytes: 32032
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

void Main()
{
  ll A,B,C,D;
  cin >> A >> B >> C >> D;
  ll L = lcm(C,D);
  ll nowariB = B -  (B/C + B/D - B/L);
  //cout << nowariB << endl;
  ll nowariA = (A-1) - ((A-1)/C + (A-1)/D - (A-1)/L);
  //cout << nowariA << endl;
  cout << nowariB - nowariA << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep (i, h) cin >> s[i];
    vector<vector<int> > g(h, vector<int>(w, -1));
    rep (i, h) {
        rep (j, w) {
            if (s[i][j] == '#') {
                g[i][j] = 1;
                continue;
            }
            bool ok = true;
            rep (k, h) {
                if (s[k][j] == '#') {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                rep (k, h) g[k][j] = 0;
            }
            ok = true;
            rep (k, w) {
                if (s[i][k] == '#') {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                rep (k, w) g[i][k] = 0;
            }
        }
    }

    rep (i, h) {
        bool exist = false;
        rep (j, w) {
            if (g[i][j] != 0) {
                cout << s[i][j];
                exist = true;
            }
        }
        if (exist) cout << endl;
    }
    
    return 0;
}



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

using namespace std;

int N;
int ma;
vector<int> G[105];
bool visit[105];

void dfs(int cur, int depth = 1)
{
    ma = max(ma, depth);

    for (int u : G[cur]) {
        if (visit[u]) {
            continue;
        }

        visit[u] = true;

        dfs(u, depth + 1);

        visit[u] = false;
    }
}

int main()
{
    while (cin >> N, N) {
        for (int i = 0; i < 100; ++i) G[i].clear();

        for (int i = 0; i < N; ++i) {
            int a, b; cin >> a >> b;
            --a, --b;
            G[a].push_back(b);
            G[b].push_back(a);
        }

        ma = 0;

        for (int i = 0; i < 100; ++i) {
            visit[i] = true;
            dfs(i);
            visit[i] = false;
        }

        cout << ma << endl;
    }
}

Measured memory_bytes: 3056
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
  string S;
  cin >> S;
  int ans = 1000000000;
  for(int i=0;i<S.size()-2;i++){
    int X = (S[i] - '0') * 100 + (S[i+1] - '0') * 10 + (S[i+2] - '0');
    int res = abs(X - 753);
    ans = min(ans, res);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
using System;

namespace ITP1_9
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                string n = Console.ReadLine().Trim('\n');
                if(n == "-") break;
                int l = int.Parse(Console.ReadLine());
                for(int i = 0; i < l; i++)
                {
                    int j = int.Parse(Console.ReadLine());
                    string m = n.Substring(0, j);
                    n = n.Remove(0, j);
                    n += m;
                }
                Console.WriteLine(n);
            }
        }
    }
}

Measured memory_bytes: 8912
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll findDivisors(ll n) 
{
    ll div[n + 1];
    ll su=0; 
    memset(div, 0, sizeof div); 
    for (ll i = 1; i <= n; i++) { 
        for (ll j = 1; j * i <= n; j++) 
            div[i * j]++; 
    }
    for (ll i = 1; i <= n; i++) 
        su+=i*div[i];
        return su;
} 
int main(){
    ll n;
    cin>>n;
    cout<<findDivisors(n);
}

Measured memory_bytes: 81716
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

class dice{
public:
  int label[7];
  void turn(char c) {
    int temp;
    if (c=='S') {
      temp=label[1];
      label[1]=label[5];
      label[5]=label[6];
      label[6]=label[2];
      label[2]=temp;
    } else if (c=='E') {
      temp=label[1];
      label[1]=label[4];
      label[4]=label[6];
      label[6]=label[3];
      label[3]=temp;
    } else if (c=='W') {
      temp=label[1];
      label[1]=label[3];
      label[3]=label[6];
      label[6]=label[4];
      label[4]=temp;
    }  else if (c=='N') {
      temp=label[1];
      label[1]=label[2];
      label[2]=label[6];
      label[6]=label[5];
      label[5]=temp;
    }
  }
  void out(){
    cout << label[1] << endl;
  }
};

int main(){
  int i;
  dice d1;
  for (i=1;i<7;i++){
    cin >> d1.label[i];
  }
  string s;
  cin >> s;
  while (s!="") {
    d1.turn(s[0]);
    s.erase(s.begin());
  }
  d1.out();
  return 0;
}



Measured memory_bytes: 3204
#include <iostream>
#include <algorithm>

using namespace std;
static const int MAX = 200000;

int main(void) {
  int R[MAX], n;
  cin >> n;
  for (int i=0;i<n;i++) cin >>R[i];
  int maxv = -2000000000;
  int minv = R[0];

  for(int i=1;i<n;i++) {
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }
  cout << maxv << endl;
  return 0;
}


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



int main(){
    int ans=2020;
    int64_t l,r;
    cin >> l>>r;

    if((l/2019)==(r/2019)){
        for(int i = l%2019; i <= r%2019; i++){
            for(int j = l%2019; j <= r%2019; j++){
                if(i==j)continue;
                ans=min(ans,(i*j)%2019);
            }
        }
    }else{
        ans=0;
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


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

int N, T;
priority_queue<int> pq;

int main() {
    cin >> N >> T;
    for (int i = 0; i < T; i++) {
        int a;
        cin >> a;
        pq.push(a);
    }

    int a_top = pq.top();

    cout << max(a_top - 1 - (N - a_top), 0) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int last = scanner.nextInt();
        long ans = last;
        for (int i = 2; i < n; i++) {
            int b = scanner.nextInt();
            ans += Math.min(last, b);
            last = b;
        }
        ans += last;
        System.out.println(ans);
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 22612
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		int first = 0;
		int second = 0;
		int third = 0;
		int temp;
		Scanner input = new Scanner(System.in);
		
		for(int i = 0; i < 10; i++) {
			temp = input.nextInt();
			if(temp > first) {
				int temp2 = first;
				first = temp;
				temp = temp2;
				if(temp > second) {
					int temp3 = second;
					second = temp;
					temp = temp3;
					if(temp3 > third) {
						third = temp3;
					}
				}
			}
			else if(temp > second) {
				int temp3 = second;
				second = temp;
				temp = temp3;
				if(temp3 > third) {
					third = temp3;
				}
			}
			else if(temp > third) {
				third = temp;
			}
		}
		System.out.println(first);
		System.out.println(second);
		System.out.println(third);
		
	}

}

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

struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))
#define int long long

signed main(){
    int n, i; cin >> n;
    for(i = 1; (i+1) * (i+1) <= n; i++);
    cout << i * i << endl;
}

Measured memory_bytes: 256
/*
ID: zhaowei10
TASK:
LANG: C++14
*/
#include "bits/stdc++.h"

using namespace std;

#ifdef LOCAL
#include "../../_library/cpp/debug.h"
#define FILE "test"
#else
#define debug(...) 0
#define FILE ""
#endif

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  if (fopen(FILE ".in", "r")) {
    freopen(FILE ".in", "r", stdin);
    freopen(FILE ".out", "w", stdout);
  }

  int a;
  cin >> a;
  cout << a + a * a + a * a * a;
}

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

using namespace std;

typedef long long int ll;
typedef long double ld;

int dp[100010];
int arr[100010];
int n;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
	}
	
	dp[0] = 0, dp[1] = abs(arr[1] - arr[0]);
	
	for(int i = 2; i < n; i++){
		int a = dp[i - 1] + abs(arr[i] - arr[i - 1]);
		int b = dp[i - 2] + abs(arr[i] - arr[i - 2]);
		
		dp[i] = min(a, b);
	}
	
	cout << dp[n - 1] << endl;
	
	return 0;
}




Measured memory_bytes: 1024
#include<stdio.h>
using namespace std;

int main(){
  int H, W;
  while(true){
    scanf("%d %d", &H, &W);
    if (H == 0 && W == 0) {
      break;
    } else {
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
          printf("#");
        }
        printf("\n");
      }
      printf("\n");
    }
  }
  return 0;
}


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

int main(void) {
    string s;
    int mindiff = INT_MAX;
    int diff ,cur;
    cin >> s;

    for(int i=0;i<s.size()-2;i++) {
        cur = (s[i]-'0')*100 + (s[i+1]-'0')*10 + s[i+2]-'0';
        diff = abs(753 - cur);
        if(mindiff > diff) {
            mindiff = diff;
        }
    }

    cout << mindiff << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2e9
#define int ll
#define vi          vector<int>
#define de          deque<int>
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()//全範囲指定を簡略化
typedef long long ll;
using namespace std;
//配列の要素数は　sizeof(ar)/sizeof(ar[0]) で求める
signed main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int N, K;
    cin >> N >> K;
    vi v(N);
    int sum = 0;

    for(int i=0;i<N;i++){
        cin >> v[i];
    }

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

    for(int i=0;i<N-K;i++){
        sum += v[i];
    }

    cout << sum << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    string s,res;
    int x[4];
    int f, r, i;

    cin >> s;
    for(i=0;i<4;i++){
        x[i]=s[i]-'0';
    }
    f = 10*x[0]+x[1];
    r = 10*x[2]+x[3];

    if((f>0&&f<13)&&(r>0&&r<13)) res = "AMBIGUOUS";
    else if(f>0&&f<13) res = "MMYY";
    else if(r>0&&r<13) res = "YYMM";
    else res = "NA";

    cout << res << 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 rept(i,k,n) for(ll i = (k); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pll;

template <typename T>
ostream& operator<<(ostream& s, const vector<T> &vec){
    for(int i=0;i<vec.size();i++){
        if(i) s << ',';
        else s << '{';
        s <<setw(2)<< vec[i];
    }
    s << '}' << endl;
    return s;
}


int main(){
    int n,m;
    cin>>n>>m;
    vector<int> h(n);
    vector<bool> ma(n,true);
    rep(i,n) {
        cin>>h[i];
    }
    rep(i,m){
        int a,b;cin>>a>>b;a--;b--;
        if(h[a]<=h[b]) ma[a]=false;
        if(h[b]<=h[a]) ma[b]=false;
    }
    int ans=0;
    rep(i,n){
        if(ma[i]) ans++;
        
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3788
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  REP(i, N) cin >> A[i];
  int m_cnt = 0;
  int a_min = 1e9 + 1;
  ll abs_sum = 0;
  REP(i, N) {
    if (A[i] < 0) m_cnt++;
    if (abs(A[i]) < a_min) a_min = abs(A[i]);
    abs_sum += abs(A[i]);
  }
  if (m_cnt % 2 == 0)
    cout << abs_sum << endl;
  else
    cout << abs_sum - 2ll * a_min << endl;
  return 0;
}

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

const int N = 100 * 1000 + 5, LG = 61;

int dp[N][LG];
long double a[N];
long double ans[N];

long long get(long long x, long long y) {
	return (x >> y) & 1;
}


int main() {
	int n, m;
	long long k;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		dp[i][0] = i;
	}
	cin >> m >> k;
	for (int i = 0; i < m; i++) {
		int x;
		cin >> x;
		swap(dp[x][0], dp[x - 1][0]);
	}
	for (int j = 1; j < LG; j++) {
		for (int i = 1; i < n; i++) {
			dp[i][j] = dp[dp[i][j - 1]][j - 1];
		}
	}
	ans[1] = a[1];
	for (int i = 2; i <= n; i++) {
		int x = i - 1;
		for (int j = 0; j < LG; j++) {
			if (get(k, j)) {
				x = dp[x][j];
			}
		}
		ans[i] = (long long) ans[i - 1] + a[x + 1] - a[x];
	}
	cout << fixed << setprecision(7);
	for (int i = 1; i <= n; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 29056
#include <bits/stdc++.h>
using namespace std;
int main(){
    
    string S;
    cin >> S;
    
    int len = S.size();
    int count=0;
    vector<int> bn(2019,0), an(2019,0);
    
    for(int i=0; i<len; i++){
        for(int j=0; j<2019; j++){
            an.at((j*10+S.at(i)-'0')%2019) = bn.at(j);
        }
        an.at(S.at(i)-'0')++;
        
        for(int j=0; j<2019; j++){
            bn.at(j) = an.at(j);
        }
        count += bn.at(0);
    }
    
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 3708
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)

    def find(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.find(self.root[x])
            return self.root[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if(x == y):
            return
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1

    def is_in_same(self, x, y):
        return self.find(x) == self.find(y)

    def count(self, x):
        return -self.root[self.find(x)]


n, m = map(int, input().split())
uf = UnionFind(n)
for _ in range(m):
    a, b = map(int, input().split())
    uf.unite(a-1, b-1)

val = 0
for i in range(n):
    val = max(val, uf.count(i))

print(val)


Measured memory_bytes: 14680
#include "iostream"
using namespace std;
int main()
{
    int t;
    cin>>t;
    
    int l= t%10;
    
    if(l==2 || l==4 || l==5||l==7 || l==9)
        cout<<"hon"<<endl;
    
     if(l==0 || l==1 || l==6||l==8 )
        cout<<"pon"<<endl;
     if(l==3)
        cout<<"bon"<<endl;

}


Measured memory_bytes: 3572
// Problem : B - Magic 2
// Contest : AtCoder - M-SOLUTIONS Programming Contest 2020
// URL : https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define ff first
#define ss second
#define vi vector<int>
#define pii pair<int, int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define mod (int)1e9+7
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define repf(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define N 100005
int main()
{
	FAST
    int t=1;
    // cin>>t;
    while(t--)
    {
		int a,b,c;
		int k;
		cin>>a>>b>>c>>k;
		if(c>b && b>a) cout<<"Yes";
		else
		{
			int cnt;
			if(!(b>a))
			{
				cnt=0;
				while(b<=a) b*=2,cnt++;
			}
			if(c<=b)
			{
				while(c<=b) c*=2,cnt++;
			}
			if(cnt<=k) cout<<"Yes";else cout<<"No";
		}
    }
    return 0;
} 


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
#define pip pair<int,pair<int,int> >
typedef unsigned long long ull;
const int inf=103974182;
using namespace std;
int n;
pair<int,pii> a[200005];
vector <pair<int,pii> >vec;
set <pair<int,pair<int,int> > > squ;
int f[200005];
priority_queue <pip,vector <pip>,greater<pip> >que;

int find(int x)
{
	return (x==f[x]?x:f[x]=find(f[x]));
}

int add(int x,int y)
{
	x=find(x);
	y=find(y);
	if(rand()&1) f[x]=y;else f[y]=x;
}

bool compare1(pair<int,pii> a,pair<int,pii> b)
{
	return a.second.first<b.second.first;
}

bool compare2(pair<int,pii> a,pair<int,pii> b)
{
	return a.second.second<b.second.second;
}

void init()
{
	for(int i=0;i<200005;i++)
	{
		f[i]=i;
	}
}

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&a[i].second.first,&a[i].second.second);
		a[i].first=i;
	}
	sort(a,a+n,compare1);
	for(int i=0;i<n-1;i++)
	{
		vec.push_back(mp(min(abs(a[i+1].second.first-a[i].second.first),abs(a[i+1].second.second-a[i].second.second)),mp(a[i].first,a[i+1].first)));
	}
	sort(a,a+n,compare2);
	for(int i=0;i<n-1;i++)
	{
		vec.push_back(mp(min(abs(a[i+1].second.first-a[i].second.first),abs(a[i+1].second.second-a[i].second.second)),mp(a[i].first,a[i+1].first)));
	}
	for(int i=0;i<vec.size();i++)
	{
		que.push(vec[i]);
//		squ.insert(vec[i]);
	}
//	for(set <pair<int,pii> > ::iterator it=squ.begin();it!=squ.end();it++)
//	{
//		cout<<it->first<<' '<<it->second.first<<' '<<it->second.second<<endl;
//	}
//	cout<<que.size()<<endl;
	init();
	int k=0;
	ll ans=0;
	while(1)
	{
//		cout<<que.size()<<endl;
//		system("pause");
		if(k==n-1) break;
		pip t=que.top();
		que.pop();
		if(find(t.second.first)==find(t.second.second)) continue;
		k++;
//		cout<<k<<endl;
		ans+=t.first;
		add(t.second.first,t.second.second);
	}
	cout<<ans<<Endl;
	return 0;
}

Measured memory_bytes: 9840
# -*- coding: utf-8 -*-

N = int(input())
lhs = [int(num) for num in input().split()]
lhs_first = lhs.pop(0)
rhs = lhs.pop()

calc_table = [0 for _ in range(21)]
calc_table[lhs_first] = 1
for num in lhs:
    new_calc_table = [0 for _ in range(21)]
    for calcs,patterns in enumerate(calc_table):
        if (calcs+num <= 20):
            new_calc_table[calcs+num] += patterns
        if (calcs-num >=  0):
            new_calc_table[calcs-num] += patterns
    calc_table = new_calc_table

print(str(calc_table[rhs]))

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

int main(){
    int n;
    cin >> n;
    vector<int> ans(2*n);
    for(int x = 1; x <= 100; x++){
        for(int y = 1; y <= 100; y++){
            for(int z = 1; z <= 100; z++){
                int a = x*x+y*y+z*z+x*y+y*z+z*x;
                if(a > n) break;
                //cout << x <<' '<<y<<' '<<z<<' '<<a << endl;
                ans[a]++;
            }
        }
    }

    for(int i = 1; i <= n; i++) cout << ans[i] << endl;
}

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

typedef pair<int, int> pii;
typedef vector<pii> vii;
const int inf = 1e8 + 11;
const int maxn = 60;
int n;
int a[maxn];
vii ans;

void pos() {
	for (int i = 1; i < n; i++) {
		ans.emplace_back(i, i + 1);
	}
}

void neg() {
	for (int i = n; i > 1; i--) {
		ans.emplace_back(i, i - 1);
	}
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	int mx = -inf, mxi = -1;
	int mn = +inf, mni = -1;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		if (a[i] > mx) {
			mx = a[i];
			mxi = i;
		}
		if (a[i] < mn) {
			mn = a[i];
			mni = i;
		}
	}
	if (mn >= 0) pos();
	else if (mx <= 0) neg();
	else if (mx > abs(mn)) {
		for (int i = 1; i <= n; i++) {
			if (a[i] < 0)
				ans.emplace_back(mxi, i);
		}
		pos();
	} else {
		for (int i = 1; i <= n; i++) {
			if (a[i] > 0)
				ans.emplace_back(mni, i);
		}
		neg();
	}
	cout << ans.size() << endl;
	for (auto x : ans)
		cout << x.first << ' ' << x.second << endl;
}


Measured memory_bytes: 256
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#define DEBUG_OUT(...)  (printf(__VA_ARGS__))
#else
#define VS_ENDPAUSE()
#define DEBUG_OUT(...)
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
    func();
    VS_ENDPAUSE();
    return 0;
}


void func(void)
{
//DEBUG_OUT("----\n");
    uint32 N;
    cin >> N;

    vector<uint32> A(N);
    for(uint32 i=0; i<N; i++){
        cin >> A[i];
    }

    sort(A.begin(), A.end());
    for(int32 i=0; i<(int32)(A.size()-1); i++){
        if(A[i] == A[i+1]){
#if 0
            uint32 sameCnt = 0;
            for(; i<N-1; i++){
                if(A[i]==A[i+1]){
                    sameCnt++;
                }else{
                    break;
                }
            }
            if(sameCnt%2 == 0){
                ans++;
            }
        }
#endif
            A.erase(A.begin()+i+1);
            A.erase(A.begin()+i);
            i--;
        }
    }
DEBUG_OUT("----\n");
    cout << A.size() << endl;

    return;
}



Measured memory_bytes: 768
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num = new int[w+1];
        sc.nextLine();
        for(int i=1; i<=w; i++){
            num[i] = i;
        }
        for(int i=0; i<n; i++){
            String[] line = sc.nextLine().split(",",0);
            int a = Integer.parseInt(line[0]);
            int b = Integer.parseInt(line[1]);
            int tmp = num[a];
            num[a] = num[b];
            num[b] = tmp;
        }
        for(int i=1; i<=w; i++){
            System.out.println(num[i]);
        }
    }
}




Measured memory_bytes: 26220
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
typedef long long ll;
 
int main(){
    int n, m, x, temp, i, ans=0, ans1=0, s, e; cin>>n>>m;
    vector<int> arr;
    for(x=0; x<n; x++){
        cin>>temp;
        arr.push_back(temp);
    }
    if(n==m){
        cout<<1;
        return 0;
    }
    i=distance(arr.begin(), min_element(arr.begin(), arr.end()));
    for(x=i; x>0; x-=m-1) ans++;
    for(x=i; x<n-1; x+=m-1) ans++;
    for(x=0; x<n-1; x+=m-1){
        if(find(arr.begin()+x, arr.begin()+x+m-1, 1)!=arr.begin()+x+m-1){
            s=x, e=x+m-1, ans1++;
            break;
        }
    }
    for(x=s; x>0; x-=m-1) ans1++;
    for(x=e; x<n-1; x+=m-1) ans1++;
    cout<<min(ans, ans1);
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int>time(3);
  for(int i=0;i<3;i++){
    cin>>time.at(i);
  }
  sort(time.begin(),time.end());
  cout<<time.at(0)+time.at(1)<<endl;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using edge = pair<ll, P>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    unordered_map<int, int> cnt;
    rep(i, Q) {
        int a;
        cin >> a;
        a --;
        cnt[a] ++;
    }

    rep(i, N) {
        int t = K - Q + cnt[i];
        if (t > 0) {
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

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


Measured memory_bytes: 4772
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll a, b, x;
    cin >> a >> b >> x;

    if(a==b){
        if(a%x==0){
            p(1);
            return 0;
        }
        else{
            p(0);
            return 0;
        }
    }

    // aを割り切れるところまで移動
    if(a%x!=0){
        ll move = x - (a%x);
        a += move;
    }

    ll diff = b - a;

    if(diff < 0){
        p(0);
    }else{
        p(diff / x + 1);
    }

    return 0;
}

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

int n;
typedef pair<string, pair<int, int>> P;
vector<P> v;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=0; i<n; ++i){
		string s;
		int p;
		cin >> s >> p;
		v.push_back(P(s, make_pair(p, i+1)));
	}
	sort(v.begin(), v.end(), [](const P p, const P q){
		if(p.first < q.first) return true;
		if(p.first == q.first && p.second.first > q.second.first) return true;
		return false;
	});
	for(auto i:v)
		cout << i.second.second << "\n";
}

Measured memory_bytes: 256