akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cctype>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VII;
typedef pair<int, int> PII;
typedef long long ll;

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back;
#define MP make_pair
#define SIZE(a) int((a).size())
#define SORT(c) sort((c).begin(), (c).end())

const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 3;

int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(void){
  int w[10], k[10], ws, ks;
  for(int i = 0; i < 10; i++) cin >> w[i];
  for(int i = 0; i < 10; i++) cin >> k[i];
  sort(w, w + 10, greater<int>()); sort(k, k + 10, greater<int>());
  ws = w[0] + w[1] + w[2];
  ks = k[0] + k[1] + k[2];
  cout << ws << " " << ks << endl;
  return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
#define ALL(x) x.begin(), x.end()
#define mset(a, b) memset(a, b, sizeof a)
#define rep(i, a, b) for(int i(a), i##_END_(b); i <= i##_END_; i++) 
#define drep(i, a, b) for(int i(a), i##_END_(b); i >= i##_END_; i--)
using namespace std;
template<class T> inline bool tomax(T &a, T b) {return a < b ? a = b, 1 : 0;}
template<class T> inline bool tomin(T &a, T b) {return b < a ? a = b, 1 : 0;}
typedef long long ll;
typedef double db;

int main() {
    int n, d;
    cin >> n >> d;
    cout << (n + d * 2) / (2 * d + 1);
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    if len(S)%2 == 1:
        print(NO)
        return
    
    for i in range(len(S)//2):
        j = 2*i
        if S[j:j+2] == "hi":
            continue
        else:
            print(NO)
            return
    print(YES)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

bool done[10][10];

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> board(H);
	for (int i = 0; i < H; i++)
		cin >> board[i];
	int y = 0, x = 0;
	while (1) {
		done[y][x] = true;
		if (y == H-1 && x == W-1) break;
		if (y+1 < H && board[y+1][x] == '#') {
			y = y+1;
			continue;
		}
		if (x+1 < W && board[y][x+1] == '#') {
			x = x+1;
			continue;
		}
		break;
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (board[i][j] == '#' && !done[i][j]) {
				cout << "Impossible" << endl;
				return 0;
			}
		}
	}
	cout << "Possible" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){int b=0;for(auto itr :a){if(b++!=0)cout << " "; cout << itr;} }
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
#define int ll
signed main(){
    int n,a,b,c,x;
    while(cin >> n >> a >> b >> c >> x,n+a+b+c+x){
        vector<int>v(n); rep(i,n) cin >>v[i];
        int cnt =0;
        int num = x;
        bool ans = false;
        for(int i = 0; i<=10000;i++){
            if(i)num = (a*num+b)%c;
            if(v[cnt] == num){
                cnt++;
                if(cnt==n){
                    cout << i << endl;
                    ans = true;
                    break;
                }
            }
        }
        if(ans == false)cout << -1 << endl;
    }
}




Measured memory_bytes: 3088
#include <iostream>
#define ll long long
using namespace std;
ll a[190] , n , k , dp[100090][120];
int main()
{
    cin >> n >> k ;
    for(int i=0;i<n;i++)
        cin >> a[i];
    for(int i=0;i<=k;i++){
        for(int j=0;j<n;j++){
            int bla =i - a[j];
            if(bla >= 0){
                dp[i][j] = (!dp[bla][n]);


            }

                    dp[i][n]|=dp[i][j];
        }
    }
    int ans =0;
    for(int j=0;j<n;j++)ans |= dp[k][j];

    cout << ((ans>0)?"First":"Second");
    return 0;
}


Measured memory_bytes: 93952
n = int(input())
a = list(map(int,input().split()))

ans = float('inf')
for _ in range(2):
    tmp = 0
    if _:
        if a[0] > 0:
            x = a[0]
        else:
            x = 1
            tmp = 1 - a[0]
    else:
        if a[0] < 0:
            x = a[0]
        else:
            x = -1
            tmp = 1 + a[0]
    for i in range(1, n):
        y = x + a[i]
        if x*y >= 0:
            if x > 0:
                tmp += y+1
                y -= y+1
            elif x < 0:
                tmp -= y-1
                y -= y-1
        x = y
    ans = min(ans, tmp)
print(ans)

Measured memory_bytes: 19944
def solve(arr)
  sorted = arr.sort
  n = arr.length
  used = Array.new(n, false)
  minimum = arr.min
  max = arr.max
  circle_index = Array.new(max)
  arr.each_with_index do |v, i|
    circle_index[v] = i
  end
  # puts circle_index

  ans = 0
  arr.each_with_index do |v, i|
    if used[i]
      next
    end
    if sorted[i] == v
      used[i] = true
      next
    end
    cur_i = i
    m = v
    s = v
    cur_n = 1
    used[i] = true
    while true
      cur_i = circle_index[sorted[cur_i]]
      if used[cur_i] 
        break
      end
      # puts "i: #{i}, cur_i: #{cur_i}, m: #{m} s: #{s}"
      m = [m, arr[cur_i]].min
      s += arr[cur_i]
      cur_n += 1
      used[cur_i] = true
    end
    ans += [(s + (cur_n - 2) * m), (s + m + (cur_n + 1) * minimum)].min
  end
  ans
end

n = gets.to_i
arr = gets.split.map(&:to_i)
puts solve(arr)



Measured memory_bytes: 8956
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;

const int maxn=500111;

char s[maxn];
int n,tl[maxn],tr[maxn];

int main()
{
	scanf("%s",s+1);n=strlen(s+1)+1;
	for(int i=2;i<=n;i++)if(s[i-1]=='<')tl[i]=tl[i-1]+1;else tl[i]=0;
	for(int i=n-1;i>=1;i--)if(s[i]=='>')tr[i]=tr[i+1]+1;else tr[i]=0;
	LL ans=0;
	for(int i=1;i<=n;i++)ans+=max(tl[i],tr[i]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

vector<pair<ll, ll> > prime_factorize(ll N) {
    vector<pair<ll, ll> > res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
    ll N;
    cin >> N;
  	int ans = 0;
    const auto &res = prime_factorize(N);
  
    ll z; 
    for (auto p : res) {
      z = 1;
    	for(int i = 1; i <= p.second ; i++){
		  z *= p.first;
          if(N % z == 0){
            ans++;
            N /= z;
          }
        }
    }
    cout << ans <<endl;
}

Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <limits>
#include <iomanip>

using namespace std;

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

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

typedef long long ll;
ll cntc, cnts;
bool check(ll A) {
	ll tc = cntc, ts = cnts;
	if (A > ts)
		tc -= (A - ts) * 2, ts = A;
	return tc >= 2 * A;
}

int main() {
	cin >> cnts >> cntc;
	ll s = 0, e = 1e12;
	while (s + 1 != e) {
		ll mid = (s + e) / 2;
		if (check(mid))
			s = mid;
		else
			e = mid;
	}
	cout << s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define mod 1000000007
#define N 500043
#define mp(a,b) make_pair(a,b)
#define loop(a,b) for(int i=a;i<b;i++)
#define test int t; cin >> t; while(t--)
using namespace std;

int dfs(vector<vector<int>>&graph,vector<int>&checked,int node){
    int x=0;
    for(int i=0;i<graph[node].size();i++){
        if(checked[graph[node][i]]==-1){
            x=max(x,dfs(graph,checked,graph[node][i])+1);
        }
        else{
            x=max(x,checked[graph[node][i]]+1);
        }
    }
    checked[node]=x;
    return x;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin >> n >> m;
    vector<vector<int>>vec(n+1);
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin >> x >> y;
        vec[x].push_back(y);
    }
    vector<int>checked(n+1,-1);
    for(int i=1;i<=n;i++){
        if(checked[i]==-1){
            dfs(vec,checked,i);
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        ans=max(ans,checked[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 11720
#include<stdio.h>

int main()
{
    int room[5][4][11]={0},a,b,f,r,v,i,j,k;
    scanf("%d\n",&a);
    for(i=0;i<a;i++){
    	scanf("%d %d %d %d",&b,&f,&r,&v);
    	if(v>9)
    	    v=9;
    	room[b][f][r] += v;
    }
    for(i=1;i<5;i++){
    	for(j=1;j<4;j++){
    		for(k=1;k<11;k++){
    			printf(" %d",room[i][j][k]);
    		}
    		printf("\n");
    	}
    	if(i<4){
    		printf("####################\n");
    	} 
    }
    return 0;
}

Measured memory_bytes: 612
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

l=[a,b,c,d,e]
l.sort()

if n%l[0]!=0:
        print(5+n//l[0])
else:
        print(4+n//l[0])

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(obj) obj.begin(), obj.end()

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 iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

// int main() { 
//     int L;
//     cin >> L;
//     long long ans = 0;
//     for (int i = 1; i <= L; i++) {
//         for (int j = 1; j <= L; j++) {
//             long long k = L - i - j;
//             if (k >= 0) {
//                 ans = max(ans, (long long)i * (long long)j * k);
//             }
//         }
//     }
//     cout << ans << endl;


//     return 0; 
// }

int main() {
    double L;
    cin >> L;
    printf("%.9f\n", pow(L / 3, 3));
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;


int main(void){
    int a;
    vector<int> v;

    rep(i,3){
        cin >> a;
        v.push_back(a);
    }
    int count=0;
    sort(v.begin(),v.end());
    while(v.at(0)!=v.at(2)){
        if(v.at(0)>v.at(2)){
            v.at(1)++;
            v.at(2)++;
        }else if(v.at(1)==v.at(2)){
            v.at(0) +=2;
        }else{
            v.at(0)++;
            v.at(1)++;
        }
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
a=input().split()
N,M=int(a[0]),int(a[1])
L,R=[],[]
ans=0
o,p,q,O=[],[],[],[]
for i in range(0,M):
    a=input().split()
    L.append(int(a[0]))
    R.append(int(a[1]))
    a.clear()
num=len(L)

l=max(L)
r=min(R)+1

for i in range(l,r):
    ans=ans+1
print(ans)


Measured memory_bytes: 11000
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define DEBUG false

int main(){
	
	//1500000	
	int n, m;
	while(cin >> m >> n, m, n){
		vector<ll> w(n);
		rep(i, n) cin >> w[i];
		int l = 0, r = 1500000;
			while (r - l > 1) {
				int mid = (l + r) / 2;
				
				bool flag = false;
				int pos = 0;
				rep(i, m){
					int tmp = 0;
					while(pos != n && tmp + w[pos] <= mid){
						tmp += w[pos];
						pos++;
					}
					if(pos == n) flag = true;
				}
				
				if (flag) r = mid;
				else l = mid;
			}
		
		cout << r << endl;
		
		
	}
	
	
	
	return 0;
}

/*
struct BIT {
  int N;
  vector<ll> data;
  BIT(int n) : N(n), data(n + 1, 0) { }
  void add(int a, ll w) {
    ++a;
    for(int x = a; x <= N; x += x & -x) {
      data[x] += w;
    }
  }
  ll sum(int a) {
    ll ret = 0;
    for(int x = a; x > 0; x -= x & -x) {
      ret += data[x];
    }
    return ret;
  }
  
  ll sum(int l, int r){//[l, r)
  	return sum(r) - sum(l);
  }
};

BIT bit = BIT(1);
int m, n;

ll dfs(int pos, int rest){
	ll ret = LLINF;
	
	if(rest == 1) return bit.sum(pos, n+1);
	for(int i = 0; i + pos <= n+1; i++){
		ll hoge1 = bit.sum(pos, pos+i);
		ll hoge2 = dfs(pos+i, rest-1);
		cout << "sum(" << pos << ", " << pos+i << "): " << hoge1 << endl;
		cout << "des(" << pos+i << ". " << rest-1 << "): " << hoge2 << endl;
		cout << endl;
		ret = min(ret, hoge1 + hoge2);
	}
	
	return ret;
}

int main(){

	while(cin >> m >> n, m, n){
		bit = BIT(n);
		rep(i, n){
			ll tmp;
			cin >> tmp;
			bit.add(i+1, tmp);
		}
		
		cout << dfs(1, m) << endl;
		
	}
	
	return 0;
}
*/

Measured memory_bytes: 3084
#include<iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main(){
    vector<pair<int, int>  > pairs;
    int n;
    int tmp;
    cin >> n;

    for(int i=0; i<n; i++){
        cin >> tmp;
        pairs.push_back(make_pair(tmp, i+1));
    }
    sort(pairs.begin(), pairs.end());
    for(int i=0; i<n; i++){
        cout << pairs[i].second << ' ';
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 1780
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main(void) {
    int N,i,k=8;
    scanf("%d" ,&N);
    for (i=2; i<=9; i++) {
        if (200*i<=N && N < 200*(i+1) ){
            printf("%d" ,k);
        }
            k--;
    }
    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long

int main(){
    IOS;

    string s;
    bool playable = true;

    cin>>s;

    for(long int i = 0; i < s.size(); i++){
        if(i % 2 == 0)
            playable &= (s[i] == 'R' || s[i] == 'U' || s[i] == 'D');
        else
            playable &= (s[i] == 'L' || s[i] == 'U' || s[i] == 'D');
    }

    if(playable)
        cout<<"Yes";
    else    
        cout<<"No";

    return 0;
}

Measured memory_bytes: 256
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

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

typedef struct UnionFind_ {
  vector<int> par;
  vector<int> rank_;
  UnionFind_(int n): rank_(n, 0) {
    for(int i = 0; i < n; i++)par.push_back(i);
  }
  int find(int x) {
    if(par[x] == x)return x;
    else return par[x] = find(par[x]);
  }
  bool same(int x, int y) {
    if(find(x) == find(y))return true;
    else return false;
  }
  bool unite(int x, int y){
    int xp = find(x);
    int yp = find(y);
    if(xp == yp)return false;
    if(rank_[xp] > rank_[yp])par[yp] = xp;
    else if(rank_[xp] < rank_[yp])par[xp] = yp;
    else {
      par[yp] = xp;
      rank_[xp]++;
    }
    return true;
  }
} UnionFind;

int at[200001];

int main(int argc, char const* argv[])
{
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  rep(i, m)cin >> x[i];
  sort(all(x));
  rep(i, m-1){
    at[x[i+1] - x[i]] += 1;
  }
  ll res = 0;
  if(n >= m){
    cout << 0 << endl;
    return 0;
  }
  int curr = m - n;
  for(int i = 1; i < 200001; i++){
    if(at[i] >= curr){
      res += (ll)curr * i;
      break;
    }else{
      res += (ll)at[i] * i;
      curr -= at[i];
    }
  }
  cout << res << endl;
	return 0;
}


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

int main() {
  int N; cin >> N;
  int cnt = 0;
  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }

  for(int i = 0; i < N; i++){
    // same を抜ける
    while (i+1 < N && A[i] == A[i+1]) ++i;

    // up
    if (i+1 < N && A[i] < A[i+1]) {
        while (i+1 < N && A[i] <= A[i+1]) ++i;
    }
    // down
    else if (i+1 < N && A[i] > A[i+1]) {
        while (i+1 < N && A[i] >= A[i+1]) ++i;
    }
    cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3784
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use text_io::*;

fn main() {
    const U_INF: usize = 1 << 60;
    const I_INF: isize = 1 << 60;
    let n: usize = read!();
    let mut a = vec![];
    for _ in 0..n {
        let ai: isize = read!();
        a.push(ai);
    }

    let mut sum_a = vec![0; n + 2];
    for i in 1..=n + 1 {
        sum_a[i] = sum_a[i - 1] + *a.get(i - 1).unwrap_or(&0);
    }


    let mut dp = vec![vec![None; n + 10]; n + 10];
    for i in 0..=n {
        dp[i][i] = Some(0);
    }
    println!("{}", solve(1, n, &mut dp, &sum_a));
}

fn solve(i: usize, j: usize, dp: &mut Vec<Vec<Option<isize>>>, a: &Vec<isize>) -> isize {
    match dp[i][j] {
        Some(t) => t,
        None => {
            let mut ans = 1 << 60;
            for k in i..j {
                ans = (ans).min(solve(i, k, dp, a) + solve(k + 1, j, dp, a) + a[j] - a[i - 1]);
            }
            dp[i][j] = Some(ans);
            ans
        }
    }
}


Measured memory_bytes: 4808
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    string str;
    int k;
    cin >> str >> k;
    set<string> s;
    int sz = str.size();
    for (int i = 0; i < sz; i++) {
        string temp;
        for (int j = i; j < min(sz, i+k); j++) {
            temp += str[j];
            s.insert(temp);
        }
    }
    auto it = s.begin();
    //cout << s.size() << "\n";
    for (int i = 1; i < k; i++) {
        //cout << *it << "\n";
        it++;
    }
    cout <<*it << "\n";
    return 0;
}


Measured memory_bytes: 1664
<?php
fscanf(STDIN, "%s", $city);
$monsters = array_reverse(explode(' ', trim(fgets(STDIN))));
$hero_powers = array_reverse(explode(' ', trim(fgets(STDIN))));

$result = 0;
foreach ($hero_powers as $i => $power) {
    $side_city = $i;
    $my_city = $i + 1;
  
	//echo "hero_powers = $hero_powers[$i]\n";
	//echo "side_monster = $monsters[$side_city]\n";
	//echo "my_monster = $monsters[$my_city]\n";
  
    // 隣町 -> 余力なし
    if ($monsters[$side_city] >= $hero_powers[$i]) {
        $result += $hero_powers[$i];
        $monsters[$side_city] -= $hero_powers[$i];
      	//echo "nokori_monster = $monsters[$side_city]\n";
        $hero_powers[$i] = 0;
        continue;
    }

    // 隣町 -> 余力あり
    $result += $monsters[$side_city];
    $hero_powers[$i] -= $monsters[$side_city];
    $monsters[$side_city] = 0;
    //echo "nokori_power = $hero_powers[$i]\n";

    

    // 自分町 -> 余力なし
    if ($monsters[$my_city] >= $hero_powers[$i]) {
        $result += $hero_powers[$i];
        $monsters[$my_city] -= $hero_powers[$i];
      	//echo "nokori_monster = $monsters[$side_city]\n";
        $hero_powers[$i] = 0;
        continue;
    }

    // 自分町 -> 余力あり
    $result += $monsters[$my_city];
    $hero_powers[$i] -= $monsters[$my_city];
    $monsters[$my_city] = 0;
    //echo "nokori_power = $hero_powers[$i]\n";
}

echo "$result\n";

Measured memory_bytes: 25072
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int width = 0;

    width = a - 2*b;
    if(width <= 0){
        System.out.println(0);
    } else{
        System.out.println(width);
    }

    

    }
}

Measured memory_bytes: 22868
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <queue>
#include <math.h>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
using namespace std;

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

	if (a == b)
	{
		cout << c << endl;
	}
	else
	{
		if (b == c)
		{
			cout << a << endl;
		}
		else
		{
			cout << b << endl;
		}
	}
}


Measured memory_bytes: 256
while True:
    a = input().split()

    op = a[1]
    x = int(a[0])
    y = int(a[2])

    if op == "?":
        exit(0)
    elif op == "+":
        print(x + y)
    elif op == "*":
        print(x * y)
    elif op == "-":
        print(x - y)
    elif op == "/":
        print(int(x // y))




Measured memory_bytes: 5592
n,a,b = map(int, raw_input().split())

if a > b:
  print 0
  exit()


if n == 1:
  if a != b:
    print 0
    exit()
  else:
    print 1
    exit()

# 2 < n, a <= b

# n = 3 => b-a+1
# n = 4 => (b-a)*2+1
# n = 5 => (b-a)*3+1
# ....
# n     => (b-a)*(n-2)+1
print (b-a)*(n-2)+1

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

using namespace std;

typedef long long ll;

const int num = 1e9+7;

int dp[1002][1002];
bool visited[1002][1002];
int indegree[1002][1002];
int flood[1002][1002];
char grid[1002][1002];

void floodfill(int a, int b){
  flood[a][b] = 1;
  //cout << a << " " << b << endl;
  if(grid[a][b+1]=='.'&&flood[a][b+1]==0){
    floodfill(a,b+1);
  }
  if(grid[a+1][b]=='.'&&flood[a+1][b]==0){
    floodfill(a+1,b);
  }
}

void dfs(int a, int b){
  dp[a+1][b] = (dp[a+1][b]+dp[a][b])%num;
  dp[a][b+1] = (dp[a][b+1]+dp[a][b])%num;
  indegree[a+1][b]--;
  indegree[a][b+1]--;
  if(indegree[a+1][b]==0&&grid[a+1][b]=='.'){
    dfs(a+1,b);
  }
  if(indegree[a][b+1]==0&&grid[a][b+1]=='.'){
    dfs(a,b+1);
  }
}


int main(){
  int H, W;
  cin >> H >> W;
  string row;
  for(int i = 1; i <= H; i++){
    cin >> row;
    for(int j = 1; j <= W; j++){
      grid[i][j]=row[j-1];
    }
    grid[i][W+1]='#';
    grid[i][0]='#';
  }
  for(int i = 0; i <= W+1; i++){
    grid[H+1][i] = '#';
    grid[0][i] = '#';
  }
  floodfill(1,1);
  indegree[1][1]=0;
  for(int i = 1; i <= H; i++){
    for(int j = 1; j <= W; j++){
      indegree[i][j] = flood[i-1][j] + flood[i][j-1];
    }
  }
  dp[1][1]=1;
  dfs(1,1);
  /*for(int i = 0; i <= H+1; i++){
    for(int j = 0; j <= W+1; j++){
      cout << grid[i][j];
    }
    cout << endl;
  }*/
  cout << dp[H][W] << endl;
  return 0;
}


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

int f(int H, int W){
	int a=W;
	while(H){
		while(W){
			printf("#");
			W--;
		}
		cout << endl;
		W=a;
		H--;
	}
}

int main() {
	int H, W;
	while(cin >> H >> W){
		if(H==0&&W==0){break;}
		f(H, W);
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3072
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Contest.B
{
	static class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			Scanner cin = new Scanner();

			int k = cin.NextInt();
			string s = cin.Next();
			if (s.Length <= k) Console.WriteLine(s);
			else Console.WriteLine(s.Substring(0, k) + "...");

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 27544
import sys
import itertools

def get_ben(time_list, shop_open_list, ben_list):
    count_list = []
    for shop_list in shop_open_list:
        count_list.append(len(list(filter(lambda i: (shop_list[i] == 1) and (time_list[i] == 1), list(range(10))))))
    res = 0
    for i, count in enumerate(count_list):
        res += ben_list[i][count]
    return res

n = int(sys.stdin.readline().strip())

shop_open_list = []
ben_list =[]

for _ in range(n):
    shop_open_list.append(list(map(int, sys.stdin.readline().strip().split(" "))))

for _ in range(n):
    ben_list.append(list(map(int, sys.stdin.readline().strip().split(" "))))

B = (0,1)
cand = []
for l in itertools.product(B, repeat = 10):
    if sum(l) == 0:
        continue
    cand.append(get_ben(l, shop_open_list, ben_list))

print(str(max(cand)))



Measured memory_bytes: 3188
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

type person struct {
	id int
	x  []int
	y  []int
}

func main() {
	N := nextInt()
	people := make([]person, N)
	var ans int
	for i := 0; i < N; i++ {
		A := nextInt()
		for j := 0; j < A; j++ {
			people[i].x = append(people[i].x, nextInt()-1)
			people[i].y = append(people[i].y, nextInt())
		}
	}
	for bit := 0; bit < 1<<uint(N); bit++ {
		var cnt int
		ok := true
		for i := 0; i < N; i++ {
			// i人目が1であることを前提に調べているので、
			// i人目が0の場合は見なくて良い
			if uint(bit)>>uint(i)&1 == 1 {
				for j := 0; j < len(people[i].x); j++ {
					if people[i].y[j] == 1 && uint(bit)>>uint(people[i].x[j])&1 == 0 {
						ok = false
						break
					}
					if people[i].y[j] == 0 && uint(bit)>>uint(people[i].x[j])&1 == 1 {
						ok = false
						break
					}
				}
			}
			if !ok {
				break
			}
		}
		if ok {
			for i := 0; i < N; i++ {
				if uint(bit)>>uint(i)&1 == 1 {
					cnt++
				}
			}
			ans = MaxOf(ans, cnt)
		}
	}
	fmt.Println(ans)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


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

int main(){
	double a, b, x;
  	cin >> a >> b >> x;
  	double s = x/a;
  	double rad;
  	if(s >= a*b/2){
    	double h = 2*(a*b-s)/a;
      	rad = atan2(h, a);
    } else {
     	double w = 2*s/b;
      	rad = atan2(b, w);
    }
  	double ans = rad*360/(2*acos(-1));
  	printf("%.10f", ans);
  	return 0;
}

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

#define F(i, a, n) for(int i=a;i<n;i++)
#define REP(i, n) F(i, 0, n)
#define REP1(i, n) for(int i=1;i<=n;i++)
#define MOD 1000000007

typedef long long ll;

const int MAX = 2e6 + 5;

char a,b;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>a>>b;
	if(a == b)
		cout<<'H';
	else
		cout<<'D';
	return 0;
}

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

#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

int main() {
	string s;
	cin >> s;
	int n = (int)s.length() + 1;
	vector<int> ans(n);
	for (int i = 0; i < n - 1; ++i) {
		if (s[i] == '<') {
			ans[i + 1] = max(ans[i + 1], ans[i] + 1);
		}
	}
	for (int i = n - 1; i >= 0; --i) {
		if (s[i] == '>') {
			ans[i] = max(ans[i], ans[i + 1] + 1);
		}
	}
	for (int i = 0; i < n - 1; ++i) {
		if (s[i] == '<') {
			ans[i + 1] = max(ans[i + 1], ans[i] + 1);
		}
	}
	for (int i = n - 1; i >= 0; --i) {
		if (s[i] == '>') {
			ans[i] = max(ans[i], ans[i + 1] + 1);
		}
	}

	cout << accumulate(all(ans), 0ll) << "\n";

	return 0;
}


Measured memory_bytes: 2820
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
const int N = 12;
bitset<N> s[N], p;

int count(int n, int m){
	int count = 0, j;

	for(int i = 0; i < (1<<n); i++){
		bitset<N> cnfg(i), x;
		//cout << cnfg << endl;
		for(j = 0; j < m; j++){
			x = cnfg;
			x &= s[j];
			//cout << s[j] << endl;
			//cout << x <<endl;
			//cout << '\n';
			if(((x.count())&1) != p[j]){
				break;
			}
		}
		if(j == m) count++;
	}
	return count;
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int n, m, k, x;
	cin >> n >> m;

	for(int i = 0; i < m; i++){
		cin >> k;
		for(int j = 0; j < k; j++){
			cin >> x;
			s[i].set(x-1);
		}
	}

	for(int i = 0; i < m; i++){
		cin >> x;
		p.set(i,x);
	}

	cout << count(n,m);
}

Measured memory_bytes: 256
import queue

"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
s = input()
f = int(s[:2])
e = int(s[2:])
t = 0
if f > 0 and f < 13:
	t += 1
if e > 0 and e < 13:
	t += 1
if t == 2:
	print("AMBIGUOUS")
elif t == 1:
	if f > 0 and f < 13:
		print("MMYY")
	else:
		print("YYMM")
else:
	print("NA")

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

int main(void){
    int N,M;cin>>N>>M;
    int S[M],C[M];
    for(int i=0;i<M;i++){
        cin>>S[i]>>C[i];
    }
    vector<int>A(N,-1);
    for(int i=0;i<M;i++){
        if(A[S[i]-1]!=-1&&A[S[i]-1]!=C[i]){
            cout<<-1<<endl;
            return 0;
        }
        else{
            A[S[i]-1]=C[i];
        }
    }
    for(int i=0;i<N;i++){
        if(N>1&&A[0]==0){
            cout<<-1<<endl;
            return 0;
        }
        if(A[i]==-1){
            if(i==0){
                if(N!=1){
                    cout<<1;        
                }
                else{
                    cout<<0;
                }
                
            }
            else{
                cout<<0;
            }
        }
        else{
            cout<<A[i];
        }
    }
    return 0;
}


Measured memory_bytes: 3604
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h> // sqrt
using namespace std;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    string S;
    cin >> S;
    vector<string> ans(N, "No");
    int pass = 0;
    int brank = 0;
    for (int i = 0; i < N; i++) {
        if (A + B <= pass) {
            break;
        }
        if (S.at(i) == 'a') {
            pass++;
            ans.at(i) = "Yes";
            continue;
        }
        if (S.at(i) == 'b') {
            brank++;
            if (brank <= B) {
                pass++;
                ans.at(i) = "Yes";
            }
        }
    }
    for (int i = 0; i < N; i++) {
        cout << ans.at(i) << endl;
    }
}

Measured memory_bytes: 6272
#include <iostream>

using namespace std;

int main() {
	long long x;
	cin >> x;
	
	long long yen = 100;
	
	long long cnt = 0;
	while (yen < x) {
		++cnt;
		
		yen += yen / 100;
	}
	
	cout << cnt << endl;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, y, k, z, N;
ll s, t, d;


// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> m ;
	cout << n+1-m;

}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


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

int main()
{
	ll a,b,k;
	cin>>a>>b>>k;
	if(a>=k)
	{
		cout<<a-k<<" "<<b<<endl;
	}
	else
	{
		ll p=k-a;
		a=0;
		if(b>=p)
			cout<<a<<" "<<b-p<<endl;
		else
			cout<<a<<" "<<0<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
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; }
ll MOD = 1000000007;

void solve()
{	
	int n,k; cin >> n>>k;
	int ans=0;
	while (n>0)
	{
		n/=k;
		ans++;
	}
	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 256
function main() {
  var
  arr = input.split(' ').map(parseFloat);
  arr.sort(function(a, b) {
    return b - a;
  });
  console.log(arr.join(' '));
}
 
var
input = '';
 
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  main();
});

Measured memory_bytes: 7652
N,Q=map(int, input().split())
S=input()
lr=[list(map(int,input().split())) for i in range(Q)]
a=[0]*(N+1)
for i in range(2,N+1):
    if S[i-2:i]=='AC':
        a[i]=a[i-1]+1
    else:
        a[i]=a[i-1]
for q in range(Q):
    print(a[lr[q][1]]-a[lr[q][0]])

Measured memory_bytes: 30656
import java.util.*;
import java.util.List;
import java.util.ArrayList;
import java.math.*;
class Main{
    public static void main(String[]args){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int m = N%10;
        switch(m){
            case 2:System.out.println("hon"); break;
            case 4:System.out.println("hon"); break;
            case 5:System.out.println("hon"); break;
            case 7:System.out.println("hon"); break;
            case 9:System.out.println("hon"); break;
            case 0:System.out.println("pon"); break;
            case 1:System.out.println("pon"); break;
            case 6:System.out.println("pon"); break;
            case 8:System.out.println("pon"); break;
            case 3:System.out.println("bon"); break;
        }
    }
}

Measured memory_bytes: 35748
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] H = Console.ReadLine().Split(' ');
            int A = int.Parse(H[0]);
            int B = int.Parse(H[1]);
            int C = int.Parse(H[2]);
            int D = int.Parse(H[3]);

            while (true)
            {

                C -= B;
                if (C <= 0)
                {
                    Console.WriteLine("Yes");
                    return;
                }
                
                A -= D;
                if (A <= 0)
                {
                    Console.WriteLine("No");
                    return;
                }
            }
        }
    }
}


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

using namespace std;

typedef pair<int, int> P;

char ch[100100];
int N;

bool flg[100100];

void input(){
	scanf("%s", ch);
	N = strlen(ch);
	for(int i = 1; i <= N; ++i){
		flg[i] = (ch[i - 1] == '1');
	}
}

vector<P> ans;

bool solve(){
	if(!flg[1]) return false;
	if(flg[N]) return false;
	for(int i = 1; i < N; ++i){
		if(flg[i] != flg[N - i]) return false;
	}
	flg[N] = true;
	vector<int> major;
	queue<int> minor;
	for(int i = 1; i <= N; ++i){
		if(flg[i]) major.push_back(i);
		else minor.push(i);
	}
	for(int i = 0; i + 1 < major.size(); ++i){
		ans.push_back(P(major[i], major[i + 1]));
		int d = major[i + 1] - major[i];
		for(int j = 0; j < d - 1; ++j){
			int v = minor.front();
			minor.pop();
			ans.push_back(P(major[i + 1], v));
		}
	}
	return true;
}

int main(){
	input();
	bool flg = solve();
	if(!flg){
		printf("-1\n");
	}else{
		for(int i = 0; i < ans.size(); ++i){
			printf("%d %d\n", ans[i].first, ans[i].second);
		}
	}
	return 0;
}


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

#R[0]
minv = int(input())
maxv = -10**12

#R[1..N-1]
for j in range(1, N):
    r = int(input())
    maxv = max(maxv, r - minv)
    minv = min(minv, r)
    
print(maxv)

Measured memory_bytes: 7680
#include <cstdio>
#include <map>
#define SQR(x) ((x)*(x))
std::map<int, int> count;
int Ans=2E9, N, tem;

int main()
{
	scanf("%d", &N);
	for(int i = 1; i <= N; ++i)
	{
		scanf("%d", &tem);
		++count[tem];
	}
	for(int itr = -100; itr <= 100; ++itr)
	{
		tem = 0;
		for(auto& jtr: count)
			tem += SQR(jtr.first - itr) * jtr.second;
		Ans = std::min(tem, Ans);
	}
	printf("%d\n", Ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << x << endl;
#else 
    #define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
       
    int n, t;
    cin >> n >> t;
    int f = 0;
    int cnt; 
    int mn;
    cin >> mn;
    fi(1, n) {
        int x;
        cin >> x;
        if (x - mn > f) {
            f = x - mn;
            cnt = 0;
        }
        cnt += f == x - mn;
        mine(mn, x);
    }   
    cout << cnt << '\n';
}

Measured memory_bytes: 3612
while True:
    s = input()
    if s == 'END OF INPUT': break
    while True:
        if '  ' in s: s = s.replace('  ', ' 0 ')
        else: break
    s = s.split()
    for i in s: print(len(i) if i != '0' else 0, end='')
    print('')

Measured memory_bytes: 6724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define MOD 1000000007

int main(){
    ll X;
    cin >> X;
    ll A = 0, B = 0, A5 = 0, B5 = 0;
    while (true) {
        ll tmp = A5 - X;
        if (tmp == B5) break;
        else if (tmp > B5) {
            while (true) {
                B++;
                B5 = B * B * B * B * B;
                if (tmp == B5) {
                    cout << A << " " << B << endl;
                    return 0;
                } else if (tmp < B5) break;
            }
        } else {
            while (true) {
                B--;
                B5 = B * B * B * B * B;
                if (tmp == B5) {
                    cout << A << " " << B << endl;
                    return 0;
                } else if (tmp > B5) break;
            }
        }
        A++;
        A5 = A * A * A * A * A;
    }

    cout << A << " " << B << endl;
    return 0;
}


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

int main() {
    int n;
    int ans = 0;
    cin >> n;
    vector<int> d(n);
    rep(i, n) {
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    rep(i, n) {
        if (i == 0) {
            ans++;
        } else if (d[i] != d[i - 1]) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false); cin.tie(0);
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
int main() {
    IO;
    
    int n;
    cin >> n;
    while (n-- > 0) {
        ll a, b;
        cin >> a >> b;
        if (a > b) swap(a, b);
        if (a == b) cout << 2 * a - 2;
        else if (b - a == 1) cout << 2 * a - 2;
        else {
            ll c = sqrt(a * b);
            if (c * c == a * b) c--;
            if ((ll) c * (c + 1) >= (ll) a * b) cout << 2 * c - 2;
            else cout << 2 * c - 1;
        }
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 256