akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(void){

int n,h;
int a,b,c,d;

while( scanf("%d",&n) != EOF){
	h=0;
	for(a=0;a<=9;a++){
	for(b=0;b<=9;b++){
	for(c=0;c<=9;c++){
	for(d=0;d<=9;d++){
		if( (a+b+c+d) == n )h++;
	}
	}
	}
	}
	printf("%d\n",h);
}

return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////

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

	ll ans = B + min(C, A + B + 1);

	cout << ans;

	system("PAUSE");

}





Measured memory_bytes: 504
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
// #ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
       *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
// #else
// sim dor(const c&) { ris; }
// #endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve(){
    string s,t;
    cin>>s>>t;
    int n=s.length();
    int m=t.length();
    int ans=m;
    for(int i=0;i<n-m+1;i++){
        int cur=0;
        for(int j=0;j<m;j++){
            if(s[i+j]!=t[j]){
                cur++;
            }
        }
        ans=min(ans,cur);
    }
    cout<<ans<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3656
def main30():
    data = input().split()
    num = []
    for i in range(2):
        num.append(int(data[i]))
    kazu = 0
    if int(num[1] / 10) == 0:
        kazu = num[0] * 10 + num[1]
    elif num[1] != 100:
        kazu = num[0] * 100 + num[1]
    else:
        kazu = num[0] * 1000 + 100
    for i in range(400):
        if i*i == kazu:
            print("Yes")
            return
    print("No")

if __name__ == "__main__":
    main30()

Measured memory_bytes: 3064
N = input()
steps = [i for i in N]
N = len(N)
ans = "Yes"
for i in range(0,N,2):
    if steps[i] == "L":
        ans = "No"
for i in range(1,N,2):
    if steps[i] == "R":
        ans = "No"
print(ans)


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

int main() {
  string S;
  cin >> S;
  int deka=10000;
  int zettai=0;
  for (int i=0; i<S.size()-2;i++){
    zettai=(S[i]-'0')*100+(S[i+1]-'0')*10+(S[i+2]-'0');
    if (abs(zettai-753)<deka){
      deka=abs(zettai-753);
    }
  }
  cout << deka << endl;
  

}


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

#define rep(i,a,b)                for(ll i=a;i<b;i++)
#define re(i,b)                for(ll i=0;i<b;i++)
#define repr(i,n)                for(ll i=n-1;i>=0;i--)
#define ll long long
#define ld long double
#define llu long long unsigned
#define vll std::vector<ll>
#define mll std::map<ll, ll>
#define mpll std::map<pair<ll,ll>, ll>
#define sll std::set<ll>
#define msll std::multiset<ll>
#define all(c) c.begin(), c.end()
#define allr(c) c.rbegin(), c.rend()
#define srt(x) sort(all(x))
#define rsrt(x) sort(allr(x))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define s(yy) ll yy;cin>>yy
#define mod 1000000007
#define maxlong 9223372036854775808


/*
###################################################### 
#                                                    #
#                     @author                        #
#                  Parth Lathiya                     #
#      https://www.cse.iitb.ac.in/~parthiitb/        #
#                                                    #
###################################################### 
*/


int main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);


//--------------------------------------------------------------------------------------
	
	s(n);
	ll s[n];
	ll sum=0;
	rep(i,0,n){
		cin>>s[i];
		sum+=s[i];
	}
	if(sum%10!=0){
		cout<<sum;
		return 0;
	}
	else{
		sort(s,s+n);
		rep(i,0,n)
			if((sum-s[i])%10!=0){
				cout<<sum-s[i];
				return 0;
			}
	}
	cout<<0;

//--------------------------------------------------------------------------------------

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	int n,ans = 0;
	cin >> n;
	if (n == 1)cout << 1 << endl;
	else {
		REPS(i, n) {
			if (n < pow(2, i)) {
				cout << pow(2, i-1) << endl;
				return 0;
			}

		}
	}
	return 0;
}



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

using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<int> f(n+1);
	f[0] = f[1] = 1;
	for (int i = 2; i < n+1; ++i) {
		f[i] = f[i-1] + f[i-2];
	}
	cout << f[n] << endl;
	return 0;
}



Measured memory_bytes: 3116
# Atcoder Express
from bisect import bisect_left, bisect_right
N = int(input())
time = list(map(int, input().split()))
vel = list(map(int, input().split()))
sum_t = [0 for i in range(N+1)]

for i in range(1, N+1):
    sum_t[i] = sum_t[i-1]+time[i-1]

dp = [[-float("inf") for j in range(101)] for i in range(20001)]
# dp[t][v]=開始からt秒後に速度v で走っている時に、t秒後に実現できる最大の移動距離
dp[0][0] = 0

for i in range(1, sum_t[-1]+1):
    # i秒後における更新

    bef = bisect_left(sum_t, i-1)
    phase = bisect_left(sum_t, i)

    bef_bound = vel[bef-1]  # i-1秒時点における速度制限
    bound = vel[phase-1]    # i秒後における速度制限
    if bef == 0:
        bef_bound = 100
        
    if bef_bound < bound:
        for j in range(bef_bound+2):
            if j == 0:
                if j+1 <= bef_bound:
                    dp[i][j] = max(dp[i-1][j]+j+0.25, dp[i-1][j+1]+j+0.5)
                else:
                    if j == bef_bound:
                        dp[i][j] = dp[i-1][j]+j+0.25

            elif j >= 1:
                if j+1 <= bef_bound:
                    dp[i][j] = max(dp[i-1][j-1]+j-0.5, dp[i-1]
                                   [j]+j+0.25, dp[i-1][j+1]+j+0.5)
                else:
                    if j == bef_bound:
                        dp[i][j] = max(dp[i-1][j-1]+j-0.5, dp[i-1][j]+j+0.25)
                    else:
                        if j-1 == bef_bound:
                            dp[i][j] = dp[i-1][j-1]+j-0.5

    elif bef_bound >= bound:
        for j in range(bound):
            if j == 0:
                # j+1<=bef_bound:
                dp[i][j] = max(dp[i-1][j]+j+0.25, dp[i-1][j+1]+j+0.5)
            elif j >= 1:
                dp[i][j] = max(dp[i-1][j-1]+j-0.5, dp[i-1]
                               [j]+j+0.25, dp[i-1][j+1]+j+0.5)

        dp[i][bound] = max(dp[i-1][bound]+bound, dp[i-1][bound-1]+bound-0.5)


ans = dp[sum_t[-1]][0]
print(ans)


Measured memory_bytes: 65884
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = 0;
		
		if(a+b==3){
			ans = 3;
			System.out.print(ans);
		}

		if(a+b==4){
			ans = 2;
			System.out.print(ans);
		}

		if(a+b==5){
			ans = 1;
			System.out.print(ans);
		}

	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, a, b, c, d);
    Cout((a >= 13) ? b : (a >= 6) ? b/2 : 0);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,m,i,j;
  int A[100][100],b[100],result[100];

  scanf("%d %d",&n,&m);

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

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

  for(i=0; i<n; i++){
    for(j=0; j<m; j++){
      result[i] += A[i][j] * b[j];
    }
  }

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

  return 0;
}



Measured memory_bytes: 2136
require 'pp'

n = gets.to_i
d = gets.split.map(&:to_i)
cnt = 0
d.group_by(&:itself).map{|k,v|[k, v.size]}.each do |n, size|
  if n > size # 全消ししないと無理なとき
    cnt += size
  elsif n < size # ちょっと消せば良いとき
    cnt += size - n
  end
end
p cnt


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

int main()
{
    int N, Y;
    cin >> N >> Y;
    int res10000 = -1, res5000 = -1, res1000 = -1;
    for (int a = 0; a <= N; ++a)
    {
        for (int b = 0; b + a <= N; ++b)
        {
            int c = N - a - b;
            int total = 10000 * a + 5000 * b + 1000 * c;
            if (total == Y)
            {
                res10000 = a;
                res5000 = b;
                res1000 = c;
            }
        }
    }

    cout << res10000 << " " << res5000 << " " << res1000 << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int n;
int S[100000];

int binary_search(int key){
    int left = 0;
    int right = n;

    while(left < right){
        int middle = (left + right) / 2;
        if(S[middle] == key){
            return 1;
        }else if(S[middle] < key){
            left = middle + 1;
        }else{
            right = middle;
        }
    }

    return 0;
}

int main(void){
    int q;
    int T[50000];
    int res = 0;

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

    scanf("%d\n", &q);
    for(int i=0; i<q; i++){
        scanf("%d", &T[i]);
        res += binary_search(T[i]);
    }

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

    return 0;
}


Measured memory_bytes: 2284
#include "iostream"

#define endl '\n'

using namespace std;

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

    unsigned long long deposit = 100;
    unsigned long long threshold = 0;

    cin >> threshold;

    unsigned counter = 0;

    while (deposit < threshold) {
        counter++;
        deposit *= 1.01;
    }

    cout << counter;

    return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
struct union_find{
  vector<int>parent;
  vector<int>rank;
  union_find(int n):parent(n),rank(n){
    for(int i=0;i<n;i++){
      parent[i]=i;
      rank[i]=0;
    }
  }
  int root(int x){
    return parent[x]==x?x:parent[x]=root(parent[x]);
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
  void uni(int x,int y){
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(rank[x]>rank[y]){
      parent[y]=x;
    }else{
      parent[x]=y;
      if(rank[x]==rank[y]){
        rank[y]++;
      }
    }
  }

};

int main(){
  int N,M;
  cin>>N>>M;
  vector<pair<int,int>>data;
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    a--,b--;
    data.push_back(make_pair(a,b));
  }
  int cnt=0;
  int ans=0;
  for(int i=0;i<M;i++){
    union_find uf(N);
    for(int j=0;j<M;j++){
      if(i==j)continue;
      uf.uni(data[j].first,data[j].second);
    }
    int cnt=0;
    for(int j=0;j<N;j++)if(j==uf.root(j))cnt++;
    if(cnt>1)ans++;
  }
  cout<<ans<<endl;
}

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

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

const long long INF = 1LL << 60;

string s;

void EraseWord(string word){
  int pos = s.find(word);
  while(pos != -1){
    s.replace(pos, word.length(), "");
    pos = s.find(word, pos);
  }
}

int main(){
  cin >> s;

  EraseWord("eraser");
  EraseWord("erase");
  EraseWord("dreamer");
  EraseWord("dream");

  cout << (s.size() == 0 ? "YES" : "NO") << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <cstdio>

using namespace std;

#define reep(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) reep(i,0,n)

int a[1000000];

int main(){
    int n;
    cin >> n;
    int N=1;
    rep(i,n){
        N*=2;
    }

    rep(i,N){
        cin >> a[i];
    }

    int right=N;
    rep(i,n){
        for(int k=0;k<right;k+=2){
            if(a[k]!=a[k+1]){
                a[k/2] = abs(a[k]-a[k+1]);
            }
        }
        right /= 2;
    }
    cout << a[0] << endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,k;
string s;
int32_t main(){
CODE_START;
cin >> n >> k;
cin >> s;
s[k-1]=char(tolower(s[k-1]));
cout << s;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    string s; cin>>s;
    int ans=0;
    for(int i=0;i<6;i++){
        if(s[i]=='1') ans++;
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 3632
#include <cstring>
#include <cstdio>
char str[200005], ans[200005]; 
int nxt[200005][35], dp[200005], ch[200005]; 
int main()
{
	// freopen("ARC081-E.in", "r", stdin); 
	scanf("%s", str); 
	int n = strlen(str); 
	for (int i = 0; i < 26; i++)
		nxt[n + 1][i] = n + i + 1; 
	for (int i = n; i >= 0; i--)
	{
		memcpy(nxt[i], nxt[i + 1], sizeof(nxt[i + 1])); 
		if (i)
			nxt[i][str[i - 1] - 'a'] = i; 
	}
	memset(dp, 0x3f, sizeof(dp)); 
	for (int i = n + 1; i <= n + 26; i++)
		dp[i] = 0; 
	for (int i = n; i >= 0; i--)
	{
		for (int j = 0; j < 26; j++)
		{
			if (dp[nxt[i + 1][j]] + 1 < dp[i])
			{
				dp[i] = dp[nxt[i + 1][j]] + 1;
				ch[i] = j; 
			}
		}
	}
	int x = 0, len = 0; 
	while (x < n)
	{
		ans[len++] = ch[x] + 'a'; 
		x = nxt[x + 1][ch[x]]; 
	}
	puts(ans); 
	return 0; 
}


Measured memory_bytes: 29312
#include <iostream>
using namespace std;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  if (a[a.length()-1]==b[0]&&b[b.length()-1]==c[0]) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;

}


Measured memory_bytes: 256
//2008dC
I;int parse(char *p){switch(*p){
	case 'F':return 0;
	case 'T':return 1;
	case '-':return !parse(p+1);
	case '(':{
		int x=0;
		p++;
		char *q=p;
		for(;;p++){
			if(*p=='(')x++;
			if(*p==')')x--;
			if(x==0&&*p!='-')break;
		}
		p++;
		switch(*p){
			case '*': return parse(q)&parse(p+1);
			case '+': return parse(q)|parse(p+1);
			case '-': return !parse(q)|parse(p+2);
		}
	}
}return (I>>(*p-97))&1;}
char p[1001],*q;main(){for(;scanf("%s",p),*p-'#';puts(I==2048?"YES":"NO")){
for(q=strchr(p,'=')+1,I=0;I<2048;I++)if(parse(p)!=parse(q))break;
}exit(0);}

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

int main(){
    int n; cin>>n;
    int a[3][110]={0};
    for(int i=1;i<=2;i++){
        for(int j=1;j<=n;j++){
            cin>>a[i][j];
            a[i][j]+=a[i][j-1];
        }
    }
    int ans=-1;
    for(int i=1;i<=n;i++){
        ans=max(ans,a[1][i]+a[2][n]-a[2][i-1]);
    }
    cout<<ans<<endl;
}


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

using namespace std;

int Atoi(const string);

int main(){
  int i, x, m, n, ans;
  string str1, str2;

  cin >> x;

  for(i=0; i<x; i++){
    cin >> str1;
    str2 = str1;

    sort(str1.begin(), str1.end());
    m = Atoi(str1);
    sort(str2.begin(), str2.end(), greater<int>());
    n = Atoi(str2);

    ans = n - m;
    cout << ans << endl;
  }

  return 0;
}

int Atoi(const string c){
  int i, x=0, digit=1;

  for(i = c.size()-1; i >= 0; --i){
    x = x + (c[i] - 48) * digit;
    digit *= 10;
  }
  return x;
}

Measured memory_bytes: 0
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;



int main(){

int N;
cin>>N;
ll K,A[N];
cin>>K;
rep(i,N){
    cin>>A[i];
}
ll bitsum[40][2];
rep(i,40)rep(j,2)bitsum[i][j]=0;
rep(i,40){
    rep(j,N){
        if(A[j]&(1LL<<i)){
            bitsum[i][1]++;
        }
        else{
            bitsum[i][0]++;
        }
    }
}
bool kbit[40];
rep(i,40)kbit[i]=(K>>i)&1;
ll dp[41][2];
memset(dp,-1,sizeof(dp));
dp[40][1]=0;
repr(i,40){
    if(kbit[i]){
        dp[i][1]=dp[i+1][1]+bitsum[i][0]*(1LL<<i);
        dp[i][0]=dp[i+1][1]+bitsum[i][1]*(1LL<<i);
        if(dp[i+1][0]!=-1){
        dp[i][0]=max(dp[i][0],dp[i+1][0]+max(bitsum[i][1],bitsum[i][0])*(1LL<<i));
        }
    }
    else{
        dp[i][1]=dp[i+1][1]+bitsum[i][1]*(1LL<<i);
        if(dp[i+1][0]!=-1){
        dp[i][0]=dp[i+1][0]+max(bitsum[i][1],bitsum[i][0])*(1LL<<i);
        }

    }
    
   
}
cout<<max(dp[0][0],dp[0][1])<<endl;
return 0;

return 0;
}

Measured memory_bytes: 4328
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 11100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[210000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	long long cur=1000;
	for(int i=1;i<a;i++){
		if(p[i]>p[i-1]){
			long long t=cur/p[i-1];
			cur=cur%p[i-1]+t*p[i];
		}
	}
	printf("%lld\n",cur);
}

Measured memory_bytes: 1704
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>

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)

int main() {
	LL X, Y;
	cin >> X >> Y;
	if (X%Y == 0) {
		cout << -1 << endl;
	}
	else {
		cout << X << endl;
	}
}

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

int main()
{
	int N;
	cin >> N;
	vector<int> sc(N);
	for (int i = 0; i < N * (N - 1) / 2; i++) {
		int a, b, c, d;
		cin >> a >> b >> c >> d; a--, b--;
		if (c > d) {
			sc[a] += 3;
		}
		else if (c < d) {
			sc[b] += 3;
		}
		else {
			sc[a] += 1;
			sc[b] += 1;
		}
	}
	const int MAX = 3e4;
	vector<vector<int>> mp(MAX + 1);
	for (int i = 0; i < N; i++) {
		mp[sc[i]].push_back(i);
	}
	vector<int> res(N);
	int sum = 0;
	for (int i = MAX; i >= 0; i--) {
		if (mp[i].empty()) continue;
		for (auto id : mp[i]) {
			res[id] = sum + 1;
		}
		sum += mp[i].size();
	}
	for (int i = 0; i < N; i++) {
		cout << res[i] << endl;
	}
	return 0;
}



Measured memory_bytes: 3632
#include "bits/stdc++.h"
#pragma optimize("unroll-loops");
#pragma optimize("Ofast");
// #include "pch.h"    
using namespace std;

#ifdef DEBUG_BUILD
#  define DEBUG(x) cerr << x
#else
#  define DEBUG(x) do {} while (1)
#endif

#define imie(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)

using ll = long long;
const int nax = 1e6 + 10;

vector<int> primes;
ll lcm(ll a, ll b) {
    return (a*b)/__gcd(a, b);
}

vector<bool> prime(nax, true);

ll f(ll n) {
    ll ans = 0;
    while(ans*(ans + 1)/2 < n) {
        ++ans;
    }
    return ans;
}

int main() {
    
    int n;
    cin >> n;
    vector<int> ans(n + 1, 0);
     
    for(int i = 1; i < n; ++i) {
        int x;
        cin >> x;
        ans[x]++;
    }
    
    for(int i = 1; i <= n; ++i) {
        cout << ans[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a,b,k;
	cin>>a>>b>>k;
	vector<int>	v;
	for(int i=min(a,b); i>0; i--) {
		if(a%i==0&&b%i==0) {
			v.push_back(i);
		}
	}
	cout<<v[k-1]<<endl;
	return 0;
}


Measured memory_bytes: 256
// AOJ 2237: The Castle
// 2017.12.9

#include <stdio.h>
#include <string.h>

double p[16][16];
double dp[65536][16];
 
int main()
{
    int m, n, i, j, k, l, b;
	double t, a, pro;

	scanf("%d%d", &m, &n);
    for (i = 0; i < m; i++) for (j = 0; j < n; j++) scanf("%lf", &p[i][j]);

    for (i = (1 << m) - 1; i >= 0; i--) {
        for (j = n-1; j >= 0; j--) {
            t = 0;
            for (b = 1, k = 0; k < m; k++, b <<= 1) if (!(i & b)) {
				pro = 1, a = 0;
                for (l = j; l < n; l++) {
                    a += pro * (1.0 - p[k][l]) * dp[i | b][l];
                    pro *= p[k][l];
                }
                a += pro;
				if (a > t) t = a;
            }
            dp[i][j] = t;
        }
    }
    printf("%.12lf\n",dp[0][0]);
    return 0;
}

Measured memory_bytes: 9996
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;


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

    if (m == 0){
        if (k == 0) {
            cout << 0 << " " << 0 << endl;
        } else {
            cout << -1 << endl;
        }
    } else if (m == 1){
        if (k == 0){
            cout << 0 << " " << 0 << " ";
            cout << 1 << " " << 1 << endl;
        } else {
            cout << -1 << endl;
        }
    } else {
        ll big = 1ll<<m;
        if (k >= big) {
            cout << -1 << endl;
            return 0;
        } 
        rep(i, big) {
            if (i == k) continue;
            cout << i << " ";
        }
        cout << k << " ";
        rep(i, big) { 
            if (big - (i+1) == k) continue;
            cout << big - (i+1) << " ";
        }
        cout << k << endl;
    }

    return 0;
}



Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdio>
using namespace std;
typedef long long ll;
#define reps(i,b,n) for(int i = b ; i < n ; ++i )
#define rep(i,n) reps(i,0,n)
#define fr first
#define sc second
void doing(char cmd,vector<string>& t,string& buff,int& y,int& x){
  switch(cmd){
  case'a': x = 0; break;
  case'e': x = t[y].size(); break;
  case'p': if(y) y--; x=0; break;
  case'n': if(y<t.size()-1) y++; x=0; break;
  case'f': if(x<t[y].size()) x++; else if(y<t.size()-1) y++,x=0; break;
  case'b': if(x)x--; else if(y) x = t[--y].size(); break;
  case'd': if(x<t[y].size()) t[y].erase(t[y].begin()+x); else if(y<t.size()-1) t[y] += t[y+1] , t.erase(t.begin()+y+1); break;
  case'k': if(x==t[y].size() && y<t.size()-1) t[y]+=t[y+1] , t.erase(t.begin()+y+1) , buff="\n"; else if(x!=t[y].size()) buff = t[y].substr(x) , t[y].erase(t[y].begin()+x,t[y].end()); break;
  case'y': if(buff == "\n") t.insert(t.begin()+y+1,t[y].substr(x)),t[y].erase(t[y].begin()+x,t[y].end()),y++,x=0; else if(buff != "")  t[y].insert(x,buff),x += buff.size(); break;
  }
}
int main(){
  vector<string> text;
  string in;
  while(getline(cin,in) , in != "END_OF_TEXT") text.push_back(in);

  char cmd;
  string buff="";
  int cury = 0, curx = 0;
  while( cin >> cmd , cmd != '-') doing(cmd,text,buff,cury,curx);

  rep(i,text.size()) cout << text[i] << endl;
}

Measured memory_bytes: 1224
var 
    a,b,i,j,k:longint;
    p,s:string;
    pos1,pos2,pos3,pos4,o1,o2,o3,o4,o5,o:longint;
begin
   
readln(p);
s:=p;
o1:=0;
j:=0;
k:=0;
o2:=0;
if p[1]='-' then begin delete(p,1,1); o1:=o1+1; end;
pos1:=pos('+',p);
if pos1>0 then
begin

   pos2:=pos('-',p);
   
   if pos2>0 then  o2:=o2+1; 
   for i:=1  to pos1-2 do
       j:=j*10+ord(p[i])-ord('0');
   for i:=pos1+2+o2  to length(p) do
       k:=k*10+ord(p[i])-ord('0');
      
   if o1=1 then j:=0-j;
   if o2=1 then k:=0-k;
   writeln(j+k);
    readln;
   readln;
   exit;
   end;
    pos1:=pos('*',p);
if pos1>0 then
begin

   pos2:=pos('-',p);
   
   if pos2>0 then  o2:=o2+1; 
   for i:=1  to pos1-2 do
       j:=j*10+ord(p[i])-ord('0');
   for i:=pos1+2+o2  to length(p) do
       k:=k*10+ord(p[i])-ord('0');
    
   if o1=1 then j:=0-j;
   if o2=1 then k:=0-k;

   writeln(j*k);
   readln;
   readln;
   exit;
   end;
    pos1:=pos('\',p);
if pos1>0 then
begin

   pos2:=pos('-',p);
   
   if pos2>0 then  o2:=o2+1; 
   for i:=1  to pos1-2 do
       j:=j*10+ord(p[i])-ord('0');
   for i:=pos1+2+o2  to length(p) do
       k:=k*10+ord(p[i])-ord('0');
    
   if o1=1 then j:=0-j;
   if o2=1 then k:=0-k;
  if k=0 then begin  writeln('NO');
  readln;
  readln;
  exit;
  end;

   writeln(j div k);
   readln;
   readln;
   
   exit;
   end;
   
   pos1:=pos('-',p);
   delete(p,pos1,1);
if pos1>0 then
begin

   pos2:=pos('-',p);
   
   if pos2>0 then  o2:=o2+1; 
   insert('-',p,pos1);
   for i:=1  to pos1-2 do
       j:=j*10+ord(p[i])-ord('0');
   for i:=pos1+2+o2  to length(p) do
       k:=k*10+ord(p[i])-ord('0');
      
   if o1=1 then j:=0-j;
   if o2=1 then k:=0-k;
  
   writeln(j-k);

    readln;
   readln;
   
   exit;
   end;
  

end.

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

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

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N; cin >> N;
    vector<int> A(N), m(N);
    rep(i, N) {
        cin >> A[i];
        if (i == 0) {
            m[i] = A[i];
        } else {
            m[i] = min(m[i-1], A[i]);
        }
    }
    int ans = 0;
    rep(i, N) {
        if (m[i] >= A[i]) {
            ans++;
        }
    }
    cout << ans << endl;
}


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

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

  int a[n];
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }

  if(n == k) {
    cout << 1 << endl;
  } else {
    int s1 = n - 1;
    int s2 = k - 1;
    int count = 0;
    while(1) {
      s1 = s1 - s2;
      count++;
      if(s1 <= 0) break;
    }
    cout << count << endl;
  }
}

Measured memory_bytes: 640
#include<stdio.h>

int main(){
  int n,a,b,i,j,k,ans,tmp;
  scanf("%d %d %d",&n,&a,&b);
  ans=0;
  for(i=1;i<=n;i++){
    j=i;
    tmp=0;
  for(k=0;k<5;k++){
      tmp+=j%10;
      j=j/10;
    }
    if (a <= tmp && tmp <= b) {
			ans += i;
		}
  }

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

  return 0;
}


Measured memory_bytes: 128
#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() {
    ll x;
    cin >> x;
    ll i = 100;
    ll cnt = 0;
    while (i < x) {
        i *= 1.01;
        cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    if(n % 1000 == 0){
        cout << 0;
    }
    else{
        cout << -(n % 1000 - 1000);   
    }
    
    return 0;
}

Measured memory_bytes: 3672
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		int n = int.Parse(input[0]);
		int a = int.Parse(input[1]);
    int b = int.Parse(input[2]);

		Console.WriteLine(Math.Min(n*a,b));
	}
}

Measured memory_bytes: 11092
n,m,c = map(int, input().split())
b = list(map(int,input().split()))
ans=0
for i in range(n):
    x = 0
    a = list(map(int,input().split()))
    for j in range(m):
        x += a[j]*b[j]
    if x+c>0: ans += 1
print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<stdio.h>
#include<fstream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<set>
#include<string>
#include<queue>
#include<map>
#include<iomanip>
#include<cassert>
#include<complex>
#include<functional>
#include<list>
#include<cmath>
#include<stack>
#include<assert.h>
#define LL long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define F first
#define S second
using namespace std;
vector<int> vec[100005];
int L[100005],R[100005];
int id[100005];
bool ans;
void solve(int v=0,int p=-1){
  L[v]=-1000000001,R[v]=1000000001;
  if(id[v]!=-1)
    L[v]=R[v]=id[v];
  for(int i=0;i<vec[v].size();i++){
  	int to=vec[v][i];
  	if(to!=p){
  	  solve(to,v);
  	  if(L[to]<-1000000000/2)
  	    continue;
  	  if(L[v]<-1000000000/2){
  	  	L[v]=L[to]-1;
  	  	R[v]=R[to]+1;
	  }
	  else{
	  	if(abs(L[to])%2==abs(L[v])%2){
	  	  ans=false;
	  	  return;
		}
		L[v]=max(L[v],L[to]-1);
		R[v]=min(R[v],R[to]+1);
	  }
	}
  }
  if(L[v]>R[v])
    ans=false;
}
void make(int v=0,int p=-1){
  if(v==0&&id[v]==-1)
    id[v]=L[v];
  for(int i=0;i<vec[v].size();i++){
  	int to=vec[v][i];
  	if(to!=p){
  	  if(id[to]==-1){
  	    if(L[to]<=id[v]-1&&id[v]-1<=R[to])
  	      id[to]=id[v]-1;
  	    else
  	      id[to]=id[v]+1;
	  }
	  make(to,v);
	}
  }
}
int main(){
  int n;
  cin>>n;
  for(int i=0;i<n-1;i++){
  	int a,b;
  	cin>>a>>b;
  	a--;
  	b--;
  	vec[a].PB(b);
	vec[b].PB(a);
  }
  memset(id,-1,sizeof(id));
  int q;
  cin>>q;
  while(q--){
  	int v,p;
  	cin>>v>>p;
  	v--;
  	id[v]=p;
  }
  ans=true;
  solve();
  if(!ans)
    puts("No");
  else{
  	make();
  	puts("Yes");
  	for(int i=0;i<n;i++)
  	  cout<<id[i]<<"\n";
  }
  return 0;
}

Measured memory_bytes: 15360
let args = readLine()!.split(separator: " ").map { Int($0)! }

let n = args[0]

var result = ""
switch n % 10 {
case 2, 4, 5, 7, 9:
    result = "hon"

case 0, 1, 6, 8:
    result = "pon"
    
default:
    result = "bon"
}

print(result)

Measured memory_bytes: 8236
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

void debug_out() {};
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

struct C1 {
    ll N_{};
    ll K_{};
    string S_{};
    explicit C1(ll N, ll K, string S) : N_(N), K_(K), S_(move(S)){}
    ll resolve() {
        ll count = 0;
        for(ll i=0; i < N_-1; ++i) {
            if (S_[i] != S_[i+1]) {
                count++;
            }
        }
        ll required = (count + 1)/ 2;
        if (K_ >= required) {
            return N_-1;
        }
        ll remaining = count - 2 * K_;
        return N_- 1 - remaining;
    }
};

int main() {
    ll N, K;
    cin >> N >> K ;
    string S;
    cin >> S;
    C1 c{N, K, S};
    cout << c.resolve() << endl;
    debug(c.resolve());
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    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;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll x;
  	ci(x);
  ll ans=0;
  FOR(i,0,x+1){
    ans+=i;
    if(ans>=x){
      co(i)
        break;
    }
    
  }
}

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

int main()
{
  int n;
  cin >> n;
  int a[n];
  int i;
  int ans = 0;
  for(i = 0; i < n;++i){
    cin >> a[i];
  }
  while(true){
    for(i = 0;i < n;++i){
      if(a[i] % 2 == 0){
      a[i] /= 2;
      }else{
      cout << ans << endl;
      return 0;
      }
    }
    ++ans;
  }
  return 0;
}

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

int main(void){
    int n; cin >> n;
    int A[n];
    for(int i=0; i<n; i++){
        cin >> A[i];
    }
    vector<int> ans;

    if(n%2==1){
        for(int i=n-1; i>=0; i=i-2){
            ans.push_back(A[i]);
        }
        for(int i=1; i<=n-2; i=i+2){
            ans.push_back(A[i]);
        }
    }
    else{
        for(int i=n-1; i>0; i=i-2){
            ans.push_back(A[i]);
        }
        for(int i=0; i<=n-2; i=i+2){
            ans.push_back(A[i]);
        }
    }

    for(int i=0; i<ans.size(); i++){
        cout << ans[i];
        if(i==ans.size()-1) cout << endl;
        else cout << " ";
    }
    return 0;
}   

Measured memory_bytes: 3828
#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 924844033  //1000000007
#define x first
#define y second
#define pi acos(-1.0)
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
//#define dprintf(...) 
#define hash _hash
#define next _next
//#define dprintf(...) fprintf(outFile,__VA_ARGS__)
 
#define FOREACH(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define ull unsigned long long
#define ll long long
#define N 100005
 
template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}
 
//FILE* outFile;
inline void add(int &a,int b){a+=b;while(a>=mod)a-=mod;}


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

char s[10][10];
int vis[10][10];
bool OK(int n,int m){
    if(s[0][0]!='#'||s[n-1][m-1]!='#')return 0;
    int p=0,q=0,x=0,y=0,cnt=n+m-2;vis[0][0]=1;
    while(cnt--){
        p=q=0;
        if(x<n-1&&s[x+1][y]=='#')p=1;
        if(y<m-1&&s[x][y+1]=='#')q=1;
        if(p&&q || p==0&&q==0)return 0;
        if(p)x++;else y++;
        vis[x][y]=1;
    }
    if(x!=n-1||y!=m-1)return 0;
    rep(i,0,n)rep(j,0,m)if(s[i][j]=='#'&&!vis[i][j])return 0;
    return 1;
}
int main(){
    //freopen("1.txt","w",stdout);
    //cout<<setprecision(3)<<fixed;
    int T,i,j,k,m=0,n;
    scanf("%d%d",&n,&m);
    rep(i,0,n)scanf("%s",s[i]);
    if(!OK(n,m))puts("Impossible");
    else puts("Possible");    
    return 0;
}

Measured memory_bytes: 384
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

struct MyStruct {
	int x, y;
	bool cleared = false;
};

bool comp(const MyStruct& s, const MyStruct& t) {
	if (s.x != t.x)
		return s.x > t.x; //降順
	return s.y > t.y;
}

bool is_online(int x1, int y1, long long kx, long long ky, int cx, int cy) {
	long long dx = cx - x1;
	long long dy = cy - y1;
	if ((long long)kx*dy == (long long)dx*ky) return true;
	else return false;
}


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

	VI v(n);
	REP(i, n) {
		cin >> v[i];
	}

	int now = 0;
	int ans = 1;
	REP(i, n) {
		if (now + v[i] <= x) {
			ans++;
			now += v[i];
		}
		else {
			break;
		}
	}
	ANS(ans);

	return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<random>
#include<deque>
#include<cstdio>
#include<fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 2000100;
const int mod = (int)pow(10, 9) + 7;
const ll INF = 10000000100;
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define ppd pair<double,double>
#define ppp pair<ll,pp>
#define fi first
#define se second
#define pb push_back
#define fix(n) fixed<<setprecision(n)
#define itr vector<ll>::iterator
#define print(s) cout<<s<<endl
#define inp(s) cin>>s
string yn(bool b) { return (b ? "Yes" : "No"); }
string YN(bool b) { return (b ? "YES" : "NO"); }
int main() {
		int n, m;
		std::cin >> n >> m;
		std::cout << n / m << " " << n % m << " ";
		cout<<fix(10)<<double(n) / double(m) << std::endl;
	return 0;
}


Measured memory_bytes: 3276
# -*- coding: utf-8 -*-

import itertools

# スペース区切りの整数の入力
N, M, X = map(int, input().split())
# 文字列の入力
#s = input()
#開業されたN個要素を受け付ける
input_list = [list(map(int, input().split())) for i in range(N)]

#print(input_list)
ans = -1
flg=1
for i in range(N+1):
    if i ==0:
        continue
    c = list(itertools.combinations(input_list, i))
    #print(c)
    flg=1
    for l in c:
        #print(l)
        flg=1
        for j in range(M):
            sum=0
            for k in range(i):
                #print(l[k][j+1])
                sum=sum+l[k][j+1]
            #print(sum)
            if sum<X:
                flg=0
        if flg==1:
            sum=0
            for j in range(i):
                sum=sum+l[j][0]
            if ans==-1:
                ans = sum
            elif sum<ans:
                ans = sum
        #print(ans)


print(ans)


Measured memory_bytes: 68552