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

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(){
    int N;
    cin >> N;
    int tmp = 1;
    for(int i=0; i<N; i++){
        y:
        if(IsPrime(tmp*10+1)){
            cout << tmp*10+1;
            if(i!=N-1) cout << " ";
        }
        else{
            tmp++;
            goto(y);
        }
    }
    cout << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: expected identifier before '(' token
   43 |             goto(y);
      |                 ^
a.cc:43:17: error: expected ';' before '(' token
   43 |             goto(y);
      |                 ^
      |                 ;
a.cc:43:18: error: 'y' was not declared in this scope
   43 |             goto(y);
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
int main(){
    int N;
    cin >> N;
    int a[60] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,
    179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281};
    for(int i=0; i<N; i++){
        cout << A[i];
        if(i!=N-1) cout << " ";
    }
    cout << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'A' was not declared in this scope
   16 |         cout << A[i];
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
int main(){
    int N;
    cin >> N;
    int a[60] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,
    179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281}
    for(int i=0; i<N; i++){
        cout << A[i];
        if(i!=N-1) cout << " ";
    }
    cout << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: expected ',' or ';' before 'for'
   15 |     for(int i=0; i<N; i++){
      |     ^~~
a.cc:15:18: error: 'i' was not declared in this scope
   15 |     for(int i=0; i<N; i++){
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
int main(){
    int N;
    cin >> N;
    int a = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,
    179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281}
    for(int i=0; i<N; i++){
        cout << A[i];
        if(i!=N-1) cout << " ";
    }
    cout << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: scalar object 'a' requires one element in initializer
   13 |     int a = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,
      |         ^
a.cc:15:5: error: expected ',' or ';' before 'for'
   15 |     for(int i=0; i<N; i++){
      |     ^~~
a.cc:15:18: error: 'i' was not declared in this scope
   15 |     for(int i=0; i<N; i++){
      |                  ^
Language: C++

#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define e cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++)
 
ll i,j,k,l,ii,jj;
ll n,m;
ll a,b,c;
ll h,w;

ll ans=0;
ll sum=0;
ll memo,num;
bool dame=false;
bool x[500005];//素数ならtrue

int main(){
	cin>>n;
	
	for(i=1;i<=500000;i++){
		x[i]=true;
	}
	x[1]=false;
	x[2]=true;
	for(i=1;i<=500000;i++){
		if(!x[i])continue;
		for(j=2;j*i<=500000;j++){
			x[i*j]=false;
		}
	}
	k=0;
	for(i=1;i<=500000;i++){
		if(x[i] && i%5==1 && k<n){
			pe(i);
			k++;
		}
	}
	e();

	
	return 0;
				
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:11: error: expected primary-expression before ')' token
   65 |         e();
      |           ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
        
int main(){
	int n; cin >> n;
	vector<long long> a(n,0);
	long long s[n+1];

	for(int i=0;i<n;i++){
		cin >> s[i]; 
	}
	
	map<long long, long long>nums;
	for(int i=0;i<n;i++){
		s[i+1] = s[i]+a[i];
	}
	for(int i=0;i<n;i++){
		nums[s[i]] ++;
	}

	long long res = 0;
	for(auto it: nums){
		long long num = it.second;
		res += num*(num-1)/2;
	}

	cout << res << endl;
		

	



}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'map' was not declared in this scope
   16 |         map<long long, long long>nums;
      |         ^~~
a.cc:4:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    3 | #include<algorithm>
  +++ |+#include <map>
    4 | #include<string>
a.cc:16:13: error: expected primary-expression before 'long'
   16 |         map<long long, long long>nums;
      |             ^~~~
a.cc:21:17: error: 'nums' was not declared in this scope
   21 |                 nums[s[i]] ++;
      |                 ^~~~
a.cc:25:22: error: 'nums' was not declared in this scope
   25 |         for(auto it: nums){
      |                      ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(), v.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;


int main()
{
  ll N,ans=0,temp;
  cin >> N;
  vector<ll> a(N), sum(N);
  rep(i,N)
  {
    cin >> A[i];
  }

  sum[0] = A[0];
  for (int i = 1; i < N; i++)
  {
    sum[i] = sum[i - 1] + A[i];
  }

  sort(all(sum));

  rep(i,N)
  {
    if (sum[i]==0)
    {
      ans++;
    }
    if(sum[i]>0)
      {
        temp = i;
        break;
      }
  }

  for (int i = temp; i < N-1; i++)
  {
    if(sum[i]==sum[i+1])
      ans++;
  }

  cout << ans << endl;


  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: 'A' was not declared in this scope
   22 |     cin >> A[i];
      |            ^
a.cc:25:12: error: 'A' was not declared in this scope
   25 |   sum[0] = A[0];
      |            ^
Language: C++

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

int main(){
  int N,count=1;
  cin>>N;
  ll ans=0;
  vector<ll> A(N);
  vector<ll> B(N+1);
  B.at(0)=0;
  for(int i=0; i<N; i++){
    cin>>A.at(i);
  }
  for(int i=1; i<N+1; i++){
    B.at(i)=A.at(i-1)+B.at(i-1);
  }
  sort(B.begin(),B.end());
  for(int i=1; i<=N; i++){
    if(B.at(i)==.at(i-1)){
      ans+=count;
      count++;//連続で同じ数が続いたら、nC2=n(n-1)/2=1+2+…+(n-1)と増えていく
    }
    else{
      count=1;
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: expected primary-expression before '.' token
   20 |     if(B.at(i)==.at(i-1)){
      |                 ^
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main() {

        int N; cin >> N;

        vector<int int> a(N, 0);

        for (int i = 0; i < N; ++i) cin >> a[i];

        vector<int int> s(N+1, 0);

        for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i];

        std::sort(s.begin(), s.end());

        int count = 0;

        int res = 0;


        for (int i = 0; i < N+1; ++i){
                if (i == 0) continue;

                if (s[i] == s[i-1]) {
                        count += 1;
                        res += count;
                }
                else count = 0;
        }

        cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: two or more data types in declaration of 'type name'
   11 |         vector<int int> a(N, 0);
      |                ^~~
a.cc:11:23: error: template argument 1 is invalid
   11 |         vector<int int> a(N, 0);
      |                       ^
a.cc:11:23: error: template argument 2 is invalid
a.cc:11:31: error: expression list treated as compound expression in initializer [-fpermissive]
   11 |         vector<int int> a(N, 0);
      |                               ^
a.cc:13:45: error: invalid types 'int[int]' for array subscript
   13 |         for (int i = 0; i < N; ++i) cin >> a[i];
      |                                             ^
a.cc:15:16: error: two or more data types in declaration of 'type name'
   15 |         vector<int int> s(N+1, 0);
      |                ^~~
a.cc:15:23: error: template argument 1 is invalid
   15 |         vector<int int> s(N+1, 0);
      |                       ^
a.cc:15:23: error: template argument 2 is invalid
a.cc:15:33: error: expression list treated as compound expression in initializer [-fpermissive]
   15 |         vector<int int> s(N+1, 0);
      |                                 ^
a.cc:17:38: error: invalid types 'int[int]' for array subscript
   17 |         for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i];
      |                                      ^
a.cc:17:47: error: invalid types 'int[int]' for array subscript
   17 |         for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i];
      |                                               ^
a.cc:17:54: error: invalid types 'int[int]' for array subscript
   17 |         for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i];
      |                                                      ^
a.cc:19:21: error: request for member 'begin' in 's', which is of non-class type 'int'
   19 |         std::sort(s.begin(), s.end());
      |                     ^~~~~
a.cc:19:32: error: request for member 'end' in 's', which is of non-class type 'int'
   19 |         std::sort(s.begin(), s.end());
      |                                ^~~
a.cc:29:22: error: invalid types 'int[int]' for array subscript
   29 |                 if (s[i] == s[i-1]) {
      |                      ^
a.cc:29:30: error: invalid types 'int[int]' for array subscript
   29 |                 if (s[i] == s[i-1]) {
      |                              ^
Language: Java

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] s = new int[n+1];
        s[0] = 0;
        for (int i=1;i<=n;i++){
            s[i]=s[i-1]+sc.nextInt();

        }
        Arrays.sort(s);
        int count = 1;
        int ans = 0;
        for (int i=0;i<n;i++){
            while (i<n&&s[i]==s[i+1]){
                i++;
                count++;
            }
            ans+=combination(count,2);
            count=1;
        }
        System.out.println(ans);
    }
    static long factorial(int num){
        if (num<2)return 1;
        else return num*factorial(num-1);
    }
    static int arraySum(int[] array){
        int ans = 0;
        for (int value : array) ans += value;
        return ans;
    }
    static long combination(int a, int b){
        return factorial(a)/(factorial(b)*factorial(a-b));
    }
    static double log(double base,double antilogarithm){
        return Math.log(antilogarithm)/Math.log(base);
    }
}


Compiler output:
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
Main.java:11: error: cannot find symbol
        Arrays.sort(s);
        ^
  symbol:   variable Arrays
  location: class Main
3 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int>A(N);
  int count=0;
  for(int i=0;i<N;i++)cin>>A[i];
  for(int i=0;i<N;i++){
    int ans=0;
    for(int j=1;j<=N-i;j++){
      ans+=B[j];
      if(ans==0)count++;
    }
  }
  cout<<count<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: 'B' was not declared in this scope
   12 |       ans+=B[j];
      |            ^
Language: Java

import java.util.*;
public class Main {


    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] ruiseki = new long[N+1];


        Map<Long,Integer> m = new HashMap<>();
        m.put(0,1);
        for (int i = 0; i < N ; i++) {
            int num = sc.nextInt();
            ruiseki[i+1] = ruiseki[i]+num;
            if(!m.containsKey(ruiseki[i+1])){
                m.put(ruiseki[i+1],1);
            }else{
                m.put(ruiseki[i+1],m.get(ruiseki[i+1])+1);
            }
        }
        long ans = 0;
        for (Map.Entry<Long,Integer> e : m.entrySet()) {
            long n  = (long) e.getValue();
            if(n>1)
            ans += n *(n-1) /2;
        }


        System.out.println(ans);

    }
}

Compiler output:
Main.java:13: error: incompatible types: int cannot be converted to Long
        m.put(0,1);
              ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: Java

import java.util.*;
public class Main {


    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] ruiseki = new long[N+1];


        Map<Long,Integer> m = new HashMap<>();
        m.put(0,1);
        for (int i = 0; i < N ; i++) {
            int num = sc.nextInt();
            ruiseki[i+1] = ruiseki[i]+num;
            if(!m.containsKey(ruiseki[i+1])){
                m.put(ruiseki[i+1],1);
            }else{
                m.put(ruiseki[i+1],m.get(ruiseki[i+1])+1);
            }
        }
        long ans = 0;
        for (Map.Entry<Integer,Integer> e : m.entrySet()) {
            long n  = (long) e.getValue();
            if(n>1)
            ans += n *(n-1) /2;
        }


        System.out.println(ans);

    }
}

Compiler output:
Main.java:13: error: incompatible types: int cannot be converted to Long
        m.put(0,1);
              ^
Main.java:24: error: incompatible types: Entry<Long,Integer> cannot be converted to Entry<Integer,Integer>
        for (Map.Entry<Integer,Integer> e : m.entrySet()) {
                                                      ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
s[j]==s[i];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:1: error: 's' was not declared in this scope
   18 | s[j]==s[i];
      | ^
a.cc:18:3: error: 'j' was not declared in this scope; did you mean 'jn'?
   18 | s[j]==s[i];
      |   ^
      |   jn
a.cc:18:9: error: 'i' was not declared in this scope
   18 | s[j]==s[i];
      |         ^
Language: C++

#include<bits/stdc++.h>
#include<set>
#include<map>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int>A(N);
  for (int i = 0; i < N; i ++) cin >> A[i];
  int sum(N + 1);
  map<int, int>f_s;
  sum[0] = 0;
  for (int i = 0; i < N; i ++) {
    sum[i + 1] = sum[i] + A[i];
    f_s[sum[i + 1]] ++;
  }
  int ans = 0;
  for (int i = 0; i < N; i ++) {
    ans += f_s[sum[i]];
    f_s[sum[i + 1]] --;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:6: error: invalid types 'int[int]' for array subscript
   12 |   sum[0] = 0;
      |      ^
a.cc:14:8: error: invalid types 'int[int]' for array subscript
   14 |     sum[i + 1] = sum[i] + A[i];
      |        ^
a.cc:14:21: error: invalid types 'int[int]' for array subscript
   14 |     sum[i + 1] = sum[i] + A[i];
      |                     ^
a.cc:15:12: error: invalid types 'int[int]' for array subscript
   15 |     f_s[sum[i + 1]] ++;
      |            ^
a.cc:19:19: error: invalid types 'int[int]' for array subscript
   19 |     ans += f_s[sum[i]];
      |                   ^
a.cc:20:12: error: invalid types 'int[int]' for array subscript
   20 |     f_s[sum[i + 1]] --;
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n;
  cin >> n;
  ll ans=0;
  map<ll,ll> m;
  ll a=0;
  rep(i,n){
    ll o;
    cin >> o;
    a+=o;
    m[o]++;
  }
  for(pair(ll,ll) b: m){
    ll v=b.second;
    ans+=(v-1)*v/2;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: missing template arguments before '(' token
   17 |   for(pair(ll,ll) b: m){
      |           ^
a.cc:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long
      |            ^~~~
a.cc:17:12: note: in expansion of macro 'll'
   17 |   for(pair(ll,ll) b: m){
      |            ^~
a.cc:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long
      |            ^~~~
a.cc:17:15: note: in expansion of macro 'll'
   17 |   for(pair(ll,ll) b: m){
      |               ^~
a.cc:22:1: error: expected primary-expression before '}' token
   22 | }
      | ^
a.cc:21:23: error: expected ')' before '}' token
   21 |   cout << ans << endl;
      |                       ^
      |                       )
   22 | }
      | ~                      
a.cc:17:6: note: to match this '('
   17 |   for(pair(ll,ll) b: m){
      |      ^
a.cc:22:1: error: expected primary-expression before '}' token
   22 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n;
  cin >> n;
  ll ans=0;
  map(ll,ll) m;
  ll a=0;
  rep(i,n){
    ll o;
    cin >> o;
    a+=o;
    m[o]++;
  }
  for(pair(ll,ll) b: m){
    ll v=b.second;
    ans+=(v-1)*v/2;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:6: error: missing template arguments before '(' token
    9 |   map(ll,ll) m;
      |      ^
a.cc:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long
      |            ^~~~
a.cc:9:7: note: in expansion of macro 'll'
    9 |   map(ll,ll) m;
      |       ^~
a.cc:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long
      |            ^~~~
a.cc:9:10: note: in expansion of macro 'll'
    9 |   map(ll,ll) m;
      |          ^~
a.cc:15:5: error: 'm' was not declared in this scope
   15 |     m[o]++;
      |     ^
a.cc:17:11: error: missing template arguments before '(' token
   17 |   for(pair(ll,ll) b: m){
      |           ^
a.cc:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long
      |            ^~~~
a.cc:17:12: note: in expansion of macro 'll'
   17 |   for(pair(ll,ll) b: m){
      |            ^~
a.cc:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long
      |            ^~~~
a.cc:17:15: note: in expansion of macro 'll'
   17 |   for(pair(ll,ll) b: m){
      |               ^~
a.cc:22:1: error: expected primary-expression before '}' token
   22 | }
      | ^
a.cc:21:23: error: expected ')' before '}' token
   21 |   cout << ans << endl;
      |                       ^
      |                       )
   22 | }
      | ~                      
a.cc:17:6: note: to match this '('
   17 |   for(pair(ll,ll) b: m){
      |      ^
a.cc:22:1: error: expected primary-expression before '}' token
   22 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  vector<int64_t>B(N);
  B.at(0)=A.at(0);
  for(int i=1;i<N;i++)
    B.at(i)=B.at(i-1)+A.at(i);
  map<int64_t,int64_t>M;
  for(int i=0;i<N;i++){
  if(M.count(B.at(i))
     M.at(B.at(i))++;
     else
     M[B.at(i)]=1;
  
  }int64_t ans=0;
     for(auto p:M){
     auto k=p.first;
       auto v=p.second;
       ans+=(v*(v-1))/2;
     
     }cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: expected ';' before 'M'
   15 |   if(M.count(B.at(i))
      |                      ^
      |                      ;
   16 |      M.at(B.at(i))++;
      |      ~                
a.cc:17:6: error: expected primary-expression before 'else'
   17 |      else
      |      ^~~~
a.cc:16:22: error: expected ')' before 'else'
   16 |      M.at(B.at(i))++;
      |                      ^
      |                      )
   17 |      else
      |      ~~~~             
a.cc:15:5: note: to match this '('
   15 |   if(M.count(B.at(i))
      |     ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<long long> a(n,0);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  vector<int> b(n+1,0);
  map<long long,long long> nums;
  for(int i=0;i<n;i++){
     b[i+1]=b[i]+a[i];
  }
  for(int i=0;i<n+1;i++) nums[s[i]]++;
  
  long long res=0;
  for(auto it:nums){
    long long num=it.second;
    res+=num*(num-1)/2;
  }
  cout<<res<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'map' was not declared in this scope
   12 |   map<long long,long long> nums;
      |   ^~~
a.cc:3:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    2 | #include<vector>
  +++ |+#include <map>
    3 | using namespace std;
a.cc:12:7: error: expected primary-expression before 'long'
   12 |   map<long long,long long> nums;
      |       ^~~~
a.cc:16:26: error: 'nums' was not declared in this scope
   16 |   for(int i=0;i<n+1;i++) nums[s[i]]++;
      |                          ^~~~
a.cc:16:31: error: 's' was not declared in this scope
   16 |   for(int i=0;i<n+1;i++) nums[s[i]]++;
      |                               ^
a.cc:19:15: error: 'nums' was not declared in this scope
   19 |   for(auto it:nums){
      |               ^~~~
Language: C++

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

#define rep3(i, s, n ,a) for (int i = (s); i < (int)(n); i+=a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

int main(){
    int n;
    cin >> n;
    vector<int> a;
    vector<long> sum;
    set<long> sum_list;
    rep(i, n){
        int num;
        cin >> num;
        a.push_back(num);
    }
    sum.push_back(0);
    sum_list.inset(0);
    long total=0;
    long minim=0, maxim=0;
    rep(i, n){
        total += a[i];
        sum.push_back(total);
        sum_list.insert(total);
        minim = min(minim, total);
        maxim = max(maxim, total);
    }
    int cnt=0;
    for(set<long>::iterator it=sum_list.begin();it!=sum_list.end();it++){
        int tmpcnt=0;
        rep(j, n+1){
            if(sum[j]==*it){
                tmpcnt++;
            }
        }
        cnt += tmpcnt * (tmpcnt - 1) / 2;
    }
    // rep2(i, sum_list.begin(), list_size){
    //     int tmpcnt=0;
    //     rep(j, n+1){
    //         if(sum[j]==sum_list[i]){
    //             tmpcnt++;
    //         }
    //     }
    //     cnt += tmpcnt * (tmpcnt - 1) / 2;
    // }
    cout << cnt << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: 'class std::set<long int>' has no member named 'inset'; did you mean 'insert'?
   20 |     sum_list.inset(0);
      |              ^~~~~
      |              insert
Language: C++

#include <iostream>
#include <map>

using namespace std;
map<long long, long long> S;
void print(){
    map<long long>::iterator it;
    long long ans=0
    for(it=S.begin;it!=S.end();it++){
        pair<long long, long long> item=*it;
        ans += item.second*(item.second-1)/2;
    }
    cout << ans << endl;
}

int main(){
    long long N, sum=0;
    long long A[200000];

    S[0] = 1;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
        sum += A[i];
        S[sum]++;
    }
    print();
    return 0;
}

Compiler output:
a.cc: In function 'void print()':
a.cc:7:18: error: wrong number of template arguments (1, should be at least 2)
    7 |     map<long long>::iterator it;
      |                  ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/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:7:30: error: expected initializer before 'it'
    7 |     map<long long>::iterator it;
      |                              ^~
a.cc:9:5: error: expected ',' or ';' before 'for'
    9 |     for(it=S.begin;it!=S.end();it++){
      |     ^~~
a.cc:9:20: error: 'it' was not declared in this scope; did you mean 'int'?
    9 |     for(it=S.begin;it!=S.end();it++){
      |                    ^~
      |                    int
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long a[100010],b[100010],ans;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	cin>>a[0];
	b[0]=a[0];
	for(int i=1; i<n; i++) {
		cin>>a[i];
		b[i]=b[i-1]+a[i];
	}
	for(int i=0; i<n; i++) {
		for(int j=i+2; j<n; j++) {
			if(b[j]==b[i]) {
				ans++;
			}
		}
	}
	for(int i=0; i<n; i++) {
		if(b[i]==0) {
			ans++;
		}
		cout<<ans;
	}

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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int n;
	cin>>n;
	vector<int> A;
	rep(i,n)cin>>A[i];
	//累積和
	vector<int> s(n+1,0);
	rep(i,n)s[i+1]=s[i]+A[i];
	
	//sort(s.begin(),s.end());
	
	map<int,int> hindo;
	rep(i,n+1){
		hindo(s[i])++;
	}
	
	ll sum=0;
	for(auto p:hindo){
		int n=p.second;
		sum+=n*(n-1)/2;
	}
	
	cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:22: error: no match for call to '(std::map<int, int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   19 |                 hindo(s[i])++;
      |                 ~~~~~^~~~~~
Language: C++

#include <bits/stdc++.h>
2
using namespace std;
3
 
4
int main() {
5
  int N,count=0;
6
  cin >> N;
7
  vector<int> vecA(N);
8
  vector<int> vecB(N+1,0);
9
  for(int i=0;i<N+1;i++) {
10
    if(i<N) cin >> vecA.at(i);
11
    if(0<i) vecB.at(i)=vecB.at(i-1)+vecA.at(i-1);
12
  }
13
  for(int i=0;i<N+1;i++) {
14
    for(int j=0;j<N+1;j++) {
15
      if(vecB.at(i)==vecB.at(j)) count++;
16
    }
17
    count--;
18
  }
19
  count=count/2;
20
  cout << count << endl;
21
}

Compiler output:
a.cc:2:1: error: expected unqualified-id before numeric constant
    2 | 2
      | ^
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 3
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<climits>

using namespace std;

void quick_sort(long long s[], long long left, long long right){
	long long p, l, r, t;
    l = left, r = right;
    p = s[(l+r)/2];
    while(1){
    	while(s[l] < p)
    		l++;
    	while(s[r] > p)
        	r--;
        if(l >= r) break;
        t = s[r];
        s[r] = s[l];
        s[l] = t;
        l++;r--;
    }
    if(left < l-1)
    	quick_sort(s, left, l-1);
    if(right > r+1)
    	quick_sort(s, r+1, right);
}

long long comb(long lng n, long long r){
	if(n == 0) return 1;
    else if(r == 0) return 1;
    else if(r == n) return 1;
    else return comb(n-1, r) + comb(n-1, r-1);
}

int main(){
    long long n, t, l, count = 0;
    cin >> n;
    long long a[n], s[n+2];
    
    for(int i = 0; i < n; i++){
    	cin >> t;
    	a[i] = t;
    }
    
    s[0] = 0;
    for(int i = 1; i < n+1; i++){
    	s[i] = a[i-1] + s[i-1];
    }
    
    //sort(s, s+n+1);
    quick_sort(s, 0, n);

    l = 0;s[n+1] = 1000000000000000LL;
    for(int i = 0; i <= n+1; i++){
    	if(s[i]!=s[l]){
        	count += comb(i-l, 2);
            l = i;
        }
    }
    
    cout << count << endl;
}







Compiler output:
a.cc:28:25: error: expected ',' or '...' before 'n'
   28 | long long comb(long lng n, long long r){
      |                         ^
a.cc: In function 'long long int comb(long int)':
a.cc:29:12: error: 'n' was not declared in this scope
   29 |         if(n == 0) return 1;
      |            ^
a.cc:30:13: error: 'r' was not declared in this scope
   30 |     else if(r == 0) return 1;
      |             ^
a.cc: In function 'int main()':
a.cc:56:30: error: too many arguments to function 'long long int comb(long int)'
   56 |                 count += comb(i-l, 2);
      |                          ~~~~^~~~~~~~
a.cc:28:11: note: declared here
   28 | long long comb(long lng n, long long r){
      |           ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

#define rep(i,n) for (int i=0; i<n; i++)

using namespace std;
typedef long long ll;

int main(){
  int N; cin >> N;
  vector<long long> a(N);
  rep(i,N) cin >> a[i];

  //累積和と連想配列
  vector<long long> s(N+1, 0);
  map<long long, long long> nums;
  rep(i,N) s[i+1] = s[i] + a[i];
  rep(i,N) nums[s[i]]++;

  //集計処理
  long long res = 0;
  for(auto it: nums){
    long long num = it.second;
    res += num*(num-1)/2; //numC_2
  }
  cout << res << endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'map' was not declared in this scope
   17 |   map<long long, long long> nums;
      |   ^~~
a.cc:4:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    3 | #include <algorithm>
  +++ |+#include <map>
    4 | 
a.cc:17:7: error: expected primary-expression before 'long'
   17 |   map<long long, long long> nums;
      |       ^~~~
a.cc:19:12: error: 'nums' was not declared in this scope
   19 |   rep(i,N) nums[s[i]]++;
      |            ^~~~
a.cc:23:16: error: 'nums' was not declared in this scope
   23 |   for(auto it: nums){
      |                ^~~~
Language: C++

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

int main(){
  int N; cin >> N;
  int a[N];
  for(int i=0; i<N; i++) cin >> a[i];
  int res = 0;
  for(int bit=0; bit < (1<<N); bit++){
    int sum = 0;
    for(int i=0; i<N; i++){
      if(bit & (1<<i)) sum += a[i]
    }
    if(sum == 0) res++;
  }
  cout << res << endl; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:35: error: expected ';' before '}' token
   14 |       if(bit & (1<<i)) sum += a[i]
      |                                   ^
      |                                   ;
   15 |     }
      |     ~
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-1; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値))
//vector<intなど> 変数名(要素数,初期値)
using namespace std;
typedef long long ll;
const int MAX = 510000;
const int INF =2000000000;
const int MOD = 1000000007;
//gcd,lcmセット
ll gcd(ll a, ll b){
   if (a%b == 0) return b;
   else return gcd(b, a%b);
}
ll lcm(ll a, ll b){	
   return a*b/gcd(a, b);
}
int pow_kai(int a, int n){//aのn乗を計算します。
  int x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a;
    }
    a = a*a;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}
// a^n mod を計算する
long long modPow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
// a^{-1} mod を計算する
ll modInv(ll a, ll mod) {
    return modPow(a, mod - 2, mod);
}

long long fac[MAX], finv[MAX], inv[MAX];

// combinationのテーブルを作る前処理
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;
    }
}
 
// 二項係数計算
 
bool isPrime(ll x){
    int i;
    if(x < 2)return false;
    else if(x == 2) return true;
    if(x%2 == 0) return false;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return false;
    return true;
}
//dfsではvector<vector<int>> g(n);で◎
int main() {
    ll n;
    cin>>n;
    ll a[n];
    REP(i,n) cin>>a[i];
    int cnt=0;
    REP(l,n){
        int sum=a[l];
        for(int r=l+1;r<n;r++){
            sum+=a[r];
            //cout<<"["<<l<<","<<r<<"):"<<sum<<endl;
            if(sum==0){
              cnt++;
            //cout<<"["<<l<<","<<r<<"):"<<sum<<endl;}
        }
    }
    cout<<cnt<<endl;
}

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

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

int main() {
    int n;
    cin >> n;
    int a[n];
    int s[n+1];
    s[0]=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        s[i+1]=s[i]+a[i];
    }
    int ans=0;
    sort(s.begin(),s.end());
    int count=1;
    for(int i=1;i<=n;i++){
        if(s[i]==s[i-1]){
            count++;
        }
        else if(s[i]!=s[i-1]){
            count=1;
        }
        if(count>=2){
            ans+=count-1;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: request for member 'begin' in 's', which is of non-class type 'int [(n + 1)]'
   15 |     sort(s.begin(),s.end());
      |            ^~~~~
a.cc:15:22: error: request for member 'end' in 's', which is of non-class type 'int [(n + 1)]'
   15 |     sort(s.begin(),s.end());
      |                      ^~~
Language: C++

n = int(input())
a = list(map(int,input().split()))
list_S = [0]
ans = 0
for i in range(n):
    list_S.append(list_S[i] + a[i])

list_S.sort()
pre = list_S[0]
acc = 1
for i in range(1,n+1):
    if list_S[i] == pre:
        acc += 1
    else:
        ans += acc * (acc-1) // 2
        pre = list_S[i]
        acc = 1

ans += acc * (acc-1) // 2

    
print(ans)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <bits/stdc++.h>

// #define fi first
// #define se second
#define rep(i, n) for (ll i=0;i<(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
#define WHITE 0  // 未訪問
#define BLACK 1  // 訪問ずみ

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 (a>b) { a=b; return 1; } return 0; }

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;

const ll M=1000000007ll;
const ll MOD=1000000007ll;
const ll MAX=100000001ll;
const int N=100000;
//const ll M = 1000000000+7;


struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n, -1){}
  int root(int x) {
    if(d[x]<0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y){
    x = root(x); y=root(y);
    if(x==y) return false;
    if (d[x]>d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) {return root(x)==root(y);}
  int size(int x) {return -d[root(x)];}
  int factor_size() {
    int ans=0;
    rep(i,d.size()){
      if (d[i]<0) {ans++;}
    }
    return ans;
  }
  
};
  
int main(){ 
  int n,m,k,q;
  cin >> n;

  int s[n+1];
  s[0]=0;
  rep(i, n ){
    cin >> q;
    s[i+1] = s[i] + q;
  }

  int ans = 0;
  sort(s, s+n+1);

  int cnt = 1;
  for (int i=0;i<n;i++ ){
    if (s[i]==s[i+1]) cnt++;
    else {
      ans += c*(c-1)/2;
      cnt = 1;
    }
  }
  ans += c*(c-1)/2;

  cout << ans <<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:70:14: error: 'c' was not declared in this scope
   70 |       ans += c*(c-1)/2;
      |              ^
a.cc:74:10: error: 'c' was not declared in this scope
   74 |   ans += c*(c-1)/2;
      |          ^
Language: C++

#include <map>
#include <vector>
#include <iostream>

using namespace std;
using ll = int64_t;

struct agc023_a{
  int N;
  vector<ll> A;
  map<ll, ll> M;
  void init(){
    cin >> N;
    A.resize(N);
    for(auto&& x:A)cin >> x;
  }
  
  void solve(){
    init();
    ll ans = 0LL;
    M[0] = 1;
    ll t = 0;
    for(auto&& x:A){
      t += x;
      M[t]++;
    }
    for(auto&& x:M){
      ans += x * (x - 1) / 2;
    }
    cout << ans << endl;
  }
  
};

int main(){
  agc023_a ins;
  ins.solve();
}

Compiler output:
a.cc: In member function 'void agc023_a::solve()':
a.cc:28:21: error: no match for 'operator-' (operand types are 'std::pair<const long int, long int>' and 'int')
   28 |       ans += x * (x - 1) / 2;
      |                   ~ ^ ~
      |                   |   |
      |                   |   int
      |                   std::pair<const long int, long int>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
                 from /usr/include/c++/14/bits/stl_tree.h:63,
                 from /usr/include/c++/14/map:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:28:23: note:   'std::pair<const long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   28 |       ans += x * (x - 1) / 2;
      |                       ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:28:23: note:   'std::pair<const long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>'
   28 |       ans += x * (x - 1) / 2;
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int main() {
 
  int N ;
  int ans = 0 ;
  cin >> N ;
  vector<int> A(N) ;
  rep(i,N) cin >> A.at(i) ;
  vector<int> S(N+1) ;
  S.at(0) = 0 ;
  rep(i,N) S.at(i+1) = S.at(i) + A.at(i) ;
  sort(S.begin(),S.end()) ;
  int count = 0 ;
  rep(i,N+1){
    if( S.at(i) == S.at(i+1) count++ ;
    else{
      ans += ( count+1 )*count / 2 ;
      count = 0 ;
       }
       }
  cout << ans << endl ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:29: error: expected ';' before 'count'
   18 |     if( S.at(i) == S.at(i+1) count++ ;
      |                             ^~~~~~
      |                             ;
a.cc:19:5: error: expected primary-expression before 'else'
   19 |     else{
      |     ^~~~
a.cc:18:39: error: expected ')' before 'else'
   18 |     if( S.at(i) == S.at(i+1) count++ ;
      |       ~                               ^
      |                                       )
   19 |     else{
      |     ~~~~                               
a.cc:23:8: error: expected primary-expression before '}' token
   23 |        }
      |        ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int N;
    cin >> N ;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    
    // 累積和
    vector<ll> s(N+1, 0);
    map<ll, ll> nums;
    REP(i, N) s[i+1] = s[i] + a[i];
    REP(i, N+1) nums[s[i]]++;

    // 集計
    ll ans = 0;
    for(auto it : nums) {
        ll num = it.second;
        ans += num * (num-1) / 2;
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:31: error: 'a' was not declared in this scope
   26 |     REP(i, N) s[i+1] = s[i] + a[i];
      |                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<long long> s(N + 1);
  s[0] = 0;
  for (int i = 0; i < N; i++) s[i + 1] = s[i] + a[i];
  map<long long,int> M;
  set<long long> S;
  for (int i = 0; i <= N; i++){
    if (!M.count(s[i])){
      M[s[i]] = 1;
      S.insert(s[i]);
    } else {
      M[s[i]]++;
    }
  }
  long long ans = 0;
  for (auto i : S){
    ans += M[i] * (M[i] - 1) / 2;
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:49: error: 'a' was not declared in this scope
   10 |   for (int i = 0; i < N; i++) s[i + 1] = s[i] + a[i];
      |                                                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1

int dp[200000][2];

int nCr(int n, int r)
{
       if(n<r) return 0;
       if(n==r) return dp[n][r] = 1;
       if(r==0) return dp[n][r] = 1;
       if(r==1) return dp[n][r] = n;
       if(dp[n][r]) return dp[n][r];
       return dp[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}

int main() {
  lli ans=0;
  int N;
  cin >>N;
  vector<lli> cumsum(N+1,0);
  rep (i, N)
  {
    if(i==0)
      continue;
    cin >> cumsum[i];
  cumsum[i] += cumsum[i-1];
  }
  sort(ALL(cumsum));
  
  lli judge=1000000001;
  lli keep =1;
  rep(i,1, N+1)
  {
    if(cumsum.at(i)==cumsum.at(i-1))
      {
      keep++;
    }
    else
      {
    ans+=nCr(keep,2);
      keep=1;
    }
    if(i==N)
      {
    ans+=nCr(keep,2);
      keep=1;
    }
    }
  cout << ans << endl;
}



Compiler output:
a.cc:39:15: error: macro "rep" passed 3 arguments, but takes just 2
   39 |   rep(i,1, N+1)
      |               ^
a.cc:3:9: note: macro "rep" defined here
    3 | #define rep(i, n) for (int i = 0;i < (int)(n);i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:39:3: error: 'rep' was not declared in this scope
   39 |   rep(i,1, N+1)
      |   ^~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int main() {
  int64_t n, s = 0, tmp = 0;
  cin >> n;
  vector<int64_t> a(n);
  rep(i, n){
    if(i == 0) cin >> v[i];
    else{
      int b;
      cin >> b;
      a[i] = a[i-1] + b;
    }
  }
  sort(a.begin(), a.end());
  rep(i, n-1){
    if(a[i] == a[i+1]){
      ++tmp;
      s += tmp;
    }
    else tmp = 0;
  }
  cout << s << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: 'v' was not declared in this scope
   11 |     if(i == 0) cin >> v[i];
      |                       ^
Language: Java

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		long[] a = new long[n];
		for(int i = 0; i < n; i++) {
			a[i] = stdIn.nextLong();
		}
		
		long[]s = new long[n+1];
		for(int i = 0; i < n; i++) {
			s[i+1] = s[i] + a[i];
		}
		Map<long,Integer> map = new HashMap<>();
		
		for(int i = 0; i < n+1; i++) {
			if(!map.containsKey(s[i])) {
				map.put(s[i], 0);
			}
			map.put(s[i], map.get(s[i])+1);
		}
		long cnt = 0;
		
		/*for(int i = 0; i < map.size(); i++) {
			if(map.get(s[i]) < 2) {
				continue;
			}else {
				cnt += map.get(s[i])*(map.get(s[i])-1)/2;
			}
		}*/
		
		for(long ss: map.keySet()) {
			if(map.get(ss) < 1) {
				continue;
			}else {
              	long n=map.get(ss);
				cnt += n*(n-1)/2;
			}
		}
		
		System.out.println(cnt);
		
	}

}


Compiler output:
Main.java:18: error: unexpected type
		Map<long,Integer> map = new HashMap<>();
		    ^
  required: reference
  found:    long
Main.java:40: error: variable n is already defined in method main(String[])
              	long n=map.get(ss);
              	     ^
2 errors
Language: Java

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		long[] a = new long[n];
		for(int i = 0; i < n; i++) {
			a[i] = stdIn.nextLong();
		}
		
		long[]s = new long[n+1];
		for(int i = 0; i < n; i++) {
			s[i+1] = s[i] + a[i];
		}
		Map<Long,Long> map = new HashMap<>();
		
		for(int i = 0; i < n+1; i++) {
			if(!map.containsKey(s[i])) {
				map.put(s[i], 0);
			}
			map.put(s[i], map.get(s[i])+1);
		}
		long cnt = 0;
		
		/*for(int i = 0; i < map.size(); i++) {
			if(map.get(s[i]) < 2) {
				continue;
			}else {
				cnt += map.get(s[i])*(map.get(s[i])-1)/2;
			}
		}*/
		
		for(long ss: map.keySet()) {
			if(map.get(ss) < 1) {
				continue;
			}else {
				cnt += map.get(ss)*(map.get(ss)-1)/2;
			}
		}
		
		System.out.println(cnt);
		
	}

}


Compiler output:
Main.java:22: error: incompatible types: int cannot be converted to Long
				map.put(s[i], 0);
				              ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error