akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        for(int x=1;x<=n;x++) {
            if(sc.next().equals("Y")) {
                System.out.println("Four");
                return;
            }
        }
        System.out.println("Three");
    }
}


Measured memory_bytes: 21588
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
#define x first
#define y second
#define ll long long
#define _for(i,j,k) for(int i=j;i<k;i++)
#define endl  '\n'
#define inf 1<<29-1
#define ull unsigned long long  
const int mod=1e9+7;
const int MAX=1e5+5;

int main()
{
 	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	ll n,sum=0;
 	cin>>n;
 	
 	for(int i=1;i<=n;i++)
 	{
 		if(i%3!=0&&i%5!=0)
 		{
 			sum+=i;
		 }
	 }
 	cout<<sum;
}




Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int ch[10000005][3],ed[10000005],cnt=1,ans[10000005];
bool rev[10000005];
char s[200005];
void pushr(int x){swap(ch[x][1],ch[x][2]);rev[x]^=1;}
void pushdown(int x)
{
    if(!rev[x])return;
    for(int i=0;i<=2;i++)if(ch[x][i])pushr(ch[x][i]);
    rev[x]=0;
}
void dfs(int x)
{
    pushdown(x);
    swap(ch[x][0],ch[x][2]),swap(ch[x][1],ch[x][2]);
    if(ch[x][0])dfs(ch[x][0]);
}
void get(int x,int now,int pw)
{
    pushdown(x);
    if(ed[x]!=0xffffffff)ans[ed[x]]=now;
    if(ch[x][0])get(ch[x][0],now,pw*3);
    if(ch[x][1])get(ch[x][1],now+pw,pw*3);
    if(ch[x][2])get(ch[x][2],now+2*pw,pw*3);
}
int main()
{
    int n,m=1;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)m*=3;
    memset(ed,0xff,sizeof(ed));
    for(int i=0;i<m;i++)
    {
        int now=1,tmp=i;
        for(int k=0;k<n;k++)
        {
            int t=tmp%3;
            tmp/=3;
            if(!ch[now][t])ch[now][t]=++cnt;
            now=ch[now][t];
        }
        ed[now]=i;
    }
    scanf("%s",s+1);
    int q=strlen(s+1);
    for(int i=1;i<=q;i++)
    {
        if(s[i]=='S')pushr(1);
        else dfs(1);
    }
    get(1,0,1);
    for(int i=0;i<m;i++)printf("%d ",ans[i]);
    return 0;
}

Measured memory_bytes: 55648
#include <iostream>
using namespace std;
int main () {
    int no, taro = 0, hanako = 0;
    cin >> no;
    for (int i = 0; i < no; i++) {
        string t, h;
        cin >> t >> h;
        if (t > h)
            taro += 3;
        else if(h > t)
            hanako += 3;
        else {
            taro++;
            hanako++;
        }
    }
    cout << taro << " " << hanako << '\n';
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
int a[123456];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int ans = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] == i) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  if (a[n] == n) ans++;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<utility>
#include<climits>
#include<set>
using namespace std;
#define ll long long

void solve(){

	int n;cin>>n;
	int size=1e6 + 5;

	int v[size]={0};
	for(int i=0;i<n;i++)
	{
		int a;
		cin>>a;
		v[a]++;
	}
	int ans=0;
	int h[size]={0};
	for(int i=0;i<size-1;i++)
	{
		if(v[i]==1 and h[i]==0)
		{
			for(int j=i;j<size-1;j+=i)
			{
				h[j]=1;
			}
			ans++;
		}
		else if(v[i]!=0)
		{
			for(int j=i;j<size-1;j+=i)
				h[j]=1;
		}
	}
	cout<<ans;
}
int main(){ 
	ios_base::sync_with_stdio(false);
	    cin.tie(0);
	    cout.tie(0);
	    
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);
	    freopen("output.txt","w",stdout);
	#endif


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

}


Measured memory_bytes: 11468
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep1(i,n) for (int i=1; i<=(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

void solve() {
  int n; cin >> n;
  vi arr(n);
  rep(i,n) cin >> arr[i];
  cout << accumulate(all(arr), 0) - n << endl;
  return;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int x[5];
  REP(i, 5) cin>>x[i];
  REP(i, 5){
    if(x[i] == 0){
      cout << i + 1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3560
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, A = getNM()
w = []
v = []
for i in range(N):
    a, b = getNM()
    w.append(a)
    v.append(b)

# limit回までコストカットできる
def knapsack_6(N, upper, limit, weight, value):
    dp = [[[0] * (upper + 1) for i in range(limit + 1)] for j in range(N + 1)]

    for i in range(N):
        # ボーナスでコスト１にするのを使ったか 使うと-1する
        for j in range(limit + 1):
            for l in range(upper + 1):
                # デフォルト　elseで下に置けない（場合分けが難しいので）
                dp[i + 1][j][l] = dp[i][j][l]
                # 追加
                if l >= weight[i]:
                    dp[i + 1][j][l] = max(dp[i][j][l], dp[i][j][l - weight[i]] + value[i])
                # 追加（コストカット）
                if l >= 1 and limit >= 1:
                    # j - 1の段で行ったl >= weight[i]の処理が先に実行されるのでmaxの候補にdp[i + 1][j - 1][l]を入れる
                    dp[i + 1][j - 1][l] = max(dp[i + 1][j - 1][l], dp[i][j - 1][l], dp[i][j][l - 1] + value[i])
    return dp[N][0][upper]

print(knapsack_6(N, A, 1, w, v))

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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 int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) cout << s << endl;
    else cout << "red" << endl;
}

Measured memory_bytes: 3576
#include <stdio.h>

int main() {
#ifdef TEST
    freopen("input", "r", stdin);
#endif

    int a, b, c;
    while (scanf("%d %d %d", &a, &b, &c), a != -1 || b != -1 || c != -1) {
        if(a == -1 || b == -1) printf("F\n");
        else if (a + b >= 80) printf("A\n");
        else if (a + b >= 65) printf("B\n");
        else if (a + b >= 50) printf("C\n");
        else if (a + b >= 30) {
            c >= 50 ? printf("C\n") : printf("D\n");
        }
        else printf("F\n");
    }

    return 0;
}



Measured memory_bytes: 2120
// D - Moving Piece

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

ll N, K;
ll P[5000];
ll C[5000];
ll max_score[500];

ll get_max_score(int i, ll k, ll base_score) {
	ll max_score = -INF;
	ll score = base_score;
	int next_i = P[i];
	for (int j=0; j<k; j++) {
		score += C[next_i];
		max_score = max(max_score, score);
		next_i = P[next_i];
		//cout << "  j=" << j << " score=" << score << " max_score=" << max_score << endl; // **** debug ****
	}

	return max_score;
}

// マスiからスタート
ll solve(int i) {
	// まずループの長さと一周した時のスコアをカウント
	int loop_len = 0;
	ll loop_score = 0;
	int next_i = P[i];
	while(1) {
		loop_len++;
		loop_score += C[next_i];
		if (next_i == i) break;
		else next_i = P[next_i];
	}

	//cout << "i=" << i << " loop_len=" << loop_len << " loop_score=" << loop_score << endl; // **** debug ****

	// K = ループs回 + tマス移動 の時、s回目のループ以降をシミュレート
	int s = K / loop_len;
	int t = K % loop_len;

	if (loop_score <= 0) {
		// loop_scoreが0以下の時は高々1回ループを見ればOK
		s = min(s, 1);
	}

	if (t == 0) {
		// 1回は動かさないといけないことに対応するために
		// ループちょうどで終わる場合も1回はループをシミュレートする
		s--;
		t = loop_len;
	}

	ll max_score = -INF;

	// s回目のループ
	if (s >= 1) {
		ll base_score = (s-1) * loop_score;
		max_score = get_max_score(i, loop_len, base_score);
	}

	// 余りのtマス移動
	ll base_score = s * loop_score;
	if (t > 0) max_score = max(max_score, get_max_score(i, t, base_score));

	return max_score;
}

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

	for (int i=0; i<N; i++) {
		cin >> P[i];
		P[i]--;
	}

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

	ll ans = -INF;
	for (int i=0; i<N; i++) {
		ans = max(ans, solve(i));
	}

	cout << ans << endl;

	return 0;
}

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

namespace Aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            Console.WriteLine(string.Join(" ", Enumerable.Range(0, int.Parse(Console.ReadLine())).Select(p => Console.ReadLine().Trim().Split(' ').Select(i => int.Parse(i)).ToArray()).OrderByDescending(p => p[1]).ThenBy(p => p[0]).ToArray()[0].Select(p => p.ToString()).ToArray()));
        }
    }
}

Measured memory_bytes: 10652
H,W = map(int,input().split())
a = []
for i in range(H):
    a.append(input())

MOD = 10**9+7


dp = [ [ 0 for i in range(W)] for j in range(H)]

dp[0][0] = 1
for i in range(H):
    for j in range(W):
        if i != 0:
            dp[i][j] += dp[i-1][j]
        if j != 0:
            dp[i][j] += dp[i][j-1]
        if a[i][j] == "#":
            dp[i][j] = 0
print(dp[H-1][W-1] % MOD)

Measured memory_bytes: 218740
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int top,s[1000];
void push(int x){
	s[++top]=x;
}
int pop()
 { top--;
  return s[top+1];
}

int main()
{
	int a,b;
	top=0;
	char s[100];
	while(scanf("%s",s)!=EOF){
		if(s[0]=='+'){a=pop();
		b=pop();push(a+b);}
		else if(s[0]=='-'){
		b=pop();a=pop();
		push(a-b);
		}
		else if(s[0]=='*'){
			a=pop();b=pop();
			push(a*b);
		}else{push(atoi(s));//atoi(s)将字符串形式的数字转换成整型数字// 
		}
	}
cout<<pop()<<endl;
return 0;
}


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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int sum = 0;
  for (int i = 0; i < m; ++i){
	int a;
	cin >> a;
	sum += a;
  }
  (n - sum >= 0) ? cout << n - sum << "\n" : cout << -1 << "\n";
return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

int main() {
  int n,k;
  S2(n,k);
  LL ans = 0;
  rep(i,max(k,1),n+1) {
    ans += n - i;
    int tot = i - k;
    ans += ((n / i) - 1) * 1LL * tot;
    ans += max((n % i) - k + 1, 0);
  }
  cout << ans << "\n";
  return 0;
}


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

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n;
    cin >> n;
    vector<int> b(n,0);
    vector<vector<int>> a(n,vector<int>(n-1));
    vector<bool> d(n,true);
    for (int i = 0;i < n;++i) for (int j = 0;j < n-1;++j) {
        scanf("%d",&a[i][j]);
        a[i][j]--;
    }
    int ans = 0;
    bool ok = true;
    unordered_set<int> st;
    while (ok) {
        ok = false;
        vector<int> c;
        for (int i = 0;i < n;++i) if (d[i] && b[i] < n-1) {
            d[i] = false;
            if (st.find(a[i][b[i]]*1001+i) != st.end()) {
                ok = true;
                c.push_back(i);
                c.push_back(a[i][b[i]]);
                st.erase(a[i][b[i]]*1001+i);
                b[a[i][b[i]]]++;
                b[i]++;
            } else {
                st.insert(i*1001+a[i][b[i]]);
            }
        }
        for (int& i : c) d[i] = true;
        ans++;
    }
    for (int i = 0;i < n;++i) if (b[i] != n-1) ans = 0;
    cout << ans-1 << endl;
    // for (int i = 0;i < n;++i) p_ary(a[i],0,n-1,j);
    return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    printf("%.10lf\n", (double)w * (double)h / (double)2);
    if (h % 2 == 0 && h / 2 == y && w % 2 == 0 && w / 2 == x) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }
    return 0;
}


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

int main(){
  vector<vector<int>> c(3,vector<int>(3));
  for(vector<int> &i:c)
    for(int &j:i)
      cin>>j;
  bool bo=true;
  vector<int> vei(2),vej(2);
  for(int i=0;i<2;i++){
    vei.at(i) = c.at(0).at(i) - c.at(0).at(i+1);
    vej.at(i) = c.at(i).at(0) - c.at(i+1).at(0);
  }
  for(int i=0;i<3;i++){
    for(int j=0;j<2;j++)
      if(vei.at(j) != c.at(i).at(j) - c.at(i).at(j+1))
        bo=false;
    for(int j=0;j<2;j++)
      if(vej.at(j) != c.at(j).at(i) - c.at(j+1).at(i))
        bo=false;
  }
  if(bo)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()

lst = []
for i in range(n):
    if a[i] % 2 == 0:
        lst.append(a[i])

for i in lst:
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    print('DENIED')
    quit()
print('APPROVED')

Measured memory_bytes: 38384
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),res=0;
    int old=sc.nextInt();
    res=old;
    for(int i=1;i<n;i++) {
    	int now=sc.nextInt();
    	res+=Math.max(0, now-old);
    	old=now;
    }
    System.out.println(res);
  }
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  map<string,ll> m;
  rep(i,n){
    string s; cin>>s;
    m[s]++;
  }
  
  cout<<"AC x "<<m["AC"]<<endl;
  cout<<"WA x "<<m["WA"]<<endl;
  cout<<"TLE x "<<m["TLE"]<<endl;
  cout<<"RE x "<<m["RE"]<<endl;
  
}

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

import javax.lang.model.element.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solution(String[] args) throws Exception{

		int N = nextInt();
		N=N%10;
		if(N==2||N==4||N==5||N==7||N==9){
			pw.println("hon");
		}else if(N==0||N==1||N==6||N==8){
			pw.println("pon");
		}else{
			pw.println("bon");
		}


	}

public static class Pair {
	String N;
	int V;

	Pair(String N, int V) {
		this.N = N;
		this.V = V;
	}

	public String getN() {
		return N;
	}

	public int getV() {
		return V;
	}

	public static Comparator<Pair> getComparator() {
		return Comparator.comparing(Pair::getN).thenComparing(Pair::getV, Comparator.reverseOrder());
	}
}


	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 25432
#include<iostream>
#include<cstdlib>
#include<utility>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
using namespace std;

int main() {

	int n;

	cin >> n;

	int count = 0;

	int c[10][10] = { 0 };

	int i, j, k, l;

	for (i = 1; i <= n; i++) {
		j = i % 10;
		k = i;
		while (k >= 10) k /= 10;
		c[j][k]++;
	}

	for (i = 0; i <= 9; i++) {
		for (j = 0; j <= 9; j++) {
			count += c[i][j] * c[j][i];
		}
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll a,b;
   while (cin>>a>>b)
   {
       ll x=0;
       while (a%4!=0)
       {
           x^=a;
           a++;
       }
       while (b%4!=0)
       {
           x^=b;
           b--;

       }
       ll ans=x^b;
       cout<<ans<<endl;
   }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
   int  a,b,c,d;
   cin>>a>>b>>c>>d ;
   int t= (a+d-1)/d ;
   int s= (c+b-1)/b ;
   if(t>=s)
   cout <<"Yes"<<endl;
   else
   cout<<"No" <<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;
const int MAX_N = 2e5;

int main(){
  int n;
  cin >> n;
  cout << (1000 - (n % 1000))%1000 << endl;
}

Measured memory_bytes: 3604
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define		CH		ch=(getchar())

inline		int		IN(){
	int x=0,f=1;char ch;
	for (CH;ch>'9'||ch<'0';CH) if (ch=='-') f=-1;
	for (;ch>='0'&&ch<='9';CH) (x*=10)+=ch-'0';
	return x*f;
}

int i,j,k,l,n,m,p;
long long a[105],Max,ans;

int main(){
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%lld",&a[i]);
	for (;;){
		Max=0;
		for (i=1;i<=n;i++) if (a[i]>Max){Max=a[i];p=i;}
		if (Max<n){
			printf("%lld",ans);
			return 0;
		}
		ans+=Max/(long long)n;
		for (i=1;i<=n;i++) if (i!=p) a[i]+=Max/(long long)n;
		a[p]%=(long long)n;
	}
}


Measured memory_bytes: 128
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    }

    public static class Edge {
        int u;
        int v;
        int w;

        public Edge(int u, int v, int w) {
            this.u = u;
            this.v = v;
            this.w = w;

        }
    }
    public static class Node {
        List<Edge> edge = new LinkedList<>();
    }

    public static void main(String[] args) {

        int N;
        HashMap<Integer,List<Edge>> set;
        Node[] node;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            set = new HashMap<>();
            node = new Node[N];
            for (int i = 0; i < N; i++) {
                node[i] = new Node();
            }
            for (int i = 0; i < N - 1; i++) {
                int u = sc.nextInt();
                int v = sc.nextInt();
                int w = sc.nextInt();
                Edge e = new Edge(u, v, w);
                setSet(set,e,u);
                setSet(set,e,v);
                node[u-1].edge.add(e);
                node[v-1].edge.add(e);
            }
        }
        int[] distans = new int[N];
        HashSet<Edge> visited = new HashSet<>();
        Deque<Integer> queue = new ArrayDeque<>();
        queue.push(1);
        distans[0] = 0;
        Integer target;
        while((target = queue.pollFirst()) != null){
            //List<Edge> list = set.get(target);
            List<Edge> list = node[target -1].edge;
            for(Edge e : list){
                if(visited.contains(e)){
                    continue;
                }else{
                    int d = (distans[target-1] + e.w) %2;
                    int i;
                    if(e.u != target ){
                        i = e.u;
                    }else{
                        i = e.v;
                    }
                    queue.addLast(i);
                    distans[i  -1] = d;
                    debug(i+":"+distans[i  -1]);
                    visited.add(e);
                }
            }
        }
        for(int i : distans){
            System.out.println(i%2);
        }
    }

    private static void setSet(HashMap<Integer,List<Edge>> set,Edge e, int i){
        List<Edge> list = set.get(i);
        if(list == null){
            list = new ArrayList<>();
        }
        list.add(e);
        set.put(i, list);
    }

}


Measured memory_bytes: 125260
use proconio::input;

fn main() {
    input! {
        n: usize,
        m: usize,
        abc: [(i64, i64, i64); n],
        def: [(i64, i64, i64); m]
    };
    let mut map_x = std::collections::BTreeMap::new();
    let mut map_y = std::collections::BTreeMap::new();
    for &(a, b, c) in abc.iter() {
        map_x.entry(a).or_insert(0);
        map_x.entry(b).or_insert(0);
        map_y.entry(c).or_insert(0);
    }
    for &(d, e, f) in def.iter() {
        map_x.entry(d).or_insert(0);
        map_y.entry(e).or_insert(0);
        map_y.entry(f).or_insert(0);
    }
    map_x.entry(0).or_insert(0);
    map_y.entry(0).or_insert(0);

    let mut xs = vec![0; map_x.len()];
    for (i, (&x, v)) in map_x.iter_mut().enumerate() {
        *v = i;
        xs[i] = x;
    }
    let mut ys = vec![0; map_y.len()];
    for (i, (&y, v)) in map_y.iter_mut().enumerate() {
        *v = i;
        ys[i] = y;
    }

    let h = map_x.len() * 2;
    let w = map_y.len() * 2;
    let mut tbl = vec![vec![Some(false); w]; h];
    for (a, b, c) in abc.iter() {
        let tbl_a = map_x.get(a).unwrap() * 2;
        let tbl_b = map_x.get(b).unwrap() * 2;
        let tbl_c = map_y.get(c).unwrap() * 2;
        (tbl_a..=tbl_b).for_each(|x| tbl[x][tbl_c] = None);
    }
    for (d, e, f) in def.iter() {
        let tbl_d = map_x.get(d).unwrap() * 2;
        let tbl_e = map_y.get(e).unwrap() * 2;
        let tbl_f = map_y.get(f).unwrap() * 2;
        (tbl_e..=tbl_f).for_each(|y| tbl[tbl_d][y] = None);
    }

    let d = vec![(-1, 0), (0, -1), (0, 1), (1, 0)];
    let mut q = std::collections::VecDeque::new();
    let (sx, sy) = (map_x.get(&0).unwrap() * 2, map_y.get(&0).unwrap() * 2);
    tbl[sx][sy] = Some(true);
    q.push_back((sx, sy));
    while let Some((x, y)) = q.pop_front() {
        for &(d_x, d_y) in d.iter() {
            let (nx, ny) = (x as i64 + d_x, y as i64 + d_y);
            if (0..w as i64).contains(&ny) && (0..h as i64).contains(&nx) {
                let (nx, ny) = (nx as usize, ny as usize);
                if tbl[nx][ny] != Some(false) {
                    continue;
                }
                tbl[nx][ny] = Some(true);
                q.push_back((nx, ny));
            }
        }
    }

    let mut ans = 0_i64;
    for x in 0..h {
        for y in 0..w {
            if tbl[x][y] != Some(true) {
                continue;
            }
            if x == 0 || x == h - 1 || y == 0 || y == w - 1 {
                println!("INF");
                return;
            }
            if x % 2 == 0 || y % 2 == 0 {
                continue;
            }
            let ex = xs[x / 2 + 1] - xs[x / 2];
            let ey = ys[y / 2 + 1] - ys[y / 2];
            ans += ex * ey;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 37732
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<string>
#include<complex>
#include<algorithm>
#include<vector>
#include<math.h>
#include<set>
#include<map>

int main()
{
	int r, g;
	scanf("%d%d", &r, &g);
	printf("%d\n", g * 2 - r);
	
	return 0;
}

Measured memory_bytes: 256
//Boxes and Candies

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n,x,ans=0;cin>>n>>x;
    vecrep(n,a,int);
    int t=a[0];
    rep(i,1,n){
        t+=a[i];
        if(t>x){
            int s=t-x;
            if(s>a[i]){
                s-=a[i];
                t-=a[i];
                ans+=a[i];
                a[i]=0;
                a[i-1]-=s;
            }else{
                a[i]-=s;
            }
            ans+=s;
            t-=s;
        }
        t-=a[i-1];
    }
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 4060
#演習2-17

coins = [10, 50, 100, 500]
def solve(price):
    maisuu = list(map(int, input().split()))
    pay = [0, 0, 0, 0]
    otsuri = sum([maisuu[i] * coins[i] for i in range(len(coins))]) - price
    otsuri_maisuu = [otsuri % 50 // 10, otsuri % 100 // 50, otsuri % 500 // 100, otsuri // 500]
    for types, saifu, tsuri in zip(coins, maisuu, otsuri_maisuu):
        if saifu > tsuri:
            print(types, saifu - tsuri)
            
p = int(input())
solve(p)
while True:
    p = int(input())
    if not p:
        break
    print()
    solve(p)


Measured memory_bytes: 5624
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) {
        if (a[i] == 0) {
            println(0);
            return 0;
        }
    }
    ll prod = 1;
    rep(i, n) {
        if (a[i] > (ll)1000000000000000000 / prod) {
            println(-1);
            return 0;
        }
        prod *= a[i];
    }
    println(prod);

    return 0;
}

Measured memory_bytes: 3984
def resolve():
    import math
    n=int(input())
    d=list(map(int,input().split()))
    d2=[0]*n
    c=1
    for m in d:
        d2[m]+=1

    # print(d2)
    for i in range(1,n):
        c=c* pow(d2[i-1],d2[i],998244353)

    if d2[0]>1 or d[0]!=0:
        print(0)
    else:
        print(c % 998244353)
resolve()

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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int, int>;
using ppa = pair<pa, int>;
#define SORT(v, n) sort(v, v + n);
#define ALL(v) v.begin(), v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v), greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)), v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for (int i = (b - 1); i >= a; i--)
#define rrep(i, n) RFOR(i, 0, n)
#define INF INT_MAX
#define SUP INT_MIN
#define mins(a, b) a = min(a, b)
#define maxs(a, b) a = max(a, b)

// 4近傍
// int dy[]={0, 1, 0, -1};
// int dx[]={1, 0, -1, 0};

// 8近傍
// int dy[]={0,0,1,-1,1,1,-1,-1};
// int dx[]={1,-1,0,0,1,-1,1,-1};

// const ll MOD = 1000000007;

ll pow_mod(ll a, ll b, ll mod) {
    ll tmp = 1;
    a %= mod;
    if (b > 0) {
        tmp = pow_mod(a, b / 2, mod);
        if (b % 2)
            tmp = (((tmp * tmp) % mod) * a) % mod;
        else
            tmp = (tmp * tmp) % mod;
    }
    return tmp;
}

ll gcd(ll x,ll y){
    if(x == 0) return y;
    return gcd(y%x,x);
}

void solve(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int x = 0, ans = 0;
    for(auto c : s){
        x += (c == 'I' ? 1 : -1);
        maxs(ans,x);
    }
    cout << ans << endl;
}

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

    solve();

    return 0;
}


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

int n;
vector<int> pre, in, ans;

template <typename Itr> void postorder(Itr ps, Itr pe, Itr is, Itr ie) {
  if (ps == pe) {
    ans.push_back(*ps);
    return;
  }
  auto root_pos = find(in.begin(), in.end(), *ps);
  if (root_pos == is)
    postorder(ps + 1, pe, is + 1, ie);
  else if (root_pos == ie)
    postorder(ps+1, pe, is, ie - 1);
  else {
    postorder(ps + 1, ps + distance(is, root_pos), is, root_pos - 1);
    postorder(ps + distance(is, root_pos) + 1, pe, root_pos + 1, ie);
  }
  ans.push_back(*ps);
}

int main() {
  cin >> n;
  pre = vector<int>(n);
  in = vector<int>(n);
  for (int i = 0; i < n; i++)
    cin >> pre[i];
  for (int i = 0; i < n; i++)
    cin >> in[i];
  postorder(pre.begin(), --pre.end(), in.begin(), --in.end());
  for (int i = 0; i < n; i++)
    cout << ans[i] << ((i == n - 1) ? "" : " ");
  cout << endl;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector <int> x(n);
  REP(i, n) {
	cin >> x[i];
  }
  int ans = 1e9;
  REP1(i, 100) {
	int cost = 0;
	REP(j, n) {
	  cost += (x[j] - i) * (x[j] - i);
	}
	ans = min(ans, cost);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // clang-format off
using namespace std;
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (int i = (a), lim_i = (b); i < lim_i; i++)
#define REP(i, ...) REP_((i), __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Mar  7 21:00:02 JST 2020
 **/

signed main() {
    Int n, P;
    cin >> n >> P;
    string s;
    cin >> s;
    Int ans = 0;
    if (P == 2 || P == 5) {
        REP(i, n) {
            if ((s[i] - '0') % P) continue;
            ans += i + 1;
        }
    } else {
        Int cur = 1;
        vector<Int> a(n);
        for (Int i = n - 1; i >= 0; i--) {
            a[i] = (s[i] - '0') * cur % P;
            (cur *= 10) %= P;
        }
        map<Int, Int> mp;
        mp[0] = 1;
        Int acc = 0;
        REP(i, n) {
            (acc += a[i]) %= P;
            ans += mp[acc];
            mp[acc]++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 2580
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int h = sc.nextInt();
            int w = sc.nextInt();
            if(h == 0 && w ==0){
                break;
            }
            for(int i = 0; i < h; i++){
                for(int j = 0; j < w; j++){
                    if(i == 0 || i == h-1){
                        System.out.print("#");
                    }else if(j ==0 || j == w-1){
                        System.out.print("#");
                    }else{
                        System.out.print(".");
                    }
                }
                System.out.println("");
            }
            System.out.println("");
        }
    }
}
                  



Measured memory_bytes: 33772
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static int n;
    static String s;
    static int[] whiteToBlack;
    static int[] blackToWhite;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        s = sc.next();

        whiteToBlack = new int[n + 2];
        for (int i = n; i > 0; i--) {
            whiteToBlack[i] = (s.charAt(i - 1) == '.' ? 1 : 0) + whiteToBlack[i + 1];
        }
        whiteToBlack[0] = whiteToBlack[1];

        blackToWhite = new int[n + 2];
        for (int i = 1; i < n + 1; i++) {
            blackToWhite[i] = (s.charAt(i - 1) == '#' ? 1 : 0) + blackToWhite[i - 1];
        }
        blackToWhite[n + 1] = blackToWhite[n];

//        debug(whiteToBlack);
//        debug(blackToWhite);


        int min = n;
        for (int i = 1; i < n + 2; i++) {
            // i以上は黒にする
            min = Math.min(whiteToBlack[i] + blackToWhite[i - 1], min);
        }

        System.out.println(min);
    }

    static void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }


}


Measured memory_bytes: 28448
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			return str;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			
			return Long.parseLong(next());
		}

		BigInteger nextBigIntger() {
			BigInteger bb = new BigInteger(next());
			return bb;
		}
	}

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n  =sc.nextInt();
		HashMap<Integer,Integer> map = new HashMap<>();
		for(int i=0;i<n;i++){
		int num = sc.nextInt();
		if(map.containsKey(num))
			map.remove(num);
		else
			map.put(num, 1);
		}
		System.out.println(map.size());
		
	}
}


Measured memory_bytes: 44984
#include<bits/stdc++.h>
using namespace std;
 
int n, w;
int a[111], b[111];
int memo[111][11111];
 
int solve(int i, int p){
 
  if(p < 0) return -1<<28;
  if(i == n) return 0;
  if(memo[i][p]) return memo[i][p];
   
  int ans = 0;
  return memo[i][p] = ans += max(solve(i+1, p), solve(i, p-b[i])+a[i]);
 
}
 
int main(){
 
  cin >> n >> w;
  for(int i=0;i<n;i++) cin >> a[i] >> b[i];
  cout << solve(0, w) << endl;
 
}

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


int main(){
    ll N,M;
    cin >> N >> M;
    ll m = M/2;
    ll ans = 0;
    if(m - N == 0) ans = N;
    else if(m-N < 0) ans = m;
    else {
        ans = N + (M-2*N)/4;
    }
    cout << ans << endl;
}


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

#define inf pow(2,31)-1
typedef pair<int,int> pii ; //first:now-vertex second:total-cost

vector< pii > point[500000] ;
priority_queue< pii, vector<pii>, greater<pii> > que ;
int v, e, r ;
int data[100000] ;

void solve()
{
  fill( data, data+v, inf ) ;
  que.push( pii( r,0 ) ) ;
  while ( que.size() )
  {
    pii now = que.top() ;
    que.pop() ;
    //printf("[debug]now:%d,%d\n", now.first, now.second ) ;
    if ( data[ now.first ] > now.second )
    {
      data[ now.first ] = now.second ;
      for ( int i = 0 ; i < point[ now.first ].size() ; i++ )
      {
        pii edge = point[ now.first ][i] ;
        que.push( pii( edge.first, now.second + edge.second ) ) ;
        //printf("[debug]pushed:%d,%d\n", edge.first, now.second + edge.second ) ;
      }
    }
  }
}

int  main()
{
  int s, t, d ;
  cin >> v >> e >> r ;
  for ( int i = 0 ; i < e ; i++ )
  {
    cin >> s >> t >> d ;
    point[s].push_back( pii( t, d ) ) ;
  }
  solve() ;
  for ( int i = 0 ; i < v ; i++ )
  {
    if ( data[i] == inf ) puts("INF") ;
    else printf("%d\n",data[i]) ;
  }
  return 0 ;
}

Measured memory_bytes: 29804
// finish date: 2019/07/20

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    int N;
    cin >> N;
    vi a(N), b(N, 0);
    vvi fac(N);
    FOR(i, 1, N + 1) {
        int j = i + i;
        while (j <= N) {
            fac[j - 1].emplace_back(i);
            j += i;
        }
    }
    rep(i, N) {
        cin >> a[i];
    }
    for (int i = N; i > 0; i--) {
        if ((a[i - 1] + b[i - 1]) % 2) {
            b[i - 1] = 1;
            for (int e: fac[i - 1]) {
                b[e - 1] = !b[e - 1];
            }
        } else {
            b[i - 1] = 0;
        }
    }
    vi pnt;
    int cnt = 0;
    rep (i, N) {
        if (b[i]) {
            pnt.emplace_back(i + 1);
            cnt++;
        }
    }
    cout << cnt << endl;
    rep(i, cnt) {
        cout << pnt[i] << " " << endl;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 24440
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

double solve(int r)
{
  return 2 * r * 3.14159265358979323846;
}

int main()
{
  int r;
  std::cin >> r;


  std::cout << std::setprecision(20);
  std::cout << solve(r) << std::endl;
}


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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int sum;
  int count = 0;
  for (int i = 0; i < A + 1; i++) {
    for (int j = 0; j < B + 1; j++) {
      for (int k = 0; k < C + 1; k++) {
        sum = 500 * i + 100 * j + 50 * k;
        if (sum == X) {
          count++;
        }
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	input = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var a = parseInt(input[0], 10);
	var b = parseInt(input[1], 10);
	var c = a*b;
  	if (c % 2 === 1) {
      console.log('Odd');
    } else {
      console.log('Even');
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21192
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 10000000000000000;
const ll mod = 1000000007;
signed main() {
	ll n, a, b, cnt = 1, ans = 0; cin >> n >> a >> b;
	if (a > b) { cout << 0 << endl; return 0; }
	if (n == 1) {
		if (a == b) { cout << 1 << endl; }
		else{ cout << 0 << endl; }
		return 0;
	}
	cnt = b - a;
	cout << cnt * (n - 2) + 1 << endl;
	cin >> n; return 0;
}

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

using namespace std;

#define all(v) (v).begin(), (v).end()

using ll = long long;
using dbl = double;

void solve(bool);

int main() {
#ifdef YA
    auto s = clock();
    assert(freopen("input.txt", "r", stdin));
    // assert(freopen("output.txt", "w", stdout));
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif

    cout << fixed << setprecision(20);

    srand(time(0));
    solve(true);

#ifdef YA1
    while (true) solve(false);
#endif

#ifdef YA
    cout << endl << endl << "time = " << (clock() - s) / (double)CLOCKS_PER_SEC << endl;
#endif

    return 0;
}

const int maxn = 2e5 + 555;

int n;
ll a[maxn];
ll cnt[22][22];
const int k = 18;

void solve(bool __attribute__((unused)) read) {
    cin >> n;
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        ll y = 0;
        bool fl = 0;
        int power = 9;
        for (int j = 0; j < (int)s.size(); ++j) {
            if (s[j] == '.') {
                fl = 1;
                continue;
            }
            if (fl) {
                --power;
            }
            y = 10 * y + (s[j] - '0');
        }
        for (int j = 0; j < power; ++j) {
            y *= 10;
        }
        a[i] = y;
        // cout << y << endl;
        int cnt2 = 0;
        int cnt5 = 0;
        while (y % 2 == 0) {
            ++cnt2;
            y /= 2;
        }
        while (y % 5 == 0) {
            ++cnt5;
            y /= 5;
        }
        ++cnt[min(cnt2, k)][min(cnt5, k)];
        // cout << a[i] << endl;
    }

    ll ans = 0;
    for (int i = 0; i <= k; ++i) {
        for (int j = 0; j <= k; ++j) {

            for (int x = 0; x <= k; ++x) {
                for (int y = 0; y <= k; ++y) {
                    if (i == x && j == y) {
                        if (i + x >= k && j + y >= k) {
                            ans += (ll)cnt[i][j] * (ll)(cnt[x][y] - 1);
                        }
                        continue;
                    }
                    if (i + x >= k && j + y >= k) {
                        ans += (ll)cnt[i][j] * (ll)cnt[x][y];
                    }
                }
            }

        }
    }
    ans /= 2;
    cout << ans << endl;
}


Measured memory_bytes: 5224