akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE

//FUNCTION
void solve(void)
{
  string str;cin>>str;
  reverse(ALL(str));
  if(str[0] =='2' || str[0] == '4' || str[0] =='5' || str[0] =='7' || str[0] =='9')
  {
    cout<<"hon"<<endl;
  }
  else if(str[0] == '3')
  {
    cout<<"bon"<<endl;
  }
  else
  {
    cout<<"pon"<<endl;
  }
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


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

int main() {
  size_t N;
  std::cin >> N;

  unsigned long long ans=0;

  for (auto i=0; i<N; i++) {
    unsigned long long a;
    std::cin >> a;
    ans += a-1;
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

const int maxN = 1e2 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll sq(ll x) {return (x * x) % MOD;}
ll modP(ll a, ll b) {return (!b ? 1 : (sq(modP(a, b / 2)) * (b % 2 ? a : 1)) % MOD);}

vector <int> D[maxN];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	for (int i = 1; i < maxN; i++){
		for (int j = 1; j * i < maxN; j++){
			D[j * i].push_back(i);
		}
	}
	int m, d, ans = 0;
	cin >> m >> d;
	for (int i = 1; i <= m; i++){
		for (auto a : D[i]){
			int b = i / a;
			if (a != 1 && b != 1 && a < 10 && b < 10 && 10 * a + b <= d) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
lli repow(lli n,lli k,lli m){
  if(k==0)return 1;
  else if(k%2==1)return repow(n,k-1,m)*n%m;
  else{
    lli temp=repow(n,k/2,m);
    return temp*temp%m;
  }
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,Z,W,H,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  DV(P,lli,2,60,0);
  rep(i,0,N){
    cin >> A;
    rep(j,0,60){
      if(A&(1LL<<j))P[1][j]++;
      else P[0][j]++;
    }
  }
  num=N*(N-1)/2;
  rep(i,0,60){
    sum+=repow(2,i,mod)*((num-(P[1][i]*(P[1][i]-1)/2)-(P[0][i]*(P[0][i]-1)/2))%mod);
    sum%=mod;
  }
  Out(sum%mod);
}


Measured memory_bytes: 256
n,m = map(int,input().split())
cl = [0 for i in range(m+1)]
for i in range(n):
    a = list(map(int,input().split()))
    k = a[0]
    for i in range(1,k+1):
        cl[a[i]] += 1
ans = 0
for i in range(m+1):
    if cl[i] == n:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N; int M; cin>>N>>M;
  vector<int> S(M);
  for(int i=0; i<M; i++){
    cin>>S.at(i);
    N-=S.at(i);
  }
  if(N>=0)
    cout<<N<<endl;
  else cout<<-1<<endl;
}


Measured memory_bytes: 3604
A = list(map(int, input().split())) 

x = A[0]
k = A[1]
d = A[2]

first_k = abs(x) // d
if k < first_k:
  final_min = abs(x) - k * d
else:
  first_min = abs(x) % d
  second_min = abs(x) - d * (first_k + 1)

  if abs(first_min) < abs(second_min):
    first_k += 1
    final_min = second_min
  else:
    final_min = first_min
  remain_k = k - first_k
  if remain_k % 2 != 0:
    plus = final_min + d
    minus = final_min - d
    if abs(plus) > abs(minus):
      final_min = abs(minus)
    else:
      final_min = abs(plus)

print(abs(final_min))


Measured memory_bytes: 9216
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  int n;
  cin >> n;
  // 完全グラフから消していく
  vector<P> ans;
  if(n % 2) {
    for (int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        if(n - i == j) continue;
        int a, b;
        a = i; b = j;
        ans.push_back(P(a, b));
      }
    }
    
  } else {
    for (int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        if(n - i + 1 == j) continue;
        int a, b;
        a = i; b = j;
        ans.push_back(P(a, b));
      }
    }
  }

  cout << ans.size() << endl;
  rep(i, ans.size()) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
}

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);

// map of result of factorization
void factorization(ll n, map<ll, ll> &a) {
    while((n%2) == 0) {
        n /= 2;
        if(a.count(2)) a.at(2)++;
        else a[2] = 1;
    }
    for(ll i = 3; i*i <= n; i+=2) {
        while((n%i) == 0) {
            n /= i;
            if(a.count(i)) a.at(i)++;
            else a[i] = 1;
        }
    }
    if(n != 1) a[n] = 1;
}

void factorial_map(vector<ll> &n, vector<ll> &ninv);

int main() {
    ll n, m;
    cin >> n >> m;
    map<ll, ll> a;
    vector<ll> nfac(101010), ninv(101010);
    factorial_map(nfac, ninv);
    factorization(m, a);
    ll ans = 1;
    
    for(auto p: a) {
        auto v = p.second;
        ll comb = mtime(nfac[v+n-1], ninv[v], ninv[n-1]);
        ans = mtime(ans, comb, 1);
    }

    cout << ans << endl;
    
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        ret %= MOD;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count))%MOD;
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}

void factorial_map(vector<ll> &n, vector<ll> &ninv) {
    n[0] = 1;
    for(ll i = 1; i < n.size(); i++) n[i] = (n[i-1] * i) % MOD;
    ninv[n.size()-1] = inv(n[n.size()-1]);
    for(ll i = n.size() - 2; i > -1; i--) ninv[i] = (ninv[i+1] * (i+1)) % MOD;
}


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

using namespace std;


#define PI 3.14159265
#define int long long



main(){

	int n, k, c; cin >> n >> k >> c;

	string s; cin >> s;

	vector <int> l(k), r(k);

	vector <int> v;

	for(int i = 0; i < n; i++){
		if(s[i] == 'o')
			v.emplace_back(i);
	}

	for(int i = 0, j = 0; i < v.size() and j < k; j++){
		l[j] = v[i];
		i = upper_bound(v.begin(), v.end(), l[j] + c) - v.begin();
	}

	for(int i = v.size() - 1, j = k - 1; i >= 0 and j >= 0; j--){
		r[j] = v[i];
		i = upper_bound(v.begin(), v.end(), r[j] - c - 1) - v.begin();
		i--;
	}

	vector <int> ans;

	for(int i = 0; i < k; i++){
		if(r[i] >= l[i] and r[i] == l[i]){
			ans.emplace_back(r[i] + 1);
		}
	}

	for(int e : ans){
		cout << e << endl;
	}
	// cout << endl;
	
		
	return 0;
}

Measured memory_bytes: 8180
// C - Maximal Value
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	vector<int> b(n - 1);
	for (int i = 0; i < n - 1; i++) cin >> b[i];
	int sum = 0;
	for (int i = 0; i < b.size(); i++)
		sum += i > 0 ? min(b[i - 1], b[i]) : b[i];
	sum += b.back();
	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
 
int main() {
    int n; 
    cin >> n;
    ll a[n+10], b[n+10];
    
    rep(i, n) cin >> a[i] >> b[i];
        
    ll ans = 0;
    for (int i = n-1; i >= 0; i--)
    {   //ll rem = a[i] % b[i];
        if ((a[i] + ans) % b[i] == 0) continue;
        ans += b[i];
        ans -= (a[i]+ans) % b[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+100;
long long he[N],ed[N],e,ord[N],Cont[2],n,m;
bool p,P[N];
struct syzs{
	long long ne,va,to;
} a[N*2];
void add(long long u,long long v){
	e++;
	a[e].to=v;
	a[e].ne=he[u];
	he[u]=e;
}
void dfs(long long k,long long fa){
	if(p==true) return;
	ed[k]=(ed[fa]+1)%2;
	for(long long i=he[k];i;i=a[i].ne){
		long long v=a[i].to;
		if(v==fa) continue;
		if(!P[v]){
			P[v]=true;
			Cont[ed[k]]++;
			ord[v]=ed[k];
			dfs(v,k);
		}
		else if(ed[k]!=ord[v]) p=true;
	}
}
int main(){
	//freopen("1.txt","r",stdin);
	cin>>n>>m;
	for(long long i=1,u,v;i<=m;i++){
		scanf("%lld%lld",&u,&v);
		add(u,v);
		add(v,u);
	}
	ed[0]=P[1]=Cont[1]=1;
	ord[1]=ed[0];
	dfs(1,0);
	if(p==true) cout<<n*(n-1)/2-m;
	else cout<<(Cont[0]*Cont[1])-m;
	puts("");
}
/*
8 9
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 5
5 2
*/

Measured memory_bytes: 7552
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

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



int X;

int main () {
  cin >> X;
  int n = X / 100;

  for (int j=n;j>=0;--j) {
    int amari = X - 100 * j;

    if (amari > (j * 5)) {
      cout << 0 << "\n";
      return 0;
    } else {
      cout << 1 << "\n";
      return 0;
    }
  }
}

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

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

	if(a == 1)
		cout << '0';
	else
	{
		cout << '1';
	}

}


Measured memory_bytes: 3632
from collections import deque

n, q = map(int, input().split())
box = [deque()for i in range(n)]
for _ in range(q):
    a, b, *c = map(int, input().split())
    if a == 0:
        box[b].append(c[0])
    elif a == 1:
        if len(box[b]):
            print(box[b][0])
    else:
        if box[b]:box[b].popleft()



Measured memory_bytes: 14480
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_C

import math

num = int(input())

result = 0

while num > 0:
	x = int(input())
	isPrime = 0
	if x == 2:
		isPrime = 1
	elif x < 2 or x % 2 == 0:
		pass
	else:
		i = 3
		isPrime2 = 1
		while i <= math.sqrt(x):
			if x % i == 0:
				isPrime2 = 0
				break
			i = i + 2
		if isPrime2:
			isPrime = 1
	if isPrime:
		result += 1
	num -= 1

print(result)

Measured memory_bytes: 7704
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int mod=1000000007;
const int INF=1001001001;

int main() {
  int N,K;
  cin>>N>>K;
  vector<int64_t>a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  int64_t ans=1e18;
  for(int s=0;s<(1<<N);s++){
    vector<int>h(N);
    int k=0; 
    for(int i=0;i<N;i++){
      if((s>>i)&1){h[i]=1;k++;}
    }
    if(k<K){continue;}
    int64_t MIN=0;
    int64_t cost=0;
    for(int i=0;i<N;i++){
      if(i==0){MIN=a[0];}
      else if(h[i]==1&&a[i]<=MIN){
        int dis=MIN-a[i];
        cost+=dis+1;
        MIN=a[i]+dis+1;
      }
      else{MIN=max(MIN,a[i]);}
    }
    ans=min(ans,cost);
  }
  cout<<ans<<endl;
  return 0;  
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> count(N, 0);
  
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    count.at(a-1)++;
    count.at(b-1)++;
  }
  
  rep(i, count.size()) {
    cout << count.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm> 
using namespace std;
 
const int mod = 1e9+7;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

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

    vector<int> v(n);

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

    if(sum%10!=0){
        p(sum)
        return 0;
    }

    int ans=0;
    for(int i=0;i<v.size();i++){
        if((sum-v[i])%10!=0) ans = max(ans,sum-v[i]);
    }
    p(ans)
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    s = list(input())

    if s[2] == s[3] and s[4] == s[5]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3064
#include<iostream>
#include<cstring>

using namespace std;

int main(){
	int n;
	string s;
	cin >> s;
	n = (int)s.size();
	int first[n], freq[n];
	memset(freq, 0, sizeof(freq));
	for(int i = n - 1, first_left ; i >= 0 ; i--){
		s[i] == 'L' ? first_left = i : first[i] = first_left;		
	}
	for(int i = 0, first_right ; i < n ; i++){
		s[i] == 'R' ? first_right = i : first[i] = first_right;
	}
	for(int i = 0 ; i < n ; i++){
		if((first[i] - i) & 1){
			++freq[first[i] + (s[i] == 'R' ? -1 : 1)];
		}else{
			++freq[first[i]];
		}
	}
	for(int i = 0 ; i < n ; i++){
		cout << freq[i] << ' ';
	}
	cout << '\n';
	return 0;
}

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

bool ok(string &str){
	if(str[0]!='A') return false;
	int num=0;
	int id=-1;
	for(int i = 2;i<=str.size()-2;i++){
		if(str[i]=='C') {++num;id=i;}
	}
	if(num!=1) return false;
	for(int i=1;i<str.size();i++){
		if(i==id) continue;
		if(str[i]<'a' || str[i]>'z') return false;
	}
	return true;
}

int main(){
		string s;
		cin>>s;
		
		if(ok(s)) cout<<"AC"<<endl;
		else cout<<"WA"<<endl;
    
    return 0;

}


Measured memory_bytes: 256
#include <map>

template<long long sieve_N>
struct primes
{
	bool sieve[sieve_N];
	constexpr primes() : sieve()
	{
		for (long long i = 2; i < sieve_N; ++i)
		{
			sieve[i] = true;
		}
		sieve[0] = sieve[1] = false;
		for (long long i = 2; i < sieve_N; ++i)
		{
			for (long long j = i * i; j < sieve_N; j += i)
			{
				sieve[j] = false;
			}
		}
	}
};

constexpr primes<150000> p;

int main()
{
  int x;
  scanf("%d", &x);
  while (!p.sieve[x]) ++x;
  printf("%d\n", x);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

const int N=8;
map<string,int> mp;
int d[4]={-1,1,4,-4};

void bfs(){
	
	queue<string> q;
	q.push("01234567");
	
	while(q.size()){
		string t=q.front();
		q.pop();
		int p=t.find('0');
		for(int i=0;i<=3;i++){
			int np=p+d[i];
			if(p<0 || p>7 || ((p==3 || p==7) && i==1) || ((p==0 || p==4) && i==0)) continue;
			string n=t;
			swap(n[np],n[p]);
			if(mp[n]==0){
				mp[n]=mp[t]+1;
				q.push(n);
			}
		}
	}
	
}


int main(){
	bfs();
	mp["01234567"]=0;
	int a[N];
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]>>a[7]){
		string s;
		for(int i=0;i<8;i++)
			s+=a[i]+'0';
		cout<<mp[s]<<endl;
	}
	return 0;
}


Measured memory_bytes: 7460
using System;
namespace Csharponly
{
    class Program
    {
        static public void Main()
        {

            int R = Oneint();
            double ans = Math.PI * R * 2;
            Console.WriteLine(ans);
        
        }

		static int Oneint()
        {
            return int.Parse(Console.ReadLine());
        }
    }
}

Measured memory_bytes: 27612
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

struct Edge
{
	int a,b;
	Edge(int a, int b) : a(a),b(b) {}
};

signed main() {
	int n,m;
	std::cin >> n >> m;
	std::vector<std::vector<int> > from(n+1,std::vector<int>());
	std::vector<std::vector<int> > to(n+1,std::vector<int>());
	std::vector<int> dist(n+1,0);
	std::vector<Edge> edges;
	rep(i,n-1+m) {
		int a,b;
		std::cin >> a >> b;
		from[a].emplace_back(b);
		to[b].emplace_back(a);
		edges.emplace_back(a,b);
	}
	int root = 0;
	for(int i=1;i<=n;i++) {
		if(to[i].size()==0) {
			root = i;
			break;
		}
	}

	// dfs backwards
	std::function<int(int)> dfs = [&] (int i) -> int {
		if(i==root) return 0;
		if(dist[i]!=0) return dist[i];
		int max = 0;
		for(int a:to[i]) {
			max = std::max(dfs(a)+1,max);
		}
		return dist[i] = max;
	};

	for(int i=1;i<=n;i++) {
		dfs(i);
	}

	std::vector<int> parent(n+1,0);
	for(Edge e:edges) {
		if(dist[e.b]-dist[e.a]==1) parent[e.b] = e.a;
	}

	for(int i=1;i<=n;i++) print(parent[i]);


	return 0;
}


Measured memory_bytes: 18800
#include <cstdio>
#include <stdio.h>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <queue>
using namespace std;

struct point {
    int x;
    int y;

    point(int x, int y) {
        this->x = x;
        this->y = y;
    }
};

point grid[4] = {
    point(0, 1),
    point(0, -1),
    point(1, 0),
    point(-1, 0)
};

int main() {

    int H, W;
    scanf("%d %d", &H, &W);

    vector<vector<int> > map(H + 2, vector<int>(W + 2, -1));

    int whiteNum = 0; 
    for(int i = 1; i < H + 1; i++) {
        for(int j = 1; j < W + 1; j++) {
            char c;
            scanf(" %c", &c);

            if(c == '#') {
                map.at(i).at(j) = -1;
            } else {
                map.at(i).at(j) = 0;
                whiteNum++;
            }
        }
    }

    queue<point> queue;
    queue.push(point(1, 1));
    map.at(1).at(1) = 1;

    while(!queue.empty()) {
        point p = queue.front();
        queue.pop();

        for(int i = 0; i < 4; i++) {
            point dist = point(p.x + grid[i].x, p.y + grid[i].y);
            
            if(map.at(dist.y).at(dist.x) == 0) {
                map.at(dist.y).at(dist.x) = map.at(p.y).at(p.x) + 1;
                queue.push(dist);
            } else {
                continue;
            }
        }
    }

    /*
    printf("\n");
    for(int i = 0; i < H + 2; i++) {
        for(int j = 0; j < W + 2; j++) {
            printf("%3d", map.at(i).at(j));
        }
        printf("\n");
    }
    */

    if(map.at(H).at(W) == 0) {
        printf("%d\n", -1);
    } else {
        printf("%d\n", whiteNum - map.at(H).at(W));
    }
    return 0;
}

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

int main() {
  long long N,K;
  cin >> N >> K;
  vector<long long> A(N + 1);
  
  for (long long i = 1; i < N + 2; i++) 
    A.at(i - 1) = i*(N + 1) - i*i + 1;
  
  long long ans = 0;
  for (long long j = K - 1; j < N + 1; j++) 
    ans += A.at(j);
  
  cout << ans%1000000007 << endl;
    
}

Measured memory_bytes: 4732
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    W, H, x, y = MI()
    ans = (W * H) / 2
    exist = int((W == x * 2) and (H == y * 2))
    print(ans,exist)
if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <set>
#include <algorithm>

using namespace std;
typedef long long ll;
#define all(x) begin(x), end(x)

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

    if (a >= k) cout << k << endl;
    else if (a+b >= k) cout << a << endl;
    else cout << a - (k - (a+b)) << endl;;

    return 0;
}

Measured memory_bytes: 3636
/* Simplicity and Goodness */
 
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 2e5+2;

int me(int x, int n)
{
    int res = 1;
    while(n) {
        if(n&1) res = (1LL * res * x) % mod;
        x = (1LL * x * x) % mod;
        n >>= 1; 
    }
    return res;
}

void solve()
{   
    int n;
    scn(n);

    map<int, int> fa;

    rep(i, 0, n) {
        int val;
        scn(val);
        fa[val] ++;
    }

    bool ok = 1;

    if(n&1 and (!fa.count(0) or fa[0] != 1))
        ok = 0;

    if(n&1^1 and fa.count(0))
        ok = 0;

    if(fa.count(0)) fa.erase(0);

    for(auto i : fa) 
        ok &= i.S == 2;

    int ans = me(2, n/2);

    if(ok) {
        prin(ans);
    } else {
        prin(0);
    }
}

int main()
{
    int t = 1;
    // scn(t);

    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 6664
#include <stdio.h>

int main(void){
	int n,m;
	scanf("%d%d",&n,&m);
	
	for(int i=m/n+1;i>0;i--){
		if(m%i==0 && i*n<=m) {
			printf("%d",i);
			return 0;
		}
	}
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(X)<<Y<<endl
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

double A,B,X;
double PI=3.141592653589793238462643383279;

signed main(){
	cin>>A>>B>>X;
	double H=(2*X)/(A*B);
	if(H>=A){
		double C=(2*X-B*A*A)/(A*A);
		double T=atan2(B-C,A)/PI*180;
		setp(10,T);
		return 0;
	}
	double T=atan2(B,H)/PI*180;
	DEB(H)END
	setp(10,T);
	return 0;
}


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

typedef long long ll;
typedef long double ld;
#define size(a) int((a).size())
#define present(c, x) (c.find(x) != c.end()) 

class myComparator {
public: 
	int operator() (pair<int, int> a, pair<int, int> b) {
		return a.second > b.second;
	}
};

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,m; cin >> n >> m;
	int a[n];
	for (int i = 0; i<n; i++) cin >> a[i];
	vector<pair<int, int>> bc(m);
	for (int i = 0; i<m; i++) {
		int b,c; cin >> b >> c;
		bc[i] = make_pair(b, c);
	}
	sort(a, a+n);
	sort(bc.begin(), bc.end(), myComparator());
	ll curr_ret = 0;
	int ptr1 = 0, ptr2 = 0;
	for (int i = 0; i<m && ptr1 < n; i++) {
		if (a[ptr1] < bc[i].second) {
			ptr2 = ptr1;
			while (ptr2 < n && a[ptr2] < bc[i].second && bc[i].first > 0) {
				a[ptr2] = bc[i].second; 
				ptr2++;
				bc[i].first--;
			}
			ptr1 = ptr2;
		}
	}
	for (int i = 0; i<n; i++) curr_ret += a[i];
	cout << curr_ret << '\n';
}



Measured memory_bytes: 4476
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	forever{
		bool White = false;
		int n,m;
		cin >> n >> m;
		if (n == 0 && m == 0) { break; }
		vector<int>a;
		rep(i, m) {
			int contents;
			cin >> contents;
			if (contents == 0) { White = true; }
			else {
				a.push_back(contents);
			}

		}
		Sort(a);
		int max = 0;
		vector <int>length_mem;
		if (!White) {
			int length = 0;
			rep(i, a.size()) {
				if (i != 0) {
					if (a[i] == a[i - 1] + 1) {
						length++;
					}
					else {
						length_mem.push_back(length);
						length = 0;
					}
				}
			}
			length_mem.push_back(length);
			Sort(length_mem);
			}
		else {
			vector<int>starts;
			vector<int>ends;
			int length = 0;
			rep(i, a.size()) {
				if (i != 0) {
					if (a[i] == a[i - 1] + 1) {
						length++;

					}
					else {
						length_mem.push_back(length);
						length = 1;
						ends.push_back(a[i - 1]);
						starts.push_back(a[i]);
					}
				}
			}
			length_mem.push_back(length);
			//if (starts.size() != 0) { ends.push_back(); }
			for (int i = 0; i < starts.size(); i++) {
				if (ends[i] + 2 == starts[i]) {
					length_mem.push_back(length_mem[i] + length_mem[i + 1] + 1);
				}
			}
			Sort(length_mem);
		}
		max = length_mem[length_mem.size() - 1] ;
		if (!White) { max++; }
		cout << max << endl;
	}
	return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,N,s,ans;
  cin>>N;
  s=0;
  vector<int> A(N);
  for(i=0;i<N;++i){
    cin>>A[i];
  }
  sort(A.begin(),A.end());
  ans=A[N/2]-A[N/2-1];
  cout<<ans<<endl;
  return 0;
}


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

int main() {
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;
	
	int pay = X * min(N, K);

	N -= K;
	if (N>0) pay += (Y*N);

	cout << pay << endl;
	return 0;
}

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

int main() {
    string str1, str2;
    cin >> str1 >> str2;
    if(str1 == str2.substr(0, str1.length())) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3624
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int X = Integer.parseInt(sc.get());
		int Y = Integer.parseInt(sc.get());
		for (int i = 0; i <= X; i++) {
			int j = X - i;
			if (i * 2 + j * 4 == Y) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

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

int main()
{
	int n, i, taro, hana;
	taro = hana = 0;
	char s1[102], s2[102];
	
	scanf("%d", &n);
	
	for(i=0;i<n;i++){
		scanf("%s %s", s1, s2);
		
		if ( strcmp(s1, s2) == 0 ){
			taro ++; hana ++;
		}
		else if ( strcmp(s1, s2) > 0 ){
			taro += 3;
		}
		else if ( strcmp(s1, s2) < 0 ){
			hana += 3;
		}
	}
	printf("%d %d\n", taro, hana);
	
	return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int dp[1<<26];
const int INF = 1e9;

int main() {
	string s;
	cin >> s;
	rep(i,(1<<26)) dp[i] = INF; // 0 : even, 1 : odd
	dp[0] = 0;
	int stat = 0;
	rep(i,s.size()) {
		stat ^= 1 << (s[i]-'a');
		// length even
		dp[stat] = dp[stat];
		// length odd
		rep(j,26) {
			int tmp = (stat^(1<<j));
			dp[stat] = min(dp[stat], dp[tmp]+1);
		}
	}
	cout << (dp[stat] ? dp[stat] : 1) << endl;
	return 0;
}


Measured memory_bytes: 262788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1<<29;
using Graph = vector<vector<int>>;
int main() {
    int N; cin >> N;
    int tmp=0;
    string ans = "No";
    for (int i=0; i<N; i++){
        int d1,d2; cin >> d1 >> d2;
        if (d1==d2) tmp++;
        else tmp = 0;
        if (tmp==3) ans = "Yes";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t = 1;
const ll inf=2*hell;
const ld PI = 3.1415926535897932384626433832795, eps = 1e-8;
inline ll mult(ll x,ll y){return (x*y)%hell;}
inline ll add(ll x,ll y){x+=y;return x%hell;}
inline ll powMod(ll base,ll expo){
	ll ans=1;
	while(expo){
		if(expo&1)ans=mult(ans,base);
		base=mult(base,base);
		expo>>=1;
	}
	return ans;
}
inline ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
void solve(){
	set<string> seta;
	ll n;
	cin>>n;
	rep(i,0,n){
		string s;
		cin>>s;
		seta.insert(s);
	}
	cout<<sz(seta);
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 //  	cin>>t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


Measured memory_bytes: 19292
import java.util.Scanner;

public class Main{

	public static void main(String[]args) {
		Scanner sc =new Scanner(System.in);
		int summerlong = sc.nextInt();
		int hw = sc.nextInt();
		int[] hwArray = new int[hw];
		for(int i =0; i < hw;i++) {
			hwArray[i]=sc.nextInt();
		}
		int totalHw = 0;
		for(int i =0;i<hw;i++) {
			totalHw+=hwArray[i];
		}
		if(totalHw<=summerlong) {
			System.out.print(summerlong-totalHw);
		}else{
			System.out.print("-1");
		}
	}
}


Measured memory_bytes: 46552
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

S = gets.chomp

if S[2] == S[3] && S[4] == S[5]
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 14476
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>

const char main_[] = {
	0x48, 0xc7, 0xc0, 0x00, 0x00, 0x00, 0x00,
	0x48, 0x89, 0xf9,
	0x48, 0x83, 0xc1, 0x03,
	0x48, 0x39, 0xf9,
	0x74, 0x14,
	0x48, 0x0f, 0xb6, 0x17,
	0x48, 0x83, 0xfa, 0x31,
	0x75, 0x04,
	0x48, 0x83, 0xc0, 0x01,
	0x48, 0x83, 0xc7, 0x01,
	0xeb, 0xe7,
	0xc3
};

int main(void){
	int fd = open("/dev/zero", O_RDONLY);
	int (*solve)(char[]) = mmap(NULL, sizeof main_, PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
	memcpy(solve, main_, sizeof main_);

	char str[4];
	fgets(str, sizeof str, stdin);
	printf("%d\n", solve(str));

	close(fd);
	munmap(solve, sizeof main_);
	return 0;
}


Measured memory_bytes: 128
import string
numbers = "0123456789"
alphabets = string.ascii_letters
characters = numbers + alphabets
def base_cvt(value, n=2):
    result = ''
    tmp = value
    while tmp >= n:
        idx = tmp%n
        result = characters[idx] + result
        tmp = int(tmp / n)
    idx = tmp%n
    result = characters[idx] + result
    return result

N,K=map(int,input().split())
print(len(str(base_cvt(N,K))))



Measured memory_bytes: 4084
//              _      _                 
//             (_)    | |                
//    _ __ ___  _  ___| |__   __ _  ___  
//   | '_ ` _ \| |/ __| '_ \ / _` |/ _ \ 
//   | | | | | | | (__| | | | (_| | (_) |
//   |_| |_| |_|_|\___|_| |_|\__,_|\___/ 
//                                       
// 
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
using namespace std;
string ans="";

int fastpow(int a ,int b)
{
	int wynik=1;
	while (b)
	{
		if (b&1)wynik=(wynik*a);
		a=(a*a);
		b>>=1;
	}
	return wynik;
}

int32_t main()
{
  BOOST;
  int n;
  cin>>n;
  int ile=0,x=1;
  while (ile<n)ile+=fastpow(26,x),x++;
  x--;
  for (int i=1;i<=x-1;i++)n-=fastpow(26,i);
  for (int i=1;i<=x;i++)
  {
  	int previ=0;
  	int akt=0;
  	for (int j=0;j<26;j++)
  	{
  		akt+=fastpow(26,x-i);
  		if (akt>=n)
  		{
  			ans+=char(j+97);
  			n-=previ;
  			break;
  		}
  		previ=akt;
  	}
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

import static java.lang.Integer.max;
import static java.lang.Integer.min;

public class Main {
    private static final int M = 2000;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        char[] a = scanner.nextLine().toCharArray();
        char[] b = scanner.nextLine().toCharArray();
        char[] c = scanner.nextLine().toCharArray();
        boolean[] ab = new boolean[10*M];
        boolean[] ac = new boolean[10*M];
        boolean[] bc = new boolean[10*M];

        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < b.length; j++) {
                if(!match(a[i], b[j])) ab[i-j+5*M] = true;
            }
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < c.length; j++) {
                if(!match(a[i], c[j])) ac[i-j+5*M] = true;
            }
        }
        for (int i = 0; i < b.length; i++) {
            for (int j = 0; j < c.length; j++) {
                if(!match(b[i], c[j])) bc[i-j+5*M] = true;
            }
        }
        int ans = 3*M;
        for (int i = -2*M; i <= 2*M ; i++) {
            for (int j = -2*M; j <= 2*M ; j++) {
                if(!ab[i+5*M] && !ac[j+5*M] && !bc[j-i+5*M]){
                    int L = min(0, min(i,j));
                    int R = max(a.length, max(b.length + i, c.length +j));
                    ans = min(ans,R-L);
                }
            }
        }
        System.out.println(ans);
    }

    private static boolean match(char c1, char c2){
        return c1 == '?' || c2 == '?' || c1 == c2;
    }
}

Measured memory_bytes: 24780
r, g, b, n = map(int, input().split())

count = 0
r, g, b = sorted([r, g, b], reverse=True)


for i in range(n // r + 1):
    rc = r * i
    for j in range((n - rc) // g + 1):
        gc = g * j
        if (n - rc - gc) % b == 0:
            count += 1
print(count)


Measured memory_bytes: 2940
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    Set<Integer> set = new HashSet<>();
    boolean check = false;
    int cnt = 0;

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

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

        int gcd = a[0];

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

        int[] smallPrime;
        smallPrime = sieve(1000001);

//        for (int i=0; i<100+1; i++) System.out.print(smallPrime[i] + " ");

        for (int i=0; i<n; i++) {
            Set<Integer> setS = factor(a[i], smallPrime);
            cnt += setS.size();
        }

//        System.out.print(set);
//        System.out.print(cnt);


        if (!check && set.size() == cnt) {
            System.out.print("pairwise coprime");
            return;
        }


        if (gcd == 1) {
            System.out.print("setwise coprime");
            return;
        }

        System.out.print("not coprime\n");

    }

    int gcd(int c, int d) {
        if (c < d) return gcd(d, c);
        if (d == 0) return c;
        return gcd(d, c % d);
    }

    int[] sieve(int n) {
        int[] res = new int[n+1];
        for (int i=0; i<n+1; i++) res[i] = i;
        for (int i=2; i*i<n; i++) {
            if (res[i] < i) continue;
            for (int j=i*i; j<=n; j+=i) {
                if (res[j] == j) res[j] = i;
            }
        }
        return res;
    }

    Set<Integer> factor(int n, int[] min) {
        Set<Integer> set1 = new HashSet<>();
        while (n > 1) {
            set.add(min[n]);
            set1.add(min[n]);
            n /= min[n];
        }
        return set1;
    }


}



Measured memory_bytes: 71828
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

int main() {
  ll K, N;
  cin >> K >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  std::sort(A.begin(), A.end());
  vector<ll> B(N);
  rep(i, N-1) {
    B[i] = A[i+1] - A[i];
  }
  B[N-1] = K - A[N-1] + A[0];
  std::sort(B.begin(), B.end());
  cout << K - B[N-1] << '\n';
}


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

int main() {
  int N;
  cin >> N;
  map<int,int> mode;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    mode[x] += 1;
  }
  bool bl = false;
  bool b = true;
  int k = mode.size();
  if (k == 1 && mode[0] == N) bl = true;
  if (k == 2 && double(mode[0]) == N/3.0) bl = true; 
  if (k == 3) {
    vector<int> v;
    for (auto m : mode) {
      v.push_back(m.first);
      if (m.second != N/3) b = false;
    }
    bitset<32> A(v[0]);
    bitset<32> B(v[1]);
    bitset<32> C(v[2]);
    if ((A^B) == C) bl = true;
  }
  cout << (bl & b ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3840
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int[] arr = new int[N];
         st = new StringTokenizer(infile.readLine());
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(st.nextToken());
         //N is even jfc
         long all = 0L;
         for(int x: arr)
            all ^= x;
         StringBuilder sb = new StringBuilder();
         for(int x: arr)
            sb.append(all^x).append(" ");
         System.out.println(sb);
      }
   }

Measured memory_bytes: 55224