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

#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>

using namespace std;

long long N,M,H,W;
long long A[200001];
long long B[200001] = {};
long long x[51][2] = {};
long long y[2][200] = {};
int ayasi[5] = {};
bool r[52] = {};
int check[102][102] = {};
long long result=0;
string S;
vector <long long>vl;
typedef pair<long long, long long> pl;
vector <pl> vpl;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (i == 0) {
			B[i] = A[i];
		}
		else {
			B[i] = B[i - 1] + A[i];
			if (B[i] == 0) {
				M++;
			}
		}
		vl.push_back(B[i]);

	}
	H = vl[vl.size() - 1];
	M += count(vl.begin(), vl.back(), H);
	sort(vl.begin(), vl.end());
	while (vl.size()>=2) {
		
		for (int i = 1; i < vl.size(); i++) {
			if (vl[i] != vl[0]) {
				M += i*(i - 1) / 2;
				vl.erase(vl.begin(), vl.begin() + i);
				break;
			}
			if (i == vl.size() - 1) {
				M += i*(i +1) / 2;
				vl.erase(vl.begin(), vl.end());
				break;
			}

		}
		
	}


	cout << M<<endl;
	return 0;
}


Compiler output:
a.cc:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
a.cc: In function 'int main()':
a.cc:44:19: error: no matching function for call to 'count(std::vector<long long int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, long long int&)'
   44 |         M += count(vl.begin(), vl.back(), H);
      |              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: candidate: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:   template argument deduction/substitution failed:
a.cc:44:19: note:   deduced conflicting types for parameter '_IIter' ('__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' and 'long long int')
   44 |         M += count(vl.begin(), vl.back(), H);
      |              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note:   candidate expects 4 arguments, 3 provided
Language: C++

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

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N; // n=10
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます len=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

	int ruiseki[N+1];
    ruiseki[0] = 0;
    int sum = 0;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        sum += a[i];
        ruiseki[i+1] = sum;
    }
    sort(ruiseki, ruiseki + N + 1, greater<int>());  // ruiseki[0:N+1] を大きい順にソート

	int same = 1;
    for (int i = 1; i < N + 1; i++) // 部分配列の長さ size = 2
    {
        int a = ruiseki[i];
        int b = ruiseki[i-1];
        if (a==b)
        {
            same++;
            res++
        }
        else
        {
            res += (same * (same-1)) / 2;
            same = 1;
        }
    res += (same * (same-1)) / 2;
    }
    cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:31:18: error: expected ';' before '}' token
   31 |             res++
      |                  ^
      |                  ;
   32 |         }
      |         ~
Language: C++

1. #include<iostream>
2. #include<algorithm>
3. using namespace std;
4. long f(int n) {
5. 	long abc = 1;
6. 	for (int i = n; i > n - 2; --i) {
7. 		abc = abc * i;
8. 	}
9. 	abc = abc / 2;
10. 	return abc;
11. }
12. int main() {
13. 	int n;
14. 	cin >> n;
15. 	int A[200000];
16. 	for (int i = 0; i < n; i++) cin >> A[i];
17. 	long long ans = 0;
18. 	int sum[20000];
19. 	sum[0] = A[0];
20. 	for (int i = 1; i < n; i++) {
21. 		sum[i] = sum[i - 1] + A[i];
22. 	}
23. 	for (int i = 0; i < n; i++) {
24. 		if (sum[i] == 0) ans++;
25. 	}
26. 	sort(sum, sum + n);
27. 	int a = 0;
28. 	int c;
29. 	while (a < n) {
30. 		c = sum[a];
31. 		int e = 0;
32. 		while (a < n&&sum[a] == c) e++, a++;
33. 		ans += f(e);
34. 	}
35. 	cout << ans;
36. }


Compiler output:
a.cc:1:4: error: stray '#' in program
    1 | 1. #include<iostream>
      |    ^
a.cc:2:4: error: stray '#' in program
    2 | 2. #include<algorithm>
      |    ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1. #include<iostream>
      | ^~
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 4. long f(int n) {
      | ^~
a.cc:12:1: error: expected unqualified-id before numeric constant
   12 | 12. int main() {
      | ^~~
Language: C++

1. #include<iostream>
2. #include<algorithm>
3. using namespace std;
4. long f(int n) {
5. 	long abc = 1;
6. 	for (int i = n; i > n - 2; --i) {
7. 		abc = abc * i;
8. 	}
9. 	abc = abc / 2;
10. 	return abc;
11. }
12. int main() {
13. 	int n;
14. 	cin >> n;
15. 	int A[200000];
16. 	for (int i = 0; i < n; i++) cin >> A[i];
17. 	long long ans = 0;
18. 	int sum[20000];
19. 	sum[0] = A[0];
20. 	for (int i = 1; i < n; i++) {
21. 		sum[i] = sum[i - 1] + A[i];
22. 	}
23. 	for (int i = 0; i < n; i++) {
24. 		if (sum[i] == 0) ans++;
25. 	}
26. 	sort(sum, sum + n);
27. 	int a = 0;
28. 	int c;
29. 	while (ptr < n) {
30. 		c = sum[a];
31. 		int e = 0;
32. 		while (a < n&&sum[a] == c) e++, a++;
33. 		ans += f(e);
34. 	}
35. 	cout << ans;
36. }


Compiler output:
a.cc:1:4: error: stray '#' in program
    1 | 1. #include<iostream>
      |    ^
a.cc:2:4: error: stray '#' in program
    2 | 2. #include<algorithm>
      |    ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1. #include<iostream>
      | ^~
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 4. long f(int n) {
      | ^~
a.cc:12:1: error: expected unqualified-id before numeric constant
   12 | 12. int main() {
      | ^~~
Language: C++

1. #include<iostream>
2. #include<algorithm>
3. using namespace std;
4. long long f(int n) {
5. 	long abc = 1;
6. 	for (int i = n; i > n - 2; --i) {
7. 		abc = abc * i;
8. 	}
9. 	abc = abc / 2;
10. 	return abc;
11. }
12. int main() {
13. 	int n;
14. 	cin >> n;
15. 	int A[200000];
16. 	for (int i = 0; i < n; i++) cin >> A[i];
17. 	long long ans = 0;
18. 	int sum[20000];
19. 	sum[0] = A[0];
20. 	for (int i = 1; i < n; i++) {
21. 		sum[i] = sum[i - 1] + A[i];
22. 	}
23. 	for (int i = 0; i < n; i++) {
24. 		if (sum[i] == 0) ans++;
25. 	}
26. 	sort(sum, sum + n);
27. 	int a = 0;
28. 	int c;
29. 	while (ptr < n) {
30. 		c = sum[a];
31. 		int e = 0;
32. 		while (a < n&&sum[a] == c) e++, a++;
33. 		ans += f(e);
34. 	}
35. 	cout << ans;
36. }


Compiler output:
a.cc:1:4: error: stray '#' in program
    1 | 1. #include<iostream>
      |    ^
a.cc:2:4: error: stray '#' in program
    2 | 2. #include<algorithm>
      |    ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1. #include<iostream>
      | ^~
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 4. long long f(int n) {
      | ^~
a.cc:12:1: error: expected unqualified-id before numeric constant
   12 | 12. int main() {
      | ^~~
Language: C++

#include <stdio.h>
#include <map>
#include <utility>
using namespace std;
#define F first
#define S second
#define MP make_pair
int main(){
int n,temp,now=0;
long long int ans=0;
map<int> m;
m.insert(MP(0,1));
scanf("%d",&n);
while(n--){
scanf("%d",&temp);
now+=temp;
if(m.find(now)!=m.end())ans+=m[now]++;
else m.insert(MP(now,1));
}
printf("%lld\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: wrong number of template arguments (1, should be at least 2)
   11 | map<int> m;
      |        ^
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:12:3: error: request for member 'insert' in 'm', which is of non-class type 'int'
   12 | m.insert(MP(0,1));
      |   ^~~~~~
a.cc:17:6: error: request for member 'find' in 'm', which is of non-class type 'int'
   17 | if(m.find(now)!=m.end())ans+=m[now]++;
      |      ^~~~
a.cc:17:19: error: request for member 'end' in 'm', which is of non-class type 'int'
   17 | if(m.find(now)!=m.end())ans+=m[now]++;
      |                   ^~~
a.cc:17:31: error: invalid types 'int[int]' for array subscript
   17 | if(m.find(now)!=m.end())ans+=m[now]++;
      |                               ^
a.cc:18:8: error: request for member 'insert' in 'm', which is of non-class type 'int'
   18 | else m.insert(MP(now,1));
      |        ^~~~~~
Language: C++

#include <stdio.h>
#incldue <map>
#include <utility>
using namespace std;
#define F first
#define S second
#define MP make_pair
int main(){
int n,temp,now=0;
long long int ans=0;
map<int> m;
m.insert(MP(0,1));
scanf("%d",&n);
while(n--){
scanf("%d",&temp);
now+=temp;
if(m.find(now)!=m.end())ans+=m[now]++;
else m.insert(MP(now,1));
}
printf("%lld\n",ans);
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #incldue; did you mean #include?
    2 | #incldue <map>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:11:1: error: 'map' was not declared in this scope
   11 | map<int> m;
      | ^~~
a.cc:4:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    3 | #include <utility>
  +++ |+#include <map>
    4 | using namespace std;
a.cc:11:5: error: expected primary-expression before 'int'
   11 | map<int> m;
      |     ^~~
a.cc:12:1: error: 'm' was not declared in this scope
   12 | m.insert(MP(0,1));
      | ^
Language: C++

#include <bits/stdc++.h>
#define LL int

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define REP(i, n) for(LL i = 0; i < n; ++i)
#define FOR(i, a, n) for(LL i = a; i < n; ++i)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

/*************** using variables ***************/
int n;
vector<LL> a, ruiseki;
/**********************************************/

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

    cin >> n;
    a.assign(n, 0);
    ruiseki.assign(n+1, 0);
    REP(i, n) cin >> a[i];
    
    FOR(i, 1, n+1){
        ruiseki[i] = ruiseki[i-1] + a[i-1];
    }

    map<LL, int> mp;

    int ans = 0;
    REP(i, n+1){
        if(mp.count(ruiseki[i])) ans += mp[ruiseki[i]];
        mp[ruiseki[i]]++;
    }
    cout << ans << endl;
}


Compiler output:
a.cc:2:12: error: expected nested-name-specifier before 'int'
    2 | #define LL int
      |            ^~~
a.cc:5:7: note: in expansion of macro 'LL'
    5 | using LL = long long;
      |       ^~
Language: C++

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

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N; // n=10
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます len=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

	int ruiseki[N+1];
    ruiseki[0] = 0;
    int sum = 0;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        sum += a[i];
        ruiseki[i+1] = sum;
    }
    sort(ruiseki, ruiseki + N, greater<int>());  // ruiseki[0:N+1] を大きい順にソート

	int same = 1;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        int a = ruiseki[i];
        int b = ruiseki[i+1];
        if (a==b)
        {
            same++;
        }
        else
        {
            res += (same * (same-1)) / 2;
            same = 1;
        }
    res += (c * (c-1)) / 2;
    }
    cout << res << endl;
}



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

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

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N; // n=10
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます len=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

	int ruiseki[N+1];
    ruiseki[0] = 0;
    int sum = 0;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        sum += a[i];
        ruiseki[i+1] = sum;
    }
    sort(ruiseki, ruiseki + N, greater<int>());  // ruiseki[0:N+1] を大きい順にソート

	int same = 1;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        int a = ruiseki[i];
        int b = ruiseki[i+1];
        if (a==b)
        {
            same++;
        }
        else
        {
            res += (c * (c-1)) / 2;
            same = 1;
        }
    res += (c * (c-1)) / 2;
    }
    cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:21: error: 'c' was not declared in this scope
   34 |             res += (c * (c-1)) / 2;
      |                     ^
a.cc:37:13: error: 'c' was not declared in this scope
   37 |     res += (c * (c-1)) / 2;
      |             ^
Language: Java


import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        int N=scanner.nextInt();
        long[] ints=new long[N];
        for(int i=0;i<N;i++){
            ints[i]= scanner.nextLong();
        }
        long[] longs=new long[N+1];
        longs[0]=0;
        for(int i=1;i<N+1;i++){
            longs[i]=longs[i-1]+ints[i-1];
        }
        Arrays.sort(longs);
        long result=0;
        long count=0;
        for(int i=1;i<N+1;i++){
            if(longs[i-1]==longs[i]){
                count++;
            }else{
                if(count>0){
                    result+=count*(count+1)/2;
                    count=0;
                }
            }
        }
        if(count>0){
            result+=count*(count+1)/2;
        }
        System.out.println(result);
    }

Compiler output:
Main.java:36: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

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

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N; // n=10
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます len=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

	int ruiseki[N+1];
    ruiseki[0] = 0;
    int sum = 0;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        sum += a[i];
        ruiseki[i+1] = sum;
    }
    sort(ruiseki, ruiseki + N, greater<int>());  // ruiseki[0:N+1] を大きい順にソート

	int same = 0;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        int a = ruiseki[i];
        int b = ruiseki[i+1];
        if (a==b)
        {
            same++;
            res += same;
        }
        else
        {
            same = 0:
        }

    }
    cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:21: error: expected ';' before ':' token
   35 |             same = 0:
      |                     ^
      |                     ;
Language: C++

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

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N; // n=10
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます len=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

	int ruiseki[N+1];
    ruiseki[0] = 0;
    int sum = 0;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        sum += a[i];
        ruiseki[i+1] = sum;
    }
    sort(ruiseki, ruiseki + N, greater<int>());  // ruiseki[0:N+1] を大きい順にソート

	same = 0
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        int a = ruiseki[i];
        int b = ruiseki[i+1];
        if (a==b)
        {
            same++;
            res += same;
        }
        else
        {
            same = 0:
        }

    }
    cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'same' was not declared in this scope
   23 |         same = 0
      |         ^~~~
a.cc:24:21: error: 'i' was not declared in this scope
   24 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |                     ^
Language: C++

#include<stdio.h>
#include <stdlib.h>
long long compare_int(const void *a, const void *b)
{
    return  *(long long*)a - *(long long*)b;;
}
int main() {
    int n, i,j;
    long long a[200002], sum[200002],ans=0, count;
    scanf("%d", &n);
    for (i = 1; i <= n; i++)
        scanf("%lld", &a[i]);
    sum[0] = 0;
    for (i = 1; i <= n; i++)
            sum[i] = sum[i - 1] + a[i];
    qsort(sum, n+1, sizeof(long long), compare_int);
    count = 1;
    long long memory=0;
    for (i = 1; i <= n; i++) {
        if (sum[i] == memory)
            count++;
        else {
            if (count > 1)
                ans += count * (count - 1) / 2;
            count = 1;
            memory = sum[i];
        }
    }
    if (count > 1)
        ans += count * (count - 1) / 2;
    printf("%lld\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:40: error: invalid conversion from 'long long int (*)(const void*, const void*)' to '__compar_fn_t' {aka 'int (*)(const void*, const void*)'} [-fpermissive]
   16 |     qsort(sum, n+1, sizeof(long long), compare_int);
      |                                        ^~~~~~~~~~~
      |                                        |
      |                                        long long int (*)(const void*, const void*)
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/stdlib.h:36,
                 from a.cc:2:
/usr/include/stdlib.h:971:34: note:   initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
Language: Java

import java.util.*;
import java.io.*;
 
public class Main{
    ArrayList<Long> list;
    HashMap<Long,Integer> map;
    long ltotal,rtotal,maximum;
    long ans;
    
    public static void main(String[] args){
        Main m = new Main();
        m.input();
        m.solve();
    }
 
    
    public void input(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ltotal = 0;
        rtotal = 0;
        ans = 0;
        maximum = 1000000000;
        list = new ArrayList<Long>();
        map = new HashMap<Long,Integer>();
        rmap = new HashMap<Long,Integer>();
        for(int i = 0; i < n; i++){
            long num = sc.nextLong();
            list.add(num);
            ltotal += num;
            if(ltotal == 0){
                if(map.containsKey(maximum)){
                    int tmp = map.get(maximum) + 1;
                    map.put(maximum,tmp);
                }else{
                    map.put(maximum,1);
                }
            }
            if(map.containsKey(ltotal)){
                int tmp = map.get(ltotal) + 1;
                map.put(ltotal,tmp);
            }else{
                map.put(ltotal,1);
            }
        }
        sc.close();
    }
    

    public void solve(){
        int max = list.size();
        long now = 0;
        for(int i = 0; i < max; i++){
            now = now + list.get(i);
            
            if(map.containsKey(now)){
                int tmp = map.get(now) - 1;
                if(tmp >= 0){
                    map.put(now,tmp);
                }
            }
            if(map.containsKey(now)){
                int tmp = map.get(now);
                ans += tmp;
            }
        }
        System.out.println(ans);
    }
    
}

Compiler output:
Main.java:26: error: cannot find symbol
        rmap = new HashMap<Long,Integer>();
        ^
  symbol:   variable rmap
  location: class Main
1 error
Language: C++

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

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N; // n=10
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます len=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

	int ruiseki[N+1];
    int sum = 0;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        sum += a[i];
        ruiseki[i+1] = sum;
    }
    sort(ruiseki, ruiseki + N+1, greater<int>());  // ruiseki[0:N+1] を大きい順にソート

    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        a = ruiseki[i];
        b = ruiseki[i+1];
        if (a==b)
        {
            res++;
        }

    }
    cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:24:11: error: incompatible types in assignment of 'int' to 'int [N]'
   24 |         a = ruiseki[i];
      |         ~~^~~~~~~~~~~~
a.cc:25:9: error: 'b' was not declared in this scope
   25 |         b = ruiseki[i+1];
      |         ^
Language: C++

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

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N; // n=10
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます len=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

	int ruiseki[N+1];
    int sum = 0;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        sum += a[i];
        ruiseki[i+1] = sum;
        }
    }
    sort(ruiseki, ruiseki + N+1, greater<int>());  // ruiseki[0:N+1] を大きい順にソート

    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        a = ruiseki[i];
        b = ruiseki[i+1];
        if (a==b)
        {
            res++;
        }

    }
    cout << res << endl;
}



Compiler output:
a.cc:21:9: error: expected constructor, destructor, or type conversion before '(' token
   21 |     sort(ruiseki, ruiseki + N+1, greater<int>());  // ruiseki[0:N+1] を大きい順にソート
      |         ^
a.cc:23:5: error: expected unqualified-id before 'for'
   23 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |     ^~~
a.cc:23:21: error: 'i' does not name a type
   23 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |                     ^
a.cc:23:28: error: 'i' does not name a type
   23 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |                            ^
a.cc:33:5: error: 'cout' does not name a type
   33 |     cout << res << endl;
      |     ^~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

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

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N; // n=10
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます len=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

	int ruiseki[N+1];
    int sum = 0;
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        sum += a[i]
        ruiseki[i+1] = sum
        }
    }
    sort(ruiseki, ruiseki + N+1, greater<int>());  // ruiseki[0:N+1] を大きい順にソート

    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        a = ruiseki[i];
        b = ruiseki[i+1];
        if (a==b)
        {
            res++;
        }

    }
    cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: expected ';' before 'ruiseki'
   17 |         sum += a[i]
      |                    ^
      |                    ;
   18 |         ruiseki[i+1] = sum
      |         ~~~~~~~     
a.cc: At global scope:
a.cc:21:9: error: expected constructor, destructor, or type conversion before '(' token
   21 |     sort(ruiseki, ruiseki + N+1, greater<int>());  // ruiseki[0:N+1] を大きい順にソート
      |         ^
a.cc:23:5: error: expected unqualified-id before 'for'
   23 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |     ^~~
a.cc:23:21: error: 'i' does not name a type
   23 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |                     ^
a.cc:23:28: error: 'i' does not name a type
   23 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |                            ^
a.cc:33:5: error: 'cout' does not name a type
   33 |     cout << res << endl;
      |     ^~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

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

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N; // n=10
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます len=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

	int ruiseki[N+1];
    int sum = 0
    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        sum += a[i]
        ruiseki[i+1] = sum
        }
    }
    sort(ruiseki, ruiseki + N+1, greater<int>());  // ruiseki[0:N+1] を大きい順にソート

    for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
    {
        a = ruiseki[i]
        b = ruiseki[i+1]
        if (a==b)
        {
            res++;
        }

    }
    cout << res << endl;
}


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++) // 部分配列の長さ size = 2
      |     ^~~
a.cc:15:21: error: 'i' was not declared in this scope
   15 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |                     ^
a.cc: At global scope:
a.cc:21:9: error: expected constructor, destructor, or type conversion before '(' token
   21 |     sort(ruiseki, ruiseki + N+1, greater<int>());  // ruiseki[0:N+1] を大きい順にソート
      |         ^
a.cc:23:5: error: expected unqualified-id before 'for'
   23 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |     ^~~
a.cc:23:21: error: 'i' does not name a type
   23 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |                     ^
a.cc:23:28: error: 'i' does not name a type
   23 |     for (int i = 0; i < N; i++) // 部分配列の長さ size = 2
      |                            ^
a.cc:33:5: error: 'cout' does not name a type
   33 |     cout << res << endl;
      |     ^~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

#include <iostream>
using namespace std;

int main() {
	int N[200001];
	int M[100000];
	int n, c = 0;
	int a = 0;
	bool b = false;

	int d = 0;
	bool e = false;
	bool f = false;

	cin >> n;

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

	for (int i = 0; i < n; i++) {
		a = 0;
		b = false;
		e = false;
		f = false;
		if (int k = 0; k < d; k++) {
			if (i == M[k]) {
				f = true;
			}
		}


		if (f == false){
			for (int j = i; j < n; j++) {
				a += N[j];

				if (a == 0) {
					c++;
					b = true;
				}

				if (b == true && j < n) {
					a = 0;
					b = false;
					if (e == false) {
						M[d] = j;
						d++;
						e = true;
					}
				}
			}
		}
	}

	cout << c;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:37: error: expected ')' before ';' token
   26 |                 if (int k = 0; k < d; k++) {
      |                    ~                ^
      |                                     )
a.cc:26:39: error: 'k' was not declared in this scope
   26 |                 if (int k = 0; k < d; k++) {
      |                                       ^
Language: C++

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
//#define sum(start, end) accumulate(start, end, 0)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

using namespace std;
template <class T = ll> T in() { T _in; cin >> _in; return (_in); }

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

    ll N = in();
    ll val[200000];
    rep(i, N) {
        val[i] = in();
        if(val[i] == 0)
            cnt++;
    }

    int cnt = 0;
    for(int i = N-1; i > -1; i--) {
        REP(j, i+1, N) {
            val[j] = val[i] + val[j];
            if(val[j] == 0)
                cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   27 |             cnt++;
      |             ^~~
      |             int
Language: C

#include <stdio.h>

int main(void)
{
	double num;
	
	scanf("%lf",&num);
    
    double vc[num];
	
	double count2;
	for (count2=1; count2<=num; count2++) {
	scanf("%lf",vc[count2]);
	putchar(' ');
	}
	
	putchar('\n');
	
	double count3,count4,count5;
	double d1,d2,d3;
	double sum;
	double counts=0;
	for (count3=1; count3<=num-2; count3++) {
		d1=vc[count3];
		for (count4=count3+1; count4<=num-1; count4++) {
			d2=vc[count4];
			for (count5=count4+1; count3<=num; count5++) {
			d3=vc[count5];
			
			sum=d1+d2+d3;
			
                if (sum==0)
                    counts++;
			}}}
			
			printf("%f", counts);
			
			return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:12: error: size of array 'vc' has non-integer type
    9 |     double vc[num];
      |            ^~
main.c:13:23: error: array subscript is not an integer
   13 |         scanf("%lf",vc[count2]);
      |                       ^
main.c:24:22: error: array subscript is not an integer
   24 |                 d1=vc[count3];
      |                      ^
main.c:26:30: error: array subscript is not an integer
   26 |                         d2=vc[count4];
      |                              ^
main.c:28:30: error: array subscript is not an integer
   28 |                         d3=vc[count5];
      |                              ^
Language: C

#include <stdio.h>
#include <iostream>
#include <stdbool.h>

using namespace std;

int main()
{
    char table[300][300] = {'\0'};
    char dust[10];
    int table_size = 0;
    int count = 0;
    bool flag = true;
    cin >> table_size;
    cout << table_size << "\n";

    for (int i = 0; i < table_size; i++)
    {
        for (int j = 0; j < table_size; j++)
        {
            cin >> table[i][j];
        }
    }

    for (int k = 0; k < table_size; k++)
    {
        for (int l = 0; l < table_size; l++)
        {
            for (int i = 0; (i < table_size) && (flag); i++)
            {
                for (int j = 0; (j < table_size) && (flag); j++)
                {
                    if ((i != j) && (table[(i+k)%table_size][(j+l)%table_size] != table[(j+k)%table_size][(i+l)%table_size])){
                        flag = false;
                    }
                }    
            }
            if(flag==true)
                count++;
            else
                flag=true;

        }
    }
    printf("%d", count);
    return 0;
}

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

#include <stdio.h>

int main(void)
{
	double num;
	
	scanf("%lf",&num);
    
    double dx[num];
	
	double count2;
	for (count2=1; count2<=num; count2++) {
	scanf("%lf",dx[count2]);
	putchar(' ');
	}
	
	putchar('\n');
	
	double count3,count4,count5;
	double d1,d2,d3;
	double sum;
	double counts=0;
	for (count3=1; count3<=num-2; count3++) {
		d1=dx[count3];
		for (count4=count3+1; count4<=num-1; count4++) {
			d2=dx[count4];
			for (count5=count4+1; count3<=num; count5++) {
			d3=dx[count5];
			
			sum=d1+d2+d3;
			
                if (sum==0)
                    counts++;
			}}}
			
			printf("%f", counts);
			
			return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:12: error: size of array 'dx' has non-integer type
    9 |     double dx[num];
      |            ^~
main.c:13:23: error: array subscript is not an integer
   13 |         scanf("%lf",dx[count2]);
      |                       ^
main.c:24:22: error: array subscript is not an integer
   24 |                 d1=dx[count3];
      |                      ^
main.c:26:30: error: array subscript is not an integer
   26 |                         d2=dx[count4];
      |                              ^
main.c:28:30: error: array subscript is not an integer
   28 |                         d3=dx[count5];
      |                              ^
Language: C

#include <stdio.h>

int main(){
  int N;
  scanf("%d", &N);
  int a[N];
  for(int i=0;i<N;i++){
    scanf("%d",&a[i]);
  }
  int res = 0;
  for(int i=0;i<N;i++){
    t = a[i];
    if (t == 0) res++;
    for(int j=0;j<N;j++){
      t += a[j];
      if (t == 0) res++;
    }
  }

  printf("%d",res);
}


Compiler output:
main.c: In function 'main':
main.c:12:5: error: 't' undeclared (first use in this function)
   12 |     t = a[i];
      |     ^
main.c:12:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

//long** cash;
long prevRes;

bool isZero(vector<long> vec,long sPos,long n){
  long sum = 0;
  long ii;

  if(prevRes != -1){
	sum = vec[sPos+n-1] + prevRes;
  }
  else{
	for(ii=sPos;ii<sPos+n;ii++){
	  sum += vec[ii];
	}
  }
  prevRes = sum;
  
  if(sum == 0){
	return true;
  }
  else{
	return false;
  }

}

int main(){

  long res,jj,ii,n,sum=0;
  vector<long> vec;
  cin >> n;
  vec.resize(n);

  //cash = (long**)malloc(sizeof(long*) * n);
  
  for(ii=0;ii<n;ii++){
	cin >> vec[ii];
	*(cash+ii) = (long*)malloc(sizeof(long) * n);
  }

  //for(ii=0;ii<n;ii++){
  //	for(jj=0;jj<n;jj++){
  //	  cash[ii][jj] = -1;
  //	}
  //}

  prevRes = -1;
  for(long sPos = 0;sPos < vec.size();sPos++){
	for(long n = 1;n <= vec.size() - sPos;n++){
	  //cout << "sPos:" << sPos << "n:" << n << endl;
	  if(isZero(vec,sPos,n)){
		sum += 1;
	  }
	}
	prevRes = -1;
  }

  cout << sum << endl;
  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:11: error: 'cash' was not declared in this scope
   42 |         *(cash+ii) = (long*)malloc(sizeof(long) * n);
      |           ^~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
long f(int n) {
	long abc = 1;
	for (int i = n; i > n - 2; --i) {
		abc = abc * i;
	}
	abc = abc / 2;
	return abc;
}
int main() {
	int n;
	cin >> n;
	int A[200000];
	for (int i = 0; i < n; i++) cin >> A[i];
	int ans = 0;
	__int64 sum[20000];
	sum[0] = A[0];
	for (int i = 1; i < n; i++) {
		sum[i] = sum[i - 1] + A[i];
	}
	for (int i = 0; i < n; i++) {
		if (sum[i] == 0) ans++;
	}
	sort(sum, sum + n);
	int ptr = 0;
	while (ptr < n) {
		__int64 cc = sum[ptr];
		int e = 0;
		while (ptr < n&&sum[ptr] == cc) e++, ptr++;
		ans += f(e);
	}
	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   18 |         __int64 sum[20000];
      |         ^~~~~~~
      |         __int64_t
a.cc:19:9: error: 'sum' was not declared in this scope
   19 |         sum[0] = A[0];
      |         ^~~
a.cc:29:24: error: expected ';' before 'cc'
   29 |                 __int64 cc = sum[ptr];
      |                        ^~~
      |                        ;
a.cc:31:45: error: 'cc' was not declared in this scope
   31 |                 while (ptr < n&&sum[ptr] == cc) e++, ptr++;
      |                                             ^~
Language: C++

#include <iostream>
#include <vector>
#include <functional>

using namespace std;

using ll = long long;

int main()
{
    int N;
    vector<ll> A;
    vector<ll> B;
    cin >> N;
    A.resize(N);
    B.resize(N, 0LL);

    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        if(i - 1 >= 0)
        {
            B[i] = A[i] + B[i - 1];
        }
        else
        {
            B[i] += A[i];
        }
    }

    sort(B.begin(), B.end(), greater<ll>());

    ll v = B[0];
    ll cnt = v == 0 ? 2 : 1;
    ll ans = 0LL;

/*
    for (int i = 0; i < N;i++)
    {
        cout << B[i] << " ";
    }
    cout << endl;
*/

    for (int i = 1; i < N; i++)
    {
        if (v == B[i])
        {
            cnt++;
        }
        else
        {
            //cout << "i = " << i << " cnt = " << cnt << endl;
            ans += (cnt * (cnt - 1)) / 2;

            v = B[i];
            cnt = v == 0 ? 2 : 1;
        }
    }

    ans += (cnt * (cnt - 1)) / 2;

    cout << ans << endl;

    return 0;
}
/*
8
1 2 -4 1 2 -2 3 -3
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:31:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   31 |     sort(B.begin(), B.end(), greater<ll>());
      |     ^~~~
      |     short
Language: C

#include <stdio.h>

int main(void)
{
	int num;
	
	scanf("%d",&num);
	
	int count1;
	for (count1=1; count1<=num; count1++)
	int ncount1;
	
	int count2;
	for (count2=1; count2<=num; count2++) {
	scanf("%d",ncount2);
	putchar(' ');
	}
	
	putchar('\n');
	
	int count3,count4,count5;
	int d1,d2,d3;
	int sum;
	int counts=0;
	for (count3=1; count3<=num-2; count3++) {
		d1=ncount3;
		for (count4=count3+1; count4<=num-1; count4++) {
			d2=ncount4;
			for (count5=count4+1; count3<=num; count5++) {
			d3=ncount5;
			
			sum=d1+d2+d3;
			
                if (sum==0)
                    counts++;
			}}}
			
			printf("%d", counts);
			
			return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:9: error: expected expression before 'int'
   11 |         int ncount1;
      |         ^~~
main.c:15:20: error: 'ncount2' undeclared (first use in this function); did you mean 'count2'?
   15 |         scanf("%d",ncount2);
      |                    ^~~~~~~
      |                    count2
main.c:15:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:20: error: 'ncount3' undeclared (first use in this function); did you mean 'count3'?
   26 |                 d1=ncount3;
      |                    ^~~~~~~
      |                    count3
main.c:28:28: error: 'ncount4' undeclared (first use in this function); did you mean 'count4'?
   28 |                         d2=ncount4;
      |                            ^~~~~~~
      |                            count4
main.c:30:28: error: 'ncount5' undeclared (first use in this function); did you mean 'count5'?
   30 |                         d3=ncount5;
      |                            ^~~~~~~
      |                            count5
Language: C++

#include <cstdio>
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
using namespace std;
long long a[200100];
long long b[200100] = {};
long long c[200] = {};
int main()
{
    int n;
    scanf("%d",&n)
    rep(i,n){
        scanf("%d",a[i]);
        b[i+1] = b[i]+a[i];
    }
    long long ans = 0;
    rep(i,n+1){
        REP(k,i+1,n+1){
            if(b[k]-b[i]==0) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: expected ';' before 'for'
   11 |     scanf("%d",&n)
      |                   ^
      |                   ;
a.cc:12:9: error: 'i' was not declared in this scope
   12 |     rep(i,n){
      |         ^
a.cc:2:35: note: in definition of macro 'rep'
    2 | #define rep(i, n) for (int i = 0; i < n; i++)
      |                                   ^
a.cc:22:5: error: 'cout' was not declared in this scope
   22 |     cout << ans << endl;
      |     ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <cstdio>
  +++ |+#include <iostream>
    2 | #define rep(i, n) for (int i = 0; i < n; i++)
a.cc:22:20: error: 'endl' was not declared in this scope
   22 |     cout << ans << endl;
      |                    ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <cstdio>
  +++ |+#include <ostream>
    2 | #define rep(i, n) for (int i = 0; i < n; i++)
Language: C++

#include <iostream>
using namespace std;

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N; // n=10
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます len=10
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

    for (int start = 0; start < N; start++) // 部分配列の長さ size = 2
    {
        int sum = 0;
        for (int i = 0; i < N - start; ++i) // i = 0,1 
            {
                sum += a[i + start]; // 加算 a[8], a[9]
                if(sum==0)
                {
                    res++;
                }
            }
        }
    cout << res << endl;
    }
}



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

#include<iostream>
using namespace std;

#define ll long long
ll n,m,a[500000],b[80000000000],c[500000],ans;

int main(){
cin>>n;

for(ll i=0;i<n;i++){
cin>>a[i];
m+=a[i];
c[i]=m+40000000000;
b[m+40000000000]++;
}

for(ll i=0;i<n;i++){
ans+=b[c[i]]*(b[c[i]]-1)/2;
b[c[i]]=0;
}

cout<<ans;
return 0;
}


Compiler output:
/tmp/ccUa9Zfc.o: in function `main':
a.cc:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccUa9Zfc.o
a.cc:(.text+0x11a): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccUa9Zfc.o
a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccUa9Zfc.o
a.cc:(.text+0x17a): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccUa9Zfc.o
a.cc:(.text+0x184): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccUa9Zfc.o
a.cc:(.text+0x197): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccUa9Zfc.o
a.cc:(.text+0x1cf): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccUa9Zfc.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
int main(void) {
  using namespace std;
  int N;
  cin >> N;
  vector<long>sum(N + 1);
  sum[0] = 0;
  for(int i = 1; i < N + 1; i++) {
    long a;
    cin >> a;
    sum[i] = a + sum[i - 1];
  }



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

  int now_sum = sum[0];
  int now_num = 1;
  int res = 0;
  for(int i = 1; i < N + 1; i++) {
    if(now_sum == sum[i]) now_num++;
    else {
      res += (now_num - 1) * now_num / 2; //nC2
    }
  }
  cout << res << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |   sort(sum.begin(), sum.end());
      |   ^~~~
      |   short
Language: C++

#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int ans,sum,a[300000],b[300000],n;
map<int,int>m;
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i],b[i]=a[i];
	rep(i,n-1)b[i+1]+=b[i];
	rep(i,n)m[b[i]]++;
	rep(i,n){
		ans+=m[sum];
		m[b[i]]--;
		sum+=a[i];
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'i' was not declared in this scope
    8 |         rep(i,n)cin>>a[i],b[i]=a[i];
      |             ^
a.cc:8:9: error: 'rep' was not declared in this scope
    8 |         rep(i,n)cin>>a[i],b[i]=a[i];
      |         ^~~
Language: C++

#include <iostream>
using namespace std;

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N;
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

    for (int all = 0; all < (1<<N); all++) // ビットを使ったforループ 0:2**N-1
    {
        for (int i = 0; i < N; ++i) // i 番目の配列について
        {
            int sum = 0;
            if( all & (1<<i) ) // i番目の要素が部分配列に含まれるか
            {
                sum += a[i]; // 含まれるなら加算
            }
            if(sum==0)
            {
                res++;
            }
        }
    }

    cout << res << endl;
    }
}



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

#ifdef local_mode
    #include <cstdio>
    #include <cassert>
#endif
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
#define pb push_back
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
#ifdef local_mode
    ios_base::sync_with_stdio(0), cin.tie(0);
    assert(freopen("in", "r", stdin));
    assert(freopen("out", "w", stdout));
#endif
    
    int n;
    cin >> n;

    vector<l> a(n);
    vector<ll> b(n + 1);
    b[0] = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        b[i + 1] = b[i] + a[i];  // sum [0..i]
    }

    int cnt = 0;
    unordered_map<int, int> m;
    for (int i = 0; i < n + 1; i++)
        m[b[i]]++;

    for (pair<int, int> p : m)
        cnt += p.second * (p.second - 1) / 2;

    cout << cnt;

    return 0;
}







































Compiler output:
a.cc: In function 'int main()':
a.cc:28:12: error: 'l' was not declared in this scope
   28 |     vector<l> a(n);
      |            ^
a.cc:28:13: error: template argument 1 is invalid
   28 |     vector<l> a(n);
      |             ^
a.cc:28:13: error: template argument 2 is invalid
a.cc:32:17: error: invalid types 'int[int]' for array subscript
   32 |         cin >> a[i];
      |                 ^
a.cc:33:28: error: invalid types 'int[int]' for array subscript
   33 |         b[i + 1] = b[i] + a[i];  // sum [0..i]
      |                            ^
Language: C++

#include<iostream>
using namespace std;

#define ll long long
ll n,m,a[500000],b[800000000000000],c[500000],ans;

int main(){
cin>>n;

for(ll i=0;i<n;i++){
cin>>a[i];
m+=a[i];
c[i]=m+400000000000000;
b[m+400000000000000]++;
}

for(ll i=0;i<n;i++){
ans+=b[c[i]]*(b[c[i]]-1)/2;
b[c[i]]=0;
}

cout<<ans;
return 0;
}


Compiler output:
/tmp/ccfhFqQ1.o: in function `main':
a.cc:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccfhFqQ1.o
a.cc:(.text+0x11a): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccfhFqQ1.o
a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccfhFqQ1.o
a.cc:(.text+0x17a): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccfhFqQ1.o
a.cc:(.text+0x184): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccfhFqQ1.o
a.cc:(.text+0x197): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccfhFqQ1.o
a.cc:(.text+0x1cf): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccfhFqQ1.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
using namespace std;

int main() {
    // データ読み込み
    int N; //配列長
    cin >> N;
    int a[N];  // 最大 2*10**5 個ですが余裕をもたせます
    int res = 0;  // 答えを格納
    for (int i = 0; i < N; ++i) cin >> a[i];

    for (int size = 1; size <= N; size++) // 部分配列の長さ
    {
        int sum = 0;
        for (int start = 0; start <= N - size; ++start) // 部分配列開始index
        {
            for (int i = 0; i < size; ++i)
            {
                sum += a[i + start]; // 加算
            }
        }
        if(sum==0)
        {
            if (all)
            {
                res++;
            }
        }
    cout << res << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'all' was not declared in this scope
   24 |             if (all)
      |                 ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;    
    cin >> n;  
    int count = 0;
    long long int check = 0;
    vector<long long int> an(n);

    for(auto iter = an.begin(); iter != an.end(); ++iter){
        cin >> *iter;
    }
   
    for(int k = 0; i < k; k++){
        for(int i = k; i < n; i++){
            check += an.at(i);
            if(check == 0){
                count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: 'i' was not declared in this scope
   15 |     for(int k = 0; i < k; k++){
      |                    ^