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

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

AB.sort(reverse=True)
works=[]
heapq.heapify(works)
ans=0
for i in range(1,M+1):
  day=M-i
  latest=i
  while AB and AB[-1][0]<=latest:
    a,b=AB.pop()
    heapq.heappush(works,-b)
  if not works:
    continue
  ans-=heapq.heappop(works)

print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

AB.sort(reverse=True)
works=[]
heapq.heapify(works)
ans=0
AB=AB+[0,0]
for i in range(1,M+1):
  day=M-i
  latest=i
  while AB and AB[-2][0]<=latest:
    a,b=AB.pop(-2)
    heapq.heappush(works,-b)
  if not works:
    continue
  ans-=heapq.heappop(works)

print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

AB.sort(reverse=True)
works=[]
heapq.heapify(works)
ans=0
AB.append([0,0])
for i in range(1,M+1):
  day=M-i
  latest=i
  while AB and AB[-2][0]<=latest:
    a,b=AB.pop(-2)
    heapq.heappush(works,-b)
  if not works:
    continue
  ans-=heapq.heappop(works)

print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

AB.sort(reverse=True)
works=[]
heapq.heapify(works)
ans=0
AB.append(0)
for i in range(1,M+1):
  day=M-i
  latest=i
  while AB and AB[-2][0]<=latest:
    a,b=AB.pop(-2)
    heapq.heappush(works,-b)
  if not works:
    continue
  ans-=heapq.heappop(works)

print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right as br
import heapq
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

AB.sort()
A=[a for a,b in AB]
B=[b for a,b in AB]
works=[]
heapq.heapify(works)
ans=0
for i in range(1,M+1):
  day=M-i
  latest=i
  #worksにlatest日以内に報酬を貰える仕事を追加する
  if not A or A[0]>latest:
    pass
  else:
    for _ in range(br(A,latest)):
      A=A[1:]
      #index=br(works,B[0])
      #works=works[:index]+B[0]+works[index:]
      heapq.heappush(works,-B[0])
      B=B[1:]
  #if not works:
    #continue
  #ans+=works.pop(-1)
  ans-=heapq.heappop(works)

print(ans)
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement

n, m, q = map(int, input().split())
comb = list(combinations_with_replacement(range(1, m+1), n))
ans = [0] * len(comb)
for _ in range(q):
    a, b, c, d = map(int, input().split())
    for i in range(len(comb)):
        if comb[i][b-1] - comb[i][a-1] == c:
            ans[i] += d
print(max(ans))

Buggy submission (verdict: Runtime Error):
from itertools import combinations

n, m, q = map(int, input().split())
comb = list(combinations(range(1, m+1), n))
ans = [0] * len(comb)
for _ in range(q):
    a, b, c, d = map(int, input().split())
    for i in range(len(comb)):
        if comb[i][b-1] - comb[i][a-1] == c:
            ans[i] += d
print(max(ans))
Problem p02831 (python)

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

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(a*b//math.gcd(a, b))
Problem p02859 (python)

Fixed submission:
r = int(input())
ans = r * r
print(ans)

Buggy submission (verdict: Runtime Error):
r = input()
ans = r * r
print(ans)

Buggy submission (verdict: Runtime Error):
r = input()
print(r * r)
Problem p02881 (python)

Fixed submission:
n = int(input())

ans = 10**12
for i in range(1, int(n**0.5)+1):
    if n%i==0:
        ans = min(ans, i+n//i)
print(ans-2)

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

ans = 10**12
for i in range(1, int(ns**0.5)+1):
    if n%i==0:
        ans = min(ans, i+n//i)
print(ans-2)

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

ans = 10**12
for i in range(1, int(ns**0.5)+1):
    print(n%i)
    if n%i==0:
        ans = min(ans, i+n//i)
print(ans-2)
Problem p02916 (python)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
b = [int(y) for y in input().split()]
c = [int(z) for z in input().split()]

total = 0
pre = 999
for i in range(N):
    total += b[a[i]-1]
    if a[i] == pre+1:
        total += c[pre-1]
    pre = a[i]
print(total)

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

total = 0
pre = 0
for i in range(N):
    total += b[a[i]-1]
    if a[i] == pre+1:
        total += c[a[i]]
    pre = a[i]
print(total)

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

total = 0
pre = 0
for i in a:
    total += b[i-1]
    if i-1 == pre:
        total += c[pre]
    pre = i
print(total)
Problem p03631 (python)

Fixed submission:
import sys
input = sys.stdin.readline().rstrip
n = input()
print('Yes' if n == n[::-1] else 'No')

Buggy submission (verdict: Runtime Error):
import functools
import fractions
n = int(input())
t = [int(input()) for _ in range(n)]

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    
ans = functools.reduce(lcm, t)
print(ans)

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

def lcm(x, y):
    return (x * y) // functools.gcd(x, y)
    
ans = functools.reduce(lcm, t)
print(ans)
Problem p03767 (python)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
ans = 0

for i in range(n):
    ans += a[i * 2 + 1]

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
x = len(a) // n
l = []
for i in range(n):
    for j in range(x):
        ll.append(a[i+j::x-1])
      
ans = 0
for i in range(n):
    ans += l[i][1]
print(ans)
Problem p03804 (python)

Fixed submission:
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
s = 0
cnt = 0

for i in range(n-m+1):
    for j in range(n-m+1):
        for x in range(m):
            for y in range(m):
                if a[i+x][j+y] == b[x][y]:
                    s += 1
        if s == m ** 2:
            cnt += 1
        else:
            s = 0
if cnt > 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
s = 0
cnt = 0

for i in range(n-m+1):
    for j in range(n-m+1):
        for x in range(m):
            for y in range(m):
                if a[i+x][j+y] == b[x][y]:
                    s += 1
            if s == m ** 2:
                cnt += 1
            else:
                s = 0
if c > 0:
    print('Yes')
else:
    print('No')
Problem p02836 (python)

Fixed submission:
A=input()
c=0
B=A[::-1]
for i in range(len(A)):
    if A[i]!=B[i]:
        c+=1
print(c//2)

Buggy submission (verdict: Runtime Error):
A=input();print(sum(i!=j for i,j in zip(A,A[::-1])//2)

Buggy submission (verdict: Runtime Error):
A=input()
c=0
B=A[::-1]
for i in range(len(A)):
    if A[i]!=B[i]:
        cnt+=1
print(cnt//2)
Problem p02688 (python)

Fixed submission:
n,k=map(int,input().split())
l=[]
for m in range(1,n+1):
  l.append(m)
for i in range(k):
  d=int(input())
  s=input().split()
  for j in s:
    if int(j) in l:
      l.remove(int(j))
print(len(l))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
for k in range(n):
  l.append(k)
for i in range(k):
  d=int(input())
  s=input().split()
  for j in s:
    if int(j) in l:
      l.remove(int(j))
print(len(l))
Problem p02623 (python)

Fixed submission:
import numpy as np
N, M, K = map(int, input().split())
A = [0]
B = [0]
A += list(map(int, input().split()))
B += list(map(int, input().split()))
A_cumsum = np.cumsum(A, dtype='int64')
B_cumsum = np.cumsum(B, dtype='int64')

def binary_search(k):
    if B_cumsum[-1] <= k:
        return M
    right = M
    left = 0
    while right != left:
        mid = (left + right) // 2
        if B_cumsum[mid] > k:
            right = mid
        else:
            left = mid + 1
    return left - 1

ans = 0
for i in range(N+1):
    count = 0
    if A_cumsum[i] <= K:
        count += i
    else:
        break
    count += binary_search(K - A_cumsum[i])
    if ans < count:
        ans = count
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
divisors = [0] * N
ans = 0
for i in range(N):
    num = i+1
    for j in range(i, N, num):
        divisors[j] += 1
    ans += num * divisors[i]
print(ans)
Problem p02624 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(1, N+1):
    ans += i * (N // i) * (N // i + 1) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
divisors = np.array([0] * N, dtype = 'int64')
ans = 0
for i in range(N):
    num = i+1
    divisors[i:N:num] += 1
    ans += num * divisors[i]
print(ans)
Problem p02659 (python)

Fixed submission:
A, B = input().split()
print(int(A) * int(B[0] + B[2] + B[3]) // 100)

Buggy submission (verdict: Runtime Error):
A, B = input().split()
print(int(A) * int(B[0] + B[1] + B[2] + B[3]) // 100)
Problem p02725 (python)

Fixed submission:
K, N = map(int, input().split())
A = list(map(int, input().split()))

ans_root = K
for i in range(N):
    if i==0:
        root = A[N-1] - A[0]
    else:
        root = A[i-1]+K - A[i]
    if ans_root > root:
        ans_root = root
print(ans_root)

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

ans_root = K
for i range(N):
    if i==0:
        root = A[N-1] - A[0]
    else:
        root = A[i-1]+K - A[i]
    if ans_root > root:
        ans_root = root
print(ans_root)
Problem p03803 (python)

Fixed submission:
A, B = map(int, input().split())

if A==B:
    print("Draw")
elif (A>B and B != 1) or A==1:
    print("Alice")
else:
    print('Bob')

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

if A==B:
    print("Draw")
elif A>B or A==1:
    print("Alice")
elif　A<B or B==1:
    print("Bob")

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

if A==B:
    print("Draw")
elif A>B or A==1:
    print("Alice")
elif:　A<B or B==1:
    print("Bob")
Problem p02793 (python)

Fixed submission:
import math
import fractions
def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)

N = int(input())
l = list(map(int, input().split()))

MODp = 1000000007
K = 1
for i in range(N):
  K = lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K // l[i]))

Ans = Ans % MODp
print(Ans)

Buggy submission (verdict: Runtime Error):
import math
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
N = int(input())
l = []
l = list(map(int, input().split()))

MODp = 1000000007
K = 1
for i in range(N):
  K = lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K / l[i])%MODp)

Ans = Ans % MODp
print(Ans)

Buggy submission (verdict: Runtime Error):
import math
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
N = int(input())
l = []
l = list(map(int, input().split()))

MODp = 1000000007
K = 1
for i in range(N):
  K = math.lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K / l[i])%MODp)

Ans = Ans % MODp
print(Ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
l = []
l = list(map(int, input().split()))

MODp = 1000000007
K = 1
for i in range(N):
  K = math.lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K / l[i])%MODp)

Ans = Ans % MODp
print(Ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
l = []
for i in range(N):
  l = list(map(int, input().split()))

MODp = 1000000007
K = 1
for i in range(N):
  K = math.lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K / l[i])%MODp)

Ans = Ans % MODp
print(Ans)
Problem p02659 (python)

Fixed submission:
#import math
#N=int(input())
A,B = map(float,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
A=int(A)
B=round(B*100)
c=A*B
c=str(c//100)
print(c)

Buggy submission (verdict: Runtime Error):
#import math
#N=int(input())
A,B = map(float,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
A=int(A)
B=Decimal(B*100)
c=A*B
c=str(c//100)
print(c)
Problem p02695 (python)

Fixed submission:
import itertools
#K = int(input())
N,M,Q = map(int,input().split())
#N = str(input())
#A = list(map(int,input().split()))
nums=[i for i in range(1,M+1)]
count=0
inp=[]
for i in range(Q):
    I=list(map(int,input().split()))
    inp.append(I)

for v in itertools.combinations_with_replacement(nums, N):
    c=0
    v=list(v)
    for i in inp:

        if v[i[1]-1] - v[i[0]-1]==i[2]:
            c+=i[3]
    count=max(count,c)
print(count)

Buggy submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
m=0
if B<N:
    N=B
s=int(B/A)
if s>N:
    print(0)
    exit()
for x in range(s,N+1,s):
    num=int(A*x/B) - A * int(x/B)

    m=max(num,m)

print(m)
Problem p02754 (python)

Fixed submission:
#N = str(input())
N,A,B = map(int,input().split())
#X=list(map(int,input().split()))

if A==0:
    print(0)
    exit()
else:
    b=N//(A+B)
    x=N%(A+B)

    if x>A:
        print(b*A+A)
    else:
        print(b*A+x)

Buggy submission (verdict: Runtime Error):
#N = str(input())
N,A,B = map(int,input().split())
#X=list(map(int,input().split()))

if A==0:
    print(0)
else:
    b=N//(A+B)
    x=N%(A+B)

if x>A:
    print(b*A+A)
else:
    print(b*A+x)

Buggy submission (verdict: Runtime Error):
#N = str(input())
N,A,B = map(int,input().split())
#X=list(map(int,input().split()))

if A==0:
    print(0)
else:
    b=N//(A+B)
    x=N%(A+B)

if x>A:
    x=A

print(b*A+x)

Buggy submission (verdict: Runtime Error):
#N = str(input())
N,A,B = map(int,input().split())
#X=list(map(int,input().split()))

if A==0:
    print(0)
else:
    b=N//(A+B)
    x=N%(A+B)

if x>A:
    x=A

    print(b*A+x)
Problem p02785 (python)

Fixed submission:
N,K=map(int,input().split())
H=[int(x) for x in input().split()]
if N<=K:
    print(0)
else:
    H.sort(reverse=True)

    del H[0:K]
    print(sum(H))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
H=input().split()
P=[]
for i in H:
    P.append(int(i))
if N<=K:
    print(0)
else:
    P.sort(reverse=True)
    for j in range(K):
        P.pop(j)
    print(sum(P))
Problem p02832 (python)

Fixed submission:
N=int(input())
A=[int(x) for x in input().split()]
ne=1
c=0

if 1 not in A:
    print(-1)
    exit()


for i in range(N-1):
    if A[i]==ne:
        c+=1
        ne+=1
if A[-1]==ne:
    c+=1
print(N-c)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(input()) for i in range(N)]
l=[]
count=0

if 1 not in A:
    print(-1)
    exit()
for i in range(N-1):
    for j in range(i+1,N):
        if A[i]>=A[j]:
            count+=1
            print(A[i],A[j])
            break

print(count)
Problem p02881 (python)

Fixed submission:
n = int(input())
s=int(n**0.5)
list=[]
for i in range(1,s+1):
    if n%i==0:
        list.append(int(i+ n/i -2))
print(min(list))

Buggy submission (verdict: Runtime Error):
n = int(input())
s=int(n**0.5)
list=[]
for i in range(1,s):
    if n%i==0:
        list.append(int(i+ n/i -2))
print(min(list))
Problem p02897 (python)

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

Buggy submission (verdict: Runtime Error):
import math
import fractions
A,B = map(int,input().split())

maxn=fractions.gcd(A,B)
list=[]
def isPrime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False

    m = math.floor(math.sqrt(n)) + 1
    for p in range(3, m, 2):
        if n % p == 0:
            return False
        return True
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

yaku=make_divisors(maxn)
for i in range(len(yaku)):
    if isPrime(yaku[i]):
        list.append(yaku[i])

print(len(list))

Buggy submission (verdict: Runtime Error):
N=int(input())
if N%2==0:
  print(N/2)
else if:
  print((N+1)/2)
Problem p02990 (python)

Fixed submission:
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    if (N-K+1)<i:
        print(0)
        continue
    print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    if (N-K+1)<i:
        print(0)
    print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))
Problem p03011 (python)

Fixed submission:
a = [int(i) for i in input().split()]
list=[]
S1 = a[0]+a[1]
S2 = a[1]+a[2]
S3 = a[2]+a[0]
list.append(S1)
list.append(S2)
list.append(S3)

print(min(list))

Buggy submission (verdict: Runtime Error):
a = int().split()

b = l[0]+l[1]
c = l[1]+l[2]
d = l[2]+l[0]

e=list[]
e.append(b)
e.append(c)
e.append(d)

print(min(e))
Problem p03265 (python)

Fixed submission:
#import numpy as np
import math
#T= str(input())
#K = int(input())
x1,y1,x2,y2= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())

a=x2-x1
b=y2-y1

print(x2-b,y2+a,x1-b,y1+a)
exit()

Buggy submission (verdict: Runtime Error):
#import numpy as np
import math
#T= str(input())
#K = int(input())
x1,y1,x2,y2= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())

L=math.sqrt((x1-x2)**2 + (y1-y2)**2)

a=abs(x2-x1)
b=abs(y2-y1)


if x1 =< x2 and y1 =< y2:
    x3 = x2 - b
    y3 = y2 + a
    x4 = x1 - b
    y4 = y1 + a
elif x1 =< x2 and y1 => y2:
    x3 = x2 + b
    y3 = y2 + a
    x4 = x1 + b
    y4 = x1 + a
elif x1 => x2 and y1 =< y2:
    x3 = x2 - b
    y3 = y2 - a
    x4 = x1 - b
    y4 = y1 - a
elif x1 => x2 and y1 => y2:
    x3 = x2 + b
    y3 = y2 - a
    x4 = x1 + b
    y4 = x1 - a

print(x3,y3,x4,y4)
Problem p02759 (python)

Fixed submission:
import math

N = int(input())
print(math.ceil(N / 2))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

num = [0] * N

P = [list(map(int,input().split())) for i in range(M)]

for i in range(M + 1):
    if i == M:
        if N == 1:
            print("".join([str(n) for n in num]))
            break
        elif num[0] == 0:
            num[0] = 1
            print("".join([str(n) for n in num]))
            break
        else:
            print("".join([str(n) for n in num]))
            break
    elif P[i][0] == 1 and P[i][1] == 0:
        if N == 1:
            continue
        else:
            print(-1)
            break
    elif num[P[i][0] - 1] == 0 or num[P[i][0] - 1] == P[i][1]:
        num[P[i][0] - 1] = P[i][1]
    else:
        print(-1)
        break
Problem p02831 (python)

Fixed submission:
import fractions
A, B = map(int, input().split())
print(int(A * B / fractions.gcd(A, B)))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(int(A * B / math.gcd(A, B)))

Buggy submission (verdict: Runtime Error):
import math

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

print(int(A * B / math.gcd(A, B)))

Buggy submission (verdict: Runtime Error):
import math

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

print(math.gcd(A, B))
Problem p02832 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
now = 1

for i in range(len(A)):
    if A[i] == now:
        now += 1
    else:
        count += 1

print(count if now != 1 else -1)

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(int(A * B / math.gcd(A, B)))
Problem p02835 (python)

Fixed submission:
A1, A2, A3 = map(int, input().split())
if A1+A2+A3 >= 22:
  print('bust')
else:
  print('win')

Buggy submission (verdict: Runtime Error):
print(sum([int(list(input().split())[i]) for i in range(3)]))
Problem p03127 (python)

Fixed submission:
import fractions

N = int(input())
A = list(input().split())
monster = list(sorted([int(A[i]) for i in range(N)]))
ans = float('inf')
MIN = monster[0]

for i in range(N):
    tmp = monster[i]
    ans = min(ans, int(fractions.gcd(tmp, MIN)))

print(ans)

Buggy submission (verdict: Runtime Error):
import flactions

N = int(input())
A = list(input().split())
monster = list(sorted([int(A[i]) for i in range(N)]))
ans = float('inf')
MIN = monster[0]

for i in range(N):
    tmp = monster[i]
    ans = min(ans, int(flactions.gcd(tmp, MIN)))

print(ans)
Problem p02596 (python)

Fixed submission:
k = int(input())
c = 0
if k%2 ==0 or k%5==0:
    print(-1)
    c=1
elif k==1:
    print(1)
    c=1
if c==0:
    t = 7

    for i in range(k):
        if int(t)%k==0 :
            print(i+1)
            break
        t = (10*t+7)%k

Buggy submission (verdict: Runtime Error):
k = int(input())
c = 0
if k%2 ==0 or k%5==0:
    print(-1)
    c=1
if c==0:

    for i in range(1,k):
        t = "7"*i
        if str(t)%k==0 :
            print(i)
            break
Problem p02624 (python)

Fixed submission:
n = int(input())

ans = 0
for i in range(1,n+1):
    nu = n // i
    ans += nu * (nu+1) * i // 2
print(ans)

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

ans = 0
for i in range(n):
    nu = n // i
    ans += nu * (nu+1) * i // 2
print(ans)

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

ans = 0
for i in range(n):
    nu = n // i
    ans += nu * (nu+1) * i // 2
print(ans)
Problem p02689 (python)

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

roads = [[] for i in range(n)]
for i in range(m):
    x,y = map(int, input().split())
    roads[x-1].append(y-1)
    roads[y-1].append(x-1)

bestcount = 0

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in roads[i]:
        if (height[j] >= height[i]):
            best = 0
            break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
height = list(map(int, input().split()))
roads = [list(map(int, input().split())) for i in range(m)]

bestcount = 0

print(height)
print(roads)

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in range(m):
        if (roads[j][0] == i):
            a = roads[j][0]
            b = roads[j][1]
            if (height[a] <= height[b]):
                best = 0
                break
        if (roads[j][1] == i):
            a = roads[j][1]
            b = roads[j][0]
            if (height[a] <= height[b]):
                best = 0
                break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
height = list(map(int, input().split()))
roads = [list(map(int, input().split())) for i in range(m)]

bestcount = 0

for i in range(n):
    best = 1 # 良い展望台なら1
    for j in range(m):
        if (roads[j][0] == i):
            a = roads[j][0]
            b = roads[j][1]
            if (height[a] <= height[b]):
                best = 0
                break
        if (roads[j][1] == i):
            a = roads[j][1]
            roads[j][0] == b
            if (height[a] <= height[b]):
                best = 0
                break
    if(best == 1):
        bestcount += 1

print(str(bestcount))