akhauriyash/Code-Regression huggingface dataset:
n, k = map(int, input().split())
m = n - k
mod = 10 ** 9 + 7
def table():
    k = 2*10**5 +5 # 変える
    fac = [1]*k
    finv = [1]*k
    inv = [0]*k
    inv[1] = 1
    for i in range(2,k):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] *(mod//i) %mod
        finv[i] = finv[i-1] * inv[i] % mod
    return fac,finv
fac,finv=table()
def comb(n,k):
    if n<k:
        return 0
    if n<0 or k<0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod
for i in range(k):
    ans = comb(k - 1, i) * comb(m + 1, m - i)
    print(ans % mod)
    

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

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

const ll MOD=1e9+7;

//足し算してmodをとる
ll ad(ll x,ll y=0){
    return (x+y)%MOD;
}

//mod _mult
ll mlt(ll x,ll y){
    return (x*y)%MOD;
}

 //xのy条
ll pwr(ll x,ll n){
    ll v=1;
    while(n>0){
      if (n%2==1) v=mlt(v, x);
      x=mlt(x,x);
      n/=2;
    }
    return v;
}

 //フェルマーの小定理に夜と、　x^(mod-2)=-1
ll inv(ll x){
    return pwr(x,MOD-2);
}

 //factorial
ll fc[200010];
void fct(){
    fc[0]=1;
    for (int i=0;i<200009;++i){
      fc[i+1]=mlt(fc[i], i+1);
    }
}

 //inverse_factorial
ll ifc[200010];
void ifct(){
    ifc[200009]=inv(fc[200009]);
    for (int i=200009;i>=1;--i) ifc[i-1]=mlt(ifc[i], i);
}

ll comb(ll n,ll r){
    if(n<0 || r<0 || n<r) return 0;
    return mlt(fc[n],mlt(ifc[r],ifc[n-r]));
}

int main(){
    ll n,a,b,c,d,f;
    cin>>n>>a>>b>>c>>d;
    ll dp[1010][1010]={};
    fct();
    ifct();
    
    dp[b+1][n]=1;
    for(ll i=b;i>=a;i--){
        //cout << i << endl;
        for(int j=0;j<n+1;++j){
            dp[i][j]=ad(dp[i][j],dp[i+1][j]);
            f=1;
            for(int k=0;k++<c-1;) f=mlt(f,comb(j+k*i,i));
            for(ll k=c;k<=d;k++){
                if(j+i*k>n) break;
                f=mlt(f,comb(j+k*i,i));
                dp[i][j]=ad(dp[i][j],mlt(dp[i+1][j+i*k],mlt(f,ifc[k])));
            }
        }
    }
    /*for(int i=2;i<4;i++){
        fr(j,8) cout<<dp[i][j]<<" ";
        cout<<endl;
    }*/
    cout<<dp[a][0]<<endl;
}


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

int main()
{
  int n,k;
  cin>>n;
  int a[n][3];
  for(int i=0;i<n;i++)
      {
        cin>>a[i][0]>>a[i][1]>>a[i][2];
      }
    int dp[n][3];
    dp[0][1]=a[0][1];
    dp[0][0]=a[0][0];
    dp[0][2]=a[0][2];
  for(int i=1;i<n;i++)
  {
      dp[i][0]=a[i][0]+max(+dp[i-1][1],dp[i-1][2]);
       dp[i][1]=a[i][1]+max(+dp[i-1][0],dp[i-1][2]);
        dp[i][2]=a[i][2]+max(+dp[i-1][0],dp[i-1][1]);
  }
  cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
}
           
                                
    
  

Measured memory_bytes: 2560
// CONTEST

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

// Utility
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, X, Y) for (int I = (X); I < (Y); I++)
using ll = int64_t;
using ull = uint64_t;
namespace std {
template<class ...Ts>        istream& operator>>(istream& i, tuple<Ts...>& x) { apply([&](auto&&... ys){ ((i >> ys), ...); }, x); return i; }
template<class T1, class T2> istream& operator>>(istream& i, pair<T1, T2>& x) { i >> x.first >> x.second; return i; }
template<class T>            istream& operator>>(istream& i, vector<T>& x)    { for (auto& y : x) { i >> y; } return i; }
}

// Debugging
#define DD(X) std::cout << #X ": " << (X) << std::endl << std::flush
namespace std {
template<class ...Ts>        ostream& operator<<(ostream& o, const tuple<Ts...>& x) { o << "("; apply([&](auto&& y, auto&&... ys){ o << y; ((o << ", " << ys), ...); }, x); o << ")"; return o; }
template<class T1, class T2> ostream& operator<<(ostream& o, const pair<T1, T2>& x) { o << tie(x.first, x.second); return o; }
template<class T>            ostream& operator<<(ostream& o, const vector<T>& x)    { o << "{"; for (auto it = x.begin(); it != x.end(); it++) { if (it != x.begin()) { o << ", "; } o << *it; } o << "}"; return o; }
template<class T1, class T2> ostream& operator<<(ostream& o, const set<T1, T2>& x)  { o << "{"; for (auto it = x.begin(); it != x.end(); it++) { if (it != x.begin()) { o << ", "; } o << *it; } o << "}"; return o; }
template<class T1, class T2> ostream& operator<<(ostream& o, const map<T1, T2>& x)  { o << "{"; for (auto it = x.begin(); it != x.end(); it++) { if (it != x.begin()) { o << ", "; } o << *it; } o << "}"; return o; }
}

// Main
void mainCase() {
  ll n; // <= 100
  cin >> n;

  vector<ll> ls(n, 0);
  cin >> ls;
  sort(ALL(ls));

  ll res = 0;
  FOR(i, 0, n) {
    FOR(j, i + 1, n) {
      FOR(k, j + 1, n) {
        ll x = ls[i], y = ls[j], z = ls[k];
        if (x == y || y == z) { continue; }
        if (z < x + y) {
          res++;
        }
      }
    }
  }
  cout << res << endl;
}

int main() {
  mainCase();
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main()
{
    int extend, good;
    cin >> extend >> good;
    if((good - 1) % (extend - 1) >= 1){
      cout << (good - 1) / (extend - 1) + 1;
      return 0;
    }
    cout << (good - 1) / (extend - 1);
    return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    total_score = sum(b)

    for i in range(1, n):
        prev = a[i - 1]
        if prev + 1 == a[i]:
            total_score += c[prev - 1]

    print(total_score)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9068
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;
//struct edge { int to, cost; };

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

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

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int modinv2(int a, int mod) {
    return mod_pow(a, mod - 2, mod);
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

signed main() {
    //srand((unsigned)time(NULL));

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int a[100005], b[100005];
    rep(i, n) cin >> a[i] >> b[i];
    int maa = 0, ans;
    rep(i, n) {
        if (a[i] > maa) {
            ans = a[i] + b[i];
            maa = a[i];
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
char s[11];
int main() {
    scanf("%s", s);
    int len = strlen(s);
    s[4] = '\0';
    if (strcmp(s, "YAKI") == 0) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
ll gcd(ll a, ll b) {
  return b != 0 ? gcd(b, a % b) : a;
}
int main(){
    int n;
    ll s,sum=1,x;
    scanf("%d",&n);
    rep(i,n){
        scanf("%lld",&x);
        s=gcd(sum,x);
        sum=sum/s*x;
    }
    printf("%lld\n",sum);
    return 0;
}

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

int main(){
    string S;  cin >> S;
    bool north = false, west = false, south = false, east = false;
    for(int i=0; i<S.length(); i++){
        if(S[i]=='N') north = true;
        if(S[i]=='W') west = true;
        if(S[i]=='S') south = true;
        if(S[i]=='E') east = true;
    }

    if((north==south)&&(west==east)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    char[] s = sc.next().toCharArray();
    StringBuilder sb = new StringBuilder();
    for(int i=0;i<s.length;i++){
        int count = (s[i]-'A'+n)%26;
        sb.append((char)('A'+count));
    }

    System.out.println(sb.toString());
    sc.close();
}
}
    

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

int V, u, v;
vector<int> G[100000];
bool visT[100000];
int cntA[100000], cntT[100000];

void bfs_A() {
    queue<int> aq;
    aq.push(v);
    fill(cntA, cntA + 100000, -1);
    cntA[v] = 0;
    while (!aq.empty()) {
        int x = aq.front();
        aq.pop();
        for (int i = 0; i < G[x].size(); i++) {
            int to = G[x][i];
            if (cntA[to] == -1) {
                cntA[to] = cntA[x] + 1;
                aq.push(to);
            }
        }
    }
}

int bfs_T() {
    int res = 0;
    queue<int> tq;
    tq.push(u);
    fill(cntT, cntT + 100000, -1);
    cntT[u] = 0;
    while (!tq.empty()) {
        int x = tq.front();
        tq.pop();
        res = max(res, cntA[x] - 1);
        for (int i = 0; i < G[x].size(); i++) {
            int to = G[x][i];
            if (cntT[x] + 1 >= cntA[to]) continue;
            if (cntT[to] == -1) {
                cntT[to] = cntT[x] + 1;
                tq.push(to);
            }
        }
    }
    return res;
}

int main() {
    cin >> V >> u >> v;
    u--, v--;
    for (int i = 0; i < V-1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    bfs_A();
    cout << bfs_T() << endl;
    return 0;
}

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

int main(){
    string S;
    cin>>S;
    int ans=0;
    int len=0;
    for(auto s:S){
        if(s=='A'||s=='T'||s=='C'||s=='G'){
            len++;
            ans=max(ans,len);
        }else{
            len=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n = [int(x) for x in input()]
op_cnt = len(n) - 1  # すき間の個数
for i in range(2 ** op_cnt):  # 000→001→010→...
    ops = ["-"] * op_cnt  # あらかじめ ["-", "-", "-"] というリストを作っておく
    for j in range(op_cnt):
        if (i >> j) & 1:
            ops[op_cnt - 1 - j] = "+"  # フラグが立っていた箇所を "+" で上書き
    # print(op)  # ['-', '-']\n['-', '+']\n['+', '-']\n['+', '+']

    formula = str(n[0])
    for op, num in zip(ops, n[1:]):
        formula += op + str(num)

    if eval(formula) == 7:  # 文字列数式→数式
        print(formula + "=7")
        exit()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 705;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n, m, cnt[2], tot, x[MAXN], y[MAXN];
bool vis[MAXN], col[MAXN], a[MAXN][MAXN], dp[MAXN][MAXN];
void dfs(int pos) {
	vis[pos] = true;
	cnt[col[pos]]++;
	for (int i = 1; i <= n; i++)
		if (a[pos][i] == false) {
			if (!vis[i]) {
				col[i] = !col[pos];
				dfs(i);
			} else if (col[i] == col[pos] && i != pos) {
				printf("-1\n");
				exit(0);
			}
		}
}
int main() {
	read(n), read(m);
	for (int i = 1; i <= m; i++) {
		int x, y; read(x), read(y);
		a[x][y] = a[y][x] = true;
	}
	for (int i = 1; i <= n; i++) {
		if (!vis[i]) {
			cnt[0] = cnt[1] = false;
			dfs(i);
			tot++;
			x[tot] = cnt[0];
			y[tot] = cnt[1];
		}
	}
	dp[0][0] = true;
	for (int i = 1; i <= tot; i++)
	for (int j = 0; j <= n; j++)
		if (dp[i - 1][j]) {
			dp[i][j + x[i]] = true;
			dp[i][j + y[i]] = true;
		}
	int ans = n * n;
	for (int i = 0; i <= n; i++)
		if (dp[tot][i]) chkmin(ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
	writeln(ans);
	return 0;
}

Measured memory_bytes: 1280
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#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;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=6007;
ll mod;

int n;

//~ ll kom[nax][7];

ll dp[nax][nax];

void dod(ll &a, ll b)
{
	a=(a+b)%mod;
}

ll f(int i, int g)
{
	if (g==1)
		return 1;
	if (g==2)
		return i-1;
	return (i-1)*(i-2);
}

int main()
{
	scanf("%d%lld", &n, &mod);
	//~ for (int i=0; i<nax; i++)
	//~ {
		//~ kom[i][0]=1;
		//~ for (int j=1; j<=i && j<7; j++)
			//~ kom[i][j]=(kom[i-1][j-1]+kom[i-1][j])%mod;
	//~ }
	dp[0][0]=1;
	for (int i=1; i<=3*n; i++)
	{
		for (int l=0; l<=i && l<=n; l++)
		{
			for (int j=1; j<=3 && j<=i && (j==1 || l>0); j++)
			{
				dod(dp[i][l], dp[i-j][l-(j>1)]*f(i, j));
			}
		}
	}
	ll wyn=0;
	for (int i=0; i<=n; i++)
		dod(wyn, dp[3*n][i]);
	printf("%lld\n", wyn);
	return 0;
}


Measured memory_bytes: 279424
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  set<ll> st;
  rep(i, 3) {
    ll a;
    cin >> a;
    st.insert(a);
  }
  cout << st.size() << endl;
}

Measured memory_bytes: 3584
x,y=input().split()
L1=["1","3","5","7","8","10","12"]
L2=["4","6","9","11"]
L3=["2"]
if (x in L1 and y in L1) or (x in L2 and y in L2) or (x in L3 and y in L3):
    print("Yes")
else:
    print("No")

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

typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vstr;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define asd cout << "ok" << endl;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define trav(it, m) for(auto it = m.begin(); it it!= m.end(); it++)

const char nl = '\n';
const int MOD = 1e9 +7;
const ll INF = 1e19;
const ld PI = acos((ld)-1);
const int MX = 2e5 + 5;

int main(){

  ios_base::sync_with_stdio(0); cin.tie(0);
  int n, m; cin >> n >> m;
  int res[m+1] = {};
  for(int i = 0; i < n; i++)
  {
    int k; cin >> k;
    for(int j = 0; j < k; j++){
      int x; cin >> x;
      res[x]++;
    }
  }
  int cnt = 0;
  for(int i = 1; i <= m; i++)
  {
    if(res[i] == n)
      cnt++;
  }
  cout << cnt << nl;





  return 0;
}



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

int main() {
  string S;
  cin >> S;
  if(S == "Sunny"){
    cout << "Cloudy" << endl;
  }else if(S == "Cloudy"){
    cout << "Rainy" << endl;
  }else{
    cout << "Sunny" << endl;
  }
}


Measured memory_bytes: 256
n,m = list(map(int, input().split()))
times = [0 for i in range(n)]
for i in range(m):
    t = list(map(int, input().split()))
    times[t[0]-1]+=1
    times[t[1]-1]+=1

ans = 1
for i in range(n):
    ans *= (times[i]+1)%2
    
if(ans==1):
    print("YES")
else:
    print("NO")





Measured memory_bytes: 46868
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
const int INF = 1000000009;

long a, b;
char field[105][105];

long n = 100;


void fill(bool flag){
	for(int i = 0; i < n/2; i += 2){
		for(int j = 0; j < n; j += 2){
			if(flag){
				if(a - 1 <= 0){
					return;
				}
				field[i][j] = '.';
				a--;
			}else{
				if(b - 1 <= 0){
					return;
				}
				field[i+n/2+1][j] = '#';
				b--;
			}
		}
	}
}

int main(){
	for(int i = 0; i < n/2; i++){
		for(int j = 0; j < n; j++){
			field[i][j] = '#';
		}
	}
	for(int i = 0; i < n/2; i++){
		for(int j = 0; j < n; j++){
			field[i+n/2][j] = '.';
		}
	}
	std::cin >> a >> b;
	
	fill(true);
	fill(false);
	printf("100 100\n");
	for(int i = 0; i < n; i++){
		printf("%s\n", field[i]);
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    string s; cin >> s;
    int N = SZ(s);
    int ans = 0, A = 0;

    REP(i, N){
        if(s[i] == 'A') A++;
        else if(i < N - 1 && s[i] == 'B' && s[i + 1] == 'C'){
            ans += A;
            i++;
        }else A = 0;
    }
    Out(ans);

    return 0;
}


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

int main() {
  ll a,b,c;
  cin >>a>>b>>c;
  
  a = a%b;
  int i = 2;
  bool ok = false;
  for (int i = 1; i< b;i++){
    int x = a*i;
    x = x%b;
    if (x == c){
      ok = true;
      break;
    }
  }
  if (ok){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test(n) cout << "test" << n << endl;
#define fixsp(n) fixed << setprecision(n)
#define defsp(n) defaultfloat << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define iikae auto&
#define zenbu(a) a.begin(), a.end()
#define rzenbu(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long;using ld = long double;using P = pair<ll,ll>;
template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}
template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};

/* ここからコード開始 */

int main(){
  kyopro;
  ll N, M;
  cin >> N >> M;
  vector<ll> S(N), T(M);
  for(auto&& i : S){
    cin >> i;
  }
  for(auto&& i : T){
    cin >> i;
  }
  ll ans{};
  vector<vector<ll>> tmp(N+1, vector<ll>(M+1)), sum(N+1, vector<ll>(M+1));
  rep(n, 0, N) rep(m, 0, M){
    if(S.at(n) == T.at(m)){
      tmp.at(n+1).at(m+1) = sum.at(n).at(m) + 1;
      sum.at(n+1).at(m+1) = tmp.at(n+1).at(m+1);
      ans += tmp.at(n+1).at(m+1);
    }
    sum.at(n+1).at(m+1) += (sum.at(n+1).at(m) + sum.at(n).at(m+1) + MOD - sum.at(n).at(m)) % MOD;
  }
  // for(auto&& i : tmp){
  //   for(auto&& j : i){
  //     cout << j << sp;
  //   }
  //   cout << rt;
  // }
  //   for(auto&& i : sum){
  //   for(auto&& j : i){
  //     cout << j << sp;
  //   }
  //   cout << rt;
  // }

  cout << (ans + 1) % MOD << rt;
}

Measured memory_bytes: 62976
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
#include<set>
#include<queue>
#include<deque>
#include<iomanip>
#include<sstream>
#include<cmath>
#include<tuple>
#include<bitset>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define req(i,n) for(ll i = 1;i <=  n; i++)
#define rrep(i,n) for(ll i = n -1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
typedef long long int ll;
typedef long double ld;
const ll INF = 1e18;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
int main(void) {
	ll n; cin >> n; vector<ll> a(n), b(n);
	rep(i, n) cin >> a[i] >> b[i];
	sort(ALL(a)); sort(ALL(b));
	if (n % 2 == 0){
		ll meda = a[n / 2 - 1] + a[n / 2];
		ll medb = b[n / 2 - 1] + b[n / 2];
		cout << medb - meda +1 << endl;
	}
	else {
		ll meda = a[n / 2], medb = b[n / 2];
		cout << medb - meda +1 << endl;
	}
}

Measured memory_bytes: 6420
//written by Aman Mishra(aspro)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,s,e) for(ll i=s;i<=e;i++)
#define aspro ios_base::sync_with_stdio(0);cin.tie(0);
#define pb push_back
#define pii pair<int,int>
#define INF 10000000000000
#define MOD 1000000007
#define N 2050
#define test int t;cin>>t;while(t--)
/*int histogram(int arr[],int n)
{
    f(j,1,n) cout<<arr[j]<<" ";cout<<endl;
    while(!s.empty()) s.pop();
    int i=1;int ans=0,area,top,ptop;
    while(i<=n)
    {
        if(s.empty() or arr[i]>=arr[s.top()])
        {
            s.push(i++);
            //i++;
        }
        else if(arr[i]<arr[s.top()])
        {
            top=s.top();
            s.pop();
            if(s.empty())    area=arr[top]*(i-1);
            else
            {
                ptop=s.top();
                area=arr[top]*(i-ptop-1);
            }
            ans=max(ans,area);
        }
    }
    while(!s.empty())
    {
        top=s.top();
        s.pop();
        if(s.empty())   area=arr[top]*(i-1);
        else
        {
            ptop=s.top();
            area=arr[top]*(i-ptop-1);
        }
         ans=max(ans,area);
    }
    //cout<<"returning  "<<ans<<endl;
    return ans;//cout<<ans<<endl;
}*/
string mat[N];
int s[N],p[N],sz[N],ans,cnt,in[N];
vector<pii> vec;
int n,m;
void init_p(int n)
{
	f(i,0,n-1)
	{
	    p[i]=i;
        sz[i]=1;
	}
}
int findit(int x)
{
	return x==p[x]?x:p[x]=findit(p[x]);
}
void uni(int x,int y)
{
	x=findit(x);
	y=findit(y);
	if(x==y) return ;
	p[x]=y;
	sz[y]+=sz[x];
}
void findans()
{

	vec.clear();
	f(i,1,m-1) vec.pb({s[i],i});
	sort(vec.begin(),vec.end(),greater<pii>() );
    /*int si=vec.size();
    cout<<"sorted :\n";
    f(i,0,si-1)
    {
        cout<<i<<" "<<v[i].first<<" "<<v[i].second<<endl;
    }*/
	init_p(m);
	++cnt;
	for(auto it:vec)
	{
		int x=it.second;
		in[x]=cnt;
		if(in[x-1]==cnt) uni(x-1,x);
		if(in[x+1]==cnt) uni(x+1,x);
		ans=max(ans,it.first*(sz[findit(x)]+1 ));
	}
}
int main()
{
    aspro
    cin>>n>>m;
    f(i,0,n-1)
    {
        cin>>mat[i];
       // mat[i]='$'+mat[i];
    }
    ans=max(n,m);
    f(i,1,m-1) s[i]=1;
    f(i,1,n-1)
    {
    	f(j,1,m-1)
    	{
    		int x=(mat[i][j]==mat[i][j-1])?1:0 ;
    		int y=(mat[i-1][j]==mat[i-1][j-1])?1:0 ;
    		if(x==y) s[j]++;
    		else s[j]=1;
    	}
    	findans();
    	//ans=max(ans,histo(s,m));
    }
    cout<<ans<<endl;
}
/*
10 8
##...#.#
##...#.#
..###.#.
#.##.#.#
.#..#.#.
..##.#.#
##.#.#..
...#.#..
###.#.##
###..###
*/


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

typedef long long ll;

const int inf = 1000000;

int main() {
    ll N;
    ll s = 0;
    cin >> N;
    vector<ll>a(N);
    vector<ll>v(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        s ^= a[i];
    }
    for (int i = 0; i < N; i++) {
        v[i] = s ^ a[i];
    } 
    for (int i = 0; i < N; i++) {
        cout << v[i];
        if (i != N-1) {
            cout << " ";
        }
    }
    cout << endl;
}


Measured memory_bytes: 6372
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;



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

	int increase = 0;
	int cnt = 1;
	for (int i = 1; i < n; i++) {
		if (increase == 1 && a[i] < a[i - 1]) {
			cnt++;
			increase = 0;
			continue;
		}
		if (increase == -1 && a[i] > a[i - 1]) {
			cnt++;
			increase = 0;
			continue;
		}

		if (increase == 0) {
			if (a[i] < a[i - 1]) {
				increase = -1;
			}
			if (a[i] > a[i - 1]) {
				increase = 1;
			}
		}
		
	}

	cout << cnt << endl;
}



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

using namespace std;

using int64 = long long;
// const int mod = 1e9 + 7;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  cin >> A;

  int ret = 0;
  int pre = inf;
  for(int i = 0; i < N; i++) {
    chmin(pre, A[i]);
    ret += A[i] <= pre;
  }
  cout << ret << endl;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	long long int a, sum=0, ans=0;
	scanf("%d", &n);
	for(int i=0; i<n; i++){
		scanf("%lld", &a);
		if(a!=0){
			sum=sum+a;
		}else{
			ans=ans+sum/2;
			sum=0;
		}
	}
	ans=ans+sum/2;
	printf("%lld\n", ans);
	return 0;
}

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

int month[13]={
  0,
  31,//1
  28,//2
  31,//3
  30,//4
  31,//5
  30,//6
  31,//7
  31,//8
  30,//9
  31,//10
  30,//11
  31//12
};

int day(int y,int m,int d){
  int base = (y-1)*365+d;
  REP(i,1,m)base+=month[i];
  int lim = m > 2 ? y+1:y;
  REP(i,1,lim){
    if ( i %400 == 0 ||(i % 100 !=0 && i % 4 == 0))base++;
  }
  return base;
}



/*
  correct version

int day2(int y,int m,int d){
  y += 4800;
  if (m < 3) --y, m += 12;
  return 365L*y+y/4-y/100+y/400+(153*m-457)/5+d-32045;
}
*/

main(){
  int y1,m1,d1,y2,m2,d2;
  while(cin>>y1>>m1>>d1>>y2>>m2>>d2 ){
    if ( y1 < 0 || m1 < 0 || d1 < 0 || 
	 y2 < 0 || m2 < 0 || d2 < 0)break;
    int a=day(y1,m1,d1),b=day(y2,m2,d2);
    
    
    
    cout << b-a << endl;
  }
}

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

int main(){
  ll N;
  cin >> N;
  
  vector<ll> A(N);
  for (int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  
  ll left = A.at(N - 1);
  ll score = left, cand;
  for (int i = 0; i < N - 1; i++){
    if (score >= abs(left - A.at(i) * 2)){
      cand = A.at(i);
      score = abs(left - A.at(i) * 2);
    }
  }
  
  cout << left << ' ' << cand << endl;
}

Measured memory_bytes: 3944
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
// a>=0, b>=0, x*a+y*b=gcd>=0, abs(y)<=a,abs(x)<=b
LL gcdex(LL a, LL b, LL& x, LL& y){
	if(b==0){
		x=1;y=0;
		return a;
	}
	LL q=a/b;
	LL g=gcdex(b,a-q*b,y,x);
	y-=x*q;
	return g;
}
LL t0[100*1000+1];
LL t1[100*1000+1];
const LL M=1000*1000*1000+7;
int main() {
	LL H,W,A,B;
	cin >> H >> W >> A >> B;
	t0[0]=1;
	for(int i=1;i<H-A;i++){
		t0[i]=t0[i-1];
		t0[i]*=B+i-1;
		t0[i]%=M;
		LL x,y;
		gcdex(i,M,x,y);
		t0[i]*=(x%M+M)%M;
		t0[i]%=M;
	}
	t1[0]=1;
	for(int i=1;i<H;i++){
		t1[i]=t1[i-1];
		t1[i]*=W-B+i-1;
		t1[i]%=M;
		LL x,y;
		gcdex(i,M,x,y);
		t1[i]*=(x%M+M)%M;
		t1[i]%=M;
	}
	LL ret=0;
	//cout << t0[0] << ", " << t1[1] << endl;
	for(int i=0;i<H-A;i++){
		ret+=(t0[i]*t1[H-1-i])%M;
		ret%=M;
	}
	cout << ret << endl;

}


Measured memory_bytes: 1664
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func main() {
	n, _ := strconv.Atoi(input())
	wLimit, _ := strconv.Atoi(input())
	w := make([]int, n+1)
	v := make([]int, n+1)
	for i := 1; i <= n; i++ {
		w[i], _ = strconv.Atoi(input())
		v[i], _ = strconv.Atoi(input())
	}

	dp := make([][]int, n+1)
	for i := 0; i <= n; i++ {
		dp[i] = make([]int, wLimit+1)
	}

	for i := 1; i <= n; i++ {
		for j := 1; j <= wLimit; j++ {
			if j < w[i] {
				dp[i][j] = dp[i-1][j]
			} else {
				dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]]+v[i])
			}
		}
	}

	fmt.Println(dp[n][wLimit])
}


Measured memory_bytes: 81792
#include<iostream>
#include<cstring>
#include<queue>
#include<cstdio>
#include<algorithm>

int h,w,n,nxtx,nxty,startx,starty,ans,dir[4][2]={{0,1},{0,-1},{-1,0},{1,0}};
char map[1005][1005];
bool flag[1005][1005];
using namespace std;

struct point{
	int x,y,step;
}temp,des[15];

int bfs(point a,point b)
{
	memset(flag,false,sizeof(flag));
	queue<point> que;
	a.step=0;flag[a.x][a.y]=true;
	que.push(a);
	while(!que.empty())
	{
		for(int i=0;i<4;i++)
		{
			temp=que.front();
			nxtx=temp.x+dir[i][0];nxty=temp.y+dir[i][1];
			if(nxtx<0||nxty<0||nxtx>=h||nxty>=w||flag[nxtx][nxty]||map[nxtx][nxty]=='X') continue;
			flag[nxtx][nxty]=true;
			temp.step++;temp.x+=dir[i][0];temp.y+=dir[i][1];
			que.push(temp);
			if(nxtx==b.x&&nxty==b.y)
			   return temp.step;
		}
		que.pop();
	}
	return -1;
}

int main()
{
	ans=0;
	scanf("%d%d%d",&h,&w,&n);
	for(int i=0;i<h;i++)
	{
		getchar();
		for(int j=0;j<w;j++)
		{
			scanf("%c",&map[i][j]);
			if(map[i][j]=='S'){des[0].x=i;des[0].y=j;}
			if(map[i][j]<='9'&&map[i][j]>='1')
			{des[map[i][j]-'0'].x=i;des[map[i][j]-'0'].y=j;}
		}
	}
	for(int i=0;i<n;i++)
	   ans+=bfs(des[i],des[i+1]);
	printf("%d\n",ans);
}


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

using namespace std;

int main()
{
    string str;
    cin >> str;
    int len = str.length();
    if ((str[len - 1] != 's'))
    {
        str += 's';
    }
    if((str[len - 1] == 's'))
    {
        str += 'e';
        str+='s';
    }
    cout << str << endl;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <list>
#include <bitset>
#include <vector>
using namespace std;

#define I64d_OJ

//#ifdef I64d_OJ
//#define LL __int64
//#endif // I64d_OJ
#ifdef I64d_OJ
#define LL long long
#endif // I64d_OJ

typedef unsigned LL ULL;
typedef unsigned uint;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;
typedef vector<int> vi;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-f; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define MID(a,b) (((LL)(a)+(LL)(b))>>1)
#define absx(a) ((a)<0?-(a):(a))
#define MK(a,b) make_pair(a,b)
#define PB(a) push_back(a)
#define lowbit(x) ((x)&-(x))

#define lc c[x][0]
#define rc c[x][1]

template< typename T >
inline void Max(T &a,T &b){if(a<b) a=b;}
template< typename T>
inline void Min(T &a,T &b){if(a>b) a=b;}

const double pi=(double)acos(-1.0);
const double eps=(double)1e-8;
const int INF = (int) 0x3f3f3f3f;
const int MOD = (int) 1e9+7;
const int MAXN =(int) 2e5+10;
const int MAXM = (int) 3e6+10;

///--------------------START-------------------------

void work(){
    int N;
    scanf("%d",&N);
    if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9) printf("hon\n");
    else if(N%10==0||N%10==1||N%10==6||N%10==8) printf("pon\n");
    else if(N%10==3) printf("bon\n");
}

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








Measured memory_bytes: 3760
N,H = map(int,input().split())
A,B = [],[]
maxA,maxAi = -1,-1
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
    if maxA < a:
        maxA = a
        maxAi = i

T = []
for i in range(N):
    if B[i] >= maxA:
        T.append(B[i])

import sys
atk = 0
T.sort(reverse=True)
for t in T:
    H -= t
    atk += 1
    if H <= 0:
        print(atk)
        sys.exit()

print(atk + (H-1)//maxA + 1)





Measured memory_bytes: 12064
n,k = map(int, input().split())
sn = [0]*n
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        sn[a[j]-1] = 1

count = 0
for i in range(n):
    if(sn[i] == 0):
        count += 1

print(count)

Measured memory_bytes: 9208
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int k;cin>>k;
	string s; cin>>s;
	if (s.size()<=k) {
		ct(s);
	} else {
		string st = s.substr(0,k);
		cout << st << "..." << "\n";
	}

}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
int N, M, A, B, C, T, S[55], X[55][55], Y[55][55], Z[55][55];
void mul() { // X = X * Y
	int R[55][55];
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			int sum = 0;
			for (int k = 0; k < N; k++) sum += X[i][k] * Y[k][j];
			R[i][j] = sum % M;
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) X[i][j] = R[i][j];
	}
}
void power() {
	for (int i = 30; i >= 0; i--) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < N; k++) Y[j][k] = X[j][k];
		}
		mul();
		if (T & (1 << i)) {
			for (int j = 0; j < N; j++) {
				for (int k = 0; k < N; k++) Y[j][k] = Z[j][k];
			}
			mul();
		}
	}
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (cin >> N >> M >> A >> B >> C >> T, N) {
		for (int i = 0; i < N; i++) cin >> S[i];
		for (int i = 0; i < N; i++) {
			Z[i][i] = B;
			if (i != 0) Z[i][i - 1] = A;
			if (i + 1 != N) Z[i][i + 1] = C;
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) X[i][j] = 0;
			X[i][i] = 1;
		}
		power();
		for (int i = 0; i < N; i++) {
			int ret = 0;
			for (int j = 0; j < N; j++) ret += X[i][j] * S[j];
			if (i) cout << ' ' << ret % M;
			else cout << ret % M;
		}
		cout << endl;
	}
}

Measured memory_bytes: 3148
// Be name khoda
#include <algorithm>
#include <iostream>
using namespace std;

typedef long long ll;

const int MAX_N = 50 + 5;
ll n, k, ans;
ll len[MAX_N];
ll tol[MAX_N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k;
	len[0] = 1;
	tol[0] = 1;
	
  	for (int i = 1; i <= n; i++) {
    	len[i] = 2 * len[i - 1] + 1;
    	tol[i] = 2 * tol[i - 1] + 3;
    }
  
  	for (int i = n; ~i; i--) {
    	if (k <= 1)
        	break;
      	if (k < 1 + tol[i - 1]) {
        	k--;
         	continue;
        }
      	ans += len[i - 1];
      	if (k == 1 + tol[i - 1])
        	break;
      
      	ans += 1;
      	if (k == 2 + tol[i - 1])
        	break;
       	
    	if (k < 2 + 2 * tol[i - 1]) {
 	      	k -= 2 + tol[i - 1];
        	continue;
        }
      	ans += len[i - 1];
      	if (k == 2 + 2 * tol[i - 1])
        	break;
      	break;
    }

    cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define mod 1000000007

long long power(long long a,long long b){
  long long x=1,y=a;
  while(b>0){
    if(b&1ll){
      x=(x*y)%mod;
    }
    y=(y*y)%mod;
    b>>=1;
  }
  return x%mod;
}

long long modular_inverse(long long n){
  return power(n,mod-2);
}

long long factorial[4194304];
long long invfact[4194304];

void cfact(){
  long long i;
  factorial[0]=1;
  factorial[1]=1;
  for(i=2;i<4194304;i++){
    factorial[i]=factorial[i-1]*i;
    factorial[i]%=mod;
  }
  invfact[4194303]=modular_inverse(factorial[4194303]);
  for(i=4194302;i>=0;i--){
    invfact[i]=invfact[i+1]*(i+1);
    invfact[i]%=mod;
  }
}

long long calcnCr(long long n,long long k){
  if(k<0 || n-k<0){return 0;}
  return (factorial[n]*((invfact[k]*invfact[n-k])%mod))%mod;
}

//0 <= A_1 + A_2 + ... + A_n <= s
//A_1,A_2,...,A_m <= g
long long hj(long long n,long long m,long long s,long long g){
  long long i,t,res=0,k=1,c;
  if(s<0 || g<0){return 0;}
  //Rule v : A_v <= g
  for(i=0;i<=m;i++){
    //violating i rules(the others are no matter)
    t=s-i*(g+1);
    if(t<0){break;}
    c=calcnCr(m,i);
    c*=calcnCr(t+n,n);
    c%=mod;
    if(k==1){res+=c;}
    else{res+=(mod-c);}
    res%=mod;
    k*=-1;
  }
  return res;
}

//0 <= A_1 + A_2 + ... + A_n <= r
//m-th greater != (m+1)-th greater
long long neq(long long n,long long m,long long r){
  long long i,j,res=0,c,k;
  for(i=0;i<=r;i++){
    //(m+1)-th greater == i
    res+=hj(n,n-m,r-(i+1)*m,i);
    res%=mod;
    res+=(mod-hj(n,n-m,r-(i+1)*m,i-1));
    res%=mod;
  }
  res*=calcnCr(n,m);
  res%=mod;
  return res;
}

//0 <= A_1 + A_2 + ... + A_n <= r
//m-th greater == (m+1)-th greater
long long rside(long long n,long long m,long long r){
  return (mod+calcnCr(r+n,n)-neq(n,m,r))%mod;
}

//l <= A_1 + A_2 + ... + A_n <= r
//m-th greater == (m+1)-th greater
long long calc(long long n,long long m,long long l,long long r){
  return (mod+rside(n,m,r)-rside(n,m,l-1))%mod;
}

int main(){
  cfact();
  long long n,m,l,r;
  scanf("%lld%lld%lld%lld",&n,&m,&l,&r);
  printf("%lld\n",calc(n,m,l,r));
}

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

int main() {
  int N;
  cin >> N;
  vector<int> card(N);
  for(int i=0;i<N;i++){
    int d;
    cin >> d;
    card.at(i) =d;
      }
    sort(card.begin(), card.end());
    reverse(card.begin(), card.end());
    int c=0;
    int tmp =101;
    for(int i=0;i<N;i++){
      if(tmp>card.at(i)){
        c++;
        tmp=card.at(i);
    }
  }
    cout << c << endl;
}


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

int main(){
int N;
  cin>>N;
  
  vector<double>x(N);
  vector<string>u(N);
  double sum=0;
  for(int i=0; i<N; i++){
   cin>>x[i]>>u[i];
   if(u[i]=="JPY"){sum+=x[i];}
   else{sum+=x[i]*380000;} 
  }
  cout<<sum<<endl;

}

Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);


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

    int res = 0;

    int N = *max_element(A.begin(), A.end());
    vector<int> cnts(N + 1, 0);
    for (auto x : A) {
        cnts[x] += 1;
    }

    for (auto x : A) {
        if (cnts[x] > 1) {
            continue;
        }
        bool ok = true;
        for (int i = 1; i * i <= x && ok; ++i) {
            if (x % i) {
                continue;
            }
            for (auto y : {i, x / i}) {
                if ((y == x && cnts[x] > 1) || (y < x && cnts[y] > 0)) {
                    ok = false;
                    break;
                }
            }
        }
        if (ok) {
            // cout << x << endl;
            ++res;
        }
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 7948
#include <cstdio>
#include <vector>

using namespace std;

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

typedef long long ll;

int main(){
  int n;
  scanf("%d", &n);
  
  vector<ll> a(n);
  rep(i, n) scanf("%d", &a[i]);
  
  double ans = 0;
  rep(i, n) {
    ans += 1 / (double)a[i];
  }
  printf("%.9f", 1/ans);
}

Measured memory_bytes: 256
/**
 *    author:  tourist
 *    created: 06.07.2020 09:39:55       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string a, b;
  cin >> a >> b;
  int ans = 0;
  for (int i = 0; i < (int) a.size(); i++) {
    if (a[i] != b[i]) {
      ++ans;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3800
#include <stdio.h>
#include <ctype.h>
int main()
{
 
  int n[100],top=0,keta=0;
  char m;  
  
  
  while( (m = getchar()) != '\n' )  {
    if(isdigit(m)){ 
      if(keta) { 
        n[top] = n[top] * 10 + (m - '0'); 
      } else {
        n[top] = (m - '0');
        keta++;
      }
    }
    if( isspace(m) ) { 
      if(keta) { 
        top++;
        keta = 0;
      }
    }
    if( m == '+' ) { 
      if( top > 1 ) {
        top--;
      }
      n[top-1] += n[top];
      n[top] = 0;
    }
    if( m == '-' ) {
      if( top > 1 ) {
        top--;
      }
      n[top-1] -= n[top];
      n[top] = 0;
    }
    if( m == '*' ) { 
      if( top > 1 ) {
        top--;
      }
      n[top-1] *= n[top];
      n[top] = 0;
    }
    if( m == '/' ) {
     
      if( top > 1 ) {
        top--;
      }
      n[top-1] /= n[top];
      n[top] = 0;
    }
  }
 
  printf("%d\n",n[0]);
  return 0;
}

Measured memory_bytes: 524