Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = str(input())
ans = 0

for i in range(N-2):
  for j in range(i+1,N-1):  
    for k in range(j+1,N):        
      if S[i] != S[j] and S[i] != S[k] and S[k] != S[j] and j-i != k-j :
          ans += 1
print(ans)

Fixed submission:
N = int(input())
S = str(input())
r = 0
g = 0
b = 0
#S[i],S[j],S[k]が違うものはr*g*b通り
for i in range(N):
  if S[i] == 'R':
    r += 1
  elif S[i] == 'G':
    g += 1
  else:
    b += 1
tot = r*g*b
#S[i],S[j],S[k]が違うかつj-i=k-jを満たすものは引く
minus = 0
for i in range(N-2):
  for j in range(i+1,N-1):
    if 2*j-i < N:
      
      if S[i] != S[j] and S[j] != S[2*j-i] and S[i] != S[2*j-i]:
        minus += 1
print(tot - minus)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = str(input())
ans = 0
for i in range(N):
  for j in range(N):
    if i < j:
      for k in range(N):
        if j < k:
          if S[i] != S[j] and S[i] != S[k] and S[k] != S[j] and j-i != k-j and i < j and j < k:
              ans += 1
print(ans)    

Fixed submission:
N = int(input())
S = str(input())
r = 0
g = 0
b = 0
#S[i],S[j],S[k]が違うものはr*g*b通り
for i in range(N):
  if S[i] == 'R':
    r += 1
  elif S[i] == 'G':
    g += 1
  else:
    b += 1
tot = r*g*b
#S[i],S[j],S[k]が違うかつj-i=k-jを満たすものは引く
minus = 0
for i in range(N-2):
  for j in range(i+1,N-1):
    if 2*j-i < N:
      
      if S[i] != S[j] and S[j] != S[2*j-i] and S[i] != S[2*j-i]:
        minus += 1
print(tot - minus)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = str(input())
ans = 0
for i in range(N):
  for j in range(N):
    for k in range(N):
      if S[i] != S[j] and S[i] != S[k] and S[k] != S[j] and j-i != k-j and i < j and j < k:
        ans += 1
print(ans)     

Fixed submission:
N = int(input())
S = str(input())
r = 0
g = 0
b = 0
#S[i],S[j],S[k]が違うものはr*g*b通り
for i in range(N):
  if S[i] == 'R':
    r += 1
  elif S[i] == 'G':
    g += 1
  else:
    b += 1
tot = r*g*b
#S[i],S[j],S[k]が違うかつj-i=k-jを満たすものは引く
minus = 0
for i in range(N-2):
  for j in range(i+1,N-1):
    if 2*j-i < N:
      
      if S[i] != S[j] and S[j] != S[2*j-i] and S[i] != S[2*j-i]:
        minus += 1
print(tot - minus)
Buggy python submission (verdict: Time Limit Exceeded):
K, N = map(int,input().split())
A = list(map(int, input().split()))
l = 0
L = []
for i in range(N-1):
  l = A[i+1] - A[i]
  L.append(l)
L.append(K-A[N-1]+A[0])
Ans = []
for j in range(len(L)):
  l = sum(L) - L[j]
  Ans.append(l)
print(min(Ans))


Fixed submission:
K, N = map(int,input().split())
A = list(map(int, input().split()))
l = 0
L = []
for i in range(N-1):
  l = A[i+1] - A[i]
  L.append(l)
L.append(K-A[N-1]+A[0])
print(sum(L)-max(L))
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int,input().split())
ans = 0
for i in range(10**100):
    if N > A+B:
        N -= (A+B)
        ans += A
    else:
        break
if N >= A:
    ans += A
    print(ans)
else :
    ans += N
    print(ans)

Fixed submission:
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int,input().split())
ans = 0
while N >= A+B:
    N -= (A+B)
    ans += A
if N >= A:
    ans += A
    print(ans)
else :
    ans += N
    print(ans)

Fixed submission:
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
s = []
c = []
for i in range(M):
    s1,c1=[int(i) for i in input().split()]
    s.append(s1)
    c.append(c1)

ans = [10 for i in range(N)]
x = ''

for j in range(M):
  if ans[s[j]-1] == 10:
     ans[s[j]-1] = c[j]
  elif ans[s[j]-1] != 10 and  ans[s[j]-1] != c[j]:
    print('-1')
    exit()
  
for k in range(N):
  if ans[k] == 10:
    ans[k] = 0
if N == 1:
  for l in range(N):
    x += str(ans[l])
  print(x)
  exit()
else:
  if ans[0] == 0 :
  print('-1')
  else :
  for l in range(N):
    x += str(ans[l])
  print(x)
   
  

Fixed submission:
N,M = map(int,input().split())
s = []
c = []
for i in range(M):
    s1,c1=[int(i) for i in input().split()]
    s.append(s1)
    c.append(c1)

ans = [10 for i in range(N)]
x = ''

for j in range(M):
  if ans[s[j]-1] == 10:
     ans[s[j]-1] = c[j]
  elif ans[s[j]-1] != 10 and  ans[s[j]-1] != c[j]:
    print('-1')
    exit()
  
for k in range(N):
  if k == 0 and ans[k] == 10 and N != 1:
    ans[k] = 1
  elif k == 0 and ans[k] == 10 and N == 1:
    ans[k] = 0
  elif ans[k] == 10:
     ans[k] = 0
if N == 1:
  print(ans[0])
  exit()
else:
  if ans[0] == 0 :
    print('-1')
  else :
    for l in range(N):
      x += str(ans[l])
    print(x)
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = [int(x) for x in input().split()]
hp = []
dis = 0
for i in range(min(X),max(X) + 1):
  hp.append(dis)
  dis = 0
  for j in X:
    dis += (i - j) ** 2
hp.remove(0)
print(min(hp))

Fixed submission:
N = int(input())
X = [int(x) for x in input().split()]
hp = []
dis = 0

for i in range(min(X), max(X) + 1):
  hp.append(dis)
  dis = 0
  for j in X:
    dis += (i - j) ** 2
if len(hp) == 1:
  print(0)
else:
  hp.remove(0)
  print(min(hp))

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = [int(x) for x in input().split()]
hp = []
dis = 0
for i in range(X[0],X[N-1] + 1):
  hp.append(dis)
  dis = 0
  for j in X:
    dis += (i - j) ** 2
hp.remove(0)
print(min(hp))

Fixed submission:
N = int(input())
X = [int(x) for x in input().split()]
hp = []
dis = 0

for i in range(min(X), max(X) + 1):
  hp.append(dis)
  dis = 0
  for j in X:
    dis += (i - j) ** 2
if len(hp) == 1:
  print(0)
else:
  hp.remove(0)
  print(min(hp))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for i in range(N):
  S.append(input())
T = list(set(S))
number = [] 
for i in range(len(T)):
  number.append(S.count(T[i]))
maxindex = [i for i, x in enumerate(number) if x == max(number)]
Ans = []
for i in range(len(maxindex)):
  Ans.append(T[maxindex[i]])
Ans.sort()
for i in Ans:
  print(i)

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
dictionary = {}
for word in S:
  if word in dictionary:
    dictionary[word] += 1 #辞書の中にその言葉があったら、keyを+1
  else:
    dictionary[word] = 1#無いなら、その言葉を登録して,keyを1にする
maximum = max(dictionary.values()) #辞書のkeyの最大値を返す
for key,value in sorted(dictionary.items()): #keyとvalueの両方に対してfor文
  if value == maximum:
    print(key)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = [int(h) for h in input().split()]

if len(H) <= K:
  print(0)
  exit()
  
for i in range(K):
  H.remove(max(H))
print(sum(H))

Fixed submission:
N, K = map(int, input().split())
H = [int(h) for h in input().split()]
H = list(sorted(H, reverse = True))

if len(H) <= K:
  print(0)
else:
  del H[0:K]
  print(sum(H))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [int(p) for p in input().split()]
ans = 0

for i in range(N):
  if P[i] == min(P[0:i+1]) :
    ans += 1

print(ans)

Fixed submission:
N = int(input())
P = [int(p) for p in input().split()]
ans = 0
mi = P[0]
for i in range(N):
  mi = min(mi, P[i])
  if mi >= P[i]:
    ans += 1 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [int(p) for p in input().split()]
out = 0

for i in range(N):
  for j in range(0, i):
    if P[i] > P[j]:
      out += 1
      break
print(N - out)

Fixed submission:
N = int(input())
P = [int(p) for p in input().split()]
ans = 0
mi = P[0]
for i in range(N):
  mi = min(mi, P[i])
  if mi >= P[i]:
    ans += 1 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
P = []
S = []
for _ in range(M):
  p,s = map(str,input().split())
  P.append(p)
  S.append(s)
ac = 0
wa = 0

for i in range(1,N+1):
  count_wa = 0
  for j in range(M):
    if int(P[j]) == i:
      if S[j] == 'WA':
        count_wa += 1
      else:
        wa += count_wa
        ac += 1
        break
print(ac,wa)

Fixed submission:
N,M = map(int,input().split())
P = []
S = []
for _ in range(M):
  p,s = map(str,input().split())
  P.append(int(p))
  S.append(s)
ac = ['WA']*N
wa = [0]*N

for i in range(M):
  if S[i] == 'WA':
    if ac[P[i]-1] == 'WA':
      wa[P[i]-1] += 1
  else:
    ac[P[i]-1] = 'AC'
for j in range(N):
  if ac[j] == 'WA':
    wa[j] = 0
print(ac.count('AC'),sum(wa))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
p = []
S = []
for i in range(M):
    p1,S1=[i for i in input().split()]
    p.append(p1)
    S.append(S1)
a = 0
b = 0
c = 0

for j in range(N):
    for k in range(M):
        if int(p[k]) == j+1:
            if S[k] == 'WA':
                b += 1
            elif S[k] == 'AC':
                a += 1
                c = b
                break
print(a,c)

Fixed submission:
N,M = map(int,input().split())
P = []
S = []
for _ in range(M):
  p,s = map(str,input().split())
  P.append(int(p))
  S.append(s)
ac = ['WA']*N
wa = [0]*N

for i in range(M):
  if S[i] == 'WA':
    if ac[P[i]-1] == 'WA':
      wa[P[i]-1] += 1
  else:
    ac[P[i]-1] = 'AC'
for j in range(N):
  if ac[j] == 'WA':
    wa[j] = 0
print(ac.count('AC'),sum(wa))
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int,input().split())

for i in range(K):
    if A !=0:
        A = A-1
    else:
        B = B-1

print(A,B)

Fixed submission:
A,B,K = map(int,input().split())

if A+B <= K:
    print(0,0)
elif A-K<=0:
    B = B-(K-A)
    A = 0
    print(A,B)
else:
    A = A-K
    print(A,B)
Buggy python submission (verdict: Runtime Error):
 = int(input())
S,T = map(str,input().split())
ans = ''
for i in range(N):
    ans = ans+S[i]+T[i]
print(ans)

Fixed submission:
N = int(input())
S,T = map(str,input().split())
ans = ''
for i in range(N):
    ans = ans+S[i]+T[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(A * B // math.gcd(A, B))


Fixed submission:
import fractions
A, B = map(int, input().split())
print(A * B // fractions.gcd(A, B))

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

import math 

print(A * B // math.gcd(A, B))

Fixed submission:
import fractions
A, B = map(int, input().split())
print(A * B // fractions.gcd(A, B))
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = []
for a in range(1, int(N ** (1/2))):
  if N % a == 0:
    ans.append(a + N // a - 2)
print(min(ans)) 

Fixed submission:
N = int(input())

i = int(N ** (1/2))
ans = 10 **13

while i > 0:
  if N % i == 0:
    ans = min(ans, i + N // i -2)
  i -= 1


print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input().split())
cartain = B*2

if A<=cartain :
    input(0)
else :
    input(A-cartain)




Fixed submission:
A, B = map(int,input().split())
cartain = B*2

if A<=cartain :
    print(0)
else :
    print(A-cartain)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(a) for a in input().split()]
ans = []
for i in range(1, N+1):
  print(A.index(i) + 1, end = " ")


Fixed submission:
N = int(input())
A = [int(a) for a in input().split()]
ans = [0] * N
for i in range(N):
  ans[A[i] - 1] = i + 1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(a) for a in input().split()]
ans = []
for i in range(1, N+1):
  ans.append(A.index(i) + 1)
for i in range(N):
  print(ans[i], end = " ")

Fixed submission:
N = int(input())
A = [int(a) for a in input().split()]
ans = [0] * N
for i in range(N):
  ans[A[i] - 1] = i + 1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(a) for a in input().split()]
ans = []
for i in range(N):
  ans.append(A.index(max(A)) + 1)
  A[A.index(max(A))] = 0
ans.reverse()
for i in range(N):
  print(ans[i], end = " ")

Fixed submission:
N = int(input())
A = [int(a) for a in input().split()]
ans = [0] * N
for i in range(N):
  ans[A[i] - 1] = i + 1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(a) for a in input().split()]
ans = []
for i in range(N):
  ans.append(A.index(min(A)) + 1)
  A[A.index(min(A))] = N + 1
for i in range(N):
  print(ans[i], end = " ")


Fixed submission:
N = int(input())
A = [int(a) for a in input().split()]
ans = [0] * N
for i in range(N):
  ans[A[i] - 1] = i + 1
print(*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):
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):
A,P = map(int,input().split())
print((A*3+B)//2)



Fixed submission:
A,P = map(int,input().split())
print((A*3+P)//2)
Buggy python submission (verdict: Runtime Error):
import numpy as np
K, X = map(int, input().split())

if min(-1000000, X-(K-1)) != X-(K-1) and max(1000000, X+(K-1)) != X+(K-1):
    left = X-(K-1)
    right = X+(K-1)
elif min(-1000000, X-(K-1)) == X-(K-1):
    left = -1000000
    right = X+(K-1)
elif max(1000000, X+(K-1)) == X+(K-1):
    left = X-(K-1)
    right = 1000000
else:
    left = -1000000
    right = 1000000

ans = list(map(str,range(left,right+1)))
print(' '.join(ans))


Fixed submission:
K, X = map(int, input().split())

left = X-(K-1)
right = X+(K-1)
ans = list(map(str,range(left,right+1)))
print(' '.join(ans))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())

word_list = []
for i in range(N):
    S = list(input())
    words, count = np.unique(S, return_counts=True)
    word_list.append(''.join(words)+str(count))

S, ans_count = np.unique(word_list, return_counts=True)
temp = ans_count[ans_count>1]
ans = int(sum([t*(t-1)/2 for t in temp]))
print(ans)


Fixed submission:
import collections

N = int(input())

word_list = []
for i in range(N):
    S = list(input())
    c = collections.Counter(sorted(S))
    count = c.values()
    words = c.keys()
    word_list.append(''.join(words)+str(count))

ans_dict = collections.Counter(word_list)
ans_count = list(ans_dict.values())
temp = [i for i in ans_count if i>1]
ans = int(sum([t*(t-1)/2 for t in temp]))
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())

word_list = []
for i in range(N):
    S = list(input())
    words, count = np.unique(S, return_counts=True)
    word_list.append(''.join(words)+str(count))

S, ans_count = np.unique(word_list, return_counts=True)
temp = ans_count[ans_count>1]
ans = int(sum([t*(t-1)/2 for t in temp]))
print(ans)

Fixed submission:
import collections

N = int(input())

word_list = []
for i in range(N):
    S = list(input())
    c = collections.Counter(sorted(S))
    count = c.values()
    words = c.keys()
    word_list.append(''.join(words)+str(count))

ans_dict = collections.Counter(word_list)
ans_count = list(ans_dict.values())
temp = [i for i in ans_count if i>1]
ans = int(sum([t*(t-1)/2 for t in temp]))
print(ans)
Buggy python submission (verdict: Runtime Error):
S = list(input())
acgt = ['A', 'C', 'G', 'T']

wlist=[]
answer=[]
for word in S:
    if word in acgt:
        wlist.append(word)
    else:
        print(wlist)
        answer.append(len(wlist))
        wlist=[]

print(max(answer))

Fixed submission:
S = list(input())
acgt = ['A', 'C', 'G', 'T']

c=0
ans=0
for word in S:
    c = c+1 if word in acgt else 0
    ans = max(ans, c)
print(ans)

Buggy python submission (verdict: Runtime Error):
S = list(input())
acgt = ['A', 'C', 'G', 'T']

list=[]
answer=[]
for word in S:
    if word in acgt:
        list.append(word)
    else:
        answer.append(len(list))
        list=[]

print(max(answer))

Fixed submission:
S = list(input())
acgt = ['A', 'C', 'G', 'T']

c=0
ans=0
for word in S:
    c = c+1 if word in acgt else 0
    ans = max(ans, c)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import re

N, Q = map(int, input().split())
S = list(input())

for i in range(Q):
    l, r = map(int, input().split())
    s = ''.join(S[l-1:r])
    m = len(re.findall('AC', s))
    print(m)

Fixed submission:
import numpy as np

N, Q = map(int, input().split())
S = input()
t = np.zeros(N+1)
for i in range(N):
    t[i+1] = t[i]+(1 if S[i-1:i+1]=='AC' else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(int(t[r]-t[l]))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

A_list=[]
B_list=[]
for i in range(N):
    A, B = map(int,input().split())
    A_list.append(A)
    B_list.append(B)

cost = 0
total_num = 0
num = 0
while True:
    index = A_list.index(min(A_list))
    num = B_list[index]
    if M > num:
        total_num += num
        cost += min(A_list)*num
        A_list.pop(index)
        B_list.pop(index)
        M -= num
    else:
        cost += min(A_list)*M
        break

print(cost)

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

AB_list=[]

for i in range(N):
    A, B = map(int,input().split())
    AB_list.append([A, B])

AB_list = sorted(AB_list)
cost = 0
num = 0
for AB in AB_list:
    num = AB[1]
    if M > num:
        cost += AB[0]*num
        M -= num
    else:
        cost += AB[0]*M
        break

print(cost)
Buggy python submission (verdict: Runtime Error):
n = input()
mod = 10**9 + 7
ans = (pow(10, n, mod) - ((2 * pow(9, n, mod)) % mod - pow(8, n, mod) + mod) % mod + mod) % mod
print(ans)

Fixed submission:
n = int(input())
mod = 10**9 + 7
ans = (pow(10, n, mod) - ((2 * pow(9, n, mod)) % mod - pow(8, n, mod) + mod) % mod + mod) % mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

modular=10**9+7
sum=0
for i in range(N):
  for j in range(i+1,N):
    #print(A[i]*A[j])
    sum+=(A[i]*A[j])%modular
    
print(sum%modular)

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

modular=10**9+7
sum=0

AllSum=0
for i in range(N):
  AllSum+=A[i]
  AllSum=AllSum%modular

  
RuisekiWa=[]
NextSum=AllSum

for i in range(N):
  RuisekiWa.append((NextSum-A[i])%modular)
  NextSum=RuisekiWa[i]

#print(RuisekiWa)
for i in range(N):
  sum+=(A[i]*RuisekiWa[i])%modular
  sum=(sum%modular)
    
print(sum%modular)
Buggy python submission (verdict: Time Limit Exceeded):
#from numba import jit

N=int(input())
A = list(map(int,input().split()))	


Money=1000
Kabu=0

#@jit
def MoneyWar(Money,Kabu,A,N):
  for i in range(N-1):
    if A[i]<A[i+1]:
      while True:
        if Money-A[i]>=0:
          Money-=A[i]
          Kabu+=1
        else:
          break
    if A[i]>A[i+1]:
      while True:
        if Kabu>0:
          Money+=A[i]
          Kabu-=1
        else:
          break

  if Kabu>0:
    Money+=Kabu*A[-1]
    
  return Money

print(MoneyWar(Money,Kabu,A,N))


Fixed submission:
import math

N=int(input())
A = list(map(int,input().split()))	

Money=1000
Kabu=0

def MoneyWar(Money,Kabu,A,N):
  for i in range(N-1):
    if A[i]<A[i+1]:
      Kounyu=math.floor(Money/A[i])
      Money-=A[i]*Kounyu
      Kabu+=Kounyu

    if A[i]>A[i+1]:
      Money+=Kabu*A[i]
      Kabu=0

      
  if Kabu>0:
    Money+=Kabu*A[-1]
    
  return Money

print(MoneyWar(Money,Kabu,A,N))

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


Money=1000
Kabu=0

for i in range(N-1):
  if A[i]<A[i+1]:
    while True:
      if Money-A[i]>=0:
        Money-=A[i]
        Kabu+=1
      else:
        break
  if A[i]>A[i+1]:
    while True:
      if Kabu>0:
        Money+=A[i]
        Kabu-=1
      else:
        break

if Kabu>0:
  Money+=Kabu*A[-1]

print(Money)

Fixed submission:
import math

N=int(input())
A = list(map(int,input().split()))	

Money=1000
Kabu=0

def MoneyWar(Money,Kabu,A,N):
  for i in range(N-1):
    if A[i]<A[i+1]:
      Kounyu=math.floor(Money/A[i])
      Money-=A[i]*Kounyu
      Kabu+=Kounyu

    if A[i]>A[i+1]:
      Money+=Kabu*A[i]
      Kabu=0

      
  if Kabu>0:
    Money+=Kabu*A[-1]
    
  return Money

print(MoneyWar(Money,Kabu,A,N))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

D = int(input())
c = [list(map(int,input().split()))]
s = [list(map(int,input().split())) for i in range(D)]

#testcase=[1,17,13,14,13]
testcase=np.ones(D, dtype='int64')
goodChoise=np.ones(D, dtype='int64')

c=np.array(c, dtype='int64')
s=np.array(s, dtype='int64')
lastday=np.zeros(26, dtype='int64')

day=0

def manzokuCounter(D,c,s,testcase):

  manzoku=0
  for day in range(D):
    Plus=s[day,testcase[day]-1]

    lastday[testcase[day]-1] = day+1

    today=(day+1)*np.ones(26)
    LessDayArray=(today-lastday)*c
    Minus=np.sum(LessDayArray)

    manzoku+=Plus-Minus
  return int(manzoku)

manzoku=0

for i in range(D):
  for j in range(26):
    testcase[i]=j+1
    CaseManzoku=manzokuCounter(D,c,s,testcase)
    if CaseManzoku > manzoku:
      goodChoise[i]=j+1
      manzoku=CaseManzoku
    
#print(goodChoise)
#print(manzoku)
for c in goodChoise:
  print(c)

Fixed submission:
import random
D = int(input())
c = [list(map(int,input().split()))]
s = [list(map(int,input().split())) for i in range(D)]

for i in range(D):
  print(random.randint(1,26))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

D = int(input())
c = [list(map(int,input().split()))]
s = [list(map(int,input().split())) for i in range(D)]

#testcase=[1,17,13,14,13]
testcase=np.ones(D, dtype='int64')
goodChoise=np.ones(D, dtype='int64')

c=np.array(c, dtype='int64')
s=np.array(s, dtype='int64')
lastday=np.zeros(26, dtype='int64')

day=0

def manzokuCounter(D,c,s,testcase):

  manzoku=0
  for day in range(D):
    Plus=s[day,testcase[day]-1]

    lastday[testcase[day]-1] = day+1

    today=(day+1)*np.ones(26)
    LessDayArray=(today-lastday)*c
    Minus=np.sum(LessDayArray)

    manzoku+=Plus-Minus
  return int(manzoku)

manzoku=0

for k in range(60):
  for i in range(D):
    for j in range(26):
      testcase[i]=j+1
      CaseManzoku=manzokuCounter(D,c,s,testcase)
      if CaseManzoku > manzoku:
          goodChoise[i]=j+1
          manzoku=CaseManzoku
    
#print(goodChoise)
#print(manzoku)
for c in goodChoise:
  print(c)

Fixed submission:
import random
D = int(input())
c = [list(map(int,input().split()))]
s = [list(map(int,input().split())) for i in range(D)]

for i in range(D):
  print(random.randint(1,26))
Buggy python submission (verdict: Runtime Error):
N, K = input().split()
P = list(map(int,input().split()))

P.sort()
 
total=0

for i in range(int(K)+1):
  total=total+P[i]
 
print(total)

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

P.sort()
 
total=0

for i in range(int(K)):
    total=total+P[i]
 
print(total)

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

# N=5
# K=2
# P=[10, 20, 40, 2, 6]

P.sort()
 
total=0

for i in range(int(K)+1):
  total=total+P[i]
 
print(total)

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

P.sort()
 
total=0

for i in range(int(K)):
    total=total+P[i]
 
print(total)

Buggy python submission (verdict: Runtime Error):
N, K = input().split()
P = list(map(int,input().split()))
 
P.sort()
 
total=0
for i in range(K+1):
  total=total+P[i]
 
print(total)

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

P.sort()
 
total=0

for i in range(int(K)):
    total=total+P[i]
 
print(total)

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

P.sort()

total=0
for i in range(K):
  total=total+P[i]
 
print(total)



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

P.sort()
 
total=0

for i in range(int(K)):
    total=total+P[i]
 
print(total)