akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_35_Marblue_And_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007)

int n,m,q;
ll s[111111];
ll t[111111];

int I_Love_35_Marblue_And_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	n=read();m=read();q=read();
	FOR(i,0,n){
		s[i+1]=read();
	}
	FOR(i,0,m)t[i+1]=read();
	sort(s+1,s+n+1);
	sort(t+1,t+m+1);
	s[n+1]=linf;
	t[m+1]=linf;
	s[0]=-linf;t[0]=-linf;
	n+=2;m+=2;
	FOR(i,0,q){
		ll x=read();
		ll a=lower_bound(s,s+n,x)-s,b=lower_bound(t,t+m,x)-t;
		printf("%lld\n",min(min(max(s[a]-x,t[b]-x),max(x-s[a-1],x-t[b-1])),min(s[a]-t[b-1]+min(s[a]-x,x-t[b-1]),t[b]-s[a-1]+min(t[b]-x,x-s[a-1]))));
	}
	
	return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
signed main(){
  long long int n,m,pay=0,a[100005],c,b[100005],hon=0;
  cin>>n>>m;
  for(int i=0;i<n;i++){
    cin>>a[i]>>c;
    a[i]=a[i]*1000000+c;
  }
  
  sort(a,a+n);
  for(int i=0;i<n;i++){
    b[i]=a[i]%1000000;
    a[i]/=1000000;
  }

  for(int i=0;i<n;i++){
    if(hon+b[i] >= m){
      pay+=(m-hon)*a[i];
      goto A;
    }

    else{
      pay+=a[i]*b[i];
      hon+=b[i];
    }
  }
  
 A:cout<<pay<<endl;
  return(0);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)

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

const int INF = 1e9;
const int MOD =1e9+7;
const ll LINF = 1e18;

int main(){
    int N;
    int a[310000];

    cin >> N;
    rep(i,3 * N) cin >> a[i];

    sort(a, a + (3 * N), greater<int>());

    ul ans = 0;
    for(int i = 0; i < N; i++){
        ans += a[(i * 2) + 1];
    }

    cout << ans << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define fori(a,b) for(int i=a;i<b;i++)
#define forj(a,b) for(int j=a;j<b;j++)
#define ford(b,a) for(int i=b;i>=a;i--)
typedef pair<int, int> pi;
#define PI 3.14159265359
#define vi vector<int>
long long mod=1000000007;
//int count=INT_MAX;
 
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int testcases=1;
    //cin>>testcases;
    //cout<<t;
    //scanf("%d",&t);
    //int t=testcases;
    while(testcases--){
        string s;
        cin>>s;
        int n=s.size();
        int x=0;
        fori(0,n){
            int val=(s[i]-'0');
            x+=val;
            x%=9;
        }
        if(x%9==0) cout<<"Yes";
        else cout<<"No";

    }               

    return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>    //C++の標準ライブラリのヘッダを全て読み込む
 
int main() {
    using std::cout;
    using std::endl;
    using std::cin;
    using std::string;

    int N, K;
    int temp = 1;

    cin >> N >> K;
 
    for(int i = 0; i < N; i++)
    {
        temp = (temp*2 < temp+K) ? temp*2 : temp+K;
    }

    cout << temp << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

const int INF = 1 << 29;
typedef long long ll;

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

	int n;
	cin >> n;

	for(int i = 0; i < n; ++i){
		int s, d;
		cin >> s >> d;

		int now = s;
		int cnt = 0;
		while(now != d){
			int p = 1;
			for(int j = 1; now + j <= d; j *= 2){
				if(now % j == 0){
					p = j;
				}
			}
			++cnt;
			now += p;
		}
		cout << cnt << endl;
	}

	return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint n;cin >> n;
    vector<lint> a(n+1),v(n+1);
    lint sum_a = 0;
    REP(i,n+1){
        cin >> a[i];
        sum_a += a[i];
    }
    if (a[0] != 0)
    {
        if(a[0]==1&&n==0){
            cout << 1 << "\n";
            return 0;
        }
        cout << -1 << "\n";
        return 0;
    }
    v[0] = 1;
    lint ans = 1;
    FOR(i,1,n+1){
        lint x = v[i - 1];//深さi-1において葉ではないやつの個数
        lint nexv = 2 * x - a[i];
            v[i] = min(nexv,sum_a);
        if(v[i]<0){
            cout << -1 << "\n";
            return 0;
        }
        ans += v[i] + a[i];
    }
    if (v[n-1]*2 < a[n])
    {
        cout << -1 << "\n";
        return 0;
    }
    vector<lint> a2(n + 1), v2(n + 1);
    lint ans2 = 1;
    a2[n] = a[n];
    IFOR(i, 1, n)
    {
        lint z = a2[i + 1]+a[i];
        a2[i] = min(z, v[i]+a[i]);
    }
    REP(i, n + 1)
    {
        ans2 += a2[i];
    }
    cout << ans2 << "\n";
    //cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6424
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n,k=map(int,input().split())\n"
"a=[0]+list(map(int,input().split()))\n"
"s=[0]\n"
"p=[0]\n"
"for i in range(1,n+1):\n"
"  s.append(s[i-1]+a[i])\n"
"  p.append(p[i-1]+max(0,a[i]))\n"
"ans=0\n"
"for i in range(1,n-k+2):\n"
"  t=max(0,s[i+k-1]-s[i-1])\n"
"  t+=p[i-1]+p[n]-p[i+k-1]\n"
"  ans=max(ans,t)\n"
"print(ans)\n"
"\"";
  system(s);
  return 0;
}            

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

int main() {
	string n;
	cin>>n;
	long long int sum=0;
	for (char ch: n) 
	{ 
		string temp="";
		temp+= ch; 
      	sum += atoi(temp.c_str()); 
    	 
		
	} 
	if(sum%9==0){
	    cout<<"Yes";
	}else{
	    cout<<"No";
	}
	return 0;
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % moder;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), moder - 2, moder) % moder * mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, a[114514];
int f(int x) {
	rep(i, n) {
		x = x / a[i] * a[i];
	}
	return x;
}
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	int ng = 0, ok = inf;
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		if (f(mid) > 2)ok = mid;
		else ng = mid;
	}
	int nga = 0, oka = inf;
	while (oka - nga > 1) {
		int mid = (oka + nga) / 2;
		if (f(mid) > 1)oka = mid;
		else nga = mid;
	}
	if (ok == oka) {
		cout << -1 << endl;
	}
	else {
		cout << oka << " " << ok - 1 << endl;
	}
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int H = sc.nextInt();
			int W = sc.nextInt();
			
			if(H == 0 && W == 0)
				break;
			
			for(int i = 1;i <= H;i++){
				if(i % 2 == 1){
					for(int j = 1;j <= W;j++){
						if(j % 2 == 1)
							System.out.print("#");
						else
							System.out.print(".");
					}
				}else{
					for(int j = 1;j <= W;j++){
						if(j % 2 == 1)
							System.out.print(".");
						else
							System.out.print("#");
					}
				}
				System.out.println();
			}
			System.out.println();				
		}
	}
}

Measured memory_bytes: 26840
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N, K = list(map(int, input().split()))
S = input()

ans = 0
for i in range(1,N):
    if S[i-1] == "R" and S[i] == "L":
        ans += 2

if S[0] == "L":
    ans += 1
if S[N-1] == "R":
    ans += 1

print(N - max(1, ans - 2*K))

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

int main()
{
    int q1,b,c1,c2,q2,g1=0,g2=0;
    while(cin>> q1>>b>>c1>>c2>>q2)
    {
        int na = 1;
        for(g1=q2;g1> 0 ;--g1)
        {
            if( (g1+(b-g1*c1)/c2)>=q1 &&(g1*c1+g2*c2)<=b)
            {
                na=0;break;
            }
        }
        if(na){cout<<"NA"<<endl;continue;}
        cout << g1 << " "<< (b-g1*c1)/c2<<endl;
    }
    return 0;
}

Measured memory_bytes: 0
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())

B = [int(input()) for _ in range(N)]

dic = {}

# row
for i in range(3):
    r = []
    for j in range(3):
        r.append(A[i][j])

    dic[(i, 'row')] = r

for j in range(3):
    r = []
    for i in range(3):
        r.append(A[i][j])

    dic[(j, 'col')] = r


r = [A[0][0], A[1][1], A[2][2]]
dic[(0, 'dic')] = r

r = [A[0][2], A[1][1], A[2][0]]
dic[(1, 'dic')] = r


B = set(B)

for k, v in dic.items():
    flag = True
    for ele in v:
        if ele in B:
            continue
        else:
            flag = False
            break

    if flag:
        print('Yes')
        exit()


print('No')


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

using namespace std;

int main()
{
    int peri ;
    int k ;

    cin>>peri;
    cin>>k;

    int arr[k];
    for(int j = 0; j< k; j++)
    {
        cin>>arr[j];
    }
    sort(arr, arr+k);
    int dis;
    int max = 0;
    long long int sum = 0;

    for(int i = 0; i < k;i++)
    {
        dis = arr[(i+1) % k] - arr[i];
        if(dis < 0)
        {
            dis *= -1;
        }

        if(peri - arr[(i+1) % k] + arr[i] < dis)
        {
            dis = peri - arr[(i+1) % k] + arr[i];
        }

         if(peri + arr[(i+1) % k] - arr[i] < dis)
        {
            dis = peri + arr[(i+1) % k] - arr[i];
        }

        if(max < dis)
        {
            max = dis;
        }

        sum += dis;

    }

    cout<<sum - max;
}

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

int main() {
  int x,a,b;
  cin >> x >> a >> b;
  if(x>a && x>b){
    if(x-a>x-b){
      cout << "B" << endl;
    }
    else if(x-a<x-b){
      cout << "A" << endl;
    }
  }
  if(x<a && x<b){
    if((x-a)*-1>(x-b)*-1){
      cout << "B" << endl;
    }
    else if((x-a)*-1<(x-b)*-1){
      cout << "A" << endl;
    }
  }
  if(x<a && x>b){
    if((x-a)*-1>x-b){
      cout << "B" << endl;
    }
    if((x-a)*-1<x-b){
      cout << "A" << endl;
    }
  }
  if(x>a && x<b){
    if(x-a>(x-b)*-1){
      cout << "B" << endl;
    }
    else if(x-a<(x-b)*-1){
      cout << "A" << endl;
    }
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
int mmin(int &a, int b) {
	a = min(a, b);
	return a;
}
ll mmin1(ll &a,ll b) {
	a = min(a, b);
	return a;
}
int mmax(int &a, int b) {
	a = max(a, b);
	return a;
}
ll mmax1(ll &a,ll b) {
	a = max(a, b);
	return a;
}
ll po(ll  a, int n,ll p) {
	if (n == 0) {
		return 1 % p;
	}
	ll x = po(a, n / 2, p);
	if (n % 2 == 0) {
		return (x*x) % p;
	}
	return (((x*x) % p)*a) % p;
}
ll inve(ll a, ll p) {
	return po(a, p - 2, p);
}
int main(){
	int n;
	cin >> n;
	int m;
	cin >> m;
	vector<int> cl(n,0);
	vector<int> cw(n,0);
	vector<vector<int> > wl(2, vector<int>(m));
	vector<int> wl1(m);
	for (int i = 0; i < m; i++) {
		int wi, lo;
		cin >> wi >> lo;
		wi--; lo--;
		wl1[i] =wi * n + lo;
		wl[0][i] = wi;
		wl[1][i] = lo;
		cl[lo]++;
		cw[wi]++;
	}
	sort(wl1.begin(), wl1.end());
	vector<vector<int> > w(n);
	int th = 0;
	for (int i = 0; i < n; i++) {
		int x = cw[i];
		vector<int> ze(x, 0);
		w[i] = ze;
		for (int di = 0; di < x; di++) {
			w[i][di] = wl1[th]%n;
			th++;
		}
	}
	vector<int> ra(n);
	vector<int> don(n, 0);
	vector<int> z(n, -1);
	vector<int> ch(n,-1);
	int mo = 0;
	int ko = 0;
	for (int i = 0; i < n; i++) {
		if (cl[i] == 0) {
			ch[ko] = i;
			don[i] = 1;
			ko++;
			ra[mo]=i;
			mo++;
		}
	}
	int ans = 0;
	while (ko != 0) {
		if (ko != 1) {
			ans = 1;
		}
		for (int i = 0; i < ko; i++) {
			int x = ch[i];
			for (int j = 0; j < cw[x]; j++) {
				int y = w[x][j];
				cl[y]--;
			}
		}
		ko = 0;
		ch = z;
		for (int i = 0; i < n; i++) {
			if (cl[i] == 0 and don[i]==0) {
				ch[ko] = i;
				ko++;
				don[i] = 1;
				ra[mo] = i;
				mo++;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		cout << ra[i]+1 << endl;
	}
	cout << ans << endl;
}


Measured memory_bytes: 4784
K=int(input())
A,B=map(int,input().split())

x=0
y=0

for i in range(B+1):
  if K*i<=B:
    y+=1

for i in range(y):
  if A<=K*i<=B:
    x+=1
if x>=1:
  print("OK")
else:
  print("NG")

Measured memory_bytes: 9196
#include <bits/stdc++.h>
 
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define INF 999999999
#define MOD 1000000007
 
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
 
int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};
 
int n, m;
 
int main(){
	cin >> n ;
	cout << (n+1)/2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#define ll long long
#define re register
#define il inline
#define fp(i,a,b) for(re int i=a;i<=b;++i)
#define fq(i,a,b) for(re int i=a;i>=b;--i)
using namespace std;
const int N=310,mod=1e9+7;
int n,m,a[N],h[N],cnt,ans,f[N][N][N];
struct Edge{int to,nxt,w;}e[N<<1];
il void add(re int u,re int v,re int w){e[++cnt]=(Edge){v,h[u],w};h[u]=cnt;}
il ll gi()
{
  re ll x=0,t=1;
  re char ch=getchar();
  while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
  if(ch=='-') t=-1,ch=getchar();
  while(ch>='0'&&ch<='9') x=x*10+ch-48,ch=getchar();
  return x*t;
}
int main()
{
  memset(h,-1,sizeof(h));
  n=gi();m=gi();
  fp(i,1,m)
    {
      re int l=gi(),r=gi(),x=gi();
      add(r,l,x);
    }
  f[0][0][0]=1;
  fp(i,0,n)
    fp(j,0,n)
    fp(k,0,n)
    {
      re int &x=f[i][j][k],l=max(i,max(j,k));
      if((i&&i==j)||(j&&j==k)||(k&&k==i)) x=0;
      if(x) 
      for(re int o=h[l];o+1;o=e[o].nxt)
	{
	  re int v=e[o].to,w=e[o].w;
	  if((i>=v)+(j>=v)+(k>=v)!=w) {x=0;break;}
	}
      if(!x) continue;
      (f[l+1][j][k]+=x)%=mod;
      (f[i][l+1][k]+=x)%=mod;
      (f[i][j][l+1]+=x)%=mod;
      if(l==n) (ans+=f[i][j][k])%=mod;
    }
  printf("%d\n",ans);
  return 0;
}


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

int main(int argc, char const *argv[])
{
	string s;
	cin>>s;
	int ans1=0,ans2=0;
	for (int i = 0; i < s.size(); ++i)
	{
		if (i%2==0)
		{
			if (s.at(i)=='0')
			{
				++ans1;
			}
			else
			{
				++ans2;
			}
		}
		else
		{
			if (s.at(i)=='1')
			{
				++ans1;
			}
			else
			{
				++ans2;
			}
		}
	}
	cout<<min(ans1,ans2)<<endl;
	return 0;
}


Measured memory_bytes: 512
N,M = map(int,input().split())
L = [list(map(int,input().split())) for _ in range(N)]
L.sort()
ans = 0
num = 0
for i in L:
    if num + i[1] <= M:
        ans += i[0]*i[1]
        num += i[1]
    else:
        ans += i[0]*(M-num)
        break
print(ans)

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

int main(){
    int N,M;cin >> N >> M;
    vector<int> x(N+1),y(M+1);
    cin >> x[0] >> y[0];
    for(int i = 1; i <= N;i++){
        cin >> x[i];
    }
    for(int i = 1; i <= M;i++){
        cin >> y[i];
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    if(x[N] < y[0])cout << "No War" << endl;
    else cout << "War" << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    x = int(input())
    if 400 <= x and x <=599:
        print(8)
    elif 600 <= x and x <= 799:
        print(7)
    elif 800 <= x and x <= 999:
        print(6)
    elif 1000 <= x and x <= 1199:
        print(5)
    elif 1200 <= x and x <= 1399:
        print(4)
    elif 1400 <= x and x <= 1599:
        print(3)
    elif 1600 <= x and x <= 1799:
        print(2)
    elif 1800 <= x and x <= 1999:
        print(1)
            
if __name__ == '__main__':
    main()

Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAX 1000001

int main(){
    int D,G;
    cin >> D >> G;
    int p[D],c[D],s[D];
    for(int i=0;i<D;i++){
        cin >> p[i] >> c[i];
        s[i] = 100*p[i]*(i+1)+c[i];
    }

    int ans = MAX;
    for(int bit=0;bit<(1<<D);bit++){
        int points = 0;
        int solved = 0;
        int highest_remain = -1;
        for(int i=0;i<D;i++){
            if(bit>>i & 1){
                points += s[i];
                solved += p[i];
            }
            else{
                highest_remain = i;
            }
        }
        if(points >= G){
            if(solved < ans) ans = solved;
        }
        else{
            if(highest_remain == -1) continue;
            int diff = G-points;
            int p_diff = int((diff-1)/((highest_remain+1)*100))+1;
            if(p_diff < p[highest_remain]){
                solved += p_diff;
                if(solved < ans) ans = solved;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
N, M = gets.strip.split.map(&:to_i)
a = N.times.map { gets.strip.split.map(&:to_i) }.sort { |x, y| x[0] <=> y[0] }

rem = M
cost = 0
a.each do |price, count|
  if count >= rem 
    cost += (rem * price)
    break
  else
    cost += (count * price)
    rem -= count 
  end
end
puts cost


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

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

    int ans=0;
    for(int i = 1; i < n-1; i++){
        int total = p[i-1] + p[i] + p[i+1];
        int x = total - max({p[i-1], p[i], p[i+1]}) -
                min({p[i-1], p[i], p[i+1]});
        if(x == p[i]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <cctype>
#include <vector>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;char c;while(isspace(c = gcu()));do{s+=c;}while(c=gcu(),c!=' '&&c!='\n'&&c!=EOF);return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H &&h, T... t){out(h);out(t...);}
template <typename... T> _OUTL(T... t){out(t...);outl();}
struct range{
	int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
	struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

template <typename T>
using V = vector<T>;

int main() {
	int H {in}, W {in};
	V<V<int>> d(H + 1, V<int>(W + 1));
	int r = 0;
	for(int y: range(1, H + 1)) {
		for (int x: range(1, W + 1)) {
			if (gcu() == '0')
				r = max(r, d[y][x] = min(min(d[y - 1][x - 1], d[y - 1][x]), d[y][x - 1]) + 1);
			gcu();
		}
	}
	outl(r * r);
}


Measured memory_bytes: 10052
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>

#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>

#include <algorithm>

using namespace std;


int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<vector<int> > vv(n + 1, vector<int> (0));

	for (int i = 1; i < n; i++) {
		int u, v, w;
		cin >> u >> v >> w;
		if (w % 2 == 1) {
			vv[u].push_back(v);
			vv[v].push_back(u);
		}
		else {
			vv[u].push_back(-v);
			vv[v].push_back(-u);
		}
	}

	vector<int> c (n + 1, -1);
	for (int i = 1; i <= n; i++) {
		queue<int> q;
		if (c[i] == -1) {
			q.push(i);
			c[i] = 0;
		}
		while (q.size() > 0) {
			int t = q.front();
			q.pop();
			for (auto next : vv[t]) {

				if (next > 0 && c[next] == -1) {
					c[next] = 1 - c[t];
					q.push(next);
				}
				if (next < 0 && c[-next] == -1) {
					c[-next] = c[t];
					q.push(-next);
				} 
			}
		}
	}
	for (int i = 1; i <= n; i++)
		cout << c[i] << endl;
}

Measured memory_bytes: 6400
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
	int H, W;
	cin >> H >> W;
	string a[ H ];
	REP( i, H ) cin >> a[ i ];
	bool row[ H ];
	bool col[ W ];
	REP( i, H ) row[ i ] = false;
	REP( i, W ) col[ i ] = false;
	REP( i, H )
	{
		REP( j, W )
		{
			if( a[ i ][ j ] == '#' ) row[ i ] = true;
		}
	}
	REP( j, W )
	{
		REP( i, H )
		{
			if( a[ i ][ j ] == '#' ) col[ j ] = true;
		}
	}
	REP( i, H )
	{
		REP( j, W )
		{
			if( row[ i ] && col[ j ] ) cout << a[ i ][ j ];
		}
		if( row[ i ] ) cout << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#ダイクストラ法(単一始点最短路)　計算量O(|E|log|V|)
#V:頂点の集合 E:辺の集合
#負の辺が含まれるときはベルマンフォード法
import collections
import heapq

class Dijkstra():
    def __init__(self):
        self.e=collections.defaultdict(list)
    def add(self,u,v,d,directed=False):
        #0-indexedでなくても良いことに注意
        #u=from,v=to,d=cost
        #directed =Trueなら、有向グラフ
        if directed is False:
            self.e[u].append([v,d])
            self.e[v].append([u,d])
        else:
            self.e[u].append([v,d])
    def delete(self,u,v):
        self.e[u]=[_ for _ in self.e[u] if _[0]!=v]
        self.e[v]=[_ for _ in self.e[v] if _[0]!=u]
    def search(self,s):
        #:param s:始点
        #:return: 始点から各点までの最短経路
        d = collections.defaultdict(lambda: float('inf'))
        d[s] = 0
        q = []
        heapq.heappush(q, (0, s))
        v = collections.defaultdict(bool)
        while len(q):
            k, u = heapq.heappop(q)
            if v[u]:
                continue
            v[u] = True

            for uv, ud in self.e[u]:
                if v[uv]:
                    continue
                vd = k + ud
                if d[uv] > vd:
                    d[uv] = vd
                    heapq.heappush(q, (vd, uv))
        return d

#Saving Shuuk
n=int(input())
uvw=l=[list(map(int, input().split())) for i in range(n-1)]
#print(l)
graph1=Dijkstra()
for u,v,w in l:
    if w%2==0:
        graph1.add(u,v,0)
    else:
        graph1.add(u,v,1)

result_a=graph1.search(1) #{2: 0, 1: 1, 4: 2, 3: 21})
#print(result_a) #{3: 0, 1: 1, 4: 101, 2: 11})

for i in range(1,n+1):
    print(result_a[i]%2)

Measured memory_bytes: 132764
#include <stdio.h>
#include <string.h>

int	main(void)
{
  char	s[11];
  int	num;
  char	*p;
  int   i;
  
  num = scanf("%s", s);
  if (num != 1)
	return (0);
  
  while ((p = strstr(s, "hi")) != NULL)
  {
	if (p == NULL)
    {
        break ;
    }
    else
    {
      *p = '_';
      *(p + 1) = '_';
    }
  }
  i = 0;
  while (s[i])
  {
    if (s[i] != '_')
    {
      printf("No");
      return (0);
    }
    i++;
  }
  printf("Yes");
  return (0);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	for( auto &k : a ) cin >> k;
	
	/*
	必要条件から絞り込むことを考える
	a(n) のなかから任意の 2 つ a(x), a(y) を取ると，ans は a(x) の約数 or a(y) の約数に含まれている	
	( a(x) に含まれていないなら必ず a(y) に含まれている )
	まず a(x), a(y) について約数を全列挙してみて，列挙した約数で割ってみる
	*/
	
	// 答えの候補
	set<int> candy;
	for( int i = 1; i*i <= a[0]; ++i ){
		if( a[0] % i == 0 ){
			candy.insert(i);
			candy.insert(a[0]/i);
		}
	}
	for( int i = 1; i*i <= a[1]; ++i ){
		if( a[1] % i == 0 ){
			candy.insert(i);
			candy.insert(a[1]/i);
		}
	}
	
	int ans = 0;
	for( auto k : candy ){
		int cnt = 0;
		for( auto i : a ){
			if( i % k == 0 ) ++cnt;
		}
		if( cnt >= n-1 ) ans = max(ans, k);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=200000+10;

int n,t,a[N];

int main() {
	n=read(),t=read();
	for (int i=1;i<=n;++i) a[i]=read();
	int ans=0;
	for (int i=1;i<n;++i) ans+=min(a[i+1]-a[i],t);
	ans+=t;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4552
from itertools import combinations
mod=10**9+7
def solve(n,k,a):
  if min(a)>0:
    ans=1
    a.sort(reverse=1)
    for i in a[:k]:
      ans*=i
      ans%=mod
    return ans
  if max(a)<0:
    if k%2==0:
      a.sort()
      ans=1
      for i in a[:k]:
        ans*=i
        ans%=mod
      return ans
    else:
      a.sort(reverse=1)
      ans=1
      for i in a[:k]:
        ans*=i
        ans%=mod
      return ans
  if n==k:
    ans=1
    for i in a:
      ans*=i
      ans%=mod
    return ans
  if k==1:
    return max(a)
  if n-k==1:
    ans=1
    if a.count(0)>1:return 0
    p=[]
    m=[]
    for i in a:
      if i>0:p.append(i)
      elif i<0:m.append(i)
    if 0 in a:
      if len(m)%2==0:
        for i in a:
          if i==0:continue
          ans=(ans*i)%mod
      else:ans=0
    else:
      if len(m)%2==0:
        for i in sorted(p)[1:]+m:ans=(ans*i)%mod
      else:
        for i in p+sorted(m)[:-1]:ans=(ans*i)%mod
    return ans


  ans=1
  p=[]
  m=[]
  for i in a:
    if i<0:m.append(i)
    elif i>=0:p.append(i)
  p.sort()
  m.sort(reverse=1)

  while k>1:
    if k<=5:
      if len(p)>=10:p=p[-10:]
      if len(m)>=10:m=m[-10:]
      ans*=solve2(len(p)+len(m),k,m+p)
      ans%=mod
      k=0
      break
    if len(p)<2:
      ans*=m.pop()*m.pop()
      k-=2
    elif len(m)<2:
      ans*=p.pop()*p.pop()
      k-=2
    elif m[-1]*m[-2]>p[-1]*p[-2]:
      ans*=m.pop()*m.pop()
      k-=2
    else:
      ans*=p.pop()*p.pop()
      k-=2
    ans%=mod
  if k:
    ans*=p.pop()
  return ans

def solve2(n,k,a):
  ans=-10**20
  for c in combinations(range(n),k):
    anss=1
    for i in c:anss*=a[i]
    ans=max(ans,anss)
  return ans%mod

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


Measured memory_bytes: 31732
n,k = map(int,input().split())
l = list(map(int,input().split()))

a = l.index(min(l))
b = a

p = n//2
count = 0
if p>a:
    while b>0:
        b -= k-1
        count += 1

    while a<n-1+b:
        a += k-1
        count += 1

else:
    while a<n-1:
        a += k-1
        count += 1

    while b>a-n+1:
        b -= k-1
        count += 1

print(count)


Measured memory_bytes: 14008
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//#define int long long

void solve() {
	string s, t; cin >> s >> t;
    t += s;
    cout << t << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

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

	int mn=N,mx=0;
	for (int i=0; i<n; i++) {
		mn = min(mn,a[i]);
		mx = max(mx,a[i]);
	}

	if (mn == mx) {
		if (n == mx+1 || n >= 2*mx)
			cout << "Yes\n";
		else
			cout << "No\n";
	} else if (mn == mx-1) {
		int loct=0,hict=0;
		for (int i=0; i<n; i++) {
			if (a[i] == mn) loct++;
			if (a[i] == mx) hict++;
		}
		if (mx >= loct+1 && hict >= 2*(mx-loct)) {
			cout << "Yes\n";
		} else {
			cout << "No\n";
		}
	} else {
		cout << "No\n";
	}
}

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

int main(){
    string S;
    cin >> S;
    long ans = 0, n = S.length();
    rep(bit, 0, (1<<(n - 1))){
        long m = S[0] - '0';
        rep(i, 1, n){
            if(bit & (1<<(i - 1))){
                ans += m;
                m = S[i] - '0';
            }else{
                m = m * 10 + (S[i] - '0');
            }
        }
        ans += m;
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3592
using System;

class Program
{
    static void Main(string[] args)
    {
        string str1 = Console.ReadLine();

        decimal hug = 0;
        decimal num = Math.Floor((decimal)str1.Length / 2);

        for ( int i = 0; i < num; i++)
        {
            if( str1[i] != str1[str1.Length - 1 -i])
            {
                hug++;
            }
        }

        Console.WriteLine(hug.ToString());
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i=0; i<(int)(n); ++i)
#define rep2(i, a, b) for(int i=a; i<=(int)(b); ++i)
#define all(v) v.begin(),v.end()

vector<vector<int>> g;

int n, ans;

void dfs(int u, unordered_set<int> s) {
  s.insert(u);
  if (s.size() == n) ++ans;
  for (int to : g[u]) {
    if (s.count(to)) continue;
    dfs(to, s);
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int m;
  cin >> n >> m;
  g.resize(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  unordered_set<int> s;
  dfs(0, s);
  cout << ans << endl;
}

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

void rev(char *s) {
    int l = strlen(s), i;
    for (i=0;i<l/2;i++) {
        char t = s[i];
        s[i] = s[l-1-i];
        s[l-1-i] = t;
    }
}

char T[4][8] = {"dream", "dreamer", "erase", "eraser"};

int main(void) {
    
    int i, c, l;
    char s[100001];
    for(i=0;i<4;i++)rev(T[i]);
    scanf("%s", s);
    l = strlen(s);
    rev(s);
    for (;c<l;) {
        int k = -1;
        for (i=0;i<4;i++) {
            if (!strncmp(s+c, T[i], strlen(T[i]))) {
                k = strlen(T[i]);
                break;
            }
        }
        if (k<0) {
            printf("NO\n");
            return 0;
        } 
        c += k;
    }
    printf("YES\n");
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
using namespace std;
int n, power[13];
void solve(int x, int v, string S) {
	if (v == n) { printf("%s\n", S.c_str()); return; }
	if (x == 13) return;
	solve(x + 1, v - power[x], '-' + S);
	solve(x + 1, v, '0' + S);
	solve(x + 1, v + power[x], '+' + S);
}
int main() {
	power[0] = 1;
	for (int i = 1; i < 13; i++) power[i] = power[i - 1] * 3;
	scanf("%d", &n); solve(0, 0, "");
	return 0;
}

Measured memory_bytes: 3228
while(True):
    n, x = map(int, input().split())
    if(n == x == 0): break
    ans = 0
    for x1 in range(1, n-1):
        for x2 in range(x1+1, n):
            for x3 in range(x2+1, n+1):
                if((x1 + x2 + x3) == x):
                    ans += 1
    print(ans)

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

int main()
{
    //bingo入力
    int A[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> A[i][j];
        }
    }

    //数字
    int N;
    cin >> N;
    int b[N];

    for(int i = 0; i < N; i++){
        cin >> b[i];

        //入力値がビンゴにあったら0に変える
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(b[i] == A[j][k]) A[j][k] = 0;
            }
        }   
    }

    int count = 0;

    //横チェック
    for(int i = 0; i < 3; i++){
        if(A[i][0] == 0 && A[i][1] ==0 && A[i][2] ==0) count++;
    }

    //縦チェック
    for(int i = 0; i < 3; i++){
        if(A[0][i] == 0 && A[1][i] ==0 && A[2][i] ==0) count++;
    }

    //斜めチェック
    if(A[0][0] == 0 && A[1][1] == 0 && A[2][2] == 0) count++;
    if(A[0][2] == 0 && A[1][1] == 0 && A[2][0] == 0) count++;

    if(count > 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" <<endl;
    }
    
}

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

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)

// policy-based
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;	


using namespace std;


typedef long long ll; // int or long long
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;

/*
typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
 
const ll MAX = 3e5+100;
const ll inf = 1e12;
const ll mod = 1e9+7;




int main(){
	fastio;
	ll tc,n,x,y,d;
	cin >> n >> d;
	ll ans = 0;
	f(i,0,n){
		cin >> x >> y;
		if(d*d >= x*x + y*y ) ans++;
	}
	cout << ans << endl;

}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    //cout.precision(10);
    int n, x, mini;
    int m[105];
    cin >> n >> x;
    mini = INF;
    for(int i = 1; i <= n; i++){
        int in;
        cin >> in;
        x -= in;
        mini = min(mini, in);
    }
    cout << n + x / mini << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVL vector<vector<ll>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<ll,ll>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr ll MOD = 1000000007;
using std::cout;
using std::endl;
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::multiset;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow(ll a, ll b) {
	ll ans = 1;
	while (b > 0) {
		if (b % 2 == 1) {
			ans *= a;
			ans %= MOD;
		}
		b /= 2;
		a *= a;
		a %= MOD;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a - b < b) { return comb(a, a - b); }
	ll c = 1;
	FOR(i, a - b + 1, a + 1) {
		c *= i;
		c %= MOD;
	}
	ll k = 1;
	FOR(i, 2, b + 1) {
		k *= i;
		k %= MOD;
	}
	c *= pow(k, MOD - 2);
	return c % MOD;
}
multiset<ll> prime_decomposition(ll n) {
	ll i = 2;
	multiset<ll> table{};
	while (i * i <= n) {
		while (n % i == 0) {
			n /= i;
			table.emplace(i);
		}
		++i;
	}
	if (n > 1) {
		table.emplace(n);
		return table;
	}
	return table;
}

struct edge {
	ll to;
	ll cost;
};

vector<bool> used(100001, false);
vector<ll> d(100001, -1);
bool f = true;
void dfs(ll a, const unordered_multimap<ll, edge>& graph) {
	if (used[a]) { return; }
	used[a] = true;

	auto p = graph.equal_range(a);
	for (auto itr = p.first; itr != p.second; ++itr) {
		if (d[itr->second.to] == -1) {
			d[itr->second.to] = d[a] + itr->second.cost;
			dfs(itr->second.to, graph);
		} else if (d[itr->second.to] != d[a] + itr->second.cost) {
			f = false;
			return;
		}
	}}

int main() {
	ll n, m;
	cin >> n >> m;
	cout << pow(2, m)*(1900 * m + 100 * (n - m)) << endl;;
}

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

using namespace std;

int main()
{
   int N, K;
   double p = 0.0;

   cin >> N >> K;

   for(int i=1;i<=N;i++){
      int num = 0;
      while(i*pow(2,num) < K){
         num++;
      }
      p += (1.0/N) * pow(0.5,num);
   }

   cout << fixed << setprecision(13) << p << endl;

   return 0;
}


Measured memory_bytes: 256
def read():
    N = int(input())
    A = list(map(int, input().split()))
    return N, A

def main():
    N, A = read()
    B = [0 for _ in range(N)]
    for i in range(N):
        B[i] = A[i] - (i+1)
    B.sort()
    if N % 2 == 1:
        b = B[int((N-1)/2)]
    else:
        bl = B[int(N/2) - 1]
        br = B[int(N/2)]
        b = int((bl + br) / 2)

    sum = 0
    for i in range(N):
        sum += abs(B[i] - b)
    print(sum)


main()


Measured memory_bytes: 26180
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 300000
typedef long long ll;



int main(){
  ll N,M,ans;
  cin>>N>>M;

  if(N*2>=M){
    ans=M/2;
  }else{
    ans=N+(M-N*2)/4;
  }
  cout<<ans<<endl;
}


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

int main(void)
{
  double px = 0, py = 0;
  int meter, rad, sumRad = 0;
  double buf;
  
  while (1) {
    scanf("%d,%d", &meter, &rad);
    if (meter == 0 && rad == 0) break;

    buf = M_PI * (double)sumRad / 180;
    px += (meter * sin(buf));
    py += (meter * cos(buf));

    sumRad += rad;
  }

  printf("%d\n%d\n", (int)px, (int)py);

  return 0;
}

Measured memory_bytes: 600
#ifdef LOCAL_BUILD
#include "pch.h"
#define DLOG(msg) cout << "#" << __LINE__ << ":" << msg << endl;
#define DLOG_V(var)\
  cout << "#" << __LINE__ << ":" << #var << " : " << var << endl;
#else
#include <bits/stdc++.h>
#define DLOG(msg)
#define DLOG_V(var)
#endif
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> nums;
  vector<int> count(10000 + 1, 0);
  for (int t, i = 0; i < n; ++i) {
    cin >> t;
    nums.push_back(t);
    ++count[t];
  }
  for (auto it = next(count.begin()); it != count.end(); ++it) {
    *it = *it + *(prev(it));
  }
  vector<int> out(nums.size(), 0);
  for (auto it = nums.rbegin(); it != nums.rend(); ++it) {
    out[--count[*it]] = *it;
  }
  bool first = true;
  for (auto it = out.begin(); it != out.end(); ++it) {
    if (!first) {
      cout << " ";
    }
    first = false;
    cout << *it;
  }
  cout << endl;
}

Measured memory_bytes: 18532
//I̲n̲ ̲t̲h̲e̲ ̲N̲a̲m̲e̲ ̲o̲f̲ ̲G̲o̲d̲
#define pb push_back
#define F first
#define S second
#define sz size()
#define ll long long

#include <bits/stdc++.h>

using namespace std;

ll n, m;
vector <int> adj[55];
int main()
{
	ios_base::sync_with_stdio(0);
	cin >> n >> m;
	for (int i = 0; i < m; i++)
    {
        int u, v;
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    for (int i = 1; i <= n; i++)
        cout << adj[i].sz << endl;
}


Measured memory_bytes: 256
import java.math.BigDecimal

fun main(args: Array<String>) {
  val a = BigDecimal(readLine())
  val b = BigDecimal(readLine())
  if( a > b ) {
    println("GREATER")
  }
  if( a < b ) {
    println("LESS")
  }
  if( a == b ) {
    println("EQUAL")
  }
}

Measured memory_bytes: 25588
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <string>

int N;
std::vector<int> A, B;

int main() {
  std::cin >> N;
  A.assign(N, 0);
  B.assign(N, 0);
  for (int i = 1; i < N; ++i) {
    std::cin >> A[i];
    --A[i];
    ++B[A[i]];
  }
  for (int i = 0; i < N; ++i) {
    std::cout << B[i] << std::endl;
  }
}

Measured memory_bytes: 4820
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    int a,b;
    cin >> a >> b;
    if(a == 1)a += 13;
    if(b == 1)b += 13;
    if(a > b)cout << "Alice\n";
    else if(a < b) cout << "Bob\n";
    else cout << "Draw\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <queue>
#include <math.h>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
using namespace std;

int main()
{
	string a, s, b;
	cin >> a >> s >> b;
	cout << a.at(0) << s.at(0) << b.at(0) << endl;
}


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

signed main() {
	int n, k;
	cin >> n >> k;
	vector<int>h(n);
	for (int i = 0; i < n; i++)cin >> h[i];
	vector<int>dp(n,1e9);
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < n; i++) {
		for (int j = 1; j <= k; j++) {
			if (i - j >= 0) {
				dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
			}
		}
	}
	cout << dp[n - 1];
	return 0;
}

Measured memory_bytes: 1792
print([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][int(input()) - 1])

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

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

int judge(int a, int b) {
	int res;
	if (a < b)res = 1;
	else if (a > b)res = -1;
	return res;
}

int main() {
	int n, a,ba,cnt=1,flag;
	cin >> n;
	if (n == 1 || n == 2) { cout << cnt << endl; return 0; }
	cin >> ba >> a;
	flag = judge(ba, a);
	ba = a;
	rep(i, n-2) {
		cin >> a;
		if ((ba < a && flag == -1) || (ba > a && flag == 1)) {
				cnt++;flag = 0;
		}
		else {
			flag = judge(ba, a);
		}
		ba = a;
	}

	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3636