akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len, tickets;
    cin >> len >> tickets;
    priority_queue<int> arr;
    long long ans = 0;
    for(int i = 0; i < len; i++) {
        int a;
        cin >> a;
        ans += a;
        arr.push(a);
    }
    while(tickets--) {
        int num = arr.top();
        ans -= num - (num / 2);
        arr.pop();
        arr.push(num / 2);
    }
    cout << ans;
}

Measured memory_bytes: 3832
#include<bits/stdc++.h>
using namespace std;
// http://tsutaj.hatenablog.com/entry/2017/03/29/204841

#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
template<typename T>
void chmax(T&a,const T& b){if(a<b)a=b;}
template<typename T>
T gcd(T a,T b){
  while(1){
    swap(a,b);
    if(a==0)return b;
    if(b==0)return a;
    a%=b;
  }
}
template<typename T>
T func(const T&a,const T&b){return gcd(a,b);}

template<typename T>
struct Segment_Tree{

  private:
    int n;
    vector<T> node;

  public:
    Segment_Tree(vector<T> v){
      int sz=v.size();
      n=1;
      while(n<sz)n<<=1;
      node.resize(2*n-1,0);
      rep(i,sz)node[i+n-1]=v[i];
      for(int i=n-2;i>=0;--i)
        node[i]=func(node[2*i+1],node[2*i+2]);
    }

    void update(int x,T val){
      x+=(n-1);
      node[x]=val;
      while(x){
        x=((x-1)>>1);
        node[x]=func(node[2*x+1],node[2*x+2]);
      }
    }

    T query(int a,int b,int k=0,int l=0,int r=-1){
      if(r<0)r=n;
      if(r<=a || b<=l)return 0;
      if(a<=l && r<=b)return node[k];
      T vl=query(a,b,2*k+1,l,(l+r)/2);
      T vr=query(a,b,2*k+2,(l+r)/2,r);
      return func(vl,vr);
    }

    void debg(){
      for(const auto& x:node)
        cout<<x<<" ";
      cout<<endl;
    }
};

main(){
  ll n;
  cin>>n;
  vector<ll> a(n);
  for(auto&x:a)cin>>x;
  Segment_Tree<ll> seg(a);

  ll ans=0;
  rep(i,n){
    seg.update(i,0);
    auto tmp=seg.query(0,n);
    chmax(ans,tmp);
    seg.update(i,a[i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3840
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N,M;
  cin >> N >> M;
  vector<int> bits(N,0),p(N);
  for(int i=0,k,b;i<M;i++){
    for(cin >> k;k>0;k--){
      cin >> b;
      bits[i]+=(1<<(b-1));
    }
  }
  for(int i=0;i<M;i++)cin >> p[i];
  
  int cnt=0;
  for(int b=0;b<(1<<N);b++){
    bool  flag=true;
    for(int i=0;i<M;i++){
      int x=b&bits[i],q=0;
      for(int s=0;s<N;s++){
        if(x&(1<<s))q++;
      }
      if(q%2!=p[i])flag=false;
    }
    if(flag)cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
from sys import stdin

N = int(input())
ct = 0
ans = 'No'
for _ in range(N):
    d1, d2 = map(int, stdin.readline().split())
    if d1 == d2:
        ct += 1
        if ct == 3:
            ans = 'Yes'
    else:
        ct = 0

print(ans)

Measured memory_bytes: 9168
N = int(input())
place = [[int(i) for i in input().split()] for _ in range(N)]

t, x, y = 0, 0, 0
for i in place:
  next_t, next_x, next_y = i
  rest = (next_t - t) % (abs(next_x - x) + abs(next_y - y))
  if rest % 2 != 0 or (next_t - t) < (abs(next_x - x) + abs(next_y - y)):
    print('No')
    exit()
    
  t, x, y = next_t, next_x, next_y

print('Yes')

Measured memory_bytes: 21108
# include <bits/stdc++.h>
using namespace std;
long long n,a[10][10],b[1000], c[10][10];
int main()
{
	for (int i=1; i<=3; i++)
	{
		for (int j=1; j<=3; j++)
		{
			cin>>a[i][j];
		}
	}
	cin>>n;
	for (int i=1; i<=n; i++)
	{
		cin>>b[i];
		for (int j=1; j<=3; j++)
		{
			for (int k=1; k<=3; k++)
			{
			 	if (a[j][k]==b[i]) c[j][k]=1;	
			}
		}
	}
	if (c[1][1]==1 && c[1][2]==1 && c[1][3]==1) 
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	if (c[2][1]==1 && c[2][2]==1 && c[2][3]==1) 
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	
	if (c[3][1]==1 && c[3][2]==1 && c[3][3]==1) 
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	
	
	if (c[1][1]==1 && c[2][1]==1 && c[3][1]==1) 
	{
		cout<<"Yes"<<endl;
		return 0;
	}
		if (c[1][2]==1 && c[2][2]==1 && c[3][2]==1) 
	{
		cout<<"Yes"<<endl;
		return 0;
	}
		if (c[1][3]==1 && c[2][3]==1 && c[3][3]==1) 
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	
	if (c[1][1]==1 && c[2][2]==1 && c[3][3]==1)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	
		if (c[1][3]==1 && c[2][2]==1 && c[3][1]==1)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	
	
	
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 99999999
using namespace std;
 
typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
 
Weight chinesePostman(const Graph &g) {
  Weight total = 0;
  vector<int> odds;
  REP(u, g.size()) {
    FOR(e, g[u]) total += e->weight;
    if (g[u].size() % 2) odds.push_back(u);
  }
  total /= 2;
  int n = odds.size(), N = 1 << n;
  Weight w[n][n]; // make odd vertices graph
  REP(u,n) {
    int s = odds[u]; // dijkstra's shortest path
    vector<Weight> dist(g.size(), INF); dist[s] = 0;
    vector<int>    prev(g.size(), -2);
    priority_queue<Edge> Q;
    Q.push( Edge(-1, s, 0) );
    while (!Q.empty()) {
      Edge e = Q.top(); Q.pop();
      if (prev[e.dst] != -2) continue;
      prev[e.dst] = e.src;
      FOR(f,g[e.dst]) {
        if (dist[f->dst] > e.weight+f->weight) {
          dist[f->dst] = e.weight+f->weight;
          Q.push(Edge(f->src, f->dst, e.weight+f->weight));
        }
      }
    }
    REP(v,n) w[u][v] = dist[odds[v]];
  }
  Weight best[N]; // DP for general matching
  REP(S,N) best[S] = INF;
  best[0] = 0;
 
  for (int S = 0; S < N; ++S)
    for (int i = 0; i < n; ++i) if (!(S&(1<<i)))
      for (int j = i+1; j < n; ++j) if (!(S&(1<<j)))
        best[S|(1<<i)|(1<<j)] = min(best[S|(1<<i)|(1<<j)], best[S]+w[i][j]);
  return total + best[N-1];
}
 
int main(){
    int i,V,E,s,t,e;
    //for(scanf("%d",&T);T;putchar(--T?' ':'\n')){
        scanf("%d%d",&V,&E);
        Graph g(V);
        for(;E--;)scanf("%d%d%d",&s,&t,&e),g[s].push_back(Edge(s,t,e)),g[t].push_back(Edge(t,s,e));
        printf("%d\n",chinesePostman(g));
    //}
}


Measured memory_bytes: 2824
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


ll n, m, s[110000];
int main() {
	cin >> n >> m;
	REP(i, n)cin >> s[i];
	REP(i, n - 1) {
		if (s[i] + s[i + 1] >= m) {
			cout << "Possible" << endl;
			REPO(j, i)cout << j << endl;
			FORR(j, n - 1, i + 2)cout << j << endl;
			cout << i + 1 << endl;
			return 0;
		}
	}
	cout << "Impossible" << endl;
}




Measured memory_bytes: 1664
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード
 
//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ
 
//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;
const double PI = acos(-1); //π
 
using namespace std;
 
//ソート
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 
//#include "./lib/generic/search.h"

//文字列入力した小数値を小数点なくして返す
int changeDoubleToInt(string decimal){ 
    decimal.erase(1, 1); //小数点削除
    int n_decimal = atoi(decimal.c_str()); //c_strでchar*に変換後、atoiでintに変換
    return n_decimal;
}

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    int c[n], a[n][m];
    rep(i, n){
        cin >> c[i];
        rep(j, m){
            cin >> a[i][j];
        }
    }
    int ans = 1001001001;

    rep(s, 1<<n){ //sは0-nの値まで1bitずつ数が増えていく(<<で1ビットずつビットシフトしているため)
        int cost = 0;
        vector<int> d(m);
        rep(i, n){ 
            if(s>>i&1){ // sのibit=1のとき＝i番目の本を選ぶことになる
                cost += c[i]; //costを求める
                rep(j,m) d[j] += a[i][j];
            }
        }

        bool ok = true;
        rep(j,m) if(d[j] < x) ok = false; //xを超えないものがあったらNGとする
        if(ok) ans = min(ans, cost);
    }

    if(ans==1001001001) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

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


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> as(n),bs(n);
  for(Int i=0;i<n;i++) cin>>as[i]>>bs[i];

  vector< vector<Int> > G(m+1);
  for(Int i=0;i<n;i++)
    if(as[i]<=m) G[m-as[i]].emplace_back(bs[i]);

  Int ans=0;
  priority_queue<Int> pq;
  for(Int i=m;i>=0;i--){
    for(Int x:G[i]){
    	pq.emplace(x);
	}
    if(!pq.empty()){
      ans+=pq.top();
      pq.pop();
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main(){
  
  
  int H,W,N;
  int nuri;
  cin >> H;
  cin >> W;
  cin >> N;
  
  if(H>=W){
  	nuri = H;}
  else{
  	nuri = W;}
  
  int solution;
    
  if(N % nuri > 0){
  	solution = N / nuri +1;}
  else{
  	solution = N / nuri;}
  
  cout << solution << endl;
    
    
  
    
}  

Measured memory_bytes: 256
# define _CRT_SECUREj_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<" :"<<x<<endl;
# define EPS 1e-12
template<class T> void debug(T a) { for (auto iiiiiiiiii : a)cout << iiiiiiiiii << endl; }
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };

signed main()
{
	int n;
	while (cin >> n&&n)
	{
		string a;
		cin >> a;
		vector<int> k(n, 0);
		int f = 0;
		for (int i = 0; i < 100; i++)
		{
			int j = i % n;
			switch (a[i])
			{
			case'S':
				f += k[j]+1;
				k[j] = 0;
				break;
			case'L':
				k[j] += f+1;
				f = 0;
				break;
			case'M':
				k[j]++;
				break;
			}
		}
		sort(ALL(k));
		for (int i = 0; i < n; i++)
		{
			if (i)cout << " ";
			cout << k[i];
		}
		cout << " " << f << endl;
	}
}

Measured memory_bytes: 3168
#include<cstdio>
#include<cstdlib>

int n, A[50];

//入力値のMから選んだ要素を引いていく再帰関数
int solve(int i, int m) {
	if (m == 0) {
		return 1;
	}
	if (i >= n) {
		return 0;
	}

	int res = solve(i + 1, m) || solve(i + 1, m - A[i]);//この行の次に1行目に戻る
	return res;
}

int main() {
	int q, M, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	scanf("%d", &q);
	for (i = 0; i < q; i++) {
		scanf("%d", &M);
		if (solve(0, M) == 1) {
			printf("yes\n");
		}
		else {
			printf("no\n");
		}
	}

	return 0;
}



Measured memory_bytes: 2620
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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; }

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

VVI g;
VI A;
VI ans;
vector<PII> hist;

void dfs(int cur, int p, VI& dp){
    //cout << cur << endl;
    //REP(i,8){
    //    cout << dp[i] << " ";
    //}
    //cout << endl;

    int idx = lower_bound(dp.begin(),dp.end(),A[cur]+1) - dp.begin();
    int memo = dp[idx];

    //dp[idx] = A[cur];
    //chmin(dp[idx],A[cur]);
    if(idx == 0) dp[idx] = A[cur];
    else{
        if(dp[idx-1] < A[cur]) dp[idx] = A[cur];
    }
    int idx2 = lower_bound(dp.begin(),dp.end(),INF) - dp.begin();
    ans[cur] = idx2;

    for(int nex : g[cur]){
        if(nex == p) continue;
        dfs(nex,cur,dp);
    }
    dp[idx] = memo;

}

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int N; cin >> N;
    g.resize(N);
    A.resize(N);
    ans.resize(N);
    hist.resize(N);
    REP(i,N) cin >> A[i];
    REP(i,N-1){
        int u,v; cin >> u >> v;
        u--; v--;
        g[u].eb(v);
        g[v].eb(u);
    }
    VI dp(N+10);
    REP(i,N+10){
        dp[i] = INF;
    }
    dfs(0,-1,dp);
    REP(i,N){
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 32328
#include <cstdio>
#include <cmath>

using namespace std;

int main()
{
    int a,b;

    while(scanf("%d%d",&a,&b)!=EOF){
        int gcd=a,tmp_b=b;
        int tmp;
        while(tmp_b!=0){
            tmp=gcd%tmp_b;
            gcd=tmp_b;
            tmp_b=tmp;
        }

        printf("%d %d\n",gcd,(int)((long)a*b/(long)gcd));
    }

    return 0;
}

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

using namespace std ;

int main()
{
    int n ;
    cin >> n ;
    string s ;
    cin >> s ;
    string a , b ;
    a = s.substr(0,n/2) ;
    b = s.substr((n/2),n/2) ;
    if(a + a == s && n >= 2)
        cout << "Yes" ;
    else cout << "No" ;
    return 0 ;
}


Measured memory_bytes: 256
fn main() {
    let n: usize = read();
    let mut p: Vec<f64> = vec![];
    for i in 0..n {
        p.push(read());
    }
    // [投げるコインの数][表の回数]
    let mut memo = vec![vec![0.0; n + 1]; n + 1];
    memo[0][0] = 1.0;
    for i in 1..n + 1 {
        for j in 0..i {
            // 表
            memo[i][j + 1] += p[i - 1] * memo[i - 1][j];
            // 裏
            memo[i][j] += (1.0 - p[i - 1]) * memo[i - 1][j];
        }
    }
    let mut ans = 0.0;
    // println!("{:?}", memo);
    for i in n / 2 + 1..n + 1 {
        ans += memo[n][i];
    }
    println!("{}", ans);
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: isize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 90364
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int N;
    cin>>N;
    int cou=0;
    for(int i=1;i<=N;i++){
        int a;
        cin>>a;
        if(i%2==1&&a%2==1){
            cou++;
        }
    }
    cout<<cou<<endl;
    return 0;
}


Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a<b && b<c){
        cout<<a<<" "<<b<<" "<<c<<endl;
    }else if(a<=b && c<=b){
        cout<<a<<" "<<c<<" "<<b<<endl;
    }else if (b<=a && a<=c){
        cout<<b<<" "<<a<<" "<<c<<endl;
    }else if (b<=c && c<=a){
        cout<<b<<" "<<c<<" "<<a<<endl;
    }else if(c<=a && a<=b){
        cout<<c<<" "<<a<<" "<<b<<endl;
    }else if(c<=b && b<=a){
        cout<<c<<" "<<b<<" "<<a<<endl;
    }return 0;
}



Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <map>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    string s;
    cin >> s;
    int N = s.size()-1;
    ll ans = 0;
    for(int bit = 0; bit < (1<<N); bit++) {
        vector<int> flag(N, 0);
        string t = "";
        for(int i = 0; i < N; i++) {
            if(bit & (1<<i)) {
                flag[i] = 1;
            }
        }
        for(int i = 0; i < N; i++) {
            t += s[i];
            if(flag[i] == 1) {
                t += '+';
            }
        }
        t += s[N];
        string r = "";
        for(int i = 0; i < t.size(); i++) {
            if(t[i] == '+') {
                ans += stoll(r);
                r = "";
            }
            else {
                r += t[i];
            }
        }
        ans += stoll(r);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<iomanip>
#include <algorithm>
#include <map>
#include <vector>
#include<queue>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include <map>
#include<string.h>
#include<sstream>
#include<stack>
#include<unordered_map>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <cstdio>
#include <cstdlib>
#include <complex>
#define ll long long
#define  point complex<double>
#define  pi acos(-1)
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define arr2dof vector  vector<vector<int>>dp(N,vector<int>(2, inf));
using namespace std;
const ll N = 2e5 + 5, mod = 1e9 + 7, inff = -1e12, inf = 1e9 + 7;
const double ep = 0.0000000001;
//const double pi = 3.14159265359;

double dot(point a, point b) {
	return  (conj(a)*b).real();
}
double cross(point a, point b) {
	return  (conj(a)*b).imag();
}
double angle(point a, point b)
{
	double dt = dot(a, b);
	dt /= abs(a);
	dt /= abs(b);
	return acos(dt) * 180.0 / pi;
}

bool isrightangel(int ind) {//90 degree
	vector<point>v;
	return(angle(v[ind] - v[(ind + 1) % 3], v[ind] - v[(ind + 2) % 3]) == 90);//bshof hal eldot producty3ny fe
	//dl3en 3moden 3ashn yb2a right trinagle
}

ll fact[1000006], inv[1000006];

ll fp(ll base, ll exp)
{
	if (exp == 0)
		return 1;
	ll ans = fp(base, exp / 2);
	ans = (ans * ans) % mod;
	if (exp % 2 != 0)
		ans = (ans * (base % mod)) % mod;
	return ans;
}

void calcFacAndInv(ll n)
{
	fact[0] = inv[0] = 1;
	for (ll i = 1; i <= n; i++)
	{
		fact[i] = (i * fact[i - 1]) % mod;
		inv[i] = fp(fact[i], mod - 2);
	}
}

ll ncr(ll n, ll r)
{
	return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}

ll npr(ll n, ll r)
{
	return (fact[n] * inv[n - r]) % mod;
}
		
		int GCD(int a, int b) {
			if (b == 0)
				return a;
			else
				return GCD(b, a%b);
		}
		int LCM(int a, int b) {
			return (a*b) / GCD(a, b);
		}
		

int main() {
	ios
		int n, m, arr[100005];
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		cin >> arr[i];
	}

	sort(arr, arr + n);
	ll ans = 1e13;
	for (int i = 0; i < n; ++i) {
		if (i + (m-1) >= n)
			break;
		if (arr[i + (m-1)] - arr[i] < ans)
			ans = arr[i + (m-1)] - arr[i];
	}
	cout << ans;
	return 0;


}


Measured memory_bytes: 3980
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using lint = long long;
using namespace std;

const int MOD = 1000000007;

int main() {
    int N, M;
    cin >> N >> M;
    priority_queue<int> q;
    rep(i, N) {
        int x;
        cin >> x;
        q.push(x);
    }

    lint res = 0;

    for (int i = 0; i < M; i++) {
        int t = q.top();
        q.pop();
        t /= 2;
        q.push(t);
    }

    while(!q.empty()) {
        res += q.top();
        q.pop();
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 892
import java.util.*;

public class Main {
  
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int T = sc.nextInt();
    
    int minCost = Integer.MAX_VALUE;
    for (int i = 0; i < N; i++) {
      int c = sc.nextInt();
      int t = sc.nextInt();
      if (t <= T && c < minCost) {
        minCost = c;
      }
    }
    if (minCost == Integer.MAX_VALUE) {
      System.out.println("TLE");
    } else {
      System.out.println(minCost);
    }
  }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define Mod 998244353
#define pi 3.14159265358979323846
#define endl '\n'
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

int main()
{
    ll n;
    cin>>n;
    ll sum=0,cur=26,p=0;
    string ans="";
    string A="zabcdefghijklmnopqrstuvwxy";
    while(sum<n)
    {
        sum+=cur;
        cur*=26;
        p++;
    }

    while(n)
    {
        ans=A[n%26]+ans;
        if(n%26==0) n-=26;
        else n-=n%26;
        n/=26;
    }
    cout<<ans<<endl;
    return 0;
}



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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  string s;cin>>s;
  int sum = 0;
  for(int i=0;i<s.size();i++){
    int p = s[i] - '0';
    sum += p;
  }

  int x = stoi(s);

  if (x % sum == 0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int main() {
    int N; cin >> N;
    vector<int> d(N);
    for(int i=0; i<N; i++) cin >> d[i];
    sort(d.begin(), d.end());

    int a = d[N/2 - 1], b = d[N/2];
    cout << b - a << endl;
    return 0;
}


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

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 100111, inf = 1000111222;

int a[max_n];
int b[max_n];
int n, m, k;
int x, y, c;

int main()
{
    //freopen("input.txt", "r", stdin);
    cin >> n >> m >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i =0 ; i < m; ++i) {
        cin >> b[i];
    }
    ll ans = inf;
    for (int i = 0; i < k; ++i) {
        cin >> x >> y >> c;
        --x, --y;
        ans = min<ll>(ans, a[x] + b[y] - c);
    }
    sort(a, a + n);
    sort(b, b + m);
    ans = min<ll>(ans, a[0] + b[0]);
    cout << ans << endl;

    return 0;
}




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


int partition(int A[], int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p;j <= r - 1;j++) {
		if (A[j] <= x) {
			i++;
			swap(A[i], A[j]);
		}
	}
	swap(A[i+1],A[r]);
	return i + 1;
}

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

	int A[100000];
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	int q=partition(A,0,n-1);
	for(int i=0;i<n;i++){
		if(i==q){
			cout<<'['<<A[i]<<']';
		}else{
			cout<<A[i];
		}
		if(i<n-1){
			cout<<' ';
		}else{
			cout<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3480
n = int(input())
sl = [input() for nesya in range(n)]
d = {"M":0,"A":0,"R":0,"C":0,"H":0}
for s in sl:
  if s[0] in d:
    d[s[0]] += 1
ans1 = d['M']*d['A']*(d['R']+d['C']+d['H'])
ans2 = (d['C']+d['H'])*d['R']*(d['M']+d['A'])
ans3 = (d['M']+d['A']+d['R'])*d['C']*d['H']
print(ans1+ans2+ans3)

Measured memory_bytes: 9752
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	while(cin>>N) {
		string s;
		map<string, ll> w;
		REP(i, N) {
			cin>>s;
			sort(ALL(s));
			w[s]++;
		}
		ll ans = 0;
		for(auto kv: w) ans += kv.SE*(kv.SE-1)/2;
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <iomanip>
#include <queue>
#include <deque>
#include <sstream>
#include <stdio.h>
#include <string>
#include <cmath>
#include <map>
#include <utility>
using namespace std;

#define s(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define ss(n) scanf("%s",&n)
#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795

int main() {
	int n;
	cin >> n;
	int sum = 0;
	int smallestnon10 = MOD;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		sum+= x;
		if(x%10 != 0 && smallestnon10 > x) {
			smallestnon10 = x;
		}
	}
	if(sum%10 == 0) {
		cout << max(sum-smallestnon10,0);
	} else {
		cout << sum;
	}
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <tuple>
#include <stdbool.h>
#include <bitset>
#include <string>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;
using namespace std;

int main(void) {
    int n,q;
    cin >> n;
    cin >> q;

    string s;
    cin >> s;

    // 事前計算
    vector<int> ans(s.length() - 1);
    int sum = 0;
    vector<int> ans_sum(s.length()); // 何回出たか
    for(int i = 0 ; i < ans.size() ; ++i) {
        ans_sum[i] = sum;
        if (s[i] == 'A' && s[i + 1] == 'C') {
            ans[i] = 1;
            sum++;
        } else {
            ans[i] = 0;
        }
    } 
    ans_sum[ans.size()] = sum; // 最後

    for(int i = 0 ; i < q ; ++i) {
        int l,r;
        cin >> l;
        cin >> r;

        int a = ans_sum[l - 1];
        int b = ans_sum[r - 1];
        auto count = b - a;
        cout << count << endl;
    }
    return 0;
}

Measured memory_bytes: 1856
# coding: utf-8
# Your code here!

s = input()

s01 = "01"*((len(s)+1)//2)
s10 = "10"*((len(s)+1)//2)

c1 = sum([1 if i==j else 0 for i,j in zip(s,s01)])
c2 = sum([1 if i==j else 0 for i,j in zip(s,s10)])

print(min(c1,c2))


Measured memory_bytes: 4212
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct kura
{
  int id, dist, count;
};

int main()
{
  int N;
  cin >> N;
  vector<kura> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v[i].id >> v[i].dist >> v[i].count;
  }
  vector<vector<double> > dp(1<<N, vector<double>(N, 1e10));
  vector<vector<int> > prev(1<<N, vector<int>(N, -1));
  for (int i = 0; i < N; i++) {
    dp[1<<i][i] = 0.0;
  }
  for (unsigned s = 0; s < (1u<<N); s++) {
    for (int i = 0; i < N; i++) {
      if (!(s & (1<<i))) {
        continue;
      }
      for (int j = 0; j < N; j++) {
        if (s & (1<<j)) {
          continue;
        }
        int w = 0;
        for (int k = 0; k < N; k++) {
          if (s & (1<<k)) {
            w += v[k].count * 20;
          }
        }
        const double d = abs(v[i].dist - v[j].dist);
        const double vv = 2000.0/(70.0+w);
        const double t = dp[s][i] + d/vv;
        const unsigned u = s | (1<<j);
        double& next = dp[u][j];
        if (t < next) {
          next = t;
          prev[u][j] = i;
        }
      }
    }
  }
  int idx = min_element(dp[(1<<N)-1].begin(), dp[(1<<N)-1].end()) - dp[(1<<N)-1].begin();
  vector<int> ans;
  for (unsigned s = (1u<<N)-1; idx != -1;) {
    ans.push_back(v[idx].id);
    const unsigned t = s;
    s &= ~(1<<idx);
    idx = prev[t][idx];
  }
  for (vector<int>::const_reverse_iterator it = ans.rbegin(); it != ans.rend(); ++it) {
    if (it != ans.rbegin()) {
      cout << " ";
    }
    cout << *it;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 9188
/*
                                             ::                     ::
                                             ':                     :
                                              :.                    :
                                           ;' ::                   ::  '
                                          .'  ';                   ;'  '.
                                         ::    :;                 ;:    ::
                                         ;      :;.             ,;:     ::
                                         :;      :;:           ,;"      ::
                                         ::.      ':;  ..,.;  ;:'     ,.;:
                                          "'"...   '::,::::: ;:   .;.;""'
                                              '"""....;:::::;,;.;"""
                                          .:::.....'"':::::::'",...;::::;.
                                         ;:' '""'"";.,;:::::;.'""""""  ':;
                                        ::'         ;::;:::;::..         :;
                                       ::         ,;:::::::::::;:..       ::
                                       ;'     ,;;:;::::::::::::::;";..    ':.
                                      ::     ;:"  ::::::"""'::::::  ":     ::
                                       :.    ::   ::::::;  :::::::   :     ;
                                        ;    ::   :::::::  :::::::   :    ;
                                         '   ::   ::::::....:::::'  ,:   '
                                          '  ::    :::::::::::::"   ::
                                             ::     ':::::::::"'    ::
                                             ':       """""""'      ::
                                              ::                   ;:
                                              ':;                 ;:"


                                                     P_r_A_d_Y
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define inf 1e18
const int N = 300005;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
void cs(int &x)
{
    cout << "Case #" << x << ": ";
}
bool cmp(string a, string b)
{
    return a + b < b + a;
}

int32_t main()
{
      fastIO;
    // int t; cin >> t;
    // int x = 1;
    // while (t--)
    // {
       string s;
       cin>>s;
       if(s[s.length()-1]=='s')
        s+="es";
        else
        s+='s';

    cout<<s<<endl;
        
    // }
    return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;
int dp[3010][3010];
signed main(){
    string s,t;
    cin >> s >>t;
    dp[0][0]=0;
    string ans="";
    for (int i = 1; i <= s.size(); i++)
    {
        for (int j = 1; j <= t.size(); j++)
        {
            if(s[i-1]==t[j-1]) {
                dp[i][j]=dp[i-1][j-1]+1;
               
            }
            else {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                
            }
        }
    }
    int i=s.size(),j=t.size();
    while(i>0 && j>0){
        if(dp[i][j]==dp[i-1][j])i--;
        else if(dp[i][j]==dp[i][j-1]) j--;
        else{
            ans=s[i-1]+ans;
            i--,j--;
        }
    }
    cout<<ans<<endl;
    return 0;

}

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

int main(){
    int N, D;
    cin >> N >> D;
    vector<vector<int>> Xij(N, vector<int>(D));
    
    for(int i=0; i<N; i++){
        for(int j=0; j<D; j++){
            cin >> Xij[i][j];
        }
    }

    int count =0;
    double length;
    for(int i=0; i<N-1; i++){
    for(int j=i+1; j<N; j++){
        length = 0;
        for(int k=0; k<D; k++){
            length += pow((Xij[i][k]-Xij[j][k]),2);
        }
        long long length_int = (long long)round(sqrt(length));
        if( abs(length_int*length_int - length) < 0.00000001){
            count += 1;
        }
    }
    }

    cout << count << endl;
    return 0;
} 

Measured memory_bytes: 3556
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<set>

using namespace std;
set<int>s;
int gh[1000][1000],w[2000];
int main()
{
    int i,j,k,l,n,m,a,b,c;
    cin>>n;
    set<int>::iterator it;
    for (i=1;i<=n;i++)
    {
      cin>>j;
      it=s.find(j);
      if (it!=s.end())
        s.erase(j);
      else  
      s.insert(j);
    }
    cout<<s.size()<<endl;

    return 0;
}
        
    
    


Measured memory_bytes: 4864
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    arr=[[[] for i in 1:9] for j in 0:9]
    for i in 1:n
        if i%10==0
            continue
        end
        s=string(i)
        push!(arr[s[1]-'0'][s[end]-'0'],i)
    end
    ans=0
    for i in 1:n
        if i%10==0
            continue
        end
        s=string(i)
        ans+=length(arr[s[end]-'0'][s[1]-'0'])
    end
    println(ans)
end
main()

Measured memory_bytes: 207052
n=int(input())
s=input().replace("o","1 ").replace("x","-1 ")
s=[int(i) for i in s.split()]
s.append(s[0])
a=[0 for i in range(n+2)]
b=[]
for j in [-1,1]:
 for k in [-1,1]:
   a[0]=j
   a[1]=k
   for i in range(1,n+1):
     a[i+1]=a[i]*s[i]*a[i-1]
   b.append("".join([str(ii) for ii in a]).replace("-1","W").replace("1","S"))
c=[]
for i in b:
 if i[0]==i[n] and i[1]==i[n+1]:
   c=i[:n]
   break
if len(c):
 print(c)
else:
 print(-1)

Measured memory_bytes: 11492
#include<cstdio>
using namespace std;
int main(){
    double n;
    int w;
    scanf("%lf",&n);
    for(double i=1;i<=3500;i++){
        for(double j=1;j<=3500;j++){
            w=(n*i*j)/(4*i*j-n*i-n*j);
            if((double)w==(n*i*j)/(4*i*j-n*i-n*j)&&w>0){
                printf("%.0f %.0f %d\n",i,j,w);
                return 0;
            }
        }
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
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; }

#include <iostream>
#include <vector>
using namespace std;

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

int main(){
    int n, id1, id2, o, ids;
    string str1, str2, tani1, tani2, okisa;
    bool ans;
    istringstream ss;
    map<string, int> mp;
    UnionFind<int> uf(205);
    while(cin >> n){
        if(n == 0) break;
        mp.clear();
        uf.init(205);
        ans = true;
        ids = 0;
        rep(i, n){
            cin >> str1 >> tani1 >> str2 >> okisa >> tani2;

            // id設定
            if(mp.count(tani1) == 0) {
                mp[tani1] = ids;
                id1 = ids;
                ids++;
            }
            else id1 = mp[tani1];
            if(mp.count(tani2) == 0) {
                mp[tani2] = ids;
                id2 = ids;
                ids++;
            }
            else id2 = mp[tani2];

            istringstream(okisa.substr(3)) >> o;

            if(uf.issame(id1, id2)){
                if(uf.diff(id1, id2) != o){
                    ans = false;
                    //break;
                }
            }
            else {
                uf.merge(id1, id2, o);
            }

        }
        if(ans) puts("Yes");
        else puts("No");
    }
}


Measured memory_bytes: 3028
#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>

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

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
#define repD(i, m, n) for(int i = m; i >= n; i--)

string ph[9] = {
	"',.!?",
	"abcABC",
	"defDEF",
	"ghiGHI",
	"jklJKL",
	"mnoMNO",
	"pqrsPQRS",
	"tuvTUV",
	"wxyzWXYZ"
};

int main(){
	string s;
	while(cin >> s){
		s += '0';
		int n = s.size();
		int cnt = -1;
		char pre = s[0];
		rep(i, n){
			if(s[i] == pre){
				if(pre == '0') cout << ' ';
				cnt++;
			}else{
				if(pre != '0'){
					string a = ph[pre - '1'];
					cout << a[cnt % (int)a.size()];
				}
				pre = s[i];
				cnt = 0;
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;
    
    bool ok = true;
    rep(i, n) {
        ll t, x, y;
        cin >> t >> x >> y;
        if(t < x+y) {
            ok = false;
        }
        if(t%2 != (x+y)%2) {
            ok = false;
        }
    }

    if(ok) {
        out("Yes");
    }
    else {
        out("No");
    }

    re0;
}

Measured memory_bytes: 256