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 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:18: error: illegal start of type
        for (int i=1; i <= inputLength; i++) {
        ^
Main.java:18: error: <identifier> expected
        for (int i=1; i <= inputLength; i++) {
                       ^
Main.java:18: error: <identifier> expected
        for (int i=1; i <= inputLength; i++) {
                                      ^
Main.java:18: error: <identifier> expected
        for (int i=1; i <= inputLength; i++) {
                                         ^
Main.java:29: error: illegal start of type
        if (minIndex < maxIndex) {
        ^
Main.java:29: error: > or ',' expected
        if (minIndex < maxIndex) {
                               ^
Main.java:37: error: illegal start of type
        for (int i = 1; i < inputLength; i++) {
        ^
Main.java:37: error: > or ',' expected
        for (int i = 1; i < inputLength; i++) {
                                       ^
Main.java:37: error: <identifier> expected
        for (int i = 1; i < inputLength; i++) {
                                          ^
Main.java:52: error: <identifier> expected
        System.out.println(maxSubtruction);
                          ^
Main.java:52: error: <identifier> expected
        System.out.println(maxSubtruction);
                                         ^
Main.java:55: 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:56: 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:71: error: class, interface, enum, or record expected
}
^
14 errors