title: How to decrease the runtime of this following code?
body: <p>(This program needs to accept N inputs of two numbers in one line, where the first number is a runner's instantaneous time in seconds and instantaneous distance. From these values, it will output the fastest speed between two consecutive points.)</p>
  
  <p>I need to decrease the runtime of this program. Does anyone have any suggestions?</p>
  
  <pre><code> import java.io.BufferedReader;
   import java.io.IOException;
   import java.io.InputStreamReader;
  
   public class Main {
     public static void main(String[] args) throws NumberFormatException, IOException {
  
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
  
       int x = Integer.parseInt(input.readLine());
       double n1;
       double n2;
       double placeholder = 0;
       double maxspeed = 0;
       int[] time = new int[x];
       int[] distance = new int[x];
  
       for(int i = 0; i&lt;x; i++) {
  
         String userinput= input.readLine();
  
         String[] parts = userinput.split(" ");
         String part1 = parts[0];
         time[i] = Integer.parseInt(part1);
         String part2 = parts[1];
         distance[i] = Integer.parseInt(part2);
         }
  
       for (int j = 0; j&lt; distance.length; j++) {
         for(int i = 1; i&lt; distance.length; i++) {
  
           n1 = (distance[(distance.length-1)- j] - distance[(distance.length-1) - i]);
           n2 = (time[(time.length-1) - j] - time[(time.length-1) - i]) ;
  
           if ((n2 != 0) &amp;&amp; (n1/2 != n1)) {
             placeholder = (n1 / n2);
             if(placeholder &lt; 0) {
               placeholder = placeholder*-1;
             }
  
             if(placeholder &gt; maxspeed) {
               maxspeed = placeholder;
             }
  
           }
         }
       }
       System.out.println(maxspeed);
     }
   }
  </code></pre>