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

Fixed submission:
from collections import deque

N, K = map(int, input().split())
x = list(map(int, input().split()))

x_upper = []

for i in reversed(x):
    if i<0:
        break
    if i>=0:
        x_upper.append(i)
        x.pop()
        
#絶対値昇順へソート
x.reverse()
x_upper.reverse()

lenXu = len(x_upper)
lenX = len(x)

if K>lenXu:
    l = K-lenXu-1
    h = lenXu-1
else:
    l = -1
    h = K-1

S = []
while l<K and l<lenX:
    if h<0:
        S.append(x[l]*(-1))
    elif l<0:
        S.append(x_upper[h])
    else:
        if (x[l]*(-1))<x_upper[h]:
            S.append((x[l]*(-1))*2 + x_upper[h])
        else:
            S.append((x[l]*(-1)) + x_upper[h]*2)
    l += 1
    h -= 1

print(min(S))

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

N, K = map(int, input().split())
x = list(map(int, input().split()))

x_upper = []

for i in reversed(x):
    if i<0:
        break
    if i>=0:
        x_upper.append(i)
        x.pop()
        
#絶対値昇順へソート
x.reverse()
x_upper.reverse()

lenXu = len(x_upper)
lenX = len(x)

if K>lenXu:
    l = K-lenXu-1
    h = lenXu-1
else:
    l = -1
    h = K-1

S = []
while l<K and l<lenX:
    if l>=0:
        if (x[l]*(-1))<x_upper[h]:
            S.append((x[l]*(-1))*2 + x_upper[h])
        else:
            S.append((x[l]*(-1)) + x_upper[h]*2)
    else:
        S.append(x_upper[h])
    l += 1
    h -= 1

print(min(S))

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

N, K = map(int, input().split())
x = list(map(int, input().split()))

x_upper = []

for i in reversed(x):
    if i<0:
        break
    if i>=0:
        x_upper.append(i)
        x.pop()
        
#絶対値昇順へソート
x.reverse()
x_upper.reverse()

lenXu = len(x_upper)
lenX = len(x)

if K>lenXu:
    min = K-lenXu-1
    max = lenXu-1
else:
    min = -1
    max = K-1

S = []
while min<K and min<lenX:
    if min>=0:
        if (x[min]*(-1))<x_upper[max]:
            S.append((x[min]*(-1))*2 + x_upper[max])
        else:
            S.append((x[min]*(-1)) + x_upper[max]*2)
    else:
        S.append(x_upper[max])
    min += 1
    max -= 1

print(S_stock)

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

N, K = map(int, input().split())
x = list(map(int, input().split()))

x_upper = []

for i in reversed(x):
    if i<0:
        break
    if i>=0:
        x_upper.append(i)
        x.pop()
        
#絶対値昇順へソート
x.reverse()
x_upper.reverse()

lenXu = len(x_upper)
lenX = len(x)

if K>lenXu:
    min = K-lenXu-1
    max = lenXu-1
else:
    min = -1
    max = K-1


S = 10**8
differ = -1

while differ<0:
    S_stock = S
    if min>=0:
        if (x[min]*(-1))<x_upper[max]:
            S = (x[min]*(-1))*2 + x_upper[max]
        else:
            S = (x[min]*(-1)) + x_upper[max]*2
    else:
        S = x_upper[max]
    differ = S - S_stock
    min += 1
    max -= 1

print(S_stock)
Problem p03280 (python)

Fixed submission:
List = list(map(int, input().split()))
a = List[0]
b = List[1]
# a = int(input())
# b = int(input())

s = a*b - (a+b) +1

print(s)

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

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

train = []
quest = []
for i in range(setting[1]):
    num = list(map(int, input().split()))
    train.append(num)
train = np.array(train)

for i in range(setting[2]):
    q = list(map(int, input().split()))
    quest.append(q)

train = train * np.array([1,-1])
for qs in quest:
    a = train
    sch = np.array(qs)
    sch = sch * np.array([-1,1])
    b = a + sch
    ans = np.delete(b, np.where(b<0), axis=0)

    print(ans.shape[0])
Problem p03282 (python)

Fixed submission:
import math
time = 5 * 10**15

num = list(input())
k = int(input())

chk = 0
count = 0
while chk == 0:
    if num[0] == '1':
        num.pop(0)
        count += 1
        if len(num)==0:
            break
    else:
        chk = 1

if k <= count:
    print(1)
else:
    print(num[0])

Buggy submission (verdict: Runtime Error):
import math
time = 5 * 10**15

num = list(input())
k = int(input())

chk = 0
count = 0
while chk == 0:
    if num[0] == '1':
        num.pop(0)
        count += 1
    else:
        chk = 1

if k <= count:
    print(1)
else:
    print(num[0])
Problem p04043 (python)

Fixed submission:
lst=list(map(int,input().split()))
if 7 in lst:
  lst.remove(5)
else:
    ans='NO'
if 5 in lst:
  lst.remove(7)
else:
    ans='NO'
if 5 in lst:
  ans='YES'
print(ans)

Buggy submission (verdict: Runtime Error):
lst=list(map(int,input().split()))
if 5 in lst:
  lst.remove(5)
else:
    ans='No'
if 7 in lst:
  lst.remove(7)
else:
    ans='No'
if 7 in lst:
  ans='Yes'
print(ans)
Problem p02947 (python)

Fixed submission:
# coding: utf-8
import collections
import math

l = int(input())
st = []
for i in range(l):
    x = ''.join(sorted(input()))
    st.append(x)
c = collections.Counter(st)
cv = c.values()
sum = 0
for i in cv:
    if int(i) > 1:
        tm = 0
        for j in range(int(i)-1):
            tm = tm + int(i)-1-j
        sum = sum + tm

print(math.floor(sum))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import collections
import math

l = int(input())
st = []
for i in range(l):
    x = ''.join(sorted(input()))
    st.append(x)
c = collections.Counter(st)
cv = c.values()
sum = 0
for i in cv:
    if int(i) > 1:
        sum = sum + math.factorial(int(i))/2

print(math.floor(sum))
Problem p03085 (python)

Fixed submission:
# coding: utf-8

str = input()

if str =='A' :
    str = 'T'
elif str == 'T' :
    str = 'A'
elif str == 'C':
    str = 'G'
elif str == 'G':
    str = 'C'

print(str)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

str = input()

if str =='A' :
    str = 'T'
    break
elif str == 'T' :
    str = 'A'
    break
elif str == 'C':
    str = 'G'
elif str == 'G':
    str = 'C'

print(str)
Problem p03228 (python)

Fixed submission:
number = input().strip().split(' ')
number_list = list(map(int,number))
A = number_list[0]
B = number_list[1]
K = number_list[2]

while K > 0:
    if A % 2 == 0:
        A = A
    else:
        A = A - 1
    A = A / 2
    B = B + A
    K = K - 1
    if K > 0:
        if B % 2 == 0:
            B = B
        else:
            B = B - 1
        B = B / 2
        A = A + B
        K = K - 1
print(str(int(A)) + ' ' + str(int(B)))

Buggy submission (verdict: Runtime Error):
number = input()
number_list = list(number)
A = int(number_list[0])
B = int(number_list[2])
K = int(number_list[4])

while K > 0:
    if A % 2 == 0:
        A = A
    else:
        A = A - 1
    A = A / 2
    B = B + A
    K = K - 1
    if K > 0:
        if B % 2 == 0:
            B = B
        else:
            B = B - 1
        B = B / 2
        A = A + B
        K = K - 1
print(str(int(A)) + ' ' + str(int(B)))
Problem p03239 (python)

Fixed submission:
# cording:utf-8
n,t_limit = (int(x) for x in input().split())
cost_list = list()
time_list = list()
while n >= 1:
    c,tn = (int(x) for x in input().split())
    if tn <= t_limit:
        cost_list.append(c)
        time_list.append(tn)
        n = n - 1
    else:
        n = n - 1
if not time_list:
    print('TLE')
else:
    best_cost = min(cost_list)
    print(best_cost)

Buggy submission (verdict: Runtime Error):
# cording:utf-8
n,t = (int(x) for x in input().split())
cost_list = list()
time_list = list()
while n >= 1:
    c,tn = (int(x) for x in input().split())
    if tn >= t:
        cost_list.append(c)
        time_list.append(tn)
        n = n - 1
    else:
        n = n - 1
best_time = min(time_list)
if best_time <= t:
    best_time_number = time_list.index(best_time)
    print(cost_list[best_time_number])
else:
    print('TLE')
Problem p02783 (python)

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

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

print(i)

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = map(int, input().split())
sum = 0

for val in A:
	sum = sum + val

if sum >= H 
	print("Yes")
  
print("No")
Problem p02784 (python)

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

for val in A:
	sum = sum + val

if sum >= H:
	print("Yes")
else:  
	print("No")

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

for val in A:
	sum = sum + val

if sum >= H 
	print("Yes")
  
print("No")

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = map(int, input().split())
sum = 0

for val in A:
	sum = sum + val

if sum >= H 
	print("Yes")
  
print("No")

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

for val in A
	sum = sum + val

if sum >= H 
	print("Yes")
  
print("No")

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = map(int, input().split())
sum = 0

for val in A
	sum = sum + val

if sum >= H 
	print("Yes")
  
print("No")
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

import math
p = [a, b, c, d, e]
pa = []
for i in range(len(p)):
    if p[i]%10 == 0:
        pa.append(0)
    else:
        pa.append(10 - p[i]%10)

ans = math.ceil(a/10)*10 + math.ceil(b/10)*10 + math.ceil(c/10)*10 + math.ceil(d/10)*10 + math.ceil(e/10)*10 - max(pa)
print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

import math
p = [a, b, c, d, e]
pa = [a%10, b%10, c%10, d%10, e%10]
ans = math.ceil(a/10)*10 + math.ceil(b/10)*10 + math.ceil(c/10)*10 + math.ceil(d/10)*10 + math.ceil(e/10)*10 - (10 - pa[pa.index(min([i for i in pa if i != 0]))])
print(ans)
Problem p03086 (python)

Fixed submission:
s = input()
import re
l = re.split('B|D|E|F|H|I|J|K|L|M|N|O|P|Q|R|S|U|V|W|X|Y|Z', s)
print(max([len(i) for i in l]))

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

l = [0]*len(s)
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or  s[i] == 'T':
        l[i]=1
        
a = []
ans=0
for k in l:
    if k==1:
        ans += k
    else:
        a.append(ans)
        ans=0
        
print(max(a))
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
l = []
for i in range(k):
    if a+i <= b-i:
        l.append(a+i)
        l.append(b-i)

List = sorted(set(l))
for i in range(len(List)):
    print(List[i])

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = list(range(a, b+1))
for i in sorted(list(set(l[:k]) | set(l[-k:]))):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = list(range(a, b+1))
for i in sorted(list(set(l[:k] + l[-k:]))):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = list(range(a, b+1))
if k != 0:
    for i in range(len(list(set(l[:k] + l[-k:])))):
        print(sorted(list(set(l[:k] + l[-k:])))[i])
else:
    print()

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = list(range(a, b+1))
for i in range(len(list(set(l[:k] + l[-k:])))):
    print(sorted(list(set(l[:k] + l[-k:])))[i])
Problem p03408 (python)

Fixed submission:
n = int(input())
sn = [input() for _ in range(n)]
m = int(input())
sm = [input() for _ in range(m)]

List = []
for i in range(len(list(set(sn)))):
    List.append(sn.count(list(set(sn))[i]) - sm.count(list(set(sn))[i]))
    
print(max(max(List), 0))

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

List = []
for i in range(len(list(set(n)))):
    List.append(n.count(list(set(n))[i]) - m.count(list(set(n))[i]))
    
print(max(List))
Problem p03777 (python)

Fixed submission:
a, b = input().split()
if a == b:
    print('H')
else:
    print('D')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a==b=="H" or a==b=="D":
    print("H")
else:
    print("D")
Problem p03846 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
if n%2==1:
    dummy = [0]
    for i in range(1, 1+(len(a)-1)//2):
        dummy.append(2*i)
        dummy.append(2*i)
    if sorted(a) == dummy:
        ans = 2**((len(a)-1)//2)
else:
    dummy = []
    for i in range(1,  1+(len(a))//2):
        dummy.append(2*i - 1)
        dummy.append(2*i - 1)
    if sorted(a) == dummy:
        ans = 2**((len(a))//2)
print(ans%(10**9 + 7))

Buggy submission (verdict: Runtime Error):
if len(a)%2==1:
    tmp = [0]
    for i in range((len(a)-1)//2):
        tmp.append((i+1)*2)
        tmp.append((i+1)*2)
    if a == tmp:
        ans = (2**((len(a)-1)//2))%(10**9+7)
    else:
        ans = 0
else:
    tmp = []
    for i in range(len(a)//2):
        tmp.append(2*i+1)
        tmp.append(2*i+1)
    if a == tmp:
        ans = (2**(len(a)//2))%(10**9+7)
    else:
        ans = 0
print(ans)
Problem p02958 (python)

Fixed submission:
N = int(input())
al = list(map(int,input().split()))
ansal = sorted(al)

for i in range(N):
    for j in range(i,N):
        cond_al = al.copy()
        cond_al[i],cond_al[j] = cond_al[j],cond_al[i]
        if(cond_al==ansal):
            print("YES")
            exit(0)

print("NO")

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

for i in range(N):
    for j in range(i,N):
        cond_al = al.copy()
        cond_al[i],cond_al[j] = cond_al[j],cond_al[i]
        if(cond_al==ansal):
            print("YES")
            exit(1)

print("NO")
Problem p02995 (python)

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

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

A,B,C,D = map(int,input().split(" "))
min_C = B//C-(A-1)//C
min_D = B//D-(A-1)//D
lcm = lcm(C,D)
min_lcm = B//lcm-(A-1)//lcm
print(B-A-min_C-min_D+min_lcm+1)

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split(" "))
min_C = int(B/C)-int((A-1)/C)
min_D = int(B/D)-int((A-1)/D)
lcm = int(C*D/math.gcd(C,D))
min_lcm = int(B/lcm)-int((A-1)/lcm)
print(B-A-min_C-min_D+min_lcm+1)

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split(" "))
min_C = int(B/C)-int((A-1)/C)
min_D = int(B/D)-int((A-1)/D)
lcm = C*D//math.gcd(C,D)
min_lcm = int(B/lcm)-int((A-1)/lcm)
print(B-A-min_C-min_D+min_lcm+1)

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split(" "))
min_C = B//C-(A-1)//C
min_D = B//D-(A-1)//D
lcm = C*D//math.gcd(C,D)
min_lcm = B//lcm-(A-1)//lcm
print(B-A-min_C-min_D+min_lcm+1)
Problem p02717 (python)

Fixed submission:
X,Y,Z=map(int, input().split())

print(Z,X,Y)

Buggy submission (verdict: Runtime Error):
X, Y, Z=int(input().split())
 
print(Z, X, Y)

Buggy submission (verdict: Runtime Error):
X,Y,Z=int(input().split())

print(Z,X,Y)
Problem p02922 (python)

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

print(1+math.ceil((B-A)/(A-1)))

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

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int, input().split())
if B==1 :
    print(1)
else :
    print(math.ceil((B-1)/(A-1))

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int, input().split())
 
print(math.ceil((B-1)/(A-1))
Problem p03423 (python)

Fixed submission:
N=int(input())
print(N//3)

Buggy submission (verdict: Runtime Error):
N=int(input())
print(X//3)
Problem p03796 (python)

Fixed submission:
import math
N=int(input())

print(math.factorial(N)%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N=int(input())

print(math.factorical(N)%(10**+7))

Buggy submission (verdict: Runtime Error):
import math

N=int(input())
print((math.factorical(N))%(10**9+7))
Problem p02705 (python)

Fixed submission:
R = int(input())

print(R*6.283)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
M = 1
while M <= N :
    print(A.count(M))
    M = M+1
Problem p02975 (python)

Fixed submission:
a = [input() for i in range(2)]
 
N = int(a[0])
data = a[1].split(' ')
 
data = [int(i) for i in data]
 
result = []
a = 0
for i in range(N):
    a = a ^ data[i]
    
if a == 0:
    print('Yes')
    exit()
    
print('No')

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

for i in range(len(a)):
    if i == 0:
        if not a[-1] ^ a[i+1] == a[i]:
            print('No')
            break
    elif i == len(a)-1:
        if a[0] ^ a[-2] == a[i]:
            print('Yes')
            break
        else:
            print('No')
            break
    else:
        if not a[i-1] ^ a[i+1] == a[i]:
            print('No')
            break
Problem p02983 (python)

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

if (R-L) > 2018:
    print(0)
else:
    mini = 2019
    for i in range(L,R):
        for j in range(i+1,R+1):
            mini = min(mini, (i*j)%2019)
    print(mini)

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

if (R-L) > 2018:
    print(0)
else:
    mini = 2019
    for i in range(L,R):
        for j in range(i+1,R+1):
            mini = min(mini, i*j%2019)
print(mini)

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

if (R-L) > 2018:
    print(0)
else:
    mini = 2019
    for i in range(R-L):
        mini = min(mini, (L+i)*(L+i+1)%2019)
print(mini)
Problem p03262 (python)

Fixed submission:
N, X = list(map(int, input().split()))
A = list(map(int, input().split()))
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
for i in range(N):
    A[i] = abs(A[i] - X)
g = A[0]
for i in range(1, N):
    g = gcd(g, A[i])
print(g)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
N, X = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
    A[i] = abs(A[i] - X)
print(gcd_list(A))

Buggy submission (verdict: Runtime Error):
import math
N, X = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
    A[i] = abs(A[i] - X)
g = A[0]
for i in range(1, N):
    g = math.gcd(g, A[i])
print(g)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
for i in range(len(S)):
    if S[i] != '1':
        if K >= i+1:
            print(S[i])
        else:
            print(1)
        break
else:
    print(1)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
i = 0
while 1:
    if S[i] != '1':
        print(S[i])
        break
    else:
        i += 1
Problem p03503 (python)

Fixed submission:
import math
N = int(input())
F = [[] * 10 for i in range(N)]
for i in range(N):
    F[i] = list(map(int, input().split()))
P = [[] * 11 for i in range(N)]
for i in range(N):
    P[i] = list(map(int, input().split()))
L = [0] * 10
Sum_max = -float("inf")
for i in range(1, 1024):
    for j in range(10):
        L[j] = i % 2
        i = int(i / 2)
    Sum = 0
    for j in range(N):
        count = 0
        for k in range(10):
            if L[k] == 1 and F[j][k] == 1:
                count += 1
        Sum += P[j][count]
    Sum_max = max(Sum_max, Sum)
print(Sum_max)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
F = [[] * 10 for i in range(N)]
for i in range(N):
    F[i] = list(map(int, input().split()))
P = [[] * 11 for i in range(N)]
for i in range(N):
    P[i] = list(map(int, input().split()))
L = [0] * 10
Sum_max = -float(math.inf)
for i in range(1, 1024):
    for j in range(10):
        L[j] = i % 2
        i = int(i / 2)
    Sum = 0
    for j in range(N):
        count = 0
        for k in range(10):
            if L[k] == 1 and F[j][k] == 1:
                count += 1
        Sum += P[j][count]
    Sum_max = max(Sum_max, Sum)
print(Sum_max)
Problem p03545 (python)

Fixed submission:
S = input()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
def ope(x,y,n,s):
    if n % 2 == 0:
        return x+y, str(s) + '+' + str(y)
    else:
        return x-y, str(s) + '-' + str(y)
for i in range(8):
    X1, S1 = ope(A,B,i,A)
    j = int(i/2)
    X2, S2 = ope(X1,C,j,S1)
    k = int(j/2)
    X3, S3 = ope(X2,D,k,S2)
    if X3 == 7:
        print(S3 + '=7')
        break

Buggy submission (verdict: Runtime Error):
def ope(i, ans, ans_str):
    if i == 3:
        if ans == 7:
            print(ans_str)
    else:
        ope(i+1, ans+int(S[i+1]), ans_str + "+" + S[i+1])
        ope(i+1, ans-int(S[i+1]), ans_str + "-" + S[i+1])
S = list(input())
ope(0,int(S[0]),S[0])+"=7"
Problem p03549 (python)

Fixed submission:
N, M = list(map(int, input().split()))
T1 = (N-M) * 100
T2 = (1900 * M)
print ((2 ** M) * (T1+ T2))

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = A.sort()
B = B.sort()
C = C.sort()
Sum = 0
for i in range(N):
    Start_B = bisect.bisect_left(B,A[i]+1)
    for j in range(Start_B, N):
        Start_C = bisect.bisect_left(C,B[j]+1)
        Sum += N - Start_C
print(Sum)
Problem p03645 (python)

Fixed submission:
N, M = list(map(int, input().split()))
X = [0] * N
Y = [0] * N
for i in range(M):
    S, E = list(map(int, input().split()))
    if S == 1:
        X[E-1] = 1
    if E == N:
        Y[S-1] = 1
for i in range(N):
    if X[i] == 1 and Y[i] == 1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
X = [0] * N
Y = [0] * N
for i in range(M):
    S, E = list(map(int, input().split()))
    if S == 1:
        X[E-1] = 1
    if E == N:
        Y[S-1] = 1
for i in range(N):
    if X[i] = Y[i]:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")
Problem p02718 (python)

Fixed submission:
N, M = input().split()
N = int(N)
M = int(M)
numbers = input().split()
numbers = [int(n) for n in numbers]
thresh = sum(numbers)/(4*M)
selected = list(filter(lambda x: x >= thresh, numbers))
if len(selected) >= M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, M = input().split()
N = int(N)
M = int(M)
numbers = input().split()
numbers = [int(n) for n in numbers]
thresh = sum(numbers)/(4*M)
if numbers[M] < thresh:
    print('No')
else:
    print('Yes')
Problem p03294 (python)

Fixed submission:
from fractions import gcd
N=int(input())
L=list(map(int,input().split()))
M=max(L)

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

p=1
for i in L:
    p=lcm(i,p)
q=0
print(sum([(p-1)%i for i in L]))

Buggy submission (verdict: Runtime Error):
from math import gcd
N=int(input())
L=list(map(int,input().split()))
M=max(L)

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

p=1
for i in L:
    p=lcm(i,p)
q=0
print(sum([(p-1)%i for i in L]))
Problem p03325 (python)

Fixed submission:
def two_div(n):
    count=0
    while n%2!=1:
        n=n/2
        count+=1
    return count

N=int(input())
L=list(map(int,input().split()))
L_div=[two_div(i) for i in L]
print(sum(L_div))

Buggy submission (verdict: Runtime Error):
import sympy
N=int(input())
L=list(map(int,input().split()))
L_alpha=[sympy.factorint(i) for i in L]
L=[i.get(2) for i in L_alpha]
L=[0 if i==None else i for i in L ]
print(sum(L))