Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
sss = []
for i in range(len(s)):
  for j in range(len(s)):
    a = s[i:i+j+2]
    sss.append(a)
    
sssss = set(sss)
for i in sssss:
  if int(sssss[i]) % 2019 == 0:
    ans += 1
      
      
print(ans)


Fixed submission:
s,l = (input(),2019)
m,a,r = ([1]+[0]*l,0,0)
for i,e in enumerate(s[::-1]):
    a += int(e)*pow(10,i,l)
    r += m[a%l]
    m[a%l] += 1
print(r)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
S =[]
for i in range(len(s)):
  for j in range(len(s)):
    a = s[i:i+j+2]
    S.append(a)
sa = set(S)
for i in range(len(se)):
  if int(sa[i]) % 2019 == 0:
    ans += 1

print(ans)


Fixed submission:
s,l = (input(),2019)
m,a,r = ([1]+[0]*l,0,0)
for i,e in enumerate(s[::-1]):
    a += int(e)*pow(10,i,l)
    r += m[a%l]
    m[a%l] += 1
print(r)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
af = 0
for i in range(len(s)):
  for j in range(len(s)):
    a = s[i:i+j+3]
    if len(a) <= 200000:
      af = 0
    else int(a) % 2019 == 0:
      ans += 1

print(ans)


Fixed submission:
s,l = (input(),2019)
m,a,r = ([1]+[0]*l,0,0)
for i,e in enumerate(s[::-1]):
    a += int(e)*pow(10,i,l)
    r += m[a%l]
    m[a%l] += 1
print(r)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0

for i in range(len(s)):
  for j in range(len(s)):
    a = s[i:i+j]
    if int(a) % 2019 == 0:
      ans += 1

print(ans)


Fixed submission:
s,l = (input(),2019)
m,a,r = ([1]+[0]*l,0,0)
for i,e in enumerate(s[::-1]):
    a += int(e)*pow(10,i,l)
    r += m[a%l]
    m[a%l] += 1
print(r)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0

for i in range(len(s)):
  for j in range(len(s)):
    a = s[i:i+j]
    if int(a) % 2019 == 0:
      ans += 1

print(ans)


Fixed submission:
s,l = (input(),2019)
m,a,r = ([1]+[0]*l,0,0)
for i,e in enumerate(s[::-1]):
    a += int(e)*pow(10,i,l)
    r += m[a%l]
    m[a%l] += 1
print(r)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
for i in range(len(s)):
  for j in range(len(s)):
  a = s[i:i+j]
  if int(a) % 2019 == 0:
    ans += 1

print(ans)

Fixed submission:
s,l = (input(),2019)
m,a,r = ([1]+[0]*l,0,0)
for i,e in enumerate(s[::-1]):
    a += int(e)*pow(10,i,l)
    r += m[a%l]
    m[a%l] += 1
print(r)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
if int(s) < 2019 :
  print(0)
else:
  for i in range(len(s)-3):
    for j in range(4,len(s)):
      a =s[i:j+1]
      if int(a) % 2019 == 0:
        ans += 1
        
print(ans)

Fixed submission:
s,l = (input(),2019)
m,a,r = ([1]+[0]*l,0,0)
for i,e in enumerate(s[::-1]):
    a += int(e)*pow(10,i,l)
    r += m[a%l]
    m[a%l] += 1
print(r)

Buggy python submission (verdict: Runtime Error):
s = input()
L = [s[i] for i in range(len(s))]
ans = 0

for j in range(0,len(L)-3):
  for k in range(3,len(L)):
    a = int(L[j:k+1])
    if a % 2019 == 0:
      ans += 1
print(ans)
               


Fixed submission:
s,l = (input(),2019)
m,a,r = ([1]+[0]*l,0,0)
for i,e in enumerate(s[::-1]):
    a += int(e)*pow(10,i,l)
    r += m[a%l]
    m[a%l] += 1
print(r)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
for i in range(0,len(s)-3):
  for j in range(3,len(s)):
    a = int(s[i:j+1])
    if a % 2019 == 0:
      ans += 1
print(ans)
               


Fixed submission:
s,l = (input(),2019)
m,a,r = ([1]+[0]*l,0,0)
for i,e in enumerate(s[::-1]):
    a += int(e)*pow(10,i,l)
    r += m[a%l]
    m[a%l] += 1
print(r)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
for i in range(0,len(s)-2):
  for j in range(3,len(s)+1):
    a = s[i:j+1]
    if a%2019 == 0:
      ans += 1
print(ans)
               


Fixed submission:
s,l = (input(),2019)
m,a,r = ([1]+[0]*l,0,0)
for i,e in enumerate(s[::-1]):
    a += int(e)*pow(10,i,l)
    r += m[a%l]
    m[a%l] += 1
print(r)