Buggy python submission (verdict: Time Limit Exceeded):
# multiple
line = input()
ln = 0
counts=[0]*2019
for i in range(1,len(line) + 1):
    ti1 = (ln +(int(line[-1*i])*10**(i-1))%2019)%2019
    counts[ti1] += 1
    ln = ti1
total = 0
counts[0] +=1
for i in range(len(counts)):
    total += counts[i]*(counts[i] - 1)/2
print(int(total))

Fixed submission:
# multiple
line = input()
ln = 0
d = 1
counts=[0]*2019
for i in range(1,len(line) + 1):
    ti1 = (ln +(int(line[-1*i])*d))%2019
    counts[ti1] += 1
    ln = ti1
    d *= 10
    d %= 2019
total = 0
counts[0] +=1
for i in range(len(counts)):
    total += counts[i]*(counts[i] - 1)/2
print(int(total))

Buggy python submission (verdict: Time Limit Exceeded):
# multiple
line = input()
ln = [0]
counts=[0]*2019
for i in range(1,len(line) + 1):
    ti1 = (ln[-1] +(int(line[-1*i])*10**(i-1))%2019)%2019
    counts[ti1] += 1
    ln.append(ti1)
total = 0
counts[0] +=1
for i in range(len(counts)):
    total += counts[i]*(counts[i] - 1)/2
print(int(total))

Fixed submission:
# multiple
line = input()
ln = 0
d = 1
counts=[0]*2019
for i in range(1,len(line) + 1):
    ti1 = (ln +(int(line[-1*i])*d))%2019
    counts[ti1] += 1
    ln = ti1
    d *= 10
    d %= 2019
total = 0
counts[0] +=1
for i in range(len(counts)):
    total += counts[i]*(counts[i] - 1)/2
print(int(total))

Buggy python submission (verdict: Time Limit Exceeded):
# multiple
line = input()
ln = [0]
combi = 0
for i in range(1,len(line) + 1):
    ti1 = (ln[-1] +(int(line[-1*i])*10**(i-1))%2019)%2019
    combi+= ln.count(ti1)
    ln.append(ti1)
print(combi)

Fixed submission:
# multiple
line = input()
ln = 0
d = 1
counts=[0]*2019
for i in range(1,len(line) + 1):
    ti1 = (ln +(int(line[-1*i])*d))%2019
    counts[ti1] += 1
    ln = ti1
    d *= 10
    d %= 2019
total = 0
counts[0] +=1
for i in range(len(counts)):
    total += counts[i]*(counts[i] - 1)/2
print(int(total))

Buggy python submission (verdict: Time Limit Exceeded):
# multiple
line = input()
ln = []
combi = 0
for i in range(len(line)):
    n = int(line[i:])% 2019 
    combi += ln.count(n)
    ln.append(n)
    #print( str(i) +',' +str(combi)+','+ str(n), ln)
n = 0
combi += ln.count(n)
ln.append(n)
#print( str(i) +',' +str(combi)+','+ str(n), ln)
print(combi)

Fixed submission:
# multiple
line = input()
ln = 0
d = 1
counts=[0]*2019
for i in range(1,len(line) + 1):
    ti1 = (ln +(int(line[-1*i])*d))%2019
    counts[ti1] += 1
    ln = ti1
    d *= 10
    d %= 2019
total = 0
counts[0] +=1
for i in range(len(counts)):
    total += counts[i]*(counts[i] - 1)/2
print(int(total))

Buggy python submission (verdict: Time Limit Exceeded):
#multiple 
line = input()
n = len(line)
total = 0
for i in range(n-3):
    for j in range(i +3,n):
        if int(line[i:j+1])%2019 == 0:
            total +=1
            
print(total)

Fixed submission:
# multiple
line = input()
ln = 0
d = 1
counts=[0]*2019
for i in range(1,len(line) + 1):
    ti1 = (ln +(int(line[-1*i])*d))%2019
    counts[ti1] += 1
    ln = ti1
    d *= 10
    d %= 2019
total = 0
counts[0] +=1
for i in range(len(counts)):
    total += counts[i]*(counts[i] - 1)/2
print(int(total))

Buggy python submission (verdict: Time Limit Exceeded):
#multiple 
line = input()
n = len(line)
total = 0
for i in range(n-3):
    for j in range(i +3,n):
        if int(line[i:j+1])%2019 == 0:
            total +=1
            
print(total)

Fixed submission:
# multiple
line = input()
ln = 0
d = 1
counts=[0]*2019
for i in range(1,len(line) + 1):
    ti1 = (ln +(int(line[-1*i])*d))%2019
    counts[ti1] += 1
    ln = ti1
    d *= 10
    d %= 2019
total = 0
counts[0] +=1
for i in range(len(counts)):
    total += counts[i]*(counts[i] - 1)/2
print(int(total))