const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        const str = lines[l++]
        output[i] = solve(n, arr, str)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr, str) {
    const liked = []
    const unliked = []
    for (let i = 0; i < arr.length; i++) {
        if (str[i] === '1') {
            liked.push([i, arr[i]])
        } else {
            unliked.push([i, arr[i]])
        }
    }
    liked.sort((a, b) => a[1] - b[1])
    unliked.sort((a, b) => a[1] - b[1])
    // console.log(liked, unliked)
    const ans = Array(n)
    for (let i = 0; i < arr.length; i++) {
        if (i < unliked.length) {
            ans[unliked[i][0]] = i + 1
        } else {
            ans[liked[i - unliked.length][0]] = i + 1
        }
    }
    return ans.join(' ')
}

const lib = require('readline');
const rl = lib.createInterface({
    input: process.stdin,
    output: process.stdout
});

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => {
        let next;
        do {
            next = (await getLineGen.next());
        } while (!next.done && next.value === '');
        return next.value;
    };
})();

let solve = async () => {
    const nsc = parseInt(await getLine());
    for(let sc = 0; sc < nsc; sc++) {
        const n = parseInt(await getLine());
        const p = (await getLine()).split(' ').map(num => parseInt(num));
        const s = await getLine();
        const res = new Array(n);
        let ptr = n - 1;
        const order = new Array(n);
        for(let i = 0; i < n; i++) {
            order[p[i] - 1] = i + 1;
        }
        for(let i = n - 1; i >= 0; i--) {
            if (s.charAt(order[i] - 1) === '1') {
                res[ptr] = order[i];
                ptr--;
            }
        }

        for(let i = n - 1; i >= 0; i--) {
            if (s.charAt(order[i] - 1) === '0') {
                res[ptr] = order[i];
                ptr--;
            }
        }

        for(let i = 0; i < n; i++) {
            order[res[i] - 1] = i + 1;
        }

        console.log(order.join(' '));
    }
}

solve();

const solve = (arr,str)=>{
     let zero = [],one = [];
     for(let i=0;i<str.length;i++){
          if(str[i]==="0") zero.push(arr[i]);
          else one.push(arr[i]);
     }
     if(!zero.length || !one.length) return arr.join(" ");
     zero.sort((a,b)=>a-b);
     one.sort((a,b)=>a-b);
     let cnt1 = 1;
     let cnt2 = zero.length+1;
     let obj = {},res = "";
     for(let i=0;i<zero.length;i++) obj[zero[i]] = cnt1++;
     for(let i=0;i<one.length;i++) obj[one[i]] = cnt2++;
     for(let i=0;i<arr.length;i++) res+=obj[arr[i]]+" ";
     return res;
}

function main() {
  const fs = require("fs");
  const input = fs.readFileSync(0, "utf8").trim().split("\n");
  let line = 0;
  function readline() {
    return input[line++];
  }
  let t = parseInt(readline());
  for(let i=0;i<t;i++){
       let n = parseInt(readline());
       let arr = (readline().trim().split(" ").map(cur=>parseInt(cur)));
       let str = readline().trim();
       console.log(solve(arr,str));
  }
}
main();

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		const n = rn();
		const p = rna();
		const s = rl();

		let cnt = 0;
		for (const c of s) cnt += c == '0';

		const ans = [];
		const used = new Set();
		for (let i = 0; i < n; i++) {
			if (s[i] == '0' && p[i] <= cnt || s[i] == '1' && p[i] > cnt) {
				ans[i] = p[i];
				used.add(p[i]);
			}
		}

		let l = 1, r = n;
		for (let i = 0; i < n; i++) {
			if (!ans[i]) {
				if (s[i] == '0') {
					while (used.has(l)) l++;
					ans[i] = l;
					l++;
				} else {
					while(used.has(r)) r--;
					ans[i] = r;
					r--;
				}
			}
		}

		console.log(ans.join(' '));
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		const n = rn();
		const p = rna();
		const s = rl();

		let cnt = 0;
		for (const c of s) cnt += c == '1';

		const ans = [];
		const used = new Set();
		for (let i = 0; i < n; i++) {
			if (s[i] == '0' && p[i] <= cnt || s[i] == '1' && p[i] > cnt) {
				ans[i] = p[i];
				used.add(p[i]);
			}
		}

		let l = 1, r = n;
		for (let i = 0; i < n; i++) {
			if (!ans[i]) {
				if (s[i] == '0') {
					while (used.has(l)) l++;
					ans[i] = l;
					l++;
				} else {
					while(used.has(r)) r--;
					ans[i] = r;
					r--;
				}
			}
		}

		console.log(ans.join(' '));
	}
}

const lib = require('readline');
const rl = lib.createInterface({
    input: process.stdin,
    output: process.stdout
});

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => {
        let next;
        do {
            next = (await getLineGen.next());
        } while (!next.done && next.value === '');
        return next.value;
    };
})();

let solve = async () => {
    const nsc = parseInt(await getLine());
    for(let sc = 0; sc < nsc; sc++) {
        const n = parseInt(await getLine());
        const p = (await getLine()).split(' ').map(num => parseInt(num));
        const s = await getLine();
        const res = new Array(n);
        let ptr = n - 1;
        for(let i = n - 1; i >= 0; i--) {
            if (s.charAt(p[i] - 1) === '1') {
                res[ptr] = p[i];
                ptr--;
            }
        }

        for(let i = n - 1; i >= 0; i--) {
            if (s.charAt(p[i] - 1) === '0') {
                res[ptr] = p[i];
                ptr--;
            }
        }

        console.log(res.join(' '));
    }
}

solve();


var n = readline()
var res = n;
var p = readline().split(" ")
var tomas = p.map((a) => Number(a)).reduce((a, b) => a + b, 0);

for (var i = 1; i < n; i++) {
    var p = readline().split(" ")
    var point = p.map((a) => Number(a)).reduce((a, b) => a + b, 0);
    (tomas >= point)?res--:0;
}

print(res)

var readline = require('readline');

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

buf = '';
ctr = 0;
var n;
var m = 0;
var lst = [];
var split;

rl.on('line', function (line) {
	split = line.trim().split(' ').map(x => parseInt(x))
	if( split.length == 1){
		n = parseInt(line);
	}
	else {

		lst[m] = {idx: m+1, val: split.reduce( (full, curr) => full + curr )}
		m++;
		n--;
		if(n == 0){
			var srt = lst.sort( (a, b) => {
				return a.val != b.val ? b.val - a.val : a.idx - b.idx
			})
			srt.forEach( ({idx}, id) => idx == 1 ? console.log(id+1) : 0 )
			// console.log(srt)
			process.exit()
		}
	}
});

function main(){
    var n = +readline();
    var a = [];

    for(var i = 0;i < n;i++){
        a.push(readline().split(' ').reduce((sum,o) => sum + +o, 0));
    }
    var t = a[0];

    print(a.sort((s,q)=>q-s).indexOf(+t) +1);
}

main();

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let me = 0;
let ans = 1;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  const arr = d.split(' ').map(Number);
  const sum = arr.reduce((a, b) => a + b, 0);

  if (c === 1) {
    me = sum;
  }

  if (sum > me) {
    ans++;
  }

  c++;
});

rl.on('close', () => {
  console.log(ans);
});

var n = +readline();
var total = [];
var id = 1;

for (var i=0; i<n; i++){
	var p = readline().split(' ').map(Number);
	total[i] = p[0] + p[1] + p[2] + p[3];
}

for (var j=1; j<n; j++){
	if (total[0] < total[j]) id++;
}

print (id);

let input = [];

const RL = require('readline').createInterface({
   input : process.stdin,
   output : process.stdout
});

RL.on('line', (line) => {
    input.push(line);
});

RL.on('close', () => {
    let n = parseInt(input[0]);

    let data = []; let t_pos = 1, t_points = 0;
    for(let i = 0; i < n; i++){
        let sum = 0; input[i+1].split(' ').forEach( j => sum+= parseInt(j) );
        data.push(sum);
        if(i == 0)
            t_points = sum;
        else {
            if(sum > t_points)
                t_pos++;
        }
    }
    console.log(t_pos);
});

function main() {
  const is = new Scanner();
  const n = is.nextInt();
  const scores = new Array(n);
  for (let i = 0; i < n; i += 1) {
    scores[i] = is.nextArray(Number);
    scores[i] = [scores[i].reduce((accum, item) => accum + item, 0), i + 1];
  }
  scores.sort((a, b) => {
    if (a[0] === b[0])
      return a[1] - b[1];
    return b[0] - a[0];
  });

  for (let i = 0; i < n; i += 1) {
    if (scores[i][1] === 1) {
      console.log(i + 1);
      break;
    }
  }

}

/*
 *  Api Scanner
 */
class Scanner {
  constructor() {
    this.index = -1;
    this.lines = stdinInput.trim().split('\n'); // eslint-disable-line
  }

  nextLine() {
    this.index += 1;
    return this.lines[this.index].trim();
  }

  nextInt() {
    return parseInt(this.nextLine(), 10);
  }

  nextDouble() {
    return parseFloat(this.nextLine());
  }

  nextArray(fn) {
    const array = this.nextLine().split(' ');
    return fn === String ? array : array.map(fn);
  }

  hasNext() {
    return this.index < this.lines.length;
  }
}

let stdinInput = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', (input) => { stdinInput += input; });
process.stdin.on('end', () => { main(); });

const vIn = [];
let itIn = 0;
const getNext = () => vIn[itIn++];
const getInt = () => parseInt(getNext(), 10);
const forEachN = (n, cb, flagInt = false) => {
  const nextItIn = itIn + n;
  const fn = flagInt ? getInt : getNext;
  while (itIn !== nextItIn) cb(fn());
};

class SolveProblemClass {
  constructor() {
  }

  solveAll() {
    const n = getInt();
    const v = [];
    for (let i = 0; i < n ; i++) {
      let sum = 0;
      forEachN(4, (x) => {
        sum += x;
      }, true);
      v.push({ i, sum });
    }
    v.sort((a, b) => {
      if (b.sum > a.sum) return 1;
      if (b.sum < a.sum) return -1;
      return a.i - b.i;
    });
    const pos = v.reduce((i, obj, it) => {
      if (obj.i === 0) return it + 1;
      return i;
    }, -1);
    console.log(pos);
  }
}

const processData = (input) => {
  input.split('\n').forEach(line => {
    // vIn.push(line);
    line.split(' ').forEach(item => { vIn.push(item); });
  });
};

const solveP = new SolveProblemClass();
process.stdin.resume();
process.stdin.setEncoding("ascii");
let _input = "";
process.stdin.on("data", (input) => {
  _input += input;
});
process.stdin.on("end", () => {
  processData(_input);
  solveP.solveAll();
});

const readline = require('readline')
const rl = readline.createInterface({input: process.stdin})

let n, sums = [], numLines = 0
rl.on('line', line => {
    if (++numLines == 1) {
        n = parseInt(line)
    } else {
        const currentSum = line.split(' ').map(x => parseInt(x)).reduce((a, x) => a + x)
        sums.push(currentSum)
    }
}).on('close', () => {
    const thomasSum = sums.shift()
    const thomasRank = 1 + sums.filter(x => x > thomasSum).length
    process.stdout.write(`${thomasRank}`)
})

function main(){
    var n = +readline();
    var a = [];
    var t = readline().split(' ').reduce((sum,o) => +sum + +o, 0)

    for(var i = 0;i< n-1;i++){
        a.push(readline().split(' ').reduce((sum,o) => +sum + +o, 0));
        print(a[i])
    }
    var r = a.sort((s,q)=>q-s).indexOf(t);
    if(r > -1){
        print(r + 1);
    }
    else{
        if(t > a[0]){
            print(1);
        }
        else{
            print(n);
        }
    }

}

main()

function main(){
    var n = +readline();
    var a = [];
    var t = readline().split(' ').reduce((sum,o) => sum + +o, 0)

    for(var i = 0;i< n-1;i++){
        a.push(readline().split(' ').reduce((sum,o) => sum + +o, 0));
    }
    var r = a.sort((s,q)=>q-s).indexOf(+t);

    if(r > -1){
        print(r + 1);
    }
    else{
        if(t > a[0] || !a.length){
            print(1);
        }
        else{
            print(n);
        }
    }
}

main()

function main(){
    var n = +readline();
    var a = [];
    var t = readline().split(' ').reduce((sum,o) => +sum + +o, 0)

    for(var i = 0;i< n-1;i++){
        a.push(readline().split(' ').reduce((sum,o) => +sum + +o, 0));
    }
    var r = a.sort((s,q)=>q-s).indexOf(t);
    if(r > -1){
        print(r + 1);
    }
    else{
        if(t > a[0]){
            print(1);
        }
        else{
            print(n);
        }
    }

}

main()

var readline = require('readline');

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', function (line) {
  console.log(2);
  process.exit()
});

var readline = require('readline');

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

buf = '';
ctr = 0;
var n;
var m = 0;
var lst = [];
var split;

rl.on('line', function (line) {
	split = line.trim().split(' ').map(x => parseInt(x))
	if( split.length == 1){
		n = parseInt(line);
	}
	else {

		lst[m] = {idx: m+1, val: split.reduce( (full, curr) => full + curr )}
		m++;
		n--;
		if(n == 0){
			var srt = lst.sort( (a, b) => {
				return a.val != b.val ? b.val - a.val : b.idx - a.idx
			})
			srt.forEach( ({idx}, id) => idx == 1 ? console.log(id+1) : 0 )
			// console.log(srt)
			process.exit()
		}
	}
});

process.stdin.resume()
process.stdin.setEncoding("ascii");
buf = ''
ctr = 0
var n
var m = 0
var lst = []
var split
process.stdin.on('data', input => {
	split = input.trim().split(' ').map(x => parseInt(x))
	if( split.length == 1){
		n = parseInt(input);
	}
	else {

		lst[m] = {idx: m+1, val: split.reduce( (full, curr) => full + curr )}
		m++;
		n--;
		if(n == 0){
			var srt = lst.sort( (a, b) => {
				return a.val != b.val ? b.val - a.val : b.idx - a.idx
			})
			// console.log(srt)
			srt.forEach( ({idx}, id) => idx == 1 ? console.log(id+1) : 0 )
			process.exit(0)
		}
	}
})
// process.stdin.on("end", () => {
// 	console.log(buf)
// })

// process.stdin.resume()
process.stdin.setEncoding("ascii");
buf = ''
ctr = 0
var n
var m = 0
var lst = []
var split
process.stdin.on('data', input => {
	split = input.trim().split(' ').map(x => parseInt(x))
	if( split.length == 1){
		n = parseInt(input);
	}
	else {

		lst[m] = {idx: m+1, val: split.reduce( (full, curr) => full + curr )}
		m++;
		n--;
		if(n == 0){
			var srt = lst.sort( (a, b) => {
				return a.val != b.val ? b.val - a.val : b.idx - a.idx
			})
			srt.forEach( ({idx}, id) => idx == 1 ? console.log(id+1) : 0 )
			// console.log(srt)
			process.exit()
		}
	}
})
// process.stdin.on("end", () => {
// 	var lid
// 	srt.forEach( ({idx}, id) => idx == 1 ? lid=id+1: 0 )
// 	console.log(lid)
// 	process.exit(lid)
// })

process.stdin.resume()
process.stdin.setEncoding("ascii");
buf = ''
ctr = 0
var n
var m = 0
var lst = []
var split
process.stdin.on('data', input => {
	split = input.trim().split(' ').map(x => parseInt(x))
	if( split.length == 1){
		n = parseInt(input);
	}
	else {

		lst[m] = {idx: m+1, val: split.reduce( (full, curr) => full + curr )}
		m++;
		n--;
		if(n == 0){
			var srt = lst.sort( (a, b) => {
				return a.val != b.val ? b.val - a.val : b.idx - a.idx
			})
			srt.forEach( ({idx}, id) => idx == 1 ? console.log(id+1) : 0 )
			console.log(srt)
			process.exit(0)
		}
	}
})
// process.stdin.on("end", () => {
// 	var lid
// 	srt.forEach( ({idx}, id) => idx == 1 ? lid=id+1: 0 )
// 	console.log(lid)
// 	process.exit(lid)
// })


'use strict';
// HEADER:
const print = function(arg){
  let str = arg;
  if (arguments.length>1)
    str = Array.prototype.slice.call(arguments).join(' ');
  process.stdout.write(str+'\n');
};
let IS_MULTITEST, testN, tests;
const pcalc = (testN, toPrint)=>{
  let res = calc(testN);
  if (Array.isArray(res)){
    toPrint.push(res.join(' '));
  } else if (Number.isFinite(res) || typeof res=='string'){
    toPrint.push(res+'');
  }
  if (process.env.DEBUG && toPrint.length){
    let ans = toPrint.pop();
    print(ans);
    let expected = tests[testN-1];
    if (expected){
      if (expected==ans)
        console.log('\x1b[32m%s\x1b[0m', 'correct');
      else {
        console.log('\x1b[31m%s\x1b[0m', 'wrong, expected:', expected);
      }
    }
  }
};

const main = ()=>{
  let toPrint = [];
  L('\nSolving:');
  if (IS_MULTITEST){
    let T = +readline()
    for (testN=1; testN<=T; testN++)
      pcalc(testN, toPrint);
  } else {
    pcalc(1, toPrint);
  }
  if (toPrint.length){
    print(toPrint.join('\n'));
  }
};

const lines = [];
const rl = require('readline').createInterface({
   input: process.stdin, output: process.stdout});
rl.on('line', line=>{
  lines.push(line);
});
rl.on('close', main);
let rli = 0;
const readline = ()=>lines[rli++];
const L = process.env.DEBUG ? console.log : ()=>{};
const LT = obj=>L(`\nTest #${testN}`, obj);

const ra = ()=>readline().split(' ').map(a=>+a)
const pa = arr=>print(arr.join(' '));

tests = [
``, // Test #1
``, // Test #2
``, // Test #3
``, // Test #4
``, // Test #5
];

// SOLUTION:
IS_MULTITEST = true;

class Heap {
  constructor(){
    this.root = null;
    this.count = 0;
  }
  size(){
    return this.count;
  }
  top(){
    return this.root.value;
  }
  push(value){
    this.root = HeapNode.merge(this.root, new HeapNode(value));
    this.count++;
  }
  pop(){
    if (!this.count)
      return null;
    this.count--;
    let val = this.root.value;
    this.root = HeapNode.merge(this.root.l, this.root.r);
    return val;
  }
}
// max heap
class HeapNode {
  constructor(value, l, r){
    this.value = value;
    this.l = l;
    this.r = r;
  }
  static merge(node1, node2){
    if (!node1)
      return node2;
    if (!node2)
      return node1;
    if (node1.value[0]<node2.value[0])
      return HeapNode.merge(node2, node1);
    return Math.random()>0.5 ?
     new HeapNode(node1.value, node1.l, HeapNode.merge(node1.r, node2)) :
     new HeapNode(node1.value, HeapNode.merge(node1.l, node2), node1.r);
  }
}

const calc = (testN)=>{
  // READING:
  let [n, k] = ra();
  let A = ra();
  LT({n, k, A});
  // PROCESSING:
  let sorted = [];
  let sum = 0;
  for (let i=0; i<n; i++){
    sorted.push(A[i]-n+i+1);
    sum += A[i]
  }
  sorted.sort((a, b)=>b-a);
  let cnt = 0;
  for (let i=0; i<k; i++){
    sum -= sorted[i]+cnt;
    cnt++;
  }
  return sum;
};

'use strict';
// HEADER:
const print = function(arg){
  let str = arg;
  if (arguments.length>1)
    str = Array.prototype.slice.call(arguments).join(' ');
  process.stdout.write(str+'\n');
};
let IS_MULTITEST, testN, tests;
const pcalc = (testN, toPrint)=>{
  let res = calc(testN);
  if (Array.isArray(res)){
    toPrint.push(res.join(' '));
  } else if (Number.isFinite(res) || typeof res=='string'){
    toPrint.push(res+'');
  }
  if (process.env.DEBUG && toPrint.length){
    let ans = toPrint.pop();
    print(ans);
    let expected = tests[testN-1];
    if (expected){
      if (expected==ans)
        console.log('\x1b[32m%s\x1b[0m', 'correct');
      else {
        console.log('\x1b[31m%s\x1b[0m', 'wrong, expected:', expected);
      }
    }
  }
};

const main = ()=>{
  let toPrint = [];
  L('\nSolving:');
  if (IS_MULTITEST){
    let T = +readline()
    for (testN=1; testN<=T; testN++)
      pcalc(testN, toPrint);
  } else {
    pcalc(1, toPrint);
  }
  if (toPrint.length){
    print(toPrint.join('\n'));
  }
};

const lines = [];
const rl = require('readline').createInterface({
   input: process.stdin, output: process.stdout});
rl.on('line', line=>{
  lines.push(line);
});
rl.on('close', main);
let rli = 0;
const readline = ()=>lines[rli++];
const L = process.env.DEBUG ? console.log : ()=>{};
const LT = obj=>L(`\nTest #${testN}`, obj);

const ra = ()=>readline().split(' ').map(a=>+a)
const pa = arr=>print(arr.join(' '));

tests = [
``, // Test #1
``, // Test #2
``, // Test #3
``, // Test #4
``, // Test #5
];

// SOLUTION:
IS_MULTITEST = true;

class Heap {
  constructor(){
    this.root = null;
    this.count = 0;
  }
  size(){
    return this.count;
  }
  top(){
    return this.root.value;
  }
  push(value){
    this.root = HeapNode.merge(this.root, new HeapNode(value));
    this.count++;
  }
  pop(){
    if (!this.count)
      return null;
    this.count--;
    let val = this.root.value;
    this.root = HeapNode.merge(this.root.l, this.root.r);
    return val;
  }
}
// max heap
class HeapNode {
  constructor(value, l, r){
    this.value = value;
    this.l = l;
    this.r = r;
  }
  static merge(node1, node2){
    if (!node1)
      return node2;
    if (!node2)
      return node1;
    if (node1.value[0]<node2.value[0])
      return HeapNode.merge(node2, node1);
    return Math.random()>0.5 ?
     new HeapNode(node1.value, node1.l, HeapNode.merge(node1.r, node2)) :
     new HeapNode(node1.value, HeapNode.merge(node1.l, node2), node1.r);
  }
}

const calc = (testN)=>{
  // READING:
  let [n, k] = ra();
  let A = ra();
  LT({n, k, A});
  // PROCESSING:
  let heap = new Heap();
  let sum = 0;
  for (let i=0; i<n; i++){
    heap.push([A[i]-n+i+1, A[i], i]);
    sum += A[i]
  }
  let cnt = 0;
  for (let i=0; i<k; i++){
    if (heap.top()[0]+cnt>=0){
      L(heap.top())
      sum -= heap.pop()[0]+cnt;
      cnt++;
    }
  }
  return sum;
};

'use strict';

var readline = require('readline');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);

function solve(n, m, nums) {
  if (m === n) return 0;
  let dp = [];
  for (let i = 0; i < n; i++) {
    dp[i] = [nums[i] - (n - i - 1), i];
  }
  dp.sort((a, b) => a[0] !== b[0] ? b[0] - a[0] : b[1] - a[1]);
  let dels = new Set(dp.slice(0, m).map(a => a[1]));
  let res = 0;
  {
    let count = 0;
    for (let i = n - 1; i >= 0; i--) {
      if (dels.has(i)) {
        if (count) {
          res += count;
        }
      } else {
        res += nums[i];
        count++;
      }
    }
  }
  return res;
}

async function main(read) {
  let t = Number(await read());
  let res = [];
  while (t--) {
    const [n, m] = (await read()).split(' ').map(Number);
    const a = (await read()).split(' ').map(Number);
    res.push(solve(n, m, a));
  }
  console.log(res.join('\n'));
}

const rl = readline__default["default"].createInterface({
  input: process.stdin,
  output: process.stdout
});
void async function () {
  const inputs = [];
  let i = 0;
  for await (const line of rl) {
    inputs.push(line.trim());
  }
  function read() {
    return inputs[i++];
  }
  await main(read);
}();

const lines = [];
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });
rl.on('line', line => lines.push(line));
rl.on('close', main);
let rli = 0;
function readline() {
    return lines[rli++];
}

const ra = ()=>readline().split(' ').map(a=>+a);

/*---------------------------------------------------*/

function div(val, by){
    return (val - val % by) / by;
}

const calc = ()=>{
    /* read */
    let [n, k] = ra();
    let a = ra();
    let b = new Array(n);

    for (let i = 0; i < n; i++) {
        b[i] = [-a[i] + (n - i), i];
    }

    b.sort(([x0, x1], [y0, y1]) => x0 - y0);

    // console.log('DEBUG b', b);

    let s = new Set();
    for (let i = 0; i < k; i++) {
        let [val, idx] = b[i];
        s.add(idx);
    }

    // console.log('DEBUG s', s);

    let result = 0;
    let acc = 0;

    for (let i = 0; i < n; i++) {
        if (s.has(i)) {
            acc++;
        } else {
            result += a[i] + acc;
        }
    }

    return result;
};

function main() {
    let T = +readline();
    let out = [];
    for (let t = 1; t <= T; t++){
        out.push(calc());
        // process.stdout.write(`${calc(n, a)}\n`);
    }
    process.stdout.write(out.join('\n')+'\n');
}

'use strict';

var readline = require('readline');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);

function solve(n, m, nums) {
  if (m === n) return 0;
  const segTree = new SegTree(n);
  for (let i = 0; i < n; i++) {
    segTree.update(i, i, nums[i]);
  }
  let i = n - 1,
      dels = new Set();
  while (m--) {
    const top = segTree.root.maxi;
    while (dels.has(i)) i--;
    if (nums[top] - 1 > nums[i]) {
      segTree.update(top, top, -1);
      segTree.update(top + 1, n - 1, 1);
      dels.add(top);
    } else {
      segTree.update(i, i, -1);
      i--;
    }
  }
  return segTree.root.val;
}
class SegTree {
  constructor(n) {
    this.n = n;
    this.root = this._newNode();
    this.update = (x, y, z) => {
      x = Math.max(x, 0);
      y = Math.min(y, n);
      this._update(this.root, 0, n, x, y, z);
    };
  }
  _newNode(val = 0, left = null, right = null) {
    return {
      val,
      left,
      right,
      add: 0,
      maxi: -1,
      count: 0,
      max: 0
    };
  }
  _down(node, l, r) {
    const {
      left,
      right
    } = node;
    if (!left || !right) return;
    const mid = l + r >> 1;
    left.add += node.add;
    left.val += node.add * (mid - l + 1 - left.count);
    right.add += node.add;
    right.val += node.add * (r - mid - right.count);
    node.add = 0;
  }
  _up(node) {
    const {
      left,
      right
    } = node;
    if (!left || !right) return;
    if (left.max > right.max) {
      node.max = left.max;
      node.maxi = left.maxi;
    } else {
      node.max = right.max;
      node.maxi = right.maxi;
    }
    node.val = left.val + right.val;
    node.count = left.count + right.count;
  }
  _update(node, l, r, x, y, z) {
    if (!node) return;
    if (l === x && r === y) {
      if (z === -1) {
        node.add = 0;
        node.val = 0;
        node.max = -1;
        node.maxi = -1;
        node.count = 1;
      } else {
        node.add += z;
        node.val += z * (r - l + 1 - node.count);
        node.max += z;
        if (l === r) node.maxi = l;
      }
      return;
    }
    const mid = Math.floor((l + r) / 2);
    if (!node.left) {
      node.left = this._newNode();
      node.right = this._newNode();
    }
    this._down(node, l, r);
    if (y <= mid) this._update(node.left, l, mid, x, y, z);else if (x > mid) this._update(node.right, mid + 1, r, x, y, z);else this._update(node.left, l, mid, x, mid, z), this._update(node.right, mid + 1, r, mid + 1, y, z);
    this._up(node);
  }
}

async function main(read) {
  let t = Number(await read());
  let res = [];
  while (t--) {
    const [n, m] = (await read()).split(' ').map(Number);
    const a = (await read()).split(' ').map(Number);
    res.push(solve(n, m, a));
  }
  console.log(res.join('\n'));
}

const rl = readline__default["default"].createInterface({
  input: process.stdin,
  output: process.stdout
});
void async function () {
  const inputs = [];
  let i = 0;
  for await (const line of rl) {
    inputs.push(line.trim());
  }
  function read() {
    return inputs[i++];
  }
  await main(read);
}();

'use strict';

var readline = require('readline');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);

function solve(n, m, nums) {
  if (m === n) return 0;
  const segTree = new SegTree(n);
  for (let i = 0; i < n; i++) {
    segTree.update(i, i, nums[i]);
  }
  let i = n - 1,
      dels = new Set();
  while (m--) {
    const top = segTree.root.maxi;
    while (dels.has(i)) i--;
    if (nums[top] - 1 > nums[i]) {
      segTree.update(top, top, -Infinity);
      segTree.update(top + 1, n, 1);
      dels.add(top);
    } else {
      segTree.update(i, i, -Infinity);
      i--;
    }
  }
  while (dels.has(i)) i--;
  let res = 0;
  for (let j = 0; j <= i; j++) {
    if (dels.has(j)) continue;
    res += segTree.query(j, j);
  }
  return res;
}
class SegTree {
  constructor(n) {
    this.n = n;
    this.root = this._newNode();
    this.update = (x, y, z) => {
      x = Math.max(x, 0);
      y = Math.min(y, n);
      this._update(this.root, 0, n, x, y, z);
    };
    this.query = (x, y) => {
      x = Math.max(x, 0);
      y = Math.min(y, n);
      return this._query(this.root, 0, n, x, y);
    };
  }
  _newNode(val = 0, left = null, right = null) {
    return {
      val,
      left,
      right,
      add: 0,
      maxi: -1
    };
  }
  _down(node, l, r) {
    const {
      left,
      right
    } = node;
    if (!left || !right) return;
    left.add += node.add;
    left.val += node.add;
    right.add += node.add;
    right.val += node.add;
    node.add = 0;
  }
  _up(node) {
    const {
      left,
      right
    } = node;
    if (!left || !right) return;
    if (left.val > right.val) {
      node.val = left.val;
      node.maxi = left.maxi;
    } else {
      node.val = right.val;
      node.maxi = right.maxi;
    }
  }
  _update(node, l, r, x, y, z) {
    if (!node) return;
    if (l === x && r === y) {
      node.add += z;
      node.val += z;
      if (l === r) node.maxi = l;
      return;
    }
    const mid = Math.floor((l + r) / 2);
    if (!node.left) {
      node.left = this._newNode();
      node.right = this._newNode();
    }
    this._down(node, l, r);
    if (y <= mid) this._update(node.left, l, mid, x, y, z);else if (x > mid) this._update(node.right, mid + 1, r, x, y, z);else this._update(node.left, l, mid, x, mid, z), this._update(node.right, mid + 1, r, mid + 1, y, z);
    this._up(node);
  }
  _query(node, l, r, x, y) {
    if (y < x) return 0;
    if (!node) return 0;
    if (l === x && r === y) return node.val;
    let res = 0,
        mid = Math.floor((l + r) / 2);
    if (!node.left) {
      node.left = this._newNode();
      node.right = this._newNode();
    }
    this._down(node, l, r);
    if (y <= mid) res = this._query(node.left, l, mid, x, y);else if (x > mid) res = this._query(node.right, mid + 1, r, x, y);else res = this._query(node.left, l, mid, x, mid) + this._query(node.right, mid + 1, r, mid + 1, y);
    this._up(node);
    return res;
  }
}

async function main(read) {
  let t = Number(await read());
  let res = [];
  while (t--) {
    const [n, m] = (await read()).split(' ').map(Number);
    const a = (await read()).split(' ').map(Number);
    res.push(solve(n, m, a));
  }
  console.log(res.join('\n'));
}

const rl = readline__default["default"].createInterface({
  input: process.stdin,
  output: process.stdout
});
void async function () {
  const inputs = [];
  let i = 0;
  for await (const line of rl) {
    inputs.push(line.trim());
  }
  function read() {
    return inputs[i++];
  }
  await main(read);
}();

'use strict';
// HEADER:
const print = function(arg){
  let str = arg;
  if (arguments.length>1)
    str = Array.prototype.slice.call(arguments).join(' ');
  process.stdout.write(str+'\n');
};
let IS_MULTITEST, testN, tests;
const pcalc = (testN, toPrint)=>{
  let res = calc(testN);
  if (Array.isArray(res)){
    toPrint.push(res.join(' '));
  } else if (Number.isFinite(res) || typeof res=='string'){
    toPrint.push(res+'');
  }
  if (process.env.DEBUG && toPrint.length){
    let ans = toPrint.pop();
    print(ans);
    let expected = tests[testN-1];
    if (expected){
      if (expected==ans)
        console.log('\x1b[32m%s\x1b[0m', 'correct');
      else {
        console.log('\x1b[31m%s\x1b[0m', 'wrong, expected:', expected);
      }
    }
  }
};

const main = ()=>{
  let toPrint = [];
  L('\nSolving:');
  if (IS_MULTITEST){
    let T = +readline()
    for (testN=1; testN<=T; testN++)
      pcalc(testN, toPrint);
  } else {
    pcalc(1, toPrint);
  }
  if (toPrint.length){
    print(toPrint.join('\n'));
  }
};

const lines = [];
const rl = require('readline').createInterface({
   input: process.stdin, output: process.stdout});
rl.on('line', line=>{
  lines.push(line);
});
rl.on('close', main);
let rli = 0;
const readline = ()=>lines[rli++];
const L = process.env.DEBUG ? console.log : ()=>{};
const LT = obj=>L(`\nTest #${testN}`, obj);

const ra = ()=>readline().split(' ').map(a=>+a)
const pa = arr=>print(arr.join(' '));

tests = [
``, // Test #1
``, // Test #2
``, // Test #3
``, // Test #4
``, // Test #5
];

// SOLUTION:
IS_MULTITEST = true;

class Heap {
  constructor(){
    this.root = null;
    this.count = 0;
  }
  size(){
    return this.count;
  }
  top(){
    return this.root.value;
  }
  push(value){
    this.root = HeapNode.merge(this.root, new HeapNode(value));
    this.count++;
  }
  pop(){
    if (!this.count)
      return null;
    this.count--;
    let val = this.root.value;
    this.root = HeapNode.merge(this.root.l, this.root.r);
    return val;
  }
}
// max heap
class HeapNode {
  constructor(value, l, r){
    this.value = value;
    this.l = l;
    this.r = r;
  }
  static merge(node1, node2){
    if (!node1)
      return node2;
    if (!node2)
      return node1;
    if (node1.value>node2.value)
      return HeapNode.merge(node2, node1);
    return Math.random()>0.5 ?
     new HeapNode(node1.value, node1.l, HeapNode.merge(node1.r, node2)) :
     new HeapNode(node1.value, HeapNode.merge(node1.l, node2), node1.r);
  }
}

const calc = (testN)=>{
  // READING:
  let [n, k] = ra();
  let A = ra();
  LT({n, k, A});
  // PROCESSING:
  let sum = 0;
  for (let i=0; i<n; i++){
    sum += A[i]
  }
  let heap = new Heap();
  let curSum = sum;
  for (let i=0; i<k; i++){
    let num = A[n-i-1]+k-i-1;
    heap.push(num);
    curSum -= A[n-i-1];
  }
  for (let i = n-k-1; i>=0; i--){
    let top = heap.top();
    let newSum = curSum - A[i] + (n-i-k) + top;
    if (newSum<curSum){
      curSum = newSum;
      heap.pop();
      heap.push(A[i]+(n-i));
    }
  }
  return curSum;
};


process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', () => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function main() {
    // console.log("typeof inputString", typeof inputString)
    //console.log("inputString", inputString)
    // const getDict = str => str.split("").reduce((dict, char) => {
    //     dict[char] = dict[char] ? dict[char] + 1 : 1;

    //     return dict;
    // }, {});

    const tests = inputString.slice(1).map(testStr => testStr.split(" ").map(Number));
    //console.log("tests", tests)

    const getOccurrencesDict = arr => {
        const dict = arr.reduce((acc, n) => {
            const remainder = n % 2;
            acc[remainder] = (acc[remainder] || 0 ) + 1;

            return acc;
        }, {});

        dict[0] = dict[0] || 0;
        dict[1] = dict[1] || 0;
        return dict;
    }

    for (let i = 0; i < tests.length; i+=2) {
        //console.log("i", i/2)
        const [length, countToSelect] = tests[i];
        const arr = tests[i + 1];

        const dict = getOccurrencesDict(arr);

        // if (i/2 === 4) {
        //     console.log("length", length);
        //     console.log("countToSelect", countToSelect);
        //     console.log("arr", arr);
        //     console.log("dict", dict)
        // }

        //console.log("dict", dict)

        if (length === countToSelect) {
            console.log(dict[1] % 2 ? "Yes" : "No");
            continue;
        } else {
            //console.log("dict", dict);
            let foundSuitableCount = false;
            if (dict[0]) {
                for (let oddCount = 1; oddCount <= dict[1]; oddCount+=2) {
                    const evenCount = countToSelect - oddCount;
                    if (dict[0] >= evenCount && dict[1] >= oddCount) {
                        foundSuitableCount = true;
                        break;
                    }
                }
                console.log(foundSuitableCount ? "Yes" : "No");
            } else {
                console.log(countToSelect % 2 ? "Yes" : "No")
            }
        }
    }

    // tests.forEach(test => {

    // })
}

'use strict';
// node.js
process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    var testCases = parseInt(readLine());

    for (var i = 0; i < testCases; i++) {
        var x = readLine()
            .split(" ")
            .map(num => parseInt(num))[1];

        var numberOfEven = 0;
        var numberOfOdd = 0;

        readLine()
            .split(" ")
            .map(num => {
                if (parseInt(num) % 2) numberOfOdd++;
                else numberOfEven++;
            });

        if (!numberOfOdd) console.log("NO");
        else if (x - 1 <= numberOfEven || (x - numberOfEven) % 2) console.log("Yes");
        else if (numberOfEven && (x - numberOfEven) < numberOfOdd) console.log("Yes");
        else console.log("NO");
    }
}

'use strict';

let inputFromTerminal = ''
process.stdin.on('data', c => inputFromTerminal += c)
process.stdin.on('end', () => {
    const { EOL } = require('os')
    const lines = inputFromTerminal.split(EOL)

    let t = Number(lines[0])
    for (let i = 1; i <= 2 * t; i += 2) {
        let currentLine = lines[i].split(' ')
        let n = Number(currentLine[0])
        let x = Number(currentLine[1])
        let array = lines[i + 1].split(' ').map(value => Number(value))
        let result = firs(n, x, array)
        if (result) {
            console.log("Yes")
        } else {
            console.log("No")
        }
    }
})

function firs(n, x, mas) {
    let countEven;
    let countOdd = 0;
    for (let i = 0; i < n; i++) {
        if (mas[i] % 2 > 0) {
            countOdd++
        }
    }
    countEven = n - countOdd
    if (countOdd === 0) {
        return false
    }
    let oddToTake;
    if (x < countOdd) {
        oddToTake = x
    } else {
        oddToTake = countOdd
    }

    if (oddToTake % 2 === 0) {
        oddToTake--
    }

    return x - oddToTake <= countEven;
}

"use strict";

var cases =parseInt(readline());

while(cases --){

	var read =readline().split(" ");
	var arr =readline().split(" ");

	var n =parseInt(read[0]) , x =parseInt(read[1]);

	var odd =0 , even =0;
	var need =0;

	for(var i =0 ; i <n ; i ++){

		if(parseInt(arr[i]) &1) odd ++;
		else even ++;

	}

	if(!odd || x >n) print("No");
	else{
		if(odd &1) need =odd;
		else need =odd -1;
		if(even +1 >=x) print("Yes");
		else if(need >=x && x &1) print("Yes");
		else if(need && even && even +need >=x) print("Yes");
		else print("No");
	}

}

"use strict";

var cases =parseInt(readline());

while(cases --){

	var read =readline().split(" ").map(val => parseInt(val));
	var arr =readline().split(" ").map(val => parseInt(val));

	var n =read[0] , x =read[1];

	var odd =0 , even =0;
	var need =0;

	for(var i =0 ; i <n ; i ++){

		if(arr[i] &1) odd ++;
		else even ++;

	}

	if(!odd || x >n) print("No");
	else{
		if(odd &1) need =odd;
		else need =odd -1;
		if(even +1 >=x) print("Yes");
		else if(need >=x && x &1) print("Yes");
		else if(need && even && even +need >=x) print("Yes");
		else print("No");
	}

}

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var input = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var n = input[0],
    x = input[1];
  var odd = [],
    even = [];
  var arr = readline()
    .split(" ")
    .forEach((val) => {
      if (parseInt(val) % 2 == 0) even.push(parseInt(val));
      if (parseInt(val) % 2 != 0) odd.push(parseInt(val));
    });
  var found = false;
  if (even.length == 0 && x % 2 != 0) print("Yes");
  else if (odd.length == 0) print("No");
  else {
    for (var i = 1; i <= odd.length && x - i >= 0; i += 2) {
      if (x - i <= even.length) {
        print("Yes");
        found = true;
        break;
      }
    }
    if (!found) print("No");
  }
}

function readStringArray() {
  return readline().split(" ");
}
function readNumArray() {
  return readStringArray().map(Number);
}

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var nx = readNumArray();
    var n = nx[0];
    var x = nx[1];
    var arr = readNumArray();

    var odds = 0;
    var evens = 0;
    for (var j = 0; j < n; j++) {
      if (arr[j] % 2) {
        odds++;
      } else {
        evens++;
      }
    }
    if (!odds) {
      print("NO");
      continue;
    }
    if (!evens && x % 2 === 0) {
      print("NO");
      continue;
    }
    if (odds % 2 === 0 && x === n) {
      print("NO");
      continue;
    }
    print("YES");
    continue;
  }
}

main();

var num = parseInt(readline());
for (var tc = 0; tc < num; tc++) {
	var n_x = readline().split(" ").map(number => parseInt(number));
	var n = n_x[0];
	var x = n_x[1];
	var even = 0, odd = 0;
	var nums = readline().split(" ").map(number => parseInt(number));
	for (var i=0; i<nums.length; i++) {
		if (nums[i]%2 == 0) {
			even += 1;
		}
		else { odd += 1; }
	}
	var min_odds = even>x?0:x-even;
	var max_odds = Math.min(x, odd);
	/* pick x integers */
	if ((min_odds === max_odds) && (min_odds%2 === 0)) {
		print("nO");
	}
	else {
		print("yes");
	}
}

//↓見なくていいよ！ここから--------------------------------------------------
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);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
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){
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
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;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var t = nextInt();
	var output = new Array(t);
	for(var i = 0; i < t; i++){
		var one = nextIntArray();
		var n = one[0];
		var x = one[1];
		var list = nextIntArray();
		var odd = 0;
		var even = 0;
		for(var j = 0; j < n; j++){
			if(list[j] % 2 == 0){
				even++;
			}else{
				odd++;
			}
		}
		if(odd > 0){
			//奇数のものを先に奇数個選んでおく
			var tmp = Math.min(odd, x);
			if(tmp % 2 == 0){
				tmp--;
			}
			x -= tmp;
			if(even >= x){
				//奇数1個、他全部偶数。奇数1個あれば偶数いくらあっても奇数になる
				output[i] = "Yes";
			}else{
				//奇数1個、選べるだけ偶数、残りは必ず奇数。
				//選ぶ個数が奇数個ならNO(合計が偶数になる)
				x -= even;
				if(x % 2 == 0){
					output[i] = "Yes";
				}else{
					output[i] = "No";
				}
			}
		}else{
			//奇数がない
			output[i] = "No";
		}
	}
	myout(myconv(output,9));
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split('\n');
  const testCases = data.shift() * 2;
  for (let i = 0; i < testCases; i += 2) {
    let numEle = data[i].split(' ')[1] * 1;
    let odd = 0;
    let even = 0;
    let arr = data[i + 1].split(' ');
    for (let j = 0; j < arr.length; j += 1) {
       if (arr[j] % 2 ===0) even += 1;
       else odd += 1;
    }
    if (!odd) console.log('No');
    else if (!even && numEle % 2 === 0) console.log('No');
    else if (odd % 2 === 0 && numEle === arr.length) console.log('No');
    else console.log('Yes');
    // const half = Math.ceil(numEle / 2);
    // if (numEle === 1) (obj.odd >= 1) ? console.log('Yes') : console.log('No');
    // else if (numEle == 2) (obj.odd >= half && obj.even >= half) ? console.log('Yes') : console.log('No');
    // else if (numEle % 2 === 0) ((obj.odd >= half - 1 && obj.even >= half + 1) || (obj.odd >= half + 1 && obj.even >= half - 1)) ? console.log('Yes') : console.log('No');
    // else {
    //   if (obj.odd >= numEle) console.log('Yes');
    //   else if (half % 2 === 0) (obj.odd >= half - 1 && obj.even >= half) ? console.log('Yes') : console.log('No');
    //   else (obj.odd >= half && obj.even >= half - 1) ? console.log('Yes') : console.log('No');
    // }
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split('\n');
  const testCases = data.shift() * 2;
  for (let i = 0; i < testCases; i += 2) {
    let numEle = data[i].split(' ')[1] * 1;
    let odd = 0;
    let even = 0;
    let arr = data[i + 1].split(' ');
    for (let j = 0; j < arr.length; j += 1) {
       if (arr[j] % 2 === 0) even += 1;
       else odd += 1;
    }
    if (!odd) console.log('No');
    else if (!even && ((numEle & 1) === 0)) console.log('No');
    else if ((odd & 1) === 0 && numEle === arr.length) console.log('No');
    else console.log('Yes');
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split('\n');
  const testCases = data.shift() * 2;
  for (let i = 0; i < testCases; i += 2) {
    let numEle = data[i].split(' ')[1] * 1;
    let obj = {odd: 0, even: 0};
    let arr = data[i + 1].split(' ');
    for (let j = 0; j < arr.length; j += 1) {
       if (arr[j] % 2 ===0) obj.even += 1;
       else obj.odd += 1;
    }
    if (!obj.odd) console.log('No');
    else if (!obj.even && numEle % 2 === 0) console.log('No');
    else if (obj.odd % 2 === 0 && numEle === arr.length) console.log('No');
    else console.log('Yes');
    // const half = Math.ceil(numEle / 2);
    // if (numEle === 1) (obj.odd >= 1) ? console.log('Yes') : console.log('No');
    // else if (numEle == 2) (obj.odd >= half && obj.even >= half) ? console.log('Yes') : console.log('No');
    // else if (numEle % 2 === 0) ((obj.odd >= half - 1 && obj.even >= half + 1) || (obj.odd >= half + 1 && obj.even >= half - 1)) ? console.log('Yes') : console.log('No');
    // else {
    //   if (obj.odd >= numEle) console.log('Yes');
    //   else if (half % 2 === 0) (obj.odd >= half - 1 && obj.even >= half) ? console.log('Yes') : console.log('No');
    //   else (obj.odd >= half && obj.even >= half - 1) ? console.log('Yes') : console.log('No');
    // }
  }
}

"use strict";

var cases =parseInt(readline());

while(cases --){

	var read =readline().split(" ").map(val =>parseInt(val));
	var arr =readline().split(" ").map(val =>parseInt(val));

	var n =read[0] , x =read[1];

	var odd =0 , even =0;
	var need =0;

	for(var i =0 ; i <n ; i ++){

		if(arr[i] &1) odd ++;
		else even ++;

	}

	if(!odd || x >n) print("No");
	else{

		if(even +1 >=x) print("Yes");
		else if(odd -1 >=x) print("Yes");
		else print("No");
	}

}

"use strict";

var cases =parseInt(readline());

while(cases --){

	var read =readline().split(" ").map(val => parseInt(val));
	var arr =readline().split(" ").map(val => parseInt(val));

	var n =read[0] , x =read[1];

	var odd =0 , even =0;
	var need =0;

	for(var i =0 ; i <n ; i ++){

		if(arr[i] &1) odd ++;
		else even ++;

	}

	if(!odd || x >n) print("No");
	else{
		if(odd &1) need =odd;
		else need =odd -1;
		if(even +1 >=x) print("Yes");
		else if(need >=x) print("Yes");
		else if(even +need >=x) print("Yes");
		else print("No");
	}

}

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var input = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var n = input[0],
    x = input[1];
  var odd = [],
    even = [];
  var arr = readline()
    .split(" ")
    .forEach((val) => {
      if (parseInt(val) % 2 == 0) even.push(parseInt(val));
      if (parseInt(val) % 2 != 0) odd.push(parseInt(val));
    });
  var found = false;
  if (even.length == 0 && x % 2 != 0) print("Yes");
  else if (odd.length == 0) print("No");
  else {
    for (var i = 1; i <= odd.length; i += 2) {
      if (x - i <= even.length) {
        print("Yes");
        found = true;
        break;
      }
    }
    if (!found) print("No");
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', () => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function main() {
    // console.log("typeof inputString", typeof inputString)
    //console.log("inputString", inputString)
    // const getDict = str => str.split("").reduce((dict, char) => {
    //     dict[char] = dict[char] ? dict[char] + 1 : 1;

    //     return dict;
    // }, {});

    const tests = inputString.slice(1).map(testStr => testStr.split(" ").map(Number));
    //console.log("tests", tests)

    const getOccurrencesDict = arr => {
        const dict = arr.reduce((acc, n) => {
            const remainder = n % 2;
            acc[remainder] = (acc[remainder] || 0 ) + 1;

            return acc;
        }, {});

        dict[0] = dict[0] || 0;
        dict[1] = dict[1] || 0;
        return dict;
    }

    for (let i = 0; i < tests.length; i+=2) {
        //console.log("i", i/2)
        const [length, countToSelect] = tests[i];
        const arr = tests[i + 1];

        const dict = getOccurrencesDict(arr);

        // if (i/2 === 18) {
        //     console.log("length", length);
        //     console.log("countToSelect", countToSelect);
        //     console.log("arr", arr);
        //     console.log("dict", dict)
        // }

        //console.log("dict", dict)

        if (length === countToSelect) {
            console.log(dict[1] % 2 ? "Yes" : "No");
            continue;
        } else {
            //console.log("dict", dict);
            let foundSuitableCount = false;
            for (let oddCount = 1; oddCount <= dict[1]; oddCount+=2) {
                const evenCount = countToSelect - oddCount;
                if (dict[0] >= evenCount && dict[1] >= oddCount) {
                    foundSuitableCount = true;
                    break;
                }
            }
            console.log(foundSuitableCount ? "Yes" : "No");
        }
    }

    // tests.forEach(test => {

    // })
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', () => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function main() {
    // console.log("typeof inputString", typeof inputString)
    //console.log("inputString", inputString)
    // const getDict = str => str.split("").reduce((dict, char) => {
    //     dict[char] = dict[char] ? dict[char] + 1 : 1;

    //     return dict;
    // }, {});

    const tests = inputString.slice(1).map(testStr => testStr.split(" ").map(Number));
    //console.log("tests", tests)

    const getOccurrencesDict = arr => {
        return arr.reduce((acc, n) => {
            const remainder = n % 2;
            acc[remainder] = (acc[remainder] || 0 ) + 1;

            return acc;
        }, {});
    }

    for (let i = 0; i < tests.length; i+=2) {
        const [length, countToSelect] = tests[i];
        const arr = tests[i + 1];

        const dict = getOccurrencesDict(arr);

        //console.log("dict", dict)

        if (length === countToSelect) {
            console.log(dict[1] % 2 ? "Yes" : "No");
            continue;
        } else {
            //console.log("dict", dict);
            let foundSuitableCount = false;
            for (let oddCount = 1; oddCount <= dict[1]; oddCount+=2) {
                const evenCount = countToSelect - oddCount;
                if (dict[0] >= evenCount && dict[1] >= oddCount) {
                    foundSuitableCount = true;
                    break;
                }
            }
            console.log(foundSuitableCount ? "Yes" : "No");
        }
    }
}

//↓見なくていいよ！ここから--------------------------------------------------
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);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
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){
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
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;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var t = nextInt();
	var output = new Array(t);
	for(var i = 0; i < t; i++){
		var one = nextIntArray();
		var n = one[0];
		var x = one[1];
		var list = nextIntArray();
		var odd = 0;
		var even = 0;
		for(var j = 0; j < n; j++){
			if(list[j] % 2 == 0){
				even++;
			}else{
				odd++;
			}
		}
		if(odd > 0){
			x--;
			odd--;
			if(even >= x){
				output[i] = "Yes";
			}else{
				x -= even;
				if(odd % 2 == 0){
					output[i] = "Yes";
				}else{
					output[i] = "No";
				}
			}
		}else{
			output[i] = "No";
		}
	}
	myout(myconv(output,9));
}

//↓見なくていいよ！ここから--------------------------------------------------
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);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
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){
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
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;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var t = nextInt();
	var output = new Array(t);
	for(var i = 0; i < t; i++){
		var one = nextIntArray();
		var n = one[0];
		var x = one[1];
		var list = nextIntArray();
		var odd = 0;
		var even = 0;
		for(var j = 0; j < n; j++){
			if(list[j] % 2 == 0){
				even++;
			}else{
				odd++;
			}
		}
		if(odd > 0){
			x--;
			odd--;
			if(even >= x){
				output[i] = "Yes";
			}else{
				x -= even;
				if(odd > 0 && odd % 2 == 0){
					output[i] = "Yes";
				}else{
					output[i] = "No";
				}
			}
		}else{
			output[i] = "No";
		}
	}
	myout(myconv(output,9));
}

//↓見なくていいよ！ここから--------------------------------------------------
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);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
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){
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
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;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var t = nextInt();
	var output = new Array(t);
	for(var i = 0; i < t; i++){
		var one = nextIntArray();
		var n = one[0];
		var x = one[1];
		var list = nextIntArray();
		var odd = 0;
		var even = 0;
		for(var j = 0; j < n; j++){
			if(list[j] % 2 == 0){
				even++;
			}else{
				odd++;
			}
		}
		if(odd > 0){
			//奇数のものを先に1個選んでおく
			x--;
			odd--;
			if(even >= x){
				//奇数1個、他全部偶数
				output[i] = "Yes";
			}else{
				//奇数1個、選べるだけ偶数、残りは必ず奇数。
				x -= even;
				if(x % 2 == 0){
					output[i] = "Yes";
				}else{
					output[i] = "No";
				}
			}
		}else{
			//奇数がない
			output[i] = "No";
		}
	}
	myout(myconv(output,9));
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split('\n');
  const testCases = data.shift() * 2;
  for (let i = 0; i < testCases; i += 2) {
    let numEle = data[i].split(' ')[1] * 1;
    let obj = {odd: 0, even: 0};
    let arr = data[i + 1].split(' ');
    for (let j = 0; j < arr.length; j += 1) {
       if (arr[j] % 2 ===0) obj.even += 1;
       else obj.odd += 1;
    }
    const half = Math.ceil(numEle / 2);
    if (numEle === 1) (obj.odd >= 1) ? console.log('Yes') : console.log('No');
    else if (numEle == 2) (obj.odd >= half && obj.even >= half) ? console.log('Yes') : console.log('No');
    else if (numEle % 2 === 0) ((obj.odd == half - 1 && obj.even == half + 1) || (obj.odd == half + 1 && obj.even == half - 1)) ? console.log('Yes') : console.log('No');
    else {
      if (obj.odd >= numEle) console.log('Yes');
      else if (half % 2 === 0) (obj.odd >= half - 1 && obj.even >= half) ? console.log('Yes') : console.log('No');
      else (obj.odd >= half && obj.even >= half - 1) ? console.log('Yes') : console.log('No');
    }
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split('\n');
  const testCases = data.shift() * 2;
  for (let i = 0; i < testCases; i += 2) {
    let numEle = data[i].split(' ')[1] * 1;
    let obj = {odd: 0, even: 0};
    let arr = data[i + 1].split(' ');
    for (let j = 0; j < arr.length; j += 1) {
       if (arr[j] % 2 ===0) obj.even += 1;
       else obj.odd += 1;
    }
    const half = Math.ceil(numEle / 2);
    if (numEle === 1) (obj.odd >= 1) ? console.log('Yes') : console.log('No');
    else if (numEle == 2) (obj.odd >= half && obj.even >= half) ? console.log('Yes') : console.log('No');
    else if (numEle % 2 === 0) ((obj.odd >= half - 1 && obj.even >= half + 1) || (obj.odd >= half + 1 && obj.even >= half - 1)) ? console.log('Yes') : console.log('No');
    else {
      if (obj.odd >= numEle) console.log('Yes');
      else if (half % 2 === 0) (obj.odd >= half - 1 && obj.even >= half) ? console.log('Yes') : console.log('No');
      else (obj.odd >= half && obj.even >= half - 1) ? console.log('Yes') : console.log('No');
    }
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split('\n');
  const testCases = data.shift() * 2;
  for (let i = 0; i < testCases; i += 2) {
    let numEle = data[i].split(' ')[1] * 1;
    let odd = 0;
    let even = 0;
    let arr = data[i + 1].split(' ');
    for (let j = 0; j < arr.length; j += 1) {
       if ((arr[j] & 1) === 0) even += 1;
       else odd += 1;
    }
    if (!odd) console.log('No');
    else if (!even && (numEle & 1 === 0)) console.log('No');
    else if ((odd & 1) === 0 && numEle === arr.length) console.log('No');
    else console.log('Yes');
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split('\n');
  const testCases = data.shift() * 2;
  for (let i = 0; i < testCases; i += 2) {
    let numEle = data[i].split(' ')[1] * 1;
    let obj = {odd: 0, even: 0};
    let arr = data[i + 1].split(' ');
    for (let j = 0; j < arr.length; j += 1) {
       if (arr[j] % 2 ===0) obj.even += 1;
       else obj.odd += 1;
    }
    const half = Math.floor(numEle / 2);
    if (numEle === 1) {
      if (obj.odd >= 1) console.log('Yes');
      else console.log('No');
    } else if (numEle % 2 === 0) {
      if (obj.odd >= half && obj.even >= half) console.log('Yes');
      else console.log('No');
    } else {
      if (obj.odd >= half && obj.even >= half + 1) console.log('Yes');
      else console.log('No');
    }
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split('\n');
  const testCases = data.shift() * 2;
  for (let i = 0; i < testCases; i += 2) {
    let numEle = data[i].split(' ')[1] * 1;
    let obj = {odd: 0, even: 0};
    let arr = data[i + 1].split(' ');
    for (let j = 0; j < arr.length; j += 1) {
       if (arr[j] % 2 ===0) obj.even += 1;
       else obj.odd += 1;
    }
    const half = Math.ceil(numEle / 2);
    if (numEle === 1) (obj.odd >= 1) ? console.log('Yes') : console.log('No');
    else if (numEle == 2) (obj.odd == half && obj.even == half) ? console.log('Yes') : console.log('No');
    else if (numEle % 2 === 0) ((obj.odd == half - 1 && obj.even == half + 1) || (obj.odd == half + 1 && obj.even == half - 1)) ? console.log('Yes') : console.log('No');
    else {
      if (obj.odd >= numEle) console.log('Yes');
      else if (half % 2 === 0) (obj.odd >= half - 1 && obj.even >= half) ? console.log('Yes') : console.log('No');
      else (obj.odd >= half && obj.even >= half - 1) ? console.log('Yes') : console.log('No');
    }
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split('\n');
  const testCases = data.shift() * 2;
  for (let i = 0; i < testCases; i += 2) {
    let numEle = data[i].split(' ')[1] * 1;
    let odd = 0;
    let even = 0;
    let arr = data[i + 1].split(' ');
    for (let j = 0; j < arr.length; j += 1) {
       if (arr[j] % 2 === 0) even += 1;
       else odd += 1;
    }
    if (!odd) console.log('No');
    else if (!even && numEle & 1 === 0) console.log('No');
    else if (odd & 1 === 0 && numEle === arr.length) console.log('No');
    else console.log('Yes');
    // const half = Math.ceil(numEle / 2);
    // if (numEle === 1) (obj.odd >= 1) ? console.log('Yes') : console.log('No');
    // else if (numEle == 2) (obj.odd >= half && obj.even >= half) ? console.log('Yes') : console.log('No');
    // else if (numEle % 2 === 0) ((obj.odd >= half - 1 && obj.even >= half + 1) || (obj.odd >= half + 1 && obj.even >= half - 1)) ? console.log('Yes') : console.log('No');
    // else {
    //   if (obj.odd >= numEle) console.log('Yes');
    //   else if (half % 2 === 0) (obj.odd >= half - 1 && obj.even >= half) ? console.log('Yes') : console.log('No');
    //   else (obj.odd >= half && obj.even >= half - 1) ? console.log('Yes') : console.log('No');
    // }
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split('\n');
  const testCases = data.shift() * 2;
  for (let i = 0; i < testCases; i += 2) {
    let numEle = data[i].split(' ')[1] * 1;
    let obj = {odd: 0, even: 0};
    let arr = data[i + 1].split(' ');
    for (let j = 0; j < arr.length; j += 1) {
       if (arr[j] % 2 ===0) obj.even += 1;
       else obj.odd += 1;
    }
    const half = Math.ceil(numEle / 2);
    if (numEle === 1) (obj.odd >= 1) ? console.log('Yes') : console.log('No')
    else if (numEle % 2 === 0) (obj.odd >= half && obj.even >= half) ? console.log('Yes') : console.log('No');
    else {
      if (obj.odd >= numEle) console.log('Yes');
      else if (half % 2 === 0) (obj.odd >= half - 1 && obj.even >= half) ? console.log('Yes') : console.log('No');
      else (obj.odd >= half && obj.even >= half - 1) ? console.log('Yes') : console.log('No');
    }
  }
}

'use strict';
// node.js
process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    var testCases = parseInt(readLine());

    for (var i = 0; i < testCases; i++) {
        var x = readLine()
            .split(" ")
            .map(num => parseInt(num))[1];

        var numberOfEven = 0;
        var numberOfOdd = 0;

        readLine()
            .split(" ")
            .map(num => {
                if (parseInt(num) % 2) numberOfOdd++;
                else numberOfEven++;
            });

        if (x - 1 <= numberOfEven && numberOfOdd) console.log("Yes");
        else if ((x - numberOfEven) % 2 == 1) console.log("Yes");
        else console.log("NO");
    }
}

'use strict';
// node.js
process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    var testCases = parseInt(readLine());

    for (var i = 0; i < testCases; i++) {
        var x = readLine()
            .split(" ")
            .map(num => parseInt(num))[1];

        var numberOfEven = 0;
        var numberOfOdd = 0;

        readLine()
            .split(" ")
            .map(num => {
                if (parseInt(num) % 2) numberOfOdd++;
                else numberOfEven++;
            });

        if (x - 1 <= numberOfEven && numberOfOdd) console.log("Yes");
        else if (numberOfOdd >= 1 && (x - (numberOfEven + parseInt((numberOfOdd - 1) / 2))) <= 1) console.log("Yes");
        else console.log("NO");
    }
}

'use strict';

let inputFromTerminal = ''
process.stdin.on('data', c => inputFromTerminal += c)
process.stdin.on('end', () => {
    const { EOL } = require('os')
    const lines = inputFromTerminal.split(EOL)

    let t = Number(lines[0][0])
    for (let i = 1; i <= 2 * t; i += 2) {
        let currentLine = lines[i].split(' ')
        let n = Number(currentLine[0])
        let x = Number(currentLine[1])
        let array = lines[i + 1].split(' ').map(value => Number(value))
        let result = firs(n, x, array)
        if (result) {
            console.log("Yes")
        } else {
            console.log("No")
        }
    }
})

function firs(n, x, mas) {
    let countEven;
    let countOdd = 0;
    for (let i = 0; i < n; i++) {
        if (mas[i] % 2 > 0) {
            countOdd++
        }
    }
    countEven = n - countOdd
    if (countOdd === 0) {
        return false
    }
    let oddToTake;
    if (x < countOdd) {
        oddToTake = x
    } else {
        oddToTake = countOdd
    }

    if (oddToTake % 2 === 0) {
        oddToTake--
    }

    return x - oddToTake <= countEven;
}


'use strict'

const getLine = () => readline().split(' ')
const getInts = () => getLine().map(n => parseInt(n))
const getInt = () => getInts()[0]
const D = (...args) => { // D({name})
  [...args].forEach(cur => print.apply(print, [JSON.stringify(cur)]))
}

main()

function main() {
  const n = getInt()
  const arr = getInts()

  let ans = 0
  let ind = 0
  const dp = {}
  for (let i in arr) {
    if (dp[arr[i] - 1]) {
      dp[arr[i]] = dp[arr[i] - 1] + 1
    } else {
      dp[arr[i]] = 1
    }

    if (ans < dp[arr[i]]) {
      ans = dp[arr[i]]
      ind = i
    }
  }

  let path = []
  let cur = arr[ind]
  while (ind >= 0) {
    if (arr[ind] === cur) {
      path.push(ind)
      cur --
    }
    ind --
  }

  path = path.map((i) => parseInt(i) + 1)
  print(ans)
  print(path.reverse().join(' '))
}

'use strict';

var N = +readline();
var a = readline().split(' ').map(function(x){return +x;});
// print(N);
// print(a);

function main() {
    var d = {};
    var best = {
        len: 0
    };

    for (var i = 0; i < a.length; i++) {
        if ((a[i] - 1) in d) {
            d[a[i]] = {
                prev: d[a[i] - 1],
                len: d[a[i] - 1].len + 1
            };

        } else {
            d[a[i]] = {
                len: 1
            };
        }

        d[a[i]].pos = i;

        if (d[a[i]].len > best.len) {
            best = d[a[i]];
        }
    }

    // print(best.len);
    var res = [];
    var t = best;
    while (typeof t !== 'undefined') {
        res.push(t.pos + 1);
        t = t.prev;
    }

    res.reverse();

    print(res.length);
    print(res.join(' '));

}

main();


var n = parseInt(readline());
var i;
var j;
var k;
var number;
var input;
var rows = [];
var names = {};

for (i = 0; i < n; i++) {
    input = readline().split(' ');
    if (typeof names[input[0]] === 'number') {
        rows[names[input[0]]].numbers = rows[names[input[0]]].numbers.concat(input.splice(2));
    } else {
        names[input[0]] = rows.length;
        rows.push({name: input[0], numbers: input.splice(2)});
    }
}

for (i = 0; i < rows.length; i++) {
    for (j = 0; j < rows[i].numbers.length; j++) {
        var deleting = false;
        number = rows[i].numbers[j];
        for (k = 0; k < rows[i].numbers.length; k++) {
            if (k != j &&
                rows[i].numbers[k].length >= number.length &&
                rows[i].numbers[k].lastIndexOf(number) == rows[i].numbers[k].length - number.length) {
                deleting = true;
                break;
            }
        }
        if (deleting) {
            rows[i].numbers.splice(j, 1);
            j--;
        }
    }
}

var toPrint = rows.length + '\n';
for (i = 0; i < rows.length; i++) {
    toPrint += rows[i].name + ' ' + rows[i].numbers.length;
    for (j = 0; j < rows[i].numbers.length; j++) {
        toPrint += ' ' + rows[i].numbers[j];
    }
    toPrint += '\n';
}
print(toPrint);

var n=Number(readline())
T={}
for (var i=0;i<n;++i) {
	var x=readline().split(' ');
	T[x[0]] = T[x[0]] || new Set()
	x.slice(2).forEach(function(e){T[x[0]].add(e)})
}

print(Object.keys(T).length)
for (var k in T) {
	var A=[]
	T[k].forEach(function(i){
		var skip=false
		T[k].forEach(function(j){
			skip = skip || (i !== j && (j.endsWith(i)))
		})
		if (!skip) {
			A.push(i)
		}
	})
	print(k + ' ' + A.length + ' ' + A.join(' '))
}

var n = +readline();
var sprav = [];
for (var i=0; i<n; i++){
	sprav[i] = readline().split(' ');
}
for (var i=0; i<n; i++){
	for (var j=(i+1); j<n; j++){
		if (sprav[i][0] == sprav[j][0]) {
			sprav[i] = sprav[i].concat(sprav[j].slice(2));
			sprav[j][0] = 0;
		}
	}
}
sprav = sprav.filter(function(item) {return item[0]; });

for (var i=0; i<sprav.length; i++){
	var p = sprav[i].slice(2).sort( (a,b) => b.length - a.length );
	for (var j=0; j<p.length; j++){
		for (var k=(j+1); k<p.length; k++){
			if (p[j] != 'NO' && p[k] != 'NO') {
				if ( p[j].slice(p[j].length - p[k].length) == p[k] ) p[k] = 'NO';
			}
		}
	}
	p = p.filter(function(item) {return (item !='NO'); });
	sprav[i][1] = p.length;
	sprav[i] = sprav[i].slice(0, 2).concat(p);
}

print (sprav.length);
for (var i=0; i<sprav.length; i++){
    print(sprav[i].join(' '));
}

//var print = require('./print');
//var readline = require('./readline');

var n = parseInt(readline());

var book = {};

for(var i=0;i<n;i++){
  var args = readline().split(' ');
  var name = args[0];
  if(book[name] == null || book[name] == undefined) {
    book[name] = [];
  }
  for(var j = 2; j < args.length; j++){
    var number = args[j];
    book[name].push(number);;
  }
}

var names = Object.keys(book);
print(names.length);
for(var i = 0; i < names.length;i++){
  var name = names[i];
  var numbers = book[name].sort(function (a,b){
    if(a.length > b.length){
      return 1;
    }
    else if(a.length < b.length){
      return -1;
    }
    return parseInt(a) - parseInt(b);
  });
  //print(numbers);

  var res = "";
  var count = 0;
  for(var j1 = 0;j1<numbers.length;j1++){
    var number1 = numbers[j1];
    var check = true;
    for(var j2 = j1 + 1; j2 < numbers.length; j2 ++){
      var number2 = numbers[j2];
      if(number2.endsWith(number1)){
        check = false;
        break;
      }
    }
    if(check){
      count ++;
      res += " " + number1;
    }
  }
  print(name + " " + count + res);
}

//var print = require('./print');
//var readline = require('./readline');

var n = parseInt(readline());

var book = {};

for(var i=0;i<n;i++){
  var args = readline().split(' ');
  var name = args[0];
  if(book[name] == null || book[name] == undefined) {
    book[name] = [];
  }
  for(var j = 2; j < args.length; j++){
    var number = args[j];
    var numbers = book[name];
    numbers.push(number);
  }
}

var names = Object.keys(book);
print(names.length);
for(var i = 0; i < names.length;i++){
  var name = names[i];
  var numbers = book[name].sort(function (a,b){
    return parseInt(a) - parseInt(b);
  });

  var res = "";
  var count = 0;
  for(var j1 = 0;j1<numbers.length;j1++){
    var number1 = numbers[j1];
    var check = true;
    for(var j2 = j1 + 1; j2 < numbers.length; j2 ++){
      var number2 = numbers[j2];
      if(number2.endsWith(number1)){
        check = false;
        break;
      }
    }
    if(check){
      count ++;
      res += " " + number1;
    }
  }
  print(name + " " + count + res);
}

/* B
var n = parseInt(readline());
var a = parseInt(readline());
var b = parseInt(readline());

for(var y = 0;;y++){
  var x = (n - b * y) / a;
  if(y * b > n){
    print('NO');
    break;
  }
  else if(x == parseInt(x) && a * x + b * y == n){
    print('YES');
    print(x + " " + y);
    break;
  }
}
*/

/* A
var n = readline();
var res = '';
for (var i = 0; i < n.length - 2; i++)
  res += n[i];
if(n.length > 1){
  if(n[n.length - 1] > '5')
    res += parseInt(n[n.length - 2]) + 1;
  else {
    res += n[n.length - 2];
  }
}
res += '0';
print(res);
*/

//var print = require('./print');
//var readline = require('./readline');

var n = parseInt(readline());

var book = {};

for(var i=0;i<n;i++){
  var args = readline().split(' ');
  var name = args[0];
  if(book[name] == null || book[name] == undefined) {
    book[name] = [];
  }
  for(var j = 2; j < args.length; j++){
    var number = args[j];
    var numbers = book[name];
    numbers.push(number);
  }
}

var names = Object.keys(book);
for(var i = 0; i < names.length;i++){
  var name = names[i];
  var numbers = book[name].sort(function (a,b){
    return parseInt(a) - parseInt(b);
  });

  var res = "";
  var count = 0;
  for(var j1 = 0;j1<numbers.length;j1++){
    var number1 = numbers[j1];
    var check = true;
    for(var j2 = j1 + 1; j2 < numbers.length; j2 ++){
      var number2 = numbers[j2];
      if(number2.endsWith(number1)){
        check = false;
        break;
      }
    }
    if(check){
      count ++;
      res += " " + number1;
    }
  }
  print(name + " " + count + res);
}

/* B
var n = parseInt(readline());
var a = parseInt(readline());
var b = parseInt(readline());

for(var y = 0;;y++){
  var x = (n - b * y) / a;
  if(y * b > n){
    print('NO');
    break;
  }
  else if(x == parseInt(x) && a * x + b * y == n){
    print('YES');
    print(x + " " + y);
    break;
  }
}
*/

/* A
var n = readline();
var res = '';
for (var i = 0; i < n.length - 2; i++)
  res += n[i];
if(n.length > 1){
  if(n[n.length - 1] > '5')
    res += parseInt(n[n.length - 2]) + 1;
  else {
    res += n[n.length - 2];
  }
}
res += '0';
print(res);
*/

var n=Number(readline())
var T={}, name, ph
function comp(a,b) { return +a-(+b); }
for (var i=0;i<n;++i) {
	var r=readline().split(' ')
	name=r[0]
	ph=r.slice(2)
	T[name] = T[name]||[];
	T[name]=T[name].concat(ph)
	T[name].sort(comp)
	T[name].reverse()
}
for (var k in T) {
	var a=T[k];
	var b=[]
	for (var i=0; i<a.length;++i) {
		var skip=false
		for (var j=0;j<i;++j) {
			skip = skip || a[j].match(new RegExp(a[i]+'$'))
		}
		if (!skip) b.push(a[i])
	}
	print(k + ' ' + b.length + ' ' + b.join(' '))
}
//print(JSON.stringify(T))

var n=Number(readline())
T={}
for (var i=0;i<n;++i) {
	var x=readline().split(' ');
	T[x[0]] = T[x[0]] || new Set()
	x.slice(2).forEach(function(e){T[x[0]].add(e)})
}

for (var k in T) {
	var A=[]
	T[k].forEach(function(i){
		var skip=false
		T[k].forEach(function(j){
			skip = skip || (i !== j && (j.endsWith(i)))
		})
		if (!skip) {
			A.push(i)
		}
	})
	print(k + ' ' + A.length + ' ' + A.join(' '))
}

var n = +readline();
var sprav = [];
for (var i=0; i<n; i++){
	sprav[i] = readline().split(' ');
}
for (var i=0; i<n; i++){
	for (var j=(i+1); j<n; j++){
		if (sprav[i][0] == sprav[j][0]) {
			sprav[i] = sprav[i].concat(sprav[j].slice(1));
			sprav[j][0] = 0;
		}
	}
}
sprav = sprav.filter(function(item) {return item[0]; });

for (var i=0; i<sprav.length; i++){
	var p = sprav[i].slice(1).sort( (a,b) => b.length - a.length );
	for (var j=0; j<p.length; j++){
		for (var k=(j+1); k<p.length; k++){
			if (p[j] != '0' && p[k] != '0') {
				if ( p[j].slice(p[j].length - p[k].length) == p[k] ) p[k] = '0';
			}
		}
	}
	p = p.filter(function(item) {return +item; });
	sprav[i] = sprav[i][0] + ' ' + p.join(' ');
}

print (sprav.length);
for (var i=0; i<sprav.length; i++){
	print(sprav[i]);
}

var n = +readline();
var sprav = [];
for (var i=0; i<n; i++){
	sprav[i] = readline().split(' ');
}
for (var i=0; i<n; i++){
	for (var j=(i+1); j<n; j++){
		if (sprav[i][0] == sprav[j][0]) {
			sprav[i] = sprav[i].concat(sprav[j].slice(2));
			sprav[j][0] = 0;
		}
	}
}
sprav = sprav.filter(function(item) {return item[0]; });

for (var i=0; i<sprav.length; i++){
	var p = sprav[i].slice(2).sort( (a,b) => b.length - a.length );
	for (var j=0; j<p.length; j++){
		for (var k=(j+1); k<p.length; k++){
			if (p[j] != '0' && p[k] != '0') {
				if ( p[j].slice(p[j].length - p[k].length) == p[k] ) p[k] = '0';
			}
		}
	}
	p = p.filter(function(item) {return +item; });
	sprav[i][1] = p.length;
	sprav[i] = sprav[i].slice(0, 2).concat(p);
}

print (sprav.length);
for (var i=0; i<sprav.length; i++){
    print(sprav[i].join(' '));
}


var n = readline();
n--;
var a =  readline().split(' '); // a0..a(n-1)
var k = 0;
var t = 0
var turns = 0;

for(k=0; k<n; k++)
{
  while(k+Math.pow(2,t) <= n)
  {
    t++;
  }
  t--;

  turns= turns + Number(a[k]);

  a[k+Math.pow(2,t)] = Number(a[k+Math.pow(2,t)]) + Number(a[k]);

  print(turns);
}

const Fs = require('fs')

const content = Fs.readFileSync(0).toString()

const parse = (a) => {
  return a.split('\n')[1].split(' ')
}

const computeMaxIndex = (i, m) => {
  const rec = (p) => {
    const j = i + Math.pow(2, p)
    if (m < j) {
      return i + Math.pow(2, p - 1)
    } else {
      return rec(p + 1)
    }
  }
  return rec(0)
}

const minMove = (array) => {
  let ans = []

  for (let i = 0; i < array.length - 1; i++) {
    const max_index = computeMaxIndex(i, array.length - 1)
    let prev = 0
    if (ans.length !== 0) {
      prev = ans[ans.length - 1]
    }
    ans.push(prev + array[i])
    array[max_index] += array[i]
    array[i] = 0
  }

  return ans
}

const array = parse(content).map(a=>Number(a))
minMove(array).forEach((a)=>console.log(a))

var n = readline();
var a =  Number(readline().split(' ')); // a0..a(n-1)
var k = 0;
var t = 0
var turns = 0;

for(k=0; k<n; k++)
{
  while(k+Math.pow(2,t) <= n)
  {
    t++;
  }
  t--;

  turns= turns + a[k];

  a[k+Math.pow(2,t)] = a[k+Math.pow(2,t)] + a[k];

  print(turns);
}

var n = readline();
var a =  readline().split(' '); // a0..a(n-1)
var k = 0;
var t = 0
var turns = 0;

for(k=0; k<n; k++)
{
  while(k+Math.pow(2,t) <= n)
  {
    t++;
  }
  t--;

  turns= turns + Number(a[k]);

  a[k+Math.pow(2,t)] = Number(a[k+Math.pow(2,t)]) + Number(a[k]);

  print(turns);
}

var n = readline();
var a = readline().split(' '); // a0..a(n-1)
var k = 0;
var t = 0
var turns = 0;

for(k=0; k<n; k++)
{
  while(k+Math.pow(2,t) <= n)
  {
    t++;
  }
  t--;

  turns= turns + a[k];

  a[k+Math.pow(2,t)] = a[k+Math.pow(2,t)] + a[k];

  print(turns);
}


var input = readline().split(' ').map(function(x) {return parseInt(x)});
var breaks = 0;

var n = input[0];
var l = input[1];
var a = input[2];
var prevEnd = 0;

for(var i=0; i<n; i++) {
  var interval = readline().split(' ').map(function(x) {return parseInt(x)});
  var start = interval[0];
  var len = interval[1];

  breaks += Math.floor((start-prevEnd)/a);
  prevEnd = start+len;
}

breaks += Math.floor((l-prevEnd)/a);
print(breaks + "");

function main(){
	var s = readline();
	var arr = s.split(" ").map(elm=>{
		return parseInt(elm);
	})
	var n = arr[0], L = arr[1], a = arr[2];
	var result = 0;
	var arr1 = [];
	arr1[0] = [];
	arr1[0][0] = arr1[0][1] = 0;
	for(var i = 1; i <= n; i++){
		var ss = readline().split(" ").map(x=>+x);
		// var t = arr1[i][0], l = arr1[i][1];
		arr1[i] = [];
		arr1[i][0] = ss[0], arr1[i][1] = ss[1];
		var cnt = arr1[i][0] - (arr1[i-1][0]+arr1[i-1][1]);
		if(cnt >= a){
			result += Math.floor(cnt/a);
		}
	}
	if(L - (arr1[n][0]+arr1[n][1]) >= a){
		result += Math.floor((L - arr1[n][0]-arr1[n][1])/a);
	}
	// console.log(result);
	print(result)
}
main();

const readline = require('readline')

const interface = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
})

let lineIndex = 0
let inputs

let customerNum, totalTimeLen, breakLen
let time, length
let breakNum = 0, lastFinish = 0
interface.on('line', line => {
  inputs = line.split(' ').map(v => parseInt(v))
  if (lineIndex === 0) {
    customerNum = inputs[0]
    totalTimeLen = inputs[1]
    breakLen = inputs[2]
  } else {
    time = inputs[0]
    length = inputs[1]
    breakNum += Math.floor((time - lastFinish) / breakLen)
    lastFinish = time + length
  }

  if (lineIndex == customerNum) {
    breakNum += Math.floor((totalTimeLen - lastFinish) / breakLen)
    console.log(breakNum)
    process.exit()
  }
  lineIndex ++
})

var input = readline().split(" ").map(function(el) {return parseFloat(el)});
var n = input[0];
var L = input[1];
var a = input[2];
var lastClientTime = 0;
var breaks = 0;
for (var i = 0; i < n; i++) {
    var client = readline().split(" ").map(function(el) {return parseFloat(el)});
    breaks += parseInt((client[0] - lastClientTime)/a);
    lastClientTime = client[0]+client[1];
    if (i == n - 1)
        breaks += parseInt((L - client[0]-client[1])/a);
}
if (n == 0)
    breaks = parseInt(L/a);
print(breaks);

var g = readline().split(" ");

var n = Number(g[0]);
var L = Number(g[1]);
var a = Number(g[2]);

var time = 0;
var count = 0;

for(i=0;i<n;i++){

    var y = readline().split(" ");

    var t = Number(y[0]);
    var l = Number(y[1]);

    count += Math.floor((t-time)/a);

    time = t + l;
}

count += Math.floor((L-time)/a);

print(count);

var input = readline().split(' ');
var breaks = 0;

var n = Number(input[0]);
var l = Number(input[1]);
var a = Number(input[2]);
var prevEnd = 0;

for(var i=0; i<n; i++) {
  var interval = readline().split(' ').map(function(x) {return parseInt(x)});
  var start = interval[0];
  var len = interval[1];

  breaks += Math.floor((start-prevEnd)/a);
  prevEnd = start+len;
}

breaks += Math.floor((l-prevEnd)/a);
print(breaks);

var line = readline().split(' ');
var numClients = line[0];
var totalTime = line[1];
var rest = line[2];

var occupiedArray = [];

var tTotal = [];
var lTotal = [];

for(var i=0; i < numClients; i++) {
    var newLine = readline().split(' ');
    var tinicial = parseInt(newLine[0]);
    var lfinal = parseInt(newLine[1]);

    tTotal[i] = tinicial;
    lTotal[i] = lfinal;
}

var ans = 0;
var start = 0;

for(var j=0; j < numClients; j++) {
    ans += Math.floor((tTotal[j] - start)/rest);
    start = tTotal[j] + lTotal[j];
}

ans += (totalTime-start)/rest;

print(Math.floor(ans));

var input = readline().split(' ');
var breaks = 0;

var n = Number(input[0]);
var l = Number(input[1]);
var a = Number(input[2]);
var prevEnd = 0;

for(var i=0; i<n; i++) {
  var interval = readline().split(' ');
  var start = Number(interval[0]);
  var len = Number(interval[1]);

  breaks += Math.floor((start-prevEnd)/a);
  prevEnd = start+len;
}

breaks += Math.floor((l-prevEnd)/a);
print(breaks);

const readline = require('readline')

const interface = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
})

let lineIndex = 0
let inputs

let customerNum, totalTimeLen, breakLen
let time, length
let breakNum = 0, lastFinish = 0
interface.on('line', line => {
  inputs = line.split(' ')

  if (lineIndex === 0) {
    customerNum = inputs[0]
    totalTimeLen = inputs[1]
    breakLen = inputs[2]
  } else {
    time = inputs[0]
    length = inputs[1]
    breakNum += Math.floor((time - lastFinish) / breakLen)
    lastFinish = time + length
  }
})
interface.on('close', () => {
  breakNum += Math.floor((totalTimeLen - lastFinish) / breakLen)
  console.log(breakNum)
  process.exit()
})

const readline = require('readline')

const interface = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
})

let lineIndex = 0
let inputs

let customerNum, totalTimeLen, breakLen
let time, length
let breakNum = 0, lastFinish = 0
interface.on('line', line => {
  inputs = line.split(' ')

  if (lineIndex === 0) {
    customerNum = inputs[0]
    totalTimeLen = inputs[1]
    breakLen = inputs[2]
  } else {
    time = inputs[0]
    length = inputs[1]
    breakNum += Math.floor((time - lastFinish) / breakLen)
    lastFinish = time + length
  }
  lineIndex ++
})
interface.on('close', () => {
  breakNum += Math.floor((totalTimeLen - lastFinish) / breakLen)
  console.log(breakNum)
  process.exit()
})

function main(){
	var s = readline();
	var arr = s.split(" ").map(elm=>{
		return parseInt(elm);
	})
	var n = arr[0], L = arr[1], a = arr[2];
	var result = 0;
	var arr1 = [];
	arr1[0] = [];
	arr1[0][0] = arr1[0][1] = 0;
	for(var i = 1; i <= n; i++){
		var ss = readline().split(" ").map(x=>+x);
		// var t = arr1[i][0], l = arr1[i][1];
		arr1[i] = [];
		arr1[i][0] = ss[0], arr[i][1] = ss[1];
		var cnt = arr1[i][0] - (arr1[i-1][0]+arr1[i-1][1]);
		if(cnt >= a){
			result += cnt/a;
		}
	}
	if(L - (arr1[n][0]+arr1[n][1]) >= a){
		result += (L - arr1[n][0]-arr1[n][1])/a;
	}
	// console.log(result);
	print(result)
}
main();

function main(){
	var s = readline();
	var arr = s.split(" ").map(elm=>{
		return parseInt(elm);
	})
	var n = arr[0], L = arr[1], a = arr[2];
	var result = 0;
	var arr1 = [];
	arr1[0] = [];
	arr1[0][0] = arr1[0][1] = 0;
	for(var i = 1; i <= n; i++){
		var ss = readline().split(" ").map(x=>+x);
		// var t = arr1[i][0], l = arr1[i][1];
		arr1[i] = [];
		arr1[i][0] = ss[0], arr1[i][1] = ss[1];
		var cnt = arr1[i][0] - (arr1[i-1][0]+arr1[i-1][1]);
		if(cnt >= a){
			result += cnt/a;
		}
	}
	if(L - (arr1[n][0]+arr1[n][1]) >= a){
		result += (L - arr1[n][0]-arr1[n][1])/a;
	}
	// console.log(result);
	print(result)
}
main();

var input = readline().split(" ").map(function(el) {return parseFloat(el)});
var n = input[0];
var L = input[1];
var a = input[2];
var lastClientTime = 0;
var breaks = 0;
for (var i = 0; i < n; i++) {
    var client = readline().split(" ").map(function(el) {return parseFloat(el)});
    breaks += parseInt((client[0] - lastClientTime)/a);
    lastClientTime = client[1];
    if (i == n - 1)
        breaks += parseInt((L - client[1])/a);
}
if (n == 0)
    breaks = parseInt(L/a);
print(breaks);

var input = readline().split(" ").map(function(el) {return parseFloat(el)});
var n = input[0];
var L = input[1];
var a = input[2];
var lastClientTime = 0;
var breakMin = 0;
for (var i = 0; i < n; i++) {
    var client = readline().split(" ").map(function(el) {return parseFloat(el)});
    breakMin += (client[0] - lastClientTime);
    lastClientTime = client[1];
    if (i == n - 1)
        breakMin += L - client[0] - client[1];
}
if (n == 0)
    breakMin = L;
print(parseInt(breakMin/a));

var input = readline().split(" ").map(function(el) {return parseFloat(el)});
var n = input[0];
var L = input[1];
var a = input[2];
var lastClientTime = 0;
var breaks = 0;
for (var i = 0; i < n; i++) {
    var client = readline().split(" ").map(function(el) {return parseFloat(el)});
    breaks += parseInt((client[0] - lastClientTime)/a);
    lastClientTime = client[1];
    if (i == n - 1)
        breaks += parseInt((L - client[0] - client[1])/a);
}
if (n == 0)
    breaks = parseInt(L/a);
print(breaks);

var line = readline().split(' ');
var numClients = line[0];
var totalTime = line[1];
var rest = line[2];

var occupiedArray = [];

var tTotal = [];
var lTotal = [];

for(var i=0; i < numClients; i++) {
    var newLine = readline().split(' ');
    var tinicial = parseInt(newLine[0]);
    var lfinal = parseInt(newLine[1]);

    tTotal[i] = tinicial;
    lTotal[i] = lfinal;
}

var ans = 0;
var start = 0;

for(var j=0; j < numClients; j++) {
    ans += (tTotal[j] - start)/rest;
    start = tTotal[j] + lTotal[j];
}

ans += (totalTime-start)/rest;

print(Math.floor(ans));

var currentLine = 0;

function readline() {
    var ret = getline().split('\n')[currentLine];

    currentLine++;

    return ret;
}

function getline() {
    return '2 11 3\n0 1\n1 1'
}

var line = readline().split(' ');
var numClients = line[0];
var totalTime = line[1];
var rest = line[2];

var timeArray = [];
var occupiedArray = [];

for(var x=0; x <= totalTime; x++){ timeArray.push(x) }

for(var i=0; i < numClients; i++) {
    var newLine = readline().split(' ');

    timeArray[parseInt(newLine[0])] = 'x';
    timeArray[parseInt(newLine[0]) + parseInt(newLine[1])] = 'x';
}

var iterable = 0;
var numIntervals = 0;
var freeTime = 0;

while(iterable <= totalTime ) {

    if(timeArray[iterable] !== 'x') {
        freeTime++;
    } else {
        freeTime = 0;
    }

    if(freeTime == rest) {
        numIntervals++
        freeTime = 0;
    }

    iterable++
}

print(numClients > 0 ? numIntervals : Math.floor(totalTime/rest));

var line = readline().split(' ');
var numClients = line[0];
var totalTime = line[1];
var rest = line[2];

var timeArray = [];
var occupiedArray = [];

for(var x=0; x <= totalTime; x++){ timeArray.push(x) }

for(var i=0; i < numClients; i++) {
    var newLine = readline().split(' ');

    timeArray[parseInt(newLine[0])] = 'x';
    timeArray[parseInt(newLine[0]) + parseInt(newLine[1])] = 'x';
}

var iterable = 0;
var numIntervals = 0;
var freeTime = 1;

while(iterable <= totalTime ) {
    if(freeTime == Math.floor(totalTime / rest)) {
        numIntervals++
        freeTime = 1;
    }

    if(timeArray[iterable] !== 'x') {
        freeTime++;
    } else {
        freeTime = 0;
    }

    iterable++
}

print(numClients > 0 ? numIntervals : Math.floor(totalTime/rest));

var line = readline().split(' ');
var numClients = line[0];
var totalTime = line[1];
var rest = line[2];

var timeArray = [];
var occupiedArray = [];

for(var x=0; x <= totalTime; x++){ timeArray.push(x) }

for(var i=0; i < numClients; i++) {
    var newLine = readline().split(' ');

    timeArray[parseInt(newLine[0])] = 'x';
    timeArray[parseInt(newLine[0]) + parseInt(newLine[1])] = 'x';
}

var iterable = 0;
var numIntervals = 0;
var freeTime = 1;

while(iterable <= totalTime ) {
    if(freeTime == Math.floor(totalTime / rest)) {
        numIntervals++
        freeTime = 1;
    }

    if(timeArray[iterable] !== 'x') {
        freeTime++;
    } else {
        freeTime = 0;
    }

    iterable++
}

print(numIntervals);