You have decided to watch the best moments of some movie. There are two buttons on your player:   Watch the current minute of the movie. By pressing this button, you watch the current minute of the movie and the player automatically proceeds to the next minute of the movie.  Skip exactly x minutes of the movie (x is some fixed positive integer). If the player is now at the t-th minute of the movie, then as a result of pressing this button, it proceeds to the minute (t + x). Initially the movie is turned on in the player on the first minute, and you want to watch exactly n best moments of the movie, the i-th best moment starts at the li-th minute and ends at the ri-th minute (more formally, the i-th best moment consists of minutes: li, li + 1, ..., ri). Determine, what is the minimum number of minutes of the movie you have to watch if you want to watch all the best moments?

The first line contains two space-separated integers n, x (1 ≤ n ≤ 50, 1 ≤ x ≤ 105) — the number of the best moments of the movie and the value of x for the second button. The following n lines contain the descriptions of the best moments of the movie, the i-th line of the description contains two integers separated by a space li, ri (1 ≤ li ≤ ri ≤ 105). It is guaranteed that for all integers i from 2 to n the following condition holds: ri - 1 < li.

Output a single number — the answer to the problem.

NoteIn the first sample, the player was initially standing on the first minute. As the minutes from the 1-st to the 4-th one don't contain interesting moments, we press the second button. Now we can not press the second button and skip 3 more minutes, because some of them contain interesting moments. Therefore, we watch the movie from the 4-th to the 6-th minute, after that the current time is 7. Similarly, we again skip 3 minutes and then watch from the 10-th to the 12-th minute of the movie. In total, we watch 6 minutes of the movie.In the second sample, the movie is very interesting, so you'll have to watch all 100000 minutes of the movie.

var tok=null;
var index=0;
function next(){
    while(tok==null || index==tok.length){
        tok=readline().split(' ');
        index=0;
    }
    var res=tok[index++];
    return res;
}

function nextInt(){
    return parseInt(next());
}

function main(){
    var n=nextInt();
    var x=nextInt();
    var r=0;
    var t=1;
    var arrS=[];
    var arrE=[];
    for(var i=0; i<n; i++){
        arrS[i]=nextInt();
        arrE[i]=nextInt();
    }
    var iMoment=0;
    while(iMoment<n){
        while((t+x)<=arrS[iMoment]){
            t=t+x;
        }

        r+=(arrE[iMoment]-t+1);
        t=arrE[iMoment]+1;

        iMoment++;
    }
    print(r);
}

main();

var tok=null;
var index=0;
function next(){
    while(tok==null || index==tok.length){
        tok=readline().split(' ');
        index=0;
    }
    var res=tok[index++];
    return res;
}

function nextInt(){
    return parseInt(next());
}

function main(){
    var n=nextInt();
    var x=nextInt();
    var r=0;
    var t=1;
    var arrS=[];
    var arrE=[];
    for(var i=0; i<n; i++){
        arrS[i]=nextInt();
        arrE[i]=nextInt();
    }
    var iMoment=0;
    while(iMoment<n){
        while((t+x)<=arrS[iMoment]){
            t=t+x;
        }
            print("Start:"+t);
        r+=(arrE[iMoment]-t+1);
        t=arrE[iMoment]+1;

        iMoment++;
    }
    print(r);
}

main();


There are $$$n$$$ traps numbered from $$$1$$$ to $$$n$$$. You will go through them one by one in order. The $$$i$$$-th trap deals $$$a_i$$$ base damage to you.Instead of going through a trap, you can jump it over. You can jump over no more than $$$k$$$ traps. If you jump over a trap, it does not deal any damage to you. But there is an additional rule: if you jump over a trap, all next traps damages increase by $$$1$$$ (this is a bonus damage).Note that if you jump over a trap, you don't get any damage (neither base damage nor bonus damage). Also, the bonus damage stacks so, for example, if you go through a trap $$$i$$$ with base damage $$$a_i$$$, and you have already jumped over $$$3$$$ traps, you get $$$(a_i + 3)$$$ damage.You have to find the minimal damage that it is possible to get if you are allowed to jump over no more than $$$k$$$ traps.

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le k \le n$$$) — the number of traps and the number of jump overs that you are allowed to make. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — base damage values of all traps. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

For each test case output a single integer — the minimal total damage that it is possible to get if you are allowed to jump over no more than $$$k$$$ traps.

NoteIn the first test case it is allowed to jump over all traps and take $$$0$$$ damage.In the second test case there are $$$5$$$ ways to jump over some traps:  Do not jump over any trap.Total damage: $$$5 + 10 + 11 + 5 = 31$$$. Jump over the $$$1$$$-st trap.Total damage: $$$\underline{0} + (10 + 1) + (11 + 1) + (5 + 1) = 29$$$. Jump over the $$$2$$$-nd trap.Total damage: $$$5 + \underline{0} + (11 + 1) + (5 + 1) = 23$$$. Jump over the $$$3$$$-rd trap.Total damage: $$$5 + 10 + \underline{0} + (5 + 1) = 21$$$. Jump over the $$$4$$$-th trap.Total damage: $$$5 + 10 + 11 + \underline{0} = 26$$$.To get minimal damage it is needed to jump over the $$$3$$$-rd trap, so the answer is $$$21$$$.In the third test case it is optimal to jump over the traps $$$1$$$, $$$3$$$, $$$4$$$, $$$5$$$, $$$7$$$:Total damage: $$$0 + (2 + 1) + 0 + 0 + 0 + (2 + 4) + 0 = 9$$$.

'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);
}();

'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;
};

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;
};


Leslie and Leon entered a labyrinth. The labyrinth consists of $$$n$$$ halls and $$$m$$$ one-way passages between them. The halls are numbered from $$$1$$$ to $$$n$$$.Leslie and Leon start their journey in the hall $$$s$$$. Right away, they quarrel and decide to explore the labyrinth separately. However, they want to meet again at the end of their journey.To help Leslie and Leon, your task is to find two different paths from the given hall $$$s$$$ to some other hall $$$t$$$, such that these two paths do not share halls other than the staring hall $$$s$$$ and the ending hall $$$t$$$. The hall $$$t$$$ has not been determined yet, so you can choose any of the labyrinth's halls as $$$t$$$ except $$$s$$$.Leslie's and Leon's paths do not have to be the shortest ones, but their paths must be simple, visiting any hall at most once. Also, they cannot visit any common halls except $$$s$$$ and $$$t$$$ during their journey, even at different times.

The first line contains three integers $$$n$$$, $$$m$$$, and $$$s$$$, where $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) is the number of vertices, $$$m$$$ ($$$0 \le m \le 2 \cdot 10^5$$$) is the number of edges in the labyrinth, and $$$s$$$ ($$$1 \le s \le n$$$) is the starting hall. Then $$$m$$$ lines with descriptions of passages follow. Each description contains two integers $$$u_i$$$, $$$v_i$$$ ($$$1 \le u_i, v_i \le n$$$; $$$u_i \neq v_i$$$), denoting a passage from the hall $$$u_i$$$ to the hall $$$v_i$$$. The passages are one-way. Each tuple $$$(u_i, v_i)$$$ is present in the input at most once. The labyrinth can contain cycles and is not necessarily connected in any way.

If it is possible to find the desired two paths, output "Possible", otherwise output "Impossible". If the answer exists, output two path descriptions. Each description occupies two lines. The first line of the description contains an integer $$$h$$$ ($$$2 \le h \le n$$$) — the number of halls in a path, and the second line contains distinct integers $$$w_1, w_2, \dots, w_h$$$ ($$$w_1 = s$$$; $$$1 \le w_j \le n$$$; $$$w_h = t$$$) — the halls in the path in the order of passing. Both paths must end at the same vertex $$$t$$$. The paths must be different, and all intermediate halls in these paths must be distinct.

'use strict';

var fs = require('fs');

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

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, m, s, edges) {
  let map = new Map();
  const g = Array.from({
    length: n
  }, () => []);

  for (let [u, v] of edges) {
    g[u].push(v);
  }

  for (let child of g[s]) {
    let tmp = new Map([[child, s]]);
    const queue = [child];

    for (let node of queue) {
      if (map.has(node)) {
        console.log('Possible');
        let path = [];

        for (let i = node; i !== undefined; i = tmp.get(i)) {
          path.push(i + 1);
        }

        console.log(path.length);
        console.log(path.reverse().join(' '));
        path = [];

        for (let i = node; i !== undefined; i = map.get(i)) {
          path.push(i + 1);
        }

        console.log(path.length);
        console.log(path.reverse().join(' '));
        return;
      }

      for (let c of g[node]) {
        if (c === s) continue;
        if (tmp.has(c)) continue;
        tmp.set(c, node);
        queue.push(c);
      }
    }

    for (let [child, node] of tmp) {
      map.set(child, node);
    }
  }

  console.log('Impossible');
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const [n, m, s] = inputs[0].split(' ').map(Number);
  const edges = [];

  for (let _ = 1; _ <= m; _++) {
    const [u, v] = inputs[_].trim().split(' ').map(Number);

    edges.push([u - 1, v - 1]);
  }

  solve(n, m, s - 1, edges);
}();

'use strict';

var fs = require('fs');

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

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, m, s, edges) {
  let map = new Map();
  const g = Array.from({
    length: n
  }, () => []);

  for (let [u, v] of edges) {
    g[u].push(v);
  }

  for (let child of g[s]) {
    let tmp = new Map([[child, s]]);
    const queue = [child];

    for (let node of queue) {
      for (let c of g[node]) {
        if (map.has(c)) {
          console.log('Possible');
          let path = [];
          tmp.set(c, node);

          for (let i = c; i !== undefined; i = tmp.get(i)) {
            path.push(i + 1);
          }

          console.log(path.length);
          console.log(path.reverse().join(' '));
          path = [];

          for (let i = c; i !== undefined; i = map.get(i)) {
            path.push(i + 1);
          }

          console.log(path.length);
          console.log(path.reverse().join(' '));
          return;
        }

        if (c === s) continue;
        if (tmp.has(c)) continue;
        tmp.set(c, node);
        queue.push(c);
      }
    }

    for (let [child, node] of tmp) {
      map.set(child, node);
    }
  }

  console.log('Impossible');
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const [n, m, s] = inputs[0].split(' ').map(Number);
  const edges = [];

  for (let _ = 1; _ <= m; _++) {
    const [u, v] = inputs[_].trim().split(' ').map(Number);

    edges.push([u - 1, v - 1]);
  }

  solve(n, m, s - 1, edges);
}();

'use strict';

var fs = require('fs');

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

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, m, s, edges) {
  let map = new Map();
  const g = Array.from({
    length: n
  }, () => []);

  for (let [u, v] of edges) {
    g[u].push(v); // g[v].push(u)
  }

  for (let child of g[s]) {
    let tmp = new Map([[child, s]]);
    const queue = [child];

    for (let node of queue) {
      for (let c of g[node]) {
        if (map.has(c)) {
          console.log('Possible');
          let path = [];
          tmp.set(c, node);

          for (let i = c; i !== undefined; i = tmp.get(i)) {
            path.push(i + 1);
          }

          console.log(path.length);
          console.log(path.reverse().join(' '));
          path = [];

          for (let i = c; i !== undefined; i = map.get(i)) {
            path.push(i + 1);
          }

          console.log(path.length);
          console.log(path.reverse().join(' '));
          return;
        }

        if (c === s) continue;
        if (tmp.has(c)) continue;
        if (node === child && c === s) continue;
        tmp.set(c, node);
        queue.push(c);
      }
    }

    for (let [child, node] of tmp) {
      map.set(child, node);
    }
  }

  console.log('Impossible');
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const [n, m, s] = inputs[0].split(' ').map(Number);
  const edges = [];

  for (let _ = 1; _ <= m; _++) {
    const [u, v] = inputs[_].trim().split(' ').map(Number);

    edges.push([u - 1, v - 1]);
  }

  solve(n, m, s - 1, edges);
}();

'use strict';

var fs = require('fs');

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

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, m, s, edges) {
  let map = new Map();
  const g = Array.from({
    length: n
  }, () => []);

  for (let [u, v] of edges) {
    g[u].push(v);
  }

  for (let child of g[s]) {
    let tmp = new Map([[child, s]]);
    const queue = [child];

    for (let node of queue) {
      for (let c of g[node]) {
        if (map.has(c)) {
          console.log('Possible');
          let path = [];
          tmp.set(c, node);

          for (let i = c; i !== undefined; i = tmp.get(i)) {
            path.push(i + 1);
          }

          console.log(path.length);
          console.log(path.reverse().join(' '));
          path = [];

          for (let i = c; i !== undefined; i = map.get(i)) {
            path.push(i + 1);
          }

          console.log(path.length);
          console.log(path.reverse().join(' '));
          return;
        }

        if (tmp.has(c)) continue;
        if (node === child && c === s) continue;
        tmp.set(c, node);
        queue.push(c);
      }
    }

    for (let [child, node] of tmp) {
      map.set(child, node);
    }
  }

  console.log('Impossible');
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const [n, m, s] = inputs[0].split(' ').map(Number);
  const edges = [];

  for (let _ = 1; _ <= m; _++) {
    const [u, v] = inputs[_].trim().split(' ').map(Number);

    edges.push([u - 1, v - 1]);
  }

  solve(n, m, s - 1, edges);
}();

'use strict';

var fs = require('fs');

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

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, m, s, edges) {
  let map = new Map();
  const g = Array.from({
    length: n
  }, () => []);

  for (let [u, v] of edges) {
    g[u].push(v);
  }

  for (let child of g[s]) {
    let tmp = new Map([[child, s]]);
    const queue = [child];

    for (let node of queue) {
      for (let c of g[node]) {
        if (map.has(c)) {
          console.log('Possible');
          let path = [];
          tmp.set(c, node);

          for (let i = c; i !== undefined; i = tmp.get(i)) {
            path.push(i + 1);
          }

          console.log(path.length);
          console.log(path.reverse().join(' '));
          path = [];

          for (let i = c; i !== undefined; i = map.get(i)) {
            path.push(i + 1);
          }

          console.log(path.length);
          console.log(path.reverse().join(' '));
          return;
        }

        if (tmp.has(c)) continue;
        if (node === child && c === s) continue;
        map.set(c, node);
        queue.push(c);
      }
    }

    for (let [child, node] of tmp) {
      map.set(child, node);
    }
  }

  console.log('Impossible');
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const [n, m, s] = inputs[0].split(' ').map(Number);
  const edges = [];

  for (let _ = 1; _ <= m; _++) {
    const [u, v] = inputs[_].trim().split(' ').map(Number);

    edges.push([u - 1, v - 1]);
  }

  solve(n, m, s - 1, edges);
}();

'use strict';

var fs = require('fs');

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

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(n, m, s, edges) {
  let set = new Set([s]),
      p = new Array(n).fill(-1);
  const g = Array.from({
    length: n
  }, () => []);

  for (let [u, v] of edges) {
    g[u].push(v);
    g[v].push(u);
  }

  for (let child of g[s]) {
    let tmp = new Set([child]);
    const queue = [child];

    for (let node of queue) {
      if (set.has(node)) {
        let path = [node + 1];

        for (let i = p[node]; i !== -1; i = p[i]) {
          path.push(i + 1);
        }

        console.log('Possible');
        console.log(2);
        console.log(path.slice(0, 2).join(' '));
        console.log(path.length);
        path = path.reverse();
        path.pop();
        console.log(`${s + 1} ${path.join(' ')}`);
        return;
      }

      for (let c of g[node]) {
        if (tmp.has(c)) continue;
        if (node === child && c === s) continue;
        p[c] = node;
        tmp.add(c);
        queue.push(c);
      }
    }

    for (let node of tmp) {
      set.add(node);
    }
  }

  console.log('Impossible');
}

// const inputs = fs.readFileSync(path.join(__dirname, './codeforces.test.txt'), 'utf-8').split('\n')

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function main() {
  const [n, m, s] = inputs[0].split(' ').map(Number);
  const edges = [];

  for (let _ = 1; _ <= m; _++) {
    const [u, v] = inputs[_].trim().split(' ').map(Number);

    edges.push([u - 1, v - 1]);
  }

  solve(n, m, s - 1, edges);
}();


Shubham has an array $$$a$$$ of size $$$n$$$, and wants to select exactly $$$x$$$ elements from it, such that their sum is odd. These elements do not have to be consecutive. The elements of the array are not guaranteed to be distinct.Tell him whether he can do so.

The first line of the input contains a single integer $$$t$$$ $$$(1\le t \le 100)$$$ — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$x$$$ $$$(1 \le x \le n \le 1000)$$$ — the length of the array and the number of elements you need to choose. The next line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 1000)$$$ — elements of the array.

For each test case, print "Yes" or "No" depending on whether it is possible to choose $$$x$$$ elements such that their sum is odd. You may print every letter in any case you want.

NoteFor $$$1$$$st case: We must select element $$$999$$$, and the sum is odd.For $$$2$$$nd case: We must select element $$$1000$$$, so overall sum is not odd.For $$$3$$$rd case: We can select element $$$51$$$.For $$$4$$$th case: We must select both elements $$$50$$$ and $$$51$$$  — so overall sum is odd.For $$$5$$$th case: We must select all elements  — but overall sum is not odd.

"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");
  }
}

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 => {

    // })
}

//↓見なくていいよ！ここから--------------------------------------------------
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';
// 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;
}

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");
	}
}

"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;
}


You've got a string $$$a_1, a_2, \dots, a_n$$$, consisting of zeros and ones.Let's call a sequence of consecutive elements $$$a_i, a_{i + 1}, \ldots, a_j$$$ ($$$1\leq i\leq j\leq n$$$) a substring of string $$$a$$$. You can apply the following operations any number of times:  Choose some substring of string $$$a$$$ (for example, you can choose entire string) and reverse it, paying $$$x$$$ coins for it (for example, «0101101» $$$\to$$$ «0111001»);  Choose some substring of string $$$a$$$ (for example, you can choose entire string or just one symbol) and replace each symbol to the opposite one (zeros are replaced by ones, and ones — by zeros), paying $$$y$$$ coins for it (for example, «0101101» $$$\to$$$ «0110001»). You can apply these operations in any order. It is allowed to apply the operations multiple times to the same substring.What is the minimum number of coins you need to spend to get a string consisting only of ones?

The first line of input contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \leq n \leq 300\,000, 0 \leq x, y \leq 10^9$$$) — length of the string, cost of the first operation (substring reverse) and cost of the second operation (inverting all elements of substring). The second line contains the string $$$a$$$ of length $$$n$$$, consisting of zeros and ones.

Print a single integer — the minimum total cost of operations you need to spend to get a string consisting only of ones. Print $$$0$$$, if you do not need to perform any operations.

NoteIn the first sample, at first you need to reverse substring $$$[1 \dots 2]$$$, and then you need to invert substring $$$[2 \dots 5]$$$. Then the string was changed as follows:«01000» $$$\to$$$ «10000» $$$\to$$$ «11111».The total cost of operations is $$$1 + 10 = 11$$$.In the second sample, at first you need to invert substring $$$[1 \dots 1]$$$, and then you need to invert substring $$$[3 \dots 5]$$$. Then the string was changed as follows:«01000» $$$\to$$$ «11000» $$$\to$$$ «11111».The overall cost is $$$1 + 1 = 2$$$.In the third example, string already consists only of ones, so the answer is $$$0$$$.

const CODEFORCES_NODE = "cf";
const CODEFORCES_V8 = "cf-v8";
const BEAKJOON = "bj";
const TEST = "test";
var SITE = CODEFORCES_NODE;
process.argv.forEach(function(val, index, array) {
  // console.log(index + ': ' + val);
  if (val.startsWith("site")) {
    switch (val.split("=")[1]) {
      case "test":
        // console.log('change site to test')
        SITE = TEST;
        break;
      case "cf-node":
        // console.log('change site to cf')
        SITE = CODEFORCES_NODE;
        break;
      case "cf":
        // console.log('change site to cf')
        SITE = CODEFORCES_NODE;
        break;
      case "cf-v8":
        // console.log('change site to cf')
        SITE = CODEFORCES_V8;
        break;
      case "bj":
        // console.log('change site to bj')
        SITE = BEAKJOON;
        break;
    }
  }
});

const DEBUG = SITE == "test";
const newLine = '\n';
if(CODEFORCES_NODE){  //NODE doesn't have readline so make it
  var readline;
  var print;
  print = console.log;
  var it;
}
var ans;
var text = "";
var lineCount = 0;
var lines;
function solve() {
  // const [n,b] = readInts();
  // const arr = readInts();
  // print(n, b);
  // print(arr);

  const [n,x,y] = readInts();
  const inp = readline();
  it(n,x,y);
  it(inp);
  var groups = [];
  var lastisgroup = false;
  for (let i = 0; i < inp.length; i++) {
    if(lastisgroup && inp[i] == 0){
      groups[groups.length - 1] += 1;
    }
    else if(!lastisgroup && inp[i] == 0){
      lastisgroup = true;
      groups.push(1);
    }
    if(lastisgroup && inp[i] == 1){
      lastisgroup = false;
    }
    else if(!lastisgroup && inp[i] == 1){

    }
  }
  if(groups.length == 0){
    print(0);
    return;
  }
  var ans = 9999999999999999999;
  for (let i = 1; i <= groups.length; i++) {
    let tmp = x * (groups.length - i) + (y * i)
    if(tmp < ans){
      it(ans, tmp);
      ans = tmp;
    }
  }
  print(ans);

}
function* getlines(text) {
  var lines = text.split(/\r?\n/);
  for (let line of lines) {
    yield line + newLine;
  }
}
function readline() {
  return lines.next().value.trim();
}
function readInts() {
  return readline()
    .split(" ")
    .map(function(x) {
      return parseInt(x);
    });
}
var input;
if (DEBUG) {
  var fs = require("fs");
  input = fs.createReadStream("input.txt", {encoding:"utf8"});
  it = print;
  // lines = getlines(fs.readFileSync("input.txt", "utf8"));
  // let data = "";
  // data += readline().toString();

  // data += readline().toString();
  // require("fs").writeFile("output.txt", data, "utf8", function(err) {
  //   console.log("비동기적 파일 쓰기 완료");
  // });
  // console.log(process.stdin);
}
else {
  input = process.stdin;
  it = function it(params) {
    return 0;
  }
}
if (CODEFORCES_NODE) {
  function inputListener(line) {
    if (!line) {
      closing();
    }
    lineCount++;
    text += line + "\r\n";
  }
  function closing(){
    lines = getlines(text);
    solve();
    process.exit();
  }
  function readlines() {
    const readline = require("readline");
    const rl = readline.createInterface({
      input,
      output: process.stdout,
      terminal: false
    });
    rl.on("line", inputListener);
    rl.on('close', closing);
  }
  readlines();
}
// console.log('hallo!!!')


You are given an integer array of length $$$n$$$.You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be equal to $$$[x, x + 1, \dots, x + k - 1]$$$ for some value $$$x$$$ and length $$$k$$$.Subsequence of an array can be obtained by erasing some (possibly zero) elements from the array. You can erase any elements, not necessarily going successively. The remaining elements preserve their order. For example, for the array $$$[5, 3, 1, 2, 4]$$$ the following arrays are subsequences: $$$[3]$$$, $$$[5, 3, 1, 2, 4]$$$, $$$[5, 1, 4]$$$, but the array $$$[1, 3]$$$ is not.

The first line of the input containing integer number $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the array. The second line of the input containing $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the array itself.

On the first line print $$$k$$$ — the maximum length of the subsequence of the given array that forms an increasing sequence of consecutive integers. On the second line print the sequence of the indices of the any maximum length subsequence of the given array that forms an increasing sequence of consecutive integers.

NoteAll valid answers for the first example (as sequences of indices):   $$$[1, 3, 5, 6]$$$  $$$[2, 3, 5, 6]$$$ All valid answers for the second example:   $$$[1, 4]$$$  $$$[2, 5]$$$  $$$[3, 6]$$$ All valid answers for the third example:   $$$[1]$$$  $$$[2]$$$  $$$[3]$$$  $$$[4]$$$ All valid answers for the fourth example:   $$$[1, 2, 3, 7, 8, 9]$$$

'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();

'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(' '))
}


Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Petya has two strings a and b of the same length n. The strings consist only of lucky digits. Petya can perform operations of two types:   replace any one digit from string a by its opposite (i.e., replace 4 by 7 and 7 by 4);  swap any pair of digits in string a. Petya is interested in the minimum number of operations that are needed to make string a equal to string b. Help him with the task.

The first and the second line contains strings a and b, correspondingly. Strings a and b have equal lengths and contain only lucky digits. The strings are not empty, their length does not exceed 105.

Print on the single line the single number — the minimum number of operations needed to convert string a into string b.

NoteIn the first sample it is enough simply to swap the first and the second digit.In the second sample we should replace the second digit with its opposite.In the third number we should replace all three digits with their opposites.

;(function () {

	print(function (a, b) {

		var t = [0, 0];

		a.forEach(function (e, i) { if (e !== b[i]) t[e === '4' ? 0 : 1]++; });

		return t.reduce(function (a, b) { return a + b; }) - Math.min.apply(null, t);

	}(readline().split(''), readline().split('')));

}.call(this));


Vasya has several phone books, in which he recorded the telephone numbers of his friends. Each of his friends can have one or several phone numbers.Vasya decided to organize information about the phone numbers of friends. You will be given n strings — all entries from Vasya's phone books. Each entry starts with a friend's name. Then follows the number of phone numbers in the current entry, and then the phone numbers themselves. It is possible that several identical phones are recorded in the same record.Vasya also believes that if the phone number a is a suffix of the phone number b (that is, the number b ends up with a), and both numbers are written by Vasya as the phone numbers of the same person, then a is recorded without the city code and it should not be taken into account.The task is to print organized information about the phone numbers of Vasya's friends. It is possible that two different people have the same number. If one person has two numbers x and y, and x is a suffix of y (that is, y ends in x), then you shouldn't print number x. If the number of a friend in the Vasya's phone books is recorded several times in the same format, it is necessary to take it into account exactly once.Read the examples to understand statement and format of the output better.

First line contains the integer n (1 ≤ n ≤ 20) — number of entries in Vasya's phone books.  The following n lines are followed by descriptions of the records in the format described in statement. Names of Vasya's friends are non-empty strings whose length does not exceed 10. They consists only of lowercase English letters. Number of phone numbers in one entry is not less than 1 is not more than 10. The telephone numbers consist of digits only. If you represent a phone number as a string, then its length will be in range from 1 to 10. Phone numbers can contain leading zeros.

Print out the ordered information about the phone numbers of Vasya's friends. First output m — number of friends that are found in Vasya's phone books. The following m lines must contain entries in the following format "name number_of_phone_numbers phone_numbers". Phone numbers should be separated by a space. Each record must contain all the phone numbers of current friend. Entries can be displayed in arbitrary order, phone numbers for one record can also be printed in arbitrary order.

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 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 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];
    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(' '));
}


Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it will go along a circle around this point and will remove all the snow from its path.Formally, we assume that Peter's machine is a polygon on a plane. Then, after the machine is switched on, it will make a circle around the point to which Peter tied it (this point lies strictly outside the polygon). That is, each of the points lying within or on the border of the polygon will move along the circular trajectory, with the center of the circle at the point to which Peter tied his machine.Peter decided to tie his car to point P and now he is wondering what is the area of the region that will be cleared from snow. Help him.

The first line of the input contains three integers — the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integers — coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on a common straight line. All the numbers in the input are integers that do not exceed 1 000 000 in their absolute value.

Print a single real value number — the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.  Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .

NoteIn the first sample snow will be removed from that area: