@@ -0,0 +1,740 @@
+import java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0A%0Apublic class RunForYourPrize %7B%0A%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));%0A        int amountOfPrizes = Integer.parseInt(reader.readLine());%0A        int timeSpent = 0;%0A        for (String s : reader.readLine().split(%22 %22)) %7B%0A            int prizePosition = Integer.parseInt(s);%0A            int distanceToFirst = prizePosition - 1;%0A            int distanceToSecond = 1_000_000 - prizePosition;%0A            timeSpent = Math.max(timeSpent, Math.min(distanceToFirst, distanceToSecond));%0A        %7D%0A        System.out.println(timeSpent);%0A    %7D%0A%7D%0A

Add RunForYourPrize