akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  sort(all(a));
  if(n==3){cout<<max(2*a[2]-a[0]-a[1],a[2]+a[1]-2*a[0])<<endl;return 0;}
  if(n==2){cout<<a[1]-a[0]<<endl;return 0;}
  rep(i,n-1)a[i+1]+=a[i];
  ll res=0;
  if(n&1)
  {

    ll l=a[n/2-1],h=a[n-1]-l;
    res=(h-l)*2-(a[n/2+1]-a[n/2-1]);
    l=a[n/2],h=a[n-1]-l;
    chmax(res,(h-l)*2+a[n/2]-a[n/2-2]);
  }
  else
  {
    ll l=a[n/2-1],h=a[n-1]-l;
    res=(h-l)*2+a[n/2-1]-a[n/2-2]-(a[n/2]-a[n/2-1]);
  }
  cout<<res<<endl;
  return 0;

}


Measured memory_bytes: 1024
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

int main()
{
    int n, k;
    std::cin >> n >> k;

    std::vector<long long> v(n);
    for (int i = 0; i < n; i++) {
        std::cin >> v[i];
    }

    long long ans = std::numeric_limits<long long>::max();

    for (int i = 0; i < n - k + 1; i++) {
        ans = std::min(ans, std::abs(v[i]) + std::abs(v[i] - v[i + k - 1]));
    }

    for (int i = n - 1; i >= k - 1; i--) {
        ans = std::min(ans, std::abs(v[i]) + std::abs(v[i] - v[i - k + 1]));
    }

    std::cout << ans << std::endl;
}


Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        long[] num = cin.ArrayLong(N);
        Array.Sort(num);
        Array.Reverse(num);

        Dictionary<long, int> dic = new Dictionary<long, int>();
        foreach (var item in num)
        {
            if (!dic.ContainsKey(item)) dic[item] = 0;
            dic[item]++;
        }

        int ans = 0;

        foreach (var A in num)
        {
            if (dic[A] == 0) continue;
            dic[A]--;
            long T = 1;
            while (T <= A) T *= 2;

            long B = T - A;

            if(dic.ContainsKey(B) && dic[B] >= 1)
            {
                dic[B]--;
                ans++;
            }
        }

        Console.WriteLine(ans);
    }
    
}




class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}



Measured memory_bytes: 48572
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

void solve() {
    int a, b, p, m, x;
    cin >> a >> b;
    p = a + b;
    m = a - b;
    x = a * b;
    int res;
    res = max(max(p,m),x);
    cout << res << endl;
}

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

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  char a[51],b[51];
  scanf("%s %s",a,b);
  int n=strlen(a),m=strlen(b);
  for(int i=0;i<n;i++){
    printf("%c",a[i]);
    if(i==m)continue;
    printf("%c",b[i]);
  }
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;


int main(){
  int n, m;
  cin >> n >> m;
  vector<int> p(m), y(m);
  rep(i, m) cin >> p[i] >> y[i];
  vector<vector<int>> ids(n + 1);
  rep(i, m) ids[p[i]].push_back(y[i]);
  rep(i, n + 1) sort(ids[i].begin(), ids[i].end());

  rep(i, m){
    int pref = p[i];
    printf("%06d", pref);
    int id = lower_bound(ids[pref].begin(), ids[pref].end(), y[i]) - ids[pref].begin();
    printf("%06d\n", id + 1);
  }
  
}


Measured memory_bytes: 7808
using System;
using System.Linq;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            while ((line = Console.ReadLine()) != null)
            {
                var n = line.Split(' ').Select(decimal.Parse).ToArray();
                Console.WriteLine((n[0] - n[2]) * (n[4] - n[6]) + (n[1] - n[3]) * (n[5] - n[7]) == 0 ? "YES" : "NO");
            }
        }
    }
}

Measured memory_bytes: 6200
n,m=map(int,input().split())
h=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(m)]
r=[0]*n
q=[0]*n
for i in range(m):
  r[l[i][0]-1]+=1
  r[l[i][1]-1]+=1
  if h[l[i][0]-1]>h[l[i][1]-1]:
    q[l[i][0]-1]+=1
  elif h[l[i][0]-1]<h[l[i][1]-1]:
    q[l[i][1]-1]+=1
cnt=0
for i in range(n):
  if r[i]!=0:
    if r[i]==q[i]:
      cnt+=1
  if r[i]==0:
    cnt+=1
print(cnt)

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

using ll = long long;
#define REP(i, n) for(int (i)=0; (i)< (n); ++i)
#define REPR(i, n) for(int (i)=(n); (i)>=0; --i)
#define FOR(i, n, m) for(int (i)=(n); (i)<(m); ++i)
constexpr int INF = 1e9;
//constexpr ll INF = 1LL << 62;
constexpr ll mod = 1e9+7;

long long modpow(long long a, long long n) {
      long long res = 1;
          while (n > 0) {
                    if (n & 1) res = res * a % mod;
                            a = a * a % mod;
                                    n >>= 1;
                                        }
                                            return res;
}

ll N, K;
ll ans = 0;
int main(){
  cin >> N >> K;
  vector<ll> memo(K+1, 0);
  for(int i = K; i > 0; i--){
    ll cnt = 0;
    ll diff = 0;
    for(int b = 1; i*b <= K; b++){
      int x = b*i;
      cnt++;
      diff += memo[x];
      diff %= mod;
      ans -= (memo[x]*i);
      ans %= mod;
      while(ans < 0) ans += mod;
    }
    ll add = (modpow(cnt, N)) % mod;
    ans += (add * i) % mod;
    ans %= mod;
    ll m = (add-diff) % mod;
    if(m < 0) m += mod;
    memo[i] = m;
  }
  cout << ans % mod<< endl;
  return 0;
}


Measured memory_bytes: 4052
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <string>
#include <iostream>
using namespace std;
const int lenc = 500 + 5 , lenab = 10000 + 5;
const int mod = 1000000007;
struct TrieNode{
	int flag , fail , next[10];
}T[lenc];
int f[lenab][lenc][2];
int c[lenab][lenc][2];
char sa[lenab] , sb[lenab] , sc[lenc];
//int kmps[lenc];
int root = 1;
int tT = 1;
void trieInsert(char *numc)
{
	int len = strlen(numc);
	int p = root;
	for (int i = 0 ; i < len ; i++)
	{
		if (T[p].next[numc[i] - '0'] == 0)
			T[p].next[numc[i] - '0'] = ++tT;
		p = T[p].next[numc[i] - '0'];
	}
	T[p].flag = 1;
}
void trieBuild()
{
	int u , v;
	queue<int>Q;
	T[root].fail = 0;
	Q.push(root);
	while (!Q.empty())
	{
		u = Q.front();
		Q.pop();
		for (int i = 0 ; i < 10 ; i++)
		{
			if (T[u].next[i])
			{
				if (u == root)
				{
					T[T[u].next[i]].fail = root;
				}else
				{
					v = T[u].fail;
					while(v)
					{
						if (T[v].next[i])
						{
							T[T[u].next[i]].fail = T[v].next[i];
							break;
						}
						v = T[v].fail;
					}
					if (!v)
						T[T[u].next[i]].fail = root;
				}
				Q.push(T[u].next[i]);
			}
		}
	}
}
int matchAndDp(char *N , bool flag)
{
	int len = strlen(N)  , v;
	memset(f , 0 , sizeof(f));
	memset(c , 0 , sizeof(c));
	f[0][tT][1] = 1;
	for (int i = 0 ; i < len ; i++)
	{
		for (int j = 1 ; j <= tT ; j++)
		{
			for (int k = 0 ; k < 10 ; k++)
			{
				v = j;
				while (v != root && T[v].next[k] == 0)
					v = T[v].fail;
				v = T[v].next[k];
				if (v == 0)
					v = root;
				if (k < N[i] - '0')
				{
					(f[i + 1][v][0] += (f[i][j][0] + f[i][j][1])%mod)%=mod;
					(c[i + 1][v][0] += (c[i][j][0] + c[i][j][1])%mod)%=mod;
					if (T[v].flag)
						(c[i + 1][v][0] += (f[i][j][0] + f[i][j][1]) % mod) %= mod;
				}
				else if (k == N[i] - '0')
				{
					(f[i + 1][v][0] += f[i][j][0]) %= mod;
					(f[i + 1][v][1] += f[i][j][1]) %= mod;
					(c[i + 1][v][0] += c[i][j][0]) %= mod;
					(c[i + 1][v][1] += c[i][j][1]) %= mod;
					if (T[v].flag)
					{
						(c[i + 1][v][0] += f[i][j][0]) %= mod;
						(c[i + 1][v][1] += f[i][j][1]) %= mod;
					}
				}else if (k > N[i] - '0')
				{
					(f[i + 1][v][0] += f[i][j][0]) %= mod;
					(c[i + 1][v][0] += c[i][j][0]) %= mod;
					if (T[v].flag)
					{
						(c[i + 1][v][0] += f[i][j][0]) %= mod;
					}
				}
			}
		}
	}
	int ans = 0;
	for (int i = 1 ; i <= tT ; i++)
		(ans += (c[len][i][0] + c[len][i][1]) % mod) %= mod;
	return ans;
}
int matchs1(char *N , char *mask)
{
	string s1(N);
	string s2(mask);
	int ans = 0;
	int lastfind = s1.find(s2 , 0);
	while (lastfind != string::npos)
	{
//		cerr << lastfind << endl;
		ans++;
		lastfind = s1.find(s2 , lastfind + 1);
	}
	return ans;
}
int main()
{
	scanf("%s%s%s" , sa , sb , sc);
	trieInsert(sc);
	trieBuild();
	tT++;
	T[tT].next[0] = tT;
	T[tT].fail = root;
	for (int i = 1 ; i <= 9 ; i++)
		T[tT].next[i] = T[root].next[i];
	int ans1(0) , ans2(0);
	ans1 = matchAndDp(sa , 1) - matchs1(sa , sc);
	ans2 = matchAndDp(sb , 1);
//	printf("%lld %lld\n" , ans1 , ans2);
	printf("%d\n" , ((ans2 - ans1) % mod + mod) % mod);
	return 0;
}

Measured memory_bytes: 80224
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

x = ni()
if x == 1:
    print("Hello World")
else:
    a = ni()
    b = ni()
    print(a+b)


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int N;
    cin >> N;

    vvi d(N, vi(N));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> d[i][j];
            if (i == j) assert(!d[i][j]);
        }
    }

    ll total = 0;

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (i == j) continue;

            bool need = true;
            for (int k = 0; k < N; k++) {
                if (i == k || k == j) continue;

                if (d[i][k] + d[k][j] < d[i][j]) {
                    cout << -1 << endl;
                    return 0;
                } else if(d[i][k] + d[k][j] == d[i][j]) {
                    need = false;
                }
            }
            if (need) total += d[i][j];
        }
    }

    cout << total / 2 << endl;

    return 0;
}



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

a = 0
b = 0
h = sum(w)/2

for i in range(n):
    a += w[i]
    if a > h :
        b = a - w[i]
        break
print(min(int(abs(h-a)*2), int(abs(h-b)*2)))

Measured memory_bytes: 3064
import math
D, G = map(int, input().split())

P = []
C = []
for i in range(D):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)

answer = sum(P)
for i in range(2**D):
    point = 0
    x = -1
    now_answer = 0
    for j in range(D):
        if i >> j & 1:
            point += P[j] * (j+1) * 100 + C[j]
            now_answer += P[j]
        else:
            x = j

    if G <= point:
        answer = min(now_answer, answer)
    else:
        n = math.ceil((G - point) / ((x+1) * 100))
        if n < P[x]:
            now_answer += n
            answer = min(now_answer, answer)

print(answer)

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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using plglg = pair<ll, ll>;
using tlglglg = tuple<ll, ll, ll>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
inline void yesno(bool ok, string yes = "Yes", string no = "No") {cout << (ok?yes:no) << endl;}


signed main() {
    //my-code
    ll k; cin >> k;
    ll md = 7 % k;
    ll ans = 1;
    while (md != 0) {
        md = (md*10+7) % k;
        ans++;
        if (ans > k*2) {
            break;
        }
    }
    if (ans > k*2) {
        print(-1);
    } else {
        print(ans);
    }

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3644
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <utility>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <cctype>

using namespace std;
//コイン払い方
int main() {
 
	long long int N,Y;
  	cin >> N >> Y;
  	Y=Y/1000;
   bool tt=0;
	for(long long int i=0;i<N+1;i++){
		for(long long int j=0;j<N+1-i;j++){
          if(i*1+j*5+(N-i-j)*10==Y){
          	cout << N-i-j << " " << j <<" "<<i<< endl;
            tt=true;
            goto kkk;
          }
        }
    }
   kkk:
   if(!tt){
   cout <<"-1 -1 -1"<< endl;
   }
}


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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int i=0; i<n; i++)
#define FOR1(i, n) for(int i=1; i<=n; i++)
#define FORI(i, n) for(int i=n-1; i>=0; i--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1)/x * t << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
#include<cassert>
#include<array>
#define ll long long
#define endl "\n"
#define pb push_back
#define READ(FILE) freopen(FILE,"r",stdin)
#define WRITE(FILE) freopen(FILE,"w",stdout)
#define loop(i,s,e) for(int i=s;i<e;i++)
#define mego fast();
using namespace std;
void fast()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

ll lcm(ll x, ll y)
{
    return (x*y)/__gcd(x,y);
}
/*const int N=500000;
ll seg[4*N];
ll arr[N+5];
void bulid(int s,int e,int p)
{
    if(s==e)
    {
         seg[p]=arr[s];
         return;
    }
    bulid(s,(s+e)/2,2*p);
    bulid((s+e)/2 +1,e,2*p +1);
    seg[p]=__gcd(seg[2*p],seg[2*p +1]);
    return;
}
void seti(int s,int e,int p,int i,int v)
{
    if(s==e && s==i)
    {
         seg[p]=arr[i]=v;
         return;
    }
    if(i >(s+e)/2)
    seti((s+e)/2 +1,e,2*p +1,i,v);
    else seti(s,(s+e)/2,2*p,i,v);
    seg[p]=__gcd(seg[2*p],seg[2*p +1]);
    return;
}
int flr(int s,int e,int p,int l,int r)
{
    if(l<=s&&e<=r)return seg[p];
    if(s>r || e<l)return 0;
    return __gcd(flr(s,(s+e)/2,2*p,l,r),flr((s+e)/2+1 ,e ,2*p +1 ,l,r));
}
*/
int main()
{
    mego
int n,x;
cin>>n;
vector<int> v;
loop(i,0,n)
{
    cin>>x;
    v.pb(x);
}

ll cur=(1000);
loop(i,0,n-1)
{
    ll s=(cur/v[i]);
if(v[i+1]>v[i])
    cur+=(v[i+1]-v[i])*s;
   }
cout<<cur;
   return 0;
}


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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<int, int> ii;

const int mod = 1e9 + 7;

const int inf = 1e9;

int add(int x, int y) {
    return (1ll * x + 1ll * y) % mod;
}

int del(int x, int y) {
    return ((1ll * x - 1ll * y) % mod + mod) % mod;
}

int mul(int x, int y) {
    return (1ll * x * 1ll * y) % mod;
}

int k, x;

int main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> k >> x;
    for(int i = max(x - k + 1, -1000000); i <= min(x + k - 1, 1000000); i++) {
        cout << i << " ";
    }
}




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

#define INFTY 1000000000
void rge(int*,int,int,int);
void rgesort(int*,int,int);
signed long long count=0;
int main(){

  int i,n,left,right;

  scanf("%d",&n);
  int A[n];
  left = 0;
  right = n;
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  rgesort(A,left,right);

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

void rge(int *A,int left,int mid,int right){
  int n1,n2,i,j,k,t=0;
  n1 = mid - left;
  n2 = right - mid;
  int L[n1];
  int R[n2];
  for(i=0;i<=n1-1;i++){
    L[i] = A[left+i];
  }
  for(i=0;i<=n2-1;i++){
    R[i] = A[mid+i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i=0;
  j=0;
  for(k=left;k<=right-1;k++){
    if(L[i]<= R[j]){
      count += t;
      A[k] = L[i];
      i=i+1;
    }
    else{
      t++;
      A[k]=R[j];
      j=j+1;
    }
  }
}
void rgesort(int *A,int left,int right){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    rgesort(A, left, mid);
    rgesort(A, mid, right);
    rge(A, left, mid, right);
  }
}



Measured memory_bytes: 3324
#include <bits/stdc++.h>
using namespace std;
const int MAXN=100000+5;
int n,h[MAXN],dp[MAXN];

int main(){
	cin>>n;
	cin>>h[1];
	for(int i=2;i<=n;++i){
		cin>>h[i];
		dp[i]=dp[i-1]+abs(h[i-1]-h[i]);
		if(i>2 && dp[i-2]+abs(h[i-2]-h[i])<dp[i]) dp[i]=dp[i-2]+abs(h[i-2]-h[i]); 
	}
	cout<<dp[n]<<endl;
	return 0;
}

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

using namespace std;

int odd(int n)
{
    return n * 3 + 1;
}

int eva(int n)
{
    return n / 2;
}

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

    vector<int> list;
    list.emplace_back(s);
    int count = 2;
    for (;;)
    {
        if (s % 2)
        {
            s = odd(s);
        }
        else
        {
            s = eva(s);
        }
        for (int num : list)
        {
            if (num == s)
            {
                cout << count << endl;
                return 0;
            }
        }
        list.emplace_back(s);
        count++;
    }
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,k; cin >> n >> k;
	double ans=0;
	for(int i=1;i<=n;i++){
		int p=0;
		while(pow(2,p)*i<k)p++;
		ans+=((double)1/(n*pow(2,p)));
	}
	printf("%.9f\n",ans);
}

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

int main(){
  ll n,m;
  cin>>n>>m;
  int ans=1;
  if(n==1){
    cout<<m<<endl;
    return 0;
  }
  for(int i=2;i*i<=m;i++){
    if(m%i==0){
      int a=i,b=m/i;
      if(a>=n){
        ans=max(ans,b);
      }
      if(b>=n){
        ans=max(ans,a);
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
main()
{
 int a,b,c,tmp;
 scanf("%d %d %d",&a,&b,&c);
 if(a>b){
  tmp=a; a=b; b=tmp; }
 if(b>c){
  tmp=b; b=c; c=tmp; }
 if(a>b){
  tmp=a; a=b; b=tmp; }
 printf("%d %d %d\n",a,b,c);
 return 0;
} 


Measured memory_bytes: 2048
s = gets.chomp
q = gets.to_i
f = true
l = []
r = []
q.times do
  t = gets
  if t[0] == '1'
    f = !f
  elsif f
    if t[2] == '1'
      l.unshift(t[4])
    else
      r.push(t[4])
    end
  else
    if t[2] == '1'
      r.push(t[4])
    else
      l.unshift(t[4])
    end
  end
end
if f
  puts l.join('') << s << r.join('')
else
  puts (l.join('') << s << r.join('')).reverse
end

Measured memory_bytes: 28736
#include <iostream>
#include <string>
#include <vector>

using namespace std;

vector<string> words;
vector<string> numbers;
vector<string> ans;

string input;
int n;

void solve(int size, string str){
  if(size == input.size()){
    ans.push_back(str + ".");
    return;
  }
  for(int i=0;i<n;i++){
    if(size + numbers[i].size() > input.size()) continue;
    bool f = true;
    for(int j=0;j<numbers[i].size();j++){
      if(input[size+j] != numbers[i][j]){
	f = false;
	break;
      }
    }
    if(f){
      if(size == 0){
	solve((int)words[i].size(), words[i]);	
      }
      else solve(size + (int)words[i].size(), str + " " + words[i]);
    }
  }
}

main(){
  while(cin >> n){
    if(n == 0) break;
    words.clear();
    ans.clear();
    for(int i=0;i<n;i++){
      string in;
      cin >> in;
      words.push_back(in);
    }
    cin >> input;
    numbers.clear();
    for(int i=0;i<words.size();i++){
      string tmp = "";
      for(int j=0;j<words[i].size();j++){
	char c = words[i][j];
	if(c < 'a' || c > 'z') continue;
	if(c - 'a' <= 2) c = '2';
	else if(c - 'a' <= 5) c = '3';
	else if(c - 'a' <= 8) c = '4';
	else if(c - 'a' <= 11) c = '5';
	else if(c - 'a' <= 14) c = '6';
	else if(c - 'a' <= 18) c = '7';
	else if(c - 'a' <= 21) c = '8';
	else if(c - 'a' <= 25) c = '9';
	tmp += c;
      }
      numbers.push_back(tmp);
    }
    solve(0, "");
    for(int i=0;i<ans.size();i++){
      cout << ans[i] << endl;
    }
    cout << "--" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define cinf(n,x,y) for(int i=0;i<(n);i++) cin >> x[i]>>y[i];
typedef long long int ll;
using namespace std;
map<int,int> C[202000];
int main(){
	int n,m; cin >>n>>m;
	vector<int> a(m),b(m);
	cinf(m,a,b);
	for(int i=0;i<m;i++){
		C[a[i]][b[i]]=1;
		C[b[i]][a[i]]=1;
	}
	for(int i=2;i<n;i++){
		if(C[1][i]==1&&C[i][n]==1){
			cout << "POSSIBLE"<< endl;
			return 0;
		}
	}
	cout << "IMPOSSIBLE" << endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define mem0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define asort(x) sort(x.begin(), x.end());
#define dsort(x, t) sort(x.begin(), a.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    string S;
    char C;
    ll Q, T, F;
    bool rev = false;
    deque<char> dq;
    cin >> S;
    for(ll i = 0; i < S.length(); i++) {
        dq.push_back(S[i]);
    }
    cin >> Q;
    for(ll i = 0; i < Q; i++) {
        cin >> T;
        if(T == 1) {
            rev = !rev;
        } else {
            cin >> F >> C;
            if((F == 1 && !rev) || (F == 2 && rev)) {
                dq.push_front(C);
            } else {
                dq.push_back(C);
            }
        }
    }
    if(rev) {
        reverse(all(dq));
    }
    for(auto &x : dq) {
        cout << x;
    }
    cout << endl;
    return 0;
}

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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

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

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 1000001;

ld N, X, Y;
ld totalDistances = 0;
ld numOfPermutations = 0;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin >> N;
	vector<pair<ld, ld>> points;
	F0R(i, N) {
		cin >> X >> Y;
		points.pb(mp(X, Y));
	}
	sort(all(points));
	
	do {
		ld totalDistance = 0;
		FOR(i, 1, N) {
			totalDistance += sqrt((pow(points[i].f - points[i - 1].f, 2.0) + pow(points[i].s - points[i - 1].s, 2.0)));
		}
		totalDistances += totalDistance;
		numOfPermutations++;
	} while(next_permutation(all(points)));
	cout << fixed << setprecision(6) << totalDistances / numOfPermutations;
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc173/tasks/abc173_b

const main = (args) => {
  const [N] = args[0].split(' ').map(Number);
  const c = [0, 0, 0, 0];
  
  for (let i=1, len=args.length; i<len; i++) {
    switch (args[i]) {
    case 'AC':  c[0]++; break;
    case 'WA':  c[1]++; break;
    case 'TLE': c[2]++; break;
    case 'RE':  c[3]++; break;
    }
  }
  
  console.log('AC x '+c[0]);
  console.log('WA x '+c[1]);
  console.log('TLE x '+c[2]);
  console.log('RE x '+c[3]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n'));


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

template<::std::uint_fast64_t mod>
class ModInt{
private:
	using value_type = ::std::uint_fast64_t;
	value_type n;
public:
	ModInt() : n(0) {}
	ModInt(value_type n_) : n(n_ % mod) {}
	ModInt(const ModInt& m) : n(m.n) {}

	template<typename T>
	explicit operator T() const { return static_cast<T>(n); }
	value_type get() const { return n; }

	friend ::std::ostream& operator<<(::std::ostream &os, const ModInt<mod> &a) {
		return os << a.n;
	}

	friend ::std::istream& operator>>(::std::istream &is, ModInt<mod> &a) {
		value_type x;
		is >> x;
		a = ModInt<mod>(x);
		return is;
	}

	bool operator==(const ModInt& m) const { return n == m.n; }
	bool operator!=(const ModInt& m) const { return n != m.n; }
	ModInt& operator*=(const ModInt& m){ n = n * m.n % mod; return *this; }

	ModInt pow(value_type b) const{
		ModInt ans = 1, m = ModInt(*this);
		while(b){
			if(b & 1) ans *= m;
			m *= m;
			b >>= 1;
		}
		return ans;
	}

	ModInt inv() const { return (*this).pow(mod-2); }
	ModInt& operator+=(const ModInt& m){ n += m.n; n = (n < mod ? n : n - mod); return *this; }
	ModInt& operator-=(const ModInt& m){ n += mod - m.n; n = (n < mod ? n : n - mod); return *this; }
	ModInt& operator/=(const ModInt& m){ *this *= m.inv(); return *this; }
	ModInt operator+(const ModInt& m) const { return ModInt(*this) += m; }
	ModInt operator-(const ModInt& m) const { return ModInt(*this) -= m; }
	ModInt operator*(const ModInt& m) const { return ModInt(*this) *= m; }
	ModInt operator/(const ModInt& m) const { return ModInt(*this) /= m; }
	ModInt& operator++(){ n += 1; return *this; }
	ModInt& operator--(){ n -= 1; return *this; }
	ModInt operator++(int){
		ModInt old(n);
		n += 1;
		return old;
	}
	ModInt operator--(int){
		ModInt old(n);
		n -= 1;
		return old;
	}
	ModInt operator-() const { return ModInt(mod-n); }
};

using namespace std;

ModInt<1000000007> func(ll x){
	ModInt<1000000007> ret(1);
	if (x == 0) return ret;
	for(ll i=x; x>=2; x--){
		ret *= x;
	}
	return ret;
}

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, k; cin>>n>>k;
	
	for(int i=1; i<=k; i++){
		ModInt<1000000007> ans(0);
		ModInt<1000000007> A;
		ModInt<1000000007> B;
		ll b = k;
		ll r = n-k;
		b -= i;
		r -= i-1;
		if (b<0 || r<0){
			cout << "0\n";
			continue;
		}
		A = func(i+b-1) / (func(b)*func(i-1));
		B = func(i+r) / (func(r)*func(i));
		ans = A*B;
		cout << ans << "\n";
	}	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <complex>
#include <iomanip>
using namespace std;
using ll = long long;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
int main(){
    int n,a,b,c,d; cin >> n >> a >> b >> c >> d;
    string s; cin >> s;
    s = "#" + s + "#";
    auto can_reach = [&](int start,int end){
        for(int i = start; i+1 <= end; i++){
            if (s[i] == '#' && s[i+1] == '#') return false;
        }
        return true;
    };
    if (!can_reach(a,c) || !can_reach(b,d)){
        cout << "No" << endl;
        return 0;
    }
    if (c > d){
        bool over = false;
        for(int i = b; i <= d; i++){
            if (s[i-1] == '.' && s[i] == '.' && s[i+1] == '.'){
                over = true;
            }
        }
        if (!over){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}
  



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

int main(){
  int H, W;
  cin >> H >> W;
  vector<string> data(H);
  for (int i = 0; i < H;i++){
    cin >> data.at(i);
  }
  for (int i = 0; i < H;i++){
    cout << data.at(i) << endl;
    cout << data.at(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

d = [0] * n

for i in range(n):
    if i % 2 == 0:
        d[0] += a[i]
    else:
        d[0] -= a[i]

for i in range(1, n):
    d[i] = 2 * a[i - 1] - d[i - 1]

print(*d)


Measured memory_bytes: 64484
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
  double X;
  cin >> X;
  double money = 100;
  int year_num = 0;
  while(true){
    if(money >= X){
      cout << year_num << endl;
      break;
    }
    money = floor(money * 1.01);
    year_num++;
  }
  return 0;
}


Measured memory_bytes: 3724
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
    int b = s.nextInt();
    if (a > b)
      System.out.println("a > b");
    else if (a < b)
      System.out.println("a < b");
    else
      System.out.println("a == b");
	}
}


Measured memory_bytes: 26060
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






long long int gcd(long long int a,long long int b)
{
 
  long long int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  long long int a,b,c,d,lcm,n;
  cin>>a>>b>>c>>d;
  a=a-1;
  lcm=c*d/gcd(c,d);
  cout<<b-(b/c+b/d-b/lcm)-(a-(a/c+a/d-a/lcm))<<endl;
}
///////////////////////////

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N = 40003;

int a[N], b[N], n, p[N], mark[N];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) scanf("%d", &p[i]);
	for (int i = 1; i <= n; ++i) a[i] = a[i - 1] + 20001, b[n - i + 1] = a[i];
	for (int i = 1; i <= n; ++i) {
		mark[p[i]] = 1;
		for (int j = p[i] + 1; j <= n; ++j)
			if (!mark[j]) ++a[j];
		for (int j = p[i] - 1; j >= 1; --j)
			if (!mark[j]) ++b[j];
	}
	
	for (int i = 1; i <= n; ++i) printf("%d ", a[i]); puts("");
	for (int i = 1; i <= n; ++i) printf("%d ", b[i]); puts("");
	return 0;
}

Measured memory_bytes: 896
from functools import reduce

def main():
    # 一文字のみを読み込み
    # s = input().rstrip().split(' ')
    
    # スペース区切りで標準入力を配列として読み込み
    # s = input().rstrip().split(' ')

    # 位置文字ずつ標準入力を配列として読み込み
    # s = list(input().rstrip())
    slist = input().rstrip().split(' ')
    N = int(slist[0])
    L = int(slist[1])
    S = []
    ans = ''
    for i in range(0,N):
        S.append(input().rstrip())
    S.sort()
    for i in range(0,N):
        ans = ans + S[i]
    print(ans)
   
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
import sys
sys.setrecursionlimit(10**7)

nodedict = {}

class Node:
    def __init__(self, id, jisu, children):
        self.id = id
        self.jisu = jisu
        self.children = children
        self.parent = -1
        self.depth = -1

    def __repr__(self):
        return "id:{}, jisu:{}, parent:{}, depth:{}, children:{}".format(self.id, self.jisu, self.parent, self.depth, self.children)

def assign_depth(node, current_depth):
    node.depth = current_depth
    for childid in node.children:
        assign_depth(nodedict[childid], current_depth+1)

def solve():
    n = int(input())

    # Node作成
    for i in range(n):
        input_list = list(map(int, input().split()))
        id = input_list[0]
        jisu = input_list[1]
        children = input_list[2:]
        nodedict[id] = Node(id, jisu, children)

    # 親番号の割り当て
    for i in range(n):
        node = nodedict[i]
        for childid in node.children:
            child = nodedict[childid]
            child.parent = node.id

    #print(nodedict)
    # 根探し
    neid = None
    for i in range(n):
        node = nodedict[i]
        if node.parent == -1:
            neid = node.id
            break

    # 深さを割り当てる
    assign_depth(nodedict[neid], 0)

    # 出力
    for i in range(n):
        node = nodedict[i]
        if node.depth == 0:
            type = "root"
        elif len(node.children) == 0:
            type = "leaf"
        else:
            type = "internal node"

        print("node {}: parent = {}, depth = {}, {}, {}".format(node.id, node.parent, node.depth, type, node.children))

solve()


Measured memory_bytes: 43428
import java.io.*;
public class Main {
    public static void main(String args[])throws Exception{
        BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
        int a = Integer.parseInt(br.readLine());
        if(a>=30){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 32552
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    
    int num = N % 10;
    
    if(num == 2 || num == 4 || num == 5 || num == 7 || num == 9){
        cout << "hon" << endl;
    }
    else if(num == 0 || num == 1 || num == 6 || num == 8){
        cout << "pon" << endl;
    }
    else{
        cout << "bon" << endl;
    }
    
    
    
}


Measured memory_bytes: 3032
package main

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

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

func scanText() string {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Scan()
	return sc.Text()
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := scanInt()
	a := make([]int, n)
	for i := 0; i < n-1; i++ {
		num := scanInt()
		a[num-1]++
	}

	for _, num := range a {
		fmt.Println(num)
	}

}


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

int main()
{
    double x1,y1,x2,y2,x3,y3,m1,m2,h,k,c,r;
    int i,j,t;
    scanf("%d",&t);
    for(i=1; i<=t; i++)
    {
        scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);

        m1=(y2-y1)/(x2-x1);
        m2=(y3-y1)/(x3-x1);
        if(m2==0)
        {
            k=(x2-x3)/m1/2+(y1+y2)/2;
            h=(x1+x3)/2;
        }
        else if(m1==0)
        {
            k=(x3-x2)/m2/2+(y1+y3)/2;
            h=(x1+x2)/2;
        }
        else if(m1!=0&&m2!=0)
        {
            h=((x1+x2)/m1-(x1+x3)/m2+y2-y3)/2/(1/m1 - 1/m2);
            k=( h-(x1+x2)/2)/(-m1)+(y1+y2)/2;
        }
        r=sqrt((h-x1)*(h-x1)+(k-y1)*(k-y1));
        printf("%.3lf %.3lf %.3lf\n",h,k,r);



    }
    return 0;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#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 rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

int n;
vl a;

vector<vector<pll> > dp(410, vector<pll>(410, pll(-1, -1)));

pll calc(int l, int r) {
  if (r - l == 1) {
    return pll(a[l], 0);
  }
  if (dp[l][r] != pll(-1, -1)) {
    return dp[l][r];
  }
  pll res(INF, INF);
  for (int m = l + 1; m < r; m++) {
    pll temp = calc(l, m) + calc(m, r);
    if (temp.second + temp.first < res.second) {
      res.first = temp.first;
      res.second = temp.second + temp.first;
    }
  }
  dp[l][r] = res;
  return res;
}

int main() {
  cin >> n;
  a.resize(n);
  rep (i, n) {
    cin >> a[i];
  }
  cout << calc(0, n).second << endl;
}


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

using namespace std;

typedef long long i64;

//bool check(const vector<pair<int, int>>& ans, const vector<pair<int, int>>& a) {
//
//}

int main() {
    int n;
    while (cin >> n) {
        vector<pair<i64, i64>> a(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i].first;
            a[i].second = i;
        }

        pair<i64, i64> maxa(-1e9, -1);
        pair<i64, i64> mina(1e9, -1);
        for (int i = 0; i < n; i++) {
            maxa = max(maxa, a[i]);
            mina = min(mina, a[i]);
        }

        auto target = (abs(maxa.first) > abs(mina.first) ? maxa : mina);

        vector<pair<int, int> > ans;
        for (int i = 0; i < n; i++) {
            if (i != target.second) {
                ans.emplace_back(target.second + 1, i + 1);
                a[i].first += target.first;
            }
        }

        if (target.first < 0) {
            for (int i = n - 1; i > 0; i--) {
                if (a[i] < a[i - 1]) {
                    ans.emplace_back(i + 1, i);
                    a[i - 1].first += a[i].first;
                }
            }

        } else {
            for (int i = 0; i < n - 1; i++) {
                if (a[i] > a[i + 1]) {
                    ans.emplace_back(i + 1, i + 2);
                    a[i + 1].first += a[i].first;
                }
            }
        }

        cout << ans.size() << endl;
        for (auto& p : ans) {
            cout << p.first << " " << p.second << endl;
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main() {
  int n;
  int a;
  scanf("%d",&n);
  
  a = n % 10;
  if ( a == 3 ) printf("bon");
  else if ( a == 0 || a == 1 || a == 6 || a == 8 ) printf("pon");
  else printf("hon");
  
  return 0;
}

Measured memory_bytes: 1696