Buggy python submission (verdict: Time Limit Exceeded):
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t*=10
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())



Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Runtime Error):
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t*=10
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())



Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Time Limit Exceeded):
s=[int(j) for j in input()][::-1]
m=len(s)
from collections import Counter
c=Counter()
tmp=0
c[0]+=1
t=1
for i in range(m):
    tmp+=t*s[i]
    c[tmp%2019]+=1
    t*=10
ans=0
for i in c:
    j=c[i]
    ans+=j*(j-1)//2

print(ans)

Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Time Limit Exceeded):
s=[int(j) for j in input()][::-1]
m=len(s)
from collections import Counter
c=Counter()
tmp=0
c[0]+=1
t=1
for i in range(m):
    tmp+=t*s[i]
    c[tmp%2019]+=1
    t*=10
ll=c.most_common()
ans=0
for i,j in ll:
    if j>=2:
        ans+=j*(j-1)//2
    else:
        break
print(ans)


Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Time Limit Exceeded):
s=[int(j) for j in input()][::-1]
m=len(s)
from collections import Counter
c=Counter()
tmp=0
c[0]+=1
for i in range(m):
    tmp+=pow(10,i)*s[i]
    c[tmp%2019]+=1
ll=c.most_common()
ans=0
for i,j in ll:
    if j>=2:
        ans+=j*(j-1)//2
    else:
        break
print(ans)


Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
m=len(s)
from collections import Counter
c=Counter()
tmp=""
c[0]+=1
for i in s[::-1]:
    tmp=i+tmp
    c[int(tmp)%2019]+=1

ll=c.most_common()
ans=0
for i,j in ll:
    if j>=2:
        ans+=j*(j-1)//2
    else:
        break
print(ans)


Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Runtime Error):
s=input()
m=len(s)
if n<2019:
    print(0)
    exit()
from collections import Counter
c=Counter()
tmp=""
c[0]+=1
for i in s[::-1]:
    tmp=i+tmp
    c[int(tmp)%2019]+=1

ll=c.most_common()
ans=0
for i,j in ll:
    if j>=2:
        ans+=j*(j-1)//2
    else:
        break
print(ans)


Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
n=int(s)
m=len(s)
if n<2019:
    print(0)
    exit()
from collections import Counter
c=Counter()
tmp=""
c[0]+=1
for i in s[::-1]:
    tmp=i+tmp
    c[int(tmp)%2019]+=1

ll=c.most_common()
ans=0
for i,j in ll:
    if j>=2:
        ans+=j*(j-1)//2
    else:
        break
print(ans)


Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
n=int(s)
m=len(s)
if n<2019:
    print(0)
    exit()
from collections import Counter
c=Counter()
for i in range(m+1):
    c[(n%(pow(10,i)))%2019]+=1

ll=c.most_common()
ans=0
for i,j in ll:
    if j>=2:
        ans+=j*(j-1)//2
    else:
        break
print(ans)


Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
n=int(s)
m=len(s)
if n<2019:
    print(0)
    exit()
from collections import Counter
c=Counter()
for i in range(m+1):
    c[(n%(10**i))%2019]+=1

ll=c.most_common()
ans=0
for i,j in ll:
    if j>=2:
        ans+=j*(j-1)//2
    else:
        break
print(ans)


Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
n=int(s)
m=len(s)

if n<2019:
    print(0)
    exit()
dp=[]
for i in range(m+1):
    dp.append((n%(10**i))%2019)
def comb(n,m):
    import math
    if n-m<0:
        return 0
    return(math.factorial(n)//math.factorial(n-m)//math.factorial(m))
import collections
c=collections.Counter(dp)
ll=c.most_common()
ans=0
for i,j in ll:
    if j>=2:
        ans+=comb(j,2)
    else:
        break
print(ans)

Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
n=int(s)
m=len(s)

if n<2019:
    print(0)
    exit()
dp=[]
for i in range(m+1):
    dp.append((n%(10**i))%2019)
def comb(n,m):
    import math
    if n-m<0:
        return 0
    return(math.factorial(n)//math.factorial(n-m)//math.factorial(m))
import collections
c=collections.Counter(dp)
ll=c.most_common()
ans=0
for i,j in ll:
    if j>=2:
        ans+=comb(j,2)
    else:
        break
print(ans)

Fixed submission:
s=[int(j) for j in input()][::-1]
c=[0]*2019
tmp=0
c[0]+=1
t=1
import numpy as np
for i in s:
    tmp+=t*i
    c[tmp%2019]+=1
    t=t*10%2019
c=np.array(c)
ans=c*(c-1)//2
print(ans.sum())