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

Fixed submission:
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N,Q=rl()
S=input()
L,R=[0]*Q,[0]*Q
for i in range(Q):
    L[i],R[i] = rl()
s = [0]*(N+2)
ss = [0]*(N+2)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        s[i] = 1
        s[i+1] = 1

ss[0] = s[0]
for i in range(1,N):
    ss[i] = ss[i-1] + s[i]

for i in range(Q):
    l,r = L[i],R[i]
    l -= 1
    r -= 1
    res = (ss[r] - ss[l-1])//2
    if s[r]==1 and s[l]==1 and S[r]=='A' and S[l]=='C':
        res -= 1
    print(res)

Buggy submission (verdict: Runtime Error):
import bisect
I=lambda:map(int,input().split())
N,Q=I()
S=input()
L=[0]*Q
R=[0]*Q
for i in range(Q):
    L[i],R[i] = I()
m=[]
for i in range(N-1):
    if S[i]=='A' and S[i+1]=='C':
        m += [i]
#print(m)
for i in range(Q):
    l=L[i]
    r=R[i]
    li=bisect.bisect_left(m,l-1)
    ri=bisect.bisect_left(m,r-1)
    #print(i,li,ri)
    print(ri-li-1 if m[ri-1]==r else ri-li)
Problem p03377 (python)

Fixed submission:
a,b,x = (int(i) for i in input().split())
if a <= x and x <= a + b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()
a_i = a[-1]
max = 0
b = 0
from scipy.misc import comb
for i in a[0:-2]:
    buf = comb(a_i,i)
    if max < buf:
        max = buf
        b = i
    else:
        break
print("{} {}".format(a_i, b))
Problem p03047 (python)

Fixed submission:

v = [int(d) for d in input().split()]
#f = []

#for e in range(v[0]):
#    f.append(list(input()))

print(v[0]-v[1]+1)

Buggy submission (verdict: Runtime Error):

v = [int(d) for d in input().split()]
f = []

for e in range(v[0]):
    f.append(input())
re = 0
for d in f:
    re += d.count('AB')
dd = [list(s) for s in f]


b = 0
a = 0
coo= 0

for q in dd:
    if q[0] == 'B':
        b += 1
    if q[-1] == 'A':
        a += 1
        if q[0] == 'B':
            coo += 1

if a > b:
    ss = b
elif a < b:
    ss = a
elif a == b:
    ss == a

if ss == coo:
    if ss == b:
        if ss == a:
            if ss != 0:
                ss -= 1
re = re + ss
print(re)
Problem p03076 (python)

Fixed submission:
inp = []
for i in range(5):
    inp.append(int(input()))
inp2 = sorted(inp, key=lambda x: x%10)
inp3 = [d for d in inp2 if d%10 != 0]
if inp3 != []:

    last = inp3[0]
    inp2.remove(last)
else:
    last = 0

r = 0
for c,z in enumerate(inp2):
    if z%10 == 0:
        r += z
    else:
        r += z//10 * 10 + 10
res = r + last
print(res)

Buggy submission (verdict: Runtime Error):
inp = []
for i in range(5):
    inp.append(int(input()))
inp2 = sorted(inp, key=lambda x: x%10)
inp3 = [d for d in inp2 if d%10 != 0]
last = inp3[0]
inp2.remove(last)

r = 0
for c,z in enumerate(inp2):
    if z%10 == 0:
        r += z
    else:
        r += z//10 * 10 + 10
res = r + last
print(res)

Buggy submission (verdict: Runtime Error):
inp = []
for i in range(5):
    inp.append(int(input()))
inp2 = sorted(inp, key=lambda x: x%10)
inp3 = [d for d in inp2 if d%10 != 0]
last = inp3[0]
inp2.remove(last)
print(inp,inp2,inp3,last)

r = 0
for c,z in enumerate(inp2):
    if z%10 == 0:
        r += z
    else:
        r += z//10 * 10 + 10
    print(z,r)
res = r + last
print(res)

Buggy submission (verdict: Runtime Error):
inp = []
for i in range(5):
    inp.append(int(input()))
inp2 = sorted(inp, key=lambda x: x%10)
inp3 = [d for d in inp2 if d%10 != 0]
last = inp3[0]
inp2.remove(last)
print(inp,inp2,inp3,last)

r = 0
for c,z in enumerate(inp2):
    if z%10 == 0:
        r += z
    else:
        r += z//10 * 10 + 10
    print(z,r)
res = r + last
print(res)
Problem p03105 (python)

Fixed submission:
inp = input().split()
k = int(inp[1]) // int(inp[0])
if k >= int(inp[2]):
  f = int(inp[2])
else:
  f = k
print(f)

Buggy submission (verdict: Runtime Error):
inp = [int(i) for i in input().split()]
li =[]
li2 =[]

for k in range(1,inp[0]+1):
  f = inp[0] / k
  if f.is_integer():
    li.append(k)

for m in range(1,inp[1]+1):
  h = inp[1] / m
  if h.is_integer():
    li2.append(m)
    
li3 = list(set(li) & set(li2))
li3.sort()
print(li3[inp[2]-1])
Problem p03145 (python)

Fixed submission:
inp = [int(i) for i in input().split()]
ru = inp[0] * inp[1] / 2
print(int(ru))

Buggy submission (verdict: Runtime Error):
inp = int(input())
li = [inp]
i = 0
while True:
  if inp % 2 == 0:
    te = inp/2
    te = int(te)
    pass
  else:
    te = int(inp * 3 + 1)
  if te in li:
    print(int(len(li)+1))
    break
  else:
    li.append(te)
    inp = te

Buggy submission (verdict: Runtime Error):
inp = int(input())
li = [0]
i = 0
while True:
  te = inp/2
  if te.is_integer():
    te = int(te)
    pass
  else:
    te = int(inp * 3 + 1)
  if te in li:
    print(int(len(li)+1))
    break
  else:
    li.append(te)
    inp = te

Buggy submission (verdict: Runtime Error):
inp = int(input())
li = [0]
i = 0
while i == 0:
  te = inp/2
  if te.is_integer():
    pass
  else:
    te = inp * 3 + 1
  if te in li:
    print(int(len(li)+1))
    i = 1
  li.append(te)
  inp = te

Buggy submission (verdict: Runtime Error):
inp = int(input())
li = [0]
for i in li:
  te = inp/2
  if te.is_integer():
    pass
  else:
    te = inp * 3 + 1
  if te in li:
    print(int(len(li)+1))
    break
  li.append(te)
  inp = te
Problem p03854 (python)

Fixed submission:
inp = input()
inp = inp[::-1]
li = ['dream','dreamer','erase','eraser']
li = [k[::-1] for k in li]
m = 0
while True:
    for i in li:
        if inp.startswith(i):
    	    inp = inp.replace(i,'',1)
    	    m = 0
    else:
    	if m == 1:
    		break
    	else:
    		m = 1
    		continue
    break
if inp == '':
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
inp = input()
m = 0
n = 0
li = ['dream','dreamer','erase','eraser']
while True:
    for i in li:
        if inp.startswith(i):
    	    inpp = inp.replace(i,'',1)
    	    if inpp == '':
    		    m = 1
    		    break
    	    for k in li:
    	    	if inpp.startswith(k):
    		        inp = inpp
    		        n = 1
    		        break
    	    else:
                if k == 'eraser':
                	break
    	    	continue
    	    break
    if m == 1:
    	print('YES')
    	break
    if n != 1:
    	print('NO')
    	break
Problem p03086 (python)

Fixed submission:
N = input()
atc = ["A","T","C","G"]
ans = []
cnt = 0
for i in range(len(N)):
    if N[i] in atc:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
if cnt != 0:
    ans.append(cnt)
if ans == []:
    if N in atc:
        print(1)
    else:
        print(0)
else:
    print(max(ans))

Buggy submission (verdict: Runtime Error):
N = input()
atc = ["A","T","C","G"]
ans = []
cnt = 0
for i in range(len(N)):
    if N[i] in atc:
        cnt += 1 
    else:
        ans.append(cnt)
        cnt = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
N = input()
atc = ["A","T","C","G"]
ans = []
cnt = 0
for i in range(len(N)):
    if N[i] in atc:
        cnt += 1 
    else:
        ans.append(cnt)
print(max(ans))
Problem p03105 (python)

Fixed submission:
a,b,c = map(int,input().split())
print(min(b//a,c))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,Input.split())

if a * c <= b:
    print(c)
elif a > b:
    print(0)
elif a * c >b:
    print(a)
Problem p03126 (python)

Fixed submission:
a,b= map(int,input().split())
arr = [0]*b

for x in range(a):
    te = list(map(int,input().split()))
    K = te[0]
    if a != 1:
        for p in range(K):
            arr[te[p+1]-1] += 1
    else:
        arr = list(set(te[1:len(te)]))
h = max(arr)

if h == a:
    print(arr.count(h))
elif a == 1:
    print(len(arr))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
a,b= map(int,input().split())
arr = [0]*a

for x in range(a):
    te = list(map(int,input().split()))
    K = te[0]
    if a != 1:
        for p in range(K):
            arr[te[p+1]-1] += 1
    else:
        arr = list(set(te[1:len(te)]))
h = max(arr)

if h == a:
    print(arr.count(h))
elif a == 1:
    print(len(arr))
else:
    print(0)
Problem p03130 (python)

Fixed submission:
li = []
n = 3
import collections
for i in range(n):
    a,b = input().split()
    li.append(a)
    li.append(b)
    
c = collections.Counter(li)

def cole(di):
    i = 0
    for k in di.keys():
        if di[k] != 0 and di[k] <= 2:
            i += 1
        else:
            i -= 1
    if i == 4:
        return True
    else:
        return False

if cole(c):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):

for i in range(n):
    a,b = input().split()
    li.append(a)
    li.append(b)
    
an = li.count("1")+li.count("2")+li.count("3")+li.count("4")
if an >= 6:
    print("YES")
else:
    print("NO")
Problem p03268 (python)

Fixed submission:
n,k = map(int,input().split())
ans1 = 0
ans2 = 0
ans = 0
for x in range(1,n+1):
    if x % k ==0:
        ans1 +=1
if k % 2 == 0:
    for y in range(1,n+1):
        if y % k == k/2:
            ans2 +=1
print(ans1**3+ans2**3)

Buggy submission (verdict: Runtime Error):
from decimal import Decimal, ROUND_HALF_UP
n,k = map(int,input().split())
ans = 0
if k % 2 ==0:
    k = Decimal(n/k).quantize(Decimal('0'),rounding=ROUND_HALF_UP)
    ans = k**3 +(n//k)**3
else:
    ans = (n // k)**3
print(ans)
Problem p03006 (python)

Fixed submission:
N=int(input())
xy=list(sorted([list(map(int, input().split())) for _ in range(N)]))

if N==1:
    print(1)
    exit(0)
diff={}
for i in range(N):
    for j in range(i+1, N):
        a=(xy[i][0]-xy[j][0], xy[i][1]-xy[j][1])
        diff[a]=diff.get(a,0)+1
print(N-max(diff.values()))

Buggy submission (verdict: Runtime Error):
N=int(input())
xy=list(sorted([list(map(int, input().split())) for _ in range(N)]))

diff={}
for i in range(N):
    for j in range(i+1, N):
        a=(xy[i][0]-xy[j][0], xy[i][1]-xy[j][1])
        diff[a]=diff.get(a,0)+1
# print(diff)
print(N-max(diff.values()))
Problem p03086 (python)

Fixed submission:
S=input()
ls=[]
tmp=0
aaa=['A', 'T', 'G', 'C']
for i in range(len(S)):
	if S[i] not in aaa:
		ls.append(tmp)
		tmp=0
		continue
	else:
		tmp+=1
ls.append(tmp)
print(max(ls))

Buggy submission (verdict: Runtime Error):
S=input()
ls=[]
tmp=0
aaa=['A', 'T', 'G', 'C']
for i in range(len(S)):
	if S[i] not in aaa:
		ls.append(tmp)
		tmp=0
		continue
	else:
		tmp+=1
print(max(ls))
Problem p03126 (python)

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

tmp=[0]*(M+1)
for i in range(N):
	for j in range(1,KA[i][0]+1):
		tmp[KA[i][j]]+=1
# print(tmp)
ans=0
for i in range(M+1):
	if tmp[i]==N:
		ans+=1
print(ans)

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

tmp=[0]*M
for i in range(N):
	for j in range(KA[i][0]):
		tmp[KA[i][j]]+=1
# print(tmp)
ans=0
for i in range(M):
	if tmp[i]==N:
		ans+=1
print(ans)
Problem p03262 (python)

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

def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

x.append(X)
y=sorted(x)
z=[]
for i in range(N):
    z.append(y[i+1]-y[i])
Min=z[0]
for i in range(N-1):
    if Min>gcd(z[i],z[i+1]):
        Min=gcd(z[i],z[i+1])
print(Min)

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

def gcd_list(numbers):
    return reduce(gcd, numbers)

N,X=list(map(int,input().split()))
x=list(map(int,input().split()))
x.append(X)
x.sort()
y=[]

for i in range(N):
    y.append(x[i+1]-x[i])
print(gcd_list(y))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N,X=list(map(int,input().split()))
x=list(map(int,input().split()))
x.append(X)
x.sort()
y=[]

for i in range(N):
    y.append(x[i+1]-x[i])
print(gcd_list(y))
Problem p03284 (python)

Fixed submission:
N, K=list(map(int,input().split()))
print(0 if N%K==0 else 1)

Buggy submission (verdict: Runtime Error):
N=int(input())
is_ans=0
for i in range(25):
    if is_ans:
        break
    for j in range(14):
        if 4*i+7*j==N:
            is_ans=1
            break
print("Yes" if is_ans else "No")
Problem p03294 (python)

Fixed submission:

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

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

j=lcm(A[0],A[1])
for i in range(2,len(A)):
    j=lcm(j, A[i])

tmp=[]
for i in A:
    tmp.append((j-1)%i)
ans=sum(tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

j=lcm(A[0],A[1])
for i in range(2,len(A)):
    j=lcm(j, A[i])

tmp=[]
for i in A:
    tmp.append((j-1)%i)
ans=sum(tmp)
print(ans)
Problem p03309 (python)

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

for i in range(1,N+1):
    A[i-1]-=i

# ave1=sum(A)//len(A)
# ave2=-(-sum(A)//len(A))
# median=Counter(A).most_common(1)[0][0]

B=A[:]
C=A[:]

B.sort()
# 偶数の場合
if N % 2 == 0:
    median1 = N/2
    median2 = N/2 + 1
    median1 = int(median1) - 1
    median2 = int(median2) - 1
    median = (B[median1] + B[median2]) / 2

    # 奇数の場合
else:
    median = (N + 1) / 2
    median = int(median) - 1
    median = B[median]

median=int(median)

for i in range(0,N):
    C[i]-=median
    C[i]=abs(C[i])

print(sum(C))

Buggy submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
A = list(map(int,input().split()))

for i in range(1,N+1):
    A[i-1]-=i

# ave1=sum(A)//len(A)
# ave2=-(-sum(A)//len(A))
# median=Counter(A).most_common(1)[0][0]
B=[]
C=[]
for k in range(min(A),max(A)+1):
    B.append(A[:])

    for i in range(0,N):
        B[k][i]-=k

        B[k][i]=abs(B[k][i])
    C.append(sum(B[k]))
print(min(C))
Problem p03351 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
if (abs(a-b)<=d and abs(b-c)<=d) or abs(a-c)<=d:
    print("Yes")
else:
    print("No")

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

l =[]

for i in range(len(s)):
    tmp = ''
    for j in range(i, len(s)):
        if j > i + 4: break
        tmp += s[j]
        l.append(tmp)
l.sort()

l2 = list(set(l))

ans = l2[K - 1]

print(ans)
Problem p03359 (python)

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

if b >= a:
    print(a)
else:
    print(a-1)

Buggy submission (verdict: Runtime Error):
a, b = int(input())

if b >= a:
    print(a)
else:
    print(a)
Problem p03369 (python)

Fixed submission:
s = input()

ct = 0

for i in range(len(s)):
    if s[i] == 'o':
        ct += 1

print(700 + 100 * ct)

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

price = min(A*X+B*Y, C*2*max(X, Y))

is_break = 0


if X >= Y:
    for a in range(X+1):
        if is_break:
            break
        for b in [0, Y]:
            if is_break:
                break
            for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)+1):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
else:
    for a in [0, X]:
        if is_break:
            break
        for b in range(Y+1):
            if is_break:
                break
            for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)+1):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
print(price)
Problem p03371 (python)

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

price = min(A*X+B*Y, C*2 * (max(X, Y)))

is_break = 0

for i in range(100000):
    if price >= A*max(0, X - i) + B*max(0, Y - i)+2*C*i:
        price = A*max(0, X - i) + B*max(0, Y - i)+2*C*i
print(price)

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

price = min(A*X+B*Y, C*2*max(x, y))

is_break = 0
for a in range(X+1):
    if is_break:
        break
    for b in range(Y+1):
        if is_break:
            break
        for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b) + 1):
            if price >= A*a+B*b+C*c:
                price = A*a+B*b+C*c
                is_break = 1
                break

print(price)
Problem p03393 (python)

Fixed submission:
S=list(input())

chara=list("abcdefghijklmnopqrstuvwxyz")
chara_dic={}
for i in range(len(chara)):
	chara_dic[chara[i]]=i
chara_dic_2={}
for i in range(len(chara)):
	chara_dic_2[i]=chara[i]

count={}
for s in S:
	count[s]=count.get(s,0)+1

flag=0
if len(count)==len(chara):
	cur_chara=len(S)-1
	for pt in range(len(S)-2,-1,-1):
		if chara_dic[S[cur_chara]]<chara_dic[S[pt]]:
			cur_chara-=1
		else:
			flag=1
			ans=''
			for i in range(0,pt):
				ans+=str(S[i])
			ls=[]
			for i in range(pt+1,len(S)):
				if chara_dic[S[pt]]<chara_dic[S[i]]:
						ls.append(chara_dic[S[i]])
			ans+=chara_dic_2[min(ls)]
			break
else:
	flag=1
	ans=''
	for i in range(len(S)):
		ans+=S[i]
	for i in range(len(chara)):
		if chara[i] not in S:
			end=chara[i]
			break
	ans+=end

print(ans if flag else "-1")

Buggy submission (verdict: Runtime Error):
S=list(input())

chara=list("abcdefghijklmnopqrstuvwxyz")
chara_dic={}
for i in range(len(chara)):
	chara_dic[chara[i]]=i
chara_dic_2={}
for i in range(len(chara)):
	chara_dic_2[i]=chara[i]

count={}
for s in S:
	count[s]=count.get(s,0)+1

flag=0
if len(count)==len(chara):
	cur_chara=len(S)-1
	for pt in range(len(S)-2,0,-1):
		if chara_dic[S[cur_chara]]==chara_dic[S[pt]]-1:
			cur_chara-=1
		else:
			flag=1
			ans=''
			for i in range(0,pt):
				ans+=str(S[i])
			ans+=chara_dic_2[chara_dic[S[pt]]+1]
			break
else:
	flag=1
	ans=''
	for i in range(len(S)):
		ans+=S[i]
	for i in range(len(chara)):
		if chara[i] not in S:
			end=chara[i]
			break
	ans+=end

print(ans if flag else "-1")
Problem p03424 (python)

Fixed submission:
N=int(input())
a=input().split()
print("Four" if "Y" in a else "Three")

Buggy submission (verdict: Runtime Error):
N=int(input())
a=map(int, input().split())
print("Four" if "Y" in a else "Three")
Problem p03474 (python)

Fixed submission:
from collections import Counter
A,B=list(map(int, input().split()))
S=list(input())

print("Yes" if S[A]=='-' and Counter(S)['-']==1 else "No")

Buggy submission (verdict: Runtime Error):
3 4
269-6650
Problem p03493 (python)

Fixed submission:
a = list(str(int(input())))
print(a.count("1"))

Buggy submission (verdict: Runtime Error):
a = list(str(int(input)))
print(a.count("1"))
Problem p03545 (python)

Fixed submission:
ABCD=list(map(int, list(input())))
for i in range(1<<3):
    tmp=list(map(int, list(str(bin(i))[2:].zfill(3))))
    a=ABCD[0]
    for j in range(3):
        if tmp[j]:
            a+=ABCD[j+1]
        else:
            a-=ABCD[j+1]
    if a==7:
        print(ABCD[0], end="")
        for j in range(3):
            print("+" if tmp[j] else "-", end="")
            print(ABCD[j+1], end="")
        print("=7")
        exit(0)

Buggy submission (verdict: Runtime Error):
ABCD=list(map(int, list(input())))
for i in range(1<<3):
    tmp=list(map(int, list(str(bin(i))[2:].zfill(3))))
    a=ABCD[0]
    for j in range(3):
        if tmp[j]:
            a+=ABCD[j+1]
        else:
            a-=ABCD[j+1]
    if a==7:
        print(ABCD[0], end="")
        for j in range(3):
            print("+" if tmp[j] else "-", end="")
            print(ABCD[j+1], end="")
        print("=7")
        exit(1)

Buggy submission (verdict: Runtime Error):
ABCD=list(map(int, list(input())))
for i in range(1<<3):
    tmp=list(map(int, list(str(bin(i))[2:].zfill(3))))
    print(tmp)
    a=ABCD[0]
    for j in range(3):
        if tmp[j]:
            a+=ABCD[j+1]
        else:
            a-=ABCD[j+1]
    if a==7:
        print(ABCD[0], end="")
        for j in range(3):
            print("+" if tmp[j] else "-", end="")
            print(ABCD[j+1], end="")
        print("=7")
        exit(1)
Problem p03557 (python)

Fixed submission:
import bisect
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))

A.sort()
C.sort()
ans=0
for b in B:
    ans+=bisect.bisect_left(A,b)*(len(C)-bisect.bisect_right(C,b))
print(ans)

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

def binary_search(list,target,b):
    left = 0
    right = len(list) - 1

    while left <= right:
        center = (left + right)//2
        if list[center] == target:
            if b:
                while list[center]==target:
                    center+=1
            return center
        elif list[center] < target:
            left = center + 1
        elif list[center] > target:
            right = center - 1

    if list[center]<target:
        center+=1
    return center

A.sort()
C.sort()
ans=0
for b in B:
    ans+=binary_search(A,b,0)*(len(C)-binary_search(C,b,1))
print(ans)
Problem p03599 (python)

Fixed submission:
A, B, C, D, E, F=map(int, input().split())
a=[[str(100*A),'0']]
for i in range(101):
    for j in range(101):
        for k in range(101):
            for l in range(101):
                x=100*A*i+100*B*j
                y=C*k+D*l
                if x+y>F or x==0:
                    break
                if 100*y/(x+y)<=(E*100)/(100+E):
                    a.append([str(x+y),str(y)])
print(' '.join(sorted(a, key=lambda x: (100*int(x[1]))/int(x[0]) if int(x[0])!=0 else 0)[-1]))

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F=map(int, input().split())
a=[[0,0]]
for i in range(101):
    for j in range(101):
        for k in range(101):
            for l in range(101):
                x=100*A*i+100*B*j
                y=C*k+D*l
                if x+y>F or x==0 or y==0:
                    break
                if 100*y/(x+y)<=(E*100)/(100+E):
                    a.append([str(x+y),str(y)])
print(' '.join(sorted(a, key=lambda x: (100*int(x[1]))/int(x[0]) if int(x[0])!=0 else 0)[-1]))

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F=map(int, input().split())
a=[]
for i in range(101):
    for j in range(101):
        for k in range(101):
            for l in range(101):
                x=100*A*i+100*B*j
                y=C*k+D*l
                if x+y>F or x==0 or y==0:
                    break
                if 100*y/(x+y)<=(E*100)/(100+E):
                    a.append([str(x+y),str(y)])
print(' '.join(sorted(a, key=lambda x: (100*int(x[1]))/int(x[0]) if int(x[0])!=0 else 0)[-1]))

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F=map(int, input().split())
a=[]
for i in range(101):
    for j in range(101):
        for k in range(101):
            for l in range(101):
                x=100*A*i+100*B*j
                y=C*k+D*l
                if x+y>F or x==0 or y==0:
                    break
                if 100*y//(x+y)<=(E*100)/(100+E):
                    a.append([str(x+y),str(y)])
print(' '.join(sorted(a, key=lambda x: (100*int(x[1]))/int(x[0]) if int(x[0])!=0 else 0)[-1]))
Problem p03611 (python)

Fixed submission:
from collections import Counter
N=int(input())
a=list(map(int, input().split()))
b=[]
for i in range(N):
    b.append(a[i])
    b.append(a[i]+1)
    b.append(a[i]-1)
Ctb=Counter(b)
print(max(Ctb.values()))

Buggy submission (verdict: Runtime Error):
N=int(input())
p=list(map(int,input().split()))
q=['x' for _ in range(N)]
ans=0
for i in range(N):
    if p[i]!=i+1:
        q[i]='o'
for i in range(N-1):
    if q[i]=='x':
        if i<n-1:
            p[i], p[i+1]=p[i+1], p[i]
        else:
            p[i], p[i-a1]=p[i-1], p[i]
        q[i]='o'
        q[i+1]='o'
        ans+=1

print(ans)