akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>

using namespace std;

int checkTable[59049];

struct Data{
	int number,depth;
};

int getNum(char ch){
	switch(ch){
	case 'r':return 0;
	case 'g':return 1;
	case 'b':return 2;
	}
	return -1; //must not reach here
}

int getWeight(int w){
	switch(w){
	case 0:return 1;
	case 1:return 3;
	case 2:return 9;
	case 3:return 27;
	case 4:return 81;
	case 5:return 243;
	case 6:return 729;
	case 7:return 2187;
	case 8:return 6561;
	case 9:return 19683;
	}
	return -1;	//must not reach here
}

int translateData(char table[],int size){
	int ret = 0;

	for(int i = 0; i < size; i++){
		ret += getNum(table[i])*pow(3,(size-1)-i);
	}

	return ret;
}

void setData(char warm[],int code,int size){
	int tmp;
	for(int i = 0; i < size; i++){
		tmp = code/getWeight(size-1-i);
		if(tmp == 0){
			warm[i] = 'r';
		}else if(tmp == 1){
			warm[i] = 'g';
		}else{
			warm[i] = 'b';
		}
		code %= getWeight(size-1-i);
	}
}

int dfs(char warm[],int size){

	int ret = -1;
	Data data;
	data.number = translateData(warm,size);
	data.depth = 0;

	queue<Data> Q;
	Q.push(data);

	Data tmp;
	char tmp_warm[11], next_warm[11];
	int code;

	while(!Q.empty()){
		tmp = Q.front();
		Q.pop();

		setData(tmp_warm,tmp.number,size);

		bool FLG = true;
		for(int i = 0; i < size-1; i++){
			if(tmp_warm[i] != tmp_warm[i+1]){
				FLG = false;
				break;
			}
		}
		if(FLG){
			//while(!Q.empty())Q.pop();
			ret = tmp.depth;
			break;
		}

		for(int i = 0; i < size-1; i++){
			if(tmp_warm[i] != tmp_warm[i+1]){
				Data new_data;
				for(int k = 0; k < size; k++)next_warm[k] = tmp_warm[k];

				if(tmp_warm[i] != 'r' && tmp_warm[i+1] != 'r'){
					next_warm[i] = 'r';
					next_warm[i+1] = 'r';
				}else if(tmp_warm[i] != 'g' && tmp_warm[i+1] != 'g'){
					next_warm[i] = 'g';
					next_warm[i+1] = 'g';
				}else{
					next_warm[i] = 'b';
					next_warm[i+1] = 'b';
				}

				code = translateData(next_warm,size);
				if(checkTable[code] == -1){
					checkTable[code] = 1;
					new_data.number = code;
					new_data.depth = tmp.depth+1;
					Q.push(new_data);
				}
			}
		}
	}
	return ret;
}

int main(){

	int size,minimum;
	char buf[11];

	while(true){
		scanf("%s",buf);
		if(buf[0] == '0')break;

		for(size = 0;buf[size] != '\0';size++);

		for(int i = 0; i < 59049; i++)checkTable[i] = -1;

		checkTable[translateData(buf,size)] = 1;

		minimum = dfs(buf,size);

		if(minimum == -1)printf("NA\n");
		else{
			printf("%d\n",minimum);
		}
	}

    return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//for(int i = 0; i<n; i++)


int main()
{
    int n;cin >> n;
    int sum = 0;
    for(int i = 0; i<n; i++){
        int l,r;cin>>l>>r;
        sum += r-l+1;
    }
    cout << sum << endl;
    return 0;
}

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

#define mod 1000000007

inline int add(int a,int b)
{
	a+=b;
	if(a>mod) a-=mod;
	return a;
}

int main()
{
	ios_base::sync_with_stdio(false),cin.tie(NULL);
	int n=0,m=0;
	cin>>n>>m;
	int mx=numeric_limits<int>::max();
	vector<vector<int>> dp(n+1,vector<int>(m+1,0));
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			char c;
			cin>>c;
			if(c=='#') dp[i][j]=mx;
		}
	}

	dp[1][1]=1;
	for(int i=2;i<=m;i++) if(dp[1][i]!=mx) dp[1][i]=dp[1][i-1];
	for(int i=2;i<=n;i++) if(dp[i][1]!=mx) dp[i][1]=dp[i-1][1];

	for(int i=2;i<=n;i++)
	{
		for(int j=2;j<=m;j++)
		{
			if(dp[i-1][j]==mx and dp[i][j-1]==mx and dp[i][j]!=mx) dp[i][j]=0;
			else if(dp[i-1][j]==mx and dp[i][j]!=mx) dp[i][j]=add(dp[i][j],dp[i][j-1]);
			else if(dp[i][j-1]==mx and dp[i][j]!=mx) dp[i][j]=add(dp[i][j],dp[i-1][j]);
			else if(dp[i][j]!=mx) dp[i][j]=add(dp[i][j],add(dp[i-1][j],dp[i][j-1]));
		}
	}

	cout<<dp[n][m];
	return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int ama[101];
int main(){
    string o,e;
    cin>>o>>e;
    string ans;
    int l=0,k=0;
    rep(i,o.size()+e.size()){
        if(i%2==0){ans+=o[l];l++;}else{
            ans+=e[k];k++;
        }
    }
    cout<<ans<<endl;
    
  
return 0;
}


Measured memory_bytes: 256
<?php
list($a, $b, $c) = ints();
echo max(0, $c-($a-$b));

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array:";
            echo implode(" ", $val)."\n";
        }else{
            echo "array:array\n";
            foreach($val as $row){
                echo implode(" ", $row)."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}

Measured memory_bytes: 4856
#include <stdio.h>

int main()
{
    int n,p[50],count = 0;
    scanf("%d",&n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d",&p[i]);
        if (p[i] != i + 1)
        {
            count++;
        }
    }
    
    if (count == 0 || count == 2)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, z, w; cin >> n >> z >> w;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  if(n == 1) cout << abs(w - a[0]) << endl;
  else cout << max(abs(w - a[n - 1]), abs(a[n - 2] - a[n - 1])) << endl;
  return 0;
}

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

int isPrime(int x) {
	if (x < 2)
		return 0;
	else if (x == 2)
		return 1;
	if (x % 2 == 0)
		return 0;
	for (int i = 3; i * i <= x; i += 2)
		if (x % i == 0)
			return 0;
	return 1;
}
int main()
{
	int n, t, cnt = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &t);
		if (isPrime(t))
			cnt++;
	}
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 3200
using System;

class Program
{
    static void Main(string[] args)
    {
        
        string[] input = Console.ReadLine().Split(' ');
        int[] num = new int[3];
        num[0] = int.Parse(input[0]);
        num[1] = int.Parse(input[1]);
        num[2] = int.Parse(input[2]);
        Array.Sort(num);
        


        Console.WriteLine(num[2]*10+num[1]+num[0]);

    }


}

Measured memory_bytes: 11092
#include <stdio.h>

int main(void){
	int n;
	scanf("%d",&n);
	char s[n+1];
	scanf("%s",s);
	int k;
	scanf("%d",&k);
	
	for(int i=0;i < n;i++){
		if(s[i] != s[k-1]){
			s[i] = '*';
		}
	}
	printf("%s",s);
	return 0;
}

Measured memory_bytes: 128
import sys
n, y = map(int, input().split())
count = 0
for i in range(n+1):
    for j in range(n-i+1):
        z = n - i - j
        if y == 10000 * i + 5000 * j + 1000 * z:
            print(i, j, z)
            sys.exit()
print(-1, -1, -1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int SIZE = 1e6;
#define ll long long
ll A[SIZE],B[SIZE];
ll mul[SIZE];
bool cmp(int x,int y)
{
    return x>y;
}
int main()
{
    ll n,k;
    scanf("%lld%lld",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%lld",&A[i]);
    for(int i=1;i<=n;i++)
        scanf("%lld",&B[i]);
    sort(A+1,A+n+1,cmp);
    sort(B+1,B+1+n);
    ll maxn=-1;
    for(int i=1;i<=n;i++)
    {
        mul[i]=A[i]*B[i];
        maxn=max(maxn,mul[i]);
    }
    ll l=0,r=maxn,mid;
    while(l<r)
    {
        mid=(l+r)>>1;
        ll res=0;
        for(int i=1;i<=n;i++)
        {
            if(mul[i]>mid)
            {
                res+=A[i]-(mid/B[i]);
            }
            if(res>k)
            {
                break;
            }
        }
        if(res>k)
        {
            l=mid+1;
        }
        else
        {
            r=mid;
        }
    }
    printf("%lld\n",r);
}


Measured memory_bytes: 9984
#include<stdio.h>
#include<iostream>
#include<string>
#include<cassert>
#include<cmath>

using namespace std;

#define N 4
#define N2 16
#define LIMIT 100

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};

int MDT[N2][N2];

struct Puzzle{
  int f[N2], space, MD;
};

Puzzle state;
int limit;
int path[LIMIT];

int getAllMD(Puzzle pz){
  int sum = 0;
  for(int i=0 ; i<N2 ; ++i){
    if(pz.f[i] == N2) continue;
    sum += MDT[i][pz.f[i]-1];
  }
  return sum;
}

bool isSolved(){
  for(int i=0 ; i<N2 ; ++i) if(state.f[i] != i+1) return false;
  return true;
}

bool dfs(int depth, int prev){
  if(state.MD == 0) return true;
  if(depth + state.MD > limit) return false;

  int sx = state.space/N;
  int sy = state.space%N;
  Puzzle tmp;

  for(int r=0 ; r<4 ; ++r){
    int tx = sx + dx[r];
    int ty = sy + dy[r];
    if(tx<0 || ty<0|| tx>=N || ty >= N) continue;
    if(max(prev, r)-min(prev, r) == 2) continue;
    tmp = state;

    state.MD -= MDT[tx*N+ty][state.f[tx*N+ty]-1];
    state.MD += MDT[sx*N+sy][state.f[tx*N+ty]-1];
    swap(state.f[tx*N+ty], state.f[sx*N+sy]);
    state.space = tx*N+ty;
    if(dfs(depth+1, r)){
      path[depth] = r;
      return true;
    }
    state = tmp;
  }
  return false;
}

string iterative_deeping(Puzzle in){
  in.MD = getAllMD(in);

  for(limit = in.MD ; limit<=LIMIT ; ++limit){
    state = in;
    if(dfs(0, -100)){
      string ans = "";
      for(int i=0 ; i<limit ; ++i) ans += dir[path[i]];
      return ans;
    }
  }
  return "unsolvable";
}

int main(){
  for(int i=0 ; i<N2 ; ++i){
    for(int j=0 ; j<N2 ; ++j){
      MDT[i][j] = abs(i/N - j/N) + abs(i%N - j%N);
    }
  }
  Puzzle in;
  for(int i=0 ; i<N2 ; ++i){
    cin >> in.f[i];
    if(in.f[i] == 0){
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = iterative_deeping(in);
  cout << ans.size() << endl;

  return 0;
}



Measured memory_bytes: 3208
def nCk(n, k):
    if k == 0:
        return 1
    elif k == 1:
        return n
    elif k == 2:
        return n * (n - 1) // 2
    else:
        return n * (n - 1) * (n - 2) // 6


def solve(N, K):
    if N == 0 and K > 0:
        return 0

    if K == 0:
        return 1

    M = len(str(N))
    hd, tl = divmod(N, 10 ** (M - 1))

    res = solve(tl, K - 1)
    res += (hd - 1) * nCk(M - 1, K - 1) * (9 ** (K - 1))

    if M > K:
        res += nCk(M - 1, K) * (9 ** K)

    return res


N = int(input())
K = int(input())

print(solve(N, K))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,s,a,b;
  cin >> n >> m;
  int max  = m;
  for(int i=1; i<=n; i++){
	cin >> a >> b;
	if( i == 1) s = (a+m)-b;
	else {
	  s = (a+s)-b;
	  if(s < 0) break ;
	}
	if(s > max) max = s;
  }
  if(s < 0) cout << 0 << endl; 
  else cout << max << endl;
  return 0;
}


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

typedef long long ll;

const int MAXN = 1000;
const int MAXM = 2000;
const int MOD = int(1E9) + 7;

int pw2[MAXM + 5];
void init() {
	pw2[0] = 1;
	for(int i=1;i<=MAXM;i++)
		pw2[i] = 2LL*pw2[i-1]%MOD;
}

struct edge{
	int u, v; ll w;
	friend bool operator < (const edge &a, const edge &b) {
		return a.w < b.w;
	}
}e[MAXM + 5], t[MAXM + 5];

ll G[MAXN + 5][MAXN + 5];

int fa[MAXN + 5];
vector<int>v[MAXN + 5];
int find(int x) {
	return (x == fa[x] ? x : find(fa[x]));
}
bool merge(int x, int y, ll w) {
	if( find(x) == find(y) ) return false;
	x = find(x), y = find(y);
	if( v[x].size() > v[y].size() ) swap(x, y);
	for(int i=0;i<v[x].size();i++)
		for(int j=0;j<v[y].size();j++)
			G[v[x][i]][v[y][j]] = G[v[y][j]][v[x][i]] = w;
	fa[x] = y;
	for(int i=0;i<v[x].size();i++)
		v[y].push_back(v[x][i]);
	return true;
}

int main() {
	init();
	int N, M; ll X;
	scanf("%d%d%lld", &N, &M, &X);
	for(int i=1;i<=M;i++)
		scanf("%d%d%lld", &e[i].u, &e[i].v, &e[i].w);
	sort(e + 1, e + M + 1);
	for(int i=1;i<=N;i++) fa[i] = i, v[i].push_back(i);
	ll A = 0; int cnt = 0;
	for(int i=1;i<=M;i++) {
		if( !merge(e[i].u, e[i].v, e[i].w) )
			t[++cnt] = e[i], t[cnt].w -= G[e[i].u][e[i].v];
		else A += e[i].w;
	}
	int ans = 0;
	if( A == X ) ans = (pw2[M] + MOD - pw2[M-N+1+1]) % MOD;
	sort(t + 1, t + cnt + 1);
	for(int i=1;i<=cnt;i++)
		if( A + t[i].w == X ) ans = (ans + pw2[cnt-i+1]) % MOD;
	printf("%d\n", ans);
}

Measured memory_bytes: 8320
using System;
using System.Linq;

namespace C
{
	class Program
	{
		static void Main(string[] args)
		{
			var N = int.Parse(Console.ReadLine());

			var line = Console.ReadLine();
			var lineSplited = line.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);

			var A = new long[N];
			for (int i = 0; i < N; i++) {
				A[i] = long.Parse(lineSplited[i]);
			}

			var count = 0;
			var aMinNotZero = long.MaxValue;
			var aMinNotZeroIndex = -1;
			while (true) {
				count = 0;
				for (int i = 0; i < N; i++) {
					if (A[i] < aMinNotZero && A[i] != 0) {
						aMinNotZero = A[i];
						aMinNotZeroIndex = i;
					}
				}

				// foreach (var a in A) {
				// 	Console.WriteLine(a);
				// }
				// Console.ReadKey();

				for (int i = 0; i < N; i++) {
					if (A[i] >= 1) count++;
					if (i == aMinNotZeroIndex) continue;

					A[i] %= aMinNotZero;
				}
				
				if (count == 1) {
					Console.WriteLine(A.Max());
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 19040
#include <bits/stdc++.h>
#define For(i, l, r) for(int i = (l), _end_ = (int)(r); i <= _end_; ++i)
#define Fordown(i, r, l) for(int i = (r), _end_ = (int)(l); i >= _end_; --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}

inline int read() {
	int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar() ) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar() ) x = (x<<1) + (x<<3) + (ch ^ '0');
    return x * fh;
}

int res[2];
int dig[100100];

int main () {
	int lenth = 0;
	while (scanf ("%1d", &dig[++lenth]) != EOF);
	-- lenth;
	res[0] = res[1] = lenth;
	For (i, 1, lenth)
		chkmin(res[dig[i]], max(lenth - i, i - 1) );
	printf ("%d\n", max(res[0], res[1]) );
    return 0;
}


Measured memory_bytes: 640
#include<iostream>

using namespace std;

main(){
  int a,b,c;
  cin>>a>>b>>c;
  int d = b+c;
  int f = a/d;
  int g = a%d;
  
  if (g>=c) cout<< f <<endl;
  else cout<<f-1<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <map>
using namespace std;
#define LL long long
#define f(i,x,y) for (int i=x;i<=y;i++)
#define ff(i,x,y) for (int i=x;i<y;i++)
#define fi first
#define se second 

const int N = 2e5+10;
int a[N],n;

int main(){
	scanf("%d",&n);
	f(i,1,n) {
		scanf("%d",&a[i]);
	}
	int ans = a[1];
	f(i,2,n) ans^=a[i];
	if (ans==0) puts("Yes");
		else puts("No");
	return 0;
}

Measured memory_bytes: 512
#include "stdio.h"

int main()
{
    int input = 0;
    int N = 0;
    int S[10000];
    int Q = 0;
    int T[500];
    int nBuff[500];
    int nCnt = 0;

    int i = 0;
    int j = 0;
    int k = 0;

    // ++++++++++
    // Init
    for(i = 0; i < 10000; i++) S[i] = 0;
    for(i = 0; i < 500; i++) T[i] = 0;
    for(i = 0; i < 500; i++) nBuff[i] = -1;

    // ++++++++++
    // Input nS[]
    scanf("%d", &input);
    if(input > 10001)
    {
        return 0;
    }
    N = input;

    for(i = 0; i < N; i++)
    {
        scanf("%d", &input);
        if(input > 1000000001)
        {
            return 0;
        }
        S[i] = input;
    }

    // ++++++++++
    // Input qT[]
    scanf("%d", &input);
    if(input > 501)
    {
        return 0;
    }
    Q = input;

    for(i = 0; i < Q; i++)
    {
        scanf("%d", &input);
        if(input > 1000000001)
        {
            return 0;
        }
        T[i] = input;
    }


    // **********
    // Search
    for(i = 0; i < N; i++)
    {
        for(j = 0; j < Q; j++)
        {
            if(S[i] == T[j])
            {
            // **********
            // debug
            //printf("%d-%d\n", S[i], T[j]);
                for(k = 0; k < 500; k++)
                {
                    if(T[j] == nBuff[k])
                    {
                        break;
                    }
                }
                if(k == 500)
                {
                    nBuff[nCnt] = T[j];
                    nCnt++;
                    break;
                }
            }
        }
    }
    printf("%d\n", nCnt);
    return 0;
}


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

// utility of stdin,stdout
#define BUFS cout <<
#define BUFE << endl 

int main(int argc, char const *argv[])
{
	int n,sum = 0;
	cin >> n;
	std::vector<int> s(n);
	for (int i = 0; i < n; ++i){
		cin >> s.at(i);
		sum += s.at(i);
	}
	if(sum % 10 != 0){
		BUFS sum BUFE;
		return 0;
	}
	else{
		sort(s.begin(), s.end());
		for (int i = 0; i < n; ++i)
		 {
		 	 if(s.at(i) % 10 != 0){
		 	 	sum -= s.at(i);
		 	 	break;
		 	 }
		 }
		sum = (sum % 10 == 0) ? 0 : sum;
		BUFS sum BUFE;
	}
	return 0;
}


Measured memory_bytes: 256
N, W = [int(i) for i in input().split()]
weight, value = [0] * (N + 1), [0] * (N + 1)

for i in range(1, N + 1):
    weight[i], value[i] = [int(i) for i in input().split()]
#%%
sum_value = sum(value)
dp = [[float("inf")] * (sum_value + 1) for _ in range(N + 1)]
dp[0][0] = 0

for i in range(1, N + 1):
    for j in range(sum_value + 1):
        if j >= value[i]:
            dp[i][j] = min(dp[i][j], weight[i] + dp[i - 1][j - value[i]])
        # i番目の品物を買った場合と買わなかった場合を比較してweightが小さい方をDPテーブルに記憶する
        dp[i][j] = min(dp[i][j], dp[i -1][j])
        
ans = 0
for i in range(sum_value + 1):
    if dp[N][i] <= W:
        ans = i

print(ans)


Measured memory_bytes: 311632
N = int(input())
A = list(map(int, input().split()))
prev = 0
costs = []
total = 0
for a in A:
  cost = abs(a - prev)
  total += cost
  costs.append(cost)
  prev = a
cost = abs(prev)
total += cost
costs.append(cost)

A = [0] + A + [0]
for i in range(N):
  print(total - costs[i] - costs[i+1] + abs(A[i+2] - A[i]))

Measured memory_bytes: 14048
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iterator>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define Rep(i, n) for (int i = 1; i <= n; i++)

typedef long long ll;

int main() {
    int a, b, k, minp, cont = 0;
    cin >> a >> b >> k;
    minp = min(a, b);
    for (int i = minp; i >= 1; i--) {
        if (a % i == 0 && b % i == 0)
            cont++;
        if (k == cont) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
x = int(input())
tuple_works = [0 for i in range(x)]
for i in range(x):
    a = input().split()
    tuple_works[i] = (int(a[1]), int(a[0]))
tuple_works=sorted(tuple_works)
time = 0
is_over = False
for i in range(len(tuple_works)):
    time += tuple_works[i][1]
    if time > tuple_works[i][0]:
        print("No")
        is_over = True
        break
if not is_over:
    print("Yes")

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

using namespace std;

int main(){
  vector <int> a;

  int N;
  cin >> N;
  for(int i = 0;i < N;i++){
    int b;
    cin >> b;
    a.push_back(b);
  }
  int sum = 0;
  for(int i = 0;i < N;i++){
    if(a[i] == i+1){
      if(a[i+1] == i+2){
	if((a[i+2] == i+3) && (a[i+3] != i+4)){
	  sum = sum+2;
	  int swap;
	  swap = a[i];
	  a[i] = a[i+1];
	  a[i+1] = swap;
	  swap = a[i+1];
	  a[i+1] = a[i+2];
	  a[i+2] = swap;
	  i = i + 2;
	  
	}
	
	else{
	  int swap;
	  swap = a[i];
	  a[i] = a[i+1];
	  a[i+1] = swap;
	  sum++;
	  i++;

	}
      }
      else{
	int swap;
	swap = a[i];
	a[i] = a[i+1];
	a[i+1] = swap;
	sum++;
	i++;

      }
    }
  }
  
  cout << sum << endl;

}

Measured memory_bytes: 1020
import java.util.Scanner;

public class Main {

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

			for (int i = 1; i < 10; i++) {
				for (int j = 1; j < 10; j++) {
					if (i * j == n) {
						System.out.println("Yes");
						return;
					}
				}
			}
			System.out.println("No");
		}
	}
}


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

using namespace std;

int main(){
    int n, li[101];
    map<int, int> memo;
    cin>>n;
    int n_=0;
    for(int i=0;i<n;++i){
        int l;
        cin>>l;
        memo[l]++;
        //cout<<memo[l]<<endl;
        if(memo[l]==1){
            li[n_]=l;
            n_++;
        }
    }
    sort(li,li+n_);
    int ans=0;
    for(int i=0;i<n_;++i){
        //cout<<li[i]<<endl;
        for(int j=i+1;j<n_;++j){
            for(int k=j+1;k<n_;++k){
                if(li[i]+li[j]>li[k]){
                    //cout<<ans<<endl;
                    ans+=memo[li[i]]*memo[li[j]]*memo[li[k]];
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3620
import collections

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x%y)

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

def main():
    a, b = map(int, input().split())
    c = collections.Counter(trial_division(gcd(a, b)))
    print(len(c.keys())+1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: u32 = read();
    let mut ps: Vec<u32> = Vec::with_capacity(n as usize);
    for _ in 0..n {
        ps.push(read());
    }
    let mut max_value_index = (0, 0 as usize);  // (max_price, index)
    for i in 0..n {
        let index = i as usize;
        if max_value_index.0 < ps[index] {
            max_value_index = (ps[index], index);
        }
    }
    let mut price = 0;
    for i in 0..n {
        let index = i as usize;
        if max_value_index.1 == index {
            price += max_value_index.0 / 2;
        } else {
            price += ps[index];
        }
    }
    println!("{}", price);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
// by gantheory™
#include <bits/stdc++.h>

using namespace std;

int a, b;

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

  if ( a % b )
    cout << a << '\n';
  else
    cout << "-1" << '\n';
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		sc.close();
		
		int tmp = Integer.MAX_VALUE;
		for(int A=1;A*A<=M;A++) {
			if(M%A!=0)continue;
			int B=M/A;
			if(A>=N)tmp = Math.min(A, tmp);
			if(B>=N)tmp = Math.min(B, tmp);
		}
		
		System.out.println(M/tmp);
	}
	
}


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

int main() {
    int price, quantity, sumPrice = 0, i = 0;
    double sumQuantity = 0;
    while (scanf("%d,%d", &price, &quantity) != EOF) {
        sumPrice += price * quantity;
        sumQuantity += quantity;
        i++;
    }
    printf("%d\n%d\n", sumPrice, (int) (sumQuantity / i + 0.5));
}

Measured memory_bytes: 0
n,m = map(int,input().split())
p,s = [],[]
for _ in range(m):
  a,b = map(str,input().split())
  p.append(a)
  s.append(b)
p = list(map(int,p))
checker = [0] * n
penalty = [0] * n
ans = 0
for i,j in enumerate(s):
  if j == "AC" and checker[p[i]-1] == 0:
    checker[p[i]-1] = 1
  elif j == "WA" and checker[p[i]-1] == 0:
    penalty[p[i]-1] += 1
for k,l in enumerate(checker):
  if l:
    ans += penalty[k]
print(sum(checker),ans)

Measured memory_bytes: 27756
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

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

    if(a < b) {
        for(int i = 0; i < b; i++) cout << a;
        cout << endl;
    }
    else {
        for(int i = 0; i < a; i++) cout << b;
        cout << endl;
    }
}


Measured memory_bytes: 3572
from collections import Counter # 重複個数のカウント: Counter(num_list)

def main():
    n = int(input())
    num_list = list(map(int, input().split()))

    ans_list = [0] * n
    cnt_list = Counter(num_list)
    for k, v in cnt_list.items():
        if v == 1:
            ans_list[k-1] = 0
            continue
        ans_list[k-1] = v * (v-1) // 2
        
    sum_num = sum(ans_list)

    ans = sum_num

    for i in range(n):
        ans -= ans_list[num_list[i]-1]
        if cnt_list[num_list[i]]-1 != 1:
            ans += (cnt_list[num_list[i]]-1) * (cnt_list[num_list[i]]-2) // 2
        print(ans)
        ans = sum_num

if __name__ == '__main__':
    main()

Measured memory_bytes: 92108
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007
#define MOD2 998244353
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<=b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define T int
#define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
auto clk=clock();
 
ll mexp(ll a, ll b, ll m){
    ll ans=1;
    a%=m;
    while(b){
        if(b&1) ans=ans*a%m;
        b>>=1;
        a=a*a%m;
    }
    return ans;
}

const int N = 200005;

ll fac[N], inv[N];

ll nCr(ll n, ll r){
    return (((fac[n] * inv[n-r]) % MOD) * inv[r]) % MOD;
}

void pre(){
    fac[0] = 1;
    inv[0] = 1;
    FOR(i,1,N-1){
        fac[i] = (fac[i-1] * i) % MOD;
        inv[i] = mexp(fac[i], MOD - 2, MOD);
    }
}

int main(){
    IOS
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    pre();
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    ll ans = 0;
    FOR(i,b,w-1){
        int y1 = h - a - 1, x1 = i;
        int y2 = a - 1, x2 = w - i - 1;
        ll p = (nCr(x1 + y1, x1) * nCr(x2 + y2, x2)) % MOD;
        ans = (ans + p) % MOD;
    }
  cout << ans << '\n';

    cerr<<endl<<endl<<"Time: "<<fixed<<setprecision(12)<<(long double)(clock()-clk)/CLOCKS_PER_SEC<<" ms"<<endl<<endl;
 
    return 0;
}

Measured memory_bytes: 3328
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func getint(scanner *bufio.Scanner) int {
	if scanner.Scan() {
		i, _ := strconv.Atoi(scanner.Text())
		return i
	}
	return 0
}

type Entry struct {
	key   rune
	value int
}
type List []Entry

func (l List) Len() int {
	return len(l)
}

func (l List) Swap(i, j int) {
	l[i], l[j] = l[j], l[i]
}

func (l List) Less(i, j int) bool {
	return l[i].key < l[j].key
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	n := getint(scanner)
	s := []string{}
	for scanner.Scan() {
		n -= 1
		if n < 0 {
			break
		}
		x := strings.NewReader(scanner.Text())
		m := make(map[rune]int)
		for {
			ch, _, err := x.ReadRune()
			if err != nil {
				break
			}
			m[ch] += 1
		}
		y := List{}
		for k, v := range m {
			y = append(y, Entry{k, v})
		}
		sort.Sort(y)
		var z string
		for _, e := range y {
			z += string([]rune{e.key}) + ":" + strconv.Itoa(e.value) + ","
		}
		s = append(s, z)
	}

	ana := make(map[string]int)

	for _, sn := range s {
		ana[sn] += 1
	}
	sum := 0
	for _, v := range ana {
		v = v - 1
		if v > 0 {
			sum += (v + 1) * v / 2
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 18688
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<queue>
using namespace std;
char s[20];
long long ans, n;
bool pls[20];
long long calc()
{
    long long t = 0, sum = 0;
    for (int i = 0; i < n - 1; ++i)
    {
        t = t * 10 + s[i];
        if (pls[i])
        {
            sum += t;
            t = 0;
        }
    }
    t = t * 10 + s[n - 1];
    return t + sum;
}
void dfs(int k)
{
    if (k == n - 1)
    {
        ans += calc();
        return;
    }
    pls[k] = false;
    dfs(k + 1);
    pls[k] = true;
    dfs(k + 1);
}
int main()
{
    cin >> s;
    n = strlen(s);
    for (int i = 0; i < n; ++i)
        s[i] -= '0';
    dfs(0);
    cout << ans << endl;
    return 0;
}

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

int main()
{
	int H, W, res = 0;
	cin >> H >> W;
	vector<vector<int>> c(H, vector<int>(W)), dp(H, vector<int>(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> c[i][j];
			if (c[i][j] == 0) {
				dp[i][j] = 1;
				if (i - 1 >= 0 && j - 1 >= 0) {
					int d = min(dp[i - 1][j], dp[i][j - 1]);
					dp[i][j] = max(dp[i][j], d + (c[i - d][j - d] ? 0 : 1));
				}
				res = max(res, dp[i][j]);
			}
		}
	}
	cout << res * res << endl;
	return 0;
}

Measured memory_bytes: 18088
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    cin>>n>>s;
    /*for(int i=0 ; i<n ; i++)
        cout<<s[i];*/
    if(s.size()>n)
        s=s.substr(0,n)+"...";
    cout<<s<<"\n";
    return 0;
}


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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int gcd( int a, int b ){


    if( a < b ) swap(a,b);
    if( b==0 ) return a;

    int r;

    r = a % b;
    while( r ){
        a = b;
        b = r;
        r = a%b;
    }

    return b;

}

int main() {

    int N;
    Scd(N);
    int k = 1;
    while( k*k <= N ){
        k++;
    }

    vector<int> a(k*k);
    Rep(i,N){
        Scd(a[i]);
    }


    vector<int> b(k);

    int r = 0;
    Rep(i,k){
        r = a[k*i];
        Rep(j,k){
            r = gcd(a[k*i+j],r);
        }
        b[i] = r;
    }

    int ans = 0;

    Rep(i,N){
        if( i != 0 ) r = a[0];
        else r = a[1];
        Rep(j,k){
            if( i >= j*k && i < (j+1)*k){
                Rep(l,k){
                    if( i == j*k+l ) continue;
                    r = gcd( r, a[j*k+l] );
                }
            }else{
                r = gcd( r, b[j] );
            }
        }
        ans = max( r,ans );
    }

    printf ("%d\n", ans );




    return 0;
}



Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if((((a - b) * (a - b) > d * d) || ((b - c) * (b - c) > d * d)) && (a - c) * (a - c) > d * d)
    cout << "No" << endl;
    else 
    cout << "Yes" << endl;
    return 0; 
}

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

using namespace std;

struct Node
{
	int value;
	Node* prev;
	Node* next;
};

Node* nil;

void insertValue(int value)
{
	Node* node = (Node*)malloc(sizeof(Node));
	node->value = value;
	node->next = nil->next;
	node->prev = nil;
	node->next->prev = node;
	nil->next = node;
}

void deleteNode(Node* node)
{
	if (node == nil) return;
	node->prev->next = node->next;
	node->next->prev = node->prev;
	free(node);
}

void deleteValue(int value)
{
	Node* node = nil->next;
	while(node->value != value && node != nil)
	{
		node = node->next;
	}
	deleteNode(node);
}

int main(int argc, char const *argv[])
{
	nil = (Node*)malloc(sizeof(Node));
	nil->next = nil;
	nil->prev = nil;

	int n = 0;
	char cmd[20];
	int value;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		scanf("%s %d", cmd, &value);
		if (strcmp(cmd, "insert") == 0)
		{
			insertValue(value);
		} else if(strcmp(cmd, "deleteFirst") == 0) {
			deleteNode(nil->next);
		} else if (strcmp(cmd, "deleteLast") == 0) {
			deleteNode(nil->prev);
		} else {
			deleteValue(value);
		}
	}
	Node* node = nil->next;
	while(node != nil->prev)
	{
		cout << node->value << " ";
		node = node->next;
	}
	cout << node->value << endl;
	return 0;
}

Measured memory_bytes: 32420
use std::io::stdin;

fn main() {
    let mut s = String::new();
    let t = 753;
    stdin().read_line(&mut s).unwrap();
    let s: Vec<_> = s.trim().chars().flat_map(|v|v.to_digit(10)).collect();
    let mut result = 753;
    for ((&a, &b), &c) in s.iter().zip(s.iter().skip(1)).zip(s.iter().skip(2)) {
        let mut v = a * 100 + b * 10 + c;
        if v > t {
            v = v - t;
        } else {
            v = t - v;
        }
        if v < result {
            result = v;
        }
    }
    println!("{}", result);
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

using vec = vector<int>;
using mat = vector<vec>;
 
vec mul(mat &A, vec &B, ll mod) {
  vec C(A.size());
  for (int i = 0; i < A.size(); i++) for (int j = 0; j < B.size(); j++) {
    (C[i] += A[i][j] * B[j]) %= mod;
  }
  return C;
}

mat mul(mat &A, mat &B, ll mod) {
  mat C(A.size(), vec(B[0].size()));
  for (int i = 0; i < A.size(); i++) for (int k = 0; k < B.size(); k++) for (int j = 0; j < B[0].size(); j++) {
    (C[i][j] += A[i][k] * B[k][j]) %= mod;
  }
  return C;
}
 
mat mat_pow(mat A, ll n, ll mod) {
  mat B(A.size(), vec(A.size()));
  for (int i = 0; i < A.size(); i++) {
    B[i][i] = 1;
  }
  while (n) {
    if (n & 1) B = mul(B, A, mod);
    A = mul(A, A, mod);
    n >>= 1;
  }
  return B;
}

int N, M, A, B, C, T;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> N >> M >> A >> B >> C >> T, N) {
    mat D(N, vec(N));
    for (int i = 0; i < N; i++) {
      if (i != 0) D[i][i - 1] = A;
      D[i][i] = B;
      if (i + 1 != N) D[i][i + 1] = C;
    }

    vec E(N);
    for (int i = 0; i < N; i++) {
      cin >> E[i];
    }

    D = mat_pow(D, T, M);
    E = mul(D, E, M);
    for (int i = 0; i < N; i++) {
      cout << E[i] << " \n"[i + 1 == N];
    }
  }

  return 0;
}


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

template<class like_bool> inline void YES(like_bool condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class like_bool> inline void Yes(like_bool condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class like_bool> inline void POSS(like_bool condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class like_bool> inline void Poss(like_bool condition){ if(condition)cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class like_bool> inline void First(like_bool condition){ if(condition)cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

int main(){
    int A, B;
    cin >> A >> B;
    if((A + 11) % 13 > (B + 11) % 13){
        cout << "Alice" << endl;
    }else if((A + 11) % 13 < (B + 11) % 13){
        cout << "Bob" << endl;
    }else{
        cout << "Draw" << endl;
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define hell        1000000007
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.000000001
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 1e7+1;
const long long mod = (long long) 998244353;

using namespace std;
void solve();

void fastIO() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);


/*class CompareDist
{
public:
    bool operator()(pair<ll,int> a,pair<ll,int> b) {
        if(a.F!=b.F)
        return a.F<b.F;
        else
        return a.S>b.S;
    }
};*/


void solve(){

  int test;
  //cin>>test;
  test=1;
  while(test--){
    int n;
    string s;
    cin>>n>>s;
    if(n&1){
      cout<<"No";
      return;
    }

    for(int i=0;i<n/2;i++){
      if(s[i]!=s[i+n/2]){
        cout<<"No";
        return;
      }
    }
    cout<<"Yes";
  }
}

/*bool issafe(int x,int y){
  return (x>=0 && y>=0 && x<n && y<m);
}*/

///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll x,ll y){
  if(x==0)
  return y;
  else
  return gcd(y%x,x);
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1)%hell)*k%hell)%hell;
  else
  return ((pw(k,x/2)%hell)*(pw(k,x/2)%hell))%hell;
}

/*void sieve(){

  for(int i=2;i<=1000000;i++){
    if(prime[i]==true){
      for(int j=i*i;j<=1000000;j+=i)
      prime[j]=false;
    }
  }

}*/


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

using namespace std;

#define REP(i,x,y) for (int i=x;i<y;i++)

const int8_t INFC=0x3f;
const int16_t INFS=0x3f3f;
const int32_t INF=0x3f3f3f3f;
const int64_t INFL=0x3f3f3f3f3f3f3f3fLL;

int main()
{
    ios::sync_with_stdio(0);
    int a,b,c;
    cin >> a >> b >>c;
    if (a==b&&b==c)
    {
        cout << "Yes" <<endl;
    }else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

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

int solve(int E){
  int ans = E;
  for(int y=0; y*y<=E; ++y)
    for(int z=0; z*z*z<=E; ++z){
      int x;
      x = E-y*y-z*z*z;
      if(x>=0){
	if(ans>x+y+z){
	  ans = x+y+z;
	}
      }
    }
  return ans;
}
int main(){
  int E;
  while(cin >> E && E>0){
    cout << solve(E) << endl;
  }
}
	  

Measured memory_bytes: 1160
n=int(input())
s=input()
ans=[]
alle=list(s).count("E")
allw=n-alle
ecnt=wcnt=0
for i in range(n):
    if s[i] == "W":
        ans.append(wcnt+alle-ecnt)
        wcnt+=1
    else:
        ans.append(wcnt+alle-ecnt-1)
        ecnt+=1
print(min(ans))

Measured memory_bytes: 18788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  
  if( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' ){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N,i,ans;string S;cin>>N>>S;
  ll w[N+1];w[0]=0;ans=N;
  REP(i,N){
    w[i+1]=w[i];if(S[i]=='.')w[i+1]++;
  }
  REP(i,N+1)ans=min(ans,i-2*w[i]+w[N]);
  cout<<ans<<endl;
  return 0;
}


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

const int MaxN = 200000 + 5;

int N;
int A[MaxN], B[MaxN];

void init() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
}

void solve() {
  for (int i = N; i >= 1; --i) {
    B[i] = A[i];
    for (int j = i * 2; j <= N; j += i)
      B[i] ^= B[j];
  }
  int cnt = 0;
  for (int i = 1; i <= N; ++i) if (B[i] == 1) cnt++;
  printf("%d\n", cnt);
  for (int i = 1; i <= N; ++i)
    if (B[i] == 1) printf("%d ", i);
}

int main() {
  init();
  solve();
  return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<set>
using namespace std;
 
int main()
{
 multiset< int,greater<int> > s;
 multiset<int>::iterator it;
 int n,m,p,i;
 int cost;
 while(cin>>n>>m,n||m){
  s.clear();
  for(i=0;i<n;i++){
   cin>>p;
   s.insert(p);
  }
  cost=0;
  i=0;
  for(it=s.begin();it!=s.end();it++){
   if(++i==m) i=0;
   else cost += *it;
  }
  cout<<cost<<endl;
 }
 return 0;
}

Measured memory_bytes: 0
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int length = sc.nextInt();
		String[] str = new String[num];
		for (int i = 0; i < num; i++) {
			str[i] = sc.next();
		}

		Arrays.sort(str);
		for (int i = 0; i < num; i++) {
			System.out.print(str[i]);
		}
	}
}


Measured memory_bytes: 22100
X, K, D = map(int, input().split())

if X < 0 :
  X = -X
  
if K * D < X :
  print(X - K * D)
else :
  K -= (X // D)
  X = X % D
  if K % 2 == 0 :
    print(X)
  else :
    print(D - X)

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

int main() {
  int N;
  cin >> N;
  vector<int> b(N-1);
  for(int i = 0; i < N-1; i++){
    cin >> b.at(i);
  }
  
  int m = b.at(0);
  
  for(int j = 1; j <= N-2; j++){
    m += min(b.at(j-1),b.at(j));
  }
  
  m += b.at(N-2);
  cout << m << endl;
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let n: i64 = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line);
        line.trim().parse().unwrap()
    };
    let mut a: Vec<f64> = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line);
        line.split_whitespace().map(|a|a.parse().unwrap()).collect()
    };
    a.sort_by(|a,b| a.partial_cmp(b).unwrap());
    let mut ret: f64 = (a[0] + a[1]) / 2.0;
    for i in 2..a.len() {
        ret = (ret + a[i]) / 2.0
    }
    println!("{}",ret)

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

int main(){
    int n, h, w, a;
    cin >> n >> h >> w >> a;
    bool flg1 = false;
    bool flg2 = false;
    bool flg3 = false;
    bool flg4 = false;
    if(n==1 || h==1 || w==1 || a==1){flg1=true;}
    if(n==9 || h==9 || w==9 || a==9){flg2=true;}
    if(n==7 || h==7 || w==7 || a==7){flg3=true;}
    if(n==4 || h==4 || w==4 || a==4){flg4=true;}


    if(flg1&&flg2&&flg3&&flg4){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int k = stdIn.nextInt();
        // int c = stdIn.nextInt();
        // String s = stdIn.next();
        // boolean flag = true;
        
        int count = 0;
        
        while(true){
            if(n == 0){
                break;
            }else{
                n /= k;
                count++;
            }
        }
        
        System.out.println(count);
        
        // int num[] = new int[n];
        
        // for(int i = 0; i < n; i++){
        //     num[i] = stdIn.nextInt();
        // }
        
        // char c[] = s.toCharArray();
        
        // for(int i = 0; i < s.length(); i++){
        //     c[i];
        // }
        
        // if(flag){
        //     System.out.println("Yes");
        // }else{
        //     System.out.println("No");
        // }
        
        // System.out.println();
        // System.out.print();
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// まずは全探索，次にDP
// 偶奇，逆から，ソート，出現回数，出現位置，DP
// 余事象，包除
// データ構造
// 問題の特徴量
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
int main() {
cin.tie(0);
ios::sync_with_stdio(false);

int N; cin >> N;
VI d(N); rep(i, 0, N) cin >> d[i];
int sum = 0;
rep(i, 0, N)
    rep(j, i+1, N){
        sum += d[i] * d[j];
    }


cout << sum << "\n";
}

// 境界，出力文字列 チェック



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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int _, A, B; cin >> _ >> A >> B;
  cout << (abs(A - B) % 2 == 0 ? "Alice" : "Borys") << "\n";
}


Measured memory_bytes: 256
def solve(string):
    l = [s == "1" for s in string]
    l_r = l[::-1]
    index = 0
    h = len(string) // 2
    for i, (c, n, c_r, n_r) in enumerate(zip(l[:h], l[1:h + 1], l_r[:h], l_r[1:h + 1])):
        if c ^ n or c_r ^ n_r:
            index = i + 1
    return str(len(string) - index)


if __name__ == '__main__':
    print(solve(input()))


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

int main()
{
    int n,r,t,s;
    cin>>n>>r;
    if(n<10)
    {
        t=100*(10-n);
        s=t+r;
        cout<<s;
    }
    else{
        cout<<r;
    }
    return 0;
}


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

using namespace std;

int main() {
  int x = 0,n;
  string s;
  cin >> n >> s;
  
  int ma = 0;
  for(int i = 0; i < n; i++) {
    if(s[i] == 'I') x++;
    else x--;
    ma = max(ma,x);
  }

  cout << ma << endl;
}

Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int main(){
    int k = 0;
    int a[5];
    while(1){
        int sum;
        cin >> sum;
        if(sum == 0)break;
        for (int i = 0;i < 9;i++){
            int p;
            cin >> p;
            sum -= p;
        }
        a[k] = sum;
        k++;
    }
    for(int i = 0;i < k;i++){
        cout << a[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3012