Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
num = 0
for i in range(L-1, (-1), (-1)):
    num += (int(s[i]) * pow(10,(L-i-1)))%2019
    amari = num % 2019
    dict[amari] += 1
ans = 0
for j in range(2019):
    ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Fixed submission:
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
num = 0
for i in range(L-1, (-1), (-1)):
    num += (int(s[i]) * pow(10,(L-i-1), 2019))%2019
    amari = num % 2019
    dict[amari] += 1
ans = 0
for j in range(2019):
    ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
for i in range(L):
  amari = (int(s[i:])) % 2019
  dict[amari] += 1
ans = 0
for j in range(2019):
  ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Fixed submission:
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
num = 0
for i in range(L-1, (-1), (-1)):
    num += (int(s[i]) * pow(10,(L-i-1), 2019))%2019
    amari = num % 2019
    dict[amari] += 1
ans = 0
for j in range(2019):
    ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
for i in range(L):
  amari = (int(s[i:])) % 2019
  dict[amari] += 1
ans = 0
for j in range(2019):
  ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Fixed submission:
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
num = 0
for i in range(L-1, (-1), (-1)):
    num += (int(s[i]) * pow(10,(L-i-1), 2019))%2019
    amari = num % 2019
    dict[amari] += 1
ans = 0
for j in range(2019):
    ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
for i in range(L):
  amari = (int(s[i:])) % 2019
  dict[amari] += 1
ans = 0
for j in range(2019):
  ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Fixed submission:
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
num = 0
for i in range(L-1, (-1), (-1)):
    num += (int(s[i]) * pow(10,(L-i-1), 2019))%2019
    amari = num % 2019
    dict[amari] += 1
ans = 0
for j in range(2019):
    ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
L = len(s)
dict = {}
for i in range(L):
  amari = (int(s[i:])) % 2019
  if not(amari in dict.keys()):
    dict[amari] = 1
  else:
    dict[amari] += 1
if not(0 in dict.keys()):
    dict[0] = 1
else:
    dict[0] += 1
ans = 0
for key in dict.keys():
  ans += (dict[key]*(dict[key]-1))/2
print(int(ans))

Fixed submission:
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
num = 0
for i in range(L-1, (-1), (-1)):
    num += (int(s[i]) * pow(10,(L-i-1), 2019))%2019
    amari = num % 2019
    dict[amari] += 1
ans = 0
for j in range(2019):
    ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Buggy python submission (verdict: Runtime Error):
s = str(input())
L = len(s)
dict = {}
for i in range(L):
  amari = (int(s[i:])*(10**i)) % 2019
  if not(amari in dict.keys()):
    dict[amari] = 1
  else:
    dict[amari] += 1
dict[0] += 1
ans = 0
for key in dict.keys():
  ans += (dict[key]*(dict[key]-1))/2
print(int(ans))

Fixed submission:
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
num = 0
for i in range(L-1, (-1), (-1)):
    num += (int(s[i]) * pow(10,(L-i-1), 2019))%2019
    amari = num % 2019
    dict[amari] += 1
ans = 0
for j in range(2019):
    ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Buggy python submission (verdict: Runtime Error):
s = str(input())
L = len(s)
dict = {}
for i in range(L+1):
  amari = int(s[i:]) % 2019
  if not(amari in dict.keys()):
    dict[amari] = 1
  else:
    dict[amari] += 1
ans = 0
for key in dict.keys():
  ans += (dict[key]*(dict[key]-1))/2
print(int(ans))

Fixed submission:
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
num = 0
for i in range(L-1, (-1), (-1)):
    num += (int(s[i]) * pow(10,(L-i-1), 2019))%2019
    amari = num % 2019
    dict[amari] += 1
ans = 0
for j in range(2019):
    ans += (dict[j]*(dict[j]-1))/2
print(int(ans))

Buggy python submission (verdict: Runtime Error):
s = str(input())
L = len(s)
dict = {}
for i in range(L):
  amari = s[i:] % 2019
  if not(amari in dict.keys()):
    dict[amari] = 1
  else:
    dict[amari] += 1
ans = 0
for key in dict.keys():
  ans += (dict[amari]*(dict[amari]-1))/2
print(ans)

Fixed submission:
s = str(input())
L = len(s)
dict = [0] * 2019
dict[0] += 1
num = 0
for i in range(L-1, (-1), (-1)):
    num += (int(s[i]) * pow(10,(L-i-1), 2019))%2019
    amari = num % 2019
    dict[amari] += 1
ans = 0
for j in range(2019):
    ans += (dict[j]*(dict[j]-1))/2
print(int(ans))