akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <vector>
#include <cstring>
#include <functional>
#include <algorithm>
#include <math.h>
#include <bitset>
#include <set>
#include <queue>
#include <assert.h>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <complex>
#include <numeric>
#include <map>
#include <time.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<int,ull> piu;
typedef pair<ull,ull> puu;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
typedef pair<pii,ll> ppl;
typedef pair<ll,pii> plp;
typedef pair<ll,pll> plP;
typedef pair<int,pii> pip;
typedef pair<pii,int> ppi;
typedef pair<pii,pii> ppp;
typedef pair<double,int> pdi;
typedef pair<int,double> pid;
typedef pair<double,pii> pdp;
typedef pair<double,double> pdd;
typedef pair<pdd,double> pd3;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i,n) for (int (i) = 0; (i) < (n); (i)++)
#define repn(i,a,n) for (int (i) = (a); (i) < (n); (i)++)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define SORT(x) sort((x).begin(),(x).end())
#define SORTN(x,n) sort((x),(x)+(n))
#define ERASE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define COUNT(x,c) count((x).begin(),(x).end(),(c))
#define REMOVE(x,c) (x).erase(remove((x).begin(),(x).end(),(c)),(x).end())
#define REVERSE(x) reverse((x).begin(),(x).end())
#define FORIT(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))-(x).begin()
#define lb(x,a) lower_bound((x).begin(),(x).end(),(a))
#define LBN(x,a,n) lower_bound((x),(x)+(n),(a))-(x)
#define lbN(x,a,n) lower_bound((x),(x)+(n),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))-(x).begin()
#define ub(x,a) upper_bound((x).begin(),(x).end(),(a))
#define BS(x,a) binary_search((x).begin(),(x).end(),(a))
#define BS2(x,n,a) binary_search((x),(x)+(n),(a))
#define NB(x) (((x)&~((x)+((x)&-(x))))/((x)&-(x))>>1)|((x)+((x)&-(x)))
#define NP(x) next_permutation((x).begin(),(x).end())
#define MM(x,p) memset((x),(p),sizeof(x))
#define SQ(x) (x)*(x)
#define SC(c1,c2) strcmp(c1,c2)==0
#define mp make_pair
#define INF (1<<29)
#define INFL (1LL<<61)
#define fi first
#define se second
#define EPS 1e-9
#define MOD 1000000007
#define MIN(x,a) x=min(x,a)
#define MAX(x,a) x=max(x,a)
#define madd(x,a) x=(x+a)%MOD
#define msub(x,a) x=(x+MOD-a)%MOD
#define OUTPUT(x) rep(__,x.size())printf("%d%c",x[__],__+1==x.size()?'\n':' ')

int N,A,B,C;
int res;

ll T1,T2;
ll A1,B1,A2,B2;


int main()
{
	cin>>T1>>T2>>A1>>A2>>B1>>B2;
	ll df=T1*A1-T1*B1;
	ll df2=T1*A1+T2*A2-T1*B1-T2*B2;
	if(df2==0)
	{
		puts("infinity");
	}
	else if((df<0)!=(df2<0))
	{
		ll h1=llabs(df);
		ll h2=llabs(df2);
		if(h1<h2)
		{
			puts("1");
		}
		else
		{
			ll r=h1/h2;
			if(r*h2==h1)printf("%lld\n",h1/h2*2);
			else printf("%lld\n",h1/h2*2+1);
		}
	}
	else puts("0");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;

vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}

int main(){
    int n; cin >> n;
    vector<int> a;
    auto t = prime_table(55555);
    int cnt = 0;
    int now = 0;
    while(cnt < n){
        if(t[now] && (now % 5 == 1)){
            a.push_back(now);
            cnt++;
        }
        now++;
    }
    rep(i,n) printf("%d%c", a[i], i==n-1 ? '\n' : ' ');
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1'000'000'000'000'007ll;
const llong mod = 1e9+7;

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

	cin >> N;
	d.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> d[i];

	llong ans = 0;
	for (int i = 0; i < N-1; ++i)
		for (int j = i+1; j < N; ++j)
			ans += d[i]*d[j];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N = str(input())
tl = N[-1]

if tl == '2' or tl == '4'or  tl ==  '5'or  tl ==  '7' or tl == '9':
    ans = 'hon'
elif tl == '3':
    ans = 'bon'
else:
    ans = 'pon'

print(ans)

Measured memory_bytes: 9112
#include<iostream>
using namespace std;
int main(){
  int N, A[100];
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  int min=A[0], max=A[0];
  for(int j=1; j<N; j++){
    if(A[j] < min) min = A[j];
    if(A[j] > max) max = A[j];
  }
  cout << abs(max - min);
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define fo(i,s,e) for (int i=(s); i < (e); i++)
#define all(obj) (obj).begin(), (obj).end()
#define int long long
signed main () {
  int n;cin >> n;
  vector<int> a(n+1,0);rep(i,n+1) cin>>a[i];
  vector<int> b(n,0);rep(i,n) cin>>b[i];
  int ans=0;
  rep(i,n){
    if (a[i]>=b[i]) ans+=b[i];
    else if (b[i]>=a[i]+a[i+1]){ans+=a[i]+a[i+1];a[i+1]=0;}
    else {a[i+1]+=a[i]-b[i];ans+=b[i];}
  }
  cout << ans << endl;
}

Measured memory_bytes: 4848
N = int(input())
strings = [input()]
judge = 0
for i in range(1, N):
  final_character = strings[i - 1][-1]
  strings.append(input())
  initial_character = strings[i][0]
  if final_character == initial_character:
    continue
  else:
    judge = 1
    break

if len(strings) != len(set(strings)):
  judge = 1
  
if judge == 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
fun main (args:Array<String>) {
    var (tHp , tAct,aHp , aAct) = readLine()!!.split(" ").map(String::toInt)

    while(tHp > 0 && aHp > 0) { //どちらも体力が1以上のときは攻撃し続ける
        aHp -= tAct            //高橋の攻撃
        if(aHp <= 0) break
        tHp -= aAct            //青木の攻撃
    }
    if(tHp > aHp){             //高橋の体力が上だったら
        print("Yes")           //
        return
    }
    if(aHp > tHp) {
        print("No")
    }
}

Measured memory_bytes: 36404
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int s1,s2,t1,t2,x,y,i;
    scanf("%d %d %d %d",&s1,&s2,&t1,&t2);
    x = t1-s1;
    y = t2-s2;
    for(i=0;i<y;i++)
        printf("U");
    for(i=0;i<x;i++)
        printf("R");
    for(i=0;i<y;i++)
        printf("D");
    for(i=0;i<x;i++)
        printf("L");
    printf("D");
    for(i=0;i<=x;i++)
        printf("R");
    for(i=0;i<=y;i++)
        printf("U");
    printf("L");
    printf("U");
    for(i=0;i<=x;i++)
        printf("L");
    for(i=0;i<=y;i++)
        printf("D");
    printf("R");
    return 0;
}



Measured memory_bytes: 128
#include<cstdio>

using namespace std;

int main()
{
	char pttn[8][9];

	for(int i=0;i<8;i++)	scanf("%s",pttn+i);

	puts("90");
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++)	putchar(pttn[7-j][i]);
		puts("");
	}
	puts("180");
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++)	putchar(pttn[7-i][7-j]);
		puts("");
	}
	puts("270");
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++)	putchar(pttn[j][7-i]);
		puts("");
	}

	return 0;
}

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

void prians(bool answer) {
  if(answer)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
string s;

int main() {
  cin >> s;
  prians((s[0] == s[1] || s[2] == s[3]) && s[1] == s[2]);
  return 0;
}

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

template <class t>
using vc = vector<t>;
template <class t>
using vvc = vector<vector<t>>;
typedef long long ll;
typedef vc<int> vi;
typedef vvc<int> vvi;
typedef pair<int, int> pi;

#define uset unordered_set
#define umap unordered_map

#define endl "\n"

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()

#define all(a) a.bg, a.ed

template <class t, class u>
ostream &operator<<(ostream &os, const pair<t, u> &p) {
    return os << "( " << p.k << ", " << p.v << " )";
}

template <class t>
ostream &operator<<(ostream &os, const vc<t> &v) {
    os << "[ ";
    for (int i = 0; i < v.size(); i++) {
        os << v[i];
        if (i != v.size() - 1) {
            os << ", ";
        }
    }
    return os << " ]";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout << fixed << setprecision(18);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution

    int a, b, c;
    cin >> a >> b >> c;
    if ((a + b) >= c) {
        cout << b + c << endl;
    } else {
        cout << a + b * 2 + 1 << endl;
    }
}


Measured memory_bytes: 256
#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int a,b,k;  cin >> a >> b >> k;
  set<int> st;

  rep1(i,min(a,b)){
    if(a%i == 0 and b%i == 0){
      st.insert(i);
    }
  }
  auto p = st.end();
  rep0(i,k){
    p--;
  }
  cout << *p;
}


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

int main(int argc, char **argv) {
  int A, B;
  int ans;

  cin >> A >> B;
  if (A >= 13)
    ans = B;
  else if (A >= 6)
    ans = B / 2;
  else
    ans = 0;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N=int(input())
dic={}
for i in range(N):
  s=sorted(list(input()))
  s="".join(s)
  if s in dic:
    dic[s]+=1
  else:
    dic[s]=1
count=0
u=len(dic)
for i in range(u):
  kk=dic.popitem()
  count+=kk[1]*(kk[1]-1)/2
print(int(count)) 

Measured memory_bytes: 17808
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
char f[105][105];
bool used[105][105];
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int h,w;
void bfs(int i,int j)
{
	char ret=f[i][j];
	queue<P> q;
	q.push(mp(i,j));
	used[i][j]=true;
	while(!q.empty())
	{
		P a=q.front();
		q.pop();
		for(int k=0;k<4;k++)
		{
			int nx=a.fi+dx[k],ny=a.sec+dy[k];
			if(nx<0||nx>=h||ny<0||ny>=w)continue;
			if(used[nx][ny])continue;
			if(f[nx][ny]!=ret)continue;
			used[nx][ny]=true;
			q.push(mp(nx,ny));
		}
	}
	return ;
}
int main()
{
	while(1)
	{
		memset(used,false,sizeof(used));
		scanf("%d %d",&h,&w);
		if(h==0&&w==0)break;
		for(int i=0;i<h;i++)scanf("%s",f[i]);
		int ans=0;
		for(int i=0;i<h;i++)
		{
			for(int j=0;j<w;j++)
			{
				if(!used[i][j])
				{
					bfs(i,j);
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1256
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
		string s;
		cin >> s;
		s[3]++;
		cout << s << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int search(int A[], int n, int key){
  int i = 0;
  A[n] = key;
  while(A[i] != key) i++;
  return i != n;
}

int main(){
  int i,n,A[10000+1],q,key,sum = 0;

  scanf("%d",&n);
  for(i = 0; i<n; i++) scanf("%d",&A[i]);

  scanf("%d",&q);
  for(i = 0; i<q;i++){
    scanf("%d",&key);
    if(search(A,n,key)) sum++;
  }
  printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 2128
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define eps 1e-12
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m,l,r,d;
int main(){
    int i,j,u,v,f1,f2;
    n=read();
    int ans=0;
    for(i=1;i<=n;i++){
    	int x=read();
    	if(i%2==1&&x%2==1) ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3620
import sys


def solve(grundy, edible):
    ans = 0
    while grundy:
        b = (1 << grundy.bit_length()) - 1
        if b not in edible:
            return -1
        ans += 1
        grundy ^= b
    return ans


n = int(input())
grundy = 0
edible = set()
for a in map(int, sys.stdin):
    grundy ^= a
    edible.add(a ^ (a - 1))
print(solve(grundy, edible))


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

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

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

  vector<ll> table(n+1, 1);
  for(ll i=2; i <= n; i++) table[i]++;

  for(ll i=2; i*2<=n; ++i) {
    for(ll j=2; i*j<=n; ++j)
        table[i*j]++;
  }
  ll ans = 0;
  reps1(i, n+1) ans += (i * table[i]);
  // reps1(i, n+1) cout << i << " " << table[i] << endl;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 81328
S = str(input())
K = int(input())
N = len(S)
x = 1
i = 0
while int(x) == 1:
  x = S[i]
  #print(x)
  i += 1
  if (i == N) & (int(x) == 1):
    x = -1
i -= 1#while文を抜けるときに余計に+1されてるので、元に戻す

x = int(x)    
if x == -1:
  print(1)
  quit()
  
if i >= K:
  print(1)
else:
  print(x)
  
  


Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int main(){
    long i;
    long len;
    char str[21];
    scanf("%s",str);
    len = strlen(str);
    for (i = len - 1; i >= 0; i-- ) {
        printf("%c",str[i]);
    }
    printf("\n");
    return 0;
}

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

const int mod = 1000000007;

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

  long long ans = 1;
  
  for(int i = 1; i <= N; i++) {
    ans *= i;
    if(ans >= mod)
      ans = ans % mod;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

void count(char s[]) {
        int n =0;
        while (*s) {
                if (*s=='+') n++;
                if (*s=='-') n--;
                s++;
        }
        printf("%d", n);
}
#define LINE_BUF_SIZE 1024
int main() {
  char line[LINE_BUF_SIZE];
  if (fgets(line, sizeof(line), stdin) != NULL) {
                count(line);
        }
  return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, X: int, A: "List[int]"):
    ans = 0
    for i in range(X-1, 0, -1):
        if i in A:
            ans += 1
    c = 0
    for i in range(X+1, N):
        if i in A:
            c += 1
    if ans > c:
        ans = c
    print(ans)


    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, M, X, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61764
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
typedef pair<int, int> pint;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vector<Int> dp(n+1,0);
    dp[0]=1;
    dp[1]=1;
    for(int i=2; i<=n; i++){
        dp[i]=dp[i-1]+dp[i-2];

    }
    cout<<dp[n]<<endl;

    return 0;
}


Measured memory_bytes: 3140
N,M = map(int,input().split())
H = list(map(int,input().split()))
L = [ list(map(int,input().split())) for i in range(M) ]

d = { k+1:True for k in range(N) }

for l in L :
    if H[l[0]-1] <= H[l[1]-1] :
        d[l[0]] = False
    if H[l[0]-1] >= H[l[1]-1] :
        d[l[1]] = False 
    
ans = 0
for v in d.values() :
    if v :
        ans += 1

print(ans)

Measured memory_bytes: 42588
s=input()

s = s[::-1] #文字の反転

t = 0;

while t ==0:
    a = s.find("maerd")
    b = s.find("remaerd")
    c = s.find("esare")
    d = s.find("resare")

    if a == 0 or c== 0:
        s = s[5:]
        continue
    if b == 0:
        s = s[7:]
        continue
    if d == 0:
        s = s[6:]
        continue
    t=1


if s == "":
    print("YES")
else:
    print("NO")

Measured memory_bytes: 134420
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

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

  vector<int> left(N + 1, 0);
  vector<int> right(N + 1, 0);
  rep(i, N){
    if (S[i] == 'W') {
      left[i + 1] = left[i] + 1;
      right[i + 1] = right[i];
    }
    else {
      left[i + 1] = left[i];
      right[i + 1] = right[i] + 1;
    }
  }
  int ans = INF;
  for (int i = 0; i < N; ++i){
    ans = min(ans, (left[i] - left[0]) + (right[N] - right[i + 1]));
  }
  cout << ans << endl;
}


Measured memory_bytes: 3076
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

ll ans;
int main() {
	REP(i, 4) {
		ll a;
		cin >> a;
		ans += a;

	}
	cout << ans << endl;
}



Measured memory_bytes: 3096
import java.io.*;
import java.util.*;
public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String str=br.readLine();
        int count=0;
        char c=str.charAt(0);
        for(int i=1;i<str.length();i++){
            if(str.charAt(i)!=c){
                count++;
                c=str.charAt(i);
            }
        }System.out.println(count);
    }
}

Measured memory_bytes: 10836
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define debug(x...) cout << #x << " = "; _print(x)
typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
#define rep(i,a,b) for (ll i = (a); i < (b); ++i)
#define per(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL) 
const int mxn = 2e5 + 1;
vi v[mxn], vis(mxn), ans(mxn), viss(mxn);

void dfs(int cur){
    vis[cur] = true;
    for(auto child: v[cur])
        if(!vis[child])
            dfs(child);
}

int solve(){
    int n, m;
    cin>> n>> m;
    int x, y;
    rep(i, 0, m){
        cin>> x>> y;
        v[x].pb(y);
        v[y].pb(x);
    }
    int cnt = 0;
    rep(i, 1, n + 1){
        if(!vis[i]){
            dfs(i);
            cnt++;
        }
    }
    if(cnt > 1)
        return cout<< "No\n", 0;
    deque<pair<int, int>> q;
    q.pb(mp(1, 0));
    viss[1] = true;
    while(q.size()){
        pair<int, int> par = q.front();
        ans[par.ff] = par.ss;
        q.pop_front();
        for(auto child: v[par.ff]){
            if(!viss[child]){
                viss[child] = true;
                q.pb(mp(child, par.ff));
            }
        }
    }
    cout<< "Yes\n";
    rep(i, 2, n + 1)
        cout<< ans[i]<< "\n";
    return 0;
}
 
int main()
{
    fast;
    int t = 1;
   // cin>> t;
    while(t--){  
        solve();
    }
    return 0;
}
//v.clear(), vis.clear(); vis.resize(n + 1, 0), v.resize(n + 1);
 
/*  inv[1] = 1; // inv is ll
    for(int i=2; i<=mxn; ++i)
        inv[i]=mod-mod/i*inv[mod%i]%mod;*/


Measured memory_bytes: 16636
#include <stdio.h>

int main(){
  char str[1024];
  while(1){
    scanf("%s", str);
    if(str[0] == '0') break;
    int sum = 0;
    for(int i = 0; str[i] != '\0'; i++){
      sum += str[i] - 48;
    }
    printf("%d\n", sum);
  }
}


Measured memory_bytes: 2724
#include<bits/stdc++.h>
using namespace         std;
#define                 int long long
#define                 pb push_back
#define st(arr,a)       memset(arr,a,sizeof arr)
#define nl              cout<<endl
#define real            signed
#define endl            '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;

real main() 
{
	ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     int a,b,c;
     cin>>a>>b>>c;
     
     if(b+a-c>=0)
     {
          cout<<b+c;
     }
     else
     {
          cout<<2*b+min(a,c-b)+1;
     }
     
     return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define ll long long
using namespace std;
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;
}
const int N = 2e5 + 1000;
int n,top,a[N];
struct node{int pos,v;} sta[N];
void insert(int pos,int mid)
{
	while(sta[top].pos > pos) top --;
	if(sta[top].pos == pos) sta[top].v ++; else sta[++ top] = node{pos,1};
	if(top > 1 && sta[top].v == mid) top --,insert(pos - 1,mid);
}
int check(int mid)
{
	sta[top = 1] = node{0,0};
	for(int i = 2;i <= n;i ++) if(a[i - 1] >= a[i]) insert(a[i],mid);
	return sta[1].v == 0;
}
int main()
{
	n = read(); for(int i = 1;i <= n;i ++) a[i] = read();
	int cnt = 0; for(int i = 2;i <= n;i ++) cnt += a[i] > a[i - 1];
	if(cnt == n - 1) {puts("1"); return 0;}
	int l = 2,r = n,mid,ans = 1;
	while(l <= r)
	{
		mid = (l + r) >> 1;
		if(check(mid)) ans = mid, r = mid - 1;
		else l = mid + 1;
	}
	cout << ans << "\n";
}

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

#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

   int N;
   cin>>N;
   vector<int>t(N),x(N),y(N);
   for(int i=0;i<N;i++)cin>>t[i]>>x[i]>>y[i];
   int old_x = 0;
   int old_y = 0;
   int old_t = 0;
   int d;
   int time;
   for(int i=0;i<N;i++){
      time = abs(old_t-t[i]);
      d = abs(old_x-x[i])+abs(old_y-y[i]);
      if(time<d){
         cout<<"No"<<endl;
         return 0;
      }
      if((time-d)%2){
         cout<<"No"<<endl;
         return 0;
      }
      old_x = x[i];
      old_y = y[i];
      old_t = t[i];
   }
   cout<<"Yes"<<endl;
   return 0;
}


Measured memory_bytes: 1408
#include<iostream>

using namespace std;

int main(){
	int memo[100000] = {};
	int N;
	int a;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> a;
		for(int j = 0; j < 3; j++){
			if(a - j < 0){
				break;
			}
			memo[a - j]++;
		}
	}
	int max = 0;
	for(int i = 0; i < 100000; i++){
		if(max < memo[i]){
			max = memo[i];
		}
	}
	cout << max << endl;
	return 0;
}

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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) ( ((x)&1)==0?0:1 )
#define SIGN(x) ( ((x) > 0) - ((x) < 0)  )
#define dbg(x) cerr << #x"= " << x << endl

std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {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 gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}




int main() {
    READ(0);
    int n;
    ll d,a;
    cin>>n>>d>>a;
    vector<ii> x(n);
    FOR(i,n) cin>>x[i].first>>x[i].second;
    sort(x.begin(),x.end());
    int idx=0;
    ll bombs=0;
    map<int,ll> hh;
    ll acum=0;
    while(idx<n){
        while (!hh.empty() && hh.begin()->first<x[idx].first){
            acum -= hh.begin()->second;
            hh.erase(hh.begin());
        }
        if (acum>=x[idx].second){++idx;continue;}
        int b = (x[idx].second-acum)/a + ((x[idx].second-acum)%a != 0);
        bombs += b;
        ll pos = d*2+x[idx].first;
        if (pos<x[n-1].first)
            hh[pos]=a*b;
        acum += a*b;
        ++idx;
    }
    cout << bombs;


}



Measured memory_bytes: 8064
import java.util.Scanner;

public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int[] a = new int[1000];
	int sum = 0;
	int ans = 0;
	for(int i=0;i<1000;i++){
		a[i] = sc.nextInt();
		for(int k=1;k<=a[i];k++){
			for(int m=k;m<=a[i];m++){
				sum = sum + m;
				if(sum==a[i]){
					ans = ans + 1;
				}
			}
			sum = 0;
		}
		if(a[i]==0){
			break;
		}
		System.out.println(ans-1);
		ans = 0;
	}
}
}

Measured memory_bytes: 19632
#include <bits/stdc++.h>
#include <vector>
#include <cstdlib> //abs(int)
using namespace std;
int main(void){
  int a, b /*, c, d*/;
  cin >> a >> b /*>> c >> d*/;
  if(a * b % 2 == 0){
    cout << "No";
  } else {
    cout << "Yes";
  }
}

Measured memory_bytes: 256
//header{{{
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <boost/hana/functional/fix.hpp>
#include <boost/sort/spreadsort/spreadsort.hpp>
//#include <boost/graph/adjacency_list.hpp>
//#include <boost/graph/dijkstra_shortest_paths.hpp>
//#include <boost/graph/graph_utility.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
  
using namespace std;
//using namespace boost::multiprecision;
//using namespace boost::math;

/*
typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS,
        boost::no_property, boost::property<boost::edge_weight_t, int> > Graph;
*/


#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define FixPoint boost::hana::fix
#define bsort boost::sort::spreadsort::spreadsort
#define int int_fast64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

template< typename T >
struct BinaryIndexedTree {
  vector< T > data;
 
  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }
 
  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }
 
  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout.setf(ios_base::fixed);
    cout.precision(10);

  	int n, q;
    cin >> n >> q;
 
    vector<int> a(n + 1);
 
    reps(i,n){
        cin >> a[i];
    }
 
    vector<tuple<int, int, int> > querys;
 
    rep(i,q){
        int l, r;
        cin >> l >> r;
        querys.emplace_back(r, l, i);
    }
 
    sort(all(querys));
 
    vector<int> v(n + 1), res(q);
    BinaryIndexedTree<int> bit(n + 5);
 
    int R = 1;
    for(auto &&[r, l, query_num] : querys){
        for(; R <= r; ++R){
            if(v[a[R]] != -1){
                bit.add(v[a[R]], -1);
            }
            v[a[R]] = R;
            bit.add(R, 1);
        }
        res[query_num] = bit.sum(r) - bit.sum(l-1);
    }
 
    for(auto &&e : res){
        cout << e << '\n';
    }

    return 0;
}


Measured memory_bytes: 31100
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  ll n; cin >> n;
  if (n % 2 == 1) {
    outl(0);
    return;
  }

  ll ans = 0, k = 5;
  n /= 2;
  while (k <= n) {
    ans += n / k;
    k *= 5;
  }
  outl(ans);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
#include<vector>
#include<deque>
#include<stack>
#include<queue>
#include<string>
#include<iostream>
#include<tuple>
#include<utility>
#include<set>
#include<queue>
#include<iomanip>
#include<iterator>
#include<map>
#include<bitset>
#include<array>
#include<cmath>
//#include<chrono>
//cout<<setprecision(12)
//fixed
//#include<random>
using namespace std;
typedef long long int llint;
typedef long double lldo;
const llint big=1e9+100000;
const llint mod=1e9+7;
const lldo eps=1e-7;
const long double pai=3.141592653589793238462643;
#define mt make_tuple
#define mp make_pair
#define fir first
#define sec second
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define res resize
#define ins insert
#define era erase
#define dme(in) cout<<in<<endl;return 0
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint tensort(vector<lldo>& in){
	//転倒数を計算しながらソートします
	llint ans=0;
	llint i,j,n=in.size(),gen=1;
	vector<lldo>iti(n);
	for(gen=1;gen<n;gen*=2){
		llint now=0;
		for(i=0;i<n;i+=gen*2){//i,i+gen
			llint hid=i,mig=i+gen,end=min(n,i+gen+gen);
			if(n<=i+gen){for(j=i;j<n;j++){iti[j]=in[j];}continue;}
			while(now!=end){
				if(mig==end){iti[now]=in[hid];now++;hid++;}//左
				else if(hid==i+gen){iti[now]=in[mig];now++;mig++;}//右
				else if(in[hid]<in[mig]){iti[now]=in[hid];now++;hid++;}//左
				else{ans+=i+gen-hid;iti[now]=in[mig];now++;mig++;}//右
			}
		}
		swap(in,iti);
	}
	return ans;
}
lldo solve(vector<tuple<int,int,int>> a){
	llint n,i;n=a.size();
	vector<tuple<lldo,lldo>>car(n);//y=ax+b
	for(i=0;i<n;i++){
		get<0>(car[i])=(lldo)-get<0>(a[i])/(lldo)get<1>(a[i]);
		get<1>(car[i])=(lldo)get<2>(a[i])/(lldo)get<1>(a[i]);
	}
	sort(car.begin(),car.end());//xを無限大に飛ばしたときの車の配置
	lldo bmax=big,bmin=-big;
	//改良型にぶたん
	//-1見る
	//1見る
	
	for(int q=0;q<45;q++){
		lldo gen=(bmax+bmin)/2;
		if(bmin+eps<-1&&-1<bmax-eps){gen=-1;}
		else if(bmin+eps<1&&1<bmax-eps){gen=1;}
		else if(q<10&&1<=bmin){gen=sqrt(bmax*bmin);}
		else if(q<10&&bmax<=-1){gen=-sqrt(bmax*bmin);}
		vector<lldo> ima(n);
		for(i=0;i<n;i++){ima[i]=get<0>(car[i])*gen+get<1>(car[i]);}
		llint beet=tensort(ima);
		if(beet<=(n*(n-1)/4)){bmax=gen;}
		else{bmin=gen;}
	}
	return (bmin+bmax)/2;
}
int main(void){
	ios::sync_with_stdio(false);
	llint n,i;
	cin>>n;
	vector<tuple<int,int,int>>a(n);
	for(i=0;i<n;i++){cin>>get<0>(a[i])>>get<1>(a[i])>>get<2>(a[i]);}
	cout<<setprecision(20)<<solve(a);
	for(i=0;i<n;i++){swap(get<0>(a[i]),get<1>(a[i]));}
	cout<<" "<<solve(a)<<endl;
	return 0;
}

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

using namespace std;

int main() {
  int N, L;
  cin >> N >> L;
  int eat = numeric_limits<int>::max();
  int total = 0;
  for (int i = 0; i < N; i++) {
    int taste = L + i;
    total += taste;
    if (abs(eat) > abs(taste)) {
      eat = taste;
    }
  }
  cout << total - eat;

  return 0;
}


Measured memory_bytes: 256
// A[0][0:j+1] + A[1][j:N]を最大化するようなj
// セグ木で和を高速に計算
/*
 * Contents   : ARC 090 C
 * Author     : Kitaura Hiromi
 * LastUpdate : 20180731
 * Since      : 20180731
 */
#include <bits/stdc++.h>
#define MAX_N 100
using namespace std;
int N, A[2][MAX_N], bit[2][MAX_N + 1];
int sum(int i, int j){
	int s = 0;
	while(i > 0){
		s += bit[j][i];
		i -= i & -i;
	}
	return s;
}

void add(int i, int x, int j){
	while(i <= N){
		bit[j][i] += x;
		i += i & -i;
	}
}

int main(void){
	cin >> N;
	for(int i=0; i<2; i++){
		for(int j=0; j<N; j++){
			cin >> A[i][j];
			add(j+1, A[i][j], i);
		}
	}
	int ret = 0;
	for(int i=0; i<N; i++){
		ret = max(ret, sum(i+1, 0) + sum(N, 1) - sum(i, 1));
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;
const int maxn = 1e5 + 20;
int a[maxn];
void work() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &a[i]);
    }
    int ans = 0;
    for (int i = 1; i <= n - 1; ++i) {
        if (a[i] == i) {
            swap(a[i], a[i + 1]);
            ans++;
        }
    }
    if (a[n] == n) ans++;
    cout << ans << endl;
}

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    work();
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define REP(n)for(ll i=0;i<n;i++)
#define M make_pair
typedef long long ll;
using namespace std;
int main(){
    ll n,k,s,t,a[50];cin>>n>>k>>s>>t;
    REP(n)cin>>a[i];
    map<pair<ll,ll>,ll> p[50];
    REP(n){
        for(ll j=k-2;j+1;j--){
            for(const auto&l:p[j]){
                p[j+1][M(l.first.first&a[i],l.first.second|a[i])]+=l.second;
            }
        }
        p[0][M(a[i],a[i])]=1;
    }
    n=0;
    REP(k)n+=p[i][M(s,t)];
    cout<<n;
}

Measured memory_bytes: 154108
use std::io;
use std::str;

pub struct Scanner<R> {
    reader: R,
    buffer: Vec<String>,
}

impl<R: io::BufRead> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Scanner {
            reader: reader,
            buffer: Vec::new(),
        }
    }

    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("failed to parse token");
            }
            let mut input = String::new();
            self.reader.read_line(&mut input).expect("failed to read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

use io::Write;
fn main() {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut stdout = io::BufWriter::new(stdout);
    let mut scanner = Scanner::new(stdin.lock());

    let N: usize = scanner.token::<usize>();
    let mut n: usize = 0;
    if N >= 100 {
        n = (N % 10) % 10;
    } else if N >= 10 {
        n = (N % 10);
    } else {
        n = N;
    }
    match n {
        2 | 4 | 5 | 7 | 9 => {
            writeln!(&mut stdout, "hon");
        }
        0 | 1 | 6 | 8 => {
            writeln!(&mut stdout, "pon");
        }
        _ => {
            writeln!(&mut stdout, "bon");
        }
    }
}


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

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
const int N=2e6+7;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}
int main()
{

    double r;
    cin>>r;
    double a=2.0*PI*r;
    cout<<a;








}


Measured memory_bytes: 3788
from math import sqrt, ceil

a, b = map(int, input().split())

def gcd(a, b):
  x, y = (a, b) if a > b else (b, a)
  while y > 0:
    x, y = y, x % y
  return x

d = gcd(a, b)
ans = 1
for i in range(2, ceil(sqrt(d))+1):
  if d % i == 0:
    ans += 1
    while(d % i == 0):
      d = d / i
if d != 1:
    ans += 1
print(ans)


Measured memory_bytes: 3064
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto N = RD;

	long ans;
	if (N != 1)
	{
		ans = 10;
		ans.modpow(N);
		
		long cnt1 = 9;
		cnt1.modpow(N);
		cnt1.modm(2);
		long cnt2 = 8;
		cnt2.modpow(N);
		ans.mods(cnt1);
		ans.moda(cnt2);
	}

	writeln(ans);
	stdout.flush;
	debug readln;
}


Measured memory_bytes: 2704
#include <stdio.h>
#include <string.h>
#include <stdio.h>
void swap_node(int H[], int i, int j){
  int tmp=H[i];
  H[i]=H[j];
  H[j]=tmp;
}
void maxHeapify(int H[], int size, int i){
  int left=2*i, right=2*i+1;
  int largest;
  if((left<=size)&&(H[i]<H[left]))
	largest=left;
  else
	largest=i;
  if((right<=size)&&(H[largest]<H[right]))
	largest=right;
  if(largest!=i){
	swap_node(H, i, largest);
	maxHeapify(H, size, largest);
  }
}
void increaseKey(int Q[], int size, int i, int key){
  if(Q[i]>key)
	return;
  else{
	Q[i]=key;
	while((i>1)&&(Q[i/2]<Q[i])){
	  swap_node(Q, i, i/2);
	  i=i/2;
	}
  }
}
int insert(int Q[], int size, int key){
  ++size;
  Q[size]=-1;
  increaseKey(Q, size, size, key);
  return size;
}
void print(int Q[], int size){
  int i;
  for(i=1; i<=size; ++i){
	printf("%d ", Q[i]);
}
  printf("\n");
}
int extract(int Q[], int size){
  int max=Q[1];
  Q[1]=Q[size];
  Q[size]=max;
  --size;
  maxHeapify(Q, size, 1);
  return size;
}
int main(){
  char line[100];
  char *str_ptr;
  int key;
  int priority_quene[2000000];
  int quene_size=0;
  int max;
  while(1){
	fgets(line, sizeof(line), stdin);
	if(line[strlen(line)-1]=='\n')
	  line[strlen(line)-1]='\0';
	if(strcmp(line, "end")==0)
	  break;
	str_ptr=strtok(line, " ");	
	if(strcmp(str_ptr, "extract")==0){
	  max=priority_quene[1];
	  quene_size=extract(priority_quene, quene_size);
	  printf("%d\n", max);
	}
	else if(strcmp(str_ptr, "insert")==0){
	  str_ptr=strtok(NULL, " ");
	  sscanf(str_ptr, "%d", &key);
	  //insert
	  quene_size=insert(priority_quene, quene_size, key);
	}else if(strcmp(str_ptr, "print")==0)
	  print(priority_quene, quene_size);
  }
  return 0;
}



Measured memory_bytes: 5644
n = int(input())

def yakusu(k):
    cnt = 1
    for i in range(1, k):
        if k % i == 0:
            cnt += 1
    return cnt

#print(yakusu(105))
ans = 0
for i in range(1,n+1):
    if i % 2 == 0:
        continue
    if yakusu(i) == 8:
        ans += 1
print(ans)


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

int main(){ 
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
  int res = a[n/2] - a[n/2-1];
  cout << res << endl;
  return 0; 
} 

Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		String a = input.next();
		String b = input.next();

		int ai = Integer.parseInt(a);
		int bi = Integer.parseInt(b);

		if(ai < bi){
			System.out.println("a < b");
		}else if (ai == bi){
			System.out.println("a == b");
		}else{
			System.out.println("a > b");
		}
	}
}

Measured memory_bytes: 26136
#include<bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define MOD (long long)(1e9+7)
#define _(i,a,n) for(int i=a;i<n;i++)
#define zero(a) a[0]=0
bool cmp(int x,int y)
{
    return x>y;
}
int main()
{
 int n,x,t;
 cin>>n>>x>>t;
 int c=ceil(1.0*n/x);
 cout<<c*t<<endl;
}


Measured memory_bytes: 3616
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
ll x;
cin>>x;
ll ans=0;
ll y=x/500;
ans+=(y*1000);
ll z=x%500;
z=z/5;
ans+=(z*5);
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
ans=0

for i in range(n):
    while h[i]!=0:
        if h[i:].count(0)==0:
            m=min(h[i:])
            for j in range(i,n):
                h[j]-=m
            ans+=m
        else:
            ind=h[i:].index(0)
            m=min(h[i:i+ind])
            for j in range(i,i+ind):
                h[j]-=m
            ans+=m
print(ans)


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


int main() {
	int n;
	cin >> n;
	int happy[100000][3];
	for(int i=0; i<n; i++){
		cin >> happy[i][0] >> happy[i][1] >> happy[i][2];
	}
	long long dp[100000][3];
	for(int i=0; i<n; i++){
		for(int j=0; j<3; j++){
			dp[i][j] = 0;
		}
	}
	for(int i=0; i<3; i++){
		dp[0][i] = happy[0][i];
	}
	for(int i=0; i<n-1; i++){
		int a = happy[i+1][0];
		int b = happy[i+1][1];
		int c = happy[i+1][2];
		dp[i+1][0] = max(dp[i][1]+a, dp[i][2]+a);
		dp[i+1][1] = max(dp[i][0]+b, dp[i][2]+b);
		dp[i+1][2] = max(dp[i][0]+c, dp[i][1]+c); 
	}
	long long ans = max(dp[n-1][0], dp[n-1][1]);
	ans = max(ans, dp[n-1][2]);
	cout << ans << endl;
}


Measured memory_bytes: 3712