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

#include <iostream>
#include <fstream>
#include <climits>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <list>
#include <ctime>

#define FOR(i , n)      for(int i = 0 ; i < n ; i++)
#define FORmn(i,m,n)	for(int i = m ; i < n ; i++)
#define FORrev(i,n,m)	for(int i = n - 1 ; i >= m ; i--)
#define ALL(a)			a.begin(),a.end()
#define pii				pair<long long int , long long int>
#define mp(a , b)		make_pair(a , b)

typedef long long int ll; 

using namespace std;

int main() {
	string s;
	cin>>s;
	int len = (int) s.length();
	int ans = 0;
	for(int i = 0 ; i < len ; i++) {
		int rem = s[i] - '0';
		for(int j = i + 1 ; j < len ; j++) {
			rem = (rem + (s[j] - '0')) % 2019;
			if(rem == 0)
				ans++;
		}
	}
	cout<<rem;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:15: error: 'rem' was not declared in this scope; did you mean 'drem'?
   45 |         cout<<rem;
      |               ^~~
      |               drem
Language: C++

#include <iostream>
#include <fstream>
#include <climits>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <list>
#include <ctime>

#define FOR(i , n)      for(int i = 0 ; i < n ; i++)
#define FORmn(i,m,n)	for(int i = m ; i < n ; i++)
#define FORrev(i,n,m)	for(int i = n - 1 ; i >= m ; i--)
#define ALL(a)			a.begin(),a.end()
#define pii				pair<long long int , long long int>
#define mp(a , b)		make_pair(a , b)

typedef long long int ll; 

using namespace std;

int main() {
	string s;
	cin>>s;
	int ans = 0;
	for(int i = 0 ; i < s.length() ; i++) {
		int rem = 0;
		for(int j = i ; j < s.length() ; j++) {
			if(j == i) {
				rem = s[j] - '0';
				continue;
			} 
			rem = rem * 10 + (s[i] - '0');
			rem % = 2019;
			if(rem == 0) {
				ans++;
			}
		}
	}
	cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:31: error: expected primary-expression before '=' token
   44 |                         rem % = 2019;
      |                               ^
Language: C++

#include <iostream>
#include <fstream>
#include <climits>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <list>
#include <ctime>

#define FOR(i , n)      for(int i = 0 ; i < n ; i++)
#define FORmn(i,m,n)	for(int i = m ; i < n ; i++)
#define FORrev(i,n,m)	for(int i = n - 1 ; i >= m ; i--)
#define ALL(a)			a.begin(),a.end()
#define pii				pair<long long int , long long int>
#define mp(a , b)		make_pair(a , b)

typedef long long int ll; 

using namespace std;

int main() {
	string s;
	cin>>s;
	int ans = 0;
	for(int i = 0 ; i < s.length ; i++) {
		int rem = 0;
		for(int j = i ; j < s.length ; j++) {
			if(j == i) {
				rem = s[j] - '0';
				continue;
			} 
			rem = rem * 10 + (s[i] - '0');
			rem % = 2019;
			if(rem == 0) {
				ans++;
			}
		}
	}
	cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:31: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   36 |         for(int i = 0 ; i < s.length ; i++) {
      |                             ~~^~~~~~
      |                                     ()
a.cc:38:39: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   38 |                 for(int j = i ; j < s.length ; j++) {
      |                                     ~~^~~~~~
      |                                             ()
a.cc:44:31: error: expected primary-expression before '=' token
   44 |                         rem % = 2019;
      |                               ^
Language: C

#include <iostream>
#include <iostream>
#include <string.h>
#include <vector>
#include <queue>
#include <cstdio>
#include <math.h>
#include <map>
#include <algorithm>
#include <deque>
#include <stack>
#include<set>
//#include <bits/stdc++.h>
#define lson l,mid,rt<<1

#define rson mid+1,r,rt<<1|1

//const int N=1e5+100;
using namespace std;

typedef long long ll;
int mod=2019;
int vis[2050];
int main()
{
    vis[0]++;
    string s;cin>>s;
    int base=1;
    ll sum=0;
    ll ans=0;
    for(int i=s.size()-1;i>=0;i--){
        sum=(sum+(s[i]-'0')*base)%mod;
        ans+=vis[sum];
        vis[sum]++;
        base=base*10%mod;
    }
    cout<<ans<<endl;
    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	int ans = 0, now = 0, p = 1;
	cnt[0] = 1;
	for (int i = s.size() - 1; i >= 0; i--){
		now = (now + (s[i] - '0') * p) % 2019;
		ans += cnt[now]++;
		p = p * 10 % 2019;
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
    7 |         cnt[0] = 1;
      |         ^~~
      |         int
Language: C++

#include<bits/stdc++.h>
using namespace std;
const ll mod=2019;
char s[200005];
ll n,mod1[200005]={0};
int main(){
	scanf("%s",s);
	n=strlen(s);
	ll sum=0,ten=1;
	for(ll i=0;i<n;i++) s[i]-='0';
	for(ll i=n-1;i>=0;i--){
		sum+=ten*s[i];
		ten=(ten*10)%2019;
		sum%=2019;
		mod1[sum]++;
	}
	sum=mod1[0]*(mod1[0]+1)/2;
	for(ll i=1;i<2019;i++) sum+=mod1[i]*(mod1[i]-1)/2;
	printf("%lld\n",sum);
	return 0; 
}



Compiler output:
a.cc:3:7: error: 'll' does not name a type
    3 | const ll mod=2019;
      |       ^~
a.cc:5:1: error: 'll' does not name a type
    5 | ll n,mod1[200005]={0};
      | ^~
a.cc: In function 'int main()':
a.cc:8:9: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 |         n=strlen(s);
      |         ^
      |         yn
a.cc:9:9: error: 'll' was not declared in this scope
    9 |         ll sum=0,ten=1;
      |         ^~
a.cc:10:15: error: expected ';' before 'i'
   10 |         for(ll i=0;i<n;i++) s[i]-='0';
      |               ^~
      |               ;
a.cc:10:20: error: 'i' was not declared in this scope
   10 |         for(ll i=0;i<n;i++) s[i]-='0';
      |                    ^
a.cc:11:15: error: expected ';' before 'i'
   11 |         for(ll i=n-1;i>=0;i--){
      |               ^~
      |               ;
a.cc:11:22: error: 'i' was not declared in this scope
   11 |         for(ll i=n-1;i>=0;i--){
      |                      ^
a.cc:12:17: error: 'sum' was not declared in this scope
   12 |                 sum+=ten*s[i];
      |                 ^~~
a.cc:12:22: error: 'ten' was not declared in this scope; did you mean 'tan'?
   12 |                 sum+=ten*s[i];
      |                      ^~~
      |                      tan
a.cc:15:17: error: 'mod1' was not declared in this scope; did you mean 'modf'?
   15 |                 mod1[sum]++;
      |                 ^~~~
      |                 modf
a.cc:17:9: error: 'sum' was not declared in this scope
   17 |         sum=mod1[0]*(mod1[0]+1)/2;
      |         ^~~
a.cc:17:13: error: 'mod1' was not declared in this scope; did you mean 'modf'?
   17 |         sum=mod1[0]*(mod1[0]+1)/2;
      |             ^~~~
      |             modf
a.cc:18:15: error: expected ';' before 'i'
   18 |         for(ll i=1;i<2019;i++) sum+=mod1[i]*(mod1[i]-1)/2;
      |               ^~
      |               ;
a.cc:18:20: error: 'i' was not declared in this scope
   18 |         for(ll i=1;i<2019;i++) sum+=mod1[i]*(mod1[i]-1)/2;
      |                    ^
Language: C

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define mp make_pair
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;
const int N=2019;

int32_t main(){
    IOS;
    string s;
    cin>>s;
    int a[s.size()];
    int x=0;
    int cur=1;
    int cnt[2019]={0};
   	cnt[0]=1;
    for(int i=s.size()-1;i>=0;i--){
    	x=(x+cur*(s[i]-'0'))%N;
    	cur=(cur*10)%N;
    	cnt[x]++;
    }
    int ans=0;
    for(int i=0;i<2019;i++){
    	ans+=(cnt[i]*(cnt[i]-1)/2);
    }
    cout<<ans<<endl;
}


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

s = input()

ch = 0
x = 1

rem = [0] * 2019

for c in reversed(s):
    ch += int(c) * x
    x = x * 10 % 2019
    rem[ch % 2019] += 1

print(sum(a * (a - 1) // 2 for a in rem) + 1)
    


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

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

typedef long long ll;

int main(){
	const int MOD = 2019;
	string S;
	cin >> S;
	reverse(S.begin(),S.end());

	ll ans = 0;
	vector<ll> cnt(2020);
	cnt[0] = 1;
	int p = 1; int t=0;
	for(char c : S ){
		int i = c-'0';
		t = (t + i * p) % MOD;
		ans += cnt[t];

		p = p*10;
		p %= MOD;
		cnt[t]++;
	}

	cout << ans << endl;
}

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

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    String S=sc.next();
    int x =S.length();
    String s[] =S.split("",0);
    long y[]=new long[x+1];
    long z[]=new long[x];
    long w[]=new long[2019];
    y[x]=0;
    long v[] =new long[x];
    long ans =0;
    for(int i=x-1;i>=0;i--){
      z[i]=Integer.parseInt(s[i]);
      v[i]=1;
      for(int j=0;j<x-1-i;j++){
        v[i]=(v[i]*10)%2019;}
      y[i]=(y[i+1]+z[i]*v[i])%2019;
      w[y[i]]=w[y[i]]+1;}
    for(int k=0;k<2019;k++){
      ans =ans+w[k]*(w[k]-1)/2;}
    System.out.println(ans);
  }
}


Compiler output:
Main.java:20: error: incompatible types: possible lossy conversion from long to int
      w[y[i]]=w[y[i]]+1;}
         ^
Main.java:20: error: incompatible types: possible lossy conversion from long to int
      w[y[i]]=w[y[i]]+1;}
                 ^
2 errors
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    String S=sc.next();
    int x =S.length();
    String s[] =S.split("",0);
    long y[]=new long[x+1];
    long z[]=new long[x];
    long w[]=new long[2019];
    y[x]=0;
    long v[] =new long[x];
    long ans =0;
    for(int i=x-1;i>=0;i--){
      z[i]=Integer.parseInt(s[i]);
      v[i]=1
      for(int j=0;j<x-1-i;j++){
        v[i]=(v[i]*10)%2019;}
      y[i]=(y[i+1]+z[i]*v[i])%2019;
      w[y[i]]=w[y[i]]+1;}
    for(int k=0;k<2019;k++){
      ans =ans+w[k]*(w[k]-1)/2;}
    System.out.println(ans);
  }
}


Compiler output:
Main.java:16: error: ';' expected
      v[i]=1
            ^
1 error
Language: C

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, P;
	string S;
	cin >> S;
	N = S.size();
	P = 2019;

	reverse(S.begin(), S.end());
	int ten = 1;
	map<int, int>mp;
	int ans = 0;
	int sum = 0;
	mp[0]++;
	REP(i, N) {

		int a = S[i] - '0';
		a *= ten;
		a %= P;
		sum += a;
		sum %= P;

		ans += mp[sum];
		mp[sum]++;






		ten *= 10;
		ten %= P;
	}


	cout << ans << endl;


	return 0;
}



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

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    String S=sc.next();
    int x =S.length();
    String s[] =S.split("",0);
    long y[]=new long[x+1];
    long z[]=new long[x];
    long w[]=new long[2019];
    y[x]=0;
    long ans =0;
    for(int i=x-1;i>=0;i--){
      z[i]=Integer.parseInt(s[i]);
      y[i]=(y[i+1]+z[i]*Math.pow(10,x-1-i))%2019;
      w[y[i]]=w[y[i]]+1;}
    for(int k=0;k<2019;k++){
      ans =ans+w[k]*(w[k]-1)/2;}
    System.out.println(ans);
  }
}


Compiler output:
Main.java:15: error: incompatible types: possible lossy conversion from double to long
      y[i]=(y[i+1]+z[i]*Math.pow(10,x-1-i))%2019;
                                           ^
Main.java:16: error: incompatible types: possible lossy conversion from long to int
      w[y[i]]=w[y[i]]+1;}
         ^
Main.java:16: error: incompatible types: possible lossy conversion from long to int
      w[y[i]]=w[y[i]]+1;}
                 ^
3 errors
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    String S=sc.next();
    int x =S.length();
    String s[] =S.split("",0);
    int y[]=new int[x+1];
    int z[]=new int[x];
    int w[]=new int[2019];
    y[x]=0;
    long ans =0;
    for(int i=x-1;i>=0;i--){
      z[i]=Integer.parseInt(s[i]);
      y[i]=(y[i+1]+z[i]*Math.pow(10,x-1-i))%2019;
      w[y[i]]=w[y[i]]+1;}
    for(int k=0;k<2019;k++){
      ans =ans+w[k]*(w[k]-1)/2;}
    System.out.println(ans);
  }
}

Compiler output:
Main.java:15: error: incompatible types: possible lossy conversion from double to int
      y[i]=(y[i+1]+z[i]*Math.pow(10,x-1-i))%2019;
                                           ^
1 error
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()

ll modpow(ll a,ll b,ll mod){
  ll ans=1%mod;
  while(b){	
    if(b&1) ans=(ans*a)%mod;
    a=(a*a)%mod;
    b=b>>1; 
  }
  return ans;
  }

int main(){
  string S;cin>>S;
  vll tmp_mod(S.size(),0);
  tmp_mod[S.size()]=0;
  ll dg = 0;
  for(ll i=S.size()-1;i>=0;--i){
    ll num = S[i]-'0';
    tmp_mod[i] = (num*modpow(10,dg,2019) + tmp_mod[i+1]) % 2019;
    dg++;
  }
  map<ll,ll> m;
  for(ll i=S.size();i>=0;--i){
    m[tmp_mod[i]]++;
  }
  ll ans=0;
  for(auto& x : m){
    ll cnt = ll(x.second);
    if(x.second<=1) continue;
    else ans += (cnt-1)*cnt/2;
  }
  cout << ans << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 2e5 + 7;
int dp[3][3000]; //状态dp[i][j]表示以第i字符结尾的数字中对2019取模为j的数字有多少个
char s[maxx];

int main() {
    scanf("%s", s + 1);
    int n = strlen(s + 1);
    LL ans = 0;
    for(int i = 1; i <= n; i++) {
        x = s[i] - '0';
        for(int j = 0; j <= 2019; j++) {
            dp[1][(j * 10 + x) % 2019] += dp[0][j];
        }
        dp[1][x]++;
        for(int j = 0; j <= 2019; j++) {
            dp[0][j] = dp[1][j];
            dp[1][j] = 0;
        }
        ans += dp[0][0];
    }
    printf("%lld\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'x' was not declared in this scope
   13 |         x = s[i] - '0';
      |         ^
Language: C

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

int pow_mod(int a, int n, int mod) {
  int res = 1;
  while (n > 0) {
    if (n & 1) res *= a;
    a = a*a;
    a %= mod;
    n >>= 1;
    res %= mod;
  }
  return res;
}

int main() {
  string S;
  cin >> S;
  int N = S.size();
  vector<int> mod(N+1);
  mod[N] = 0;
  for (int s = N-1; s >= 0; s--) {
    int a = S[s] - '0';
    mod[s] = a * pow_mod(10, (N-1)-s, 2019) + mod[s+1];
    mod[s] %= 2019;
  }
  map<int, int> cnt;
  for (auto m : mod) {
    cnt[m]++;
  }
  int ans = 0;
  for (auto c : cnt) {
    ans += c.second * (c.second - 1) / 2;
  }
  cout << ans << endl;
}


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

#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int p = 2019;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    vector<int> d(n+1);
    int ten = 1;
    for(int i = n-1; i >= 0; i--){
        int a = (s[i] - '0') * ten % p;
        d[i] = (d[i+1]+a) % p;
        ten *= 10;
        ten %= p;
    }
    vector<int> cnt(p);
    ll ans = 0;
    for(int i = n; i >= 0; i--){
        ans += cnt[d[i]];
        cnt[d[i]]++;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include "bits/stdc++.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vl vector<long long>
#define fin(ar,k,n) for(int i=k;i<n;i++) cin>>ar[i]
#define fout(ar,k,n) for(int i=k;i<n;i++) cout<<ar[i]<<' '
#define all(z) z.begin(),z.end()
#define mcc ((int)1e9+7)
#define mcf 998244353
#define mi map<int,int>
#define mem(a,n) memset(a,n,sizeof(a))
using namespace std;

//ll maxl(ll a,ll b) {return (a>b)? a:b;}
//ll minl(ll a,ll b) {return (a<b)? a:b;}
//ll gcdl(ll a,ll b) {return b ? gcdl(b,a%b):a;}
//bool sortc(const vi &v1,const vi &v2) {return v1[0]>v2[0];}


void solve()
{
    string s;
    cin>>s;
    ll dp[2][2019],ans=0;
    mem(dp,0);
    dp[0][s[0]-'0']=1;
    for (int i=1;i<s.length();i++)
    {
        for (int j=0;j<2019;j++)
        {
            int nxt=(j*10+s[i]-'0')%2019;
            dp[1][nxt]+=dp[0][j];
        }
        ans+=dp[1][0];
        memcpy(dp[0],dp[1],sizeof(dp[1]));
        mem(dp[1],0);
        dp[0][s[i]-'0']++;
    }
    cout<<ans<<endl;
}

#if 1
int main()
{
   
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}
#endif

//------------------------Google-------------------
#if 0
int main()
{
    #ifdef __WIN32
    freopen("input.txt","r",stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t,ct=0;
    cin>>t;
    while(t--)
    {
        cout<<"Case #"<<++ct<<": ";
        solve();
    }
    return 0;
}
#endif


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

#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vl vector<long long>
#define fin(ar,k,n) for(int i=k;i<n;i++) cin>>ar[i]
#define fout(ar,k,n) for(int i=k;i<n;i++) cout<<ar[i]<<' '
#define all(z) z.begin(),z.end()
#define mcc ((int)1e9+7)
#define mcf 998244353
#define mi map<int,int>
#define mem(a,n) memset(a,n,sizeof(a))
using namespace std;

//ll maxl(ll a,ll b) {return (a>b)? a:b;}
//ll minl(ll a,ll b) {return (a<b)? a:b;}
//ll gcdl(ll a,ll b) {return b ? gcdl(b,a%b):a;}
//bool sortc(const vi &v1,const vi &v2) {return v1[0]>v2[0];}


void solve()
{
    string s;
    cin>>s;
    ll dp[2][2019],ans=0;
    mem(dp,0);
    dp[0][s[0]-'0']=1;
    for (int i=1;i<s.length();i++)
    {
        for (int j=0;j<2019;j++)
        {
            int nxt=(j*10+s[i]-'0')%2019;
            dp[1][nxt]+=dp[0][j];
        }
        ans+=dp[1][0];
        memcpy(dp[0],dp[1],sizeof(dp[1]));
        mem(dp[1],0);
        dp[0][s[i]-'0']++;
    }
    cout<<ans<<endl;
}

#if 1
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}
#endif

//------------------------Google-------------------
#if 0
int main()
{
    #ifdef __WIN32
    freopen("input.txt","r",stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t,ct=0;
    cin>>t;
    while(t--)
    {
        cout<<"Case #"<<++ct<<": ";
        solve();
    }
    return 0;
}
#endif


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

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

int main(){
  string s; cin >> s;
  int size = s.size();
  //cout << size << endl;
  vector<int> amari(2019,0);
  amari[0]++;
  int ten = 1;
  int ans = 0;
  for(int i = size - 1; i >= 0; i--){
    int tmp = ( tmp + (s[i] - '0') * ten ) % 2019;
    ans += amari[tmp]++;
    ten = ( ten * 10 ) % 2019;
  }

  cout << ans << endl;
}



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

//	Author : amnptl 
//	   Godbless
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define NeedForSpeed() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod (2019) // not 1e9+7

ll power(ll base, ll exponent, ll modx = mod) 
{
    ll ret = 1 % modx; base %= modx;
    while(exponent) 
    {
        if(exponent & 1) ret = (ret * base) % modx;
        base = (base * base) % modx; exponent >>= 1;
    }
    return ret;
}

int main()
{
	NeedForSpeed();
	string s; cin>>s; int n = s.size(); int a[n+1];
	for(int i=0; i<n; i++) a[i+1] = (s[i] - '0');
	ll num[n+1]; num[n] = a[n]; map<int,int> m; m[0]++; ll ans = 0;
	for(int i=n-1; i>0; i--)
	{
		num[i] = (power(10,n-i)*a[i])%mod;
		num[i] = (num[i]+num[i+1])%mod;
		m[num[i]]++;
	}
	for(auto x : m) ans += ((x.second)*(x.second-1))/2;
	cout<<ans<<endl;
	return 0;
}

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

#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

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

    string s;
    cin >> s;
    reverse(all(s));
    int n = s.size();
    vector<int> a(n);
    rep(i, n) a[i] = s[i] - '0';
    vector<int> b(n + 1);
    int num = 1;
    rep(i, n)
    {
        b[i + 1] = (num * a[i] + b[i]) % 2019;
        num *= 10;
    }
    vector<int> cnt(2019);
    rep(i, n + 1) cnt[b[i]]++;
    int ans = 0;
    //rep(i, n + 1) cout << b[i] << endl;
    rep(i, 2019) ans += (cnt[i] * (cnt[i] - 1)) / 2;
    cout << ans << endl;
}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int mod = 2019;

int main() {
  string s;
  cin >> s;
  reverse(s.begin(),s.end());
  int amari[220000];
  int ans = 0;
  map<int,int> mp;
  rep(i,s.size()) {
    if(i==0) {
      string t = "";
      t += s[i];
      int m = stoi(t);
      mp[m]++;
    }
    int ten = 1;
    rep(j,i) {
      ten *= 10;
      ten %= mod;
    }
    string t = "";
    t += s[i];
    int m = stoi(t);
    ten *= m;
    ten %= mod;
    ten += amari[i-1];
    ten %= mod;
    amari[i] = ten;
    mp[amari[i]]++;
  }
  for(auto p : mp) {
    int m = p.second;
    if(m==0) continue;
    ans += m*(m-1)/2;
  }
  cout << ans << endl;
  return 0;
}

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

/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 2019;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	string s;
	cin >> s;
	ll n = s.size();

	ll ans = 0;
	Vec prev(MOD), cur(MOD);
	rep(i, n){
		cur.assign(MOD, 0);
		ll k = s[i] - '0';
		cur[k]++;
		ll cnt = 0;
		for(ll i : prev){
			cur[(cnt++ * 10 + k) % MOD] += i;
		}

		ans += cur[0];
		swap(cur, prev);
	}

	co(ans);

	return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

template<typename T, typename U> 
T modpow(T a, U n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % 2019;
        a = a * a % 2019;
        n >>= 1;
    }
    return res;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string S;
    cin >> S;
    int N = S.size();
    reverse(all(S));
    map<int, ll> mp;
    mp[0]++;
    ll tmp = 0;
    ll ans = 0;
    rep(i,N){
        tmp += (modpow(10,i)*(S[i]-'0'))%(2019);
        tmp %= 2019;
        if(i >= 3)ans += mp[tmp];
        mp[tmp]++;
    }
    cout << ans << endl;
}


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

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

 
int main(){
    string s;
    cin >> s;
    int n = s.size();

    vector<int> mod(n);
    mod[0] = 1;
    for(int i=1;i<n;i++){
        mod[i] = 0;
    }

    long long int t = 0;    
    long long int tens = 1;

    int ans = 0;
    
    for(int i=n-1;i>=0;i--){
        t = t%2019 + tens*(S[i]-'0')%2019;
        ans += mod[t];
        mod[t]++;
        tens = tens*10%2019;
    }

    cout << ans << endl;
}   


Compiler output:
a.cc: In function 'int main()':
a.cc:30:28: error: 'S' was not declared in this scope
   30 |         t = t%2019 + tens*(S[i]-'0')%2019;
      |                            ^
Language: C++

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

 
int main(){
    string s;
    cin >> s;
    int n = s.sizes();

    vector<int> mod(n);
    mod[0] = 1;
    for(int i=1;i<n;i++){
        mod[i] = 0;
    }

    long long int t = 0;    
    long long int tens = 1;

    int ans = 0;
    
    for(int i=n-1;i>=0;i--){
        t = t%2019 + tens*(S[i]-'0')%2019;
        ans += mod[t];
        mod[t]++;
        tens = tens*10%2019;
    }

    cout << ans << endl;
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'sizes'; did you mean 'size'?
   16 |     int n = s.sizes();
      |               ^~~~~
      |               size
a.cc:30:28: error: 'S' was not declared in this scope
   30 |         t = t%2019 + tens*(S[i]-'0')%2019;
      |                            ^
Language: C++

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

 
int main(){
    string s;
    cin >> s;
    n = s.sizes();

    vector<int> mod(n);
    mod[0] = 1;
    for(int i=1;i<n;i++){
        mod[i] = 0;
    }

    long long int t = 0;    
    long long int tens = 1;

    int ans = 0;
    
    for(int i=n-1;i>=0;i--){
        t = t%2019 + tens*(S[i]-'0')%2019;
        ans += mod[t];
        mod[t]++;
        tens = tens*10%2019;
    }

    cout << ans << endl;
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'n' was not declared in this scope
   16 |     n = s.sizes();
      |     ^
a.cc:16:11: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'sizes'; did you mean 'size'?
   16 |     n = s.sizes();
      |           ^~~~~
      |           size
a.cc:30:28: error: 'S' was not declared in this scope
   30 |         t = t%2019 + tens*(S[i]-'0')%2019;
      |                            ^
Language: C

// atcoder/abc164/D/main2.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  str s;
  while (cin >> s) {
    map<int, lli> m;
    reverse(s.begin(), s.end());
    int x = 0;
    int w = 1;
    each (c, s) {
      x = (x + (c - '0') * w) % 2019;
      (w *= 10) %= 2019;
      ++m[x];
    }

    lli y = m[0];
    each (i, m) y += i.second * (i.second - 1) / 2;
    cout << y << endl;
  }

  return 0;
}


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

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

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

    int n = s.length();

    int mod[2019];
    mod[0] = 1;

    int ans = 0;

    for(int i=1;i<n;i++){
        mod[i] = 0;
    }

    long long int t=0, tens = 1;
    
    for(int i=n-1;i>=0;i--){
        t=(t+tens*(s[i]-'0')%2019)%2019;
        //ans+=mod[t];
        mod[t]++;
        tens = tens*10%2019;
    }
    for(int i=0;i<2019;i++){
        ans += mod[i]*(mod[i]-1)/2019
    }
    cout << ans << endl;
}   


Compiler output:
a.cc: In function 'int main()':
a.cc:39:38: error: expected ';' before '}' token
   39 |         ans += mod[i]*(mod[i]-1)/2019
      |                                      ^
      |                                      ;
   40 |     }
      |     ~
Language: C

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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

ll pow_k(ll x,ll n){  // xのn乗 (mod m)
    ll res = 1;
    if(n > 0){
        res = pow(x,n / 2);
        if(n % 2 == 0){
            res = (res * res);
        }else{
            res = (((res * res)) * x);
        }
    }
    return res;
}

int main()
{
    string s; cin >> s;
    ll n = s.size();
    ll a[n];
    reverse(s.begin(),s.end());
    a[0] = s[0] - '0';
    for(ll i = 0; i < n-1; i++){
        a[i+1] = ((ll)(s[i+1]-'0') * pow_k(10,i+1) + (a[i])) % 2019;
        //a[i+1] = ((a[i]+ (s[i+1]-'0'))*pow(10,i)) % 2019);
    }
    map<ll,ll> mp;
    mp[0] = 1;
    rep(i,n){
        mp[a[i]]++;
    }
    ll ans = 0;
    rep(i,mp.size()){
        if(mp[i] > 1){
            ll tmp = mp[i];
            ans += (tmp * (tmp-1))/2;
        }
    }
    cout << ans << endl;
}


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

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;
 
typedef long long int ll; 
 
int main(){
 
    string s;
    cin >> s;

    int n = s.size();



    int mod[2019];
    mod[0] = 1;

    int ans = 0;

    for(int i=1;i<n;i++){
        mod[i] = 0;
    }

    ll t=0, tens = 1;
    
    for(int i=n-1;i>=0;i--){
        t = (t + tens*(s[i]-'0')%2019)%2019;
        ans+=mod[t];
        mod[t]++;
        tens = tes*10%2019;
    }

    cout << ans << endl;
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:37:16: error: 'tes' was not declared in this scope; did you mean 'tens'?
   37 |         tens = tes*10%2019;
      |                ^~~
      |                tens
Language: C

#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 100000000
//#define INF 300000000000000000
#define MOD 1000000007
#define mod 1000000007
#define INT_MAX_ 2147483647
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define rep(i,n)for (ll i = 0; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
#define me memset
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[5]={-1,0,1,0,0};
int dy[5]={0,-1,0,1,0};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp1(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------
ll cnt[2020];
//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    string s;cin>>s;
    ll ans=0;
    cnt[0]=1;
    ll now=0;
    ll d=1;
    for(ll i=s.length()-1;i>=0;i--){
        now+=(s[i]-'0')*d%2019;
        now%=2019;
        cnt[now]++;
        ans+=(cnt[now]-1);
        d*=10;
        d%=2019;
    }
    cout<<ans<<endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------





































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

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;
 
typedef long long int ll; 
 
int main(){
 
    string s;
    cin >> s;

    int n = s.size();

    ll tens[n];
    tens[0] = 1;

    ll mod[2019];
    mod[0] = 1;

    ll dp[n+1];
    dp[n] = 0;

    int ans = 0;

    for(int i=1;i<n;i++){
        mod[i] = 0;
        tens[i] = tens[i-1]*10%2019;
    }

    for(int i=n-1;i>=0;i--){
        dp[i] = (dp[i+1] + tens[n-i-1]*(s[i]-'0')%2019)%2019;
        ans+=a[dp[i]];
        mod[dp[i]]++;

    }

    cout << ans << endl;
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:38:14: error: 'a' was not declared in this scope
   38 |         ans+=a[dp[i]];
      |              ^
Language: C++

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;
 
typedef long long ll; 
 
int main(){
 
    string s;
    cin >> s;

    int n = s.size();

    ll int tens[n];
    tens[0] = 1;

    ll int mod[2019];
    mod[0]++;

    int dp[n+1];
    dp[n] = 0;

    int ans = 0;

    for(int i=1;i<n;i++){
        tens[i] = tens[i-1]*10;
    }

    for(int i=n-1;i>=0;i--){
        dp[i] = dp[i+1] + tens[n-i-1]*s[i];
        mod[dp[i] % 2019]++;
    }

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

    cout << ans << endl;
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: two or more data types in declaration of 'tens'
   20 |     ll int tens[n];
      |     ^~
a.cc:21:5: error: 'tens' was not declared in this scope
   21 |     tens[0] = 1;
      |     ^~~~
a.cc:23:5: error: two or more data types in declaration of 'mod'
   23 |     ll int mod[2019];
      |     ^~
a.cc:24:5: error: 'mod' was not declared in this scope; did you mean 'modf'?
   24 |     mod[0]++;
      |     ^~~
      |     modf
Language: C

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int D = 2019;
int dp[2019];

void solve() {
    string S;
    cin >> S;
    int L = S.size();
    reverse(S.begin(), S.end());
    dp[0] = 1;
    int m = 0;
    int ten = 1;
    for (int i = 0; i < L; ++i) {
        m = m + (S[i] - '0') * ten;
        m %= D;
        dp[m]++;
        ten *= 10;
        ten %= D;
    }
    int ans = 0;
    for (int i = 0; i < 2019; ++i) {
        int x = dp[i];
        ans += x * (x - 1) / 2;
    }
    cout << ans << endl;
}

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


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

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MAXX 1000000000000000000

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll i,j,x,y, fre[2019]={0}, ans=0;
	string s;
	cin >> s;
	x = 1;
	y = 0;
	for(i=n-1;i>=0;i--)
	{
		y += x*(s[i]-'0');
		y %= 2019;
		x *= 10;
		x %= 2019;
		fre[y]++;
	}
	for(i=0;i<2019;i++)
	{
		ans += (fre[i]*(fre[i]+1))/2;
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: 'n' was not declared in this scope
   22 |         for(i=n-1;i>=0;i--)
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
 
#define REP(i, n) for(LL i = 0; i < (LL)(n); i++)
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const LL IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 2019;
 
LL power(LL x, LL y) {
    LL res = 1;
    for(;0 < y;) {
        if(y%2 == 0) {
            x *= x;
            x %= MOD;
            y /= 2;
        }else{
            res *= x;
            res %= MOD;
            y--;
        }
    }
    return res;
}
 
int main() {
    string s;
    cin >> s;
    reverse(ALL(s));
    LL N;
    N = s.size();
    vector<LL> v(N, 0);
    vector<LL> c(MOD, 0);
    v[0] = s[0] - '0';
    c[v[0]] = 1;
    FOR(i, 1, N) {
        LL p = s[i] - '0';
        v[i] = power(10, i)*p + v[i - 1];
        v[i] %= MOD;
        c[v[i]]++;
    }
    LL res = 0;
    res += c[i];
    REP(i, MOD) {
        res += c[i]*(c[i] - 1)/2;
    }
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:14: error: 'i' was not declared in this scope
   46 |     res += c[i];
      |              ^
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

constexpr int m = 2019;

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

    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    int n = s.length();
    
    vector<int> sum(n + 1);
    sum[0] = 0;
    int mul = 1;
    for(int i = 0; i < n; ++i){
        int num = s[i] - '0';
        sum[i + 1] = (sum[i] + num * mul) % m;
        mul *= 10;
        if(mul > m) mul %= m;
    }
    map<int, int> mp;
    for(int i = 0; i <= n; ++i) ++mp[sum[i]];
    ll ans = 0;
    for(auto it : mp)   ans += (ll)it.second * (it.second - 1) / 2;
    cout << ans << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
 
#define REP(i, n) for(LL i = 0; i < (LL)(n); i++)
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const LL IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 2019;
 
LL power(LL x, LL y) {
    LL res = 1;
    for(;0 < y;) {
        if(y%2 == 0) {
            x *= x;
            x %= MOD;
            y /= 2;
        }else{
            res *= x;
            res %= MOD;
            y--;
        }
    }
    return res;
}
 
int main() {
    string s;
    cin >> s;
    reverse(ALL(s));
    LL N;
    N = s.size();
    vector<LL> v(N, 0);
    vector<LL> c(MOD, 0);
    // c[0] = 1;
    v[0] = s[0] - '0';
    FOR(i, 1, N) {
        LL p = s[i] - '0';
        v[i] = power(10, i)*p + v[i - 1];
        v[i] %= MOD;
        c[v[i]]++;
    }
    LL res = 0;
    res += c[0];
    REP(i, MOD) {
        res += c[i]*(c[i] - 1)/2;
    }
    cout << res << endl;
    return 0;
}

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