Language: Java

import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;

import lib.io.ExtendedScanner;
import lib.io.Out;
import lib.util.Longs;

public class E {
    public static void main(String[] args) throws Exception {
        Field f = System.out.getClass().getDeclaredField("autoFlush");
        f.setAccessible(true);
        f.set(System.out, false);
        execute(System.in, System.out);
    }

    public static void execute(InputStream in, OutputStream out) {
        ExtendedScanner s = new ExtendedScanner(in);
        Out o = new Out(out);
        solve(s, o);
        o.flush();
        o.close();
    }

    public static void solve(ExtendedScanner sc, Out out) {
        int r = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        long[][] g = new long[r + 1][c + 1];
        for (int i = 0; i < k; i++) g[sc.nextInt()][sc.nextInt()] = sc.nextLong();
        long[][][] dp = new long[r + 1][c + 1][4];
        for (int i = 1; i <= r; i++) {
            for (int x = 1; x <= 3; x++) {
                for (int j = 1; j <= c; j++) {
                    dp[i][j][x] = Longs.max(dp[i][j - 1][x - 1] + g[i][j], dp[i][j - 1][x]);
                    if (x == 1) {
                        dp[i][j][x] = Longs.max(dp[i][j][x], g[i][j] + Longs.max(dp[i - 1][j][1], dp[i - 1][j][2], dp[i - 1][j][3]));
                    }
                }
            }
        }
        out.writeln(Longs.max(dp[r][c][1], dp[r][c][2], dp[r][c][3]));
    }
}


Compiler output:
Main.java:9: error: class E is public, should be declared in a file named E.java
public class E {
       ^
Main.java:5: error: package lib.io does not exist
import lib.io.ExtendedScanner;
             ^
Main.java:6: error: package lib.io does not exist
import lib.io.Out;
             ^
Main.java:7: error: package lib.util does not exist
import lib.util.Longs;
               ^
Main.java:25: error: cannot find symbol
    public static void solve(ExtendedScanner sc, Out out) {
                             ^
  symbol:   class ExtendedScanner
  location: class E
Main.java:25: error: cannot find symbol
    public static void solve(ExtendedScanner sc, Out out) {
                                                 ^
  symbol:   class Out
  location: class E
Main.java:18: error: cannot find symbol
        ExtendedScanner s = new ExtendedScanner(in);
        ^
  symbol:   class ExtendedScanner
  location: class E
Main.java:18: error: cannot find symbol
        ExtendedScanner s = new ExtendedScanner(in);
                                ^
  symbol:   class ExtendedScanner
  location: class E
Main.java:19: error: cannot find symbol
        Out o = new Out(out);
        ^
  symbol:   class Out
  location: class E
Main.java:19: error: cannot find symbol
        Out o = new Out(out);
                    ^
  symbol:   class Out
  location: class E
Main.java:35: error: cannot find symbol
                    dp[i][j][x] = Longs.max(dp[i][j - 1][x - 1] + g[i][j], dp[i][j - 1][x]);
                                  ^
  symbol:   variable Longs
  location: class E
Main.java:37: error: cannot find symbol
                        dp[i][j][x] = Longs.max(dp[i][j][x], g[i][j] + Longs.max(dp[i - 1][j][1], dp[i - 1][j][2], dp[i - 1][j][3]));
                                                                       ^
  symbol:   variable Longs
  location: class E
Main.java:37: error: cannot find symbol
                        dp[i][j][x] = Longs.max(dp[i][j][x], g[i][j] + Longs.max(dp[i - 1][j][1], dp[i - 1][j][2], dp[i - 1][j][3]));
                                      ^
  symbol:   variable Longs
  location: class E
Main.java:42: error: cannot find symbol
        out.writeln(Longs.max(dp[r][c][1], dp[r][c][2], dp[r][c][3]));
                    ^
  symbol:   variable Longs
  location: class E
14 errors