akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int maxn=112345;
int n,x[maxn],l,q,f[maxn][20];
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i) scanf("%d",&x[i]);
    scanf("%d%d",&l,&q);
    for (int i=1;i<n;++i) {
        int t=upper_bound(x+1,x+1+n,x[i]+l)-x-1;
        f[i][0]=t;
    }
    f[n][0]=f[n+1][0]=n+1;
    for (int i=1;i<20;++i)
        for (int j=1;j<=n+1;++j)
            f[j][i]=f[f[j][i-1]][i-1];
    while (q--) {
        int a,b;scanf("%d%d",&a,&b);
        if (a>b) swap(a,b);
        int num=0;
        for (int i=19;i>=0;--i)
            if (f[a][i]<=b) {
                num+=1<<i;
                a=f[a][i];
            }
        printf("%d\n",num+(a!=b));
    }
    return 0;
}


Measured memory_bytes: 12052
#include <iostream>

using namespace std;

int main(void) {

	int H, W;
	while(true) {
		cin >> H >> W;
		if(H == 0 && W == 0)	break;

		for(int i=0;i<H;i++) {
			for(int j=0;j<W;j++) {
				if((i+j)%2 == 0) {
					cout << "#";
				} else {
					cout << ".";
				}
				// cout << "#";
			}
			cout << endl;
		}

		cout << endl;
	}

	return 0;
}

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

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

    string S;
    cin >> S;

    int answer = 1;
    char previousSlime = S[0];
    for (int i = 1; i < N; i++ ) {
       
        char currentSlime = S[i];

        if (currentSlime != previousSlime) {
           answer++;
        }

        previousSlime = currentSlime;

    }

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



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

int main(){
    int q;
    cin >> q;
    multiset<int> s;
    for(int i=0; i<q; i++){
        int a, x;
        cin >> a >> x;
        if(a == 0){
            s.insert(x);
            cout << s.size() << endl;
        }else if(a == 1){
            cout << s.count(x) << endl;
        }else if(a == 2){
            s.erase(x);
        }else{
            int y;
            cin >> y;
            auto first = s.lower_bound(x);
            auto last = s.upper_bound(y);
            for(auto itr = first; itr != last; ++itr) {
                cout << *itr << endl;
            }
        }
    }
    return 0;
}


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


int main() {
    vector<int> vec(3);
    for (int i = 0; i < 3; i++) cin >> vec.at(i);
    int k;
    cin >> k;
    sort(vec.begin(), vec.end());
    int sum = 0;
    for (int i = 0; i < 3; i++) {
        int num = vec.at(i);
        if (i == 2) {
            for (int j = 0; j < k; j++) {
                num *= 2;
            }
        }
        sum += num;
    }
    cout << sum << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppiii;

void solve() {
  int a, b;
  cin >> a >> b;
  if(b%a==0) cout << a+b << endl;
  else cout << b-a << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}


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

#define mod 1000000007
typedef long long ll;

ll fact[1006], inv[1006];
ll fp(ll base, ll exp)
{
    if (exp == 0)
        return 1;
    ll ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}
void calcFacAndInv(ll n)
{
    fact[0] = inv[0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        fact[i] = (i * fact[i - 1]) % mod;
        inv[i] = fp(fact[i], mod - 2);
    }
}

ll ncr(ll n, ll r)
{
    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}

int main()
{
    calcFacAndInv(110);
    ll even,odd;
    cin>>even>>odd;
    ll sum=0;
    if(even>=2)
        sum+=ncr(even,2);
    if(odd>=2)
        sum+=ncr(odd,2);

    cout <<sum<< endl;

        return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var b=new int[s[0]+1];
		for(int i = 0;i<s[1];i++) {
			var d=sc.I;
			var a=sc.Ia;
			for(int j = 0;j<d;j++) {
				b[a[j]]=1;
			}
		}
		Console.WriteLine("{0}",s[0]-b.Sum());
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

int main(){
  int x, y, t;

  while(1){
  cin >> x >> y;
  if (x==0 && y==0){
    break;
  }
  if (x > y){
    t = x;
    x = y;
    y = t;
  }
  cout << x << " " << y << "\n";
  }

  return 0;
}

Measured memory_bytes: 1160
import java.util.*;

public class Main {
	public static void main(String[] arg) {
		Scanner in = new Scanner(System.in);
		int A = in.nextInt();
		int B = in.nextInt();
		int C = in.nextInt();
		String result;

		if (A == B && A != C || A == C && A != B || B == C && A != B) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
X = int(input())
# S = input()
# X1_list = [int(input()) for i in range(N)]
# X2_list = [list(map(int,input().split())) for i in range(N)]

sho500 = X // 500
amari500 = X % 500
sho5 = amari500 // 5
amari5 = sho5 % 5

print(1000 * sho500 + 5 * sho5)

Measured memory_bytes: 2940
from collections import deque
import math
import sys

n,x,y = list(map(int,sys.stdin.readline().split()))
x -= 1
y -= 1
table=[0]*(n-1)
#print(table)

#i,jに関して全探索
for i in range(n):
    for j in range(i+1,n):
        #print(i,j, min(abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x)))
        table[min(abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x)) - 1] += 1

for ans in table:
    print(ans)


Measured memory_bytes: 3828
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

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

	int x;
	cin >> x;
	int t = x / 500;
	x %= 500;
	int s = x / 5;
	cout << 1000 * t + 5 * s << endl;
}


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

using namespace std;
int n, p, x;
long long cnk[2000][2000];
int a[2000], cnt[200];
int main() {
    ios_base::sync_with_stdio(0);
    cin >> n;
    cin >> p;
    cnk[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        cnk[i][0] = 1;
        for (int j = 1; j <= i; j++) cnk[i][j] = (cnk[i - 1][j - 1] + cnk[i - 1][j]);
    }
    for (int i = 1; i <= n; i++) {
        cin >> x;
        cnt[x % 2]++;
    }
    long long ans = 0;
    for (int t = 0; t <= cnt[0]; t++)
    for (int w = 0; w <= cnt[1]; w++) {
        if (w % 2 == p) ans += 1ll* cnk[cnt[0]][t] * cnk[cnt[1]][w];
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define deb(x) cout << #x << " --> " << x << endl;

#define deb1a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
        cout << it << " ";        \
    cout << endl;
#define deb2a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        for (auto it1 : it)       \
        {                         \
            cout << it1 << " ";   \
        }                         \
        cout << endl;             \
    }
#define deb3a(v) cout << #v << "-->" << endl; for(auto it:v){\
cout << it.fi << " " << it.se << endl;}


#define mod 1000000007
#define so(v) sort(v.begin(),v.end())
#define fi first
#define se second
//#define endl "\n"
int power(int x, unsigned int y, int p){ int res = 1;x = x % p;while (y > 0)  { if (y & 1)res = (res*x) % p;y = y>>1;  x = (x*x)% p;} return res;}
int mI(int a, int m)  {return power(a, m - 2, m);}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    int s = 0;
    fo(i,m){
        int x;
        cin>>x;
        s += x;
    }
    if(s>n)
        cout << -1;
        else
        {
            cout << n - s;
        }
        

}


Measured memory_bytes: 3664
"""#################################################################
【ABC117】
B_Polygon
#################################################################"""

#インポート
import sys

#入力用
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IS(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def SS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()

N = II()
lst = sorted(LI())
if lst[-1]< sum(lst[:-1]):
    print("Yes")
else:
    print("No")

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

using namespace std;
using ll = long long;

int main(void){
    string S;
    cin >> S;

    ll sum = 0;
    ll app = 0;
    int length = S.size();

    for(int i = 0; i < length; i++){
        if(S[i] == 'W'){
            sum += (i - app);
            app++;
        }
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main()
{
	int r,g,b;
	cin >> r >> g >> b;
	int a = r*100 + g*10 + b;
	if(a%4==0)
	{
		cout<<"YES"<<endl;
	}
	else
	{
		cout<<"NO"<<endl;
	}
	
	return 0;
}

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

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            int start = 1;
            int last = 99999;
            bool[] isPrime = new bool[last + 1];

            for (int i = start; i <= last; i += 2)
            {
                if (i == start) continue;

                bool prime = true;
                for (int j = 2; j <= Sqrt(i); j++)
                {
                    if (i % j == 0) prime = false;
                }
                for (int j = 2; j <= Sqrt(i); j++)
                {
                    if (((i + 1) / 2) % j == 0) prime = false;
                }
                isPrime[i] = prime;
            }

            long[] cum = new long[last + 2];
            for (int i = 0; i < last + 1; i++)
            {
                int cnt = 0;
                if (isPrime[i]) cnt = 1;
                cum[i + 1] = cum[i] + cnt;
            }

            var q = IO.RInt;
            for (int i = 0; i < q; i++)
            {
                var lr = IO.RSInt;
                WriteLine(cum[lr[1] + 1] - cum[lr[0]]);
            }
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

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

    string s;
    int t;
    cin >> s >> t;

    char cur = ' ';
    int cnt = 0;
    vector < pair<char, int> > vec;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == cur) {
            ++cnt;
        } else {
            if (cnt > 0) vec.push_back(make_pair(cur, cnt));
            cur = s[i]; cnt = 1;
        }
    }
    if (cnt > 0) vec.push_back(make_pair(cur, cnt));

    if (vec.size() == 1) {
        cout << 1LL * t * (int)s.size() / 2 << endl;
    } else {
        if (vec[0].first != vec.back().first) {
            long long res = 0;
            for (auto &e : vec) {
                res += e.second / 2;
            }
            cout << res * t << endl;
        } else {
            long long res = 0;
            for (int i = 1; i < (int)vec.size() - 1; ++i) {
                res += vec[i].second / 2;
            }
            res *= t;
            res += vec[0].second / 2;
            res += vec.back().second / 2;
            res += 1LL * (t - 1) * ((vec[0].second + vec.back().second) / 2);
            cout << res << endl;
        }
    }
}

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

int main() {
    const int MOD = 1e9 + 7;
    ll n, k;
    cin >> n >> k;

    ll ans = 0;
    for (int i = k; i < n + 2; i++) {
        ans = (ans + i * (n - i + 1) + 1) % MOD;
    }

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


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

int main(){
    int n; string s; cin >> n >> s;
    int ans = 1;
    rep(i,n-1){
        if(s[i] != s[i+1]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL n;
	cin >> n;

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

	LL ans = 0;

	LL ind = 1;
	while(ind >= 0){
		ind = -1;
		LL count = 0;
		for(int i = 0; i < n-1; i++){
			LL tc = 0;
			if(i > 0){
				if(vec[i] != -1 && vec[i] == vec[i-1]){
					tc++;
				}
			}

			if(vec[i] != -1 && vec[i] == vec[i+1]){
				tc++;
			}

			if(tc > count){
				count = tc;
				ind = i;
			}
		}
		if(ind >= 0){
			vec[ind] = -1;
			ans++;
		}
	}

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

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

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

int main()
{
    ll a,b;
    cin >> a >> b;
    if(a+b>=10)cout << "error" << endl;
    else cout << a+b << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MX=1e6+5;

ll ara[MX], csm[MX];

int main(){
     ll i, j, k;
     ll n;
     cin >> n;
     for(i=0; i<=n; ++i) cin >> ara[i];
     for(i=n; i>=0; --i) csm[i]=csm[i+1]+ara[i];
     ll cur=1, ans=1;
     for(i=0; i<=n; ++i){
          cur-=ara[i];
          if(cur<0){
               cout << -1 << endl;
               return 0;
          }
          cur*=2LL;
          cur=min(cur, csm[i+1]);
          ans+=cur;
     }
     cout << ans << endl;
     return 0;
}


Measured memory_bytes: 5132
def main():
    _ = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    prev = -100
    s = 0
    for a in A:
        s += B[a-1]
        if a - prev == 1:
            s += C[prev-1]
        prev = a

    print(s)


if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s,t;
    cin>>s>>t;
    int ans=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3852
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int k,x;
    cin >> k >> x;
    cout << ((500 * k >= x)?"Yes":"No") << endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int a, b, x;
  cin >> x >> a >> b;

  cout << (abs(a - x) < abs(b - x) ? 'A' : 'B') << endl;
  return 0;
}


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

int main() 
{
    int N;
    cin >> N;
    set<long long>st;
    
    for (int i = 0; i < N; i++) 
    {
        long long a;
        cin >> a;
        auto itr = st.find(a);
        if (itr != st.end()) {
            st.erase(a);
        }else{
            st.insert(a);
        }
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 8140
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define MOD (int)(1e9 + 7)

int main()
{
    int n;
    cin >> n;
    int counts[4] = {0};
    for (int q = 0; q < n; q++)
    {
        int a;
        cin >> a;
        counts[a]++;
    }
    double dp[n+1][n+1][n+1];
    for (int d = 0; d <= n; d++)
    {
        for (int c = 0; c + d <= n; c++)
        {
            for (int b = 0; b + c + d <= n; b++)
            {
                    dp[b][c][d]=0;
                    if (b == 0 && c == 0 && d == 0)
                    {
                        continue;
                    }
                    dp[b][c][d]+=(1.0*n)/(b+c+d);
                    //cout << dp[a][b][c][d] << " " << a << " " << b << " " << c << " " << d << endl;
                    if (d>0)
                    {
                        dp[b][c][d]+= (1.0*d)/(b+c+d)*dp[b][c+1][d-1];
                    }
                    if (c > 0)
                    {
                        dp[b][c][d]+=(1.0*c)/(b+c+d) * dp[b+1][c-1][d];
                    }
                    if (b > 0)
                    {
                        dp[b][c][d] += (1.0*b)/(b+c+d) * dp[b-1][c][d];
                    }
                    //cout << dp[a][b][c][d] << " " << a << " " << b << " " << c << " " << d << endl;
            }
        }
    }
    cout.precision(15);
    cout << dp[counts[1]][counts[2]][counts[3]];
    return 0;
}


Measured memory_bytes: 213248
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

class UnionFind {
public:
    vector<int> par, rank;
    int cnt;

    UnionFind(int n) : cnt(n) {
        par = vector<int>(n);
        iota(par.begin(), par.end(), 0);
        rank = vector<int>(n, 0);
    }

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

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (rank[x] < rank[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if (rank[x] == rank[y]) rank[x]++;
        }
        cnt--;
    }

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N,K,L;
  cin >> N >> K >> L;
  UnionFind uf1=UnionFind(N);
  UnionFind uf2=UnionFind(N);
  int p,q;
  for(int i=0;i<K;i++){
    cin >> p >> q;
    p--,q--;
    uf1.unite(p,q);
  }
  int r,s;
  for(int i=0;i<L;i++){
    cin >> r >> s;
    r--,s--;
    uf2.unite(r,s);
  }
  int root1[N];
  int root2[N];
  map<P,ll> mp;
  for(int i=0;i<N;i++){
    root1[i]=uf1.root(i);
    root2[i]=uf2.root(i);
    mp[{root1[i],root2[i]}]++;
  }

  for(int i=0;i<N;i++){
    cout << mp[{root1[i],root2[i]}];
    if(i!=N-1) cout << " ";
    else break;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 16640
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il ll ci(){
	register char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	register ll x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}
const int N = 1e5 + 10, M = 2e5 + 30;
int n, m;
struct edge {
    int y, nxt, id;
}e[M << 1];
int lin[M], len;
int dis[N], pos[N];
bool vis[N];
set<int> c[N];
 
inline int read() {
    int s = 0, f = 1;
    char ch;
    for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-')   f = -1;
    for(; ch >= '0' && ch <= '9'; ch = getchar())   s = (s << 1) + (s << 3) + ch - '0';
    return s * f;
}
 
inline void add(int xx, int yy, int vv) {
    e[++len] = (edge){yy, lin[xx], vv};
    lin[xx] = len;
}
 
inline void Dijkstra() {
    priority_queue< pair < int, int > > q;
    memset(dis, 0x3f, sizeof(dis));
    memset(vis, 0, sizeof(vis));
    dis[1] = 0;
    q.push(make_pair(0, 1));
    while(!q.empty()) {
        int x = q.top().second; q.pop();
        if(vis[x])  continue;
        vis[x] = 1;
        for(int i = lin[x]; i; i = e[i].nxt) {
            int y = e[i].y, v = c[x].count(e[i].id) ? 0 : 1;
            if(dis[y] > dis[x] + v) {
                dis[y] = dis[x] + v;
                q.push(make_pair(-dis[y], y));
                c[y].clear();
                c[y].insert(e[i].id);
            } else if(dis[y] == dis[x] + v) c[y].insert(e[i].id);
        }
    }
}
 
int main() {
    n = read(), m = read(); 
    if(m == 0) { puts("-1"); return 0; }
    for(int i = 1; i <= m; ++i) {
        int xx = read(), yy = read(), vv = read();
        add(xx, yy, vv);
        add(yy, xx, vv);
    }
    Dijkstra();
    printf("%d\n", dis[n] == 0x3f3f3f3f ? -1 : dis[n]);
    return 0;
}

Measured memory_bytes: 20984
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

int main(int argc, char const *argv[])
{
    int n;
    double x[100]={},y[100]={};
    double d1=0,d2=0,d3=0,dinf=0;

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

    for (int i = 0; i < n; ++i)
    {
        d1 += fabs(x[i]-y[i]);
        d2 += (x[i]-y[i])*(x[i]-y[i]);
        d3 += fabs((x[i]-y[i])*(x[i]-y[i])*(x[i]-y[i]));
        if(dinf < fabs(x[i]-y[i])) dinf = fabs(x[i]-y[i]);
    }
    d2 = sqrt(d2);
    d3 = pow(d3,(1.0/3));
    printf("%lf\n%lf\n%lf\n%lf\n", d1,d2,d3,dinf);

    return 0;
}

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

using namespace std;
#define REP(i,n) for(int i = 0;i < n;i++)
#define FT(i,a,b) for(int i=a;i <= b;i++)

typedef long long  ll;
typedef unsigned long long ull;
typedef vector<unsigned long long> ullv;
typedef vector<int> iv;
typedef vector<iv> ivv;



int main()
{
	int N;
	while(cin >> N && N != 0)
	{
		ivv v(N,iv(31,0));
		REP(i,N)
		{
			int n;
			cin >> n;
			REP(j,n)
			{
				int x; cin >> x;
				v[i][x]++;
			}
		}
		
		ullv w(N,0);
		REP(i,N)
		{
			w[i] = 1ULL<<i;
		}
		
		FT(d,1,30)
		{
			iv us(N,0);
			ull s = 0ULL;
			REP(i,N)
			{
				FT(j,i+1,N-1)
				{
					if(v[i][d] && v[j][d])
					{
						us[i] = us[j] = 1;
						s |= w[i] | w[j];
					}
				}
			}
			if(s == (1ULL<<N)-1)
			{
				cout << d << endl;
				goto NEXT;
			}
			for(int i = 0;i < N;i++)
			{
				if(us[i])
				{
					w[i] = s;
				}
			}
		}
		cout << -1 << endl;
		NEXT:
		;
		
	}
	
	return 0;
}

Measured memory_bytes: 3112
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(ReadLine());
            var input = ReadLine().Split(' ').Select(int.Parse);
            if (input.Count() != input.Distinct().Count())
            {
                WriteLine("NO");
            }
            else
            {
                WriteLine("YES");
            }
            
        }
    }
}

Measured memory_bytes: 33376
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, K] = [int(input_raw[0]), int(input_raw[1])]
    if (K == 1):
        print 0
    else:
        print (N - (K - 1)- 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2932
inputs = []
mi = 0
amari = 9
5.times do |i|
    input = gets.chomp.to_i
    mod = input % 10
    if amari > mod && mod != 0
        amari = mod
        mi = i
    end
    inputs << input
end
5.times do |i|
    x = inputs[i]
    unless x % 10 == 0 || mi == i
        x = x + 10 - (x%10)
    end
    inputs[i] = x
end
puts inputs.inject(:+)

Measured memory_bytes: 1916
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef list<ll> listl;
typedef string str;

#define min(A, B) min(static_cast<ll>(A), static_cast<ll>(B))

void In(ll& I)
{
	cin >> I;
}

void In(vl& I)
{
	for (auto& i : I)
	{
		cin >> i;
	}
}

void Out(ll& O)
{
	cout << O;
}

void Out(vl& O)
{
	for (auto& o : O)
	{
		cout << o;
	}
}

int main()
{
	ll N;
	In(N);

	ll K;
	In(K);

	str S;

	cin >> S;

	vl A(N);

	for (int i = 0; i < N; i++)A[i] = S[i] - '0';

	ll Max = 0;

	vl V;

	V.push_back(0);

	for (int i = 1; i < N; i++)
	{
		if (A[i] != A[i - 1])
		{
			V.push_back(i);
		}
	}

	ll Size = V.size();

	for (int i = 0; i < V.size(); i++)
	{
		ll a = i + 2 * K + 1;
		if (A[V[i]] == 0)a = i + 2 * K;
		ll n = (a >= Size ? N : V[a]) - V[i];
		if (n > Max)Max = n;
	}

	Out(Max);

	return 0;
}

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

using namespace std;

const int MOD=1e9+7;

//const int MOD=998244353;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int H,W,h,w;
    cin>>H>>W>>h>>w;
    
    vector<string> vs(H,string(W,'b'));
    for(int i=0; i<h; i++){
        for(int j=0; j<W; j++){
            vs[i][j]='w';
        }
    }
    for(int j=0; j<w; j++){
        for(int i=0; i<H; i++){
            vs[i][j]='w';
        }
    }
    int ans=0;
    for(auto s:vs){
        for(char c:s) ans+=c=='b';
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int counti=0;
int main()
{
	int n;
	cin>>n;
	int a[n+5];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]!=i)
			counti++;
	}
	if(counti>2)
		cout<<"NO";
	else
		cout<<"YES";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(void)
{
	using namespace std;
	char c;
	while(cin.get(c))
	{
		if(c >= 'a' && c <= 'z')
			cout << char(c - 32);
		else if(c >= 'A' && c <= 'Z')
			cout << char(c + 32);
		else
			cout << c;
	}
	return 0;
}


Measured memory_bytes: 3104
/*
AuThOr GaRyMr
技巧:
1.区别对待大数据&小数据！
2.Dp难推时算贡献！
3.long long (尤其乘法)！
4.long long INF 要大
5.Dp on trees: 换根法，每次清空当前的节点和换到的子节点
6.long double | 输出浮点数
7.注意特判!(prince and princess)
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int cnt[100000+10];
vector<int> v;
int a[100000+10]; 
int main(){
	int n;
	cin>>n;
	rb(i,1,n)
	{
		int ai;
		cin>>ai;
		v.PB(ai);
		a[i]=ai;
		cnt[ai]++;
	}
	if(a[1]!=0){
		cout<<0<<endl;
		return 0;
	}
	sort(ALL(v));
	int OK=1;
	rb(i,1,v.size()-1){
		if(v[i]==v[i-1]||v[i]==v[i-1]+1);
		else OK=0;
	}
	LL res=0;
	const int MOD=998244353;
	if(v[0]==0&&OK){
		int maxi=v[v.size()-1];
		if(v.size()==1) res=1;
		if(v.size()>=2&&cnt[0]==1)
		{
			res=1;
			 rb(i,1,n){
			 	if(a[i]){
			 		
			 		res*=cnt[a[i]-1],res%=MOD;
			 	}
			 		
			 }
		} 
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 1532
import Data.List

main = do 
  (a:b:c:xs) <- map read . words <$> getLine
  d <- read <$> getLine
  putStrLn . show $ solve a b c d

solve a b c d = 
  let (t:s:f:xs) = sort [a,b,c]
  in t + s + f * (2^d)


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long ll;
ll mod_pow(ll, ll, ll);
ll mod_fact(ll, ll);
ll mod_inv(ll, ll);
//
int main(){
    int k, s;
    cin >> k >> s;
    int ans = 0;
    for(int i = 0; i <= k; i++){
        for(int j = 0; j <= k; j++){
            int a = s - (i + j);
            if(a >= 0 && a <= k) ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
int a, b;
int main() {
	cin >> a >> b;
	int cnt = 0;
	for (int i = a; i <= b; ++i) {
		int tmp = (i % 10) * 10000 + ((i / 10) % 10) * 1000 + ((i / 100) % 10) * 100 + ((i / 1000) % 10) * 10 + (i / 10000) % 10;
		if (i == tmp) cnt++;
	}
	cout << cnt << endl;
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  int A[N];
  int x[N][N];
  int y[N][N];
  rep(i,N){cin >> A[i];
    rep(j,A[i]) cin >> x[i][j] >> y[i][j];
  }
  
  int ans = 0;
  //bit全探索　それぞれの人が正直者か不誠実の全パターン2^N通りについて、正直者の発言が矛盾していないか調べる
  for(int bit = 0;bit<(1<<N);bit++){
    bool ok = true;
    for(int i = 0;i < N; i++){
      if((bit&(1<<i))){ //正直者iの発言のみチェック
        for(int j = 0;j < A[i];j++){ //正直者iのj番目の発言、人x[i][j]はy[i][j]であるをチェック          
         if(!(bit&(1<<(x[i][j]-1)))&&y[i][j]==1) ok = false;
         else if( bit& (1<<(x[i][j]-1)) && y[i][j]==0)ok = false; //正直者i発言が矛盾しているとき、フラグをfalseにする                      
          }
        }
      }
    if(ok) ans = max(ans,__builtin_popcount(bit));
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
S=input()
N=len(S)
INF=1e9+7
dp=[[0]*4 for _ in range(N+1)]
dp[0][0]=1
for i in range(N):
    if S[i]=="?":
        for j in range(4):
            dp[i+1][j]+=dp[i][j]*3%INF
    else:
        for j in range(4):
            dp[i+1][j]+=dp[i][j]%INF
    if S[i]=="A" or S[i]=="?":
        dp[i+1][1]+=dp[i][0]%INF
    if S[i]=="B" or S[i]=="?":
        dp[i+1][2]+=dp[i][1]%INF
    if S[i]=="C" or S[i]=="?":
        dp[i+1][3]+=dp[i][2]%INF
print(int(dp[N][3]%INF))


Measured memory_bytes: 66412
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n,ans;
 
int main(){
    cin>>n;
    for(ll i=2;i*i<=n;i++){
        int cnt=0;
        while(n%i==0){
            n/=i;
            cnt++;
        }
        int x=1;
        while(cnt>=x){
            ans++;
            cnt-=x;
            x++;
        }
    }
    if(n>1)ans++;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}

main()
{
    int N,i,Alice=0,Bob=0;
	scanf("%d",&N);
	int a[N];
	
	for(i=0;i<N;i++){
		scanf("%d",&a[i]);
	}
	
	qsort(a,N,sizeof(int),compare_int);
	
	for(i=0;i<N;i++){
		if(i%2==0){
			Alice+=a[i];
		} else {
			Bob+=a[i];
		}
	}
	
	printf("%d",Alice-Bob);
	return 0;
	
}

Measured memory_bytes: 128
<?php
list($k, $n) = explode(' ', trim(fgets(STDIN)));
$a_a = explode(' ', trim(fgets(STDIN)));

$sum = 0;
$max = 0;

for($i = 1; $i < count($a_a); $i++){
	$tmp = $a_a[$i] - $a_a[$i - 1];
	if($tmp > $max){
		$max = $tmp;
	}
	$sum += $tmp;
}

$tmp = $a_a[0] + $k - $a_a[count($a_a) - 1];
if($tmp > $max){
	$max = $tmp;
}
$sum += $tmp;

echo $sum - $max;
?>


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

int main()
{
    int n, i, j, k, a;
    map<int, int>mapp;
    cin>>n;
    for(i = 1; i <= n; i++)
    {
        cin>>a;
        mapp[a] = i;
    }
    for(i = 1; i <= n; i++)
        cout<<mapp[i]<<" ";
    return 0;
}


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

int main(){

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

    sort(a, a+n, greater<int>());

    int cnt=0;
    while(true){
        alice += a[cnt++];
        if(cnt==n) break;
        bob += a[cnt++];
        if(cnt==n) break;
    }
    cout << (alice - bob) << endl;
}

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

#define int long long
#define pb push_back 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for( int i = 0; i < (n); i++ )
#define Rrep(i, a, n) for( int i = (a); i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; 
typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

signed main()
{
  int N;
  int a[100001];

  cin >> N;
  Rep(i, N) cin >> a[i];

  int mi = INF, ma = -1;
  set<int> all;
  Rep(i, N) {
    mi = min(mi, a[i]);
    ma = max(ma, a[i]);
    all.insert(a[i]);
  }

  if( all.size() > 2 ) cout << "No" << endl;
  else if( mi == ma ) {
    if( N >= mi * 2 || N - 1 == mi ) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else {
    int mi_cnt = 0, ma_cnt = 0;
    Rep(i, N) {
      if( a[i] == mi ) mi_cnt++;
      else ma_cnt++;
    }

    int flag = false;
    int cnt;
    if( ma_cnt == 1 ) cnt = 0;
    else cnt = 1;

    if( mi == mi_cnt - 1 + 1 && ma == mi_cnt + cnt ) flag = true; // maがすべて同じ場合
    if( mi == mi_cnt - 1 + ma_cnt && ma == ma_cnt - 1 + mi_cnt ) flag = true;
    for(int i=2; i <= ma_cnt / 2; i++) {
      if( mi == mi_cnt - 1 + i && ma == i + mi_cnt ) flag = true;
    }

    if( flag ) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  
}


Measured memory_bytes: 5760
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N, M, Q := getInt(), getInt(), getInt()
	n := make([][]int, N+1)
	for i := 0; i <= N; i++ {
		n[i] = make([]int, N+1)
	}
	for i := 0; i < M; i++ {
		l, r := getInt(), getInt()
		n[l][r]++
	}
	// for i := 0; i <= N; i++ {
	// 	out(n[i])
	// }
	// out("----")
	for i := 1; i <= N; i++ {
		for j := i + 1; j <= N; j++ {
			n[i][j] += n[i][j-1]
		}
	}
	// for i := 0; i <= N; i++ {
	// 	out(n[i])
	// }
	for i := 0; i < Q; i++ {
		p, q := getInt(), getInt()
		ans := 0
		// out("pq", p, q)
		for j := p; j <= q; j++ {
			// out(j, j, n[j][p-1], n[j][q])
			ans += n[j][q] - n[j][p-1]
		}
		// out("-----", ans)
		out(ans)
	}
}


Measured memory_bytes: 6016
fn main() {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());
    loop {
        let r0: usize = sc.read();
        let w0: usize = sc.read();
        let c: usize = sc.read();
        let r: usize = sc.read();
        if r0 == 0 { break; }
        for i in 0..10000000 {
            // (r0 + r * i) / w0 >= c
            if (r0 + r * i) >= c * w0 {
                println!("{}", i);
                break;
            }
        }
    }
}

pub struct Scanner<R> {
    reader: R,
}

impl<R> Scanner<R> {
    pub fn new(reader: R) -> Scanner<R> {
        Scanner { reader }
    }
}

fn is_whitespace(b: u8) -> bool {
    b == b' ' || b == b'\n' || b == b'\r' || b == b'\t'
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        let buf = std::io::Read::bytes(self.reader.by_ref())
            .map(|b| b.expect("Read failed"))
            .skip_while(|&b| is_whitespace(b))
            .take_while(|&b| !is_whitespace(b))
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error")
    }

    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}



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

using namespace std;
 //not understood --do again 

int main()
{
    int n ,m;
    cin >> n >> m;
    vector<int> vec1;
    while(n-- >0)
    {
        int i;
        cin >> i;
        vec1.push_back(i);
    }
    int sum=0;
    for(size_t i=0;i<vec1.size();i++)
    {
        sum=sum+vec1[i];
    }
    int count=0;
    int rp =4*m;
    for(size_t i=0;i<vec1.size();i++)
    {
        if(vec1[i] * rp >=sum)
        {
            ++count;
        }
    }   
    if(count>=m)
    {
        cout <<"Yes"<<endl;
    }
    else {
        cout <<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import re

N = int(input())
A = [a for a in map(int,input().split())]

result = []

for a in A:
    m = re.search(r'0+$',bin(a))
    if m==None:
        result.append(0)
        break
    else:
        result.append(len(str(m.group())))

print(min(result))

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

int dp[11111],n,w,a[222],sum,ans;

int main(){
  cin>>n>>w;
  r(i,n)cin>>a[i];
  sort(a,a+n);

  r(i,n){
    
    memset(dp,0,sizeof(dp));
    if(sum>w)break;
    dp[sum]=1;
    
    for(int j=i+1;j<n;j++){
      for(int k=w;k-a[j]>=sum;k--){
	(dp[k]+=dp[k-a[j]])%=1000000007;
      }
    }

    for(int j=sum;j<=w;j++){
      if(j+a[i]>w){
	(ans+=dp[j])%=1000000007;
      }
    }
    sum+=a[i];
  }

  if(sum<=w)ans++;

  cout<<ans<<endl;
}



Measured memory_bytes: 3188
#!/usr/bin/env python
# coding: utf-8

N = int(input())
h = list(map(int, input().split()))

DP = [0, abs(h[0]-h[1])]
for i in range(N-2):
    DP += [min(DP[-2] + abs(h[i]-h[i+2]), DP[-1] + abs(h[i+1]-h[i+2]))]

print(DP[-1])

#dp = {}
#NOT_FOUND = pow(10, 4) + 1
#
#def sget(i):
#    if i in dp:
#        return dp[i]
#    return NOT_FOUND
#
#def chmin(a, b):
#    if (a > b):
#        return b
#    return a
#
#def main(N, hs):
#    dp[0] = 0
#    #for i in range(1, N):
#    #    dp[i] = chmin(sget(i), sget(i - 1) + abs(hs[i] - hs[i - 1]))
#    #    if i > 1:
#    #        dp[i] = chmin(sget(i), sget(i - 2) + abs(hs[i] - hs[i - 2]))
#    #def rec(i):
#    #    if sget(i) < NOT_FOUND:
#    #        return sget(i)
#    #    if i == 0:
#    #        return 0
#    #    res = NOT_FOUND
#    #    res = chmin(res, rec(i-1) + abs(hs[i] - hs[i-1]))
#    #    if (i > 1):
#    #        res = chmin(res, rec(i-2) + abs(hs[i] - hs[i-2]))
#    #    dp[i] = res
#    #    return dp[i]
#    #return rec(N-1)
#    return dp[N-1]
#
#
#if __name__ == '__main__':
#    #N = 4
#    #hs = [10, 30, 40, 20]
#    #N = 2
#    #hs = [10, 10]
#    #N = 6
#    #hs = [30, 10, 60, 10, 60, 50]
#    #N = 2
#    #hs = [1, 3, 2, 1]
#    N = int(input())
#    hs = list(map(int, input().split()))
#    print(main(N, hs))


Measured memory_bytes: 13980
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))

max_s = sum(p[0:K])
s = sum(p[0:K])
for i in range(N-K):
    f = p[K+i]
    b = p[i]
    ns = s + f - b
    if ns >= max_s:
        max_s = ns
    s = ns
    # print(s)

print((K+max_s)/2)

Measured memory_bytes: 25060
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)
        {
            var input = Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);
            var c = int.Parse(input[2]);

            if (b - a == c - b)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> ii;
typedef tuple<int,int,int> iii;
#define ll long long
#define iiMPQ priority_queue<ii,vector<ii>,greater<ii> >
#define MPQ priority_queue<int,vector<int>,greater<int> >
#define PQ priority_queue<int>
#define iiPQ priority_queue<ii>
#define US unordered_set<int>
#define UMS unordered_multiset<int>
#define UM unordered_map<int>
#define iiUS unordered_set<ii>
#define ST stack<int>
#define MS multiset<int>
#define scan1(n) cin>>n
#define scan2(a,b) cin>>a>>b
#define scan3(a,b,c) cin>>a>>b>>c
#define print(n) cout<<n
#define println(n) cout<<n<<"\n"
#define vi vector<int>
#define vii vector<ii>
#define viii vector<iii>
#define fi first
#define se second
#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,s,e) for(int i=s;i<e;++i)
#define REPS(i,s,e,st) for(int i=s;i<e;i+=st)
#define rep(i,n) for(int i=n-1;i>=0;--i)
#define repr(i,s,e) for(int i=s;i>=e;--i)
#define reps(i,s,e,st) for(int i=s;i>=e;i-=st)
#define SET(arr,k) memset(arr,k,sizeof arr)
#define speed ios::sync_with_stdio(0); cin.tie(0);
#define mp make_pair
#define pb push_back
#define Qu queue
#define Vt vector
#define Dq deque
#define prints(n) cout << n << " ";


void m1(){
  int n,d; cin >> n >> d;
 	int x, y, cnt = 0;
  for(int i=0;i<n;++i){
  	cin >> x >> y;
    if(x*x + y*y <= d*d) ++cnt;
  }
  cout << cnt;
}
/* 
void m2(){
  int t; scan1(t);
  while(t--) m1();
}
*/
 
signed main(){
  speed;
  //freopen("in.txt","r",stdin);
  m1();
  //m2();
}

Measured memory_bytes: 3644