Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02658 (python)

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

def ans(a):
    if 0 in a:
        return 0
    n = 1
    for i in a:
        n *= i
        if n > 10**18:
            return -1
    return n

print(ans(a))

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

def ans(a):
    if 0 in a:
        return 0
    n = 1
    for i in a:
        n *= i
        if n > 10**18
            return -1
    return n

print(ans(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
from decimal import *
import numpy as np
a = np.array(list(map(Decimal, input().split())))
p = np.prod(a, axis=0)
if p > 10**18:
    print(-1)
else:
    print(p)

Buggy submission (verdict: Runtime Error):
n = int(input())
from decimal import *
import numpy as np
a = np.array(list(map(Decimal, input().split())))
p = np.prod(a, axis=0)
if p > 10**18:
    print(-1)
else:
    print(p)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
p = 1
if 0 in n:
    print(0)
    exit()
for i in range(n):
    p = p * a[i]
if p > 10**18:
    print(-1)
else:
    print(p)
Problem p02681 (python)

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

if len(t) - len(s) != 1:
    print('No')
else:
    if s == t[0:-1] and t[-1].isalpha() and t[-1].islower():
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
a, b, c, k = list(map(int, input().split()))
s = 0

if k >= a:
    s = a
if (k - a - b) >= 0:
    s -= k - a - b

print(s)
Problem p02658 (python)

Fixed submission:
n=int(input())
a=list(input().split())
ans=1
f=0
i=0
while(i<n):
    if f==0:
        ans=ans*int(a[i])
    if f==0 and ans>1000000000000000000:
        f=1
    if int(a[i])==0:
        print(0)
        exit()
    i+=1
if f==1:
    print(-1)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
b1=int(b*100)
a1=int(a)
ans=int(a1*b1/100)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(input().split())
ans=1
f=0
i=0
p=0
while(i<n):
    if f==0:
        if i==n-1:
            p=1
            ans=ans*int(a[i])
        else:
            ans=ans*int(a[i])*int(a[i+1])
    if f==0 and ans>1000000000000000000:
        f=1
    if int(a[i])==0:
        print(0)
        exit()
    if p==0:
        if int(a[i+1])==0:
            print(0)
            exit()
    i+=2
if f==1:
    print(-1)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(input().split())
ans=1
f=0
i=0
while(i<=n):
    if i==n-1:
        ans=ans*int(a[i])
    else:
        ans=ans*int(a[i])*int(a[i+1])
        i+=1
    if f==0 and ans>1000000000000000000:
        f=1
    if ans==0:
        print(0)
        exit()
    i+=2
if f==1:
    print(-1)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(input().split())
ans=1
for i in a:
    ans=ans*int(i)
    if f==0 and ans>1000000000000000000:
        f=1
    if int(i)==0:
        f=0
        print(0)
if f==1:
    print(-1)
    exit()
print(ans)
Problem p02664 (python)

Fixed submission:
t=list(input())
for i in range(len(t)):
    if t[i]=="?":
        t[i]="D"
    print(t[i],end='')

Buggy submission (verdict: Runtime Error):
t=list(input())
for i in range(len(t)):
    if t[i]=="?":
        t[i]=D
    print(t[i],end="")

Buggy submission (verdict: Runtime Error):
t=list(input())
for i in range(len(t)):
    if t[i]=='?':
        t[i]=D
    print(t[i],end="")
Problem p02684 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(input().split())
p = [0]*200000
q = [0]*200000
p[0]=1
p[1]=int(a[0])
q[0]=1
q[p[1]-1]=2
f=0
for i in range(k-1):
    p[i+2]=int(a[p[i+1]-1])
    if q[p[i+2]-1]>0:
        r=q[p[i+2]-1]-1
        q=i+2-r
        f=1
        l=k-r
        l%=q
        s=p[r+l]
        break
    if f==1:
        break
    q[p[i+2]-1]=i+3
if f==0:    
    print(p[k])
else:
    print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(input().split())
p = [0]*200000
q = [0]*200000
p[0]=1
p[1]=int(a[0])
q[0]=1
q[p[1]-1]=2
f=0
for i in range(k-1):
    p[i+2]=int(a[p[i+1]-1])
    if q[p[i+2]-1]>0:
        r=q[p[i+2]-1]-1
        q=i+2-r
        f=1
        break
    if f==1:
        break
    q[p[i+2]-1]=i+3
l=k-r
l%=q
s=p[r+l]
if f==0:    
    print(p[k])
else:
    print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(input().split())
p = [0]*200000
q = [0]*200000
p[0]=1
p[1]=int(a[0])
q[0]=1
q[p[1]-1]=2
f=0
for i in range(k-1):
    p[i+2]=int(a[p[i+1]-1])
    if q[p[i+2]]>0:
        r=q[p[i+2]]
        q=i+2-r
        f=1
        break
    if f==1:
        break
    q[p[i+2]]=i+3
l=k-r
l%=q
s=p[r+l]
if f==0:    
    print(p[k])
else:
    print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(input().split())
p = [0]*200000
p[0]=1
p[1]=int(a[0])
f=0
for i in range(k-1):
    p[i+2]=int(a[p[i+1]-1])
    for j in range(i+2):
        if p[i+2] == p[j]:
            r=j
            q=i+2-j
            f=1
            break
    if f==1:
        break
l=k-r
l%=q
s=p[r+l]
if f==0:    
    print(p[k])
else:
    print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(input().split())
p[0]=int(a[0])-1
f=0
for i in range(k-1):
    p[i+1]=int(a[p])-1
    for j in range(i+1):
        if p[i+1] == p[j]:
            r=j
            q=j-i-1
            f=1
            break
    if f==1:
        break
k-=r
k%=q
s=p[r+k-1]
if f==0:    
    print(p[k-1]+1)
else:
    print(s)
Problem p02995 (python)

Fixed submission:
import fractions
def lcm(C,D):
    return C*D//fractions.gcd(C,D)
A,B,C,D = map(int, input().split())
b = (B - B//C - B//D + B//lcm(C,D))
a = ((A-1) - (A-1)//C- (A-1)//D + (A-1)//lcm(C,D))
print(b-a)

Buggy submission (verdict: Runtime Error):
import fractions
def lcm(C,D):
    return C*D/fractions.gcd(C,D)
A,B,C,D = map(int, input().split())
X = B - A
print(X - int(X/C) - int(X/D) + int(X/(C*D/math.gcd(C,D))))

Buggy submission (verdict: Runtime Error):
import math
def lcm(C,D):
    return int(C*D/math.gcd(C,D))
A,B,C,D = map(int, input().split())
X = B - A + 1
print(int(X - X/C - X/D + X/lcm(C,D)))
Problem p03005 (python)

Fixed submission:
N, K = map(int, input().split())
if K == 1:
    print(0)
elif N > K:
    print(N - K)
elif N == K:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np
costs = []
N = int(input())
x, y = [], []
# (x,y)の値を取得
for n in range(N):
    temp = list(map(int, input().split()))
    x.append(temp[0])
    y.append(temp[1])
# コスト計算
for n, perm in enumerate(itertools.permutations(zip(x,y), N)):
    sol = 0
    cost = 1
    for i in range(1, N):
        if i == 1:
            sol = [perm[i][0] - perm[i-1][0], perm[i][1] - perm[i-1][1]]
        else:
            if perm[i][0] - sol[0] == perm[i-1][0] and perm[i][1] - sol[1] == perm[i-1][1]:
                cost += 0
            else:
                cost += 1
    costs.append(cost)
print(np.min(costs))
Problem p03006 (python)

Fixed submission:
N = int(input())
arr = sorted([list(map(int, input().split())) for _ in range(N)])
cnt = {}
for i in range(N):
    for j in range(i+1,N):
        pq = (arr[j][0] - arr[i][0], arr[j][1] - arr[i][1])
        cnt.setdefault(pq, 0)
        cnt[pq] += 1
print(1 if cnt == {} else N - max(cnt.values()))

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np
from sympy import *
p = Symbol('p')
q = Symbol('q')
costs = []
N = int(input())
x, y = [], []
# (x,y)の値を取得
for n in range(N):
    temp = list(map(int, input().split()))
    x.append(temp[0])
    y.append(temp[1])
# コスト計算
for n, perm in enumerate(itertools.permutations(zip(x,y), N)):
    sol = 0
    cost = 1
    for i in range(1, N):
        if i == 1:
            sol = solve([perm[i][0]-p-perm[i-1][0], perm[i][1]-q-perm[i-1][1]], [p,q])
            #print(sol)
        else:
            if perm[i][0] - sol[p] == perm[i-1][0] and perm[i][1] - sol[q] == perm[i-1][1]:
                cost += 0
            else:
                cost += 1
    costs.append(cost)
#print(costs)
print(np.min(costs))
Problem p03408 (python)

Fixed submission:
N = int(input())
s, t = [], []
for n in range(N):
  s.append(input())

M = int(input())
for m in range(M):
  t.append(input())

name_union = set(s) | set(t)
money = {}
for i, n in enumerate(name_union):
  money.setdefault(n, 0)
  money[n] += sum(map(lambda x: 1 if x == n else 0, s))
  money[n] -= sum(map(lambda x: 1 if x == n else 0, t))
#print(money)
#print(money.values())
print(0 if max(money.values()) < 0 else max(money.values()))

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]

name_union = set(s) | set(t)
money = {}0
for i, n in enumerate(name_union):
  money.setdefault(n, 0)
  money[n] += sum(map(lambda x: 1 if x == n else 0, s))
  money[n] -= sum(map(lambda x: 1 if x == n else 0, t))
print(0 if max(money.values()) < 0 else max(money.values()))
Problem p02761 (python)

Fixed submission:
import numpy as np
n,m = map(int,input().split())
base = np.zeros(n)
seen = np.zeros(n)
base[0] = 1
sign = 0

for i in range(m):
  s,c = map(int,input().split())
  if (seen[s-1] == 0) or (base[s-1] == c):
    base[s-1] = c
    seen[s-1] = 1
    sign = 1
  else:
    sign = 2
    break
ans = 0
if (sign == 2) or ((base[0] == 0) and (n > 1)):
  ans = -1
else:
  for i in range(1,len(base)+1):
    ans += base[-i]*(10**(i-1))
    
if (m == 0) and (n == 1):
  ans = 0
print(int(ans))

Buggy submission (verdict: Runtime Error):
import numpy as np

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

matrix = np.ones(num[0]) * (-1)
sign_0 = []
sign_1 = []
ans = 0

if num[1] == 0:
  if not matrix[0] == 0:
    ans = 10**(num[0]-1)
  elif matrix[0] == 0:
    ans = -1

elif not num[1] == 0:
  for i in range(0,num[1]):
    temp = list(map(int,input().split()))
    if (temp[0] in sign_0 and) (temp not in sign_1) :
      ans = -1
      break
    else:
      matrix[temp[0]-1] = temp[1]
      sign_0.append(temp[0])
      sign_1.append(temp)
  
  if not ans == -1:
    if matrix[0] == -1:
       matrix[0] = 1
        
    for i in range(1,num[0]):
      if matrix[i] == -1:
        matrix[i] = 0
        
    ans = matrix[0]*(10**(num[0]-1))
    
    for i in range(1,num[0]):
      ans = ans + matrix[i]*(10**(num[0]-1-i))
    ans = int(ans)
      
  judge_a = len(list(str(ans)))
  judge = judge_a - num[0]
  
  if not judge == 0:
    ans = -1
    
  
print(int(ans))
Problem p02791 (python)

Fixed submission:
num = [input() for i in range(2)]
num_0 = int(num[0])
num_1 = list(map(int, num[1].split()))

num_min = num_1[0]
count = 0

for i in range(0,num_0):
  if(num_min >= num_1[i]):
    count = count+1
    num_min = num_1[i]
    
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np

num = np.array(list(map(int, input().split())))

history = []
count = 0

for i in range(0,num[0]):
    history.append(num[i+1])
    num_min = np.min(history)
    if(num[i+1] <= num_min):
        count = count + 1

print(count)

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

history = []
count = 0

for i in range(0,num[0]):
    history.append(num[i+1])
    num_min = np.min(history)
    if(num[i+1] <= num_min):
        count = count + 1

print(count)

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

history = []
count = 0

for i in range(0,num[0]):
    history.append(num[i+1])
    num_min = np.min(history)
    if(num[i+1] <= num_min):
        count = count + 1

print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np

num=np.array(list(map(int,input().split())))

history = []
count = 0

for i in range(0,num[0]):
    history.append(num[i+1])
    num_min = np.min(history)
    if(num[i+1] <= num_min):
        count = count + 1

print(count)
Problem p03244 (python)

Fixed submission:
n = int(input())
base = list(map(int,input().split()))
even = [0]*(10**5)
odd = [0]*(10**5)

for i in range(1,n+1):
  sign = i%2
  num = base[i-1]
  
  if sign == 0:
    even[num-1] += 1
  elif sign == 1:
    odd[num-1] += 1

ans_e = max(even)
ans_o = max(odd)
even_i = even.index(ans_e)
odd_i = odd.index(ans_o)

if even_i == odd_i:
  even.sort()
  odd.sort()
  if even[10**5 - 2] <= odd[10**5 - 2]:
    ans_o = odd[10**5 - 2]
  else:
    ans_e = even[10**5 - 2]
  
print(n - ans_e - ans_o)

Buggy submission (verdict: Runtime Error):
n = int(input())
base = list(map(int,input().split()))
even = [0]*(10**5)
odd = [0]*(10**5)

for i in range(1,n+1):
  sign = i%2
  num = base[i-1]
  
  if sign == 0:
    even[num] += 1
  elif sign == 1:
    odd[num] += 1

ans_e = max(even)
ans_o = max(odd)
even_i = even.index(ans_e)
odd_i = odd.index(ans_o)

if even_i == odd_i:
  even.sort()
  odd.sort()
  if even[10**5 - 2] <= odd[10**5 - 2]:
    ans_o = odd[10**5 - 2]
  else:
    ans_e = even[10**5 - 2]
  
print(n - ans_e - ans_o)

Buggy submission (verdict: Runtime Error):
n = int(input())
base = list(map(int,input().split()))
even = [0]*(10**5)
odd = [0]*(10**5)

for i in range(1,n+1):
  sign = i%2
  num = base[i-1]
  
  if sign == 0:
    even[num] += 1
  elif sign == 1:
    odd[num] += 1

ans_e = max(even)
ans_o = max(odd)
even_i = even.index(ans_e)
odd_i = odd.index(ans_o)

if even_i == odd_i:
  even.sort()
  odd.sort()
  if even[10*5 - 2] <= odd[10*5 - 2]:
    ans_o = odd[10**5 - 2]
  else:
    ans_e = even[10**5 - 2]
  
print(n - ans_e - ans_o)

Buggy submission (verdict: Runtime Error):
n = int(input())
base = list(map(int,input().split()))
even = [0]*100000
odd = [0]*100000

for i in range(n):
  sign = i%2
  num = base[i]
  if sign == 0:
    even[num] += 1
  elif sign == 1:
    odd[num] += 1

ans_e = max(even)
ans_o = max(odd)
even_i = even.index(ans_e)
odd_i = odd.index(ans_o)

if even_i == odd_i:
  even.sort()
  odd.sort()
  if even[10*5 - 2] <= odd[10*5 - 2]:
    ans_o = odd[10*5 - 2]
  else:
    ans_e = even[10*5 - 2]
  
print(n - ans_e - ans_o)
Problem p03274 (python)

Fixed submission:
n,k = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**9
  
for i in range(n-k+1):
  if x[k-1+i]*x[i] < 0:
    if x[k-1+i] <= abs(x[i]) :
      temp = 2*x[k-1+i] - x[i]
    elif abs(x[i]) < x[k-1+i]:
      temp = x[k-1+i] - 2*x[i]
      
  elif (0 <= x[i]):
    temp = x[k+i-1]

  elif (x[k+i-1] <= 0):
    temp = -x[i]
    
  if temp < ans:
    ans = temp
    
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**9
  
for i in range(n-k+1):
  if x[k-1+i]*x[i] < 0:
    if x[k-1+i] <= abs(x[i]) :
      temp = 2*x[k-1+i] - x[i]
    elif abs(x[i]) < x[k-1+i]:
      temp = x[k-1+i] - 2*x[i]
      
  elif (0 <= x[i]):
    temp = x[k+i-1]

  elif (x[k+i-1] <= 0) and ():
    temp = -x[0]
    
  if temp < ans:
    ans = temp
    
print(ans)
Problem p03436 (python)

Fixed submission:
import queue
import numpy as np

num = list(map(int,input().split()))
field = [list(input()) for i in range(num[0])]
seen = np.zeros((num[0],num[1]))

step_r = [1,0,-1,0]
step_c = [0,1,0,-1]
q_r = queue.Queue()
q_c = queue.Queue()
sign = 0
white = 0
q_r.put(0)
q_c.put(0)

for i in range(num[0]):
  for j in range(num[1]):
    if field[i][j] == ".":
      white = white + 1

while not q_r.empty():
  r = q_r.get()
  c = q_c.get()
  for i in range(4):
    next_r = r + step_r[i]
    next_c = c + step_c[i]
    
    if (next_r<0) or (num[0]<=next_r) or (next_c<0) or (num[1]<=next_c) or (field[next_r][next_c] == "#"):
      continue
      
    if seen[next_r][next_c] == 0:
      q_r.put(next_r)
      q_c.put(next_c)
      seen[next_r][next_c] = seen[r][c] + 1
      if (next_r == num[0]-1) and (next_c == num[1]-1):
        g_r = next_r
        g_c = next_c
        sign = 1
        break
 
  if sign == 1:
    break

if sign == 1:
  ans = white - (seen[g_r][g_c] + 1)
elif sign == 0:
  ans = -1

print(int(ans))

Buggy submission (verdict: Runtime Error):
import queue
import numpy as np

num = list(map(int,input().split()))
field = [list(input()) for i in range(num[0])]
seen = np.zeros((num[0],num[1]))

step_r = [1,0,-1,0]
step_c = [0,1,0,-1]
q_r = queue.Queue()
q_c = queue.Queue()
sign = 0
white = 0
q_r.put(0)
q_c.put(0)

for i in range(num[0]):
  for j in range(num[1]):
    if field[i][j] == ".":
      white = white + 1

while not q_r.empty():
  r = q_r.get()
  c = q_c.get()
  for i in range(4):
    next_r = r + step_r[i]
    next_c = c + step_c[i]
    
    if (next_r<0) or (num[0]<=next_r) or (next_c<0) or (num[1]<=next_c) or (field[next_r][next_c] == "#"):
      continue
      
    if seen[next_r][next_c] == 0:
      q_r.put(next_r)
      q_c.put(next_c)
      seen[next_r][next_c] = seen[r][c] + 1
      if (next_r == num[0]-1) and (next_c == num[1]-1):
        g_r = next_r
        g_c = next_c
        sign = 1
        break
 
  if sign == 1:
    break
    
ans = white - (seen[g_r][g_c] + 1)
print(int(ans))
Problem p03565 (python)

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

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0]) or "?"]

if n_s >= n_t:
  for i in base:
    if n_s - i >= n_t:
      sign = 0
      for j in range(i,i+n_t):
        if not ((s[j] == t[j-i]) or (s[j] == "?")):
          sign = 1
        
      if sign == 0:
        last_num = i

  if last_num != -1:
    for i in range(last_num,last_num + n_t):
      if s[i] == "?":
        s[i] = t[i-last_num]
    
    if s[0] == "?":
      ans = "a"
    else:
      ans = str(s[0])
                  
    for j in range(1,n_s):
      if s[j] == "?":
        s[j] = "a"
      ans = ans + s[j]
    
  elif last_num == -1:
    ans = "UNRESTORABLE"

else:
  ans = "UNRESTORABLE"

print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0]) or "?"]

if n_s >= n_t:
  for i in base:
    if n_s - i >= n_t:
      sign = 0
      for j in range(i,i+n_t):
        if not ((s[j] == t[j-i]) or (s[j] == "?")):
          sign = 1
        
      if sign == 0:
        last_num = i

  if last_num != -1:
    for i in range(last_num,last_num + n_t):
      if s[i] == "?":
        s[i] = t[i-last_num]
    
    if s[0] == "?":
      ans = "a"
      
    for j in range(1,n_s):
      if s[j] == "?":
        s[j] = "a"
      ans = ans + s[j]
    
  elif last_num == -1:
    ans = "UNRESTORABLE"

else:
  ans = "UNRESTORABLE"

print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0])]

if n_s >= n_t:
  for i in base:
    if n_s - i >= n_t:
      sign = 0
      for j in range(i,i+n_t):
        if not ((s[j] == t[j-i]) or (s[j] == "?")):
          sign = 1
        
      if sign == 0:
        last_num = i

  if last_num != -1:
    for i in range(last_num,last_num + n_t):
      if s[i] == "?":
        s[i] = t[i-last_num]
    
    if s[0] == "?":
      ans = "a"
      
    for j in range(1,n_s):
      if s[j] == "?":
        s[j] = "a"
      ans = ans + s[j]
    
  elif last_num == -1:
    ans = "UNRESTORABLE"

else:
  ans = "UNRESTORABLE"

print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0])]

for i in base:
  if n_s - i >= n_t:
    sign = 0
    for j in range(i,i+n_t):
      if not ((s[j] == t[j-i]) or (s[j] == "?")):
        sign = 1
        
    if sign == 0:
      last_num = i

if last_num != -1:
  for i in range(last_num,last_num + n_t):
    if s[i] == "?":
      s[i] = t[i-last_num]
    
  if s[0] == "?":
    ans = "a"
      
  for j in range(1,n_s):
    if s[j] == "?":
      s[j] = "a"
    ans = ans + s[j]
    
elif last_num == -1:
  ans = "UNRESTORABLE"
  
print(ans)
Problem p02687 (python)

Fixed submission:
S=input()
T=""
if S=="ARC":
   T="ABC"
else: T="ARC"
print(T)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
H=list(map(int,input().split()))
ABmap=[[] for i in range(N)]
count=0
for i in range(M):
    A,B=map(lambda x:x-1,map(int,input().split()))
    ABmap[A].append(H[B])
    ABmap[B].append(H[A])
        
for i in range(N):
    #print(ABmap[i])
    #print(ABmap.count(H[i]))
    if max(ABmap[i])<H[i]:
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
H=list(map(int,input().split()))
ABmap=[[0 for i in range(N)] for i in range(N)]
count=0
for i in range(M):
    A,B=map(lambda x:x-1,map(int,input().split()))
    ABmap[A][B]=H[B]
    ABmap[B][A]=H[A]
        
for i in range(N):
    #print(ABmap[i])
    #print(ABmap.count(H[i]))
    if max(ABmap[i])<H[i]:
        count+=1
print(count)
Problem p02765 (python)

Fixed submission:
N=input().split()

Naibu = int(N[1]) + 100*(10-int(N[0]))
if int(N[0])<=9:
    print(Naibu)
else:
    print(N[1])

Buggy submission (verdict: Runtime Error):
N=input()
R=input()
Naibu = int(R) + 100*(10-int(N))
if int(N)<=9:
    print(Naibu)
else:
    print(R)
Problem p02909 (python)

Fixed submission:
W = ["Sunny","Cloudy","Rainy","Sunny"]
M = input()
print(W[W.index(M)+1])

Buggy submission (verdict: Runtime Error):
W = ["Sunny","Cloudy","Rainy"]
M = input()
print(W[W.index(M)+1])
Problem p02921 (python)

Fixed submission:
S = input()
T = input()
C = 0
for i in range(len(S)):
    if S[i] == T[i]:
        C += 1
print(C)

Buggy submission (verdict: Runtime Error):
S = input().split()
T = input().split()
C = 0
for i in range(3):
    if S[i] == T[i]:
        C += 1
print(C)

Buggy submission (verdict: Runtime Error):
S,T = input().split()
C = 0
for i in range(len(S)):
    if S[i] == T[i]:
        C += 1
print(C)
Problem p03485 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
A = int((a+b)/2)
print(A if ((a+b)%2 == 0 else int(A+0.5))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
A = int((a+b)/2)
print(A if (A%2 == 0 else int(A+0.5))
Problem p02787 (python)

Fixed submission:
''' Hey stalker :) '''
INF = 10**10
def main():
    #print = out.append
    ''' Cook your dish here! '''
    h, n = get_list()
    wepons = dict()
    for _ in range(n):
        a,b = get_list()
        if a in wepons:
            wepons[a] = min(b, wepons[a])
        else: wepons[a] = b
    dp = [0]*(h+1)
    for i in range(1, h+1):
        ans = INF
        for wp in wepons:
            if wp>i: ans = min(ans, wepons[wp])
            else: ans = min(ans, wepons[wp] + dp[i-wp])
        dp[i] = ans
    print(dp[-1])

''' Pythonista fLite 1.1 '''
import sys
#from collections import defaultdict, Counter
#from bisect import bisect_left, bisect_right
#from functools import reduce
#import math
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
print(*out, sep='\n')

Buggy submission (verdict: Runtime Error):
''' Hey stalker :) '''
INF = 10**10
def main():
    #print = out.append
    ''' Cook your dish here! '''
    h, n = get_list()
    wepons = dict()
    for _ in range(n):
        a,b = get_list()
        if a in wepons:
            wepons[a] = min(b, wepons[a])
        else: wepons[a] = b

    dp = [-1]*(h+1)
    dp[0] = 0
    #print(wepons)
    def calc(n):
        if n<0: return 0
        if dp[n]!=-1: return dp[n]
        #print(n)
        cst = INF
        for wepon in wepons:
            #print(n-wepon)
            cst = min(cst, calc(n-wepon) + wepons[wepon])
        dp[n] = cst
        #print(n, cst)
        return cst
    print(calc(h))


''' Pythonista fLite 1.1 '''
import sys
#from collections import defaultdict, Counter
#from bisect import bisect_left, bisect_right
#from functools import reduce
#import math
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
print(*out, sep='\n')