s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s832908706 | p03597 | u781025961 | 1510859768 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 47 | N,A = map(int,input().split())
print(N * N - A) |
s622722618 | p03597 | u330205771 | 1509775596 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 4 | A.py |
s964842999 | p03597 | u887153853 | 1509141501 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3188 | 49 | N, A = map(int,input().split())
t=N**2-A
print(t) |
s945495675 | p03597 | u887153853 | 1509141441 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3060 | 48 | N, A = map(int,input().split())
t=N^2-A
print(t) |
s949964015 | p03597 | u837070819 | 1508360200 | Python | Python (2.7.6) | py | Runtime Error | 12 | 2692 | 49 | N=int(raw_input())
A=int(raw_input())
prom N*N-A |
s547601279 | p03597 | u417658545 | 1508196953 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3316 | 1060 | #import numpy as np
def FindMaxCon(res, water, C, D, E):
c = 0
d = 0
tmpCon = 0
dp = list([False] * 3001)
dp[0] = True
for i in range(3001):
if(i - C >= 0 and i - D >= 0):
dp[i] = dp[i - C] or dp[i - D]
elif(i - C >= 0):
dp[i] = dp[i - C]
elif(i - D >= 0):
dp[i] = dp[i - D]
... |
s160863330 | p03597 | u898690911 | 1507829291 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 33 | a=input()
b=input()
print(a*a-b) |
s780565943 | p03597 | u161911516 | 1507129137 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 101 |
if __name__ == "__main__":
input1 = input()
input2 = input()
print (input1*input1 - input2)
|
s057829799 | p03597 | u161911516 | 1507128979 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 67 |
input1 = input()
input2 = input()
print (input1*input1 - input2)
|
s697346639 | p03597 | u782516204 | 1506736285 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 58 | n = int(raw_input())
m = int(raw_input())
print( n*n - m ) |
s902361020 | p03597 | u266272131 | 1506714268 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 49 | a,b = list(map(int,input().split()))
print(a*a-b) |
s376878035 | p03597 | u937164028 | 1506493130 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 211 | if __name__ == "__main__":
N = int(input())
K = int(input())
x = list(map(int, input().split()))
ans = 0
for i in range(N):
r = min(x[i],abs(K-x[i]))
ans += 2*r
print(ans) |
s386030262 | p03597 | u937164028 | 1506490008 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 89 | if __name__ =='__main__':
N = input()
A = input()
ans = N**2-A
print(ans) |
s688136733 | p03597 | u937164028 | 1506489763 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 93 | if __name__ =='__main__':
N = input()
A = input()
ans = N**2 - A
print(ans) |
s269545575 | p03597 | u937164028 | 1506489736 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 92 | if __name__ =='__main__':
N = input()
A = input()
ans = N**2 - A
print ans |
s870932933 | p03597 | u937164028 | 1506489154 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 92 | if __name__ =='__main__':
N = input()
A = input()
ans = N**2 - A
print ans |
s775180854 | p03597 | u937164028 | 1506489100 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 92 | if __name__ =='__main__':
N = input()
A = input()
ans = N**2 - A
print ans |
s098623425 | p03597 | u937164028 | 1506489089 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 92 | if __name__ =='__main__':
N = input()
A = input()
ans = N**2 - A
print ans |
s464428353 | p03597 | u937164028 | 1506488962 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 100 | if __name__ =='__main__':
N = raw_input()
A = raw_input()
ans = N**2 - A
print ans |
s475878498 | p03597 | u937164028 | 1506488852 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 101 | if __name__ =='__main__':
N = raw_input()
A = raw_input()
ans = N**2 - A
return N-A |
s644063543 | p03597 | u937164028 | 1506488775 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2572 | 95 | if __name__ =='__main__':
N = raw_input()
A = raw_input()
N = N**2
return N-A |
s971154019 | p03597 | u813450984 | 1506279458 | Python | Python (3.4.3) | py | Runtime Error | 20 | 2940 | 176 | NUM = int(input())
K = int(input())
POS = list(map(int, input().split()))
sum = 0
for i in POS:
a = pow(i, 2)
b = pow(abs((i - K)), 2)
sum += min(a, b)
print(sum)
|
s634914916 | p03597 | u045930594 | 1506111740 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3188 | 684 | inf = 10 ** 9
n = int(input())
dp = [[inf for i in range(n)] for j in range(n)]
a = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
j = 0
for e in map(int, input().split()):
a[i][j] = e
dp[i][j] = e
j += 1
for i in range(n):
dp[i][i] = inf
# washal_floyd
ret = 0
for i in range(n):
for j in ran... |
s958592986 | p03597 | u335590796 | 1505970187 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 769 | a = list(map(int,input().split()))
big = a[1] * 100
small = a[0] * 100
concentration = 0
maxtotal = 0
maxsugar = 0
timesb = int(a[5] / big)
timess = int(a[5] / small)
for i in range(timesb + 1):
waterb = big * i
for j in range(timess + 1):
waters = small * j
watert = waterb + waters
if watert >= a[5]:
break
... |
s766457872 | p03597 | u834354741 | 1505970135 | Python | Python (3.4.3) | py | Runtime Error | 16 | 3060 | 194 | N = int(input())
K = int(input())
x = list(map(int,input().split()))
length = 0
Khalf = K//2
for i in range(N):
if x[i] <= Khalf:
length += 2*x[i]
else:
length += 2*(K-x[i])
print(length)
|
s181045735 | p03597 | u834354741 | 1505969986 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 195 | N = int(input())
K = int(input())
x = list(map(int,input().split()))
length = 0
Khalf = K//2
for i in range(N):
if x[i] <= Khalf:
length += 2*x[i]
else:
length += 2*(K-x[i])
print(length)
|
s771740122 | p03597 | u909643606 | 1505851972 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 458 | a,b,c,d,e,f= map(int, input().split())
youeki=0
yousitu=0
noudo=0
n_a=int(f/(100*a))
for i in range(2+n_a):
for j in range(2+int((f-100*i*a)/(100*b))):
for k in range(2+int((f-100*i*a-100*j*b)/c)):
for l in range(2+int((f-100*i*a-100*j*b-k*c)/d)):
S=100.0*a*i+100.0*b*j+c*k+d*l
T=c*k+d*l
if S!=0:
... |
s384678456 | p03597 | u909643606 | 1505785588 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 44 | N=int(input())
a=int(input())
print(N**2-A) |
s079005001 | p03597 | u667084803 | 1505700230 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 699 | def Warshall_Floyd(edges,N):
"""頂点N個のグラフ上の隣接行列edgesが与えられたとき,
2点間の最短距離距離を隣接行列で返す"""
for k in range(N):
for i in range(N):
for j in range(N):
edges[i][j]=min(edges[i][j],edges[i][k]+edges[k][j])
return edges
import sys
from sys import stdin
input = stdin.readline
N=int(input())
A=[list(map(in... |
s206014072 | p03597 | u552668967 | 1505617982 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 85 | from sys import stdin
n = in(stdin.readline())
a = int(stdin.readline())
print n*n-a |
s469997745 | p03597 | u537905693 | 1505617701 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1077 | #!/usr/bin/env python
# coding: utf-8
def main():
A, B, C, D, E, F = [int(x) for x in input().split()]
max_rate = E / (100 + E)
best_weight, best_suger, best_rate = A*100, 0, 0.0
for a in range(F//100 +1):
for b in range((F-a*A)//100 + 1):
water = (a*A+b*B)*100
if water ... |
s430338305 | p03597 | u063896676 | 1505615362 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1131 | # -*- coding: utf-8 -*-
inlist = list(map(int, input().split()))
a = inlist[0] * 100
b = inlist[1] * 100
c = inlist[2]
d = inlist[3]
e = inlist[4]
f = inlist[5]
tupleList = []
for i in range((f//a) + 1):
for j in range((f - a*i)//b + 1):
for k in range((f - a*i - b*j)//c + 1):
for l in range(... |
s160336717 | p03597 | u080112718 | 1505612592 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 175 | N = int(input())
K = int(input())
x = [int(i) for i in input().split()]
ans = 0
for xi in x:
if xi < K/2:
ans += xi*2
else:
ans += (K-xi)*2
print(ans) |
s780984722 | p03597 | u877199806 | 1505611520 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 53 | a = int(raw_input())
b = int(raw_input())
print a*a-b |
s789978066 | p03597 | u858136677 | 1505611460 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 171 | 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) |
s807152426 | p03597 | u877199806 | 1505611413 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 54 | a = int(raw_input())
b = int(raw_input())
return a*a-b |
s255408071 | p03597 | u080112718 | 1505611331 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 234 | N = int(input())
K = int(input())
x = [int(i) for i in input().split()]
ans = 0
if K == 1:
print(2*N)
else:
for xi in x:
if xi < K//2:
ans += xi*2
else:
ans += (K-xi)*2
print(ans) |
s314139814 | p03597 | u063896676 | 1505611043 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 217 | # -*- coding: utf-8 -*-
n = int(input())
k = int(input())
x = list(map(int, input().split())) #x[0->(n-1)]
sum = 0
for i in x:
if i < k - i:
sum = sum + i
else:
sum = sum + k - i
print(sum) |
s770412212 | p03597 | u354075848 | 1505611006 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 75 | l = input().split()
n = int(l[0])
a = int(l[1])
ans = n ** 2 - a
print(ans) |
s012360863 | p03597 | u213431796 | 1505610991 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 37 | N = input()
A = input()
print(N*N-A) |
s522792742 | p03597 | u080112718 | 1505610947 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 178 | N = int(input())
K = int(input())
x = [int(i) for i in input().split()]
ans = 0
for xi in x:
if xi < K//2:
ans += xi*2
else:
ans += (K-xi)*2
print(ans) |
s653432406 | p03597 | u213431796 | 1505610729 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 44 | n = input()
a = input()
print ((n * n) - a) |
s682521629 | p03597 | u213431796 | 1505610640 | Python | Python (3.4.3) | py | Runtime Error | 94 | 2940 | 44 | a = input()
n = input()
print ((n * n) - a) |
s326033063 | p03597 | u213431796 | 1505610548 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 47 | N = input()
A = input()
print (str(N * N - A)) |
s500909230 | p03597 | u213431796 | 1505610493 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 45 | N = input()
A = input()
print str(N * N - A) |
s392764737 | p03597 | u213431796 | 1505610437 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 42 | N = input()
A = input()
print (N * N - A) |
s237971456 | p03597 | u213431796 | 1505610374 | Python | Python (2.7.6) | py | Runtime Error | 12 | 2692 | 42 | N = imput()
A = imput()
print (N * N - A) |
s999849425 | p03597 | u213431796 | 1505610299 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 42 | N = imput()
A = imput()
print (N * N - A) |
s613719967 | p03597 | u026951890 | 1505610248 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3316 | 667 | import sys
# utils
def read_numbers():
return [int(num) for num in sys.stdin.readline().split()]
def read_string():
return sys.stdin.readline().rstrip('\r\n')
def list2str(*array):
return ' '.join([str(i) for i in array])
def main(N, A):
return N*N - A
def parse_stdin():
# N = read_numbers()
... |
s677905066 | p03598 | u538784937 | 1599520653 | Python | Python (3.8.2) | py | Runtime Error | 32 | 9016 | 159 | N = input()
K = input()
l = list(map(int(input().split()))
print(N,K,l)
for i in l:
ans = 0
ans += min(i,K-i)
print(ans*2)
|
s511323921 | p03598 | u538784937 | 1599520552 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8808 | 135 | N = input()
K = input()
l = list(map(int(input().split()))
for i in l:
ans = 0
ans += min(i,K-i)
print(ans*2)
|
s739615105 | p03598 | u835575472 | 1599253158 | Python | Python (3.8.2) | py | Runtime Error | 20 | 8932 | 133 | n = int(input())
k = int(input())
x = map(int, input().split())
ans = 0
for i in range(n):
ans += min(x[i], abs(k-x[i]))
print(ans) |
s467702450 | p03598 | u835575472 | 1599253005 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8988 | 118 | n, k = map(int , input().split())
ans = 0
for i in range(n):
x = int(input())
ans += min(x, abs(x-k))
print(ans) |
s660014709 | p03598 | u796563423 | 1598538888 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9120 | 155 | a=int(input())
b=int(input())
c=list(map(int,input().split()))
total=0
for i in range(2):
d=2*c[i]
e=2*abs(9-c[i])
total+=min(d,e)
print(total) |
s696822697 | p03598 | u796563423 | 1598538836 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9176 | 173 | #Collecting Balls
a=int(input())
b=int(input())
c=list(map(int,input().split()))
total=0
for i in range(2):
d=2*c[i]
e=2*abs(9-c[i])
total+=min(d,e)
print(total) |
s318251149 | p03598 | u468972478 | 1598491926 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9180 | 152 | n = int(input())
k = int(input())
nums = list(map(int, input().split()))
a = []
for i in n:
a.append(2 * min(k-nums[i], nums[i]))
print(min(a))
|
s421995541 | p03598 | u468972478 | 1598491800 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9160 | 143 | n = int(input())
k = int(input())
nums = list(map(int, input().split()))
a = 0
for i in n:
a += (2 * min(k-nums[i], nums[i]))
print(a)
|
s628559941 | p03598 | u536017058 | 1597293215 | Python | PyPy3 (7.3.0) | py | Runtime Error | 96 | 74712 | 142 | N = int(input())
K = int(input())
x = [int(input()) for i in range(N)]
ans = 0
for i in range(N):
ans += min(2x[i], 2*(K-x[i]))
print(ans) |
s323602713 | p03598 | u137214546 | 1597095397 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8944 | 121 | n = int(input())
k = int(input())
summ = 0
for _ in range(n):
x = int(input())
summ += min(2*x, 2*(k-x))
print(summ) |
s289085529 | p03598 | u368270116 | 1596567747 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8872 | 175 | n=int(input())
k=int(input())
x=list(map(int,input().split())
ans=0
for i in range (n):
if abs(x[i])>abs(x[i]-k):
ans+=abs(x[i]-k)*2
else:
ans+=x[i]*2
print(ans) |
s081918479 | p03598 | u520465403 | 1595061274 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9092 | 236 | N = int(input())
K = int(input())
x = [int(i) for i in input().split()]
suml = [0] * 10
for i in range(N):
delta = abs(K-x[i])
if x[i] < delta:
suml[i] = suml[i] + x[i]*2
else:
suml[i] = suml[i] + delta*2
print(sum(suml)) |
s311686755 | p03598 | u953379577 | 1594991854 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9168 | 128 | n = int(input())
k = int(input())
x = list(map(int,input().split()))
ans = 0
for i in x:
ans += min(abs(x-k),x)
print(ans) |
s471481323 | p03598 | u869731337 | 1593304375 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9136 | 198 | n=int(input())
k=int(input())
xs=map(int,input().split(' '))
#A (0,i)
#B (K,i)
sum=0
for i in range(n):
deltak=abs(xs[i]-k)
if xs[i]<deltak:
sum+=2*xs[i]
else:
sum+=deltak*2
print(sum) |
s493096123 | p03598 | u061361273 | 1593059313 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8976 | 213 | #include<iostream>
using namespace std;
int main(){
int n, k;
cin >> n >> k;
int x;
int sum = 0;
for (int i=0;i<n; i++){
cin >> x;
if (x > k-x) sum += (k-x)*2;
else sum += x*2;
}
cout << sum<<endl;
} |
s318186051 | p03598 | u607075479 | 1592333692 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 61 | N,K,*A=map(int,open(0))
print(sum([min(a,K-a)*2 for a in A])) |
s081851499 | p03598 | u607075479 | 1592333565 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 102 | N = int(input())
K = int(input())
*A = map(int, input().split())
print(sum([min(a,K-a)*2 for a in A])) |
s071467060 | p03598 | u711238850 | 1588917712 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 154 | n = int(input())
k = int(input())
x = tuple([int(t)for t in input().split()])
ans = 0
for x_i in x:
if k-x>x:
ans+=x*2
else:
ans+=(k-x)*2 |
s755095529 | p03598 | u911276694 | 1588874226 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 160 | N=int(input())
K=int(input())
a=line(map(int,input().split()))
s=0
for i in range(len(a)):
if a[i]<=K-a[i]:
s=s+2*a[i]
else:
s=s+2*(K-a[i])
print(s) |
s832468750 | p03598 | u467307100 | 1588741655 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 130 | N = int(input())
K = int(input())
X = list(map(int, input()))
minSum = 0
for i in X:
minSum += min(i, K - i) * 2
print(minSum) |
s665664689 | p03598 | u852790844 | 1587569097 | Python | Python (3.4.3) | py | Runtime Error | 150 | 12484 | 217 | import sys
import numpy as np
readline = sys.stdin.readline
n = int(input())
k = int(input())
x = np.array(readline().split(), dtype=np.int64)
y = k - x
ans = np.sum(np.amin(np.stack([x,y]), axis=0)) * 2
print(ans) |
s341448553 | p03598 | u852790844 | 1587568986 | Python | Python (3.4.3) | py | Runtime Error | 148 | 12488 | 240 | import sys
import numpy as np
readline = sys.stdin.readline
n = int(input())
k = int(input())
x = np.array(readline().split(), dtype=np.int64)
y = k - x
print(np.stack([x,y]))
ans = np.sum(np.amin(np.stack([x,y]), axis=0)) * 2
print(ans) |
s640272061 | p03598 | u903005414 | 1587259827 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 183 | N = int(input())
T = list(map(int, input().split()))
sum_T = sum(T)
M = int(input())
for _ in range(M):
p, x = map(int, input().split())
v = sum_T - T[p - 1] + x
print(v)
|
s205169107 | p03598 | u904804404 | 1587002447 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 122 | N = int(input())
K = int(input())
x = list(map(int,input().split()))
res = 0
for i in x:
res += 2* min(x,K-x)
print(res) |
s403490308 | p03598 | u808593466 | 1586998998 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3068 | 305 | #include <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007
#define INF -99999999
using namespace std;
int main(){
int N,K; cin >> N >> K;
int ans = 0;
for (int i = 0; i < N; i++)
{
int x;
cin >> x;
ans += 2*min(x,K-x);
}
cout << ans << endl;
} |
s495154236 | p03598 | u698919163 | 1586830234 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 150 | N = int(input())
K = int(input())
X = list(map(int,input().split()))
answer = 0
for x in X:
answer += min(abs(x),abs(K-x))
answer *= 2
print(ans) |
s447268533 | p03598 | u201928947 | 1586779789 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 136 | n = int(input())
k = int(input())
x = map(int,input().split())
ans = 0
for i in range(n):
ans += min(abs(x[i]-k),x[i])
print(ans*2)
|
s734212966 | p03598 | u440129511 | 1585712340 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 135 | n=int(input())
k=int(input())
x=map(int,input().split())
l=[]
for i in range(n):
p=2*min(x[i],k-x[i])
l.append(p)
print(sum(l)) |
s989583763 | p03598 | u702786238 | 1585168049 | Python | PyPy3 (2.4.0) | py | Runtime Error | 183 | 38640 | 129 | N = int(input())
K = int(input())
l = list(map(int, input().split()))
ans = 0
for i in l:
ans += min([K-l, l])*2
print(ans) |
s759216147 | p03598 | u697696097 | 1584501524 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 130 | n=int(input())
k=int(input())
xx=list(map(int.input().split()))
diff=0
for x in xx:
diff+=2*min(abs(x),abs(x-k))
print(diff)
|
s116890438 | p03598 | u603939330 | 1583636333 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 317 |
N, A,B = map(int, input().split())
str = []
if A==0 and B==0:
print('0')
else:
from math import floor
list_ab = []
list_b = ['b']*A
list_ab+=(list_b)
list_a = ['a']*B
list_ab+=list_a
count = (floor(N/(A+B))+1)
str = list_ab*count
str = str[:N]
print(str.count('b'))
|
s657613442 | p03598 | u934868410 | 1582739243 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 131 | n = int(input())
k = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
ans += min(k-a, a) * 2
print(ans) |
s647061081 | p03598 | u597455618 | 1574585754 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 240 | a, b, c = map(int, input().split())
ans = 0
if a == b == c and a%2 == 0:
print(-1)
else:
while (a%2 or b%2 or c%2) == 0 :
tmp1 = a
tmp2 = b
a = b/2 + c/2
b = tmp1/2 + c/2
c = tmp1/2 + tmp2/2
ans += 1
print(ans) |
s699083550 | p03598 | u693953100 | 1574175262 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 122 | n=int(input())
k=int(input())
a=list(map(int,input().split()))
ans = 0
for i in a:
ans+=min(a*2,abs(k-a)*2)
print(ans) |
s178861440 | p03598 | u007886915 | 1572990398 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 254 | # -*- coding: utf-8 -*-
n = int(input())
k = int(input())
xi = list(int, input().split())
i = 1
soukyori = 0
while i <= n:
if k-x[i] >= x[i]:
soukyori += x[i]
else :
soukyori += k-x[i]
i += 1
print(soukyori) |
s503694144 | p03598 | u644907318 | 1571052647 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 130 | N = int(input())
K = int(input())
X = list(map(int,input().split()))
cnt = 0
for i in range(N):
cnt += 2*min(K-x,x)
print(cnt) |
s163250672 | p03598 | u871049538 | 1567378587 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 220 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k ;
int ans = 0;
int x;
for (int i=0; i<n; i++) {
cin >> x;
ans += min(x*2, (k-x)*2);
}
cout << ans << endl;
}
|
s166059269 | p03598 | u639104973 | 1566868719 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 153 | N,X=map(int, input().split())
L=list(map(int, input().split()))
s=[x for x in range(N) if sum(L[:x])<=X]
if N>=len(s):
print(len(s))
else:
print(N+1) |
s840024237 | p03598 | u360515075 | 1566821716 | Python | Python (3.4.3) | py | Runtime Error | 49 | 5468 | 234 | import fractions
from functools import reduce
N = int(input())
T = [int(input()) for _ in range(N)]
def gcd(*args):
return reduce(fractions.gcd, args)
ans = 1
for i in range(1, N):
ans = ans * T[i] // gcd(ans, T[i])
print(ans) |
s108335652 | p03598 | u627530854 | 1566264075 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 125 | n = int(input())
k = int(input())
total = 0
for _ in range(n):
x = int(input())
total += min(x, k - x)
print(2 * total) |
s545907452 | p03598 | u434282696 | 1565219348 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 139 | n,k = map(int,input().split())
x = [int(_) for _ in input().split()]
res = 0
for i in range(n):
res += min(x[i],abs(k-x[i]))
print(res*2) |
s499883325 | p03598 | u537234062 | 1565095299 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3056 | 129 | import math
n = int(input())
k = int(input())
xs = [int(input()) for i in range(n)]
print(2*sum([min([x, k - x]) for x in xs])) |
s350092620 | p03598 | u537234062 | 1565095052 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 115 | import math
n = int(input())
k = int(input())
xs = [int(input()) for i in range(n)]
print(2*sum(min([x, k - x]))) |
s476136639 | p03598 | u626337957 | 1564547101 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 147 | N = int(input())
K = int(input())
ans = 0
for _ in range(N):
x = int(input())
if K >= 2*x:
ans += x*2
else:
ans += (K-x)*2
print(ans) |
s208328348 | p03598 | u324549724 | 1563925732 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 126 | n, k = int(input()), int(input())
a = map(int, input().split())
sum = 0
for x in a :
sum += min(a, abs(k-a)) * 2
print(sum)
|
s424208580 | p03598 | u862296914 | 1562093027 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 128 | N = int(input())
K = int(input())
X = [int(x) for x in input().split()]
total = sum([min(2*x, (K-x)*2) for x in X]
print(total) |
s119958806 | p03598 | u663014688 | 1561235305 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 260 | N = int(input())
K = int(input())
l = [int(input()) for i in range(N)]
zero_kyori = 0
K_kyori = 0
kyori_list = []
for i in range(N):
zero_kyori = l[i] - 0
K_kyori = abs(l[i] - 0)
kyori_list.append(min(zero_kyori, K_kyori))
print(sum(kyori_list))
|
s277527383 | p03598 | u902151549 | 1560543222 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3312 | 228 | # coding: utf-8
import time
import re
import math
def main():
n=int(input())
k=int(input())
X=map(int,input().split())
total=0
for a in X:
total+=min([a,math.abs(k-a)])*2
print(int(total))
main() |
s622402537 | p03598 | u829249049 | 1559361572 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 157 | N=int(input())
K=int(input())
list1=list(input())
SUM=0
for i in range(N):
x=int(list1[i])
if x>K-x:
SUM+=2*(K-x)
else:
SUM+=2*x
print(SUM) |
s787068772 | p03598 | u844005364 | 1559068949 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 87 | input()
print(2 * sum(min(x, int(input())-x) for x in list(map(int, input().split())))) |
s957730788 | p03598 | u220345792 | 1558141436 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 126 | N = int(input())
K = int(input())
cnt = 0
for i in range(N):
tmp = int(input())
cnt += min(abs(K-tmp), (tmp))*2
print(cnt) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.