akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,0,-1}, dy[4]={1,0,-1,0};
long double eps = 1e-9;
long double pi = acos(-1);

//a^n (mod m)
const ll mod = 998244353;
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//mod mでの a の逆元を求める
ll modinv(ll a) {
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod; 
    if (u < 0) u += mod;
    return u;
}


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

    ll n,t;
    cin>>n>>t;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll dp[n+1][t+1]={};
    dp[0][0] = modpow(2,n);
    ll inv = modinv(2);
    for(int i=0;i<n;i++){
        for(int j=0;j<=t;j++){
            dp[i+1][j] += dp[i][j];
            dp[i+1][j] %= mod;
            if(j+a[i] <= t){
                dp[i+1][j+a[i]] += (dp[i][j] * inv) % mod;
                dp[i+1][j+a[i]] %= mod;
            }
        }
    }
    cout << dp[n][t] << endl;

}

Measured memory_bytes: 74008
#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>;

int main() {
  ll K;
  cin >> K;
  vector<int> a(K, 0);

  ll ans = -1;
  ll num = 7 % K;
  ll i = 1;
  while (true) {
    if (num == 0) {
      ans = i;
      break;
    } else if (a[num] == 0) {
      a[num]++;
    } else if (a[num] == 1) {
      break;
    }
    i++;
    num = (10 * num + 7) % K;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7116
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val s = readLine()!!
    val k = readLong()

    val runLengthS = runLengthEncode(s)
    if (runLengthS.size == 1) {
        println(s.length * k / 2)
        return
    }

    var ansForS = 0
    for (run in runLengthS) {
        ansForS +=  run.length / 2
    }

    val runLengthSS = runLengthEncode(s + s)
    var ansForSS = 0
    for (run in runLengthSS) {
        ansForSS += run.length / 2
    }

    val diff = ansForSS - ansForS
    println(ansForS + diff * (k - 1))
}

data class RunLength<T>(val value: T, val length: Int)

/** O(s.length) */
fun runLengthEncode(s: String): List<RunLength<Char>> {
    if (s.isEmpty()) return listOf(RunLength(s.first(), 1))

    val runLengthList = mutableListOf<RunLength<Char>>()
    var currentChar = s.first()
    var length = 1
    for (c in s.substring(1)) {
        if (c == currentChar) {
            length++
        } else {
            runLengthList += RunLength(currentChar, length)
            currentChar = c
            length = 1
        }
    }
    runLengthList += RunLength(currentChar, length)

    return runLengthList
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 33588
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,a) for(ll i=ll(a-1);i>=0;--i)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<long double,long double> point;
typedef complex<long double> Point;
const ll MAX = 3000;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> sum,sa;
    rep(i,n){
        ll x,y;
        cin >> x >> y;
        sum.push_back(x+y);
        sa.push_back(x-y);
    }
    SORT(sum);
    SORT(sa);
    PRINT(max({sum[n-1]-sum[0],-sa[0]+sa[n-1],sa[n-1]-sa[0],-sum[0]+sum[n-1]}));
}


Measured memory_bytes: 6688
s=input()
t=input()
T = len(t)
num = 0
nowi = -1
nexti =-1
for i,ti in enumerate(t):
    nexti = s[nowi+1:].find(ti)
    if nexti == -1:
        num+=1
        nexti =s.find(ti)
        nowi = nexti
        if nexti ==-1:
            print(-1)
            exit()
    else:
        nowi = nexti+nowi+1
if num<= 10**100 -1:
    print(len(s)*num + nowi+1)

Measured memory_bytes: 3316
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let mut s: Vec<char> = itr.next().unwrap().chars().collect();
    let mut t: Vec<char> = itr.next().unwrap().chars().collect();
    s.sort();
    t.sort();
    t.reverse();

    let s: String = s.into_iter().collect();
    let t: String = t.into_iter().collect();
    println!("{}", if s < t { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
N, K = map(int, input().split())
As = list(map(int, input().split()))

for i in range(K):
    table = [0 for _ in range(N*2)]
    # imos法 - メモ
    for j in range(N):
        ai = As[j]
        # 電球が照らす左端をメモ
        table[max((j-ai)*2-1, 0)] += 1
        # 電球が照らす右端をメモ
        table[min((j+ai)*2+1, N*2-1)] -= 1
    
    # imos法 - シミュレート
    for j in range(N*2):
        if j > 0:
            table[j] += table[j-1]
    
    # 答えになおす
    for j in range(N):
        As[j] = table[j*2]
    
    exit_condition = True
    for j in range(N):
        if As[j] != N:
            exit_condition = False
            break
    
    if exit_condition:
        print(*As)
        exit(0)
            

print(*As)

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

//#define int long long
#define fi first
#define se second
#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 rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX
int gcd(int x, int y){
    int r;
    if(x<y){
        swap(x,y);
    }
    
    while(y>0){
        r=x%y;
        x=y;
        y=r;
    }
    return x;
}


int main(){
    long long a,b;
    cin>>a>>b;
    long long L=(a*b)/gcd(a,b);
    cout<< L<<endl;
    //ab=LG;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;

int main(void){
    int n;
    cin >> n;
    vector<ll> vec(n);
    for(int i=0;i<n;i++) cin >> vec[i];

    ll ans = 0;
    ll d = 1;

    //桁ごとにみて(0の個数*1の個数)*2^iを加算
    for(int i=0;i<60;i++){
        ll num0 = 0, num1 = 0;

        for(int j=0;j<n;j++){
            if(vec[j]%2==1) num1++;
            else num0++;

            vec[j] /= 2;
        }
        ll add = num0*num1;
        add %= mod;
        ans += d*add;
        ans %= mod;
        
        d *= 2;
        d %= mod;
    }    
    cout << ans << endl;
    return 0;
}

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

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

using namespace std;

const int L=100000;

class union_find{
	vector<int> a;
public:
	union_find(int n):a(n,-1){}
	int find(int x){
		if(a[x]<0) return x;
		return a[x]=find(a[x]);
	}
	void unite(int x,int y){
		x=find(x),y=find(y);
		if(x!=y){ a[x]+=a[y]; a[y]=x; }
	}
	int size(int x){ return -a[find(x)]; }
};

int main(){
	int n; scanf("%d",&n);
	vector<pair<int,int>> p(n);
	rep(i,n){
		scanf("%d%d",&p[i].first,&p[i].second);
		p[i].first--;
		p[i].second--;
	}

	vector<vector<int>> xtoy(L),ytox(L);
	rep(i,n){
		xtoy[p[i].first].emplace_back(p[i].second);
		ytox[p[i].second].emplace_back(p[i].first);
	}

	rep(x,L) sort(xtoy[x].begin(),xtoy[x].end());
	rep(y,L) sort(ytox[y].begin(),ytox[y].end());

	union_find U(2*L);
	vector<bool> used(L);
	rep(x,L){
		if(xtoy[x].size()<=1) continue;

		bool ok=false;
		for(int y:xtoy[x]) if(!used[y]) {
			for(int x2:ytox[y]) if(x2!=x) {
				U.unite(x2,x);
				ok=true;
			}
			used[y]=true;
		}
		if(!ok) continue;

		for(int y:xtoy[x]) U.unite(y+L,x);
	}

	fill(used.begin(),used.end(),false);
	rep(y,L){
		if(ytox[y].size()<=1) continue;

		bool ok=false;
		for(int x:ytox[y]) if(!used[x]) {
			for(int y2:xtoy[x]) if(y2!=y) {
				U.unite(y2+L,y+L);
				ok=true;
			}
			used[x]=true;
		}
		if(!ok) continue;

		for(int x:ytox[y]) U.unite(x,y+L);
	}

	int m=0;
	map<int,int> f; // representative of U -> index in [0, m)
	rep(i,2*L){
		int u=U.find(i);
		if(U.size(u)>1 && f.count(u)==0) f[u]=m++;
	}
	vector<pair<int,int>> cnt(m);
	rep(i,2*L){
		int u=U.find(i);
		if(U.size(u)<=1) continue;
		if(i<L) cnt[f[u]].first ++; // x-coordinate
		else    cnt[f[u]].second++; // y-coordinate
	}

	long long ans=0;
	rep(i,m){
		ans+=1LL*cnt[i].first*cnt[i].second;
	}
	rep(i,n){
		if(U.size(p[i].first)>1) ans--;
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 9728
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



n = int(input())
p = list(map(float, input().split()))
dp = [[0]*(n+1) for _ in range(n+1)]
dp[0][0] = 1
for i in range(1,n+1):
    for j in range(i+1):
        dp[i][j] = dp[i-1][j] * (1-p[i-1]) + dp[i-1][j-1] * p[i-1]
print(sum(dp[n][j] for j in range(n//2+1, n+1)))

Measured memory_bytes: 203680
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> G(h);
  vector<vector<int>> Dis(h, vector<int>(w));
  vector<vector<bool>> Visited(h, vector<bool>(w));
  ll wall_cnt = 0;
  rep (i, h) {
    rep (j, w) {
      char ch;
      cin >> ch;
      G[i].push_back(ch);
      if (ch == '#') wall_cnt++;
    }
  }

  queue<P> qi;
  qi.push(make_pair(0, 0));
  Visited[0][0] = true;
  vector<int> py = {0, 0, 1, -1};
  vector<int> px = {1, -1, 0, 0};
  while (!qi.empty()) {
    P current = qi.front();
    qi.pop();
    for (int i = 0; i < 4; i++) {
      int new_y = current.first + py[i];
      int new_x = current.second + px[i];
      if (0 <= new_y && 0 <= new_x && new_y < h && new_x < w) {
	if (Visited[new_y][new_x] || G[new_y][new_x] == '#') continue;
	qi.push(make_pair(new_y, new_x));
	Dis[new_y][new_x] = Dis[current.first][current.second] + 1;
	Visited[new_y][new_x] = true;
      }
    }
  }

  //for (int i = 0; i < h; i++) {
  //  for (int j = 0; j < w; j++) {
  //    cout << Dis[i][j] << " ";
  //  }
  //  cout << endl;
  //}
  if (Dis[h - 1][w - 1] == 0) {
    cout << -1 << endl;
  } else {
    cout << (h * w) - wall_cnt - Dis[h - 1][w - 1] - 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3612
//    >File Name: at1.cpp
//    > Author: Webwei

#include<bits/stdc++.h>
using namespace std;

int a[200010];
int main()
{
	int n,t;
	cin>>n>>t;
	long long sum=t;
	for(int i=0;i<n;i++)   cin>>a[i];
	sort(a,a+n);
	int p=0;
	for(int i=0;i<n-1;i++){
		int p=a[i+1]-a[i];
		if(p>=t)  sum+=t;
		else sum+=p;
	}
	cout<<sum<<endl;
	return 0;
}

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

int main(){
	string s;
	cin >> s;
	while(s.size()){
		if(s.rfind("dream") == s.size()-5 && s.size() >= 5) //s.size()>=5がないと、s.rfind("dream")==string::npos && s.size()-5==-1でtrueになる
			s.erase(s.size()-5, 5);							//-1番目の要素にアクセスしようとして実行時エラーが発生する
		else if(s.rfind("dreamer") == s.size()-7 && s.size() >= 7)
			s.erase(s.size()-7, 7);
		else if(s.rfind("erase") == s.size()-5  && s.size() > 4)
			s.erase(s.size()-5, 5);
		else if(s.rfind("eraser") == s.size()-6  && s.size() > 5)
			s.erase(s.size()-6, 6);
		else
			break;
	}
	if(s.size())
		cout << "NO" << endl;
	else
		cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

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

    std::string s;
    cin >> s;
    if (s[0] == s[1]) {
        cout << 1 << " " << 2 << endl;
        return 0;
    }

    char a = s[0], b = s[1], c = s[2];
    int position = 2;
    while (position + 1 <= s.size()) {
        if (a == c) {
            cout << position - 1 << " " << position + 1 << endl;
            return 0;
        } else if (b == c) {
            cout << position << " " << position + 1 << endl;
            return 0;
        }
        position++;
        a = b;
        b = c;
        c = s[position];
    }
    cout << -1 << " " << -1 << endl;

    return 0;
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n,u,v = map(int, input().split())
adjacent_list = [[] for i in range(n+1)]
aoki = [0 for i in range(n+1)]
takahashi = [0 for i in range(n+1)]
for i in range(n-1):
    a,b = map(int ,input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)

def dfs(node, count,li):
    global node_par
    li[node] = count
    finished.add(node)
    for i in adjacent_list[node]:
        if i not in finished:
            node_par[i] = node
            dfs(i, count + 1,li)
        
node_par = [0 for i in range(n+1)]

finished = set()
dfs(u,0,takahashi)

#辿って親保存しとく
finished = set()
dfs(v,0,aoki)

#さかのぼれるとこまで行く,startがさかのぼれる最大のノーど
par = u
start = u
while takahashi[par] < aoki[par]:
    start = par
    par = node_par[start]

ans_height = [0 for i in range(n+1)]
finished = set([node_par[start]])
dfs(start,0,ans_height)
print(max(ans_height) + aoki[start] - 1)


Measured memory_bytes: 109252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef vector<int > vi ;
typedef vector<ll> vl ;
#define endl '\n'
#define all(a) a.begin(),a.end()
#define open_file freopen("input.txt","r",stdin);
#define write_file  freopen("output.txt","w",stdout);
#define mem(A,v) memset(A, v, sizeof(A));
#define d(x)             cout<<#x " = "<<(x)<<endl
#define FAST ios::sync_with_stdio(false); cin.tie(0) ; cout.tie(0) ;
#ifdef ONLINE_JUDGE
#define cerr if (false) cerr
#endif
const int mod = 1000000007;

int main()
{
    //open_file
    FAST
    int n;
    cin >> n;

    vector<int> A(n);
    for(int& a : A) cin >> a;
    sort(all(A));
    ll ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            int a = lower_bound(A.begin() + j + 1, A.end(), A[i] + A[j]) - A.begin();
            int b = upper_bound(A.begin() + j + 1, A.end(), A[j] - A[i]) - A.begin();
            ans += a - b;
        }
    }
    cout << ans << endl;

    return 0;
}


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

using namespace std;

int main(){
	long long int n, m, d;
	cin >> n >> m >> d;
	if( d == 0 ){
		cout << fixed << setprecision(20) << ( n - d )*1.0 * ( m - 1 ) / n / n << endl;
	} else{
		cout << fixed << setprecision(20) << ( n - d )*2.0 * ( m - 1 ) / n / n << endl;
	}
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//↑templete
signed main(){

	int K, Q;
	cin>>K>>Q;
	vll D;
	ll Dsum=0;
	for(int i=0;i<K;i++){
		int d;
		cin>>d;
		D.pb(d);
		Dsum+=d;
	}
	while(Q--){
		ll N, X, M;
		cin>>N>>X>>M;

		vint E;
		ll Esum=0, L=0;
		for(int i=0;i<K;i++){
			E.pb(D[i]%M);
			Esum+=E.back();
			if(E.back()==0)
				L++;
		}

		//Aがmod Mで何回転するか？
		ll sum=X%M;
		sum+=Esum*((N-1)/K);
		//cout<<sum<<endl;
		ll equal=L*((N-1)/K);
		for(int i=0;i<(N-1)%K;i++){
			sum+=E[i];
			if(E[i]==0)
				equal++;
		}
		//cout<<sum<<endl;
		
		ll rou=sum/M;
		cout<<N-1-rou-equal<<endl;


	}

	return 0;
}

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

int main() {
    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    int sum = 0;
    rep(i,n) sum ^= a[i];
    rep(i,n) {
        int x = sum^a[i];
        cout << x << endl;
    }
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, d;
    cin >> a >> b >> c >> d;
    i = 0;
    while(a > 0 && c > 0){
        if(i % 2 == 0){
            c -= b;
        }
        else{
            a -= d;
        }
        i++;
    }
    if(i % 2 == 0){
        cout << "No" << endl;
    }
    else{
        cout << "Yes";
    }

    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e7,ha=998244353;

inline int add(int x,int y){ x+=y; return x>=ha?x-ha:x;}
inline void ADD(int &x,int y){ x+=y; if(x>=ha) x-=ha;}

inline int ksm(int x,int y){
	int an=1;
	for(;y;y>>=1,x=x*(ll)x%ha) if(y&1) an=an*(ll)x%ha;
	return an;
}

int jc[N+5],ni[N+5],n,ans;

inline int C(int x,int y){ return x<y?0:jc[x]*(ll)ni[y]%ha*(ll)ni[x-y]%ha;}

inline void solve(){
	jc[0]=1; for(int i=1;i<=n;i++) jc[i]=jc[i-1]*(ll)i%ha;
	ni[n]=ksm(jc[n],ha-2);
	for(int i=n;i;i--) ni[i-1]=ni[i]*(ll)i%ha;
	
	for(int i=0,c=2;i*2<n;i++,c=add(c,c)) ADD(ans,c*(ll)C(n,i)%ha);
	
	ans=add(ha-ans,ksm(3,n));
}

int main(){
	cin>>n,solve(),cout<<ans<<endl;
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  int ans=0,m=0,b;
  for(int i=0;i<n;i++){
    cin >> b;
    if(b>=m)
      ans++;
    m=max(m,b);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3640
// amigos y no más
// dile a la jardinera que traigo flores
 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define MOD 998244353LL
#define MOD1 1000000007LL
#define LIM 262150
 
using namespace std;
 
typedef long long ll ;
 
int H,W;

int sqA[100][100];
int sqB[100][100];
bool dp[85][85][6405] = {0};




int main() {
	fastio;
	
	cin>>H>>W;
	
	for(int i=1; i<=H ; i++ ) {
		for(int j=1; j<=W ; j++ ) {
			cin>>sqA[i][j];
		}
	}
	
	for(int i=1; i<=H ; i++ ) {
		for(int j=1; j<=W ; j++ ) {
			cin>>sqB[i][j];
		}
	}
	
	dp[1][1][abs(sqA[1][1] - sqB[1][1])] = 1;
	
	for(int i=1; i<=H ; i++ ){
		for(int j=1; j<=W ; j++ ){
			for(int k=0; k<=6400;k++){
				if(dp[i][j][k]){
					
					int a = abs(k + abs(sqA[i+1][j] - sqB[i+1][j]));
					int b = abs(k - abs(sqA[i+1][j] - sqB[i+1][j]));
					int c = abs(k + abs(sqA[i][j+1] - sqB[i][j+1]));
					int d = abs(k - abs(sqA[i][j+1] - sqB[i][j+1]));
					
					if(a<=6400) dp[i+1][j][ a ] = 1;
					if(b<=6400) dp[i+1][j][ b ] = 1;
					if(c<=6400) dp[i][j+1][ c ] = 1;
					if(d<=6400) dp[i][j+1][ d ] = 1;
				}
			}
			
		}
	}
	
	for(int i=0; i<=6400;i++){
		if(dp[H][W][i]) {
			cout<<i<<"\n";
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 44800
#include<algorithm>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstdio>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){
    long long N, A, B;
    cin >> N >> A >> B;
    
    long long x = N / (A + B);
    long long ans = x * A;
    long long y = N - x * (A + B);
    ans += min(A, y);
    cout << ans;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long K) {
    while (A >= B) {
        K--;
        B *= 2;
    }
    while (B >= C) {
        K--;
        C *= 2;
    }
    if (0 <= K) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main() {
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    long long K;
    scanf("%lld", &K);
    solve(A, B, C, K);
    return 0;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

VVI edge(114514,VI(0));
int k;
ll ans=1;

void dfs(int v, int p, int d, int f){
	ans*=max(k-min(2,d)-f,0);
	ans%=MOD;
	int m=0;
	for(int i=0;i<edge[v].size();i++){
		int to=edge[v][i];
		if(to!=p)
			dfs(to,v,d+1,i-m);
		else
			m=1;
	}
}

int main() {
	int n; cin >> n >> k;
	int a, b;
	REP(i,n-1){
		cin >> a >> b;
		a--; b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	dfs(0,-1,0,0);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 14784
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		PriorityQueue<Integer> queue = new PriorityQueue<>();
		StringBuilder sb = new StringBuilder();
		while (true) {
		    String type = sc.next();
		    if (type.equals("end")) {
		        break;
		    } else if (type.equals("insert")) {
		        queue.add(-sc.nextInt());
		    } else {
		        sb.append(-queue.poll()).append("\n");
		    }
		}
		System.out.print(sb);
	}
}



Measured memory_bytes: 585916
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include <functional>

using namespace std;

int INF = 10000000;

int table[] = 
{
	0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,0,0,1,0
};



int main()
{
	string str;
	while(cin >> str && str != "#")
	{
		int sum = 0;
		int flag = table[str[0] - 'a'];
		for(int i = 0;i < str.length();i++)
		{
			if(flag != table[str[i] - 'a'])
			{
				sum++;
				flag = 1-flag;
			}
		}

		cout << sum << endl;
	}

  return 0;
}

Measured memory_bytes: 1184
def f_many_many_paths():
    class Combination(object):
        """参考: https://harigami.net/contents?id=5f169f85-5707-4137-87a5-f0068749d9bb"""
        __slots__ = ['mod', 'factorial', 'inverse']

        def __init__(self, max_val_arg: int = 10**6, mod: int = 10**9 + 7):
            fac, inv = [1], []
            fac_append, inv_append = fac.append, inv.append

            for i in range(1, max_val_arg + 1):
                fac_append(fac[-1] * i % mod)

            # inv_append(pow(fac[-1], -1, mod)) (after Python 3.8)
            inv_append(pow(fac[-1], mod - 2, mod))

            for i in range(max_val_arg, 0, -1):
                inv_append((inv[-1] * i) % mod)

            self.mod, self.factorial, self.inverse = mod, fac, inv[::-1]

        def combination(self, n, r):
            if n < 0 or r < 0 or n < r:
                return 0
            return self.factorial[n] * self.inverse[r] * self.inverse[n - r] % self.mod

    R1, C1, R2, C2 = [int(i) for i in input().split()]
    comb = Combination(R2 + C2 + 2).combination

    def g(r, c):
        return comb(r + c + 2, r + 1) - 1

    return (g(R2, C2) - g(R1 - 1, C2) - g(R2, C1 - 1) + g(R1 - 1, C1 - 1)) % (10**9 + 7)

print(f_many_many_paths())

Measured memory_bytes: 177044
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    string S;
    cin >> S;
    cout << ( S.find( "9" ) != string::npos ? "Yes" : "No" ) << endl;
    return 0;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
// const long long INF = 1LL << 60;
const int INF = 1 << 30;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int a, b, k;
    cin >> a >> b >> k;

    // 処理
    int cnt = 0;
    int ans = 0;
    for (int i = 101; i > 0 && k; i--) {
        if (a % i == 0 && b % i == 0) {
            k--;
            ans = i;
        }
    }

    // 出力
    cout << ans << endl;

    return 0;
}


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

using namespace std;

int main(){
  int N;
  long long A, B, C;
  cin >> N >> A >> B >> C;
  
  vector<string> s(N);
  for(int i = 0; i < N; i++){
    cin >> s[i];
  }
  
  bool able = true;
  vector<char> ans;
  for(int i = 0; i < N; i++){
    if(s[i] == "AB"){
      if(i + 1 < N && s[i + 1] == "AC" && B){
        ++A; --B; ans.push_back('A');
      }else if(i + 1 < N && s[i + 1] == "BC" & A){
        ++B; --A; ans.push_back('B');
      }else{
        if(A == 0){
          ++A; --B; ans.push_back('A');
        }else{
          ++B; --A; ans.push_back('B');
        }
      }
    }else if(s[i] == "AC"){
      if(i + 1 < N && s[i + 1] == "AB" && C){
        ++A; --C; ans.push_back('A');
      }else if(i + 1 < N && s[i + 1] == "BC" && A){
        ++C; --A; ans.push_back('C');
      }else{
        if(A == 0){
          ++A; --C; ans.push_back('A');
        }else{
          ++C; --A; ans.push_back('C');
        }
      }
    }else{
      if(i + 1 < N && s[i + 1] == "AB"&& C){
        ++B; --C; ans.push_back('B');
      }else if(i + 1 < N && s[i + 1] == "AC" && B){
        ++C; --B; ans.push_back('C');
      }else{
        if(B == 0){
          ++B; --C; ans.push_back('B');
        }else{
          ++C; --B; ans.push_back('C');
        }
      }
    }
    
    if(A < 0 || B < 0 || C < 0) able = false;
  }
  
  if(able){
    puts("Yes");
    for(char x : ans) cout << x << endl;
  }else puts("No");
  
  return 0;
}

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

int main() {
	string s;
	cin >> s;

	char x = 'R';

	if (s[0] == x && s[1] == x && s[2] == x)
		cout << 3 << endl;
	else if (s[0] == x && s[1] == x || s[1] == x && s[2] == x)
		cout << 2 << endl;
	else if (s[0] == x || s[1] == x || s[2] == x)
		cout << 1 << endl;
	else
		cout << 0 << endl;

}

Measured memory_bytes: 3588
#include <stdio.h>
#include <stdlib.h>
#define inf 1000000000
typedef struct{
    long x,y;
}point;
int min(long a,long b){
    if(a<b)return a;
    else return b;
}
int main(void){
    //生徒とチェックポイント
    point s[50];
    point c[50];
    int n,m,i,j;
    long t,ans,minimum;
    
    //nは生徒数,mはポイント数
    scanf("%d %d",&n,&m);
    for(i=0;i<n;i++){
        scanf("%ld %ld",&s[i].x,&s[i].y);
    }
    for(j=0;j<m;j++){
        scanf("%ld %ld",&c[j].x,&c[j].y);
    }
    for(i=0;i<n;i++){
        minimum=inf;
        for(j=0;j<m;j++){
            t=labs(s[i].x-c[j].x)+labs(s[i].y-c[j].y);
            if(minimum>t){
                ans=j;
                minimum=t;
            }
        }
        printf("%ld\n",ans+1);
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;

struct Point{
    int x;
    int y;
    int a;
};

int main(){
    int w,h,n;  cin >> w >> h >> n;
    vector<Point>point(n);
    rep(i, n){
        cin >> point[i].x >> point[i].y >> point[i].a;
    }
    //solve
    pair<int, int>left(0, 0);
    pair<int, int>right(w, h);
    rep(i, n){
        switch(point[i].a){
            case 1:
                left.first = max(point[i].x, left.first);
                break;
            case 2:
                right.first = min(point[i].x, right.first);
                break;
            case 3:
                left.second = max(point[i].y, left.second);
                break;
            case 4:
                right.second = min(point[i].y, right.second);
                break;
        }
    }
    int width = ((right.first-left.first)>0)?right.first-left.first:0;
    int height = ((right.second-left.second)>0)?right.second-left.second:0;
    int ans = width*height;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int64_t> vec(N+1);
  for(int i;i<N+1;i++){
    if(i==0){
      vec.at(i)=2;
    }
    if(i==1){
      vec.at(i)=1;
    }
    if(i>1){
      vec.at(i)=vec.at(i-1)+vec.at(i-2);
    }
  }
    cout << vec.at(N);
  }

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

int main() {
    int n, q;
    cin >>n >>q;
    vector<string> Name(n, "");
    vector<int> Time(n, 0);
    for (int i=0; i<n; i++)
        cin >>Name.at(i) >>Time.at(i);
    vector<int> que;
    for (int i=0; i<n; i++)
        que.push_back(i);
    int T=0;
    while(!que.empty()) {
        int ix=que.front();
        que.erase(que.begin(), que.begin()+1);
        if (q<Time.at(ix)) {
            Time.at(ix) -=q;
            que.push_back(ix);
            T +=q;
        } else {
            T +=Time.at(ix);
            cout <<Name.at(ix) <<' ' <<T <<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 6128
#include <bits/stdc++.h>
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
H,W = gets.split.map(&:to_i)
M = (H + W) * 80
A = H.times.map { gets.split.map(&:to_i) }
B = H.times.map { gets.split.map(&:to_i) }

dp = Array.new(H){ Array.new(W, 0)}
dp[0][0] = 1 << M

W.times do |x|
  H.times do |y|
    d = (A[y][x] - B[y][x]).abs
    dp[y][x]  = (dp[y][x] << d | dp[y][x] >> d) if x == 0 && y == 0
    dp[y][x] |= (dp[y][x - 1] << d | dp[y][x - 1] >> d)  if x > 0
    dp[y][x] |= (dp[y - 1][x] << d | dp[y - 1][x] >> d)  if y > 0
  end
end

G = dp[H - 1][W - 1]
puts M.times.find{|i| G[M - i] > 0 || G[M + i] > 0 }


Measured memory_bytes: 36220
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long X = sc.nextLong();
		
		for(int i=1; i*i<=X; i++) {
			if(X%i==0) {
				for(long A=0; A<300; A++) {
					long B = A-i;
					if(Math.abs(B)>=300)
						continue;
					long ans = A*A*A*A*A - B*B*B*B*B;
					if(ans == X) {
						System.out.println(A + " " + B);
						sc.close();
						return;
					} else if(B>0 && ans > X) {
						break;
					}
				}
			}
		}
		
		sc.close();
	}
}


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

using namespace std;

bool palin(string s){
	for(int i=0;i<s.length()/2;i++){
		if(s[i]!=s[s.length()-1-i])
			return false;
	}
	return true;
}

int main(){
	string s;
	cin>>s;
	bool toPr=true;
	toPr=palin(s.substr(0,s.length()/2));
	if(!toPr){
		cout<<"No"<<endl;
		return 0;
	}
	toPr=palin(s);
	if(!toPr){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;

int main()
{
    int a[1000];
    int N,K,sum=0;
    cin>>N>>K;
    for(int i=0;i<N;i++)cin>>a[i];
    sort(a,a+N);
    for(int i=0;i<K;i++)sum+=a[i];
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3644
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Edge{
	int to;
	int cost;
	public Edge(int to, int cost) {
		this.to = to;
		this.cost = cost;
	}
}

public class Main {
	static List<Edge>[] tree;
	static long result = 0;

	static void dfs(boolean[] seen, int v, long cost, long[] costs) {
		seen[v] = true;
		costs[v] = cost;
		for(Edge next : tree[v]) {
			if(seen[next.to]) continue;
			costs[next.to] = costs[v] + next.cost;
			dfs(seen, next.to, cost + next.cost, costs);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean[] seen = new boolean[n];
		long[] costs = new long[n];
		tree = new ArrayList[n];

		for(int i = 0; i < n; i++) {
			tree[i] = new ArrayList<>();
		}

		for(int i = 0; i < n - 1; i++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int c = sc.nextInt();
			tree[a].add(new Edge(b, c));
			tree[b].add(new Edge(a, c));
		}

		int q = sc.nextInt();
		int k = sc.nextInt() - 1;
		int[] x = new int[q];
		int[] y = new int[q];

		for(int i = 0; i < q; i++) {
			x[i] = sc.nextInt() - 1;
			y[i] = sc.nextInt() - 1;
		}

		dfs(seen, k, 0, costs);

		for(int i = 0; i < q; i++) {
			System.out.println(costs[x[i]] + costs[y[i]]);
		}
		sc.close();
	}
}


Measured memory_bytes: 181864
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
// fflush(stdout)
// cout << flush
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    int a,b,c;
    cin >> a >> b >> c;
    a += b;
    cout << (a >= c? "Yes" : "No") << '\n';
    return 0;
}   

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 998244353;
const int N = 300010;
ll fact[N], invf[N];

ll mul(ll x, ll y){
    return (x%mod)*(y%mod)%mod;
}

ll powll(ll x, ll y){
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll divll(ll x, ll y){
    return (x * powll(y,mod-2)) % mod;
}

ll nPr(ll n, ll r){
    if (n < r || r < 0) return 0;
    return mul(fact[n], invf[n-r]);
}

ll nCr(ll n, ll r){
    if (n < r || r < 0) return 0;
    return mul(mul(fact[n], invf[r]), invf[n-r]);
}

int main() {
    ll n, a, b, k;
    cin >> n >> a >> b >> k;
    fact[0] = invf[0] = 1;
    FOR(i,1,N-1){
        fact[i] = (fact[i-1] * i) % mod;
        invf[i] = divll(invf[i-1], i);
    }

    ll ans = 0;
    REP(x,k/a+1){
        if ((k - x * a) % b != 0) continue;
        ll y = (k - x * a) / b;
        ll tmp = (nCr(n, x) * nCr(n, y)) % mod;
        ans = (ans + tmp) % mod;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4992
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;
using System.Timers;

static class MainClass
{
    public static void Main(string[] args)
    {
        var n = Console.ReadLine().ToInt32();
        var ls = new HashSet<int>();
        for (int i = 0; i < n; i++)
        {
            var a = Console.ReadLine().ToInt32();
            if (ls.Contains(a))
                ls.Remove(a);
            else
                ls.Add(a);
        }
        Console.WriteLine(ls.Count);
        Console.ReadLine();
    }

    #region ライブラリ

    #region 文字列処理

    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();

    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    #endregion
    #region DeepClone
    public static T DeepClone<T>(this T src)
    {
        using (var memoryStream = new MemoryStream())
        {
            var binaryFormatter
              = new BinaryFormatter();
            binaryFormatter.Serialize(memoryStream, src);
            memoryStream.Seek(0, SeekOrigin.Begin);
            return (T)binaryFormatter.Deserialize(memoryStream);
        }
    }
    #endregion

    public static int Gcd(int a,int b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }
    public static BigInteger Gcd(BigInteger a, BigInteger b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }


    public static BigInteger Factorial(int n)
    {
        var dp = new BigInteger[n];
        dp[0] = 1;
        for (int i = 1; i < n; i++)
        {
            dp[i] = dp[i - 1] * (i + 1);
        }
        return dp[n - 1];
    }

    #endregion

}


Measured memory_bytes: 19424
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i,a) for(ll i=a-1;i>=0;i--)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)
#define printall(n,array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7

int main(){
    ll n, k;
    VE h;
    ll H;
    cin >> n >> k;
    REP(i, n){
        cin >> H;
        h.push_back(H);
    }
    sort(h.begin(), h.end());
    ll ans = mod;
    REP(i, n-k+1){
        ans = min(ans, h[i+k-1] - h[i]);
    }
    print(ans);
}

Measured memory_bytes: 1400
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int n, m, x[10000], y[10000], a[10000], b[10000];
int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++)cin >> x[i] >> y[i];
	for (int i = 1; i <= m; i++)cin >> a[i] >> b[i];
	for (int i = 1; i <= n; i++) {
		int minx = 1999999999, minid = 0;
		for (int j = 1; j <= m; j++) {
			int UI = abs(x[i] - a[j]) + abs(y[i] - b[j]);
			if (minx > UI) { minx = UI; minid = j; }
		}
		cout << minid << endl;
	}
	return 0;
}

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

#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
const int inf=1010001000;
const ll  INF=1001000100010001000;
const int mod=(int)1e9+7;

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 n,w;
    ll we[110],va[110];
    ll dp[110][100100]={0};
int main(){
    
    cin>>n>>w;
    rep(i,0,n){
        cin>>we[i]>>va[i];
    }
    rep(i,0,n){
        rep(sumw,0,w+1){
            if(sumw-we[i]>=0){
                dp[i+1][sumw]=max(dp[i+1][sumw],dp[i][sumw-we[i]]+va[i]);
                //chmax(dp[i+1][sumw],dp[i][sumw-we[i]]+va[i]);
            }
            dp[i+1][sumw]=max(dp[i+1][sumw],dp[i][sumw]);
            //chmax(dp[i+1][sumw],dp[i][sumw]);
        }
    }
    cout<<dp[n][w]<<endl;
return 0;
}

Measured memory_bytes: 79360
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;

int main(){
    int a, b, k; cin >> a >> b >> k;
    int i = a;
    for(; i < b && i <= a + k -1; i++) cout << i << endl;
    for(i = max(i, b-k+1); i <= b; i++) cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

template <typename T>
struct RollingHash {
    using ll = long long;
    ll B_1, B_2, MOD_1, MOD_2;
    vector<ll> hash_1, hash_2, pow_1, pow_2;

    RollingHash(vector<T> v, ll B_1 = 1007, ll B_2 = 1009,
                ll MOD_1 = 1000000007, ll MOD_2 = 1000000009)
        : B_1(B_1), B_2(B_2), MOD_1(MOD_1), MOD_2(MOD_2) {
        init(v);
    }

    RollingHash(string& s, ll B_1 = 1007, ll B_2 = 1009, ll MOD_1 = 1000000007,
                ll MOD_2 = 1000000009)
        : B_1(B_1), B_2(B_2), MOD_1(MOD_1), MOD_2(MOD_2) {
        vector<T> v;
        for (char c : s) v.emplace_back(c);
        init(v);
    }

    void init(vector<T> v) {
        int n = v.size();
        hash_1.assign(n + 1, 0);
        hash_2.assign(n + 1, 0);
        pow_1.assign(n + 1, 1);
        pow_2.assign(n + 1, 1);
        for (int i = 0; i < n; i++) {
            hash_1[i + 1] = (hash_1[i] * B_1 + v[i]) % MOD_1;
            hash_2[i + 1] = (hash_2[i] * B_2 + v[i]) % MOD_2;
            pow_1[i + 1] = pow_1[i] * B_1 % MOD_1;
            pow_2[i + 1] = pow_2[i] * B_2 % MOD_2;
        }
    }

    pair<int, int> get(int l, int r) {
        int res_1 =
            ((hash_1[r] - hash_1[l] * pow_1[r - l]) % MOD_1 + MOD_1) % MOD_1;
        int res_2 =
            ((hash_2[r] - hash_2[l] * pow_2[r - l]) % MOD_2 + MOD_2) % MOD_2;
        return pair<ll, ll>(res_1, res_2);
    }
};
signed main() {
    int n;
    cin >> n;
    vector<RollingHash<char>> v;
    string s[n];
    rep(i, n) {
        cin >> s[i];
        RollingHash<char> rh(s[i]);
        v.emplace_back(rh);
    }
    set<pair<int, int>> cnt[26];
    rep(i, n) {
        cnt[s[i][0] - 'a'].emplace(v[i].get(1, (int)s[i].size()));
    }
    ll ans = 0;
    rep(i, n) {
        set<int> S;
        S.emplace(s[i][0] - 'a');
        int m = s[i].size();
        for (int j = 1; j <= m; j++) {
            for(int s : S){
                if (cnt[s].count(v[i].get(j, m))) ans++;
            }
            if (j == m) continue;
            S.emplace(s[i][j] - 'a');
        }
    }
    cout << ans - n << endl;
    return 0;
}

Measured memory_bytes: 89016
//AtCoder 
#include <bits/stdc++.h>
using namespace std;
using lli=int64_t;

struct Dat{
    string n;
    int p;
    int ans;
    int no;
};
int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    int N;
    cin>>N;
    vector<Dat> tbl(N);
    int n=0;
    for(auto&& d:tbl){
        cin>>d.n>>d.p;
        d.no=n++;
    }
    sort(tbl.begin(),tbl.end(),[](auto& a,auto &b){
        if(a.n==b.n){
            return a.p>b.p;
        }
        return (a.n<b.n);
    }
    );

    int a=1;
    for(auto&& d:tbl){
        d.ans=a++;
    }
    // sort(tbl.begin(),tbl.end(),[](auto &a,auto &b){
    //     return (a.no<b.no);
    // }
    // );

    for(auto&& d:tbl){
        cout<<d.no+1<<endl;
    }

    return 0;
}

Measured memory_bytes: 256