ZhenlongDai/ACPR huggingface dataset:
Problem: p03479
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,y = map(int,input().split())
cnt = 1
while x * cnt <= y:
    cnt += 1
    x *= 2
print(cnt)

Failing test case input:
5597 307210693821963751

Expected output:
46


Actual output:
42


Fixed submission (verdict: Accepted):
x,y = map(int,input().split())
cnt = 1
while x * 2 <= y:
    x *= 2
    cnt += 1
print(cnt)

Problem: p03479
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

x, y = map(int, input().split())
ans = 0
for k in range(1, 40):
    
    if int(y / (x * 2**k)) < 1:
        ans = k
        break
print(ans)

Failing test case input:
363 5404913929872006

Expected output:
44


Actual output:
0


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

x, y = map(int, input().split())
ans = 0
while True:
    ans += 1
    temp = x * 2 ** ans
    if temp > y:
        break
print(ans)

Problem: p03479
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input().split()
ans=1
b=0
c=[int(a[0])]
while(0==0):
    if c[b]*2<int(a[1])-1:
        c.append(c[b]*2)
        b+=1
    else:
        print(len(c))
        break

Failing test case input:
25 100

Expected output:
3

Actual output:
2


Fixed submission (verdict: Accepted):
a = input().split()
b=0
c=[int(a[0])]
while(0==0):
    if c[b]*2<=int(a[1]):
        c.append(c[b]*2)
        b+=1
    else:
        print(len(c))
        break

Problem: p03479
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,y = map(int, input().split())
count = 0
while x*2 <= y:
    x = x*2
    count += 1
print(count)

Failing test case input:
489 338021882461105620

Expected output:
50


Actual output:
49


Fixed submission (verdict: Accepted):
x,y = map(int, input().split())
count = 1
while x*2 <= y:
    x = x*2
    count += 1
print(count)
Problem: p03764
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools


def main():
    n, m = map(int, input().split())

    x = list(map(int, input().split()))
    y = list(map(int, input().split()))

    x_len = 0
    y_len = 0

    for i in range(n):
        x_len += (2 * i - n + 1) * x[i] % (10 ** 9 + 7)
        print(x_len)

    for j in range(m):
        y_len += (2 * j - m + 1) * y[j] % (10 ** 9 + 7)
        print(y_len)

    print(x_len * y_len % (10 ** 9 + 7))


if __name__ == '__main__':
    main()


Failing test case input:
3 3
1 3 4
1 3 6

Expected output:
60

Actual output:
1000000005
1000000005
1000000013
1000000005
1000000005
1000000017
60


Fixed submission (verdict: Accepted):
import itertools


def main():
    n, m = map(int, input().split())

    x = list(map(int, input().split()))
    y = list(map(int, input().split()))

    x_len = 0
    y_len = 0

    for i in range(n):
        x_len += (2 * i - n + 1) * x[i] % (10 ** 9 + 7)
        

    for j in range(m):
        y_len += (2 * j - m + 1) * y[j] % (10 ** 9 + 7)
        

    print(x_len * y_len % (10 ** 9 + 7))


if __name__ == '__main__':
    main()
Problem: p03764
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
INF=10**9+7
L=[int(i)-1 for i in input().split()]
x=[int(i)   for i in input().split()]
y=[int(i)   for i in input().split()]
x.sort()
y.sort()

X=[x[i+1]-x[i] for i in range(L[0])]
Y=[y[i+1]-y[i] for i in range(L[1])]

usingX=[0 for i in range(L[0])]
usingY=[0 for i in range(L[1])]

if L[0]%2==0:
	for i in range(L[0]):
		temp=min(i,L[0]-i-1)
		temp+=1
		usingX[i]+=int(temp*(temp+1)/2)
		
		usingX[i]+=temp*int(L[0]/2-temp)
		
		usingX[i]*=2
		
else:
	for i in range(L[0]):
		temp=min(i,L[0]-i-1)
		temp+=1
		usingX[i]+=int(temp*(temp+1)/2)
		usingX[i]+=temp*int((L[0]-1)/2-temp)
		usingX[i]*=2
		
		usingX[i]+=temp
	
	


if L[1]%2==0:
	for i in range(L[1]):
		temp=min(i,L[1]-i-1)
		temp+=1
		usingY[i]+=int(temp*(temp+1)/2)
		
		usingY[i]+=temp*int(L[1]/2-temp)
		
		usingY[i]*=2
		
else:
	for i in range(L[1]):
		temp=min(i,L[1]-i-1)
		temp+=1
		usingY[i]+=int(temp*(temp+1)/2)
		usingY[i]+=temp*int((L[1]-1)/2-temp)
		usingY[i]*=2
		
		usingY[i]+=temp
	
	

print(usingX)
print(usingY)
for i in range(L[0]):
	X[i]*=usingX[i]
for j in range(L[1]):
	Y[j]*=usingY[j]
ans=sum(X)*sum(Y)
print(ans%INF)

Failing test case input:
3 3
1 3 4
1 3 6

Expected output:
60

Actual output:
[2, 2]
[2, 2]
60


Fixed submission (verdict: Accepted):
INF=10**9+7
L=[int(i)-1 for i in input().split()]
x=[int(i)   for i in input().split()]
y=[int(i)   for i in input().split()]
x.sort()
y.sort()

X=[x[i+1]-x[i] for i in range(L[0])]
Y=[y[i+1]-y[i] for i in range(L[1])]

usingX=[0 for i in range(L[0])]
usingY=[0 for i in range(L[1])]

if L[0]%2==0:
	for i in range(L[0]):
		temp=min(i,L[0]-i-1)
		temp+=1
		usingX[i]+=int(temp*(temp+1)/2)
		
		usingX[i]+=temp*int(L[0]/2-temp)
		
		usingX[i]*=2
		
else:
	for i in range(L[0]):
		temp=min(i,L[0]-i-1)
		temp+=1
		usingX[i]+=int(temp*(temp+1)/2)
		usingX[i]+=temp*int((L[0]-1)/2-temp)
		usingX[i]*=2
		
		usingX[i]+=temp
	
	


if L[1]%2==0:
	for i in range(L[1]):
		temp=min(i,L[1]-i-1)
		temp+=1
		usingY[i]+=int(temp*(temp+1)/2)
		
		usingY[i]+=temp*int(L[1]/2-temp)
		
		usingY[i]*=2
		
else:
	for i in range(L[1]):
		temp=min(i,L[1]-i-1)
		temp+=1
		usingY[i]+=int(temp*(temp+1)/2)
		usingY[i]+=temp*int((L[1]-1)/2-temp)
		usingY[i]*=2
		
		usingY[i]+=temp
	
	



for i in range(L[0]):
	X[i]*=usingX[i]
for j in range(L[1]):
	Y[j]*=usingY[j]
ans=sum(X)*sum(Y)
print(ans%INF)
Problem: p03764
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
mod=10**9+7
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
ansx=0
cum=x[0]
for i in range(1,n):
    ansx+=(i*x[i]-cum+mod)%mod
    ansx%=mod
    cum+=x[i]
ansy=0
cum=y[0]
for i in range(1,m):
    ansy+=(i*y[i]-cum+mod)%mod
    ansy%=mod
    cum+=y[i]
print(ansx,ansy)
print((ansx*ansy)%mod)


Failing test case input:
3 3
1 3 4
1 3 6

Expected output:
60

Actual output:
6 10
60


Fixed submission (verdict: Accepted):
mod=10**9+7
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
ansx=0
cum=x[0]
for i in range(1,n):
    ansx+=(i*x[i]-cum+mod)%mod
    ansx%=mod
    cum+=x[i]
ansy=0
cum=y[0]
for i in range(1,m):
    ansy+=(i*y[i]-cum+mod)%mod
    ansy%=mod
    cum+=y[i]

print((ansx*ansy)%mod)
Problem: p03714
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

import sys
import math
import heapq


def input(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')


sys.setrecursionlimit(10**8)
inf = float('inf')
count = 0
ans = -inf
n = int(input())
A = list(map(int, input().split()))
AL = A[:n]
AR = A[2*n:]
AL.sort()
AR.sort(reverse=1)
i1 = i2 = j1 = j2 = 0
i = j = 0
ANL = A[n:2*n]
ANR = ANL[::-1]
LS = sum(AL)
RS = sum(AR)
heapq.heapify(AL)
AR = list(map(lambda ddd: -ddd, AR))

heapq.heapify(AR)
ans = max(ans, LS-RS)

for count in range(n):
    print(AL,AR)
    
    if ANL[i]-AL[0] > -AR[0]-ANR[j]:
        LS = LS-heapq.heappop(AL)+ANL[i]
        heapq.heappush(AL,ANL[i])
        i += 1
    else:
        RS = RS+heapq.heappop(AR)+ANR[j]
        heapq.heappush(AR,-ANR[j])
        j += 1
    
    ans = max(ans, LS-RS)
print(AL,AR)



print(ans)


Failing test case input:
1
1 2 3

Expected output:
-1

Actual output:
[1] [-3]
[1] [-2]
-1


Fixed submission (verdict: Accepted):

import sys, math, heapq,copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans=count=0


ans = -inf
n = int(input())
A = list(map(int, input().split()))
AL, AR = A[:n], A[2*n:]
al,ar=copy.copy(AL),copy.copy(AR)
AN = A[n:2*n]
LS, RS = sum(AL), sum(AR)
AR = list(map(lambda ddd: -ddd, AR))
heapq.heapify(AL)
heapq.heapify(AR)
tmp=LS
ANSR=[0]*n
ANSL=[0]*n

for i in range(n):
    if AN[i]-AL[0] >0:
        LS = LS-heapq.heappop(AL)+AN[i]
        heapq.heappush(AL,AN[i])
    ANSL[i] = LS

LS=tmp
for j in range(n-1,-1,-1):
    if 0 < -AR[0]-AN[j]:
        RS = RS+heapq.heappop(AR)+AN[j]
        heapq.heappush(AR,-AN[j])
    ANSR[j] = RS
ANSR=ANSR+[sum(ar)]
ANSL=[sum(al)]+ANSL
for i in range(n+1):
    ans=max(ans,ANSL[i]-ANSR[i])
print(ans)
Problem: p03714
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import heapq

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

pre = [0]*(n+1)
pre_list = [e for e in A[:n]]
heapq.heapify(pre_list)
pre_sum = sum(pre_list)
pre[0] = pre_sum
for i in range(n, 2*n):
    small = heapq.heappushpop(pre_list, A[i])
    pre_sum += A[i] - small
    pre[i-n+1] = pre_sum

suf = [0]*(n+1)
suf_list = [-e for e in A[2*n:]]
heapq.heapify(suf_list)
suf_sum = -sum(suf_list)
suf[-1] = suf_sum
for i in range(2*n-1, n-1, -1):
    large = -heapq.heappushpop(suf_list, A[i])
    suf_sum += A[i] - large
    suf[i-n] = suf_sum




print(max([pre[i] - suf[i] for i in range(n+1)]))


Failing test case input:
3
3 8 1 2 1 4 -1 6 1

Expected output:
12


Actual output:
9


Fixed submission (verdict: Accepted):
import heapq

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

pre = [0]*(n+1)
pre_list = [e for e in A[:n]]
heapq.heapify(pre_list)
pre_sum = sum(pre_list)
pre[0] = pre_sum
for i in range(n, 2*n):
    small = heapq.heappushpop(pre_list, A[i])
    pre_sum += A[i] - small
    pre[i-n+1] = pre_sum

suf = [0]*(n+1)
suf_list = [-e for e in A[2*n:]]
heapq.heapify(suf_list)
suf_sum = -sum(suf_list)
suf[-1] = suf_sum
for i in range(2*n-1, n-1, -1):
    large = -heapq.heappushpop(suf_list, -A[i])
    suf_sum += A[i] - large
    suf[i-n] = suf_sum




print(max([pre[i] - suf[i] for i in range(n+1)]))

Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import heapq
n = int(input())
a = list(map(int, input().split()))

a1 = a[:n]
ax = a[n:2*n]
a2 = list(map(lambda x: -x, a[2*n:]))
print('a2', a2)

sum_a1 = sum(a1)
fdif1 = [sum_a1]
heapq.heapify(a1)
for i in range(n):
    p = heapq.heappushpop(a1,ax[i])
    fdif1.append(fdif1[-1]+ax[i]-p)
    
sum_a2 = sum(a2)
fdif2 = [sum_a2]
heapq.heapify(a2)
print('a2', a2)
for i in range(n):
    p = heapq.heappushpop(a2,-ax[-1-i])
    fdif2.append(fdif2[-1]-ax[-1-i]-p)
fdif2.reverse()

fdif = [fdif1[i]+fdif2[i] for i in range(n)]
print(max(fdif))

Failing test case input:
2
3 1 4 1 7 0

Expected output:
6


Actual output:
a2 [-7, 0]
a2 [-7, 0]
6


Fixed submission (verdict: Accepted):
import heapq
n = int(input())
a = list(map(int, input().split()))

a1 = a[:n]
ax = a[n:2*n]
a2 = list(map(lambda x: -x, a[2*n:]))


sum_a1 = sum(a1)
fdif1 = [sum_a1]
heapq.heapify(a1)
for i in range(n):
    p = heapq.heappushpop(a1,ax[i])
    fdif1.append(fdif1[-1]+ax[i]-p)
    
sum_a2 = sum(a2)
fdif2 = [sum_a2]
heapq.heapify(a2)

for i in range(n):
    p = heapq.heappushpop(a2,-ax[-1-i])
    fdif2.append(fdif2[-1]-ax[-1-i]-p)
fdif2.reverse()

fdif = [fdif1[i]+fdif2[i] for i in range(n+1)]
print(max(fdif))
Problem: p03714
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def examD():
    N = I()
    a = LI()
    a_b = list(map(lambda x: x*(-1), a))
    R = a[:N]; B = a_b[2*N:]
    heapq.heapify(R)
    heapq.heapify(B)
    ansC =[]
    curR = [sum(R)]; curB = [-sum(B)]
    for i in range(N):
        heapq.heappush(R, a[N+i])
        cur = curR[-1] - heapq.heappop(R) + a[N+i]
        curR.append(cur)
    for i in range(N):
        heapq.heappush(B, a_b[2*N-1-i])
        cur =curB[-1] - heapq.heappop(B)*(-1) - a_b[2*N-1-i]
        curB.append(cur)
    for i in range(N):
        ansC.append(curR[i]-curB[-1-i])
    ans = max(ansC)
    print(ans)




import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()


Failing test case input:
1
0 1 -1

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
def examD():
    N = I()
    a = LI()
    a_b = list(map(lambda x: x*(-1), a))
    R = a[:N]; B = a_b[2*N:]
    heapq.heapify(R)
    heapq.heapify(B)
    ansC =[]
    curR = [sum(R)]; curB = [-sum(B)]
    for i in range(N):
        heapq.heappush(R, a[N+i])
        cur = curR[-1] - heapq.heappop(R) + a[N+i]
        curR.append(cur)
    for i in range(N):
        heapq.heappush(B, a_b[2*N-1-i])
        cur =curB[-1] - heapq.heappop(B)*(-1) - a_b[2*N-1-i]
        curB.append(cur)
    for i in range(N+1):
        ansC.append(curR[i]-curB[-1-i])
    ans = max(ansC)
    print(ans)




import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()
Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy
n=int(input())
a=list(map(int,input().split()))
import heapq as hq
f1=[0]*(3*n)
f1[n-1]=sum(a[:n])
h=copy.deepcopy(a[:n])
hq.heapify(h)
su=f1[n-1]
for i in range(n,2*n):
    cur=a[i]
    x=hq.heappop(h)
    if cur>x:
        su-=x
        su+=cur
        hq.heappush(h,cur)
    else:
        hq.heappush(h,x)
    f1[i]=su
f2=[0]*(3*n)
f2[2*n]=sum(a[2*n:])
su=f2[2*n]
h2=[]
for i in a[2*n:]:
    h2.append(-i)
hq.heapify(h2)
for i in range(2*n-1,n-1,-1):
    cur=a[i]
    x=-1*hq.heappop(h2)
    if cur<x:
        su-=x
        su+=cur
        hq.heappush(h2,cur)
    else:
        hq.heappush(h2,-x)
    f2[i]=su
ans=-float('inf')
for i in range(n-1,2*n):
    ans=max(ans,f1[i]-f2[i+1])
print(ans)





Failing test case input:
3
3 8 1 2 1 4 -1 6 1

Expected output:
12


Actual output:
9


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
import heapq as hq
f1=[0]*(3*n)
f1[n-1]=sum(a[:n])
h=a[:n]
hq.heapify(h)
su=f1[n-1]
for i in range(n,2*n):
    cur=a[i]
    x=hq.heappop(h)
    if cur>x:
        su-=x
        su+=cur
        hq.heappush(h,cur)
    else:
        hq.heappush(h,x)
    f1[i]=su
f2=[0]*(3*n)
f2[2*n]=sum(a[2*n:])
su=f2[2*n]
h2=[]
for i in a[2*n:]:
    h2.append(-i)
hq.heapify(h2)
for i in range(2*n-1,n-1,-1):
    cur=a[i]
    x=-1*hq.heappop(h2)
    if cur<x:
        su-=x
        su+=cur
        hq.heappush(h2,-cur)
    else:
        hq.heappush(h2,-x)
    f2[i]=su
ans=-float('inf')
for i in range(n-1,2*n):
    ans=max(ans,f1[i]-f2[i+1])
print(ans)
Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import heapq

N = int(input())

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

left = A[:N]
left_total = [(sum(left))]
heapq.heapify(left)

for i in range(N, 2*N):
    l = heapq.heappop(left)
    
    if l >= A[i]:
        heapq.heappush(left,l)
        left_total.append(left_total[-1])
    
    else:
        heapq.heappush(left,A[i])
        left_total.append(left_total[-1] - l + A[i])


right = [-i for i in A[2*N:]]
right_total = [sum(right)]
heapq.heapify(right)

for i in reversed(range(N, 2*N)):
    r = heapq.heappop(right)
    
    if r >= -1*A[i]:
        heapq.heappush(right, r)
        right_total.append(right_total[-1])
    else:
        heapq.heappush(right, A[i])
        right_total.append(right_total[-1] - r - A[i])


right_total = right_total[::-1]

ans = -float("inf")
for i in range(len(left_total)):
    ans = max(ans, left_total[i] + right_total[i])

print(ans)

Failing test case input:
3
3 8 1 2 1 4 -1 6 1

Expected output:
12


Actual output:
9


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

import heapq

lefts = a[:n]
lefts_sums = [sum(lefts)]
heapq.heapify(lefts)

for x in range(n, 2 * n):
    l = heapq.heappop(lefts)
    if l < a[x]:
        heapq.heappush(lefts, a[x])
        lefts_sums.append(lefts_sums[-1] - l + a[x])
    else:
        heapq.heappush(lefts, l)
        lefts_sums.append(lefts_sums[-1])

rights = [-_a for _a in a[2 * n:]]
rights_sums = [sum(rights)]
heapq.heapify(rights)

for x in reversed(range(n, 2 * n)):
    r = heapq.heappop(rights)
    if r < -a[x]:
        heapq.heappush(rights, -a[x])
        rights_sums.append(rights_sums[-1] - r - a[x])
    else:
        heapq.heappush(rights, r)
        rights_sums.append(rights_sums[-1])

rights_sums = rights_sums[::-1]
ans = -float('inf')
for i in range(len(lefts_sums)):
    ans = max(ans, lefts_sums[i] + rights_sums[i])

print(ans)
Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import heapq
def main():
    N = int(input())
    A = list(map(int, input().split()))
    fl = [i for i in A[:N]]
    f = [sum(A[:N])]
    heapq.heapify(fl)
    ll = [-i for i in A[2*N:]]
    l = [sum(A[2*N:])]
    heapq.heapify(ll)
    for i in range(N):
        s = f[-1]
        if A[N+i] > fl[0]:
            s = s - fl[0] + A[N+i]
            heapq.heappushpop(fl, A[N+i])
        f.append(s)
        s = l[-1]
        if - A[2*N-1-i] > ll[0]:
            s = s + ll[0] + A[2*N-1-i]
            heapq.heappushpop(ll, -A[2*N-1-i])
        l.append(s)
    r = -pow(10, 100)
    for i in range(N):
        r = max(r, f[i] - l[-1-i])
    return r
print(main())


Failing test case input:
1
-1 1 0

Expected output:
1


Actual output:
-1


Fixed submission (verdict: Accepted):
import heapq
def main():
    N = int(input())
    A = list(map(int, input().split()))
    fl = [i for i in A[:N]]
    f = [sum(A[:N])]
    heapq.heapify(fl)
    ll = [-i for i in A[2*N:]]
    l = [sum(A[2*N:])]
    heapq.heapify(ll)
    for i in range(N):
        s = f[-1]
        if A[N+i] > fl[0]:
            s = s - fl[0] + A[N+i]
            heapq.heappushpop(fl, A[N+i])
        f.append(s)
        s = l[-1]
        if - A[2*N-1-i] > ll[0]:
            s = s + ll[0] + A[2*N-1-i]
            heapq.heappushpop(ll, -A[2*N-1-i])
        l.append(s)
    r = f[0] - l[-1]
    for i in range(N+1):
        r = max(r, f[i] - l[-1-i])
    return r
print(main())

Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import heapq
from collections import deque
N = int(input())
A = list(map(int, input().split()))

al = A[:N]
ar = [-a for a in A[2*N:]]
ac = deque(A[N:2*N])
heapq.heapify(al)
heapq.heapify(ar)
for i in range(N):
    gl = ac[0] - al[0]
    gr = -ar[0] - ac[-1]
    if gl < 0 and gr < 0:
        ac.pop()
    elif gl > gr:
        heapq.heappop(al)
        tmp = ac.popleft()
        heapq.heappush(al, tmp)
    else:
        heapq.heappop(ar)
        tmp = ac.pop()
        heapq.heappush(ar, -tmp)
print(sum(al)+sum(ar))


Failing test case input:
3
23 1 2 -2 1 12 -2 -1 3

Expected output:
37


Actual output:
31


Fixed submission (verdict: Accepted):
import heapq
N = int(input())
A = list(map(int, input().split()))

al = A[:N]
heapq.heapify(al)
sal = sum(al)
suml = [sal]
for i in range(N, 2*N):
    if al[0] < A[i]:
        tmp = heapq.heappop(al)
        heapq.heappush(al, A[i])
        sal += A[i]-tmp
    suml.append(sal)

ar = [-a for a in A[2*N:]]
heapq.heapify(ar)
sar = -sum(ar)
sumr = [sar]

ans = -10**15
for i in range(N, 2*N):
    if -ar[0] > A[3*N-1-i]:
        tmp = -heapq.heappop(ar)
        heapq.heappush(ar, -A[3*N-1-i])
        sar += A[3*N-1-i]-tmp
    sumr.append(sar)
for i in range(len(suml)):
    ans = max(ans, suml[i]-sumr[-(i+1)])
print(ans)
Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI()
    wakeme = N
    Aleftsum = [0 for _ in range(3*N+1)]
    leftA = [x for x in A[:N]]
    heapq.heapify(leftA)
    subsum = sum(leftA)
    Aleftsum[wakeme] = subsum
    for i in range(N):
        heapq.heappush(leftA, A[wakeme + i])
        subsum += A[wakeme + i]
        subsum -= heapq.heappop(leftA)
        Aleftsum[wakeme+i+1] = subsum

    Arightsum = [0 for _ in range(3*N+1)]
    rightA = [-x for x in A[-N:]]
    heapq.heapify(rightA)
    subsum = sum(rightA)
    wakeme = 2*N
    Arightsum[wakeme] = -subsum
    for i in range(1, N+1):
        heapq.heappush(rightA, -A[wakeme-i])
        subsum -= A[wakeme - i]
        subsum -= heapq.heappop(rightA)
        Arightsum[wakeme - i] = -subsum
    ans = -inf
    for i in range(N, 2*N):
        ans = max(ans, Aleftsum[i] - Arightsum[i])
    print(ans)
main()



Failing test case input:
1
-1 0 0

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI()
    wakeme = N
    Aleftsum = [0 for _ in range(3*N+1)]
    leftA = [x for x in A[:N]]
    heapq.heapify(leftA)
    subsum = sum(leftA)
    Aleftsum[wakeme] = subsum
    for i in range(N):
        heapq.heappush(leftA, A[wakeme + i])
        subsum += A[wakeme + i]
        subsum -= heapq.heappop(leftA)
        Aleftsum[wakeme+i+1] = subsum

    Arightsum = [0 for _ in range(3*N+1)]
    rightA = [-x for x in A[-N:]]
    heapq.heapify(rightA)
    subsum = sum(rightA)
    wakeme = 2*N
    Arightsum[wakeme] = -subsum
    for i in range(1, N+1):
        heapq.heappush(rightA, -A[wakeme-i])
        subsum -= A[wakeme - i]
        subsum -= heapq.heappop(rightA)
        Arightsum[wakeme - i] = -subsum
    ans = -inf
    for i in range(N, 2*N+1):
        ans = max(ans, Aleftsum[i] - Arightsum[i])
    print(ans)
main()
Problem: p03714
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
import heapq

def main():
    mod=10**9+7
    N=I()
    a=LI()
    q1=a[:N]
    s1=[0]*(N+1)
    s1[0]=sum(q1)
    heapq.heapify(q1)
        
    q2=[]
    heapq.heapify(q2)
    s2=[0]*(N+1)
    for i in range(N):
        b=a[-1-i]*(-1)
        s2[0]+=b
        heapq.heappush(q2,b)
    
    
    for i in range(N):
        b=heapq.heappop(q1)
        s1[i+1]=s1[i]+a[i+N]-b
        
        c=heapq.heappop(q2)
        s2[i+1]=s2[i]+a[-1-N-i]*(-1)-c
        
    L=[0]*(N+1)
    ans=-1*10**16
    for i in range(N+1):
        temp=s1[i]+s2[-1-i]
        if ans<temp:
            ans=temp
    print(ans)
        
        
    

main()


Failing test case input:
3
3 8 1 2 1 4 -1 6 1

Expected output:
12


Actual output:
9


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
import heapq

def main():
    mod=10**9+7
    N=I()
    a=LI()
    q1=a[:N]
    s1=[0]*(N+1)
    s1[0]=sum(q1)
    heapq.heapify(q1)
        
    q2=[]
    heapq.heapify(q2)
    s2=[0]*(N+1)
    for i in range(N):
        b=a[-1-i]*(-1)
        s2[0]+=b
        heapq.heappush(q2,b)
    
    
    for i in range(N):
        bb=a[i+N]
        heapq.heappush(q1,bb)
        b=heapq.heappop(q1)
        s1[i+1]=s1[i]+bb-b
        
        cc=a[-1-N-i]*(-1)
        heapq.heappush(q2,cc)
        c=heapq.heappop(q2)
        s2[i+1]=s2[i]+cc-c
        
    L=[0]*(N+1)
    ans=-1*10**16
    for i in range(N+1):
        temp=s1[i]+s2[-1-i]
        if ans<temp:
            ans=temp
    print(ans)
        
        
    

main()
Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from heapq import heappop,heappush,heapify
n=int(input())
a=list(map(int,input().split()))
left=[0]*n
lst=a[:n]
s=sum(lst)
heapify(lst)
for i in range(n):
    heappush(lst,a[n+i])
    x=heappop(lst)
    if i==0:
        left[0]=s+a[n]-x
    else:
        left[i]=left[i-1]+a[n+i]-x
left=[s]+left
right=[0]*n
lst=[]
for i in range(2*n,3*n):
    lst.append(-a[i])
s=-sum(lst)
heapify(lst)
for i in range(n):
    heappush(lst,-a[2*n-1-i])
    x=-heappop(lst)
    if i==0:
        right[n-1]=s+a[2*n-1]-x
    else:
        right[n-1-i]=right[n-i]+a[2*n-1-i]-x
right+=[s]
ans=-float("inf")
for i in range(n):
    ans=max(ans,left[i]-right[i])
print(ans)

Failing test case input:
1
-1 2 -1

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
from heapq import heappop,heappush,heapify
n=int(input())
a=list(map(int,input().split()))
left=[0]*n
lst=a[:n]
s=sum(lst)
heapify(lst)
for i in range(n):
    heappush(lst,a[n+i])
    x=heappop(lst)
    if i==0:
        left[0]=s+a[n]-x
    else:
        left[i]=left[i-1]+a[n+i]-x
left=[s]+left
right=[0]*n
lst=[]
for i in range(2*n,3*n):
    lst.append(-a[i])
s=-sum(lst)
heapify(lst)
for i in range(n):
    heappush(lst,-a[2*n-1-i])
    x=-heappop(lst)
    if i==0:
        right[n-1]=s+a[2*n-1]-x
    else:
        right[n-1-i]=right[n-i]+a[2*n-1-i]-x
right+=[s]
ans=-float("inf")
for i in range(n+1):
    ans=max(ans,left[i]-right[i])
print(ans)

Problem: p03714
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import heapq

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

sa = 0
sb = 0
hf = []
hb = []
for i in range(n):
    sa += A[i]
    heapq.heappush(hf,A[i])
for i in range(2*n,3*n):
    sb += A[i]
    heapq.heappush(hb,-A[i])

ans = sa-sb
for i in range(n,2*n):
    now = A[i]
    
    l = -heapq.heappop(hb)
    
    if now < l:
        ans = sa-sb+l-now
    heapq.heappush(hb,-l)
    h = heapq.heappop(hf)
    
    if now > h:
        sa += now-h
        heapq.heappush(hf,now)
        ans = max(ans,sa-sb)
    else:
        heapq.heappush(hf,h)
    
ans = max(ans,sa-sb)
print(ans)


Failing test case input:
3
2 4 2 32 0 0 2 2 11

Expected output:
36


Actual output:
34


Fixed submission (verdict: Accepted):
import heapq

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

sa = 0
sb = 0
hf = []
hb = []
la = [[0]*2 for i in range(n+1)]
for i in range(n):
    sa += A[i]
    heapq.heappush(hf,A[i])
for i in range(2*n,3*n):
    sb += A[i]
    heapq.heappush(hb,-A[i])
la[0][0] = sa
la[-1][-1] = sb
for i in range(n,2*n):
    now = A[i]
    now2 = A[-1-i]
    heapq.heappush(hf,now)
    heapq.heappush(hb,-now2)
    h1 = heapq.heappop(hf)
    h2 = -heapq.heappop(hb)
    sa += now-h1
    sb += now2 -h2
    la[i-n+1][0] = sa
    la[-i+n-2][1] = sb

ans = -float("INF")
for i,j in la:
    ans = max(ans,i-j)
print(ans)
Problem: p03714
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import heapq

n = int(input().strip())
a = list(map(int, input().split()))
pre = a[:n]
heapq.heapify(pre)
suf = list(map(lambda x: -x, a[(2 * n):]))
heapq.heapify(suf)
left = {}
right = {}
pre_sum = sum(pre)
suf_sum = -sum(suf)
left[n - 1] = pre_sum
right[2 * n] = suf_sum
for i in range(n, 2 * n):
    heapq.heappush(pre, a[i])
    pre_sum = pre_sum + a[i] - heapq.heappop(pre)
    left[i] = pre_sum
for i in range(2 * n - 1, n - 1, -1):
    heapq.heappush(suf, -a[i])
    suf_sum = suf_sum + heapq.heappop(suf) + a[i]
    right[i] = suf_sum
ans = - (10 ** 50)
for i in range(n - 1, 2 * n - 1):
    ans = max(ans, left[i] - right[i + 1])
print(ans)


Failing test case input:
2
4 -1 1 2 1 0

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
import heapq

n = int(input().strip())
a = list(map(int, input().split()))
pre = a[:n]
heapq.heapify(pre)
suf = list(map(lambda x: -x, a[(2 * n):]))
heapq.heapify(suf)
left = {}
right = {}
pre_sum = sum(pre)
suf_sum = -sum(suf)
left[n - 1] = pre_sum
right[2 * n] = suf_sum
for i in range(n, 2 * n):
    heapq.heappush(pre, a[i])
    pre_sum = pre_sum + a[i] - heapq.heappop(pre)
    left[i] = pre_sum
for i in range(2 * n - 1, n - 1, -1):
    heapq.heappush(suf, -a[i])
    suf_sum = suf_sum + a[i] + heapq.heappop(suf)
    right[i] = suf_sum
ans = -float('inf')
for i in range(n - 1, 2 * n):
    ans = max(ans, left[i] - right[i + 1])
print(ans)

Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import heapq
n = int(input())
a = list(map(int,input().split()))
aka = a[:n]
heapq.heapify(aka)
akasum = [0] * (n+1)
akasum[0] = sum(aka)
ao = a[2*n:]
heapq._heapify_max(ao)
aosum = [0] * (n+1)
aosum[-1] = sum(ao)
for i in range(n,2*n):
  b = heapq.heappop(aka)
  if b >= a[i]:
    heapq.heappush(aka, b)
  else:
    heapq.heappush(aka, a[i])
  akasum[i-n+1] = sum(aka)
  b = heapq.heappop(ao)
  if b <= a[-i-1]:
    heapq.heappush(ao, b)
  else:
    heapq.heappush(ao, a[-i-1])
  aosum[-i+n-2] = sum(ao)
ans = - float("inf")
for i in range(n+1):
  kota = akasum[i] - aosum[i]
  ans = max(kota,ans)
print(ans)

Failing test case input:
3
3 8 2 6 0 2 2 3 11

Expected output:
13


Actual output:
12


Fixed submission (verdict: Accepted):
import heapq
n = int(input())
a = list(map(int,input().split()))
aka = a[:n]
heapq.heapify(aka)
akasum = [0] * (n+1)
akasum[0] = sum(aka)
ao = a[2*n:]
aosum = [0] * (n+1)
aosum[-1] = sum(ao)
for i in range(len(ao)):
  ao[i] = -ao[i]
heapq.heapify(ao)
for i in range(n,2*n):
  b = heapq.heappop(aka)
  if b >= a[i]:
    heapq.heappush(aka, b)
    akasum[i-n+1] = akasum[i-n] 
  else:
    heapq.heappush(aka, a[i])
    akasum[i-n+1] = akasum[i-n] + a[i] - b
  b = heapq.heappop(ao)
  if b >=  -a[-i-1]:
    heapq.heappush(ao, b)
    aosum[-i+n-2] = aosum[-i+n-1]
  else:
    heapq.heappush(ao, -a[-i-1])
    aosum[-i+n-2] = aosum[-i+n-1] + a[-i-1] + b
ans = - float("inf")
for i in range(n+1):
  kota = akasum[i] - aosum[i]
  ans = max(kota,ans)
print(ans)
Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import heapq

n=int(input())
arr=list(map(int,input().split()))
q1=[]
tmp=0
for val in arr[:n]:
  heapq.heappush(q1,val)
  tmp+=val
sum1=[tmp]
for val in arr[n:2*n]:
  tmp=heapq.heappop(q1)
  if val>tmp:
    heapq.heappush(q1,val)
    sum1.append(sum1[-1]+(val-tmp))
  else:
    heapq.heappush(q1,tmp)
    sum1.append(sum1[-1])
print(sum1)
q2=[]
tmp=0
for val in arr[2*n:]:
  heapq.heappush(q2,-val)
  tmp+=val
sum2=[tmp]
for val in arr[2*n-1:n-1:-1]:
  tmp=-heapq.heappop(q2)
  if val<tmp:
    heapq.heappush(q2,-val)
    sum2.append(sum2[-1]+(val-tmp))
  else:
    heapq.heappush(q2,-tmp)
    sum2.append(sum2[-1])
sum2=sum2[::-1]
print(sum2)
ans=-10**18
for i in range(n+1):
  tmp=sum1[i]-sum2[i]
  ans=max(ans,tmp)
print(ans)

Failing test case input:
3
8 1 2 7 4 6 6 0 8

Expected output:
7


Actual output:
[11, 17, 19, 21]
[10, 10, 12, 14]
7


Fixed submission (verdict: Accepted):
import heapq

n=int(input())
arr=list(map(int,input().split()))
q1=[]
tmp=0
for val in arr[:n]:
  heapq.heappush(q1,val)
  tmp+=val
sum1=[tmp]
for val in arr[n:2*n]:
  tmp=heapq.heappop(q1)
  if val>tmp:
    heapq.heappush(q1,val)
    sum1.append(sum1[-1]+(val-tmp))
  else:
    heapq.heappush(q1,tmp)
    sum1.append(sum1[-1])
q2=[]
tmp=0
for val in arr[2*n:]:
  heapq.heappush(q2,-val)
  tmp+=val
sum2=[tmp]
for val in arr[2*n-1:n-1:-1]:
  tmp=-heapq.heappop(q2)
  if val<tmp:
    heapq.heappush(q2,-val)
    sum2.append(sum2[-1]+(val-tmp))
  else:
    heapq.heappush(q2,-tmp)
    sum2.append(sum2[-1])
sum2=sum2[::-1]
ans=-10**18
for i in range(n+1):
  tmp=sum1[i]-sum2[i]
  ans=max(ans,tmp)
print(ans)

Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from heapq import heapify, heappop, heappush
N = int(input())
A = list(map(int, input().split()))
A = [-a for a in A]

L = [[a, i] for i, a in enumerate(A[:2*N])]
Sl = 0
heapify(L)
used = set()
for i in range(N):
  a, i = heappop(L)
  used.add(i)
  Sl -= a

R = A[2*N:].copy()
Sr = -sum(R)
heapify(R)

ans = Sl - Sr
for i in range(2*N-1, N-1, -1):
  a = - A[i]
  r =  - heappop(R)
  if a > r:
    heappush(R, -r)
  else:
    Sr += a - r
    heappush(R, -a)
  if i in used:
    while L:
      l, j = heappop(L)
      if j in used or j >= i:
        continue
      Sl += l - a
      used.add(j)
      break
  ans = max(ans, Sl - Sr)

print(ans)

Failing test case input:
1
-2 0 0

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
from heapq import heapify, heappop, heappush

N = int(input())
A = list(map(int, input().split()))
A = [-a for a in A]

L = [[a, i] for i, a in enumerate(A[:2*N])]
Sl = 0
heapify(L)
used = set()
for i in range(N):
  a, i = heappop(L)
  used.add(i)
  Sl -= a

R = A[2*N:].copy()
Sr = -sum(R)
heapify(R)

ans = Sl - Sr
for i in range(2*N-1, N-1, -1):
  a = - A[i]
  r =  - heappop(R)
  if a > r:
    heappush(R, -r)
  else:
    Sr += a - r
    heappush(R, -a)
  if i in used:
    while L:
      l, j = heappop(L)
      l *= -1
      if j < i:
        Sl += l - a
        used.add(j)
        break
  ans = max(ans, Sl - Sr)

print(ans)
Problem: p03714
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import heapq
n = int(input())
a = list(map(int,input().split()))

left_seq = sorted(a[0:n])
right_seq =  sorted(a[2*n:3*n])
left_sum = [0]*(n+1)
right_sum = [0]*(n+1)
left_sum[0] =  sum(left_seq) 
right_sum[n] =  sum(right_seq) 


for i in range(n):
  if left_seq[0]<a[n+i]:
    left_sum[i+1] = left_sum[i]-left_seq[0]+a[n+i]
    heapq.heappushpop(left_seq, a[n+i])
  else:
    left_sum[i+1] = left_sum[i]
  
  

for i in range(n)[::-1]:
  if right_seq[-1]>a[n+i]:
    right_sum[i] = right_sum[i+1]-right_seq[-1]+a[n+i]
    del right_seq[-1]
    heapq.heappush(right_seq, a[n+i])
  else:
    right_sum[i] = right_sum[i+1]
  

ans = -float("inf")
for i in range(n+1):
  ans = max(ans,left_sum[i]-right_sum[i])
print(ans)


Failing test case input:
3
3 8 2 6 0 2 2 3 11

Expected output:
13


Actual output:
12


Fixed submission (verdict: Accepted):
import heapq
n = int(input())
a = list(map(int,input().split()))


left_seq = sorted(a[0:n])
right_seq =  sorted(a[2*n:3*n],reverse=True)
for i in range(n):
  right_seq[i]=-right_seq[i]






left_sum = [0]*(n+1)
right_sum = [0]*(n+1)
left_sum[0] =  sum(left_seq) 
right_sum[n] =  sum(right_seq) 


for i in range(n):
  if left_seq[0]<a[n+i]:
    left_sum[i+1] = left_sum[i] + a[n+i] - left_seq[0]
    heapq.heappop(left_seq)
    heapq.heappush(left_seq, a[n+i])
  else:
    left_sum[i+1] = left_sum[i]
  
  

for i in range(n)[::-1]:
  if right_seq[0]<-a[n+i]:
    right_sum[i] = right_sum[i+1] + (-a[n+i]) - right_seq[0]
    
    heapq.heappop(right_seq)
    heapq.heappush(right_seq, -a[n+i])
    
  else:
    right_sum[i] = right_sum[i+1]
  

ans = -float("inf")
for i in range(n+1):
  
  ans = max(ans,left_sum[i]+right_sum[i])
print(ans)
Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
K=int(input())
if K%2==0:
  print(K/2*K/2)
else:
  print(K/2*(K-1)/2)

Failing test case input:
611

Expected output:
93330


Actual output:
93177.5


Fixed submission (verdict: Accepted):
K=int(input())
if K%2==0:
  print(int(K*K/4))
else:
  print(int((K+1)*(K-1)/4))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
k = int(input())

if k % 2 == 0:
  	print((k / 2)**2)
else:
	print(k * (k - 1))  

Failing test case input:
-176

Expected output:
7744


Actual output:
7744.0


Fixed submission (verdict: Accepted):
k = int(input())
if k % 2 == 0:
  	print(int((k / 2)**2))
else:
	print(int(k

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

K = int(input())
if K % 2 == 0:
    print((K / 2) ** 2)
else:
    print((K / 2) * ((K / 2) + 1))

Failing test case input:
-1464

Expected output:
535824


Actual output:
535824.0


Fixed submission (verdict: Accepted):
import math

K = int(input())
if K % 2 == 0:
    print(int((K / 2) ** 2))
else:
    print(math.floor(K / 2) * (math.floor(K / 2) + 1))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
k = int(input())        
if (k%2) == 1:
    oe = ((k+1) * (k-3)) / 8
    print(2 * oe)
else:
    o = (k+2) * (k-1)/8
    e = (k*(k-4))/8
    print(o+e)

Failing test case input:
-107

Expected output:
2862


Actual output:
2915.0


Fixed submission (verdict: Accepted):

k = int(input())        

if (k%2) == 1:
    o = (k-1) * (k+1) / 8
    
    print(int(2*o))

else:
    o = k * (k+2) / 8
    e = k * (k-2) / 8
    print(int(o+e))

Problem: p03264
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = int(input())

if k%2 == 0:
  print(k*k/4)
else:
  print(k**2/4-1/4)

Failing test case input:
-2373

Expected output:
1407782


Actual output:
1407782.0


Fixed submission (verdict: Accepted):
k = int(input())
 
if k%2 == 0:
  print(int(k*k/4))
else:
  print(int(k**2/4-1/4))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
if a%2  == 0 :
    print(a**2/4)
else :
    print((a+1)/2*(a-1)/2)
  

Failing test case input:
-107

Expected output:
2862


Actual output:
2862.0


Fixed submission (verdict: Accepted):
a = int(input())
if a%2  == 0 :
    print(int(a**2/4))
else :
    print(int((a+1)/2*(a-1)/2))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
K=int(input())
if K%2==0:
    m=(K/2)**2
else:
    m=((K-1)/2)*(((K-1)/2)+1)
print(m)

Failing test case input:
-1265

Expected output:
400056


Actual output:
400056.0


Fixed submission (verdict: Accepted):
K=int(input())
if K%2==0:
    m=(K/2)**2
else:
    m=((K-1)/2)*(((K-1)/2)+1)
n=int(m)
print(n)

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
k=int(input())
if k%2==0:
  print(k/2*k/2)
else:
  print(int(((k-1)/2+1)*(k-1)/2))

Failing test case input:
-176

Expected output:
7744


Actual output:
7744.0


Fixed submission (verdict: Accepted):
k=int(input())
if k%2==0:
  print(int(k/2*k/2))
else:
  print(int(((k-1)/2+1)*(k-1)/2))
Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

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

if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    if a[0] %2 ==1:
        print(a[0]*(a[0]-1))
    else:
        print(a[0]*(a[0]))


Failing test case input:
-50

Expected output:
625


Actual output:
2500


Fixed submission (verdict: Accepted):
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

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

if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    if a[0] %2 ==1:
        print((a[0]
    else:
        print((a[0]

Problem: p03264
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = int(input())
print(s/2 * (s+1)/2)

Failing test case input:
-374

Expected output:
34969


Actual output:
34875.5


Fixed submission (verdict: Accepted):
s = int(input())
print((s-s

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
K = int(input())

if K%2 == 0:
    print((K/2)**2)
else:
    print((K+1)/2*(K-1)/2)


Failing test case input:
-1265

Expected output:
400056


Actual output:
400056.0


Fixed submission (verdict: Accepted):
K = int(input())

if K%2 == 0:
    print(int((K/2)**2))
else:
    print(int((K+1)/2*(K-1)/2))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
a=int(input())
if a%2==0:
  print(int(a*a/4))
else:
  print(math.ceil(a)*math.floor(a))

Failing test case input:
-147

Expected output:
5402


Actual output:
21609


Fixed submission (verdict: Accepted):
import math
a=int(input())
if a%2==0:
  print(int(a*a/4))
else:
  print(math.ceil(a/2)*math.floor(a/2))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
k = int(input())        
if (k%2) == 1:
    oe = ((k+1) * (k-3)) / 8
    print(2 * oe)
else:
    o = (k+2) * (k-2)/8
    e = k * (k-4) / 8
    print(o+e)

Failing test case input:
-74

Expected output:
1369


Actual output:
1405.5


Fixed submission (verdict: Accepted):

k = int(input())        

if (k%2) == 1:
    o = (k-1) * (k+1) / 8
    
    print(int(2*o))

else:
    o = k * (k+2) / 8
    e = k * (k-2) / 8
    print(int(o+e))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
k = int(input())
if k % 2 == 0:
  print(k**2/4)
else:
  print((k+1)*(k-1)/4)

Failing test case input:
-147

Expected output:
5402


Actual output:
5402.0


Fixed submission (verdict: Accepted):
k = int(input())
if k % 2 == 0:
  print(int(k**2/4))
else:
  print(int((k+1)*(k-1)/4))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
K=int(input())
if K%2==0:
  print(K*K/4)
else:
  print((K-1)*(K-1)/4)

Failing test case input:
259

Expected output:
16770


Actual output:
16641.0


Fixed submission (verdict: Accepted):
K=int(input())
if K%2==0:
  print(int(K*K/4))
else:
  print(int((K+1)*(K-1)/4))
Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
K=int(input())
if K%2==0:
  print(K*K/4)
else:
  print((K+1)*(K-1)/4)

Failing test case input:
-374

Expected output:
34969


Actual output:
34969.0


Fixed submission (verdict: Accepted):
K=int(input())
if K%2==0:
  print(int(K*K/4))
else:
  print(int((K+1)*(K-1)/4))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
i=int(input())
if i%2==0:
  print((i/2)**2)
else:
  print((i+1)*(i-1)/4)

Failing test case input:
-626

Expected output:
97969


Actual output:
97969.0


Fixed submission (verdict: Accepted):
i=int(input())
if i%2==0:
  print(int((i/2)**2))
else:
  print(int((i+1)*(i-1)/4))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
K = int(input())
if(K%2 == 0):
  print(int((K/2)**2))
else:
  print(int((K/2)*(K/2+1)))

Failing test case input:
-2373

Expected output:
1407782


Actual output:
1406595


Fixed submission (verdict: Accepted):
K = int(input())
if(K%2 == 0):
  print(int((K/2)**2))
else:
  print(int(((K-1)/2)*((K+1)/2)))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
k = int(input())
if k%2 == 0:
    a = (k/2)**2
    print(a)
else:
    a = ((k-1)/2)*((k-1)/2 + 1)
    print(int(a))


Failing test case input:
382

Expected output:
36481


Actual output:
36481.0


Fixed submission (verdict: Accepted):
k = int(input())
if k%2 == 0:
    a = (k/2)**2
    print(int(a))
else:
    a = ((k-1)/2)*((k-1)/2 + 1)
    print(int(a))

Problem: p03264
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

k = 50

if k%2:
    print(math.floor(k/2)*math.ceil(k/2))
else:
    print(int((k/2)**2))

Failing test case input:
-931

Expected output:
216690


Actual output:
625


Fixed submission (verdict: Accepted):
import math

k = int(input())

if k%2:
    print(math.floor(k/2)*math.ceil(k/2))
else:
    print(int((k/2)**2))
Problem: p02553
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c, d = [int(t) for t in input().split()]
print(max([b*d, a*c, a*d, b*d]))

Failing test case input:
-3 -6 -2 -1

Expected output:
12


Actual output:
6


Fixed submission (verdict: Accepted):
a, b, c, d = [int(t) for t in input().split()]
print(max([b*d, a*c, a*d, b*c]))

Problem: p02553
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c, d = input().split()

a=int(a)
b=int(b)
c=int(c)
d=int(d)


print(a, b, c, d)

X1 = min(a,b) * min(c,d)
X2 = min(a,b) * max(c,d)
X3 = max(a,b) * min(c,d)
X4 = max(a,b) * max(c,d)

print(max(X1,X2,X3,X4))


Failing test case input:
-75619035 -2 -1151695436 0

Expected output:
87090097484224260


Actual output:
-75619035 -2 -1151695436 0
87090097484224260


Fixed submission (verdict: Accepted):
a, b, c, d = input().split()

a=int(a)
b=int(b)
c=int(c)
d=int(d)

X1 = min(a,b) * min(c,d)
X2 = min(a,b) * max(c,d)
X3 = max(a,b) * min(c,d)
X4 = max(a,b) * max(c,d)

print(max(X1,X2,X3,X4))

Problem: p02553
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
print(max(a, b) * max(c, d))

Failing test case input:
-1 7 -3 0

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())
print(max(a * c, b * d, a*d, b*c))

Problem: p02553
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = list(map(int, input().split()))
ans = -float('inf')
for i, v in enumerate(a):
  for j in a[i + 1:]:
    ans = max(ans, v * j)
print(ans)

Failing test case input:
6 39 -3 1

Expected output:
39


Actual output:
234


Fixed submission (verdict: Accepted):
a,b,c,d = map(int, input().split())
a = [a, b]
b = [c, d]

ans = -float('inf')
for i in a:
  for j in b:
    ans = max(ans, i * j)
print(ans)

Problem: p02553
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c,d=map(int,input().split())
print(max(a*b,a*c,b*c,b*d))

Failing test case input:
-32 -8 -1 0

Expected output:
32


Actual output:
256


Fixed submission (verdict: Accepted):
a,b,c,d=map(int,input().split())
print(max(a*c,a*d,b*c,b*d))

Problem: p02553
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys
import collections as cc
import math as mt
I=lambda:list(map(int,input().split()))
a,b,c,d=I()
print(max(a*c,a*d,b*d,b*d))

Failing test case input:
10 3 -2 -8

Expected output:
-6


Actual output:
-20


Fixed submission (verdict: Accepted):
import sys
import collections as cc
import math as mt
I=lambda:list(map(int,input().split()))
a,b,c,d=I()
print(max(a*c,a*d,b*c,b*d))
Problem: p02553
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def resolve():
    a, b, c, d = list(map(int, input().split()))
    ans = -10 ** 9

    for x in (a, b):
        for y in (c, d):
            ans = max(ans, x * y)
    if (b == 0 and d > 0) or (b > 0 and d == 0):
        ans = 0

    print(ans)

resolve()

Failing test case input:
-107235604 0 -2758789909 1

Expected output:
295840502200720036


Actual output:
0


Fixed submission (verdict: Accepted):
def resolve():
    a, b, c, d = list(map(int, input().split()))
    ans = - 10 ** 19

    for x in (a, b):
        for y in (c, d):
            ans = max(ans, x * y)

    print(ans)

resolve()

Problem: p02553
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
a, b, c, d = map(int, input().split())
print(max(a*c, b*c, b*c, a*d))

Failing test case input:
6 13 -3 1

Expected output:
13


Actual output:
6


Fixed submission (verdict: Accepted):
a, b, c, d = map(int, input().split())
print(max(a*c, b*c, b*d, a*d))

Problem: p02553
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
if __name__ == "__main__":
    a, b, c, d = map(int, input().split())
    x_list = [a, b]
    y_list = [c, d]
    ans = 0

    if x_list[0] <= 0 and x_list[1] <= 0 and y_list[0] >= 0 and y_list[1] >= 0:
        ans = max(x_list) * min(y_list)
    elif (x_list[0] >= 0 and x_list[1] >= 0 and y_list[0] <= 0 and y_list[1] <= 0):
        ans = max(y_list) * min(x_list)
    elif (x_list[0] <= 0 or x_list[1] <= 0) and (y_list[0] <= 0 or y_list[1] <= 0):
        ans = min(x_list) * min(y_list)
    else:
        ans = max(x_list) * max(y_list)

    print(ans)

Failing test case input:
0 8 -1 1

Expected output:
8


Actual output:
0


Fixed submission (verdict: Accepted):
if __name__ == "__main__":
    a, b, c, d = map(int, input().split())
    x_list = [a, b]
    y_list = [c, d]
    ans = 0

    if x_list[0] <= 0 and x_list[1] <= 0 and y_list[0] >= 0 and y_list[1] >= 0:
        ans = max(x_list) * min(y_list)
    elif x_list[0] >= 0 and x_list[1] >= 0 and y_list[0] <= 0 and y_list[1] <= 0:
        ans = max(y_list) * min(x_list)
    elif (x_list[0] <= 0 or x_list[1] <= 0) and (y_list[0] <= 0 or y_list[1] <= 0):
        ans = max(min(x_list) * min(y_list), max(x_list) * max(y_list))
    else:
        ans = max(x_list) * max(y_list)

    print(ans)

Problem: p02553
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
ans = []
for i in c,d:
    ans.append(a*i)
for j in c,d:
    ans.append(b*i)

print(max(ans))

Failing test case input:
10 3 -2 -8

Expected output:
-6


Actual output:
-20


Fixed submission (verdict: Accepted):
a,b,c,d = map(int,input().split())
ans = []
for i in c,d:
    ans.append(a*i)
for j in c,d:
    ans.append(b*j)

print(max(ans))