akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(x) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

const LLI mod = 998244353;

bool check(int r, int g, int b){
  return r<g+b and g<r+b and b<r+g;
}

LLI power(LLI n, LLI p, LLI m){
  LLI ret = 1;
  while(p>0){
    if(p&1) (ret *= n) %= m;
    (n *= n) %= m;
    p /= 2;
  }
  return ret;
}

LLI dp[301][90010];
LLI dp2[301][90010];

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

  int N;
  while(cin >> N){
    vector<int> a(N); cin >> a;
    sort(ALL(a));

    int sum = accumulate(ALL(a), 0);
    //dump(sum);

    LLI ans = power(3,N,mod);

    fill_array(dp, 0);
    dp[0][0] = 1;

    fill_array(dp2, 0);
    dp2[0][0] = 1;

    
    REP(i,N){
      REP(j,sum){
	(dp[i+1][j] += dp[i][j]*2) %= mod;
	if(j+a[i] <= sum) (dp[i+1][j+a[i]] += dp[i][j]) %= mod;

	(dp2[i+1][j] += dp2[i][j]) %= mod;
	if(j+a[i] <= sum) (dp2[i+1][j+a[i]] += dp2[i][j]) %= mod;
      }
    }

    REPE(j,sum){
      if(j >= (sum+1)/2){
	ans -= dp[N][j] * 3;
	(ans += mod) %= mod;
      }
    }

    if(sum % 2 == 0){
      ans += dp2[N][sum/2] * 3;
      (ans += mod) %= mod;
    }


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


Measured memory_bytes: 423552
#!/usr/bin/env python3
import sys
import numpy as np

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


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


def LI():
    return list(MI())


N = I()
A = LI()


def is_pair_coprime(A):
    n = max(A)
    D = [0] * (n + 1)
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
            if not D[j]:
                D[j] = i

    used = [False] * (n + 1)
    for a in A:
        temp = a

        while D[temp]:
            mod = D[temp]
            if used[mod]:
                return False
            else:
                used[mod] = True
            while temp % mod == 0:
                temp //= mod

        if temp != 1:
            if used[temp]:
                return False
            else:
                used[temp] = True

    return True


# def pre_fac(n):
#     D = [0] * (n + 1)
#     is_prime = [True] * (n + 1)
#     is_prime[0] = False
#     is_prime[1] = False
#     for i in range(2, int(n ** 0.5) + 1):
#         if not is_prime[i]:
#             continue
#         for j in range(i * 2, n + 1, i):
#             is_prime[j] = False
#             if not D[j]:
#                 D[j] = i
#     return D


# def fac(prime, n):
#     if n == 1:
#         return [[1, 1]]
#     arr, temp = [], n
#
#     while prime[temp]:
#         mod = prime[temp]
#         cnt = 0
#         while temp % mod == 0:
#             cnt += 1
#             temp //= mod
#         arr.append([mod, cnt])
#
#     if temp != 1:
#         arr.append([temp, 1])
#
#     return arr

if is_pair_coprime(A):
    print("pairwise coprime")
elif np.gcd.reduce(A) == 1:
    print("setwise coprime")
else:
    print("not coprime")

# prime = pre_fac(10 ** 6)
#
# d = defaultdict(int)
# for a in A:
#     tmp = fac(prime, a)
#     for t in tmp:
#         d[t[0]] += 1
#
# flag = True
# for k, v in d.items():
#     if flag and v != 1:
#         if k != 1:
#             flag = False
#     if v == N:
#         if k == 1:
#             print("pairwise coprime")
#         else:
#             print("not coprime")
#             exit()
#
#
# if flag:
#     print("pairwise coprime")
# elif 1 in A:
#     print("not coprime")
# else:
#     print("setwise coprime")


Measured memory_bytes: 145216
#include <stdio.h>
#include <bits/stdc++.h>
     
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
     
using namespace std;
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

vector<int> g[N];
vector<int> order;

bool dfs(int u, int par, int n)
{
    order.push_back(u);
    if (u == n - 1)
        return true;
    for (int v : g[u])
        if (v != par)
            if (dfs(v, u, n))
                return true;
    order.pop_back();
    return false;
}

int get(int u, int par)
{
    int res = 1;
    for (int v : g[u])
        if (v != par)
            res += get(v, u);
    return res;
}

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n;
    cin >> n;
    rep(i, 0, n - 1)
    {
        int u, v;
        cin >> u >> v;
        u--; v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(0, -1, n);
    int c1 = 0, c2 = 0;
    rep(i, 0, sz(order))
    {
        int u = order[i];
        if (i < (sz(order) + 1) / 2)
            c1++;
        else
            c2++;
        for (int v : g[u])
            if (!(i > 0 && v == order[i - 1] || i < sz(order) - 1 && v == order[i + 1]))
                if (i < (sz(order) + 1) / 2)
                    c1 += get(v, u);
                else
                    c2 += get(v, u);
    }
    cout << (c1 > c2 ? "Fennec" : "Snuke") << "\n";
    return 0;
}

Measured memory_bytes: 12536
//                                  _                 ______   ______   ______   ______
//                                 | |               |  __  | |  __  | |  __  | |____  |
//   __ _   ____    _____    _  _  | |____           | |__| | | |__| | | |__| |      | |
//  / _` | |  __| /  __  |  / _` | |  __  |          |____  | |____  | |____  |      | |
// | (_| | | |    | |  | | | (_| | | |__| |  ______   ____| |  ____| |  ____| |      | |
//  \__,_| |_|    |_|  |_|  \__,_| |______| |______| |______| |______| |______|      |_|

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9+7;

void FAST(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

bool comp(const pair<int, int> &a, const pair<int, int> &b){
  return (a.first > b.second);
}

int main(){

  FAST();
  //Code goes past here:
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
        cout<<"Yes\n";
    else
        cout<<"No\n";


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

const int N = 2e5 + 1;

void solve(){
	int x;
	cin >> x;
	if(x == 7 or x == 3 or x == 5) cout << "YES" << newl;
	else cout << "NO" << newl;

	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

int main() {
    ull L, R;
    cin >> L >> R;

    ull mod_min=2018;

    for (ull i=L; i<min(R, L+2019); i++) {
        for (ull j=i+1; j<=min(R, L+2019); j++) {
            mod_min = min(mod_min, i * j % 2019);
        }
    }

    cout << mod_min << endl;

    return 0;
}



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

int n,s,ans,a,dp[10000],MOD=998244353;
void pl(int &a,int b){a=(a+b)%MOD;}

int main(){
  cin>>n>>s;
  dp[0]=1;
  for(int i=0,j=s;i<n;i++){
    cin>>a;
    for(int j=s;j>=0;j--)pl(dp[j+a],dp[j]);
    pl(dp[a],i);
    pl(ans,dp[s]);
  }
  cout<<ans;
}


Measured memory_bytes: 256
a,b,c,d = map(int,input().split())

# ユークリッドの互除法
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd (a, b)

cd = lcm(c,d)

mul_count = b//c + b//d - b//cd
a -= 1
mul_count -= (a//c + a//d -a//cd)
print(b - a - mul_count)

# print(cd)
# print(b//c ,b//d ,b//cd)
# print(a//c ,a//d ,a//cd)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long double
//template

//main
signed main(){
  int N;cin>>N;
  std::vector<int> x(N),y(N);
  std::vector<char> q(N);
  for(int i=0;i<N;i++)cin>>x[i]>>y[i]>>q[i];
  char u,d,l,r;u='U';d='D';l='L';r='R';
  int uyM,uym,dyM,dym,ayM,aym;
  int lxM,lxm,rxM,rxm,axM,axm;
  uyM=dyM=ayM=lxM=rxM=axM=-INF;
  uym=dym=aym=lxm=rxm=axm=INF;
  for(int i=0;i<N;i++){
    if(q[i]==u){
      uyM=max(uyM,y[i]);
      uym=min(uym,y[i]);
      axM=max(axM,x[i]);
      axm=min(axm,x[i]);
    }
    if(q[i]==l){
      ayM=max(ayM,y[i]);
      aym=min(aym,y[i]);
      lxM=max(lxM,x[i]);
      lxm=min(lxm,x[i]);
    }
    if(q[i]==d){
      dyM=max(dyM,y[i]);
      dym=min(dym,y[i]);
      axM=max(axM,x[i]);
      axm=min(axm,x[i]);
    }
    if(q[i]==r){
      ayM=max(ayM,y[i]);
      aym=min(aym,y[i]);
      rxM=max(rxM,x[i]);
      rxm=min(rxm,x[i]);
    }
  }
  std::vector<int> t(20,0);
  t[0]=ayM-uyM;
  t[1]=dyM-ayM;
  t[2]=(dyM-uyM)/2;
  t[3]=aym-uym;
  t[4]=dym-aym;
  t[5]=(dym-uym)/2;
  t[6]=lxM-axM;
  t[7]=axM-rxM;
  t[8]=(lxM-rxM)/2;
  t[9]=lxm-axm;
  t[10]=axm-rxm;
  t[11]=(lxm-rxm)/2;
  int ans=LINF;
  for(int p:t){
    if(p<0)continue;
    int xM=max({axM,lxM-p,rxM+p});
    int xm=min({axm,lxm-p,rxm+p});
    int yM=max({uyM+p,ayM,dyM-p});
    int ym=min({uym+p,aym,dym-p});
    ans=min(ans,(xM-xm)*(yM-ym));
  }
  cout<<fixed<<setprecision(12)<<ans<<endl;
}


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

int n;
bool bpGraph[100][100];
vector< pair<int,int> >a,b;

bool bpm(int u, bool seen[], int matchR[]){
    for (int v = 0; v < n; v++){
        if (bpGraph[u][v] && !seen[v]){
            seen[v] = true;
            if (matchR[v] < 0 || bpm(matchR[v], seen, matchR)){
                matchR[v] = u;
                return true;
            }
        }
    }
    return false;
}

int max_match()
{
    int matchR[n];
    memset(matchR, -1, sizeof(matchR));
    int result = 0;
    for (int u = 0; u < n; u++){
        bool seen[n];
        memset(seen, 0, sizeof(seen));
        if (bpm(u,seen,matchR))
            result++;
    }
    return result;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin>>n;
    for(int i=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        a.push_back({x,y});
    }
    for(int i=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        b.push_back({x,y});
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(b[i].first>a[j].first&&b[i].second>a[j].second) bpGraph[i][j] = true;
        }
    }
    int ans = max_match();
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream> //標準入出力
#include <fstream>  //ファイルでの入出力
#include <vector>
#include <set>
#include <functional>
#include <string>
#include <utility> //pair
#include <cmath>  //sqrt 
#include <iomanip> //setprecision
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define MAX 1000000
#define pair(a) pair<a,a>

void _main(){
    ll out = __LONG_LONG_MAX__;
    int n,k; cin >> n >> k;
    vector<ll> heights(n); rep(i,n) cin >> heights[i];
    for (int bit = 0; bit < (1<<(n-1)); bit++)
    {
        vector<ll> heightscopy = heights;
        int color=1;
        ll sum = 0;
        ll maxheight_onleftside = heightscopy[0];
        rep(i,n-1){
            if(bit&(1<<i)){
                color++;
            }
        }
        if(color>=k){
            rep(i,n-1){
                int j = i+1;
                if(bit&(1<<i)){
                    if(maxheight_onleftside+1 > heightscopy[j]){
                        sum += maxheight_onleftside+1 - heightscopy[j];
                        heightscopy[j] = maxheight_onleftside+1;
                    }
                }
                maxheight_onleftside = max(maxheight_onleftside,heightscopy[j]);
            }
            out = min(sum,out);
        }
    }
    
    cout<< out << endl;
    return;
}
int main() {
    cout << fixed << setprecision(10);
    _main();
    return 0;
}
    

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  lint N;
  cin >> N;
  vector<lint> A(N);
  REP(i, N) cin >> A[i];
  vector<bool> prime(1000001, true);
  prime[1] = false;
  FOR(i, 2, 1000001) {
    if(prime[i]) {
      for(int j=i*2; j<1000001; j+=i) prime[j] = false;
    }
  }
  vector<int> ps;
  FOR(i, 2, 1001) {
    if(prime[i]) ps.push_back(i);
  }
  vector<int> cnt(1000001);
  bool pairwise = true;
  REP(i, N) {
    REP(j, ps.size()) {
      if(A[i]%ps[j] == 0) {
        if(cnt[ps[j]] > 0) pairwise = false;
        cnt[ps[j]]++;
        while(A[i]%ps[j] == 0) A[i] /= ps[j];
      }
    }
    if(A[i] > 1) {
      if(cnt[A[i]] > 0) pairwise = false;
      cnt[A[i]]++;
    }
  }
  if(pairwise) {
    cout << "pairwise coprime" << endl;
    return 0;
  }
  REP(i, cnt.size()) {
    if(cnt[i] == N) {
      cout << "not coprime" << endl;
      return 0;
    }
  }
  cout << "setwise coprime" << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v.at(i);
    }

    vector<int> b(n);
    int t = 0;
    int j = 0, k = n-1;
    for(int i = n-1; i >= 0; i--){
        if(t % 2 == 0){
            b.at(j) = v.at(i);
            j++;
        }
        else{
            b.at(k) = v.at(i);
            k--;
        }
        t++;
    }
    for(int i = 0; i < n; i++){
        cout << b.at(i) << " ";
    }
    cout << endl;
}

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

int main(){
  int H,W;
  while(1){
    cin >> H >> W;
    
    if(H==0 && W==0)
      break;
  for(int i=1; i<=H; i++){
    for(int j=1; j<=W; j++){
      if(i%2==j%2){
        cout << "#";
      }
      else{
        cout << ".";
        }
      }
    cout << endl;
    }
    cout << endl;
  }
}




Measured memory_bytes: 3092
import numpy as np
import numba
@numba.njit("void(i8,i8,i8[:])", cache=True)
def solve(N,S,A):
    dp = np.zeros((N+1, S+1), dtype=np.int64)#[[0]*(S+1) for _ in range(N+1)]
    dp[0][0] = 1
    mod = 998244353
    for i, a in enumerate(A, 1):
        for s in range(S+1):
            if s-a >= 0:
                dp[i][s] = (dp[i-1][s] * 2 + dp[i-1][s-a]) % mod
            else:
                dp[i][s] = dp[i-1][s] * 2 % mod
    print(dp[N][S])

N, S = map(int, input().split())
A = list(map(int, input().split()))
solve(N,S,np.array(A))


Measured memory_bytes: 177000
using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.Text.RegularExpressions;
    using System.Text;
    using System.Net;

     
    public class Program
    {

        public void Proc() {
            CoinCounts = new int[3];
            for(int i=0; i<CoinCounts.Length; i++) {
                CoinCounts[i] = int.Parse(Reader.ReadLine());
            }
            int total = int.Parse(Reader.ReadLine());
            int ans = GetAns(0, total);
            Console.WriteLine(ans);
        }

        private int GetAns(int idx, int remain) {
            if(idx>=this.Coins.Length) {
                if(remain==0) {
                    return 1;
                } else {
                    return 0;
                }
            }
            int ans = 0;
            for(int i=0; i<=this.CoinCounts[idx]; i++) {
                int newRemain = remain-this.Coins[idx]*i;
                if(newRemain<0){
                    break;
                }
                ans+=GetAns(idx+1, newRemain);
            }
            return ans;
        }

        private int[] CoinCounts;
        private int[] Coins = new int[]{500,100,50};


        public class Reader {
            public static bool IsDebug = false;
            private static System.IO.StringReader SReader;
            private static string InitText = @"





30
40
50
6000






";
            public static string ReadLine() {
                if(IsDebug) {
                    if(SReader == null) {
                        SReader = new System.IO.StringReader(InitText.Trim());
                    }
                    return SReader.ReadLine();
                } else {
                    return Console.ReadLine();
                }
            }
        }
        public static void Main(string[] args)
        {
            #if DEBUG
            Reader.IsDebug = true;
            #endif
            Program prg = new Program();
            prg.Proc();
        }
    }

Measured memory_bytes: 11092
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = System.Console.ReadLine().Trim();
            Dictionary<string, string> dicW = new Dictionary<string, string>() { { "Sunny", "Cloudy" }, { "Cloudy", "Rainy" }, { "Rainy", "Sunny" } };

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            // 出力
            System.Console.WriteLine("{0}", dicW[sS].ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 11228
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define MAXN 405
const lli inf = 1e17;
lli dp[MAXN][MAXN];
lli a[MAXN];

lli solve(int l, int r){
	if(l > r) return inf;
	if(l == r){
		return 0;
	}
	if(dp[l][r] != -1) return dp[l][r];
	lli sum =0ll;
	for(int k = l; k <= r; k++) sum+=a[k];

	lli ans = 1e18;
	for(int k=l+1; k<=r; k++){
		ans = min(ans, solve(l,k-1) + solve(k,r) + sum);
	}
	return dp[l][r] = ans;
}

int main(){__
	int n;
	cin >> n;
	memset(dp,-1,sizeof(dp));
	for(int i=1; i <=n; i++){
		cin >> a[i];
	}
	cout << solve(1,n) << endl;
	return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<(n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
ll hai[100];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  for(int i=0;i<n;i++){
    ll k;cin>>k;
    for(int j=0;j<k;j++){
      ll a;cin>>a;
      hai[a]++;
    }
  }
  ll ans=0;
  for(int i=0;i<=m;i++){
    if(hai[i]==n)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;

#define int long long
signed main(){
//int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> cnt(n+1,0);

    for(int i = 1; i <= n; i++) {
        int j=i;
        while(j<=n) {
            cnt[j]++;
            j+=i;
        }
    }
    ll ans=0;
    for(int i = 0; i < n; i++) {
        ans+=cnt[i+1]*(i+1);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 81340
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string s;cin>>s;
	ll k;cin>>k;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] != 'a' && ('z' - s[i] + 1) <= k){
			k -= ('z' - s[i] + 1);
			s[i] = 'a';
			// cout << k << endl;
		}
	}
	s[s.size() - 1] = char('a' + (s[s.size() - 1] - 'a' + k) % 26);
	cout << s << endl;
	return 0;
}

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

int stringErase(string s)
{
	stack<char> st;
	for (int i = 0; i < s.size(); ++i) {
		if(s[i] == 'S')
			st.push('S');
		else{
			if((st.size() > 0) && (st.top() == 'S'))
				st.pop();
			else
				st.push('T');
		}
	}
	return st.size();
}

int main(){
	string s;

	cin >> s;

	cout << stringErase(s);
	return 0;
}


Measured memory_bytes: 900
// AOJ DSL_4_A Union of Rectangles
// 2018.5.14 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define MAX_N 2005
#define MAX   4005

int x1[MAX_N], y1[MAX_N], x2[MAX_N], y2[MAX_N];
int x[MAX], xs;
int y[MAX], ys;
short s[MAX][MAX];

int cmp(const void *a, const void *b) { return *(int *)a - *(int *)b; }

int xbsch(int a)
{
	int m, l = 0, r = xs;

    while (l < r) {
        m = (l + r) >> 1;
        if (x[m] < a) l = m + 1; else r = m;
    }
	return l;
}
int ybsch(int a)
{
	int m, l = 0, r = ys;

    while (l < r) {
        m = (l + r) >> 1;
        if (y[m] < a) l = m + 1; else r = m;
    }
	return l;
}

int uniq(int *a, int n)
{
	int i, j;
	
	for (i = 0, j = 1; j < n; j++) {
		while (j < n && a[j] == a[i]) j++;
		if (j < n) if (++i != j) a[i] = a[j];
	}
	return i+1;
}

int main()
{
	int N, i, r, c, r1, c1, r2, c2;
	long long ans;

	N = in(); xs = ys = 0;
	for (i = 0; i < N; i++) {
		x1[i] = c = in(), y1[i] = r = in();
		x[xs++] = c, y[ys++] = r;
		x2[i] = c = in(), y2[i] = r = in();
		x[xs++] = c, y[ys++] = r;
	}
	qsort(x, xs, sizeof(int), cmp); xs = uniq(x, xs);
	qsort(y, ys, sizeof(int), cmp); ys = uniq(y, ys);

	for (i = 0; i < N; i++) {
		c1 = xbsch(x1[i]), c2 = xbsch(x2[i]);
		r1 = ybsch(y1[i]), r2 = ybsch(y2[i]);

		s[r1][c1]++, s[r1][c2]--;
		s[r2][c1]--, s[r2][c2]++;
	}

	ans = 0;
	for (r = 0; r < ys; r++) for (c = 1; c < xs; c++) s[r][c] += s[r][c-1];
	for (r = 1; r < ys; r++) for (c = 0; c < xs; c++) s[r][c] += s[r-1][c];
	for (r = 0; r < ys; r++) for (c = 0; c < xs; c++) if (s[r][c]) {
		ans += (long long)(x[c+1]-x[c])*(y[r+1]-y[r]);
	}
	printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 33172
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 10000

int main(){
  string s;
  char ans[15] = {};
  int t = 0;
  cin >> s;

  for(int i=0;i<s.size();i++){
    if(s[i]=='0' || s[i]=='1')
      ans[t++] = s[i];
    else
      if(t>0) ans[--t] = '\0';

    cerr << ans << endl;
  }

  printf("%s\n",ans);
  
  return 0;
}


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

#define all(C) C.begin(),C.end()
typedef long long int Long;
typedef long double Double;
const int MAXN = 100 + 5;

int n, a[MAXN];
vector<vector<Long>> v;

void solve(int a, int b, Long mask, vector<Long> &masks) {
  if(a == b) {
    masks.push_back(mask);
    return;
  }

  for(int i = 1; i <= a; ++i)
    solve(a % i, b, mask | (1LL << i), masks);
}

bool canAvoid(Long avoid) {
  for(int i = 0; i < n; ++i) {
    bool can = false;
    for(Long mask : v[i])
      if(!(mask & avoid)) {
        can = true;
        break;
      }
    if(!can)
      return false;
  }
  return true;
}

int main() {
  scanf("%d", &n);
  for(int i = 0; i < n; ++i)
    scanf("%d", a + i);
  for(int i = 0, b; i < n; ++i) {
    scanf("%d", &b);

    if(a[i] == b)
      continue;

    vector<Long> masks;
    solve(a[i], b, 0, masks);

    if(!masks.size())
      return 0 * puts("-1");

    v.emplace_back(masks);
  }
  n = (int) v.size();

  Long ans = 0, avoid = 0;
  for(int i = 50; i >= 1 && n; --i) {
    if(canAvoid(avoid | (1LL << i))) {
      avoid |= (1LL << i);
    } else {
      ans |= 1LL << i;
    }
  }

  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int A = in(),B = in();
    cout << (A%3==0 || B%3==0||(A+B)%3==0 ? "Possible" : "Impossible") << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <queue>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int> ;
using vl = vector<ll>;

int main(){
    string s;
    cin >> s;
    vi vec(3);
    rep(i,s.length()){
        vec[(int)s[i]-'a']++;
    }

    sort(vec.begin(),vec.end(),greater<int>());
    if(vec[0] - vec[2] <= 1){
        cout << "YES" << endl;
    }else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3676
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int               long long
#define ff                first
#define ss                second
#define md                1000000007
#define md1               998244353
#define inf               1000000000000000
#define minf              -1000000000000000
#define pb                push_back
#define in                insert
#define mkp               make_pair
#define mpll              map<ll,ll>
#define len(p)            (ll)p.size()
#define pll               pair<ll,ll>
#define all(v)            v.begin(),v.end()
#define mem(a,t)          memset(a,t,sizeof(a))
#define endl              "\n"
#define ar                array
#define vl                vector<ll>
#define vpll              vector<pair<ll,ll>>
#define f(i,yha,wha)      for(ll i=yha;i<wha;i++)
#define rf(i,wha,yha)     for(ll i=wha;i>=yha;i--)
#define f0(n)             for(ll i=0;i<n;i++)
#define f1(n)             for(ll i=1;i<=n;i++)
#define fg(i,yha,wha,gap) for(ll i=yha;i<wha;i+=gap)


void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


void solve()
{
    string s;
    cin >> s;
    if (s == "ARC")
        cout << "ABC" << endl;
    else
        cout << "ARC" << endl;


}

int32_t main()
{
    flash();
    int t;
    t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3672
def main():
  import sys
  n,k=map(int,input().split())
  a=tuple(map(int,sys.stdin.readline().split()))
  
  def count(arr,now):
    return sum(element<now for element in arr)
  
  ans=0
  prime=10**9+7
  k=k%prime
  for i in range(n):
    left=count(a[:i],a[i])
    right=count(a[i+1:],a[i])
    res=(k-1)*k//2*(right+left)+right*k
    ans+=res%prime
    
  print(ans%prime)

if __name__=="__main__":
  main()

Measured memory_bytes: 3188
use std::str::FromStr;
use std::fmt::Debug;

fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<f64>();

    println!("{}", line[0]/line[1]);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>  // sort, 二分探索, etc
#include <iomanip>  // setprecision (浮動小数点の出力の誤差)
#include <map>
#include <queue>
#include <set>
#include <stack>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a,i##_len=(b);i<i##_len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define cauto const auto&
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SIZE(x) ((ll)(x).size()) // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

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

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

const char newl = '\n';

ll qp(ll a,ll b){ll ans=1;do{if(b&1)ans*=a;a*=a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mod){ll ans=1;do{if(b&1)ans=ans*a%mod;a=a*a%mod;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll comb(int n, int r) {
    vector<vector<ll> > v(n+1, vector<ll>(r+1, 0));
    for(int i=0;i<n+1;i++) {v[i][0]=1; if(i < r+1)v[i][i]=1; }
    for(int i=1;i<n+1;i++) {for(int j=1;j<min(i,r+1);j++) {v[i][j]=v[i-1][j-1]+v[i-1][j];}}
    return v[n][r];
}

// INT_MAX   = 2.1e+09 (2147483647)
// LONG_MAX  = 9.2e+18 (9223372036854775807)
// LLONG_MAX = 9.2e+18 (9223372036854775807)


int main() {
    int s, w;
    cin >> s >> w;
    
    if (w >= s) {
        cout << "unsafe" << newl;
    } else {
        cout << "safe" << newl;
    }


    return 0;
}


Measured memory_bytes: 3104
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define debug(output) cout<<#output<<"= "<<output<<endl

using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=998244353;
//区間加算を行うセグ木
//indexは0~n-1まで
class Seg_Tree{
    private:
    int n;
    vector<int> node;
    public:
    int process(int left,int right){
        if(left==inf)return right;
        if(right==inf)return left;
        int ans=left;
        if(left>right)ans=right;
        return ans;
    }
    Seg_Tree(vector<int> v){
        int num=1;
        int size=v.size();
        while(num<size){
            num*=2;
        }
        n=num;
        node.resize(2*num-1,0);
        for(int i=0;i<size;i++)node[i+num-1]=v[i];
        for(int i=n-2;i>=0;i--)node[i]=process(node[i*2+1],node[i*2+2]);
    }
    int get(int x){
        x+=(n-1);
        int res=node[x];
        while(x>0){
            x=(x-1)/2;
            res+=node[x];
            res%=MOD;
        }
        res+=node[0];
        res%=MOD;
        return res;
    }
    void add(int a,int b,int value,int k=0,int l=0,int r=-1){
        if(r<0)r=n;
        if(a>=r||b<=l)goto FINE;
        if(a<=l&&b>=r){
            node[k]+=value;
            node[k]%=MOD;
            goto FINE;
        }
        add(a,b,value,k*2+1,l,(l+r)/2);
        add(a,b,value,k*2+2,(l+r)/2,r);
        //return process(vl,vr);
        FINE:;
    }
};
signed main(){
  int n,k;cin>>n>>k;
  vector<int> l(k),r(k);
  rep(i,k)cin>>l[i]>>r[i];
  Seg_Tree dp(vector<int>(n*2+10,0));
  dp.add(1,2,1);
  for(int j=1;j<=n;++j){
    rep(i,k){
      dp.add(j+l[i],j+r[i]+1,dp.get(j));
    }
  }
  cout<<dp.get(n)<<"\n";
  rep1(i,n){
    lint hoge=dp.get(i);
    //debug(hoge);
  }
  return 0;
}


Measured memory_bytes: 14528
#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(){
    ll N;
    string data;
    cin >> N;

    vector<string> All(N);
    rep(i, N){
        cin >> data;
        All[i] = data;
    }

    sort(All.begin(), All.end());
    All.erase(unique(All.begin(), All.end()), All.end());
    cout << All.size() << endl;
    return 0;
}

Measured memory_bytes: 9596
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int n, m, v, p;
vector<int> a;

bool judge(int i) {
	if (a[p - 1] > a[i] + m) return false;
	int _v = v;
	_v -= p - 1 + n - i;
	if (_v <= 0) return true;
	int b = a[i] + m;
	vector<int> cnt;
	for (int j = p - 1; j < i; ++j)
			cnt.push_back(b - a[j]);
	if (_v == 1) {
		ll sum = accumulate(cnt.begin(), cnt.end(), 0LL);
		return sum >= m;
	}
	int sz = cnt.size();
	ll tmp = 0;
	for (int j = 0; j <= sz - _v; ++j) tmp += cnt[j];
	tmp += min(tmp * (_v - 1LL), accumulate(cnt.begin() + sz - _v + 1, cnt.end(), 0LL));
	return (tmp / _v) >= m;
}

signed main() {
	cin >> n >> m >> v >> p;
	a.resize(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	// にぶたん
	int ok = p - 1, ng = n;
	while (ok + 1 < n && a[ok + 1] == a[p - 1])
		++ok;
	while (ng - ok > 1) {
		int mid = (ok + ng) / 2;
		if (judge(mid)) ok = mid;
		else ng = mid;
	}
	cout << (ok + 1) << endl;
	return 0;
}


Measured memory_bytes: 1556
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  ll n,m;
  cin>>n>>m;

  map<ll,ll> M;
  ll tmp=0,x;
  M[0]++;
  rep(i,n){
    cin>>x;
    tmp=(tmp+x)%m;
    M[tmp]++;
  }
  
  ll sum=0;
  for(auto y:M){
    if(y.second<2) continue;
    sum+=y.second*(y.second-1)/2;
  }
  cout<<sum<<endl;

  return 0;
}

Measured memory_bytes: 7340
#include<stdio.h>

int main(){
	int w, h, x, y, r;
	scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
	if(x - r >= 0 && x + r <= w && y - r >= 0 && y + r <= h){
		printf("Yes\n");
	}else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1820
// 2013/06/21 Tazoe

#include <iostream>
using namespace std;

int cnt_max;
int C;

void DFS2(int q[10][10], int y, int x, int b, int c)
{
	if(q[y][x]!=b)
		return;

	q[y][x] = c;

	DFS2(q, y, x+1, b, c);
	DFS2(q, y+1, x, b, c);
	DFS2(q, y, x-1, b, c);
	DFS2(q, y-1, x, b, c);
}

void DFS(int n, const int p[10][10], int c)
{
	int q[10][10];
	for(int y=0; y<10; y++){
		for(int x=0; x<10; x++){
			q[y][x] = p[y][x];
		}
	}

	DFS2(q, 1, 1, q[1][1], c);
	
	if(n>=5){
		if(c!=C)
			return;

		DFS2(q, 1, 1, q[1][1], 7);

		int cnt = 0;
		for(int y=0; y<10; y++){
			for(int x=0; x<10; x++){
				if(q[y][x]==7){
					cnt++;
				}
			}
		}

		if(cnt>cnt_max){
			cnt_max = cnt;
		}

		return;
	}

	for(int cc=1; cc<=6; cc++){
		if(q[1][1]==cc)
			continue;

		DFS(n+1, q, cc);
	}
}

int main()
{
	while(true){
		int h, w;
		cin >> h >> w >> C;

		if(h==0&&w==0&&C==0)
			break;

		int p[10][10];
		for(int y=0; y<10; y++){
			for(int x=0; x<10; x++){
				p[y][x] = 0;
			}
		}

		for(int y=1; y<=h; y++){
			for(int x=1; x<=w; x++){
				cin >> p[y][x];
			}
		}

		cnt_max = 0;

		for(int c=1; c<=6; c++){
			if(p[1][1]==c)
				continue;

			DFS(1, p, c);
		}

		cout << cnt_max << endl;
	}

	return 0;
}

Measured memory_bytes: 1164
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")

#pragma GCC optimize("O3")
#pragma GCC target("avx2")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int N;
  cin >> N;
  int r = N % 10;
  if (r == 0) cout << "pon" << endl;
  if (r == 1) cout << "pon" << endl;
  if (r == 2) cout << "hon" << endl;
  if (r == 3) cout << "bon" << endl;
  if (r == 4) cout << "hon" << endl;
  if (r == 5) cout << "hon" << endl;
  if (r == 6) cout << "pon" << endl;
  if (r == 7) cout << "hon" << endl;
  if (r == 8) cout << "pon" << endl;
  if (r == 9) cout << "hon" << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


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

typedef long long ll;

int F1[100002], F2[100002];

int main()
{
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<pair<int, int> > p1, p2;
    for(int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if(i & 1) F1[a]++;
        else F2[a]++;
    }
    for(int i = 1; i <= 100000; i++) {
        p1.push_back({F1[i], i});
        p2.push_back({F2[i], i});
    }
    sort(p1.rbegin(), p1.rend());
    sort(p2.rbegin(), p2.rend());
    if(p1[0].second == p2[0].second) {
        cout << n - max(p1[0].first + p2[1].first, p1[1].first + p2[0].first) << endl;
    }
    else {
        cout << n - (p1[0].first + p2[0].first) << endl;
    }
}


Measured memory_bytes: 2804
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repR(i, n) for(int i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(int i = n; i >= 0; ++i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn int
#define ednl endl
using namespace std;
typedef long long ll;template<typename TypeInt>TypeInt G_C_D(TypeInt a, TypeInt b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename TypeInt>
TypeInt G_C_D(const std::vector<TypeInt> &list){TypeInt a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename TypeInt>TypeInt L_C_M(TypeInt a, TypeInt b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename TypeInt>TypeInt L_C_M(const std::vector<TypeInt> &list){TypeInt a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	int N;
	cin>>N;
	if(N==1){
		cout<<"Hello World"<<endl;
		return 0;
	}
	int A,B;
	cin>>A>>B;
	cout<<A+B<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	while(n!=0) {
		if(n%10==9) {
			cout<<"Yes\n";
			return 0;
		}
		n/=10;
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <functional>
#include <set>
#define DB cerr<<"D"<<endl
#define pb push_back
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";}
using P=pair<int,int>;
const ll M = 1e9+7, mx = 200000;
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; void chmax(ll& x, ll y) {if (x<y) x=y;}; void chmin(ll& x, ll y) {if (x>y) x=y;};

template <typename T>
struct seg_Lp {
  // 区間更新、一点取得
  using F = function<T(T,T)>;
  const F f,g; const T ft; vector<T> lazy; int m, n, n2;
  seg_Lp(int _m, F _f, T _ft) : m(_m), f(_f), ft(_ft) {
    n=1; while(m>n) n<<=1;
    n2=2*n; lazy.resize(n2);
    for(int i=1;i<n2;i++) lazy[i]=ft;
  }

  // 増加
  void update(int k, int a, int b, int v, int l, int r) {
    if (a <= l && r <= b) {lazy[k] = f(lazy[k],v); return;}
    else if (a >= r || b <= l) return;
    else {
      update(2*k, a, b, v, l, (l+r)/2);
      update(2*k+1, a, b, v, (l+r)/2, r);
    }
  }

  // 増加（使用用）
  void update(int a, int b, int v) {
    update(1, a, b, v, 0, n);
  }

  // 合計
  T sum(int k) {
    //int fir = sum[k];
    k+=n;
    int ins = lazy[k];
    while(k>0) {
      k = k / 2;
      ins = f(ins,lazy[k]);
    }
    return ins; 
  }
  void print() {
    for(int i=1,j=0;i<n2;i++) {
      if (i+1 > (1<<j)) {cout<<endl; j++;}
      cout<<lazy[i]<<" ";
    } cout<<endl;
  }
  void print2() {
    for(int i=0;i<m;i++) {
      cout<<sum(i)<<" ";
    } cout<<endl;
  }
};

int main() {
  ll n; cin>>n;
  seg_Lp<ll> sg(n, [](ll x,ll y){return (x+y)%M;}, 0);
  sg.update(0,1,1);

  ll an = 0;
  for(int i=0;i<n;i++) {
    ll nw = sg.sum(i);
    if (i == n-1) {
      // 3 1 1 1 ? -> ? はなんでも良い
      an += nw * n;
      break;
    }
    // 2 1 1 ? -> 1
    //sg.print2();
    sg.update(i+1,i+2,nw);
    //sg.print2();

    // 2 1 1 ? -> (2 ~ n), (2 ~ n...)
    an += nw * (n-1) % M * (n-1) % M;
    //caut(nw*(n-1)*(n-1));

    // 2 1 1 ? -> (2 ~ n), (1,1,1,1)
    sg.update(i+3,n,nw); // 2 1 1 ?
    //an += nw * (i+1);
    an += nw * (i+2) % M;

    if (i == n-2) an -= nw - M; // 右端手前n-1が1なのは計算済み
    //caut(nw*(i+2));
    an %= M;
    //sg.print2();
    //cout<<an<<endl;
  }
  an %= M;
  cout<<an<<endl;
}

Measured memory_bytes: 19532
#include<bits/stdc++.h>
#include <ext/numeric>
#define     __        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define     pi        acos(-1)
#define     ll        long long int
#define     mem(a)    memset(a,0,sizeof(a))
#define     mems(a)   memset(a,-1,sizeof(a))
#define     pii       pair<int,int>
#define     N         200005
using namespace std;

int b[2000];

int main()
{
    int n,ans=111111;

    cin >> n;

    int a[n+5];

    for(int i=0;i<n;i++)
    {
        cin >> a[i];
        if(i>0) b[i]=b[i-1]+a[i];
        else b[i]=a[i];
    }

    for(int i=0;i<n-1;i++)
    {
        int tm=abs(b[i] - (b[n-1]-b[i]));

        if(tm<ans) ans=tm;
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 256