function main(input) {
  const lines = input.split('\n');
  delete lines[lines.length - 1];
  lines.forEach(v => {
    const s = v.split(' ');
    console.log(fn(s[0], s[1]));
  });
}

function fn(n, d) {
  const availableNumberOfCounterPerOne = d * 2 + 1;
  if (n % availableNumberOfCounterPerOne === 0 ) {
    return n / availableNumberOfCounterPerOne;
  }
  return Math.floor(n / availableNumberOfCounterPerOne + 1);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
