ZhenlongDai/ACPR huggingface dataset:
Problem: p02663
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):

h1,m1,h2,m2,k=map(int,input().split())
tot=0
if m2>=m1:
	tot+=(m2-m1)+60*(h2-h1)
else:
	h2=h2-1
	m2+=60+m2
	tot+=(h2-h1)*60+(m2-m1)
print(max(0,tot-k))



Failing test case input:
11 0 12 -1 29

Expected output:
30


Actual output:
29


Fixed submission (verdict: Accepted):

h1,m1,h2,m2,k=map(int,input().split())
tot=0
if m2>=m1:
	tot+=(m2-m1)+60*(h2-h1)
else:
	h2=h2-1
	m2=60+m2
	tot+=(h2-h1)*60+(m2-m1)
	
print(max(0,tot-k))

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
num_list = list(map(int, input().split())) 

a=num_list[2]-num_list[0]
b=num_list[3]-num_list[1]
if b<0:
    a=a-1
a=a*60
c=b+a-num_list[4]
if c<0:
    c=0
print(c)

Failing test case input:
11 0 12 -1 34

Expected output:
25


Actual output:
0


Fixed submission (verdict: Accepted):


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

a=num_list[2]-num_list[0]
b=num_list[3]-num_list[1]
if b<0:
    a=a-1
    b=b+60
a=a*60
c=b+a-num_list[4]
if c<0:
    c=0
print(c)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H1,M1,H2,M2,K=map(int, input().split())
a=(H2-H1)*60+(M2-M1)
if M1 > M2: a+=60
print(a-K)

Failing test case input:
8 0 12 -1 34

Expected output:
205


Actual output:
265


Fixed submission (verdict: Accepted):
H1,M1,H2,M2,K=map(int,input().split())
if H1>H2:H2+=24
print((H2-H1)*60+M2-M1-K)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H1, M1, H2, M2, K = map(int, input().split())

H = (H2 - H1) * 60
M = M2 - M1

res = (H+M) - K

if res >= K:
    print(res)
else:
    print(0)

Failing test case input:
11 0 12 -1 34

Expected output:
25


Actual output:
0


Fixed submission (verdict: Accepted):
H1, M1, H2, M2, K = map(int, input().split())

H = (H2 - H1) * 60
M = M2 - M1

res = (H+M)

if res >= K:
    print(res - K)
else:
    print(0)

Problem: p02663
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
h1, m1, h2, m2, k = list(map(int, input().split()))
if m1 < m2:
    h1 -= m2/60
    m1 += m2/60
tm = m1 - m2
th = h2 - h1
if tm < k:
    h1 -= k/60
    m1 += k/60
tm -= k
print(th*60 + tm)

Failing test case input:
1 -69 128 19 0

Expected output:
7708


Actual output:
7551.316666666667


Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = list(map(int, input().split()))
if m2 < m1:
    while m2 < m1:
        h2 -= 1
        m2 += 60
tm = m2 - m1
th = h2 - h1
if k > (th*60 + tm):
    print (0)
else:
    print(th*60 + tm - k)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H = list(map(int,input().split()))

h = H[2]-H[0]
m = H[3]-H[1]

if h < 0:
    h = h + 24

if m < 0:
    h -= 1
    m *= -1

mini = h*60 + m - H[4]

if mini < 0:
    mini = 24*60 + mini

print(mini)

Failing test case input:
11 0 12 -1 29

Expected output:
30


Actual output:
1412


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

h = H[2]-H[0]
m = H[3]-H[1]

if h < 0:
    h = h + 24

if m < 0:
    h -= 1
    m = 60 + m

mini = h*60 + m - H[4]

if mini < 0:
    mini = 24*60 + mini

print(mini)
Problem: p02663
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
h1, m1, h2, m2, k = map(int, input().split())
 
time = h2 * 60 + m2 - h1 * 60 + m1
if k >= time:
    print(0)
else:
    print(time - k)

Failing test case input:
11 -8 722 6 -1

Expected output:
42675


Actual output:
42659


Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = map(int, input().split())
 
if h1 <= h2:
    time = h2 * 60 + m2 - h1 * 60 - m1
else:
    time = (h2+24) * 60 + m2 - h1 * 60 - m1
if k >= time:
    print(0)
else:
    print(time - k)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1, m1, h2, m2, k = map(int, input().split())
pos = 60 * (h2 - h1) + abs(m2 - m1)
print(pos - k)


Failing test case input:
8 0 12 -1 34

Expected output:
205


Actual output:
207


Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = map(int, input().split())
pos = 60 * (h2 - h1 - 1) + (60 - m1) + m2
print(pos - k)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1, m1, h2, m2, k = map(int, input().split())
h = h2 - h1
if m1>m2:
	h-=1
	m = m2 - m1 + 60
else:
	m = m2 - m1
l = h*60 + m - k

Failing test case input:
0 -13 83 26 0

Expected output:
5019


Actual output:

Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = map(int, input().split())
h = h2 - h1
if m1>m2:
	h-=1
	m = m2 - m1 + 60
else:
	m = m2 - m1
l = h*60 + m - k
print(l)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c, d, k = map(int, input().split());

x = 60*a + b
y = 60*c + b

if y>x:
    print(y-x-k);
else:
    print(1440+y-x-k);

Failing test case input:
6 -2 16 1 5

Expected output:
598


Actual output:
595


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

x = 60*a + b
y = 60*c + d

if y>x:
    print(y-x-k);
else:
    print(1440+y-x-k);

Problem: p02663
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
h1,m1,h2,m2,k=map(int,input().split())
if(h1==h2):
    print(m2-m1-k)
elif(m1<m2):
    print((h2-h1)*60+(60-m1)+m2-k)
else:
    print((h2-h1)*60+(m2-m1)-k)

Failing test case input:
1 -7 200 1 0

Expected output:
11948


Actual output:
12008


Fixed submission (verdict: Accepted):
h1,m1,h2,m2,k=map(int,input().split())
if(h1==h2):
    print(m2-m1-k)
elif(m2<m1):
    print((h2-h1-1)*60+(60-m1)+m2-k)
else:
    print((h2-h1)*60+(m2-m1)-k)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1, m1, h2, m2, k = map(int, input().split())

start = m2 + 60*h1
end = m2 + 60*h2

print(end-start-k)


Failing test case input:
17 -4 722 6 -1

Expected output:
42311


Actual output:
42301


Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = map(int, input().split())

start = m1 + 60*h1
end = m2 + 60*h2

print(end-start-k)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1,m1,h2,m2,k=map(int,input().split())
minute=(h2-h1)*60+(m2-m1)-2
t=minute
print(t*k)
    


Failing test case input:
1 -26 83 26 0

Expected output:
4972


Actual output:
0


Fixed submission (verdict: Accepted):
h1,m1,h2,m2,k=map(int,input().split())
minute=(h2-h1)*60+(m2-m1)-k
print(minute)
Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1, m1, h2, m2, k = map(int, input().split())
print(max(0, h2*60-h1*60+m1-m2-k))

Failing test case input:
1 -26 83 26 -1

Expected output:
4973


Actual output:
4869


Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = map(int, input().split())
print(max(0, h2*60-h1*60+m2-m1-k))

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1, m1, h2, m2, k = [int(i) for i in input().split()]

awake = 60*h2+m2 - (60*h1+m1) - k
print(k)

Failing test case input:
26 -1 206 3 -1

Expected output:
10805


Actual output:
-1


Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = [int(i) for i in input().split()]

awake = 60*h2+m2 - (60*h1+m1) - k
print(awake)

Problem: p02663
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
h1, m1,h2,m2,k = map(int,input().split())
print((h2*60+m2 - h1*60+m1)-k)

Failing test case input:
6 -1 80 1 -1

Expected output:
4443


Actual output:
4441


Fixed submission (verdict: Accepted):
h1, m1,h2,m2,k = map(int,input().split())
print(((h2*60+m2) - (h1*60+m1))-k)

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

print(c * 60 + d - a * 60 - d - k)

Failing test case input:
10 -1 206 6 -1

Expected output:
11768


Actual output:
11761


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

print(c * 60 + d - a * 60 - b - k)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1, m1, h2, m2, k = [int(i) for i in input().split()]

time = 60*h2+m2 - 60*h1+m1 - k
print(time)

Failing test case input:
-1 -5 68 11 -1

Expected output:
4157


Actual output:
4147


Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = [int(i) for i in input().split()]

awake = 60*h2+m2 - (60*h1+m1) - k
print(awake)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
time = map(int, input().split())
list1=[]
for i in time:
    list1.append(i)
time1 = (list1[2]-list1[0])*60
minute = time1  - list1[4]
print(minute)

Failing test case input:
1 -69 128 19 0

Expected output:
7708


Actual output:
7620


Fixed submission (verdict: Accepted):
time = map(int, input().split())
list1=[]
for i in time:
    list1.append(i)
time1 = (list1[2]*60+list1[3])-(list1[0]*60+list1[1])
minute = time1  - list1[4]
print(minute)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1, m1, h2, m2, k = [int(arg) for arg in input().split()]
print((h2-h1)*60 - (m2-m1) - k)


Failing test case input:
6 -1 15 1 5

Expected output:
537


Actual output:
533


Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = [int(arg) for arg in input().split()]
print((h2-h1)*60 + (m2-m1) - k)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H1, M1, H2, M2, K = map(int, input().split())
time = (H2 - H1) * 60 + (M1 - M2)
print(time - K)

Failing test case input:
6 -1 80 1 1

Expected output:
4441


Actual output:
4437


Fixed submission (verdict: Accepted):
H1, M1, H2, M2, K = map(int, input().split())
time = (H2 - H1) * 60 + (M2 - M1)
print(time - K)
Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h,m,h2,m2,k=map(int,input().split())
print(h2*60+m-h*60+m-k)

Failing test case input:
1 -7 200 1 0

Expected output:
11948


Actual output:
11926


Fixed submission (verdict: Accepted):
h,m,h2,m2,k=map(int,input().split())
print(max((h2*60+m2)-(h*60+m)-k,0))

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H_1,M_1,H_2,M_2,K = map(int,input().split())
if H_2 < H_1:
    H_2 += 24
MaxH = abs(H_2 - H_1)
if M_1 >= M_2:
    MaxM = M_2 - M_1
if M_1 < M_2:
    MaxM = M_1 - M_2
useTime = MaxH*60 + MaxM
useTime -= K
print(useTime)

Failing test case input:
10 -1 80 6 -1

Expected output:
4208


Actual output:
4194


Fixed submission (verdict: Accepted):
H_1,M_1,H_2,M_2,K = map(int,input().split())
if H_2 < H_1:
    H_2 += 24
MaxH = abs(H_2 - H_1)
if M_1 >= M_2:
    MaxM = M_2 - M_1
if M_1 < M_2:
    MaxM = abs(M_1 - M_2)
useTime = MaxH*60 + MaxM
useTime -= K
print(useTime)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H1, M1, H2, M2, K = map(int,input().split())

latest = H2*60+M2-K  
earliest = H1*60

study = abs(latest-earliest)
print(study)

Failing test case input:
-1 -3 239 11 -1

Expected output:
14415


Actual output:
14412


Fixed submission (verdict: Accepted):
H1, M1, H2, M2, K = map(int,input().split())

latest = H2*60+M2-K  
earliest = H1*60+M1
study = latest-earliest
print(study)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=list(map(int,input().split()))
print((a[2]-a[0])*60-(a[3]-a[1])-a[4])

Failing test case input:
10 -1 206 6 -1

Expected output:
11768


Actual output:
11754


Fixed submission (verdict: Accepted):
a=list(map(int,input().split()))
print((a[2]*60+a[3])-(a[0]*60+a[1])-a[4])

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

a, b, c, d, e = map(int, input().split())



start = a*60+b
end = c*60+d
result = end - start
print(result)

Failing test case input:
4 0 12 0 120

Expected output:
360


Actual output:
480


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



start = a*60+b
end = c*60+d
result = end - start - e
print(result)

Problem: p02663
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
FH, FM, TH, TM, K = map(int, input().split())
M = (TH-FH)*60+(TM-FM)
ans = M 
print(ans*K)


Failing test case input:
-1 -9 83 14 0

Expected output:
5063


Actual output:
0


Fixed submission (verdict: Accepted):
FH, FM, TH, TM, K = map(int, input().split())
M = (TH*60+TM)-(FH*60+FM)
print(M-K)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H1,M1,H2,M2,K = (int(x) for x in input().split())
Wake  = 60*H1+M1
Sleep = 60*H2+M2

Activate = 60*H2+M2 - 60*H1+M1
CanStudy = Activate - K
print(CanStudy)

Failing test case input:
0 -13 83 26 0

Expected output:
5019


Actual output:
4993


Fixed submission (verdict: Accepted):
H1,M1,H2,M2,K = (int(x) for x in input().split())
Wake  = 60*H1+M1
Sleep = 60*H2+M2

Activate = Sleep - Wake
CanStudy = Activate - K
print(int(CanStudy))
Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H = list(map(int,input().split()))

h = H[2]-H[0]
m = H[3]-H[1]

if h < 0:
    h = h + 24

if m < 0:
    h -= 1
    m *= -1

mini = h*60 + m - H[4]

if mini < 0:
    mini = 24*60 -mini

print(mini)

Failing test case input:
11 0 12 -1 43

Expected output:
16


Actual output:
1482


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

h = H[2]-H[0]
m = H[3]-H[1]

if h < 0:
    h = h + 24

if m < 0:
    h -= 1
    m = 60 + m

mini = h*60 + m - H[4]

if mini < 0:
    mini = 24*60 + mini

print(mini)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import time
import datetime
from datetime import timedelta
H1,M1,H2,M2,K=map(int,input().split())


delta1=timedelta(minutes=M1,hours=H1)
delta2=timedelta(minutes=M2,hours=H2)

delta=delta2-delta1
delta_minutes=delta.total_seconds()/60
if delta_minutes>30:
  print(delta_minutes-30)
else:
  print(0)


Failing test case input:
10 0 15 0 30

Expected output:
270

Actual output:
270.0


Fixed submission (verdict: Accepted):
import datetime
from datetime import timedelta
H1,M1,H2,M2,K=map(int,input().split())


delta1=timedelta(minutes=M1,hours=H1)
delta2=timedelta(minutes=M2,hours=H2)

delta=delta2-delta1
delta_minutes=delta.total_seconds()/60
if delta_minutes>=K:
  print(round(delta_minutes-K))
else:
  print(0)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
hmk = input('')

h1 = int(hmk.split(' ')[0])
m1 = int(hmk.split(' ')[1])
h2 = int(hmk.split(' ')[2])
m2 = int(hmk.split(' ')[3])
k = int(hmk.split(' ')[4])

h = h2 - h1
m = m2 - m1
if m < 0:
    m = m1 - m2
    h-=1

a = h*60 + m - k
print(a)

Failing test case input:
4 0 12 -1 22

Expected output:
457


Actual output:
399


Fixed submission (verdict: Accepted):
hmk = input('')

h1 = int(hmk.split(' ')[0])
m1 = int(hmk.split(' ')[1])
h2 = int(hmk.split(' ')[2])
m2 = int(hmk.split(' ')[3])
k = int(hmk.split(' ')[4])

min1 = h1*60 + m1
min2 = h2*60 + m2

if min1 > min2:
    min2+=60*24

a = min2 - min1 - k
print(a)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H_1,M_1,H_2,M_2,K = map(int,input().split())
if H_2-H_1<0:
    print((H_2-H_1+24)*60+M_2+M_1-K)
else:
    print(H_2*60+M_2-H_1*60+M_1-K)


Failing test case input:
15 -1 206 3 -1

Expected output:
11465


Actual output:
11463


Fixed submission (verdict: Accepted):
H_1,M_1,H_2,M_2,K = map(int,input().split())
if H_2-H_1<0:
    print((H_2-H_1+24)*60+M_2-M_1-K)
else:
    print(H_2*60+M_2-H_1*60-M_1-K)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1, m1,h2, m2, k = map(float, input().split())
 
 
m3=k%60
h3=(k-m3)/60
ans=(h2-h3-h1)*60 + (m2-m3-m1)
 
print(ans)

Failing test case input:
10 0 15 0 30

Expected output:
270

Actual output:
270.0


Fixed submission (verdict: Accepted):


h1, m1, h2, m2, k = map(int, input().split())
 
 
 
ans=(h2-h1)*60 + (m2-k-m1)
 
print(ans)
Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


def answ():
    h1, m1, h2,m2,k = map(int, input().split())
    if h1 > h2:
        h2 +=24
    h = h2 - h1
    m = m2 - m1
    if m < 0:
        m = m + 60
        h = h - 1
    time = h*60 + m 
    return time - k
answ()

Failing test case input:
1 -26 83 26 -1

Expected output:
4973


Actual output:

Fixed submission (verdict: Accepted):
h1, m1, h2,m2,k = map(int, input().split())
if h1 > h2:
    h2 +=24
h = h2 - h1
m = m2 - m1
if m < 0:
    m = m + 60
    h = h - 1
time = h*60 + m 
print(time - k)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1, m1, h2, m2, k = map(int,input().split())
x = 60*max(0, h2-h1-1)
print(x)
if h1 == h2:
    x += (m2-m1)
else:
    x += (60-m1 + m2)
print(x - k)

Failing test case input:
17 -4 722 6 -1

Expected output:
42311


Actual output:
42240
42311


Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = map(int,input().split())
x = 60*max(0, h2-h1-1)
if h1 == h2:
    x += (m2-m1)
else:
    x += (60-m1 + m2)
print(x - k)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1, m1, h2, m2, k = [int(i) for i in input().split()]

awake = 60*h2+m2 - 60*h1+m1
if awake >= 0:
  print(awake-k)
else:
  print(60*24+awake-k)

Failing test case input:
6 -2 15 1 5

Expected output:
538


Actual output:
534


Fixed submission (verdict: Accepted):
h1, m1, h2, m2, k = [int(i) for i in input().split()]

awake = 60*h2+m2 - (60*h1+m1) - k
print(awake)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c,d,e =map(int ,input().split())
g=0
h=0
f=c-a
if d-b<0:
  g=60+d-b
  f-=1
g+=f*60
if g<e :
  h=0
else:
  h=g-e
print(h)

Failing test case input:
10 -1 104 6 -1

Expected output:
5648


Actual output:
5641


Fixed submission (verdict: Accepted):
a,b,c,d,e =map(int ,input().split())
g=0
h=0
if d-b<0:
  g=60+d-b
  c-=1
else:
  g=d-b
f=c-a
g+=f*60
if g<e :
  h=0
else:
  h=g-e
print(h)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H1, M1, H2, M2, K = map(int, input().split())

if H1 > H2 or (H1 == H2 and M1 >= M2):
    H2 += 24
    
diff_min = H2*60 + M2 - (H1*60 + M1)
if diff_min - K < 0:
    print(0)
else:
    diff_min - K

Failing test case input:
0 -8 722 6 -1

Expected output:
43335


Actual output:

Fixed submission (verdict: Accepted):
H1, M1, H2, M2, K = map(int, input().split())

if H1 > H2 or (H1 == H2 and M1 >= M2):
    H2 += 24
    
diff_min = H2*60 + M2 - (H1*60 + M1)
if diff_min - K < 0:
    print(0)
else:
    print(diff_min - K)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1,m1,h2,m2,k=map(int,input().split())
s=abs(h2-h1)*60+abs(m2-m1)
n=s-k
print(n)

Failing test case input:
8 0 12 -1 22

Expected output:
217


Actual output:
219


Fixed submission (verdict: Accepted):
h1,m1,h2,m2,k=map(int,input().split())
s=(h2-h1)*60+(m2-m1)
n=s-k
print(n)
Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h_1, m_1, h_2, m_2, k = map(int, input().split())
print(h_1*60+m_1-h_2*60-m_2-k)

Failing test case input:
-1 -3 436 6 0

Expected output:
26229


Actual output:
-26229


Fixed submission (verdict: Accepted):
h_1, m_1, h_2, m_2, k = map(int, input().split())
print(-h_1*60-m_1+h_2*60+m_2-k)

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
h1,m1,h2,m2,k = map(int, input().split())
print(max(h2*60+m2 - h1*60+m1 - k, 0))

Failing test case input:
1 -41 83 26 0

Expected output:
4987


Actual output:
4905


Fixed submission (verdict: Accepted):
h1,m1,h2,m2,k = map(int, input().split())
print(max((h2*60+m2) - (h1*60+m1) - k, 0))

Problem: p02663
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
H1,M1,H2,M2,K=map(int, input().split())
hour = H2-H1
if M1 > M2:
  hour -= 1
  minutes = abs(M2-M1)
else:
  minutes = M2-M1

print(hour*60+minutes-K)


Failing test case input:
11 0 12 -1 29

Expected output:
30


Actual output:
-28


Fixed submission (verdict: Accepted):
H1,M1,H2,M2,K=map(int, input().split())

if H1 > H2:
  hour = H2+(24-H1)
else:
  hour = H2-H1

if M1 > M2:
  hour -= 1
  minutes = M2+(60-M1)
else:
  minutes = M2-M1
print(hour*60+minutes-K)

Problem: p02663
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def main():
    H1, M1, H2, M2, K = (int(i) for i in input().split())
    h = H2 - H1
    m = 0
    if M2 - M1 >= 0:
        m = M2 - M1
    elif H1 != H2:
        m = (60 - M2) + M1
    else:
        m = 0
    ans = h*60 + m - K
    if ans > 0:
        print(ans)
    else:
        print(0)


if __name__ == '__main__':
    main()


Failing test case input:
4 0 12 -1 22

Expected output:
457


Actual output:
519


Fixed submission (verdict: Accepted):
def main():
    H1, M1, H2, M2, K = (int(i) for i in input().split())
    h = H2 - H1
    m = M2 - M1
    ans = h*60 + m - K
    if ans > 0:
        print(ans)
    else:
        print(0)


if __name__ == '__main__':
    main()
Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
x = [int(x) for x in input().split()]
ans = 0
for i in x:
  ans+=min(abs(K-i),i)
print(ans)

Failing test case input:
1
-3
-867

Expected output:
-1734


Actual output:
-867


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
x = [int(x) for x in input().split()]
ans = 0
for i in x:
  ans+=2*min(abs(K-i),i)
print(ans)

Problem: p03598
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
K = int(input())
x = list(map(int, input().split()))

sum = 0

for i in range(N):
  if x[i] >= K - x[i]:
    sum += K - x[i]
  
  else:
    sum += x[i]

print(sum)

Failing test case input:
1
-1
-578

Expected output:
-1156


Actual output:
-578


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
x = list(map(int, input().split()))

sum = 0

for i in range(N):
  if x[i] >= K - x[i]:
    sum += 2 * (K - x[i])
  
  else:
    sum += 2 * x[i]

print(sum)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

ans = 0

for i in range(N):
    if X[i] >= K - X[i]:
        ans += 2 * (K - X[i])
    else:
        ans += 2 * X[i]

    print(ans)


Failing test case input:
5
20
11 17 9 17 12

Expected output:
64


Actual output:
18
24
42
48
64


Fixed submission (verdict: Accepted):

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

ans = 0

for i in range(N):
    if X[i] >= K - X[i]:
        ans += 2 * (K - X[i])
    else:
        ans += 2 * X[i]

print(ans)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
k=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n):
    c+=min(abs(k-a[i]),a[i])
print(c)

Failing test case input:
2
7
3 4

Expected output:
12


Actual output:
6


Fixed submission (verdict: Accepted):
n=int(input())
k=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n):
    c+=2*min(abs(k-a[i]),a[i])
print(c)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
k=int(input())
ans=0
for i in list(map(int,input().split())):
    if 2*i<k:ans+=2*i
    else:ans+=2*k
print(ans)

Failing test case input:
5
20
8 12 9 17 15

Expected output:
66


Actual output:
154


Fixed submission (verdict: Accepted):
n=int(input())
k=int(input())
ans=0
for i in list(map(int,input().split())):
    if 2*i<k:ans+=2*i
    else:ans+=2*(k-i)
print(ans)

Problem: p03598
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
K = int(input())
X = [int(x) for x in input().split()]

ans = 0
for x in X:
    ans += min(x, abs(x-K))
print(ans)

Failing test case input:
1
0
-7

Expected output:
-14


Actual output:
-7


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
X = [int(x) for x in input().split()]

ans = 0
for x in X:
    ans += min(x, abs(x-K))
ans *= 2
print(ans)
Problem: p03598
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n=int(input())
k=int(input())
x = list(map(int, input().split()))

ans=0
for i in range(n):
  ans+=min(x[i],abs(x[i]-k))
print(ans)
  

Failing test case input:
5
20
14 18 20 17 7

Expected output:
36


Actual output:
18


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

ans=0
for i in range(n):
  ans+=min(x[i],abs(x[i]-k))
print(ans*2)

Problem: p03598
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
_,k=int(input()),int(input())
print(sum([min([i,k-i])for i in list(map(int,input().split()))]))


Failing test case input:
1
000
-6

Expected output:
-12


Actual output:
-6


Fixed submission (verdict: Accepted):
_,k=int(input()),int(input())
print(sum([min([i,k-i])*2 for i in list(map(int,input().split()))]))

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
k=int(input())
ans=0
for i in list(map(int,input().split())):
    if 2*i<k:ans+=2*i
    else:ans+=k
print(ans)

Failing test case input:
5
20
14 12 16 17 15

Expected output:
52


Actual output:
100


Fixed submission (verdict: Accepted):
n=int(input())
k=int(input())
ans=0
for i in list(map(int,input().split())):
    if 2*i<k:ans+=2*i
    else:ans+=2*(k-i)
print(ans)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
NUM = int(input())
K = int(input())
POS = list(map(int, input().split()))
a = 0
b = 0
sum = 0
for i in POS:
    a = pow(i, 2)
    b = pow(abs((i - K)), 2)
    sum += min(a, b)
print(sum)



Failing test case input:
1
-11
-110

Expected output:
-220


Actual output:
9801


Fixed submission (verdict: Accepted):
NUM = int(input())
K = int(input())
POS = list(map(int, input().split()))
sum = 0
for i in POS:
    a = i * 2
    b = abs(i - K) * 2
    sum += min(a, b)
print(sum)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
k=int(input())
x=list(map(int,input().split()))
ans=0
for i in range(len(x)):
  if abs(x[i]-k)>=x[i]:
    ans=ans+x[i]*2
  else:
    ans=ans+(x[i]-k)*2
print(ans)

Failing test case input:
5
20
14 12 9 17 15

Expected output:
62


Actual output:
-26


Fixed submission (verdict: Accepted):
n=int(input())
k=int(input())
x=list(map(int,input().split()))
ans=0
for i in range(n):
  if abs(x[i]-k)>=x[i]:
    ans=ans+x[i]*2
  else:
    ans=ans+abs(x[i]-k)*2
print(ans)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
k = int(input())
b = list(map(int, input().split())) 

sum = 0
for ball in b:
  sum += ball - 0 if (ball - 0) < k - ball else k - ball
  
  print(sum*2)

Failing test case input:
5
20
14 10 20 17 15

Expected output:
48


Actual output:
12
32
32
38
48


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

sum = 0
for ball in b:
  sum += ball - 0 if (ball - 0) < k - ball else k - ball
  
print(sum*2)
Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
k=int(input())
x=list(map(int,input().split()))
ans=0
for i in range(n):
  ans+=min(x[i],k-x[i])
print(ans)

Failing test case input:
1
-2
-19

Expected output:
-38


Actual output:
-19


Fixed submission (verdict: Accepted):
n=int(input())
k=int(input())
x=list(map(int,input().split()))
ans=0
for i in range(n):
  ans+=min(x[i],k-x[i])
print(ans*2)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
b = int(input())
d = list(map(int, input().split()))
c = 0
for i in d:
    if i < b - i:
        c += i
    else:
        c += b-i
print(c)

Failing test case input:
1
-2
-47

Expected output:
-94


Actual output:
-47


Fixed submission (verdict: Accepted):
n = int(input())
b = int(input())
d = list(map(int, input().split()))
c = 0
for i in d:
    if i < b - i:
        c += i
    else:
        c += b-i
print(c*2)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
X = list(map(int, input().split()))
Z = 0
for i in range(N):
  Z += max(X[i]*2, abs(K-X[i])*2)
print(Z)

Failing test case input:
1
18
2

Expected output:
4


Actual output:
32


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
X = list(map(int, input().split()))
Z = 0
for i in range(N):
  Z += min(X[i]*2, abs(K-X[i])*2)
print(Z)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
  if K - x[i] <= x[i]:
    L = L + x[i]
  else:
    L = K -x[i]
print (2 * L)

Failing test case input:
1
-11
-2257

Expected output:
-4514


Actual output:
4492


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
  if K - x[i] >= x[i]:
    L += x[i]
  else:
    L += K -x[i]
print (2 * L)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
K=int(input())
ans=0
for x in map(int,input().split()):
    ans+=2*min(x,K-x)

Failing test case input:
5
20
8 12 9 17 15

Expected output:
66


Actual output:

Fixed submission (verdict: Accepted):
N=int(input())
K=int(input())
ans=0
for x in map(int,input().split()):
    ans+=2*min(x,K-x)
print(ans)

Problem: p03598
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

N = int(input())
K = int(input())
x = list(map(int, input().split()))
K_half =  10/2

total=0

for i in range(N):
    if K_half>=x[i]:
        total = total + x[i]*2
    else:
        total = total + (K-x[i])*2
print(total)

Failing test case input:
2
31
1 8

Expected output:
18


Actual output:
48


Fixed submission (verdict: Accepted):

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

total=0

for i in range(N):
    if K_half>=x[i]:
        total = total + x[i]*2
    else:
        total = total + (K-x[i])*2
print(total)
Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
  if K - x[i] >= x[i]:
    L = L + x[i]
  else:
    L = K - x[i]
print (2 * L)

Failing test case input:
2
9
1 6

Expected output:
8


Actual output:
6


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
  if K - x[i] >= x[i]:
    L += x[i]
  else:
    L += K -x[i]
print (2 * L)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
k=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  ans+=min(a[i]*2,abs(a[i]-k)+a[i])
print(ans)

Failing test case input:
5
23
11 17 9 17 12

Expected output:
86


Actual output:
109


Fixed submission (verdict: Accepted):
n=int(input())
k=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  ans+=min(a[i]*2,abs(a[i]-k)*2)
print(ans)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
x = list(map(int, input().split()))
for i in x:
    print(min(abs(K - i), i) * 2)

Failing test case input:
5
20
14 18 20 17 7

Expected output:
36


Actual output:
12
4
0
6
14


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
x = list(map(int, input().split()))
sum = 0;
for i in x:
    sum += min(abs(K - i), i) * 2
print(sum)

Problem: p03598
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
N = int(input())
K = int(input())
X = list(map(int,input().split()))
distance = 0
for n in range(N):
  if X[n] < K/2:
    distance += X[n]
  else:
    distance += K - X[n]
print(distance)
  

Failing test case input:
1
0
-26

Expected output:
-52


Actual output:
-26


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
N = int(input())
K = int(input())
X = list(map(int,input().split()))
distance = 0
for n in range(N):
  if X[n] < K/2:
    distance += X[n]
  else:
    distance += K - X[n]
print(distance*2)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n = int(input())
k = int(input())
x = list(map(int, input().split())) 

sum = 0

for i in x:
    if i > k - i:
        sum = sum + i
    else:
        sum = sum + k - i

print(sum)

Failing test case input:
2
7
3 4

Expected output:
12


Actual output:
8


Fixed submission (verdict: Accepted):


n = int(input())
k = int(input())
x = list(map(int, input().split())) 

sum = 0

for i in x:
    if i < k - i:
        sum = sum + i
    else:
        sum = sum + k - i

print(sum*2)
Problem: p03598
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
K = int(input())

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

res = 0
for i in range(N):
  if X[i] >= (K - X[i]):
    res += 2 * X[i]
  else:
    res += 2 * (K - X[i])

print(res)

Failing test case input:
1
000
-4

Expected output:
-8


Actual output:
8


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

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

res = 0
for i in range(N):
  if X[i] <= (K - X[i]):
    res += 2 * X[i]
  else:
    res += 2 * (K - X[i])

print(res)

Problem: p03598
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
k = int(input())
x = map(int, input().split())
s = 0
for xx in x:
  s += min(xx, k-xx)
print(s)

Failing test case input:
1
2
-16

Expected output:
-32


Actual output:
-16


Fixed submission (verdict: Accepted):
n = int(input())
k = int(input())
x = map(int, input().split())
s = 0
for xx in x:
  s += 2 * min(xx, k-xx)
print(s)

Problem: p03598
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
k = int(input())
x = list(map(int,input().split()))
ans = 0

for i in x:
  ans += min(abs(i-k),i)
  
print(ans)


Failing test case input:
5
20
14 12 9 17 15

Expected output:
62


Actual output:
31


Fixed submission (verdict: Accepted):
n = int(input())
k = int(input())
x = list(map(int,input().split()))
ans = 0

for i in x:
  ans += min(abs(i-k),i)*2
  
print(ans)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
k = int(input())
x = list(map(int, input().split()))
ans = 0
for i in range(n):
  ans += min(x[i], k-x[i])
print(ans)

Failing test case input:
1
-2
-85

Expected output:
-170


Actual output:
-85


Fixed submission (verdict: Accepted):
n = int(input())
k = int(input())
x = list(map(int, input().split()))
ans = 0
for i in range(n):
  ans += min(x[i], k-x[i])
print(ans*2)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K,*x =map(int,open(0).read().split())
print(sum([min(i,K-i) for i in x]))


Failing test case input:
1
-3
-488

Expected output:
-976


Actual output:
-488


Fixed submission (verdict: Accepted):
N,K,*x =map(int,open(0).read().split())
print(sum(2*[min(i,K-i) for i in x]))

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
k = int(input())
xxx = list(map(int, input().split()))
ans = 0
for x in xxx:
    ans += 2 * (x if k < 2 * x else k - x)
print(ans)


Failing test case input:
5
20
14 18 20 17 15

Expected output:
32


Actual output:
168


Fixed submission (verdict: Accepted):
n = int(input())
k = int(input())
xxx = list(map(int, input().split()))
ans = 0
for x in xxx:
    ans += 2 * (x if k > 2 * x else k - x)
print(ans)
Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
k = int(input())
x = list(map(int, input().split()))

ans = 0
for i in x:
  ans += min(i, abs(k - i))
print(ans)

Failing test case input:
1
-1
-529

Expected output:
-1058


Actual output:
-529


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

ans = 0
for i in x:
  ans += 2 * min(i, abs(k - i))
print(ans)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(input())
k = int(input())
x = list(map(int,input().split()))
ans=0

for i in range(n):
    ans+=min(2*x[i],2*k-x[i])

print(ans)

Failing test case input:
1
15
8

Expected output:
14


Actual output:
16


Fixed submission (verdict: Accepted):

n = int(input())
k = int(input())
x = list(map(int,input().split()))
ans=0
for i in range(n):
    ans+=min(2*x[i],2*(k-x[i]))
print(ans)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
k = int(input())
x = [int(_) for _ in input().split()]

ans = 0
for i in x:
    ans += min(i, abs(i-k)) * 2
    print(ans)

Failing test case input:
5
20
14 12 9 17 15

Expected output:
62


Actual output:
12
28
46
52
62


Fixed submission (verdict: Accepted):
n = int(input())
k = int(input())
x = [int(_) for _ in input().split()]

ans = 0
for i in x:
    ans += min(i, abs(i-k)) * 2
print(ans)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
X = list(map(int, input().split()))
count = 0
for i in X:
    A = i
    B =abs(i - K)
    if A >= B:
        count = count + B
    else:
        count = count + A
print(count)

Failing test case input:
5
20
11 12 9 17 15

Expected output:
68


Actual output:
34


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
X = list(map(int, input().split()))
count = 0
for i in X:
    A = i
    B =abs(i - K)
    if A >= B:
        count = count + 2*B
    else:
        count = count + 2*A
print(count)

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

l = [int(i) for i in input().split()]
s = 0

for i in range(n):
  if k - l[i] > l[i]:
    s += l[i]  * 2
 
  elif k - l[i] < l[i]:
    s += 2 * (k - l[i])
    
print(s)

Failing test case input:
5
20
14 10 20 17 15

Expected output:
48


Actual output:
28


Fixed submission (verdict: Accepted):
n = int(input())
k = int(input())

l = [int(i) for i in input().split()]
s = 0

for i in range(n):
  if k - l[i] >= l[i]:
    s += l[i]  * 2
 
  elif k - l[i] < l[i]:
    s += 2 * (k - l[i])
    
print(s)

Problem: p03598
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
k=int(input())
l=list(map(int,input().split()))

ans=0
for i in l:
  if i>=k/2:
    ans+=abs(k-i)*2
  else:
    ans+=i

print(ans)

Failing test case input:
5
20
0 12 9 17 15

Expected output:
50


Actual output:
41


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

ans=0
for i in l:
  if i>=k/2:
    ans+=abs(k-i)*2
  else:
    ans+=i*2

print(ans)
Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

K = int( input() )

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

x = 0
for num in list:
    a = num * 2
    b = (K - num) * 2

    if b <= a:
        x += b
    elif b > a:
        x += a

print( x )

Failing test case input:
1
-4
-160

Expected output:
-320


Actual output:
-8


Fixed submission (verdict: Accepted):


N = int( input() )

K = int( input() )

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

x = 0
for num in list:
    a = num * 2
    b = (K - num) * 2

    if b <= a:
        x += b
    elif b > a:
        x += a

print( x )

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
X = input().split()
S = 0
for i in range(N):
  if (K-int(X[i])) > int(X[i]) :
    S += int(X[i])
  else:
    S += (K-int(X[i]))
print(S)

Failing test case input:
1
18
2

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
X = input().split()
S = 0
for i in range(N):
  if (K-int(X[i])) > int(X[i]) :
    S += int(X[i])
  else:
    S += (K-int(X[i]))
print(2*S)

Problem: p03598
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
k = int(input())
x_l = list(map(int, input().split()))
th = k/2

ans = 0
for x in x_l:
  if x >= th:
    ans += abs(x-k)
  else:
    ans += x
print(ans)
    

Failing test case input:
5
20
14 10 16 17 15

Expected output:
56


Actual output:
28


Fixed submission (verdict: Accepted):
n = int(input())
k = int(input())
x_l = list(map(int, input().split()))
th = k/2

ans = 0
for x in x_l:
  if x >= th:
    ans += abs(x-k)
  else:
    ans += x
print(ans*2)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
  if K - x[i] <= x[i]:
    L = L + x[i]
  else:
    L = K -x[i]
print (L)


Failing test case input:
1
2
-14

Expected output:
-28


Actual output:
16


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
  if K - x[i] >= x[i]:
    L += x[i]
  else:
    L += K -x[i]
print (2 * L)

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

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

ans = 0

for i in range(n):
  ans += 2 * min(x[i], k-x[i]) + max(x[i], k-x[i])

print(ans)

Failing test case input:
1
0
-8

Expected output:
-16


Actual output:
-8


Fixed submission (verdict: Accepted):
n = int(input())
k = int(input())

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

ans = 0

for i in range(n):
  ans += 2 * min(x[i], k-x[i])

print(ans)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
k = int(input())
xxx = list(map(int, input().split()))
ans = sum(min(x, abs(k - x)) for x in xxx)
print(ans)

Failing test case input:
1
-1
-13

Expected output:
-26


Actual output:
-13


Fixed submission (verdict: Accepted):
n = int(input())
k = int(input())
xxx = list(map(int, input().split()))
ans = sum(min(x, abs(k - x)) for x in xxx) * 2
print(ans)
Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())

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

a = 0
for i in x:
    if i < int(K / 2):
        a += i * 2
    elif i > int(K / 2):
        a += (K - i) * 2

print(a)

Failing test case input:
2
7
3 4

Expected output:
12


Actual output:
6


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

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

a = 0
for i in x:
    if float(i) <= (K / 2):
        a += i * 2
    elif float(i) > (K / 2):
        a += (K - i) * 2

print(a)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
k = int(input())
l = map(int,input().split())
print(sum(min(i,k-i) for i in range(n))*2)

Failing test case input:
1
2
-14

Expected output:
-28


Actual output:
0


Fixed submission (verdict: Accepted):
input()
k = int(input())
l = map(int,input().split())
print(sum(min(i,k-i) for i in l)*2)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
X = list(map(int,input().split()))

ans = 0
for x in X:
  ans += min(x,K-x)

print(ans)

Failing test case input:
1
-11
-220

Expected output:
-440


Actual output:
-220


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
X = list(map(int,input().split()))

ans = 0
for x in X:
  ans += min(x,K-x) * 2

print(ans)

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

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

a = 0
for i in x:
    if float(i) < (K / 2):
        a += i * 2
    elif float(i) > (K / 2):
        a += (K - i) * 2

print(a)


Failing test case input:
5
20
14 10 20 17 15

Expected output:
48


Actual output:
28


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

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

a = 0
for i in x:
    if float(i) <= (K / 2):
        a += i * 2
    elif float(i) > (K / 2):
        a += (K - i) * 2

print(a)

Problem: p03598
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int (input())
K = int (input())
x = list(map(int, input().split()))
sum_min = 0

for p in x:
  a = 2*p
  b = 2*abs(K-p)
  if a > b:
    sum_min += b
  elif a < b:
    sum_min += a

print(sum_min)

Failing test case input:
5
20
14 10 20 17 15

Expected output:
48


Actual output:
28


Fixed submission (verdict: Accepted):
N = int (input())
K = int (input())
x = list(map(int, input().split()))
sum_min = 0

for p in x:
  a = 2*p
  b = 2*abs(K-p)
  if a >= b:
    sum_min += b
  elif a < b:
    sum_min += a

print(sum_min)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
NUM = int(input())
K = int(input())
POS = list(map(int, input().split()))
a_sum = 0
b_sum = 0
for i in POS:
    a_sum += pow(i, 2)
    b_sum += pow(abs((i - K)), 2)

print(min(a_sum, b_sum))



Failing test case input:
1
-2
-49

Expected output:
-98


Actual output:
2209


Fixed submission (verdict: Accepted):
NUM = int(input())
K = int(input())
POS = list(map(int, input().split()))
sum = 0
for i in POS:
    a = i * 2
    b = abs(i - K) * 2
    sum += min(a, b)
print(sum)
Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input()
K=int(input())
ans = [min(x-0,K-x) for x in list(map(int,input().split()))]
print(sum(ans))

Failing test case input:
5
19
11 9 9 17 1

Expected output:
58


Actual output:
29


Fixed submission (verdict: Accepted):
input()
K=int(input())
ans = [min(x-0,K-x) for x in list(map(int,input().split()))]
print(sum(ans)*2)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(input())
k = int(input())
l = list(map(int, input().split()))
for i in range(n):
    l[i] = min(l[i],abs(l[i]-k))
print(sum(l))

Failing test case input:
5
20
0 12 9 17 15

Expected output:
50


Actual output:
25


Fixed submission (verdict: Accepted):

n = int(input())
k = int(input())
l = list(map(int, input().split()))
for i in range(n):
    l[i] = min(l[i],abs(l[i]-k))*2
print(sum(l))

Problem: p03598
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
K=int(input())
def ans(s):
  n=int(s)
  return 2*min(K-n,n)
x=list(map(int,input().split()))
print(sum(x))



Failing test case input:
1
-4
-91

Expected output:
-182


Actual output:
-91


Fixed submission (verdict: Accepted):
N=int(input())
K=int(input())
def ans(s):
  n=int(s)
  return 2*min(K-n,n)
x=list(map(ans,input().split()))
print(sum(x))

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
a = list(map(int, input().split()))
sum_a = 0

for i in range(N):
    A = a[i]
    B = K-a[i]
    sum_a += min(A,B)
    
    
print(sum_a)

Failing test case input:
1
-4
-91

Expected output:
-182


Actual output:
-91


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
a = list(map(int, input().split()))
sum_a = 0

for i in range(N):
    A = 2*a[i]
    B = 2*(K-a[i])
    sum_a += min(A,B)
    
    
print(sum_a)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n = int(input())
k = int(input())
x = list(map(int, input().split())) 

sum = 0

for i in x:
    if i < k - i:
        sum = sum + i
    else:
        sum = sum + k - i

print(sum)

Failing test case input:
1
15
8

Expected output:
14


Actual output:
7


Fixed submission (verdict: Accepted):


n = int(input())
k = int(input())
x = list(map(int, input().split())) 

sum = 0

for i in x:
    if i < k - i:
        sum = sum + i
    else:
        sum = sum + k - i

print(sum*2)

Problem: p03598
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = int(input())
X = list(map(int,input().split(" ")))
print(sum([min([X[i], K-X[i]]) for i in range(N)]))

Failing test case input:
1
-1
-308

Expected output:
-616


Actual output:
-308


Fixed submission (verdict: Accepted):
N = int(input())
K = int(input())
X = list(map(int,input().split(" ")))
print(2 * sum([min([X[i], K-X[i]]) for i in range(N)]))