akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

double memo[150010];
double ans[150010];
vector<int> G[150010];

void dfs(int idx, int par) {
    int sz = G[idx].size();
    for(auto &to : G[idx]) {
        if(to == par) {
            sz--; continue;
        }
        dfs(to, idx);
        memo[idx] += memo[to] + 1.0;
    }
    if(sz) memo[idx] /= sz;
}

void dfs2(int idx, double d_par, int par) {
    double sum = 0.0;
    int sz = G[idx].size();
    for(auto &to : G[idx]) {
        if(to == par) sum += d_par + 1.0;
        else sum += memo[to] + 1.0;
    }
    // printf("idx = %lld, d_par = %.12lf, par = %lld, sum = %.12lf\n", idx, d_par, par, sum);
    ans[idx] = (sz > 0 ? sum / sz : 0.0);
    for(auto &to : G[idx]) {
        if(to == par) continue;
        dfs2(to, sz > 1 ? (sum - memo[to] - 1.0) / (sz - 1) : 0.0, idx);
    }
}

signed main() {
    int n; cin >> n;
    rep(i,0,n-1) {
        int u, v; cin >> u >> v;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    dfs(0, -1);
    dfs2(0, 0.0, -1);
    rep(i,0,n) printf("%.12f\n", ans[i]);
    return 0;
}

Measured memory_bytes: 19968
#include<bits/stdc++.h>
using namespace std;
using Int = long long;

const Int MOD=998244353;
#define MAX_P 500005
Int fact[MAX_P],inv[MAX_P],finv[MAX_P];;
Int extgcd(Int a,Int b,Int& x,Int& y){
  Int d=a;
  if(b!=0){
    d=extgcd(b,a%b,y,x);
    y-=(a/b)*x;
  }else{
    x=1;y=0;
  }
  return d;
}
Int mod_inverse(Int a,Int mod){
  Int x,y;
  extgcd(a,mod,x,y);
  return (mod+x%mod)%mod;
}

Int mod_pow(Int x,Int n,Int mod){
  Int res=1;
  while(n){
    if(n&1) (res*=x)%=mod;
    (x*=x)%=mod;
    n>>=1;
  }
  return res;
}

Int mod_inverse2(Int a,Int mod){
  return mod_pow(a,mod-2,mod);
}

void init(Int mod){
  fact[0]=1;
  for(Int i=1;i<MAX_P;i++)
    fact[i]=(fact[i-1]*i)%mod;

  inv[1]=1;
  for(Int i=2;i<MAX_P;i++)
    inv[i]=inv[mod%i]*(mod-mod/i)%mod;
  
  finv[0]=1;
  for(Int i=1;i<MAX_P;i++)
    finv[i]=finv[i-1]*inv[i]%mod;
}

Int mod_fact(Int n,Int mod,Int& e){
  e=0;
  if(n==0) return 1;
  Int res=mod_fact(n/mod,mod,e);
  e+=n/mod;
  if(n/mod%2!=0)return res*(mod-fact[n%mod]) %mod;
  return res*fact[n%mod]%mod;
}

Int mod_comb(Int n,Int k,Int mod){
  if(n==k||k==0) return 1;
  Int e1,e2,e3;
  Int a1=mod_fact(n,mod,e1),a2=mod_fact(k,mod,e2),a3=mod_fact(n-k,mod,e3);
  if(e1>e2+e3) return 0;
  return a1*mod_inverse(a2*a3%mod,mod)%mod;
}

Int mod_comb2(Int n,Int k,Int mod){
  Int res=1;
  for(Int i=0;i<k;i++){
    res*=(n-i)%mod;
    res%=mod;
    res*=mod_inverse(i+1,mod);
    res%=mod;
  }
  return res;
}

//only for prime mod
Int mod_comb3(Int n,Int k,Int mod){
  if(k<0||k>n) return 0;
  return fact[n]*finv[k]%mod*finv[n-k]%mod;
}

Int montmort(Int n,Int mod){
  Int res=0,inv=1;
  for(Int k=2;k<=n;k++){
    (inv*=mod_inverse(k,mod))%=mod;
    if(k%2) (res+=mod-inv)%=mod;
    else (res+=inv)%=mod;
  }
  for(Int i=1;i<=n;i++)
    (res*=i)%=mod;
  return res;
}

// calculate P(t) from given points in [0,N]
Int LagrangePolynomial(vector<Int> &y,Int t,const Int mod){
  init(mod);
  Int n=y.size()-1;
  Int num=1;
  for(Int i=0;i<=n;i++)
    num=num*((t-i)%mod)%mod;
  Int res=0;
  for(Int i=0;i<=n;i++){
    Int tmp=(y[i]*num%mod)*mod_inverse((t-i)%mod,mod)%mod;
    tmp=tmp*finv[i]%mod;
    tmp=tmp*finv[n-i]%mod;
    if((n-i)&1) tmp=mod-tmp;
    res=(res+tmp)%mod;
  }
  return res;
}

//INSERT ABOVE HERE
signed main(){
  Int n,A,B,K;
  cin>>n>>A>>B>>K;
 
  Int ans=0;
  init(MOD);
  
  for(Int s=0;s<=n;s++){
    if(K-s*A<0) continue;
    if((K-s*A)%B) continue;
    Int t=(K-s*A)/B;
    ans+=mod_comb3(n,s,MOD)*mod_comb3(n,t,MOD)%MOD;
    ans%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 11904
import math
#n個からr個とるときの組み合わせの数
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

S = int(input())
ans = 0
mod = 10 ** 9 + 7
for i in range(1,S // 3 + 1):      #長さiの数列のとき
   
    x = S - 3 * i       #3を分配後の余り
    
    ans += (combinations_count(x + i - 1, i - 1)) % mod  #重複組み合わせを足す
    ans %= mod

print(ans)


Measured memory_bytes: 9004
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 60;
constexpr auto mod = 1000000007;
constexpr auto MOD = 998244353;
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() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int m, d;
    cin >> m >> d;
    int ans = 0;
    eFOR(i, 1, m)eFOR(j, 1, d) {
        if (j % 10 >= 2 && j / 10 >= 2 && (j / 10) * (j % 10) == i)ans++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int main() {
	long long n, sum = 0;
	cin >> n;
	int a[n * 3];
	for (int i = 0; i < n * 3; i++) {
		cin >> a[i];
	}
	sort(a, a + n * 3);
	reverse(a, a + n * 3);
	for (int i = 1; i < n * 2 + 1; i += 2) {
		sum += a[i];
	}
	cout << sum << endl;
	return 0;
}

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

int main() {
    int n, m;
    vector<string> s, t;

    cin >> n;
    s = vector<string>(n);
    for (int i = 0; i < n; i++) {
        cin >> s.at(i);
    }

    cin >> m;
    t = vector<string>(m);
    for (int i = 0; i < m; i++) {
        cin >> t.at(i);
    }

    int max_score, score;
    string w;
    max_score = 0;
    for (int i = 0; i < n; i++) {
        score = 0;
        w = s.at(i);
        for (int j = 0; j < n; j++) {
            if (w == s.at(j)) score += 1;
        }
        for (int j = 0; j < m; j++) {
            if (w == t.at(j)) score -= 1;
        }
        if (score > max_score) max_score = score;
    }
    cout << max_score << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

long long F[257][311];

int n, C, fir, L[7], A1[257], A2[257], B[33][33], tim = -1, Fac[6] = {1, 1, 2, 6, 24, 120};

int main() {
    scanf("%d%d", &n, &C);
    for(int i = 0; i < n; i++) scanf("%d", &L[i]);
    for(int i = 0; i < (1 << (n - 1)); i++)
        for(int j = 0; j < (1 << (n - 1)); j++)
            if(__builtin_popcount(i) == __builtin_popcount(j)) {
                A1[++tim] = i;
                A2[tim] = j;
                B[i][j] = tim;
            }
    sort(L, L + n);
    fir = L[n - 1];
    memset(F, 0, sizeof F);
    F[0][fir * n] = 1;
    for(int i = 0; i <= C * n; i++) if(i % n)
        for(int S = 0; S < tim; S++) {
            int s1 = A1[S], s2 = A2[S], tmp;
            if((s2 >> (i % n - 1)) & 1) continue;
            tmp = s2 + (1 << (i % n - 1));
            for(int j = i; j <= C * n; j++)
                for(int nxt1 = 0; nxt1 < n - 1; nxt1++) if(!((s1 >> nxt1) & 1))
                    F[B[s1 + (1 << nxt1)][tmp]][min(C * n, max(j, i + L[nxt1] * n))] += F[S][j];
        }
    printf("%.15lf\n", F[tim][C * n] / pow(C, n - 1) / Fac[n - 1]);
    return 0;
}


Measured memory_bytes: 896
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
using namespace std;

const int MAX_V = 1 << 17;
vector<int> G[MAX_V]; //グラフ
int V; //頂点数
int color[MAX_V]; //頂点iの色
queue<pair<int, int> > que;
int d[MAX_V][3];

void bfs(int i, int j) {
  que.push(make_pair(i, j));
  while (!que.empty()) {
    int a = que.front().first, b = que.front().second;
    que.pop();
    for (int k = 0; k < G[a].size(); k++) {
      if (!d[G[a][k]][(b + 1) % 3]) {
	d[G[a][k]][(b + 1) % 3] = d[a][b] + 1;
	que.push(make_pair(G[a][k], (b + 1) % 3));
      }
    }
  }
  return;
}

int main(int argc, char *argv[])
{
  int m;
  cin >> V >> m;
  int from, to;
  for (int i = 0; i < m; i++) {
    cin >> from >> to;
    from--; to--;
    G[from].push_back(to);
  }
  int s, t;
  cin >> s >> t;
  s--; t--;

  bfs(s, 0);

  if (!d[t][0]) cout << -1 << endl;
  else cout << d[t][0] / 3 << endl;

  return 0;
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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


void Main()
{
    int n,k,x,y;cin>>n>>k>>x>>y;

    LL result = min(k,n) * x + max(n-k,0) * y;

    cout<<result<<endl;



	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
// http://drken1215.hatenablog.com/entry/2018/09/08/204300
int main() {
    int N;
    cin >> N;
    vector<long long> a(N);
    vector<long long> b(N);
    REP(i, N) { cin >> a[i]; }
    REP(i, N) { cin >> b[i]; }
    long long res = 0;
    for(int digit = 29; digit >= 0; digit--) {
        int bekihigh = 1 << (digit + 1);
        int bekilow = 1 << digit;
        REP(i, N) {
            a[i] %= bekihigh;
            b[i] %= bekihigh;
        }
        sort(ALL(b));
        long long num = 0;
        for(int i = 0; i < N; i++) {
            int add = 0;
            if(bekilow - a[i] >= 0) {
                add += lower_bound(b.begin(), b.end(), bekihigh - a[i]) -
                       lower_bound(b.begin(), b.end(), bekilow - a[i]);
            } else {
                add += lower_bound(b.begin(), b.end(), bekihigh - a[i]) -
                       b.begin();
                add +=
                    lower_bound(b.begin(), b.end(), bekihigh) -
                    lower_bound(b.begin(), b.end(), bekihigh + bekilow - a[i]);
            }
            num += add;
        }
        if(num & 1) {
            res += bekilow;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3456
n = int(input())
s_t = list()
for i in range(n):
  s, t = input().split()
  s_t.append([s, int(t)])
x = input()

for i in range(n):
  if s_t[i][0] == x:
    print(sum(t_[1] for t_ in s_t[i+1:]))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,A,B;
    cin >> N >> A >> B;
    if(A > B) {
        cout << 0 << endl;
        return 0;
    }
    if(N == 1) {
        if(A == B) {
            cout << 1 << endl;
        }
        else {
            cout << 0 << endl;
        }
    }
    else {
        cout << A+B*(N-1)-(B+A*(N-1))+1 << endl;
    }
}


Measured memory_bytes: 3604
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 10L^^12;

void main() {
    int n, k;
    scan(n, k);
    auto x = readln.split.to!(int[]);

    long ans = inf;

    foreach (i ; 0 .. n - k + 1) {
        long l = x[i].to!long;
        long r = x[i + k - 1].to!long;
        long tmp;

        if (r < 0) {
            tmp = abs(l);
        }
        else if (l < 0) {
            tmp = min(2*abs(l) + r, abs(l) + 2*r);
        }
        else {
            tmp = r;
        }

        debug {
            writefln("%d, %d", l, r);
        }

        ans = min(ans, tmp);
    }

    writeln(ans);
}






















void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 4348
//I am so vegetable
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = 3.141593;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }

int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
	set<string>cnt;
	string s;
	int ans = 0;
	int n;cin>>n;
	_for(i,0,n){
		cin>>s;
		if(!cnt.CT(s)){
			++ans;
			cnt.IN(s);
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 19288
def main():  
    n = int(input())
    xy = [tuple(map(int,input().split())) for _ in range(n)]
    ans = 0
    c = 0
    for i in range(n):
        for j in range(n):
            if i < j:
                x1 = xy[i][0]
                y1 = xy[i][1]
                x2 = xy[j][0]
                y2 = xy[j][1]
                ans += ((x1-x2)**2+(y1-y2)**2)**(1/2)
                c += 1
    print(ans*(n-1)/c)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 38512
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

struct Point { double x, y; };

int crs(double x1, double y1, double x2, double y2) {
    double z = x1 * y2 - y1 * x2;
    return (0 < z ? 1 : (z < 0 ? -1 : 0));
}

bool intersect(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
    if (0 <= crs(x2-x1, y2-y1, x3-x1, y3-y1) * crs(x2-x1, y2-y1, x4-x1, y4-y1)) return false;
    if (0 <= crs(x4-x3, y4-y3, x1-x3, y1-y3) * crs(x4-x3, y4-y3, x2-x3, y2-y3)) return false;
    return true;
}

Point intersection(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
    if (x3 == x4) {
        swap(x1, x3); swap(y1, y3); swap(x2, x4); swap(y2, y4);
    }
    double x, y, a, b, c, d;
    if (x1 == x2) {
        c = (y4 - y3) / (x4 - x3);
        d = y3 - c * x3;
        x = x1;
        y = c * x + d;
    } else {
        a = (y2 - y1) / (x2 - x1);
        b = y1 - a * x1;
        c = (y4 - y3) / (x4 - x3);
        d = y3 - c * x3;
        x = (d - b) / (a - c);
        y = a * x + b;
    }
    return (Point){x, y};
}

int main() {
    int x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6;
    while (cin >> x1 >> y1 >> x2 >> y2, (x1 || y1 || x2 || y2)) {
        cin >> x3 >> y3 >> x4 >> y4 >> x5 >> y5 >> x6 >> y6;
        if ( ! intersect(x1, y1, x2, y2, x3, y3, x4, y4) ||
             ! intersect(x3, y3, x4, y4, x5, y5, x6, y6) ||
             ! intersect(x5, y5, x6, y6, x1, y1, x2, y2)) {
            cout << "kyo" << endl;
        } else {
            Point p1 = intersection(x1, y1, x2, y2, x3, y3, x4, y4);
            Point p2 = intersection(x3, y3, x4, y4, x5, y5, x6, y6);
            Point p3 = intersection(x5, y5, x6, y6, x1, y1, x2, y2);
            double area = abs((p2.x - p1.x) * (p3.y - p1.y) - (p2.y - p1.y) * (p3.x - p1.x)) / 2.0;
            if (area < 0.00000001)
                cout << "kyo" << endl;
            else if (1899999.99999999 < area)
                cout << "dai-kichi" << endl;
            else if (999999.99999999 < area)
                cout << "chu-kichi" << endl;
            else if (99999.99999999 < area)
                cout << "kichi" << endl;
            else
                cout << "syo-kichi" << endl;
        }
    }
    return 0;
}

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

/*

    1: . , ! ? (スペース)
    2: a b c
    3: d e f
    4: g h i
    5: j k l
    6: m n o
    7: p q r s
    8: t u v
    9: w x y z
    0: 確定ボタン 
*/

string button[10] = {" ", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};

string conv(string str) {
  string res = "";
  char c = 'X';
  int num = 0;
  for (int i = 0; i < str.size(); ++i) {
    if (str[i] == '0') {
      if (num > 0) {
	int bu = c - '0';
	int ord = (num - 1) % button[bu].size();
	char add = button[bu][ord];
	res += add;
	num = 0;
      }
    }
    else {
      c = str[i];
      ++num;
    }
  }
  return res;
}

int main() {
  int n; cin >> n;
  for (int i = 0; i < n; ++i) {
    string str; cin >> str;
    cout << conv(str) << endl;
  }
}


Measured memory_bytes: 1216
fun main(args: Array<String>) = yorukatsu9d()

fun yorukatsu9d() {
    val (n, x) = readLine()!!.split(' ').map { it.toLong() }

    val pattyAndBans = LongArray(51)
    pattyAndBans[0] = 1
    for (i in 0 until pattyAndBans.lastIndex) pattyAndBans[i + 1] = pattyAndBans[i] * 2 + 3

    val bans = LongArray(51)
    bans[0] = 1
    for (i in 0 until bans.lastIndex) bans[i + 1] = bans[i] * 2 + 1

    fun dfs(lv: Int, pos: Long): Long {
        if (lv == 0) return 1
        if (pos == 1L) return 0
        if (pos == pattyAndBans[lv]) return bans[lv]
        val mid = pattyAndBans[lv] / 2 + 1
        return when {
            pos < mid -> {
                dfs(lv - 1, pos - 1)
            }
            pos == mid -> {
                bans[lv - 1] + 1
            }
            else -> {
                dfs(lv - 1, pos - mid) + bans[lv - 1] + 1
            }
        }
    }

    val answer = dfs(n.toInt(), x)

    println(answer)
}


Measured memory_bytes: 38264
#include <iostream>
#include <algorithm>
#define ll long long int
using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    int counter[n+1];
    for (int i=1;i<=n;i++) counter[i]=0;
    for (int i=0;i<n-1;i++) {
        int a;
        scanf("%d", &a);
        counter[a]++;
    }
    for (int i=1;i<=n;i++) printf("%d\n", counter[i]);
}


Measured memory_bytes: 4008
#include<bits/stdc++.h>
using namespace std ; 
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fast ios_base:: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define pii pair<int,int> 
long long M  = 1e9+7;

bool check(string s){
	int i=0,j = s.size()-1;
	while(i<j){
		if(s[i] != s[j]){
			return false;
		}
		i++,j--;
	}
	return true;
}

signed main(){
    fast;
    string s; cin >> s;
    int n = s.size();
    string a = "",b="";
    for(int i=0 ; i<(n-1)/2 ; i++)
    	a.pb(s[i]);
    for(int i=(n+3)/2-1 ; i<n ; i++)
    	b.pb(s[i]);

    if(check(a) &&  check(b) && check(s)){
    	cout  << "Yes" << endl;
    } 
    else
    	cout << "No" << endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FScanner sc = new FScanner();
		int N = sc.nextInt();
		long[] divide = new long[N];
		long sum = 0;
		for (int i = 0; i < N; i++) {
			long val = sc.nextLong();
			divide[i] = val;
			sum += val;
		}
		long half = sum / 2;
		long pIndex = 0;
		long lIndex = 0;
		long tmpSum = 0;
		for (int i = 0; i < N; i++) {
			tmpSum += divide[i];
			if (tmpSum <= half) {
				pIndex = tmpSum;
			}
			if (tmpSum >= half) {
				lIndex = tmpSum;
				break;
			}
		}
		if (pIndex == lIndex) {
			System.out.println(0);
			return;
		}
		long pNear = half - pIndex;
		long lNear = lIndex - half;
		if (pNear < lNear) {
			long abs = Math.abs(pIndex - (sum - pIndex));
			System.out.println(abs);
			return;
		} else {
			long abs = Math.abs(lIndex - (sum - lIndex));
			System.out.println(abs);
			return;
		}
	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 24604
A,B,M = map(int,input().split())
MList = [[0,0,0] for i in range(M)]
a = list(map(int,input().split()))
b = list(map(int,input().split()))
for i in range(M):
    MList[i] = list(map(int,input().split()))

ans = sorted(a)[0] + sorted(b)[0] 

for i in range(M):
    price = a[MList[i][0]-1] + b[MList[i][1]-1] - MList[i][2]
    if (ans > price):
        ans = price

print(ans)

Measured memory_bytes: 39724
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

int main()
{
	int n = 0;
	int k = 0;

	scanf("%d", &n);
	scanf("%d", &k);

	if (n % k == 0) {
		printf("0");
	}else {
		printf("1");
	}

	return 0;


}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_131
{
    class F
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[][] xys = new int[n][];
            for(int i = 0; i < n; i++)
            {
                xys[i] = ReadInts();
            }

            int length = 100000 + 5;
            List<int>[] graph = new List<int>[length * 2];
            for(int i =0; i < length; i++)
            {
                graph[i] = new List<int>();
                graph[i + length] = new List<int>();
            }

            for(int i = 0; i < n; i++)
            {
                graph[xys[i][0]].Add(length + xys[i][1]);
                graph[length + xys[i][1]].Add(xys[i][0]);
            }

            bool[] used = new bool[length * 2];
            long res = 0;
            for(int i = 0; i < length*2; i++)
            {
                if (used[i]) continue;

                Queue<int> que = new Queue<int>();
                long edges = 0;
                long xs = 0;
                long ys = 0;
                que.Enqueue(i);
                while (que.Count > 0)
                {
                    int index = que.Dequeue();
                    if (used[index]) continue;

                    used[index] = true;
                    if (index < length) xs++;
                    else ys++;
                    edges += graph[index].Count;
                    for (int j = 0; j < graph[index].Count; j++)
                    {
                        if (used[graph[index][j]]) continue;

                        que.Enqueue(graph[index][j]);
                    }
                }
                edges /= 2;
                if (xs >= 2 && ys >= 2) res += xs * ys - edges;
            }

            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 41676
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A, B):
    m = N // (A + B)
    x = m * A
    return x + min((N-(A+B)*m), A)


def main():
    N, A, B = read_int_n()
    print(slv(N, A, B))


if __name__ == '__main__':
    main()


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

int main(void){
    int n;
    cin >> n;
    int a[n];
    int sum = 0;
    for(int i = 0;i < n;i++)cin >> a[i];
    for(int i = 0;i < n-1;i++){
        if(a[i] == a[i+1]){
            sum++;
            a[i+1] = 0;
        }
    }
    cout << sum;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define all(a) (a).begin(),(a).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=10000000000000000;

int main(){
    int n,w;
    cin >> n >> w;
    int k=100100;
    vector<vector<ll>> dp(n+1,vector<ll>(k,INF));
    rep(i,n+1) dp.at(i).at(0)=0;
    rep(i,n){
        ll f,g;
        cin >> f >> g;
        rep(j,k)  dp.at(i+1).at(j)=dp.at(i).at(j);
        rep(j,k){
            if (j+g>k-1) break;
            dp.at(i+1).at(j+g)=min(dp.at(i+1).at(j+g),dp.at(i).at(j)+f);
        }
    }
    ll ans=0;
    rep(i,k) {
        if (dp.at(n).at(i)<=w) ans=i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 80256
from math import sqrt

n = int(input())
p = n
count = 0

for i in range(2, int(sqrt(n)) + 1):
    e = 1
    while n % i ** e == 0:
        n //= i ** e
        count += 1
        e += 1
    if n % i == 0:
        while n % i == 0:
            n //= i

if n != 1:
    count += 1
if count == 0 and p != 1:
    count = 1

print(count)


Measured memory_bytes: 64008
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut arr:Vec<u64> = (0..5).map(|_| read()).collect();
    arr.sort_by_key(|&x| ((x as f64/10.0).ceil()*10.0)as u64 - x );
    let mut cnt = 0.0;
    let last = arr.pop().unwrap();
    for i in arr {
        cnt += (i as f64 / 10.0).ceil() * 10.0;
    }
    cnt += last as f64;
    println!("{}", cnt);
}


Measured memory_bytes: 4352
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"
#include "cmath"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<ll> > mat;


int main()
{
  string s;
  cin >> s;
  string a[7] = {"SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"};
  for (int i = 0; i < 7; i++)
  {
    if (a[i] == s)
    {
      cout << i + 1 << "\n";
    }
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_168
{
    class C
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] abhm = ReadInts();
            int a = abhm[0];
            int b = abhm[1];
            int h = abhm[2];
            int m = abhm[3];
            double x1 = a * Cos(PI / 2 - 2 * PI * h / 12 - PI / 6 * m / 60);
            double y1 = a * Sin(PI / 2 - 2 * PI * h / 12 - PI / 6 * m / 60);
            double x2 = b * Cos(PI / 2 - 2 * PI * m / 60);
            double y2 = b * Sin(PI / 2 - 2 * PI * m / 60);

            WriteLine(Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 27992
mod = 2019
l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
else:
    ans = 10**10
    for i in range(l, r):
        for j in range(i+1, r+1):
            ans = min(ans, (i*j)%mod)
    print(ans)

Measured memory_bytes: 40812
import java.util.Scanner;
public class Main {
  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);

    int N = stdIn.nextInt();
    int K = stdIn.nextInt();

    int number = 1;

    for(int i=1; i<=N; i++){
      if(number*2 < number+K){
        number = number*2;
      }
      else{
        number = number+K;
      }

    }
    System.out.println(number);
  }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
const int SZ = 405;
char graph[SZ][SZ];
int visit[SZ][SZ];
int n,m; 
long long b,w;
void dfs(int x, int y){
	visit[x][y]=1;
	if(graph[x][y]=='#') b++;
	else w++;
	int dx[4]={0,0,1,-1}; int dy[4]={1,-1,0,0};
	for(int i=0;i<4;i++){
		int nx = x+dx[i]; int ny = y+dy[i];
		if(nx<0 || nx>=n) continue;
		if(ny<0 || ny>=m) continue;
		if(graph[x][y]==graph[nx][ny]) continue;
		if(visit[nx][ny]==1) continue;
		dfs(nx,ny);
	}
}
int main(void){
	scanf("%d %d",&n,&m); getchar();
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++) graph[i][j]=getchar();
		getchar();
	}
	long long aa = 0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			b = 0; w = 0;
			if(visit[i][j]==1) continue;
			if(graph[i][j]=='#') dfs(i,j); 
			aa += b*w;
		}
	}
	printf("%lld",aa);
	return 0;
}

Measured memory_bytes: 16000
#include <stdio.h>
int main(void){
    // Your code here!
    int town[4]={0,0,0,0},num1,num2,cnt=0;
    
    scanf("%d %d",&num1,&num2);
    town[num1-1]++; town[num2-1]++;
    scanf("%d %d",&num1,&num2);
    town[num1-1]++; town[num2-1]++;
    scanf("%d %d",&num1,&num2);
    town[num1-1]++; town[num2-1]++;
    
    for(int i=0;i<4;i++){
        if(town[i]%2==1){
            cnt++;
        }
    }
    
    if(cnt==0 || cnt==2){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
}


Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>

int main(void){
	int x, h;
	double ans;

	while(1){
		scanf("%d %d", &x, &h);
		if(x == 0 && h == 0) break;

		ans = x*x + 4*(sqrt((x/2.0)*(x/2.0) + h*h) * x / 2.0);
		printf("%6f\n", ans);
	}


	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
  int sx,sy,gx,gy;
  cin>>sx>>sy>>gx>>gy;
  for(int i=sy;i<gy;i++){
    cout<<'U';
  }
  for(int i=sx;i<gx;i++){
    cout<<'R';
  }
  for(int i=sy;i<gy;i++){
    cout<<'D';
  }
  for(int i=sx;i<gx;i++){
    cout<<'L';
  }
  cout<<'L';
  for(int i=sy;i<=gy;i++){
    cout<<'U';
  }
  for(int i=sx;i<=gx;i++){
    cout<<'R';
  }
  cout<<"DR";
  for(int i=sy;i<=gy;i++){
    cout<<'D';
  }
  for(int i=sx;i<=gx;i++){
    cout<<'L';
  }
  cout<<'U'<<endl;
  return(0);
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007; 
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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

class UnionFind{
    std::vector<int> par;
    std::vector<int> rank;
    std::vector<int> membnum;

public:
    UnionFind(){}
    UnionFind(int n): par(n), rank(n), membnum(n){
        for(int i(0); i < n; ++i){
            par[i] = i;
            rank[i] = 0;
            membnum[i] = 1;
        }
    }

    void resize(int n){
        int m(par.size());
        par.resize(n);
        rank.resize(n, 0);
        membnum.resize(n, 1);
        for(int i(m); i < n; ++i) par[i] = i;
    }

    int find(int x){
        if(x == par[x]) return x;
        else return par[x] = find(par[x]);
    }

    bool unit(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return false;

        if(rank[x] < rank[y]){
            par[x] = y;
            membnum[y] += membnum[x];
        }else{
            par[y] = x;
            if(rank[x] == rank[y]) ++rank[x];
            membnum[x] += membnum[y];
        }
        return true;
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }

    int howmany(int x){ //同じグループに属すものの個数(自分を含む)
        return membnum[find(x)];
    }
};





int main(){
    int N, M; std::cin >> N >> M;
    UnionFind uf(N);
    std::vector<int> a(M), b(M);
    for(int i(0); i < M; ++i){
        std::cin >> a[i] >> b[i];
        --a[i]; --b[i];
    }
    std::vector<long long> ans(M);
    long long cnt((long long)N * (N - 1) / 2);
    ans[M-1] = cnt;
    for(int i(M-1); i > 0; --i){
        if(!uf.same(a[i], b[i])){
            long long n1(uf.howmany(a[i])), n2(uf.howmany(b[i]));
            cnt -= n1 * n2;
            uf.unit(a[i], b[i]);
        }
        ans[i-1] = cnt;
    }
    for(int i(0); i < M; ++i){
        std::cout << ans[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int llu;
typedef long double ld;
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pair<int,int>>
#define pb push_back
#define pf push_front
#define mp map<ll,ll>
#define INF 1000000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
ll gcd(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    else
    {
        return gcd(b%a,a);   
    }
}
ll lcm(ll a,ll b)
{
    return a*b/gcd(a,b);
}
int f(char c)
{
    return (int)c-96;
}
/**********************************************************************
***********************************************************************
*********************ACTUAL CODE BEGINS HERE***************************/
int main()
{   
    fast;
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll m=-INF;
    m=max(m,a*c);
    m=max(m,a*d);
    m=max(m,b*c);
    m=max(m,b*d);
    cout<<m;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  ll n,d;
  cin>>n>>d;
  int ans=0;
  
  rep(i,0,n){
   ll x,y;
    cin>>x>>y;
    if(x*x+y*y<=d*d){
     ans++; 
    }
  }
  
  
  cout<<ans<<endl;
}

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

typedef long long ll;
ll N, Q;
// w, c, d
vector<vector<tuple<ll, ll, ll>>> Adj;
const ll LEVEL = 20;
vector<vector<ll>> Anc;
vector<ll> Dist, Depth;
// query id, coefficient, x, y
vector<vector<tuple<ll, ll, ll, ll>>> Calc;
// sum of lengths, number
vector<pair<ll, ll>> ColorInfo;
vector<ll> R;

void init_dfs(ll v, ll par, ll depth, ll dist) {
  Anc[v][0] = par;
  Depth[v] = depth;
  Dist[v] = dist;
  for (auto edge : Adj[v]) {
    ll w = get<0>(edge);
    if (w == par) continue;
    ll d = get<2>(edge);
    init_dfs(w, v, depth + 1, dist + d);
  }
}
ll lca(ll u, ll v) {
  if (Depth[u] > Depth[v]) swap(u, v);
  for (ll k = LEVEL - 1; k >= 0; --k) {
    if ((Depth[v] - Depth[u]) & (1 << k)) v = Anc[v][k];
  }
  if (u == v) return u;
  for (ll k = LEVEL - 1; k >= 0; --k) {
    if (Anc[u][k] != Anc[v][k]) {
      u = Anc[u][k];
      v = Anc[v][k];
    }
  }
  return Anc[u][0];
}
void dfs(ll v, ll par) {
  for (auto calc : Calc[v]) {
    ll i = get<0>(calc), coeff = get<1>(calc);
    ll x = get<2>(calc), y = get<3>(calc);
    R[i] += coeff * (Dist[v] - ColorInfo[x].first + y * ColorInfo[x].second);
  }
  for (auto edge : Adj[v]) {
    ll w = get<0>(edge);
    if (w == par) continue;
    ll c = get<1>(edge), d = get<2>(edge);
    ColorInfo[c].first += d;
    ++ColorInfo[c].second;
    dfs(w, v);
    ColorInfo[c].first -= d;
    --ColorInfo[c].second;
  }
}
int main() {
  cin >> N >> Q;
  Adj.resize(N);
  for (ll i = 0; i < N - 1; ++i) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    --a;
    --b;
    --c;
    Adj[a].push_back(make_tuple(b, c, d));
    Adj[b].push_back(make_tuple(a, c, d));
  }
  Anc.resize(N);
  for (auto &anc : Anc) anc.resize(LEVEL, -1);
  Depth.resize(N);
  Dist.resize(N);
  init_dfs(0, -1, 0, 0);
  for (ll k = 1; k < LEVEL; ++k) {
    for (ll v = 0; v < N; ++v) {
      if (Anc[v][k - 1] != -1) Anc[v][k] = Anc[Anc[v][k - 1]][k - 1];
    }
  }
  Calc.resize(N);
  for (ll i = 0; i < Q; ++i) {
    ll x, y, u, v;
    cin >> x >> y >> u >> v;
    --x;
    --u;
    --v;
    ll w = lca(u, v);
    Calc[u].push_back(make_tuple(i, 1, x, y));
    Calc[v].push_back(make_tuple(i, 1, x, y));
    Calc[w].push_back(make_tuple(i, -2, x, y));
  }
  ColorInfo.resize(N - 1);
  R.resize(Q);
  dfs(0, -1);
  for (ll r : R) cout << r << endl;
  return 0;
}


Measured memory_bytes: 53104
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,k;
    cin>>a>>b>>k;
    int c=a+k-1;
    for(int i=a;i<=min(b,c);i++){
        cout<<i<<endl;
    }
    for(int i=max(c+1,(b-k+1));i<=b;i++){
        cout<<i<<endl;
    }
    getchar();
    getchar();
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
AB = [[int(x) for x in input().split()] for _ in range(M)]
G = [[] for _ in range(N+1)]
for a,b in AB:  
  G[a].append(b)
  G[b].append(a)
color = [None]*(N+1)  
color[1] = 0
q = [1]
# 二部グラフ判定
while q:
  x = q.pop()
  for y in G[x]:
    if color[y] is None:
      color[y] = 1 - color[x]
      q.append(y)
bl = all(color[a] != color[b] for a, b in AB)      
# ans
if bl:
  # 二部グラフ
  x = sum(color[1:])
  y = N-x
  print(x*y-M)
else:
  # 完全グラフ
  print(N*(N-1)//2-M)

Measured memory_bytes: 34652
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

const int mod = (int) 1e9 + 7;

void add(int &x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int mult(int x, int y) {
  return (long long) x * y % mod;
}

int power(int x, int pw) {
  int res = 1;
  for (; pw; pw >>= 1) {
    if (pw & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
  }
  return res;
}

void precalc() {
}


const int maxn = (int) 3e3 + 10;
int n, m;

int read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return 0;
  }
  return 1;
}

int dp[2][maxn];
int ndp[2][maxn];

void solve() {
  for (int i = 0; i < n; ++i) {
    dp[0][i] = 2;
    dp[1][i] = 0;
    if (!i) {
      swap(dp[0][i], dp[1][i]);
    }
  }

  for (int iter = 0; iter < m - 1; ++iter) {
    for (int t = 0; t < 2; ++t) {
      for (int i = 0; i < n; ++i) {
        ndp[t][i] = 0;
      }
    }
    for (int t = 0; t < 2; ++t) {
      for (int i = 0; i < n; ++i) {
        auto cur = dp[t][i];
        if (!cur) {
          continue;
        }
        add(ndp[t][i], cur);
        add(ndp[t][i], cur);

        if (i) {
          add(ndp[(i == 1) ? 1 : t][i - 1], cur);
        }
        if (i < n - 1) {
          add(ndp[t][i + 1], cur);
        }
      }
    }
    swap(dp, ndp);
  }

  int res = 0;
  for (int i = 0; i < n; ++i) {
    int cur = dp[1][i];
    add(cur, cur);
    add(res, cur);
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 256
# coding: utf-8
sa = input()
sb = input()
sc = input()
d = {"A":sa, "B":sb, "C":sc}
s = d["A"][0].upper()
d[s] = d[s][1:]
while True:
    if len(d[s]) == 0:
        print(s)
        break
    tmp = d[s][0].upper()
    d[s] = d[s][1:]
    # if len(d[tmp]) == 0:
    #     print(tmp)
    #     break
    s = tmp[:]

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll n;
  cin >> n;
  map<string, ll> ma;
  string s;
  rep(i, n) {
    cin >> s;
    ma[s]++;
  }

  ll maxi = 0;
  for (auto&& i : ma) {
    cmax(maxi, i.second);
  }

  cerr << endl;
  for (auto&& i : ma) {
    if (i.second == maxi) {
      cout << i.first << endl;
    }
  }
}


Measured memory_bytes: 23808
n, k = map(int, input().split())

from collections import Counter
c = Counter(list(map(int, input().split())))

#Counterからの取り出し
l = []
m = []
for x, y in c.items():
    l += [y]
    m += [x]

L = sorted(l)
M = len(m)

cnt = 0 
if M <= k:
    print(0)
else:
    for i in range(M-k):
        cnt += L[i]
    print(cnt)

Measured memory_bytes: 137228