akhauriyash/Code-Regression huggingface dataset:
def run(a, b, c, d):
    ret = 'No'
    if abs(a - c) <= d:
        ret = 'Yes'
    elif abs(a - b) <= d and abs(b - c) <= d:
        ret = 'Yes'
    return ret


def main():
    a, b, c, d = map(int, input().split())
    print(run(a, b, c, d))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  map<string,int> mp;
  rep(i,N){
    string s;cin >> s;
    ++mp[s];
  }
  int maxnum = 0;
  for(auto &p : mp) maxnum = max(maxnum,p.second);
  vector<string> v;
  for(auto &p : mp) if(p.second == maxnum) v.emplace_back(p.first);
  sort(all(v));
  for(const string &s : v) cout << s << endl;
  return 0;
}


Measured memory_bytes: 25584
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e5 + 5;
const int inf = 1000000000;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338; // double PI = 4*atan(1);

	 

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	//ifstream cin (".in");
	//ofstream cout (".out");

	ll a,b;
	cin >> a >> b;
	if(a == 1 || b == 1){
		cout << 1 << "\n";
	}else{
		cout << (a*b+1)/2 << "\n";
	}
	return 0;
}




Measured memory_bytes: 3644
#include <bits/stdc++.h> 
#define Rajpoot ios_base::sync_with_stdio(0);   cin.tie(0);  cout.tie(0);
#define ll long long
#define loo(i,n) for(i=0;i<n;i++)
#define go(i,sp)  for(auto i=sp.begin();i!=sp.end();i++)
#define pb push_back
#define lb lower_bound
#define mo 1000000007
#define pi 3.14159265358979323846264338327950288419716939937510582
#define exp 2.71828182845904523536028747135266249775724709369995957
#define endl "\n"
using namespace std;



int main() 
{
   Rajpoot
      //    freopen("input.txt","r",stdin);
      // freopen("output.txt","w",stdout);

   // int t; cin>>t; 
    int t=1;
    while(t--)
    { 
        int x; cin>>x;
        if(x>=30)  cout<<"Yes";
        else cout<<"No";
        cout<<endl;
        
    }    

	return 0;
}

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

int main(){
	int a,b;
	cin>>a>>b;
	string ans;
	if(a>b){
		if(b!=1)
			ans="Alice";
		else 
			ans="Bob";
	}
	else if(a<b){
		if(a!=1)
			ans="Bob";
		else 
			ans="Alice";
	}
	else 
		ans="Draw";
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

const int N = 2005;
const int mo = 1e+9+7;

int c[N*2][N*2];
int f[N][N];
int g[N];
int n,k;

int add(int x,int y){return x+y>=mo?x+y-mo:x+y;}

int main(){
	scanf("%d%d",&n,&k);
	fo(i,0,4000){
		c[i][0]=1;
		fo(j,1,i)c[i][j]=add(c[i-1][j-1],c[i-1][j]);
	}
	f[1][1]=1;
	fo(i,2,k){
		fo(j,1,i-1)f[i][j+1]=add(f[i][j+1],f[i-1][j]);
		int sum=0;
		fd(j,i-1,1){
			sum=add(sum,f[i-1][j]);
			f[i][j]=add(f[i][j],sum);
		}
		g[i-1]=sum;
	}
	g[0]=1;
	int ans=g[k-1];
	if (n-2>=k-1)
	fo(i,1,k-1){
		if (i==k-1)ans=add(ans,c[n-2-(k-1-i)][i]);
		else{
			int tmp=c[n-2-(k-1-i)][i];
			fo(x,1,k-1-i)
			ans=add(ans,1ll*tmp*f[k-1-i][x]%mo*c[x+i][i]%mo);
		}
	}
	fo(i,1,n-k-1)ans=ans*2%mo;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 77696
n,m=map(int,input().split())
l=[]
for _ in range(n):
  a,b=map(int,input().split())
  l.append([a,b])
l.sort()
ans=0
for a,b in l:
  ans+=min(b,m)*a
  m=max(0,m-b)
print(ans)

Measured memory_bytes: 24480
using System;using System.Linq;class A{static void Main(){int n=int.Parse(Console.ReadLine());long []a=Console.ReadLine().Split().Select(long.Parse).ToArray();for(int i=0;;i++){for(int j=0;j<a.Length;j++){if(a[j]%2==1){Console.WriteLine(i);return;}a[j]/=2;}}}}

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

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

  int d, g; cin >> d >> g;
  int t[20][2];
  for (int i = 0; i < d; i++) {
    cin >> t[i][0] >> t[i][1];
  }

  int ans = 1000;
  int point, cnt;
  for (int bit = 0; bit < 1<<d; bit++) {
    point = 0, cnt = 0;
    for (int i = 0; i < d; i++) {
      if (bit & 1<<i) {
        point += t[i][0] * (i+1) * 100 + t[i][1];
        cnt += t[i][0];
      }
    }

    for (int i = d-1; i >= 0; i--) {
      if (!(bit & 1<<i)) {
        for (int j = 0; j < t[i][0]; j++) {
          if (point >= g) break;
          point += (i+1) * 100;
          cnt++;
        }
      }
    }
    ans = min(ans, cnt);
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;

int main()
{
	int N, T;
	cin >> N >> T;
	vector<int> A(N);
	for (auto &x : A) cin >> x;

	int max_diff = 0;
	int min_value = A[0];
	for (int i = 0; i < N; ++i) {
		min_value = min(min_value, A[i]);
		max_diff = max(max_diff, A[i] - min_value);
	}
	int ans = 0;
	int min_count = 0;
	min_value = A[0];
	for (int i = 0; i < N; ++i) {
		if (A[i] < min_value) {
			min_value = A[i];
			min_count = 1;
		}
		else if (min_value == A[i]) {
			++min_count;
		}
		if (A[i] - min_value == max_diff) {
			ans += min_count;
		}
	}
	cout << ans << endl;
}


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

string s,t;

bool search(int x){
  for(int i = 0;i < t.size();i++){
    if(!(s[i+x] == t[i] || s[i+x] == '?')){
      return false;
    }
  }

  return true;
}


int main(){
  cin >> s >> t;

  for(int i = s.size()-t.size();i >= 0;i--){
    if(search(i)){
      for(int j = 0;j < s.size();j++) if(s[j] == '?') s[j] = 'a';
      for(int j = 0;j < t.size();j++){
        s[i+j] = t[j];
      }
      cout << s << endl;
      return 0;
    }
  }

  cout << "UNRESTORABLE" << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    N, *A = map(int, open(0).read().split())
    B = [A[i] - i - 1 for i in range(N)]
    B.sort()
    b1 = B[(N-1)//2]
    b2 = B[N//2]
    ans1 = ans2 = 0
    for i in range(N):
        a = A[i] - i - 1
        ans1 += abs(a - b1)
        ans2 += abs(a - b2)
    print(min(ans1, ans2))

if __name__ == '__main__':
  main()


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<pair<int,int> > v;
    for(int i=0;i<n;i++)
    {
        int a,b;
        cin >> a >> b;
        v.push_back(make_pair(b,a));
    }
    sort(v.begin(),v.end());
    int now=0;
    bool ok=1;
    for(int i=0;i<n;i++)
    {
        now+=v[i].second;
        if(now>v[i].first)
        {
            ok=0;
            break;
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 2420
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
------------------------
author : iiou16
time : 11/01/12:11
------------------------
'''


def main():
    N = int(input())

    flag = 0
    for i in range(1, 10):
        for j in range(1, 10):
            if i * j == N:
                flag = 1
                break
    if flag == 1:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
<?php
$getCards = function($total) {
    $cards = [];
    for ($i=0; $i < $total; $i++) {
        $string = trim(fgets(STDIN));
        $cards[$string] = isset($cards[$string])
            ? $cards[$string] = ++$cards[$string]
            : 1;
    }
    return $cards;
};
$blueCards = $getCards(trim(fgets(STDIN)));
$redCards  = $getCards(trim(fgets(STDIN)));

$maxYen = 0;
foreach ($blueCards as $string => $yen) {
    $sumYen = $yen - ($redCards[$string] ?? 0);
    if ($maxYen < $sumYen) {
        $maxYen = $sumYen;
    }
}
if ($maxYen < 0) {
    foreach ($redCards as $string => $yen) {
        $sumYen = ($blueCards[$string] ?? 0) - $yen;
        if ($maxYen < $sumYen) {
            $maxYen = $sumYen;
        }
    }
}

echo $maxYen;

Measured memory_bytes: 4728
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <numeric>
using namespace std;
int main(void)
{
    int n;
    cin >> n;

    vector<int> a(n);

    for (int i = 0;i < n;i++) cin >> a[i];
    
    int ave = accumulate(a.begin(), a.end(),0) / n;
    int ave2= ave + 1;


    int cost = 0, cost2 = 0;
    for (int i = 0;i < n;i++)
    {
        cost += (a[i] - ave) * (a[i] - ave);
        cost2 += (a[i] - ave2) * (a[i] - ave2);
    }

    cout << min(cost,cost2) << endl;
    
    return 0;
}


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

int main(){
  int count = 0;
  string str;
  cin >> str;
  for(int i = 0; i < str.length()-1; i++){
    if(str.at(i) != str.at(i+1)) count++;
  }
  cout << count << endl;
}

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

using namespace std;

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

    vector<long long int> data;

    for (int a = 0; a < n; ++a) {
        long long int input;
        cin >> input;

        data.push_back(input);
    }

    long long int max = 0;
    for(auto a : data){
        for(auto b : data){
            long long int diff = 0;

            diff = a > b ? a - b : b - a;

            if(diff > max){
                max = diff;
            }
        }
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        int N = sc.nextInt();
                        boolean[] Q = new boolean[2001];
                        Q[0] = true;
                        for (int i = 0; i < N; i++) {
                                int q = sc.nextInt();
                                for (int j = 2000-q; j >= 0; j--) {
                                        if (Q[j]) {
                                                Q[j+q] = true;
                                        }
                                }
                        }
                        int A = sc.nextInt();
                        for (int i = 0; i < A; i++) {
                                if (Q[sc.nextInt()]) {
                                        System.out.println("yes");
                                } else {
                                        System.out.println("no");
                                }
                        }
                }
        }
}

Measured memory_bytes: 26276
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    int d;
    cin>>d;
    if(d==22)cout<<"Christmas Eve Eve Eve"<<endl;
    else if(d==23)cout<<"Christmas Eve Eve"<<endl;
    else if(d==24)cout<<"Christmas Eve"<<endl;
    else if(d==25)cout<<"Christmas"<<endl;
    return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
void solve() {
	int n;
	cin>>n;
	vector<int>d(200010);
	bitset<4000010>dp;
	int sum=0;
	dp[0]=1;
	for(int i=0; i<n; i++) {
		cin>>d[i];
		sum+=d[i];
		dp|=dp<<d[i];
	}
	int odd=sum%2;
	for(int i=sum/2+odd; i<4000010; i++) {
		if(dp[i]) {
			cout<<i;
			return ;
		}
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 2560
//Daniel Grzegorzewski
#include <bits/stdc++.h>

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

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

void init_ios()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

int main()
{
	init_ios();
	char a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);
	if (a[0] == 'a' && a[1] == 'b' && a[2] == 'c')
		cout<<"Yes\n";
	else
		cout<<"No\n";
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int n;
    cin >> n;
    vl a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) a[i] -= i+1;
    sort(all(a));
    ll ans = 0LL;
    auto calc = [&](int m) {
        ll ret = 0LL;
        rep(i, n) ret += abs(a[i] - a[m]);
        return ret;
    };
    if(n&1) cout << calc(n/2) << endl;
    else cout << min(calc(n/2), calc(n/2-1)) << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 100005
#define pb push_back
#define vit vector<int>::iterator
typedef pair<lint,lint> pii;
map<lint,lint>M;
vector<lint> V[MAX];
lint A[MAX];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lint n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>A[i];
    sort(A,A+n);
    lint sum=0;
    for(lint i=0;i<n;i++){
        for(lint j=i+1;j<n;j++){
            for(lint k=j+1;k<n;k++){
                if(A[i]!=A[j] && A[j]!=A[k] && A[i]+A[j]>A[k]){
                    sum++;
                }
            }
        }
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 6004
if __name__ == '__main__':
    N, Y = map(int, input().split())

    answer = "-1 -1 -1"
    for i in range(N+1):
        for j in range(0, N-i+1):
            k = N - i - j
            if i*10000 + j*5000 + k*1000 == Y:
                answer = str(i) + " " + str(j) + " " + str(k)
                break

    print(answer)

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────

// 解説：https://youtu.be/TdR816rqc3s?t=8424
struct UnionFind {
	vi d;
	UnionFind(int n = 0) : d(n, -1) {}
	
	int find(int x) {
		if (d[x] < 0) return x;
		return d[x] = find(d[x]);
	}

	bool unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return false;
		if (d[x] > d[y]) swap(x, y);
		d[x] += d[y];
		d[y] = x;
		return true;
	}

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

int deg[100005];
vi to[100005];

int main() {
	int n, m, k;
	cin >> n >> m >> k;
	
	UnionFind uf(n);

	rep(i, m) {
		int a, b;
		cin >> a >> b;
		--a, --b;

		deg[a]++;
		deg[b]++;
		uf.unite(a, b);
	}

	rep(i, k) {
		int a, b;
		cin >> a >> b;
		--a, --b;

		to[a].push_back(b);
		to[b].push_back(a);
	}

	rep(i, n) {
		int ans = uf.size(i) - 1 - deg[i];
		for (int u : to[i]) {
			if (uf.same(i, u)) --ans;
		}
		printf("%d%c", ans, i == n - 1 ? '\n' : ' ');
	}
	return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

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

const int MAXN = 105000;

int n, sx;
int x[MAXN];

int main() { 

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

  long long ans = abs(x[0] - sx);
  for (int i = 0; i < n; i++) {
    ans = gcd(ans, abs(x[i] - sx));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  boolean isCheck = true;
  for(int i = 0; i<N; i++){
    int tmp = sc.nextInt();
    if(tmp%2 == 0){
      if(tmp%3 != 0 && tmp%5 != 0){
        isCheck = false;
      }
    }
  }
  if(isCheck){
    System.out.println("APPROVED");
  }else{
    System.out.println("DENIED");
  }
}
}


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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto& x : a)
        cin >> x;
    if(n == 1 && a[0] == 1){
        cout << "Yes" << endl;
        cout << 1 << endl;
        return 0;
    }
    vector<pair<int,int>> p;
    for(int i = 0; i < n; ++i)
        p.emplace_back(--a[i], i);
    sort(p.begin(), p.end());
    int c = 0;
    vector<int> ans(n * n, -1);
    for(auto& q : p){
        int pos, num;
        tie(pos, num) = q;
        for(int i = 0; i < num; ++i){
            while(ans[c] != -1){
                if(++c >= n * n){
                    cout << "No" << endl;
                    return 0;
                }
            }
            ans[c++] = num;
            if(c >= n * n){
                cout << "No" << endl;
                return 0;
            }
        }
        ans[pos] = num;
    }
    reverse(p.begin(), p.end());
    c = n * n - 1;
    while(ans[c] != -1)
        c--;
    for(auto& q : p){
        int pos, num;
        tie(pos, num) = q;
        for(int i = 0; i < n - num - 1; ++i){
            while(ans[c] != -1){
                if(--c < 0){
                    cout << "No" << endl;
                    return 0;
                }
            }
            ans[c--] = num;
            if(c < 0){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    if(count(ans.begin(), ans.end(), -1)){
        cout << "No" << endl;
        return 0;
    }
    vector<vector<int>> v(n);
    for(int i = 0; i < n * n; ++i)
        v[ans[i]].emplace_back(i);
    for(int i = 0; i < n; ++i){
        if(v[i].size() != n || v[i][i] != a[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i = 0; i < n * n - 1; ++i)
        cout << ans[i] + 1 << " ";
    cout << ans.back() + 1 << endl;
}


Measured memory_bytes: 3200
H, W = map(int, input().split())
s = [list(input()) for i in range(H)]
for i in range(H):
    for p in range(W):
        if s[i][p] == '.':
            s[i][p] = 0
for i in range(H):
    for p in range(W):
        if s[i][p] != '#':
            if (i != 0) and (p != 0) and (s[i-1][p-1] == '#'):
                s[i][p] += 1
            if (i != 0) and (s[i-1][p] == '#'):
                s[i][p] += 1
            if (p != 0) and (s[i][p-1] == '#'):
                s[i][p] += 1
            if (i != (H - 1)) and (p != (W - 1)) and (s[i+1][p+1] == '#'):
                s[i][p] += 1
            if (i != (H-1)) and (s[i+1][p] == '#'):
                s[i][p] += 1
            if (p != (W - 1)) and (s[i][p+1] == '#'):
                s[i][p] += 1
            if (i != 0) and (p != (W-1)) and (s[i-1][p+1] == '#'):
                s[i][p] += 1
            if (i != (H-1)) and (p != 0) and (s[i+1][p-1] == '#'):
                s[i][p] += 1            
for i in s:
    print(''.join(list(map(str, i))))

Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    for(int i=0; i<n; ++i){
        if(a[i] % 2 != 0){
            cout << "first" << endl;
            return 0;
        }
    }

    cout << "second" << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
/**int x1,x2,x3,x4,x5;
cin>>x1>>x2>>x3>>x4>>x5;
if(x1==0)cout<<1<<endl;
if(x2==0)cout<<2<<endl;
if(x3==0)cout<<3<<endl;
if(x4==0)cout<<4<<endl;
if(x5==0)cout<<5<<endl;



int x,y;
cin>>x>>y;
long long cranes=(4*x -y)/2;
long long turtle=(y-2*x)/2;
if(cranes>=0 && turtle>=0){
    if(cranes * 2 + turtle *4 == y)cout<<"Yes\n";
    else cout<<"No\n";
}
else cout<<"No\n";

*/
int x,n;
cin>>x>>n;
if(n==0){cout<<x<<endl;return 0;}
vector<int> v(n);
map<int,int> m;
for(auto &x : v)cin>>x;
for(int i=-200;i<200;i++)m[i]=0;

for(auto x : v)m[x]++;

for(int i=0;i<200;i++){
 if(m[x-i]==0){cout<<x-i<<endl;return 0;}
        if(m[x+i]==0){cout<<x+i<<endl;return 0;}







}

return 0;
}


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

// definition {{{ 1

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

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

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

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

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

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

// }}} 1

int main() {

    int n;
    int a[100003];
    int l;
    Scd2(n,l);
    int tmp = 0;
    int ans = 0;
    Scd(a[0]);
    tmp = a[0];
    Repe(i,n,1){
        Scd(a[i]);
        tmp += a[i];
        if( i > 1 ){
            tmp -= a[i-2];
        }
        if( tmp >= l ){
            ans = i;
        }
    }


    if( ans ){
        printf ("Possible\n");
        Repe(i,n,1){
            if( ans == i ) break;
            printf ("%d\n", i);
        }
        for(int i = n-1; i >= ans; i-- ){
            printf ("%d\n", i);
        }
    }else{
        printf ("Impossible\n");
    }

    return 0;
}



Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
typedef long long ll;
typedef pair<int,int> P;
#define F first
#define S second
const double PI=acos(-1);
//fixed<<setprecision(11)<<

int main(){
  int k,a,b;
  cin>>k>>a>>b;
  
  for(int i=a;i<=b;i++)
    if(i%k==0){
    cout<<"OK"<<endl;
    return 0;
    }
  cout<<"NG"<<endl;
return 0;
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n; cin >> n;
    string str; cin >> str;
    ll cnt[26];
    for(int i=0;i<26;i++) cnt[i] = 0;
    for(int i=0;i<n;i++){
        cnt[str[i] - 'a']++;
    }
    ll ans = 1;
    for(int i=0;i<26;i++){
        ans = (ans * (cnt[i] + 1)) % MOD;
    }
    cout << ans - 1 << endl;
}

Measured memory_bytes: 512
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

import re
# import numpy as np
# from scipy.misc import comb

# 再帰がやばいとき
# import sys
# sys.setrecursionlimit(10**9)

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e50)
MOD = int(1e9)+7 # 10^9 + 7

# field[H][W]
def create_grid(H, W, value = 0):
    return [[ value for _ in range(W)] for _ in range(H)]

########

def main():
    A, B, C =l_inpl()
    print(max(C-(A-B), 0))

if __name__ == "__main__":
    main()


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


int main(){

    int a,b,c,d;
    int i;

    scanf("%d %d %d %d",&a,&b,&c,&d);
    
    for(i=1;i<1000;i++){
        if(c-b*i<=0){
            printf("Yes");
            break;
        }
        else if(a-d*i<=0){
                printf("No");
                break;
        }
        else{
              i=i+1;
        }
    }

    return 0;
}



Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define S second
#define F first
#define all(x) (x).begin(), (x).end()


using namespace std;

const bool dbg_flg = false;
#define debug(x) if (dbg_flg) cerr << #x << ' ' << x << '\n'
#define debug_pair(x) if (dbg_flg) cerr << #x << ' ' << x.F << ' ' << x.S << '\n'
 
const int inf = 1e9 + 7;
const int MAXN = 1e6 + 5;
const ll INF = 1e18;

#define int ll

int n, m;
char s[MAXN], t[MAXN];
map<int, int> x;

main() {
	//~ freopen("input.txt", "r", stdin);
	//~ freopen("output.txt", "w", stdout);
	
	ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);	

	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> t[i];
	}
	
	int l = (n * m) / __gcd(n, m);
		
	if (s[0] != t[0]) {
		cout << -1;
		return 0;
	}
		
	for (int i = 1; i < n; i++) {
		int id = i * (l / n) + 1;
		x[id] = i;
	}
	
	for (int i = 1; i < m; i++) {
		int id = i * (l / m) + 1;
		
		if (x.find(id) != x.end()) {
			if (s[x[id]] != t[i]) {
				cout << -1;
				return 0;
			}
		}
		
		x[id] = i;
	}
	
	cout << l;
	return 0;
}


Measured memory_bytes: 10880
N, M = gets.split.map(&:to_i)
ys = Array.new(N+1){[]}
M.times do |i|
    p, y = gets.split.map(&:to_i)
    ys[p].push([y, i])
end
ans = Array.new(M)
(1..N).each do |i|
    ys[i].sort!
    ys[i].length.times do |j|
        ans[ys[i][j][1]] = sprintf("%06d%06d", i, j+1)
    end
end
M.times do |i|
    puts ans[i]
end

Measured memory_bytes: 26236
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- (0 :) . (++ [0]) <$> getIntList
    let d1 = zipWith (\a b -> abs (a-b)) as (tail as)
        s = sum d1
        d2 = zipWith (\a b -> abs (a-b)) as (drop 2 as)
        is = zipWith (\a b -> s - a + b) (zipWith (+) d1 (tail d1)) d2
    mapM_ print is

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

using namespace std;
const int mn = 1e5 + 5;
const int MOD = 1e9 + 7;
#define pb push_back
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
using pii=pair<int, int>;

int m, d;

int main() {
    //cin.sync_with_stdio(0);
#ifdef trote
    freopen("../1.txt", "r", stdin);
#endif
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    int ans = 0, cnt = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < i; ++j) {
            if (a[j] > a[i]) ans++;
        }
        for (int j = i + 1; j < n; ++j) {
            if (a[j] > a[i]) cnt++;
        }
        //cout << ans << " " << cnt << "\n";
    }
    //cout << ans << " " << cnt << "\n";
    cout << (1ll * ans * k + 1ll * (ans + cnt) * ((k - 1) * (long long) k / 2 % MOD)) % MOD << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <cmath>
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;

#define rep(i, m) for(ll i=0;i<(m);i++)
#define rep1(i, m) for(ll i=1;i<=(m);i++)

int N, D;
int A[3][110];
ll dp[3][110];

int main() {
   cin >> N;
   rep1(j, 2) {
      rep1(i, N) {
         cin >> A[j][i];
      }
   }

   rep(j, N) {
      dp[1][j+1] = dp[1][j] + A[1][j+1];
   }
   rep(j, N) {
      dp[2][j+1] = max(dp[1][j+1], dp[2][j]) + A[2][j+1];
   }
   cout << dp[2][N] << endl;
}

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

using namespace std;

#define ll long long
#define ar array


ll N, D, x, y;


void solve(){
    cin >> N >> D;

    int count = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> x >> y;
        

        if (sqrt(x*x+ y*y) <= D)
        {
            count++;
        }
        
    }
    
   cout << count << "\n";
}





int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
    int arr[5];
    int coun;
	for(int i=1;i<=5;++i){
		cin>>arr[i];
	}
	for(int i=1;i<=5;++i){
		if(arr[i] == 0){
			coun = i;
		}else{	
		}
	}
	cout<<coun;
}

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

#define pb push_back
#define mp make_pair
#define up upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define ll long long
#define vi vector < ll > 
#define pi pair < ll , ll > 
#define ld long double
#define iPair pair< ll , ll >

#define lp(n,i) for(ll i=0;i<n;i++)
#define rlp(n) for(ll i=n-1;i>=0;i--)
//#define e 1000000009
//#define e  998244353
#define inf 9999999999999999
#define pri1 1000000007
#define pri2 1000001001
#define PI 3.14159265
 /*
ll pw(ll a, ll b)
{
    ll t=1;
    
    if(b==0)return t;
    if(b%2)
    {
        t=t*a;
    }
   t%=e;
    ll x=pw(a,b/2);
    x=x*x;
    x%=e;
    t*=x;
    t%=e;
    return t;
}/*
vector < ll > pr;
ll vis[10000005]={0};
void seive ( ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(vis[i]==0)
        {
            
            for(ll j=i*i;j<=n;j+=i)vis[j]=1;
        }
    } 
    
    for(ll i=2;i<=n;i++)
    {
        if(vis[i]==0)pr.pb(i);
    }
}
 
#define N 100005
ll z[N];
vector < ll > v;
void getz(string s)
{
    ll n=s.length();
    ll l=0,r=0;
    for(ll i=1;i<n;i++)
    {
        if(i<=r)
        {
            z[i]=min(r-i+1,z[i-l]);
        }
        
        while(i+z[i]<n&&s[z[i]]==s[i+z[i]])z[i]++;
        
        if((i+z[i]-1)>r)
        {
            l=i;
            r=i+z[i]-1;
        }
    }
    
   for(ll i=0;i<n;i++)
   {
       v.pb(z[i]);
   }
  
    sort(v.begin(),v.end());
    
}
*/
 

 
int main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
 
   
 ll ti=1;
//cin>>ti;
 
 for (ll io=0;io<ti;io++)
 {
    
    ll n;
    cin>>n;
    ll i=n%10;
    if(i==2||i==4||i==5||i==7||i==9)cout<<"hon"<<endl;
    else if(i==0||i==1|i==6||i==8)cout<<"pon"<<endl;
    else cout<<"bon"<<endl;
    
    
    
 }
 return 0;	
}

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

int dist(int i, int j, int X, int Y, int N){
  int d1 = j - i;
  int d2 = abs(X - i) + abs(Y - j) + 1;
  
  if (d1 > d2){
    return d2;
  }
  if (d1 <= d2){
    return d1;
  }
}

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;
  X--;
  Y--;
  vector<int> K(N);
  
  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      K.at(dist(i,j,X,Y,N))++;
    }
  }
  
  for (int k = 1; k < N; k++){
    cout << K.at(k) << endl;
  }
}

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

using namespace std;

void solve(){

    int n; cin >> n;
    int arr[n];
    for(int i = 0; i < n; ++i) cin >> arr[i];
    int mx = *max_element(arr, arr+n);
    vector<int> present (mx+1, 0);
    for(int i = 0; i < n; ++i) ++present[arr[i]];
    int ans = 0;
    for(int i = 1; i <= mx; ++i){
        if(present[i] == 0) continue;
        if(present[i] == 1) ++ans;
        for(int j = 2*i; j <= mx; j += i)
            present[j] = false;
    }
    cout << ans;
}

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

	return 0;
}

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

int main() {
    int n, a;
    vector<int> mochis;
    cin >> n;
    while(cin >> a) {
        auto j = mochis.begin();
        for(auto i=mochis.begin(); i < mochis.end() && *i > a; i++) j=i+1;
        if(j == mochis.end() || *j != a) mochis.insert(j, a);
    }
    cout << mochis.size() << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		int n = in.readInt();
		int m = in.readInt(); 
		boolean sol[] = new boolean[n+1];
		boolean ans = false; 
		for(int i = 0; i<m; i++) {
			int a = in.readInt();
			int b = in.readInt(); 
			if(a==1) {
				if(sol[b]) {
					ans = true; 
				}
				sol[b] = true; 
			}
			else if(b == n) {
				if(sol[a]) {
					ans = true;
				}
				sol[a] = true; 
			}
		}
		System.out.println(ans?"POSSIBLE":"IMPOSSIBLE"); 
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 24348
#include<iostream>
#include<utility>
#include<map>
#define MAX_NUM 55
#define MP make_pair
using namespace std;
typedef pair<int, int> P;

char grid[MAX_NUM][MAX_NUM];
map<P, int> M;

int main() {
    int H, W;
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> grid[i][j];
            M[MP(i, j)] = 1;
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (grid[i][j] == '#') {
                cout << '#';
                continue;
            }
            int count = 0;
            for (int k = -1; k <= 1; k++) {
                for (int l = -1; l <= 1; l++) {
                    P now_grid = MP(i + k, j + l);
                    if (M[now_grid] == 1 && grid[i + k][j + l] == '#') count++;
                }
            }
            cout << count;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 384
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        if(a%2==0){
            a = a /2 - 1;
        }else{
            a = a / 2;
        }
        System.out.println(a);
        sc.close();
    }
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
    int t = N%10;
    if(t==3){
        cout << "bon" << endl;
    }else if(t==0 || t==1 || t==6 || t==8){
        cout << "pon" << endl;
    }else{
        cout << "hon" << endl;
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

int main()
{
  int A, B;
  cin >> A >> B;
  string letter;
  cin >> letter;

  for (int i = 0; i < A+B+1; i++) {
    if (i == A) {
      if (letter[i] != '-') {
        cout << "No";
        return 0;
      }
    } else {
      if (letter[i] == '-') {
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes";
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        int c = 0;
        for (int i = a; i <= b; i++) {
            StringBuffer sb = new StringBuffer(String.valueOf(i));
            String revNum = sb.reverse().toString();
            int num = Integer.parseInt(revNum);

            if (i == num) {
                c++;
            }
        }

        System.out.println(c);
    }
}


Measured memory_bytes: 36948
import math
def myFactorization(n):
    '''nを素因数分解する

    戻り値: factList = [[prime1, exp1], [prime2, exp2],...] 
           n=(prime1)**exp1 * (prime2)**exp2 * ...
    '''

    factList=[]
    temp=n
    cnt=0
    while(temp%2==0):
        temp=temp//2
        cnt+=1
    if(cnt>0):
        factList.append([2,cnt])

    m=int(math.sqrt(n))+1
    for i in range(3,m+1,2):
        cnt=0
        while(temp%i==0):
            temp=temp//i
            cnt+=1
        if(cnt>0):
            factList.append([i,cnt])
        if(temp==1):
            break
    if(temp>1):
        factList.append([temp,1])
    return factList

def readinput():
    n,p=list(map(int,input().split()))
    return n,p

def main(n,p):
    factList=myFactorization(p)
    gcd=1
    for fact in factList:
        gcd=gcd*fact[0]**(fact[1]//n)
    return gcd

if __name__=='__main__':
    n,p=readinput()
    ans=main(n,p)
    print(ans)


Measured memory_bytes: 9264
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define PI            (acos(-1.0))
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0),cout<<fixed<<setprecision(20);
#define rep(i,n)    for(int i=0;i<n;i++)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define w(t)          int t;cin>>t;while(t--)
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
	string s;
	cin>>s;
	cout<<s[0]<<s[1]<<s[2]<<nl;
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}

char ca[200005];

int main(){
	LL a,b,c,d;
	LL n;
	LL i,j,k;
	LL s=0;
	cin>>ca;
	n=strlen(ca);
	a=0;
	for(i=0;i<n;){
		if(ca[i]=='A' && ca[i+1]=='B' && ca[i+2]=='C'){
			s+=a+1;
			a++,i+=3;
			continue;
		}
		if(ca[i]=='B' && ca[i+1]=='C'){
			s+=a,i+=2;
			continue;
		}
		
		if(ca[i]=='A')a++;
		else a=0;
		
		i++;
	}
	cout<<s<<endl;
}
	


Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	ll K;
	ll A[200001],F[200001];
	ll val[200001];
	ll valmax=0;
	scan(N>>K);
	rep(i,N){
		scan(A[i]);
	}
	rep(i,N){
		scan(F[i]);
	}
	sort(A,A+N);
	sort(F,F+N);
	rep(i,N){
		val[i]=A[i]*F[N-i-1];
		valmax=max(valmax,val[i]);
	}
	ll cmin=-1,cmax=valmax+1;
	while(cmin+1<cmax){
		ll cmid=(cmin+cmax)/2;
		ll needK=0;
		rep(i,N){
			if(val[i]>cmid){
				needK+=(val[i]-cmid)/F[N-i-1]+((val[i]-cmid)%F[N-i-1]!=0);
			}
		}
		if(needK<=K){
			cmax=cmid;
		}
		else{
			cmin=cmid;
		}
	}
	prin(cmax);
	return 0;
}


Measured memory_bytes: 4992