akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

//            0  0  0
// e.g 14 = > 1, 2, 4, 7 => 7-14
//           \ \   \3 -- => 3-6
//            \ \1 ----- => 1-2
//            0 -------- => 0
// 10 edges, n <= 2^4
int main() {
    int L, nbits = 0;
    cin >> L;
    if (L < 50) {
        cout << 2 << " " << L << endl;
        for(int i = 0; i < L; i++)
            cout << "1 2 " << i << endl;
        return 0;
    }
    vector<vector<int>> ans;
    while ((1<<nbits) < L) {
        nbits += 1;
    }
    // cout << nbits << endl;
    int last = nbits-1;
    for(int i = 0; i < nbits-2; i++) {
        ans.push_back({i, i+1, 0});
        ans.push_back({i, i+1, (1<<i)});
    }
    for(int bit = nbits-2; bit >= 0; bit--) {
        while (L-(1<<bit) >= 0) {
            ans.push_back({bit, last, L-(1<<bit)});
            L -= (1<<bit);
        }
    }
    cout << nbits << " " << ans.size() << endl;
    for(auto vec: ans) {
        cout << vec[0]+1 << " " << vec[1]+1 << " " << vec[2] << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define REP(i,b,e) for ( int i = b; i < e; i++)
#define rep(i,n) REP(i,0,n)
static const int MAX = 10;
static const int di[4] = {0, -1, 0, 1};
static const int dj[4] = {1, 0, -1, 0};

int H, W, C, G[MAX][MAX], V[MAX+2][MAX];
int cnt, ans;

void init(){ 
  REP(i, 1, H+1) REP(j, 1, W+1) V[i][j] = 0; 
  cnt = 0;
}

void fillc(int color, int i, int j, int prec){
  G[i][j] = V[i][j] = color;
  cnt++;
  rep(r, 4){
    int ni = i + di[r];
    int nj = j + dj[r];
    if ( G[ni][nj] == prec && !V[ni][nj]) fillc(color, ni, nj, prec);
  }
}

void solve(int d){
  int T[MAX][MAX];
  if ( d == 4 ){
    rep(i, 2){ init(); fillc(C, 1, 1, G[1][1]); }
    ans = max(ans, cnt);
    return;
  }
  
  REP(a, 1, 7) {
    REP(i, 1, H+1) REP(j, 1, W+1) T[i][j] = G[i][j]; 
    init(); fillc(a, 1, 1, G[1][1]);
    solve(d+1);
    REP(i, 1, H+1) REP(j, 1, W+1) G[i][j] = T[i][j];
  }
}

main(){
  while(1){
    cin >> H >> W >> C;
    if ( H == 0 ) break;
    rep(i, H+2) rep(j, W+2) G[i][j] = 0;
    rep(i, H) rep(j, W) cin >> G[i+1][j+1];
    ans = 0;
    solve(0);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1164
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int D = sc.nextInt();
    int N = sc.nextInt();

    sc.close();
    
    if (N != 100) {
      System.out.println(N * (int)Math.pow(100,D));
    } else {
      System.out.println((N + 1) * (int)Math.pow(100,D));
    }
    
  }

}

Measured memory_bytes: 21844
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    vvi C(3, vi(3));
    REP(i, 3)
        REP(j, 3) cin >> C[i][j];

    string ans = "Yes";
    FOR(i,1,3) {
        int d = C[i][0] - C[i - 1][0];
        FOR(j,1,3){
            if (C[i][j] - C[i-1][j] != d){
                ans = "No";
                break;
            }
        }
        if (ans == "No") break;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> bool chmin(T &a, const T &b){ if(a > b){ a = b; return 1; } return 0; }
const ll INF = 0x1fffffffffffffff;

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  for(auto& i : a) cin >> i;
  vector<ll> s(n);
  partial_sum(a.begin(), a.end(), s.begin());
  ll ans = INF;
  for(auto& i : s) chmin(ans, abs((s.back() - i) - i));
  cout << ans << endl;
}

Measured memory_bytes: 3328
def intmod2(n):
    return int(n) % 2

def rankmod2(A):
    global N, M
    ret = 0
    i = 0
    j = 0
    while i < N and j < M:
        if A[i][j]:
            ret += 1
        else:
            for ii in range(i+1, N):
                if A[ii][j]:
                    A[i], A[ii] = A[ii], A[i]
                    ret += 1
                    break
            else:
                j += 1
                continue
                
        for ii in range(i+1, N):
            if A[ii][j]:
                for jj in range(j, M):
                    A[ii][jj] = (A[ii][jj] + A[i][jj]) % 2
        i += 1
        j += 1
        
    return ret
                        
P = 998244353
N, M = map(int, input().split())
A = [list(map(intmod2, input().split())) for _ in range(N)]
r = rankmod2(A)
print((pow(2, N+M-1, P)-pow(2, N+M-r-1, P)) % P)

Measured memory_bytes: 43228
#include<iostream>
#include<string>
#include<algorithm>
#include <map>  
#include <string.h>

using namespace std;




int main()
{

	string l1, l2;
	cin >> l1 >> l2;

	if (l1[0] == l2[2] && l1[1] == l2[1] && l1[2] == l2[0]) {
		cout << "YES" << endl;
		return 0;
	}

	cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
N,K = list(map(int,input().split()))
modZeroCount = N // K
modHalfCount = 0
if K % 2 == 0:
    modHalf = K // 2
    if N % K < modHalf:
        modHalfCount = modZeroCount
    else:
        modHalfCount = modZeroCount + 1
answer = modZeroCount ** 3 + modHalfCount ** 3
print(answer)

Measured memory_bytes: 9020
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main()
{
    long long n,m;
    scanf("%lld%lld",&n,&m);
    {
        long long sun=0;
        if (n==1&&m==1) sun=1;
        else if (n==1||m==1) sun=max(n,m)-2;
        else if (n==2||m==2) sun=0;
        else sun=(n-2)*(m-2);
        printf("%lld\n",sun);
    }
    return 0;
}


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

using ll = long long;

int main() {
    int N, K;
    cin >> N >> K;

    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    vector<ll> cum_best(N, 0),
               cum_black(N, 0);
    for (int i = 0; i < N; i++) {
        if (a[i] >= 0) cum_best[i] = a[i];
        cum_black[i] = a[i];

        if (i > 0) {
            cum_best[i] += cum_best[i - 1];
            cum_black[i] += cum_black[i - 1];
        }
    }

    ll ans = -(1LL << 50);
    for (int i = 0; i + K <= N; i++) {
        ll score = cum_best[N - 1] - cum_best[i + K - 1];
        if (i > 0) score += cum_best[i - 1];

        ll black = cum_black[i + K - 1] - (i > 0 ? cum_black[i - 1] : 0);
        ans = max(ans, max(score, score + black));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
int R=1,C=1,H[2000010],N[2000010],L[1000010];
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return (N[H[a]]<N[H[b]]||N[H[a]]==N[H[b]]&&L[H[a]]>L[H[b]])?1:0;
}
//挿入関数
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
int n,B[500010]={0};
//BITのadd関数
//i番めの数値にnを足す
void badd(int i,int a){for(;i<=n;i+=i&-i)B[i]+=a;}
//BITのsum関数
//1からi番めの数の総和を返す
int  bsum(int i){
  int s=0;
  for(;i;i-=i&-i)s+=B[i];
  return s;
}
int main(){
  int m,i,p[500010],a[500010],r,ans[500050],j;
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  for(i=0;i<=n;i++)p[i]=-1;
  for(i=0;i<m;i++){
    scanf("%d %d",&L[R],&r);
    hin(r);
  }
  for(i=r=0;i<m;i++){
    j=hout();//printf("%d %d\n",L[j],N[j]);
    while(N[j]>r){//printf("p,%d\n",p[a[r]]);
      if(p[a[r]]+1)badd(p[a[r]],-1);//printf("%d\n",r);
      p[a[r]]=r+1;//printf("a\n");
      badd(r+1,1);//printf("r+1,%d\n",r+1);
      //printf("sum %d\n",bsum(r+1));
      r++;
    }
    //printf("N,L,j,%d %d %d\n",bsum(N[j]),bsum(L[j]-1),j);
    ans[j]=bsum(N[j])-bsum(L[j]-1);//printf("ans %d %d %d\n",N[j],L[j],ans[j]);
  }
  for(i=0;i<m;i++)printf("%d\n",ans[i+1]);
  return 0;
}


Measured memory_bytes: 17216
//#include "bits/stdc++.h"

#include <iostream>
#include <vector>
// #include <map>
// #include <string>
#include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

int main() {
	int n, m, value;
	vector<int> vec;
	while (1) {
		cin >> n >> m;
		if (n == 0 and m == 0) {
			break;
		}
		value = 0;
		vec.resize(n);
		for (int i = 0; i < n; i++) {
			cin >> vec[i];
		}
		sort(vec.begin(), vec.end(), greater<int>());
		for (auto itr = vec.begin(); itr < vec.end(); itr++) {
			for (auto itr2 = itr+1; itr2 < vec.end(); itr2++) {
				int tmp = *itr + *itr2;
				if (tmp <= m and value < tmp) {
					value = tmp;
				}
			}
		}
		if (value != 0) {
			cout << value << endl;
		} else {
			cout << "NONE" << endl;
		}
		vec.resize(0);
	}

	// std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve(){
		UL N; cin >> N;
		vector<ULL> A(N); rep(i, N) cin >> A[i];
		reverse(A.begin(), A.end());
		ULL L, R; L = R = 2;
		rep(i, N) {
			ULL a = A[i];
			L = (L - 1) / a * a + a;
			R = R / a * a + (a - 1);
			if (L > R) { cout << -1 << endl; return; }
		}
		cout << L << " " << R << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <map>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <queue>
#include <climits>
using namespace std;


#define MOD 1000000007
using ll = long long;

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


const int sqrtN = 512;

struct SqrtDecomposition {
	int N, K;
	vector<pair<int,int>> data; //内部の値, どのタイミングで変更したか
	vector<pair<int, int>> bucketUpdate;
	SqrtDecomposition(int n) : N(n) {
		K = (N + sqrtN - 1) / sqrtN;
		data.assign(K*sqrtN, make_pair(INT_MAX, 0));
		bucketUpdate.assign(K, make_pair(INT_MAX, 0));
	}

	// [s, t)
	void update(int s, int t, int x, int num) {
		for (int k = 0; k < K; ++k) {
			int l = k * sqrtN, r = (k + 1) *sqrtN;
			if (r <= s || t <= l) continue;
			if (s <= l && r <= t) {
				bucketUpdate[k] = make_pair(x, num);
			}
			else {
				for (int i = max(s, l); i < min(t, r); ++i) {
					data[i] = make_pair(x, num);
				}
			}
		}
	}

	//[x, y)
	int find(int i) {
		int k = i / sqrtN;
		if (data[i].second > bucketUpdate[k].second) return data[i].first;
		else return bucketUpdate[k].first;
	}
};
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, q; cin >> n >> q;
	SqrtDecomposition sd(n);

	for (int i = 0; i < q; ++i) {
		int com; cin >> com;
		if (com == 0) {
			int s, t, x; cin >> s >> t >> x;
			sd.update(s, t+1, x, i+1);
		}
		else {
			int t; cin >> t;
			cout << sd.find(t) << endl;
		}
	}
	int a; cin >> a;
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define ll  long long
#define mp make_pair
#define pb  push_back
#define ALL(_a)   _a.begin(), _a.end()
#define PI acos(-1.0)
#define MAX 200005
#define MOD 1000000007
#define nl '\n'
#define pqmin(x) priority_queue<x, vector<x>, greater<x>>
#define pqmax(x) priority_queue<x>
#define testCase(x) int x; cin>>x; for(int tc=1;tc<=x;tc++)
#define int ll
void c_p_c() {
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
}
//............................................................
//   A'udhu Billaahi min ash-shaitwanir rajeem
//       Bismillah-ir Rahman-ir Raheem
//           Rabbi zidnee 'ilmaa
//............................................................
void solve() {
   int n, k, d, x, c = 0;
   cin >> n >> k;
   int a[n + 5] = {0};
   for (int i = 0; i < k; i++) {
      cin >> d;
      for (int j = 0; j < d; j++) {
         cin >> x;
         a[x] = 1;
      }
   }
   for (int i = 1; i <= n; i++) {
      if (!a[i])c++;
   }
   cout << c << nl;
}
int32_t main() {
   c_p_c();
   //testCase(t)
   solve();
   return 0;
}


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

int main() {
  int n, a, b, sum = 0, out = 0;
  string s;
  cin >> n >> a >> b >> s;
  for(int i = 0; i < n; i++) {
    bool ans = false;
    if(s[i]=='a' and sum < a+b) {
      sum++;
      ans = true;
    }
    if(s[i]=='b' and sum < a+b and out < b) {
      sum++;
      out++;
      ans = true;
    }    
    cout << ( ans ?"Yes" :"No") << "\n";
  }
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

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

    ll a[n], b[n - 1];
    rep(i, 0, n - 1){
        cin >> b[i];
    }

    rep(i, 0, n){
        if(i == 0){
            a[i] = b[i];
        }else if(i == n - 1){
            a[i] = b[i - 1];
        }else{
            a[i] = min(b[i], b[i - 1]);
        }
    }

    ll sum = 0;
    rep(i, 0, n){
        sum += a[i];
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T = ll> constexpr T TEN(int n) {return (n==0)?1:10*TEN<T>(n-1);}

const int MP = 100100;
vector<int> pr;
vector<ull> bpr;

void first() {
    bool used[MP] = {};
    for (int i = 2; i < MP; i++) {
        if (used[i]) continue;
        pr.push_back(i);
        ull x = ((__int128(1)<<64) + i-1 ) / i;
        bpr.push_back(x);
        for (int j = 2*i; j < MP; j += i) {
            used[j] = true;
        }
    }
}

map<ll, int> fact(ll n) {
    int pc = (int)pr.size();
    map<ll, int> mp;
    for (int i = 0; i < pc; i++) {
        ll d = pr[i]; ull rd = bpr[i];
        if (n < d*d) break;
        while (true) {
            ll nd = __int128(n)*rd >> 64;
            if (nd * d != n) break;
            n = nd;
            mp[d]++;
        }
    }
    if (n > 1) mp[n]++;
    return mp;
}


int main() {
    first();
    using F = vector<ll>;
    map<F, F> g;
    map<F, int> a;
    int n;
    scanf("%d", &n);
    bool one = false;
    for (int i = 0; i < n; i++) {
        if (i % 1000 == 0) {
//            cout << i << " " << gc << endl;
        }
        ll s;
        scanf("%lld", &s);
        map<ll, int> fac = fact(s);
        F d0, d1;
        for (auto p: fac) {
            p.second %= 3;
            if (p.second == 1) {
                d0.push_back(p.first);
                d1.push_back(p.first);
                d1.push_back(p.first);
            } else if (p.second == 2) {
                d0.push_back(p.first);
                d0.push_back(p.first);
                d1.push_back(p.first);
            }
        }
        sort(d0.begin(), d0.end());
        sort(d1.begin(), d1.end());
        if (d0.size() == 0) {
            one = true;
            continue;
        }
        g[d0] = d1; g[d1] = d0;
        a[d0]++;
    }

    int ans = 0;
    for (auto p: g) {
        ans += max(a[p.first], a[p.second]);
    }
    cout << ans/2 + (one ? 1 : 0) << endl;
    return 0;
}


Measured memory_bytes: 65792
N, L = map(int, input().split())

r1, rN = L, L + N - 1          # リンゴ1, N
s  = N * L + N * (N - 1) // 2  # 総和
if r1 * rN > 0:                # 同符号
    s -= r1 if r1 > 0 else rN
print(s)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;

struct edge {
    int to, cost;
    edge(){}
    edge(int _to, int _cost) : to(_to), cost(_cost) {}
};
using Graph = vector<vector<edge>>;

void dfs(int now, const Graph& G, vector<bool>& visited) {
    visited[now] = true;
    for (auto e : G[now]) {
        if (!visited[e.to]) dfs(e.to, G, visited);
    }
}

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

    int n, m;
    cin >> n >> m;
    Graph G1(n), G2(n);
    vi a(m), b(m), c(m);
    rep(i, m) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--; b[i]--; c[i] = -c[i];
        G1[a[i]].emplace_back(b[i], c[i]);
        G2[b[i]].emplace_back(a[i], c[i]);
    }

    vector<bool> reachable1(n);
    dfs(0, G1, reachable1);
    vector<bool> reachable2(n);
    dfs(n - 1, G2, reachable2);

    vector<bool> alive(n);
    rep(i, n) {
        alive[i] = reachable1[i] && reachable2[i];
    }

    // printV(reachable1);
    // printV(reachable2);
    // printV(alive);

    Graph G(n);
    rep(i, m) {
        if (alive[a[i]] && alive[b[i]]) {
            G[a[i]].emplace_back(b[i], c[i]);
        }
    }

    vi d(n, inf);
    d[0] = 0;
    rep(i, n - 1) {
        rep(j, n) {
            for (auto e : G[j]) {
                if (d[e.to] > d[j] + e.cost) {
                    d[e.to] = d[j] + e.cost;
                }
            }
        }
    }

    rep(j, n) {
        for (auto e : G[j]) {
            if (d[e.to] > d[j] + e.cost) {
                cout << "inf" << endl;
                return 0;
            }
        }
    }

    cout << -d[n-1] << endl;

}


Measured memory_bytes: 512
//============================================================================
// Name        : PapaCoder.cpp
// Author      : Tohru Fujii
// Version     :
// Copyright   : Oredayo
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,P> P2;
const ll INF=100000000000000001;
ll a[51]={};
int n;

int main() {

	cin>>n;
	int mmin=1;
	int mmax=1;
	for(int i=1;i<n+1;++i){
		cin>>a[i];
		if(a[mmin]>a[i])mmin=i;
		if(a[mmax]<a[i])mmax=i;
	}

	int fp=0;
	int d=0;
	if((a[mmax]+a[mmin])>0){
		d=1;
		fp=mmax;
	}else{
		d=0;
		fp=mmin;
	}
	if(d==1){
		cout<<2*n-1<<endl;
		cout<<fp<<" "<<2<<endl;
		cout<<fp<<" "<<2<<endl;
		cout<<fp<<" "<<2<<endl;
		for(int i=2;i<n;++i){
			cout<<i<<" "<<i+1<<endl;
			cout<<i<<" "<<i+1<<endl;
		}
	}
	if(d==0){
		cout<<2*n-1<<endl;
		cout<<fp<<" "<<n-1<<endl;
		cout<<fp<<" "<<n-1<<endl;
		cout<<fp<<" "<<n-1<<endl;
		for(int i=n-1;i>1;--i){
			cout<<i<<" "<<i-1<<endl;
			cout<<i<<" "<<i-1<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
import sys
from math import ceil, floor

input = sys.stdin.readline


def main():
    n = int(input())
    x = n / 1.08
    if n == floor(ceil(x) * 1.08):
        print(ceil(x))
    elif n == floor(floor(x) * 1.08):
        print(floor(x))
    else:
        print(":(")


if __name__ == "__main__":
    main()


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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



void func(long long N, std::vector<long long> A){

    lli ans = 0;
    REP(i,1,N){
        if(A[i-1]>A[i]){
            ans += abs(A[i-1]-A[i]);
            A[i] = A[i-1];
        }
    }
    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    func(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4848
// Goods things are coming, just keep believing 
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
 
#define FOR(i, x, n) for(ll i = x; i < n; i++) 
#define pb push_back
#define pf push_front
#define ll long long
#define hii cout << "hii" << endl
#define okay cout << "okay" << endl
// #define hey cout << "hey" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mpp make_pair
#define endl '\n'
#define ff first 
#define int long long
#define ss second
#define vi vector<int>
#define all(s) s.begin(), s.end()
#define si size()
 #define ld long double
#define INF 1000000000;
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
 
 
 
const int N = 3e5 + 10;
const int LG = 20;
const int MOD = 1e9 + 7;
 
int arr[N];
int X[N];
int V[N];
vector<pair<int, int>> v;
 
struct BIT
{
	int N;
	vector<int> bit;
 
	void init(int n)
	{
		N = n;
		bit.assign(n + 1, 0);
	}
 
	void update(int idx, int val)
	{
		while(idx <= N)
		{
			bit[idx] += val;
			idx += idx & -idx;
		}
	}
 
	void updateMax(int idx, int val)
	{
		while(idx <= N)
		{
			bit[idx] = max(bit[idx], val);
			idx += idx & -idx;
		}
	}
 
	int pref(int idx)
	{
		int ans = 0;
		while(idx > 0)
		{
			ans += bit[idx];
			idx -= idx & -idx;
		}
		return ans;
	}
 
	int rsum(int l, int r)
	{
		return pref(r) - pref(l - 1);
	}
 
	int prefMax(int idx)
	{
		int ans = -2e9;
		while(idx > 0)
		{
			ans = max(ans, bit[idx]);
			idx -= idx & -idx;
		}
		return ans;
	}
};
 
 
void solve()
{
	int n;
	cin >> n;
	cout << (n + 1) / 2 << endl;
}
 
int32_t main() 
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
    int t;
    t = 1;
    // cin >> t;
    while(t--)
    	solve();
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};

fn main() {
    input! {
        n: usize,
        init: i32,
        xs: [i32; n],
    }
    let xs = {
        let mut xs: Vec<_> = xs.iter().map(|x| x - init ).collect();
        xs.push(0);
        xs.sort();
        xs
    };
    let zero = xs.iter().position(|x| *x == 0).unwrap();
    let min_d = xs.windows(2).map(|w| w[1] - w[0]).min().unwrap();
    for d in (1..min_d + 1).rev() {
        if xs.iter().all(|x| x % d == 0) {
            println!("{}", d);
            return;
        }
    }
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
    using namespace std;
    #define IOS                           \
        ios_base::sync_with_stdio(false); \
        cin.tie(NULL);                    \
        cout.tie(NULL);
    #define int long long
    #define pi pair<int, int>
    #define ff first
    #define ss second
    #define pb push_back
    #define mod 1000000007
    #define vi vector<int>

    int32_t main()
    {
        IOS;
        int n,k; cin>>n>>k;
        vi a(n);
        for(int i=0;i<n;i++) cin>>a[i];
        sort(a.begin(),a.end());
        int res = 1;
    
        if(k&1){
            if(a[n-1] == 0) res = 0;
            else if(a[n-1] < 0){
                for(int i=n-1;i>n-k-1;i--){
                    res = res * a[i];
                    res %= mod;
                }
            }
            else{
                res = res * a[n-1];
                res %= mod;
                n--;
                k--;
            }
        }
        
        if(k%2 == 0){
            k/=2;
            int i=0,j=n-1;
            while(k--){
                int x = a[i] * a[i+1];
                int y = a[j] * a[j-1];
                if(x >= y){
                    res = res * (x%mod);
                    i+=2;
                }
                else{
                    res = res * (y%mod);
                    j-=2;
                }
                res %= mod;
            }
        }
    if(res<0) res = mod + res;
        cout<<res<<endl;
    }

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

using namespace std;

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.14159265;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,n,r) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(x) x.begin(),x.end()
#define CALL(x) x.cbegin(),x.cend()
#define RALL(x) x.rbegin(),x.rend()
#define CRALL(x) x.crbegin(),x.crend()

#define cout cout << setprecision(12)

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void dbg(T a) { cout << a << ' '; }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
//double d;
string s;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> n;
  long double d = (double)n / 3.0;

    cout << d * d * d << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e7;
#define ll long long
#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)

class comp {

public:
    bool operator()(pair<int, int> a,
                    pair<int, int> b)
    {
        if(a.first!=b.first)
        return a.first>b.first;
    }
};
int main()
{
 
    ll n;
    cin>>n;
    if(n==0)
        cout<<1<<endl;
    else
        cout<<0<<endl;
    
    //getch();
    return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long int64;
constexpr int p = 1e9+7;
constexpr long long M = 0x777777777777777777777777777777777777777LL;

int N;
int a[24];
int dp[1024*1024*4];

vector<int> V;
void combi(int cnt, int taboo=-1, int it=0, int v=0) {
    if(cnt==0) {
        V.emplace_back(v);
    }
    else for(int i=it; i<N; ++i) if(i!=taboo) {
        combi(cnt-1, taboo, i+1, v | (1<<i));
    }
}

int main() {
	scanf("%d", &N);
    dp[0] = 1;
    for(int n=0; n<N; ++n) {
        for(int n2=0; n2<N; ++n2) {
            int a;
            scanf("%d", &a);
            if(a) {
                V.clear();
                combi(n, n2);
                for(int v : V) {
                    int i = (v|(1<<n2));
                    int sum = dp[i] + dp[v];
                    if(p<=sum) sum-=p;
                    dp[i] = sum;
                }
            }
        }
    }
    printf("%lld\n", dp[(1<<N)-1]);
	return 0;
}


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

using namespace std;

using ll = long long;

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

    vector<string> v(n);
    for(auto &e: v) cin >> e;
    map<string,ll> cnt;

    for(auto &e: v) cnt[e]++;

    ll m = 0;
    for(auto &t: cnt) m = max(m, t.second);

    vector<string> r;
    for(auto &t: cnt)
        if(t.second == m) r.push_back(t.first);
    sort(r.begin(), r.end());

    for(auto &e: r) cout << e << endl;
}


Measured memory_bytes: 28404
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int main(void)
{
	int x;
	int i = 1;

	scanf("%d", &x);

	while (x != 0) {
		printf("Case %d: %d\n", i, x);
		i++;
		scanf("%d", &x);
	}

	return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		boolean flag=false;
		for(int i=0;i<=25;i++) {
			for(int j=0;j<=14;j++) {
				int a=7*j+i*4;
				if(N==a) {
					flag=true;
				}
			}
		}
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}
}

Measured memory_bytes: 22228
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <limits>

using namespace std;

using i64 = long long int;
using P = pair<i64, i64>;

struct edge {
    i64 from, to, cost;
    edge(i64 from, i64 to) : from(from), to(to), cost(1) {}
    edge(i64 from, i64 to, i64 cost) : from(from), to(to), cost(cost) {}
};
using Graph = vector<vector<edge>>;

constexpr i64 SINF = std::numeric_limits<i64>::max() / 10;
const i64 MOD = 1000000007;
const i64 dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
//const i64 dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//const i64 dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//const i64 dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main() {
    i64 w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << (double)(w * h) / 2.0 << " ";
    bool flag = true;
    if (w % 2 == 0 && h % 2 == 0 && w / 2 == x && h / 2 == y) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }
 }

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}


int main(void){
  int n;
  float v[1005];
  
  scanf("%d", &n);
  for(int i=0;i<n;i++){
    scanf("%f", &v[i]);
  }
   qsort(v, n, sizeof(int), compare_int);
  for(int i=0;i<n-1;i++){
    float x = v[i];
    float y= v[i+1];
    v[i+1]= (x+y)/2;
  }
  printf("%f", v[n-1]);
  return 0;
}

Measured memory_bytes: 1716
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class Registration
{
    static void Main(string[] args)
    {
        var first = Console.ReadLine();
        var second = Console.ReadLine();

        for(var i = 0; i < first.Length; i++)
        {
            if(first[i] != second[i])
            {
                Console.WriteLine("No");
                return;
            }
        }

        Console.WriteLine("Yes");
        
    }
}

Measured memory_bytes: 25784
N=int(input())
dp=[float('inf') for i in range(N+1)]
l=[int(x) for x in input().rstrip().split()]
dp[0]=0
dp
for i in range(1,N):
    if i==1:
        dp[i]=dp[i-1]+abs(l[i]-l[i-1])
    else:
        dp[i]=min(dp[i-1]+abs(l[i]-l[i-1]),dp[i-2]+abs(l[i]-l[i-2]))

print(dp[N-1])



Measured memory_bytes: 17464
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn msd(mut x: usize) -> usize {
    while x >= 10 {
        x /= 10;
    }
    x
}

fn main() {
    let N = read!(usize);

    let mut map = vec![vec![0; 10]; 10];
    for x in 1..N + 1 {
        map[x % 10][msd(x)] += 1;
    }

    let mut total = 0;
    for first in 1..10 {
        for last in 1..10 {
            total += map[first][last] * map[last][first];
        }
    }
    println!("{}", total)
}


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





int main() {
  
  int64_t s,c;
  cin>>s>>c;
  
  
  
  if (c<2*s){
    cout<<c/2;
  }
  
  else {
    cout<<(s+(c-2*s)/4)<<endl;
  }
  
    
  
  
}












Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;

int main(){
   int H,W,K;
   cin >> H >> W >> K;
   int ans = 0;
   string M[H];
   for(int i = 0 ; i < H; i++){
      cin >> M[i];
   }
   for(int i = 0 ; i < (1<<H); i++){
      for(int j = 0 ; j < (1<<W); j++){
         int cnt = 0;
         for(int x=0;x < H; x++){
            for(int y = 0 ; y < W; y++){
               if((i&(1<<x))==0&&(j&(1<<y))==0){
                  if(M[x][y]=='#'){
                     cnt ++;
                  }
               }
            }
         }
         if(cnt == K) ans ++;
      }
   }
   cout << ans << endl;
   return 0;
}


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

#define ll long long 
#define mkp make_pair 
#define fi first 
#define se second

using namespace std ;

int z , e , q , k;

int main ( ) {
	
	int a , b , c; 
	cin >> a >> b >> c ;
	if( ( a == b && c != b ) || ( b == c && a != b ) || ( a == c && b != c )){
		cout << "Yes" << endl ;
	}
	else{
		cout << "No" << endl ;	 
	}

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int inputN = sc.nextInt();		
		int inputH = sc.nextInt();
		
		int count = 1;
		int highest = inputH;
		
		for(int i = 0 ; i < inputN -1 ; i++) {
			inputH = sc.nextInt();
			if(inputH >= highest) {
				count++;
				highest = inputH;
			}
		}
		sc.close();
		System.out.println(count);
		
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int n;
    cin>>n;
    vi h={2, 4, 5, 7, 9}, p={0, 1, 6, 8};
    for(int i = 0; i < 5; i++){
        if(n%10==h[i]){
            cout<<"hon";
            return;
        }
    }
    for(int i = 0; i < 4; i++){
        if(n%10==p[i]){
            cout<<"pon";
            return;
        }
    }
    cout<<"bon";
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}   

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

int main() {
    int x, y, z, cnt=0;
    cin >> x >> y >> z;
    while(x >= z) {
        x -= y + z;
        if (x >= z) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int INF=1e9;
const int MOD=1e9+7;
const double pi=acos(-1);

int main(){
  int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout<<a[k-1]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int A[N][N];
    int B[N][N];

    rep(i, N) {
        rep(j, N) {
            cin >> A[i][j];
            B[i][j] = A[i][j];
        }
    }

    rep(k, N) rep(i, N) rep(j, N) 
        B[i][j] = min(B[i][j], B[i][k] + B[k][j]);

    ll ans = 0;
    rep(i, N) {
        rep(j, N) {
            ans += B[i][j];
            if (A[i][j] > B[i][j]) {
                cout << "-1" << endl;
                return 0;
            }
        }
    }

    rep(i, N){
        rep(j, N) {
            rep(k, N) {
                if (i != k && k != j && B[i][j] == B[i][k] + B[k][j] ){
                    ans -= B[i][j];
                    break;
                }
            }
        }
    }
    cout << ans/2 << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
  int n;
  cin >> n;
  vector<ll> t(n);
  REP(i, n) cin >> t[i];
  ll ans = 1ll;
  REP(i, n) ans = lcm(ans, t[i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int a;
        cin >> a;
        if (mp[a] == 1) {
            cout << "NO" << endl;
            return 0;
        }
        mp[a]++;
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 9600
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000007;
constexpr int INF = 2000000000;
using namespace std;

int main() {
	int N, W;
	int v[100], w[100];
	int dp[101][10001];
	cin >> N >> W;
	for (int i = 0; i < N; i++) {
		cin >> v[i] >> w[i];
	}
	for (int i = 0; i < 101; i++)for (int j = 0; j < 10001; j++)dp[i][j] = -1;
	dp[0][0] = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= W; j++) {
			if (0 <= dp[i][j]) {
				dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
				if (j + w[i] <= W) {
					dp[i + 1][j + w[i]] = max(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
				}
			}
		}
	}
	int ans = -1;
	for (int i = 0; i <= W;i++)ans = max(ans, dp[N][i]);
	cout << ans << endl;
}

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

int main() {
  	int N;
	string s;
  	cin >> N >> s;
  
  	vector<int> vec(1,0);
  	int x = 0;
  
  	for(int i = 0; i < N; i++) {
      
      	if(s.at(i) == 'I') {
        	x++;
        }else {
        	x--;
        }
      
      	vec.push_back(x);
       }
  
  	sort(vec.begin(),vec.end());
  
  	cout << vec.at(N) << endl;
}

Measured memory_bytes: 256