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

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

int main(){
  long long ans=0,array[200000],n,sort[200001];
  cin>>n;
  sort[0]=0;
  for(int i=0;i<n;i++){
    cin>>array[i];
  }
  for(int i=1;i<=n;i++){
    sort[i]=sort[i-1]+array[i-1];
  }
  sort(sort,sort+n+1);
  for(int i=0;i<=n;i++){
    while(sort[i]==sort[i+1]){
      ans++;
      i++;
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: 'sort' cannot be used as a function
   14 |   sort(sort,sort+n+1);
      |   ~~~~^~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define int long long
#define itn int
#define pr pair<int,int>
using namespace std;
int main(){
	int n,a[200000],z=1,zz=1,zzz=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(i) a[i]+=a[i-1];
	}
	sort(a,a+n);
	for(int i=0;i<n;i++){
		if(i){
			if(a[i]==a[i-1]) z++;
			else{
				zzz+=zz/2;
				z=1;
				zz=1;
			}
			zz*=z;
		}
	}
}
			
			

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

#include<cstdio>
#include<algorithm>
using namespace std;
int a[300000];
int s[400000];
int main(void) {
  int n;
  scanf("%d",&n);
  for(int i=0; i<n; i++)
    scanf("%d",&a[i]);
  s[0]=a[0]
  for(int i=0; i<n; i++)
    s[i+1]=s[i]+a[i+1];
  sort(s, s+n);
  int res=0;
  for(int i=0; i<n-1; i++)
    if(s[i]==s[i+1]) res++;
  printf("%d\n", res);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: expected ';' before 'for'
   11 |   s[0]=a[0]
      |            ^
      |            ;
   12 |   for(int i=0; i<n; i++)
      |   ~~~       
a.cc:12:16: error: 'i' was not declared in this scope
   12 |   for(int i=0; i<n; i++)
      |                ^
Language: C

#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
  long long int a,sum[200001];
  int n,p;
  long ans=0;
  scanf("%d",&n);
  scanf("%lld",&a);
  sum[0]=a;
  for(int i=0;i<n;i++){
    scanf("%lld",&a);
    sum[i+1]=sum[i]+a;
  }
  sort(sum,sum+n);
  sum[n]=sum[n-1]+1;
  a=sum[0];
  p=0;
  for(int i=1;i<=n;i++){
    if(a!=sum[i]){
      ans+=(long)(i-p)*(i-p-1)/2;
      if(a==0)
        ans+=(long)(i-p);
      a=sum[i];
      p=i;
    }
  }
  printf("%ld\n",ans);
}

Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include <bits\stdc++.h>

#define maxn (200000 + 8)

using namespace std;

int n;
long long sum[maxn];

int main() {
    while (scanf("%d",&n)==1) {
        sum[0]=0;
        for (int i=1;i<=n;++i) {
            int a;
            scanf("%d",&a);
            sum[i]=sum[i-1]+a;
        }
        sort(sum,sum+n+1);
        unsigned long long res=0llu,cnt=1llu;
        for (int i=1;i<=n;++i) {
            if (sum[i]==sum[i-1]) {
                ++cnt;
                if (i==n) res+=cnt*(cnt-1llu)/2llu;
            }
            else {
                res+=cnt*(cnt-1llu)/2llu;
                cnt=1llu;
            }
        }
        printf("%llu\n",res);
    }
    return 0;
}


Compiler output:
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include <bits\stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++


#include <iostream>
#include <string>
using namespace std;

int main() {
     int N;
    cin >> N;
    
    long long A[200050];
    for (int i = 0; i < N; ++i) cin >> A[i];
    
    long long S[N + 1];
    S[0] = 0;
    for (int i = 1; i <= N; ++i){
        S[i] = S[i-1] + A[i-1];
    }
    
sort(S, S + N + 1);
    
    int res = 0;
    int m = 1;
    
    for (int i=0; i < N; ++i) {
        if ( S[i] == S[i+1]) {
            ++m;
            
            if (i == N - 1) {
                if (S[i] != 0 ) res += m * (m-1) /2;
                else {
                    res += m - 1 + (m-1) * (m-2) /2;
                }
            }
        }
        else {
            if (S[i] != 0 ) res += m * (m-1) /2;
            else {
                res += m - 1 + (m-1) * (m-2) /2;
            }
            m = 1;
        }   
    }
    cout << res << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:1: error: 'sort' was not declared in this scope; did you mean 'short'?
   19 | sort(S, S + N + 1);
      | ^~~~
      | short
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	long long int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	long long int sum=0;
	int cunt[0]=1;
	long long int ans=0;
	for(int i=0;i<n;i++){
		sum+=a[i];
		ans+=cunt[sum];
		cunt[sum]++;
	}
	
	
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: array must be initialized with a brace-enclosed initializer
   14 |         int cunt[0]=1;
      |                     ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	long long int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	long long int sum=0;
	int cunt[0]=1;
	long long int ans=0
	for(int i=0;i<n;i++){
		sum+=a[i];
		ans+=cunt[sum];
		cunt[sum]++;
	}
	
	
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: array must be initialized with a brace-enclosed initializer
   14 |         int cunt[0]=1;
      |                     ^
a.cc:16:9: error: expected ',' or ';' before 'for'
   16 |         for(int i=0;i<n;i++){
      |         ^~~
a.cc:16:21: error: 'i' was not declared in this scope
   16 |         for(int i=0;i<n;i++){
      |                     ^
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    int couint = 0;
    for(int j = 0; j < n; j++){
      int b = 0;
      for(int i = 0; i < n; i++){
        b += a[i];
        if(b == 0)
          count++;
      }
    }
    System.out.println(count);
  }
}

Compiler output:
Main.java:13: error: cannot find symbol
          count++;
          ^
  symbol:   variable count
  location: class Main
Main.java:16: error: cannot find symbol
    System.out.println(count);
                       ^
  symbol:   variable count
  location: class Main
2 errors
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int *v = new int[n];
  for(int i=0;i<n;i++){
    cin >> v[i];
  }
  int l=0;
  int r=1;

  int cnt=0:
  for(l=0;l<n-1;l++){
    for(r=1;l<n;r++){
      int calc = 0;
      for(int i=l;i<r;i++){
        calc+=v[i];
      }
      if(calc==0){
        cnt++;
      }
    }
  }
  delete(v);
  cout << cnt; 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: expected ',' or ';' before ':' token
   13 |   int cnt=0:
      |            ^
a.cc:14:20: error: expected ';' before ')' token
   14 |   for(l=0;l<n-1;l++){
      |                    ^
      |                    ;
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n;
  int[] v;
  cin >> n;
  v = new int[n];
  for(int i=0;i<n;i++){
    cin >> v[i];
  }
  int l=0;
  int r=1;

  int cnt=0:
  for(l=0;l<n-1;l++){
    for(r=1;l<n;r++){
      int calc = 0;
      for(int i=l;i<r;i++){
        calc+=v[i];
      }
      if(calc==0){
        cnt++;
      }
    }
  }

  cout << cnt; 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:6: error: structured binding declaration cannot have type 'int'
    5 |   int[] v;
      |      ^~
a.cc:5:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:5:6: error: empty structured binding declaration
a.cc:5:9: error: expected initializer before 'v'
    5 |   int[] v;
      |         ^
a.cc:7:3: error: 'v' was not declared in this scope
    7 |   v = new int[n];
      |   ^
a.cc:14:12: error: expected ',' or ';' before ':' token
   14 |   int cnt=0:
      |            ^
a.cc:15:20: error: expected ';' before ')' token
   15 |   for(l=0;l<n-1;l++){
      |                    ^
      |                    ;
Language: Java

import java.util.*;
public class MyClass {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int arr[] = new int[n+1];
        arr[0] = 0;
        arr[1] = sc.nextInt();
        Map<Integer, Integer> map = new HashMap<>();
        map.put(arr[0], 1);
        for(int i=2;i<1+n;i++){
            arr[i] = arr[i-1] + sc.nextInt();
        }
        for(int i=1;i<n+1;i++){
            if(map.containsKey(arr[i])){
                map.put(arr[i], map.get(arr[i])+1);
            } else map.put(arr[i], 1);
        }
        long ans =0L;
        for(Map.Entry<Integer, Integer> mape: map.entrySet()){
            if(mape.getValue()>0){
                ans+= (mape.getValue())* (mape.getValue()-1) / 2;
            }
        }
        System.out.println(ans); return;
    }
}


Compiler output:
Main.java:2: error: class MyClass is public, should be declared in a file named MyClass.java
public class MyClass {
       ^
1 error
Language: C++

#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
  int num,a,ans;
  scanf("%d",&num);
  vector<long> n(num+1);
  n[0] = (long)0;
  for(int i = 1;i <= num;i++){
    scanf("%d",&a);
    n[i] = n[i-0]+a;
  }
  auto base = n.begin();
  auto next = base+1;
  sort(base,n.end());
  int accord = 1;
  ans = 0;
  while(base < n.end()-1){
    if(base == next){
      accord++;
    }else{
      count += accord*(accord-1)/2;
      base = next;
      accord = 1;
    }
    next++;
  }
  printf("%d",ans);
  return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:34: error: overloaded function with no contextual type information
   23 |       count += accord*(accord-1)/2;
      |                                  ^
Language: C++

#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
  int num,a,ans;
  scanf("%d",&num);
  vector<long> n(num+1);
  n[0] = (long)0;
  for(int i = 1;i <= num;i++){
    scanf("%d",&a);
    n[i] = n[i-0]+a;
  }
  auto base = n.begin();
  auto next = base+1;
  sort(b,n.end());
  int accord = 1;
  ans = 0;
  while(base < n.end()-1){
    if(base == next){
      accord++;
    }else{
      count += accord*(accord-1)/2;
      base = next;
      accord = 1;
    }
    next++;
  }
  printf("%d",ans);
  return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:8: error: 'b' was not declared in this scope
   16 |   sort(b,n.end());
      |        ^
a.cc:23:34: error: overloaded function with no contextual type information
   23 |       count += accord*(accord-1)/2;
      |                                  ^
Language: C++

#include <stdio.h>
#include
int main(void){
  int num;
  scanf("%d",&num);
  long n[num+1];
  n[0] = 0;
  int a,count;
  for(int i = 1;i <= num;i++){
    scanf("%d",&a);
    n[i] = n[i-1]+a;
    for(int j = 0;j < i;j++){
      if(n[j]==n[i])count++;
    }
  }
  printf("%d",count);
}

Compiler output:
a.cc:2:9: error: #include expects "FILENAME" or <FILENAME>
    2 | #include
      |         ^
Language: C++

#include <stdio.h>
int main(void){
  int num;
  scanf("%d",&num);
  int n[num];
  for(int i = 0;i < num;i++){
    scanf("%d",n+i);
  }
  int total;
  int count = 0;
  for(int i = 0;i < num;i++){
    toal = n[i];
    if(total==0)count++;
    for(int j = i+1;j < num;j++){
      total += n[j];
      if(total == 0)count++;
    }
  }
  printf("%d",count);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'toal' was not declared in this scope; did you mean 'total'?
   12 |     toal = n[i];
      |     ^~~~
      |     total
Language: C++

#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;

#define rep(i,n) for(long int i=0;i<n;i++)
#define Rep(i,n0,n) for(long int i=n0;i<n;i++)
#define Com(i,j,n) for(long int i=0;i<n-1;i++)for(long int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;

long int com(long int a){
	return (a==0) ?  0:(a*(a-1))/2;
}



long int main (){
	long int NNN;
	cin >> NNN;
	long int temp;
	long int a[NNN+1];
	a[0]=0;
	vector <long int> sum;
	rep(i,NNN){
		cin >>a[i+1];
		a[i+1] += a[i];
		sum.push_back(a[i+1]);
	}

	sort(sum.begin(),sum.end());

	temp=INF;
	long int count=1;
	long int anscount=0;

	rep(i,NNN){
		if(i==0){
			temp = sum[0];
			continue;
		}

		else if(temp==sum[i]){
			count ++;
		}

		else if(temp!=sum[i]){
			anscount += com(count);
			if(temp==0){
				anscount += count;
			}
			temp = sum[i];
			count =1;
		}

	}
	anscount += com(count);
	if(temp==0) anscount += count;


	cout << anscount << endl;

	return 0;
}


Compiler output:
a.cc:24:6: error: '::main' must return 'int'
   24 | long int main (){
      |      ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  int N;
  cin >> N;
  ll a[200100];
  for (int i=0;i<N;i++){
    cin >> t;
    if(i==0){
      a[0]=t;
      continue;
    }
    a[i]=a[i-1]+t;
  }
  sort(a,a+N);
  ll ans=0;
  ll k=1;
  for(int i=0;i<N;i++){
    if(a[i]==a[i+1]){
      k++;
    }
    else{
      ans+=k*(k-1)/2;
      k=1;
    }
  }
  cout << ans+k*(k-1/2);
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:20:12: error: 't' was not declared in this scope
   20 |     cin >> t;
      |            ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int sum=0,count=0;
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      sum+=a[j];
      if(sum==0){
	count++;
      }
    }
    cout<<count<<endl;
    return 0;
  }


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

def solve():
N,L=map(int,input().split())
a=[0]+[L-int(input())for _ in[0]*N]
l=[]
cumsum,dir=0,0
for n,prev in zip(a[1:],a):
if dir==0 and n>prev or dir==1 and n<prev:
cumsum+=n
else:
l.append(cumsum)
cumsum=n+prev
dir^=1
else:
l.append(cumsum)
print(max(l))
if __name__=="__main__":
solve()
()


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def solve():
      | ^~~
Language: C++

def solve():
    N,L=map(int,input().split())
    a=[0]+[L-int(input())for _ in[0]*N]
    l=[]
    cumsum,dir=0,0
    for n,prev in zip(a[1:],a):
        if dir==0 and n>prev or dir==1 and n<prev:
            cumsum+=n
        else:
            l.append(cumsum)
            cumsum=n+prev
            dir^=1
    else:
        l.append(cumsum)
    print(max(l))
if __name__=="__main__":
    solve()


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def solve():
      | ^~~
Language: C++

// Zero-Sum Ranges

#include <cstdio>
#include <unordered_set>
using namespace std;

unordered_set<long long int> sum_set({});

int main()
{
	int n = 0;
	int num = 0;
	int cnt = 0;
	long long int sum = 0;
	scanf("%d", &n);
	sum_set.clear();
	for(int i=0; i<n; ++i)
	{
		scanf("%d", &num);
		sum += num;
		if(sum_set.find(sum) != sum_set.end())
			++cnt;
		else
			sum_set.add(sum);
	}
	printf("%d\n", cnt);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: 'class std::unordered_set<long long int>' has no member named 'add'
   24 |                         sum_set.add(sum);
      |                                 ^~~
Language: C++

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  ll n, a[200001], result = 0;
  map<int, int> count;
  cin >> n;
  FOR(i, 0, n) cin >> a[i];
  FOR(i, 1, n) {
    a[i] += a[i - a];
    count[a[i]]++;
  }
  count[a[0]]++;

  for(it = mp.begin(); it != mp.end(); it++) {
    if (it->second - 1) {
      FOR(i, 0, it->second) result += i + 1;
    }
  }

  result += count[0];
  cout << result << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: invalid operands of types 'll' {aka 'long long int'} and 'll [200001]' {aka 'long long int [200001]'} to binary 'operator-'
   25 |     a[i] += a[i - a];
      |               ~ ^ ~
      |               |   |
      |               |   ll [200001] {aka long long int [200001]}
      |               ll {aka long long int}
a.cc:30:7: error: 'it' was not declared in this scope; did you mean 'int'?
   30 |   for(it = mp.begin(); it != mp.end(); it++) {
      |       ^~
      |       int
a.cc:30:12: error: 'mp' was not declared in this scope
   30 |   for(it = mp.begin(); it != mp.end(); it++) {
      |            ^~
Language: C++

#include <iostream>
using namespace std;
int main()
{
  int length;
  int* chain;
  
  cin >> length;
  chain= new int[length];
  
  for(int i = 0; i < length; i++)
    cin >> chain[i];

  int count = 0;
 
  for(int i = 0; i < length; i++)
  {
    int sum = chain[i];
    for(int j = i + 1; j < length; j++)
    {
        if(sum == 0) count++;
    }
    }
  }
  
  cout << count;
    
 }


Compiler output:
a.cc:26:3: error: 'cout' does not name a type
   26 |   cout << count;
      |   ^~~~
a.cc:28:2: error: expected declaration before '}' token
   28 |  }
      |  ^
Language: C++

#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>

#define REP(i,x,y) for(int i=(int)(x);i<(int)(y);i++)
#define RREP(i,x,y) for(int i=(int)(x);i>=(int)(y);i--)
#define all(x) (x).begin(),(x).end()

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

typedef long long ll;
typedef long long int;

using namespace std;

const int MAX_N = 200000;
int N;
int A[MAX_N];
ll sums[MAX_N];
map<ll, int> cmb;

int solve() {
    int answer = 0;

    ll sum = 0;
    sums[0] = 0;
    REP(i,0,N) {
        sum += A[i];
        sums[i] = sum;
    }

    cmb.clear();
    cmb[0] = 1;
    REP(i,0,N) {
        ll key = sums[i];
        if(cmb.count(key) == 0) cmb[key] = 0;
        cmb[key]++;
    }

    for (map<ll, int>::iterator it = cmb.begin(); it != cmb.end(); ++it){
        ll key = it->first;
        int cnt = it->second;

        eprintf("key: %d, cnt: %d\n", key, cnt);

        if (cnt <= 1) continue;

        answer += cnt * (cnt - 1) / 2;
    }

    return answer;
}

signed main() {
    // to shorten execution time for iostream
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N;
    REP(i,0,N) cin >> A[i];
    cout << solve() << "\n";
}


Compiler output:
a.cc:26:19: error: declaration does not declare anything [-fpermissive]
   26 | typedef long long int;
      |                   ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long N,A[300000],count = 0,m = 0;
  cin >> N;
  for(int i = 0;i<N;i++)
  {
    cin >> a[i];
  }
  for(int i = 0;i<N;i++)
  {
    for(int k = i+1;k<N;k++)
    {
      m = a[i]+a[k];
      if(m == 0){count++;}
    }
  }
  cout << m << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: 'a' was not declared in this scope
    9 |     cin >> a[i];
      |            ^
a.cc:15:11: error: 'a' was not declared in this scope
   15 |       m = a[i]+a[k];
      |           ^
Language: C++

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

const int M=1E9+7;

unsigned int doit(int i,int j){
	if (i==j) return 0;
	if (j-i==1) return 1;
	int mid=(i+j)/2;
	unsigned int ret=(doit(i,mid)+doit(mid+1,j))%M;
	ll p = (1LL * (mid-i+1) * (j-mid))%M;
	ret = (ret + p)%M;
	return ret;
}

int main(){
	int n,cin>>n;
	unsigned int s=doit(0,n-1);
	cout << s+1;
	return 0;
}

Compiler output:
a.cc: In function 'unsigned int doit(int, int)':
a.cc:11:9: error: 'll' was not declared in this scope
   11 |         ll p = (1LL * (mid-i+1) * (j-mid))%M;
      |         ^~
a.cc:12:22: error: 'p' was not declared in this scope
   12 |         ret = (ret + p)%M;
      |                      ^
a.cc: In function 'int main()':
a.cc:17:18: error: expected initializer before '>>' token
   17 |         int n,cin>>n;
      |                  ^~
Language: C++

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	
	static void inc(Map<Long, Integer> map, long value) {
		Integer nVal = map.get(value);
		nVal = nVal == null ? 1 : nVal + 1;
		map.put(value, nVal);
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int N = sc.nextInt();
		Map<Long, Integer> acums = new HashMap<>();
		long acum = 0, tmp;
		inc(acums, acum);
		for (int i = 0; i < N; i++) {
			tmp = sc.nextInt();
			acum += tmp;
			inc(acums, acum);
		}
		long ans = 0;
		for (int cant : acums.values()) {
			ans += cant * (long) (cant - 1) / 2;
		}
		System.out.println(ans);
	}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.BufferedReader;
      | ^~~~~~
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.InputStreamReader;
      | ^~~~~~
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.util.HashMap;
      | ^~~~~~
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.Map;
      | ^~~~~~
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.Scanner;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
    7 | public class Main {
      | ^~~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
void main(){
 int n,i,j,sum=0;
 int *x;
x = calloc(n, sizeof(int));
 for(i=0;i<n;i++)
    scanf("%d ",&x[i]);
 
scanf("%s",x);
 for(i=0;i<n;i++){
   if(x[i]==0) sum++;
  for(j=0;j<i;j++){
        if(x[i]+x[j]=0)  sum++;
}
}
}

Compiler output:
main.c: In function 'main':
main.c:14:21: error: lvalue required as left operand of assignment
   14 |         if(x[i]+x[j]=0)  sum++;
      |                     ^
Language: C

#include<stdio.h>
#include<stdlib.h>
void main(){
 int n,i,j,sum=0;
 int *x;
 scanf("%d",&n);
 x = calloc(n, sizeof(int));
scanf("%s",x);
 for(i=0;i<n;i++){
   if(x[i]==0) sum++;
  for(j=0;j<i;j++){
        if(x[i]+x[j]=0)  sum++;
}
}
}

Compiler output:
main.c: In function 'main':
main.c:12:21: error: lvalue required as left operand of assignment
   12 |         if(x[i]+x[j]=0)  sum++;
      |                     ^
Language: C

#include<stdio.h>
#include<stdlib.h>
void main(){
 int n,i,j,sum=0;
 int *x;
 scanf("%d",&n);
 x = calloc(n, sizeof(int));
scanf("%s",
 for(i=0;i<n;i++){
   if(x[i]==0) sum++;
  for(j=0;j<i;j++){
        if(x[i]+x[j]=0)  sum++;
}
}
}

Compiler output:
main.c: In function 'main':
main.c:9:2: error: expected expression before 'for'
    9 |  for(i=0;i<n;i++){
      |  ^~~
main.c:14:2: error: expected ';' before '}' token
   14 | }
      |  ^
      |  ;
   15 | }
      | ~
Language: C++

#include<stdio.h>

int main(){
    int n = 0;
    int i,sum=ans=0;
    int a[2*100000] = {0};

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(int j = 0;j<n;j++){
        for(i=j;i<n;i++){
            sum+=a[i];
            if(!sum){
                ans++;
            }
        }
    }
    printf("%d\n",ans);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:15: error: 'ans' was not declared in this scope
    5 |     int i,sum=ans=0;
      |               ^~~
Language: C++

#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
 
using namespace std;
 
const int MAX = 200001;
 
int main() {
	int N;
	int A[MAX];
	int S[MAX];
 
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (i == 0)S[i] = A[i];
		else S[i] = S[i - 1] + A[i];
	}
 
	sort(S, S + N);
 
	long long ans = 0;
	int prev = 0;
	long long cnt = 1;
 
	for (int i = 0; i < N; i++) {
		if (S[i] == prev) {
			cnt++;
		}
		else {
			ans += cnt * (cnt - 1) / 2;
			prev = S[i];
			cnt = 1;
		}
	}
	ans += cnt * (cnt - 1) / 2;
　　if(S[N - 1] == 0)ans -= 1;
 
	cout << ans << endl;
 
	return 0;
	
}

Compiler output:
a.cc:49:1: error: extended character 　 is not valid in an identifier
   49 | 　　if(S[N - 1] == 0)ans -= 1;
      | ^
a.cc:49:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:49:1: error: '\U00003000\U00003000if' was not declared in this scope
   49 | 　　if(S[N - 1] == 0)ans -= 1;
      | ^~~~~~
Language: C++

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

map<int,int> mp;

int main()
{
    int n;

    cin >> n;

    for(int i = 1 ; i<=n ; i++)
    {
        int x;

        cin >> x;

        sum+=x;

        ans+=mp[sum];

        mp[sum]++;
    }

    cout << ans;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'sum' was not declared in this scope
   18 |         sum+=x;
      |         ^~~
a.cc:20:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |         ans+=mp[sum];
      |         ^~~
      |         abs
a.cc:25:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |     cout << ans;
      |             ^~~
      |             abs
Language: C++

#include<cstdio>
#include<iostream>
typedef long long ll;
using namespace std;



int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N,count = 0;
  string s;
  cin >> N;
  ll s[N]= {};
  cin >> s;
  for (int i = 0; i < N; i++){
    cin >> s[i];
  }
  for (int i = 0; i < N; i++){
    for (int j = N-1 ; j > i ; j--){
      ll sum = 0;
      sum += s[j];
      if (sum == 0) count++;
    }
  }
  cout << count;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:6: error: conflicting declaration 'll s [N]'
   14 |   ll s[N]= {};
      |      ^
a.cc:12:10: note: previous declaration as 'std::string s'
   12 |   string s;
      |          ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
//typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

ll nc2(ll n){
    return (n*(n-1))/2;
}

int main(){
    int n; cin>>n;
    vector<int> v(n+1);
    rep(i,0,n+1){
        cin>>v[i];
        if(i)v[i]+=v[i-1];
    }
    
    Sort(v);
    
    ll ans=0;
    rep(i,0,n){
        ll count=1;
        while(v[i]==v[i+1]){
            count++;
            i++;   
        }
        ans+=nc2(count);
    }
    ans+=nc2(count);
    
    cout<<ans<<endl;
    
    
    
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:13: error: cannot resolve overloaded function 'count' based on conversion to type 'll' {aka 'long long int'}
   45 |     ans+=nc2(count);
      |          ~~~^~~~~~~
Language: C

#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
	return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}
long long gcd(long long x,long long y){
	return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
	return x/gcd(x,y)*y;
}

// konoshita kara kaku

int main(void){
	int n=in(),a,i,s[200002]={};
	long long c=1,ans=0;
	make_nC2(n);
	rep(i,n){
		a=in();
		if(!i)s[i]=a;
		else s[i]=s[i-1]+a;
	}
	s[n]=0;
	s[n+1]=inf;
	sort(s,n+1);
	rep(i,n+1){
		if(s[i]==s[i+1])c++;
		else{
			ans+=c*(c-1)/2;
			c=1;
		}
	}
	llprint(ans);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:87:9: error: implicit declaration of function 'make_nC2' [-Wimplicit-function-declaration]
   87 |         make_nC2(n);
      |         ^~~~~~~~
Language: C

#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
	return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}
long long gcd(long long x,long long y){
	return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
	return x/gcd(x,y)*y;
}

// konoshita kara kaku

int main(void){
	int n=in(),a,i,s[200001]={};
	long long c=1,ans=0;
	make_nC2(n);
	rep(i,n){
		a=in();
		if(!i)s[i]=a;
		else s[i]=s[i-1]+a;
	}
	s[n]=0;
	sort(s,n+1);
	rep(i,n+1){
		if(s[i]==s[i+1])c++;
		else{
			ans+=c*(c-1)/2;
			c=1;
		}
	}
	llprint(ans);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:87:9: error: implicit declaration of function 'make_nC2' [-Wimplicit-function-declaration]
   87 |         make_nC2(n);
      |         ^~~~~~~~
Language: Java

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new ZeroSumRanges().solve();
    }

    public void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < array.length; i++) {
            array[i] = sc.nextInt();
        }


        int count = 0;
        for (int i = 0; i < array.length; i++) {
            int sum = 0;
            for (int j = i; j < array.length; j++) {
                sum += array[j];
                if(sum == 0) {
                    count++;
                    break;
                }
            }
        }
        System.out.println(count);
    }
}


Compiler output:
Main.java:6: error: cannot find symbol
        new ZeroSumRanges().solve();
            ^
  symbol:   class ZeroSumRanges
  location: class Main
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    long long a,sum;
    map<long ,long>mp;
    for(int i=1;i<=n;i++)
    {
        cin>>a;
        sum+=a;
        ++mp[sum];
    }
    long long ans=0;
    for(auto second:mp)
    {
        ans=(mp.second*(mp.second-1))/2;
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'class std::map<long int, long int>' has no member named 'second'
   18 |         ans=(mp.second*(mp.second-1))/2;
      |                 ^~~~~~
a.cc:18:28: error: 'class std::map<long int, long int>' has no member named 'second'
   18 |         ans=(mp.second*(mp.second-1))/2;
      |                            ^~~~~~
Language: C++

N = input()

A = raw_input().split(' ')

total = 0
B = [0]
dic = {}

for i in range(N):
    total += int(A[i])
    B.append(total)

for b in B:
    if b in dic:
        dic[b] +=1
    else:
        dic[b] = 1
def C(n):
    return int(n*(n-1)/2)

ans = 0;

for k,v in dic.items():
    ans += C(v)

print(ans)


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = input()
      | ^
a.cc:9:1: error: expected unqualified-id before 'for'
    9 | for i in range(N):
      | ^~~
a.cc:23:1: error: expected unqualified-id before 'for'
   23 | for k,v in dic.items():
      | ^~~
Language: C++

#include <cstdio>
#include <unordered_map>

int main()
{
    int n;
    scanf("%d", &n);

    unordered_map<long long, int> mp;
    long long a, ans = 0, sum = 0;
    ++mp[0];
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &a);
        sum += a;
        ans += mp[sum];
        ++mp[sum];
    }
    printf("%lld\n", ans);
}
/*
累積和が等しい2点間の、連続する部分列の和は０になる。
ある累積和がn個存在するとき、n個の中から2点を選ぶ組み合わせはnC2通り。

累積和１が３回現れる場合。
1回目：
    sum += a;  // sum = 1
    ans += mp[sum];  // mp[1] = 0 <- 初回の累積和はカウントされない
    ++mp[sum];  // mp[1] = 1

2回目：
    sum += a;  // sum = 1
    ans += mp[sum];  // mp[1] = 1 <- 累積和１が２回出たのでansがカウントされる。2C2=1通り
    ++mp[sum];  // mp[1] = 2 <- 累積和１が２点に存在する

3回目：
    sum += a;  // sum = 1
    ans += mp[sum];  // mp[1] = 2 <- 累積和１が３回出たのでansがカウントされる。3C2=3通り
    ++mp[sum];  // mp[1] = 3 <- 累積和１が３点に存在する
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'unordered_map' was not declared in this scope
    9 |     unordered_map<long long, int> mp;
      |     ^~~~~~~~~~~~~
a.cc:9:5: note: suggested alternatives:
In file included from /usr/include/c++/14/unordered_map:41,
                 from a.cc:2:
/usr/include/c++/14/bits/unordered_map.h:109:11: note:   'std::unordered_map'
  109 |     class unordered_map
      |           ^~~~~~~~~~~~~
/usr/include/c++/14/unordered_map:67:13: note:   'std::pmr::unordered_map'
   67 |       using unordered_map
      |             ^~~~~~~~~~~~~
a.cc:9:19: error: expected primary-expression before 'long'
    9 |     unordered_map<long long, int> mp;
      |                   ^~~~
a.cc:11:7: error: 'mp' was not declared in this scope
   11 |     ++mp[0];
      |       ^~
Language: C++

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <utility>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(ll a=0;a<t;++a) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define int_maxvalue numeric_limits<int>::max()
ll mod = 1e9 + 7;
ll Comb(ll n) {
	return n*(n - 1) / 2;
}
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll>dp(n+1);
	for (int i = 0; i < n; i++) {
		dp[i + 1] = a[i] = 0;
	}
	dp[0] = 0;
	rep(i, n) {
		cin >> dp[i + 1];
		dp[i + 1] += dp[i];
	}
	ll ans = 0;
	Sort(dp);
	ll thiscontinue=0;
	for (int i = 1; i < n + 1; ++i) {
		if (dp[i] == dp[i - 1]) { thiscontinue++; }
		else {
			ans += Comb(thiscontinue);
			thiscontinue = 0;
		}
	}
	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:29: error: 'a' was not declared in this scope
   46 |                 dp[i + 1] = a[i] = 0;
      |                             ^
Language: C++

#include<iostream>
using namespace std;

typedef long long LL;

LL num_seq[200005];

int main() {
    LL N, idx = 0, count = 0, sum_num = 0, target;
    cin >> N;

    num_seq[0] = 0;
    for (int i = 1; i <= N; i++) {
        cin >> num_seq[i];
        num_seq[i] += num_seq[i - 1];
    }

    sort(num_seq, num_seq + N + 1);

    for (int i = 0; i <= N; i++) {
        target = num_seq[i];
        sum_num++;
        if (num_seq[i + 1] != target) {
            count += LL((sum_num * (sum_num - 1)) / 2);
            sum_num = 0;
        }
    }

    cout << count << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |     sort(num_seq, num_seq + N + 1);
      |     ^~~~
      |     short
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Agc023A {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        StringTokenizer tokn = new StringTokenizer(input.readLine());
        int [] values = new int [n];
        for (int i = 0; i < n; i++) {
            if (i == 0){
                values[i] = Integer.parseInt(tokn.nextToken());
            }else{
                values[i] = values[ i - 1] + Integer.parseInt(tokn.nextToken());
            }
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i +1; j < n; j++) {
                int sum =   values[j];
                if (i != 0){
                    sum -= values[i - 1];
                }
                if (sum == 0)
                    count++;
            }
        }
        System.out.println(count);
    }
}


Compiler output:
Main.java:5: error: class Agc023A is public, should be declared in a file named Agc023A.java
public class Agc023A {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
 
int main()
{
   map<ll, ll> mp;
   mp[0]++;
   int N;
   cin >> N;
   ll a, sum = 0;
   ll ans = 0;
   for(int i = 0; i < N; i ++)
    {
          cin >> a
         sum += a;
         ans += mp[sum];
        mp[sum] ++;
     }
    cout << ans << endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: expected ';' before 'sum'
   17 |           cin >> a
      |                   ^
      |                   ;
   18 |          sum += a;
      |          ~~~
Language: C

#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<climits>
#include<cstdlib>
#include<map>
#include<math.h>
using namespace std;
int main(){
  long long n;
  int a[1000001];

  cin >> n;
  for(long long i=0; i<n; i++){
    cin >> a[i];
  }
  int sa[1000001];
  sa[0] = 0;
  for(long long i=0; i<n; i++){
    sa[i+1] = sa[i] + a[i];
  }

  sort(sa, sa+n+1);
  long long k = 1;
  long long ans=0;
  for(long long i = 1; i<=n; i++){
    if(sa[i]==sa[i-1]) k++;
    else{
      ans += k*(k-1)/2;
      k = 1;
    }
  }
  cout << ans+k*(k-1)/2 << endl;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int getsum(int k){
    return k*(k-1)/2;
}
long long qSum[200003], n, num;
long long n;
long long num;
int main(int argc, char const *argv[])
{
    cin>>n;
    for (int i = 1; i <= n; ++i)
    {
        cin>>num;
        qSum[i] = qSum[i-1]+num;
    }
    sort(qSum+1, qSum+n+1);
    long long sum = 0;
    long long k = 1;
    for (int i = 1; i <= n; ++i)
    {
        if(qSum[i] == 0){
            sum++;
        }
        if(qSum[i] == qSum[i+1]&&i != n){
            k++;
        } else {
            sum += k*(k-1)/2;
            k = 1;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Compiler output:
a.cc:9:11: error: redefinition of 'long long int n'
    9 | long long n;
      |           ^
a.cc:8:25: note: 'long long int n' previously declared here
    8 | long long qSum[200003], n, num;
      |                         ^
a.cc:10:11: error: redefinition of 'long long int num'
   10 | long long num;
      |           ^~~
a.cc:8:28: note: 'long long int num' previously declared here
    8 | long long qSum[200003], n, num;
      |                            ^~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int n;
int num;
long long qSum[200001];
int getsum(int k){
    return k*(k-1)/2;
}
int main(int argc, char const *argv[])
{
    cin>>n;
    for (int i = 1; i <= n; ++i)
    {
        cin>>num;
        qSum[i] = qSum[i-1]+num;
    }
    sort(qSum, qSum+n+1);
    long long sum = 0;
    int k = 1;
    for (int i = 1; i <= n; i++)
    {
        if(qSum[i] ！= qSum[i-1]){
            sum += getsum(k);
            k = 1;
        } else {
            k++;
        }
    }
    cout<<sum+getsum(k)<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:23:19: error: expected ')' before '\U0000ff01'
   23 |         if(qSum[i] ！= qSum[i-1]){
      |           ~       ^~~
      |                   )
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <camth>
using namespace std;
const int maxn = 2e5+2;
long long num[maxn];
int main(){
    int n;
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d",&num[i]);
        if(i != 0)
            num[i] += num[i-1];//前缀和
    }
    sort(num,num+n);//从小到大排序
    long long ans = 0;//最终答案
    long long pair = 0;//前缀和相等的对数
    for(int i = 1; i < n; i++){
        if(num[i] == 0)
            ans++;
        if(num[i] = num[i - 1])//因为排好序，相等的必然是连续的
            pair++;
        if(num[i] != num[i - 1] && pair || i = n - 1 && pair){//一旦不相等了，就处理一次
            ans += (pair + 1) * pair / 2;//比如说有两对相等的，那么就是num[i-1],num[i],num[i+1],每两个之间的和都为0，就是组合数C(pair+1,2)
            pair = 0;//置为0，免得干扰后面的
        }
    }
    printf("%lld\n", ans);
return 0;
}

Compiler output:
a.cc:4:10: fatal error: camth: No such file or directory
    4 | #include <camth>
      |          ^~~~~~~
compilation terminated.
Language: C++


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int N;
    cin >> N;
    int A[N];
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    int count =  0;
    int sum = 0;
    int s[N+1];
    s[N] = INT_MAX;
    int p[N];
    for(int i=0;i<N;i++){
        p[i] = 0;
    }
    for(int i=0;i<N;i++) {
        sum = sum + A[i];
        s[i] = sum;
    }
    /*for(int i=0;i<N;i++){
        cout << s[i] <<" ";
    }
    cout <<"\n";
     */
    sort(s,s+N);
    int c = 0;
    for(int i=0;i<N;i++){
        if(s[i]==0) c++;
        else if(s[i]==s[i+1]) c++;
        if(s[i] != s[i+1] && c >0){
            //cout << i <<"\n";
            count += c * (c+1)/ 2;
            c = 0;
        }
    }

    cout << count <<"\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'INT_MAX' was not declared in this scope
   17 |     s[N] = INT_MAX;
      |            ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <algorithm>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>
 
using namespace std;
 
int main()
{
	int N, input, count = 0, ans = 0;
	long long sum = 0;
	vector<int> A;
	vector<long long> s;
 
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> input;
		A.push_back(input);
	}
 
	s.push_back(0);
	for (int i = 0; i < N; i++) {
		sum += A[i];
		s.push_back(sum);
	}
 
	sort(s.begin(), s.end());
 
	long long check = -1;
	for (int i = 0; i < N+1; ++i) {
		if (s[i] != check) {
			check = s[i];
			count = 0;
		}
		else
		{
			count++;
			ans += count;
		} 
	}
 
	cout << ans;
	char qq;
	cin >> qq;
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:50:18: error: expected '}' at end of input
   50 |         return 0;
      |                  ^
a.cc:14:1: note: to match this '{'
   14 | {
      | ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

const int MAX = 200000;
int main() {
    // データ読み込み
    static int N, A[MAX];
    cin >> N; // n=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

    int64_t sum[N+1];
    sum[0] = 0;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        sum[i+1] = sum[i] + a[i];
    }
    sort(sum, sum + N + 1, greater<int>());  // ruiseki[0:N+1] を大きい順にソート
	int num = 1;
	for (int i = 1;i <= N;i ++) {
		if (sum[i] == sum[i - 1]) num ++; // 累積和が同値になるものの個数
		else {
			res += (int64_t)num * (num - 1) / 2; // 総和が0になる区間の数
			num = 1;
		}
	}
	res += (int64_t)num * (num - 1) / 2;
    cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:11:40: error: 'a' was not declared in this scope
   11 |     for (int i = 0; i < N; ++i) cin >> a[i];
      |                                        ^
a.cc:17:29: error: 'a' was not declared in this scope
   17 |         sum[i+1] = sum[i] + a[i];
      |                             ^