Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  n0 = N-l0*l[0]
  for l1 in range(n0//l[1]+1):
    l2 = (n0 - l1*l[1])/l[2]
    if l2%1.0 == 0 and l2 >= 0:
      count += 1
print(count)

Fixed submission:
R, G, B, N = map(int, input().split())
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  n0 = N-l0*l[0]
  for l1 in range(n0//l[1]+1):
    l2 = n0 - l1*l[1]
    if l2%l[2] == 0 and l2 >= 0:
      count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  for l1 in range((N-l0*l[0])//l[1]+1):
    l2 = (N - l0*l[0] - l1*l[1])/l[2]
    if l2%1.0 == 0 and l2 >= 0:
      count += 1
print(count)

Fixed submission:
R, G, B, N = map(int, input().split())
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  n0 = N-l0*l[0]
  for l1 in range(n0//l[1]+1):
    l2 = n0 - l1*l[1]
    if l2%l[2] == 0 and l2 >= 0:
      count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  for l1 in range(N//l[1]+1):
    l2 = (N - l0*l[0] - l1*l[1])/l[2]
    if l2%1.0 == 0 and l2 >= 0:
      count += 1
print(count)

Fixed submission:
R, G, B, N = map(int, input().split())
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  n0 = N-l0*l[0]
  for l1 in range(n0//l[1]+1):
    l2 = n0 - l1*l[1]
    if l2%l[2] == 0 and l2 >= 0:
      count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

count = 0
for r in range(N//R+1):
  for g in range(N//G+1):
    b = (N - r*R - g*G)/B
    if b%1.0 == 0 and b >= 0:
      count += 1
print(count)

Fixed submission:
R, G, B, N = map(int, input().split())
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  n0 = N-l0*l[0]
  for l1 in range(n0//l[1]+1):
    l2 = n0 - l1*l[1]
    if l2%l[2] == 0 and l2 >= 0:
      count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
print('YES' if int(input) in [3,5,7] else 'NO')

Fixed submission:
print('YES' if int(input()) in [3,5,7] else 'NO')
Buggy python submission (verdict: Runtime Error):
S = input()
ans = float('inf')
for i in range(S-2):
  ans = min(ans, abs(753-s[i:i+3]))
print(ans)

Fixed submission:
S = input()
ans = float('inf')
for i in range(len(S)-2):
  ans = min(ans, abs(753-int(S[i:i+3])))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
dic = {}
for m in range(M):
  dic[m] = list(map(int, input().split()))
for n in range(N):
  l = sorted([d for d in dic.items() if d[1][0]==n+1], key=lambda x:x[1][1])
  for i in range(len(l)):
    l[i][1].append(i+1)
for d in dic.items():
  print("{:06d}{:06d}".format(d[1][0], d[1][2]))

Fixed submission:
N, M = map(int, input().split())
dic = {}
cnt = [1]*N
for m in range(M):
  dic[m] = list(map(int, input().split()))
l = sorted([d for d in dic.items()], key=lambda x:x[1][1])
for m in range(len(l)):
  l[m][1].append(cnt[l[m][1][0]-1])
  cnt[l[m][1][0]-1] += 1
for d in dic.values():
  print("{:06d}{:06d}".format(d[0], d[2]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
v = list(map(int, input().split()))

va, ve = v[0::2], v[1::2]
add, even = va[0], ve[0]
for a in set(va):
  add = a if va.count(add) < va.count(a) else add
for e in set(ve):
  even = e if ve.count(even) < ve.count(e) else even

print(len(v)-va.count(add)-ve.count(even) if add!=even else len(v)-va.count(add))

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

va, ve = v[0::2], v[1::2]
da, de = {}, {}
for a in va:
  da[a] = da.get(a, 0)+1
for e in ve:
  de[e] = de.get(e, 0)+1
add = sorted([(k,v) for k,v in da.items()], key=lambda x:-x[1])+[(0,0)]
even = sorted([(k,v) for k,v in de.items()], key=lambda x:-x[1])+[(0,0)]
if add[0][0] == even[0][0]:
  if add[1][1] <= even[1][1]:
    even.pop(0)
  else:
    add.pop(0)
print(n-add[0][1]-even[0][1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = tuple(int(x) for x in input().split())
length = len(X)
for x in range(length):
 print(sorted(X[:x]+X[x+1:])[length//2-1])

Fixed submission:
N = int(input())
X = tuple(int(x) for x in input().split())
length = len(X)
med = sorted(X)[length//2-1:length//2+1]
for x in X:
 print(med[1] if x < sum(med)/2 else med[0])
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = tuple(int(x) for x in input().split())

def hoge(n, r):
 return n * (min(n-r, r))

n = max(a)
ans = (n, a[0])
for i in a:
 if n = i: continue
 ans = (n, i) if hoge(*ans) < hoge(n, i) else ans
print(*ans)


Fixed submission:
N = int(input())
a = sorted(int(x) for x in input().split())

def hoge(n, r):
 return n * (min(n-r, r))

n = max(a)
ans = (n, a[0])
for i in a[1:]:
 ans = (n, i) if hoge(*ans) < hoge(n, i) else ans
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = tuple(int(x) for x in input().split())

def hoge(n, r):
 return n * (min(n-r, r))
ans = sorted(a[:2])[::-1]
for i in a:
 for j in a:
  if i <= j: continue
  ans = (i, j) if hoge(*ans) < hoge(i, j) else ans
print(*ans)


Fixed submission:
N = int(input())
a = sorted(int(x) for x in input().split())

def hoge(n, r):
 return n * (min(n-r, r))

n = max(a)
ans = (n, a[0])
for i in a[1:]:
 ans = (n, i) if hoge(*ans) < hoge(n, i) else ans
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = tuple(int(x) for x in input().split())

def fac(n, x):
 fact = 1
 for f in range(n, x+1):
  fact *= f
 return fact

def comb(n, r):
 num = fac(1, r)
 dom = fac(n-r+1, n)
 return dom // num

maxi = {}
for i in a:
 for j in a:
  if i <= j: continue
  maxi[i, j] = comb(i, j)

ans = tuple(maxi.keys())[0]
for k, v in maxi.items():
 ans = k if maxi[ans] < v else ans
print(*ans)


Fixed submission:
N = int(input())
a = sorted(int(x) for x in input().split())

def hoge(n, r):
 return n * (min(n-r, r))

n = max(a)
ans = (n, a[0])
for i in a[1:]:
 ans = (n, i) if hoge(*ans) < hoge(n, i) else ans
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = tuple(int(x) for x in input().split())

def fac(n, x):
 fact = 1
 for f in range(n, x+1):
  fact *= f
 return fact

def comb(n, r):
 num = fac(1, r)
 dom = fac(n-r+1, n)
 return dom // num

maxi = a[:2]
for i in a:
 for j in a:
  if i < j: continue
  maxi = (i, j) if comb(*maxi) < comb(i, j) else maxi
print(*maxi)


Fixed submission:
N = int(input())
a = sorted(int(x) for x in input().split())

def hoge(n, r):
 return n * (min(n-r, r))

n = max(a)
ans = (n, a[0])
for i in a[1:]:
 ans = (n, i) if hoge(*ans) < hoge(n, i) else ans
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = tuple(int(x) for x in input().split())

def fac(x):
 fact = 1
 for f in range(1, x+1):
  fact *= f
 return fact

def comb(n, r):
 return fac(n) // (fac(r) * fac(n-r))

maxi = a[:2]
for i in a:
 for j in a:
  if i < j: continue
  maxi = (i, j) if comb(*maxi) < comb(i, j) else maxi
print(*maxi)


Fixed submission:
N = int(input())
a = sorted(int(x) for x in input().split())

def hoge(n, r):
 return n * (min(n-r, r))

n = max(a)
ans = (n, a[0])
for i in a[1:]:
 ans = (n, i) if hoge(*ans) < hoge(n, i) else ans
print(*ans)
Buggy python submission (verdict: Runtime Error):
print(min(int(input()), int(input()))+min(int(input()), int(input())))

Fixed submission:
N = int(input())
D, X = (int(x) for x in input().split())
A = tuple(int(input()) for x in [None]*N)
sum = 0
for i in range(N):
 sum += 1 + (D - 1) // A[i]
print(sum + X)
Buggy python submission (verdict: Runtime Error):
n,a,b=[int(x) for x in input().split()]
ans=0
for i in rabge(n):
  t=0
  while i:
    t+=i%10
    i/=10
  if a<=t and t<=b:ans+=t
print(ans)

Fixed submission:
n,a,b=[int(x) for x in input().split()]
ans=0
for i in range(n+1):
  j,t=i,0
  while j:
    t+=j%10
    j=j//10
  if a<=t and t<=b:ans+=i
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
print(min([max(i+1,len(s)-i-1) for i in range(len(s)-1) if s[i]!=s[i+1]]))

Fixed submission:
s=input()
l=[max(i+1,len(s)-i-1) for i in range(len(s)-1) if s[i]!=s[i+1]]
print(min(l) if len(l)!=0 else len(s))

Buggy python submission (verdict: Time Limit Exceeded):
def po(tmp,i,j):
  str=tmp.copy()
  for k in range(i,j):
    if str[k]=='0':str[k]='1'
    else:str[k]='0'
  return str

s=list(input())
l=len(s)
while l:
  o,c=[s],[]
  while len(o)!=0:
    t=o[0]
    for i in range(l,len(s)+1):
      for j in range(len(s)-i+1):
        tmp=po(t,j,i+j)
        if tmp==["0"]*len(s):
          print(l);exit()
        if tmp not in o+c:o.append(tmp)
    c.append(o[0])
    o=o[1:]
  l-=1

Fixed submission:
s=input()
l=[max(i+1,len(s)-i-1) for i in range(len(s)-1) if s[i]!=s[i+1]]
print(min(l) if len(l)!=0 else len(s))
Buggy python submission (verdict: Runtime Error):
a = input().split()
b = int(a[0])
c = int(a[1])

X = 2
Y = 4
for i in range(b+1):
    if b == 1 and c == 2:
        print('Yes')
        break
    elif b == 1 and c == 4:
        print('Yes')
        breake
    d = b-i
    if X*i + Y*d == c:
        print('Yes')
        break
    elif i == b-1:
        print('No')
        

Fixed submission:
a = input().split()
b = int(a[0])
c = int(a[1])

X = 2
Y = 4
for i in range(b+1):
    if b == 1 and c == 2:
        print('Yes')
        break
    elif b == 1 and c == 4:
        print('Yes')
        break
    d = b-i
    if X*i + Y*d == c:
        print('Yes')
        break
    elif i == b:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = [int(i) for i in input().split()]

ans =1
for I in b:
  ans = ans*I
if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
a = int(input())
b = [int(i) for i in input().split()]

ans =1
b = sorted(b)
for I in b:
  ans = ans*I
  if b[0] == 0:
      ans = 0
      print(0)
      break
  elif ans > 10**18:
    print('-1')
    ans = -1
    break
if ans >=1:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = input().split()
c = []
for i in range(a):
  d = int(b[i])
  c.append(d)
ans =1
for I in c:
  ans = ans*I
if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
a = int(input())
b = [int(i) for i in input().split()]

ans =1
b = sorted(b)
for I in b:
  ans = ans*I
  if b[0] == 0:
      ans = 0
      print(0)
      break
  elif ans > 10**18:
    print('-1')
    ans = -1
    break
if ans >=1:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = 1
c = []
for i in range(a):
    c.append(b)
    b += 1

D = 0
for I in range(a):
    if c[I]%3 == 0:
        c.remove(c[I])
        c.insert(I,'a')
    
    elif c[I]%5 == 0:
        c.remove(c[I])
        c.insert(I,'a')
        
    else:
        D = D + c[I]
print(D)

Fixed submission:
a = int(input())
d = 1
D = 0
for I in range(a):
    if d%3 == 0:
        d += 1
    
    elif d%5 == 0:
        d += 1
        
    else:
        D = D + d
        d += 1
print(D)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = 1
c = []
for i in range(a):
    c.append(b)
    b += 1

D = 0
for I in range(a):
    if c[I]%5 == 0:
        c.remove(c[I])
        c.insert(I,'a')
    
    elif c[I]%3 == 0:
        c.remove(c[I])
        c.insert(I,'a')
        
    else:
        D = D + c[I]
print(D)

Fixed submission:
a = int(input())
d = 1
D = 0
for I in range(a):
    if d%3 == 0:
        d += 1
    
    elif d%5 == 0:
        d += 1
        
    else:
        D = D + d
        d += 1
print(D)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = 1
c = []
for i in range(a):
    c.append(b)
    b += 1

D = 0
for I in range(a):
    if c[I]%15 == 0:
        c.remove(c[I])
        c.insert(I,'a')

    elif c[I]%5 == 0:
        c.remove(c[I])
        c.insert(I,'a')
    
    elif c[I]%3 == 0:
        c.remove(c[I])
        c.insert(I,'a')
        
    else:
        D = D + c[I]
print(D)

Fixed submission:
a = int(input())
d = 1
D = 0
for I in range(a):
    if d%3 == 0:
        d += 1
    
    elif d%5 == 0:
        d += 1
        
    else:
        D = D + d
        d += 1
print(D)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = 1
c = []
for i in range(a):
    c.append(b)
    b += 1

for I in range(a):
    if c[I]%15 == 0:
        c.remove(c[I])
        c.insert(I,'a')

    elif c[I]%5 == 0:
        c.remove(c[I])
        c.insert(I,'a')
    
    elif c[I]%3 == 0:
        c.remove(c[I])
        c.insert(I,'a')
        
    else:
        continue


D = 0
for q in range(a):
    if c[q] == 'a':
        continue
    elif c[q] != 'a':
        D = D + c[q]
print(D)

Fixed submission:
a = int(input())
d = 1
D = 0
for I in range(a):
    if d%3 == 0:
        d += 1
    
    elif d%5 == 0:
        d += 1
        
    else:
        D = D + d
        d += 1
print(D)
Buggy python submission (verdict: Runtime Error):
a = str(input())
s = ['z','x','c','v','b','n','m','a','s','d','f','g','h','j','k','l','q','w','e','r','t','y','u','i','o','p']
e = append(a)
w = sorted(e)
print(w[a+1])



Fixed submission:
a = str(input())
s = ['z','x','c','v','b','n','m','a','s','d','f','g','h','j','k','l','q','w','e','r','t','y','u','i','o','p']
s.append(a)
s.sort()
Q = s.index(a)
e = int(Q) + 2
print(s[int(e)])
Buggy python submission (verdict: Runtime Error):
N = int(input())
music = []
for i in range(N):
    music.append(input().split())
X = str(input())
C = music.index('X')
D = int(C)
B = int(music[X][1])
A = B + 1
if music(X) == music[N]:
    print(0)
elif music[X] < music[N]:
    while music[D] == music[N]:
        s = music[X][1] + music[A][1]
        A += 1
        D += 1
print(s)

Fixed submission:
N = int(input())
music = []
for i in range(N):
    music.append(input().split())
X = (input())
Time = 0
kama = False
for s,t in music:
    if kama:
        Time += int(t)
    if s == X:
        kama = True
            
print(Time)
Buggy python submission (verdict: Runtime Error):
A,B,T = input().split()
A = int(A)
B = int(B)
T = int(T)
for X in range(1,20):
  if A*X <= T + 0.5:
    s = B*X
  if A*X >=T + 0.5:
    break
print(s)



Fixed submission:
A,B,T = input().split()
A = int(A)
B = int(B)
T = int(T)
s = 0
for X in range(1,21):
  if A*X <= T + 0.5:
    s = B*X
  if A*X >=T + 0.5:
    break
print(s)

Buggy python submission (verdict: Runtime Error):
A,B,T = input().split()
A = int(A)
B = int(B)
T = int(T)
s = int(s)
for X in range(0,20):
  if A*X <= T + 0.5:
    s = B*X
  if A*X >=T + 0.5:
    break
print(s)



Fixed submission:
A,B,T = input().split()
A = int(A)
B = int(B)
T = int(T)
s = 0
for X in range(1,21):
  if A*X <= T + 0.5:
    s = B*X
  if A*X >=T + 0.5:
    break
print(s)
Buggy python submission (verdict: Runtime Error):
    m = int(input())
     
    def fizz_buzz(i):
      fizz = i % 3
      buzz = i % 5
      
      return (fizz > 0) && (buzz > 1)
     
    res = 0
     
    for i in range(m):
      use_i = i+1
      if fizz_buzz(use_i):
        res += use_i
        
    print(res)

Fixed submission:
m = int(input())
     
def fizz_buzz(i):
  fizz = i % 3
  buzz = i % 5
      
  return (fizz > 0) & (buzz > 0)
     
res = 0
     
for i in range(m):
  use_i = i+1
  if fizz_buzz(use_i):
    res += use_i
        
print(res)

Buggy python submission (verdict: Runtime Error):
m = int(input())

def fizz_buzz(i):
  fizz = i % 3
  buzz = i % 5
  
  return (fizz > 0) && (buzz > 1)

res = 0

for i in range(m):
  use_i = i+1
  if fizz_buzz(use_i):
    res += use_i
    
print(res)

Fixed submission:
m = int(input())
     
def fizz_buzz(i):
  fizz = i % 3
  buzz = i % 5
      
  return (fizz > 0) & (buzz > 0)
     
res = 0
     
for i in range(m):
  use_i = i+1
  if fizz_buzz(use_i):
    res += use_i
        
print(res)
Buggy python submission (verdict: Runtime Error):
import itertools
import math

m = int(input())
g = range(1, m+1)
res = 0
for c in itertools.combinations(g, 3):
  set_c = set(c)
  if len(set_c) == 3:
    n = 6
  elif len(set_c) == 2:
    n = 3
  else:
    n = 1
  tmp_res = math.gcd(c[0], c[1], c[2])
  res += tmp_res * n
print(res)

Fixed submission:
import itertools
import math

m = int(input())
g = list(range(1, m+1))
res = 0
for c in itertools.combinations_with_replacement(g, 3):
  set_c = set(c)
  set_list_c = list(set_c)
  if len(set_c) == 3:
    n = 6
    tmp_res = math.gcd(set_list_c[0], set_list_c[1])
    tmp_res = math.gcd(tmp_res, set_list_c[2])
  elif len(set_c) == 2:
    n = 3
    tmp_res = math.gcd(set_list_c[0], set_list_c[1])
  else:
    n = 1
    tmp_res = set_list_c[0]
  res += tmp_res * n
print(res)
Buggy python submission (verdict: Runtime Error):
import sys

def get_minimun_val(n, rule_dict):
  max_val = 10**n
  min_val = 10**(n-1)
  if min_val = 1:
    min_val=0
  for i in range(min_val, max_val):
    str_i = str(i)
    flg = True
    for s, c in rule_dict.items():
      if str_i[s-1] == str(c):
        continue
      else:
        flg = False
        break
    if flg:
      return i
  return -1


rule_dict = {}

n, m = map(int, input().split())
res = -1
for i in range(m):
  s, c = map(int, input().split())
  if c == 0 and s == 1 and n > 1:
    print(-1)
    sys.exit()
  if s not in rule_dict:
    rule_dict[s] = c
    continue
  current_c = rule_dict[s]
  if c != current_c:
    print(-1)
    sys.exit()

print(get_minimun_val(n, rule_dict))


Fixed submission:
import sys

def get_minimun_val(n, rule_dict):
  max_val = 10**n
  min_val = 10**(n-1)
  if min_val == 1:
    min_val=0
  for i in range(min_val, max_val):
    str_i = str(i)
    flg = True
    for s, c in rule_dict.items():
      if str_i[s-1] == str(c):
        continue
      else:
        flg = False
        break
    if flg:
      return i
  return -1


rule_dict = {}

n, m = map(int, input().split())
res = -1
for i in range(m):
  s, c = map(int, input().split())
  if c == 0 and s == 1 and n > 1:
    print(-1)
    sys.exit()
  if s not in rule_dict:
    rule_dict[s] = c
    continue
  current_c = rule_dict[s]
  if c != current_c:
    print(-1)
    sys.exit()

print(get_minimun_val(n, rule_dict))

Buggy python submission (verdict: Runtime Error):
    import sys
     
    def get_minimun_val(n, rule_dict):
      max_val = 10**n
      min_val = 10**(n-1)
      for i in range(min_val, max_val):
        str_i = str(i)
        flg = True
        for s, c in rule_dict.items():
          if str_i[s-1] == str(c):
            continue
          else:
            flg = False
            break
        if flg:
          return i
      return -1
     
     
    rule_dict = {}
     
    n, m = map(int, input().split())
    res = -1
    for i in range(m):
      s, c = map(int, input().split())
      if c == 0 and s == 1:
        print(-1)
        sys.exit()
      if s not in rule_dict:
        rule_dict[s] = c
        continue
      current_c = rule_dict[s]
      if c != current_c:
        print(-1)
        sys.exit()
     
    print(get_minimun_val(n, rule_dict))

Fixed submission:
import sys

def get_minimun_val(n, rule_dict):
  max_val = 10**n
  min_val = 10**(n-1)
  if min_val == 1:
    min_val=0
  for i in range(min_val, max_val):
    str_i = str(i)
    flg = True
    for s, c in rule_dict.items():
      if str_i[s-1] == str(c):
        continue
      else:
        flg = False
        break
    if flg:
      return i
  return -1


rule_dict = {}

n, m = map(int, input().split())
res = -1
for i in range(m):
  s, c = map(int, input().split())
  if c == 0 and s == 1 and n > 1:
    print(-1)
    sys.exit()
  if s not in rule_dict:
    rule_dict[s] = c
    continue
  current_c = rule_dict[s]
  if c != current_c:
    print(-1)
    sys.exit()

print(get_minimun_val(n, rule_dict))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
p_arr = np.array(list(map(int, input().split())))
res = 0
for k, i in enumerate(p_arr):
  if i == 1 or k == 0:
    res += 1
  else:
    left_arr = p_arr[:k]
    b_arr = i > left_arr
    if not b_arr.any():
      res += 1
print(res)

Fixed submission:
n = int(input())
p_arr = list(map(int, input().split()))
min_i = 9999999999999999999999999
res = 0
for i in p_arr:
  if i == 1:
    res += 1
    break
  else:
    if i < min_i:
      res += 1
      min_i = i
print(res)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
p_list = list(map(int, input().split()))
res = 0
for k, i in enumerate(p_list):
  left_list = p_list[:k]
  if i == 1:
    res += 1
  else:
    filter_left = list(filter(lambda x: i > x, left_list))
    if len(filter_left) == 0:
      res += 1
print(res)

Fixed submission:
n = int(input())
p_arr = list(map(int, input().split()))
min_i = 9999999999999999999999999
res = 0
for i in p_arr:
  if i == 1:
    res += 1
    break
  else:
    if i < min_i:
      res += 1
      min_i = i
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p_list = map(int, input().split())
left_list = []
res = 0
for i in p_list:
  if i == 1:
    res += 1
  else:
    filter_left = list(filter(lambda x: i > x, left_list))
    if len(filter_left) == 0:
      res += 1
  left_list.append(i)
print(res)

Fixed submission:
n = int(input())
p_arr = list(map(int, input().split()))
min_i = 9999999999999999999999999
res = 0
for i in p_arr:
  if i == 1:
    res += 1
    break
  else:
    if i < min_i:
      res += 1
      min_i = i
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
takahashi_u = []
aoki_u = []
sum_u = []
takahashi_eat = []
aoki_eat = []
for i in range(n):
  a, b = map(int, input().split())
  takahashi_u.append(a)
  aoki_u.append(b)
  sum_u.append(a+b)
for i in range(n):
  turn = i % 2
  # takahashi
  m_index = sum_u.index(max(sum_u))
  sum_u.pop(m_index)
  if turn == 0:
    takahashi_eat.append(takahashi_u.pop(m_index))
    aoki_u.pop(m_index)
  # aoki
  else:
    aoki_eat.append(aoki_u.pop(m_index))
    takahashi_u.pop(m_index)
print(sum(takahashi_eat) - sum(aoki_eat))

Fixed submission:
import numpy as np
n = int(input())
takahashi_u = []
aoki_u = []
sum_u = []
takahashi_eat = []
aoki_eat = []
for i in range(n):
  a, b = map(int, input().split())
  takahashi_u.append(a)
  aoki_u.append(b)
  sum_u.append(a+b)
arr = np.array([sum_u, takahashi_u, aoki_u])
sort_index = np.argsort(arr[0])[::-1]
sort_arr = arr[:, sort_index]
takahashi_arr = sort_arr[1, 0::2]
aoki_arr = sort_arr[2, 1::2]
print(sum(takahashi_arr) - sum(aoki_arr))