akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;


public class Main {
  private static class Tuple {
    public final int a;
    public final long b;
    public Tuple(int a, long b) {
      this.a = a;
      this.b = b;
    }
  }
  public static void main(String[] args) throws Throwable {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    long K = scanner.nextLong();
    Tuple[] ab = new Tuple[N];
    for (int i = 0; i < N; i++) {
      int a = scanner.nextInt();
      long b = scanner.nextLong();
      ab[i] = new Tuple(a, b);
    }
    Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a));

    Integer lastA = null;
    long k = 0;
    for (int i = 0; k < K && i < N; i++) {
      k += ab[i].b;
      lastA = ab[i].a;
    }

    System.out.println(lastA);
  }
}

Measured memory_bytes: 90812
#include<bits/stdc++.h>
using namespace std;
void pre(){}
void solve(){
    long long int n;cin>>n;
    long double arr[n];
    for(long long int i=0;i<n;i++){
        cin>>arr[i];
    }
    long double dp[n+1][n+1];
    for(long long int i=0;i<=n;i++){
        for(long long int j=0;j<=n;j++){
            dp[i][j]=0.0;
        }
    }
    dp[0][0]=1.0;
    for(long long int i=1;i<=n;i++){
        for(long long int j=0;j<i;j++){
            dp[i][j]+=dp[i-1][j]*(1-arr[i-1]);
            dp[i][j+1]+=dp[i-1][j]*(arr[i-1]);
        }
    }
    long double ans = 0.0;
    for(long long int j = n;j>n-j;j--){
        ans+=dp[n][j];
    }
    cout<<setprecision(15)<<ans<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    pre();
    long long int num = 1;
    //cin>>num;
    for(long long int i=0;i<num;i++){
       	solve();
    }   
}


Measured memory_bytes: 140928
#include<stdio.h>

int main()
{
	char s[100002]={};
	int i,sta=0,c=0;
	
	fgets(s,sizeof(s),stdin);
	
	for(i=0;s[i]!=0;i++){
		if(sta==0){
			if(s[i]=='B')sta=1;
			if(s[i]=='W')sta=2;
		}else if(sta==1){
			if(s[i]=='W'){
				sta = 2;
				c++;
			}
		}else if(sta==2){
			if(s[i]=='B'){
				sta = 1;
				c++;
			}
		}
	}
	printf("%d\n",c);
	
	return 0;
	
	
}

Measured memory_bytes: 384
#include<stdio.h>
int main(void){
    int m, n, l, i, j, k;
    scanf("%d %d %d", &n, &m, &l);//????????????????¨?//
    int a[n][m], b[m][l];
    long c[n][l];
    for(i=0 ; i<n; i++){
        for(j=0 ; j<m;j++){
            scanf("%d", &a[i][j]);
        }
    }
    for(i=0 ; i<m; i++){
        for(j=0 ; j<l;j++){
            scanf("%d", &b[i][j]);
        }
    }
    for(i=0 ;i<n ;i++){
        
        for(j=0; j<l; j++){
            
            c[i][j] = 0;
            
        }
        
    }
    for(i=0; i<n; i++ ){
        for(k=0 ;k<l ;k++){
            for(j=0 ;j<m ;j++){
                c[i][k] += a[i][j] * b[j][k];
            }
        }
    }
    for(k=0 ; k<n ;k++ ){
        for(j=0 ;j<l ;j++){
            printf("%ld", c[k][j]);
            if(j == l-1){
                printf("\n");
            }else printf(" ");
        }
    }
    return 0;
}

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

int main(){
  int N,M,X,Y;
  cin >> N >> M >> X >> Y;
  vector<int> x(N);
  vector<int> y(M);
  for(int i = 0;i < N;i++){
    cin >> x.at(i);
  }
  for(int i = 0;i < M;i++){
    cin >> y.at(i);
  }
  
  int ok = 0;
  int Z;
  for(Z = X + 1;Z <= Y;Z++){
    int a = 0;
    int b = 0;
    for(int j = 0;j < N;j++){
      if(x.at(j) < Z){
        a++;
      }
    }
    for(int j = 0;j < M;j++){
      if(y.at(j) >= Z){
        b++;
      }
    }
    if(a == N && b == M){
      ok = 1;
      break;
    }
  }
  if(ok == 0){
    cout << "War" << endl;
  }else if(ok == 1){
    cout << "No War" << endl;
  }
}

Measured memory_bytes: 256
import collections

def main():
    N = int(input())
    S = list(input())
    Scount = collections.Counter(S)
    Wcount = Scount['W']
    Ecount = Scount['E']

    if S[0] == "W":
        Wcount -= 1
    else:
        Ecount -= 1
    ans = Ecount
    L = [0, 0]; R = [Wcount, Ecount]
    for i in range(N-1):
        sl = S[i]
        s = S[i+1]
        if sl == 'W':
            L[0] += 1
        else:
            L[1] += 1
        if s == 'W':
            R[0] -= 1
        else:
            R[1] -= 1
        cnt = L[0] + R[1]
        ans = min(ans, cnt)
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 11756
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,k;cin>>n>>k;
  vi A(n);
  for(auto &a:A)cin>>a;
  sort(ALL(A));
  ll ans = 0;
  for(int i=0;i<n;i++){
    if(i == n-1){
      if(k == A[i])ans++;
    }else{
      if(k >= A[i]){
	k -= A[i];
	ans++;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
  string A,B;
  cin >> A >> B;
  int a=0;
  int C;
  C = A.size();
  for (int i=0; i < C; i++) {
    if (A.at(i) != B.at(i)) {
      a++;
      break;
    }
  }
  if (a == 1) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}
    
    

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

int n,a[200069],i;

int main() {
  cin>>n;
  for(i=0;i<n;i++)
  cin>>a[i];
  sort(a,a+n);
  for(i=0;i<n-1;i++)
  if(a[i]==a[i+1]){
  cout<<"NO"; return 0;}
  cout<<"YES";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7
// https://atcoder.jp/contests/agc032/tasks/agc032_b
int main() {
    int n; cin >> n;

    // if (n == 3) {
    //     cout << 2 << endl;
    //     cout << 1 << " " << 3 << endl;
    //     cout << 2 << " " << 3 << endl;
    //     return
    // }

    ll edge;
    if (n % 2 == 0) edge = n * (n - 2) / 2;
    else edge = (n - 1) * (n - 1) / 2;
    cout << edge << endl;

    int m = (n % 2 == 0) ? n : n - 1;
    for (int from = 1; from < m; from++)
    {
        for (int to = from + 1; to <= m; to++)
        {
            if (to != m - from + 1) {
                cout << from << " " << to << endl;
            }
        }
    }

    if (n % 2 == 1) {
        for (int to = 1; to < n; to++)
        {
            cout << n << " " << to << endl;
        }
    }
}


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

int main() {
  long a,b,c,d,e,f,g;
  cin >> a >> b >> c >> d >> e >> f >> g;
  long suma=0,sumb;
  if(a>0 && d>0 && e>0)suma=((a-1)/2)*2+b+((d-1)/2)*2+((e-1)/2)*2+3;
  sumb=(a/2)*2+b+(d/2)*2+(e/2)*2;
  cout << max(suma,sumb);
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  string s; cin >> s;
  if(s == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;

}


Measured memory_bytes: 3596
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

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

    int n,k;cin>>n>>k;
    map<int,int> mp;
    set<int> st;
    for(int i=0;i<n;i++){
        int a;cin>>a;
        mp[a]++;
        st.insert(a);
    }
    vector<int> num;
    for(auto itr=st.begin();itr!=st.end();itr++){
        int a = *itr;
        num.push_back(mp[a]);
    }
    sort(num.begin(),num.end());
    if((int)num.size()<=k){
        cout<<0<<endl;
        return 0;;
    }
    int res=0;
    for(int i=0;i<(int)num.size()-k;i++){
        res+=num[i];
    }
    cout<<res<<endl;
}


Measured memory_bytes: 20216
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] l = new int[2*n];
		
		for(int i = 0; i < l.length; i++) {
			l[i] = sc.nextInt();
		}
		
		sc.close();
		
		Arrays.sort(l);
		
		int ans = 0;
		for(int i = 0; i < l.length; i += 2) {
			ans += Math.min(l[i], l[i+1]);
		}
		
		System.out.println(ans);
	}
	
}

Measured memory_bytes: 10064
# -*- coding: utf-8 -*-
"""
Created on Sat May  2 14:48:19 2020

@author: ab
"""
# import math
import sys
# import os

def isDivisible(num1,num2):
    return num1%num2 == 0

def search(n,m,k):
    if isDivisible(n,k) | isDivisible(m,k):
        return True
    elif abs(n-m) <=1:
        return False
    for i in range(n,m):
        if isDivisible(i, k):
            return True
    return False
    
def solution(k,n,m):
    if k == 1:
        return True
    elif isDivisible(n,k) | isDivisible(m,k):
        return True
    elif abs(n-m) <=1:
        return False
    elif k>m:
        return False
    else:
        return search(n,m,k)



input = sys.stdin
output = sys.stdout
while True:
    lineElements = input.readline().rstrip("/n").split(" ")
    if(lineElements[0] == ''):
        break;
    if len(lineElements) == 1:
        k = int(lineElements[0])
    else:
        n,m = lineElements
        n,m = int(n),int(m)
        if solution(k,n,m) == True:
            print("OK\n")
        else:
            print("NG\n")
# output.flush()

Measured memory_bytes: 9184
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
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)
typedef long long ll;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main () {

    int n; cin >>n;
    vector<int> a(n+2); 
    int res = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i+1];
        res += abs(a[i+1] - a[i]);
    }
    res += abs(a[n+1] - a[n]);

    for (int i = 1; i <= n; i++) {
        int ans = res;
        ans += abs(a[i+1] - a[i-1]);
        ans -= abs(a[i+1] - a[i]);
        ans -= abs(a[i-1] - a[i]);
        cout << ans << endl;
    }

    return 0;
}



Measured memory_bytes: 2168
n = int(input())
a = list(map(int, input().split()))

tmp = [0] * n
tmp2 = [0] * n
for i, j in enumerate(a):
    if i + j < n:
        tmp[i + j] += 1
    if 0 <= i - j:
        tmp2[i - j] += 1

cnt = 0
for i in range(n):
    cnt += tmp[i] * tmp2[i]
print(cnt)

Measured memory_bytes: 32156
input_data = input().split(" ")
N = int(input_data[0])
D = int(input_data[1])
p_data = [list(map(lambda x:int(x),input().split(" "))) for i in range(N)]
distance = []

for n in range(N):
  for t in range(n,N):
    if n == t:
      pass
    else:
      tes = list(map(lambda x,y:(x-y)**2,p_data[n],p_data[t]))
      dis = (sum(tes)**0.5).is_integer()
      distance.append(dis)

print(sum(distance))

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  llvec a(N);
  rep(i, N)cin >> a[i];
  ll m=a[0];
  ll cnt=0;
  rep(i, N){
    if(m>a[i]){
      cnt += m-a[i];
      a[i]=m;
    }
    m = a[i];
  }
  cout << cnt;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n, m,k,s,cnt=0,lampcnt=0,ans=0;
	cin >> n >> m;
	vector<vector<int>>lamp(m, vector<int>(n,0));
	vector<int>lampm(m);
	vector<int>si(n, 0), sii(n, 0);
	rep(i, m) {
		cin >> k;
		rep(j, k) {
			cin >> s;
			lamp[i][--s] = 1;
		}
	}
	rep(i,m)cin >> lampm[i];

	for (int bit = 0; bit < (1 << n); bit++) {
		si = sii;
		rep(i,n){
			if (bit & (1 << (n - 1)) >> i) {
				si[i] = 1;
			}
		}
		lampcnt = 0;
		rep(i, m) {
			cnt = 0;
			rep(j, n) {
				if (si[j] ==1 &&lamp[i][j] == 1)cnt++;
			}
			if (cnt % 2 == lampm[i])lampcnt++;
		}
		if (lampcnt == m)ans++;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3636
////////////////いろいろあるよ//////////////////////////////////
//include,namespace
 #include<bits/stdc++.h>
 #include<iostream>
 #include<bitset>
 using namespace std;
//REPmacro
 #define all(x) (x).begin(),(x).end()             //ソート
 #define FOR(i,x,n)for(int i=(x);i<(n);i++)
 #define FOR_R(i,x,n) for(int i=(n-1);i>=(x);i--)
 #define REP(i, n) FOR(i, 0, n)
 #define REP_R(i, n) FOR_R(i, 0, n)
//long long(define)
 using ll = long long;
 typedef long long ll;
 typedef long long int64;
 typedef long long lint;
 typedef long long lli;
////////////////いろいろあるよ//////////////////////////////////

int main(){
	int a,b;
	cin >>a >>b;
	int sum=0;
	REP(i,b){
		int piyo = 0;
		cin >>piyo;
		sum+=piyo;
	}
	if(sum>=a)cout << "Yes" << endl;
	else cout <<"No"<<endl;
    
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("sse,sse2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set = tree <T, null_type ,  less<T> ,  rb_tree_tag ,  tree_order_statistics_node_update>;

template<class T>
using ordered_multiset = tree <T, null_type ,  less_equal<T> ,  rb_tree_tag ,  tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vvii = vector<vii>;

#define all(x) x.begin(), x.end()
#define all_r(x) x.rbegin(), x.rend()
#define pb push_back
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, n) for(int i = n; i >= 0; --i)
#define f first
#define s second

int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n, k;
	cin >> n >> k;
	vi p(n);
	FOR(i, n) cin >> p[i];
	sort(all(p));
	int ans = 0;
	FOR(i, k) ans += p[i];
	cout << ans << '\n';
 	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const ll MOD = 1e16;

ll a[5005], dp[5005] = { 0 };
 
int main() {
	ll N, K;
	cin >> N >> K;
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
		a[i] = min(K, a[i]);
	}
	dp[0] = 1;
	for (int i = 0; i < N; ++i) {
		for (int j = K - a[i] - 1; j >= 0; --j) {
          dp[j + a[i]] += dp[j];
          dp[j + a[i]] %= MOD;
        }
	}
  for (int j = 0; j < K; ++j) assert(dp[j] >= 0);
	ll ans = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < K - a[i]; ++j) {
          dp[j + a[i]] -= dp[j];
          dp[j + a[i]] = (dp[j + a[i]] + MOD) % MOD;
        }
      	//for (int j = 0; j < K; ++j) assert(dp[j] >= 0);
		ll cnt = 0;
		for (int j = K - a[i]; j < K; ++j) {
          cnt += dp[j];
          cnt %= MOD;
        }
		if (cnt == 0) ++ans;
		for (int j = K - a[i] - 1; j >= 0; --j) {
          dp[j + a[i]] += dp[j];
          dp[j + a[i]] %= MOD;
        }
	}
	cout << ans << '\n';
}


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

typedef long long ll;
const ll maxn=1e10;
const ll maxm=1e5;

vector<ll>vec;
void init(){
    vec.clear();
    for(ll i=1;i<maxm;i++){
        ll temp=i*i;
        vec.push_back(temp);
    }
}

int main(int argc, char const *argv[])
{
    init();
    ll n;
    while(cin>>n){
        int p=lower_bound(vec.begin(),vec.end(),n)-vec.begin();
        while(vec[p]>n) p--;
        printf("%lld\n",vec[p]);
    }
    return 0;
}

Measured memory_bytes: 1400
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;

int main(){
  string a,b;
  cin >> a >> b;
  int sum = stoi(a+b);
  for(int i=1; i<=317; i++){
    if(sqrt(sum) == i){
      cout << "Yes" << endl;
      return 0;
    }
  }cout << "No" << endl;
}

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  if(s[0] == s[1]){
    if(s[2] == s[3] && s[2] != s[0]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else if(s[0] == s[2]){
    if(s[1]==s[3] && s[1] != s[0]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else if(s[0] == s[3]){
    if(s[1]==s[2] && s[1] != s[0]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else cout << "No" << endl;

  return 0;
    

}


Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
	String s = sc.next();
	if(s.equals("A")) System.out.println("T");
	if(s.equals("T")) System.out.println("A");
	if(s.equals("C")) System.out.println("G");
	if(s.equals("G")) System.out.println("C");

    }
}

Measured memory_bytes: 21972
import java.util.*;

class Main {
    public static HashSet<Integer> hs = new HashSet<>();
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            int count = 0;
            int n = in.nextInt();
            int a[] = new int[n];
            int b[] = new int[n];
            for(int i = 0; i < n; i++) {
                a[i] = i+1;
                b[i] = n-i;
            }
            sieveOfEratosthenes(n);
            for(int i = 0; i < n; i++)
                if(hs.contains(a[i]) && hs.contains(b[i]))
                    count++;
            System.out.println(count);
        }
    }
    static void sieveOfEratosthenes(int n) {
        long prime[] = new long[n + 1];

        for (int p = 2; p * p <= n; p++)
            if (prime[p] == 0)
                for (int i = p * 2; i <= n; i += p)
                    prime[i] = 1;

        for (int i = 2; i <= n; i++)
            if (prime[i] == 0)
                hs.add(i);
    }
}

Measured memory_bytes: 64376
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(10);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
    ll K;
    cin >> K;
    cout << 50 << endl;
    FOR(i,0,50){
        if(i < K%50)cout << K/50+50-i << " \n"[i == 50-1];
        else cout << K/50+49-i << " \n"[i == 50-1];
    }
}



Measured memory_bytes: 256
//皆さん、第9回シンデレラガール総選挙は、トップでオンリーワンを目指す城ヶ崎美嘉に
//そしてボイスアイドルオーディションは、プログラミングが趣味の才女大石泉に、ぜひ投票をお願いします！
//#城ヶ崎美嘉を009のシンデレラに
//#大石泉の必勝プログラム
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(lint i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	lint n,k,out=0,mo=1000000007;cin>>n>>k;n++;
	REP(i,k,n+1){
		lint ma=(n-1)*i-i*(i-1)/2,mi=i*(i-1)/2;
		//cout<<i<<' '<<ma-mi+1<<endl;
		out+=ma-mi+1;
		out%=mo;
	}
	cout<<out<<endl;
}


Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0030
{
	class Program
	{
		static void Main(string[] args)
		{
			while( true ) {
				var	str	= Console.ReadLine().Split();
				var	n	= int.Parse( str[ 0 ] );
				var	s	= int.Parse( str[ 1 ] );
				if( (n == 0) && (s == 0) ) {
					break;
				}

				var	num	= new int[ n ];
				for( int i = 0; i < n; i++ ) {
					num[ i ]	= i;
				}
				
				int	cnt	=	0; 
				while( num[ 0 ] <= 10 - n ) {
					if( num.Sum() == s ) {
						cnt++;
					}
					for( int i = n - 1; i >= 0; i-- ) {
						num[ i ]++;
						if( num[ i ] <= 10 - (n - i) ) {
							for( int j = i + 1; j < n; j++ ) {
								num[ j ]	= num[ j - 1 ] + 1;
							}
							break;
						}
					}
				}
				Console.WriteLine( cnt );
			}
		}
	}
}

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

int main()
{
	int i;

	char moji;

	cin >> moji;

	if ((moji >= 'a') && (moji <= 'z'))
		cout << 'a' << endl;

	if ((moji >= 'A') && (moji <= 'Z'))
		cout << 'A' << endl;

	return 0;
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;

    int count =0;
    if(S.size()%2 == 1){
        cout << "No" << endl;
    }
    else {
        for(int i=0; i<S.size()/2; i++){
            if(S.at(i) != S.at(i+S.size()/2)){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        
    }
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,l,r,mid;
char s[10],first;
int main(){
    scanf("%d",&n);r=n;
	puts("0");fflush(stdout);
	scanf("%s",s);first=s[0];
    if(s[0]=='V') return 0;
    while(s[0]!='V'){
        mid=(l+r)>>1;
        printf("%d\n",mid);fflush(stdout);
		scanf("%s",s);
        if(s[0]==first){
        	if(mid%2==0) l=mid;
        	else r=mid;
		}
		else{
			if(mid%2) l=mid;
			else r=mid;
		}
    }
}

Measured memory_bytes: 852
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int X, A;

  std::cin >> X >> A;

  std::cout << (X < A ? 0 : 10) << std::endl;
  
  return 0;
}


Measured memory_bytes: 888
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int a[5] = {105, 135, 165, 189, 195};

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);

    int n;
    while (cin >> n) {
        int ans = 0;
        FOR(i,0,5)
            if (a[i] <= n)
                ans++;
        cout << ans << endl;
    }
}   

Measured memory_bytes: 256
N, A, B, C = list(map(int, input().split()))
L = [int(input()) for _ in range(N)]

assign = [0]*N

cost_min = 10000

while assign.count(3)<N:
    NL = [0]*4
    XL = [0]*4
    for i in range(N):
        NL[assign[i]] += 1
        XL[assign[i]] += L[i]

    if min(NL[:3])>=1:
        cost = (sum(NL[:3])-3)*10 + abs(A-XL[0]) + abs(B-XL[1]) + abs(C-XL[2])
        cost_min = min(cost_min, cost)

    for i in range(N):
        if assign[i]<3:
            assign[i] += 1
            for j in range(i):
                assign[j] = 0
            break

print(cost_min)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
template <typename X, typename Y> istream& operator>>(istream& is, pair<X, Y>& p) { return is >> p.first >> p.second; }
const int N = 200'000;
const ll INF = 200'000'000'000'001ll;
int n;
ll a[N + 1];
map<pair<int, int>, ll> memo;
ll opt(int i, int j) {
    if(not memo.count({i, j})) {
        ll& ans = memo[{i, j}];
        if(i == 0) {
            ans = j == 0 ? 0 : -INF;
        } else if((i - 1) / 2 <= j and j <= (i + 1) / 2) {
            ans = max({
                opt(i - 1, j),
                j > 0 ? a[i] + opt(max(i - 2, 0), j - 1) : -INF
            });
        } else {
            ans = -INF;
        }
    }
    return memo[{i, j}];
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    cout << opt(n, n / 2) << endl;
    return 0;
}


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

#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}

int main(void){
    int k,a,b;
    cin>>k>>a>>b;
    for(int i=1;i*k<=b;i++){
        if(a<=i*k&&i*k<=b){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    array<int, 3> A;
    rep(i, 3) cin >> A[i];
    vector<string> S(N);
    rep(i, N) cin >> S[i];

    ll sum = accumulate(all(A), 0LL);
    bool ok = true;
    vector<int> ans(N);
    if (sum >= 3) {
        rep(i, N) {
            int x = S[i][0] - 'A', y = S[i][1] - 'A';
            if (A[x] == 0 && A[y] == 0) {
                ok = false;
                break;
            }
            else if (A[x] < A[y]) {
                ans[i] = x;
                A[x]++; A[y]--;
            }
            else {
                ans[i] = y;
                A[y]++; A[x]--;
            }
        }
    }
    else {
        vector<array<int, 3>> nxt(N, { N, N, N });
        for (int i = N - 2; i >= 0; --i) {
            nxt[i] = nxt[i + 1];
            if (S[i + 1] == "BC") nxt[i][0] = i + 1;
            else if (S[i + 1] == "AC") nxt[i][1] = i + 1;
            else nxt[i][2] = i + 1;
        }

        rep(i, N) {
            int x = S[i][0] - 'A', y = S[i][1] - 'A';
            if (A[x] == 0 && A[y] == 0) {
                ok = false;
                break;
            }
            else if (A[x] == 0) {
                ans[i] = x;
                A[x]++; A[y]--;
            }
            else if (A[y] == 0) {
                ans[i] = y;
                A[y]++; A[x]--;
            }
            else {
                if (nxt[i][x] < nxt[i][y]) {
                    ans[i] = y;
                    A[y]++; A[x]--;
                }
                else {
                    ans[i] = x;
                    A[x]++; A[y]--;
                }
            }
        }
    }

    if (ok) {
        write("Yes");
        rep(i, N) cout << (char)('A' + ans[i]) << "\n";
    }
    else write("No");
}

Measured memory_bytes: 7952
#最初に入れておくとinputが早くなる
import sys
input = sys.stdin.readline

n, x = map(int, input().split())
l = list(map(int, input().split()))

for i in range(1,n):
    l[i]=l[i-1]+l[i]

#print(l)
t=0
for _ in l:
    if (l[t] > x):
        break
    t+=1

print(t+1)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
typedef long long ll;
int main(){
    ll n;
    cin >> n;
    ll ans = 1000000000;
    for(ll i=1;i<=sqrt(n);i++){
        if(n%i == 0){
            ll j = n/i;
            ll d_i = to_string(i).length();
            ll d_j = to_string(j).length();
            if(max(d_i,d_j) < ans){
                ans = max(d_i,d_j);
            }

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

Measured memory_bytes: 256
#include <stdio.h>
    int main() {
    int a, b, i, x;
    scanf("%d", &a);
    scanf("%d", &b);
    for (i = 10;i < 101;i = i * 10) {
    if (b <= 9) {
    x = 10;
    break;
    } if (b / i <= 9) {
    x = i * 10;
    break;
    } }
    a = (a * x) + b;
    for (i = 0;1000000;i++) {
    if (a == i * i) {
    printf("Yes\n");
    break;
    } if (i == 1000000) {
    printf("No\n");
    break;
    } }
    return 0;
    }  

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

int main()
{
    int a,b;
    cin >> a >> b;
    if(a+b==0)
        cout << 0 << endl;
    else if(a+b>0)
        cout << 1 << endl;
    else
        cout << -1 << endl;
    return 0;
}



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

#a,b,c,d = map(int,readline().split())
s,k = readline().split()


a = [len(i) for i in s.split("0")]
while a and a[-1] == 0: a.pop()

if not a:
    print(1)
    exit()

MOD = 998244353

M = sum(a)+1
k = min(int(k),M)


dp = [[0]*M for _ in range(k+1)] # j 使って（上限 k）、l 余ってる
dp[0][0] = 1

#print(a)
for ai in a[::-1]:
    ndp = [[0]*M for _ in range(k+1)] # j 使って（上限 k）、l 余ってる
    for j in range(k+1):
        for l in range(M):
            if dp[j][l]:
                for ll in range(l):
                    ndp[j][ll] += dp[j][l]
                    ndp[j][ll] %= MOD

                V = min(M-l,k-j+1,ai+1)
                for i in range(V):
                    #if j+i > k: break
                    ndp[j+i][l+i] += dp[j][l]
                    ndp[j+i][l+i] %= MOD
    
    dp = ndp
    #print(dp)

ans = 0
for jj in range(k+1):
    ans += dp[jj][0]

print(ans%MOD)







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

string s, t;

int dp[3003][3003];
pair <int, int> pr[3003][3003];

	

int main()
{
	cin >> s >> t;
	
	
	for(int i = 1; i <= s.size(); i++)
	{
		for(int j = 1; j <= t.size(); j++)
		{
			if(s[i-1] != t[j-1])
			{
				if(dp[i][j-1] >= dp[i-1][j])
				{
					dp[i][j] = dp[i][j-1];
					pr[i][j].first = i;
					pr[i][j].second = j-1;
				}
				else {
					dp[i][j] = dp[i-1][j];
					pr[i][j].first = i-1;
					pr[i][j].second = j;
				}
			}
			else 
			{
				dp[i][j] = dp[i-1][j-1] + 1;
				pr[i][j].first = i-1;
				pr[i][j].second = j-1;
			}
		}
	}
	
	int sx, tx;
	sx = s.size();
	tx = t.size();
	string s1 = "";
	while(sx != 0 && tx != 0)
	{
		int g1 = pr[sx][tx].first;
		int g2 = pr[sx][tx].second;
		if((pr[sx][tx].first == (sx-1)) && (pr[sx][tx].second == (tx-1)))
		{
			s1 += s[sx-1];
		}
		sx = g1;
		tx = g2;
	}
	reverse(s1.begin(), s1.end());
	cout << s1;
	return 0;
}


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

vector<int> graph[100010];

int visited[100010] = {};

void dfs(int idx){
    visited[idx] = 1;

    for(int i = 0;i < graph[idx].size();i++){
        if(visited[graph[idx][i]] == 0){
            dfs(graph[idx][i]);
        }
    }

    return;
}

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

    int x, y, z;
    for(int i = 0;i < m;i++){
        cin >> x >> y >> z;
        x--; y--;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }

    int ans = 0;

    for(int i = 0;i < n;i++){
        if(visited[i] == 0){
            ans++;
            dfs(i);
        }
    }

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


Measured memory_bytes: 9216
#include <iostream>
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <functional>
#include <climits>
#include <string>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int a[503][503];//i駅から始まり、j駅で終わる電車の数
	int ruiseki[503][503];
	int ruiseki2[503][503];
	int n, m, q;
	cin >> n >> m >> q;
	int l, r;
	for (int i = 0; i < 503; i++) {
		for (int j = 0; j < 503; j++) {
			a[i][j] = 0;
			ruiseki[i][j] = 0;
		}
	}
	for (int i = 0; i < m; i++) {
		cin >> l >> r;
		a[l][r] += 1;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j++) {
			ruiseki[i][j] = ruiseki[i][j - 1] + a[i][j];
		}
	}
	int pp, qq;
	for (int z = 0; z < q; z++) {
		cin >> pp >> qq;
		int ans = 0;
		for (int i = pp; i <= qq; i++) {
			ans += ruiseki[i][qq];
		}
		cout << ans<<"\n";
	}
	return 0;
}



Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
const int N = 1e3 + 5;
typedef long long int ll;

int main() {
    IOS ;
    // int t ; cin >> t ; while(t--) {}
    double n,d ; cin >> n >> d ; 
    int cnt  = 0 ;
    while(n--) {
        double x,y ; cin >> x >> y ;
        if(sqrt(x*x + y*y) <= d) cnt++ ; 
    }
    cout << cnt ;
    return 0 ;
}


Measured memory_bytes: 3824
#include <iostream>

int main(void){
  int N;
  std::cin >> N;
  for(int i=1; i < 10;i++){
    for(int j=1; j<=i; j++){
      if(i*j==N)
        {
        std::cout << "Yes";
        return 0;
        }
    }
  }
  std::cout << "No";
  return 0;
}


Measured memory_bytes: 256
//#pragma warning(disable : 4996)
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<fstream>
#include<stdio.h>
#include<map>
#include<set>
#include<limits.h>
#include<list>
#include <cassert>
#include<sstream>
#include <bitset>
#include<unordered_map>
using namespace std;
using ll = long long int;
using uint = unsigned int;

bool eqlvv(const vector<int>& l, const vector<int>& r) {
	if (l.size() != r.size())
		return false;
	for (int i = 0; i < l.size(); ++i)
		if (l[i] != r[i])
			return false;
	return true;
}
int main() {
	vector<int> fs[2] = { vector<int>(257, -1), vector<int>(257, -1) };
	int cnt[2] = { 0 };
	string s[2];
	cin >> s[0] >> s[1];
	vector<int> Sparse[2] = { vector<int>(s[0].size()), vector<int>(s[0].size()) };
	for (int i = 0; i < s[0].size(); ++i)
	{
		for (int j = 0; j < 2; ++j)
		{
			if (fs[j][s[j][i]] == -1) {
				fs[j][s[j][i]] = cnt[j]++;
			}
			Sparse[j][i] = fs[j][s[j][i]];
		}
	}
	cout << (eqlvv(Sparse[0], Sparse[1]) ? "Yes" : "No");

	return 0;
} 





Measured memory_bytes: 5444
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

int main()
{
    ll n=in();
    map<ll,ll>mp[2];
    for(ll i=0;i<n;++i)++mp[i%2][in()];

    vector<pair<ll,ll>>v[2];
    for(ll i=0;i<2;++i){
        mp[i].insert(make_pair(-1,0));
        for(auto foo:mp[i])v[i].push_back(make_pair(foo.second,foo.first));
        sort(v[i].begin(),v[i].end());
    }

    if(v[0].back().second!=v[1].back().second){
        cout<<n-v[0].back().first-v[1].back().first<<endl;
    }else{
        cout<<min(
            n-v[0].back().first-(v[1].end()-2)->first,
            n-(v[0].end()-2)->first-v[1].back().first
        )<<endl;
    }
}


Measured memory_bytes: 8824
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder.ABC114
{
    public class B
    {
        public static void Solve()
        {
            string[] input = Console.ReadLine().Split(' ');
            string s1 = input[0];
            
            //　int arr[s.len -2]
            var numList = new List<int>();

            //for int i = 0 ; i <= s.len -2 ; i++ 
            // X = S[i..j] ; i=0 ; j+=2;
            //List<int>.GetRange(i,j); ??
            // Stringj.Substring???
            // int parse(X)
            for (int i = 0 ; i < s1.Length - 2; i++)
            {
                var num = s1.Substring(i,3);
                int n = Math.Abs(753 - int.Parse(num));
                numList.Add(n);
            }

            // xs = | 753 - X | * (S.len -2)
            // min(xs)
            Console.WriteLine(numList.Min());
        }    
    }
}

namespace AtCoder {
    class Program
    {
        static void Main(string[] args)
        {
            ABC114.B.Solve();
        }
    }
}


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

int main() {
	// your code goes here
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	 cin>>a[i];
	sort(a,a+n);
	int sum=0;
	for(int i=0;i<k;i++)
	 sum+=a[i];
	cout<<sum<<endl; 
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
int n, m, ans, r;
pair<int, int> a[100001];
bool dd[100001];

int main(){
    cin >> n >> m;
    for (int i = 1; i <= m; i++){
        int x, y;
        cin >> x >> y;
        a[i] = make_pair(x,y);
    }
    sort(a+1, a+m+1);
    ans = 1;
    r = a[1].se;
    for (int i = 2; i <= m; i++){
        if (a[i].fi >= r){
            ans++;
            r = a[i].se;
        }
        else r = min(r, a[i].se);
    }
    cout << ans;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;

int main() {
	int H,W;
	cin>>H>>W;
	vector<string>vec(H);
	for(int i=0;i<H;i++) {
		string s;
		cin>>s;
		vec.at(i)=s;
	}
	for(int i=0;i<H+2;i++) {
		if(i==0||i==H+1) {
			for(int j=0;j<W+2;j++) {
				cout<<"#";
			}
		}
		else {
			cout<<"#"<<vec.at(i-1)<<"#";
		}
		cout<<endl;
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using i64 = int64_t;
#define rep(i, s, n) for (i64 i = (s); i < (n); ++i)

void run() {
  string s;
  cin >> s;
  cout << s << ((s[size(s) - 1] == 's') ? "es" : "s") << endl;
}

int main() {
  cin.tie(nullptr);
  run();
  return 0;
}


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

signed main() {
	int n;
	cin >> n;
	long long sum = 0ll;
	for (register int  i =1; i <= n; i++){
		if (i % 3 != 0 &&i%5!=0)	sum +=i;
	}
	cout <<sum<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxN = (int)1e5 + 100;
int a[maxN];
ll prefAll[maxN];
ll pref[maxN];
int n, q;
int calcQ(int x, int i) {
     if (a[i] >= x) {
         int ind = lower_bound(a + 1, a + n + 1, x) - a;
         if (2 * x - a[1] <= a[i]) {
             return i;
         }
         else {
             int ind2 = lower_bound(a + 1, a + n + 1, 2 * x - a[i]) - a;
             return (i - ind2 + 1);
         }
     }
     else {
         int ind = lower_bound(a + 1, a + n + 1, x) - a;
         if (a[n] < 2 * x - a[i]) {
             return n - i + 1;
         }
         else {
             int ind2 = lower_bound(a + 1, a + n + 1, 2 * x - a[i]) - a;
             ind2--;
             return (ind2 - i + 1);
         }
     }
}
void solve(int x) {
    if (x >= a[n]) {
        cout << pref[n] << '\n';
        return ;
    }
    int ind = lower_bound(a + 1, a + n + 1, x) - a;
    if (calcQ(x, ind) + ind > n) {
        ll ans = prefAll[n] - prefAll[ind - 1];
        int left = 2 * ind - n - 2;
        if (left > 0) ans += pref[left];
        cout << ans << '\n';
        return ;
    }
    else {
        int l = ind;
        int r = n;
        while (r - l > 1) {
            int mid = (l + r) / 2;
            if (calcQ(x, mid) + mid > n) {
                r = mid;
            }
            else {
                l = mid;
            }
        }
        // l - ok
        //cout << l << '\n';
        ll ans = prefAll[n] - prefAll[l];
        int left = 2 * l - n + 1 - 1;
        if (left > 0) ans += pref[left];
        cout << ans << '\n';
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    cin >> n >> q;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        prefAll[i] = prefAll[i - 1] + a[i];
        if (i >= 2) pref[i] = pref[i - 2] + a[i];
        else pref[i] = a[i];
    }
    for (int i = 1; i <= q; i++) {
        int x;
        cin >> x;
        solve(x);
    }
    return 0;
}

Measured memory_bytes: 3712