function solution(price, money, count) {
let total = 0
for(let i = 0; i < count+1; i++) {
total += price * i
}
if (money - total > 0 ) {
return 0
}
return Math.abs(money - total)
}
function solution(price, money, count) {
const tmp = price * count * (count + 1) / 2 - money;
return tmp > 0 ? tmp : 0;
}