Problem:
Score : 200 points

Problem Statement

There are N apple trees in a row. People say that one of them will bear golden apples.

We want to deploy some number of inspectors so that each of these trees will be inspected.

Each inspector will be deployed under one of the trees. For convenience, we will assign numbers from 1 through N to the trees. An inspector deployed under the i-th tree (1 \leq i \leq N) will inspect the trees with numbers between i-D and i+D (inclusive).

Find the minimum number of inspectors that we need to deploy to achieve the objective.

Constraints

All values in input are integers.

1 \leq N \leq 20

1 \leq D \leq 20

Input

Input is given from Standard Input in the following format:

N D

Output

Print the minimum number of inspectors that we need to deploy to achieve the objective.

Sample Input 1

6 2

Sample Output 1

2

We can achieve the objective by, for example, placing an inspector under Tree 3 and Tree 4.

Sample Input 2

14 3

Sample Output 2

2

Sample Input 3

20 4

Sample Output 3

3

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

// E. Magical Permutation
// time limit per test1 second
// memory limit per test256 megabytes
// inputstandard input
// outputstandard output
// Kuro has just learned about permutations and he is really excited to create a
// new permutation type. He has chosen 𝑛 distinct positive integers and put all
// of them in a set 𝑆. Now he defines a magical permutation to be:

// A permutation of integers from 0 to 2𝑥−1, where 𝑥 is a non-negative integer.
// The bitwise xor of any two consecutive elements in the permutation is an
// element in 𝑆. Since Kuro is really excited about magical permutations, he
// wants to create the longest magical permutation possible. In other words, he
// wants to find the largest non-negative integer 𝑥 such that there is a magical
// permutation of integers from 0 to 2𝑥−1. Since he is a newbie in the subject,
// he wants you to help him find this value of 𝑥 and also the magical
// permutation for that 𝑥.

// Input
// The first line contains the integer 𝑛 (1≤𝑛≤2⋅105) — the number of elements in
// the set 𝑆.

// The next line contains 𝑛 distinct integers 𝑆1,𝑆2,…,𝑆𝑛 (1≤𝑆𝑖≤2⋅105) — the
// elements in the set 𝑆.

// Output
// In the first line print the largest non-negative integer 𝑥, such that there
// is a magical permutation of integers from 0 to 2𝑥−1.

// Then print 2𝑥 integers describing a magical permutation of integers from 0 to
// 2𝑥−1. If there are multiple such magical permutations, print any of them.

// Examples
// inputCopy
// 3
// 1 2 3
// outputCopy
// 2
// 0 1 3 2
// inputCopy
// 2
// 2 3
// outputCopy
// 2
// 0 2 1 3
// inputCopy
// 4
// 1 2 3 4
// outputCopy
// 3
// 0 1 3 2 6 7 5 4
// inputCopy
// 2
// 2 4
// outputCopy
// 0
// 0
// inputCopy
// 1
// 20
// outputCopy
// 0
// 0
// inputCopy
// 1
// 1
// outputCopy
// 1
// 0 1
// Note
// In the first example, 0,1,3,2 is a magical permutation since:

// 0⊕1=1∈𝑆
// 1⊕3=2∈𝑆
// 3⊕2=1∈𝑆
// Where ⊕ denotes bitwise xor operation.

#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

using namespace std;

int n, m, d;
int i, j, k;

void solve() {
  cin >> n >> d;
  cout << ((n + d - 1) / d) << endl;
  return;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}