Time and Space Complexity: coding problems
Write a program that reads the input and prints the answer. Run checks it against every test, including hidden ones.
0 of 7 solved
Your friend wrote this loop and wants to know how many times the line
count++runs before running it:``
text count = 0 for i in 0 .. n-1: for j in 0 .. i-1: count = count + 1``When
iis 0 the inner loop does not run at all, and wheniis 1 it runs once. Givenn, print the final value ofcount. The loop is far too long to run for the biggestn, so work out the formula from the lesson instead.**Constraints:** 0 <= n <= 2,000,000,000. The answer can exceed the range of a 32-bit integer.
Input. One integer n.
Output. One integer: the number of times `count` is increased.
Example 1 input
6
Output
15
Example 2 input
4
Output
6