Positive integer $$$x$$$ is called divisor of positive integer $$$y$$$, if $$$y$$$ is divisible by $$$x$$$ without remainder. For example, $$$1$$$ is a divisor of $$$7$$$ and $$$3$$$ is not divisor of $$$8$$$.We gave you an integer $$$d$$$ and asked you to find the smallest positive integer $$$a$$$, such that  $$$a$$$ has at least $$$4$$$ divisors;  difference between any two divisors of $$$a$$$ is at least $$$d$$$.

The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 3000$$$) — the number of test cases. The first line of each test case contains a single integer $$$d$$$ ($$$1 \leq d \leq 10000$$$).

For each test case print one integer $$$a$$$ — the answer for this test case.

NoteIn the first test case, integer $$$6$$$ have following divisors: $$$[1, 2, 3, 6]$$$. There are $$$4$$$ of them and the difference between any two of them is at least $$$1$$$. There is no smaller integer with at least $$$4$$$ divisors.In the second test case, integer $$$15$$$ have following divisors: $$$[1, 3, 5, 15]$$$. There are $$$4$$$ of them and the difference between any two of them is at least $$$2$$$.The answer $$$12$$$ is INVALID because divisors are $$$[1, 2, 3, 4, 6, 12]$$$. And the difference between, for example, divisors $$$2$$$ and $$$3$$$ is less than $$$d=2$$$.

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

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

function main() {
	let t = +readLine();
	const map = new Map();
	const primes = [2];
	const isPrime = Array(1e5).fill(1);

	for (let i = 3; i <= 1e5; i += 2) {
		if (isPrime[i] === 1) {
			primes.push(i);
			for (let j = i + i; j <= 1e5; j += i) {
				isPrime[j] = 0;
			}
		}
	}
	while (t--) {
		const n = +readLine();
		if (map.has(n)) console.log(map.get(n));
		else {
			const a = immediateGreaterValue(primes, n);
			const b = immediateGreaterValue(primes, a + n - 1);
			map.set(n, a * b);
			console.log(a * b);

			function immediateGreaterValue(arr, target) {
				let [left, right] = [0, arr.length - 1];
				while (left <= right) {
					const mid = left + Math.floor((right - left) / 2);
					if (arr[mid] > target) right = mid - 1;
					else left = mid + 1;
				}
				return arr[left];
			}
		}
	}
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();
    var answer = []

    // console.log(Number(x))
    // 1 1 7
    // 6 9, 15, 18
    Array(Number(x)).fill(1).map((t, i) => {
        var n = Number(readline());
        var d =n+1
        sumDivisors(d*d*d, n)
        // console.log((1+n)*(1+2*n))

    })

}

function sumDivisors(n, d) {
    var sum = 0;
    var nn = 1+d
    while(!isPrime(nn)) nn++
    var nn2 = nn+d
    while(!isPrime(nn2)) nn2++

    console.log(nn2*nn)
}
function isPrime(num) {
    for(var i = 2; i < num; i++)
        if(num % i === 0) return false;
    return num > 1;
}

//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{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
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();
	var map = {};
	var sosu = Array.from(sieveOfEratos(30000));
	sosu.sort(function(a,b){
		return a - b;
	});
	for(var i = 0; i < t; i++){
		var d = nextInt();
		if(map[d] != null){
			myout(map[d]);
			continue;
		}
		var L = 0;
		var index = -1;
		for(var j = 0; j < sosu.length; j++){
			if(sosu[j] > d){
				index = j;
				L = sosu[j];
				break;
			}
		}
		var R = 0;
		for(var j = index + 1; j < sosu.length; j++){
			if(sosu[j] - L >= d){
				R = sosu[j];
				break;
			}
		}
		myout(L * R);
		map[d] = L * R;
	}
}
function isPrime(val){
  if(val == null || val <= 1 || (val != 2 && val % 2 == 0)){
    return false;
  }else if(val == 2){
    return true;
  }
  var root = Math.floor(Math.sqrt(val));
  for(var i = 3; i <= root; i += 2){
    if(val % i == 0){
      return false;
    }
  }
  return true;
}
function sieveOfEratos(val){
  var primes = new Set();
  var nums = new Set();
  var used = [2,3,5,7,11];//これらは既に素数であるとする
  var underPrime = 13;//この値から+2ごとに追加。↑の値で割り切れたものは何もしない
  if(val <= 1){
     return nums;
  }
  for(var i = 0; i < used.length; i++){if(used[i] <= val){nums.add(used[i]);}}
  for(var i = underPrime; i <= val; i = i + 2){
    var continued = false;
    for(var j = 0; j < used.length; j++){
      if(i % used[j] == 0){continued = true; break;}
    }
    if(continued){continue;}
    nums.add(i);
  }
  for(var i = 2; i <= Math.sqrt(val); (i == 2) ? i++ : i = i + 2){
    if(!nums.has(i)){continue;}
    var count = 1;
    while(i * count <= val){
      if(i <= 11 && used.indexOf(i) != -1){break;}
      if(count == 1){primes.add(i);}
      nums.delete(i * count);
      count++;
    }
  }
  var primeItr = Array.from(primes);
  for(var i = 0; i < primeItr.length; i++){
    nums.add(primeItr[i]);
  }
  return nums;
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  const checkPrime = (n) => {
    for (let i = 2; i * i <= n; i++) {
      if (n % i === 0) return false;
    }
    return true;
  };
  while (t--) {
    let n = parseInt(readline());
    let c = n + 1;
    while (true) {
      if (checkPrime(c)) break;
      c++;
    }
    let res = c;
    c = c + n;
    while (true) {
      if (checkPrime(c)) break;
      c++;
    }
    console.log(res * c);
  }
};
solve();

'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() {
    let testCases = readline()
    while(testCases--)
        solve()
}

// function to solve problems
function solve (){
    let n = readline() // .split(' ')
    // let n = line[0]
    // let k = line[1]
    // let ans = ''
    let first = 0, second = 0
    // ------------------
    // console.log('n = ', n)
    let num = 1 + parseInt(n)
    while ( first == 0) {
        first = isPrime(num)
        num++
    }
    // console.log('first = ', first)
    num += n - 1
    while ( second == 0) {
        second = isPrime(num)
        num++
    }
    // console.log('second = ', second)
    console.log(first * second)
}

function isPrime (num) {
    // console.log('isPrime num = ', num)
    if (num == 2)
        return 2
    if (num % 2 == 0)
        return 0
    else {
        if (num == 3)
            return 3

        let limit = parseInt(Math.sqrt(num))
        let i = 0
        for ( i = 3; i <= limit; i += 2) {
            if (num % i == 0)
                return 0
        }
        // console.log('i = ', i)
        return num
    }
}

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

const isPrime = n => {
  for (let index = 2; index < Math.ceil(Math.floor(n)); index++) {
    if (n % index === 0) return false
  }
  return true
}

const calculate = d => {
  let first = 1 + d
  while (!isPrime(first)) {
    first++
  }

  let second = first + d
  while (!isPrime(second)) {
    second++
  }

  return first * second
}

let index = -1
let maxRound = 0
let round = 0

let d
let answer = []

readline.on('line', line => {
  if (index === -1) {
    maxRound = Number(line)
    index = 0
  } else {
    d = Number(line)

    answer.push(calculate(d))

    round++
    if (round === maxRound) {
      readline.close()
      console.log(answer.join('\n'))
      return
    }
    index++
  }
})
// console.log(calculate(6, 5, [1, 2, 3, 3, 2, 1]))

"use strict"

let iter = parseInt(readline());

for(iter; iter > 0; iter--){
    let n = parseInt(readline());

    let temp = findNextPrime(1, n)
    let res = temp * findNextPrime(temp, n)
    print(res)
}

function findNextPrime(n, d){
    for(let i = n + d;; i++){
        if(isPrime(i)) return i;
    }
}

function isPrime(n){
    for(let i = 2; i <= Math.sqrt(n); i++){
        if(n % i === 0) return false;
    }
    return true;
}

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

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

function main() {
	let t = +readLine();
	while (t--) {
		const n = +readLine();
		const [a, b] = [1 + n, 1 + 2 * n];
		console.log(a * b);
	}
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();
    var answer = []

    // console.log(Number(x))
    // 1 1 7
    // 6 9, 15, 18
    Array(Number(x)).fill(1).map((t, i) => {
        var n = Number(readline());
        console.log((1+n)*(1+2*n))

    })

}


Arkady is playing Battleship. The rules of this game aren't really important.There is a field of $$$n \times n$$$ cells. There should be exactly one $$$k$$$-decker on the field, i. e. a ship that is $$$k$$$ cells long oriented either horizontally or vertically. However, Arkady doesn't know where it is located. For each cell Arkady knows if it is definitely empty or can contain a part of the ship.Consider all possible locations of the ship. Find such a cell that belongs to the maximum possible number of different locations of the ship.

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$) — the size of the field and the size of the ship. The next $$$n$$$ lines contain the field. Each line contains $$$n$$$ characters, each of which is either '#' (denotes a definitely empty cell) or '.' (denotes a cell that can belong to the ship).

Output two integers — the row and the column of a cell that belongs to the maximum possible number of different locations of the ship. If there are multiple answers, output any of them. In particular, if no ship can be placed on the field, you can output any cell.

NoteThe picture below shows the three possible locations of the ship that contain the cell $$$(3, 2)$$$ in the first sample.


Andrew was very excited to participate in Olympiad of Metropolises. Days flew by quickly, and Andrew is already at the airport, ready to go home. He has $$$n$$$ rubles left, and would like to exchange them to euro and dollar bills. Andrew can mix dollar bills and euro bills in whatever way he wants. The price of one dollar is $$$d$$$ rubles, and one euro costs $$$e$$$ rubles.Recall that there exist the following dollar bills: $$$1$$$, $$$2$$$, $$$5$$$, $$$10$$$, $$$20$$$, $$$50$$$, $$$100$$$, and the following euro bills — $$$5$$$, $$$10$$$, $$$20$$$, $$$50$$$, $$$100$$$, $$$200$$$ (note that, in this problem we do not consider the $$$500$$$ euro bill, it is hard to find such bills in the currency exchange points). Andrew can buy any combination of bills, and his goal is to minimize the total number of rubles he will have after the exchange.Help him — write a program that given integers $$$n$$$, $$$e$$$ and $$$d$$$, finds the minimum number of rubles Andrew can get after buying dollar and euro bills.

The first line of the input contains one integer $$$n$$$ ($$$1 \leq n \leq 10^8$$$) — the initial sum in rubles Andrew has.  The second line of the input contains one integer $$$d$$$ ($$$30 \leq d \leq 100$$$) — the price of one dollar in rubles.  The third line of the input contains integer $$$e$$$ ($$$30 \leq e \leq 100$$$) — the price of one euro in rubles.

Output one integer — the minimum number of rubles Andrew can have after buying dollar and euro bills optimally.

NoteIn the first example, we can buy just $$$1$$$ dollar because there is no $$$1$$$ euro bill.In the second example, optimal exchange is to buy $$$5$$$ euro and $$$1$$$ dollar.In the third example, optimal exchange is to buy $$$10$$$ dollars in one bill.

const rubleCount = Number(readline());
const dollarPrice = Number(readline());
const euroPrice = Number(readline()) * 5;
var result = rubleCount;
for (var i = 0;; i++) {
  var remaining = rubleCount - i * dollarPrice;
  if (remaining < 0) break;
  var cur = remaining % euroPrice;
  if (cur < result) result = cur;
}
print(result);

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var n = rdN();
    var d = rdN();
    var e = rdN();

    var d1 = d;
    var e5 = e*5;

    var a = Math.floor(n / d1);
    var b = 0;
    var res = n%d1;

    while (a >= 0) {
        var s = a*d1 + b*e5;
        if (s <= n) {
            res = Math.min(res, n - s);
            ++b;
        } else {
            --a;
        }
    }

    wr(res);
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var n = rdN();
    var d = rdN();
    var e = rdN();

    var d1 = d;
    var e5 = e*5;
    var b = Math.max(d1,e5);
    var s = Math.min(d1,e5);
    var diff = b - s;

    var res1 = n%b;
    res1 %= s;

    var res2 = n%s;
    res2 %= diff;
    wr(Math.min(res1, res2));
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var n = rdN();
    var d = rdN();
    var e = rdN();

    var d1 = d;
    var e5 = e*5;

    var a = Math.floor(n / d1);
    var b = 0;
    var res = n%d1;

    while (a > 0) {
        var s = a*d1 + b*e5;
        if (s <= n) {
            res = Math.min(res, n - s);
            ++b;
        } else {
            --a;
        }
    }

    wr(res);
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var n = rdN();
    var d = rdN();
    var e = rdN();

    var d1 = d;
    var e5 = e*5;

    wr(Math.min(n%d1%e5, n%e5%d1));
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var n = rdN();
    var d = rdN();
    var e = rdN();

    var d1 = d;
    var e5 = e*5;

    wr(Math.min([n%d1%e5, n%e5%d1]));
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();


Polycarp has $$$3$$$ positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He can perform the following operation exactly once.  Choose a positive integer $$$m$$$ and multiply exactly one of the integers $$$a$$$, $$$b$$$ or $$$c$$$ by $$$m$$$. Can Polycarp make it so that after performing the operation, the sequence of three numbers $$$a$$$, $$$b$$$, $$$c$$$ (in this order) forms an arithmetic progression? Note that you cannot change the order of $$$a$$$, $$$b$$$ and $$$c$$$.Formally, a sequence $$$x_1, x_2, \dots, x_n$$$ is called an arithmetic progression (AP) if there exists a number $$$d$$$ (called "common difference") such that $$$x_{i+1}=x_i+d$$$ for all $$$i$$$ from $$$1$$$ to $$$n-1$$$. In this problem, $$$n=3$$$.For example, the following sequences are AP: $$$[5, 10, 15]$$$, $$$[3, 2, 1]$$$, $$$[1, 1, 1]$$$, and $$$[13, 10, 7]$$$. The following sequences are not AP: $$$[1, 2, 4]$$$, $$$[0, 1, 0]$$$ and $$$[1, 3, 2]$$$.You need to answer $$$t$$$ independent test cases.

The first line contains the number $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains $$$3$$$ integers $$$a$$$, $$$b$$$, $$$c$$$ ($$$1 \le a, b, c \le 10^8$$$).

For each test case print "YES" (without quotes) if Polycarp can choose a positive integer $$$m$$$ and multiply exactly one of the integers $$$a$$$, $$$b$$$ or $$$c$$$ by $$$m$$$ to make $$$[a, b, c]$$$ be an arithmetic progression. Print "NO" (without quotes) otherwise. You can print YES and NO in any (upper or lower) case (for example, the strings yEs, yes, Yes and YES will be recognized as a positive answer).

YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
YES

NoteIn the first and second test cases, you can choose the number $$$m=4$$$ and multiply the second number ($$$b=5$$$) by $$$4$$$.In the first test case the resulting sequence will be $$$[10, 20, 30]$$$. This is an AP with a difference $$$d=10$$$.In the second test case the resulting sequence will be $$$[30, 20, 10]$$$. This is an AP with a difference $$$d=-10$$$.In the third test case, you can choose $$$m=1$$$ and multiply any number by $$$1$$$. The resulting sequence will be $$$[1, 2, 3]$$$. This is an AP with a difference $$$d=1$$$.In the fourth test case, you can choose $$$m=9$$$ and multiply the first number ($$$a=1$$$) by $$$9$$$. The resulting sequence will be $$$[9, 6, 3]$$$. This is an AP with a difference $$$d=-3$$$.In the fifth test case, it is impossible to make an AP.

var q=+readline();function isInt(a){return a%1==0}function isPosT(a,b){if(a==0&&b==0)return true;if(a==0)return false;if(b==0)return false;return a/b>0&&isInt(a/b)}wb:while(q--){var des=readline().split(" ").map(function(x){return+x});fb:for(var i=0;i<3;i++){switch(i){case 0:if(isPosT(2*des[1]-des[2],des[0])){print("YES");continue wb}break;case 1:if(isPosT((des[0]+des[2])/2,des[1])){print("YES");continue wb}break;case 2:if(isPosT(2*des[1]-des[0],des[2])){print("YES");continue wb}break}}print("NO")}

var t = parseInt(readline());

  function solve() {
    var inp = readline()
      .split(" ")
      .map((data) => +data);

    var a = inp[0];
    var b = inp[1];
    var c = inp[2];

    if (2 * b - c > 0 && (2 * b - c) % a === 0) {
      return "Yes";
    } else if ((c + a) % (2 * b) === 0) {
      return "Yes";
    } else if (2 * b - a > 0 && (2 * b - a) % c === 0) {
      return "Yes";
    }

    return "No";
  }

  while (t--) {
    print(solve());
  }

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\n');
let currentline = 0;
function readline(){
    return input[currentline++];
}

var T = readline();
for(var q=1;q<=T;q++) {
            var a = readline().split(" ").map(w => parseInt(w))
            function as(x,y,z) {
                var d = y-x;
                if(((y+d)%z) == 0 && y+d > 0) return true;
                else return false;
            }
            function ase(x,y,z) {
                var d = y-x;
                if(((x-d)%z) == 0 && x-d > 0) return true;
                else return false;
            }
            function ad(x,y,z) {
                var d = (y-x)/2;
                //if(x+d==0) return false;
                if(((x+d)%z) == 0 && x+d > 0) return true;
                else return false;
            }
            //console.log(as(a[0],a[1],a[2]), ase(a[1],a[2],a[0]), ad(a[0],a[2],a[1]))
            var c = as(a[0],a[1],a[2]) || ase(a[1],a[2],a[0]) || ad(a[0],a[2],a[1])
            console.log(c ? 'YES' : 'NO')
}

let data = "";

process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  let [_, ...input] = data
    .trim()
    .split(/\n/)
    .map((el) => el.trim());

  input = input.map((el) =>
    el
      .trim()
      .split(" ")
      .map((el) => +el.trim())
  );

  const doesformAP = (a, b, c) => {
    const m1 = (2 * b - c) / a;
    const m2 = (c + a) / (2 * b);
    const m3 = (2 * b - a) / c;

    if (m1 > 0 && Math.ceil(m1) == m1) {
      return true;
    }

    if (m2 > 0 && Math.ceil(m2) == m2) {
      return true;
    }

    if (m3 > 0 && Math.ceil(m3) == m3) {
      return true;
    }
    return false;
  };

  input.forEach((el) => {
    if (doesformAP(el[0], el[1], el[2])) console.log("YES");
    else console.log("NO");
  });
});

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

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

function main () {
	let T = rn();
	while (T--) {
		const [a, b, c] = rna();

		const check = x => x > 0 && x%1 == 0;

		const ans = check((2*b-c)/a) || check((2*b-a)/c) || check((a+c)/(2*b));

		console.log(ans ? 'YES' : 'NO');
	}
}

let readline = require("readline");

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

let input = [];
rl.on("line", function (line) {
  input.push(line);

  if (input.length === +input[0] + 1) {
    // call your function here
    solve(input);
    rl.close();
  }
});

let solve = (input) => {
  for (let testCase = 1; testCase < input.length; testCase++) {
    let numbers = input[testCase].split(" ");
    let a = +numbers[0];
    let b = +numbers[1];
    let c = +numbers[2];

    newA = b - (c - b);
    if (newA >= a && newA % a == 0 && newA != 0) {
      console.log("YES");
      continue;
    }

    let newB = a + (c - a) / 2;
    if (newB >= b && (c - a) % 2 == 0 && newB % b == 0 && newB != 0) {
      console.log("YES");
      continue;
    }

    let newC = a + 2 * (b - a);
    if (newC >= c && newC % c == 0 && newC != 0) {
      console.log("YES");
      continue;
    }

    console.log("NO");
  }
};

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];
    var n = 0;
    for(i = 1; i <= t; i++){
        var k = lines[i].split(' ').map(Number);
        var a = k[0], b = k[1], c = k[2];
        var bc = 2 * b - c;
        var ba = 2 * b - a;
        var bcs = bc > 0 && bc % a === 0;
        var bas = ba > 0 && ba % c === 0;
        if(bcs || (a + c) % (b * 2) === 0 || bas){
            console.log('YES');
        }else{
            console.log('NO');
        }
    }
});

/*
===== READ INPUT DATA START =====
=================================
*/

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

let inputString = '';

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

process.stdin.on('end', (_) => {
  const lines = inputString.trim().split('\n').map((string) => string.trim()).filter(Boolean);
  main(lines);
});

/*
===== READ INPUT DATA END =====
===============================
*/

function main(lines) {
  let index = 0;
  let T = Number(lines[index++]);
  let a, b, c;

  while (T--) {
    [a, b, c] = lines[index++].split(' ').map(Number);

    if (solve(a, b, c) || solve(c, b, a)) {
      console.log('YES');
    } else {
      console.log('NO');
    }
  }
}

function solve(a, b, c) {
  let diff;
  let newVal;

  // already an AP
  if (isAP([a, b, c ])) {
    return true;
  }

  // a
  diff = c - b;
  newVal = b - diff;
  if (diff >= 0 && newVal > a && newVal % a === 0 && isAP([newVal, b, c])) {
    return true;
  }

  // b
  diff = (c - a) / 2;
  newVal = a + diff;
  if (diff >= 0 && newVal > b && newVal % b === 0 && isAP([a, newVal, c])) {
    return true;
  }

  // c
  diff = b - a;
  newVal = b + diff;
  if (diff >= 0 && newVal > c && newVal % c === 0 && isAP([a, b, newVal])) {
    return true;
  }

  return false;
}

function isAP(arr) {
  return arr[2] - arr[1] === arr[1] - arr[0];
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});
function readLine() {
  return inputString[currentLine++];
};
process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });
  main();
  // cmd: node cp.js < input.txt > output.txt
});
function main() {
  let t = parseInt(readLine());
  while (t--) {
    solve();
  }
}
function solve() {
  let nums = readLine().split(" ");
  let a = parseInt(nums[0]);
  let b = parseInt(nums[1]);
  let c = parseInt(nums[2]);
  let m1 = (2 * b - c) / a;
  let m2 = (a + c) / (2 * b);
  let m3 = (2 * b - a) / c;
  if (Number.isSafeInteger(m1) && m1 >= 1 || Number.isSafeInteger(m2) && m2 >= 1 || Number.isSafeInteger(m3) && m3 >= 1) {
    console.log("YES");
  } else {
    console.log("NO");
  }
}

let _inputLines;
let _lineNumber = 0;
let inputReader = _inputReader ();

function _main() {

	_inputLines = _inputData.trim().split('\n').map((string) => {
		return string.trim();
	});;

	let t = inputReader.readNumber();

	function solve(){
	    let [a,b,c] = inputReader.readNumberArray();
	    let ok = false;
	    if((a + c) % (2*b) == 0 && (a + c) / (2 * b) > 0) ok = true;
	    if((2 * b - c) % a == 0 && (2 * b - c) / a > 0) ok = true;
	    if((2 * b - a) % c == 0 && (2 * b - a) / c > 0) ok = true;
	    if(ok) console.log("YES")
	    else console.log("NO");
	}

	while(t--){
	    solve();
	}

}

var _inputData = '';
function cacheInput(data) {
	_inputData += data;
}

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', cacheInput).on('end', _main);

function _inputReader () {
	function readNumber(){
		return Number(_inputLines[_lineNumber++]);
	}

	function readNumberArray(){
		return _inputLines[_lineNumber++].split(' ').map(val => Number(val));
	}

	return {
		readNumber,
		readNumberArray,
	}
}

/* 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 */

function main() {
    //take input according to the format;
    const n = +(readline());
    for(let i =0; i<n; ++i){
        const arr = readline().split(' ');

        let a = parseInt(arr[0]);
        let b = parseInt(arr[1]);
        let c = parseInt(arr[2]);

        if(doesformAP(a,b,c))
            console.log('YES')
        else
            console.log('NO')

    }
}
const formSubset= (arr)=>{

}

const doesformAP = (a,b,c)=>{
    const m1 = (2*b - c ) / a;
    const m2 = (c+a)/(2*b);
    const m3 = (2*b -a )/(c);

    if(m1>0 && Math.ceil(m1) == m1){
        return true
    }

    if(m2 >0 && Math.ceil(m2) == m2){
        return true
    }

    if(m3>0 && Math.ceil(m3) == m3){
        return true
    }
    return false;
}

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

    let count = 1;
    for (let i = 0; i < lines[0]; ++i) {
        let total = 0;
        const a = lines[count].split(' ').map((el) => +el);

        let diff1 = a[1] - a[0];
        let diff2 = a[2] - a[1];
        let diff3 = a[2] - a[0];

        // a[0] = 10, a[1] = 5, a[2] = 30
        // diff1 = -5, diff2 = 25, diff3 = 20

        // a[2] * X = a[1] + diff1;
        // X = (a[1] + diff1) / a[2] => (0 / 30) => X = 0
        // a[0] * Y = a[1] - diff2;
        // Y = (a[1] - diff2) / a[0] => (-20 / 10) => Y = -2;
        // if diff3 % 2 === 0 return false
        // a[1] * Z = a[2] - (diff3 / 2)
        // Z = (a[2] - (diff3 / 2)) / a[1] => 20 / 5 => Z = 4

        const x = (a[1] + diff1) / a[2];
        const y = (a[1] - diff2) / a[0];

        let z = 0;
        if (diff3 % 2 === 0) {
            z = (a[2] - (diff3 / 2)) / a[1];
        }

        if ((x > 0 && Number.isInteger(x)) || (y > 0 && Number.isInteger(y)) || (z > 0 && Number.isInteger(z))) {
            console.log("YES");
        } else {
            console.log("NO");
        }

        count += 1;
    }
});

process.stdin.setEncoding('utf-8')
const readline = require('readline')

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

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        inputArr = inputArr.map(i => i.split(' ').map(j => +j))
        main()
        process.exit(0)
    }
})

function solve([a, b, c]) {
    if (Math.floor((a + c) / 2) % b === 0 && (a + c) % 2 === 0) {
        console.log('YES')
        return
    }
    if ((2 * b - c) % a === 0 && 2 * b - c > 0) {
        console.log('YES')
        return
    }
    if ((2 * b - a) % c === 0 && 2 * b - a > 0) {
        console.log('YES')
        return
    }
    console.log('NO')
}

function main() {
    for (let i = 0; i < inputArr.length; i++) solve(inputArr[i])
}

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

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

const readInt = async function(){
    return parseInt(await getLine());
}

const readIntArray = async function() {
    return (await getLine()).split(' ').map(num => parseInt(num));
}

let solve = async () => {
    const tsc = await readInt();
    for(let sc = 0; sc < tsc; sc++) {
        const [a,b,c] = await readIntArray();
        const can = (num1, num2) => {
           if (num2 === 0)
               return true;
           return num1%num2===0 && num1/num2 > 0;
        }
        if (can(b + (b-a), c) || can(b - (c-b), a) || ((c+a)%2 === 0 && can((c+a)/2, b))) {
            console.log("YES");
        } else {
            console.log("NO");
        }
    }
}

solve();

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 [a, b, c] = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(a, b, c) ? 'YES' : 'NO'
    }
    console.log(output.join('\n'))
// })()
})

function solve(a, b, c) {
    if (a + c === 2 * b) return true
    return ok(2 * b - c, a)
        || ok(2 * b - a, c)
        || ok(a + c, 2 * b)
}
function ok(a, b) {
    return a > 0 && !(a % b)
}

var q = +readline(); function isInt(a, b) { if (a == 0) return true; if (b == 0) return false; return Math.floor(a / b) === a / b } wb: while (q--) { var des = readline().split(" ").map(function (x) { return +x }); fb: for (var i = 0; i < 3; i++) { switch (i) { case 0: if (isInt(2 * des[1] - des[2], des[0])) { print("YES"); continue wb } break; case 1: if (isInt((des[0] + des[2]) / 2, des[1])) { print("YES"); continue wb } break; case 2: if (isInt(2 * des[1] - des[0], des[2])) { print("YES"); continue wb } break } } print("NO") }

var q = +readline(); function isInt(a, b) { if (a == 0) return true; if (b != 0) return false; return Math.floor(a / b) === a / b } wb: while (q--) { var des = readline().split(" ").map(function (x) { return +x }); fb: for (var i = 0; i < 3; i++) { switch (i) { case 0: if (isInt(2 * des[1] - des[2], des[0])) { print("YES"); continue wb } break; case 1: if (isInt((des[0] + des[2]) / 2, des[1])) { print("YES"); continue wb } break; case 2: if (isInt(2 * des[1] - des[0], des[2])) { print("YES"); continue wb } break } } print("NO") }

var q = +readline(); function isInt(a, b) { if (a != 0 && b != 0) return Math.floor(a / b) === a / b; return false } wb: while (q--) { var des = readline().split(" ").map(function (x) { return +x }); fb: for (var i = 0; i < 3; i++) { switch (i) { case 0: if (isInt(2 * des[1] - des[2], des[0])) { print("YES"); continue wb } break; case 1: if (isInt((des[0] + des[2]) / 2, des[1])) { print("YES"); continue wb } break; case 2: if (isInt(2 * des[1] - des[0], des[2])) { print("YES"); continue wb } break } } print("NO") }

var q = +readline();
function isInt(a, b) {
    if (a != 0 && b != 0) return Math.floor(a / b) === a / b;
    return false;
}
wb: while (q--) {
    var des = readline().split(" ").map(function (x) {
        return +x;
    });
    //   console.log(des);
    fb: for (var i = 0; i < 3; i++) {
        switch (i) {
            case 0:
                if (isInt(2 * des[1] - des[2], des[0])) {
                    print("YES");
                    continue wb;
                }
                break;
            case 1:
                if (isInt((des[0] + des[2]) / 2, des[1])) {
                    print("YES");
                    continue wb;
                }
                break;
            case 2:
                if (isInt(2 * des[1] - des[0], des[2])) {
                    print("YES");
                    continue wb;
                }
                break;
        }
    }
    print("NO");
}

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\n');
let currentline = 0;
function readline(){
    return input[currentline++];
}

var T = readline();
for(var q=1;q<=T;q++) {
                var a = readline().split(" ").map(w => parseInt(w))
                function as(x,y,z) {
                    var d = y-x;
                    if(((y+d)%z) == 0) return true;
                    else return false;
                }
                function ase(x,y,z) {
                  var d = y-x;

                  if(((x-d)%z) == 0) return true;
                  else return false;
                }
                function ad(x,y,z) {
                    var d = (y-x)/2;

                    if(((x+d)%z) == 0) return true;
                    else return false;
                }
                //console.log(as(a[0],a[1],a[2]), ase(a[1],a[2],a[0]), ad(a[0],a[2],a[1]))
                var c = as(a[0],a[1],a[2]) || ase(a[1],a[2],a[0]) || ad(a[0],a[2],a[1])
                console.log(c ? 'YES' : 'NO')
}

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\n');
let currentline = 0;
function readline(){
    return input[currentline++];
}

var T = readline();
for(var q=1;q<=T;q++) {
            var a = readline().split(" ").map(w => parseInt(w))
            function as(x,y,z) {
                var d = y-x;
                if(y+d==0) return false
                else if(((y+d)%z) == 0) return true;
                else return false;
            }
            function ase(x,y,z) {
                var d = y-x;
                if(x-d==0) return false
                else if(((x-d)%z) == 0) return true;
                else return false;
            }
            function ad(x,y,z) {
                var d = (y-x)/2;
                if(x+d==0) return false;
                else if(((x+d)%z) == 0) return true;
                else return false;
            }
            //console.log(as(a[0],a[1],a[2]), ase(a[1],a[2],a[0]), ad(a[0],a[2],a[1]))
            var c = as(a[0],a[1],a[2]) || ase(a[1],a[2],a[0]) || ad(a[0],a[2],a[1])
            console.log(c ? 'YES' : 'NO')
}

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\n');
let currentline = 0;
function readline(){
    return input[currentline++];
}

var T = readline();
for(var q=1;q<=T;q++) {
        let a = readline().split(" ").map(w => parseInt(w))
        function as(x,y,z) {
            var d = y-x;
            if(y+d==0) return false
            if((Math.abs(y+d))%z == 0) return true;
            else return false;
        }
        function ase(x,y,z) {
            var d = y-x;
            if(x-d==0) return false
            if((Math.abs(x-d))%z == 0) return true;
            else return false;
        }
        function ad(x,y,z) {
            var d = (y-x)/2;
            if(x+d==0) return false;
            if((Math.abs(x+d))%z == 0) return true;
            else return false;
        }
        //console.log(as(a[0],a[1],a[2]), ase(a[1],a[2],a[0]), ad(a[0],a[2],a[1]))
        var c = as(a[0],a[1],a[2]) || ase(a[1],a[2],a[0]) || ad(a[0],a[2],a[1])
        console.log(c ? 'YES' : 'NO')
}

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\n');
let currentline = 0;
function readline(){
    return input[currentline++];
}

var T = readline();
for(var q=1;q<=T;q++) {
    let a = readline().split(" ").map(w => parseInt(w))
    function as(x,y,z) {
        var d = y-x;
        if(y+d==0) return false
        if((y+d)%z == 0) return true;
        else return false;
    }
    function ase(x,y,z) {
        var d = y-x;
        if(x-d==0) return false
        if((x-d)%z == 0) return true;
        else return false;
    }
    function ad(x,y,z) {
        var d = (y-x)/2;
        if(x+d==0) return false;
        if((x+d)%z == 0) return true;
        else return false;
    }
    //console.log(as(a[0],a[1],a[2]), ase(a[1],a[2],a[0]), ad(a[0],a[2],a[1]))
    var c = as(a[0],a[1],a[2]) || ase(a[1],a[2],a[0]) || ad(a[0],a[2],a[1])
    console.log(c ? 'YES' : 'NO')
}

let data = "";

process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  let [_, ...input] = data
    .trim()
    .split(/\n/)
    .map((el) => el.trim());

  input = input.map((el) =>
    el
      .trim()
      .split(" ")
      .map((el) => +el.trim())
  );

  let difference = 0;

  input.forEach((el) => {
    const m1 = (2 * el[1] - el[2]) / el[0];
    const m2 = (el[2] + el[0]) / (2 * el[1]);
    const m3 = (2 * el[1] - el[0]) / el[3];

    if (m1 > 0 && Math.ceil(m1) == m1) {
      console.log("YES");
      return 0;
    }

    if (m2 > 0 && Math.ceil(m2) == m2) {
      console.log("YES");
      return 0;
    }

    if (m3 > 0 && Math.ceil(m3) == m3) {
      console.log("YES");
      return 0;
    }
    console.log("NO");
  });
});

let data = "";

process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  let [_, ...input] = data
    .trim()
    .split(/\n/)
    .map((el) => el.trim());

  input = input.map((el) =>
    el
      .trim()
      .split(" ")
      .map((el) => +el.trim())
      .sort((a, b) => a - b)
  );

  let difference = 0;

  input.forEach((el) => {
    difference = el[2] - el[1];

    difference % el[0] === 0 && difference * 2 !== el[0] + el[1]
      ? console.log("YES")
      : console.log("NO");
  });
});

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

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

function main () {
	let T = rn();
	while (T--) {
		const [a, b, c] = rna();

		const m1 = (2*b-c) != 0 && (2*b-c)%a == 0;
		const m2 = (2*b-a) != 0 && (2*b-a)%c == 0;
		const m3 = (a+c) != 0 && (a+c) % (2*b) == 0;

		const ans = m1 || m2 || m3;

		console.log(ans ? 'YES' : 'NO');
	}
}

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

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

function main () {
	let T = rn();
	while (T--) {
		const [a, b, c] = rna();

		const m1 = (2*b-c)/a;
		const m2 = (2*b-a)/c;
		const m3 = (a+c)/(2*b);

		const ans = m1 && m1%1 == 0 || m2 && m2%1 == 0 || m3 && m3%1 == 0;

		console.log(ans ? 'YES' : 'NO');
	}
}

let readline = require("readline");

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

let input = [];
rl.on("line", function (line) {
  input.push(line);

  if (input.length === +input[0] + 1) {
    // call your function here
    solve(input);
    rl.close();
  }
});

let solve = (input) => {
  for (let testCase = 1; testCase < input.length; testCase++) {
    let numbers = input[testCase].split(" ");
    let a = +numbers[0];
    let b = +numbers[1];
    let c = +numbers[2];

    let newA = b - (c - b);
    if (newA >= a && newA % a === 0 && newA !== 0) {
      console.log("YES");
      continue;
    }

    let newB = a + (c - a) / 2;
    if (newB >= b && newB % b === 0 && newB !== 0) {
      console.log("YES");
      continue;
    }

    let newC = b + 2 * (b - a);
    if (newC >= c && newC % c === 0 && newC !== 0) {
      console.log("YES");
      continue;
    }

    console.log("NO");
  }
};


Vasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each successful throw has value of either 2 or 3 points. A throw is worth 2 points if the distance it was made from doesn't exceed some value of d meters, and a throw is worth 3 points if the distance is larger than d meters, where d is some non-negative integer.Vasya would like the advantage of the points scored by the first team (the points of the first team minus the points of the second team) to be maximum. For that he can mentally choose the value of d. Help him to do that.

The first line contains integer n (1 ≤ n ≤ 2·105) — the number of throws of the first team. Then follow n integer numbers — the distances of throws ai (1 ≤ ai ≤ 2·109).  Then follows number m (1 ≤ m ≤ 2·105) — the number of the throws of the second team. Then follow m integer numbers — the distances of throws of bi (1 ≤ bi ≤ 2·109).

Print two numbers in the format a:b — the score that is possible considering the problem conditions where the result of subtraction a - b is maximum. If there are several such scores, find the one in which number a is maximum.

var n = parseInt(readline());
var a = readline().split(' ');
var m = parseInt(readline());
var b = readline().split(' ');

for (var i = 0, ii = a.length; i < ii; i++)
	a[i] = parseInt(a[i]);
for (var i = 0, ii = b.length; i < ii; i++)
	b[i] = parseInt(b[i]);

function g(x, y) {return x - y};

var dict = {};
var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
a.sort(g);
b.sort(g);
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
}

print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

function g(x, y) {return x - y};

a.sort(g);
b.sort(g);

var dict = {};

var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
	if (n == 5)
		print(c[ci] + ' ' + A + ' ' + B);
}
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

function g(x, y) {return x - y};

a.sort(g);
b.sort(g);

var dict = {};
var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
	if (n == 5)
		print(c[ci] + ' ' + A + ' ' + B);
}
if (n == 5)
{
	print(a.join(','));
	print(b.join(','));
}
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

function g(x, y) {return x - y};

a.sort(g);
b.sort(g);

a.unshift(a[0]-1);
b.unshift(b[0]-1);
n += 1;
m += 1;

var c = []
for (var i = 0, ii = a.length; i < ii; i++)
	c.push(a[i]);
for (var i = 0, ii = b.length; i < ii; i++)
	c.push(b[i]);
c.sort(g);

var A = n * 3 - 3 + 2, B = m * 3 - 3 + 2;
var diff = A - B;

var i = 0, j = 0;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n && a[i] <= c[ci]) i++;
	while (j < m && b[j] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
}
A -= 2;
B -= 2;
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

function g(x, y) {return x - y};

a.sort(g);
b.sort(g);

var dict = {};

var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
c.sort(g);

var A = n * 3, B = m * 3;
var diff = A - B;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
}
print(A+':'+B);

var n = parseInt(readline());
var a = readline().split();
var m = parseInt(readline());
var b = readline().split();

for (var i = 0, ii = a.length; i < ii; i++)
	a[i] = parseInt(a[i]);
for (var i = 0, ii = b.length; i < ii; i++)
	b[i] = parseInt(b[i]);

function g(x, y) {return x - y};

var dict = {};
var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
a.sort(g);
b.sort(g);
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
	if (n == 5)
		print(c[ci] + ' ' + A + ' ' + B);
}
if (n == 5)
{
	print(a.join(','));
	print(b.join(','));
}
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

var c = []
for (var i = 0, ii = a.length; i < ii; i++)
	c.push(a[i]);
for (var i = 0, ii = b.length; i < ii; i++)
	c.push(b[i]);

c.sort(function(x, y) {return x - y});

var A = 0, B = 0, diff = -123456789;

var i = 0, j = 0;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n && a[i] <= c[ci]) i++;
	while (j < m && b[j] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
	print(A+':'+B);
}

var n = parseInt(readline());
var a = readline();
print(a);
a = a.split();
var m = parseInt(readline());
var b = readline().split();

for (var i = 0, ii = a.length; i < ii; i++)
	a[i] = parseInt(a[i]);
for (var i = 0, ii = b.length; i < ii; i++)
	b[i] = parseInt(b[i]);

function g(x, y) {return x - y};

var dict = {};
var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
a.sort(g);
b.sort(g);
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
	if (n == 5)
		print(c[ci] + ' ' + A + ' ' + B);
}
if (n == 5)
{
	print(a.join(','));
	print(b.join(','));
}
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split();
var m = parseInt(readline())
var b = readline().split();

function g(x, y) {return x - y};

var dict = {};
var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	a[i] = a[i] - 0;
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	b[i] = b[i] - 0;
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
a.sort(g);
b.sort(g);
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
	if (n == 5)
		print(c[ci] + ' ' + A + ' ' + B);
}
if (n == 5)
{
	print(a.join(','));
	print(b.join(','));
}
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

function g(x, y) {return x - y};

a.sort(g);
b.sort(g);

var dict = {};

var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
	if (n == 5)
		print(c[ci] + ' ' + A + ' ' + B);
}
if (n == 5)
{
	print(a);
	print(b);
}
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

var c = []
for (var i = 0, ii = a.length; i < ii; i++)
	c.push(a[i]);
for (var i = 0, ii = b.length; i < ii; i++)
	c.push(b[i]);

c.sort(function(x, y) {return x - y});

var A = n * 3, B = m * 3;
var diff = A - B;

var i = 0, j = 0;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n && a[i] <= c[ci]) i++;
	while (j < m && b[j] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
}

print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

function g(x, y) {return x - y};

a.sort(g);
b.sort(g);

a.unshift(a[0]-1);
b.unshift(b[0]-1);
n += 1;
m += 1;

var c = []
for (var i = 0, ii = a.length; i < ii; i++)
	c.push(a[i]);
for (var i = 0, ii = b.length; i < ii; i++)
	c.push(b[i]);
c.sort(g);

var A = n * 3 - 3 + 2, B = m * 3 - 3 + 2;
var diff = A - B;

var i = 1, j = 1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n && a[i] <= c[ci]) i++;
	while (j < m && b[j] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
}
A -= 2;
B -= 2;
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

function g(x, y) {return x - y};

a.sort(g);
b.sort(g);

var dict = {};

var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
	print(c[ci] + ' ' + A + ' ' + B);
}
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

function g(x, y) {return x - y};

a.sort(g);
b.sort(g);

var dict = {};

var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
}
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt.bind(null, 10));
var m = parseInt(readline())
var b = readline().split().map(parseInt.bind(null, 10));

function g(x, y) {return x - y};

a.sort(g);
b.sort(g);

var dict = {};
var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
	if (n == 5)
		print(c[ci] + ' ' + A + ' ' + B);
}
if (n == 5)
{
	print(a.join(','));
	print(b.join(','));
}
print(A+':'+B);

var n = parseInt(readline())
var a = readline().split().map(parseInt);
var m = parseInt(readline())
var b = readline().split().map(parseInt);

function g(x, y) {return x - y};

a.sort(g);
b.sort(g);

var dict = {};

var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
c.sort(g);

var A = n * 3, B = m;
var diff = A - B;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
}
print(A+':'+B);

var n = parseInt(readline());
var a = readline().split(' ');
var m = parseInt(readline());
var b = readline().split(' ');

for (var i = 0, ii = a.length; i < ii; i++)
	a[i] = parseInt(a[i]);
for (var i = 0, ii = b.length; i < ii; i++)
	b[i] = parseInt(b[i]);

function g(x, y) {return x - y};

var dict = {};
var c = []
for (var i = 0, ii = a.length; i < ii; i++) {
	dict[a[i] - 1] = 1;
	dict[a[i]] = 1;
	dict[a[i] + 1] = 1;
}
for (var i = 0, ii = b.length; i < ii; i++) {
	dict[b[i] - 1] = 1;
	dict[b[i]] = 1;
	dict[b[i] + 1] = 1;
}
for (var num in dict) {
	c.push(parseInt(num));
}
a.sort(g);
b.sort(g);
c.sort(g);

var A = 0, B = 0;
var diff = -123456789;

var i = -1, j = -1;

for (var ci = 0, cii = c.length; ci < cii; ci++) {
	while (i < n - 1 && a[i + 1] <= c[ci]) i++;
	while (j < m - 1 && b[j + 1] <= c[ci]) j++;
	var AA = (i + 1) * 2 + (n - i - 1) * 3;
	var BB = (j + 1) * 2 + (m - j - 1) * 3;
	if (AA - BB > diff) {
		diff = AA - BB;
		A = AA;
		B = BB;
	} else if (AA - BB === diff) {
		if (AA > A) {
			A = AA;
			B = BB;
		}
	}
	if (n == 5)
		print(c[ci] + ' ' + A + ' ' + B);
}
if (n == 5)
{
	print(a.join(','));
	print(b.join(','));
}
print(A+':'+B);


You are a given an array $$$a$$$ of length $$$n$$$. Find a subarray $$$a[l..r]$$$ with length at least $$$k$$$ with the largest median.A median in an array of length $$$n$$$ is an element which occupies position number $$$\lfloor \frac{n + 1}{2} \rfloor$$$ after we sort the elements in non-decreasing order. For example: $$$median([1, 2, 3, 4]) = 2$$$, $$$median([3, 2, 1]) = 2$$$, $$$median([2, 1, 2, 1]) = 1$$$.Subarray $$$a[l..r]$$$ is a contiguous part of the array $$$a$$$, i. e. the array $$$a_l,a_{l+1},\ldots,a_r$$$ for some $$$1 \leq l \leq r \leq n$$$, its length is $$$r - l + 1$$$.

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq 2 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq n$$$).

Output one integer $$$m$$$ — the maximum median you can get.

NoteIn the first example all the possible subarrays are $$$[1..3]$$$, $$$[1..4]$$$, $$$[1..5]$$$, $$$[2..4]$$$, $$$[2..5]$$$ and $$$[3..5]$$$ and the median for all of them is $$$2$$$, so the maximum possible median is $$$2$$$ too.In the second example $$$median([3..4]) = 3$$$.

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

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

function main () {
	const [n, k] = rna();
	const a = rna();

	function check (m) {
		const b = []; b[-1] = 0;
		for (let i = 0; i < n; i++) {
			b[i] = a[i] >= m ? 1 : -1;
			b[i] += b[i-1];
		}

		let mn = 0;
		for (let i = k - 1; i < n; i++) {
			mn = Math.min(mn, b[i-k]);
			if (b[i] > mn) return true;
		}
		return false;
	}

	let ans = 0;
	let l = 1, r = n;
	while (l <= r) {
		const mid = l + r >> 1;
		if (check(mid)) {
			ans = mid;
			l = mid + 1;
		} else {
			r = mid - 1;
		}
	}

	console.log(ans);
}

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

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

function main () {
	const [n, k] = rna();
	const a = rna();

	const as = a.slice();
	as.sort((x, y) => x - y);

	function check (m) {
		const b = [];
		for (let i = 0; i < n; i++) {
			b[i] = a[i] >= m ? 1 : -1;
		}

		const psum = [], pmnsum = []; psum[-1] = 0, pmnsum[-1] = 0;
		for (let i = 0; i < n; i++) {
			psum[i] = psum[i-1] + b[i];
			pmnsum[i] = Math.min(pmnsum[i-1], psum[i]);
		}

		//if (m == 47) console.log({m, b, psum, pmnsum});

		for (let i = k-1; i < n; i++) {
			if (psum[i] - pmnsum[i-k] > 0) return true;
		}

		return false;
	}

	let ans = 0;
	let l = 0, r = n-1;
	while (l <= r) {
		const mid = l + r >> 1;
		if (check(as[mid])) {
			ans = as[mid];
			l = mid + 1;
		} else {
			r = mid - 1;
		}
	}

	console.log(ans);
}

const rl = require("readline").createInterface({
	input: process.stdin
});
const it = rl[Symbol.asyncIterator]();
const readln = async () => (await it.next()).value;
const writeln = (value) => process.stdout.write(`${value}\n`);
const run = async (proc)  => { await proc(); rl.close(); };

run(async () =>
{
	const [n,k] = (await readln()).split(" ").map((e) => parseInt(e));
	const a = new Int32Array(n+1);
	const b = new Int32Array(n+1);
	(await readln()).split(" ").forEach((e,i) => a[i+1] = parseInt(e));
	let l = 0;
	let h = n+1;
	while(h-l>=2)
	{
		let m = Math.floor((l+h)/2);
		for(let i=1;i<=n;i++)
		{
			b[i] = b[i-1];
			if (a[i]<m)
			{
				b[i]--;
			}
			else
			{
				b[i]++;
			}
		}
		let found = false;
		for(let i=n-1;i>=0;i--)
		{
			found = found || (((i+k)<=n) && (b[i]<b[i+k]));
			if (found) break;
			b[i] = Math.max(b[i],b[i+1]);
		}
		if (found)
		{
			l = m;
		}
		else
		{
			h = m;
		}
	}
	writeln(l);
});

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

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

function main () {
	const [n, k] = rna();
	const a = rna();
	const ar = a.slice().reverse();

	const as = a.slice();
	as.sort((x, y) => x - y);

	function check (m, a) {
		const req = Math.ceil((k+1)/2);
		//console.log({m, req})
		let lc = 0, rc = 0;
		for (let i = 0; i < n; i++) {
			if (a[i] >= m) {
				rc++;
				if (rc == Math.max(lc+1, req)) return 1;
			} else {
				if (rc) {
					lc++;
					if (lc - rc >= req) lc = rc = 0;
				}
			}
			//console.log({m, req, i, lc, rc}, a[i])
		}
		return 0;
	}

	let ans = 0;
	let l = 0, r = n-1;
	while (l <= r) {
		const mid = l + r >> 1;
		cur = check(as[mid], a) || check(as[mid], ar);
		//console.log({cur});
		if (cur) {
			ans = as[mid];
			l = mid + 1;
		} else {
			r = mid - 1;
		}
	}

	console.log(ans);
}

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

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

function main () {
	const [n, k] = rna();
	const a = rna();

	const as = a.slice();
	as.sort((x, y) => x - y);

	function check (m) {
		const req = Math.ceil((k+1)/2);
		//console.log({m, req})
		let lc = 0, rc = 0;
		for (let i = 0; i < n; i++) {
			if (a[i] >= m) {
				rc++;
				if (rc == Math.max(lc+1, req)) return 1;
			} else {
				if (rc) {
					lc++;
					if (lc - rc > req) lc = rc = 0;
				}
			}
			//console.log({m, req, i, lc, rc}, a[i])
		}
		return 0;
	}

	let ans = 0;
	let l = 0, r = n-1;
	while (l <= r) {
		const mid = l + r >> 1;
		cur = check(as[mid]);
		//console.log({cur});
		if (cur) {
			ans = as[mid];
			l = mid + 1;
		} else {
			r = mid - 1;
		}
	}

	console.log(ans);
}

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

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

function main () {
	const [n, k] = rna();
	const a = rna();

	a.sort((x, y) => x - y);

	function check (m) {
		const req = Math.ceil((k+1)/2);
		let lc = 0, rc = 0;
		for (let i = 0; i < n; i++) {
			if (a[i] >= m) {
				rc++;
				if (rc == req) return 1;
			} else {
				if (rc) {
					lc++;
					if (lc - rc > req) lc = rc = 0;
				}
			}
		}
		return 0;
	}

	let ans = 0;
	let l = 0, r = n-1;
	while (l <= r) {
		const mid = l + r >> 1;
		if (check(a[mid])) {
			ans = a[mid];
			l = mid + 1;
		} else {
			r = mid - 1;
		}
	}

	console.log(ans);
}