akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main{
  public static void main(String [] args){
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int [] Array = new int[n];
    
    for(int i = 0; i < Array.length; i++) {
    	Array[i] = stdIn.nextInt();
    }
    
    int sum = 0;
    int a = 0;
    Outer:
    do{
      a++;
    	for(int i = 0; i < Array.length; i++){
      		if(Array[i]%2!=0) break Outer;
      		else Array[i]/=2;
      		if(i==n-1){ 
              sum++;
              a --;
            }
    	}
    }while(a==0);
    
    System.out.println(sum);
  }
}

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

using namespace std;

typedef long long ll;

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const double EPS = 1e-9;
const ll INF = 1e17;

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

	int n;
	cin >> n;

	vector<pair<int, int> > a(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i].first;
		a[i].second = i;
	}

	vector<ll> ans(n);

	sort(rall(a));
	a.push_back({0, n});
	int mn = a[0].second;

	for (int i = 1; i < n + 1; i++) {
		ans[mn] += (ll)(a[i - 1].first - a[i].first) * i;
		mn = min(mn, a[i].second);
	}

	for (auto t : ans) {
		cout << t << "\n";
	}

	return 0;
}


Measured memory_bytes: 2672
#include <bits/stdc++.h>
using namespace std;
string s, s1;
int k;
int ans[3];
int main()
{
    while (cin >> s >> k)
    {
        s1 = s + s + s;
        for (int i = 1; i < s1.size(); i++)
        {
            if (s1[i] == s1[i - 1])
            {
                s1[i] = '.';
                ans[(i / s.size())]++;
            }
        }
        k--;
        long long res = ans[0];
        res += 1ll * (k + 1) / 2 * ans[1];
        res += 1ll * k / 2 * ans[2];
        cout << res << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    string S;
    cin >> S;
    int N = S.size();
    int max_count = 0;
    for (int left=0; left < N; left++) {
        int count = 0;
        if (S[left] != 'A' && S[left] != 'C' && S[left] != 'G' && S[left] != 'T') {
            continue;
        }

        for (int right=left; right < N; right++) {
            if (S[right] != 'A' && S[right] != 'C' && S[right] != 'G' && S[right] != 'T') {
                break;
            }

            count += 1;
        }

        if (count > max_count) {
            max_count = count;
        }

    }

    cout << max_count << endl;
    return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);

/* -----  2019/04/27  Problem: ABC 125 C / Link: http://abc125.contest.atcoder.jp/tasks/abc125_c  ----- */

template< typename MeetSemilattice>
struct SparseTable {
	using T = typename MeetSemilattice::t;
	vector<vector<T>> st;

	SparseTable() {}

	SparseTable(const vector<T> &v) {
		int b = 0;
		while ((1 << b) <= v.size()) ++b;
		st.assign(b, vector<T>(1 << b));
		for (int i = 0; i < v.size(); i++) {
			st[0][i] = v[i];
		}
		for (int i = 1; i < b; i++) {
			for (int j = 0; j + (1 << i) <= (1 << b); j++) {
				st[i][j] = MeetSemilattice::op(st[i - 1][j], st[i - 1][j + (1 << (i - 1))]);
			}
		}
	}
	// [l, r)
	inline T query(int l, int r) {
		int b = 32 - __builtin_clz(r - l) - 1;
		return (MeetSemilattice::op(st[b][l], st[b][r - (1 << b)]));
	}
};

struct M {
	using t = LL;
	static t op(const t&l, const t&r) { return __gcd(l, r); }
};


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

	LL N; cin >> N;
	vector<LL> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	SparseTable<M> seg(a);
	LL ans = 0LL;
	FOR(i, 0, N) {
		if (i == 0) {
			ans = max(ans, seg.query(1, N));
		}
		else if (i == N - 1) {
			ans = max(ans, seg.query(0, N-1));
		}
		else {
			LL L = seg.query(0, i);
			LL R = seg.query(i + 1, N);
			ans = max(ans, __gcd(L, R));
		}
	}
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 19584
def solve(xys):
    count = 0
    right = 0
    xys.sort(key=lambda x: x[0])
    for a, b in xys:
        if right <= a:
            count += 1
            right = b
        elif b < right:
            right = b
    return count

if __name__ == "__main__":
    n, m = map(int, input().split())
    xys = [[int(s) for s in input().split()] for _ in range(m)]
    print(solve(xys))


Measured memory_bytes: 22892
#include<bits/stdc++.h>
#define ll long long
using namespace std;
char fff;
vector<char>st,ed;

int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    char tr;
    int q;
    cin>>q;
    int t,temp;
    int sum=1;
    for(int i=0; i<q; i++)
    {
        cin>>t;
        if(t==1)
        {
            sum++;
        }
        if(t==2)
        {
            cin>>temp>>tr;
            if((sum%2==1&&temp==1)||sum%2==0&&temp==2)
            {
                st.push_back(tr);
            }
            else
                ed.push_back(tr);
        }
    }


    if(sum%2==1)
    {
         for(int i=st.size()-1;i>=0;i--) cout<<st[i];
        cout<<s;
        for(char c:ed) cout<<c;
    }
    else
    {
        for(int i=ed.size()-1;i>=0;i--) cout<<ed[i];
        for(int i=s.size()-1;i>=0;i--)cout<<s[i];
        for(char c:st) cout<<c;
    }



}


Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
#define Uniq(v) v.erase(unique(All(v)),v.end())
typedef pair<int, int> Pii;
typedef pair<int, Pii> Pip;
typedef pair<string, int> Psi;
const int INF = (1<<30);
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

int n;

string intToString(int number)
{
  stringstream ss;
  ss << number;
  return ss.str();
}

void func( int bef, int cnt, string s )
{
  if( cnt == n ) cout << s << endl;
  else {
    for(int i=bef; i>=1; i--) {
      string add = intToString( i );
      string next;
      if( s == "" ) next = add;
      else next = s + " " + add;
      if( cnt + i <= n ) func( i, cnt + i, next );
    }
  }
}

int main()
{
  while( cin >> n, n ) {
    func( n, 0, "" );
  }
}

Measured memory_bytes: 3052
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,W,*wv = map(int,read().split())

res = [[] for _ in range(n)]
w0 = wv[0]
mp = iter(wv)
for w,v in zip(mp,mp):
    res[w-w0].append(v)

from itertools import accumulate
d = [None for _ in range(4)]
for i in range(4):
    r = res[i]
    r.sort(reverse=True)
    d[i] = {(w0+i)*(j+1):wj for j,wj in enumerate(accumulate(r))}
    d[i][0] = 0
    #print(r,w0+i)
    #print(d[i])

def merge(d1,d2):
    res = {}
    for w1,v1 in d1.items():
        for w2,v2 in d2.items():
            w = w1+w2
            v = v1+v2
            if w in res: res[w] = max(res[w],v)
            else: res[w] = v
    return res    

#print(d)

d1 = merge(d[0],d[1])
d2 = merge(d[2],d[3])
dd = merge(d1,d2)

#print(d)
#print(d1)
#print(d2)
#print(dd)

ans = 0
for w,v in dd.items():
    if w <= W and ans < v:
        ans = v
print(ans)


    













Measured memory_bytes: 74160
#include <stdio.h>
#include <cmath>
#include <iostream>

using namespace std;
#define MAX 500000;
#define SENTINEL 2000000000;
//int count=0;

void merge(int A[], int left, int mid, int right){
    int n1=mid-left;
    int n2=right-mid;
    int L[500000/2+2],R[500000/2+2];
    for(int i=0;i<n1;i++) L[i]=A[left+i];
    for(int i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1]=SENTINEL;
    R[n2]=SENTINEL;
    int i=0,j=0;
    for(int k=left;k<right;k++){
//        count++;
        if(L[i]<=R[j]){
            A[k]=L[i++];
        }else{
            A[k]=R[j++];
        }
    }

};

void mergeSort(int A[], int left, int right){
    if (left+1<right){
        int mid=(left+right)/2;
        mergeSort(A,left,mid);
        mergeSort(A,mid,right);
        merge(A,left,mid,right);
    }
}

int partition(int A[], int p, int r){
    int x=A[r];
    int i=p-1;
    for(int j=p; j<r; j++){
        if (A[j]<=x){
            i++;
            swap(A[i],A[j]);
        }
    }
    swap(A[i+1],A[r]);
    return i+1;
}

void quicksort(int A[], int p, int r){
    if(p<r){
        int q = partition(A,p,r);
        quicksort(A,p,q-1);
        quicksort(A,q+1,r);
    }
}

int C[2000001];
int k=10000;
void countingSort(int A[], int B[], int n){
    for(int i=0;i<k;i++)C[i]=0;
    for(int j=1;j<=n;j++)C[A[j]]++;
    for(int i=1;i<k;i++)C[i]=C[i]+C[i-1];
    for(int j=n;j>0;j--){
        B[C[A[j]]]=A[j];
        C[A[j]]--;
    }

}
int main()
{
    int n,i;
    scanf("%d",&n);
    int A[n+1];
    int B[n+1];
    for(int i=0;i<n;i++)scanf("%d",&A[i+1]);
    countingSort(A,B,n);
    for(i=1;i<=n;i++){
        if(i>1) cout<<" ";
        cout<<B[i];

    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 18860
N = int(input())

l = [0 for _ in range(N)]
for x in range(1, 10**2):
    for y in range(1, 10**2):
        for z in range(1, 10**2):
            m = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if m <= N:
                l[m - 1] += 1
            else:
                break

for i in range(N):
    print(l[i])

Measured memory_bytes: 9296
#include<stdio.h>
int main(){
  int i,n,a[10000],count=0,max,min;
  long int sum=0;

  scanf("%d",&n);
  scanf("%d",&a[0]);
  max = a[0];
  min = a[0];
  sum += a[0];
  for(i=1;i<n;i++){
    scanf("%d",&a[i]);
    sum+=a[i];
    if(max < a[i]) max = a[i];
    if(min > a[i]) min = a[i];
  }
  printf("%d %d %ld\n",min,max,sum);
  return 0;
}



Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
//constexpr int MOD = 10e9+7;
//constexpr int INF = 1LL << 60;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

signed main()
{
  ios();
  string a,b;
  cin >> a >> b;
  int N = atoi((a+b).c_str());
  rep(i,N)
  {
    if(i*i == N)
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" <<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007


int main(){
	char s[11], t[11], u[11];
	int a, b;
	scanf("%s%s", s, t);
	scanf("%d%d", &a, &b);
	scanf("%s", u);
	if(s[0] == u[0]) printf("%d %d\n", a-1, b);
	else printf("%d %d\n", a, b-1);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;

int main() {

	int N;
	cin >> N;
	vector<int> B(N - 1);
	rep(i, N - 1) cin >> B.at(i);
	int ans = B.at(0) + B.at(N - 2);
	for(int i = 1; i < N - 1; i++) {
		
		if (B.at(i - 1) >= B.at(i)) {
			ans += B.at(i);
		}
		else {
			ans += B.at(i - 1);
		}
	}

	cout << ans << endl;

	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main(){
    cin>>S;
    N = S.size();
    ll ans = 0;
    rep(i,N/2){
        ans += S[i] != S[N - 1 - i];
    }
    cout<<ans<<endl;
}

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


#define fast_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define pb push_back
#define F first
#define S second
#define int long long int
#define ll long long
#define ld long double

bool isPrime(ll n){if(n<2)return false;for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}

ll lcm(ll x,ll y){
    return (x*y)/(__gcd(x,y));
}

ll nod(ll n){
    while(n%10==0){
        n/=10;
    }
    return n;
}


signed main(){
    fast_IO;
    int t=1;
    //cin>>t;
    while(t--){
        string s;
        cin>>s;
        int cnt=0;
        int ans=0;
        for(int i=0;i<3;i++){
            if(s[i]=='R')
                cnt++;
            else{
            	ans=max(cnt,ans);
                cnt=0;
            }
        }
        ans=max(cnt,ans);
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 3656
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[2 * n];
		for (int i = 0; i < 2 * n; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		//System.out.println(Arrays.toString(a));
		int count = 0;
		for (int i = 0; i < 2 * n; i+=2) {
			if(a[i] < a[i+1]){
				count += a[i];
				//System.out.println(count);
			}else{
				count += a[i+1];
				//System.out.println("b" +count);
			}
		}
		System.out.println(count);
	}
}


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

const int MN = 105;
vector<int> ans, vec;
int n, i, x;

int main(){
    for(scanf("%d",&n),i=1;i<=n;i++)
        scanf("%d",&x), vec.push_back(x);
    while(vec.size()){
        bool fnd = 0;
        for(int i=vec.size()-1;i>=0;i--){
            if(vec[i]==i+1){
                vec.erase(vec.begin()+i);
                ans.insert(ans.begin(), i+1);
                fnd = 1;
                break;
            }
        }
        if(!fnd) break;
    }
    if(vec.size()) printf("-1\n");
    else{
        for(auto v : ans) printf("%d\n",v);
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    // char ;
    ll n,ans=1;
    scanf("%lld",&n);
    ll a[n];
    rep(i,0,n){
        scanf("%lld",&a[i]);
    }
    ll cnt[n];
    rep(i,0,n){
        cnt[i]=0;
    }
    rep(i,0,n){
        if(a[i]>i){
            printf("0\n");
            return 0;
        }
        if(a[i]==0){
            if(cnt[0]+1>3){
                printf("0\n");
                return 0;
            }
            if(cnt[0]==0){
                ans*=3;
            }
            if(cnt[0]==1){
                ans*=2;
            }
        }else{
            if( cnt[a[i]]+1>3 || cnt[a[i]]+1>cnt[a[i]-1] ){
                printf("0\n");
                return 0;
            }
            if(cnt[a[i]]==0){
                ans*=cnt[a[i]-1];
            }
            if(cnt[a[i]]==1){
                ans*=cnt[a[i]-1]-1;
            }
        }
        // printf("%lld ",ans);
        ans%=MOD1;
        cnt[a[i]]++;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1664
import java.util.*;

public class Main {

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

		String N = in.nextLine();
		int count = 0;
		for (int i = 0; i < N.length(); ++i) {
			if (N.charAt(i) == '2') {
				++count;
			}
		}
		System.out.println(count);

	}

}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007
ll mod = 998244353;
ll inv(ll a,ll b) {

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


int main()
{

	int N;
	cin >> N;
	map<int, ll> K;
	vec(D);
	int maxi = 0;
	fx(N) {
		vecp(D);
		K[D[x]]++;
		maxi = max(maxi, D[x]);
	}

	if (D[0]!=0||K[0]!=1) {
		ce(0)
	}else{

		ll ans = 1;
		fyg(maxi+1,1) {
			ans *=inv(K[y-1],K[y]);
			ans %= mod;

		}
		ce(ans)
	}

    return 0;
}



Measured memory_bytes: 6904
#include<bits/stdc++.h>
#define Rushia_mywife ios::sync_with_stdio(0);cin.tie(0);
#define rep(i,head,n) for(int i=(head);i<n;i++)
#define int long long
#define F first
#define S second
#define pb push_back
#define p2(n) (1<<(n))
#define lg2(n) __lg(n)
using namespace std;
using pii = pair<long long,long long>;
using ld = long double;
mt19937 mt_rand(time(0));
const int mod = 1000000007;
const int hnum = 998244353;
const ld PI = acos(-1);

int a,b,c;
int k;

void solve(){
    cin >> a >> b >> c;
    cin >> k;
    while(k&&b<=a){
        b *= 2;
        k--;
    }
    while(k&&c<=b){
        c *= 2;
        k--;
    }
    cout << (a<b&&b<c ? "Yes\n" : "No\n");
}

signed main(){
    Rushia_mywife
    solve();
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double A[] = new double[N];
		for(int i = 0 ; i < N ; ++i){
			A[i] = sc.nextDouble();
		}
		double S = 0.0;
		for(double d : A){
			S += 1.0 / d;
		}
		System.out.println(1.0 / S);
	}
}


Measured memory_bytes: 23636
using System;
using System.Linq;

namespace AtCoder {
    class Program {
        static int[][] abcd;
        static int n, m, q;

        static void Main() {
            int[] nmq = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            n = nmq[0];
            m = nmq[1];
            q = nmq[2];
            abcd = new int[q][];
            for(int i = 0; i < q; i++) {
                abcd[i] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            }

            Console.WriteLine(Solve(new int[0]));
        }
        static long Solve(int[] array) {
            if(array.Length == n) {
                return Score(array);
            }
            long max = 0;
            int last = array.Length == 0 ? 0 : array[ ^ 1];
            for(int i = last; i < m; i++) {
                long score = Solve(array.Append(i).ToArray());
                max = Math.Max(max, score);
            }
            return max;
        }
        static long Score(int[] array) {
            long score = 0;
            for(int i = 0; i < q; i++) {
                int a = abcd[i][0] - 1, b = abcd[i][1] - 1, c = abcd[i][2], d = abcd[i][3];
                if(array[b] - array[a] == c) score += d;
            }
            return score;
        }
    }
}

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

using namespace std;

const int mod = 1e9 + 7;
const long long INF = 1e18;
long long dp[404][404];

void add_self(int &a,int b)
{
    a+=b;
    if (a>=mod)
        a-=mod;
}

void sub_self(int &a,int b)
{
    a-=b;
    if (a<0)
        a+=mod;
}

int main()
{
    //freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    vector <int> a(n);
    for (int i=0;i<n;i++)
    cin >> a[i];

    auto sum = [&](int L,int R)
    {
        long long sum=0;
        for (int i=L;i<=R;i++)
            sum+=a[i];
        return sum;
    };

    for (int L=n-1;L>=0;L--)
        for (int R=L;R<n;R++)
        if (L==R)
        dp[L][R]=0;
    else
    {
        dp[L][R]=INF;
        long long s=sum(L,R);
        for (int i=L;i<R;i++)
        dp[L][R]=min(dp[L][R],dp[L][i]+dp[i+1][R]+s);
    }

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


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define hackcyborg shresth_walia
#define ll long long
#define ld double
#define pb push_back
#define mod 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
ll binpow(ll a,ll b,ll m=mod)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)
        res=(a*res)%m;
        a=(a*a)%m;
        b/=2;
    }
    return res;
}
ll h,w;
ll co[1001][1001];
ll g=0;
string s[1001];
vector<vector<ll>> ar;
void dfs(ll x,ll y)
{
    if(s[x][y]=='#')return;
    co[x][y]=g;
    if(x-1>=0 && co[x-1][y]==0)
        dfs(x-1,y);
    if(x+1<h && co[x+1][y]==0)
        dfs(x+1,y);
    if(y-1>=0 && co[x][y-1]==0)
        dfs(x,y-1);
    if(y+1<w && co[x][y+1]==0)
        dfs(x,y+1);
}
main()
{
    IO
    cin>>h>>w;
    ll ch,cw;
    ll dh,dw;
    cin>>ch>>cw>>dh>>dw;
    --ch;
    --cw;
    --dh;
    --dw;
    memset(co,0,sizeof(co));
    for(int x=0;x<h;x++)
        cin>>s[x];

    for(int x=0;x<h;x++)
    {
        for(int y=0;y<w;y++)
        {
            if(co[x][y]==0 && s[x][y]=='.')
            {++g;
            dfs(x,y);}
        }
    }
    ar.resize(g+1);
    for(int x=0;x<h;x++)
        for(int y=0;y<w;y++)
        {
            for(int i=x-2;i<=x+2;i++)
                for(int j=y-2;j<=y+2;j++)
            {
                if(i>=0 && i<h && j>=0 && j<w && co[i][j]!=co[x][y] && s[x][y]!='#' && s[i][j]!='#')
                     {ar[co[i][j]].pb(co[x][y]);
                     //vcout<<i<<" "<<j<<" "<<x<<" "<<y<<"\n";
                     ar[co[x][y]].pb(co[i][j]);}
            }
        }
      ll dp[g+1];
      for(int x=0;x<=g;x++)
        dp[x]=1e10;
      queue<ll> aw;
      aw.push(co[ch][cw]);
      dp[co[ch][cw]]=0;
      while(!aw.empty())
      {
          ll w=aw.front();
          aw.pop();
          for(auto it : ar[w])
          {
              if(dp[it]==1e10)
              {
                  dp[it]=dp[w]+1;
                  aw.push(it);
              }
          }
      }
      if(dp[co[dh][dw]]>1e9)cout<<-1;
      else cout<<dp[co[dh][dw]];
}


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

long long product[20][2];

void fact(long long P){
  if(P==1){
    product[0][0]=1;
    product[0][1]=1;
  }else{
    int now=0;
    long long div=2;
    while(div*div<=P){
      while(P%div==0){
        product[now][1]++;
        P/=div;
      }
      if(product[now][1]>0){
        product[now][0]=div;
        now++;
      }
      if(div==2) div++;
      else div+=2;
    }
  }
}

int main(){
  for(int i=0; i<20; i++){
    product[i][0]=0;
    product[i][1]=0;
  }
  long long N,P; cin >> N >> P;
  if(N==1||P==1){
    cout << P << endl;
    return 0;
  }
  fact(P);
  long long res=1;
  for(int i=0; i<20; i++){
    if(product[i][0]>0&&product[i][1]>=N){
      for(int j=0; j<product[i][1]/N; j++){
        res*=product[i][0];
      }
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX_DATA 100

int hindo[MAX_DATA];

int main()
{
        int i;
        for(i = 0; i < MAX_DATA; i++) {
                hindo[i] = 0;
        }
        int max, num;
        max = 0;
        while(scanf("%d", &num) != EOF) {
                hindo[num]++;
                if(max < hindo[num])
                        max = hindo[num];
        }
        for(i = 0; i < MAX_DATA; i++) {
                if(hindo[i] == max)
                        printf("%d\n", i);
        }
        return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define re(i , n) for(Long i = 0; i < (Long)n ; i++)
#define rer(i, a, b) for (Long i = a, to = b; i < to; i++)
 
using namespace std;
typedef long long Long;
const Long MX=3700;
const Long MOD=1000000007;
const Long MX2=9223372036854775806;
 


int main(){
	Long a,b,n;cin>>a>>b>>n;
	if(b==1){
		cout<<"0";
		return 0;
	}	
	if(n==1){
		
	}
	if(b>(n+1)){
		cout<<(a*(n))/b;

	}else{
		cout<<(a*(b-1))/b;
	}
	
	
}

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

int main(void){
    int h,w;
    cin >> h >> w;
    vector<vector<char>> t(h, vector<char>(w));
    int i,j;
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            cin >> t[i][j];
        }
    }
    vector<bool> row(h);
    vector<bool> col(w);
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            if(t[i][j] == '#'){
                row[i] = true;
                col[j] = true;
            }
        }
    }
    for(i=0;i<h;i++){
        if(row[i]){
            for(j=0;j<w;j++){
                if(col[j]){
                    cout << t[i][j];
                }
            }
            cout << endl;
        }
    }
    return 0;
}

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

int main(int argc, char *argv[]) {
	int N = 0;
	int T = 0;
	int A = 0;
	std::vector<int> heights;

	std::cin >> N;
	std::cin >> T;
	std::cin >> A;
	double current_h;
	for (int i = 0; i < N; i++) {
		std::cin >> current_h;
		heights.push_back(current_h);
	}

	double min_temp_sub = DBL_MAX;
	double temp_sub = 0;
	double ave_temp = 0;
	int answer = 0;
	for(int j = 0; j < N; j++) {
		//
		//  0.006 は2進数では正確に表現できない。
		//  誤差をなくすため、1000倍して演算する
		//
		//  また、浮動小数点として演算してほしいので、オペランドの
		//  ひとつは必ずdoubleに変換する
		//  整数同士で演算してしまうと、結果の値は切り捨てられる
		//
		//  http://www.jpcert.or.jp/sc-rules/c-flp06-c.html
		//
		ave_temp = T - ((static_cast<double>(heights[j]) * 6) / 1000);
		temp_sub = std::abs(A - ave_temp);
		if (temp_sub <= min_temp_sub) {
			min_temp_sub = temp_sub;
			answer = j + 1;
		}
	}

	std::cout << answer << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[5];
	cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
	int k;cin>>k;
	sort(a,a+5);
	if(a[4]-a[0]>k)
	{
		cout<<":(\n";
	 } 
	else
	{
		cout<<"Yay!\n";
	}
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    const vector<int> dx{0,1,0,-1},
                      dy{1,0,-1,0};
    const char B = '#';
    int H, W;
    cin >> H >> W;
    vector<string> ss(H);
    REP(i,H) cin >> ss[i];

    int ans = 0;
    vector<pii> bfs;
    REP(i,H) REP(j,W) {
        if (ss[i][j] == B) bfs.emplace_back(i,j);
    }

    while(!bfs.empty()) {
        vector<pii> tmp;
        swap(tmp,bfs);

        for(auto p:tmp) {
            REP(i,dx.size()) {
                int ny = p.first + dy[i];
                int nx = p.second+ dx[i];
                if (ny < 0 || H <= ny) continue;
                if (nx < 0 || W <= nx) continue;
                if (ss[ny][nx] == B) continue;
                bfs.emplace_back(ny,nx);
                ss[ny][nx] = B;
            }
        }
        if (!bfs.empty()) ans++;
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 14700
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};



int A, B, C, D, E, F;

int main () {
  cin >> A >> B >> C >> D >> E >> F;

  vector<int> w;
  for (int i=0;i<=3000;i+=A*100) {
    for (int j=i;j<=3000;j+=B*100) {
      w.push_back(j);
    }
  }

  vector<int> s;
  for (int i=0;i<=1000;i+=C) {
    for (int j=i;j<=1000;j+=D) {
      s.push_back(j);
    }
  }

  set<int> st(All(s));
  set<int> wt(All(w));

  int ans = 0;
  int ans_s = 0;
  double cri = 0.0;

  for (auto itr = st.begin(); itr != st.end(); ++itr) {
    for (auto itr2 = wt.begin(); itr2 != wt.end(); ++itr2) {
      if (*itr2 == 0 && *itr == 0) {
        continue;
      }

      //cout << *itr << " " << *itr2 << "\n";

      int sum = *itr + *itr2;
      double tmp = (double)*itr / ((double) *itr2 + (double)*itr);

      if (sum <= F) {
        //cout << tmp << "\n";
        //cout << sum << "\n";
        //cout << *itr << " " << *itr2 << "\n";
      }

      if (tmp >= cri && sum <= F && *itr <= (double)*itr2 * (double)E/(double)100) {
        //cout << sum << *itr << "\n";
        cri = tmp;
        ans = sum;
        ans_s = *itr;
      }
    }
  }

  cout << ans << " " << ans_s << "\n";
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXM 110000

int main(){
  int n,m;cin>>n>>m;
  vector<int> x(n);
  rep(i, n)cin>>x[i];
  map<int, int>mp, mm;
  rep(i, n){
    mm[x[i]]++;
    mp[x[i]%m]++;
  }

  int result = 0;
  int tr = 0;
  rep(i, m){
    if(i==0 || m%2==0 && i==m/2){
      tr += mp[i]/2;
    }else{
      int j = m-i;
      int s=mp[i],t=mp[j];
      mp[i]=0,mp[j]=0;
      if(s>t){
        swap(s,t);
        j=i;
      }
      //if(s==0)continue;
      result += s;
      t-=s;s=0;

      int tt=t;
      int tr2 = 0;
      for(int k=j%m; k<=MAXM; k+=m){
        if(tt>=2 && mm[k]>=2){
          int x = min(mm[k]/2, tt/2);
          tr2 += x;
          tt -= 2*x;
        }
      }

      result += tr2;

    }
  }

  cout<<result+tr<<endl;
//  cout<<result<<' '<<tr<<endl;

  return 0;
}


Measured memory_bytes: 12888
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  string s;
  cin>>s;
  int n=s.size();

  if(s=="keyence") {
    cout << "YES" << endl;
    return 0;
  }

  rep(i,n){
    rep(j,n){
      if(i>j) continue;
      string a="";
      rep(k,n){
        if(i<=k && k<=j) continue;
        a+=s[k];
      }
      if(a=="keyence") {
        cout << "YES" << endl;
        return 0;
      }
    }
  }

  cout << "NO" << endl;
}

Measured memory_bytes: 3644
using System;
 
class Program {
  static void Main (string[] args) {
    string[] HW = Console.ReadLine().Split(' ');
    string[] hw = Console.ReadLine().Split(' ');
    int H = int.Parse(HW[0]);
    int W = int.Parse(HW[1]);
    int h = int.Parse(hw[0]);
    int w = int.Parse(hw[1]);
    int res = (h > w) ? (h * W) + (w * (H - h)) : (w * H) + (h * (W - w));
    res = (H * W) - res;
    Console.WriteLine(res);
  }
}

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

using namespace std;

int main()
{
    int n, t;
    int ca[100], ta[100];

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

    int min = 1001;
    for (int i = 0; i < n; i++) {
        if (ta[i] <= t) {
            if (ca[i] < min) {
                min = ca[i];
            }
        }
    }

    if (min == 1001) {
        cout << "TLE" << endl;
    } else {
        cout << min << endl;
    }

    return 0;
}


Measured memory_bytes: 256
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n,k=parseMap(split(readline()))
    ans=k
    for i in 2:n
        ans*=k-1
    end
    println(ans)
end
main()

Measured memory_bytes: 110224
defmodule Main do
  def main do
    IO.gets("")
    |> String.trim()
    |> String.split("", trim: true)
    |> process([])
    |> Enum.join()
    |> IO.puts()
  end
  
  def process([], acc), do: acc
  def process(["B"  | tail], acc), do: process(tail, Enum.slice(acc, 0..-2))
  def process([head | tail], acc), do: process(tail, acc ++ [head])
end

Measured memory_bytes: 31324
#include<iostream>
using namespace std;
 
int main(){
  int n,a[200],ans=1001001001;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
   int count=0;
    while(a[i]%2==0){
      count++;
      a[i]/=2;
    }
    ans=min(count,ans);
  }
  cout<<ans<<endl;
}

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

int n, k, t, u, v, l, d[201];

double greedy()
{
    double time = 0;
    int carrot = 0;
    int next_carrot = 0;
    int place = 0;
    int dash_length = v * t;
    while (place < l) {
        if (carrot == 0) {
            int distance = d[next_carrot] - place;
            time += (double)distance / u;
            place = d[next_carrot];
            next_carrot++;
            carrot++;
        }
        else {
            if (place + dash_length < l) {
                carrot--;
                while (1) {
                    if (place + dash_length < d[next_carrot]) {
                        time += t;
                        place += dash_length;
                        break;
                    }
                    if (next_carrot == n) {
                        time += (double)(l - place) / v;
                        place = l;
                        break;
                    }
                    if (carrot < k) {
                        next_carrot++;
                        carrot++;
                    }
                    else {
                        time += (double)(d[next_carrot] - place) / v;
                        place = d[next_carrot];
                        next_carrot++;
                    }
                }
            }
            else {
                time += (double)(l - place) / v;
                place = l;
            }
        }
//        cout << "place" << place << endl;
//        cout << "carrot" << carrot << endl << endl;
    }
    return time;
}

int main()
{
    cin >> n >> k >> t >> u >> v >> l;
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }
    d[n] = l; // goal
    double ans = greedy();
    cout << fixed << setprecision(8) <<  ans << endl;
    return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;
using namespace chrono;
 
typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

//#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define loop(x,n) for(int x = 0; x < n; ++x)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;

string get_str() {
    string temp;
    cin >> temp;
    return temp;
}
int get_int() {
    int temp;
    cin >> temp;
    return temp;
}

void solve() {

    int n, d; cin >> n >> d;
    int c = 0;
    loop(i, n) {
        ll x, y;
        cin >> x >>y;
        
        if((sqrt((x*x)+(y*y)) <= d)) c++;
    }
    cout << c << endl;

}

int main() {
    
    solve();

}

Measured memory_bytes: 3612
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <bitset>
#include <utility>
#include <assert.h>
using namespace std;
#define rank rankk
#define mp make_pair
#define pb push_back
#define xo(a,b) ((b)&1?(a):0)
#define tm tmp
//#pragma comment(linker, "/STACK:1024000000,1024000000") 
//#define LL ll
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
const ll INFF=0x3f3f3f3f3f3f3f3fll;
const int MAX=1e5+10;
//const ll MAXN=2e8;
//const int MAX_N=MAX;
const ll MOD=998244353;
//const long double pi=acos(-1.0);
//const double eps=0.00000001;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
inline ll powMM(ll a,ll b,ll M){
    ll ret=1;
    a%=M;
//    b%=M;
    while (b){
        if (b&1) ret=ret*a%M;
        b>>=1;
        a=a*a%M;
    }
    return ret;
}
void open()
{
//    freopen("1009.in","r",stdin);
    freopen("out.txt","w",stdout);
}
int n,m,u,v;
const int maxn=1e5+5;
vector<int> G[maxn];
int color[maxn];
bool bipartite(int u)
{
    for(int i=0;i<G[u].size();i++)
    {
        int v=G[u][i];
        if(color[v]==color[u])return false;
        if(!color[v])
        {
            color[v]=3-color[u];
            if(!bipartite(v))return false;
        }
    }
    return true;
}
int cnt1;
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d",&u,&v);G[u].pb(v);G[v].pb(u);
    }
    color[1]=1;
    if(bipartite(1))
    {
        for(int i=1;i<=n;i++)
            if(color[i]==1)++cnt1;
        printf("%lld\n",1LL*(n-cnt1)*cnt1-m);
    }
    else printf("%lld\n",1LL*n*(n-1)/2LL-m);
    return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define n 50
using namespace std;
int main(){
    int score[n][3];
    int m[n], f[n], r[n];
    int num;
    for(int i=0;i<n;i++){
        cin >> m[i] >> f[i] >> r[i];
        if(m[i]==-1 && f[i]==-1 && r[i]==-1){
            num=i;
            break;
        } 
    }
    for(int i=0;i<num;i++){
        if(m[i]==-1 || f[i]==-1) {
            cout << "F" << endl;
            continue;
        }
        int sum=m[i]+f[i];
        if(sum>=80) cout << "A" << endl;
        else if(sum>=65) cout << "B" << endl;
        else if(sum>=50) cout << "C" << endl;
        else if(sum>=30){
            if(r[i]>=50) cout << "C" << endl;
            else cout << "D" << endl;
        }else cout << "F" << endl;
    }
    return 0;
}


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

int main(){
    int n,m;
    scanf(" %d %d",&n,&m);
    int sum = 0;
    for(int i = 0; i < m;++i){
        int va; scanf(" %d",&va);
        sum += va;
    }
    if(sum > n)puts("-1");
    else printf("%d\n",n-sum);
    return 0;
}


Measured memory_bytes: 3868
#include<stdio.h>
#include<ctype.h>
int main(void){
	int x[26],i,j;
	char a;
	for(i=0;i<26;i++)x[i]=0;

	while(scanf("%c", &a) != EOF){
		x[tolower(a)-'a']++;
	}
	for(i=0;i<26;i++)
		printf("%c : %d\n",'a'+i,x[i]);
	return 0;
}

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

int main()
{
    string s, t;
    cin >> s >> t;
    
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    
    if(t > s)
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}


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

int main(void){

    int x_in;
    bool isMatch[5] = {false};

    int init_x[5]={1,2,3,4,5};
    for(int i=0;i<5;++i){
        cin >> x_in;
        for(int j=0;j<5;++j){
            if(x_in == init_x[j]){
                isMatch[j] = true;
                break;
            }
        }
    }

    for(int k=0;k<5;++k){
        if(isMatch[k]==false){
             cout << init_x[k];
             break;
        }
    } 
    return 0;
}



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

int main()
{
	int a, b, c;
	int k;
	cin >> a >> b >> c;
	cin >> k;

	for(int i = 0; i < k; i++){
		if(a >= b) b = b * 2;
		else if(b >= c) c = c * 2;
		else break;
	}

	if(a < b and b < c )
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3612
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <iostream>
#include <map>
#include <queue>
#define N 1000010
#define ll long long
#define mo ((ll)1e9+7)
//10000000000037ll
//21993833369ll
#define db double
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define drep(i,a,b) for(int i=a;i>=b;--i)
#define mst(a,b) memset(a,b,sizeof(a))
using namespace std;
bool cmp(int a, int b) {return a > b;}
inline ll read() {
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') {if (ch == '-')f = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
	return x * f;
}
int n;
int a[N], pri[N], cnt;
bool ispri[N], vis[N];
bool one, two;
void init() {
	mst(ispri, 1);
	rep(i, 2, (int)1e6)if (ispri[i]) {
		pri[++cnt] = i;
		for (int j = 2; i * j < N; ++j)ispri[i * j] = 0;
	}
}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
void solve(int x) {
	for (int i = 1; i <= cnt && pri[i] * 1ll * pri[i] <= x; ++i)
		if (x % pri[i] == 0) {
			if (!vis[pri[i]])vis[pri[i]] = 1;
			else {one = 0; return;}
			for (; x % pri[i] == 0; x /= pri[i]);
		}
	if (x > 1) {
		if (!vis[x])vis[x] = 1;
		else {one = 0; return;}
	}
}
int main() {
	n = read();
	init();
	one = 1, two = 1;
	int tmp;
	rep(i, 1, n) {
		a[i] = read();
		if (one)solve(a[i]);
		if (i == 1)tmp = a[1];
		else tmp = gcd(tmp, a[i]);
	}
	if (tmp != 1)two = 0;
	if (one)puts("pairwise coprime");
	else if (!one && two)puts("setwise coprime");
	else puts("not coprime");
	return 0;
}


Measured memory_bytes: 8800
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)
#define FORR(i,a,b) for (int i=(a); i>=(b); --i)
#define REP(i,b) for (int i=0; i<(b); ++i)
#define endl '\n'
#define sz(x) (int) x.size()
#define mod %
#define fillchar(x,y,z) memset(x,z,y)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define sqr(x) ((x)*(x))
typedef long long int64;
typedef unsigned long long qword;
using namespace std;
const int maxn=1e5+5;
int n,m;
int64 f[maxn];
void Input()
{
    cin >> n >> m;
    int sum=0;
    fillchar(f,sizeof(f),127);
    f[0]=0;
    FOR(i,1,n) {
        int w,v;
        cin >> w >> v;
        FORR(j,sum,0) if (f[j]<=m)
            f[j+v]=min(f[j+v],f[j]+w);
        sum+=v;
    }
    int res=0;
    FOR(i,0,sum) if (f[i]<=m) res=i;
    cout << res;
}
void Solve()
{

}
int main()
{
    #ifdef meomeomeooooo
        freopen("input.txt","r",stdin);
        //freopen(".out","w",stdout);
    #endif // meomeomeooooo
    iostream::sync_with_stdio(false);
    cin.tie(0);
    Input();
    Solve();
    return 0;
}



Measured memory_bytes: 1024