Javascript Array Average Codeforces Practice