akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        int a = Integer.valueOf(mylist.get(0));
        int b = Integer.valueOf(mylist.get(1));

        System.out.println(6 - a - b);

    }

}


Measured memory_bytes: 21204
#include <iostream>

using namespace std;

typedef unsigned long long ull;

int main()
{
	ull a, b, t;
	while(scanf("%llu", &a)+1)
	{
		scanf("%llu", &b);
		ull M = a > b ? a : b;
		ull m = a < b ? a : b;
		while(m != 0)
		{
			t = M % m;
			M = m;
			m = t;
		}

		printf("%llu %llu\n", M, a / M * b);
	}
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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; }

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

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  map<ll,ll> m;
  rep(i,n) {
    ll a; cin>>a;
    m[a]++;
  }
  vll b;
  for(auto e:m){
    if(e.second>=2){
      rep(_,e.second/2){
        b.push_back(e.first);
      }
    }
  }
  vsort(b);
  reverse(all(b));
  if(b.size()<2) cout<<0<<endl;
  else cout<<b[0]*b[1]<<endl;
  
}

Measured memory_bytes: 6528
/*
██████╗  ███████╗  
██╔══██╗ ██╔════╝ 
██████╔╝ ███████╗ 
██╔══██╗ ╚════██║  
██║  ██║ ███████║      
╚═╝  ╚═╝ ╚══════╝                                                                                                             
*/

#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define haha(j,a,n) for(int j=a;j<n;j++)
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define endl "\n"
#define bc(v) v.begin(),v.end()
#define vl vector<ll>
#define vi vector<int>
#define why 1000000007
#define NUM 100005
#define F first
#define S second
#define bhar(a) rep(i,a.size()) cin>>a[i];
#define show(a) rep(i,a.size()) cout<<a[i]<<" ";
#define sott(a) sort(bc(a))
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define mapp map<ll,ll>
#define dkac cout<<fixed<<setprecision(15);
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define yeah(n) while(n--)
ll gcd(int a, int b){if(b==0) return a; else return gcd(b,a%b);}
ll bitfun(ll x){
  return (x&(-x));
}
void solve(){
  ll n,m; cin>>n>>m;
  vl a(n);
  bhar(a);
  ll sm=0;
  rep(i,n) sm+=a[i];
  double x = sm/(m*4.0),ans=0;
  //cout<<x<<endl;
  for(ll i=0;i<n;i++) if(a[i]>=x) ans++;
    if(ans>=m) cout<<"Yes";
    else cout<<"No";
}
int main(){
    ios
    int t=1; 
    //cin>>t;
    yeah(t){
      solve();
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define finish(x) return cout << x << endl, 0;
#define ll long long

int n;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n;
    cout << 48-n << endl;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int S, H, J, I;
  S = n / 1000; //千の位
  n = n % 1000; //左から一桁目を切り捨てる
  H = n / 100; //百の位
  n = n % 100; //左から二桁目を切り捨てる
  J = n / 10; //十の位
  n = n % 10; //右から二桁目を切り捨てる
  I = n; //一の位
 if (S == H) {
    if (H == J) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
 }
  else if (H == J) {
    if (J == I){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }

  else {
    cout << "No" << endl;
  }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()

const int MAX = 1e5+10;

int N, M;
bool done[MAX];
int wa[MAX];

int main() {
    cin >> N >> M;
    REP (i, M) {
        int p; string s;
        cin >> p >> s;
        p--;
        if (!done[p]) {
            if (s == "AC") done[p] = true;
            else wa[p]++;
        }
    }

    int count_ac = 0;
    int count_wa = 0;
    REP (i, N) if (done[i]) {
        count_ac++;
        count_wa += wa[i];
    }

    cout << count_ac << " " << count_wa << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  ll n;
  cin>>n;
  ll sisu[1100];
  rep(i,0,1100){
    sisu[i]=0; 
  }
  rep(i,1,n+1){
    ll c=i;
            for(int j=2;j*j<=i;j++){
                      while(c%j==0){
                        sisu[j]++;
                        c/=j;
                      }
            }
    
            if(c!=1){
              sisu[c]++;
            }
  }
  ll ans=1;
  rep(i,2,n+1){
    if(sisu[i]==0) continue;
   ans=ans*((sisu[i]+1)%inf); 
   ans%=inf;
  //cout<<sisu[i]<<endl;
  }
  cout<<ans<<endl;
}






//木に情報を持たせておく

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

using namespace std;
int sum(int n){
int su=0;
while(n){
    su+=n%10;
    n = n/10;
}
return su;
}

int main()
{
    int i,j,n,m,ans;
    cin>>n;
    ans = 1e9;
    for(i=1;i<n;++i){
        ans = min(ans,sum(i)+sum(n-i));
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#coding: UTF-8

import bisect

# 指定した数以下の素数の個数を返却する
# 素数判定はエラストテネスのふるい

# 要素1000000のリスト（素数かどうかのリスト）を準備
max_number = 1000000
prime_flag_list = [True] * max_number

# 0、1は素数でない
prime_flag_list[0] = False
prime_flag_list[1] = False

# 2の倍数（2を除く）は素数でない
prime_flag_list[4::2] = [False] * len(prime_flag_list[4::2])

# 3以上の数について、素数ならその倍数を振るい落とす
for i in range(3, int(max_number**0.5) + 1, 2):
    prime_flag_list[i*i::i] = [False] * len(prime_flag_list[i*i::i])

# フラグの立ったままの箇所は素数なので、そこだけ取り出す
prime_list = [i for i in range(2, max_number) if prime_flag_list[i]]

while True:
    try:
        input = int(raw_input())
    except EOFError:
        break
    print bisect.bisect_right(prime_list, input)

Measured memory_bytes: 44524
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = (ll)1e11;

ll A, B, Q;
vector<ll> s, t, x;

ll f(ll X) {
  auto s_east = upper_bound(s.begin(), s.end(), X);
  auto t_east = upper_bound(t.begin(), t.end(), X);
  auto s_west = s_east, t_west = t_east;
  s_west--;
  t_west--;
  ll res, tmp[6];
  tmp[0] = (X - *s_west) * 2 + (*t_east - X);
  tmp[1] = (X - *t_west) * 2 + (*s_east - X);
  tmp[2] = (X - *s_west) + (*t_east - X) * 2;
  tmp[3] = (X - *t_west) + (*s_east - X) * 2;
  tmp[4] = X - min(*s_west, *t_west);
  tmp[5] = max(*s_east, *t_east) - X;

  res = tmp[0];
  for (int i = 1; i < 6; i++) {
    res = min(res, tmp[i]);
  }
  return res;
}

void abc119d() {
  for (int i = 0; i < Q; i++) {
    cout << f(x[i]) << "\n";
  }
}

int main() {
  cin >> A >> B >> Q;
  s.assign(A + 2, 0);
  t.assign(B + 2, 0);
  x.assign(Q, 0);
  for (int i = 1; i <= A; i++) {
    cin >> s[i];
  }
  for (int i = 1; i <= B; i++) {
    cin >> t[i];
  }
  s[0] = t[0] = -INF;
  s[A + 1] = t[B + 1] = INF;
  for (int i = 0; i < Q; i++) {
    cin >> x[i];
  }
  abc119d();
  return 0;
}

Measured memory_bytes: 3712
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

#2325
#import numpy as np
import math

def main():
	a,b,x=MI()

	k=0

	if b/2<=x/a**2:
		k=2/a*(b-x/a**2)
	else:
		k=a*b**2/(2*x)

	print(math.degrees(math.atan(k)))





if __name__ == "__main__":
	main()

Measured memory_bytes: 3064
N,M,K=map(int,input().split())
mod=998244353

def cmb(n, r, mod):
  if ( r<0 or r>n ):
    return 0
  r = min(r, n-r)
  return g1[n] * g2[r] * g2[n-r] % mod

g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
  g1.append( ( g1[-1] * i ) % mod )
  inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
  g2.append( (g2[-1] * inverse[-1]) % mod )

ans=0
for k in range(K+1):
  ans+=(M*pow(M-1,N-1-k,mod)*cmb(N-1,k,mod))%mod
  ans=ans%mod
print(ans%mod)

Measured memory_bytes: 32804
def popcount(x):
    return bin(x).count("1")


n=int(input())
x=input()
num=int(x,2)
cnt=popcount(num)

mod1=num%(cnt+1)
mod2=num%(cnt-1) if cnt-1!=0 else 0

for i in range(n):
    if x[i]=="0":
        ans=(mod1+pow(2,n-i-1,cnt+1))%(cnt+1)
    else:
        if cnt-1==0:
            print(0)
            continue
        else:
            ans=(mod2-pow(2,n-i-1,cnt-1))%(cnt-1)
    point=1
    while ans!=0:
        ans %=popcount(ans)
        point +=1
    print(point)

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

int main() {
    int N;
    int t[110000], x[110000], y[110000];
    cin >> N;
    t[0] = x[0] = y[0] = 0;  // 初期状態
    for (int i = 0; i < N; ++i) cin >> t[i+1] >> x[i+1] >> y[i+1];  // 1-index にしておく

    bool can = true;
    for (int i = 0; i < N; ++i) {
        int dt = t[i+1] - t[i];
        int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if (dt < dist) can = false;
        if (dist % 2 != dt % 2) can = false;  // dist と dt の偶奇は一致する必要あり！
    }

    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define repeat(i,a,b) for(int i=(a),i##__end=(b);i<i##__end;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,i##__end=(a);i>=i##__end;i--)
#define mst(a,x) memset((a),(x),sizeof(a))
#define pii pair<int,int>
#define N 1000010
#define mod 1000000007
#define int ll
//快速幂压行
ll qpow(ll a,ll b/*,ll mod*/){
	ll ans=1;
	do{
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}while(b>>=1);
	return ans;
}
//快速幂版乘法逆元
ll getinv(ll n){
	return qpow(n,mod-2);
}
int x,y,a,b;
signed main(){
	//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>x>>y;
	if((x+y)%3!=0){cout<<0<<endl;return 0;}
	a=(x+y)/3;
	b=x-a;
	if(b<0 || b>a){cout<<0<<endl;return 0;}
	int ans=1,inv=1;
	repeat(i,a-b+1,a+1)ans=(ans*i)%mod;
	repeat(i,1,b+1)inv=(inv*i)%mod;
	ans=(ans*getinv(inv))%mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
ll n, ans = 1ll << 60;
int main()
{
	scanf("%lld", &n);
	for (int i = 1; (ll)i * i <= n; i++)
		if (n % i == 0)
			ans = min(ans, i + n / i);
	printf("%lld\n", ans - 2);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>

int main() {
    int N,M;
    std::cin >> N >> M;
    std::map<unsigned long,unsigned long> AB;
    unsigned long a,b;
    for(int i = 1; i <= N; i++){
        std::cin >> a;
        std::cin >> b;
        AB[a] += b;
    }
    int last = M;
    unsigned long ans = 0;
    for(auto itr = AB.begin(); itr != AB.end(); itr++){
        if(itr->second < last){
            last -= itr->second;
            ans += itr->first * itr->second;
        }else if(itr->second == last){
            ans += itr->first * itr->second;
            break;
        }else if(itr->second > last){
            ans += itr->first * last;
            break;
        }
    }
    std::cout << ans << std::endl;
}

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


class Main{
    public static void main(String args[]){
	Scanner scan  = new Scanner(System.in);
	int n = scan.nextInt() * 2;
	int total = 0;
	int[] l = new int[n];
        for(int i=0;i<n;i++){
            l[i] = scan.nextInt();
        }
        Arrays.sort(l);
	for(int i=0;i<n;i++){
            if(i%2==0)total += l[i];
        }
        System.out.println(total);
    }
}



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

int main() {
  int N, A=0, B=0;
  cin>>N;
  vector<int> a(N);
  for (int i=0; i<N; i++)
    cin>>a.at(i);
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int i=0; i<N; i++){
    if (i%2==0)
      A+=a.at(i);
    else
      B+=a.at(i);
  }
  cout<<A-B<<endl;
}

Measured memory_bytes: 256
a, b = map(int, input().split())

ans1 = a + b
ans2 = a - b
ans3 = a * b

if ans1 > ans2:
  if ans1 > ans3:
    print(ans1)
  else:
    print(ans3)
else:
  if ans2 > ans3:
    print(ans2)
  else:
    print(ans3)


Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {

	public static void main(String[] args) {
		int[] group = {0,1,3,1,2,1,2,1,1,2,1,2,1};
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		try{
			String s = new String(in.readLine());
			String[] spStr = s.split(" ",0);
			int x = Integer.parseInt(spStr[0]);
			int y = Integer.parseInt(spStr[1]);
			if(group[x] == group[y]){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
			System.out.println();
		}catch(Exception e){}

	}
}

Measured memory_bytes: 21204
n, x, y, z = map(int, input().split())
s = x+y+z
MOD = 10**9+7
dp = [[0]*(1<<s) for _ in range(n+1)]
dp[0][0] = 1
mask = (1<<s) - 1
for i in range(n):
  for j in range(1<<s):
    for k in range(1, 11):
      t = ((j<<k) | (1<<(k-1))) & mask
      if t>>(z-1) & 1 and t>>(y+z-1)&1 and t>>(x+y+z-1)&1:
        continue
      dp[i+1][t] += dp[i][j]
      dp[i+1][t] %= MOD
ans = pow(10, n, MOD) - sum(dp[n])
ans %= MOD
print(ans)

Measured memory_bytes: 87772
n, h, w = input().split()
n = int(n)
h = int(h)
w = int(w)
a = []
b = []

for i in range(n):
	add = input().split()
	a.append(int(add[0]))
	b.append(int(add[1]))

count = 0
for i in range(n):
	if a[i] >= h and b[i] >= w:
		count += 1
	else:
		pass

print(count)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=200005;
int n;
char s[N];
char a[N];
int len[N],l[N];
int m;
int sum[N][2];
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1,j=1;i<=n;i=j)
	{
		while(j<=n&&s[i]==s[j]) j++;
		m++,a[m]=s[i],len[m]=j-i;
	}
	for(int i=1;i<=m;i++)
	{
		sum[i][0]+=sum[i-1][0];
		sum[i][1]+=sum[i-1][1];
		sum[i][a[i]-'0']+=len[i];
		l[i]=l[i-1]+len[i];
	}
	long long ans=0;
	for(int i=1;i<=m;i++)
	{
		if(a[i]=='1')
		{
			if(len[i]&1)
			{
				ans+=(sum[i][0]+l[i]%2)/2;
				ans+=sum[m][0]-sum[i][0];
				int t=len[i]/2;
				ans+=sum[i][0]*t;
				ans+=(sum[m][0]-sum[i][0])*t;
			}
			else
			{
				int t=len[i]/2;
				ans+=sum[i][0]*t;
				ans+=(sum[m][0]-sum[i][0])*t;
			}
		}
	}
	for(int i=0;i<=sum[m][1];i++)
	{
		int s=sum[m][1]-i;
		ans+=(s+1)/2;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 7296
N, M = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(M)]
data = sorted(data, key=lambda x: x[1])

count = 1
left = data[0][1]
for i in range(1, M):
    if data[i][0] < left:
        left = max(data[i][0], left)
    else:
        count += 1
        left = data[i][1]
print(count)


Measured memory_bytes: 29452
import java.util.*;
  
public class Main
{
    public static void main (String[] args)
    {
        Scanner scanner = new Scanner(System.in);
  
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
  
        if(a < b && b < c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
    }
  }
}

Measured memory_bytes: 26244
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific

using namespace std;

int main(void) {
    size_t m, n, x;
    cin >> m >> x;
    n = 2*m-1;
    if (x != 1 && x != n)
    {
        cout << "Yes\n";
        size_t *row = new size_t[n];
        size_t pos = m-1;
        row[pos] = x;
        //pos+pos = 2*(m-1) = 2*m-2 = n-1
        for (size_t i = 1; i <= pos; ++i)
        {
            size_t next_up = x+i>n ? x+i-n : x+i;
            size_t next_down = i>=x ? n-i+x : x-i;
            row[pos+i] = (i%2 ? next_up : next_down);
            row[pos-i] = (i%2 ? next_down : next_up);
        }
        for (size_t i = 0; i < n; ++i) cout << row[i] << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end

typedef pair<ll,ll> P;
ll res[201000]={},sum[201000]={};

int main(){
   int n; ll d,a; scanf("%d%lld%lld",&n,&d,&a);
   vector<P> mst(n);
   rep(i,0,n){
      scanf("%lld%lld",&mst[i].first,&mst[i].second);
      mst[i].second=(mst[i].second+a-1)/a;
   }
   sort(ALL(mst));
   rep(i,0,n){
      int idx=lower_bound(ALL(mst),P{mst[i].first-2LL*d,-1})-mst.begin();
      ll sub=sum[i]-sum[idx];
      res[i]=max(0LL,mst[i].second-sub);
      sum[i+1]=sum[i]+res[i];
   }
   printf("%lld\n",sum[n]);
   return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int N;
bool A[2010][2010];
bool L[2010][2010];
bool R[2010][2010];

using BS = bitset<2010>;
V<BS> Rix(2010);
V<BS> Lxi(2010);
V<BS> Aix(2010);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	cin >> N;
	{
		V<string> s(N);
		rep1(i,N-1) cin >> s[i];
		rep(i,N) rep(j,N){
			if(i>j) A[i][j] = s[i][j]=='1';
			if(j>i) A[i][j] = s[j][i]=='0'; 
		}
	}
	if(false){
		rep(i,N){
			rep(j,N) cout << A[i][j] << " ";
			cout << endl;
		}
	}
	rep(i,N){
		rep(j,N) if(A[i][j]) Aix[i].set(j);
	}

	for(int d=1;d<=N;d++){
		for(int l=0;l+d-1<N;l++){
			int r = l+d-1;
			if(d == 1){
				Lxi[r].set(l);
				Rix[l].set(r);
				L[l][r] = true;
				R[l][r] = true;
			}else{
				{	//L
					// for(int x=l+1;x<=r;x++){
					// 	if(A[l][x] && R[l+1][x] && L[x][r]){
					// 		L[l][r] = true;
					// 		break;
					// 	}
					// }
					auto tmp = Aix[l] & Rix[l+1] & Lxi[r];
					if(tmp.any()) Lxi[r].set(l);
				}
				{	//R
					// for(int x=l;x<r;x++){
					// 	if(A[r][x] && L[x][r-1] && R[l][x]){
					// 		R[l][r] = true;
					// 		break;
					// 	}
					// }
					auto tmp = Aix[r] & Rix[l] & Lxi[r-1];
					if(tmp.any()) Rix[l].set(r);
				}
			}
		}
	}
	int ans = 0;
	rep(i,N) if(Rix[0][i] && Lxi[N-1][i]){
		ans++;
		show(i);
	}
	cout << ans << endl;
}


Measured memory_bytes: 13732
#include <stdio.h>  
 int main(){ 
 int a, b; 
     scanf("%d %d", &a, &b); 
     if(a>b){ 
         printf("a > b\n"); 
     }else if(a<b){ 
         printf("a < b\n"); 
     }else{ 
         printf("a == b\n"); 
     } 
     return 0; 
 } 




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

using namespace std;

double RofCake[12];
double Dp[4096][12];

const double INF = DBL_MAX;

unsigned popcnt(unsigned u)
{
	unsigned ret = 0;
	while (u)
	{
		u = (u & (u - 1));
		ret++;
	}
	return ret;
}

double getDistance(double r1, double r2)
{
	return sqrt(pow(r1 + r2, 2) - pow(r1 - r2, 2));
}

double solve(int index) {
	int next;
	double ans;

	for (int i = 0; i < (1<<index); i++) {
		for (int j = 0; j < index; j++) {
			for (int k = 0; k < index; k++) {
				next = i | (1 << j);
				if (i == 0) {
					Dp[next][j] = min( Dp[next][j], RofCake[j]);
					continue;
				}
				if (Dp[i][k] == INF) {
					continue;
				}

				if (popcnt(next) == index) {
					Dp[next][j] = min(Dp[next][j], Dp[i][k] + getDistance(RofCake[k], RofCake[j]) + RofCake[j]);
				}
				else {
					Dp[next][j] = min(Dp[next][j], Dp[i][k]+getDistance(RofCake[k],RofCake[j]));
				}
			}
		}
	}

	ans = INF;
	for (int i = 0; i < index; i++) {
		ans = min(ans, Dp[(1 << index) - 1][i]);
	}

	return ans;
}


int main() {
	int w, index;
	string str;
	stringstream ss;
	double ans;

	while (getline(cin,str)) {
		ss << str;
		ss >> w;
		index = 0;
		memset(RofCake, 0, sizeof(RofCake));
		while (ss >> RofCake[index]) {
			//cout<<RofCake[index]<<ends;
			index++;
		}
		//cout << index << endl;
		for (int i = 0; i < (1 << index); i++) {
			for (int j = 0; j < index; j++) {
				Dp[i][j] = INF;
			}
		}

		ans = solve(index);

		if (ans > w) {
			cout << "NA" << endl;
		}
		else {
			cout << "OK" << endl;
		}

		str = "";
		ss.clear();
	}
	

	return 0;
}


Measured memory_bytes: 3608
#pragma GCC optimize(3)
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define mst(a,b) memset(a,b,sizeof(a))
#define For(i, k, j) for(register int i = (k); i <= (j); i++)
#define INF (1 << 30) - 1
#define ll long long
#define reaD() read()
using namespace std;
inline int read()
{
    int num=0,flag=1;char c=' ';
    for(;c>'9'||c<'0';c=getchar()) if(c=='-') flag = -1;
    for(;c>='0'&&c<='9';num=(num<<1)+(num<<3)+c-48,c=getchar());
    return num*flag;
}
long long a,b,k;
main(){
    scanf("%lld%lld%lld",&k,&a,&b);
    if(k<=a)return puts("1"),0; //按思路特判
    else if(a<=b)return puts("-1"),0;   //按思路特判
    else printf("%lld\n",((k-a)/(a-b)+bool((k-a)%(a-b)))<<1|1);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
//#define sz(x) int((x).size())

/*int gcd(int a, int b) {
  if(a < b) gcd(b, a);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
  }*/


int main() {
  int N,M;
  cin >>N >> M;
  string S,T;
  cin >> S >> T;
  long long int GCD = __gcd(M,N);
  int n = N/GCD;
  int m = M/GCD;
  bool out=false;
  for (int i=0; i<GCD; i++){
    //      if(S[i*n] != T[i*m]){
    if(S[i*(N/GCD)] != T[i*(M/GCD)]){  
      //        cout <<  -1 << endl;
      //        return 0;
      out = true;
      }
      
  }
  if(out)
    cout<<-1<<endl;
  else
    cout<<M*(N/GCD)<<endl;
  //  cout << M*N/GCD << endl;
  //  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int a,b,c;
  cin >> a >> b >> c;
  int x = 0;
  for (int i=a;i<=b;i++) {
    if ( c%i == 0 ) {
      x++;
    }
  }
  cout << x << endl;
}


Measured memory_bytes: 3096
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=1010000;
const int MOD=1e9+7;
long long n,a,b;
long long c[MAXN];
long long f[MAXN],s[MAXN];
int main()
{
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
    scanf("%lld%lld%lld",&n,&a,&b);
    if(a>b)swap(a,b);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&c[i]);
        if(i>2&&c[i]-c[i-2]<a)
        {
            printf("0");
            return 0;
        }
    }	
    f[0]=s[0]=1;
    for(int i=1,l=0,r=0;i<=n;i++)
    {
        while(i>1&&c[i]-c[r+1]>=b)r++;
        if(l<=r)
        {	
            f[i]=s[r];
            if(l!=0)f[i]=(f[i]+MOD-s[l-1])%MOD;
        }
        s[i]=(s[i-1]+f[i])%MOD;
        if(i>1&&c[i]-c[i-1]<a)l=i-1;
    }
    long long ans=0;
    for(int i=n;i>=0;i--)
    {
        ans=(ans+f[i])%MOD;
        if(i<n&&a>c[i+1]-c[i])break;
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sync ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD  1000000007 
int powm(int base,int exp,int mod=MOD) {int ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
int32_t main()
{
	int n;
	cin>>n;
	double a[n];
	float sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=(1/a[i]);
	}
	float ans=1/sum;
	cout<<ans<<endl;
}	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<long long> num;
long long Q[int(1e7)];
int l=1,r=0;
inline void prepare() 
{
	for(register int i=1;i<10;i++)
		Q[++r]=i;
	while(r>l) 
	{
		long long cur=Q[l++];
		if(cur>1e11) 
			return;
		num.push_back(cur);
		int back=cur%10;
		Q[++r]=cur*10ll+back; 
		if(back!=0)
			Q[++r]=cur*10ll+back-1;
		if(back!=9) 
			Q[++r]=cur*10ll+back+1;
	}
}
signed main() 
{
	prepare();
	int k;
	cin>>k;
	sort(num.begin(),num.end()) ;
	cout<<num[k-1]<<endl;
}

Measured memory_bytes: 22892
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    int N;
    cin >> N;
    vector<pair<int, int>> ab(N);
    REP(i, N) {
        cin >> ab[i].first >> ab[i].second;
    }

    sort(ALL(ab), [](auto p1, auto p2) {return p1.second < p2.second; });

    int time = 0;
    REP(i, N) {
        time += ab[i].first;
        if(time > ab[i].second)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    ll s = (K % 2 == 0) ? 1 : -1;
    PR(s*(A-B));

    return 0;
}

/*



*/

Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>

using namespace std;
int main(void){
 long long int R,G,B,N;
 long long int ans=0;

 cin>>R>>G>>B>>N;
 
 for(int i=0; i<=(N/R);i++)
  for(int j=0; j<=(N/G);j++)if((N-i*R-j*G)>=0 &&(N-i*R-j*G)%B==0)ans++;

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

Measured memory_bytes: 256
class Mode
  def initialize
    @numbers = Hash.new
    @result = []
    while num = $stdin.gets do
      num = num.chomp.to_i
      if @numbers.has_key?(num)
        @numbers[num] += 1
      else
        @numbers[num] = 1
      end
    end
    
    max = 0

    @numbers.each_pair do |num, count|
      if max < count 
        max = count
        @result = [num]
      elsif max == count
        @result << num
      end
    end

    @result.sort.each do |n|
      puts n
    end
  end
end

m = Mode.new

Measured memory_bytes: 2324
#include<stdio.h>
int main()
{
	long long int x;
	long long int a=100,b=0,c=0;
	scanf("%lld",&x);
	while(1){
		if(x<=a){
			printf("%d\n",c);
			break;
		}
		b=a/100;
		a+=b;
		c++;
	}
	return 0;
}

Measured memory_bytes: 1704
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k,sum=0;
  cin>>n>>k;
  int arr[n],i;
  for(i=0;i<n;i++)
  	cin>>arr[i];
  sort(arr,arr+n);
  for(i=0;i<k;i++)
  	sum+=arr[i];
   cout<<sum;	
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

typedef long long   ll;
typedef long double ld;
const int N  = 5e5+10;
const int M  = 20;
const ll mod = 1e9+7;
const ll inf = 1e18;
 
#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb              push_back
#define mp              make_pair
#define ub              upper_bound                 // first element >  val(itr)
#define lb              lower_bound                 // first element >= val(itr) 
#define all(x)          (x).begin(),(x).end()
#define reset(a,x)      memset(a,x,sizeof(a))       // x can be 0 or -1
#define leadzero(a)     __builtin_clz(a)            // count leading zeroes
#define trailzero(a)    __builtin_ctz(a)            // count trailing zeroes
#define bitcount(a)     __builtin_popcount(a)       // count set bits
#define iceil(n,x)      ((n)+(x)-1)/(x)
#define test            int t; cin>>t; while(t--)
#define forn(i,a,e)     for(ll i = a; i < e; i++)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;    }
ll powm(ll base,ll exp){ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
ll add(ll a,ll b)  { return (a%mod+b%mod)%mod;        }
ll sub(ll a, ll b) { return (a%mod+mod-b%mod)%mod;    }
ll mult(ll a,ll b) { return ((a%mod)*(b%mod))%mod;    }
ll choose2(ll n)   { ll ans=(n*(n-1))/2; return ans;  }
ll dist2(ll x1,ll y1,ll x2,ll y2){ ll ans=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); return ans;}

int main()
{
    fast
    string s;
    cin>>s;
    bool isok=1;
    forn(i,0,3)
    {
      if(s[i]==s[i+1])
        isok=0;
    }
    if(isok)
        cout<<"Good";
    else
        cout<<"Bad";
    return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll
const long double pi = 3.14159265358979323846;

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<Pll> v(n);
    rep(i,0,n){
        cin >> v[i].first >> v[i].second;
    }
    using Plll = pair<Pll, ll>;
    vector<Plll> p(n);
    rep(i,0,n){
        auto [x, y] = v[i];
        Pll t = {x - y, x + y};
        p[i] = {t, i};
    }
    sort(all(p));
    debug(p);
    auto c = [&](ll i, ll j){
        return abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second);
    };
    ll f = p[0].second, l = p[n-1].second;
    ll ans = -INF;
    chmax(ans, c(f, l));
    sort(all(p), [](auto const &a, auto const &b){
        return a.first.second < b.first.second;
    });
    debug(p);
    f = p[0].second, l = p[n - 1].second;
    chmax(ans, c(f, l));

    cout << ans << "\n";
}

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

int main() {
    long n, m, d;
    cin >> n >> m >> d;
    if (d != 0 && 2 * d <= n - 1) {
        printf("%.8f\n", (2 * n - 2 * d) * (m - 1) / double(n) / n);
    } else {
        printf("%.8f\n", (m - 1) / double(n));
    }
}


Measured memory_bytes: 256
#include <cstdio>

constexpr int MAX_N = 100000, MAX_AB = 100000; 

int N;
long long K;
long long num[MAX_AB + 1];

int main(){
	scanf("%d%lld", &N, &K);

	for(int i = 0; i < N; ++i){
		int a, b;
		scanf("%d%d", &a, &b);
		num[a - 1] += (long long)b;
	}

	for(int i = 0; ; ++i){
		if(num[i] == 0){
			continue;
		}

		if(K <= num[i]){
			printf("%d\n", i + 1);
			break;
		}
		
		K -= num[i];
	}
	return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n); for(auto&&i:a)cin>>i;
	int ans=0;
	for(int i=1;i!=2&&ans<n;++ans){
		i=a.at(i-1);
	}
	cout<<(ans<n?ans:-1)<<"\n"s;
}


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

int main() {
  
  int N, T; cin >> N >> T; int minCost = 1001;
  
  for (int i = 0; i < N; i++) {
    int c, t; cin >> c >> t;
    if (t <= T) minCost = min(minCost, c);
  }
  
  if (minCost == 1001) cout << "TLE" << endl;
  
  else cout << minCost << endl;
  
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9+7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amin(T& a,T b){ a=min(a,b);}
template <class T> void amax(T& a,T b){ a=max(a,b);}

int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	VI a(3);
	cin >>n >>a[0] >>a[1] >>a[2];
	VI l(n);
	rep(i, n) cin >> l[i];
	int cnd=0;
	rep(i,n){
		int amp = 999999999;
		rep(j, 3){
			amp = min(amp, abs(a[j] - l[i]));
		}
		cnd += amp;
	}
	//dbg(cnd);
	
	int ans = 1<<28;
	int pj=4;
	rep(i,(int)pow(pj, n)){
		vector<int> vi(n);
		for(int j=0, wki=i; j<n; j++, wki/=pj){
			vi[n-1-j] = wki%pj;
		}
		
		VI sm(4), cnt(4);
		rep(j, n){
			sm[vi[j]] += l[j];
			cnt[vi[j]]++;
		}
		if(cnt[0]<1 || cnt[1]<1 || cnt[2]<1) continue;
		
		int sk=0;
		rep(k,3){
			 sk += abs(sm[k] - a[k]) + max(0, (cnt[k] - 1) *10);
		}
		ans = min(ans, sk);
	}	
		
	cout << min(cnd, ans) <<"\n";

	return 0;
}



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

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

  int64_t lucas[87];
  lucas[0] = 2; lucas[1] = 1;
  for (int i = 2; i <= 86; i++){
    lucas[i] = lucas[i - 1] + lucas[i - 2];
  }

  cout << lucas[n] << endl;
}

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

int main(){

  int n, m, a, b, cnt[50]={};

  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>a>>b;
    cnt[a-1]++;
    cnt[b-1]++;
  }

  for(int i=0;i<n;i++) cout<<cnt[i]<<endl;
  
  return 0;
}


Measured memory_bytes: 256
import heapq

first = input()
c1 = input()
c2 = input()
c3 = input()
times = int(first.split(' ')[3])
ca = sorted([int(x) for x in c1.split(' ')], reverse=True)
cb = sorted([int(x) for x in c2.split(' ')], reverse=True)
cc = sorted([int(x) for x in c3.split(' ')], reverse=True)
h = []
ex = set()
i, j, k = 0, 0, 0
s = ca[i] + cb[j] + cc [k]
heapq.heappush(h, (-s, (s, i, j, k)))
ex.add((i, j, k))
for t in range(times):
    m = heapq.heappop(h)
    print(m[1][0])
    i, j, k = m[1][1], m[1][2], m[1][3]
    ex.discard((i, j, k))
    if i+1 < len(ca):
        if (i+1, j, k) not in ex:
            s1 = ca[i+1] + cb[j] + cc[k]
            heapq.heappush(h, (-s1, (s1, i+1, j, k)))
            ex.add((i+1, j, k))
    if j+1 < len(cb):
        if (i, j+1, k) not in ex:
            s2 = ca[i] + cb[j+1] + cc[k]
            heapq.heappush(h, (-s2, (s2, i, j+1, k)))
            ex.add((i, j+1, k))
    if k+1 < len(cc):
        if (i, j, k+1) not in ex:
            s3 = ca[i] + cb[j] + cc[k+1]
            heapq.heappush(h, (-s3, (s3, i, j, k+1)))
            ex.add((i, j, k+1))


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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

#define MAXAS(x,v) x = max(x,v)

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

#define PI 3.141592653589793

#define MOD 1000000007L
// #define INF 100000000000

#define MAX_V 2000
#define INF 2147483647
//to,cost
typedef pair<long, long> P;

signed main() {
	int x;
	int y;
	cin >> x >> y;
	bool yes = false;
	int a[] = { 4, 6, 9, 11 };
	int b[] = { 1, 3, 5, 7, 8, 10, 12 };
	if ((x == 2 && y == 2) || (find(begin(a), end(a), x) != end(a) && find(begin(a), end(a), y) != end(a)) || (find(begin(b), end(b), x) != end(b) && find(begin(b), end(b), y) != end(b))) {
		yes = true;
	}
	cout << (yes ? "Yes" : "No") << endl;
}


Measured memory_bytes: 764
# coding=utf-8

if __name__ == "__main__":
    S = input()

    for idx, str_ in enumerate(S):
        if idx % 2 != 0:
            if str_ in ["L", "U", "D"]:
                continue
            else:
                print("No")
                break
        else:
            if str_ in ["R", "U", "D"]:
                continue
            else:
                print("No")
                break
    else:
        print("Yes")


Measured memory_bytes: 2940
import numpy as np

N=int(input())
H=list(map(int,input().split()))

acc = np.zeros(N)
acc[-1] = 0
for i in reversed(range(N-1)):
    if H[i] >= H[i+1]:
        acc[i] = acc[i+1] + 1
    else:
        acc[i] = 0
print(int(max(acc)))

Measured memory_bytes: 23384
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

using Graph = vector<vector<int>>;
Graph graph;
map<pair<int, int>, int> colors;
int max_color = 0;

void dfs(int cur, int par, int color) {
    for (auto next: graph[cur]) {
        if (next == par) continue;

        color += 1;
        color %= max_color;

        int a = cur, b = next;
        if (a > b) swap(a, b);
        colors[{a, b}] = color;
        dfs(next, cur, color);
    }
}
int main() {
    cin.tie(0); ios::sync_with_stdio(false);

    int n; cin >> n;
    graph.resize(n);
    vector<int> a(n - 1), b(n - 1);

    rep(i, n - 1) {
        cin >> a[i] >> b[i];
        --a[i]; --b[i];

        if (a[i] > b[i]) swap(a[i], b[i]);

        graph[a[i]].push_back(b[i]);
        graph[b[i]].push_back(a[i]);
    }

    int index = 0;
    rep(i, n) {
        if (max_color < (int)graph[i].size()) {
            index = i;
            max_color = graph[i].size();
        }
    }

    dfs(index, -1, 0);

    cout << max_color << endl;
    rep(i, n - 1) {
        cout << colors[{a[i], b[i]}] + 1 << endl;
    }
}


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

int main(){
  ll n,m;
  cin >> n >> m;
  int bound = sqrt(m) + 1;
  ll ans = 0;
  rep(i,bound){
    ll num = i+1;
    if(m % num != 0) continue;
    ll buf = m / num;
    if(buf * n <= m) ans = max(ans,buf);
    if(num * n <= m) ans = max(ans,num);
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int N,M,R,A,B,C,ans=1e9,c,i,j,k;
    cin>>N>>M>>R;
    vector<int>r(R);
    for(i=0;i<R;i++)cin>>r[i];
    int d[N][N]={};
    for(i=0;i<N*N;i++)if(i/N!=i%N)d[i/N][i%N]=1e9;
    for(i=0;i<M;i++){cin>>A>>B>>C;if(d[A-1][B-1]>C)d[A-1][B-1]=d[B-1][A-1]=C;}
    for(k=0;k<N;k++)for(i=0;i<N;i++)for(j=0;j<N;j++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
    sort(r.begin(),r.end());
    do{
        for(i=1,c=0;i<r.size();i++)c+=d[r[i-1]-1][r[i]-1];
        if(ans>c)ans=c;
    }while(next_permutation(r.begin(),r.end()));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
use std::io::*;
use std::str::FromStr;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    loop {
        let h: u32 = sc.read();
        let w: u32 = sc.read();
        if h == 0 { break }
        for i in 0..h {
            for j in 0..w {
                let c = if i == 0 || j == 0 || i == h-1 || j == w-1 {
                    '#'
                } else {
                    '.'
                };
                print!("{}", c);
            }
            println!("");
        }
        println!("");
    }
}



Measured memory_bytes: 5028
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    long long X, Y; cin >> X >> Y;

    int ans = 0;
    while (true) {
        if (X > Y) break;
        Y /= 2;
        ++ans;
    }

    cout << ans << endl;
}

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

int main(){
  string s;
  cin>>s;
  int i=7;
  if(s=="SUN"){
    cout<<i<<endl;
  }
  if(s=="MON"){
    cout<<i-1<<endl;
  }
  if(s=="TUE"){
    cout<<i-2<<endl;
  }
  if(s=="WED"){
   cout<<i-3<<endl;
  }
  if(s=="THU"){
    cout<<i-4<<endl;
  }
  if(s=="FRI"){
    cout<<i-5<<endl;
  }
  if(s=="SAT"){
    cout<<i-6<<endl;
  }
return 0;
}


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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<long long int> v;
  for (int i = 0; i < n; i++) {
    long long int tmp;
    cin >> tmp;
    v.push_back(tmp);
  }

  long long int res = 0;

  for (int i = 0; i <= n && i <= k; i++) {
    for (int j = 0; j <= n - i && j <= k - i; j++) {

      vector<long long int> mine;

      for (int l = 0; l < i; l++) {
        mine.push_back(v[l]);
      }
      for (int r = 0; r < j; r++) {
        int s = v.size() - 1;
        mine.push_back(v[s-r]);
      }

      //      for (int take = 0; take < mine.size(); take++) {
      //        cout << mine[take] << " ";
      //      }
      //      cout << endl;

      sort(mine.begin(), mine.end());
      for (int x = 0; x < k - i - j; x++) {
        if (mine.empty() || mine.front() >= 0) {
          break;
        } else {
          mine.erase(mine.begin());
        }
      }

      long long int tmpRes;
      if (mine.empty()) {
        tmpRes = 0;
      } else {
        tmpRes = accumulate(mine.begin(), mine.end(), 0);
      }
      res = max(res, tmpRes);
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
  
long snk, ari, a[223456];

int main(){
  int n;
  scanf("%d", &n);
  
  for (int i = 0; i < n; i++){
  	scanf("%ld", a + i);
  }

  long ans = 12345678901;

  long sum;
  for (int i = 0; i < n; i++){
  	sum += a[i];
  }

  snk = 0;
  ari = sum;

  for (int i = 0; i < n - 1; i++){
  	snk += a[i];
  	ari -= a[i];
  	ans = min(ans, abs(snk - ari));
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
inline int sqr(int x){
	return x*x;
}
int main(){
	int n,a[101];
	cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		ans+=sqr(a[i]);
	}
	for(int x=-100;x<=100;x++){\
	int tmp=0;
	for(int i=1;i<=n;i++){
		tmp+=sqr(a[i]-x);
	}
	ans=min(ans,tmp);
	}
	cout<<ans;
}

Measured memory_bytes: 256