criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

//modしながら塁乗
ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

ll main(){

  ll n;cin>>n;
  ll a[n];
  cin>>a[0];
  for(ll i=1;i<n;i++){
    ll t;cin>>t;
    a[i] = a[i-1] + t;
  }
  vector<ll> v;
  REP(i,n){
    v.pb(a[i]);
  }
  v.pb(0);
  VSORT(v);
  ll ans = 0;
  ll i = 1;
  ll count = 1;
  while(i<v.size()){

    if(v[i] != v[i-1]){
      ans += count * (count - 1) / 2;
      count = 0;
    }
        count++;
    i++;
  }
  ans += count * (count - 1) / 2;

  cout<<ans<<endl;


  return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

//modしながら塁乗
ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  ll n;cin>>n;
  ll a[n];
  cin>>a[0];
  for(int i=1;i<n;i++){
    ll t;cin>>t;
    a[i] = a[i-1] + t;
  }
  vector<ll> v;
  REP(i,n){
    v.pb(a[i]);
  }
  v.pb(0)
  VSORT(v);
  ll ans = 0;
  int i = 1;
  int count = 1;
  while(i<=n){

    if(v[i] != v[i-1]){
      ans += count * (count - 1) / 2;
      count = 0;
    }
        count++;
    i++;
  }
  ans += count * (count - 1) / 2;

  cout<<ans<<endl;


  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: expected ';' before 'sort'
    7 | #define VSORT(v) sort(v.begin(), v.end());
      |                  ^~~~
a.cc:55:3: note: in expansion of macro 'VSORT'
   55 |   VSORT(v);
      |   ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl

//累積和　

int main() {
  int N;
  cin >> N;

  vl sum(N + 1, 0);
  map<ll, ll> num;

  FOR(i, 1, N + 1) {
    ll a;
    cin >> a;
    sum[i] = sum[i - 1] + a;
  }

  FOR(i, 0, N + 1) { num[sum[i]]++; }

  ll res = 0;
  for (auto it : nums) {
    long long num = it.second;  // it.first が it.second 個ある
    res += num * (num - 1) / 2;
  }

  cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:18: error: 'nums' was not declared in this scope; did you mean 'num'?
   37 |   for (auto it : nums) {
      |                  ^~~~
      |                  num
Language: C++

#include <iostream>
#include <map>

int main() {
  using i64 = long long;

  std::map<i64, i64> mp({{0, 1}});
  i64 ans = 0, acc = 0;
  while (n--) {
    i64 a;
    std::cin >> a;
    ans += mp[acc += a]++;
  }
  std::cout << ans << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: 'n' was not declared in this scope
    9 |   while (n--) {
      |          ^
Language: C++

N=int(input())
a=list(map(int,input().split()))



dic={0:1}
tmp=0
for i in range(N):
    tmp+=a[i]
    dic.setdefault(tmp,0)
    dic[tmp]+=1



ans=0
for i in dic:
    ans+=dic[i]*(dic[i]-1)//2

print(ans)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N=int(input())
      | ^
a.cc:7:1: error: 'tmp' does not name a type
    7 | tmp=0
      | ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N;
  vector<long long> v(N+1, 0);
  map<long long, long long> m;
  for (int i = 0; i < N; i++) {
    cin >> v[i+1];
    v[i+1] += v[i];
    m[v[i]]++;
  }
  long long res = 0;
  for (auto x : m) {
    res += x.second * (x.second - 1) / 2
  }
  cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:41: error: expected ';' before '}' token
   17 |     res += x.second * (x.second - 1) / 2
      |                                         ^
      |                                         ;
   18 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define repprev(i,a,b) for(ll i=b-1;i>=a;i--)
#define reprev(i,n) repprev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<60;
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
struct UnionFind {
    vector<ll> par;
 
    UnionFind(ll n) : par(n, -1) { }
    void init(ll n) { par.assign(n, -1); }
 
    ll root(ll x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
 
    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }
 
    bool merge(ll x, ll y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
 
    ll size(ll x) {
        return -par[root(x)];
    }
};
 
int main() {
    int N; cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    vector<int> s(N+1, 0);
    rep(i,N) s[i+1] = s[i] + a[i];
  	map<ll, ll> nums;
  	rep(i,N){
      ++nums[s[i]];
    }
  	ll ans = 0;
  	for (auto it = nums.begin(); it != nums.end(); ++it) {
    if(it->second % 2 == 0) ans += second / 2;
  }
  cout << ans << endl;
  	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:97:36: error: 'second' was not declared in this scope
   97 |     if(it->second % 2 == 0) ans += second / 2;
      |                                    ^~~~~~
Language: C

//#include<stdlib.h>
#include"include/io.h"
#include"include/lib.h"

#undef long
#define long() long long int

int n, i;
long b[200001];
long ans, now;
char f;

int main(){
	n = nextInt();
	b[0] = 0;
	for(i=0; i<n; i++){
		b[i+1] = b[i] + nextInt();
	}
	qsort(b, n+1, sizeof(long), compare_long);
	for(i=0; i<n; i++){
		if(b[i+1]==b[i]){
			if(f){now++;}
			else{now=2; f=1;}
		}else{
			if(f){ans+=now*(now-1)/2; f=0;}
		}
	}
	if(f){ans+=now*(now-1)/2; f=0;}
	printLong(ans); println();
}


Compiler output:
main.c:2:9: fatal error: include/io.h: No such file or directory
    2 | #include"include/io.h"
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;

//sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});
typedef long long ll;

int main(){
    int N,
    ll r=0;
    cin >> N;
    vector<ll> v(N);
    map<ll,int> mp;
    for (int i=0;i<N;++i) {
        cin >> v[i];
        if (i>0) v[i] += v[i-1];
        mp[v[i]] += 1;
    }


    for (auto it=mp.begin();it!=mp.end();++it) {
        if (it->first==0) r += it->second;
        r += (it->second)*(it->second-1)/2;
    }
    cout << r << endl;    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: expected initializer before 'r'
    9 |     ll r=0;
      |        ^
a.cc:21:27: error: 'r' was not declared in this scope
   21 |         if (it->first==0) r += it->second;
      |                           ^
a.cc:22:9: error: 'r' was not declared in this scope
   22 |         r += (it->second)*(it->second-1)/2;
      |         ^
a.cc:24:13: error: 'r' was not declared in this scope
   24 |     cout << r << endl;
      |             ^
Language: C++

#include <bits/stdc++.h>

int main(){
	int num[20000];
	int a = 0;
	int count = 0;
	// int forcount = 0;
	int sum = 0;

	cin >> a;
	
	for(int i = 0;i < a;i++){
		cin >> num[i];
	}

	for(int i = 0;i < a;i++){
		sum = 0;
		// forcount = 0;
		for(int j = i;j < a;j++){
			// forcount++;
			sum += num[j];
			// if(forcount >= 2){
				if(sum == 0){
					count++;
				}
			// }
		}
	}

	cout << count << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 |         cin >> a;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:30:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   30 |         cout << count << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:30:26: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   30 |         cout << count << endl;
      |                          ^~~~
      |                          std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<58;
 
int main(){
    ll N; cin >> N;
  	vector<ll> A(N);
    for(ll i = 0; i < N; ++i) cin >> A[i];
  	map<ll,ll> nums;
  	ll sum = 0;
  	nums[sum]++;
  		for (int i = 0; i < N; ++i) {
    		sum += A[i];
    		nums[sum]++;
  		}
  		ll res = 0;
  		for (auto it = nums.begin(); it != nums.end(); ++it) {
    		res += it->second * (it->second - 1) / 2;
  		}
  		cout << res << endl;
    	return 0;
  	}
}

Compiler output:
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
Language: C++

#include <iostream>
#include <vector>

int main(){
   int N;
   std::cin >> N;
   std::vector<int> S(N+1);
   S[0] = 0;
   int A;
   for(int i=0; i<N; ++i){
      std::cin >> A;
      S[i+1] = S[i] + A;
   }
   std::sort(S.begin(),S.end());

   int count = 0;
   int same = 1;
   for(int i=0; i<N; ++i){
      if(S[i]==S[i+1]) ++same;
      else{
	 count += same * (same-1) / 2;
	 same = 1;
      }
   }
   count += same * (same-1)/2;
   std::cout << count << std::endl;
   return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   14 |    std::sort(S.begin(),S.end());
      |         ^~~~
      |         qsort
Language: C++

#include<iostream>
#include<string>
#include<cmath>
//#include<array>
#include<algorithm>
//#include<deque>
#include<vector>
//#include<utility>
#include<set>
#include<map>
//#include<list>

using namespace std;
using LLI = long long int;

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

//int gcd(int x, int y) {
//	int tmp, r;
//	if (x < y) {
//		tmp = x;
//		x = y;
//		y = tmp;
//	}
//	r = x % y;
//	while (r != 0) {
//		x = y;
//		y = r;
//		r = x % y;
//	}
//	return y;
//}

int main(void) {
	int N,a,res = 0,sum = 0;
	int tmp = INT_MAX;
	vector<int>vec;
	vector<int>vec2;
	cin >> N;
	for (int i = 0; i < N;i++) {
		cin >> a;
		vec.push_back(a);
	}
	sum = vec[0];
	vec2.push_back(sum);
	for (int i = 1; i < N ;i++) {
		sum = sum + vec[i];
		vec2.push_back(sum);
	}
	sort(vec2.begin(),vec2.end());
	
	for (int i = 0; i < vec2.size();i++) {
		if (vec2[i] == 0) {
			res++;
		}
		if (vec2[i] != tmp) {
			a = count(vec2.begin(), vec2.end(), vec2[i]);
			a = a * (a - 1) / 2;
			res += a;
			tmp = vec2[i];
		}
	}
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:19: error: 'INT_MAX' was not declared in this scope
   60 |         int tmp = INT_MAX;
      |                   ^~~~~~~
a.cc:11:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include<map>
  +++ |+#include <climits>
   11 | //#include<list>
Language: C++

using namespace std;

typedef long long ll;

int main(void){
    ll N;
    cin>>N;
    
    ll A[N];
    vector<ll> B(N+1);
    B[0]=0;
    map<ll,ll> p;
    p[0]=0;
    

    for(int i=0;i<N;i++){
        cin>>A[i];
        B[i+1]=A[i]+B[i];
        p[B[i+1]]=0;
    }
    
    sort(B.begin(),B.end());
    for(int i=0;i<N+1;i++){
        p[B[i]]++;
    }
    
    unique(B.begin(),B.end());
    
    int count=0;    
    for(int i=0;i<p.size();i++){
        if(p[B[i]]>=2)count+=(p[B[i]])*(p[B[i]]-1)/2;
    }
    
    cout<<count<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin>>N;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:10:5: error: 'vector' was not declared in this scope
   10 |     vector<ll> B(N+1);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:10:14: error: expected primary-expression before '>' token
   10 |     vector<ll> B(N+1);
      |              ^
a.cc:10:16: error: 'B' was not declared in this scope
   10 |     vector<ll> B(N+1);
      |                ^
a.cc:12:5: error: 'map' was not declared in this scope
   12 |     map<ll,ll> p;
      |     ^~~
a.cc:1:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
  +++ |+#include <map>
    1 | using namespace std;
a.cc:12:11: error: expected primary-expression before ',' token
   12 |     map<ll,ll> p;
      |           ^
a.cc:12:14: error: expected primary-expression before '>' token
   12 |     map<ll,ll> p;
      |              ^
a.cc:12:16: error: 'p' was not declared in this scope
   12 |     map<ll,ll> p;
      |                ^
a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |     sort(B.begin(),B.end());
      |     ^~~~
      |     short
a.cc:27:5: error: 'unique' was not declared in this scope
   27 |     unique(B.begin(),B.end());
      |     ^~~~~~
a.cc:34:5: error: 'cout' was not declared in this scope
   34 |     cout<<count<<endl;
      |     ^~~~
a.cc:34:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:18: error: 'endl' was not declared in this scope
   34 |     cout<<count<<endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std ;

int main () {
  int N ;
  cin >> N ;
  long long line[N+10] ;
  long long A[N+10] = {} ;
  for(int i= 1 ; i <= N ; i++ ) cin >> line[i] ;
  A[0] = 0 ;
  for(int i = 1 ; i <= N ; i++ ) A[i] += line[i] + A[i-1];
  long long ans = 0 ;
  sort(A,A+N+1) ;
  long long tmp = S[0] ;
  int count = 1 ;
  for(int i = 1 ; i <= N ; i++ ){
    if(tmp==A[i]){
      ans += count ;
      count++ ;
    } else {
      tmp = A[i];
      count =  1 ;
    }
  }
  cout << ans << endl ;
  //for(int i = 0 ; i < N + 1 ; i++  ) cout << A[i] << endl ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: 'S' was not declared in this scope
   14 |   long long tmp = S[0] ;
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std ;

int main () {
  int N ;
  cin >> N ;
  long long line[N] ;
  long long A[N] = {} , B[N] ={};
  for(int i= 0 ; i < N ; i++ ) cin >> line[i] ;
  A[0] = 0 ;
  for(int i = 0 ; i < N ; i++ ) A[i+1] += line[i+1] + A[i];
  int ans = 0 ;
  sort(line,line+N+1) ;
  int tmp = 0 ;
  int count = 1 ;
  for(int i = 0 ; i <= N ; i++ ){
    if(tmp==A[i]){
      ans += count ;
      count++ ;
    } else {
      tmp = S[i];
      count =  1 ;
    }
  }
  cout << ans << endl ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:13: error: 'S' was not declared in this scope
   21 |       tmp = S[i];
      |             ^
Language: C++

#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int a[334334],cnt[334334];int n,memo=0,ans=0,cnta=0;
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n){
		memo+=a[i];
		cnt[i]=memo;
	}
	sort(cnt,cnt+n);
	rep(i,n){
		if(cnt[i]==0)cnta++;
	}
	rep(i,n){
		if(cnt[i]==cnt[i+1])continue;
		ans+=((s64)(upper_bound(cnt,cnt+n,cnt[i])-lower_bound(cnt,cnt+n,cnt[i])))*(upper_bound(cnt,cnt+n,cnt[i])-lower_bound(cnt,cnt+n,cnt[i])-1)/2;
	}
	cout<<ans+cnta<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: 's64' was not declared in this scope
   19 |                 ans+=((s64)(upper_bound(cnt,cnt+n,cnt[i])-lower_bound(cnt,cnt+n,cnt[i])))*(upper_bound(cnt,cnt+n,cnt[i])-lower_bound(cnt,cnt+n,cnt[i])-1)/2;
      |                        ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define nn 65536*4
#define ll long long
msp<ll,ll> cnt;ll a[nn];ll s[nn];
ll n;
int main()
{
	ll ans=0;cnt[0]=1;
	cin>>n;for(int i=1;i<=n;i++) 
		scanf("%lld",&a[i]),s[i]=s[i-1]+a[i],ans+=cnt[s[i]]++;
	cout<<ans;
    return 0;
}

Compiler output:
a.cc:5:1: error: 'msp' does not name a type
    5 | msp<ll,ll> cnt;ll a[nn];ll s[nn];
      | ^~~
a.cc: In function 'int main()':
a.cc:9:18: error: 'cnt' was not declared in this scope; did you mean 'int'?
    9 |         ll ans=0;cnt[0]=1;
      |                  ^~~
      |                  int
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
signed main(){
	 map<int ,int>mp;
	 int ans=0;
	 int n,cnt=0;
	 cin>>n;
	 ++mp[0];
	 rep(i,n){
		 int wa;
		 cin>>wa;
		 cnt+=wa;
		 ++mp[cnt];
       }
       for(auto i=mp.begin();i!=mp.end();++i){
		   ans+=i->second*(i->second-1)/2;
	   }
	   cout<<ans<<endl;
   }
}

Compiler output:
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
signed main(){
	 map<int int>mp;
	 int n,cnt=0;
	 cin>>n;
	 ++mp[0];
	 rep(i,n){
		 int wa;
		 cin>>wa;
		 cnt+=wa;
		 ++mp[cnt];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:13: error: 'long long long' is too long for GCC
    3 | #define int long long
      |             ^~~~
a.cc:6:18: note: in expansion of macro 'int'
    6 |          map<int int>mp;
      |                  ^~~
a.cc:3:18: error: 'long long long' is too long for GCC
    3 | #define int long long
      |                  ^~~~
a.cc:6:18: note: in expansion of macro 'int'
    6 |          map<int int>mp;
      |                  ^~~
a.cc:6:21: error: wrong number of template arguments (1, should be at least 2)
    6 |          map<int int>mp;
      |                     ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:9:14: error: invalid types 'int[int]' for array subscript
    9 |          ++mp[0];
      |              ^
a.cc:14:22: error: invalid types 'int[long long int]' for array subscript
   14 |                  ++mp[cnt];
      |                      ^
a.cc:15:2: error: expected '}' at end of input
   15 | }
      |  ^
a.cc:5:14: note: to match this '{'
    5 | signed main(){
      |              ^
Language: Java

import java.util.*;
public class Main {
    public static void main(String[]$) {
        Scanner sc = new Scanner(System.in);
        int n=Integer.parseInt(sc.next());
        long[] a=new long[n+1];
        a[0]=0;
        HashMap<Integer,Integer> m=new HashMap<>();
        m.put(a[0],0);
        for (int i = 1; i <n+1; i++) {
            a[i]=a[i-1]+Integer.parseInt(sc.next());
            m.put(a[i],0);
        }
        long ans=0;
        for(int i=0;i<=n;i++){
            ans+=m.get(a[i]);
            m.put(a[i],m.get(a[i])+1);
        }
        System.out.println(ans);
    }
}


Compiler output:
Main.java:9: error: incompatible types: long cannot be converted to Integer
        m.put(a[0],0);
               ^
Main.java:12: error: incompatible types: long cannot be converted to Integer
            m.put(a[i],0);
                   ^
Main.java:17: error: incompatible types: long cannot be converted to Integer
            m.put(a[i],m.get(a[i])+1);
                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
3 errors
Language: Java

import java.util.*;
public class Main {
    public static void main(String[]$) {
        Scanner sc = new Scanner(System.in);
        int n=Integer.parseInt(sc.next());
        int[] a=new int[n+1];
        a[0]=0;
        HashMap<Long,Integer> m=new HashMap<>();
        m.put(a[0],0);
        for (int i = 1; i <n+1; i++) {
            a[i]=a[i-1]+Long.parseLong(sc.next());
            m.put(a[i],0);
        }
        long ans=0;
        for(int i=0;i<=n;i++){
            ans+=m.get(a[i]);
            m.put(a[i],m.get(a[i])+1);
        }
        System.out.println(ans);
    }
}


Compiler output:
Main.java:9: error: incompatible types: int cannot be converted to Long
        m.put(a[0],0);
               ^
Main.java:11: error: incompatible types: possible lossy conversion from long to int
            a[i]=a[i-1]+Long.parseLong(sc.next());
                       ^
Main.java:12: error: incompatible types: int cannot be converted to Long
            m.put(a[i],0);
                   ^
Main.java:17: error: incompatible types: int cannot be converted to Long
            m.put(a[i],m.get(a[i])+1);
                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
4 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  int n;
  cin>>n;
  set<ll> se;
  se.insert(0);
  ll s=0;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    s+=a;
    se.insert(s);
  }
  cout<<n+1-s.size();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: request for member 'size' in 's', which is of non-class type 'long long int'
   16 |   cout<<n+1-s.size();
      |               ^~~~
Language: C++

#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
 
using namespace std;
 
int n,a[200010],q=1,g;
long long int xx,sm=0,b[200010];
vector<int> s;

vector<int> akrk(int target[],int size){ 
    vector<int> result;
    int repeats=1,number=target[0];
    for(int i=1;i<size;i++){
        if(number==target[i])repeats++;
        else{
            number=target[i];
            result.push_back(repeats);
            repeats=1;
        }
    }
    result.push_back(repeats);
    return result;
}

int main(){
    scanf("%d",&n);
    b[0]=0;
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        b[i+1]=b[i]+a[i];
    }
    sort(b,b+n+1);
    g=b[0];
    s=akrk(b,n+1);
    
    for(int itr:s){
        printf("%d\n",itr);
        sm+=itr*(itr-1)/2;
    }
    printf("%lld\n",sm);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:12: error: cannot convert 'long long int*' to 'int*'
   45 |     s=akrk(b,n+1);
      |            ^
      |            |
      |            long long int*
a.cc:21:22: note:   initializing argument 1 of 'std::vector<int> akrk(int*, int)'
   21 | vector<int> akrk(int target[],int size){
      |                  ~~~~^~~~~~~~
Language: C++

/*
For Bantako San
By shyyhs.

Using hash to insert and search for a perticular number.
Every insert and search is O(1) ideally.
*/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;
#define ll long long
#define MASK 0x000FFFFF // number&MASK means get the last 20 bits of the number
#define HASH 0x00055555
#define Hsize ((1<<21)-1) //same as pow(2,21)-1
#define MAXN 200001
ll sumZ; //sum from the beginning
int Ai; //This is Ai in the problem, we use it only once so array is not necessary.
int N; //N in the problem

struct T
{
    int number, times, next;
}hashBucket[MAXN];
int top;
int hashIndex[Hsize];


//x->hash(x)
inline int hashFunc(ll x)
{
    return (x&(MASK));
}

//add the current sumZ to the hash table
void addToHash(ll sumZ)
{
    bool addDone = 0;
    int index, HsumZ;
    HsumZ = hashFunc(sumZ);
    for (index=hashIndex[HsumZ]; hashBucket[index].next>0; index=hashBucket[index].next)
        if (hashBucket[index].number == sumZ) // there is already that number in the hashbucket
        {
            hashBucket[index].times++;
            addDone = 1;
            break;
        }
    if (hashBucket[index].number==sumZ)
        hashBucket[index].times++;
    else
    {
        hashIndex[HsumZ]=(++top);
        hashBucket[top].number = sumZ;
        hashBucket[top].times = 1;
        hashBucket[top].next = index;
    }
}

void init()
{
    memset(hashBucket,-1,sizeof(hashBucket));
    scanf("%d",&N);
    addToHash(0);
    for (int i=0; i<N; ++i)
    {
        scanf("%d",&Ai);
        sumZ=sumZ+Ai;
        addToHash(sumZ);
    }
}

void work()
{
    ll answer=0;
    for (int i=1; i<=top; ++i)
    {
        //cout<<hashBucket[i].number<<" "<<hashBucket[i].times<<" "<<hashBucket[i].next<<endl;
        answer=answer+(((hashBucket[i].times)*(hashBucket[i].times-1))>>1) ;
        //cout<<answer<<endl;
    }
    cout<<answer<<endl;
}
    
int main()
{
    init();
    work();
    return 0;
}


Compiler output:
a.cc: In function 'void init()':
a.cc:63:5: error: 'memset' was not declared in this scope
   63 |     memset(hashBucket,-1,sizeof(hashBucket));
      |     ^~~~~~
a.cc:13:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include<cmath>
  +++ |+#include <cstring>
   13 | using namespace std;
Language: C++

#include<cstdio>
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<queue>
using  ll = long long;
using namespace std;

int main(){
  int n; cin >> n;
  ll a[n+1];
  ll temp = 0;
  ll total = 0;
  for(int i = 0; i < n; i++){
    cin >> temp;
    total += temp;
    a[i] = total;    
  }

  a[n] = 0;
  sort(a, a+n+1);
  ll temp = 1;
  ll ans = 0;

  for(int i = 1; i < n+1; i++){
    if(a[i] == a[i-1]){
      temp++;
    } else {
      ans += temp*(temp-1)/2;
      temp = 1;
    }
  }
  ans += temp*(temp - 1)/2;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:6: error: redeclaration of 'll temp'
   22 |   ll temp = 1;
      |      ^~~~
a.cc:12:6: note: 'll temp' previously declared here
   12 |   ll temp = 0;
      |      ^~~~
Language: C++

#include<cstdio>
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<queue>
#define ll = long long;
using namespace std;

int main(){
  int n; cin >> n;
  ll a[n+1];
  ll temp = 0;
  ll total = 0;
  for(int i = 0; i < n; i++){
    cin >> temp;
    total += temp;
    a[i] = total;    
  }

  a[n] = 0;
  sort(a, a+n+1);
  ll temp = 1;
  ll ans = 0;

  for(int i = 1; i < n+1; i++){
    if(a[i] == a[i-1]){
      temp++;
    } else {
      ans += temp*(temp-1)/2;
      temp = 1;
    }
  }
  ans += temp*(temp - 1)/2;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: expected primary-expression before '=' token
    6 | #define ll = long long;
      |            ^
a.cc:11:3: note: in expansion of macro 'll'
   11 |   ll a[n+1];
      |   ^~
a.cc:6:14: error: expected primary-expression before 'long'
    6 | #define ll = long long;
      |              ^~~~
a.cc:11:3: note: in expansion of macro 'll'
   11 |   ll a[n+1];
      |   ^~
a.cc:11:6: error: 'a' was not declared in this scope
   11 |   ll a[n+1];
      |      ^
a.cc:6:12: error: expected primary-expression before '=' token
    6 | #define ll = long long;
      |            ^
a.cc:12:3: note: in expansion of macro 'll'
   12 |   ll temp = 0;
      |   ^~
a.cc:6:14: error: expected primary-expression before 'long'
    6 | #define ll = long long;
      |              ^~~~
a.cc:12:3: note: in expansion of macro 'll'
   12 |   ll temp = 0;
      |   ^~
a.cc:12:6: error: 'temp' was not declared in this scope; did you mean 'tm'?
   12 |   ll temp = 0;
      |      ^~~~
      |      tm
a.cc:6:12: error: expected primary-expression before '=' token
    6 | #define ll = long long;
      |            ^
a.cc:13:3: note: in expansion of macro 'll'
   13 |   ll total = 0;
      |   ^~
a.cc:6:14: error: expected primary-expression before 'long'
    6 | #define ll = long long;
      |              ^~~~
a.cc:13:3: note: in expansion of macro 'll'
   13 |   ll total = 0;
      |   ^~
a.cc:13:6: error: 'total' was not declared in this scope
   13 |   ll total = 0;
      |      ^~~~~
a.cc:6:12: error: expected primary-expression before '=' token
    6 | #define ll = long long;
      |            ^
a.cc:22:3: note: in expansion of macro 'll'
   22 |   ll temp = 1;
      |   ^~
a.cc:6:14: error: expected primary-expression before 'long'
    6 | #define ll = long long;
      |              ^~~~
a.cc:22:3: note: in expansion of macro 'll'
   22 |   ll temp = 1;
      |   ^~
a.cc:6:12: error: expected primary-expression before '=' token
    6 | #define ll = long long;
      |            ^
a.cc:23:3: note: in expansion of macro 'll'
   23 |   ll ans = 0;
      |   ^~
a.cc:6:14: error: expected primary-expression before 'long'
    6 | #define ll = long long;
      |              ^~~~
a.cc:23:3: note: in expansion of macro 'll'
   23 |   ll ans = 0;
      |   ^~
a.cc:23:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |   ll ans = 0;
      |      ^~~
      |      abs
Language: C++

#include<cstdio>
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<queue>
#define ll long long;
using namespace std;

int main(){
  int n; cin >> n;
  ll a[n+1];
  ll temp = 0;
  ll total = 0;
  for(int i = 0; i < n; i++){
    cin >> temp;
    total += temp;
    a[i] = total;    
  }

  a[n] = 0;
  sort(a, a+n+1);
  ll temp = 1;
  ll ans = 0;

  for(int i = 1; i < n+1; i++){
    if(a[i] == a[i-1]){
      temp++;
    } else {
      ans += temp*(temp-1)/2;
      temp = 1;
    }
  }
  ans += temp*(temp - 1)/2;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:11:3: note: in expansion of macro 'll'
   11 |   ll a[n+1];
      |   ^~
a.cc:11:6: error: 'a' was not declared in this scope
   11 |   ll a[n+1];
      |      ^
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:12:3: note: in expansion of macro 'll'
   12 |   ll temp = 0;
      |   ^~
a.cc:12:6: error: 'temp' was not declared in this scope; did you mean 'tm'?
   12 |   ll temp = 0;
      |      ^~~~
      |      tm
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:13:3: note: in expansion of macro 'll'
   13 |   ll total = 0;
      |   ^~
a.cc:13:6: error: 'total' was not declared in this scope
   13 |   ll total = 0;
      |      ^~~~~
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:22:3: note: in expansion of macro 'll'
   22 |   ll temp = 1;
      |   ^~
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:23:3: note: in expansion of macro 'll'
   23 |   ll ans = 0;
      |   ^~
a.cc:23:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |   ll ans = 0;
      |      ^~~
      |      abs
Language: C++

#include<cstdio>
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<queue>
#define ll long long;
using namespace std;

int main(){
  int n; cin >> n;
  ll a[n+1];
  ll temp = 0;
  ll total = 0;
  for(int i = 0; i < n; i++){
    cin >> temp;
    total += temp;
    a[i] = total;    
  }

  a[n] = 0;
  sort(a, a+n+1);
  ll temp = 1;
  ll ans = 0;

  for(int i = 1; i < n+1; i++){
    if(a[i] == a[i-1]){
      temp++;
    } else {
      ans += temp*(temp-1)/2;
      temp = 1;
    }
  }
  ans += temp*(temp - 1)/2
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:11:3: note: in expansion of macro 'll'
   11 |   ll a[n+1];
      |   ^~
a.cc:11:6: error: 'a' was not declared in this scope
   11 |   ll a[n+1];
      |      ^
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:12:3: note: in expansion of macro 'll'
   12 |   ll temp = 0;
      |   ^~
a.cc:12:6: error: 'temp' was not declared in this scope; did you mean 'tm'?
   12 |   ll temp = 0;
      |      ^~~~
      |      tm
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:13:3: note: in expansion of macro 'll'
   13 |   ll total = 0;
      |   ^~
a.cc:13:6: error: 'total' was not declared in this scope
   13 |   ll total = 0;
      |      ^~~~~
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:22:3: note: in expansion of macro 'll'
   22 |   ll temp = 1;
      |   ^~
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:23:3: note: in expansion of macro 'll'
   23 |   ll ans = 0;
      |   ^~
a.cc:23:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |   ll ans = 0;
      |      ^~~
      |      abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int n;
	cin>>n;
	
	long long int sum=0,x,a[200001];
	a[0]=0;
	for (int i = 1; i <= n; i++){
		cin>>x;
		sum+=x;
		a[i]=sum;
	}

	sort(a,a+n+1);

	long long int ans=0
	int count=1;
	for (int i = 1; i <= n; i++){
		if(a[i]==a[i-1])
			count++;
		else{
			ans+=count*(count-1)/2;
			count=1;
		}
	}
	ans+=count*(count-1)/2;  //最後のチェックの反映

	cout<<ans<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: expected ',' or ';' before 'int'
   19 |         int count=1;
      |         ^~~
a.cc:22:30: error: no post-increment operator for type
   22 |                         count++;
      |                              ^~
a.cc:24:42: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   24 |                         ans+=count*(count-1)/2;
      |                                     ~~~~~^~
a.cc:25:31: error: overloaded function with no contextual type information
   25 |                         count=1;
      |                               ^
a.cc:28:26: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   28 |         ans+=count*(count-1)/2;  //最後のチェックの反映
      |                     ~~~~~^~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;
int main()
{
	int n,a[200010];
	long long sum[200010];
	cin >> n;
	sum[0] = 0;
	for(int i=1; i<=n; i++){
		cin >> a[i];
		sum[i] = sum[i-1] + a[i];
	}
	sort(sum,sum+n+1);
	long long ans = 0
    long long now = 0;
  	long long cnt = 1;
	for(int i=1; i<=n; i++){
		if(now == sum[i]){
			cnt++;
		}
		else{
			ans += (cnt * (cnt-1)) / 2;
			now = sum[i];
			cnt = 1;
		}
	}
	cout << ans + (cnt * (cnt-1)) / 2 << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: expected ',' or ';' before 'long'
   17 |     long long now = 0;
      |     ^~~~
a.cc:20:20: error: 'now' was not declared in this scope
   20 |                 if(now == sum[i]){
      |                    ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	ll a[200000];
	cin >> n;
	REP(i, n) cin >> a[i];

	ll sum[200000], mem = 0;
	map<int, ll> mp;
	int ans = 0;

	REP(i, n){
		mem += a[i];
		sum[i] = mem;
		if(sum[i] == 0) ans++;
		mp[sum[i]]++;
	}
	
	for(auto itr = mp.begin(); itr != mp.end(); ++itr){
		if(itr->second >= 2) ans += nCr(itr->second, 2);
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:48: error: no matching function for call to 'nCr(long long int&, int)'
   51 |                 if(itr->second >= 2) ans += nCr(itr->second, 2);
      |                                             ~~~^~~~~~~~~~~~~~~~
a.cc:24:10: note: candidate: 'template<class T> T nCr(T, T)'
   24 | inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
      |          ^~~
a.cc:24:10: note:   template argument deduction/substitution failed:
a.cc:51:48: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   51 |                 if(itr->second >= 2) ans += nCr(itr->second, 2);
      |                                             ~~~^~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n+1]={};
  for(int i=1;i<=n;i++){
    cin >> a[i];
    a[i] += a[i-1];
  }
  sort(a,a+n+1);
  int ans = 0, cnt = 0, prev = -1;
  for(int i = 0, i < n+1; i++){
    if(a[i] != prev){
      if(cnt >= 2){
        ans += cnt * (cnt - 1) / 2;
        cnt = 1;
        prev = a[i];
      }
    }else{
      cnt++;
      if(i == n){
        ans += cnt * (cnt - 1) / 2;
      }
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: expected ';' before '<' token
   13 |   for(int i = 0, i < n+1; i++){
      |                   ^~
      |                   ;
a.cc:13:20: error: expected primary-expression before '<' token
   13 |   for(int i = 0, i < n+1; i++){
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  long long a[n],s[n+1];
  s[0]=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    s[i+1]=a[i]+s[i];
  }
  sort(s.begin(),s.end());
  long long b=s[0],c=0,d=1;
  for(int i=1;i<=n;i++){
    if(b==s[i]
    

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: request for member 'begin' in 's', which is of non-class type 'long long int [(n + 1)]'
   12 |   sort(s.begin(),s.end());
      |          ^~~~~
a.cc:12:20: error: request for member 'end' in 's', which is of non-class type 'long long int [(n + 1)]'
   12 |   sort(s.begin(),s.end());
      |                    ^~~
a.cc:15:15: error: expected ')' at end of input
   15 |     if(b==s[i]
      |       ~       ^
      |               )
a.cc:15:15: error: expected statement at end of input
a.cc:15:15: error: expected '}' at end of input
a.cc:14:24: note: to match this '{'
   14 |   for(int i=1;i<=n;i++){
      |                        ^
a.cc:15:15: error: expected '}' at end of input
   15 |     if(b==s[i]
      |               ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  long long a[n];
  for(int i=0;i<n;i++){
    cint>>a[i];
  }
  long long c=0;
  for(int i=0;i<n;i++){
    long long b=a[i];
    if(b==0)
      c++;
    for(int j=i+1;j<n;j++){
      b+=a[j];
      if(b==0)
        c++;
    }
  }
  cout<<c;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cint' was not declared in this scope; did you mean 'uint'?
    8 |     cint>>a[i];
      |     ^~~~
      |     uint
Language: C++

#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
using namespace std;
signed main(){
	int n,x=1,ans=0,j=0;
	cin >> n;
	vec(a,n);
	vec(s,n);
	cin >> a[0];
	s[0]= a[0];
	FOR(i,1,n){
		cin >> a[i];
		s[i] = s[i-1] + a[i];
	}
	sort(s.begin(),s.end());
	REP(j,n){
        if(s[j]== 0){
            ans++:
        }
        else if(s[j] > 0){
            break;
        }
    }
	REP(i,n){
		if(s[i] == s[i+1]){
			x += 1;
		}
		else{
			ans = ans + x * (x-1) / 2;
			x = 1;
		}
	}
	cout << ans << endl;
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: expected ';' before ':' token
   22 |             ans++:
      |                  ^
      |                  ;
Language: C++

#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
using namespace std;
signed main(){
	int n,x=1,ans=0,j=0;
	cin >> n;
	vec(a,n);
	vec(s,n);
	cin >> a[0];
	s[0]= a[0];
	FOR(i,1,n){
		cin >> a[i];
		s[i] = s[i-1] + a[i];
	}
	sort(s.begin(),s.end());
	REP(j,n){
        if(s[i]== 0){
            ans++:
        }
        else if(s[i] > 0){
            break;
        }
    }
	REP(i,n){
		if(s[i] == s[i+1]){
			x += 1;
		}
		else{
			ans = ans + x * (x-1) / 2;
			x = 1;
		}
	}
	cout << ans << endl;
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: 'i' was not declared in this scope
   21 |         if(s[i]== 0){
      |              ^
a.cc:22:18: error: expected ';' before ':' token
   22 |             ans++:
      |                  ^
      |                  ;
Language: Java

import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] sum = new long[n+1];
        for(int i = 1; i < n+1; i++){
            sum[i] = sum[i-1] + sc.nextInt();
        }
        Arrays.sort(sum);
        long ans = 0;
        int tmp = -1, prev = sum[0];
        for(int i = 0; i < sum.length; i++){
            if(sum[i] == prev) tmp++;
            else{
                tmp = 0;
                prev = sum[i];
            }
            ans += tmp;
        }
        System.out.println(ans);
    }
}




Compiler output:
Main.java:14: error: incompatible types: possible lossy conversion from long to int
        int tmp = -1, prev = sum[0];
                                ^
Main.java:19: error: incompatible types: possible lossy conversion from long to int
                prev = sum[i];
                          ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  long long ans=0,array[200000],n,c=1,S[200001];
  cin>>n;
  S[0]=0;
  for(int i=0;i<n;i++){
    cin>>array[i];
  }
  for(int i=1;i<=n;i++){
    S[i]=S[i-1]+array[i-1];
  }
  sort(S,S+n+1);
  for(int i=0;i<n;i++){
    if(S[i]==S[i+1]){
      if(i==n-1){
        c++;
        ans+=c*(c-1)/2;
      }
    }
      c++;
      i++;
    }else{
      ans+=c*(c-1)/2;
      c=1;
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:6: error: 'else' without a previous 'if'
   24 |     }else{
      |      ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  long long ans=0,array[200000],n,c=1,S[200001];
  cin>>n;
  S[0]=0;
  for(int i=0;i<n;i++){
    cin>>array[i];
  }
  for(int i=1;i<=n;i++){
    S[i]=S[i-1]+array[i-1];
  }
  sort(S,S+n+1);
  for(int i=0;i<n;i++){
    if(S[i]==S[i+1]){
      if(i==n-1){
        c++;
        ans+=c*(c-1)/2;
      }
      c++;
      i++;
    }else{
      ans+=c*(c-1)/2;
      c=1;
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:2: error: expected '}' at end of input
   28 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^