Problem:
Score : 200 points

Problem Statement

There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0.
During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right.
That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i.
The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible.
Find the earliest possible time to reach coordinate X.

Constraints

X is an integer.

1≤X≤10^9

Input

The input is given from Standard Input in the following format:

X

Output

Print the earliest possible time for the kangaroo to reach coordinate X.

Sample Input 1

6

Sample Output 1

3

The kangaroo can reach his nest at time 3 by jumping to the right three times, which is the earliest possible time.

Sample Input 2

2

Sample Output 2

2

He can reach his nest at time 2 by staying at his position during the first second, and jumping to the right at the next second.

Sample Input 3

11

Sample Output 3

5

Solution in Java (OpenJDK 11.0.6) (judge verdict: Accepted)


import java.util.*;
import java.io.*;
public class Main {
 static class Reader 
 { 
     final private int BUFFER_SIZE = 1 << 16; 
     private DataInputStream din; 
     private byte[] buffer; 
     private int bufferPointer, bytesRead; 

     public Reader() 
     { 
         din = new DataInputStream(System.in); 
         buffer = new byte[BUFFER_SIZE]; 
         bufferPointer = bytesRead = 0; 
     } 

     public Reader(String file_name) throws IOException 
     { 
         din = new DataInputStream(new FileInputStream(file_name)); 
         buffer = new byte[BUFFER_SIZE]; 
         bufferPointer = bytesRead = 0; 
     } 

     public String readLine() throws IOException 
     { 
         byte[] buf = new byte[64]; // line length 
         int cnt = 0, c; 
         while ((c = read()) != -1) 
         { 
             if (c == '\n') 
                 break; 
             buf[cnt++] = (byte) c; 
         } 
         return new String(buf, 0, cnt); 
     } 

     public int nextInt() throws IOException 
     { 
         int ret = 0; 
         byte c = read(); 
         while (c <= ' ') 
             c = read(); 
         boolean neg = (c == '-'); 
         if (neg) 
             c = read(); 
         do
         { 
             ret = ret * 10 + c - '0'; 
         }  while ((c = read()) >= '0' && c <= '9'); 

         if (neg) 
             return -ret; 
         return ret; 
     } 

     public long nextLong() throws IOException 
     { 
         long ret = 0; 
         byte c = read(); 
         while (c <= ' ') 
             c = read(); 
         boolean neg = (c == '-'); 
         if (neg) 
             c = read(); 
         do { 
             ret = ret * 10 + c - '0'; 
         } 
         while ((c = read()) >= '0' && c <= '9'); 
         if (neg) 
             return -ret; 
         return ret; 
     } 

     public double nextDouble() throws IOException 
     { 
         double ret = 0, div = 1; 
         byte c = read(); 
         while (c <= ' ') 
             c = read(); 
         boolean neg = (c == '-'); 
         if (neg) 
             c = read(); 

         do { 
             ret = ret * 10 + c - '0'; 
         } 
         while ((c = read()) >= '0' && c <= '9'); 

         if (c == '.') 
         { 
             while ((c = read()) >= '0' && c <= '9') 
             { 
                 ret += (c - '0') / (div *= 10); 
             } 
         } 

         if (neg) 
             return -ret; 
         return ret; 
     } 

     private void fillBuffer() throws IOException 
     { 
         bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
         if (bytesRead == -1) 
             buffer[0] = -1; 
     } 

     private byte read() throws IOException 
     { 
         if (bufferPointer == bytesRead) 
             fillBuffer(); 
         return buffer[bufferPointer++]; 
     } 

     public void close() throws IOException 
     { 
         if (din == null) 
             return; 
         din.close(); 
     } 
 } 
	private static final int m = 0;
	public static void main(String[] args) throws Exception  {
Reader sc=new Reader();
PrintWriter out=new PrintWriter(System.out);
int n=sc.nextInt();
int ans=0;
int i=0;
while(ans<n) {
	i++;
	ans=ans+i;
	
}
System.out.println(i);
		
		
	}
	}