Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
S = input()
count = 0
l = [0]*2019
l[0] = 1
l = np.array(l)

for i in range(1,len(S)+1):
    n =(int(S[len(S)-i:])%2019)
    l[n] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)


Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy python submission (verdict: Runtime Error):
import numpy as np
S = input()
count = 0
l = [0]*2019
l[0] = 1
l = np.array(l)

for i in range(1,len(S)+1):
    n =(int(S[len(S)-i:])%2019)
    l[n] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)


Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
S = input()
count = 0
l = [0]*2019
l[0] = 1
l = deque(l)

for i in range(1,len(S)+1):
    n =(int(S[len(S)-i:])%2019)
    l[n] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)


Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
count = 0
l = [0]*2019
l[0] = 1

for i in range(1,len(S)+1):
    n =(int(S[len(S)-i:])%2019)
    l[n] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)


Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
S = int(input())
count = 0
l = [0]*2019
key = range(2019)
l[0] = 1
d = dict(zip(key,l))

for i in range(1,len(str(S))+1):
    n =((S%10**i)%2019)
    d[n] += 1
    

for j in range(2019):
    if d[j] >= 2:
        count += d[j]*(d[j]-1)//2

print(count)


Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
S = int(input())
count = 0
l = [0]*2019
l[0] = 1

for i in range(1,len(str(S))+1):
    l[(S%10**i)%2019] += 1

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)


Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
S = int(input())
count = 0
l = [0]*2019
l[0] = 1

for i in range(1,len(str(S))+1):
   l[(S%10**i)%2019] += 1

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)


Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy python submission (verdict: Time Limit Exceeded):

S = int(input())
count = 0
l = [0]*2019
l[0] = 1

for i in range(1,len(str(S))+1):
   l[(S%10**i)%2019] += 1

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)


Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

S = int(input())
count = 0
l = [0]*2019
l[0] = 1

for i in range(1,len(str(S))+1):
   l[(S%10**i)%2019] += 1

for j in range(2019):
    if l[j] >= 2:
        count += comb(l[j],2)

print(count)


Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
S = int(input())
count = 0
l = [0]*2019

for i in range(1,len(str(S))+1):
   l[(S%10**i)%2019] += 1

count += l[0]
for j in range(1,len(l)):
    if l[j] >= 2:
        count += comb(l[j],2)

print(count)


Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
S = int(input())
count = 0

for i in range(1,len(str(S))+1):
    for j in range(i+4,len(str(S))+1):
        N = S%10**(len(str(S))-i+1)-S%10**(len(str(S))-j)
        if N%2019 == 0:
            count += 1

print(count)
  

Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)