akhauriyash/Code-Regression huggingface dataset:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N = in_n()

    ans = 0

    for i in range(N):
        x, u = readline().rstrip().split()
        x = float(x)
        u = u.decode()
        if u == 'JPY':
            ans += x
        elif u == 'BTC':
            ans += x * 380000

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

struct data{
  ll time;
  int type;
  ll val;
  
  // 演算子オーバーロードで比較関数を定義
  bool operator<(const data& b) const {
    if (time != b.time)
      return time < b.time;
    if (type != b.type)
      return type < b.type;
    return val < b.val;
  }
};

bool cmp(const data &a, const data &b)
{
    return a.time < b.time;
}

int main(){
  int n,q; cin >> n >> q;
  vector<data> v;
  vector<ll> ans(q);
  rep(i,n){
    data tmp1,tmp2;
    ll s,t,x; cin >> s >> t >> x;
    tmp1.time = s-x,tmp1.type = -1, tmp1.val = x;
    tmp2.time = t-x,tmp2.type = 0, tmp2.val = x;
    v.push_back(tmp1);
    v.push_back(tmp2);
  }
  
  rep(i,q){
    ll d; cin >> d;
    data tmp;
    tmp.time = d, tmp.type = 1, tmp.val = i;
    v.push_back(tmp);
  }
  sort(v.begin(),v.end());
/*  
  for(auto e:v){
    printf("time=%d type=%d val=%d\n",e.time,e.type,e.val);
  }
*/
  
  multiset<ll> st;
  
  for(auto e:v){
    if(e.type == -1) st.insert(e.val);
    else if(e.type == 0) st.erase(st.find(e.val));
    else{
      if(st.empty()) ans[e.val] = -1;
      else ans[e.val] = *st.begin();
    }
  }
  
  rep(i,q){
    cout << ans[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 28008
#include <iostream>

int main() {
    int co,b,f,r,v;
	int n[5][4][11]={0};
    std::cin >> co;
    for(int con=0;con<co;con++){
        std::cin >> b >> f >> r >> v;
        n[b][f][r]=v+n[b][f][r];
    }
    for(int bc=1;bc<5;bc++){
        for(int fc=1;fc<4;fc++){
            for(int rc=1;rc<11;rc++){
                std::cout << " " <<n[bc][fc][rc];
            }
            std::cout << std::endl;
        }
        if(bc<4)std::cout << "####################" << std::endl;
    }
	return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int main() {
    int a, b; cin >> a >> b;
    cout << a * b << endl;
}

struct boot {
    boot() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} boot_;


Measured memory_bytes: 3636
#include<cstdio>
int main(){
    long long a,b,c,i=0;
    scanf("%lld%lld%lld",&a,&b,&c);
    while(a!=b||b!=c){
        if(a%2==1||b%2==1||c%2==1){
            printf("%lld",i);
            return 0;
        }
        long long atmp=(b+c)/2,btmp=(c+a)/2,ctmp=(a+b)/2;
        a=atmp;
        b=btmp;
        c=ctmp;
        i++;
    }
    if(a%2==0)printf("-1");
    else printf("0");
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int month, day;
	int i, j;
	int a, b;
	int n;
	
	scanf("%d %d", &a, &b);
	while (a != 0 && b != 0){
		n = 0;
		for (month = 1; month < a; month++){
			switch (month){
				case 1: case 3: case 5: case 7:
				case 8: case 10: case 12:
					n += 31;
					break;
				case 4: case 6: case 9: case 11:
					n += 30;
					break;
				case 2:
					n += 29;
					break;
			}
		}
		for (day = 1; day < b; day++);
		n += day;
		
		switch (n % 7){
			case 0:
				puts("Wednesday");
				break;
			case 1:
				puts("Thursday");
				break;
			case 2:
				puts("Friday");
				break;
			case 3:
				puts("Saturday");
				break;
			case 4:
				puts("Sunday");
				break;
			case 5:
				puts("Monday");
				break;
			default:
				puts("Tuesday");
				break;
		}
		scanf("%d %d", &a, &b);
	}
	
	return (0);
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
#define all(x) x.begin(), x.end()
#define fi first
#define se second
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

int main() {
    Int n, a, b;
    cin >> n >> a >> b;
    if ((b - a) % 2 == 0) {
        dump((b - a) / 2);
    }
    else {
        Int res1 = (n - (a + (n - b) + 1)) / 2 + (n - b) + 1;
        Int res2 = (b - (a - 1) - 1 - 1) / 2 + a - 1 + 1;
        dump(min(res1, res2));
    }
    return 0;
}

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

using namespace std;

const int INF = 1 << 30;

int main()
{
  int W, H, N, L[100000] = {};

  scanf("%d %d %d", &W, &H, &N);
  for(int i = 0; i < N; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    L[x] = max(L[x], y);
  }

  int ret = INF, curr = 0;
  for(int i = W - 1; i >= 0; i--) {
    ret = min(ret, i + curr);
    curr = max(curr, L[i]);
  }

  cout << ret << endl;
}

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

typedef vector<int> vi;
#define ll long long
#define loop(i,n) for(int i=0; i<n; i++)
#define loop1(i,n) for(int i=1; i<=n; i++)
#define loopi(i,s,e) for(int i=s; i < e; i++)
#define loopiRev(i,s,e) for(int i=s; i >= e; i--)
#define PI 3.14159265359
//#define x first
//#define y second
#define point pair<double,double>
#define len(s)   (int)s.length()
#define sz(v)    (int)v.size()
#define all(a)   a.begin(),a.end()
#define clr(x, val)	memset((x), (val), sizeof(x))

void initialize(vector<int> &F, int n){
    F = vector<int> (n+1, 0);

    for(int i=2; i*i  <= n; i++){
        if(F[i] == 0)
            for(int k=i*i; k <=n ; k+= i)
                if(F[k] == 0) F[k] = i;
    }
}

//you don't know math, unless you can do math!

ll mod = 1e9 + 7;
int n,m;
bool valid(int r,int c){
    return (r >= 0 && r < n && c >= 0 && c < m);
}

ll dp[1100][1100];
char grid[1100][1100];



ll solve(int r, int c){
    if(r == n - 1 && c == m - 1)
        return 1;

    ll &ret= dp[r][c];
    if(ret != -1)
        return ret;

    ll path1=0, path2=0;
    if(valid(r+1, c) && grid[r+1][c] != '#') path1= solve(r+1, c);
    if(valid(r, c+1) && grid[r][c+1] != '#') path2= solve(r, c+1);

    return ret= ((path1%mod) + (path2%mod))%mod;
}



int main() {
    //freopen("input.txt" , "r" , stdin) ;
    //freopen("output.txt" , "w" , stdout) ;

    cin.tie(0);
    cin.sync_with_stdio(0);

    clr(dp,-1);

    cin>>n>>m;
    loop(i,n)loop(j,m) cin>>grid[i][j];

    cout<<solve(0,0);
}


Measured memory_bytes: 10880
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i=0;i<n;i++) cin >> a[i];

	vector<int> b;
	int index = 1;
	for(int i=0;i<n;i++){
		if(index==1){
			b.push_back(a[i]);	
		}else{
			b.insert(b.begin(), a[i]);
		}
		index *= -1;
	}

	if(n%2==0){
		for(int i=0;i<n-1;i++){
			cout << b[i] << " ";
		}
		cout << b[n-1] <<endl;
	}else{
		for(int i=n-1;i>0;i--){
			cout << b[i] << " ";
		}
		cout << b[0] <<endl;
	}

  return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
using namespace std;

constexpr int MAX_N = 200;
constexpr int MAX_R = 8;
constexpr int INF = 100000000;
int graph[MAX_N + 1][MAX_N + 1];
int cs[MAX_R];

int n, m, r;

void init(){
  for(int i=1; i<=n; i++){
    for(int j=1; j<=n; j++){
      if(i == j) graph[i][j] = 0;
      else graph[i][j] = INF;
    }
  }

  for(int i=0; i<m; i++){
    int a, b, c;
    cin >> a >> b >> c;

    graph[a][b] = min(graph[a][b], c);
    graph[b][a] = min(graph[b][a], c);
  }
}

void Warshall_Floyd(){
  for(int k=1; k<=n; k++){
    for(int i=1; i<=n; i++){
      for(int j=1; j<=n; j++){
        graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
      }
    }
  }
}

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

  for(int i=0; i<r; i++) cin >> cs[i];
  sort(cs, cs + r);

  init();
  
  Warshall_Floyd();
  
  int ans = INT_MAX;
  do{
    int path = 0;
    for(int i=1; i<r; i++){
      path += graph[cs[i-1]][cs[i]];
    }
    ans = min(ans, path);
  }while(next_permutation(cs, cs+r));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
while True:
    a,b = [int(i) for i in input().split()]

    if a == 0 and b == 0:
        break

    if a < b:
        a,b = b,a

    cnt = 0
    while b > 0:
        a, b = b, a % b
        cnt += 1

    print(a, cnt)



Measured memory_bytes: 5612
#include <iostream>
#include <vector>
#include <algorithm>
// #include <cstdio>
// #include <bitset>
// #include <math.h>
//#include <bits/stdc++.h>
using namespace std;
int N;
string s[101];
int    p[101];

struct Info {
  int    num;
  string s;
  int    p;
  Info(int t_num, string t_s, int t_p) {
    num = t_num;
    s = t_s;
    p = t_p;
  }
  // int getNum() { return (num + 1); }
  int getNum() { return (num); }
};

bool cmp(const Info& a, const Info& b) {
  if (a.s < b.s) {
    return true;
  } else if (a.s > b.s) {
    return false;
  } else {
    if (a.p > b.p) {
      return true;
    } else {
      return false;
    }
  }
}


int main() {
  cin >> N;
  // Info obj[N];
  vector<Info> info_list;
  for(int i=1;i<=N;i++) {
    cin >> s[i];
    cin >> p[i];
    //obj[i] = Info(i,s[i], p[i]);
    info_list.push_back(Info(i,s[i], p[i]));
  }
  sort(info_list.begin(), info_list.end(), cmp);
  for(auto t_info : info_list) {
    cout << (t_info.getNum()) << "\n";
  }

#if 0
  printf("%d\n",N);
  for(int i=0;i<N;i++) {
    //printf("%s ", s[i]);
    cout << s[i] ;
    printf(" %d\n", p[i]);
  }
#endif
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
int ans=1e9;
void Main(){
    ll n;cin>>n;
    ll m;cin>>m;
    ll x;cin>>x;
    vector<vector<int>> book(n,vector<int> (m,0));
    vector<int> cost(n,0);
    For(i,0,n){
        cin >> cost[i];
        For(j,0,m){
            cin >> book[i][j];
        }
    }
    For(i,0,1<<n){
        int costi=0;
        vector<int> skill(m,0);
        For(j,0,n){
            if(i>>j&1){
                costi+=cost[j];
                For(k,0,m){
                    skill[k]+=book[j][k];
                }
            }
        }
        For(j,0,m){
            if(x>skill[j]){
                goto end;
            }
        }
        ans=min(ans,costi);
        end:;
    }
    if(ans<1e9) cout << ans << endl;
    else cout << -1 << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#include <cstring>
#include <iterator>

using namespace std;

int main()
{
    string str;
    cin >> str;
    if (str[str.size() - 1] == 's') str = str + "es";
    else str += "s";
    cout << str;
    return 0;
}


Measured memory_bytes: 3628
import fractions

A, B = map(int, input().split())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
a = set(prime_factorize(A))
b = set(prime_factorize(B))
c = a & b

print(len(c) + 1)


Measured memory_bytes: 5048
package main

import (
    "bufio"
    "fmt"
    "os"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
    var s string
    ans, tmp := 0, 0
    if sc.Scan() {
        s = sc.Text()
    }
  	for i:=0; i<3; i++ {
    	if s[i] == 'R' {
        	tmp++;
        } else {
        	if ans < tmp {
            	ans = tmp
            }
          	tmp = 0
        }
    }
  	if ans < tmp {
  		ans = tmp
    }
  	fmt.Println(ans)
}

Measured memory_bytes: 1772
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;

void solve()
{
	int n;
	cin>>n;
	ll a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	ll ans=0;
	map<ll,ll> mp;
	for(int i=1;i<n;i++)
	{
		mp[i-a[i]]++;
	}
	for(int i=0;i<n;i++)
	{
		ans+=mp[i+a[i]];
	}
	cout<<ans;
}
 
int main()
{
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

Measured memory_bytes: 27784
s=input()
n=len(s)
ans=0

for bit in range(1<<(n-1)):
    f=s[0]
    
    for i in range(n-1):
        
        if bit & 1<<i:
            f+="+"
        
        f+=s[i+1]
    
    ans+=sum(map(int,f.split("+")))

print(ans)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll x,ll y){
    if (y == 0) return x;
    return gcd(y, x%y);
}
ll lcm(ll x,ll y){
    return (x/gcd(x,y))*y;
}
int main(void){
    ll n,m;cin>>n>>m;
    vector<ll> b(n);
    ll xx=-1;
    for(int i=0;i<n;i++){
        cin>>b[i];b[i]/=2;
        if(xx==-1){
            ll x=b[i];
            while(x>0){
                if(x%2!=0){
                    xx=b[i]/x;
                    break;
                }
                x/=2;
            }
        }else{
            if((b[i]/xx)%2==0){
                cout<<0<<endl;
                return 0;
            }
        }
    }
    ll L=b[0];
    for(int i=0;i<n;i++){
        L=lcm(L,b[i]);
    }
    ll res=m/L;
    if(res%2!=0){
        res/=2;
        res++;
    }else{
        res/=2;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1024
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		Map<Integer, List<Integer>> listMap = new TreeMap<>();

		for (int i = 0; i < m; i++) {
			int k = sc.nextInt();
			List<Integer> list = new ArrayList<>();
			for (int j = 0; j < k; j++) {
				int s = sc.nextInt();
				list.add(s);
			}
			listMap.put(i,list);
		}
		int[] pArray = new int[m];
		for (int i = 0; i < m; i++) {
			int p = sc.nextInt();
			pArray[i] = p;
		}
		int result = 0;

		for(int one =0;one<=1;one++){
			for(int two =0;two<=1;two++){
				for(int three =0;three<=1;three++){
					for(int four =0;four<=1;four++){
						for(int five =0;five<=1;five++){
							for(int six =0;six<=1;six++){
								for(int seven =0;seven<=1;seven++){
									for(int eight =0;eight<=1;eight++){
										for(int nine =0;nine<=1;nine++){
											for(int ten =0;ten<=1;ten++){
												Map<Integer, Integer> switchMap = new HashMap<>();
												switchMap.put(1,one);
												switchMap.put(2,two);
												switchMap.put(3,three);
												switchMap.put(4,four);
												switchMap.put(5,five);
												switchMap.put(6,six);
												switchMap.put(7,seven);
												switchMap.put(8,eight);
												switchMap.put(9,nine);
												switchMap.put(10,ten);

												boolean isOk=true;
												for (int i = 0; i < m; i++) {
													// 電球iについて
													int curP = pArray[i];
													List<Integer> curList = listMap.get(i);

													// System.out.println("curP "+curP);
													// System.out.println("curList "+curList);

													int sumOn =0;
													for(int switchin:curList){
														// System.out.println("switchMap.get "+ switchMap.get(switchin));
														sumOn += switchMap.get(switchin);
													}
													if(!(sumOn%2 == curP)){
														isOk =false;
														break;
													}
												}
												if(isOk){
													result++;
												}
			
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		int pow = (int)Math.pow(2,10-n);
		result = result / pow;
		System.out.println(result);



	}
}


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

void check(string s, int n, int a, int b){
    int passed = 0, rank = 0;
    for (int i=0; i<n; i++){
        if (s[i] == 'a'){
            if (passed < a + b){
                cout << "Yes" << endl;
                passed++;
            } else{
                cout << "No" << endl;
            }
        } else if (s[i] == 'b'){
            if (passed < a + b && rank + 1 <= b){
                cout << "Yes" <<  endl;
                passed++;
                rank++;
            } else {
                cout << "No" << endl;
            }
        } else{
            cout << "No" << endl;
        }
    }
}

int main(void){
    int n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    check(s, n, a, b);
    return 0;
}

Measured memory_bytes: 3796
#include <iostream>
using namespace std;
int main(void){
    int n,m,l,a[100][100],b[100][100];
    long c[100][100]={0};
    
    cin >> n >> m >> l;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<l;j++){
            cin >> b[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            for(int k=0;k<m;k++){
               c[i][j] += a[i][k]*b[k][j]; 
            }   
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            cout << c[i][j];
            if(j!=l-1)cout << " ";
        }
        cout << endl;
    }
   return 0; 
    
}


Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,n)  for(ll i=0;i<n;i++)
#define fb(i,n) for(ll i=n-1;i>=0;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef pair<int,int> pii;
int main()
{
	IOS;
	//int t; cin>>t;
	//ll M=pow(10,9)+7;
	int t=1;
	while(t)
	{
		int r,g,b; cin>>r>>g>>b;
		int k; cin>>k;
		int count=0;
		while(g<=r)
		{
			g=g*2;
			count++;
		}
		while(b<=g)
		{
			b=b*2;
			count++;
		}
		if(count<=k) cout<<"Yes\n";
		else cout<<"No\n";
		t--;
	}
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;

struct puddle {
  int id, s;
};

int main() {
  string s;
  cin >> s;
  int n = s.size(), x, n2, sum = 0;
  stack<int> s1;
  stack<puddle> s2;
  puddle p;
  
  rep(i, n) {
    if (s[i] == '\\') {
      s1.push(i);
    }
    else if (s[i] == '/') {
      if (s1.empty()) continue;
      x = s1.top();
      s1.pop();
      p.id = x;
      p.s = i - x;
      while (!s2.empty() && s2.top().id > x) {
        p.s += s2.top().s;
        s2.pop();
      }
      s2.push(p);
    }
  }

  n2 = s2.size();
  vector<int> ans(n2);
  rep(i, n2) {
    ans[i] = s2.top().s;
    s2.pop();
    sum += ans[i];
  }
  cout << sum << endl;
  cout << n2;
  repr(i, n2 - 1) {
    cout << " " << ans[i];
  }
  cout << endl;
  



  
  return 0;
}


Measured memory_bytes: 3276
#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	int k,a,b,tag=0;
	scanf("%d%d%d",&k,&a,&b);
	for(int i=a;i<=b;i++)
		{
			if(i%k==0)
				{
					tag=1;
				}
		}
	if(tag)printf("OK\n");
	else printf("NG\n");
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  int count = 0;
  for (int i = 0; i < S.size(); ++i)
    if (S[i] == 'x')
      ++count;
  if (count < 8)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	for(register int i=0;i<=9;i++)
		for(register int j=0;j<=9;j++)
			if(i*j==n)
			{
				puts("Yes");
				return 0;
			}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

type BreakCount map[int]int

func main() {
	var N int
	fmt.Scan(&N)

	result := 0
	count := 0
	for {
		if  float64(N) < math.Pow(2.0,float64(count)) {
			result = int(math.Pow(2.0,float64(count - 1)))
			break
		}
		count++
	}
	fmt.Println(result)
}


Measured memory_bytes: 512
//Katana Thrower

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n,h;cin>>n>>h;
    int k=0;
    priority_queue<int>q;
    rep(i,0,n){
        int a,b;cin>>a>>b;
        k=max(k,a);
        q.push(b);
    }
    int ans=0;
    if(k>=q.top()){
        ans=ceil((double)h/(double)k);
    }else{
        while(q.top()>k&&!q.empty()&&h>0){
            h-=q.top();
            q.pop();
            ans++;
        }
        if(h>0)ans+=ceil((double)h/(double)k);
    }
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 4388
N = gets.to_i
a_list = gets.split.map(&:to_i)

ans = Array.new(N) { 0 }
N.downto(1) do |i|
  sum = 0
  ii = i
  while ii <= N
    sum += ans[ii - 1]
    ii += i
  end
  ans[i - 1] = (a_list[i - 1] - (sum % 2)).abs
end
puts ans.count { |n| n == 1 }
ids = ans.map.with_index { |a, i| [a, i] }.select do |a, i|
  a == 1
end.map { |_, i| i + 1 }
puts ids.join(' ')


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

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define MAXX 100005

#define PI 3.14159265358979323846264338327950

#define ll signed long long int

ll a[MAXX];
multiset<ll> ms;
multiset<ll>::iterator it;
signed main()
{
    FAST;
    ll n;
    ll b;
    cin >> n >> b;
    if(n > b){
    	cout << 2*n - 1;
	}
	else if(n < b){
		cout << 2*b - 1;
	}
	else{
		cout << n + b;
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int x[10000] = {1};
  int i = 0, j;

  do {
    scanf("%d",&x[i]);
    i++;
  } while (x[i - 1] != 0);

  for (j = 0; j < i - 1; j++)
    printf("Case %d: %d\n", j + 1, x[j]);
    return 0;
}



Measured memory_bytes: 1924
"""
- I hate Factorization
- A**5 - B**5, >0 A>B (Bminusあり)
"""
X = int(input())
 
for a in range(1000000):
  a5 = a ** 5
  for b in range(a-1,-1000000,-1):
    b5 = b**5
    if a5 - b5 == X:
      print(a,b)
      exit(0)
    elif a5 - b5 > X:
      break

Measured memory_bytes: 9052
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<utility>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<list>
#include<set>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define F first
#define S second
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
struct XY
{
	int x;
	int y;
};
int in()
{
	int x;
	cin >> x;
	return x;
}
/*
(char)'1' - (int)48 = (int)1;
???1111181
*/
////////////////////////////////////////////////////


int main()
{
	string a; int n;
	while (cin >> a >> n&&n)
	{
		if (a.size() < n)
		{
			string b;
			for (int i = 0; i < n - a.size(); i++)b += '0';
			b += a;
			a = b;
		}
		int now = 0;
		map<string,int> xx;
		xx[a] = now;
		while (1)
		{
			now++;
			string mi, ma;
			mi = a;
			sort(mi.begin(), mi.end());
			ma = mi;
			reverse(ma.begin(), ma.end());
			for (int i = ma.size() - 1; i >= 0; i--)
			{
				ma[i] -= mi[i];
				ma[i] += 48;
				if (ma[i] < '0')
				{
					ma[i - 1]--;
					ma[i] += 10;
				}
			}
			a = ma;
			if (xx.count(a))
			{
				
				cout << xx[a] << " ";  int i = 0;
				for (; i < ma.size()-1; i++)
				{
					
					if (a[i] != '0')break;
				}
				for (; i < n; i++)cout << a[i];
				cout << " " << now - xx[a] << endl;
				break;
			}
			else
			{
				xx[a] = now;
			}
		}
		
	}
}

Measured memory_bytes: 1236
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]
Clist = Counter(S).most_common()
num = Clist[0][1]
anses = [Clist[0][0]]
for X in Clist[1:]:
    if X[1] == num:
        anses.append(X[0])
anses.sort()
for ans in anses:
    print(ans)

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

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vi h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  int ans = 0;
  int count = 0;
  for (int i = 0; i < n - 1; i++) {
    if (h[i] >= h[i + 1]) {
      count++;
    } else if (h[i] < h[i + 1]) {
      count = 0;
    }
    ans = max(ans, count);
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> answer(N);

    for(int i = 0; i < M; i++){
        int a,b;
        cin >> a >> b;
        answer.at(a-1) += 1;
        answer.at(b-1) += 1;
    }

    for(int i = 0; i < N; i++){
        cout << answer.at(i) << endl;
    }
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){

  int n,k;
  cin >> n >> k;
  vector<bool> is(10,0);
  rep(i,k){
    int x;cin >> x;
    is[x] = true;
  }
  for(ll i = n;;i++){
    bool ok = true;
    ll l = i;
    while(l){
      if(is[l%10])ok = false;
      l /= 10;
    }
    if(ok){
      cout << i << endl;
      break;
    }
  }







  

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;

int main()
{
    int num;
    cin >> num;
    vector<pair<int, int> > v;
    int a, b;
    for(int i=0;i<num;i++){
        cin >> a >> b;
        v.push_back(make_pair(b,a));
    }
    sort(v.begin(),v.end());

    bool judge = true;

    long currenttime = 0;
    for(int i=0;i<num;i++){
        currenttime += v[i].second;
        if(v[i].first<currenttime){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 2420
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        long r = 0;
        long g = 0;
        long b = 0;
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == 'R') {
                r++;
            } else if (s.charAt(i) == 'G') {
                g++;
            } else {
                b++;
            }
        }
        long sum = r * g * b;
        long counter = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (s.charAt(i) == s.charAt(j)) {
                    continue;
                }
                int k = 2 * j - i;
                if (k >= n || s.charAt(k) == s.charAt(i) || s.charAt(k) == s.charAt(j)) {
                    continue;
                }
                counter++;
            }
        }
        System.out.println(sum - counter);
        sc.close();
    }
}

Measured memory_bytes: 37252
import heapq

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
assert len(A) == X and len(B) == Y and len(C) == Z

# to reverse the order
A = [-x for x in A]
B = [-x for x in B]
C = [-x for x in C]

A.sort()
B.sort()
C.sort()

def val(pos):
    a, b, c = pos
    return A[a] + B[b] + C[c]

def nextpos(pos):
    a, b, c = pos
    if a + 1 < len(A):
        yield (a + 1, b, c)
    if b + 1 < len(B):
        yield (a, b + 1, c)
    if c + 1 < len(C):
        yield (a, b, c + 1)

def cakelist():
    H = []  # heap
    heapq.heappush(H, (val((0, 0, 0)), (0, 0, 0)))
    visited = {(0, 0, 0)}
    while len(H) > 0:
        v, pos = heapq.heappop(H)
        yield -v
        for npos in nextpos(pos):
            if npos not in visited:
                heapq.heappush(H, (val(npos), npos))
                visited.add(npos)

cl = cakelist()
for i in range(K):
    print(next(cl))


Measured memory_bytes: 4852
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let n = input::<usize>();
    let m = input::<usize>();
    let xx = input::<i64>();
    let yy = input::<i64>();
    let x = (0..n).map(|_| input()).collect::<Vec<i64>>();
    let y = (0..m).map(|_| input()).collect::<Vec<i64>>();

    let x_max = std::cmp::max(xx, *x.iter().max().unwrap());
    let y_min = std::cmp::min(yy, *y.iter().min().unwrap());

    let ans = if x_max < y_min { "No War" } else { "War" };
    println!("{}", ans);
}


Measured memory_bytes: 4352
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    head = int(inputs[0][:2])
    tail = int(inputs[0][2:])

    if head >= 1 and head <= 12:
        if tail >= 1 and tail <= 12:
            return "AMBIGUOUS"
        else:
            return "MMYY"

    if tail >= 1 and tail <= 12:
        return "YYMM"

    return "NA"


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(a-c) <= d) puts("Yes");
    else if(abs(a-b) <= d && abs(b-c) <= d) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define MM 1e9

int N,K;
int res=0;

void input() {
    cin >> N >> K;
}

void solve(){
    rep(i,1,N) {
        if (i+K-1<=N) res++;
    }
    cout << res << endl;
}

int main() {
    input();
    solve();
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int N;
vector<pair<ll, ll>> XS;
const int MAX_N = 200010;
ll dp[MAX_N];
int main()
{
    cin >> N;
    XS.resize(N);
    for (int i = 0; i < N; i++)
    {
        ll x, s;
        cin >> x >> s;
        XS[i] = mp(x, s);
    }
    ll sum = 0;
    ll L = XS[0].first;
    ll res = 0;
    for (int i = 0; i < N; i++)
    {
        dp[i] = XS[i].second - XS[i].first + (sum + L);
        res = max(res, XS[i].second);
        res = max(res, dp[i]);
        if (sum + L + XS[i].second < XS[i].first + XS[i].second)
        {
            sum = XS[i].second;
            L = XS[i].first;
        }
        else
        {
            sum += XS[i].second;
        }
    }
    cout << res << endl;

    return 0;
}

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

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef set<int> si;
typedef set<ll> sll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;

const double pi = acos(-1.0);
const long long INF = 2e18;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define in insert
#define endl "\n"

#define sqr(a) ((a) * (a))
#define jor(a) !(a&1)// jor means EVEN number
#define bjor(a) (a&1)// bjor means ODD number

#define all(a)  a.begin(), a.end()
#define mem(arr, b) memset(arr, b, sizeof(arr)) //memset only for -1 and 0
//fill(a, a+n, 5) //fill for any value

#define for0(i,b) for(int i=0;i<(b);i++)
#define for1(i,b) for(int i=1;i<=(b);i++)
#define forab(i,a,b) for(int i=(a);i<=(b);i++)
#define forba(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fileRead freopen("input.txt", "r", stdin);
#define fileWrite freopen("output.txt", "w", stdout);

void print(int a[], int n){ // for testing or debugging
    for(int i=0;i<n;i++)cout<<a[i]<<" "; cout<<endl;
}

//-------------------------------------------------------------------\\

si mainset;

si findPrimeFactors(int n)
{
    si s;

    while (n%2== 0) s.in(2), n = n/2;

    for (int i = 3; i*i <= n; i = i+2)
    {
        while (n%i == 0)
        {
            s.in(i);
            n = n/i;
        }
    }

    if (n > 2) s.in(n);

    return s;
}

int main()
{
    
    int n;
    cin>>n;
    int a[n];
    for0(i,n) cin>>a[i];

    bool no=0;
    for0(i,n){
        si s = findPrimeFactors(a[i]);
        for(auto t: s){
            if(mainset.count(t)) {no=1; break;}
            mainset.in(t);
        }
        if(no) break;
    }

    if(no){
        int gcd = a[0];
        for1(i,n-1) gcd = __gcd(gcd,a[i]);
        if(gcd==1) cout<<"setwise coprime";
        else cout<<"not coprime";
    }
    else cout<<"pairwise coprime";
}


Measured memory_bytes: 7520
#include<iostream>
#include<string>
#include<vector>

using namespace std;

long long result=0;



long tranStringtoInt(string s){
	long l=0;
	for(int i=0;i<s.length();i++){
		l=l*10 + (s[i]-'0');
	}
	return l;
}

long addAll(vector<long> all){
	long l=0;
	for(int i =0;i<all.size();i++){
	//	cout<<all[i]<<"+";
		l+=all[i];
	}
	//cout<<"="<<l<<endl;
	return l;
}

void process(string after,vector<long> before){
	int length=after.length();
	if(length==0){
		result+=addAll(before);
		return;
	}
	if(length==1){
		int a=tranStringtoInt(after);
		before.push_back(a);
		result+=addAll(before);
		return;
	}
	for(int i=1;i<=length;i++){
		string current = after.substr(0,i);
		string thisAfter = after.substr(i);
		vector<long> thisBefore=before;
		thisBefore.push_back(tranStringtoInt(current));
		process(thisAfter,thisBefore);
	}
}

int main(){
	string  input;
	cin>>input;
	vector<long> empty;
	process(input,empty);
	cout<<result;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string str;
int main(){
	int ans = 0; 
	cin>>str;
	for(int i = 1;i<str.size();i++){
		if(str[i-1] != str[i]){
			ans += 1;
		}
	} 
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(){

  int n,i,j,a[5][4][11],k,b,f,r,v;
  for(k=1;k<=4;k++){
    for(i=1;i<=3;i++){
      for(j=1;j<=10;j++){
	a[k][i][j]=0;
      }
    }
  }



  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d%d%d%d",&b,&f,&r,&v);
    a[b][f][r]+=v;
  }

 for(k=1;k<=4;k++){
    for(i=1;i<=3;i++){
      for(j=1;j<=10;j++){
	printf(" %d",a[k][i][j]);
      }
      printf("\n");
    }
    if(k<4)  printf("####################\n");
 }

 return 0;
}

Measured memory_bytes: 612
url = "https://atcoder.jp//contests/abc133/tasks/abc133_c"

def main():
    t = list(map(int, input().split()))
    ans = []
    for i in range(t[0], t[1]+1):
        for j in range(i+1, t[1]+1):
            val = (i*j) % 2019
            if val == 0:
                print(val)
                exit()
            ans.append(val)
    print(min(ans))


if __name__ == '__main__':
    main()

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

int main(void) {
  int N;
  cin >> N;

  int P[1010];
  int max = 0;
  int max_index = 0;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> P[i];
    if (max < P[i]) {
      max = P[i];
      max_index = i;
    }
  }

  for (int i = 0; i < N; i++) {
    if (max_index == i) {
      ans += P[i] / 2;
    } else {
      ans += P[i];
    }
  }

  cout << ans<< endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <fstream>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cmath>
#include <queue>

using namespace std;
using ll = long long;
using ull = unsigned long long;

//const double PI = acos(-1);



int main() {
    string s;
    cin >> s;
    int p = -1;
    for (int i = 1; i < s.length(); i++)
        if (s[i] == s[i - 1]) {
            p = i;
            break;
        }
    if (p == -1) {
        cout << 0;
        return 0;
    }
    int ans1 = 1;
    string t = s;
    if (t[p] == '0')
        t[p] = '1';
    else 
        t[p] = '0';
    for (int i = p + 1; i < s.length(); i++) 
        if (t[i] == t[i - 1]) {
            if (t[i] == '0')
                t[i] = '1';
             else 
                t[i] = '0';
            ans1++;
        }
    int ans2 = 1;
    if (s[p - 1] == '0')
        s[p - 1] = '1';
    else 
        s[p - 1] = '0';
    for (int i = p; i < s.length(); i++) 
        if (s[i] == s[i - 1]) {
            if (s[i] == '0')
                s[i] = '1';
             else 
                s[i] = '0';
            ans2++;
        }
    for (int i = p - 2; i >= 0; i--) 
        if (s[i] == s[i + 1]) {
            if (s[i] == '0')
                s[i] = '1';
             else 
                s[i] = '0';
            ans2++;
        }
    cout << min(ans1, ans2);
}



Measured memory_bytes: 512
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

void FennecvsMonster() {
    int n, k;
    long long res = 0;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++) cin >> h[i];
    if (n <= k) res = 0;
    else {
        sort(h.begin(), h.end());
        for(int i=0;i<n-k;i++) res += h[i];
    }
    cout << res << endl;
    return;
}
 
int main(){
  FennecvsMonster();
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	int n;
	cin >> n;

	printf("ABC%3d\n", n);
	
	return 0;
}


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

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

	string s,t;

	cin >> s >> t;
	
	int ans=0;
	
	rep(i,3){
		if(s[i]==t[i]) ans++;
	}
	
	
	cout << ans << "\n";

    }

Measured memory_bytes: 384
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	Deque<long[]> d = new ArrayDeque<>();
	long a = 0;

	// 爆弾追加 (right:範囲の右端座標 z:威力)
	void addBomb(long right, long z) {
		d.offer(new long[] { right, z });
		a += z;
	}

	// 爆弾効果取得
	long getBomb(long x) {
		if (d.isEmpty()) {
			return 0;
		}

		while (!d.isEmpty() && x > d.peekFirst()[0]) {
			a -= d.peekFirst()[1];
			d.poll();
		}
		return a;
	}

	long A;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		long D = sc.nextLong();
		A = sc.nextLong();
		long[][] XH = new long[N][2];
		for (int i = 0; i < N; i++) {
			XH[i][0] = sc.nextLong();
			XH[i][1] = sc.nextLong();
		}

		sc.close();

		Arrays.sort(XH, (a, b) -> (Long.compare(a[0], b[0])));

		//
		long ans = 0;

		for (int i = 0; i < N; i++) {
			long x = XH[i][0];
			long h = XH[i][1];

			while (h > getBomb(x)) {
				long s = (h - getBomb(x) + A - 1) / A;
				addBomb(x + 2 * D, A * s);
				ans += s;
//				System.err.println(ans);
			}
		}
		out.println(ans);
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 125080
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0)
//#define MULTI_TEST
//#define GOOGLE
#ifdef LOCAL
#include "debugger.h"
#else
#define db(...)
#endif
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
const ll MOD = 1e9 + 7;
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }

void solve()
{
	ll a, b, c, n;
	cin >> a >> b >> c >> n;
	ll ans = min(n, a);
	n -= min(n, a);
	n -= min(n, b);
	ans -= min(n, c);
	cout << ans << ln;
	return;
}

int main()
{
#ifndef LOCAL
	FASTIO;
#endif
	int t = 1;
#ifdef LOCAL
	clock_t start, stop;
	start = clock();
#endif
#ifdef MULTI_TEST
	cin >> t;
#endif
	for (int tc = 1; tc < t + 1; tc++)
	{
#ifdef GOOGLE
		cout << "Case #" << tc << ": ";
#endif
		solve();
	}
#ifdef LOCAL
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll D; cin >> D;
    if (D == 25) cout << "Christmas";
    else if (D == 24) cout << "Christmas Eve";
    else if (D == 23) cout << "Christmas Eve Eve";
    else if (D == 22) cout << "Christmas Eve Eve Eve";
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> S(N,0);
  for(int i=0; i<N; i++) {
    cin >> A.at(i);
    while(A.at(i)%2==0){
      A.at(i) /= 2;
      S.at(i)++;
    }
  }
  int min = S.at(0);
  for(int i=i; i<N; i++) {
    if(S.at(i) < min) min = S.at(i);
  }
  cout << min << endl;
}

Measured memory_bytes: 256
import scala.collection.mutable
import java.io.{BufferedReader, InputStreamReader}

object Main extends App {

  val in = new BufferedReader(new InputStreamReader(System.in))
  val Array(a, b, c, d, e, f) = in.readLine.split(" ").map(_.toInt)
  // 入れる水の量 100a 100b
  // 入れる砂糖の量 c d
  // 100gあたりとける量 e
  // ビーカーに入る量 f
  // 濃度 0% の砂糖水 : water > 0 , sugar >= 0
  val water = {
    val set = mutable.HashSet[Int]()
    for {
      i <- 0 to f/(a*100)
      j <- 0 to f/(b*100)
      w = 100 * a * i + 100 * b * j
      if 0 < w && w <= f
    } set += w
    set.toArray
  }
  val sugar = {
    val set = mutable.HashSet[Int]()
    for {
      i <- 0 to (f-100)/c
      j <- 0 to (f-100)/d
      w = c * i + d * j
      if w <= f
    } set += w
    set.toArray
  }

  // println(water.length + " " + sugar.length)

  val ans = {
    var max = (-1d, 0, 0)
    for {
      w <- water
      wd = w.toDouble/100d
      s <- sugar
      weight = w + s
      concent = s.toDouble / wd
      if weight <= f && concent <= e
    } {
      if(concent > max._1) {
        // println(weight + " " + concent)
        max = (concent, weight, s)
      }
    }
    max
  }
  
  println(ans._2 + " " + ans._3)
}

Measured memory_bytes: 36128
#!/usr/bin/python

import math
import sys

def main(argv):
    line = sys.stdin.readline()
    while line:
        N, H = map(lambda i: int(i), line.rstrip("\n").split(" "))
        attackes = []
        for i in xrange(N):
            a, b = map(
              lambda i: int(i), sys.stdin.readline().rstrip("\n").split(" "))
            attackes.append((i, a, "A"))
            attackes.append((i, b, "B"))

        max_a = max(
          filter(lambda t: t[2] == "A", attackes), key=lambda x: x[1])
        max_ab = attackes[max_a[0] * 2 + 1]

        hit = 0
        for t in sorted(attackes, key=lambda x: x[1], reverse=True):
#            if t[0] == max_ab[0] and t[1] == max_ab[1] and t[2] == max_ab[2]:
#                if H <= t[1]:
#                    H -= t[1]
#                    hit += 1
#                    break
#                continue

            if t[0] == max_a[0] and t[1] == max_a[1] and t[2] == max_a[2]:
                break

            H -= t[1]
            hit += 1

            if H <= 0:
                break
        
        if H > 0:
            q, r = divmod(H, max_a[1])
            hit += q
            if r > 0:
                hit += 1
        print hit

        line = sys.stdin.readline()

if __name__ == "__main__":
    main(sys.argv)

Measured memory_bytes: 35896
import java.util.Scanner;

/**
 * Copyright © 2018 Chris. All rights reserved.
 *
 * @author Chris
 * 2018/6/23 11:55
 * @see meituan.n2018.Bturn
 */
public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        int S = sc.nextInt();
        int mod = 0;

        int tmp = S;
        while (tmp > 0) {
            mod += tmp % 10;
            tmp /= 10;
        }
        System.out.println(S % mod == 0 ? "Yes" : "No");
    }
}


Measured memory_bytes: 21972
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <sstream>
#define INF 0x3f3f3f3f
using namespace std;

typedef long long ll;
const int mod = 1e9 + 7;
const ll maxn = 1000005;
const double pi = acos(-1.0);

int a,b;

int main()
{
    while(cin >> a >> b)
    {
        if(a >= 13)
            cout << b << endl;
        if(a < 13 && a > 5)
            cout << b / 2 << endl;
        if(a <= 5)
            cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
int n,m;
char s[507][507];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)scanf("%s",s[i]+1);
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j)putchar(s[i][j]=='#'||(i==1||i!=n&&(j&1))&&j!=1&&j!=m?'#':'.');
		puts("");
	}
	puts("");
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j)putchar(s[i][j]=='#'||(i==n||i!=1&&(~j&1))&&j!=1&&j!=m?'#':'.');
		puts("");
	}
	return 0;
}

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

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

    if (S == "RRR") {
        cout << 3 << endl;
    } else if (S=="SRR" || S=="RRS") {
        cout << 2 << endl;
    } else if (S=="RSS" || S== "SRS" || S=="SSR" || S=="RSR") {
        cout << 1 << endl;
   }
   else {
       cout << 0 << endl;
   }

    return 0;
}


Measured memory_bytes: 3592