akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>
using namespace std;
	long long int A[200000],ans=0,sunuke,kuma,sum=0;
	int N;
int main(){

	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i];
		sum+=A[i];
	}
	if(N==2){
		cout<<labs(A[0]-A[1])<<endl;
		return 0;
	}
	sunuke=A[0];
	kuma=sum-A[0];
	ans=labs(sum-A[0]-A[0]);
	
	for(int i=1;i<N-2;i++){
		sunuke+=A[i];
		kuma-=A[i];
		if(ans>labs(sunuke-kuma)){
			ans=labs(sunuke-kuma);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
int main(){
    int n;
    std::cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) std::cin >> a[i];
    int q;
    std::cin >> q;
    std::vector<int> flag(q, 0);
    int m[q];
    for(int i = 0; i < q; i++) std::cin >> m[i];
    for(int bit = 0; bit < (1 << n); bit++){
        int res = 0;
        for(int j = 0; j < n; j++){
            if(bit & (1 << j)) res += a[j];
        }
        for(int i = 0; i < q; i++){
            if(res == m[i]) flag[i] = 1;
        }
    }
    for(int i =0; i < q; i++){
        if(flag[i] == 1) std::cout << "yes" << std::endl;
        else std::cout << "no" << std::endl;
    }
}


Measured memory_bytes: 3096
//====================================
//======================================
//
//                   Bismillahir-Rahmanir-Rahim
//
// ==========================================================================
#include <bits/stdc++.h>
#define        ll                              long long int
#define        FOR(x,y,z)                      for(int x=y;x<z;x++)
#define        pii                             pair<int,int>
#define        pll                             pair<ll,ll>
#define        CLR(a)                          memset(a,0,sizeof(a))
#define        SET(a)                          memset(a,-1,sizeof(a))
#define        N                               200010
#define        M                               1000000007
#define        pi                              acos(-1.0)
#define        ff                              first
#define        ss                              second
#define        pb                              push_back
#define        inf                              (1e9)+1000
#define        eps                             1e-9
#define        ALL(x)                          x.begin(),x.end()
using namespace std;
int dx[]={0,0,1,-1,-1,-1,1,1};
int dy[]={1,-1,0,0,-1,1,1,-1};
template < class T> inline T biton(T n,T pos){return n |((T)1<<pos);}
template < class T> inline T bitoff(T n,T pos){return n & ~((T)1<<pos);}
template < class T> inline T ison(T n,T pos){return (bool)(n & ((T)1<<pos));}
template < class T> inline T gcd(T a, T b){while(b){a%=b;swap(a,b);}return a;}
template <typename T> string NumberToString ( T Number ) { ostringstream ss; ss << Number; return ss.str(); }
inline int nxt(){int aaa;scanf("%d",&aaa);return aaa;}
inline ll lxt(){ll aaa;scanf("%lld",&aaa);return aaa;}
inline double dxt(){double aaa;scanf("%lf",&aaa);return aaa;}
template <class T> inline T bigmod(T p,T e,T m){T ret = 1;
for(; e > 0; e >>= 1){
    if(e & 1) ret = (ret * p) % m;p = (p * p) % m;
} return (T)ret;}
#ifdef sayed
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " is " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cerr.write(names, comma - names) << " is " << arg1 <<endl;
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************
int ar[N];
int main(){
    #ifdef sayed
    //freopen("out.txt","w",stdout);
    // freopen("in.txt","r",stdin);
    #endif
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    int n=  nxt();
    int a = nxt();
    int b = nxt();
    if((b-a)%2) cout<<"Borys"<<endl;
    else cout<<"Alice"<<endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rept(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=y;i>=x;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
//	ios::sync_with_stdio(false);
//	cin.tie(0);
const int maxx = 2e5+7;
const int maxn = 1e9+7;
typedef long long ll;
using namespace std;
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
ll t,n,a,b;
int main(){
	cin>>a>>b;
	cout<<a*b<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    if(a > b)
        {
         cout << "a > b" << endl;
        }
    else if (a < b)
        {
         cout << "a < b" << endl;
        }
    else
        {
        cout << "a == b" << endl;
        }
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define all(v) v.begin(), v.end()
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
typedef pair<lli, lli> pll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n, k;
    cin >> n >> k;
    vector<lli> v;
    for1(i, 0, n)
    {
        lli a;
        cin >> a;
        v.pb(a);
    }
    for1(i, k, n)
    {
        if (v[i] > v[i - k])
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 5316
def counting_sort(A, n, k):
    C = [0] * (k + 1)
    B = [0] * n
    for ai in A:
        C[ai] += 1
    # C[i]にi以下の出現数を記録する
    for i in range(1, k + 1):
        C[i] += C[i - 1]
    for ai in reversed(A):
        B[C[ai] - 1] = ai
        C[ai] -= 1
    return B
n = int(input())
k = 10000
print(*counting_sort(list(map(int, input().split())), n, k))


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

Slist = [list(S[i]) for i in range(H)]

ans = [[0 for i in range(W+2)] for j in range(H+2)]
for i in range(H):
    for j in range(W):
        if(Slist[i][j] == '#'):
            ans[i][j] += 1
            ans[i][j+1] += 1
            ans[i][j+2] += 1
            ans[i+1][j] += 1
            ans[i+1][j+2] += 1
            ans[i+2][j] += 1
            ans[i+2][j+1] += 1
            ans[i+2][j+2] += 1

for i in range(H):
    ansstr =""
    for j in range(W):
        if(Slist[i][j] == '.'):
            ansstr += str(ans[i+1][j+1])
        elif(Slist[i][j] == '#'):
            ansstr += Slist[i][j]
    print(ansstr)

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}
func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func scanNums() (nums []int) {
	s := nextLine()
	numStr := strings.Split(s, " ")

	for _, n := range numStr {
		i, _ := strconv.Atoi(n)
		nums = append(nums, i)
	}
	return nums
}

func scanStrings() (strs []string) {
	s := nextLine()
	list := strings.Split(s, " ")
	strs = append(strs, list...)
	return strs
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}

func comb(n, r int) int {
	nn := kaijo(n)
	rr := kaijo(r)
	nr := kaijo(n - r)
	return nn / (rr - nr)
}

func kaijo(a int) int {
	r := a
	for index := 1; index < a; index++ {
		r = r * (a - index)
	}
	return r
}


func main() {

	S := oneStr()
	var num []int
	for _, r := range S {
		num = append(num, int(r))
	}

	num = sortDesc(num)
	for index := 0; index < 4; index++ {
		if num[0] == num[1] {
			if num[1] != num[2] {
				if num[2] == num[3] {
					fmt.Print("Yes")
					return
				}
			}
		}
	}
	fmt.Print("No")
}


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

int p[11][111], dt[11][111];
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 1; i<=2; i++)
        for(int j = 1; j<=n; j++)
            scanf("%d", &p[i][j]);

    for(int i=1; i<=2; i++)
        for(int j=1; j<=n; j++)
            dt[i][j] = (dt[i-1][j] > dt[i][j-1] ? dt[i-1][j] : dt[i][j-1]) + p[i][j];

    printf("%d", dt[2][n]);
}


Measured memory_bytes: 256
# coding=utf-8
import sys

if __name__ == '__main__':
    N = int(input())
    li_A = list(map(int, input().split()))

    ans = li_A[0]

    if 0 in li_A:
        print('0')
        sys.exit()

    for i in range(1, N):
        if ans * li_A[i] > 1000000000000000000:
            print('-1')
            sys.exit()
        else:
            ans *= li_A[i]

    print(ans)



Measured memory_bytes: 21640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  string s;
  cin >> s;
  
  int n = s.size(), f = 0, b = n - 1;
  while (s[f] != 'A') f++;
  while (s[b] != 'Z') b--;

  cout << b - f + 1 << endl;



  
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

vector<int> E[100001];
int memo[100001];
int sagasu(int A) {
	if (memo[A]) return memo[A];
	vector<int> kari;
	for (int i : E[A]) kari.pb(sagasu(i));
	sort(kari.begin(), kari.end());
	reverse(kari.begin(), kari.end());
	int ret = 1;
	rep(i, kari.size()) {
		ret = max(ret, i + kari[i] + 1);
	}
	return memo[A] = ret;
}

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


	int N;
	cin >> N;

	for (int i = 2; i <= N; i++) {
		int a;
		cin >> a;
		E[a].pb(i);
	}

	rep1(i, N) cesp(sagasu(i));

	co(sagasu(1) - 1);


	Would you please return 0;
}

Measured memory_bytes: 17536
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007 
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main(){
	fast_io();
	string s;
	cin >> s;
	int ans = 0;
	cu(i,0,s.length()){
		int ind = i;
		while(ind < s.length() && s[ind] == 'A' || s[ind] == 'T'||s[ind] == 'G'|| s[ind] == 'C'){
			++ind;	
		}
		ans = max(ans, ind - i);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Int int32_t
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(const auto& x : c )cout << x << " "; cout << "\n";
#define ol(c, s, e) for(int pos=s; pos<e; pos++)cout << c[pos] << " ";cout <<"\n";
#define PI acos(-1LL)


#ifdef LOCAL
string to_string(const string& s){
    return '"' + s + '"';
}
string to_string(const char* s) {
    return to_string((string) s);
}
string to_string(bool b) {
    return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename T>
string to_string(T v){
    bool first = true;
    string res = "{";
    for(const auto& x: v){
        if(!first) res+=", ";
        first = false;
        res+=to_string(x);
    }
    res+="}";
    return res;
}
void bug() { cerr << endl; }
template<typename Head, typename... Tail>
void bug(Head H, Tail... T) {
    cerr << " " << to_string(H);
    bug(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", bug(__VA_ARGS__);
#endif


const int M = 1000000007;
const int N = 2e6 + 5;
const long long INF = 2e18 + 12;

void solve(){
    int n, k;
    cin >> n >> k;
    int ans =0;
    for(int i=0; i<n ;i++){
        int a, b;
        cin >> a >> b ;
        if(k*k >= a*a + b*b) ++ans;
    }
    cout << ans << endl;
}
signed main(){
    FAST
#ifdef LOCAL
    clock_t start;
    double duration;
    start = clock();
#endif
    int tc = 1;
//    TODO: check for tc
//    cin >> tc;
    for (int t = 1; t <= tc; t++) {
//        cout << "Case #" << t << ": ";
        solve();
    }
#ifdef LOCAL
    duration = (clock() - start) / (double) CLOCKS_PER_SEC;
    cerr <<"\nTotal time elapsed: "<< duration <<"sec\n";
#endif
}

Measured memory_bytes: 3644
import java.util.*;

public class Main {
	static int n, w;
	static int[] wt, val;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		w = sc.nextInt();
		wt = new int[n];
		val = new int[n];
		long [][] dp = new long[n][w+1];
		for(int i = 0; i < n; i++) {
			wt[i] = sc.nextInt();
			val[i] = sc.nextInt();
			Arrays.fill(dp[i], -1);
		}
		dp[n-1][w] = solve(w, n-1, dp);
		System.out.println(dp[n-1][w]);
	}

	public static long solve(int awt, int item, long[][] dp) {
		if(dp[item][awt] != -1) {
			return dp[item][awt];
		}
		if(item == 0) {
			if(awt >= wt[item]) {
				return dp[item][awt] = val[item];
			} else {
				return dp[item][awt] = 0;
			}
		} else if(awt <= 0) {
			return ((dp[item][awt]=0));
		} else if(awt >= wt[item]) {
			return dp[item][awt] = max(
					solve(awt-wt[item], item-1, dp) + val[item],
					solve(awt, item-1, dp)
			);
		} else {
			return dp[item][awt] = solve(awt, item-1, dp);
		}
	}
	public static long max(long a, long b) {
		return Math.max(a, b);
	}
}

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

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

    int n;
    cin >> n;
    map<pair<int, int>, int> cnt;
    vector<int> xs(n), ys(n);
    for (int i = 0; i < n; i++) cin >> xs[i] >> ys[i];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
          	if (i != j) cnt[{xs[j] - xs[i], ys[j] - ys[i]}]++;
        }
    }
    int nax = 0;
    for (auto &p : cnt) {
        nax = max(nax, p.second);
    }
    cout << n - nax << endl;
}


Measured memory_bytes: 384
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    #トポロジカルソート
    N,M = MI()
    edge = [[]for _ in range(N)]
    indegree = [0]*N #入次数
    for _ in range(M+N-1):
        a,b = MI_()
        edge[a].append(b)
        indegree[b] += 1
    #print(indegree)
    #入次数が0の点からあれしていく
    queue = deque() 
    for i,x in enumerate(indegree):
        if not x:
            queue.append(i)
    
    pop = queue.popleft
    topological_index = [] #トポロジカルソート順
    ans = [0]*N
    while queue:
        v = pop()
        topological_index.append(v)
    
        for to in edge[v]:
            indegree[to] -= 1
            if not indegree[to]:
                queue.append(to)
                ans[to]=v+1
    # print(*topological_index,sep="\n")
    print(*ans,sep="\n")    
if __name__ == '__main__':
    main()

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

int main()
{
    long long ans = 0;
    long long max_num = 0;
    long long N;
    vector<long long> a;
    vector<long long> numV;
    cin >> N;
    a.resize(N);
    for (long long i = 0; i < N; i++)
    {
        cin >> a[i];
        max_num = max(max_num, a[i]);
    }

    numV.resize(max_num + 2);

    for (long long i = 0; i < N; i++)
    {
        numV[a[i]]++;
        numV[a[i] + 1]++;
        numV[a[i] + 2]++;
    }

    for (long long i = 0; i <= max_num + 1; i++)
    {
        ans = max(ans, numV[i]);
    }

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

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

int main(){
    int H,W;
    while(1) {
        
       cin >>H>>W;
       if (H == 0&& W==0)break;
       for (int b = 0;b<H;b++){

       for (int a =0;a<W;a++){
       cout<<"#"; }
       cout <<endl;
       }
       cout<<endl;
    }
}


Measured memory_bytes: 3100
s = input()
ans = 0
while len(s) > 0:
    if s[0] == s[-1]:
        s = s[1:len(s)-1]
    elif s[0] == 'x':
        s += 'x'
        ans += 1
    elif s[-1] == 'x':
        s = 'x' + s
        ans += 1
    else:
        print(-1)
        exit()
print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    bool oddexist = false;

    REP(i,n) {
        int a; cin >> a;
        if (a % 2 != 0) oddexist = true;
    }

    if (oddexist) OUT("first")
    else OUT("second")

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef long long ll;
 
int main(){
    string s;
    cin >> s;
    int stack = 0;
    int p = 0;
    rep (i,(int)s.length()) {
        if (s[i] == 'S') stack++;
        else if (stack > 0) stack--,p++;
    }
    cout << (int)s.length() - p*2 << endl;
    return 0;
}

Measured memory_bytes: 640
N,T=map(int,raw_input().split())
L=[raw_input().split() for i in range(N)]
for i in range(N):
    t1=map(int,L[i][0].split(":"))
    t2=map(int,L[i][2].split(":"))
    L[i][0]=t1[0]*60+t1[1]
    L[i][2]=t2[0]*60+t2[1]
ans=[]
for i in range(N-1):
    diff=L[i+1][0]-L[i][2]
    if diff>=T:
        ans.append((L[i][3],diff))
print len(ans)
for name,time in ans:
    print name,time

Measured memory_bytes: 4260
DAY = input()
if(DAY == "SUN"):
    print(7)
if(DAY == "SAT"):
    print(1)
if(DAY == "FRI"):
    print(2)
if(DAY == "THU"):
    print(3)
if(DAY == "WED"):
    print(4)
if(DAY == "TUE"):
    print(5)
if(DAY == "MON"):
    print(6)

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

int main()
{
  int n,ans;
  cin>>n;
  ans=1;
  vector<int> h(n);
  for(int i=0;i<n;i++)
  {
    cin>>h.at(i);
  }
  sort(h.begin(),h.end());
  for(int i=0;i<n-1;i++)
  {
    if(h.at(i)!=h.at(i+1))
      ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
#define NUM 1000000007
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n,m;
    cin>>n>>m;
    vector<bool> ok(n+1,true);
    rep(i,m){
        int a;
        cin>>a;
        ok[a]=false;
    }
    vector<ll> dp(n+1);
    dp[0]=1;
    rep(now,n){
        for(int next=now+1;next<=min(n,now+2);next++){
            if(ok[next]){
                dp[next]+=dp[now];
                dp[next]%=NUM;
            }
        }
    }
    cout<<dp[n];
}

Measured memory_bytes: 4000
H, W = [int(x) for x in input().split()]
S_list = [input() for _ in range(H)]
cnt = [[0] * W for _ in range(H)]

for i in range(H):
    done = [0] * W
    for j in range(W):
        if (S_list[i][j] == '#'): continue
        elif (done[j]): continue
        else:
            # .がいくつ続くか
            k = 0
            while (j+k < W):
                if (S_list[i][j+k] == '#'): break
                k += 1
            # k個続いてるのでkを加算
            for l in range(k):
                cnt[i][j+l] += k
                done[j+l] = 1
for i in range(W):
    done = [0] * H
    for j in range(H):
        if (S_list[j][i] == '#'): continue
        elif (done[j]): continue
        else:
            # .がいくつ続くか
            k = 0
            while (j+k < H):
                if (S_list[j+k][i] == '#'): break
                k += 1
            # k個続いてるのでkを加算
            for l in range(k):
                cnt[j+l][i] += k
                done[j+l] = 1
print(max(map(max, cnt))-1)


Measured memory_bytes: 101720
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)

//変数
ll N;
vector<ll> A;

//解法
void solve() {

	A.insert(A.begin(), 0);
	A.emplace_back(0);

	int sum = 0;
	rep(i, N+1) {
		sum += abs(A[i] - A[i + 1]);
	}

	for (int i = 1; i < N + 1; i++) {

		int ans = sum - abs(A[i - 1] - A[i]) - abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i + 1]);
		cout << ans << endl;
	
	}

	return;
}

int main() {
	//入力
	cin >> N;
	A.resize(N);
	rep(i, N) cin >> A[i];
	solve();
	//cout << endl;
	return 0;
}


Measured memory_bytes: 2032
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <math.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
    for (T &x : vec)
        is >> x;
    return is;
}

//最大公約数
ll gcd(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    while (m != n)
    {
        if (m > n)
            m = m - n;
        else
            n = n - m;
    }
    return m;
}

//最小公倍数
ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

int main(){
    int n;
    cin >> n;
    int t,a;
    cin >> t >> a;

    vector<double> h(n);
    cin >> h;

    vector<double> temp(n);

    REP(i,n){
        temp[i] = fabs(t - h[i]*0.006 - a);
    
    }

    double minelement = *min_element(temp.begin(), temp.end());
    //cout << minelement << endl;



    REP(i,n){
        //cout << minelement << " " << temp[i] << endl;
        if(minelement == temp[i]){
            cout << i+1 << endl;
            return 0;
        }
    }
}


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

using namespace std;

#define ll long long
#define mod 1000000007

void solve(){

    int n; cin >> n;
    int a = 0, w = 0, t = 0, r = 0;
    while(n--){
        string s; cin >> s;
        if(s == "TLE") ++t;
        else if(s == "WA") ++w;
        else if(s == "AC") ++a;
        else if(s == "RE") ++r;
    }
    cout << "AC x " << a;
    cout << "\nWA x " << w;
    cout << "\nTLE x " << t;
    cout << "\nRE x " << r;
    
    return;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    //int test; cin >> test;
    //for(int t = 1; t <= test; ++t){
        solve();    
    //}

    //cout << "Case #" << t << ": ";
    //cout << "\n";

    //inr(10);
	return 0;
}

int inr(int a){
    return ++a;
}

Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;
 
#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}
 
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mk(arr,n,type)  type *arr=new type[n];
 
clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}
int32_t main(){
	int t;	
	cin >> t;
	long long arr[t];
	int zero = 0;
	for(int i = 0;i < t;i++)cin >> arr[i];
	for(int j = 0;j < t;j++)if(arr[j]==0)zero++;
	if(zero > 0){
		cout << "0" << "\n";
		return 0;
	}
	long long ans = 1;
	for(int i = 0;i < t;i++){
		if(arr[i ] <=1000000000000000000/ ans ){
			// This condition is equivalent to ans*a[i] <=10ˆ18
			ans *=arr[i];
		} else {
			cout << "-1" << "\n";
			return 0;
		}
	}
	cout << ans << "\n";
		

	return 0;
}


Measured memory_bytes: 4412
from sys import exit, setrecursionlimit
setrecursionlimit(10**6)

def array2D(row, col ,val=0):
    return [[val]*col for i in range(row)]

n,k,c = map(int, input().split())
S = [True if i=='o' else False for i in input()]

if n == c:
    ANS = []
    if sum(S) == 1:
        for i in range(n):
            if S[i]:
                ANS.append(i+1)
    print(*ANS, sep='\n')
    exit()



left = [0]*n
right = [0]*n
c = c+1
if S[0]:
    left[0] = 1

for i in range(1, c):
    if S[i]:
        left[i] = 1
    left[i] = max(left[i], left[i-1])

for i in range(c, n):
    if S[i]:
        left[i] = left[i-c] + 1
    else:
        left[i] = left[i-1]
if S[-1]:
    right[-1] = 1
for i in range(n-c, n-1)[::-1]:
    if S[i]:
        right[i] = 1
    right[i] = max(right[i], right[i+1])
for i in range(n-c)[::-1]:
    if S[i]:
        right[i] = right[i+c] + 1
    else:
        right[i] = right[i+1]

ans = []
for i in range(n):
    if S[i]:
        tl = 0
        tr = 0
        if i>0:
            tl = left[i-1]
        if i<n-1:
            tr = right[i+1]
        if tl + tr < k:
            ans.append(i+1)

print(*ans, sep='\n')




Measured memory_bytes: 64888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define x first
#define y second
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pie   3.141592653589793238462643383279502884L
ll mod = 998244353;
ll powerMod(ll a,ll n){
  if(n==0)
    return 1;
  ll res = powerMod((a%mod*a%mod)%mod,n/2)%mod;
  if(n%2)
  return (a%mod*res%mod)%mod;
  return res; 
} 

int main(){
  ll q, h, s, d, n;
  cin >> q >> h >> s >> d >> n;
  h = min(2*q, h);
  s = min(2*h, s);
  d = min(2*s, d);
  ll ans = 0;
  if (n % 2 )
    ans += s;
  ans += d*(n/2);
  cout << ans;

  return 0;   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 998244353
using namespace std;
template <typename Mnd> struct segment_tree {
    int sz;
    vector<Mnd> data;
    function<Mnd(Mnd, Mnd)> f;
    Mnd e;
    //サイズだけ指定して初期化
    segment_tree(int _sz, function<Mnd(Mnd, Mnd)> _f, Mnd _e) : f(_f), e(_e) {
        sz = 1;
        while(sz < _sz)
            sz <<= 1;
        data.assign(sz * 2, e);
    }
    //参照渡しなので代入とかもできる
    Mnd &operator[](const int &k) { return data[k + sz]; }
    //木を構築 O(n)
    void build() {
        for(int i = sz - 1; i > 0; i--)
            data[i] = f(data[2 * i], data[2 * i + 1]);
    }
    //更新しつつ木を再構築 O(log n)
    void update(int k, Mnd x) {
        data[k += sz] = x;
        while(k >>= 1)
            data[k] = f(data[2 * k], data[2 * k + 1]);
    }
    //[a,b)でのクエリに答える　O(log n)
    Mnd query(int a, int b) const {
        Mnd l = e, r = e;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
            if(a & 1)
                l = f(l, data[a++]);
            if(b & 1)
                r = f(r, data[--b]);
        }
        return f(l, r);
    }
};
int main() {
    int n;
    cin >> n;
    segment_tree<int> seg(n, [](int a, int b) { return max(a, b); }, INT_MIN);
    vector<pair<ll, ll>> xd(n);
    for(int i = 0; i < n; i++) {
        cin >> xd[i].first >> xd[i].second;
    }
    sort(all(xd));
    seg.update(n - 1, n - 1);
    for(int i = n - 2; i >= 0; i--) {
        auto ind = lower_bound(all(xd), make_pair(xd[i].first + xd[i].second,
                                                  LLONG_MIN)) -
                   xd.begin();
        seg.update(i, max(i, seg.query(i, ind)));
    }
    vector<ll> dp(n + 1);
    dp[n] = 1;
    dp[n - 1] = 2;
    for(int i = n - 2; i >= 0; i--) {
        dp[i] = dp[i + 1] + dp[seg[i] + 1];
        dp[i] %= MOD;
    }
    cout << dp[0] << endl;
}

Measured memory_bytes: 7040
# include <bits/stdc++.h>
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define ll long long int
#include <tr1/unordered_map>
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define f(i,a,b)  for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end()
#include <map>
using namespace std;





int main()
{




     flash;
     ///////////////////////////////////////////////////////////////////////////////////////

ll n;
cin>>n;
vector <ll> vect1;
vector <ll> vect2;
vector <ll> vect;

	//bool flag=false;
for(ll i=1;i*i<=n;i++)
{
	if(n%i==0)
	{
		vect1.push_back(i);
		vect2.push_back(n/i);

	}
}
for(ll i=0;i<vect1.size();i++)
{
	vect.push_back(vect1[i]+vect2[i]-2);
}
sort(vect.begin(),vect.end());
cout<<vect[0];







    ///////////////////////////////////////////////////////////////////////////////////////

     return 0;

}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>

using namespace std;

typedef long long ll;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);



int main()
{
    fastInp;
    
    ll n;
    cin >> n;
    string ans;

    while (n > 0) {
        ll q = (n - 1) % 26 + 1;
        ans.push_back('a' + q - 1);
        n -= q;
        n /= 26;
    }

    reverse(ans.begin(), ans.end());

    cout << ans;
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int mask[N],ans,n;
vector<int> g[N];
void DFS(int u,int fr){
    int two=0,tot=0;
    for(int i:g[u])
        if(i!=fr){
            DFS(i,u);
            two|=tot&mask[i];
            tot|=mask[i];
        }
    int v=31-__builtin_clz(two);
    v= __builtin_ffs(~(tot>>v))-1+v;
    ans=max(ans,v);mask[u]=((tot>>v)<<v)|(1<<v);
}
int main(){
    scanf("%d",&n);
    for(int i=2,f,t;i<=n;i++) 
        scanf("%d%d",&f,&t),g[f].push_back(t),g[t].push_back(f);
    DFS(1,0);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 11776
#include<bits/stdc++.h>
#define y0 ___y0
#define y1 ___y1
typedef long long ll;
const int maxn = 1001;
typedef std::pair<ll,int> pr;
int n,m,s,t;
namespace mcmf{
    const int maxn = 10010,maxm = 1001000;
    struct T{ int to,nxt,v,f; } way[maxm << 1];;
    int h[maxn],num = 1;
    inline void link(int x,int y,int v,int f){
        way[++num]={y,h[x],v,f},h[x]=num;
        way[++num]={x,h[y],0,-f},h[y]=num;
    }
    ll d[maxn],dis[maxn]; int vis[maxn],fr[maxn];
    inline void bellmanford(int s,int t){
        std::queue<int> q; std::fill(d + s,d + t + 1,1e18);
        for(d[s] = 0,q.push(s);!q.empty();){
            int t = q.front(); q.pop(); vis[t] = 0;
            for(int i=h[t];i;i=way[i].nxt) 
                if(way[i].v && d[way[i].to] > d[t] + way[i].f){
                    d[way[i].to] = d[t] + way[i].f;
                    if(!vis[way[i].to]) vis[way[i].to]=1,q.push(way[i].to);
                }
        }
    }
    inline bool dijkstra(int s,int t){
        std::priority_queue<pr,std::vector<pr>,std::greater<pr>> q;
        std::fill(dis + s,dis + t + 1,1e18);
        std::fill(vis + s,vis + t + 1,0);
        for(dis[s] = 0,q.push(pr(0,s));!q.empty();){
            pr t=q.top(); q.pop(); if(vis[t.second]) continue; vis[t.second] = 1;
            for(int i=h[t.second];i;i=way[i].nxt){
                const ll v = way[i].f + d[t.second] - d[way[i].to];
                if(way[i].v && dis[way[i].to] > dis[t.second] + v){
                    dis[way[i].to] = dis[t.second] + v; fr[way[i].to] = i;
                    q.push(pr(dis[way[i].to],way[i].to));
                }
            }
        }
        return dis[t] < 1e17;
    }
    inline std::pair<ll,ll> ek(int s,int t){
        bellmanford(s,t); ll flow = 0,cost = 0;
        while(dijkstra(s,t)){
            ll sum = 0,fl = 1e18;
            for(int i=fr[t];i;i=fr[way[i^1].to])
                fl = std::min<ll>(way[i].v,fl), sum += way[i].f;
            flow += fl,cost += fl * sum;
            for(int i=fr[t];i;i=fr[way[i^1].to]) way[i].v -= fl,way[i ^ 1].v += fl;
            for(int i=s;i<=t;++i) d[i] += dis[i];
        }
        return {flow,cost};
    }
}
int x0[maxn],y0[maxn],z0[maxn];
int x1[maxn],y1[maxn],z1[maxn];
int main(){
    std::ios::sync_with_stdio(false),std::cin.tie(0);
    std::cin >> n;
	int o0 = n + n + 1,o1 = n + n + 2,o2 = n + n + 3,o3 = n + n + 4;
	using mcmf::link;
	for(int i = 1;i <= n;++i){
		std::cin >> x0[i] >> y0[i] >> z0[i];
		link(0, i, z0[i], 0);
		link(i, o0, z0[i], - x0[i] + y0[i]);
		link(i, o1, z0[i], x0[i] - y0[i]);
		link(i, o2, z0[i], x0[i] + y0[i]);
		link(i, o3, z0[i], - x0[i] - y0[i]);
	}
	for(int i = 1;i <= n;++i){
		std::cin >> x1[i] >> y1[i] >> z1[i];
		link(i + n,n + n + 5,z1[i],0);
		link(o0, i + n,z1[i], x1[i] - y1[i]);
		link(o1, i + n,z1[i], -x1[i] + y1[i]);
		link(o2, i + n,z1[i], - x1[i] - y1[i]);
		link(o3, i + n,z1[i], x1[i] + y1[i]);
	}
	std::cout << -mcmf::ek(0,n + n + 5).second << '\n';
}


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

int main() {
  string s;
  cin >>s;
  int x,y,z;
  x=0;
  y=0;
  z=0;
  if(s[0]=='a'||s[1]=='a'||s[2]=='a'){
    x=1;
  }
  if(s[0]=='b'||s[1]=='b'||s[2]=='b'){
    y=1;
  }
  if(s[0]=='c'||s[1]=='c'||s[2]=='c'){
    z=1;
  }
  if(x==1&&y==1&&z==1){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
  cout<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int n,i,j,j1,j2,a,k;
cin>>n;
for(i=0;i<n;i++){
j1=j2=0;a=1;
for(k=0;k<10;k++){
cin>>j;
if(j1<j&&j2<j){if(j1<j2)j2=j;else j1=j;}
else if(j1<j)j1=j;
else if(j2<j)j2=j;
else a=0;
}
if(a==1)cout<<"YES"<<endl;else cout<<"NO"<<endl;
}
return 0;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int N, M, Q;
int L[202020], R[202020];
int p[101010], q[101010];
int LR[1000][1000];
int sum[1000][1000];

int main()
{
    cin >> N >> M >> Q;
    repe(i, 1, M)
    {
        cin >> L[i] >> R[i];
        LR[L[i]][R[i]]++;
    }
    repe(i, 1, Q)
    {
        cin >> p[i] >> q[i];
    }

    repe(i, 1, N)
    {
        sum[i][1] = LR[i][1];
        repe(j, 1, N - 1)
        {
            sum[i][j + 1] = LR[i][j + 1] + sum[i][j];
        }
    }
    repe(i, 1, Q)
    {
        ll ans = 0;
        repe(j, p[i], q[i])
        {
            ans += sum[j][q[i]] - sum[j][p[i] - 1];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

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

    ll ans = 0;
    rep(i, n){
        double a, b;
        cin >> a >> b;

        double res = a * a + b * b;
        res = sqrt(res);

        if(res <= d)ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
using Graph = vector<vector<ll>>;

int main(){
  int n;cin>>n;
  vector<int> a(n),b(n),c(n-1);
  for (auto &&i : a)
  {
    cin >>i;
  }
  for (auto &&i : b)
  {
    cin >>i;
  }
  for (auto &&i : c)
  {
    cin >>i;
  }
  ll ans = 0;
  for (int i = 0; i < n; i++)
  {
    int meal = a.at(i) - 1;
    ans += b.at(meal);
    if(i < n - 1)
    {
      int next = a.at(i + 1) - 1;
      if (next == meal + 1)
      {
        ans += c.at(meal);
      }

    }

  }
  cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.HashSet;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String N=sc.next();
    String V[]=N.split("");

   if(Integer.parseInt(V[V.length-1])==3){
     System.out.println("bon");

   }else if(Integer.parseInt(V[V.length-1])==0||Integer.parseInt(V[V.length-1])==1||Integer.parseInt(V[V.length-1])==6||Integer.parseInt(V[V.length-1])==8){
     System.out.println("pon");
   }else{
     System.out.println("hon");
   }



  }
}


Measured memory_bytes: 35664
import scala.io.{StdIn => in}

object Main extends App {
  val Array(n, m) = in.readLine.split(" ").map(_.toInt)
  val param =Iterator.continually(in.readLine)
    .take(n)
    .map(_.split(" ").map(_.toLong))
    .toArray

  val res = for {
    i <- -1 to 1 by 2
    j <- -1 to 1 by 2
    k <- -1 to 1 by 2
  } yield {
    param.map(e => e(0)*i + e(1)*j + e(2)*k)
      .sorted(Ordering[Long].reverse)
      .take(m)
      .sum
  }

  val ans = res.max
  println(ans)
}

Measured memory_bytes: 30012
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
    bool ans[4]={false,false,false,false};
    int a,b;
    cin>>a>>b;
    ans[a]=true;
    ans[b]=true;
    for(int i=1;i<=3;i++)
    {
        if(!ans[i])
        {
            cout<<i<<endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {

	int a, b, m, i;
	int a_min = 100000, b_min = 100000, ans;
	int ref[100000], mwo[100000];
	int ref_c[100000], mwo_c[100000], cpn[100000];

	cin >> a >> b >> m;
	for (i = 0; i < a; i++)
		cin >> ref[i];
	for (i = 0; i < b; i++)
		cin >> mwo[i];
	for (i = 0; i < m; i++)
		cin >> ref_c[i] >> mwo_c[i] >> cpn[i];

	//まず、クーポン使わずしての最安値
	for (i = 0; i < a; i++) {
		if (ref[i] < a_min)
			a_min = ref[i];
	}
	for (i = 0; i < b; i++) {
		if (mwo[i] < b_min)
			b_min = mwo[i];
	}
	ans = a_min + b_min;

	for (i = 0; i < m; i++) {
		if (ref[ref_c[i] - 1] + mwo[mwo_c[i] - 1] - cpn[i] < ans)
			ans = ref[ref_c[i] - 1] + mwo[mwo_c[i] - 1] - cpn[i];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int n=s.size();
    if ( s[n-1]=='3' ) {
        cout << "bon" << endl;
    } 
    else if ( s[n-1]=='0' || 
    s[n-1]=='1' || s[n-1]=='6' || s[n-1]=='8') {
        cout << "pon" << endl;
    }
    else {
        cout << "hon" << endl;
    }

    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int W, H, x, y; cin >> W >> H >> x >> y;
    cout << (double)W*H/2 << ' ';
    cout << (x * 2 == W && y * 2 == H) << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
using namespace std;
// type alias
typedef long long LL;
typedef vector < int > VI;
typedef unordered_map < int, int > MAPII;
typedef unordered_set < int > SETI;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// minmax
#define SMAX(a,b) a = max(a,b)
#define SMIN(a,b) a = min(a,b)
// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }

/*
 
 8/9/2018
 
 23:30-23:35 analysis
 
 */

// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG x.cpp && ./a.out
//const int MAX_N=1e5+1;
int N;
string S;
void solve() {
  deque<char> Q;
  REP(i,N)Q.push_back(S[i]);
  auto it=Q.begin();
  int d=0;
  while(it!=Q.end()) {
    if(*it==')') {
      if(d==0) Q.push_front('(');
      else --d;
    } else {
      ++d;
    }
    ++it;
  }
  while(d-->0) Q.push_back(')');
  string res; FORR(c,Q) res+=c;
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  cin>>N>>S;
  solve();
  return 0;
}


Measured memory_bytes: 504
#include <stdio.h>
#include <stdlib.h>

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

int main()
{
  int n, k;  
  scanf("%d %d", &n, &k);
    
  long long int a[n];
  for(int i=0;i<n;i++){
    scanf("%lld", &a[i]);
  }
  qsort(a, n, sizeof(long long int), comp);
  
  long long int sum=0;
  for(int i=0;i<n;i++){
    if(i<k) continue;
    else sum+=a[i];
  }
  
  printf("%lld", sum);
  return 0;
}


Measured memory_bytes: 3324
#include<stdio.h>

int main()
{
	char a[10], b[10], c[10];
	int i = 0, j = 0;

	scanf("%s %s %s", a, b, c);

	while (a[i] != '\0') {
		i++;
	}
	while (b[j] != '\0') {
		j++;
	}

	if (a[i-1] == b[0] && b[j-1] == c[0]) {
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}

	return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define FORq(i, m, n) for(int i = m;i <= n;i++)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define PRINTD(n) printf("%d\n",n)
#define DEBUG printf("%s\n","debug")
using namespace std;
//////////////////////////////////////////////////////
int main(){
	int N; SCD(N);
	int X[N];
	int Y[N];
	
	REP(i,N){
		SCD(X[i]);
	}
	REP(i,N){
		Y[i] = X[i];
	}
	
	sort(Y,Y+N);
	
	int med = Y[N/2];
	
	REP(i,N){
		if (X[i] < med) PRINTD(med);
		else PRINTD(Y[(N/2) - 1]);
	}
	
	
	return 0;
}







Measured memory_bytes: 3712