Language: C++

#include <iostream>
#include <cmath>
#include <string>

int main()
{
	std::string S;
	std::cin >> S;
	unsigned int zero = 0;
	int digit = std::log10(std::stoll(S, &zero, 10)) + 1;
	int sum = 0;
	for (int i = 0; i < digit; i++)
	{
		for (int j = i + 1; j <= digit; j++) 
		{
			std::string str = S.substr(i, j - i);
			long long ext = std::stoll(str, &zero, 10);
			if (ext == 0) continue;
			long long res = ext % 2019;
			if (res == 0) {
				sum++;
			}
			
		}
	}
	std::cout << sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:42: error: no matching function for call to 'stoll(std::string&, unsigned int*, int)'
   10 |         int digit = std::log10(std::stoll(S, &zero, 10)) + 1;
      |                                ~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:38: note:   no known conversion for argument 2 from 'unsigned int*' to 'std::size_t*' {aka 'long unsigned int*'}
 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 'std::string' {aka 'std::__cxx11::basic_string<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:17:51: error: no matching function for call to 'stoll(std::string&, unsigned int*, int)'
   17 |                         long long ext = std::stoll(str, &zero, 10);
      |                                         ~~~~~~~~~~^~~~~~~~~~~~~~~~
/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:38: note:   no known conversion for argument 2 from 'unsigned int*' to 'std::size_t*' {aka 'long unsigned int*'}
 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 'std::string' {aka 'std::__cxx11::basic_string<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)
      |         ~~~~~~~~~~~~~~~^~~~~