You are given three integers $$$a$$$, $$$b$$$, and $$$c$$$. Determine if one of them is the sum of the other two.

The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 9261$$$) — the number of test cases. The description of each test case consists of three integers $$$a$$$, $$$b$$$, $$$c$$$ ($$$0 \leq a, b, c \leq 20$$$).

For each test case, output "YES" if one of the numbers is the sum of the other two, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

NoteIn the first test case, $$$1 + 3 = 4$$$.In the second test case, none of the numbers is the sum of the other two.In the third test case, $$$9 + 11 = 20$$$.

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() {
  let n = readline();
  for (let i = 0; i < n; i++) {
    let [a, b, c] = readline().split(" ").map(Number);
    if (((a + b + c) / 2) == a || ((a + b + c) / 2) == b || ((a + b + c) / 2) == c) {
      console.log("YES");
    } else {
      console.log("NO");
    }
  }
}

'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 main(){
    const testNumbers = readline()

    for(let i = 0; i<testNumbers; i++){
        solve(readline().split(" ").map(x=>parseInt(x)));
    }
}

function solve(input){
    console.log(
        Math.abs(input[0]-input[1]) == input[2]
        ||
        Math.abs(input[0]-input[2]) == input[1]
        ||
        Math.abs(input[1]-input[2]) == input[0]
        ? 'YES':'NO'
    )
}

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

let standardInputString = ''
let currentLine = 0

function readLine() {
    return standardInputString[currentLine++]
}
process.stdin.on('data', rawData => {
    standardInputString += rawData
})

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

    main()
})

//   .........................................................   //\

const main = () => {
    const testCase = parseInt(readLine());

    for (let index = 0; index < testCase; index++) {
        const a = readLine().split(" ").map(x => parseInt(x));

        console.log(sum(a[0], a[1], a[2]));

    }
}

const sum = (a, b, c) => {
    if (a + b === c || a + c === b || b + c === a)
        return 'YES';
    return 'NO';

}

let buf='';

process.stdin.on('readable',function(){
    let chunk=process.stdin.read();
    if(chunk) buf+=chunk.toString();
})

process.stdin.on('end',function(){
    const {EOL}=require('os');
    let line=buf.split(EOL);
    let t=parseInt(line[0]);
    for(let i=1;i<=t;i++)
    {
        let [a,b,c]=line[i].split(' ').map(x=>{return parseInt(x)});
        if(a===b+c||b===a+c||c===a+b)
        {
            console.log("YES");
        }
        else
        {
            console.log("NO");
        }
    }
})

const lines = [];
const readlineInterface = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
readlineInterface.on("line", (line) => {
  lines.push(line);
});
readlineInterface.on("close", () => {
  const tests = lines.slice(1).map((line) => line.split(" ").map((e) => +e));

  tests
    .map((numbers) => {
      const sum = numbers.reduce((a, b) => a + b, 0);
      return numbers.find((e) => e === sum / 2) !== undefined ? "YES" : "NO";
    })
    .forEach((e) => console.log(e));
});

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\n');

let currentline = 0;
function readline(){
    return input[currentline++];
}

let T = readline();
for(let i = 1; i <= T; i++){
    let [a, b, c] = readline().split(' ').map(Number);
    console.log(solve(a, b, c));
}

function solve(a, b, c){
    return (a + b === c || b + c === a || a + c === b) ? 'YES' : 'NO';
}

// cls; cat .\input.txt | node .\script.js
// codium --diff file1.js file2.js
'use strict';
async function main(read) {
    let amount = Number(await read());
    let output = ""
    while (amount > 0) {
        try {
            let str = await read().split(' ')
            let a = Number(str[0]);
            let b = Number(str[1]);
            let c = Number(str[2]);
            let max = Math.max(a, b, c)
            output+=(max == (a + b + c - max) ? "YES" : "NO") + '\n'
        } catch (error) {
            console.log(error);
        }
        amount--

    }
    return output

}

let inputs, str = '';
function read() {
    return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', async () => {
    inputs = str.split('\n').values();
    const output = await main(read);
    process.stdout.write(output);
});

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

let c = 0;

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

  const arr = d
    .split(" ")
    .map(Number)
    .sort((a, b) => a - b);

  if (arr[0] + arr[1] === arr[2]) {
    console.log("YES");
  } else {
    console.log("NO");
  }
  c++;
});

rl.on("close", () => {});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
       var k = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
       console.log(k[0] + k[1] == k[2] ? 'YES' : 'NO');
    }
});

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

//   return gcd(b, a % b);
// }
let ryan = '';//.map(Number).sort(function(a, b){return a - b})
process.stdin.on('data', c => ryan += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = ryan.split(EOL);
    var n = lines[0]
    for(j = 1; j <= n; j++){
       var k = lines[j].split(' ').map(Number).sort(function(a, b){return a - b})
       console.log(k[0] + k[1] == k[2] ? 'YES' : 'NO')
    }
});

const readline = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
});
const sum = (a, b, c) => {
  if (a + b === c) return "YES";
  if (a + c === b) return "YES";
  if (b + c === a) return "YES";
  return "NO";
};
const inputs = [];

const solution = async () => {
  for await (const line of readline) {
    var num = line.split(" ").map((x) => parseInt(x));
    inputs.push(num);
  }

  for (let x = 1; x < inputs.length; x++) {
    console.log(sum(inputs[x][0], inputs[x][1], inputs[x][2]));
  }
};

solution();

'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 = parseInt(readline());
    for(let i = 0; i < x; i += 1) {
        const nums = readline().split(' ').map(n => parseInt(n));
        const isYes = nums.some((num, index) => {
            if (index === 0)
                return num === nums[1] + nums[2];
            else if (index === 1)
                return num === nums[0] + nums[2];
            else
                return num === nums[1] + nums[0];
        });

        if (isYes)
            console.log('YES');
        else
            console.log('NO');
    }

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", function (inputStdin) {
  inputString += inputStdin;
});

process.stdin.on("end", function () {
  inputString = inputString.split("\n");
  main();
});

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

function checkSum(cases) {
  for (let i = 0; i < cases.length; i++) {
    const [first, second, third] = cases[i];
    if (
      Number(first) === Number(second) + Number(third) ||
      Number(second) === Number(first) + Number(third) ||
      Number(third) === Number(first) + Number(second)
    ) {
      console.log("YES");
    } else {
      console.log("NO");
    }
  }
}

function main() {
  const t = parseInt(readLine().trim());
  const cases = [];
  for (let i = 0; i < t; i++) {
    const numbers = readLine().split(" ");
    cases.push(numbers);
  }

  checkSum(cases);
}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {
let n = parseInt(readline());
var num = undefined
while(n--){
     num =readline().split(' ').map(x => parseInt(x))
        if((num[0]+num[1] === num[2]) || (num[0]+num[2] === num[1]) || (num[2]+num[1] === num[0])){
            console.log(`YES`);

        }
        else{
            console.log(`NO`);
        }

}
}

/**
 * 10/13/22 morning
 * https://codeforces.com/contest/1742/problem/A
 */

const pr = console.log;

const solve = (a) => {
    if (a[0] + a[1] == a[2] || a[0] + a[2] == a[1] || a[1] + a[2] == a[0]) {
        pr("YES");
    } else {
        pr("NO");
    }
};

const main = () => {
    const readLine = () => input[currentLine++];
    const ni = () => readLine() - '0';
    const nas = () => readLine().split(" ");
    const nai = () => nas().map(Number);
    const nal = () => nas().map(BigInt);
    let input = '', currentLine = 0;
    process.stdin.on('data', (stdin) => input += stdin)
    process.stdin.on('end', () => {
        input = input.split('\n');
        let t = ni();
        while (t--) {
            let a = nai();
            solve(a);
        }
    });
};

main()

/*
** Template
*/

// Common Template Starts //
//*
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++];
}
// Common Template Ends //

// Driver Function Starts //
const main = () => {
    console.clear()
    let t = parseInt(readline())
    while (t--) {
        // let n = parseInt(readline())
        let arr = readline().split(' ').map(Number)
        console.log(solve(arr))
    }
}
// Driver Function Ends //

// MAIN LOGIC
const solve = (arr) => {
    let a = arr[0]
    let b = arr[1]
    let c = arr[2]

    if( a === b + c ) return 'YES'
    if( b === c + a ) return 'YES'
    if( c === a + b ) return 'YES'

    return 'NO'
}

const isOdd = (num) => num & 1
const isEven = (num) => !(num & 1)
const minOfArray = (arr) => Math.min.apply(null, arr)
const maxOfArray = (arr) => Math.max.apply(null, arr)
const uniqueArray = (arr) => [...new Set(arr)]
const sortArray = (arr) => arr.sort((a, b) => a - b)
const sumOfArray = (arr) => arr.reduce((partialSum, a) => partialSum + a, 0)

// cmd: cat input.txt | node main.js

const readline = require("readline");

var tcn = 0

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

rl.on('line', line => {
  if (!tcn) return tcn = Number(line)

  run(line)

  if (!--tcn) rl.close()
})

function run(line) {
  var vals = line.split(' ').map(val => Number(val)).sort((a, b) => a - b)
  if (vals[2] == vals[1] + vals[0] || vals[0] == vals[1] + vals[2]) {
    console.log('YES')
  }
  else {
    console.log('NO')
  }
}

'use strict';

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

let processIn = '';
let processCurr = 0;

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

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

    JS();
});

function readLine() {
    return processIn[processCurr++];
}
function mergeSort(a) {
    let r = a.length;
    let l = 0;
    let m = Math.round((r - l) / 2);
    if (r === 1) {
        return;   // returns recursively
    }
    let L = [];   // left half of current a
    let R = [];   // right half of current a
    for (let i = l; i < m; i++) {
        L.push(a[i]);
    }
    for (let j = m; j < r; j++) {
        R.push(a[j]);
    }
    mergeSort(L);
    mergeSort(R);
    let i = 0, j = 0, k = 0;
    // Merging part
    while (i < L.length && j < R.length) {
        if (L[i] < R[j]) {
            a[k] = L[i];
            i++;
        } else {
            a[k] = R[j];
            j++;
        }
        k++;
    }
    while (i < L.length) {
        a[k] = L[i];
        i++;
        k++;
    }
    while (j < R.length) {
        a[k] = R[j];
        j++;
        k++;
    }
}

function JS() {
    /*

    */
    let tt = parseInt(readLine());
    // let tt = 1;
    for(let t=0;t<tt;++t){
        let inp = readLine().trim().split(' ').map(string => { return parseInt(string.trim()); });
        let a = inp[0],b=inp[1],c=inp[2];
        if(a === b+c || b === a+c || c === a+b){
            console.log('YES');
        }else{
            console.log('NO');
        }
    }
}

"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 main() {
  let n = readline();
  for (let i = 0; i < n; i++) {
    let [a, b, c] = readline().split(" ").map(Number);
    if (a + b === c || a + c === b || c + b === a) {
      console.log("YES");
    } else {
      console.log("NO");
    }
  }
}

const readline = require('readline')

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

function solve(arr) {
    const [a, b, c] = arr.sort((a, b) => a - b)
    return a + b === c ? 'YES' : 'NO'
}

'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(read) {
  const [rn, rb, rns, re, rbs] = convertInput(read);
  const a = rns(3),
        sum = a.reduce((a, b) => a + b, 0);
  for (let i = 0; i < 3; i++) {
    if (a[i] === sum - a[i]) return 'YES';
  }
  return 'NO';
}
function convertInput(read) {
  const rn = () => Number(read());
  const rb = () => BigInt(read());
  const rns = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rn();
    return res;
  };
  const re = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rn() - 1;
    return res;
  };
  const rbs = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rb();
    return res;
  };
  return [rn, rb, rns, re, rbs];
}
function main(r) {
  const [rn, rb, rns, re, rbs] = convertInput(r);
  try {
    let t = rn();
    let res = new Array(t);
    let limit = 0;
    for (let i = 0; i < t; i++) {
      var _solve;
      const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';
      if (t < limit) {
        process.stdout.write(s.toString());
        process.stdout.write('\n');
      } else {
        res[i] = s;
      }
    }
    if (t >= limit) {
      return res.join('\n');
    } else {
      return '';
    }
  } catch (error) {
    console.log(error);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8')
.split(/\s+/);
void function () {
  const read = ((i = 0) => () => inputs[i++])();
  const output = main(read);
  process.stdout.write(output);
}();

// run on javascript V8 4.8.0
// https://codeforces.com/contest/1742/problem/A
// You are given three integers a, b, and c. Determine if one of them is the sum of the other two.
function main() {
    var tn = +readline(); // Number of test cases
    for (var i = 0; i < tn; i++) {

        var a = readline().split(' ').map(Number);
        // Call solve()
        solve(a);
    }
}

function solve(a) {
    var a = a.sort(function(a, b){return a-b});
    if (a[0] + a[1] == a[2]) {
        print('YES');
    } else {
        print('NO');
    }
}

main();

function begin(a,b,c) {
    if(a == b + c) {
        print("YES");
    } else if(b == a + c) {
        print("YES");
    } else if(c == a + b) {
        print("YES");
    } else {
        print("NO");
    }
}

var caseNum = parseInt(readline(), 10);
for (var i = 0; i < caseNum; i++) {
    var x = readline()
        .trim()
        .split(' ')
        .map((y) => parseInt(y, 10));
        begin(x[0], x[1], x[2]);
}

var tests = +readline();

for(var i=0; i<tests; i++) {
    var input = readline().split(" ");
    var num1 = parseInt(input[0]);
    var num2 = parseInt(input[1]);
    var num3 = parseInt(input[2]);
    if((num1 + num2 == num3) || (num1 + num3 == num2) || (num3 + num2 == num1)) {
        print("YES");
    }else {
        print("NO");
    }
}

var a = readline();
var arr = [];
var max = 0;
var s = 0;
var f = 0;
for(var i = 0; i < a; i++){
    arr[i] = readline().split(' ').map(i=>Number(i));
    max = Math.max.apply(null,arr[i]);
    for(var j = 0; j < arr[i].length; j++){
        s+=arr[i][j];
        f=s-max;
    }if(f==max){
        print("YES");
    }else{
        print("NO");
    }
    f=0;
    max=0;
    s=0;
}

var limit = parseInt(readline());
for (var i = 0; i < limit; i++)
{
    var caseArray = readline().split(" ");
    var caseIntArray = new Array();
    for (var j = 0; j < caseArray.length; j++)
    {
        caseIntArray.push(parseInt(caseArray[j]));
    }
    var caseIntSorted = caseIntArray.sort((a,b) => a - b);
    if (caseIntSorted[2] == (caseIntSorted[1] + caseIntSorted[0]))
    {
        print("YES");
    }
    else print("NO");
}

t = readline()
while (t--) {
    input = readline().split(" ").map(Number).sort(function (a, b) { return a - b }).reverse()
    if (input[0] === input[1] + input[2]) {
        print("YES")
    } else {
        print("NO")
    }
}

const tc = readline();
for (var t =0 ; t<tc;t++){
    var input = readline().split(" ");
    var a = parseInt(input[0]), b=parseInt(input[1]), c=parseInt(input[2]);
    if(a+b==c || a+c==b ||b+c==a){
       print("YES");
    }else{
        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 readline() {
  return inputString[currentLine++];
}
function main() {
  let n = readline();
  for (let i = 0; i < n; i++) {
    let [a, b, c] = readline().split(" ").map(Number);
    if (((a + b + c) / 2) == a || b || c) {
      console.log("YES");
    } else {
      console.log("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 readline() {
  return inputString[currentLine++];
}

function main() {
  let n = readline();
  for (let i = 0; i < n; i++) {
    let [a, b, c] = readline().split(" ");
    if (a + b === c || a + c === b || c + b === a) {
      console.log("YES");
    } else {
      console.log("NO");
    }
  }
}

process.stdin.setEncoding('utf-8');
// let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = -1, f;
// process.stdin.on('data', function (data) {
//   var d = data.toString().trim().replaceAll(' ', '\n')
//   var splittedSTR = d.split('')
//   process.stdout.write(splittedSTR);
//   let output = [];
//   if (splittedSTR.length == 1) {
//     if (f == undefined) {
//       f = data.toString().trim();
//     } else {
//     }
//     return;
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
//       splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
//       splittedSTR.splice(i + 1, 1)
//       splittedSTR.splice(i - 1, 1)
//     }
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     output.push(Alpha[splittedSTR[i] - 1])
//     if (output.length == splittedSTR.length) {
//       process.stdout.write(output.join(''));
//       z++
//       if (z == f) {
//         process.exit();
//       }
//       return output.join('');
//     }
//   }
// })
var f, c = 0;
// process.stdin.on('data', function (data) {
//   if (f == undefined) {
//     f = 1;
//     return;
//   }
//   var phrase = data.toString().trim().toLowerCase().split(' ');
//   if (phrase[0] == phrase[1]) {
//     process.stdout.write('=\n');
//     return '=';
//   }
//   if (!data.toString().trim().toLowerCase().includes('s')) {
//     if (phrase[0].includes('m') && phrase[1].includes('l')) {
//       process.stdout.write('<\n');
//       return '<';
//     } else if (phrase[0].includes('l') && phrase[1].includes('m')) {
//       process.stdout.write('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       process.stdout.write('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       process.stdout.write('>\n');
//       return '>';
//     }
//   } else {
//     if (phrase[0].includes('m') && phrase[1].includes('s')) {
//       process.stdout.write('>\n');
//       return '>';
//     } else if (phrase[0].includes('s') && phrase[1].includes('m')) {
//       process.stdout.write('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       process.stdout.write('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       process.stdout.write('<\n');
//       return '<';
//     }
//   }
// })
process.stdin.on('data', function (data) {
  if (f == undefined) {
    f = parseInt(data.toString().trim());
    return;
  }
  var b;
  var Nums = data.trim().split(' ');
  for (var i = 0; i < Nums.length; i++) {
    if (((parseInt(Nums[0]) + parseInt(Nums[1]) + parseInt(Nums[2])) / 2) == parseInt(Nums[i])) {
      b = true;
      break;
    } else {
      b = false;
    }
  }
  if (b) {
    process.stdout.write('YES\n');
  } else {
    process.stdout.write('NO\n');
  }
  c++
  if (c == f) {
    process.exit();
  }
})

// let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = -1, f;
// process.stdin.on('data', function (data) {
//   var d = data.toString().trim().replaceAll(' ', '\n')
//   var splittedSTR = d.split('')
//   process.stdout.write(splittedSTR);
//   let output = [];
//   if (splittedSTR.length == 1) {
//     if (f == undefined) {
//       f = data.toString().trim();
//     } else {
//     }
//     return;
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
//       splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
//       splittedSTR.splice(i + 1, 1)
//       splittedSTR.splice(i - 1, 1)
//     }
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     output.push(Alpha[splittedSTR[i] - 1])
//     if (output.length == splittedSTR.length) {
//       process.stdout.write(output.join(''));
//       z++
//       if (z == f) {
//         process.exit();
//       }
//       return output.join('');
//     }
//   }
// })
var f, c = 0;
// process.stdin.on('data', function (data) {
//   if (f == undefined) {
//     f = 1;
//     return;
//   }
//   var phrase = data.toString().trim().toLowerCase().split(' ');
//   if (phrase[0] == phrase[1]) {
//     process.stdout.write('=\n');
//     return '=';
//   }
//   if (!data.toString().trim().toLowerCase().includes('s')) {
//     if (phrase[0].includes('m') && phrase[1].includes('l')) {
//       process.stdout.write('<\n');
//       return '<';
//     } else if (phrase[0].includes('l') && phrase[1].includes('m')) {
//       process.stdout.write('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       process.stdout.write('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       process.stdout.write('>\n');
//       return '>';
//     }
//   } else {
//     if (phrase[0].includes('m') && phrase[1].includes('s')) {
//       process.stdout.write('>\n');
//       return '>';
//     } else if (phrase[0].includes('s') && phrase[1].includes('m')) {
//       process.stdout.write('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       process.stdout.write('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       process.stdout.write('<\n');
//       return '<';
//     }
//   }
// })
process.stdin.on('data', function (data) {
  if (f == undefined) {
    f = parseInt(data.toString().trim());
    return;
  }
  var b;
  var Nums = data.toString().trim().split(' ');
  for (var i = 0; i < Nums.length; i++) {
    if (((parseInt(Nums[0]) + parseInt(Nums[1]) + parseInt(Nums[2])) / 2) == parseInt(Nums[i])) {
      b = true;
      break;
    } else {
      b = false;
    }
  }
  if (b) {
    process.stdout.write('YES\n');
  } else {
    process.stdout.write('NO\n');
  }
  c++
  if (c == f) {
    process.exit();
  }
})

// let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = -1, f;
// process.stdin.on('data', function (data) {
//   var d = data.toString().trim().replaceAll(' ', '\n')
//   var splittedSTR = d.split('')
//   process.stdout.write(splittedSTR);
//   let output = [];
//   if (splittedSTR.length == 1) {
//     if (f == undefined) {
//       f = data.toString().trim();
//     } else {
//     }
//     return;
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
//       splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
//       splittedSTR.splice(i + 1, 1)
//       splittedSTR.splice(i - 1, 1)
//     }
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     output.push(Alpha[splittedSTR[i] - 1])
//     if (output.length == splittedSTR.length) {
//       process.stdout.write(output.join(''));
//       z++
//       if (z == f) {
//         process.exit();
//       }
//       return output.join('');
//     }
//   }
// })
var f, c = 0;
// process.stdin.on('data', function (data) {
//   if (f == undefined) {
//     f = 1;
//     return;
//   }
//   var phrase = data.toString().trim().toLowerCase().split(' ');
//   if (phrase[0] == phrase[1]) {
//     process.stdout.write('=\n');
//     return '=';
//   }
//   if (!data.toString().trim().toLowerCase().includes('s')) {
//     if (phrase[0].includes('m') && phrase[1].includes('l')) {
//       process.stdout.write('<\n');
//       return '<';
//     } else if (phrase[0].includes('l') && phrase[1].includes('m')) {
//       process.stdout.write('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       process.stdout.write('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       process.stdout.write('>\n');
//       return '>';
//     }
//   } else {
//     if (phrase[0].includes('m') && phrase[1].includes('s')) {
//       process.stdout.write('>\n');
//       return '>';
//     } else if (phrase[0].includes('s') && phrase[1].includes('m')) {
//       process.stdout.write('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       process.stdout.write('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       process.stdout.write('<\n');
//       return '<';
//     }
//   }
// })
process.stdin.on('data', function (data) {
  if (f == undefined) {
    f = parseInt(data.toString().trim());
    return;
  }
  var b;
  var Nums = data.toString().trim().split(' ');
  for (var i = 0; i < Nums.length; i++) {
    if (((parseInt(Nums[0]) + parseInt(Nums[1]) + parseInt(Nums[2])) / 2) == parseInt(Nums[i])) {
      b = true;
      break;
    } else {
      b = false;
    }
  }
  if (b) {
    process.stdout.write('YES');
  } else {
    process.stdout.write('NO');
  }
  c++
  if (c == f) {
    process.exit();
  }
})

// let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = -1, f;
// process.stdin.on('data', function (data) {
//   var d = data.toString().trim().replaceAll(' ', '\n')
//   var splittedSTR = d.split('')
//   console.log(splittedSTR);
//   let output = [];
//   if (splittedSTR.length == 1) {
//     if (f == undefined) {
//       f = data.toString().trim();
//     } else {
//     }
//     return;
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
//       splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
//       splittedSTR.splice(i + 1, 1)
//       splittedSTR.splice(i - 1, 1)
//     }
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     output.push(Alpha[splittedSTR[i] - 1])
//     if (output.length == splittedSTR.length) {
//       console.log(output.join(''));
//       z++
//       if (z == f) {
//         process.exit();
//       }
//       return output.join('');
//     }
//   }
// })
var f, c = 0;
// process.stdin.on('data', function (data) {
//   if (f == undefined) {
//     f = 1;
//     return;
//   }
//   var phrase = data.toString().trim().toLowerCase().split(' ');
//   if (phrase[0] == phrase[1]) {
//     console.log('=\n');
//     return '=';
//   }
//   if (!data.toString().trim().toLowerCase().includes('s')) {
//     if (phrase[0].includes('m') && phrase[1].includes('l')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].includes('l') && phrase[1].includes('m')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     }
//   } else {
//     if (phrase[0].includes('m') && phrase[1].includes('s')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].includes('s') && phrase[1].includes('m')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     }
//   }
// })
process.stdin.on('data', function (data) {
  if (f == undefined) {
    f = parseInt(data.toString().trim());
    return;
  }
  var b;
  var Nums = data.toString().trim().split(' ');
  for (var i = 0; i < Nums.length; i++) {
    if (((parseInt(Nums[0]) + parseInt(Nums[1]) + parseInt(Nums[2])) / 2) == parseInt(Nums[i])) {
      b = true;
      break;
    } else {
      b = false;
    }
  }
  if (b) {
    console.log('YES');
  } else {
    console.log('NO');
  }
  c++
  if (c == f) {
    process.exit();
  }
})

// let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = -1, f;
// process.stdin.on('data', function (data) {
//   var d = data.toString().trim().replaceAll(' ', '\n')
//   var splittedSTR = d.split('')
//   console.log(splittedSTR);
//   let output = [];
//   if (splittedSTR.length == 1) {
//     if (f == undefined) {
//       f = data.toString().trim();
//     } else {
//     }
//     return;
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
//       splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
//       splittedSTR.splice(i + 1, 1)
//       splittedSTR.splice(i - 1, 1)
//     }
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     output.push(Alpha[splittedSTR[i] - 1])
//     if (output.length == splittedSTR.length) {
//       console.log(output.join(''));
//       z++
//       if (z == f) {
//         process.exit();
//       }
//       return output.join('');
//     }
//   }
// })
var f, c = 0;
// process.stdin.on('data', function (data) {
//   if (f == undefined) {
//     f = 1;
//     return;
//   }
//   var phrase = data.toString().trim().toLowerCase().split(' ');
//   if (phrase[0] == phrase[1]) {
//     console.log('=\n');
//     return '=';
//   }
//   if (!data.toString().trim().toLowerCase().includes('s')) {
//     if (phrase[0].includes('m') && phrase[1].includes('l')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].includes('l') && phrase[1].includes('m')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     }
//   } else {
//     if (phrase[0].includes('m') && phrase[1].includes('s')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].includes('s') && phrase[1].includes('m')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     }
//   }
// })
process.stdin.on('data', function (data) {
  if (f == undefined) {
    f = parseInt(data.toString().trim());
    return;
  }
  var b;
  var Nums = data.toString().trim().split(' ');
  for (var i = 0; i < Nums.length; i++) {
    if (((parseInt(Nums[0]) + parseInt(Nums[1]) + parseInt(Nums[2])) / 2) == parseInt(Nums[i])) {
      b = true;
      break;
    } else {
      b = false;
    }
  }
  if (b) {
    console.log('YES\n');
  } else {
    console.log('NO\n');
  }
  c++
  if (c == f) {
    process.exit();
  }
})

// let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = -1, f;
// process.stdin.on('data', function (data) {
//   var d = data.toString().trim().replaceAll(' ', '\n')
//   var splittedSTR = d.split('')
//   console.log(splittedSTR);
//   let output = [];
//   if (splittedSTR.length == 1) {
//     if (f == undefined) {
//       f = data.toString().trim();
//     } else {
//     }
//     return;
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
//       splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
//       splittedSTR.splice(i + 1, 1)
//       splittedSTR.splice(i - 1, 1)
//     }
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     output.push(Alpha[splittedSTR[i] - 1])
//     if (output.length == splittedSTR.length) {
//       console.log(output.join(''));
//       z++
//       if (z == f) {
//         process.exit();
//       }
//       return output.join('');
//     }
//   }
// })
var f, c = 0;
// process.stdin.on('data', function (data) {
//   if (f == undefined) {
//     f = 1;
//     return;
//   }
//   var phrase = data.toString().trim().toLowerCase().split(' ');
//   if (phrase[0] == phrase[1]) {
//     console.log('=\n');
//     return '=';
//   }
//   if (!data.toString().trim().toLowerCase().includes('s')) {
//     if (phrase[0].includes('m') && phrase[1].includes('l')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].includes('l') && phrase[1].includes('m')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     }
//   } else {
//     if (phrase[0].includes('m') && phrase[1].includes('s')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].includes('s') && phrase[1].includes('m')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     }
//   }
// })
process.stdin.on('data', function (data) {
  if (f == undefined) {
    f = parseInt(data.toString().trim());
    console.log(f);
    return;
  }
  var b;
  var Nums = data.toString().trim().split(' ');
  for (var i = 0; i < Nums.length; i++) {
    if (((parseInt(Nums[0]) + parseInt(Nums[1]) + parseInt(Nums[2])) / 2) == parseInt(Nums[i])) {
      b = true;
      break;
    } else {
      b = false;
    }
  }
  if (b) {
    console.log('YES\n');
  } else {
    console.log('NO\n');
  }
  c++
  if (c == f) {
    process.exit();
  }
})

// let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = -1, f;
// process.stdin.on('data', function (data) {
//   var d = data.toString().trim().replaceAll(' ', '\n')
//   var splittedSTR = d.split('')
//   console.log(splittedSTR);
//   let output = [];
//   if (splittedSTR.length == 1) {
//     if (f == undefined) {
//       f = data.toString().trim();
//     } else {
//     }
//     return;
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
//       splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
//       splittedSTR.splice(i + 1, 1)
//       splittedSTR.splice(i - 1, 1)
//     }
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     output.push(Alpha[splittedSTR[i] - 1])
//     if (output.length == splittedSTR.length) {
//       console.log(output.join(''));
//       z++
//       if (z == f) {
//         process.exit();
//       }
//       return output.join('');
//     }
//   }
// })
var f;
// process.stdin.on('data', function (data) {
//   if (f == undefined) {
//     f = 1;
//     return;
//   }
//   var phrase = data.toString().trim().toLowerCase().split(' ');
//   if (phrase[0] == phrase[1]) {
//     console.log('=\n');
//     return '=';
//   }
//   if (!data.toString().trim().toLowerCase().includes('s')) {
//     if (phrase[0].includes('m') && phrase[1].includes('l')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].includes('l') && phrase[1].includes('m')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     }
//   } else {
//     if (phrase[0].includes('m') && phrase[1].includes('s')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].includes('s') && phrase[1].includes('m')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     }
//   }
// })
process.stdin.on('data', function (data) {
  if (f == undefined) {
    f = 1;
    return;
  }
  var b;
  var Nums = data.toString().trim().split(' ');
  for (var i = 0; i < Nums.length; i++) {
    if (((parseInt(Nums[0]) + parseInt(Nums[1]) + parseInt(Nums[2])) / 2) == parseInt(Nums[i])) {
      b = true;
      break;
    } else {
      b = false;
    }
  }
  if (b) {
    console.log('YES\n');
  } else {
    console.log('NO\n');
  }
})

// let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = -1, f;
// process.stdin.on('data', function (data) {
//   var d = data.toString().trim().replaceAll(' ', '\n')
//   var splittedSTR = d.split('')
//   console.log(splittedSTR);
//   let output = [];
//   if (splittedSTR.length == 1) {
//     if (f == undefined) {
//       f = data.toString().trim();
//     } else {
//     }
//     return;
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
//       splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
//       splittedSTR.splice(i + 1, 1)
//       splittedSTR.splice(i - 1, 1)
//     }
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     output.push(Alpha[splittedSTR[i] - 1])
//     if (output.length == splittedSTR.length) {
//       console.log(output.join(''));
//       z++
//       if (z == f) {
//         process.exit();
//       }
//       return output.join('');
//     }
//   }
// })
var f;
// process.stdin.on('data', function (data) {
//   if (f == undefined) {
//     f = 1;
//     return;
//   }
//   var phrase = data.toString().trim().toLowerCase().split(' ');
//   if (phrase[0] == phrase[1]) {
//     console.log('=\n');
//     return '=';
//   }
//   if (!data.toString().trim().toLowerCase().includes('s')) {
//     if (phrase[0].includes('m') && phrase[1].includes('l')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].includes('l') && phrase[1].includes('m')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     }
//   } else {
//     if (phrase[0].includes('m') && phrase[1].includes('s')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].includes('s') && phrase[1].includes('m')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     }
//   }
// })
process.stdin.on('data', function (data) {
  if (f == undefined) {
    f = 1;
    return;
  }
  var Nums = data.toString().trim().split();
  if (((Nums[0] + Nums[1]) == Nums[2]) || ((Nums[0] + Nums[2]) == Nums[1]) || ((Nums[1] + Nums[2]) == Nums[0])) {
    console.log('Yes\n');
  } else {
    console.log('NO\n');
  }
})

// let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = -1, f;
// process.stdin.on('data', function (data) {
//   var d = data.toString().trim().replaceAll(' ', '\n')
//   var splittedSTR = d.split('')
//   console.log(splittedSTR);
//   let output = [];
//   if (splittedSTR.length == 1) {
//     if (f == undefined) {
//       f = data.toString().trim();
//     } else {
//     }
//     return;
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
//       splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
//       splittedSTR.splice(i + 1, 1)
//       splittedSTR.splice(i - 1, 1)
//     }
//   }
//   for (var i = 0; i < splittedSTR.length; i++) {
//     output.push(Alpha[splittedSTR[i] - 1])
//     if (output.length == splittedSTR.length) {
//       console.log(output.join(''));
//       z++
//       if (z == f) {
//         process.exit();
//       }
//       return output.join('');
//     }
//   }
// })
var f;
// process.stdin.on('data', function (data) {
//   if (f == undefined) {
//     f = 1;
//     return;
//   }
//   var phrase = data.toString().trim().toLowerCase().split(' ');
//   if (phrase[0] == phrase[1]) {
//     console.log('=\n');
//     return '=';
//   }
//   if (!data.toString().trim().toLowerCase().includes('s')) {
//     if (phrase[0].includes('m') && phrase[1].includes('l')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].includes('l') && phrase[1].includes('m')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     }
//   } else {
//     if (phrase[0].includes('m') && phrase[1].includes('s')) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].includes('s') && phrase[1].includes('m')) {
//       console.log('<\n');
//       return '<';
//     } else if (phrase[0].match(/x/g).length < phrase[1].match(/x/g).length) {
//       console.log('>\n');
//       return '>';
//     } else if (phrase[0].match(/x/g).length > phrase[1].match(/x/g).length) {
//       console.log('<\n');
//       return '<';
//     }
//   }
// })
process.stdin.on('data', function (data) {
  if (f == undefined) {
    f = 1;
    return;
  }
  var Nums = data.toString().trim().split();
  if (((Nums[0] * Nums[1]) == Nums[2]) || ((Nums[0] * Nums[2]) == Nums[1]) || ((Nums[1] * Nums[2]) == Nums[0])) {
    console.log('Yes\n');
  } else {
    console.log('NO\n');
  }
})

'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 main(){
    const testNumbers = readline()

    for(let i = 0; i<testNumbers; i++){
        solve(readline().split(" ").map(x=>parseInt(x)))
    }
}

function solve(input){
    console.log(
        input.includes(Math.abs(input[0]-input[1]))
        ||
        input.includes(Math.abs(input[0]-input[2]))
        ||
        input.includes(Math.abs(input[1]-input[2])) ? 'YES':'NO'
    )
}

'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 main(){
    const testNumbers = readline()

    for(let i = 0; i<testNumbers; i++){
        solve(readline().split(" ").map(x=>parseInt(x)));
    }
}

function solve(input){
    console.log(
        input.includes(Math.abs(input[0]-input[1]))
        ||
        input.includes(Math.abs(input[0]-input[2]))
        ||
        input.includes(input[1]-input[2]) ? 'YES':'NO'
    )
}

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\n');

let currentline = 0;
function readline(){
    return input[currentline++];
}

let T = readline();
for(let i = 1; i <= T; i++){
    let [a, b, c] = readline().split(' ').map(Number);
    console.log(solve(a, b, c));
}

function solve(a, b, c){
    return a + b === c || b + c === a || a + c === b;
}

// run on javascript V8 4.8.0
// https://codeforces.com/contest/1742/problem/A
// You are given three integers a, b, and c. Determine if one of them is the sum of the other two.
function main() {
    var tn = +readline(); // Number of test cases
    for (var i = 0; i < tn; i++) {

        var a = readline().split(' ').map(Number);
        // Call solve()
        solve(a);
    }
}

function solve(a) {
    var a = a.sort(function(a, b){return a-b});
    if (a[0] + a[1] == a[2]) {
        print('YES');
    } else {
        print('NO');
    }
}

// main();

var tests = +readline();

for(var i=0; i<tests; i++) {
    var input = readline().split(" ");
    var num1 = parseInt(input[0]);
    var num2 = parseInt(input[1]);
    var num3 = parseInt(input[3]);
    if((num1 + num2 == num3) || (num1 + num3 == num2) || (num3 + num2 == num1)) {
        print("YES");
    }else {
        print("NO");
    }
}


Alperen has two strings, $$$s$$$ and $$$t$$$ which are both initially equal to "a". He will perform $$$q$$$ operations of two types on the given strings:  $$$1 \;\; k \;\; x$$$ — Append the string $$$x$$$ exactly $$$k$$$ times at the end of string $$$s$$$. In other words, $$$s := s + \underbrace{x + \dots + x}_{k \text{ times}}$$$.  $$$2 \;\; k \;\; x$$$ — Append the string $$$x$$$ exactly $$$k$$$ times at the end of string $$$t$$$. In other words, $$$t := t + \underbrace{x + \dots + x}_{k \text{ times}}$$$. After each operation, determine if it is possible to rearrange the characters of $$$s$$$ and $$$t$$$ such that $$$s$$$ is lexicographically smaller$$$^{\dagger}$$$ than $$$t$$$.Note that the strings change after performing each operation and don't go back to their initial states.$$$^{\dagger}$$$ Simply speaking, the lexicographical order is the order in which words are listed in a dictionary. A formal definition is as follows: string $$$p$$$ is lexicographically smaller than string $$$q$$$ if there exists a position $$$i$$$ such that $$$p_i < q_i$$$, and for all $$$j < i$$$, $$$p_j = q_j$$$. If no such $$$i$$$ exists, then $$$p$$$ is lexicographically smaller than $$$q$$$ if the length of $$$p$$$ is less than the length of $$$q$$$. For example, $$$\texttt{abdc} < \texttt{abe}$$$ and $$$\texttt{abc} < \texttt{abcd}$$$, where we write $$$p < q$$$ if $$$p$$$ is lexicographically smaller than $$$q$$$.

The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. The first line of each test case contains an integer $$$q$$$ $$$(1 \leq q \leq 10^5)$$$ — the number of operations Alperen will perform. Then $$$q$$$ lines follow, each containing two positive integers $$$d$$$ and $$$k$$$ ($$$1 \leq d \leq 2$$$; $$$1 \leq k \leq 10^5$$$) and a non-empty string $$$x$$$ consisting of lowercase English letters — the type of the operation, the number of times we will append string $$$x$$$ and the string we need to append respectively. It is guaranteed that the sum of $$$q$$$ over all test cases doesn't exceed $$$10^5$$$ and that the sum of lengths of all strings $$$x$$$ in the input doesn't exceed $$$5 \cdot 10^5$$$.

For each operation, output "YES", if it is possible to arrange the elements in both strings in such a way that $$$s$$$ is lexicographically smaller than $$$t$$$ and "NO" otherwise.

3

5

2 1 aa

1 2 a

2 3 a

1 2 b

2 3 abca

2

1 5 mihai

2 2 buiucani

3

1 5 b

2 3 a

2 4 paiu

NoteIn the first test case, the strings are initially $$$s = $$$ "a" and $$$t = $$$ "a". After the first operation the string $$$t$$$ becomes "aaa". Since "a" is already lexicographically smaller than "aaa", the answer for this operation should be "YES".After the second operation string $$$s$$$ becomes "aaa", and since $$$t$$$ is also equal to "aaa", we can't arrange $$$s$$$ in any way such that it is lexicographically smaller than $$$t$$$, so the answer is "NO".After the third operation string $$$t$$$ becomes "aaaaaa" and $$$s$$$ is already lexicographically smaller than it so the answer is "YES".After the fourth operation $$$s$$$ becomes "aaabb" and there is no way to make it lexicographically smaller than "aaaaaa" so the answer is "NO".After the fifth operation the string $$$t$$$ becomes "aaaaaaabcaabcaabca", and we can rearrange the strings to: "bbaaa" and "caaaaaabcaabcaabaa" so that $$$s$$$ is lexicographically smaller than $$$t$$$, so we should answer "YES".

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const q = +lines[l++]
        const qs = lines.slice(l, l + q).map(str => str.trim().split(' ').map((x, i) => i < 2 ? +x : x))
        l += q
        output[i] = solve(qs)
    }
    console.log(output.join('\n'))
// })()
})
class Queue {
    constructor() {
        this.map = {}
        this.first = 0
        this.last = -1
    }
    push(...args) {
        let i = 0
        if (!this.length) {
            this.first = this.last = 0
            this.map[this.first] = args[i++]
        }
        for (; i < args.length; i++) {
            this.map[++this.last] = args[i]
        }
    }
    unshift(...args) {
        let i = 0
        if (!this.length) {
            this.first = this.last = 0
            this.map[this.first] = args[i++]
        }
        for (; i < args.length; i++) {
            this.map[--this.first] = args[i]
        }
    }
    pop() {
        const r = this.map[this.last]
        delete this.map[this.last]
        this.last--
        return r
    }
    shift() {
        const r = this.map[this.first]
        delete this.map[this.first]
        this.first++
        return r
    }
    get length() {
        if (this.first > this.last) return 0
        return this.last - this.first + 1
    }
    get(x) {
        return this.map[this.first + x]
    }
    getLast() {
        return this.map[this.last]
    }
    forEach(fn) {
        for (let i = this.first; i <= this.last; i++) {
            fn(this.map[i], i - this.first)
        }
    }
}

function solve(qs) {
    const s = Array(26).fill(0)
    s[0] = 1
    const t = Array(26).fill(0)
    t[0] = 1
    return qs.map(([type, k, x]) => {
        let add
        if (type === 1) {
            add = s
        } else {
            add = t
        }
        for (let i = 0; i < x.length; i++) {
            const j = x.charCodeAt(i) - 'a'.charCodeAt(0)
            add[j] += k
        }
        // console.log(s, t)
        const sch = []
        const tch = []
        for (let i = 0; i < s.length; i++) {
            if (s[i]) sch.push(i)
            if (t[i]) tch.push(i)
        }
        if (!sch.length) return 'YES'
        if (!tch.length) return 'NO'
        if (sch[0] < tch[tch.length - 1]) return 'YES'
        if (sch[0] > tch[tch.length - 1]) return 'NO'
        if (sch.length > 1) return 'NO'
        if (tch.length > 1) return 'NO'
        const a = s[sch[0]]
        const b = t[tch[0]]
        return a < b ? 'YES' : 'NO'
    }).join('\n')
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const q = +lines[l++]
        const qs = lines.slice(l, l + q).map(str => str.trim().split(' ').map((x, i) => i < 2 ? +x : x))
        l += q
        output[i] = solve(qs)
    }
    console.log(output.join('\n'))
// })()
})
class Queue {
    constructor() {
        this.map = {}
        this.first = 0
        this.last = -1
    }
    push(...args) {
        let i = 0
        if (!this.length) {
            this.first = this.last = 0
            this.map[this.first] = args[i++]
        }
        for (; i < args.length; i++) {
            this.map[++this.last] = args[i]
        }
    }
    unshift(...args) {
        let i = 0
        if (!this.length) {
            this.first = this.last = 0
            this.map[this.first] = args[i++]
        }
        for (; i < args.length; i++) {
            this.map[--this.first] = args[i]
        }
    }
    pop() {
        const r = this.map[this.last]
        delete this.map[this.last]
        this.last--
        return r
    }
    shift() {
        const r = this.map[this.first]
        delete this.map[this.first]
        this.first++
        return r
    }
    get length() {
        if (this.first > this.last) return 0
        return this.last - this.first + 1
    }
    get(x) {
        return this.map[this.first + x]
    }
    getLast() {
        return this.map[this.last]
    }
    forEach(fn) {
        for (let i = this.first; i <= this.last; i++) {
            fn(this.map[i], i - this.first)
        }
    }
}

function solve(qs) {
    const s = Array(26).fill(0)
    s[0] = 1
    const t = Array(26).fill(0)
    t[0] = 1
    return qs.map(([type, k, x]) => {
        let add
        if (type === 1) {
            add = s
        } else {
            add = t
        }
        for (let i = 0; i < x.length; i++) {
            const j = x.charCodeAt(i) - 'a'.charCodeAt(0)
            add[j] += k
        }
        // console.log(s, t)
        const sch = []
        const tch = []
        for (let i = 0; i < s.length; i++) {
            if (s[i]) sch.push(i)
            if (t[i]) tch.push(i)
        }
        if (!sch.length) return 'YES'
        if (!tch.length) return 'NO'
        if (sch[0] < tch[tch.length - 1]) return 'YES'
        if (sch[0] > tch[tch.length - 1]) return 'NO'
        // if (sch.length > 1) return 'NO'
        // if (tch.length > 1) return 'NO'
        const a = s[sch[0]]
        const b = t[tch[0]]
        // console.log(s, t)
        if (a < b) {
            return sch.length > 1 ? 'NO' : 'YES'
        } else if (a > b) {
            // return tch.length > 1 ? 'NO' : 'YES'
            return 'NO'
        } else {
            // return sch.length > 1 ? 'NO' : 'YES'
            return 'NO'
        }
    }).join('\n')
}

'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(read) {
  const [rn, rb, rns, re, rbs] = convertInput(read);
  const n = rn();
  const res = new Array(n);
  const cnt1 = new Array(26).fill(0),
        cnt2 = new Array(26).fill(0);
  let sum1 = 1,
      sum2 = 1;
  cnt1[0] = 1;
  cnt2[0] = 1;
  let flag = false;
  next: for (let i = 0; i < n; i++) {
    const d = rn(),
          k = rn(),
          s = read();
    if (!flag) {
      for (let j = 0; j < s.length; j++) {
        if (d === 1) {
          cnt1[s[j].charCodeAt(0) - 97] += k;
          sum1 += k;
        } else {
          if (s[j] !== 'a') {
            flag = true;
            break;
          }
          cnt2[s[j].charCodeAt(0) - 97] += k;
          sum2 += k;
        }
      }
    }
    if (flag) {
      res[i] = 'YES';
    } else {
      let p1 = 0,
          p2 = 0;
      for (let j = 0; j < 26; j++) {
        p1 += cnt1[j];
        p2 += cnt2[j];
        if (cnt1[j] !== cnt2[j]) {
          if (cnt1[j] < cnt2[j] && p1 === sum1 || cnt1[j] > cnt2[j] && p2 !== sum2) {
            res[i] = 'YES';
            continue next;
          }
          break;
        }
      }
      res[i] = 'NO';
    }
  }
  return res.join('\n');
}
function convertInput(read) {
  const rn = () => Number(read());
  const rb = () => BigInt(read());
  const rns = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rn();
    return res;
  };
  const re = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rn() - 1;
    return res;
  };
  const rbs = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rb();
    return res;
  };
  return [rn, rb, rns, re, rbs];
}
function main(r) {
  const [rn, rb, rns, re, rbs] = convertInput(r);
  try {
    let t = rn();
    let res = new Array(t);
    let limit = 0;
    for (let i = 0; i < t; i++) {
      var _solve;
      const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';
      if (t < limit) {
        process.stdout.write(s.toString());
        process.stdout.write('\n');
      } else {
        res[i] = s;
      }
    }
    if (t >= limit) {
      return res.join('\n');
    } else {
      return '';
    }
  } catch (error) {
    console.log(error);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8')
.split(/\s+/);
void function () {
  const read = ((i = 0) => () => inputs[i++])();
  const output = main(read);
  process.stdout.write(output);
}();

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const q = +lines[l++]
        const qs = lines.slice(l, l + q).map(str => str.trim().split(' ').map((x, i) => i < 2 ? +x : x))
        l += q
        output[i] = solve(qs)
    }
    console.log(output.join('\n'))
// })()
})
class Queue {
    constructor() {
        this.map = {}
        this.first = 0
        this.last = -1
    }
    push(...args) {
        let i = 0
        if (!this.length) {
            this.first = this.last = 0
            this.map[this.first] = args[i++]
        }
        for (; i < args.length; i++) {
            this.map[++this.last] = args[i]
        }
    }
    unshift(...args) {
        let i = 0
        if (!this.length) {
            this.first = this.last = 0
            this.map[this.first] = args[i++]
        }
        for (; i < args.length; i++) {
            this.map[--this.first] = args[i]
        }
    }
    pop() {
        const r = this.map[this.last]
        delete this.map[this.last]
        this.last--
        return r
    }
    shift() {
        const r = this.map[this.first]
        delete this.map[this.first]
        this.first++
        return r
    }
    get length() {
        if (this.first > this.last) return 0
        return this.last - this.first + 1
    }
    get(x) {
        return this.map[this.first + x]
    }
    getLast() {
        return this.map[this.last]
    }
    forEach(fn) {
        for (let i = this.first; i <= this.last; i++) {
            fn(this.map[i], i - this.first)
        }
    }
}

function solve(qs) {
    const s = Array(26).fill(0)
    const t = Array(26).fill(0)
    return qs.map(([type, k, x]) => {
        let add
        if (type === 1) {
            add = s
        } else {
            add = t
        }
        for (let i = 0; i < x.length; i++) {
            const j = x.charCodeAt(i) - 'a'.charCodeAt(0)
            add[j] += k
        }
        // console.log(s, t)
        const sch = []
        const tch = []
        for (let i = 0; i < s.length; i++) {
            if (s[i]) sch.push(i)
            if (t[i]) tch.push(i)
        }
        if (!sch.length) return 'YES'
        if (!tch.length) return 'NO'
        if (sch[0] < tch[tch.length - 1]) return 'YES'
        if (sch[0] > tch[tch.length - 1]) return 'NO'
        if (sch.length > 1) return 'NO'
        if (tch.length > 1) return 'NO'
        const a = s[sch[0]]
        const b = t[tch[0]]
        return a < b ? 'YES' : 'NO'
    }).join('\n')
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const q = +lines[l++]
        const qs = lines.slice(l, l + q).map(str => str.trim().split(' ').map((x, i) => i < 2 ? +x : x))
        l += q
        output[i] = solve(qs)
    }
    console.log(output.join('\n'))
// })()
})
class Queue {
    constructor() {
        this.map = {}
        this.first = 0
        this.last = -1
    }
    push(...args) {
        let i = 0
        if (!this.length) {
            this.first = this.last = 0
            this.map[this.first] = args[i++]
        }
        for (; i < args.length; i++) {
            this.map[++this.last] = args[i]
        }
    }
    unshift(...args) {
        let i = 0
        if (!this.length) {
            this.first = this.last = 0
            this.map[this.first] = args[i++]
        }
        for (; i < args.length; i++) {
            this.map[--this.first] = args[i]
        }
    }
    pop() {
        const r = this.map[this.last]
        delete this.map[this.last]
        this.last--
        return r
    }
    shift() {
        const r = this.map[this.first]
        delete this.map[this.first]
        this.first++
        return r
    }
    get length() {
        if (this.first > this.last) return 0
        return this.last - this.first + 1
    }
    get(x) {
        return this.map[this.first + x]
    }
    getLast() {
        return this.map[this.last]
    }
    forEach(fn) {
        for (let i = this.first; i <= this.last; i++) {
            fn(this.map[i], i - this.first)
        }
    }
}

function solve(qs) {
    const s = Array(26).fill(0)
    const t = Array(26).fill(0)
    return qs.map(([type, k, x]) => {
        let add
        if (type === 1) {
            add = s
        } else {
            add = t
        }
        for (let i = 0; i < x.length; i++) {
            const j = x.charCodeAt(i) - 'a'.charCodeAt(0)
            add[j] += k
        }
        // console.log(s, t)
        const sch = []
        const tch = []
        for (let i = 0; i < s.length; i++) {
            if (s[i]) sch.push(i)
            if (t[i]) tch.push(i)
        }
        if (!sch.length) return 'YES'
        if (sch[0] < tch[tch.length - 1]) return 'YES'
        if (sch.length > 1) return 'NO'
        const a = s[sch[0]]
        const b = t[tch[0]]
        return a < b ? 'YES' : 'NO'
    }).join('\n')
}


Amr lives in Lala Land. Lala Land is a very beautiful country that is located on a coordinate line. Lala Land is famous with its apple trees growing everywhere.Lala Land has exactly n apple trees. Tree number i is located in a position xi and has ai apples growing on it. Amr wants to collect apples from the apple trees. Amr currently stands in x = 0 position. At the beginning, he can choose whether to go right or left. He'll continue in his direction until he meets an apple tree he didn't visit before. He'll take all of its apples and then reverse his direction, continue walking in this direction until he meets another apple tree he didn't visit before and so on. In the other words, Amr reverses his direction when visiting each new apple tree. Amr will stop collecting apples when there are no more trees he didn't visit in the direction he is facing.What is the maximum number of apples he can collect?

The first line contains one number n (1 ≤ n ≤ 100), the number of apple trees in Lala Land. The following n lines contains two integers each xi, ai ( - 105 ≤ xi ≤ 105, xi ≠ 0, 1 ≤ ai ≤ 105), representing the position of the i-th tree and number of apples on it. It's guaranteed that there is at most one apple tree at each coordinate. It's guaranteed that no tree grows in point 0.

Output the maximum number of apples Amr can collect.

NoteIn the first sample test it doesn't matter if Amr chose at first to go left or right. In both cases he'll get all the apples.In the second sample test the optimal solution is to go left to x =  - 1, collect apples from there, then the direction will be reversed, Amr has to go to x = 1, collect apples from there, then the direction will be reversed and Amr goes to the final tree x =  - 2.In the third sample test the optimal solution is to go right to x = 1, collect apples from there, then the direction will be reversed and Amr will not be able to collect anymore apples because there are no apple trees to his left.

var n = parseInt(readline());
var plusArr = [];
var minusArr = [];
for (var i = 0; i < n; i++) {
  var numbers = readline().split(" ").map(function(x) { return parseInt(x); });
  if (numbers[0] > 0) {
    plusArr.push({
      x: numbers[0],
      a: numbers[1]
    })
  }
  else {
    minusArr.push({
      x: Math.abs(numbers[0]),
      a: numbers[1]
    })
  }
}

function sortfunction(a, b){
  return (a.x - b.x)
}

plusArr.sort(sortfunction);
minusArr.sort(sortfunction);

var sum = 0;
var min = Math.min(plusArr.length, minusArr.length);
plusArr.forEach(function(apple, i) {
  if (i <= min)
    sum = sum + apple.a;
});
minusArr.forEach(function(apple, i) {
  if (i <= min)
    sum = sum + apple.a;
});

print(sum);

function main() {
    var n = parseInt(readline()),
        rightList = {}, leftList = {}, result = 0;

    for(var index = 0; index < n; index++)  {
        var XAi = readline().split(/\s/gi).map(Number);

        if(XAi[0] < 0)  {
            rightList[XAi[0]] = XAi[1];
        } else  {
            leftList[XAi[0]] = XAi[1];
        }
    }

    var leftPos = Object.keys(leftList).map(Number).sort(function(a, b) { return a - b }),
        rightPos = Object.keys(rightList).map(Number).sort(function(a, b) { return b - a });

    if(rightPos.length > leftPos.length)  {
        leftPos.forEach(function(pos)   {
            result += leftList[pos];
        });

        rightPos.some(function(pos, index)   {
            if(index <= leftPos.length)  {
                result += rightList[pos];
            } else  {
                return true;
            }
        });
    } else if(rightPos.length < leftPos.length)   {
        rightPos.forEach(function(pos)   {
            result += rightList[pos];
        });

        leftPos.some(function(pos, index)   {
            if(index <= rightPos.length)  {
                result += leftList[pos];
            } else  {
                return true;
            }
        });
    } else  {
        leftPos.forEach(function(pos)   {
            result += leftList[pos];
        });

        rightPos.forEach(function(pos)   {
            result += rightList[pos];
        });
    }

    print(result);
};

Array.prototype.getLastValue = function()   {
    return this[this.length - 1];
};

main();

var n = parseInt(readline());
var plusArr = [];
var minusArr = [];
for (var i = 0; i < n; i++) {
  var numbers = readline().split(" ").map(function(x) { return parseInt(x); });
  if (numbers[0] > 0) {
    plusArr.push({
      x: numbers[0],
      a: numbers[1]
    })
  }
  else {
    minusArr.push({
      x: Math.abs(numbers[0]),
      a: numbers[1]
    })
  }
}
plusArr.sort();
minusArr.sort();

var sum = 0;
if ((Math.abs(plusArr.length - minusArr.length) == 0) || (Math.abs(plusArr.length - minusArr.length) == 1)) {
  plusArr.forEach(function(apple) {
    sum = sum + apple.a;
  });
  minusArr.forEach(function(apple) {
    sum = sum + apple.a;
  });
}
else if (plusArr.length > minusArr.length) {
  for (var i=0; i < minusArr.length + 1; i++) {
    sum = sum + plusArr[i].a;
  }
}
else {
  for (var i=0; i < plusArr.length + 1; i++) {
    sum = sum + minusArr[i].a;
  }
}

print(sum);

function main() {
    var n = parseInt(readline()),
        rightList = [ 0 ], leftList = [ 0 ], result = 0;

    for(var index = 0; index < n; index++)  {
        var XAi = readline().split(/\s/gi).map(Number);

        if(XAi[0] < 0)  {
            rightList.push(rightList.getLastValue() + XAi[1]);
        } else  {
            leftList.push(leftList.getLastValue() + XAi[1]);
        }
    }

    if(rightList.length > leftList.length)  {
        result = leftList.getLastValue() + rightList[leftList.length];
    } else if(rightList.length < leftList.length)   {
        result = rightList.getLastValue() + leftList[rightList.length];
    } else  {
        result = rightList.getLastValue() + leftList.getLastValue();
    }

    print(result);
};

Array.prototype.getLastValue = function()   {
    return this[this.length - 1];
};

main();


You are given a string $$$s$$$ of lowercase Latin letters. The following operation can be used:   select one character (from 'a' to 'z') that occurs at least once in the string. And replace all such characters in the string with the previous one in alphabetical order on the loop. For example, replace all 'c' with 'b' or replace all 'a' with 'z'. And you are given the integer $$$k$$$ — the maximum number of operations that can be performed. Find the minimum lexicographically possible string that can be obtained by performing no more than $$$k$$$ operations.The string $$$a=a_1a_2 \dots a_n$$$ is lexicographically smaller than the string $$$b = b_1b_2 \dots b_n$$$ if there exists an index $$$k$$$ ($$$1 \le k \le n$$$) such that $$$a_1=b_1$$$, $$$a_2=b_2$$$, ..., $$$a_{k-1}=b_{k-1}$$$, but $$$a_k < b_k$$$.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) —the number of test cases in the test. This is followed by descriptions of the test cases. 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 10^9$$$) — the size of the string $$$s$$$ and the maximum number of operations that can be performed on the string $$$s$$$. The second line of each test case contains a string $$$s$$$ of length $$$n$$$ consisting of lowercase Latin letters.  It is guaranteed that the sum $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

For each test case, output the lexicographically minimal string that can be obtained from the string $$$s$$$ by performing no more than $$$k$$$ operations.

4

3 2

cba

4 5

fgde

7 5

gndcafb

4 19

ekyv

'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, s) {
  const nums = s.split('').map(char => char.charCodeAt(0) - 97);
  let pre = 0;
  for (let i = 0; i < n; i++) {
    if (nums[i] === 97) continue;
    let cur = nums[i];
    while (m && nums[i] > pre) {
      m--;
      let num = nums[i];
      for (let j = i; j < n; j++) {
        if (nums[j] === num) nums[j]--;
      }
    }
    if (nums[i] === pre) {
      for (let j = i; j < n; j++) {
        if (nums[j] === pre) nums[j] = 0;
      }
    }
    pre = Math.max(cur, pre);
    if (!m) {
      break;
    }
  }
  console.log(nums.map(num => String.fromCharCode(num + 97)).join(''));
}

async function main(read) {
  let t = Number(await read());
  while (t--) {
    const [n, m] = (await read()).split(' ').map(Number);
    const s = await read();
    solve(n, m, s);
  }
}

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

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

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

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

const cnk = (n, k) => {
    let res = 1;
    for (let i = 1; i <= k; i++)
        res = res * (n - k + i) / i;
    return Math.round(res + 0.01);
}

const sumab = (a, b) => {
    let x = (b - a + 1);
    let y = a + b;
    if (x % 2 === 0) {
        x = Math.round(x / 2);
    } else {
        y = Math.round(y / 2);
    }
    return BigInt(x) * BigInt(y);
}

const calc = (n, k, a)=>{
    // if (k > 25) {
    //     let result = new Array(n).fill('a');
    //     return result.join('');
    // }

    let charmap = {};

    let aCode = 'a'.charCodeAt(0);

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

    for (let i = 0; i < n; i++) {
        if (k <= 0) break;
        let curchar = charmap[a[i]];
        let idx = curchar.charCodeAt(0) - aCode;

        if (idx === 0) continue;
        let diff = Math.min(idx, k);
        let newchar = String.fromCharCode(aCode + (idx - diff));
        // console.log(`DEBUG newchar`, newchar);

        let found = false;

        for (let j = 1; j <= diff; j++) {
            let c = String.fromCharCode(aCode + (idx - j));
            // console.log(`DEBUG j ${j} c`, c);
            if (!!charmap[c] && charmap[c] !== c) {
                let nextchar = charmap[c];
                // console.log(`DEBUG j ${j} nextchar`, nextchar);
                for (let q = 0; q <= j; q++) {
                    let cc = String.fromCharCode(aCode + (idx - j + q));
                    charmap[cc] = nextchar;
                }

                k -= j;
                found = true;
                break;
            }
        }
        if (found) continue;

        k -= diff;

        for (let j = 0; j <= diff; j++) {
            let c = String.fromCharCode(aCode + (idx - j));
            charmap[c] = newchar;
        }
        // console.log(`DEBUG charmap`, charmap);
    }

    for (let i = 0; i < n; i++) {
        a[i] = charmap[a[i]];
    }
    return a.join('');
};

function main() {
    let T = +readline();
    for (let t = 1; t <= T; t++){
        // let n = +readline();
        let [n, k] = ra();
        let a = readline().split('');
        console.log(`${calc(n, k, a)}`);
    }
}

'use strict';
// HEADER:
const print = console.log;
let IS_MULTITEST, testN;
const pcalc = testN=>{
  let res = calc(testN);
  if (Array.isArray(res)){
    pa(res);
  } else if (Number.isFinite(res) || typeof res=='string'){
    print(res);
  }
};

const main = ()=>{
  if (IS_MULTITEST){
    let T = +readline()
    for (testN=1; testN<=T; testN++)
      pcalc(T);
  } else
   pcalc();
};

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(`Test #${testN}`, obj);

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

// SOLUTION:
IS_MULTITEST = 1;

const calc = ()=>{
  // READING:
  let [n, k] = ra();
  let S = readline().split('');
  LT({n, k, S});
  // PROCESSING:
  let get_prev = (ch)=>{
    if (ch!='a'){
      return String.fromCharCode(ch.charCodeAt(0)-1)
    }
  };
  let covered = {};
  let ops = 0;
  for (let i=0; i<n && ops<k; i++){
    let ch = S[i];
    while (ch!='a' && ops<k){
      if (!covered[ch])
        ops++;
      covered[ch] = 1;
      ch = get_prev(ch);
    }
  }
  L({covered})
  let res = '';
  for (let i=0; i<n; i++){
    let ch = S[i];
    while (ch!='a' && covered[ch]){
      ch = get_prev(ch);
    }
    res += ch;
  }
  return res;
};

const readline = require('readline')

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

function solve(n, k, str) {
    const a = 'a'.charCodeAt(0)
    //
    const dp = Array(n)//.fill(-1)
    let p = 0
    let pp = -1, pto
    while (p < n && k >= 0) {
        if (dp[p]) {
            p++
            continue
        }

        const connect = str.charCodeAt(p) - str.charCodeAt(pp)
        let cost, to
        if (pp >= 0 && k >= connect) {
            cost = connect
            to = pto
        } else {
            const max = str.charCodeAt(p) - a
            cost = Math.min(max, k)
            to = String.fromCharCode(str.charCodeAt(p) - cost)
        }
        k -= cost
    // console.log(str[p], to, cost)
        for (let i = 0; i < str.length; i++) {
            if (dp[i]) continue
            if (str[i] <= str[p]) {
                // dp[i] = p
                if (str[i] >= to) {
                    dp[i] = to
                } else {
                    dp[i] = str[i]
                }
            }
        }
        pp = p
        pto = to
        //
        p++
    }
    return dp.join('')
}

'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, s) {
  const nums = s.split('').map(char => char.charCodeAt(0) - 97);
  let pre = 0;
  for (let i = 0; i < n; i++) {
    if (nums[i] === 97) continue;
    let cur = nums[i];
    while (m && nums[i] > pre) {
      m--;
      let num = nums[i];
      for (let j = i; j < n; j++) {
        if (nums[j] === num) nums[j]--;
      }
    }
    pre = Math.max(cur, pre);
    if (!m) {
      break;
    }
  }
  console.log(nums.map(num => String.fromCharCode(num + 97)).join(''));
}

async function main(read) {
  let t = Number(await read());
  while (t--) {
    const [n, m] = (await read()).split(' ').map(Number);
    const s = await read();
    solve(n, m, s);
  }
}

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

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

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

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

const cnk = (n, k) => {
    let res = 1;
    for (let i = 1; i <= k; i++)
        res = res * (n - k + i) / i;
    return Math.round(res + 0.01);
}

const sumab = (a, b) => {
    let x = (b - a + 1);
    let y = a + b;
    if (x % 2 === 0) {
        x = Math.round(x / 2);
    } else {
        y = Math.round(y / 2);
    }
    return BigInt(x) * BigInt(y);
}

const calc = (n, k, a)=>{
    // if (k > 25) {
    //     let result = new Array(n).fill('a');
    //     return result.join('');
    // }

    let charmap = {};

    let aCode = 'a'.charCodeAt(0);

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

    for (let i = 0; i < n; i++) {
        if (k <= 0) break;
        let curchar = charmap[a[i]];
        let idx = curchar.charCodeAt(0) - aCode;

        if (idx === 0) continue;
        let diff = Math.min(idx, k);
        let newchar = String.fromCharCode(aCode + (idx - diff));
        // console.log(`DEBUG newchar`, newchar);

        let found = false;

        for (let j = 1; j < diff; j++) {
            let c = String.fromCharCode(aCode + (idx - j));
            // console.log(`DEBUG j ${j} c`, c);
            if (!!charmap[c] && charmap[c] !== c) {
                let nextchar = charmap[c];
                // console.log(`DEBUG j ${j} nextchar`, nextchar);
                for (let q = 0; q <= j; q++) {
                    let cc = String.fromCharCode(aCode + (idx - j + q));
                    charmap[cc] = nextchar;
                }

                k -= j;
                found = true;
                break;
            }
        }
        if (found) continue;

        k -= diff;

        for (let j = 0; j < diff; j++) {
            let c = String.fromCharCode(aCode + (idx - j));
            charmap[c] = newchar;
        }
        // console.log(`DEBUG charmap`, charmap);
    }

    for (let i = 0; i < n; i++) {
        a[i] = charmap[a[i]];
    }
    return a.join('');
};

function main() {
    let T = +readline();
    for (let t = 1; t <= T; t++){
        // let n = +readline();
        let [n, k] = ra();
        let a = readline().split('');
        console.log(`${calc(n, k, a)}`);
    }
}


You are given two positive integers $$$n$$$ and $$$s$$$. Find the maximum possible median of an array of $$$n$$$ non-negative integers (not necessarily distinct), such that the sum of its elements is equal to $$$s$$$.A median of an array of integers of length $$$m$$$ is the number standing on the $$$\lceil {\frac{m}{2}} \rceil$$$-th (rounding up) position in the non-decreasing ordering of its elements. Positions are numbered starting from $$$1$$$. For example, a median of the array $$$[20,40,20,50,50,30]$$$ is the $$$\lceil \frac{m}{2} \rceil$$$-th element of $$$[20,20,30,40,50,50]$$$, so it is $$$30$$$. There exist other definitions of the median, but in this problem we use the described definition.

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Description of the test cases follows. Each test case contains a single line with two integers $$$n$$$ and $$$s$$$ ($$$1 \le n, s \le 10^9$$$) — the length of the array and the required sum of the elements.

For each test case print a single integer — the maximum possible median.

NotePossible arrays for the first three test cases (in each array the median is underlined):  In the first test case $$$[\underline{5}]$$$  In the second test case $$$[\underline{2}, 3]$$$  In the third test case $$$[1, \underline{2}, 2]$$$

var limit = parseInt(readline());
for (var i = 0; i < limit; i++)
{
    var caseArray = readline().split(" ");
    var terms = parseInt(caseArray[0]);
    var total = parseInt(caseArray[1]);
    var div = Math.floor(terms/2) + 1;
    var result = Math.floor(total/div);
    print(result);
}

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

	function main() {
		var testCasesNum = +readline();
		for (var i = 0; i < testCasesNum; i++) {
			var ns = readStringArray();
			var n = ns[0];
			var s = ns[1];
			var ind = n % 2 ? Math.floor(n / 2) : Math.floor(n / 2) - 1;
			var res = Math.floor(s / (n - ind));
			print(res);
		}
	}

	main();

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
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';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//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();
	while(hasNext()){
		var N = nextInt();
		var S = nextInt();
		var size = Math.ceil((N + 1) / 2);
		myout(Math.floor(S / size));
	}
}

process.stdin.resume();
process.stdin.setEncoding('utf8');
let standardInputString = '';
let curLine = 0;

const readLine = () => {
  return standardInputString[curLine++];
};

process.stdin.on('data', rawData => {
  standardInputString += rawData;
});

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

  main();
});

/**
 * Test cases.
 *
 * 5
 * 1 15 // 15
 * 3 16 // 8
 * 5 19 // 6
 * 4 20 // 6
 * 1000000000 1 // 0
 */

// https://codeforces.com/contest/1566/problem/A
const main = () => {
    const t = +readLine();

    for (let _ = 0; _ < t; _ += 1) {
        const [n, s] = readLine().split(' ');

        const ans = Math.floor(
            s / Math.floor(n / 2 + 1),
        );

        console.log(ans);
    }
};


Each employee of the "Blake Techologies" company uses a special messaging app "Blake Messenger". All the stuff likes this app and uses it constantly. However, some important futures are missing. For example, many users want to be able to search through the message history. It was already announced that the new feature will appear in the nearest update, when developers faced some troubles that only you may help them to solve.All the messages are represented as a strings consisting of only lowercase English letters. In order to reduce the network load strings are represented in the special compressed form. Compression algorithm works as follows: string is represented as a concatenation of n blocks, each block containing only equal characters. One block may be described as a pair (li, ci), where li is the length of the i-th block and ci is the corresponding letter. Thus, the string s may be written as the sequence of pairs .Your task is to write the program, that given two compressed string t and s finds all occurrences of s in t. Developers know that there may be many such occurrences, so they only ask you to find the number of them. Note that p is the starting position of some occurrence of s in t if and only if tptp + 1...tp + |s| - 1 = s, where ti is the i-th character of string t.Note that the way to represent the string in compressed form may not be unique. For example string "aaaa" may be given as , , ...

The first line of the input contains two integers n and m (1 ≤ n, m ≤ 200 000) — the number of blocks in the strings t and s, respectively. The second line contains the descriptions of n parts of string t in the format "li-ci" (1 ≤ li ≤ 1 000 000) — the length of the i-th part and the corresponding lowercase English letter. The second line contains the descriptions of m parts of string s in the format "li-ci" (1 ≤ li ≤ 1 000 000) — the length of the i-th part and the corresponding lowercase English letter.

Print a single integer — the number of occurrences of s in t.

NoteIn the first sample, t = "aaabbccccaaacc", and string s = "aabbc". The only occurrence of string s in string t starts at position p = 2.In the second sample, t = "aaabbbbbbaaaaaaacccceeeeeeeeaa", and s = "aaa". The occurrences of s in t start at positions p = 1, p = 10, p = 11, p = 12, p = 13 and p = 14.

var str = readline().split(" ", 2);
var n = Number(str[0]);
var m = Number(str[1]);

var strn = readline().split(" ", n);
var strm = readline().split(" ", m);
var numn = [], charn = [];
var numm = [], charm = [];

function normal(str, num, char) {
	var arr = str[0].split("-", 2);
	num[0] = Number(arr[0]);
	char[0] = arr[1].charCodeAt(0);
	var last = 0;

	for (var i = 1; i < str.length; ++i) {
		arr = str[i].split("-", 2);
		var x = Number(arr[0]);
		var y = arr[1].charCodeAt(0);
		if (char[last] === y) {
			num[last] += x;
		} else {
			++last;
			num[last] = x;
			char[last] = y;
		}
	}
}
normal(strn, numn, charn);
normal(strm, numm, charm);

if (numm.length === 1) {
	var ans = 0;
	for (var i = 0; i < numn.length; ++i) {
		if (charm[0] === charn[i]) {
			if (numm[0] <= numn[i]) {
				ans += numn[i] - numm[0] + 1;
			}
			++i;
		}
	}
	print(ans);
} else if (numm.length === 2) {
	var ans = 0;
	for (var i = 0; i < numn.length - 1; ++i) {
		if (charm[0] === charn[i]) {
			if (numm[0] <= numn[i] && charm[1] === charn[i + 1] &&
				numm[1] <= numn[i + 1]) {
				++ans;
			}
			++i;
		}
	}
	print(ans);
}
else {
var pre = [];
for (var i = 0; i < numm.length; ++i) {
	if (i < 2) {
		pre[i] = 0;
	} else {
		var pos =  i - 1;
		while (pre[pos] !== 0 &&
			!(numm[i] === numm[pre[pos]] && charm[i] === charm[pre[pos]])) {
			pos = pre[pos] - 1;
		}
		if (pre[pos] === 0) {
			if ((i !== numm.length - 1 && numm[i] >= numm[0] ||
			  i === numm.length - 1 && numm[i] === numm[0])
			  && charm[i] === charm[0]) {
				pre[i] = 1;
			} else {
				pre[i] = 0;
			}
		}  else {
			pre[i] = pre[pos] + 1;
		}
	}
}

var pos = 0, ans = 0;
for (var i = 0; i < numn.length; ++i) {
	if (pos === numm.length - 1) {
		if (numm[pos] <= numn[i] && charm[pos] === charn[i]) {
			++ans;
			if (numm[pos] === numn[i]) {
				pos = pre[pos];
				continue;
			} else {
				pos = pre[pos - 1];
			}
		} else {
			pos = pre[pos - 1];
		}
	}
	while (pos !== 0 &&
		!(numm[pos] === numn[i] && charm[pos] === charn[i])) {
		pos = pre[pos - 1];
	}
	if (pos === 0) {
		if (numm[0] <= numn[i] && charm[0] === charn[i]) {
			pos = 1;
		}
	} else {
		++pos;
	}
}

print(ans);
}

var str = readline().split(" ", 2);
var n = Number(str[0]);
var m = Number(str[1]);

var strn = readline().split(" ", n);
var strm = readline().split(" ", m);
var numn = [], charn = [];
var numm = [], charm = [];

function normal(str, num, char) {
	var arr = str[0].split("-", 2);
	num[0] = Number(arr[0]);
	char[0] = arr[1].charCodeAt(0);
	var last = 0;

	for (var i = 1; i < str.length; ++i) {
		arr = str[i].split("-", 2);
		var x = Number(arr[0]);
		var y = arr[1].charCodeAt(0);
		if (char[last] === y) {
			num[last] += x;
		} else {
			++last;
			num[last] = x;
			char[last] = y;
		}
	}
}
normal(strn, numn, charn);
normal(strm, numm, charm);

if (numm.length === 1) {
	var ans = 0;
	for (var i = 0; i < numn.length; ++i) {
		if (charm[0] === charn[i]) {
			if (numm[0] <= numn[i]) {
				ans += numn[i] - numm[0] + 1;
			}
			++i;
		}
	}
	print(ans);
} else if (numm.length === 2) {
	var ans = 0;
	for (var i = 0; i < numn.length - 1; ++i) {
		if (charm[0] === charn[i]) {
			if (numm[0] <= numn[i] && charm[1] === charn[i + 1] &&
				numm[1] <= numn[i + 1]) {
				++ans;
			}
			++i;
		}
	}
	print(ans);
}
else {
var pre = [];
for (var i = 0; i < numm.length; ++i) {
	if (i < 2) {
		pre[i] = 0;
	} else {
		var pos =  i - 1;
		while (pre[pos] !== 0 &&
			!(numm[i] === numm[pre[pos]] && charm[i] === charm[pre[pos]])) {
			pos = pre[pos] - 1;
		}
		if (pre[pos] === 0) {
			if ((i !== numm.length - 1 && numm[i] >= numm[0] ||
			  i === numm.length - 1 && numm[i] === numm[0])
			  && charm[i] === charm[0]) {
				pre[i] = 1;
			} else {
				pre[i] = 0;
			}
		}  else {
			pre[i] = pre[pos] + 1;
		}
	}
}

var pos = 0, ans = 0;
for (var i = 0; i < numn.length; ++i) {
	if (pos === numm.length - 1) {
		if (numm[pos] <= numn[i] && charm[pos] === charn[i]) {
			++ans;
			if (numm[pos] === numn[i]) {
				pos = pre[pos];
			} else {
				pos = pre[pos - 1];
			}
		} else {
			pos = pre[pos - 1];
		}
	}
	while (pos !== 0 &&
		!(numm[pos] === numn[i] && charm[pos] === charn[i])) {
		pos = pre[pos - 1];
	}
	if (pos === 0) {
		if (numm[0] <= numn[i] && charm[0] === charn[i]) {
			pos = 1;
		}
	} else {
		++pos;
	}
}

print(ans);
}