Language: Java

#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    vector<ll> a(n);
    vector<int> s(n);
    REP(i,n) cin >> a[i];
    s[0] = a[0]%m;
    for (int i = 1; i < n; ++i) s[i] += ((s[i-1]+a[i])%m);
    sort(s.begin(), s.end());
    map<ll, ll> mp;
    ll ans = 0;
    REP(i,n) {
        if (s[i] == 0) ans++;
        mp[s[i]]++;
    }
    for (auto x: mp) ans += (x.second*(x.second-1))/2;
    cout << ans << endl;
    return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:3: error: class, interface, enum, or record expected
const int MOD = 1e9+7;
^
Main.java:4: error: class, interface, enum, or record expected
const long long LINF = 1e18;
^
Main.java:5: error: illegal character: '#'
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
^
Main.java:5: error: class, interface, enum, or record expected
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
        ^
Main.java:5: error: unclosed character literal
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
                                ^
Main.java:5: error: unclosed character literal
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
                                    ^
Main.java:5: error: illegal character: '`'
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
                                                ^
Main.java:5: error: illegal character: '`'
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
                                                  ^
Main.java:6: error: illegal character: '#'
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
^
Main.java:6: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
        ^
Main.java:6: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
                                 ^
Main.java:6: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
                                       ^
Main.java:7: error: illegal character: '#'
#define REP(i,n) for(int i=0;i<(n);++i)
^
Main.java:7: error: class, interface, enum, or record expected
#define REP(i,n) for(int i=0;i<(n);++i)
                             ^
Main.java:7: error: class, interface, enum, or record expected
#define REP(i,n) for(int i=0;i<(n);++i)
                                   ^
Main.java:8: error: illegal character: '#'
#define REPR(i,n) for(int i=n;i>=0;i--)
^
Main.java:8: error: class, interface, enum, or record expected
#define REPR(i,n) for(int i=n;i>=0;i--)
                              ^
Main.java:8: error: class, interface, enum, or record expected
#define REPR(i,n) for(int i=n;i>=0;i--)
                                   ^
Main.java:9: error: illegal character: '#'
#define FOREACH(x,a) for(auto& (x) : (a) )
^
Main.java:11: error: class, interface, enum, or record expected
using namespace std;
^
Main.java:14: error: not a statement
    cin >> n >> m;
             ^
Main.java:15: error: not a statement
    vector<ll> a(n);
                 ^
Main.java:16: error: not a statement
    vector<int> s(n);
                  ^
Main.java:17: error: not a statement
    REP(i,n) cin >> a[i];
                 ^
Main.java:28: error: not a statement
    cout << ans << endl;
                ^
Main.java:12: error: unnamed classes are a preview feature and are disabled by default.
int main(int argc, char const *argv[]) {
^
  (use --enable-preview to enable unnamed classes)
Main.java:12: error: <identifier> expected
int main(int argc, char const *argv[]) {
                       ^
Main.java:15: error: ';' expected
    vector<ll> a(n);
                ^
Main.java:15: error: ';' expected
    vector<ll> a(n);
                  ^
Main.java:16: error: ';' expected
    vector<int> s(n);
                 ^
Main.java:16: error: ';' expected
    vector<int> s(n);
                   ^
Main.java:17: error: ';' expected
    REP(i,n) cin >> a[i];
            ^
Main.java:23: error: ';' expected
    REP(i,n) {
            ^
35 errors