akhauriyash/Code-Regression huggingface dataset:
def resolve():
    n = int(input())
    a = []

    for i in range(n):
        row = list(map(lambda x: int(x) - 1, input().split()))
        row.reverse()
        a.append(row)

    q = set()

    def check(i):
        if len(a[i]) == 0:
            return
        j = a[i][-1]
        if i == a[j][-1]:
            p = (i, j) if i < j else (j, i)
            q.add(p)

    for i in range(n):
        check(i)

    day = 0
    while len(q) > 0:
        day += 1
        prev_q, q = q, set()

        for p in prev_q:
            (i, j) = p
            a[i].pop()
            a[j].pop()

        for p in prev_q:
            (i, j) = p
            check(i)
            check(j)

    for i in range(n):
        if len(a[i]) != 0:
            print(-1)
            return
    print(day)
    
resolve()

Measured memory_bytes: 67036
#include "bits/stdc++.h"
#define all(x) x.begin(),x.end()
#define rep(i,N) for(int i=0;i<(int)N;++i)
using namespace std;
using ll = long long;
using vint = vector<int>;
using vll = vector<ll>;
using vll2 = vector<vector<ll>>;
const ll INF = (1LL << 30);
const ll LINF = (1LL << 60);
const ll MOD = 1e9 + 7;

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

   while (true) {
      int H, W, N;
      cin >> H >> W >> N;
      if (H == 0 && W == 0 && N == 0) break;
      vll2 g(H, vll(W));
      rep(i, H) rep(j, W) cin >> g[i][j];

      vll2 c(H, vll(W));
      c[0][0] = N - 1;
      rep(i, H) rep(j, W) {
         if (i == 0 && j == 0) continue;
         if (j - 1 >= 0) {
            c[i][j] += c[i][j - 1] / 2;
            if (c[i][j - 1] % 2 != 0 && g[i][j - 1] == 1) c[i][j]++;
         }
         if (i - 1 >= 0) {
            c[i][j] += c[i - 1][j] / 2;
            if (c[i - 1][j] % 2 != 0 && g[i - 1][j] == 0) c[i][j]++;
         }
      }

      rep(i, H) rep(j, W) if (c[i][j] & 1) g[i][j] ^= 1;

      int y = 0, x = 0;
      while (y < H && x < W) {
         if (g[y][x] == 1) x++;
         else y++;
      }

      cout << y + 1 << " " << x + 1 << endl;
   }
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, M;
    cin >> N >> M;
    vector<ll> G[M];
    REP(i, M){
    	ll k;
    	cin >> k;
    	REP(j, k){
    		ll s;
    		cin >> s;
    		s--;
    		G[i].push_back(s);
    	}
    }
    vector<ll> p(M);
    ll res = 0;
    REP(i, M) cin >> p[i];
    REP(mask, 1<<N){
    	vector<ll> cnt(M, 0);
    	REP(i, M){
    		REP(j, G[i].size()){
    			if(mask >> G[i][j] & 1){
    				cnt[i]++;
    			}
    		}
    	}
    	bool flag = true;
    	REP(i, M){
    		if(cnt[i]%2 != p[i]) flag = false;
    	}
    	if(flag) res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

    int N, K, h;
    int count = 0;

    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> h;
        if(h >= K)
            count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

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

    int ans = 6;
    ans -= a + b;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
int main(){
    string s;
    cin>>s;
    int fi, la;
    for (int i=0; i<s.size(); i++){
        if (s[i] == 'A'){
          fi = i;
          break;
        }
    }
    reverse(s.begin(), s.end());
    for (int i=0; i<s.size(); i++){
        if (s[i] == 'Z'){
          la = s.size() - i;
          break;
        }
    }
    cout << la-fi;
}

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

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

  int ans = 0;
  rep(i, 50000)
  {
    if ((int)((i + 1) * 1.08) == N)
    {
      ans = i + 1;
      cout << ans << endl;
      return 0;
    }
  }

  cout << ":(" << endl;

  return 0;
}

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

int main(){
  int n;
  cin >> n;
  int a[n][3];
  rep(i,0,n) cin >> a[i][0] >> a[i][1] >> a[i][2];
  int dp[n][3] = {0};
  rep(i,0,3) dp[0][i] = a[0][i];

  rep(i,1,n)rep(j,0,3)rep(k,0,3){
    if(j!=k) dp[i][k] = max(dp[i][k], dp[i-1][j]+a[i][k]);
  }

  int ans = 0;
  rep(i,0,3) ans = max(ans, dp[n-1][i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**3
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = 2 ** I()
    a = [I() for _ in range(n)]
    while len(a) > 1:
        b = []
        for i in range(len(a)//2):
            if a[i*2] == a[i*2+1]:
                b.append(a[i*2])
            else:
                b.append(abs(a[i*2] - a[i*2+1]))
        a = b

    return a[0]


print(main())



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

#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i,l,n) for(int (i)=(int)(l);(i)<(int)(n);(i)++)
#define d_arr(arr, h, w) rep(i,(h) ){ cout << "["; rep(j,(w) ) { cout << (arr)[i][j] << ", "; } cout << "]" << endl;}
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x);
#define print_a(x) rep(jejeje,x.size()){ cout << x[jejeje] << " "; }

typedef pair<int ,int> P;



int main()
{
    int n,tmp;
    vector<int> x; //[0,n-1]
    cin >> n; //変数の個数
    rep(i,n){
        cin >> tmp;
        x.push_back(tmp);
    }
    unsigned long long int dp[99][21] = {0}; //[0,n-2] [0,20]
    // 総数 : [今いる変数id:0-ori][今までの総和]
    // dp[i][j]:=i番目の数まで使って(足すか引くかして)jを作ることが出来る通りの数

    rep(i,n-1) rep(j,21) dp[i][j] = 0;

    dp[0][x[0]] = 1;
    rep(i,n-1){
        if( i==0 ) {continue;}
        rep(j,21){
            if( j+x[i] < 21 ){ dp[i][j+x[i]] += dp[i-1][j];}
            if( j-x[i] > -1 ){ dp[i][j-x[i]] += dp[i-1][j];}
        }
    }
    cout << dp[n-2][x[n-1]] << endl;
}

Measured memory_bytes: 1232
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int sub = b - a;

		int t = 0;
		for(int i=1; i<=sub; i++) {
			t += i;
		}
		System.out.print(t-b);
		in.close();
		
	}
}

Measured memory_bytes: 23892
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [f64; n],
        a_last: f64,
    }

    let mut sum = 0;
    let mut pred = 0.5;
    let mut max = a.iter().fold(0.0, |s, i| s + i) + a_last;

    for stage in a {
        max -= stage;
        pred = (pred * 2.0) - stage;
        if pred >= max {
            pred = max;
        }
        sum += (pred + stage) as i64;
        // println!("stage:{}, pred: {}, sum: {}", stage, pred, sum);
    }

    if a_last > pred * 2.0 {
        println!("-1");
    } else {
        println!("{}", sum + a_last as i64);
    }
}

Measured memory_bytes: 3592
n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=-10**10
for i in range(n):
	loop=[0]
	now=i
	while True:
		now=p[now]-1
		loop.append(loop[-1]+c[now])
		if now==i:
			break
	L=len(loop)-1
	if k<=L:
		score=max(loop[1:k+1])
		ans=max(score,ans)
	else:
		score=max(loop[-1],0)*(k//L-1)
		ans=max(ans,score)
		for j in range(k%L+L):
			score+=loop[j%L+1]-loop[j%L]
			ans=max(score,ans)
print(ans)

Measured memory_bytes: 80780
#include <iostream>
#include <cmath>
#include <ctgmath>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b + c >= 22){
        cout << "bust";
    }else{
        cout << "win";
    }
    return 0;
}

Measured memory_bytes: 3564
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int n; cin >> n;
	VS u(n);
	rep(i, n)cin >> u[i];

	bool open = false;
	int m; cin >> m;
	rep(i, m) {
		string t;
		cin >> t;

		auto re = find(all(u), t);
		if (re == u.end()) {
			cout << "Unknown " << t << endl;
		}
		else {
			if (!open)open = true, cout << "Opened by " << t << endl;
			else open = false, cout << "Closed by " << t << endl;
		}
	}
}


Measured memory_bytes: 3188
#include <stdio.h>

#define MAX 500 //配列の大きさは500*500で十分です。

int main(void){
	while(1){
		//入力
		//問題ではn, m, t, pとして与えられますが、
		//nはw、mはhとして変数を用意します。
		int w, h, t, p; 
		scanf(" %d %d %d %d", &w, &h, &t, &p);
		if(!w && !h && !t && !p) break;

		//2次元配列は行列のように、i行j列(kami[i][j])として考えます。
		//そのため、座標(x, y)は kami[y][x] となります。
		int kami[MAX][MAX] = {0};
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				kami[i][j] = 1;//折り紙が存在する部分を1で初期化
			}
		}

		//処理
		int origin_x = 0, origin_y =0; //折り紙左上の角の座標を原点として記憶(kami[origin_y][origin_x])
		for(int k=0; k<t; k++){
			int d, c;
			scanf(" %d %d", &d, &c);

			if(d == 1){
				//もし d が 1 なら，左端から c だけ右側を通る垂直の折り線の左側を右側に折り重ねる．
				int dist = 1; //distは折られる前の座標と、折る先の座標の差の絶対値。
				for(int j=origin_x+c; j<origin_x+(2*c); j++){	//折られる先のx座標
					for(int i=0; i<MAX; i++){	//垂直方向に折るループ
						kami[i][j] += kami[i][j-dist];
					}
					dist += 2;
				}
				origin_x += c;
			} else{
				//このプログラムの場合は、上下を入れ替えています。
				//	→もし d が 2 なら，上端から c だけ下側を通る水平の折り線の上側を下側に折り重ねる。
				int dist = 1; //distは折られる前の座標と、折る先の座標の差の絶対値。
				for(int i=origin_y+c; i<origin_y+(2*c); i++){	//折られる先のy座標
					for(int j=0; j<MAX; j++){	//水平方向に折るループ
						kami[i][j] += kami[i-dist][j];
					}
					dist += 2;
				}
				origin_y += c;
			}
		}

		//入力・出力
		for(int k=0; k<p; k++){
			int x, y;
			scanf(" %d %d", &x, &y);
			printf("%d\n", kami[origin_y+y][origin_x+x]);
		}
	}

	return 0;
}


Measured memory_bytes: 2776
/***************************************** 
****       Solution by SlavicG        ****
*****************************************/
 
#include<bits/stdc++.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm> 
#include <set>
#include <utility>
#include <queue>
#include <map>
#include <assert.h>
#include <stack>
using namespace std;
#define ll long long
#define forn(i,n) for(int i=0;i<n;++i)
#define MX 10000000001
#define pow2(a) ((a)*(a))
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define endl "\n"
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 int longestIncreasingSubsequenceLenghtDP(int a[],int n){
    int dp[n],ans=0;
    for(int k = 0;k<n;k++){
        dp[k] = 1;
        for(int i = 0;i<k;i++){
            if(a[i] <= a[k]){
                dp[k] = max(dp[k],dp[i] + 1);
                ans = max(dp[k],ans);
            }
        }
    }
    return ans;
 }
int result[1000] = {0};
int factDP(int n) 
{
   if (n >= 0) {
      result[0] = 1;
      for (int i = 1; i <= n; ++i) {
         result[i] = i * result[i - 1];
      }
      return result[n];
   }
}
bool checkPrime(int n)
{
    if(n<2) return false;
    for(int x = 2;x*x <=n;x++)
    {
        if(n%x == 0)return false;
    }
    return true;
}
vector<int> primeFactors(int n){
    vector<int> f;
    for(int x = 2;x*x<=n;x++){
        while(n%x==0){
            f.push_back(x);
            n/=x;
        }
    }
    if(n>1)f.push_back(n);
    return f;
}
int binary_Search_Classic(int n, int arr[],int target){
	int l,r,mid;
	l=0;
	r=n-1;
	while(l<=r){
		mid= l+(r-l)/2;
		if(arr[mid] == target){
			return mid;
		}
		if(arr[mid] < target){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return -1;
	
}
int binary_Search_First_Greater(int n, int arr[],int target){
	int l,r,ans,mid;
	l = 0;
	r = n-1;
	ans=-1;
	while(l<=r){
		mid = l + (r-l)/2;
		if(arr[mid] > target){
			ans=mid;
			r=mid-1;
		}else{
			l = mid+1;
		}
	}
	return ans;
}
int countDistinctCharsString(string s) {
    unordered_map<char, int> m; 
    for (int i = 0; i < s.length(); i++) { 
        m[s[i]]++; 
    }
    return m.size(); 
} 
int main()
{
	string s,t;
	cin >> s >> t;
	cout << t + s << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <climits>
#include <math.h>
#include <utility>
#include <ctime>
#include <cstdlib>
using namespace std;

typedef long long ll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

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

int main() {
	int x; cin >> x;
	int sum = 0;
	int i = 1;
	while (sum < x) {
		sum += i;
		i++;
	}
	cout << i - 1 << endl;
	return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;

const int N = 510; 
int n, num[N * N], use[N][N], mp[N][N], ans;
int qx[N * N * 2], qy[N * N * 2];

const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
int main(){
	read(n); 
	for (int i = 1; i <= n * n; i++) read(num[i]);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++){
			mp[i][j] = min(min(i - 1, n - i), min(j - 1, n - j));
			use[i][j] = true;
		}
	for (int i = 1; i <= n * n; i++){
		int x = (num[i] - 1) % n + 1, y = (num[i] / n) + (num[i] % n != 0);
		ans = ans + mp[x][y];
		int pl = 1, pr = 1;
		qx[pl] = x, qy[pl] = y;
		use[x][y] = false;
		while (pl <= pr){
			x = qx[pl], y = qy[pl]; pl++;
			int k = mp[x][y] + use[x][y];
			for (int j = 0; j < 4; j++){
				int tx = x + dx[j], ty = y + dy[j];
				if (mp[tx][ty] > k){
					mp[tx][ty] = k;
					qx[++pr] = tx, qy[pr] = ty;
				}
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 8572
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iomanip>
using namespace std;

int main() {
    int a, b, c;
    double S, L, h, t;
    cin >> a >> b >> c;
    h = b * sin(c*M_PI/180);
    S = 0.5 * a * h;
    L = a + b + sqrt(a*a + b*b - 2 * a * b * cos(c*M_PI/180));

    printf("%.10f\n", S);
    printf("%.10f\n", L);
    printf("%.10f\n", h);
    return 0;
}

Measured memory_bytes: 3552
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        int INF = Integer.MAX_VALUE/10;

        while(true){
            int n = sc.nextInt(), m =sc.nextInt();
            if(n==0 && m==0) break;

            int[][] aruki = new int[n][n];
            int[][] fune = new int[n][n];
            for(int i=0; i<n; i++){
                Arrays.fill(aruki[i], INF);
                Arrays.fill(fune[i], INF);
                aruki[i][i] = 0; fune[i][i] = 0;
            }
            for(int i=0; i<m; i++){
                int x = sc.nextInt()-1, y = sc.nextInt()-1, t = sc.nextInt();
                char s = sc.next().charAt(0);
                if(s=='L'){
                    aruki[x][y] = t; aruki[y][x] = t;
                }else{
                    fune[x][y] = t; fune[y][x] = t;
                }
            }

            for(int k=0; k<n; k++)
                for(int i=0; i<n; i++)
                    for(int j=0; j<n; j++){
                        aruki[i][j] = Math.min(aruki[i][j], aruki[i][k]+aruki[k][j]);
                        fune[i][j] = Math.min(fune[i][j], fune[i][k]+fune[k][j]);
                    }
            
            int r = sc.nextInt();
            int[] z = new int[r];
            for(int i=0; i<r; i++) z[i] = sc.nextInt()-1;

            int[][] dp = new int[r][n];
            for(int i=0; i<r; i++) Arrays.fill(dp[i], INF);
            dp[0][z[0]] = 0;
            for(int i=1; i<r; i++){
                for(int j=0; j<n; j++){
                    if(dp[i-1][j]==INF) continue;
                    dp[i][j] = Math.min(dp[i][j], dp[i-1][j] + aruki[z[i-1]][z[i]]);
                    if(aruki[z[i-1]][j]==INF) continue;
                    for(int k=0; k<n; k++)
                        dp[i][k] = Math.min(dp[i][k], dp[i-1][j] + aruki[z[i-1]][j] + 
                                            fune[j][k] + aruki[k][z[i]]);
                    
                }
            }

            int min = INF;
            for(int i=0; i<n; i++) min = Math.min(min, dp[r-1][i]);
            System.out.println(min);
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 62336
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B, N;
  cin >> A >> B;
  if(A<B){
    N = B+(B-1);
  }
  else if(A>B){
    N = A+(A-1);
  }
  else{
    N=A+B;
  }
  cout << N << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int a;
  scanf("%d", &a);
  a = a % 10;
  switch (a) {
  	case 2:
  	case 4:
  	case 5:
    case 7:
    case 9:
  		printf("hon\n");
  		break;
  	case 0:
  	case 1:
  	case 6:
  	case 8:
  		printf("pon\n");
  		break;
  	case 3:
  		printf("bon\n");
  }
  return 0;
}


Measured memory_bytes: 1596
package main

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

func main() {
	io := newIo()
	defer io.Flush()

	N := io.NextInt()
	K := io.NextInt()

	h := make([]int, N)
	for i := range h {
		h[i] = io.NextInt()
	}
	sort.Ints(h)

	ans := math.MaxInt32
	for i := 0; i+K-1 < N; i++ {
		cnt := h[i+K-1] - h[i]
		ans = min(ans, cnt)
	}
	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	_ = io.writer.Flush()
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, _ := io.reader.ReadLine()
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) NextString() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, _ := strconv.Atoi(io.NextString())
	return i
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

vector<vector<ll>> value;

ll factorial(ll n){
    if(n==0) return 1;
    else return n * factorial(n-1);
}

ll calc(ll n, ll r){
    if(value[n][r] != -1) return value[n][r];
    if(n==r || r==0){
        value[n][r] = 1;
    }else{
        value[n][r] = (calc(n-1,r-1) + calc(n-1,r));
    }
    return value[n][r];
}

int main(){
    string N;  cin >> N;
    ll K;  cin >> K;
    ll D = N.length();
    if(D < K){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0;
    value.resize(max(D+1, 10ll), vector<ll>(K+1, -1));
    for(int i=K; i<D; i++){
        ans += pow(9, K) * calc(i-1, K-1);
    }

    vector<int> flag(D-1, 0);
    for(int i=0; i<K-1; i++){
        flag[D-2-i] = 1;
    }   

    if(N[0] - '0' > 1){
        ans += (N[0]-'0'-1)*pow(9, K-1)*calc(D-1, K-1);
    }
    if(K == 1) ans++;
    else if(K==2){
        do {
            for(int i=1; i<=9; i++){
                string temp = "";
                temp += N[0];
                for(int k=1; k<D; k++){
                    if(flag[k-1] == 1) temp += to_string(i);
                    else temp += "0";
                }
                if(temp <= N) ans++;
            }
        }while(next_permutation(flag.begin(), flag.end()));
    }else if(K==3){
        do {
            for(int i=1; i<=9; i++) for(int j=1; j<=9; j++){
                string temp = "";
                temp += N[0];
                bool first = true;
                for(int k=1; k<D; k++){
                    if(flag[k-1] == 1 && first){
                        temp += to_string(i);
                        first = false;
                    }
                    else if(flag[k-1] == 1) temp += to_string(j);
                    else temp += "0";
                }
                if(temp <= N){
                    ans++;
                }
            }
        }while(next_permutation(flag.begin(), flag.end()));
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)]

indexA = {}

for a in A:
  if a not in indexA:
    indexA[a] = 0
  indexA[a] += 1

sumA = sum(A)

for (b,c) in BC:
  if b in indexA:
    sumA += (c-b) * indexA[b]
    if c not in indexA:
      indexA[c] = 0
    indexA[c] += indexA[b]
    indexA[b] = 0
  print(sumA)


Measured memory_bytes: 35992
def main():
    n, k = map(int, input().split())
    pp = list(map(int, input().split()))
    i = 0
    maxi = 0
    s = sum(pp[maxi:maxi + k])
    maxs = s
    while i < n - k:
        s = s - pp[i] + pp[i + k]
        if maxs < s:
            maxs = s  # 増加しているなら
            maxi = i + 1
        i += 1
    print((sum(pp[maxi:maxi + k]) + k) / 2)


if __name__ == "__main__":
    main()


Measured memory_bytes: 25060
#include <vector>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

char s[100005];
ll dp[100005][13];

int main() {
  int n;
  scanf("%s", s);
  n = strlen(s);

  dp[0][0] = 1;

  for (int i = 0; i < n; ++i) {
    int c;
    if (s[i] == '?') c = -1;
    else c = s[i] - '0';
    for (int j = 0; j < 10; ++j) {
      if (c != -1 && c != j) continue;
      for (int k = 0; k < 13; ++k) {
	dp[i + 1][(k * 10 + j) % 13] += dp[i][k];
      }
    }
    for (int j = 0; j < 13; ++j) {
      dp[i + 1][j] %= MOD;
    }
  }

  ll ans = dp[n][5];
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 10496
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>
#include <array>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

#define REP(i,m,n) for(int i=(m); i<(n); i++)
#define RREP(i,n,m) for(int i=(n);i>=(m); i--)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << endl
// #define int long long 

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30)-1);
const ll linf = (1LL<<60);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct mint 
{
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int dp[100010];
    dp[0] = 0;
    REP(i,1,100001)
    {
        dp[i] = inf;
        int power = 1;
        while(power <= i)
        {
            dp[i] = min(dp[i], dp[i-power]+1);
            power *= 6;
        }
        power = 9;
        while(power <= i)
        {
            dp[i] = min(dp[i], dp[i-power]+1);
            power *= 9;
        }
    }
    int N;
    cin >> N;
    cout << dp[N] << endl;
    return 0;
}



Measured memory_bytes: 640
n = int(input())
a = [int(i) for i in input().split()]
arr = [0 for _ in range(n)]
for i in reversed(range(n)):
    s = 0
    for j in range(i, n, i+1):
        s += arr[j]
    s %= 2
    if a[i] != s:
        arr[i] = 1
print(sum(arr))
for i in range(n):
    if arr[i] == 1:
        print(i+1, end=' ')
print('')


Measured memory_bytes: 7276
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

//累積和の問題

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

  int N, Q;
  string s;

  cin >> N >> Q;
  cin >> s;

  vector<int> l(Q);
  vector<int> r(Q);

  for (int i = 0; i < Q; i++) {
    cin >> l[i] >> r[i];
  }

  vector<int> sum(N + 1, 0);

  for (int i = 1; i < N; i++) {            // ACが出るのは2文字目から
    if (s[i - 1] == 'A' && s[i] == 'C') {  // Cを発見かつ前がAだった場合
      sum[i + 1] = sum[i] + 1;
    } else {
      sum[i + 1] = sum[i];
    }
  }
  // 0 1 2 3 4 5 6
  //  A C A C A C
  //

  for (int i = 0; i < Q; i++) {
    int ans = sum[r[i]] - sum[l[i]];
    cout << ans << '\n';
  }
}


Measured memory_bytes: 2256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
#define INF (1LL << 60)
using namespace std;
typedef long long ll;

ll N, S;

ll f(ll b, ll n) {
  if(n < b) return n;
  return f(b, n / b) + (n % b);
}

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

  ll ans = INF;
  REP(b, 2, (ll) (sqrt(N) * 2 + 1)) {
    if(f(b, N) == S) ans = min(ans, b);
  }
  for(ll i = (ll) sqrt(N) * 2; i >= 0; i--) {
    ll p = N / (i + 1), q = (i != 0 ? N / i : INF);
    if(p == 0) continue;
    for(ll k = (N - S + i) / q; k < (N - S + i + p - 1) / p; k++) {
      if(k == 0) {
        ll b = N + 1;
        if(f(b, N) == S) ans = min(ans, b);
        continue;
      }
      if((N - S + i) % k == 0) {
        ll b = (N - S + i) / k;
        if(p < b && b <= q && f(b, N) == S) ans = min(ans, b);
      }
    }
  }
  cout << (ans < INF ? ans : -1) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int N,X,M;
  cin>>N>>X>>M;
  int n=X,m;
  vector<int> A(M,-1);
  for(int i=0;i<N;i++){
    if(A[n]!=-1){
      m=i-A[n];
      break;
    }else A[n]=i;
    n=n*n%M;
    if(i==N-1){
      int ans=0;
      for(int i=0;i<N;i++){
        ans+=X;
        X=X*X%M;
      }
      cout<<ans<<endl;
      return 0;
    }
  }
  int ans=0;
  for(int i=0;i<A[n];i++){
    ans+=X;
    X=X*X%M;
  }
  int sum=0;
  for(int i=0;i<(N-A[n])%m;i++){
    sum+=X;
    ans+=X;
    X=X*X%M;
  }
  for(int i=(N-A[n])%m;i<m;i++){
    sum+=X;
    X=X*X%M;
  }
  cout<<ans+(N-A[n])/m*sum<<endl;
}

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

#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for(int i=a; i<b; i++)

#define PB push_back

int main(){
	int w; scanf("%d", &w);
	REP(i, 1234567){
		int j = i;
		int x = 0;
		int y = 1;
		while(j){
			if(j%3==1) x+=y;
			if(j%3==2) x-=y;
			y*=3;
			j/=3;
		}
		if(x==w){
			j = i;
			int len = 0;
			vector<char> v;
			while(j){
				if(j%3==0){
					v.PB('0');
				}else{
					if(j%3==1){
						v.PB('+');
					}else{
						v.PB('-');
					}
					len = v.size();
				}
				j/=3;
			}
			for(int j = len-1; j>=0; j--){
				printf("%c", v[j]);
			}
			printf("\n");
		}
	}
}

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

// UnionFind木
const int MAX = 100010;
int par[MAX];

void init(){
  rep(i, 0, MAX){
    par[i] = -1;
  }
}

int root(int x){
  if(par[x] < 0){
    return x;
  }
  return par[x] = root(par[x]);
}

int size(int x){
  return -par[root(x)];
}

void unite(int x, int y){
  int rx = root(x);
  int ry = root(y);
  if(rx == ry){
    return;
  }
  if(size(rx) < size(ry)){
    swap(rx, ry);
  }
  par[rx] += par[ry];
  par[ry] = rx;
  return;
}

bool same(int x, int y){
  int rx = root(x);
  int ry = root(y);
  if(rx < 0 || ry < 0){
    if(rx >= 0){
      return rx == y;
    }
    if(ry >= 0){
      return ry == x;
    }
    return false;
  }
  return rx == ry;
}

int main(){
  int n, m;
  cin >> n >> m;
  
  init();
  
  rep(i, 0, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    unite(a, b);
  }
  
  vb ck(n, false);
  
  rep(i, 0, n)
    ck[root(i)] = true;
  
  int cnt = 0;
  
  rep(i, 0, n){
    if(ck[i])
      cnt++;
  }
  
  cout << cnt-1 << endl;
  
  return 0;
  
}

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

long x[3333][3333];
int main() {
    int A, B, c, d, p = 998244353;
    cin >> A >> B >> c >> d;
    x[A][B] = 1;
    for(int a = A; a <= c; a++) {
        for(int b = B; b <= d; b++) {
            if(a == A && b == B)
                continue;
            if(a == A)
                x[a][b] = x[a][b - 1] * a % p;
            else if(b == B)
                x[a][b] = x[a - 1][b] * b % p;
            else
                x[a][b] = (x[a - 1][b] * b + x[a][b - 1] * a +
                           x[a - 1][b - 1] * (a - 1) % p * (p + 1 - b)) %
                          p;
        }
    }
    cout << x[c][d] << endl;
    return 0;
}


Measured memory_bytes: 81628
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cstdio>


using namespace std;

typedef pair<int,int> P;
typedef pair<int,P> PP;
const int MAX = 101;
const int INF = (1<<25);
int N,M,L;
int node[MAX][MAX];

struct Edge{int to,d,killer;};
vector<Edge> E[MAX];

void input(){
  for(int i = 0; i < M; i++){
    int from;
    Edge e;
    cin >> from >> e.to >> e.d >> e.killer;
    E[from].push_back(e);
    swap(from,e.to);
    E[from].push_back(e);
  }
}

void solve(){
  
  priority_queue<PP, vector<PP>, greater<PP> > Q;

  node[L][1] = 0;

  Q.push(PP(0,P(L,1)));

  while(!Q.empty()){
    PP pp = Q.top();
    Q.pop();
    
    int t = pp.first;
    int mon = pp.second.first;
    int pos = pp.second.second;  
    if(node[mon][pos] < t) continue;

    for(int i = 0; i < E[pos].size(); i++){
    

      //employ
      if(mon >= E[pos][i].d){
	if(node[mon-E[pos][i].d][E[pos][i].to] > t){
	  node[mon-E[pos][i].d][E[pos][i].to] = t;
	  PP pp1;
	  pp1.first = t;
	  pp1.second.first = mon-E[pos][i].d;
	  pp1.second.second = E[pos][i].to;
	  Q.push(pp1);
	}
      }

      //not employ
      if(node[mon][E[pos][i].to] > t+E[pos][i].killer){
	node[mon][E[pos][i].to] = t+E[pos][i].killer;
	PP pp1;
	pp1.first = t+E[pos][i].killer;
	pp1.second.first = mon;
	pp1.second.second = E[pos][i].to;

	Q.push(pp1);
      }
    }
  }
  int ans = INF;

  for(int i = 0; i <= L; i++)
    ans = min(ans,node[i][N]);
  cout << ans << endl;
}

void init(){
  for(int i = 0; i < MAX; i++)
    E[i].clear();

  for(int i = 0; i < MAX; i++)
    for(int j = 0; j < MAX; j++) node[i][j] = INF;

}

int main(){

  while(cin >> N >> M >> L && N+M+L){
    init();
    input();
    solve();
  }
  return 0;
}

Measured memory_bytes: 1756
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

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

  reps1(i, 10) {
    if (111*i >= n) {
      cout << 111 * i << endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dp[50];

int fibonacci(int n){
	if(n==0||n==1)return dp[n]=1;
	if(dp[n]!=-1)return dp[n];
	return dp[n]=fibonacci(n-1)+fibonacci(n-2);
}

int main(){
	int n;
	cin>>n;
	int a[1000];
	memset(dp,-1,sizeof(dp));
	cout<<fibonacci(n)<<endl;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n; cin >> n; 
    using XY = tuple<ll, ll>;
    vector<XY> in(n);
    ll minv = inf, maxv = 0;
    rep(i, n){
        ll x, y; cin >> x >> y;
        if(x > y) swap(x, y);
        in[i] = XY(x, y);
        chmin(minv, x);
        chmax(maxv, y);
    }
    sort(_all(in));

    ll res = 0;
    {
        ll maxr = minv, minb = maxv;
        rep(i, n){
            ll x, y; tie(x, y) = in[i];
            chmax(maxr, x);
            chmin(minb, y);
        }
        res = (maxr - minv) * (maxv - minb);
    }

    using Elem = tuple<ll, int, bool>;
    priority_queue<Elem, vector<Elem>, greater<Elem>> q;
    ll l = minv, r = minv;
    rep(i, n){
        ll x, y; tie(x, y) = in[i];
        q.push(Elem(x, i, false));
        chmax(r, x);
    }

    chmin(res, (maxv - minv) * (r - l));
    while(true){
        Elem cur = q.top(); q.pop();
        ll v; int idx; bool used; tie(v, idx, used) = cur;
        if(used) break;
        ll nv; tie(ignore, nv) = in[idx];
        q.push(Elem(nv, idx, true));
        chmax(r, nv);
        l = get<0>(q.top());
        chmin(res, (maxv - minv) * (r - l));
    }

    cout << res << endl;

    return 0;
}


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

#define si(v) v.size()
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (n); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

using ll = long long;
using ld = long double;
using namespace std;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int x; cin >> x;
  if (x < 1200) cout << "ABC\n";
  else cout << "ARC\n";
  
  return (0);
}

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

int main(){
    string s;
    cin >> s;
    int len = s.size();
    bool isH = false;
    for(int i = 0; i < len; i++){
        if(s[i] == 'h'){
            isH = true;
        }
        else if(isH and s[i] == 'i'){
            isH = false;
        }
        else{
            cout << "No" << endl;
            return 0;
        }
    }

    if(isH){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s=="SUN") cout<<7<<endl;
  else if(s=="MON") cout<<6<<endl;
  else if(s=="TUE") cout<<5<<endl;
  else if(s=="WED") cout<<4<<endl;
  else if(s=="THU") cout<<3<<endl;
  else if(s=="FRI") cout<<2<<endl;
  else cout<<1<<endl;
}

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


int main(void){
    int x,y;
    cin >> x >> y;
    bool yes = false;
    rep(a,100)rep(b,100){
        if (a+b == x && a*2 + b*4 == y) {
            yes = true;
        }
    }
    cout << ((yes) ? "Yes" : "No") << endl;
    return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int d;
  cin >> d;
  string ans = "";
  if (d == 25) ans = "Christmas";
  if (d == 24) ans = "Christmas Eve";
  if (d == 23) ans = "Christmas Eve Eve";
  if (d == 22) ans = "Christmas Eve Eve Eve";
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
typedef long long ll;

using ipair = pair<int, int>;

ll INF = 1e16+7;
ll mod = 1e9+7;

bool operator>(const ipair a,const ipair b){return a.first > b.first;}

int main(){
  int N;
  cin >> N;
  vector<int> X(N), Y(N), H(N);
  rep(i, N) cin >> X[i] >> Y[i] >> H[i];

  for(int x=0; x<=100; x++){
    for(int y=0; y<=100; y++){
      bool ok = true;
      int h_candidate = -1;
      // H[i] > 0
      rep(i, N){
        if(H[i] > 0){
          int tmp_h = abs(x-X[i]) + abs(y-Y[i]) + H[i];
          if(h_candidate == -1){
            h_candidate = tmp_h;
          }else{
            if(h_candidate != tmp_h){
              ok = false;
              break;
            }
          }
        }
      }

      if(!ok) continue;

      // H[i] == 0
      rep(i, N){
        if(H[i] == 0){
          int judge = h_candidate - (abs(x-X[i]) + abs(y-Y[i]));
          if(judge > 0){
            ok = false;
            break;
          }
        }
      }

      if(ok){
        cout << x << " " << y << " " << h_candidate << endl;
        return 0;
      }
    }
  }


  return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        GoodGrid solver = new GoodGrid();
        solver.solve(1, in, out);
        out.close();
    }

    static class GoodGrid {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int c = in.nextInt();
            int[][] d = new int[c + 1][c + 1];
            for (int i = 1; i <= c; i++) {
                for (int j = 1; j <= c; j++) {
                    d[i][j] = in.nextInt();
                }
            }

            int[][] cc = new int[n + 1][n + 1];
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= n; j++) {
                    cc[i][j] = in.nextInt();
                }
            }
            int[][] cost = new int[3][c + 1];
            for (int to = 1; to <= c; to++) {
                for (int i = 1; i <= n; i++) {
                    for (int j = 1; j <= n; j++) {
                        int cfrom = cc[i][j];
                        int ccost = d[cfrom][to];
                        cost[(i + j) % 3][to] += ccost;
                    }
                }
            }
            int res = Integer.MAX_VALUE;
            for (int i = 1; i <= c; i++) {
                for (int j = 1; j <= c; j++) {
                    if (i == j) {
                        continue;
                    }
                    for (int k = 1; k <= c; k++) {
                        if (k == i || k == j) {
                            continue;
                        }
                        int tmp = cost[0][i];
                        tmp += cost[1][j];
                        tmp += cost[2][k];
                        res = Math.min(res, tmp);
                    }
                }
            }
            out.println(res);
        }

    }
}



Measured memory_bytes: 60664
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		int lines = Integer.parseInt(sc.nextLine());
		
		while (lines != 0) {
			int score = 0;
			int base = 0;
			int out = 0;
		
			while (out != 3) {
				String line = sc.nextLine();
				
				switch (line) {
				case "HIT":
					if (base != 3) base++;
					else score++;
					break;
				case "HOMERUN":
					score = score + base + 1;
					base = 0;
					break;
				case "OUT":
					out++;
					break;
				}
			}
			
			System.out.println(score);
			lines--;
		}
	}
}

Measured memory_bytes: 25916
import java.util.Scanner;

public class Main {

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

        String str = out.nextLine();
        String[] sss = str.split(" ");
        int a = Integer.parseInt(sss[0]);
        int b = Integer.parseInt(sss[1]);
        int c = Integer.parseInt(sss[2]);
        int d = Integer.parseInt(sss[3]);
        int e = Integer.parseInt(sss[4]);

        if (d - e >= 0 && c - e >= 0 && a - c >= e && b - d >= e) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }


    }
}

Measured memory_bytes: 26228
S = input()

if S == 'Sunny':
    answer = 'Cloudy'
elif S == 'Cloudy':
    answer = 'Rainy'
elif S == 'Rainy':
    answer = 'Sunny'
else:
    answer = '入力間違い【Sunny】【Cloudy】【Rainy】を入力'

print(answer)

Measured memory_bytes: 9108
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.next());
        for (int i = x; i < 2 * x; i++) {
            if (isPrime(i)) {
                System.out.println(i);
                return;
            }
        }
    }

    private static boolean isPrime(long n) {
        for (int i = 2; i <= n / i; i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return n != 1;
    }
}

Measured memory_bytes: 23764