Language: Java

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long long a[1001][4];
bool cmp(long long p,long long q) {
    return p > q;
}
int main() {
    int n,m,i,j,k;
    scanf("%d%d",&n,&m);
    for (i = 0;i < n;i ++) {
        for (j = 0;j < 3;j ++)
            cin>>a[i][j];
    }
    long long ans = -1;
    for (i = 0;i < 8;i ++) {
        long long f[100010];
        for (j = 0;j < n;j ++) {
            long long sum = 0;
            for (k = 0;k < 3;k ++) {
                if(i >> k & 1)sum += a[j][k];
                else sum -= a[j][k];
            }
            f[j] = sum;
        }
        sort(f,f + n,cmp);
        long long s = 0;
        for (j = 0;j < m;j ++)s += f[j];
        ans = max(s,ans);
    }
    cout<<ans;
    return 0;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include<iostream>
^
Main.java:2: error: illegal character: '#'
#include<cstdio>
^
Main.java:3: error: illegal character: '#'
#include<algorithm>
^
Main.java:5: error: class, interface, enum, or record expected
long long a[1001][4];
^
Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
bool cmp(long long p,long long q) {
^
  (use --enable-preview to enable unnamed classes)
Main.java:6: error: <identifier> expected
bool cmp(long long p,long long q) {
             ^
Main.java:8: error: class, interface, enum, or record expected
}
^
Main.java:11: error: class, interface, enum, or record expected
    scanf("%d%d",&n,&m);
    ^
Main.java:12: error: class, interface, enum, or record expected
    for (i = 0;i < n;i ++) {
    ^
Main.java:12: error: class, interface, enum, or record expected
    for (i = 0;i < n;i ++) {
               ^
Main.java:12: error: class, interface, enum, or record expected
    for (i = 0;i < n;i ++) {
                     ^
Main.java:13: error: class, interface, enum, or record expected
        for (j = 0;j < 3;j ++)
                   ^
Main.java:13: error: class, interface, enum, or record expected
        for (j = 0;j < 3;j ++)
                         ^
Main.java:15: error: class, interface, enum, or record expected
    }
    ^
Main.java:17: error: class, interface, enum, or record expected
    for (i = 0;i < 8;i ++) {
    ^
Main.java:17: error: class, interface, enum, or record expected
    for (i = 0;i < 8;i ++) {
               ^
Main.java:17: error: class, interface, enum, or record expected
    for (i = 0;i < 8;i ++) {
                     ^
Main.java:19: error: class, interface, enum, or record expected
        for (j = 0;j < n;j ++) {
        ^
Main.java:19: error: class, interface, enum, or record expected
        for (j = 0;j < n;j ++) {
                   ^
Main.java:19: error: class, interface, enum, or record expected
        for (j = 0;j < n;j ++) {
                         ^
Main.java:21: error: class, interface, enum, or record expected
            for (k = 0;k < 3;k ++) {
            ^
Main.java:21: error: class, interface, enum, or record expected
            for (k = 0;k < 3;k ++) {
                       ^
Main.java:21: error: class, interface, enum, or record expected
            for (k = 0;k < 3;k ++) {
                             ^
Main.java:23: error: class, interface, enum, or record expected
                else sum -= a[j][k];
                ^
Main.java:24: error: class, interface, enum, or record expected
            }
            ^
Main.java:26: error: class, interface, enum, or record expected
        }
        ^
Main.java:28: error: class, interface, enum, or record expected
        long long s = 0;
        ^
Main.java:29: error: class, interface, enum, or record expected
        for (j = 0;j < m;j ++)s += f[j];
        ^
Main.java:29: error: class, interface, enum, or record expected
        for (j = 0;j < m;j ++)s += f[j];
                   ^
Main.java:29: error: class, interface, enum, or record expected
        for (j = 0;j < m;j ++)s += f[j];
                         ^
Main.java:30: error: class, interface, enum, or record expected
        ans = max(s,ans);
        ^
Main.java:31: error: class, interface, enum, or record expected
    }
    ^
Main.java:33: error: class, interface, enum, or record expected
    return 0;
    ^
Main.java:34: error: class, interface, enum, or record expected
}
^
34 errors