akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

int main() {
  std::string s;
  std::cin >> s;
  int count;
  for(std::size_t i = 0; i < s.size(); ++i){
    if (s[i] == 'o') ++count;
  }
  std::cout << 700+count*100;
  return 0;
}

Measured memory_bytes: 256
N=int(input())
spe=[1,2,3,4,5,6,7,8,9,10,11,12,13]
har=[1,2,3,4,5,6,7,8,9,10,11,12,13]
clo=[1,2,3,4,5,6,7,8,9,10,11,12,13]
dia=[1,2,3,4,5,6,7,8,9,10,11,12,13]
for n in range(N):
    sur,num=input().split()
    num=int(num)
    if sur=="S":
        for i in range(len(spe)):
            if num==spe[i]:
                spe.remove(num)
                break
    elif sur=="H":
        for i in range(len(har)):
            if num==har[i]:
                har.remove(num)
                break
    elif sur=="C":
        for i in range(len(clo)):
            if num==clo[i]:
                clo.remove(num)
                break
    elif sur=="D":
        for i in range(len(dia)):
            if num==dia[i]:
                dia.remove(num)
                break
for sp in spe:
    print("S"+" "+str(sp))
for ha in har:
    print("H"+" "+str(ha))
for cl in clo:
    print("C"+" "+str(cl))
for di in dia:
    print("D"+" "+str(di))





Measured memory_bytes: 5616
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define M   1000000007 // 1e9 + 7
#define MAXN 300100
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}
int check(int x){
	int a = sqrt(x);
	if(a*a==x)return true;
	return false;
}

int32_t main(){
	int L,R;
	cin>>L>>R;
	if(R-L>=2019){
		cout<<0<<endl;
	}else{
		int mini = 2020;
		for(int i=L;i<=R;i++){
			for(int j=i+1;j<=R;j++){
				mini=min(mini,(i*j)%2019);
			}
		}
		cout<<mini<<endl;
	}
}

Measured memory_bytes: 256
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_D&lang=jp

def main():
    n = int(input())
    N = [int(input()) for _ in range(n)]
    
    # O(n)
    minv = N[0]
    maxv = -10000000000000000
    for i in range(1, len(N)):
        maxv = max(maxv, N[i] - minv)
        minv = min(minv, N[i])
    print(maxv)

main()


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

using namespace std;

long long gcd(long long n1, long long n2)
{
    if(n1<n2) gcd(n2,n1);
    else if(n2==0) return n1;
    else
    {
        return gcd(n2,n1%n2);
    }
}

int main()
{
    long long mGCD,mLCM;
    long long n1,n2;
    while(cin>>n1>>n2)
    {
        mGCD=gcd(n1,n2);
        mLCM=(n1/mGCD)*n2;
        cout<<mGCD<<" "<<mLCM<<endl;
    }

    return 0;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    int k, x;
    cin >> k >> x;

    rep(i, max(x - k + 1, -1000000), min(x + k, 1000000 + 1)) { cout << i << " "; }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void Set(int Tri[]);

int main(void)
{
	int n;
	int i;
	int Tri[3];
	
	scanf("%d", &n);
	for (i = 1; i <= n; i++){
		scanf("%d %d %d", &Tri[0], &Tri[1], &Tri[2]);
		
		Set(Tri);
		if (Tri[0] * Tri[0] + Tri[1] * Tri[1] == Tri[2] * Tri[2]){
			printf("YES\n");
		}else {
			printf("NO\n");
		}
	}
	
	return (0);
}

void Set(int Tri[])
{
	int n[3];
	int i;
	
	for (i = 0; i < 3; i++){
		n[i] = Tri[i];
	}
	
	if (n[0] < n[1] && n[0] < n[2]){
		
		if (n[1] < n[2]){
			Tri[1] = n[1];
			Tri[2] = n[2];
		}else {
			Tri[1] = n[2];
			Tri[2] = n[1];
		}
		
		Tri[0] = n[0];
	}else if (n[1] < n[0] && n[1] < n[2]){
		
		if (n[0] < n[2]){
			Tri[1] = n[0];
			Tri[2] = n[2];
		}else {
			Tri[1] = n[2];
			Tri[2] = n[0];
		}
		
		Tri[0] = n[1];
	}else {
		
		if (n[0] < n[1]){
			Tri[1] = n[0];
			Tri[2] = n[1];
		}else {
			Tri[1] = n[1];
			Tri[2] = n[0];
		}
		
		Tri[0] = n[2];
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h> 
using namespace std;
int main()
{
	int k,x;
	cin >>k>>x;
	for(int i=x-k+1;i<x+k-1;i++){
		if(i >= -1000000 && i<= 1000000)
			printf("%d ",i);
	}
	if((x+k-1) >= -1000000 && (x+k-1)<= 1000000) printf("%d",x+k-1);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <queue>
using namespace std;
typedef long long ll;

int n;
vector<int> G[200020];
    
int tree_diameter(void) {
    queue<int> former, latter;
    former.push(0);
    int u, v;
    bool take[200020];
    take[0] = false;
    for (int i = 1; i < n; i++) take[i] = true;
    
    for (int i = 0; !former.empty(); i++) {
        int t = former.front();
        for (int j = 0; j < G[t].size(); j++) {
            if (take[G[t][j]]) {
                take[G[t][j]] = false;
                former.push(G[t][j]);
            }
        }
        if (former.size() == 1) u = t;
        former.pop();
    }
    //cout << "u " << u << endl;
    int q[200020];
    latter.push(u);
    for (int i = 0; i < n; i++) {
        take[i] = true;  q[i] = 0;
    }
    q[0] = 1;
    take[u] = false;
    
    int tmp = 0, idx = 0;
    for (int i = 0; !latter.empty(); i++) {
        int t = latter.front();
        for (int j = 0; j < G[t].size(); j++) {
            if (take[G[t][j]]) {
                take[G[t][j]] = false;
                latter.push(G[t][j]);
                q[idx + 1]++;
                //cout << G[t][j] << endl;
            }
        }
        tmp++;
        //cout << idx << " " << q[idx] << " " << tmp << endl;
        if (tmp == q[idx]) {
            idx++;  tmp = 0;
        }
        if (latter.size() == 1) return idx;
        latter.pop();
    }
}

int main(void){
    cin >> n;
    
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    int d = tree_diameter(); //cout << d << endl;
    for (int i = 1; i < 100000; i++) {
        if (d == 3 * i - 1) {
            cout << "Second" << endl;
            return 0;
        }
    }
    cout << "First" << endl;
}

Measured memory_bytes: 13812
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
Scanner SC = new Scanner(System.in);
int N = SC.nextInt();
int ans = 0;
for(int i = 1; i <= N; i++) {
	if(i%2 == 0) {
		continue;
	}
	int count = 0;
	for(int j = 1; j <= i; j++) {
		if(i%j == 0) {
			count++;
		}
	}
	if(count == 8) {
		ans++;
	}
}
System.out.println(ans);

	}

}


Measured memory_bytes: 35580
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <memory>
#include <time.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);

typedef vector<vvi> vvvi;

bool satisfied(vvi &field,int y,int x){
	FOR(i,y,y+2){
		FOR(j,x,x+2){
			if(field[i][j]){
				return false;
			}
		}
	}
	return true;
}

int h(int y,int x){
	return y*3+x;
}

bool thirsty(vi pos){
	vvi wetness(4,vi(4));
	REP(i,pos.size()){
		int y=pos[i]/3;
		int x=pos[i]%3;
		FOR(j,y,y+2){
			FOR(k,x,x+2){
				wetness[j][k]++;
			}
		}
	}
	REP(i,4){
		REP(j,4){
			if(wetness[i][j]==0){
				return true;
			}
		}
	}
	return false;
}

int dp[2][9][9][9][9][9][9];
int main(){
	int N;
	while(cin>>N,N){
		REP(day,2)REP(i,9)REP(j,9)REP(k,9)REP(l,9)REP(m,9)REP(n,9)dp[day][i][j][k][l][m][n]=0;
		int d=0;
		REP(day,N){
			vvi field(4,vi(4));
			REP(i,4){
				REP(j,4){
					cin>>field[i][j];
				}
			}
			REP(i,9)REP(j,9)REP(k,9)REP(l,9)REP(m,9)REP(n,9)dp[d][i][j][k][l][m][n]=0;
			if(day==0){
				dp[d][0][0][0][0][0][h(1,1)]=satisfied(field,1,1);
			}else{
				REP(i,9){
					REP(j,9){
						REP(k,9){
							REP(l,9){
								REP(m,9){
									REP(n,9){
										if(dp[(d+1)%2][i][j][k][l][m][n]){
											int py=n/3,px=n%3;
											REP(o,9){
												int cy=o/3,cx=o%3;
												if(cy==py||cx==px){
													if(day>=6){
														vi pos;
														pos.push_back(i);
														pos.push_back(j);
														pos.push_back(k);
														pos.push_back(l);
														pos.push_back(m);
														pos.push_back(n);
														pos.push_back(o);
														if(thirsty(pos))continue;
													}
													dp[d][j][k][l][m][n][o]|=satisfied(field,cy,cx);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			d=(d+1)%2;
		}
		bool ok=false;
		REP(i,9){
			REP(j,9){
				REP(k,9){
					REP(l,9){
						REP(m,9){
							REP(n,9){
								ok|=dp[(d+1)%2][i][j][k][l][m][n];
							}
						}
					}
				}
			}
		}
		cout<<ok<<endl;
	}
}

Measured memory_bytes: 5364
#include <stdio.h>
#include <math.h>

int main(void)
{
	double x1;
	double x2;
	double y1;
	double y2;

	//座標を入力する
	scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);

	//結果を出力する
	printf("%lf\n", sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2)));

	return 0;
}


Measured memory_bytes: 2148
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

/*
　　　　　　　　　　　　　　　　　　　　　__,.二ﾆ==-　　ﾆ．、_.　　　　　　　　　　　　　　　　　　　　　
　　　　　　　　　　　　　　　　.,.．‐　⌒　　　　　　　　　　　　｀`'ァ-ﾆ、.　　　　　　　　　　　　　　　
　　　　　　　　　　　　　　ィ'´.　　　　　　　　　　　　　　　　　　　　　　´丶.、　　　　　　　　　　　　
　　　　　　　　　　　.,ィ'´　　　　　　　　　　　　　　　　　　　　　　　　　　　　`.ｘ、..　　　　　　　　　
　..　　　　　　　　／.　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　､＼.　　　　　　　　
　　　　　　　　.ﾝ′.　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　￢`""冖ｰミト．
　　　　　　　,ｒ′.　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　.ﾍ、　　　　`
　　　　　　ﾂ　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`、....　　　
　　　　　./´　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　ﾍ　　　　
　.....　　/.　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　.〉.　　　
　　　´/..　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　.ｌ　　　
　　　ｨ　　　　　　　　　　　　　　　　　　　　　　　　　．　　　　　　　　　　　　　　　　　　　　　ｆ..　　
　..　.ｆ　,d.　　　　　　　　　　　　　　　　　l　　　′　」　　,.　　　　　　　　　　　　　ﾄ　　　　　！　　
　.　〕../.ｆ..　　　　　　　　　　　　　　　　　′　．.　　|　　.｝　　　　　　　　　　　　　|　　　　　　|.　　
　　.!./..f..　　　　　　　　　　　　　　　　　/　　!－　ナ丶п冖т　　　　ﾉｰ-　．　〕　　　　　　|.　　
　　|ﾒ　|　　　　　　　　　　　　　　　｜　j　　　　　　,　　┌．　|〈.　　　л`.　　　/|..　　　　　┤,..　
　...「...｜.　　　　　　|　　´　　　　　　l.　|　　j.Ｌ......ｭ.Ｌ＿└ヽ_｜Y.　　ﾒムｗ　ょ　|　　j.:　　　|　￣
　.　　｜.　　　　　　　　　　　　　　　т〕＜.ィ冖T冖..　г‐　`､　`,　/┴￢..г￣|..　.′　　｜　　
　...　　|　　　　　　　　．..　　　　　　　),|..　｀　　ﾘ　「_ﾉ.||　　　　`　V　　|!｛,｢ll　´.」.　　　　　卜　　
　.　　｜.」　　　　　　′　　　　　　　　ヽ　　　　└++〃..　　　　　　　　ﾙｗｆ　　ｶz′.　　　｜.　　
　　　　|..〕　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　｢　　　　　．|　　　
　　　　.ｌ.|.　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　′.　　　　　|　　　
　.　　　.〕..　　　　　　　　　　　　　　　`!　　　　　　　　_...．.ｰ：''　　　　　　　　　｣　´　　　　λ.　　
　　　　_｢.　　　　,　　　　　　　　　　　　┐_,、｀~‐''"´　　　　　　　　　　　　　　　　ィ　　　.､　ﾍ、　
　　　　ｆ　　　　　　:_＿..,二ュ．-i―'''^~´　　　　　　　　　　　　　　　　　　　　　　　､＼イ　ヘ．`ｘ
　.　　/　　　　　　｛　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　j　　　　.~^
　　､/　　　　　　　'ｔ..　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　丿..　　　　　
　.../.　　　　　　　,x┐..　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　∠∫　　　　　
　:^.　　　　　　　/　　￣冖ー=zzｭ┌ｰ―--　　　∟,二...＿.　　　　　　　_,､．-ｰ.'l+~.　.l｀．　　　　
　.　　　　　　　У.　　　　　　　　　⌒冖‐-=．_..　l｢.｢　　　　　　´￣｣了　　.,､-''＾　　　〉　ヽ_　　　
　　　　　　　_/.　　　　　　　　　　　　　　　　　　￣~'.ー-=．、＿,..usｧ.ｰ''"　　　　　　｛　　　＼´　
　　　　　　_ヰl'￢―-　､_　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　（　　　　.＼
*/

using namespace std;

using ll = long long int;
using ull = unsigned long long int;

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n,ll mod = MOD){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%mod;
        }
        x = (x*x)%mod;
        n >>= 1;
    }
    return ret;
}

ll mygcd(ll a,ll b){
    if(b == 0)return a;
    return mygcd(b,a%b);
}

ll twoPow(ll shiftNum){
    return (1LL << (shiftNum - 1));
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    ll a,b;
    cin >> a >> b;

    cout << a * b << endl;

    return 0;
}

Measured memory_bytes: 3652
x=input()
x_list=x.split()
N=int(x_list[0])
K=int(x_list[1])

Z=set()

for i in range(K):
  s=int(input())
  c=input()
  c_list=c.split()
  for r in c_list:
    Z.add(r)
  
print(N-len(Z))
  

Measured memory_bytes: 9084
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

LL a, b, c;

int main(){
    INIT;
    cin >> a >> b >> c;
    if(b >= c){
        cout << b + c << endl;
    }else{
        cout << b * 2 + min(c - b, a + 1) << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	public static void main(String[] args) {
		int a=scan.nextInt();
		double b=a%2==0?a/2:upper_division(a,2);
		System.out.println(b/a/1.0);
			
	}
}

Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var N = Input.NextInt();
            var T = Input.NextLong();
            long sum = 0;
            long prev = Input.NextLong();

            for (int i = 1; i < N; i++) {
                var tmp = Input.NextLong();
                sum += Math.Min(T, tmp - prev);
                prev = tmp;
            }

            Console.WriteLine(sum + T);
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    int n;

	cin >> n;

	ll a[n];
	ll gap[n - 1];
	int x = 0;
	int y = 1;
	ll m = LLONG_MAX;

	int i, len = n - 1;

	rep(i, n) cin >> a[i];

	sort(a, a + n);

	if (a[0] == 1) {
		Out(1);

		return 0;
	}

	rep(i, len) gap[i] = a[i + 1] - a[i];

    rep(i, len) {
		if (0 < gap[i] && gap[i] < m) {
			m = gap[i];
			x = i;
			y = i + 1;
		}
	}

	while (0 < a[x] && 0 < a[y]) {
		if (a[x] <= a[y]) a[y] -= a[x];
		else a[x] -= a[y];
	}

	if (a[x] < 1) a[x] += a[y];
	else if (a[y] < 1) a[y] += a[x];

	m = min(a[x], a[y]);

	rep(i, n) {
		if (a[i] % m == 0) a[i] = m;
		else a[i] %= m;
	}

	sort(a, a + n);

	Out(a[0]);
	
	return 0;
}


Measured memory_bytes: 1792
g = gets.chomp.split("")

class Ground
  def initialize(ground)
    @str_ground = ground # ["/","/", "\"]
    @int_ground = to_i_array # [1, 2, 1]
  end

  def to_i_array
    h = 0
    @str_ground.map do |g|
      if g == "/"
        h += 1
      elsif g == "_"
        h
      elsif g == "\\"
        h -= 1
      end
    end.unshift(0)
  end

  def puddles
    peak_index = @int_ground.index(@int_ground.max)
    left_puddles = UpSlope.new(@int_ground[0..peak_index]).find_puddles
    right_puddles = DownSlope.new(@int_ground[peak_index..-1]).find_puddles

    left_puddles + right_puddles
  end
end

class DownSlope
  def initialize(int_ground)
    @upslope = UpSlope.new(int_ground.reverse)
  end

  def find_puddles
    @upslope.find_puddles.reverse
  end
end

class UpSlope
  def initialize(int_ground)
    @points = int_ground
  end

  def find_puddles
    puddles = []
    start = 0
    @points.each_with_index do |g, i|
      if i == 0
        # スキップ
        next
      elsif start != (i - 1) # startが固定されてる
        if @points[start] == g  # 終わり
          puddles << Puddle.new(@points[start..i])
          start = i
        end
      elsif @points[i-1] <= g  # 上りか平面
        start = i
      else # 初めて下りになった時
        # startを固定する
      end
    end
    puddles    # [Puddle(...), Puddle(..)]
  end
end

class Puddle
  attr_accessor :size

  def initialize(ground)
    @ground = ground
    @size = calculate_size
  end

  private

  # 真ん中でならす
  def calculate_size
    max = @ground.max
    max * @ground.size - @ground.sum
  end
end

ground = Ground.new(g)

sizes = ground.puddles.map(&:size)
kosu = sizes.length

puts sizes.sum
puts ([kosu] + sizes).join(" ")


Measured memory_bytes: 8476
#include <bits/stdc++.h>
using namespace std;
long long INF = 1000000000000;
int main(){
  int N, C;
  cin >> N >> C;
  vector<vector<int>> D(C, vector<int>(C));
  for (int i = 0; i < C; i++){
    for (int j = 0; j < C; j++){
      cin >> D[i][j];
    }
  }
  vector<vector<int>> c(N, vector<int>(N));
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      cin >> c[i][j];
      c[i][j]--;
    }
  }
  vector<vector<long long>> S(C, vector<long long>(3, 0));
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      for (int k = 0; k < C; k++){
        S[k][(i + j) % 3] += D[c[i][j]][k];
      }
    }
  }
  long long ans = INF;
  for (int i = 0; i < C; i++){
    for (int j = 0; j < C; j++){
      for (int k = 0; k < C; k++){
        if (i != j && j != k && k != i){
          ans = min(ans, S[i][0] + S[j][1] + S[k][2]);
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (auto &v : vec)
    cin >> v;

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

  cout << vec[n/2] - vec[n/2-1] << endl;
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int a,b,c;
    cin >> a >> b >> c;

    if(a+b<c) cout << "No" << endl;
    else cout << "Yes" << endl;
}


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

int main(){
  ll n,k;cin>>n>>k;
  ll a[n];for(int i=0;i<n;++i)cin>>a[i];
  ll b,c;
  b=c=0;
  for(int i=0;i<n;++i){
    ll tmp=0;
    for(int j=0;j<i;++j){
      if(a[i]<a[j])tmp++;
    }
    b+=tmp;
    b%=mod;
  }
  for(int i=0;i<n;++i){
    ll tmp=0;
    for(int j=0;j<n;++j){
      if(a[i]<a[j])tmp++;
    }
    c+=tmp;
    c%=mod;
  }
  ll ans=0;
  ans+=b*k;
  ans%=mod;
  ans+=k*(k-1)/2%mod*c%mod;
  cout<<ans%mod<<endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(lambda a: abs(int(a) % 4 - 2), input().split()))

odd = len(list(filter(lambda x: x == 1, A)))
even2 = len(list(filter(lambda x: x == 0, A)))
even4 = len(list(filter(lambda x: x == 2, A)))

even2 %= 2

if odd + (even2 % 2) <= even4 + 1:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 62960
N, K = map(int, input().split())
D = input().split()

def isok(yen, D):
    flag = True
    for y in yen:
        if y in D:
            flag = False
            break
    return flag

while True:
    if isok(str(N), D):
        print(N)
        break
    N += 1

Measured memory_bytes: 2940
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<char> S(N),T(N);
	for (int i = 0; i < N; ++i) {
		cin >> S[i];
	}
	for (int i = 0; i < N; ++i) {
		cin >> T[i];
	}
	for (int i = 0; i < N; ++i) {
		cout << S[i] << T[i];
	}
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#include<set>
#define ws " "
#define nl "\n"
#define tc ll test; cin>>test; while(test--)
#define f(i, a, b) for(ll i = a; i<b; i++)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod 1000000007
#include<fstream>

using namespace std;

#define pll pair<ll, ll>
bool compare(pll a, pll b)
{
	//for descending order replace with a.roll >b.roll
   if((a.ff < b.ff)||((a.ff==b.ff)&&a.ss<b.ss))
        return 1;
	else
		return 0;
}

ll power(ll x,  ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}


void solve()
{
    int n, d = 0;
    cin>>n;
    string s;
    cin>>s;
    int i = 0;
    string ss = "";
    int r = 0, w = 0;
    while(s[i]!='\0')
    {
        if(s[i]=='R')
            r++;
        else w++;

        i++;
    }

    f(i, 0, r)
    ss+='R';
    f(i, 0, w)
    ss+='W';

    f(i, 0, n)
    {
        if(s[i]!=ss[i])
            d++;
    }

    cout<<d/2<<nl;
}


int main()
{
    fastIO;
    //tc

    //cout<<"Case #"<<i+1<<" :"<<nl;
    solve();


}


Measured memory_bytes: 3808
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Element : IComparable<Element>
    {
        public static bool sortIndex = false;

        public int leftIndex;
        public int distanceToRight;

        public int CompareTo(Element e)
        {
            if(sortIndex)
            {
                return leftIndex.CompareTo(e.leftIndex);
            }

            return distanceToRight.CompareTo(e.distanceToRight);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = int.Parse(s[0]);
            int M = int.Parse(s[1]);

            if (N >= M)
            {
                Console.WriteLine(0);
                return;
            }

            int[] v = new int[M];
            s = Console.ReadLine().Split(' ');
            for (int i = 0; i < M; i++)
            {
                v[i] = int.Parse(s[i]);
            }
            Array.Sort(v);

            if (1 == N)
            {
                Console.WriteLine(v[M - 1] - v[0]);
                return;
            }

            List<Element> elist = new List<Element>();
            for (int i = 0; i < M - 1; i++)
            {
                Element e = new Element();
                e.leftIndex = i;
                e.distanceToRight = v[i + 1] - v[i];

                elist.Add(e);
            }

            elist.Sort();
            elist.Reverse();
            elist.RemoveRange(N - 1, M - N);

            Element.sortIndex = true;
            elist.Sort();

            int ans = v[elist[0].leftIndex] - v[0];
            ans += v[M - 1] - v[elist[elist.Count - 1].leftIndex + 1];

            for (int i = 0; i < elist.Count - 1; i++)
            {
                ans += v[elist[i + 1].leftIndex] - v[elist[i].leftIndex + 1];
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 26460
n = gets.to_i
array = gets.split(" ").map{|k|k.to_i}
ans = 0
h = 0
until h == n
for i in (h+1..(n-1)).reverse_each do
    if array[i-1] > array[i]
        k = array[i]
        array[i] = array[i-1]
        array[i-1] = k
        ans += 1
    end
end
h += 1
end

puts array.join(" ")
puts ans


Measured memory_bytes: 6912
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll k,a,b,i,j;
    cin>>k>>a>>b;
    j=a/k;
    if(a%k!=0)
        j+=1;
    if(j*k>=a&&j*k<=b)
        cout<<"OK"<<endl;
    else
        cout<<"NG"<<endl;


    return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    while(sc.hasNext()){
      int n,y,mb=0;
      double max=0;
      n=sc.nextInt();
      if(n==0)break;
      y=sc.nextInt();
      for(int i=0,b,r,t=0;i<n;++i){
        b=sc.nextInt();r=sc.nextInt();t=sc.nextInt();
        double rt=(t==1)?1+y*r/100.0:Math.pow(1+r/100.0,y);
        if(rt>max){
          max=rt;
          mb=b;
        }
      }
      System.out.println(mb);
    }
  }
}

Measured memory_bytes: 35708
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define MN 205
#define eps 1e-11
#define db double
using namespace std;
const db pi=acos(-1);
struct po{
	db x,y;int id;
	friend po operator-(po x,po y){return (po){x.x-y.x,x.y-y.y};}
	friend db operator/(po x,po y){return x.x*y.y-x.y*y.x;}
	friend db operator*(po x,po y){return x.x*y.x+x.y*y.y;}
	friend db mo(po x){return sqrt(x.x*x.x+x.y*x.y);}
}a[MN];
int n,st[MN];
db ans[MN];
bool cmp(po x,po y){return x.x==y.x?x.y<y.y:x.x<y.x;}
int main(){
	scanf("%d",&n);double x,y;
	for(int i=1;i<=n;i++)scanf("%lf%lf",&x,&y),a[i].x=x,a[i].y=y,a[i].id=i;sort(a+1,a+n+1,cmp);
	int top=1;st[1]=1;
	for(int i=2;i<=n;i++){
		while(top>1&&(a[st[top]]-a[st[top-1]])/(a[i]-a[st[top-1]])<=-eps)top--;
		st[++top]=i;
	}int ls=top;
	for(int i=n-1;i>=1;i--){
		while(top>ls&&(a[st[top]]-a[st[top-1]])/(a[i]-a[st[top-1]])<=-eps)top--;
		st[++top]=i;
	}top--;st[0]=st[top],st[top+1]=st[1];
	for(int i=1;i<=top;i++){
		po tmpx=a[st[i-1]]-a[st[i]],tmpy=a[st[i+1]]-a[st[i]];
		ans[a[st[i]].id]=(pi-acos((tmpx*tmpy)/mo(tmpx)/mo(tmpy)))/(2*pi);
	}for(int i=1;i<=n;i++){
		double tmp=ans[i];printf("%.10lf\n",tmp);
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k,m,i;
  cin>>n>>k;
  m=1;
  for (i=0;i<n;i++) {
    if (m<k) m*=2;
    else m+=k;
  }
  cout<<m<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define ll long long
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vector<int>,greater<int>>
const   double eps = 1e-9;
const long double pi = acos(-1.0);
using namespace std;


void solve(){
    string s;
    int n;
    cin >> s;
    n = s.length();
    if (s[0] == s[n - 1]){
        if (n % 2) cout << "Second\n";
        else 
        cout << "First\n";
    }
    else{
        if (n % 2) cout << "First\n";
        else 
            cout << "Second\n";
    }
}       
int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(10);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int step;
    step = 1;
    //cin >> step;
    for (int i = 1; i <= step; i++){
         solve();
    }
}

Measured memory_bytes: 3704
#include <stdio.h>
int main()
{
	int a1, a2, a3, sum;
	scanf("%d %d %d", &a1, &a2, &a3);
	
	sum = a1 + a2 + a3;
	
	if(sum >= 22){
		printf("bust");
	}
	else{
		printf("win");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9

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

    int a,b,c;
    a = N/100;
    b = (N-a*100)/10;
    c = N-a*100-b*10;

    if(a==7 || b ==7 || c==7){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3584
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define ll long long
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    int n, k;
    cin >> n >> k;
    vector<ll>hn(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> hn.at(i);
    }
    vector<ll>dp(n + 1);
    dp.at(1) = 0;
    for(int i = 2; i <= n; i++){
        ll tmp_min = mod;
        for(int j = 1; j <= k; j++){
            if(i - j < 1) break;
            tmp_min = min(tmp_min, dp.at(i - j) + abs(hn.at(i) - hn.at(i - j)));
        }
        dp.at(i) = tmp_min;
    }
    cout << dp.at(n) << endl;
    solve();
    return 0;
}



Measured memory_bytes: 1792
N = int(input())
import math
sin_dic = {}
mod = 1000000007

zero_num = 0
for i in range(N):
    a, b = list(map(int, input().split()))
    if a == 0 and b == 0:
        zero_num += 1
        continue
    if a == 0:
        b = -1
    elif b == 0:
        a = 1
    else:
        c = math.gcd(a, b)
        a, b = a//c, b//c
        if a < 0 and b < 0:
            a, b = -a, -b
        elif a < 0 and b > 0:
            a, b = -a, -b
    if (a,b) in sin_dic:
        sin_dic[(a, b)].append(i)
    else:
        sin_dic[(a, b)] = [i]

ans = 1
skip_dic = {}
for (key, _key) , values in sin_dic.items():
    if (key, _key) in skip_dic:
        continue
    oth_len = 0
    norm_len = 0
    norm_len += len(values)
    if (-key, -_key) in sin_dic:
        norm_len += len(sin_dic[(-key, -_key)])
    if (_key, -key) in sin_dic:
        oth_len += len(sin_dic[(_key, -key)])
    if (-_key, key) in sin_dic:
        oth_len += len(sin_dic[(-_key, key)])

    p = pow(2, oth_len, mod) - 1 + pow(2, norm_len, mod)
    ans = (ans * p) % mod
    skip_dic[(key, _key)] = True
    skip_dic[(-key, -_key)] = True
    skip_dic[(_key, -key)] = True
    skip_dic[(-_key, key)] = True
print((ans-1 + zero_num) % mod)


Measured memory_bytes: 214176
#include <bits/stdc++.h>
using namespace std;
const int maxn = 31;
int main(){
	unsigned full = 0;
	int n; cin >> n;
	int cnt[maxn] = {};
	for(int i = 0; i < n; i++){
		unsigned x; cin >> x;
		for(int j = 0; j < maxn; j++){
			if(x&(1u<<j)){
				cnt[j]++;
				x ^= 1u<<j;
				break;
			}
		}
		full ^= x;
	}
	int res = 0;
	for(int j = maxn - 1; j >= 0; j--){
		if(full&(1u<<j)){
			if(cnt[j] == 0) return !printf("-1\n");
			if(cnt[j] & 1);
			else {
				cnt[j]--;
				res++;
				full ^= (1u<<j) - 1;
			}
		} else {
			if(cnt[j] & 1){
				cnt[j]--;
				res++;
				full ^= (1u<<j) - 1;
			}
		}
	}
	cout << res << endl;
	return 0;
}
		


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

signed main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if (abs(a - c) <= d || abs(a - b) <= d && abs(b - c) <= d) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
while True:
  n,x = map(int, input().split())
  if n == 0 and x == 0: break
    
  ans = 0
  for i in range(1, n+1):
    for j in range(i+1, n+1):
      if(j < x-i-j < n+1):
        ans += 1
    
  print(ans)


Measured memory_bytes: 5596
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int n = s.size();
    V<int> a(n + 1, 0);
    REP(i, n) a[i + 1] = a[i] ^ (1 << (s[i] - 'a'));

    V<int> dp(n + 1, 200005);
    dp[0] = 0;
    V<int> mdp(1 << 26, 200005);
    mdp[0] = 0;
    for (int i = 0; i < n; i++) {
        dp[i + 1] = mdp[a[i + 1]] + 1;
        for (int j = 0; j < 26; j++) {
            chmin(dp[i + 1], mdp[a[i + 1] ^ (1LL << j)] + 1);
        }
        chmin(mdp[a[i + 1]], dp[i + 1]);
    }
    cout << dp[n] << '\n';
    return 0;
}


Measured memory_bytes: 264340
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.function.BiConsumer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt();
			List<Pair> list = new ArrayList<Pair>();
			for (int i = 0; i < n; i++) {
				list.add(new Pair(in.nextInt(), in.nextInt()));
			}
			list.sort((a, b) -> a.value - b.value);
			long total = 0;
			String ans = "Yes";
			for (Pair pair : list) {
				total += pair.key;
				if (total > pair.value) {
					ans = "No";
					break;
				}
			}
			out.println(ans);
		}
	}

	static class Pair {
		int key;
		int value;

		public Pair(int key, int value) {
			this.key = key;
			this.value = value;
		}

	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}


Measured memory_bytes: 54424
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

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

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////

int main() {
	int N;
	string S;
	cin >> N >> S;
	vector<int>count(N, 0);
	for (int i = 0; i < N-1; ++i) {
		if (S[i] == 'W') {
			count[i+1] = count[i] + 1;
		}
		else {
			count[i+1] = count[i];
		}
	}
	vector<int>Count(N, 0);
	for (int i = N-1; i > 0; --i) {
		if (S[i] == 'E') {
			Count[i-1] = Count[i] + 1;
		}
		else {
			Count[i-1] = Count[i];
		}
	}
	int ans = INF;
	for (int i = 0; i < N; ++i) {
		ans = min(ans, count[i] + Count[i]);
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3076
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll big = (ll)1e9 + 7;

ll po(ll b, ll e) {
	if (e == 1) {
		return b%big;
	}
	if (e%2){
		return b*po(b*b%big, e / 2)%big;
	}else {
		return po(b*b%big, e / 2)%big;
	}
}

int main() {
	ll m, n;
	cin >> m >> n;
	cout << po(m, n) << endl;
}

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

struct P{
    string team;
    int judge[30];
    int win,lose;
    static bool less(const P& left,const P& right){ return left.lose < right.lose; }
    static bool more(const P& le,const P& ri){ return le.win > ri.win; }
};

int main(){
    int n;
    P tmp;
    while(cin >> n,n){
        vector <P> data;
        for(int i=0;i<n;i++){
            tmp.win = 0;
            tmp.lose = 0;
            data.push_back(tmp);
        }
        for(int i=0;i<n;i++){
            cin >> data[i].team;
            for(int j=0;j<n-1;j++){
                cin >> data[i].judge[j];
                if(data[i].judge[j] == 1) data[i].lose++;
                else if(data[i].judge[j] == 0) data[i].win++;
            }
        }
        sort(data.begin(),data.end(),P::less);
        sort(data.begin(),data.end(),P::more);
        for(int i=0;i<n;i++) cout << data[i].team << endl;
    }
}

Measured memory_bytes: 1216
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring> 
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
 
using namespace std;

#define mod 1000000007

int main()
{
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    int kokunai = 0, kaigai = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'a' && kokunai + kaigai < a + b){
            kokunai++;
            cout << "Yes" << endl;
        } else if(s[i] == 'b' && kokunai + kaigai < a + b && kaigai < b){
            kaigai++;
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<"[@"<<__LINE__<<"] "<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}
template<typename T> istream& operator>>(istream& s,vector<T>& v){for(T& x:v)s>>x;return s;}

int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    
    int a, b, m;
    cin >> a >> b >> m;
    vector<int> A(a), B(b);
    cin >> A >> B;
    int ans = INF;
    ans = *min_element(A.begin(), A.end()) + *min_element(B.begin(), B.end());
    int tmp = INF;
    rep(i, m){
        int x, y, c;
        cin >> x >> y >> c;
        --x; --y; 
        chmin(tmp, A[x]+B[y]-c);
    }
    chmin(ans, tmp);
    cout << ans << '\n';
    
    return 0;
}


Measured memory_bytes: 1024
a, b, c = list(map(int, input().split()))
if a==b==c and a%2==1:
  print(0)
elif a==b==c and a%2==0:
  print(-1)
else:
  ans = 0
  while True:
    if a%2==1 or b%2==1 or c%2==1:
      break
    a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
    ans += 1
  print(ans)

Measured memory_bytes: 3064
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n, m = map(int, input().split())

dp = [-1 for _ in range(n)]
V = [[] for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    V[x-1].append(y-1)

def f(x):
    if dp[x] != -1:
        return dp[x]

    t = 0
    for v in V[x]:
        t = max(t, f(v)+1)

    dp[x] = t
    return dp[x]

t = 0
for i in range(n):
    t = max(t, f(i))

print(t)


Measured memory_bytes: 61160