akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define M 100000
bool mark;

int main()
{
    ll x,y,z,n,m,i=4,j,k,l,a[4],sum=0;
    vector<int>v;

    cin>>n;
    for(int j=1;j<=4;j++)
    {
        a[--i]=(n%10);
        n=n/10;
//        cout<<arr[i]<<endl;
    }
    if(a[0]+a[1]+a[2]+a[3]==7)
    {
        cout<<a[0]<<"+"<<a[1]<<"+"<<a[2]<<"+"<<a[3]<<"=7"<<endl;
    }
    else if(a[0]-a[1]+a[2]-a[3]==7)
    {
        cout<<a[0]<<"-"<<a[1]<<"+"<<a[2]<<"-"<<a[3]<<"=7"<<endl;
    }
    else if(a[0]+a[1]+a[2]-a[3]==7)
    {
        cout<<a[0]<<"+"<<a[1]<<"+"<<a[2]<<"-"<<a[3]<<"=7"<<endl;
    }

    else if(a[0]+a[1]-a[2]-a[3]==7)
    {
        cout<<a[0]<<"+"<<a[1]<<"-"<<a[2]<<"-"<<a[3]<<"=7"<<endl;
    }
    else if(a[0]+a[1]-a[2]+a[3]==7)
    {
        cout<<a[0]<<"+"<<a[1]<<"-"<<a[2]<<"+"<<a[3]<<"=7"<<endl;
    }
    else if(a[0]-a[1]-a[2]-a[3]==7)
    {
        cout<<a[0]<<"-"<<a[1]<<"-"<<a[2]<<"-"<<a[3]<<"=7"<<endl;
    }
    else if(a[0]-a[1]-a[2]+a[3]==7)
    {
        cout<<a[0]<<"-"<<a[1]<<"-"<<a[2]<<"+"<<a[3]<<"=7"<<endl;
    }
    else if(a[0]-a[1]+a[2]+a[3]==7)
    {
        cout<<a[0]<<"-"<<a[1]<<"+"<<a[2]<<"+"<<a[3]<<"=7"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>

using namespace std;
const int MIN = -200;
const int MAX = 200;

long by_5(int a, int b) {
	return powl(a, 5) - powl(b, 5);
}

int main() {
	long x;
	cin >> x;

	for (int i = MIN;i <= MAX;i++) {
		for (int j = MIN;j <= MAX;j++) {
			if (x == by_5(i, j)) {
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3704
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>

using namespace std;

#define TRACE(x) cerr << #x << " " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<

#define fst first
#define snd second

typedef long long llint;
typedef pair<int, int> pii;

const int B = 27397, MOD = 1e9 + 7;
const int B1 = 33941, MOD1 = 1e9 + 9;

int n;
string s;

inline bool check(string &s) {
  for (int i = 1; i < s.size(); ++i)
    if (s[i] != s[i - 1]) return false;
  return true;
}

int solve(char c) {
  int ret = 0;
  string curr = s, next = s;
  if (check(curr)) return ret;
  while (true) {
    ++ret;
    next.pop_back();
    for (int i = 0; i < curr.size() - 1; ++i) {
      if (curr[i] == c || curr[i + 1] == c)
        next[i] = c;
      else
        next[i] = curr[i + 1];
    }
    if (next.size() == 0 || check(next))
      break;
    curr = next;
  }
  return ret;
}

int main(void) {
  cin >> s;
  n = s.size();

  int sol = n - 1;
  for (int i = 0; i < 26; ++i)
    sol = min(solve('a' + i), sol);

  printf("%d\n", sol);
  return 0;
}


Measured memory_bytes: 256
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy[8] = { 1,1,1,0,0,-1,-1,-1 };


//LOVE NyantakoGG	https://www.youtube.com/channel/UC6XdFs8T6Ei54O0FYl3PVVA


using namespace std;



int main() {
	string S;
	cin >> S;
	map<char, int>mp;
	for (int i = 0; i < S.size(); i++) {
		mp[S[i]] = 1;
	}
	int ans = 0;
	for (auto it = mp.begin(); it != mp.end(); ++it) {
		ans += it->second;
	}
	if (S.size() == ans) {
		cout << "yes" << endl;
	}
	else {
		cout << "no" << endl;
	}
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i < int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

int SURP = 1000000007;

int main(){
	int N;
	cin >> N;
	int a[N];
	FOR(i,0,N) cin >> a[i];
	sort(a,a+N);

	bool isAlice = true;
	int ret = 0;
	for(int i = N-1; i>=0;i--){
		if (isAlice) ret += a[i];
		else ret -= a[i];
		isAlice = !isAlice;
	}

	if(ret) cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n, m, a, b, c, ans = 0;
    string s, t, res = "";
    bool f = true;

    cin >> a >> b;

    if(a == 1) a += 13;
    if(b == 1) b += 13;

    if(a == b) cout << "Draw" << endl;
    else if(a > b) cout << "Alice" << endl;
    else cout << "Bob" << endl;


    
}

Measured memory_bytes: 764
n=int(input())
str=input()
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#a=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
for st in str:
  x=int(a.find(st))
  x+=n
  if x>=26:
     print(a[x-26],end="")
  else:
     print(a[x],end="")
 


Measured memory_bytes: 4468
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

ans = [-1] * n
for s, c in sc:
    if (ans[s-1] == c) | (ans[s-1] == -1):
        ans[s-1] = c
    else:
        print(-1)
        exit()

for i in range(n):
    if ans[i] == -1:
        if (i == 0) & (n != 1):
            ans[i] = 1
        else:
            ans[i] = 0

if n != 1 and ans[0] == 0:
    print(-1)
    exit()

print(*ans, sep='')


Measured memory_bytes: 9180
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL n,dp[110][4][4][4],ans=0;
vector <int> v;

bool ok(int i,int j,int k)
{
	return !((i==0&&j==1&&k==2)||(i==0&&j==2&&k==1)||(i==1&&j==0&&k==2));
}

bool ok2(int a,int b,int c,int d)
{
	v.clear();
	v.pb(a);
	v.pb(b);
	v.pb(c);
	v.pb(d);
	rep(j,4)
	for(int k=-1;k<=1;k+=2)
	{
		if(j+k<0||j+k>=4) continue;
		swap(v[j],v[j+k]);
		rep(i,2)
		{
			if(v[i]==0&&v[i+1]==1&&v[i+2]==2)
			{
				return false;
			}
		}
		swap(v[j],v[j+k]);
	}
	return true;
}

int main()
{
	cin>>n;
	rep(i,4) rep(j,4) rep(k,4) if(ok(k,j,i)) dp[3][i][j][k]=1;
	for(int len=4;len<=n;len++)
	{
		rep(i,4)
		{
			rep(j,4)
			{
				rep(k,4)
				{
					rep(p,4)
					{
						if(ok2(k,j,i,p)&&ok(j,i,p)) dp[len][p][i][j]=(dp[len][p][i][j]+dp[len-1][i][j][k])%MOD;
					}
				}
			}
		}
	}
	rep(i,4) rep(j,4) rep(k,4) ans=(ans+dp[n][i][j][k])%MOD;
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	// if card[charactor][number] == 0 -> Missing Card.
	int card[4][13] = { 0 }, n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		char charactor;
		int number;
		cin >> charactor >> number;
		switch (charactor) {
		case 'S':
			card[0][number - 1] = 1;
			break;
		case 'H':
			card[1][number - 1] = 1;
			break;
		case 'C':
			card[2][number - 1] = 1;
			break;
		case 'D':
			card[3][number - 1] = 1;
			break;
		}
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 13; j++) {
			if (!card[i][j]) {
				switch (i) {
				case 0:
					cout << "S ";
					break;
				case 1:
					cout << "H ";
					break;
				case 2:
					cout << "C ";
					break;
				case 3:
					cout << "D ";
					break;
				}
				cout << j + 1 << endl;
			}
		}
	}
}

Measured memory_bytes: 1160
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std; 


inline void solve(){
	bool ok=true;
    int n; cin>>n; 
    map <int,int> cnt;
    vi a(n); 
    for (int i=0;i<n;i++){
    	cin>>a[i];
    	cnt[a[i]]++;
    }
    if (sz(cnt)==1) {
    	if (a[0] != 0) ok=false;
    }
    else if (n%3 or sz(cnt)>3) ok=false;
    else if (sz(cnt)%3==0){
    	vector <pii> h(3);
    	int i=0;
    	for (auto &it: cnt) h[i++]=it;
    	if ( (h[0].ff^h[1].ff^h[2].ff) or (h[0].ss != h[1].ss) or (h[1].ss != h[2].ss) ) ok=false;
    }
    else {
    	vector <pii> h(2);
    	int i=0;
    	for (auto &it: cnt) h[i++]=it;
    	if ( (h[0].ff != 0) or (h[0].ss*2 != h[1].ss)) ok=false;
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 8588
def solve():
    N = int(input())
    A = list(map(int, input().split()))

    dict = {}
    for i, Nstudent in enumerate(A):
        dict[i+1] = Nstudent
    

    sortedDict = sorted(dict.items(), key=lambda x: x[1])
    for i in sortedDict:
        print(i[0], end=" ")

if __name__ == '__main__':
    solve()


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
 
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define form(i, n) for (size_t i = 0; i < size_t(n); ++i)
#define forn(i, n) for (size_t i = 1; i <= size_t(n); ++i)
template<class T> using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long mod(long long a, long long b) { return (a%b+b)%b; }
long long gcd(long long x, long long y) { return __gcd(x, y); }
long long lcm(long long x, long long y) { return x * 1ll * y / gcd(x, y); }
 
 
const long long MAXN = 1e9 + 9;
const long long SIZE = 5e5 + 5;
const long long MOD  = 1e9 + 7;


long long N, res;


int main() { speedhack()

	cin >> N;

	for (long long i = 1; i <= N; i++) {
		long long cnt = N / i;
		cnt = (cnt * (cnt + 1)) / 2;
		res = res + cnt * i;
	}	cout << res << endl;

	return 0;
}

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

//#define int long long
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX
bool cmp(int a, int b) {
	return a > b;
}

int main(){
    int n,k;
    cin>>n>>k;
    int a[n];
    long long ans=0;
    vector<int> h(n);
	for (int i = 0; i < n; ++i)
		cin >> h[i];
	sort(h.begin(), h.end(), cmp);
    for (int i=k; i<n; i++){
        ans+=h[i];
    }   
    cout<<ans<<endl;
    

}

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

int main()
{
  int n, m;
  int a[101];

  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];

  for (int k = 1; k <= m; ++k){
    for (int i = 1; i < n; ++i){
      if (a[i] % k > a[i + 1] % k) swap(a[i + 1], a[i]);
    }
  }

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

Measured memory_bytes: 3096
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define endl "\n"
const ll maxn = 2*(1e5 + 5);

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    ll i, j, k, t, n, m;
    double d;

    cin>>n;

    d = (double)22/7;

    printf("%0.7lf",2*d*n);


 
    return 0;
}

Measured memory_bytes: 3740
n = [int(i) for i in input().split()]
K = int(input())

for _ in range(K):
    if n[0] >= n[1]:
        n[1] = n[1] * 2
    else:
        n[2] = 2*n[2]
        

if n[2] > n[1] > n[0]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using i64 = int64_t;
using u64 = uint64_t;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

constexpr int64_t MOD = 1'000'000'007LL;

#define INT(NAME) int NAME; cin>>NAME;
#define INT64(NAME) int64_t NAME; cin>>NAME;
#define VECTOR(NAME, TYPE, SIZE) std::vector<TYPE> NAME((SIZE));\
    for(int xxxx_i=0; xxxx_i<SIZE; xxxx_i++) cin>>NAME[xxxx_i];
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)    

void solve() {
    INT64(N)
    if (N==1) {
        cout<<1<<endl; return;
    }
    vector<vector<ull>> factors(N+1);
    vector<ull> fs(N+1, 1);
    ull ans = 1;
    for (ull i = 2; i<=N; i++) {
        if (fs[i]==1) {
            for (ull j=i+i; j<=N; j+=i) {
                int k = j;
                int c = 0;
                while (k%i == 0) {
                    k /= i;
                    c++;
                }
                fs[j] *= (c+1);
            }
            fs[i] = 2;
        } 
    }
    for (ull i=2; i<=N; i++) {
        ans += fs[i] * i;
    }
    cout<<ans<<endl;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 315740
d = int(input())
cl = list(map(int, input().split()))
sl = []
for _ in range(d):
    sl.append(list(map(int, input().split())))

tl = []
# for _ in range(d):
#     tl.append(int(input()))

last_di = [-1]*26
ans = 0
for day in range(d):
    best_t = 0
    best_t_val = -999999999999
    for t in range(26):
        curr_val = sl[day][t]*1
        for i in range(26):
            if i == t: continue
            curr_val -= (day-last_di[i])*cl[i]*5
        if curr_val >= best_t_val:
            best_t = t
            best_t_val = curr_val
    tl.append(best_t+1)
    last_di[best_t] = day
    ans += best_t_val
    # print(ans)
    # print('-- {}---'.format(day))
    # print(best_t)
    # print(last_di)

for t in tl:
    print(t)

# for day, t in enumerate(tl):
#     ans += sl[day][t-1]
#     last_di[t-1] = day
#     for ld, c in zip(last_di, cl):
#         # if ld == -1: continue
#         ans -= (day-ld)*c
#     print(ans)

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

import sys
from itertools import accumulate
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = MAP()
# Mの倍数が欲しいのでとりあえずMOD Mする
A = [a%M for a in LIST()]

# 累積和
acc = [0] + [a%M for a in accumulate(A)]
C = Counter(acc)
ans = 0
for v in C.values():
    # 同値のペアが区間和が0(Mの倍数)になるので、そこを数える
    ans += v * (v-1) // 2
print(ans)


Measured memory_bytes: 17424
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    m, n = map(int, input().split())
    horizontal, vertical = [], []
    X, Y = {-INF, 0, INF}, {-INF, 0, INF}

    for _ in range(m):
        x0, x1, y = map(int, input().split())
        horizontal.append((x0, x1, y))
        X.add(x0)
        X.add(x1)
        Y.add(y)
    for _ in range(n):
        x, y0, y1 = map(int, input().split())
        vertical.append((x, y0, y1))
        X.add(x)
        Y.add(y0)
        Y.add(y1)
    X = sorted(X)
    Y = sorted(Y)

    # compress
    m, n = len(X), len(Y)
    cX = {v : i for i, v in enumerate(X)}
    cY = {v : i for i, v in enumerate(Y)}

    # make grid
    grid_hor = [[True] * n for _ in range(m)]
    grid_ver = [[True] * n for _ in range(m)]
    for x0, x1, y in horizontal:
        y = cY[y]
        for x in range(cX[x0], cX[x1]):
            grid_hor[x][y] = False
    for x, y0, y1 in vertical:
        x = cX[x]
        for y in range(cY[y0], cY[y1]):
            grid_ver[x][y] = False

    # bfs
    ans = 0
    queue = [(cX[0], cY[0])]
    used = [[False] * n for _ in range(m)]
    used[cX[0]][cY[0]] = True
    while queue:
        nQ = []
        for x, y in queue:
            if x == 0 or y == 0 or x == m - 1 or y == n - 1:
                print("INF")
                return
            ans += (X[x + 1] - X[x]) * (Y[y + 1] - Y[y])
            # up
            if y + 1 < n and grid_hor[x][y + 1] and not used[x][y + 1]:
                used[x][y + 1] = True
                nQ.append((x, y + 1))
            # down
            if y - 1 >= 0 and grid_hor[x][y] and not used[x][y - 1]:
                used[x][y - 1] = True
                nQ.append((x, y - 1))
            # right
            if x + 1 < m and grid_ver[x + 1][y] and not used[x + 1][y]:
                used[x + 1][y] = True
                nQ.append((x + 1, y))
            # left
            if x - 1 >= 0 and grid_ver[x][y] and not used[x - 1][y]:
                used[x - 1][y] = True
                nQ.append((x - 1, y))
        queue = nQ

    print(ans)
resolve()

Measured memory_bytes: 290016
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int maxn = 100010;

int x, y, a, b, c;
int p[maxn], q[maxn], r[maxn];

int main() {
    ll ans = 0;
    scanf("%d%d%d%d%d", &x, &y, &a, &b, &c);
    vector<int> ap;
    for (int i = 0; i < a; i++) {
        scanf("%d", &p[i]);
    }
    for (int i = 0; i < b; i++) {
        scanf("%d", &q[i]);
    }
    for (int i = 0; i < c; i++) {
        scanf("%d", &r[i]);
    }
    sort(p, p + a, greater<int>());
    sort(q, q + b, greater<int>());
    sort(r, r + c, greater<int>());
    for (int i = 0; i < x; i++) {
        ap.push_back(p[i]);
    }
    for (int i = 0; i < y; i++) {
        ap.push_back(q[i]);
    }
    sort(ap.begin(), ap.end());
    for (int i = 0; i < c && i < ap.size(); i++) {
        if (ap[i] < r[i]) ap[i] = r[i];
    }
    for (int it : ap) {
        ans += (ll)it;
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 5488
n, h = gets.split.map(&:to_i)
a = []
b = []
n.times do |i|
  a[i], b[i] = gets.split.map(&:to_i)
end
a_max = a.max
count = 0
b.sort.reverse.each do |i|
  if i > a_max
    h -= i
    count += 1
  else
    break
  end
  if h <= 0
    p count
    exit
  end
end
if h % a_max == 0
  count += h / a_max
else
  count += h / a_max + 1
end
p count

Measured memory_bytes: 4972
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll read(){
	ll x=0,sign=1;char s=getchar();
	while(!isdigit(s)){if(s=='-')sign=-1;s=getchar();}
	while(isdigit(s))x=(x<<1)+(x<<3)+s-'0',s=getchar();
	return x*sign;
}
int k,x;
int main()
{
	cin>>k>>x;
	for(int i=x-k+1;i<x+k;i++)
		cout<<i<<" "; 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
long long fact(int x)
{
    if(x==0)
        return 1;
    else
        return x*fact(x-1);
}
long long permu(int x,int r)
{
    return (fact(x)/((fact(x-r))*fact(r)));
}
bool pali(char a[])
{
    int l=strlen(a),i;
    for(i=0;i<l;i++)
    {
        if(a[i]==a[l-1-i])
            continue;
        else
            return false;
    }
    return true;
}
int main()
{
    fast;
    float l;
    cin>>l;
    printf("%.12f",(l*l*l)/27);
}


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

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

	char current_col = s[0];
	int num_switch = 0;
	for (int i = 1; i < s.size(); i++) {
		if (s[i] != current_col) {
			current_col = s[i];
			num_switch++;
		}
	}

	cout << num_switch << endl;

	return 0;

}


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

int main() {
string s;
  cin>>s;
  int p=s.size()-1;
  
  if(s[p] == 's'){
    string e="es";
    cout<<s + e<<endl;
  }
  else{
    string S="s";
    cout<<s+S<<endl;
  }
}

Measured memory_bytes: 3628
n, m = map(int, input().split())

a_set=set()

for index in range(m):
    a_set.add(int(input()))

ans_list=[]

for index in range(n + 1):
    ans_list.append(0)

for index in range(n + 1):
    if index == 0:
        ans_list[index] += 1
        continue
    if index == 1 and (index not in a_set):
        ans_list[index] += ans_list[index - 1]
        continue
    
    if index not in a_set:
        if (index - 1) not in a_set:
            ans_list[index] += ans_list[index - 1]
            ans_list[index] %= 1000000007
        if (index - 2) not in a_set:
            ans_list[index] += ans_list[index - 2]
            ans_list[index] %= 1000000007

print(ans_list[n])


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

int main() {
  int A;
  int B;
  int C;
  int X;
  
  cin >> A >> B >> C >> X;
  
  int res = 0;
  
  for (int a = 0; a <= A; ++a) {
    for (int b = 0; b <= B; ++b) {
      for (int c = 0; c <= C; ++c) {
        int total = 500*a + 100*b + 50*c;
        if(total == X) ++res;
      }
    }
  }
  

  cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(v) v.begin(), v.end()
#define mod 1000000007
#define mod2 1000000006
#define inf 1000000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<lli>
#define vii vector<int>
#define is indexed_set
#define eps 0.000001
#define endl '\n'
#define mo 998244353
#define pi 3.141592653589793
#define FF first
#define SS second
using namespace std ;
 
const lli dx4[] = {-1, 0, 1, 0};
const lli dy4[] = {0, 1, 0, -1};
const lli dx8[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const lli dy8[] = {0, 1, 0, -1, -1, 1, -1, 1};
 
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count()); // can give negative values too

#define N 10000000

void solve()
{
    lli n,m;
    cin>>n>>m;

    string s[n];
    loopl(i,0,n) cin>>s[i];

    lli a[n][m];
    a[0][0] = (s[0][0] == '#') ;

    loopl(i,1,m)
    {
        a[0][i] = a[0][i-1] + (s[0][i]!=s[0][i-1] && s[0][i]=='#');
    }

    loopl(i,1,n)
    {
        a[i][0] = a[i-1][0] + (s[i][0]!=s[i-1][0] && s[i][0]=='#');
    }

    loopl(i,1,n)
    {
        loopl(j,1,m)
        {
            lli k = min(a[i][j-1]+(s[i][j-1]!=s[i][j] && s[i][j]=='#'),
                        a[i-1][j]+(s[i-1][j]!=s[i][j] && s[i][j]=='#'));

            a[i][j] = k;
        }
    }
    cout<<a[n-1][m-1];
}

int main()
{
/////////////////////////////////////
    fastio;
/////////////////////////////////////  
        
    lli t;
    t=1;
    while(t--)
    solve();    
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define For(i,n) for(int i=0;i<n;i++)
#define mem(a,b) memset(a,b,sizeof(a))
#define int long long int
#define ld long double
#define fio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define vpi vector<pair<int,int> >
#define vv vector<int>
#define MAXN 1001
#define PI 3.1415926535897932384626
int A[MAXN];


int32_t main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fio;
	long double a, b, h, m;
	cin >> a >> b >> h >> m;
	long double x = h * 30 + m / 2;
	long double y = 6 * m;
	double e = abs(x - y) * PI / 180;
	double ans = sqrt(a * a + b * b - 2 * a * b * cos(e) );
	printf("%.12lf\n", ans);


}


Measured memory_bytes: 4276
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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;
}

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */

int main() {
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >>k;
    if(e- a >k){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }


}



Measured memory_bytes: 256
using static System.Console;
using System.Linq;

public class Hello
{
    public static void Main()
    {
      var l = ReadLine();
      int N = int.Parse(l);
      int[] W = new int[N];
      l = ReadLine();
      int sum = 0;
      int sum_temp = 0;
      for (int i=0;i<N;i++){
      W[i] = int.Parse(l.Split()[i]);
      sum+=W[i];
      }
      
      int mini = 1000000;
      
      for (int i=0;i<N;i++){
      for (int j=0;j<i + 1;j++){
      sum_temp +=W[j];        
      }
      
      mini = new int[2]{mini,System.Math.Abs(sum - 2 * sum_temp)}.Min();    
      sum_temp = 0;
      }
      
      
      WriteLine(mini);    
      
    }
}

Measured memory_bytes: 13268
n,m,l = map(int,input().split())
A=[]
B=[]
for i in range(n): A.append(list(map(int,input().split())))
for j in range(m): B.append(list(map(int,input().split())))
for A_r in A:
    print(" ".join(map(str,[sum([x*y for x,y in zip(A_r,[B_r[k] for B_r in B])]) for k in range(l)])))


Measured memory_bytes: 6320
#include <iostream>
#include <string>
#include <math.h>
#include <list>
#include <stack>
#include <set>
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <cstdlib>
#include <typeinfo>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	ll a, b, ans = 1;
	cin >> a >> b;
	while (1) {
		if (a > b)break;
		a *= 2;
		ans++;
	}
	cout << ans-1 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int total = Integer.parseInt(sc.next());
        int max = Integer.parseInt(sc.next());
        int res = 0;
        int count = 1;
        for(int x=1; x<=total;x++) {
            res += Integer.parseInt(sc.next());
            if (res > max) {
                System.out.println(count);
                return;
            }
            count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 21844
using System;

class C
{
	static void Main()
	{
		var s = Console.ReadLine();

		var q = new int[2];
		foreach (var c in s)
		{
			int i = c - '0', j = (i + 1) % 2;
			if (q[j] > 0) q[j]--;
			else q[i]++;
		}
		Console.WriteLine(s.Length - q[0] - q[1]);
	}
}


Measured memory_bytes: 13140
#include <iostream>
#define MOD 1000000007

using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int h, w; cin >> h >> w;
    char grid[h][w];
    for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) cin >> grid[i][j];
    long long dp[h][w];
    for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) dp[i][j] = 0;
    dp[0][0] = 1;
    for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) {
        if (i + 1 < h && grid[i + 1][j] == '.') {
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j] %= MOD;
        }
        if (j + 1 < w && grid[i][j + 1] == '.') {
            dp[i][j + 1] += dp[i][j];
            dp[i][j + 1] %= MOD;
        }
    }
    cout << dp[h - 1][w - 1];
    return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  string x;
  for (int i = 0; i < s.size(); i++) {
    x += t.at(i);
  }
  if (s == x) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mmax(a,b,c) max(a,max(b,c))
#define mmin(a,b,c) min(a,min(b,c))
#define M 1000000007
#define V vector
#define F(a,b,c) for (a=b;a<=c;++a)
#define I cin
#define O cout
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second

int main() {
    I.sync_with_stdio(false);
    I.tie(0);
    ll ls,lt,i,j;
    string s,t;
    I>>s>>t;
    ls=s.size();
    lt=t.size();
    vector<vector<ll>> dp(lt+1, vector<ll> (ls+1,0));
    string a;
    for (i=1;i<=lt;++i)
    {
        for (j=1;j<=ls;++j)
        {
            if (s[j-1]==t[i-1])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    for (i=lt;;)
    {
        for (j=ls;;)
        {
            if (s[j-1]==t[i-1])
            {
                a=s[j-1]+a;
                --i;
                --j;
            }
            else if (dp[i][j-1] > dp[i-1][j])
            {
                // a=s[j-1]+a;
                --j;
            }
            else if (dp[i][j-1] <= dp[i-1][j])
            {
                // a=t[i-1]+a;
                --i;
            }
            if (j==0||i==0)
                break;
        }
        if (j==0||i==0)
            break;
    }
    O<<a<<'\n';
    // O<<dp[lt][ls]<<'\n';
    return 0;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
#define ll long long
#define read(x) scanf("%d",&x)
using namespace std;
const int maxn = 1e5 + 10;

int n, k;
char s[maxn];
char tmp[maxn];

int main()
{   
	cin>>n>>k;
	cin>>s;
	int tot = 0;
	int res = 0;
	for(int i=0;i<n;i++){
		if(i==0) {tmp[tot++] = s[i];
			continue;
		}
		if(s[i]==s[i-1]) res++;
		if(s[i-1]!=s[i]) tmp[tot++] = s[i];
	}
	// for(int i=0;i<tot;i++){
	// 	cout<< tmp[i]<<' ';
	// }
	if(tmp[0]!=tmp[tot-1]){
		if(k>=tot/2) res += (tot/2-1)*2+1;
		else res += k*2;  
		cout<<res<<endl;
	}
	if(tmp[0]==tmp[tot-1]){
		if(tot==1) {
			cout<<res<<endl;
		}else{
			if(k>=tot/2) res += (tot/2)*2;
			else res += k*2;
			cout<<res<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
#define mid ((l+r)>>1)

const int N=190;
char str[N][N];
int n,m,tmp,sum[N][N],dp[N][N][N][18];

bool check(int lx,int rx,int ly,int ry) {
	int res=sum[rx][ry]-sum[lx-1][ry]-sum[rx][ly-1]+sum[lx-1][ly-1];
	if(res==0||res==(rx-lx+1)*(ry-ly+1)) return true;
	return false;
}
int main() {
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i) scanf("%s",str[i]+1);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+(bool)(str[i][j]=='.');
	for(int x=1;x<=n;++x)
		for(int L=1;L<=m+1;++L)
			for(int k=0;k<18;++k) dp[x][L][L-1][k]=1<<30;
	for(int x=1;x<=n;++x)
		for(int L=1;L<=m;++L) for(int R=L;R<=m;++R) {
			int l=x,r=n,ans=l-1;
			while(l<=r) check(x,mid,L,R)?ans=mid,l=mid+1:r=mid-1;
			dp[x][L][R][0]=ans;
		}
	// for(tmp=1;dp[1][1][m][tmp-1]<n;++tmp) {
	// 	for(int x=1;x<=n;++x)
	// 		for(int L=1;L<=m;++L)
	// 			for(int R=L;R<=m;++R)
	// 				dp[x][L][R][tmp]=dp[dp[x][L][R][tmp-1]+1][L][R][tmp-1];
	// 	for(int x=1;x<=n;++x)
	// 		for(int L=1;L<=m;++L)
	// 			for(int R=L;R<=m;++R) {
	// 				int res=L;
	// 				while(res<R&&
	// 					min(dp[x][L][res][tmp-1],dp[x][res+1][R][tmp-1])<=
	// 					min(dp[x][L][res+1][tmp-1],dp[x][res+2][R][tmp-1])) ++res;
	// 				dp[x][L][R][tmp]=
	// 					max(dp[x][L][R][tmp],min(dp[x][L][res][tmp-1],dp[x][res+1][R][tmp-1]));
	// 			}
	// }
	// printf("%d\n",tmp-1);
	int ans=1;
	for (;dp[1][1][m][ans-1]<n;ans++){
		for (int i=1;i<=n;i++)
			for (int j=1;j<=m;j++)
				for (int k=j;k<=m;k++)
					dp[i][j][k][ans]=dp[dp[i][j][k][ans-1]+1][j][k][ans-1];
		for (int i=1;i<=n;i++)
			for (int j=1;j<=m;j++)
				for (int k=j,p=j;k<=m;k++){
					while (p<k&&min(dp[i][j][p][ans-1],dp[i][p+1][k][ans-1])<=min(dp[i][j][p+1][ans-1],dp[i][p+2][k][ans-1])) ++p;
					dp[i][j][k][ans]=max(dp[i][j][k][ans],min(dp[i][j][p][ans-1],dp[i][p+1][k][ans-1]));
				}
	}
	printf ("%d",ans-1);
	return 0;
}

Measured memory_bytes: 471424
package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var n, l int
	var str string
	fmt.Scan(&n, &l)

	s := make([]string, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&str)
		s = append(s, str)
	}

	sort.Strings(s)
	fmt.Println(strings.Join(s, ""))
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
constexpr long long gcd(long long a, long long b){return b ? gcd(b, a % b) : a;}
constexpr long long lcm(long long a, long long b){return a / gcd(a, b) * b;}
constexpr int INF = 1e9, MOD = INF + 7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
constexpr int mod_pow(long long x, long long n, const int mod){long long ret=1;while(n){if(n&1)(ret*=x)%=mod;(x*=x)%=mod;n>>=1;}return ret;}
template<int n> struct Factorial{long long arr[n+1],ary[n+1];constexpr Factorial():arr(),ary(){arr[0]=1;ary[0]=1;for(int i=0;i<n;i++){arr[i+1]=arr[i]*(i+1)%MOD;ary[i+1]=mod_pow(arr[i+1],MOD-2,MOD);}}}; constexpr Factorial<1010> fact;
constexpr long long comb(int a, int b){if(a < b) return 0LL;if(!a or !b) return 1LL; long long pos = fact.arr[a], pot = fact.ary[a - b], por = fact.ary[b]; return pos * pot % MOD * por % MOD;}
constexpr int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
constexpr long double PI = abs(acos(-1));
constexpr int sqrtN = 512, logN = 32;
constexpr long long LINF=1e18;

int main(){
	long n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	
	long dp[1005] = {}; dp[n] = 1;
	for(int i = a; i <= b; i++){
		for(int k = i * c; k < n + 1; k++){
			long A = k;
			long B = 1;
			
			for(int j = 1; j < d + 1; j++){
				if(k - i * j < 0) break;
				
				(B *= comb(A, i)) %= MOD;
				A -= i;
				
				if(j >= c){
					(dp[k - i * j] += dp[k] * B % MOD * fact.ary[j] % MOD) %= MOD;
				}
			}
		}
	}
	
	cout << dp[0] << endl;
	return 0;
}


Measured memory_bytes: 256
from collections import Counter
def solve():
    s = input()
    t = input()
    s_cnt = Counter(s)
    t_cnt = Counter(t)
    if all(sv == tv for sv, tv in zip(sorted(s_cnt.values()), sorted(t_cnt.values()))):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 9760
import math


def lem(A, B):
    AB = A * B
    while B != 0:
        A, B = B, A % B
    return AB // A


a, b, c, d = map(int, input().split())

"""
# A以上B以下でCで割り切れる数の個数
x1 = (A-1) // C
x2 = B // C
x = x2 - x1
#print("x:", x)

# A以上B以下でDで割り切れる数の個数
y1 = (A-1) // D
y2 = B // D
y = y2 - y1
#print("y", y)

# A以上B以下でC,Dで割り切れる数の個数
z1 = (A-1) // lcm(C, D)
z2 = B // lcm(C, D)
z = z2 - z1
#print("lcm:{}".format(lcm(C, D)))
#print("z", z)

# A~B間の整数 - Cの倍数とDの倍数の個数 + CでもDでも割り切れる個数
not_d = B - (A+1) - (x + y - z)
print(int(not_d))
 """

total = b - a+1
bsep = (b // c) + (b // d) - (b // lem(c, d))
asep = (a-1) // c + (a-1) // d - (a-1) // lem(c, d)

ans = total - bsep + asep
print(ans)


Measured memory_bytes: 3064
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n;
    cin>>n;
    int x = n%10;
    if(x==2||x==4||x==5||x==7||x==9)    cout<<"hon\n";
    else if(x==0||x==1||x==6||x==8)     cout<<"pon\n";
    else    cout<<"bon\n";
    return 0;
}



Measured memory_bytes: 3616
from collections import defaultdict
N,X,D = map(int,input().split())
d = defaultdict(list)
if D<0:
    D *= -1
    X *= -1

if D != 0:
    for m in range(N+1):
        a = X*m+(m*(m-1)*D)//2
        b = X*m+(m*(2*N-m-1)*D)//2
        d[a%D].append([a,b])


    ans = 0
    for k in d:
        q = d[k]
        q.sort()
        l,r = q[0]
        for i in range(len(q)):
            a,b = q[i]
            if a<=r:
                r = max(r,b)
            else:
                ans += (r-l)//D+1
                l = a
                r = b
        ans += (r-l)//D+1

if D == 0:
    ans = N+1
    if X == 0:
        ans = 1
print(ans)

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

#include <algorithm>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
typedef long long ll;
typedef pair<ll, ll> P;

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)
vector<long long> dijkstra(vector<vector<pair<long long, long long>>> graph, long long s) {
    vector<long long> ans(graph.size(), -1);
    priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>>
        pq;
    pq.push({0, s});
    while (pq.size() > 0) {
        ll cur1 = 0;
        ll cur2 = 0;
        if (ans[pq.top().second] != -1) {
            pq.pop();
        } else {
            cur1 = pq.top().first;
            cur2 = pq.top().second;
            pq.pop();
            ans[cur2] = cur1;
            for (long long i = 0; i < graph[cur2].size(); i++) {
                pq.push({cur1 + graph[cur2][i].second, graph[cur2][i].first});
            }
        }
    }
    return ans;
}
signed main() {
    long long n;
    cin >> n;
    vector<int> as(n);
    vector<int> cnt(1e6 + 23);
    REP(i, n) {
        cin >> as[i];
        cnt[as[i]]++;
    }
    sort(as.begin(), as.end());
    int ans = 0;
    REP(i, n) {
        if (cnt[as[i]] > 1) {
            // cout << as[i] << endl;
            continue;
        }
        bool div = false;
        for (int j = 1;j <= sqrt(as[i]); j++) {
            // cout << as[j] << endl;
            if (as[i] % j == 0 && j != as[i]) {
                if (cnt[j] > 0) {
                    div = true;
                }
                if (cnt[(as[i] / j)] > 0 && as[i] / j != as[i]) {
                    div = true;
                }
            }
        }
        if (div == false) {
            // cout << endl;
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 7956
using System;
using System.Collections.Generic;

namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] Odd = Console.ReadLine().ToCharArray();
            char[] Even = Console.ReadLine().ToCharArray();

            int length = Odd.Length;

            List<char> p = new List<char>();

            for(int i = 0; i < length; i++)
            {
                p.Add(Odd[i]);
                if (i < Even.Length) p.Add(Even[i]);
            }

            Console.WriteLine(new string(p.ToArray()));
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 13140
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def dfs(k,dep):
    if dep==n:
        return 1
    sm = 0
    for i in dst[k]:
        if used[i]:
            continue
        used[i] = True
        sm += dfs(i,dep+1)
        used[i] = False
    return sm

n,m = inm()
dst = {}
for i in range(m):
    a,b = inm()
    if a not in dst:
        dst[a] = {}
    dst[a][b] = 1
    if b not in dst:
        dst[b] = {}
    dst[b][a] = 1
used = [False]*(n+1)
used[1] = True
print(dfs(1,1))


Measured memory_bytes: 41564
#include<iostream>

int main(){
  char a,b;
  std::cin >> a >> b;
  if(a == 'H')
    std::cout << b;
  else if ( b == 'H')
    std::cout << 'D';
  else if ( b == 'D')
    std::cout << 'H';
  return 0;
}

Measured memory_bytes: 256
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	m := getNextInt(scanner)
	dd := make([][]int, m+1)
	for i := 1; i < m+1; i++ {
		for j := i; j < m+1; j += i {
			dd[j] = append(dd[j], i)
		}
	}
	seg := newSegment(m + 1)
	pp := make([]pair, n)
	for i := 0; i < n; i++ {
		l := getNextInt(scanner)
		r := getNextInt(scanner)
		pp[i][0] = l
		pp[i][1] = r
	}
	sort.SliceStable(pp, func(i, j int) bool {
		return pp[i][1] > pp[j][1]
	})
	j := 0
	ans := make([]int, m+1)
	for i := m; i >= 1; i-- {
		for j < n && pp[j][1] >= i {
			seg.update(pp[j][0], seg[0][pp[j][0]]+1, seg.add)
			j++
		}
		for _, d := range dd[i] {
			if i-d+1 < 0 {
				ans[d] += seg.query(0, i+1, 0, seg.add)
				continue
			}
			ans[d] += seg.query(i-d+1, i+1, 0, seg.add)
		}
	}
	for i := 1; i < m+1; i++ {
		fmt.Fprintln(writer, ans[i])
	}
}

type pair [2]int

type segment [][]int

func newSegment(n int) segment {
	seg := make(segment, 0)
	for n > 1 {
		seg = append(seg, make([]int, n))
		n = (n + 1) >> 1
	}
	seg = append(seg, make([]int, 1))
	return seg
}
func (seg segment) update(i int, v int, f func(x, y int) int) {
	seg[0][i] = v
	for h := 1; h < len(seg); h++ {
		i >>= 1
		if i<<1+1 < len(seg[h-1]) {
			seg[h][i] = f(seg[h-1][i<<1], seg[h-1][i<<1+1])
		} else {
			seg[h][i] = seg[h-1][i<<1]
		}
	}
}
func (seg segment) query(l, r int, s int, f func(x, y int) int) int {
	for h := 0; h < len(seg) && l < r; h++ {
		if l&1 == 1 {
			s = f(s, seg[h][l])
			l++
		}
		l >>= 1
		if r&1 == 1 {
			s = f(s, seg[h][r-1])
		}
		r >>= 1
	}
	return s
}
func (seg segment) add(x, y int) int {
	return x + y
}


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

int main(){
	int H,W;

	while(1){
		cin >> H >> W;
		if(H==0 && W==0) break;

		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if(i==0 || i== H-1 || j==0 || j == W-1){
					cout << "#";
				} else {
					cout << ".";
				}
			}
			cout << "\n";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3028