akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fr(i,j,n)   for(int i=j;i<(n);++i)
#define bk(i,j,n)   for(int i=j;i>=n;--i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define MOD 1000000007
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>

typedef long long  ll;

ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}


int main()
{
    run;
    string s;
    cin>>s;
    ll n=s.length();
    ll p=0;
    ll lo=0,hi=n-1;
    while(hi>lo)
    {
        if(s[hi]==s[lo])
        {
            hi--,lo++;
        }else
        break;
    }
    if(hi==lo)
    {
        ll lop=(n-1)/2;
        ll hop=(n+3)/2;
        lo=0,hi=lop-1;
        while(hi>lo)
        {
            if(s[hi]==s[lo])
            {
                hi--,lo++;
            }else{
            break;}
        }
        if(hi<=lo)
        {

            lo=hop-1;
            hi=n-1;
            while(hi>lo)
        {
            if(s[hi]==s[lo])
            {
                hi--,lo++;
            }else{
            break;}
        }
        if(hi<=lo)
        {
            cout<<"Yes";
        }else{
        cout<<"No";}


        }else{
        cout<<"No";}


    }else{
    cout<<"No";}




}


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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var strs = Console.ReadLine().Split();
            var ab = int.Parse(strs[0]);
            var bc = int.Parse(strs[1]);

            Console.WriteLine(ab * bc / 2);
        }
    }
}


Measured memory_bytes: 13140
(defn otoshidama [n y]
  (for [a (range 0 (inc n)) b (range (- (inc n) a))
        :let [c (- n a b)]
        :when (= (+ (* 10000 a) (* 5000 b) (* 1000 c)) y)]
    (format "%d %d %d" a b c)))

(defn main []
  (let [res (first (otoshidama (read) (read)))]
    (if (nil? res)
        (println "-1 -1 -1")
        (println res))))

(main)

Measured memory_bytes: 181104
#include <iostream>
#include <math.h>
#include <algorithm>
#define ll long long int
#define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n)

using namespace std;

int main()
{
    string s;
    cin >> s;
    int n = s.length(), one_first = 0, zero_first = 0;
    REP(i,n){
        if(i % 2 == 0){
            if(s[i] == '1') zero_first++;
            else one_first++;
        }else{
            if(s[i] == '0') zero_first++;
            else one_first++;
        }
    }
    cout << min(one_first, zero_first) << endl;
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int Li, Ri, Ln, Rn;


int dfs(int li, int ri, int ln, int rn, bool isono)
{
  if(li >= 5 && ri >= 5)
    return false;
  if(ln >= 5 && rn >= 5)
    return true;

  if(isono)
  {
    int res = false;
    if(ri < 5)
    {
      if(ln < 5)
        res |= dfs(li, ri, ln + ri, rn, false);
      if(rn < 5)
        res |= dfs(li, ri, ln, rn + ri, false);
    }
    if(li < 5)
    {
      if(ln < 5)
        res |= dfs(li, ri, ln + li, rn, false);
      if(rn < 5)
        res |= dfs(li, ri, ln, rn + li, false);
    }
    return res;
  }
  else
  {
    int res = true;
    if(rn < 5)
    {
      if(li < 5)
        res &= dfs(li + rn, ri, ln, rn, true);
      if(ri < 5)
        res &= dfs(li, ri + rn, ln, rn, true);
    }
    if(ln < 5)
    {
      if(li < 5)
        res &= dfs(li + ln, ri, ln, rn, true);
      if(ri < 5)
        res &= dfs(li, ri + ln, ln, rn, true);
    }
    return res;
  }
}


int main()
{
  cin >> Li >> Ri >> Ln >> Rn;
  cout << (dfs(Li, Ri, Ln, Rn, true) ? "ISONO" : "NAKAJIMA") << endl;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int>  a(3);
  for (int i = 0; i < 3; i++) {cin >> a.at(i);}
  sort(a.begin(), a.end());
  if (a.at(0) -  a.at(1) == a.at(1) - a.at(2)) {cout << "YES" << endl;}
  else {cout <<  "NO" << endl;}
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,A,B;
  cin >> K >> A >> B;
  int F = K;
  while (true){
    if (A <= F && F <= B){
      cout << "OK";
      break;
    }
	else if (F < A){
      F += K;
    }
    else {
      cout << "NG";
      break;
    }
  }
}

Measured memory_bytes: 3636
#include<stdio.h>
#define N 100000

int G[N];

int find(int x)
{
  if(x == G[x]) return x;
  return G[x] = find(G[x]);
}

int eq(int a, int b)
{
  if(find(a) == find(b)) return 1;
  else return 0;
}

void cone(int a,int b) {
  a = find(a);
  b = find(b);

  if(a == b) return;
  G[b] = a;
}

int main()
{
    int i,j,m,v,k,s;
    for(i=0;i<N;i++) G[i]=i;
    scanf("%d %d", &s,&m);
    for(i=0;i<m;i++)
    {
        scanf("%d %d", &j,&v);
        cone(j,v);
    }
    scanf("%d", &k);

    for(i=0;i<k;i++) 
    {
        scanf("%d %d", &j,&v);
        if(eq(j,v))
        {
            printf("yes\n");
        }
        else printf("no\n" );
    }
    return 0;
    
}


Measured memory_bytes: 2132
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;

int main(){
  ll N;
  cin>>N;
  out(2*M_PI*N);
}


Measured memory_bytes: 3776
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int mod= 1e+9+7;

int main() {
    ll A,B,C; cin>>A>>B>>C;
    bitset<100>b;
    ll a=A;
    while(true){
        if(A%B==C){
            cout<<"YES"<<endl;
            return 0;
        }
        else{
            //cout<<A%B<<" ";
            if(b.test(A%B)){
                cout<<"NO"<<endl;
                return 0;
            }
            //cout<<3<<endl;
            b.set(A%B);
        }
        A+=a;
    }
    }
 



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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main()
{
  int n;
  cin >> n;
  string a, b, c;
  cin >> a >> b >> c;
  ll ans = 0;
  for (int i = 0; i < n; ++i)
  {
    if (a[i] == b[i] && b[i] == c[i])
    {
      continue;
    }
    else if (a[i] != b[i] && b[i] != c[i] && c[i] != a[i])
    {
      ans += 2;
    }
    else
    {
      ans++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin>>n;
  vector<ll> a(n),sum;
  ll tmp=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    tmp+=a[i];
    sum.push_back(tmp);
  }
  vector<ll> ans;
  for(int i=0;i<n-1;i++){
    ans.push_back(abs(2*sum[i]-sum[n-1]));
  }
  cout<<*(min_element(ans.begin(),ans.end()));
  
}

Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;
    cin>>n;
    int cnt=0;
    ll ans=0;
    int mi=1000000001;
    rep(i,n){
        int a;
        cin>>a;
        if(a<0) cnt++;
        ans+=abs(a);
        mi=min(mi,abs(a));
    }
    //cout<<cnt<<" "<<mi<<endl;
    if(cnt%2==0){
        cout<<ans<<endl;
    }
    else cout<<ans-2*mi<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
int main(void){
    // Your code here!
    string a;
    int p = 0;
    std::cin >> a;
    rep(i, a.size()/2){
        if(a.at(i) == a.at(a.size() - i - 1)){}
        else p++;
    }
    std::cout << p << std::endl;
}


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

using namespace std;

int main(){
	string in;
	cin >> in;
	for(int i = 0; i < in.size(); i++){
		in[i] = (in[i]-'A')>=3?in[i]-=3:'Z'-(2-((int)in[i]-'A'));
	}

	cout << in << endl;

	return 0;
}


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

typedef long long ll;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const int MOD = 1e9 + 7 ;
const double PI = 2 * acos(0.0) ;

int main()
{
    ll k, d ;
    cin >> k >> d ;
    if (k >= 10)    cout << d << endl ;
    else {
        cout << (d + (100 * (10 - k))) << endl ;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static int dp[];//dp[i] i番にいるとき最小コスト
	static int N;
	static int[]h;


	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		N= sc.nextInt();
		h=new int[N];
		dp=new int[N];

		for(int i=0;i<N;i++) {
			h[i]=sc.nextInt();
		}
		dp[N-1]=0;
		dp[N-2]=Math.abs( h[N-1]-h[N-2]);
		for(int i=N-3;i>=0;i--) {
			dp[i]=Math.min(
					Math.abs( h[i]-h[i+1])+dp[i+1],
					Math.abs( h[i]-h[i+2])+dp[i+2]
					);
		}

		System.out.println(dp[0]);
	}
}

Measured memory_bytes: 62292
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    while(cin >> n){
        cout << n*(n+1)/2 +1 << "\n";
    }
    return 0;
}


Measured memory_bytes: 2996
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#define MAX 10000
#define INFTY (1 << 29)


using namespace std;

class Disjoint{
    public:
    
        vector<int> rank, p;
        
        Disjoint(){}
        Disjoint(int size){
            rank.resize(size, 0);
            p.resize(size,0);
            
            for(int i=0; i<size; i++){
                Makeset(i);
            }
        }
        
        void Makeset(int x){
            p[x] = x;
            rank[x] = 0;
        }
        
        bool same(int x, int y){
            return Findset(x) == Findset(y);
        }
        
        void unite(int x, int y){
            link(Findset(x), Findset(y));
        }
        
        void link(int x, int y){
            if(rank[x] > rank[y]){
                p[y] =x;
            }else{
                p[x] = y;
                if(rank[x] == rank[y]){
                    rank[y]++;
                }
            }
        }
        
        int Findset(int x){
            if(x != p[x]){
                p[x] = Findset(p[x]);
            }
            return p[x];
        }
};

class Edge{
    public:
    int sou, tar, cost;
    Edge(int sou = 0, int tar = 0, int cost = 0):
    sou(sou), tar(tar), cost(cost){}
    
    bool operator < ( const Edge &e) const{
        return cost < e.cost;
        
    }
    
};


int Kruskal(int N, vector<Edge> edges){
    int acost = 0;
    sort(edges.begin(), edges.end());
    
    Disjoint dset = Disjoint(N+1);
    
    for(int i=0; i<N; i++){
        dset.Makeset(i);
    }
    
    int sou, tar;
    
    for(int i=0; i<edges.size(); i++){
        Edge e = edges[i];
        
        if(!dset.same( e.sou, e.tar)){
            acost += e.cost;
            dset.unite( e.sou, e.tar);
        }
    }
    return acost;
    
}


int main(){
    int N, M, cost;
    int sou, tar;
    
    cin >> N >> M;
    
    vector<Edge> edges;
    
    for(int i=0; i<M; i++){
        
        cin >> sou >> tar >> cost;
        
        edges.push_back(Edge(sou, tar, cost));
    }
    
    cout << Kruskal(N, edges) << endl;
    
    
    return 0;
}





Measured memory_bytes: 5116
def cut(cake,s):
    ret_cake = [ (-1,-1),(-1,-1) ]
    w = cake[2]
    h = cake[1]

    s %= 2*(w+h)

    if w > s:
        ret_cake = [(h,s),(h,w-s)]
    elif w+h > s:
        ret_cake = [(s-w,w),(w+h-s,w)]
    elif 2*w+h > s:
        ret_cake = [(h,s-w-h),(h,2*w+h-s)]
    elif 2*w+2*h > s:
        ret_cake = [(s-2*w-h,w),(2*w+2*h-s,w)]

    ret_cake =  [ (c[0]*c[1],c[0],c[1]) for c in ret_cake]
    ret_cake.sort()
    return ret_cake

while True:
    n,w,d = map(int,input().split())
    if n == 0  and w == 0 and d == 0:
        break
    p = [0] * n
    s = [0] * n
    for i in range(n):
        p[i],s[i] = map(int,input().split())
    cake = [ (w*d,d,w) ]

    for i in range(n):
        cake = cake[:p[i]-1] + cake[p[i]:] + cut(cake[p[i]-1],s[i])
    cake.sort()
    print( " ".join(map(str,[c[0] for c in cake])))

Measured memory_bytes: 7688
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

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

    vector<int> b(n - 1);
    for (int i = 0; i < b.size(); i++)
    {
        b[i] = a[i + 1] - a[i];
    }
    ll stock = 0;
    ll money = 1000;
    for (int i = 0; i < n - 1; i++)
    {
        if (b[i] < 0)
        {
            money += a[i] * stock;
            stock = 0;
        }
        else if (b[i] > 0)
        {
            ll plus = money / a[i];
            stock += plus;
            money -= plus * a[i];
        }
        if (i == n - 2)
        {
            money += stock * a[i + 1];
            stock = 0;
        }
    }
    cout << money << endl;
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<sstream>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<vector>
#define inf 0x3f3f3f3f
#define N 2200000
#define mod 1e9+9
#define eps 1e-9
#define clr(x,a) memset(x,a,sizeof(x))
#define sqr(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI=acos(-1.0);

struct ZT{
    int st,en;
    double cost;
};
ZT zt[N];
struct BALL{
    double x,y,z;
    double r;
};
BALL ball[N];
int n;
int root[N];
int finds(int x)
{
    if(root[x]!=x)
        return root[x]=finds(root[x]);
    return root[x];
}
int cmp(const ZT &a,const ZT &b)
{
    return a.cost<b.cost;
}
int main()
{
    while(~scanf("%d",&n)&&n)
    {
        for(int h=0;h<n;h++)
            scanf("%lf %lf %lf %lf",&ball[h].x,&ball[h].y,&ball[h].z,&ball[h].r);
        int ct=0;
        for(int h=0;h<n;h++)
            for(int i=h+1;i<n;i++)
            {
                double len=sqrt(sqr(ball[h].x-ball[i].x)+sqr(ball[h].y-ball[i].y)+sqr(ball[h].z-ball[i].z));
                len-=ball[h].r+ball[i].r;
                len=max(len,0.0);
                zt[ct].st=h;
                zt[ct].en=i;
                zt[ct++].cost=len;
            }
        for(int h=0;h<=ct;h++)
            root[h]=h;
        sort(zt,zt+ct,cmp);
        double sum=0;
        for(int h=0;h<ct;h++)
        {
            int x=finds(zt[h].st);
            int y=finds(zt[h].en);
            if(x!=y)
            {
                root[x]=y;
                sum+=zt[h].cost;
            }
        }
        printf("%.3lf\n",sum);
    }
	return 0;
}

Measured memory_bytes: 5376
const inputs = require('fs')
  .readFileSync('/dev/stdin', 'utf8')
  .trim()
  .split('\n')
  .map(Number);
inputs.shift();
let min = inputs[0];
let max = inputs[1] - inputs[0];
inputs.shift();
inputs.forEach(input => {
  max = Math.max(max, input - min);
  min = Math.min(min, input);
});
console.log(max);



Measured memory_bytes: 51480
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MOD = 11;
const int MAX_N = 80000;

/* typedef */

/* global variables */

int mods[2][MOD];

/* subroutines */

/* main */

int main() {
  for (;;) {
    string str;
    cin >> str;
    if (str == "0") break;

    int n = str.length();
    int count = 0;
    memset(mods, 0, sizeof(mods));

    int cur = 0, nxt = 1;
    
    for (int i = 0; i < n; i++) {
      int d = str[i] - '0';
      for (int j = 0; j < MOD; j++)
	mods[nxt][(j * 10 + d) % MOD] = mods[cur][j];
      if (d > 0) mods[nxt][d]++;
      count += mods[nxt][0];

      cur ^= 1;
      nxt ^= 1;
    }

    cout << count << endl;
  }

  return 0;
}

Measured memory_bytes: 1320
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            if x == (500*ia + 100*ib + 50*ic):
                count+=1

print(count)

Measured memory_bytes: 3060
#include<stdio.h>
#include <string>
#include <iostream>
#include <assert.h>
#include <stdio.h>
#define SIZEOF(x) (sizeof x )/(sizeof x[0])
#include <math.h>

int main(){
    long long N;
    scanf("%lld" , &N);
    int s = (int)sqrt(N);
    int d = (int)sqrt(s);
    printf("%d\n" , s*s );
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  int ans =0,n=s.size();
  char x = s.at(0);
  for(int i=0;i<n;i++){
    if(s.at(i) != x){
      ans++;
      x = s.at(i);
    }
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1e9+7,INF=1e17;
const int iINF=1e9;
#define vi vector<int>
#define vl vector<ll>
#define inarr(a,n) for(ll i=0;i<n;i++)cin>>a[i]
int main(){
    int k,x;
    cin>>k>>x;
    for(int i=k-1;i>0;i--){
        cout<<x-i;
        cout<<" ";
    }
    for(int i=0;i<k;i++){
        cout<<i+x;
        if(i!=k-1)cout<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        // 主処理
        int result = (int) Math.round(a / 0.08);
        if ((int) (result * 0.1) != b) {
            if ((int) (b * 10 * 0.08) == a) {
                result = b * 10;
            } else {
                result = -1;
            }
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}

Measured memory_bytes: 23892
/*input
async layered coding
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	string a,b,c;
	cin>>a>>b>>c;
	if(a.back()==b[0]&&b.back()==c[0]){
		cout<<"YES\n";
	}
	else cout<<"NO";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    
    for(int i = 0; i < 8; i++){
        if(n < (1 << (i+1))){
            cout << (1 << i) << endl;
            break;
        }
    }
    
}

Measured memory_bytes: 256
n = gets.to_i
a = $stdin.read.split.map(&:to_i)
visited = Hash.new { false }
next_point = a[0]

n.times do
  if visited[next_point]
    puts(-1)
    exit
  end

  if next_point == 2
    puts(visited.length + 1)
    exit
  end

  visited[next_point] = true
  next_point = a[next_point - 1]
end

puts(-1)

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

const int MAX_N = 1e5+10;
int prime[MAX_N];
bool is_prime[MAX_N];
bool like_2017[MAX_N];
int sum[MAX_N];

int sieve(int n){
	int p = 0;
	for (int i = 0; i <= n; ++i) is_prime[i] = true;
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= n; i++){
		if (is_prime[i]){
			prime[p++] = i;
			for (int j = 2*i; j <= n; j += i) {
				is_prime[j] = false;
			}
		}
	}
	return p;
}

int main(){
    sieve(1e5);
    for (int i = 1; i < 1e5; i+=2){
    	like_2017[i] = is_prime[i] && is_prime[(i+1)/2];
    }
    
    int s = 0;
    for (int i = 1; i <= 1e5; ++i){
    	if(like_2017[i]) s++;
    	sum[i] = s;
    }
    

    int Q;
    cin >> Q;
    for (int i = 0; i < Q; ++i){
    	int l,r;
    	cin >> l >> r;
    	cout << sum[r] - sum[l-1] << endl;;
    }
}

Measured memory_bytes: 1280
program ccc

implicit none

integer :: n, m, i
integer,allocatable,dimension(:) :: a, dp

read*, n, m
allocate(a(m))
allocate(dp(0:n))
if(m/=0) then
read*, a
else
a=0
end if

dp=1

do i=1,m
dp(a(i))=0
end do

do i=2,n
if(dp(i)==1) then 
dp(i)=mod(dp(i-2)+dp(i-1),1000000007)
end if
end do

write(*,'(i0)') dp(n)

end program

Measured memory_bytes: 1536
import sys

b = input()

flg = 0
n = 0
nw = []
for bi in b:
    if bi == 'A' or bi == 'G' or bi == 'C' or bi == 'T':
        flg = 1
        n += 1
    else:
        flg = 0
        n = 0
    nw.append(n)

nw.sort(reverse = True)
print(nw[0])




Measured memory_bytes: 2940
#include<iostream>
#include <numeric>
// #include<string>
#include<vector>
#include <algorithm>
#include <cmath>
// #include <functional>
#include <iomanip>

using namespace std;

int main()
{
    // std::cout<<std::fixed<<std::setprecision(10);

    // Input
    unsigned long long x;
    cin >> x;

    unsigned long long ans;

    ans = x / 500 * 1000;

    ans += (x % 500) / 5 * 5;

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
int a[55][2];
int b[55][2];
int anss[55];
int main(int argc, const char * argv[]) {
    
    int n,m;
    
    scanf("%d %d",&n,&m);
    
    for(int i=0;i<n;i++) scanf("%d %d",&a[i][0], &a[i][1]);
    
    for(int i=0;i<m;i++) scanf("%d %d",&b[i][0], &b[i][1]);
    
    for(int i=0;i<n;i++){
        int ans = 500000000;
        for(int j=0;j<m;j++){
            int tmp = abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1]);
            if(ans > tmp){
                ans = tmp;
                anss[i]=j+1;
            }
        }
    }
    for(int i=0;i<n;i++){
        printf("%d\n",anss[i]);
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
const int N=100005;

int A,B,C,X,Y;

int main()
{
	scanf("%d%d%d%d%d",&A,&B,&C,&X,&Y);
	int ra,rb,tmp,ans=2e9;
	for (int i=0;i<=2*max(X,Y);i++) 
	{
		ra=max(X-i/2,0);
		rb=max(Y-i/2,0);
		ans=min(ans,ra*A + rb*B + C*i );
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{        
    public void Slove()
    {
        var inputs = Console.ReadLine().Split();
        int height = int.Parse(inputs[0]);
        int width = int.Parse(inputs[1]);
        int n = int.Parse(inputs[2]);
        Dictionary<long, int> blackCount = new Dictionary<long, int>();
        foreach(var i in Enumerable.Range(0, n))
        {
            inputs = Console.ReadLine().Split();
            int row = int.Parse(inputs[0]) - 1;
            int column = int.Parse(inputs[1]) - 1;
            foreach(int my in Enumerable.Range(-1, 3).Select(x => x + row).Where(x => x > 0 && x < height - 1))
                foreach(int mx in Enumerable.Range(-1, 3).Select(x => x + column).Where(x => x > 0 && x < width - 1))
                {
                    long key = (long)(my) * width + mx;
                    if(blackCount.ContainsKey(key))
                        blackCount[key]++;
                    else
                    {
                        blackCount.Add(key, 1);
                    }
                }
        }
        long[] hist = new long[10];
        foreach(int count in blackCount.Values)
        {
            hist[count]++;
        }
        hist[0] = (long)(height - 2) * (width - 2) - hist.Sum();
        Console.WriteLine(string.Join("\n", hist));
    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


Measured memory_bytes: 58956
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define per(i,n) for (int i = (n)-1; i >=0; --i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;

int main(){
    int n,l;
    cin>>n>>l;
    vector<string> s(n);
    rep(i,n)cin>>s[i];
    sort(s.begin(), s.end());
    rep(i,n)cout<<s[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
	int n,cnt;
	while(std::cin>>n){
		cnt=0;
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				for(int k=0;k<10;k++){
					for(int l=0;l<10;l++){
						if(i+j+k+l==n) cnt++;
					}
				}
			}
		}
		std::cout<<cnt<<'\n';
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll p=998244353,jc[4000010],ny[4000010];
ll ksm(ll x,ll y){
	ll xlh=1;
	while(y){
		if(y&1)xlh=xlh*x%p;
		x=x*x%p;
		y/=2;
	}
	return xlh;
}
ll C(ll x,ll y){
	if(x<0||y<0||x<y)return 0;
	return jc[x]*ny[y]%p*ny[x-y]%p;
}
ll solve(ll n,ll zo,ll m){
	ll i,ans=0,xlh,sy;
	for(i=0;i<=m;i++)if(zo%2==i%2){
		xlh=C(n,i);
		sy=zo-i;sy/=2;
		xlh=xlh*C(sy-1+n,n-1)%p;
		ans=(ans+xlh)%p;
	}
	return ans;
}
int main(){
	ll i,n,m;
	jc[0]=ny[0]=1;
	for(i=1;i<=4000000;i++)jc[i]=jc[i-1]*i%p;
	ny[4000000]=ksm(jc[4000000],p-2);
	for(i=4000000-1;i;i--)ny[i]=ny[i+1]*(i+1)%p;
	scanf("%lld%lld",&n,&m);
	printf("%lld",(solve(n,m*3,m)-n*(solve(n,m,m)-solve(n-1,m,m)+p)%p+p)%p);
}

Measured memory_bytes: 62720
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    int a,b,c;
    cin >> a >> b >> c;
    if ( a == b and b == c) {
        cout << "No" << endl;
    }
    else if (a != b and b != c and c != a){
        cout << "No" << endl;
    } 
    else {
        cout << "Yes" << endl;
    }
}


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

int main() {
  int t, x;
  cin >> t >> x;
  double ans = (double)t / (double)x;
  cout << fixed << setprecision(12) << ans << endl;
}

Measured memory_bytes: 256
N, A, B, K = map(int, input().split())
mod = 998244353

def pow(n, i):
    if i == 0: return 1
    elif i == 1: return n
    elif i % 2 == 0: return pow((n * n) % mod, i//2)
    else: return (pow((n * n) % mod, i//2) * n) % mod

factorial = [1] *(N+1)
revfactorial = [1] * (N+1)
for i in range(N):
    factorial[i+1] = (factorial[i] * (i+1)) % mod
revfactorial[N] = pow(factorial[N], mod-2)
for i in reversed(range(1, N)):
    revfactorial[i] = (revfactorial[i+1] * (i+1)) % mod

ans = 0
for a in range(N+1):
    if K >= A * a:
        if (K - A * a) % B == 0:
            b = (K - A * a) // B
            apatt = (factorial[N] * revfactorial[N - a] * revfactorial[a]) % mod
            if b <= N: bpatt = (factorial[N] * revfactorial[N - b] * revfactorial[b]) % mod
            else: bpatt = 0
            ans += (apatt * bpatt) % mod
            ans %= mod
print(ans)

Measured memory_bytes: 26740
import java.util.*;
import java.util.Collections;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        int bigger = 0;
        
        ArrayList<Integer> list = new ArrayList<>();
        
        if(A < B){
            bigger = B;
        }else{
            bigger = A;
        }
        for(int i = 1;i <= bigger;i++){
            if(A % i == 0 && B % i == 0){
                list.add(i);
            }
        }
        Collections.sort(list,Collections.reverseOrder());
        System.out.println(list.get(K-1));
    }
}


Measured memory_bytes: 21844
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int grid[15][15];
int n,m,o,r,c,s,a;

void ro()
{
	int i,j,k,l,tmp_grid[15][15];
	
	scanf( "%d%d%d%d",&r,&c,&s,&a);
	r--,c--;
	for(;a>0;a-=90)
	{
		memcpy(tmp_grid,grid,sizeof(grid));
		for(i=0;i<s;i++)
		{
			for(j=0;j<s;j++)
				tmp_grid[r+i][c+j]=grid[r+s-j-1][c+i];
		}
		memcpy(grid,tmp_grid,sizeof(grid));
	}
}

void re()
{
	int i,j;
	scanf("%d%d%d",&r,&c,&s);
	r--,c--;
	for(i=r;i<r+s;i++)
		for(j=c;j<c+s;j++)
			grid[i][j]=grid[i][j]?0:1;
}

void ls()
{
	int i,tmp;
	scanf("%d",&r);
	r--;
	tmp=grid[r][0];
	for(i=0;i<n-1;i++)
		grid[r][i]=grid[r][i+1];
	grid[r][n-1]=tmp;
}

void rs()
{
	int i,tmp;
	scanf("%d",&r);
	r--;
	tmp=grid[r][n-1];
	for(i=n-1;i>0;i--)
		grid[r][i]=grid[r][i-1];
	grid[r][0]=tmp;
}

void ir(int r,int c)
{
	int mv[5]={0,1,0,-1,0},tmp=grid[r][c],i;
	grid[r][c]=grid[r][c]?0:1;
	for(i=0;i<4;i++)
		if(r+mv[i]>=0&&r+mv[i]<n&&c+mv[i+1]>=0&&c+mv[i+1]<n&&grid[r+mv[i]][c+mv[i+1]]==tmp)
			ir(r+mv[i],c+mv[i+1]);
}

int main()
{
	int i,j;
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)
		for(j=0;j<n;j++)
			scanf( "%d",&grid[i][j]);

	for(i=0;i<m;i++)
	{
		scanf("%d",&o);
		switch(o)
		{
		case 0:ro();break;
		case 1:re();break;
		case 2:ls();break;
		case 3:rs();break;
		case 4:scanf("%d%d",&r,&c);r--;c--;ir(r,c);break;
		}
	}
	for(i=0;i<n;i++)
		for(j=0;j<n;j++)
		printf( "%d%s",grid[i][j],j==n-1?"\n" :" ");
	return 0;
}

Measured memory_bytes: 616
n = int(input())
numList = list(map(int, input().split()))
evenCount = 0
count = 0

for num in numList:
    if num % 2 == 0:
        evenCount += 1
    if num % 2 == 0 and (num % 3 == 0 or num % 5 == 0):
        count += 1

if count == evenCount:
    print("APPROVED")
else:
    print("DENIED")

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)

using namespace std;


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int c = -1;
    int cnt = 0;
    int res = 0;
    rep(i, n){
        if(a[i] != c){
            res += cnt/2;
            c = a[i];
            cnt = 1;
            continue;
        }
        cnt++;
    }

    res += cnt/2;

    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 256
def solution(a, b):
    if max(a) < min(b):
        return 'No War'
    else:
        return 'War'

def main():
    n, m, x, y = [int(i) for i in raw_input().strip().split()]
    a = [x] + [int(i) for i in raw_input().strip().split()]
    b = [y] + [int(i) for i in raw_input().strip().split()]
    print(solution(a, b))

if __name__ == '__main__':
    main()


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
//define
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define str string
#define vint vector<int>
#define vvint vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vool vector<bool>
#define vtr vector<str>
#define vvtr vector<vector<str>>
#define pb() push_back()
#define elif else if
#define all(x) x.begin(),x.end()
//function
int shizuku(int);
//UnionFind
struct UnionFind{
  vint par;
  UnionFind(int N):par(N){
    rep(0,N)par[i]=i;
  }
  int root(int x){
    if(par[x]==x)return x;
    return par[x]=root(par[x]);
  }
  void unite(int x,int y){
    int rx=root(x);
    int ry=root(y);
    if(rx==ry)return;
    par[rx]=ry;
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
};

signed main(){
    int pow,D,G,N,M,X,count=0,count2=0;
    double d;
    int C='A'-'a';
    char op;
    str T;
    cin>>N;
    vint A(N);
    if(to_string(N).size()==1)cout<<N<<endl;
    if(to_string(N).size()==3)cout<<9+(N-99)<<endl;
    if(to_string(N).size()==5)cout<<9+900+(N-9999)<<endl;
    if(to_string(N).size()==4)cout<<909<<endl;
    if(to_string(N).size()==2)cout<<9<<endl;
    if(to_string(N).size()==6)cout<<90909<<endl;

}


Measured memory_bytes: 1024
import java.util.*;

public class Main {

    public static double dp[][][] = new double[301][301][301];

    public static double solve(int x,int y,int z,int  n){
        if(x < 0 || y < 0 || z < 0) return 0;
        if(x == 0 && y == 0 && z == 0) return  0;
        if(dp[x][y][z] > -0.9){
            return dp[x][y][z];
        }
        double exp = n + x * solve(x-1,y,z,n) + y * solve(x+1,y-1,z,n) + z * solve(x,y+1,z-1,n);
        return dp[x][y][z] = exp/(x+y+z);
    }

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int one = 0;
        int two = 0;
        int three = 0;

        for(int i=1;i<=n;i++){
            int temp = sc.nextInt();
            if(temp == 1){
                one++;
            }
            else if(temp == 2){
                two++;
            }
            else{
                three++;
            }
        }

        for(int i=0;i<=300;i++){
            for(int j=0;j<=300;j++){
                for(int k=0;k<=300;k++){
                    dp[i][j][k] = -1;
                }
            }
        }

        System.out.println(solve(one,two,three,n));
    }
}

Measured memory_bytes: 304340
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cstdio>
#include <tuple>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

template <int N>
struct UnionFind {
    int ig[N];
    int d[N];
    vector<int> gi[N];
    int dc;
    void init(int n = N) {
        for (int i = 0; i < n; ++i) {
            ig[i] = d[i] = i;
            gi[i] = {i};
        }
        dc = 0;
    }
 
    void merge(int a, int b) {
        if (same(a, b)) return;
        dc++;
        int x = ig[a], y = ig[b];
        d[x] = d[y];
        if (gi[x].size() < gi[y].size()) swap(x, y);
        for (int j: gi[y]) {
            ig[j] = x;
        }
        gi[x].insert(gi[x].end(), gi[y].begin(), gi[y].end());
        gi[y].clear();
    }
 
    bool same(int a, int b) {
        return ig[a] == ig[b];
    }
    int get(int a) {
        return d[ig[a]];
    }
};


const int MN = 100100;
P q[MN];
int root[MN];
bool ism[MN];
UnionFind<MN> uf;

int main() {
    while (true) {
        int n, m;
        scanf("%d %d\n", &n, &m);
        if (!n) break;
        uf.init(n);
        fill_n(ism, n, false);
        ism[0] = true;
        for (int i = 1; i < n; i++) {
            int u;
            scanf("%d\n", &u); u--;
            //assert(u < i);
            root[i] = u;
        }
        for (int i = 0; i < m; i++) {
            char c; int d;
            scanf(" %c %d\n", &c, &d); d--;
            if (c == 'Q') {
                q[i] = P(0, d);
            } else {
                if (ism[d]) {
                    q[i] = P(2, d);
                } else {
                    ism[d] = true;
                    q[i] = P(1, d);
                }
            }
        }
        for (int i = 0; i < n; i++) {
            if (ism[i]) continue;
            uf.merge(i, root[i]);
        }
        ll res = 0;
        for (int i = m-1; i >= 0; i--) {
            int a, b;
            tie(a, b) = q[i];
            if (a == 2) continue;
            if (a == 1) {
                uf.merge(b, root[b]);
            } else {
                res += uf.get(b)+1;
            }
        }
        printf("%lld\n", res);
    }
    return 0;
}

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

signed main() {
  int h,w,a,b;
    scanf("%d%d%d%d",&h,&w,&a,&b);
    	std::string s(a,'0');
    	std::string t(w-a,'1');
        std::string ans=s+t;
  		std::string S(a,'1');
  		std::string T(w-a,'0');
  		std::string Ans=S+T;
  for(int i=0;i<h;++i){
    if(i<b){
    	printf("%s\n",ans.c_str());
    }
    else{
    	printf("%s\n",Ans.c_str());
    }
  }
}

Measured memory_bytes: 3704
<?php
# 整数の入力
fscanf(STDIN,"%d %d %d",$a,$b,$c);
$arrat = [5 => 0,7=>0];
if($a === 5 || $a === 7){
	$arrat[$a] = $arrat[$a] + 1;
}

if($b === 5 || $b === 7){
	$arrat[$b] = $arrat[$b] + 1;
}

if($a === 5 || $a === 7){
	$arrat[$c] = $arrat[$c] + 1;
}


if($arrat[5] === 2 &&$arrat[7] === 1){
	echo 'YES';
}else{
echo 'NO';
}



Measured memory_bytes: 3828
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

typedef long long LL;

const int N = 300010, M = 300010, K = 300010;
const LL MOD = 1E9 + 7;

inline void Add(LL &a, LL b) {
    a = (a + b) % MOD;
    return;
}
inline void Dec(LL &a, LL b) {
    a = ((a - b) % MOD + MOD) % MOD;
    return;
}

LL Pow(LL a, LL b) {
    LL c = 1;
    while (b) {
        if (b & 1) c = c * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return c;
}

int n, m, k, cnt;

LL fac[N + M + K], fac_ie[N + M + K], f[N + M + K], t[N + M + K];

void Pre() {
    fac[0] = 1;
    for (int i = 1; i <= cnt; ++i)
        fac[i] = fac[i - 1] * i % MOD;
    fac_ie[cnt] = Pow(fac[cnt], MOD - 2);
    for (int i = cnt; i; --i)
        fac_ie[i - 1] = fac_ie[i] * i % MOD;
    t[0] = 1;
    for (int i = 1; i <= cnt; ++i)
        t[i] = t[i - 1] * 3 % MOD;
    return;
}

inline LL C(int a, int b) {
    return fac[a] * fac_ie[b] % MOD * fac_ie[a - b] % MOD;
}

int main() {
    scanf("%d%d%d", &n, &m, &k);
    cnt = n + m + k;
    Pre();
    f[0] = 1;
    for (int i = 1; i <= m + k; ++i) {
        f[i] = (f[i - 1] << 1) % MOD;
        if (i >= m + 1) Dec(f[i], C(i - 1, m));
        if (i >= k + 1) Dec(f[i], C(i - 1, k));
    }
    LL res = 0;
    for (int i = n; i <= cnt; ++i)
        Add(res, C(i - 1, n - 1) * f[i - n] % MOD * t[cnt - i]);
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 28416
#line 2 "/Users/kaage/Desktop/ProgrammingWorkspace/library/other/template.hpp"
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define all(V) V.begin(),V.end()
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
typedef std::pair<lint, lint> LP;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, lint b) {
	if (!b)return T(1);
	if (b & 1)return mypow(a, b - 1) * a;
	T memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
#line 2 "main.cpp"
int n;
lint d;
int main(){
	std::cin>>n>>d;
	int ans=0;
	rep(i,n){
		lint x,y;
		std::cin>>x>>y;
		if(x*x+y*y<=d*d)ans++;
	}
	std::cout<<ans<<std::endl;
	return 0;
}

Measured memory_bytes: 3632
/*+lmake
 * STD = c++14
 * DEFINE += MDEBUG
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
#ifdef DEBUG
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

void solve(string s, long long K){
	vector<string> v;
	for(size_t i=0; i<s.length(); ++i) {
		for(size_t j=1; j+i-1<=s.length() && j<=K; ++j) {
			v.push_back(s.substr(i,j));
		}
	}
	std::sort(v.begin(),v.end());
	std::unique(v.begin(),v.end());
	cout<<v[K-1]<<endl;
}

int main(){	
	string s;
	long long K;
	cin >> s;
	scanf("%lld",&K);
	solve(s, K);
	return 0;
}



Measured memory_bytes: 1660
var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  const x = Number.parseInt(lines[0].split(' ')[0]);
  const y = Number.parseInt(lines[0].split(' ')[1]);
  console.log((x * y) + ' ' + (2 *x + 2 * y));
});


Measured memory_bytes: 16220
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// solution 
use std::cmp;
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        N: usize,
        K: usize,
        A: [u32; N],
    }

    println!("{}", (N-1 + K-2) / (K - 1));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  int N;
  cin >> N;

  vector<pair<int,int>> ball(N);
  for (int i = 0; i < N; i++) {
    int x,y; cin >> x >> y;
    ball[i] = make_pair(x,y);
  }
  sort(ball.begin(), ball.end());

  map<pair<int,int>,int> cnt;
  for (int i = 0; i < N-1; i++) {
    for (int j = i+1; j < N; j++) {
      int x = ball[j].first - ball[i].first;
      int y = ball[j].second - ball[i].second;
      cnt[make_pair(x,y)]++;
    }
  }

  int ans = 0;
  for (auto v : cnt) {
    if (v.first.first == 0 && v.first.second == 0) continue;
    ans = max(ans, v.second);
  }
  ans = N-ans;
  cout<<ans<<endl;
}


Measured memory_bytes: 384