Tesla Pyramid
Problem Statement:
Elon Musk wants to build a pyramid of Teslas to appease the Martian Gods. If a pyramid has a height of K units, then there are i Teslas on the ith level (1 ≤ i ≤ K). To avoid being killed by the Martians when the SpaceX astronauts land on Mars, Elon Musk has hired you to find the maximum height pyramid that can be formed using N Teslas.
Constraints:
Subtask 1: 20 points
- 1 ≤ N ≤ 105
Subtask 2: 60 points
- 1 ≤ N ≤ 109
Input format:
- The first line contains a single integer N, the number of coins.
Output format:
- Print a single integer K, the height of the largest pyramid that you can form.
Sample input:
7 Sample output:
3