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

#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<30;
const int MOD = 1000000007;

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


int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    map<ll, ll> nums;
    ll sum = 0;
    nums[sum]++;
    for (int i = 0; i < N; ++i) {
        sum += A[i];
        nums[sum % M]++;
  }
  ll ans = 0;
  for (auto it = nums.begin(); it != nums.end(); ++it) {
    ans += it->second * (it->second - 1) / 2;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:25: error: 'N' was not declared in this scope
   29 |     for (int i = 0; i < N; ++i) {
      |                         ^
a.cc:30:16: error: 'A' was not declared in this scope
   30 |         sum += A[i];
      |                ^
a.cc:31:20: error: 'M' was not declared in this scope
   31 |         nums[sum % M]++;
      |                    ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;


int main(){
	ll n,m;
	cin>>n>>m;
    ll a[n];
    rep(i,0,n)cin>>a[i];
    ll ans=0;
    ll st[n+1];
    map <ll> b;
    map.push_back(0);
    st[0]=0;
    rep(i,1,n+1){
        st[i]=st[i-1]+a[i-1];
        st[i]%=m;
        map.push_back(st[i]);
    }
    rep(i,0,b.size())ans+=b[i]*(b[i]-1)/2;
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: wrong number of template arguments (1, should be at least 2)
   15 |     map <ll> b;
      |            ^
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:16:8: error: expected unqualified-id before '.' token
   16 |     map.push_back(0);
      |        ^
a.cc:21:12: error: expected unqualified-id before '.' token
   21 |         map.push_back(st[i]);
      |            ^
a.cc:23:15: error: request for member 'size' in 'b', which is of non-class type 'int'
   23 |     rep(i,0,b.size())ans+=b[i]*(b[i]-1)/2;
      |               ^~~~
a.cc:2:42: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(auto i=ll(a);i<ll(b);i++)
      |                                          ^
a.cc:23:28: error: invalid types 'int[long long int]' for array subscript
   23 |     rep(i,0,b.size())ans+=b[i]*(b[i]-1)/2;
      |                            ^
a.cc:23:34: error: invalid types 'int[long long int]' for array subscript
   23 |     rep(i,0,b.size())ans+=b[i]*(b[i]-1)/2;
      |                                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(void){
    int n,m; cin>>n>>m;
    vector <int> a(n);
    vector <ll> nums(n+10);
    for(int i=0;i<n;i++){
        scanf("%d", &a[i]);
    }
    ll ans = 0;
    for(int r=0;r<n;r++){
        int cnt =0 ;
        for(int l=r;l>=0;l--){
            cnt += a[l];
            if(cnt!=0&&cnt%m==0) {ans = nums[r+1] = nums[l] + 1;  break;}
        }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'll' was not declared in this scope
    7 |     vector <ll> nums(n+10);
      |             ^~
a.cc:7:15: error: template argument 1 is invalid
    7 |     vector <ll> nums(n+10);
      |               ^
a.cc:7:15: error: template argument 2 is invalid
a.cc:11:7: error: expected ';' before 'ans'
   11 |     ll ans = 0;
      |       ^~~~
      |       ;
a.cc:16:35: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |             if(cnt!=0&&cnt%m==0) {ans = nums[r+1] = nums[l] + 1;  break;}
      |                                   ^~~
      |                                   abs
a.cc:16:45: error: invalid types 'int[long long int]' for array subscript
   16 |             if(cnt!=0&&cnt%m==0) {ans = nums[r+1] = nums[l] + 1;  break;}
      |                                             ^
a.cc:16:57: error: invalid types 'int[long long int]' for array subscript
   16 |             if(cnt!=0&&cnt%m==0) {ans = nums[r+1] = nums[l] + 1;  break;}
      |                                                         ^
a.cc:19:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll v[100100][100100];

void ncr(ll n){
    for(int i=0;i<n+1;i++){
        for(int j=0;j<=i;j++){
            if(j==0||j==i){
                v[i][j]=1;
            }
            else{
                v[i][j]=v[i-1][j-1]+v[i-1][j];
            }
        }
    }
    return ;
}

ll N,M,ans=0,cnt,now;

int main(){
    cin>>N>>M;
    ll A[N];
    ncr(N);
    rep(i,N){
        cin>>A[i];
        A[i]=A[i]%M;
    }
    rep(i,N-1){
        A[i+1]=(A[i+1]+A[i])%M;
    }
    sort(A,A+N);
    now=0;
    cnt=1;
    rep(i,N){
        if(now==A[i]){
            cnt++;
        }
        else{
            // printf("cnt : %lld\n",cnt);
            if(cnt>1)ans+=v[cnt][2];
            // out(ans);
            cnt=1;
            now=A[i];
        }
    }
    if(cnt>1)ans+=v[cnt][2];
    // rep(i,N){
    //     printf("%lld ",A[i]);
    // }
    // out("");
    out(ans);
    

}


Compiler output:
/tmp/ccCS5VRb.o: in function `main':
a.cc:(.text+0x11c): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccCS5VRb.o
a.cc:(.text+0x138): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccCS5VRb.o
a.cc:(.text+0x14a): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccCS5VRb.o
a.cc:(.text+0x194): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccCS5VRb.o
a.cc:(.text+0x1e0): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccCS5VRb.o
a.cc:(.text+0x201): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccCS5VRb.o
a.cc:(.text+0x238): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccCS5VRb.o
a.cc:(.text+0x25c): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccCS5VRb.o
a.cc:(.text+0x26b): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccCS5VRb.o
a.cc:(.text+0x290): relocation truncated to fit: R_X86_64_PC32 against symbol `now' defined in .bss section in /tmp/ccCS5VRb.o
a.cc:(.text+0x29b): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

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

#define int long long
const int N = 1e5 + 9;
int x, n, m, s, ans;
map<int, int> mp;
int main(){
	scanf("%lld%lld", &n, &m);
	for (int i = 1; i <= n; i++)
	{
		scanf("%lld", &x);
		x %= m;
		s += x;
		s %= m;
		ans += mp[s];
		mp[s]++;
		if (!s)
			ans++;
	}
	cout << ans << endl;
}

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

#include <bits/stdc++.h>
// #include "bits:stdc++.h"
using namespace std;
#define LLINF 1234567890987654321
#define ph push
#define ins insert
#define db 0
#define f first
#define s second
typedef long long ll;
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
map <ll, ll> mp;
ll n, m, ans, A[100001], sum[100001];
void make_sum(ll i)
{
	if(i==0)sum[i] = A[i];
	else sum[i] = sum[i-1] + A[i];
}
ll get_sum(ll x, ll y)
{
	if(x == 0)return sum[y];
	else return sum[y] - sum[x-1];
}
int main()
{
	cin >> n >> m;
	for(ll i = 0; i < n; i++)cin >> A[i];
	for(ll i = 0; i < n; i++)make_sum(i);
	mp[0] = 1;
  ll lol=0;
	for(ll i = 0; i < n; i++)
	{
		lol+=A[i];
      	sum=lol;
		ans += mp[sum%m];
		mp[sum%m]++;
	}
	cout << ans << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:12: error: incompatible types in assignment of 'll' {aka 'long long int'} to 'll [100001]' {aka 'long long int [100001]'}
   35 |         sum=lol;
      |         ~~~^~~~
a.cc:36:30: error: invalid operands of types 'll [100001]' {aka 'long long int [100001]'} and 'll' {aka 'long long int'} to binary 'operator%'
   36 |                 ans += mp[sum%m];
      |                           ~~~^~
      |                           |   |
      |                           |   ll {aka long long int}
      |                           ll [100001] {aka long long int [100001]}
a.cc:37:23: error: invalid operands of types 'll [100001]' {aka 'long long int [100001]'} and 'll' {aka 'long long int'} to binary 'operator%'
   37 |                 mp[sum%m]++;
      |                    ~~~^~
      |                    |   |
      |                    |   ll {aka long long int}
      |                    ll [100001] {aka long long int [100001]}
Language: C++

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

//#define int long long
using ll = long long;
const int INF = 1<<29;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var)  std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(int i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(int i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline bool isnatural(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

signed main() {
	ll N,M;
	cin >> N >> M;
	vector<ll> a(N,0);
	rep(i,N)cin >> a[i];

	vector<ll> rui(N+1,0);
	rep(i,N)rui[i+1]=(rui[i]+a[i])%M;

	unordered_map<ll,ll> map;
	rep(i,N+1){
      map[rui[i]]++;
	}

	ll ans=0;
	for(auto it=map.begin();it!=map.end();it++){
		ll t=*it.second;
		if(t>0){
			ans+=t*(t-1)/2;
		}
	}

	p(ans);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:26: error: 'struct std::__detail::_Node_iterator<std::pair<const long long int, long long int>, false, false>' has no member named 'second'
   67 |                 ll t=*it.second;
      |                          ^~~~~~
Language: C++

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

//#define int long long
using ll = long long;
const int INF = 1<<29;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var)  std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(int i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(int i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline bool isnatural(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

signed main() {
	ll N,M;
	cin >> N >> M;
	vector<ll> a(N,0);
	rep(i,N)cin >> a[i];

	vector<ll> rui(N+1,0);
	rep(i,N)rui[i+1]=(rui[i]+a[i])%M;

	unordered_map<ll,ll> map;
	rep(i,N+1){
      map[rui[i]]++;
	}

	ll ans=0;
	for(auto it=map.begin();it!=map.end();it++){
		if(map[i]>0){
			ll t=arr[i];
			ans+=t*(t-1)/2;
		}
	}

	p(ans);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:24: error: 'i' was not declared in this scope; did you mean 'it'?
   67 |                 if(map[i]>0){
      |                        ^
      |                        it
a.cc:68:30: error: 'arr' was not declared in this scope
   68 |                         ll t=arr[i];
      |                              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
int re[1000000001];
signed main(){
	int n,m;cin>>n>>m;
	int a=0ll,b=0ll;
	re[0]=1ll;
	for(int i=0;i<n;i++){
		cin>>a; b+=a;b=(b%m);re[b]++;
}
	int ans=0ll;
	for(int i=0;i<m;i++)ans+=w*(w-1)/2;
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:34: error: 'w' was not declared in this scope
   13 |         for(int i=0;i<m;i++)ans+=w*(w-1)/2;
      |                                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	int n,m;cin>>n>>m;
	vector<int>re(m,0ll);
	int a=0ll,b=0ll;
	re[0]=1ll;
	for(int i=0;i<n;i++){
		cin>>a; b+=a;b=(b%m);re[b]++;
}
	int ans=0ll;
	for(auto&& w:re)ans+=w*(w-1)/2;
	cout<<ans<<endl;
}
ll

Compiler output:
a.cc:16:1: error: 'll' does not name a type
   16 | ll
      | ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
int main(){
	int n,m;cin>>n>>m;
	vector<int>re(m,0);
	int a=0,b=0;
	re[0]=1;
	for(int i=0;i<n;i++){
		cin>>a; b+=a;b=(b%m);re[b]++;
}
	int ans=0;
	for(auto&& w:re)ans+=w*(w-1)/2;
	cout<<ans<<endl;
}

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

#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int64 n,m;
  cin>>n>>m;
  int64 ans=0,a[n],sum[n];
  rep(i,n){
    cin>>a[i];
  }
  sum[0]=a[0]%m;
  rep1(i,n){
    sum[i]=(a[i]+sum[i-1])%m;
  }
  map<int64,int64> mp;
  mp[0]++;
  rep(i,n){
    mp[sum[i]]++;
  }
  for(auto p:mp){
    ans+=p.second()*(p.second()-1)/2;
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:18: error: expression cannot be used as a function
   31 |     ans+=p.second()*(p.second()-1)/2;
      |          ~~~~~~~~^~
a.cc:31:30: error: expression cannot be used as a function
   31 |     ans+=p.second()*(p.second()-1)/2;
      |                      ~~~~~~~~^~
Language: C++

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


int main(){
  int N, M;cin>>N>>M;
  map<ll, ll> counter;
  for (auto i=0;i<N;++i){
    ll a;cin>>a;
    counter[a%M]++;
  }

  int L=counter.size();
  ll ans=0;
  for (int p:counter){
    ll c=p.second;
    ans+=(c*(c-1))/2;
  }

  ans+=counter[0];
  
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: cannot convert 'std::pair<const long long int, long long int>' to 'int' in initialization
   16 |   for (int p:counter){
      |              ^~~~~~~
a.cc:17:12: error: request for member 'second' in 'p', which is of non-class type 'int'
   17 |     ll c=p.second;
      |            ^~~~~~
Language: C++

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


int main(){
  int N, M;cin>>N>>M;
  map<ll, ll> counter;
  for (int i=0;i<N;++i){
    ll a;cin>>a;
    counter[a%M]++;
  }

  int L=counter.size();
  ll ans=0;
  for (int p:counter){
    ll c=p.second;
    ans+=(c*(c-1))/2;
  }

  ans+=counter[0];
  
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: cannot convert 'std::pair<const long long int, long long int>' to 'int' in initialization
   16 |   for (int p:counter){
      |              ^~~~~~~
a.cc:17:12: error: request for member 'second' in 'p', which is of non-class type 'int'
   17 |     ll c=p.second;
      |            ^~~~~~
Language: C++

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


int main(){
  int N, M;cin>>N>>M;
  map<ll, ll> counter;
  for (int i=0;i<N;++i){
    ll a;cin>>a;
    map[a%M]++;
  }

  int L=counter.size();
  ll ans=0;
  for (int p:counter){
    ll c=p.second;
    ans+=(c*(c-1))/2;
  }

  ans+=counter[0];
  
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: expected ']' before '%' token
   11 |     map[a%M]++;
      |          ^
      |          ]
a.cc:11:9: error: conflicting declaration 'auto a'
   11 |     map[a%M]++;
      |         ^
a.cc:10:8: note: previous declaration as 'll a'
   10 |     ll a;cin>>a;
      |        ^
a.cc:11:13: error: expected initializer before '++' token
   11 |     map[a%M]++;
      |             ^~
a.cc:16:14: error: cannot convert 'std::pair<const long long int, long long int>' to 'int' in initialization
   16 |   for (int p:counter){
      |              ^~~~~~~
a.cc:17:12: error: request for member 'second' in 'p', which is of non-class type 'int'
   17 |     ll c=p.second;
      |            ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
#define set(i) setprecision(i)
using namespace std;

signed main(){
    int n,m; cin>>n>>m;
    map<int, int> rem;
    rem[0]++;
    int sum=0;
    rep(i,n){
        int a; cin>>a;
        sum+=a;
        rem[sum%m]++;
    }
    int ans=0;
    rep(i,rem.size()){
        ans+=(rem[i]-1)*rem[i]/2;
    }
    cout<<ans<<endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:28:21: error: expected '}' at end of input
   28 |     cout<<ans<<endl;
      |                     ^
a.cc:14:14: note: to match this '{'
   14 | signed main(){
      |              ^
Language: Java

import java.util.Scanner;
import java.util.HashMap;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long m = sc.nextLong();
		long[] a=new long[n];
		HashMap<Long,Long> map=new HashMap<>();
		long ans = 0;
		a[0]=sc.nextLong();
		for(int i = 1; i<n; i++){
			 a[i] = sc.nextLong()+a[i-1];
		}
		for(int i = 0; i<n; i++){
			if(map.containsKey(a[i]%m)){
				map.put(a[i]%m,map.get(a[i]%m)+1);
			}else{
				map.put(a[i]%m,1);
			}
		}
		for(long i:map.keySet()){
			long q=map.get(i);
			if(i==0){
				ans+=q;
			}
			ans+=(q*(q-1))/2;
		}
		System.out.println(ans);
	}
}

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

#include <iostream>
#include "bits/stdc++.h"

using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i, a, b) for(ll i=a;i<b;i++)
#define REP(i, a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i, a) for(ll i=a;i>0;i--)
#define rrep(i, a, b) for(ll i=a-1;i>=b;i--)
#define printall(n, array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
typedef vector<vector<ll>> VVE;
const ll mod = 1e9 + 7; //10^9+7

ll modpow(ll x, ll p){
    if(p == 0) return 1;
    if(p % 2) return  x * modpow(x, p - 1) % mod;
    else {
        ll res = modpow(x, p / 2);
        return res * res % mod;
    }
}

ll comb(ll n, ll r){
    ll mul = 1;  //n!
    ll div1, div2;
    rep(i, 1, n + 1){
        mul *= i;
        mul %= mod;
        if(i == r) div1 = modpow(mul, mod - 2);  //r!
        if(i == n - r) div2 = modpow(mul, mod - 2); //(n-r)!
    }
    return mul * div1 % mod * div2 % mod;
}


int main() {
    ll n, m;
    cin >> n >> m;
    VE a(n);
    REP(i, n) cin >> a[i];
    VE sum(n + 1, 0);
    rep(i, 1, n + 1) sum[i] = sum[i - 1] + a[i - 1];
    jkl;
    map<ll, ll> mp;
    REP(i, n + 1) mp[sum[i] % m]++;
    ll ans = 0;
    for (auto itr = mp.begin(); itr != mp.end(); itr++){
        if(itr->second < 2)continue;
        ans += comb(itr->second, 2);
    }
    print(ans);
}#include <iostream>
#include "bits/stdc++.h"

using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i, a, b) for(ll i=a;i<b;i++)
#define REP(i, a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i, a) for(ll i=a;i>0;i--)
#define rrep(i, a, b) for(ll i=a-1;i>=b;i--)
#define printall(n, array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
typedef vector<vector<ll>> VVE;
const ll mod = 1e9 + 7; //10^9+7

int main() {
    ll n, m;
    cin >> n >> m;
    VE a(n);
    REP(i, n) cin >> a[i];
    VE sum(n + 1, 0);
    rep(i, 1, n + 1) sum[i] = sum[i - 1] + a[i - 1];
    jkl;
    ll ans = 0;
    rep(i, 0, n + 1)rep(j, i + 1, n + 1){
        if((sum[j] - sum[i]) % m)continue;
        ans++;
    }
    print(ans);
}









Compiler output:
a.cc:59:2: error: stray '#' in program
   59 | }#include <iostream>
      |  ^
a.cc:59:3: error: 'include' does not name a type
   59 | }#include <iostream>
      |   ^~~~~~~
a.cc:77:10: error: redefinition of 'const ll mod'
   77 | const ll mod = 1e9 + 7; //10^9+7
      |          ^~~
a.cc:19:10: note: 'const ll mod' previously defined here
   19 | const ll mod = 1e9 + 7; //10^9+7
      |          ^~~
a.cc:79:5: error: redefinition of 'int main()'
   79 | int main() {
      |     ^~~~
a.cc:43:5: note: 'int main()' previously defined here
   43 | int main() {
      |     ^~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+9
#define MOD 1000000007
using namespace std;


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


Compiler output:
a.cc: In function 'int main()':
a.cc:44:36: error: expected ';' before 'cnt'
   44 |             ans +=  cnt*(cnt-1) / 2
      |                                    ^
      |                                    ;
   45 |             cnt=1;
      |             ~~~
Language: C++

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n+1);
    for(int i=0;i<a.size();i++)
    {
        cin >> a[i];
    }

    map<int, int> ma;
    vecotr<int> sum(n+1);
    sum[0] = 0;
    for(int i=0; i<n; i++)
    {
        sum[i+1] = (sum[i] + a[i]) % m;
    }

    long long ans = 0;
    for(int i=0; i<sum.size(); i++)
    {
        ans += ma[sum[i]];
        ma[sum[i]]++;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'vecotr' was not declared in this scope
   15 |     vecotr<int> sum(n+1);
      |     ^~~~~~
a.cc:15:12: error: expected primary-expression before 'int'
   15 |     vecotr<int> sum(n+1);
      |            ^~~
a.cc:16:5: error: 'sum' was not declared in this scope
   16 |     sum[0] = 0;
      |     ^~~
Language: C++

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n+1);
    for(int i=0;i<a.size();i++)
    {
        cin >> a[i];
    }

    map<int, int> m;
    vecotr<int> sum(n+1);
    sum[0] = 0;
    for(int i=0; i<n; i++)
    {
        sum[i+1] = (sum[i] + a[i]) % m;
    }

    long long ans = 0;
    for(int i=0; i<sum.size(); i++)
    {
        ans += m[sum[i]];
        m[sum[i]]++;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: conflicting declaration 'std::map<int, int> m'
   14 |     map<int, int> m;
      |                   ^
a.cc:6:12: note: previous declaration as 'int m'
    6 |     int n, m;
      |            ^
a.cc:15:5: error: 'vecotr' was not declared in this scope
   15 |     vecotr<int> sum(n+1);
      |     ^~~~~~
a.cc:15:12: error: expected primary-expression before 'int'
   15 |     vecotr<int> sum(n+1);
      |            ^~~
a.cc:16:5: error: 'sum' was not declared in this scope
   16 |     sum[0] = 0;
      |     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	long long int p,d,ans=0,y=0;
 	cin >> p>>d;
 	vector <int> a;
 	a.push_back(0);
 	for (int i = 0; i < p; i++){
 		int x;
 		cin >> x;
 		y=x+y;
 		a.push_back(y%d);
 	}
 	}
 	cout << endl;
 	int c =count(a.begin(),a.end(),0);
 	ans=ans+c*c-c;
 	for (int i = 1; i < d; i++){
 		int h=count(a.begin(),a.end(),i);
 		ans=ans+h*h-h;
 	}
 	cout << ans/2 << endl;
 }

Compiler output:
a.cc:18:9: error: 'cout' does not name a type
   18 |         cout << endl;
      |         ^~~~
a.cc:19:22: error: 'a' was not declared in this scope
   19 |         int c =count(a.begin(),a.end(),0);
      |                      ^
a.cc:19:32: error: 'a' was not declared in this scope
   19 |         int c =count(a.begin(),a.end(),0);
      |                                ^
a.cc:20:9: error: 'ans' does not name a type
   20 |         ans=ans+c*c-c;
      |         ^~~
a.cc:21:9: error: expected unqualified-id before 'for'
   21 |         for (int i = 1; i < d; i++){
      |         ^~~
a.cc:21:25: error: 'i' does not name a type
   21 |         for (int i = 1; i < d; i++){
      |                         ^
a.cc:21:32: error: 'i' does not name a type
   21 |         for (int i = 1; i < d; i++){
      |                                ^
a.cc:25:9: error: 'cout' does not name a type
   25 |         cout << ans/2 << endl;
      |         ^~~~
a.cc:26:2: error: expected declaration before '}' token
   26 |  }
      |  ^
Language: C++

#include <bits/stdc++.h>
#define int long long
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define inout(s) freopen((string(s) + ".inp").c_str(), "r", stdin),\
		freopen((string(s) + ".out").c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 1e5 + 5, LIM = 1e6 + 5;
int n, m, a[N];
map<int, int> cnt;
signed main() {
	#ifdef BLU
	//in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	fw (i, 0, n) cin >> a[i];
	memset(cnt, 0, sizeof cnt);
	cnt[0]++;
	int sum = 0, ans = 0;
	fw (i, 0, n) {
		sum += a[i];
		sum %= m;
		ans += cnt[sum];
		cnt[sum]++;
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: cannot convert 'std::map<long long int, long long int>' to 'void*'
   26 |         memset(cnt, 0, sizeof cnt);
      |                ^~~
      |                |
      |                std::map<long long int, long long int>
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
Language: Java

import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), m = sc.nextInt();
        Map<Integer,Integer> map = new HashMap<>();
        int[] sum = new int[n+1];
        long ans = 0;
        sum[0] = 0;
        map.put(0, 1);
        for(int i = 1; i < n+1; i++){
            sum[i] = (sum[i-1] + sc.nextInt()) % m;
            if(!map.containsKey(sum[i])){
                map.put(sum[i], 1);
            }else{
                map.put(sum[i], map.get(sum[i]) + 1);
            }
            ans += map.get(sum[i]) - 1;
        }
        System.out.println(ans);
    }
}}

Compiler output:
Main.java:24: error: class, interface, enum, or record expected
}}
 ^
1 error
Language: C++

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

int main(){
	int N,M;
	cin >> N >> M;
	vector<int> A(N);
	for(int i=0;i<A.size();i++) cin >> A[i];

	map<int, int> m;
	vector<int> sum(N+1);
	for(int i=0;i<N;i++) sum[i+1]=(sum[i]+A[i])%M;

	ll ans=0;
	for(int i=0;i<sum.size();i++) {
			ans += m[sum[i]];
			m[sum[i]]++;
		}
	}

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


Compiler output:
a.cc:22:9: error: 'cout' does not name a type
   22 |         cout << ans << endl;
      |         ^~~~
a.cc:23:9: error: expected unqualified-id before 'return'
   23 |         return 0;
      |         ^~~~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

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

int main(){
	int N,M;
	cin >> N >> M;
	vector<int> A(N);
	for(int i=0;i<A.size();i++) cin >> A[i];

	map<int, int> m;
	vector<int> sum(N+1);
	for(int i=0;i<N;i++) sum[i+1]=(sum[i]+A[i])%M;

	ll ans=0;
	for(int i=0;i<sum.size();i++) {
			ans += m[sum[i]];
			m[sum[i]]++;
		}
	}

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


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

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;
typedef long long ll;
#define INF (1e9)
#define REP(i, n) for((int)(i) = 0; (i) < (n); (i)++)
#define each(i, mp) for((auto) (i):(mp))
#define FOR(i, m, n) for(int i = m;i < n;i++)

const int MAX_N = int(1e5);
ll N, M, A[MAX_N];


void solve() {
    unordered_map<ll, ll> mp;
    ll ans = 0;
    ll dp[N + 1];
    REP(i, N) {
        dp[i + 1] = (dp[i] + A[i]) % M;
        mp[dp[i + 1]]++;
    }
    each(mod, mp) {
        ans += mod.second * (mod.second - 1) / 2;
        if (mod.first == 0) ans += mod.second;
    }
    cout << ans << endl;
}

int main() {
    cin >> N >> M;
    REP(i, N) cin >> A[i];
    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:24:9: error: 'i' was not declared in this scope
   24 |     REP(i, N) {
      |         ^
a.cc:12:29: note: in definition of macro 'REP'
   12 | #define REP(i, n) for((int)(i) = 0; (i) < (n); (i)++)
      |                             ^
a.cc:13:26: error: expected primary-expression before 'auto'
   13 | #define each(i, mp) for((auto) (i):(mp))
      |                          ^~~~
a.cc:28:5: note: in expansion of macro 'each'
   28 |     each(mod, mp) {
      |     ^~~~
a.cc:13:26: error: expected ')' before 'auto'
   13 | #define each(i, mp) for((auto) (i):(mp))
      |                         ~^~~~
a.cc:28:5: note: in expansion of macro 'each'
   28 |     each(mod, mp) {
      |     ^~~~
a.cc:33:1: error: expected primary-expression before '}' token
   33 | }
      | ^
a.cc:32:25: error: expected ';' before '}' token
   32 |     cout << ans << endl;
      |                         ^
      |                         ;
   33 | }
      | ~                        
a.cc:33:1: error: expected primary-expression before '}' token
   33 | }
      | ^
a.cc:32:25: error: expected ')' before '}' token
   32 |     cout << ans << endl;
      |                         ^
      |                         )
   33 | }
      | ~                        
a.cc:13:24: note: to match this '('
   13 | #define each(i, mp) for((auto) (i):(mp))
      |                        ^
a.cc:28:5: note: in expansion of macro 'each'
   28 |     each(mod, mp) {
      |     ^~~~
a.cc:33:1: error: expected primary-expression before '}' token
   33 | }
      | ^
a.cc: In function 'int main()':
a.cc:37:9: error: 'i' was not declared in this scope
   37 |     REP(i, N) cin >> A[i];
      |         ^
a.cc:12:29: note: in definition of macro 'REP'
   12 | #define REP(i, n) for((int)(i) = 0; (i) < (n); (i)++)
      |                             ^
Language: C++

using namespace std;

int main() {
    int N, M;

    cin >> N >> M;

    int a[N+10];
    int b[N+10];

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

    b[0] = 0;
    for (int i = 1; i < N; ++i)
    {
       b[i] = (b[i-1] + a[i]) % M;
    }
    long ans = 0;

    for (int i = 0; i <= N; ++i) {
      for (int j = i+1; j <= N; ++j) {
        if(b[j] - b[i] == 0) ans++;
      }
    }

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> N >> M;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:30:5: error: 'cout' was not declared in this scope
   30 |     cout << ans << endl;
      |     ^~~~
a.cc:30:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:20: error: 'endl' was not declared in this scope
   30 |     cout << ans << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

/*
title:D - Candy Distribution

url:https://abc105.contest.atcoder.jp/tasks/abc105_d

方針:
A_l + ... A_r
にひつようなパラメーターはlとrのみなので、累積和を用いることで計算量を減らす。
また、すべてのl, rを累積和に対しててきようしていたのでは、計算量がO(N^2)となり、計算が間に合わない。
知りたい情報は,(l, r)のうち、Mで割り切れるかどうかである。知りたい情報量が少ないのでもっと少ない計算量で
答えを求めることができるのではないかと考える。
じっさいにMを法として、各累積和のうちあまりが同じものの数を考える。
例えばあまり1のものが５個あれば、5C2とおりの条件を満たす(l, r)があるはずである。
これを利用して答えを求める。
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

typedef pair<int, int> pint;
typedef long long ll;

int main()
{
    ll N, M;
    cin >> N >> M;
    //元のデータ
    int original_data[N + 1];
    for (int i = 1; i <= N; i++)
    {
        cin >> data[i];
    }

    //同じ余りのものを記録しておく
    ll *mod = (ll *)malloc(sizeof(ll) * M);
    memset(mod, 0, sizeof(mod));
    mod[0]++;

    //累積和.indexは１つずつずらしておく
    ll acc[N + 1];
    memset(acc, 0, sizeof(acc));
    acc[0] = 0;

    bool *used = (bool *)malloc(sizeof(bool) * M);
    vector<int> which_to_use;
    for (int i = 1; i <= N; i++)
    {
        acc[i] = acc[i - 1] + original_data[i];
        int tmp = acc[i] % M;
        mod[tmp]++;
        if (!used[tmp])
        {
            used[tmp] = true;
            which_to_use.push_back(tmp);
        }
    }

    ll ans = 0;
    //すべてのMに対して走査すると、とんでもなく時間がかかる
    //したがって、あらかじめどの余りの時に計算が必要か記録しておく
    /*
    for (int i = 0; i < M; i++)
    {
        ans += mod[i] * (mod[i] - 1) / 2;
    }
    */
    for (int i = 0; i < which_to_use.size(); i++)
    {
        ans += mod[which_to_use[i]] * (mod[which_to_use[i]] - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:20: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   44 |         cin >> data[i];
      |                    ^
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>
#include <queue>
#include <regex>
#include <cassert>
// #include "bits/stdc++.h"

using namespace std;
//debug

#define rep(i, N, M) for (ll i = N; i < M; ++i)
#define rrep(i, N, M) for (ll i = N; i < M; --i)
#define pb push_back



typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef priority_queue<pll, vector<pll>, greater<pll>> greater_pq;


#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vec(a) vector<a>

template<class T, class S>
T atbit(T n, S i) {
	return (n >> i) % i;
}
template<class T>
T getbit( T i) {
	return 1LL<<i;
}

using namespace std;

ll A[100100] = { 0LL };
ll sum[100100] = { 0LL };

int main() {
	ll N, M;
	cin >> N >> M;
	//vll A(N),sum(N+1,0);
	rep(i, 0, N) {
		//cin >> A[i];
		scanf_s("%d", &A[ i]);
		sum[i+1] += (i>0?sum[i]:0)+A[i];
		
	}
	ll cnt = 0LL;
	rep(l, 0, N) {
		rep(r,l, N) {
			if ((sum[r + 1] - sum[l])%M==0) {
				++cnt;
			}
		}
	}
	cout << cnt;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   62 |                 scanf_s("%d", &A[ i]);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <unordered_map>

using namespace std;

typedef long long ll;

ll N, M;
ll A[100010];
ll ASUM[100010];
ll dp[100010];
ll count=0;
unordered_map<ll,ll> map;

int main() {
   cin >> N >> M;
   for (ll i=1;i<=N;i++) {
      cin >> A[i];
      ASUM[i] = A[i] + ASUM[i-1];
      map[ASUM[i] % M] = map[ASUM[i] % M] + 1;
      if (ASUM[i] % M == 0) {
	 count++;
      }
   }
   for (auto iter=map.begin(); iter != map.end(); ++iter) {
      //cout << iter->first << ":" << iter->second << endl;
      ll val = iter->second;
      count += val * (val - 1) / 2;
   }
   cout << count << endl;
   return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:4: error: 'cin' was not declared in this scope
   15 |    cin >> N >> M;
      |    ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <unordered_map>
  +++ |+#include <iostream>
    2 | 
a.cc:29:4: error: 'cout' was not declared in this scope
   29 |    cout << count << endl;
      |    ^~~~
a.cc:29:4: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:21: error: 'endl' was not declared in this scope
   29 |    cout << count << endl;
      |                     ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <unordered_map>
  +++ |+#include <ostream>
    2 |
Language: C++

#include <iostream>
#include <stack>
#include <map>

#define ll long long
using namespace std;
ll N,M;
ll A[101234];
ll ans=0,a;
map<ll,ll> llmap;
int i,j,k;
ll a,b;

int main(){
    cin>>N>>M;
    for(i=1;i<=N;i++){
        cin>>A[i];
    }
    map[0]=1;
    for(i=0;i<=N;i++){
        a=(a+A[i])%M;
        llmap[a]++;
    }
    for(auto l:llmap){
        ans+=(l.second-1)*l.second/2;
    }
    cout<< ans<<endl;
    return 0;
}

Compiler output:
a.cc:12:4: error: redefinition of 'long long int a'
   12 | ll a,b;
      |    ^
a.cc:9:10: note: 'long long int a' previously declared here
    9 | ll ans=0,a;
      |          ^
a.cc: In function 'int main()':
a.cc:19:9: error: expected identifier before numeric constant
   19 |     map[0]=1;
      |         ^
a.cc:19:9: error: expected ']' before numeric constant
   19 |     map[0]=1;
      |         ^
      |         ]
a.cc:19:8: error: empty structured binding declaration
   19 |     map[0]=1;
      |        ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;
template <typename... Args>
void dbg(Args&&... args) {
  using expander = int[];
  (void)expander {0,(static_cast<void>(void(cout << std::forward<Args>(args) << " ")), 0)...};
  cout << endl;
}
void gen() {exit(0);}

const int N = 1e5 + 5;
const int M = 1e9 + 5;
int n, m;
int a[N];

void input() {
  scanf("%d %d", &n, &m);
  forn(i, 0, n) {
    scanf(" %d", &a[i]);
  }
}

ll ans = 0;
int counts[M];
int mods[N];

void solve() {
  forn(i, 0, n) {
    mods[i] += ((i == 0 ? 0 : mods[i - 1]) + a[i]) % m;
    ans += counts[(mods[i]) % m] + (mods[i] == 0);
    counts[mods[i]]++;
  }
 
  printf("%lld\n", ans);
}

int main() {
#ifdef DEBUG
  freopen("input", "r", stdin);
  //  freopen("output", "w", stdout);
  //  gen();
#endif
  input();
  solve();
  return 0;
}


Compiler output:
/tmp/ccneC0nG.o: in function `solve()':
a.cc:(.text+0xac): relocation truncated to fit: R_X86_64_PC32 against symbol `mods' defined in .bss section in /tmp/ccneC0nG.o
a.cc:(.text+0xcc): relocation truncated to fit: R_X86_64_PC32 against symbol `mods' defined in .bss section in /tmp/ccneC0nG.o
a.cc:(.text+0x113): relocation truncated to fit: R_X86_64_PC32 against symbol `mods' defined in .bss section in /tmp/ccneC0nG.o
a.cc:(.text+0x12a): relocation truncated to fit: R_X86_64_PC32 against symbol `mods' defined in .bss section in /tmp/ccneC0nG.o
a.cc:(.text+0x162): relocation truncated to fit: R_X86_64_PC32 against symbol `mods' defined in .bss section in /tmp/ccneC0nG.o
a.cc:(.text+0x197): relocation truncated to fit: R_X86_64_PC32 against symbol `mods' defined in .bss section in /tmp/ccneC0nG.o
collect2: error: ld returned 1 exit status
Language: C++

#include "bitsstdc++.h"
using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	vector<int> SUM(N + 1);
	SUM[0] = 0;
	map<int, int> m;

	for (int i = 0; i < A.size(); i++) {
		SUM[i + 1] = (SUM[i] + A[i]) % M;
	}

	long ans = 0;
	for (int i = 0; i < A.size(); i++) {
		ans += m[SUM[i]];
		m[SUM[i]]++;
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:1:10: fatal error: bitsstdc++.h: No such file or directory
    1 | #include "bitsstdc++.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();
        int M=sc.nextInt();
        int[] A=new int[N];
        int cnt=0;
        long sum;

        for(int i=0;i<N;i++){
            A[i]=sc.nextint();
            sum=0.0;
            for(int j=i;j<N;j++){
                sum+=A[j];
                if(sum%M==0){
                    cnt++;
                }
            }
        }
        System.out.println(""+cnt);
    }
}

Compiler output:
Main.java:14: error: cannot find symbol
            A[i]=sc.nextint();
                   ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:15: error: incompatible types: possible lossy conversion from double to long
            sum=0.0;
                ^
2 errors
Language: Java

import java.util.Scanner;

public class Candy_Distribution{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        long N = scan.nextLong();
        long M = scan.nextLong();

        long A[] = new long[(int)N];
        int i;
        for(i = 0; i < N; i++){
            A[i] = scan.nextLong();
        }

        int count = 0;
        int r = 0;
        int j,l;
        long total;

        while(r < N){
            j = 0;
            while(j < r+1){
                l = j;
                total = 0;
                while(l <= r){
                    total += A[l];
                    if(l == r){
                        if(total % M == 0){
                            count++;
                            break;
                        }
                        else{
                            break;
                        }
                    }
                    else{
                        l++;
                    }
                }
                j++;
            }
            r++;
        }
        System.out.println(count);
    }
}

Compiler output:
Main.java:3: error: class Candy_Distribution is public, should be declared in a file named Candy_Distribution.java
public class Candy_Distribution{
       ^
1 error