Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
s = input()
cnt = 0
ss = []
nums = np.array([(i+1)*2019 for i in range(200000//2019) if not "0" in str((i+1)*2019)])
for start in range(len(s)):
  end = start + 3
  while(end+1<=len(s)):
    if int(s[start:end+1]) in nums:
      cnt += 1
    end += 1
print(cnt)

Fixed submission:
s = input()
l = len(s)
dp = [0]*2019
dp[0] = 1
r = 0
for i in range(1, l + 1):
    r += int(s[-i]) * pow(10, i - 1, 2019)
    r %= 2019
    dp[r] += 1
    
print(sum([(i * (i - 1)) // 2 for i in dp]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
s = input()
cnt = 0
ss = []
nums = np.array([(i+1)*2019 for i in range(200000//2019) if not "0" in str((i+1)*2019)])
for start in range(len(s)):
  end = start + 3
  while(end+1<=len(s)):
    if int(s[start:end+1]) in nums:
      cnt += 1
    end += 1
print(cnt)

Fixed submission:
s = input()
l = len(s)
dp = [0]*2019
dp[0] = 1
r = 0
for i in range(1, l + 1):
    r += int(s[-i]) * pow(10, i - 1, 2019)
    r %= 2019
    dp[r] += 1
    
print(sum([(i * (i - 1)) // 2 for i in dp]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
s = input()
cnt = 0
ss = []
nums = np.array([(i+1)*2019 for i in range(200000//2019) if not "0" in str((i+1)*2019)])
for start in range(len(s)):
  end = start + 3
  while(end+1<=len(s)):
    if int(s[start:end+1]) in nums:
      cnt += 1
    end += 1
print(cnt)

Fixed submission:
s = input()
l = len(s)
dp = [0]*2019
dp[0] = 1
r = 0
for i in range(1, l + 1):
    r += int(s[-i]) * pow(10, i - 1, 2019)
    r %= 2019
    dp[r] += 1
    
print(sum([(i * (i - 1)) // 2 for i in dp]))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
cnt = 0
ss = []
nums = [(i+1)*2019 for i in range(200000//2019) if not "0" in str((i+1)*2019)]
for start in range(len(s)):
  end = start + 3
  while(end+1<=len(s)):
    if int(s[start:end+1]) in nums:
      cnt += 1
    end += 1
print(cnt)

Fixed submission:
s = input()
l = len(s)
dp = [0]*2019
dp[0] = 1
r = 0
for i in range(1, l + 1):
    r += int(s[-i]) * pow(10, i - 1, 2019)
    r %= 2019
    dp[r] += 1
    
print(sum([(i * (i - 1)) // 2 for i in dp]))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
cnt = 0
ss = []
nums = [str((i+1)*2019) for i in range(200000//2019)]
for start in range(len(s)):
  end = start + 3
  while(end+1<=len(s)):
    ss.append(s[start:end+1])
    end += 1
for ss_ in ss:
  if ss_ in nums:
    cnt += 1
print(cnt)


Fixed submission:
s = input()
l = len(s)
dp = [0]*2019
dp[0] = 1
r = 0
for i in range(1, l + 1):
    r += int(s[-i]) * pow(10, i - 1, 2019)
    r %= 2019
    dp[r] += 1
    
print(sum([(i * (i - 1)) // 2 for i in dp]))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
cnt = 0
pass_ = False
for start in range(len(s)):
  end = start + 3
  if int(s[start:end+1]) == 2019:
    cnt += 1
    pass_ = True
  elif int(s[start:end+1]) < 2019:
    end += 1
  while(end+1<=len(s)):
    if int(s[start:end+1]) % 2019 == 0 and pass_ == False:
      cnt += 1
    end += 1
    pass_ = False
print(cnt)


Fixed submission:
s = input()
l = len(s)
dp = [0]*2019
dp[0] = 1
r = 0
for i in range(1, l + 1):
    r += int(s[-i]) * pow(10, i - 1, 2019)
    r %= 2019
    dp[r] += 1
    
print(sum([(i * (i - 1)) // 2 for i in dp]))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
cnt = 0
pass_ = False
for start in range(len(s)):
  end = start + 3
  if int(s[start:end+1]) == 2019:
    cnt += 1
    pass_ = True
  elif int(s[start:end+1]) < 2019:
    end += 1
  while(end+1<=len(s)):
    if int(s[start:end+1]) % 2019 == 0 and pass_ == False:
      cnt += 1
    end += 1
    pass_ = False
print(cnt)


Fixed submission:
s = input()
l = len(s)
dp = [0]*2019
dp[0] = 1
r = 0
for i in range(1, l + 1):
    r += int(s[-i]) * pow(10, i - 1, 2019)
    r %= 2019
    dp[r] += 1
    
print(sum([(i * (i - 1)) // 2 for i in dp]))