akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include<vector>
#include<iostream>
using namespace std;




int main() {
	
	string s;
	cin >> s;
	int K;
	cin >> K;
	
	unsigned long long int dp1[101][10] = {0};
	unsigned long long int dp2[101][10] = {0};
	
	
	dp1[0][0] = 1;
	int tmp = (s[0] - '0');
	dp1[0][1] = tmp-1;
	
	
	// 未確定
	dp2[0][1] = 1;
	//dp2[0][0] = 1;
	
	
	//dp1[i][k] = dp[i][k-1]*9;
	
	for(int i=0;i<s.size()-1;++i){
		for(int k=0;k<=K;++k){
			//cout <<i << " "<< k <<endl;
			
			dp1[i+1][k+1] += dp1[i][k]*9;
			dp1[i+1][k] += dp1[i][k];
			
			int t = s[i+1] - '0';
			if(t == 0){
				dp2[i+1][k] += dp2[i][k]; // only 0
			}else{
				dp1[i+1][k] += dp2[i][k]; // only 0
				dp1[i+1][k+1] += dp2[i][k]*(t-1); // not 0 and t
				dp2[i+1][k+1] += dp2[i][k]; // only t
			}
		}
	}
	/*
	for(int i=0;i<10;++i){
		cout << dp1[i][0] << " ";
	}cout << endl;
	
	for(int i=0;i<10;++i){
		cout << dp1[i][1] << " ";
	}cout << endl;
	for(int i=0;i<10;++i){
		cout << dp1[i][2] << " ";
	}cout << endl;
	for(int i=0;i<10;++i){
		cout << dp2[i][0] << " ";
	}cout << endl;
	
	for(int i=0;i<10;++i){
		cout << dp2[i][1] << " ";
	}cout << endl;
	for(int i=0;i<10;++i){
		cout << dp2[i][2] << " ";
	}cout << endl;
	*/
	
	
	//cout << dp1[s.size()-1][K] <<" " << dp2[s.size()-1][K] <<endl;
	cout << dp1[s.size()-1][K] + dp2[s.size()-1][K] <<endl;
	
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;

#define huge 1000000007

int main(void) {

	string a, b;
	cin >> a >> b;
	a = a + b;
	int c = stoi(a);

	
	string res = "No";
	for (int i = 0; c >= i*i; i++) {

		if (c == i*i) {
			res = "Yes";
			break;
		}
		//cout << i*i << endl;
	}

	cout << res << endl;
	return 0;


}

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

// 5*300
#define BUF_SIZE 1600

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  static char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
#ifdef BUF_SIZE
    static char line[BUF_SIZE];
    char *tmpbuf = line;
    int i;
    if(!fgets(line, BUF_SIZE, stdin)) return -1;
    for(i = 0; i < size; i++) {
        char *tmp = strtok(tmpbuf, " ");
        arr[i] = strtol(tmp, NULL, 10);
        tmpbuf = NULL;
    }
#else
#error
#endif
    return 0;
}
#define NUM_MAX 300
#define WEIGHT_MAX 1000
#define SET_MAX 50


#define STACK_MAX 20000
#define max(a,b) ((a) > (b) ? (a) : (b))
#define DP_SIZE_MAX (NUM_MAX+1)*(NUM_MAX+1)

int drop_point(int v1, int v2) {
    return (abs(v1-v2)<=1)*2;
}

int main(void) {
    int ans[SET_MAX];
    int idx = 0;
    int i;
    // dp[size][start];
    while(1) {
        int dp[NUM_MAX+1][NUM_MAX+1] = {0};
        int num = get_int();
        if(!num) break;
        int ws[NUM_MAX+1];
        fget_array(ws, num);
        int size, start, end;
        // for size=2
        for(i = 0; i < num-1; i++) {
            dp[2][i] = drop_point(ws[i], ws[i+1]);
        }
        for(size = 3; size <= num; size++) {
            for(start = 0; start < num-size+1; start++) {
                end = start + size - 1;
                int res = dp[size-1][start]; // When topmost daruma left
                int pivot;
                // consider that the situation where pivot and end are dropped
                for(pivot = start; pivot < end; pivot++) {
                    int mid_size = end-pivot-1;
                    int mid = dp[mid_size][pivot+1];
                    res = max(
                        dp[pivot-start][start] + 
                          mid + 
                          (mid==mid_size)*drop_point(ws[pivot], ws[end]),
                        res
                    );
#ifdef DEBUG
                    printf("(%d, %d) -> %d\n",start, end, res);
#endif
                }
                dp[size][start] = res;
            }
        }
        ans[idx++] = dp[num][0];
    }
    for(i = 0; i < idx; i++) {
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 2072
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n), bit(40);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        for (int j = 0; j < 40; j++) {
            bit[j] += bool((1LL << j) & a[i]);
        }
    }

    ll ans = 0, val = 0;
    for (int i = 39; i >= 0; i--) {
        if (bit[i] >= n - bit[i] || val + (1LL << i) > k) {
            ans += bit[i] * (1LL << i);
        }
        else {
            ans += (n - bit[i]) * (1LL << i);
            val += (1LL << i);
        }
        cerr << ans _ val << endl;
    }

    cout << ans << endl;

    for (int i = 0; i < 40; i++) cerr << bit[i];

}


Measured memory_bytes: 1024
n = int(input())
h = list(map(int, input().split()))

tmp = -1
cnt_tmp = 0
cnt_res = 0

for i in h:
    if i <= tmp:
        cnt_tmp+=1
    else:
        if cnt_res < cnt_tmp:
            cnt_res = cnt_tmp
        cnt_tmp = 0
    tmp = i
if cnt_res < cnt_tmp:
    cnt_res = cnt_tmp

print(cnt_res)

Measured memory_bytes: 14252
#include<stdio.h>
int main(){
        int A,B,K,i,j;
        scanf("%d %d %d",&A,&B,&K);
        for(i=A;i<=B;i++){
                printf("%d\n",i);
                if(i-A == K-1 ){
                        j=i;
                        break;
                }
        }
        i=B-K+1;
        if(j>=i)        i=j+1;                                                                 
        if(i<=B && i>A) for(;i<=B;i++)  printf("%d\n",i);
        return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int d;
	while (cin >> d) {
		int D = 0;
		for (int i = d; i < 600; i += d) D += i*i*d;
		cout << D << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
int main(void)
{
  int t,n,s,f,sum;
  int i;
  while(1){
    sum=0;
    scanf("%d",&t);
    if(t==0)
      break;
    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d %d",&s,&f);
      sum+=f-s;
    }
    if(sum>=t)
      printf("OK\n");
    else
      printf("%d\n",t-sum);
  }

  return 0;
}

Measured memory_bytes: 612
#include <stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r){
  int x, i, j, t;
  x = A[r];
  i = p - 1;
  for (j = p; j < r; j++) {
    if (A[j] <= x) {
      i++;
      t = A[i]; A[i] = A[j]; A[j] = t;
    }
  }
  t = A[i + 1]; A[i + 1] = A[r]; A[r] = t;
  return i + 1;
}
int main() {
  int i,q;

  scanf("%d",&n);
  for (i = 0; i < n; i++) {
    scanf("%d",&A[i]);
  }

  q = partition(0, n - 1);

  for (i = 0; i < n; i++) {
    if ( i ) printf(" ");
    if ( i == q ) {
      printf("[");
    }
    printf("%d",A[i]);
    if (i == q) {
      printf("]");
    }
  }
  printf("\n");
  return 0;
}



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

int main() {
    int n;
    cin>>n;
    for (int i = 0; i < n; ++i) {
        if ((i+1)%3==0||(i+1)%10==3)
            cout<<" "<<i+1;
        else {
            int x = i + 1;
            while (x / 10 != 0) {
                x = x / 10;
                if (x % 10 == 3) {
                    cout << " " << i + 1;
                    break;
                }
            }
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3096
x,n=map(int,input().split())
while True:
      try:
        p=list(map(int,input().split()))
        break
      except EOFError:
        p=[]
        break
p.sort()

ans=0
i=0
while(True):
  if x-i not in p:
    ans=x-i
    break
  if x+i not in p:
    ans=x+i
    break
  i+=1

print(ans)

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

const int M=105;
char s[M];

int main()
{
	scanf("%s",s+1);
	int n=strlen(s+1);
	int ans=1;
	for(int i=1;i<=n;i++)
	{
		if((i&1))
		{
			if(s[i]=='L')
			{
				ans=0;
				break;
			}
		}
		else
		{
			if(s[i]=='R')
			{
				ans=0;
				break;
			}
		}
	}
	printf("%s\n",ans?"Yes":"No");
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Sample201
{
    class Program
    {
        static void Main(string[] args)
        {
          int h, n;
            string[] str = Console.ReadLine().Split(' ');
          h = int.Parse(str[0]);
          n = int.Parse(str[1]);
          
 str = Console.ReadLine().Split(' ');
          int ans = 0;
          for(int i =0;i<n;i++){
          ans += int.Parse(str[i]);                
          }
          if(ans<h){
          Console.WriteLine("No");
          }else{
          Console.WriteLine("Yes");
          }
        }
    }
}

Measured memory_bytes: 18528
from collections import defaultdict
import math
A,B = map(int,input().split())
A_upper = (A + 1) / 0.08
A_bottom= (A ) / 0.08
A_upper = math.ceil(A_upper)
A_bottom= math.ceil(A_bottom)


B_upper = (B + 1) / 0.1
B_upper  = math.ceil(B_upper )
B_bottom= (B ) / 0.1
B_bottom= math.ceil(B_bottom )
Bs = list(range(B_bottom,B_upper ,1))
Bs = set(Bs)
ans = -1
for a in range(A_bottom,math.ceil(A_upper),1):
    if a in Bs:
        ans = a
        break
print(ans)


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

using ll = long long int;
using P = pair<int,int>;

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

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

  vector<P> sushi;

  REP(i,n){
    int t,d;
    cin >> t >> d;
    sushi.emplace_back(make_pair(d,t));
  }
  sort(sushi.rbegin(), sushi.rend());

  priority_queue<int, vector<int>, greater<int> > pq;

  set<int> st;
  ll base_score=0;
  REP(i,k){
    base_score+=sushi[i].first;
    if(st.count(sushi[i].second)){
      pq.push(sushi[i].first);
    }else{
      st.insert(sushi[i].second);
    }
  }

  ll score = base_score + st.size() * st.size();

  FOR(i,k,n){
    if(pq.empty())break;
    if(st.count(sushi[i].second))continue;
    base_score -= pq.top();
    pq.pop();
    base_score += sushi[i].first;
    st.insert(sushi[i].second);
    chmax(score, (ll)(base_score + st.size()*st.size()));
  }
  cout << score << endl;
}



Measured memory_bytes: 4212
#include<cstdlib>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<cstring>
#include<cmath>
using namespace std;
const int MAXN = (int) 1e3 + 10;
const int INF = (int) 0x3f3f3f3f;
typedef long long LL;

char s1[MAXN],s2[MAXN];
int dp[MAXN][MAXN];

void work(){
    scanf("%s%s",s1+1,s2+1);
    memset(dp,INF,sizeof(dp));
    int len1=strlen(s1+1);
    int len2=strlen(s2+1);
    for(int i=0;i<=len1;i++) dp[i][0]=i;
    for(int i=1;i<=len2;i++) dp[0][i]=i;
    for(int i=1;i<=len1;i++){
        for(int j=1;j<=len2;j++){
            if(s1[i]==s2[j]) dp[i][j]=min(dp[i][j],dp[i-1][j-1]);
            else dp[i][j]=min(dp[i][j],dp[i-1][j-1]+1);
            dp[i][j]=min(dp[i][j],dp[i][j-1]+1);
            dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
        }
    }
    printf("%d\n",dp[len1][len2]);
}

int main(){
#ifdef NNever
//    freopen("data.in","r",stdin);
//    freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}








Measured memory_bytes: 7220
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N;i++){
        cin >> S[i];
    }
    sort(S.begin(), S.end());
    S.erase(unique(S.begin(), S.end()), S.end());

    int ans = S.size();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9508
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstring>
#define R register
#define EN printf("\n")
#define LL long long
inline int read(){
	int x=0,y=1;
	char c=std::getchar();
	while(c<'0'||c>'9'){if(c=='-') y=-1;c=std::getchar();}
	while(c>='0'&&c<='9'){x=x*10+(c^48);c=std::getchar();}
	return x*y;
}
int n;
int main(){
	int h=read();
	n=read();
	int apk=0;
	for(R int i=1;i<=n;i++) apk+=read();
	std::puts(apk>=h?"Yes":"No");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>

using namespace std;

void solve(long long N){
    if (N >= 1000) {
        std::cout << "ABD" << std::endl;
    } else {
        std::cout << "ABC" << std::endl;
    }
}

int main(){	
    struct timeval start,end;
    long long span;
    gettimeofday(&start,NULL);

    long long N;
    scanf("%lld",&N);
    solve(N);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
	char S[11];
	char x[11];
	int loop1, loop2;
	loop2 = 0;
	scanf("%s",S);
	for (loop1 = 0; loop1 <= 10; loop1++) {
		if (S[loop1] == '\0') {
			x[loop2] = '\0';
			break;

		}
		switch (S[loop1]) {
		case 48:
		case 49: {
			x[loop2] = S[loop1];
			loop2++;
			break;
		}
		case 66: {
			if (loop2 != 0) loop2--;
			break;
		}

		}

	}

	printf("%s\n", x);

	return 0;

}


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

int main(void) {
long long int N,i,max,max_i,submax,submax_i;
scanf("%lld",&N);
long long int A[N];
for(i=0;i<N;i++){
	scanf("%lld",&A[i]);
}
max=1;
max_i=0;
submax=0;
submax_i=0;
for(i=0;i<N;i++){
	if(A[i]>max){
		submax=max;
		submax_i=max_i;
		max=A[i];
		max_i=i;
	}
	if(A[i]>submax && max_i!=i){
		submax=A[i];
		submax_i=i;
	}
}
for(i=0;i<N;i++){
	if(i!=max_i){
	printf("%lld\n",max);
	}else{
		printf("%lld\n",submax);
	}
}
return 0;
}


Measured memory_bytes: 3072
N = int(input())

M = [[0]*10 for _ in range(10)]

for n in range(1,N+1):
    head = int(str(n)[0])
    tail = int(str(n)[-1])
    M[head][tail] += 1

ans = 0
for i in range(10):
    for j in range(i+1,10):
        ans += M[i][j]*M[j][i]*2
    ans += M[i][i]**2

print(ans)








Measured memory_bytes: 67876
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans = (n/(a+b))*a;
    ll left = n%(a+b);
    ans += min(left,a);
    cout<<ans<<endl;
    /*
    ll blue=0, red=0, tot=0;
    while(tot<n){
        if(tot+a<=n){
            tot += a;
            blue += a;
            //cout<<"Blue: "<<tot<<" "<<blue<<endl;
        }
        else{
            ll diff = n - tot;
            tot += diff;
            blue += diff;
            //cout<<"Blue: "<<tot<<" "<<blue<<endl;
        }
        if(tot+b<=n){
            tot += b;
            red += b;
            //cout<<"Red: "<<tot<<" "<<red<<endl;
        }
        else{
            ll diff = n - tot;
            tot += diff;
            red += diff;
            //cout<<"Red: "<<tot<<" "<<red<<endl;
        }
    }

    cout<<blue<<endl;
    */

    return 0;
}



Measured memory_bytes: 256
MOD = 10**9+7
n = int(input())
F = [1]*(n+1)
for i in range(n):
  F[i+1] = F[i]*(i+1)
  F[i+1] %= MOD
X = list(map(int, input().split()))
D = [X[i+1]-X[i] for i in range(n-1)]
T = [1]*n
for i in range(2, n):
  T[i] = T[i-1]*i+F[i-1]
  T[i] %= MOD
t = 1
for i in range(1, n-1):
  t *= (n-i)
  t %= MOD
  T[n-1-i] *= t
  T[n-1-i] %= MOD
ans = 0
for i in range(1, n):
  ans += D[i-1]*T[i]
  ans %= MOD
print(ans)

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

int main(){
    int a, b, c, k;
    cin >> a >> b >> c >>k;
    int ans = 0;
    for(int l = 0; l <= k; l++){
        for(int m = 0; m+l <= k; m++){
            int n = k - l - m;
            ans = max(ans, (int)(a*pow(2,l) + b*pow(2,m) + c*pow(2,n)));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.FileNotFoundException;
import java.io.File;

public class Main {
	
    	static int n,q;
        static ArrayList<Integer> A = new ArrayList<Integer>(),
                                  M = new ArrayList<Integer>();
        static ArrayList<Boolean> R = new ArrayList<Boolean>();
        
    public static void main(String[] args) {
        
    	//Input
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for(int i = 0; i < n; i++){
        	A.add(sc.nextInt());
        }
        q = sc.nextInt();
        for(int i = 0; i < q; i++){
        	M.add(sc.nextInt());
        }
        
        //Calculation
        for (int i = 0; i < q; i++){
        	R.add(solve(0,M.get(i)));
        }
        
        //Output
        print(R);
    }

    private static boolean solve(int p,int t){
    	if(p == n){
    		if(t == 0){
    			return true;
    		} else {
    			return false;
    		}
    	}
    	if (solve(p + 1,t - A.get(p)) || solve(p + 1,t)){
    		return true;
    	} else {
    		return false;
    	}
    }
    
    private static void print(ArrayList<Boolean> R){
    	for (Boolean b:R){
			if (b == true) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}
    }
}

Measured memory_bytes: 20936
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int max(vector<int> vec){
    int ret=0;
    for(int i=0; i<(int) vec.size(); i++){
        if(vec[i]>ret){
            ret=vec[i];
        }
    }
    return ret;
}

int main(){
    long long N, K, Q;
    cin >> N >> K >> Q;
    vector<int> vec(N,0);
    for(int i=0; i<Q; i++){
        int A;
        cin >> A;
        A--;
        vec[A]++;
    }
    
    for(int i=0; i<N; i++){
        if(vec[i]>Q-K){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1024
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a,v=map(int,input().split())
b,w = map(int,input().split())
V  = v-w
t = int(input())
d = abs(a-b)
if V <= 0:
  if d == 0:print("YES")
  else:
    print("NO")
  exit()
def ceil(x,y):
  return (x-1)//y+1
if ceil(d,V) <= t:
  print("YES")
else:
  print("NO")

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

#define dbg(x) cout<<#x<<"="<<x<<endl

using P=pair<int,int>;

int main(){
    int n,k;
    cin>>n>>k;
    if(k==2){
        cout<<"Yes"<<endl;
        return 0;
    }
    vector<int> p(n);
    for (int i = 0; i < n; ++i) {
        cin>>p[i];
        --p[i];
    }
    if(n==k){
        for (int i = 0; i < n-1; ++i) {
            if(p[i]!=n-1&&p[i]>p[i+1]){
                cout<<"No"<<endl;
                return 0;
            }
        }
        cout<<"Yes"<<endl;
        return 0;
    }

    vector<bool> vis(n,false);
    int ms=0;
    for (int i = 0; i < n; ++i) {
      if(vis[i])continue;
      int crt=i;
      int d=0;
      while(!vis[crt]){
        vis[crt]=true;
        d++;
        crt=p[crt];
      }
      d%=2;
      if(d==0)ms++;
    }
    ms%=2;

    if(k%2==1&&ms%2==1)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}



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

int main(){
    int m,f,b;  cin>>m>>f>>b;
    if(m+f<b)cout<<"NA"<<endl;
    else if(m>b)cout<<"0"<<endl;
    else{
        cout<<b-m<<endl;
    }


    return 0;
}



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

#define fi first
#define se second
#define FO(x, n) for (int x = 0; x < n; ++x)
#define FOR(x, a, b) for (int x = a; x < b; ++x)
#define RFO(x, n) for (int x = n - 1; x >= 0; --x)
#define RFOR(x, a, b) for (int x = b - 1; x >= a; --x)
#define FOR_ITER(x, a) for(auto x = a.begin(); x != a.end(); ++x)
using namespace std;
typedef unsigned char byte;
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;
typedef pair<llong, llong> pll;
inline bool feq(const double& a, const double& b) { return fabs(a - b) < 1e-10; }

using namespace std;

int n;
vector<int> nums(n);

int cal(int a) {
    int sum = 0;
    FO(i, n) {
        sum += (nums.at(i) - a) * (nums.at(i) - a);
    }
    return sum;
}

int main(){
//    int n, l;
//    cin >> n >> k;
//    vector<bool> dislike(10, false);
//
//    FOR(i, 0, k) {
//        int t;
//        cin >> t;
//        dislike[t] = true;
//    }


    cin >> n;
    nums.resize(n);

    int sum = 0;
    FO(i, n) {
        cin >> nums.at(i);
        sum += nums.at(i);
    }

    int avg = ceil((double) sum / n);

    cout << min(cal(avg), cal(avg - 1)) << endl;
    return 0;
}


Measured memory_bytes: 256
// abc149_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int vx = x2 - x1;
    int vy = y2 - y1;

    int vx_ = -vy;
    int vy_ = vx;

    int x4 = x1 + vx_;
    int y4 = y1 + vy_;

    int x3 = x4 + vx;
    int y3 = y4 + vy;

    print(x3, y3, x4, y4);

    return 0;
}


Measured memory_bytes: 256
s = input()
K = int(input())
substring = []

for i in range(len(s)+1):
    for j in range(i+1,i+K+1):
        if j >len(s):
                break
        else:
                substring.append(s[i:j])

setsubstring = list(set(substring))
setsubstring.sort()

print(setsubstring[K-1])

Measured memory_bytes: 5068
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll a,b,c; cin>>a>>b>>c;
    cout << (a==2||b==2?"No":"Yes")<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

void solve(long long n, std::vector<long long> p){
    int count = 0;
    REP(i, n - 2) {
        if ((p[i] < p[i+1] && p[i+1] < p[i+2]) || (p[i] > p[i+1] && p[i+1] > p[i+2]))
            count++;
    }
    cout << count << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long n;
    scanf("%lld",&n);
    std::vector<long long> p(n);
    for(int i = 0 ; i < n ; i++){
        scanf("%lld",&p[i]);
    }
    solve(n, std::move(p));
    return 0;
}


Measured memory_bytes: 256
program main;
var 
    r,b,i : string;
    rn,bn,j : integer;
begin 
    readln(r);
    for j := 1 to length(r) do 
        if r[j] = ' ' then 
            begin
                r := copy(r,1,j-1);
                b := copy(r,j,(length(r)-j));
            end;
    readln(rn,bn);
    readln(i);
    if ( i = r ) then 
        writeln(rn-1,' ',bn)
    else 
        writeln(rn,' ',bn-1);
end.

Measured memory_bytes: 1372
#include <stdio.h>
#include <stdlib.h>
long long MAX(long long a,long long b){
    return a>b?a:b;
}
int main() {
    int N,W;
    scanf("%d%d",&N,&W);
    long long w[N],v[N];
    for(int i=0;i<N;i++){
        scanf("%lld%lld",&w[i],&v[i]);
    }
    long long dp[102][100002]={0};
    for(int i=0;i<N;i++){
        for(long long j=0;j<=W;j++){
            dp[i+1][j]=dp[i][j];
            if(j>=w[i]){
                dp[i+1][j]=MAX(dp[i][j-w[i]]+v[i],dp[i+1][j]);
            }
        }
    }
    long long ans=0;
    for(int i=1;i<=W;i++){
        if(ans<dp[N][i]){
            ans=dp[N][i];
        }
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 79872
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)

// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
using namespace std;

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 GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

// I'm trying to ~~~
int main(){
    string s; cin>>s;
    int res=700;
    rep(i,3){
        if(s[i]=='o') res+=100;
    }
    cout << res << endl;
    
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
 
int main()
{
    int n;
    double jsum = 0, bsum = 0, sum = 0, x[10];
    std::string u[11];

    std::cin >> n;
    for (int i = 0;i < n;i++){
        std::cin >> x[i]>> u[i];
    }

    for(int i = 0;i < n;i++){
        if(u[i] == "JPY"){
            jsum += x[i];
        }
        else{
            bsum += x[i] * 380000;
        }
    }

    sum = jsum + bsum;

    std::cout << sum;

    return 0;
}

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

int main(){
  string s,t,u;
  cin >> s >> t;
  int  a,b;
  cin >> a >> b;
  cin >> u;
  if(u==s){
    a--;
  }else{
    b--;
  }
  cout << a << " " << b << endl;
  return 0;

}


Measured memory_bytes: 256
N = int(input())
SS = [list(input()) for _ in range(N)]

CNT = [60] * 26

for S in SS:
  c = [0] * 26
  for s in S:
    c[ord(s)-97] += 1
  
  for i in range(26):
    CNT[i] = min(CNT[i],c[i])
    
ANS = ""
for i in range(26):
  s = chr(97+i)
  ANS += s * CNT[i]
  
print(ANS)


Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
int maxh=0,h=0,n;
char c;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>c;
		if(c=='I')h++;
		else h--;
		if(h>maxh)maxh=h;
	}
	cout<<maxh<<endl;
}

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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(true){
        c=c-b;
        if(c<=0){
            cout<<"Yes"<<endl;
            break;
        }
        a=a-d;
        if(a<=0){
            cout<<"No"<<endl;
            break;
        }
    }
    
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s, n) for(int i = s; i < (int)(n); i++)
#define co(x) cout<<x<<endl
#define SQvec(i,j) vector<vector<int>> data(i, vector<int>(j))
#define mod 1000000007
typedef long long int lint;

int main() {
  string S;
  cin >> S;
  int ans=0;
  bool fin = false;
  rep(i,0,S.size() - 1){
    if(S[i] == S[i + 1]){
      cout << i + 1 << " " << i + 2 << endl; 
      fin = true; 
      break;
    }
  }
  if(fin == false){
    rep(i,0,S.size() - 2){
      if(S[i] == S[i + 2]){
        cout << i + 1 << " " << i + 3 << endl; 
        fin = true; 
        break;
      }
    }
    if(fin == false){cout << -1 << " " << -1 << endl;}
  }
}

Measured memory_bytes: 512
#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 <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	int n; ll k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
		a[i]--;
	}
	vector<int> vis(n, -1);
	int now = 0; vis[0] = 0;
	int per;
	rep(i, 2 * n) {
		now = a[now];
		if (vis[now] == -1) {
			vis[now] = i + 1;
		}
		else {
			per = i + 1 - vis[now];
			k -= (i + 1);
			break;
		}
		if (i + 1 == k) {
			cout << now + 1 << '\n';
			return 0;
		}
	}
	k %= per;
	while (k--) {
		now = a[now];
	}
	cout << now + 1 << '\n';
}

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

using namespace std;

int t[111][111];
int s[111][111];

int main() {
	int r, c;
	cin >> r >> c;
	for (int i = 0; i < r; ++i) {
		for (int j = 0; j < c; ++j) {
			cin >> t[i][j];
			s[i][j] = (i == 0) ? t[i][j] : t[i][j] + s[i-1][j];
		}
	}
	int total_sum = 0;
	for (int i = 0; i < r; ++i) {
		int sum = 0;
		for (int j = 0; j < c; ++j) {
			cout << t[i][j] << ' ';
			sum += t[i][j];
		}
		cout << sum << '\n';
		total_sum += sum;
	}
	for (int j = 0; j < c; ++j) {
		cout << s[r-1][j] << ' ';
	}
	cout << total_sum << '\n';
}


Measured memory_bytes: 3172
(defvar *n* (read))
(defvar *m* (read))
(defvar *x* (read))
(defvar *y* (read))

(defun set-lst (n)
  (let ((lst (list nil)))
    (dotimes (x n)
      (let ((tmp (read)))
        (push tmp lst)))
    (cdr (reverse lst))))

(defvar *lst-x* (set-lst *n*))
(setq *lst-x* (sort *lst-x* #'>))

(defvar *lst-y* (set-lst *m*))
(setq *lst-y* (sort *lst-y* #'<))

(defun calc (x y z)
  (cond ((and (< x z) (>= y z) (< *x* z) (>= *y* z))
         t)
        ((> z *y*)
         nil)
        (t (calc x y (1+ z)))))

(defun main ()
  (if (calc (nth 0 *lst-x*) (nth 0 *lst-y*) (1+ *x*))
      (princ "No War")
      (princ "War")))


(main)

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

class Main{
    public static void main(String[] args){
        FastScanner fs = new FastScanner();
        int a = fs.nextInt();
        int b = fs.nextInt();
        long g = getGCD(a, b);
        long lcd = a/g*b;
        System.out.println(lcd);
    }
    public static long getGCD(long a,long b){
        if(b==0){
            return a;
        }else{
            return getGCD(b,a%b);
        }
    }
    static class FastScanner{
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte(){
            if(ptr < buflen){
                return true;
            }else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen <= 0){
                    return false;
                }
            }
            return true;
        }

        private int readByte(){
            if(hasNextByte())return buffer[ptr++];
            else return -1;
        }

        private boolean isPrintableChar(int c){
            return 33<=c && c<=126;
        }

        public boolean hasNext(){
            while(hasNextByte() && !isPrintableChar(buffer[ptr]))ptr++;
            return hasNextByte();
        }

        public String next(){
            if(!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)){
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong(){
            if(!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if(b == '-'){
                minus = true;
                b = readByte();
            }
            if(b < '0' || '9' < b){
                throw new NumberFormatException();
            }
            while(true){
                if('0' <= b && b<='9'){
                    n*=10;
                    n+=b-'0';
                }else if(b==-1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt(){
            long nl = nextLong();
            if(nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)throw new NumberFormatException();
            return (int)nl;
        }
        public double nextDouble(){return Double.parseDouble(next());}
    }
}

Measured memory_bytes: 22484
#ifdef _DEBUG
#include ".vscode/debug_print.hpp"
#else
#define debug(...)
#endif
#include <bits/stdc++.h>

using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1050000000;
constexpr long long INF64 = 4000000000000000000;
constexpr int MOD7        = 1000000007;
constexpr int MOD53       = 998244353;
constexpr long double PI  = 3.14159265358979323846;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

void vprint() { std::cout << '\n'; }
template <class H, class... T> void vprint(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << '\n';
    vprint(std::forward<T>(args)...);
}
template <class T> void vprint(std::vector<T> &v) {
    for (auto &&i : v) {
        std::cout << i << '\n';
    }
}

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

    int K, N;
    scan(K, N);
    vector<int> a(N);
    scan(a);

    int ans = K - a[N - 1] + a[0];
    int mx  = K - a[N - 1] + a[0];
    for (size_t i = 1; i < N; i++) {
        ans += a[i] - a[i - 1];
        chmax(mx, a[i] - a[i - 1]);
    }
    ans -= mx;
    print(ans);

    return 0;
}

Measured memory_bytes: 1024
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    string a, b;
    cin >> a >> b;
    string c = a + b;
    int num = stoi(c);
    for (int i = 1; i <= 500; i++) {
        if (num == i * i) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<LL> a(n), r(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < 2*n; ++i) {
		LL& curr = a[i % n];
		LL& next = a[(i + 1) % n];
		LL diff = next - curr;
		if (diff > 0) {
			LL& nn = a[(i + 2) % n];
			LL d = min(diff, nn);
			r[(i + 2) % n] += 2 * d;
			next -= d;
			nn -= d;
		} else {
			LL& prev = a[(i - 1 + n) % n];
			LL d = min(-diff, prev);
			r[i % n] += 2 * d;
			curr -= d;
			prev -= d;
		}
	}
	LL mn = *min_element(a.begin(), a.end());
	for (int i = 0; i < n; ++i) {
		a[i] -= mn;
		r[i] += mn;
	}
	for (int i = 0; i < 2 * n; ++i) {
		LL& curr = a[i % n];
		LL& next = a[(i + 1) % n];
		LL d = min(curr, next);
		r[(i + 1) % n] += 2 * d;
		curr -= d;
		next -= d;
	}
	for (int i = 0; i < n; ++i) {
		if (i)cout << " ";
		cout << r[i];
	}
	cout << endl;
	return 0;
}	


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

int main(){
    ll n;
    cin >> n;
    ll p[8], q[8];
    for (int i = 0; i < n;i++)
        cin >> p[i];
    for (int i = 0; i < n; i++)
        cin >> q[i];
    ll pn, qn;
    vector<ll> pp, qq;
    for (int i = 0; i < n;i++)
    {
        pp.push_back(p[i]);
        qq.push_back(q[i]);
    }
    vector<ll> nums(n);
    iota(nums.begin(), nums.end(), 1);
    bool pf, qf = false;
    ll count = 0;
    do
    {
        //for (auto x : nums)
            //cout << x << " ";
        //cout << "\n";
        count++;
        
   if(pp == nums)
       pn = count;
    if(qq == nums)
        qn = count;
    } while (next_permutation(nums.begin(), nums.end()));
    cout << abs(pn - qn);
}

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

void call(int n){
    for (int i=1; i<=n; i++) {
        if (i%3==0) cout << " " << i;
        else {
            int x=i;
            while (x>0){
                int LSB = x%10;
                if (LSB==3) {
                    cout << " " << i;
                    break;
                }
                x/=10;
            }
        }
    }
}


int main(){
    int n;
    cin >> n;
    call(n);
    cout << endl;

    return 0;
}


Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
//type
typedef long long ll;
using pii = pair<int, int>;
using vi = vector<int>;
//x * y * 1.0 can cause overflow
//constant
#define inf (int)(1e9+7)
#define mod (ll)(1e9+7)
#define eps 1e-10
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
//omission
#define eb emplace_back
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define all(v) v.begin(), v.end()
//manip
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end(), v.end());
#define fill(x, y) memset(x, y, sizeof(x))
#define ceil(a, b) a / b + !!(a % b)
template<class T> T power(T a, T b)
{return b ? power(a * a % inf, b / 2) * (b % 2 ? a : 1) % inf : 1;}
#define LB(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define UB(v, x) (int)(upper_bound(v.begin(), v.end(), x) - v.begin())
//loop
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep3(i, st, n) for (int i = st; i < n; ++i)
//algorithm
//double pointer, l start, how many adds, can be 0 -> init r = l, sum = 0
//bfs, not x, y, i, j
//not !(i % 2), i % 2 == 0


bool comp(pair<ll, ll> a, pair<ll, ll> b) {
    return a.second < b.second;
}


int main() {
    //cast caution
    //look constraints always
    cin.tie(0); ios::sync_with_stdio(false);
    
    
    
    int n, k; cin >> n >> k;
    
    
    /*
     組み合わせ最大 nC2
     
     連結グラフで、最小n - 1本の辺がある
     辺で直接結ばれてるペアは最短距離1
     
     最短距離2の最大組み合わせ数 nC2 - (n - 1)
     = n(n - 1) / 2 - (n - 1)
     = n(n - 1) / 2 - 2(n - 1) / 2
     = (n - 1)(n - 2) / 2
     
     スターグラフにおいてこれは達成される
     
     そして、スターグラフから最短距離ペア数減らすには
     頂点どうし結べばいい
     
     結んだら、そのペアは最短距離1になる
     他の頂点に影響与えない
     
     
     */
    
    int star = (n - 1) * (n - 2) / 2;
    if (k > star) {cout << -1 << endl; return 0;}
    
    int m = (n - 1) + (star - k);
    cout << m << endl;
    
    rep3(i, 2, n + 1) cout << 1 << " " << i << endl;
    
    m -= (n - 1);
    //cout << m << endl;
    if (m == 0) return 0;
    
    int c = 0;
    rep3(i, 2, n + 1) {
        rep3(j, i + 1, n + 1) {
            cout << i << " " << j << endl;
            c++;
            if (c == m) return 0;
        }
    }
   
    
    
    
    
    
    
    
    
    
}
//cast caution



Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
def main():

    n,m,k=map(int,input().split())
    uf=UnionFind(n)
    block={}
    for i in range(n):
        block[i]=[i]
    for i in range(m):
        a,b=map(int,input().split())
        uf.union(a-1,b-1)
        block[a-1].append(b-1)
        block[b-1].append(a-1)
        
    for i in range(k):
        a,b=map(int,input().split())
        block[a-1].append(b-1)
        block[b-1].append(a-1)
    ans=[]
    #print(block)
    for i in range(n):
        res=uf.size(i)
    #   print(res)
        for value in block[i]:
            if uf.same(value,i):
                res-=1
        ans.append(res)
    print(*ans)
        
        
if __name__=="__main__":
    main()


Measured memory_bytes: 49072
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A&lang=jp
"""
from enum import Enum
from heapq import heappush, heappop, heapify

class Sssp(object):
    """ single source shortest path """
    class Status(Enum):
        """ ?????????????¨??????¶??? """
        white = 1  # ????¨????
        gray = 2  # ?¨???????
        black = 3  #?¨???????

    def __init__(self, V, data):
        num_of_nodes = V
        self.color = [Sssp.Status.white] * num_of_nodes  # ????????????????¨??????¶???
        self.d = [float('inf')] * num_of_nodes  # ?§???????????????????
        self.p = [-1] * num_of_nodes  # ????????????????????????????¨?????????????????????????
        self.adj = [[] for _ in range(num_of_nodes)]
        self.make_adj(data)


    def make_adj(self, data):
        # ??£??\??????????????????
        for f, t, c in data:
            self.adj[f].insert(0, (t, c))
            # self.adj[t].insert(0, (f, c))

    def dijkstra(self, start):
        self.d[start] = 0
        pq = []
        heappush(pq, (0, start))

        while pq:
            cost, u = heappop(pq)
            self.color[u] = Sssp.Status.black
            if self.d[u] < cost:
                continue

            for v, cost in self.adj[u]:
                if self.color[v] == Sssp.Status.black:
                    continue
                if self.d[v] > self.d[u] + cost:
                    self.d[v] = self.d[u] + cost
                    heappush(pq, (self.d[v], v))
                    self.color[v] = Sssp.Status.gray



if __name__ == '__main__':
    # ??????????????\???
    V, E, r = [int(x) for x in input().split(' ')]
    data = []
    for i in range(E):
        data.append(list(map(int, input().split(' '))))

    # ???????????¢?´¢
    s = Sssp(V, data)
    s.dijkstra(r)

    # ???????????¨???
    for i in range(V):
        if s.d[i] == float('inf'):
            print('INF')
        else:
            print('{}'.format(s.d[i]))

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

int main() {
	int n;
	cin >> n;
	string ans = "Yes";
	
	cout << (n+1)/2 << endl;
	return 0;
}

Measured memory_bytes: 256