akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define inf LLONG_MAX
#define bp __builtin_popcountll
#define pb push_back
#define ff first
#define ss second
#define P pair<ll,ll>
#define N 100001
#define all(a) a.begin(),a.end()
#define LG 20
#define int ll
#define nl '\n'
#define sp " "
#define vi vector<int>
#define f(n) for(int i=0;i<n;i++)
#define mod 1000000007
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
#define ps(x,y) fixed<<setprecision(y)<<x
#define F(i,a,b) for(int i = a ; i < b ; i++)
#define print_vector(v) cout<< #v << " " ; for(auto j:v) cout<<j<<sp; cout<<nl;
#define deb(x) cout<< #x << " " << x << endl;


// vector<vector<int>> dp(100002, vector<int>(6,-1));
int dp[100002][6];


int power(int x, int y){
    if(y==0) return 1;
    int temp = power(x,y/2);

    int curr = (temp*temp)%mod;
    if(y%2) return (curr*x)%mod;
    else return curr;
}



// void dfs(int curr){

// }



void solve(){
    int n;
    cin>>n;
    vi v(n);
    f(n) cin>>v[i];
    int sum = 0;
    for(int i=0;i<n;i++) {
        sum+=v[i];
        sum = sum%mod;
    }
    int ans = 0;
    for(int i=0;i<n;i++){
        sum-=(v[i]);
        if(sum<0) sum+=mod;
        ans+=((sum%mod)*(v[i]%mod));
        ans = ans%mod;
    }

    cout<<ans<<nl;
}

signed main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast;
    // int t;
    // cin>>t; 
    // while(t--){
        solve();
    // }
}

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

int main() {

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

    int arr[n];
    int mysum = 0;

    for (int i = 0; i < n; i++) {
        scanf("%d", &d);
        arr[i] = d;
    }

    for (int j = 0; j < n; j++) {
        for (int k = j + 1; k < n; k++) {
            mysum += arr[j] * arr[k];
        }
    }

    printf("%d", mysum);



    return 0;

}

Measured memory_bytes: 128
s = input()
s1 = s[::2]
s2 = s[1::2]
count1 = 0
count2 = 0
count3 = 0
count4 = 0

for i in s1:
    if i == "1":
        count1 += 1
    else:
        count2 += 1
for j in s2:
    if j == "1":
        count3 += 1
    else:
        count4 += 1

answer1 = count2 + count3
answer2 = count1 + count4

if answer1 >= answer2:
    print(answer2)
else:
    print(answer1)


Measured memory_bytes: 3188
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n){
    vector<int> v(n, 0);
    vector<int> cnt(26, 0);
    function<void(int)> f = [&](int idx){
        if(idx == n - 1){
            for(int j = 0; j < n; ++j)
                cout << char(v[j] + 'a');
            cout << endl;
            return;
        }
        for(int i = 0;!i || cnt[i - 1]; ++i){
            ++cnt[i];
            v[idx + 1] = i;
            f(idx + 1);
            --cnt[i];
        }
    };
    cnt[0] = 1;
    f(0);
}


signed main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n, m, x, sum = 0;
    cin >> n >> m;
    for(int i=1; i<=m; i++)
    {
        cin >> x;
        sum += x;
    }
    if(n>sum) cout << n-sum <<endl;
    else if(n<sum) cout<< "-1" <<endl;
    else if(n == sum) cout << "0" <<endl;
    return 0;
}


Measured memory_bytes: 3640
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
#define int long long
int seg_tree[seg_size*4];
int seg_sub[seg_size*4];
int seg_set(int now){
    seg_tree[now*2] += seg_sub[now*2];
    seg_sub[now*2*2] += seg_sub[now*2];
    seg_sub[now*2*2+1] += seg_sub[now*2];
    seg_sub[now*2] = 0;
    seg_tree[now*2+1] += seg_sub[now*2+1];
    seg_sub[(now*2+1)*2] += seg_sub[now*2+1];
    seg_sub[(now*2+1)*2+1] += seg_sub[now*2+1];
    seg_sub[now*2+1] = 0;
    seg_tree[now] = min(seg_tree[now*2],seg_tree[now*2+1]);
    if(now != 0) seg_set(now/2);
    return 0;
}
int seg_find(int now,int n_l,int n_r,int w_l,int w_r){
    seg_tree[now] += seg_sub[now];
    seg_sub[now*2] += seg_sub[now];
    seg_sub[now*2+1] += seg_sub[now];
    seg_sub[now] = 0;
    if(w_l <= n_l&&n_r <= w_r) return seg_tree[now];
    if(n_r <= w_l||w_r <= n_l) return (1LL << 31LL) - 1LL;
    return min(seg_find(now*2,n_l,(n_l+n_r)/2,w_l,w_r),seg_find(now*2+1,(n_l+n_r)/2,n_r,w_l,w_r));
}
int seg_add(int now,int n_l,int n_r,int w_l,int w_r,int setting){
    seg_tree[now] += seg_sub[now];
    seg_sub[now*2] += seg_sub[now];
    seg_sub[now*2+1] += seg_sub[now];
    seg_sub[now] = 0;
    if(w_l <= n_l&&n_r <= w_r){
        seg_sub[now] += setting;
        seg_set(now/2);
        return seg_tree[now];
    }
    if(n_r <= w_l||w_r <= n_l) return (1LL << 31LL) - 1LL;
    return min(seg_add(now*2,n_l,(n_l+n_r)/2,w_l,w_r,setting),seg_add(now*2+1,(n_l+n_r)/2,n_r,w_l,w_r,setting));
}
#undef int
int main(){
#define int long long
    int n,m;
    cin >> n >> m;
    REP(i,m){
        int a;
        cin >> a;
        if(a == 0){
            int b,c,d;
            cin >> b >> c >> d;
            seg_add(1,0,seg_size,b,c+1,d);
        }else{
            int b,c;
            cin >> b >> c;
            cout << seg_find(1,0,seg_size,b,c+1) << endl;
        }
    }
}


Measured memory_bytes: 7852
h,w = map(int, input().split())
a = [ list(map(int, input().split())) for _ in range(h)]
ans = []
for i in range(h):
    for j in range(w):
        if a[i][j]%2==0:
            continue
        if i==h-1 and j==w-1:
            continue
        elif j==w-1:
            a[i][j]-=1
            a[i+1][j]+=1
            ans.append([i+1,j+1,i+2,j+1])
        else:
            a[i][j] -=1
            a[i][j+1] +=1
            ans.append([i+1,j+1,i+1,j+2])
n = len(ans)
print(n)
for i in range(n):
    print(*ans[i])

Measured memory_bytes: 30276
import sys
n = int(input())
h_ls = [int(i) for i in sys.stdin.readline().split()]
_max = 0
cur = 0
for i in range(n-1):
    if h_ls[i] >= h_ls[i+1]:
        cur += 1
    else:
        cur = 0
    _max = max(cur, _max)
print(_max)

Measured memory_bytes: 14168
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef double ld;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}
ll gcd(ll a,ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< MOD >;
long long modpow(long long a, long long n, long long mod=MOD) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
	init();
	ll N;cin>>N;
	vector<ll>C(N);
	for(int i=0;i<N;i++)cin>>C[i];
	sort(C.begin(),C.end(),greater<ll>());
	
	ll num=modpow(2,N-1);
	ll add=modpow(2,N-2);
	//cout<<add<<endl;
	ll ans=0;
	
	
	
	for(int i=0;i<N;i++){
		ans+=C[i]*num;
		ans%=MOD;
		num+=add;
		num%=MOD;
	}
	ans*=modpow(2,N);
	ans%=MOD;
	cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
	int r, g;
	cin >> r >> g;
	cout << 2 * g - r << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#define INF 100000000
#define MOD 1000000007
using namespace std;


int main(){
    string S;
    cin >> S;
    
    int position=S.length();
    while(position>0){

        
        if(position>=5){
        if(S.substr(position-5,5)=="dream" || S.substr(position-5,5)=="erase"){
            position-=5;
            continue;
        }
        }
        
        if(position>=6){
        if(S.substr(position-6,6)=="eraser"){
            position-=6;
            continue;
        }
        }
        
        if(position>=7){
        if(S.substr(position-7,7)=="dreamer"){
            position-=7;
            continue;
        }
        }
        
        if(position!=0){
            cout<<"NO"<<endl;
            return 0;
        }
        
    }
    
    cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 512
#include<cstdio>
int M,K;
int main() {
	scanf("%d %d",&M,&K);
	if(K>=(1<<M)) {
		printf("-1");
		return 0;
	}
	if(M==1) {
		if(K==0) printf("0 0 1 1");
		else printf("-1");
		return 0;
	}
	for(int i=0;i<(1<<M);i++) {
		if(i!=K) printf("%d ",i);
	}
	printf("%d ",K);
	for(int i=(1<<M)-1;i>=0;i--) {
		if(i!=K) printf("%d ",i);
	}
	printf("%d",K);
	return 0;
}
/*
1 偶  -> 0
1 奇  -> 1 

000
001
010
011
//100
101
110
111

00
01
00
01
0 1 0 1

0 1 2 3 5 6 7 4 7 6 5 3 2 1 0 4
*/

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

typedef long long lint;
typedef unsigned long long ulint;
const int MOD=1000000007;

lint S(lint a){
    lint r=0;
    while(a>0){
        r+=a%10;
        a/=10;
    }
    return r;
}
bool former(lint a, lint b){
    return (a*S(b)<b*S(a)) || (a*S(b)==b*S(a) && a<b);
}
int keta(lint a){
    int k=1;
    while(a>10){
        k++;
        a/=10;
    }
    return k;
}
lint pow10(lint n){
    if(n<=0) return 1LL;
    else return pow10(n-1)*10LL;
}

lint nextsunuke(lint n){
    lint r=n+1;
    int k=keta(n+1);
    for(lint i=0;i<=k+1;i++){
        lint m=pow10(i)*((n+1)/pow10(i)+1LL)-1;
        if(m>n){
            r=former(r,m)?r:m;
        }
    }

    return r;
}
int main(){
    int K;
    cin >> K;
    lint prev=1LL;
    cout << 1 << endl;

    for(int i=2;i<=K;i++){
        prev=nextsunuke(prev);
        cout << prev << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;

int main(){
    int N, n, j;
    cin >> N;
    vector<int> A(N);
    j = 1;
    for (int i = 0; i < A.size(); i++)
    {
        cin >> n;
        A[n-1] = j++;
    }
    
    for (int i : A)
    {
        cout << i << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,W; cin >> N >> W;
    vector<int> v(N),w(N);
    rep(i,N) cin >> v[i] >> w[i];
    vector<int> dp(W+1,0);
    rep(i,N) rep2(j,w[i],W+1){
        chmax(dp[j],dp[j-w[i]]+v[i]);
    }
    int ans=0;
    rep(i,W+1) chmax(ans,dp[i]);
    cout << ans << endl;
}


Measured memory_bytes: 3260
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void){
 
    int a[5]={0};
    string str="null";
    while(scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4])!=EOF){
        sort(a,a+5);
        if(((a[0]==a[1])&&(a[2]==a[3])&&(a[2]==a[1]))||((a[1]==a[2])&&(a[2]==a[3])&&(a[3]==a[4])))str="four card";
        else if(((a[0]==a[1])&&(a[1]==a[2])&&(a[3]==a[4]))||((a[0]==a[1])&&(a[2]==a[3])&&(a[3]==a[4])))str="full house";
        else if(((a[0]==1)&&(a[1]==10)&&(a[2]==11)&&(a[3]==12)&&(a[4]==13))||((a[0]+1==a[1])&&(a[1]+1==a[2])&&(a[2]+1==a[3])&&(a[3]+1==a[4])))str="straight";
        else if(((a[0]==a[1])&&(a[1]==a[2]))||((a[1]==a[2])&&(a[2]==a[3]))||((a[2]==a[3])&&(a[3]==a[4])))str="three card";
        else if(((a[0]==a[1])&&((a[2]==a[3])||(a[3]==a[4])))||((a[1]==a[2])&&(a[3]==a[4])))str="two pair";
        else if((a[0]==a[1])||(a[1]==a[2])||(a[2]==a[3])||(a[3]==a[4]))str="one pair";
 
        cout<<str<<endl;
    }
    return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int N,W;
signed main(){
	cin>>N>>W;
	int off = 0;
	vector<int> vs[4];
	rep(i,N){
		int w;
		cin>>w;
		if(i==0) off = w;
		w -= off;
		int v;
		cin>>v;
		vs[w].pb(v);
	}
	rep(i,4) sort(all(vs[i]),greater<int>());
	int ans = 0;

	int vi = 0;
	rep(i,vs[0].size()+1){
		if(i!=0) vi += vs[0][i-1];
		int vj = 0;
		rep(j,vs[1].size()+1){
			if(j!=0) vj += vs[1][j-1];
			int vk = 0;
			rep(k,vs[2].size()+1){
				if(k!=0) vk += vs[2][k-1];
				int vl = 0;
				rep(l,vs[3].size()+1){
					if(l!=0) vl += vs[3][l-1];
					int wei = (off)*i + (off+1)*j + (off+2)*k + (off+3)*l;
					if(wei<=W){
						int val = vi+vj+vk+vl;
						chmax(ans,val);
					}
				}
			}
		}
	}
	cout<<ans<<endl;
}


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

class Main {
    public static void main(String... args) {
        int D = IN.nextInt();
        int G = IN.nextInt();
        int[] p = new int[D + 1];
        int[] c = new int[D + 1];
        // pad index 0
        for (int i = 1; i <= D; i++) {
            p[i] = IN.nextInt();
            c[i] = IN.nextInt();
        }
        int[] complete = new int[D + 1];
        for (int i = 1; i <= D; i++) {
            complete[i] = 100 * i * p[i] + c[i];
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < (1 << D); i ++) {
            int score = 0;
            int num = 0;
            for (int j = 1; j <= D; j++) {
                int k = 1 << (j - 1);
                if ((i & k) > 0) {
                    score += complete[j];
                    num += p[j];
                }
            }
            if (score >= G) {
                ans = num < ans ? num : ans;
            } else {
                int notCompInd = 0;
                for (int m = 0; m < D; m++) {
                    if (((~i >> m) & 1) == 1) {
                        notCompInd = m + 1;
                    }
                }
                if (notCompInd == 0) {
                    continue;
                }
                int solvNum = (G - score) / (notCompInd * 100);
                if (((G - score) % (notCompInd * 100)) > 0) {
                    solvNum++;
                }
                if (solvNum > (p[notCompInd] - 1)) {
                    continue;
                }
                num += solvNum;
                ans = num < ans ? num : ans;
            }
        }
        puts(ans);
    }

    static final Scanner IN = new Scanner(System.in);
    static <T> void puts(T arg) { System.out.println(arg); }
}

Measured memory_bytes: 23764
N = int(input())
if N % 10 == 2 or N % 10 == 4 or N % 10 == 5 or N % 10 == 7 or N % 10 == 9:
  print('hon')
elif N % 10 == 0 or N % 10 == 1 or N % 10 == 6 or N % 10 == 8:
  print('pon')
elif N % 10 == 3:
  print('bon')

Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ

string solve(string s,int a,int b){
    string res="";
    if(a==0&&b==0){
        res+="SS";
    }else if(a==0&&b==1){
        res+="SW";
    }else if(a==1&&b==0){
        res+="WS";
    }else{
        res+="WW";
    }
    for(int x=1;x<s.size();x++){
        if(x==s.size()-1){
            if(res[0]=='S'){
                if(s[0]=='o'&&res[1]!=res[x]) return "False";
                if(s[0]=='x'&&res[1]==res[x]) return "False";
            }else{
                if(s[0]=='o'&&res[1]==res[x]) return "False";
                if(s[0]=='x'&&res[1]!=res[x]) return "False";
            }
            if(s[x]=='o'){
                char p=res[x-1];
                if(res[x]=='S' && p==res[0]) return res;
                else if(res[x]=='W'&& p!=res[0]) return res;
            }else{
                char p=res[x-1];
                if(res[x]=='W'&&p==res[0]) return res;
                else if(res[x]=='S'&&p=='W'&&p!=res[0]) return res;
            }
            return "False";
        }
        if(s[x]=='o'){
            char p=res[x-1];
            if(res[x]=='S') res+=p;
            else if(p=='W') res+='S';
            else res+='W';
        }else{
            char p=res[x-1];
            if(res[x]=='W') res+=p;
            else if(p=='W') res+='S';
            else res+='W';
        }
    }
    return "False";
}

signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; cin >> n;
    string s; cin >> s;
    
    rep(i,2){
        rep(j,2){
            if(solve(s,i,j)!="False"){
                string ans=solve(s,i,j);
                cout << ans << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 3844
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string>
#define pll pair<ll,ll>
#define NMAX 200001

using namespace std;
typedef long long ll;
typedef long double ld;
int val[NMAX];
int main()
{
    ios::sync_with_stdio(false);
    int H,W,n,x,y;
    string s,t;
    cin>>H>>W>>n>>x>>y;
    cin>>s>>t;
    int vact;
    char act[]={'R','L','U','D'};
    char op[] ={'L','R','D','U'};
    int valact[]={W-y+1,y,x,H-x+1};
    int maxact[]={W,W,H,H};
    for(int car=0;car<4;car++)
    {
        for(int i=n-1;i>=0;i--)
        {
            val[i]=val[i+1]+(s[i]==op[car])-(t[i]==act[car]);
        }
        vact=valact[car];
        for(int i=0;i<n;i++)
        {
            if(s[i]==act[car])
            {
                vact--;
            }
            if(vact<=0)
            {
                cout<<"NO"<<'\n';
                return 0;
            }
            if(t[i]==op[car] && vact+1<=maxact[car])
            {
                vact++;
            }
            else
            {
                if(t[i]==act[car] && maxact[car]-vact-val[i]+1<=0)
                    vact--;
            }
            if(vact<=0)
            {
                cout<<"NO"<<'\n';
                return 0;
            }
        }
        if(vact<=0)
        {
            cout<<"NO"<<'\n';
            return 0;
        }
    }
    cout<<"YES"<<'\n';
    return 0;
}

Measured memory_bytes: 1536
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int main(){
	int a,b;
	scanf("%d%d",&a,&b);if(a>b)swap(a,b);
	if(a+1<b){
		printf("0\n");return 0;
	}
	long long ret=1;
	if(a==b){
		ret=2;
	}
	for(int i=0;i<a;i++)ret=ret*(i+1)%mod;
	for(int i=0;i<b;i++)ret=ret*(i+1)%mod;
	printf("%lld\n",ret);
}


Measured memory_bytes: 128
#include "stdio.h"
int main(int argc, char const *argv[])
{
	int i,j,flag=0,count;
	char string[201];
	char p[101];
	scanf("%s",string);
	scanf("%s",p);
	for(i=0;;i++){
		if(string[i] == '\0'){
			count = i;
			break;
		}
	}
	for(i=0;i<count;i++){
		string[i + count] = string[i];
	}
	for(i=0;i<100;i++){
		for(j=0;;j++){
			if(p[j] != string[i+j] && p[j] != '\0')
				break;
			if(p[j] == '\0')
				flag = 1;
		}
	}
	if(flag == 1)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}


Measured memory_bytes: 524
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        System.out.println((reader.nextInt()-reader.nextInt())%reader.nextInt());
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  vector<int> x;
  cin >> N;
  x.resize(N);
  x[0] = -1;
  reps(i, 1, N) cin >> x[i];
  int ans = 1;
  int sz = 0;
  rep(i, N) {
    if(x[i] >= 2*sz-1) sz++;
    else (ans *= sz) %= mod;
  }
  rep(i, sz) (ans *= (i+1)) %= mod;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int  a,b;
    cin >> a >> b;
    if(a <= b) cout << a << endl;
    else cout << a - 1 << endl;
    return 0;
}


Measured memory_bytes: 3608
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] datas = new int[n][3];
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            int h = sc.nextInt();
            datas[i] = new int[]{x, y, h};
        }
        
        int idx = 0;
        while (datas[idx][2] < 1) {
            idx++;
        }
        int x0 = datas[idx][0];
        int y0 = datas[idx][1];
        int h0 = datas[idx][2];
        
        
        for (int cx = 0; cx <= 100; cx++) {
            for (int cy = 0; cy <= 100; cy++) {
                boolean solved = true;
                int H = h0 + Math.abs(x0 - cx) + Math.abs(y0 - cy);
                
                for (int i = 0; i < n; i++) {
                    int x = datas[i][0];
                    int y = datas[i][1];
                    int h = datas[i][2];
                    
                    boolean contradicts = h != Math.max(H - Math.abs(x - cx) - Math.abs(y - cy), 0);
                    if (contradicts) {
                        solved = false;
                        break;
                    }
                }
                
                if (solved) {
                    System.out.println(cx + " " + cy + " " + H);
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 23764
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<min(b/a,c);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <math.h>
using namespace std;
using ll = long long;
using R = double;



int main(void){
 int W,a,b;
 cin >> W >> a >>b;
if(abs(a-b) <= W) cout << 0 << endl;
else cout << abs(a-b) -W << endl;

}

Measured memory_bytes: 764
/*------------------------------------------------,
|  __                                       __    |
| |  |--.-----.---.-.----.----.-----.-----.|  |_  |
| |  _  |  -__|  _  |  __|  __|  -__|  _  ||   _| |
| |_____|_____|___._|____|____|_____|   __||____| |
|                                   |__|          |
`------------------------------------------------*/
#include<algorithm>
#include<array>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdint>
#include<deque>
#include<functional>
#include<iomanip>
#include<ios>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
typedef long long ll; using namespace std;
#define INF 2147483647
#define MOD 10000007
#define REP(counter, limit) for (long long counter = 0; counter < limit; counter++)
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) { if (a == 1) { return false; }if (a == 2) { return true; }if (a % 2 == 0) { return false; }for (int i = 3; i < sqrt(a) + 1; i += 2) { if (a != i) { if (a % i == 0) { return false; } } }return true; }
struct setupios{setupios(){cin.tie(0);ios::sync_with_stdio(0); /*cout<<fixed<<setprecision(20);*/};}setupios;
int main() {

  int x,n;
  cin>>x>>n;
  vector<int> p(n);
  REP(i,n)cin>>p[i];

  int ans=MOD;
  for(int i=-1;i<102;i++){
    bool tr=false;
    REP(j,p.size()){
      if(i==p[j]){
        tr=true;
        break;
      }
    }
    if(!tr){
      if(abs(ans-x) > abs(x-i)){
        ans=i;
      }
    }
  }
  cout<<ans<<endl;

}


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

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int main()
{
    int k, out=0, d;
    cin >> k;
    for (int a=1;a<=k;++a){
        for (int b=1;b<=k;++b){
            for (int c=1;c<=k;++c){
                d=gcd(a,b);
                out+=gcd(c,d);
            }
        }
    }
    cout << out << endl;
    return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		for (int j = i + 1; j < s.size() ; j++) {
			if (s[i] == s[j]) {
				cout << "no";
				return 0;
			}
		}
	}
	cout << "yes";
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <set>
#include <stack>
using namespace std;
int N, M; 
vector<int> E[800010]; 
int visited[800010]; 
int main(){
	string S; 
	cin >> N >> M >> S; 
	set<pair<int, int>> T;
	for(int i = 0; i < M; i++){
		int a, b; cin >> a >> b; 
		a--; b--; 
		if(a > b) swap(a, b); 
		T.insert(make_pair(a, b)); 
	}
	int In[800010] = {};
	for(auto it = T.begin(); it != T.end(); it++){
		int a = (*it).first; int b = (*it).second; 
		if(S[a] == 'A' && S[b] == 'A'){
			E[4*a+3].push_back(4*b); In[4*b] ++; 
			if(a!= b) {
				E[4*b+3].push_back(4*a); In[4*a] ++; 
			}
		}
		if(S[a] == 'A' && S[b] == 'B'){
			E[4*a].push_back(4*b+1); In[4*b+1] ++; 
			E[4*b+2].push_back(4*a+3); In[4*a+3] ++; 
		}
		if(S[a] == 'B' && S[b] == 'A'){
			E[4*a+2].push_back(4*b+3); In[4*b+3] ++; 
			E[4*b].push_back(4*a+1); In[4*a+1] ++; 
		}
		if(S[a] == 'B' && S[b] == 'B'){
			E[4*a+1].push_back(4*b+2); In[4*b+2] ++; 
			if(a != b){
				E[4*b+1].push_back(4*a+2); In[4*a+2] ++; 
			}
		}
	}
	stack<int> st;
	for(int i = 0; i < N*4; i++){
		if(!In[i]) st.push(i); 
	}
	vector<int> Top = {}; //トポロジカルソート後
	while(st.size()){
		int i = st.top(); st.pop(); 
		Top.push_back(i); 
		for(int j = 0; j < E[i].size(); j++){
			In[E[i].at(j)] --; 
			if(!In[E[i].at(j)]) st.push(E[i].at(j)); 
		}
	}
	cout << ((Top.size() == N*4) ? "No" : "Yes") << endl;
}

Measured memory_bytes: 47768
// agrawal117
//chahatagrawal117  
#include<bits/stdc++.h>
#define mod 998244353
#define endl '\n'
typedef  long long int ll ; 
using namespace std;
#define MAX 200006
ll dp[MAX]; ll jmp[MAX];
ll n=0;
ll tree[800009];

ll combine(ll a,ll b)					// 1 based indexing remember;
{
	return max(a,b);
}
ll rec(int i)
{
    if(i==n) return 1;
    if(dp[i]!=-1) return dp[i]%mod;
    dp[i]=(rec(i+1) %mod) + (rec(jmp[i]) % mod);
    dp[i]%=mod;
    return dp[i]%mod;
}
ll query(ll start,ll end,ll node,ll l,ll r)
{
	if(start>r || l>end) {				//no overlap case  return that value which does not affect the ans 
		return LLONG_MIN;							// as in case of sum we can return 0;
	}
	else if(l<=start && r>=end) {
		return tree[node];           // case of fully overlap
	}
	else{
		ll mid=(start+end)>>1;								//partial overlap so call both children
		ll child1=query(start,mid,2*node,l,r);
		ll child2=query(mid+1,end,(2*node)+1,l,r);
		return combine(child1,child2);
	}
}

void update(ll start,ll end,ll node,ll idx,ll value)
{
	 if(start==end){
		tree[node]=value;
		return;
	}
	ll mid=(start+end)>>1;	
	if(start<=idx && idx<=mid){
	 update(start,mid,2*node,idx,value);
	}
	 else{
		update(mid+1,end,(2*node)+1,idx,value);
	 }
	tree[node]=combine(tree[2*node],tree[(2*node)+1]);
}

int main()
{
     cin>>n;
    vector<pair<ll,ll> > v;
    for(int i=1;i<=n;i++){
        ll a, b; cin>>a>>b;
        v.push_back({a,b});
    }
    sort(v.begin(),v.end());
    jmp[n-1]=n;
    update(1,n,1,n,n);
    for(int i=n-2;i>=0;i--){
        ll val= v[i].first+v[i].second;
        if(val<=v[i+1].first) jmp[i]=i+1;
        else {
            pair<ll,ll> pp; pp.first=val; pp.second=LLONG_MIN;
            int j= lower_bound(v.begin(),v.end(),pp)-v.begin();
            j--;
            // cout<<i<<" J "<<j<<endl;
            ll mx= query(1,n,1,i+2,j+1);
            jmp[i]=mx;
        }
        update(1,n,1,i+1,jmp[i]);
    }
    // for(int i=0;i<n;i++) cout<<jmp[i]<<" ";
    // cout<<endl;
    for(int i=0;i<=n-1;i++) dp[i]=-1;
    dp[n]=1;
    cout<<rec(0)%mod<<endl;
    
    
}

Measured memory_bytes: 19820
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c){
    return b / c - (a - 1) / c;
}

int main(){
    int n, t, x;
    string s;
    cin >> s;
    if (s[0] == 'S' && s[1] =='U'){
        cout << "7" << endl;
    }
    if (s[0] == 'S' && s[1] =='A'){
        cout << '1' << endl;
        return 0;
    }
    if (s[0] == 'F' && s[1] =='R'){
        cout << '2' << endl;
        return 0;
    }
    if (s[0] == 'T' && s[1] =='H'){
        cout << '3' << endl;
        return 0;
    }
    if (s[0] == 'W' && s[1] =='E'){
        cout << '4' << endl;
        return 0;
    }
    if (s[0] == 'T' && s[1] =='U'){
        cout << '5' << endl;
        return 0;
    }
    if (s[0] == 'M' && s[1] =='O'){
        cout << '6' << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int S;
	int A;
	int B;
	int C;
	int Cs;
	scanf("%d %d %d",&A,&B,&C);
	S=A;
	Cs=S%B;
	while(true){
		if(C==S%B){
			printf("YES\n");
			return 0;
		}
		S+=A;
		if(S%B==Cs){
			printf("NO\n");
			return 0;
		}
	}
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <string.h>
#include <iomanip>

using namespace std;

int main()
{
	int r, D, x;
	
	cin >> r >> D>>x;
	long rx[100];
	rx[0] = (r * x) -D;
	cout <<rx[0] <<endl;
	
	for (int i = 1; i<10; i++)
	{
		rx[i] = r*rx[i-1] - D;
		cout <<rx[i] <<endl; 
	}	
	
	
	
	
	
	return 0;
}



Measured memory_bytes: 256
n,a,m,s,r = int(input()),list(map(int,input().split())),(10**9)+7,0,0
for i in range(n): s = (s+a[i])%m
for i in range(n):
    s = (s-a[i])%m
    r = (r+(a[i]*s))%m
print(r%m)


Measured memory_bytes: 94092
from math import sqrt
n=int(input())
ans=0
xy=[list(map(int,input().split())) for i in range(n)]
for i in range(n-1):
  for j in range(i+1,n):
    res=(xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2
    ans+=2*sqrt(res)
print(ans/n)

Measured memory_bytes: 62260
eq = input().split()
stack = []

for op in eq:
    if op == "+":
        x = stack.pop() + stack.pop()
        stack.append(x)
    elif op == "-":
        x1 = stack.pop()
        x2 = stack.pop()
        stack.append(x2 - x1)
    elif op == "*":
        x = stack.pop() * stack.pop()
        stack.append(x)
    else:
        stack.append(int(op))

print(stack[0])



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

typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
const double pi = 3.141592653589793238;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

void printV(vector<int> &v);
void printVV(vector<vector<int>> &vv);


int main() {
  int N;
  cin >> N;

  vector<int> v(N+1);
  v.at(0) = 0;
  for(int i = 1; i <= N; i++) {
    cin >> v.at(i);
  }

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

  int cnt = 0;
  for(int i = 1; i <= N; i++) {
    if(v.at(i) > v.at(i-1)) cnt++;
  }
  cout << cnt << endl;

  return 0;
}


// ベクターの中身を全部出力
void printV(vector<int> &v) {
  cout << "  [ ";
  for(int i = 0; i < (int)v.size(); i++) {
    cout << v.at(i) << " ";
  }
  cout << "]" << endl;
}

void printVV(vector<vector<int>> &vv) {
  cout << "{" << endl;
  for(int i = 0; i < (int)vv.size(); i++) {
    cout << "  [ ";
    for(int j = 0; j < (int)vv.at(i).size(); j++) {
      cout << vv.at(i).at(j) << " ";
    }
    cout << "]," << endl;
  }
  cout << "}" << endl;
}


Measured memory_bytes: 256
import scala.io.StdIn

object Main {
  def main(args: Array[String]) = {
    val array = StdIn.readLine.split(" ").map(_.toInt)
    val (n, a, b) = (array(0), array(1), array(2))
    var count = 0
   
    for(x <- 1 to array(0)){
      if((a to b).contains(x.toString.map(_.asDigit).sum)) count += x 
    }
    println(count)
  }
  
}

Measured memory_bytes: 32472
fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map { it.toInt() }


    fun meetsCondition(gcd: Int) : Boolean {
        // check M = gcd * K or Not
        val K = M / gcd
        return K >= N && (M % gcd) == 0
    }

    // Find lowerbound that meets condition
    /*
    fun lowerBound() : Int {
        var ng = M // left
        var ok = 1  // right

        while (Math.abs(ok - ng) > 1) {
            var mid = (ok + ng) / 2
            println("$$$$$$$$$$")
            println(mid)
            println(meetsCondition(mid))
            println("$$$$$$$$$$")
            if (meetsCondition(mid)) {
                ok = mid
            } else {
                ng = mid
            }
        }
        return ok
    }
    */
    println(
            (M/N downTo 1).first { meetsCondition(it) }
    )
}

Measured memory_bytes: 38004
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 23 16:58:10 2020

@author: liang
"""


"""
【パディングはソート後】
"""
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
A += [-1]
ans = 0
count = 1
for i in range(N):
    #print(count)
    if A[i] == A[i+1]:
        #print("A")
        count += 1
    else:
        #print("B")
        if count%2 == 1:
            ans += 1
        count = 1
print(ans)

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

string S;
int cur=0;

int factor();
int expression();

int factor(){
	if(isdigit(S[cur])){
		return S[cur++]-'0';
	}else if(S[cur]=='('){
		cur++;
		int num=expression();
		assert(S[cur]==')');
		cur++;
		return num;
	}
	return 0;
}

int expression(){
	int a=factor(),b;
	switch(S[cur]){
		case '+':
			cur++;
			b=factor();
			a+=b;
			break;
		case '-':
			cur++;
			b=factor();
			a-=b;
			break;
		case '*':
			cur++;
			b=factor();
			a*=b;
			break;
	}
	return a;
}

int eval(string e){
	S=e;
	cur=0;
	return expression();
}

string base_exp[5]={
	"(((a,b),c),d)",
	"((a,(b,c)),d)",
	"(a,(b,(c,d)))",
	"(a,((b,c),d))",
	"((a,b),(c,d))"
};

char op[3]={'+','-','*'};

int main(void){
	int num[4];
	while(1){
		rep(i,4) cin >> num[i];
		if(num[0]==0) break;
		sort(num,num+4);
		string ans="";
		do{
			rep(a,5)rep(b,3)rep(c,3)rep(d,3){
				string base=base_exp[a];
				rep(i,base.size()){
					if(islower(base[i]))
						base[i]=num[base[i]-'a']+'0';
				}
				rep(i,base.size()) if(base[i]==','){ base[i]=op[b];break;}
				rep(i,base.size()) if(base[i]==','){ base[i]=op[c];break;}
				rep(i,base.size()) if(base[i]==','){ base[i]=op[d];break;}
				if(eval(base)==10)
					ans=base;
			}
		}while(next_permutation(num,num+4));
		if(ans=="")
			cout << 0 << endl;
		else
			cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main() {
IOS;
int  a,b,t;
cin>>a>>b>>t;
cout<<(t/a)*b<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
using namespace std;

int main() {
	int a[3]; cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	if (a[0] == a[1]) cout << a[2] << endl;
	else cout << a[0] << endl;
	return 0;
}

Measured memory_bytes: 256
import math
import copy
from collections import Counter
from _ast import Or
 
 
 
def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:
 
            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l
 
n=int(input())
a=nCast(inputArr(5))


                   
   

def func():
    mm=min(a)
    k=0
    if n%mm!=0:
        k=1
    k+=int(n/mm)+4
    return k
print(func())


Measured memory_bytes: 3828
<?php
	$n = trim(fgets(STDIN));
	list($w, $h, $x, $y, $r) = explode(" ", $n);

	if (($x - $r) >= 0 && ($y - $r) >= 0 && 
		($x + $r) <= $w && ($y + $r) <= $h)
		$str = "Yes";
	else
		$str = "No";

	printf("%s\n", $str);

Measured memory_bytes: 6568
N , M = map(int ,input().split())
mod = 10 ** 9 + 7
A = []
crash = 0
idx = 0
for i in range(M):
    A.append(int(input()))
    if i == 0:
        crash = A[0]
    if A[i] - 1 == A[i - 1] and i > 0:
        print("0")
        exit()
dp = [0] * (N + 1)
dp[0] = 1

for i in range(1 , N + 1):
    if i == crash:
        idx += 1
        if idx < M:
            crash = A[idx]
    else:
        if i == 1:
            dp[1] = 1
        else:
            dp[i] = dp[i - 1] + dp[i - 2]
            dp[i] %= mod
print(dp[-1])


Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

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

int main() {
	long long int n, m;
	cin >> n >> m;

	vector< vector<P> > xx(n);
	vector<long long int> ax(n, 0);
	vector<long long int> kou(n, 0);
	long long int l, r, d;
	for (long long int i = 0; i < m; i++) {
		cin >> l >> r >> d;
		l--;
		r--;
		xx[l].push_back(P(r, d));
		xx[r].push_back(P(l, -d));
	}
	bool hh = true;
	for (long long int i = 0; i < n; i++) {
		queue<long long int> q;
		if (kou[i] == 0) {
			q.push(i);
			kou[i] = 1;
		}
		while (!q.empty()) {
			long long int qq = q.front();
			q.pop();
			for (long long int j = 0; j < xx[qq].size(); j++) {
				P p = xx[qq][j];
				if (kou[p.first] == 1) {
					if (ax[p.first] != ax[qq] + p.second) {
						hh = false;
					}
				}
				else {
					ax[p.first] = ax[qq] + p.second;
					kou[p.first] = 1;
					q.push(p.first);
				}
			}
		}
	}
	if (hh) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 14848
#include <iostream>

using namespace std;

int main()
{
    int n;
    string s = "APPROVED";
    cin >> n;
    int p[n];
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    for (int i = 0; i < n; i++)
    {
        if (p[i] % 2 == 0)
        {
            if (p[i] % 3 != 0 && p[i] % 5 != 0)
            {
                s = "DENIED";
                break;
            }
        }
    }
    cout << s << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
int main(){
  string s; cin >> s;
  if(s.at(0)==s.at(1)&&s.at(2)==s.at(3)&&s.at(1)!=s.at(2)) cout << "Yes" << endl;
  else if(s.at(0)==s.at(2)&&s.at(1)==s.at(3)&&s.at(1)!=s.at(2)) cout << "Yes" << endl;
  else if(s.at(0)==s.at(3)&&s.at(1)==s.at(2)&&s.at(1)!=s.at(3)) cout << "Yes" << endl;
  else cout << "No" << endl;
}



Measured memory_bytes: 256