Language: Java

#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

	

int main() {
	int n, m;
	while (cin >> n >> m, n | m){
		int count=0;
		vector<int>  vn;
		vector<int>  vm;
		vn.push_back(0);
		vm.push_back(0);
		map<int, int> ma;
		int x=0;
		REP(i, n){
			int a;
			cin >> a;
			x += a;
			vn.push_back(x);
		}
		x = 0;
		REP(i, m){
			int a;
			cin >> a;
			x += a;
			vm.push_back(x);
		}
		
		REP(i,n+1){
			REP(j,m+1){
				ma[vn[i] - vm[j]]++;

			}
		}
			for (map<int, int>::iterator it = ma.begin(); it != ma.end(); it++)
				count += it->second*(it->second - 1) / 2;

		
		cout << count << endl;

	}
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <algorithm>
^
Main.java:2: error: illegal character: '#'
#include <cmath>
^
Main.java:3: error: illegal character: '#'
#include <climits>
^
Main.java:4: error: illegal character: '#'
#include <cstdio>
^
Main.java:5: error: illegal character: '#'
#include <cstdlib>
^
Main.java:6: error: illegal character: '#'
#include <cstring>
^
Main.java:7: error: illegal character: '#'
#include <fstream>
^
Main.java:8: error: illegal character: '#'
#include <iostream>
^
Main.java:9: error: illegal character: '#'
#include <list>
^
Main.java:10: error: illegal character: '#'
#include <map>
^
Main.java:11: error: illegal character: '#'
#include <queue>
^
Main.java:12: error: illegal character: '#'
#include <set>
^
Main.java:13: error: illegal character: '#'
#include <sstream>
^
Main.java:14: error: illegal character: '#'
#include <stack>
^
Main.java:15: error: illegal character: '#'
#include <string>
^
Main.java:16: error: illegal character: '#'
#include <vector>
^
Main.java:17: error: illegal character: '#'
#include <cassert>
^
Main.java:18: error: illegal character: '#'
#include <functional>
^
Main.java:22: error: illegal character: '#'
#define LOG(...) printf(__VA_ARGS__)
^
Main.java:22: error: class, interface, enum, or record expected
#define LOG(...) printf(__VA_ARGS__)
        ^
Main.java:24: error: illegal character: '#'
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
^
Main.java:24: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
                                      ^
Main.java:24: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
                                                 ^
Main.java:25: error: illegal character: '#'
#define REP(i,n) for(int i=0;i<(int)(n);++i)
^
Main.java:25: error: class, interface, enum, or record expected
#define REP(i,n) for(int i=0;i<(int)(n);++i)
                             ^
Main.java:25: error: class, interface, enum, or record expected
#define REP(i,n) for(int i=0;i<(int)(n);++i)
                                        ^
Main.java:26: error: illegal character: '#'
#define ALL(a) (a).begin(),(a).end()
^
Main.java:27: error: illegal character: '#'
#define RALL(a) (a).rbegin(),(a).rend()
^
Main.java:28: error: illegal character: '#'
#define EXIST(s,e) ((s).find(e)!=(s).end())
^
Main.java:29: error: illegal character: '#'
#define SORT(c) sort((c).begin(),(c).end())
^
Main.java:30: error: illegal character: '#'
#define RSORT(c) sort((c).rbegin(),(c).rend())
^
Main.java:31: error: illegal character: '#'
#define CLR(a) memset((a), 0 ,sizeof(a))
^
Main.java:34: error: class, interface, enum, or record expected
typedef unsigned long long ull;
^
Main.java:35: error: class, interface, enum, or record expected
typedef vector<bool> vb;
^
Main.java:36: error: class, interface, enum, or record expected
typedef vector<int> vi;
^
Main.java:37: error: class, interface, enum, or record expected
typedef vector<ll> vll;
^
Main.java:38: error: class, interface, enum, or record expected
typedef vector<vb> vvb;
^
Main.java:39: error: class, interface, enum, or record expected
typedef vector<vi> vvi;
^
Main.java:40: error: class, interface, enum, or record expected
typedef vector<vll> vvll;
^
Main.java:41: error: class, interface, enum, or record expected
typedef pair<int, int> pii;
^
Main.java:42: error: class, interface, enum, or record expected
typedef pair<ll, ll> pll;
^
Main.java:44: error: class, interface, enum, or record expected
const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };
^
Main.java:44: error: class, interface, enum, or record expected
const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };
                                  ^
Main.java:50: error: not a statement
	while (cin >> n >> m, n | m){
	                        ^
Main.java:60: error: not a statement
			cin >> a;
			    ^
Main.java:67: error: not a statement
			cin >> a;
			    ^
Main.java:78: error: not a statement
			for (map<int, int>::iterator it = ma.begin(); it != ma.end(); it++)
			        ^
Main.java:78: error: not a statement
			for (map<int, int>::iterator it = ma.begin(); it != ma.end(); it++)
			                                                 ^
Main.java:82: error: not a statement
		cout << count << endl;
		              ^
Main.java:48: error: unnamed classes are a preview feature and are disabled by default.
int main() {
^
  (use --enable-preview to enable unnamed classes)
Main.java:50: error: ')' expected
	while (cin >> n >> m, n | m){
	                    ^
Main.java:50: error: ';' expected
	while (cin >> n >> m, n | m){
	                           ^
Main.java:58: error: ';' expected
		REP(i, n){
		         ^
Main.java:65: error: ';' expected
		REP(i, m){
		         ^
Main.java:72: error: ';' expected
		REP(i,n+1){
		          ^
Main.java:73: error: ';' expected
			REP(j,m+1){
			          ^
Main.java:78: error: ';' expected
			for (map<int, int>::iterator it = ma.begin(); it != ma.end(); it++)
			                  ^
Main.java:78: error: ';' expected
			for (map<int, int>::iterator it = ma.begin(); it != ma.end(); it++)
			                                                                  ^
58 errors