Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
h_deg = (minutes  / (12 * 60)) * 2 * math.pi
m_deg = (minutes  / 60) * 2 * math.pi
h_x = a * math.cos(h_deg)
h_y = a * math.sin(h_deg)
m_x = b * math.cos(m_deg)
m_y = b * math.sin(m_deg)
print(math.sqrt((h_x - m_x) * (h_x - m_x) + (h_y - m_y) * (h_y - m_y)))


Fixed submission:
import math

(a, b, h, m) = tuple(map(int, input().split()))
minutes = h * 60 + m
h_deg = (minutes  / (12 * 60)) * 2 * math.pi
m_deg = (minutes  / 60) * 2 * math.pi
h_x = a * math.cos(h_deg)
h_y = a * math.sin(h_deg)
m_x = b * math.cos(m_deg)
m_y = b * math.sin(m_deg)
print(math.sqrt((h_x - m_x) * (h_x - m_x) + (h_y - m_y) * (h_y - m_y)))
Buggy python submission (verdict: Runtime Error):
import math
A,B,H,M=map(int,input().split())
H=5*H+5*M/60
theta=6*abs(H-M) 
if theta>180:
    theta=360-theta
C=math.sqrt(A**2+B**2-2*A*B*(math.cos(math.radians(theta))))
print(C)

Fixed submission:
N=list(map(int,input()))
if N[-1]==3:
    print("bon")
elif N[-1]==2 or N[-1]==4 or N[-1]==5 or N[-1]==7 or N[-1]==9:
    print("hon")
else:
    print("pon")
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
if len(s)<=n:
  print(s)
else:
  print(s[:n,'...',sep=''])

Fixed submission:
n=int(input())
s=input()
if len(s)<=n:
  print(s)
else:
  print(s[:n],'...',sep='')
Buggy python submission (verdict: Runtime Error):
import math

a,b,h,m = map(int,input().split())

flg = 0
if h > 6:
  flg += 1
  x = 12 - h
  h = 6 - x

if m > 30:
  flg += 2
  mm = m -30

if flg == 1:
  mm = m + 30

if flg == 2:
  h += 6

c = (h * 60 * 0.5) + (m * 0.5)
d = mm * 6

if c > d:
  e = c - d
else:
  e = d - c

if e == 0:
  print(0.0)
else:
  ans = (a * a) + (b * b) - 2 * a * b * math.cos(math.radians(e))
  print(math.sqrt(ans))

Fixed submission:
import math

a,b,h,m = map(int,input().split())

c = (h * 60 * 0.5) + (m * 0.5)
d = m * 6

if c > d:
  e = c - d
else:
  e = d - c

ans = (a * a) + (b * b) - 2 * a * b * math.cos(math.radians(e))
print(math.sqrt(ans))

Buggy python submission (verdict: Runtime Error):
import math

a,b,h,m = map(int,input().split())

if h > 6:
  x = 12 - h
  h = 6 - x

if m > 30:
  mm = m -30

c = (h * 60 * 0.5) + (m * 0.5)
d = mm * 6

if c > mm:
  e = c - d
else:
  e = d - c

ans = (a * a) + (b * b) - 2 * a * b * math.cos(math.radians(e))
print(math.sqrt(ans))

Fixed submission:
import math

a,b,h,m = map(int,input().split())

c = (h * 60 * 0.5) + (m * 0.5)
d = m * 6

if c > d:
  e = c - d
else:
  e = d - c

ans = (a * a) + (b * b) - 2 * a * b * math.cos(math.radians(e))
print(math.sqrt(ans))

Buggy python submission (verdict: Runtime Error):
import math

a,b,h,m = map(int,input().split())

if h > 6:
  x = 12 - h
  h = 6 - x

if m > 30:
  mm = m -30

c = (h * 60 * 0.5) + (m * 0.5)
d = mm * 6

if c > mm:
  e = c - d
else:
  e = d - c

ans = (a * a) + (b * b) - 2 * a * b * math.cos(math.radians(e))
print(math.sqrt(ans))

Fixed submission:
import math

a,b,h,m = map(int,input().split())

c = (h * 60 * 0.5) + (m * 0.5)
d = m * 6

if c > d:
  e = c - d
else:
  e = d - c

ans = (a * a) + (b * b) - 2 * a * b * math.cos(math.radians(e))
print(math.sqrt(ans))
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split)
if c - (a -b) >= 0:
  print(c - (a -b))
else:
  print(0)


Fixed submission:
a, b, c= map(int, input().split())
if c - (a - b) >= 0:
  print(c - (a - b))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n = input()
i = int(n)
cnt = 0
ans = 0
while i > 0:
  i /= 10
  cnt++
if cnt / 2 == 0:
  i = cnt / 2
  if i == 3:
      ans = 90000 + 900 + 9
  elif i == 2:
      ans = 900 + 9
  else :
      ans = 9
else :
  i = (cnt / 2) + 1
  if i == 3:
    ans = 9 + 900 + (int(n) - 10000) + 1
  elif i == 2:
    ans = 9 + (int(n) - 100) + 1
  else :
    ans = int(n)
print(ans)


Fixed submission:
n = input()
i = int(n)
cnt = 0
ans = 0
while i >= 1:
  i = int(i) / 10
  cnt = int(cnt) + 1
if int(cnt) % 2 == 0:
  i = cnt / 2
  if i == 3:
      ans = 90000 + 900 + 9
  elif i == 2:
      ans = 900 + 9
  else :
      ans = 9
else :
  i = (int(cnt) / 2) + 1
  if i >= 3:
    ans = 9 + 900 + (int(n) - 10000) + 1
  elif i >= 2:
    ans = 9 + (int(n) - 100) + 1
  else :
    ans = int(n)
print(ans)

Buggy python submission (verdict: Runtime Error):
n = map(int, input())
i = n
cnt = 0
ans = 0
while i > 0:
  i /= 10
  cnt++
  
if cnt / 2 == 0:
  i = cnt / 2
  if i == 3:
      ans = 90000 + 900 + 9
  elif i == 2:
      ans = 900 + 9
  else :
      ans = 9
  
else :
  i = (cnt / 2) + 1
  if i == 3:
    ans = 9 + 900 + (n - 10000) + 1
  elif i == 2:
    ans = 9 + (n - 100) + 1
  else :
    ans = n

print(ans)


Fixed submission:
n = input()
i = int(n)
cnt = 0
ans = 0
while i >= 1:
  i = int(i) / 10
  cnt = int(cnt) + 1
if int(cnt) % 2 == 0:
  i = cnt / 2
  if i == 3:
      ans = 90000 + 900 + 9
  elif i == 2:
      ans = 900 + 9
  else :
      ans = 9
else :
  i = (int(cnt) / 2) + 1
  if i >= 3:
    ans = 9 + 900 + (int(n) - 10000) + 1
  elif i >= 2:
    ans = 9 + (int(n) - 100) + 1
  else :
    ans = int(n)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().splid())
if (a + b) % 2 == 0 :
  print((a + b) / 2)
else :
  print("IMPOSSIBLE")


Fixed submission:
a, b = map(int, input().split())
if (a + b) % 2 == 0 :
  print((a + b) // 2)
else :
  print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a + b) % 2 == 0 :
  print((a + b) / 2)
else
  print("IMPOSSIBLE")


Fixed submission:
a, b = map(int, input().split())
if (a + b) % 2 == 0 :
  print((a + b) // 2)
else :
  print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().splid())
if (a + b) % 2 == 0 :
  print((a + b) / 2)
else
  print("IMPOSSIBLE")


Fixed submission:
a, b = map(int, input().split())
if (a + b) % 2 == 0 :
  print((a + b) // 2)
else :
  print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().solid())
if (a + b) % 2 == 0 :
  print((a + b) % 2)
else
  print("IMPOSSIBLE")


Fixed submission:
a, b = map(int, input().split())
if (a + b) % 2 == 0 :
  print((a + b) // 2)
else :
  print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
n, d = map(int, input().split())
i = (d * 2) + 1
if n % i == 0 :
  print(n / i)
else :
  print((n // i) + 1)


Fixed submission:
r = int(input())
print(3 * r * r)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = int(input())
i = (d * 2) + 1
if n % i == 0 :
  print(n // i)
else :
  print((n // i) + 1)


Fixed submission:
n, d = map(int, input().split())
i = (d * 2) + 1
if n % i == 0 :
  print(n // i)
else :
  print((n // i) + 1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = int(input())
i = (d * 2) + 1
if n % i == 0 :
  print(n / i)
else :
  print((n // i) + 1)


Fixed submission:
n, d = map(int, input().split())
i = (d * 2) + 1
if n % i == 0 :
  print(n // i)
else :
  print((n // i) + 1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = int(input())
i = (d * 2) + 1
if n % i == 0 :
  print(n / i)
else :
  print(n // i) + 1

Fixed submission:
n, d = map(int, input().split())
i = (d * 2) + 1
if n % i == 0 :
  print(n // i)
else :
  print((n // i) + 1)
Buggy python submission (verdict: Runtime Error):
n, a, b = (int(x) for x in input().splint())
sum = n * a
if sum <= b :
  print(sum)
else :
  print(b)

Fixed submission:
n, a, b = (int(x) for x in input().split())
sum = n * a
if sum <= b :
  print(sum)
else :
  print(b)
Buggy python submission (verdict: Runtime Error):
n, d = (int(i) for i in input().split())
num = list((list(map(int, input().split())) for j in rage(n)))
sum = 0
cnt = 0
for k in range(n - 1) :
  for h in range(d) :
    sum += (num[k][h] - num[k + 1][n])**2
  if (isinstance(sum **(1 / 2)), int) :
    cnt += 1
  sum = 0
print(sum)

Fixed submission:
n, d = (int(i) for i in input().split())
num = list((list(map(int, input().split())) for j in range(n)))
sum = 0
cnt = 0
for k in range(n - 1) :
  for t in range(k + 1, n) :
    for h in range(d) :
      sum += (num[k][h] - num[t][h])**2
    work = sum**(1 / 2)
    temp = work * 10
    temp = temp % 10
    if temp == 0 :
      cnt += 1
    sum = 0
print(cnt)
Buggy python submission (verdict: Runtime Error):
s = input()
cnt = 0
for i in renge(4 - 1) :
  if s[i] != s[i + 1] :
    cnt += 1
if cnt != 0 && cnt <= 2 :
  print("Yes")
else :
  print("No")


Fixed submission:
s = input()
s = sorted(s)
cnt = 0
for i in range(4 - 1) :
  if s[i] != s[i + 1] :
    cnt += 1
if cnt == 1 :
  print("Yes")
else :
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
num = list(map(int, input().split()))
cnt = 0
for i in range(1, n) :
  if num[i - 1] > num[i] & num[i] > num[i + 1] :
    cnt += 1
  elif num[i - 1] < num[i] & num[i] < num[i + 1] :
    cnt += 1
print(cnt)

Fixed submission:
n = int(input())
num = list(map(int, input().split()))
cnt = 0
for i in range(1, n - 1) :
  if num[i - 1] > num[i] & num[i] > num[i + 1] :
    cnt += 1
  elif num[i - 1] < num[i] & num[i] < num[i + 1] :
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
s = list(map(int, input().solit()))
flg = 1
for i in range(4) :
  if i != 0 & s[i -1] == s[i] :
    flg = 0
if flg == 1 :
  print("Good")
else :
  print("Bad")
    

Fixed submission:
s = list(map(int, input()))
flg = 1
for i in range(4) :
  if i != 0 :
    if s[i -1] == s[i] :
      flg = 0
if flg == 1 :
  print("Good")
else :
  print("Bad")
Buggy python submission (verdict: Runtime Error):
n, l = (int(i) for i in input().solit())
ans = 0
flg = 0
min = 1000
for i in range(n) :
  sum =  l + (i + 1) - 1
  if sum == 0 :
    flg = 1
  elif min > sum :
    min = sum
  ans += sum
if flg == 1 :
  print(ans)
else :
  print(ans - sum)

Fixed submission:
n, l = (int(i) for i in input().split())
ans = 0
flg = 0
temp = 1000
for i in range(n) :
  sum =  l + (i + 1) - 1
  if sum == 0 :
    flg = 1
  elif temp > abs(sum) :
    temp = abs(sum)
    min = sum
  ans += sum
if flg == 1 :
  print(ans)
else :
  print(ans - min)
Buggy python submission (verdict: Runtime Error):
p, q, r = (int(i) for i in input().split())
if p >= q & p >= r :
  max = p
if q >= p & q >= r :
  max = q
if r >= p & r >= q :
  max = r
print(p + q + r - max)

Fixed submission:
l = list(map(int, input().split()))
sum = 0
max = 0
for i in range(3) :
  sum += l[i]
  if max <= l[i] :
    max = l[i]
print(sum - max)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque
def input():
    return list(map(int, sys.stdin.readline().strip().split()))

n, m = input()
mem = [0 for _ in range(n + 1)] # n -> 1 거리
adj = [set() for _ in range(n + 1)]
q = []

for i in range(m):
    a, b = input()
    adj[b].append(a)
    adj[a].append(b)
    if b == 1: 
        q.append(a)
        mem[a] = 1
    if a == 1: 
        q.append(b)
        mem[b] = 1

visited = []
while q:
    v = q.pop(0)
    if v not in visited:
        visited.append(v)
        for node in adj[v]:
            if node not in visited:
                mem[node] = mem[v] + 1
                q.append(n)

if 0 in mem: print('No')
else: print('Yes', *mem[2:], sep='\n')



Fixed submission:
import collections

n,m=map(int,input().split())
g=[[] for _ in range(n+1)]
for _ in range(m):
 a,b=map(int,input().split())
 g[a].append(b)
 g[b].append(a)
q=collections.deque()
q.append(1)
check=[0]*(n+1)
check[1]=1
ans=[0]*(n+1)
while len(q)!=0:
 v=q.popleft()
 for u in g[v]:
   if check[u]==0:
     check[u]=1
     ans[u]=v
     q.append(u)
print('Yes')
for i in range(2,n+1):
 print(ans[i])
Buggy python submission (verdict: Runtime Error):
import sys
def input():
  return list(map(int, sys.stdin.readline().strip().split()))

n, m = input()
h = input()
tmp = [[] for i in range(n)]
for i in range(m):
  a, b = input()
  tmp[b - 1].append(a - 1)
  tmp[a - 1].append(b - 1)
ans = 0
for i in range(n):
  flag = True
  for ele in tmp[i]:
    if(h[i] <= h[ele]):
  		flag = False
  if(flag): ans += 1
print(ans)

Fixed submission:
import sys
def input():
  return list(map(int, sys.stdin.readline().strip().split()))

n, m = input()
h = input()
tmp = [[] for i in range(n)]
for i in range(m):
  a, b = input()
  tmp[b - 1].append(a - 1)
  tmp[a - 1].append(b - 1)
ans = 0
for i in range(n):
  flag = True
  for ele in tmp[i]:
    if(h[i] <= h[ele]): flag = False
  if(flag): ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
power5 = [(i ** 5) for i in range(100)]
for i in range(100):
  for j in range(100):
    if power[i] - power5[j] == x:
      print(i, j)
      exit()
for i in range(100):
  for j in range(100):
    if power5[i] + power5[j] == x:
      print(i, -j)
      exit()
for i in range(100):
  for j in range(100):
    if -power5[i] + power5[j] == x:
      print(-i, -j)
      exit()

Fixed submission:
x = int(input())
power5 = [(i ** 5) for i in range(1000)]
for i in range(1000):
  for j in range(1000):
    if power5[i] - power5[j] == x:
      print(i, j)
      exit()
for i in range(1000):
  for j in range(1000):
    if power5[i] + power5[j] == x:
      print(i, -j)
      exit()
for i in range(1000):
  for j in range(1000):
    if -power5[i] + power5[j] == x:
      print(-i, -j)
      exit()
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split())
print(max(n - sum(list(map(int, input().split()))), 0))

Fixed submission:
n, m = list(map(int, input().split()))
print(max(n - sum(list(map(int, input().split()))), -1))

Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split())
print(max(n - sum(list(map(int, input().split()), 0))

Fixed submission:
n, m = list(map(int, input().split()))
print(max(n - sum(list(map(int, input().split()))), -1))
Buggy python submission (verdict: Runtime Error):
s, w = int(input().split)

if w >= s:
  print('unsafe')
else:
  print('safe')


Fixed submission:
s, w = input().split()

if int(w) >= int(s):
  print('unsafe')
else:
  print('safe')

Buggy python submission (verdict: Runtime Error):
s, w = int(input().split)

if w <= s:
  print('unsafe')
else:
  print('safe')


Fixed submission:
s, w = input().split()

if int(w) >= int(s):
  print('unsafe')
else:
  print('safe')
Buggy python submission (verdict: Runtime Error):
r = int(input())
s = input()
 
if i < 2:
  return

i = int(r/2)
before = s[i:]
after = s[:i]
 
if before == after:
	print('Yes')
else:
  	print('No')

Fixed submission:
r = int(input())
s = input()
 
i = int(r/2)
before = s[i:]
after = s[:i]
 
if before == after:
	print('Yes')
else:
  	print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(x) for x in input().split()]

arr1 = {}
for i,x in enumerate(A):
	arr1[i+1] = x

arr2 = sorted(arr1.items(), key=lambda x:x[1])

ans = ''
for k,v in arr2:
	if v == 1:
		ans = str(k)
	else:
		ans = ans + ' ' + str(k)

print(ans)


Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]

arr1 = {}
for i,x in enumerate(A):
	arr1[i+1] = x

arr2 = sorted(arr1.items(), key=lambda x:x[1])

ans = ''
for k,v in arr2:
		print(k)
Buggy python submission (verdict: Runtime Error):
import sys

a = int(sys.argv[1])
b = int(sys.argv[2])

print(max(a+b, a-b, a*b))

Fixed submission:
a,b = map(int,input().split())
print(max(a+b,a-b,a*b))

Buggy python submission (verdict: Runtime Error):
a = sys.argv[0]
b = sys.argv[1]

print(max(a+b, a-b, a*b))

Fixed submission:
a,b = map(int,input().split())
print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

words = list(map(lambda word: input(), range(N)))

letter_lists = []
for word in words:
  letters = list(map(lambda word: word, word))
  letters.sort()
  letter_lists.append(letters)

count = 0
for i in range(N-1):
  for j in range(i+1,N):
    if letter_lists[i] == letter_lists[j]:
      count+=1 

print(count)

Fixed submission:
N = int(input())

d_word={}
count=0

for _ in range(N):
  word = "".join(sorted(input()))
  if word not in d_word:
    d_word[word]=0
  else:
    d_word[word]+=1
    count+=d_word[word]

print(count)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
list_A = [1]*N
for i in range(K):
    d = int(input())
    l = list(map(int, input().split()))
    for J range(d):
        if list_A[l[j]-1]  == 1:
            list_A[l[j]-1]  = 0

print(list_A.count(1))        
        
        

Fixed submission:
N, K = map(int, input().split())
list_A = [1]*N
for i in range(K):
    d = int(input())
    l = list(map(int, input().split()))
    for j in range(d):
        if list_A[l[j]-1]  == 1:
            list_A[l[j]-1]  = 0

print(list_A.count(1))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split()) 

ans = []
if M % 2 != 0:
    for i in range((M+1)//2):
        ans.append((1 + i,M - i))
        
    for j in range((M - 1)//2):
        ans.append((M + 1 + j, 2*M + 1 - j))
        
else:
    for i in range(M//2):
        ans.append((1 + i, M + 1 - i))
        ans.append((M + 2 + j, 2*M + 1 - j))
              
for i in range(M):
    print(*ans[i])

Fixed submission:
K = int(input()) 
A, B = map(int, input().split())
import math
n = math.floor(B / K) 
if n >= A / K:
    print('OK')
else:
    print('NG')

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split()) 
ans = []
if M % 2 != 0:
    for i in range((M+1)//2):
        ans.append((1 + i,M - i))
        
    for j in range((M - 1)//2):
        ans.append((M + 1 + j, 2*M + 1 - j))
else:
    for i in range(M//2):
        ans.append((1 + i, M + 1 - i))
        ans.append((M + 2 + j, 2*M + 1 - j))
              
for i in range(M):
    print(*ans[i])

Fixed submission:
K = int(input()) 
A, B = map(int, input().split())
import math
n = math.floor(B / K) 
if n >= A / K:
    print('OK')
else:
    print('NG')
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split()) 
ans = []
if M % 2 != 0:
    for i in range((M + 1)//2):
        ans.append((1 + i, M + 1 - i))
        
    for j in range((M - 1)//2):
        ans.append((M + 2 + j, 2*M + 1 - j))
else:
    for i in range(M//2):
        ans.append((1 + i, M + 1 - i))
        ans.append((M + 2 + j, 2*M + 1 - j))
              
for i in range(M):
    print(*ans[i])

Fixed submission:
N, M = map(int, input().split()) 
ans = []
if M % 2 != 0:
    for i in range((M + 1)//2):
        ans.append((1 + i, M + 1 - i))
        
    for j in range((M - 1)//2):
        ans.append((M + 2 + j, 2*M + 1 - j))
else:
    for i in range(M//2):
        ans.append((1 + i, M + 1 - i))
        ans.append((M + 2 + i, 2*M + 1 - i))
              
for i in range(M):
    print(*ans[i])

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split()) 

ans = []
if M % 2 != 0:
    for i in range((M+1)//2):
        ans.append((1 + i,M - i))
        
    for j in range((M - 1)//2):
        ans.append((M + 1 + j, 2*M + 1 - j))
else:
    for i in range(M//2):
        ans.append((1 + i, M + 1 - i))
        ans.append((M + 2 + j, 2*M + 1 - j))
              
for i in range(M):
    print(*ans[i])

Fixed submission:
N, M = map(int, input().split()) 
ans = []
if M % 2 != 0:
    for i in range((M + 1)//2):
        ans.append((1 + i, M + 1 - i))
        
    for j in range((M - 1)//2):
        ans.append((M + 2 + j, 2*M + 1 - j))
else:
    for i in range(M//2):
        ans.append((1 + i, M + 1 - i))
        ans.append((M + 2 + i, 2*M + 1 - i))
              
for i in range(M):
    print(*ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for i in range(N):
    item = input()
    if not item in S:
        S.append(item)
    else:
        continue
print(len(S))

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
print(len(set(S)))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
l = [0]*2019
l[0] = 1
n = 0
out = 0
for i in range(N-1, -1, -1):
    n += int(S[i]) * (10**(N-1 - i))
    r = n % 2019
    l[r] += 1
for m in l:
    out += (m*(m-1))//2 
print(out)

Fixed submission:
S = input()[::-1]
N = len(S)
l = [0]*2019
l[0] = 1
n = 0
d = 1

for i in range(N):
    n += int(S[i]) * d
    r = n % 2019
    l[r] += 1
    d = 10*d % 2019
    
out = 0    
for m in l:
    out += (m*(m-1))//2 
print(out)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
l = [0]*2019
n = 0
out = 0
for i in range(N-1, -1, -1):
    n += int(S[i]) * (10**(N-1 - i))
    r = n % 2019
    l[r] += 1
for i in range(2019):
    m = l[i]
    out += (m*(m-1))//2 
    if i == 0:
        out += m
print(out)

Fixed submission:
S = input()[::-1]
N = len(S)
l = [0]*2019
l[0] = 1
n = 0
d = 1

for i in range(N):
    n += int(S[i]) * d
    r = n % 2019
    l[r] += 1
    d = 10*d % 2019
    
out = 0    
for m in l:
    out += (m*(m-1))//2 
print(out)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
l = [0]*2019
n = 0
out = 0
for i in range(N-1, -1, -1):
    n += int(S[i]) * (10**(N-1 - i))
    r = n % 2019
    l[r] += 1
for i in range(2019):
    m = l[i]
    out += (m*(m-1))//2 
    if i == 0:
        out += m
print(out)

Fixed submission:
S = input()[::-1]
N = len(S)
l = [0]*2019
l[0] = 1
n = 0
d = 1

for i in range(N):
    n += int(S[i]) * d
    r = n % 2019
    l[r] += 1
    d = 10*d % 2019
    
out = 0    
for m in l:
    out += (m*(m-1))//2 
print(out)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
l = list()
n = 0
out = 0
for i in range(N-1, -1, -1):
    n += int(S[i]) * (10**(N-1 - i))
    r = n % 2019
    l.append(r)
for i in range(2019):
    m = l.count(i)
    out += (m*(m-1))//2 
    if i == 0:
        out += m
print(out)

Fixed submission:
S = input()[::-1]
N = len(S)
l = [0]*2019
l[0] = 1
n = 0
d = 1

for i in range(N):
    n += int(S[i]) * d
    r = n % 2019
    l[r] += 1
    d = 10*d % 2019
    
out = 0    
for m in l:
    out += (m*(m-1))//2 
print(out)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
count = 0
for i in range(N):
    for j in range(i,N):
        if int(S[i:j+1]) % 2019 == 0:
            count = count + 1
        else:
            continue
print(count)

Fixed submission:
S = input()[::-1]
N = len(S)
l = [0]*2019
l[0] = 1
n = 0
d = 1

for i in range(N):
    n += int(S[i]) * d
    r = n % 2019
    l[r] += 1
    d = 10*d % 2019
    
out = 0    
for m in l:
    out += (m*(m-1))//2 
print(out)

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
c
ount = 0
for i in range(N):
    for j in range(i,N):
        if int(S[i:j+1]) % 2019 == 0:
            count = count + 1
        else:
            continue
print(count)

Fixed submission:
S = input()[::-1]
N = len(S)
l = [0]*2019
l[0] = 1
n = 0
d = 1

for i in range(N):
    n += int(S[i]) * d
    r = n % 2019
    l[r] += 1
    d = 10*d % 2019
    
out = 0    
for m in l:
    out += (m*(m-1))//2 
print(out)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(M):
      N = N - A[i] 
if N >= 0:
    print(N)
else:
    print(-1)

Fixed submission:
print(int(input())*6.3)

Buggy python submission (verdict: Runtime Error):
import math
2*math.pi*R

Fixed submission:
print(int(input())*6.3)
Buggy python submission (verdict: Time Limit Exceeded):
N  = int(input()) 
l = list(map(int,input().split()))
for i in range(1,N+1):
    print(l.count(i))

Fixed submission:
N  = int(input()) 
l = list(map(int,input().split()))
a = list()
for i in range(N):
    a.append(0)
for i in range(len(l)):
    a[l[i]-1] = a[l[i]-1] + 1
for n in a:
    print(n)