akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}

/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*最大公約数*/
unsigned long long GCD(long long L,long long R){
    if(L>R){
        long long temp=R;
        R = L;
        L = temp;
    }
    unsigned long long pp=0,ppt=0;
    unsigned long long ans=0;
    if(R%L==0){
        ans = L;
    }else{
        while(true){
            ppt = pp;
            pp=R%L;
            if(pp == 0){
                ans = ppt;
                break;
            }
            R = L;
            L = pp;
        }
    }    
    return ans;    
}

/*最小公倍数*/
unsigned long long LCM(long long L,long long R){
    unsigned long long ans;
    unsigned long long gcd = GCD(L,R);
    ans = (L/gcd)*R;
    return ans;
}

/*ここから*/
int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    int ans=0;
    for(int i=0;i<n;i++){
        cin >> p[i] ;
    }
    for(int i=0;i<n-2;i++){
        if(p[i]>p[i+1]&&p[i+1]>p[i+2]){
            ans++;
        }
        if(p[i]<p[i+1]&&p[i+1]<p[i+2]){
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main(void){
    int n,d;
    cin >> n >> d;
    int scope = 2*d+1;
    int ans=0, rest=n;

    while(rest>0){
        rest -= scope;
        ans += 1;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
 
int no_digits(int a) {
    if (a == 0)
        return 0;
    return 1 + no_digits(a / 10);
}

int main() {
    int n, t;
    cin >> n;
    int rez = 0;
    for (int ctr1 = 1; ctr1 <= n; ++ctr1)
        rez += no_digits(ctr1) & 1;
    cout << rez;
    return 0;
}

Measured memory_bytes: 256
// This file is a "Hello, world!" in Java language by OpenJDK for wandbox.

import java.util.*;
import java.io.*;

class Main
{
	public static void main(String[] args){
		new Main().run();
	}
	
	class State{
		long pos;
		long val;
		public State(long pos,long val){
			this.pos=pos;
			this.val=val;
		}		
	}
	
	void run(){
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long D=sc.nextLong();
		long A=sc.nextLong();
		long[][] Y=new long[N][2];
		for(int i=0;i<N;++i){
			Y[i][0]=sc.nextLong();
			Y[i][1]=sc.nextLong();
		}
		Arrays.sort(Y,new Comparator<long[]>(){
			public int compare(long[] a,long[] b){
				return Long.compare(a[0],b[0]);
			}
		});
		ArrayDeque<State> dq= new ArrayDeque<>();
		long sum=0;
		long ans=0;
		for(int i=0;i<N;++i){
			while(!dq.isEmpty()&&Y[i][0]>=dq.peekFirst().pos){
				sum-=dq.pollFirst().val;
			}
			Y[i][1]-=sum;
			if(Y[i][1]>0){
				long num=(Y[i][1]+A-1)/A;
				ans+=num;
				Y[i][1]-=A*num;
				sum+=A*num;
				dq.addLast(new State(Y[i][0]+2*D+1,A*num));
			}
		}
		System.out.println(ans);
	}
	
	void tr(Object...o){
		System.out.println(Arrays.deepToString(o));
	}

}

// OpenJDK reference:
//   http://openjdk.java.net/

// Java language references:
//   http://docs.oracle.com/javase


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  
  int j = 0;
  while (j < n) {
    if (!(a.at(j) % 2)) {
     if (a.at(j) % 3 && a.at(j) % 5) {
       cout << "DENIED";
       return 0;
     }
    }
    j++;
  }
  
  cout << "APPROVED";
  return 0;
}



Measured memory_bytes: 256
import sys
from bisect import bisect_right as bsr
from collections import Counter as cnt
from collections import defaultdict as dd
from collections import deque
from fractions import gcd
from itertools import combinations as comb
from itertools import permutations as perm
from math import ceil, factorial, floor
from operator import itemgetter as ig

sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N, K = input(int, int)
    H = input([int, N])
    print(len([h for h in H if K <= h]))


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Measured memory_bytes: 14400
#include<map>
#include<queue>
#include<time.h>
#include<limits.h>
#include<cmath>
#include<ostream>
#include<iterator>
#include<set>
#include<stack>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep_1(i,m,n) for(int i=m;i<=n;i++)
#define mem(st) memset(st,0,sizeof st)
int read()
{
	int res=0,ch,flag=0;
	if((ch=getchar())=='-')             //判断正负
		flag=1;
	else if(ch>='0'&&ch<='9')           //得到完整的数
		res=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')
		res=res*10+ch-'0';
	return flag?-res:res;
}
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef pair<double,double> pdd;
const int inf = 0x3f3f3f3f;
void solve()
{
	int x,y;
	cin>>x>>y;
	if(y>x*4)
	{
		cout<<"No"<<endl;
		return ;
	}
	y-=x*2;
	if(y<0)
	{
		cout<<"No"<<endl;
		return ;
	}
	if(y%2)
	{
		cout<<"No"<<endl;
		return ;
	}
	cout<<"Yes"<<endl;
}
int main()
{
	int t=1;
	while(t--)
		solve();
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main{
	static int [] k = {500,100,50,10};
	static int [] backk = new int[4];
	static int back(int b) {
		int count = 0;
		for(int i=0;i<4;i++) {
			count += b/k[i];
			backk[i] = b/k[i];
			b = b%k[i];
		}
		return count;
	}
	
	static boolean check(int i,int j,int k,int l) {
		if( (i!=0 && backk[0]!=0) || (j!=0 && backk[1]!=0) || (k!=0 && backk[2]!=0) || (l!=0 && backk[3]!=0) ){
			return false; 
		}else {
			return true;
		}
	}
		
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int p = sc.nextInt();
		while(true) {
			int [] purse = new int[4];
			int [] ans = new int[4];
			int sum = 0;
			for(int i=0;i<4;i++) {
				purse[i] = sc.nextInt();
			}
			int min = 80;
			for(int i=0;i<=purse[3];i++) {
				for(int j=0;j<=purse[2];j++) {
					for(int k=0;k<=purse[1];k++) {
						for(int l=0;l<=purse[0];l++) {
							int pay = 500*i + 100*j + 50*k + 10*l;
							if(pay>=p) {
								int b = pay - p;
								if(back(b)-(i+j+k+l)<min) {
									if(check(i,j,k,l)) {
										min = back(b)-(i+j+k+l);
										ans[0] = l;
										ans[1] = k;
										ans[2] = j;
										ans[3] = i;
									}
									
								}
							}
						}
					}
				}
			}
			for(int i=0;i<4;i++) {
				if(ans[i]!=0) {
					System.out.println(k[3-i]+" "+ans[i]);
				}
			}
			p = sc.nextInt();
			if(p!=0) {
				System.out.println();
			}else {
				return;
			}
			
		}
	}
}



Measured memory_bytes: 41408
a,b,c,d = map(int,input().split())
if max(a,c) -min(a,c) <= d:
  print('Yes')
else:
  if max(b,a)-min(b,a)<=d and max(c,b)-min(c,b)<=d :
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

// mod. m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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


int main(){
    int n;
    cin >> n;
    ll ans = 0;

    for(ll i=1; i<=n; i++){
        ll y = n/i;
        ans += y*(y+1)/2*i;
    }
    cout << ans << endl;
}



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;

int main() {
    int n; cin >> n;
    const double tax = 1.08;
    rep1(i,50001){
    double X = i*tax;
    int x = X;
        if(x == n){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a,b;
    int nmax = -10000; 
    scanf("%d%d", &a, &b);
    if(nmax < a + b)nmax = a + b;
    if(nmax < a - b)nmax = a - b;
    if(nmax < a * b)nmax = a * b;
    printf("%d\n",nmax);
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    cout << fixed << setprecision(15);
    ll N, M;
    cin >> N >> M;

    int maxL = 0;
    int minR = N;
    REP(i, M){
        int L, R;
        cin >> L >> R;
        maxL = max(maxL ,L);
        minR = min(minR ,R);
    }
    cout << max(minR - maxL + 1, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 pb push_back
using namespace std;
using P = pair<int,int>;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef tuple<int,int,int> T;
typedef vector<P> vp;
typedef vector<T> vt;

// head
int main(void){
  int r;
  cin >> r;
  const double PI=3.14;
  cout << 2*r*PI << endl;
  return 0;
}

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  ll d, t, s;
  cin >> d >> t >> s;
  bool ok = d <= t * s;
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}


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

// See debug.cc for usage etc
#define DEBUG 0

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#if DEBUG
  #define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DCALL(func, ...)
#endif

constexpr ll eGCD(ll a, ll b, ll& s, ll& t) {
  if (a == 0) {
    s = 0;
    t = 1;
    return b;
  }
  ll u = 0;
  ll g = eGCD(b % a, a, t, u);
  s = u - (b / a) * t;
  return g;
}

ll A, B, C, D;
ll g;
ll l;

ll upto(ll p) {
  return p - ((p + C - 1) / C + (p + D - 1) / D - 1);
}

ll adNum(ll x) {
  ll k = x / l;
  ll m = x % l;
  if (m == 0) {
    return k * upto(l);
  }else {
    return k * upto(l) + upto(m);
  }
}


int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif
  cout << setprecision(20);

  cin >> A >> B >> C >> D;
  ll dummy1, dummy2;
  g = eGCD(C, D, dummy1, dummy2);
  l = C * D / g;
  ll answer = adNum(B+1) - adNum(A);
  cout << answer << endl;

  return 0;
}



Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] xs =  new int[n];
        for (int i = 0; i < n; i++) {
            xs[i] = sc.nextInt();
        }
        Arrays.sort(xs);

        int count = 0;
        for (int a = 0; a < n - 2; a++) {
            for (int b = a + 1; b < n - 1; b++) {
                for (int c = b + 1; c < n; c++) {
                    if (xs[c] >= xs[a] + xs[b]) {
                        break;
                    }
                    if (xs[a] < xs[b] + xs[c] && xs[b] < xs[a] + xs[c]) {
                        count++;
                    }
                }
            }
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 26820
#include <iostream>
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define ma 100000000
#define mod 1000000007
#define Nmax 1000000000000
using namespace std;
long double p[3000];
long double dp[3000][3000];
int n;
long double f(int pos,int nb){
    if(pos>n) return 1;
    if(dp[pos][nb]!=(long double)-1) {return dp[pos][nb];}
    dp[pos][nb]=0;
    dp[pos][nb]+=p[pos]*f(pos+1,nb);
    if(nb<n/2-(n%2==0)) dp[pos][nb]+=(1-p[pos])*f(pos+1,nb+1);
    return dp[pos][nb];
}
int main()
{
    IOS;
    cin>>n;
    for(int i=0;i<3000;i++) for(int j=0;j<3000;j++) dp[i][j]=-1;
    cout.precision(20);
    for(int i=1;i<=n;i++) cin>>p[i];
    cout<<f(1,0);


    return 0;
}


Measured memory_bytes: 141184
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100009;
int prime[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
vector<pi>p;
int n;
pi fnd(int x)
{
    int ret=0;
    pi r;
    r.fi=x;
    while(1)
    {
        ret+=(n/x);
        x=x*r.fi;
        if(x>n)break;
    }
    r.si=ret;
    return r;
}
 main()

{
    fast
    cin>>n;
    for(int i=0;i<25;i++)
    {
        int x=prime[i];
        if(x>n)break;
        pi nw=fnd(x);
        p.pb(nw);
    }
    int ses=0;
    int sz=p.size();
    for(int i=0;i<sz;i++)
    {
        int cnt=p[i].si;
        int x=p[i].fi;
        if(cnt>=74)
        {
            ses++;
        }
    }
    for(int i=0;i<sz;i++)
    {
        for(int j=0;j<sz;j++)
        {
            if(i==j)continue;
            int c1=p[i].si;
            int c2=p[j].si;
            if(c1>=2 && c2>=24)ses++;
            if(c1>=4 && c2>=14)ses++;
        }
    }
    int yo=0;
    for(int i=0;i<sz;i++)
    {
        int cnt=p[i].si;
        if(cnt>=4)yo++;
    }
    f(i,0,sz-1)
    {
        int c=p[i].si;
        if(c>=2)
        {

            int x=yo;
            if(c>=4)x--;
            x=(x*(x-1))/2;
            ses+=x;
        }
    }
    cout<<ses<<endl;
    return 0;

}





































Measured memory_bytes: 256
#include<stdio.h> 
int main()
{
  int x, y, r;

  scanf("%d %d",&x,&y);
  if(y < x) {
    r = y;
    y = x;
    x = r;
  }

  while(1) {
    r = x % y; 
    if(r == 0) break;
    x = y;
    y = r;
  }
  printf("%d\n",y);

  return 0;
}

Measured memory_bytes: 592
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;
#define pai 3.141592653589793238462643383279




int main(){
  int X, N; cin >> X >> N; int p[N]; bool check[200] = {};
  rep(i, N){
    cin >> p[i]; check[p[i]] = true;
  }
  int mi = inf; int ans;
  rep(i, 200){
    if(check[i]) continue;
    int tmp = abs(X-i);
    //cout << tmp << endl;
    if(mi>tmp){
      ans = i; mi = tmp;
    }
  }
  cout << ans << endl;
}
    
      

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

int main() {
    ll n;
    std::cin >> n;
    string ans="";
    while(n>0){
        ans =  (char)('a'+(n-1+26)%26)+ans;
        n = (n-1)/26;
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
long long n, x, ans = INT64_MAX, res;
vector<long long> a, b;
 
int main() {
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;
		a.push_back(tmp);
		b.push_back(tmp);
	}
	for(int k = 0; k < n; k++) {
		res = k * x;
		for (int i = 0; i < n; i++) {
			b[i] = min(b[i], a[(i + n - k) % n]);
			res += b[i];
		}
		ans = min(ans, res);
	}
	cout << ans << '\n';
	return 0;
}


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

int main()
{
    ll a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;

    b = abs(a - b);
    a = 0;
    a += v * t;
    b += w * t;
    if (a < b || v <= w)
        cout << "NO" << endl;
    else
        cout << "YES" << endl;
    return 0;
}

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

int main()
{
    long long N, money = 1000, kabu;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }

    for (int i = 1; i < N; i++)
    {
        if (A.at(i - 1) < A.at(i))
        {
            kabu = (money / A.at(i - 1));
            //cout << kabu << endl;
            money -= (kabu * A.at(i - 1));
            money += kabu * A.at(i);
            //cout << i  << " " << money << endl;
        }
    }
    cout << money << endl;
}


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

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

  if(S == "Sunny"){
    cout << "Cloudy" << endl;
  }else if(S == "Cloudy"){
    cout << "Rainy" << endl;
  }else {
    cout << "Sunny" << endl;
  }
}

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


int main(void) {
	double n, k;
	scanf("%lf %lf", &n, &k);
	double sum = 0;
	double prob = 1;
	double die;

	for (double i = 1; i <= n; ++i) {
		prob = 1/n;
		die = i;
		while (die<k)
		{
			prob *= 0.5;
			die *= 2;

		}

		sum += prob;

	}
	printf("%.10lf", sum);

	return 0;
}


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	private static Scanner in;

    private static int n;
    private static int[][] a;
    private static final int MOD = (int)1e9+7;
    private static long[] dp;

    public static void main(String[] args) {
        in = new Scanner(System.in);
        n = in.nextInt();
        a = new int[n][n];
        for(int i=0; i<n; i++) {
            for(int j=0; j<n; j++) {
                a[i][j] = in.nextInt();
            }
        }

        dp = new long[1<<(n)+1];

        Arrays.fill(dp, -1);
        System.out.println(solve(0, 0));

    } 

    private static long solve(int i, int mask) {
        //ith man and mask denotes women mask
        if (i==n) return 1;

        if (dp[mask]!=-1) return dp[mask];

        long ans = 0;
        for(int j=0; j<n; j++) {
            if ((mask&(1<<j))==0 && a[i][j]==1) {
                ans = (ans+solve(i+1, mask|(1<<j)))%MOD;
            }
        }

        return dp[mask] = ans;
    }
    
}


Measured memory_bytes: 58324
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
const ll INF = 1LL<<60;
typedef pair<ll, ll> P;

int main() {
    cin>>K>>N;
    vec a(N);
    rep(i,N) cin>>a[i];
    ll minus = a[0] + K - a[N - 1];
    reps(i,1,N) minus = max(minus, a[i] - a[i-1]);
    cout<<K - minus<<endl;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<functional>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<cstdlib>
#include<cctype>
#include<queue>
#define rep(i,a) for(i=0;i<a;i++)
#define kansurep(i,b,a) for(i=b+1;i<a;i++)
using namespace std;
int n,list[120],before,after,flg;
char s[100],kanban[120][120];
int cnt,mozi;
int kensaku(int p,int r)
{
	int q=0,jk,x=0,cc;
	int sa=0,syoki,i,j,k;
	kansurep(i,before,list[p]) {
		syoki=1;cc=2;
		if(s[1]==kanban[p][i]) {
			jk=i;
			sa=abs(abs(before)-abs(i));
			while(mozi!=cc) {
				if(jk+sa<list[p])jk+=sa;
				syoki++;
				if(s[syoki]!=kanban[p][jk]) break;
				else cc++;
			}
			if(cc==mozi) {flg=1;break;}
		}
		if(flg==1) break;
	}
	return flg;
}
int main(void)
{
	int i,j,k;
	cin>>n>>s;
	rep(i,n) {
		cin>>kanban[i];
		list[i]=strlen(kanban[i]);
	}
	mozi=strlen(s);cnt=0;
	rep(i,n) {
		flg=0;
		if(strcmp(s,kanban[i])==0) cnt++;
		else {
			rep(j,list[i]) {
				if(s[0]==kanban[i][j]) {
					before=j;cnt+=kensaku(i,j);
					if(flg==1)break;
				}
			}
		}
	}
	cout<<cnt<<endl;
	return 0;	
}
					

Measured memory_bytes: 3128
def check():
  S = input()
  n = len(S)
  dp = [False]*(n+10)
  dp[0] = True
  for i in range(n+1):
    if S[i:i+5]=='dream':
      dp[i+5] |= dp[i]
    if S[i:i+7]=='dreamer':
      dp[i+7] |= dp[i]
    if S[i:i+5]=='erase':
      dp[i+5] |= dp[i]
    if S[i:i+6]=='eraser':
      dp[i+6] |= dp[i]
  if dp[n]==True:
    return 'YES'
  return 'NO'
print(check())

Measured memory_bytes: 9808
package main

import (
    "fmt"
)

func main() {
    var (
        a, b, c, x, count int
    )
    fmt.Scan(&a, &b, &c, &x)
    for i := 0; i < a+1; i++ {
        for j := 0; j < b+1; j++ {
            for k := 0; k < c+1; k++ {
                if i*500+j*100+k*50 == x {
                    count++
                }
            }
        }
    }
    fmt.Println(count)
}

Measured memory_bytes: 1768
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=100023;
bool vis[N];
vector <int> adj[N];
ll dp[216][N];
void solve()
{
    ll n,x;
    cin>>n>>x;
    vl v;
    v.pb(0);
    rep(i,n)
    {
        ll c;
        cin>>c;
        v.pb(c);
    }
    sort(all(v));
    memset(dp,0,sizeof(dp));
    for(int a=0;a<=x;a++)
    {
        dp[1][a]=a%v[1];
    }
    for(int i=2;i<=n;i++)
    {
        for(int a=0;a<=x;a++)
        {
            dp[i][a]=dp[i-1][a%v[i]]+dp[i-1][a]*(i-1);
            dp[i][a]%=mod;
        }
    }
    ll ans=dp[n][x];
    cout<<ans<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 174940
#include<stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  int h[n];
  for(int i=0;i<n;i++){
    scanf("%d",&h[i]);
  }
  int ans=1;
  
  
  for(int i=1;i<n;i++){
    int count =0;
    for(int j=0;j<i;j++){
      if(h[i]<h[j]){
        count++;
      }
    }
    if(count==0){
      ans++;
    }
  }
  
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define Max(_A,_B) (_A>_B?_A:_B)
#define Min(_A,_B) (_A<_B?_A:_B)
#define Abs(_A) ((_A)?(_A):(-(_A))
#define INF 0x3f3f3f3f
int n,m;
struct data{
    int a;
    int b;
    int id;
}tl[100005];
vector<data> nl[100005];
inline bool cmp(const data &a,const data &b){
    return a.b<b.b;
}
inline bool cmp2(const data &a,const data &b){
    return a.id<b.id;
}
void init(){
    scanf("%d%d",&n,&m);
    int x,y;
    data nw;
    for(int i=1;i<=m;++i){
        scanf("%d%d",&x,&y);
        nw.b=y;
        nw.id=i;
        nw.a=x;
        nl[x].push_back(nw);
    }
    for(int i=1;i<=n;++i){
        sort(nl[i].begin(),nl[i].end(),cmp);
    }
    int tp=0;
    for(int i=1;i<=n;++i){
        for(int j=0;j<nl[i].size();++j){
            nl[i][j].b=j+1;
            tl[++tp]=nl[i][j];
        }
    }
    sort(tl+1,tl+1+m,cmp2);
    for(int i=1;i<=m;++i){
        printf("%.6d%.6d\n",tl[i].a,tl[i].b);
    }
}
int main(){
	init();
	return 0;
}


Measured memory_bytes: 8192
def examA():
    N, A, B = LI()
    ans = min(N*A,B)
    print(ans)


import sys,copy,bisect,itertools
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
    vector<int> dp(n);dp[0]=0;
    for(int i=1;i<n;i++){
        if(i>=2){
            dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
        }
        else{
            dp[i]=dp[i-1]+abs(v[i]-v[i-1]);
        }
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1024
def main():
    L, R = map(int, input().split())
    # 2019 の相異なる素因数は 3, 673 の 2つ
    if L + 672 <= R:
        print(0)
        return
    lst = []
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            lst.append(i * j % 2019)
            m = i * j % 2019
            if m == 0:
                break
        if m == 0:
            break
    print(min(lst))
    return


main()


Measured memory_bytes: 6796
#include <bits/stdc++.h>
using namespace std;
#define END '\n'
#define int unsigned long long
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define trace(x) cerr<<x<<END;
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i) 
const int mod = 1e9+7;
const int mod1 = 998244353;
const int inf = 9223372036854775807ll;

void solve()
  {
   int n;
   cin>>n;
   int ans = 0;
   loop(i,1,n+1)
    {
    	int x;
    	cin>>x;
    	ans += (i%2 == 1 && x%2 == 1);
    }
    cout<<ans;
  } 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0); 
	solve();
	//cerr<<END<<1.0*clock();
	return 0;
} 

Measured memory_bytes: 3656
//MIPT Cryptozoology
//Room 265
#define _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:128000000")
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <cmath>
#include <ctime>
#include <stack>
#include <bitset>
#include <set>
#include <map>
#include <cassert>
#include <memory.h>
#include <sstream>

using namespace std;

#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define itn int

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)

typedef long long li;
typedef long long i64;
typedef long double ld;
typedef vector<int> vi;
typedef pair <int, int> pi;

void solve(bool);

void precalc();

int TESTNUM = 0;
#define FILENAME ""

int main() {
	string s = FILENAME;
#ifdef YA
	//assert(!s.empty());
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//cerr<<FILENAME<<endl;
	//assert (s != "change me please");
	clock_t start = clock();
#else
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//freopen(FILENAME ".in", "r", stdin);
	//freopen(FILENAME ".out", "w", stdout);
	cin.tie(0);
#endif
	cout.sync_with_stdio(0);
	cout.precision(10);
	cout << fixed;
	precalc();
	int t = 1;
	//cin >> t;
	int test_num = 1;
	while (t--) {
		//cout << "Case #" << test_num++ << ": ";
		++TESTNUM;
		solve(true);
	}
#ifdef YAH
	while (true) {
		solve(false);
	}
#endif
#ifdef YA
	cerr << "\n\n\n" << (clock() - start) / 1.0 / CLOCKS_PER_SEC << "\n\n\n";
#endif
	return 0;
}

//#define int li

/*int pr[] = { 97, 2011 };
int mods[] = { 1000000007, 1000000009 };

const int C = 100500;
int powers[2][C];*/

//int MOD = 1000000007;

//int c[5010][5010];

template<typename T>
T binpow(T q, T w, T mod) {
	if (!w)
		return 1 % mod;
	if (w & 1)
		return q * 1LL * binpow(q, w - 1, mod) % mod;
	return binpow(q * 1LL * q % mod, w / 2, mod);
}

void precalc() {

	/*for (int w = 0; w < 2; ++w) {
	powers[w][0] = 1;
	for (int j = 1; j < C; ++j) {
	powers[w][j] = (powers[w][j - 1] * 1LL * pr[w]) % mods[w];
	}
	}*/

	/*for (int i = 0; i < 5010; ++i) {
	c[i][i] = c[i][0] = 1;
	for (int j = 1; j < i; ++j) {
	c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;
	}
	}*/
}

template<typename T>
T gcd(T q, T w) {
	while (w) {
		q %= w;
		swap(q, w);
	}
	return q;
}
template<typename T>
T lcm(T q, T w) {
	return q / gcd(q, w) * w;
}

inline int nxt(){
	int x;
	cin >> x;
	return x;
}

//#define int li

void solve(bool read) {
	int n;
	cin >> n;
	int odd = 0;
	for (int i = 0; i < n; ++i) {
		int cur;
		cin >> cur;
		if (cur & 1) {
			++odd;
		}
	}
	if (odd % 2 == 0) {
		cout << "YES\n";
	}
	else {
		cout << "NO\n";
	}
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int a, b, k; cin >> a >> b >> k;

    int m = min(a, k);
    a -= m; k -= m;
    b -= k;
    if(b < 0) b = 0;
    cout << a << " " << b << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pairs;

#define MOD 998244353


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

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}


  

int main(){
    string s;
    cin>>s;
    if(s[2] == s[3] && s[4] == s[5]){
        puts("Yes");
    }else puts("No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

#define _DEF 0x20

int main(){
    using namespace std;

    long long int ans = 0;
    string w;
    cin >> w;
    string text;

    for(int i=0;i<w.size();i++){
        if(w[i] >= 'A' && w[i] <= 'Z'){
            w[i] = w[i] + _DEF;
        }
    }

    while(text!="END_OF_TEXT"){
        cin >> text;

        if(text=="END_OF_TEXT"){ // to prevent in case w=="END_OF_TEXT"
            break;
        }

        for(int i=0;i<text.size();i++){
            if(text[i] >='A' && text[i]<='Z'){
                text[i] += _DEF;
            }
        }
        if(text==w){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3228
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])
k = 0
if A[1] - A[0] == 2:
    k += 1
if B[1] - B[0] == 2:
    k += 1
if C[1] - C[0] == 2:
    k += 1

if k == 1:
    print("NO")
else:
    print("YES")


Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll N, M;
ll dp[MAX/10];
set<ll> s;
ll c[]={0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

void rec(ll n, ll len) {
    if(n==0) return;
    ll i;
    ll max=0;
    for(auto it=s.begin(); it!=s.end(); it++) {
        i=*it;
        if(n<c[i]) continue;
        if(dp[n-c[i]]==len-1) chmax(max, i);
    }
    cout << max;
    rec(n-c[max], len-1);
}

int main(void) {
    cin >> N >> M;
    ll i, j;
    
    for(i=0; i<M; i++) {
        ll a;
        cin >> a;
        s.insert(a);
    }
    
    memset(dp, -1, sizeof(dp));
    dp[0]=0;
    for(i=0; i<=N; i++) {
        if(dp[i]==-1) continue;
        for(auto it=s.begin(); it!=s.end(); it++) {
            j=*it;
            if(i+c[j]<=N) chmax(dp[i+c[j]], dp[i]+1);
        }
    }
    
    rec(N, dp[N]);
    cout << "\n";
}





Measured memory_bytes: 384
unittest
{
	assert( [ "4 5", "0 5", "-2 4", "3 4", "4 -4" ].solve == 3 );
	assert( [ "12 3", "1 1", "1 1", "1 1", "1 1", "1 2", "1 3", "2 1", "2 2", "2 3", "3 1", "3 2", "3 3" ].solve == 7 );
	assert( [ "20 100000", "14309 -32939", "-56855 100340", "151364 25430", "103789 -113141", "147404 -136977", "-37006 -30929", "188810 -49557", "13419 70401", "-88280 165170", "-196399 137941", "-176527 -61904", "46659 115261", "-153551 114185", "98784 -6820", "94111 -86268", "-30401 61477", "-55056 7872", "5901 -163796", "138819 -185986", "-69848 -96669" ].solve == 6 );
}



import std.conv;
import std.format;
import std.math;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto d = 0L;
	input.front.formattedRead!"%s %s"( n, d );
	auto xys = new long[ 2 ][ n ];
	foreach( ref xy; xys )
	{
		input.popFront;
		xy = input.front.split.to!( long[] );
	}
	
	auto ans = 0L;
	foreach( xy; xys )
	{
		if( hypot( xy[ 0 ], xy[ 1 ] ) <= d ) ans++;
	}
	return ans;
}


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

typedef long long ll;



int main(){

    string a;
    cin>>a;
    for(int i=0;i<a.size();i++){
        if(a[i]=='?') a[i] ='D';
    }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 3700
#include <iostream>
using namespace std;
int main()
{
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    int ans = 0;
    for (int k1 = 0; k1 <= K; k1++) {
        const int a = A * (1 << k1);
        for (int k2 = 0; k1 + k2 <= K; k2++) {
            const int k3 = K - k1 - k2;
            const int b = B * (1 << k2);
            const int c = C * (1 << k3);
            ans = max(ans, a + b + c);
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*************** using variables **************/
LL a, b, c, k;
/**********************************************/

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

    cin >> a >> b >> c >> k;

    if(k % 2 == 1) cout << b-a << endl;
    else cout << a-b << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P = pair<int,int>;

int main(){
    int n,ans=1;
    cin >> n;
    vector<int> mou(n);
    rep(i,n) cin >> mou[i];
    for(int i=1; i<n; i++){
        bool ansc = true;
        rep(j,i){
            if(mou[j] > mou[i] && i != j)
                ansc = false;
        }
        if(ansc)
            ans++;
    }

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



Measured memory_bytes: 256
def main():
  N = int(input())
  Ds = [list(map(int,input().split())) for x in range(N)]
  c = 0
  f = False
  for d in Ds:
    if d[0] == d[1]:
      c += 1
    else:
      c = 0
    if c == 3:
      f = True
  if f:
    print("Yes")
  else:
    print("No")

main()


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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0) return 0;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    int idx;
    rep(i,n){
      rep(j,s[i].length()){
        if(s[i][j]!='.'){
          idx=j-1;
          break;
        }
        s[i][j]=' ';
      }
      if(idx>=0){
        s[i][idx]='+';
        per(j,i){
          if(s[j][idx]!=' ') break;
          s[j][idx]='|';
        }
      }
    }
    rep(i,n){
      cout << s[i] << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3680
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;

int main(){
    int N;
    cin >> N;
    ll ans=0;
    for(int i=1; i<=N-1; i++){
        for(int a=1;a*a<=i;a++){
            if(i%a==0){
                ans+=2;
                if(a*a==i){
                    ans--;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main() {
    int bi, prn, a = 0;
    scanf("%d %d", &bi, &prn);
    
    for (int i = 0; i < bi+1; ++i){
        int x = bi - i;
        
        if (i*2 + x*4 == prn){
            a = 1;
            break;
        }
    }
        if (a == 1)
            printf("Yes\n");
        else
            printf("No\n");
    
    return 0;
}


Measured memory_bytes: 1616
h,w,n=map(int,input().split())
ls=[]
while True:
    try:
        ls.append(tuple(map(int,input().split())))
    except EOFError:break
check={}
count={0:(h-2)*(w-2)}
for i in range(1,10):
    count[i]=0
for tup in ls:
    for i in range(-2,1):
        for j in range(-2,1):
            if(tup[0]+i>0 and tup[0]+i<h-1 and tup[1]+j>0 and tup[1]+j<w-1):
              try:
                check[(tup[0]+i,tup[1]+j)]+=1
              except KeyError:
                check[(tup[0]+i,tup[1]+j)]=1
              index=check[(tup[0]+i,tup[1]+j)]
              count[index]+=1
              count[index-1]-=1
for i in range(10):
    print("{}".format(count[i]))

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

using namespace std;
typedef long long ll;

vector<int> G[100010];
int id[100010];

bool check(int u, int f) {
  if (id[u]) return id[u] == f;
  id[u] = f;
  bool res = true;
  for (int i = 0; i < G[u].size(); i++) {
    res &= check(G[u][i], (f > 0 ? -1 : 1));
  }
  return res;
}

int main(void) {
  ll n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  if (check(0, 1)) {
    ll b = 0, w = 0;
    for (int i = 0; i < n; i++) {
      b += id[i] == 1;
      w += id[i] == -1;
    }
    cout << b * w - m << endl;
  } else {
    cout << n * (n - 1) / 2 - m << endl;
  }

  return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll arr[maxn];
int n;
int main(void) {
    while(~scanf("%d", &n)) {
        for(int i = 0; i < n; ++i)
            scanf("%I64d", arr + i);
        ll ma1 = 0, ma2 = 0;
        sort(arr, arr + n);
        for(int i = n - 1; i >= 1; --i) {
            if(arr[i] == arr[i - 1]) {
                ma2 = ma1;
                ma1 = arr[i];
                arr[i] = arr[i - 1] = 0;
                if(ma1 && ma2) break;
            }
        }
        printf("%lld\n", ma1 * ma2);
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
#define INF 1<<27

int cost[4][30][30];
int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
int G[30][30],C[4],W,H;

class P{
public:
  P(){}
  int x,y,d,cost;

  P(int x,int y,int d,int cost):x(x),y(y),d(d),cost(cost){}

  bool operator<(const P &p)const{
    return cost > p.cost;
  } 
};

int solve ()
{
  priority_queue<P>pq;
  pq.push(P(0,0,0,0));
  fill(cost[0][0],cost[4][0],INF);
  cost[0][0][0] = 0;
  while(!pq.empty()){
    P p = pq.top();pq.pop();
    if(p.cost > cost[p.d][p.y][p.x])continue;
    if(p.x == W-1 && p.y == H-1 )return p.cost;

    for(int i = 0 ; i < 4 ; i++ ){

      P t = p;
      t.cost += (G[p.y][p.x] == i ? 0 : C[i]);
      t.d = (p.d + i)%4;
      t.x += dx[t.d],t.y += dy[t.d];
      if(!(0<= t.x && t.x < W && 0<=t.y && t.y < H))continue;
      if(t.cost < cost[t.d][t.y][t.x]){
	pq.push(t);
	cost[t.d][t.y][t.x] = t.cost;
      }
    }
  }
}

void input()
{
  while(cin >> W >> H,W+H )
{
  for(int i = 0 ; i < H ; i++ )
    for(int j = 0 ; j < W ; j++ )cin >> G[i][j];

  for(int i = 0 ; i < 4 ; i++ )cin >> C[i];

  cout << solve() << endl;
 }
}


int main()
{
  input();
}

Measured memory_bytes: 1328