criyle/codenet-compile-errors huggingface dataset:
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];
        for(int i = 0; i < N; i++){
            A[i] = scan.nextLong();
        }

        int count = 0;
        int l;
        long total;

        for(int r = 0; r < N; r++){
            for(int j = 0; j < r+1; j++){
                l = j;
                total = 0;
                while(l <= r){
                    total += A[l];
                    if(l == r){
                        if(total % M == 0){
                            count++;
                            break;
                        }
                        else{
                            break;
                        }
                    }
                    else{
                        l++;
                    }
                }
            }
        }
        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
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include "contest.h"
#include <numeric>
using namespace std;

long long sum(vector<long long> v, int i, int j){
    long long a = 0;
    for(int p = i; p <= j ; p++){ a += v[p] ;};
    return a;
}

int main(){
    long long N,M,count=0;
    cin >> N >> M;
    vector<long long> A(N);
    for(int i=0; i < N ; i++){
        cin >> A[i];
    }
    for(int i=0 ; i < N ; i++){
        for(int j=i ; j < N ; j++){
            if(sum(A,i,j)%M == 0) count += 1;
        }
    }
    for(int i=0 ; i < N ; i++){
        for(int j=i ; j < N ; j++){
            cout << sum(A,i,j) << " " ;
        }cout << endl;
    }
    cout << count << endl;
	return 0;
}

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

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


int main(){
	int n,m;
	cin>>n>>m;
	ll ans=0,sum=0;
	map<ll,ll>s;
	map[sum]++;
	rep(i,n){
		ll a;
		cin>>a;
		sum=(sum+a)%m;
		s[sum]++;
	}

	for(auto i:s){
		ans+=i.second*(i.second-1)/2;
	}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: conflicting declaration 'auto sum'
   13 |         map[sum]++;
      |             ^~~
a.cc:11:18: note: previous declaration as 'll sum'
   11 |         ll ans=0,sum=0;
      |                  ^~~
a.cc:13:17: error: expected initializer before '++' token
   13 |         map[sum]++;
      |                 ^~
Language: C++

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


int main(){
	int n,m;
	cin>>n>>m;
	ll ans=0,sum=0;
	map<int,int>s;
	rep(i,n){
		int a;
		cin>>a;
		sum=(sum+a)%m;
		s[sum]++;
	}

	for(auto i:m){
		ans+=i.second*(i.second-1)/2;
	}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:20:20: error: 'begin' was not declared in this scope
   20 |         for(auto i:m){
      |                    ^
a.cc:20:20: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:20:20: error: 'end' was not declared in this scope
   20 |         for(auto i:m){
      |                    ^
a.cc:20:20: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
Language: C++

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


int main(){
	int n,m;
	cin>>n>>m;
	ll ans=0,sum=0;
	map<int,int>s;
	rep(i,n){
		int a;
		cin>>a;
		sum=(sum+a)%m;
		s[sum]++;
	}

	for(auto i:m){
		ans+=i*(i-1)/2;
	}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:20:20: error: 'begin' was not declared in this scope
   20 |         for(auto i:m){
      |                    ^
a.cc:20:20: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:20:20: error: 'end' was not declared in this scope
   20 |         for(auto i:m){
      |                    ^
a.cc:20:20: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
Language: C++

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


int main(){
	int n,m;
	cin>>n>>m;
	ll ans=0,sum=0;
	map<int,int>s;
	rep(i,n){
		int a;
		cin>>a;
		sum=(sum+a)%m;
		s[sum]++;
	}
	for(auto i=:m){
		ans+=i*(i-1)/2;
	}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:19:20: error: expected primary-expression before ':' token
   19 |         for(auto i=:m){
      |                    ^
a.cc:21:10: error: expected ';' before 'cout'
   21 |         }
      |          ^
      |          ;
   22 | 
   23 |         cout<<ans<<endl;
      |         ~~~~
a.cc:24:9: error: expected primary-expression before 'return'
   24 |         return 0;
      |         ^~~~~~
a.cc:23:25: error: expected ')' before 'return'
   23 |         cout<<ans<<endl;
      |                         ^
      |                         )
   24 |         return 0;
      |         ~~~~~~           
a.cc:19:12: note: to match this '('
   19 |         for(auto i=:m){
      |            ^
Language: C++

#include<iostream>
#include<map>
using namespace std;
typedef long long int LL;

int main(){
    int n;
    long long A[10004];
    long long sum[10004]={0};
    map<LL,LL>mp;
    mp[0]++;
    long long  m;
    cin>>n>>m;
    for(int i=1; i<=n;i++)
    {
        cin>>A[i];
    }
    int count=0;
    
    for(int j=1; j<=n; j++)
    {
        sum[j]=sum[j-1]+A[j];
        LL temp=sum[j]%m;
        count+=mp[temp];
        mp[temp]++;
    }
    
    cout<<count;
    return 0;
    

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

#include <stdio.h.>
int main(void){
	int N,M;
	scanf("%d %d",&N,&M);
	//printf("N=%d M=%d\n",N,M);
	int a[N][N];
	long i,j;
	int ans=0;
	for(i=0;i<N;i++){
		scanf("%d",&a[i][0]);
		a[i][0]%=M;
	}
	for(i=0;i<N;i++){
		for(j=0;j<N;j++){
			a[i][j]=a[i][0];
		}
	}
	/*for(i=0;i<N;i++){
		for(j=0;j<N;j++){
			printf("a[%d][%d]=%d\n",i,j,a[i][j]);
		}
	}*/
	//列を固定して行ごとに足して割る 割った結果が0ならans++;
	for(i=0;i<N;i++){
		if(a[i][i]==0){
			ans++;
		}
		for(j=1;j+i<N;j++){
			a[i+j][i]+=a[i+j-1][i];
			a[i+j][i]%=M;
			if(a[i+j][i]==0){
				ans++;
			}
		}
	}
	printf("%d",ans);
	return 0;
}

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

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

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

    int n,m;
    cin>>n>>m;
    vector<ll> a(n+1);
    a[0]=0;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)a[i]=(a[i]+a[i-1])%m;
    sort(a.begin(),a.end());
    ll ans=0;
    int cnt=1;
    for(int i=0;i<n;i++){
        if(a[i]!=a[i+1]){
            ans+=(cnt*(cnt-1))/2;
            cnt=1;
        }
        else tmp++;
    }
    ans+=(cnt*(cnt-1))/2;
    cout<<ans<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   23 |         else tmp++;
      |              ^~~
      |              tm
Language: C++

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

const int MAX = 100001;
int main() {
	int N, M;
	static int A[MAX];
	cin >> N >> M;
	for (int i = 0;i < N;++ i) cin >> A[i];
	static int sum[MAX]; // Aの累積和 ただしmod M上で考える
	sum[0] = A[0] % M;
	for (int i = 1;i < N;++ i) sum[i] = (A[i] + sum[i - 1]) % M;
	sort(sum, sum+N);
	int64_t ans = 0;
	for (int l = 0, r = 0;l < N;r = l > r ? l : r) {
		if (r < N && sum[l] == sum[r]) ++ r; // r < N && 範囲が条件を満たす場合
		else {
			ans += (int64_t)(r - l - (sum[l] == 0 ? -1 : 1)) * (r - l) / 2; // 往々にしてオーバーフローするのでint64_tの検討を
			l = r;
		}
	}
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、Mの倍数という条件に注目。
これ、mod M上で考えると良さそうだよね？(xがMの倍数⇔x mod M==0)
そこで全てmod M上で考えると、[l, r]区間がMの倍数であるという条件がA_lからA_rまで全て足すとmod M==0になるという条件に変わった
ここで、A_lからA_rまでの合計が分かっていると計算が楽そう→累積和を使ってみよう
累積和B_i = Σ[k=1, i]A_iとすると、[l, r]区間はΣ[k=l, r]A_i == Σ[k=1, r]A_k - Σ[k=1, l-1]A_k == B_r - B_{l-1}で導出できるね
さて、この時のB_rとB_{l-1}について何が成立すると条件を満たすだろうか？
これは、つまりB_r - B_{l-1} mod M == 0、つまりB_r mod MとB_{l-1} mod Mが等しいということ
逆に、これさえ満たせば全て条件を満たすので、今x個のB_iがmod M上で同値ならば、そのうち任意の2個に対して条件を満たすのでxC2 == (x-1)x/2個が条件を満たす
ただしB_i mod M==0ならば1個でも条件を満たすからxC2+x == x(x+1)/2個が条件を満たすことに注意ね
これはBについてソートしておけば単調性があるので簡単に調べられるよ
なお、最大ケースはN==10^5、全てのA_i==Mの倍数を満たすときで、この時答えは(10^5)(100001)/2=5,000,050,000とint型に収まらないことに注意ね
*/

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

#include<iostream>
using namespace std;
int main(){
	int n,m;
	long long a[10005];
	long result = 0;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	while(true){
		a[0]=a[0];
	for(int i=0;i<n;i++){
		long long  sumi2j=0;
		for(int j=i;j<n;j++){
			sumi2j+=a[j];
			sumi2j = sumi2j % m;
			if(sumi2j==0){
				//sumi2j=0;
				result++;
			}
		}
		
	}
	cout<<result;
	
}

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

#include <iostream>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#define re register
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define MAXN 4000007
#define mo 19930726
using namespace std;
typedef unsigned long long ull;
#define ms(arr) memset(arr, 0, sizeof(arr))
const int inf = 0x3f3f3f3f;
ll a[MAXN],sum[MAXN],n,m,ans;
map<ll,ll> mp;
int main()
{
	cin>>n>>m;
	for(re int i=1;i<=n;i++){
		cin>>a[i];
		sum[i]=(sum[i-1]+a[i])%m;
	}
	for(re int i=1;i<=n+1;i++){
		ans+=mp[sum[i]];
		mp[sum[i]]++;
	}
	cout<<ans;
}

Compiler output:
a.cc:20:1: error: 'll' does not name a type; did you mean 'ull'?
   20 | ll a[MAXN],sum[MAXN],n,m,ans;
      | ^~
      | ull
a.cc:21:5: error: 'll' was not declared in this scope; did you mean 'ull'?
   21 | map<ll,ll> mp;
      |     ^~
      |     ull
a.cc:21:8: error: 'll' was not declared in this scope; did you mean 'ull'?
   21 | map<ll,ll> mp;
      |        ^~
      |        ull
a.cc:21:10: error: template argument 1 is invalid
   21 | map<ll,ll> mp;
      |          ^
a.cc:21:10: error: template argument 2 is invalid
a.cc:21:10: error: template argument 3 is invalid
a.cc:21:10: error: template argument 4 is invalid
a.cc: In function 'int main()':
a.cc:24:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   24 |         cin>>n>>m;
      |              ^
      |              yn
a.cc:24:17: error: 'm' was not declared in this scope; did you mean 'tm'?
   24 |         cin>>n>>m;
      |                 ^
      |                 tm
a.cc:25:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 |         for(re int i=1;i<=n;i++){
      |                    ^
a.cc:26:22: error: 'a' was not declared in this scope
   26 |                 cin>>a[i];
      |                      ^
a.cc:27:17: error: 'sum' was not declared in this scope
   27 |                 sum[i]=(sum[i-1]+a[i])%m;
      |                 ^~~
a.cc:29:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   29 |         for(re int i=1;i<=n+1;i++){
      |                    ^
a.cc:30:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |                 ans+=mp[sum[i]];
      |                 ^~~
      |                 abs
a.cc:30:25: error: 'sum' was not declared in this scope
   30 |                 ans+=mp[sum[i]];
      |                         ^~~
a.cc:33:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |         cout<<ans;
      |               ^~~
      |               abs
Language: C++

#include<iostream>
#include<String>
#include<map>
#include<windows.h>

using namespace std;
#define repeat(i, n) for(int i = 0; i < (n); i++)


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

	int A[100001] = {};
	long long B[100001] = {};
	map<int, int> MAP;

	repeat(i, N) {
		cin >> A[i];
		B[i + 1] = B[i] + A[i];

		B[i + 1] %= M;

		MAP[(int)B[i + 1]]++;
	}
	MAP[0]++;

	long long result = 0;

	for (auto ITR : MAP){
		result += ITR.second * (ITR.second - 1) / 2;
	}


	//出力
	cout << result << endl;



	//Sleep(3000);

	return 0;
}

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

#include<bits/stdc++.h>
#pragma warning(disable:4996)
using namespace std;
using ll = long long;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
ll a[100000];
ll sum[100000];
int main() {
	ll N, M;
	scanf("%d %d", &N, &M);
	for (int i = 0; i < N; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < N; i++) {
		sum[i + 1] = sum[i] + a[i];
	}

}
#include<bits/stdc++.h>
#pragma warning(disable:4996)
using namespace std;
using ll = long long;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
ll a[100000];
ll sum[100000];
int main() {
	ll N, M;
	scanf("%d %d", &N, &M);
	for (int i = 0; i < N; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < N; i++) {
		sum[i + 1] = sum[i] + a[i];
	}

}


Compiler output:
a.cc:23:11: error: redefinition of 'const int dx [4]'
   23 | const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
      |           ^~
a.cc:5:11: note: 'const int dx [4]' previously defined here
    5 | const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
      |           ^~
a.cc:23:33: error: redefinition of 'const int dy [4]'
   23 | const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
      |                                 ^~
a.cc:5:33: note: 'const int dy [4]' previously defined here
    5 | const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
      |                                 ^~
a.cc:24:4: error: redefinition of 'll a [100000]'
   24 | ll a[100000];
      |    ^
a.cc:6:4: note: 'll a [100000]' previously declared here
    6 | ll a[100000];
      |    ^
a.cc:25:4: error: redefinition of 'll sum [100000]'
   25 | ll sum[100000];
      |    ^~~
a.cc:7:4: note: 'll sum [100000]' previously declared here
    7 | ll sum[100000];
      |    ^~~
a.cc:26:5: error: redefinition of 'int main()'
   26 | int main() {
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main() {
      |     ^~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
int main() {
    long long n, m, in, s = 0, ans = 0; cin >> n >> m;
    unordered_map<lint, lint> h;
    ++h[0];
    for (int i = 0; i < n; ++i) {
        cin >> in;
        s = (s + in) % m;
        ++h[s];
    }
    for (auto i : h) {
        ans += i.second*(i.second - 1) / 2;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:19: error: 'lint' was not declared in this scope; did you mean 'uint'?
    5 |     unordered_map<lint, lint> h;
      |                   ^~~~
      |                   uint
a.cc:5:29: error: template argument 1 is invalid
    5 |     unordered_map<lint, lint> h;
      |                             ^
a.cc:5:29: error: template argument 3 is invalid
a.cc:5:29: error: template argument 4 is invalid
a.cc:5:29: error: template argument 5 is invalid
a.cc:6:8: error: invalid types 'int[int]' for array subscript
    6 |     ++h[0];
      |        ^
a.cc:10:12: error: invalid types 'int[long long int]' for array subscript
   10 |         ++h[s];
      |            ^
a.cc:12:19: error: 'begin' was not declared in this scope
   12 |     for (auto i : h) {
      |                   ^
a.cc:12:19: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:12:19: error: 'end' was not declared in this scope
   12 |     for (auto i : h) {
      |                   ^
a.cc:12:19: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
Language: C++

// coding on smartphone
#include<iostream>
#include<map>
using namespace std;

typedef long long ll;

int main(){
  int n, m, a;
  ll ans = 0;
  map<int,ll> appear;
  
  cin >> n >> m;
  ll a[n+1];
  a[0] = 0;
  
  for(int i = 1; i <= n; i++){
    cin >> a[i];
    a[i] += a[i-1];
    appear[a[i]%m]++;
  }
  
  for(pair<int,int> x : appear)
    ans += ll(x.second) * (x.second - 1) / 2 + (x.first == 0 ? n : 0);
  
  cout << ans << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:6: error: conflicting declaration 'll a [(n + 1)]'
   14 |   ll a[n+1];
      |      ^
a.cc:9:13: note: previous declaration as 'int a'
    9 |   int n, m, a;
      |             ^
a.cc:15:4: error: invalid types 'int[int]' for array subscript
   15 |   a[0] = 0;
      |    ^
a.cc:18:13: error: invalid types 'int[int]' for array subscript
   18 |     cin >> a[i];
      |             ^
a.cc:19:6: error: invalid types 'int[int]' for array subscript
   19 |     a[i] += a[i-1];
      |      ^
a.cc:19:14: error: invalid types 'int[int]' for array subscript
   19 |     a[i] += a[i-1];
      |              ^
a.cc:20:13: error: invalid types 'int[int]' for array subscript
   20 |     appear[a[i]%m]++;
      |             ^
Language: C++

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

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);
  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:15:7: error: two or more data types in declaration of 'type name'
   15 |   map<int int> m;
      |       ^~~
a.cc:15:14: error: wrong number of template arguments (1, should be at least 2)
   15 |   map<int int> m;
      |              ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:27:13: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   27 |     ans += m[SUM[i]];
      |             ^
a.cc:28:6: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   28 |     m[SUM[i]]++;
      |      ^
Language: C++

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

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);
  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:15:7: error: two or more data types in declaration of 'type name'
   15 |   map<int int> m;
      |       ^~~
a.cc:15:14: error: wrong number of template arguments (1, should be at least 2)
   15 |   map<int int> m;
      |              ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:27:13: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   27 |     ans += m[SUM[i]];
      |             ^
a.cc:28:6: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   28 |     m[SUM[i]]++;
      |      ^
Language: C++

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

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);
  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:15:7: error: two or more data types in declaration of 'type name'
   15 |   map<int int> m;
      |       ^~~
a.cc:15:14: error: wrong number of template arguments (1, should be at least 2)
   15 |   map<int int> m;
      |              ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:27:13: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   27 |     ans += m[SUM[i]];
      |             ^
a.cc:28:6: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   28 |     m[SUM[i]]++;
      |      ^
a.cc: At global scope:
a.cc:35:3: error: expected declaration before '}' token
   35 |   }
      |   ^
Language: C++


const int MaxN = 100000;
unsigned long long S[ MaxN + 10 ];

int main()
{
unsigned long long i;
unsigned long long N;
unsigned long long M;
unsigned long long A;
unsigned long long x;
unsigned long long iCnt;
unsigned long long iSum;

	scanf( "%llu%llu", &N, &M );

	iSum = 0;
	iCnt = 0;
	for( i = 1; i <= N; i++ )
	{
		scanf( "%llu", &A );

		iSum += A;
		iSum %= M;
		S[ i ] = iSum;
	}

	sort( S, S + ( N + 1 ) );

	x = 0;
	for( i = 1; i <= N; i++ )
	{
		if( S[ i - 1 ] == S[ i ] )
			x++;
		else
		{
			iCnt += ( x + 1 ) * x / 2;
			x = 0;
		}
	}

	if( x > 0 ) iCnt += ( x + 1 ) * x / 2;

	printf( "%llu\n", iCnt );

	return 0;
}






Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'scanf' was not declared in this scope
   15 |         scanf( "%llu%llu", &N, &M );
      |         ^~~~~
a.cc:28:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   28 |         sort( S, S + ( N + 1 ) );
      |         ^~~~
      |         short
a.cc:44:9: error: 'printf' was not declared in this scope
   44 |         printf( "%llu\n", iCnt );
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 |
Language: Java

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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];
        for (int i = 0; i < n; i++) a[i] = sc.nextInt();

        Map<Long, Long> map = new HashMap<>();
        map.put(0L, 1L);
        long remain = 0;
        long count = 0;
        for (int i = 0; i < a.length; i++) {
            remain = (remain + a[i]) % m;
            count += map.getOrDefault(remain, 0);
            map.put(remain, map.getOrDefault(remain, 0) + 1);
        }
        System.out.println(count);
        sc.close();
    }
}


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

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

using namespace std;
#define int long long

singed main(){
  int ans = 0;
  int n, m;
  cin >> n >> m;
  vector<int> A(n);
  for(int i = 0; i < n; i++){
    cin >> A[i];
  }
  vector<int> B(n+1);
  B[0]=0;
  map<int, int> C;
  C[0]=1;
  for(int i = 0; i < n; i++){
    B[i+1]=(B[i]+A[i]) % m;
    C[B[i+1]]++;
  }
  
  for(auto m: C){
    ans += (m.second -1) * m.second / 2;
  }
  cout << m << endl;
}

Compiler output:
a.cc:8:1: error: 'singed' does not name a type; did you mean 'signed'?
    8 | singed main(){
      | ^~~~~~
      | signed
Language: C++

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

using namespace std;
#define int long long

void main(void){
  int ans = 0;
  int n, m;
  cin >> n >> m;
  vector<int> A(n);
  for(int i = 0; i < n; i++){
    cin >> A[i];
  }
  vector<int> B(n+1);
  B[0]=0;
  map<int, int> C;
  C[0]=1;
  for(int i = 0; i < n; i++){
    B[i+1]=(B[i]+A[i]) % m;
    C[B[i+1]]++;
  }
  
  for(auto m: C){
    ans += (m.second -1) * m.second / 2;
  }
  cout << m << endl;
}

Compiler output:
a.cc:8:1: error: '::main' must return 'int'
    8 | void main(void){
      | ^~~~
Language: C++

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

using namespace std;
#define int long long

void main(){
  int ans = 0;
  int n, m;
  cin >> n >> m;
  vector<int> A(n);
  for(int i = 0; i < n; i++){
    cin >> A[i];
  }
  vector<int> B(n+1);
  B[0]=0;
  map<int, int> C;
  C[0]=1;
  for(int i = 0; i < n; i++){
    B[i+1]=(B[i]+A[i]) % m;
    C[B[i+1]]++;
  }
  
  for(auto m: C){
    ans += (m.second -1) * m.second / 2;
  }
  cout << m << endl;
}

Compiler output:
a.cc:8:1: error: '::main' must return 'int'
    8 | void main(){
      | ^~~~
Language: C++

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

using namespace std;
#define int long long

int main(){
  int ans = 0;
  int n, m;
  cin >> n >> m;
  vector<int> A(n);
  for(int i = 0; i < n; i++){
    cin >> A[i];
  }
  vector<int> B(n+1);
  B[0]=0;
  map<int, int> C;
  C[0]=1;
  for(int i = 0; i < n; i++){
    B[i+1]=(B[i]+A[i]) % m;
    C[B[i+1]]++;
  }
  
  for(auto m: C){
    ans += (m.second -1) * m.second / 2;
  }
  cout << m << endl;
}

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

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

using namespace std;
#define int long long

int main(void){
  int ans = 0;
  int n, m;
  cin >> n >> m;
  vector<int> A(n);
  for(int i = 0; i < n; i++){
    cin >> A[i];
  }
  vector<int> B(n+1);
  B[0]=0;
  map<int, int> C;
  C[0]=1;
  for(int i = 0; i < n; i++){
    B[i+1]=(B[i]+A[i]) % m;
    C[B[i+1]]++;
  }
  
  for(auto m: C){
    ans += (m.second -1) * m.second / 2;
  }
  cout << m << endl;
}

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

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

using namespace std;
#define int long long

int main(void){
  int ans = 0;
  int n, m;
  cin >> n >> m;
  vector<int> A(n);
  for(int i = 0; i < n; i++){
    cin >> A[i];
  }
  vector<int> B(n+1);
  B[0]=0;
  map<int, int> C;
  C[0]=1;
  for(int i = 0; i < n; i++){
    B[i+1]=(B[i]+A[i])%M;
    C[B[i+1]]++;
  }
  
  for(auto m: C){
    ans += (m.second -1) * m.second / 2;
  }
  cout << m << endl;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:21:24: error: 'M' was not declared in this scope
   21 |     B[i+1]=(B[i]+A[i])%M;
      |                        ^
Language: C

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

int main(){
  unsigned long int n, m;
  unsigned long int *a = NULL;
  int i;
  unsigned long int comb_num = 0;
  scanf( "%lu", &n );
  scanf( "%lu", &m );
  a = ( unsigned long int* )malloc( sizeof( unsigned long int ) * n );
  for ( i = 0; i < n; i++ ){
    scanf( "%lu", &a[ i ] );
    if ( a[ i ] % m == 0 ){
      comb_num++;
    }
    //printf( "%d ", a[i] );
  }
  int l = 0, r = 0;

  // for ( l = 0; l < n; l++ ){
  //   for ( r = l; r < n; r++ ){
  //     int j;
  //     unsigned long int sum = 0;
  //     for ( j = l; j <= r; j++ ){
  //       sum += a[ j ];
  //     }
  //     if ( sum % m == 0 ){
  //       comb_num++;
  //     }
  //   }
  // }
  // unsigned long int sum = 0;
  // for ( l = 0; l < n; l++ ){
  // sum = 0;
  //   for ( r = l; r < n; r++ ){
  //     sum += a[ r ];
  //     //printf("%lu\n", sum);
  //     if ( sum % m == 0 ){
  //       comb_num++;
  //     }
  //   }
  // }
  unsigned long int sum[ n ][ n ];
  sum[ 0 ][ 0 ] = a[ 0 ];
  if ( sum[ 0 ][ 0 ] )
  for ( r = 1; r < n; r++ ){
    sum[ 0 ][ r ] = a[ r ] + sum[ 0 ][ r - 1 ];
    if ( sum[ 0 ][ r ] % m == 0 )
      comb_num++;
  }
  for ( l = 1; l < n; l++ ){
    for ( r = l + 1; r < n; r++ ){
      sum[ l ][ r ] = sum[ l - 1 ][ r ] - a[ l - 1 ];
      if ( sum[ l ][ r ] % m == 0 )
         comb_num++;
  }

  printf( "%lu\n", comb_num );
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:62:1: error: expected declaration or statement at end of input
   62 | }
      | ^
Language: C++

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

#define LL long long int
#define LD long double
#define inp_s ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define mod 1000000007

int main(){
      LL n, a[100010], p[100010], m;
      cin >> n >> m;
      for(int i=1 ; i<=n ; i++){
            cin >> a[i];
            p[i] += (p[i-1] + a[i]) % m;
      }
      map<LL, LL> M;
      M[0LL]++;
      LL ans = 0LL;
      for(int i=1 ; i<=n ; i++){
     
            ans += M[p[i]];
            M[r]++;
      }
      cout <<  ans << '\n';
      return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: 'r' was not declared in this scope
   22 |             M[r]++;
      |               ^
Language: C


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

long comb(long n){
    return n*(n-1)/2;
}

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    int a[n];
    int sum[n];
    int i;
    long result = 0;
    for(i=0;i<n;i++) scanf("%d", &a[i]);
    sum[0] = a[0] % m;
    for(i=1;i<n;i++) sum[i] = (sum[i-1] + a[i]) % m;
    qsort(sum, n, sizeof(int), compare_int);
    int now = 0;
    for(i=1;i<n;i++){
        if(sum[i]==sum[i-1]) now++;
        else if(sum[i-1]==0){
            result += (now+1)*(now+2)/2;
            now = 0;
        }else{
            if(now>=1) result += comb(now+1);
            now = 0;
        }
    }
    if(sum[n-1]==0) result += comb(now+2);
    else if(now>=1) result += comb(now+1);
    
    printf("%ld", result);
    

Compiler output:
main.c: In function 'main':
main.c:40:5: error: expected declaration or statement at end of input
   40 |     printf("%ld", result);
      |     ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

void get() {

}

typedef long long ll;
ll a[123456];
unordered_map<ll, int>mp;
// Returns value of Binomial Coefficient C(n, k) O(n)时间, O(1)空间
ll binomialCoeff(int n, int k)
{
	ll res = 1;

	// Since C(n, k) = C(n, n-k)
	if ( k > n - k )
		k = n - k;

	// Calculate value of [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
	for (int i = 0; i < k; ++i)
	{
		res *= ll(n - i);
		res /= ll(i + 1);
	}

	return res;
}
class DCandyDistribution {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n, m;
		in >> n >> m;
		mp.clear();
		memset(a, 0, sizeof(a));
		ll sum = 0;
		for (int i = 1; i <= n; ++i) {
			in >> a[i];
			a[i] += a[i-1];
			a[i] %= m;
			mp[a[i]]++;
		}
		for (auto it = mp.begin(); it != mp.end(); ++it) {
			if(it->second >= 2 && it->first != 0)sum += binomialCoeff(it->second, 2);
			else if(it->first == 0)sum += binomialCoeff(it->second, 2);
			if(it->first == 0) sum += it->second;
		}
		out << sum << '\n';
	}
};

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <set>
#include <vector>

using namespace std;

int main() {
    long long n, m;
    cin >> n >> m;

    vector<long long> a(n);
    long long x;

    cin >> x;
    a[0] = x % m;
    for (long long i = 0; i < n-1; i++) {
        cin >> x;
        a[i+1] = (a[i] + x) % m;
    }

    set<long long> s{a.begin(), a.end()};
    long long ans = 0;

    for (auto x: s) {
        ans += count(a.begin(), a.end(), x) * (count(a.begin(), a.end(), x)-1) / 2;
    }
    ans += count(a.begin(), a.end(), 0);

    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: 'count' was not declared in this scope
   25 |         ans += count(a.begin(), a.end(), x) * (count(a.begin(), a.end(), x)-1) / 2;
      |                ^~~~~
a.cc:27:12: error: 'count' was not declared in this scope
   27 |     ans += count(a.begin(), a.end(), 0);
      |            ^~~~~
Language: C++

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

int main() {
	// your code goes here
	unsigned long long n, m, a = 0;
	cin >> n >> m;
	int k[n];
	for(int i = 0; i < n; i++){
		long long a;
		cin >> a;
		if(a % 2 == 0){
			k[i] = 1;
		}else{
			k[i] = 0;
		}
	}
	long long t[n], f[n];
	for(int i = n - 1; i >= 0; i--){
		t[i] = 0;
		f[i] = 0;
		if(k[i] == 1 && i < n - 1){
			t[i] += t[i + 1] + 1;
			f[i] = f[i + 1];
		}else if(k[i] == 0 && i < n - 1){
			f[i] += f[i + 1] + 1;
			t[i] = t[i + 1];
		}else if(k[i] == 1 && i == n - 1){
			t[i] = 1;
			f[i] = 0;
		}else if(k[i] == 0 && i == n - 1){
			f[i] = 1;
			t[i] = 0;
			
		}
	}
	for(int i = 0; i < n; i++){
		//cout << k [i] << " " << t[i] << " " << f[i] << endl;
		if(k[i] == 1){
			a+= t[i];
			if(f[i] % 2 == 0){
				a+= f[i] / 2;
			}
		}else{
			if(f[i] % 2 == 0){
				a+= f[i] / 2;
		}
	}
	cout << a << endl;
	return 0;
}


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

#include <stdio.h>
int main(void){
long long  n,m,a[100000],k,ans;
int i,j,y;
ans=0;
scanf("%lld",&n);
scanf("%lld",&m);
for(i=1;i<=n;i++){
sanf("%lld",&a[i]);}
for(i=1;i<=n;i++){
for(j=1;j<n-i+1;j++){
k=0;
for(y=0;y<=i-1;y++){
k=k+a[j+y];
k=k%m;
}
if(k==0) ans++;
}
}

printf("%lld",ans);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:1: error: implicit declaration of function 'sanf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    9 | sanf("%lld",&a[i]);}
      | ^~~~
      | scanf
Language: C++

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

int main () {
  int N;
  long long M;
  cin >> N >> M;
  int A[N];
  long long S[N][N];
  for(int i = 1; i <= N ;i++){
  	scanf(%f,A[i]);
  }
  for(int j = 1;j <= N;j++){
    S[j][j] = A[j];
   for(int i = j + 1;i <= N ;i++){
  	S[j][i] = S[j][i-1] + A[i];
   }
  }
  long long cnt = 0;
  for(int j = 1;j <= N;j++){
   for(int i = j;i <= N ;i++){
     if(S[j][i] % M == 0){
       //cout << j << "," << i << endl;
       cnt++;
     }
   }
  }
  cout << cnt << endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: expected primary-expression before '%' token
   11 |         scanf(%f,A[i]);
      |               ^
a.cc:11:16: error: 'f' was not declared in this scope
   11 |         scanf(%f,A[i]);
      |                ^
Language: C++

// cout << endl;
    // printvector(B);

    ll ans=0;
    for (ll i = 0; i < n; i++) {
        for (ll j = i; j < n; j++) {
            if (i == j){
                if(B[i] % m == 0) {
                    ans++;
                }
            }else if ((B[j] - B[i]) % m == 0) {
                // cout << i << ", " << j << endl;
                ans++;
            }
        }
    }

    cout << ans << endl;
    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


// map の key, value を全て抜き出す。
// for (auto itr = mp.begin(); itr != mp.end(); itr++) {
//     cout << "key" << itr->first << " value" << itr->second << endl;
// }

// 文字列の検索
// string s="abc";
// if (s.find('d') == string::npos){
//     cout << "find" << endl;
// }else{
//     cout << "not find" << endl;
// }


Compiler output:
a.cc:4:5: error: 'll' does not name a type
    4 |     ll ans=0;
      |     ^~
a.cc:5:5: error: expected unqualified-id before 'for'
    5 |     for (ll i = 0; i < n; i++) {
      |     ^~~
a.cc:5:20: error: 'i' does not name a type
    5 |     for (ll i = 0; i < n; i++) {
      |                    ^
a.cc:5:27: error: 'i' does not name a type
    5 |     for (ll i = 0; i < n; i++) {
      |                           ^
a.cc:18:5: error: 'cout' does not name a type
   18 |     cout << ans << endl;
      |     ^~~~
a.cc:19:5: error: expected unqualified-id before 'return'
   19 |     return;
      |     ^~~~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
a.cc: In function 'int main(int, const char**)':
a.cc:24:5: error: 'solve' was not declared in this scope
   24 |     solve();
      |     ^~~~~
Language: C++

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

int main(){
	int n,m;
	cin>>n>>m;
	vector<int>a(n);
	rep(i,n)cin>>a[i];
	ll ans=0,sum=0;
	rep(i,n)forx(j,i,n){
		sum+=a[j];
		sum%=mod;
		if(!sum)ans++;
	}
	cout<<ans<<endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: 'mod' was not declared in this scope; did you mean 'modf'?
   15 |                 sum%=mod;
      |                      ^~~
      |                      modf
Language: C++

#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<set>
#include<map>
#include<cctype>
#include<sstream>
using namespace std;
int a[100050];
__int64 sum;
int main()
{
	ios::sync_with_stdio(false);
	int n,m;
	cin >> n >> m;
	for (int i = 0;i < n;i++)
		cin >> a[i];
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = i; j < n; j++)
		{
			sum = 0;
			for (int k = i;k <= j;k++)
			{
				sum += a[k];
			}
			if (sum%m == 0)
				ans++;
		}
	}
	cout << ans << endl;
	return 0;
}



Compiler output:
a.cc:16:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | __int64 sum;
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:29:25: error: 'sum' was not declared in this scope
   29 |                         sum = 0;
      |                         ^~~
Language: C

#include<stdio.h>
#include<stdint.h>

int main(void){
	int N,M,l,r,i;
	long long unsigned int sum=0,check=0;
	scanf("%d %d",&N,&M);
	if(N==-1||M==-1){
		break;
	}
	int A[N];
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
		if(A[i]==-1){
		break;
	}
	}
	
	
	for(l=0;l<N;l++){
	for(r=l;r<N;r++){
		sum=0;
		
		for(i=l;i<=r;i++){
			sum+=A[i];
		}
		if(sum%M==0){
			check++;
		}
		
	}
	}
	
	printf("%llu",check);
		
}

Compiler output:
main.c: In function 'main':
main.c:9:17: error: break statement not within loop or switch
    9 |                 break;
      |                 ^~~~~
Language: C++

int main(){
    int N,M,i,t;
    cin >> N >> M;
    vector<int> S(N+1);//sum of l~r : s[r]-s[l-1] 
    S[0]=0;
    for(i=1;i<=N;i++){
        cin >> t;
        t %= M;
        t += S.at(i-1);
        S.at(i) = t % M;
    }
    sort(S.begin(),S.end());
    int l,r;
    long long int ans;
    ans = 0;
    for(l=0;l<N;l++){
        for(r = l+1; r < N+1; r++){
            if(S.at(r)==S.at(l)) ans++;
            if(S.at(r)>S.at(l)) continue;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> N >> M;
      |     ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<int> S(N+1);//sum of l~r : s[r]-s[l-1]
      |     ^~~~~~
a.cc:4:12: error: expected primary-expression before 'int'
    4 |     vector<int> S(N+1);//sum of l~r : s[r]-s[l-1]
      |            ^~~
a.cc:5:5: error: 'S' was not declared in this scope
    5 |     S[0]=0;
      |     ^
a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |     sort(S.begin(),S.end());
      |     ^~~~
      |     short
a.cc:22:5: error: 'cout' was not declared in this scope
   22 |     cout << ans << endl;
      |     ^~~~
a.cc:22:20: error: 'endl' was not declared in this scope
   22 |     cout << ans << endl;
      |                    ^~~~
Language: Java

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class ABC105_D {

    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];
        long[] b = new long[n];
        Map<Integer, Integer> map = new HashMap<>();

        long sum = 0;
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
            sum += (long) a[i];
            b[i] = sum;
            int p = (int) (b[i] % m);
            if (map.containsKey(p)) {
               map.put(p, map.get(p) + 1);
            } else {
                map.put(p, 1);
            }


        }
        long ans = 0;
        if (map.containsKey(0)) {
            map.put(0, map.get(0) + 1);
        } else {
            map.put(0, 1);
        }

        for (Integer key : map.keySet()) {
            ans += (long) map.get(key) * (map.get(key) - 1) / 2;
           // System.out.println(key + "  " + map.get(key));
        }
        System.out.println(ans);
    }

}

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

#include <iostream>

int main(void){
  int n, m;
  std::cin >> n >> m;
  std::vector<int> v(n);
  for(int i = 0; i < n; i++){
    std::cin >> v[i];
  }
  long int ans = 0;
  int index = 0;
  while(index < n){
    long int sum = 0;
    int i = index;
    while(i < n){
      sum += v[i];
      if(sum % m == 0){
        ans ++;
      }
      i++;
    }
    index++;
  }
  std::cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: 'vector' is not a member of 'std'
    6 |   std::vector<int> v(n);
      |        ^~~~~~
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 | 
a.cc:6:15: error: expected primary-expression before 'int'
    6 |   std::vector<int> v(n);
      |               ^~~
a.cc:8:17: error: 'v' was not declared in this scope
    8 |     std::cin >> v[i];
      |                 ^
a.cc:16:14: error: 'v' was not declared in this scope
   16 |       sum += v[i];
      |              ^
Language: C++

#include<stdio.h>

int main(void){
  int N,M;
  scanf("%d",&N);
  scanf("%d",&M);
  int A[N];
  for(int i=0;i<N;i++){
    scanf("%d",&A[i]);
    A[i] %=M;
  }
  long int x = 0;
  for(int i=0;i<N;i++){
    int sum = 0;
    for(int j=i;j<N;j++){
      sum +=A[y];
      if(sum%M==0){
        x++;
      }
    }
  }
  printf("%ld",x);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'y' was not declared in this scope
   16 |       sum +=A[y];
      |               ^
Language: C++

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

using namespace std;

int main() {
	ll N;
	cin >> N;
	bool pos = true;
	if (N < 0) pos = false;

	if (N == 0) {
		cout << 0 << endl;
		return 0;
	}

	int b = 0;
	if (!pos) b = 1;
	ll x = 1;
	if (!pos) x *= -2;
	while (abs(x) < abs(N)) {
		x *= 4;
		b += 2;
	}

	ll rest = x - N;
	vector<int> v(b + 1, 0);
	v[b] = 1;

	if (pos) {
		if (N % 2 == 1) v[0] = 1;

		rest -= 1;
		int cnt = 




	cout << x << " " << b << endl;


	/*
	ll a = 1e10;

	for (int i = 1; ; i++) {
		ll x = pow(2, i);
		if (x >= a) {
			cout << x << endl;
			cout << i << endl;
			break;
		}
	}
	*/

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:31: error: cannot convert 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int' in initialization
   39 |         cout << x << " " << b << endl;
      |         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
      |                               |
      |                               std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}
a.cc:56:2: error: expected '}' at end of input
   56 | }
      |  ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^