const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
let limit = 999;
rl.on("line", line => {
input.push(line);
limit = +input[0];
if (input.length >= 2 && limit === input[1].split(" ").length) rl.close();
}).on("close", () => {
let temp = input[1].split(" ").map(v => +v);
let min = temp.reduce((prev, curr) => (prev < curr ? prev : curr));
let max = temp.reduce((prev, curr) => (prev > curr ? prev : curr));
console.log(min, max);
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on("line", line => {
input.push(+line);
if (input.length === 9) rl.close();
}).on("close", () => {
let answer = "";
let maxNumber = input.reduce((prev, curr) => (prev < curr ? curr : prev));
let maxIndex = input.indexOf(maxNumber) + 1;
answer = `${maxNumber}\n${maxIndex}`;
console.log(answer);
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on("line", line => {
input.push(+line);
if (input.length === 3) rl.close();
}).on("close", () => {
let answer = "";
const array = Array(10)
.fill()
.map(() => 0);
String(input.reduce((prev, curr) => prev * curr, 1))
.split("")
.forEach(v => array[v]++);
array.forEach(v => (answer += `${v}\n`));
console.log(answer);
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on("line", line => {
input.push(+line);
if (input.length === 10) rl.close();
}).on("close", () => {
const result = new Set(input.map(v => v % 42)).size;
console.log(result);
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on("line", line => {
input.push(line);
if (input.length === 2 && input[1].split(" ").length === +input[0]) rl.close();
}).on("close", () => {
const inputArray = input[1].split(" ").map(v => +v);
const maxScore = inputArray.reduce((prev, curr) => (prev < +curr ? +curr : prev), 0);
const avg = inputArray.reduce((prev, curr) => (curr / maxScore) * 100 + prev, 0) / inputArray.length;
console.log(avg);
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on("line", line => {
input.push(line);
if (input.length >= 2 && input.length - 1 === +input[0]) rl.close();
}).on("close", () => {
input.shift();
let answer = "";
let currentScore = 1;
let result = input.map(value => {
currentScore = 1;
return value.split("").reduce((prev, curr) => {
switch (curr) {
case "O":
return prev + currentScore++;
case "X":
currentScore = 1;
return prev;
}
}, 0);
});
result.forEach(v => (answer += `${v}\n`));
console.log(answer);
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on("line", line => {
input.push(line);
if (input.length >= 2 && input.length - 1 === +input[0]) rl.close();
}).on("close", () => {
input.shift();
let answer = "";
const inputArray = input.map(v => v.split(" ").slice(1));
const avgArray = inputArray.map(v => v.reduce((prev, curr) => prev + +curr, 0) / v.length);
const studentList = inputArray.map((value, i) => value.reduce((prev, curr) => (+curr > avgArray[i] ? prev + 1 : prev), 0) / value.length);
studentList.forEach(v => (answer += `${(v * 100).toFixed(3)}%\n`));
console.log(answer);
process.exit();
});