akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

int N, M;
vector<VI> G;
vector<VI> V;
vector<pii>ans;
VI out;

struct UnionFind {
	VI par;
	UnionFind(int _N) :par(_N) {
		REP(i, _N)par[i] = i;
	}
	int root(int x) {
		if (par[x] == x)return x;
		return par[x] = root(par[x]);
	}
	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry)return;
		par[rx] = ry;
	}
	bool same(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

void dfs(int now, int pa) {

	//cout << now << " " << pa << endl;
	for (int to : V[now]) {
		if (pa != to)dfs(to, now);
	}
	if (pa == -1)return;

	if (out[now] % 2) {
		ans.push_back(pii(now, pa));
		out[now]++;
		//cout << "L"<<now << " " << pa << endl;
	}
	else {
		ans.push_back(pii(pa, now));
		out[pa]++;
		//cout << now << " " << pa << endl;
	}
}


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


	map<pii, bool>mp;

	cin >> N >> M;
	UnionFind uni(N);
	G.resize(N);
	V.resize(N);
	out.resize(N);
	REP(i, N)out[i] = 0;
	REP(i, M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	if (M % 2) {
		cout << -1 << endl;
		return 0;
	}

	REP(i, N) {
		REP(j, G[i].size()) {
			int x = i, y = G[i][j];
			if (!uni.same(x, y)) {
				uni.unite(x, y);
				V[x].push_back(y);
				V[y].push_back(x);
				mp[pii(x, y)] = true;
			}
			else {
				
				if (!mp[pii(x, y)] && !mp[pii(y, x)]) {
					ans.push_back(pii(x, y));
					out[x]++;
				}
				mp[pii(x,y)] = true;
				
			}
		}
	}
	/*
	cout << endl;
	REP(i, N) {
		REP(j,V[i].size())cout << i << " " << V[i][j] << endl;
	}
	cout << endl;
	*/

	/*REP(i, N)cout << out[i] << " ";
	cout << endl;

	for (auto p : ans)cout << p.first + 1 << " " << p.second + 1 << endl;
	cout << endl;
	*/
	dfs(0, -1);




	for (auto p : ans)cout << p.first + 1 << " " << p.second + 1 << endl;


	return 0;
}



Measured memory_bytes: 32880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    ll a[n], b[n];
    ll suma = 0;
    ll sumb = 0;
    rep(i, 0, n) {
        cin >> a[i];
        suma += a[i];
    }
    rep(i, 0, n) {
        cin >> b[i];
        sumb += b[i];
    }

    if (suma < sumb) {
        cout << -1 << endl;
        return 0;
    }
    vector<tuple<ll, ll, ll>> t(n);
    rep(i, 0, n) {
        t[i] = make_tuple(a[i] - b[i], a[i], b[i]);
    }
    sort(all(t), greater<tuple<ll, ll, ll>>());

    ll ini[n];
    rep(i, 0, n) {
        ini[i] = get<1>(t[i]);
    }
    int to = n - 1;
    rep(i, 0, n) {
        while (get<0>(t[i]) > 0) {
            if (get<0>(t[to]) < 0) {
                ll move = min(get<0>(t[i]), -get<0>(t[to]));
                get<0>(t[i]) -= move;
                get<1>(t[i]) -= move;
                get<0>(t[to]) += move;
                get<1>(t[to]) += move;
            }
            if (get<0>(t[to]) >= 0) to--;
            if (to == -1) break;
        }
        if (to == -1) break;
    }

    int ans = 0;
    rep(i, 0, n) {
        if (get<1>(t[i]) != ini[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4864
#include<bits/stdc++.h>
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using namespace std;

int main(){
  int n,a[100005],b[100005],c[100005];cin>>n;
  rep(i,n)cin>>a[i]>>b[i]>>c[i];
  int cost[100500][3];
  cost[0][0]=a[0],cost[0][1]=b[0],cost[0][2]=c[0];
  for(int i=1;i<n;i++){
    cost[i][0]=max(cost[i-1][1]+a[i],cost[i-1][2]+a[i]);
    cost[i][1]=max(cost[i-1][2]+b[i],cost[i-1][0]+b[i]);
    cost[i][2]=max(cost[i-1][0]+c[i],cost[i-1][1]+c[i]);
  }
  cout<<max({cost[n-1][0],cost[n-1][1],cost[n-1][2]});
}

Measured memory_bytes: 2560
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace competitive_programming
{
    class Program
    {
        static void Main(string[] args)
        {
            var main = new Program();
            main.solve();
        }

        void solve()
        {
            long n = long.Parse(Console.ReadLine());
            long max = 0;
            long root = (long)Math.Sqrt(n);
            for(long a = 1;a < root + 1; a++)
            {
                if (n % a == 0 && a > max) max = a;
            }

            Console.WriteLine(max + n/max - 2);
        }
    }

    struct Vector2
    {
        public Vector2(long x, long y)
        {
            this.x = x;
            this.y = y;
        }
        public long x;
        public long y;
    }

    struct Vector3
    {
        public int x;
        public int y;
        public int z;
    }
}


Measured memory_bytes: 13140
n, k = map(int, input().split())
s = list(input())
sn = []
cur = None
for c in s:
    if cur is not None:
        if c == cur:
            sn[-1] += 1
        else:
            sn.append(1)
    else:
        sn = [1]
    cur = c

while len(sn) >= 3:
    if k == 0:
        break
    a, b, c = sn.pop(), sn.pop(), sn.pop()
    sn.append(a+b+c)
    k -= 1
if k > 0:
    if len(sn) == 3:
        sn = [sn[0] + sn[1] + sn[2]]
    elif len(sn) == 2:
        sn = [sn[0] + sn[1]]

score = sum([s - 1 for s in sn])
print(score)


Measured memory_bytes: 5416
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e6 + 5, M = 2 * N + 5;

int getCnt(ll x){
    int ret = 0;

    for(int i = 1 ; x >= i ; ++i)
        x -= i, ++ret;

    return ret;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
#endif
    ll n;
    scanf("%lld", &n);

    int ans = 0;
    for(ll i = 2 ; i <= n / i ;  ++i){
        if(n % i)continue;
        int cnt = 0;
        while(n % i == 0)++cnt, n /= i;
        ans += getCnt(cnt);
    }

    printf("%d\n", ans + (n > 1));
}

Measured memory_bytes: 3808
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)

bool used[101];

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  rep(i, 0, m) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  queue<int> q;
  vector<bool> used(n);
  vector<int> ans(n);
  q.push(0);
  used[0] = true;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int nv : g[v]) {
      if (!used[nv]) {
        used[nv] = true;
        ans[nv] = v;
        q.push(nv);
      }
    }
  }

  cout << "Yes" << '\n';
  rep(i, 1, ans.size()) cout << ans[i] + 1 << '\n';
  return 0;
}


Measured memory_bytes: 10216
#include <stdio.h>

long long min(long long a, long long b){ return a < b ? a : b; }

int main(){
    long long Q, H, S, D;
    scanf("%lld%lld%lld%lld", &Q, &H, &S, &D);
    long long N;
    scanf("%lld", &N);
    long long perLitre = min(min(4*Q, 2*H), S);
    printf("%lld", min(perLitre*N, N/2*D + (N%2)*perLitre));
    return 0;
}

Measured memory_bytes: 128
N,M=map(int,input().split())
nekotyann=[0]*N
wanntyann=[0]*N
ans="IMPOSSIBLE"
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        nekotyann[b-1]+=1
    if b==N:
        wanntyann[a-1]+=1
for k in range(N):
    if nekotyann[k]!=0 and wanntyann[k]!=0:
        ans="POSSIBLE"
        break
print(ans)


Measured memory_bytes: 11876
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define vcin(V) for (int i = 0; i < (V).size(); i++) { cin >> (V).at(i); }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define nn int n=0
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
//BEGIN OF CODE.
int a = 0, b = 0, c = 0, cnt = 0, ans = 0, n = 0;
string s, t;
int main(void) {
	cin >> n;
	vint p(n);
	rep(i, n)cin >> p[i];
	c = p[0];
	cnt = 1;
	rep(i, n) {
		if (p[i] < c) {
			c = p[i];
			cnt++;
		}
	}
	cout <<cnt  << rt;
	please AC;
}

//THE END.


Measured memory_bytes: 1024
def main():
  inp = input()
  temp = inp.split()
  N = int(temp[0]); K = int(temp[1])
  S = input()
  lower = S[K-1].lower()
  ans = S[:K-1] + lower + S[K:]
  print(ans)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 2940
import math
prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]

n = int(input())
N = math.factorial(n)

M = N
fac_lst = []
for i in prime:
    count = 0
    M = N
    while M % i == 0:
        M = M // i
        count += 1
    fac_lst.append(count)
    
count0, count1, count2, count3, count4 = 0, 0, 0, 0,0
for i in fac_lst:
    if i >= 74:
        count0 += 1
        count1 += 1
        count2 += 1
        count3 += 1
        count4 += 1
    elif i >= 24:
        count1 += 1
        count2 += 1
        count3 += 1
        count4 += 1
    elif i >= 14:
        count2 += 1
        count3 += 1
        count4 += 1
    elif i >= 4:
        count3 += 1
        count4 += 1
    elif i >= 2:
        count4 += 1
count_lst = [count0, count1, count2, count3, count4]

ans0 = count_lst[0]
ans1 = count_lst[1] * (count_lst[4] - 1)
ans2 = count_lst[2] * (count_lst[3] - 1)
ans3 = (count_lst[3]*(count_lst[3]-1) // 2) * (count_lst[4] - 2)
if ans1 < 0:
    ans1 = 0
if ans2 < 0:
    ans2 = 0
if ans3 < 0:
    ans3 = 0
print(ans0+ans1+ans2+ans3)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
// typename alias
template <class T> using vec = vector<T>;
template <class T, class U> using vep = vec<pair<T,U> >;
template <class T> using PQ = priority_queue<T>;
using ll = long long;
using vll = vec<ll>;
using pll = pair<ll, ll>;
using vpll = vec<pll>;
using str = string;
// あくまのちから
//#define int ll

// const
static const long long INF = 1LL<<59;
static const long long MOD = (ll)1e9+7;
static const double PI = 3.14159265358979323846;

// accelerate stdin, stdout
#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
// repeat macro
#define FOR(i, a, b) for(ll (i)=(a);(i)<=(b);i++)
#define rFOR(i, a, b) for(ll (i)=(b);(i)>=(a);i--)
#define REP(i, n) for(ll i=0;i<n;i++)
// vector macro
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort(WHOLE(v))
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse(WHOLE(v))
#define FOLDL(src, dst, lambda) partial_sum(WHOLE(src), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum(WHOLE(src), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate(WHOLE(v), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

// io helper
template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}
template <typename T>istream& operator>>(istream &is, vec<T> &v) {for(auto &a:v) is >> a; return is;}
template <typename T>ostream& operator<<(ostream &os, vec<T> &v) {os << "[";REP(i, v.size() - 1) os << v[i] <<", "; os << v[v.size()-1]<<"]";return os;}
template <typename T, typename U>ostream& operator<<(ostream &os, pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")";return os;}
template <typename T, typename U>ostream& operator<<(ostream &os, map<T, U> &mp) {os << "{ ";for(auto &p:mp) os << p.first << ": " << p.second << ", "; os << "}";return os;}

void solve() {
    str s, t, u; ll m;
    while(1) {
        cin >> s;
        if(s == "-") break;
        cin >> m;
        REP(i, m) {
            ll h;
            cin >> h;
            t = s.substr(0, h);
            u = s.substr(h);
            s = u + t;
        }
        out(s);
    }
}

signed main() {
    fast_io;
    cout << setprecision(20) << fixed;
    solve();
    return 0;
}


Measured memory_bytes: 3180
N, K = [int(_) for _ in input().split()]

S = [[int(_) for _ in input().split()] for _ in range(K)]
p = 998244353

dp = [0 for _ in range(N + 1)]
dsum = [0 for _ in range(N + 1)]

dp[0] = 1
dsum[0] = 1

for i in range(1, N):
    for l, r in S:
        s = i - r
        e = i - l
        
        if e >= 0:
            dp[i] += dsum[e]
        if s > 0:
            dp[i] -= dsum[s-1]
        dp[i] %= p
    dsum[i] = dsum[i-1] + dp[i]
    dsum[i] %= p

print(dp[N-1])


Measured memory_bytes: 24776
#include <bits/stdc++.h>
using namespace std;
#define Endl endl
typedef long long ll;
const int MAXN = (int)2e5 + 5;
ll a, b, c;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while (cin >> a >> b >> c)
		cout << max(0LL, c - (a - b)) << endl;
}
/*
6 4 3

8 3 9

12 3 7
*/

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


int main() {

  int n;
  cin>>n;

  long double sum=0;;
  for(int i=0;i<n;i++){
    long double x;
    string u;

    cin>>x>>u;
    if(u=="JPY"){
      sum+=x;
    }
    else
    {
      sum+=x*380000.0;
    }
    


  }

  cout << std::fixed << std::setprecision(15) <<sum<<endl;

  return 0;

}


Measured memory_bytes: 256
/* ex5_3
    riverstone*/

#include<stdio.h>
#include <stdbool.h>

int main(void){
    
    int height, width, i, j;
    
    //入力の受け取り
    scanf("%d %d", &height, &width);

    //多次元配列の定義
    //rowとcolは各行と各列に1つ以上の黒が存在するかを記録
    char block[height][width];
    bool row[height], col[width];

    //rowとcolをすべてfalseの配列にする
    for (int i = 0; i < height; i++) {
        row[i] = false;
    }
    for (int i = 0; i < width; i++) {
        col[i] = false;
    }

    //行列のマス(i,j)を読み取る
    //各行と各列に1つ以上の黒が存在するかをrowとcolに記録
    for(i = 0; i < height; i++){
        for(j = 0; j < width; j++){
            scanf(" %c", &block[i][j]);
            if(block[i][j] == '#'){
                //マス(i,j)が黒のとき,row[i],col[j]をtrueにする
                row[i] = true;
                col[j] = true;
            }
        }   
    }
    
    //rowとcolを見て共にtrueであるようなマスの場合のみ出力
    for(i = 0; i < height; i++){
        if(row[i] == 1){
            for(j = 0; j < width; j++){
                if(col[j] == 1){
                    //row[i] = tureかつcol[j] = falseのときblock[i][j]を表示
                    printf("%c", block[i][j]);
                }
            }
            //1行すべて処理が終わると改行する
            printf("\n");  
        } 
    }
 
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=1e3+3;
const int MOD=1e9+7;
template <class T>
bool sf(T &ret){ //Faster Input
    char c; int sgn; T bit=0.1;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&c!='.'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    if(c==' '||c=='\n'){ ret*=sgn; return 1; }
    while(c=getchar(),c>='0'&&c<='9') ret+=(c-'0')*bit,bit/=10;
    ret*=sgn;
    return 1;
}


int main(void){
    int r;
    sf(r);
    if(r<1200)  cout <<"ABC";
    else if(r<2800)  cout <<"ARC";
    else cout <<"AGC";


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cinttypes>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<stack>


#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


struct solve
{
	solve(){}
	ll operator()() {
		return 0;
	}
};

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

	for(;;)
	{
		int x, n;
		cin >> x >> n;
		if(cin.fail()) break;

		vi f(300+3, 1);

		vi p(n);
		for(auto&m:p) cin >> m;

		for(auto&m:p) f[101+m]=0;

		int ans=0;
		for(int i=0;i<=100;i++)
		{
			int y=101+x+i;
			int z=101+x-i;
			if(f[z])
			{
				ans=x-i;
				break;
			}
			if(f[y])
			{
				ans=x+i;
				break;
			}
		}
		cout << ans << "\n";
	}
	return 0;
}


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

int main() {
	vector<int> vec(3);
	for (int i = 0; i < 3; i++) cin >> vec[i];
	sort(vec.begin(), vec.end());
	cout << vec[0] << " " << vec[2] << endl;
	return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;

constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
class modint{
public:
  long long x;
  constexpr modint(long long x=0):x((x%MOD+MOD)%MOD){}
  constexpr modint operator-() const{return modint(-x);}
  constexpr modint& operator+=(const modint& a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  constexpr modint& operator-=(const modint& a){
    if((x+=MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  constexpr modint& operator*=(const modint& a){
    (x*=a.x)%=MOD;
    return *this;
  }
  constexpr modint operator+(const modint& a) const{return modint(*this)+=a;}
  constexpr modint operator-(const modint& a) const{return modint(*this)-=a;}
  constexpr modint operator*(const modint& a) const{return modint(*this)*=a;}
  constexpr bool operator==(const modint& a) const{return this->x==a.x;}
  constexpr bool operator!=(const modint& a) const{return this->x!=a.x;}
  constexpr modint pow(long long expo) const{
    if(expo==0)  return 1;
    modint a=pow(expo>>1);
    a*=a;
    if(expo&1)  a*=(*this);
    return a;
  }
  //for prime MOD
  constexpr modint inv() const{return pow(MOD-2);}
  constexpr modint& operator/=(const modint& a){return (*this)*=a.inv();}
  constexpr modint operator/(const modint& a) const{return modint(*this)/=a;}
};
istream& operator>>(istream& is,const modint& a){return is >> a.x;}
ostream& operator<<(ostream& os,const modint& a){return os << a.x;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N,K;
  cin >> N >> K;
  vector<int> a(N);
  for(int i=0;i<N;i++)  cin >> a.at(i);

  vector<vector<modint>> dp(N+1,vector<modint>(K+1,0));
  dp.at(0).at(0)=1;
  for(int i=0;i<N;i++){
    modint sum=0;
    for(int j=0;j<K+1;j++){
      sum+=dp.at(i).at(j);
      if(j-a.at(i)>0) sum-=dp.at(i).at(j-a.at(i)-1);
      dp.at(i+1).at(j)+=sum;
    }
  }
  cout << dp.at(N).at(K) << endl;

  return 0;
}

Measured memory_bytes: 80256
num=input()
num_str=list(num)
lengh=len(num_str)
tmp=num_str
for i in range(lengh):
    if num_str[i]=="1":
        tmp[i]="9"
    elif num_str[i]=="9":
        tmp[i]="1"
ans="".join(tmp)
print(ans)

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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	char a[2][3];
	for(int i=0;i<2;i++)
		for(int j=0;j<3;j++)
			cin >> a[i][j];
	bool check = true;
	if(a[0][0] != a[1][2] || a[0][1] != a[1][1] || a[1][0] != a[0][2])	
		cout << "NO\n";
	else cout << "YES\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			int n = sc.nextInt();
			int[] xArray = new int[n];
			
			for(int i = 0 ; i < n ; i++ ) {
				xArray[i] = sc.nextInt();
			}
			
			int minE = Integer.MAX_VALUE;
			for(int i = 1 ; i <= 100 ; i++ ) {
				
				int e = 0;
				for(int j = 0 ; j < n ; j++ ) {
					e += (int)Math.pow(xArray[j] - i, 2);
				}
				if ( e < minE ) {
					minE = e;
				}
			}
			
			System.out.println(minE);
			
		}
	}
}

Measured memory_bytes: 21844
#include"bits/stdc++.h"
#include"math.h"
using namespace std;

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
 

using ll = long long int;
using ld = long double;
using pii = pair<int,int>;

#define REP(i,m,n) for(ll i = m; i < (ll)(n);++i)
#define rep(i,n) REP(i,0,n)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
 
using vi=vc<int>;

const ll mod=1e9+7;
const ll INF = 1e18;

int main(){
  cout << fixed; cout << setprecision(20);
  int n;
  cin >> n;
  vector<double> x(n), y(n);
  rep(i,n) cin >> x[i] >>y[i];
  int a=1;
  double ans=0.0;
  for(int i=1;i<n+1;i++){
    a*=i;}
  rep(i,n){
    rep(j,n){
      double dx=x[i]-x[j];
      double dy=y[i]-y[j];
      ans+=pow(dx*dx+dy*dy,0.5)*a/n;
    }
  }
  cout << ans/a << endl;
}
  

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
int main(){
    int l,i;
    char s[105],ans[105]={};
    scanf("%s",s);
    l=strlen(s);
    for(i=0; i<l; i++){
        ans[i]='x';
    }
    printf("%s",ans);
    return 0;
}

Measured memory_bytes: 128
N,M = map(int,input().split())
ABC = [tuple(map(int,input().split())) for i in range(M)]

INF = float('inf')
ds = [[INF]*N for _ in range(N)]
for i in range(N):
    ds[i][i] = 0
for a,b,c in ABC:
    a,b = a-1,b-1
    ds[a][b] = ds[b][a] = c

for k in range(N):
    for i in range(N):
        for j in range(N):
            ds[i][j] = min(ds[i][j], ds[i][k] + ds[k][j])

ans = 0
for a,b,c in ABC:
    a,b = a-1,b-1
    if c != ds[a][b]:
        ans += 1
print(ans)

Measured memory_bytes: 8868
import itertools as itr
import math

s = input()
li = [[k, len(list(g))] for k, g in itr.groupby(s)]
n = len(li)
for i in range(int(n/2)):
  for _ in range(li[2*i][1]-1):
    print(0,end=" ")
  print(math.ceil(li[2*i][1]/2)+math.floor(li[2*i+1][1]/2),end=" ")
  print(math.floor(li[2*i][1]/2)+math.ceil(li[2*i+1][1]/2),end=" ")
  for _ in range(li[2*i+1][1]-1):
    print(0,end=" ")


Measured memory_bytes: 14704
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e9;

#define mod             1000000007
#define what_is(x)      cerr<<#x<<" is "<<x<<"\n";
#define read(x)         freopen("in.txt","r",stdin);
#define write(x)        freopen("out.txt","w",stdout);
#define Fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define sz              81

int n;
ll arr[sz];
ll solve(ll taka){

    ll stock;

    for(int i=1;i<n; i++){
        if(arr[i]<arr[i+1]){
            stock=taka/arr[i];
            taka-=(arr[i]*stock);
            taka+=(arr[i+1]*stock);
        }
    }
    return taka;
}

int main(){
    Fast;///using Fast I/O
    int a,b,c, i,j,k, t,m;
    cin>>n;
    for(i=1; i<=n; i++)cin>>arr[i];
    cout<<solve(1000)<<endl;
    return 0;
}


Measured memory_bytes: 3620
N=int(input())
txy=[list(map(int,input().split())) for _ in range(N)]
txy.insert(0,[0,0,0])
answer="Yes"

for i,t in enumerate(txy[1::]):
    dist=abs(t[1]-txy[i][1])+abs(t[2]-txy[i][2])
    time=t[0]-txy[i][0]
    if dist<=time and (time-dist)%2==0:
        pass
    else:
        answer="No"
        break
print(answer)

Measured memory_bytes: 28148
N=int(input())
p=list(map(int,input().split()))
ANS=0
ans=p[0]-p[1]
for i in range(2,N):
    if (p[i-1]-p[i])*ans>=0:
        ANS+=1
    ans=(p[i-1]-p[i])//abs(p[i-1]-p[i])
print(ANS)

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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int a,b;
  cin >> a >> b;
  if(a==b)
    cout << "Draw" << endl;
  else if(a!=1&&b!=1){
    if(a<b)
      cout << "Bob" << endl;
    else
      cout << "Alice" << endl;
  }
  else{
    if(a==1){
      cout << "Alice" << endl;
    }
    else
      cout << "Bob" << endl;
  }
}


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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


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

    set<int> ans;
    rep(i,N)
    {
        int tmp;
        cin >> tmp;
        ans.insert(tmp);
    }
    cout << ans.size() << endl;
}


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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int main(){
    int a,b;
    cin>>a>>b;
    int x = 1;
    int ans = 0;
    while(x<b){
        ans++;
        x--;
        x+=a;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = list(input())
ANS = []
ans = 0
for i in range(0,N) :
    if i == 0 :
        ans += S[1:].count("E")
        ANS.append(ans)
    elif S[i-1] == "E" and S[i] == "E" :
        ans -= 1
        ANS.append(ans)
    elif S[i-1] == "W" and S[i] == "W" :
        ans += 1
        ANS.append(ans)
print(min(ANS))



Measured memory_bytes: 21068
g = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]

while True :
    try :
        c = -1
        left, right = int(input()), []
        while True :
            if left <= 0 : break
            else :
                if left - g[c] < 0 : c += -1
                else :
                    left -= g[c]
                    right.append(g[c])
        right.sort()
        print(*right)
    except : break

Measured memory_bytes: 7612
#include <iostream>
#include <algorithm>
#include <vector>
#include <bits/stdc++.h>

#define unsigned int long long
#define p(a, b) pair<a,b>

using namespace std;

//ifstream cin("Input.txt");
//ofstream cout("Output.txt");`

int main() {
    int n;
    cin >> n;
    stack<int> st;

    do {
        int remainder = n % -2;
        n = n / -2;
        if (remainder < 0) {
            remainder += 2;
            n += 1;
        }
        st.push(remainder);
    } while (n != 0);

    while (!st.empty()) {
        cout << st.top();
        st.pop();
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        switch(N) {
            case 3: case 5: case 7:
                System.out.println(String.format("YES"));
                break;
            default:
                System.out.println(String.format("NO"));
                break;
        }
    }
}


Measured memory_bytes: 24020
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n=sc.nextInt();
		long min=1145141919;
		long sum=0;
		int count=0;
		for(int i=0;i<n;i++) {
			long A=sc.nextLong();
			min =Math.min(min,Math.abs(A));
			sum+=Math.abs(A);
			if(A<0)count++;
		}
		System.out.println(count%2==0?sum:sum-2*min);
	}
}


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


void solve(long long N, std::vector<std::string> S){
    map<string, ll> mp;
    mp["AC"] = 0;
    mp["WA"] = 0;
    mp["TLE"] = 0;
    mp["RE"] = 0;
    for (ll i=0; i<N; i++) {
        mp[S[i]]++;
    }
    cout << "AC" << " x " <<  mp["AC"] << endl;
    cout << "WA" << " x " <<  mp["WA"] << endl;
    cout << "TLE" << " x " <<  mp["TLE"] << endl;
    cout << "RE" << " x " <<  mp["RE"] << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
    }
    solve(N, std::move(S));
    return 0;
}


Measured memory_bytes: 6456
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
)

func init() {
	readString = newReadString(os.Stdin)
}

type Res struct {
	AC bool
	WA int
}

func main() {
	n := readInt()
	n = n // ???
	m := readInt()

	res := make(map[int]Res)
	for i := 0; i < m; i++ {
		p := readInt()
		m := readString()

		if m == "WA" {
			if !res[p].AC {
				res[p] = Res{
					AC: res[p].AC,
					WA: res[p].WA + 1,
				}
			}
		} else {
			res[p] = Res{
				AC: true,
				WA: res[p].WA,
			}
		}
	}

	ac := 0
	wa := 0
	for k := range res {
		ac = ac + Ac(res[k].AC)
		if res[k].AC {
			wa = wa + res[k].WA
		}
	}

	fmt.Printf("%d %d\n", ac, wa)
}

func Ac(in bool) int {
	if in {
		return 1
	}
	return 0
}

/*-------------------inputs-------------------*/

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func subL(list []int) []int {
	sl := make([]int, len(list)-1)
	for i := range list {
		if i == len(list)-1 {
			continue
		}
		sub := list[i+1] - list[i]
		sl[i] = sub
	}
	return sl
}


Measured memory_bytes: 8576
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int INF = (int)1e9 + 7;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    int sum = 0;
    for (auto &ai: a) cin >> ai, sum += ai;
    pair<int, int> mi{INF, -1};
    for (int i = 0; i < n; i++) {
        mi = min(mi, {abs(a[i] * n - sum), i});
    }
    cout << mi.second << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FO(i,x) for(int (i)=1;(i)<=(x);(i)++)
#define fo(i,x) for(int (i)=0;(i)<=(x);(i)++)
#define G 3
#define p 998244353
const int N=1e6;
int i,j,k,x,y,m,n,tot,sum;
int a[N],b[N],ver[N],nxt[N],head[N];
inline int read()
{
	int r=1;char ch=' ';
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') r=r*10+ch-'0',ch=getchar();
	return r;
}
inline ll ksm(ll x,ll y)
{
	ll re=1;
	for(;y;y>>=1,x=(x*x)%p) if(y&1) re=(re*x)%p;
	return re;
}
inline void add(int x,int y)
{
	ver[++tot]=y,nxt[tot]=head[x],head[x]=tot;
}
int main()
{
	scanf("%d",&n);
	printf("%d",3*n*n);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ri register int
const int N=5e3+5;
string ans;
char s[N<<1];
int main(){
	ri n,k,i,j,x,res;
	scanf("%d%d%s",&n,&k,s+1);
	char c='z';
	for(i=1;i<=n;++i) c=min(c,s[i]),s[2*n-i+1]=s[i];
	if(k>=14){
		while(n--) printf("%c",c);
		return 0;
	}
	for(i=1;i<=n<<1;i=j+1)
		if(s[i]!=c) j=i;
		else{
			for(j=i;j+1<=n<<1&&s[j+1]==c;++j);
			if(j<n) continue;
			res=(j-i+1)*(1<<k-1);
			if(res>=n){
				while(n--) printf("%c",c);
				return 0;
			}
			if(i-1<n-res) continue;
			string now;
			for(x=1;x<=res;++x) now+=c;
			res=n-res;
			for(x=i-1;x>=i-res;--x) now+=s[x];
			ans=ans.empty()?now:min(ans,now);
		}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <map>
#include <utility>
#include <list>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

#define LL long long

int main() {
    int n;
    cin >> n;
    int a[100000];


    for (int i=0; i < n; ++i) {
        int t;
        cin >> t;
        a[i] = t;

        if (t % 2 == 1) {
            cout << "first" << endl;
            return 0;
        }
    }

    cout << "second" << endl;
    return 0;

    

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
  int n;
  scanf("%d",&n);
  if (n == 1)
    cout << "1.0000000000000" << endl;
  else if (n % 2 == 0)
    cout << "0.500000000000000000" << endl;
  else
  {
    float ans = (float) (n/2 + 1) / n;
    printf("%0.10f\n",ans);
  }
  return 0;
}


Measured memory_bytes: 256
def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))
    answer = solve(N, K, p)
    print(answer)


def solve(N, K, p):
    p.sort(reverse=True)

    sum = 0
    for _ in range(K):
        sum += p.pop()

    return sum


if __name__ == "__main__":
    main()


Measured memory_bytes: 9124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int mn[]={0,0,10,100,1000,10000};
int pw10[]={1,10,100,1000};
pair<int,int> M[10];
int get(int n,int pos){
    return n/pw10[pos-1]%10;
}
int main(){
    int n,m;cin>>n>>m;
    for(int i=1;i<=m;i++) cin>>M[i].first>>M[i].second;
    for(int i=mn[n];i<=mn[n+1]-1;i++){
        bool ok=1;
        for(int j=1;j<=m;j++){
            if(get(i,n-M[j].first+1)!=M[j].second) {ok=0;break;}
        }
        if(ok) {cout<<i<<endl;return 0;}
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 256
def sol():
    n=int(input())
    e=[0]*(n+1)
    for i in range(2,n+1):
        cur=i
        for j in range(2,i+1):
            while cur%j==0:
                e[j]+=1
                cur//=j

    def num(m):
        return len(list(filter(lambda x: x>=m-1,e)))
    #print(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+num(5)*(num(5)-1)*(num(3)-2)//2)

    ans=0
    for i in range(n+1):
        if e[i]>73: ans+=1


    for i in range(n):
        for j in range(i+1,n+1):
            if e[i]>23 and e[j]>1: ans+=1
            if e[i]>1 and e[j]>23: ans+=1

    for i in range(n):
        for j in range(i+1,n+1):
            if e[i]>13 and e[j]>3: ans+=1
            if e[i]>3 and e[j]>13: ans+=1

    for i in range(n-1):
        for j in range(i+1,n):
            for k in range(j+1,n+1):
                if e[i]>3 and e[j]>3 and e[k]>1: ans+=1
                if e[i]>3 and e[j]>3 and e[k]>3: ans+=1
                if e[i]>1 and e[j]>3 and e[k]>3: ans+=1
    print(ans)

if __name__=="__main__":
    sol()


Measured memory_bytes: 40816
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
const int MN=2e5+5;
const int mod=998244353;
int n,m,k,fac[MN],inv[MN],pw[MN];
inline ll C(int n,int m){
	return 1ll*fac[n]*inv[n-m]%mod*inv[m]%mod;
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	fac[0]=fac[1]=inv[0]=inv[1]=pw[0]=1;
	for(reg int i=2;i<=n;i++)fac[i]=1ll*fac[i-1]*i%mod;
	for(reg int i=2;i<=n;i++)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	for(reg int i=2;i<=n;i++)inv[i]=1ll*inv[i-1]*inv[i]%mod;
	for(reg int i=1;i<=n;i++)pw[i]=1ll*pw[i-1]*(m-1)%mod;
	reg int Ans=0;
	for(reg int i=min(n-1,k);~i;i--)
		Ans=(Ans+C(n-1,i)*pw[n-1-i]%mod*m)%mod;
	printf("%d\n",Ans);
	return 0;
}

Measured memory_bytes: 6168
#include <stdio.h>

int main(void){
  char s[17] = { '\0' };
  scanf("%16s", s);
  char a[] = "CODEFESTIVAL2016";
  int num = 0;
  for(int i = 0; i < 16; i++){
    if(s[i] != a[i]) num++;
  }
  printf("%d\n", num);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	int h, w;
	cin >> h >> w;

	string strs[100] = {};

	for (int i = 0; i < h; i++)
		cin >> strs[i];

	//tate
	for (int i = 0; i < h; i++) {
		if (strs[i].find('#') == string::npos) {
			for (int j = i + 1; j < h; j++) {
				strs[j - 1] = strs[j];
			}
			h--;
			i--;
		}
	}

	//yoko
	for (int i = 0; i < w; i++) {
		bool flag = true;
		for (int j = 0; j < h; j++) {
			if (strs[j][i] == '#')
				flag = false;
		}

		if (flag) {
			for (int j = i + 1; j < w; j++) {
				for (int k = 0; k < h; k++) {
					strs[k][j - 1] = strs[k][j];
				}
			}
			w--;
			i--;
		}
	}


	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {

			cout << strs[i][j];
		}
		cout << endl;
	}




	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main(){
	int n, d, p, q;
	while(cin >> n, n) {
		bool b[5010][5] = {};
		int up = 0;
		rep(i,n) {
			cin >> d >> p >> q;
			--q;
			bool f = 1;
			if(d == 1) {
				for(int j=up-1;j>=0;--j) {
					rep2(i,q,p+q) {				
						if(b[j][i]) {
							rep2(k,q,p+q) {
								b[j+1][k] = 1;
							}
							up = j == up-1 ? up+1 : up;
							f = 0;
							break;
						}
					}
					if(!f) break;
				}
				if(f) {
					rep2(i,q,p+q) {
						b[0][i] = 1;
					}
					up = up == 0 ? 1 : up;
				}
			} else {
				for(int j=up-1;j>=0;--j) {
					if(b[j][q]) {
						rep2(i,1,p+1) {
							b[j+i][q] = 1;
						}
						up = up <= j+p+1 ? j+p+1 : up;
						f = 0;
						break;
					}
				}
				if(f) {
					rep(i,p) {
						b[i][q] = 1;
					}
					up = up < p ? p : up;
				}
			}
			int cnt = 0;
			rep(i,up) {
				bool c = 1;
				rep(j,5) {
					if(!b[i][j]) {
						c = 0;
						break;
					}
				}
				if(c) {
					rep2(j,i,up) {
						rep(k,5) {
							b[j][k] = b[j+1][k];
						}
					}
					i--;
					cnt++;
				}
			}
			up -= cnt;
		}
		int ret = 0;
		rep(i,up) {
			rep(j,5) {
				if(b[i][j]) ret++;
			}
		}
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 1188
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

l, r, d = map(int, readline().split())

if l % d == 0:
    ans = r // d - l // d + 1
else:
    ans = r // d - l // d
print(ans)


Measured memory_bytes: 9072
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    string s,t;
    cin >> s >> t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    if(s<t){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#define rep(i, n) for(Int (i) = 0; (i) < (n); (i)++)
#define debug(var) cout << #var << ": " << var << endl
using namespace std;
using Int = int64_t;
using Uint = uint64_t;
constexpr long long int mod = 1e9 + 7;
using container = vector<Int>;

///aとbの最大公約数を求める関数。計算量はO(log min(a, b))
Int Gcd(Int a, Int b) {
	if (a % b == 0)return b;
	else return Gcd(b, a % b);
}

//aとbの最小公倍数を求める関数。計算量はO(log min(a, b)) 上のGcdとセットでコピペしてね
Int Lcm(Int a, Int b) {
	return a * b / Gcd(a, b);
}

Int f(Int x) {
	Int res = 0;
	while (x % 2 == 0) {
		x /= 2;
		res++;
	}
	return res;
}

int main() {

	Int N, M; cin >> N >> M;
	container a(N);
	rep(i, N) {
		cin >> a[i];
		a[i] /= 2;
	}

	bool flag = true;
	rep(i, N - 1)if (f(a[i]) != f(a[i + 1]))flag = false;
	if (!flag) {
		cout << 0 << endl;
		return 0;
	}
	Int t = f(a[0]);
	rep(i, N)a[i] >>= t;
	M >>= t;

	Int l = 1;
	rep(i, N) {
		l = Lcm(l, a[i]);
		if (l > M) {
			cout << 0 << endl;
			return 0;
		}
	}

	M /= l;
	Int ans = (M + 1) / 2;

	cout << ans << endl;

}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
int m,d,h,y;
char w[][7]={"Satur","Sun","Mon","Tues","Wednes","Thurs","Fri"};
for(;;){
y=4;
cin>>m>>d;
if(m==0)break;
if(m<3){m+=12;y--;}
h=(y+int(y/4)+int(2.6*(m+1))+d)%7;
cout<<w[h]<<"day"<<endl;
}
return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  rep(i, N) cin >> H[i];

  int ans = 1;
  int m = H[0];
  for (int i = 1; i < N; i++) {
    if (m > H[i]) continue;
    ans++;
    m = max(m, H[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
#include<stdlib.h>


 int main(){
     int i,count[26]={0};
     char n;
    
     for(i=0; scanf("%c",&n)!=EOF;i++){
          if(isupper(n)!=0)count[tolower(n)-'a']++;
          else count[n-'a']++;
          }
     for(i=0;i<26;i++){
          printf("%c : %d\n",'a'+i,count[i]);
          }
     return 0;
     }


Measured memory_bytes: 2056
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    int cnt = 0;
    int ans;
    for (int i = max(A, B); i >= 1; i--) {
        if (A % i == 0 && B % i == 0) {
            cnt++;
            ans = i;
        }
        if (cnt == K) {
            cout << ans << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
x = int(input())
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
else:
    print(1)


Measured memory_bytes: 61636
def bs(A,key):
    m = len(A)
    left = 0
    right = m
    while left < right:
        mid = (right+left)//2
        if A[mid] == key:
            return True
        elif key < A[mid]:
            right = mid
        else:
            left = mid + 1
    return False

n = int(input())
s = [int(i) for i in input().split()]
q = int(input())
t = [int(i) for i in input().split()]
ans = 0
for i in range(q):
    if bs(s,t[i]):
        ans += 1
print(ans)


Measured memory_bytes: 16896
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

int gcd(int x,int y){
  if(!(x%y))return y;
  else return gcd(y,x%y);
}
int main() {
  string s;cin >> s;
  int n=s.size();
  int c=0;
  
  rep(i,n-1) if(s[i]==s[i+1]){s[i+1]=((s[i+1]=='1')?'0':'1');c++;}
  cout << min(n-c,c);
}

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

int main(){
  int N;
  cin >> N;
  int X[N],Y[100]={};
  for(int i=0;i<N;i++){
    cin >> X[i];
    for(int j=0;j<101;j++){
      Y[j] = Y[j]+(j-X[i])*(j-X[i]);
    }
  }
  sort(Y,Y+100);
  cout << Y[0] << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
set<int> s;
int main()
{
	int n;
	scanf("%d",&n);
	while(n--)
	{
		int x, y;
		scanf("%d%d",&x,&y);
		if(x == 0) 
		{
			s.insert(y);
			printf("%d\n",s.size());
		}
		else if(x == 1) printf("%d\n",s.count(y));
		else if(x == 2) s.erase(y);
	}
	return 0;
}


Measured memory_bytes: 12580