akhauriyash/Code-Regression huggingface dataset:
/**
 * Title: D - RGB Triplets
 * Url: https://atcoder.jp/contests/abc162/tasks/abc162_d
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

const int R = 0;
const int G = 1;
const int B = 2;


int main() {

    int n; cin >> n;
    string s; cin >> s;

    vector<vector<int>> rgb(3);
    for(int i=0; i<n; i++) {
        if(s[i]=='R') {
            rgb[R].push_back(i);
        } else if (s[i]=='G') {
            rgb[G].push_back(i);
        } else {
            rgb[B].push_back(i);
        }
    }

    // cout << "rsize:" << rgb[R].size() << endl;
    // cout << "gsize:" << rgb[G].size() << endl;
    // cout << "bsize:" << rgb[B].size() << endl;
    ll all = rgb[R].size() * rgb[G].size() * rgb[B].size();
    for(auto ri:rgb[R]) {
        // cout << "ri:" << ri << endl;
        for(auto gi:rgb[G]) {
            int diff = abs(ri-gi);
            int min_b = min(ri, gi)-diff;
            int max_b = max(ri, gi)+diff;
            int ptr = -1;
            if((ri+gi)%2==0) {
                ptr = (ri+gi)/2;
            }
            int hits = 0;
            if(min_b>0&min_b<n) {
                if(s[min_b]=='B') hits++;
            }
            if(max_b>0&max_b<n) {
                if(s[max_b]=='B') hits++;
            }
            if(ptr!=-1) {
                if(s[ptr]=='B') hits++;
            }

            all -= hits;
        }
    }

    cout << all << endl;

    return 0;
}

Measured memory_bytes: 3644
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

    int n; cin>>n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];

    int ng = 0, ok = n;
    while(ok - ng > 1){
        int mid = (ng + ok) / 2;

        bool valid = true;
        stack<P> st;
        for(int i=0; i+1<n; i++){
            if(a[i] >= a[i+1]){
                while(st.size() && !(st.top().first <= a[i+1])) st.pop();
                if(st.size() && st.top().first == a[i+1]) st.top().second++;
                else st.emplace(a[i+1], 1);

                while(st.top().second == mid){
                    int digit = st.top().first;
                    if(digit == 1) {valid = false; break;}
                    st.pop();
                    if(st.size() && st.top().first == digit - 1) st.top().second++;
                    else st.emplace(digit-1, 1);
                }

                if(!valid) break;
            }
        }

        END:;
        if(valid) ok = mid;
        else ng = mid;
    }

    cout << ok << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
#define NIL -2000000001
#define MAX 2000

int A[MAX];
int n = 0;

int fib(int num) {
  if (A[num] != NIL) {
    return A[num];
  } else {
    A[num-2] = fib(num-2);
    A[num-1] = fib(num-1);
    return A[num-2]+A[num-1];
  }
}

int main() {
  int num;
  for ( int i = 0; i < MAX; i++ ) {
    A[i] = NIL;
  }
  A[0] = 1;
  A[1] = 1;
  scanf("%d", &num);
  printf("%d\n", fib(num));
  return 0;
}



Measured memory_bytes: 2668
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    bool hash1[256] = {};
    bool hash2[256] = {};
    int ans = 0;
    int n;
    string s;
    cin >> n >> s;

    FOR(i, 1, n - 1) {
        REP(j, 256) hash1[j] = hash2[j] = false;
        REP(j, i) hash1[(int)s[j]] = true;
        FOR(j, i, n - 1) hash2[(int)s[j]] = true;
        int cnt = 0;
        REP(j, 256) cnt += hash1[j] & hash2[j];
        ans = max(ans, cnt);
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int n, k; cin >> n >> k;
    if(k %2 == 1){
        ll ans = n/k;

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

    ll jud = n/k;
    ll jud2 = n/(k/2) - jud;

    cout << jud * jud * jud + jud2 * jud2 * jud2 << endl;

}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c;
int x, y;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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

Measured memory_bytes: 3636
import math
from math import log2
from math import ceil

N,K = map(int,input().split())

def prob_wins(x,k):
    if x>=k:
        return 1
    return 0.5**ceil(log2(k/x))

ans = 0
for i in range(1,N+1):
    ans += prob_wins(i,K)
    # print(i,prob_wins(i,K))
print(ans/N)

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)






int main() {
    ll cnt[4] = {};
    REP(i, 3){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        cnt[a]++;
        cnt[b]++;
    }
    ll cnt2[2] = {};
    REP(i, 4){
        if(cnt[i] >= 3){
            cout << "NO" << endl;
            return 0;
        }
        cnt2[cnt[i] - 1]++;
    }
    if(cnt2[0] == 2 && cnt2[1] == 2){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
using System;

	public class Class1
	{
		public static void Main(String[] args)
		{   string line;
			while((line=Console.ReadLine())!="-")
			{				
			int m=int.Parse(Console.ReadLine());			
			shuffle(m,line);
			}
		}
		public static void shuffle(int count ,string abc)
		{	
			
			for(int i=0;i<count;i++)
			{
				 int index=int.Parse(Console.ReadLine());
				 string after=abc.Substring(index);
				 string tail=abc.Substring(0,index);
				 abc=after+tail;				 
			}
			Console.WriteLine(abc);			
		}
	}

Measured memory_bytes: 8868
#include <iostream>
using namespace std;
 
int main() {
	int row,col;
	cin >> row >> col;
	int mtx[101][101];
	mtx[row][col] = 0;
 
	//????????????????´?
	for(int i = 0; i < row; i++){
		for(int j = 0; j < col; j++){
			mtx[i][col] = 0;
			mtx[row][j] = 0;
			cin >> mtx[i][j];
		}
	}
 
	//??????????????????
	for(int i = 0; i < row; i++){
		for(int j = 0; j < col; j++){
			mtx[i][col] += mtx[i][j];
			mtx[row][j] += mtx[i][j];
 
		}
		mtx[row][col] += mtx[i][col];
	}
 
	int c;
 
	for(int i = 0; i <= row; i++){
 
		for(int j = 0; j <= col; j++){
			if(j)cout << " ";
			cout << mtx[i][j] ;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3104
from copy import deepcopy
from itertools import product

h, w, k = map(int, input().split())
board   = [ [ c for c in input() ] for _ in range(h) ]

s = 0

def num_to_bit_boolean(n):
    return [ bool(n & b) for b in [ 1, 2, 4, 8, 16, 32 ] ]

def del_row_col(rows_num, cols_num, board):
    global s

    for bit, row in zip(num_to_bit_boolean(rows_num), range(h)):
        if bit:
            board[row] = [ '.' ] * w

    for row in board:
        for bit, col in zip(num_to_bit_boolean(cols_num), range(w)):
            if bit:
                row[col] = '.'

    if count_black(board) == k:
        # print('row', num_to_bit_boolean(rows_num)[:h])
        # print('col', num_to_bit_boolean(cols_num)[:w])

        s += 1

    return board

def count_black(board):
    return sum( row.count('#') for row in board )

for row, col in product(range(2 ** h), range(2 ** w)):
    del_row_col(row, col, deepcopy(board))

print(s)

Measured memory_bytes: 9028
x, y = map(int, input().split())

# 最初に反転を押したかどうか
x = [(0, x), (1, -x)]
p = []

def posY(x):
    if x <= y:
        return y-x
    else:
        return None

def negY(x):
    if x <= -y:
        return -y-x
    else:
        return None

# 次の反転でyになるようにAを押す
for n, z in x:
    v = posY(z)
    if v != None:
        p.append(n+v)
    v = negY(z)
    if v != None:
        p.append(n+v+1)

print(min(p))


Measured memory_bytes: 3064
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0566
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<algorithm>
int main(){
	int N;
	scanf("%d", &N);
	int point[101] = { 0 };
	for (int i = 0; i < N * (N - 1) / 2; ++i){
		int a, b, c, d;
		scanf("%d %d %d %d", &a, &b, &c, &d);
		if (c>d)point[a-1] += 3;
		else if (d>c)point[b-1] += 3;
		else point[a-1]++, point[b-1]++;
	}
	int rank[101];
	for (int i = 0; i < N; ++i)rank[i] = point[i];
	std::sort(rank, rank + N);
	bool flag[101] = { true };
	int ans[101];
	int r = 1;
	for (int i = N - 1; i >= 0; --i){
		int cnt = 0;
		for (int j = 0; j < N; ++j){
			if (point[j] == rank[i]){
				cnt++;
				ans[j] = r;
			}
		}
		if (cnt>1){
			i -= cnt - 1;
			r += cnt - 1;
		}
		r++;
		
	}
	for (int i = 0; i < N; ++i){
		std::cout << ans[i] << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1212
// inputに入力データ全体が入る
function Main(input) {
// 1行目がinput[0], 2行目がinput[1], …に入る
  x = Number(input);
  m = 100;
  y = 0;
  while(m < x){
    m = Math.floor(m * 1.01);
    y++
  }
  console.log(y);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29720
# coding: utf-8
# Your code here!

import math

n = int(input())

p1 = [0.0, 0.0]
p2 = [100.0, 0.0]

def rad(r) :
    return math.radians(r)

def sin(s) :
    return math.sin(s)
    
def cos(s) :
    return math.cos(s)

def A(n, p1, p2) :
    if n == 0 :
        return 0
    else :
        s = [0, 0]
        t = [0, 0]
        u = [0, 0]
        
        s[0] = (p2[0] - p1[0]) / 3 + p1[0]
        s[1] = (p2[1] - p1[1]) / 3 + p1[1]
        t[0] = (p2[0] - p1[0]) / 3 * 2 + p1[0]
        t[1] = (p2[1] - p1[1]) / 3 * 2 + p1[1]
        
        u[0] = (t[0] - s[0]) * cos(rad(60)) - (t[1] - s[1]) * sin(rad(60)) + s[0]
        u[1] = (t[0] - s[0]) * sin(rad(60)) + (t[1] - s[1]) * cos(rad(60)) + s[1]
        
        A(n - 1, p1, s)
        p(s[0], s[1])
        
        A(n - 1, s, u)
        p(u[0], u[1])
        
        A(n - 1, u, t)
        p(t[0], t[1])
        
        A(n - 1, t, p2)
        
def p(x, y) :
    print(f"{x:.8f} {y:.8f}")
    
print(p1[0], p1[1])
A(n, p1, p2)
print(p2[0], p2[1])


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

int main(){
  int a, b;
  cin >> a >> b;

  int mean = (a + b) / 2;
  
  int r_mean;

  if((a + b) % 2 != 0){
    r_mean = mean + 1;
  }else{
    r_mean = mean;
  }

  cout << r_mean << endl; 
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	sort(a.begin(),a.end());
	int ng = 0,ok = n + 1;
	while(ok - ng > 1){
		int mid = (ok + ng) / 2;
		if(a.at(mid - 1) >= k){
			ok = mid;
			continue;
		}
		vector<bitset<5010>> dp(n + 1);
		dp[0].set(0);
		rep(i,n){
			if(i == mid - 1) dp[i + 1] |= dp[i];
			else dp[i + 1] |= dp[i] | (dp[i] << a.at(i));
		}
		bool flg = false;
		for(int i = k - a.at(mid - 1); i < k; i++){
			if(dp[n][i]){
				flg = true;
				break;
			}
		}
		if(flg) ok = mid;
		else ng = mid;
	}
	cout << ng << endl;
}


Measured memory_bytes: 3440
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int r0 = sc.nextInt();
            int w0 = sc.nextInt();
            int c = sc.nextInt();
            int r = sc.nextInt();
            if ((r0 | w0 | c | r) == 0) {
                break;
            }
            int k = w0 * c;
            int i = 0;
            while (r0 < k) {
                i++;
                r0 += r;
            }
            System.out.println(i);
        }
    }
}

Measured memory_bytes: 26580
n,m=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
a.sort(reverse=True)
ALL=0

for i in a:
    ALL+=i


for i in range(m):
    if a[i]>=ALL/(4*m):
        cnt+=1
        if cnt==m:
            print("Yes")
    else:
        print("No")
        break


Measured memory_bytes: 9212
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>

#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define FOR(i, A, N) for(int (i) = (A); (i) < (N); (i)++)
#define REP(i, N) for(int (i) = 0; (i) < (N); (i)++)

using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

int n,m;
ll dePow(ll num, int pw) {
	if(pw == 1)
		return num;
	if(num == 1)
		return num;
	for(ll x = 2; ; x++) {
		ll cpw = 1;
		REP(j, pw) {
			cpw = cpw*x;
			if(cpw > num)
				return -1;
		}
		if(cpw == num)
			return x;
	}
	return -1;
}

int main() {
	ll N, P;
	scanf("%lld%lld", &N, &P);
	if(N >= 40) {
		printf("1\n");
		return 0;
	}
	ll ans = 0;
	for(ll d = 1; d*d <= P; d++) {
		if(P%d == 0) {
			ll A = dePow(d, (int)N);
			ll B = dePow(P/d, (int)N);
			if(A != -1)
				ans = max(ans, A);
			if(B != -1)
				ans = max(ans, B);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <queue>
#include <tuple>
#include <utility>

constexpr size_t m1 = -1;
constexpr size_t di[] = {m1, 0, 1, 0};
constexpr size_t dj[] = {0, m1, 0, 1};

std::vector<size_t> make_vector(size_t n, size_t x) {
  return std::vector<size_t>(n, x);
}

template <class Tp>
std::vector<Tp> make_vector(size_t n, const Tp& x) {
  return std::vector<Tp>(n, x);
}

template <class... Ts>
auto make_vector(size_t n, size_t m, const Ts&... x) {
  return std::vector<decltype(make_vector(m, x...))>(n, make_vector(m, x...));
}


using zahyo = std::pair<size_t, size_t>;
void bfs(const std::vector<std::string>& a,
         std::queue<zahyo>& q, std::vector<std::vector<bool>>& b) {

  size_t h = a.size();
  size_t w = a[0].size();
  while (!q.empty()) {
    size_t i, j;
    std::tie(i, j) = q.front();
    q.pop();
    for (int k = 0; k < 4; ++k) {
      size_t ni = i + di[k];
      size_t nj = j + dj[k];
      if (!(ni < h && nj < w)) continue;
      if (a[ni][nj] != '.') continue;
      if (b[ni][nj]) continue;
      b[ni][nj] = true;
      q.emplace(ni, nj);
    }
  }
}

int testcase_ends() {
  size_t h, w;
  scanf("%zu %zu", &w, &h);
  if (h == 0 && w == 0) return 1;

  std::queue<zahyo> qw, qb;
  auto xb = make_vector(h, w, false);
  auto xw = xb;

  std::vector<std::string> a(h);
  for (size_t i = 0; i < h; ++i) {
    char buf[64];
    scanf("%s", buf);
    a[i] = buf;
    for (size_t j = 0; j < w; ++j) {
      if (a[i][j] == 'W') {
        qw.emplace(i, j);
        // xw[i][j] = true;
      } else if (a[i][j] == 'B') {
        qb.emplace(i, j);
        // xb[i][j] = true;
      }
    }
  }

  bfs(a, qw, xw);
  bfs(a, qb, xb);

  int black = 0;
  int white = 0;
  for (size_t i = 0; i < h; ++i) {
    for (size_t j = 0; j < w; ++j) {
      if (a[i][j] != '.') continue;
      if (xb[i][j] && xw[i][j]) continue;
      int c = 0;
      if (xb[i][j]) c = +1;
      if (xw[i][j]) c = -1;
      if (c == 0) continue;
      for (int k = 0; k < 4; ++k) {
        size_t ni = i + di[k];
        size_t nj = j + dj[k];
        if (!(ni < h && nj < w)) continue;
        if (c > 0 && a[ni][nj] == 'W') {
          c = 0;
          break;
        }
        if (c < 0 && a[ni][nj] == 'B') {
          c = 0;
          break;
        }
      }
      if (c > 0) ++black;
      if (c < 0) ++white;
    }
  }

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

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2860
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
using namespace std;
int n,p1,p2,p3,p4,S,T,tot=1;
const int N=1010,inf=1e9;
int head[N*2],to[N*20],nt[N*20],val[N*20],cost[N*20],pre[N*2],from[N*2],vis[N*2];
long long dis[N*2];
void ADD(int x,int y,int v,int c)
{
	to[++tot]=y;val[tot]=v;cost[tot]=c;nt[tot]=head[x];head[x]=tot;
}
void add(int x,int y,int v,int c)
{
	ADD(x,y,v,-c);ADD(y,x,0,c);
}
queue<int>q;
int SPFA()
{
	int x;
	memset(from,-1,sizeof(from));
	memset(dis,0x3f,sizeof(dis));
	while(!q.empty())q.pop();
	dis[S]=0;q.push(S);vis[S]=1;
	while(!q.empty())
	{
		x=q.front();q.pop();vis[x]=0;
		for(int i=head[x];i;i=nt[i])
			if(val[i]&&dis[to[i]]>dis[x]+cost[i])
			{
				dis[to[i]]=dis[x]+cost[i];from[to[i]]=x;pre[to[i]]=i;
				if(!vis[to[i]])q.push(to[i]),vis[to[i]]=1;
			}
	}
	return from[T]!=-1;
}
long long MFMC()
{
	long long ans=0;int k;
	while(SPFA())
	{
		k=inf;
		for(int i=T;i!=S;i=from[i])k=min(k,val[pre[i]]);
		ans+=dis[T]*k;
		for(int i=T;i!=S;i=from[i])val[pre[i]]-=k,val[pre[i]^1]+=k;
	}
	return ans;
}
int main()
{
	cin>>n;p1=2*n+1;p2=p1+1;p3=p1+2;p4=p1+3;S=p1+4;T=p1+5;
	for(int i=1,x,y,z;i<=n;++i)
	{
		scanf("%d%d%d",&x,&y,&z);
		add(S,i,z,0);
		add(i,p1,inf,x+y);
		add(i,p2,inf,x-y);
		add(i,p3,inf,-x+y);
		add(i,p4,inf,-x-y);
	}
	for(int i=1,x,y,z;i<=n;++i)
	{
		scanf("%d%d%d",&x,&y,&z);
		add(n+i,T,z,0);
		add(p1,n+i,inf,-x-y);
		add(p2,n+i,inf,-x+y);
		add(p3,n+i,inf,x-y);
		add(p4,n+i,inf,x+y);
	}
	cout<<-MFMC();
	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define INF 1000000007
#define LINF 1000000000000000007
#define MOD 1000000007
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout << #X << ": " << X << " ";
#define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " ";
#define END cout << endl;
#else
#define DEB(X) \
    {          \
    }
#define ARDEB(i, X) \
    {               \
    }
#define END \
    {       \
    }
#endif
typedef pair<int, int> P;
struct edge{int to,cost;};

typedef long long ll;

int ans,ans2;
int n,a[211111],b[211111];



signed main(){

	cin>>n;
	rep(i,n)cin>>a[i];
	repb(i,n){
		int sum=0;
		for(int j=i*2+2;j<=n;j+=i+1)sum+=b[j-1];
		if(sum%2!=a[i])b[i]=1;
	}
	rep(i,n)if(b[i])ans++;
	cout<<ans<<endl;
	rep(i,n)if(b[i])cout<<i+1<<" ";
}


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

int main()
{
	int n;
	int count = 1;
  
    cin >> n;
	vector<int> diameter__array(n);
  
	//for文で、n個の入力を配列に入れる
	for (int i = 0; i < n; i++)
		cin >> diameter__array.at(i);

	sort(diameter__array.begin(), diameter__array.end());
	reverse(diameter__array.begin(), diameter__array.end());

	//お餅の個数を、直径のダブりを覗きながらカウントする
	for (int l = 1; l < n; l++)
	{
		if (diameter__array.at(l - 1) != diameter__array.at(l))
			count++;
	}
	cout << count << endl;
	return (0);
}


Measured memory_bytes: 256
R = range(8)
A = [4,1,4,1,2,1,2,1]
A += A
B = "41412121"
B = map(int, [B[i:]+B[:i] for i in R])

import sys
for s in sys.stdin:
  x = map(int, s[:-1].split())
  m = sum(x)
  for i in R:
    s = sum([max(0, x[j] - A[i+j]) for j in R])
    if s<m: m,p = s,B[i]
    elif m==s and B[i]<p: p=B[i]
  print " ".join(list(str(p)))

Measured memory_bytes: 4240
using System;
using System.Collections;
class Program
{
    static int Mul2(int k)
    {
        return 2 * k;
    }
    static int Mul3(int k)
    {
        return 3 + 6 * (k - 1);
    }
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        if (n == 3)
        {
            Console.WriteLine("2 5 63");
            Environment.Exit(0);
        }
        ArrayList ans = new ArrayList();
        int num2 = 1;
        int num3 = n - num2;
        while (num2 % 3 == 1 || num3 % 2 == 1 || num2 > 15000 || num3 > 5000)
        {
            num3--;
            num2++;
        }
        for (int i = 1; i <= num2; i++)
            ans.Add(Mul2(i));
        for (int i = 1; i <= num3; i++)
            ans.Add(Mul3(i));
        for (int i = 0; i < n - 1; i++)
            Console.Write("{0} ", ans[i]);
        Console.WriteLine(ans[n - 1]);
    }
}

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

using i64 = int64_t;

int main(){
    int h, n;
    cin >> h >> n;
    int sum = 0;
    for(int i=0;i<n;++i){
        int a;
        cin >> a;
        sum += a;
    }
    cout << (sum >= h ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
//26

int n, k, q, ans = INF;
vector<int> a;
vector<int> solve(int l, int r){
	vector<int> vec, vec2;
	repi(i,l+1,r)vec.pb(a[i]);
	sort(all(vec));
	rep(i,r-l-k)vec2.pb(vec[i]);
	//for(auto x: vec2)cout << x << " ";
	//cout << endl;
	//printf("%lld\n", (int)vec2.size());
	return vec2;
}

signed main(){
	scanf("%lld%lld%lld", &n, &k, &q);
	a.pb(-1);
	rep(i,n){
		int x;
		scanf("%lld", &x);
		a.pb(x);
	}
	a.pb(-1);
	rrep(i,n){
		int m = a[i], l = 0, r = 0;
		vi vec;
		rep(j,n+2){
			if(a[j] < m){
				r = j;
				vi v;
				if(r-l-1 >= k)v = solve(l, r);
				vec.insert(vec.end(), all(v));
				//if(r-l-1 >= k)vec.insert(vec.end(), all(solve(l, r)) );
				/*if(r-l-1 >= k){
					for(auto x: solve(l, r))cout << x << " ";
					cout << endl;
				}*/
				l = j;
			}
		}
		//if(n-l-1 >= k)vec.insert(vec.end(), all(solve(l, n)));
		//printf("%lld\n", (int)vec.size());
		sort(all(vec));
		if(vec.size() >= q)chmin(ans, vec[q-1]-m);
	}
	printf("%lld\n", ans);
	return 0;
}




Measured memory_bytes: 384
#include<bits/stdc++.h>
#define LL long long
#define rep(i,a,b) for(int i=a;i<=b;++i)
using namespace std;

const int mn=1e5+7;

int main()
{
	LL n,a=100;
	double t=1.01;
	int cnt=0;
	scanf("%lld",&n);
	while(a<n) {
		a*=t;
		cnt++;
	}
	printf("%d",cnt);
}

Measured memory_bytes: 3824
s = input()

n = len(s)
ans = [0]*n
boundary = []

for i in range(n-1):
    if s[i]=='L' and s[i+1]=='R':
        boundary.append(i)
boundary.append(n-1)

l = 0
for r in boundary:
    middle = 0
    cnt = [0,0]
    for x in range(l,r+1):
        cnt[x%2] += 1
        if s[x]=='R' and s[x+1]=='L':
            middle = x

    ans[middle] = cnt[middle%2]
    ans[middle+1] = cnt[1-(middle%2)]

    l = r+1
print(*ans)

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

void dijkstra(int from, vector<int>* v, vector<int> &d){
    queue<int> q;
    q.push(from);
    d[from] = 0;
    while(!q.empty()){
        int x = q.front();  q.pop();
        for(int next : v[x]){
            if(d[next] != 1<<30)    continue;
            d[next] = d[x]+1;
            q.push(next);
        }
    }
}

typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    s--, t--;
    
    vector<int> v[n];
    while(m-- > 0){
        int x, y;
        cin >> x >> y;
        x--, y--;
        v[x].push_back(y);
        v[y].push_back(x);
    }

    vector<int> a(n, 1<<30), b(n, 1<<30);
    dijkstra(s, v, a);
    dijkstra(t, v, b);

    vector<int> cnta(n+1, 0), cntb(n+1, 0);
    for(int i = 0; i < n; i++)  if(a[i] != 1<<30)   cnta[a[i]]++;
    for(int i = 0; i < n; i++)  if(b[i] != 1<<30)   cntb[b[i]]++;

    ll ans = 0;
    for(int i = 0; i <= a[t]-2; i++){
        ans += (ll)(cnta[i]) * cntb[a[t]-2-i];
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 10984
from scipy.sparse.csgraph import shortest_path
import numpy as np
N,M=map(int,input().split())
abc = [tuple(map(int,input().split())) for i in range(M)]
g = [[10**9]*N for i in range(N)]
for a,b,c in abc:
  a,b = a-1,b-1
  g[a][b]=c
  g[b][a]=c
g = np.array(g)
G,P=shortest_path(g,return_predecessors=True)
ans=set()
for i in range(N):
  for j in range(N):
    if P[i][j]>0 and (P[i][j],j) not in ans:
      ans.add((j,P[i][j]))

print(M-len(ans))

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
	int n, k;
	cin >> n >> k;

	// 二部グラフの考えを使うけど二部グラフじゃない！
	if ( (n - 1) * (n - 2) / 2 >= k )
	{
		int m = (n - 1) * (n - 2) / 2;
		cout << n-1 + m-k << endl;
		for(int i = 2; i <= n; ++i)
		{
			cout << 1 << " " << i << endl;
		}

		for(int i = 2; i <= n - 1; ++i)
		{
			for(int j = i + 1; j <= n; ++j)
			{
				m--;
				if (m >= k) cout << i << " " << j << endl;
				else break;
			}
		}
		return;
	}
	cout << -1;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
typedef long long ll;
using namespace std;

int main(){
    int N, T;
    cin >> N >> T;
    vi(t,N);
    rep(i,N) cin >> t[i];
    int ans = T;
    rep(i,N-1){
        ans += T;
        if(t[i+1] - t[i] < T) ans -= T-(t[i+1] - t[i]);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long signed int ll;

constexpr ll NIL = -20000000000;

vector<pair<int, int>> w;
ll dp[100][100];

ll mmc(int b, int e) {
    if (e == b + 1 || e == b) return 0;
    if (!dp[b][e]) {
        dp[b][e] = -NIL;
        for (int i = b + 1; i < e; i++) {
            dp[b][e] = min(dp[b][e], mmc(b, i) + mmc(i, e) + w[b].first * w[i].first * w[e - 1].second);
        }
    }
    return dp[b][e];
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        w.push_back(make_pair(x, y));
    }
    cout << mmc(0, n) << endl;
}



Measured memory_bytes: 3152
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#define rep(i, n) for(int i=0; i<n; i++)
#define rep_one(i, n) for(int i=1; i<n; i++)
using namespace std;
typedef long long ll;


int main(){
    int n; cin >> n;
    int a=0, w=0, t=0, r=0;
    string s;
    rep(i, n){
        cin >> s;
        if(s == "AC"){
            a++;
        }else if(s == "WA"){
            w++;
        }else if(s == "TLE"){
            t++;
        }else{
            r++;
        }
    }
    cout << "AC x " << a << endl;
    cout << "WA x " << w << endl;
    cout << "TLE x " << t << endl;
    cout << "RE x " << r << endl;
}

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

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 2e5+10 , mod = 1e9+7;

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n;
   cin >> n;
   int a[n];
   for(int i = 0 ; i < n ; i++){
      cin >> a[i];
   }
   sort(a , a + n);
   int ans = 0;
   for(int i = 0 ; i < n ; i++){
      for(int j = i + 1 ; j < n ; j++){
         if(a[i] == a[j])
            continue;
         for(int k = j + 1 ; k < n ; k++){
            if(a[k] == a[j])
               continue;
            if(a[i] + a[j] > a[k])
               ans++;
         }
      }
   }
   cout << ans;
   return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int digit(ll n) {
    int cnt = 0;
    while (n > 0) {
        n /= 10;
        cnt++;
    }
    return cnt;
}

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

    const ll maxi = pow(10, 18);
    ll ans = 1;
    bool valid = true;
    bool zero = false;
    REP(i, 0, N) {
        ll a; cin >> a;
        if (a == 0) {
            zero = true;
            // break;
        }
        if (ans * a < ans || ans * a > maxi) {
            valid = false;
            // break;
        }
        // if (digit(ans) + digit(a) < digit(ans * a)) {
        //     valid = false;
        //     break;
        // }

        ans *= a;
    }
    
    if (zero) {
        cout << 0 << endl;
    } else if (!valid) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
n,l = map(int,input().split())
a = [l+i for i in range(n)]

yotei = sum(a)

if 0 in a:
    print(yotei)
    exit()

if abs(a[0]) < abs(a[n-1]):
    print(yotei-a[0])
else:
    print(yotei-a[n-1])


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

using namespace std;

int
main()
{
	int a, b, p = 0;
	scanf( "%d %d", &a, &b );
	if( a > b ) p += ( a * 2 ) - 1;
	else if( a == b ) p += a * 2;
	else p += ( b * 2 ) - 1;
	printf( "%d\n", p );
	return 0;
}


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

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

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b;
  cin >> a >> b;
  if (a * b % 2 == 0)
    cout << "Even" << endl;
  else
    cout << "Odd" << endl;
}

Measured memory_bytes: 3504
n = int(input())
import math 
result = []
for a in range(1, int(math.sqrt(n) // 1) + 1):
    if n % a == 0:
        b = n // a
        result.append([a, b])
    
best_count = float("inf")
for a_b in result:
    score = a_b[0] + a_b[1] - 2
    if best_count > score:
        best_count = score

print(best_count)

Measured memory_bytes: 3464
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	ll n,k ;
	cin >> n >> k ;
	if(n==k){
		ll ans = 1 ;
		for(int i=0;i<n;i++){
			ll a ; cin >> a ;
			ans = (ans*a%mod+mod)%mod ;
		}
		cout << ans << endl ;
		return 0 ;
	}
	vll p,m ;
	for(int i=0;i<n;i++){
		ll a ; cin >> a ;
		if(a>=0) p.emplace_back(a) ;
		else m.emplace_back(a) ;
	}
	sort(all(p)) ;
	reverse(all(p)) ;
	sort(all(m)) ;
	if(k%2==1&&p.size()==0){
		ll ans = 1 ;
		for(int i=1;i<=k;i++){
			ans = ans*(m.at(m.size()-i)+mod)%mod ;
		}
		cout << ans << endl ;
	}else{
		ll posp = 0 ;
		ll posm = 0 ;
		ll ans = 1 ;
		if(k&1){
			ans = p.at(0) ;
			posp = 1 ;
			k-- ;
		}
		while(k){
			ll a,b ;
			if(p.size()-posp<=1) a = -INF ;
			else a = p.at(posp)*p.at(posp+1) ;
			if(m.size()-posm<=1) b = -INF ;
			else b = m.at(posm)*m.at(posm+1) ;
			if(a>=b){
				ans = a%mod*ans%mod ;
				posp += 2 ;
			}else{
				ans = b%mod*ans%mod ;
				posm += 2 ;
			}
			k -= 2 ;
		}
		cout << ans << endl ;
	}
}

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

int a[1 << 20], ans[1 << 20], maxx[1 << 20];

int main(){
	int k, n;
	scanf("%d",&k);
	n = (1 << k);
	for (int i = 0; i < n; i++) scanf("%d",&a[i]);
	memset(ans, 0, sizeof(ans));
	memset(maxx, 0, sizeof(maxx));
	for (int i = 0; i < n; i++){
		for (int j = i; j < n; j = (j + 1) | i){
			ans[j] = max(ans[j], a[i] + maxx[j]);
			maxx[j] = max(maxx[j], a[i]);
		}
	}
	for (int i = 1; i < n; i++) ans[i] = max(ans[i], ans[i - 1]);
	for (int i = 1; i < n; i++) printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 13312
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;
const ll mod=1e9+7;

int main(){
    ll x;
    cin >> x;
    if(x>=30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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


int main(){
	int H, W;
	while(true){
		scanf("%d %d", &H, &W);
		if(H==0&&W==0)
			break;
		for(int k=0;k<W;k++)
			printf("#");
		printf("\n");
		for(int i=0;i<H-2;i++){
			printf("#");
			for(int j=0;j<W-2;j++)
				printf(".");
			printf("#");
			printf("\n");
		}
//		printf("\n");
		for(int k=0;k<W;k++)
			printf("#");
		printf("\n\n");
	}
	
}


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

#define int           long long
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (long long )(9e18)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii >

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){
    cerr << name << " = " << arg1 << endl;
}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args){
    const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);
}
template<typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2> &q){ 
    in >> q.F >> q.S; return in;
}
template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> &q){
    out << q.F << " " << q.S; return out;
}
template< typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F+p2.F, p1.S+p2.S};
}
template< typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F-p2.F, p1.S-p2.S};
}

void solve() {
    int n;
    cin >> n;
    n = n%10;
    if(n == 3){
        cout <<"bon";
    } else if(n == 0 || n == 1 || n == 6 || n == 8){
        cout <<"pon";
    } else{
        cout <<"hon"; 
    }
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   

    int t = 1;
    start = clock(); 

    cout << fixed << setprecision(20);

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);
    // freopen("error.txt", "w", stderr);
    // #endif
   
    //cin >> t;
    
    for(int i = 1; i <= t; ++i){
        //cout << "Case #" << i << ": "; 
        solve();
        //cout << endl;
    }
    //cerr << time(start);
    return 0;
}


Measured memory_bytes: 3652
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#define log(args...)
#else
#define log(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); logf(_it, args); }
void logf(istream_iterator<string> it) {
}
template<typename T, typename ... Args>
void logf(istream_iterator<string> it, T a, Args ... args) {
	cout << *it << " = " << a << endl;
	logf(++it, args...);
}
#endif

#define forn(i,k,n) for(ll i=(k); i<(n); i++)

const double PI = acos(-1);
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

void solve() {
	cins(s);
	for (int i = 0; i < s.size() / 2; i++) {
		if (s[i] != s[s.size() - 1 - i]) {
			cout << "No" << endl;
			return;
		}
	}
	for (int i = 0; i < (s.size() - 1) / 2; i++) {
		if (s[i] != s[(s.size() - 1) / 2 - 1 - i]) {
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
}

int main() {
	cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	solve();
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  string S;
  cin >> N >> S;
  ll x = 0;
  ll max_x = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == 'I')
      x++;
    else
      x--;
    max_x = max(max_x, x);
  }
  cout << max_x << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n;
    cin>>n;
    long long int ans=0;
    if(n%2==0)
    {
        n=n>>1;
        while(n>0)
        {
            ans+=n/5;
            n/=5;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3608
Module _20190525

    Sub Main()

        Dim sRead As String = Console.ReadLine()
        Dim N As Integer = sRead.Split(" ")(0)
        Dim M As Integer = sRead.Split(" ")(1)

        Dim sFirst As String = Console.ReadLine()

        Dim iMin As Integer = sFirst.Split(" ")(0)
        Dim iMax As Integer = sFirst.Split(" ")(1)

        For i As Integer = 2 To M

            Dim sTemp As String = Console.ReadLine()

            If CInt(sTemp.Split(" ")(0)) > iMin Then

                iMin = CInt(sTemp.Split(" ")(0))

            End If

            If CInt(sTemp.Split(" ")(1)) < iMax Then

                iMax = CInt(sTemp.Split(" ")(1))

            End If

        Next

        If iMax - iMin + 1 < 0 Then

            Console.WriteLine(0)

        Else

            Console.WriteLine(iMax - iMin + 1)

        End If

    End Sub

End Module


Measured memory_bytes: 17324
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  long long int a[n];
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  long long int x=a[0];
  long long int y=0;
  for(int i=1; i<n; i++){
    y+=a[i];
  }
  long long int mi = abs(x-y);
  for(int i=1; i<n-1; i++){
    x+=a[i];
    y-=a[i];
    mi = min(mi,abs(x-y));
  }
  cout << mi << endl;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main()
{
    long long  a = 0,b = 0,c = 0,d = 0;
   long long max = 0;
    cin >> a >> b >> c >> d;
    max = a * c;
    if (max < a * d)
        max = a * d;
    if (max < b * d)
        max = b * d;
    if (max < b * c)
        max = b * c;
    cout << max << endl;

   
}

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

int main(){
  string S;
  int counter = 0;
  cin >> S;
  rep(i,3){
    char t;
    cin >> t;
    if(S.at(i) == t) counter++;
  }
  cout << counter << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tmp = Console.ReadLine().Split(' ');
            int N = int.Parse(tmp[0]);
            int M = int.Parse(tmp[1]);

            int[] stuX = new int[N];
            int[] stuY = new int[N];

            int[] chkX = new int[M];
            int[] chkY = new int[M];

            for(int i = 0; i < N; i++)
            {
                tmp = Console.ReadLine().Split(' ');
                stuX[i] = int.Parse(tmp[0]);
                stuY[i] = int.Parse(tmp[1]);
            }

            for (int i = 0; i < M; i++)
            {
                tmp = Console.ReadLine().Split(' ');
                chkX[i] = int.Parse(tmp[0]);
                chkY[i] = int.Parse(tmp[1]);
            }

            double distance = 4*Math.Pow(10,8) + 1;
            double tmpDis = 0;
            int minDisIndex = -1;

            for(int i=0;i< N;i++)
            {
                distance = 4 * Math.Pow(10, 8) + 1;
                minDisIndex = -1;
                for(int j=0;j< M; j++)
                {
                    tmpDis = Math.Abs(stuX[i] - chkX[j]) + Math.Abs(stuY[i] - chkY[j]);
                    if (distance > tmpDis)
                    {
                        distance = tmpDis;
                        minDisIndex = j;
                    }
                }
                Console.WriteLine(minDisIndex + 1);
            }

            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11220
N, M = list(map(int,input().split()))
H= list(map(int,input().split()))

t=[0]*N
for i in range(M):
  A,B= list(map(int,input().split()))
  t[A-1]=max(t[A-1],H[B-1])
  t[B-1]=max(t[B-1],H[A-1])

ans=0
for i in range(N):
  if t[i]<H[i]:
    ans+=1
print(ans)



Measured memory_bytes: 85012
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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 pair<ld, ld> P;
typedef vector<ld> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
ld EPS=0.001;
// cout << "Case #" << index << " :IMPOSSIBLE";
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
  
    cout << fixed << setprecision(10);
    ll a;
    string b;
    cin>>a>>b;
    ll c=(b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');
    cout<<a*c/100<<endl;
}


Measured memory_bytes: 3640