Language: C++

// #include <bits/stdc++.h>
#include <string>
#define REP(i, n) for(long long i = 0; i < n; i++)
#define REPR(i, n) for(long long i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(long long i = m; i <= n; i++)
#define FORR(i, m, n) for(long long i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;


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

    string s; cin>>s;
    int n = s.size();
    ll dp[n+1][2019];

    if(n<4){
        cout << 0 << endl;
        return 0;
    }

    // REP(i,n+1)REP(j,2019) dp[i][j]=0;
    char a = s[0];
    dp[1][a-'0'] = 1;

    FOR(i,1,n-1){
        a = s[i];
        int keta = a-'0';
        dp[i+1][keta]++;

        REP(j,2019){  
            // if (i==10) cout<<dp[i][j]<<endl; 
            dp[i+1][(j*10+keta) % 2019] += dp[i][j];
        }

    }
    int ans = 0;

    FOR(i,1,n){
        cout<<dp[i][0]<<endl;
        ans += dp[i][0];
    }

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

Compiler output:
a.cc:13:13: error: 'vector' does not name a type
   13 | using vll = vector<ll>;
      |             ^~~~~~
a.cc:14:14: error: 'vector' does not name a type
   14 | using vvll = vector<vector<ll>>;
      |              ^~~~~~
a.cc: In function 'int main()':
a.cc:24:15: error: 'cin' was not declared in this scope
   24 |     string s; cin>>s;
      |               ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <string>
  +++ |+#include <iostream>
    3 | #define REP(i, n) for(long long i = 0; i < n; i++)
a.cc:29:9: error: 'cout' was not declared in this scope
   29 |         cout << 0 << endl;
      |         ^~~~
a.cc:29:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:22: error: 'endl' was not declared in this scope
   29 |         cout << 0 << endl;
      |                      ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <string>
  +++ |+#include <ostream>
    3 | #define REP(i, n) for(long long i = 0; i < n; i++)
a.cc:51:9: error: 'cout' was not declared in this scope
   51 |         cout<<dp[i][0]<<endl;
      |         ^~~~
a.cc:51:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:51:25: error: 'endl' was not declared in this scope
   51 |         cout<<dp[i][0]<<endl;
      |                         ^~~~
a.cc:51:25: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:55:5: error: 'cout' was not declared in this scope
   55 |     cout<<ans<<endl;
      |     ^~~~
a.cc:55:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:55:16: error: 'endl' was not declared in this scope
   55 |     cout<<ans<<endl;
      |                ^~~~
a.cc:55:16: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'