akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
using namespace std;

using ll = long long;

int main() {
    ll N, V;
    cin >> N >> V;
    vector<vector<ll>> v(4, vector<ll>(N));
    for(int i=0; i<4; ++i) {
        for(int j=0; j<N; ++j) {
            cin >> v[i][j];
        }
    }
    map<ll, ll> m1, m2;
    for(int i=0; i<N; ++i) {
        for(int j=0; j<N; ++j) {
            m1[v[0][i]+v[1][j]]++;
            m2[v[2][i]+v[3][j]]++;
        }
    }
    ll res = 0;
    for(auto& p : m1) {
        if(m2.count(V-p.first) != 0) {
            res += p.second * m2[V-p.first];
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 128168
#include<bits/stdc++.h>
     
    using namespace std;
     
    #define INF 1000000007
    #define LINF 1000000000000000007
     
    typedef long long ll;
    typedef pair<ll,ll> P;
     
    int d, n;
     
    ll jou(int i){
    	ll a = 1;
    	while(i--){
    		a *= 100;
    	}
    	return a;
    }
     
    int main(){
    	cin >> d >> n;
    	
    	if(n != 100) cout << jou(d) * n << endl;
		else cout << jou(d)*(n+1) << endl;
    	
    	return 0;
    }

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


int main()
{
	int i,N,K;
	cin>>N>>K;
	vector<long> H(N);
	for(i=0;i<N;i++){
		cin >> H[i];
	}
	long long P=0;
	sort(H.begin(), H.end());
	for(i=0;i<N-K;i++){
		P+=H[i];
	}
	cout<< P <<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long a, b, h;
  cin >> a >> b >> h;
  cout << (a+b) * h / 2 << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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


int main(){
    int N; cin>>N;
    int A[100010];
    for(int i=1;i<=N;i++)cin>>A[i];
    A[0]=0;
    A[N+1]=0;
    int D=0;
    for(int i=1;i<=N+1;i++){
        D+=abs(A[i]-A[i-1]);
    }
    for(int i=1;i<=N;i++){
        cout<<D-(abs(A[i+1]-A[i])+abs(A[i]-A[i-1]))+abs(A[i+1]-A[i-1])<<endl;
    }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii > vii;
typedef vector<pll > vll;
#define pb push_back
#define mp make_pair 
#define mod 1000000007
#define F first
#define S second
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
#define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define debug_arr(a,n) {{for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}cout<<"\n";}}
#define int ll 

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

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    // #ifndef ONLINE_JUDGE
    // freopen("inp.txt", "r", stdin);
    // freopen("out.txt", "w", stdout); 
    // #endif

    int n;
    cin>>n;

    int a[n+1];
    inp_arr(a,n+1);


    int sum[n+2] = {0};

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

    // debug_arr(sum,n+1);

    int vertices = 0;
    int cur = 1;

    int ans = -1;

    for(int i=0;i<=n;++i) {

        vertices += cur;

        if(cur < a[i]) {
            vertices = -1;
            break;
        }
        else {
            cur -= a[i];
            cur *= 2;
            int nextleaves = sum[i+1];
            // cout<<cur<<"--"<<nextleaves<<"\n";
            if(nextleaves < cur) {
            //     cur = nextleaves;
                int d = min(cur, cur - nextleaves);
                cur -= d;
            }
            

            // cout<<cur<<" "<<nextleaves<<"\n";

            
        }
    }

    ans = vertices;
    cout<<vertices;

    return 0;
}

Measured memory_bytes: 5184
MOD = 10**9+7


def make_combination_table(n):
    fact = [1]
    for i in range(1, n+1):
        fact.append(fact[i-1] * i % MOD)

    ifact = [0] * (n+1)
    ifact[n] = pow(fact[n], MOD-2, MOD)
    for i in range(n, 0, -1):
        ifact[i-1] = ifact[i] * i % MOD
    return (fact, ifact)


def mod_combination(n, r, table):
    if r > n:
        return 0
    return table[0][n] * table[1][n - r] * table[1][r] % MOD


def sum_rect(r, c, table):
    return (mod_combination(r+c+2, r+1, table)-1) % MOD


def main():
    r1, c1, r2, c2 = map(int, input().split())
    table = make_combination_table((r2+c2+2))
    r1 -= 1
    c1 -= 1

    ans = sum_rect(r2, c2, table)
    ans %= MOD
    ans -= sum_rect(r2, c1, table)
    ans %= MOD
    ans -= sum_rect(r1, c2, table)
    ans %= MOD
    ans += sum_rect(r1, c1, table)
    ans %= MOD
    print(ans)


main()


Measured memory_bytes: 125112
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;
static const int MAX_M = 100000;

int dat[MAX_M*3],lazy[MAX_M*3];

class LazySegmentTree{
public:

    int n;
    LazySegmentTree(vector<int> v){
        n=1;
        while(n<v.size())n*=2;
        for(int i=0;i<v.size();++i)dat[n+i-1]=v[i];
        for(int i=0;i<2*n-1;++i)lazy[i]=0;
        for(int i=n-2;i>=0;--i)dat[i]=dat[2*i+1]+dat[2*i+2];
    }

    void eval(int k,int l,int r){
        if(lazy[k]!=0){
            dat[k]+=lazy[k];
            if(r-l>1){
                lazy[2*k+1]+=lazy[k]/2;
                lazy[2*k+2]+=lazy[k]/2;
            }
            lazy[k]=0;
        }
    }

    void add(int a,int b,int x,int k,int l,int r){
        eval(k,l,r);
        if(b<=l||r<=a)return;
        if(a<=l&&r<=b){
            lazy[k]+=(r-l)*x;
            eval(k,l,r);
        }
        else{
            add(a,b,x,2*k+1,l,(l+r)/2);
            add(a,b,x,2*k+2,(l+r)/2,r);
            dat[k]=dat[2*k+1]+dat[2*k+2];
        }
    }

    int query(int a,int b,int k,int l,int r){
        eval(k,l,r);
        if(b<=l||r<=a)return 0;
        if(a<=l&&r<=b)return dat[k];
        int vl = query(a,b,2*k+1,l,(l+r)/2);
        int vr = query(a,b,2*k+2,(l+r)/2,r);
        return vl+vr;
    }
};

int N,M;
int L[MAX_M*3],R[MAX_M*3];
vector<P1> len[MAX_M*3];
LazySegmentTree seg(vector<int>(MAX_M,0));
int pre;

void solve(int d){
    int res=N-(pre+len[d].size());
    pre+=len[d].size();
    for(auto v : len[d]){
        int l = v.first,r = v.second;
        seg.add(l,r+1,1,0,0,seg.n);
    }
    int x=0,t=1;
    while(1){
        if(x>M)break;
        res+=seg.query(x,x+1,0,0,seg.n);
        x=d*t;
        t++;
    }
    cout<<res<<endl;
}


signed main(){
    cin>>N>>M;
    for(int i=0;i<N;++i){
        cin>>L[i]>>R[i];
        len[R[i]-L[i]+1].PB(P1(L[i],R[i]));
    }
    for(int i=1;i<=M;++i){
        solve(i);
    }
}


Measured memory_bytes: 24432
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
Int dp[1010][1010];
signed main(){
  string t,b;
  cin>>t>>b;
  Int n=t.size(),m=b.size();
  b.push_back('$');
  memset(dp,0,sizeof(dp));
  dp[0][0]=1;
  
  const Int MOD = 1e9+7;
  for(Int i=0;i<n;i++){
    for(Int j=0;j<=m;j++){
      if(t[i]==b[j]){
	dp[i+1][j+1]+=dp[i][j];
	dp[i+1][j+1]%=MOD;
      }
      dp[i+1][j]+=dp[i][j];
      dp[i+1][j]%=MOD;	
    }
  }
  cout<<dp[n][m]<<endl;
  return 0;
}



Measured memory_bytes: 11140
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define INF 100000000000ULL

size_t a[2][2019];

void solve() {
    string s1, s2;
    cin >> s1 >> s2;
    if (strncmp(s1.c_str(), s2.c_str(), s1.length()) == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

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

    solve();

    return 0;
}

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

using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'

int main()
{
	//IOS
	
	
	int a,f = 0;
	
	cin >> a;
	
	for(int i = 1; i <= 9; i++)
	{
		if(f == 1) break;
		if(a%i == 0)
		{
			int b = a/i;
			if(b >= 1 && b <= 9) {cout << "Yes\n";f = 1;}
		}
	}
	if(f == 0) cout << "No\n";
	
	return 0;
}


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

int main() {

  long long K;
  cin >> K;

  if(K % 7 == 0){
    K = K / 7;
  }

  long long tmp = 1;
  int cnt = -1;
  for(int i = 1; i <= 1000000; i++){
    tmp = tmp % K;
    if(tmp == 0){
      cnt = i;
      break;
    }
    tmp = tmp * 10 + 1;
  }
  cout << cnt << endl;
}

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

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	long a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k<=a) cout<<k<<endl;
	else {
		if(k>a && k<=a+b) cout<<a<<endl;
		else cout<<a-(k-(a+b))<<endl;
	}

	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define int long long
using namespace std;
int N,M;
int w[1111][3];
long long ans;
priority_queue<pair<int,int>>pq[8];
signed main(){
    cin>>N>>M;
    for(int i=0;i<N;i++){
        int x,y,z;
        cin>>x>>y>>z;
        w[i][0]=x;
        w[i][1]=y;
        w[i][2]=z;
        for(int j=0;j<8;j++){
            long long l=0LL;
            switch(j){
                case 0:
                l=x+y+z;
                break;
                case 1:
                l=x+y-z;
                break;
                case 2:
                l=x-y+z;
                break;
                case 3:
                l=x-y-z;
                break;
                case 4:
                l=-x+y+z;
                break;
                case 5:
                l=-x+y-z;
                break;
                case 6:
                l=-x-y+z;
                break;
                case 7:
                l=-x-y-z;
                break;
            }
            pq[j].push({l,i});
        }
    }
    for(int i=0;i<8;i++){
        int tmp=M;
        long long x=0LL,y=0LL,z=0LL;
        while(tmp--){
            x+=w[pq[i].top().second][0];
            y+=w[pq[i].top().second][1];
            z+=w[pq[i].top().second][2];
            pq[i].pop();
        }
        switch(i){
            case 0:
            if(x>=0&&y>=0&&z>=0)ans=max(ans,x+y+z);
            break;
            case 1:
            if(x>=0&&y>=0&&z<=0)ans=max(ans,x+y-z);
            break;
            case 2:
            if(x>=0&&y<=0&&z>=0)ans=max(ans,x-y+z);
            break;
            case 3:
            if(x>=0&&y<=0&&z<=0)ans=max(ans,x-y-z);
            break;
            case 4:
            if(x<=0&&y>=0&&z>=0)ans=max(ans,-x+y+z);
            break;
            case 5:
            if(x<=0&&y>=0&&z<=0)ans=max(ans,-x+y-z);
            break;
            case 6:
            if(x<=0&&y<=0&&z>=0)ans=max(ans,-x-y+z);
            break;
            case 7:
            if(x<=0&&y<=0&&z<=0)ans=max(ans,-x-y-z);
            break;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 384
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	int INF = 1 << 28;
	int MAX = 123456 * 2;
	boolean[] ip = new boolean[MAX+1];
	void run() {
		Scanner sc = new Scanner(System.in);
		ip[0] = ip[1] = true;
		for (int i = 2; i < ip.length; i++) if( !ip[i]) {
			for(int j=i*2;j<=MAX;j+=i) ip[j] = true;
		}
		
		for(;;) {
			int n = sc.nextInt();
			if( n == 0) break;
			int cnt=0;
			for(int i=n+1;i<=2*n;i++) if(!ip[i]) cnt++;
			System.out.println(cnt);
		}
	}

	public static void main(String[] args) {
		try {
			System.setIn(new FileInputStream("A.in"));
			System.setOut(new PrintStream(new FileOutputStream("A.out")));
		} catch(Exception e){
		
		}
		new Main().run();
	}
	
	
}

Measured memory_bytes: 13000
import numpy as np

N = int(input())

digit_max = len(str(N))

if digit_max ==2:
    ans =9
elif digit_max ==1:
    ans = N
elif digit_max >2:
    count=0
    for i in range(int(np.ceil(digit_max/2)-1)):
        j = 2*i+1
        count+=9*10**(j-1)
    if digit_max%2 ==1:
        count+=N-10**(digit_max-1)+1
    elif digit_max%2 ==0:   
        count+=9*10**(digit_max-2)
        
    ans = count
    
print(ans)
    

Measured memory_bytes: 12424
n = int(input())
x = list(map(int,input().split()))

count = 0
if 1 in x:
    try:
        j = 0
        for i in range(n):
            while x[j]!=(i+1):
                j = j+1
                count += 1    
            j +=1        
        print(count)
    except:
        print(count)
else:
    print(-1)

Measured memory_bytes: 24744
process.stdin.on("data",function(c){
	var k=[],m=1,t=0,p;
	(c+"").trim().split("\n").sort(function(a,b){
		return a-b;
	})
	.map(function(n){
		p==n?t++:((t>m?(k=[p],m=t):t==m?(k.push(p),m=t):0),(t=0));
		p=n;
	});
	console.log(k.join("\n"));
}).resume();

Measured memory_bytes: 7912
#include <iostream>
using namespace std;
long long pow5(long long n) {
    return n*n*n*n*n;
}
int main() {
    int x;
    cin >> x;
    for (long long i=-200; i<200; i++) {
        for (long long j=-200; j<i; j++) {
            if (pow5(i) - pow5(j) == x) {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 1e5 + 10;
int H, N, A[MAX];

int main(void) {
    cin >> H >> N;
    LL sum = 0;
    REP(i, N) {
        cin >> A[i];
        sum += A[i];
    }

    cout << (sum >= H ? "Yes" : "No") << endl;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include<iostream>

int main() {
    int a,b;
    bool isF = true;
    while (true) {
        scanf("%d%d", &a, &b);
        if (a == 0&&b == 0) {
            break;
        }
        if (!isF) {
            printf("\n");
        }
        isF = false;
        bool isN = true;
        for (int i=a;i<=b;++i){
            if ((i%4==0)&&((i%100!=0)||(i%400==0))){
                printf("%d\n", i);
                isN = false;
            }
        }
        if (isN) {
            printf("NA\n");
        }
    }
    return 0;
}

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

using namespace std;

const int MN = 1e5+10;
typedef long long ll;
typedef pair<int,int> ii;

ii ptos[MN];
ll res[10];

int main()
{
    #ifdef ACMTUYO
    freopen("a.in","r",stdin);
    #else
    cin.tie(0); ios_base::sync_with_stdio(0);
    #endif

    map<ii,ll> m;
    map<ii,ll>::iterator it;
    ll H, W, N;
    /*reading input*/
    cin >> H >> W >> N;
    for (int k=0; k < N; k++){
        ll x,y; cin >> x >> y;
        /*counting rectangles*/
        for (ll i=max(1ll,x-2); i <= min(x,H-2); i++){
            for (ll j=max(1ll,y-2); j <= min(y,W-2); j++){
                m[ii(i,j)]++;
            }
        }
    }

    res[0] = (H-2)*(W-2);
    for (it = m.begin(); it!=m.end(); it++){
        res[0]--;
        res[it->second]++;
    }

    for (int i=0; i <= 9; i++){
        cout << res[i] << "\n";
    }

    return 0;
}


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

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9 + 7;

void FAST(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main(){
  FAST();

  int n, i;
  cin >> n;
  vi arr(n);
  map<int, int> abc;
  REP(i, 0, n - 1){
      cin >> arr[i];
      abc[arr[i] - 1]++;
  }


  REP(i, 0, n){
      cout << abc[i] << endl;
  }


  return 0;
}


Measured memory_bytes: 13556
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //a
  int x;
  cin >> x;
  cout << (x >= 30 ? "Yes\n" : "No\n");
  return 0;
}

Measured memory_bytes: 3596
//#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    int N,K;
    int sum=0;
    cin >> N >> K;
    vector<int> vi(N);
    for(int i=0;i<N;i++){
        cin >> vi[i];
    }
    for(int i=0;i<N;i++){
        if(vi[i]>=K){
            sum++;
        }
    }
    cout << sum << endl;
}

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

int m, n;
int data[101];

bool func( int num ) {
  int sum = 0, cnt = 1;
  for(int i=0; i<n; i++) {
    if( sum + data[i] <= num ) {
      sum += data[i];
    } else {
      sum = data[i];
      cnt++;
    }
  }

  if( cnt <= m ) return true;
  else return false;
}


int main() 
{
  while( cin >> m >> n, m+n ) {
    int ma = 0;
    for(int i=0; i<n; i++) {
      cin >> data[i];
      ma = max(ma, data[i]);
    }
    
    int l = 0, r = 1500000;
    int now;
    while( l != r ) {
      now = (l + r) / 2;
      if( now >= ma && func( now ) ) {
	r = now;
      } else {
	l = now+1;
      }
    }
    
    cout << l << endl;
  }
  
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>

namespace ABC168
{

  class A
  {
  public:
    A() = default;
    ~A() = default;


    void Run()
    {

      int A = 0;
      std::cin >> A;

      auto ichi = A % 10;

      std::string yomi = "";

      switch (ichi)
      {
      case 3:
        yomi = "bon";
        break;
      case 0:
      case 1:
      case 8:
      case 6:
        yomi = "pon";
        break;
      case 2:
      case 4:
      case 5:
      case 7:
      default: // 9
        yomi = "hon";
      }

      std::cout << yomi << std::endl;
    }
  };

}
int main()
{

  ABC168::A prob;
  prob.Run();

  return 0;
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unrolled-loops")
#define y1 hoainambimaysolokill
#define fi first
#define se second
#define PII pair<int,int>
#define PII2 pair<int,pair<int,int> >
#define PII3 pair<pair<int,int>,int >
void solve()
{
   vector<int> a,b;
   int n,x;
   cin>>n;
   for(int i=0;i<n;i++){
        cin>>x;
        a.emplace_back(x);
   }
   a[0]--;
   for(int i=1;i<a.size();i++)
       if(a[i]>a[i-1])a[i]--;
   b=a;
   sort(b.begin(),b.end());
   if(a==b)cout<<"Yes";
   else cout<<"No";
}
main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);cout.tie(0);

    //freopen("TBC.inp", "r", stdin);
    //freopen("FORMMAU.out", "w", stdout);

    //int t;cin>>t;while(t--)

    solve();
}


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

int main()
{
	int N,X;
	cin >> N >> X;
	int mi = 1005;
	rep(i,N)
	{
		int m;
		cin >> m;
		mi = min(mi,m);
		X -= m;
	}
	cout << N + X / mi << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pi pair<int, int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define deb(x) cout << #x << ":" << x << endl;
/* freopen("input.txt", "r", stdin); */
/* freopen("output.txt", "w", stdout); */
const ll inf = 1e17 + 7, MOD = 1e7 + 9;


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

int main() {
	int k;
	cin >> k;
	ll sum = 0;
	for(int i=1;i<=k;i++)
		for(int j=1;j<=k;j++)
			for(int l=1;l<=k;l++)
				sum += gcd(i, gcd(j, l));
	cout << sum << "\n";
	return 0;
}


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

bool in_range(int a, int b){
  return a >= 0 && a < b;
}

int main(){
  int w, h;
  while(cin >> w >> h, w){
    vector<string> A(h);
    for(int i = 0; i < h; ++i) cin >> A[i];
    queue<pair<int,int>> QB, QW;
    for(int i = 0; i < h; ++i){
      for(int j = 0; j < w; ++j){
        if(A[i][j] == 'W') QW.emplace(i,j);
        if(A[i][j] == 'B') QB.emplace(i,j);
      }
    }
    vector<vector<bool>> B(h,vector<bool>(w,false)), W(h,vector<bool>(w,false));
    int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};
    while(not QB.empty()){
      int x = QB.front().first, y = QB.front().second;
      QB.pop();
      for(int j = 0; j < 4; ++j){
        int x_ = x + dx[j], y_ = y + dy[j];
        if((not in_range(x_,h)) or (not in_range(y_,w))) continue;
        if(A[x_][y_] != '.') continue;
        if(not B[x_][y_]){
          B[x_][y_] = true;
          QB.emplace(x_,y_);
        }
      }
    }
    while(not QW.empty()){
      int x = QW.front().first, y = QW.front().second;
      QW.pop();
      for(int j = 0; j < 4; ++j){
        int x_ = x + dx[j], y_ = y + dy[j];
        if((not in_range(x_,h)) or (not in_range(y_,w))) continue;
        if(A[x_][y_] != '.') continue;
        if(not W[x_][y_]){
          W[x_][y_] = true;
          QW.emplace(x_,y_);
        }
      }
    }
    int bl = 0, wh = 0;
    for(int i = 0; i < h; ++i){
      for(int j = 0; j < w; ++j){
        if(B[i][j] == W[i][j]) continue;
        if(B[i][j]) ++bl;
        if(W[i][j]) ++wh;
      }
    }
    cout << bl << " " << wh << endl;
  }
}



Measured memory_bytes: 3192
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define MOD 1000000007
#define oo 1000000000000000000
#define forr(i,n) for(ll i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0) ; cout.tie(0);
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define pb push_back
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
using namespace __gnu_pbds; 
using namespace std;

ll valueOfIndex(ordered_set&s , ll i){ return *(s.find_by_order(i)); }
ll indexOfValue(ordered_set&s , ll x){ return s.order_of_key(x); }
ll add(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a+b + p)%p;}
ll mul(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a*b + p)%p;} // __int128
ll power(ll x,ll n,ll p=MOD){ if(x==0) return 0; if(n==0 || x==1) return 1LL;
    ll r = (power(x,n/2,p))%p; if(n&1) return mul(mul(r,r,p) , x,p); else return mul(r,r,p);
}
ll inv(ll x){return power(x,MOD-2);}


void __sol(){
    int n,m,x; cin >> n >> m >> x;
    int a[n+2][m+3];
    for(int i=0;i<n;i++){
        for(int j=0;j<=m;j++) cin >> a[i][j];
    }
   // int mask = (1<<n);
    int ans = INT_MAX;
    forr(mask,(1<<n)){
        int temp[m+3]; memset(temp,0,sizeof(temp));
        int cost=0;
        forr(i,n){
            if( mask&(1<<i)){
                cost+= a[i][0];
                for(int j=1;j<=m;j++) temp[j]+=a[i][j];
            }
        }
        bool hit=1;
        for(int i=1;i<=m && hit;i++){
            if(temp[i]<x) hit=0;
        }
        if(hit) ans = min(ans , cost);
    }
    if(ans==INT_MAX) cout << -1;
    else cout << ans;
}


int main(){
    fastio
    ll tc=1; //cin >> tc;
    while(tc--) __sol();
    return 0;
}

Measured memory_bytes: 3604
x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())),reverse=True)
q=sorted(list(map(int,input().split())),reverse=True)
r=sorted(list(map(int,input().split())),reverse=True)

l=p[:x]+q[:y]+r
l.sort(reverse=True)
print(sum(l[:x+y]))

Measured memory_bytes: 23200
#include<iostream>
#include<vector>
using namespace std;
int gcd(int x,int y){
  if(x==0)return y;
  if(y==0)return x;
  return gcd(y,x%y);
}

int main(){
  int N,X;
  cin>>N>>X;
  vector<int> x(N);
  int ans = 0;
  for(int i=0;i<N;++i){
    cin>>x[i];
    ans = gcd(abs(X-x[i]),ans);
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
using Graph = vector<vector<int>>;

int main(){
	int n, k, q, p[100100] = {};
	cin >> n >> k >> q;
	rep(i,q){
		int a;
		cin >> a;
		p[a]++;
	}
	for(int i = 1; i <= n; i++) Yes(k - q + p[i] > 0);
}

Measured memory_bytes: 1024
from __future__ import print_function

import sys

# import math
# import string
import fractions
# from fractions import Fraction
from fractions import gcd

# import re
# import array
# import copy
# import functools
# import operator

import collections
# from collections import deque
# from collections import Counter

# import itertools
# import bisect
# import heapq

# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace
# from queue import PriorityQueue as pq
# from itertools import accumulate
# import random
# import time
from operator import mul
# from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


# def lcm(n, m):
#     return int(n * m / gcd(n, m))

# def reduce_x(p, q):
#     common = fractions.gcd(p, q)
#     return (p // common, q // common)

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce_x(mul, range(n, n - r, -1), 1)
#     denom = reduce_x(mul, range(1, r + 1), 1)
#     return numer // denom

# def reverse_range(a, b):  # b < a ,  get [b, a)
#     return range(b, a, -1)  # range(a, b+1, -1)


def main():
    n = int(input().strip())
    s_old = input().strip()
    C = collections.Counter()
    C[s_old] += 1

    s_new = ""

    for i in range(n - 1):
        s_new = input().strip()
        C[s_new] += 1
        if C[s_new] > 1 or s_new[0] != s_old[-1]:
            print("No")
            return
        s_old = s_new
    print("Yes")
    eprint("debug")
    pass
    return


if __name__ == '__main__':
    main()


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

int main(){
  int n;
  while(cin>>n,n){
    vector<vector<int> > vec(n,vector<int>(n+1));
    for(int i=0;i<n;i++){
      for(int j=0;j<=n;j++){
	cin>>vec[i][j];
      }
    }
    int size = 1<<n;
    vector<int> dp(size,1<<30);
    dp[0] = 0;
    for(int i=0;i<size;i++){
      for(int j=0;j<n;j++){
	if(((i>>j)&1) == 1) continue; 
	int _min = vec[j][0];
	for(int k=0;k<n;k++){
	  if(((i>>k)&1) == 1) _min = min(_min,vec[j][k+1]);
	}
	dp[i | (1<<j)] = min(dp[i] + _min,dp[i | (1<<j)]);
      }
    }
    cout<<dp[size-1]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1476
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }


const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long K, long long Q, std::vector<long long> A){
	vector<ll> V(N);
	REP(i, N) V[i] = 0;
	REP(i, Q) {
		ll si = A[i]-1;
		V[si]++;
	}
	REP(i, N) {
		ll sum = Q - V[i];
		if (sum < K) cout << YES << "\n";
		else cout << NO << "\n";
	}
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> A(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, K, Q, std::move(A));
    return 0;
}


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

const long long mod = 998244353;

int main() {
  long long n;
  int k;
  cin >> n >> k;
  vector<pair<int, int>> range;
  for ( int i = 0; i < k; i++ ) {
    int l, r;
    cin >> l >> r;
    range.push_back({l, r+1});
  }

  vector<long long> dp(n);
  dp[0] = 1;
  for ( int i = 0; i < n; i++ ) {
    if ( i > 1 ) { dp[i] += dp[i-1]; dp[i] %= mod; }
    for ( int j = 0; j < k; j++ ) {
      int l, r;
      tie(l, r) = range[j];
      if ( i+l < n ) { dp[i+l] += dp[i]; dp[i+l] %= mod; }
      if ( i+r < n ) { dp[i+r] -= dp[i]; dp[i+r] += mod; dp[i+r] %= mod; }
    }
  }

  cout << dp[n-1] << endl;
  return 0;
}


Measured memory_bytes: 4812
import java.io.*;
import java.util.*;

class Main {
 	public static void main(String args[]) throws IOException {
     	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      	int N = Integer.parseInt(br.readLine());
      	StringTokenizer st = new StringTokenizer(br.readLine());
      	long[] arr = new long[N];
      	long sum = 0;
      	long ans = 0;
      	for(int i=0;i<N;i++) {
         	arr[i] = Long.parseLong(st.nextToken()); 
          	sum += arr[i];
          	sum %= 1000000007;
        }
      	for(int i=0;i<N;i++) {
          	 sum -= arr[i];
             if(sum < 0)
               	sum += 1000000007;
         	 ans += (sum*arr[i]);
          	 ans %= 1000000007;
        }
      	System.out.println(ans);
    }
}

Measured memory_bytes: 55800
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 10
using namespace std;
int ans,n,in[M],len[4];
void dfs(int d,int a,int b,int c,int sum) {
    if (d>n) {
        if (a>0 && b>0 && c>0) {
            ans = min(ans, sum + abs(len[1]-a) + abs(len[2]-b) + abs(len[3]-c));
        }
        return;
    }
    
    dfs(d+1, a, b, c, sum);
    dfs(d+1, a+in[d], b, c, sum + (a==0?0:10));
    dfs(d+1, a, b+in[d], c, sum + (b==0?0:10));
    dfs(d+1, a, b, c+in[d], sum + (c==0?0:10));
}
int main()
{
    while (~scanf("%d",&n)) {
        REP(i,1,3) scanf("%d", &len[i]);
        REP(i,1,n) scanf("%d", &in[i]);

        ans = 2000000000;
        dfs(1, 0, 0, 0, 0);
        printf("%d\n", ans);
    }
    
    return 0;
}



Measured memory_bytes: 256
"use strict";

const main = arg => {
  const a = arg.split(" ").map(x=>parseInt(x));
  if(a[0]+a[1]+a[2]>21){
  	console.log("bust");
  }
  else{
    console.log("win");
  }
  return;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8')); 

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

int setcount(int x) {
    int cnt = 0;
    int test = 1 << 10;
    for (; test; test >>= 1) {
        if (x & test)
            cnt++;
    }
    return cnt;
}

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

    auto lamp_mask = vector<int>(m);

    for (auto &lamp_i : lamp_mask) {
        int mask = 0;

        int k_i;
        cin >> k_i;
        for (int j = 0; j < k_i; j++) {
            int s;
            cin >> s;
            --s;
            mask |= (1 << s);
        }

        lamp_i = mask;
    }

    auto p = vector<int>(m);
    for (auto &p_i : p) {
        cin >> p_i;
    }

    auto cnt = 0LL;
    for (int bits = 0; bits < (1 << n); bits++) {
        int on_cnt = 0;

        for (int i = 0; i < m; i++) {
            auto m = lamp_mask[i] & bits;
            if ((setcount(m) & 1) == p[i])
                on_cnt++;
        }

        if (on_cnt == m)
            cnt++;
    }

    cout << cnt;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <limits.h>
#include <assert.h>
#define FOR(i,a,n) for(i=(a);i<(n);i++)
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define MOD 1000000007
#define SIZE 100005
#define LOCAL
#ifdef LOCAL
    #define DEBUG(...) printf(__VA_ARGS__)
#else
    #define DEBUG(...)
#endif
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
ll a[7];
int main(void)
{
	int i;
	ll n1,n2;
	FOR(i,0,7) scanf("%lld",a+i);
	n1=n2=a[1];
	if(a[0]>0&&a[3]>0&&a[4]>0) n1+=(a[0]-1)/2*2+(a[3]-1)/2*2+(a[4]-1)/2*2+3;
	n2+=a[0]/2*2+a[3]/2*2+a[4]/2*2;
	printf("%lld\n",MAX(n1,n2));
	return 0;
}
    

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(void){
  int n;
  cin >> n;
  long long a[n];
  long long temp;
  int b[n];
  for(int i = 0; i < n; i++){
    cin >> temp;
    if(temp % 2 == 1) temp = 0;
    a[i] = temp;
    b[i] = 0;
  }
  int p;
  for(int i = 0; i < n; i++){
    p = 0;
    while(a[i] % 2 == 0 && a[i] > 0){
      p++;
      a[i] /= 2;
    }
    b[i] = p;
  }
  p = 0;
  for(int i = 0; i < n; i++) p += b[i];
  cout << p << endl;
  return 0;
}


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

using namespace std;

using ll = long long;

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

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

bool Contains_in_P(ll N, vector<ll> P)
{
    for(auto x : P)
    {
        if(x == N) return true;
    }
    return false;
}

ll Ans(ll X, ll N, vector<ll> P)
{
    ll Down;
    for(ll i=X;i>=0;i--)
    {
        if(!Contains_in_P(i,P))
        {
            Down = i;
            break;
        }
    }
    ll Up;
    for(ll i=X;i<=101;i++)
    {
        if(!Contains_in_P(i,P))
        {
            Up = i;
            break;
        }
    }
    if(abs(X-Up)>abs(X-Down))
    {
        return Down;
    }
    else if(abs(X-Up)<abs(X-Down))
    {
        return Up;
    }
    else
    {
        return Down;
    }
}

int main()
{
    ll X,N;
    cin >> X >> N;

    vector<ll> P(N);
    ALLIN1_NUMBER(P);

    OUT0(Ans(X,N,P));

    return 0;
}

Measured memory_bytes: 3720
N, M = map(int, input().split())
S = input()

max_len = 0
for i in range(N + 1):
    if S[i] == '0':
        current_len = 0
    else:
        current_len += 1
        max_len = max(current_len, max_len)

if max_len >= M:
    ans = -1
else:
    order = []
    i = N
    while i > 0:
        c = min(M, i)
        while S[i - c] == '1':
            c -= 1
        order.append(str(c))
        i -= c
    ans = ' '.join(order[::-1])

print(ans)


Measured memory_bytes: 10528
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" },
        StringSplitOptions.RemoveEmptyEntries);

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

static class Extentions
{
}

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if DEBUG
        sw.AutoFlush = true;
#else
        sw.AutoFlush = false;
#endif
        SetOut(sw);
        Solve(new IO());
        Out.Flush();
    }

    static void Solve(IO io)
    {
        var r = io.I;
        var g = io.I;

        io.Write(g + (g - r));
    }
}

Measured memory_bytes: 13268
import math

N = int(input())

max_n = math.ceil(math.sqrt(N))

a = 0
b = 0

for i in range(max_n + 1, 0, -1):
    if N % i == 0:
        a = i
        break

b = N / a


print(str(int(a-1 + b-1)))



Measured memory_bytes: 3060
n = int(input())
 
k = len(str(n))
 
if k == 1:
	print(n)
elif k == 6:
	print(90909)
elif k == 2:
	print(9)
elif k == 3:
	print(9 + n - 100 + 1)
elif k == 4:
	print(9 + 999 - 100 + 1)
else:
	print(909 + n - 10000 + 1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using VP = vector<P>;
#define rep(i, ss, ee) for (int i = (ss); i < (ee); ++i)

vector<bool> isPrime;
void f1(ll n) {
  isPrime.resize(n + 1, true);
  isPrime[0] = isPrime[1] = false;
  for (ll i = 2; i * i <= n; ++i)
    if (isPrime[i])
      for (ll j = 2; i * j <= n; ++j) isPrime[i * j] = false;
}

VP f2(ll N) {
  VP v;
  rep(i, 0, isPrime.size()) {
    if (!isPrime[i]) continue;
    if (N % i != 0) continue;
    ll exp = 0;
    while (N % i == 0) {
      ++exp;
      N /= i;
    }
    v.emplace_back(i, exp);
  }
  if (N != 1) v.emplace_back(N, 1);
  return v;
}

void solve() {
  ll n, ans = 0;
  cin >> n;

  f1(sqrt(n));
  VP v = f2(n);

  if (v.size() == 0) {
    cout << 0 << endl;
    return;
  }

  for (const auto &p : v) {
    ll x = p.second;
    ll i = 1;
    while (x >= i) {
      ans++;
      x -= i++;
    }
  }
  cout << ans << endl;
}

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

Measured memory_bytes: 3736
def LI():return list(map(int,input().split()))
def yes():print("Yes")
def no():print("No")
from collections import deque
def main():
  n,m=LI()
  edge=[[]for i in range(n)]
  for i in range(m):
    a,b=LI()
    edge[a-1]+=b-1,
    edge[b-1]+=a-1,    
  dq=deque([0])
  ans=[-1]*n
  while dq:
    g=dq.popleft()
    for i in edge[g]:
      if ans[i]==-1:
        ans[i]=g+1
        dq.append(i)
  yes()
  print(*ans[1:])
main()
  

Measured memory_bytes: 100628
//Name: Fish
//Level: 3
//Category: 座標圧縮
//Note:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct Rect {
    int x1, y1, z1, x2, y2, z2;

    bool operator <(const Rect &other) const {
        return z1 < other.z1;
    }
};

enum EventType {
    EVENT_CLOSE,
    EVENT_OPEN,
};

struct Event {
    int x1, y1, x2, y2;
    int z;
    EventType event;

    Event(int x1, int y1, int x2, int y2, int z, EventType ev) : x1(x1), y1(y1), x2(x2), y2(y2), z(z), event(ev) {}

    bool operator <(const Event &other) const {
        if(z != other.z) return z < other.z;
        return event < other.event;
    }
};

vector<Rect> rects;
vector<int> event_x, event_y;
vector<Event> event_z;
int K;

void sort_and_uniq(vector<int> &v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
}

inline bool in_range(int a, int x, int b) {
    return a <= x && x < b;
}

long long sweep_z(const int x, const int y) {
    const int N = event_z.size();
    long long ans = 0;
    int cnt = 0;
    int prev_z = 0;
    for(int i = 0; i < N; ) {
        const int z = event_z[i].z;
        if(cnt >= K) {
            ans += z - prev_z;
        }
        while(i < N && z == event_z[i].z) {
            const Event &ev = event_z[i];
            if(in_range(ev.x1, x, ev.x2) && in_range(ev.y1, y, ev.y2)) {
                if(ev.event == EVENT_CLOSE) --cnt;
                else ++cnt;
            }
            ++i;
        }
        prev_z = z;
    }
    return ans;
}

long long sweep_y(const int x) {
    const int N = event_y.size();
    long long ans = 0;
    for(int i = 0; i < N-1; ++i) {
        const int y = event_y[i];
        long long length = sweep_z(x, y);
        ans += length * (event_y[i+1] - y);
    }
    return ans;
}

long long sweep() {
    const int N = event_x.size();
    long long ans = 0;
    for(int i = 0; i < N-1; ++i) {
        const int x = event_x[i];
        long long area = sweep_y(x);
        ans += area * (event_x[i+1] - x);
    }
    return ans;
}

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

    int N;
    cin >> N >> K;
    rects.resize(N);
    for(int i = 0; i < N; ++i) {
        Rect &r = rects[i];
        cin >> r.x1 >> r.y1 >> r.z1 >> r.x2 >> r.y2 >> r.z2;
        event_x.push_back(r.x1);
        event_x.push_back(r.x2);
        event_y.push_back(r.y1);
        event_y.push_back(r.y2);
        event_z.push_back(Event(r.x1, r.y1, r.x2, r.y2, r.z1, EVENT_OPEN));
        event_z.push_back(Event(r.x1, r.y1, r.x2, r.y2, r.z2, EVENT_CLOSE));
    }
    sort_and_uniq(event_x);
    sort_and_uniq(event_y);
    sort(event_z.begin(), event_z.end());

    cout << sweep() << endl;
    return 0;
}

Measured memory_bytes: 1228
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
MOD = 998244353
N, K = map(int, input().split())
S = [0] * K
for i in range(K):
    l, r = map(int, input().split())
    S[i] = (l, r)

dp = [0] * (N + 2)
acc = [0] * (N + 2)
dp[1] = 1
acc[1] = 1
for i in range(1, N + 1):
    for j in range(K):
        li = i - S[j][1]
        ri = i - S[j][0]
        if ri < 0:
            continue
        li = max(li, 0)
        dp[i] += (acc[ri] - acc[li - 1]) % MOD
    acc[i] = (acc[i - 1] + dp[i]) % MOD
print(dp[N] % MOD)


Measured memory_bytes: 27420
#include <iostream>
#include <numeric>

using namespace std;

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

typedef long long ll;

int main(){

    char S[4];
    char T[4];

    scanf("%s",S);
    scanf("%s",T);

    int count=0;

    rep(i,3){
        if(S[i]==T[i]){
            ++count;
        }
    }

cout<<count<<endl;


}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (b % 2 == 0) return (pow(a * a, b / 2, m) % m); else return (pow(a * a, b / 2) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};

int main(){
  ll N; cin >> N;
  Vi A(N), B(N);
  REP(i, N) cin >> A[i] >> B[i];
  ll ans = 0;
  for(ll i = N - 1; i >= 0; i--){
    ans += residue(-(A[i] + ans),B[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
import sys


def solv(w):
    if w <= 48.0:
        c = 'light fly'
    elif 48.0 < w <= 51.0:
        c = 'fly'
    elif 51.0 < w <= 54.0:
        c = 'bantam'
    elif 54.0 < w <= 57.0:
        c = 'feather'
    elif 57.0 < w <= 60.0:
        c = 'light'
    elif 60.0 < w <= 64.0:
        c = 'light welter'
    elif 64.0 < w <= 69.0:
        c = 'welter'
    elif 69.0 < w <= 75.0:
        c = 'light middle'
    elif 75.0 < w <= 81.0:
        c = 'middle'
    elif 81.0 < w <= 91.0:
        c = 'light heavy'
    elif 91.0 < w:
        c = 'heavy'
    else:
        pass
    return c



for line in sys.stdin:
    weight = float(line)
    print solv(weight)

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

int classify(int x)
{
    if (x == 2)
    {
        return 2;
    }
    else if (x == 4 || x == 6 || x == 9 || x == 11)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

int main()
{
    int x, y;
    cin >> x >> y;

    if (classify(x) == classify(y))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256