akhauriyash/Code-Regression huggingface dataset:
void main()
{
    long n = rdElem;
    long[][] a = 2.rdMat;

    long[][] b = new long[][](2, n+1);
    foreach (i; 0 .. 2)
    {
        foreach (j; 0 .. n)
        {
            b[i][j+1] = b[i][j] + a[i][j];
        }
    }

    long result;
    foreach (i; 1 .. n+1)
    {
        result = max(result, b[0][i]+b[1][n]-b[1][i-1]);
    }

    result.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

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

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

using namespace std;



void one_case() {
    int n;
    cin >> n;
    map<char, int> mp;
    string l  = "MARCH";
    for (int i = 0; i < n; ++i) {
        string name;
        cin >> name;
        for (auto lt : l) {
            if (lt == name[0]) {
                ++mp[name[0]];
                break;
            }
        }
    }

    vector<vector<ll>> dp(6, vector<ll>(4));
    for (int i = 0; i < 6; ++i) {
        dp[i][0] = 1;
    }

    for (int i = 1; i < 6; ++i) {
        for (int j = 0; j < 3; ++j) {
            dp[i][j + 1] = ll(mp[l[i - 1]]) * dp[i - 1][j] + dp[i - 1][j + 1];
        }
    }

    cout << dp.back().back() << "\n";

}


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


    int t = 1;
//    cin >> t;
    while (t--) {
        one_case();
    }

    return 0;
}


Measured memory_bytes: 256
import math

n = int(input())


def sub(n):
	max_v = int(math.log(n // 2, 5))
	ans = 0
	for i in range(max_v):
		ans += n // (2 * 5 ** (i + 1))
	return ans

def guess(n):
	if n % 2 == 1 or n < 10:
		return 0
	else:
		return sub(n)

print(guess(n))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,X;
  cin >> K >> X;
  for(int i=(X-K+1);i<(X+K);i++){
    if((i>-1000001)&&(i<1000001)){
      cout << i;
      if(i!=(X+K-1)){
        cout << " ";
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	ll w, h; cin >> w >> h;
	using P = pair<ll, ll>;
	priority_queue<P, vector<P>, greater<P>> pq;
	REP(i, w) {
		ll a; cin >> a;
		pq.push({ a, 0 });
	}
	REP(i, h) {
		ll a; cin >> a;
		pq.push({ a, 1 });
	}

	ll cost = 0;
	while (!pq.empty()) {
		auto p = pq.top(); pq.pop();
		if (p.second) {
			cost += (w + 1) * p.first;
			h--;
		} else {
			cost += (h + 1) * p.first;
			w--;
		}
	}
	cout << cost << endl;

	return 0;
}

Measured memory_bytes: 4464
#include <stdio.h>
int main()
{

	long long int a,b,c=0,d,e,f,i,j,k,l,m,n;
	scanf("%lld %lld",&n,&m);
	long long int x[m];
	for(i=0;i<m;i++)
    {
        scanf("%lld",&x[i]);
        c=c+x[i];
    }
    if(c<=n){printf("%lld\n",(n-c));}
    else{printf("-1\n");}


}


Measured memory_bytes: 1808
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long ll;

int read() {
	char ch;
	for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
	int x=ch-'0';
	for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

const int N=1e6+5,Mo=998244353,iv=Mo+1>>1;

int n,m,c[N],g[N],inv[N],p[N],mu[N];
bool vis[N];

void pre(int N) {
	mu[1]=1;
	fo(i,2,N) {
		if (!vis[i]) p[++p[0]]=i,mu[i]=-1;
		fo(j,1,p[0]) {
			int k=i*p[j];if (k>N) break;
			vis[k]=1;if (!(i%p[j])) break;
			mu[k]=-mu[i];
		}
	}
}

int main() {
	n=read();
	fo(i,1,n) {
		int x=read();
		c[x]++;m=max(m,x);
	}
	pre(m);
	fo(i,1,m) fo(j,1,m/i) (g[i]+=(ll)j*c[i*j]%Mo*i%Mo)%=Mo;
	inv[0]=inv[1]=1;fo(i,2,m) inv[i]=(ll)(Mo-Mo/i)*inv[Mo%i]%Mo;
	int ans=0;
	fo(i,1,m) {
		int ret=0;
		fo(j,1,m/i) (ret+=(ll)mu[j]*g[i*j]*g[i*j]%Mo)%=Mo;
		(ans+=(ll)ret*inv[i]%Mo)%=Mo;
	}
	fo(i,1,m) (ans-=(ll)c[i]*i%Mo)%=Mo;
	ans=(ll)ans*inv[2]%Mo;
	printf("%d\n",(ans+Mo)%Mo);
	return 0;
}


Measured memory_bytes: 18688
def main():
    H, W = map(int, input().split())
    g_list = []
    for i in range(10):
        g_list.append(list(map(int, input().split())))
    min_change = [j[1] for j in g_list]
    flag = [0 for _ in range(10)]
    tep = [(j,g) for j, g in enumerate(min_change) if j != 1]  
    min_g = min(tep, key=lambda a:a[1])[0]
    flag[min_g] = 1
    #print(min_change, flag, min_g)
    while sum(flag) != 9:
        #print(min_change, flag)
        for j in range(10):
            if g_list[j][min_g] + min_change[min_g] < min_change[j]:
                min_change[j] = g_list[j][min_g] + min_change[min_g]
        tep = [(k,g) for k, g in enumerate(min_change) if flag[k] == 0 and k != 1]
        if tep != []:
            min_g = min(tep, key=lambda a:a[1])[0]
        else :
            break
        flag[min_g] = 1
    s = 0
    for i in range(H):
        wall = list(map(int, input().split()))
        s += sum([min_change[i] for i in wall if i != -1])
    return s
        
if __name__ == '__main__':
    print(main())

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	char c;
	cin>>c;
	printf("%c\n",c+1);
}


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

int main(void){
	int i,j;
	
	int s;
	
	scanf("%d",&s);
	
	int a,b,c,d;
	
	a=s%10;
	s/=10;
	b=s%10;
	s/=10;
	c=s%10;
	s/=10;
	d=s;
	
	if(a==b||b==c||c==d){
		printf("Bad\n");
	}else{
		printf("Good\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
//
//  main.cpp
//  E - Red and Green Apples
//
//  Created by 李远铄 on 2020/7/15.
//  Copyright © 2020 李远铄. All rights reserved.
//

#include <iostream>
#include <cstdlib>
using namespace std;
typedef unsigned long long ull;
long X,Y,A,B,C;
ull *p;
ull *q;
ull *r;
ull ans;
int compare_ull (const void * a, const void * b);
int main(int argc, const char * argv[]) {
    scanf("%ld %ld %ld %ld %ld",&X,&Y,&A,&B,&C);
    p=(ull*)calloc(A, sizeof(ull));
    q=(ull*)calloc(B, sizeof(ull));
    r=(ull*)calloc(C, sizeof(ull));
    for (long i=0; i<A; i++) {
        scanf("%llu",p+i);
    }
    for (long i=0; i<B; i++) {
        scanf("%llu",q+i);
    }
    for (long i=0; i<C; i++) {
        scanf("%llu",r+i);
    }
    qsort(p,A,sizeof(ull),compare_ull);qsort(q,B,sizeof(ull),compare_ull);qsort(r,C,sizeof(ull),compare_ull);
    long n_A=X-1;long n_B=Y-1;long n_C=0;
    while (n_C<C) {
        if ( n_A>=0 && n_B>=0) {
            if (p[n_A]<q[n_B]) {
                if (p[n_A]<r[n_C]) {
                    n_A--;n_C++;
                }else{
                    break;
                }
            }else if(p[n_A]>q[n_B]){
                if (q[n_B]<r[n_C]) {
                    n_B--;n_C++;
                }else{
                    break;
                }
            }else{
                if (p[n_A]<r[n_C]) {
                    if (n_A<n_B) {
                        n_B--;n_C++;
                    }else{
                        n_A--;n_C++;
                    }
                }else{
                    break;
                }
            }
        }else if( n_A>=0 && n_B<0 ){
            if (p[n_A]<r[n_C]) {
                n_A--;n_C++;
            }else{
                break;
            }
        }else if( n_B>=0 && n_A<0 ){
            if (q[n_B]<r[n_C]) {
                n_B--;n_C++;
            }else{
                break;
            }
        }else{
            break;
        }
    }
    for (long i=0; i<=n_A; i++) {
        ans+=p[i];
    }
    for (long i=0; i<=n_B; i++) {
        ans+=q[i];
    }
    for (long i=0; i<n_C; i++) {
        ans+=r[i];
    }
    printf("%llu",ans);
    return 0;
}
int compare_ull (const void * a, const void * b){
    if ( *(ull*)a <  *(ull*)b ) return 1;
    if ( *(ull*)a == *(ull*)b ) return 0;
    if ( *(ull*)a >  *(ull*)b ) return -1;
    return 0;
}


Measured memory_bytes: 6180
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a


def lcm(a, b):
    return (a * b) // gcd(a, b)


N, M = map(int, input().split())
s = input()
t = input()

g = gcd(N, M)
n, m = N // g, M // g

L = lcm(N, M)

k = 0
flg = True
while k * n * m < L:
    if s[k * n] != t[k * m]:
        flg = False
        break
    k += 1

print(L if flg else -1)

'''
0-indexed -> 1-indexed
a * L/N == b * L/M
となるすべてのa, bについて
s[a] == t[b]が必要

a * M == b * N
a * gcd(N, M) * m == b * gcd(N, M) * n
a * m == b * n
m, nは互いに素

a = k * n
b = k * m
k: 0以上の整数
とおける

文字列Xの長さLは, lcm(N, M)の倍数だが
調べるa, bの組は, Lの値によらないので
構成できるときは
L = lcm(N, M)とするのが最小
'''

Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	stack<int> st;
	int x;
	while (cin >> x) {
		if (x == 0) {
			cout << st.top() << endl; st.pop();
		}
		else st.push(x);
	}
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
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; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

int n;
int a[200001];
deque<int> rec;

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    for(int i=0;i<n;i++){
        if(i%2) rec.push_front(a[i]);
        else rec.push_back(a[i]);
    }
    if(n%2){
        for(int i=n-1;i>=0;i--){
            cout << rec[i] << ' ';
        }
    }
    else{
        for(int i=0;i<n;i++){
            cout << rec[i] << ' ';
        }
    }
    cout << "\n";
    return 0;
}

Measured memory_bytes: 3840
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,x,a[1009];
int main()
{
  scanf("%d%d",&n,&x);
  for (int i=1;i<=n;i++) scanf("%d",&a[i]);
  sort(a+1,a+1+n);
  int ans=0;
  for (int i=1;i<n;i++)
  if (x>=a[i])x-=a[i],ans++;
  else break;
  if (x==a[n]) ans++;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  char n[11];
  while(cin>>n){
    for(int i=0;i<9;i++){
      for(int j=0;j<9-i;j++) n[j]=(n[j]-'0'+n[j+1]-'0')%10+'0';
    }
    cout<<(int)(n[0]-'0')<<endl;
  }
  return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int n,k;
    scanf("%d%d",&n,&k); 
    bool flag[15];
    for(int i=0;i<=10;i++){
        flag[i]=false;
    }
    int x;
    for(int i=1;i<=k;i++){
        scanf("%d",&x);
        flag[x]=true;
    }

    for(int i=n;;i++){
        int j=i;
        while(j>0){
            if (flag[j%10]==true){
                break;
            }
            j/=10;
        }
        if (j<=0){
            printf("%d\n",i);
            break;
        }
    }
}

Measured memory_bytes: 3720
#include <stdio.h>
int main() {
  int N;
  scanf("%d", &N);
  int gurus = 0;
  int colors = 0;
  for (int i = 0; i < N; ++i) {
    int rate;
    scanf("%d", &rate);
    if (rate >= 3200)
      ++gurus;
    else
      colors |= 1 << (rate / 400);
  }
  if (colors == 0) {
    printf("1 %d\n", gurus);
  }
  else {
    int cmin = 0;
    while (colors) {
      colors &= (colors - 1);
      ++cmin;
    }
    printf("%d %d\n", cmin, cmin + gurus);
  }
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
  	int N, X, dist = 0, res = 0;
  	int L[100];
  
  	scanf("%d %d\n",&N,&X);
  	for(int i = 0; i < N; i++){
    	scanf("%d ",&L[i]);
    }
  
  	for(int i = 0; i <= N; i++){
    	if(i == 0){
        	dist = 0;
        }else{
        	dist += L[i-1];
        }
      
      	if(dist <= X){
        	res++;
        }else{
        	break;
        }
    }
  	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 128
package main

import (
  "fmt"
)

import (
  "bufio"
  "strconv"
  "os"
  "sort"
)

var sc = bufio.NewScanner(os.Stdin)

func Init() {
  sc.Split(bufio.ScanWords)
}

func NextLine() (string, bool) {
  nonstop := sc.Scan()
  return sc.Text(), nonstop
}

func NextWord() (string, bool) {
  nonstop := sc.Scan()
  return sc.Text(), nonstop
}

func NextInt() (int, bool) {
  nonstop := sc.Scan()
  res, _ := strconv.ParseInt(sc.Text(), 10, 32)
  return int(res), nonstop
}

func NextLong() (int64, bool) {
  nonstop := sc.Scan()
  res, _ := strconv.ParseInt(sc.Text(), 10, 64)
  return int64(res), nonstop
}

func NextFloat() (float32, bool) {
  nonstop := sc.Scan()
  res, _ := strconv.ParseFloat(sc.Text(), 32)
  return float32(res), nonstop
}

func NextDouble() (float64, bool) {
  nonstop := sc.Scan()
  res, _ := strconv.ParseFloat(sc.Text(), 64)
  return float64(res), nonstop
}

func main(){
  Init()
  // var c [2]byte
  // var n [2]int
  s, _ := NextWord()

  b := make([]int, len(s))
  for i, a := range s {
    b[i] = int(a)
  }

  sort.Ints(b)

  if b[0] == b[2] {
    fmt.Printf("No\n")
    return
  }
  if b[0] == b[1] && b[2] == b[3] {
    fmt.Printf("Yes\n")
  }else{
    fmt.Printf("No\n")
  }
}


Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))

def gcd_step(a, b):
    return b, a % b

def gcd(a, b):
    a, b = gcd_step(a,b)
    while b > 0:
        a,b = gcd_step(a,b)

    return a

g = A[0]
for i in range(1, N):
    g = gcd(g, A[i])

print(g)


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

int main() {
    long long N, A, B;
    cin >> N >> A >> B;
    long long ans = N / (A + B) * A;
    N %= A + B;
    if (N < A) ans += N;
    else ans += A;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 55
#define MO 1000000007
void Add(int &x,int y)
{
	x=(x+y>=MO)?(x+y-MO):(x+y);
}
int dp[MAXN][MAXN*2][MAXN*2],n,a[MAXN*2],ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n*2-1;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n*2);
	dp[n][1][0]=1;
	for(int i=n-1;i>=1;i--)
	{
		int al=(a[i]!=a[i+1]),ar=(a[n*2-i]!=a[n*2-i-1]);
		for(int l=0;l<=2*n-1;l++)
			for(int r=0;r+l<=2*n-1;r++)
				if(dp[i+1][l][r])
				{
					int t=dp[i+1][l][r];
					for(int dl=0;dl<l+al;dl++)
						Add(dp[i][l+al-dl][r+ar+(dl>0)],t);
					for(int dr=1;dr<=r+ar;dr++)
						Add(dp[i][l+al+1][r+ar-dr],t);
				}
	}
	for(int l=0;l<=2*n-1;l++)
		for(int r=0;r+l<=2*n-1;r++)
			Add(ans,dp[1][l][r]);
	printf("%d\n",ans);
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
ll a[100005],b[100005];
void solve(){
	ll n,res=0;
	cin>>n;
	for(ll i=1;i<=n;i++)
		cin>>a[i];
	for(ll i=1;i<=n;i++)
		cin>>b[i];
	for(ll i=1;i<=n;i++)
		if(a[i]>b[i])
			res-=a[i]-b[i];
		else
			res+=(b[i]-a[i])/2;
	if(res>=0)
		cout<<"Yes";
	else
		cout<<"No";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    clock_t z=clock();
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}

Measured memory_bytes: 3964
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int getResult(vector<int> &L, const int size){
  sort(L.begin(), L.end());
  int sum = 0;
  for(int i = 0; i < size; i += 2){
    sum += L[i];
  }
  return sum;
}

int main(){
  int N;
  cin >> N;
  
  const int N2 = N * 2;
  vector<int> L(N2);
  for(int i = 0; i < N2; i++){
    cin >> L[i];
  }

  int result = getResult(L, N2);
  cout << result;
  return 0;
}

Measured memory_bytes: 3528
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i,n) for(int i=(int)(n);i>=0;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    int ans = 0;
    rep(i, 0, N) {
        int a;
        cin >> a;
        ans += a - 1;
    }
    cout << ans << endl;
    return (0^_^0);
}



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


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

    li h, w;
    cin >> h >> w;
    li ch, cw, dh, dw;
    cin >> ch >> cw >> dh >> dw;

    vector<string> field(h + 2, string(w + 2, '#'));
    li hh = h + 2;
    li ww = w + 2;

    for (int i = 0; i < h; ++i) {
        string line;
        cin >> line;
        for (int j = 0; j < w; ++j) {
            field[i + 1][j + 1] = line[j];
        }
    }

    const li inf = 1LL << 50;
    vector<vector<li>> dists(hh, vector<li>(ww, inf));
    deque<tuple<li, li, li>> q;
    q.emplace_back(ch, cw, 0);
    dists[ch][cw] = 0;

    while (not q.empty()) {
        const auto pos = q.front();
        q.pop_front();
        li x = get<0>(pos);
        li y = get<1>(pos);
        li dist = get<2>(pos);
        if (dists[x][y] < dist) {
            continue;
        }

        for (int dx = -2; dx <= 2; ++dx) {
            for (int dy = -2; dy <= 2; ++dy) {
                if (dx == 0 && dy == 0) {
                    continue;
                }
                li nx = x + dx;
                li ny = y + dy;
                if (nx < 0 || nx >= hh || ny < 0 || ny >= ww) {
                    continue;
                }
                if (field[nx][ny] == '#') {
                    continue;
                }
                li cost;
                if (abs(dx) + abs(dy) == 1) {
                    cost = 0;
                } else {
                    cost = 1;
                }
                li ndist = dist + cost;
                if (dists[nx][ny] <= ndist) {
                    continue;
                }
                if (cost == 0) {
                    q.emplace_front(nx, ny, ndist);
                } else {
                    q.emplace_back(nx, ny, ndist);
                }
                dists[nx][ny] = ndist;
            }
        }
    }
    li ans = dists[dh][dw];
    if (ans == inf) {
        ans = -1;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 12756
N = int(input())
H = list(map(int, input().split()))
dp = [- 1]*N
dp[-1] = 0
res = 0
for i in range(N - 2, - 1, - 1):
    if H[i] >= H[i + 1]:
        dp[i] = dp[i + 1] + 1
        res = max(res, dp[i])
    else:
        dp[i] = 0
print(res)

Measured memory_bytes: 14252
#include<iostream>
#include <bits/stdc++.h>
#include<cstdio>
#include<string>
#include<math.h>
#include<vector>
#include <algorithm>
using namespace std; 
typedef long long  ll;



int main()
{
	ll a,b,c;
	cin >>a >>b >>c;
	if(4*a*b<(c-a-b)*(c-a-b)&&c-a-b>0){
		cout << "Yes" <<endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#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;
#pragma endregion

#pragma region const
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;
#pragma endregion

#pragma region util
#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(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

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;
}
#pragma endregion

#pragma region init
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

int main()
{
	i64 N,M;
	cin >> N >> M;
	vector<i64> food(M, 0);

	REP(i, N)
	{
		i64 K;
		cin >> K;
		REP(j, K)
		{
			i64 A;
			cin >> A;
			food[A - 1]++;
		}
	}

	i64 ans = 0;
	REP(i, M)
	{
		if (food[i] == N)
			++ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
// Union Find Tree
// 高速にグループ分けをするデータ構造
// * 2つメンバーが所属するグループを同じグループにまとめる
// * 2つのメンバーが同じグループに所属するか判定する
//
// verifyした問題
// B - Union Find
// https://atcoder.jp/contests/atc001/tasks/unionfind_a

#include <bits/stdc++.h>
using namespace std;
#define int long long

// Union Find Tree
class UnionFindTree
{
private:
    vector<int> parent;
    vector<int> rank;
    int root(int x) { return parent[x] == x ? x : parent[x] = root(parent[x]); }
    vector<int> size; // グループのメンバー数
public:
    // コンストラクタ n: メンバー数
    UnionFindTree(int n)
    {
        parent.resize(n);
        iota(parent.begin(), parent.end(), 0);
        rank.assign(n, 0);
        size.assign(n, 1);
    }
    // メンバーxとメンバーyが同じグループに所属しているかどうかを返す
    bool same(int x, int y) { return root(x) == root(y); }
    // メンバーxとメンバーyが所属するグループを合併する
    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;

        if (rank[x] < rank[y])
        {
            parent[x] = y;
            size[y] += size[x];
        }
        else
        {
            parent[y] = x;
            size[x] += size[y];
            if (rank[x] == rank[y])
                rank[x]++;
        }
        return true;
    }
    // メンバーxが所属するグループのサイズを返す
    int getGroupSize(int x) { return size[root(x)]; }
};

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

    int n, m, k;
    cin >> n >> m >> k;
    UnionFindTree uft(n);
    vector<int> friends(n);
    vector<int> candidate(n);

    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;

        uft.unite(a, b);
        friends[a]++;
        friends[b]++;
    }

    for (int i = 0; i < n; i++)
    {
        candidate[i] = uft.getGroupSize(i) - friends[i] - 1;
    }

    for (int i = 0; i < k; i++)
    {
        int c, d;
        cin >> c >> d;
        c--;
        d--;

        if (uft.same(c, d))
        {
            candidate[c]--;
            candidate[d]--;
        }
    }

    for (int i = 0; i < n; i++)
    {
        cout << candidate[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 4736
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
const char dir[4] = { 'u','l','d','r' };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

LL n, k;
const LL MOD = 1000000007;
LL combi(LL N_, LL C_) {
	const int NUM_ = 400001;
	static LL fact[NUM_ + 1], factr[NUM_ + 1], inv[NUM_ + 1];
	if (fact[0] == 0) {
		inv[1] = fact[0] = factr[0] = 1;
		for (int i = 2; i <= NUM_; ++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
		for (int i = 1; i <= NUM_; ++i) fact[i] = fact[i - 1] * i%MOD, factr[i] = factr[i - 1] * inv[i] % MOD;
	}
	if (C_<0 || C_>N_) return 0;
	return factr[C_] * fact[N_] % MOD*factr[N_ - C_] % MOD;
}

LL hcomb(int P_, int Q_) { return (P_ == 0 && Q_ == 0) ? 1 : combi(P_ + Q_ - 1, Q_); }

LL modpow(LL a, LL n = MOD - 2) {
	LL r = 1;
	while (n) r = r*((n % 2) ? a : 1) % MOD, a = a*a%MOD, n >>= 1;
	return r;
}

int main() {
	cin >> n >> k;
	cout << hcomb(k, n) << endl;
}


Measured memory_bytes: 12444
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long int lnt;
typedef pair<lnt,lnt> P;
const lnt MOD=1e9 +7;
lnt h[100000];
lnt t[100000],a[100000];
lnt n;
int main()
{
	lnt ans=1;
	cin>>n;
	for(lnt i=0;i<n;i++){
		cin>>t[i];
	}
	for(lnt i=0;i<n;i++){
		cin>>a[i];
	}
	for(lnt i=0;i<n;i++){
		if(i==0||t[i-1]!=t[i]){
			h[i]=-t[i];
		}
		else h[i]=t[i];
	}
	for(lnt i=0;i<n;i++){
		if(i==n-1||a[i+1]!=a[i]){
			if(h[i]>0){
				if(a[i]>h[i]) goto owari;
				else h[i]=-a[i];
			}
			else{
				if(a[i]!=-h[i]) goto owari;
			}
		}
		else{
			if(h[i]>0){
				h[i]=min(h[i],a[i]);
			}
			else{
				if(a[i]<-h[i]) goto owari;
			}
		}
	}
	
	for(lnt i=0;i<n;i++){
		if(h[i]<0) continue;
		ans= (ans* h[i])%MOD;
	}
	printf("%lld\n",ans);
	return 0;
	owari: printf("0\n");
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

#define NUM 2147483647

int N = 1;
int* data;

void init(int first_N){
	while(N < first_N)N *= 2;
}

void update(int update_left,int update_right,int new_value,int node_id,int node_left,int node_right){
	if(update_right < node_left || update_left > node_right)return;
	else if(update_left <= node_left && update_right >= node_right){
		data[node_id] = new_value;
	}else{
		if(data[node_id] >= 0){
			update(node_left,node_right,data[node_id],2*node_id+1,node_left,(node_left+node_right)/2);
			update(node_left,node_right,data[node_id],2*node_id+2,(node_left+node_right)/2+1,node_right);
			data[node_id] = -1;
		}
		update(update_left,update_right,new_value,2*node_id+1,node_left,(node_left+node_right)/2);
		update(update_left,update_right,new_value,2*node_id+2,(node_left+node_right)/2+1,node_right);
	}
}

int query(int search_left,int search_right,int node_id,int node_left,int node_right){
	if(search_right < node_left || search_left > node_right){
		return NUM;
	}else if(node_left <= search_left && node_right >= search_right && data[node_id] >= 0){
		return data[node_id];
	}else if(search_left <= node_left && search_right >= node_right && data[node_id] >= 0){
		return data[node_id];
	}else{
		if(data[node_id] != -1)return data[node_id];
		else{
			int left = query(search_left,search_right,2*node_id+1,node_left,(node_left+node_right)/2);
			int right = query(search_left,search_right,2*node_id+2,(node_left+node_right)/2+1,node_right);
			return min(left,right);
		}
	}
}

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

	init(first_N);

	data = new int[270000];

	for(int i = 0; i <= 2*N-2; i++)data[i] = NUM;

	int command,left,right,value;

	for(int i = 0; i < Q; i++){
		scanf("%d",&command);

		if(command == 0){
			scanf("%d %d %d",&left,&right,&value);
			update(left,right,value,0,0,N-1);
		}else{
			scanf("%d %d",&left,&right);
			printf("%d\n",query(left,right,0,0,N-1));
		}
	}

}

Measured memory_bytes: 4224
// code.begin();
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back 
#define what_is(x) cerr<<#x<<" is "<<x<<endl;
#define print(v) for(auto i:v) cout<<i<<" ";cout<<endl;
#define my_time ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long 
#define endl "\n"
#define MOD 1000000007
const long long int INF=1e18;
#define mod 1000000007
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    ordered_set; 
//find_by_order(x)
//order_of_key(x)  


int power(int x,unsigned int y)
{
    int res=1;
    
    while(y>0)
    {
        // if y is odd multiply with result
        if(y&1)
        res=res*x;
        
        y=y>>1; // y=y/2;
        x=x*x;
        
    }
    return res;
}

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

ll  max3(ll  a, ll  b, ll c)
{
    return max(c, max(a, b));
}
int min3(int a, int  b, int  c)
{
    return min(a, min(b, c));
}

int  powermod(int  x, int  y, int p )
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int logg(int  a)
{
    int  x = 0;
    while (a > 1)
    {
        x++;
        a /= 2;
    }
    return x;
}


int modinv(int x)
{
    return powermod(x, mod - 2, mod);
}


int  main(){
	my_time;

int t;
t=1;
//cin>>t;int test=0;
while(t--)
{
int n;
cin>>n;
int arr[n];ll sum=0;
for(int i=0;i<n;i++)
{
    cin>>arr[i];
    sum+=arr[i];
}
ll dp[n+5][n+5][2];
for(int i=0;i<n;i++)
{
    dp[i][i][0]=arr[i];
    dp[i][i][1]=0;
}
for(int i=1;i<n;i++)
{
    for(int j=0;j+i<n;j++)
    {
        int l=j;int r=j+i;
        dp[l][r][0]=max(arr[l]+dp[l+1][r][1],arr[r]+dp[l][r-1][1]);
        dp[l][r][1]=min(dp[l+1][r][0],dp[l][r-1][0]);
    }
}

ll ans=2*dp[0][n-1][0]-sum;

cout<<ans<<endl;


}
    return 0;
}


//code.end();





Measured memory_bytes: 85368
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define lli int
void solve(){
  int d, t, s;
  cin>>d>>t>>s;
  t*s>=d?cout<<"Yes"<<endl:cout<<"No"<<endl;
}
signed main(){
  // int t;
  // cin>>t;
  // while(t--)
  solve();
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n);++i)
using namespace std;
using ll = long long; 
using P = pair<int,int>;
using vv = vector<vector<ll>>;
template <class _t> inline bool chmax (_t& a,_t b){if(a<b){a=b;return true;}return false;} template <class _t> inline bool chmin (_t& a,_t b){if(a>b){a=b;return true;}return false;}

const long long inf = 1ll << 60;
const long long mod = 1000000007;

int dx[4] = {1,0,-1,0};int dy[4] = {0,-1,0,1};
using Graph = vector<vector<int> >;

int main() {
    int h,w;cin >> h >> w;
    vector<string> S(h);
    for(int i=0;i<h;i++){
	string s; cin >> s;
	S[i] = s;
    }
    int ans = 0;
    for(int i=0;i<h;i++){
	for(int j=0;j<w;j++){
	    queue<P> que;
	    if(S[i][j]=='#')continue;
	    vector<vector<int> >dist(h,vector<int>(w,-1));
	    que.push(make_pair(i,j));
	    dist[i][j] = 0;
	    int tmp = 0;
	    while(!que.empty()){
		P v = que.front();que.pop();
		for(int k=0;k<4;k++){
		    int di = v.first + dx[k];
		    int dj = v.second + dy[k];
		    if(di < 0 || dj < 0 || h<= di || w <= dj) continue;
		    if(S[di][dj] == '#') continue;
		    if(dist[di][dj]==-1){
			dist[di][dj] = dist[v.first][v.second] + 1;
			tmp = max(tmp,dist[di][dj]);
			que.push(make_pair(di,dj));
		    }
		}
	    }
	    ans = max(ans,tmp); 
	}
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main() {

    int A;
    int B;

    cin >> A >> B;

    int cnt = 0;
    int m = 1;

    while (m < B) {
        m += (A - 1);
        cnt += 1;
    }

    cout << cnt << endl;

    return 0;
}


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

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n, k = rli()
    if k == 0:
        print(n*n)
        return
    ans = 0
    for b in range(1, n+1):
        if b <= k:
            continue
        ans += (n // b)*(b-k)
        ans += max(0, n%b-k+1)
    print(ans)


if __name__ == '__main__':
    main()


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

int main(void)
{
  int a,b;
  cin>>a>>b;
  if(a==b)
    cout<<a+b<<endl;
  else if(a>b)
    cout<<a+a-1<<endl;
  else if(b>a)
    cout<<b+b-1<<endl;
}

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

int main(void){
  int i;
  char s[3];
  
  for(i = 0; i < 3; i++)
    cin >> s[i];
  
  if(s[0] != s[1] || s[1] != s[2] )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
int main() {
  int A,B,C;
  cin >> A >> B >> C;
  if(A == B){
    cout << C;
  }
  else if(B == C){
    cout << A;
  }
  else{
    cout << B;
  }
}

Measured memory_bytes: 256
//***********************
//Author:kibi11
//Quarantine Days
//***********************

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define fr(i, n) for(int i = 0; i < n; i++)
#define fr1(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,k) for(int i=a;i>=k;i--)
#define same int t;cin>>t;while(t--)
#define check(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define f first
#define s second
#define XOX

//////////////////////////////////////////////////////////////////////////
/////////////////DEBUGING ZONE//////////////////////////////

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
///////////////////////////////////////////////////////////////////////////
 
ll powermod(ll base, ll exp, ll mod) {
	ll result = 1;
	while (exp != 0) {
		if ((exp % 2) == 1) {
			result = (result * base) % mod;
		}
		base = (base * base) % mod;
		exp /= 2;
	}
	return result;
}

///////////////////////////////////////////////////////////////////////////
//Fuctions if any:





///////////////////////////////////////////////////////////////////////////
int main() 
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt = clock();
//ios_base& scientific (ios_base& str);

int n;
cin>>n;
std::set<int > hon({2,4,5,7,9});
std::set<int > pon({0,1,6,8});
std::set<int > bon({3});
if(hon.count(n%10))
{
	cout<<"hon"<<endl;
}

else if(pon.count(n%10))
{
	cout<<"pon"<<endl;
}

else if(bon.count(n%10))
{
	cout<<"bon"<<endl;
}
cerr << "TIME = " << (double) 1.0 * (clock() - tt) / CLOCKS_PER_SEC << " seconds" << endl;
return 0;
}

Measured memory_bytes: 3804
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int N;

int main() {
  cin >> N;
  long long A = 1, B = 1;
  for (int i=0; i<N; i++) {
    long long a, b;
    cin >> a >> b;
    long long g;
    if (a >= A && b >= B) g = 1;
    else if (a < A && b < B) {
      g = max(
        (A / a) + (A % a == 0 ? 0 : 1),
        (B / b) + (B % b == 0 ? 0 : 1)
      );
    }
    else if (a < A) {
      g = (A / a) + (A % a == 0 ? 0 : 1);
    }
    else if (b < B) {
      g = (B / b) + (B % b == 0 ? 0 : 1);
    }
    a *= g;
    b *= g;
    A = a;
    B = b;
  }
  cout << A + B << "\n";
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M;cin>>N>>M;vector<int>A(M),B(M-1);long long V=0;
  if(N>=M){
    cout<<0<<endl;return 0;
  }
  for(int X=0;X<M;X++){
    cin>>A[X];
  }
  sort(A.begin(),A.end());V=A[M-1]-A[0];
  for(int X=0;X<M;X++){
    if(X!=0){
      B[X-1]=A[X]-A[X-1];
    }
  }
  sort(B.begin(),B.end());
  reverse(B.begin(),B.end());
  for(int X=0;X<N-1;X++){
    V-=B[X];
  }
  cout<<V<<endl;
}

Measured memory_bytes: 3956
from collections import deque
n = int(input())
Ps = list(map(lambda x: int(x)-1, input().split()))
cost = [min(i, n-1-i, j, n-1-j) for i in range(n) for j in range(n)]
exist = [1]*(n**2)


def to_idx(p):
    return divmod(p, n)


def to_v(i, j):
    return i*n+j


def bfs(init_v):
    next_v = deque([init_v])
    exist[init_v] = 0
    while next_v:
        v = next_v.popleft()
        i, j = to_idx(v)
        if 0 < i:
            v2 = v-n
            if cost[v2] > cost[v]+exist[v]:
                cost[v2] = cost[v]+exist[v]
                next_v.append(v2)

        if i < n-1:
            v2 = v+n
            if cost[v2] > cost[v]+exist[v]:
                cost[v2] = cost[v]+exist[v]
                next_v.append(v2)

        if 0 < j:
            v2 = v-1
            if cost[v2] > cost[v]+exist[v]:
                cost[v2] = cost[v]+exist[v]
                next_v.append(v2)

        if j < n-1:
            v2 = v+1
            if cost[v2] > cost[v]+exist[v]:
                cost[v2] = cost[v]+exist[v]
                next_v.append(v2)

ans = 0
for p in Ps:
    ans += cost[p]
    bfs(p)
print(ans)

Measured memory_bytes: 129544
#include<iostream>
using namespace std;
int N,cnt;
int tmp[1000001];
int main(){
    cin>>N;
    for(int A=1;A<=1000000;A++){
        for(int B=1;A*B<=1000000;B++){
            tmp[A*B]++;
        }
    }
    
    for(int C=1;C<=N;C++){
        int n=N-C;
        cnt+=tmp[n];
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 7524
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    ll ans = 0, l = h2 * 60 + m2;
    bool flag = false;
    for (int i = h1; i <= h2; i++) {
        for (int j = (i == h1 ? m1 : 0); j <= (i == h2 ? m2 : 59); j++) {
            ll t = i * 60 + j + k;
            if (t > l) {
                flag = true;
                break;
            }
            ans++;
        }
        if (flag) break;
    }
    cout << ans - 1 << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int i=0; i<n; i++)
#define REP2(i, a, b) for(int i=a; i<b; i++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

long long N, M, V, P;
bool check(vector<long long> A, int x){
    A[x] += M;
    long long cnt = (V-1)*M;
    int ex = 0;
    for(int i=N-1; i>=0; i--){
        if(i == x) continue;
        if(A[i] > A[x]){
            A[i] += M;
            cnt -= M;
            ex++;
        }else{
            if(ex < P-1){
                A[i] += M;
                cnt -= M;
                ex++;
            }else{
                long long tmp = min(M, A[x]-A[i]);
                A[i] += tmp;
                cnt -= tmp;
            }
        }
    }
    if(cnt <= 0 && ex < P) return true;
    return false;
}

int main(){
    cin >> N >> M >> V >> P;
    vector<long long> A(N);
    REP(i, N)
        cin >> A[i];

    sort(A.begin(), A.end());
    if(check(A, 0)) {
        cout << N << endl;
        return 0;
    }
    long long ub = N-1;
    long long lb = 0;
    while(ub - lb > 1){
        long long mid = (ub + lb) / 2;
        if(check(A, mid)) ub = mid;
        else lb = mid;
    }
    long long ans = N - ub;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1920
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    a, b, k = LI()
    for i in range(k):
        if i & 1:
            b = b // 2
            a += b
        else:
            a = a // 2
            b += a
    print(a,b)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 39024
#include <iostream>
#include <algorithm>
#include<vector>
#include <queue>
#include<string>
using namespace std;
const int INF = 1000000000;

int main()
{

	long long n;
	int a;
	int k=0;
	int ans = 0;
	int old = -1;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		if (old >= a) { 
			k++; 
			if (k > ans)ans = k;
		}
		else {
			k = 0;
		}
		old = a;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int D[7],i,j,n,t,f,T,F;
    for(i=1;i<=6;i++){
    	scanf("%d",&D[i]);
    }
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d %d",&T,&F);
        for(j=1;j<=6;j++){if(T==D[j])t=j;}
        for(j=1;j<=6;j++){if(F==D[j])f=j;}
        switch(t){
            case 1:switch(f){
                case 2:printf("%d\n",D[3]);break;
                case 3:printf("%d\n",D[5]);break;
                case 4:printf("%d\n",D[2]);break;
                case 5:printf("%d\n",D[4]);break;
            }break;
            case 2:switch(f){
                case 1:printf("%d\n",D[4]);break;
                case 3:printf("%d\n",D[1]);break;
                case 4:printf("%d\n",D[6]);break;
                case 6:printf("%d\n",D[3]);break;
            }break;
            case 3:switch(f){
                case 1:printf("%d\n",D[2]);break;
                case 2:printf("%d\n",D[6]);break;
                case 5:printf("%d\n",D[1]);break;
                case 6:printf("%d\n",D[5]);break;
            }break;
            case 4:switch(f){
                case 1:printf("%d\n",D[5]);break;
                case 2:printf("%d\n",D[1]);break;
                case 5:printf("%d\n",D[6]);break;
                case 6:printf("%d\n",D[2]);break;
            }break;
            case 5:switch(f){
                case 1:printf("%d\n",D[3]);break;
                case 3:printf("%d\n",D[6]);break;
                case 4:printf("%d\n",D[1]);break;
                case 6:printf("%d\n",D[4]);break;
            }break;
            case 6:switch(f){
                case 2:printf("%d\n",D[4]);break;
                case 3:printf("%d\n",D[2]);break;
                case 4:printf("%d\n",D[5]);break;
                case 5:printf("%d\n",D[3]);break;
            }break;
        }
    }
    return 0;
}

Measured memory_bytes: 596
number = int(input())
dicesList = []
for n in range(number):
  dicesList.append(list(input().split()))
doubletNumber = 0
for dices in dicesList:
  if dices[0] == dices[1]:
    doubletNumber += 1
  else:
    doubletNumber = 0
  if doubletNumber == 3:
    break
if doubletNumber == 3:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9176