Language: C++

#include <bits/stdc++.h>
using namespace std;
#define loop(i,a,n) for (ll i=a;i<n;i++)
#define loopm(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define Graph(n) vector < vector < ll > > (n,vector < ll >(0,0)) 
#define tr(container,it)\
for(auto it=container.begin();it!=container.end();it++)
#define SZ(x) ((int)(x).size())
typedef vector<long long> VI;
typedef long long ll;
typedef vector < vector < ll > > VII;
typedef pair<ll,ll> PII;
typedef double db;
ll ans=0;
void computeLPSArray(string pt, ll m, ll* lps)
{
   lps[0]=0;
   ll len=0;
   ll i=1;
   while(i<m)
   {
           if(pt[len]==pt[i])
           {
               len++;
               pt[i]=len;
               i++;
           }
           else
           {
               if(len!=0)//ajeeb if else hn bhai!!
               {
                   len=lps[len-1];
               }
               else
                   lps[i++]=0;
           }
   }
}
void KMPSearch(string pat,string txt)
{
     ll m=strlen(pat);
     ll n=strlen(txt);
     ll lps[m];
     computeLPSArray(pat,m,lps);
     ll i=0,j=0;
     while(i<n)
     {
          if(txt[i]==pat[j])
          {
              i++;
              j++;
          }
          if(j==m)
          {
              ans++;
              j=lps[j-1];
          }
          else if(i<n&&pat[j]!=txt[i])
          {
                  if(j!=0)//ajeed if else hn bhai!!
                   j=lps[j-1];
                else
                    i++;
          }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s="";
    cin>>s;
    for(int i=1;i<1000;i++)
    {
        string txt=to_string(2019*i);
        ll flag=1;
        loop(i,0,txt.size())
        {
              if(txt[i]=='0')
              {
                flag=0;
                break;
              }
        }
        if(flag==1)
        {
            KMPSearch(s,txt);
        }
    }
    cout<<ans<<"\n";

}

Compiler output:
a.cc: In function 'void KMPSearch(std::string, std::string)':
a.cc:46:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   46 |      ll m=strlen(pat);
      |                  ^~~
      |                  |
      |                  std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
a.cc:47:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   47 |      ll n=strlen(txt);
      |                  ^~~
      |                  |
      |                  std::string {aka std::__cxx11::basic_string<char>}
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~