akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

/* prototype declaration */
void printAns(int a, int b, int flag);
int isLeapYear(int year);

int main(int argc, const char *argv[])
{
	int a, b, flag = 0;
	while(scanf("%d%d", &a, &b)!=EOF){
		if(a == 0 && b == 0) break;
		printAns(a, b, flag);
		flag = 1;
	}	
	return 0;
}

void printAns(int a, int b, int flag)
{
	if(flag) printf("\n");

	int y, na_flag = 1;
	for(y=a; y<=b; y++){
		if(isLeapYear(y)){
		 	printf("%d\n",  y);
			na_flag = 0;
		}
	}
	if(na_flag) printf("NA\n");
}

int isLeapYear(int year)
{
	if(year%4) return 0;
	if(year%100) return 1;
	if(year%400) return 0;
	return 1;
}

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

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

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

struct BipartiteMatching {
	vector< vector< int > > graph;
	vector< int > match, alive, used;
	int timestamp;

	BipartiteMatching(int n) : graph(n), alive(n, 1), used(n, 0), match(n, -1), timestamp(0) {}

	void add_edge(int u, int v) {
		graph[u].push_back(v);
		graph[v].push_back(u);
	}

	bool dfs(int idx) {
		used[idx] = timestamp;
		for (auto &to : graph[idx]) {
			int to_match = match[to];
			if (alive[to] == 0) continue;
			if (to_match == -1 || (used[to_match] != timestamp && dfs(to_match))) {
				match[idx] = to;
				match[to] = idx;
				return true;
			}
		}
		return false;
	}

	int bipartite_matching() {
		int ret = 0;
		for (int i = 0; i < graph.size(); i++) {
			if (alive[i] == 0) continue;
			if (match[i] == -1) {
				++timestamp;
				ret += dfs(i);
			}
		}
		return ret;
	}

	void output() {
		for (int i = 0; i < graph.size(); i++) {
			if (i < match[i]) {
				cout << i << "-" << match[i] << endl;
			}
		}
	}
};

int main() {

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

	int N;
	cin >> N;

	vector<pair<int, int>> ab(N), cd(N);
	for (int i = 0; i < N; i++) cin >> ab[i].first >> ab[i].second;
	for (int i = 0; i < N; i++) cin >> cd[i].first >> cd[i].second;

	BipartiteMatching bm(2 * N);
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {

			if (ab[i].first < cd[j].first && ab[i].second < cd[j].second) {
				bm.add_edge(i, N + j);
			}

		}
	}

	cout << bm.bipartite_matching() << "\n";

	return 0;
}

Measured memory_bytes: 256
import numpy as np

N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]

count = np.zeros(N)

for a in A:
    count[a-1] += 1

ans = K - (Q - count)

for answer in ans:
    if answer <= 0:
        print('No')
    else:
        print('Yes')
    


Measured memory_bytes: 33168
# stdin
INPUT_SENTENCES = 2
ss = [input() for i in range(INPUT_SENTENCES)]
N = int(ss[0])
p = list(map(lambda x: int(x), ss[1].split()))
rev_index = []
for i in range(N-1):
    if p[i] > p[i+1]:
        if len(rev_index) > 0:
            rev_index.append(i+1)
        else:
            rev_index.append(i)
if len(rev_index) == 2:
    p[rev_index[0]], p[rev_index[1]] = p[rev_index[1]], p[rev_index[0]]
if p == list(range(1,N+1)):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>

using namespace std;


int SL[200005];
int SR[200005];
int SU[200005];
int SD[200005];
int TL[200005];
int TR[200005];
int TU[200005];
int TD[200005];

int main(){
  int H, W, N;
  int sr, sc;
  string S, T;
  cin >> H >> W >> N;
  cin >> sr >> sc;
  cin >> S >> T;
  int p = sc;
  int flag = 0;
  for(int i=N;i>=1;i--){
    SR[i-1] = SR[i] + (S[i] == 'R');
    TL[i-1] = TL[i] + (T[i] == 'L');
  }
  // cout << "L" << endl;
  for(int i=0;i<N;i++){
    if(S[i] == 'L'){
      p--;
      if(p == 0){
	flag = 1;
	goto end;
      }
    }
    if(T[i] == 'R'){
      p = min(p+1, W - max(- TL[i] + SR[i], 0));
    }
  }
  for(int i=0;i<N;i++){
    SL[i+1] = SL[i] + (S[i] == 'L');
    TR[i+1] = TR[i] + (T[i] == 'R');
  }
  p = sc;
  // cout << "R" << endl;  
  for(int i=0;i<N;i++){
    // cout << p << endl;
    if(S[i] == 'R'){
      p++;
      if(p == W+1){
	flag = 1;
	goto end;
      }
    }
    if(T[i] == 'L'){
      p = max(p-1, 1 + max(- TR[i] + SL[i], 0));
    }
  }
  for(int i=N;i>=1;i--){
    SD[i-1] = SD[i] + (S[i] == 'D');
    TU[i-1] = TU[i] + (T[i] == 'U');
  }
  p = sr;
  // cout << "U" << endl;  
  for(int i=0;i<N;i++){
    if(S[i] == 'U'){
      p--;
      if(p == 0){
	flag = 1;
	goto end;
      }
    }
    if(T[i] == 'D'){
      p = min(p+1, H - max(-TU[i] + SD[i], 0));
    }
  }
  for(int i=0;i<N;i++){
    SU[i+1] = SU[i] + (S[i] == 'U');
    TD[i+1] = TD[i] + (T[i] == 'D');
  }
  p = sr;
  // cout << "D" << endl;  
  for(int i=0;i<N;i++){
    if(S[i] == 'D'){
      p++;
      if(p == H+1){
	flag = 1;
	goto end;
      }
    }
    if(T[i] == 'U'){
      p = max(p-1, 1 + max(- TD[i] + SU[i], 0));
    }
  }

 end:
  if(flag){
    cout << "NO" << endl;
  }else{
    cout << "YES" << endl;
  }
  return 0;
}


Measured memory_bytes: 7048
k, s = list(map(int, input().split()))

p = s
factors = {}

while p > 1:
    f = False
    for i in range(2, int(p**0.5)+1):
        if p % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1

            p //= i
            f = True
            break

    if not f:
        if p in factors:
            factors[p] += 1
        else:
            factors[p] = 1
        break

if len(factors) == 0:
    print(1)
else:
    primes = list(factors.keys())
    exp = [0] * len(primes)
    upper = s/k
    ans = 1

    while exp[0] <= factors[primes[0]]:
        num = 1
        for i in range(len(primes)):
            num *= pow(primes[i], exp[i])

        if num == upper:
            ans = num
            break
        elif num < upper:
            ans = max(ans, num)

        index = len(primes)-1
        done = False
        while not done:
            exp[index] += 1
            if exp[index] > factors[primes[index]]:
                if index == 0:
                    break
                else:
                    exp[index] = 0
                    index -= 1
            else:
                done = True

    print(ans)

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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int solve(const vvi& g,int u)
{
	int m=g[u].size();
	vi ds(m);
	rep(i,m) ds[i]=solve(g,g[u][i]);
	sort(all(ds));
	int res=m;
	rep(i,m) res=max(res,ds[i]+m-i);
	return res;
}

int main()
{
	for(int n;cin>>n&&n;){
		vi a(n,-1);
		repi(i,1,n) cin>>a[i],a[i]--;
		vvi g(n);
		repi(i,1,n) g[a[i]].push_back(i);
		cout<<solve(g,0)<<endl;
	}
}


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

class Main {

    public static void main(String[] args) {

	Scanner stdin = new Scanner(System.in);

	while ( true ) {

	    final int n = stdin.nextInt();
	    if ( n == 0 ) {
		break;
	    }

	    final int[] before = new int[n];
	    final int[] current = new int[n];
	    for ( int i = 0; i < n; i++ ) {
		current[i] = stdin.nextInt();
	    }
	    final HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
	    
	    int count = 0;
	    while ( !isSame( before, current ) ) {
		System.arraycopy( current, 0,  before, 0, current.length );
		map.clear();
		for ( final int val : current ) {
		    if ( map.containsKey( val ) ){
			map.put( val, map.get( val ) + 1 );
		    } else {
			map.put( val, 1 );
		    }
		}
		for ( int i = 0; i < current.length; i++ ) {
		    current[i] = map.get( current[i] );
		}
		count++;
	    }
	    count--;
	    System.out.println( count );
	    if ( current.length > 0 ) {
		System.out.print( current[0] );
		for ( int i = 1; i < current.length; i++ ){
		    System.out.print(" " + current[i] );
		}
		System.out.println();
	    }		
	}
	
    }

    static boolean isSame ( int[] a1, int[] a2 ) {
	for ( int i = 0; i < a1.length; i++ ) {
	    if ( a1[i] != a2[i] ) {
		return false;
	    }
	}
	return true;
    }
    
}

Measured memory_bytes: 23488
//NEVER GIVE UP I AM GOING TO IMPROVE ONE DAY.
//PRACTICE,PRACTICE,PRACTICE!!!
#include<bits/stdc++.h>
#define int long long int
// #define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 1e18
#define endl "\n"
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); 
#define dbg(x)  cerr << #x << " = " << x << endl;
const int M=100005;
const int mod=1000000007;
const double pi = acos(-1.0);
using namespace std;
int32_t main(){

    #ifndef ONLINE_JUDGE 
        freopen("in.txt", "r", stdin); 
        freopen("out.txt", "w", stdout); 
    #endif 

    fast;
    int t;
    t=1;
    // cin>>t;
    // int test=t;
    while(t--){
        int x;
        cin>>x;
        if(x>=30){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll n;cin >>n;
    vector<ll>ans(26,INF);
    for (int i = 0; i < n; ++i) {
        vector<ll>now(26,0);
        string s;
        cin >>s;
        ll m=s.size();
        for (int j = 0; j < m; ++j) {
            now[s[j]-'a']++;
        }
        for (int j = 0; j < 26; ++j) {
            ans[j]=min(ans[j],now[j]);
        }
    }
    for (int i = 0; i < 26; ++i) {
        if(ans[i]!=INF){
            for (int j = 0; j < ans[i]; ++j) {
                cout <<(char)('a'+i);
            }
        }
    }
    cout <<endl;
    return 0;
}



Measured memory_bytes: 256
# フィボナッチ数列

n = int(input())
F = [0] * (n + 1)


def fibonacci(n):
    global F
    if n == 0 or n == 1:
        F.append(1)
        F.append(1)
        return 1
    if F[n] != 0:
        return F[n]
    F[n] = fibonacci(n - 1) + fibonacci(n - 2)
    return F[n]


ans = fibonacci(n)
print(ans)



Measured memory_bytes: 5600
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
int ctoi(char a) {
	return (int)a - '0';
}
const long long Inf = 4523372036854775807;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++

int bit[200001],n,q;
int sum(int x){
	int sum=0;
	while(x>0){
		sum+=bit[x];
		x-=x&-x;
	}
	return sum;
}
void add(int i,int x){
	while(i<=n){
		bit[i]+=x;
		i+=i&-i;
	}
}
signed main() {
	cin>>n>>q;
	for(int i=0;i<q;i++){
		int com,x,y;
		cin>>com>>x>>y;
		if(com==0){
			add(x,y);
		}
		else{
			if(x==0) cout<<sum(y)<<endl;
			else cout<<sum(y)-sum(x-1)<<endl;
		}
	}
	getchar();getchar();
}



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

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int D=sc.nextInt();
		if(D==25) {
			System.out.print("Christmas");
		}
		if(D==24) {
			System.out.print("Christmas Eve");
		}
		if(D==23) {
			System.out.print("Christmas Eve Eve");
		}
		if(D==22) {
			System.out.print("Christmas Eve Eve Eve");
		}
		sc.close();
	}

}

Measured memory_bytes: 20564
//#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

void func150a()
{
    int k, x;

    cin >> k;
    cin >> x;

    if (x <= k * 500) cout << "Yes";
    else cout << "No";
    cout << "\n";
}

int main()
{

    func150a();
    return 0;
}

Measured memory_bytes: 256
import math

N, D = [int(_) for _ in input().split()]
X = [[int(_) for _ in input().split()] for __ in range(N)]
cnt = 0

for i in range(N):
    for j in range(i+1,N):
        l2 = 0
        for k in range(D):
            l2 += (X[i][k]-X[j][k])**2
        l = math.sqrt(l2)
        if l.is_integer():
            cnt += 1
print(cnt)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文
int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << a[0] + a[1] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try(Scanner scanner = new Scanner(System.in)) {
            String nums = scanner.next();
            int count = 0;
            for (int i = 0; i < nums.length(); i++) {
                if (nums.charAt(i) == '1') {
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}


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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll N;
vector<ll> A;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return b/gcd(a,b)*b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // Globalなvectorのリサイズ
  //A.resize(N);

  ll n, r;
  cin >> n >> r;
  if (n < 10) {
    cout << r + 100 * (10 - n) << endl;
  } else {
    cout << r << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Map.Entry;
import java.util.function.DoubleToLongFunction;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		String s = sc.next();
		System.out.println(s.substring(0, 4) + " " + s.substring(4, s.length()));
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

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

bool in[101];

void solve() {
    int L;
    cin >> L;
    stack<int> st;
    for (int i=1; i<=L; ++i) {
        int c;
        cin >> c;
        if (c > 0) {
            if (in[c]) {
                cout << i << endl;
                return;
            }
            st.push(c);
            in[c] = true;
        } else {
            if (st.empty() || st.top() != -c) {
                cout << i << endl;
                return;
            }
            st.pop();
            in[-c] = false;
        }
    }
    cout << "OK" << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(5*1e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

string s;
vector<int>rowx, rowy;
int cnt, memo;
int gx, gy;
bool dpx[8000][16005], dpy[8000][16005];
signed main() {
	cin >> s >> gx >> gy;
	gx += 8000, gy += 8000;
	rep(i, s.size()) {
		if (s[i] == 'T') {
			if (memo) {
				if (cnt % 2)rowy.push_back(memo);
				else rowx.push_back(memo);
				memo = 0;
			}
			cnt++;
		}
		else {
			memo++;
		}
	}
	if (memo) {
		if (cnt % 2)rowy.push_back(memo);
		else rowx.push_back(memo);
		memo = 0;
	}

	//x座標のDP
	dpx[0][8000] = true;
	bool b = false;
	if (s[0] == 'T')b = true;
	rep(i, rowx.size()) {
		rep(j, 16001) {
			if (dpx[i][j]) {
				if (b) {
					dpx[i + 1][j - rowx[i]] = true;
				}
				dpx[i + 1][j + rowx[i]] = true;
			}
		}
		b = true;
	}
	//y座標のDP
	dpy[0][8000] = true;
	rep(i, rowy.size()) {
		rep(j, 16001) {
			if (dpy[i][j]) {
				dpy[i + 1][j + rowy[i]] = true;
				dpy[i + 1][j - rowy[i]] = true;
			}
		}
	}
	if (dpx[rowx.size()][gx] && dpy[rowy.size()][gy]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	endre;
}

Measured memory_bytes: 64384
#include<bits/stdc++.h>
using namespace std;
int n,m;
struct hhh
{
	long long l,k;
}x[1000],y[1000];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>x[i].l>>x[i].k;
	for(int i=1;i<=m;i++)
		cin>>y[i].l>>y[i].k;
	long long legm,minn=1<<30;	
	for(int i=1;i<=n;i++)		
	{
		for(int j=1;j<=m;j++)
		{
			long long pop=abs(x[i].l-y[j].l)+abs(x[i].k-y[j].k);
			if(pop<minn)
			{
				minn=pop;
				legm=j;
			}
		}
		cout<<legm<<endl;
		minn=1<<30;
	}	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  int ans = a*x+b*y;
  ans = min(ans, max(x,y)*c*2);

  if (x > y) {
    swap(x,y);
    swap(a,b);
  }
  ans = min(ans, c*x*2+(b*(y-x)));
  COUT(ans);

  return 0;
}

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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

int main() {
    int x,y;
    int z,w;
    cin >> x >> y >> z >> w;

    int ans = 0;

    if(x != z){
        ans = 1;
    }else{
        ans = 0;
    }

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

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

using std::vector;
using std::pair;
void explore(vector<int> &v, vector<vector<int> > &adj, int i, int count){
	v[i]=count;
	for(int j=0; j<adj[i].size(); j++){
		if(v[adj[i][j]]==-1)
			explore(v, adj, adj[i][j], count);
	}
}
int number_of_components(vector<vector<int> > &adj) {
  int count = 1, i=0, n=adj.size();
  	vector<int> v(n, -1);
  	while(n--){
  		if(v[i]==-1){
  			explore(v, adj, i, count);
  			count++;
		  }
		  i++;
	  }
  return count-1;
}

int main() {
  size_t n, m;
  std::cin >> n >> m;
  vector<vector<int> > adj(n, vector<int>());
  for (size_t i = 0; i < m; i++) {
    int x, y;
    std::cin >> x >> y;
    adj[x - 1].push_back(y - 1);
    adj[y - 1].push_back(x - 1);
  }
  std::cout << number_of_components(adj)-1;
}

Measured memory_bytes: 10068
package main

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

const mod int64 = 1000000007

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,100)}
  n,m := input.NextInts()
  a := make(map[int]struct{})
  for i:=0;i<m;i++ { a[input.NextInt()] = struct{}{} }
  dp := make([]int64,n+1)
  dp[0],dp[1] = 1,1
  if _,ok := a[1];ok { dp[1] = 0 }
  for i:=2;i<n+1;i++ {
    dp[i] = (dp[i-1]+dp[i-2])%mod
    if _,ok := a[i];ok { dp[i] = 0 }
  }
  fmt.Println(dp[n])
}

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInt() int {
  x,_ := strconv.Atoi(i.NextLine())
  return x
}
func(i *Input) NextInts() (int,int) {
  s := strings.Split(i.NextLine()," ")
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}

Measured memory_bytes: 5504
x, y, a, b, c = map(int, input().split())
ps = list(map(int, input().split()))
qs = list(map(int, input().split()))
rs = list(map(int, input().split()))
ps.sort()
ps = ps[-x:]
qs.sort()
qs = qs[-y:]
pqs = ps + qs
pqs.sort()
rs.sort(reverse=True)

answer = sum(pqs)
for i in range(min(x+y, c)):
    diff = rs[i] - pqs[i]
    if diff < 0:
        break
    answer += diff

print(answer)


Measured memory_bytes: 105444
#include<bits/stdc++.h>
using namespace std;
long long a[23][23];
long long sco[1<<22],dp[1<<22];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++) cin>>a[i][j];
	}
	for(int i=1;i<(1<<n);i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<j;k++){
				if((i&(1<<j))&&(i&(1<<k))) sco[i]+=a[j][k];
			}
		}
	}
	for(int i=1;i<(1<<n);i++){
		dp[i]=sco[i];
		for(int j=i;j;j=i&(j-1)){
			dp[i]=max(dp[i],dp[i^j]+sco[j]);
		}
	}
	cout<<dp[(1<<n)-1];
}

Measured memory_bytes: 2816
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.List
import Data.Maybe
import Data.Bits

query :: Int -> String
query 0 = "0"
query i = loop i 1 []
  where
    loop 0 !sgn_ acc = acc
    loop i sgn !acc | even i = loop (i `shiftR` 1) (-sgn) $ '0':acc
                    | otherwise = loop (i' `shiftR` 1) (-sgn) $ '1':acc
      where i' = i-sgn

main :: IO ()
main = do
  n <- read <$> getLine
  putStrLn $ query n


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

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

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

  int n;
  cin >> n;
  vector<string> ss(n);
  for (int i = 0; i < n; i++) {
    cin >> ss[i];
  }

  auto encode_fn = [](const string& s) -> vector<int> {
    vector<int> cs(256);
    for (int i = 0; i < s.length(); i++) {
      cs[s[i]]++;
    }
    return  cs;
  };

  vector<int> cs(256, 1000000);
  for (int i = 0; i < n; i++) {
    auto ds = encode_fn(ss[i]);
    for (int j = 0; j < 256; j++) {
      UpdateMin(cs[j], ds[j]);
    }
  }

  string ans = "";
  for (int i = 0; i < 256; i++) {
    for (int j = 0; j < cs[i]; j++) {
      ans.push_back(i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int C = scanner.nextInt();

        int ans = (A - B) - C;
        if(ans < 0) ans = Math.abs(ans);
        else ans = 0;

        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {
	/**
	 * Addition and Subtraction Easy
	 * @param 1 ≦ A, B ≦ 10^9
	 */
	public static void main(String... args) {
		try (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
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

int main() {
    int N, K;
    cin >> N >> K;
    V<int> P(N), C(N);
    rep(i, N) cin >> P[i], --P[i];
    rep(i, N) cin >> C[i];
    
    ll ans = -1000000000;
 
    rep(i, N) {
        int v = i;
        ll cycle_sum = 0;
        int cycle_cnt = 0;
 
        while (true) {
            cycle_cnt++;
            cycle_sum += C[v];
            v = P[v];
            if (v == i) break;
        }
 
        ll path = 0;
        int cnt = 0;
 
        while (true) {
            cnt++;
            path += C[v];
 
            if (cnt > K) break;
            int num = (K - cnt) / cycle_cnt;
            ll score = path + max(0ll,cycle_sum) * num;
            if(ans<score)ans = score;
 
            v = P[v];
            if (v == i) break;
        }
    }
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 3680
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  int N, K;

  std::cin >> N >> K;

  std::vector<int> D(N);

  for (int i=0; i<N; i++) std::cin >> D[i];

  int ans = 0;

  for (int kl=0; kl<=std::min(N, K); kl++) {
    for (int kr=0; kl+kr<=std::min(N, K); kr++) {
      // std::cerr << kl << ' ' << kr << ':';

      std::vector<int> gotten(kl);
      gotten.reserve(kl+kr);
      std::copy(D.begin(), std::next(D.begin(), kl), gotten.begin());
      std::copy(std::next(D.begin(), N-kr), D.end(), std::back_inserter(gotten));
      std::sort(gotten.begin(), gotten.end());

      // for (auto e: gotten) std::cerr << ' ' << e;
      // std::cerr << std::endl;

      int can_skip = K-kl-kr;
      int value = 0;

      for (auto v: gotten) {
        // std::cerr << ' ' << v;
        if (v < 0 && can_skip > 0) {
          // std::cerr << 'S';
          can_skip--;
          continue;
        }
        value += v;
      }
      // std::cerr << std::endl;
      // std::cerr << ' ' << value << std::endl;

      ans = std::max(ans, value);
    }
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
n,m,c=map(int,input().split())
b=[int(x) for x in input().split()]
ans=0
for i in range(n):
  a=[int(x) for x in input().split()]
  combined1 = [x * y for (x, y) in zip(a, b)]
  if sum(combined1) + c >0:
    ans+=1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)

int main()
{
  long long a,b,c,d;
  cin >> a >> b >> c >> d;
  if(b<=0 && c>=0) cout << b*c << endl;
  else if(d<=0 && a>=0) cout << a*d << endl;
  else{
    if(a==0) a++;
    if(b==0) b--;
    if(c==0) c++;
    if(d==0) d--;
    if(a*c < b*d) cout << b*d << endl;
    else cout<< a*c << endl;
  }
  return 0;
}

Measured memory_bytes: 3604
#include "bits/stdc++.h"
using namespace std;
int main() {
	int n;
	while(scanf("%d",&n),n) {
		int ans=0;
		for(int i=1;i*i<=n;i++) {
			if(i*i==n) ans++;
			for(int j=i;i*i+j*j<=n;j++) {
				if(i*i+j*j==n) ans++;
				for(int k=j;i*i+j*j+k*k<=n;k++) {
					if(i*i+j*j+k*k==n) ans++;
					for(int l=k;i*i+j*j+k*k+l*l<=n;l++) {
						if(i*i+j*j+k*k+l*l==n) ans++;
					}
				}
			}
		}
		printf("%d\n",ans);
	}
}

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

using namespace std;
typedef long long ll;

int T;

ll gcd(ll a, ll b) {
	if (a % b == 0)return b;
	return gcd(b, a % b);
}

bool ok(ll a, ll b, ll c, ll d) {
	if (b > d) {
		return false;
	}
	else if (b == d) {
		if (a % b <= c)return true;
		else return false;
	}
	else {
		ll G = gcd(b, d);
		if (c < b - G || (a % b) > c || a < b)return false;
		return true;
	}
}

int main() {
	cin >> T;
	for (int i = 0; i < T; i++) {
		ll A, B, C, D;
		cin >> A >> B >> C >> D;
		if (ok(A, B, C, D))cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 998244353
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;

int main() {
	fast_io;
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if (k <= a)
		cout << k << '\n';
	else if (k <= a + b)
		cout << a << '\n';
	else
		cout << a - k + a + b << '\n';
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

string s;
int n;

bool possible( int k ){
	bool res = true;
	for( int i = n-k; i < k-1; ++i ){
		if( s[i] != s[i+1] ) res = false;
	}
	return res;
}

int main(){
	cin >> s;
 	n = s.l_ength();
  	int ok = 1;
	int ng = n+1;
	while( ng-ok > 1 ){
		int mid = (ok+ng)/2;
		if( possible(mid) ){
			ok = mid;
		} else {
			ng = mid;
		}
	}
	cout << ok << endl;
}

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

	#define itn int
	#define vi vector<int>
	#define pb push_back
	#define srt sort(v.begin(), v.end())
	#define retunr return

	//int infiint = std::numeric_limits<int>::max();
	//float infiflt = std::numeric_limits<float>::infinity();


	int main() {
	    std::ios::sync_with_stdio(false);
	    cin.tie(0);
	    //freopen("input.txt", "rt", stdin);

	    int a, b, c;
	    cin >> a >> b >> c;
	    
	    if((a==b) || (b==c) || (a==c)) {
	    	if((a!=b) || (b!=c) || (a!=c))
	    		cout << "Yes";
	    	else cout << "No";
	    }
	    else cout << "No";
	    
	    return 0;
	}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}


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

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}


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

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

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

		public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
int x;
int y;
int hantei =9;
for(;hantei!=0;){
	x=sc.nextInt();
	y=sc.nextInt();
	
	if(x==0){
		if(y==0){
		System.exit(0);	
		}
	}
	if(x<=y){
		System.out.println(x + " "+y);
	}else if(y<x){
		System.out.println(y + " "+x);
	}
	
	
}
	
	
	
	}
	}

Measured memory_bytes: 36204
#include<bits/stdc++.h>
using namespace std;
long long H[100000+1],n;
long long A[100000+1];
long long rec(long long x)
{   
    if(x>=n-1)
    return 0;
    
    if(x==n-2)
    return abs(H[n-1]-H[n-2]);
    
    if(A[x]!=-1)
    return A[x];
	
	long long ans=min(abs(H[x]-H[x+1])+rec(x+1),abs(H[x]-H[x+2])+rec(x+2));
	
	return A[x]=ans;
}
int main()
{
	cin>>n;
	memset(A,(long long)-1,sizeof(A));
	for(int i=0;i<n;i++)
	cin>>H[i];
	
	long long cost=rec(0);
	
	//for(int i=0;i<4;i++)
	//cout<<A[i]<<" ";
	
	cout<<cost;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
  int N,M;cin>>N>>M;vi A(M);rep(i,M)cin>>A[i];
  int tot=0;rep(i,M)tot+=A[i];
  if(N-tot>=0)cout<<N-tot<<endl;
  else cout<<-1<<endl;
}





Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;


long long int n;
char ch[1004];
map<char,long long int>mp;

long long int solve(string s){
	long long int ret=0;
	for(int i=0;i<s.length();i++){
		if(s[i]<='9'&&s[i]>='2'){ret+=(s[i]-'0')*mp[s[i+1]];i++;}
		else{ret+=mp[s[i]];}
	}
	return ret;
}

void cou(long long int num,long long int ccc){
	if(num==0){return;}
	else if(num==1){cout<<ch[ccc];return;}
	else {cout<<num<<ch[ccc];return;}
}

int main() {
	string s,t;
	mp['m']=1000;
	mp['c']=100;
	mp['x']=10;
	mp['i']=1;
	ch[1]='i';
	ch[2]='x';
	ch[3]='c';
	ch[4]='m';
	cout << fixed << setprecision(18);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s>>t;
		long long int res=solve(s)+solve(t);
		long long int m=res/1000,c=res/100%10,x=res/10%10,ii=res%10;
		//cout<<"DEBUG "<<solve(s)<<" "<<solve(t)<<endl;
		cou(m,4);cou(c,3);cou(x,2);cou(ii,1);
		cout<<endl;
	}

} 


Measured memory_bytes: 3212
#include<stdio.h>

#define MAX 100
#define INFITY 11111111
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[MAX][MAX];

int prim(){
  int u, unchi;
  int d[MAX], p[MAX], color[MAX];

  int i,v;
  for(i = 0; i < n; i++){
    d[i] = INFITY;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while(1){
    unchi = INFITY;
    u = -1;
    for(i = 0; i < n; i++){
      if(unchi > d[i] && color[i] != BLACK){
	u = i;
	unchi = d[i];
      }
    }
    if(u == -1)break;
    color[u] = BLACK;
    for(v = 0; v < n; v++){
      if(color[v] != BLACK && M[u][v] != INFITY){
	if(d[v] > M[u][v]){
	  d[v] = M[u][v];
	  p[v] = u;
	  color[v] = GRAY;
	}
      }
    }
  }
  int sum = 0;
  for(i = 0; i < n; i++){
    if(p[i] != -1)sum += M[i][p[i]];
  }

  return sum;
}

int main(){
  scanf("%d",&n);

  int i, j;
  int e;
  
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      scanf("%d",&e);
      M[i][j] = (e == -1) ? INFITY : e;
    }
  }
  
  printf("%d\n",prim());

  return 0;
}



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

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

int main()
{
    int K;
    cin >> K;
    ll ans = 0;
    for(int i = 1; i < K+1; i++){
        for(int j = 1; j < K+1; j++){
            for(int k = 1; k < K+1; k++){
                ans += gcd(k,gcd(i, j));
            }
        }
    }

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

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

int main(){
  string S_A, S_B, S_C;
  cin >> S_A >> S_B >> S_C;

  int a = 0, b = 0, c = 0, next = 0;
  while(a <= S_A.length() && b <= S_B.length() && c <= S_C.length()){
    // cout << next << endl;
    if(next == 0){
      if(a == S_A.length()){
        cout << 'A' << endl;
        return 0;
      }
      next = S_A[a++] - 'a';
    }else if(next == 1){
      if(b == S_B.length()){
        cout << 'B' << endl;
        return 0;
      }
      next = S_B[b++] - 'a';
    }else{
      if(c == S_C.length()){
        cout << 'C' << endl;
        return 0;
      }
      next = S_C[c++] - 'a';
    }
  }
}

       


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    int N, Y;
    cin >> N >> Y;
    Y /= 1000;
    rep(y, N + 1) rep(z, N + 1) {
        if (y + z > N) break;
        if (4 * y + 9 * z == Y - N) {
            int x = N - y - z;
            if (x < 0 || x > N) continue;
            cout << z << " " << y << " " << x << endl;
            return 0;
        }
    }
    cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256