Language: C++

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.TreeMap;
import java.util.*;
 
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
 
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}
 
public class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;
 
    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }
 
    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }
 
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = fs.nextInt();
        }
        int min = Integer.MAX_VALUE;
      int before=0;
      
        for (int i = 0; i < n; i++) {
          
           int sumf = 0;
            int sumb = 0;
            for (int j = 0; j < i; j++) {
                sumf += a[j];
            }
            for (int j = n - 1; j >= i; j--) {
                sumb += a[j];
            }
            if (Math.abs(sumf - sumb) < min)
                min = Math.abs(sumf - sumb);
 
          int before=min;
          if(before<min)break;
        }
        System.out.println(min);
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.File;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.IOException;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.InputStream;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.NoSuchElementException;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.TreeMap;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.*;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:12: error: expected ':' before 'final'
    9 |     private final InputStream in = System.in;
      |            ^~~~~~
      |            :
a.cc:9:13: error: 'final' does not name a type
    9 |     private final InputStream in = System.in;
      |             ^~~~~
a.cc:10:12: error: expected ':' before 'final'
   10 |     private final byte[] buffer = new byte[1024];
      |            ^~~~~~
      |            :
a.cc:10:13: error: 'final' does not name a type
   10 |     private final byte[] buffer = new byte[1024];
      |             ^~~~~
a.cc:11:12: error: expected ':' before 'int'
   11 |     private int ptr = 0;
      |            ^~~~
      |            :
a.cc:12:12: error: expected ':' before 'int'
   12 |     private int buflen = 0;
      |            ^~~~
      |            :
a.cc:14:12: error: expected ':' before 'boolean'
   14 |     private boolean hasNextByte() {
      |            ^~~~~~~~
      |            :
a.cc:14:13: error: 'boolean' does not name a type; did you mean 'bool'?
   14 |     private boolean hasNextByte() {
      |             ^~~~~~~
      |             bool
a.cc:31:12: error: expected ':' before 'int'
   31 |     private int readByte() {
      |            ^~~~
      |            :
a.cc:38:12: error: expected ':' before 'static'
   38 |     private static boolean isPrintableChar(int c) {
      |            ^~~~~~~
      |            :
a.cc:38:20: error: 'boolean' does not name a type; did you mean 'bool'?
   38 |     private static boolean isPrintableChar(int c) {
      |                    ^~~~~~~
      |                    bool
a.cc:42:11: error: expected ':' before 'boolean'
   42 |     public boolean hasNext() {
      |           ^~~~~~~~
      |           :
a.cc:42:12: error: 'boolean' does not name a type; did you mean 'bool'?
   42 |     public boolean hasNext() {
      |            ^~~~~~~
      |            bool
a.cc:48:11: error: expected ':' before 'String'
   48 |     public String next() {
      |           ^~~~~~~
      |           :
a.cc:48:12: error: 'String' does not name a type
   48 |     public String next() {
      |            ^~~~~~
a.cc:60:11: error: expected ':' before 'long'
   60 |     public long nextLong() {
      |           ^~~~~
      |           :
a.cc:86:11: error: expected ':' before 'int'
   86 |     public int nextInt() {
      |           ^~~~
      |           :
a.cc:93:11: error: expected ':' before 'double'
   93 |     public double nextDouble() {
      |           ^~~~~~~
      |           :
a.cc:96:2: error: expected ';' after class definition
   96 | }
      |  ^
      |  ;
a.cc: In member function 'int FastScanner::readByte()':
a.cc:32:13: error: 'hasNextByte' was not declared in this scope
   32 |         if (hasNextByte())
      |             ^~~~~~~~~~~
a.cc:33:20: error: 'buffer' was not declared in this scope; did you mean 'buflen'?
   33 |             return buffer[ptr++];
      |                    ^~~~~~
      |                    buflen
a.cc: In member function 'long int FastScanner::nextLong()':
a.cc:61:14: error: 'hasNext' was not declared in this scope
   61 |         if (!hasNext())
      |              ^~~~~~~
a.cc:62:23: error: expected type-specifier before 'NoSuchElementException'
   62 |             throw new NoSuchElementException();
      |                       ^~~~~~~~~~~~~~~~~~~~~~
a.cc:64:9: error: 'boolean' was not declared in this scope; did you mean 'bool'?
   64 |         boolean minus = false;
      |         ^~~~~~~
      |         bool
a.cc:67:13: error: 'minus' was not declared in this scope
   67 |             minus = true;
      |             ^~~~~
a.cc:71:23: error: expected type-specifier before 'NumberFormatException'
   71 |             throw new NumberFormatException();
      |                       ^~~~~~~~~~~~~~~~~~~~~
a.cc:77:36: error: 'isPrintableChar' was not declared in this scope
   77 |             } else if (b == -1 || !isPrintableChar(b)) {
      |                                    ^~~~~~~~~~~~~~~
a.cc:78:24: error: 'minus' was not declared in this scope
   78 |                 return minus ? -n : n;
      |                        ^~~~~
a.cc:80:27: error: expected type-specifier before 'NumberFormatException'
   80 |                 throw new NumberFormatException();
      |                           ^~~~~~~~~~~~~~~~~~~~~
a.cc: In member function 'int FastScanner::nextInt()':
a.cc:88:18: error: 'Integer' was not declared in this scope
   88 |         if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
      |                  ^~~~~~~
a.cc:89:23: error: expected type-specifier before 'NumberFormatException'
   89 |             throw new NumberFormatException();
      |                       ^~~~~~~~~~~~~~~~~~~~~
a.cc: In member function 'double FastScanner::nextDouble()':
a.cc:94:16: error: 'Double' was not declared in this scope; did you mean 'double'?
   94 |         return Double.parseDouble(next());
      |                ^~~~~~
      |                double
a.cc:94:35: error: 'next' was not declared in this scope; did you mean 'nextInt'?
   94 |         return Double.parseDouble(next());
      |                                   ^~~~
      |                                   nextInt
a.cc: At global scope:
a.cc:98:1: error: expected unqualified-id before 'public'
   98 | public class Main {
      | ^~~~~~