akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

	int D, G; cin >> D >> G;
	vector<int> p(D, 0), c(D, 0);
	rep (i, D){
		cin >> p[i] >> c[i];	// p: 100 * (i + 1)点の問題数 c: コンプリートボーナス
	} // end rep

	int res = accumulate(ALL(p), 0);

	rep (i, 1<<D){
		int currS = 0; // 現在の得点
		int currN = 0; // 現在の解いた問題数

		for (int j = D - 1; j >= 0; --j){
			if (i & (1<<j)){	// 全完した問題群
				currS += 100 * (j + 1) * p[j] + c[j];
				currN += p[j];
				if (currS >= G){
					res = min(res, currN);
				} // end if
			}else{ // 全完しなかった問題群
				for (int k = 0; k <= p[j] - 1; ++k){
					int cS = currS + 100 * (j + 1) * k;
					int cN = currN + k;
					if (cS >= G){
						res = min(res, cN);
					} // end if
				} // end for
			} // end if
		} // end for
	} // end rep

	cout << res << endl;		
	
	return 0;
}

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

using namespace std;
using ll = long long;
const int INF = 1000100100;
    int dp[(1 << 16)][16]={};
    int  Graph[16][16];
    int V;

int rec(int selection, int last_node){

    if(selection ==0){
        if(last_node ==0){//始点の0に戻ってくる場合
            return 0;
        }else{
            return INF;//セレクションは0だけど、last_nodeは0以外の値の場合
        }
    }
    else if((selection &(1 << last_node)) == 0){
        return INF;
    }
    int &ret = dp[selection][last_node];
    if(ret!= 0){
        return ret;
    }
        ret = INF;//最小値をとるので、このタイミングでretをINFにする。（最初から全部しても多分いい。
    for (int i=0;i<V;i++){//どのノードを減らした奴からの増分が一番大きいか確認する）
            ret=min(ret,rec(selection ^ (1 << last_node),i)+Graph[i][last_node]);
    }
    return  ret;
}



int main(){
    int E;
    cin >> V >> E;
    for(int i=0;i<V; i++){
        for(int j =0; j <V;j++){
           Graph[i][j] = INF;
        }
    }
    for (int i=0;i < E;i++){
        int tmp1,tmp2,tmp3;
        cin >> tmp1 >> tmp2 >>tmp3;
        Graph[tmp1][tmp2]=tmp3;
    }

    //ここからメモ化再帰
    int ret=INF;
    ret = rec((1 << V)-1, 0);//どの頂点から出発しても、一周回ればおなじこと
    if(ret == INF){
        cout << -1 << endl;
    }
    else{
        cout << ret << endl;
    }
    return 0;
}


Measured memory_bytes: 5116
import java.util.Scanner;

public class Main {

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

		int h = scan.nextInt();
		int w = scan.nextInt();

		int i = 0;
		String[] ary = new String[h];

		for (i = 0; i < h; i++) {
			ary[i] = scan.next();
		}

		//System.out.println(ary[0]);
		//System.out.println(ary[1]);

		int j = 0;
		String k = "";

		for (j = 0; j < h; j++) {
			k=k+""+ary[j]+ary[j];

				System.out.println(ary[j] );
				System.out.println(ary[j]);


		}

	}

}


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

int n;
int s[111111];

int binary_search(int t);

int main(){
  int q;
  int t;
  int ans = 0;
  
  scanf(" %d",&n);
  for(int i=0;i<n;i++){
    scanf(" %d",&s[i]);
  }
  
  scanf(" %d",&q);
  for(int i=0;i<q;i++){
    scanf(" %d",&t);
    ans += binary_search(t);
  }
  
  printf("%d\n",ans);
  
  return 0;
}

int binary_search(int t){
  int dn = 0;
  int up = n;
  int mid;
  
  while(dn + 1 < up){
    mid = (dn + up) / 2;
    if(s[mid] == t)return 1;
    if(t < s[mid]){
      up = mid;
    } else {
      dn = mid;
    }
  }
  
  if(s[dn] == t)return 1;
  
  return 0;
}

Measured memory_bytes: 3540
#!/usr/bin/env python
# coding: utf-8

# In[11]:


N = int(input())
a = list(map(int, input().split()))


# In[12]:


ans = (10**9)*N
x = 0
y = sum(a)
for i in range(N-1):
    x += a[i]
    y -= a[i]
    ans = min(ans,abs(x-y))
    if ans < 2:
        break
print(ans)


# In[ ]:






Measured memory_bytes: 100416
# from pprint import pprint
import math

# import collections

n = int(input())


# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))


def f(a, b):
    return max(math.floor(math.log10(a)) + 1, math.floor(math.log10(b)) + 1)


a = 1
ans = 11
while a <= math.sqrt(n):
    if n % a == 0 and f(a, n // a) <= ans:
        # print('test', a, n // a, f(a, n // a))
        ans = f(a, n // a)
    a += 1

print(ans)


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

const int64_t MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

ll pCount(int x){
  if(x==0) return 1;
  return pCount(x-1)*2 + 1;
}

ll allCount(int x){
  if(x==0) return 1;
  return allCount(x-1)*2 + 3;
}


signed main() {
  int n,m;
  cin >> n >> m;
  
  vector< pair<int,int> > input(m);
  vector< vector<int> > pref(n);

  int p,y;
  for(int i=0;i<m;i++){
    cin >> p >> y;
    p--;
    input[i] = make_pair(p,y);
    pref[p].push_back(y);
  }
  
  for(int i=0;i<n;i++){
    sort(pref[i].begin(),pref[i].end());
  }
  
  for(int i=0;i<m;i++){
    //cout << input[i].first << ":" << input[i].second << endl;
    cout << setw(6) << setfill('0') << input[i].first+1;
    auto iter = find(pref[input[i].first].begin(),
                     pref[input[i].first].end(),
                    input[i].second);
    cout << setw(6) << setfill('0') << iter-pref[input[i].first].begin()+1 << endl;
  }
  
  return 0;
}



Measured memory_bytes: 9480
import sys
sys.setrecursionlimit(200010)

N = int(input())
tree = [[] for _ in range(N + 1)]
for _ in range(N-1):
    a, b = map(int, input().split())
    tree[a].append(b)
    tree[b].append(a)
c = [int(s) for s in input().split()]
c.sort(reverse=True)

anst = [0] * (N + 1)
anss = 0


def visit(a, prev):
    global anst, anss
    ans = 0
    for b in tree[a]:
        if b != prev:
            ci = visit(b, a)
            anss += ci
    ci = c.pop()
    anst[a] = ci
    return ci


visit(1, 1)
print(anss)
print(" ".join((str(i) for i in anst[1:])))


Measured memory_bytes: 54104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
inline int read(){
	int x=0,w=1;
	char ch=0;
	while (ch<'0' || ch>'9'){
		ch=getchar();
		if (ch=='-') w=-1;	
	}
	while (ch<='9' && ch>='0'){
		x=(x<<1)+(x<<3)+ch-'0';
		ch=getchar();
	}
	return x*w;
}
struct edge{
	int next,to;
}a[N<<1];
int head[N],cnt;
inline void add(int u,int v){
	a[++cnt].to=v;
	a[cnt].next=head[u];
	head[u]=cnt;
}
int n,Mod;
int f[N],g[N],ans[N];
void dfs(int x,int fa){
	f[x]=1;
	vector<int>suf,pre;
	pre=vector<int>();
	suf=vector<int>();
	for (int i=head[x];i;i=a[i].next){
		int y=a[i].to;
		if (y==fa) continue;
		dfs(y,x);
		f[x]=1ll*f[x]*(f[y]+1)%Mod;
		suf.push_back(f[y]+1);
		pre.push_back(f[y]+1);
	}
	int now=0,nowf=1;
	for (int i=suf.size()-2;i>=0;--i)
		suf[i]=1ll*suf[i+1]*suf[i]%Mod;
	for (int i=head[x];i;i=a[i].next){
		int y=a[i].to;
		if (y==fa) continue;
		g[y]=nowf;
		if (now!=suf.size()-1) g[y]=1ll*g[y]*suf[now+1]%Mod;
		nowf=1ll*nowf*pre[now]%Mod;
		++now;
	}
}
void dp(int x,int fa,int s){
	int k=1ll*(s+1)*g[x]%Mod;
	ans[x]=1ll*(k+1)*f[x]%Mod;
	for (int i=head[x];i;i=a[i].next){
		int y=a[i].to;
		if (y==fa) continue;
		dp(y,x,k);
	}
}
int main(){
	n=read();Mod=read();
	for (int i=1;i<n;++i){
		int u=read(),v=read();
		add(u,v),add(v,u);
	}
	dfs(1,0);
	ans[1]=f[1];
	for (int i=head[1];i;i=a[i].next)
		dp(a[i].to,1,0);
	for (int i=1;i<=n;++i)
		printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 13568
#

import sys
from copy import deepcopy
input=sys.stdin.readline

def main():
    ab="abcdefghijklmnopqrstuvwxyz"
    w=input()
    b=1
    for a in ab:
        c=w.count(a)
        if c%2!=0:
            b=0
            break
    if b==1:
        print("Yes")
    else:
        print("No")
    
if __name__=="__main__":
    main()


Measured memory_bytes: 3444
import java.util.*;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);

	void run(){

		char in[][] = new char[8][8];

		for(int i= 0;i < 8;i++){

			in[i] = sc.next().toCharArray();

		}

		System.out.println(90);

		for(int i =0 ; i < 8 ; i ++){

			for(int j=0;j < 8 ; j++){

				System.out.print(in[7-j][i]);

			}

			System.out.println();

		}

		System.out.println(180);

		for(int i =0 ; i < 8 ; i ++){

			for(int j=0;j < 8 ; j++){

				System.out.print(in[7-i][7-j]);

			}

			System.out.println();

		}

		System.out.println(270);

		for(int i =0 ; i < 8 ; i ++){

			for(int j=0;j < 8 ; j++){

				System.out.print(in[j][7-i]);

			}

			System.out.println();

		}

	}

	public static void main(String[] args){

		Main m = new Main();

		m.run();

	}

}

Measured memory_bytes: 12000
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    char s[210];
    while(cin>>s)
    {
        int len=strlen(s);
        len--;
        if(len%2!=0)
        {
            len--;
        }
        int i,j,k;
        for(i=len/2;i!=0;len=len-2,i=len/2)
        {
            for(j=0,k=i;k<len;j++,k++)
            {
                if(s[j]!=s[k])
                break;
            }
            if(k==len)
            {
                break;
            }
        }
        if(i==0)
        {
            printf("0\n");
        }
        else
        {
             printf("%d\n",len);
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

int main() {
    int x1,x2,x3,x4,x5;
    cin >> x1 >> x2 >> x3 >> x4 >> x5;
    if(x1 == 0) cout << 1 << endl;
    else if(x2 == 0) cout << 2 << endl;
    else if(x3 == 0) cout << 3 << endl;
    else if(x4 == 0) cout << 4 << endl;
    else cout << 5 << endl;
}

Measured memory_bytes: 3592
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=abs(a[0])*2+abs(a[-1])*2#とりあえず最大
for i in range(n-k+1):
  x,y=a[i],a[i+k-1]
  if x*y<0:m=min(abs(x),y)*2+max(abs(x),y)
  else:m=max(abs(x),abs(y))
  ans=min(ans,m)
print(ans)

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

#define INF (int)1e9+7

using ll = long long;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<P> vpi;
typedef pair<ll,ll> Pl;
typedef vector<ll> vl;
typedef vector<Pl> vpl;

ll gcd(ll a, ll b){
    if(a < b) swap(a, b);
    if(b <= 0) return -1;
    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll a, ll b){
    return (a/gcd(a,b)*b);
}

int main() {
    ll A, B;
    cin >> A >> B;

    ll ABgcd = gcd(A, B);
    ll ans = 1;
    for (ll i = 2; i*i <= ABgcd; i++) {
        if(ABgcd%i == 0) {
            while(ABgcd%i == 0) {
                ABgcd /= i;
            }
            ans++;
        }
    }
    //最後に残る値は1か素因数
    if(ABgcd > 1) ans++;

    //string ans = ( flag ? "Yes" : "No" );
    //printf("%.8lf\n", ans);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	string a;
	cin>>a;
	for(register int i=0;i<a.size();i++)
		if(a[i]!=',') cout<<a[i];
		else cout<<' ';
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [[float('inf')]*(N+1)] + [[float('inf')]+list(map(int,input().split())) for _ in range(N)]
test = [[float('inf')]*(N+1) for _ in range(N+1)]
def main():
    for i in range(1,N+1):
        for j in range(1,N+1):
            for k in range(1,N+1):
                test[i][j] = min(test[i][j],A[i][j],A[i][k] + A[k][j])
    ans = 0
    if test == A:
        for i in range(1,N+1):
            for j in range(i+1,N+1):
                flag = True
                for k in range(1,N+1):
                    if A[i][j] == A[i][k] + A[j][k] and k != i and k != j:
                        flag = False
                        break
                if flag:
                    ans += A[i][j]    
        print(ans)                
    else:
        print(-1)
main()

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    long long MOD = 1e9 + 7;
    vector<long long> pw2(2*n+1, 1);
    for (int i = 1; i < pw2.size(); i++) {
        pw2[i] = (pw2[i-1] * 2) % MOD;
    }
    long long cur = 0;
    for (int i = n-1; i >= 0; i--) {
        int k = n-1-i;
        cur = (a[i]*(2*(k == 0 ? 1ll : pw2[k-1+k]*(k+2)) % MOD)%MOD + 4*cur)%MOD;
    }
    cout << cur << endl;
}



Measured memory_bytes: 7960
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 40010
#define M 110
#define Inf 2147483647
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
struct note{
	int to,next,flow;
};note edge[N*10];
int i,j,n,m,ans,x,S,T,la;
int sx,sy,tx,ty;
int tot,head[N];
int height[N],qu[N*20];
int map[M][M],p0[M][M],p1[M][M],a[M],b[M];
char ch;
void lb(int x,int y,int z){
	edge[++tot].to=y;edge[tot].next=head[x];edge[tot].flow=z;head[x]=tot;
	edge[++tot].to=x;edge[tot].next=head[y];edge[tot].flow=0;head[y]=tot;
}
bool BFS(){
	int i,x,l=0,r=1;
	memset(height,-1,sizeof(height));
	height[S]=0;
	qu[1]=S;
	while(l<r){
		x=qu[++l];
		for(i=head[x];i;i=edge[i].next)
		    if(edge[i].flow>0&&height[edge[i].to]==-1){
		    	height[edge[i].to]=height[x]+1;
		    	qu[++r]=edge[i].to;
			}
	}
	return ~height[T]?1:0;
}
int Min(int x,int y){return x<y?x:y;}
int find(int u,int thin){
	if(u==T)return thin;
	int i,a,sum=0;
	for(i=head[u];i;i=edge[i].next)
	    if(edge[i].flow>0&&height[edge[i].to]==height[u]+1){
	    	a=find(edge[i].to,Min(thin,edge[i].flow));
	    	if(a>0){
	    		thin-=a;
	    		sum+=a;
	    		edge[i].flow-=a;
	    		edge[i^1].flow+=a;
	    		if(!thin)return sum;
			}
		}
	if(!sum)height[u]=-1;
	return sum;
}
void Dinic(){
	while(BFS())ans+=find(S,Inf);
}
int main(){
    scanf("%d%d\n",&n,&m);
    tot=1;
    fo(i,1,n){
    	fo(j,1,m){
    		ch=getchar();
    		if(ch=='o'){
    			p0[i][j]=++x;
    		    p1[i][j]=++x;
    		    map[i][j]=1;
			}
    		if(ch=='S')sx=i,sy=j;
    		if(ch=='T')tx=i,ty=j;
		}
    	ch=getchar();
	}
	if(sx==tx||sy==ty){printf("-1");return 0;}
	fo(i,1,n)a[i]=++x;fo(i,1,m)b[i]=++x;
	S=0,T=x+1;
	lb(S,a[sx],Inf);lb(S,b[sy],Inf);
	lb(a[tx],T,Inf);lb(b[ty],T,Inf);
	fo(i,1,n)fo(j,1,m)
		if(map[i][j]){
			lb(a[i],p0[i][j],Inf);
			lb(b[j],p0[i][j],Inf);
			lb(p1[i][j],a[i],Inf);
			lb(p1[i][j],b[j],Inf);
			lb(p0[i][j],p1[i][j],1);
		}
	Dinic();
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 4608
import java.util.*;
 
public class Main {
    public static void main(String args[]) {
        
       Scanner sc = new Scanner(System.in);
       long num = sc.nextLong();
       
       double root =Math.sqrt(num);
       long a=1;
       long b=1;
       long answer =0;
       
       for (a=1;a<=root;++a) {
            if (num % a == 0) { 
                b = num/a;
                if(a + b -2<answer||answer ==0){
                    answer = a+b-2;
                    
                }
                
            }
        }
        
        System.out.println(answer);
        
        
       
       }
    
}

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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var hs = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

        hs = hs.Concat(new [] { 0 }).ToArray();

        var k = 0;
        var max = hs.Max();
        while (max > 0)
        {
            max = 0;
            int l = 0;
            var min = int.MaxValue;
            for (int i = 0; i < hs.Length; i++)
            {
                if (hs[i] > 0)
                {
                    min = Math.Min(min, hs[i]);
                    continue;
                }

                if (l == i)
                {
                    l++;
                    continue;
                }
                
                k += min;
                for (int j = l; j <= i; j++)
                {
                    hs[j] -= min;
                    max = Math.Max(max, hs[j]);
                }
                l = i + 1;
                min = int.MaxValue;
            }
        }

        Console.WriteLine(k);
    }
}


Measured memory_bytes: 13396
object Main{
  def main(args: Array[String]){
      val sc = new java.util.Scanner(System.in)
      val d = sc.nextInt
      val a = sc.nextInt
      val b = sc.nextInt

      if ( b <= a ) println("delicious")
      else if ( b <= a + d ) println("safe")
      else if ( b > a + d) println("dangerous")
  }
}

Measured memory_bytes: 25416
#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    string a;
    cin >> a;
    int n = a.size();
    int odp = 0;
    for (int l = 0, p = n - 1; l < p; ++l, --p)
        if (a[l] != a[p])
            ++odp;
    cout << odp;
    return 0;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n,k,m;
    cin >> n >> k >> m;
    if(n==0) break;
    list<int> a;
    for(int i=1;i<=n;i++){
      if(i!=m) a.push_back(i);
    }
    auto itr=a.begin(),itr2=a.begin();
    for(int i=0;i<m-1;i++){
      itr++;
      if(itr==a.end()) itr=a.begin();
    }
    for(int i=0;i<n-2;i++){
      for(int j=0;j<(k-1)%(n-i-1);j++){
        // cout << *itr << endl;
        itr++;
        if(itr==a.end()) itr=a.begin();
      }
      itr2=itr;
      // cout << "!" SP *itr << endl;
      itr++;
      if(itr==a.end()) itr=a.begin();
      a.erase(itr2);
    }
    cout << a.front() << endl;
  }
  return 0;
}



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

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
    long long N;
    cin >> N;
    const auto &res = prime_factorize(N);
    int ans = 0, k;
    for (auto p : res) {
        k = 1;
        while(p.second >= k)
        {
            ++ans;
            p.second -= k;
            ++k;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

struct UnionFind{
	vector<int> par;
	UnionFind(int N):par(N){
		for(int i=0; i<N; i++)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){
		return root(x)==root(y);
	}
};
int main(void){
	int n,m; cin >> n >> m;
	int a[55],b[55],ans=0,conect;
	for(int i=1; i<=m; i++){
		cin >> a[i] >> b[i];
	}
	for(int i=1; i<=m; i++){
		UnionFind tree(n+1);
		for(int j=1; j<=m; j++){
			if(j==i)continue;
			tree.unite(a[j],b[j]);
		}
		conect=1;
		for(int j=1; j<=n; j++){
			if(!tree.same(1,j))conect=0;
		}
		if(!conect)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9+7;
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};

void solve() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int count=0;
	for(int i=0;i<n-2;i++) {
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') {
			count++;
		}
	}
	cout << count <<endl;
}

signed main() {
	boost;
	solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

ll mod = 1000000007;
ll modsize = 10000;

ll modinv(ll a) {
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a%mod;
		a = a * a%mod;
		b >>= 1;
	}
	return ans;
}

vector<ll> fac(modsize + 5);
vector<ll> inv(modsize + 5);
vector<ll> facinv(modsize + 5);

void modcalc() {
	fac[0] = fac[1] = 1; inv[1] = 1;
	facinv[0] = facinv[1] = 1;
	for (int i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0) return 0;
	if (n == 0 && k == 0) return 1;
	return modcomb(n + k - 1, k);
}

int dp[4020][4020];

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();

	int n;
	cin >> n;
	vector<int> a(n), b(n);
	rep(i, n) {
		cin >> a[i] >> b[i];
		dp[2002 - a[i]][2002 - b[i]]++;
	}
	rep(i, 4010) {
		rep(j, 4010) {
			dp[i + 1][j + 1] += dp[i + 1][j];
			dp[i + 1][j + 1] += dp[i][j + 1];
			dp[i + 1][j + 1] %= mod;
		}
	}
	int ans = 0;
	rep(i, n) {
		ans += dp[2002 + a[i]][2002 + b[i]];
		ans -= modcomb(2 * (a[i] + b[i]), 2 * a[i]);
		ans += mod;
	}
	cout << ans % mod * inv[2] % mod << endl;
}

Measured memory_bytes: 129664
import numpy as np
N=int(input())
X=np.array(list(map(int,input().split())))
ans=sum(X**2)
for i in range(min(X)-1,max(X)+1):
    Z=sum(X**2)-sum(2*X*i)+N*i**2
    ans=min(Z,ans)
print(ans)

Measured memory_bytes: 13208
import java.io.*;
import java.util.*;

public class Main {
    Scanner sc;
    Main() {
        sc = new Scanner(System.in);
    }
    public static void main(String[] args) {
        new Main().run();
    }
    void debug(Object ... o) {
        System.out.println(Arrays.deepToString(o));
    }
    int N;
    char [] message;
    int [] a, b;
    boolean init() {
        N = sc.nextInt();
        if (N == 0) return false;
        a = new int[N];
        b = new int[N];
        message = sc.next().toCharArray();
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt()-1;
            b[i] = sc.nextInt()-1;
        }
        return true;
    }
    int rotate(char c, int d) {
        return ((c - 'a') + d) % 26 + 'a';
    }
    void decipher(int ai, int bi) {
        int d = Math.abs(ai - bi);
        message[ai] = (char)rotate(message[ai], d);
        message[bi] = (char)rotate(message[bi], d);
        char p = message[ai];
        char q = message[bi];
        message[ai] = q;
        message[bi] = p;
    }
    void run() {
        while (init()) {
            for (int i = a.length-1; i >= 0; i--) {
                decipher(a[i], b[i]);
            }
            System.out.println(message);
        }
    }
}

Measured memory_bytes: 12000
#include<stdio.h>
int main(void)
{
	int a,b,i,j,k;
	for(k=0;k<300;k++){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0){
			break;
		}else{
			for(i=0;i<a;i++){
				for(j=0;j<b;j++){
					printf("#");
				}
				printf("\n");
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2588
#include <stdio.h>

int main() {
	int a, b, k;
	scanf("%d %d %d", &a, &b, &k);
	for (int i = 100; i > 0; i--) {
		if ((a % i == 0) && (b % i == 0))
			k--;
		if (k < 1) {
			printf("%d\n", i);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(int i=0;i<(n);++i)
#define iter(it,v) for(auto it=v.begin();it!=v.end();++it)
#define in(v) cin>>v;
#define out(v) cout<<v<<"\n"
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int K, T;
  in(K); in(T);

  int max_a = 0;
  rep(i, T) {
    int a; in(a);
    chmax(max_a, a);
  }
  out(max(max_a - 1 - (K - max_a), 0));

  return 0;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll nCm(ll n, ll m){
    if(m == 0 || m == n){
        return 1;
    } else if(m == 1){
        return n;
    }
    return (nCm(n - 1, m) + nCm(n - 1, m - 1));
}

//-----------------------ここから-----------

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

    string ans = "ABC" + to_string(n);
    cout << ans << endl;
}

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

int swap(char [],char [],int);
int move(int,int,char []);
void unit(int,char [],char [],int);

int main(void){

	int shuffle,i,j,len,time,k,count,loop;
	char card[200],temp[200],temp2[1];

	for(loop=0;loop>-1;loop++){
		scanf("%s",card);
		if(card[0]=='-')
			break;
		scanf("%d",&time);
		for(k=0;k<time;k++){
			scanf("%d",&shuffle);
			count=swap(temp,card,shuffle);
			len=strlen(card);
			j=move(len,count,card);
			i=j;
			unit(len,card,temp,i);
		}
		printf("%s\n",card);
	}
	return 0;
}

int swap(char temp[],char card[],int shuffle){

	int i;
	for(i=0;i<shuffle;i++)
		temp[i]=card[i];
	temp[i]='\0';
	return i;
}

int move(int len,int count,char card[]){
	int i,j;
	char temp[1];
	
	j=0;
	for(i=count;i<len;i++){//後ろを前に持ってくる//
		temp[0]=card[i];
		card[j]=temp[0];
		j++;
	}
	return j;
}

void unit(int len,char card[],char temp[],int i){

	int j;
	for(j=0;i<len;i++){
		card[i]=temp[j];
		j++;
	}
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
#define LL                  long long
#define ull                 unsigned long long LL
#define scl(n)              scanf("%lld", &n)
#define scf(n)              scanf("%lf", &n)
#define sci(n)              scanf("%d", &n)
#define scii(n,m)           scanf("%d %d",&n,&m)
#define sciii(n,m,p)        scanf("%d %d %d",&n,&m,&p)

#define MOD                 1000000007
#define MODP                99999999999973LL
#define pb                  push_back
#define mp                  make_pair
#define pp                  pair<LL,LL>
#define memo(a,b)           memset(a,b,sizeof(a))
#define INF                 1e9
#define EPS                 1e-8
#define Pi                  acos(-1.0)
LL bigmod(LL b, LL p, LL md){if(p==0) return 1;if(p%2==1){ return ((b%md)*bigmod(b,p-1,md))%md;} else {LL y=bigmod(b,p/2,md);return (y*y)%md;}}
#define N 300002

LL dp[N];

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

    LL arr[n+1];

    for(int i=1;i<=n;i++)
        cin>>arr[i],dp[i]=1000000000000000000;


    dp[1]=0;
    dp[0]=0;
    arr[0]=arr[1];


    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=min(i+k,n);j++)
        {
            dp[j]=min(dp[j],dp[i]+abs(arr[j]-arr[i])  );
        }


    }
    cout<<dp[n]<<endl;




    return 0;
}



/* LL dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; */ // 4 Direction
/* LL dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; */ // 8 Direction
/* LL dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* LL dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Directio


Measured memory_bytes: 1792
#include <stdio.h>
int n, k, p[1001], count, min = 1001, ans = 0;
int main()
{
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &p[i]);
    }
    for (int i = 0; i < k; i++)
    {

        for (int j = 0; j < n; j++)
        {
            if (p[j] < min)
            {
                min = p[j];
                count = j;
            }
        }
        ans = ans + min;
        min = 1001;
        p[count] = 9999;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1708
#include <iostream>

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll a , b , c, d;
    ll tk , ao;
    cin >> a >>b>>c>>d;
    tk = c/b ;
    if(c%b!=0)
    {
        tk++;
    }
    ao = a/d;
    if(a%d!=0)
    {
        ao++;
    }
    if(tk<=ao)
    {
        cout << "Yes";
        return 0;
    }
    cout << "No";
    return 0;
}


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

typedef long long ll;

// Output
template<class T, class S> std::ostream& operator <<(std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  //os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << " " << v[i]; }
  return os;
}

template<class T, class S> std::ostream& operator <<(std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< std::vector<T> > vv)
{
  for (auto& vec : vv){ os << vec << std::endl; }
  os << "--------" << std::endl;
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H&& head){ std::cout << head << std::endl; }
template<typename H, typename... T> void print(H&& head, T&&... tail){
  std::cout << head << " ", print(std::forward<T>(tail)...);
}

ll H, W, A, B;

ll pos2idx(ll y, ll x) { return y * W + x; }
ll idx2y(ll idx) { return idx / W; }
ll idx2x(ll idx) { return idx % W; }

bool is_ok(std::vector<std::string>& grid)
{
  ll cnt = 0;
  for (ll y = 0; y < H; y++) {
    cnt = 0;
    for (ll x = 0; x < W; x++) {
      if (grid[y][x] == '1') cnt++;
    }
    if (std::min(cnt, W-cnt) != A) {
      return false;
    }
  }

  for (ll x = 0; x < W; x++) {
    cnt = 0;
    for (ll y = 0; y < H; y++) {
      if (grid[y][x] == '1') cnt++;
    }
    if (std::min(cnt, H-cnt) != B) {
      return false;
    }
  }

  return true;
}


void jikken()
{
  std::cin >> H >> W >> A >> B;
  ll V = H * W;

  ll ans = 0;
  for (ll bit = 0; bit < (1<<V); bit++) {
    std::vector<std::string> grid(H, std::string(W, '0'));

    for (ll idx = 0; idx < V; idx++) {
      if ((bit>>idx) & 1) grid[idx2y(idx)][idx2x(idx)] = '1';
    }

    if (is_ok(grid)) {
      ans++;
      for (ll y = 0; y < H; y++) print(grid[y]);
      print();
    }
  }

  print(ans);
  return;
}

void solve()
{
  std::cin >> H >> W >> A >> B;

  std::vector<std::string> grid(H, std::string(W, '0'));

  for (ll y = 0; y < B; y++) {
    for (ll x = 0; x < A; x++) {
      grid[y][x] = '1';
    }
  }

  for (ll y = B; y < H; y++) {
    for (ll x = A; x < W; x++) {
      grid[y][x] = '1';
    }
  }

  for (ll y = 0; y < H; y++) print(grid[y]);
}

int main()
{
  // bit 全探索すれば, 小さなグリッドであれば、ある程度実験して予想できた。
  //jikken();
  solve();
  return 0;
}



Measured memory_bytes: 2304
def solve():
    from sys import stdin
    f_i = stdin
    
    n, q = map(int, f_i.readline().split())
    S = [[] for i in range(n)]
    ans = []
    
    for i in range(q):
        query = f_i.readline()
        op = query[0]
        if op == '0':
            t, x = query[2:].split()
            S[int(t)].append(x)
            continue
        s = S[int(query[2:])]
        if s:
            if op == '1':
                ans.append(s[-1])
            else:
                s.pop()
    
    print('\n'.join(ans))

solve()


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a > b) swap(a, b);
  if(b > c) swap(b, c);
  if(a > b) swap(a, b);
  
  cout << c - a << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n;
    cin>>n;
    int f=0;
    while(n)
    {
        if(n%10==7)
        {
            f=1;break;
        }
        n/=10;
    }
    if(f)cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3648
# ABC071b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

alphabet = 'abcdefghijklmnopqrstuvwxyz'

s = input()
for i in s:
    # print(i)
    alphabet = alphabet.replace(i, '')
print(alphabet[0] if len(alphabet) > 0 else 'None')

Measured memory_bytes: 3188
class UnionFind:
    def __init__(self, size):
        self.parent = [-1] * size
        self.rank = [1] * size
        self.groups = size

    def get_root(self, node):
        parent = self.parent[node]
        if parent == -1:
            root = node
        else:
            root = self.get_root(parent)
            self.parent[node] = root  # 同じnodeへの2回目以降のget_rootを高速にするために、直接rootに繋いでおく
        return root

    def in_same_group(self, node1, node2):
        root1 = self.get_root(node1)
        root2 = self.get_root(node2)
        return root1 == root2

    def unite(self, node1, node2):
        if self.in_same_group(node1, node2):
            return
        main_root = self.get_root(node1)
        sub_root = self.get_root(node2)
        if self.rank[main_root] < self.rank[sub_root]:  # rankの大きい方をmain_rootにする
            main_root, sub_root = sub_root, main_root

        self.parent[sub_root] = main_root
        self.rank[main_root] += self.rank[sub_root]
        self.groups -= 1


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

for i in range(m):
    x, y, z = map(int, input().split())
    x -= 1
    y -= 1
    uf.unite(x, y)

print(uf.groups)

Measured memory_bytes: 5936
import java.util.Scanner;
import java.util.Map;
import java.util.TreeMap;

public class Main {
  static final long MOD = 1_000_000_007L;
  static int n;
  static int[] a;

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

    n = sc.nextInt();
    a = new int[n];
    for(int i = 0; i < n; i++){
      a[i] = sc.nextInt();
    }

    Map< Integer, Integer > count = new TreeMap< Integer, Integer >();
    count.put(0, 0);
    for(int i = 0; i < n; i++){
      if(count.containsKey(a[i])){
        count.put(a[i], count.get(a[i]) + 1);
      }
      else{
        count.put(a[i], 1);
      }
    }

    if((n % 2 == 1 && count.get(0) != 1)
      || (n % 2 == 0 && count.get(0) != 0)){
      System.out.println(0);
      return;
    }

    boolean check = true;
    for(int i = 0; i < n; i++){
      if(a[i] != 0 && count.get(a[i]) != 2){
        check = false;
        break;
      }
    }
    if(!check){
      System.out.println(0);
      return;
    }

    long ans = 1;
    for(int i = 0; i < n / 2; i++){
      ans = (ans * 2L) % MOD;
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 34240
#include <algorithm>
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>

using namespace std;



int main(void) {
	string S;
	string T;

	cin >> S;
	cin >> T;

	string tsub = T.substr(0, T.length() - 1);

	if (S != tsub || S.length() != T.length() - 1) {
		cout << "No";
	}
	else {
		cout << "Yes";
	}



	return 0;
}

Measured memory_bytes: 3592
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
#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
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

signed main()
{
  ll n;
  cin >> n;
  vector< ll > a;
  REP(i, n - 1)
  {
    ll ai;
    cin >> ai;
    ll syain_num = ai - 1;
    a.push_back(syain_num);
  }
  vector< ll > memo(n, 0);

  REP(i, n - 1)
  {
    ll num = i + 1;
    memo[a[i]] += 1;
  }

  REP(i, n)
  {
    cout << memo[i] << endl;
  }
}


Measured memory_bytes: 6348
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<int,int> P;
#include <boost/multiprecision/cpp_int.hpp>
 
using bint = boost::multiprecision::cpp_int;

int main(){
    int n,k; cin >> n >> k;
    vector<int> a(n); rep(i,n) cin >> a[i];
    cout << (n-1 + k - 2)/(k-1);
    
}

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

#define INF (INT64_MAX/2)
#define MAX 100000
#define MOD (1000000000+7)

int N, Q;
string S;
int l[MAX];
int r[MAX];

int n[MAX + 1];

int main() {
	cin >> N >> Q >> S;
	for( int i = 0; i < Q; i++ ) {
		cin >> l[i] >> r[i];
	}

	for( int i = 0; i < N; i++ ) {
		if( S[i] == 'A' && S[i + 1] == 'C' ) {
			n[i + 1] = n[i] + 1;
			n[i + 2] = n[i + 1];
			i++;
		}
		else {
			n[i + 1] = n[i];
		}
	}

	for( int i = 0; i < Q; i++ ) {
		cout << n[r[i] - 1] - n[l[i] - 1] << endl;
	}

	return 0;
}


Measured memory_bytes: 2176
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int i = sc.nextInt() % 10;
		if (i == 3) {
			System.out.println("bon");
		} else if (0 == i
				||
				1 == i
				||
				6 == i
				||
				8 == i) {
			System.out.println("pon");
		} else {
			System.out.println("hon");
		}
	}

	static class FastScanner {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

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

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

			return tokenizer.nextToken("\n");
		}

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

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

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

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
	}
}

Measured memory_bytes: 32496
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
U_MAP mp;

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

  cin >> n;
  rep(i, n - 1) {
    cin >> a;
    a--;
    mp[a]++;
  }
  rep(i, n) Cout(mp[i]);
  return 0;
}

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

int main() {
    int A, B;
    cin >> A >> B;

    int add, sub, mul;
    add = A + B;
    sub = A - B;
    mul = A * B;

    int res = max(add, max(sub, mul));
    cout << res << endl;
}

Measured memory_bytes: 256
/*-------enazuma11----------------*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(v) v.begin(),v.end()
#define inc(a,n) sort(a,a+n)
#define dec(a,n) sort(a,a+n,greater<int>() )
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define F first
#define S second
#define M 1000000007
 
/* int x[]={-1,-1,0,1,1,1,0,-1};
int y[]={0,1,1,1,0,-1,-1,-1};
*/
/* int x[]={-1,0,1,0};
int y[]={0,1,0,-1};
*/

const int N=1e5+5;
vector<ll> g[N];
ll vis[N];
ll dp[N];
ll n,m;
void dfs(int i)
{
	vis[i]=1;
	for(auto j:g[i])
	{
		if(!vis[j])
		{
			dfs(j);
		}
		dp[i]=max(dp[i],1+dp[j]);
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		
		cin>>n>>m;
		ll i,j,u,v;
		rep(i,0,m)
		{
			cin>>u>>v;
			g[u].pb(v);
			
		}
		
		rep(i,1,n+1)
		{
			if(!vis[i])
			dfs(i);
		}
		ll ans=0;
		rep(i,1,n+1)
		ans=max(ans,dp[i]);
		cout<<ans<<'\n';
	}
	return 0;
}


Measured memory_bytes: 9344
#include<iostream>
using namespace std;
int a[105];
int main()
{
	int n,m,x=0,i;
	cin>>n>>m;
	int ans=0;
	for(i=1;i<=n;i++){
		if(x<=m) ans++;
		cin>>a[i];
		x+=a[i];
	}
	if(x<=m) ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256