akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;


template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
int solve(){
 int a,b,n;cin>>a>>b>>n;
 if(n>=b){
 	cout<<floor((b-1)*a/b)<<endl;
 }
 else{
    int ans=floor(n*a/b)-a*floor(n/b);
    cout<<ans<<endl;
 }
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
 

Measured memory_bytes: 3800
use std::cmp;

const C: [usize; 10] = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6];

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let m: usize = sc.read();
    let a: Vec<usize> = sc.vec(m);
    let mut dp = vec![String::new(); n + 1];
    for i in 0..dp.len() {
        if i > 0 && dp[i].is_empty() {
            continue;
        }
        for &a in a.iter() {
            let c = (a as u8 + '0' as u8) as char;
            let cost = C[a];
            if i + cost > n {
                continue;
            }
            let mut s = dp[i].clone();
            s.push(c);
            if dp[i + cost].len() < s.len() || (dp[i + cost].len() == s.len() && dp[i + cost] < s) {
                dp[i + cost] = s;
            }
        }
    }

    println!("{}", dp[n]);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

using namespace std;

int A[123456];

int main() {
    int N;
    cin >> N;
    multiset < int > st;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        multiset < int > :: iterator it = st.lower_bound(A[i]);
        if (it == st.begin()) {
            st.insert(A[i]);
        } else {
            it--;
            st.erase(it);
            st.insert(A[i]);
        }
    }
    cout << st.size();
    return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 110;
ll INF = 1e15;
int val[N];

namespace WLL {
  struct data {
    int nt, to;
    ll w;
  } a[N * N * 2];
  int S, T, cnt = -1, dep[N], cur[N], head[N];
  
  void init(int n) {
    S = 0, T = n + 1;
    for(int i = S; i <= T; ++i)
      head[i] = -1;
  }
  
  void add(int x, int y, ll c) {
//    printf("%d %d %lld\n", x, y, c);
    a[++cnt].to = y, a[cnt].w = c, a[cnt].nt = head[x], head[x] = cnt;
    a[++cnt].to = x, a[cnt].w = 0, a[cnt].nt = head[y], head[y] = cnt;
  }
  
  queue<int> q;
  bool bfs() {
    q.push(S);
    memset(dep, 0, sizeof dep);
    dep[S] = 1;
    while(!q.empty()) {
      int u = q.front(); q.pop();
      for(int i = head[u]; ~i; i = a[i].nt) {
        int to = a[i].to;
        if(!dep[to] && a[i].w)
          dep[to] = dep[u] + 1, q.push(to);
      }
    }
/*    for(int i = S; i <= T; ++i)
      printf("dep[%d] = %d\n", i, dep[i]);*/
    return dep[T];
  }

  ll dfs(int s, ll v) {
    if(s == T) return v;
    for(int& i = cur[s]; ~i; i = a[i].nt) {
      if(dep[a[i].to] == dep[s] + 1 && a[i].w) {
//        printf("to = %d\n", a[i].to);
        ll d = dfs(a[i].to, min(a[i].w, v));
        if(d) {
          a[i].w -= d;
          a[i ^ 1].w += d;
          return d;
        }
      }
    }
    return 0ll;
  }
  
  ll solve() {
    ll ans = 0;
    int count = 0;
    for(; bfs(); ) {
      for(int i = S; i <= T; ++i)
        cur[i] = head[i];
      for(; ll d = dfs(S, INF); ) {
//        printf("d = %lld\n", d);
        ans += d;
      }
    }
    return ans;
  }
}

int main() {
  int n;
  scanf("%d", &n);
  WLL::init(n);
  ll sum = 0, tmp = 0;
  for(int i = 1; i <= n; ++i) {
    scanf("%d", &val[i]);
    sum += val[i];
    val[i] = -val[i];
    if(val[i] > 0) tmp += val[i];
    if(val[i] > 0) WLL::add(WLL::S, i, val[i]);
    else if(val[i] < 0) WLL::add(i, WLL::T, -val[i]);
    for(int j = 1; j < i; ++j) {
      if(i % j == 0) {
        WLL::add(j, i, INF);
      }
    }
  }
  ll pos = WLL::solve();
//  printf("sum = %lld, tmp = %lld, pos = %lld\n", sum, tmp, pos);
  sum += tmp - pos;
  printf("%lld\n", sum);
  return 0;
}

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

using namespace std;

typedef long long int ll;
typedef long int li;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main() {
    ll ans=0;
    ll a,b;
    cin >> a >> b;
    if(a>=13)ans=b;
  	else if(a>=6)ans=b/2;
    cout << ans << endl;
    return 0;
}



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

int main() {
  std::string s, p;
  std::cin >> s >> p;
  std::string ss = s + s;
  if (ss.find(p) != std::string::npos) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
  return 0;
}



Measured memory_bytes: 3204
M, D = map(int, input().split())
ans = 0
for m in range(M+1):
    for d in range(D+1):
        d1 = d // 10
        d10 = d % 10
        if d1 >= 2 and d10 >= 2 and d1 * d10 == m:
            ans += 1
print(ans)

Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
//#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(int i=(int)(l);i<(int)(r);i+=(int)(k))
//#define Repp(i,l,r,k)for(LL i=(LL)(l);i<(LL)(r);i+=(LL)(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009 
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
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 sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(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 invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
typedef struct fac { LL n, exp; }F;
LL fact(LL n,F*a){LL x,i,j,c=0;x=n;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
//snippet
//overflow...char 1e6

#define N 200009

int main() {
	int n, k, a[N];
	scanf("%d%d", &n, &k);
	rep(i, n)scanf("%d", &a[i]);
	rep(i, n - k) {
		printf(a[i] < a[i + k] ? "Yes\n" : "No\n");
	}
	return 0;
}

Measured memory_bytes: 2516
import java.util.Scanner;
class Main{
        public static void main(String[] args){
                Scanner scan = new Scanner(System.in);
                int a=0,b=0;
                for(int i=0;i<4;i++){
                        a+=scan.nextInt(); 
                }
                for(int i=0;i<4;i++){
                        b+=scan.nextInt();
                }
                if(a>b){
                        System.out.println(a);
                }
                else{
                        System.out.println(b);
                }
       }
}

Measured memory_bytes: 17168
#include <bits/stdc++.h>
using namespace std;
const int MAX = (1e5)+1;

int n;
long long E, T, x[MAX], dp[MAX], f[MAX];
multiset<long long> l, m;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> E >> T;
	l.insert(f[0] = T);
	for(int i = 1, j = 0; i <= n; i++) {
		cin >> x[i];
		while(j < i && 2*(x[i]-x[j+1]) >= T) {
			l.erase(l.find(f[j]));
			f[j] = f[j]-T-2*(x[j+1]);
			m.insert(f[j]);
			j++;
		}
		dp[i] = LLONG_MAX;
		if(!l.empty()) dp[i] = min(x[i]+*l.begin(), dp[i]);
		if(!m.empty()) dp[i] = min(3*x[i]+*m.begin(), dp[i]);
		l.insert(f[i] = dp[i]-x[i]+T);
	}
	cout << dp[n]+E-x[n];
}


Measured memory_bytes: 7296
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<assert.h>
using namespace std;
int ans[25010],op;
int fa[2010],dep[2010],a[2010],ch[2010],dn[2010],up[2010],rk[2010],so[2010],bl[2010],M;
bool del[2010],us[2010];
void rot(int x){
	ans[++op]=x;
	assert(op<=25000);
	int v=a[x];
	a[x]=a[1];
	for(x=fa[x];x;x=fa[x])swap(v,a[x]);
}
int main(){
	int n,i,j,cnt;
	bool flag;
	scanf("%d",&n);
	dep[1]=1;
	for(i=2;i<=n;i++){
		scanf("%d",fa+i);
		fa[i]++;
		ch[fa[i]]++;
		dep[i]=dep[fa[i]]+1;
	}
	for(i=1;i<=n;i++){
		scanf("%d",a+i);
		a[i]++;
	}
	while(1){
		flag=1;
		for(i=1;i<=n;i++){
			if(a[i]!=i){
				flag=0;
				break;
			}
		}
		if(flag)break;
		M=0;
		for(i=1;i<=n;i++){
			if(!del[i]&&ch[i]==0){
				M++;
				dn[M]=i;
				for(j=i;fa[j]&&ch[fa[j]]==1;j=fa[j]);
				up[M]=j;
				so[M]=0;
				cnt=0;
				for(j=i;dep[j]>=dep[up[M]];j=fa[j]){
					rk[j]=++cnt;
					bl[j]=M;
				}
			}
		}
		memset(us,0,sizeof(us));
		while(1){
			flag=1;
			for(i=1;i<=M;i++){
				for(j=dn[i];dep[j]>=dep[up[i]];j=fa[j]){
					if(a[j]!=j){
						flag=0;
						break;
					}
				}
				if(!flag)break;
			}
			if(flag)break;
			us[a[1]]=1;
			if(bl[a[1]]){//insert it to a chain
				i=bl[a[1]];
				if(!so[i]){
					rot(dn[i]);
					so[i]=dn[i];
				}else{
					for(j=dn[i];dep[j]>=dep[so[i]]&&rk[a[j]]<rk[a[1]];j=fa[j]);
					rot(j);
					so[i]=fa[so[i]];
				}
			}else{
				j=0;
				for(i=1;i<=n;i++){
					if(!del[i]&&!us[a[i]]&&dep[i]>dep[j])j=i;
				}
				rot(j);
			}
		}
		for(i=1;i<=M;i++){
			for(j=dn[i];dep[j]>=dep[up[i]];j=fa[j])del[j]=1;
			ch[fa[up[i]]]--;
		}
	}
	printf("%d\n",op);
	for(i=1;i<=op;i++)printf("%d\n",ans[i]-1);
}

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

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int N =nextInt();
		char[] s = nextString().toCharArray();

		int R=0;
		for(int i=0;i<N;i++){
			if(s[i]=='E'){
				R++;
			}
		}
		int L=0;
		if(s[0]=='E'){
			R--;
		}
		int ans=R;

		for(int i=1;i<N;i++){
			if(s[i]=='E'){
				R--;
			}
			if(s[i-1]=='W'){
				L++;
			}
			ans=Math.min(ans, R+L);
		}
		System.out.println(ans);
	}


	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}

Measured memory_bytes: 27384
import sys

sys.setrecursionlimit(10**6)
def dps(gr,p,s,num):
    if gr[s]!=-1:
        return
    gr[s]=num
    for x in p[s]:
        dps(gr,p,x,num)

N,K,L=list(map(int,input().split()))
dic={}
road=[[] for _ in range(N)]
rail=[[] for _ in range(N)]

for i in range(K):
    p,q=list(map(int,input().split()))
    road[p-1].append(q-1)
    road[q-1].append(p-1)

for i in range(L):
    r,s=list(map(int,input().split()))
    rail[r-1].append(s-1)
    rail[s-1].append(r-1)


roadG=[-1 for _ in range(N)]
num=0
for i in range(N):
    if roadG[i]==-1:
        dps(roadG,road,i,num)
        num+=1

railG=[-1 for _ in range(N)]
num=0
for i in range(N):
    if railG[i]==-1:
        dps(railG,rail,i,num)
        num+=1
dic={}
arr=[]
for i in range(N):
    key=(roadG[i],railG[i])
    arr.append(key)
    dic[key]=dic.setdefault(key,0)+1
print(' '.join([str(dic[x]) for x in arr]))

Measured memory_bytes: 101328
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		int tmpA = 0;
		int tmpB = 0;
		int tmpC = 0;

		if(A%2>0 || B%2>0 || C%2>0){
			System.out.println(0);
			System.exit(0);
		}
		
		for (int i = 1; ;i++) {
			tmpA = A/2;
			tmpB = B/2;
			tmpC = C/2;
			
			A = tmpB + tmpC;
			B = tmpA + tmpC;
			C = tmpA + tmpB;
			
			if(A%2>0 || B%2>0 || C%2>0){
				System.out.println(i);
				System.exit(0);
			}
			
			if(A == B && B == C && C == A) {
				System.out.println(-1);
				System.exit(0);			
			}
			
		}
	}
 
}

Measured memory_bytes: 24276
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		sc.nextLine();
		
		int[] div = new int[n];
		for (int i = 0; i < n; i++) {
			int tmpScore = sc.nextInt();
			div[i] = tmpScore;
			
			if (i >= k) {
				if (tmpScore > div[i-k]) {
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			}
		}
	}
}


Measured memory_bytes: 60856
n,m = map(int,input().split())
d = {}
f = True
if n ==1 and m==0: print(0);exit()

for i in range(m):
    s,c = map(int,input().split())
    if s-1 in d and d[s-1] != c:
        f = False
    d[s-1] = c
if not f: print(-1);exit()
l = ['-1']*n
for key,val in d.items():
    l[key] = str(val)
if n==1 and l[0]=='0':print(0);exit()
if l[0]=='0':print(-1);exit()
f = True
for i in range(len(l)):
    if l[0] == '-1':
        l[0]='1'
    elif l[i]=='-1':
        l[i]='0'
print(''.join(l))
            

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

typedef long long ll;

int main(){
    ll N,A,B,C,D,E;
    cin>>N>>A>>B>>C>>D>>E;
    vector<ll> Z={A,B,C,D,E};
    ll Q;
    Q=*min_element(Z.begin(),Z.end());
    ll time;
    time=N/Q;
    if(N%Q>0){
        time+=1;
    }
    cout<<time+4<<endl;
}
//ネックに着目した。


/*
//TLEしたので放棄
int main(){
    ll N,A,B,C,D,E;
    cin>>N>>A>>B>>C>>D>>E;
    map<ll,ll> mp;
    mp[1]=N;
    for(ll i=2;i<7;i++){
        mp[i]=0;
    }
    ll time=0;
    while(mp[6]<N){
        if(mp[5]>0){
            if(mp[5]>E){
                mp[6]+=E;
                mp[5]-=E;
            }
            else if(mp[5]<=E){
                mp[6]+=mp[5];
                mp[5]=0;
            }
        }
        if(mp[4]>0){
            if(mp[4]>D){
                mp[5]+=D;
                mp[4]-=D;
            }
            else {
                mp[5]+=mp[4];
                mp[4]=0;
            }
        }
        if(mp[3]>0){
            if(mp[3]>C){
                mp[4]+=C;
                mp[3]-=C;
            }
            else{
                mp[4]+=mp[3];
                mp[3]=0;
            }
        }
        if(mp[2]>0){
            if(mp[2]>B){
                mp[3]+=B;
                mp[2]-=B;
            }
            else{
                mp[3]+=mp[2];
                mp[2]=0;
            }
        }
        if(mp[1]>0){
            if(mp[1]>A){
                mp[2]+=A;
                mp[1]-=A;
            }
            else{
                mp[2]+=mp[1];
                mp[1]=0;
            }
        }
        time++;
    }
    cout<<time<<endl;
}
*/

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <set>
#include <string>
#include <queue>

int main() {
  size_t n;
  char buf[2048];
  scanf("%zu %s", &n, buf);
  std::string s = buf;

  std::queue<std::string> q;
  q.push(s);
  std::set<std::string> st, vis;
  while (!q.empty()) {
    std::string t = q.front();
    q.pop();
    std::string t0 = t.substr(0, t.length()/2);
    std::string t1 = t.substr(t.length()/2);
    if (t0 != t1) st.insert(t);
    if (t0.length() > 1 && !vis.count(t0)) {
      vis.insert(t0);
      q.push(t0);
    }
    if (t1.length() > 1 && !vis.count(t1)) {
      vis.insert(t1);
      q.push(t1);
    }
  }

  // for (auto const& s0: st) fprintf(stderr, "%s\n", s0.c_str());
  printf("%zu\n", st.size());
}



Measured memory_bytes: 2948
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++)

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

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 500005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

int root[SIZE];
void init() {
    for( int i = 0; i < SIZE; ++i ) {
        root[i] = i;

    }
}

int Root( int x ) {
    if( x == root[x] ) return x;
    return root[x] = Root( root[x] );

}

bool Unite( int x, int y ) {
    int rx, ry;
    rx = Root( x );
    ry = Root( y );

    if( rx == ry ) return false;
    if( rx < ry ) {
        root[ry] = rx;

    } else {
        root[rx] = ry;

    }
    return true;

}


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

    int H, W, M;
    cin >> H >> W >> M;

    vector<P> wcnt(H + 1), hcnt(W + 1);

    for(int i = 1; i <= H; ++i) {
        wcnt[i].S = i;
    }
    for(int i = 1; i <= W; ++i) {
        hcnt[i].S = i;
    }

    map<P, bool> mp;
    vector<P> v;
    int wmax = 0;
    int hmax = 0;
    for(int i = 0; i < M; ++i) {
        int h, w;
        cin >> h >> w;
        v.pb(MP(h, w));
        wcnt[h].F++;
        hcnt[w].F++;
        mp[MP(h, w)] = true;

        wmax = max(wmax, wcnt[h].F);
        hmax = max(hmax, hcnt[w].F);
    }

    sort(all(wcnt), greater<P>());
    sort(all(hcnt), greater<P>());

    int p = 0;
    while(p < H && wcnt[p].F == wmax) {
        int q = 0;
        while(q < W && hcnt[q].F == hmax) {
            if(!mp[MP(wcnt[p].S, hcnt[q].S)]) {
                cout << wmax + hmax << endl;
                return 0;
            }
            ++q;
        }
        ++p;
    }
    cout << wmax + hmax - 1 << endl;

    return 0;
}



Measured memory_bytes: 29124
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}

/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*最大公約数*/
unsigned long long GCD(long long L,long long R){
    if(L>R){
        long long temp=R;
        R = L;
        L = temp;
    }
    unsigned long long pp=0,ppt=0;
    unsigned long long ans=0;
    if(R%L==0){
        ans = L;
    }else{
        while(true){
            ppt = pp;
            pp=R%L;
            if(pp == 0){
                ans = ppt;
                break;
            }
            R = L;
            L = pp;
        }
    }    
    return ans;    
}

/*最小公倍数*/
unsigned long long LCM(long long L,long long R){
    unsigned long long ans;
    unsigned long long gcd = GCD(L,R);
    ans = (L/gcd)*R;
    return ans;
}

/*Combination set*/
#define mod 1000000007
#define maxcomb 3000/*大きいものを求めるときはここを変える*/
vector<long long> fc(maxcomb+1);
vector<long long> ifc(maxcomb+1);
long long modpow(long long x,long long n){
    long long ans = 1;
    while(n > 0){
        if(n & 1) {
            ans = ans*x%mod;
        }
        x = x*x%mod;
        n >>= 1;
    }
    return ans;
}
void Conb(){
    fc[0]= 1;
    ifc[0]=1;
    for(long long i=0;i<maxcomb;i++){
        fc[i+1] = fc[i]*(i+1)%mod;//n!(mod)
        ifc[i+1] = ifc[i]*modpow(i+1,mod-2)%mod;//k!^{M-2} (mod)
    }
}
unsigned long long Combination(long long L,long long R){
    unsigned long long up=1,ans;
    Conb();
    if(L==0&&R==0){
        return 1;
    }else if(L<R||L<0){
        return 0;
    }else{
        long long t = ifc[L-R]*ifc[R]%mod;
        ans = t*fc[L]%mod;
    }
    return ans;
}
/*Combination set ここまで*/

/*ここから*/
int main() {
    double ans=0;
    int N;
    cin >> N;
    double up=1,down=0;
    vector<double> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
        up*=A[i];
    }
    for(int i=0;i<N;i++){
        down += up/A[i];
    }
    printf("%.10f\n", up/down);
    return 0;
}
/*REの時vectorのoverflow確認*/

Measured memory_bytes: 3852
# import sys
# sys.setrecursionlimit(10 ** 9)

# H, W = map(int, input().split())
# L = []
# for _ in range(H):
#     s = input()
#     a = []
#     for i in range(len(s)):
#         a.append(s[i])
#     L.append(a)

# dx = [-1, 0, 1, 0]
# dy = [0, -1, 0, 1]


# def dfs(h, w, dp, ans, count):
#     if L[h][w] == '#':
#         return ans
#     elif (L[h][w] == '.' and dp[h][w] == -1):
#         dp[h][w] = 0

#     for i in range(4):
#         if w + dx[i] >= 0 and w + dx[i] < W and h + \
#                 dy[i] >= 0 and h + dy[i] < H:
#             if L[h + dy[i]][w + dx[i]] == '.' and dp[h + dy[i]][w + dx[i]] == -1:
#                 count += 1
#                 ans[h + dy[i]][w + dx[i]
#                                ] = min(ans[h + dy[i]][w + dx[i]], count)
#                 return dfs(h + dy[i], w + dx[i], dp, ans, count)
#             elif L[h + dy[i]][w + dx[i]] == '#':
#                 continue

#     return ans


# max_count = 0
# ans = [[100000000] * W for _ in range(H)]
# for i in range(H):
#     for j in range(W):
#         dp = [[-1] * W for _ in range(H)]
#         count = dfs(i, j, dp, ans, 0)
#         print(count)
#         # max_count = max(max_count, count)

# print(max_count)

# 幅優先探索
from collections import deque
H, W = map(int, input().split())
L = []
for _ in range(H):
    s = input()
    a = []
    for i in range(len(s)):
        a.append(s[i])
    L.append(a)

dx = [-1, 0, 1, 0]
dy = [0, -1, 0, 1]


def bfs(x, y):
    dp = [[10000000] * W for _ in range(H)]
    dp[y][x] = 0
    if L[y][x] == '#':
        return dp
    else:
        d = deque()
        d.append([x, y])
        while len(d) > 0:
            s = d.popleft()
            for i in range(4):
                if (s[1] +
                    dy[i] >= 0 and s[1] +
                    dy[i] < H and s[0] +
                    dx[i] >= 0 and s[0] +
                        dx[i] < W):
                    if L[s[1] +
                         dy[i]][s[0] +
                                dx[i]] == '.' and dp[s[1] +
                                                     dy[i]][s[0] +
                                                            dx[i]] == 10000000:
                        d.append([s[0] + dx[i], s[1] + dy[i]])
                        dp[s[1] + dy[i]][s[0] + dx[i]] = dp[s[1]][s[0]] + 1

        return dp


max_num = 0
for i in range(H):
    for j in range(W):
        dp = bfs(j, i)
        for k in dp:
            for p in k:
                if (p == 10000000):
                    continue
                max_num = max(max_num, p)
print(max_num)


Measured memory_bytes: 9412
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int w, h, n;
	cin >> w >> h >> n;
	int x1 = 0, x2 = w, y1 = 0, y2 = h;
	REP(i, n)
	{
		int x, y, a;
		cin >> x >> y >> a;
		switch (a)
		{
		case 1:
			x1 = max(x1, x);
			break;
		case 2:
			x2 = min(x2, x);
			break;
		case 3:
			y1 = max(y1, y);
			break;
		case 4:
			y2 = min(y2, y);
			break;
		}
	}
	int x = x1 > x2 ? 0 : x2 - x1;
	int y = y1 > y2 ? 0 : y2 - y1;
	print(x * y);
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <map>

template <typename T>
void read(T& x)
{
    x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar());
    for (; isdigit(c); x = x * 10 + (c ^ 48), c = getchar());
}

unsigned long long get2(std::string s)
{
    while (s.length() && s[0] == '0')
        s = s.substr(1, s.length() - 1);
    if (s.length() == 0)
        return 0;
    unsigned long long x = s[0] - '0', ans = 0;
    if (x == 0)
        return 0;
    if (s.length() >= 2)
        ans += 1ull * (x - 1ull) * (s.length() - 1ull) * 9ull;
    if (s.length() >= 3)
        ans += 1ull * (s.length() - 1ull) * (s.length() - 2ull) / 2ull * 81ull;
    if (s.length() >= 2)
    {
        for (int i = 1; i < s.length(); ++i)
        {
            if (s[i] == '0')
            {
                continue;
            }
            else
            {
                ans += s[i] - '0';
                ans += (s.length() - (i + 1ull)) * 9ull;
                break;
            }
        }
    }
    return ans;
}

std::string s;
int k;

int main()
{
    std::ios::sync_with_stdio(0);
    std::cin >> s >> k;
    if (k == 1)
    {
        int x = s[0] - '0';
        std::cout << x + (s.length() - 1) * 9 << std::endl;
    }
    else if (k == 2)
    {

        std::cout << get2(s) << std::endl;
    }
    else
    {
        unsigned long long x = s[0] - '0';
        if (s.length() <= 2)
        {
            std::cout << 0 << std::endl;
            return 0;
        }
        unsigned long long ans = 0;
        ans += 1ull * (x - 1ull) * (s.length() - 1ull) * (s.length() - 2ull) / 2ull * 81ull;
        if (s.length() >= 4)
            ans += 1ull * (s.length() - 1ull) * (s.length() - 2ull) * (s.length() - 3ull) / 2ull * 243ull;
        ans += get2(s.substr(1, s.length() - 1));
        std::cout << ans << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin>>N>>M;
  vector<vector<pair<int,int>>> Ps(N);
  for(int i=0;i<M;i++){
    int p,y;
    cin>>p>>y;
    pair<int,int> y_i(y,i);
    Ps.at(p-1).push_back(y_i);
  }
  vector<pair<int,string>> outputs(0);
  for(int i=0;i<N;i++){
    vector<pair<int,int>> yis=Ps.at(i);
    sort(yis.begin(),yis.end());
    for(int j=0;j<yis.size();j++){
      string pid="000000"+to_string(i+1);
      pid=pid.substr(to_string(i+1).size(),6);
      string yid="000000"+to_string(j+1);
      yid=yid.substr(to_string(j+1).size(),6);
      string id=pid+yid;
      pair<int,string> output(yis.at(j).second,id);
      outputs.push_back(output);
    }
  }
  sort(outputs.begin(),outputs.end());
  for(int i=0;i<outputs.size();i++){cout<<outputs.at(i).second<<endl;}
}

Measured memory_bytes: 13168
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for (auto &e: a) cin >> e.second >> e.first;
    sort(a.begin(), a.end());

    ll now = 0;
    for (auto &e: a) {
        now += e.second;
        if (now > e.first) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 1792
s = input()
flag = False
ans = ""
def f(temp, index):
  global ans
  if ans:
    return
  
  if len(temp) == 7:
    if eval(temp) == 7:
      ans = temp+"=7"
    return 
  
  f(temp + "+" + s[index], index+1)
  f(temp + "-" + s[index], index+1)

f(s[0], 1)

print(ans)

Measured memory_bytes: 3060
N, K = gets.split.map(&:to_i)

ans = 0

(1..N).each do |i|
    point = 0
    idx = 0

    loop do
        point = i * (2 ** idx)

        break if point >= K

        idx += 1
    end

    ans += (1 / N.to_f) * (0.5 ** idx)
end

puts ans

Measured memory_bytes: 1788
n = int(input())
lis = [str(3),str(5),str(7)]
nu = [str(3),str(5),str(7)]
for i in range(8):
    nlis = []
    for j in lis:
        for k in nu:
            nlis.append(j+k)
    lis.extend(nlis)
slis = set(lis)
mlis = []
cnt = 0
for i in slis:
    if "3" not in i or "5"  not in i or "7" not in i:
        continue
    if int(i)>n: continue
    cnt+=1
    mlis.append(i)
print(cnt)
#print(slis)


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

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000
#define _GLIBCXX_DEBUG

void chmaxl(ll &a,ll b){
	if(a<b){
		a=b;
	}
	return;
}

void chminl(ll &a,ll b){
	if(a>b){
		a=b;
	}
	return;
}

void chmaxi(int &a,int b){
	if(a<b){
		a=b;
	}
	return;
}

void chmini(int &a,int b){
	if(a>b){
		a = b;
	}
	return;
}



int main() {
  ll X;
  cin >> X;
  ll A,B;
  bool owaru=false;
  for(int i=0;i<180;i++){
    if(owaru)break;
    for(int j=-180;j<i;j++){
      if(i*i*i*i*i-j*j*j*j*j==X){
        cout << i << " " << j;
        owaru=true;
        break;
      }
    }
  }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n;
  cin >> n;
  vl a(n);
  ll sum=0;
  rep(i,n){
    cin >> a[i];
    sum +=a[i];
  }
  ll sum2=0,sum3=0;
  rep(i,n){
    sum2 +=a[i];
    if(2*sum2>=sum)
      break;
    sum3 =sum2;
  }
  cout << min(sum-2*sum3,-sum+2*sum2) << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <atcoder/all>

using namespace std;
using namespace atcoder;
typedef long long ll;

int main() {
  ll n, q;
  cin >> n >> q;
  fenwick_tree<ll> fw(n);
  for (int i = 0; i < n; i++) {
    ll ai; cin >> ai;
    fw.add(i, ai);
  }

  while (q--) {
    ll qq, l, r;
    cin >> qq >> l >> r;
    if (qq == 0) {
      fw.add(l, r);
    } else if (qq == 1) {
      cout << fw.sum(l, r) << endl;
    }
  }
  
}


Measured memory_bytes: 8216
n,k = map(int, input().split())

d = {}
for _ in range(n):
  a,b = map(int, input().split())
  if a in d: d[a] += b
  else: d[a] = b
    
for x,y in sorted(d.items(), key=lambda x: x[0]):
  k -= y
  if k <= 0:
    print(x)
    exit()

Measured memory_bytes: 20848
#include<bits/stdc++.h>
#define MOD (1e9+7)
#define rep(i, x, n) for(int i = x; i < n; i++)
#define repr(i, x, n) for(int i = x; i > n; i--)
#define pii pair<int,int>
#define ll long long
const long long iinf = 1e18;
const int inf = 1e9;
int dir4[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
int knight[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{-1,2},{1,-2},{-1,-2}};

using namespace std;

void solve()
{
   long double x, y;
   cin >> x >> y;
   cout << (long long)(x*y);
   

    
}
//new line is printed in the main

int main()
{
    int t = 1;
        //cin >> t; // comment out if no test case is required
    // int i = 1;
    while(t--){
        //cout << "Case " << i++ << ": ";
        solve();
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
char a[101];
int x=0;
int main()
{
	gets(a);
	for(int i=0;i<=strlen(a)-1;i++)
	{
		if(x==0&&a[i]=='C')
		{
			x=1;
		}
		if(x==1&&a[i]=='F')
		{
			x=2;
		}
	}
	if(x==2)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]


tab_h = [[0] * W for _ in range(H)]
tab_v = [[0] * W for _ in range(H)]

for i in range(H):
    memo = [0] * W
    tmp = 0
    for j in range(W):
        if S[i][j] == '.':
            tmp += 1
        else:
            tmp = 0
        memo[j] = tmp
    tmp = 0
    for j in range(W):
        if tmp == 0 and memo[W - 1 - j] > 0:
            tmp = memo[W - 1 - j]
        elif memo[W - 1 - j] == 0:
            tmp = 0
        tab_h[i][W - 1 - j] = tmp

for j in range(W):
    memo = [0] * H
    tmp = 0
    for i in range(H):
        if S[i][j] == '.':
            tmp += 1
        else:
            tmp = 0
        memo[i] = tmp
    tmp = 0
    for i in range(H):
        if tmp == 0 and memo[H - 1 - i] > 0:
            tmp = memo[H - 1 - i]
        elif memo[H - 1 - i] == 0:
            tmp = 0
        tab_v[H - 1 - i][j] = tmp

# for i in range(H): print("#", tab_h[i])
# for i in range(H): print("#", tab_v[i])

ans = 1
for i in range(H):
    for j in range(W):
        ans_tmp = tab_h[i][j] + tab_v[i][j] - 1
        if ans < ans_tmp:
            ans = ans_tmp

print(ans)

Measured memory_bytes: 248072
n,A,B,C = map(int, input().split()) 

ls = [int(input()) for _ in range(n)]

inf = 10000

def dfs(i,a,b,c):
    if i == n:
        return \
            inf if min(a,b,c) == 0 \
            else abs(A-a) + abs(B-b)+abs(C-c)-30
    
    i1 = i+1
    lsi = ls[i]

    r0 = dfs(i1, a,b,c)
    r1 = dfs(i1, a+lsi,b,c) + 10
    r2 = dfs(i1, a,b+lsi,c) + 10
    r3 = dfs(i1, a,b,c+lsi) + 10

    return min(r0,r1,r2,r3)

print(dfs(0,0,0,0))

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(){
    int x;
    cin >> x;
    int sumx = 0;
    int y = x;
    while(x > 0){
        sumx += x % 10;
        x /= 10;
    }
    cout << (y % sumx == 0 ? "Yes":"No" ) << endl;
    return 0;
}


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

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

		for(int i=0; i<N; i++) {
			A[i] = sc.nextInt();
		}Arrays.sort(A);

		System.out.println(A[N-1]-A[0]);

	}

}


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

int main(void){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0;i < n;i++)cin >> a[i];
    double sum = 0;
    for(int i = 0;i < n;i++){
        sum += (1/(double)a[i]);
    }
    cout << setprecision(10) << (double)(1/sum);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <functional>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define P(r) do{for(auto i:r){cout<<i<<' ';}cout<<'\n';}while(0)
int main()
{
    int N; cin >> N;
    vector<int> T(N); REP(i, N) cin >> T[i];
    int sum = 0;
    REP(i, N) sum += T[i];
    int M; cin >> M;
    REP(i, M) {
        int p, x; cin >> p >> x;
        p--;
        cout << sum - (T[p] - x) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int a, b;
    cin >> a >>b ;
    int ans = INT_MIN;
    ans = max(ans, a+b);
    ans = max(ans, a-b);
    ans = max(ans, a*b);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define db double 
#define maxn 10005 
#define mod 998244353
#define vi vector<double>
#define pb push_back
#define ll long long
using namespace std;
ll ksm(ll a, ll b) {
	if (!b) return 1;
	ll ns = ksm(a, b >> 1);
	ns = ns * ns % mod;
	if (b & 1) ns = ns * a % mod;
	return ns;
}
inline int add(int a, int b) {
	a += b;
	return (a < mod) ? a : (a - mod);
}
inline int sub(int a, int b) {
	a -= b;
	return (a < 0) ? a + mod : a;
}
inline int mul(int a, int b) {
	return (ll)a * b % mod;
}
// head

int n, k;
char inp[maxn];
char ans[maxn];
char nans[maxn];
int main() {
	cin >> n >> k;
	scanf("%s", inp);
	for (int i = 0; i < n; i++)	
		ans[i] = 'z';
	for (int i = 0; i < n; i++)
		inp[2 * n - 1 - i] = inp[i];
	char mn = 'z';
	for (int i = 0; i < 2 * n; i++)	
		if (inp[i] < mn) mn = inp[i];
	if (k >= 14) {
		for (int i = 0; i < n; i++) cout << mn;
		return 0;
	}
	for (int i = n - 1; i < 2 * n; i++) {
		if (inp[i] != mn) continue;
		if (inp[i + 1] == mn) continue;
	//	cout << "!@!#" << i << endl;
		int nl = 0;
		for (int j = i; j >= 0; j--)	
			if (inp[j] == mn) nl++;
			else break;
		int ns = (1 << (k - 1)) * nl;
	//	cout << ns << " " << nl << endl;
		int cnt = 0;
		int fl = 0;
		for (int k = 0; k < n; k++) {
			if (k < ns) nans[k] = mn;
			else nans[k] = inp[i - nl - cnt], cnt++;
			
		}
		for (int k = 0; k < n; k++) {
			if (ans[k] != nans[k]) {
				if (ans[k] < nans[k]) break;
				else {
					fl = 1;
					break;
				}
			}
		}
		if (fl) {
		//	cout << "!@#!@" << endl;
			for (int k = 0; k < n; k++)	
				ans[k] = nans[k];
		}
	}
	cout << ans;
	return 0;
}


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

const int INF = 100001;

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

  vector<int> dp(n + 1, INF);
  dp[0] = 0;
  int power;

  for (int i = 1; i <= n; i++) {
    power = 1;
    while (power <= i) {
      dp[i] = min(dp[i], dp[i - power] + 1);
      power *= 6;
    }

    power = 1;
    while (power <= i) {
      dp[i] = min(dp[i], dp[i - power] + 1);
      power *= 9;
    }
  }
  cout << dp[n] << endl;
  return 0;
}


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

int main() {
  int D, T, S;
  cin >> D >> T >> S;

  if(D > T * S){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }

  /*int N = 3;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }*/

  /*for (int i = 0; i < vec.size(); i ++){
    cout << vec.at(i) << endl;
  }

  for (int i = 0; i < vec.size()-1; i ++){
    cout << vec.at(i) << " ";
  }
  cout << vec.at(vec.size() - 1) << endl;*/
}


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

int main() {
	int n, a;
	int color = 0;
	cin >> n;
	int g = 0;
	bool flag[8];
	for (int i = 0; i < 8; i++) {
		flag[i] = false;
	}
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a <= 399) {
			if (flag[0] == false) { color++; flag[0] = true; }
		}
		else if (400 <= a && a <= 799) {
			if (flag[1] == false) { color++; flag[1] = true; }
		}
		else if (800 <= a && a <= 1199) {
			if (flag[2] == false) { color++; flag[2] = true; }
		}
		else if (1200 <= a && a <= 1599) {
			if (flag[3] == false) { color++; flag[3] = true; }
		}
		else if (1600 <= a && a <= 1999) {
			if (flag[4] == false) { color++; flag[4] = true; }
		}
		else if (2000 <= a && a <= 2399) {
			if (flag[5] == false) { color++; flag[5] = true; }
		}
		else if (2400 <= a && a <= 2799) {
			if (flag[6] == false) { color++; flag[6] = true; }
		}
		else if (2800 <= a && a <= 3199) {
			if (flag[7] == false) { color++; flag[7] = true; }
		}
		else if (3200 <= a) {
			g++;
		}
	}
	if (color > 0) {
		cout << color << ' ';
	}
	else {
		cout << 1 << ' ';
	}
	cout << color + g << endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using IP = pair<int, int>;

const ll INF = 1LL << 62;
#define atcoder(int)1e9+7
#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back

ll gcd(ll a, ll b) {//最大公約数
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}

int main(){

	int n;
	ll a[210];
	int cnt = 0;

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

	while (1) {
		for (int i = 0; i < n; i++) {
			if (a[i] % 2 != 0) {
				cout << cnt << endl;
				return 0;
			}
			else a[i] /= 2;
		}
		cnt++;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
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;}

typedef struct {
  int idx;
  int cnt;
} E;
E a_no1, a_no2, b_no1, b_no2;

int main() {
  int n; cin >> n;
  vector<int> mem1(100001,0), mem2(100001, 0);
  rep(i, n) {
    int v; cin >> v;
    if(i%2) ++mem1[v];
    else ++mem2[v];
  }
  rep(i, 100001) {
    if(mem1[i] > a_no1.cnt) {
      a_no2.idx = a_no1.idx;
      a_no2.cnt = a_no1.cnt;
      a_no1.idx = i;
      a_no1.cnt = mem1[i];
    } else if(mem1[i] > a_no2.cnt) {
      a_no2.idx = i;
      a_no2.cnt = mem1[i];
    }
    if(mem2[i] > b_no1.cnt) {
      b_no2.idx = b_no1.idx;
      b_no2.cnt = b_no1.cnt;
      b_no1.idx = i;
      b_no1.cnt = mem2[i];
    } else if(mem2[i] > b_no2.cnt) {
      b_no2.idx - i;
      b_no2.cnt = mem2[i];
    }
  }
  if(a_no1.cnt == b_no1.cnt && a_no1.idx == b_no1.idx)
    cout << n - a_no1.cnt - max(a_no2.cnt, b_no2.cnt) << endl;
  else
    cout << n - a_no1.cnt - b_no1.cnt << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  ll ans = 0LL;
  vector<ll> a(n);
  vector<ll> list(100001, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    list[a[i]]++;
  }
  for (int i = 0; i < 100001; i++) {
    ans += list[i] * i;
  }
  int q;
  cin >> q;
  vector<ll> b(q), c(q);
  for (int i = 0; i < q; i++) {
    cin >> b[i] >> c[i];
    ans -= list[b[i]] * b[i];
    ans -= list[c[i]] * c[i];
    list[c[i]] += list[b[i]];
    ans += list[c[i]] * c[i];
    list[b[i]] = 0;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 6412