Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, W = [int(i) for i in input().split()]
weight = [0]
value = [0]
for _ in range(N):
    temp1, temp2 = [int(i) for i in input().split()]
    weight.append(temp1)
    value.append(temp2)

dp = [[0] * (W + 1) for N in range(N + 1)]
#%%
for i in range(1, N + 1):
    for j in range(1, W + 1):
        if weight[i] <= j:
            dp[i][j] = max(value[i] + dp[i - 1][j - weight[i]] , dp[i - 1][j])
        else:
            dp[i][j] = dp[i - 1][j]

print(dp[N][W])


Fixed submission:
N, W = [int(i) for i in input().split()]
weight, value = [0] * (N + 1), [0] * (N + 1)
for i in range(1, N + 1):
    weight[i], value[i] = [int(i) for i in input().split()]
#%%
dp = [[0] * (W + 1) for _ in range(N + 1)]

#%%
for i in range(1, N + 1):
    for j in range(1, W + 1):
        if weight[i] <= j:
            dp[i][j] = max(value[i] + dp[i - 1][j - weight[i]], dp[i - 1][j])
        else:
            dp[i][j] = dp[i - 1][j]
print(int(dp[-1][-1]))

Buggy python submission (verdict: Runtime Error):
N, W = [int(i) for i in input().split()]
weight, value = [0] * (N + 1), [0] * (N + 1)
for i in range(1, N + 1):
    weight[i], value[i] = [int(i) for i in input().split()]
#%%
import  numpy as np
dp = np.zeros((N + 1, W + 1))

#%%
for i in range(1, N + 1):
    for j in range(1, W + 1):
        if weight[i] <= j:
            dp[i][j] = max(value[i] + dp[i - 1][j - weight[i]], dp[i - 1][j])
        else:
            dp[i][j] = dp[i - 1][j]
print(int(dp[-1][-1]))



Fixed submission:
N, W = [int(i) for i in input().split()]
weight, value = [0] * (N + 1), [0] * (N + 1)
for i in range(1, N + 1):
    weight[i], value[i] = [int(i) for i in input().split()]
#%%
dp = [[0] * (W + 1) for _ in range(N + 1)]

#%%
for i in range(1, N + 1):
    for j in range(1, W + 1):
        if weight[i] <= j:
            dp[i][j] = max(value[i] + dp[i - 1][j - weight[i]], dp[i - 1][j])
        else:
            dp[i][j] = dp[i - 1][j]
print(int(dp[-1][-1]))

Buggy python submission (verdict: Time Limit Exceeded):
#%%
N, W = [int(i) for i in input().split()]
weight, value = [0] * (N + 1), [0] * (N + 1)
for i in range(1, N + 1):
    weight[i], value[i] = [int(i) for i in input().split()]
#%%
import  numpy as np
dp = np.zeros((N + 1, W + 1))

#%%
for i in range(1, N + 1):
    for j in range(1, W + 1):
        if weight[i] <= j:
            dp[i][j] = max(value[i] + dp[i-1][j - weight[i]], dp[i - 1][j])
        else:
            dp[i][j] = dp[i - 1][j]
print(int(dp[-1][-1]))


Fixed submission:
N, W = [int(i) for i in input().split()]
weight, value = [0] * (N + 1), [0] * (N + 1)
for i in range(1, N + 1):
    weight[i], value[i] = [int(i) for i in input().split()]
#%%
dp = [[0] * (W + 1) for _ in range(N + 1)]

#%%
for i in range(1, N + 1):
    for j in range(1, W + 1):
        if weight[i] <= j:
            dp[i][j] = max(value[i] + dp[i - 1][j - weight[i]], dp[i - 1][j])
        else:
            dp[i][j] = dp[i - 1][j]
print(int(dp[-1][-1]))
Buggy python submission (verdict: Runtime Error):
N, W = [int(i) for i in input().split()]
value, weight = [0] * (N + 1), [0] * (N + 1)
for i in range(1, N + 1):
    value[i], weight[i] = [int(i) for i in input().split()]
sum_value = sum(value)
dp = [[float("inf")] * (sum_value + 1) for _ in range(N + 1)]
dp[0][0] = 0

#%%

for i in range(1, N + 1):
    for j in range(sum_value + 1):
        if j >= value[i]:
            dp[i][j] = min(dp[i][j], weight[i] + dp[i -1][j - value[i]])
        else:
            dp[i][j] = dp[i -1][j]
        
ans = 0
for i in range(sum_value + 1):
    if dp[N][i] == W:
        ans = i

print(ans)


Fixed submission:
N, W = [int(i) for i in input().split()]
weight, value = [0] * (N), [0] * (N)
for i in range(N):
    weight[i], value[i] = [int(i) for i in input().split()]

#%%

sum_value = sum(value)
dp = [[float("inf")] * (sum_value + 1) for _ in range(N + 1)]
dp[0][0] = 0

#%%

for i in range(N):
    for j in range(sum_value + 1):
        if j >= value[i]:
            dp[i + 1][j] = min(weight[i] + dp[i][j - value[i]], dp[i + 1][j])
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

#%%

ans = 0
for i in range(sum_value + 1):
    if dp[N][i] <= W:
        ans = i
        
print(ans)
Buggy python submission (verdict: Runtime Error):
a_sort =sorted(a)
cou = 0
for i in range(N):
    if x >= a_sort[i]:
        cou += 1
        x -= a_sort[i]
print(cou)

Fixed submission:
N, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a_sort =sorted(a)
cou = 0
for i in range(N):
    if x >= a_sort[i]:
        x -= a_sort[i]
        cou += 1
if x > 0 and cou == N:
    print(cou-1)
else:
    print(cou)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
m = [int(input(i)) for i in range(N)]
XX -= sum(m)
ans = N + XX // min(m)
print(ans)

Fixed submission:
n,x = map(int,input().split())
m = [int(input()) for _ in range(n)]
x -= sum(m)
ans = n + x//min(m)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]

from collections import Counter

cou_S = Counter(S)
cou_T = Counter(T)

ans = [0]
for key in cou_S:
    ans.append(cou_S[key] - cou_T.get(i, 0))
print(max(ans))

Fixed submission:
N = int(input())
s = [input() for _ in range(N)]
M = int(input())
t = [input() for _ in range(M)]

Max = 0
for i in set(s):
    C = 0
    C = s.count(i) - t.count(i)
    if Max < C:
        Max = C
print(Max)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [int(j) for j in str(N)]
if N % sum(L) == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
A, B = [int(i) for i in input().split()]
bag=[]
for i in range(A, B+1):
    aa = str(i)
    if aa ==aa[::-1] :
        bag.append(i)

print(len(bag))
Buggy python submission (verdict: Runtime Error):
A, B, C, X = [int(input()) for i in range(4)]
ans =0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50*k == X:
                ans += 1
                
print(ans

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
to = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50*k == X:
                to += 1
print(to)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
if (x + y) % == 0:
    print((x+y)/2)
else:
    print((x+y+1)/2)

Fixed submission:
a, b = map(int, input().split())
x = (a + b)
xx = -(-x // 2)
print(xx)

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
if (x + y) % == 0:
  print((x+y)/2)
else:
  print((x+y+1)/2)

Fixed submission:
a, b = map(int, input().split())
x = (a + b)
xx = -(-x // 2)
print(xx)

Buggy python submission (verdict: Runtime Error):
x,y = int(input().split())
if (x + y) % == 0:
  print((x+y)/2)
else:
  print((x+y+1)/2)

Fixed submission:
a, b = map(int, input().split())
x = (a + b)
xx = -(-x // 2)
print(xx)
Buggy python submission (verdict: Runtime Error):
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans
 
n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible, a))
 
print ans

Fixed submission:
N = int(input())
x =list(map(int, input().split()))

cou = []
for i in range(N):
    cc = 0
    while True:
        if x[i] % 2 == 0:
            x[i] /= 2
            cc+=1
        else:
            cou.append(cc) 
            break   
print(min(cou))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = list(set(B))
D ={}
bag = 0

for i in C:
    D[i] = 0
    for j in B:
        if i == j:
            D[i] += 1

LLL = sorted(list(D.values()))
AA = len(D) - K
if len(D) <= K:
    print(0)
else:
    for i in range(AA):
        bag += LLL[i]
    print(bag)

Fixed submission:
N, K = [int(i) for i in input().split()]
B = sorted([int(i) for i in input().split()])
D ={}
bag = 0

for i in B:
    if i in D:
        D[i] += 1
    else:
        D[i] = 1

LLL = sorted(list(D.values()))
AA = len(D) - K
if len(D) <= K:
    print(0)
else:
    for i in range(AA):
        bag += LLL[i]
    print(bag)

Buggy python submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = list(set(B))
D ={}
for i in C:
    D[i] = 0
    for j in B:
        if i == j:
            D[i] += 1
if len(D) <= K:
    print(0)
else:
    LLL = list(D.values())
    AA = len(D) - K
    bag = 0
    for i in range(-AA, 0):
    bag += LLL[i]
    print(bag)

Fixed submission:
N, K = [int(i) for i in input().split()]
B = sorted([int(i) for i in input().split()])
D ={}
bag = 0

for i in B:
    if i in D:
        D[i] += 1
    else:
        D[i] = 1

LLL = sorted(list(D.values()))
AA = len(D) - K
if len(D) <= K:
    print(0)
else:
    for i in range(AA):
        bag += LLL[i]
    print(bag)
Buggy python submission (verdict: Runtime Error):
N = int(inout)
L = [int(j) for j in str(N)]
if N % sum(L) == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
L = [int(j) for j in str(N)]
if N % sum(L) == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
S = set(input())
Alp = "abcdefghijklmnopqrstuvwxyz"
L = []
for i in Alp:
    if i not in S:
        L.append(i)
if L == S:
    print("None")
else:
    print(min(L))

Fixed submission:
S = set(input())
Alp = list("abcdefghijklmnopqrstuvwxyz")
MM = []
for i in Alp:
    if i not in S:
        MM.append(i)
if MM == []:
    print("None")
else:
    print(min(MM))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
s_sort = sorted(a, reverse=True)
score = 0
for i in range(1, 3N, 2):
    score += s_sort[i]
print(score)

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
s_sort = sorted(a, reverse=True)
score = 0
for i in range(1, 2*N, 2):
    score += s_sort[i]
print(score)
Buggy python submission (verdict: Runtime Error):
n = int(input())
 
a = []
b = []
 
 
for i in range(1, n):
    if n%i == 0:
        a.append(i)
        b.append(int(n/i))
 
a = list(map(str, a))
b = list(map(str, b))
 
 
result = []
for i in range(len(a)):
    result.append(max(len(a[i]), len(b[i])))
 
print(min(result))

Fixed submission:
N = int(input())

import math
N_sqrt = int(math.sqrt(N))

A = [i for i in range(1, N_sqrt+1) if N%i == 0]

print(len(str(N // A[-1])))
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
L = [list(map(int,input().split())) for _ in range(M)]
graph = [[False] * (N + 1) for _ in range(N + 1)]
#%%

for i in L:
    graph[i[0]][i[1]] = True
    graph[i[1]][i[0]] = True

graph[0][1] = True
graph[1][0] = True
#%%
ans = 0
for i in permutations(range(1, N + 1)):
    if i[0] != 1:
        continue
    for j in range(1, N):
        if not graph[i[j - 1]][i[j]]:
            break
    else:
       ans += 1 

print(ans)


Fixed submission:
from   itertools import   permutations

N,M = map(int, input().split())
L = [list(map(int,input().split())) for _ in range(M)]
graph = [[False] * (N + 1) for _ in range(N + 1)]
#%%

for i in L:
    graph[i[0]][i[1]] = True
    graph[i[1]][i[0]] = True

graph[0][1] = True
graph[1][0] = True
#%%
ans = 0
for i in permutations(range(1, N + 1)):
    if i[0] != 1:
        continue
    for j in range(1, N):
        if not graph[i[j - 1]][i[j]]:
            break
    else:
       ans += 1 

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(i) for i in input().split()]
AA = [1 for X in range(K+1) for Y in range(K+1) for Z in range(K+1) if X+Y+Z==S]
print(len(AA))

Fixed submission:
K, S =[int(i) for i in input().split()]
C = 0
for X in range(K+1):
    for Y in range(K+1):
        if X+Y <= S <= X+Y+K:
            C += 1
print(C)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(i) for i in input().split()]
AA = [1 for X in range(K+1) for Y in range(K+1) for Z in range(K+1) if X+Y+Z==S]
print(len(AA))

Fixed submission:
K, S =[int(i) for i in input().split()]
C = 0
for X in range(K+1):
    for Y in range(K+1):
        if X+Y <= S <= X+Y+K:
            C += 1
print(C)
Buggy python submission (verdict: Time Limit Exceeded):
# D

S = input()
Q = int(input())

#q = []
#for _ in range(Q):
#  q += [input().split(" ")]

hc = 0

for i in range(Q):
  #qi = q[i]
  qi = input().split(" ")
  if len(qi)==1:
    #S = S[::-1]
    if hc==0:
      hc = 1
    else:
      hc = 0
  else:
    fi = int(qi[1])
    ci = qi[2]
    if hc ==0:
      if fi==1:
        S = ci + S
      else:
        S = S + ci
    else:
      if fi==1:
        S = S + ci
      else:
        S = ci + S

if hc == 1:
  S = S[::-1]
print(S)

Fixed submission:
# D

from collections import deque
S = deque(input())
Q = int(input())

#q = []
#for _ in range(Q):
#  q += [input().split(" ")]

hc = 0

for i in range(Q):
  #qi = q[i]
  qi = input().split(" ")
  if len(qi)==1:
    #S = S[::-1]
    if hc==0:
      hc = 1
    else:
      hc = 0
  else:
    fi = int(qi[1])
    ci = qi[2]
    if hc ==0:
      if fi==1:
        S.appendleft(ci)
      else:
        S.append(ci)
    else:
      if fi==1:
        S.append(ci)
      else:
        S.appendleft(ci)

S = list(S)
if hc == 1:
  S = S[::-1]
print("".join(S))
Buggy python submission (verdict: Runtime Error):
#D

H = int(input())
c = 1
while H>1:
  H = math.floor(H/2)
  c += 1
print(sum([2**i for i in range(c)]))

Fixed submission:
#D
import math
H = int(input())
c = 1
while H>1:
  H = math.floor(H/2)
  c += 1
print(sum([2**i for i in range(c)]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
arr=list(map(int,input().split()))
prev=1
for i in range(k):
    prev*=arr[i]
ans=[]
for i in range(k,n):
    if(prev<prev*arr[i]/arr[i-k]):
        print('Yes')
    else:
        print('No')
    prev=prev*arr[i]/arr[i-k]
           
        

    

Fixed submission:
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
arr=list(map(int,input().split()))

for i in range(k,n):
    if(arr[i-k]<arr[i]):
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
A,B  = map(int, input().split())
print(int(A*B))

Fixed submission:
A,B = input().split()
A = int(A)
B = int(B.replace('.',''))
print(int(A*B//100))
Buggy python submission (verdict: Runtime Error):
N=input()
n=N%10
if n==3:
  print("bon")
elif n==0 or n==1 or n==6 or n==8:
  print("pon")
else:
  print("hon")
  


Fixed submission:
N=int(input())
n=N%10
if n==3:
  print("bon")
elif n==0 or n==1 or n==6 or n==8:
  print("pon")
else:
  print("hon")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for i in range(N):
  new = input()
  if not(new in S):
  	S.append(new)
print(len(S))

Fixed submission:
N = int(input())
S = {}
for i in range(N):
  new = input()
  if not(new in S):
    S[new]=1

print(len(S))
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    n,k=input().split()
    A=list(map(int,input().split()))
    n=int(n)
    k=int(k)
    M=[]
    a=[1]*(n+1)
    for i in range(len(A)):
        a[i+1]=A[i]*a[i]
    # print(a)
    for i in range(0,n-k+1):
        s=1
        # for j in range(i,i+k):
        #     s=s*A[j]
        s=a[i+k]//a[i]
        M.append(s)
    # print(M)      
    for i in range(1,len(M)):
        if M[i]>M[i-1]:
            print("Yes")
        else:
            print("No")

solve()

Fixed submission:
def solve():
    n,k=input().split()
    A=list(map(int,input().split()))
    n=int(n)
    k=int(k)
    for i in range(n-k):
        if A[i+k]>A[i]:
            print("Yes")
        else:
            print("No")

solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    n,k=input().split()
    A=list(map(int,input().split()))
    n=int(n)
    k=int(k)
    M=[]
    for i in range(0,n-k+1):
        s=1
        for j in range(i,i+k):
            s=s*A[j]
        M.append(s)
        # print(M)
    for i in range(1,len(M)):
        if M[i]>M[i-1]:
            print("Yes")
        else:
            print("No")

solve()

Fixed submission:
def solve():
    n,k=input().split()
    A=list(map(int,input().split()))
    n=int(n)
    k=int(k)
    for i in range(n-k):
        if A[i+k]>A[i]:
            print("Yes")
        else:
            print("No")

solve()

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
l=list(map(int,input().split()))
pr=1
t=[]
for i in range(len(l)):
    if i<k:
        pr*=l[i]
    else:
        pr1=pr
        pr1*=l[i]
        pr1//=l[i-k]
        if pr<pr1:
            print("Yes")
        else:
            print("No")

Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
pr=1
t=[]
for i in range(len(l)-k):
    if l[i]<l[i+k]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
print(1000-N%1000)

Fixed submission:
n=int(input())
if n%1000==0:
  print(0)
else:
  print(1000-n%1000)
Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
  l.append(input())
a=0
b=0
c=0
d=0
for i in l:
  if i=='AC':
    a+=1
  elif i=='WA':
    b+=1
  elif i=='TLE':
    c+=1
  else:
    d+=1
print('AC x',a)
print('WA x',b)
print('TLE x',c)
print('RE x',d)

Fixed submission:
n=int(input())
l=[]
for i in range(n):
  l.append(input())
a=0
b=0
c=0
d=0
for i in l:
  if i=='AC':
    a+=1
  elif i=='WA':
    b+=1
  elif i=='TLE':
    c+=1
  else:
    d+=1
print('AC x',a)
print('WA x',b)
print('TLE x',c)
print('RE x',d)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = ''
alf = ['a', 'b', 'c', 'd', 'e','f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ]
order = 0
def func(m):
    return 26 * (26**m-1) / 25
# print(func(12))
for i in range(11, 0, -1):
    if n > func(i):
        n = int(n-func(i)+0.5)
        order = i
        break
for i in range(order, 0, -1):
    m = int(n//(26**i) + 0.5)
    # print(n)
    # print(m)
    n %= 26**i
    ans += alf[m]
ans += alf[n-1]
print(ans)


Fixed submission:
n = int(input())
ans = ''
alf = ['a', 'b', 'c', 'd', 'e','f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ]
order = 0
def func(m):
    return int(26 * (26**m-1) / 25 + 0.5)
# print(func(12))
for i in range(11, 0, -1):
    if n > func(i):
        n = n-func(i)
        order = i
        break
for i in range(order, 0, -1):
    if n % 26**i == 0:
        m = n//(26**i) - 1
        n -= m * 26 ** i
        ans += alf[m]
    # print(n)
    # print(m)
    else:
        m = n // 26**i
        n %= 26**i
        ans += alf[m]
ans += alf[n-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
b = 0
while True:
    a = pow(x + b**5, 0.2)
    if a**5 == int(a**5):
        break
    if b == 0:
        b = 1
    elif b>0:
        b = -b
    else:
        b = -b + 1
print(int(a), b)

Fixed submission:
x = int(input())
flag = 0
for a in range(-150, 150):
    for b in range(-150, 150):
        if a**5 - b**5 == x:
            break
    else:
        continue
    break

print(a, b)
Buggy python submission (verdict: Runtime Error):
a, b, n = map(int, input().split())
f = max(n, b-1)

print((a*f)//b -a*(f//b))

Fixed submission:
k = int(input())
a, b = map(int, input().split())
flag = 0
for i in range(a, b+1):
    if i%k == 0:
        flag = 1
        break
if flag == 0:
    print('NG')
else:
    print('OK')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sequence = [input()]
if n!=1:
    for i in range(n-1):
        a = input()
        for sen in sequence:
            if a == sen:
                break
            else:
                if sen == sequence[-1]:
                    sequence.append(a)
print(len(sequence)) 

Fixed submission:
n = int(input())
sequence = [input() for _ in range(n)]

print(len(set(sequence)))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
l = len(s)
count = [0] * 2019
res = 0
count[res] = 1
for i in range(1, l+1):
    res += int(s[-i]) * 10 ** (i-1)
    res %= 2019
    count[res] += 1
print(int(sum([m*(m-1)/2 for m in count])))

Fixed submission:
s = input()
s = s[::-1]
l = len(s)
count = [0] * 2019
res = 0
count[res] = 1
d = 1
for i in s:
    res += int(i) * d
    res %= 2019
    count[res] += 1
    d *= 10
    d %= 2019
print(int(sum([m*(m-1)/2 for m in count])))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
l = len(s)
ans = 0
flag = 0
for i in range(3, l):
    for j in range(3, l):
        while (i - j >= 0 and i >= 3) and flag == 0:
            num = int(s[i-j:i+1])
            if num % 2019 == 0:
                ans += 1
                i -= j+1
            else:
                flag = 1
        flag = 0    
print(ans)

Fixed submission:
s = input()
s = s[::-1]
l = len(s)
count = [0] * 2019
res = 0
count[res] = 1
d = 1
for i in s:
    res += int(i) * d
    res %= 2019
    count[res] += 1
    d *= 10
    d %= 2019
print(int(sum([m*(m-1)/2 for m in count])))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
l = len(s)
ans = 0
for i in range(0, l-4):
    for j in range(i+3, l):
        num = int(s[i:j+1])
        if num%3 == 0:
            if num%673 == 0:
                ans += 1
print(ans)

Fixed submission:
s = input()
s = s[::-1]
l = len(s)
count = [0] * 2019
res = 0
count[res] = 1
d = 1
for i in s:
    res += int(i) * d
    res %= 2019
    count[res] += 1
    d *= 10
    d %= 2019
print(int(sum([m*(m-1)/2 for m in count])))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
l = len(s)
ans = 0
for i in range(0, l-4):
    for j in range(i+3, l):
        num = int(s[i:j+1])
        if num%2019 == 0:
            ans += 1
print(ans)

Fixed submission:
s = input()
s = s[::-1]
l = len(s)
count = [0] * 2019
res = 0
count[res] = 1
d = 1
for i in s:
    res += int(i) * d
    res %= 2019
    count[res] += 1
    d *= 10
    d %= 2019
print(int(sum([m*(m-1)/2 for m in count])))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(1, n + 1):
    count = a.count(i)
    del a[:count]
    print(count)



Fixed submission:
n = int(input())
a = list(map(int, input().split()))
lst = [0] * n
for i in a:
    lst[i-1] += 1
print(*lst)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(1, n + 1):
    count = a.count(i)
    print(count)



Fixed submission:
n = int(input())
a = list(map(int, input().split()))
lst = [0] * n
for i in a:
    lst[i-1] += 1
print(*lst)
Buggy python submission (verdict: Time Limit Exceeded):
number = int(input())
character = input()
count = 0
for i in range(number - 3):
    first_character = character[i]
    for j in range(i + 1, number -1):
        second_character = character[j]
        if first_character == second_character:
            continue
        for k in range(j + 1, number):
            if j  - i == k - j:
                continue
            third_character = character[k]
            if first_character == third_character or second_character == third_character:
                continue
            count += 1

print(count)

Fixed submission:
number = int(input())
character = input()
rnumber = character.count('R')
gnumber = character.count('G')
bnumber = character.count('B')
count = rnumber*gnumber*bnumber

for j in range(1, number):
    for i in range(j):
        k = j + (j - i)
        if k >= number:
            continue    
        if character[i] ==character[j]:
            continue
        if character[i] == character[k]:
            continue
        if character[j] == character[k]:
            continue
        count -= 1


print(count)