akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int l;
char s[102],c[102],t[102],a;
int main()
{ cin>>s>>t;
  if(strcmp(s,t)==0)
  { cout<<"Yes";
    return 0;
  }
  l=strlen(s);
  strcpy(c,s);
  a=c[0];
  for(int i=1;i<l;i++)
    c[i-1]=c[i];
  c[l-1]=a;
  while(strcmp(s,c)!=0)
  { if(strcmp(c,t)==0)
    { cout<<"Yes";
      return 0;
    }
    a=c[0];
    for(int i=1;i<l;i++)
      c[i-1]=c[i];
    c[l-1]=a;
  }
  cout<<"No";
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <vector>
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define REPR(i, n) for (int i = n-1; i >= 0; --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTG(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<n)
#define bit_check(bit, i) (bit>>i) & 1
#define setpre(n) fixed << setprecision(n)
#define ENDL cout << endl;
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VP = vector<PII>;
using VI = vector<int>;
using VVI = vector<VI>;
using Vll = vector<ll>;
using VVll = vector<Vll>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;

int main(){
  int N, M;
  cin >> N >> M;
  int limit = M / N;
  int ans = 1;
  REP(i, min(limit, (int)sqrt(M)))
  {
    if (M % (i+1) == 0)
    {
        ans = max(ans, i + 1);
        if (M / (i + 1) <= limit) ans = max(ans, M / (i + 1));
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
    long a,b;
    long i,j;
    long len;
    char S[100001];
    a = 0;
    b = 0;
    gets(S);
    len = strlen(S);
    if(len == 1){
        printf("0\n");
        return 0;
    }
    //1スタートの場合
    for(i=0;i<len;i++){
        if ((S[i]=='0') && (i % 2 == 0)){
            a++;
        }
        if ((S[i]=='1') && (i % 2 == 1)){
            a++;
        }
    }

    //0スタートの場合
    for(i=0;i<len;i++){
        if ((S[i]=='1') && (i % 2 == 0)){
            b++;
        }
        if ((S[i]=='0') && (i % 2 == 1)){
            b++;
        }
    }
    if(a<b){
        printf("%ld\n",a);
    }else{
        printf("%ld\n",b);
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int x, n, a[100] = { 0 }, hasi;
	for (int i0 = 0;i0 < 100;i0++) {
		cin >> n;
		cin >> x;
		if (n == 0 && x == 0) {
			break;
		}
		for (int i = 0;i < n;i++) {
			for (int i2 = i + 1;i2 < n;i2++) {
				for (int i3 = i2 + 1;i3 < n;i3++) {
					if (i + i2 + i3 + 3 == x) {
						a[i0] = a[i0] + 1;
					}
				}
			}
		}
		hasi = i0;
	}
	for (int i = 0;i <= hasi;i++) {
		cout << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
#include<stdio.h>
#include<string.h>
#define M 1000
 
int A[M+1][M+1];
int longest(char x[M+1],char y[M+1]){
  int i,j,a,b;
  a = strlen(x);
  b = strlen(y);
  for(i  = 1;i<=a; i++){
    for(j = 1; j <= b; j++){
      if(x[i-1] == y[j-1])A[i][j]=A[i-1][j-1] + 1;
      else if(x[i-1] != y[j-1])A[i][j] = max(A[i-1][j],A[i][j-1]);
    }
  }
  return A[a][b];
}
 
int max(int a,int b){
  if(a>= b)return a;
  else if(a < b)return b;
}
 
int main(){
  int i,n;
  char x[M+1],y[M+1];
  scanf("%d", &n);
  for(i = 0;i<n;i++){
    scanf("%s", x);
    scanf("%s",y);
    printf("%d\n", longest(x,y));
  }
 
  return 0;
}
/*
#include<stdio.h>
#include<string.h>
#define M 1000
  
int A[M+1][M+1];
int longest(char x[M+1],char y[M+1]){
  int i,j,a,b;
  a = strlen(x);
  b = strlen(y);
  for(i  = 1;i<=a; i++){
    for(j = 1; j <= b; j++){
      if(x[i-1] == y[j-1])A[i][j]=A[i-1][j-1] + 1;
      else if(x[i-1] != y[j-1])A[i][j] = max(A[i-1][j],A[i][j-1]);
    }
  }
  return A[a][b];
}
  
int max(int a,int b){
  if(a>= b)return a;
  else if(a < b)return b;
}
  
int main(){
  int i,n;
  char x[M+1],y[M+1];
  scanf("%d", &n);
  for(i = 0;i<n;i++){
    scanf("%s", x);
    scanf("%s",y);
    printf("%d\n", longest(x,y));
  }
  
  return 0;
  }*/



Measured memory_bytes: 5640
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 200001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

int main(){
  ll n; cin >> n; ll cnt = 1;
  
  ll nd = n;
  ll pow = 26; bool flag = true;
  while(flag){
    if(nd <= pow) break;
    nd -= pow;
    pow *= 26;
    cnt++;
  }
  
  nd -= 1;
  string s = "";
  rep(i,cnt) s += 'a';
  for(ll i=0; i < cnt; i++){
    for(ll j=0; j <= 26; j++){
      if(nd % 26 == j){
        s[cnt-1-i] = small[j];
        nd /= 26;
        break;
      }
    }
  }
  
  cout << s << endl;
  
}

Measured memory_bytes: 3628
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
// now

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0) : d(n,-1){}
    int Find (int x){//根の番号を探す
        if(d[x] < 0) return x;
        return d[x] = Find(d[x]);
    }
    bool unite (int x, int y){
        x = Find(x); y = Find(y);
        if(x == y ) return false;
        if(d[x] < d[y]){
            swap(x,y);
        }
        d[x] += d[y];
        d[y] = x;
        return true;
    } 

    bool same(int x, int y){
        return Find(x) == Find(y);
    }
    int size(int x) {
        return (-d[Find(x)]);
    }
};


ll nCr (ll n, ll r){
    ll ans = 1;
    for(ll i = n ; i > n-r ; i --){
        ans *= i;
    }
    for(ll i = 1 ; i<= r; i ++){
        ans /= i;
    }
    return ans ;
}

int nPr (int n,int r){
    int ans = 1;
    for(int i = n ; i > n-r ; i --){
        ans *= i;
    }
    return ans ;
}
 ll modd = 1e9+ 7;
ll wa (ll n,ll mi, ll ma){
    ll ans  = n * (mi+ma) /2;
    return ans;
}
ll kw(ll k,ll n){
    
    ll ans  =0;
    ll mi,ma;
    mi= wa(k,0,k-1);
    
    ma = wa(k,n-k+1,n);
    
    return (ma-mi +1)%modd;
}

int main(){
    ll n;
    ll d = 1e9+7;
    cin >> n;
    vector<ll> vec(n);
    ll sum = 0;

    REP(i,n){
        cin >> vec[i];
        sum+= vec[i];
        sum %= d;
    }

    ll ans = 0;
    REP(i,n){
        sum -= vec[i];
        if(sum < 0) sum += d;
        ans += vec[i]*sum;
        ans %=d;
    }
    cout << ans <<endl;

    
}





Measured memory_bytes: 4852
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=200005,mod=1e9+7;
int inv2=(mod+1)/2;
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
int n,S=1;
int a[N],b[N],p[N];
namespace bit{
	int c[N];
	void add(int x,int d){
		for (;x<=n;x+=x&-x)
			Add(c[x],d);
	}
	int Ask(int x){
		int ans=0;
		for (;x;x-=x&-x)
			Add(ans,c[x]);
		return ans;
	}
}
bool cmp1(int x,int y){
	return a[x]<a[y];
}
bool cmp2(int x,int y){
	return x<y;
}
int pre[N];
int main(){
	n=read();
	For(i,1,n){
		a[i]=read();
		b[a[i]]++;
	}
	Fod(i,n,1)
		b[i]+=b[i+1];
	For(i,1,n)
		b[i]-=n-i;
	For(i,1,n){
		if (b[i]<=0)
			return puts("0"),0;
		S=(LL)S*b[i]%mod;
	}
	For(i,1,n)
		p[i]=i;
	sort(p+1,p+n+1,cmp1);
	int ans=0;
	for (int i=1,j;i<=n;i=j){
		for (j=i+1;j<=n;j++){
			int flag=0;
			For(k,a[p[j-1]]+1,a[p[j]])
				if (b[k]==1){
					flag=1;
					break;
				}
			if (flag)
				break;
		}
		int mi=a[p[i]],mx=a[p[j-1]];
		pre[mi]=1;
		For(k,mi+1,mx)
			pre[k]=(LL)pre[k-1]*(b[k]-1)%mod*Pow(b[k],mod-2)%mod;
		sort(p+i,p+j,cmp2);
		For(k,i,j-1){
			int x=p[k];
			if (k>i){
				int t=(LL)bit::Ask(a[x])*pre[a[x]]%mod;
				Add(ans,(LL)t*S%mod*inv2%mod);
			}
			bit::add(a[x],Pow(pre[a[x]],mod-2));
		}
		For(k,i,j-1)
			bit::add(a[p[k]],Del(-Pow(pre[a[p[k]]],mod-2)));
		For(k,i,j-1){
			int x=p[k];
			if (k>i){
				int t=Del(bit::Ask(n)-bit::Ask(a[x]));
				t=(LL)t*Pow(pre[a[x]],mod-2)%mod;
				Del(ans,(LL)t*S%mod*inv2%mod);
			}
			bit::add(a[x],pre[a[x]]);
		}
		For(k,i,j-1)
			bit::add(a[p[k]],Del(-pre[a[p[k]]]));
	}
	For(i,1,n){
		int t=bit::Ask(n)-bit::Ask(a[i]);
		bit::add(a[i],1);
		Add(ans,(LL)S*t%mod);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4096
A, B, m = map(int, input().split()) 
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = min(a)+ min(b)

for i in range(m):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x -1] + b[y - 1] - c) 
print(ans)

Measured memory_bytes: 24768
n, m = map(int, input().split())
a = []
b = []
for i in range(n):
    ai = list(map(int, input().split()))
    a.append(ai)
for i in range(m):
    bi = int(input())
    b.append(bi)

for i in range(n):
    ci = 0
    for j in range(m):
        ci += a[i][j] * b[j]
    print(ci)

Measured memory_bytes: 7960
def gcd(a, b):
    r = a % b
    while r != 0:
        a, b, r = b, r, b % r
    return b

class query:
    def __init__(self, a, b, c, d):
        self.a = a
        self.b = b
        self.c = c
        self.d = d
    def isEternal(self):
        if self.a < self.b:
            return "No"
        if self.d < self.b:
            return "No"
        if self.b <= self.c:
            return "Yes"
        g = gcd(self.d, self.b)
        if self.b - g + self.a % g > self.c:
            return "No"
        return "Yes"

if __name__ == "__main__":
    t = int(input())
    querys = [query(*[int(s) for s in input().split()]) for _ in range(t)]
    for q in querys:
        print(q.isEternal())


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


int main() {
    int N;
    cin >> N;
    int money = 1000;
    if (N % money == 0) {
        cout << 0 << endl;
    } else if (N <= money){
        cout << money - N << endl;
    } else {
        cout << (money * (N / money + 1)) % N << endl;
    }
}


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

using namespace std;

typedef long long ll;

#define INF (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
//#define N 100005
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795


ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll N=2e5+1;

ll solve(ll t,vector<ll>& a,ll n)
{
  ll ans=0;
  for(int i=1;i<=n;i++)
    ans+=(a[i]-t)*(a[i]-t);

  return ans;

}


ll bx(ll n)
{
  ll temp=10;
  while(n)
  {
    temp=min(temp,n%10);
    n/=10;
  }
  return temp;
}

ll ax(ll n)
{
  ll temp=0;
  while(n)
  {
    temp=max(temp,n%10);
    n/=10;
  }
  return temp;
}



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


ll k;cin>>k;
queue<ll>q;
for(int i=1;i<=9;i++)q.push(i);

  ll cnt=0,above;
while(cnt!=k)
{
  cnt++;
   above=q.front();
  q.pop();
  ll temp=above*10+above%10;
  if(above%10!=0)q.push(temp-1);
  q.push(temp);
  if(above%10!=9)q.push(temp+1);
  
}

cout<<above<<"\n";

return 0;

}

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

typedef pair<int,int> pii;
typedef pair<pii,int> piipi;

int n;

bool cek_bit(int id, int mask){
	return (1<<id) & mask;
}

int cnt_bit(int x){
	int ret = 0;
	while(x > 0){
		ret++;
		x/=2;
	}
	return ret;
}

vector<piipi> li;

int main(){
//	for(int i=0;i<20;i++){
//		printf(">>> %d\n",(1<<i));
//	}
	scanf("%d",&n);
	n--;
	if(n==1){
		printf("2 2\n");
		printf("1 2 0\n");
		printf("1 2 1\n");
		return 0;
	}
	int pan = cnt_bit(n);
	printf("%d ",pan);
	for(int i=1;i<pan;i++){
		li.push_back(make_pair(make_pair(i,i+1),(1<<(pan-i-1))));
		li.push_back(make_pair(make_pair(i,i+1),0));
	}
	int cur = (1<<(pan-1));
	int idx = 2;
	for(int i=pan-2;i>=0;i--){
		if(cek_bit(i,n)){
			li.push_back(make_pair(make_pair(1,min(pan,idx)),cur));
			cur+=(1<<i);
		}
		idx++;
	}
	li.push_back(make_pair(make_pair(1,pan),cur));
	printf("%d\n",li.size());
	for(int i=0;i<li.size();i++){
		printf("%d %d %d\n",li[i].first.first,li[i].first.second,li[i].second);
	}
	return 0;
}

/*

10010101


 
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    char a[55][55],b[55][55];
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)cin>>a[i][j];
    for(int i=0;i<m;i++)
        for(int j=0;j<m;j++)cin>>b[i][j];
    for(int i=0;i<n-m+1;i++)
    {
        for(int j=0;j<n-m+1;j++)
        {
            int flag=1;
            for(int k=0;k<m;k++)
            {
                for(int l=0;l<m;l++)
                {
                    if(a[k+i][l+j]!=b[k][l]){flag=0;break;}
                }
                if(flag==0)break;
            }
            if(flag==1){cout<<"Yes"<<endl;return 0;}
        }
    }
    cout<<"No"<<endl;
}


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

int main() {
	while(1){
		int n,sum=0;
		cin>>n;
		if(n==0)
			break;
		int s[n];
		for(int i=1; i<=n; i++)
			cin>>s[i];
		for(int i=1; i<=n; i++){
			int v=s[i];
			if(s[i]<=s[1]){
				s[i]=s[1];
				s[1]=v;
			}
			if(s[i]>=s[n]){
				s[i]=s[n];
				s[n]=v;
			}
		}
		for(int i=2; i<=n-1; i++)
			sum+=s[i];
		cout<<sum/(n-2)<<endl;
	}
			
			
				
	
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>

#define ll long long 
using namespace std;

const ll smax = 1e5;
const ll mod = 1e9 + 7;

ll p[smax+1];

string s;


void power(){
	ll x=1;
	for(int i=0;i<smax;i++){
		p[i]=x;
		x *= 3;
		x %= mod;
	}
}


void solve(){
	int a[s.length()], c[s.length()];
	int q_l[s.length()], q_r[s.length()];
	int a_count=0; int c_count=0; int q_count=0;
	for(int i=0;i<s.length();i++){
		if(s[i]=='A') a_count++;
		if(s[i]=='?') q_count++;
		a[i]=a_count; q_l[i]=q_count;
	}
	q_count=0;
	for(int i=s.length()-1;0<=i;i--){
		if(s[i]=='C' ) c_count++;
		if(s[i]=='?') q_count++;
		c[i]=c_count; q_r[i]=q_count;
	}

	ll ans=0;

	for(int i=1;i<s.length()-1;i++){
		if(s[i]=='B'||s[i]=='?'){
			ll ans_0 = a[i-1]*p[q_l[i-1]] + q_l[i-1]*p[q_l[i-1]-1];
			ll ans_1 = c[i+1]*p[q_r[i+1]] + q_r[i+1]*p[q_r[i+1]-1];
			ans_0 %= mod; ans_1 %= mod;
			ans += ans_0*ans_1;
			ans %= mod;
		}
	}

	cout << ans << endl;




}

int main(){
	cin >> s;

	power();
	solve();
	return 0;
}

Measured memory_bytes: 2816
#include <stdio.h>
#include <string.h>
#define CARDS 36
#define SUIT 4
#define NUMBER 9

void BubbleSort( char cards[CARDS][3], int N){
    int i,j,k;
    int tmp;

    for(i = 0; i < N;i++){
        for(j = N - 1;j > i;j--){
            if(strcmp( &cards[j][1], &cards[j-1][1]) < 0){
                for(k = 0;k < 2;k++){
                    tmp = cards[j-1][k];
                    cards[j-1][k] = cards[j][k];
                    cards[j][k] = tmp;
                }
            }
        }
    }

    for(i = 0; i < N - 1;i++){
        printf("%c%c ", cards[i][0], cards[i][1]);
    }
    printf("%c%c\n", cards[N -1][0], cards[N - 1][1]);

    return;
}

void SelectionSort( char cards[CARDS][3], int N){
    int i,j,k;
    int mini;
    char tmp;

    for(i = 0; i < N - 1;i++){
        mini = i;
        for(j = i + 1;j < N;j++){
            if(strcmp( &cards[j][1], &cards[mini][1]) < 0){
                mini = j;
            }
        }
        for(k = 0;k < 2;k++){
            tmp = cards[mini][k];
            cards[mini][k] = cards[i][k];
            cards[i][k] = tmp;
        }
    }

    for(i = 0; i < N - 1;i++){
        printf("%c%c ", cards[i][0], cards[i][1]);
    }
    printf("%c%c\n", cards[N -1][0], cards[N - 1][1]);

    return;
}

void Checker( char cards[CARDS][3], char check[NUMBER][SUIT+1], int N){
    int i,j,num = 0;
    for(i = 0;i < N;i++){
        num = cards[i][1] - '0';
        for(j = 0;j < 4;j++){
            if(check[num-1][j] == '\0'){
                check[num-1][j] = cards[i][0];
                break;
            }
        }
    }
}

void StableChecker(char SortCheck[NUMBER][SUIT+1],char check[NUMBER][SUIT+1]){
    int i,j,stable_cnt = 0;

    for(i = 0;i < NUMBER;i++){
        for(j = 0;j < SUIT;j++){
            if(SortCheck[i][j] != check[i][j]){
                stable_cnt++;
            }
        }
    }
    if(stable_cnt == 0){
        printf("Stable\n");
    }else{
        printf("Not stable\n");
    }

}
int main(void){
    int N,i,j,num = 0;
    char cards[CARDS][3];
    char Bubble[CARDS][3];
    char Selection[CARDS][3];

    char check[NUMBER][SUIT+1] = {0};
    char Bubblecheck[NUMBER][SUIT+1] = {0};
    char Selectioncheck[NUMBER][SUIT+1] = {0};

    scanf("%d" ,&N);

    for(i = 0;i < N;i++){
        scanf("%s", cards[i]);
    }

    /*copy array*/
    memcpy(Bubble,cards,sizeof cards);
    memcpy(Selection,cards,sizeof cards);

    Checker(cards,check,N);

    BubbleSort(Bubble,N);
    Checker(Bubble,Bubblecheck,N);
    StableChecker(Bubblecheck,check);

    SelectionSort(Selection,N);
    Checker(Selection,Selectioncheck,N);
    StableChecker(Selectioncheck,check);

    return 0;
}

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

const ll MAXN = 200000;

ll N, K, ans=0, tmp=0;
vector<ll> A(MAXN, 0);

const int MAX = 510000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
signed main(){
    cin >> N >> K;
    COMinit();
    for(int i=1;i<=K;i++) {
        if(i>N-K+1) {
            cout << 0 << endl;
        }
        else {
            ans = COM(N-K+1, i)*COM(K-1, i-1);
            ans %= MOD;
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 13824
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {

  int N;
  vector<int> v;
  cin >> N;
  int total = N/2;
  for (int i = 0; i <  N; i++) {
    int t;
    cin >> t;
    total += t;
    v.push_back(t);
  }
  int mid = total/v.size();
  int result = 0;
  for (int i = 0; i < v.size(); i++) {
    result += pow(abs(v[i] - mid),2);
  }
  cout << result;

  return 0;
}


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

typedef long long ll;

using namespace std;

int n, Q;
string s;

void update(int x, vector<int> &d, vector<int> &salsas)
{
    if (salsas[x] != Q)
    {
        salsas[x] ^= 1;
        if (d[x] == 1) d[x] = 2;
        else if (d[x] == 2) d[x] = 1;
    }
}

pair<vector<int>, vector<int> > solve(vector<int> last_p, vector<int> last_w)
{
    vector<int> p(3 * last_p.size()), w;
    int n = last_p.size();

    Q = 0;
    vector<int> d(3 * last_p.size());
    vector<int> salsas(3 * last_p.size());
    for (int i = 0; i < n; i++) d[i] = 0;
    for (int i = n; i < 2 * n; i++) d[i] = 1;
    for (int i = 2 * n; i < 3 * n; i++) d[i] = 2;

    for (int i = 0; i < s.size(); i++)
    {
        int x = last_w[i];

        update(x, d, salsas);
        update(x + n, d, salsas);
        update(x + 2 * n, d, salsas);

        if (d[x] == 2) w.push_back(x);
        if (d[n + x] == 2) w.push_back(n + x);
        if (d[2 * n + x] == 2) w.push_back(2 * n + x);
        if (s[i] == 'S')
        {
            Q ^= 1;
        }
        else
        {
            int x = last_w[i];
            d[x] = (d[x] + 1) % 3;
            d[n + x] = (d[n + x] + 1) % 3;
            d[2 * n + x] = (d[2 * n + x] + 1) % 3;
        }
    }

    for (int i = 0; i < 3 * n; i++) update(i, d, salsas);
    for (int i = 0; i < 3 * n; i++)
    {
        p[i] = last_p[i % n] + d[i] * n;
    }

    return {p, w};
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n;
    #ifdef LOCAL
    string ss;
    cin >> ss;
    while (s.size() < 200000) s += ss;
    #else
    cin >> s;
    #endif // LOCAL

    vector<int> last_p = {0, 1, 2};
    vector<int> last_w;
    for (int i = 0; i < s.size(); i++)
    {
        for (int j = 0; j < 3; j++) if (last_p[j] == 2) last_w.push_back(j);
        if (s[i] == 'S')
        {
            int t = 1;
            for (int k = 0; t && k < 3; k++)
            {
                for (int j = 0; t && j < 3; j++)
                {
                    if (last_p[k] == 2 && last_p[j] == 1)
                    {
                        swap(last_p[k], last_p[j]);
                        t = 0;
                    }
                }
            }
        }
        else
        {
            for (int j = 0; j < 3; j++) last_p[j] = (last_p[j] + 1) % 3;
        }
    }
    for (int i = 1; i < n; i++)
    {
        pair<vector<int>, vector<int> > gg = solve(last_p, last_w);
        last_p = gg.first;
        last_w = gg.second;
    }
    #ifdef LOCAL
    //return 0;
    #endif // LOCAL
    for (int i = 0; i < last_p.size(); i++)
    {
        cout << last_p[i] << " ";
    }
}


Measured memory_bytes: 16552
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b){
	while(b){
		a %= b;
		swap(a, b);
	}
	return a;
}
int who_wins(vector<int> a){
	int q[2] = {};
	for(int v : a) q[v % 2]++;
	if(q[0]%2){
		return 1;
	}
	if(q[1] > 1){
		return 2;
	}
	for(int &v : a) if(v%2){
		if(v == 1) return 2;
		v--;
	}
	int g = 0;
	for(int v : a) g = gcd(g, v);
	for(int & v : a) v /= g;
	return 3 - who_wins(a);
}
int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	if(who_wins(a) == 1) cout << "First" << endl;
	else cout << "Second" << endl;
	return 0;
}


Measured memory_bytes: 9984
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple

int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n; cin>>n;
	cout<<fixed<<setprecision(10);
	double ans = 0.0;
	for(int i=0;i<n;i++)
	{
	    double p; cin>>p;
	    ans += 1.0/p;
	}
	ans = 1.0/ans;
	cout<<ans;
	
	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] xlist = new int[n];
        int[] ylist = new int[n];

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

        double ans = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                ans += Math.sqrt(Math.pow(xlist[i] - xlist[j], 2) + Math.pow(ylist[i] - ylist[j], 2));
            }
        }

        System.out.println(ans / n);
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
typedef pair<int, int> P;
typedef long long ll;
int dp[100][200100];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, k;
    cin >> n >> k;
    rep(i, n)
    {
        cin >> dp[0][i];
        dp[0][i]--;
    }
    rep(i, 90)
    {
        rep(j, n)
        {
            dp[i + 1][j] = dp[i][dp[i][j]];
        }
    }
    ll cur = 0;
    for (int i = 0; i < 100; i++)
    {
        if (k % 2)
        {
            cur = dp[i][cur];
        }
        k /= 2;
    }
    cout << cur + 1 << endl;
}

Measured memory_bytes: 74784
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>

int main() {

    char w[101];
    scanf("%s", w);

    int a[26];
    int l = strlen(w);

    //初期化
    for (int k = 0; k < 26; k++) {
        a[k] = 0;
    }

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

        //printf("%c %d\n", w[i], w[i]-'A'-32);
        int num = w[i] - 'A' - 32;
        a[num] += 1;

    }

    for (int j = 0; j < 26; j++) {
        int cnt = a[j];
        if (cnt % 2 != 0) {
            printf("No");
            return 0;
        }
    }
    printf("Yes");

    return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N;
  cin>>N;
  
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  
  vector<int> X(N);
  for(int i=0;i<N;i++){
    X[i]=vec[i];
  }
  sort(X.begin(),X.end());
  
  int sec=X[N-2];
  
  
  for(int i=0;i<N;i++){
    if(vec[i]!=X[N-1]){
      cout<<X[N-1]<<endl;
    }
    else{
      cout<<sec<<endl;
    }
  }
}

Measured memory_bytes: 4836
n,k=map(int,input().split())
ans=0
mod=10**9+7
for i in range(k,n+2):
    l=((i-1)*i)//2
    r=(n*(n+1))//2 - ((n-i)*(n-i+1))//2
#    print(i,l,r)
    ans+=r-l+1
    ans%=mod
    if ans<0:
        ans+=mod
print(ans)


Measured memory_bytes: 9188
#include<bits/stdc++.h>
#define maxn 100005
#define Mod 1000000007 
using namespace std;
int N;
int pos[maxn]; 
long long fac[maxn];
inline void build()
{
    fac[0] = 1; 
    for(int i=1;i<maxn;i++) 
    	fac[i] = (i*fac[i-1])%Mod; 
} 
int l,r;    // 重複元素位置
inline void input()
{
	cin >> N;
	N++; 
	for(int i=1;i<=N;i++)
	{ 
	    int x; 
	    cin >> x;
    	if(pos[x] != 0)
		    l = pos[x] , r = i;
		pos[x] = i; 
	}
}
inline long long Pow(long long,int);
inline long long C(int n,int m);     // C n 取 m 
inline void solve()
{
	int L = l+N-r;
	for(int k=1;k<=N;k++)
	{
		long long ans = C(N,k);
		long long fix = 0;
		if(k <= L)
		    fix = (C(L,k) - C(L-1,k) + Mod)%Mod;
		cout << (ans-fix+Mod)%Mod << endl; 
	} 
} 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    build(); 
    input();
    solve(); 
	return 0;
}
inline long long Pow(long long a,int b)
{ 
    long long ret = 1 , base = a;
	while(b)
	{
		if(b&1)    ret = (ret*base)%Mod;
		base = (base*base)%Mod;
		b>>=1; 
	} 
	return ret; 
}
inline long long C(int n,int m)
{
	long long ret = fac[n];
	long long fix = (fac[m]*fac[n-m])%Mod;
	return ( ret*Pow(fix,Mod-2) ) %Mod; 
}

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

"""
input:
3 5
0 0 1
0 1 2
0 2 3
1 0 2
1 1 2

output:
1
2
"""

import sys
from math import ceil, log2, isinf


class SegmentTree(object):
    __slots__ = ('dat', 'tree_range')

    def __init__(self):
        """
        Init a SegmentTree with update and find for RMQ.
        """
        self.tree_range = end
        self.dat = [float('inf')] * (2 * self.tree_range - 1)

    # let A[k]=a
    def update(self, k, a):
        k += self.tree_range - 1
        self.dat[k] = a
        while k > 0:
            k = (k - 1) // 2
            self.dat[k] = min(self.dat[k * 2 + 1], self.dat[k * 2 + 2])

    # get min(A[s] A[s+1] ... A[t])
    def find(self, s, t, k=0, l=0, r=float('inf')):
        if r <= s or t <= l:
            return float('inf')
        if s <= l <= r <= t:
            return self.dat[k]
        else:
            vl = self.find(s, t, k * 2 + 1, l, (l + r) // 2)
            vr = self.find(s, t, k * 2 + 2, (l + r) // 2, r)
            return min(vl, vr)


def action(cmd_list):
    for query in cmd_list:
        cmd, ele_1, ele_2 = map(int, query)
        if cmd == 0:
            case.update(ele_1, ele_2)
        elif cmd == 1:
            assert ele_1 <= ele_2
            res = case.find(s=ele_1, t=ele_2 + 1, r=end)
            if isinf(res):
                print(INIT_MAX)
            else:
                print(res)

    return case


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    n_num, q_num = map(int, _input[0].split())
    q_list = map(lambda x: x.split(), _input[1:])

    end = pow(2, ceil(log2(n_num)))
    INIT_MAX = pow(2, 31) - 1

    case = SegmentTree()

    ans = action(q_list)

Measured memory_bytes: 19648
import sys
import fileinput
import math

ips = []
for line in fileinput.input():
    ips.append(line)

data = []
i = 0
while True:
    ip = [ int(i) for i in ips[i].strip().split(',')]
    if ip == [0,0] : break;
    else: data.append(ip)
    i+=1

data = sorted(data,key=lambda x:-x[1])
counter = 0
score = -1

m = {}
for k, s in data:
    if s != score:
        counter+=1
        score = s
    m[k] = counter

for a in range(i+1, len(ips)):
    ip = int(ips[a].strip())
    print(m[ip])

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

int main() {

  int N, X, Y;
  cin >> N >> X >> Y;
  --X;
  --Y;
  
  vector<int> answer(N);
  int INF = 1000000007;

  for (int i = 0; i < N; i++) {
    vector<int> distance(N, INF);

    // BFSで距離を調べる
    queue<int> q;

    auto push = [&](int v, int d) {
      if (distance[v] != INF) {
        return;
      }
      distance[v] = d;
      q.push(v);
    };

    // スタート地点
    push(i,0);

    while(!q.empty()) {
      int v = q.front();
      q.pop();
      int d = distance[v];
      if (0 <= v - 1) {
        push(v - 1, d + 1);
      }
      if (v + 1 < N) {
        push(v + 1, d + 1);
      }
      // XとYをつなぐ線
      if (v == X) {
        push(Y, d + 1);
      }
      if (v == Y) {
        push(X, d + 1);
      }
    }
    for (int j = 0; j < N; j++) {
      answer[distance[j]]++;
    }
  }

  for (int i = 0; i < N; i++) {
    answer[i] /= 2;
  }

  for (int i = 1; i < N; i++) {
    cout << answer[i] << endl;
  }

  return 0;

}

Measured memory_bytes: 256
from collections import deque
n = int(input())
edges = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

d = list(map(int, input().split()))
d.sort(reverse=True)

que = deque()
que.append(0)
seen = [False for _ in range(n)]
seen[0] = True
memo = [0]
while que:
    cur = que.popleft()
    for to in edges[cur]:
        if seen[to]:
            continue
        seen[to] = True
        memo.append(to)
        que.append(to)


print(sum(d) - d[0])

ans = [0 for _ in range(n)]
for i in range(n):
    ans[memo[i]] = d[i]

print(*ans)

Measured memory_bytes: 12104
import math
import collections
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass
def count_counter(c,n):
    res = 0
    for i in c.values():
        if i >= n:
            res += 1
    return res
    
n = int(input())
factors, ans = [], 0
for i in range(2,n+1):
    factors = factors + prime_factor(i)
c = collections.Counter(sorted(factors))
ans += count_counter(c,74)
ans += (count_counter(c,24)*(count_counter(c,2)-1))
ans += (count_counter(c,14)*(count_counter(c,4)-1))
ans += ((count_counter(c,4)*(count_counter(c,4)-1)*(count_counter(c,2)-2))//2)
print(ans)

Measured memory_bytes: 3436
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long n,a[2000],i,total=1000,k,l;
    cin>>n;
    cin>>a[1];
    for(i=2;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]>a[i-1])
        {
            k=total/a[i-1];
            total=total-(k*a[i-1]);           
            total+=(k*a[i]);
        }
    }
    cout<<total<<endl;
    return 0;
}

Measured memory_bytes: 3680
/*
    In the name of Allah

    MohammadErfan Gooneh

*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

#define endl                        '\n'
#define all(a, n)                   for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;
#define IOS                         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
int main() {
    IOS ;
    string s ;
    cin >> s ;
    s[3] = '8' ; 
    cout << s ; 




















return 0 ;
}


Measured memory_bytes: 3584
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
INF = 10 ** 12
T = [2**i for i in range(N)]
dp = [INF] * (2**N)
dp[0] = 0
for i in range(M):
    a, b = map(int, input().split())
    C = list(map(int, input().split()))
    step = sum(T[c-1] for c in C)
    for j in range(2**N):
        dp[step|j] = min(dp[step|j], dp[j]+a)

print(dp[-1] if dp[-1] < INF else -1)


Measured memory_bytes: 42716
#include <stdio.h>
int main(){
	int a, b;
	scanf("%d %d", &a, &b);
	int eq, eq2;
	int agrsim;
	if(a >= 10){
		printf("%d\n", b);
	} else{
		eq=100*(10-a);
		eq2= eq+b;
		printf("%d\n", eq2);
	}
	
	
	return 0;
}

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

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)   __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)   __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)   __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define ll long long
#define pb push_back
#define PI M_PI
#define endl "\n"
#define sc scanf
#define pf printf
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int main()
{
     IOS
     ll x,cnt=100;
     ll ans=0;

     cin>>x;
     while(cnt<x)
     {
          cnt+=cnt/100;
          ans++;
          //cout<<cnt<<endl;
     }
     cout<<ans<<endl;


     return 0;
}



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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  int n;
  cin >> n;
  vt<i64> a(n), b(n);
  rep(i, 0, n) cin >> a[i];
  rep(i, 0, n) cin >> b[i];

  {
    i64 sum1 = 0, sum2 = 0;
    rep(i, 0, n) {
      sum1 += a[i];
      sum2 += b[i];
    }

    if(sum2 > sum1) return cout << -1 << endl, 0;
  }

  vt<i64> p, m;
  rep(i, 0, n) {
    i64 tmp = a[i] - b[i];
    if(tmp > 0) p.push_back(tmp);
    else if(tmp < 0) m.push_back(tmp);
  }
  sort(rall(p));

  if(m.size() == 0) return cout << 0 << endl, 0;  

  int ans = m.size();
  i64 summ = 0;
  rep(i, 0, m.size()) summ += m[i];
  summ = -summ;
  i64 sump = 0;
  rep(i, 0, p.size()) {
    ans++;
    sump += p[i];
    if(sump >= summ) break;
  }
  cout << ans << endl;
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    Int k;
    cin >> k;
    dump(a[k - 1]);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <iostream>
#include <fstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <iterator>
#include <iomanip>
#include <unordered_map>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    
    string s;
    int n;
    cin>>s;
    n=s.size();
    while(n--) cout<<'x';
    
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if(A + B >= 10) {
			System.out.println("error");
		} else {
			System.out.println(A + B);
		}
	}
}


Measured memory_bytes: 23252
N,M=map(int,input().split())
ab=[[int(i) for i in input().split()] for i in range(N)]
check=[[int(i) for  i in input().split()] for i in range(M)]
for hito in ab:
    curmin=10**9
    goto=0
    for j,point in enumerate(check):
        if abs(point[1]-hito[1])+abs(point[0]-hito[0])<curmin:
            curmin=abs(point[1]-hito[1])+abs(point[0]-hito[0])
            goto=j+1
    print(goto)
        

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		while (true) {
			String str = br.readLine();
			if ("0 0".equals(str)) {
				break;
			}
			String[] strS = str.split(" ");
			int[] n = new int[2];
			for (int i = 0; i < n.length; i++) {
				n[i] = Integer.parseInt(strS[i]);
			}
			if(n[0] > n[1]) {
				int temp = n[0];
				n[0] = n[1];
				n[1] = temp;
			}
			sb.append(Integer.toString(n[0]) + " " + Integer.toString(n[1]) + "\n");
		}
		System.out.print(sb);
	}

}

Measured memory_bytes: 27372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define tr(container, it) \
	for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c,x) ((c).find(x) != (c).end())   //O(log n) 
#define contains(c,x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define Ichar(_x) char _x;scanf("%c",&_x);
#define Iint(_x) int _x;scanf("%d",&_x); 
#define Ill(_x)  ll _x;scanf("%lld",&_x);
#define inc(a,b,x)(x)>a && (x)<b	
#define incE(a,b,x)(x)>=a && (x)<=b	
#define fileIO 	freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);

void insert_sort(int *arr,int n)
{
	for (int i = 1; i < n; ++i)
	{
		int key = arr[i];
		int j = i - 1;
		while (key<arr[j] && j>=0)
		{
			arr[j + 1] = arr[j];
			j--;
		}
		arr[j + 1] = key;
	}
}

void select_sort(int *arr,int n)
{
	
	for (int i = 0; i < n; ++i)
	{
		int min_idx = i;
		for (int j = i+1; j < n; ++j)
		{
			if (arr[j] < arr[min_idx])min_idx = j;
		}
		swap(arr[min_idx], arr[i]);
	}


}

int c[100];
void add_binary(int *a,int *b,int n)
{
	int k = 0;
	for (int i = n-1; i >=0; --i)
	{
		if(a[i]==b[i]==1)
		{
			c[i+1] = k ^ 0;
			k = 1;
		}
		else
		{
			c[i+1] = k ^ (a[i] ^ b[i]);
			k &= a[i] ^ b[i];
		}
	}
	c[0] = k;
	for (int i = 0; i < n+1; ++i)
	{
		std::cout << c[i];
	}
	puts("");
}
int main()
{
	Ill(a1)
	Ill(a2)
	Ill(a3)
	Ill(a4)
	Ill(n)
	a1 *= 4;
	a2 *= 2;
	ll cheap = min(min(a1, a2), a3);
	if(cheap<=a4/2.0)std::cout << n*cheap;
	else
	{
		std::cout << n/2*a4+n%2*cheap;
	}




}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define INF 1 << 30
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define FORALL(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef valarray<int> Array;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cout<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}

int a[144];

void flip(int x, int y)
{
  if(x>11||y>11||x<0||y<0) return;
  if(a[x+y*12])
  {
    a[x+y*12] = 0;
    flip(x+1,y);
    flip(x-1,y);
    flip(x,y+1);
    flip(x,y-1);
  }
}

void solve()
{
  int cnt = 0;
  REP(i,144) if(a[i])
  {
    cnt++;
    flip(i%12,i/12);
  }
  cout << cnt << endl;
}

int main()
{
  string s;
  int i = 0;
  while(cin >> s)
  {
    REP(j,12) a[i*12+j] = s[j]-'0';
    i=(++i)%12;
    if(i==0) solve();
  }
  return 0;
}

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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  LL N,K,S;
  cin >> N >> K >> S;
  
  REP(i,N){
    if(i<K){
      cout << S;
    }else{
      if(S!=1000000000){
        cout << S+1;
      }else{
        cout << 1;
      }
    }
    if(i!=N-1){
      cout << " ";
    }else{
      cout << endl;
    }
  }
}


Measured memory_bytes: 1280
N, M = map(int, input().split())
As = []
for i in range(N):
  A = input()
  As.append(A)
Bs = []
for i in range(M):
  B = input()
  Bs.append(B)
r = False
for p in range(0, N-M+1):
  for q in range(0, N-M+1):
    ok = True
    for i in range(0, M):
      if Bs[i] != As[i+p][q:q+M]:
        ok = False
        break
    if ok:
      r = True
if r:
  print("Yes")
else:
  print("No")


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

int main() {
    unordered_map<string, int> table;
    string frequent;    // 最大頻度
    string longest;     // 最長
    string word;        // 入力
    while (cin >> word) {
        table[word]++;
        if (table[word] > table[frequent]) {
            frequent = word;
        }
        if (word.length() > longest.length()) {
            longest = word;
        }
    }
    cout << frequent << " " << longest << endl;
    return 0;
}


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    string s;
    cin >> s;
    rep (i, s.size())
        cout << 'x';
    cout << endl;

    return 0;
}


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

int main() {
	char c;
  	cin >> c;
  	switch(c){
      case 'a':
        cout << "vowel" << endl;
        break;
      case 'e':
        cout << "vowel" << endl;
        break;
      case 'i':
        cout << "vowel" << endl;
        break;
      case 'u':
        cout << "vowel" << endl;
        break;
      case 'o':
        cout << "vowel" << endl;
        break;
      default:
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256