akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b=mod-2,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

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



int n;

signed main() {
    cin >> n;
    cout << max(0, (n+1)/2 - 1) << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
#define debug(x) cerr<<#x<<": "<<x<<endl

string s;
int K;

string mul(string str, int n){
    string res;
    rep(i,n){
        res += str;
        if((int)res.size() > K) break;
    }
    return res.substr(0,K+1);
}

// T := c..c | Nc | N(T) | TT
string read(int &i){
    if((int)s.size() == i || s[i] == ')'){
        return "";
    }

    string str;

    // c..c
    if(isalpha(s[i])){
        while(isalpha(s[i])){
            str += s[i];
            i++;
        }
    }else{
        int num = 0;
        assert(isdigit(s[i]));
        while(isdigit(s[i])){
            num = num*10+(s[i]-'0');
            i++;
        }

        // Nc
        if(isalpha(s[i])){
            str = string(num,s[i]);
            i++;
        }
        // N(T)
        else{
            assert(s[i] == '(');
            i++;
            str = mul(read(i),num);
            assert(s[i] == ')');
            i++;        
        }
    }
    // TT
    return mul(str+read(i),1);
}

int main(void){
    while(cin>>s>>K, !(s=="0" && K==0)){
        int i = 0;
        string res = read(i);
        if((int)res.size() <= K){
            cout<<0<<endl;
        }else{
            cout<<char(res[K])<<endl;
        }
    }
    return 0;
}



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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}
int main() {
	int a = ri(), b = ri(), c = ri();
	int x = ri(), y = ri();
	int mi = min(x,y);
	s64 res = 0;
	res += mi * min(a+b, 2*c);
	x -= mi, y -= mi;
	if (x) res += x * min(a,2*c);
	else res += y * min(b,2*c);
	cout << res << endl;
    return 0;
}


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

int main() {
  int x[3], y[3];
  cin>>x[0]>>y[0];
  cin>>x[1]>>y[1];
  cin>>x[2]>>y[2];

  double s = 0.5 * abs((x[1] - x[0]) * (y[2] - y[0]) - (x[2] - x[0]) * (y[1] - y[0]));
  double a = sqrt(pow(x[1] - x[0], 2) + pow(y[1] - y[0], 2));
  double b = sqrt(pow(x[2] - x[1], 2) + pow(y[2] - y[1], 2));
  double c = sqrt(pow(x[0] - x[2], 2) + pow(y[0] - y[2], 2));

  printf("%.9lf\n", s / ((a + b + c) / 2 + 2 * s / max(a, max(b, c))));
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;

unsigned egcd(unsigned a, unsigned b) {
  if(a < b) return egcd(b, a);
  unsigned r;
  while ((r=a%b)) {a=b; b=r;}
  return b;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n,0); for (auto &aa:a) cin >> aa;

    vector<int> b(n-1),c(n-1);
    b[0] = a[0];
    for (int i=1;i<n-1;i++) {b[i] = egcd(b[i-1],a[i]);}
    c[n-2] = a[n-1];
    for (int j=n-3;j>=0;j--) {c[j] = egcd(c[j+1],a[j+1]);        }

    int maxi=0,pre;
    for (int i=0;i<n;i++) {
        if (i==0) pre = c[i];
        else if (i==n-1) pre = b[i-1];
        else pre = egcd(b[i-1],c[i]);
        maxi = max(maxi,pre);
    }
    cout << maxi << endl;
    return 0;
}

Measured memory_bytes: 1408
a,b=input().split()
if a!='10000':
  a=str(int(a)-1)
def f(x):
  c=int(x[0])
  d=int(x[1])
  m=(c-1)*100+d*10
  e=int(x[2])
  g=int(x[3])*10+int(x[4])
  if g<d*10+c:
    m+=e
  else:
    m=m+e+1
  return m
print(f(b)-f(a))
  

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iomanip>


#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;


// <<fixed<<setprecision(6)<<


int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}


int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}


int main(){
  string s;
  cin>>s;
  bool is=false;
  if(s[0]=='7'||s[1]=='7'||s[2]=='7'){
    is=true;
  }
  if(is){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}

Measured memory_bytes: 3128
import java.io.*;
public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sbu=new StringBuilder();
        
        while(true){
            String[] num=buf.readLine().split(" ");
            int h=Integer.parseInt(num[0]);
            int w=Integer.parseInt(num[1]);
            
            if(h==0 && w==0)break;
            
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    if((i+j)%2==0)
                        sbu.append("#");
                    else
                        sbu.append(".");
                }
                sbu.append("\n");
            }
            sbu.append("\n");
        }
        System.out.print(sbu);
    }
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC() ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);


int main()
{
    int i = 0, j = 0, cs = 0, in;
    ll a ; cin>>a;
    cout << a + a*a + a*a*a << endl;
    return 0;
}


Measured memory_bytes: 3588
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

inline int Ri(){
	register int r=0,c=getchar();
	while(c<'0' || '9'<c) c=getchar();
	while('0'<=c && c<='9') r=(r<<1)+(r<<3)+c-'0',c=getchar();
	return r;
}

const int N=1e5+10;

struct GRAPH{
	int head[N],nxt[N<<1],to[N<<1],du[N],ncnt;
	void AddEdge(int u,int v){
		int p=++ncnt,q=++ncnt;
		du[u]++,du[v]++;
		nxt[p]=head[u],to[p]=v,head[u]=p;
		nxt[q]=head[v],to[q]=u,head[v]=q;
	}
	int operator [](const int &u){return head[u];}
}Gr;

int n;
int val[N];
bool fail;

int DFS(int u,int fa){
	if(Gr.du[u]==1) return val[u];
	long long tot=0;
	int mx=0;
	for(int it=Gr[u];it;it=Gr.nxt[it]){
		int v=Gr.to[it];
		if(v==fa) continue;
		int res=DFS(v,u);
		mx=max(mx,res),tot+=res;
	}
	long long mat=tot-val[u];
	long long mxmat;
	if(tot-mx>=mx) mxmat=tot/2;
	else mxmat=tot-mx;
	if(mat<0 || mxmat<mat || val[u]-mat<0 || (fa==0 && val[u]-mat>0)){
		printf("NO\n");
		exit(0);
	}
	return val[u]-mat;
}
int main(){
	n=Ri();
	for(int i=1;i<=n;i++) val[i]=Ri();
	for(int i=1;i<n;i++) Gr.AddEdge(Ri(),Ri());
	if(n==2){
		printf("%s\n",val[1]==val[2]?"YES":"NO");
		return 0;
	}
	int rt=0;
	for(int i=1;i<=n && !rt;i++)
		if(Gr.du[i]>=2)
			rt=i;
	DFS(rt,0);
	printf("YES\n");
	return 0;
}

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

const ll mod = 1e9 + 7;

long long gcd(ll x, ll y){
	if(x > y) swap(x, y);
	while(x != 0){ y %= x; swap(x, y); }
	return y;
}

ll mpow(ll x, ll r){
	if(r == 0) return 1;
	if(r % 2 == 1){ return x * mpow(x, r-1) % mod; }
	else{ ll aa = mpow(x, r/2); return aa*aa%mod; }
}

long double pi = 3.14159265358979;

int main(){
	long double r; cin >> r;
	cout  << setprecision(10)<< 2*r*pi << endl;
	return 0;
}

Measured memory_bytes: 3788
lst = []
H, W = map(int, input().split())
for _ in range(H):
    l = list(input())
    lst.append(l)
gy = H - 1
gx = W - 1

def bfs(sy, sx, gy, gx):
    queue = deque()
    visited = [[-1 for _ in range(W)] for _ in range(H)]
    visited[sy][sx] = 0
    queue.append([sy,sx])
    while queue:
        now = queue.popleft()
        if now == [gy, gx]:
            return visited[gy][gx]
        for _ in range(4):
            ny = now[0] + y[_]
            nx = now[1]+ x[_]
            if 0 < nx < W and 0 < ny < H: 
                if lst[ny][nx] != "X" and visited[ny][nx] == -1:
                    visited[ny][nx] = visited[now[0]][now[1]] +1
                    queue.append([ny, nx])
                    print(now, [gy, gx], visited[ny][nx])
    return -1

from collections import deque
x = [1, -1, 0, 0]
y = [0, 0, 1, -1]

def bfs(sy, sx, gy, gx):
    queue = deque()
    visited = [[-1 for _ in range(W)] for _ in range(H)]
    visited[sy][sx] = 0
    queue.append([sy,sx])
    while queue:
        now = queue.popleft()
        if now == [gy, gx]:
            return visited[gy][gx]
        for _ in range(4):
            ny = now[0] + y[_]
            nx = now[1]+ x[_]
            if 0 <= nx < W and 0 <= ny < H:
                if lst[ny][nx] != "#" and visited[ny][nx] == -1:
                    visited[ny][nx] = visited[now[0]][now[1]] +1
                    queue.append([ny, nx])
    return -1

step = bfs(0,0, gy, gx)
if step == -1:
    print(step)
else:
    ans = H * W -  sum([_.count('#') for _ in lst]) - (step + 1)
    print(ans)

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

int main() {
    int N;
    cin >> N;
    int a, b, c, d;
    a = N / 1000;
    b = (N % 1000) / 100;
    c = (N % 100) / 10;
    d = (N % 10);
    if (( a == b && b == c) || (b == c && c == d)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}



Measured memory_bytes: 256
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]


def rle(s):
    import itertools
    return list(map(lambda x: (x[0], len(list(x[1]))), itertools.groupby(s)))


n = ri()
ls = ril()
ls = rle(ls)
res = 0
for _, x in ls:
    res += x // 2
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;cin>>n;
    vector<int> a(n, 0);
    rep(i, n-1){
        int x;cin>>x;
        a[x-1]++;
    }
    rep(i,n){
        cout<<a[i]<<endl;
    }


}

Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

set<char> st;
int main(){
    int n;
    cin>>n;
    char c;
    rep(i,n){
        cin>>c;
        st.insert(c);
    }
    if(st.size()==3) cout<<"Three"<<endl;
    else cout<<"Four"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> as(n); cin >> as;
    sort(as.begin(), as.end());
    int nn = as.back(), ans;
    int maxi = -1;
    for(auto& a : as){
        if(maxi < min(a, nn - a)){
            maxi = min(a, nn - a);
            ans = a;
        }
    }
    cout << nn << ' ' << ans << '\n';
}


Measured memory_bytes: 640
var input = require('fs').readFileSync('/dev/stdin', 'utf8').split("\n");
input.shift();
input = input.map((s)=>{
  return s.split("").sort().join("");
});
var countmap = {};

for(var i = 0; i < input.length; i++) {
	var s = input[i];
	if (countmap[s] === undefined) countmap[s] = [0,0];
	else {
		countmap[s][0] += 1;
		countmap[s][1] += countmap[s][0];
	}
}
console.log(Object.keys(countmap).reduce((i,e)=>{return i+countmap[e][1];},0));


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

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

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

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

int main() {
  int H, W;
  string S[51];
  cin >> H >> W;
  rep(i, H) cin >> S[i];

  rep(i, H) rep(j, W) {
    if (S[i][j] == '#') continue;
    int cnt = 0;
    rep(k, 8) {
      int nx = i + dx[k], ny = j + dy[k];
      if (0 <= nx && nx < H && 0 <= ny && ny < W) {
        if (S[nx][ny] == '#') cnt++;
      }
    }
    S[i][j] = '0' + cnt;
  }

  rep(i, H) cout << S[i] << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i))
using namespace std;
template <class T>
void setmax(T &a, T const &b) {
    if (a < b) a = b;
}

template <class T>
void setmin(T &a, T const &b) {
    if (a > b) a = b;
}

template <typename T, typename X>
auto vectors(T a, X x) { return vector<T>(x, a); }

template <typename T, typename X, typename Y, typename... Zs>
auto vectors(T a, X x, Y y, Zs... zs) {
    auto cont = vectors(a, y, zs...);
    return vector<decltype(cont)>(x, cont);
}

int main() {
    int x;
    cin >> x;
    cout << !x << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,c[55],v[55],b[55],sum=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
	}
	for(int i=0;i<n;i++)
	{
		cin>>c[i];
	}
	for(int i=0;i<n;i++)
	{
		b[i]=v[i]-c[i];
	}
	for(int i=0;i<n;i++)
	{
		if(b[i]>0)
		{
			sum+=b[i];
		}
	}
	cout<<sum;
	return 0;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define pb push_back

using namespace std;
using ll=long long;
using pii= pair<int, int>;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... T> void rd(T&... args) {((cin>>args), ...);}
template<typename... T> void wr(T... args) {((cout<<args<<" "), ...);cout<<endl;}

template <int MOD>
struct ModInt {
    int val;
    // constructor
    ModInt(ll v = 0) : val(int(v % MOD)) {
        if (val < 0) val += MOD;
    };
    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }
    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(ll n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }
    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = int(ll(val) * x.val % MOD);
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }
    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};
using mint = ModInt<int(1e9+7)>;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H,W,n;
    cin>>H>>W>>n;
    vector<pii> a(n);
    for(auto& [x,y]:a) cin>>x>>y;
    a.emplace_back(H,W);
    sort(all(a));
    const int N=2e5;
    array<mint,N+1> fac;
    fac[0]=1;
    for(int i=1;i<=N;i++){
        fac[i]=(fac[i-1])*i;
    }
    auto cal=[&](pii i,pii j){
        int x=j.F-i.F,y=j.S-i.S;
        return fac[x+y]/fac[x]/fac[y];
    };
    vector<mint> ans(n+1);
    for(int i=0;i<sz(a);i++){
        ans[i]+=cal({1,1},a[i]);
        for(int j=i+1;j<sz(a);j++){
            if(a[j].S<a[i].S) continue;
            ans[j]-=ans[i]*cal(a[i],a[j]);
        }
    }
    cout<<ans.back();
    return 0;
}



Measured memory_bytes: 4436
a, b, c, d = map(int, input().split())

TyokudaiWin = True

for i in range(100):
    c -= b
    if c <= 0:
        break
    a -= d
    if a <= 0:
        TyokudaiWin = False
        break

if TyokudaiWin:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9092
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

//みなさん天才的ですよね

ll num[858200];
const int ma = (1 << 19) - 1;
bool query(ll n) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) return 1;
		n2 = n2 * 2 % 858101;
	}
	return 0;
}
void add(ll n) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) {
			return;
		}
		n2 = n2 * 2 % 858101;
	}
	num[n2] = n + 1;
}

int KH[300001], KW[300001];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int H, W, M;
	cin >> H >> W >> M;

	rep(i, M) {
		int h, w;
		cin >> h >> w;

		KH[h]++;
		KW[w]++;
		add(ll(h) * W + w);
	}

	int saidaih = -1;
	int hh[300001], h = 0;
	rep1(i, H) {
		if (saidaih < KH[i]) {
			saidaih = KH[i];
			h = 1;
			hh[0] = i;
		}
		else if (saidaih == KH[i]) {
			hh[h++] = i;
		}
	}
	int saidaiw = -1;
	int ww[300001], w = 0;
	rep1(i, W) {
		if (saidaiw < KW[i]) {
			saidaiw = KW[i];
			w = 1;
			ww[0] = i;
		}
		else if (saidaiw == KW[i]) {
			ww[w++] = i;
		}
	}

	if (ll(h) * w > M) {
		co(saidaih + saidaiw);
		return 0;
	}
	int atta = 0;
	rep(i, h) rep(j, w) {
		if (!query(ll(hh[i]) * W + ww[j])) {
			atta = 1;
			break;
		}
	}

	if (atta) co(saidaih + saidaiw);
	else co(saidaih + saidaiw - 1);

	Would you please return 0;
}

Measured memory_bytes: 14952
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define vvvel vector<vvel>
void mmin(int &a, int b) { a = min(a, b); }
void mmax(int &a, int b) { a = max(a, b); }
void sor(vel &v) { sort(v.begin(), v.end()); }
int zero() { return 0; }
signed main() {
	int n, m; cin >> n >> m;
	if (n >= m) {
		cout << 0 << endl;
		return 0;
	}
	int di = m - n;
	vel x(m);
	for (int i = 0; i < m; i++) {
		cin >> x[i];
	}
	sor(x);
	vel d(m - 1);
	for (int i = 0; i < m - 1; i++) d[i] = x[i + 1] - x[i];
	sor(d);
	int ans = 0;
	for (int i = 0; i < di; i++) {
		ans += d[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main() {
    double D, T, S;
    cin >> D >> T >> S;
    auto arrive = D / S;
//    cout << arrive << " " << T << endl;
    if (T >= arrive)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


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

int main(){
  int n;
  cin >> n;
  int b,f,r,v;//building,floor,room,number of people
  int cb,cf,cr,cv;
  cin.ignore();
  b=4;
  f=3;
  r=10;
  int univ[4][3][10] = {{{0},{0},{0}}};
  for(int i = 0;i < n;i++){
    cin >> cb >> cf >> cr >> cv;
    univ[cb-1][cf-1][cr-1] += cv;
  }
  for(int i =0;i < b;i++){
    for(int j=0;j<f;j++){
      for(int k=0;k<r;k++){
        cout << " " << univ[i][j][k];
      }
      cout << endl;
    }
    if(i!=b-1){
      cout << "####################" << endl;
    }
  }
  return 0;
}
    



Measured memory_bytes: 3072
#pragma comment(linker, "/stack:200000000")
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) return cout<<a,0;
#define y1 sfasfd 
#define int long long
#define go adssdadsasda
using namespace std;
 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;
const int N = 4e5 + 123;
int n ;
int sf[N];
string s;


main(){
	cin >> s;
	n = sz(s);
	s = '#' + s;	
	s = s + "##";
	int ans = 0;
	for(int i = n ; i > 0 ; i--){
	   if(s[i] == 'B' && s[i + 1]  == 'C')
	      sf[i] = sf[i + 2] + 1;
	   if(s[i] == 'C')
	   	 sf[i] = 0;
	   if(s[i] == 'A')
	   	sf[i] = sf[i + 1], ans += sf[i];
	}
	cout << ans ;
}


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

using ll = long long;

constexpr ll INF = 1e18;

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    for(int i = 0; i <= N; ++i) {
        for(int j = 0; j <= M; ++j) {
            if(i * M + j * N - 2 * (i * j) == K) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long p = sc.nextLong();

        double rr = p;
        long nn = n;
        while(nn > 1) {
        	rr = Math.sqrt((double)rr);
        	nn /= 2;
        }
        long res = (long)rr;

        while(res > 1) {
        	if(p % Math.pow(res, n) == 0) {
        		break;
        	}
        	res--;
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 22100
// TEMPLATE {{{
#include <bits/stdc++.h>
using namespace std;
#ifndef LOCAL
#define OJ 1
#else
#define OJ 0
#endif
 
#define endl '\n'
#define TIMESTAMP merr << "Execution time: " << (double)clock()/CLOCKS_PER_SEC << " s.\n"
class C_ {}; template <typename T> C_& operator <<(C_& __m, const T& __s) { if (!OJ) cerr << "\E[91m" << __s << "\E[0m"; return __m; }
C_ merr;
 
struct __s { __s() { if (OJ) { ios_base::Init i; cin.sync_with_stdio(0); cin.tie(0); } } ~__s(){ TIMESTAMP; } } __S;
/// END OF TEMPLATE }}}

#define size_t unsigned long long

vector<size_t> G[111111];
bool u[111111];

void brute(size_t m) {
    vector<size_t> A(1<<(m+1));
    for (size_t i = 0; i < 1ULL<<(m+1); i++) {
        A[i] = i/2;
    }
    vector<size_t> I(1<<(m+1));
    iota(I.begin(), I.end(), 0);
    do {
        map<size_t,size_t> mp;
        vector<size_t> B;
        for (auto i : I) {
            B.push_back(A[i]);
        }
        set<size_t> S;
        for (size_t i = 0; i < B.size(); i++) {
            size_t x = B[i];
            if (mp.find(x) == mp.end()) {
                mp[x] = i;
                continue;
            }
            size_t prev = mp[x];
            size_t xx = 0;
            for (size_t j = prev; j <= i; j++) {
                xx ^= B[j];
            }
            S.insert(xx);
            if (S.size() > 1) break;
        }
        if (S.size() == 1 && *S.begin() > 0) {
            cout << *S.begin() << endl;
            for (auto x : B) {
                cout << x << ' ';
            }
            cout << endl;
        }

    } while (next_permutation(I.begin(), I.end()));
}

int main(void) {
    size_t m,k;
    cin >> m >> k;
    if (k >= (1ULL<<m) || (m == 1 && k == 1)) {
        cout << "-1" << endl;
        return 0;
    }
    if (k == 0) {
        for (size_t i = 0; i < (1ULL<<(m+1)); i++) {
            cout << i/2 << " ";
        }
        cout << endl;
        return 0;
    }
    size_t idx = 0;
    auto getNext = [&idx, k]() {
        if (idx == k) {
            idx++;
        }
        return idx++;
    };
    size_t f = getNext();
    cout << f << " " << k << " " << f << " ";
    vector<size_t> V;
    for (size_t i = 0; i < (1ULL<<m)-2; i++) {
        size_t x = getNext();
        V.push_back(x);
        cout << x << " ";
    }
    cout << k << " ";
    for (int i = (int)V.size()-1; i >= 0; i--) {
        cout << V[i] << " ";
    }
    cout << endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> f(n);
  for(int i=0;i<n;i++){
    cin >> f[i];
  }
  
  int i=0;
  for (;;i++){
    decltype(f)::iterator i = max_element(f.begin(),f.end());
    int maxn = *i;
    if (maxn==0) break;
    int index = distance(f.begin(),i);
    for (int j=index;j>=0;j--){
      if (f[j]==0)break;
      f[j]-=1;
    }
    for (int j=index+1;j<f.size();j++){
      if (f[j]==0)break;
      f[j]-=1;
    }
  }
  cout << i << endl; 
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
long long a[1000005];
int main()
{
    int n,x=1,ans=0;///x表示一个数出现的次数，赋值1 
    scanf("%d",&n);
    for(int i=0;i<n;i++)
      scanf("%d",&a[i]);
    sort(a,a+n);///先排序，更方便判断奇偶 
    for(int i=1;i<n;i++)
    {
        if(a[i]==a[i-1])///出现相同的数，x+1然后mod2 
          x=(x+1)%2;
        else
        {
            ans+=x;///单独的一个数，ans+1，x重新赋值为1，进行循环 
            x=1;
        }      
    }
    if(x%2)///再次判断 ，若不为0，则ans+1 
      ans++;
    printf("%d\n",ans);
    return 0;
} 

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define XX first
#define YY second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define REP rep
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
const ll MOD=1e9+7;

#define rall(X) (X).rbegin(),(X).rend()
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}

string S;
LL dp[1145141][2];

signed main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  cin >> S;
  int N = S.size();
  fill(dp[0], dp[N+1], 1LL << 54);
  dp[N][0] = 0;
  rrep(j, N) {
    int x = S[j]-'0';
    reps(i, x, 10) {
      LL cand = dp[j+1][0]+i+i-x;
      MN(dp[j][0], cand);
    }
    rep(i, x) {
      LL cand = dp[j+1][0]+i+10+i-x;
      MN(dp[j][1], cand);
    }
    ++x;
    reps(i, x, 10) {
      LL cand = dp[j+1][1]+i+i-x;
      MN(dp[j][0], cand);
    }
    rep(i, x) {
      LL cand = dp[j+1][1]+i+10+i-x;
      MN(dp[j][1], cand);
    }
    //cout << "dp[" << j << "][0]: " << dp[j][0] << endl;
    //cout << "dp[" << j << "][1]: " << dp[j][1] << endl;
  }
  cout << min(dp[0][0], dp[0][1]+1) << endl;
}


Measured memory_bytes: 17820
#include<bits/stdc++.h>
#define ll long long
#define pb emplace_back
#define mr make_pair
#define N 2010
using namespace std;
int m,n,x,y,d[N],f[N],c[N],nc,g[N],ne,p[N],q[N],ans;
bool vi[N];
vector<int> a[N],s[N];
struct Info{int x,y;bool ex;}e[N*2];
void jb(int x,int y){a[x].pb(y);}
void dfs(int x,int fa,int dep){
	f[x]=fa;d[x]=dep;
	for (auto y:a[x])if (y!=fa)dfs(y,x,dep+1);
	c[++nc]=x;vi[x]=1;
}
void get(int x,int y){
	while (x!=y){
		if(d[x]<d[y])swap(x,y);
		g[x]++;x=f[x];
	}
}
void g1(int x,int y){while (x!=y){if(d[x]<d[y])swap(x,y);vi[x]=0;x=f[x];}}
int lca(int x,int y){while (x!=y){if(d[x]<d[y])swap(x,y);x=f[x];}return x;}
int main(){
	cin>>n>>m;ne=m;
	for (int i=1;i<n;i++){cin>>x>>y;jb(x,y);jb(y,x);}
	dfs(1,0,1);
	for (int i=1;i<=m;i++){cin>>e[i].x>>e[i].y;get(e[i].x,e[i].y);e[i].ex=1;}
	for (int i=1;i<=n;i++){
		ans+=min(g[c[i]],2);
		if (vi[c[i]]){
			if (g[c[i]]>1){
				for (int j=1;j<=ne;j++){
					if (e[j].ex&&e[j].x!=e[j].y&&(e[j].x==c[i]||e[j].y==c[i])){
						if (p[i]){q[i]=j;break;}else p[i]=j;
					}
				}
				int x=lca(e[p[i]].x,e[p[i]].y),y=lca(e[q[i]].x,e[q[i]].y);
				if (x==y){
					if (e[p[i]].x!=c[i])x=e[p[i]].x;else x=e[p[i]].y;
					if (e[q[i]].x!=c[i])y=e[q[i]].x;else y=e[q[i]].y;
					x=lca(x,y);				
				}else {if (d[x]<d[y]) swap(x,y);}
				g1(c[i],x);
				e[p[i]].ex=0;e[q[i]].ex=0;
				ne++;e[ne].ex=1;
				if (e[p[i]].x==c[i])e[ne].x=e[p[i]].y;else e[ne].x=e[p[i]].x;
				if (e[q[i]].x==c[i])e[ne].y=e[q[i]].y;else e[ne].y=e[q[i]].x;
			}			
		}
		for (int j=1;j<=ne;j++){
			if (e[j].ex&&e[j].x!=e[j].y&&(e[j].x==c[i]||e[j].y==c[i])){
				if (e[j].x==c[i])e[j].x=f[c[i]];else e[j].y=f[c[i]];
				s[i].pb(j);
			}
		}
	}
	for (int i=n;i>=1;i--){
//		cout<<i<<' '<<p[i]<<' '<<q[i]<<' '<<c[i]<<endl;
//		for (int j=1;j<=ne;j++)cout<<e[j].x<<' '<<e[j].y<<endl;
		if (p[i]){
			if (e[ne].x==e[p[i]].y||e[ne].y==e[p[i]].x)swap(e[p[i]].x,e[p[i]].y);
			if (e[ne].x==e[q[i]].y||e[ne].y==e[q[i]].x)swap(e[q[i]].x,e[q[i]].y);
			if (e[ne].x==e[ne].y&&e[p[i]].x==e[q[i]].x)swap(e[q[i]].x,e[q[i]].y);
			ne--;
		}
		for (auto j:s[i]){
			if (e[j].x==f[c[i]])e[j].x=c[i];else e[j].y=c[i];
		}
	}
	cout<<ans<<endl;
	for (int i=1;i<=m;i++)cout<<e[i].x<<' '<<e[i].y<<endl;
	return 0;
}

Measured memory_bytes: 6784
import heapq

def main():
    _, k, q = map(int, input().split())
    a = list(map(int, input().split()))
    idx = make_index(a)
    groups = [(0, len(a))]

    m = float('inf')
    for y in sorted(set(a)):
        xs = []
        for start, stop in groups:
            xs.extend(nsmallest(min(stop - start - k + 1, q), a, start, stop))

        if len(xs) < q:
            break

        xxs = heapq.nsmallest(q, xs)
        x = xxs[-1]
        m = min(m, x - y)

        groups = split_groups(idx[y], groups, k)

    print(m)

MEMO = dict()
def nsmallest(n, a, start, stop):
    global MEMO
    key = (n, id(a), start, stop)
    if key in MEMO:
        return MEMO[key]

    val = heapq.nsmallest(n, a[start:stop])
    MEMO[key] = val
    return val

def split_groups(pivots, groups, k):
    gs = []

    i = 0
    for start, stop in groups:
        while i < len(pivots) and pivots[i] < start:
            i += 1
        while i < len(pivots) and pivots[i] <= stop:
            if pivots[i] - start >= k:
                gs.append((start, pivots[i]))
            start = pivots[i] + 1
            i += 1

        if stop - start >= k:
            gs.append((start, stop))

    return gs


def make_index(a):
    idx = dict()

    for i, x in enumerate(a):
        if x in idx:
            idx[x].append(i)
        else:
            idx[x] = [i]

    return idx

main()


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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int L; cin >> L;

        vector<tuple<int, int, int>> ans;
        rep(i, 19) {
            ans.emplace_back(i + 1, i + 2, 0);
        }
        {
            bool flg = false;
            for(int i = 19; i >= 0; i--) {
                if(flg) ans.emplace_back(19 - i, 19 - i + 1, (1 << i));
                flg |= L & (1 << i);
            }
        }
        {
            int l = 0;
            for(int i = 19; i >= 0; i--) {
                if(L & (1 << i)) {
                    if(l > 0) ans.emplace_back(1, 19 - i + 1, l);
                    l |= 1 << i;
                }
            }
        }
        // ans.emplace_back(1, 20, L);
        cout << 20 << " " << ans.size() << endl;
        for(auto a : ans) cout << get<0>(a) << " " << get<1>(a) << " " << get<2>(a) << endl;

        return 0;
        vector<vector<pii>> E(21);
        for(auto a : ans) {
            E[get<0>(a)].push_back(make_pair(get<1>(a), get<2>(a)));
        }
        auto a = check(E);
        assert(a.size() == L);
        assert(ans.size() <= 60);
        rep(i, L) assert(a[i] == i);

        return 0;
    }
    vector<int> check(vector<vector<pii>> &E) {
        vector<pii> state;
        state.emplace_back(1, 0);
        vector<int> foo;
        while(state.size() > 0) {
            vector<pii> nxt_state;
            for(auto s : state) {
                for(auto e : E[s.first]) {
                    nxt_state.emplace_back(e.first, s.second + e.second);
                }
                if(E[s.first].size() == 0) foo.push_back(s.second);
            }
            state = nxt_state;
        }
        sort(all(foo));
        //debug(foo);
        return foo;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n,k; scanf("%d%d",&n,&k);
    vector<int> a(n);
    rep(i,0,n)scanf("%d",&a[i]);
    set<int> st;
    rep(i,0,k)st.insert(a[i]);
    int ans=1,cnt=0,nosort=0;
    rep(i,1,n){
        if(a[i-1]<a[i])cnt++; else cnt=0;
        if(cnt==k-1)nosort++;
    }
    rep(i,k,n){
        st.erase(a[i-k]);
        if(*st.begin()<a[i-k]||*st.rbegin()>a[i])ans++;
        st.insert(a[i]);
    }
    printf("%d\n",ans-max(nosort-1,0));
    return 0;
}

Measured memory_bytes: 10368
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cmath>
#include<cstdint>
//#include<>
using namespace std;

typedef int64_t i64;typedef int32_t i32;
typedef int16_t i16;typedef int8_t i8;
typedef uint64_t ui64;typedef uint32_t ui32;
typedef uint16_t ui16;typedef uint8_t ui8;

typedef i32 int__;
#define rep(i,j) for(int__ i=0;i<j;i++)
#define repeat(i,j,k) for(int__ i=(j);i<(k);i++)
#define repeat_eq(i,j,k) for(int__ i=(j);i<=(k);i++)
#define all(v) begin(v),end(v)

const i32 INF=1<<30;//=10E10

int main()
{
  while(true){
    i32 n,p;cin>>n>>p;
    if(!n&&!p)return 0;
    vector<i32> hold(n,0);
    i32 cup=p;
    int now=0;
    
    while(true){
      if(cup>0){
	hold[now]+=1;
	--cup;
	if(hold[now]==p){
	  cout<<now<<endl;
	  break;
	}
      }
      else{
	cup+=hold[now];
	hold[now]=0;
      }
      if(++now>=n)now=0;
    }

  }
  
  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define INF 1000000007
using namespace std;
int n,a[200010],b[200010];
int dp[200010][5];
int k[]={0,2,1,2,0};
int main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		b[i]=a[i];
		if(a[i]==0) continue;
		else if(a[i]%2==0) a[i]=2;
		else a[i]=1;
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<5;j++){
			dp[i][j]=INF;
			for(int l=0;l<=j;l++){
				dp[i][j]=min(dp[i][j],dp[i-1][l]);
			}
			if(a[i]==0) dp[i][j]+=k[j];
			else if(k[j]==0) dp[i][j]+=b[i];
			else dp[i][j]+=abs(a[i]-k[j]);
		}
	}
	int ans=INF;
	for(int i=0;i<5;i++) ans=min(ans,dp[n][i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define INF 1000000000
using namespace std;
using ll = long long;

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

  int ans = 1, mx = 0;
  for (int i = 1; i <= n; ++i) {
    int score = 0;

    int j = i;
    while (j % 2 == 0) {
      j /= 2;
      ++score;
    }

    if (score >= mx) {
      mx = score;
      ans = i;
    }
  }
  
  cout << ans << '\n';

  return (0);
}


Measured memory_bytes: 3576
//   PIGMEISTER™   //

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

#define ll long long
#define ull unsigned long long
#define sidha(i,x,n) for(ll i=(ll)(x);i<(ll)(n);i++)
#define ulta(i,x,n) for(ll i=(ll)(x);i>=(ll)(n);i--)
#define mi map<ll,ll>
#define vi vector<ll>
#define si set<ll>
#define pi pair<ll,ll>
#define vp vector<pair<ll,ll>>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sab(a) a.begin(),a.end()
#define bas(a) a.rbegin(),a.rend()
#define modinv(x) powah(x,mod-2)
#define ncr(n,r) (((fact[n]*modinv(fact[n-r]))%mod*modinv(fact[r]))%mod)
#define factorial fact.pb(1);sidha(i,1,MAX)fact.pb((fact[i-1]*i)%mod)
#define test ll t;cin>>t;while(t--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
//#define mod (ll)1000000007
#define mod (ll)998244353
#define MAX 500005
ll powah(ll, ll);

int main()
{
    jaldi;

    string s;
    cin >> s;
    ll f = 0, l = 0, h = s.size() - 1;
    ll flag = 1;
    while (l < h) {
        if (s[l++] != s[h--]) {
            flag = 0;
            break;
        }
    }
    if (flag) f++;
    l = 0, h = (s.size() - 1)/2 - 1;
    flag = 1;
    while (l < h) {
        if (s[l++] != s[h--]) {
            flag = 0;
            break;
        }
    }
    if (flag) f++;
    l = (s.size() + 3)/2 - 1, h = s.size() - 1;
    flag = 1;
    while (l < h) {
        if (s[l++] != s[h--]) {
            flag = 0;
            break;
        }
    }
    if (flag) f++;
    if (f == 3) cout << "Yes\n";
    else cout << "No\n";
    
    return 0;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }

struct mint {
    constexpr static int mod = 998244353;
    long long x;
    mint(long long x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<vector<mint>> dp(c + 1, vector<mint>(d + 1, 0));
    dp[a][b] = 1;
    reps(i, a, c + 1) {
        reps(j, b, d + 1) {
            if (i > a) dp[i][j] += dp[i - 1][j] * j;
            if (j > b) dp[i][j] += dp[i][j - 1] * i;
            if ((i > a) && (j > b)) dp[i][j] -= dp[i - 1][j - 1] * (i - 1) * (j - 1);
        }
    }
    cout << dp[c][d].x << endl;
    return 0;
}


Measured memory_bytes: 73560
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int N;
string s,t;

int main(){
	cin>>s>>N;
	int ans=0;
	rep(i,N){
		cin>>t;
		rep(j,10){
			int f=t.find(s);
			if(f!=string::npos){ans++;break;}
			t=t.substr(t.size()-1,1)+t.substr(0,t.size()-1);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 0
N = int(input())
a_cnt = {}
for i in range(N):
    a = int(input())
    if a in a_cnt:
        a_cnt[a] += 1
    else:
        a_cnt[a] = 1

ans = 0
for a in a_cnt.values():
    if a % 2 != 0:
        ans += 1
print(ans)

Measured memory_bytes: 15076