akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

vector<ll> sum(55),P(55);

ll solve(ll N,ll X){
    if(N==0){
        return (X<=0 ? 0 : 1);
    }
    else if(X<=1+sum[N-1]){
        return solve(N-1,X-1);
    }
    else{
        return P[N-1]+1+solve(N-1,X-2-sum[N-1]);
    }
}

int main() {
    ll N,X;
    cin >> N >> X;
    sum[0]=1;P[0]=1;
    for(int i=1;i<=N;i++){
        sum[i]=sum[i-1]*2+3;
        P[i]=P[i-1]*2+1;
    }
    ll ans = solve(N,X);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
while True:
    h,w=map(int, input().split())
    if h == 0 and w == 0: break
    for i in range(h):
        for j in range(w):
            if i == 0 or i == h-1 or j == 0 or j == w-1 :
                print("#", end="")
            else :
                print(".", end="")
        print()
    print()


Measured memory_bytes: 7004
#include <iostream>
#include<string>
using namespace std;
class Dice{
    public:
    int a[7],n;
    
    Dice(){}
    
    void roll_E(){   //東のとき
        roll(1,4,6,3);
    };   
    
    void roll_W(){  //西のとき
        roll(1,3,6,4);
    };
    
    
    void roll_S(){   //南のとき
        roll(1,5,6,2);
    };
    void roll_N(){  //北のとき
        roll(1,2,6,5);
    };
    
    void roll_H(){      //横回り
        roll(2,3,5,4);
    }
    
    
    void roll(int i, int j, int k, int l){    //転がったときの値の移動
       n = a[i], a[i] = a[j], a[j] = a[k], a[k] = a[l], a[l] = n; 
    }
    
    void way(char m){  //方角を判断
        if(m == 'E') roll_E();
        else if(m == 'W') roll_W();
        else if(m == 'S') roll_S();
        else if(m == 'N') roll_N();
        else if(m == 'H') roll_H();
    }
    
    int getRight(Dice c1, int t, int f){   //tは上、ｆは前
        for(int i = 0;i < 6; i++){
            for(int j = 0;j < 4; j++){
                if(c1.a[1] == t && c1.a[2] == f)  return c1.a[3];
                c1.roll_H();
                
                //cout << "i,j,a[1]" << i << " "<< j <<" " << c1.a[1]<< endl;
            }
            
            if(i%2 == 0) c1.roll_W();
            else c1.roll_N();
        }
        
        return -1;   //関数の処理の終わり、関数の処理結果として－１を呼び出し元にかえす
    }
    
    
    
};
    



int main(void){
    // Your code here!
    Dice dice;
    //char direction; //方向
    int n,t,f;   //ｎは質問の数,tは上、ｆは前
    
    for(int i = 1; i <= 6; i++){    //各面に値を入力
        cin >> dice.a[i];
    }
    
    cin >> n;  //質問を入力
    
    for(int i = 0; i < n;i++){
        cin >> t >> f;
        cout << dice.getRight(dice,t,f) << endl;
    }
    
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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 = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll ans=a*c;
  chmax(ans,a*d);
  chmax(ans,b*c);
  chmax(ans,b*d);
  cout << ans << endl;
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

int main()
{
	string S1, S2;
	cin>>S1>>S2;
	int p=S1.length();
	bool check=0;
	for(int a=0;a<p;a++)
	{
		for(int b=0;b<p;b++)
		{
			if(S1[(a+b)%p]!=S2[b])
			{
				break;
			}
			if(b==p-1) check=1;
		}
	}
	if(check)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int []x=new int [10];
		for(int i=0;i<x.length;i++){
			x[i]=sc.nextInt();
		}
		Arrays.sort(x);
		System.out.println(x[9]);
		System.out.println(x[8]);
		System.out.println(x[7]);
	}
}

Measured memory_bytes: 17168
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long N;
    string name = "";
    cin >> N;
    while(N>0){
        name.push_back('a' + (N-1)%26);
        N = (N-1)/26;
    }
    reverse(name.begin(), name.end());
    cout << name << endl;
}

Measured memory_bytes: 3600
#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,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) for(auto&& x : v){cout << x << " ";} cout << endl
#define printVV(vv) for(auto&& v : vv){for(auto&& x : v){cout << x << " ";}cout << endl;}
#define printP(p) cout << p.first << " " << p.second << endl
#define printVP(vp) for(auto&& p : vp) printP(p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;
typedef vector<vector<int>> Graph;

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

    int H, W;
    cin >> H >> W;
    vector<string> s(H);
    rep(i, H) cin >> s[i];

    vector<string> red(H, string(W, '.'));
    rep(i, H) red[i][0] = '#';
    rep(i, H) {
        if (i % 2 == 0) continue;
        rep(j, W - 1) {
            red[i][j] = '#';
        }
    }

    vector<string> blue(H, string(W, '.'));
    rep(i, H) blue[i][W - 1] = '#';
    rep(i, H) {
        if (i % 2 == 1) continue;
        rep2(j, 1, W) {
            blue[i][j] = '#';
        }
    }

    rep(i, H) {
        rep(j, W) {
            if (s[i][j] == '#') {
                red[i][j] = '#';
                blue[i][j] = '#';
            }
        }
    }

    rep(i, H) cout << red[i] << endl;
    cout << endl;
    rep(i, H) cout << blue[i] << endl;

}


Measured memory_bytes: 1536
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;

signed main(){
    int n;
    cin >> n;
    int l[100] = {0};
    rep(i,n) cin >> l[i];
    int s = 0;
    rep(i,n)s += l[i];
    int c = 1;
    rep(i,n)if(l[i] >= s-l[i])c = 0;
    if(c)cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0; 
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://agc030.contest.atcoder.jp/tasks/agc030_a
// rm -r -f test;oj dl http://abc117.contest.atcoder.jp/tasks/abc117_b

Measured memory_bytes: 256
// clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define INFLL 1000000000000000000LL
#define MOD 1000000007
#define PI acos(-1)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>

using namespace std;

// clang-format on

main {
  int s = 0;
  char p;
  cin >> p;
  char c;
  while (cin >> c) {
    s += p != c;
    p = c;
  }
  cout << s << endl;
  bye;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define n_p(v) next_permutation(v.begin(),v.end())
#define to_ll(b) stoll(b)
#define MOD 1000000007
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp

signed main(){
	int N; cin>>N;
	vl vec(N);
	rep(i,0,N){
		ll a; cin>>a;
		vec[i]=a;
	}
	sort(all(vec));
	reverse(all(vec));
	ll yoko=0,tate=0;
	rep(i,0,N){
		if(vec[i]==vec[i+1] && vec[i]!=0){
			if(yoko==0){
				yoko=vec[i];
				vec[i]=0;
				vec[i+1]=0;
			}
			else if(tate==0) {
				tate=vec[i];
				vec[i]=0;
				vec[i+1]=0;
			}
		}
		if(yoko!=0 && tate!=0) break;
	}
	cout<<tate*yoko;
	
	return 0;
}

Measured memory_bytes: 1024
import collections

n, m = map(int, input().split())
graph = [[] for i in range(n + 1)]
for i in range(m):
    u, v = map(int, input().split())
    graph[u].append(v)
flag = [False for i in range(n + 1)]
s, t = map(int, input().split())

queue = collections.deque([s])
count = 0
while True:
    for i in range(2):
        temp = set()
        while queue:
            test = queue.popleft()
            for j in graph[test]:
                if j not in temp:
                    temp.add(j)
        for j in temp:
            queue.append(j)
    temp = set()
    while queue:
        test = queue.popleft()
        for i in graph[test]:
            if flag[i] == True:
                continue
            else:
                if i not in temp:
                    temp.add(i)
                    flag[i] = True
    count += 1
    if flag[t] == True:
        print(count)
        break
    if len(temp) == 0:
        print(-1)
        break
    for i in temp:
        queue.append(i)

Measured memory_bytes: 23412
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define fix(n) cout<<fixed<<setprecision(n);
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  while(1){
    int a,b; cin>>a>>b;
    if(a==0 && b==0) break;
    rep(i,0,a){
      if(i==0 || i==a-1) rep(j,0,b) cout<<"#";
      else{
        rep(j,0,b){
          if(j==0 || j==b-1) cout<<"#";
          else cout<<".";
        }
      }
      co("");
    }
    co("");
  }
    
  return 0;
}


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

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

using ll = long long;

void  solve(){
	int n;
cin>>n;
int x=n+n*n+n*n*n;
cout<<x;
}

int main(){

		solve();


		

 
}


Measured memory_bytes: 3620
//yukicoder@cpp14
//author:luckYrat(twitter:@luckYrat_)
//競技プログラミングから逃げるな
//https://www.youtube.com/watch?v=z_B9iJ8r4ic

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  int s,w;cin>>s>>w;
  if(s <= w){
    cout << "unsafe" << endl;
  }else{
    cout << "safe" << endl;
  }
}


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

int main(){
    long N;
    long A;
    cin >> N >> A;
    vector<long> x;
    long tmp;
    for(int i=0; i<N; i++){
        cin >> tmp;
        x.push_back(tmp);
    }
    long xs = 0;
    for(int i=0; i<N; i++){
        xs += x[i];
    }
    /*i枚目のカードまで見たときに 
    j枚使って合計がkとなる組み合わせ*/
    long dp[N+1][N+1][xs+1] = {};

    dp[0][0][0] = 1;
    for(int i=0; i<N; i++){
        for(int j=0; j<N+1; j++){
            for(int k=0; k<xs+1; k++){
                dp[i+1][j][k] = dp[i][j][k];
                if( (j >= 1) && (k >= x[i]) ){
                    dp[i+1][j][k] += dp[i][j-1][k-x[i]];
                }
            }
        }
    }
    long ans = 0;
    for(int i=1;i<N+1; i++){
        if(A*i > xs){break;}
        ans += dp[N][i][A*i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 54356
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD 1000000007
#define P pair<ll, ll>

int main() {
    ll n;
    cin >> n;
    if (n % 1000 == 0) cout << 0 << endl;
    else cout << 1000 - n % 1000 << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int main(){
	string s,t;
	cin>>s;
	cin>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end());
	reverse(t.begin(),t.end());
	if(s<t) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const int MOD = 100000;

int main()
{
    int h, w;
    cin >> h >> w;

    vector<string> s(h);
    for(int i=0; i<h; ++i)
        cin >> s[i];

    int ret = 1;
    vector<int> dp(1<<w, 0);
    dp[0] = 1;
    for(int y=0; y<h; ++y){
        for(int x=0; x<w; ++x){
            char c = s[y][x];
            if(c == '?'){
                ret *= 3;
                ret %= MOD;
            }

            vector<int> nextDp(1<<w, 0);
            int i = 0;
            while(i<(1<<w)){
                bitset<20> bs(i);

                if(c == 'J' || c == '?'){
                    int j = i;
                    j &= ~1;
                    j <<= 1;
                    j &= (1<<w)-1;
                    j |= 1;
                    nextDp[j] += dp[i];
                    nextDp[j] %= MOD;
                }
                if(c == 'O' || c == '?'){
                    int j = i;
                    if(x == 0)
                        j &= ~1;
                    j <<= 1;
                    j &= (1<<w)-1;
                    nextDp[j] += dp[i];
                    nextDp[j] %= MOD;
                }
                if((c == 'I' || c == '?') && !(i&(1<<(w-1)))){
                    int j = i;
                    j &= ~1;
                    j <<= 1;
                    j &= (1<<w)-1;
                    nextDp[j] += dp[i];
                    nextDp[j] %= MOD;
                }

                if(i & 1){
                    int k = 0;
                    while(i & (1<<k)){
                        i &= ~(1<<k);
                        k += 2;
                    }
                    i |= 1<<(k-1);
                }else{
                    int k = 1;
                    while(i & (1<<k)){
                        i &= ~(1<<k);
                        k += 2;
                    }
                    i |= 1<<(k-1);
                }
            }

            dp.swap(nextDp);
        }
    }

    for(int i=0; i<(1<<w); ++i){
        ret -= dp[i];
        ret += MOD;
        ret %= MOD;
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll  long long int
#define db long double 
#define ull unsigned long long int
// #define mp make_pair
#define F first
#define S second
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
#define Nmax 1000005
// #define INF 10000000000000
#define MOD 1000000007
#define MAXN 200005
 
using namespace std;

ll mod=998244353;
 
ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}

const ll M=3000006;
ll f[M],inv[M];

void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2,mod);
    for(ll i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
ll C(ll n,ll r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // compute();
    int tests=1;
    // cin>>tests;    
    while(tests--)
    {
    	ll i,j,k,n;
    	cin>>n;
    	ll ans=0;
    	rep(i,1,sqrt(n))
    	{
    		j=i;
    		ll cur=0;
    		while(i*j<n)
    		{
    			j++;
    			cur+=2;
    		}
    		cur--;
    		ans+=max(0LL,cur);
    	}

    	cout<<ans;

    }

    return 0;
}
    

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	vector<int> v;
	int n, k, a;

	cin >> n >> k;
	for (int i = 0;i < n;i++) {
		cin >> a;
		v.emplace_back(a);
	}
	
	std::sort(v.begin(), v.end());

	int sum = 0;
	for (int i = 0;i < k;i++) {
		sum += v[i];
	}

	cout << sum << "\n";

	return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

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

        boolean result = a.length() == b.length() - 1 && a.equals(b.substring(0, a.length()));
        System.out.println(result ? "Yes" : "No");
    }
}

Measured memory_bytes: 35656
n,m = map(int,input().split())
nn = n-1
mm = m-1
XList = list(map(int,input().split()))
YList = list(map(int,input().split()))

XDiff = [0] * nn
YDiff = [0] * mm
for i in range(nn):
    XDiff[i] = XList[i+1]-XList[i]
for i in range(mm):
    YDiff[i] = YList[i+1]-YList[i]

MOD = 10**9+7 
sumx = 0
sumy = 0
for i in range(1,n):
    sumx += (i*(n-i))*XDiff[i-1] 
    sumx %= MOD
for i in range(1,m):
    sumy += (i*(m-i))*YDiff[i-1]
    sumy %= MOD

ans = sumx*sumy%MOD
print(ans)


Measured memory_bytes: 19068
#include <stdio.h>
int isPrime(int);

int main()
{
    int n, i, itg, num = 0;

    scanf("%d", &n); 
    for (i = 0; i < n; i++)
    {
        scanf("%d", &itg);
        if (isPrime(itg)) ++num;
    }
    printf("%d\n", num);
    return 0;
}

int isPrime(int itg)
{
    int i;

    if (itg < 2) return 0;
    for (i = 2; i * i <= itg; i++)
    {
        if (itg % i == 0) return 0;
    }
    return 1;
}



Measured memory_bytes: 1956
def ope(s,c):
    ret = ""
    for i in range(len(s)-1):
        if s[i] == c or s[i+1] == c:
            ret += c
        else:
            ret += s[i]
    return ret

def is_filled(s,c):
    for i in s:
        if i != c:
            return False
    else:
        return True

def main():
    s = input()
    ans = 114514
    for i in range(97,97+26):
        c = chr(i)
        if not c in s: continue
        si = s

        turn = 0
        while not is_filled(si,c):
            si = ope(si,c)
            turn += 1
        
        ans = min(ans,turn)
    print(ans)

        
main()


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>
#include <cstring>
#include <unordered_map>

using namespace std;

#define ll long long
#define MOD 1000000007
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());


int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    vector<int> a(n);
    for (int i = 0; i<n; ++i)cin >> s[i] >> a[i];
    vector<int> ord(n);
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&](int x, int y) {
        if (s[x] == s[y])return a[x]>a[y];
        return s[x]<s[y];
    });
    for (auto e : ord)cout << e + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
import collections

h,w=map(int,input().split())
color=[[0]*w for _ in range(h)]
for i in range(h):
  s=input()
  for j in range(w):
    if s[j]=='#':
      color[i][j]=1
used=[[0]*400 for _ in range(400)]
ans=0
bc=0
wc=0
for i in range(0,h):
  for j in range(0,w):
    if used[i][j]==1:
      continue
    bc=0
    wc=0
    q=collections.deque()
    used[i][j]=1
    q.append([i,j])
    while 1:
      if len(q)==0:
        break
      else:
        ti,tj=q.popleft()
        if color[ti][tj]==1:
          bc+=1
        else:
          wc+=1
        if ti-1>=0:
          if color[ti][tj]!=color[ti-1][tj]:
            if used[ti-1][tj]==0:
              used[ti-1][tj]=1
              q.append([ti-1,tj])
        if ti+1<=h-1:
          if color[ti][tj]!=color[ti+1][tj]:
            if used[ti+1][tj]==0:
              used[ti+1][tj]=1
              q.append([ti+1,tj])
        if tj-1>=0:
          if color[ti][tj]!=color[ti][tj-1]:
            if used[ti][tj-1]==0:
              used[ti][tj-1]=1
              q.append([ti,tj-1])
        if tj+1<=w-1:
          if color[ti][tj]!=color[ti][tj+1]:
            if used[ti][tj+1]==0:
              used[ti][tj+1]=1
              q.append([ti,tj+1])
    ans+=bc*wc
print(ans)

Measured memory_bytes: 5868
#include <stdio.h>

int main(){
    int A, B;

    scanf("%d%d", &A, &B);

    int ans_list[] = {0, 0, 0};

    ans_list[A - 1] = 1;
    ans_list[B - 1] = 1;

    for(int i = 0; i < 3; i ++){
        if(ans_list[i] == 0){
            printf("%d\n", i + 1);

            break;
        }
    }
}

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

int main() {
  string S, T;
  cin >> S >> T;
  bool ok = false;
  for(int i = 0; i< S.size(); i++){
    S = S.back() + S.substr(0, S.size() - 1);
    if(S == T){
      ok = true;
      break;
    }
  }
  if(ok){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,d = iim()
cd = []
for i in range(n):
    cd.append(iil())
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        di = sum([(y-x)**2 for (x,y) in zip(cd[i],cd[j])])**0.5
        if di == int(di):
            cnt += 1

print(cnt)

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string ss,tt;cin>>ss>>tt;
    for(int i=0;i<(int)ss.size();i++){
      if(ss[i]!=tt[i]){
        cout<<"No"<<endl;
        return 0;
      }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 3652
import sys

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

T = ['dream', 'dreamer', 'erase', 'eraser']

S = input().rstrip()
S = S[::-1]
#print(S)

cur = 0
while cur < len(S):
	#print(cur, S[cur:])
	for t in T:
		#print(S[cur:cur+len(t)], t[::-1])
		if S[cur:cur+len(t)] == t[::-1]:
			cur += len(t)
			break
	else:
		print('NO')
		break
else:
	print('YES')

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

#define INF INT_MAX;
#define F first
#define S second

int main(){
  int n;
  int cnt=1;
  int a[100005];

  scanf("%d",&n);

  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  
  for(int i=1;i<n;i++){
    if(a[i-1]>=a[i]) cnt++;
  }

  printf("%d\n%d\n",cnt,n);
  
  return 0;
}


Measured memory_bytes: 3588
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<array>
#include<vector>
//#include<bits/stdc++.h>

using namespace std;
typedef long long ll;


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

vector< pair<ll,int> > factorize(ll n){
	vector< pair<ll, int> > res;
	for(ll i = 2; i*i <=n;i++){
		if(n%i) continue;
		res.emplace_back(i,0);
		while(n%i ==0){
			n /= i;
			res.back().second++;
		}
	}
	if(n != 1)res.emplace_back(n,1);
	return res;
}

int pf(ll a/*, int* c*/){
	int j=1;
	ll b=a;
	double d = sqrt(a);
	//c[0] = 1;
	for(ll i=2;i*i<=a;i++){
		if(b%i != 0){
			continue;
		}else if(b%i == 0){
			//cout << i << " ";
			//c[j]= i;
			j++;
			while(b%i == 0){
				b = b/i;
			}
		}
		
	}
	//cout << "\n";
	return j;
}


int main()
{
	ll A, B, C;
	cin >> A >> B;
	C = gcd(A,B);
	//cout << C << "\n";
	//int c[C];
	//count = pf(C,/*c*/);
	auto f = factorize(C); 
	int count = f.size()+1;
	cout << count << endl;

	return 0;
}

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

int main() {
  int k,x;
  cin >> k >> x;
  if (k*500 >= x) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    vector<ll> x(n);
    for(int i=0;i<n;i++) cin >> x[i];
    ll cost=0;
    for(int i=1;i<n;i++){
        if( (x[i]-x[i-1])*a > b ) cost += b;
        else cost += (x[i]-x[i-1])*a;
    }
    cout << cost << endl;
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    long a[N], b[N];
    long process_count = 0;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        process_count -= a[i];
    }
    for(int i = 0; i < N; i++){
        cin >> b[i];
        process_count += b[i];
    }
    long need_process = 0;
    for(int i = 0; i < N; i++){
        if(b[i] > a[i]){
            need_process += (b[i] - a[i] + 1) / 2 + (b[i] - a[i]) % 2;
        }else{
            need_process += a[i] - b[i];
        }
    }
    if(need_process <= process_count * 2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 384
n,a,b = map(int, input().split())
sum_n = 0
ans = 0
for i in range(n+1):
    sum_n = 0
    N = [0]
    N = list(str(i))
    for j in range(len(N)):
        sum_n += int(N[j])
    if a <= sum_n and sum_n <= b:
        ans += i
print(ans)

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

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  int N;

  int a[100001];

  int cnt[100001]={ };

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

    cnt[a[i]+1]++;
    cnt[a[i]]++;
    cnt[a[i]-1]++;
  }

  sort(cnt,cnt+100001,greater<int>());

  cout<<cnt[0]<<endl;

  return 0;

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define OO 2e18
#define oo 1e9
#define yalla ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define sz  100005
#define re return
#define mod  1000000007
#define pi acos(-1)
using namespace std;

int n,ans[sz][3],a[sz],b[sz],c[sz];
int main()
{yalla;
 cin>>n;

for(int i=0;i<n;i++)
 cin>>a[i]>>b[i]>>c[i];
 
 ans[0][0]=a[0], ans[0][1]=b[0], ans[0][2]=c[0];
 ///
 for(int i=1;i<n;i++)
 {
  ans[i][0]=max(ans[i-1][1],ans[i-1][2])+a[i];
  ans[i][1]=max(ans[i-1][0],ans[i-1][2])+b[i];
  ans[i][2]=max(ans[i-1][0],ans[i-1][1])+c[i];
 }
 cout<<max(ans[n-1][0],max(ans[n-1][1],ans[n-1][2]) )<<endl;
 re 0;
}




Measured memory_bytes: 2560
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int MOD = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 素数
vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// べき乗の余り
ll modpow(ll a, ll n, ll mod){
    ll res = 1;
    while(n){
        if(n & 1){
            (res *= a) %= mod;
        }else{
            (a *= a) %= mod;
        }
        n >>= 1;
    }
    return res;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ld a, b, x;
    cin>>a>>b>>x;

    ld ans = 0;
    if(x <= a * a * b / 2){
        ld t = x * 2 / a / b;
        ans = atan(b / t) * (180 / M_PI);
    }else{
        ld t = (a * b - x / a) * 2 / a;
        ans = 90 - atan(a / t) * (180 / M_PI);
    }
    cout<<setprecision(10)<<ans<<endl;

    return 0;
}

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

int main(){
    long long n;
    cin >> n;
    
    long long max;
    for(int i = 1; i <= sqrt(n); i++){
        if(n % i == 0){
            max = i;
        }
    }
    
    long long ans = (max - 1) + (n/max -1);

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
# A - Cookie Exchanges

A, B, C = map(int, input().split())
ans = 0

if A==B and B==C and C%2==0:
    ans = -1
else:
    while A%2==B%2==C%2==0:
        ans += 1
        A, B, C = (B+C)/2, (C+A)/2, (A+B)/2

print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
int main(){
  int d,i,j,s,N,K,ans;
  scanf("%d%d",&N,&K);
  int check[N];
  for(i=0;i<N;i++)
    check[i]=0;
  for(i=0;i<K;i++){
    scanf("%d",&d);
    for(j=0;j<d;j++){
      scanf("%d",&s);
      check[s-1]++;
    }
  }
  ans=0;
  for(i=0;i<N;i++){
    if(check[i]==0)
      ans++;
  }
  printf("%d\n",ans);
  return 0;
}
  

Measured memory_bytes: 1736
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
  int N,M;
  string input;
  map<string ,int> score;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> input;
    score[input]++;
  }
  cin >> M;
  for(int i = 0; i < M; i++){
    cin >> input ;
    score[input]--;
  }
  int maxScore = 0;
  for( auto i = score.begin(); i != score.end() ; i++ ) {
      maxScore = max(i->second ,maxScore);
  }
  cout << maxScore << endl;
}


Measured memory_bytes: 256
h,w = map(int,input().split())
m = [input() for _ in range(h)]

for i in range(h):
    l = ''
    for j in range(w):
        if m[i][j] == '#':
            l += '#'
        else:
            l += str(sum([t[max(0,j-1):min(w,j+2)].count('#') for t in m[max(0,i-1):min(h,i+2)]]))
    print(l)



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}

int main(){
  int a,b,c;
  cin >> a >> b >>c;
  cout<< max(0,c-(a-b)) <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(string,s);
	int ans = 0,tmp=0;
	REP(i,s.size()){
		switch(s[i]){
		case 'A':
		case 'C':
		case 'G':
		case 'T':
			++tmp;
			break;
		default:
			ans = max(ans,tmp);
			tmp = 0;
			break;
		}
	}
	ans = max(ans,tmp);
	OUT(ans)BR;
	
  return 0;
}


Measured memory_bytes: 256
import fractions
from functools import reduce

MOD = 10**9 + 7

def main():
    N = int(input())
    A = list(map(int, input().split()))

    def lcm_base(x, y):
        return (x * y) // fractions.gcd(x, y)

    def lcm_list(numbers):
        return reduce(lcm_base, numbers, 1)

    l = lcm_list(A)
    ans = 0

    for x in A:
        ans += l // x
        
    print(ans % MOD)

    
if __name__ == "__main__":
    main()


Measured memory_bytes: 6100
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------


int main(){
ll a,b,c;
cin>>a>>b>>c;
cout<<(a*b)/2<<endl;
}









Measured memory_bytes: 384
//rohitaas_15
#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;
//typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> o_set;
#define ll  long long
#define int ll
#define um(a,b) unordered_map<a,b>
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(),v.end()
#define f(a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define show(x) cout<<x<<"\n"
#define printvector(v,x,n) f(x,n-1){cout<<v[i]<<" ";}
#define input(v,n) f(0,n-1){cin>>v[i];}
#define vr vector<ll>
#define check() cout<<"hi"<<"\n"
#define MOD 1000000007
//#define endl "\n"
#define len() length()
#define con continue
#define maxv(v) *max_element(all(v));
#define minv(v) *min_element(all(v));
#define sumv(v) accumulate(all(v),0)
#define test() ll t;cin>>t;while(t--)
ll search(vr arr, ll l, ll r, ll x){if (r >= l) {ll mid = l + (r - l) / 2;if (arr[mid] == x)return mid;if (arr[mid] > x)return search(arr, l, mid - 1, x);return search(arr, mid + 1, r, x);} return -1;}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll lcm(ll a , ll b){return (a*b)/ gcd(a,b);}
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){ if (y & 1) res = (res*x) % p; y = y>>1;x = (x*x) % p; } return res; }
ll modInverse(ll n, ll p){return power(n, p-2, p);}
ll CmP(ll n, ll r, ll p=MOD){if (r==0)return 1;ll fac[n+1];fac[0] = 1;for (ll i=1 ; i<=n; i++)fac[i] = fac[i-1]*i%p; return (fac[n]* modInverse(fac[r], p) % p *modInverse(fac[n-r], p) % p) % p; }
/*ll constructSTUtil(vr v,ll start,ll end,int *st,ll index)
{
	if(start==end)
	{
		st[index]=v[start];
		return st[index];
	}
	ll mid=(start+end)/2;
	st[index]=constructSTUtil(v,start,mid,st,2*index)+constructSTUtil(v,mid+1,end,st,2*index+1);
	return st[index];
}
ll *constructST(vr v,ll n)
{
	ll po=(ll)(ceil(log2(n)));
	ll msize=2*power(2,po)+1;
	vr st[msize];
	constructSTUtil(v,0,n-1,st,1);
	return st;
}*/
ll ask1(ll y)
{
	cout<<1<<" "<<y<<endl;
	ll x;
	cin>>x;
	return x;
}


signed main()
{
	fastio();///*
	/*#ifndef ONLINE_JUDGE
	 freopen("input.txt","r",stdin);
	 freopen("output.txt","w",stdout);
	 #endif
	 */

	 int t=1;
	 //cin>>t;
	 int cccc=t;
	while(t--)
	 {
	 	ll n;
	 	cin>>n;
	 	ll x=n%10;
	 	if(x==2 || x==4 || x==5 || x==7 || x==9)
	 	{
	 		show("hon");
	 	}
	 	else if(x==0 || x==1 || x==6 || x==8)
	 	{
	 		show("pon");
	 	}
	 	else if(x==3)
	 	{
	 		show("bon");
	 	}






	 }


	 	/*cout<<"Case #"<<cccc-t<<": ";*/





}


Measured memory_bytes: 3656
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


void solve() {
    int N; cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    sort(A.begin(), A.end());

    vector<bool> judge(A[N-1], true);

    for (int i = 0; i < N-1; i++) {
        if (judge[A[i]]) {
            for (int j = A[i] * 2; j <= A[N-1]; j+=A[i]){
                judge[j] = false;
                //cout << j << endl;
            }
        }
        if (A[i] == A[i+1]) {
            judge[A[i]] = false;
            judge[A[i+1]] = false;
        }
    }

    

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (judge[A[i]]) ans++;
    }


    cout << ans << endl;
}


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

Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
const int N = 2e6+1;
int a[N],sum[N]={0};
int main (){
	memset(a,0,sizeof(a));
	for (int i=1;i<1000000;i++) a[i]=1;
	for (int i=2;i<1000000;i++)
		for (int j=i;j<1000000;j+=i)
			a[j]++;
		sum[1]=a[1];
	for (int i=1;i<1000000;i++)
		sum[i]=sum[i-1]+a[i];
	int n;
	cin>>n;
	cout<<sum[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 15284
using System.Linq;
using System.Collections.Generic;
using System;

public class C
{
    public int c { get; set; }
}

public class Info
{
    public int node { get; set; }
    public string via { get; set; }
}

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var map = new bool[n, n];
        for (int i = 0; i < m; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]) - 1;
            var b = int.Parse(line[1]) - 1;
            map[a, b] = true;
            map[b, a] = true;
        }
        var c = new C();
        goBfs(map, c);
        Console.WriteLine(c.c);
    }
    public static void goBfs(bool[,] map, C c)
    {
        var n = map.GetLength(0);
        var q = new Queue<Info>();
        q.Enqueue(new Info { node = 0, via = "" });
        while (q.Count() > 0)
        {
            var a = q.Dequeue();
            if (a.via.Length + 1 == n && !a.via.Contains(a.node.ToString())) { c.c++; goto next; }
            for (int i = 0; i < n; i++)
                if (map[a.node, i] && !(a.via + a.node.ToString()).Contains(i.ToString()))
                    q.Enqueue(new Info { node = i, via = a.via + a.node.ToString() });
            next:;
        }
    }
}

Measured memory_bytes: 17924
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;

//map<long long , int> pa;

int main()
{
  double ans=0;
  int N,K,i,j,t;
  double a,sum;
  
  cin>>N>>K;
  sum=0;
  double p[N+1]={};
  
  //連番K個の期待値を算出
  for(i=0;i<N+1;i++)
  {
    cin>>a;
    sum+=a+1;
    p[i+1]=sum;
   // cout<<p[i];
  }
  for(i=0;i<N-K+1;i++)
  {
    sum=p[i+K]-p[i];
    ans=max(sum,ans);
  }
  //cout<<ans;
  printf("%.10f",ans/2);
       
}

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

int main(){
  long long int a,b,c;
  cin >> a >> b >> c;
  long long int f=a-b+1;
  long long ans=0;
  if(c-b>2){
    ans=(c-b)*(f/2)+(f%2)+b;
  }
  else{
    ans=1+a;
  }
  cout << ans << endl;
}

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

int main(){
    int n;
    scanf("%d",&n);
    bool f[n][10];
    int p[n][11];
    int cnt[n]={0};
    long long ans=0;
    for (int i=0;i<n;i++) for (int j=0;j<10;j++) {
        cin>>f[i][j];
    }
    for (int i=0;i<n;i++) for (int j=0;j<11;j++) cin>>p[i][j];

    long long tmp;
    for (int i=1;i<(1<<10);i++) {
        tmp=0;
        for (int x=0;x<n;x++) cnt[x]={0};
        for (int j=0;j<10;j++) {
            if (i&(1<<j)) for (int k=0;k<n;k++) if (f[k][j]) cnt[k]++;
        }
        for (int l=0;l<n;l++) tmp+=p[l][cnt[l]];
        if (i==1) ans=tmp;
        else ans=max(ans,tmp);
    }
    printf("%lld\n",ans);
    return 0;
}


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

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = 1LL<<60;
const ll MOD = 1000000007;

//cout << fixed << setprecision(10);

int main() {
    ll H, W, N;
    cin >> H >> W >> N;
    vector<ll> A(N),B(N);
    map<Pll,ll> mp;
    ll dx[9] = {0,0,1,1,1,0,-1,-1,-1};
    ll dy[9] = {0,1,1,0,-1,-1,-1,0,1};
    for(int i=0;i<N;i++){
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
        for(int k=0;k<9;k++){
            ll nx = B[i]+dx[k];
            ll ny = A[i]+dy[k];
            if(nx<1 || nx>=W-1 || ny<1 || ny>=H-1)continue;
            mp[Pll(nx,ny)]++;
        }
    }
    vector<ll> res(10,0);
    ll sum=0;
    for(auto e : mp){
        res[e.second]++;
        //cout << e.first.first << " " << e.first.second <<" " << e.second <<  endl;
    }
    res[0]=(H-2)*(W-2) - mp.size();
    
    for(int i=0;i<10;i++){
        cout << res[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 60160
mod=10**9+7
s=int(input())
dp=[1]*(s+1)
if s==1 or s==2:
    print(0)
    quit()
for i in range(3,s+1):
    for j in range(3,i-2):
        dp[i]+=dp[j]
print(dp[s]%mod)



Measured memory_bytes: 74040
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

int n;
int a[2100000];
int b[2100000];
int c[10500];

void CountingSort(int k)
{
	for (int i = 0; i <= k; i++) {
		c[i] = 0;
	}

	for (int i = 0; i < n; i++) {
		c[a[i]]++;
	}
	for (int i = 1; i <= k; i++) {
		c[i] += c[i - 1];
	}

	for (int i = n - 1; i >= 0; i--) {
		b[c[a[i]]] = a[i];
		c[a[i]]--;
	}

}

int main()
{
	cin >> n;
	int mx = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		mx = max(mx, a[i]);
	}
	CountingSort(mx);

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

	return 0;
}

Measured memory_bytes: 18740