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

Fixed submission:
k,s=map(int,input().split())
ret=0
k+=1
for i in range(k):
  for j in range(k):
    d=s-i-j
    if k>d>=0:
      ret+=1
print(ret)

Buggy submission (verdict: Runtime Error):
a,b,c = input().split(',')
print(a,b,c)

Buggy submission (verdict: Runtime Error):
def solve(K: int, S: int):
    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            z = S - x - y
            if z >= 0 and z <= K:
                cnt += 1
    print(cnt)
    return
 
 
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    solve(K, S)
 
if __name__ == '__main__':
    main()
#!/usr/bin/env python3
import sys


def solve(K: int, S: int):
    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            z = S - x - y
            if z >= 0 and z <= K:
                cnt += 1
    print(cnt)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    solve(K, S)

if __name__ == '__main__':
    main()
提出情報
Problem p02689 (python)

Fixed submission:
n,m=map(int,input().split())
h_list=list(map(int,input().split()))
lst=[0]*n
for _ in range(m):
  a,b=map(int,input().split())
  if h_list[a-1]<=h_list[b-1]:
    lst[a-1]-=1
  if h_list[a-1]>=h_list[b-1]:
    lst[b-1]-=1
print(lst.count(0))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
h_list=list(map(int,input().split))
col_list=[[0]*n for _ in range(n)]
count=0
for _ in range(m):
  a,b=map(int,input().split)
  col_list[a-1][b-1]+=1

for i in range(n):
  for j in range(n):
    if col_list[i][j]>=1 and h_list[i]<=h_list[j]:
      count+=1
      break
print(n-count)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
h_list=list(map(int,input().split))
col_list=[[0]*n]*n
count=0
for i in range(m):
  a,b=map(int,input().split)
  col_list[a-1][b-1]+=1

for i in range(n):
  for j in range(n):
    if col_list[i][j]>=1 and h_list[i]<=h_list[j]:
      count+=1
      break
print(n-count)
Problem p02725 (python)

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

ans=0
if max(a)<=(k/2.0) or min(a)>=(k/2.0):
  for i in range(n-1):
    ans+=abs(a[i+1]-a[i])
else:
  max_=0
  for i in range(n-1):
    max_=max(max_,abs(a[i+1]-a[i]))
  max_=max(max_,abs(a[0]-(a[n-1]-k)))
  ans=k-max_
print(ans)

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

ans=0
if max(a)<=(k/2.0) or min(a)>=(k/2.0):
  for i in range(n-1):
    ans+=abs(a[i+1]-a[i])
else:
  for i in range(n):
    if a[i]>k/2.0:
      a[i]-=k
    else:
      j=i
  for i in range(j):
     ans+=abs(a[i+1]-a[i])
  ans+=abs(a[n]-a[0])
  for i in range(j+1,n-1):
    ans+=abs(a[i+1]-a[i])
print(ans)

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

ans=0
if max(a)<=k/2.0 or min(a)>=k/2.0:
  for i in range(n):
    ans+=abs(a[i+1]-a[i])
else:
  for i in range(n):
    if a[i]>k/2.0:
      a[i]-=k
    else:
      j=i
  for i in range(j):
     ans+=abs(a[i+1]-a[i])
  ans+=abs(a[n]-a[0])
  for i in range(j+1,n):
    ans+=abs(a[i+1]-a[i])
print(ans)
Problem p02759 (python)

Fixed submission:
N=int(input())
if N%2==1:
    print(int(N/2)+1)
else:
    print(int(N/2))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
ans=[0]*N
s_1i=[]
s_2i=[]
s_3i=[]
for i in range(M):
    s[i],c[i]=map(int,input().split())
flg=0
for i in range(M):
    if s[i]==1 and c[i]==0:
        flg+=1
for i in range(M):
    if s[i]==1:
        s_1i.append(c[i])
    elif s[i]==2:
        s_2i.append(c[i])
    elif s[i]==3:
        s_3i.append(c[i])
if len(s_1i)>=2:
    if s_1i.count(s_1i[0])!=len(s_1i):
        flg+=1
if len(s_2i)>=2:
    if s_2i.count(s_2i[0])!=len(s_2i):
        flg+=1
if len(s_3i)>=2:
    if s_3i.count(s_3i[0])!=len(s_3i):
        flg+=1
if flg>=1:
    print("-1")
else:
    if (1 not in s) and (N!=1):
        ans[0]=1
    for i in range(M):
        ans[s[i]-1]=c[i]
    for i inrange(N):
        print(ans[i],end="")
Problem p02766 (python)

Fixed submission:
N,K=map(int,input().split())
i=0
while N>=K**i:
    i+=1
print(i)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
i=0
while N>K=**i:
    i+=1
print(i)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
i=0
while N>=k**i:
    i+=1
print(i)
Problem p03835 (python)

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

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
count=0
for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x+y+z=s:
        count+=1
print(count)
Problem p03221 (python)

Fixed submission:
#!/usr/bin/env python3
import sys

dic = {}

def list_sort(x):
    values = dic[x]
    values.sort()

    return {x: values}

def solve(N: int, M: int, P: "List[int]", Y: "List[int]"):
    for i in range(N):
        dic[i + 1] = []
    
    for i in range(M):
        dic[P[i]].append(Y[i])

    sorted_dic = {}
    for key in dic.keys():
        tmp = {}
        values = dic[key]

        values.sort()
        for i in range(len(values)):
            tmp[values[i]] = i + 1

        sorted_dic[key] = tmp


    for m in range(M):
        key = P[m]
        value = Y[m]
        sorted_ranked_dic = sorted_dic[key]
        rank = sorted_ranked_dic[value]

        print('{0:06d}'.format(key, rank) + '{0:06d}'.format(rank))



    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    P = [int()] * (M)  # type: "List[int]"
    Y = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        P[i] = int(next(tokens))
        Y[i] = int(next(tokens))
    solve(N, M, P, Y)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from itertools import *
from operator import itemgetter

def solve(N: int, M: int, P: "List[int]", Y: "List[int]"):
    sorted_list = [(P[i], Y[i]) for i in range(M)]
    sorted_list.sort()

    group_list = dict((key, list(map(lambda x: x[1], items))) for key, items in groupby(sorted_list, key = itemgetter(0)))
    for i in range(N + 1):
        key = P[i]
        rank = group_list[P[i]].index(Y[i]) + 1
        print('{0:06d}'.format(key, rank) + '{0:06d}'.format(rank))

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    P = [int()] * (M)  # type: "List[int]"
    Y = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        P[i] = int(next(tokens))
        Y[i] = int(next(tokens))
    solve(N, M, P, Y)

if __name__ == '__main__':
    main()
Problem p02701 (python)

Fixed submission:
n = int(input())
items = [input() for _ in range(n)]

print(len(list(set(items))))

Buggy submission (verdict: Runtime Error):
n = int(input())
items = [input() for _ in range(n)]

print(len(list(set(items)))
Problem p02754 (python)

Fixed submission:
n, a, b = map(int, input().split())
period = a+b
times = n//period
k = n%period
n =  a if k >a else k
print(times*a + n)

Buggy submission (verdict: Runtime Error):
n, blue, red = [int(x) for x in input().split()]

balls = "b"*blue + "r"*red

x = 0
if balls != "":
    x = n // len(balls) + 1

row = balls*x

print(row[:n].count("b"))

Buggy submission (verdict: Runtime Error):
n, blue, red = [int(x) for x in input().split()]

balls = "b"*blue + "r"*red
x = n // len(balls) + 1

row = balls*x

print(row[:n].count("b"))

Buggy submission (verdict: Runtime Error):
n, blue, red = [int(x) for x in input().split()]

row = ""
while len(row) <= n:
    row += "b"*blue + "r"*red

print(row[:n].count("b"))
Problem p02777 (python)

Fixed submission:
[S, T] = input().split()
[A, B] = [int(x) for x in input().split()]
U = input()

if U == S:
    print(A-1, B)
else:
    print(A, B-1)

Buggy submission (verdict: Runtime Error):
[S, T] = input().split()
[A, B] = input().split()
U = input()

if U == S:
    print(f"{int(A)-1} {B}")
else:
    print(f"{A} {int(B) - 1}")

Buggy submission (verdict: Runtime Error):
[S, T] = input().split()
[A, B] = input().split()
U = input()
 
if U == S:
    print(f"{int(A)-1} {B}")
else:
    print(f"{A} {int(B) - 1}")

Buggy submission (verdict: Runtime Error):
[S, T] = input().split()
print(S)
print(T)

[A, B] = input().split()

U = input()

if U == S:
    print(f"{int(A)-1} {B}")
else:
    print(f"{A} {int(B) - 1}")

Buggy submission (verdict: Runtime Error):
X = input().split()
S = X[0]
T = X[1]
Y = input().split()
A = int(Y[0])
B = int(Y[1])
U = input()
 
A -= 1 if U == S else B -= 1
 
print(str(A) + " " + str(B))

Buggy submission (verdict: Runtime Error):
X = input().split()
S = X[0]
T = X[1]
Y = input().split()
A = int(Y[0])
B = int(Y[1])
U = input()

A -= 1 if U == S else B-= 1

print(A + " " + B)
Problem p02829 (python)

Fixed submission:
A = input()
B = input()
 
choices = "123"
answer = [x for x in choices if x != A and x != B]

print(int(answer[0]))

Buggy submission (verdict: Runtime Error):
number_of_guests = input().split()

A = int(number_of_guests[0])
B = int(number_of_guests[1])


A_divisors = []
x = 2
while True:
    if (A % x == 0):
        A /= x
        A_divisors.append(x)
    else:
        x += 1

    if (A <= 1):
        break

y = 2
B_divisors = []
while True:
    if (B % y == 0):
        B /= y
        B_divisors.append(y)
    else:
        y += 1

    if (B <= 1):
        break

A_only = [x for x in A_divisors if (x not in B_divisors)]
B_only = [y for y in B_divisors if (y not in A_divisors)]

common_divisors = []
for z in (A_divisors + B_divisors):
    if z in A_divisors and z in B_divisors:
        if (A_divisors.count(z) >= B_divisors.count(z)):
            common_divisors.append(z**A_divisors.count(z))
        else:
            common_divisors.append(z**B_divisors.count(z))

        A_divisors = list(filter(lambda x: x != z, A_divisors))
        B_divisors = list(filter(lambda x: x != z, B_divisors))


result = 1
for x in A_only + B_only + common_divisors:
    result *= x

print(result)
Problem p02831 (python)

Fixed submission:
import fractions
import math

a,b = map(lambda x:int(x), input().split())


print(math.ceil(a*b/fractions.gcd(a,b)))

Buggy submission (verdict: Runtime Error):
import math

a,b = map(lambda x:int(x), input().split())


print(math.ceil(a*b/math.gcd(a,b)))

Buggy submission (verdict: Runtime Error):
import math

a,b = map(lambda x:int(x), input().split())

print(math.ceil(a*b/math.gcd(a,b)))
Problem p02682 (python)

Fixed submission:
a, b, c, k = [int(x) for x in input().split()]
 
if k <= a:
  print(k)
elif a < k and k<= a+b:
  print(a)
else:
  print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
a, b, c, k = [int(x) for x in input().split()]

ab = a+b
abc = a+b+c

if k <= a:
  print(k)
elif k<= ab:
  print(k):
else:
  print(a-(k-ab))
Problem p03072 (python)

Fixed submission:
N = int(input())
h_vals = input().split(' ')
h_vals = [int(h) for h in h_vals]
hmax = -1
count = 0
for h in h_vals:
  if hmax <= h:
  	hmax = h
  	count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
h_vals = input().split(' ')
hmax = -1
count = 0
for h in h_vals:
  if hmax <= h:
  	hmax = h
  	count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
h_vals = input().split(' ')
hmax = -1
count = 0
for h in h_vals:
  if hmax <= h
  	hmax = h
  	count+=1
print(count)
Problem p03073 (python)

Fixed submission:
s=input()
n=len(s)
s = int(s, 2)
s_10 = '1' * (n % 2) + '01' * (n // 2)
s_01 = '0' * (n % 2) + '10' * (n // 2)
s_10 = int(s_10, 2)
s_01 = int(s_01, 2)
r = bin(s ^ s_01)
l = bin(s ^ s_10)
print(min(r.count('1'), l.count('1')))

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
s = bin(int(s, 2))
s_10 = '1' * (n % 2) + '01' * (n // 2)
s_01 = '0' * (n % 2) + '10' * (n // 2)
s_10 = bin(int(s_10, 2))
s_01 = bin(int(s_01, 2))
r = s ^ s_01
l = s ^ s_10
print(min(r.count('1'), l.count('1')))
Problem p02707 (python)

Fixed submission:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
ans = np.zeros(N)
for a in A:
    ans[a-1] += 1
for o in ans:
    print(int(o))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
ans = np.zeros(N)
for a in A:
    ans[a-1] += 1
for o in ans:
    print(int(o))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = np.array(list(map(int, input().split())))
ans = np.zeros(N)
for a in A:
    ans[a-1] += 1
for o in ans:
    print(int(o))

Buggy submission (verdict: Runtime Error):

N = int(input())
A = np.array(list(map(int, input().split())))
ans = np.zeros(N)
for a in A:
    ans[a-1] += 1
for o in ans:
    print(int(o))
Problem p02689 (python)

Fixed submission:
n,m=map(int,input().split())
l=list(map(int,input().split()))
tmp=[0]*n

for i in range(m):
    a,b=map(int,input().split())
    if l[a-1] >= l[b-1]:
        tmp[b-1]=-1
    if l[a-1] <= l[b-1]:
        tmp[a-1]=-1

print(tmp.count(0))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=list(map(int,input().split()))
tmp=[0]*n

for i in range(m):
    a,b=map(int,input().split())
    if l[a-1] >= l[b-1]:
        tmp[b-1]=-1
    if l[a-1] <= l[b-1]
        tmp[a-1]=-1

print(tmp.count(0))
Problem p02771 (python)

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

if a == b and b == c:
    cnt += 1
elif  a != b and b != c and a != c:
    cnt += 1
else:
    pass

if cnt == 1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
cnt = 1

if a == b and b == c:
    cnt += 1
else a<>b and b<>c:
    cnt += 1

if cnt == 1:
    print("Yes")
else:
    print("No")
Problem p02773 (python)

Fixed submission:
n=int(input())
d=dict()

for i in range(n):
  a=input()
  d.setdefault(a,0)
  d[a] += 1

mx=0
result=[]
for key,value in d.items():
  if mx < value:
    mx = value
    result=[key]
  elif mx == value:
    result.append(key)

result.sort()

for i in range(len(result)):
  print(result[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
d=dict()

for i in range(n):
  a=input()
  d.setdefault(s,0)
  d[s] += 1

mx=0
result=[]
for key,value in d.items:
  if mx < value:
    mx = value
    result=[key]
  elif mx == value:
    result.append(key)

result.sort()

for i in range(len(result)):
  print(i)
Problem p02777 (python)

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

if s == u:
    a=a-1
else:
    b=b-1

print(a,b)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
num = list(map(int, input().split()))
 
# 各サイコロの期待値を出す
expect = []
for i in range(N):
  expect.append((1 + num[i]) / 2)
 
# 累積和を作る
cs = [0]
for i in range(N):
    cs.append(cs[i]+expect[i])

max = 0
for i in range(K, N+1): # 配列0番目に初期値0が増えてるので1足す
  if max < cs[i] - cs[i-K]:
    max = cs[i] - cs[i - K]
print(max)
Problem p02831 (python)

Fixed submission:
from fractions import gcd
a,b=map(int,input().split())

result=int(a*b//gcd(a,b))
print(result)

Buggy submission (verdict: Runtime Error):
import math

a,b=map(int,input().split())

result=float(a*b//math.gcd(a,b))
print(result)

Buggy submission (verdict: Runtime Error):
import math

a,b=map(int,input().split())

result=int(a*b//math.gcd(a,b))
print(result)

Buggy submission (verdict: Runtime Error):
import math

a,b=map(int,input().split())

result=int(a*b//math.gcd(a,b))
print(result)
Problem p02987 (python)

Fixed submission:
s=input()

if s[0]==s[1] and s[0]==s[2] and s[0]==s[3]:
    print("No")
elif(s[0]==s[2] and s[1]==s[3]) or (s[0]==s[1] and s[2]==s[3]) or (s[0]==s[3] and s[1]==s[2]):
    print("Yes")
else:
    print("No")

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

if (s[0]==s[2] and s[1]==s[3]) or (s[0]==s[1] and s[2]==s[3]) or (s[0]==s[3] and s[1]==s[2]) 
    print("Yes")
else:
    print("No")
Problem p03012 (python)

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

total=sum(w)
s1=w[0]
ans=total-s1

for i in range(1,n):
    s1+=w[i]
    ans=min(ans,abs(total-s1*2))

print(ans)

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

total=sum[w]
s1=w[0]
ans=total-s1

for i in range(1,n):
    s1+=w[i]
    ans=min(ans,abs(total-s1*2))

print(ans)

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

total=sum[w]
s1=w[0]
ans=total-s1

for in range(1,n):
    s1+=w[i]
    ans=min(ans,abs(total-s1*2))

print(ans)
Problem p03053 (python)

Fixed submission:
from collections import deque

H,W=map(int,input().split())
grid=[input() for i in range(H)]
dist=[[-1]*W for _ in range(H)]

black_cells=deque()
for h in range(H):
    for w in range(W):
        if grid[h][w] == "#":
            black_cells.append((h,w))
            dist[h][w]=0

def bfs(black_cells,dist):
        d=0
        while black_cells:
            h,w=black_cells.popleft()
            d=dist[h][w]
            for dx, dy in ((1,0),(0,1),(-1,0),(0,-1)):
                new_h=h+dy
                new_w=w+dx
                if new_h <0 or H <= new_h or new_w < 0 or W<=new_w:
                    continue
                if dist[new_h][new_w]==-1:
                    dist[new_h][new_w]=d+1
                    black_cells.append((new_h,new_w))
        return d

d=bfs(black_cells,dist)
print(d)

Buggy submission (verdict: Runtime Error):
from collections import deque

H,W=map(int,input().split())
grid=[input() for i in range(H)]
dist=[[-1]*W for _ in range(H)]

M=deque()
for i in range(W):
    for j in range(H):
        if grid[i][j]=="#":
            M.append((i,j))
            dist[i][j]=0

def bfs(M,dist):
    d=0
    while M:
        x,y=M.popleft()
        d=dist[x][y]
        for dx,dy in ((1,0),(0,1),(-1,0),(0,-1)):
            new_h=x+dy
            new_w=y+dx
            if new_h < 0 or H <= new_h or new_w <0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:
                dist[new_h][new_w]=d+1
                M.append((new_h,new_w))
    return d

d=bfs(M,dist)
print(d)

Buggy submission (verdict: Runtime Error):
from collections import deque

H,W=map(int,input().split())
grid=[input() for i in range(H)]
dist=[[-1]*W for _ in range(H)]

black_cells=deque()
for h in range(H):
    for w in range(W):
        if grid[h][w] == "#":
            black_cells.append((h,w))
            dist[h][w]=0

def bfs(black_cells,dist,grid):
        d=0
        while black_cells:
            h,w=black_cells.popleft()
            d=dist[h][w]
            for dx, dy in ((1,0),(0,1),(-1,0),(0,-1)):
                new_h=h+dy
                new_w=w+dx
                if new_h <0 or H <= new_h or new_w < 0 or W<=new_w:
                    continue
                if dist[new_h][new_w]==-1:
                    dist[new_h][new_w]=d+1
                    black_cells.append((new_h,new_w))
        return d

d=bfs(black_cells,dist)
print(d)

Buggy submission (verdict: Runtime Error):
from collections import deque

H,W=map(int,input().split())
grid=[input() for _ in range(H)]
dist=[[-1]*W for _ in range(H)]

M=deque()
for i in range(W):
    for j in range(H):
        if grid[i][j]=="#":
            M.append((i,j))
            dist[i][j]=0

def bfs(M,dist):
    d=0
    while M:
        x,y=M.popleft()
        d=dist[x][y]
        for dx,dy in ((1,0),(0,1),(-1,0),(0,-1)):
            new_h=x+dx
            new_w=y+dy
            if new_h < 0 or H <= new_h or new_w <0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:
                dist[new_h][new_w]=d+1
                M.append((new_h,new_w))
    return d

d=bfs(M,dist)
print(d)
Problem p03307 (python)

Fixed submission:
from fractions import gcd

n=int(input())

print(n*2//gcd(2,n))

Buggy submission (verdict: Runtime Error):
from math import gcd

n=int(input())

print(n*2//gcd(2,n))
Problem p02689 (python)

Fixed submission:
N, M = map(int, input().split())
Hi = list(map(int,input().split(" ")))
#path = [list() for _ in range(M+1)]

Tallest = [0]*N

for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Tallest[a] = max(Tallest[a], Hi[b])
    Tallest[b] = max(Tallest[b], Hi[a])

goodT = 0

for i in range(N):
    if Hi[i]>Tallest[i]:
        goodT +=1
    
print (goodT)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
Hi = list(map(int,input().split(" ")))
path = [list[] for _ in range(M+1)]

for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    path[a].append(b)
    path[b].append(a)
    

goodT = 0
T = range(M+1)

for i, p in zip(T, path):
    good = 1
    if p == []:
        goodT += good
    else:
        for t in p:
            if Hi[i] <= Hi[t]:
                good = 0
        goodT +=good
        
print (goodT)

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

# N, K = map(int, input().split())
# # N, K = 3, 2
# di = np.zeros((K), dtype='int64')
# Ai = np.ones((N),  dtype='int8')

# for i in range(K):
#     di[i] = int(input())
#     Sunuke = map(int, input().split())
#     for s in Sunuke:
#         Ai[int(s)-1] = 0
        
# print (Ai.sum())
    
N, M = map(int, input().split())
Hi = list(map(int,input().split(" ")))
path = [list() for _ in range(M+1)]

for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    path[a].append(b)
    path[b].append(a)
    

goodT = 0
T = range(M+1)

for i, p in zip(T, path):
    good = 1
    if p == []:
        goodT += good
    else:
        for t in p:
            if Hi[i] <= Hi[t]:
                good = 0
        goodT +=good
        
print (goodT)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
Hi = list(map(int,input().split(" ")))
path = [list() for _ in range(M+1)]

for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    path[a].append(b)
    path[b].append(a)
    

goodT = 0
T = range(M)

for i, p in zip(T, path):
    good = 1
    if p == []:
        goodT += good
    else:
        for t in p:
            if Hi[i] <= Hi[t]:
                good = 0
        goodT +=good
        
print (goodT)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
Hi = list(map(int,input().split(" ")))
path = [set() for _ in range(M+1)]

for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    path[a].add(b)
    path[b].add(a)
    
# print (path)

i = 0
goodT = 0

for p in path:
    good = 1
    if p == set():
        goodT += good
    else:
        for t in p:
            if Hi[i]<=Hi[t]:
                good =0
        goodT +=good
    i +=1
print (goodT)