akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using Enu = System.Linq.Enumerable;

public class Program
{
    static readonly int Mod = (int)1e9 + 7;
    Dictionary<long, Dictionary<long, long>> dic;

    public void Solve()
    {
        long N = Reader.Long();
        dic = new Dictionary<long, Dictionary<long, long>>();
        Console.WriteLine(F(N, N));
    }

    private long F(long S, long X)
    {
        if (S == 0) return 1;
        if (dic.ContainsKey(S) && dic[S].ContainsKey(X)) return dic[S][X];
        long res = 0;
        res += F(S / 2, X / 2);
        res += F((S - 1) / 2, (X - 1) / 2);
        if (S >= 2) res += F((S - 2) / 2, X / 2);
        res %= Mod;
        Add(S, X, res);
        return res;
    }

    void Add(long S, long X, long val)
    {
        if (!dic.ContainsKey(S)) dic[S] = new Dictionary<long, long>();
        dic[S][X] = val;
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    public static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string[] Split(string s) { return s.Split(separator, op); }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

Measured memory_bytes: 3032
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  // Input
  int A, B;
  std::cin >> A >> B;

  // Main
  if (A >= 13)
    std::cout << B << std::endl;
  else if (A >= 6)
    std::cout << B / 2 << std::endl;
  else
    std::cout << 0 << std::endl;

  // Output

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc090c
{
    class Program
    {
        static void Main(string[] args)
        {
            var mn = Console.ReadLine().Split();
            var n = long.Parse(mn[0]);
            var m = long.Parse(mn[1]);
            var ans = 0L;
            checked {
                if (n == 1 && m == 1) ans = 1;
                else if (n == 1) ans = m - 2;
                else if (m == 1) ans = n - 2;
                else ans = (m - 2) * (n - 2);
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A {
    class Program {
        static void Main(string[] args) {
            int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();//2つ以上のスペース区切り入力の取得
            int A = input[0];
            int B = input[1];
            // Console.Write("改行なし a = {0} b = {1} c = {2}", a, b, c)//改行なし出力
            // Console.WriteLine("改行あり a = {0} b = {1} c = {2}", a, b, c);//改行付き出力
            if ((A * B) % 2 == 0) {
                Console.WriteLine("Even");
            } else {
                Console.WriteLine("Odd");
            }
        }
    }
}

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

#define debug(x) cout <<"DEBUG"<<" "<<#x<<":"<<x<<'\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}


/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    //input
    int h, w, a; cin >> h >> w;
    vii c(10, vi(10));
    rep(i,10) {
        rep(j,10) cin >> c[i][j];
    }
    //warshall floyd
    for(int k = 0; k < 10; k++) {
        for(int i = 0; i < 10; i++) {
            for(int j = 0; j < 10; j++){
                //passが通っていない箇所がないのでescapeはいらない
                chmin(c[i][j], c[i][k]+c[k][j]);
            }
        }
    }

    int cnt = 0;
    rep(i,h) {
        rep(j,w) {
            cin >> a;
            if(a == -1) continue;
            cnt += c[a][1];
        }
    }
    //output
    cout << cnt << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int h,a;cin>>h>>a;
	cout << (h + a - 1) / a << endl;
	return 0;
}

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 ll long long int
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define mp make_pair
#define ld long double
#define ull unsigned long long int
#define mod 1000000007
int n,a[3005];
ll dp[3004][3004];
ll recurs(int start,int end)
{
	if(start>end) return 0;
	if(dp[start][end]!=-1) return dp[start][end];
	dp[start][end]=max(a[start]+min(recurs(start+1,end-1),recurs(start+2,end)),a[end]+min(recurs(start+1,end-1),recurs(start,end-2)));
	return dp[start][end];
}
int main()
{
    ios_base::sync_with_stdio(false);//this works only
    cin.tie(NULL);// when first all inputs are from user
    cout.tie(NULL);//you will see all outputs afterwards
    memset(dp,-1,sizeof(dp));
    cin>>n;
    ll sum=0;
    for (int i = 0; i < n; ++i)
    {
    	cin>>a[i];
    	sum+=a[i];
    }
    ll ans=recurs(0,n-1);
    ll y=sum-ans;
    cout<<ans-y<<endl;
    return 0;
}

Measured memory_bytes: 71040
N,M=input().split(" ")
N=int(N)
M=int(M)

A=[]
B=[]
for i in range(N):
	a,b=input().split(" ")
	A.append(int(a))
	B.append(int(b))




SET=[[A[i],B[i]]for i in range(N)]
#print(SET)
SET.sort(key=lambda x:x[0])
#print(SET)

total=0
money=0
for i in range(len(SET)):
	for j in range(SET[i][1]):
		if(total>=M):
			print(money)
			exit()
		total+=1
		money+=SET[i][0]
		#print(money,total)
print(money)	






Measured memory_bytes: 22816
N = int(input())
A = list(map(int, input().split()))
flg = True
for a in A:
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      flg = False
      break
if flg:
  print('APPROVED')
else:
  print('DENIED')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=200005;
//i_am_noob
int n,a[50];
ld k=0;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cout << fixed << setprecision(12);
	cin >> n;
	rep(n) cin >> a[i];
	sort(a,a+n);
	k=a[0];
	rep(n-1) k=(k+a[i+1])/2;
	print1(k);
	return 0;
}

Measured memory_bytes: 256
from math import gcd

n = int(input())
for i in range(n):
    a, b = map(int, input().split())
    if i == 0:
        pre_a, pre_b = a, b
    if pre_a * b < pre_b * a:
        mul = (pre_b + b - 1) // b
        pre_b = mul * b
        pre_a = pre_b * a // b
    else:
        mul = (pre_a + a - 1) // a
        pre_a = mul * a
        pre_b = pre_a * b // a
    # print(i, pre_a, pre_b)
print(pre_a + pre_b)


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

// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

typedef long long ll; 
typedef long double ld; 
#define prarr(a,n) cout<<#a<<" : ";for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define prmat(mat,row,col) cout<<#mat<<" :\n";for(ll i=0;i<row;i++) {for(ll j=0;j<col;j++) cout<<mat[i][j]<<"\t";cout<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define fast_io ios_base::sync_with_stdio(NULL); cin.tie(NULL)
template <class T> void dbs(string str, T t) {cout << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {ll idx = str.find(','); cout << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cout << "["; for (T i = a; i != b; ++i) {if (i != a) cout << ", "; cout << *i;} cout << "]\n";}
template <class T> void prall(T a) { prc(all(a)); }
const int inf=1000*1000*1000+9; 
const ll infl=1ll*inf*inf; 
const int mod=1000*1000*1000+7;

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

const int nax=1e5+5;


void solve(){
    int n;
    string s;
    cin>>n>>s;
    for(int i=0;i<sz(s);i++){
        int j=s[i]-'A';
        j+=n;
        j%=26;
        cout<<(char)(j+'A');
    }
}


int main(){
    // clock_t beg=clock(); 
    fast_io; 
    cout << fixed << setprecision(13); 
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    } 
    // clock_t end=clock(); 
    // fprintf(stderr, "%lf\n", (double)(end-beg)/(CLOCKS_PER_SEC));
}

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

int main() {
	map<string, bool> T;
	int commandNum;

	cin >> commandNum;
	for (int i = 0; i < commandNum; i++) {
		string command, str;
		cin >> command >> str;

		if (command[0] == 'i') T[str] = true; //insert??????
		else {								  //find??????
			if (T[str]) cout << "yes" << endl;
			else        cout << "no"  << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 52436
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b;
    cin>> a>>b;
    if(b==100){
    for(int i=1;i<1000;i*=10){
        int c=0;
        c=a/i%10*1000*i;
       b+=c;
      }
    }
    else if(9<b&&b<100){
        for(int i=1;i<1000;i*=10){
            int c=0;
            c=a/i%10*100*i;
            b+=c;
        }
    }
    else {
        for(int i=1;i<1000;i*=10){
            int c=0;
            c=a/i%10*10*i;
            b+=c;
        }
    }
    for(int i=1;i<350;i++){
        if(i*i==b){
            cout << "Yes" <<endl;
            return 0;
        }
    }
    cout << "No"  <<endl;

}

Measured memory_bytes: 3604
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//



int main() {

    int H, W, K; cin >> H >> W >> K;
    char c[H][W];
    rep(h,H) {
        rep(w,W) cin >> c[h][w];
    }

    int ans = 0;
    for (int h_bit = 0; h_bit < (1 << H); ++h_bit) {
        for (int w_bit = 0; w_bit < (1<<W); ++w_bit) {
            
            int tmp = 0;
            for (int h = 0; h < H; ++h) {
                for (int w = 0; w < W; ++w) {
                    if (h_bit & (1<<h) && w_bit & (1<<w) && c[h][w] == '#') ++tmp;
                }
            }
            if (tmp == K) ++ans;
        }
    }

    out(ans);



    return 0;
}









Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
lli f[(int)1e7 + 50];
int main()
{
	lli a;
	scanf("%lld",&a);
	for(int i=2; i<=a; i++)
	{
		f[i] ++;
		for(int j=2 * i; j <= a; j += i)
			f[j] ++;
	}
	lli ans = 0;
	for(lli i=1; i<=a; i++)
		ans += i * (f[i] + 1ll);
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 81908
N,x=map(int,input().split())
a=[]
ans=0
a=list(map(int,input().split()))
a.sort()
for i in range(N):
    if i==N-1 and a[i]!=x:
        break
    elif a[i]<=x:
        x-=a[i]
        ans+=1
    else:
        break
print(ans)


Measured memory_bytes: 3060
a, b, c, d = gets.chomp.chars.map(&:to_i)

expl = ""
["+", "-"].each do |op1|
  ["+", "-"].each do |op2|
    ["+", "-"].each do |op3|
      expl = "#{a}" + op1 + "#{b}" + op2 + "#{c}" + op3 + "#{d}"
      if eval(expl) == 7
        puts expl + "=7"
        exit
      end
    end
  end
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
using PL = pair<ll , ll> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
#define mod 1000000007

int main(){
    string s ;
    cin >> s ;
    vector<int> a (2019) ;
    reverse(s.begin(), s.end()) ;
    int n = s.size() ;
    int ans = 0 ;
    int tot = 0 ;
    int x = 1 ;
    rep(i, n){
        a[tot]++ ;
        tot += (s[i] - '0') * x ;
        tot %= 2019 ;
        ans += a[tot] ;
        x *= 10 ;
        x %= 2019 ;
    }
    cout << ans << endl ;
}



Measured memory_bytes: 3696
#include<iostream>
using namespace std;
int main()
{
int n,t=0;
cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=0;i<n;i++)
{
  if(i%2==0&&a[i]%2==1)
  t++;
  }
  cout<<t;
  return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e9;
const long long int mod = 1e9+7;
typedef pair<ll,ll> pairs;
vector<pairs> p;


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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<vector<ll>> combination(ll n, ll r){
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for(ll i=0;i<v.size();++i){
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for(ll i=1;i<v.size();++i){
        for(ll j=0;j<i;++j){
            v[i][j] = (v[i - 1][j - 1] + v[i - 1][j]);
        }
    }
    return v;
}
// ------------------------------------

int main(){
    ll k, t;
    cin>>k>>t;
    ll a[t];
    ll x=0;
    ll ans=0;
    for(ll i=0;i<t;++i){
        cin>>a[i];
        x = max(x, a[i]);
        ans += a[i];
    }
    ans -= x;
    ans = x-ans-1;
    ll flag = 0;
    ans = max(ans, flag);
    cout<<ans<<endl;

    return 0;
}

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

using namespace std;

int gcd(int a, int b)
{
	return ( a%b ? gcd(b, a%b) : b );
}

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

	int x, y;
	cin >> x >> y;
	cout << x + y - gcd(x, y) + 1 << endl;

	return 0;
}



Measured memory_bytes: 3220
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int A, B;
	cin >> A >> B;
	int now = 1;
	int cnt = 0;
	while (now < B) {
		now += (A - 1);
		cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
n,m,x,y=map(int, input().split(" "))
X=list(map(int, input().split(" ")))
Y=list(map(int, input().split(" ")))
flag=0
#print(max(X),min(Y))
for i in range(x+1,y+1):
    #print(i)
    if (max(X) < i) and (min(Y) >= i):
        #print(i)
        flag=1
        break
if flag==1:
    print("No War")
else:
    print("War")


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll m=1000000007;
vector<vector<ll> > multi(vector<vector<ll> >a,vector<vector<ll> >b)
{
		ll n=a.size();
	vector<vector<ll> >c(n,vector<ll>(n,0));
	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<n;j++)
		{
			//c[i][j]=0;
			for(ll k=0;k<n;k++)
			{
				c[i][j]=((a[i][k]%m*b[k][j]%m)%m+c[i][j]%m)%m;
			}
		}
	}
	return c;
}
vector<vector<ll> > power(vector<vector<ll> >g,ll k)
{
	if(k==1)return g;
	vector<vector<ll> >res;
	res=power(g,k/2);
	res=multi(res,res);
	if(k%2!=0)res=multi(res,g);
	return res;
}
int main()
{
	ll n,k;
	cin>>n>>k;
	vector<vector<ll> >g(n,vector<ll>(n,0));
	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<n;j++)
		{
			cin>>g[i][j];
		}
	}
	vector<vector<ll> >res;
	res=power(g,k);
	ll sum=0;
	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<n;j++)
		{
			sum=(res[i][j]%m+sum%m)%m;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int N;
map<int, int> m;
int main() {
  cin >> N;

  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    m[a]++;
    m[a + 1]++;
    m[a - 1]++;
  }

  int maxv = 0;
  for( auto itr = m.begin(); itr != m.end() ; ++itr ) {
    maxv = max(maxv, itr->second);
  }
  cout << maxv << endl;
  return 0;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
long long dp[100005][15];
const int md = 1e9+7;

int main(){
  string s;
  cin>>s;
  
  vector<int> tmp;
  tmp.push_back(1);tmp.push_back(10);tmp.push_back(9);
  tmp.push_back(12);tmp.push_back(3);tmp.push_back(4);
  
  int mod = 1e9+7;

  dp[0][0] = 1;
  int n = s.length();
  
  for(int i=0;i<n;++i){
    
    if(s[i]!='?'){
      int curr = s[i]-'0';
      int ii = n-i-1;
      int mod = ii%6;
      int rnt = (tmp[mod] * curr) %13;
      for(int j=0;j<13;++j){
        dp[i+1][(j+rnt)%13] += dp[i][j];
        dp[i+1][(j+rnt)%13] %= md;
      }
      
    }else{
      for(int j=0;j<10;++j){
        int curr = j;
        int ii = n-i-1;
        int mod = ii%6;
        int rnt = (tmp[mod] * curr) %13;
        for(int j=0;j<13;++j){
          dp[i+1][(j+rnt)%13] += dp[i][j];
          dp[i+1][(j+rnt)%13] %= md;
        }        
      }
    }
    /*
    for(int j=0;j<13;++j){
      cout<<dp[i+1][j]<<" "; 
    }cout<<endl;
    */
  }
  
  cout<<dp[n][5]<<endl;
  //for(int i=0;i<13;++i)cout<<i<<" "<<dp[n][i]<<endl;
  return 0;
}

Measured memory_bytes: 12160
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int N, a[109];
int main() {
	cin >> N;
	for (int i = 0; i < N; i++) cin >> a[i];
	sort(a, a + N, greater<int>());
	int ret = 0;
	for (int i = 0; i < N; i++) ret += a[i] * (i & 1 ? -1 : 1);
	cout << ret << endl;
	return 0;
}

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

#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 1e5+5;
int  a[N];

int main()
{
	IOS;
	int n,k;
	string s;
	cin >> n >> s >> k;
	char lol = s[k-1];
	for(int i = 0; i < n; i++)
	{
		if(lol == s[i])
		{
			cout << s[i];
			continue;
		}
		cout<<"*";
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int add = 0, sub = 0;
		for (; !isPalin(n + add); ++add) ;
		for (; !isPalin(n - sub); ++sub) ;
		int ans = n - sub;
		if ( add < sub ) {
			ans = n + add;
		}
		System.out.println(ans);
	}

	static boolean isPalin(int x) {
		String str = Integer.toString(x);
		for (int i = 0; i < str.length(); ++i) {
			if (str.charAt(i) != str.charAt(str.length() - 1 - i)) {
				return false;
			}
		}
		return true;
	}
}

Measured memory_bytes: 17364
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int a;
  string s;
  cin >> a >> s;
  if(a >= 3200) cout << s << endl;
  else cout << "red" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define sl set<ll>
#define vs vector<string>
#define vl vector<ll>
#define vi vector<int>
#define vpl vector<pair<ll,ll>>
#define pb push_back
#define PI 3.14159265358979323846
#define ll long long
#define ld long double
#define endl "\n"
#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define repp(i,a,b) for (ll i = (a); i >= (b); i--)
#define rop(i,a,b)  for(ll i=(a); i>(b); i--)
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define tt long long t; cin>>t; while(t--)
#define IOS ios::sync_with_stdio(0);cin.tie(0);
const int maxn=1e5+100;


int main()
{
ll n;
cin>>n;
ll a[n];
ll sum=0,b;
rep(i,0,n)cin>>a[i];
rep(i,1,n)
{
  if(a[i]<=a[i-1]){b=abs(a[i-1]-a[i]);sum+=b;a[i]+=b;}
  
}
cout<<sum<<endl;
}

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

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

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

int f(char c) {
    return c - '0';
}

void solve(int N) {
    const int sz = (60 * 60 * 24 + 1) * 2; 
    VI v(sz, 0);
    REP(i, N) {
        string s; cin >> s;
        int st = 0;
        st += f(s[0]) * 10 + f(s[1]);
        st *= 60 * 60;
        st += (f(s[3]) * 10 + f(s[4])) * 60;
        st += f(s[6]) * 10 + f(s[7]);
        cin >> s;
        int ed = 0;
        ed += f(s[0]) * 10 + f(s[1]);
        ed *= 60 * 60;
        ed += (f(s[3]) * 10 + f(s[4])) * 60;
        ed += f(s[6]) * 10 + f(s[7]);
        v[st]++;
        v[ed]--;
    }
    REP(i, sz - 1) {
        v[i + 1] += v[i];
    }
    int ans = 0;
    REP(i, sz) {
        ans = max(ans, v[i]);
    }
    cout << ans << endl;
    return;
}

signed main(void) {
    int n, m, p, a, b, c, x, y, z, q;
    string s;
    bool f = false;
    while (cin >> n, n) {
        solve(n);
        //return 0;
    }
}

Measured memory_bytes: 3828
#include <cstdio>
typedef long long ll;
inline ll rd(){
    ll x=0,p=1;
    char a=getchar();
    while((a<48||a>57)&&a!='-')a=getchar();
    if(a=='-')p=-p,a=getchar();
    while(a>47&&a<58)x=(x<<1)+(x<<3)+(a&15),a=getchar();
    return x*p;
}
const int N=2002;
const ll mod=1e9+7;
inline ll fpow(ll b,ll p,ll mod){
	ll ans=1,tmp=b;
	while(p){
		if(p&1)ans=ans*tmp%mod;
		tmp=tmp*tmp%mod;
		p>>=1;
	}
	return ans;
}
int n,k;
ll fac[N*N],inv[N*N],f[N][N];
inline ll C(int n,int m){
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main(){
	fac[0]=1;
	n=rd(),k=rd();
	if(k==1)return puts("1"),0;
	for(int i=1;i<=4000000;i++)fac[i]=fac[i-1]*i%mod;
	f[0][0]=1;
	inv[4000000]=fpow(fac[4000000],mod-2,mod);
	for(int i=3999999;i>=0;i--)inv[i]=(inv[i+1]*(i+1))%mod;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=i;j++){
			f[i][j]=f[i-1][j];
			if(j)f[i][j]=(f[i][j]+f[i][j-1]*(n-j+1)%mod*C(n-i+(n-j+1)*(k-1)-1,k-2)%mod)%mod;
		}
	printf("%lld\n",f[n][n]);
    return 0;
}

Measured memory_bytes: 92672
#include <cstdio>
using namespace std;
char s[105],c;int top=0;
int main(){
	while((c=getchar())!='\n'){
		if(c=='B') {
			if(top) top--;
		}
		else s[top++]=c;
	}
	for(int i=0;i<top;i++) printf("%c",s[i]);putchar('\n');
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

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

const int N_MAX = 2020;
const int INF = 1e9;
int a[3*N_MAX];
int dp[N_MAX][N_MAX];
int maxi[N_MAX];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    int x,y; cin>>x>>y;
    if (x>y) swap(x,y);
    rep(i,3*(N-1)) cin>>a[i];
    int z; cin>>z;

    rep(i,N+1)rep(j,N+1) dp[i][j]=-INF;
    rep(i,N+1) maxi[i]=-INF;
    dp[x][y] = 0;
    maxi[x] = maxi[y] = 0;
    int Max=0;
    int extra=0;
    using P = tuple<int,int,int>;
    // FOR(i,1,N)FOR(j,i,N) cout<<"dp("<<i<<","<<j<<") = "<<dp[i][j]<<endl;
    // FOR(i,1,N) cout<<"max("<<i<<") = "<<maxi[i]<<endl;
    // cout<<"--------------"<<endl;
    rep(i,N-1){
        int *v = &a[i*3];
        if (v[0]==v[1] && v[1]==v[2]){
            extra++;
            continue;
        }
        sort(v,v+3);
        bool aab = (v[0]==v[1]);
        bool abb = (v[1]==v[2]);
        int vsum=v[0]+v[1]+v[2];
        // cout<<"input: "<<v[0]<<" "<<v[1]<<" "<<v[2]<<endl;
        queue<P> que;
        rep(j,3)FOR(k,1,N){
            int value = maxi[k];
            if (aab && j==2){
                int s = min(k,v[0]);
                int t = max(k,v[0]);
                chmax(value,dp[s][t]+1);
            }
            if (abb && j==0){
                int s = min(k,v[2]);
                int t = max(k,v[2]);
                chmax(value,dp[s][t]+1);
            }
            rep(x,3)FOR(y,x+1,2){
                if ((v[x]==k&&y==j) || (x==j&&v[y]==k)){
                    int z = vsum-v[x]-v[y];
                    chmax(value,max(dp[z][z]+1,Max));
                }
            }
            que.push({v[j],k,value});
        }
        while(!que.empty()){
            int s,t,score;
            tie(s,t,score) = que.front(); que.pop();
            if (s>t) swap(s,t);
            chmax(dp[s][t],score);
            chmax(Max,dp[s][t]);
            chmax(maxi[s],dp[s][t]);
            chmax(maxi[t],dp[s][t]);
        }
        // FOR(i,1,N)FOR(j,i,N) cout<<"dp("<<i<<","<<j<<") = "<<dp[i][j]<<endl;
        // FOR(i,1,N) cout<<"max("<<i<<") = "<<maxi[i]<<endl;
        // cout<<"--------------"<<endl;
    }
    int ans=0;
    rep(i,N+1)rep(j,N+1){
        chmax(ans,dp[i][j]+(i==j&&j==z));
    }
    ans+=extra;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 19532
import itertools
N, M, Q = map(int,input().split())
abcd_list = []
for i in range(Q):
    abcd_list.append(list(map(int,input().split())))

ans = 0
for A in itertools.combinations_with_replacement(range(1, M+1), N):
    A = sorted(list(A))
    point = 0
    for abcd in abcd_list:
        if A[abcd[1]-1] - A[abcd[0]-1] == abcd[2]:
            point += abcd[3]
    if point > ans:
        ans = point

print(ans)


Measured memory_bytes: 9216
import scala.io.StdIn


object Main {
  def main(args: Array[String]): Unit = {
    while(true) {
      val n :: m :: _res = StdIn.readLine().split(" ").map(_.toInt).toList
      if(n == 0) { return; }

      val c = (for {
        i <- 1 to m
      } yield {
        StdIn.readLine.split(" ").map(_.toInt)
      }).toArray

      println(solve(n, m, c))
    }
  }



  def solve(w: Int, h: Int, c: Array[Array[Int]]): Int = {
    case class I(x: Int, y: Int, var isLand: Boolean) {
      def coodinateIndexes: Seq[(Int, Int)] = {
        //if(!isLand) return Seq.empty

        (for {
          i <- List(-1, 0, 1)
          j <- List(-1, 0, 1)
          if !(i == 0 && j == 0)
        } yield (x + i, y + j)).filterNot{ case (nx, ny) =>
            (nx == x && ny == y) ||
            (nx < 0) || (nx >= w) ||
            (ny < 0) || (ny >= h)
        }
      }
    }

    val is = c.zipWithIndex.map{ case (row, rId) =>
      row.zipWithIndex.map{ case (i, cId) =>
        I(cId, rId, i == 1)
      }
    }


    def rec(i: Int, j: Int): Int = {
      val now = is(j)(i)
      if(now.isLand) {
        now.isLand = false
        now.coodinateIndexes.filter{ case (x, y) =>
          is(y)(x).isLand
        }.map{ case (x, y) => rec(x, y)}
        1
      } else 0
    }

    (for {
      i <- 0 until w
      j <- 0 until h
    } yield rec(i, j)).sum
  }
}

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

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, x; cin >> n >> x;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	int ans = 1, sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (sum <= x) ans++;
	}
	cout << ans << '\n';
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
ll mod = 1000000007;

int main() {
    ll n, d;
    cin >> n >> d;
    ll x[n], y[n];
    rep(i, n) { cin >> x[i] >> y[i]; }

    ll count = 0;
    rep(i, n) {
        if (x[i] * x[i] + y[i] * y[i] <= d * d)
            count++;
    }
    cout << count << endl;
    return 0;
}



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

using namespace std;

int main(){
    int h, n, s=0;
    cin>>h>>n;
    int x[n];
    for(int i=0;i<n;i++){
        cin>>x[i];
        s=s+x[i];
    }
    if(s>=h){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 640
"""
与えられた二つのプログラムが完全に等しければ IDENTICAL と出力せよ．
二つのプログラム中の対応する文字列定数一つだけが異なるならば CLOSE と出力せよ．
それ以外の場合，DIFFERENT と出力せよ．
"""
import re


while True:
    s1 = str(input())
    if s1 == '.':
        break
    s2 = str(input())

    moziretsuteisu_s1 = re.findall("\".*?\"", s1)
    moziretsuteisu_s2 = re.findall("\".*?\"", s2)

    new_s1 = re.sub("\".*?\"", " ", s1)
    new_s2 = re.sub("\".*?\"", " ", s2)

    cnt = 0
    if len(moziretsuteisu_s1) != len(moziretsuteisu_s2):
        cnt = 2
    else:
        for x, y in zip(moziretsuteisu_s1, moziretsuteisu_s2):
            if x != y:
                cnt += 1

    if s1 == s2:
        print("IDENTICAL")
    elif cnt == 1 and new_s1 == new_s2:
        print("CLOSE")
    else:
        print("DIFFERENT")



Measured memory_bytes: 6540
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    h = list(map(int, input().split()))
    res = 0
    while sum(h):
        for i in range(n):
            if h[i]==0:
                continue
            h[i] -= 1
            if i==n-1:
                res += 1
            elif h[i+1]==0:
                res += 1
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n,m;
	std::cin >> n >> m;
	std::string s;
	std::cin >> s;
	// reverse in the end
	reverse(all(s));
	std::vector<int> safe;
	rep(i,n+1) {
		if(s[i]=='0') safe.emplace_back(i);
	}
	std::vector<int> ans;
	int curr = 0;
	while(curr<n) {
		int l=-1,r=safe.size();
		int next = *(std::upper_bound(safe.begin(),safe.end(),curr+m)-1);
		if(next<=curr) {
			print(-1);
			return 0;
		}
		ans.emplace_back(next-curr);
		curr = next;
	}
	reverse(all(ans));
	for(auto i:ans) {
		std::cout << i << ' ';
	}
	std::cout << ENDL;

	return 0;
}


Measured memory_bytes: 2676
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

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; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void AnsYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void AnsYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}

//ここまでライブラリ
//ここから本文

long long int tpimin(vector<int> a) {
	int MIN = 1000000000;
	int number = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
		number = i;
	}
	return number;
}
int main() {
	int a, b;
	string s;
	cin >> a >> b >> s;
	bool flag = true;
	for (int i = 0; i < s.size(); i++) {
		if (i == a) {
			if (s.at(i) != '-') flag = false;
		}
		else {
			if ('0' > s.at(i) || s.at(i) > '9') flag = false;
		}
	}
	AnsYes(flag);
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

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

    public static void solve(Scanner sc) {
        String s = sc.nextLine();
        System.out.println("" + s.charAt(0) + (s.length() - 2) + s.charAt(s.length() - 1));
    }
}

Measured memory_bytes: 22864
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>  // assert(x>=10), 部分点問題
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <set>

#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
#define SORT(v,n) sort(v,v+n)
#define VSORT(v) sort(all(x))
#define FILL(v, value) (v+(sizeof(v) / sizeof *(v)), value);
#define inf 999999999
#define dbg(x) cout<<#x<<":"<<x<<endl;
#define pb(a) push_back((a))
#define mp(a) make_pair((a))
#define pi 2*acos(0.0)
#define in scanf
#define out printf
#define fi first
#define se second

// --
#define bit(n) (1LL<<(n)) // 左bitシフト
// --

using namespace std;

typedef long long llong;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<llong, pll> plp;

const int MOD=1000000007;
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};  // 右下左上


int main(int argc, char**argv){
    int n;
    cin >> n;
    vector<int> a;
    rep(i, n){
        int tmp;
        in("%d", &tmp);
        a.pb(tmp);
    }
    // check
    if (n % 2 == 0) {
        int check[n];
        rep(i,n) check[i] = 0;
        rep(i,n){
            check[a[i]]++;
        }
        for(int i = 1; i < n-1; i+=2){
            if (check[i] != 2){
                cout << 0 << endl;
                return 0;
            }
        }
    }else{
        int num_of_zero = 0;
        rep(i,n){
            if (a[i] == 0) num_of_zero++;
        }
        if (num_of_zero != 1) {
            cout << 0 << endl;
            return 0;
        }
        int check[n];
        rep(i,n) check[i] = 0;
        rep(i,n){
            check[a[i]]++;
        }
        for(int i = 2; i < n; i+=2){
            if (check[i] != 2){
                cout << 0 << endl;
                return 0;
            }
        }
    }
    // end of check

    // ok
    // cout << ((int) pow(2, n/2)) << endl;
    llong ans = 1;
    rep(i, n/2){
        ans *= 2;
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    bool flg;
    flg = false;
    for(int i=0; i<n; i++){
        char c;
        cin >> c;
        if(c=='Y') flg=true;
    }
    if(flg){
        cout << "Four" << endl;
    }else{
        cout << "Three" << endl;
    }
}




Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
//		solveA(args);
		solveB(args);
//		solveC(args);
//		solveD(args);
//		solveE(args);
//		solveF(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int N= nextInt();

		if(N>=30) {
			pw.println("Yes");
		}else {
			pw.println("No");
		}
	}
	public static void solveB(String[] args) throws Exception{
		int N = nextInt();
		long D = nextInt();

		int ans = 0;
		for(int i=0;i<N;i++) {
			long x = nextLong();
			long y = nextLong();
			if(x*x+y*y<=D*D) {
				ans++;
			}
		}
		pw.println(ans);
	}
	public static void solveC(String[] args) throws Exception{


	}


	public static void solveD(String[] args) throws Exception{

	}


	public static void solveE(String[] args) throws Exception{


	}

	public static void solveF(String[] args) throws Exception{

	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 46336
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
const int MOD = (int)1e9 + 7;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()


int main(int argc, char const *argv[]) {
vector<int> v(5);
vector<int> v_mod(5);
int ans=0;
REP(i,5){
  cin>>v[i];
  v_mod[i]=10-v[i]%10;
  if(v_mod[i]==10){
    v_mod[i]=0;
  }
  ans+=v[i]+v_mod[i];
}
sort(ALL(v_mod));
int max=v_mod[4];
ans=ans-max;
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 256