akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const ll MOD = 1e9+7;

bool isPalindrome(string s){
	int n = s.size();
	for(int i = 0; i < n/2; i++){
		if(s[i] != s[n-i-1]) return false;
	}
	return true;
}

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

	int l; cin >> l;

	auto f = [&](double a){
		double q = l-2*a;
		return a*q*l - a*a*q - q*q*a;
	};

	double a = 0, b = l;
	FOR(i, 300){
		double m1 = a + (b-a)/3;
		double m2 = b - (b-a)/3;
		double f1 = f(m1), f2 = f(m2);
		if(f1 < f2)
			a = m1;
		else
			b = m2;
	}

	cout << setprecision(8) << fixed << f(b) << '\n';

	return 0;
}

Measured memory_bytes: 256
[A,B,C] = list(map(int,input().split()))
K = int(input())

ini = [A,B,C]
from itertools import permutations, combinations,combinations_with_replacement,product
a=['A','B','C']
Ls = list(combinations_with_replacement(a,K))

ans=0
for L in Ls:
    ini=[A,B,C]
    # print('ini:',ini)
    # print('L:',L)
    for i in L:
        # print('i:',i)
        if i=='A':
            ini[0]*=2
        elif i=='B':
            ini[1]*=2
        elif i=='C':
            ini[2]*=2
    ans=max(ans,sum(ini))
    # print('ans:',ans)

print(ans)


Measured memory_bytes: 62136
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define loop(i,L,R) for(int i=(L);i<=(R);i++)
const int maxn=1e5+5;
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    printf("%d\n",n-k+1);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>

int main(){
    int i;
    char ch;
    while(1){
        ch = getchar();
        if(ch == '\n')break;

        if(islower(ch)) printf("%c", toupper(ch));
        else if(isupper(ch)) printf("%c", tolower(ch));
        else printf("%c", ch);
    }
    putchar('\n');
}


Measured memory_bytes: 2064
#include <stdio.h>
struct point{
    int x;
    int y;
    void init(){
        x=0;
        y=0;
    };
};
int main(){
    int h,w;
    point now;
    char a[100][100];
    bool went[100][100];
    while(1){
        scanf("%d%d",&h,&w);
        if(h==0)return 0;
        for(int i=0;i<h;i++){
            scanf("%s",a[i]);
            for(int j=0;j<w;j++)went[i][j]=false;
        }
        now.init();
        while(a[now.x][now.y]!='.'){
            if(went[now.x][now.y]){
                printf("LOOP\n");
                break;
            }
            went[now.x][now.y]=true;
            if(a[now.x][now.y]=='v')now.x++;
            else if(a[now.x][now.y]=='^')now.x--;
            else if(a[now.x][now.y]=='<')now.y--;
            else if(a[now.x][now.y]=='>')now.y++;
        }
        if(a[now.x][now.y]=='.')printf("%d %d\n",now.y,now.x);
    }
}

Measured memory_bytes: 2684
import java.util.*;

public class Main{
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args){
        String s = sc.next();
        int tail = s.length();
        String ans = "NO";
        while(tail > 0){
            if(tail >= 5 && s.substring(tail - 5, tail).equals("dream")){
                tail -= 5;
            }else if(tail >= 7 && s.substring(tail - 7, tail).equals("dreamer")){
                tail -= 7;
            }else if(tail >= 5 && s.substring(tail - 5, tail).equals("erase")){
                tail -= 5;
            }else if(tail >= 6 && s.substring(tail - 6, tail).equals("eraser")){
                tail -= 6;
            }else{
                System.out.println("NO");
                return;
            }
        }

        if(tail == 0) ans = "YES";
        System.out.println(ans);
    }
}

Measured memory_bytes: 28068
N = int(input())
A = list(map(int,input().split()))
suma = sum(A)
unit = N*(N+1)//2
if suma % unit:
    print('NO')
    exit()
ope = suma // unit

d = A[0]-A[-1]
for a,b in zip(A,A[1:]):
    if (b-a)%N != d%N:
        print('NO')
        exit()

AA = A + [A[0]]
k = 0
for a,b in zip(AA,AA[1:]):
    if b-a > ope:
        print('NO')
        exit()
    k += (ope - (b-a)) // N

print('YES' if k==ope else 'NO')

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

using namespace std;
#define lint long long



int main() {
    double a, b;
    cin >> a >> b;
    
    double c;
    c = 1. / a + 1/ b;
    
    double d;
    d = 1. / c;
    
    constexpr int e = std::numeric_limits<float>::max_digits10;
    cout << setprecision(e) <<  1. / c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define int long long
#define double long double
const int INF = 1e18, MOD = 1e9 + 7;

signed main() {
    int n, a;
    int sum[111111] = {};
    cin>>n;
    for (int i = 0; i <= n; i++) {
        cin>>a;
        if (i == 0 && a != 0 && !(a == 1 && n == 0)) {
            cout<<-1<<endl;
            return 0;
        }
        sum[i + 1] = sum[i] + a;
    }
    int ans = 0, cnt;
    for (int i = 0; i <= n + 1; i++) {
        if (i == 0) cnt = 1;
        else {
            a = sum[i] - sum[i - 1];
            if (cnt < a) {
                cout<<-1<<endl;
                return 0;
            }
            cnt -= a;
            cnt *= 2;
        }
        
        cnt = min(cnt, sum[n + 1] - sum[i]);
        ans += cnt;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4436
#include<bits/stdc++.h>
namespace ZDY{
#define fir freopen("2.in","r",stdin)
#define ll long long
#define Fur(i,x,y) for(int i=x;i<=y;i++)
#define fur(i,x,y) for(i=x;i<=y;i++)
#define Fdr(i,x,y) for(int i=x;i>=y;i--)
#define in2(x,y) in(x),in(y)
#define in3(x,y,z) in2(x,y),in(z)
#define in4(a,b,c,d) in2(a,b);in2(c,d)
#define clr(x,y) memset(x,y,sizeof(x))
#define cpy(x,y) memcpy(x,y,sizeof(x))
#define fl(i,x) for(ll i=head[x],to;to=e[i].to,i;i=e[i].next)
#define inf 2147483647
}
namespace FAST{
#define pob (fwrite(fob::b,sizeof(char),fob::f-fob::b,stdout),fob::f=fob::b,0)
#define pc(x) (*(fob::f++)=(x),(fob::f==fob::g)?pob:0)
#define gc ((*fib::f)?(*(fib ::f++)):(fgets(fib::b,sizeof(fib::b),stdin)?(fib::f=fib::b,*(fib::f++)):-1))
namespace fib{char b[300000]= {},*f=b;}
inline void in(ll &x){x=0;char c;bool f=0;while((c=gc)>'9'||c<'0')if(c=='-')f=!f;x=c-48;while((c=gc)<='9'&&c>='0')x=x*10+c-48;if(f)x=-x;}
inline void in(int &x){x=0;char c;bool f=0;while((c=gc)>'9'||c<'0')if(c=='-')f=!f;x=c-48;while((c=gc)<='9'&&c>='0')x=x*10+c-48;if(f)x=-x;}
namespace fob{char b[300000]= {},*f=b,*g=b+300000-2;}struct foce{~foce(){pob;fflush(stdout);}} _foce;namespace ib{char b[100];}
inline void out(ll x){if(x==0){pc(48);return;}if(x<0){pc('-');x=-x;}char *s=ib::b;while(x) *(++s)=x%10,x/=10;while(s!=ib::b) pc((*(s--))+48);}inline void outn(ll x){out(x);pc('\n');}
inline void out(int x){if(x==0){pc(48);return;}if(x<0){pc('-');x=-x;}char *s=ib::b;while(x) *(++s)=x%10,x/=10;while(s!=ib::b) pc((*(s--))+48);}inline void outn(int x){out(x);pc('\n');}
inline char sc(){char c=gc;while(!(('A'<=c&&c<='Z')||('a'<=c&&c<='z')||('0'<=c<='9')))c=gc;return c;}
inline ll jdz(ll x){return x>0?x:-x;}
inline ll max(ll x,ll y){return x>y?x:y;}
}using namespace FAST;using namespace ZDY;using namespace std;
#define N 111
char a[N],b[N];
int n;
int main(){
	scanf("%s%s",a+1,b+1);
	n=strlen(a+1);
	Fur(i,1,n)a[i+n]=a[i];
	Fur(i,1,n){
		bool f=1;
		Fur(j,1,n)
		if(a[i+j-1]!=b[j]){f=0;break;}
		if(f){printf("Yes\n");return 0;}
	}
	printf("No\n");
}

Measured memory_bytes: 256
n,m=map(int, input().split())
alist=[list(map(int, input().split())) for i in range(m)]
ans=-1
if n==1:
  for i in range(9,-1,-1):
    x=True
    stri=str(i)
    for j in range(m):
      if stri[alist[j][0]-1]!=str(alist[j][1]):
        x=False
    if x:
      ans=i
else:
  for i in range(10**n-1,10**(n-1)-1,-1):
    x=True
    stri=str(i)
    for j in range(m):
      if stri[alist[j][0]-1]!=str(alist[j][1]):
        x=False
    if x:
      ans=i
print(ans)

Measured memory_bytes: 9172
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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 S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll X, K, D;

int main() {
  std::cin >> X >> K >> D;

  ll x = X;

  if( X < 0 )
    x *= -1;

  ll q = x/D;

  if( q > K ) {
    x -= K*D;

    std::cout << llabs(x) << endl;

    return 0;
  }

  x -= q*D;
  K -= q;

  if( K&1 ) {
    x -= D;
  }

  std::cout << llabs(x) << endl;

  return 0;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

const int INF = 1000000000;
const double PI = 3.1415926535897932384626433832795;

// N, E, S, W
const int dx[4] = { 1, 0, -1, 0};
const int dy[4] = { 0, 1, 0, -1};

using LL = long long int;
using LD = long double;
using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;

//==============================================

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

	LL a, b, c;
	cin >> a >> b >> c;

	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
		cout << "0" << "\n";
		return 0;
	}

	cout << min(a * b, min(a * c, b * c)) << "\n";
	return 0;
}

Measured memory_bytes: 256
l, r = gets.split.map(&:to_i)
if r - l + 1 >= 673
    puts 0
elsif r == 672 && l == 673
    puts 672
else
    mods = (l..r).map{|it| it % 2019}
    puts mods.combination(2).map{|a, b| a * b % 2019}.min
end


Measured memory_bytes: 2684
using System;
using System.Collections.Generic;
using System.Linq;
// using System.Linq;

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            int[] ab = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int N = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] AB = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
            // List<long> kl=new List<long>(hs.Keys);
            // kl.Sort();
            // foreach(long k in kl){
            //     s[1]-=hs[k];
            //     if(s[1]<1){Console.WriteLine("{0}",k);break;}
            // }
            int time = ab[0]+ab[1];
            if(time>=24){
                time -=24;
            }
            Console.WriteLine(time);
        }
        //最小公倍数
        static long Lcm(long a, long b)
        {
            return a/Gcd(a,b)*b;
        }

        //最大公約数
        static long Gcd(long m, long n)
        {
            if(n==0)return m;
            return Gcd(n,m%n);
        }
    }
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

signed main()
{
  int n;

  while (cin >> n, n){
    vi v;
    int sum = 0;

    rep(i, n) v.pb(in());
    sort(all(v));
    for (int i = 1; i < n - 1; i++) sum += v[i];
    print(sum / (n - 2));
  }

  return (0);
}

Measured memory_bytes: 3088
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextssort(n,a){return a?cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>b-a):cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>a-b);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}
var streams=[];function print(s){streams.push(s);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));
if(streams.length)console.log(streams.join("\n"));

function main(){
  var n = next();
  var x = 0;
  for(var i = 0; i < n; i++){
    var [a,b] = nexts(2);
    if(a === b)x++;else x = 0;
    if(x === 3)return "Yes";
  }
  return "No";
}

Measured memory_bytes: 29712
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int n;

i64 x[202020][2];

int main(){
	cin >> n;
	rep(i,1,n) cin >> x[i][0] >> x[i][1];
	rep(i,1,n) if(x[i][0] < x[i][1]) swap(x[i][0] , x[i][1]);
	x[0][0] = 0;
	x[0][1] = 1e9;
	int MAX = 0;
	int MIN = 0;
	rep(i,1,n){
		if(x[MAX][0] < x[i][0]) MAX = i;
		if(x[MIN][1] > x[i][1]) MIN = i;
	}
	i64 result = 1e18;
	//patten 1. Rmax = MAX , Rmin = MIN
	if(MAX != MIN){
		i64 RMAX = x[MAX][0];
		i64 BMIN = x[MIN][1];
		i64 RMIN = 1e9;
		i64 BMAX = 0;
		rep(i,1,n){
				RMIN = min(RMIN,x[i][0]);
				BMAX = max(BMAX,x[i][1]);
		}
		result = (RMAX - RMIN) * (BMAX - BMIN);
	}

	//patten2 . Rmax = MAX,Rmin = MIN
	{
		i64 RDIF = x[MAX][0] - x[MIN][1];
		set<P> st;
		rep(i,1,n) st.insert({x[i][0],i});
		while(true){
			i64 BDIF = (st.rbegin()->first) - (st.begin()->first);
			result = min(result , RDIF * BDIF);

			P p = *st.rbegin();
			st.erase(*st.rbegin());
			if(p.second == -1) break;
			st.insert({x[p.second][1] , -1});
		}
	}

	cout << result << endl;
}


Measured memory_bytes: 15872
# -*- coding: utf-8 -*-

import math

n = int(input())
a = list(map(int, input().split()))

#aを昇順でSort
a.sort()
a.reverse()

sumA = 0
sumB = 0

# print(a)
sumA = sum(a[0::2])

sumB = sum(a[1::2])
print(sumA-sumB)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
	int A,B,C;
	cin>>A;
	if(A==1){
		cout<<"Hello World";
	}else{
		cin>>B>>C;
		cout<<B+C;
	}
}


Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.math;
import std.string;
import std.conv;
import std.range;

void main() {
    while (true) {
        int n = readln.chomp.to!int;
        if (n == 0) break;

        int[] ice = new int[10];
        foreach (i; 0..n) {
            ice[readln.chomp.to!int]++;
        }

        foreach (e; ice) {
            if (e == 0) {
                writeln("-");
            } else {
                foreach (i; 0..e) {
                    write("*");
                }
                writeln;
            }
        }
    }
}

Measured memory_bytes: 1504
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N;
	string s,bs;
	set<string>ss;
	cin>>N;
	for(int i=0;i<N;i++)
	{
		cin>>s;
		if(ss.find(s)!=ss.end())
		{
			cout<<"No"<<endl;
			return 0;
		}
		if(!(i==0||(bs[bs.length()-1]==s[0])))
		{
			cout<<"No"<<endl;
			return 0;
		}
		bs=s;
		ss.insert(s);
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
/*input
3 7
9 3 4
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> 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())
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 ld PI=acos(-1);
const ld eps=1e-9;
//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;
		a=a*a;
		
		b>>=1;
	}
	return res;
}
int a[maxn];

int main(){
	IOS;
	int n,k;
	cin>>n>>k;
	REP(i,n) cin>>a[i];

	int g=0;
	REP(i,n) g=__gcd(g,a[i]);

	sort(a,a+n);
	if(k<=a[n-1]&&k%g==0) cout<<"POSSIBLE\n";
	else cout<<"IMPOSSIBLE\n";

	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define MOD 998244353

struct BIT {
	std::vector<int> data;
	int n;
	BIT(int n) {
		this->n = n;
		data.resize(n + 1);
	}
	void add(int i, int val) {
		for (i++; i <= n; i += i & -i) data[i] += val;
	}
	int sum(int i) {
		int res = 0;
		for (; i; i -= i & -i) res += data[i];
		return res;
	}
};

#ifdef _WIN32
#	define getchar_fast _getchar_nolock
#else
#	define getchar_fast getchar_unlocked
#endif
int ri() {
	int r = 0, c, s = 0;
	for (;;) {
		c = getchar_fast();
		if (c == '-') {
			s = 1;
			break;
		}
		if (c <= '9' && c >= '0') {
			r = c - '0';
			break;
		}
	}
	for (;;) {
		c = getchar_fast();
		if (c < '0' || c > '9') break;
		r = r * 10 + c - '0';
	}
	if (s) r = -r;
	return r;
}

struct Point {
	int x;
	int y;
	int id;
};

int main() {
	int n = ri();
	Point a[n];
	for (int i = 0; i < n; i++) a[i].x = ri(), a[i].y = ri(), a[i].id = i;
	
	int b2[n + 3];
	b2[0] = 1;
	for (int i = 1; i <= n + 2; i++) {
		b2[i] = b2[i - 1] + b2[i - 1];
		if (b2[i] >= MOD) b2[i] -= MOD;
	}
	
	std::sort(a, a + n, [](const Point &a, const Point &b) { return a.y < b.y; });
	int cnt = 0;
	for (auto &i : a) i.y = cnt++;
	std::sort(a, a + n, [](const Point &a, const Point &b) { return a.x < b.x; });
	
	BIT tree(cnt);
	int64_t res = 0;
	for (int i = 0; i < n; i++) {
		int v = tree.sum(a[i].y);
		res += b2[v];
		res += b2[i - v];
		res += b2[a[i].y - v];
		res += b2[n - a[i].y - 1 - i + v];
		
		tree.add(a[i].y, 1);
	}
	res += (int64_t) (b2[n] - 1) * n;
	res -= b2[n + 2] - 4;
	std::cout << res % MOD << std::endl;
	
	return 0;
}


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

int main(){
  int N,M;
  
  cin >> N >> M;
  vector<int> L(M);
  vector<int> R(M);
  for(int i = 0; i<M;i++){
    cin >> L.at(i) >> R.at(i);
  }
  int LMax=0;
  int RMin=1000000;
  int res;
  for(int i = 0;i<M;i++){
    if(LMax < L.at(i)) LMax = L.at(i);
    if(RMin > R.at(i)) RMin = R.at(i);
  }
  if(RMin >= LMax){
    cout << RMin - LMax + 1 << endl;
  }else cout << 0 << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; }
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(b-a==c-b) cout<<"YES";
    else cout<<"NO";
    
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int, input().split()))

    dp = [[[0.0 for k in range(N + 1)]for j in range(N + 1)]for i in range(N + 1)]


    one = A.count(1)
    two = A.count(2)
    three = A.count(3)

    for k in range(three + 1):
        for j in range(two + three + 1 - k):
            for i in range(one + two + three + 1 -k -j):
                if i == 0 and j == 0 and k == 0:
                    continue
                ret = N * 1.0
                if i > 0:
                    ret += dp[i - 1][j][k] * i
                if j > 0:
                    ret += dp[i + 1][j - 1][k] * j 
                if k > 0:
                    ret += dp[i][j + 1][k -1] * k

                dp[i][j][k] = ret / (i + j + k)

    print(dp[one][two][three])

main()


Measured memory_bytes: 260488
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
typedef pair<ll, int> P;
ll X[100000];
int W[100000];
ll ans[100000];
ll N, L, T;
int get_num(int k) {
	ll cnt = 0;
	for (int i = 0; i < N; i++) {
		if (W[k] == W[i]) continue;
		double t = 0;
		if (W[k] == 1) {
			if (X[i] > X[k]) t = (X[i] - X[k]) / 2.0;
			else t = (X[i] + L - X[k]) / 2.0;
		}
		else {
			if (X[i] > X[k]) t = (L - X[i] + X[k]) / 2.0;
			else t = (X[k] - X[i]) / 2.0;
		}
		if (T < t) continue;
		(cnt += (ll)((T - t) / (L / 2.0)) + 1) %= N;
	}
	ll ret = k;
	if (W[k] == 1) (ret += cnt) %= N;
	else (ret += N - cnt) %= N;
	return ret;
}
int main() {
	cin >> N >> L >> T;
	for (int i = 0; i < N; i++) {
		cin >> X[i] >> W[i];
	}
	vector<P> pos;
	for (int i = 0; i < N; i++) {
		if (W[i] == 1) pos.emplace_back((X[i] + T) % L, i);
		else pos.emplace_back((X[i] + (L - T % L)) % L, i);
	}
	sort(pos.begin(), pos.end());
	int idx = get_num(pos[0].second);
	ans[idx] = pos[0].first;
	for (int i = 1; i < N; i++) {
		(idx += 1) %= N;
		if (pos[i].first == pos[0].first) {
			int t = get_num(pos[i].second);
			ans[t] = pos[i].first;
		}
		else {
			ans[idx] = pos[i].first;
		}
	}
	for (int i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 4848
#include <iostream>
using namespace std;
int main(void){
    long long N,i,sum=0;
    cin >> N;
    if(N>500000000){
        sum=14384;
        for(i=500000003;i<N+1;){
        long long a=0,b=0,c=0,d=1,n=i;
        for(;n>0;){
            if(n%10==3){
                a=1;
            }else if(n%10==5){
                b=1;
            }else if(n%10==7){
                c=1;
            }else{
                d=0;
                break;
            }
            n=n/10;
        }
        if(a*b*c*d==1){
            sum++;
        }
        if(i%10==7){
            i+=6;
        }else{
            i+=2;
        }
    }
    cout << sum << endl;
    return 0;
    }
    for(i=3;i<N+1;){
        long long a=0,b=0,c=0,d=1,n=i;
        for(;n>0;){
            if(n%10==3){
                a=1;
            }else if(n%10==5){
                b=1;
            }else if(n%10==7){
                c=1;
            }else{
                d=0;
                break;
            }
            n=n/10;
        }
        if(a*b*c*d==1){
            sum++;
        }
        if(i%10==7){
            i+=6;
        }else{
            i+=2;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################

signed main(){
    int d;cin >> d;
    int c[26];rep(i,26)cin >> c[i];
    int s[d][26];
    rep(i,d)rep(j,26)cin >> s[i][j];
    vector<int> ans(d);
    vector<int> last(26,-1);//last[j]:jコメのコンテストの最後に参加した日
    int satisfaction = 0;
    rep(i,d){
        int curmax = -1001001001;
        int mxcontest = -1;
        rep(j,26){
            //jに出ると仮定して満足度を計算
            satisfaction += s[i][j];
            int pre = last[j];
            last[j] = i;
            rep(k,26){
                satisfaction -= c[k]*(i-last[k]);
            }
            if(satisfaction > curmax){
                curmax = satisfaction;
                mxcontest = j;
            }
            rep(k,26){
                satisfaction += c[k]*(i-last[k]);
            }

            satisfaction -= s[i][j];
            last[j] = pre;

        }
        
        satisfaction = curmax;
        last[mxcontest] = i;
        ans[i] = mxcontest+1;
        //trace(i,satisfaction,mxcontest+1);


    }
    rep(i,d)cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 3720
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(X: int, K: int, D: int):
    X = abs(X)
    mx = K * D
    tmp = X % D
    #print(mx, tmp, X - tmp)
    if mx < X - tmp:
        ret = X - mx
    elif (X - tmp) // D == K:
        ret = tmp
    else:
        d = X - tmp
        n = d // D
        if n % 2 == K % 2:
            ret = tmp
        else:
            ret = abs(tmp - D)
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    solve(X, K, D)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61840
n = int(input())
tmp = 0
import sys
for i in range(n):
    d = list(map(int,input().split()))
    if d[0] == d[1]:
        tmp += 1
        #check
        if tmp == 3:
            print('Yes')
            sys.exit()
    else:
        tmp = 0
print('No')

Measured memory_bytes: 9076
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String isDiff = "No";

		char station = S.charAt(0);
		for (int i = 1; i < 3; i++) {
			char temp = S.charAt(i);
			if (station != temp) {
				isDiff = "Yes";
			}
		}

		System.out.println(isDiff);

		sc.close();
	}
}

Measured memory_bytes: 23764
x = int(input())
 
a = [i**5 for i in range(1000)]
for i in range(120):
    for j in range(120):
        if a[i] - a[j] == x:
            print(i, j)
            exit()
        if a[i] + a[j] == x:
            print(i, -j)
            exit()

Measured memory_bytes: 8964
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int M = 1e9+7;
const int INF = 1<<30;

int _;
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll qpow(ll a,ll b) {ll s=1;while(b){if(b&1)s=(s*a)%M;b>>=1;a=(a*a)%M;}return s;}

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

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

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

bool is_prime(int n) {
    if (n <= 1) return false;
    for (int p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}

int main() {
    int x;
    cin >> x;
    while(!is_prime(x)) ++x;
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
#define Pair pair<int, int>
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
#define int long long 
#define LL long long 
#define Fin(x) {freopen(#x".in","r",stdin);}
#define Fout(x) {freopen(#x".out","w",stdout);}
using namespace std;
const int MAXN = 1e6 + 10, mod = 1e9 + 7, INF = 1e9 + 10;
const double eps = 1e-9;
template <typename A, typename B> inline bool chmin(A &a, B b){if(a > b) {a = b; return 1;} return 0;}
template <typename A, typename B> inline bool chmax(A &a, B b){if(a < b) {a = b; return 1;} return 0;}
template <typename A, typename B> inline LL add(A x, B y) {if(x + y < 0) return x + y + mod; return x + y >= mod ? x + y - mod : x + y;}
template <typename A, typename B> inline void add2(A &x, B y) {if(x + y < 0) x = x + y + mod; else x = (x + y >= mod ? x + y - mod : x + y);}
template <typename A, typename B> inline LL mul(A x, B y) {return 1ll * x * y % mod;}
template <typename A, typename B> inline void mul2(A &x, B y) {x = (1ll * x * y % mod + mod) % mod;}
template <typename A> inline void debug(A a){cout << a << '\n';}
template <typename A> inline LL sqr(A x){return 1ll * x * x;}
inline int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int N, a[MAXN];
map<int, int> mp;
signed main() {
	N = read();
	for(int i = 1; i <= N; i++) a[i] = read();
    for(int i = 1; i <= N; i++) {
    	int x = 0;
		for(int j = i; j <= min(N, i + 10); j++) {
    		x = x * 10 + a[j];
    		mp[x] = 1;
		}
	}
	int lim = 1e6 + 1;
    for(int i = 0; i <= lim; i++) if(!mp[i]) {cout << i  << '\n'; return 0;}
    return 0;
}
/*
20
1 8 4 4 6 7 4 4 0 7 3 7 0 9 5 5 1 6 1 8
*/


Measured memory_bytes: 3584
#include <stdio.h>
#include <algorithm>

using namespace std;

int H;

void maxHeapify(long long array[],int i){
	int left = 2*i;
	int right = 2*i + 1;
	if(left > H) return;
	int largest = i;
	if(right <= H){
		if((array[right] > array[left]) && (array[right] > array[i])){
			largest = right;
		}else if((array[left] > array[right]) && (array[left] > array[i])){
			largest = left;
		}
	}else{
		if(array[i] < array[left]){
			largest = left;
		}
	}
	if(largest != i){
		swap(array[i],array[largest]);
		maxHeapify(array, largest);
	}
}

void buildMaxHeap(long long array[]){
	for(int i = H/2; i >=1; i--) maxHeapify(array,i);
}

int main(){
	scanf("%d",&H);
	long long array[H+1];

	for(int i = 1; i <= H; i++) scanf("%lld",&array[i]);

	buildMaxHeap(array);

	for(int i = 1; i <= H; i++) printf(" %lld",array[i]);
	printf("\n");
}



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

#define CheckNumber(number, limitLow, limitHigh) (	\
		(number) >= limitLow		&&				\
		(number) <= limitHigh						\
)

typedef struct {
	long** matrix;
	int rowSize;
	int columnSize;
} Matrix;

void InputNumber1(long* number, int limitLow, int limitHigh);
void InputNumber3(int* number1, int* number2, int* number3, int limitLow, int limitHigh);

void GetMatrix(Matrix* matrix, const int rowSize, const int columnSize);
void MulMatrix(Matrix* newMatrix, Matrix* a, Matrix* b);

void FreeMatrix(Matrix* matrix);

int main(void) {
	int rowSize;
	int commonSize;
	int columnSize;

	Matrix a;
	Matrix b;
	Matrix res;

	int idr;
	int idc;

	InputNumber3(&rowSize, &commonSize, &columnSize, 1, 100);
	GetMatrix(&a, rowSize, commonSize);
	GetMatrix(&b, commonSize, columnSize);

	for (idr = 0; idr < a.rowSize; idr++) {
		for (idc = 0; idc < a.columnSize; idc++) {
			InputNumber1((*(a.matrix + idr) + idc), 0, 10000);
		}
	}

	for (idr = 0; idr < b.rowSize; idr++) {
		for (idc = 0; idc < b.columnSize; idc++) {
			InputNumber1((*(b.matrix + idr) + idc), 0, 10000);
		}
	}

	MulMatrix(&res, &a, &b);

	for (idr = 0; idr < res.rowSize; idr++) {
		for (idc = 0; idc < res.columnSize - 1; idc++) {
			printf("%ld ", *(*(res.matrix + idr) + idc));
		}
		printf("%ld\n", *(*(res.matrix + idr)+ idc));
	}

	FreeMatrix(&a);
	FreeMatrix(&b);
	FreeMatrix(&res);

	return 0;
}

void InputNumber1(long* number, int limitLow, int limitHigh) {
	long tmp1;
	do {
		scanf("%ld", &tmp1);
	} while(!CheckNumber(tmp1, limitLow, limitHigh));
	*number = tmp1;
}

void InputNumber3(int* number1, int* number2, int* number3, int limitLow, int limitHigh) {
	int tmp1;
	int tmp2;
	int tmp3;
	do {
		scanf("%d %d %d", &tmp1, &tmp2, &tmp3);
	} while(
			!CheckNumber(tmp1, limitLow, limitHigh) ||
			!CheckNumber(tmp2, limitLow, limitHigh) ||
			!CheckNumber(tmp3, limitLow, limitHigh)
			);
	*number1 = tmp1;
	*number2 = tmp2;
	*number3 = tmp3;
}

void GetMatrix(Matrix* matrix, const int rowSize, const int columnSize) {
	int idx;
	long** arr = (long**)malloc(sizeof(long*) * rowSize);
	for (idx = 0; idx < rowSize; idx++) {
		*(arr + idx) = (long*)malloc(sizeof(long) * columnSize);
	}
	matrix->matrix = arr;
	matrix->rowSize = rowSize;
	matrix->columnSize = columnSize;
}

void MulMatrix(Matrix* newMatrix, Matrix* a, Matrix* b) {
	const int newRowSize = a->rowSize;
	const int newColumnSize = b->columnSize;

	const int repeat = (a->columnSize == b->rowSize) * a->columnSize;

	int idr;
	int idc;
	int idrp;

	GetMatrix(newMatrix, newRowSize, newColumnSize);
	for (idr = 0; idr < newRowSize; idr++) {
		for (idc = 0; idc < newColumnSize; idc++) {
			long sum = 0;

			for (idrp = 0; idrp < repeat; idrp++) {
				long aVal = *(*(a->matrix + idr) + idrp);
				long bVal = *(*(b->matrix + idrp) + idc);
				sum += aVal * bVal;
			}
			*(*(newMatrix->matrix + idr) + idc) = sum;
		}
	}
}

void FreeMatrix(Matrix* matrix) {
	int rowSize = matrix->rowSize;

	int idr;

	for (idr = 0; idr < rowSize; idr++) {
		free(*(matrix->matrix + idr));
	}
	free(matrix->matrix);
}


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

ll INF = 1e18;
ll MOD = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

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


int main() {
    ll N, K; cin >> N >> K;
    ll ans = 0;
    vector<ll> DP(K+1);
    for(int i = N; K /i ==1 ; i++) DP[i] = 1;
    for(int i = K; i > 0; i--){
        if(K / i == 1) DP[i] = 1;
        else{
            DP[i] += modpow((K/i), N, MOD);
            for(int j =2; j <= (K / i); j++){
                DP[i] -= DP[i*j];
            }
            while(DP[i] < 0) DP[i] += MOD;
            DP[i] %= MOD;
        }
        ans += DP[i]*i;
        ans %= MOD;
    }
    cout << ans << endl;


}

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

#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i,l,r) for (int i=l;i<=r;i++)
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ll long long
#define mod 1000000007
#define random_jbt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

using namespace std;

int main(){
    int n;
    int h=0,ans=0;;
    cin>>n;
    while(n--){
        int x;cin>>x;
        if (x>=h)ans++;
        h=max(h,x);
    }
    cout<<ans;
    return 0;
}


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

namespace io {
    template <typename T> inline void read(T & _x) {
        int f = 0, ch; _x = 0;
        while(!isdigit(ch = getchar())) f |= ch == '-';
        while(isdigit(ch)) _x = _x * 10 + ch - '0', ch = getchar();
        if(f) _x = -_x;
    }
    template <typename T, typename ... Args> inline void read(T &_f, Args& ... args) {
        read(_f), read(args ...);
    }
    inline void _deal(char ch) { putchar(ch); }
    template <typename T> inline void _deal(T _x) {
        if (_x < 0) putchar('-'), _x = -_x;
        if (_x > 9) _deal(_x / 10);
        putchar(_x % 10 + '0');
    }
    inline void write() {}
    template <typename T, typename ... Args> inline void write(T _f, Args ... args) {
        _deal(_f), write(args...);
    }
}

int32_t main() {
	LL n, ans = 0, d;
	std::cin >> n >> d;
	for(int i = 1; i <= n; ++i) {
		LL x, y;
		std::cin >> x >> y;
		if(x * x + y * y <= d * d)
			ans++;
	}
	std::cout << ans;
    return 0;
}


Measured memory_bytes: 3620
import System.IO (isEOF)

main = do
    quit <- isEOF
    if quit then return () else do
        getLine >>= return . solve >>= print
        main

solve :: String -> Int
solve cs = accum 0 $ map c2n cs
    where
    c2n 'I' = 1
    c2n 'V' = 5
    c2n 'X' = 10
    c2n 'L' = 50
    c2n 'C' = 100
    c2n 'D' = 500
    c2n 'M' = 1000

    accum acc []        = acc
    accum acc (n0:n1:ns)
        | n0 < n1       = accum (acc+n1-n0) ns
    accum acc (n:ns)    = accum (acc+n) ns

Measured memory_bytes: 3700
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
ll mypow(ll x, ll n, ll m) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 0) {
		return mypow(x*x%m, n / 2, m);
	}
	else {
		return x * mypow(x, n - 1, m) % m;
	}
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
//テーブルをつくる前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;//mod pにおける1,2,,,nの逆元
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i%INF;
		inv[i] = INF - inv[INF%i] * (INF / i) % INF;
		finv[i] = finv[i - 1] * inv[i] % INF;
	}
}

ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}
///////////////////////////////////////


int main() {
	string n; cin >> n;
	for (int i = 0; i < 3; ++i) {
		if (n[i] == '7') {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
 
using namespace std;


void solve(){
	int n; cin>>n;
	string s; cin>>s;
	if(n%2){
		cout<<"No";
		return;
	}
	for(int i=0; 2*i<n; i++){
		if(s[i] != s[i+n/2]){
			cout<<"No";
			return;
		}
	}
	cout<<"Yes";

}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//cout<<fixed<<setprecision(12);
	
	int t =1; 
	//cin>>t;

	for(int i=1; i<=t; i++){
		solve();
		cout<<"\n";
	}
	return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	#define MAX 30010
	bool sosu[MAX]={1,1,0};
	for(int i=2;i*i<=MAX;i++)if(!sosu[i])
	for(int j=2*i;j<MAX;j+=i)sosu[j]=true;
	vi so;
	rep(i,MAX)if(sosu[i]==0)so.pb(i);
	int n;
	while(cin>>n,n){
		int out=0;
		int m=lower_bound(all(so),n)-so.begin();
		rep(i,m)loop(j,i,m){
			int t=n-so[i]-so[j];
			if(t<so[j])continue;
			if(sosu[t])continue;
			int ma=max(t,max(so[i],so[j]));
			int sum=t+so[i]+so[j];
			if(sum>2*ma)out++;
		}
		cout<<out<<endl;
	}
}

Measured memory_bytes: 1284
while True:
    h,w=map(int,input().split())
    if h==0 and w==0 :
        break
    for i in range(h):
        for j in range(w):
            if i==0 or i==h-1 or j==0 or j==w-1:
                print('#',end='')
            else:
                print('.',end='')
        print()
    print()


Measured memory_bytes: 7008
def get_answer(ki):
    """
    n = ki[0][0]
    q = ki[0][1]
    n_data = ki[1:-q]
    q_index = [0] * n
    for qq in ki[-q:]:
        q_index[qq[0] - 1] += qq[1]
    """
    k0 = ki[0].split(" ")
    n = int(k0[0])
    q = int(k0[1])
    q_index = [0] * n
    for k in ki[-q:]:
        k = k.split(" ")
        q0 = int(k[0])
        q1 = int(k[1])
        q_index[q0 - 1] += q1

    score = [0] * n

    """
        assert get_answer(["4 3",
                       "1 3", "1 4", "2 3",
                       "2 10", "1 100", "3 1"]) == "100 111 101 100"
    """
    t_index = []
    for i in range(0, n + 1):
        t_index.append([])
    for ki_n in ki[1:-q]:
        k = ki_n.split(" ")
        n0 = int(k[0])
        n1 = int(k[1])
        t_index[n0].append(n1)
        t_index[n1].append(n0)

    t_stack = [1]
    s_stack = [0]
    r_flag = [0] * n
    while len(t_stack) > 0:
        i = t_stack.pop()
        s = s_stack.pop()
        if r_flag[i - 1]:
            continue
        r_flag[i - 1] = 1
        s += q_index[i - 1]
        score[i - 1] += s
        t_stack += t_index[i]
        s_stack += [s] * len(t_index[i])

    ss = [str(s) for s in score]
    return " ".join(ss)

# b05 1923 ms
if __name__ == "__main__":
    input_ki = []
    while True:
        try:
            input1 = input()
            if not input1:
                break
            if len(input1) == 0:
                break
            #s = input1.split(" ")
            #input_ki.append([int(s[0]), int(s[1])])
            input_ki.append(input1)
        except EOFError:
            break
    print(get_answer(input_ki))


Measured memory_bytes: 107544
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define inf 10000000000000007
#define eps 1e-13
#define PI 3.14159265359
#define sp printf(" ")
#define vi vector<int>
#define vl vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pcc pair<char, char>
#define mp make_pair
#define FF first
#define SS second
#define pb(x) push_back(x)
#define sd(x) scanf("%d", &(x))
#define pd(x) printf("%d", (x))
#define pdn(x) printf("%d\n", (x))
#define sld(x) scanf("%ld", &(x))
#define pld(x) printf("%ld", (x))
#define pldn(x) printf("%ld\n", (x))
#define slf(x) scanf("%lf", &(x))
#define plf(x) printf("%.9lf", (x))
#define plfn(x) printf("%.9lf\n", (x))
#define sch(x) scanf("%c", &(x))
#define pch(x) printf("%c", (x))
#define pchn(x) printf("%c\n", (x))
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define ios ios::sync_with_stdio(false); cin.tie(0)
#define endl '\n'
using namespace std;
ll a[300004];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=3*n;i++){cin>>a[i];a[i]=-a[i];}
    sort(a+1,a+3*n+1);
    ll ans=0;
    for(int i=2;i<=2*n;i=i+2)ans-=a[i];
    cout<<ans<<endl;

}


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

int main()
{
  ll n, m;
  cin >> n >> m;
  vector<ll> h(n);
  for (ll i = 0; i < n; i++)
  {
    cin >> h[i];
  }
  vector<ll> ans(n, 0);
  for (ll i = 0; i < m; i++)
  {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    ans[a] = max(ans[a], h[b]);
    ans[b] = max(ans[b], h[a]);
  }
  ll cnt = 0;
  for (ll i = 0; i < n; i++)
  {
    cnt += h[i] > ans[i];
  }
  cout << cnt << endl;
}


Measured memory_bytes: 4828
#include<bits/stdc++.h>
using namespace std;
int i,i0,n,m;
int main()
{
    int a,b,c,ans=0;
	scanf("%d %d %d %d",&a,&b,&c,&n);
	for(i=0;i*a<=n;i++)for(i0=0;a*i+b*i0<=n;i0++)ans+=((n-a*i-b*i0)%c==0);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256