Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  string S;cin>>S;
  ll N=S.size(),DP[N][2019],i,j,ans=0;
  REP(i,N)REP(j,2019)DP[i][j]=0;
  REP(i,N)DP[i][stoll(S[i])]++;
  REP(i,N-1)REP(j,2019)DP[i+1][(stoll(S[i+1])+10*j%2019)%2019]+=DP[i][j];
  REP(i,N)ans+=DP[i][0];
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: no matching function for call to 'stoll(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   14 |   REP(i,N)DP[i][stoll(S[i])]++;
      |                 ~~~~~^~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4180:3: note: candidate: 'long long int std::__cxx11::stoll(const std::string&, std::size_t*, int)'
 4180 |   stoll(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~~
/usr/include/c++/14/bits/basic_string.h:4180:23: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
 4180 |   stoll(const string& __str, size_t* __idx = 0, int __base = 10)
      |         ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4447:3: note: candidate: 'long long int std::__cxx11::stoll(const std::wstring&, std::size_t*, int)'
 4447 |   stoll(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~~
/usr/include/c++/14/bits/basic_string.h:4447:24: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
 4447 |   stoll(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |         ~~~~~~~~~~~~~~~^~~~~
a.cc:15:38: error: no matching function for call to 'stoll(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   15 |   REP(i,N-1)REP(j,2019)DP[i+1][(stoll(S[i+1])+10*j%2019)%2019]+=DP[i][j];
      |                                 ~~~~~^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4180:3: note: candidate: 'long long int std::__cxx11::stoll(const std::string&, std::size_t*, int)'
 4180 |   stoll(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~~
/usr/include/c++/14/bits/basic_string.h:4180:23: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
 4180 |   stoll(const string& __str, size_t* __idx = 0, int __base = 10)
      |         ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4447:3: note: candidate: 'long long int std::__cxx11::stoll(const std::wstring&, std::size_t*, int)'
 4447 |   stoll(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~~
/usr/include/c++/14/bits/basic_string.h:4447:24: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
 4447 |   stoll(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |         ~~~~~~~~~~~~~~~^~~~~