Language: Java

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

/**
 * Created by martin-d28jp-love on 15/04/01.
 */
public class Main {

        int[] input = input();
//        int[] input = mockuop();

        int inputLength = input.length;
        int minValue = Integer.MAX_VALUE;
        int maxValue = -Integer.MAX_VALUE;
        int minIndex = 0;
        int maxIndex = 0;
        for (int i=1; i <= inputLength; i++) {
            int Ri = input[i];
            if (Ri < minValue) {
                minValue = Ri;
                minIndex = i;
            }
            if (Ri > maxValue) {
                maxValue = Ri;
                maxIndex = i;
            }
        }
        if (minIndex < maxIndex) {
            System.out.println(maxValue - minValue);
            return;
        }

        int maxSubtruction = -Integer.MAX_VALUE;
        int maxSubtructionIndex = 1;
        int beforeSubtructionRi = Integer.MAX_VALUE;
        for (int i = 1; i < inputLength; i++) {
            int Ri = input[i];
            if (beforeSubtructionRi < Ri) {
                continue;
            }
            int start = maxSubtructionIndex > i + 1 ? maxSubtructionIndex : i + 1;
            for (int j = start; j <= inputLength; j++) {
                int Rj = input[j];
                if (Rj - Ri > maxSubtruction) {
                    maxSubtruction = Rj - Ri;
                    maxSubtructionIndex = j;
                    beforeSubtructionRi = Ri;
                }
            }
        }
        System.out.println(maxSubtruction);
    }

    public static int[] mockuop() {
        int input[] = {20,100,99,95,86,85,76,75,71,70,61,52,48,47,43,42,38,37,33,32,28}
        return input;
    }
    public static int[] input() {
        Scanner in = new Scanner(System.in);
        int size = Integer.valueOf(in.nextLine());

        int[] list = new int[size];
        int i = 0;
        while(in.hasNext()) {
            list[i++] = Integer.valueOf(in.nextLine());
        }
        in.close();
        return input;
    }
}

Compiler output:
Main.java:19: error: illegal start of type
        for (int i=1; i <= inputLength; i++) {
        ^
Main.java:19: error: <identifier> expected
        for (int i=1; i <= inputLength; i++) {
                       ^
Main.java:19: error: <identifier> expected
        for (int i=1; i <= inputLength; i++) {
                                      ^
Main.java:19: error: <identifier> expected
        for (int i=1; i <= inputLength; i++) {
                                         ^
Main.java:30: error: illegal start of type
        if (minIndex < maxIndex) {
        ^
Main.java:30: error: > or ',' expected
        if (minIndex < maxIndex) {
                               ^
Main.java:38: error: illegal start of type
        for (int i = 1; i < inputLength; i++) {
        ^
Main.java:38: error: > or ',' expected
        for (int i = 1; i < inputLength; i++) {
                                       ^
Main.java:38: error: <identifier> expected
        for (int i = 1; i < inputLength; i++) {
                                          ^
Main.java:53: error: <identifier> expected
        System.out.println(maxSubtruction);
                          ^
Main.java:53: error: <identifier> expected
        System.out.println(maxSubtruction);
                                         ^
Main.java:56: error: unnamed classes are a preview feature and are disabled by default.
    public static int[] mockuop() {
                  ^
  (use --enable-preview to enable unnamed classes)
Main.java:57: error: ';' expected
        int input[] = {20,100,99,95,86,85,76,75,71,70,61,52,48,47,43,42,38,37,33,32,28}
                                                                                       ^
Main.java:72: error: class, interface, enum, or record expected
}
^
14 errors