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

let c = 0;
let inc = 0;
let a = [];
let b = [];
let n = 0;
let k = 0;

const solve = (a, b) => {
  a = a.sort((x, y) => x - y);
  b = b.sort((x, y) => y - x);

  let idx = 0;

  for (let i = 0; i < k; i++) {
    if (b[idx] > a[i]) {
      a[i] = b[idx];
      idx++;
    }
  }

  return a.reduce((a, b) => a + b, 0);
};

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

  if (inc % 3 === 0) {
    a = [];
    b = [];
    [n, k] = d.split(" ").map(Number);
    inc++;
    return;
  }

  if (a.length === 0) {
    a = d.split(" ").map(Number);
  } else if (b.length === 0) {
    b = d.split(" ").map(Number);

    console.log(solve(a, b));
  }

  inc++;
  c++;
});

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("inputString", inputString)
    const tests = inputString.slice(1).map(item => item.split(" ").map(Number));
    //console.log("tests", tests)
    for (let i = 0; i < tests.length; i+=3) {
        const [n, k] = tests[i];
        const a = tests[i + 1];
        const b = tests[i + 2];

        const sortedA = a.sort((a, b) => a - b);
        let sortedB = b.sort((a, b) => b - a);

        let j = 0;
        while (sortedA[j] <= sortedB[0] && j < k) {
            let temp = sortedA[j];
            sortedA[j] = sortedB[0];
            sortedB[0] = temp;
            j++;
            sortedB = sortedB.sort((a, b) => b - a);
        }

        const sum = sortedA.reduce((acc, item) => acc + item, 0);
        console.log(sum);
    }
}

'use strict';

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 => string.trim());
    main();
});

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

let main = () => {
    let t = parseInt(readline());

    while(t--){
    	let [n, k] = readline().split(" ").map(Number);
    	let a = readline().split(" ").map(Number);
    	let b = readline().split(" ").map(Number);
    	b.sort((a, b) => a-b);
    	a.sort((a, b) => a-b);
    	let res = 0, ai = 0, bi = n-1;
    	while( ai < n ){
    		if( a[ai] < b[bi] && k > 0 ){
    			res += b[bi];
    			k--;
    			bi--;
    		}else{
    			res += a[ai];
    		}
    		ai++;
    	}

    	console.log(res);
    }
}

'use strict';

const parseProblem = (line, problem) => {
    if (!problem.T || problem.T === 0) {
        problem.T = parseInt(line);
        return problem;
    }

    const cases = problem.cases;

    if (cases.length === 0 || (cases[cases.length - 1].a && cases[cases.length - 1].b)) {
        cases.push({
            s: line
        });
    } else if(!cases[cases.length - 1].a) {
        cases[cases.length - 1].a = line;
    } else {
        cases[cases.length - 1].b = line;
    }

    const isProcessing = cases.length < problem.T || (!cases[cases.length - 1].a || !cases[cases.length - 1].b);
    problem.isProcessing = isProcessing;

    return problem;
};

const solve = data => {
    const [n, k] = data.s.split(' ').map(i => parseInt(i));
    const a = data.a.split(' ').map(i => parseInt(i));
    const b = data.b.split(' ').map(i => parseInt(i));

    for(let j = 0; j < k; j++) {
        a.sort((v1, v2) => +v1 - +v2);
        b.sort((v1, v2) => +v1 - +v2);
        if(a[0] < b[n - 1]) {
            const a0 = a[0];
            a[0] = b[n - 1];
            b[n - 1] = a0;
        }
    }

    let sum = a.reduce((i, val) => i + val);
    return sum;
}

const solveCases = cases => {
    for (let index = 0; index < cases.length; index++) {
        const result = solve(cases[index]);
        console.log(result);
    }
};

const main = () => {
    const readline = require('readline');

    let problem = {
        T: 0,
        cases: [],
        isProcessing: true
    };

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

    rl.on('line', line => {
        problem = parseProblem(line, problem);

        if (!problem.isProcessing) {
            rl.close();
        }
    }).on('close', () => {
        solveCases(problem.cases);
        process.exit(0);
    });
};

if (!module.parent) {
    main();
}

'use strict';
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(str => str.trim());

    main();
});

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

function main() {
    const T = parseInt(readLine(), 10);
    for (let t = 0; t < T; t++) {
        const [n, k] = readLine().split(" ").map(x => parseInt(x));
        let a = readLine().split(" ").map(x => parseInt(x));
        let b = readLine().split(" ").map(x => parseInt(x));
        a = a.sort((a1, b1) => {
            if (a1 > b1) return 1;
            else if (a1 < b1) return -1;
            else return 0;
        });
        b = b.sort((a1, b1) => {
            if (a1 > b1) return -1;
            else if (a1 < b1) return 1;
            else return 0;
        })
        for (let i = 0; i < k;i++) {
            if (a[i] < b[i]) {
                a[i] = b[i];
            }
        }
        const sum = a.reduce((pre, cur) => pre + cur, 0);
        console.log(sum)

    }
}

const readline = require('readline');

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

let tests = [];
rl.on('line', (line) => {
  tests.push(line.split(' ').map(v => +v));
}).on('close', () => {
  for (ii = 1; ii < tests.length; ii += 3) {
    const k = tests[ii][1];
    let a = tests[ii + 1].sort((x,y) => y - x);
    let b = tests[ii + 2].sort((x,y) => y - x);
    let i = 0;
    while (i < k && a[a.length - 1] < b[0]) {
      const lastA = a[a.length - 1];
      a = [b[0] ,...a.slice(0, a.length - 1)];
      b = [...b.slice(1), lastA];
      i++;
    }

    let maxA = 0;

    a.forEach(element => {
      maxA += element;
    });

    process.stdout.write(`${maxA}\n`);
  }
});

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");
});
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 K = one[1];
		var alist = nextIntArray();
		var blist = nextIntArray();
		alist.sort(function(a,b){
			return a - b;
		});
		blist.sort(function(a,b){
			return a - b;
		});
		for(var j = 0; j < K; j++){
			if(alist[0] >= blist[blist.length - 1]){
				break;
			}
			alist.shift();
			alist.push(blist.pop());
		}
		var sum = 0;
		for(var j = 0; j < N; j++){
			sum += alist[j];
		}
		output[i] = sum;
	}
	myout(myconv(output,9));
}

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 readNumbersArray() {
    return readLine().split(' ').map(num => Number(num));
}

function writeLine(str) {
    process.stdout.write(`${str}\n`);
}

function main() {
    let t = Number(readLine());
    while(t--) {
        const [n, k] = readNumbersArray();
        const a = readNumbersArray().sort((a, b) => a-b);
        const b = readNumbersArray().sort((a, b) => a-b);
        let arr = [];
        let sum = a.reduce((acc, cur) => acc + cur);
        for (let i = 0; i< k; i++) {
            arr.push(a[i], b[n-1-i]);
            sum -= a[i];
        }
        arr = arr.sort((a, b) => a-b).reverse();
        for (let i = 0; i < k; i++) {
            sum += arr[i];
        }
        console.log(sum);
    }
}

'use strict';

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 => string.trim());

    main();
});

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

function main() {
    const n = parseInt(readline());
    const arrays = [];

    for (let i = 0; i < n; i++) {
        arrays.push([
            readline().split(' ').map(o => parseInt(o)),
            readline().split(' ').map(o => parseInt(o)),
            readline().split(' ').map(o => parseInt(o)),
        ]);
    }

    arrays.forEach(([[n, k], a, b]) => {
        let sum = a.reduce((acc, oof) => acc + oof, 0);
        let remaining = k;
        let i = 0, j = n - 1;
        a.sort((x, y) => x - y);
        b.sort((x, y) => x - y);

        while (remaining && i < n && a[i] < b[j]) {
            if (b[j] > a[i]) {
                sum += (b[j] - a[i]);
                remaining--;
            }

            i++;
            j--;
        }

        console.log(sum);
    });
}

const processData = (lines) => {
  const n = +lines[0]
  for (let i=0; i<n; i++) {
    const [n, k] = lines[i*3+1].split(' ').map(x => +x)
    const a = lines[i*3+2].split(' ').map(x => +x)
    const b = lines[i*3+3].split(' ').map(x => +x)
    a.sort((a, b) => a - b)
    b.sort((a, b) => b - a)
    for (let j =0; j<k; j++) {
      if (a[j] >= b[j]) {
        break
      } else {
        a[j] = b[j]
      }
    }
    console.log(a.reduce((r, x) => r+x, 0))
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

// node template.js < A-small.in > A-small.out

function main() {
    var tests = 1;
    tests = nextInt();

    for (let t = 1; t <= tests; t++) {
        let N = nextInt(), K = nextInt();
        let a = [], b = [];
        for(let i = 0; i < N; i++) {
            a.push(nextInt());
        }
        for(let i = 0; i < N; i++) {
            b.push(nextInt());
        }

        while (K--) {
            let i = find(a, Math.min);
            let j = find(b, Math.max);
            if (a[i] > b[j]) {
                break;
            }
            let tmp = a[i];
            a[i] = b[j];
            b[j] = tmp;
        }

        let result = a.reduce((sum, v) => sum+v);

        print(result);
    }
}

function find(arr, func) {
    let result = 0;
    arr.forEach((_, idx) => {
        if (arr[idx] == func(arr[idx], arr[result])) {
            result = idx;
        }
    });
    return result;
}

// ------- Template ------------------
function newTensor(dimensions, value) {
    let res = [];
    let dim = dimensions[0], subdim = dimensions.slice(1);
    if (subdim.length == 0) {
        for(let i = 0; i < dim; i++) {
            res.push(value);
        }
    } else {
        for(let i = 0; i < dim; i++) {
            res.push(newTensor(subdim, value));
        }
    }
    return res;
}

if (!String.prototype.startsWith) {
    Object.defineProperty(String.prototype, 'startsWith', {
        value: function(search, rawPos) {
            var pos = rawPos > 0 ? rawPos|0 : 0;
            return this.substring(pos, pos + search.length) === search;
        }
    });
}
if (!String.prototype.endsWith) {
    String.prototype.endsWith = function(search, this_len) {
        if (this_len === undefined || this_len > this.length) {
            this_len = this.length;
        }
        return this.substring(this_len - search.length, this_len) === search;
    };
}

var curTokens = [], curToken = 0;

function next() {
    while (curToken >= curTokens.length) {
        curTokens = readline().split(/[\s]+/);
        curToken = 0;
    }
    return curTokens[curToken++];
}

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

// code for nodejs
var inputBuffer = '', curLine = 0;

function readline() {
    return inputBuffer[curLine++];
}

function print(data) {
    process.stdout.write(data + '\n');
}

process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    inputBuffer += chunk;
});

process.stdin.on('end', function () {
    inputBuffer = inputBuffer.split(/[\s]+/);
    main();
});

// Time Complexity O(n)
function processData(input) {
    input = input.trim().split('\n')
    var t = Number(input[0])
    // console.log(t)
    var line = 1
    for(var j = 0;j<t;j++){
        var [n,k] = input[line++].split(' ').map(a=>parseInt(a))
        var a = input[line++].split(' ').map(a=>parseInt(a)).sort((a,b)=>(a-b))
        var b = input[line++].split(' ').map(a=>parseInt(a)).sort((a,b)=>(b-a))
        // console.log(n,k,a,b)
        var res = findSum(n,k,a,b)
        console.log(res)

    }
    function findSum(n,k,a,b){
        var i = 0
        var sum = 0
        while(i <n && k>0){
            if(a[i] < b[i]){
                swap(a,b,i)
                k--
            }
            i++
        }
        // console.log(k)
        for(var l = 0;l<n;l++){
            sum+=a[l]
        }
        return sum
    }
    function swap(a,b,i){
        var temp =a[i]
        a[i] =b[i]
        b[i] = temp
    }
}

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
    _input += input;
});

process.stdin.on("end", function () {
   processData(_input);
});

// Sample code to perform I/O:

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

/**
 *
 * @param {*} str
 * @param {*} seperator
 */
function splitter(str, seperator = '') {
    return str.trim().split(seperator);
}

/**
 *
 * @param {*} arr
 */
function strToNumArr(arr = []) {
    return arr.map(num => Number(num));
}

/**
 *
 * @param {*} num1
 * @param {*} num2
 */
function matrixArray(num1, num2) {
    return Array(num1).fill(Array(num2));
}

let log = function () {
    return Function.prototype.bind.call(console.log, console, '');
}();

function removeEmptyItem(arr, index) {
    return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));
}

function range(min, max) {

    let arr = [];
    for (let index = min; index < max; index++) {
        arr.push(index);

    }
    return arr;
}

function main(input) {
    let output = nameLookUp(input);
    // process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(str) {

    let inputs = str.split('\n');
    let t = +inputs[0].trim();
    let cases = inputs.slice(1);
    let loopIndex = 0;
    for (let index = 0; index < t; index++) {

        if (cases[loopIndex] !== undefined && cases[loopIndex + 1] != undefined) {

            const element = cases[loopIndex].trim().split(' ');
            let kMove = +element[1];
            let a = strToNumArr(cases[loopIndex + 1].trim().split(' ')).sort((a, b) => a - b);
            let b = strToNumArr(cases[loopIndex + 2].trim().split(' ')).sort((a, b) => b - a);

            for (let j = 0; j < kMove; j++) {
                if (a[j] < b[j]) {
                    let temp = a[j];
                    a[j] = b[j];
                    b[j] = temp;
                }
            }

            console.log(a.reduce((a, b) => { return a + b }, 0));

            loopIndex += 3;
        }
    }

}

'use strict';

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++];
}
/**
    5
    2 1
    1 2
    3 4
    5 5
    5 5 6 6 5
    1 2 5 4 3
    5 3
    1 2 3 4 5
    10 9 10 10 9
    4 0
    2 2 4 3
    2 4 2 3
    4 4
    1 2 2 1
    4 4 5 4

**/

function gcd(a, b) {
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
};

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let [n, swap] = readline().split(" ").map(Number);
        let a = readline().split(" ").map(Number);
        let b = readline().split(" ").map(Number);

        let min, max;
        let minI, maxJ;

        while(swap) {
            min = Math.min(...a);
            max = Math.max(...b);
            minI = a.indexOf(min);
            maxJ = b.indexOf(max);

            if(min < max) {
                a[minI] = max;
                b[maxJ] = 0;
            }

            swap--;
        }

        let sum = a.reduce((a, b) => a + b, 0);
        console.log(sum);
    }
}

var tescaseNumber = readline();
tescaseNumber = parseInt(tescaseNumber);

function findIndexOf(arr, type) {
    var index = 0;
    for (var i in arr) {
        if (type == 'min') {
            if (parseInt(arr[index]) > parseInt(arr[i])) {
                index = i;
            }
        } else {
            if (parseInt(arr[index]) < parseInt(arr[i])) {
                index = i;
            }
        }

    }

    return index;
}

var currentTestCase = 1;
while (currentTestCase <= tescaseNumber) {
    var input = readline().split(" ");
    var n = parseInt(input[0]);
    var k = parseInt(input[1]);
    var a = readline().split(" ");
    var b = readline().split(" ");

    var step = 1;
    while (step <= k) {
        var minIndexA = findIndexOf(a, 'min');
        var maxindexB = findIndexOf(b, 'max');

        if (parseInt(a[minIndexA]) >= parseInt(b[maxindexB])) {
            break;
        }

        var temp = a[minIndexA];
        a[minIndexA] = b[maxindexB];
        b[maxindexB] = temp;

        step += 1;
    }

    var total = 0;
    for (var element of a) {
        total += parseInt(element);
    }

    print(total);
    currentTestCase += 1;
}

var t = parseInt(readline());

for (var tc = 0; tc < t; tc++) {
  var nk = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var n = nk[0],
    k = nk[1];
  var a = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var b = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var sum = a.reduce((acc, val) => {
    acc += val;
    return acc;
  }, 0);

  a = a.sort((a, b) => a - b);
  b = b.sort((a, b) => b - a);
  for (var i = 0; i < k; i++) {
    if (a[i] < b[i]) {
      sum += b[i] - a[i];
    } else break;
  }
  print(sum);
}

function comp(a,b) { return a-b; }
function solve(n,k,a,b) {
    a.sort(comp);
    b.sort(comp);
    var sum = 0;
    for (var i=0; i<n; i++) {
        if ((i < k) && (b[n-i-1] > a[i]))
            a[i] = b[n-i-1];
        sum += a[i];
    }
    return sum;
}
var tc = Number(readline());
while (tc--) {
  var inputArr = readline().split(" ").map(function(x) { return +x });
  var n = inputArr[0];
  var k = inputArr[1];
  var a = readline().split(" ").map(function(x) { return +x });
  var b = readline().split(" ").map(function(x) { return +x });
  print(solve(n,k,a,b));
}

'use strict';

const parseProblem = (line, problem) => {
    if (!problem.T || problem.T === 0) {
        problem.T = parseInt(line);
        return problem;
    }

    const cases = problem.cases;

    if (cases.length === 0 || (cases[cases.length - 1].a && cases[cases.length - 1].b)) {
        cases.push({
            s: line
        });
    } else if(!cases[cases.length - 1].a) {
        cases[cases.length - 1].a = line;
    } else {
        cases[cases.length - 1].b = line;
    }

    const isProcessing = cases.length < problem.T || (!cases[cases.length - 1].a || !cases[cases.length - 1].b);
    problem.isProcessing = isProcessing;

    return problem;
};

const solve = data => {
    const [n, k] = data.s.split(' ').map(i => +i);
    const a = data.a.split(' ').map(i => +i);
    const b = data.b.split(' ').map(i => +i);

    a.sort();
    b.sort((v1, v2) => v2 > v1);

    for(let j = 0; j < k; j++) {
        if(a[j] < b[j]) {
            const aj = a[j];
            a[j] = b[j];
            b[j] = aj;
        }
    }

    let sum = a.reduce((i, val) => i + val);
    return sum;
}

const solveCases = cases => {
    for (let index = 0; index < cases.length; index++) {
        const result = solve(cases[index]);
        console.log(result);
    }
};

const main = () => {
    const readline = require('readline');

    let problem = {
        T: 0,
        cases: [],
        isProcessing: true
    };

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

    rl.on('line', line => {
        problem = parseProblem(line, problem);

        if (!problem.isProcessing) {
            rl.close();
        }
    }).on('close', () => {
        solveCases(problem.cases);
        process.exit(0);
    });
};

if (!module.parent) {
    main();
}

'use strict';
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(str => str.trim());

    main();
});

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

function main() {
    const T = parseInt(readLine(), 10);
    for (let t = 0; t < T; t++) {
        const [n, k] = readLine().split(" ").map(x => parseInt(x));
        let a = readLine().split(" ").map(x => parseInt(x));
        let b = readLine().split(" ").map(x => parseInt(x));
        a = a.sort();
        b = b.sort((a1, b1) => {
            if (a1 > b1) return -1;
            else if (a1 < b1) return 1;
            else return 0;
        })
        for (let i = 0; i < k; i++) {
            if (a[i] < b[i]) {
                a[i] = b[i];
            } else break;
        }
        const sum = a.reduce((pre, cur) => pre + cur, 0);
        console.log(sum)

    }
}

'use strict';
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(str => str.trim());

    main();
});

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

function main() {
    const T = parseInt(readLine(), 10);
    for (let t = 0; t < T; t++) {
        const [n, k] = readLine().split(" ").map(x => parseInt(x));
        let a = readLine().split(" ").map(x => parseInt(x));
        let b = readLine().split(" ").map(x => parseInt(x));
        a = a.sort();
        b = b.sort((a1, b1) => {
            if (a1 > b1) return -1;
            else if (a1 < b1) return 1;
            else return 0;
        })
        for (let i = 0; i < k;i++) {
            if (a[i] < b[i]) {
                a[i] = b[i];
            }
        }
        const sum = a.reduce((pre, cur) => pre + cur, 0);
        console.log(sum)

    }
}

'use strict';
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(str => str.trim());

    main();
});

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

function main() {
    const T = parseInt(readLine(), 10);
    for (let t = 0; t < T; t++) {
        const [n, k] = readLine().split(" ").map(x => parseInt(x));
        let a = readLine().split(" ").map(x => parseInt(x));
        let b = readLine().split(" ").map(x => parseInt(x));
        a = a.sort();
        b = b.sort((a1, b1) => {
            if (a1 > b1) return -1;
            else if (a1 < b1) return 1;
            else return 0;
        })
        for (let i = 0; i < k && i < n; i++) {
            if (a[i] < b[i]) {
                a[i] = b[i];
            } else break;
        }
        const sum = a.reduce((pre, cur) => pre + cur, 0);
        console.log(sum)

    }
}

const readline = require('readline');

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

let tests = [];
rl.on('line', (line) => {
  tests.push(line.split(' ').map(v => +v));
}).on('close', () => {
  for (ii = 1; ii < tests.length; ii += 3) {
    const k = tests[ii][1];
    let a = tests[ii + 1].sort((x,y) => x < y);
    let b = tests[ii + 2].sort((x,y) => x < y);

    let i = 0;
    while (i < k && a[a.length - 1] < b[0]) {
      const lastA = a[a.length - 1];
      a = [b[0] ,...a.slice(0, a.length - 1)];
      b = [...b.slice(1), lastA];
      i++;
    }

    let maxA = 0;

    a.forEach(element => {
      maxA += element;
    });

    process.stdout.write(`${maxA}\n`);
  }
});

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");
});
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 K = one[1];
		var alist = nextIntArray();
		var blist = nextIntArray();
		alist.sort(function(a,b){
			return a - b;
		});
		blist.sort(function(a,b){
			return a - b;
		});
		for(var j = 0; j < K; j++){
			alist.shift();
			alist.push(blist.pop());
		}
		var sum = 0;
		for(var j = 0; j < N; j++){
			sum += alist[j];
		}
		output[i] = sum;
	}
	myout(myconv(output,9));
}

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 readNumbersArray() {
    return readLine().split(' ').map(num => Number(num));
}

function writeLine(str) {
    process.stdout.write(`${str}\n`);
}

function main() {
    let t = Number(readLine());
    while(t--) {
        const [n, k] = readNumbersArray();
        const a = readNumbersArray().sort();
        const b = readNumbersArray().sort();
        let arr = [];
        let sum = a.reduce((acc, cur) => acc + cur);
        for (let i = 0; i< k; i++) {
            arr.push(a[i], b[n-1-i]);
            sum -= a[i];
        }
        arr = arr.sort().reverse();
        for (let i = 0; i < k; i++) {
            sum += arr[i];
        }
        console.log(sum);
    }
}

'use strict';

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 => string.trim());

    main();
});

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

function main() {
    const n = parseInt(readline());
    const arrays = [];

    for (let i = 0; i < n; i++) {
        arrays.push([
            readline().split(' ').map(o => parseInt(o)),
            readline().split(' ').map(o => parseInt(o)),
            readline().split(' ').map(o => parseInt(o)),
        ]);
    }

    arrays.forEach(([[n, k], a, b]) => {
        let sum = a.reduce((acc, oof) => acc + oof, 0);
        let remaining = k;
        let i = 0, j = n - 1;
        a.sort((x, y) => x - y);
        b.sort((x, y) => x - y);

        while (remaining && i <= j) {
            if (b[j] > a[i]) {
                sum += (b[j] - a[i]);
                remaining--;
            }

            i++;
            j--;
        }

        console.log(sum);
    });
}

// node template.js < A-small.in > A-small.out

function main() {
    var tests = 1;
    tests = nextInt();

    for (let t = 1; t <= tests; t++) {
        let N = nextInt(), K = nextInt();
        let a = [], b = [];
        for(let i = 0; i < N; i++) {
            a.push(nextInt());
        }
        for(let i = 0; i < N; i++) {
            b.push(nextInt());
        }

        while (K--) {
            let i = find(a, Math.min);
            let j = find(b, Math.max);
            let tmp = a[i];
            a[i] = b[j];
            b[j] = tmp;
        }

        let result = a.reduce((sum, v) => sum+v);

        print(result);
    }
}

function find(arr, func) {
    let result = 0;
    arr.forEach((_, idx) => {
        if (arr[idx] == func(arr[idx], arr[result])) {
            result = idx;
        }
    });
    return result;
}

// ------- Template ------------------
function newTensor(dimensions, value) {
    let res = [];
    let dim = dimensions[0], subdim = dimensions.slice(1);
    if (subdim.length == 0) {
        for(let i = 0; i < dim; i++) {
            res.push(value);
        }
    } else {
        for(let i = 0; i < dim; i++) {
            res.push(newTensor(subdim, value));
        }
    }
    return res;
}

if (!String.prototype.startsWith) {
    Object.defineProperty(String.prototype, 'startsWith', {
        value: function(search, rawPos) {
            var pos = rawPos > 0 ? rawPos|0 : 0;
            return this.substring(pos, pos + search.length) === search;
        }
    });
}
if (!String.prototype.endsWith) {
    String.prototype.endsWith = function(search, this_len) {
        if (this_len === undefined || this_len > this.length) {
            this_len = this.length;
        }
        return this.substring(this_len - search.length, this_len) === search;
    };
}

var curTokens = [], curToken = 0;

function next() {
    while (curToken >= curTokens.length) {
        curTokens = readline().split(/[\s]+/);
        curToken = 0;
    }
    return curTokens[curToken++];
}

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

// code for nodejs
var inputBuffer = '', curLine = 0;

function readline() {
    return inputBuffer[curLine++];
}

function print(data) {
    process.stdout.write(data + '\n');
}

process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    inputBuffer += chunk;
});

process.stdin.on('end', function () {
    inputBuffer = inputBuffer.split(/[\s]+/);
    main();
});

// Sample code to perform I/O:

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

/**
 *
 * @param {*} str
 * @param {*} seperator
 */
function splitter(str, seperator = '') {
    return str.trim().split(seperator);
}

/**
 *
 * @param {*} arr
 */
function strToNumArr(arr = []) {
    return arr.map(num => Number(num));
}

/**
 *
 * @param {*} num1
 * @param {*} num2
 */
function matrixArray(num1, num2) {
    return Array(num1).fill(Array(num2));
}

let log = function () {
    return Function.prototype.bind.call(console.log, console, '');
}();

function removeEmptyItem(arr, index) {
    return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));
}

function range(min, max) {

    let arr = [];
    for (let index = min; index < max; index++) {
        arr.push(index);

    }
    return arr;
}

function main(input) {
    let output = nameLookUp(input);
    // process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(str) {

    let inputs = str.split('\n');
    let t = +inputs[0].trim();
    let cases = inputs.slice(1);
    let loopIndex = 0;
    for (let index = 0; index < t; index++) {
        const element = cases[loopIndex].trim().split(' ');
        let kMove = +element[1];
        let a = strToNumArr(cases[loopIndex + 1].trim().split(' '));
        let b = strToNumArr(cases[loopIndex + 2].trim().split(' ')).sort((a, b) => b - a);

        for (let j = 0; j < kMove; j++) {
            if (a[j] < b[j]) {
                let temp = a[j];
                a[j] = b[j];
                b[j] = temp;
            }
        }

        console.log(a.reduce((a, b) => { return a + b }, 0));

        loopIndex += 3;

    }

}

'use strict';

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++];
}
/**
    5
    2 1
    1 2
    3 4
    5 5
    5 5 6 6 5
    1 2 5 4 3
    5 3
    1 2 3 4 5
    10 9 10 10 9
    4 0
    2 2 4 3
    2 4 2 3
    4 4
    1 2 2 1
    4 4 5 4

**/

function gcd(a, b) {
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
};

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let [n, swap] = readline().split(" ").map(Number);
        let a = readline().split(" ").map(Number);
        let b = readline().split(" ").map(Number);

        let min, max;
        let minI, maxJ;

        let sumA = a.reduce((a,b) => a+b, 0);
        let sumB = b.reduce((a,b) => a + b, 0);

        if(sumA < sumB) {
            while(swap) {
            min = Math.min(...a);
            max = Math.max(...b);
            minI = a.indexOf(min);
            maxJ = b.indexOf(max);

            a[minI] = max;
            b[maxJ] = 0;
            swap--;
            }
        }

        let sum = a.reduce((a, b) => a + b, 0);
        console.log(sum);
    }
}

var t = parseInt(readline());

for (var tc = 0; tc < t; tc++) {
  var nk = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var n = nk[0],
    k = nk[1];
  var a = readline()
    .split("")
    .map((val) => parseInt(val));
  var b = readline()
    .split("")
    .map((val) => parseInt(val));
  var sum = a.reduce((acc, val) => {
    acc += val;
    return acc;
  }, 0);
  a = a.sort((a, b) => a - b);
  b = b.sort((a, b) => b - a);
  for (var i = 0; i < k; i++) {
    if (a[i] < a[b]) {
      sum += b[i] - a[i];
    } else break;
  }
  print(sum);
}

var t = parseInt(readline());

for (var tc = 0; tc < t; tc++) {
  var nk = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var n = nk[0],
    k = nk[1];
  var a = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var b = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var sum = a.reduce((acc, val) => {
    acc += val;
    return acc;
  }, 0);
  a = a.sort((a, b) => a - b);
  b = b.sort((a, b) => b - a);
  for (var i = 0; i < k; i++) {
    if (a[i] < a[b]) {
      sum += b[i] - a[i];
    } else break;
  }
  print(sum);
}


var i,a = readline(), b = readline();

i=0;
while(a[i]=='0') i++;
if(i>0) a=a.substring(i,a.length);
a=a.split('');

i=0;
while(b[i]=='0') i++;
if(i>0) b=b.substring(i,b.length);
b=b.split('');

var found = false;
if(a.length === b.length) {

    for(var i=0;i<a.length;i++)
      if(a[i]>b[i]) {
           print('>');found =true;break;
      } else if(a[i]<b[i]) {
          print('<');found =true;break;
       }

   if(!found) { print('=');}
}
else {
  if(a.length>b.length)print('>');
else print('<');
}

var s1 = readline();
var s2 = readline();

function trim(s) {
    var a = -1;
    for (var i = 0; i < s.length; i++) {
        if (s[i] != '0')
            return s.substr(i);
    }
    return '0';
}

function cmp(s1, s2) {
    s1 = trim(s1);
    s2 = trim(s2);
    if (s1.length == s2.length) {
        for (var i = 0; i < s1.length; i++) {
            var v = s1.codePointAt(i) - s2.codePointAt(i);
            if (v == 0) {
                continue;
            } else {
                print(v > 0 ? '>' : '<');
                return;
            }
        }
        print('=');
    } else {
        print(s1.length > s2.length ? '>' : '<')
    }
}
cmp(s1, s2);

//main.apply(0, readNums());
//function main(n, m) {
//}
//function readNums() {
//    return readline().split(' ').map(function(v) {
//        return v - 0;
//    })
//}
//function readline() {
//    return '00012345'
//}
//function print(v) {
//    console.log(v)
//}

var n1 = readline();
var n2 = readline();

function compare(a, b) {
    while (true) {

        if (a.length == 0 || b.length == 0) return "=";

        var a0 = a.charAt(0);
        var b0 = b.charAt(0);

        if (a.length == b.length) {
            if (a0 > b0) return ">";
            else if (a0 < b0) return "<";
            else if (a0 == b0) {
                a = a.substr(1);
                b = b.substr(1);
            }
        }
        else if (a.length > b.length) {
            if (a0 == "0") a = a.substr(1);
            else return ">";
        }
        else if (a.length < b.length) {
            if (b0 == "0") b = b.substr(1);
            else return "<";
        }

    }
}
print(compare(n1, n2));

var i,a = readline(), b = readline();

i=0;
while(a[i]=='0') i++;
if(i>0) a=a.substring(i,a.length);
a=a.split('');

i=0;
while(b[i]=='0') i++;
if(i>0) b=b.substring(i,b.length);
b=b.split('');

var found = false;
if(a.length === b.length) {

    for(var i=0;i<a.length;i++)
      if(a[i]>b[i]) {
           print('>');found =true;break;
      } else if(a[i]<b[i]) {
          print('<');found =true;break;
       }

   if(!found) { print('=');}
}
else {
  if(a.length>b.length)print('>..');
else print('<.');
}

var i,a = readline(), b = readline();

i=0;
while(a[i]=='0') i++;
if(i>0) a=a.substring(i,a.length);
a=a.split('');

i=0;
while(b[i]=='0') i++;
if(i>0) b=b.substring(i,b.length);
b=b.split('');

var found = false;
if(a.length === b.length) {

    for(var i=0;i<a.length;i++)
      if(a[i]>b[i]) {
           print('>');found =true;
      } else if(a[i]<b[i]) {
          print('<');found =true;
       }

   if(!found) print('=');
}
else {
  if(a.length>b.length)print('>');
else print('<');
}


(function main() {
      readline();
      var input = readline().split(' ');
      var output = '';
      var nulls = 0;
      var flag = false;
      /*if (input.length === 1) {
        print(input[0]);
        return 0;
      }*/
      function isBeautiful(str) {
        var len = str.length;

        if (str[0] !== '1' && str[0] !== '0') return false;
        for (var i = 1; i < len; i++)
          if (str[i] !== '0') return false;
        return true;
      }
      try {

        input.forEach(function (s) {
          if (s === '0') {
            print('0');
            throw false;
          }
          if (flag || isBeautiful(s)) {
            nulls += s.length - 1;
          } else {
            output = s;
            flag = true;
          }
        });
      } catch (e) {
        if (e === false)
          return 0;
        else
          throw e;
      }
      if (!flag) {
        output += '1';
      }
      for (var i = 0; i < nulls; i++)
        output += '0';
      print(output);
      return 0;
}());

    (function f()
    {
         var n = +readline();
         var k0=0;
         var kr=null;
         var m = readline().split(' ');
         //for (var i =0 ;i<m.length;i++) m[i] = +m[i];
         mm:for (var i = 0 ;i< m.length; i++)
         {
            if (m[i]=='0') {print(0); return 0;}
            if (m[i][0]!='1') {kr = m[i]; continue;}
            for (var j = 1;j<m[i].length;j++) if (m[i][j]!='0') {kr = m[i]; continue mm;}
            k0 += m[i].length-1;
         }
         if (kr === null) kr='1';
         var res = kr;
         //alert(k0);
         //alert(res);
         for (i = 0; i<k0;i++) res+='0';
         print(res);})()

         var n = new Object(0);

         var n = +readline();
         var k0=0;
         var kr;
         var m = readline().split(' ');
         //for (var i =0 ;i<m.length;i++) m[i] = +m[i];
         for (var i = 0 ;i< m.length; i++)
         {
            if (m[i][0]!='1') {kr = m[i]; break;}
            for (var i = 1;i<=m[i].length;i++) {if (m[i]!='0') kr = m[i]; break;}
            k0 += m[i].length-1;
         }
         var res = kr;
         for (i = 0; i<k0;i++) m+='0';
         print(res);

         var n = +readline();
         var k0=0;
         var kr=null;
         var m = readline().split(' ');
         //for (var i =0 ;i<m.length;i++) m[i] = +m[i];
         mm:for (var i = 0 ;i< m.length; i++)
         {

            if (m[i][0]!='1') {kr = m[i]; continue;}
            for (var j = 1;j<m[i].length;j++) if (m[i][j]!='0') {kr = m[i]; continue mm;}
            k0 += m[i].length-1;
         }
         if (kr === null) kr='1';
         var res = kr;
         //alert(k0);
         //alert(res);
         for (i = 0; i<k0;i++) res+='0';
         print(res);

(function main() {
      readline();
      var input = readline().split(' ');
      var output = '';
      var nulls = 0;
      function isBeautiful(str) {
        var len = str.length;

        if (str[0] !== '1' && str[0] !== '0') return false;
        for (var i = 1; i < len; i++)
          if (str[i] !== '0') return false;
        return true;
      }
      try {
        input.forEach(function (s) {
          if (s === '0') {
            print('0');
            throw false;
          }
          if (isBeautiful(s)) {
            nulls += s.length - 1;
          } else {
            output = s;
          }
        });
      } catch (e) {
        if (e === false)
          return 0;
        else
          throw e;
      }

      for (var i = 0; i < nulls; i++)
        output += '0';
      print(output);
      return 0;
  }());


var tc = parseInt(readline());
while(tc--){
    var ar = readline().split(' ').map(x => parseInt(x));
    print(ar[1]-ar[0] >= ar[0] ? "NO" : "YES");
}

var n = parseInt(readline());

for(var it=0;it<n;it++){
    var ar = readline().split(" ").map(item=>parseInt(item));
    var item1 = ar[0];
    var item2 = ar[1];
    print( item1*2>item2? "YES":"NO" )
}

 var testCasesNumber = readline();
var listOfRange = [];

//Saisie des données

for (var i = 0; i < testCasesNumber; i++) {
    listOfRange.push(readline().split(' '));
    }
for (var i = 0; i < testCasesNumber; i++) {
    print(parseInt(listOfRange[i][1])-parseInt(listOfRange[i][0]) >= parseInt(listOfRange[i][0]) ? 'NO' : 'YES');
    }

var t = +readline();

for (var i = 0; i < t; i++) {
  var p = readline().split(" ").map(x => +x);
  var l = p[0];
  var r = p[1];

  if (l * 2 > r) {
    print("YES");
  } else {
    print("NO");
  }
}

var testcases = parseInt(readline());

while(testcases--)
{
    var ar = readline().split(' ').map(x => parseInt(x));

    if(ar[0] * 2 > ar[1]) {
        print("YES");
    } else {
        print("NO");
    }
}

const solve = (l, r) => {
    return 2 * l > r ? 'YES' : 'NO';
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = Number(input[0][0]);
        let i = 1;
        while (t > 0) {
            let data = input.slice(i, i + 1);
            console.log(solve(data[0][0], data[0][1]));
            t--;
            i++;
        }
    });
};

main()

var tc = parseInt(readline());
for (; tc--;){
    var Ar = readline().split(' ').map(x => parseInt(x));
    var n = Ar[0], m = Ar[1];
    print(m - n >= n ? 'NO' : 'YES');
}

function main() {
    let n = stdin[0];
    let x=[],y=[];
    for(let i=0;i<n;i++){
        x.push(stdin[2*i+1]);
        y.push(stdin[2*i+2]);
    }
    for(let i=0;i<n;i++){
        if(x[i]*2>y[i]){
            console.log('YES');
        }
        else{
            console.log('NO');
        }
    }
}

const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
var stdin = [];
rl.on('line', function (line) {line.split(' ').map(c => stdin.push(parseInt(c)))});
rl.on('close', main);

var tc = parseInt(readline());
while(tc--){
    var AR = readline().split(' ').map(x => parseInt(x));
    var n = AR[0], m = AR[1];
    print(m-n >= n ? 'NO' : 'YES');
}

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
const sub = (a, b) => mod(mod(a) - mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}
function pow(base, n) {
  if (n === 0) return 1;
  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));
  if (n % 2 === 1) res = mul(mod(res), base);
  return res;
}
function highestOneBit(i) {
  i |= i >> 1;
  i |= i >> 2;
  i |= i >> 4;
  i |= i >> 8;
  i |= i >> 16;
  return i - (i >>> 1);
}
function permutation(arr, len, store = "", permutations = []) {
  if (store.length === len) {
    permutations.push(store);
    return;
  }
  for (let i = 0; i < arr.length; i++) {
    const newArr = [...arr];
    const newChar = newArr.splice(i, 1);
    permutation(newArr, len, store.concat(newChar), permutations);
  }
  return permutations;
}

function main() {
  let t = +readLine();
  while (t--) {
    const [a, b] = readLine().split(" ").map(Number);
    if (b >= 2 * a) console.log("NO");
    else console.log("YES");
  }
}

//Don't have to see. start------------------------------------------
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);
	console.error('\n↑入力 ↓出力');
	Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
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){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
	};
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
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;}}

//Don't have to see. end------------------------------------------
function Main(){
  var t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
    var one = nextIntArray();
    var L = one[0];
    var R = one[1];
    output[i] = (L * 2 > R) ? "YES" : "NO";
  }
  myout(myconv(output, 9));
}

let inputString = '';
let currentLine = 0;

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

process.stdin.on('end', function() {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function getAns(start, end) {
    if ((end + 1)/2 <= start) return 'YES';
    else return 'NO'
}

function main() {

    const t = parseInt(readLine(), 10);

    for (let tItr = 0; tItr < t; tItr++) {
        const [start, end] = readLine().split(' ').map(arrTemp => parseInt(arrTemp, 10));

        const result = getAns(start, end);

        console.log(result + '\n');
    }
}

'use strict'
const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin
});
var count=0,
    arr=[],
    a,x,
    mod=0,
    div=0;
rl.question('', (nb) => {
  rl.on('line', (TC) => {
    arr = TC.split(' ');
    a = Number(arr[0]); //l
    x = Number(arr[1]);
    div = x/2; //r
    if(a<=div){console.log("NO")}
    else{console.log("YES")}
    count++;
    if (count == nb) {
      rl.close();
    }
  });
});

(()=>{"use strict";var t={675:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),Array.numbersMatrix=(t,e,r)=>{let n=[];null==t&&(e=t),null==r&&(r=0);for(let o=0;o<t;++o){let t=[];for(let n=0;n<e;++n)t.push(r);n.push(t)}return n},Array.prototype.sortAsc=function(){return this.sort(((t,e)=>t-e))},Array.prototype.sortDesc=function(){return this.sort(((t,e)=>e-t))},Array.prototype.max=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.max(t,this[e]);return t},Array.prototype.min=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.min(t,this[e]);return t},Array.prototype.sum=function(){let t=0;for(let e=0;e<this.length;++e)t+=this[e];return t},Array.prototype.modSum=function(t){let e=0;for(let r=0;r<this.length;++r)e+=this[r],e%=t;return e},Array.prototype.avg=function(){return this.sum()/this.length},Array.prototype.groupBy=function(t){let e=new Map;for(let r=0;r<this.length;++r){const n=t(this[r]);e.has(n)?e.get(n).push(this[r]):e.set(n,[this[r]])}return e},Array.prototype.deepCopy=function(){let t=[];if(0==this.length)return t;let e=!1;Array.isArray(this[0])&&(e=!0);for(let r=0;r<this.length;++r)e?t.push(this[r].deepCopy()):t.push(this[r]);return t},Array.prototype.transpose=function(){let t=[];if(0==this.length)return[[]];for(let e=0;e<this[0].length;++e){let r=[];for(let t=0;t<this.length;++t)r.push(this[t][e]);t.push(r)}return t},Array.prototype.toString=function(){if(0==this.length)return"";if(!Array.isArray(this[0]))return this.join(" ");let t="";for(let e=0;e<this.length;++e)t+=this[e].join(" "),e!=this.length-1&&(t+="\n");return t}},312:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(r(747));let s="",i=[],u=0,l="";const h="local"===process.argv[2],p=t=>{if(h){if(i=o.default.readFileSync("input.txt").toString().trim().split("\n").map((t=>t.trim())),t(),o.default.writeFileSync("output.txt",l),console.log(l),o.default.readFileSync("expected.txt").toString().trim()==l.trim()){const{exec:t}=r(129);t("osascript -e 'display notification \"✅ AC!!\"'")}}else process.stdin.resume(),process.stdin.setEncoding("utf-8"),process.stdin.on("data",(t=>{s+=t})),process.stdin.on("end",(e=>{i=s.trim().split("\n").map((t=>t.trim())),t(),console.log(l)}))};function a(){return i[u++]}function f(){return a().split(" ").map((t=>parseFloat(t)))}function c(){return a().split("")}e.default={runMain:p,runEachTest:t=>{p((()=>{let[e]=f();for(;e>0;)t(),e--}))},readline:a,nextNumbers:f,nextNumbersMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(f());return e},nextCharacters:c,nextCharacterMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(c());return e},nextIntervalArray:function(t){let e=[];for(let r=0;r<t;++r){const[t,r]=f();e.push({a:t,b:r})}return e},put:function(t){l+=t},puts:function(t){l+=t+"\n"},debug:function(t){h&&console.log(t)}}},965:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),r(675);const o=n(r(312));o.default.runEachTest((function(){let[t,e]=o.default.nextNumbers();o.default.puts(2*t>e?"YES":"NO")}))},129:t=>{t.exports=require("child_process")},747:t=>{t.exports=require("fs")}},e={};!function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}(965)})();

// Solution written in typescript and compiled via webpack. Original source code below
// Happy Hacking 😜

// import './array'
//
// import io from './io'
//
// function main() {
//   let [l, r] = io.nextNumbers()
//
//   io.puts(l * 2 > r ? "YES" : "NO")
// }
//
// io.runEachTest(main)
// // io.runMain(main)

'use strict';

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++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();
    for (let i = 0; i < x; i++) {
        const y = readline().split(" ")
        if (Number(y[0]) * 2 > Number(y[1])) {
            console.log("YES")
        } else {
            console.log("NO")
        }
    }
}

var testcase = parseInt(readline())
while(testcase--)
{
    var l = parseInt(readline())
    var r = parseInt(readline())

    if(2 * l > r) {
        print("YES")
    } else {
        print("NO")
    }
}

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
const sub = (a, b) => mod(mod(a) - mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}
function pow(base, n) {
  if (n === 0) return 1;
  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));
  if (n % 2 === 1) res = mul(mod(res), base);
  return res;
}
function highestOneBit(i) {
  i |= i >> 1;
  i |= i >> 2;
  i |= i >> 4;
  i |= i >> 8;
  i |= i >> 16;
  return i - (i >>> 1);
}
function permutation(arr, len, store = "", permutations = []) {
  if (store.length === len) {
    permutations.push(store);
    return;
  }
  for (let i = 0; i < arr.length; i++) {
    const newArr = [...arr];
    const newChar = newArr.splice(i, 1);
    permutation(newArr, len, store.concat(newChar), permutations);
  }
  return permutations;
}

function main() {
  let t = +readLine();
  while (t--) {
    const [a, b] = readLine().split(" ").map(Number);
    if (a === 1 || b === 1) console.log("NO");
    else console.log("YES");
  }
}

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
const sub = (a, b) => mod(mod(a) - mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}
function pow(base, n) {
  if (n === 0) return 1;
  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));
  if (n % 2 === 1) res = mul(mod(res), base);
  return res;
}
function highestOneBit(i) {
  i |= i >> 1;
  i |= i >> 2;
  i |= i >> 4;
  i |= i >> 8;
  i |= i >> 16;
  return i - (i >>> 1);
}
function permutation(arr, len, store = "", permutations = []) {
  if (store.length === len) {
    permutations.push(store);
    return;
  }
  for (let i = 0; i < arr.length; i++) {
    const newArr = [...arr];
    const newChar = newArr.splice(i, 1);
    permutation(newArr, len, store.concat(newChar), permutations);
  }
  return permutations;
}

function main() {
  let t = +readLine();
  while (t--) {
    const [a, b] = readLine().split(" ").map(Number);
    if (a % b === 0 || b % a === 0) console.log("NO");
    else console.log("YES");
  }
}

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
const sub = (a, b) => mod(mod(a) - mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}
function pow(base, n) {
  if (n === 0) return 1;
  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));
  if (n % 2 === 1) res = mul(mod(res), base);
  return res;
}
function highestOneBit(i) {
  i |= i >> 1;
  i |= i >> 2;
  i |= i >> 4;
  i |= i >> 8;
  i |= i >> 16;
  return i - (i >>> 1);
}
function permutation(arr, len, store = "", permutations = []) {
  if (store.length === len) {
    permutations.push(store);
    return;
  }
  for (let i = 0; i < arr.length; i++) {
    const newArr = [...arr];
    const newChar = newArr.splice(i, 1);
    permutation(newArr, len, store.concat(newChar), permutations);
  }
  return permutations;
}

function main() {
  let t = +readLine();
  while (t--) {
    const [a, b] = readLine().split(" ").map(Number);
    if (2 * a >= b) console.log("NO");
    else console.log("YES");
  }
}

let inputString = '';
let currentLine = 0;

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

process.stdin.on('end', function() {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function getAns(start, end) {
    if ((end + 1)/2 < start) return 'YES';
    else return 'NO'
}

function main() {

    const t = parseInt(readLine(), 10);

    for (let tItr = 0; tItr < t; tItr++) {
        const [start, end] = readLine().split(' ').map(arrTemp => parseInt(arrTemp, 10));

        const result = getAns(start, end);

        console.log(result + '\n');
    }
}

'use strict'
const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin
});
var count=0,
    arr=[],
    a,x,
    mod=0,
    div=0;
rl.question('', (nb) => {
  rl.on('line', (TC) => {
    arr = TC.split(' ');
    a = Number(arr[0]);
    x = Number(arr[1]);
    mod = x%a;
    div = a/2;
    if(mod>=div){console.log("YES")}
    else{console.log("NO")}
    count++;
    if (count == nb) {
      rl.close();
    }
  });
});


var numbers = readline().split(" ").map(function(x) { return parseInt(x); });

var lines  = numbers[0];
var stock = numbers[1];
var distress = 0;

var queue = [];

for (var i=0; i<lines; i++ ) {
  var x = readline().split(" ");

  if (x[0] == "+") {
    stock += parseInt(x[1]);
  } else if ((stock-parseInt(x[1])) < 0) {
    distress++;
  } else {
    stock -= parseInt(x[1]);
  }
}

print(stock + "  " + distress);

var inputs, arr, icePacks, childDestress = 0;

inputs = readline().split(' ').map(Number);
icePacks = inputs[1];

for (var i = 0; i < inputs[0]; i++) {
    arr = readline().split(' ');
    if (arr[0] === '+') {
        icePacks += Number(arr[1]);
    }
    else {  // '-'
        if (icePacks >= Number(arr[1])) {
            icePacks = icePacks - Number(arr[1])
        }
        else
            childDestress++;
    }
}
print(icePacks, childDestress);

'use strict';

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 readint() {
    let line = readline().split(' ').map(function(num) {
        return parseInt(num);
    });
    return line;
}

function readfloat() {
    let line = readline().split(' ').map(function(num) {
        return parseFloat(num);
    });
    return line;
}

function print(x) {
    console.log(x);
}

function write(x) {
    process.stdout.write(x);
}
function main() {
    let [n, x] = readint();
    let distres = 0;
    for(let i = 0; i < n; i++) {
        let [sign, num] = readline().split(" ");
        num = parseInt(num);
        if(sign == '+') {
            x += num;
        } else {
            if(x < num) distres++;
            else x -= num;
        }
    }
    print(x + " " + distres);

}

const input = [];

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

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

RL.on('close', () => {
   let {0:n, 1:x} = {...input[0].split(' ')};
   n = parseInt(n, 10); x = parseInt(x, 10);

   let d = 0;
   for(let i = 0; i < n; i += 1){
    const data = input[i+1].split(' ');
    if(data[0] === '+') {
        x += parseInt(data[1], 10);
    } else {
        if(x  >= parseInt(data[1], 10)) {
            x -= parseInt(data[1], 10);
        } else {
            d += 1;
        }
    }
   }

   console.log(`${x} ${d}`)
});

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

const readLine=()=> inputString[currentLine++];
/* ================================================
           Main Solution Starts Here
===================================================*/

const main=()=>{
	let [t,d]=readLine().split(" ").map(n=>+n)
	let distressed = 0
	while(t--){
		let [sign,amt] = readLine().split(" ")
		sign === '+' ?
			d+=parseInt(amt)
		: amt > d ? distressed++ : d-=parseInt(amt)
	}

	console.log(d,distressed)
}

var input = readline().split(' ').map(function(item){return parseInt(item)});
var n = input[0], x = input[1], distress = 0;
for(var i = 0; i < n; i++){
	var num = parseInt(readline().split(' ').join(''));
	if(num >= 0){
		x += num;
	} else {
		if(x + num < 0){
			distress++;
		} else {
			x += num;
		}
	}
}

print(x, distress);

input = readline().split(' ');
n = parseInt(input[0]);
m = parseInt(input[1]);
var ans = 0;
for(var i=0;i<n;i++)
{
	input = readline().split(' ');
	var c = input[0];
	var d = parseInt(input[1]);
	if(c == '+') m += d;
	else if(m<d)
	{
		ans++;
	}else
	{
		m-=d;
	}
}
print(m+' '+ans);

var l = readline();
l = l.split(" ");
var n = Number(l[0]);
var x = Number(l[1]);
var sad = 0;
var count = x;
for(i=0; i <n; i++)
{
    var s = readline();
    s = s.split(" ");
    var znak = s[0];
    var chislo = Number(s[1]);
    if(znak=="+")
        count+=chislo;
    else
    {
    	if(count-chislo<0)
            sad++;
         else
            count-=chislo;
    }
}
print(count,sad);

var input = readline().split(' ');
var carrer = parseInt(input[1]);
var calc = 0;

//var sting = ["- 16","- 2","- 98","+ 100","- 98"];

for (var i = 0; i < input[0]; i++)
{
var s = readline().split(' ');var s1 = parseInt(s[1]);
if(s[0]=='+'){carrer+=s1;}
if(s[0]=='-'){if(carrer>=s1){carrer-=s1}else{calc+=1}
}

}

print(carrer +" "+calc);

var input = readline().split(" ").map(Number);
var n = input[0], x = input[1];

var sad = 0;
for(var i = 0; i < n; i++){
    input = readline().split(" ");
    var d = +input[1];
    if(input[0] == "+"){
        x += d;
    }else{
        if(x >= d){
            x -= d;
        }else{
            sad++;
        }
    }
}

write(x + " " + sad);

var values = readline().split(" ");
var n = parseInt(values[0]);
var x = parseInt(values[1]);

var packs = x;
var distress = 0;

for (var i = 0; i < n; i++) {
    var ice = readline().split(" ");
    var k = ice[0];
    var m = parseInt(ice[1]);

    if (k === "+") {
        packs += m;
    } else {
        if (m > packs) {
            distress++;
        } else {
            packs -= m;
        }
    }
}

print(`${packs} ${distress}`);

var x = readline();
var numArr = x.split(' ').map(Number);
var num = numArr[0];
var q = [];
for(var i = 0; i < num; i++){
    var thisLine = readline();
    q.push(thisLine.split(' '));
}

var iceCounter = numArr[1], dCounter = 0;

for(var i = 0; i < num; i++){
    q[i][1] = parseInt(q[i][1]);

    if (q[i][0] == '-'){
        if(iceCounter >= q[i][1])
            iceCounter -= q[i][1];
        else
            dCounter++;
    }
    else if ((q[i][0] == '+'))
        iceCounter += q[i][1];
}

print(iceCounter, dCounter);

var informations = readline().split(' ').map(Number)
  var numberOfPeopleInLine = informations[0]
  var numberOfPacket = informations[1]
  var distress = 0

  for (var i = 0; i < numberOfPeopleInLine; i++) {
    var info = readline().split(' ')

    if (info[0] === '+') {
      numberOfPacket += Number(info[1])
    } else {
      if (Number(info[1]) > numberOfPacket) {
        distress += 1
      } else {
        numberOfPacket -= Number(info[1])
      }
    }
  }

  print(Number(numberOfPacket) + ' ' + Number(distress))

var g = readline();
g = g.split(" ");
var n = Number(g[0]);
var x = Number(g[1]);
var count = x;
var child = 0;
for(i=1;i<=n;i++){
    var y = readline();
    y = y.split(" ");
    var b = y[0];
    var c = Number(y[1]);
    if(b == "+"){
        count += c;
    }
    else if(b == "-"){
        if(c <= count){
            count -= c;
        }
        else{
            child++;
        }
    }
}
print(count,child)

var print = this.print || require('lol-io').print; //print --> outputs result and adds (enter)
var write = this.write || require('lol-io').write; //write --> creates output.txt with output
var readline = this.readline || require('lol-io').readline; //readline --> reads unread line of input.txt

var arr = readline().replace(/\r$/, '').split(' '), ice = Number(arr[1]), ans = [ice, 0], line;

for (i = 0; i < Number(arr[0]); i++) {
    line = readline().replace(/\r$/, '').split(' ');

    if (line[0] === '+') {
        ans[0] += Number(line[1]);
    } else {
        if (Number(line[1]) > ans[0]) {
            ans[1]++;
        } else {
            ans[0] -= Number(line[1]);
        }
    }
}

print(ans.join(' '));

//Don't have to see. start------------------------------------------
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);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
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){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
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;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var X = one[1];
  var count = 0;
  for(var i = 0; i < N; i++){
  	var tmp = nextStrArray();
  	var k = tmp[0];
  	var f = myconv(tmp[1], 1);
  	if(k == "+"){
  		X += f;
  	}else{
  		if(X >= f){
  			X -= f;
  		}else{
  			count++;
  		}
  	}
  }
  myout(X + " " + count);
}

'use strict';

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 print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // input
  let [n, x] = readline().split(' ').map(x => parseInt(x));
  let c = 0;
  for (let i = 0; i < n; i++) {
    let [s, a] = readline().split(' ');
    a = +a;
    if (s === '+') {
      x += a;
    } else {
      if (x - a >= 0) {
        x -= a;
      } else {
        c++;
      }
    }
  }
  print(`${x} ${c}`);
}

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

rl.on('line', (d) => {
  if (c === 0) {
    [x, iceCream] = d.split(' ').map(Number);
    c++;
    return;
  }

  let [sign, val] = d.split(' ');

  if (sign === '+') {
    iceCream += +val;
  }
  else {
    if (iceCream >= +val) {
      iceCream -= +val;
    }
    else {
      disappointed++;
    }
  }

  c++;
});

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

var input = readline().split(' ');
var n = Number(input[0]), x = Number(input[1]);
var sad = 0;

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

	if (input[0] === "+")
		x += d;
	else if (x >= d)
		x -= d;
	else
		sad++;
}

write(x, ' ', sad);

var g = readline();
g.split(" ");
var n = Number(g[0]);
var x = Number(g[1]);
var count = x;
var child = 0;
for(i=0;i<n;i++){
    var y = readline();
    y.split(" ");
    var b = y[0];
    var c = Number(y[1]);
    if(b == "+"){
        count += c;
    }
    else if(b == "-"){
        if(c <= count){
            count -= c;
        }
        else{
            child++;
        }
    }
    print(count,child)
}

var input = readline().split(' ');
var n = input[0], x = input[1];
var sad = 0;

for (var i=0; i<n; i++) {
	input = readline().split(' ');
	var d = input[1];

	if (input[0] === "+")
		x += d;
	else if (x >= d)
		x -= d;
	else
		sad++;

	write(x, ' ', sad, '|');
}

write(x, ' ', sad);

var input = readline().split(' ');
var n = input[0], x = input[1];
var sad = 0;

for (var i=0; i<n; i++) {
	input = readline().split(' ');
	var d = input[1];

	if (input[0] === "+")
		x += d*2;
	else if (x >= d)
		x -= d;
	else
		sad++;

	write(x, ' ', sad, '|');
}

write(x, ' ', sad);

var input = readline().split(' ');
var n = input[0], x = input[1] + 0;
var sad = 0;

for (var i=0; i<n; i++) {
	input = readline().split(' ');
	var d = input[1];

	if (input[0] === "+")
		x += d;
	else if (x >= d)
		x -= d;
	else
		sad++;

	write(x, ' ', sad, '|');
}

write(x, ' ', sad);

var input = readline().split(' ');
var n = Number(input[0]), x = Number(input[1]);
var sad = 0;

for (var i=0; i<n; i++) {
	input = readline().split(' ');
	var d = input[1];

	if (input[0] === "+")
		x += d;
	else if (x >= d)
		x -= d;
	else
		sad++;

	write(x, ' ', sad, '|');
}

write(x, ' ', sad);

var input = readline().split(' ').map(Number);
var n = input[0], x = input[1];
var sad = 0;

for (var i=0; i<n; i++) {
	input = readline().split(' ');
	var d = input[1];
	if (input[0] === "+")
		x += d;
	else if (x >= d)
		x -= d;
	else
		sad++;
}

write(x, ' ', sad);

var input = readline().split(' ');
var n = input[0], x = input[1];
var sad = 0;

for (var i=0; i<n; i++) {
	input = readline().split(' ');
	var d = input[1];

	if (input[0] === "+")
		x += d*1;
	else if (x >= d)
		x -= d;
	else
		sad++;

	write(x, ' ', sad, '|');
}

write(x, ' ', sad);

var input = readline().split(' ').map(Number);
var n = input[0], x = input[1];
var sad = 0;

write(n+2);

for (var i=0; i<n; i++) {
	input = readline().split(' ');
	var d = input[1];
	if (input[0] === "+")
		x += d;
	else if (x >= d)
		x -= d;
	else
		sad++;
}

write(x, ' ', sad);

var input = readline().split(' ');
var n = input[0], x = input[1];
var sad = 0;

for (var i=0; i<n; i++) {
	input = readline().split(' ');
	var d = input[1];

	write(input[0],' = ', d*36);

	if (input[0] === "+")
		x += d;
	else if (x >= d)
		x -= d;
	else
		sad++;
}

write(x, ' ', sad);

var input = readline().split(' ');
var n = Number(input[0]), x = Number(input[1]);
var sad = 0;

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

	if (input[0] === "+")
		x += d;
	else if (x >= d)
		x -= d;
	else
		sad++;

	write(x, ' ', sad, '|');
}

write(x, ' ', sad);

var numbers = readline().split(" ").map(function(x) { return parseInt(x); });

var lines  = numbers[0];
var stock = numbers[1];
var distress = 0;

var queue = [];

// for (let i=0; i<lines; i++ ) {
//   var x = readline().split(" ");

//   queue.push({
//     sign: x[0],
//     value: parseInt(x[1])
//   });
// }

// queue.forEach(function q(item) {
//   if (item.sign == "+") {
//     stock += item.value;
//   } else if (stock-item.value < 0) {
//     distress++;
//   } else {
//     stock -= item.value;
//   }
// });

print(stock + "  " + distress);

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

rl.on('line', (d) => {
  if (c === 0) {
    [x, iceCream] = d.split(' ').map(Number);
    c++;
    return;
  }

  let [sign, val] = d.split(' ');

  if (sign === '+') {
    iceCream += +val;
  }
  else {
    if (iceCream > +val) {
      iceCream -= +val;
    }
    else {
      disappointed++;
    }
  }

  c++;
});

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

var numbers = readline().split(" ").map(function(x) { return parseInt(x); });

// var lines  = numbers[0];
// var stock = numbers[1];
// var distress = 0;

// var queue = [];

// for (let i=0; i<lines; i++ ) {
//   var x = readline().split(" ");
//   print(x[0] + x[1]);
//   if (x[0] == "+") {
//     stock += item.value;
//   } else if ((stock-parseInt(x[1])) < 0) {
//     distress++;
//   } else {
//     stock -= parseInt(x[1]);
//   }
// }

// print(stock + "  " + distress);
print(numbers);

var numbers = readline().split(" ").map(function(x) { return parseInt(x); });

// var lines  = numbers[0];
// var stock = numbers[1];
// var distress = 0;

// var queue = [];

// for (let i=0; i<lines; i++ ) {
//   var x = readline().split(" ");

//   queue.push({
//     sign: x[0],
//     value: parseInt(x[1])
//   });
// }

// queue.forEach(function q(item) {
//   if (item.sign == "+") {
//     stock += item.value;
//   } else if (stock-item.value < 0) {
//     distress++;
//   } else {
//     stock -= item.value;
//   }
// });

print(5 + "  " + 2);

var l = readline();
l = l.split(" ");
var n = Number(l[0]);
var x = Number(l[1]);
var sad = 0;

for(var i=0; i <n; i++)
{
    var s = readline();
    s = s.split(" ");
    var znak = s[0];
    var chislo = Number(s[1]);
    if(znak=="+")
        x+=chislo;
    else if(x-chislo<0)
            sad++;
         else
            x-=chislo;
    print(x,sad);
}

var l = readline();
l = l.split(" ");
var n = Number(l[0]);
var x = Number(l[1]);
var sad = 0;

for(i=0; i <n; i++)
{
    var s = readline();
    s = s.split(" ");
    var znak = s[0];
    var chislo = Number(s[1]);
    if(znak=="+")
        x+=chislo;
    else if(x-chislo<0)
            sad++;
         else
            x-=chislo;
    print(x,sad);
}


nmk = readline().split(' ').map(Number);

var n = nmk[0], m = nmk[1], k = nmk[2], arr = new Array(n), res = 0;

for (var i = 0; i < n; i++) {
	arr[i] = readline();

	var count = 0;

	for (var j = 0; j < m; j++) {
		if (arr[i][j] == '.') {
			count++;
		} else {
			count = 0;
		};

		if (count >= k) {
			res++;
		};
	};
};

if (k > 1) {
	for (var j = 0; j < m; j++) {

		var count = 0;

		for (var l = 0; l < n; l++) {
			if (arr[l][j] == '.') {
				count++;
			} else {
				count = 0;
			};

			if (count >= k) {
				res++;
			};
		};
	};
};

print(res);

'use strict';

function Scanner() {
  this.nextLine = () => readline();
  this.nextInt = () => parseInt(readline());
  this.nextDouble = () => parseInt(readline());
  this.nextArray = () => readline().split(' ');
}

const is = new Scanner();

let line = is.nextArray().map(Number);
const n = line[0];
const m = line[1];
const k = line[2];

const grid = new Array(n);
for (let i = 0; i < n; i++)
  grid[i] = is.nextLine();

// rows
let answer = 0, aux;
for (const row of grid) {
  aux = 0;
  for (const i of row)
    if (i === '.')
      aux++;
    else {
      answer += Math.max(0, aux - k + 1);
      aux = 0;
    }
  answer += Math.max(0, aux - k + 1);
}

if (k !== 1) {
  for (let j = 0; j < m; j++) {
    aux = 0;
    for (let i = 0; i < n; i++)
      if (grid[i][j] === '.')
        aux++;
      else {
        answer += Math.max(0, aux - k + 1);
        aux = 0;
      }
    answer += Math.max(0, aux - k + 1);
  }
}

print(answer)

'use strict';

function Scanner() {
  this.nextLine = () => readline();
  this.nextInt = () => parseInt(readline());
  this.nextDouble = () => parseInt(readline());
  this.nextArray = () => readline().split(' ');
}

const is = new Scanner();

let line = is.nextArray().map(Number);
const n = line[0];
const m = line[1];
const k = line[2];

const grid = new Array(n);
for (let i = 0; i < n; i++)
  grid[i] = is.nextLine();

// rows
let answer = 0, aux;
for (const row of grid) {
  aux = 0;
  for (const i of row)
    if (i === '.')
      aux++;
    else {
      answer += Math.max(0, aux - k + 1);
      aux = 0;
    }
  answer += Math.max(0, aux - k + 1);
}

for (let j = 0; j < m; j++) {
  aux = 0;
  for (let i = 0; i < n; i++)
    if (grid[i][j] === '.')
      aux++;
    else {
      answer += Math.max(0, aux - k + 1);
      aux = 0;
    }
  answer += Math.max(0, aux - k + 1);
}

print(answer)

'use strict';

function Scanner() {
  this.nextLine = () => readline();
  this.nextInt = () => parseInt(readline());
  this.nextDouble = () => parseInt(readline());
  this.nextArray = () => readline().split(' ');
}

const is = new Scanner();

let line = is.nextArray().map(Number);
let n = line[0];
let m = line[1];
let k = line[2];

let grid = new Array(n);
for (let i = 0; i < n; i++)
  grid[i] = is.nextLine();

// rows
let answer = 0, aux, calc;
for (const row of grid) {
  aux = 0;
  for (const i of row)
    if (i === '.')
      aux++;
    else {
      aux = 0;
      answer += Math.max(0, aux - k + 1);
    }
  answer += Math.max(0, aux - k + 1);
}

for (let j = 0; j < m; j++) {
  aux = 0;
  for (let i = 0; i < n; i++)
    if (grid[i][j] === '.')
      aux++;
    else {
      aux = 0;
      answer += Math.max(0, aux - k + 1);
    }
  answer += Math.max(0, aux - k + 1);
}

print(answer)

'use strict';

function Scanner() {
  this.nextLine = () => readline();
  this.nextInt = () => parseInt(readline());
  this.nextDouble = () => parseInt(readline());
  this.nextArray = () => readline().split(' ');
}

const is = new Scanner();

let line = is.nextArray().map(Number);
const n = line[0];
const m = line[1];
const k = line[2];

const grid = new Array(n);
for (let i = 0; i < n; i++)
  grid[i] = is.nextLine();

// rows
let answer = 0, aux;
for (const row of grid) {
  aux = 0;
  for (const i of row)
    if (i === '.')
      aux++;
    else {
      answer += Math.max(0, aux - k + 1);
      aux = 0;
    }
  answer += Math.max(0, aux - k + 1);
}

if (k !== 1) {
  for (let j = 0; j < m; j++) {
    aux = 0;
    for (let i = 0; i < n; i++) {
      if (grid[i][j] === '.') aux++;
      else {
        answer += Math.max(0, aux - k + 1);
        aux = 0;
      }
      answer += Math.max(0, aux - k + 1);
    }
  }
}

print(answer)