akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
int roundup(int a,int b){return	(a-1)/b+1;}

signed main(){
	int n;cin>>n;
	vector<int> a(n);
	rep(i,n) cin>>a[i];
	if(a[0]!=0){
		cout<<-1<<endl;
		return 0;
	}
	int ans=0;
	rep(i,n-1){
		if(a[i+1]==a[i]+1) ans++;
		else if(a[i+1]<=a[i]){
			ans+=a[i+1];
		}
		else{
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int P = scanner.nextInt();
    int numOdd = 0;
    int numEven = 0;
    for (int i = 0; i < N; i++) {
      int a = scanner.nextInt();
      if (a % 2 == 0) numEven++;
      else numOdd++;
    }

    long res = 0;
    if (P == 1) {
      for (int i = 1; i <= numOdd; i += 2)
        res += choose(numOdd, i);
    } else {
      for (int i = 0; i <= numOdd; i += 2)
        res += choose(numOdd, i);
    }
    res *= 1L << numEven;
    System.out.println(res);
  }

  private static long choose(long n, long k) {
    if (k > n - k) return choose(n, n - k);
    if (k == 0) return 1;
    long res = 1;
    for (int i = 0; i < k; i++) res *= n - i;
    for (int i = 1; i <= k; i++) res /= i;
    return res;
  }
}


Measured memory_bytes: 22740
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int N;
vector<pair<int,int>> g[100010];

int color[100010];

void dfs(int now,int col){
  color[now]=col;
  for(int i=0;i<g[now].size();i++){
    int nex=g[now][i].first;
    int co=g[now][i].second;
    
    if(color[nex]!=0) continue;
    if(co%2) dfs(nex,-col);
    else dfs(nex,col);
  }
  return;
}

int main(){
  cin>>N;
  for(int i=0;i<N-1;i++){
    int u,v,w;
    cin>>u>>v>>w;
    u--;
    v--;
    g[u].push_back(make_pair(v,w));
    g[v].push_back(make_pair(u,w));
  }

  int start=0;
  for(int i=0;i<N;i++){
    if(g[i].size()==1) start=i;
  }

  dfs(start,1);

  for(int i=0;i<N;i++){
    if(color[i]==1) cout<<1<<endl;
    else cout<<0<<endl;
  }

  return 0;
}


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

#define ii pair<int,int>
#define f first
#define s second
#define pb push_back
#define mp make_pair

typedef vector<int> vi;
typedef vector<ii> vii;

int main(){
    int s = 0, ent;
    for(int i = 0; i < 3; i++){
        scanf("%d", &ent);
        s+=ent;
    }
    if(s > 21){
        printf("bust\n");
    }else{
        printf("win\n");
    }
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

int u[10];

bool solve(){
	bool f=false;
	int sum=0;
	for(int i=1;i<10;i++)sum+=u[i];
	if(sum==0)return true;
	for(int i=1;i<10;i++){
		if(u[i]>2){
			u[i]-=3;
			if(solve()){
				f=true;
			}
			u[i]+=3;
		}
	}
	for(int i=1;i<8;i++){
		if(u[i]>0&&u[i+1]>0&&u[i+2]>0){
			u[i]--;
			u[i+1]--;
			u[i+2]--;
			if(solve()){
				f=true;
			}
			u[i]++;
			u[i+1]++;
			u[i+2]++;
		}
	}
	return f;
}

int main(void){
	char buff[20];
	while(scanf("%s",buff)!=EOF){
		int d[10]={0};
		vector<int> v;
		for(int i=0;i<13;i++){
			d[buff[i]-'0']++;
		}
		for(int i=1;i<10;i++){
			for(int j=1;j<10;j++){
				u[j]=d[j];
			}
			if(u[i]==4)continue;
			if(u[i]>4){v.clear();break;}
			u[i]++;
			if(u[i]>4)continue;
			bool f=false;
			for(int j=1;j<10;j++){
				if(u[j]>1){
					u[j]-=2;
					if(solve()){
						f=true;
					}
					u[j]+=2;
				}
			}
			if(f)v.push_back(i);
		}
		if(v.size()==0){cout<<"0"<<endl;continue;}
		for(int i=0;i<v.size()-1;i++)cout<<v[i]<<" ";
		cout<<v[v.size()-1]<<endl;
	}
}

Measured memory_bytes: 1208
import sys
input = sys.stdin.readline

X, D = map(int, input().split())
L = [[int(v) for v in input().split()] for _ in range(X)]

def f(a, b):
    ab = [0] * D
    for i in range(D):
        ab[i] = (a[i] - b[i]) ** 2
    return sum(ab) ** 0.5

ans = 0
for i in range(1 << X):
    p = []
    for j in range(X):
        if (i >> j) & 1:
            p.append(j)
            
    if len(p) != 2:
        continue
        
    t = f(L[p[0]], L[p[1]])
    if t == int(t):
        ans += 1
        
print(ans)

Measured memory_bytes: 3192
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(long long int i=0;i<p;i++)
#define reep(i,p) for(long long int i=1;i<=p;i++)
#define ll long long

using namespace std;

int main(){
ll int N,K;
cin >> N >> K;

ll int counter = 0;
vector<ll int> h(N);
rep(i,N){
	cin >> h[i];
	if(h[i]>=K){
		counter+=1;
}
}

cout << counter;










	return 0;

}



Measured memory_bytes: 1024
#include<stdio.h>
int main(void){

  char a;
  scanf("%c",&a);

  if(a=='A'){
    printf("T");
  }else if(a=='C'){
    printf("G");
  }else if(a=='T'){
    printf("A");
  }else if(a=='G'){
    printf("C");
  }else{
    printf(":(");
  }

return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int cnt[101010];
int main()
{
	int n,x,mi=100000,ma=0,k=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		cnt[x]++;
		mi=min(mi,x);
		ma=max(ma,x);
	}
	if(mi==ma&&mi==n-1)
	{
		printf("Yes");
		return 0;
	}
	if(ma-mi>1)
	{
		printf("No");
		return 0;
	}
	if(ma-mi==1)
	{
		k=cnt[mi];
		if(ma<=cnt[mi])
		{
			printf("No");
			return 0;
		}
	}
	if((ma-k)*2<=cnt[ma])
		printf("Yes");
	else
		printf("No");
	return 0;
}

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

int main() {
	int N;cin>>N;
	vector<int>A(N),B(N),C(N-1);
	for(int i=0;i<N;i++)cin>>A[i];

	int ans = 0;

	for(int i=0;i<N;i++)
	{
		int b;cin>>b;
		ans += b;
	}

	for(int i=0;i<N-1;i++)
	{
		cin>>C[i];
	}
	for (int i = 1; i < N; i++)
	{
		if(A[i]-A[i-1]==1)ans+=C[A[i-1]-1];
	}

	cout<<ans<<endl;


	return 0;
}

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

int t, n, j, c, x, a, b; string s; string ss;

vector<int> v; 

int main(){
	scanf("%d %d %d", &x, &a, &b);
	if(a-b>=0) printf("delicious\n");
	else if(b-a <= x) printf("safe\n");
	else printf("dangerous\n");
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>

using namespace std;
const int qq = 1e5 + 10;
int num[qq];
int Gcd(int a, int b) {
    return b == 0 ? a : Gcd(b, a % b);
}

int main() {
    int n, k;   scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; ++i) {
        scanf("%d", num + i);
    }
    sort(num + 1, num + 1 + n);
    if(k > num[n]) {
        puts("IMPOSSIBLE");
        return 0;
    }
    if(k == 1) {
        if(num[1] == k) {
            puts("POSSIBLE");
        } else {
            puts("IMPOSSIBLE");
        }
        return 0;
    }
    int t = num[1];
    for(int i = 2; i <= n; ++i) {
        t = Gcd(t, num[i]);
    }
    if(t == 1) {
        puts("POSSIBLE");
    } else {
        if(k % t == 0) {
            puts("POSSIBLE");
        } else {
            puts("IMPOSSIBLE");
        }
    }
    return 0;
}


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

#define ff 		first
#define ss 		second
#define ll 		long long
#define pb 		push_back
#define mp 		make_pair
#define pi 		pair<int,int>
#define vi 		vector<int>
#define pqb 	priority_queue<int>
#define pqs 	priority_queue<int,vi,greater<int>>
#define setbit(x) 	__builtin_popcountll(x)
#define mod 	1000000007
#define inf 	1e18
#define endl 	"\n"

int main() {
	ll n, d;
	cin >> n >> d;
	ll x, y;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		double ans = sqrt(x * x + y * y);
		if (ans <= d) {
			cnt++;
		}
	}
	cout << cnt;

	return 0;

}

Measured memory_bytes: 3676
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

bool[101] L;

void main()
{
    auto nmx = readln.split.to!(int[]);
    auto N = nmx[0];
    auto M = nmx[1];
    auto X = nmx[2];
    foreach (a; readln.split.to!(int[])) L[a] = true;

    int a, b;
    foreach (i; 0..N+1) {
        if (L[i]) ++a;
        if (i == X) {
            b = a;
            a = 0;
        }
    }
    writeln(min(a, b));
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long int64;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second

signed main(){
    int A, B; cin>>A>>B;
    int res=0;
    REP(i,2){
        if(A>B) res += A, A--;
        else res += B, B--;
    }
    cout << res << endl;
    return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	auto N=in(),A=in(),B=in();
	int sum = 0;
	for(int i=1;i<=N;i++){
		int v=i;
		int psum=0;
		while(v){
			psum+=v%10;
			v/=10;
		}
		if(psum>=A && psum<=B) sum += i;
	}
	
	out(sum);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V){os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P){return os << "(" << P.first << "," << P.second << ")";}
#ifndef ONLINE_JUDGE
#define TRACE
#endif

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){ cout << name << " : " << arg1 << endl; }
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...) 1
#endif
#define mp make_pair
#define pb push_back
#define endl '\n'
#define F first
#define S second
#define I insert
typedef long double ld;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
const int N = 1e5+5;
vll adj[N],topo;
ll T,vis[N],dp[N];

void dfs(ll u){
	vis[u] = 1;
	for(auto z : adj[u]){
		if(!vis[z]) dfs(z);
	}
	topo.pb(u);
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout<<setprecision(25);
    ll n,m; cin>>n>>m;
    for(int i=0;i<m;i++){
    	ll u,v; cin>>u>>v;
    	adj[u].pb(v);
    }
    for(int i=1;i<=n;i++)
    	if(vis[i] == 0) dfs(i);
    reverse(topo.begin(), topo.end());
    for(auto z : topo){
    	for(auto y : adj[z])
    		dp[y] = max(dp[y], dp[z]+1);
    }
    ll ans = 0;
    for(int i=1;i<=n;i++) ans = max(ans, dp[i]);
    cout << ans;
}

Measured memory_bytes: 10228
import fractions
N,M=map(int,input().split())
S=input()
T=input()
g=fractions.gcd(N,M);l=N*M//g
if(g==1):
    print(l if S[0]==T[0] else -1)
    exit()
a,b=0,0
n=N//g;m=M//g
while(a<N and b<M):
    if(S[a]!=T[b]):
        print(-1)
        exit()
    a+=n;b+=m
print(l)


Measured memory_bytes: 5560
#include <bits/stdc++.h>
using namespace std;
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
vector<int> used1,used2;
vector<int> dp1,dp2;
priority_queue<pair<int,int>> pq1;
priority_queue<pair<int,int>> pq2;
vector<vector<int>> v;
int main(){
    int n,m;
    int s,t;
    cin>>n>>m>>s>>t;
    s--;
    t--;
    v=vector<vector<int>>(n);
    // set<pair<int,int>> se;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
        // se.insert(minmax(a,b));
    }
    used1=vector<int>(n+10,-1);
    used2=vector<int>(n+10,-1);
    pq1.push(make_pair(0,s));
    pq2.push(make_pair(0,t));
    while(pq1.size()){
        auto top=pq1.top();
        pq1.pop();
        if(used1[top.second]>=0) continue;
        used1[top.second]=-top.first;
        for(int x:v[top.second]){
            if(used1[x]>=0) continue;
            pq1.push(make_pair(top.first-1,x));
        }
    }
    while(pq2.size()){
        auto top=pq2.top();
        pq2.pop();
        if(used2[top.second]>=0) continue;
        used2[top.second]=-top.first;
        for(int x:v[top.second]){
            if(used2[x]>=0) continue;
            pq2.push(make_pair(top.first-1,x));
        }
    }
    // for(auto x:se){
    //     cout<<x.first<<" "<<x.second<<endl;
    // }
    long long ans=0;
    int dist=used1[t];
    // if(dist<2){
        // cout<<0<<endl;
        // return 0;
    // }
    dp1=vector<int>(n+10,0);
    dp2=vector<int>(n+10,0);
    rep(i,n){
        if(0<=used1[i]&&used1[i]<=n) dp1[used1[i]]++;
        if(0<=used2[i]&&used2[i]<=n) dp2[used2[i]]++;
    }
    rep(i,dist-1){
        // if(i==dist-2-i) ans+=dp1[i]*dp2[dist-2-i]/2;
        ans+=(long long)dp1[i]*dp2[dist-2-i];
    }
    // rep(i,n){
        // cout<<i<<" "<<used1[i]<<" "<<used2[i]<<endl;
        // if(s==i||t==i) continue;
        // if(used2[i]==dist-2&&se.find(minmax(s,i))==se.end()) ans++;
        // if(used1[i]==dist-2&&se.find(minmax(t,i))==se.end()) ans++;
    // }
    cout<<ans<<endl;
}

Measured memory_bytes: 10424
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        static final long MODULO = 998244353;
        static int[] invs;
        static int[] facts;
        static int[] invfacts;

        static {
            int k = (int) 1.1e7;
            invs = new int[k + 2];
            invs[1] = 1;
            for (int i = 2; i <= k + 1; ++i) {
                invs[i] = (int) ((MODULO - (MODULO / i) * (long) invs[(int) (MODULO % i)] % MODULO) % MODULO);
            }
            facts = new int[k + 2];
            invfacts = new int[k + 2];
            facts[0] = 1;
            invfacts[0] = 1;
            for (int i = 1; i <= k + 1; ++i) {
                facts[i] = (int) (facts[i - 1] * (long) i % MODULO);
                invfacts[i] = (int) (invfacts[i - 1] * (long) invs[i] % MODULO);
            }
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long res = 1;
            for (int i = 0; i < n; ++i) {
                res = res * 3 % MODULO;
            }

            long p2 = 2;
            for (int na = 0; na < n / 2; ++na) {
                res = (res - facts[n] * (long) invfacts[na] % MODULO * invfacts[n - na] % MODULO * p2) % MODULO;
                p2 = p2 * 2 % MODULO;
            }
            if (res < 0) res += MODULO;
            out.println(res);
        }

    }

    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 int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int a, b;
    cin >> a >> b;
    cout << ceil((b - 1) / (double)(a - 1)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string str;
    int n;
    cin >> str;
    cin >> n;
    //iを使わないで減らすだけ
    while(n--) {
        string s;
        cin >> s;
        if (s == "print") {
            int a, b;
            cin >> a >> b;
            cout << str.substr(a, b-a+1) << endl;
        } else if (s == "reverse") {
            int a, b;
            cin >> a >> b;
            reverse(str.begin()+a, str.begin()+b+1);
        } else {
            int a, b;
            string p;
            cin >> a >> b >> p;
            str.replace(a, b-a+1, p);
        }
    }
    return 0;
}


Measured memory_bytes: 3172
#include<stdio.h>
#include<string.h>
#define LEN 100005

//プロセスを表す構造体
typedef struct pp{
    char name[100];
    int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x){
    Q[tail] = x;
    tail = (tail +1) % LEN;
}

P dequeue(){
    P x =Q[head];
    head = (head +1) % LEN;
    return x;
}

int min(int a, int b){return a < b ? a: b;}//最小値を返す
int main(){
    int elaps = 0, c;
    int i, q;
    P u;
    scanf("%d %d", &n, &q);

    //全てのプロセスをキューに順番に追加する
    for (i=1; i<= n; i++){
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].t);
    }
    head = 1; tail= n+1;

    //シミュレーション
    while(head != tail){
        u = dequeue();
        c = min(q, u.t); //qまたは必要な時間　u.t だけ処理を行う
        u.t -= c;
        elaps += c;
        if(u.t >0) enqueue(u);
        else{
            printf("%s %d\n", u.name, elaps);
        }
    }
    return 0;
}


Measured memory_bytes: 11864
#include<bits/stdc++.h>
using namespace std;
int i[500][500];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=1,f=0;
  string s[110];
  cin >>a>>b;
  for(int n=0;n<a;n++) cin >>s[n];
  for(int n=0;n<a;n++){
    cout <<s[n]<<'\n';
    cout <<s[n]<<'\n';
  }
  return (0);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	string s;
	cin >> s;
	
	int n = (int)s.size();
	for(int i = 0; i < n; ++i) {
		for(int j = i; j < n + 1; ++j) {
			string t = s.substr(0, i) + s.substr(j);
			
			if( t == "keyence" ) {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	
	cout << "NO" << endl;
	
	return 0;
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using Edge = std::tuple<int, ll>;

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

constexpr ll INF = std::numeric_limits<ll>::max() / 2;
int N, M;
ll X, H[100100];
std::vector<Edge> G[100100], rG[100100];
// dist[i] = 木 i の一番下から木 N の頂上へ行くのにかかる最短時間
// maxHeight[i] = 木 1 の位置 X から木を登らないで行ける木 i の最大位置
ll dist[100100], maxHeight[100100];
std::priority_queue<std::tuple<ll, int>> pq;

void dijkstra(){
    std::fill(dist + 1, dist + 1 + N, INF);
    dist[N] = H[N];
    pq.emplace(-dist[N], N);

    until(pq.empty()){
        ll d;
        int i;
        std::tie(d, i) = pq.top();
        d = -d;
        pq.pop();

        if(d > dist[i]){
            continue;
        }

        for(const auto &e : rG[i]){
            int j;
            ll t;
            std::tie(j, t) = e;

            if(d + 2ll * t < dist[j]){
                dist[j] = d + 2ll * t;
                pq.emplace(-dist[j], j);
            }
        }
    }
}

void dijkstra2(){
    std::fill(maxHeight + 1, maxHeight + 1 + N, -1);
    maxHeight[1] = X;
    pq.emplace(maxHeight[1], 1);

    until(pq.empty()){
        ll h;
        int i;
        std::tie(h, i) = pq.top();
        pq.pop();

        if(h < maxHeight[i]){
            continue;
        }

        for(const auto &e : G[i]){
            int j;
            ll t;
            std::tie(j, t) = e;

            if(h < t){ // 登らなければ移れない
                continue;
            }

            ll nh = std::min(h - t, H[j]);
            if(nh > maxHeight[j]){
                maxHeight[j] = nh;
                pq.emplace(maxHeight[j], j);
            }
        }
    }
}

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

    std::cin >> N >> M >> X;

    for(int i=1;i<=N;++i){
        std::cin >> H[i];
    }

    for(int i=0;i<M;++i){
        int a, b;
        ll t;
        std::cin >> a >> b >> t;

        if(H[a] >= t){
            G[a].emplace_back(b, t);
            rG[b].emplace_back(a, t);
        }
        if(H[b] >= t){        
            G[b].emplace_back(a, t);
            rG[a].emplace_back(b, t);
        }
    }

    dijkstra();
    dijkstra2();
    
    ll res = INF;
    if(maxHeight[N] >= 0){
        res = (X - maxHeight[N]) + (H[N] - maxHeight[N]);
    }

    for(int i=1;i<N;++i){
        if(maxHeight[i] < 0){
            continue;
        }

        for(const auto &e : G[i]){
            int j;
            ll t;
            std::tie(j, t) = e;

            if(maxHeight[i] >= t){ // 登らなくても移れる
                continue;
            }

            ll ti = (X - maxHeight[i]) + (t - maxHeight[i]) + t + dist[j];
            res = std::min(res, ti);
        }
    }

    if(res == INF){
        res = -1;
    }

    std::cout << res << std::endl;
}



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

int main()
{
	vector<int> a;
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int t;
		cin >> t;
		a.push_back(t);
	}
	int max = *max_element(a.begin(), a.end());
	int min = *min_element(a.begin(), a.end());
	long long sum = accumulate(a.begin(), a.end(), 0LL);
	cout << min << " " << max << " " << sum << endl;
	return 0;
}



Measured memory_bytes: 3244
#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 = 2e5 + 5, M = 2 * N + 5;

ll lim(1e18);

ll isOver(ll x, ll y){
    return y && x > lim / y;
}

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

    ll res = 1;
    bool ok = true;
    bool zero = false;

    while(n--){
        ll x;
        scanf("%lld", &x);
        if(isOver(res, x))
            ok = false;
        if(ok)
            res *= x;
        if(!x)zero = true;
    }

    if(zero)res = 0, ok = 1;
    if(ok)printf("%lld\n", res);
    else puts("-1");
}

Measured memory_bytes: 3796
N_MATCH, NUMBERS = gets.split(' ').map(&:to_i)
USABLE = gets.split(' ').map(&:to_i).sort.reverse
TABLE = [1000,2,5,5,4,5,6,3,7,6]

PRIORITY = USABLE.reduce({}){ |z, x| (z[TABLE[x]] ||= []) << x; z }.sort.to_h

MEMO = {}
MEMO2 = {}
@max_str = ""
def dp(n)
  return 0 if n == 0
  return -10000000 if n < 0
  return MEMO[n] if MEMO[n]

  max = -1
  max_digit = 0
  USABLE.each do |v|
    res = dp(n - TABLE[v]) + 1
    if res > max
      max = res
      max_digit = v
    end
  end

  MEMO[n] = max
  MEMO2[n] = max_digit
  max
end

dp(N_MATCH)
num = N_MATCH
res = ""
while num > 0
  d = MEMO2[num]
  res += d.to_s
  num -= TABLE[d]
end
puts res


Measured memory_bytes: 15484
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int n;  cin >> n;
    long long *a = new long long [n];
    for (int i = 0; i < n; i++) {
        long long c;    cin >> c;
        a[i] = c-(i+1);
    }

    long long ans = 0;

    sort(a, a+n);
    
    for (int i = 0; i < n; i++) 
        ans += abs(a[n/2] - a[i]);

    cout << ans << endl;
    return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

struct point {
	int x, y, z;
} pt[MAXN];

pii sorted_yz[MAXN], sorted_xz[MAXN];
set<pii> pt_xz_x, pt_xy_y;

void solve(){
	int X, Y, Z, n;
	ll ans = 0ll;
	scanf("%d%d%d", &X, &Y, &Z);
	n = X + Y + Z;
	REP(i, 0, n) {
		scanf("%d%d%d", &pt[i].x, &pt[i].y, &pt[i].z);
		int mn = min(pt[i].x, min(pt[i].y, pt[i].z));
		ans += mn;
		pt[i].x -= mn;
		pt[i].y -= mn;
		pt[i].z -= mn;
		
		sorted_yz[i] = mp(pt[i].z - pt[i].y, i);
	}
	sort(sorted_yz, sorted_yz + n);
	ll best = 0;
	REP(i, 0, Y) {
		int ind = sorted_yz[i]._2;
		pt_xy_y.insert(mp(pt[ind].y - pt[ind].x, ind));
		best += pt[ind].y;
	}
	REP(i, Y, n) {
		int ind = sorted_yz[i]._2;
		sorted_xz[i] = mp(pt[ind].z - pt[ind].x, ind);
	}
	sort(sorted_xz + Y, sorted_xz + n);
	REP(i, Y, Y + X) {
		int ind = sorted_xz[i]._2;
		pt_xz_x.insert(mp(pt[ind].x - pt[ind].z, ind));
		best += pt[ind].x;
	}
	REP(i, Y + X, n) {
		int ind = sorted_xz[i]._2;
		best += pt[ind].z;
	}
	
	ll cur = best;
	REP(i, Y, Y + X) {
		int ind = sorted_yz[i]._2;
		
		int dif = pt[ind].y - pt[ind].x;
		if (dif > pt_xy_y.begin()->_1) {
			cur += dif - pt_xy_y.begin()->_1;
			pt_xy_y.erase(pt_xy_y.begin());
			pt_xy_y.insert(mp(dif, ind));
		}
		
		dif = pt[ind].x - pt[ind].z;
		if (pt_xz_x.find(mp(dif, ind)) != pt_xz_x.end()) {
			pt_xz_x.erase(mp(dif, ind));
		} else {
			cur += dif - pt_xz_x.begin()->_1;
			pt_xz_x.erase(pt_xz_x.begin());
		}
		
		best = max(best, cur);
	}
	
	ans += best;
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code
int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	for (int i = 1; i < 10; i++) {
		for (int j = 1; j < 10; j++) {
			if (n == i*j) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}



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

#define MAX 100000

struct Node{
  int key;
  struct Node *pa,*le,*ri;
};

struct Node *ro,*NIL;

void insert(int);
void pre(struct Node *);
void ino(struct Node *);

int main(){
  int num,buf;
  int i;
  char word[10];
  
  scanf("%d",&num);
  
  for(i=0;i<num;i++){
    scanf("%s",word);
    scanf("%d",&buf);
    if(word[0]=='i'){
      insert(buf);
    }else if(word[0]=='p'){
      ino(ro);
      printf("\n");
      pre(ro);
      printf("\n");
    }
  }
  
  return 0;
}

void insert(int buf){
  struct Node *x,*y,*z;
  y=NIL;
  x=ro;

  z=(struct Node *)malloc(sizeof(struct Node));
  z->key=buf;
  z->le=NIL;
  z->ri=NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key < x->key) x=x->le;
    else x=x->ri;
  }
  z->pa=y;
  if(y==NIL) ro=z;
  else if(z->key < y->key)y->le=z;
  else y->ri=z;
}

void pre(struct Node *ro){
  if(ro==NIL) return;
  printf(" %d",ro->key);
  pre(ro->le);
  pre(ro->ri);
}

void ino(struct Node *ro){
  if(ro==NIL) return;
  ino(ro->le);
  printf(" %d",ro->key);
  ino(ro->ri);
}



Measured memory_bytes: 25140
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt(),sum=0;
    int[] l=new int[n],r=new int[n],a=new int[n];
    for(int i=0;i<n;i++){
      l[i]=sc.nextInt();
      r[i]=sc.nextInt();
      a[i]=r[i]-l[i]+1;
      sum+=a[i];
    }
    System.out.println(sum);
  }
}


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

def gcd(x,y):
    a = max(x,y)
    b = min(x,y)
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b
def multiple_num(x, start, end):
    """
        Return the number of multiples of x in a range
        from start to end (includes end).
    """
    if start % x == 0:
        l = start # minimum multiple above start
    else:
        l = start + (x - (start % x))
    if end % x == 0:
        r = end # maximum multiple below end
    else:
        r = end - (end % x)
    if l > r:
        return 0
    else:
        return (r-l) // x + 1

x = multiple_num(c, a, b)
y = multiple_num(d, a, b)
z = multiple_num(c*d//gcd(c,d), a, b)
ans = b-a+1-x-y+z
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <map>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,x;
    cin >> a >> b >> x;
    if(a<=x && a+b>=x){
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+9;
vector<int>g[N];
int n,m,ans,vis[N];

void dfs(int n){ 
    vis[n]=1;
    for(int i=0;i<g[n].size();i++){ 
        if(vis[g[n][i]]==0)dfs(g[n][i]);
    } 
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif
    cin>>n>>m;
    for(int x,y,i=0;i<m;i++){ 
        cin>>x>>y;
        g[x].push_back(y);
        g[y].push_back(x);
    } 
    for(int i=1;i<=n;i++){ 
        if(vis[i]==0){ 
            ans++;
            dfs(i);
        } 
    }
    cout<<ans-1<<endl; 

    return 0;
}


Measured memory_bytes: 9948
#include <iostream>
#include <string>
using namespace std;
#define v int 
int main () {
    v c = 0;
    string s, t;
    cin >> s >> t;
    for (v i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            c++;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 3852
#include<iostream>
using namespace std;
int main(){
  int h1,h2,k1,k2,a,b,c,d;
  cin>>h1>>h2;
  cin>>k1>>k2;
  cin>>a>>b>>c>>d;
  if(h1*a+h2*b+h1/10*c+h2/20*d<k1*a+k2*b+k1/10*c+k2/20*d){
    cout<<"kenjiro"<<endl;
  }
  if(h1*a+h2*b+h1/10*c+h2/20*d>k1*a+k2*b+k1/10*c+k2/20*d){
    cout<<"hiroshi"<<endl;
  }
  if(h1*a+h2*b+h1/10*c+h2/20*d==k1*a+k2*b+k1/10*c+k2/20*d){
    cout<<"even"<<endl;
  }
}



Measured memory_bytes: 3112
A, B, C, X, Y = map(int, input().split())
cost = 0
if (A + B) > 2 * C:
    cost += C * min(X, Y) * 2
    if X > Y:
        if A > 2 * C:
            cost += C * (X - Y) * 2
        else:
            cost += A * (X - Y)
    else:
        if B > 2 * C:
            cost += C * (Y - X) * 2
        else:
            cost += B * (Y - X)
else:
    cost += A * X + B * Y
print(cost)

Measured memory_bytes: 3064
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def prime_factorize(n):
        a = []
        while n % 2 == 0:
            a.append(2)
            n //= 2
        f = 3
        while f * f <= n:
            if n % f == 0:
                a.append(f)
                n //= f
            else:
                f += 2
        if n != 1:
            a.append(n)
        return a

    n = ni()
    a = prime_factorize(n)

    c = collections.Counter(a)

    ans = 0
    for v in c.values():
        cnt = 1
        while True:
            v -= cnt
            cnt += 1
            if v >= 0:
                ans += 1
            else:
                break

    print(ans)


if __name__ == '__main__':
    main()


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


int main(){
  int x;
  cin >> x;
  if (x<30){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
  return 0;
  
  
}

Measured memory_bytes: 3588
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#include <bits/stdc++.h>
#define pb(X) push_back(X)
#define x first
#define y second
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
using namespace std;

typedef pair<int, int> pii;

int n, a, b, c, d, q, ans;

int main() {
	INIT
	int x, y, z, k;
	vector<long long > A, B, C, D;
	cin >> x >> y >> z >> k;
	A.resize(x);
	B.resize(y);
	C.resize(z);
	for (int i = 0; i < x; ++i) cin >> A[i];
	for (int i = 0; i < y; ++i) cin >> B[i];
	for (int i = 0; i < z; ++i) cin >> C[i];
	sort(A.begin(), A.end(), greater<long long>());
	sort(B.begin(), B.end(), greater<long long>());
	sort(C.begin(), C.end(), greater<long long>());
	for (int i = 0; i < x ; ++i) {
		for (int j = 0; j < y; ++j) {
			for (int u = 0; u < z; ++u) {
				if ((i + 1) * (j + 1) * (u + 1) <= k) {
					long long t = A[i] + B[j] + C[u];
					D.pb(t);
				} else {
					break;
				}
			}
		}
	}
	sort(D.begin(), D.end(), greater<long long>());
	//for (int i = 0; i < D.size() ; ++i) cout << D[i] << ' ';
	//cout << D.size() - k << endl;
	for (int i = 0; i < k; ++i) {
		cout << D[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1404
N,A,B,C=map(int,input().split())

if A+B+C==0:
  print("No")
elif A+B+C==1:
  ans_list=[]
  for _ in range(N):
    com=input()
    if com=="AB":
      if A==1:
        A-=1
        B+=1
        ans_list.append("B")
      elif B==1:
        A+=1
        B-=1
        ans_list.append("A")
      else:
        print("No")
        break
    elif com=="AC":
      if A==1:
        A-=1
        C+=1
        ans_list.append("C")
      elif C==1:
        A+=1
        C-=1
        ans_list.append("A")
      else:
        print("No")
        break
    elif com=="BC":
      if B==1:
        B-=1
        C+=1
        ans_list.append("C")
      elif C==1:
        B+=1
        C-=1
        ans_list.append("B")
      else:
        print("No")
        break
  else:
    print("Yes")
    for ans in ans_list:
      print(ans)
else:
  com_list=[]
  for i in range(N):
    com_list.append(input())
  
  for i in range(N):
    com=com_list[i]
    if com=="AB":
      if i==0 and A==0 and B==0:
        print("No")
        break
      elif i==0:
        print("Yes")
      
      if i<N-1 and A+B+C==2 and A==1 and B==1 and com!=com_list[i+1]:
        if com_list[i+1]=="AC":
          A+=1
          B-=1
          print("A")
        elif com_list[i+1]=="BC":
          A-=1
          B+=1
          print("B")
      else:
        if A>=B:
          A-=1
          B+=1
          print("B")
        else:
          A+=1
          B-=1
          print("A")
    elif com=="AC":
      if i==0 and A==0 and C==0:
        print("No")
        break
      elif i==0:
        print("Yes")
      
      if i<N-1 and A+B+C==2 and A==1 and C==1 and com!=com_list[i+1]:
        if com_list[i+1]=="AB":
          A+=1
          C-=1
          print("A")
        elif com_list[i+1]=="BC":
          A-=1
          C+=1
          print("C")
      else:
        if A>=C:
          A-=1
          C+=1
          print("C")
        else:
          A+=1
          C-=1
          print("A")
    elif com=="BC":
      if i==0 and B==0 and C==0:
        print("No")
        break
      elif i==0:
        print("Yes")
      
      if i<N-1 and A+B+C==2 and B==1 and C==1 and com!=com_list[i+1]:
        if com_list[i+1]=="AB":
          B+=1
          C-=1
          print("B")
        elif com_list[i+1]=="AC":
          B-=1
          C+=1
          print("C")
      else:
        if B>=C:
          B-=1
          C+=1
          print("C")
        else:
          B+=1
          C-=1
          print("B")

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

#define mem( arr, i ) fill( arr, arr + sizeof (arr), i )
#define MEM( arr, i ) memset( arr, i, sizeof (arr) )
#define Push push_back
#define Pair make_pair
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
const lli mod = 1000000007;


void precal() {

	return;
}

bool solve() {
	lli n = 1;
	int _max = 0;
	string s;
	if ( cin >> n );
	else return false;
	
	vPL num(n);
	
	for (int i = 0; i < n; ++i) {
		cin >> num[i].first >> num[i].second;
	}
	
	sort( num.begin(), num.end() );
	
	map<pll,int> disc;
	
	for (int i = 0; i < n; ++i) {
		for (int j = i+1; j < n; ++j) {
			pll tmp = Pair( num[j].first-num[i].first, num[j].second-num[i].second );
			disc[tmp]++ ;
			_max = max( _max, disc[tmp] );
		}
	}
	
	cout << n-_max << '\n';
	
	return true;
}

int main() {
	precal();
	int t = INT_MAX;
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		if ( !solve() ) break;
	}
	return 0;
}


Measured memory_bytes: 384
n = list(input())

if n[0] == "1":
    n[0] = "9"
else:
    n[0] = "1"
if n[1] == "1":
    n[1] = "9"
else:
    n[1] = "1"
if n[2] == "1":
    n[2] = "9"
else:
    n[2] = "1"
print("".join(n))

Measured memory_bytes: 3060
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n, m = map(int, input().split())
if n <= 1:
    comb_e = 0
else:
    comb_e = comb(n, 2)
if m <= 1:
    comb_o = 0
else:
    comb_o = comb(m, 2)
ans = comb_e + comb_o
print(ans)


Measured memory_bytes: 3060
import scala.io.StdIn

object Main{
  def main(args: Array[String]){
    val list = StdIn.readLine.split(" ").toList.map(_.toInt)

    printf("%d %d %10.8f\n", list(0) / list(1), list(0) % list(1), list(0).toDouble / list(1).toDouble)
  }
}

Measured memory_bytes: 43972
//典型的な前処理O(N * 2^N) + O(M * 3^N)のDPで、最小包含円を求めるのが本質。O(N^3)かけても間に合うのが
//優しいけど、ちょっとライブラリを探してきた。
#include <iostream>
#include <vector>
#include <complex>
#include <cassert>
#include <random>
#include <algorithm>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

void chmin(double &a, double b) { a = min(a, b); }

//BEGIN: https://tubo28.me/algorithm/minball/
using ld = double;
using P = complex<ld>;
double eps = 1e-12;
double cross(P a, P b) { return a.real() * b.imag() - a.imag() * b.real(); }

template <class iter>
std::pair<P, ld> min_ball(iter left, iter right, int seed = 1333) {
    const int n = right - left;

    assert(n >= 1);
    if (n == 1) {
        return {*left, ld(0)};
    }

    std::mt19937 mt(seed);
    std::shuffle(left, right, mt);
    // std::random_shuffle(left, right); // simple but deprecated

    iter ps = left;
    using circle = std::pair<P, ld>;

    auto make_circle_3 = [](const P &a, const P &b, const P &c) -> circle {
        ld A = std::norm(b - c), B = std::norm(c - a), C = std::norm(a - b),
           S = cross(b - a, c - a);
        P p = (A * (B + C - A) * a + B * (C + A - B) * b + C * (A + B - C) * c) / (4 * S * S);
        ld r2 = std::norm(p - a);
        return {p, r2};
    };

    auto make_circle_2 = [](const P &a, const P &b) -> circle {
        P c = (a + b) / (ld)2;
        ld r2 = std::norm(a - c);
        return {c, r2};
    };

    auto in_circle = [](const P &a, const circle &c) -> bool {
        return std::norm(a - c.first) <= c.second + eps;
    };

    circle c = make_circle_2(ps[0], ps[1]);

    // MiniDisc
    for (int i = 2; i < n; ++i) {
        if (!in_circle(ps[i], c)) {
            // MiniDiscWithPoint
            c = make_circle_2(ps[0], ps[i]);
            for (int j = 1; j < i; ++j) {
                if (!in_circle(ps[j], c)) {
                    // MiniDiscWith2Points
                    c = make_circle_2(ps[i], ps[j]);
                    for (int k = 0; k < j; ++k) {
                        if (!in_circle(ps[k], c)) {
                            c = make_circle_3(ps[i], ps[j], ps[k]);
                        }
                    }
                }
            }
        }
    }
    return c;
}
//END

int n, m;
P p[14];
double radius[1 << 14];
double dp[15][1 << 14];

int main() {
	int i, j, k;
	
	cin >> n >> m;
	rep(i, n) {
		double x, y; cin >> x >> y;
		p[i] = P(x, y);
	}
	
	rep(i, (1 << n)) {
		if (i == 0) continue;
		vector<P> ps;
		rep(j, n) {
			if ((i >> j) % 2 == 1) {
				ps.push_back(p[j]);
			}
		}
		radius[i] = min_ball(ps.begin(), ps.end()).second;
		radius[i] = sqrt(radius[i]);
	}

	double INF = 1e+9;
	rep(i, n + 1) rep(j, (1 << n)) dp[i][j] = INF;
	
	dp[0][0] = 0;
	rep(i, m) {
		rep(j, (1 << n)) {
			//参考：https://kimiyuki.net/blog/2017/07/16/enumerate-sets-with-bit-manipulation/
			int z = (1 << n) - 1 - j;
			for (int y = 0; ; y = (y - z) & z) {
				chmin(dp[i + 1][j + y], max(dp[i][j], radius[y]));
				if (y == z) break;
			}
		}
	}
	
	double ans = INF;
	rep(i, m + 1) {
		chmin(ans, dp[i][(1 << n) - 1]);
	}
	printf("%.14f\n", ans);
	return 0;
}


Measured memory_bytes: 5284
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

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

const ll INF = 1e30;
const ll MOD = 1e9 + 7;

int main(){
	ll N, M;
	cin >> N >> M;
	cout << (1900 * M + 100 * (N - M))*pow(2, M) << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main()
{
  string S;
  cin >> S;
  int x,y;
  cin >> x >> y;
  int cnt = 0;
  int flag = 0;
  deque<int> X;
  vector<int> Y;
  REP(i,sz(S)){
    if(S[i]=='F'){
      cnt++;
    }else{
      if(flag==0){
        X.push_back(cnt);
        cnt=0;
        flag=1;
      }else{
        Y.push_back(cnt);
        cnt=0;
        flag=0;
      }
    }
  }
  if(flag==0){
    X.push_back(cnt);
  }else{
    Y.push_back(cnt);
  }
  x-=X[0];
  X.pop_front();
  sort(ALL(X));
  sort(ALL(Y));
  reverse(ALL(X));
  reverse(ALL(Y));
  int sumx=0;
  REP(i,sz(X)){
    if(sumx<x){
      sumx+=X[i];
    }else{
      sumx-=X[i];
    }
  }
  int sumy=0;
  REP(i,sz(Y)){
    if(sumy<y){
      sumy+=Y[i];
    }else{
      sumy-=Y[i];
    }
  }
  if(sumx==x&&sumy==y){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3684
# -*- coding: utf-8 -*-
s = input()
len_s = len(s)
k = int(input())
substring_list = []
sappend = substring_list.append
for i in range(len_s):
    for j in range(5):
        sappend(s[i:min(i+1+j,len_s)])
substring_set = set(substring_list)
print(sorted(substring_set)[k-1])


Measured memory_bytes: 5052