akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int n,k;
ll mod;
ll f[330][330],s[330][330];
ll C[330][330];
void sol()
{
	for (int x=k;x>=0;--x) for (int size=1;size<=n+1;++size)
	{
		ll sss=0;
		for (int ch=1;ch<size;++ch)
		{
			ll doe=C[size-2][ch-1]*f[x][size-ch]%mod;
			ll now=(doe*s[x+1][ch]%mod+mod)%mod;
			sss=(sss+now)%mod;
		}
		if (size==1) sss=1;
		f[x][size]=sss;
		s[x][size]=(s[x+1][size]+f[x][size])%mod;

	}
}
int main()
{
//	freopen("E.in","r",stdin);
//	freopen("E.out","w",stdout);

	memset(f,-1,sizeof(f));
	scanf("%d%d%lld",&n,&k,&mod);
	C[0][0]=1;
	for (int i=1;i<=310;++i)
	{
		C[i][0]=C[i][i]=1;
		for (int j=1;j<i;++j)
			C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
	}
	
//	cerr<<"end_init"<<endl;
	sol();
	printf("%lld\n",f[0][n+1]);

	return 0;
}

Measured memory_bytes: 2816
import itertools

n=int(input())

lst=[[] for i in range(n)] 

for i in range(n):
  a=int(input())
  for j in range(a):
    x,y=map(int,input().split())
    lst[i].append([x-1,y])

ans=0


for xxx in itertools.product(range(2),repeat=n):
    table=[[] for i in range(n)]
    for j in range(n):
        if xxx[j]==1:
            for k in lst[j]:
                table[k[0]].append(k[1])
    
    flag=True

    for j in range(n):
        if xxx[j]==1:
            if table[j].count(0)!=0:
                flag=False
        
        else:
            if table[j].count(1)!=0:
                flag=False
    

    if not flag:
        continue
    

    ans=max(ans,xxx.count(1))



print(ans)

Measured memory_bytes: 74396
def f(x):
    ret=[]
    for i in range(1,int(x**0.5)+1):
        if x%i==0:
            ret+=[i,x//i]
    ret.sort()
    return ret

N,M=map(int,input().split())
divitors=f(M)
for m in divitors:
    if m<N:pass
    else:
        print(int(M/m))
        break

Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

typedef long long ll;

#include <set>

using namespace std;

bool isLeap(ll year){
  return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
}

int daysOf(ll year, int month){
  static int days[2][12] = {
    {31,28,31,30,31,30,31,31,30,31,30,31},
    {31,29,31,30,31,30,31,31,30,31,30,31}
  };
  return days[isLeap(year)][month - 1];
}

int thirteenFriday(ll year, int firstDay){
  int ret = 0;
  REP(i,12){
    const int day = (firstDay + 12) % 7;
    if(day == 4) ret++;
    firstDay = (firstDay + daysOf(year, i + 1)) % 7;
  }
  return ret;
}

const int period = 400;
int firstDays[period];
int thirteenFridays[period];

void init(){
  firstDays[0] = 5;
  REP(i,period - 1)
    firstDays[i + 1] = (firstDays[i] + 365 + isLeap(i)) % 7;
  REP(i,period)
    thirteenFridays[i] = thirteenFriday(i, firstDays[i]);
}

int firstDayOf(ll year){
  return firstDays[year % period];
}

int dayOf13(ll year, int month){
  int firstDay = firstDayOf(year);
  for(int i = 1; i < month; i++){
    firstDay = (firstDay + daysOf(year, i)) % 7;
  }
  return (firstDay + 12) % 7;
}

ll solve(ll y, int m, int d){
  ll ret = 0;
  for(int i = 0; i < min(y, (ll)period); i++){
    const ll cnt = (y - i + period - 1) / period;
    const int fd = firstDayOf(i);
    ret += thirteenFriday(i, fd) * cnt;
  }

  for(int i = 1; i < m; i++)
    ret += dayOf13(y, i) == 4;

  if(d >= 13)
    ret += dayOf13(y, m) == 4;

  return ret;
}

int main(){
  init();

  ll y1, y2;
  int m1, m2, d1, d2;
  cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;

  ll ans = solve(y2, m2, d2) - solve(y1, m1, d1);
  if(d1 == 13 && dayOf13(y1, m1) == 4) ans++;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1168
import java.util.Scanner;

public class Main {
	static long n,k,m,l,a,b,c;
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		a=sc.nextInt();
		b=sc.nextInt();
		n=sc.nextInt();
		k=0;
		for(int i=1;i*a<=n;i++) {
			k+=b;
		}
		System.out.println(k);
    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N;cin>>N;
  vector<vector<long>>A(N);
  for(long i=0;i<N;i++){
    long a,b;cin>>a>>b;
    A[a-1].push_back(b-1);
    A[b-1].push_back(a-1);
  }
  vector<long>D(N,-1);D[0]=0;
  queue<long>q;q.push(0);
  while(q.size()){
    long f=q.front();q.pop();
    for(long n:A[f])if(D[n]==-1){
      D[n]=D[f]+1;q.push(n);
    }
  }
  long o=0,e=0;
  for(long x:D)x%2?o++:e++;
  vector<long>P(N);
  long x=1,y=2,z=3;
  if(o<(N+1)/3){
    for(long i=0;i<N;i++){
      if(D[i]%2){P[i]=z;z+=3;}
      else{
        if(x<=N){P[i]=x;x+=3;}
        else if(y<=N){P[i]=y;y+=3;}
        else {P[i]=z;z+=3;}
      }
    }
  }
  else if(e<(N+2)/3){
    for(long i=0;i<N;i++){
      if(D[i]%2==0){P[i]=z;z+=3;}
      else{
        if(x<=N){P[i]=x;x+=3;}
        else if(y<=N){P[i]=y;y+=3;}
        else {P[i]=z;z+=3;}
      }
    }
  }
  else{
    for(long i=0;i<N;i++){
      if(D[i]%2){
        if(y<=N){P[i]=y;y+=3;}
        else {P[i]=z;z+=3;}
      }
      else{
        if(x<=N){P[i]=x;x+=3;}
        else {P[i]=z;z+=3;}
      }
    }
  }
  for(long p:P)cout<<p<<" ";
  /*
  距離の偶奇の個数で場合分け
  : 偶数に1,奇数に2を振ってあとは3
  偶数が異様に多い時:
    1と3を全部使い切ってしまって2しか埋められなくなる
    [偶数の個数>1の個数+3の個数]
    1の個数=(N+2)//3
    2の個数=(N+1)//3
    3の個数=N//3
    偶数>(N+2)//3+N//3=N-(N+1)//3
    
    奇数=N-偶数<(N+1)//3
    
    
    この時, 奇数に全部3を埋めちゃえばいい
    
    こうなるのは...?
    奇数が, 3の個数以下
  奇数が異様に多い時:
  2,3
  [奇数の個数>2,3]
  偶数<(N+2)//3
  偶数に全部
  */
}


/*


*/

Measured memory_bytes: 18280
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

// ref: http://prd-xxx.hateblo.jp/entry/2017/10/13/004256
struct BipartileGraph {
    vi colors;
    vvi edges;
    BipartileGraph(int n) : colors(n, -1), edges(n) {}
    void addEdge(int f, int t) {
        edges[f].emplace_back(t);
        edges[t].emplace_back(f);
    }
    // true = bipartile
    bool build(int s, int color = 0) {
        colors[s] = color;
        for (auto &e : edges[s]) {
            if (colors[e] == color)
                return false;
            if (colors[e] == -1 && !build(e, color ^ 1))
                return false;
        }
        return true;
    }
};

int main() {
    ll n, m;
    cin >> n >> m;
    vi d(n);
    vector<pii> di(n);
    for (int i = 0; i < n; ++i) {
        cin >> d[i];
        di[i] = {d[i], i};
    }
    sort(di.begin(), di.end());
    vl cost(m, -1);
    string color(n, 'X');
    vl u(m), v(m);
    // struct edge {
    //     int f, t, idx;
    // };
    vector<vector<pii>> edges(n);
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        edges[u].emplace_back(v, i);
        edges[v].emplace_back(u, i);
    }
    for (int i = 0; i < n; ++i) {
        if (color[di[i].second] == 'X') {
            bool ok = false;
            for (auto &p : edges[di[i].second]) {
                if (color[p.first] != 'X' && d[p.first] <= d[di[i].second]) {
                    char c;
                    c                   = color[p.first] == 'W' ? 'B' : 'W';
                    color[di[i].second] = c;
                    cost[p.second]      = d[di[i].second];
                    ok                  = true;
                    break;
                }
            }
            if (!ok) {
                for (auto &p : edges[di[i].second]) {
                    if (color[p.first] == 'X' && d[p.first] == d[di[i].second]) {
                        color[di[i].second] = 'W';
                        color[p.first]      = 'B';
                        cost[p.second]      = d[di[i].second];
                        ok                  = true;
                        break;
                    }
                }
            }

            if (!ok) {
                cout << -1 << "\n";
                return 0;
            }
        }
    }
    cout << color << "\n";
    for (int i = 0; i < m; ++i) {
        if (cost[i] == -1)
            cout << 1000000000 << "\n";
        else
            cout << cost[i] << "\n";
    }
    return 0;
}

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

ll s[100000], g[100000];
int main() {
	ll t; int n; scanf("%lld%d", &t, &n);
	rep(i, n)scanf("%lld%lld", &s[i], &g[i]);
	int b = 0;
	ll sum = 0, Max = 0;
	rep(i, n) {
		while (b < n&&g[b] - s[i] <= t)sum += g[b] - s[b], b++;
		ll c = 0; if (b < n)c = max(0LL, s[i] + t - s[b]);
		Max = max(Max, sum + c);
		sum -= g[i] - s[i];
	}
	printf("%lld\n", Max);
}

Measured memory_bytes: 4740
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n, q; cin >> n >> q;
  string s; cin >> s;
  V<char> t(q), d(q); REP(i, q) cin >> t[i] >> d[i];
  // 左側の落ちる判定
  ll l_l=0, l_r=n;
  while (l_l < l_r) {
    ll mid = (l_l + l_r) / 2;
    ll tmp = mid;
    REP(i, q) {
      if (tmp<0 || tmp>=n) break;
      if (s[tmp] == t[i]) {
        if (d[i] == 'L') tmp--;
        else tmp++;
      }
    }
    if (tmp < 0) l_l = mid+1;
    else l_r = mid;
  }
  // 右側の落ちる判定
  ll r_l=0, r_r=n;
  while (r_l < r_r) {
    ll mid = (r_l + r_r) / 2;
    ll tmp = mid;
    REP(i, q) {
      if (tmp<0 || tmp>=n) break;
      if (s[tmp] == t[i]) {
        if (d[i] == 'L') tmp--;
        else tmp++;
      }
    }
    if (tmp >= n) r_r = mid;
    else r_l = mid+1;
  }
  cout << r_r - l_r << endl;
  return 0;
}


Measured memory_bytes: 900
N,M = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort()
ans = 0
m = 0
for a,b in src:
    if m+b < M:
        m += b
        ans += a*b
    else:
        ans += (M-m)*a
        break
print(ans)

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

using namespace std;

int n;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
#endif

    cin >> n;
    int cnt = (n + 999) / 1000;
    int temp = cnt * 1000;
    cout << temp - n << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define cal(x,y) ((x+=y)%=mo)
using namespace std;
const int N=4050,mo=998244353;
int f[N][N],c[N][N],k,n;
int fap(int a,int b){
  int s=1;
  for (; b; b>>=1,a=1ll*a*a%mo)
    if (b&1) s=1ll*s*a%mo;
  return s;
}
int C(int x,int y){
  if (y<0) return 0;
  if (y==0) return 1;
  return c[x+y-1][y];
}
int solve(int s){
  int ans=0,cnt=0,t;
  for (int i=1; i<=k; ++i)
    if (s-i<=k&&s>i)
      ++cnt;
  t=cnt/2;
  if (s%2==0)
    for (int i=0; i<=n; ++i){
      cal(ans,1ll*f[t][i]*C(k-cnt,n-i)%mo);
      cal(ans,1ll*f[t][i]*C(k-cnt,n-i-1)%mo);
    }
  else
    for (int i=0; i<=n; ++i)
      cal(ans,1ll*f[t][i]*C(k-cnt,n-i)%mo);
  return ans;
}
int main(){
  cin>>k>>n,f[0][0]=1;
  for (int i=0; i<=k/2; ++i){
    for (int j=0; j<=n; ++j)
      cal(f[i+1][j+1],2*f[i][j]%mo);
    for (int j=1; j<=n; ++j)
      cal(f[i+1][j],f[i+1][j-1]);
    for (int j=0; j<=n; ++j)
      cal(f[i+1][j],f[i][j]);
  }
  for (int i=0; i<n+k; ++i){
    c[i][0]=1;
    for (int j=1; j<=i; ++j)
      c[i][j]=(c[i-1][j-1]+c[i-1][j])%mo;
  }
  for (int i=2; i<=2*k; ++i)
    cout<<solve(i)<<endl;
  return 0;
}

Measured memory_bytes: 80640
#include<stdio.h>
#include<iostream>
using namespace std;
long long num[200005];

int main()
{
    long long ans=10000000000000000;
    long long n;
    scanf("%lld",&n);
    long long i;
    long long sum=0;
    for(i=1;i<=n;i++)
    {
        cin>>num[i];
        sum=sum+num[i];
    }
    long long tempn=0;
    long long temps;
    for(i=1;i<=n-1;i++)
    {
        tempn=tempn+num[i];
        if(2*tempn<=sum)
        {
            temps=sum-tempn-tempn;
        }
        else
        {
            temps=tempn-(sum-tempn);
        }
        if(temps<ans)
            ans=temps;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = 1e18;

vvll graph;
V<bool> visited;
ll n;
vll indeg;
vll toposo;

void bfs(ll i) {
  queue<ll> q; q.push(i);
  visited[i] = true;
  while (!q.empty()) {
    ll to = q.front(); q.pop();
    toposo.push_back(to);
    REP(i, graph[to].size()) {
      ll v = graph[to][i];
      indeg[v]--;
      if (indeg[v] == 0 && !visited[v]) {
        visited[v] = true;
        q.push(v);
      }
    }
  }
}

void tsort() {
  REP(i, n) indeg[i] = 0;  // 入次数の初期化
  REP(i, n) REP(j, graph[i].size()) indeg[graph[i][j]]++;
  REP(i, n) if (indeg[i]==0 && !visited[i]) bfs(i);
  REP(i, toposo.size()) cout << toposo[i] << endl;
}

int main() {
  ll s, t, m;
  cin >> n >> m;
  visited.resize(n); indeg.resize(n);
  graph.resize(n);
  REP(i, n) visited[i] = false;
  REP(i, m) {
    cin >> s >> t;
    graph[s].push_back(t);
  }
  tsort();
  return 0;
}



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

int N,X,T;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>N>>X>>T;
	if(N % X == 0) cout<<N / X * T<<endl;
	else cout<<(N / X + 1) * T<<endl;
}


Measured memory_bytes: 3648
n, m, x = map(int, input().split())
inn = [ list( map(int, input().split() ) ) for _ in range(n) ]
c = [inn[_][0] for _ in range(n) ]
ara = [ inn[_][1:] for _ in range(n)]

ans = 1e9

for mask in range(2**n):
	cost = 0
	cnt = [0 for _ in range(m)]
	for i in range(n):
		if ( (1 << i) & mask ) == 0:
			continue
		cost += c[i]
		for j in range(m):
			cnt[j] += ara[i][j]
	ok = 1
	for i in range(m):
		if cnt[i] < x:
			ok = 0
	if ok:
		ans = min(ans, cost)

if ans == 1e9:
	ans = -1

print(ans)





Measured memory_bytes: 9096
#include<bits/stdc++.h>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define put(x) cout<<#x<<" = "<<x<<endl;
#define X first
#define Y second
#define pb push_back
#define pp pop_back
#define int num
#pragma GCC optimize("O3")
using namespace std;
typedef long long num;
typedef pair<int,int> point;
const int maxn=3e5+10,M=998244353;

int n,a,b,k,fact[maxn],frev[maxn];

int power(int a,int b){
    if(b==0) return 1;
    int ans=power(1ll*a*a%M,b/2);
    if(b&1) ans=1ll*ans*a%M;
    return ans;
}

int C(int n,int k){
    if(k<0 || k>n) return 0;
    int ans=1ll*fact[n]*frev[k]%M;
    ans=1ll*ans*frev[n-k]%M;
    return ans;
}
int ans=0;
int32_t main(){
    fact[0]=frev[0]=1;
    rep(i,1,maxn){
	fact[i]=1ll*fact[i-1]*i%M;
	frev[i]=1ll*frev[i-1]*power(i,M-2)%M;
    }
    cin>>n>>a>>b>>k;
    rep(pa,0,n+1){
	int rem=k-pa*a;
	if(rem<0 || rem%b!=0) continue;
	int pb=rem/b;
	int s=1ll*C(n,pa)*C(n,pb)%M;
	ans=(ans+s)%M;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4992
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

// ================================================= //



/*
 1-index
 
 add : x に valを加算
 sum : [1,x] の総和を出力
 */
struct BIT {
    int N;
    vector<ll> bit;
    BIT(int N):N(N) {
        /* BITは[1..N]で扱う */
        bit.resize(N + 1, 0);
    }
    
    void add(int x, int val){
        while (x <= N) {
            bit[x] += val;
            x += x & -x;
        }
    }
    
    int sum(int x){
        int ret = 0;
        while (x) {
            ret += bit[x];
            x &= (x - 1);
        }
        return (ret);
    }
};



int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int n,q; cin >> n >> q;
    
//    SegTree ST(n);
    BIT bit(n);
    while(q--){
        int com,x,y; cin >> com >> x >> y;
        if(com == 0){
           // ST.update(x-1,y);
            bit.add(x,y);
        }else{
            //cout << ST.rsq(x-1,y) << endl;
            cout << bit.sum(y) - bit.sum(x-1) << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 3492
def koch(n, ax, ay, bx, by):
    if n == 0:
        return
    
    th = math.pi * 60.0 / 180.0
    
    xx = (2.0 * ax + bx)/3.0
    xy = (2.0 * ay + by)/3.0
    zx = (ax + 2.0 * bx)/3.0
    zy = (ay + 2.0 * by)/3.0
    yx = (zx - xx)*math.cos(th) - (zy - xy)*math.sin(th) + xx
    yy = (zx - xx)*math.sin(th) + (zy - xy)*math.cos(th) + xy
    
    koch(n-1, ax, ay, xx, xy)
    print xx,xy
    koch(n-1, xx, xy, yx, yy)
    print yx,yy
    koch(n-1, yx, yy, zx, zy)
    print zx,zy
    koch(n-1, zx, zy, bx, by)
    
import math
n = int(raw_input())
ax = 0.0
ay = 0.0
bx = 100.0
by = 0.0

print ax,ay
koch(n, ax, ay, bx, by)
print bx,by

Measured memory_bytes: 6644
#include <stdio.h>
#include <map>

int main()
{
	std::map<int, int> m;
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int temp;
		scanf("%d", &temp);
		if (m[temp] == 0) m[temp] = 1;
		else m.erase(m.find(temp));
	}
	printf("%d\n", (int)m.size());
	return 0;
}

Measured memory_bytes: 4864
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n; cin>>n;
  VI a(3*n); rep(i,3*n) cin>>a[i];
  ll ans = 0;
  sort(RALL(a));
  rep(i,n) ans += a[2*i+1];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>


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


const int MOD = pow(10,9)+7;
const int MAX = 2047483647;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll;


int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}

ll gcb(ll a, ll b){/// ユークリッドの互除法: O(log)
    
    if(b == 0) return a;
    
    return gcb(b,a%b);
}


ll lcm(ll a, ll b){
    
    return  a/gcb(a,b) * b; ///gcbは約数
}


int main() {
    
    string S;
    string T;
    
    cin >> S;
    cin >> T;
    
    int corresp[30];
    for(auto i = 0; i<30;i++){
        corresp[i] = -1;
    };
    
    int correspS[30];
    for(auto i = 0; i<30;i++){
        correspS[i] = -1;
    };
    
    for(auto i = 0; i<S.size(); i++){
        
        if(correspS[S[i]-'a']==-1){
            correspS[S[i]-'a']  = T[i]-'a';
        }
        
        if(corresp[T[i]-'a'] == -1){
            corresp[T[i]-'a']  = S[i]-'a';
        }
        
        if (correspS[S[i]-'a'] != T[i]-'a' || corresp[T[i]-'a'] != S[i]-'a'){
//            cout <<correspS[T[i]-'a']  << " " <<corresp[S[i]-'a'] <<endl;
            cout << "No" << endl;
            return 0;
        }
        
    }
    
    cout << "Yes" << endl;
    
    return 0;
}






Measured memory_bytes: 776
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W, K = map(int, input().split())
    S = [list(input()) for _ in range(H)]

    res = [[0] * W for _ in range(H)]
    num = 0
    for h in range(H):
        flg = 0
        for w in range(W):
            if S[h][w] == "#":
                num += 1
                flg = 1
            res[h][w] = num if flg else 0

    for h in range(H):
        num = res[h][-1]
        for w in reversed(range(W)):
            if S[h][w] == "#":
                num = res[h][w]
            res[h][w] = num

    for w in range(W):
        for h in range(1, H):
            if res[h][w] == 0:
                res[h][w] = res[h - 1][w]

    for w in range(W):
        for h in reversed(range(H - 1)):
            if res[h][w] == 0:
                res[h][w] = res[h + 1][w]

    for i in res:
        print(*i)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 13424
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n,m,k =I()
a = [0]+list(itertools.accumulate(l()))
b = [0]+list(itertools.accumulate(l()))

j = m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k-a[i]:
        j -= 1
    ans = max(ans,i+j)

print(ans)

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

int main(){

  int N, i, count=0;
  cin >> N;
  vector<int> d(N);
  for(i=0; i<N; i++) cin >> d[i];
  sort(d.begin(), d.end());


  if(d[(N/2)-1] == d[N/2]) cout << "0" << endl;
  else{
    for(i=d[(N/2)-1]; i<d[N/2]; i++) count++;
    cout << count << endl;
  }

  return 0;
}


Measured memory_bytes: 640
w,h,n = map(int, input().split())

xmin, ymin = 0, 0
xmax, ymax = w, h

for i in range(n):
   x, y, a = map(int, input().split())
   if a == 1:
      xmin = max(xmin, x)
   elif a == 2:
      xmax = min(xmax, x)
   elif a == 3:
      ymin = max(ymin, y)
   elif a == 4:
      ymax = min(ymax, y)

xmax = max(xmin, xmax)
ymax = max(ymin, ymax)

print((xmax-xmin)*(ymax-ymin))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int age;
  cin >> age;
  if (age == 1) {
    cout << "Hello World" << endl;
  }
  
  if (age == 2) {
    int A,B,ans;
    cin >> A >> B;
    ans = A + B;
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
 
# 後ろ向きに考える
# 各要素は基本的に大きくしたいので、そのまま、もしくは
# うまくいかない場合にのみ、1減らす
ans = 'Yes'
for i in range(N-1, 0, -1):
  if A[i] < A[i-1]: A[i-1] -= 1
  if A[i] < A[i-1]:
    ans = 'No'
    break

print(ans)

Measured memory_bytes: 20728
#include <string>
#include <iostream>
using namespace std;
int n, a, b; string s[109], t[109];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> s[i];
	for (int i = 0; i < n; i++) cin >> t[i];
	bool flag = false;
	for (int i = 0; i < n && !flag; i++) {
		int p, q;
		if (s[i] == "kougekida") p = 0;
		if (s[i] == "tameru") p = 1;
		if (s[i] == "mamoru") p = 2;
		if (t[i] == "kougekida") q = 0;
		if (t[i] == "tameru") q = 1;
		if (t[i] == "mamoru") q = 2;
		if (p == 0 && q == 0) {
			if (a > b) {
				cout << "Isono-kun" << endl;
				flag = true;
			}
			if (a < b) {
				cout << "Nakajima-kun" << endl;
				flag = true;
			}
			a = 0, b = 0;
		}
		else if (p == 0) {
			if (a == 0) {
				cout << "Nakajima-kun" << endl;
				flag = true;
			}
			else if (q == 1) {
				cout << "Isono-kun" << endl;
				flag = true;
			}
			else if (a >= 5) {
				cout << "Isono-kun" << endl;
				flag = true;
			}
			a = 0;
		}
		else if (q == 0) {
			if (b == 0) {
				cout << "Isono-kun" << endl;
				flag = true;
			}
			else if (p == 1) {
				cout << "Nakajima-kun" << endl;
				flag = true;
			}
			else if (b >= 5) {
				cout << "Nakajima-kun" << endl;
				flag = true;
			}
			b = 0;
		}
		else {
			if (p == 1) a++;
			if (q == 1) b++;
		}
	}
	if (!flag) cout << "Hikiwake-kun" << endl;
	return 0;
}

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

typedef pair<int, int> ii;
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<int> vi;

#define end '\n'
#define fi first
#define se second
#define sz(x) (int)(x.size())
#define all(x) x.begin(), x.end()
#define rep(i,a,b) for(int i=a;i<=b;i++)

#define L(x) (x<<1)
#define R(x) ((x<<1)+1)

const int maxN = 110;

int main() {
	//fast input/output c++
	ios_base::sync_with_stdio(0), cin.tie(NULL);

	int a, b, c;
	cin >> a >> b >> c;
	cout << c << " " << a  << " " << b << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 class Main{
  public static void main(String args[]){
  Scanner scan = new Scanner(System.in);
   int a = scan.nextInt(); 
   int b = scan.nextInt();
   int c = scan.nextInt();

   int x =0; 
   
    for(int i=a; i<=b; i++){if(c%i==0){x++;}}
     
    System.out.println(x);
                                        }
            }


Measured memory_bytes: 26436
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	int x, a, b, y;
	cin >> x>> a >> b;

	y = x - a;

	cout << y % b << endl;


		
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

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

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 200001; //check the limits, dummy

int main() {
    ios_base::sync_with_stdio (0);
    cin.tie (0);
    ll n;
    cin >> n;
    ll ans = 1e15;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ans = min (ans, i + n / i - 2);
        }
    }
    cout << ans << '\n';

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int holiday = scanner.nextInt();
        int num = scanner.nextInt();

        for (int i = 0; i < num; i++) {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(holiday);
    }
}


Measured memory_bytes: 46252
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=100;
int n,a[maxn],b[maxn],c[maxn],tot;
int lg,d[maxn];
void add(int x,int y,int z) {
	a[++tot]=x; b[tot]=y; c[tot]=z;
}
int main() {

	read(n);
	for (int i=0;i<20;i++)
		if (n&(1<<i)) d[++lg]=i;
	for (int i=1;i<=d[lg];i++)
		add(i,i+1,0),add(i,i+1,(1<<(i-1)));
	n=(1<<d[lg]);
	for (int i=lg-1;i>=1;i--)
		add(d[i]+1,d[lg]+1,n),n+=(1<<d[i]);
	printf("%d %d\n",d[lg]+1,tot);
	for (int i=1;i<=tot;i++)
		printf("%d %d %d\n",a[i],b[i],c[i]);
	return 0;
}

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

/**
 * Created by Ayushi on 14 Jun 2020.
 * Problem:
 * Round:
 */

public class Main {
    public static void main(String[] args) throws IOException {
        StringTokenizer st;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        st = new StringTokenizer(br.readLine(), " ");
        int x = Integer.parseInt(st.nextToken());
        int n = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine(), " ");
        ArrayList<Integer> a = new ArrayList<>();
        while (st.hasMoreTokens()) {
            a.add(Integer.parseInt(st.nextToken()));
        }
        br.close();

        int ans = x;
        for (int i = 0; i <= (n/2)+1; i++) {
            if (!a.contains(x-i)) {
                ans = x-i;
                break;
            }
            if (!a.contains(x+i)) {
                ans = x+i;
                break;
            }
        }
        System.out.println(ans);
    }
}


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

using namespace std;

int D, N;
vector<int> T;
vector<int> A, B, C;
vector<vector<bool>> usable;
vector<vector<int>> dp;

int main() {
  cin >> D >> N;
  T.assign(D + 1, 0);
  A.assign(N + 1, 0);
  B.assign(N + 1, 0);
  C.assign(N + 1, 0);
  usable.assign(D + 1, vector<bool>(N + 1, false));
  dp.assign(D + 1, vector<int>(N + 1, -1));
  for (int i = 1; i <= D; i++)
    cin >> T[i];
  for (int i = 1; i <= N; i++)
    cin >> A[i] >> B[i] >> C[i];
  for (int i = 1; i <= D; i++)
    for (int k = 1; k <= N; k++)
      usable[i][k] = (A[k] <= T[i] && T[i] <= B[k]);

  for (int i = 1; i <= N; i++)
    if (usable[1][i])
      dp[1][i] = 0;
  for (int i = 1; i <= D - 1; i++)
    for (int k = 1; k <= N; k++)
      if (dp[i][k] >= 0)
        for (int j = 1; j <= N; j++)
          if (usable[i + 1][j])
            if (dp[i + 1][j] < dp[i][k] + abs(C[k] - C[j]))
              dp[i + 1][j] = dp[i][k] + abs(C[k] - C[j]);
  int ans=-1;
  for(int i=1;i<=N;i++){
    if(ans < dp[D][i]){
      ans = dp[D][i];
    }
  }
  cout << ans << endl;
}



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

int main(){
	int n, u, k, v;
	int Graph[100][100] = {};
	
	cin >> n;
	
	for(int i = 0 ; i < n ; i++){
		cin >> u >> k; //u = ??????????????? k = u?????????????¬???°
		u--;
		for(int j = 0 ; j < k ; j++){
			cin >> v; //v = ??£??\?????????????????????
			v--;
			Graph[u][v] = 1;
		}
	}
	
	for(int i = 0 ; i < n ; i++){
		for(int j = 0 ; j < n ; j++){
			if(j != 0){
				cout << " ";
				}
			cout << Graph[i][j];
			}
		cout << endl;
		}
	
	return 0;
}

Measured memory_bytes: 1208
let ans, n, a, b, ds, xs = Scanf.scanf "%d %d %d" @@ fun n a b -> Array.(ref max_int, n, a, b, make n 0, init n @@ fun _ -> Scanf.scanf " %d" (+) 0)
let _ = for i = 1 to n - 1 do ds.(i - 1) <- xs.(i) - xs.(i - 1) done; Array.(sort (-) ds; iteri (fun i d -> if i > 0 then ds.(i) <- ds.(i) + ds.(i - 1)) ds); for w = 0 to n - 1 do ans := min !ans @@ ds.(w) * a + (n - 1 - w) * b done; Printf.printf "%d\n" !ans

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

int main() {
    string s;
    int n;
    cin>>n;
    cin >> s ;
    char tmp=s[0];
    int ans=n;
    for (int i = 1; i < n; ++i){
      if(s[i]==tmp){
        ans--;
      }
      tmp=s[i];
    }

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


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

int main() {
  int N, A, B;
  A = 1;
  B = 0;
  cin >> N;
  for (int i = 0; i < 9; i++){
    B += ((N-N%A)/A)%10;
    A *= 10;
  }
  if (N%B == 0){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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

#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265
 
const ll N = 100005;

void solve(){
    ll n, m;
    cin>>n>>m;
    ll H[n+1];
    ll A[n+1];
    rep(i,1,n+1)  A[i]=1;
    rep(i,1,n+1)    cin>>H[i];
    rep(i,0,m){
        ll u,v;
        cin>>u>>v;
        if(H[u]>=H[v])  A[v]=0;
        if(H[v]>=H[u])  A[u]=0;
    }
    ll cnt=0;
    // rep(i,1,n+1)    cout<<A[i]<<" ";cout<<endl;
    rep(i,1,n+1)    if(A[i])    cnt++;
    cout<<cnt<<endl;
    return;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll no;
    // cin>>no;
    no = 1;
    while(no--){
        solve();
    }
    return 0;
}

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

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<char> > a = vector<vector<char> >(h, vector<char>(w, 0));
    char c[1000];
    for (int y = 0; y< h; y++){

        cin >> c;
        for(int x =0;x<w;x++){
            a[y][x] = c[x];
        }
    }
    vector<pair<int, int> > open = vector<pair<int,int> >(w*h, make_pair(-1,-1));
    int openlen = 0;
    vector<pair<int, int> > next = vector<pair<int,int> >(w*h, make_pair(-1,-1));
    int nextlen = 0;

    vector<vector<bool> > visited = vector<vector<bool> >(h, vector<bool>(w, false));

    for (int y=0;y<h;y++){
        for(int x=0;x<w;x++){
            visited[y][x] = false;
            if(a[y][x] == '#'){
                open[openlen] = make_pair(x, y);
                openlen ++;
                visited[y][x] = true;
            }
        }
    }
    int dirx[] = {+1, -1, 0, 0};
    int diry[] = {0, 0, +1, -1};
    int cnt = 0;
    while(true){
        for(int i=0;i<openlen; i++){
            int x = open[i].first;
            int y = open[i].second;
            for(int j = 0;j<4;j++){
                int nextx = x + dirx[j];
                int nexty = y + diry[j];
                if(0<= nextx && nextx < w && 0<= nexty && nexty < h){
                    if(!visited[nexty][nextx]){
                        next[nextlen] = make_pair(nextx, nexty);
                        visited[nexty][nextx] = true;
                        nextlen++;
                    }
                }
            }
        }
        if(nextlen == 0){
            cout << cnt;
            return 0;
        }else{
            cnt ++;
            for(int i=0;i<nextlen;i++){
                open[i] = next[i];
            }
            openlen = nextlen;
            nextlen = 0;
        }
    }
    return 0;
}

Measured memory_bytes: 17024
a, b, k = map(int, input().split())

"""
for i in range(k):
    if (a >= 1):
        a -= 1
    elif (b >= 1):
        b -= 1
print("{} {}".format(a, b))
"""

if (a > k):
    ax = a - k
    bx = b
else:
    ax = 0
    bx = max(a+b-k, 0)

print("{} {}".format(ax, bx))


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

int main() {
  string N;
  cin >> N;
  int total = 0;
  for(int i = 0; i < N.size(); i++) {
    int a = N.at(i) - '0';
    total += a;
  }
  if(total % 9 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }  
}

Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define N 100005
#define ll long long
#define ull unsigned long long
#define loop1(i, j, k, step) for (int i=j; i<k; i+=step)
#define loop(i, j, k) for (int i=j; i<k; i++) 
#define rloop1(i, j, k, step) for (int i=j; i>=k; i-=step)
#define rloop(i, j, k) for(int i=j; i>=k; i--)
#define rep(i, k) for(int i = (0); i < (k); i++ )
#define rrep(i, k) for(int i = k-1; i >= 0; i-- )

#define forall(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define pop pop_back
#define F first
#define S second
#define sz(x) (int)(x).size()
#define endl "\n"
#define Max (int)INT_MAX
#define Min (int)INT_MIN
#define MEM(a, b) memset(a, (b), sizeof(a))
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;


void solve()
{
	int n,i,j,k,l;
	cin>>n;
	k=n%10;
	if(k==2 || k==4 || k==5 || k==9|| k==7)
		cout<<"hon"<<endl;
	else if(k==0 || k==1 || k==6 || k==8)
		cout<<"pon"<<endl;
	else
		cout<<"bon"<<endl;
}
int  main() 
{
	fast_io;
    int t=1;
    ///cin>>t;
    while(t--)
    	solve();
	return 0; 
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String S = sc.next();
		sc.close();
		String ans = "";
		for(int i=0; i< S.length(); i++){
			int count = (S.charAt(i)-'A' + N) % 26;
			ans = ans + String.valueOf((char)('A' + count));
		}

		System.out.println(ans);

	}

}

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

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

  int res = 0;
  res += (X / 500) * 1000;
  X %= 500;
  res += (X /= 5) * 5;

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int gcd(int a, int b);
int main(void) {
	int K;
	scanf("%d", &K);
	int i,j,k, sum=0;
	for (i = 1; i <= K; i++) {
		for (j = 1; j <= K; j++) {
			for (k = 1; k <= K; k++) {
				sum+=gcd(gcd(i, j), k);
			}
		}
	}
	printf("%d", sum);

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

Measured memory_bytes: 2152
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>

using namespace std;
#define endl '\n'
#define pb push_back
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1e9 + 7)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) > "Yes" : "No" ) << endl


typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

void solve() {

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

	int min, tmp;
	vector<int> x;

	REP(i, n) {
		x.pb(in());
	}
	min = fabs(x[0]) + fabs(x[k - 1] - x[0]);
	REP(i, n - k + 1) {
		tmp = fabs(x[i]) + fabs(x[i + k - 1] - x[i]);
		if (min > tmp) {
			min = tmp;
		}
	}
	for (int i = n - 1; i >= k - 1; i--) {
		tmp = fabs(x[i]) + fabs(x[i] - x[i - k + 1]);
		if (min > tmp) {
			min = tmp;
		}
	}

	out(min);

	return;
}

int main() {

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

	solve();

	return 0;

}

Measured memory_bytes: 892
#include <stdio.h>
#define MAX 100

int main(){
  int M[MAX][MAX];
  int i, j, k, n, u, v;

  scanf("%d", &n);

  for(i = 0; i < n; i++)
    for(j = 0; j < n; j++)
      M[i][j] = 0;

  for(i = 0; i < n; i++){
    scanf("%d %d", &u, &k);
    u--;
    for(j = 0; j < k; j++){
      scanf("%d", &v);
      v--;
      M[u][v] = 1;
    }
  }

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(j != 0) printf(" ");
      printf("%d", M[i][j]);
    }
    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2048
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main(){
  int N;
  cin >> N;
  int btm = 100000;
  int top = -1;
  vector<int> a(N);
  rep(i, N){
    cin >> a.at(i);
    chmin(btm, a.at(i));
    chmax(top, a.at(i));
  }
  sort(all(a));
  int cnt = 0;
  int ans = 0;
  int p = 0;
  int q = 0;
  rep2(i, btm, top+1){
    p = q;
    rep2(j, p, N){
      if(a.at(j) < i-1){
        q++;
      }
      if(i-1 <= a.at(j) && a.at(j) <= i+1){
        cnt++;
      }
      if(a.at(j) > i+1){
        break;
      }
    }
    chmax(ans, cnt);
    cnt = 0;
  }
  cout << ans << endl;
}

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

#define pb push_back
typedef long long int ll;
typedef vector<ll> vl;
typedef map<ll,ll> ii;
typedef map<ll,vl> grp;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    
    ll t;cin>>t;
    vl a;
    for(int i=0;i<t;i++){
        ll k;cin>>k;
        a.pb(k);
    }
    ll s=0;
    sort(a.begin(),a.end());
    for(int i=0;i<t-2;i++){
        for(int j=i+1;j<t-1;j++){
            auto p=lower_bound(a.begin(),a.end(),a[i]+a[j])-a.begin();
            //cout<<p<<" "<<i<<"\n";
            s+=(p-j-1);
        }
    }
    cout<<s;
    return 0;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define ppb pop_back()
#define fi first
#define se second
#define pi pair<int, int>
#define rep(i, a, n) for(int i = a; i <= n; i++)
#define REP(i, a, n) for(int i = a; i < n; i++)
#define Y "YES"
#define N "NO"
using namespace std;

int n;
map<ll, ll> s;
ll a, ans;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	REP(i, 0, n) {
		cin >> a;
		s[a]++;
	}
	n = s.size();
	vector<pair<ll, ll>> v;
	for (auto x : s) {
	    v.pb({x.fi, x.se});
	}
    REP(i, 0, n-2) {
        REP(j, i+1, n-1) {
            REP(z, j+1, n) {
                if (v[i].fi + v[j].fi > v[z].fi) {
                    ans += v[i].se * v[j].se * v[z].se;
                }
            }
        }
    }
	cout << ans;
}


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

#define Rep(i,n) for(int i=0;i<(n);i++)
#define For(i,n1,n2) for(int i=(n1);i<(n2);i++)
#define REP(i,n) for(ll i=0;i<(n);i++)
#define RREP(i,n) for(ll i=(n-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(n1);i<(n2);i++)
#define put(a) cout<<(a)<<"\n";
#define all(a)  (a).begin(),(a).end();
#define SORT(a) sort((a).begin(),(a).end())
#define TDARRAY(int,a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()

typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int n,m;
const int MAXN = 8;
bool e[MAXN][MAXN];
int main(){
    cin >> n >> m;
    vector<int> a(m);
    vector<int> b(m);
    //vector<vector<int>> e(n);
    
    REP(i,n){
        REP(j,n){
            e[i][j] = false;
        }
    }
    REP(i,m){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        e[a[i]][b[i]] = true;
        e[b[i]][a[i]] = true;
    }
    vector<int> v(n-1);
    iota(v.begin(), v.end(), 1);
    int res = 0;
    do {
        bool flag = true;
        if(!e[0][v[0]]){
            flag = false;
        }
        REP(i,n-2){
            if(!e[v[i]][v[i+1]]){
                flag = false;
            }
        }
        if(flag){
            res++;
        }
    } while( next_permutation(v.begin(), v.end()) );     // 次の順列を生成
    put(res);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <string> 
#include <sstream>  
#include <vector> 
#include <time.h>
#include <algorithm>
#include <list>
#include <fstream>
#include <math.h>
using namespace std;

int N,Y;


int main(void){
	while(true){
	cin >> N;
	if(N == 0)break;
	cin >> Y; 
	double  b,r,t,max = 0.00000;
	double  s;
	int ans;
	for(int i = 0;i < N;i++){
		cin >> b >> r >> t;
		if(t == 1){
			s = 1.0 + Y * ( r / 100 );
		}else{
			s =  pow( 1.0 +  ( r / 100.0 ) , Y );
		}
		if(max <= s){
			max = s;
			ans = b;	
		}
		
	} 
	cout << ans << endl;		
	}

}

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

int main() {
  char a;
  cin >> a;
  if(a == 'A')
    cout << 'T' << endl;
  else if(a == 'T')
    cout << 'A' << endl;
  else if(a == 'G')
    cout << 'C' << endl;
  else
    cout << 'G' << endl;
}

Measured memory_bytes: 256