akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main (){
	
	int a,b,c;
	
	scanf("%d",&a);
	scanf("%d",&b);
	
	if(a == 1 && b == 2){
		printf("3");
	}
	
	else if(a == 2 && b == 1){
		printf("3");
	}
	
	else if(a == 2 && b == 3){
		printf("1");
	}
	
	else if(a == 3 && b == 2){
		printf("1");
	}
	
	else {
		printf("2");
	}
	
	return 0;
	
}

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

 
 int main(){
  	ios::sync_with_stdio(false);
    cin.tie(0);  
    int H, W;
    cin>>H>>W; 
    vector<vector<bool> > grid(H);
	vector<vector<int> > d(H); 
	
	for(int i=0;i<H;i++){ 
		d[i]=vector<int> (W);  
		for(int j=0;j<W;j++){ 
			d[i][j]=0; 
		}
	}  
    queue<pair<int,int> > q; 
    
	for(int i=0;i<H;i++){ 
	    string s; 
	    cin>>s; 
	    grid[i]=vector<bool>(W); 
		for(int j=0;j<W;j++){ 
			if (s[j]=='#'){ 
				grid[i][j]=true; 
				q.push(pair<int,int>(i,j));  
			}else{ 
				grid[i][j]=false; 
			}
		}
	} 
	 
	//BFS 
	while(!q.empty()){  
		pair<int,int> loc=q.front(); 
		q.pop();  
		int y=loc.first; 
		int x=loc.second;
		int vu=y+1; 
		int vd=y-1; 
		int vr=x+1; 
		int vl=x-1; 
		if ((vu<H) and not grid[vu][x]){ 
			q.push(pair<int,int> (vu,x));
			d[vu][x]=d[y][x]+1; 
			grid[vu][x]=true;   
			
		} 
		if(vd>=0 and not grid[vd][x]) { 
			q.push(pair<int,int>(vd,x));  
			d[vd][x]=d[y][x]+1; 
			grid[vd][x]=true;  
		} 
		if(vr<W and not grid[y][vr]) { 
		     q.push(pair<int,int>(y,vr)); 
		      d[y][vr]=d[y][x]+1; 
		      grid[y][vr]=true;  
		  } 
		  if(vl>=0 and not grid[y][vl]){ 
		  	q.push(pair<int,int>(y,vl)); 
		  	d[y][vl]=d[y][x]+1; 
		  	grid[y][vl]=true; 
		  }
		
	} 
	
	int m=0; 
	for(int j=0;j<H;j++){ 
		for(int i=0;i<W;i++){ 
		m=max(m,d[j][i]);   
		}
	
	} 
	cout<<m; 
    
    return 0; 
    
}


Measured memory_bytes: 12560
x,y = gets.split.map(&:to_i)

if x < 0 && y > 0
    puts -x <= y ? 1 + y + x : 1 - y - x
elsif x <= y
    puts y - x
elsif x == 0 || y == 0
    puts x == 0 ? 1 - y : 1 + x
elsif x > 0 && y < 0
    puts 1 + (x + y).abs
else
    puts 2 + x - y
end

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(0)<<fixed;
  ll a;
  string b;
  cin>>a>>b;
  ll c=(b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');
  cout<<a*c/100<<'\n';
  return 0;
}


Measured memory_bytes: 3652
#include <complex>
#include <vector>
#include <set>
#include <cstdio>
using namespace std;

const double EPS = 1e-12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

bool intersectLP(const L &l, const P &p) {
  return abs(cross(l[1]-p, l[0]-p)) < EPS;
}

long long pow_binary_mod(long long x,long long y,long long M){
	long long z=1;
	for(;y;y>>=1){
		if((y&1)!=0)z=z*x%M;
		x=x*x%M;
	}
	return z;
}

int main(){
	int M=998244353;
	int N,x,y;
	scanf("%d",&N);
	vector<P>v(N);
	int r=pow_binary_mod(2,N,M);
	set<pair<int,int> >se;
	for(int i=0;i<N;i++)scanf("%d%d",&x,&y),v[i]={(double)x,(double)y};
	for(int i=0;i<N;i++)for(int j=i+1;j<N;j++){
		if(se.find({i,j})!=se.end())continue;
		L l(v[i],v[j]);
		vector<int>x={i,j};
		for(int k=0;k<N;k++)if(k!=i&&k!=j&&intersectLP(l,v[k]))x.push_back(k);
		for(int a=0;a<x.size();a++)for(int b=a+1;b<x.size();b++){
			int n=b-a-1;
			r=(r-pow_binary_mod(2,n,M))%M;
			se.emplace(x[a],x[b]);
		}
	}
	printf("%d\n",((r-N-1)%M+M)%M);
}

Measured memory_bytes: 1152
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

x = [0]
y = [0]
for i in range(n):
    x.append(x[i] + a[i])
    
for i in range(m):
    y.append(y[i] + b[i])
    
i = 0
j = m
ans = 0
while i <= n and 0 <= j:
    if x[i] + y[j] <= k:
        ans = max(ans, i + j)
        i += 1
    else:
        j -= 1

print(ans)

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

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

using namespace std;
using ll = long long;

void solve();

int main(void){
    int H, W;
    cin >> H >> W;
    int cost[10][10]; // cost[i][j]はi->jへの変換コスト(のちにワーシャルフロイドする)
    rep(i, 10){
        rep(j, 10){
            cin >> cost[i][j];
        }
    }

    rep(k, 10){
        rep(i, 10){
            rep(j, 10){
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
    }
    int ans = 0;
    int loop = H*W;
    rep(i, loop){
        int temp; cin >> temp;
        if(temp == -1) continue;
        else ans += cost[temp][1];
    }
    cout << ans << endl;
    return 0;
}

void solve(){}

Measured memory_bytes: 256
import math
n = int(input())
sqrt_n = int(math.sqrt(n))
div_list = []
for i in range(1, sqrt_n + 1):
    if n % i == 0:
        if n / i == i:
            div_list.append(int(i))
        else:
            div_list.append(int(i))
            div_list.append(int(n / i))

if len(div_list) % 2 == 0:
    a = div_list[-2]
    b = div_list[-1]
    dig_a = len(str(a))
    dig_b = len(str(b))
    print(max(dig_a, dig_b))
else:
    a = div_list[-1]
    print(len(str(a)))

Measured memory_bytes: 3188
#include <stdio.h>
#include <string.h>
#include <functional>
#include <algorithm>

using namespace std;

int main() {

    char s[101], t[101];
    scanf("%s", s);
    scanf("%s", t);

    sort(s, s + strlen(s));
    sort(t, t + strlen(t), greater<char>());

    int sl = strlen(s);
    int tl = strlen(t);
    int l = min(sl, tl);
    bool f = false;
    for (int i = 0; i < l; ++i) {
        // printf("s = %c\n", s[i]);
        // printf("t = %c\n", t[tl - 1 - i]);
        if (s[i] > t[i]) {
            f = false;
            break;
        } else if (s[i] < t[i]) {
            f = true;
            break;
        } else {
            if (i + 1 == l) {
                if (sl < tl)
                    f = true;
                else
                    f = false;
            }
        }
    }

    if (f) printf("Yes\n");
    else printf("No\n");

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<limits.h>
using namespace std;

long long Fib(int n){
	vector<long long> F(n+1);
	int i;
	F[0]=1;
	F[1]=1;
	for (i=2;i<=n;i++){
		F[i]=F[i-1]+F[i-2];
	}
	return F[n];
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	
	cout << Fib(n)<<endl;
	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    string s;
    cin >> s;
    vector<int> data(s.size(),1);
    ll right=0;
    ll left = 0;
    ll rposi;
    ll lposi;

    rep(i,0,s.size()+1){
        if(left>0&&s[i]=='R'||i==s.size()){
            ll M = max(left,right);
            int L,R;
            lposi = right;
            rposi = right-1;

            if(left<right){
                L = (left+right)/2;
                R = left+right-L;
            }else{
                R = (left+right)/2;
                L = left+right-R;
            }
            M--;
            //cout<<M<<R<<L<<endl;
            if(M%2==0){//終わっ時の状態が最終状態
                rep(j,0,right+left){
                    if(j==rposi){
                        cout<<R<<" ";
                    }else if(j==lposi){
                        cout<<L<<" ";
                    }else{
                        cout<<0<<" ";
                    }
                }
            }else{
                rep(j,0,right+left){
                    if(j==rposi){
                        cout<<L<<" ";
                    }else if(j==lposi){
                        cout<<R<<" ";
                    }else{
                        cout<<0<<" ";
                    }
                }
            }
            left=0;
            right=1;
            //rposi = i;

        }else if(s[i]=='L'){
            // if(left==0){
            //     lposi=i;
            // }
            left++;
        }else if(s[i]=='R'){
            //rposi=i;
            right++;
        }
    }
    cout<<endl;
  return 0;
}

Measured memory_bytes: 3820
#include <stdio.h>
#include "iostream"
#include "deque"
#include "vector"
#include "string"

using namespace std;

int main(){
    int H, W;
    const int INF = 1e9+1;

    cin >> H >> W;

    vector<string> S(H);

    for(int i = 0; i < H; i++){
        cin >> S[i];
    }

    int cost_max = 0;
    for(int s_y = 0; s_y < H; s_y++){
        for(int s_x = 0; s_x < W; s_x++){
            if(S[s_y][s_x] == '.'){
                vector<vector<int>> dist(H, vector<int>(W, INF));
                deque<int> que_y, que_x;
                que_y.push_front(s_y);
                que_x.push_front(s_x);
                dist[s_y][s_x] = 0;
                int n_x, n_y, n_x_tmp, n_y_tmp;

                while(!que_y.empty()){
                    int y = que_y.front();
                    int x = que_x.front();
                    que_y.pop_front();
                    que_x.pop_front();

                    for(int i = -1; i <= 1; ++i){
                        for(int j = -1; j <= 1; ++j){
                            if(abs(i) + abs(j) == 1){
                                n_x = x + i;
                                n_y = y + j;
                                if(n_x >= 0 && n_y >= 0 && n_x < W && n_y < H){
                                    if(S[n_y][n_x] == '.' && dist[n_y][n_x] > dist[y][x] + 1){
                                        dist[n_y][n_x] = dist[y][x] + 1;
                                        que_y.push_back(n_y);
                                        que_x.push_back(n_x);
                                        n_y_tmp = n_y;
                                        n_x_tmp = n_x;
                                    }
                                }
                            }
                        }
                    }
                }

                cost_max = max(cost_max, dist[n_y_tmp][n_x_tmp]);
            }
        }
    }
    cout << cost_max << endl;

    return 0;
}

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

int d[1000001];
int main()
{
int s,i=1;
cin>>s;
for(;;i++)
if(d[s]){cout<<i<<endl;return 0;}
else
{d[s]=1;
	
	s=(s&1)?3*s+1:(s>>1);
	
}


}



Measured memory_bytes: 3668
#include <iostream>
#include <cstdio>
#include <string.h>

#define M 1000003
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
	if (ch == 'A') return 1;
	else if (ch == 'C') return 2;
	else if (ch == 'G') return 3;
	else if (ch == 'T') return 4;
	return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
	long long sum = 0, p = 1, i;
	for (i = 0; i < strlen(str); i++){
		sum += p*(getChar(str[i]));
		p *= 5;
	}
	return sum;
}

int h1(long long key){ return key % M/* your task */; }
int h2(long long key){ return (key % (M - 1)) + 1/* your task */; }

int find(char str[]){

	int curhash = h1(getKey(str));
	int sechash = h2(getKey(str));
	for (int i = 0; i < M; i++){
		if (strcmp(H[curhash], str) == 0){
			return 1;
		}
		else if (H[curhash][0] == '\0'){
			return 0;
		}
		else{
			curhash = (curhash + sechash) % M;
		}
	}
	return -1;

	/* your task */

}

int insert(char str[]){
	
	int curhash = h1(getKey(str));
	int sechash = h2(getKey(str));
	for (int i = 0; i < M; i++){
		if (H[curhash][0] == '\0'){
			strcpy(H[curhash], str);
			return 0;
		}
		else{
			curhash = (curhash + sechash) % M;
		}
	}
	return -1;
	/* your task */

}

int main(){
	int i, n;
	char str[L], com[9];
	for (i = 0; i < M; i++) H[i][0] = '\0';

	scanf("%d", &n);

	for (i = 0; i < n; i++){
		scanf("%s %s", com, str);

		if (com[0] == 'i'){
			insert(str);
		}
		else {
			if (find(str)){
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}

	return 0;
}


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

ll C[51][51];

void comb(int n) {
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            if (j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
        }
    }
    return;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    comb(n);
    ll v[n];
    for (int i = 0; i < n; i++) cin >> v[i];
    sort(v, v + n);
    reverse(v, v + n);
    ll k = 0;
    for (int i = 0; i < a; i++) k += v[i];
    double ans = (double)k / a;
    ll cnt = 0;
    if (v[0] > v[a - 1]) {
        int p = 0, q = 0;
        for (int i = 0; i < n; i++) {
            if (v[i] == v[a - 1]) {
                p++;
                if (i < a) q++;
            }
        }
        cnt = C[p][q];
    } else {
        int p = 0;
        for (int i = 0; i < n; i++) {
            if (v[i] == v[0]) p++;
        }
        for (int i = a; i <= min(p, b); i++) {
            cnt += C[p][i];
        }
    }
    printf("%0.10f\n", ans);
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

int main(){
    long long N, X; cin >> N >> X;
    vector<long long> x(N);
    vector<long long> s(N+1, 0);
    for(auto& t : x) cin >> t;
    for(int i=0;i<N;i++) s[i+1] = s[i] + x[i];
    long long res = (1LL << 60);
    for(int i=N;i>=1;i--){
        long long cur = (N+i) * X;
        for(int j=0;j*i<N;j++){
            int src = N - j * i;
            int dst = max(0, src - i);
            cur += (s[src] - s[dst]) * max(5, 2*j+3);
            if(cur > res) break;
        }
        res = min(res, cur);
    }
    cout << res << endl;
}

Measured memory_bytes: 3328
#!/usr/bin/env python
# -*- coding:utf-8 -*-

import math

N = int(input().strip())
pos_list = []

for _ in range(N):
    obj = input().strip().split(' ')
    x = float(obj[0])
    y = float(obj[1])
    pos_list.append((x, y))

total = 0
for i in range(N):
    xi, yi = pos_list[i]
    for j in range(i + 1, N):
        xj, yj = pos_list[j]
        dist = math.sqrt((xi - xj) ** 2 + (yi - yj) ** 2)
        total += dist

res = total * 2 / N
print(res)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for(int i=0;i<int(N);++i)
int main() {
	int N,H,W;
	cin>>N>>H>>W;
	int ans=(N-W+1)*(N-H+1);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String date = sc.next();
			int year = Integer.valueOf(date.substring(0, 4)).intValue();
			int month = Integer.valueOf(date.substring(5, 7)).intValue();
			int day = Integer.valueOf(date.substring(8, 9)).intValue();

			int kjdatenum = 2019 * 10000 + 4 * 100 + 30;
			if (kjdatenum >= (year * 10000 + month * 100 + day)) {
				System.out.println("Heisei");
			} else {
				System.out.println("TBD");
			}
		}
	}
}

Measured memory_bytes: 21844
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Set<Integer> arr = new HashSet<>();
		for(int i = 0; i < n; i++) {
			arr.add(sc.nextInt());
		}
		System.out.println(arr.size());

	}

}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

    string s1;
signed main()
{

    int k;
    cin >> s1;
    cin >> k;

    set<string> st;
    for (int i = 0; i < k; i++)
    {
        int j = 0;
        while (j + i < s1.length())
        {
            string tmp = s1.substr(j, i + 1);
            j += 1;
            st.insert(tmp);
        }
    }

    int cnt = 0;
    for (auto itr = st.begin(); itr != st.end(); itr++)
    {
        if (cnt++ == k - 1)
        {
            cout << *itr << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <sstream>
#include <string>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=100001;
bool vis[N];
vector <int> adj[N];
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
ll binaryNum[32];
void decToBinary(ll n) 
{ 
    binaryNum[32]={0};
    int i = 0; 
    while (n > 0) { 
        binaryNum[i] = n % 2; 
        n = n / 2; 
        i++; 
    } 
} 

void solve(){
    ll n,d;
    cin>>n>>d;
    ll count=0;
    rep(i,n){
        double x,y;
        cin>>x>>y;
        ll a = (ll)sqrt(x*x+y*y);
        if(sqrt(x*x+y*y) <= d){
            count++;
        }
    }
    cout<<count;
    

}


int main()
{
    // cout<<1<<endl;
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

int main() {
    string s;
    cin >> s;
    int n = s.size(), ans = n;
    for (int i = 1; i < n; i++) {
        if (s[i-1] != s[i]) ans = min(ans, max(i, n - i));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            if(m==-1 && f==-1 && r==-1) break;
            if(m==-1 || f==-1) System.out.println("F");
            else if(m+f>=80) { System.out.println("A"); }
            else if(m+f>=65){ System.out.println("B"); }
            else if(m+f>=50){ System.out.println("C"); }
            else if(m+f>=30){ 
                if(r>=50){System.out.println("C");}
                else {System.out.println("D");} 
            }else{ System.out.println("F"); }
        }
    }
}


Measured memory_bytes: 26112
// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long


using namespace std;

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

    ll a = 0,  b = 0;
    
    for(int i = 1000; i >= 0; i--)
    {	
		if(2*i*i*i*i*i == x)
		{
			a = i; b = i;
		}
		
		
		for(int j= 1000; j >=0; j--)
		{
			if(j==i) continue;
			
			if(x%(i-j)==0)
			{
				if(i*i*i*i*i - j*j*j*j*j == x)
				{
					a = i;
					b = j;
				}
			}
			
			if(x%(i+j)==0)
			{
				if(i*i*i*i*i + j*j*j*j*j == x)
				{
					a = i;
					b = -j;
				}
			}
			
		}
	}
	 
	cout << a << ' ' << b;
    
    return 0;
}



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

int main() {
  vector<int> d(5),r(5);
  rep(i,5){
    cin>>d[i];
    r[i]=d[i]%10;
  }
  int ld=0,r_min=10;
  rep(i,5){
    if(r[i]==0){
      continue;
    }
    if(r[i]<r_min){
      ld=i;
      r_min=r[i];
    }
  }
  int ans=0;
  rep(i,5){
    if(i==ld){
      ans+=d[i];
    }else if(r[i]==0){
      ans+=d[i];
    }else{
      ans+=d[i]/10*10+10;
     }
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
x = int(input())
A=[]
i=1
while i*i<=x:
  if x%i==0:
    A += [i, x//i]
  i += 1
for j in A:
  c= j//2
  a = c
  while a**5-(a-j)**5 < x:
    a +=1
  else:
    if a**5-(a-j)**5 == x:
      print(a,a-j)
      break

Measured memory_bytes: 9192
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
char s[10];
int main(){
	cin>>s;
	int n = strlen(s);
	for(int i = 0;i < n;i++){
		if(s[i] == 'A' && s[i + 1] == 'C') 
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

int main() {
  int N,K; cin >>N >>K;
  vector<bool> kirai(10);
  rep(i,0,K) {
    int D; cin >>D;
    kirai[D]=true;
  }
  while (true) {
    string check=to_string(N);
    bool flag=true;
    rep(i,0,10) {
      int result=check.find(to_string(i));
      if (kirai[i]==true && result!=-1) {
        flag=false;
        break;
      }
    }
    if (flag) break;
    N++;
  }
  cout <<N <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
#define INF 2000000000
#define REP(i,b,n) for(int i = (b); i < n; i++)
#define rREP(i,b,n) for(int i = n; i >= b; i--)
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const string lowercase = "abcdefghijklmnopqrstuvwxyz";
const string uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int gcd(int a, int b){return b ? gcd(b, a % b): a;}

void find_n753(int d, int n, int c3, int c5, int c7);

long update(long i){
    string s = to_string(i);
    reverse(s.begin(), s.end());
    int pos = 0;
    bool done = false;
    while(1){
        if(pos == s.size()) {
            s.push_back('3');
            break;
        }

        if (s[pos] == '3') {
            s[pos] = '5';
            break;
        }
        else if (s[pos] == '5') {
            s[pos] = '7';
            break;
        }
        else if (s[pos] == '7'){
            s[pos] = '3';
            pos++;
        }
    }
    reverse(s.begin(), s.end());
    return stol(s);
}

int main()
{
    int n;
    cin >> n;
    vi n753;
    for (long i = 357; i <= n;) {
        string s = to_string(i);
        int c3 = 0, c5 = 0, c7 = 0;
        REP(j,0,s.size()){
            if(s[j] == '3') c3++;
            else if(s[j] == '5') c5++;
            else if(s[j] == '7') c7++;
        }
        if (c3 > 0 && c5 > 0 && c7 > 0) {
            n753.push_back(i);
        }
        i = update(i);
    }
    cout << n753.size() << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MAX = 1000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
//setprecision(15)

int main() {
	string S, T; cin >> S >> T;
	int A, B; cin >> A >> B;
	string U; cin >> U;
	if (S == U) A--;
	if (T == U) B--;
	cout << A << " " << B << endl;
}

Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    int a, b; cin >> a >> b;
    string s, t;
    REP(i, a) s += (b + '0');
    REP(i, b) t += (a + '0');
    cout << (s < t ? s : t) << endl;
    return 0;
}


Measured memory_bytes: 256
(r, c) = [int(i) for i in input().split()]

table = [[0 for j in range(c + 1)]for i in range(r + 1)]

for i in range(r):
    tmp = [int(x) for x in input().split()]
    for j in range(c + 1):
        if not j == c:
            table[i][j] = tmp[j]
            table[i][c] += table[i][j]
        table[r][j] += table[i][j]

for i in range(r + 1):
    for j in range(c + 1):
        if j == c:
            print(table[i][j], end='')
        else:
            print(table[i][j], '', end='')
    print()

Measured memory_bytes: 6892
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

for p in range(1, 3 + 1):
    s = sum([(pow(abs(x[i] - y[i]), p)) for i in range(n)])
    print('{0:.6f}'.format(pow(s, 1 / p)))

print('{0:.6f}'.format(max([abs(x[i] - y[i]) for i in range(n)])))

Measured memory_bytes: 7812
import numpy as np

N = int(input())
A_array = np.asarray(list(map(int, input().split(" "))))
B_array = np.asarray(list(map(int, input().split(" "))))

sum_A = A_array.sum()
sum_B = B_array.sum()

yobun = sum_A - sum_B

if sum_A < sum_B:
    print(-1)
else:
    A_B_array = A_array - B_array

    # A< B sum B-A
    A_B_minus = A_B_array[A_B_array < 0]
    num_minus = A_B_minus.shape[0]
    if num_minus == 0:
        print(0)
    else:
        minus_sum = - sum(A_B_minus)

        A_B_plus = np.sort(A_B_array[A_B_array >= 0])[::-1]
        A_B_plus_ruiseki = np.cumsum(A_B_plus)
        #print("ruiseki", A_B_plus_ruiseki)

        num_plus = 1 + np.where( A_B_plus_ruiseki >= minus_sum )[0][0]
        print(num_minus + num_plus)

Measured memory_bytes: 25296
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int n;
int f[110][12];
int p[110][12];
int cnt[110];
int main(){
    cin >> n;
    for(int i=0;i<n;i++){
        for(int j=0;j<10;j++){
                cin >> f[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<=10;j++){
            cin >> p[i][j];
        }
    }
    ll ps = -10000000000000;
    for(int i=1;i<1024;i++){
        ll ans = 0;
        memset(cnt,0,sizeof(cnt));
        for(int j=0;j<10;j++){
            if(i&(1<<j)){
                for(int k=0;k<n;k++)
                    if(f[k][j]) cnt[k]++;

            }
        }
        for(int j=0;j<n;j++) ans += (ll)p[j][cnt[j]];
        if(ans>ps) ps = ans;
    }
    cout << ps << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=5005,M=205;
#define ll long long
ll n,m,L,R,st[N],num[N],b[M][N],l[M][N],r[M][N];
ll ans=0,a[N],pre[N],sq[N][N];
int main() {
	scanf("%d%d",&n,&m);
	for(int i=1; i<n; i++) {
		scanf("%lld",&a[i]);
		pre[i+1]=pre[i]+a[i];
	}
	for(int i=1; i<=n; i++)
		for(int j=1; j<=m; j++)
			scanf("%d",&b[j][i]);
	for(int i=1; i<=m; i++) {
		L=R=0;
		for(int j=1; j<=n; j++) {
			while(L&&b[i][j]>st[L])L--;
			l[i][j]=L?num[L]+1:1;
			st[++L]=b[i][j];
			num[L]=j;
		}
		for(int j=n; j; j--) {
			while(R&&b[i][j]>st[R])R--;
			r[i][j]=R?num[R]-1:n;
			st[++R]=b[i][j];
			num[R]=j;
		}
		for(int j=1; j<=n; j++) {
			sq[l[i][j]][j]+=b[i][j];
			sq[l[i][j]][r[i][j]+1]-=b[i][j];
			sq[j+1][j]-=b[i][j];
			sq[j+1][r[i][j]+1]+=b[i][j];
		}
	}
	for (int i=1; i<=n; i++) {
		for (int j=1; j<=n; j++)
			sq[i][j]+=sq[i][j-1];
		for (int j=1; j<=n; j++)
			sq[i][j]+=sq[i-1][j];
		for (int j=i; j<=n; j++)
			ans=max(ans,sq[i][j]-pre[j]+pre[i]);
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 219904
#include<iostream>
#include<set>
#include<vector>
#include<array>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int D; std::cin >> D;
  int c[26];
  for(auto& ci: c) std::cin >> ci;
  std::vector<std::array<int,26>> s(D);
  for(int d = 0; d < D; ++d) {
    for(auto& si: s[d]) std::cin >> si;
  }
  std::vector<int> t(D);
  for(auto& ti: t) { std::cin >> ti; --ti; }
  std::set<int> last[26];
  for(auto& li: last) li.insert(-1); // sentinel
  int ans = 0;
  for(int d = 0; d < D; ++d) {
    int t1 = t[d];
    ans += s[d][t1];
    last[t1].insert(d);
    for(int i = 0; i < 26; ++i) {
      ans -= c[i]*(d - *last[i].rbegin());
    }
  }
  for(auto& li: last) li.insert(D); // sentinel
  // additional score when t[d] = i compare to t[d] = -1
  auto sum_up = [](int d) { return d*(d-1)/2; };
  auto score = [&](int d, int i)->int {
    int res = s[d][i];
    auto it = last[i].lower_bound(d);
    int nd = *it;
    int pd = *--it;
    int diff = sum_up(d-pd) + sum_up(nd-d) - sum_up(nd-pd);
    res -= c[i]*diff;
    return res;
  };
  int M; std::cin >> M;
  for(int m = 0; m < M; ++m) {
    int d, q; std::cin >> d >> q; --d; --q;
    int prev_q = t[d];
    last[prev_q].erase(d);
    ans += score(d, q) - score(d, prev_q);
    last[q].insert(d);
    std::cout << ans << "\n";
    t[d] = q;
  }
  return 0;
}


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

bool good_pass(string S) {
    for (int i = 0; i < S.length() - 1; i++) {
        if (S.at(i) == S.at(i + 1)) {
            return false;
        }
    }

    return true;
}

int main() {
    string S;
    cin >> S;

    cout << (good_pass(S) ? "Good" : "Bad") << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        if (k == 1) {
            System.out.println(0);
            return;
        }
        if (n % k == 0) {
            System.out.println(0);
        } else {
            System.out.println(1);
        }
    }
}


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

#define ll long long
#define mp make_pair
#define rep(i, a, b) for(int i = (a);i <= (b);i++)
#define per(i, a, b) for(int i = (a);i >= (b);i--)
#define lowbit(x) x&-x

using namespace std;

typedef pair<int, int> pii;
typedef double db;
const ll mod = 1e9 + 7;
const int N = 1e6 + 50;
int c[N*10];
int n,a[N],s[N*10];

inline int read(){
	int x = 0, f = 1;
	char ch = getchar();
	while(ch < '0' || ch > '9'){if(ch == '-') f = -1; ch = getchar();}
	while(ch >='0' && ch <='9'){x = (x<<3)+(x<<1)+(ch^48); ch = getchar();}
	return x*f;
}
void add(int x){
    for(int i = x;i <= 2*N;i += lowbit(i)) c[i]++;
}
ll query(int x){
    ll sum = 0;
    for(int i = x;i >0 ;i -= lowbit(i)) sum += c[i];
    return sum;
}
bool check(int x){
    for(int i = 1;i <= 2*N;i++) c[i] = 0;
    s[0] = 0;
    for(int i = 1;i <= n;i++)
        s[i] = s[i-1]+(a[i]>=x?1:-1);
    ll sum = 0;
    for(int i = 0;i <= n;i++){
        sum += query(s[i]+N);
        add(s[i] + N);
    }
    return sum >= 1ll*n*(n+1)/4;
}
int main(){
    n = read();
    int l = 0,r = 0;
    for(int i = 1;i <= n;i++){
        a[i] = read();
        r = max(r, a[i]);
    }
    int ans = 0;
    while(l <= r){
        int mid = (l+r)>>1;
        if(check(mid)) l = mid+1;
        else r = mid-1;
    }
    printf("%d\n", r);
}


Measured memory_bytes: 12928
s = gets.chomp.split("")

n = s.length

ans = 0

n.times do |i|
  if (i + 1).odd?
    if s[i] == 'p'
      ans -= 1
    end
  else
    if s[i] == 'g'
      ans += 1
    end
  end
end

puts ans

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

const int mod = 998244353;

map <string, int> dp;
int DP(const string &s) {
	if (s.empty()) return 1;
	if (dp.count(s)) return dp[s];
	int ans = 1LL * ((s[0] == '1') + 1) * DP(s.substr(1)) % mod;
	for (int i = 1; i < s.size(); ++ i) {
		string a = s.substr(0, i);
		for (int ed = i * 2; ed <= s.size(); ed += i) {
			for (int j = i; j < ed; ++ j)
				a[j % i] = min(a[j % i], s[j]);
			ans += 1LL * DP(a) * DP(s.substr(ed)) % mod;
			if (ans >= mod) ans -= mod;
		}
	}
	return dp[s] = ans;
}

string s;

int main() {
	cin >> s;
	cout << DP(s);
	return 0;
}

Measured memory_bytes: 5632
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n,m,ans;
ll x[99][99];
int main(){
	scanf("%lld%lld",&n,&m);
	if(m-n>=2018){
		puts("0");
		return 0;
	}
	ll ans=INF;
	rep(i,n,m)rep(j,i+1,m+1){
		ans=min(ans,i*j%2019);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 2019;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}
 
int main(){
  ll c11,c12,c13,c21,c22,c23,c31,c32,c33;
  cin>>c11>>c12>>c13>>c21>>c22>>c23>>c31>>c32>>c33;
  bool ok=true;
  if(c22+c11-c12-c21!=0) ok=false;
  if(c23-c21-c13+c11!=0) ok=false;
  if(c32-c31-c12+c11!=0) ok=false;
  if(c33+c11-c31-c13!=0) ok=false;
  
  if(ok) Yes();
  else No();
}

Measured memory_bytes: 256
import itertools
n,m,q= map(int, input().split())
g = []
for _ in range(q):
    z = list(map(int, input().split()))
    g.append(z)
seq = []
for i in range(1,m+1):
  seq.append(i)
f = [0]
for i in list(itertools.combinations_with_replacement(seq, n)):
  ans = 0
  for j in g:
    if i[j[1]-1]-i[j[0]-1] == j[2]:
      ans += j[3]
  f.append(ans)
print(max(f))

Measured memory_bytes: 25172
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
 
 
int main()
{
    int n; std::cin >> n;
    std::vector<int> d(n);
    for(int i=0; i<n; i++) std::cin >> d[i];
    std::sort(d.begin(), d.end());
    int sum = 0;
    for(int i=0; i<n; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            sum += d[i] * d[j];
        }
    }
    std::cout << sum << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  int a, b; cin >> a >> b;
  for(int i=1; i<=1000; i++) {
    int aa = (int) (i * 0.08);
    int bb = (int) (i * 0.10);
    if (a == aa && b == bb) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  
  return 0;
}

// EOF


Measured memory_bytes: 384
import itertools
s = input()
li = ["+", ""]
lli = list(itertools.product(li, repeat=len(s)-1))
ans = 0
for k in lli:
  val = ""
  for i, j in zip(s, k):
    val += i + j
  val += s[-1]
  ans += eval(val)
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

#define MAX 500001

int H;
int A[MAX];

void maxHeapify(int i){
  int l=2*i;
  int r=2*i+1;
  int largest=0,tmp;

  if(l<=H && A[l]>A[i]){
    largest=l;
  }else{
    largest=i;
  }

  if(r<=H && A[r]>A[largest]){
    largest=r;
  }

  if(largest!=i){
    tmp=A[i];
    A[i]=A[largest];
    A[largest]=tmp;
    maxHeapify(largest);
  }
}

void buildMaxHeap(){
  int i;

  for(i=H/2;i>=1;i--){
    maxHeapify(i);
  }
}

int main(){
  int i;

  scanf("%d",&H);
  for(i=1;i<=H;i++){ 
    scanf("%d",&A[i]);
  }

  buildMaxHeap();

  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 2552
N = int(input())
prev = (0, 0, 0)
b = True
for n in range(N):
    next=[int(i) for i in input().split()]
    diff = abs(next[1] - prev[1]) + abs(next[2] - prev[2])
    c = next[0] - prev[0]
    if c - diff < 0 or (c - diff) % 2 != 0:
        print('No')
        b=False
        break
    prev = next
if b:
    print('Yes')

Measured memory_bytes: 3188
num=eval(input(""))
if(num%10==2 or num%10==4 or num%10==5 or num%10==7 or num%10==9):
    print("hon")
if(num%10==0 or num%10==1 or num%10==6 or num%10==8):
    print("pon")
if(num%10==3):
    print("bon")

Measured memory_bytes: 9004
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    int mi = 10000, ma = -10000;
    rep(i, N){
        int a;
        cin >> a;
        mi = min(mi, a);
        ma = max(ma, a);
    }
    output(ma - mi);
    
    return 0;
}

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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int>k(n);
  vector<vector<int>>a(n,vector<int>(m));
  for(int i=0;i<n;i++){
    cin>>k.at(i);
    for(int j=0;j<k.at(i);j++){
      cin>>a.at(i).at(j);
    }
  }
  int ans=0;
  for(int i=0;i<m;i++){
    int A=0;
    for(int j=0;j<n;j++){
      for(int l=0;l<k.at(j);l++){
        if(i+1==a.at(j).at(l)){
          A++;
        }
      }
    }
    if(A==n){
      ans++;
    }
  }
  cout<<ans<< endl;
}
        
      



Measured memory_bytes: 256
n, k, q = map(int, input().split())
a = list(map(int, input().split()))

ans = 10 ** 10
for i, y in enumerate(a):
    li = []
    l = 0
    cnd = []
    l_cnd = 0
    for j, x in enumerate(a + [-1]):
        if x < y:
            if l - k + 1 >= 0:
                li.sort()
                cnd += li[:l-k+1]
                l_cnd += l - k + 1
            li = []
            l = 0
        else:
            li.append(x)
            l += 1

    if l_cnd >= q:
        cnd.sort()
        sub = cnd[q-1] - y
        ans = min(ans, sub)

print(ans)


Measured memory_bytes: 3188
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
int n;
vector<int> adj[100100];

int calc(int i) {
    vector<int> ds;
    for (int j : adj[i]) ds.push_back(1 + calc(j));
    sort(ds.rbegin(), ds.rend());
    int ret = 0;
    for (int i = 0; i < ds.size(); i++) ret = max(ret, i+ds[i]);
    return ret;
}

int main() {
    cin >> n;
    for (int i = 1; i < n; i++) {
        int a; cin >> a;
        adj[a-1].push_back(i);
    }
    cout << calc(0) << endl;
}


Measured memory_bytes: 15104
package main

import (
	"fmt"
	"io"
	"os"
)

func proc(r io.Reader, w io.Writer) {
	var k, x int
	fmt.Fscanf(r, "%d %d", &k, &x)
	min := x - k + 1
	max := min + k*2 - 2
	//fmt.Printf("%#v", numbers)
	for i := min; i < max; i++ {
		fmt.Fprintf(w, "%d ", i)
	}
	fmt.Fprintf(w, "%d ", max)
}

func main() {
	proc(os.Stdin, os.Stdout)
}


Measured memory_bytes: 512
n, k = map(int, input().split())
ki = []
for i in range(n):
    ki.append(int(input()))
ki.sort()
mx = 10**9
for i in range(n - k + 1):
    if mx > ki[i + k - 1] - ki[i]:
        mx = ki[i + k - 1] - ki[i]
print(mx)


Measured memory_bytes: 7440
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int func(string s, string t) {
	int ans = 0;
	for (char c = 'a'; c <= 'z'; c++) {
		bool founds = false, foundt = false;
		for (int i = 0; i < s.length(); i++) {
			if (s[i] == c) founds = true;
		}
		for (int i = 0; i < t.length(); i++) {
			if (t[i] == c) foundt = true;
		}

		if (founds&&foundt) ans++;
	}
	return ans;
}

int main() {
	int n; cin >> n;
	string s; cin >> s;

	int ans = 0;
	for (int i = 0; i <= n; i++) {
		int tmp = func(s.substr(0, i), s.substr(i));
		ans = max(ans, tmp);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int test)
{
  string s;
  cin >> s;
  int ans = 0;
  int prev = 1;
  n = (int)s.size();
  for (int i = 0; i < n; ++i) {
    if (s[i] == s[i + 1] && prev == 1) {
      prev = 2;
      ++i;
      ++ans;
    }
    else {
      ++ans;
      prev = 1;
    }
  }
  cout << ans << '\n';
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)

pair<int, int> p[25];
int main() {
	while (true) {
		int n;
		cin >> n;
		if (n == 0) break;
		REP(i, n) cin >> p[i].second >> p[i].first;
		sort(p, p + n);

		long long total = 0;
		REP(i, n) {
			total += p[i].second;
			if (total > p[i].first) {
				cout << "No" << endl;
				break;
			}
			if (i == n - 1) cout << "Yes" << endl;
		}
	}
}

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> S(M);
    vector<int> C(M);
    vector<int> A(N);
    int i;
    for(i=0;i<M;i++){
        cin >> S[i] >> C[i];
        if(S[i] == 1 && C[i] == 0 && N != 1){
            cout << -1 << endl;
            return 0;
        }
        if(A[S[i]] == 0 || A[S[i]] == C[i])
            A[S[i]] = C[i];
        else {
            cout << -1 << endl;
            return 0;
        }
    }
    if(A[1] == 0 && N != 1) A[1] = 1;
    for(i=1;i<=N;i++){
        cout << A[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

(N, C) = reads()

x, v = [], []
for _ in range(N):
  X, V = reads()
  x.append(X)
  v.append(V)

psumr = [0] * (N+1)
psuml = [0] * (N+1)

INF = 10**20

pmaxr = [0] * (N+1)
pmaxl = [0] * (N+1)

for i in range(N):
  psumr[i+1] = psumr[i] + v[i]
  pmaxr[i+1] = max(pmaxr[i], psumr[i+1] - x[i])

for i in range(N-1, -1, -1):
  psuml[i] = psuml[i+1] + v[i]
  pmaxl[i] = max(pmaxl[i+1], psuml[i] - (C - x[i]))

ans0 = max(pmaxr[N], pmaxl[0])
ans1 = max((psumr[i+1] - 2 * x[i] + pmaxl[i+1] for i in range(N)))
ans2 = max((psuml[i] - 2 * (C - x[i]) + pmaxr[i] for i in range(N)))
print(max(ans0, ans1, ans2))


Measured memory_bytes: 28964
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let x: i64 = s.trim().parse().unwrap();
    let mut ans = 0;
    let mut now: i64 = 100;

    while now < x {
        now = (now as f64 * 1.01) as i64;
        ans += 1;
    }

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


Measured memory_bytes: 2176
#include <iostream>

int main() {
    unsigned int n, m, x, y = 0;
    std::cin >> n;
    std::cin >> m;

    for (int i = 0; i < m; i++) {
        std::cin >> x;
        y += x;
    }

    if (y > n) {
        std::cout << -1 << std::endl;
    } else {
        std::cout << n - y << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3620