akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
typedef long long ll;
typedef long double ld;
//typedef unsigned long long ull;
typedef pair<long long, long long> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<pair<ll,ll> > vii;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef pair<ll,pair<ll,ll> > iii;
#define PI 3.141592653589793
#define mod (ll)(1000*1000*1000+7)
//# define N 300005
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=((ans%m)*(a%m))%m; b/=2; a=((a%m)*(a%m))%m; } return ans%m; }
# define INF (ll)1e18
# define LN 20  
# define EPS 1e-9
typedef pair<ll,pair<ll,ll> > pii;
# define INF1 (ll)1e10
# define maxn 200005
# define offset 2000005
#define N 100005
const ld eps = 1e-10L;

/*void LPS()
{
	len = s.length();
    lps[0] = 0;
    for(ll i=1;i<len;i++){

        ll j = lps[i-1];
        while(j > 0 && s[j] != s[i])    j = lps[j-1];
        if(s[i] == s[j])    j++;
        lps[i] = j;
    }
}*/

/*************************************************
struct Coupon {
	ll l;
	ll r;
	ll id;

	Coupon(ll l, ll r, ll id): l(l), r(r), id(id) {} // Initialization

	bool operator<(const Coupon& c) { // Sorting
		return l < c.l;    
	}
};

**************************************************/

int a[maxn];
int n;
int k;
int dp[101][100002];

ll solve(int id,int left)
{
	//trace2(id,left);
	if(left<0)
		return 0;
	if(left>k)
		return 0;
	if(id==0)
	{
		return (left==0);
	}
	if(dp[id][left]!=-1)
		return dp[id][left];
	ll ans=(solve(id-1,max(0,left-a[id]))%mod)-(solve(id-1,left+1)%mod);
	if(ans<0)
		ans+=mod;
	ans%=mod;
	ans+=solve(id,left+1);
	ans%=mod;
	return dp[id][left]=ans;
}

int main()
{
	IOS;
	cin >> n >> k;
	for(int i=1;i<=n;i++)
		cin >> a[i];
	memset(dp,-1,sizeof dp);
	cout << solve(n,k);
}

Measured memory_bytes: 45952
#include<bits/stdc++.h>
#define ll long long
#define MOD 998244353LL

using namespace std;

ll fact_memo[500001];

ll fact(ll n){
    return fact_memo[n];
}

ll expmod(ll b, ll e){
    if(e == 0) return 1;
    ll f = expmod(b, e / 2);
    f *= f;
    f %= MOD;
    if(e % 2 == 1) f *= b;
    return f % MOD;
}

ll inv(ll n){
    return expmod(n, MOD - 2);
}

ll comb(ll n, ll k){
    ll ans = 1;
    ans *= fact(n);
    ans *= inv(fact(k));
    ans %= MOD;
    ans *= inv(fact(n - k));
    return ans % MOD;
}

ll H(ll n, ll k){
    return comb(n - 1 + k, k);
}

int main(void){
    fact_memo[0] = 1;
    for(ll f = 1; f <= 500000; f++){
        fact_memo[f] = (fact_memo[f - 1] * f) % MOD;
    }
    ll N, M, K;
    cin >> N >> M >> K;
    ll ans = 0;
    for(ll i = 0; i <= K; i++){
        ll sub = M;
        if(N - i - 1 >= 1) sub *= expmod(M - 1, N - i - 1);
        sub %= MOD;
        sub *= H(N - i, i);
        sub %= MOD;
        ans += sub;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main()
{
    long long n,k,temp,count=0;
    cin>>n>>k;
    if(k%2==0)
    {
        temp=n/k;
        count=(temp*temp*temp);
        temp=(n+(k/2))/k;
        count+=(temp*temp*temp);
    }
    else
    {
        temp=n/k;
        count=(temp*temp*temp);
    }
    cout<<count<<endl;

}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(N, K, inputs):
    trees = list(map(lambda x: int(x), inputs))
    trees.sort()

    min_diff = -1
    for i in range(K-1, N):
        diff = trees[i] - trees[i - K + 1]
        if min_diff == -1 or diff < min_diff:
            min_diff = diff
    return min_diff


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N, K] = string_to_int(input())
    ret = solve(N, K, inputs(N))
    print(ret)


Measured memory_bytes: 14552
from collections import Counter
h,w,n = map(int,input().split())
need = []
append = need.append
for i in range(n):
    a,b = map(int,input().split())
    for x in range(-2,1):
        for y in range(-2,1):
            s = a + x
            t = b + y
            if 1 <= s <= h-2 and 1 <= t <= w-2:
                append(s*10**10 + t)

data = Counter(need).most_common()
ans = [0 for i in range(10)]
for x,y in data:
    ans[y] += 1

print((h-2)*(w-2)-sum(ans))
for i in ans[1:]:
    print(i)

Measured memory_bytes: 204980
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    
    vector<int> a;
    for (int i = 0; i < n; i++) {
        int ai;
        cin >> ai;
        a.push_back(ai);
    }

    int count = 0;
    for (int i = 0; i < n; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (a[j] < a[minj]) {
                minj = j;
            }
        }
        if (minj != i) {
            swap(a[i], a[minj]);
            count++;
        }
    }

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

    cout << count << endl;

    return 0;
}



Measured memory_bytes: 3164
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
INF =  float("inf")
import bisect
import statistics
mod = 10**9+7

N = int(input())
s = input()

dp = [[0 for j in range(N+1)] for i in range(N+1)]
for j in range(1,N+1):
    dp[1][j] = 1

for i in range(2,N+1):
    a = [0 for i in range(N-i+3)]
    for k in range(1,N-i+3):
        a[k] = (a[k-1] + dp[i-1][k]) % mod

    for j in range(1,N-i+2):
        if s[i-2] == "<":
            dp[i][j] = (a[N-i+2] - a[j]) % mod
            # for k in range(1,N-i-j+3):
            #     dp[i][j] = (dp[i][j] + dp[i-1][j+k]) % mod
        else:
            dp[i][j] = (a[j] - a[0]) % mod
            # for k in range(1,j+1):
            #     dp[i][j] = (dp[i][j] + dp[i-1][k]) % mod

print(dp[N][1] % mod)

Measured memory_bytes: 154080
#include <iostream>
#include <cstring>
#include <algorithm>
#include <list>
#include <map>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
 
using namespace std;

typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '
 
const int MAXN = 100+5;
int weights[MAXN], value[MAXN];

int largest(int a, int b){
	return (a<b)?b:a;
}



int main() {	
	string s, k;
	cin >> s >> k;
	if(s.length() < k.length()){
		cout << "LESS" << endl;
		return 0;
	}
	if(s.length() > k.length()){
		cout << "GREATER" << endl;
		return 0;
	}
	for(int i = 0; i < s.length(); ++i){
		if((s[i] - '0') < (k[i] - '0')){
			cout << "LESS" << endl;
			return 0;
		}
		else if((s[i] - '0') > (k[i] - '0')){
			cout << "GREATER" << endl;
			return 0;
		}
	}
	cout << "EQUAL" << endl;



    return 0;
}	

Measured memory_bytes: 256
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>
#include <ext/rope>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define mp make_pair
#define pb push_back
#define LL long long
#define co complex<double>
#define fi first
#define se second

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;
using namespace __gnu_cxx;

char x[MAX];

int main(){
	scanf("%s",x);
	F1(a,0,4)printf("%c",x[a]);
	printf(" %s\n",x+4);
	#ifdef LOCAL_PROJECT
	system("pause");
	#endif
	return 0;
}


Measured memory_bytes: 128
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;
#define PI 3.14159265358979323846

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int a, b, x;
    cin >> a >> b >> x;
    double theta;

    if (a * a * b <= 2 * x) {
        theta = atan(2.0 * (1.0 * b / a - 1.0 * x / (1.0 * a * a * a)));
    } else {
        theta = atan(1.0 * a * b * b / (2.0 * x));
    }

    double ret = theta * 180 / PI;
    cout << setprecision(10) << fixed << ret << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int n;
  cin >> n;
  int h[n];
  double sum=0;
  for(int i=0;i<n;i++){
    cin >> h[i];
    sum+=h[i];
  }
  double ave=sum/n;
  int ans=0;
  for(int i=0;i<n;i++){
    ans=ans+(h[i]-round(ave))*(h[i]-round(ave));
  }
  cout << ans << endl;
}


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

int main(){
    int n; cin >> n;
    for(int i = 1; i <= n; i++){
        int a = i * 1.08;
        if(a == n){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace  std;
 
int main(){
 
  long long  int n;
    cin>>n;
 
    float m;
    cin>>m;
    
    int arr[n] = {0};
  long long  int sum = 0;
 
    for(int i = 0 ; i < n ; i++){
    cin>>arr[i];
    sum+=arr[i];   
    
    }
 
 
    float total_votes1 = 1/(4*m);
  
   float total_votes = total_votes1*sum;
 
 
    for(int i = 0 ; i < n ; i++){
 
        if(arr[i]>=total_votes){
            m--;
        }
 
     
    }
 
 
 
    if(m<=0){
        cout<<"Yes";
    }
 
    else if(m>0){
        cout<<"No";
    }
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define FI first
#define SE second
#define MP make_pair
#define int long long
using namespace std;
static const int inf = 1ll<<60;
static const int MAX_N = 16777216;
typedef pair<int,int> P;

int N,D;
int X[40],Y[40];
int ans=0;
int dat[MAX_N*4];

class Segment{
    public :
        int n;
        void inti(int n_){
            n=1;
            while(n<n_)n*=2;
            for(int i=0;i<4*n-1;++i)dat[i]=-INT_MAX;
        }

        void update(int k,int a){
            k+=n-1;
            dat[k]=a;
            while(k>0){
                k=(k-1)/2;
                dat[k]=max(dat[k*2+1],dat[k*2+2]);
            }
        }

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

void half(int n,int last,int x,int y,vector<P> &res) {
    if (n==last) {
        res.PB(P(x,y));
        return;
    }
    half(n-1,last,x+X[n],y+Y[n],res);
    half(n-1,last,x-X[n],y-Y[n],res);
    half(n-1,last,x,y,res);
}

signed main(){
    cin>>N>>D;
    Segment seg;
    int n2=N/2;
    for(int i=1;i<=N;++i){
        cin>>X[i]>>Y[i];
    }
    vector<P> p1;
    vector<P> p2;
    p1.reserve(MAX_N);
    half(n2,0,0,0,p1);
    p2.reserve(MAX_N);
    half(N,n2,0,0,p2);
    sort(p2.begin(),p2.end());
    seg.inti(p2.size());
    for(int i=0;i<p2.size();++i)seg.update(i,p2[i].SE);
    for(int i=0;i<p1.size();++i){
        int x=p1[i].FI+D;
        int y=p1[i].FI-D;
        int r=lower_bound(p2.begin(),p2.end(),MP(y,-inf))-p2.begin();
        int l=upper_bound(p2.begin(),p2.end(),MP(x,inf))-p2.begin();
        if(r==p2.size())continue;
        if(r>=l)continue;
        ans=max(ans,abs(seg.query(r,l,0,0,seg.n)-p1[i].SE));
    }
    cout<<ans<<endl;
}

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

int n;
int a[200000];
int p[200001];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    --a[i];
    p[a[i]] = i;
  }
  p[n] = -1;
  
  int mx = 0;
  int cnt = 0;
  int prev = 1 << 30;
  for (int i = 0; i <= n; ++i) {
    if (p[i] > prev) {
      ++cnt;
    } else {
      mx = max(mx, cnt);
      cnt = 1;
    }
    prev = p[i];
  }
  cout << n - mx << endl;
}

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

int num[4];
string input;
int solve()
{
	int sum;
	for(int op = 0; op < (1<<4); op++){
		sum = num[0];
		string S;
		S = (char)(num[0] + '0');
		for(int i = 0; i < 3; i++){
			if((op >> i) & 1){
				sum += num[i+1];
				S += '+';
				S +=  (char)(num[i+1]+'0');
			}
			else{
				sum -= num[i+1];
				S += '-'; 
				S += (char)(num[i+1] + '0');
			}
		}
		if(sum == 7){
			S += "=7";
			cout << S << endl;
			return 0;
		}
	}
}
int main()
{
	cin >> input;
	for(int i = 0; i < 4; i++)
		num[i] =(int) input[i] - '0';	 
	solve();
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();

        long syou = N/(A+B);
        long amari = N%(A+B);
        
        if(amari<=A){
        System.out.println(syou*A+amari);
        }else{
        System.out.println(syou*A+A);
	}
}
}

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

int h,w;
string str[101];
int cnt[26];

bool check(){
	int four=(h/2)*(w/2);
	int two=0;
	if(h%2==1){
		two+=w/2;
	}
	if(w%2==1){
		two+=h/2;
	}
	int on=0;
	if(h%2==1 && w%2==1){
		on++;
	}
	while(four>0){
		bool flag=false;
		for(int i=0;i<26;i++){
			if(cnt[i]>=4 && !flag){
				four--;
				cnt[i]-=4;
				flag=true;
			}
		}
		if(!flag)return false;
	}
	while(two>0){
		bool flag=false;
		for(int i=0;i<26;i++){
			if(cnt[i]>=2 && !flag){
				two--;
				cnt[i]-=2;
				flag=true;
			}
		}
		if(!flag)return false;
	}
	while(on>0){
		bool flag=false;
		for(int i=0;i<26;i++){
			if(cnt[i]>=1 && !flag){
				on--;
				cnt[i]-=1;
				flag=true;
			}
		}
		if(!flag)return false;
	}
	return true;
}

int main(void){
	scanf("%d%d",&h,&w);
	for(int i=0;i<h;i++){
		cin >> str[i];
		for(int j=0;j<w;j++){
			cnt[str[i][j]-'a']++;
		}
	}
	
	printf("%s\n",check()?"Yes":"No");
	return 0;
}

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

int main()
{
  char s[3];
  int res=0;
  cin >> s;

  rep(i,3){
    if(s[i]=='1')  res++;
  }

  cout << res << endl;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  int a, b;
  cin >> a >> b;

  int res = (b - 1) / (a - 1);
  if ((b - 1) % (a - 1) != 0)
    ++res;

  cout << res << endl;

  return 0;
}

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

int main(){
	volatile clock_t c = clock();
	string s;
	cin >> s;
	c += (s[0] - 'a' + 1) * 0.01 * CLOCKS_PER_SEC;
	while(clock() < c);
	if(s[2] == s[3] && s[4] == s[5]){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define SQR(x) ((x)*(x))
int a[200];
int main(){
	int n;
  	cin>>n;
  	for(int i=0;i<n;i++){
    	cin>>a[i];
    }
    int ans = INT_MAX;
  	for(int i=1;i<=100;i++){
    	int res = i,sum = 0;
      	for(int j=0;j<n;j++){
        	sum += SQR(a[j]-res);
        }
        if(sum<ans){
        	ans = sum;
        }
    }
  	cout<<ans<<endl;
}


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

int main() {
    ios::sync_with_stdio(false);
    int d, n;
    cin >> d >> n;
    for (int i = 1; ; i++) {
        if (d == 0) {
            if (i % 100) n--;
        }
        if (d == 1) {
            if (i % 100 == 0 && i % 10000) n--;
        }
        if (d == 2) {
            if (i % 10000 == 0 && i % 1000000) n--;
        }
        if (!n) {
            cout << i;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  int N;
  cin >> N;

  vector<int> A(N);
  REP(i, N) cin >> A[i];
  
  int cnt = 0;
  REP(i,N){
    if(A.at(A.at(i)-1)-1==i){
      cnt++;
    }
  }

  cout << cnt/2 << endl;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int m,f,r;

    while(cin >> m >> f >> r){
    int x=m+f;
        if(m==-1 && f==-1 && r==-1)break;
        else if(m==-1||f==-1)
            cout << 'F' << endl;
        else if(x>=80)
            cout << 'A' << endl;
        else if(65<=x&&x<80)
            cout << 'B' << endl;
        else if(50<=x&&x<65)
            cout << 'C' << endl;
        else if(30<=x&&x<50){
            if(50<=r)
                cout << 'C' << endl;
            else
                cout << 'D' << endl;
        }
        else
            cout << 'F' << endl;
    }
}


Measured memory_bytes: 3084
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int x = Integer.parseInt(sc.next());
    pw.println(10 - x / 200);
  }
}


Measured memory_bytes: 35548
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(ll &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
ll n,x,ans,p,q;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	in(n);in(x);
	for(int i=1;i<=n;i++){
		in(p);in(q);
		if(sqrt(p*p+q*q)<=x)ans++;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3740
import java.util.Scanner;

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

    int n = sc.nextInt();
    String s = sc.next();

    String a = s.substring(0, n / 2);
    String b = s.substring(n / 2, n);

    if (a.equals(b)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define umii            unordered_map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define rep(i,st,end)   for(int i=st;i<end;i++)
#define w(x)            int x; cin>>x; while(x--)
//mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void s_g_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	s_g_c();
	int n;
	cin >> n;
	string s;
	cin >> s;
	int count_w = 0;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'W')
			count_w++;
	}
	int count = 0;
	for (int i = n - count_w; i < n; i++)
	{
		if (s[i] == 'R')
			count++;
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 3772
import java.util.*;
import java.awt.geom.*;
import java.io.*;
public class Main{
	
	int [][] data;
	int [][][] p = {
			{
			{0,1,0,1},
			{0,0,1,1}
			},
			
			{
				{0,0,0,0},
				{0,1,2,3}
			},
			
			{
				{0,1,2,3},
				{0,0,0,0}
				
			},
			
			{
				{0,0,-1,-1},
				{0,1,1,2}
				
			},
			
			{
				{0,1,1,2},
				{0,0,1,1}
				
			},
			
			{
				{0,0,1,1},
				{0,1,1,2}
				
			},
			
			{
				{0,0,1,-1},
				{0,1,0,1}
				
			},
	};
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			data = new int[8][8];
			int n = 8;
			for(int i = 0;i < n; i++){
				String input = sc.next();
				for(int j = 0; j < n; j++){
					data[i][j] = input.charAt(j) - '0';
				}
			}
			
			int ind = -1;
			EXIT :
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					if(data[i][j] == 1){
						
						for(int k = 0; k < p.length; k++){
							boolean res = isOK(i,j,k);
							if(res){
								ind = k;
								break EXIT;
							}
						}
					}
				}
			}
			char ans = (char) (ind + 'A');
			System.out.println(ans);
		}
	}
	
	private boolean isOK(int y, int x, int k) {
		for(int i = 0; i < 4; i++){
			int xx = x + p[k][0][i];
			int yy = y + p[k][1][i];
			if(0<= xx && xx < 8 && 0<= yy && yy<8){
				
			}
			else{
				return false;
			}
			if(data[yy][xx] != 1){
				return false;
			}
		}
		return true;
	}

	public static void main(String [] args){
		new Main().doit();
	}
}

Measured memory_bytes: 12000
#include <stdio.h>

int main(void)
{
	int S,h,m,s;

	scanf("%d", &S);

	s = S % 60;
	S = (S - s) / 60;
	m = S % 60;
	h = (S - m) / 60;

	printf("%d:%d:%d\n",h,m,s);

	return 0;
}

Measured memory_bytes: 592
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;
 
int main() {
    int x; cin >> x;
    vector<bool> ok(x + 1, false);
    ok[0] = true;
    for (int i = 100; i <= 105; i++) {
        for (int j = 0; j <= x; j++) {
            if (j-i >= 0 && ok[j-i]) ok[j] = true;
        }
    }
    if (ok[x]) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

public class Program
{
    public static void Main()
	{
        var N = int.Parse(Console.ReadLine());
        var Ai = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

        Array.Sort(Ai);
        var index = Ai.Length-1;
        var sumA = 0;
        var sumB = 0;
        var flugAB = true;
        while (index >= 0)
        {
            if (flugAB)
            {
                sumA += Ai[index];
            }
            else
            {
                sumB += Ai[index];
            }
            flugAB = !flugAB;
            index --;
        }

        Console.WriteLine(sumA - sumB);
        
    }
}


Measured memory_bytes: 11220
from collections import deque
order = int(input())
llist = [input().split() for _ in range(order)]
ans = deque([])
count = 0
for lst in llist:
    if lst[0] == 'insert':
        ans.appendleft(lst[1])
    
    elif lst[0] == 'delete':
        if lst[1] in ans:
            ans.remove(lst[1])
   
    elif lst[0] == 'deleteFirst':
        ans.popleft()
    
    elif lst[0] == 'deleteLast':
        ans.pop()
        
    count += 1

print(*ans)
    

Measured memory_bytes: 557384
X, N = map(int, input().split())
P = list(map(int, input().split()))

if not X in P:
    print(X)
else:
    for i in range(100):
        if not X-i in P: 
            tmp = True
            break
        elif not X+i in P: 
            tmp = False
            break
    print(X-i if tmp else X+i)

Measured memory_bytes: 9184
#include <stdio.h>
int main(void)
{
    int m,f,r;
        while(scanf("%d %d %d",&m,&f,&r)!=EOF){
        if(m==-1 && f==-1 && r==-1) 
        break;
        if(m==-1 || f==-1)
        printf("F\n");
        else { 
            if(m+f>=80)
            printf("A\n");
            else {
                if(m+f>=65)
                printf("B\n");
                else {
                    if(m+f>=50)
                    printf("C\n");
                    else {
                        if(m+f>=30 && r>=50)
                        printf("C\n");
                        else if(m+f>=30 && r<50)
                        printf("D\n");
                        else if(m+f<30)
                        printf("F\n");
                        } } } } } 
                        return 0;
} 


Measured memory_bytes: 2104
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

int main(void) {
    Int n;
    cin >> n;
    string s;
    cin >> s;

    Int result = 0;
    char c = ' ';
    Int length = s.length();
    for (Int i = 0; i < length; ++i) {
        if (c != s[i]) {
            result++;
            c = s[i];
        }
    }
    cout << result << endl;
    return 0;
}


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

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

typedef long long ll;

int main() {
    int a,b,c;cin>>a>>b;
  if(b==100)c=a*1000 + b;
  else if(b>=10)c = a*100 + b;
  else c = a*10 + b;

  int d = sqrt(c);
  if(d*d == c)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
//    cout<<ans<<endl;
	return 0;
}

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

int n, k;
long INF = 100010;
int dp[100010];
int c[100010];

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

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

  for (int i = 0; i < 100010; i++)
  {
    dp[i] = INF;
  }

  dp[0] = 0;
  dp[1] = dp[0] + abs(c[1] - c[0]);

  for (int i = 2; i < n; i++)
  {
    int temp = INT_MAX;
    for (int j = 1; j <= k; j++)
    {
      int step = dp[i - j] + abs(c[i] - c[i - j]);
      if (step < temp && i - j >= 0)
      {
        temp = step;
      }
    }
    dp[i] = temp;
  }

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


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

int main()
{
    int N;
    cin >> N;
    
    int a[N+1], b[N+1], c[N+1];
    for(int i = 1; i <= N; i++) cin >> a[i] >> b[i] >> c[i];
    
    int A[N+1], B[N+1], C[N+1];
    A[1] = a[1];
    B[1] = b[1];
    C[1] = c[1];
    
    for(int i = 2; i <= N; i++)
    {
        A[i] = a[i] + max(B[i-1], C[i-1]);
        B[i] = b[i] + max(C[i-1], A[i-1]);
        C[i] = c[i] + max(A[i-1], B[i-1]);
    }
    cout << max(A[N], max(B[N], C[N])) << '\n';
    return 0;
}

Measured memory_bytes: 2560
#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); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >> e;
    if (a == 0) cout << 1 << endl;
    if (b == 0) cout << 2 << endl;
    if (c == 0) cout << 3 << endl;
    if (d == 0) cout << 4 << endl;
    if (e == 0) cout << 5 << endl;
}



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

#define ll long long
#define ld long double
#define ull unsigned long long
#define pw(x) (1LL << (x))

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"

using namespace std;

struct edge
{
    int to, cost;
};

void dijkstra(int s, int n, vector<vector<edge>> &G, vector<vector<bool>> &used)
{
    vector<int> d(n, INT_MAX);
    typedef pair<int, int> P; // first->shortest dist, second->vertex number
    priority_queue<P, vector<P>, greater<P>> pq;
    d.at(s) = 0;
    pq.push(P(0, s));
    while (!pq.empty())
    {
        P p = pq.top();
        pq.pop();
        int v = p.second;
        if (d.at(v) < p.first)
            continue;
        for (int i = 0; i < G.at(v).size(); ++i)
        {
            edge e = G.at(v).at(i);
            if (d.at(e.to) > d.at(v) + e.cost)
            {
                d.at(e.to) = d.at(v) + e.cost;
                pq.push(P(d.at(e.to), e.to));
            }
        }
    }
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < G.at(i).size(); ++j)
        {
            edge e = G.at(i).at(j);
            if (d.at(i) + e.cost == d.at(e.to))
            {
                used.at(i).at(e.to) = true;
                used.at(e.to).at(i) = true;
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int N, M;
    cin >> N >> M;
    vector<vector<edge>> G(N);

    for (int i = 0; i < M; ++i)
    {
        int a, b, c;
        cin >> a >> b >> c;
        G.at(a - 1).push_back({b - 1, c});
        G.at(b - 1).push_back({a - 1, c});
    }

    vector<vector<bool>> used(N, vector<bool>(N, false));

    for (int i = 0; i < N; ++i)
        dijkstra(i, N, G, used);

    int ans = M;
    for (int i = 0; i < N - 1; ++i)
        for (int j = i + 1; j < N; ++j)
            if (used.at(i).at(j))
                --ans;

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N = Integer.parseInt(sc.next());
	static int W = Integer.parseInt(sc.next());
	static int[] v = new int[N];
	static int[] w = new int[N];
	static int[] dp = new int[W+1];
	public static void main(String[] args) {
		for (int i = 0; i < N; i++) {
			v[i] = Integer.parseInt(sc.next());
			w[i] = Integer.parseInt(sc.next());
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j <= W; j++) {
				if (j >= w[i]) {
					dp[j] = Math.max(dp[j], dp[j-w[i]]+v[i]);
				}
			}
		}
		System.out.println(dp[W]);
	}
}


Measured memory_bytes: 26480
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define ALL(x) (x).begin(),(x).end()
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

VI primes;
bool is_prime[114514];

int f[114514];

void sieve(int n){
    for(int i=0;i<=n;i++) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            primes.PB(i);
            for(int j=2*i;j<=n;j += i) is_prime[j] = false;
        }
    }
    return;
}

void solve(){
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d\n",f[b]-f[a-1]);
}

void init(){
    REP(i,114514){
        if(i%2==0) continue;
        if(is_prime[i]&&is_prime[(i+1)/2]) f[i]++;
    }
    REP1(i,114513) f[i]+=f[i-1];
}

signed main(){
    REP(i,114514) f[i] = 0;
    int q;
    scanf("%d",&q);
    int n = 114514;
    sieve(n);

    init();


    REP(i,q) solve();
    return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>
int main(){
	
	while(1){
	
		int H , W , counth , countw;
		
		scanf("%d %d", &H , &W);
		
		if(H == 0 && W == 0){
		
			break;
		}
		
		for(counth = 1 ; counth <= H  ; counth++){
			
			if(0 < counth % 2){
				for(countw = 1 ; countw <= W ; countw++){
					
					if(0 < countw % 2){
					printf("#");
					}else{printf(".");}
				}
			}else {
				for(countw = 1 ; countw <= W  ; countw++){
				
				if(0 < countw % 2){
					printf(".");
				}else {printf("#");}
				}
			}
			printf("\n");
		}
		
		printf("\n");
	
	}
	return 0;
	
}

//?¨????????????????????¢???????????????¨??????()??????
// int ??´??°
// char ??????
// double ???????°???°???
/*d = a / b;
r = a % b;
f = 1.0 * a / b;
// f = (double)a / b;*/

Measured memory_bytes: 572
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
typedef long long ll;
const ll maxn = 1e6+10;
const ll mod = 1000000007;
ll n,k;
ll f1[maxn],f2[maxn],inv[maxn];

void init(){
    inv[1] = 1;
    for(int i = 2;i<maxn;i++) inv[i] = mod-mod/i*inv[mod%i]%mod;
    f1[0] = f2[0] = 1;
    for(int i = 1;i<maxn;i++){
        f1[i] = f1[i-1]*i%mod;
        f2[i] = f2[i-1]*inv[i]%mod;
    }
}

ll C(ll n,ll k){
    return f1[n]*f2[k]%mod*f2[n-k]%mod;
}

int main(){
    init();
    cin>>n>>k;
    ll res = 0;
    for(ll i = 0;i<=min(n-1,k);i++){
        res = (res + C(n,i)*C(n-1,n-i-1)%mod)%mod;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 23680
s = input()
k = int(input())

# 1の連続性を確認し終わった段階の数字を記録
cnt = 0

for i in range(len(s)):
    if s[i] != '1':
        num = s[i]
        break
    if s[i] == '1':
        cnt += 1

if cnt >= k:
    print(1)
else:
    print(num)


Measured memory_bytes: 2940
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<string>

using namespace std;

typedef long long ll;

int main() {
	string s;
	cin >> s;
	int fn = 0, fe = 0, fw = 0, fs = 0;
	int len = s.size();
	for (int i = 0; i < len; ++i) {
		if (s[i] == 'N') {
			fn = 1;
		}
		if (s[i] == 'E') {
			fe = 1;
		}
		if (s[i] == 'W') {
			fw = 1;
		}
		if (s[i] == 'S') {
			fs = 1;
		}
	}
	if (fn == fs && fe == fw) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3568
n,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
for i in range(1,n):
  if sum(a[:i]) > x:
    print(i-1)
    exit()
if sum(a[:n]) == x:
  print(n)
else:
  print(n-1)

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

int main(){
    int a, b, k;
    cin >> a >> b >> k;
    
    int ans, count = 0;
    for(int i = 100; i > 0; i--){
        if(a%i == 0 && b%i == 0) count++;
        if(count == k){
            ans = i;
            break;
        }
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};

int main() {
ll N;
  cin >>N;
   vl a(N);
  rep(i,N) {
cin >>a.at(i);
  }
  vl b(N);
  rep(i,N) {
ll count=0;
    while(a.at(i)%2==0) {
     a.at(i)=a.at(i)/2;
      count++;
    }
    b.at(i)=count;
  }
  
  ll sum=0;
  rep(i,N) {
    sum +=b.at(i);
  }
  
  cout<<sum<<endl;
  
}
  
 

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

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<ll,ll> pll;
typedef pair<int, int> pii;

#define N 100010
#define M 200010
#define A 110
#define endl "\n"
#define mod 1000000007 

int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	
	double r;
	
	cin >> r;
	
	printf("%0.18f\n", 2 * 3.1416 * r);
	
	return 0;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using Graph = vector<vector<int>>;
const int MOD = 1e9 + 7;

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

    int N, Q;
    string S;
    cin >> N >> S >> Q;
    vector<set<int>> pos(26);

    for (int i = 0; i < N; ++i)
        pos[S[i] - 'a'].insert(i);

    for (int i = 0; i < Q; ++i) {
        int n;
        cin >> n;
        if (n == 1) {
            int a;
            char c;
            cin >> a >> c;
            a--;
            pos[S[a] - 'a'].erase(a);
            pos[c - 'a'].insert(a);
            S[a] = c;
        } else {
            int a, b;
            cin >> a >> b;
            a--, b--;
            int cnt = 0;
            for (int j = 0; j < 26; ++j) {
                auto itr = pos[j].lower_bound(a);
                if (itr != pos[j].end())
                    cnt += (*itr <= b);
            }
            cout << cnt << '\n';
        }
    }
    return 0;
}


Measured memory_bytes: 24220
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  if(N % 10 == 2)
    cout << "hon" << endl;
  else if(N % 10 == 4)
    cout << "hon" << endl;
  else if(N % 10 == 5)
    cout << "hon" << endl;
  else if(N % 10 == 7)
    cout << "hon" << endl;
  else if(N % 10 == 9)
    cout << "hon" << endl;
  else if(N % 10 == 1)
    cout << "pon" << endl;
  else if(N % 10 == 6)
    cout << "pon" << endl;
  else if(N % 10 == 8)
    cout << "pon" << endl;
  else if(N % 10 == 0)
    cout << "pon" << endl;
  else if(N % 10 == 3)
    cout << "bon" << endl;
}
    
    


Measured memory_bytes: 3624
#include"bits/stdc++.h"
using namespace std;
const int N=5e3+100;
typedef long long LL;
struct node{
	LL h,p;
}a[N];
LL dp[N];
bool cmp(node a,node b){
	if(a.h+a.p==b.h+b.p)return a.h<b.h;
	return a.h+a.p<b.h+b.p;
}

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<=5050;i++)dp[i]=0x3f3f3f3f3f3f3f3f;
	for(int i=1;i<=n;i++)
		scanf("%d %d",&a[i].h,&a[i].p);
	sort(a+1,a+n+1,cmp);
	dp[0]=0;
	for(int i=1;i<=n;i++){
		for(int j=i-1;j>=0;j--){
			if(a[i].h>=dp[j]){
				dp[j+1]=min(dp[j+1],dp[j]+a[i].p);
			}
		}
	}
	int ans=1;
	for(int i=2;i<=n;i++)
		if(dp[i]!=0x3f3f3f3f3f3f3f3f)ans=i;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] A = new int[100001];
		int[] B = new int[100001];
		int a1 =1, a2 = 0,b1 = 1,b2 = 0;
		int ans = 0;
		for(int i = 0;i < N;i++) {
			if(i%2 == 0) {
				A[scn.nextInt()]++;
			}else {
				B[scn.nextInt()]++;
			}
		}
		for(int i = 2;i <= 100000;i++) {
			if(A[i] > A[a1]) {
				a2 = a1;
				a1 = i;
			}else {
				if(A[i] > A[a2]) {
					a2 = i;
				}
			}
			if(B[i] > B[b1]) {
				b2 = b1;
				b1 = i;
			}else {
				if(B[i] > B[b2]) {
					b2 = i;
				}
			}
		}
		if(a1!=b1) {
			ans = N - A[a1] - B[b1];
		}else {
			ans = Math.min(N-A[a1]-B[b2], N-A[a2]-B[b1]);
		}
		System.out.println(ans);
		scn.close();

	}
}

Measured memory_bytes: 52876
def main():
    a, b = map(int, input().split())
    if a <= 0 <= b:
        print('Zero')
    elif b < 0:
        print('Positive' if (b - a + 1) % 2 == 0 else 'Negative')
    else:
        print('Positive')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<algorithm>
#define NO  std::string::npos
int main(){
    std::string S,buf;
    int N;
    std::cin >> N >> S; buf =S;
    std::sort(buf.begin(),buf.end());
    buf.erase(std::unique(buf.begin(), buf.end()), buf.end());
    int m = 0;
    for(int i=0; i < N-1; i++) {
        std::string a = S.substr(0,i+1);
        std::string b = S.substr(i+1);
        int count=0;
        for(auto c:buf)
            if(a.find(c) != NO && b.find(c) != NO) count++;
        if(count > m)  m=count;
    }
    std::cout << m << "\n";

}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 
		int[] point = new int[5];
		int k;
		String ans = "Yay!";
 
		//入力
		for(int i=0; i<point.length; i++) {
			point[i] = sc.nextInt();
		}
		k = sc.nextInt();
 
		cmp: for(int i=0; i<point.length; i++) {
			for(int j=i+1; j<point.length; j++) {
				int p = point[i];
				int q = point[j];
				if((q-p) > k) {
					ans = ":(";
					break cmp;
				}
			}
		}
 
		System.out.println(ans);
 
		sc.close();
	}
}

Measured memory_bytes: 22100
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
#define INF (1<<24)
 
struct state{
  int cost,pos,cnt;
  bool operator < (const state &p) const{
    return cost>p.cost;
  }
};
 
struct edge{
  int to,cost;
};
 
int c,n,m,s,d;
vector<edge> G[100];
 
void init(){
  for(int i=0;i<100;i++)G[i].clear();
}
 
int dijkstra(int si,int ti){
  int d[100][11];
  for(int i=0;i<100;i++)
    for(int j=0;j<11;j++)d[i][j]=INF;
 
  d[si][c]=0;
  priority_queue< state > Q;
  Q.push((state){0,si,c});
 
  while(!Q.empty()){
    state s=Q.top();Q.pop();
    if(s.cost>d[s.pos][s.cnt])continue;
 
    for(int i=0;i<(int)G[s.pos].size();i++){
      edge e=G[s.pos][i];
      if(s.cost+e.cost>=d[e.to][s.cnt])continue;
      d[e.to][s.cnt]=s.cost+e.cost;
      Q.push((state){s.cost+e.cost,e.to,s.cnt});
    }
 
    if(s.cnt==0)continue;
 
    for(int i=0;i<(int)G[s.pos].size();i++){
      edge e=G[s.pos][i];
      if(s.cost+e.cost/2>=d[e.to][s.cnt-1])continue;
      d[e.to][s.cnt-1]=s.cost+e.cost/2;
      Q.push((state){s.cost+e.cost/2,e.to,s.cnt-1});
    }
  }//while
 
  int res=INF;
  for(int i=0;i<=c;i++){
    res=min(res,d[ti][i]);
  }
  return res;
}
 
int main(){
  int a,b,f;
  while(cin>>c>>n>>m>>s>>d){
    if(n==0)break;
    init();
    for(int i=0;i<m;i++){
      cin>>a>>b>>f;
      a--;b--;
      G[a].push_back((edge){b,f});
      G[b].push_back((edge){a,f});
    }
    cout<<dijkstra(s-1,d-1)<<endl;
  }
  return 0;
}


Measured memory_bytes: 3212
import math

a, b, x = map(int, input().split())
V = a * a * b

if x > V / 2:
    theta = 180*math.atan(2*(V - x)/a**3)/math.pi
else:
    theta = 180*math.atan(a*b*b/2/x)/math.pi
print(theta)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n, m, x;
  cin >> n >> m >> x;
  vector<ll> c(n);
  vector<vector<ll>> a(n, vector<ll>(m));
  rep(i,n){
      cin >> c[i];
      rep(j,m) cin >> a[i][j];
  }
  ll ans = INF;
  for (int bit = 0; bit < (1 << n); bit++) {
    ll cost = 0;
    vector<int> now(m, 0);
    for (int i = 0; i < n; i++) {
      if (bit & (1 << i)) {
        cost += c[i];
        rep(j, m) now[j] += a[i][j];
      }
    }
    bool f = true;
    rep(j, m) if (now[j] < x) f = false;
    if (f) chmin(ans, cost);
  }
    if(ans!=INF) cout << ans << endl;
    else
      puts("-1");
    return 0;
}


Measured memory_bytes: 3628
n=int(input())
s=[]
for i in range(n):
  a=int(input())
  t=[]
  for j in range(a):
    x=list(map(int,input().split()))
    t.append(x)
  s.append(t)

ans=0
for r in range(2**n):
  ans1=0
  za=[0 for i in range(n)]
  for w in range(n):
    if (r>>w)&1:
      ans1+=1
      za[w]+=1
  ch=0
  for h in range(n):
    if za[h]==1:
      for p in s[h]:
        A=p[0]-1
        B=p[1]
        if za[A]!=B:
          ch+=1
  if ch==0:
    ans=max(ans,ans1)
    
print(ans)

Measured memory_bytes: 73912
#include <bits/stdc++.h>
using i64 = long long;


int main() {
    int n, m, s, t;
    std::cin >> n >> m;
    std::vector<std::deque<int>> g(n + 1);
    for (int i = 0; i < m; i++) {
        int u, v;
        std::cin >> u >> v;
        g[u].push_back(v);
    }

    std::cin >> s >> t;
    std::deque<int> q { s };
    std::vector<std::vector<int>> v(n + 1, std::vector<int>(3));
    v[s][0] = 1;
    int c = 0;
    while (!q.empty()) {
        std::deque<int> nxt;
        ++c;
        for (auto i : q) {
            for (auto to : g[i]) {
                if (v[to][c % 3]) continue;
                v[to][c % 3] = 1;
                nxt.push_back(to);
            }
        }
        std::swap(nxt, q);
        if (v[t][0]) {
            std::cout << c / 3 << std::endl;
            return 0;
        }
    }
    std::cout << -1 << std::endl;

    return 0;
}


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

int main()
{
	string s;
	getline(cin,s);
	
	int a[6]={0};
	
	for(int i=0;i<=5;i++)
	{
		a[i]=s[i];
	}
	if(a[2]==a[3]&&a[4]==a[5])
		cout<<"Yes";
	else
		cout<<"No"; 
	return 0;
}

Measured memory_bytes: 256