akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
long degree(long n){
  long hoge = 10;
  long i = 0;
  for(i=1;i<=10;i++){
    if(hoge > n){
      return i;
    }else{
      hoge *= 10;
    }
  }
}

long max_side(long a,long b){
  if(a<b){
    return b;
  }else{
    return a;
  }
}
    
int main(){
  long n = 0;
  long i = 0;
  long hoge = 0;
  long minhoge = -1;
  scanf("%ld",&n);
  for(i=1;i<sqrt(n)+1;i++){
    if(n % i == 0){
      hoge = max_side(degree(i),degree(n/i));
      if(minhoge > hoge || minhoge == -1){
        minhoge = hoge;
      }
    }
  }
  
  printf("%ld",minhoge);
  //printf("%ld",degree(99999));
  return 0;
}

Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#include <assert.h>
#include <numeric>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)(5e5+5)
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int bit[mxn];
void add(int x,int v){
	for(;x<mxn;x+=x&(-x)) bit[x]+=v;
}int query(int x){
	int s=0;for(;x;x-=x&(-x)) s+=bit[x];
	return s;
}
int main(){fast;
	int n,q,i;cin>>n>>q;vector<int>c(n),ans(q);for(i=0;i<n;i++) cin>>c[i];
	map<int,int>mp;vector<vector<pair<int,int> > >v(mxn);
	for(i=0;i<q;i++){
		int x,y;cin>>x>>y;
		v[y].pb(mkp(x,i));
	}for(i=0;i<n;i++){
		if(mp[c[i]]) add(mp[c[i]],-1);
		add(i+1,1);mp[c[i]]=i+1;
		for(auto j:v[i+1]){
			ans[j.se]=query(i+1)-query(j.fs-1);
		}
	}for(i=0;i<q;i++) cout<<ans[i]<<endl;
}


Measured memory_bytes: 54688
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  double l;
  cin >> l;
  l /= 3;
  cout << fixed << setprecision(15);
  cout << l * l * l << endl;
  return 0;
}

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

int main() {
  int A, B, Q; cin >> A >> B >> Q;
  vector<ll> s(A), t(B);
  for (int i = 0; i < A; i++) cin >> s[i];
  for (int i = 0; i < B; i++) cin >> t[i];
  auto f = [&](const vector<ll> &v, ll k) -> int {
    int lo = 0, hi = v.size();
    while (hi - lo > 1) {
      int mid = lo + (hi - lo)/2;
      if (v[mid] <= k) lo = mid;
      else hi = mid;
    }
    return lo;
  };
  auto g = [&](bool sf, int idx, ll k) -> ll {
    const auto &a = sf ? s : t, &b = sf ? t : s;
    if (idx >= a.size()) return 1e18;
    ll sc = abs(a[idx] - k);
    int bidx = f(b, a[idx]);
    sc += min(abs(a[idx] - b[bidx]), abs(a[idx] - b[min(bidx + 1, (int)b.size() - 1)]));
    return sc;
  };
  while (Q--) {
    ll x; cin >> x;
    int sidx = f(s, x), tidx = f(t, x);
    cout << min({g(true, sidx, x), g(true, sidx + 1, x), g(false, tidx, x), g(false, tidx + 1, x)}) << endl;
  }
  return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    for(ll i=0; i<n; ++i){cin >> a[i];}
    ll res = 0;
    for(ll i=1; i<n; ++i){
        if(a[i-1]>a[i]){
            ll d = a[i-1] - a[i];
            res += d;
            a[i] = a[i-1];
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4836
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long x,y;
    cin>>x>>y;
    int i;
    if(y==1||x==y||x%y==0)
    {
        cout<<"-1\n";
        return 0;
    }
        cout<<x<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int a[2005];
	int f=0;
	for(int i=0;i<n;i++) 
		cin >> a[i] ;
	sort(a,a+n);
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n;j++) 
			for(int k=j+1;k<n;k++) {
				if(a[i]<a[j]+a[k]&&a[j]<a[i]+a[k]&&a[k]<a[j]+a[i]) f++;
				else break;
			} 
				
	cout << f<<endl;
	return 0;
}



Measured memory_bytes: 256
N, K = map(int, input().split())
Demand = []
for i in range(N):
    x, y, c = input().split()
    x, y = int(x), int(y)
    if c == 'W':
        y += K
    Demand.append([x % (2 * K), y % (2 * K)])


class Ruisekiwa2D:
    def __init__(self, h, w):
        self.H = h
        self.W = w
        self.G = [[0] * w for _ in range(h)]

    def load(self, points):
        # 問題によってイメージしやすいよう書き換えてください
        for x, y in points:
            self.G[x][y] += 1

    def load_imos(self, points):
        # pointsは[[左上h, 左上w, 右下h, 右下w], ...]であること
        for i1, j1, i2, j2 in points:
            self.G[i1][j1] += 1  # 左上
            if j2 + 1 < self.W:  # 右上
                self.G[i1][j2 + 1] -= 1
            if i2 + 1 < self.H:
                self.G[i2 + 1][j1] -= 1  # 左下
            if j2 + 1 < self.W and i2 + 1 < self.H:  # 右下
                self.G[i2 + 1][j2 + 1] += 1

    def calc(self):
        for y in range(self.W):
            for x in range(1, self.H):
                self.G[x][y] += self.G[x - 1][y]

        for y in range(1, self.W):
            for x in range(self.H):
                self.G[x][y] += self.G[x][y - 1]

    def get(self, i1, j1, i2, j2):
        if i1 > i2 or j1 > j2 or i1 < 0 or j1 < 0 or i2 < 0 or j2 < 0:
            return 0
        elif i1 > 0 and j1 > 0:
            return self.G[i2][j2] - self.G[i1 - 1][j2] - self.G[i2][j1 - 1] + self.G[i1 - 1][j1 - 1]
        elif i1 <= 0 < j1:
            return self.G[i2][j2] - self.G[i2][j1 - 1]
        elif j1 <= 0 < i1:
            return self.G[i2][j2] - self.G[i1 - 1][j2]
        else:
            return self.G[i2][j2]


R2D = Ruisekiwa2D(2 * K, 2 * K)
R2D.load(Demand)
R2D.calc()


ans = 0
for x in range(K):
    for y in range(K):
        cnt = 0
        cnt += R2D.get(x, y, x + K - 1, y + K - 1)  # 真ん中
        cnt += R2D.get(0, 0, x - 1, y - 1)  # 左上
        cnt += R2D.get(x + K, 0, 2 * K - 1, y - 1)  # 右上
        cnt += R2D.get(0, y + K, x - 1, 2 * K - 1)  # 左下
        cnt += R2D.get(x + K, y + K, 2 * K - 1, 2 * K - 1)  # 右下
        ans = max(ans, cnt, N - cnt)

print(ans)


Measured memory_bytes: 95064
import math

def isprime(z):
    if z == 2:
        return True
    
    if z < 2 or z % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(z):
        if z % i == 0:
            return False
        i += 2
    return True

if __name__ == '__main__':
    n = int(input())
    c = 0
    for _ in range(n):
        if isprime(int(input())):
            c += 1
    print (c)


Measured memory_bytes: 5676
#include <iostream>
int cnt(int n)
{
  int total = (n % 10);
  while (n/10 != 0) {
    n /= 10;
    total += (n % 10);
  }
  return total;
}

int main()
{
  int N, A, B;
  std::cin >> N >> A >> B;
  int ans = 0;

  for ( int i = 1; i <= N; i++ ) {
    int total = cnt(i);
    if ( total >= A && total <= B ) {
      ans += i;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long cnt;
int A[200010], tmp[200010];

void margeSort(int l, int r) {
    if (r - l == 1) return;
    int m = (l + r) / 2;
    margeSort(l, m);
    margeSort(m, r);
    int i = 0;
    for (int il = l, ir = m; il < m || ir < r;)
        if (il < m)
            if (ir < r)
                tmp[i++] = A[il] > A[ir] ? (cnt += m - il, A[ir++]) : A[il++];
            else
                tmp[i++] = A[il++];
        else
            tmp[i++] = A[ir++];
    for (int j = 0; j < i; ++j) A[l + j] = tmp[j];
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> A[i];
    margeSort(0, n);
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 4660
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <chrono>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <cassert>
# include <array>
# include <tuple>
# include <cctype>
# include <unistd.h>
# include <unordered_map>
# include <unordered_set>
using namespace std;

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

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fast_work {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}

const ll INF = 1e18 + 5, NMAX = 1e6 + 5, MOD = 1000000007, N = 1e9 + 5, LOG = 25;
const ld EPS = 1e-8, pi = 3.14159265358979323846;

signed main() {
    fast_work

    string s;
    cin >> s;

    if(s.back() == 's') s += "es"; else s += "s";

    cout << s;
}


Measured memory_bytes: 3636
/*......................*/
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double   ld;

//#include <ext/pb_ds/assoc_container.hpp>   
//#include <ext/pb_ds/tree_policy.hpp>  
//#include <functional> 
//using namespace __gnu_pbds;  
//typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> OST;           //unique elements 

#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1000000007
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL);
#define    pb                       push_back
#define    pf                       push_front
#define    mp                       make_pair
#define    T                        int t; cin >> t; while(t--)
#define    ff                       first
#define    ss                       second
#define    all(container)           container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    pll                      pair <long long int , long long int>
#define    setp(x)                  setprecision(x)
#define    ook(x)                   order_of_key(x)
#define    fbo(x)                   find_by_order(x)

//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

void solve(){
   
}

int main(){                                       //constraints , long long
     speed upp
     int n; cin >> n;
     int arr[n+5];
     arr[0] = -1;
     f(i,1,n){
         cin >> arr[i];
         if(arr[i] > arr[i-1]){
             arr[i]--;
         }
         if(arr[i] < arr[i-1]){
             cout << "No\n"; return 0;
         }
     }
     cout << "Yes\n";
}




Measured memory_bytes: 640
#include <iostream>
#include <sstream>
using namespace std;
int main(){
    int a;
    cin >> a;
    int b = a / 3600;
    int c = (a- b * 3600) / 60;
    int d = a - b*3600 - c * 60;
    cout << b << ':' << c << ':' << d << endl;
    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    int a,i,ans=0;
    cin >> s >> t;

    a=s.size();

    for(i=0;i<a;i++){
        if(s.at(i)!=t.at(i)){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3840
// In The Name Of The Queen
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, q, L[N], R[N], C[N];
long long dp[N];
vector < int > V[N], U[N];
int main()
{
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= q; i ++)
    {
        scanf("%d%d%d", &L[i], &R[i], &C[i]);
        V[L[i]].push_back(i);
        U[R[i]].push_back(i);
    }
    dp[1] = 0;
    set < pair < long long , int > > ST;
    for (int i = 1; i <= n; i ++)
    {
        if (i > 1 && !ST.size())
            return !printf("-1\n");
        if (i > 1)
            dp[i] = ST.begin()->first;
        for (int id : V[i])
            ST.insert({C[id] + dp[i], id});
        for (int id : U[i])
            ST.erase({C[id] + dp[L[id]], id});
    }
    printf("%lld\n", dp[n]);
    return 0;
}

Measured memory_bytes: 13696
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

ll powmod(ll m, ll p) {
    if (p == 0) return 1;
    ll tmp = powmod(m, p / 2);
    if (p & 1) return (tmp * tmp % MOD) * m % MOD;
    else return tmp * tmp % MOD;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll m, n; cin >> m >> n;
    cout << powmod(m, n) << '\n';
    return 0;
}



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

int main(){
  ll a,b,n; cin >> a >> b >> n;

  ll kakeru = 1;
  ll ans = 0;
  bool flag = false;
  if(b * kakeru - 1 <= n) {
    flag = true;
    ll tmp = (a * (b * kakeru - 1)) / b;
    //cout << tmp << endl;
    ans = max(ans,tmp);
    kakeru++;
  }

  if(!flag) {
    ans = (a * n) / b;
    ll tmp = n / b;
    tmp = tmp * a;
    ans = ans - tmp;
  }

  cout << ans << endl;
}




Measured memory_bytes: 3676
#include <stdio.h>
int main(void){
  int e,y;
  scanf("%d %d",&e,&y);
  if(e==0){
      if(1868<=y&&y<=1911) printf("M%d\n",y-1868+1);
      else if(1912<=y&&y<=1925) printf("T%d\n",y-1912+1);
      else if(1926<=y&&y<=1988) printf("S%d\n",y-1926+1);
      else printf("H%d\n",y-1989+1);
  }
  else if(e==1) printf("%d\n",1867+y);
  else if(e==2) printf("%d\n",1911+y);
  else if(e==3) printf("%d\n",1925+y);
  else printf("%d\n",1988+y);
   return 0;
}






Measured memory_bytes: 2112
def main():
    a, b = map(int, input().split())

    xs = [0]
    for i in range(1, 999+1):
        xs.append(xs[-1] + i)

    diff = b - a
    w = xs[diff]
    ans = w - b
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import numpy as np
n = list(map(int,input().split()))
h = list(map(int,input().split()))
s = 0

x = []

i=0
for hi in h:
    x.append((i+1,hi))
    i = i+1 

# print(x)
xs = sorted(x, key = lambda k:k[1])
# for q in xs:
#    print(q)
print(*list(map(lambda k:k[0], xs)))



Measured memory_bytes: 29844
s = input()

isOdd = True
for i in range(len(s)):
    if i % 2 == 1:
        if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
            isOdd = False

isEven = True
for i in range(len(s)):
    if i == 0 or i % 2 == 0:
        if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
            isEven = False

if isOdd == True and isEven == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
#include <stdio.h>
int main(){
	int n,sum = 0, i;
	scanf("%d", &n);
	int a[n],b[n],c[n-1];
	for(i=0;i<n;++i){
		scanf("%d", &a[i]);
	}
	for(i=0;i < n;++i){
		scanf("%d", &b[i]);
	}
	for(i=0;i < n-1 ;++i){
		scanf("%d", &c[i]);
	}
	for(i=0; i < n;++i){
		if ((i != 0) && (a[i] == a[i-1]+1)){
			sum += c[a[i-1]-1];
		}
		sum += b[a[i]-1];
	}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <algorithm>

using namespace std;

int N, M, X;
int a[200];

int main()
{
	int left = 0;
	int right = 0;
	cin >> N;
	cin >> M;
	cin >> X;

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

	for (int j = X; j < N + 1; ++j) {
		for (int k = 0; k < M; ++k) {
			if (j == a[k]) {
				right = right + 1;
			}
		}
	}
	
	for (int s = X; s > 0; s--) {
		for (int k = 0; k < M; ++k) {
			if (s == a[k]) {
				left = left + 1;
			}
		}
	}
	
	int ans = min(right,left);
	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

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



int main() {
  char _a, _b, _c, _d;
  cin >> _a >> _b >> _c >> _d;
  int a=_a-'0', b=_b-'0', c=_c-'0', d=_d-'0';

  rep(i, 8) {
    int ans = a;
    ans += (((i>>0)&1)==1 ? b : -b);
    ans += (((i>>1)&1)==1 ? c : -c);
    ans += (((i>>2)&1)==1 ? d : -d);
    if(ans == 7) {
      char op1 = (((i>>0)&1)==1 ? '+' : '-');
      char op2 = (((i>>1)&1)==1 ? '+' : '-');
      char op3 = (((i>>2)&1)==1 ? '+' : '-');
      cout << a << op1 << b << op2 << c << op3 << d << "=7" << endl;
      return 0;
    }
  }

  return 0;
}

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

int main(){
    int D,N;
    cin>>D>>N;
    if(D==0&&N!=100){
        cout<<1*N<<endl;
    }else if(D==0&&N==100){
        cout<<101<<endl;
    }else if(D==1&&N!=100){
        cout<<100*N<<endl;
    }else if(D==1&&N==100){
        cout<<10100<<endl;
    }else if(D==2&&N==100){
        cout<<1010000<<endl;
    }else{
        cout<<10000*N<<endl;
    }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;
const int N = 5e5 + 10;
//const int mod = 1e9 + 7;

ll fac[N];

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

void init() {
    fac[0] = 1;
    for (int i = 1; i < N; i++)
        fac[i] = fac[i - 1] * i % mod;
}

ll inv(ll a) {
	return binpow(a, mod - 2);
}

ll A(ll n, ll m) {
	return fac[n] * inv(fac[n - m]) % mod;
}

ll C(ll n, ll m) {
    return fac[n] * inv(fac[m]) % mod * inv(fac[n - m]) % mod;
}

void solve(){
     init();
     int n;cin >> n;
     int ans = 0;
     vector<int>a(105);
     for(int i = 2;i<=n;i++){
        int temp = i;
        for(int j = 2;j<100;j++){
            while(temp%j==0){temp /= j;a[j]++;}
        }
     }
     int cnt3 = 0;int cnt5 = 0;int cnt25 = 0;int cnt15 = 0;int cnt75 = 0;
     for(int i = 0;i<=100;i++){
            if(a[i]>=74) cnt75++;
            if(a[i]>=24)cnt25++;if(a[i]>=14) cnt15++;
            if(a[i]>=4)cnt5++;if(a[i]>=2)cnt3++;}
     ans += cnt75;
     ans += (cnt3-1)*(cnt25)+(cnt5-1)*cnt15;
     ans += (cnt5*(cnt5-1)*(cnt3-2))/2;
     cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 7560
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int s = 0;
    int m = 0;
    for (int i = 0; i < n; i++)
    {
        int l;
        cin >> l;
        s += l;
        m = max(m, l);
    }
    s -= m;
    cout << (s > m ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
su=sum(l)//2
aplussum=sum(l[::2])
a=aplussum-su
ret=[0]*n
ret[0]=a
for i in range(1,n):
    ret[i]=l[i-1]-ret[i-1]
print(*[2*x for x in ret])

Measured memory_bytes: 16968
#include <stdio.h>

int main(void){
    
    int x1,x2,x3,x4,y1,y2,y3,y4;
    
    scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
    
    if(x2-x1>0){
        if(y2-y1>0){
            x3=x2-(y2-y1);
            x4=x1-(y2-y1);
        }
        else{
            x3=x2+y1-y2;
            x4=x1+y1-y2;
        }
        y3=y2+x2-x1;
        y4=y1+x2-x1;
    }
    else{
        if(y2-y1>0){
            x3=x2-(y2-y1);
            x4=x1-(y2-y1);
        }
        else{
            x3=x2+y1-y2;
            x4=x1+y1-y2;
        }
        y3=y2-(x1-x2);
        y4=y1-(x1-x2);
    }
    printf("%d %d %d %d",x3,y3,x4,y4);
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 0;
    for (int i = 0; i < n; i++) {
      int a = sc.nextInt();
      ans += Integer.numberOfTrailingZeros(a);
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 36012
#include <bits/stdc++.h>
using namespace std;
int X, A, B;

int main(){
  cin>>X>>A>>B;
  if(A - B >= 0){
    cout<<"delicious"<<endl;
  }else if(X+(A-B) >= 0){
    cout<<"safe"<<endl;
  }else{
    cout<<"dangerous"<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int W,H,x,y;
    cin >> W >> H >> x >> y;
    double S = (double)W * (double)H /2;
    bool some = (W == x+x) && (H == y+y);
    printf("%lf %d\n", S,  some);
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    int n;
    Integer[] pre;
    Integer[] in;
    int preCount;
    List<Integer> postorderList = new ArrayList<>();

    void run() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();

        pre = new Integer[n];
        in = new Integer[n];
        
        for (int i = 0; i < n; i++) {
            pre[i] = sc.nextInt();
        }

        for (int i = 0; i < n; i++) {
            in[i] = sc.nextInt();
        }

        preCount = 0;
        reconstruction(0, n);
        System.out.println(postorderList.stream().map(String::valueOf).collect(Collectors.joining(" ")));
    }



    void reconstruction(int l, int r) {
        if (l >= r) return;
        int c = pre[preCount++];
        int m = Arrays.asList(in).indexOf(c);
//        System.out.println(c + ", " + m);
        reconstruction(l, m);
        reconstruction(m + 1, r);
        postorderList.add(c);
    }


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

}


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

#define ll long long
#define INF 1e9

vector <ll> item;
vector <ll> dis;

ll dp(int w) {
    if (w < 0) return INF;
    if (w == 0) return 0;
    if (dis[w] != INF) return dis[w];
    dis[w] = dp(w-1) + abs(item[w]-item[w-1]);
    if (w >= 2) dis[w] = min(dis[w], dp(w-2) + abs(item[w]-item[w-2]));
    return dis[w];
}

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

    item.assign(n, 0);
    for (int i = 0; i < n; i++) scanf("%lld", &item[i]);

    dis.assign(n, INF);
    printf("%lld\n", dp(n-1));
}


Measured memory_bytes: 6528
import java.util.Scanner;

public class Main {
  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    char[] S = sc.next().toCharArray();
    int W = sc.nextInt();
    for (int i = 0; i < S.length; i+=W) {
      System.out.print(S[i]);
    }
    System.out.println();
  }

}


Measured memory_bytes: 22996
#include <cstdio>
#include <vector>
using namespace std;

int main(){
	int n, m;
	while (1){
		scanf("%d %d", &n, &m);
		if (n == 0 && m == 0){
			break;
		}
		vector<int> masu;
		vector<int> deme;
		for (int i=0; i<n; i++){
			int tmp;
			scanf("%d", &tmp);
			masu.push_back(tmp);
		}
		for (int i=0; i<m; i++){
			int tmp;
			scanf("%d", &tmp);
			deme.push_back(tmp);
		}

		int place = 0;
		int turn = 0;
		while (place < n-1){
			place += deme[turn];
			turn++;
			if (place >= n-1){
				break;
			}
			place += masu[place];
		}
		printf("%d\n", turn);
	}

	return 0;
}

Measured memory_bytes: 1056
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    unordered_map<string,int>mp;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        mp[s]++;
    }
    int count=0;
    for(auto i:mp)
    count++;
    cout<<count<<endl;
}


Measured memory_bytes: 17616
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

using namespace std;
int a=0;
vector<string>sts;
vector<int>ens;
int getnum(){
  if(sts[a]=="*"){
    int num=1;
    int pe=ens[a+1];
    a++;
    while(a!=sts.size()&&ens[a]==pe){
      num*=getnum();
    }
    return num;
  }
    else if(sts[a]=="+"){
      int num=0;
      int pe=ens[a+1];
      a++;
      while(a!=sts.size()&&ens[a]==pe){
	num+=getnum();
      }
      return num;
    }else{
      int num=stoi(sts[a]);
      a++;
      return num;
    }
}
int main()
{
  while(1){
    int n;cin>>n;
    if(!n)break;
    for(int i=0;i<n;++i){
      string st;cin>>st;
      int n=st.find_first_not_of(".");
      sts.push_back(st.substr(n));
      ens.push_back(n);
      // cout<<sts[i]<<" "<<ens[i]<<endl;
    }
    int ans=getnum();
    cout<<ans<<endl;

  }
  return 0;
}

Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef pair<l_l,ll> lll;
typedef vector<string> vs;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
const int mod = 1000000007;
struct mint {
ll x;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
mint dp[3300][3300];
mint dp_sum[3300][3300];
int main(){
    ll n;cin>>n;
    string s;cin>>s;
    dp[0][0]=1;
    for(int i=1;i<=n-1;i++){
        for(int j=0;j<=i-1;j++){
            dp_sum[i-1][j]=dp[i-1][j];
            if(j-1>=0)dp_sum[i-1][j]+=dp_sum[i-1][j-1];
        }
        for(int j=0;j<=i;j++){
            if(s[i-1]=='<'){
                if(j-1>=0)dp[i][j]+=dp_sum[i-1][j-1];
            }
            else{
                dp[i][j]=dp_sum[i-1][i-1];
                if(j-1>=0)dp[i][j]-=dp_sum[i-1][j-1];
            }
        }
    }
    mint ans=0;
    rep(i,n)ans+=dp[n-1][i];
    cout<<ans.x<<endl;
    return 0;
}

Measured memory_bytes: 173772
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pii(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];
#define sq(n) (n)*(n)
#define ios ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
int main()
{   ios;
     ll ans=0;
    ll n;cin>>n;
    n--;
    cout<<(n*(n+1))/2;
}

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

using namespace std;

int main(){

    int n;
    cin >> n;

    string ta, ha;
    int left=0, right = 0;

    for(int i=0; i<n; i++){
        cin >> ta >> ha;
        if(ta > ha){
            left += 3;
        }else if(ta < ha){
            right += 3;
        }else{
            left+=1;
            right+=1;
        }
    }

    cout << left << " " << right << endl;

    return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique((c).begin(), (c).end()), (c).end());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


void solve(LL N, LL K){
	LL A = N / K;
	A = A * A * A;
	LL B = 0;
	if (K % 2 == 0 && N >= K / 2) {
		B = (N - K / 2) / K;
		B++;
		B = B * B * B;
	}
	cout << A + B << endl;
}

int main(){	
	LL N;
	LL K;
	scanf("%lld",&N);
	scanf("%lld",&K);
	solve(N, K);
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=998244353;
const int MAXN=3010, LOG=20;

ll a, b, c, d, ans;
ll dp[MAXN][MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>a>>b>>c>>d;
	dp[a][b]=1;
	for (int x=a; x<=c; x++) for (int y=b; y<=d; y++){
		dp[x][y]+=dp[x-1][y]+dp[x][y-1];
		dp[x][y]+=(x-1)*dp[x][y-1];
		dp[x][y]+=(y-1)*dp[x-1][y];
		dp[x][y]-=(x-1)*(y-1)*dp[x-1][y-1];
		dp[x][y]%=mod;
	}
	ans=dp[c][d];
	if (ans<0) ans+=mod;
	cout<<ans<<'\n';
	
	return 0;
}


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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)



typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////



ll SOLVE(){
    ll h1,m1,h2,m2,k;cin>>h1>>m1>>h2>>m2>>k;
    m1+=h1*60;
    m2+=h2*60;
    ll dism=m2-m1;
    if(dism<k)cout<<0<<endl;
    else cout<<dism-k<<endl;
    
    
    return 0;
}

int main(){fastio
    
    clock_t start = clock();
    SOLVE();
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    cerr<<endl<<time<<"ms"<<endl;
    
    return 0;
}



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

int main()
{
	int k;
	string s;
	cin >> k;
	cin >> s;

	if (s.size() <= k) {
		cout << s << endl;
	}
	else {
		cout << s.substr(0, k) << "..." << endl;
	}


	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll; ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);
ll fac(ll x){if(x==0) return 1;  return x*fac(x-1);}

int main(){
    string s; cin>>s;
    if(s=="SUN") cout<<7<<endl;
    else if(s=="MON") cout<<6<<endl;
    else if(s=="TUE") cout<<5<<endl;
    else if(s=="WED") cout<<4<<endl;
    else if(s=="THU") cout<<3<<endl;
    else if(s=="FRI") cout<<2<<endl;
    else cout<<1<<endl;
}

Measured memory_bytes: 256
ip=[int(x) for x in input().split()]
a=ip[0]
b=ip[1]
c=ip[2]
k=ip[3]

ans=min(k,a)
k-=min(a,k)
if k>0:
	k-=min(k,b)
if k>0:
	ans-=min(k,c)

print(ans)

Measured memory_bytes: 9196
import sys

K = int(input())
base = 0
seen = set()

for i in range(10**6):
    base += 7 * pow(10, i, K)
    base %= K
    if base == 0:
        print(i+1)
        sys.exit()
    elif base in seen:
        print(-1)
        sys.exit()
    seen.add(base)

Measured memory_bytes: 157044
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

double q;

double iter(double x) {
    return x - (x*x*x-q)/(3*x*x);
}

int main() {
    while(cin >> q, q+1) {
        double x = q/2;
        while (abs(x*x*x - q) >= 0.00001*q) {
            x = iter(x);
        }
        printf("%.6f\n", x);
    }
    return 0;
}

Measured memory_bytes: 1236
import itertools

n = int(input())
a = [0] * 26
for _ in range(n):
   a[ord(input()[0]) - ord('A')] += 1
c = []
for x in 'MARCH':
    c.append(a[ord(x) - ord('A')])
s = 0
for x in itertools.combinations(c, 3):
    k = 1
    for i in x: k *= i
    s += k
print(s)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main() {
    int K,N; cin >> K >> N;
    vector<int> A(N);
    for (int i=0;i<N;i++) cin >> A[i];
    int max_x = 0;
    for (int i=0;i<N-1;i++){
        int x;
        if (i==0) x = A[0] + (K-A[N-1]);
        else x = A[i+1] - A[i];
        max_x = max(x,max_x);
    }
    cout << K - max_x << endl;
    return 0;
}

Measured memory_bytes: 1024
n=int(input())
s=[int(input()) for _ in range(n)]
x=sum(s)
if x%10:
  print(x)
else:
  a=[]
  for i in s:
    if i%10:
      a.append(i)
  if a:
    print(x-min(a))
  else:
    print(0)


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
int n, a[6] = {2,4,3,9,8,10};
int main(){
	scanf("%d", &n);
	if(n == 3) printf("2 5 63\n");
	else{
		int k = n/8, t = 0;
		rep(i,k){
			printf("%d %d %d %d %d %d %d %d", t+2,t+3,t+4,t+6,t+8,t+9,t+10,t+12);
			printf("%s", (i+1)*8 == n ? "\n" : " ");
			t += 12;
		}
		rep(i,n%8/2*2) printf("%d%s", t+a[i], n%8-1==i ? "\n" : " ");
		if(n%2) printf("%d\n", t+6);
	}
}

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

vector<vector<char>> getRuns(string s) {
  vector<vector<char>> runs;  // aabbcccd -> aa/bb/ccc/d

  vector<char> tmp;
  for (int i = 0; i < s.size(); i++) {
    if (tmp.size() < 1 || tmp.back() == s[i]) {
      tmp.push_back(s[i]);
    } else {
      runs.push_back(tmp);

      tmp.clear();
      tmp.push_back(s[i]);
    }

    if (i == s.size() - 1) {
      runs.push_back(tmp);
    }
  }

  return runs;
}

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

  string s;
  ll k;
  cin >> s >> k;

  auto runs1 = getRuns(s);
  auto runs2 = getRuns(s + s);

  ll ans1 = 0;
  for (auto run : runs1) {
    ans1 += run.size() / 2;
  }

  ll ans2 = 0;  // 二倍にしたやつ
  for (auto run : runs2) {
    ans2 += run.size() / 2;
  }

  int n = (int)s.size();
  if (s == string(n, s[0])) {
    cout << n * k / 2 << endl;
  } else {
    ll ans = ans1 + (ans2 - ans1) * (k - 1);

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

/*
s + (ss - s) * (k - 1)

aaba 1
aabaaaba 2
aabaaabaaaba 3

aba 0
abaaba 1
abaabaaba 2

abaa 1
abaaabaa 2
abaaabaaabaa 3

abb 1
abbabb 2
abbabbabb 3

*/

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define INF 1000000007
using namespace std;
typedef long long ll;
///----------------------------------------------
const int Prime_N = 7 + 1000;
bool isPrime[Prime_N];
int  prime[Prime_N],pn;
void getPrime() {
    //--0 init
    memset(isPrime,true,sizeof(isPrime));
    pn=0;
    //--1 work
    for (int i=2; i<Prime_N; i++) {
        if (isPrime[i]) { prime[++pn]=i; }
        for (int j=1; j<=pn&&prime[j]*i<Prime_N; j++) {
            isPrime[prime[j]*i]=false;
            if (i%prime[j]==0) break;
        }
    }
}
///----------------------------------------------
int num[Prime_N];
int main() {

    //freopen ( "xx.in"  , "r" , stdin  );

    //--0 init
    getPrime();

    //--1 read
    int n; scanf("%d",&n);

    //--2 work
    memset(num,0,sizeof(num));
    for (int i=1; i<=n; i++) {
        for (int j=1,tmp=i; j<=pn&&tmp>1; j++)
            for (; tmp%prime[j]==0; tmp/=prime[j]) num[j]++;
    }

    //--3 count
    int ans=1;
    for (int i=1; i<=n; i++) {
        ans=((ll)ans*(num[i]+1))%INF;
    }
    printf("%d",ans);

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define PI  3.14159265358979323846
#define lp(i,n) for(int i = 0; i <n;i++)
#define rlp(i,n) for(int i = int(n);i >= 0;i--)
#define range1(i,a,b,c) for(int i = int(a);i <= int(b);i+=int(c))
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define fr first
#define sc second
#define sz(v) ((int)((v).size()))
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef pair<int, int> pii;
template<class T> using ordered_set=tree<T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;
const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)3e5+2;
int dx[] = {0,0,-1,1};
int dy[] = {1,-1,0,0};
void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
map<int,int>row,col;
void _run(){
    int h,w,m;
    cin>>h>>w>>m;
    set<pair<int,int>>s;
    lp(i,m){
        int x,y;
        cin>>x>>y;
        row[x]++;
        col[y]++;
        s.insert({x,y});
    }
    int mxr=-1,mxc=-1,r,c;
    int res =0;    
    for(auto x:row){
        if(x.sc>mxr){
            mxr=x.sc;
            r = x.fr;
        }
    }
    vii v;
    int ans = 0;
    for(int i=1;i<=w;i++){
        if(col.count(i)){
            int temp = mxr+col[i];
            // cout<<temp<<endl;
            if(s.count({r,i})){
                temp -=1;
            }
            ans = max(temp,ans);
        }
    }
     for(auto x:col){
        if(x.sc>mxc){
            mxc=x.sc;
            c = x.fr;
        }
    }
    for(int i=1;i<=h;i++){
        if(row.count(i)){
            int temp = mxc+row[i];
            // cout<<temp<<endl;
            if(s.count({i,c})){
                temp -=1;
            }
            ans = max(temp,ans);
        }
    }
   
    cout<<ans<<endl;
}
int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    int t=1;
    // scanf("%d",&t);
    while(t--)_run();
    
    return 0;
}

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

// clang-format off
#define forn(i, x, y) for(int i = x; i < y; i++)
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL)
// clang-format on

using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;

const long long MOD = 1000000007;

void add(LL &a, LL b)
{
  a += b;
  if (a >= MOD)
    a -= MOD;
}

int main()
{
  IOS;

  int N;
  cin >> N;
  VI A(N);
  int k;
  forn(i, 0, N) forn(j, 0, N)
  {
    cin >> k;
    A[i] |= k << j;
  }

  int mask = 1 << N;
  VVLL dp(N + 1, VLL(mask));
  dp[0][mask - 1] = 1;

  for (int i = 0; i < N; i++)
  {
    for (int k = 0; k < mask; k++)
    {
      if (__builtin_popcount(k) != N - i)
        continue;
      for (int j = 0; j < N; j++)
      {
        if (A[i] & k & (1 << j))
          add(dp[i + 1][k - (1 << j)], dp[i][k]);
      }
    }
  }
  cout << dp[N][0] << endl;

  return 0;
}


Measured memory_bytes: 380192
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<ll, ll>
#define SZ(x) ((int)(x).size())
// #define endl "\n"
#define vvi vector<vector<int> >
#define vvl vector<vector<long long> >
ll mod = 1e9 + 7;
//const double pi = acos(-1.0);
/*
ll kmp(string x)
{
    ll n= x.length();
    //cout<<x<<endl;
    vector<ll> lcp(x.length(), 0);
    for(ll i=1;i<n;i++)
    {
        ll j=lcp[i-1];
        while(j>0 && x[j]!=x[i])
            j=lcp[j-1];
        if(x[i]==x[j])
            j++;
        lcp[i]=j;
    }
    return lcp[n-1];
}

int N = 1000002;
int ar[100002];
void sieve()
{
    for(int i=1;i<=N;i++)
        ar[i] = 1;
    ar[0] = 0;
    for(int i=2;i*i<=N;i++)
    {
        if(ar[i] && i*i<=N)
        {
            for(int j = i*i; j<=N;j+=i)
                ar[j] = 0;
        }
    }
}

ll modex(ll a,ll b){
    if(b<=0){
        return 1;
    }
    if(b%2==0)
    {
        ll x = modex(a, b/2);
        return ((x*x)%mod);
    }
    else
        return ((a%mod * modex(a, b-1))%mod);
}

ll c[1010][1010];

ll combina(ll i, ll j){
        for (int i=0;i<=1005;i++)
        for (int j=0;j<=i;j++)
        {
            if (j==i||j==0)
                c[i][j]=1;
            else
            c[i][j]=c[i-1][j-1]+c[i-1][j];
            c[i][j]%=mod;
        }
        return c[i][j];
}
void find_fac(int x){
    vector<ll> di;
    for(ll i = 2; i*i <= x; i++)
    {
        if(x%i==0){
            di.push_back(i);
            while(x%i==0)
                x/=i;
        }
    }
    if(x > 1)
        di.push_back(x);
}
*/

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout<<fixed;
    cout.precision(12);
    ll n, d;
    cin>>n>>d;
    d*=d;
    ll an = 0;
    for(int i=0;i<n;i++){
        ll x, y;
        cin>>x>>y;
        ll s = x*x + y*y;
        if(s<=d)
            an++;
    }
    cout<<an<<endl;
    return 0;
}


Measured memory_bytes: 3648