Language: C++

  /*input
  9
  */
  /*
  FIND YOUR PURPOSE BECOME UNSTOPPABLE.
                      ,.
                    ,_> `.   ,';
                ,-`'      `'   '`'._
              ,,-) ---._   |   .---''`-),.
            ,'      `.  \  ;  /   _,'     `,
        ,--' ____       \   '  ,'    ___  `-,
        _>   /--. `-.              .-'.--\   \__
      '-,  (    `.  `.,`~ \~'-. ,' ,'    )    _\
      _<    \     \ ,'  ') )   `. /     /    <,.
    ,-'   _,  \    ,'    ( /      `.    /        `-,
    `-.,-'     `.,'       `         `.,'  `\    ,-'
    ,'       _  /   ,,,      ,,,     \     `-. `-._
    /-,     ,'  ;   ' _ \    / _ `     ; `.     `(`-\
    /-,        ;    (o)      (o)      ;          `'`,
  ,~-'  ,-'    \     '        `      /     \      <_
  /-. ,'        \                   /       \     ,-'
    '`,     ,'   `-/             \-' `.      `-. <
      /_    /      /   (_     _)   \    \          `,
        `-._;  ,' |  .::.`-.-' :..  |       `-.    _\
          _/       \  `:: ,^. :.:' / `.        \,-'
        '`.   ,-'  /`-..-'-.-`-..-'\            `-.
          >_ /     ;  (\/( ' )\/)  ;     `-.    _<
          ,-'      `.  \`-^^^-'/  ,'        \ _<
          `-,  ,'   `. `"""""' ,'   `-.   <`'
            ')        `._.,,_.'        \ ,-'
              '._        '`'`'   \       <
                >   ,'       ,   `-.   <`'
                  `,/          \      ,-`
                  `,   ,' |   /     /
                    '; /   ;        (
                    _)|   `       (
                    `')         .-'
                      <_   \   /    
                        \   /\(
                          `;/  `
  */
  #include <bits/stdc++.h>
  #define endl "\n"
  #define ll long long int
  #define vi vector<int>
  #define vll vector<ll>
  #define vvl vector < vll >
  #define pii pair<int,int>
  #define pll pair<long long, long long>
  #define mod 1000000007
  #define inf 1000000000000000001
  #define all(c) c.begin(),c.end()
  #define mem(a,val) memset(a,val,sizeof(a))
  #define eb emplace_back
  #define sz(a) int((a).size())
  #define pb push_back
  #define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
  #define present(c,x) ((c).find(x) != (c).end())
  #define cpresent(c,x) (find(all(c),x) != (c).end())     
  #define rep(i,j,n) for(ll i=j;i<n;i++)
  #define mp make_pair
  #define hell 998244353
  //s.replace(s.find("10"), sizeof("10") - 1, "");
  using namespace std;
  ll gcd(ll a,ll b){
    if(b==0) return a;
    return gcd(b,a%b);
  }
  bool compare(const pair<int, int>&i, const pair<int, int>&j)
    {
      return i.second < j.second;
    }
  bool isPrime(ll j)
{
	if(j==2)
	return true;
	if(j%2==0)
	return false;
	for(ll i=3;i*i<=j;i=i+2)
	if(j%i==0)
	return false;
	return true;
}
  bool isSubSequence(string str1, string str2, int m, int n) 
  { 
    int j = 0; // For index of str1 (or subsequence 

    // Traverse str2 and str1, and compare current character  
    // of str2 with first unmatched char of str1, if matched  
    // then move ahead in str1 
    for (int i=0; i<n&&j<m; i++) 
      if (str1[j] == str2[i]) 
        j++; 

    // If all characters of str1 were found in str2 
    return (j==m); 
  } 
  ll modularExponentiation(ll x,ll n)
  {
      if(n==0)
          return 1;
      else if(n%2 == 0)        //n is even
          return modularExponentiation((x*x),n/2);
      else                             //n is odd
          return (x*modularExponentiation((x*x),(n-1)/2));

  }
  int issq(ll n)
  {
    ll a=sqrt(n);
    return (a*a==n?1:0);
  }
  int main()
  {
    // added the two lines below 
    ios_base::sync_with_stdio (false); 
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    //freopen("error.txt","w",stderr); 
    #endif
    ll n,d;
    cin>>n>>d;
    ll c=0,i;
    d=2*d+1;
    for(i=d;i<=n;i=i+d){
      //cout<<i<<' ';
      c++;
    }
    i=i-d;
    if(i<n){
      cout<<c+1;
    }
    else cout<<c;



  }
          /*input
  9
  */
  /*
  FIND YOUR PURPOSE BECOME UNSTOPPABLE.
                      ,.
                    ,_> `.   ,';
                ,-`'      `'   '`'._
              ,,-) ---._   |   .---''`-),.
            ,'      `.  \  ;  /   _,'     `,
        ,--' ____       \   '  ,'    ___  `-,
        _>   /--. `-.              .-'.--\   \__
      '-,  (    `.  `.,`~ \~'-. ,' ,'    )    _\
      _<    \     \ ,'  ') )   `. /     /    <,.
    ,-'   _,  \    ,'    ( /      `.    /        `-,
    `-.,-'     `.,'       `         `.,'  `\    ,-'
    ,'       _  /   ,,,      ,,,     \     `-. `-._
    /-,     ,'  ;   ' _ \    / _ `     ; `.     `(`-\
    /-,        ;    (o)      (o)      ;          `'`,
  ,~-'  ,-'    \     '        `      /     \      <_
  /-. ,'        \                   /       \     ,-'
    '`,     ,'   `-/             \-' `.      `-. <
      /_    /      /   (_     _)   \    \          `,
        `-._;  ,' |  .::.`-.-' :..  |       `-.    _\
          _/       \  `:: ,^. :.:' / `.        \,-'
        '`.   ,-'  /`-..-'-.-`-..-'\            `-.
          >_ /     ;  (\/( ' )\/)  ;     `-.    _<
          ,-'      `.  \`-^^^-'/  ,'        \ _<
          `-,  ,'   `. `"""""' ,'   `-.   <`'
            ')        `._.,,_.'        \ ,-'
              '._        '`'`'   \       <
                >   ,'       ,   `-.   <`'
                  `,/          \      ,-`
                  `,   ,' |   /     /
                    '; /   ;        (
                    _)|   `       (
                    `')         .-'
                      <_   \   /    
                        \   /\(
                          `;/  `
  */
  #include <bits/stdc++.h>
  #define endl "\n"
  #define ll long long int
  #define vi vector<int>
  #define vll vector<ll>
  #define vvl vector < vll >
  #define pii pair<int,int>
  #define pll pair<long long, long long>
  #define mod 1000000007
  #define inf 1000000000000000001
  #define all(c) c.begin(),c.end()
  #define mem(a,val) memset(a,val,sizeof(a))
  #define eb emplace_back
  #define sz(a) int((a).size())
  #define pb push_back
  #define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
  #define present(c,x) ((c).find(x) != (c).end())
  #define cpresent(c,x) (find(all(c),x) != (c).end())     
  #define rep(i,j,n) for(ll i=j;i<n;i++)
  #define mp make_pair
  #define hell 998244353
  //s.replace(s.find("10"), sizeof("10") - 1, "");
  using namespace std;
  ll gcd(ll a,ll b){
    if(b==0) return a;
    return gcd(b,a%b);
  }
  bool compare(const pair<int, int>&i, const pair<int, int>&j)
    {
      return i.second < j.second;
    }
  bool isPrime(ll j)
{
	if(j==2)
	return true;
	if(j%2==0)
	return false;
	for(ll i=3;i*i<=j;i=i+2)
	if(j%i==0)
	return false;
	return true;
}
  bool isSubSequence(string str1, string str2, int m, int n) 
  { 
    int j = 0; // For index of str1 (or subsequence 

    // Traverse str2 and str1, and compare current character  
    // of str2 with first unmatched char of str1, if matched  
    // then move ahead in str1 
    for (int i=0; i<n&&j<m; i++) 
      if (str1[j] == str2[i]) 
        j++; 

    // If all characters of str1 were found in str2 
    return (j==m); 
  } 
  ll modularExponentiation(ll x,ll n)
  {
      if(n==0)
          return 1;
      else if(n%2 == 0)        //n is even
          return modularExponentiation((x*x),n/2);
      else                             //n is odd
          return (x*modularExponentiation((x*x),(n-1)/2));

  }
  int issq(ll n)
  {
    ll a=sqrt(n);
    return (a*a==n?1:0);
  }
  int main()
  {
    // added the two lines below 
    ios_base::sync_with_stdio (false); 
    cin.tie(NULL);
    ll n,d;
    cin>>n>>d;
    ll c=0,i;
    d=2*d+1;
    for(i=d;i<=n;i=i+d){
      //cout<<i<<' ';
      c++;
    }
    i=i-d;
    if(i<n){
      cout<<c+1;
    }
    else cout<<c;



  }
        

Compiler output:
a.cc:204:6: error: redefinition of 'long long int gcd(long long int, long long int)'
  204 |   ll gcd(ll a,ll b){
      |      ^~~
a.cc:65:6: note: 'long long int gcd(long long int, long long int)' previously defined here
   65 |   ll gcd(ll a,ll b){
      |      ^~~
a.cc:208:8: error: redefinition of 'bool compare(const std::pair<int, int>&, const std::pair<int, int>&)'
  208 |   bool compare(const pair<int, int>&i, const pair<int, int>&j)
      |        ^~~~~~~
a.cc:69:8: note: 'bool compare(const std::pair<int, int>&, const std::pair<int, int>&)' previously defined here
   69 |   bool compare(const pair<int, int>&i, const pair<int, int>&j)
      |        ^~~~~~~
a.cc:212:8: error: redefinition of 'bool isPrime(long long int)'
  212 |   bool isPrime(ll j)
      |        ^~~~~~~
a.cc:73:8: note: 'bool isPrime(long long int)' previously defined here
   73 |   bool isPrime(ll j)
      |        ^~~~~~~
a.cc:223:8: error: redefinition of 'bool isSubSequence(std::string, std::string, int, int)'
  223 |   bool isSubSequence(string str1, string str2, int m, int n)
      |        ^~~~~~~~~~~~~
a.cc:84:8: note: 'bool isSubSequence(std::string, std::string, int, int)' previously defined here
   84 |   bool isSubSequence(string str1, string str2, int m, int n)
      |        ^~~~~~~~~~~~~
a.cc:237:6: error: redefinition of 'long long int modularExponentiation(long long int, long long int)'
  237 |   ll modularExponentiation(ll x,ll n)
      |      ^~~~~~~~~~~~~~~~~~~~~
a.cc:98:6: note: 'long long int modularExponentiation(long long int, long long int)' previously defined here
   98 |   ll modularExponentiation(ll x,ll n)
      |      ^~~~~~~~~~~~~~~~~~~~~
a.cc:247:7: error: redefinition of 'int issq(long long int)'
  247 |   int issq(ll n)
      |       ^~~~
a.cc:108:7: note: 'int issq(long long int)' previously defined here
  108 |   int issq(ll n)
      |       ^~~~
a.cc:252:7: error: redefinition of 'int main()'
  252 |   int main()
      |       ^~~~
a.cc:113:7: note: 'int main()' previously defined here
  113 |   int main()
      |       ^~~~