akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;

namespace dp_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var dp = new long[100010].Select(x => 9223372036854775807).ToArray();
            dp[0] = 0;

            var n = int.Parse(Console.ReadLine());
            var h = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();

            for(int i = 1; i < n; i++){
                dp[i] = Math.Min(dp[i], dp[i-1] + Math.Abs(h[i] - h[i-1]));
                if(i > 1){
                    dp[i] = Math.Min(dp[i], dp[i-2] + Math.Abs(h[i] - h[i-2]));
                }
            }
            Console.WriteLine(dp[n-1]);
        }
    }
}


Measured memory_bytes: 22240
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, r, p, c;
        while(true){
            n = sc.nextInt();
            r = sc.nextInt();
            if (n == 0 && r == 0) break;
            int deck[] = new int[n];
            int tmp[] = new int[n];
            for (int i = 0; i < n; i++) deck[i] = n - i;
            for (int i = 0; i < r; i++){
                p = sc.nextInt();
                c = sc.nextInt();
                System.arraycopy(deck,p-1, tmp,0, c);
                System.arraycopy(deck,0, deck, c, p-1);
                System.arraycopy(tmp,0, deck,0, c);
            }
            System.out.println(deck[0]);
        }
    }
}

Measured memory_bytes: 37440
#include <stdio.h>
int main(void){
	int n;
	scanf("%d",&n);
	int i;
	int ans = 0;
	int a[n];
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		while( a[i]%2 == 0){
			ans ++;
			a[i]/=2;
		}
	}
	printf("%d",ans);
	return 0;
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 200005;
int N;
int A[MAX_N];

signed main()
{
  cin >> N;
  REP(n,N) {
    cin >> A[n];
  }

  int ans = 0;
  int pos = 1;

  REP(n,N) {
    if(pos == A[n]) {
      pos++;
    } else {
      ans++;
    }
  }

  if(pos == 1) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int):
    g = gcd(N, 2)
    return N * 2 // g


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
    result = solve(N)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5140
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;
const int MAX_V = 300000;

int m, n;
struct Flow{
    struct edge{
        int to, cap, rev;
    };
    vector<edge> G[MAX_V];//??£??\?????????
    bool used[MAX_V];

    void add_edge(int from, int to, int cap){
        G[from].push_back((edge){to, cap, (int)G[to].size()});//from -> to
        G[to].push_back((edge){from, 0, (int)G[from].size() - 1});//to -> from
    }

    //?¢???????????????¢???
    int dfs(int v, int t, int f){
        if(v == t) return f;
        used[v] = true;
        for (int i = 0; i < G[v].size(); ++i){
            edge &e = G[v][i];
            if(!used[e.to] && e.cap > 0){
                int d = dfs(e.to, t, min(f, e.cap));
                if(d > 0){
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
    //s??????t???????????§???
    int max_flow(int s, int t){
        int flow = 0;
        while(1){
            memset(used, 0, sizeof(used));
            int f = dfs(s, t, INF);
            if(f == 0) return flow;
            flow += f;
        }
    }
};

int b[510], r[510];
int main(void){
	while(1){
        cin >> m >> n;
        if(m == 0 && n == 0) return 0;
        rep(i, m) cin >> b[i];
        rep(i, n) cin >> r[i];
        int s = m + n, t = m + n + 1;
        Flow mf;
        //s -> b
        rep(i, m){
            mf.add_edge(s, i, 1);
        }
        //r -> t
        rep(i, n){
            mf.add_edge(m + i, t, 1);
        }
        //b -> r
        rep(i, m)rep(j, n){
            if(__gcd(b[i], r[j]) > 1){//1??\???????´???°?????????
                mf.add_edge(i, m + j, 1);
            }
        }
        printf("%d\n", mf.max_flow(s, t));
    }
}

Measured memory_bytes: 14828
#include<iostream>

using namespace std;

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

	int n,k;
	cin >> n >> k;
	int freq[n] = {0};
	for(int i=0; i<k; i++){
		int d;
		cin >> d;
		for(int i=0; i<d; i++){
			int snuke;
			cin >> snuke;
			freq[snuke-1]++;
		}
	}
	
	int ans = 0;
	for(int i=0; i<n; i++){
		if(freq[i]==0) ans++;
	}
	cout << ans;
	return 0;
}

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

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << "\t|";
    __f(comma + 1, args...);
}


#define print(x) for(auto it : x) cout<< it << ' '; cout << '\n';
typedef long long ll;
typedef unsigned long long ull;

const int MOD = 1e9 + 7;
ll mod(ll a) { return (ll) (a % MOD + MOD) % MOD; }
ll mul(ll a, ll b) { return (ll) mod(mod(a) * mod(b));}


int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    vector<int> heights(n);
    for (int i = 0; i < n; i++) {
        cin >> heights[i];
    }
    
    vector<int> dp(n, INT_MAX);
    dp[0] = 0; dp[1] = abs(heights[0] - heights[1]);
    for (int i = 2; i < n; i++) {
        // frog will reach i from i - 1 OR i - 2
        dp[i] = min(abs(heights[i] - heights[i - 1]) + dp[i - 1], abs(heights[i] - heights[i - 2]) + dp[i - 2]);
    }
        
    cout << dp.back();
    return 0;
}


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

using namespace std;

#define mx 1111

int main()
{
    int n, x, t, s;

    cin >> n >> x >> t;

    s = n / x;


    if(s * x  < n)
    {
        s += 1;
    }

    cout << s * t << endl;





    return 0;
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    ll ans = 1;
    eFOR(i, 1, n)(ans *= i) %= mod;
    cout << ans << "\n";
}

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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<vector<T>> m) {
    repall (v, m)
        init(v);
}

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    int a, b;
    mat son(n + 1);

    map<int, int> mp;
    while (cin >> a >> b) {
        son[a].pb(b);
        mp[b]++;
    }

    queue<int> q;
    For(i, 1, n) if (!mp[i]) q.push(i);

    vec par(n + 1);

    while (!q.empty()) {
        int vv = q.front();
        q.pop();

        repall (i, son[vv]) {
            mp[i]--;
            par[i] = vv;
            if (!mp[i]) q.push(i);
        }
    }

    For(i, 1, n) print(par[i]);

    return 0;
}

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

#define ll long long 
 
using namespace std ;
 
int z , o , ans ;

string s ;

int main(){

	int s , w ;

	cin >> s >> w ;

	if( w >= s ){

		cout << "unsafe" << endl ;

	}

	else{

		cout << "safe" << endl ;

	}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main()
{	
	int n,a,ans=0;
	map<int,int
	>m;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		m[a]++;
	}
	for(auto i=m.begin();i!=m.end();i++)
	{
		if(i->first<i->second)ans+=i->second-i->first;
		else if(i->first>i->second)ans+=i->second;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4736
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define dump(o) { cerr << #o << " " << o << endl; }
#define dumpc(o) { cerr << #o; for (auto &e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

const int MAX = 50 * 50 + 1;

signed main() {
	int N, A; cin >> N >> A;
	vector<int> x(N);
	ll dp[51][MAX] = {};
	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		cin >> x[i];
		for (int j = N; j > 0; j--) {
			for (int k = MAX - 51; k >= 0; k--) {
				dp[j][k + x[i]] += dp[j - 1][k];
			}
		}
	}
	ll ans = 0;
	for (int i = 1; i <= N; i++) {
		//dumpc(dp[i]);
		ans += dp[i][i*A];
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
int a,ans=0;
bool b;
string s;
while(cin>>s){
b=true;
a=s.size();
for(int i=0;2*i<a+3;i++){if(s[i]!=s[a-i-1]){b=false; break;}}
if(b)ans++;}
cout<<ans<<endl;}

Measured memory_bytes: 1184
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>
#include <numeric>
#include <iomanip>

using namespace std;

int main() {
    int M1, M2, D1, D2;
    cin >> M1 >> D1;
    cin >> M2 >> D2;

    vector<int> vec = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    if (vec[M1 - 1] == D1)
    {
        cout << 1 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pii pair<int,int>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define vi vector<ll>
#define all(x) x.begin(),x.end()
#define show(x) cerr<<#x<<" is: "<<x<<endl;
#define sout(x) cout<<#x<<" is: "<<x<<endl;
#define countBits(x) __builtin_popcount(x)
#define mt make_tuple
#define eb emplace_back
#define pob pop_back
#define star(x) cout<<"********** "<<x<<" **********"<<endl;
#define yes cout<<"YES"<<endl; return;
#define no cout<<"NO"<<endl; return;
#define flus fflush(stdin); fflush(stdout);
#define F first
#define S second
#define np next_permutation
#define prio priority_queue
#define greatPrio priority_queue <ll, vector<ll>, greater<ll>>
#define inf 1e9
#define mod 1000000007
#define N 200100

void solve(){
	ll x,n;
	cin>>x>>n;
	set<int> s;
	rep(i,0,n){
		int temp;
		cin>>temp;
		s.insert(temp);
	}
	ll dif=inf;
	ll ans=-100;
	for(ll i=-100;i<=200;i++){
		if(s.find(i)==s.end() and abs(x-i)<dif){
			ans=i;
			dif=abs(x-i);
		}
	}
	cout<<ans<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	// cin>>t;
	t=1;
	while(t--){
		solve();
	}
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n\n";
}

Measured memory_bytes: 3664
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N, H, W;
	cin >> N >> H >> W;
	vector<int> X(N), Y(N), A(N);
	for (int i = 0; i < N; ++i) {
		cin >> X[i] >> Y[i] >> A[i]; --X[i], --Y[i];
	}
	vector<int> perm(N);
	for (int i = 0; i < N; ++i) {
		perm[i] = i;
	}
	sort(perm.begin(), perm.end(), [&](int i, int j) {
		return A[i] > A[j];
	});
	vector<vector<int> > g(H + W);
	vector<int> group(H + W);
	vector<bool> cycle(H + W);
	for (int i = 0; i < H + W; ++i) {
		g[i] = { i };
		group[i] = i;
		cycle[i] = false;
	}
	long long ans = 0;
	for (int i : perm) {
		int va = group[X[i]], vb = group[Y[i] + H];
		if (va == vb && !cycle[va]) {
			cycle[va] = true;
			ans += A[i];
		}
		if (va != vb) {
			if (cycle[va] && cycle[vb]) continue;
			if (g[va].size() < g[vb].size()) swap(va, vb);
			g[va].insert(g[va].end(), g[vb].begin(), g[vb].end());
			for (int i : g[vb]) group[i] = va;
			if (cycle[vb]) cycle[va] = true;
			g[vb].clear();
			ans += A[i];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 17020
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input! {h:usize, w:usize, s:[chars; h]};
    let mut cnt:Vec<Vec<i32>> = vec![vec![0; w]; h];
    for i in 0..h {
        for j in 0..w {
            if s[i][j] == '#' {
                for y in -1..2 {
                    for x in -1..2 {
                        let i = i as i32;
                        let j = j as i32;
                        if i+y < 0 || i+y >= h as i32 {continue;}
                        if j+x < 0 || j+x >= w as i32 {continue;}
                        cnt[(i+y) as usize][(j+x) as usize] += 1;
                    }
                }
            }
        }
    }

    for i in 0..h {
        for j in 0..w {
            if s[i][j] == '#' {
                print!("{}", s[i][j]);
            } else {
                print!("{}", cnt[i][j]);
            }
        }
        println!("");
    }
}


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

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  if(a.at(a.size()-1)==b.at(0)&&b.at(b.size()-1)==c.at(0)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define scani(x) scanf("%d",&x)
#define scanc(x) scanf("%s",x)
#define printi(x) printf("%d",x)
#define printin(x) printf("%d\n",x)
#define printd(x) printf("%.8f",x)
#define printc(x) printf("%s",x)
#define repd(i,n,m) for(int i = n; i > m; i--)
#define repu(i,n,m) for(int i = n; i < m; i++)
#define allprintu(i,n,m,a) for(int i = n; i < m; i++){if(i != m-1){printf("%d ",a[i]);}else{printf("%d\n",a[i]);}}
#define allprintd(i,n,m,a) for(int i = n; i > m; i--){if(i != 0){printf("%d ",a[i]);}else{printf("%d\n",a[i]);}}

#define MAX 200000
#define LIMIT pow(10,9)+1
int n;
int a[MAX];

long long int merge(int A[],int n, int left, int mid, int right){
	long long int cnt = 0;
	int n1 = mid - left, n2 = right - mid;
	int *L = (int*)malloc(sizeof(int)*(n1+1));
	int *R = (int*)malloc(sizeof(int)*(n2+1));
	repu(i,0,n1){
		L[i] = A[left + i];
	}
	repu(i,0,n2){
		R[i] = A[mid + i];
	}
	L[n1] = R[n2] = LIMIT;
	int i = 0;
	int j = 0;
	repu(k,left,right){
		if(L[i] <= R[j]){
			A[k] = L[i];
			i = i + 1;
		}else{
			A[k] = R[j];
			j = j + 1;
			cnt += n1 - i;
		}
	}
	free(L);
	free(R);
	return cnt;
}

long long int mergeSort(int A[], int n, int left, int right){
	long long int v1, v2, v3;
	if( left + 1 < right){
		int mid = (left+right)/2;
		v1 = mergeSort(A,n,left,mid);
		v2 = mergeSort(A,n,mid,right);
		v3 = merge(A,n,left, mid, right);
		return v1 + v2 + v3;
	}else{
		return 0;
	}
}
int main(void){
	scani(n);
	repu(i,0,n){
		scani(a[i]);
	}
	printf("%llu\n",mergeSort(a,n,0,n));
}



Measured memory_bytes: 3024
#include<stdio.h>

int main(void)
{
	int in[1000];
	int out[1000];
	int q;
	int n1 = 0;
	int n2 = 0;
	int i;
	
	while (scanf("%d", &q) != EOF) {
		if (q > 0 && q <= 10) {
			in[n1] = q;
			n1++;
		}
		
		else if(q == 0) {
			n1--;
			out[n2] = in[n1];
			n2++;
		}
	} 
	
	for (i = 0; i < n2; i++) {
		printf("%d\n", out[i]);
	}
	
	return (0);
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
ofstream fo("output.out");
#define fast() {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define out(a) { fo << #a << ":" << (a) <<" ";}
#define outv(a) { fo << "["; \
	for(int i = 0; i < (a).size(); ++i){ \
		fo << i <<":" << a[i] <<" "; \
		if(i % 10 == 9) fo <<"\n"; \
		} \
	fo << "]"; \
}
#define outvv(a) { fo << "["; \
	for(int i = 0; i < a.size(); ++i){ \
		for(int j = 0; j < a[i].size(); ++j){ \
			fo << "(" << i <<"," <<j <<")" <<":" << a[i][j] <<" "; \
		} \
		fo << "\n"; \
	} \
	fo << "]"; \
}
#define outp(a) { fo <<"[" << #a << ".fi:"<<a.first; \
					fo << " "<< #a << ".se:" << a.second <<"]"; }
using ll = long long;
const ll INF = 1e18L + 5;
int main()
{
    fast();
    int n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; ++i){
		cin >> a[i];
	}
	vector<vector<ll>> dp(n + 1, vector<ll>(n + 1, INF));
	// 0 -> R
	vector<ll> sum(n + 1, 0);
	for(int i = 1; i <= n; ++i){
		sum[i] += a[i - 1];
		sum[i] += sum[i - 1];
	}
	outv(sum)
	int L = 0;
	for(int R = 0; R < n; ++R){
		for(int L = R; L >= 0; --L){
			if(L == R) dp[L][R] = 0;
			else{
				for(int i = L; i <= R - 1; ++i){
					dp[L][R] = min(dp[L][R], dp[L][i] + dp[i+1][R]\
						+ sum[R + 1] - sum[L + 1 - 1]);
				}
			}
		}
	}
	cout << dp[0][n - 1];
}

Measured memory_bytes: 1536
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    string s;
    cin>>s;
    reverse(s.begin(),s.end());

    string s1,s2,s3,s4;
    s1="maerd";
    s2="remaerd";
    s3="esare";
    s4="resare";
    
    int i,n=0;
    int N=s.length();

    while(n<N){
        if(s[n]==s1[0]&&s[n+1]==s1[1]&&s[n+2]==s1[2]&&s[n+3]==s1[3]&&s[n+4]==s1[4])i=5;
        else if(s[n]==s2[0]&&s[n+1]==s2[1]&&s[n+2]==s2[2]&&s[n+3]==s2[3]&&s[n+4]==s2[4]&&s[n+5]==s2[5]&&s[n+6]==s2[6])i=7;
        else if(s[n]==s3[0]&&s[n+1]==s3[1]&&s[n+2]==s3[2]&&s[n+3]==s3[3]&&s[n+4]==s3[4])i=5;
        else if(s[n]==s4[0]&&s[n+1]==s4[1]&&s[n+2]==s4[2]&&s[n+3]==s4[3]&&s[n+4]==s4[4]&&s[n+5]==s4[5])i=6;
        else {
            cout<<"NO"<<endl;
            goto lol;
        }
        n+=i;
    }
    
    cout<<"YES"<<endl;
    lol:
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long sum = 0;

		int n = sc.nextInt();
		// int num = 0;
		int[] arr = new int[n];
		long check = (long) n * (long) (n + 1) / 2L;

		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
			sum += arr[i];
		}

		if (sum % check != 0) {
			System.out.println("NO");
			return;
		}

		long k = sum / check;
		long s = 0;
		for (int i = 0; i < n; i++) {
			int current = arr[i];
			int next = arr[(i + 1) % n];
			long diff = next - current;
			if ((k - diff) % n != 0 || diff > k) {
				System.out.println("NO");
				return;
			}
			s += (k - diff) / n;
		}

		if (s != k) {

			System.out.println("NO");
			return;
		}

		System.out.println("YES");
	}
}


Measured memory_bytes: 33264
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
/*        string[] input = ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
//        int a = int.Parse(input[2]);
//        int b = int.Parse(input[3]);*/
//        string temp = ReadLine();
//        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        int c = int.Parse(ReadLine());
//        int d = int.Parse(ReadLine());
        string a = ReadLine();
//        string b = ReadLine();
//        string c = ReadLine();
//        string ko = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        int count = 0;
        for(int i=0;i<a.Length;i++){
            if(count == 0 && a[i] == 'C'){
                count++;
            }
            if(count == 1 && a[i] == 'F'){
                count++;
            }
        }
        if(count == 2){
            WriteLine("Yes");
        }else{
            WriteLine("No");
        }
    }
}

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

using namespace std;

enum {
      LEFT,
      RIGHT,
};

int main()
{
  char key_right[] = { 'y', 'u', 'i', 'o', 'p',
                     'h', 'j', 'k', 'l', 'n', 'm' };

  while (1) {
    int last_status = -1;
    int count = 0;
    string str;
    cin >> str;
    cin.ignore();
    if (str == "#") break;
    for (auto s : str) {
      int status = LEFT;
      for (auto key : key_right) {
        if (s == key) {
          status = RIGHT;
          break;
        }
      }
      if (last_status != -1 && last_status != status) {
        count++;
      }
      last_status = status;
    }
    cout << count << endl;
  }
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
int x,ans;
string s;
int main(){
    cin>>s;
    for(char c:s){
        if(c=='p'){
            // p vs g
            if(x<=0)ans--,x++;
            // p vs p
            else x--;
        }
        else{
            // g vs g
            if(x<=0)x++;
            // g vs p
            else x--,ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a,d;
  int b[1000000],c[1000000];
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b[i];
    c[i]=b[i];
  }
  sort(b,b+a,greater<int>());
  for(int i=0;i<a;i++){
    d=0;
    if(b[0]!=c[i]){
      cout<<b[0]<<"\n";
      d=1;
    }
    if(b[0]==c[i]&&d==0||b[0]==c[i]){
      cout<<b[1]<<"\n";
    }
  }
  return(0);
}


Measured memory_bytes: 8064
#include <string>
#include <iostream>
#include <vector>
#include <set>
#include <cstdlib>
#include <algorithm>
#include <cctype>

using namespace std;

template <typename T_char>
T_char ToUpper (T_char cX) { return toupper(cX); }  // テンプレート関数として ToUpper を定義する。

int main() {

   string n;
   string m;
   string l;
   cin >> n >> m >> l;
   

    transform(n.begin(), n.end(), n.begin(), ToUpper<char>);
    transform(m.begin(), m.end(), m.begin(), ToUpper<char>);
    transform(l.begin(), l.end(), l.begin(), ToUpper<char>);
   
    
  cout << n[0] << m[0] << l[0] <<endl;

  
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define print(obj) cout << obj << endl
#define scan(obj) cin >> obj

typedef long long ll;

using namespace std;

int main(void){
    int n, h, w, ans;
    cin >> n;
    cin >> h;
    cin >> w;
    ans = (n - h + 1) * (n - w + 1);
    print(ans);
}

Measured memory_bytes: 256
h,w,d=map(int,input().split())
field=[[]]*(h*w)
for i in range(h):
	x=list(map(int,input().split()))
	for j in range(w):
		field[x[j]-1]=[i,j]
dis=[10**20]*(h*w)
for i in range(d):
	dis[i]=0
for i in range((h*w)):
	if i>=d:
		dis[i]=dis[i-d]+abs(field[i][0]-field[i-d][0])\
		+abs(field[i][1]-field[i-d][1])
q=int(input())
for i in range(q):
	l,r=map(int,input().split())
	print(dis[r-1]-dis[l-1])

Measured memory_bytes: 17128
fun main (args : Array<String>) {
	val n = readLine()!!
	val N : Int = n.toInt()
	for (i in 1..9) {
		for (j in 1..9) {
			if (N == (i * j)) {
				return println("Yes")
			}
		}
	}
	return println("No")
}

Measured memory_bytes: 31748
// by syu
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var in = NewScanner(os.Stdin, 16777216)

func main() {
	N, K := in.Int(), in.Int()
	x := in.ArrayInt(N)
	min := math.MaxInt64
	for i := 0; i < N-K+1; i++ {
		a, b := x[i], x[i+K-1]
		sum := Min(Abs(a), Abs(b))
		sum += b - a
		if sum < min {
			min = sum
		}
	}
	Pln(min)
}

type Scanner struct {
	*bufio.Scanner
}

func NewScanner(r io.Reader, max int) *Scanner {
	s := bufio.NewScanner(r)
	s.Split(scanWords)
	if max <= 0 {
		max = 1048576
	}
	s.Buffer([]byte{}, max)
	return &Scanner{s}
}
func (s *Scanner) Int() int {
	s.Scan()
	i, e := strconv.ParseInt(s.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}
func (s *Scanner) ArrayInt(n int) (r []int) {
	for i := 0; i < n; i++ {
		r = append(r, s.Int())
	}
	return
}
func isSpace(b byte) bool {
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}
func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	start := 0
	for start < len(data) && isSpace(data[start]) {
		start++
	}
	for i := start; i < len(data); i++ {
		if isSpace(data[i]) {
			return i + 1, data[start:i], nil
		}
	}
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	return start, nil, nil
}
func Min(arr ...int) (r int) {
	r = arr[0]
	for _, x := range arr {
		if x < r {
			r = x
		}
	}
	return
}
func Abs(n int) int {
	y := n >> 63
	return (n ^ y) - y
}
func Pln(s ...interface{}) {
	fmt.Println(s...)
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100000 + 10;
ll a[N], inf = 1e18;
int main(){
    int n; cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    ll sum = 1;
    for(int i=0;i<n;i++){
        ll x = a[i];
        if(x==0){
            sum = 0; break;
        }
        if(sum>inf/x){
            sum = -1;
            break;
        }
        else{
            sum *= x;
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 4408
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}


int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  string s;cin>>s;
  if(s=="AAA" || s=="BBB"){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
io = STDIN
n,m=io.gets.split.map(&:to_i)
$path=Hash.new{|h,k|h[k]=[]}
m.times.each do
  a,b=io.gets.split.map(&:to_i)
  $path[a]<<b
  $path[b]<<a
end
$flag=Array.new(n+1)

def bfs
  que=[1]
  while(nd=que.shift)
    $path[nd].each do |to|
      next if $flag[to]
      $flag[to]=nd
      que<<to
    end
  end
end
bfs
if $flag[2..-1].include? nil
  puts 'No'
else
  puts 'Yes'
  puts $flag[2..-1]
end


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

using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    vector<long long> a(n),dp(n,0);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=1;i<n;i++){
        long long mini=dp[i-1]+abs(a[i-1]-a[i]);
        for(int j=i-1;j>=0 && i-j<=k;j--){
            if(dp[j]+abs(a[j]-a[i]) < mini){
                mini=dp[j]+abs(a[j]-a[i]);
            }
        }
        //cout<<mini<<"\n";
        dp[i]=mini;
    }
    cout<<dp[n-1]<<"\n";
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    //long long double N;
    long long m[6];
    //cin >> N;
    long long  i;
    long long ans=0;
    long long min;
    for(i=0;i<6;i++)
    {
        cin >> m[i];
    }
    sort(m+1,m+6);
    
    ans += 5 + m[0]/m[1];
    if(m[0]%m[1]==0){ans--;}
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <stack>
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
  string word;
  stack<int> S;
  while(cin >> word) {
    if (word == "+") {
      int n = S.top(); S.pop();
      n += S.top(); S.pop();
      S.push(n);
    }
    else if (word == "-") {
      int n = -S.top(); S.pop();
      n += S.top(); S.pop();
      S.push(n);
    }
    else if (word == "*") {
      int n = S.top(); S.pop();
      n *= S.top(); S.pop();
      S.push(n);
    }
    else {
      S.push(atoi(word.c_str()));
    }
  }
  cout << S.top() << endl;
}

Measured memory_bytes: 3196
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#define endl "\n"
#define ll long long
using namespace std;

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

    ll amount = 100;
    ll count = 0;
    while(amount < x)
    {
    	amount = amount + amount / 100;
    	count ++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3636
S = input()
a = S[:2]
b = S[2:]
ans = ""
if 1<=int(a)<=12: ans += "MM"
else: ans += "YY"
if 1<=int(b)<=12: ans += "MM"
else: ans += "YY"

if ans in ["YYMM", "MMYY"]: print(ans)
elif ans == "MMMM": print("AMBIGUOUS")
else: print("NA")

Measured memory_bytes: 3060
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }

int fill_field(vector<vector<char>>& field, int X, char t, int r_s) {
    int r = r_s;
    int c = 0;
    rep(i, X) {
        field[r][c] = t;
        if (c + 2 < 100) c += 2;
        else {
            r+=2;
            c = 0;
        }
    }
    return r + 2;
}

int main() {
    int A, B;
    cin >> A >> B;
    vector<vector<char>> field1(100, vector<char>(100, '#'));
    vector<vector<char>> field2(100, vector<char>(100, '.'));
    int Ah = fill_field(field1, A - 1, '.', 0);
    int Bh = fill_field(field2, B - 1, '#', 1) - 1;
    cout << Ah + Bh << " " << 100 << endl;
    rep(i, Ah) {
        rep(j, 100) {
            cout << field1[i][j];
        }
        cout << endl;
    }
    rep(i, Bh) {
        rep(j, 100) {
            cout << field2[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, K) = readIntList()
    val (R, S, P) = readIntList()
    val T = readString()
    var ans = 0
    for (k in 0 until K) {
        var pre = 'x'
        for (n in k until N step K) {
            val t = T[n]
            if (t == pre) {
                pre = 'x'
                continue
            }
            ans += when (t) {
                'r'  -> P
                'p'  -> S
                's'  -> R
                else -> 0
            }
            pre = t
        }
    }

    println(ans)
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 41380
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	s, _ := r.ReadString('\n')
	s = strings.TrimRight(s, " \t\n")
	n, _ := strconv.Atoi(s)

	switch n % 10 {
	case 2, 4, 5, 7, 9:
		fmt.Println("hon")
	case 0, 1, 6, 8:
		fmt.Println("pon")
	case 3:
		fmt.Println("bon")
	}
}


Measured memory_bytes: 1772
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
 
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
 
using namespace std;
 
using ll = long long;
using ld = long double;
 
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }
 
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }
 
template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}
 
struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};
 
void solve(ll N, ll M) {
  cout << (ll(M * 1900 + (N - M) * 100) << int(M)) << endl;;
}
 
int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	ll M;
	scanf("%lld", &N);
	scanf("%lld", &M);
	solve(N, M);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
namespace io{
    #define re register
    #define ll long long
    #define inf 0x3f3f3f3f
    #define il inline 
    #define in1(a) read(a)
    #define in2(a,b) in1(a),in1(b)
    #define in3(a,b,c) in2(a,b),in1(c)
    #define in4(a,b,c,d) in2(a,b),in2(c,d)
    il void readl(ll &x){
        x=0;ll f=1;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
        x*=f;
    }
    il void read(int &x){
        x=0;int f=1;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
        x*=f;
    }
}using namespace io;
#define N 100005
int n;
map<ll,ll> mp;
char s[15];
int a[30];
int main(){
	ll ans=0;
	read(n);
	for(re int i=1;i<=n;i++){
		memset(a,0,sizeof(a));
		scanf(" %s",s);
		int len=strlen(s);
		for(re int j=0;j<len;j++) a[s[j]-'a']++;
		ll x=0;
		for(re int j=0;j<25;j++) x=x*10+a[j];
		ll t=mp[x];
		mp[x]++;
		ans+=t;
	}
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using i64 = int64_t;

int main()
{
    int n, k;
    cin >> n >> k;

    n--;
    k--;
    cout << n / k + !!(n % k) << endl;
}


Measured memory_bytes: 256
def solve(string):
    import numpy
    from itertools import product
    n, m, x, *ca = map(int, string.split())
    ca = numpy.array(ca).reshape((-1, m + 1)).T
    c, a = ca[0], ca[1:]
    ans = n * 10**5 + 1
    for b in product([0, 1], repeat=n):
        b = numpy.array(b)
        if (a @ b.T).min() >= x:
            ans = min(ans, c @ b.T)
    return str(ans if ans <= n * 10**5 else -1)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 27292
/*
❤️❤️❤️I_love_QMsh❤️❤️❤️
*/



#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>


#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define x first
#define y second

using namespace std;
using namespace __gnu_pbds; // gp_hash_table<int, int> table;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // <int> .find_by_order(int) .order_of_key(int)

template<typename T> bool smin(T &a, const T &b) { bool ret = b < a; return a = (ret ? b : a), ret; }
template<typename T> bool smax(T &a, const T &b) { bool ret = a < b; return a = (ret ? b : a), ret; }

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;

mt19937 rnd;

const int N = 43;
const int M = (int)1e9 + 7;

gp_hash_table<ll, int> dp;
gp_hash_table<ll, int> prv;

int get(ll x) {
  return (x ? get(x / 10) + 1 : 0);
}

signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, x, y, z;
  cin >> n >> x >> y >> z;

  vector<int> st10(n + 1);
  st10[0] = 1;
  for (int i = 1; i <= n; i++) {
    st10[i] = 1ll * st10[i - 1] * 10 % M;
  }
  vector<ll> st10l(18);
  st10l[0] = 1;
  for (int i = 1; i < 18; i++) {
    st10l[i] = st10l[i - 1] * 10;
  }

  dp[0] = 1;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    prv = dp;
    dp.clear();
    for (auto &arr : prv) {
      int csz = get(arr.first);

      for (int d = 1; d <= 10; d++) {
        ll nxtv = arr.first;
        bool empty = 0;
        nxtv = (nxtv * 10 + (d == 10 ? d - 1 : d));
        int sz = csz + 1;

        while (true) {
          int pos = 0, rem = x;
          bool ok = 1;
          for (int i = sz; i >= 1; i--) {
            int val = (nxtv / st10l[i - 1]) % 10;
            if (rem >= val) {
              rem -= val;
            } else {
              ok = 0;
            }
            if (rem == 0) {
              rem = (pos == 0 ? y : (pos == 1 ? z : -1));
              pos++;
            }
          }
          if (ok) {
            if (rem == -1) {
              ans = (ans + 1ll * arr.second * st10[n - i - 1]) % M;
            } else {
              dp[nxtv] = (dp[nxtv] + arr.second) % M;
            }
            break;
          } else {
            nxtv %= st10l[sz - 1];
            sz--;
          }
        }
      }
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 5612