Vasya wants to turn on Christmas lights consisting of m bulbs. Initially, all bulbs are turned off. There are n buttons, each of them is connected to some set of bulbs. Vasya can press any of these buttons. When the button is pressed, it turns on all the bulbs it's connected to. Can Vasya light up all the bulbs?If Vasya presses the button such that some bulbs connected to it are already turned on, they do not change their state, i.e. remain turned on.

The first line of the input contains integers n and m (1 ≤ n, m ≤ 100) — the number of buttons and the number of bulbs respectively.  Each of the next n lines contains xi (0 ≤ xi ≤ m) — the number of bulbs that are turned on by the i-th button, and then xi numbers yij (1 ≤ yij ≤ m) — the numbers of these bulbs.

If it's possible to turn on all m bulbs print "YES", otherwise print "NO".

NoteIn the first sample you can press each button once and turn on all the bulbs. In the 2 sample it is impossible to turn on the 3-rd lamp.

//const nums = line.trim().split(' ').map(s => parseInt(s))

var numLines = 0;

var buttons = 0;
var bulbs = 0;

var allBulbs = [];

require('readline').createInterface({
    input: process.stdin,
}).on('line', (line) => {
    numLines++;
    let nums = line.trim().split(' ');
    for(let i = 0; i<nums.length; i++){
        nums[i] = parseInt(nums[i]);
    }

    if(numLines === 1){
        buttons = nums[0];
        bulbs = nums[1];

        return;
    }

    let numBulbsInLine = nums[0];

    for(let i = 1; i<=numBulbsInLine; i++){
        if(allBulbs.indexOf(nums[i]) === -1){
            allBulbs.push(nums[i]);
        }
    }

    if(numLines - 1 === buttons){
        let flag = true;
        for(let i = 1; i <= bulbs; i++){
            if(allBulbs.indexOf(i) === -1){
                flag = false;
                break;
            }
        }

        process.stdout.write(flag ? 'YES' : 'NO' + '\n');
        process.exit();
    }
})

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, m;
let arr = [];

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

  let temp = d.split(' ');
  temp.shift();

  arr = arr.concat(temp);

  c++;
});

rl.on('close', () => {
  const ans = new Set(arr);

  if (ans.size === m) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }
});

var input = readline().split(" "), n = +input[0], m = +input[1];
var lamps = [];
for(var i = 0; i < m; i++){
    lamps[i] = false;
}

for(var i = 0; i < n; i++){
    input = readline().split(" ").map(Number);
    var x = input[0];
    var y = input.slice(1);
    for(var j = 0; j < x; j++){
        lamps[y[j]-1] = true;
    }
}

var ans = lamps.every( function(a){ return a; } );

if(ans){
    write("YES");
}else{
    write("NO");
}

Array.prototype.in_array = function(p_val) {
	for(var i = 0, l = this.length; i < l; i++)	{
		if(this[i] == p_val) {
			return true;
		}
	}
	return false;
}

var inp = readline().split(' ');
var n = inp[0];
var m = inp[1];

var m_arr = [];
for(var i = 1; i <= n; i++) {
    var n_arr = readline().split(' ');
    for (var j = 1; j <= n_arr[0]; j++) {
        m_arr.push(n_arr[j]);
    }
}
var f;
for(var k = 1; k <= m; k++) {
    if (m_arr.in_array(k)) {
        f = true;
    } else {
        f = false;
        break;
    }
}
if(f) {
    print("YES");
} else {
    print("NO");
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, m;
let arr = [];

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

  arr = arr.concat(d.split(' '));

  c++;
});

rl.on('close', () => {
  const ans = new Set(arr);

  if (ans.size === m) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }
});


You are given an integer $$$n$$$. Check if $$$n$$$ has an odd divisor, greater than one (does there exist such a number $$$x$$$ ($$$x > 1$$$) that $$$n$$$ is divisible by $$$x$$$ and $$$x$$$ is odd).For example, if $$$n=6$$$, then there is $$$x=3$$$. If $$$n=4$$$, then such a number does not exist.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case contains one integer $$$n$$$ ($$$2 \le n \le 10^{14}$$$). Please note, that the input for some test cases won't fit into $$$32$$$-bit integer type, so you should use at least $$$64$$$-bit integer type in your programming language.

For each test case, output on a separate line:    "YES" if $$$n$$$ has an odd divisor, greater than one;  "NO" otherwise.  You can output "YES" and "NO" in any case (for example, the strings yEs, yes, Yes and YES will be recognized as positive).

var cnt = +readline();
var arr = [];
for(var i = 0; i < cnt; i++) {
    arr.push(readline());
}

function oddDivisor(n) {
  if (n !== 1 && n % 2 === 1) {
    return 'YES';
  }
  if (n === 1) {
    return 'NO';
  }
  return oddDivisor(Math.floor(n / 2));
}

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

var t = readline();
    for(var i = 0 ; i < t ; ++i){
        var n = readline();
        while(n > 1){
            if(n%2 === 0){
                n = n /2;
            }
            else{
                print("YES");
                break;
            }
        }
        if(n == 1){
            print("NO");
        }
    }

var n = +readline();
for(var i = 0; i < n; i++) {
  var val = +readline(), temp = 2;
  while(val > temp) {
    temp = temp * 2;
  }
  print(val === temp ? 'NO' : 'YES');
}

"use strict"
let iter = parseInt(readline());

while(iter--){
let ch=false;
let input=parseInt(readline());
for(var i =input;i>1;i/=2){
if(i%2!==0){
ch=true;

}

}
(ch===true)?print("YES"):print("NO");
}

"use strict"

let iter = parseInt(readline());

while(iter--){
    let res = "NO";
    let input = parseInt(readline());
    for(let i = input; input > 1; input /= 2){
        if(input % 2 === 1){
            res = "YES";
            break;
        }
    }
    print(res);
}

//  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]
        if(k % 2 == 1){
            console.log('YES')
            continue;
        }
        while(k % 2 === 0){
            k /= 2
        }
        console.log(k > 1 ? 'YES' : 'NO')
    }
});

const nextString = (function() {
  const l = [], s = [], p = process.stdin
  let q = ''
  p.setEncoding('utf8')
  p.on('readable', () => {
    let c
    while ((c = p.read()) !== null) {
      c = (q + c).split(/\r\n|\r|\n/)
      q = c[c.length - 1]
      for (let i = 0; i < c.length - 1; ++i) {
        if (c[i].length > 0) {
          if (l.length > 0) {
            l.shift(1)(c[i])
          }
          else {
            s.push(c[i])
          }
        }
      }
    }
  })
  const f = r => {
    if (s.length > 0) {
      r(s.shift(1))
    }
    else {
      l.push(r)
    }
  }
  return () => new Promise(f)
})()

async function main() {
  let t = +await nextString()
  let one = BigInt(1)
  let two = BigInt(2)
  let zero = BigInt(0)
  for (let i = 0; i < t; ++i) {
    let n = BigInt(await nextString())
    while (n % two === zero) {
      n = n >> one
    }
    if (n > one) {
      console.log('YES')
    }
    else {
      console.log('NO')
    }
  }
  process.exit(0)
}

main()

const nextString = (function() {
  const listeners = [], strings = [], ps = process.stdin
  let last = ''
  ps.setEncoding('utf8')
  ps.on('readable', () => {
    let chunk
    while ((chunk = ps.read()) !== null) {
      chunk = (last + chunk).split(/\r\n|\r|\n/)
      last = chunk[chunk.length - 1]
      for (let i = 0; i < chunk.length - 1; ++i) {
        if (chunk[i].length > 0) {
          if (listeners.length > 0) {
            listeners.shift(1)(chunk[i])
          }
          else {
            strings.push(chunk[i])
          }
        }
      }
    }
  })
  const fn = resolve => {
    if (strings.length > 0) {
      resolve(strings.shift(1))
    }
    else {
      listeners.push(resolve)
    }
  }
  return () => new Promise(fn)
})()

async function main() {
  let t = +await nextString()
  let one = BigInt(1)
  let two = BigInt(2)
  let zero = BigInt(0)
  for (let i = 0; i < t; ++i) {
    let n = BigInt(await nextString())
    while (n % two === zero) {
      n = n >> one
    }
    if (n > one) {
      console.log('YES')
    }
    else {
      console.log('NO')
    }
  }
  process.exit(0)
}

main()

process.stdin.resume();
process.stdin.setEncoding("utf8");
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();
});

function main() {
  const cl = console.log,
    rl = readLine,
    tc = rl();

  for (let i = 0; i < tc; i++) {
    let N = +rl();
    while (N % 2 === 0) N /= 2;
    N > 1 ? cl("Yes") : cl("NO");
  }
}

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

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

function main() {
	let t = +readLine();
	const map = new Map();
	while (t--) {
		let n = +readLine();
		if (map.has(n)) {
			console.log(map.get(n));
		} else {
			if (n % 2 !== 0) {
				map.set(n, 'YES');
				console.log('YES');
			} else {
				let found = false;
				let div = Math.floor(n / 2);
				while (div > 1) {
					if (div % 2 !== 0) {
						found = true;
						console.log('YES');
						map.set(n, 'YES');
						break;
					}
					div = Math.floor(div / 2);
				}
				if (!found) {
					map.set(n, 'NO');
					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++];
}

// 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
        console.log(isPrime(n))
        // if (n % 2 !== 0) return console.log('YES')
        // if (!isPrime(n)) return console.log(n)
        // console.log('NO')
    })
}

function isPrime(num) {
    var result = true
    while (num !== 1 && num % 2 === 0) {
        num = num / 2
    }
return     num !== 1 ? 'YES' :'NO'
    console.log(num)
}

//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();
	for(var i = 0; i < t; i++){
		var N = nextInt();
		var isOK = false;
		while(N > 1){
			if(N % 2 == 0){
				N /= 2;
			}else{
				isOK = true;
				break;
			}
		}
		myout((isOK) ? "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 i = 1; i < input.length; i++) {
    while (+input[i] % 2 === 0) {
      input[i] = +input[i] / 2;
    }
    if (+input[i] > 1) console.log("YES");
    else 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];
    for(i = 1; i <= t; i++){
        var n = lines[i];
        if(n % 2 == 1){
            console.log('YES');
            continue;
        }
        while(n % 2 === 0){
            n /= 2;
        }
        console.log(n > 1 ? '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.split("\n");
    main();
});

/********** Utility Function Start **********/
/**
 *  read row Input
 * @returns string
 */
function _readRawLine() {
    return inputString[currentLine++];
}
function readLine(){
    // return _readRawLine().replace(/\s+$/g, '');
    return _readRawLine().replace('\r', '');
}

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

function readSingleInt() {
    const p = readLine();
    return parseInt(p);
}
function readIntArray() {
    return readLine().split(" ").map((v) => parseInt(v));
}
function readArray() {
    return readLine().split(" ");
}
function int(n) {
    return parseInt(n);
}
/********** Utility Function End **********/
/**
 * Don't Touch this fucntion at all unless you know what are you doing!
 */
function main() {
    solve();
}

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

function solve() {
    let tc = readSingleInt();
    // console.log(BigInt(readLine()));
    const two = BigInt(2);
    while(tc--){
        let bgi = BigInt(readLine());
        let cnt = 0;
        while(bgi%two==0){
            bgi = bgi / two;
        }
        if(bgi===BigInt(1)){
            print("NO");
        }else{
            print("YES")
        }
    }

}

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

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

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = +input[z++];

    while(testCases--){
        let num = +input[z++];
        if(num % 2){
            console.log("YES");
        }
        else{
            if(Math.log2(num) % 2 === 0 || Math.log2(num) % 2 === 1){
                console.log("NO");
            }
            else{
                console.log("YES");
            }
        }
    }
}

//https://codeforces.com/problemset/problem/1475/A
const readline = require("readline");
const scanner = readline.createInterface({
	input: process.stdin,
	output: process.stdout
});

isOne = true;
scanner.on("line", input => {
	if (isOne)
	{
		isOne = false;
	}
	else
	{
		console.log(oddDivisor(+input));
	}
});

//Oh lmao if everything is even divisor then it would just be 2^x
//A odd divisor is the only thing that jams this
const oddDivisor = num => Math.log2(num) % 1 != 0 ? "YES" : "NO";

// define file test.inp
process.stdin.resume();
process.stdin.setEncoding("utf8");

var jsin = "";
var jscur = 0;

process.stdin.on('data',chunk => jsin += chunk);
process.stdin.on('end',function(){
    jsin = jsin.split('\n')
    main();
});

readLine = () => jsin[jscur++];
readLines = () => readLine().split(' ');
readInt = () => parseInt(readLine());
readInts = () => readLine().split(' ').map(x => parseInt(x));

function main(){
    // code goes here!!
    var numTest = readInt();
    for(let i = 0;i < numTest;++i){
        let n = readInt();
        while(n % 2 == 0){
            n /= 2;
        }
        if(n > 1){
            console.log("YES");
        } else {
            console.log("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]
            console.log(k % 2 ==1 ? 'YES' : 'NO')
            continue;

    }
});

//  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; i++){
        var k = lines[j]
            console.log(k % 2 ==1 ? 'YES' : 'NO')
            break;;

    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(j = 1; j <= n; j++){
    var k = Number(lines[j])
    e = k / 2
    if(k % 2 === 0 && e % 2 != 1){
        console.log('NO')
    }else{
        console.log('YES')
    }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(j = 1; j <= n; j++){
    var k = Number(lines[j])
    e = k / 2
    if(k % 2 === 0 || e % 2 != 1){
        console.log('NO')
    }else{
        console.log('YES')
    }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(j = 1; j <= n; j++){
    var k = Number(lines[j])
    e = k / 2
    if(k % 2 === 0 || e % 2 == 1){
        console.log('NO')
    }else{
        console.log('YES')
    }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(j = 1; j <= n; j++){
    var k = Number(lines[j])
    if(k % 2 === 0){
        console.log('NO')
    }else{
        console.log('YES')
    }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(j = 1; j <= n; j++){
    var k = lines[j]
    if(k % 2 === 0){
        console.log('NO')
    }else{
        console.log('YES')
    }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(j = 1; j <= n; j++){
    var k = lines[j]
    if(j % 2 === 0){
        console.log('NO')
    }else{
        console.log('YES')
    }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    if(n % 2 === 0){
        console.log('NO')
    }else{
        console.log('YES')
    }
});

const nextString = (function() {
  const l = [], s = [], p = process.stdin
  p.setEncoding('utf8')
  p.on('readable', () => {
    for (let c; (c = p.read()) !== null;) {
      c = c.split(/\r\n|\r|\n/)
      for (let i = 0; i < c.length; ++i) {
        if (c[i].length > 0) {
          if (l.length > 0) {
            l.shift(1)(c[i])
          }
          else {
            s.push(c[i])
          }
        }
      }
    }
  })
  const f = r => {
    if (s.length > 0) {
      r(s.shift(1))
    }
    else {
      l.push(r)
    }
  }
  return () => new Promise(f)
})()

async function main() {
  let t = +await nextString()
  let one = BigInt(1)
  let two = BigInt(2)
  let zero = BigInt(0)
  for (let i = 0; i < t; ++i) {
    let n = BigInt(await nextString())
    while (n % two === zero) {
      n = n >> one
    }
    if (n > one) {
      console.log('YES')
    }
    else {
      console.log('NO')
    }
  }
  process.exit(0)
}

main()

const nextString = (function() {
  const l = [], s = [], p = process.stdin
  p.setEncoding('utf8')
  p.on('readable', () => {
    for (let c; (c = p.read()) !== null;) {
      c = c.split(/\r\n|\r|\n/)
      for (let i = 0; i < c.length; ++i) {
        if (c[i].length > 0) {
          if (l.length > 0) {
            l.shift(1)(c[i])
          }
          else {
            s.push(c[i])
          }
        }
      }
    }
  })
  const f = r => {
    if (s.length > 0) {
      r(s.shift(1))
    }
    else {
      l.push(r)
    }
  }
  return () => new Promise(f)
})()

async function main() {
  let t = +await nextString()
  for (let i = 0; i < t; ++i) {
    let n = +await nextString()
    while (n % 2 === 0) {
      n = Math.round(n / 2)
    }
    if (n > 1) {
      console.log('YES')
    }
    else {
      console.log('NO')
    }
  }
  process.exit(0)
}

main()

process.stdin.resume();
process.stdin.setEncoding("utf8");
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();
});

function main() {
  const cl = console.log,
    rl = readLine,
    tc = rl();

  for (let i = 0; i < tc; i++) {
    const n = +rl();
    if (n & (n - 1)) cl("Yes");
    else cl("NO");
  }
}

process.stdin.resume();
process.stdin.setEncoding("utf8");
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();
});

function main() {
  const cl = console.log,
    rl = readLine,
    tc = rl();

  for (let i = 0; i < tc; i++) {
    const n = rl();
    if (n & (n - 1)) cl("Yes");
    else cl("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++];
}

// 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
        if (n % 2 !== 0) return  console.log('YES')
        // if (!isPrime(n)) return console.log(n)
        console.log('NO')
    })

}

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


Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not subsequences: "owoo", "owwwo", "ooo".The wow factor of a string is the number of its subsequences equal to the word "wow". Bob wants to write a string that has a large wow factor. However, the "w" key on his keyboard is broken, so he types two "v"s instead. Little did he realise that he may have introduced more "w"s than he thought. Consider for instance the string "ww". Bob would type it as "vvvv", but this string actually contains three occurrences of "w":   "vvvv"  "vvvv"  "vvvv" For example, the wow factor of the word "vvvovvv" equals to four because there are four wows:  "vvvovvv"  "vvvovvv"  "vvvovvv"  "vvvovvv" Note that the subsequence "vvvovvv" does not count towards the wow factor, as the "v"s have to be consecutive.For a given string $$$s$$$, compute and output its wow factor. Note that it is not guaranteed that it is possible to get $$$s$$$ from another string replacing "w" with "vv". For example, $$$s$$$ can be equal to "vov".

The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.

Output a single integer, the wow factor of $$$s$$$.

NoteThe first example is explained in the legend.

const readline = require('readline');

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

const preprocess = input => {
  let l = 0;
  let r = input.length;
  while (input[l] === 'o') {
    l++;
  }
  while (input[r - 1] === 'o') {
    r--;
  }
  return input.substring(l, r);
};

rl.question('', (input) => {
  const before = [];
  const after = [];
  let count = 0;
  let numw = 0;

  const rep = preprocess(input);
  for (let i = 0; i < rep.length; i++) {
    let c = rep[i];
    if (c === 'v') {
      count++;
    } else {
      numw += (count - 1);
      before.push(numw > 0 ? numw : 0);
      count = 0;
      while (c && c !== 'v') {
        c = rep[++i];
      }
      --i;
    }
  }
  count = 0;
  numw = 0;
  for (let i = 0; i < rep.length; i++) {
    let c = rep[rep.length - i - 1];
    if (c === 'v') {
      count++;
    } else {
      numw += (count - 1);
      after.push(numw > 0 ? numw : 0);
      count = 0;
      while (c && c !== 'v') {
        i += 1;
        c = rep[rep.length - i - 1];
      }
      --i;
    }
  }

  const ogroup = rep.split('v').filter(c => c !== '').map(group => group.length);

  let res = 0;
  for (let i = 0; i < before.length; i++) {
    res += (ogroup[i] * before[i] * after[after.length - 1 - i]);
  }
  console.log(res);

  rl.close();
});

const readline = require('readline');

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

rl.question('', (input) => {
  const before = [];
  const after = [];
  let count = 0;
  let numw = 0;

  let l = 0;
  let r = input.length;
  while (input[l] === 'o') {
    l++;
  }
  while (input[r - 1] === 'o') {
    r--;
  }

  const rep = input.substring(l, r);
  for (let i = 0; i < rep.length; i++) {
    let c = rep[i];
    if (c === 'v') {
      count++;
    } else {
      numw += (count - 1);
      before.push(numw > 0 ? numw : 0);
      count = 0;
      while (c && c !== 'v') {
        c = rep[++i];
      }
      --i;
    }
  }
  count = 0;
  numw = 0;
  for (let i = 0; i < rep.length; i++) {
    let c = rep[rep.length - i - 1];
    if (c === 'v') {
      count++;
    } else {
      numw += (count - 1);
      after.push(numw > 0 ? numw : 0);
      count = 0;
      while (c && c !== 'v') {
        i += 1;
        c = rep[rep.length - i - 1];
      }
      --i;
    }
  }

  const ogroup = rep.split('v').filter(c => c !== '').map(group => group.length);

  let res = 0;
  for (let i = 0; i < before.length; i++) {
    res += (ogroup[i] * before[i] * after[after.length - 1 - i]);
  }
  console.log(res);

  rl.close();
});

const readline = require('readline');

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

rl.question('', (input) => {
  const before = [];
  const after = [];
  const rep = input.split('v');
  let count = 0;
  rep.forEach((c) => {
    if (c === '') {
      count++
    } else {
      before.push((count - 1) * c.length);
    }
  });
  count = 0;
  for (let i = rep.length - 1; i >= 0 ; i--) {
    let c = rep[i];
    if (c === '') {
      count++
    } else {
      after.push(count - 1);
    }
  }

  let res = 0;
  for (let i = 0; i < before.length; i++) {
    res += (before[i] * after[after.length - 1 - i]);
  }
  console.log(res);

  rl.close();
});

const readline = require('readline');

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

rl.question('', (input) => {
  const before = [];
  const after = [];
  const rep = input.split('v');
  let count = 0;
  rep.forEach((c) => {
    if (c === '') {
      count++
    } else {
      before.push((count - 1) * c.length);
    }
  });
  count = 0;
  for (let i = rep.length - 1; i >= 0 ; i--) {
    let c = rep[i];
    if (c === '') {
      count++
    } else {
      after.push(count - 1);
    }
  }

  let res = 0;
  for (let i = 0; i < before.length; i++) {
    res += (before[i] * after[after.length - 1 - i]);
  }
  if (res <= 0) {
    console.log(0);
  } else {
    console.log(res);
  }

  rl.close();
});


You are given an array $$$a[0 \ldots n - 1] = [a_0, a_1, \ldots, a_{n - 1}]$$$ of zeroes and ones only. Note that in this problem, unlike the others, the array indexes are numbered from zero, not from one.In one step, the array $$$a$$$ is replaced by another array of length $$$n$$$ according to the following rules:   First, a new array $$$a^{\rightarrow d}$$$ is defined as a cyclic shift of the array $$$a$$$ to the right by $$$d$$$ cells. The elements of this array can be defined as $$$a^{\rightarrow d}_i = a_{(i + n - d) \bmod n}$$$, where $$$(i + n - d) \bmod n$$$ is the remainder of integer division of $$$i + n - d$$$ by $$$n$$$.  It means that the whole array $$$a^{\rightarrow d}$$$ can be represented as a sequence $$$$$$a^{\rightarrow d} = [a_{n - d}, a_{n - d + 1}, \ldots, a_{n - 1}, a_0, a_1, \ldots, a_{n - d - 1}]$$$$$$  Then each element of the array $$$a_i$$$ is replaced by $$$a_i \,\&\, a^{\rightarrow d}_i$$$, where $$$\&$$$ is a logical "AND" operator. For example, if $$$a = [0, 0, 1, 1]$$$ and $$$d = 1$$$, then $$$a^{\rightarrow d} = [1, 0, 0, 1]$$$ and the value of $$$a$$$ after the first step will be $$$[0 \,\&\, 1, 0 \,\&\, 0, 1 \,\&\, 0, 1 \,\&\, 1]$$$, that is $$$[0, 0, 0, 1]$$$.The process ends when the array stops changing. For a given array $$$a$$$, determine whether it will consist of only zeros at the end of the process. If yes, also find the number of steps the process will take before it finishes.

The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases.  The first line of each test case description contains two integers: $$$n$$$ ($$$1 \le n \le 10^6$$$) — array size and $$$d$$$ ($$$1 \le d \le n$$$) — cyclic shift offset. The second line of the description contains $$$n$$$ space-separated integers $$$a_i$$$ ($$$0 \le a_i \le 1$$$) — elements of the array. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$.

Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to a test case should be a single integer — the number of steps after which the array will contain only zeros for the first time. If there are still elements equal to $$$1$$$ in the array after the end of the process, print -1.

NoteIn the third sample test case the array will change as follows:   At the beginning $$$a = [1, 1, 0, 1, 0]$$$, and $$$a^{\rightarrow 2} = [1, 0, 1, 1, 0]$$$. Their element-by-element "AND" is equal to $$$$$$[1 \,\&\, 1, 1 \,\&\, 0, 0 \,\&\, 1, 1 \,\&\, 1, 0 \,\&\, 0] = [1, 0, 0, 1, 0]$$$$$$  Now $$$a = [1, 0, 0, 1, 0]$$$, then $$$a^{\rightarrow 2} = [1, 0, 1, 0, 0]$$$. Their element-by-element "AND" equals to $$$$$$[1 \,\&\, 1, 0 \,\&\, 0, 0 \,\&\, 1, 1 \,\&\, 0, 0 \,\&\, 0] = [1, 0, 0, 0, 0]$$$$$$  And finally, when $$$a = [1, 0, 0, 0, 0]$$$ we get $$$a^{\rightarrow 2} = [0, 0, 1, 0, 0]$$$. Their element-by-element "AND" equals to $$$$$$[1 \,\&\, 0, 0 \,\&\, 0, 0 \,\&\, 1, 0 \,\&\, 0, 0 \,\&\, 0] = [0, 0, 0, 0, 0]$$$$$$  Thus, the answer is $$$3$$$ steps.In the fourth sample test case, the array will not change as it shifts by $$$2$$$ to the right, so each element will be calculated as $$$0 \,\&\, 0$$$ or $$$1 \,\&\, 1$$$ thus not changing its value. So the answer is -1, the array will never contain only zeros.

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

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

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

		let ans = 0;
		const vis = [];
		for (let i = 0; i < n; i++) {
			if (vis[i]) continue;

			let pos = i;
			while (true) {
				if (a[pos] == 0) break;
				pos = (pos + d) % n;
				if (pos == i) break;
			}

			if (a[pos] == 1) {
				ans = -1;
				break;
			}

			let cnt = 0;
			while (!vis[pos]) {
				vis[pos] = 1;
				pos = (pos + d) % n;
				cnt += a[pos] ? 1 : -cnt;
				ans = Math.max(ans, cnt);
			}
		}

		console.log(ans);
	}
}


Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like walls, he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.Roger Waters has a square grid of size $$$n\times n$$$ and he wants to traverse his grid from the upper left ($$$1,1$$$) corner to the lower right corner ($$$n,n$$$). Waters can move from a square to any other square adjacent by a side, as long as he is still in the grid. Also except for the cells ($$$1,1$$$) and ($$$n,n$$$) every cell has a value $$$0$$$ or $$$1$$$ in it.Before starting his traversal he will pick either a $$$0$$$ or a $$$1$$$ and will be able to only go to cells values in which are equal to the digit he chose. The starting and finishing cells ($$$1,1$$$) and ($$$n,n$$$) are exempt from this rule, he may go through them regardless of picked digit. Because of this the cell ($$$1,1$$$) takes value the letter 'S' and the cell ($$$n,n$$$) takes value the letter 'F'.For example, in the first example test case, he can go from ($$$1, 1$$$) to ($$$n, n$$$) by using the zeroes on this path: ($$$1, 1$$$), ($$$2, 1$$$), ($$$2, 2$$$), ($$$2, 3$$$), ($$$3, 3$$$), ($$$3, 4$$$), ($$$4, 4$$$)The rest of the band (Pink Floyd) wants Waters to not be able to do his traversal, so while he is not looking they will invert at most two cells in the grid (from $$$0$$$ to $$$1$$$ or vice versa). They are afraid they will not be quick enough and asked for your help in choosing the cells.  Note that you cannot invert cells $$$(1, 1)$$$ and $$$(n, n)$$$.We can show that there always exists a solution for the given constraints.Also note that Waters will pick his digit of the traversal after the band has changed his grid, so he must not be able to reach ($$$n,n$$$) no matter what digit he picks.

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 50$$$). Description of the test cases follows. The first line of each test case contains one integers $$$n$$$ ($$$3 \le n \le 200$$$). The following $$$n$$$ lines of each test case contain the binary grid, square ($$$1, 1$$$) being colored in 'S' and square ($$$n, n$$$) being colored in 'F'. The sum of values of $$$n$$$ doesn't exceed $$$200$$$.

For each test case output on the first line an integer $$$c$$$ ($$$0 \le c \le 2$$$)  — the number of inverted cells. In $$$i$$$-th of the following $$$c$$$ lines, print the coordinates of the $$$i$$$-th cell you inverted. You may not invert the same cell twice.  Note that you cannot invert cells $$$(1, 1)$$$ and $$$(n, n)$$$.

NoteFor the first test case, after inverting the cell, we get the following grid:S01000011001111F

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

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

function main() {
  let t = +readLine();
  while (t--) {
    const len = +readLine();
    const arr = [];
    let i = len;
    while (i--) {
      const row = readLine();
      arr.push(row);
    }
    const [right, bottom, top, left] = [+arr[0][1], +arr[1][0], +arr[len - 2][len - 1], +arr[len - 1][len - 2]];

    if ((right + bottom === 0 && top + left === 0) || (right + bottom === 2 && top + left === 2)) {
      console.log(2);
      console.log(`${1} ${2}`);
      console.log(`${2} ${1}`);
    } else if ((right + bottom === 0 && top + left === 2) || (right + bottom === 2 && top + left === 0)) {
      console.log(0);
    } else {
      if (bottom === 1 && right === 0 && left === 1 && top === 0) {
        console.log(2);
        console.log(`${2} ${1}`);
        console.log(`${len - 1} ${len}`);
      } else if (bottom === 1 && right === 0 && left === 0 && top === 1) {
        console.log(2);
        console.log(`${2} ${1}`);
        console.log(`${len} ${len - 1}`);
      } else if (bottom === 0 && right === 1 && left === 0 && top === 1) {
        console.log(2);
        console.log(`${2} ${1}`);
        console.log(`${len - 1} ${len}`);
      } else if (bottom === 0 && right === 1 && left === 1 && top === 0) {
        console.log(2);
        console.log(`${2} ${1}`);
        console.log(`${len} ${len - 1}`);
      } else if (bottom === 1 && right === 0 && left === 1 && top === 1) {
        console.log(1);
        console.log(`${2} ${1}`);
      } else if (bottom === 1 && right === 0 && left === 0 && top === 0) {
        console.log(1);
        console.log(`${1} ${2}`);
      } else if (bottom === 0 && right === 1 && left === 1 && top === 1) {
        console.log(1);
        console.log(`${1} ${2}`);
      } else if (bottom === 0 && right === 1 && left === 0 && top === 0) {
        console.log(1);
        console.log(`${2} ${1}`);
      } else if (bottom === 0 && right === 0 && left === 1 && top === 0) {
        console.log(1);
        console.log(`${len - 1} ${len}`);
      } else if (bottom === 0 && right === 0 && left === 0 && top === 1) {
        console.log(1);
        console.log(`${len} ${len - 1}`);
      } else if (bottom === 1 && right === 1 && left === 1 && top === 0) {
        console.log(1);
        console.log(`${len} ${len - 1}`);
      } else if (bottom === 1 && right === 1 && left === 0 && top === 1) {
        console.log(1);
        console.log(`${len - 1} ${len}`);
      }
    }
  }
}


You have an array of integers $$$a$$$ of size $$$n$$$. Initially, all elements of the array are equal to $$$1$$$. You can perform the following operation: choose two integers $$$i$$$ ($$$1 \le i \le n$$$) and $$$x$$$ ($$$x > 0$$$), and then increase the value of $$$a_i$$$ by $$$\left\lfloor\frac{a_i}{x}\right\rfloor$$$ (i.e. make $$$a_i = a_i + \left\lfloor\frac{a_i}{x}\right\rfloor$$$).After performing all operations, you will receive $$$c_i$$$ coins for all such $$$i$$$ that $$$a_i = b_i$$$.Your task is to determine the maximum number of coins that you can receive by performing no more than $$$k$$$ operations.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 10^3; 0 \le k \le 10^6$$$) — the size of the array and the maximum number of operations, respectively. The second line contains $$$n$$$ integers $$$b_1, b_2, \dots, b_n$$$ ($$$1 \le b_i \le 10^3$$$). The third line contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 10^6$$$). The sum of $$$n$$$ over all test cases does not exceed $$$10^3$$$.

For each test case, print one integer — the maximum number of coins that you can get by performing no more than $$$k$$$ operations.

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
    const dp = Array(1001).fill(Infinity)
    dp[1] = 0
    for (let i = 1; i <= 1000; i++) {
        for (let j = 1; j <= i; j++) {
            const d = Math.floor(i / j)
            if (d <= 0) break
            const other = i + d
            if (other < dp.length) {
                dp[other] = Math.min(dp[other], dp[i] + 1)
            }
        }
    }
    // console.log(dp.join(','))
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 arr = lines[l++].trim().split(' ').map(Number)
        const c = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, k, arr, c)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, k, arr, c) {
// console.log(arr.map(x => dp[x]))
    let prev
    for (let i = 0; i < arr.length; i++) {
        const f = Array(12 * arr.length + 1).fill(0)
        const cost = dp[arr[i]]
        for (let j = 0; j <= 12 * arr.length; j++) {
            if (i) {
                f[j] = j < cost
                    ? prev[j] : Math.max(prev[j - cost] + c[i], prev[j])
            } else {
                f[j] = j < cost ? 0 : c[i]
            }
        }
        prev = f
// console.log(cost, c[i], prev)
    }
    return prev[Math.min(k, 12 * arr.length)]
}

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

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

const N = 1001;

function countSetBits (n) {
	let cnt = 0;
	for (let i = 0; i < 10; i++) {
		cnt += (n & 1 << i) > 0;
	}
	return cnt;
}

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

		const d = Array(N).fill(100);
		d[1] = 0;
		for (let i = 1; i < N; i++) {
			for (let x = 1; x <= i; x++) {
				const nxt = i + Math.floor(i/x);
				if (nxt < N) {
					d[nxt] = Math.min(d[nxt], d[i] + 1);
				}
			}
		}

		const w = [];
		for (let i = 0; i < n; i++) {
			w[i] = d[b[i]];
		}

		k = Math.min(k, 12*n);
		const dp = Array.from(Array(n+1), _ => Array(k+1).fill(0));
		for (let i = 1; i <= n; i++) {
			for (let j = 0; j <= k; j++) {
				dp[i][j] = dp[i-1][j];
				if (j - w[i-1] >= 0) {
					dp[i][j] = Math.max(dp[i][j], dp[i-1][j-w[i-1]] + c[i-1]);
				}
			}
		}

		console.log(dp[n][k]);
	}
}

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

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

const N = 1001;

function countSetBits (n) {
	let cnt = 0;
	for (let i = 0; i < 10; i++) {
		cnt += (n & 1 << i) > 0;
	}
	return cnt;
}

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

		const d = Array(N).fill(100);
		d[1] = 0;
		for (let i = 1; i < N; i++) {
			for (let x = 1; x <= i; x++) {
				const nxt = i + Math.floor(i/x);
				d[nxt] = Math.min(d[nxt], d[i] + 1);
			}
		}

		const w = [];
		for (let i = 0; i < n; i++) {
			w[i] = d[b[i]];
		}

		k = Math.min(k, 20000);
		const dp = Array.from(Array(n+1), _ => Array(k+1).fill(0));
		for (let i = 1; i <= n; i++) {
			for (let j = 0; j <= k; j++) {
				dp[i][j] = dp[i-1][j];
				if (j - w[i-1] >= 0) {
					dp[i][j] = Math.max(dp[i][j], dp[i-1][j-w[i-1]] + c[i-1]);
				}
			}
		}

		console.log(dp[n][k]);
	}
}

var lines = parseInt(readline());

var steps = new Array(1000);
steps[0] = 0;
for (var i = 1; i < 1000; i++) {
  if (steps[i - 1] != undefined) {
    var step = steps[i - 1];
    for (var j = 1; j <= i; j++) {
      var inc = Math.floor(i / j);
      if (
        i + inc - 1 < 1000 &&
        (steps[i + inc - 1] == undefined || steps[i + inc - 1] > step + 1)
      )
        steps[i + inc - 1] = step + 1;
    }
  }
}

for (var i = 0; i < lines; i++) {
  var line = readline().split(" ");
  var n = parseInt(line[0]);
  var k = parseInt(line[1]);
  var b = readline()
    .split(" ")
    .map((i) => parseInt(i));
  var c = readline()
    .split(" ")
    .map((i) => parseInt(i));

  var weights = [];
  for (var j = 0; j < b.length; j++) {
    weights.push([c[j], steps[b[j] - 1]]);
  }

  weights.sort((a, b) => b[0] / (b[1] + 0.00001) - a[0] / (a[1] + 0.00001));
  var dict = {};
  print(best(dict, weights, k, 0));
}

function best(dict, w, k, i, opt) {
  if (i >= w.length) return 0;
  if (dict[k + "," + i] != undefined) return dict[k + "," + i];
  var take = 0;
  opt = opt || 0;
  if (w[i][1] <= k)
    take = best(dict, w, k - w[i][1], i + 1, opt - w[i][0]) + w[i][0];
  if (opt > take) console.log(take, opt);
  take = Math.max(take, opt);
  if (w[i][1] == 0) {
    dict[k + "," + i] = take;
    return take;
  }

  var bestSub = 0;
  var kTemp = k;
  for (var j = i + 1; j < w.length && kTemp > 0; j++) {
    if (kTemp >= w[j][1]) bestSub += w[j][0];
    else bestSub += Math.floor((kTemp * w[j][0]) / w[j][1], take);
    kTemp -= w[j][1];
  }
  if (bestSub <= take) {
    dict[k + "," + i] = take;
    return take;
  }

  take = Math.max(best(dict, w, k, i + 1), take);
  dict[k + "," + i] = take;
  return take;
}

var pre=[];
for(var i=0;i<=2000;i++){
    pre[i]=10000000;
}
pre[0]=0;
pre[1]=0;

for(var i=1;i<=1000;i++){
    for(var j=1;j<=1000;j++){
        var next=i+Math.floor(i/j);
        pre[next]= Math.min(pre[next],pre[i]+1);
    }
}

var t=readline();
while(t--){
    var temp=readline().split(" ").map(x => parseInt(x));
    var n=temp[0];
    var k=temp[1];

    var brr=readline().split(" ").map(x => parseInt(x));
    var crr=readline().split(" ").map(x => parseInt(x));

    for(var i=0;i<n;i++){
        brr[i]=pre[brr[i]];
    }
    k=Math.min(k,brr.reduce((a, b) => a + b, 0));
    var dp=[];
    for(var i=0;i<=k;i++){
        dp[i]=0;
    }

    for(var i=0;i<n;i++){
        for(var j=k;j>=brr[i];j--){
            dp[j]=Math.max(dp[j],crr[i]+dp[j-brr[i]]);
        }
    }
    print(dp[k]);

}

var pre=[];
for(var i=0;i<=2000;i++){
    pre[i]=10000000;
}
pre[0]=0;
pre[1]=0;

for(var i=1;i<=1000;i++){
    for(var j=1;j<=1000;j++){
        var next=i+Math.floor(i/j);
        pre[next]= Math.min(pre[next],pre[i]+1);
    }
}

var t=readline();
while(t-- >0){
    var temp=readline().split(" ").map(x => parseInt(x));
    var n=temp[0];
    var k=temp[1];
    k=Math.min(k,15000);
    var brr=readline().split(" ").map(x => parseInt(x));
    var crr=readline().split(" ").map(x => parseInt(x));

    for(var i=0;i<n;i++){
        brr[i]=pre[brr[i]];
    }
    var dp=[];
    for(var i=0;i<=k;i++){
        dp[i]=0;
    }

    for(var i=0;i<n;i++){
        for(var j=k;j>=brr[i];j--){
            dp[j]=Math.max(dp[j],crr[i]+dp[j-brr[i]]);
        }
    }
    print(dp[k]);

}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
    const dp = Array(1001).fill(Infinity)
    dp[1] = 0
    for (let i = 1; i <= 1000; i++) {
        for (let j = 1; j <= i; j++) {
            const d = Math.floor(i / j)
            if (d <= 0) break
            const other = i + d
            if (other < dp.length) {
                dp[other] = Math.min(dp[other], dp[i] + 1)
            }
        }
    }
    // console.log(dp.join(','))
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 arr = lines[l++].trim().split(' ').map(Number)
        const c = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, k, arr, c)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, k, arr, c) {
// console.log(arr.map(x => dp[x]))
    let prev
    for (let i = 0; i < arr.length; i++) {
        const f = Array(12 * arr.length + 1).fill(0)
        const cost = dp[arr[i]]
        for (let j = 0; j <= 12 * arr.length; j++) {
            if (i) {
                f[j] = j < cost
                    ? prev[j] : Math.max(prev[j - cost] + c[i], prev[j])
            } else {
                f[j] = j < cost ? 0 : c[i]
            }
        }
        prev = f
// console.log(cost, c[i], prev)
    }
    return prev[k]
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
    const dp = Array(1001).fill(Infinity)
    dp[1] = 0
    for (let i = 1; i <= 1000; i++) {
        for (let j = 1; j <= i; j++) {
            const d = Math.floor(i / j)
            if (d <= 0) break
            const other = i + d
            dp[other] = Math.min(dp[other], dp[i] + 1)
        }
    }
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 arr = lines[l++].trim().split(' ').map(Number)
        const c = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, k, arr, c)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, k, arr, c) {
    const sorted = arr.map((x, i) => ({ i, cost: dp[x], point: c[i] }))
        .sort((a, b) => {
            // p1 / c1 > p2 / c2
            return a.cost * b.point - b.cost * a.point
        })
// console.log(arr.map(x => dp[x]))
    let ans = 0
    let now = 0
    let i = 0
    while (now < k && i < sorted.length) {
        if (now + sorted[i].cost <= k) {
            now += sorted[i].cost
            ans += sorted[i].point
        }
        i++
    }
    return ans
}

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 = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const str = lines[l++]
        output[i] = solve(n, str)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, str) {
    let now = { val: 0 }
    let head = now
    for (let i = 0; i < str.length; i++) {
        const item = { val: i + 1 }
        if (str[i] === 'L') {
            if (now.prev) {
                now.prev.next = item
                item.prev = now.prev
                item.next = now
                now.prev = item
            } else {
                now.prev = item
                item.next = now
                head = item
            }
        } else {
            if (now.next) {
                now.next.prev = item
                item.next = now.next
                now.next = item
                item.prev = now
            } else {
                now.next = item
                item.prev = now
            }
        }
        now = item
    }
    const ans = Array(str.length)
    let p = 0
    while (head) {
        ans[p++] = head.val
        head = head.next
    }
    // const ans = [0]
    // let p = 0
    // for (let i = 0; i < str.length; i++) {
    //     if (str[i] === 'L') {
    //         ans.splice(p, 0, i + 1)
    //     } else {
    //         ans.splice(p + 1, 0, i + 1)
    //         p = p + 1
    //     }
    // }
    return ans.join(' ')
}

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

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

function countSetBits (n) {
	let cnt = 0;
	for (let i = 0; i < 10; i++) {
		cnt += (n & 1 << i) > 0;
	}
	return cnt;
}

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

		const w = [];
		for (let i = 0; i < n; i++) {
			w[i] = Math.floor(Math.log2(b[i])) + countSetBits(b[i]) - 1;
			//console.log({i}, b[i], w[i], countSetBits(b[i]));
		}

		k = Math.min(20000, k);
		const dp = Array.from(Array(n+1), _ => Array(k+1).fill(0));
		for (let i = 1; i <= n; i++) {
			for (let j = 0; j <= k; j++) {
				dp[i][j] = dp[i-1][j];
				if (j - w[i-1] >= 0) {
					dp[i][j] = Math.max(dp[i][j], dp[i-1][j-w[i-1]] + c[i-1]);
				}
			}
		}

		console.log(dp[n][k]);
	}
}

var lines = parseInt(readline());

var steps = new Array(1000);
steps[0] = 0;
for (var i = 1; i < 1000; i++) {
  if (steps[i - 1] != undefined) {
    var step = steps[i - 1];
    for (var j = 1; j <= i; j++) {
      var inc = Math.floor(i / j);
      if (
        i + inc - 1 < 1000 &&
        (steps[i + inc - 1] == undefined || steps[i + inc - 1] > step + 1)
      )
        steps[i + inc - 1] = step + 1;
    }
  }
}

for (var i = 0; i < lines; i++) {
  var line = readline().split(" ");
  var n = parseInt(line[0]);
  var k = parseInt(line[1]);
  var b = readline()
    .split(" ")
    .map((i) => parseInt(i));
  var c = readline()
    .split(" ")
    .map((i) => parseInt(i));

  var weights = [];
  for (var j = 0; j < b.length; j++) {
    weights.push([c[j], steps[b[j] - 1]]);
  }

  weights.sort((a, b) => b[0] / (b[1] + 0.00001) - a[0] / (a[1] + 0.00001));
  print(best(weights, k, 0));
}

function best(w, k, i) {
  if (i >= w.length) return 0;
  var take = 0;
  if (w[i][1] <= k) take = best(w, k - w[i][1], i + 1) + w[i][0];
  if (w[i][1] == 0) return take;

  var bestSub = 0;
  var kTemp = k;
  for (var j = i + 1; j < w.length && kTemp > 0; j++) {
    if (kTemp >= w[j][1]) bestSub += w[j][0];
    else bestSub += Math.ceil(w[j][0] / w[j][1]);
    kTemp -= w[j][1];
  }
  if (bestSub <= take) return take;
  return Math.max(best(w, k, i + 1), take);
}

var lines = parseInt(readline());

var steps = new Array(1000);
steps[0] = 0;
for (var i = 1; i < 1000; i++) {
  if (steps[i - 1] != undefined) {
    var step = steps[i - 1];
    for (var j = 1; j <= i; j++) {
      var inc = Math.floor(i / j);
      if (
        i + inc - 1 < 1000 &&
        (steps[i + inc - 1] == undefined || steps[i + inc - 1] > step + 1)
      )
        steps[i + inc - 1] = step + 1;
    }
  }
}

for (var i = 0; i < lines; i++) {
  var line = readline().split(" ");
  var n = parseInt(line[0]);
  var k = parseInt(line[1]);
  var b = readline()
    .split(" ")
    .map((i) => parseInt(i));
  var c = readline()
    .split(" ")
    .map((i) => parseInt(i));

  var weights = [];
  for (var j = 0; j < b.length; j++) {
    weights.push([c[j], steps[b[j] - 1]]);
  }

  weights.sort((a, b) => b[0] / (b[1] + 0.00001) - a[0] / (a[1] + 0.00001));
  print(best(weights, k, 0));
}

function best(w, k, i) {
  if (i >= w.length || k == 0) return 0;
  var take = 0;
  if (w[i][1] <= k) take = best(w, k - w[i][1], i + 1) + w[i][0];
  if (
    w[i][1] == 0 ||
    (i < w.length - 2 && k > w[i + 1][1] + w[i + 2][1]) ||
    w.reduce((a, b) => a + b[1], 0) <= k
  )
    return take;
  var bestSub = 0;
  var kTemp = k;
  for (var j = i + 1; j < w.length && kTemp > 0; j++) {
    bestSub += w[j][0];
    kTemp -= w[j][1];
  }
  if (bestSub <= take) return take;
  return Math.max(best(w, k, i + 1), take);
}


The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four cells adjacent by side.Each cell has one of the symbols 'L', 'R', 'D' or 'U' written on it, indicating the direction in which the robot will move when it gets in that cell — left, right, down or up, respectively.The robot can start its movement in any cell. He then moves to the adjacent square in the direction indicated on the current square in one move.   If the robot moves beyond the edge of the board, it falls and breaks.  If the robot appears in the cell it already visited before, it breaks (it stops and doesn't move anymore). Robot can choose any cell as the starting cell. Its goal is to make the maximum number of steps before it breaks or stops.Determine from which square the robot should start its movement in order to execute as many commands as possible. A command is considered successfully completed if the robot has moved from the square on which that command was written (it does not matter whether to another square or beyond the edge of the board).

The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line followed by $$$n$$$ lines, the $$$i$$$-th of which describes the $$$i$$$-th line of the board. Each of them is exactly $$$m$$$ letters long and consists of symbols 'L', 'R', 'D' and 'U'. It is guaranteed that the sum of sizes of all boards in the input does not exceed $$$4\cdot10^6$$$.

For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.

7

1 1
R

1 3
RRL

2 2
DL
RU

2 2
UD
RU

3 2
DL
UL
RU

4 4
RRRD
RUUD
URUD
ULLR

4 4
DDLU
RDDU
UUUU
RDLD

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INF = Number.MAX_SAFE_INTEGER;
const INIT = -1;
let n;
let m;
let adj;
let doom;
let dist;
function at(i, j) {
    return i * m + j;
}
function f(s) {
    if (dist[s] != 0) {
        return dist[s];
    }
    let path = [];
    let depth = -1;
    let u = s;
    do {
        dist[u] = depth--;
        path.push(u);
        u = adj[u];
    } while (u != doom && dist[u] == 0);
    //  printf("path %j\n", path);
    let start = 1;
    if (u != doom) {
        if (dist[u] < 0) { // same s
            let cycle = dist[u] - depth;
            //      printf("cycle %d\n", cycle);
            let v = INIT;
            for (let i = 0; i < cycle; i++) {
                v = path.pop();
                dist[v] = cycle;
            }
            check(v == u);
        }
        start += dist[u];
    }
    //  printf("path %j start %d\n", path, start);
    while (path.length > 0) {
        let v = path.pop();
        dist[v] = start++;
    }
    return dist[s];
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        m = nextInt();
        adj = new Int32Array(n * m + 1);
        doom = n * m;
        for (let i = 0; i < n; i++) {
            let s = nextStr();
            for (let j = 0; j < m; j++) {
                let ni = i;
                let nj = j;
                switch (s[j]) {
                    case 'L':
                        nj--;
                        break;
                    case 'R':
                        nj++;
                        break;
                    case 'U':
                        ni--;
                        break;
                    case 'D':
                        ni++;
                        break;
                }
                if (ni < 0 || ni >= n || nj < 0 || nj >= m) {
                    adj[at(i, j)] = doom;
                }
                else {
                    adj[at(i, j)] = at(ni, nj);
                }
            }
        }
        dist = new Int32Array(n * m + 1).fill(0);
        let best = 0;
        let ans = INIT;
        for (let u = 0; u < n * m; u++) {
            let rv = f(u);
            if (best < rv) {
                best = rv;
                ans = u;
            }
        }
        printf("%d %d %d\n", Math.floor(ans / m) + 1, ans % m + 1, best);
    }
}


On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some strange rules. It contains n different items numbered from 1 to n. The i-th item has base cost ai Egyptian pounds. If Sagheer buys k items with indices x1, x2, ..., xk, then the cost of item xj is axj + xj·k for 1 ≤ j ≤ k. In other words, the cost of an item is equal to its base cost in addition to its index multiplied by the factor k.Sagheer wants to buy as many souvenirs as possible without paying more than S Egyptian pounds. Note that he cannot buy a souvenir more than once. If there are many ways to maximize the number of souvenirs, he will choose the way that will minimize the total cost. Can you help him with this task?

The first line contains two integers n and S (1 ≤ n ≤ 105 and 1 ≤ S ≤ 109) — the number of souvenirs in the market and Sagheer's budget. The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 105) — the base costs of the souvenirs.

On a single line, print two integers k, T — the maximum number of souvenirs Sagheer can buy and the minimum total cost to buy these k souvenirs.

NoteIn the first example, he cannot take the three items because they will cost him [5, 9, 14] with total cost 28. If he decides to take only two items, then the costs will be [4, 7, 11]. So he can afford the first and second items.In the second example, he can buy all items as they will cost him [5, 10, 17, 22].In the third example, there is only one souvenir in the market which will cost him 8 pounds, so he cannot buy it.

function cmp(a,b)
{
    return a-b;
}

var s=readline().split(' ')
var n=+s[0]
var budget=+s[1]
var a=readline().split(' ').map(function(x){return +x;})
var l=0;
var r=n+1;
if (r>1261){r=1261;}
var x=0;
while(l+1<r)
{
    var m=(l+r);
    if (m%2==0){m/=2;}
    else{m=(m-1)/2;}
    var dubler=[];
    for (var i=0;i<n;i++)
    {
        dubler.push(a[i]+(i+1)*m);
    }
    dubler.sort(cmp);
    var sm=0;
    for (var i=0;i<m;i++)
    {
        sm+=dubler[i];
    }
    if (sm<=budget)
    {
        l=m;
        x=sm;
    }
    else
    {
        r=m;
    }
}
print(l+' '+x)

var str = readline().split(" ").map(x=>+x);
var n = str[0];
var S = str[1];
var arr = readline().split(" ").map(x=>+x);
var sum = [];
var ans =0;

var l=0,r=n;
while(l != r){
	var mid = (l+r+1)>>1;
	var ret = 0;
	for(var i = 0; i < n; i++){
		sum[i] = arr[i]+mid*(i+1);
	}
	sum.sort(cmp);
	for(var i=0; i < mid; i++){
		ret += sum[i];
	}
	if(ret <= S){
		l = mid;
		ans = ret;
	}
	else r = mid-1;
}
print(l+" "+ans);
function cmp(value1, value2){
	return value1-value2;
}

var ns = readline().trim().split(' ').map((x)=>parseInt(x))
var n=ns[0],s=ns[1];
var a =readline().trim().split(' ').map((x,i)=>[parseInt(x),i+1])

var k=1;
var somme=0;
var maxi=0;
var maxiK=0;
var l=1,r=n;
while(l<=r){
    k=parseInt((l+r)/2)
    somme=0;
    a.sort((_a,_b)=>(_a[0]+k*_a[1])-(_b[0]+k*_b[1]))

    for(var i=0;i<n;i++){
        if(i<k)
        somme+=a[i][0]+k*a[i][1]
    }

    if(somme>s){
        r=k-1;
    }else{
        maxi=somme;
        maxiK=k;
        l = k+1;
    }

}
print(maxiK,maxi)

var arr = readline().split(' ');
var n = parseInt(arr[0]);
var s = parseInt(arr[1]);
var smax = 0;
var v = [];
var arr = readline().split(' ');
var maxpossible = 0;
for (var i = 0; i < n; i ++)
{
    var val = parseInt(arr[i]);
    maxpossible += val + n*(i+1);
    v.push(val);
}
smax = Math.min(s,maxpossible);

var vs = Array(n);
var solve = function(k)
{
    for (var i = 0; i < n; i ++)
    {
        vs[i]=(v[i] + (i+1)*k);
    }
    vs.sort(function(a,b){return a-b;});
    // print(vs);
    var mins = 0;
    for (var i = 0; i < k; i ++)
    {
        mins += vs[i];
    }
    return mins;
}
var maxk = {};
var low = 0;
var up = n;
while(true)
{
    var k = parseInt((low+up)/2);
    var val = solve(k);
    // print(low,k,up);
    //print(k, val);
    if (val <= s)
    {
        maxk[k] = val;
    }
    if (up-low == 0)
    {
        k = 0;
        for(var key in maxk)
        {
            if (parseInt(key) >= k)
            {
            // print(key, maxk[key]);
                k = key;
                val = maxk[k];
            }
        }
        print(k, val);
        break;
    }

    if (val <= s)
    {
        low = k;
        if (up-low==1)
        {
            low ++
        }
    }
    else
    {
        up = k;
    }
}

var ns = readline().trim().split(' ').map((x)=>parseInt(x))
var n=ns[0],s=ns[1];
var a =readline().trim().split(' ').map((x,i)=>[parseInt(x),i+1])

var k=1;
var somme;
var maxi=0;
var maxiK=0;

a.sort((_a,_b)=>(_a[0]+_a[1])-(_b[0]+_b[1]))
while(k<=n){
    somme=0;
    var minDiff = 0;

    for(var i=0;i<n;i++){
        if(i<k)
            somme+=a[i][0]+k*a[i][1]

        if(i>0){
            if((a[i][0]+(k+1)*a[i][1] -(a[i-1][0]+(k+1)*a[i-1][1]))<0){
               var x = [a[i][0],a[i][1]];
               a[i]=[a[i-1][0],a[i-1][1]];
               a[i-1]=x;
            }
        }
    }
    if(somme>s)
    break

    maxi=somme
    maxiK=k
    if(somme==s)
    break;
    k++;
}
print(maxiK,maxi)

var ns = readline().trim().split(' ').map((x)=>parseInt(x))
var n=ns[0],s=ns[1];
var a =readline().trim().split(' ').map((x,i)=>[parseInt(x),i+1])

var k=1;
var somme;
var maxi=0;
var maxiK=0;
var need = true
while(k<=n){
    somme=0;
    var minDiff = 0;
    if(need)
        a.sort((_a,_b)=>(_a[0]+k*_a[1])-(_b[0]+k*_b[1]))

    need = false
    for(var i=0;i<n;i++){
        if(i>0){
            if((a[i][0]+k*a[i][1] -(a[i-1][0]+k*a[i-1][1]))<0){
                need = true
            }
        }
        if(i<k)
        somme+=a[i][0]+k*a[i][1]
    }
    if(somme>s)
    break

    maxi=somme
    maxiK=k
    if(somme==s)
    break;
    k++;
}
print(maxiK,maxi)

var ns = readline().trim().split(' ').map((x)=>parseInt(x))
var n=ns[0],s=ns[1];
var a =readline().trim().split(' ').map((x,i)=>[parseInt(x),i+1])

var k=1;
var somme;
var maxi=0;
var maxiK=0;
var need = true
while(k<=n){
    somme=0;
    var minDiff = 0;
    if(need)
        a.sort((_a,_b)=>(_a[0]+k*_a[1])-(_b[0]+k*_b[1]))

    need = false
    for(var i=0;i<n;i++){
        if(i>0){
            if((a[i][0]+k*a[i][1] -(a[i-1][0]+k*a[i-1][1]))<0){
                need = true
            }
        }
        if(i<k)
        somme+=a[i][0]+k*a[i][1]
    }
    if(somme>=s)
    break
    maxi=somme
    maxiK=k
    k++;
}
print(maxiK,maxi)

var ns = readline().trim().split(' ').map((x)=>parseInt(x))
var n=ns[0],s=ns[1];
var a =readline().trim().split(' ').map((x,i)=>[parseInt(x),i+1])

var k=1;
var somme;
var maxi=0;
var maxiK=0;
var need = true
while(k<=n){
    somme=0;
    var minDiff = 0;
    if(need)
        a.sort((_a,_b)=>(_a[0]+k*_a[1])-(_b[0]+k*_b[1]))

    need = false
    for(var i=0;i<n;i++){
        if(i>0){
            if((a[i][0]+k*a[i][1] -(a[i-1][0]+k*a[i-1][1]))<0){
                need = true
            }
        }
        if(i<k)
        somme+=a[i][0]+k*a[i][1]
    }
    if(somme>s)
    break
    maxi=somme
    maxiK=k
    k++;
}
print(maxiK,maxi)

var arr = readline().split(' ');
var n = parseInt(arr[0]);
var s = parseInt(arr[1]);
var smax = 0;
var v = [];
var arr = readline().split(' ');
var maxpossible = 0;
for (var i = 0; i < n; i ++)
{
    var val = parseInt(arr[i]);
    maxpossible += val + n*(i+1);
    v.push(val);
}
smax = Math.min(s,maxpossible);
var tried = {};
var k = 0;
var lastK = 0;
while (true)
{
    // print("trying "+k);
    var dp = Array(smax+1).fill(0);
    var dps = Array(smax+1).fill(0);
    for (var i = 0; i < n; i ++)
    {
        var vi = v[i] + (i+1)*k;
        for (var j = smax; j >= vi; j --)
        {
            dp[j] = Math.max(dp[j], dp[j-vi] + 1);
            dps[j] = Math.max(dps[j], dps[j-vi] + vi);
        }
    }
    // print(dp[smax]);
    // print(JSON.stringify(dp));
    if (k == dp[smax] || (tried[k] && k > dp[smax]))
    {
        print(dp[smax],dps[smax]);
        break;
    }
    tried[k] = true;
    var kk = k;
    k = parseInt((lastK + dp[smax])/2);//k+1;//dp[n][s];
    if (kk == k)
    {
        k ++;
    }
    lastK = kk;
}
// v.sort(function(a,b){return b-a;});

var arr = readline().split(' ');
var n = parseInt(arr[0]);
var s = parseInt(arr[1]);
var smax = 0;
var v = [];
var arr = readline().split(' ');
var maxpossible = 0;
for (var i = 0; i < n; i ++)
{
    var val = parseInt(arr[i]);
    maxpossible += val + n*(i+1);
    v.push(val);
}
smax = Math.min(s,maxpossible);

var vs = Array(n);
var solve = function(k)
{
    for (var i = 0; i < n; i ++)
    {
        vs[i]=(v[i] + (i+1)*k);
    }
    vs.sort(function(a,b){return a-b;});
    // print(vs);
    var mins = 0;
    for (var i = 0; i < k; i ++)
    {
        mins += vs[i];
    }
    return mins;
}
var maxk = {};
var low = 0;
var up = n;
while(true)
{
    var k = parseInt((low+up)/2);
    var val = solve(k);
    // print(low,k,up);
    if (val <= smax)
    {
        maxk[k] = val;
    }
    if (up-low == 0)
    {
        k = 0;
        for(var key in maxk)
        {
            if (key >= k)
            {
                k = key;
                val = maxk[k];
            }
        }
        print(k, val);
        break;
    }

    if (val <= smax)
    {
        low = k;
        if (up-low==1)
        {
            low ++
        }
    }
    else
    {
        up = k;
    }
}

var arr = readline().split(' ');
var n = parseInt(arr[0]);
var s = parseInt(arr[1]);
var smax = 0;
var v = [];
var arr = readline().split(' ');
var maxpossible = 0;
for (var i = 0; i < n; i ++)
{
    var val = parseInt(arr[i]);
    maxpossible += val + n*(i+1);
    v.push(val);
}
smax = Math.min(s,maxpossible);

var vs = Array(n);
var solve = function(k)
{
    for (var i = 0; i < n; i ++)
    {
        vs[i]=(v[i] + (i+1)*k);
    }
    vs.sort(function(a,b){return a-b;});
    // print(vs);
    var mins = 0;
    for (var i = 0; i < k; i ++)
    {
        mins += vs[i];
    }
    return mins;
}
var maxk = {};
var low = 0;
var up = n;
while(true)
{
    var k = parseInt((low+up)/2);
    var val = solve(k);
    // print(low,k,up);
    if (val <= s)
    {
        maxk[k] = val;
    }
    if (up-low == 0)
    {
        k = 0;
        for(var key in maxk)
        {
            if (key >= k)
            {
                k = key;
                val = maxk[k];
            }
        }
        print(k, val);
        break;
    }

    if (val <= s)
    {
        low = k;
        if (up-low==1)
        {
            low ++
        }
    }
    else
    {
        up = k;
    }
}

var arr = readline().split(' ');
var n = parseInt(arr[0]);
var s = parseInt(arr[1]);
var smax = 0;
var v = [];
var arr = readline().split(' ');
var maxpossible = 0;
for (var i = 0; i < n; i ++)
{
    var val = parseInt(arr[i]);
    maxpossible += val + n*(i+1);
    v.push(val);
}
smax = Math.min(s,maxpossible);

var vs = Array(n);
var solve = function(k)
{
    for (var i = 0; i < n; i ++)
    {
        vs[i]=(v[i] + (i+1)*k);
    }
    vs.sort(function(a,b){return a-b;});
    // print(vs);
    var mins = 0;
    for (var i = 0; i < k; i ++)
    {
        mins += vs[i];
    }
    return mins;
}
var maxk = {};
var low = 0;
var up = n;
var count = 0;
while(true)
{
    var k = parseInt((low+up)/2);
    var val = solve(k);
    // print(low,k,up);
    count ++;
    if (val <= smax)
    {
        maxk[k] = val;
    }
    if (up-low == 0)
    {
        k = 0;
        for(var key in maxk)
        {
            if (key > k)
            {
                k = key;
                val = maxk[k];
            }
        }
        print(k, val);
        break;
    }

    if (val <= smax)
    {
        low = k;
        if (up-low==1)
        {
         low ++
        }
    }
    else
    {
        up = k;
    }
}

var arr = readline().split(' ');
var n = parseInt(arr[0]);
var s = parseInt(arr[1]);
var smax = 0;
var v = [];
// var arr = readline().split(' ');
var maxpossible = 0;
for (var i = 0; i < n; i ++)
{
    var val = 100000;//parseInt(arr[i]);
    maxpossible += val + n*(i+1);
    v.push(val);
}
smax = Math.min(s,maxpossible);

var vs = Array(n);
var solve = function(k)
{
    for (var i = 0; i < n; i ++)
    {
        vs[i]=(v[i] + (i+1)*k);
    }
    vs.sort(function(a,b){return a-b;});
    // print(vs);
    var mins = 0;
    for (var i = 0; i < k; i ++)
    {
        mins += vs[i];
    }
    return mins;
}
var maxk = {};
var low = 0;
var up = n;
while(true)
{
    var k = parseInt((low+up)/2);
    var val = solve(k);
    // print(low,k,up);
    //print(k, val);
    if (val <= s)
    {
        maxk[k] = val;
    }
    if (up-low == 0)
    {
        k = 0;
        for(var key in maxk)
        {
            if (parseInt(key) >= k)
            {
            // print(key, maxk[key]);
                k = key;
                val = maxk[k];
            }
        }
        print(k, val);
        break;
    }

    if (val <= s)
    {
        low = k;
        if (up-low==1)
        {
            low ++
        }
    }
    else
    {
        up = k;
    }
}


There is a special offer in Vasya's favourite supermarket: if the customer buys $$$a$$$ chocolate bars, he or she may take $$$b$$$ additional bars for free. This special offer can be used any number of times.Vasya currently has $$$s$$$ roubles, and he wants to get as many chocolate bars for free. Each chocolate bar costs $$$c$$$ roubles. Help Vasya to calculate the maximum possible number of chocolate bars he can get!

The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of testcases. Each of the next $$$t$$$ lines contains four integers $$$s, a, b, c~(1 \le s, a, b, c \le 10^9)$$$ — the number of roubles Vasya has, the number of chocolate bars you have to buy to use the special offer, the number of bars you get for free, and the cost of one bar, respectively.

Print $$$t$$$ lines. $$$i$$$-th line should contain the maximum possible number of chocolate bars Vasya can get in $$$i$$$-th test.

NoteIn the first test of the example Vasya can buy $$$9$$$ bars, get $$$3$$$ for free, buy another bar, and so he will get $$$13$$$ bars.In the second test Vasya buys $$$1000000000$$$ bars and gets $$$1000000000000000000$$$ for free. So he has $$$1000000001000000000$$$ bars.

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

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

  let [s, a, b, c] = d.split(' ').map(BigInt);
  let choco = s / c;
  let freeChoco = choco / a * b;
  let ans = choco + freeChoco;

  console.log(ans.toString());

  count++;
});


Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy as it sounds: the question Vladik face now is to find the cheapest way to get to the olympiad.Vladik knows n airports. All the airports are located on a straight line. Each airport has unique id from 1 to n, Vladik's house is situated next to the airport with id a, and the place of the olympiad is situated next to the airport with id b. It is possible that Vladik's house and the place of the olympiad are located near the same airport. To get to the olympiad, Vladik can fly between any pair of airports any number of times, but he has to start his route at the airport a and finish it at the airport b.Each airport belongs to one of two companies. The cost of flight from the airport i to the airport j is zero if both airports belong to the same company, and |i - j| if they belong to different companies.Print the minimum cost Vladik has to pay to get to the olympiad.

The first line contains three integers n, a, and b (1 ≤ n ≤ 105, 1 ≤ a, b ≤ n) — the number of airports, the id of the airport from which Vladik starts his route and the id of the airport which he has to reach.  The second line contains a string with length n, which consists only of characters 0 and 1. If the i-th character in this string is 0, then i-th airport belongs to first company, otherwise it belongs to the second.

Print single integer — the minimum cost Vladik has to pay to get to the olympiad.

NoteIn the first example Vladik can fly to the airport 2 at first and pay |1 - 2| = 1 (because the airports belong to different companies), and then fly from the airport 2 to the airport 4 for free (because the airports belong to the same company). So the cost of the whole flight is equal to 1. It's impossible to get to the olympiad for free, so the answer is equal to 1. In the second example Vladik can fly directly from the airport 5 to the airport 2, because they belong to the same company.

function ansa(n,a,b,s){

  a -= 1;
  b -= 1;

  print(((s[a] - '0') ^ (s[b] - '0')));

}

var line = readline().split(' ');
for(var i = 0 ; i < line.length ; i++) line[i] = parseInt(line[i]);

var str  = readline();

ansa(line[0],line[1],line[2],str);

function main() {

    var arr = readline().split(' ').map(Number);
    var n = arr[0];
    var home = arr[1];
    var olympiad = arr[2];

    var airports = readline();

    if(airports[home - 1] == airports[olympiad - 1]) {
        print(0);
    }else {
        print(1);
    }

}

main();

var functionVadic = function(str, b, e)
    {
        if (str[b] === str[e]) return 0;
        else return 1;
    }
var input1 = readline();
var input2 = readline();
input1 = input1.split(' ');
print(functionVadic(input2, +input1[1] - 1, +input1[2] - 1));

function sa(a,b,data){

       if(data[a] == data[b]){
        return 0;
    } else {
        return 1;
    }

    }

    var f = readline().split(" ").map(Number);
    var n = f[0];
    var a = f[1]-1;
    var b = f[2]-1;
    var data = readline();

    print(sa(a,b,data));

var minCost = function(airports, a, b) {
  if ( airports[ a ] === airports[ b ] ) {
    return 0;
  } else {
    return 1;
  }
}

var input = readline().split( " " ).map( i => parseInt( i, 10 ) );
var a = input[ 1 ] - 1;
var b = input[ 2 ] - 1;
var airports = readline().split( "" );
print( minCost( airports, a, b) );

function main() {

    var arr = readline().split(' ').map(Number);
    var n = arr[0];
    var home = arr[1];
    var olympiad = arr[2];

    var airports = readline();

    if(airports[home - 1] == airports[olympiad - 1]){
        print(0);
    }else {
        if (home == olympiad) {
            print(0);
        } else if (home < olympiad) {

            for (var i = home; i < olympiad; i++) {
                if (airports[i] == airports[home - 1]) {
                    continue;
                }
                if (airports[i] != airports[home - 1]) {
                    print(i - (home - 1));
                    break;
                }
            }
        } else if(home > olympiad){
            for (var i = olympiad; i < home; i++) {
                if (airports[i] == airports[olympiad - 1]) {
                    continue;
                }
                if (airports[i] != airports[olympiad - 1]) {
                    print(i - (olympiad - 1));
                    break;
                }
            }
        }
    }

}

main();

function main() {

    var arr = readline().split(' ').map(Number);
    var n = arr[0];
    var home = arr[1];
    var olympiad = arr[2];

    var airports = readline();

    var r_route,
        l_route;

    var nr_route,
        nl_route,
        route;

    if(airports[home - 1] == airports[olympiad - 1]){
        print(0);
    }else {
        if (home == olympiad) {
            print(0);
        } else {
            for(var i = home;i<n;i++){
                if (airports[i] == airports[home - 1]) {
                    continue;
                }
                if (airports[i] != airports[home - 1]) {
                    r_route = i - (home - 1);
                    break;
                }
            }

            for(var j = home-2;j>0;j--){
                if (airports[j] == airports[home - 1]) {
                    continue;
                }
                if (airports[j] != airports[home - 1]) {
                    l_route = (home - 1) - j;
                    break;
                }
            }

            nr_route = Number(r_route);
            nl_route = Number(l_route);
            route = Math.min(nr_route,nl_route);

            print(route);

        }
    }

}

main();

function main() {

    var arr = readline().split(' ').map(Number);
    var n = arr[0];
    var home = arr[1];
    var olympiad = arr[2];

    var airports = readline();

    var r_route,
        l_route;

    if(airports[home - 1] == airports[olympiad - 1]){
        print(0);
    }else {
        if (home == olympiad) {
            print(0);
        } else {
            for(var i = home;i<n;i++){
                if (airports[i] == airports[home - 1]) {
                    continue;
                }
                if (airports[i] != airports[home - 1]) {
                    r_route = i - (home - 1);
                    break;
                }
            }

            for(var j = home-2;j>0;j--){
                if (airports[j] == airports[home - 1]) {
                    continue;
                }
                if (airports[j] != airports[home - 1]) {
                    l_route = (home - 1) - j;
                    break;
                }
            }

            print(Math.min(r_route,l_route));

        }
    }

}

main();

function main() {

    var arr = readline().split(' ').map(Number);
    var n = arr[0];
    var home = arr[1];
    var olympiad = arr[2];

    var airports = readline();

    var r_route,
        l_route;

    if(airports[home - 1] == airports[olympiad - 1]){
        print(0);
    }else {
        if (home == olympiad) {
            print(0);
        } else {
            for(var i = home;i<n;i++){
                if (airports[i] == airports[home - 1]) {
                    continue;
                }
                if (airports[i] != airports[home - 1]) {
                    r_route = i - (home - 1);
                    break;
                }
            }

            for(var j = home-2;j>0;j--){
                if (airports[j] == airports[home - 1]) {
                    continue;
                }
                if (airports[j] != airports[home - 1]) {
                    l_route = (home - 1) - j;
                    break;
                }
            }

            print(Math.min(Number(r_route),Number(l_route)));

        }
    }

}

main();

function sa(a,b,data){

       if(data[a] == data[b]){
        return 0;
    } else {
        var g = Number.MAX_VALUE;
        var t = Number.MAX_VALUE;
        for(var i=1;i<data.length;i++){
            if(a-i >= 0 && data[a-i]!== data[a]){
                g= i;
                break;
            }
            if(a+i <data.length && data[a+i]!==data[a]){
                g= i;
                break;
            }
        }
        for(var i=1;i<data.length;i++){
            if(b-i >= 0 && data[b-i]!== data[b]){
                t= i;
                break;
            }
            if(b+i <data.length && data[b+i]!==data[b]){
                t= i;
                break;
            }
        }
        return Math.min(g,t);
    }

    }

    var f = readline().split(" ").map(Number);
    var n = f[0];
    var a = f[1]-1;
    var b = f[2]-1;
    var data = readline();

    print(sa(a,b,data));


Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime:  Find two consecutive characters in the string, such that the first of them equals "y", and the second one equals "x" and swap them. If there are several suitable pairs of characters, we choose the pair of characters that is located closer to the beginning of the string.  Find in the string two consecutive characters, such that the first of them equals "x" and the second one equals "y". Remove these characters from the string. If there are several suitable pairs of characters, we choose the pair of characters that is located closer to the beginning of the string. The input for the new algorithm is string s, and the algorithm works as follows:  If you can apply at least one of the described operations to the string, go to step 2 of the algorithm. Otherwise, stop executing the algorithm and print the current string.  If you can apply operation 1, then apply it. Otherwise, apply operation 2. After you apply the operation, go to step 1 of the algorithm. Now Vitaly wonders, what is going to be printed as the result of the algorithm's work, if the input receives string s.

The first line contains a non-empty string s.  It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string.

In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s.

NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this:  string "yxyxy" transforms into string "xyyxy";  string "xyyxy" transforms into string "xyxyy";  string "xyxyy" transforms into string "xxyyy";  string "xxyyy" transforms into string "xyy";  string "xyy" transforms into string "y". As a result, we've got string "y". In the third test case only one transformation will take place: string "xxxxxy" transforms into string "xxxx". Thus, the answer will be string "xxxx".

print(function(s) {
	var ans = [],
		j = 0;
	for (var i = 0, l = s.length; i < l; i++) {
		if (j === 0 || ans[j - 1] === s[i]) {
			ans.push(s[i]);
			j++;
		} else {
			ans.pop();
			j--;
		}
	}
	return ans.join('');
}(readline()));

print(function(s) {
	var q = [];
	for (var i = 0; i < s.length; i++) {
		if (s[i] === 'x' && s[i + 1] === 'y') {
			i++;
		} else if (q.length === 0 || q[q.length - 1] == s[i]) {
			q.push(s[i]);
		} else{
			q.pop();
		}
	}
	return q.join('');
}(readline()));

print(function(s) {
	s = s.replace(/xy/g, '');
	s = s.replace(/yx/g, '');
	return s;
}(readline()));