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

Fixed submission:
import fractions
n=int(input())
A=list(map(int,input().split()))

a=A[0]
for b in A:
    a = (a * b) // fractions.gcd(a, b)

count=0
for i in A:
    count+=a//i

print((count%((10**9)+7)))

Buggy submission (verdict: Runtime Error):
import math
import fractions
"""
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)
"""
n=int(input())
A=list(map(int,input().split()))

a=A[0]
for b in A:
    #a=lcm(a,b)
    a = a /fractions.gcd(a, b)*b

count=0
[count+=a/i for i in A]
    #count+=a/i
    #if count>(10**9)+7:
    #    count=count%((10**9)+7)
print(math.floor(count%((10**9)+7)))

Buggy submission (verdict: Runtime Error):
import math
#import fractions
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

n=int(input())
A=list(map(int,input().split()))

a=A[0]
for b in A:
    a=lcm(a,b)
    #a = a /fractions.gcd(a, b)*b

count=0
for i in A:
    count+=a/i
    #if count>(10**9)+7:
    #    count=count%((10**9)+7)
print(math.floor(count%((10**9)+7)))

Buggy submission (verdict: Runtime Error):
#import fractions
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

n=int(input())
A=list(map(int,input().split()))

a=A[0]
for b in A:
    a=lcm(a,b)
    #a = a /fractions.gcd(a, b)*b

count=0
for i in A:
    count+=a/i
    if count>(10**9)+7:
        count=count%((10**9)+7)
print(int(count)%((10**9)+7))

Buggy submission (verdict: Runtime Error):
#import fractions
def gcd(a, b):
     while b:
          a, b = b, a % b
     return a

def lcm(a, b):
     return a * b // gcd (a, b)

n=int(input())
A=list(map(int,input().split()))

a=A[0]
for b in A:
    a=lcm(a,b)
    #a = a /fractions.gcd(a, b)*b

count=0
for i in A:
    count+=a/i

print(int(count)%((10**9)+7))

Buggy submission (verdict: Runtime Error):
#import fractions
def gcd(a, b):
     while b:
          a, b = b, a % b
     return a

def lcm(a, b):
     return a * b // gcd (a, b)

n=int(input())
A=list(map(int,input().split()))

a=A[0]
for b in A:
    a=lcm(a,b)
    #a = a /fractions.gcd(a, b)*b

count=0
for i in A:
    count+=a/i

print(int(count)%((10**9)+7))
Problem p03127 (python)

Fixed submission:
n=int(input())
tmp=list(map(int, input().split(" ")))
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd (a, b)

a=max(tmp)
for i in tmp:
    a=gcd(a,i)

print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
#for i in range(n):
if n>2:
    A=list(set(list(map(int, input().split(" ")))))
else:
    A=list(map(int, input().split(" ")))

A.sort()
t1=A[0]
t2=A[1]

while t1!=t2:
    #print(t1)
    if t1>t2:
        t1=t1-t2
    else:
        t2=t2-t1

print(t1)

Buggy submission (verdict: Runtime Error):
n=int(input())
#for i in range(n):
A=list(set(list(map(int, input().split(" ")))))

A.sort()
t1=A[0]
t2=A[1]

while t1!=t2:
    #print(t1)
    if t1>t2:
        t1=t1-t2
    else:
        t2=t2-t1

print(t1)
Problem p03426 (python)

Fixed submission:
import numpy as np
H, W, D=list(map(int,input().split(" ")))
#print(in1)
#arr=np.zeros((in1[0],in1[1]))
d={}
for i in range(H):
    #arr[i]=input().split(" ")
    for n,k in enumerate(input().split(" ")):
        d[int(k)]=[i,n]
#print(arr)
Q=int(input())
out=[]

cost={}

for i in range(1,D+1):
    now = i + D
    cost[i]=0
    #cost[i]=abs(d[now][0] - d[now - D][0]) + abs(d[now][1] - d[now - D][1])
    while now <= H * W:
        cost[now] = cost[now - D] + abs(d[now][0] - d[now - D][0]) + abs(d[now][1] - d[now - D][1])
        now += D


out=[]
for k in range(Q):
    start,end=list(map(int,input().split(" ")))
    out.append(cost[end]-cost[start])

for i in out:
    print(int(i))

Buggy submission (verdict: Runtime Error):
import numpy as np
H, W, D=list(map(int,input().split(" ")))
#print(in1)
#arr=np.zeros((in1[0],in1[1]))
d={}
for i in range(H):
    #arr[i]=input().split(" ")
    for n,k in enumerate(input().split(" ")):
        d[int(k)]=[i,n]
#print(arr)
Q=int(input())
out=[]

cost={}
for i in range(1,D+1):
    now = i + D
    cost[i]=abs(d[now][0] - d[now - D][0]) + abs(d[now][1] - d[now - D][1])
    while now <= H * W:
        cost[now] = cost[now - D] + abs(d[now][0] - d[now - D][0]) + abs(d[now][1] - d[now - D][1])
        now += D


out=[]
for k in range(Q):
    start,end=list(map(int,input().split(" ")))
    out.append(cost[end]-cost[start])

for i in out:
    print(int(i))

Buggy submission (verdict: Runtime Error):
import numpy as np
H, W, D=list(map(int,input().split(" ")))
#print(in1)
#arr=np.zeros((in1[0],in1[1]))
d={}
for i in range(H):
    #arr[i]=input().split(" ")
    for n,k in enumerate(input().split(" ")):
        d[int(k)]=[i,n]
#print(arr)
Q=int(input())
out=[]

cost={}
for i in range(1,D+1):
    now = i + D
    cost[i]=abs(d[now][0] - d[now - D][0]) + abs(d[now][1] - d[now - D][1])
    while now <= H * W:
        cost[now] = cost[now - D] + abs(d[now][0] - d[now - D][0]) + abs(d[now][1] - d[now - D][1])
        now += D


out=[]
for k in range(Q):
    start,end=list(map(int,input().split(" ")))
    out.append(cost[end]-cost[start])
for i in out:
    print(i)

Buggy submission (verdict: Runtime Error):
import numpy as np
in1=list(map(int,input().split(" ")))
#print(in1)
#arr=np.zeros((in1[0],in1[1]))
d={}
for i in range(in1[0]):
    #arr[i]=input().split(" ")
    for n,k in enumerate(input().split(" ")):
        d[int(k)]=[i,n]
#print(arr)
Q=int(input())
test=[]
out=[]
route=[]
for k in range(Q):
    ans=0
    start,end=list(map(int,input().split(" ")))
    #place=np.where(arr==start)
    place=d[start]
    #print(start,end)
    while start != end:
        #print("ans",ans)
        #nextplace=np.where(arr==start+in1[2])#[1][0]
        if start in route:
            nextplace=d[start+in1[2]]
        else:
            nextplace=d[start+in1[2]]
            ans1=abs(int(nextplace[0])-int(place[0]))
            ans2=abs(int(nextplace[1])-int(place[1]))
            route[start]=ans1+ans2
        ans+=route[start]
        start+=in1[2]
        place=nextplace

    print(ans)
    #out.append(ans)
#for i in out:
    #print(i)
Problem p03631 (python)

Fixed submission:
num=list(raw_input())
#print num
#print num[::-1]
if num==num[::-1]:
    print "Yes"
else:
    print "No"

Buggy submission (verdict: Runtime Error):
tmp=map(int, raw_input().split(" "))
if tmp[1]<tmp[2]:
    print 0
else:
    print min(tmp[1],tmp[3])-tmp[2]
Problem p02831 (python)

Fixed submission:
import fractions
def lcm(a, b):
    return (a*b)//fractions.gcd(a,b)

N = input().split()
N = [int(i) for i in N]
print(lcm(N[0],N[1]))

Buggy submission (verdict: Runtime Error):
import fractions
def lcm(a, b):
    return (a*b)//fracitons.gcd(a,b)

N = input().split()
N = [int(i) for i in N]
print(lcm(N[0],N[1]))
Problem p02891 (python)

Fixed submission:
import sys

S = input()
K = int(input())

if len(S) == 1:
    print(K//2)
    sys.exit()
if len(S) == 2:
    if S[0] == S[1]:
        print(K)
    else:
        print('0')
    sys.exit()

olds = S[0]
l = 1
c = 0
first = 1
for i in range(1,len(S)):

    if olds == S[i]:
        l += 1
    else:
        if first:
            firstL = l
            first = 0
        c += l//2
        l = 1
    olds = S[i]
    
    if i == len(S)-1:
        if first:
            print(len(S)*K//2)
            sys.exit()
        lastL = l
        c += l//2

if S[0] == S[-1] and firstL%2 == 1 and lastL%2 == 1:
    print((c+1)*K-1)
else:
    print(c*K)

Buggy submission (verdict: Runtime Error):
import sys

S = input()
K = int(input())

if len(S) == 1:
    print(K//2)
    sys.exit()
if len(S) == 2:
    if S[0] == S[1]:
        print(K)
    else:
        print('0')
    sys.exit()

olds = S[0]
l = 1
c = 0
first = 1
for i in range(1,len(S)):

    if olds == S[i]:
        l += 1
    else:
        if first:
            firstL = l
            first = 0
        c += l//2
        l = 1
    olds = S[i]
    
    if i == len(S)-1:
        lastL = l
        c += l//2

if S[0] == S[-1] and firstL%2 == 1 and lastL%2 == 1:
    print((c+1)*K-1)
else:
    print(c*K)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

olds = S[0]
l = 1
c = 0
first = 1
for i in range(1,len(S)):

    if olds == S[i]:
        l += 1
    else:
        if first:
            firstL = l
            first = 0
        c += l//2
        l = 1
    olds = S[i]
    
    if i == len(S)-1:
        lastL = l
        c += l//2

if S[0] == S[-1] and firstL%2 == 1 and lastL%2 == 1:
    print((c+1)*K-1)
else:
    print(c*K)
Problem p03041 (python)

Fixed submission:
length, pos = input().split(' ')
length, pos = int(length), int(pos)
target = input()
answer = ''
if pos == 1:
  answer = str(target[pos-1].lower() + target[1:])
elif pos == length:
  answer = str(target[:-1] + target[pos-1].lower())
else:
  answer = str(target[:pos-1] + target[pos-1].lower() + target[pos:])

print(answer)

Buggy submission (verdict: Runtime Error):
length, pos = input().split(' ')
length,pos = int(length), int(pos)
target = input()
if target[pos-1] == 'A':
  target[pos-1] = 'a'
if target[pos-1] == 'B':
  target[pos-1] = 'b'
if target[pos-1] == 'C':
  target[pos-1] = 'c'

print(target)
Problem p03042 (python)

Fixed submission:
target = input()
first, second = int(target[0:2]), int(target[2:4])
if first == 0:
  first = 100
if second == 0:
  second = 100

def check():
  if first >12 and second >12:
    return 'NA'
  elif first <= 12 and second <= 12:
    return 'AMBIGUOUS'
  elif first >12 and second <= 12:
    return 'YYMM'
  else:
    return 'MMYY'

if __name__ == '__main__':
  print(check())

Buggy submission (verdict: Runtime Error):
target = input()
first, second = int(target[0:2]), int(target[2:4])
if first = 0:
  first = 100
if second = 0:
  second = 100

def check():
  if first >12 and second >12:
    return 'NA'
  elif first <= 12 and second <= 12:
    return 'AMBIGUOUS'
  elif first >12 and second <= 12:
    return 'YYMM'
  else:
    return 'MMYY'

if __name__ == '__main__':
  print(check())
Problem p03045 (python)

Fixed submission:
# coding: utf-8

N, M = (int(x) for x in input().split())

adj_list = [[] for i in range(N)]
for i in range(M):
	x, y, z = (int(x) for x in input().split())
	adj_list[x - 1].append(y - 1)
	adj_list[y - 1].append(x - 1)

searched = [False] * N
count = 0
for i in range(N):
	if searched[i] == True:
		continue

	count += 1
	stack = [i]
	searched[i] = True
	while len(stack) > 0:
		node = stack.pop()	
		for n in adj_list[node]:
			if searched[n] == False:
				stack.append(n)
				searched[n] = True

print(count)

Buggy submission (verdict: Runtime Error):
f-8

N, M = (int(x) for x in input().split())

adj_list = [[] for i in range(N)]
for i in range(M):
	x, y, z = (int(x) for x in input().split())
	adj_list[x - 1].append(y - 1)
	adj_list[y - 1].append(x - 1)

searched = [False] * N
count = 0
for i in range(N):
	if searched[i] == True:
		continue

	count += 1
	stack = [i]
	while len(stack) > 0:
		node = stack.pop()
		searched[node] = True
		for n in adj_list[node]:
			if searched[n] == False:
				stack.append(n)

print(count)
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 fractions
A, B = map(int, input().split())
print(int(A * B / fractions.gcd(A, B))
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 p02862 (python)

Fixed submission:
import math
MOD = 1000000000+7
X, Y = map(int, input().split())

if ((2*Y-X)%3 != 0) or ((2*X-Y)%3 != 0) or (2*Y-X) < 0 or (2*X-Y) < 0:
    print(0)
elif 2 *Y == X or 2 * X == Y:
    print(1)
else:
    x = (2*Y-X) // 3
    y = (2*X-Y) // 3
    fac_list = [None for _ in range(x+y+2)]
    inv_fac_list = [None for _ in range(x+y+2)]

    fac_list[0] = 1
    for i in range(1, x+y+2):
        fac_list[i] = i * fac_list[i-1] % MOD

    inv_fac_list[x+y+1] = pow(fac_list[x+y+1],(MOD - 2), MOD)
    for i in range(x+y, 0, -1):
        inv_fac_list[i] = inv_fac_list[i+1] * (i+1) % MOD

    print((fac_list[x+y] * inv_fac_list[x] * inv_fac_list[y]) % MOD)

Buggy submission (verdict: Runtime Error):
import math
MOD = 1000000000+7
X, Y = map(int, input().split())




if ((2*Y-X)%3 != 0) or ((2*X-Y)%3 != 0) or (2*Y-X) < 0 or (2*X-Y) < 0:
    print(0)
else:
    x = (2*Y-X) // 3
    y = (2*X-Y) // 3
    fac_list = [None for _ in range(x+y+2)]
    inv_fac_list = [None for _ in range(x+y+2)]

    fac_list[0] = 1
    for i in range(1, x+y+2):
        print(i)
        fac_list[i] = i * fac_list[i-1] % MOD

    inv_fac_list[x+y+1] = pow(fac_list[x+y+1],(MOD - 2), MOD)
    for i in range(x+y, 0, -1):
        inv_fac_list[i] = inv_fac_list[i+1] * (i+1) % MOD

    print((fac_list[x+y] * inv_fac_list[x] * inv_fac_list[y]) % MOD)

Buggy submission (verdict: Runtime Error):
import math
MOD = 1000000000+7
X, Y = map(int, input().split())




if ((2*Y-X)%3 != 0) or ((2*X-Y)%3 != 0):
    print(0)
else:
    x = (2*Y-X) // 3
    y = (2*X-Y) // 3
    fac_list = [None for _ in range(x+y+2)]
    inv_fac_list = [None for _ in range(x+y+2)]

    fac_list[0] = 1
    for i in range(1, x+y+2):
        print(i)
        fac_list[i] = i * fac_list[i-1] % MOD

    inv_fac_list[x+y+1] = pow(fac_list[x+y+1],(MOD - 2), MOD)
    for i in range(x+y, 0, -1):
        inv_fac_list[i] = inv_fac_list[i+1] * (i+1) % MOD

    print((fac_list[x+y] * inv_fac_list[x] * inv_fac_list[y]) % MOD)
Problem p03986 (python)

Fixed submission:
s_list = list(input())
seizon_t = 0
s_amari = 0
for char in s_list:
  if char == "T":
    if s_amari == 0:
      seizon_t += 1
    else:
      s_amari -= 1
  else:
    s_amari += 1
print(2*seizon_t)

Buggy submission (verdict: Runtime Error):
s_list = list(input())
seizon_t = 0
s_amari = 0
for char in s_list:
  if char == "T":
    if s_amari == 0:
      seizon_t += 1:
    else:
      s_amari -= 1
  else:
    s_amari += 1
print(2*seizon_t)
Problem p02785 (python)

Fixed submission:
H, K = map(int, input().split())
array = list(map(int, input().split()))
A = sorted(array, reverse=True)
del A[0:K]
print(sum(A))

Buggy submission (verdict: Runtime Error):
H, K = int(input().split())
array = list(map(int, input().split()))
A = sorted(array, reverse=True)
del A[0:K-1]
print(sum(A))
Problem p02819 (python)

Fixed submission:
import math 
def isPrime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
def nextPrime(N):
    if N <= 1:
        return 2
    prime = N
    found = False
    while(not found): 
        prime = prime + 1
        if(isPrime(prime) == True): 
            found = True
    return prime 
A = int(input())
N = A-1
print(nextPrime(N))

Buggy submission (verdict: Runtime Error):
def main():
    n = input('Find the next prime number greater great than: ')
    print find_next_prime(n+1)

def find_next_prime(n):
    return find_prime_in_range(n, 2*n)

def find_prime_in_range(a, b):
    for p in range(a, b):
        for i in range(2, p):
            if p % i == 0:
                break
        else:
            return p
    return None

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

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

# for i in range(m):
#     a = sorted(a)
#     b,c = map(int,input().split())
#     for j in range(b):
#         if a[j] >= c:
#             break
#         else:
#             a[j] = c
# print(sum(a))
d = []
for i in range(m):
    b,c = map(int,input().split()) # b 交換できる枚数 c:カードの値
    d.append((b,c))

# dを降順にsorted
d = sorted(d,key=lambda x: x[1], reverse=True)

for i in range(m):
    b,c = d[i]
    a.extend([c]*b)
    if len(a) > 2*n:
        break

print(sum(sorted(a)[-n:]))

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

# for i in range(m):
#     a = sorted(a)
#     b,c = map(int,input().split())
#     for j in range(b):
#         if a[j] >= c:
#             break
#         else:
#             a[j] = c
# print(sum(a))
d = []
for i in range(m):
    b,c = map(int,input().split()) # b 交換できる枚数 c:カードの値
    d.append((b,c))

# dを降順にsorted
d = sorted(d,key=lambda x: x[1], reverse=True)

for i in range(m):
    b,c = d[i]
    a.extend([c]*b)
    if len(a) > 2*N:
        break

print(sum(sorted(a)[-n:]))
Problem p03835 (python)

Fixed submission:
k,s=[int(i) for i in input().split()]
count = 0
for y in range(k+1):
 if y < s - k * 2 or s - y < 0:
  continue
 for x in range(k+1):
   if s - x - y >= 0 and s - x - y <= k:
      count = count+1
print(count)

Buggy submission (verdict: Runtime Error):
k,s=[int(i) for i in input().split()]
count = 0
for y in range(k+1):
 if i < s - k * 2 or s - i < 0:
  continue
 for x in range(k+1):
   if s - x - y >= 0 and s - x - y <= k:
      count = count+1
print(count)
Problem p02891 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = list(input().strip())
K = int(input())

L = [i for i in S]


if len(S) == 1:
    if K == 1:
        print(0)
    else:
        print(K//2)
    sys.exit()

count = 0
tmp = S[0]
for i in range(1, len(S)):
    if S[i] == tmp:
        count += 1
        S[i] = "A"
        tmp = S[i]
    else:
        tmp = S[i]

count2 = 0
if S[0] == S[-1]:
    L[0] = "A"
    count2 += 1
    tmp = L[0]
    for i in range(1, len(L)):
        if L[i] == tmp:
            count2 += 1
            L[i] = "A"
            tmp = L[i]
        else:
            tmp = L[i]
    if L[-1] == "A":
        print((K//2)*count2 + (K//2+K%2)*count)
    else:
        print(count + (K-1)*count2)
else:
    print(count * K)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = list(input().strip())
K = int(input())

L = [i for i in S]


if len(S) == 1:
    if K == 1:
        print(0)
    else:
        print(S[2])
    sys.exit()

count = 0
tmp = S[0]
for i in range(1, len(S)):
    if S[i] == tmp:
        count += 1
        S[i] = "A"
        tmp = S[i]
    else:
        tmp = S[i]

count2 = 0
if S[0] == S[-1]:
    L[0] = "A"
    count2 += 1
    tmp = L[0]
    for i in range(1, len(L)):
        if L[i] == tmp:
            count2 += 1
            L[i] = "A"
            tmp = L[i]
        else:
            tmp = L[i]
    print((K//2)*count2 + (K//2+K%2)*count)
else:
    print(count * K)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = list(input().strip())
K = int(input())

L = [i for i in S]


if len(S) == 1:
    if K == 1:
        print(0)
    else:
        print(K//2)
        print(S[2])
    sys.exit()

count = 0
tmp = S[0]
for i in range(1, len(S)):
    if S[i] == tmp:
        count += 1
        S[i] = "A"
        tmp = S[i]
    else:
        tmp = S[i]

count2 = 0
if S[0] == S[-1]:
    L[0] = "A"
    count2 += 1
    tmp = L[0]
    for i in range(1, len(L)):
        if L[i] == tmp:
            count2 += 1
            L[i] = "A"
            tmp = L[i]
        else:
            tmp = L[i]
    print((K//2)*count2 + (K//2+K%2)*count)
else:
    print(count * K)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = list(input().strip())
K = int(input())


count = 0
tmp = S[0]
for i in range(1, len(S)):
    if S[i] == tmp:
        count += 1
        tmp = ""
    else:
        tmp = S[i]

if S[0] == S[-1] and S[-2] != S[-1]:
    count += 1
print(count * K)
Problem p03107 (python)

Fixed submission:
S = input()
S_list = list(S)

count0 = S_list.count("0")
count1 = S_list.count("1")

print(len(S_list) - abs(count0-count1))

Buggy submission (verdict: Runtime Error):
import sys
S = input()
S_list = list(S)
flag = 1
S_pick = []

if len(S) < 2:
    print(0)
    sys.exit()

while flag:
    if len(S_list) == 0:
        break
    tmp = S_list[0]
    count = 0
    for i in range(1, len(S_list)):
        if S_list[i] == tmp and i == len(S_list)-1:
            break
            
        elif S_list[i] == tmp:
            tmp = S_list[i]
        else:
            S_pick.append(i-1)
            S_pick.append(i)
            tmp = S_list[i+1]
    for i in range(len(S_pick)-1, -1, -1):
        S_list.pop(S_pick[i])
    if len(S_pick) == 0:
        flag = 0
    S_pick = []
    
print(len(S)-len(S_list))
Problem p03127 (python)

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

def gcd(a,b):
    if ( b==0 ):
        return a
    else:
        return (gcd(b, a%b))

max_k = gcd(A_arr[0], A_arr[1])
if N > 2:
    for i in range(2, N):
        max_k = gcd(max_k, A_arr[i])
else:
    pass

print(max_k)

Buggy submission (verdict: Runtime Error):
import math

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

max_k = math.gcd(A_arr[0], A_arr[1])
if N > 2:
    for i in range(2, N):
        max_k = math.gcd(max_k, A_arr[i])
else:
    pass

print(max_k)
Problem p03135 (python)

Fixed submission:
t, x = [int(i) for i in input().split()]
print(t/x)

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
x_arr = [int(i) for i in input().split()]

x_sort = sorted(x_arr)

if n >= m:
    print(0)
else:
    x_sub = [x_sort[i+1]-x_sort[i] for i in range(m-1)]
    x_sub = sorted(x_sub)
    
    print(sum(x_sub[:-(n-1)]))
Problem p03137 (python)

Fixed submission:
n, m = [int(i) for i in input().split()]
x_arr = [int(i) for i in input().split()]

x_sort = sorted(x_arr)

if n >= m or m==1:
    print(0)
else:
    x_sub = [x_sort[i+1]-x_sort[i] for i in range(m-1)]
    x_sub = sorted(x_sub)
    print(sum(x_sub[:(m-1)-(n-1)]))

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
x_arr = [int(i) for i in input().split()]

x_sort = sorted(x_arr)
x_sub = []

if len(x_sort) == 1:
    print(0)
else:
    x_sub = [x_sort[i+1]-x_sort[i] for i in range(m-1) ]
    x_sub = sorted(x_sub)
    
    for i in range(n-1):
        x_sub.remove(x_sub[-1])
    
    print(sum(x_sub))

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
x_arr = [int(i) for i in input().split()]

x_sort = sorted(x_arr)
x_sub = []

if len(x_sort) == 1:
    print(0)
else:
    for i in range(m-1):
        x_sub.append(x_sort[i+1]-x_sort[i])
    
    x_sub = sorted(x_sub)
    
    for i in range(n-1):
        x_sub.remove(x_sub[-1])
    
    print(sum(x_sub))

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
x_arr = [int(i) for i in input().split()]
x_n = [[] for i in range(n)]

x_sort = sorted(x_arr)
x_sub = []

for i in range(m-1):
    x_sub.append(x_sort[i+1]-x_sort[i])

x_sub = sorted(x_sub)

for i in range(n-1):
    x_sub.remove(max(x_sub))

print(sum(x_sub))
Problem p03201 (python)

Fixed submission:
from collections import Counter
N = int(input())
A_arr = list(map(int, input().split()))

A_arr = sorted(A_arr, reverse=True)
C_arr = Counter(A_arr)

count = 0
for i in range(N):
    v_max = A_arr[i]
    if C_arr[v_max] == 0:
        continue
    C_arr[v_max] -= 1
    v_pair = 2**v_max.bit_length() - v_max
    if C_arr[v_pair] > 0:
        C_arr[v_pair] -= 1
        count += 1
    else:
        pass

print(count)

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

A_arr = sorted(A_arr, reverse=True)
two_arr = []
for i in range(1,31):
    two_arr.append(2**i)

count = 0
while len(A_arr) != 0:
    for j in range(30):
        if A_arr[0] > two_arr[j]:
            pass
        else:
            v_pair = two_arr[j] - A_arr[0]
            break
    if v_pair in A_arr:
        A_arr.remove(v_pair)
        count += 1
    else:
        pass
    A_arr.pop(0)

print(count)