akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;

int N, A, B, C; 
vector<int> l(10);
int dfs(int i, int cost, int a, int b, int c){
  if(i == N){
    if(a*b*c == 0) return INF;
    return cost+abs(A-a)+abs(B-b)+abs(C-c)-30;
  }

  int ret = INF;
  chmin(ret, dfs(i+1, cost,    a,      b,      c     ));
  chmin(ret, dfs(i+1, cost+10, a+l[i], b,      c     ));
  chmin(ret, dfs(i+1, cost+10, a,      b+l[i], c     ));
  chmin(ret, dfs(i+1, cost+10, a,      b,      c+l[i]));
  return ret;
}

signed main() {
  cin >> N >> A >> B >> C;

  REP(i, N) cin >> l[i];
  
  cout << dfs(0, 0, 0, 0, 0) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define cmax(a,b) (a<b?a=b:a)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
using namespace std;

const int N=1e5+50,oo=1e9;

bool del[N]; 
char col[N]; 
int cnt,n,root,ans,siz[N],len[N]; 
vector<int> g[N]; 

void delLeaf(int v,int p){
	bool son=false;
	for(int d:g[v])if(d!=p){
		delLeaf(d,v); 
		son|=!del[d];
	}
	if(!son&&col[v]=='B')++cnt,del[v]=true;
}

int res=0; 
void calc(int v,int p){
	int tmp=0,deg=(p>0)^(col[v]=='W');
	for(int d:g[v])if(d!=p&&!del[d]){
		deg^=1;
		calc(d,v); 
		cmax(tmp,len[v]+len[d]); 
		cmax(len[v],len[d]); 
	}
	cmax(res,tmp+deg);
	len[v]+=deg;
	ans+=deg;
}

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("dat.in","r",stdin);
#endif
	scanf("%d",&n); 
	rep(i,1,n-1){
		int u,v;
		scanf("%d%d",&u,&v); 
		g[u].pb(v),g[v].pb(u); 
	}
	scanf("%s",col+1); 
	rep(i,1,n)if(col[i]=='W')root=i;
	if(root==0){
		return puts("0"),0; 
	}
	delLeaf(root,0); 
	if(cnt==n-1){
		return puts("1"),0; 
	}
	ans+=(n-1-cnt)<<1;
	calc(root,0);
	ans-=res*2;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 14080
#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main(){
    int N;
    cin >> N;
    set<int> S;
    for(int i=0;i<N;i++){
        int t;
        cin >> t;
        S.insert(t);
    }
    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    rep(i,n)cout << s[i] << t[i];
    cout << endl;
}


Measured memory_bytes: 256
import math
A, B, H, M = map(int, input().split())
theta_A = 2*math.pi*((H+M/60)/12)
theta_B = 2*math.pi*M/60
A_x = A*math.cos(theta_A)
A_y = A*math.sin(theta_A)
B_x = B*math.cos(theta_B)
B_y = B*math.sin(theta_B)
dst = math.sqrt((A_x-B_x)**2+(A_y-B_y)**2)
print(dst)

Measured memory_bytes: 9516
while 1:
    try:
        v,d=map(int,input().split())
        f=[0]*(v+1)
        f[0],f[1]=1,2
        for i in range(2,v+1):
            f[i]=(f[i-1]+f[i-2])%1001
        f.sort()
        c=1
        for i in range(2,v+1):
            if f[i]-f[i-1]>=d: c+=1
        print(c)
    except:break

Measured memory_bytes: 7752
import math

A, B = list(input().split())
A = int(A)

# A *= 100
# B = float(B)
# B = math.floor(B * 100)
B = B.replace('.', '').ljust(3, '0')
B = int(B)

# AB = A * B / 100
# floored = int(math.floor(AB))
# print(floored)

AB = A * B
AB = str(AB)
AB = AB[0:-2]
AB = 0 if AB == '' else AB
print(AB)



Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=((ll)n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=((ll)a);i<((ll)n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vl a(n),b(n);
    rep(i,n)cin>>a[i]>>b[i];
    sort(all(a));
    sort(all(b));
    if(n%2==1){
        puta(b[n/2]-a[n/2]+1);
    }else{
        puta((b[n/2]+b[n/2-1]) - (a[n/2]+a[n/2-1]) +1);
    }
    return 0;
}

Measured memory_bytes: 6364
N,A,B= map(int,input().split())
S = input()

for s in S:
    if s == 'a' and A+B > 0:
        if A != 0:
            A -= 1
        else:
            B -= 1
        print('Yes')
    elif s == 'b' and B > 0:
        B -= 1
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 4016
while 1:
    H, W = list(map(int, input().split()))
    if H == W == 0:
        break
    for i in range(H):
        for j in range(W):
            if (i + j) % 2:
                print('.', end='')
            else:
                print('#', end='')
        print()
    print()

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

int find(vector<int> &par, int k){
  if(par[k] == k) return k;
  return par[k] = find(par,par[k]);
}

int main(){
  int N, Q;
  while(cin >> N >> Q, N){
    vector<int> par(N);
    for(int i = 0; i < N; ++i) par[i] = i;
    int p[N];
    p[0] = 0;
    for(int i = 1; i < N; ++i){
      cin >> p[i];
      --p[i];
      par[i] = p[i];
    }
    vector< pair<char,int> > Query;
    char c;
    int k, count[N];
    fill(count,count+N,0);
    for(int i = 0; i < Q; ++i){
      cin >> c >> k;
      --k;
      if(c == 'M'){
	par[k] = k;
	++count[k];
      }
      Query.push_back(make_pair(c,k));
    }
    reverse(Query.begin(),Query.end());
    /*
    for(int i = 0; i < N; ++i){
      cout << par[i] << " ";
    }cout << endl;
    */
    long long int ans = 0;
    for(int i = 0; i < Q; ++i){
      c = Query[i].first;
      k = Query[i].second;
      if(c == 'Q'){
	ans += (long long int)find(par,k)+1;
      }else{
	--count[k];
	if(!count[k])
	  par[k] = par[p[k]];
      }
    }
    /*
    for(int i = 0; i < N; ++i){
      cout << par[i] << " ";
    }cout << endl;
    */
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 5744
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<typeinfo>
#include<functional>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    ll n;
    cin>>n;
    vector<vector<ll>> dp(n+1,vector<ll>(n+1,E));
    vector<pll> A(n);
    for(int i=0;i<n;i++){
        dp[1][i]=0;
        ll r,c;
        cin>>r>>c;
        A[i]={r,c};
    }
    for(int i=2;i<=n;i++){
        for(int t=0;i+t<=n;t++){
            for(int h=0;h+1<i;h++){
                //cout<<i<<" "<<t<<" "<<h<<endl;
                dp[i][t]=min(dp[i][t],dp[h+1][t]+dp[i-h-1][t+h+1]+A[t].F*A[t+h].S*A[t+i-1].S);
            }
        }
    }
    cout<<dp[n][0]<<endl;
    
    
    return 0;
}



Measured memory_bytes: 3212
#define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

#define eight 8
//int rc[eight][2];
//0??? 1?¨? 2.135 3.45
bool can[eight][2] = { false }, can_45[eight * 2][2] = { false };
bool _rc[eight][eight] = { false };
bool k_rc[eight] = { false };

int k = 0;
void print(void) {
	for (int i = 0; i < eight; ++i) {
		for (int j = 0; j < eight; ++j) {
			if (_rc[i][j]) printf("Q");
			else printf(".");
		}
		printf("\n");
	}
}
void Queens(int n)
{
	if (n <= eight) {
		int x = -1, y = -1, c;
		if (n == eight) { k = eight; return; }
		if (k_rc[n] == true) Queens(n + 1);
		else if (can[n][0] == false) {
			y = n;
			for (int l = 0; l < eight; ++l) {
				if (can[l][1] == false) {
					x = l;
					if (can_45[y + x][0] == false && can_45[y - x + eight][1] == false) {
						can[y][0] = true; can[x][1] = true;
						can_45[y + x][0] = true; can_45[y - x + eight][1] = true;
						_rc[y][x] = true;

						Queens(n + 1);
						if (k != eight) {
							can[y][0] = false; can[x][1] = false;
							can_45[y + x][0] = false; can_45[y - x + eight][1] = false;
							_rc[y][x] = false;
						}
					}
				}
			}

		}
	}
}

int main(void)
{
	int r, c;
	scanf_s("%d", &k);
	for (int i = 0; i < k; ++i) {
		scanf_s("%d %d", &r, &c);
		_rc[r][c] = true;
		can[r][0] = true; can[c][1] = true;
		can_45[r + c][0] = true; can_45[r - c + eight][1] = true;
		k_rc[r] = true;
	}
	Queens(0);	
	print();
}

Measured memory_bytes: 1164
#include<iostream>
using namespace std;
int main(){
	unsigned long long a,k;
	cin>>a;
	k=a/11;
//	cout<<k;
	a-=(k*11);
//	cout<<a<<" ";
	k*=2;
	if(a<=6&&a!=0){
		k++;
	}else if(a>=7){
		k+=2;
	}
//	while(a>0){
///		cout<<a<<endl;
//		a-=5;
//		k++;
//		if(a<=0){
//			break;
//		}
//		a-=6;
//		k++;
//	}
	cout<<k;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int age;
  int fee;
  scanf("%d", &age);
  scanf("%d", &fee);
  if(age<6){
    printf("0");
  }else if(6<=age&&age<13){
    printf("%d", fee/2);
  }else{
    printf("%d", fee);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int x, y;
    cin >> x >> y;

    vector<int> a = {1, 3, 5, 7, 8, 10, 12};
    vector<int> b = {4, 6, 9, 11};

    if(x==y){
        cout << "Yes" << endl;
        return 0;
    }

    for(int i=0; i<a.size(); i++){
        if(x==a.at(i)){
            for(int j=0; j<a.size(); j++){
                if(y==a.at(j)){
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }

    for(int i=0; i<b.size(); i++){
        if(x==b.at(i)){
            for(int j=0; j<b.size(); j++){
                if(y==b.at(j)){
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }

    cout << "No" << endl;


    return 0;
}


Measured memory_bytes: 256
// Problem : C - One Quadrillion and One Dalmatians
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*
 *   ﷽
 * In the name of Allah,the Most Gracious,the Most Merciful
 */

#include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;


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

  char num[27];
  for (int t = 1; t < 27; t++) num[t] = 'a' + t - 1;  // a to y
  vector<unsigned long> base;

  while (n) {
  	if(n % 26 == 0)
  	{
  		base.push_back(26);
  		n = n/26;
  		n--;
  	}
    else
    {
    	base.push_back(n % 26);
    	n = n / 26;
    }
  }

  std::reverse(base.begin(), base.end());
  string ans;
  for (auto e : base) {
    if (e == -1)
      ans += 'z';
    else
      ans += num[e];
  }
  cout << ans;

  return 0;
}

Measured memory_bytes: 3124
from collections import deque
class UnionFind():
    n=1
    par=[0]
    rnk=[0]
    def __init__(self,size):
        self.n=size
        self.par=[i for i in range(self.n)]
        self.rnk=[0 for i in range(self.n)]
    def find(self,vertex1):
        if self.par[vertex1]==vertex1:
            return vertex1
        else:
            self.par[vertex1]=self.find(self.par[vertex1])
            return self.par[vertex1]
    def unite(self,vertex1,vertex2):
        vertex1=self.find(vertex1)
        vertex2=self.find(vertex2)
        if vertex1==vertex2:
            return
        if (self.rnk[vertex1]<self.rnk[vertex2]):
            self.par[vertex1]=vertex2
        else:
            self.par[vertex2]=vertex1
            if(self.rnk[vertex1]==self.rnk[vertex2]):
                self.rnk[vertex1]+=1
    def same(self,vetrex1,vertex2):
        return self.find(vetrex1)==self.find(vertex2)

N,M=map(int,input().split())
if M%2==1:
    print(-1)
    exit()
edges=[]
tree=[]
G=UnionFind(N)
H=[[] for i in range(N)]
T=[[] for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a-=1;b-=1
    if G.same(a,b):
        edges.append((a,b))
        H[a].append(b)
    else:
        tree.append((a,b))
        G.unite(a,b)
        T[a].append(b)
        T[b].append(a)
#print(edges)
#print(tree)
q=deque([0])
reached=[0 for i in range(N)]
search=deque([])
parents=[-1 for i in range(N)]
while(len(q)>0):
    #print(q,reached,search)
    r=q.popleft()
    reached[r]=1
    for p in T[r]:
        if reached[p]==0:
            q.append(p)
            parents[p]=r
            search.appendleft(p)
#print(parents)
for i in range(N-1):
    v=search.popleft()
    p=parents[v]
    if len(H[v])%2==0:
        H[p].append(v)
    else:
        H[v].append(p)
for i in range(N):
    for j in H[i]:
        print(i+1,j+1)


Measured memory_bytes: 42784
#include<bits/stdc++.h>
using namespace std;
int n,m;
bool b[1010][1010];
char c[1010];
struct bfs{
	int x,y,bs;
}q[1000010];
int h=0,t=0;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		scanf("%s",c+1);
		for(int j=1;j<=m;j++){
			b[i][j]=(c[j]=='#');
			if(b[i][j]==1)q[++t]={i,j,0};
		}

	}
	while(h<t){
		bfs now=q[++h];int cs=now.bs+1;
		if(now.x>1&&b[now.x-1][now.y]==0)
		q[++t]={now.x-1,now.y,cs},b[now.x-1][now.y]=1;
		if(now.x<n&&b[now.x+1][now.y]==0)
		q[++t]={now.x+1,now.y,cs},b[now.x+1][now.y]=1;
		
		if(now.y>1&&b[now.x][now.y-1]==0)
		q[++t]={now.x,now.y-1,cs},b[now.x][now.y-1]=1;
		if(now.y<m&&b[now.x][now.y+1]==0)
		q[++t]={now.x,now.y+1,cs},b[now.x][now.y+1]=1;
	}
	cout<<q[t].bs;
	return 0;
}


Measured memory_bytes: 12928
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(int, n);
	vector<LL> d(n + 1);
	inc1(i, n) {
		for(int j = 0; j <= n; j += i) { d[j]++; }
	}
	LL ans = 0;
	inc1(i, n) { ans += i * d[i]; }
	OUT(ans);
}


Measured memory_bytes: 81396
s=input()

s=s.replace("BC","D")

count=0

c=0
while c<len(s):
    if s[c]=="A" or s[c]=="D":
        d=c
        while s[d]=="A" or s[d]=="D":
            d+=1
            if d==len(s):
                break
        an=0
        for i in range(c,d):
            if s[i]=="A":
                an+=1
            else:
                count+=an
        c=d
    else:
        c+=1

print(count)

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

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef vector< ll > vl;
typedef vector< pii > vpii;

#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;



//DONT WASTE YOUR TIME......i said don't waste -_- 
//prove yourself remember....fuck ps&&as hard....show them your are better then them
//Be confident.....dont lose hope.......You can do it.....
//dimaag  khoob h tere meh ....bas concentration ki kami h
//CONCENTRATE
//A,B,C dimaag nhi ...observation h .....zyaada mat sochna unme.....bas observe karna dhyaan se aur implement kar daal jitni jaldi ho sake

//capture it

// fortunately or unfortunately tu sabse badaah chodu h ....ek number ka chutiyaa -_-

const ll N= 1e6+55,mod = 1e9+7;

int main() {
 	//freopen("task.in","r",stdin);freopen("task.out","w",stdout);
	ll i,j,k,a,b,c,x,y,z;
	sc(a);sc(b);sc(k);
	for(i=a;i<(a+k);i++){
		if(i>b)break;
		pr(i);
	}	
	for(i=(max(i,b-k+1));i<=b;i++){
		pr(i);
	}

}

Measured memory_bytes: 256
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Ans[2] = {"No", "Yes"};
string ANS[2] = {"NO", "YES"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}

int A[505][505];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a, b;
    cin >> a >> b;
    if (a + b >= 10) cout << "error";
    else cout << a + b;
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    for(int i = 0; i < n; i++)  cin >> p[i];
    sort(p.begin(), p.end());
    cout << accumulate(p.begin(), p.begin()+k, 0) << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<string>
 
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
 
int main(){
  
  int i,x=0,X=0;
  int N;
  cin >> N;
  string S;
  cin >> S;
  rep(i,N){
    if(S[i]=='I'){
      x+=1;
    }else{
      x-=1;
    }
    if(X<x){
      X=x;
    }
  }
  cout << X << endl;
    
  return 0;
} 


Measured memory_bytes: 256
S = input().split(" ")
n = int(S[0])
k = int(S[1])
arr = []
for i in range(n):
    arr.append(int(input()))


def calculate(n,k,arr):
    arr.sort()
    drr = []
    for i in range(1,n):
        drr.append(arr[i] - arr[i-1])

    j = 0
    s = 0
    sums = []
    for i in range(len(drr) - (k-1) + 1):
        while j < i + (k-1):
            s = s + drr[j]
            j = j + 1

        sums.append(s)
        s = s - drr[i]

    print(min(sums))

calculate(n,k,arr)

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

int main(){
  int N;
  cin >> N;
  
  vector<int> height(N);
  for(int i = 0; i < N; i++){
    cin >> height.at(i);
  }
  
  vector<int> dp(N);
  dp.at(0) = 0;
  dp.at(1) = abs(height.at(1) - height.at(0));
  
  for(int i = 2; i < N; i++){
    int a = abs(height.at(i) - height.at(i-1)) + dp.at(i-1);
    int b = abs(height.at(i) - height.at(i-2)) + dp.at(i-2);
    dp.at(i) = min(a,b);
  }
  
  cout << dp.at(N-1) << endl;
}

Measured memory_bytes: 1024
n,m=gets.split.map &:to_i
a=gets.split.map &:to_i
odd=a.count{|e|e.odd?}
even=n-odd

b=[1]
150.times do |i|
  b<< b[-1]*(i+1)
end
c=1
if m==0
  (odd/2).times do |i|
     c+=b[odd]/b[odd-1-i*2-1]/b[(i*2+2)]
     
  end
else
  c=0
  if odd==0
    c=0
  else
    ((odd+1)/2).times do |i|
      c+=b[odd]/b[odd-1-i*2]/b[(i*2+1)]
    end
  end
end
p g=c*2**even


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

#define Fast           ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO             freopen("in.txt", "r", stdin)
#define FC             freopen("out.txt", "w", stdout)
#define aise           cout<<"aise"<<endl
#define pb             push_back
#define pf             push_front
#define ppb            pop_back
#define ppf            pop_front
#define mp             make_pair
#define ll             long long
#define all(x)         x.begin(), x.end()
#define mset(v, a)     memset(v, a, sizeof(v))
#define pll            pair< ll, ll >
#define pd             pair< double, double >
#define ff             first
#define ss             second
#define pi             acos(-1.0)
#define mxN            2010
#define inf            1e14
#define mod            1000000007
#define tc             ll tc;scanf("%lld",&tc);while(tc--)

//NCR iterative
/*voidcomb_table(intN)
{
    for(inti=0; i<=N; ++i)
    {
        for(intj=0; j<=i; ++j)
        {
            if(j==0or j==i)
            {
                C[i][j]=1LL;
            }
            else
            {
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}*/


//NCR recursive
/*ll dp[55][55];

ll NCR(ll n,ll r)
{

    if(n==r)
        return dp[n][r]=1;
    if(r==0)
        return dp[n][r]= 1;
    if(r==1)
        return dp[n][r]=n ;
    if(dp[n][r] != -1)
        return dp[n][r];
    return dp[n][r] = NCR(n-1,r)+NCR(n-1,r-1);
}*/

//Sieve:
/*bool Flag[1000010];
vector<ll> Prime;

void sieve()
{

    ll val=sqrt(1000010);
    for(ll i=4;i<=1000005; i+=2) Flag[i]=1;
    for(ll i=3;i <= val;i+=2)
    {

        if(Flag[i]==0)
        {

            for(ll j=i*i;j<=1000005;j+=i) Flag[j]=1;
        }
    }
    Flag[1]=1;
    for(ll i=1;i<=1000000;i++)
        if(Flag[i]==0) Prime.pb(i);
}*/


//Conversion
/*string bin(ll x)
{

    string ret;
    while(x)
    {

        ll t=x%2;
        char c;
        if(t==1)
            c='1';
        else
            c='0';
        ret.pb(c);
        x/=2;
    }
    reverse(all(ret));
    return ret;
}*/

/*ll lcm(ll x, ll y)
{

    ll ret=__gcd(x,y);
    return (x*y)/ret;
}*/

/*ll dx[]= {0,0,1,-1};
ll dy[]= {1,-1,0,0};*/

int main()
{

    string s,t;
    cin >> s >> t;
    ll ans=inf;
    ll s1=s.size(), s2=t.size();
    for(ll i=0;i<s1;i++)
    {

        if(i+s2 > s1) break;
        ll mn=0;
        for(ll j=0;j<s2;j++) if(t[j]!=s[i+j]) mn++;
        ans=min(ans,mn);
    }
    cout << ans;
}


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

int main() {
  int kari;
  int gokei=0;
  string kazu;
  cin >> kazu;
  for(int i=0;i<kazu.size();i++) {
    gokei+=kazu.at(i)-'0';
  }
  if(gokei%9==0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

typedef struct data{
  ll v;
  int i,j,k;
  data()=default;
  data(ll d,int a,int b,int c):v(d),i(a),j(b),k(c){}
  bool operator<(const data& rhs)const{return v<rhs.v;}
}dt;

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

  int X=in(),Y=in(),Z=in(),K=in();
  vector<ll> A(X),B(Y),C(Z);
  for(auto& v:A) v=in<ll>();
  for(auto& v:B) v=in<ll>();
  for(auto& v:C) v=in<ll>();
  
  sort(ALL(A),greater<ll>());
  sort(ALL(B),greater<ll>());
  sort(ALL(C),greater<ll>());
  
  int num=0;
  vector<vector<vector<char>>> memo(X);
  for(auto& v:memo){
    v.resize(Y);
    for(auto& w:v) w.resize(Z,0);
  }
  priority_queue<dt> rest;
  rest.emplace(A[0]+B[0]+C[0],0,0,0);
  memo[0][0][0]=1;
  while(!rest.empty() && num<K){
    dt t=rest.top();
    rest.pop();
    
    cout << t.v << endl;
    num++;
    if(t.i<X-1 && !memo[t.i+1][t.j][t.k]){
      memo[t.i+1][t.j][t.k] = 1;
      rest.emplace(A[t.i+1]+B[t.j]+C[t.k],t.i+1,t.j,t.k);
    }
    if(t.j<Y-1 && !memo[t.i][t.j+1][t.k]){
      memo[t.i][t.j+1][t.k] = 1;
      rest.emplace(A[t.i]+B[t.j+1]+C[t.k],t.i,t.j+1,t.k);
    }
    if(t.k<Z-1 && !memo[t.i][t.j][t.k+1]){
      memo[t.i][t.j][t.k+1] = 1;
      rest.emplace(A[t.i]+B[t.j]+C[t.k+1],t.i,t.j,t.k+1);
    }
  }
  
  return 0;
}

Measured memory_bytes: 1008384
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    char c;
    cin >> c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = int(input())

print(l[n-1])

Measured memory_bytes: 3444
/* AtCoder Grand Contest 019. Problem A, by Abreto<m@abreto.net>. */
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

ll N;
ll w[5] = {0,1,2,4,8};
ll c[5];
ll dp[16];

int main(void)
{
    int i = 0, j = 0;
    for(i = 1;i <= 4;++i)
        scanf("%lld", c+i);
    dp[0] = 0;
    dp[1] = c[1];
    for(i = 1;i < 9;++i)
    {
        dp[i] = 0x7fffffffffffffff;
        for(j = 1;j < 5;++j)
            if(i - w[j] >= 0)
                dp[i] = min(dp[i], dp[i-w[j]]+c[j]);
    }
    /* do dp */
    scanf("%lld", &N);
    ll need_8 = N/2, need_4 = N&1;
    ll ans = need_8 * dp[8] + need_4 * dp[4];
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < n; i++)
typedef long long ll;
// Welcome to my source code!

struct Node {
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int key) {
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = new Node;
    z->key = key;
    z->left = NIL;
    z->right = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    z->parent = y;

    if (y == NIL) {
        root = z;
    } else {
        if (z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if (u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if (u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int m, k;
    string com;
    cin >> m;

    REP(i,m) {
        cin >> com;
        if (com == "insert") {
            cin >> k;
            insert(k);
        } else {
            inorder(root);
            cout << '\n';
            preorder(root);
            cout << endl;
        }
    }
}


Measured memory_bytes: 26712
N,M = map(int,input().split())
L=[0]*M
R=[0]*M

for i in range(M):
    L[i], R[i] = map(int, input().split())
L.sort()
R.sort()
ans=R[0]-L[M-1]+1
if ans>=0:
    print(ans)
else:
    print(0)



Measured memory_bytes: 11312
<?php
$n = int();
echo ceil($n/2);
function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}
/**
 * 座圧対象の配列を渡すと以下の値を返す
 * ・圧縮された配列
 * ・復元用のMap
 * ・圧縮用のMap
 **/
function atsu($array){
    $a = array_flip($array);
    $fuku = array_flip($a);
    sort($fuku);
    $atsu = array_flip($fuku);
    foreach($array as $i => $val)$array[$i] = $atsu[$val];
    return [$array, $fuku, $atsu];
}
//配列の最大公約数
function gcdAll($array){
    $gcd = $array[0];
    for($i = 1; $i < count($array); $i++){
        $gcd = gcd($gcd, $array[$i]);
    }
    return $gcd;
}

//最大公約数
function gcd($m, $n){
    if(!$n)return $m;
    return gcd($n, $m % $n);
}

//配列の最小公倍数
function lcmAll($array){
    $lcm = $array[0];
    for($i = 1; $i < count($array); $i++){
        $lcm = lcm($lcm, $array[$i]);
    }
    return $lcm;
}

//最小公倍数
function lcm($a, $b) {
    return $a / gcd($a, $b) * $b;
}
//ビットカウント-1の数を数える
function popcount($x){
    $con = 0;
    while ($x) {
        $x &= $x-1;
        ++$con;
    }
    return $con;
}


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

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

    set<int> s;
    for (int i = 1; i < 10; ++i) {
        for (int j = 1; j < 10; ++j) {
            s.insert(i * j);
        }
    }
    if (s.find(n) == s.end()) {
        cout << "No";
    } else {
        cout << "Yes";
    }

    return 0;
}

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    ll ans = 0;
    int next = 0, now = 0;
    bool kuriagari = false;
    for(int i = n - 1; i >= 0; i --){
        now = s[i] - '0';
        if (kuriagari){
            now ++;
        }
        if (now < 5){
            ans += now;
            kuriagari = false;
        }
        else if (now == 5){
            ans += 5;
            if (i > 0 && s[i - 1] - '0' >= 5) kuriagari = true;
            else kuriagari = false;
        }

        else if (now <= 9){
            ans += 10 - now;
            kuriagari = true;
        }
        else if (now == 10){
            kuriagari = true;
        }

        // int f = 0;
        // if(kuriagari) f = 1;
        // cout << s[i] << " " << min(now, 10 - now) << " " << f << endl;
    }
    if (kuriagari) ans += 1;
    cout << ans << endl;
}


Measured memory_bytes: 1412
#include <stdio.h>
#include <string.h>

int main(void) {
  int A, B;
  int sum, min, mul;
  scanf("%d %d", &A, &B);
  sum = A + B;
  min = A - B;
  mul = A * B;

  int max = sum;
  if (max<min) {
    max = min;
  }
  if (max<mul) {
    max = mul;
  }
  printf("%d\n", max);
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int X = sc.nextInt();
        int Y = sc.nextInt();
        Map<Integer, Integer> disCount = new HashMap<>();
        for (int i = 1;i <= n; i++) {
            for (int j = i + 1;j <= n; j++) {
                int dis1 = j - i;
                int dis2 = Math.abs(X-i) + 1 + Math.abs(j-Y);
                int dis3 = Math.abs(Y-i) + 1 + Math.abs(j-X);
                int min = Math.min(dis1, dis2);
                min = Math.min(min, dis3);
                int count = disCount.getOrDefault(min, 0 );
                disCount.put(min, ++count);
            }
        }

        // ans
        for (int i = 1; i <= n-1; i++) {
            System.out.println(disCount.getOrDefault(i, 0));
        }
    }

}


Measured memory_bytes: 49156
#include<iostream>

using namespace std;

class dice {
public:
	int f[6];
	void rollN() {
		int t=f[0];
		f[0]=f[1];
		f[1]=f[5];
		f[5]=f[4];
		f[4]=t;
	}
	void rollE() {
		int t=f[0];
		f[0]=f[3];
		f[3]=f[5];
		f[5]=f[2];
		f[2]=t;
	}
	void rollS() {
		int t=f[0];
		f[0]=f[4];
		f[4]=f[5];
		f[5]=f[1];
		f[1]=t;
	}
	void rollW() {
		int t=f[0];
		f[0]=f[2];
		f[2]=f[5];
		f[5]=f[3];
		f[3]=t;
	}
	void roll(char dir) {
		if(dir=='N') rollN();
		else if(dir=='E') rollE();
		else if(dir=='S') rollS();
		else if(dir=='W') rollW();
	}
};

char dir[] = "NEEESWWWNEEESWWWNEEESWWW";

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	dice d1, d2;
	cin>>d1.f[0]>>d1.f[1]>>d1.f[2]>>d1.f[3]>>d1.f[4]>>d1.f[5];
	cin>>d2.f[0]>>d2.f[1]>>d2.f[2]>>d2.f[3]>>d2.f[4]>>d2.f[5];

	bool isSame = true;
	for(char *p=dir; *p; p++) {
		d2.roll(*p);
		for(int i=0; i<6; i++) {
			isSame = true;
			if(d1.f[i]!=d2.f[i]) {
				isSame=false;
				break;
			}
		}
		if(isSame) break;
	}
	if(isSame) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}



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

int main () {
  int n ;
  cin >> n ; 
  string a , b , c ;
  cin >> a >> b >> c ;
  
  int answer = 0 ;
  
  for (int  i = 0 ; i < n ;i++ ){
    if ( a[i] == b[i] && b[i] == c[i] ){
    } else if ( a.at(i) != b.at(i) && b.at(i) != c.at(i) && c.at(i) != a.at(i)) {
      answer +=2 ;
    } else {
      answer +=1 ;
    }
  }
  cout << answer << endl ;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    def dfs(u=0):
        def merge(dpu, dpv):
            vn = len(dpv)
            for d in range(-1, -1 - vn, -1):
                u0, u1, u2 = dpu[d]
                v0, v1, v2 = dpv[d]
                n0 = (u0 * v0) % md
                n1 = (u0 * v1 + u1 * v0) % md
                n2 = (u2 * (v0 + v1 + v2) + v2 * (u0 + u1) + u1 * v1) % md
                dpu[d] = (n0, n1, n2)

        # 葉の場合
        if len(to[u]) == 0:
            return [(inv2, inv2, 0)]
        # すべての子をマージ
        dpu = []
        mxlen=0
        for v in to[u]:
            dpv = dfs(v)
            #深さが2段以上あったらu2をu0に
            if not dpu:
                dpu = dpv
            else:
                if len(dpu) < len(dpv): dpu, dpv = dpv, dpu
                mxlen=max(mxlen,len(dpv))
                merge(dpu, dpv)
        for d in range(-1,-1-mxlen,-1):
            u0,u1,u2=dpu[d]
            dpu[d] = (u0 + u2, u1, 0)
        dpu.append((inv2, inv2, 0))
        return dpu

    md = 10 ** 9 + 7
    # 1/2のmod
    inv2 = pow(2, md - 2, md)
    n = int(input())
    to = [[] for _ in range(n+1)]
    pp = list(map(int, input().split()))
    for i, p in enumerate(pp, 1):
        to[p].append(i)
    # print(to)
    dp0 = dfs()
    # print(dp0)
    ans = sum(u1 for _, u1, _ in dp0)
    print((ans * pow(2, n + 1, md)) % md)

main()


Measured memory_bytes: 319156
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,c;
    cin>>a>>b;
    c=a*b;
    if(c%2==0){
        cout<<"Even"<<endl;
    }
    else{
        cout<<"Odd"<<endl;
    }
    return 0;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
vi g[100010];
int c[100010];
int st[100010];
bool ok;
/*
void dfs(int v, int p)
{
	int s = 0;
	int c = 0;
	int codd = 0;
	int ceven = 0;
	bool only_path = 1;

	for (int to : g[v]) {
		if (to != p) {
			dfs(to, v);

			if (st[to] == 0) {
				++codd;
			} else if (st[to] == 1) {
				++ceven;
			} else {
				only_path = 0;
			}

			if (c) {
				s = -1;
			} else {
				if (st[to] == -1) {
					s = -1;
				} else {
					s = (st[to] ^ 1);
				}
			}

			++c;
		}
	}

	st[v] = s;

	if (codd >= 2 || (p == -1 && only_path && ceven > 0 && codd == 0)) {
		ok = 1;
	}
	//cout<<v<<" " << st[v] << endl;
}
*/

queue<int> que;
bool vis[100010];
int col[100010];
int sz[100010];

int main() {
	scanf("%d", &N);

	rep(i, N-1) {
		int a, b;
		scanf("%d%d", &a, &b);
		--a; --b;
		g[a].pb(b); g[b].pb(a);
	}

	rep(i, N) {
		sz[i] = g[i].size();
		if (g[i].size() == 1) {
			 que.push(i);
		}
	}

	memset(col, -1, sizeof(col));

	while (!que.empty()) {
		int v = que.front(); que.pop();
		vis[v] = 1;
		
		col[v] = 0;
		int cnt = 0;
		int c1 = 0;

		for (int to : g[v]) {
			--sz[to];

			if (col[to] != -1) {
				if (col[to] == 0) {
					col[v] = 1;
					++cnt;
				} else {
					++c1;
				}
			}

			if (sz[to] <= 1 && !vis[to]) {
				que.push(to);
			}
		}
		if (cnt >= 2 || c1 == (int)g[v].size()) {
			ok = 1;
		}
	}

	puts(ok ? "First" : "Second");

	return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;


lint f(lint x) {
  lint res = x >> 1 & 1;
  for (int i = 1; i < 40; ++i) {
    lint y = x % (1LL << i + 1);
    if (y <= 1LL << i) continue;
    y -= 1LL << i;
    if (y & 1) res |= 1LL << i;
  }
  return res;
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  lint a, b; cin >> a >> b;
  cout << (f(a) ^ f(b + 1)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

#define v(type) vector<type>
#define p(type1, type2) pair<type1 , type2>
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int inversion = 0, total_inversion = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < i; j++) {
            if (a[j] > a[i])
                inversion++;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[j] > a[i])
                total_inversion++;
        }
    }
    cout<< ((k * inversion % MOD) + (((k - 1) * k / 2) % MOD) * total_inversion % MOD) % MOD;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i,n) cin >> h[i];
  sort(h.begin(),h.end());
  ll ans = 0;
  k = min(n,k);
  rep(i,k){
    h.pop_back();
  }
  rep(i,h.size()) ans += h[i];
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll s,c,ans;
    cin >> s >> c;
    if(s*2 > c)ans = c/2;
    else ans = s + (c-s*2)/4;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
(defn input []
  (letfn [(for-input [] (Integer/parseInt (read-line)))]
    (repeatedly (for-input) for-input)))

(defn Christmas [P]
  (let [tmp (reverse (sort P))]
    (int
      (+
        (/ (first tmp) 2.0)
        (apply + (rest tmp))))))

(->> (input)
  Christmas
  println)

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

int dp[100006];
int find(int source,vector<int> adj[])
{
    int ans=0;
    if(dp[source]!=-1)
    return dp[source];
    for(int v:adj[source])
    {
        ans=max(ans,1+find(v,adj));
    }
    return dp[source]=ans;
}
int main()
{
    int n,m;
    int u,v;
    cin>>n>>m;
    vector<int> adj[n+1];
    while(m--)
    {
        
        cin>>u>>v;
        adj[u].push_back(v);
    }
    int res=INT_MIN;
    memset(dp,-1,sizeof(dp));
    for(int i=1;i<=n;i++)
    {
        res=max(res,find(i,adj));
    }
    
    cout<<res<<"\n";
    
    
}


Measured memory_bytes: 12044