jiahuimbzuai/CoQuIR huggingface dataset:
//  [ruby]
def counts(nums)
  nums.each_with_object(Hash.new(0)) { |i, h| h[i] += 1 }.sort_by { |num, count| [count, num] }.reverse
end

N = gets.to_i
evens, odds = gets.split(" ").map(&:to_i).partition.with_index { |n, i| i % 2 == 0 }

even_counts = counts(evens)
odd_counts = counts(odds)

even_num, even_no_op_count = even_counts[0]
odd_num,  odd_no_op_count  = odd_counts[0]

ans = if even_num == odd_num
  candidates = [
    even_counts.fetch(1, [0]).last + odd_no_op_count,
    even_no_op_count  + odd_counts.fetch(1, [0]).last
  ]
  N - candidates.max
else
  N - (even_no_op_count + odd_no_op_count)
end

puts ans
//  [ruby]
n = gets.to_i
vs = gets.split.map(&:to_i)
even = {}
odd = {}
ev = []
ov = []
vs.each_with_index{|v, i|
  if i % 2 == 0
    t = even
    tv = ev
  else
    t = odd
    tv = ov
  end
  if t[v] == nil
    o = {:v => v, :c => 0}
    t[v] = o
    tv << o
  end
  t[v][:c] += 1
}
ev.sort!{|a, b|
  v = 0 if a[:c] == b[:c]
  v = -1 if a[:c] > b[:c]
  v = 1 if a[:c] < b[:c]
  v
}
ov.sort!{|a, b|
  v = 0 if a[:c] == b[:c]
  v = -1 if a[:c] > b[:c]
  v = 1 if a[:c] < b[:c]
  v
}

ei = 0
oi = 0
while(true)
  te = ev[ei]
  to = ov[oi]
  break if te[:v] != to[:v]
  break if ei == ev.length - 1 && oi == ov.length - 1
  if ei == ev.length - 1
    oi += 1
  elsif oi == ov.length - 1
    ei += 1
  else
    if ev[ei + 1][:c] > ov[oi + 1][:c]
      ei += 1
    else
      oi += 1
    end
  end
end
ans = n - ev[ei][:c] - ov[oi][:c] 
if vs[0] == vs[1] && ans == 0
  ans = n / 2
end
puts ans
//  [rust]
fn main() {
    use std::io::Read;
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    
    let n: usize = iter.next().unwrap().parse().unwrap();
    let v: Vec<u64> = (&mut iter).take(n).map(|x| x.parse().unwrap()).collect();
    
    let mut fst = vec![];
    let mut snd = vec![];
    for i in 0..n {
        if i % 2 == 0 {fst.push(v[i]);}
        else {snd.push(v[i]);}
    }
    
    let fst_freqsec = freq_sec(&fst);
    let snd_freqsec = freq_sec(&snd);
    let ret = if fst_freqsec[0].1 == snd_freqsec[0].1 {
        std::cmp::min(
            calc(&fst, 0) + calc(&snd, 1),
            calc(&fst, 1) + calc(&snd, 0)
        )
    } else {
        calc(&fst, 0) + calc(&snd, 0)
    };
    println!("{}", ret);
}

fn freq_sec(fst: &[u64]) -> Vec<(usize, u64)> {
    let freq = count_series(fst);
    let mut freqsec: Vec<_> = freq.iter().map(|(&key, &value)| (value, key)).collect();
    freqsec.sort();
    freqsec.reverse();
    freqsec
}

fn calc(fst: &[u64], rank: usize) -> usize {
    let freqsec = freq_sec(fst);
    let mut sum = 0;
    for &(value, key) in &freqsec {
        if freqsec.len() <= rank || freqsec[rank].1 != key {
            sum += value;
        }
    }
    sum
}

#[allow(dead_code)]
fn count_series<T: Eq + std::hash::Hash + Clone>(
    series: &[T],
) -> std::collections::HashMap<T, usize> {
    let mut hmap = std::collections::HashMap::new();
    for item in series {
        *hmap.entry(item.clone()).or_insert(0) += 1;
    }
    hmap
}
//  [rust]
use std::collections::HashMap;
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let mut seq = vec![0; n];
    let mut cnts = vec![HashMap::<usize, usize>::new(); 2];
    for i in 0..n {
        seq[i] = read::<usize>();
        let mut entry = cnts[i % 2].entry(seq[i]).or_insert(0);
        *entry += 1;
    }
    let mut ans = 0;
    let mut cnts2 = vec![vec![]; n];
    for i in 0..2 {
        for (&v, &cnt) in cnts[i].iter() {
            cnts2[i].push((cnt, v));
            ans = std::cmp::max(ans, cnt);
        }
        cnts2[i].sort();
        cnts2[i].reverse();
    }
    for i in 0..std::cmp::min(4, cnts2[0].len()) {
        for j in 0..std::cmp::min(4, cnts2[1].len()) {
            if cnts2[0][i].1 == cnts2[1][j].1 {
                continue;
            }
            ans = std::cmp::max(ans, cnts2[0][i].0 + cnts2[1][j].0);
        }
    }
    println!("{}", n - ans);
}
//  [rust]
use std::io::{stdin, Read};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let vv = (0..n).map(|_| read::<usize>()).collect::<Vec<_>>();
    use std::collections::HashMap;
    let mut odds: HashMap<usize, i32> = HashMap::new();
    let mut evens: HashMap<usize, i32> = HashMap::new();

    for i in 0..n {
        let v = vv[i];
        if i % 2 == 0 {
            let &c = evens.get(&v).or(Some(&0)).unwrap();
            evens.insert(v, c + 1);
        } else {
            let &c = odds.get(&v).or(Some(&0)).unwrap();
            odds.insert(v, c + 1);
        }
    }

    let mut ve = evens.iter().map(|(&k, &v)| (v, k)).collect::<Vec<_>>();
    ve.sort();

    let mut vo = odds.iter().map(|(&k, &v)| (v, k)).collect::<Vec<_>>();
    vo.sort();

    let e_len = ve.len();
    let o_len = vo.len();
    let (c1, v1) = ve[e_len - 1];
    let (c3, v3) = vo[o_len - 1];

    let a: i32 = vo.iter().map(|&(c, v)| c).sum();
    let b: i32 = ve.iter().map(|&(c, v)| c).sum();

    if v1 != v3 {
        let (e1, _) = ve[e_len - 1];
        let (o1, _) = vo[o_len - 1];
        println!("{}", a + b - e1 - o1);
    } else {
        let (e1, _) = ve[e_len - 1];
        let (o1, _) = vo[o_len - 1];

        if e_len == 1 && o_len == 1 {
            println!("{}", n / 2);
        } else if e_len == 1 {
            let (o2, _) = vo[o_len - 2];
            println!("{}", a + b - e1 - o2);
        } else if o_len == 1 {
            let (e2, _) = ve[e_len - 2];
            println!("{}", a + b - e2 - o1);
        } else {
            let (e2, _) = ve[e_len - 2];
            let (o2, _) = vo[o_len - 2];
            use std::cmp::min;
            let ans = min(a + b - e1 - o2, a + b - e2 - o1);
            println!("{}", ans);
        }
    }
}
//  [typescript]
export default solve;

// =================================================
// ABC110C
// =================================================

// main
function main(lines) {
  console.log(solve(lines));
}

// interface
type Tuple = { value: number; count: number; even: boolean };

// solver
function solve(lines: string[]): string {
  const { N, evens, odds } = parseLines(lines);

  const evenTuples = getDescSortedTuplesByExistsNumberCount(evens);
  const oddTuples = getDescSortedTuplesByExistsNumberCount(odds);
  const steps: number[] = [];
  for (let i = 0; i < 2; i++) {
    for (let j = 0; j < 2; j++) {
      const evenTuple = evenTuples[i];
      const oddTuple = oddTuples[j];
      if (evenTuple && oddTuple && evenTuple.value === oddTuple.value) {
        steps.push(N - (evenTuple ? evenTuple.count : 0));
      } else {
        steps.push(N - (evenTuple ? evenTuple.count : 0) - (oddTuple ? oddTuple.count : 0));
      }
    }
  }
  return Math.min(...steps).toString();
}

// helpers
function getDescSortedTuplesByExistsNumberCount(nums: number[]): Tuple[] {
  const numsCountMap: Record<number, number> = nums.reduce((acc, v) => {
    !acc[v] ? (acc[v] = 1) : acc[v]++;
    return acc;
  }, {});
  const sortedTuples: Tuple[] = Object.entries(numsCountMap)
    .map(v => ({ value: +v[0], count: v[1], even: true }))
    .sort((x, y) => y.count - x.count);
  return sortedTuples;
}

function parseLines(lines: string[]) {
  const N = +lines[0];
  const nums = lines[1].split(' ').map(s => +s);
  const evens = nums.filter((v, i) => i % 2 === 0);
  const odds = nums.filter((v, i) => i % 2 !== 0);
  const obj = { N, nums, evens, odds };
  debug(obj);
  return obj;
}

// general helpers
function debug(message?: any, ...optionalParams: any[]) {
  if (!!process.env.LOCAL_DEBUG) console.log(message, ...optionalParams);
}

// reader
if (!process.env.LOCAL_DEBUG) {
  const { stdin: input, stdout: output } = process;
  input.resume().setEncoding('utf8');
  const lines = [];
  require('readline')
    .createInterface({ input, output })
    .on('line', line => lines.push(line))
    .on('close', () => main(lines));
}

// polyfills
if (!Object.entries) {
  Object.entries = function(obj) {
    var ownProps = Object.keys(obj),
      i = ownProps.length,
      resArray = new Array(i); // preallocate the Array
    while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]];
    return resArray;
  };
}
//  [python]
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

# r = int(sys.stdin.readline())
# print(r**2 *3)

N, D = list(map(int, sys.stdin.readline().split()))

print(math.ceil(N / (D * 2 + 1)))
//  [python]
import numpy as np

N,D = map(int, input().split())

if N % (2*D+1) == 0:
    print(N // (2*D+1))
else:
    print(N // (2*D+1) + 1)
//  [python]
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def local_input():# {{{
    from pcm.utils import set_stdin
    import sys
    from pathlib import Path
    parentdir = Path(os.path.dirname(__file__)).parent
    inputfile = parentdir.joinpath('test/sample-1.in')
    if len(sys.argv) == 1:
        set_stdin(inputfile)
# }}}

def solve():
    n,d = map(int,input().split())

    if n % (2*d+1) == 0:
        print( (n // (2*d+1)))
    else:
        print(n//(2*d+1) +1)
    return 0

if __name__ == "__main__":# {{{
    try:
        local_input()
        def dump(*args):
            names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
            print(', '.join(names.get(id(arg),'???')+' => '+repr(arg) for arg in args), file=sys.stderr)
    except:
        def dump(*args):
            pass

    solve()

# vim: set foldmethod=marker:}}}
//  [java]
import java.io.*;
import java.util.*;

public class Main {
	static int mod = (int)1e9+7;
	static Comparator<Integer> lower_bound = (x, y) -> x.compareTo(y) >= 0 ? 1 : -1;
	static Comparator<Integer> upper_bound = (x, y) -> x.compareTo(y) > 0 ? 1 : -1;

	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		int d = sc.nextInt();
		
		out.println((int)Math.ceil(n/(d*2d+1d)));
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static long factorial(int n) {
		long a;

		if(n > 0) {
			a = n * factorial(n - 1);
		}else{
			a = 1;
		}

		return a;
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(K key, V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class UnionFind {
	int[] par;

	public UnionFind(int n) {
		par = new int[n];

		Arrays.fill(par, -1);
	}

	int root(int x) {
		if(par[x] < 0) return x;
		return par[x] = root(par[x]);
	}

	boolean unite(int x,int y) {
		x = root(x);
		y = root(y);

		if(x == y) return false;

		if(size(x) < size(y)) {
			int tmp = x;
			x = y;
			y = tmp;
		}

		par[x] += par[y];
		par[y] = x;

		return true;
	}

	boolean same(int x,int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}

	int size(int a) {
		return -par[root(a)];
	}
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d  =sc.nextInt();

		int a = n / ((2*d) + 1);
		int b = n %((2*d) + 1);
		if (b > 0) a++;

		System.out.println(a);

		sc.close();
	}
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
int main () {
    
    int N , D;
    cin >> N >> D ;
    int mx = N ;
    for(int mask = 1 ; mask < (1 << N) ; mask++){
        
        bool v[N + 1] ;
        for(int j = 0 ; j <= N ;j++)
            v[j] = false ;
        vector<int> pos ;
        for(int j = 0 ; (1 << j) <= mask ;j++)
            if(mask&(1<<j)) pos.push_back(j + 1) ;
        for(int i = 0 ; i < pos.size();i++){
            for(int j = max(1 , pos[i] - D) ; j <= min(N , pos[i] + D) ;j++)
                v[j] = true ;
        }
        bool flag = true ;
        for(int i = 1 ; i <= N ;i++)
            if(v[i] == false){
                flag = false ;
                break ;
            }
        if(flag) mx = min(mx , int(pos.size())) ;
    }
    
    cout<<mx<<endl;
    return 0 ;
}
//  [cpp]
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, d;
int32_t main(){_

   cin>>n>>d;

   int ans = inf;
   for (int i = 0; i < (1LL<<n); ++i)
   {
      vector<int> v(n);
      for (int j = 0; j < n; ++j)
      {
         if(i & (1LL << j))
            v[j] = 1;
      }

      int curr = __builtin_popcountll(i);

      vector<int> tmp = v;
      for (int i = 0; i < n; ++i)
      {
         if(v[i] == 0)continue;
         for (int j = max(0LL, i-d); j <= i; ++j)
            tmp[j] = 1;
         for (int j = i; j <= min(n-1, i+d); ++j)
            tmp[j] = 1;
      }

      bool good = 1;
      for(auto i: tmp)
         good &= (i == 1);

      if(good){
         smin(ans, curr);
      }
   }

   cout<<ans;

   return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll INF = 1e18;
const int BIG = 1e9 + 555;

ll n, d;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> n >> d;
	int ans = n + 1;

	for(int bitmask = 0; bitmask < (1 << n); bitmask++){
		vector<bool> mrk(n);
		int cur = 0;
		for(int i = 0; i < n; i++){
			int l = max(0LL, i - d);
			int r = min(n - 1, i + d);
			if((bitmask & (1 << i)) == 0){
				continue;
			}
			cur++;
			for(int j = l; j <= r; j++){
				mrk[j] = true;
			}
		}

		bool flag = true;
		for(int i = 0; i < n; i++){
			if(!mrk[i]){
				flag = false;
				break;
			}
		}

		if(flag){
			ans = min(ans, cur);
		}
	}
	
	cout << ans << '\n';

	return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>
//prototype declaration

//gloval variable


int main(void){
    int n, d;
    scanf("%d %d", &n, &d);
    printf("%d\n", (n+2*d)/(2*d+1));
    return 0;
}
//  [c]
#include <stdio.h>
int main(void) {
    int n, d, i=0, m=0;
    
    scanf("%d%d",&n,&d);
    
    while(m<n){
        i++;
        m=i*(1+2*d);
    }
    printf("%d\n",i);
    return 0;
}
//  [c]
#include<stdio.h>
int main()
{
	int a,b,c,d,e,f,g;
	scanf("%d%d",&a,&b);
	if(a%(b*2+1)==0)
	{
		printf("%d",a/(b*2+1));
	}
	else
	{
		printf("%d",a/(b*2+1)+1);
	}
}
//  [javascript]
'use strict';

function main(stdin) {
  const input = stdin.split(' ').map(v => parseInt(v, 10));
  const N = input[0];
  const D = input[1];

  const a = N / (2 * D + 1);
  
  console.log(Math.ceil(a));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
  input = input.split(' ')
  var N = parseInt(input[0])
  var D = parseInt(input[1])
  var i = 1

  while (N > (2 * D + 1) * i) {
    i++
  }

  console.log(i)
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]


function Main(input) {
  input = input.split("\n");
  var N = input[0].split(" ")[0];
  var D = input[0].split(" ")[1];
  var ans = Math.ceil(N/(D*2+1));


  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import "fmt"

func main() {
	var n, d int
	fmt.Scan(&n, &d)
	if n%(1+d*2) == 0 {
		fmt.Print(n / (1 + d*2))
	} else {
		fmt.Print(n/(1+d*2) + 1)
	}
}
//  [ruby]
n,d=gets.split.map &:to_i
puts (n+2*d)/(2*d+1)
//  [ruby]
# B - Golden Apple
# https://atcoder.jp/contests/abc134/tasks/abc134_b

def calculate_number_of_worker(tree, range)   
    tmp = tree % ((range * 2) + 1)

    if tmp == 0
        tree / ((range * 2) + 1)
    else
        tree / ((range * 2) + 1) + 1
    end
end

n,d= gets.chomp.split(" ").map(&:to_i)

p calculate_number_of_worker(n,d)
//  [ruby]
n,d=gets.split.map &:to_i
p (n+2*d)/(2*d+1)
//  [rust]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    n: usize,
    d: usize
    }
    let ans = n / (2 * d + 1) + if n % (2 * d + 1) > 0 { 1 } else { 0 };
    println!("{}", ans);
}
//  [rust]
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let d: usize = iterator.next().unwrap().parse().unwrap();

    let t: usize = d * 2 + 1;
    let ans = if n % t == 0 {
        n / t
    } else {
        n / t + 1
    };

    return ans.to_string();
}
//  [swift]
import Foundation
let inp = readLine()!.split(separator: " ").map { Double($0)! }
let n = inp[0]
let d = inp[1]
print(Int(ceil(n / (2.0 * d + 1))))
//  [swift]
func readInts() -> [Int]{
    return readLine()!.split(separator: " ").map{Int($0)!};
}
let a = readInts();
let N = a[0];
let D = a[1];
var range = -1, ans = 0;
while(range < N - 1) {
    range += (2 * D + 1);
    ans += 1;
}
print(ans);
//  [swift]
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
var div = arr[0] / ( arr[1] * 2 + 1 ) 
let amari = arr[0] % ( arr[1] * 2 +  1) 
if( amari > 0 ) {
  div += 1
}
print( div )
//  [typescript]
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  const [N, D] = lines[0].split(" ").map(Number);
  console.log(Math.ceil(N / (2 * D + 1)));
});
//  [typescript]
export default solve;

// main
function main(lines) {
  console.log(solve(lines));
}

// solver
function solve(lines: string[]): string {
  const { N, D } = parseLines(lines);
  return Math.ceil(Number(N) / (Number(D) * 2 + 1)).toString();
}

// helpers
function parseLines(lines: string[]) {
  const [N, D] = lines[0].split(' ');

  const obj = { N, D };
  debug(obj);
  return obj;
}

// general helpers
function debug(message?: any, ...optionalParams: any[]) {
  if (!!process.env.LOCAL_DEBUG) console.log(message, ...optionalParams);
}

// reader
if (!process.env.LOCAL_DEBUG) {
  const { stdin: input, stdout: output } = process;
  input.resume();
  input.setEncoding('utf8');
  const lines = [];
  require('readline')
    .createInterface({ input, output })
    .on('line', line => lines.push(line))
    .on('close', () => main(lines));
}
//  [typescript]
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): { N: number, D: number } => {
  const [N, D] = lines[0].split(' ').map(line => +line)
  const obj = { N, D }
  debug(obj)
  return obj
}
// solver
export const solve = (lines: string[]): string => {
  const { N, D } = parseLines(lines)
  let range = D * 2 + 1
  let person = Math.floor(N / range)
  if (N % range > 0) {
    person++
  }
  return `${person}`
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}
//  [python]
N = int(input())
print((N-1)//2)
//  [python]
# coding: utf-8
N = int(input())
if N % 2 == 0:
    print(N // 2 - 1)
else:
    print(N // 2)
//  [python]
N=int(input()) 
if N%2 ==0:
  print(N//2-1)
else:
  print((N-1)//2)
//  [python]
import math
import numpy as np

N = int(input())

N_half = math.floor(N/2)

counts = 0
for i in np.arange(1, N):
    j = N-i
    if(i != j ):
        counts += 1
        
print(int(counts/2))
//  [python]
N = int(input())
ans = set()
for i in range(1, N + 1):
    j = N - i
    if i == j or i == 0 or j == 0:
        continue
    ans.add((min(i, j), max(i, j)))
print(len(ans))
//  [python]
n=int(input())
s=set()
for i in range(1,n):
  j=n-i
  if i==j:continue
  t=[i,j]
  t.sort()
  key=str(t[0])+str([1])
  s.add(key)
print(len(s))
//  [java]
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();

        }

        String arr01[] = mylist.get(0).split(" ");

        int n = Integer.valueOf(arr01[0]);

        if (n % 2 == 0) {
            System.out.println(n / 2 - 1);
        } else {
            System.out.println(n / 2);

        }

    }

}
//  [java]
import java.util.*;
 
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println((N-1)/2);
    }
}
//  [java]
import java.util.*;
import java.io.*;
import java.util.function.*;

class Main {
    static Scanner scanner = new Scanner();
    static int mod = 1000000007;
    static long inf = 0x7ffffffffffffffL;

    public static void main(String[]$) throws Exception {
        int n = scanner.nextInt();
        System.out.println(n % 2 == 0 ? n / 2 - 1 : n / 2);
    }

    static class System {
        static PrintWriter out = new PrintWriter(java.lang.System.out);

        static {
            Runtime.getRuntime().addShutdownHook(new Thread(System.out::flush));
        }

        static void exit() {
            java.lang.System.exit(0);
        }
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(java.lang.System.in), 0x10000);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        char[][] nextCharArray(int n, int m) {
            char[][] a = new char[n][m];
            for (int i = 0; i < n; i++) {
                a[i] = next().toCharArray();
            }
            return a;
        }
        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        int[] nextIntArray(int n, IntUnaryOperator op) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = op.applyAsInt(nextInt());
            }
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }

        long[] nextLongArray(int n, LongUnaryOperator op) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = op.applyAsLong(nextLong());
            }
            return a;
        }
    }
}
//  [cpp]
#include<stdio.h>

int main(){
    int N;
    scanf("%d",&N);
    int answer;
    if(N%2==0){
        answer=(N/2)-1;
    }
    else{
        answer=(N-1)/2;
    }
    printf("%d\n",answer);
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;


int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        LL n;
        cin >> n;
        n--;
        cout << n/2 << endl;
    return 0;
}
//  [cpp]
#include"bits/stdc++.h"
using namespace std;
int main(){
	int n;
	cin>>n;
	if(n==2)cout<<0;
	else if(n%2==1)cout<<n/2<<endl;
	else if(n%2==0)cout<<(n-1)/2<<endl;
return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() 
{
    int n,c=0;
    cin>>n;
    map<int,int>mp;
    for(int i=1;i<n;i++)
        mp[i]=1;
    for(auto it=mp.begin();it!=mp.end();it++)
    { 
        int x=it->first;
         int y=n-x;
          if(mp[x]!=0)
           {  mp[x]=0;
                if(mp.find(y)!=mp.end()&&mp[y]!=0)
                  c++;
               
           }
           mp[y]=0;
            
    }
    cout<<c;
      
      
    
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = (ll)1e9;
auto p = vector<int>();
auto c = vector<int>();
int d,g;
	
int main(){
	ll n;
	cin >> n;
  	auto used = map<int,int>();
	ll sum = 0;
	for(ll i=1;i<n;i++){
      if(used[i] == 1 && used[n-i] == 1) continue;
      if(i == n-i)continue;
      used[i]=1;
      used[n-i]=1;
      sum++;
	}

	cout << sum << endl;
	
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

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

	long long ans = 0;
	map<pair<int, int>, int> m;
	for( int i = 1; i < N; i++ ) {
		if( i == N  - i ) continue;
		pair<int, int> p = make_pair( min(i, N - i), max(i, N - i) );
		if( m.count(p) == 0 ) {
			m[p]++;
			ans++;
		}
	}

	cout << ans << endl;
}
//  [c]
#include <stdio.h>
#include <stdint.h>
           
           
int        
main (void)
{          
  uint32_t  N, i, count = 0;
           
  scanf("%d", &N);
           
  for (i = 1; i < (N + 1)/2; i++) {
    if (i != N -i) {
      count++;
    }      
  }        
           
  printf("%u", count);
           
  return 0;                                                                        
}
//  [c]
#include <stdio.h>

int main(){
  int N;
  scanf("%d",&N);
  
  printf("%d\n",(N-1)/2);
  return 0;
}
//  [c]
#include <stdio.h>
int main() {
	int n;
	scanf("%d", &n);
	printf("%d\n", n % 2 == 0 ? n / 2 - 1 : n / 2);
	return 0;
}
//  [c]
#include <stdio.h>

int main(void) {
	int N;
	if (scanf("%d", &N) != 1) return 1;
	printf("%d\n", (N - 1) / 2);
	return 0;
}
//  [c]
#include <stdio.h>
int main(void){
    int N;
    scanf("%d", &N);
    if(N%2==0) printf("%d", N/2-1);
    else printf("%d", N/2);
    return 0;
}
//  [c]
#include <stdio.h>

int main()
{
    int n=0;
    scanf("%d",& n);

    int cnt = 0;
    for (int i = 1; i < n - i; i++)
        cnt++;
    printf("%d", cnt);
    return 0;
}
//  [javascript]
function Main(input){
if(input%2 == 0){
  console.log((input/2)-1);
}else{
  console.log((input/2)-0.5);
}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(arg) {
    arg2 = parseInt(arg);
    console.log(Math.ceil(arg2/2)-1);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
const Main = input => {
  const N = +input;
  console.log(Math.ceil(input / 2) -1);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  if(N % 2 == 0){
    myout(N / 2 - 1);
  }else{
    myout(Math.floor(N / 2));
  }

}
//  [javascript]
function main(input) {
  var s = input[0]-0;
  var ans = 0;
  for(var i=1;i<s;i++){
    if(s-i>i) ans++;
  }
  console.log(ans);
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8').split("\n"))
//  [javascript]
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const N = parseInt(args[0][0], 10)
	if (N % 2 === 0) console.log(Math.floor(N / 2 - 1))
	else console.log(Math.floor(N / 2))
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	
	ans := 0
	if n % 2 == 0 {
		ans = n / 2 - 1
	} else {
		ans = n / 2
	}
	fmt.Println(ans)
}
//  [go]
package main

import "fmt"

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

	if n%2 == 0 {
		fmt.Println(n/2 - 1)
	} else {
		fmt.Println(n / 2)
	}
}
//  [go]
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	res := map[int]int{}
	for i := 1; i < n/2+1; i++ {
		if i != n-i {
			res[i] = n - i
		}
	}
	fmt.Println(len(res))
}
//  [go]
package main

import (
  "fmt"
)

func main() {
  var n int
  fmt.Scanf("%d", &n)
  
  ans := n / 2
  if n % 2 == 0 {
    ans--
  }
  fmt.Printf("%d\n", ans)
}
//  [ruby]
p ((gets.to_f-0.5)/2).to_i
//  [ruby]
n = gets.to_i

if n.even?
  puts n/2 - 1
else
  puts n/2
end
//  [ruby]
# frozen_string_literal: true

n = gets.to_i

puts (n - 1) / 2
//  [ruby]
n = gets.chomp.to_i
map = Hash.new(false)
count = 0
(1...n).each do |i|
  break if map[i]
  break if map[n - i]
  break if i == n - i
  map[i] = true
  map[n - i] = true
  count += 1
end
puts count
//  [ruby]
n = gets.to_i

array = (1..n-1).to_a
array_r = (1..n-1).to_a.reverse

#p array
#p array_r

ctn = 0
for i in 0..array.length-1
  #puts array[i]
  #puts array_r[i]
  if array[i] != array_r[i]
    ctn += 1
   # puts "a"
  end
end

puts ctn / 2
//  [ruby]
N = gets.to_i

count = 0
N.times do |i|
  next if i == N-1
  one = i+1
  pair = N - (i+1)
  
  next if one == pair
  count+=1
end

count = count/2

puts(count)
//  [rust]
use std::io;

fn main() {
    let n = read_one::<usize>();
    let ans = (n as f64 / 2f64).ceil() as usize - 1;
    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}
//  [rust]
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let n: usize;
    input!(n);

    let mut ans = 0;

    for i in 1..n/2+1 {
        if n - i != i {
            ans += 1;
        }
    }
    p(ans);
}
//  [rust]
use std::io;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let n: i64 = s.trim().parse().ok().unwrap();
    println!("{}", (n-1)/2);
}
//  [rust]
use std::collections::HashSet;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
    let v: Vec<T> = read_vec();
    assert_eq!(v.len(), 2);
    (v[0], v[1])
}

fn main() {
    let n: usize = read();
    let mut ans: usize = 0;
    let mut set = HashSet::new();
    for i in 1..n {
        let m = n - i;
        if i < m {
            set.insert((i, m));
        } else if m < i {
            set.insert((m, i));
        }
    }

    ans = set.len();
    println!("{}", ans);
}
//  [rust]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let n: usize = read!();
    println!("{}", (n - 1) / 2);
}
//  [swift]
print((Int(readLine()!)!+1)/2-1)
//  [swift]
print((Int(readLine()!)!-1)/2)
//  [typescript]
"use strict";

function Main(input) {
  // 数値にする
  let num = +input;
  console.log(Math.abs(Math.ceil((input-2)/2)));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
export const Main = function (input: Array<Array<string>>) {
  const N = parseInt(input[0][0]);
  console.log(Math.ceil(0.5 * N) - 1)
}
const parseInput = (input: string) => {
  const lines = input.split("\n");
  if (lines[lines.length - 1] === "") lines.pop();
  return lines.map((el) => (el.split(" ")));
}

Main(parseInput(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
'use strict'
const main = (input: string) => {
    const n: number = Number(input)
    console.log(Math.floor((n-1)/2))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};
const main=()=>{
  to(ceil(tn()/2)-1)
}
main()
//  [typescript]
function main(p){
  const n = parseInt(p.split('\n')[0], 10)
  let ans = 0
  for(let i=1; i<=n/2; i++){
    if(i !== n-i){
      ans++
    }
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [python]
from pip._vendor.distlib.compat import raw_input

a, b, c, d = map(int, raw_input().split())

while a > 0 and c > 0:
    c -= b
    if c <= 0:
        print('Yes')
        break
    a -= d
    if a <= 0:
        print('No')
//  [python]
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

# sys.setrecursionlimit(100000)
input = sys.stdin.buffer.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(A, B, C, D):
    while True:
        C -= B
        if C <= 0:
            return 'Yes'
        A -= D
        if A <= 0:
            return 'No'


def main():
    A, B, C, D = read_int_n()
    print(slv(A, B, C, D))


if __name__ == '__main__':
    main()
//  [python]
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    Al,Aa,Bl,Ba = map(int,input().strip().split())
    while True:
        Bl -= Aa
        if Bl<=0:
            print("Yes")
            return
        Al -= Ba
        if Al <= 0:
            print("No")
            return

if __name__ == '__main__':
    main()
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        boolean t = false;
        while (a > 0 && c > 0) {
            t ^= true;
            if (t) {
                c -= b;
            } else {
                a -= d;
            }
        }
        System.out.println(t ? "Yes" : "No");
    }
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;

public class Main {

    static class FastReader{
        BufferedReader br;
        StringTokenizer st;

        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next(){
            while(st==null || !st.hasMoreElements()){
                try{
                    st=new StringTokenizer(br.readLine());
                }
                catch(IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt(){
            return Integer.parseInt(next());
        }

        Long nextLong(){
            return Long.parseLong(next());
        }

        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str="";
            try{
                str=br.readLine();
            }
            catch(IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
        FastReader in = new FastReader();
      int a=in.nextInt();
      int b=in.nextInt();
      int c=in.nextInt();
      int d =in.nextInt();
      while(true){
          c=c-b;
          a=a-d;
          if(c<=0){
              System.out.println("Yes");
              break;
          }else if(a<=0){
              System.out.println("No");
              break;
          }
      }
    }
}