Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, m = (int(i) for i in input().split())
p = [None] * m
s = [None] * m
for i in range(m):
    p[i], s[i] = (j for j in input().split())
    p[i] = int(p[i])
    
pena = [0] * m
ac   = [0] * m
for i in range(m):
    q_index = p[i]-1
    if s[i] == 'AC': 
        ac[q_index] = 1
    if s[i] == 'WA':
        if ac[q_index] == 0: pena[q_index] += 1
        
print(sum(ac), sum(pena))

Fixed submission:
n, m = (int(i) for i in input().split())
p = [None] * m
s = [None] * m
for i in range(m):
    p[i], s[i] = (j for j in input().split())
    p[i] = int(p[i])
    
pena = [0] * n
ac   = [0] * n

for i in range(m):
    q_index = p[i]-1
    if s[i] == 'AC': 
        ac[q_index] = 1
    if s[i] == 'WA':
        if ac[q_index] == 0: pena[q_index] += 1
        
ac_num = 0
pena_num = 0
for i in range(n):
    if ac[i] == 1:
        ac_num += 1
        pena_num += pena[i]

print(ac_num, pena_num)
Buggy python submission (verdict: Runtime Error):
import math
A, B = (int(i) for i in input().split())
print(int(A*B / math.gcd(A, B)))


Fixed submission:
def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

A, B = (int(i) for i in input().split())
print(int(A*B / gcd(A, B)))
Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under



X, Y = (int(i) for i in input().split())
if (X+Y) % 3 == 0 and max(X,Y) - min(X,Y) <= min(X,Y):
    print(cmb(X+Y/3, abs(X-Y)) % (10**9+7))
else:
    print(0)

Fixed submission:
N = int(input())
print(N ** 2)
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
D = input().split(' ')
for i in range(N):
    D[i] = int(D[i])
D.sort()
if D[0] != 0 or 0 in D[1:]:
    print(0)
else:
    nums = []
    previous_num = D[0]
    previous_cnt = 1
    cnt = 1
    sum = 1
    for i in range(1,N):
        if D[i] != previous_num:
            if D[i] - previous_num != 1:
                print(0)
                sys.exit()
            previous_num = D[i]
            sum *= previous_cnt ** cnt
            previous_cnt = cnt
            cnt = 1
        else:
            cnt += 1
        if i == N-1:
            sum *= previous_cnt ** cnt
    
    print(sum)


Fixed submission:
N = int(input())
N = N - 1
print(int(N/2))

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = input().split(' ')
for i in range(N):
    D[i] = int(D[i])
D.sort()
if D[0] != 0 or 0 in D[1:]:
    print(0)
else:
    nums = []
    previous_num = D[0]
    previous_cnt = 1
    cnt = 1
    sum = 1
    for i in range(1,N):
        if D[i] != previous_num:
            previous_num = D[i]
            sum *= previous_cnt ** cnt
            previous_cnt = cnt
            cnt = 1
        else:
            cnt += 1
        if i == N-1:
            sum *= previous_cnt ** cnt
    
    print(sum)


Fixed submission:
N = int(input())
N = N - 1
print(int(N/2))

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = input().split(' ')
for i in range(N):
    D[i] = int(D[i])
D.sort()
if D[0] != 0 or 0 in D[1:]:
    print(0)
else:
    nums = []
    previous_num = D[0]
    previous_cnt = 1
    cnt = 1
    sum = 1
    for i in range(1,N):
        if D[i] != previous_num:
            previous_num = D[i]
            sum *= previous_cnt ** cnt
            previous_cnt = cnt
            cnt = 1
        else:
            cnt += 1
        if i == N-1:
            sum *= previous_cnt ** cnt
    
    print(sum)


Fixed submission:
N = int(input())
N = N - 1
print(int(N/2))

Buggy python submission (verdict: Runtime Error):
N = input()
N = N-1
print(N/2)

Fixed submission:
N = int(input())
N = N - 1
print(int(N/2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

s = 0
pre_food = A[0]
for food in A:
    s += B[food]
    if food - pre_food == 1 : s += C[food]
    pre_food = food

print(s)

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

s = 0
pre_food = A[0]
for food in A:
    s += B[food-1]
    if food - pre_food == 1 : s += C[food-2]
    pre_food = food

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = [int(i) for i in input().split()]
can_move_nums = [0] * N
start = 0

for now in range(N-1):
    if H[now+1] <= H[now]:
        for j in range(start, now+1):
            can_move_nums[j] += 1
    else:
        start = now
        
print(max(can_move_nums)) 

Fixed submission:
N = int(input())
H = [int(i) for i in input().split()]
H = H[::-1]
can_move_nums = [0] * N
start = 0

for i in range(1, N):
    if H[i] >= H[i-1]:
        can_move_nums[i] = can_move_nums[i-1]+1        
        
print(max(can_move_nums))

Buggy python submission (verdict: Runtime Error):
N = int(input())
H = [int(i) for i in input().split()]
can_move_nums = [None] * N

for i in range(N):
    cnt = 0
    if i == N-1:
        break
    
    for j in range(i, N-1):
        if H[j+1] <= H[j]:
            cnt += 1
        else:
            break
        
    
    can_move_nums[now] = cnt 

print(max(can_move_nums)) 

Fixed submission:
N = int(input())
H = [int(i) for i in input().split()]
H = H[::-1]
can_move_nums = [0] * N
start = 0

for i in range(1, N):
    if H[i] >= H[i-1]:
        can_move_nums[i] = can_move_nums[i-1]+1        
        
print(max(can_move_nums))
Buggy python submission (verdict: Runtime Error):
print(3*(int(input())**2)

Fixed submission:
print(3*(int(input())**2))
Buggy python submission (verdict: Runtime Error):
a, b = (int(i) for i in input(),split())
print(a+b) if b%a == 0 else print(b-a)

Fixed submission:
a, b = (int(i) for i in input().split())
print(a+b) if b%a == 0 else print(b-a)
Buggy python submission (verdict: Runtime Error):
age = int(input())
if age == 1:
  print('Hello'World)
else:
  a = int(input())
  b = int(input())
  print(a+b)
  

Fixed submission:
age = int(input())
if age == 1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
n, k = (int(i) for in input().split())
print(0) if n % k == 0 else print(1)

Fixed submission:
n, k = (int(i) for i in input().split())
print(0) if n%k == 0 else print(1)
Buggy python submission (verdict: Runtime Error):
n = input()
if n < 1200: print('ABC')
elif n < 2800: print('ARC')
else: print('AGC')

Fixed submission:
n = int(input())
if n < 1200: print('ABC')
elif n < 2800: print('ARC')
else: print('AGC')
Buggy python submission (verdict: Runtime Error):
a, b, x = (i for i in input().split())
if x-a <= a+b:
  print('Yes')
else:
  print('No')

Fixed submission:
a, b, x = (int(i) for i in input().split())
if x >= a and x-a <= b:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
a, b, c = (i for i in input().split())
if ord(a) + ord(b) + ord(c) == ord('a') + ord('b') + ord('c'):
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
na = 0
nb = 0
nc = 0

for c in s:
  if c == 'a': na += 1
  if c == 'b': nb += 1
  if c == 'c': nc += 1

if na == nb == nc:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
na = 0
nb = 0
nc = 0
for c in s:
  if c == 'a': na += 1
  if c == 'b': nb += 1
  if c == 'c': nc += 1

if a == b == c:
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
na = 0
nb = 0
nc = 0

for c in s:
  if c == 'a': na += 1
  if c == 'b': nb += 1
  if c == 'c': nc += 1

if na == nb == nc:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
a = 0
b = 0
c = 0
for c in s:
  if c == 'a': a += 1
  if c == 'b': b += 1
  if c == 'c': c += 1

if a == b == c:
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
na = 0
nb = 0
nc = 0

for c in s:
  if c == 'a': na += 1
  if c == 'b': nb += 1
  if c == 'c': nc += 1

if na == nb == nc:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
a = b = c = 0
for c in s:
  if c == 'a': a += 1
  if c == 'b': b += 1
  if c == 'c': c += 1

if a == b == c:
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
na = 0
nb = 0
nc = 0

for c in s:
  if c == 'a': na += 1
  if c == 'b': nb += 1
  if c == 'c': nc += 1

if na == nb == nc:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a, b, c, d = (int(i) for i in input().split())
print(min(a,b) + min(c,d))

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b) + min(c,d))
Buggy python submission (verdict: Runtime Error):
s = list(input())
if s[3] == '7':
  ans = s[:3] + '8' + s[4:]
else:
  ans = s
print(ans)

Fixed submission:
s = input()
if s[3] == '7':
  ans = s[:3] + '8' + s[4:]
else:
  ans = s
print(ans)

Buggy python submission (verdict: Runtime Error):
s = list(input())
if s[3] == '7':
  s = s[:3] + '8' + s[4:]
print(s)

Fixed submission:
s = input()
if s[3] == '7':
  ans = s[:3] + '8' + s[4:]
else:
  ans = s
print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
if s[3] == '7':
  s[3] = '8'
print(s)

Fixed submission:
s = input()
if s[3] == '7':
  ans = s[:3] + '8' + s[4:]
else:
  ans = s
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

s.sort()
t.sort(reverse=True)
s = ''.join(s)
t = ''.join(t)
if s < t:
    print('Yes')
else:
    print('No')


Fixed submission:
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)
s = ''.join(s)
t = ''.join(t)
if s < t:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
S = input()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

idx = [0, 1, 2]
output = []
for i in range(1 << len(idx)):
    ops = ['+', '+', '+']
    if A+B+C+D == 7: 
        print(f'{A}{ops[0]}{B}{ops[1]}{C}{ops[2]}{D}=7')
        exit()
    
    ans = A
    for j in range(len(idx)):
        if ((i >> j) & 1) == 1:
            ops[j] = '-'
    
    if ops[0] == '+' : ans += B
    else : ans -= B
    
    if ops[1] == '+' : ans += C
    else : ans -= C
    
    if ops[2] == '+' : ans += D
    else : ans -= D
    
    if ans == 7:
        print(f'{A}{ops[0]}{B}{ops[1]}{C}{ops[2]}{D}=7')
        exit()
        

Fixed submission:
S = input()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

idx = [0, 1, 2]
output = []
for i in range(1 << len(idx)):
    ops = ['+', '+', '+']
    if A+B+C+D == 7: 
        print(A,ops[0],B,ops[1],C,ops[2],D,'=7',sep='')
        exit()
    
    ans = A
    for j in range(len(idx)):
        if ((i >> j) & 1) == 1:
            ops[j] = '-'
    
    if ops[0] == '+' : ans += B
    else : ans -= B
    
    if ops[1] == '+' : ans += C
    else : ans -= C
    
    if ops[2] == '+' : ans += D
    else : ans -= D
    
    if ans == 7:
        print(A,ops[0],B,ops[1],C,ops[2],D,'=7',sep='')
        exit()
Buggy python submission (verdict: Runtime Error):
a, b, c = (i for i in input().split())
d, e, f = (i for i in input().split())

if a == f and b == e and c == d:
  print('YES')
else:
  print('NO')

Fixed submission:
s1 = input()
s2 = input()

if s1[0] == s2[2] and s1[1] == s2[1] and s1[2] == s2[0]:
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
a, b, c = (int(i) for i in input().split())
d, e, f = (int(i) for i in input().split())

if a == f and b == e and c == d:
  print('YES')
else:
  print('NO')

Fixed submission:
s1 = input()
s2 = input()

if s1[0] == s2[2] and s1[1] == s2[1] and s1[2] == s2[0]:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 1
while ans**2 <= n:
    if ans**2 < n: ans += 1
print((ans-1)**2)


Fixed submission:
n = int(input())
ans = 1
while ans**2 <= n:
    if ans**2 <= n: ans += 1
print((ans-1)**2)
Buggy python submission (verdict: Runtime Error):
x, a, b = (int(i) for i in input().split())

if b-a <= 0: 
  print('delicious')
elif b-a <= X:
  print('safe')
else:
  print('dengerous')

Fixed submission:
x, a, b = (int(i) for i in input().split())

n = b - a
if n <= 0:
  print('delicious')
elif n <= x:
  print('safe')
else:
  print('dangerous')
Buggy python submission (verdict: Runtime Error):
a, op, b = (i for i in input().split())

if op == '+':
  print(a+b)
else:
  print(a-b)

Fixed submission:
a, op, b = (i for i in input().split())

if op == '+':
  print(int(a)+int(b))
else:
  print(int(a)-int(b))
Buggy python submission (verdict: Runtime Error):
K = input()
print('ACL'*K)

Fixed submission:
K = int(input())
print('ACL'*K)
Buggy python submission (verdict: Runtime Error):
s = list(map(str,input()))
t = list(map(str,input()))

ans = len(t)

for i in range(0,len(s)-len(t)+1):
    df = 0
    if s[i+j] != t[j]:
        df += 1
        ans = min(ans,df)

print(ans)

Fixed submission:
s = list(map(str,input()))
t = list(map(str,input()))

ans = len(t)

for i in range(0,len(s)-len(t)+1):
    df = 0
    for j in range(0,len(t)):
        if s[i+j] != t[j]:
            df += 1
    ans = min(ans,df)

print(ans)

Buggy python submission (verdict: Runtime Error):
s = list(map(str,input()))
t = list(map(str,input()))

ans = len(t)

for i in range(0,len(s)-len(t)+1):
    df = 0
        if s[i+j] != t[j]:
            df += 1
    ans = min(ans,df)

print(ans)

Fixed submission:
s = list(map(str,input()))
t = list(map(str,input()))

ans = len(t)

for i in range(0,len(s)-len(t)+1):
    df = 0
    for j in range(0,len(t)):
        if s[i+j] != t[j]:
            df += 1
    ans = min(ans,df)

print(ans)
Buggy python submission (verdict: Runtime Error):
x,k,d = map(int,input().split())
cnt = x//d
mod = x%d
mini = 0

if k < cnt:
    print(x-(d*k))
    exit()

if mod > abs(mod-d):
    mini = abs(mod-d)
    cnt += 1
else:
    mini = mod

if k%2 == 1:
    if cnt%2 == 1:
        print(x-(d*cnt))
    else:
        print(min(abs(mini-d),mini+d))
else:
    if cnt%2 == 0:
        print(x-(d*cnt))
    else:
        print(min(abs(mini-d),mini+d))


Fixed submission:
s = input()

if s == "RSS" or s == "SRS" or s == "SSR" or s == "RSR":
    print(1)
elif s == "RRS" or s == "SRR":
    print(2)
elif s == "RRR":
    print(3)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

ans = 0

for i in range(2**n):
    tmp = []
    for j in range(n):
        if ((i >> j) & 1):
            tmp .append(a[j])
    tmp.sort()
    if len(tmp) == 3 and abs(tmp[0]-tmp[1]) < tmp[2] and tmp[2] < tmp[0]+tmp[1] and tmp[0] != tmp[1] != tmp[2]:
        ans += 1

print(ans)

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

ans = 0

for i in range(n):
    for j in range(1,n):
        for k in range(2,n):
            tmp = []
            if i != j != k and i < j < k:
                tmp.append(a[i])
                tmp.append(a[j])
                tmp.append(a[k])
                tmp.sort()
                if len(tmp) == 3 and abs(tmp[0]-tmp[1]) < tmp[2] and tmp[2] < tmp[0]+tmp[1] and tmp[0] != tmp[1] != tmp[2]:
                    ans += 1

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

ans = [0]*(n-k+1)
ans[0] = sum(a[0:k])
for i in range(1,n-k+1):
    ans[i] = sum(a[i:k+i])
    if ans[i-1] < ans[i]:
        print("Yes")
    else:
        print("No")

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

for i in range(1,n-k+1):
    if a[k+i-1] > a[i-1]:
        print("Yes")
    else:
        print("No")

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

ans = [0]*(n-k+1)
for i in range(n-k+1):
    ans[i] = sum(a[i:k+i])

for i in range(len(ans)-1):
    if ans[i] < ans[i+1]:
        print("Yes")
    else:
        print("No")

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

for i in range(1,n-k+1):
    if a[k+i-1] > a[i-1]:
        print("Yes")
    else:
        print("No")

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

ans = []
for i in range(n-k+1):
    tmp = 1
    for _ in range(k):
        tmp *= a[i]
        i += 1
    ans.append(tmp)

for i in range(len(ans)-1):
    if ans[i] < ans[i+1]:
        print("Yes")
    else:
        print("No")

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

for i in range(1,n-k+1):
    if a[k+i-1] > a[i-1]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
ans = [0]*(n-1)
ans[0] = a[0]

for i in range(2,n):
    p = a[(i)//2]
    ans[i-1] = a[p]

print(sum(ans))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
ans = [0]*(n-1)
ans[0] = a[0]

for i in range(2,n):
    p = i//2
    ans[i-1] = a[p]

print(sum(ans))
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
 
ans = 0
for i in range(x+1):
    f = (2*i) + 4*(x-i)
    if  f == y:
        print("Yes")
        exit()
 
print("No")

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

cnt = 1
for i in range(len(l)):
    if l[i] == 0:
        break
    else:
        cnt += 1
        

print(cnt)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))
ans = 1

for i in a:
    ans = ans*i
    if ans > 1000000000000000000:
        ans = -1
        exit
    elif ans == 0:
        exit

print(ans)

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

print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline
 
n = int(input())
a = list(map(int,input().split()))
ans = 1

for i in a:
    ans *= i
    if ans > 10**18:
        ans = -1
        exit
    elif ans == 0:
        exit
 
print(ans)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
 
n = int(input())
a = list(map(int,input().split()))
ans = 1

for i in a:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
 
if 0 in a:
    ans = 0

print(ans)

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

for i in a:
    ans = ans*i
    if ans > 1000000000000000000:
        ans = -1
        exit
    elif ans == 0:
        exit

print(ans)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
 
n = int(input())
a = list(map(int,input().split()))
ans = 1

for i in a:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
 
if 0 in a:
    ans = 0

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))
ans = 1

for i in a:
    ans = ans*i
    if ans > 1000000000000000000:
        ans = -1
        exit
    elif ans == 0:
        exit

print(ans)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
 
n = int(input())
a = list(map(int,input().split()))
ans = 1

for i in a:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
 
if 0 in a:
    ans = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))
ans = 1
a.sort()

for i in a:
    ans = ans*i
    if ans > 1000000000000000000:
        ans = -1
        exit
    elif ans == 0:
        exit

print(ans)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
 
n = int(input())
a = list(map(int,input().split()))
ans = 1

for i in a:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
 
if 0 in a:
    ans = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))
ans = 1

for i in a:
    ans = ans*i
    if ans > 1000000000000000000:
        ans = -1
        exit
    elif ans == 0:
        exit

print(ans)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
 
n = int(input())
a = list(map(int,input().split()))
ans = 1

for i in a:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
 
if 0 in a:
    ans = 0

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

if s == "ABC":
    print("ARC")
else:
    print("ABC)

Fixed submission:
s = str(input())

if s == "ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
h = list(map(int,input().split()))
r = []
cnt = 0

for i in range(m):
    i = list(map(int,input().split()))
    r.append(i)

r = [e for row in r for e in row]

for i in range(n):
    flag = 0
    for j in range(0,m,2):
        if h[i] == h[r[j]]:
            if h[i] < h[r[j+1]]:
                flag += 1
                break
        elif h[i] == h[r[j+1]]:
            if h[i] < h[r[j]]:
                flag += 1
                break
    if flag == 0:
        cnt += 1

print(cnt)

Fixed submission:
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
memo = [0]*n
 
for _ in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    if memo[a] < h[b]:
        memo[a] = h[b]
    if memo[b] < h[a]:
        memo[b] = h[a]

for i in range(n):
    if memo[i] < h[i]:
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
ans = 0
tmp = 0


for i in range(n+1):
    tmp = ((a*i)//b)-a*(i//b)
    if tmp > ans:
        ans = tmp
        tmp = 0

print(ans)

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

if b > n:
    print((a*n)//b)
elif b <= n:
    print((a*(b-1))//b)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
l = x = [int(i) for i in input().split()]
l_sum = sum(l)
cnt = 0
 
for i in range(N):
    if l[i] > (1//(4*M))*l_sum:
        cnt += 1
 
if cnt >= M:
    print("Yes")
else:
    print("No") 

Fixed submission:
x,y,z = map(int,input().split())
print(z,x,y)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list((i for i in A if i % 2 == 0))

count = 0

for i in B:
    if i%3 == 0 or i%5 == 0:
        count += 1
    else:
        count += 0

if int(count) == int(len(B)):
    print("APROVED")
else:
    print("DENIED")

Fixed submission:
A = list(map(int,input().split()))
A_unique = list(set(A))
A_length = len(A_unique)

if A_length == 2:
    print("Yes")

else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
H,A = map(int,input().split())
cnt = 0

while True:
    if H < A:
        cnt += 1
        break
    elif H > A:
        H = H - A
        cnt += 1

print(cnt)

Fixed submission:
H,A = map(int,input().split())
cnt = 0

while H > 0:
    H = H - A
    cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
m = list(map(int,input().split()))
m.sort()

ans = 0
for i in range(n):
    for j in range(i+1,n):
        l = j
        r = n
        while r-l>1:
            mid = (r+l)//2
            if m[mid] < m[i]+m[j] and m[i] < m[mid]+m[j] and m[j] < m[mid]+m[i]:
                l = mid
            else:
                r = mid
        ans += l-j

print(ans)

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

ans = 0
for i in range(n):
    for j in range(i+1,n):
        l = j
        r = n
        while r-l>1:
            mid = (r+l)//2
            if m[mid] < m[i]+m[j] and m[i] < m[mid]+m[j] and m[j] < m[mid]+m[i]:
                l = mid
            else:
                r = mid
        ans += l-j

print(ans)