akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

bool is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

int main()
{
    string s; cin >> s;
    int ans = 0;
    if (s[0] == 'R')
        ans++;
    if (s[1] == 'R')
        ans++;
    if (s[2] == 'R' && s[1] == s[2])
        ans++;
    if (s == "SSR")
        ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string s;
	cin >> s;

	if (s[0] == s[2]) cout << "Yes" << "\n";
	else cout << "No" << "\n";

	return 0;
}

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

using namespace std;

int main()
{
	long long h, w;
	cin >> h >> w;
	long long s = min(((h-1)/3+1-h/3)*w, ((w-1)/3+1-w/3)*h);
	s = min(s, ((w-1)/2+1)*(h-h/3)-h/3*w);
	s = min(s, ((h-1)/3+1)*w-w/2*(2*h/3));
	s = min(s, ((h-1)/2+1)*(w-w/3)-w/3*h);
	s = min(s, ((w-1)/3+1)*h-h/2*(2*w/3));
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
n, m = [int(_) for _ in input().split()]
g = [[int(_) for _ in input().split()] for __ in range(m)]
l = g[0][0]; r = g[0][1]
for i in range(1,m):
    l = max(l, g[i][0])
    r = min(r, g[i][1])
print(max(0, r-l+1))

Measured memory_bytes: 21156
import java.util.Scanner;

public class Main
{ 
  int lcs( char[] X, char[] Y, int m, int n ) 
  { 
    int L[][] = new int[m+1][n+1]; 
  
   
    for (int i=0; i<=m; i++) 
    { 
      for (int j=0; j<=n; j++) 
      { 
        if (i == 0 || j == 0) 
            L[i][j] = 0; 
        else if (X[i-1] == Y[j-1]) 
            L[i][j] = L[i-1][j-1] + 1; 
        else
            L[i][j] = max(L[i-1][j], L[i][j-1]); 
      } 
    } 
  return L[m][n]; 
  } 
  
  int max(int a, int b) 
  { 
    return (a > b)? a : b; 
  } 
  
  public static void main(String[] args) 
  { 
    Main lcs = new Main(); 
    Scanner scan = new Scanner(System.in);
    int numbOfSets = scan.nextInt();
    
    for(int i = 0; i < numbOfSets; i++) {
    	
    	String s1 = scan.next();
        String s2 = scan.next();
        char[] X=s1.toCharArray(); 
        char[] Y=s2.toCharArray(); 
        int m = X.length; 
        int n = Y.length; 
        
        System.out.println(lcs.lcs( X, Y, m, n ) );
    }
    
  } 
  
} 


Measured memory_bytes: 64340
#include <cmath>
#include <vector>
#include <map>
#include <functional>
#include <queue>
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>

using namespace std;

#define ll long long int
#define ti4 tuple<int,int,int,int>
#define pii pair<ll,ll>
#define REP(x,n) for(int x = 0;x < n;x++)

struct UnionFind {
    vector<ll> data;
    UnionFind(ll size) : data(size, -1) { }
    bool unionSet(ll x, ll y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(ll x, ll y) {
        return root(x) == root(y);
    }
    ll root(ll x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    ll size(ll x) {
        return -data[root(x)];
    }
};

int main()
{
    int n,k;
    cin >> n >> k;
    ll s = k;
    for(int i = 1;i < n;i++)
    {
        s *= (ll)(k-1);
    }
    cout << s << endl;
    return 0;
}

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

int main()
{
   string str ;
   cin>>str;
   int i=0;
   while(i<(str.size())){
    if(str[i] == ','){
        str[i] = ' ';
    }
    i++;
   }
   cout<<str;
    return 0;
}


Measured memory_bytes: 256
import collections

N, M = map(int, input().split())
A = [int(i) for i in input().split()]
D = collections.Counter(A)
for i in range(M):
    B, C = map(int, input().split())
    if C in D:
        D[C] += B
    else:
        D[C] = B
D = sorted(D.items(), key=lambda x: x[0], reverse=True)

ans = 0
for d in D:
    if d[1] > N:
        ans += d[0] * N
        break
    else:
        ans += d[0] * d[1]
        N -= d[1]

print(ans)

Measured memory_bytes: 43296
#include<bits/stdc++.h>
#define ll  long long
#define pp pair<int,int>
#define ppn pair<pp,int>
#define F first
#define S second
#define N 1000005
#define mod 1000000007
#define pi 3.14159265358979323846

using namespace std;



int main()
{


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

  ll a, b, c, d;
  cin>>a>>b>>c>>d;
  ll k = a*c;
  k=max(k,a*d);
  k=max(k,b*c);
  k=max(k,b*d);
  cout<<k<<endl;
}


Measured memory_bytes: 3644
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


#define MAXN (1 << 20)

vector<int> pos, neg;
int a[MAXN];
int n;
vector<pair<int, int> > ans;

int main() {
	cout << fixed << setprecision(12);	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] >= 0) {
			pos.push_back(a[i]);
		} else if (a[i] < 0) {
			neg.push_back(a[i]);
		} 
	}
	sort(pos.begin(), pos.end());
	sort(neg.begin(), neg.end(), greater<int>());
	if (pos.size() && neg.size()) {
		int nn = neg[0];
		int pp = pos[0];
		for (int i = 1; i < pos.size(); i++) {
			ans.push_back(make_pair(nn, pos[i]));
			nn -= pos[i];
		}
		for (int i = 1; i < neg.size(); i++) {
			ans.push_back(make_pair(pp, neg[i]));
			pp -= neg[i];
		}
		ans.push_back(make_pair(pp, nn));
	} else if (pos.size()) {
		int nn = pos[0];
		for (int i = 1; i < pos.size() - 1; i++) {
			ans.push_back(make_pair(nn, pos[i]));
			nn -= pos[i];
		}
		ans.push_back(make_pair(pos[pos.size() - 1], nn));
	} else if (neg.size()) {
		int nn = neg[0];
		for (int i = 1; i < neg.size(); i++) {
			ans.push_back(make_pair(nn, neg[i]));
			nn -= neg[i];
		}
	}
	pair<int, int> last = ans[ans.size() - 1];
	cout << last.first - last.second << endl;
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i].first << " " << ans[i].second << endl;
	}
	return 0;
}


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

int main(){
  string s,ans = "Good";
  cin >> s;
  int num = s.size();
  char tem = s[0];
  for(int i=1; i< num ; ++i){
    if(tem == s[i]){
      ans = "Bad";
    }
    tem = s[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
// In the name of God
#include <bits/stdc++.h>

using namespace std;
#define Size(x) ((int)(x).size())
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const int INF = 1e9 + 10;
const int MN = 1e5 + 10;

int n , arr[MN];

int main()
{
	ios_base :: sync_with_stdio(false) ,cin.tie(0) , cout.tie(0);
	cin >> n;
	for(int i=0;i<n;++i) cin >> arr[i];
	bool fl = false;
	if(n == 1){
		if(arr[0]&1) cout << "Second\n";
		else cout << "First\n";
		return 0;
	}
	while(1){
		if(*min_element(arr , arr+n) == 1){
			ll sm = 0;
			for(int i=0;i<n;++i) sm += arr[i];
			if((sm-n)%2){
				if(!fl)cout << "First\n";
				else cout << "Second\n";
			}else{
				if(!fl) cout << "Second\n";
				else cout << "First\n";
			}
			return 0;
		}
		int cnt = 0;
		for(int i=0;i<n;++i) if(arr[i]%2 == 0) ++cnt;
		if(cnt&1){
			if(fl) cout << "Second\n";
			else cout << "First\n";
			return 0;
		}else if(n-cnt > 1){
			if(fl) cout << "First\n";
			else cout << "Second\n";
			return 0;
		}
		if(*max_element(arr , arr+n) == 1){
			if(!fl) cout << "Second\n";
			else cout << "First\n";
			return 0;
		}
		for(int i=0;i<n;++i) if(arr[i]&1) arr[i]--;
		int g = -1;
		for(int i=0;i<n;++i){
			if(g == -1) g = arr[i];
			else g = __gcd(g , arr[i]);
		}
		for(int i=0;i<n;++i) arr[i]/=g;
		fl = !fl;
	}
	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
signed main()
{
    SPEED;
    int n;
    cin>>n;
    cout<<(n/500)*1000+((n%500)/5)*5;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		int a,b;

		Scanner sc =  new Scanner(System.in);

		a = sc.nextInt();
		b = sc.nextInt();

		int ab1,ab2,ab3;

		ab1 = a + b;
		ab2 = a - b;
		ab3 = a*b;

		int max = ab1;

		if (ab2 > max) max = ab2;
		if (ab3 > max) max = ab3;

		System.out.println(max);
	}
}


Measured memory_bytes: 21716
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

ss = list(input()[:-1])

ss.sort()

a = s(ss)

for i in range(len(a)):
    if a[i][1] >= 2:
        print("no")
        break
else:
    print("yes")

Measured memory_bytes: 65376
N = int(input())
S = 0
 
for i in range(1, N+1):
    if i % 3 == 0 and i % 5 == 0:
        i = "FizzBuzz"
    elif i % 3 == 0:
        i = "Fizz"
    elif i % 5 == 0:
        i = "Buzz"
    else:
        S += i
 
print(S)


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

using namespace std;
const int OO = 0x3f3f3f3f;
//const long long OO = (long long) 5e18+7;
//const unsigned long long UOO = (long long) 10e18+7;
#define lp(i,a,n) for(long long i = a ; i < n ; ++i)
#define lpr(i,a,n) for(long long i = a ; i >= n ; --i)
#define rep(i,vec) for(ll i = 0 ; i < vec.size() ; ++i)
#define reprv(i,vec) for(ll i = vec.size()-1; i >=0 ; --i)
#define eps (1e-5)
#define pb(i) push_back(i)
#define EPS 1e-9
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define debug(x) cout<<(#x)<<": \""<<x<<"\""<<endl
#define debugVec(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl

typedef vector<int> vi ;
typedef   long long ll;
typedef   unsigned long long ull;
typedef vector<ll> vll ;
typedef pair<int,int> pii ;
typedef vector< pair<int,int> >  vpii;
typedef vector<pair<long long,long long>> vpll;
typedef vector<vector<int> > vvi ;
typedef complex<double> point;
typedef pair<ll,ll> pll;

using namespace std;
ll  inv(ll a, ll b) {return 1 < a ? b - inv(b % a, a) * b / a : 1;}
ll  Pow(ll  B,ll  P){ll  R=1; while(P>0)  {if(P&1) R=(R*B);P/=2;B=(B*B);}return R;} //compute b^p
ll  GCD(ll  a,ll  b){ while(b){b ^= a ^=b ^= a %=b;}  return a;}
ll  LCM(ll  a,ll  b) { return (a / GCD(a,b)*b); }
ll  BigMod(ll  B,ll  P,ll  M){ ll  R=1; while(P>0)  {if(P&1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (ll )R;} //compute b^p%m
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//int i=uniform_int_distribution<int>(1,n)(rng);


int N,k;
vi h;
int mem[100005];






int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
//    cout.tie(0);
//#ifndef ONLINE_JUDGE
//   freopen( "output.txt" , "w" , stdout ) ;
//   freopen( "input.txt" , "r" , stdin ) ;
//#endif

    cin >> N >> k;
    h.resize(N);
    lp(i,0,N) cin >> h[i];
    --N;
    lp(i,0,N) mem[i] = 1000000000;
    mem[N] = 0;
    lpr(i,N,1){
        lp(j,1,k+1){
            if(i-j<0) break;
            mem[i-j] = min(mem[i-j],mem[i]+abs(h[i]-h[i-j]));
        }

    }
    cout << mem[0];


    return 0;
}


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

int main(){
  int n;
  cin>>n;
  char s[n];
  int countR=0,countW=0;
  for(int i=0;i<n;i++){
    cin>>s[i];
    if(s[i]=='R')
      countR++;
   else
      countW++;
  }
  int count=0;
  for(int i=0;i<countR;i++){
    if(s[i]=='W')
      count++;
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define Check system("pause")
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)



int main()
{
	ios::sync_with_stdio(false);
	int n,t=0;
	ll w=1,k,a=1000000000000000000;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>k;
		if(k==0)
		{
			cout<<"0";
			return 0;
		}
		if(a/w<k)
		t=1;
		if(!t) w=w*k;
	}
	if(t) cout<<"-1";
	else cout<<w;
	return 0;
}




Measured memory_bytes: 3652
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int[] c = new int[n];
		int[] s = new int[n];
		int[] f = new int[n];
		for(i=0;i<n-1;i++) {
			c[i] = parseInt(sc.next());
			s[i] = parseInt(sc.next());
			f[i] = parseInt(sc.next());
		}
		sc.close();
		int[] a = new int[n];
		for(i=0;i<n-1;i++) {
			for (j = i; j < n-1; j++) {
				if(a[i]<s[j]) {
					a[i]=s[j];
				} else {
					a[i] = (int)ceil((double)(a[i]-s[j])/f[j])*f[j]+s[j];
					
				}
				a[i] += c[j];
			}
		}
		PrintWriter pw = new PrintWriter(out);
		for(i=0;i<n;i++) {
			pw.println(a[i]);
		}
		pw.flush();
	}
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;

#define pb push_back
#define mp make_pair

#define mod 1000000007

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

#define vin(v, n) for (int i = 0; i < (int)(n); i++) cin >> (v)[i];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll x, y;
	cin >> x >> y;

	if (y % 2 == 1) cout << "No" << endl;
	else {
		if ((y - 2 * x) % 2 == 0 ) {
			ll b = (y - 2 * x)/2;

			if (b < 0) {cout << "No" << endl;}
			else {
				if ((-1 * y + 4 * x) % 2 == 0) {
					ll a = (-1 * y + 4 * x) / 2;
					if (a < 0) { cout << "No" << endl;}
					else {cout << "Yes" << endl;}
				}
				else cout<< "No" << endl;
			}
		}

		else cout << "No" << endl;
	}
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int M = sc.nextInt();

		long gakusei[][] = new long[N][2];
		long point[][] = new long[M][2];

		for (int i = 0; i < N; i++) {
			gakusei[i][0] = sc.nextInt();
			gakusei[i][1] = sc.nextInt();
		}

		for (int i = 0; i < M; i++) {
			point[i][0] = sc.nextInt();
			point[i][1] = sc.nextInt();
		}

		long goalhairetsu[] = new long[N];
		for (int i = 0; i < N; i++) {
			long manhattan = 999999999;
			long goal = 999999999;
			long kyori;
			for (int j = 0; j < M; j++) {
				kyori = Math.abs((gakusei[i][0] - point[j][0])) + Math.abs((gakusei[i][1] - point[j][1]));
				if (kyori < manhattan) {
					manhattan = kyori;
					goal = j + 1;
				}
			}
			goalhairetsu[i] = goal;
		}
		// 出力
		for (int i = 0; i < N; i++) {
			System.out.println(goalhairetsu[i]);
		}
	}
}


Measured memory_bytes: 23764
package main

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

func main() {
	c := nextInts(3)
	t := 301
	for i, vi := range c {
		for j, vj := range c {
			if i == j {
				continue
			}
			t = Min(vi+vj, t)
		}
	}
	fmt.Println(t)
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextString() string {
	return nextReader()
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func Max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Min(s, v)
	}
	return s
}

func MaxA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Max(s, v)
	}
	return s
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


Measured memory_bytes: 640
import java.util.*;
import javax.lang.model.util.ElementScanner6;
//import java.lang.Math;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // 入力
        String x = sc.next();
        String y = sc.next();
        String z = sc.next();

        // 処理
        String out = z + " " + x + " " + y;


        // 出力
        System.out.println(out);
    }
}

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

bool Check(string& s)
{
    int l = s.length();
    int h = floor(l / 2);
    for(int i = 0; i < h; ++i)
    {
        if(s.at(i) != s.at(l - i - 1))
        {
            return false;
        }
    }

    return true;
}

void Main()
{
    string S;
    cin >> S;
    int64_t N = S.length();

    if(!Check(S))
    {
        cout << "No" << endl;
        return;
    }

    string temp = S.substr(0, (N - 1) / 2);
    if(!Check(temp))
    {
        cout << "No" << endl;
        return;
    }

    temp = S.substr((N + 3) / 2 - 1, N - ((N + 3) / 2 - 1) + 1);
    if(!Check(temp))
    {
        cout << "No" << endl;
        return;
    }

    cout << "Yes" << endl;
}

int main()
{
    Main();
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;
    int cnt = 0, flag;
    
    while(cin >> s){
      bool flag = false;      
      int l = s.length();
      for(int i = 0; i <= l/2; i++){
        if(s[i] != s[l-i-1]){
          flag = true; break;
        }
      }
      if(flag == false) cnt++;
    }
    
    cout << cnt << endl;
}

Measured memory_bytes: 1184
#include<bits/stdc++.h>
using namespace std;
const long long INF=1LL<<62;
inline void read(int &x){
    x=0;
    char ch=getchar();
    while(!isdigit(ch)) ch=getchar();
    while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
}
int main(){
    int x;
    read(x);
    cout<<x*x*x<<endl;
    return 0;
}


Measured memory_bytes: 3060
#include<stdio.h>

int main(){
	double x,y;
	double a,b,c,d,e,f;

	while(scanf("%lf %lf %lf %lf %lf %lf", &a,&b,&c,&d,&e,&f) != EOF){
		if(e == 0 && d*b != 0){
			x = (f/d);
			y = (c/b)-(a*f)/(b*d);
		}else if(b == 0 && a*e != 0){
			x = (c/a);
			y = (f/e)-(c*d)/(a*e);
		}else if(a == 0 && b*d != 0){
			y = (c/b);
			x = (f/d)-(c*e)/(b*d);
		}else if(d == 0 && a*e != 0){
			y = (f/e);
			x = (c/a)-(b*f)/(a*e);
		}else{
			x = (e*c - b*f)/(a*e - b*d);
			y = (f/e) - (d/e)*x;
		}

		printf("%.3lf %.3lf\n", x+0.0001,y+0.0001);
	}

	return 0;
}

Measured memory_bytes: 656
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;

using namespace std;

int main(){
    int n,i,h=0,t=0;
    string s;
    cin>>n>>s;
    for (i=0;i<n;i++){
        if (s[i]=='(') h++;
        else{
            if (h>0) h--;
            else t++;
        }
    }
    //(を上回る分だけ(を左端に挿入
    for (i=0;i<t;i++) cout<<"(";
    cout<<s;
    for (i=0;i<h;i++) cout<<")";
    cout<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		String op = sc.next();
		int B = sc.nextInt();
		
		if(op.equals("+"))
		{
			System.out.println(A + B);
		}else
		{
			System.out.println(A - B);
		}
	}

}


Measured memory_bytes: 23764
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]

for i in sc:
    for j in sc:
        if i[0] == j[0] and i[1] != j[1]:
            print(-1)
            exit()

result = []
if n == 1:
    result = [0]
if n == 2:
    result = [1, 0]
if n == 3:
    result = [1, 0, 0]

for i in sc:
    if i[0] == 1 and i[1] == 0 and n > 1:
        print(-1)
        exit()

    result[i[0]-1] = i[1]

print("".join(map(str,result)))

Measured memory_bytes: 3064
s = gets.chomp

max_cnt = 0
cnt = 0
s.chars.each do |c|
  if %[A C G T].include?(c)
    cnt += 1
  else
    max_cnt = [max_cnt, cnt].max
    cnt = 0
  end
end
max_cnt = [max_cnt, cnt].max

puts max_cnt


Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
int main()
{
  int y,m,d;
  char a,b;
  cin>>y>>a>>m>>b>>d;

  cout<<(m>=5?"TBD":"Heisei")<<endl;


}

Measured memory_bytes: 256
#include <stdio.h>

int n, A[50];

int solve(int i, int m){
	if(m == 0) {return 1;}
	if(i >= n) {return 0;}
	int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
	return res;
}

int main(){
	int q, M, i;
	
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d", &A[i]);
	}
	scanf("%d", &q);
	for(i = 0; i < q; i++){
		scanf("%d", &M);
		if(solve(0,M)) {printf("yes\n");}
		else {printf("no\n");}
	}
	
	return 0;
}



Measured memory_bytes: 2128
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>
#include "bits/stdc++.h"

namespace adaptor = boost::adaptors;

int64_t n, A[25];

bool isPossible(int64_t i, int64_t m) {
    if (m == 0) return true;
    if (i > n) return false;
    bool res = isPossible(i + 1, m) || isPossible(i + 1, m - A[i]);
    return res;
}

void solve() {
    std::cin >> n;
    for (int64_t i = 0; i < n; i++) {
        std::cin >> A[i];
    }

    int64_t q, m;
    std::cin >> q;
    for (int64_t i = 0; i < q; i++) {
        std::cin >> m;
        if (isPossible(0, m))
            std::cout << "yes" << std::endl;
        else
            std::cout << "no" << std::endl;
    }
    return;
}

int main() {
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}



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

bool eq_str(string s, string t) {
    bool flg = true;
    if (s.size() != t.size()) return false;
    else {
        for (int i = 0; i < s.size(); i++) {
            char s_tmp = s[i];
            char t_tmp = t[i];
            if (s_tmp != t_tmp) {
                if (s_tmp >= 'a' && s_tmp <= 'z') {
                    if (s_tmp - 'a' + 'A' != t_tmp) {
                        flg = false;
                        break;
                    }
                }
                if (s_tmp >= 'A' && s_tmp <= 'Z') {
                    if (s_tmp + 'a' - 'A' != t_tmp) {
                        flg = false;
                        break;
                    }
                }
            }
        }
        return flg;
    }
}

vector<string> split(string s) {
    vector<string> result;
    istringstream iss(s);
    string tmp;
    while (getline(iss, tmp, ' ')) {
        result.push_back(tmp);
    }
    return result;
}

int main(void) {
    string W;cin>>W;
    int result = 0;
    cin.ignore();
    while (true) {
        string s;
        getline(cin, s);
        if (s == "END_OF_TEXT") break;
        vector<string> vc = split(s);
        for (auto tmp : vc) {
            if (eq_str(tmp, W)) result++;
        }
    }
    cout << result << endl;
}


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

using namespace std;
int main(){
  int n,k;
  int max;
  cin >> n >> k;
  while(n != 0 || k != 0){
    vector <int> a(n);
    cin >> a[0];
    for(int i =  1 ; i < k ; i++){
      cin >> a[i];
      a[i] += a[i-1];
    }
    max = a[k-1];

    for(int i = k; i < n ; i++){
      cin >> a[i];
      a[i] += a[i-1];
      if(max < (a[i] - a[i-k])){
        max = a[i] - a[i-k];
      }
    }
    cout << max << endl;
    cin >> n >> k;
  }
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
        #define MAXN 200100
        #define pii pair<int,int>
        #define ff first
        #define ss second
        #define ll long long
        #define in_range(x, y, n) (x >= 0 and x<n and y >=0 and y<n)
        using namespace std;
        const ll mod = 1e9 + 7;


        int main (){
            ios_base::sync_with_stdio(false);
            int n, m;

            cin >> n >> m;

            vector<int> v[MAXN];
            for (int i=0; i<n; i++){
                int a, b;
                cin >> a >> b;
                v[a].push_back(b);
            }

            ll ans = 0;

            multiset<int> st;
            for (int i=1; i<=m; i++){
                for (auto x: v[i]) st.insert(x);
                if (st.empty()) continue;

                ans += *prev(st.end());
                st.erase(prev(st.end()));
            }

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

Measured memory_bytes: 10112
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 500050;
const int K = 230000;
const int M = 1e9;
const int mod = 1e9 + 7;
int n;
int solve(vector <pair<int, int>> a){
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    set <int> t;
    int res = 0;
    for (int i = 1; i <= 1 + a.size(); i++) t.insert(i);
    for (auto x: a){
        auto y = t.lower_bound(x.S + 1);
        if (y == t.end()) y--;
        while(y != t.begin() && (*y) > x.S) y--;
        if (y == t.begin() && (*y) > x.S) continue;
        else{
            res += x.F;
            t.erase(y);
        }
    }
    return res;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
     //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        vector <pair<int,int>> a, b;
        int ans = 0;
        for (int i = 1; i <= n; i++){
            int k, l, r;
            cin >> k >> l >> r;
            int x = min(l, r);
            ans += x;
            l -= x;
            r -= x;
            if (r == 0){
                a.pb({l, k});
            } else{
                b.pb({r, n - k});
            }
        }
        ans += solve(a) + solve(b);
        cout << ans << endl;
    }
}


Measured memory_bytes: 14056
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int Max_K(105);
const int Max_NM(105);

int N, M, K, MOD, Fac[Max_NM], Inv[Max_NM], F[Max_NM][Max_NM], G[2][Max_NM][Max_NM], power[Max_K][Max_NM * Max_NM];

inline int Add(int a, int b)
{
	return a + b >= MOD ? a + b - MOD : a + b;
}

inline int Sub(int a, int b)
{
	return a - b < 0 ? a - b + MOD : a - b;
}

inline int Mult(int a, int b)
{
	return a * 1LL * b % MOD;
}

inline void upd(int &a, int b)
{
	a = Add(a, b);
}

inline void inc(int &a, int b)
{
	a = Sub(a, b);
}

void exgcd(int a, int b, int &x, int &y)
{
	if (b == 0)
		x = 1, y = 0;
	else
		exgcd(b, a % b, y, x), y -= x * (a / b);
}

inline int inverse(int a)
{
	int invx, invy;
	exgcd(a, MOD, invx, invy);
	return (invx % MOD + MOD) % MOD;
}

int main()
{
	scanf("%d%d%d%d", &N, &M, &K, &MOD);
	Fac[0] = 1;
	for (int i = 1;i <= max(N, M);++i)
		Fac[i] = Mult(Fac[i - 1], i);
	Inv[max(N, M)] = inverse(Fac[max(N, M)]);
	for (int i = max(N, M) - 1;i >= 0;--i)
		Inv[i] = Mult(Inv[i + 1], i + 1);
	for (int d = 1;d <= K;++d)
	{
		power[d][0] = 1;
		for (int i = 1;i <= N * M;++i)
			power[d][i] = Mult(power[d][i - 1], d);
	} 
	F[0][0] = 1;
	for (int d = 1;d <= K;++d)
	{
		for (int n = 0;n <= N;++n)
			for (int m = 0;m <= M;++m)
				G[0][n][m] = F[n][m];
		memset(G[1], 0, sizeof(G[1]));
		for (int m = 0;m <= M;++m)
			for (int x = 0, xs;x <= N;++x)
			{
				xs = Mult(Mult(power[d][x * (M - m)], power[K - d + 1][x * m]), Inv[x]);
				for (int n = 0;n <= N;++n)
					upd(G[1][n + x][m], Mult(G[0][n][m], xs));
			}
		memset(G[0], 0, sizeof(G[0]));
		for (int n = 0;n <= N;++n)
			for (int y = 0, xs;y <= M;++y)
			{
				xs = Mult(Mult(power[d][y * (N - n)], power[K - d + 1][y * n]), Inv[y]);
				for (int m = 0;m + y <= M;++m)
					upd(G[0][n][m + y], Mult(G[1][n][m], xs));
			}
		if (d == K)
			goto loop;
		memset(G[1], 0, sizeof(G[1]));
		for (int m = 0;m <= M;++m)
			for (int x = 0, xs;x <= N;++x)
			{
				xs = Mult(Mult(power[d][x * (M - m)], power[K - d][x * m]), Inv[x]);
				if (x & 1)
					xs = Sub(0, xs);
				for (int n = 0;n + x <= N;++n)
					upd(G[1][n + x][m], Mult(G[0][n][m], xs));
			}
		memset(G[0], 0, sizeof(G[0]));
		for (int n = 0;n <= N;++n)
			for (int y = 0, xs;y <= M;++y)
			{
				xs = Mult(Mult(power[d][y * (N - n)], power[K - d][y * n]), Inv[y]);
				if (y & 1)
					xs = Sub(0, xs);
				for (int m = 0;m + y <= M;++m)
					upd(G[0][n][m + y], Mult(G[1][n][m], xs));
			} 
		loop :
		for (int n = 0;n <= N;++n)
			for (int m = 0;m <= M;++m)
				F[n][m] = G[0][n][m];
	}
	printf("%d", Mult(F[N][M], Mult(Fac[N], Fac[M])));
	return 0;
}

Measured memory_bytes: 4608
#include<iostream>
#include<queue>

using namespace std;
static const int N = 100;
static const int INFTY = (1<<21);

int n, M[N][N];
int d[N];  // 距離で訪問状態(color)を管理する

void bfs(int s)
{
    queue<int> q;  // 標準ライブラリのqueueを使用
    q.push(s);
    for (int i = 0; i < n; i++) {
        d[i] = INFTY;  // 距離を十分に大きい値に初期化する
    }
    d[s] = 0;  // s(始点)の距離を0とする
    int u;
    while(!q.empty()) {  // キューにキーがある限り実行
        u = q.front();  // キューの一番上の要素をuにして
        q.pop();  // 削除
        for (int v = 0; v < n; v++) {
            if (M[u][v] == 0) {  // uからvへのパスがなければ次へ
                continue;
            }
            if (d[v] != INFTY) {  // 距離が十分に大きくなければ次へ
                continue;
            }
            d[v] = d[u] + 1;  // d[v]にd[u]の距離+1を入れる
            q.push(v);
        }
    }
    for (int i = 0; i < n; i++) {
        cout << i + 1 << " " << ((d[i] == INFTY) ? (-1) : d[i]) << endl;
    }
}

int main()
{
    int u, k, v;

    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            M[i][j] = 0;
        }
    }

    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        u--;
        for (int j = 0; j < k; j++) {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    bfs(0);

    return 0;
}


Measured memory_bytes: 3140
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  int32_t N, M;
  cin >> N >> M;
  vector<int> checked(N, -1);

  for (int i = 0; i < M; i++) {
    int32_t s, c;
    cin >> s >> c;
    if (checked[s-1] != -1 && checked[s-1] != c) {
      cout << -1 << endl;
      return 0;
    } else if (N >= 2 && s-1 == 0 && c == 0) {
      cout << -1 << endl;
      return 0;
    }
    checked[s-1] = c;
  }

  int32_t res = 0;
  for (int i = 0; i < N; i++) {
    if (i == 0 && checked[i] == -1) {
      if (N == 1) {
        res = 0;
      } else {
        res = 1;
      }
    } else if (i == 0) {
      res = checked[i];
    } else if (checked[i] == -1) {
      res = res * 10;
    } else {
      res = res*10 + checked[i];
    }
  }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

int main() {
    int a,b,h;
    cin >>a >>b;
    h=a+b;
    if (h%2!=0) {
        cout << "IMPOSSIBLE";
    }
    else
        cout << h/2;
    
return 0;
}

Measured memory_bytes: 256
s = list(input())

memo = ""
cnt = 0
before_cnt = 0
ans = 0

for x in s:
    if memo == "":
        memo = x
    
    if memo == x:
        cnt += 1
    else:
        ans += cnt * (cnt+1) // 2
        if before_cnt < cnt:
            if memo == ">":
                ans -= before_cnt
        else:
            if memo == ">":
                ans -= cnt
        before_cnt = cnt
        cnt = 1
        memo = x
else:
    ans += cnt * (cnt+1) // 2
    if before_cnt < cnt:
        if memo == ">":
            ans -= before_cnt
    else:
        if memo == ">":
            ans -= cnt
    before_cnt = cnt
    cnt = 0

print(ans)

Measured memory_bytes: 7836
#include<stdio.h>
int main(void){
  int N;
  int A,B,C;
  scanf("%d",&N);
  for(A = 0;N >= 100;A++){
    N = N - 100;
  }
  for(B = 0;N >= 10;B++){
    N = N - 10;
  }
  for(C = 0;N >= 1;C++){
    N = N -1;
  }
  if(A == 7){
    printf("Yes");
    return 0;
  }
  if(B == 7){
    printf("Yes");
    return 0;
  }
  if(C == 7){
    printf("Yes");
    return 0;
  }
  printf("No");
  return 0;
}

Measured memory_bytes: 1700
#include <stdio.h>
#define N 100

int main(){
  int A[N];
  int v,i,j,num,cnt;

  scanf("%d",&num);
  
  for(i=0;i<num;i++){
    scanf("%d",&A[i]);
  }
  
  for(cnt=0;cnt<num;cnt++){
      printf("%d",A[cnt]);
      if(cnt != num-1) printf(" ");
      if(cnt == num-1) printf("\n");
  }
    
    
  for(i=1;i<num;i++){
        v = A[i];
    j = i-1;
    while (j>=0 && A[j] > v)
      {
	A[j+1] = A[j];
	j--;
      }
    A[j+1] = v;
    for(cnt=0;cnt<num;cnt++){
      printf("%d",A[cnt]);
      if(cnt != num - 1) printf(" ");
      if(cnt == num - 1) printf("\n");
    }
    

    
  }
 
  return 0;
}





























  



Measured memory_bytes: 2080
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(A == B){
    cout << C << endl;
  }else{
    if(A == C){
      cout << B << endl;
    }else{
      cout << A << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int in(){ int x; scanf("%d", &x); return x; }
int main(){
	int a=in();
	int b=in();
	if(a < b) printf("a < b\n");
	else if(a > b) printf("a > b\n");
	else printf("a == b\n");
	return 0;
}

Measured memory_bytes: 1008
N,A,B=map(int,input().split())
if N>(A+B):
    if N%(A+B)<A:
        print((N//(A+B))*A+(N%(A+B)))
    else:
        print((N//(A+B))*A+A)
elif A<N<=(A+B):
    print(A)
else:
    print(N)

Measured memory_bytes: 3060
import sys
list1=[]
list3=["Bingo","Bingo","Bingo"]
A1,A2,A3=map(str,input().split())
A4,A5,A6=map(str,input().split())
A7,A8,A9=map(str,input().split())
n=int(input())
list1=[input() for i in range(1,n+1)]
list2=[[A1,A2,A3],
    [A4,A5,A6],
    [A7,A8,A9]]
for y in range(3):
    for x in range(n):
            if (list1[x] in list2[y])==True:
                s=list2[y].index(list1[x])
                list2[y][s]="Bingo"
#横
for i in range(3):
    if list2[i]==list3:
        print("Yes")
        sys.exit()
#斜め
if list2[0][0]==list2[1][1] and list2[1][1]==list2[2][2]:
    print("Yes")
elif list2[0][2]==list2[1][1] and list2[1][1]==list2[2][0]:
    print("Yes")
#縦
elif list2[0][0]==list2[1][0] and list2[1][0]==list2[2][0]:
    print("Yes")
elif list2[0][1]==list2[1][1] and list2[1][1]==list2[2][1]:
    print("Yes")
elif list2[0][2]==list2[1][2] and list2[1][2]==list2[2][2]:
    print("Yes")
elif n<=2:
    print("No")
else:
    print("No")
    

Measured memory_bytes: 3188
#include<cstdio>
#define buf 1000
using namespace std;
void Answer(int ans);

int main(void){
	int ans,n;
	char str[buf];

	for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
		sscanf(str,"%d",&n);
		ans=n%39;
		Answer(ans);
	}
	return 0;
}

void Answer(int ans){
	printf("3C");
	if(ans==0)
		printf("%d\n",ans+39);
	else if(ans<10)
		printf("0%d\n",ans);
	else 
		printf("%d\n",ans);
}

Measured memory_bytes: 2588
const main = (input) => {
  input = input.trim();
  input = input.split(' ');
  const c = input[0];
  
  if (c=="a"||c=="e"||c=="i"||c=="o"||c=="u") {
      console.log("vowel");
      }else{
      console.log("consonant");
      }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

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

    int ans = 0;
    for (int x = 0; x <= K; x++) {
        for (int y = 0; y <= K; y++) {
            int z = S - (x + y);
            if (z >= 0 && z <= K) ans++;
        }
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
const int inf = numeric_limits<int>::max()/2;
const ll mod = 1e9 + 7;


int main(void){
  int n,p;
  cin >> n >> p;
  ll e = 1,o = 0;
  for(int i = 0;i < n;++i){
    int a;
    cin >> a;
    ll ne,no;
    if(a % 2 == 0){      
      ne = e+e;
      no = o+o;
    }else{
      ne = e+o;
      no = o+e ;
    }
    e = ne;o = no;
  }
  if(p)cout << o << endl;
  else cout << e << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main() {
	int n;
	cin >> n;
	int x=n%10;
	if(x==2 || x==4 || x==5 || x==7 || x==9){
		cout << "hon" << endl;
	}else if(x==3){
		cout << "bon" << endl;
	}else{
		cout << "pon" << endl;
	}
	return 0;
}


Measured memory_bytes: 3636
n, x, y = gets.chomp.split.map(&:to_i)
cnt = Hash.new(0)
1.step(n) do |i|
  i.step(n) do |j|
    d = [j - i, 1 + (i - x).abs + (j - y).abs].min
    cnt[d] += 1
  end
end

(1..(n - 1)).each {|i| puts cnt[i] }

Measured memory_bytes: 1916
N=int(input())

def f(a,b):
  return max(len(str(a)), len(str(b)))

i=1
ans=float("inf")
while i**2<=N:
  if N%i==0:
    temp=f(i, N//i)
    ans=min(ans, temp)
  i+=1
print(ans)

Measured memory_bytes: 65344
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

x = int(input())
primeList = primes(10**6)
a = 10**9
ans = 0

for i in primeList:
    if abs(x-i) <= a and x <= i:
        a = abs(x-i)
        ans = i

print(ans)

Measured memory_bytes: 20344
#include <bits/stdc++.h>
using namespace std;
long long n,now,X[100005],Y[100005],H[100005],q,ans;
struct V {
	long long x,y;
} A[100005];
struct X {
	long long an1,an2,f;
} Q[200005];
long long Find(long long i) {
	if(Q[i].f==i)return Q[i].f;
	return Q[i].f=Find(Q[i].f);
}
void BU(long long a,long long b) {
	a=Find(a),b=Find(b);
	if(a^b) {
		Q[a].an1+=Q[b].an1;
		Q[a].an2+=Q[b].an2;
		Q[b].f=a;
	}
}
int main() {
	scanf("%lld",&n);
	for(long long i=1; i<=n; i++) {
		scanf("%lld %lld",&A[i].x,&A[i].y);
		if(!X[A[i].x]) {
			X[A[i].x]=++q;
			Q[q].an2=1;
			Q[q].f=q;
		}
		if(!Y[A[i].y]) {
			Y[A[i].y]=++q;
			Q[q].an1=1;
			Q[q].f=q;
		}
	}
	for(long long i=1; i<=n; i++)
		BU(X[A[i].x],Y[A[i].y]);
	for(long long i=1; i<=n; i++){
		q=Find(X[A[i].x]);
		if(!H[q]){
			H[q]=1;
			ans+=Q[q].an1*Q[q].an2;
		}
		q=Find(Y[A[i].y]);
		if(!H[q]){
			H[q]=1;
			ans+=Q[q].an1*Q[q].an2;
		}
	}
	ans-=n;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 8832
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#include <limits>
#include <utility>
#include <bitset>
#include <sstream>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
#define INF 1e18

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

	// 1~N dice
	long double t = 0.0;
	int nn;
	long double ans = 0.0;
	for (int n = 1; n <= N; n++)
	{
		nn = n;
		long long b = 1;
		while (true)
		{
			if (nn >= K)
			{
				break;
			}
			nn <<= 1;
			b <<= 1;
		}
		t += 1.0 / b;
	}
	ans = (long double) t / N;

	printf("%.15Lf\n",ans);

	return 0;
}

Measured memory_bytes: 256
N,C = [ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(N) ]

dx = [0]*(N+1)
for i in range(N+1):
  if (i==0):
    dx[i]=li[i][0]-0
  elif(i==N):
    dx[i]=C-li[i-1][0]
  else:
    dx[i]=li[i][0]-li[i-1][0]

lic = [0]*(N+1)
for i in range(N):
  lic[i+1] = lic[i] + li[i][1] - dx[i]
liu = [0]*(N+1)
for i in range(N,0,-1):
  liu[i-1] = liu[i] + li[i-1][1] - dx[i]
lic2 = [0]*(N+1)
for i in range(N):
  lic2[i+1] = lic2[i] + li[i][1] - dx[i]*2
liu2 = [0]*(N+1)
for i in range(N,0,-1):
  liu2[i-1] = liu2[i] + li[i-1][1] - dx[i]*2
lic2ma = [0]*(N+1)
for i in range(1,N+1):
  lic2ma[i] = max(lic2ma[i-1],lic2[i])
liu2ma = [0]*(N+1)
for i in range(N-1,0,-1):
  liu2ma[i] = max(liu2ma[i+1],liu2[i])

if (False):
  
  print (dx)  
  print ( lic )
  print ( liu )  

  print (lic2)
  print (lic2ma)
  print (liu2)
  print (liu2ma)

ma = 0
for i in range(N+1):
  ma = max(ma, lic[i] + liu2ma[i] )
  ma = max(ma, liu[i] + lic2ma[i] )
  
print ( ma )

  




Measured memory_bytes: 69592
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Solve(long a, long b)
        {
            if (0 < a) { return 1; }
            else if (0 <= b) { return 0; }
            else { return (((a + b) & 1) == 0) ? -1 : 1; }
        }
        static void Main(string[] args)
        {
            var V = ReadLongs();
            string s = "";
            switch (Solve(V[0], V[1]))
            {
            case -1: s = "Negative"; break;
            case 0: s = "Zero"; break;
            case 1: s = "Positive"; break;
            }
            Console.WriteLine(s);
        }
    }
}


Measured memory_bytes: 13140
obj = {}


def f(n):
    if n in obj:
        return obj[n]
    if n < 4:
        obj[n] = False
        return False
    if n == 4 or n == 7:
        obj[n] = True
        return True
    if f(n - 7):
        obj[n] = True
        return True
    if f(n - 4):
        obj[n] = True
        return True


def main():
    N = int(input())
    if f(N):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int N;
  vector<int> d;

  cin >> N;
  rep(i, N) {
    int a;
    cin >> a;
    d.push_back(a);
  }
  int sum = 0;
  rep(i, N) {
    rep(j, N) {
      if (i != j) {
        sum += d.at(i) * d.at(j);
      }
    }
  }
  cout << sum / 2 << endl;
}


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

int main(){
    int h,w,n=0;
    std::vector<int> vec_h,vec_w;
    while(1){
        cin >> h >> w;
        vec_h.push_back(h);
        vec_w.push_back(w);
        if(h==0&&w==0)break;
        n++;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<vec_h[i];j++){
            for(int k=0;k<vec_w[i];k++){
                if(j==0||j==vec_h[i]-1){
                    cout << "#";
                }else{
                    if(k==0||k==vec_w[i]-1){
                        cout << "#";
                    }else{
                        cout << ".";
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long n;
	cin>>n;
	long long  ans=0;
	long long  a=100;
	while(1)
	{
		a=a+a/100;
		ans++;
		if(a>=n)
		{
			cout<<ans<<endl;
			return 0;
		}
	}
	return 0;
}

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvl vector<vector<long long>>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define vpli vector<pair<long long, int>>
#define vs vector<string>
#define deb(x) cout << x << endl;
#define all(x) x.begin(), x.end()
vector<vvi> dp;
int M = 1e9 + 7;
vi k;
int d;
void modadd(int &a, int b)
{
    a = (a + b) % M;
    if(a<0)
        a+= M;
}

int helper(int pos, bool full, int sum)
{
    if (pos == k.size())
        return (sum == 0);
    if (dp[pos][full][sum] != -1)
        return dp[pos][full][sum];
    int limit = (full ? (k[pos]) : (9));
    int ans = 0;
    for (int i = 0; i <= limit; i++)
    {
        modadd(ans, helper(pos + 1, full && (i == limit), (sum+i)%d ) );
    }
    dp[pos][full][sum] = ans;
    return ans;
}

void solve()
{
    string s;
    cin >> s >> d;
    k.resize(s.size());
    for (int i = 0; i < s.size(); i++)
    {
        k[i] = s[i] - '0';
    }
    dp.resize(s.size());
    for (vvi &t : dp)
    {
        t.resize(2);
        for (vi &u : t)
        {
            u.resize(d+1);
            for (int &x : u)
                x = -1;
        }
    }
    cout << ((helper(0, 1, 0)-1+M)%M)<<endl;
}

int main()
{
    int t = 1;
    //cin>>t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 13192