function main(input) { let [N, K] = getIntegers(input, " "); let dp = new Array(10e5).fill(0); let A = input.shift().split(" ").map(function(e) { let n = Number(e); dp[n]++; return n; }); let count = 0; for(let i=0; i= 0 ? dp[V] : 0); } console.log(count); } //-- functions ------------------------------------ function getIntegers(lines, sep) { if(sep === undefined) { return lines.map(function(e) { return Number(e); }); } else { return lines.shift().split(sep).map(function(e) { return Number(e); }); } } function getBigIntegers(lines, sep=" ") { return lines.shift().split(sep).map(function(e) { return BigInt(e); }); } function getStrings(lines, sep=" ") { return lines.shift().split(sep); } function twoDimenArrayByValue(h, w, value) { const list = new Array(h); for(let i=0; i { first -= 1; // 一番端の位置からさらにずらす while (last - first > 1) { const mid = first + Math.floor((last - first) / 2); if (arr[mid] < val) first = mid; else last = mid; } return last; } const upper_bound = (arr, val, first = 0, last = arr.length) => { first -= 1; while (last - first > 1) { const mid = first - Math.floor((last - first) / 2); if (arr[mid] <= val) // ココを直すだけ first = mid; else last = mid; } return last; } //-- Array ------------------------------------------- Array.prototype.deepCopy = function(list) { let retList = []; for(let i=0; i