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

#include <stdio.h>

long long POW(int a, int b)
{
	int i;
	long long ret = 1;
	for( i=0; i<b; i++)ret *= a;
	return ret;
}

char* decMinus2bin(char* str, int N)
{
	int u,k;
	long long i,j,sum;
	static const long long oddsum[]={
		2LL, 10LL, 42LL,
		170LL, 682LL, 2730LL,
		10922LL, 43690LL, 174762LL,
		699050LL, 2796202LL, 11184810LL,
		44739242LL, 178956970LL, 715827882LL,
		2863311530LL
	};
	static const long long evensum[]={
		1LL, 5LL, 21LL,
		85LL, 341LL, 1365LL,
		5461LL, 21845LL, 87381LL,
		349525LL, 1398101LL, 5592405LL,
		22369621LL, 89478485LL, 357913941LL,
		1431655765LL
	};
	
	if( N<0 )return NULL;
	if( N==0 ){
		str[0] = '0', str[1] = 0;
		return str;
	}
	
	for(u=0; evensum[u] < N; u++);
	j = (1LL<<(2*u));

	sum = j;
	
	do{
		if( sum<N ){
			for(u=0; sum+evensum[u] < N ; u++);
			j = j + (1LL<<(2*u));
		}else if( sum>N ){
			for(u=0; sum-oddsum[u] > N; u++);
			j = j + (1LL<<(2*u+1));
		}
		sum = 0;
		for(i=1,k=0; i<=j; i<<=1,k++){
			if( j&i )
				sum += POW(-2,k);
		}
	}while( sum!=N );
	
	str[k] = 0;
	for(i=1; i<=j; i<<=1){
		str[--k] = j&i ? '1' : '0';
	}
	
	return str;
}

int main()
{
    int n;cin >> n;
    printf("%s",i,decMinus2bin(str,i));
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:68:11: error: 'cin' was not declared in this scope
   68 |     int n;cin >> n;
      |           ^~~
a.cc:69:17: error: 'i' was not declared in this scope
   69 |     printf("%s",i,decMinus2bin(str,i));
      |                 ^
a.cc:69:32: error: 'str' was not declared in this scope; did you mean 'std'?
   69 |     printf("%s",i,decMinus2bin(str,i));
      |                                ^~~
      |                                std
Language: C

#include <stdio.h>

long long POW(int a, int b)
{
	int i;
	long long ret = 1;
	for (i = 0; i<b; i++)ret *= a;
	return ret;
}

char* decMinus2bin(char* str, int N)
{
	int u, k;
	long long i, j, sum;
	static const long long oddsum[] = {
		2LL, 10LL, 42LL,
		170LL, 682LL, 2730LL,
		10922LL, 43690LL, 174762LL,
		699050LL, 2796202LL, 11184810LL,
		44739242LL, 178956970LL, 715827882LL,
		2863311530LL
	};
	static const long long evensum[] = {
		1LL, 5LL, 21LL,
		85LL, 341LL, 1365LL,
		5461LL, 21845LL, 87381LL,
		349525LL, 1398101LL, 5592405LL,
		22369621LL, 89478485LL, 357913941LL,
		1431655765LL
	};

	//if (N<0)return NULL;
	if (N == 0) {
		str[0] = '0', str[1] = 0;
		return str;
	}

	for (u = 0; evensum[u] < N; u++);
	j = (1LL << (2 * u));

	sum = j;

	do {
		if (sum<N) {
			for (u = 0; sum + evensum[u] < N; u++);
			j = j + (1LL << (2 * u));
		}
		else if (sum>N) {
			for (u = 0; sum - oddsum[u] > N; u++);
			j = j + (1LL << (2 * u + 1));
		}
		sum = 0;
		for (i = 1, k = 0; i <= j; i <<= 1, k++) {
			if (j&i)
				sum += POW(-2, k);
		}
	} while (sum != N);

	str[k] = 0;
	for (i = 1; i <= j; i <<= 1) {
		str[--k] = j&i ? '1' : '0';
	}

	return str;
}

int main()
{
	char str[34];
	int i=0;
		scanf_s("%d", &i);
		printf("%s\n", decMinus2bin(str, i));
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:71:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   71 |                 scanf_s("%d", &i);
      |                 ^~~~~~~
      |                 scanf
Language: C++

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

int main() {
  int n,c=0;
  cin>>n;
  for(int i=1;i<=1000000000;i*-2){
    if(i<n){
      c=i
    }
    else {
      break;
    }
  }
  for(int x=c;x<=1000000000;x/-2){
    cout<<n%x<<endl;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: expected ';' before '}' token
    9 |       c=i
      |          ^
      |          ;
   10 |     }
      |     ~
Language: C++

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

int main() {
  int n c=0;
  cin>>n;
  for(int i=1;i<=1000000000;i*-2){
    if(i<n){
      c=i
    }
    else {
      break;
    }
  }
  for(int x=c;x<=1000000000;x/-2){
    cout<<n%x<<endl;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: expected initializer before 'c'
    5 |   int n c=0;
      |         ^
a.cc:6:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |   cin>>n;
      |        ^
      |        yn
a.cc:9:7: error: 'c' was not declared in this scope
    9 |       c=i
      |       ^
a.cc:15:13: error: 'c' was not declared in this scope
   15 |   for(int x=c;x<=1000000000;x/-2){
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  string ans="";
  int a=1;
  for(int i=0;i<;i++){
    if(N%abs(a*2)!=0){
      ans+='1';
      N-=a;}
    else{ans+='0';}
    a*=-2;
    if(N==0){break;}
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: expected primary-expression before ';' token
    9 |   for(int i=0;i<;i++){
      |                 ^
Language: C++

#include <bits/stdc++.h> 
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
 
 
using namespace std;
// using namespace __gnu_pbds;
// using namespace __gnu_pbds;
 
 
// template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
 
typedef long long  ll;
typedef unsigned long long  ull;
#define lp(i,n)      for(int i=0;i<n;i++)
#define lpi(i,j,n)   for(int i=j;i<n;i++)
#define lpd(i,j,n)   for(int i=j;i>=n;i--)
#define MP           make_pair
#define clr(v, d)    (memset(v, d, sizeof(v)))
#define all(v)     (v.begin()),(v.end())
#define f first
#define se second
#define N 100001
 
ll n,t,m,k;



int main() {
 
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
// freopen("alchemy_input.txt","r",stdin); 
// freopen("out.txt","w",stdout); 
cout.precision(2);
cin>>n>>m;
vector<int>a(n);
lp(i,n)cin>>a[i],a[i]%=m;
map<int,int>mp;
mp[0]=1;
int sum=0;
lp(i,n){
  ans+=mp[(m-a[i])%m];
  sum+=a[i];
  sum%=m;
  mp[sum]++;
}
cout<<ans;


  
  
}

 
 
 
 
 
 
  
 
 
 
 
// bool isPrime(ll h){
//      for(ll i=0;primes[i]*primes[i]<= h;i++)
//      if (h%primes[i]==0)
//      	return 0;
//      return h!=1;
//  }
 bool isPrime(ll g){
   if((g%2==0 && g>2) || g==1)return 0;
   for(ll i=3;i*i<=g;i+=2)if(g%i==0)return 0;
   return 1;   
 
 }  

Compiler output:
a.cc: In function 'int main()':
a.cc:44:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |   ans+=mp[(m-a[i])%m];
      |   ^~~
      |   abs
a.cc:49:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   49 | cout<<ans;
      |       ^~~
      |       abs
Language: C++

#include <bits/stdc++.h> 
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
 
 
using namespace std;
// using namespace __gnu_pbds;
// using namespace __gnu_pbds;
 
 
// template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
 
typedef long long  ll;
typedef unsigned long long  ull;
#define lp(i,n)      for(int i=0;i<n;i++)
#define lpi(i,j,n)   for(int i=j;i<n;i++)
#define lpd(i,j,n)   for(int i=j;i>=n;i--)
#define MP           make_pair
#define clr(v, d)    (memset(v, d, sizeof(v)))
#define all(v)     (v.begin()),(v.end())
#define f first
#define se second
#define N 100001
 
ll n,t,m,k;



int main() {
 
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
// freopen("alchemy_input.txt","r",stdin); 
// freopen("out.txt","w",stdout); 
cout.precision(2);
cin>>n>>m;
vecto<int>a(n);
lp(i,n)cin>>a[i],a[i]%=m;
map<int,int>mp;
mp[0]=1;
int sum=0;
lp(i,n){
  ans+=mp[(m-a[i])%m];
  sum+=a[i];
  sum%=m;
  mp[sum]++;
}
cout<<ans;


  
  
}

 
 
 
 
 
 
  
 
 
 
 
// bool isPrime(ll h){
//      for(ll i=0;primes[i]*primes[i]<= h;i++)
//      if (h%primes[i]==0)
//      	return 0;
//      return h!=1;
//  }
 bool isPrime(ll g){
   if((g%2==0 && g>2) || g==1)return 0;
   for(ll i=3;i*i<=g;i+=2)if(g%i==0)return 0;
   return 1;   
 
 }  

Compiler output:
a.cc: In function 'int main()':
a.cc:38:1: error: 'vecto' was not declared in this scope
   38 | vecto<int>a(n);
      | ^~~~~
a.cc:38:7: error: expected primary-expression before 'int'
   38 | vecto<int>a(n);
      |       ^~~
a.cc:39:13: error: 'a' was not declared in this scope
   39 | lp(i,n)cin>>a[i],a[i]%=m;
      |             ^
a.cc:44:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |   ans+=mp[(m-a[i])%m];
      |   ^~~
      |   abs
a.cc:44:14: error: 'a' was not declared in this scope
   44 |   ans+=mp[(m-a[i])%m];
      |              ^
a.cc:49:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   49 | cout<<ans;
      |       ^~~
      |       abs
Language: C

#include <iostream>
#include <algorithm>
#include <fstream>
#include <utility>
#include <iomanip>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#define IO ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;

using namespace std;
const ll INF = 1e18;
const int mod = 1e4, N = 1e5 + 5, inf = 1e9;

int main()
{
    IO
    int n, m, arr[N], cnt = 0;
    vector<pair<int, pair<int, int>>>vec;
    ll ans = 0;
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        arr[i] = arr[i] % m;
        if (!arr[i])
            cnt++;
        else
        {
            ans += ((double)cnt / 2) * (cnt + 1);
            if (vec.size())
                vec.back().second.second = cnt;
            vec.push_back({ i, {cnt , 0} });
            cnt = 0;
        }
    }
    if (cnt)
    {
        if (vec.size())
            vec.back().second.second = cnt;
        ans += ((double)cnt / 2) * (cnt + 1);
    }
    for (unsigned int i = 0; i < vec.size() - 1; i++)
    {
        ll sum = arr[vec[i].first];
        for (unsigned int j = i + 1; j < vec.size(); j++)
        {
            sum = sum + arr[vec[j].first];
            sum %= m;
            if (!sum)
            {
                ans += vec[i].second.first + 1;
                ans += vec[j].second.second;
                ans += (vec[i].second.first * vec[j].second.second);
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

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

import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int m = sc.nextInt();
        HashMap<Integer,Integer> data = new HashMap<>();
        int front=0;
        data.put(0,1);
        for (int i=0;i<n;i++){
            front=(front+sc.nextInt())%m;
            if (data.containsKey(front)){
                data.put(front,data.get(front)+1);
            }else {
                data.put(front,1);
            }
        }
        long ans = 0;
        for (int A : data.keySet()){
            int N = data.get(A);
            ans+=N*(N-1)/2;
        }
        System.out.println(ans);
    }


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

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

int main() {
    int n,m;cin>>n>>m;
    map<int,int> mp;
    mp[0]=1;
    int sm=0
    ll ans=0;
    for (int i=0;i<n;i++) {
        int a;cin>>a;
        sm=(sm+a)%m;
        ans+=mp[sm];
        mp[sm]++;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: expected ',' or ';' before 'll'
   10 |     ll ans=0;
      |     ^~
a.cc:14:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |         ans+=mp[sm];
      |         ^~~
      |         abs
a.cc:17:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C++

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

int main() {
    int n,m;cin>>n>>m;
    map<int> mp;
    mp[0]=1;
    int sm=0
    ll ans=0;
    for (int i=0;i<n;i++) {
        int a;cin>>a;
        sm=(sm+a)%m;
        ans+=mp[sm];
        mp[sm]++;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: wrong number of template arguments (1, should be at least 2)
    7 |     map<int> mp;
      |            ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:8:7: error: invalid types 'int[int]' for array subscript
    8 |     mp[0]=1;
      |       ^
a.cc:10:5: error: expected ',' or ';' before 'll'
   10 |     ll ans=0;
      |     ^~
a.cc:14:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |         ans+=mp[sm];
      |         ^~~
      |         abs
a.cc:14:16: error: invalid types 'int[int]' for array subscript
   14 |         ans+=mp[sm];
      |                ^
a.cc:15:11: error: invalid types 'int[int]' for array subscript
   15 |         mp[sm]++;
      |           ^
a.cc:17:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	int a[n+1];
	int s[n+1];
	for(int i=0;i<=n;i++)
	s[i]=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		s[i+1]=(s[i]+a[i])%m;
	}
	map<int,int> mp;
	for(int i=0;i<=n;i++) mp[s[i]]++;
	int t=0;
	for(int i=0;i<mp.size();i++)
	{
		t+=mp[i].second()*(mp[i].second-1)/2; 
	}
	cout<<t;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: request for member 'second' in 'mp.std::map<int, int>::operator[](i)', which is of non-class type 'std::map<int, int>::mapped_type' {aka 'int'}
   21 |                 t+=mp[i].second()*(mp[i].second-1)/2;
      |                          ^~~~~~
a.cc:21:42: error: request for member 'second' in 'mp.std::map<int, int>::operator[](i)', which is of non-class type 'std::map<int, int>::mapped_type' {aka 'int'}
   21 |                 t+=mp[i].second()*(mp[i].second-1)/2;
      |                                          ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N,M;cin>>N>>M;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  vector<int64_t>B(N+1);B.at(0)=0;
  for(int i=1;i<=N;i++)
    B.at(i)=(B.at(i-1)+A.at(i-1))%M;
  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 v=p.second;
         ans+=(v*(v-1))/2;
       }cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: expected ';' before 'm'
   13 |     if(m.count(B.at(i))
      |                        ^
      |                        ;
   14 |        m.at(B.at(i))++;
      |        ~                
a.cc:15:8: error: expected primary-expression before 'else'
   15 |        else
      |        ^~~~
a.cc:14:24: error: expected ')' before 'else'
   14 |        m.at(B.at(i))++;
      |                        ^
      |                        )
   15 |        else
      |        ~~~~             
a.cc:13:7: note: to match this '('
   13 |     if(m.count(B.at(i))
      |       ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

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

long long A[100002] = {0};
long long  S[100002] = {0};
map<long long, long long> m;

int main(int argc, char* argv[]){
	int N;
	long long M; 

	cin >> N >> M ;

	A[0] = 0, S[0] = 0;
	for(int i=1; i<=N; i++){
		cin >> A[i];
		S[i] = ( S[i-1]+A[i] ) % M;
		if(m.count(S[i])==0){
			m[S[i]] = 1;
		}
		else{
			long long r = m[S[i]];
			m[S[i]] = r+1;
		}
	}

	unsigned long long ans = 0;
	for(iterator itr=m.begin(); itr!=m.end(); itr++){
		long long k, v;
		k = itr->first;
		v = itr->second;
		if(k==0){
			ans = ans + v + (v*(v-1))/2; //重複OK
		}
		else{
			ans = ans + (v*(v-1))/2;
		}
	}
	printf("%llu\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:34:34: error: class template argument deduction failed:
   34 |         for(iterator itr=m.begin(); itr!=m.end(); itr++){
      |                                  ^
a.cc:34:34: error: no matching function for call to 'iterator(std::map<long long int, long long int>::iterator)'
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
                 from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_iterator_base_types.h:127:34: note: candidate: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> iterator()-> std::iterator<_Category, _Tp, _Distance, _Pointer, _Reference>'
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:127:34: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_iterator_base_types.h:127:34: note: candidate: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> iterator(std::iterator<_Category, _Tp, _Distance, _Pointer, _Reference>)-> std::iterator<_Category, _Tp, _Distance, _Pointer, _Reference>'
/usr/include/c++/14/bits/stl_iterator_base_types.h:127:34: note:   template argument deduction/substitution failed:
a.cc:34:34: note:   'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'std::iterator<_Category, _Tp, _Distance, _Pointer, _Reference>'
   34 |         for(iterator itr=m.begin(); itr!=m.end(); itr++){
      |                                  ^
Language: C++

#include<iostream>//基本
#include<algorithm>//min,maxとか
#include<vector>//配列
#include<string>//文字化
#include<cmath>//
#include<map>//map<int,int>toka
#include<iomanip>//
#include<numeric>//
#include<queue>//
#include<functional>//
#include<tuple>//
#include<intrin.h>
#include<math.h>
#include<bitset>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ld long double
#define sec setprecision　//小数点以下何位まで知りたいか
#define mod 1000000007
#define pi 3.14159265
using namespace std;
int gcd(int a, int b)//最大公約数
{if (a % b == 0)	return(b);
	else return(gcd(b, a % b));}
int lcm(int a, int b)//最小公倍数
{return a * b / gcd(a, b);}
ll pow(ll a, ll b) {ll k = b % 30000, h = b / 30000, s = 1;
	rip(i, 30000)s = (s * a) % mod; ll j = 1;
	if (h != 0)rip(i, h)j = j * s % mod;
	if (k != 0)rip(i, k)j = j * a % mod;
	return(j);}
int main() {
	int n; ll m;
	cin >> n >> m;
	vector<ll>a(n);
	rip(i, n)cin >> a[i], a[i] = a[i] % m;
	ll sum[100010];//dp[i]haa[i]madenowano%m
	sum[0] = 0;
	ll summ = 0;
	rip(i, n) {
		summ += a[i];
		summ = summ % m;
		sum[i+1] = summ;
	}
	map<ll,int> b;
	for (int i =0; i <= n; i++) {
		b[sum[i]] += 1;
	}
	int count = 0;
	for(int i=0;i<m;i++){
		count += b[i] * (b[i] - 1) / 2;
	}
	cout << count << endl;
}

Compiler output:
a.cc:12:9: fatal error: intrin.h: No such file or directory
   12 | #include<intrin.h>
      |         ^~~~~~~~~~
compilation terminated.
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 m = sc.nextLong();
    HashMap<Long, Long> map = new HashMap<Long, Long>();
    map.put(0, 1);
    long sum = 0;
    long ans = 0;
    for(int i = 0; i < n; i++) {
      long a = sc.nextLong();
      sum = (sum + a) % m;
      if(map.containsKey(sum)) ans += map.get(sum);
    }
    System.out.println(ans);
  }
}


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

#include <bits/stdc++.h>
#define INF 1000000000000000001
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N + 1, 0);
  for (ll i = 0; i < N; ++i)
  {
    ll a;
    cin >> a;
    A.at(i + 1) = (A.at(i) + a) % M;
  }
  sort(A.begin(), A.end());
  ll cnt = 0;
  before = -1;
  ll ans = 0;
  for (ll i = 0; i < N; ++i)
  {
    if (A.at(i) == before)
    {
      cnt += 1;
    }
    else
    {
      ans += (cnt - 1) * cnt / 2;
      cnt = 1;
    }
  }
  ans += cnt * (cnt - 1);
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:3: error: 'before' was not declared in this scope
   20 |   before = -1;
      |   ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <stack>
#include <string>
#include <deque>
#include <map>
#include <algorithm>

using namespace std;
//--------------------
int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}

//------------

//-------
void func() {
    int N,M;
    cin >> N >> M ;
    int arr[N];
    for (int j = 0; j < N; ++j) {
        cin >> arr[j];
    }
    
    vector<long long> prefixSum(N + 1);
    prefixSum.at(0) = 0;
    for (int k = 0; k <= N ; ++k) {
        prefixSum.at(k + 1) = (prefixSum.at(k) + arr[k]) % M;
    }
    map<int ,int> counter;
    
    for (int i = 0; i <= N; ++i) {
        if(counter.count(prefixSum.at(i))) {
            ans += counter[prefixSum.at(i)];
            counter[prefixSum.at(i)]++;
        } else {
            counter[prefixSum.at(i)] = 1;
        }
    }
    cout << ans << endl;
}

int main() {
    func();
    return 0;
}

Compiler output:
a.cc: In function 'void func()':
a.cc:38:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   38 |             ans += counter[prefixSum.at(i)];
      |             ^~~
      |             abs
a.cc:44:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <stack>
#include <string>
#include <deque>
#include <map>
#include <algorithm>

using namespace std;
void func() {
    int N,M;
    cin >> N >> M ;
    int sum = 0;
    int ans = 0;
    map<int ,int> counter;
    counter[0] = 0;
    for (int i = 0; i < N; ++i) {
        int a ;
        cin >> a;
        sum += a;
        sum %= M;
        if(counter[sum]) {
            ans += couter[sum];
            couter[sum] += 1;
        } else {
            couter[sum] = 1;
        }
    }
    cout << ans << endl;
}

int main() {
    func();
    return 0;
}

Compiler output:
a.cc: In function 'void func()':
a.cc:26:20: error: 'couter' was not declared in this scope; did you mean 'counter'?
   26 |             ans += couter[sum];
      |                    ^~~~~~
      |                    counter
a.cc:29:13: error: 'couter' was not declared in this scope; did you mean 'counter'?
   29 |             couter[sum] = 1;
      |             ^~~~~~
      |             counter
Language: C++

n,m = map(int,input().split())
lis = list(map(int,input().split()))
rui = [0]
for l in lis:
    rui.append(rui[-1]+l)

count = 0
for i,r in enumerate(rui):
    if i == len(lis):
        break
    for j in range(i+1,len(rui)):
        #print(rui[j],rui[i])
        if (rui[j]-rui[i])%m == 0:
            count += 1
#print(rui)
print(count)

Compiler output:
a.cc:12:10: error: invalid preprocessing directive #print
   12 |         #print(rui[j],rui[i])
      |          ^~~~~
a.cc:15:2: error: invalid preprocessing directive #print
   15 | #print(rui)
      |  ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n,m = map(int,input().split())
      | ^
Language: C++

#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

map<int, int> f;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int sum = 0;
    ll sol = 0;
    f[0] = 1;
    for (int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        sum += x;
        sum %= m;
        sol += [(m - sum) % 10];
        f[sum]++;
    }
    cout << sol;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: expected identifier before '(' token
   26 |         sol += [(m - sum) % 10];
      |                 ^
a.cc: In lambda function:
a.cc:26:32: error: expected '{' before ';' token
   26 |         sol += [(m - sum) % 10];
      |                                ^
a.cc: In function 'int main()':
a.cc:26:13: error: no match for 'operator+=' (operand types are 'll' {aka 'long long int'} and 'main()::<lambda()>')
   26 |         sol += [(m - sum) % 10];
      |         ~~~~^~~~~~~~~~~~~~~~~~~
Language: C++

n, m = gets.split.map(&:to_i)
candies = gets.split.map(&:to_i)
tmp = 0
cumulative_mods = []
hash = Hash.new{ |hash, key| hash[key] = [] }
candies.each_with_index do |c, i|
  mod = (tmp + c) % m
  cumulative_mods << mod
  hash[mod] << i
  tmp = mod
end
sum = 0
(0...n).each do |i|
  tmp_mod = cumulative_mods[i]
  deduction = i == 0 ? 0 : cumulative_mods[i - 1]
  tmp_mod -= deduction
  sum += 1 if tmp_mod == 0
  target = (m - deduction) % m
  target_array = hash[target]
  usable_index = target_array.bsearch_index { |e| e > i } || target_array.size
  usable = target_array.size - usable_index
  sum += usable
end
puts sum


Compiler output:
a.cc:13:2: error: too many decimal points in number
   13 | (0...n).each do |i|
      |  ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n, m = gets.split.map(&:to_i)
      | ^
a.cc:6:1: error: 'candies' does not name a type
    6 | candies.each_with_index do |c, i|
      | ^~~~~~~
a.cc:20:59: error: expected unqualified-id before '||' token
   20 |   usable_index = target_array.bsearch_index { |e| e > i } || target_array.size
      |                                                           ^~
Language: C++

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

#define For(i,a,b) for(int (i) = (a);(i) < (b);i += 1)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "
#define INF 1e18
#define INT_INF 1e9
#define MAX_N 100000

typedef long long ll;
const ll MOD = 1000000007;
const ll MOD_9 = 998244353;

int main(){
    ll N,M;
    cin >> N >> M;
    ll A[N];
    vector<ll> Sum(N);
    Rep(i,N){
        cin >> A[i];
        if(i != 0)Sum[i] = Sum[i-1] + A[i];
        else Sum[i] = A[i];
        Sum[i] %= M;
        //cout << Sum[i] << endl;
    }
    sort(All(Sum));
    ll cnt = 1;
    ll ans = 0;
    Rep(i,N){
        if(Sum[i] == 0)ans++;
    }
    Rep(i,N-1){
        if(Sum[i] == Sum[i+1]){
            cnt++;
        }else if{
            ans += (cnt*(cnt-1))/2;
            cnt = 1;
        }
    }
    ans += (cnt*(cnt-1))/2;
    cout << ans;
    //cin >> N;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:17: error: expected '(' before '{' token
   37 |         }else if{
      |                 ^
      |                 (
Language: C++

#include <vector>
#include <iostream>

using namespace std;
using ll = long long int;

int main() {
  ll N, M;
  cin >> N >> M;
  vector<ll> s(N + 1);

  s[0] = 0;
  ll a = 0;
  for (ll i = 0; i < N; i++) {
    ll tmp; cin >> tmp;
    s[i + 1] = a = (a + tmp) % M;
  }

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

  ll sum = 0;
  ll streak = 0;
  ll current = -1;

  for (ll si : s) {
    if (si == current) {
      streak++;
    } else {
      streak = 0;
      current = si;
    }
    sum += streak;
  }

  cout << sum << endl;
  return 0;
}


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

#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <unordered_map>
#include <cstdint>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef unsigned long long		SQWORD;

/*-----------------------------------------------------------------------------
　メイン
 -------------------------------------------------------------------------------*/
int main()
{
	ll N, M;
	cin >> N >> M;
	map<ll, ll> mp;
	vector<ll> A(N);
	vector<ll> sum(N + 1, 0);
	REP(i, N) {
		cin >> A[i];
		A[i] %= M;
		sum[i + 1] = sum[i] + A[i];
		sum[i + 1] %= M;
		mp[sum[i + 1]]++;
	}
	
	ll ans = 0;
	for (int i = 0; i <= (M + 1) / 2; i++) {
		ll amari = i;
 		ll amariRev = (M - i) % M;
		ll amariPtn = mp[amari] * (mp[amari] + 1) / 2;
 		ll amariPtnRev = mp[amariRev] * (mp[amariRev] + 1) / 2;
		if (amari == 0) {
			ans += amariPtn;
		} else if (amari == amariRev) {
			ans += (amariPtn / 2) * (amariPtn / 2);
		} else {
			ans += amariPtn * amariPtnRev;
		}
	}
	cout << ans << endl;
	return 0;
}



Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <unordered_map>
#include <cstdint>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef unsigned long long		SQWORD;

/*-----------------------------------------------------------------------------
　メイン
 -------------------------------------------------------------------------------*/
int main()
{
	ll N, M;
	cin >> N >> M;
	map<ll, ll> mp;
	vector<ll> A(N);
	vector<ll> sum(N + 1, 0);
	REP(i, N) {
		cin >> A[i];
		A[i] %= M;
		sum[i + 1] = sum[i] + A[i];
		sum[i + 1] %= M;
		mp[sum[i + 1]]++;
	}
	
	ll ans = 0;
	for (int i = 0; i <= (M + 1) / 2; i++) {
		ll amari = i;
 		ll amariRev = (M - i) % M;
		if (amariRev == amari) {
			ans += mp[amari];
		} else {
			ans += mp[amari] * mp[amariRev];
		}
	}
	cout << ans << endl;
	return 0;
}



Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>

using namespace std;
typedef long long ll;

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

int main()
{
    ll N, M;
    cin >> N >> M;

    vector<ll> B;
    ll total = 0;
    RPT(i, N) {
        int tmp;
        cin >> tmp;
        total += tmp;
        B.push_back(total);
    }

    ll count = 0;
    RPT(i, N) {
        for(int j = i; j < N; j++) {
            ll total = (i == 0) ? B[j] : B[j] - B[i-1];
            if (total % M == 0) count++;
        }
    }

    cout << count << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'vector' was not declared in this scope
   14 |     vector<ll> B;
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:14:14: error: expected primary-expression before '>' token
   14 |     vector<ll> B;
      |              ^
a.cc:14:16: error: 'B' was not declared in this scope
   14 |     vector<ll> B;
      |                ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int main() {
    ll N,M; cin>>N>>M; ll A[N],B[N+1]={};
    rep(i,N) cin>>A[i]; B[i+1]=(B[i]+A[i])%M;
    map<ll,ll> ct;
    rep(i,N+1) ++ct[B[i]];
    ll ans=0; 
    for(auto x:ct) ans+=(x.second*(x.second-1))/2;
    cout<< ans<<"\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:27: error: 'i' was not declared in this scope
    7 |     rep(i,N) cin>>A[i]; B[i+1]=(B[i]+A[i])%M;
      |                           ^
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int M = Integer.parseInt(sc.next());
        int[] A = new int[N];
        long[] ruiseki = new long[N+1];
        for (int i=0;i<N;i++) {
            A[i] = Integer.parseInt(sc.next());
            ruiseki[i+1] = ruiseki[i] + A[i];
        }
        HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
        for (int i=0;i<N+1;i++) {
            long r = ruiseki[i]%M;
            r = (int)r;
            if (map.containsKey(r)) {
                map.put(r, map.get(r)+1);
            } else {
                map.put(r, 1);
            }
        }
        ArrayList<Integer> value = new ArrayList<Integer>(map.values());
        long ans = 0L;
        for (Integer i : value) {
            ans += i*(i-1)/2;
        }
        System.out.println(ans);
    }
}

Compiler output:
Main.java:19: error: incompatible types: long cannot be converted to Integer
                map.put(r, map.get(r)+1);
                        ^
Main.java:21: error: incompatible types: long cannot be converted to Integer
                map.put(r, 1);
                        ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
Language: Java

import java.io.*;
import java.util.*;

class Main{
  public static void main(String[] args){
    try{
      InputStreamReader is = new InputStreamReader(System.in);
      BufferedReader br = new BufferedReader(is);
      String[] sp = br.readLine().split(" ");
      int N = Integer.parseInt(sp[0]);
      long M = Long.parseLong(sp[1]);
      sp = br.readLine().split(" ");
      
      long now = 0;
      long[] amaris = new long[N];
      for(int i=0;i<N;i++){
        now=(now+Long.parseLong(sp[i]))%M;
        amaris[now]++;
      }
      long patterns = 0;
      for(int i=0;i<N;i++){
        patterns += (amaris[i]*(amaris[i]-1))/2;
      }
      System.out.println(patterns);
    }catch(IOException e){
      System.out.println(e);
    }
  }
}

Compiler output:
Main.java:18: error: incompatible types: possible lossy conversion from long to int
        amaris[now]++;
               ^
1 error
Language: Java

import java.io.*;
import java.util.*;

class Main{
  public static void main(String[] args){
    try{
      InputStreamReader is = new InputStreamReader(System.in);
      BufferedReader br = new BufferedReader(is);
      String[] sp = br.readLine().split(" ");
      int N = Integer.parseInt(sp[0]);
      long M = Long.parseLong(sp[1]);
      sp = br.readLine().split(" ");
      
      int now = 0;
      long[] amaris = new long[N];
      for(int i=0;i<N;i++){
        now=(now+Long.parseLong(sp[i]))%M;
        amaris[now]++;
      }
      long patterns = 0;
      for(int i=0;i<N;i++){
        patterns += (amaris[i]*(amaris[i]-1))/2;
      }
      System.out.println(patterns);
    }catch(IOException e){
      System.out.println(e);
    }
  }
}

Compiler output:
Main.java:17: error: incompatible types: possible lossy conversion from long to int
        now=(now+Long.parseLong(sp[i]))%M;
                                       ^
1 error
Language: Java

import java.io.*;
import java.util.*;

class Main{
  public static void main(String[] args){
    try{
      InputStreamReader is = new InputStreamReader(System.in);
      BufferedReader br = new BufferedReader(is);
      String[] sp = br.readLine().split(" ");
      int N = Integer.parseInt(sp[0]);
      int M = Integer.parseInt(sp[1]);
      sp = br.readLine().split(" ");
      
      int now = 0;
      long[] amaris = new long[N];
      for(int i=0;i<N;i++){
        now=(now+Long.parseLong(sp[i]))%M;
        amaris[now]++;
      }
      long patterns = 0;
      for(int i=0;i<N;i++){
        patterns += (amaris[i]*(amaris[i]-1))/2;
      }
      System.out.println(patterns);
    }catch(IOException e){
      System.out.println(e);
    }
  }
}

Compiler output:
Main.java:17: error: incompatible types: possible lossy conversion from long to int
        now=(now+Long.parseLong(sp[i]))%M;
                                       ^
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 m = sc.nextLong();
    HashMap<Long, Long> map = new HashMap<Long, Long>();
    long sum = 0;
    for(int i = 0; i < n; i++) {
      long a = sc.nextLong();
      sum = (sum + a) % m;
      if(map.containsKey(sum)) {
        map.put(sum, map.get(sum) + 1);
      } else {
        map.put(sum, 1);
      }
    }
    long ans = 0;
    if(map.containsKey(0)) ans = map.get(0);
    for(long key : map.keySet) {
      ans += ((map.get(key) * (map.get(key) - 1)) / 2);
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:16: error: incompatible types: int cannot be converted to Long
        map.put(sum, 1);
                     ^
Main.java:21: error: keySet is not public in AbstractMap; cannot be accessed from outside package
    for(long key : map.keySet) {
                      ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
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 m = sc.nextLong();
    long[] mod = new long[(int)m];
    long sum = 0;
    for(int i = 0; i < n; i++) {
      long a = sc.nextLong();
      sum = (sum + a) % m;
      mod[sum]++;
    }
    long ans = mod[0];
    for(int i = 0; i < (int)m; i++) {
      ans += ((mod[i] * (mod[i] - 1)) / 2);
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:13: error: incompatible types: possible lossy conversion from long to int
      mod[sum]++;
          ^
1 error
Language: C++

using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  long n,m;
  cin >> n >> m;
  vector<long> sum(n+1);
  sum.at(0) = 0;
  rep(i,n){
    long a;
    cin >> a;
    sum.at(i+1) = sum.at(i) + a;
  }
  map<long,long> mp;
  rep(i,n+1){
    long tmp = sum.at(i) % m;
    if(mp.count(tmp)) mp.at(tmp)++;
    else mp[tmp] = 1;
  }
  long ans = 0;
  rep(i,m){
    if(mp.count(i)){
      long tmp = mp.at(i) * (mp.at(i) - 1) / 2;
      ans += tmp;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc:1:12: error: 'vector' does not name a type
    1 | using vi = vector<int>;
      |            ^~~~~~
a.cc:2:12: error: 'vector' does not name a type
    2 | using vb = vector<bool>;
      |            ^~~~~~
a.cc:3:12: error: 'vector' does not name a type
    3 | using vc = vector<char>;
      |            ^~~~~~
a.cc:4:12: error: 'vector' does not name a type
    4 | using vs = vector<string>;
      |            ^~~~~~
a.cc:5:13: error: 'vector' does not name a type
    5 | using vvi = vector<vector<int>>;
      |             ^~~~~~
a.cc:6:13: error: 'vector' does not name a type
    6 | using vvc = vector<vector<char>>;
      |             ^~~~~~
a.cc:7:13: error: 'pair' does not name a type
    7 | using pii = pair<int, int>;
      |             ^~~~
a.cc: In function 'int main()':
a.cc:13:3: error: 'cin' was not declared in this scope
   13 |   cin >> n >> m;
      |   ^~~
a.cc:14:3: error: 'vector' was not declared in this scope
   14 |   vector<long> sum(n+1);
      |   ^~~~~~
a.cc:14:10: error: expected primary-expression before 'long'
   14 |   vector<long> sum(n+1);
      |          ^~~~
a.cc:15:3: error: 'sum' was not declared in this scope
   15 |   sum.at(0) = 0;
      |   ^~~
a.cc:21:3: error: 'map' was not declared in this scope
   21 |   map<long,long> mp;
      |   ^~~
a.cc:21:7: error: expected primary-expression before 'long'
   21 |   map<long,long> mp;
      |       ^~~~
a.cc:24:8: error: 'mp' was not declared in this scope; did you mean 'tmp'?
   24 |     if(mp.count(tmp)) mp.at(tmp)++;
      |        ^~
      |        tmp
a.cc:29:8: error: 'mp' was not declared in this scope; did you mean 'm'?
   29 |     if(mp.count(i)){
      |        ^~
      |        m
a.cc:34:3: error: 'cout' was not declared in this scope
   34 |   cout << ans << endl;
      |   ^~~~
a.cc:34:18: error: 'endl' was not declared in this scope
   34 |   cout << ans << endl;
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int N, M;
  cin >> N >> M;
  vi A(N);
  rep(i,N) cin >> A[i];

  vi sum(N);
  sum[0] = A[0] % M;
  rep(i,N-1) sum[i+1] = (sum[i] + A[i+1]) % M;
  map<int, int> G;
  ++G[0];
  rep(i,N) ++G[sum[i]];

  ll ans = 0;
  for (auto p : G) {
    ll &v = p.second;
    ans += v*(v-1)/2;
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:27:15: error: cannot bind non-const lvalue reference of type 'll&' {aka 'long long int&'} to a value of type 'int'
   27 |     ll &v = p.second;
      |             ~~^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,m;
  cin >> n >> m;
  vector<ll> a(n);
  vector<ll> sum(n);
  for(int i = 0;i < n;i++){
    ll A;
    cin >> A;
    A %= m;
    a[i] = A;
    if(i == 0)sum[i] = a[i];
    else sum[i] = sum[i-1]+a[i];
    sum[i] %= M;
  }
  sort(sum.begin(),sum.end());
  ll count = 1;
  ll ans = 0;
  for(int i = 0;i < n-1;i++){
    if(s[i] == s[i+1])count++;
    else{
      ans += count*(count-1)/2;
      count = 1;
    }
  }
  ans += count*(count-1)/2;
  cout << ans << endl;
}
    
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'M' was not declared in this scope
   16 |     sum[i] %= M;
      |               ^
a.cc:22:8: error: 's' was not declared in this scope
   22 |     if(s[i] == s[i+1])count++;
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+7;
const int M=1e9+7;
int n,m,a[M],sum[N],tmp;
long long cnt=0LL;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&tmp);
		sum[i]=(sum[i-1]+tmp%m)%m;
		a[sum[i]]++;
	}
	for(int i=0;i<=m-1;i++){
		if(i==0){
			cnt+=a[i];
		}
		cnt+=a[i]*(a[i]-1)/2;
	}
	printf("%lld",cnt);
	return 0;
}

Compiler output:
/tmp/ccifyWta.o: in function `main':
a.cc:(.text+0x3f): relocation truncated to fit: R_X86_64_PC32 against symbol `tmp' defined in .bss section in /tmp/ccifyWta.o
a.cc:(.text+0x6d): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccifyWta.o
a.cc:(.text+0x76): relocation truncated to fit: R_X86_64_PC32 against symbol `tmp' defined in .bss section in /tmp/ccifyWta.o
a.cc:(.text+0xa4): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccifyWta.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccifyWta.o
a.cc:(.text+0x130): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccifyWta.o
a.cc:(.text+0x13a): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccifyWta.o
a.cc:(.text+0x182): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccifyWta.o
a.cc:(.text+0x18c): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccifyWta.o
a.cc:(.text+0x1a6): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccifyWta.o
collect2: error: ld returned 1 exit status
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const ll MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const ll INF = (1 << 28);
const ll dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const ll Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
ll n, m;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    map<ll, ll> modm;
    ll sum = 0;
    for (ll i = 0; i < n; i++)
    {
        ll a;
        cin >> a;
        a = a % m;
        sum += a;
        sum %= m;
        modm[sum]++;
    }
    ll ans = 0;
        for (auto itr = modm.begin(); itr != modm.end(); ++itr)
        {
            ll k = itr->first;
            ll v = itr->second;
            if (k == 0){
                ans+=modm[0];
                ans += ll(modm[k]*(modm[k]-1)/2);
            }
            else{
                ans+=ll(modm[k]*(modm[k]-1)/2);
            }
        }
    
    cout << ans << "\n";
}


Compiler output:
a.cc:20:7: error: 'll' does not name a type
   20 | const ll MOD = 1000000007;
      |       ^~