Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
q = []
for i in range(N):
  if A[i] in q:
    q.remove(A[i])
  else:
    q.append(A[i])
print(len(q))


Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
c = 1
ans = 0
for i in range(N-1):
  if A[i] == A[i+1]:
    c += 1
  else:
    if c % 2 == 1:
      ans += 1
    c = 1
if c % 2 == 1:
  ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
q = []
for i in range(N):
  if A[i] in q:
    q.remove(A[i])
  else:
    q.append(A[i])
print(len(q))


Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
c = 1
ans = 0
for i in range(N-1):
  if A[i] == A[i+1]:
    c += 1
  else:
    if c % 2 == 1:
      ans += 1
    c = 1
if c % 2 == 1:
  ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]

S = []
E = []

for i in range(M):
  if ab[i][0] == 1:
    S.append(ab[i][1])
  if ab[i][1] == N:
    E.append(ab[i][0])

#print(S)
#print(E)

flag = False
for s in S:
  if s in E:
    flag = True
    break

if flag:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')


Fixed submission:
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]

S = []
E = []

for i in range(M):
  if ab[i][0] == 1:
    S.append(ab[i][1])
  if ab[i][1] == N:
    E.append(ab[i][0])

if set(S) & set(E):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(input().split())
b = []
for i in range(n):
  if i % 2 == 0:
    b.append(a[i])
  else:
    b.insert(0, a[i])
if n % 2 == 1:
  b.reverse()

print(" ".join(b))


Fixed submission:
n = int(input())
a = list(input().split())
b = []

if n % 2 == 0:
  for i in range(n//2):
    b.append(a[n-1-i*2])
  for i in range(n//2):
    b.append(a[i*2])
else:
  for i in range(n//2+1):
    b.append(a[n-i*2-1])
  for i in range(n//2):
    b.append(a[i*2+1])

print(" ".join(b))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
  b.append(str(a[i]))
  b.reverse()
print(" ".join(b))


Fixed submission:
n = int(input())
a = list(input().split())
b = []

if n % 2 == 0:
  for i in range(n//2):
    b.append(a[n-1-i*2])
  for i in range(n//2):
    b.append(a[i*2])
else:
  for i in range(n//2+1):
    b.append(a[n-i*2-1])
  for i in range(n//2):
    b.append(a[i*2+1])

print(" ".join(b))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p = 1
for i in range(N):
  p *= i+1
print(p % (pow(10, 9) + 7))


Fixed submission:
N = int(input())
p = 1
for i in range(N):
  p *= i+1
  p = p % (pow(10, 9) + 7)
print(p)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
while True:
  l = len(s)
  s = s.replace('ST', '', 1)
  if l == len(s):
    break
print(len(s))


Fixed submission:
s = input()
S = 0
T = 0
for i in range(len(s)):
  if s[i] == 'S':
    S += 1
  else:
    if S > 0:
      S -= 1
    else:
      T += 1
print(T * 2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
while True:
  l = len(s)
  s = s.replace('ST', '')
  if l == len(s):
    break
print(len(s))


Fixed submission:
s = input()
S = 0
T = 0
for i in range(len(s)):
  if s[i] == 'S':
    S += 1
  else:
    if S > 0:
      S -= 1
    else:
      T += 1
print(T * 2)
Buggy python submission (verdict: Runtime Error):
L, N = map(int, input().split())
S = [input() for _ in range(N)]
S.sort()
print("".join(S))


Fixed submission:
N, L = map(int, input().split())
S = [input() for _ in range(N)]
S.sort()
print("".join(S))
Buggy python submission (verdict: Runtime Error):

num1 = int(input())
num2 = int(input())

if num1 >= 2*num2:
    print(num1 - 2*num2)
else:
    print(0)

Fixed submission:
num1,num2 = map(int,input().split())
if num1 >= 2*num2:
    print(num1 - 2*num2)
else:
    print('0')

Buggy python submission (verdict: Runtime Error):

num1 = int(input())
num2 = int(input())

if num1 >= 2*num2:
    print(num1 - 2*num2)
else:
    print('0')

Fixed submission:
num1,num2 = map(int,input().split())
if num1 >= 2*num2:
    print(num1 - 2*num2)
else:
    print('0')
Buggy python submission (verdict: Runtime Error):
from typing import *
import math
import collections, itertools, functools, heapq, bisect

def main():
    S, T = input().split()
    A, B = [int(x) for x in input().split()]
    U = input().strip()
    
    if U == S:
        A -= 1
    elif U == T:
        B -= 1
    print(' '.join([str(x) for x in [A, B]]))


if __name__ == '__main__':
    main()


Fixed submission:
import sys

S, T = sys.stdin.readline().split()
A, B = [int(x) for x in sys.stdin.readline().split()]
U = sys.stdin.readline().strip()

if U == S:
    A -= 1
elif U == T:
    B -= 1
print(' '.join([str(x) for x in [A, B]]))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
i=0
c="YES"   ##ここ文字列だからくおーてーしょんいるの注意
for i in range(a-1):
 j=i+1
 for j in range (a-1):
    if b[i]==b[j]:
    c="NO" ##ここも
print(c)

Fixed submission:
a,b=input().split()
A,B=map(int,input().split())
c=input()
if a==c:
  A=A-1
else:
  B=B-1
print(A,B)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
i=0
j=0
c="YES"  ##ここ文字列だからくおーてーしょんいるの注意
for i in range(a-1):
  for j in range (a-1):
    if b[i]==b[j]
    c="NO" 
print(c)

Fixed submission:
a,b=input().split()
A,B=map(int,input().split())
c=input()
if a==c:
  A=A-1
else:
  B=B-1
print(A,B)
Buggy python submission (verdict: Runtime Error):
a=input()
A=len(a)
b=x
for i in A-1:
  b=b+'x'
print(b)

Fixed submission:
a=input()
A=len(a)
b="x"
for i in range(A-1):
  b=b+"x"
print(b)
Buggy python submission (verdict: Runtime Error):
a=int(input())
if a==2:
  print(a)
else:
  sosuu=1
  a=a-1
  while sosuu==1:
    a+=1
    b=2
    while a!=b:
      sosuu=0
      if a%b==0:
        sosuu=1//割り切れた
        break
      else:
        b+=1
  print(a)

Fixed submission:
a=int(input())
if a==2:
  print(a)
else:
  sosuu=1
  a=a-1
  while sosuu==1:
    a+=1
    b=2
    while a!=b:
      if a%b==0:
        sosuu=1
        break
      else:
        b+=1
        sosuu=0
  print(a)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,K = map(int,input().split())
P = list(map(int,input().split()))
total = 0
for i in range(N-K+1):
  A = P[i:i+K]
  total = sum(A)
  if total>0:
    B = A
np.array(B)
C = (B+np.array([1]))/np.array([2])
print(sum(C))


Fixed submission:
S, T = input().split()
A,B = map(int,input().split())
U = input()
if U == S:
  A -= 1
  print(A,B)
else:
  B -= 1
  print(A,B)
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
num = 0
for i in range(K+1):
  for j in range(K+1) :
    for k in range(K+1):
      total = i +j + k
      if total == S :
        num += 1
print(num)


Fixed submission:
K,S = map(int,input().split())
num = 0
for i in range(K+1):
  for j in range(K+1) :
    k = S - i - j
    if k >= 0 and k <= K :
      num += 1
print(num)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
num = 0
for i in range(K+1):
  for j in range(K+1) :
    for k in range(K+1):
      total = i +j + k
      if total == S :
        num += 1
print(num)


Fixed submission:
K,S = map(int,input().split())
num = 0
for i in range(K+1):
  for j in range(K+1) :
    k = S - i - j
    if k >= 0 and k <= K :
      num += 1
print(num)
Buggy python submission (verdict: Runtime Error):
S = input()
n = len(S)
total = 0
for i in range(2**(n-1)) :
  ls = [""] * (n-1)
  
  for j in range(n) :
    if ((i >> j) & 1) :
      ls[j] = "+"
  for k in range(n) :
    if k==0 :
      fo = S[k] + ls[k]
    elif k==n-1 :
      fo = fo + S[k]
    else :
      fo = fo + S[k] + ls[k]  
  total += eval(fo)
print(total)

Fixed submission:
S = input()
n = len(S)
total = 0
for i in range(2**(n-1)) :
  fo = ''
  fo = S[0]
  for j in range(n-1) :
    if ((i >> j) & 1) :
      fo += '+' 
    fo += S[j+1]
  total += sum(map(int,fo.split('+')))
print(total)
Buggy python submission (verdict: Runtime Error):
import numpy

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

K = A[1]
N = A[0]

P = list(map(float, input().split()))

EP = list(map(lambda x: (1+x)/2, P))

cumEP = list(numpy.cumsum(EP))

new_list = []
for val in range(N-K):
    new_list.append(cumEP[val+K]-cumEP[val])

print(max(new_list))


Fixed submission:
import numpy

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

K = A[1]
N = A[0]

P = list(map(float, input().split()))

EP = list(map(lambda x: (1+x)/2, P))

cumEP = list(numpy.cumsum(EP))

new_list = []

if N>K:
    for val in range(N-K):
        new_list.append(cumEP[val+K]-cumEP[val])
    print(max(new_list))
else:
    print(sum(EP))

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

K = A[1]
N = A[0]

P = list(map(float, input().split()))

new_list = []

for val in range(N-K+1):
    P_list=P[val:val+K]
    new_list.append(sum(list(map(lambda x: (1+x) / 2, P_list))))

print(max(new_list))


Fixed submission:
import numpy

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

K = A[1]
N = A[0]

P = list(map(float, input().split()))

EP = list(map(lambda x: (1+x)/2, P))

cumEP = list(numpy.cumsum(EP))

new_list = []

if N>K:
    for val in range(N-K):
        new_list.append(cumEP[val+K]-cumEP[val])
    print(max(new_list))
else:
    print(sum(EP))

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

K = A[1]
N = A[0]

P = list(map(float, input().split()))
P_list = P[N-K:N]

new_list = []

for val in range(N-K):
    P_list=P[val:val+K]
    new_list.append(sum(list(map(lambda x: (1+x) / 2, P_list))))

print(max(new_list))


Fixed submission:
import numpy

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

K = A[1]
N = A[0]

P = list(map(float, input().split()))

EP = list(map(lambda x: (1+x)/2, P))

cumEP = list(numpy.cumsum(EP))

new_list = []

if N>K:
    for val in range(N-K):
        new_list.append(cumEP[val+K]-cumEP[val])
    print(max(new_list))
else:
    print(sum(EP))
Buggy python submission (verdict: Runtime Error):
HN=input()
HN_list=HN.split()
H=int(HN_list[0])
N=int(HN_list[1])
A=input()
A_list=A.split()
aaa=map(int, A_list)
A_sum=sum(aaa)
if A_sum>H:
    print("Yes")
else:
    print("No")

Fixed submission:
import math
str = input()
str_list=str.split()
H=int(str_list[0])
A=int(str_list[1])
Q=math.ceil(H/A)
print(Q)

Buggy python submission (verdict: Runtime Error):
import math
H=int(input())
A=int(input())
Q=math.ceil(H/A)
print(Q)

Fixed submission:
import math
str = input()
str_list=str.split()
H=int(str_list[0])
A=int(str_list[1])
Q=math.ceil(H/A)
print(Q)

Buggy python submission (verdict: Runtime Error):
import sys
import math
input_list=sys.argv[0:]
H=int(input_list[1])
A=int(input_list[2])
Q=math.ceil(H/A)
print(Q)

Fixed submission:
import math
str = input()
str_list=str.split()
H=int(str_list[0])
A=int(str_list[1])
Q=math.ceil(H/A)
print(Q)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))

total_expects = []
# 1回のサイコロについて
for i in range(0, n):    
    # 1個のサイコロの期待値リスト
    expect = [q * (1 / p[i]) for q in range(1, p[i]+1)]
    total_expects.append(sum(expect))

print(max([sum(total_expects[i:i+k]) for i in range(0, k)]))

Fixed submission:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = str(input())

if u == s:
    print(a-1, b)
elif u == t:
    print(a, b-1)
else:
    print(a, b)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort()
for i in range(k):
    h.pop()
    if len(h) == 0:
        break
print(0 if len(h) == 0 else sum(h))

Fixed submission:
h, a = map(int, input().split())

for i in range(1, h+1):
    if (h - a*i) <= 0:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
    a.append(input())

# 1 / sum_i(1/a_i)
print(1 / sum([1/i for i in a]))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

print(1 / sum([1/i for i in a]))
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
h = list(map(int, input().split()))

h = np.array(h)

for i in range(len(h)-1):
   if h[i] < h[i+1]:
       h[i+1] -= 1
np.diff(h-1, n=1)

minus = [i for i in np.diff(h-1, n=1) if i < 0]

if len(minus) > 0:
    print('No')
else:
    print('Yes')


Fixed submission:
a, b, c = map(int, input().split())

c1 = b
c2 = c
cap = a - b

c1 = c1 + cap
c2 = c2 - cap

if c2 < 0:
    c2 = 0
print(c2)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

x,y = c,d

# 最小公倍数
while y != 0:
	x,y = y,x%y

x = (c*d)//x

count1 = b - (b//c + b//d -b//x)
count2 = (a - 1) - ((a-1)//c + (a-1)//d -(a-1)//x) 
print(count1 - count2)

Fixed submission:
s = str(input())
is_good = True
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        #print('Bad')
        is_good = False
        break

print('Good' if is_good else 'Bad')
Buggy python submission (verdict: Runtime Error):
import itertools

L = int(input(), 2)

count = 1
# (a, b)の組み合わせ
#products = itertools.product(range(L+1), range(L+1))
products = list(itertools.combinations(range(L+1), 2))
for p in products:
    s = p[0] + p[1]
    if s <= L:
        # XOR
        if s == (p[0] ^ p[1]):
            count += 1
            if p[0] != p[1]:
                count += 1

print(count % (10**9 + 7))

Fixed submission:
L=input()
length=len(L)
inf=10**9+7
a=2
b=1
for i in range(1,len(L)):
	if L[i]=="0":
		b=b*3%inf
		continue
	else:
		b=(b*3+a)%inf
		a=a*2%inf
print((a+b)%inf)

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

L = int(input(), 2)

count = 0
# (a, b)の組み合わせ
products = itertools.product(range(L+1), range(L+1))
for p in products:
    s = p[0] + p[1]
    if s <= L:
        # XOR
        if s == (p[0] ^ p[1]):
            count += 1
            # a, bが異なる値ならば、組み合わせ数+1
            #if a != b:
            #    count += 1

#print(count)
print(count % (10**9 + 7))

Fixed submission:
L=input()
length=len(L)
inf=10**9+7
a=2
b=1
for i in range(1,len(L)):
	if L[i]=="0":
		b=b*3%inf
		continue
	else:
		b=(b*3+a)%inf
		a=a*2%inf
print((a+b)%inf)

Buggy python submission (verdict: Runtime Error):
L = int(input(), 2)
count = 0
# (a, b)の組み合わせ
products = itertools.product(range(L+1), range(L+1))
for p in products:
    s = p[0] + p[1]
    if s <= L:
        # XOR
        if s == (p[0] ^ p[1]):
            count += 1

print(count % (10**9 + 7))

Fixed submission:
L=input()
length=len(L)
inf=10**9+7
a=2
b=1
for i in range(1,len(L)):
	if L[i]=="0":
		b=b*3%inf
		continue
	else:
		b=(b*3+a)%inf
		a=a*2%inf
print((a+b)%inf)
Buggy python submission (verdict: Time Limit Exceeded):
import re

s = str(input())
count = 0
while True:
    s_n = re.sub(r"ABC", "BCA", s)
    l_find = len(re.findall(r"ABC", s))
    count += l_find

    if l_find == 0:
        print(count)
        break
    else:
        s = s_n

Fixed submission:
import re

s = input()
s = s.replace('BC', 'D')

count = 0
count_a = 0
for string in s:
    if string == 'A':
        count_a += 1
    elif string == 'D':
        count += count_a
    else:
        count_a = 0

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import re

s = str(input())
count = 0
while True:
    s_n = re.sub(r"ABC", "BCA", s)
    l_find = len(re.findall(r"ABC", s))
    count += l_find

    if l_find == 0:
        print(count)
        break
    else:
        s = s_n

Fixed submission:
import re

s = input()
s = s.replace('BC', 'D')

count = 0
count_a = 0
for string in s:
    if string == 'A':
        count_a += 1
    elif string == 'D':
        count += count_a
    else:
        count_a = 0

print(count)

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

s = str(input())
find_s = 'ABC'
count = 0
while True:
    s_n = re.sub(r"ABC", "BCA", s)
    l_find = len(re.findall(r"ABC", s))
    count += l_find

    if l_find == 0:
        print(count)
        break
    else:
        s = s_n

Fixed submission:
import re

s = input()
s = s.replace('BC', 'D')

count = 0
count_a = 0
for string in s:
    if string == 'A':
        count_a += 1
    elif string == 'D':
        count += count_a
    else:
        count_a = 0

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import re

s = str(input())
find_s = 'ABC'
count = 0
while True:
    s_n = re.sub(r"{}".format(find_s), "BCA", s)
    n_find = re.findall(r"{}".format(find_s), s)
    count += len(n_find)

    if s_n.find(find_s) == -1:
        print(count)
        break
    else:
        s = s_n

Fixed submission:
import re

s = input()
s = s.replace('BC', 'D')

count = 0
count_a = 0
for string in s:
    if string == 'A':
        count_a += 1
    elif string == 'D':
        count += count_a
    else:
        count_a = 0

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = []
volatility = 0
a = 0

for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
    
for i in range(K, N+1):
    for j in range(i-K, i):
        volatility += p[j]
    
    ans.append(volatility)
    volatility = 0

a = max(ans)
print(a)

Fixed submission:
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]

for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
    
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
    
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

if int(S[0:2]) <= 12 and int (S[0:2]) > 0:
    if int(S[2:4]) > 0 and int(S[2:4]) <= 12:
        print("AMBIGUOUS")
    elif int(S[2:4]) > 0:
        print("MMYY")
        
elif int(S[2:4]) <= 12 and int(S[2:4]) > 0:
    if int(S[0:2]) > 0 and int(S[0:2]) <= 12:
        print("AMBIGUOUS")    
    elif int(S[0:2]) > 0:
        print("YYMM")

elif int(S[0:2]) >= 13 and int(S[0:2]) == 0:
    if int(S[2:4]) == 0:
        print("NA")

elif int(S[2:4]) >= 13 and int(S[2:4]) == 0
    if int(S[0:2]) == 0:
        print("NA")

Fixed submission:
S = str(input())

if 12 >= int(S[0:2]) >= 1:

    if 12 >= int(S[2:4]) >= 1:
        print("AMBIGUOUS")

    else:
        print("MMYY")

else:
    if 12 >= int(S[2:4]) >= 1:
        print("YYMM")

    else:
        print("NA")

Buggy python submission (verdict: Runtime Error):
S = input()

if int(S[0:2]) <= 12 and int (S[0:2]) > 0:
    if int(S[2:4]) > 0 and int(S[2:4]) <= 12:
        print("AMBIGUOUS")
    elif int(S[2:4]) > 0:
        print("MMYY")
        
elif int(S[2:4]) <= 12 and int(S[2:4]) > 0:
    if int(S[0:2]) > 0 and int(S[0:2]) <= 12:
        print("AMBIGUOUS")    
    elif int(S[0:2]) > 0:
        print("YYMM")

elif int(S[0:2]) >= 13 and int(S[0:2]) == 0:
    if int(S[2:4]) == 0:
        print("NA")

elif int(S[2:4]) >= 13: and int(S[2:4]) == 0
    if int(S[0:2]) == 0:
        print("NA")

Fixed submission:
S = str(input())

if 12 >= int(S[0:2]) >= 1:

    if 12 >= int(S[2:4]) >= 1:
        print("AMBIGUOUS")

    else:
        print("MMYY")

else:
    if 12 >= int(S[2:4]) >= 1:
        print("YYMM")

    else:
        print("NA")
Buggy python submission (verdict: Runtime Error):
n = int(input())
tmp = input().split()
length = len(tmp)
length2 = len(list(set(tmp)))
if length == length2 :
  print("YES")
else:
  print("NO")

Fixed submission:
st = input().split()
ab = input().split()
u = input()
if u == st[0]:
 print(int(ab[0])-1,int(ab[1]))
else:
 print(int(ab[0]),int(ab[1])-1)
Buggy python submission (verdict: Time Limit Exceeded):
nk = input().split()
tmp = input().split()
n = int(nk[0])
k = int(nk[1])

s = [0]*n
hai = [0]*n
max = 0

for i in range(n):
  hai[i] = (sum(range(int(tmp[i])))+int(tmp[i]))/int(tmp[i])
for i in range(n):
  for j in range(k):
   t = sum(hai[(i-j):(i+k-j)])
   if max < t :
      max = t
print(max)

Fixed submission:
n ,k = map(int ,input().split())
hai = list(map(lambda x:(int(x)+1)/2 ,input().split()))
hait= hai[:k]
ans = tmp = sum(hait)
for i in range(k,n):
  tmp = tmp - hai[i-k] + hai[i]
  if ans < tmp:
    ans = tmp
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = input().split()
cnt = 0
for i in range(n):
 ng_flg = 0
 ii = i
 for j in range(ii+1):
  if int(p[j]) < int(p[ii]) :
   ng_flg=1
   break
 if ng_flg == 0:
  cnt +=1
print(cnt)

Fixed submission:
n = int(input())
p = input().split()
min = int(p[0])
cnt = 0
for i in range(n):
 if int(p[i]) <= min:
  cnt+=1
 if int(p[i])<min :
  min = int(p[i])
print(cnt)
Buggy python submission (verdict: Runtime Error):
s,t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
  a -= 1
 else:
  b -= 1
 print(a,b)

Fixed submission:
s,t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
  a -= 1
else:
  b -= 1
print(a,b)
Buggy python submission (verdict: Time Limit Exceeded):
n, t = map(int, input().split())
dices = map(int, input().split())
avg = list(map(lambda x: sum(x)/len(x)+1, map(range, dices)))
s = prev = sum(avg[0:t])

for i in range(1, n-t+1):
  prev = prev - avg[i-1] + avg[i+t-1]
  s = max(s, prev)
print(s)


Fixed submission:
n, t = map(int, input().split())
dices = map(int, input().split())
avg = list(map(lambda n: (n+1)/2, dices))
s = prev = sum(avg[0:t])

for i in range(1, n-t+1):
  prev = prev - avg[i-1] + avg[i+t-1]
  s = max(s, prev)
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
n, t = map(int, input().split())
dices = map(int, input().split())
avg = list(map(lambda x: sum(x)/len(x)+1, map(range, dices)))
exp=0
for i in range(n-t+1):
  d = avg[i:i+t]
  exp = max(exp, sum(d))
print(exp)


Fixed submission:
n, t = map(int, input().split())
dices = map(int, input().split())
avg = list(map(lambda n: (n+1)/2, dices))
s = prev = sum(avg[0:t])

for i in range(1, n-t+1):
  prev = prev - avg[i-1] + avg[i+t-1]
  s = max(s, prev)
print(s)
Buggy python submission (verdict: Runtime Error):
s,t=map(sting,input())
a,b=map(int,input())
u=map(sting,input())

if s==u:
    print(a-1,b)
else
    print(a,b-1)



Fixed submission:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()

if s==u:
  print(a-1,b)
elif t==u:
  print(a,b-1)
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans=0
for x in range(k+1):
     for y in range(k+1):
        z=s-x-y
        if 0<=z and z<=k
            ans+=1
print(ans)


Fixed submission:
k,s=map(int,input().split())
ans=0
for x in range(k+1):
     for y in range(k+1):
        z=s-x-y
        if 0<=z and z<=k:
            ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
for i in range(k+1):
     for n in range(k+1):
         for t in range(k+1):
            if i+n+t==s:
                ans+=1
print(ans)
 

Fixed submission:
k,s=map(int,input().split())
ans=0
for x in range(k+1):
     for y in range(k+1):
        z=s-x-y
        if 0<=z and z<=k:
            ans+=1
print(ans)