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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s627032642 | p03862 | u282978698 | 1586487142 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2107 | 63984 | 242 | X = [int(e) for e in input().split()]
A = [int(f) for f in input().split()]
i=0
ans=0
while i<X[0]:
if(A[i] + A[i+1]) <= X[1] and i+1 < X[0]:
i+=1
else:
A[i+1] -= 1
ans += 1
continue
i+=1
print(ans) |
s167422798 | p03862 | u757030836 | 1586194073 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 135 | A=list(map(int,input().split())) +[0]
ans =0
for i in range(N):
eated =max(0,A[i]+A[i-1]-x)
ans +=eated
A[i]-=eated
print(ans) |
s774918901 | p03862 | u787449825 | 1586068561 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 235 | N, x = map(int, input().split())
a = list(map(int, inout().split()))
count = 0
for i in range(N-1):
while a[i]+a[i+1]>x:
if a[i]>a[i+1]:
a[i] -= 1
count += 1
else:
a[i+1] -= 1
count += 1
print(count) |
s772831070 | p03862 | u787449825 | 1586068339 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 262 | N, x = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(N-1):
while a[i]+a[i+1] > x:
if a[i]>a[i+1]:
a[i] -= 1
count += 1
else:
a[i+1] -= 1
count += 1
print(count) |
s169802023 | p03862 | u395816772 | 1585778185 | Python | Python (3.4.3) | py | Runtime Error | 130 | 13380 | 246 | n,x = map(int,input().split())
a = list(input().split())
ans = 0
if int(a[0]) > x:
ans += a[0]-x
a[0] = x
for i in range(n-1):
c = int(a[i+1]) + int(a[i])
if c > x:
ans += c-x
a[i+1] = int(a[i+1])-(c-x)
print(ans) |
s059983844 | p03862 | u750838232 | 1585250307 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 134 | A=list(map(int,input().split()))+[0]
ans=0
for i in range(N):
eated=max(0,A[i]+A[i-1]-x)
ans+=eated
A[i]-=eated
print(ans) |
s633798349 | p03862 | u934868410 | 1584019835 | Python | Python (3.4.3) | py | Runtime Error | 137 | 14132 | 246 | n,x = map(int,input().split())
a = list(map(int,input().split()))
b = [a[i] + a[i+1] for i in range(n-1)]
ans = max(0, a[0] - x)
b[0] -= ans
for i in range(n-1):
diff = max(0, b[i] - x)
ans += diff
b[i] -= diff
b[i+1] -= diff
print(ans) |
s651555981 | p03862 | u620157187 | 1582750786 | Python | Python (3.4.3) | py | Runtime Error | 137 | 14052 | 332 | N, x = map(int, input().split())
a = list(map(int, input().split()))
total = 0
for i in range(len(a)):
if (a[i+1]+a[i])>=x:
if (a[i+1]-(x-a[i]))>=0:
a[i+1] = a[i+1]-(x-a[i])
total += x-a[i]
else:
a[i+1] = 0
total += x-a[i]
else:
pass
... |
s734018865 | p03862 | u408375121 | 1582227320 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14132 | 237 | N, x = map(int, input().split())
A = list(map(int, input().split()))
s = 0
for i in range(N - 1):
s = A[i] + A[i + 1] - x
ans += max(0, s)
if s > 0:
if s <= A[i + 1]:
A[i + 1] -= s
else:
A[i + 1] = 0
print(ans)
|
s628614656 | p03862 | u408375121 | 1582227205 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14132 | 230 | N, x = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N - 1):
s = A[i] + A[i + 1] - x
ans += max(0, s)
if s > 0:
if s <= A[i + 1]:
A[i + 1] -= s
else:
A[i + 1] = 0
print(ans) |
s909757257 | p03862 | u414458988 | 1581989151 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 134 | A=list(map(int,input().split()))+[0]
ans=0
for i in range(N):
eated=max(0,A[i]+A[i-1]-x)
ans+=eated
A[i]-=eated
print(ans) |
s524967120 | p03862 | u676029460 | 1581771637 | Python | Python (3.4.3) | py | Runtime Error | 26 | 11268 | 177 | n,x =map(int,input().split())
a=[map(int,input().split())]
ans=0
for i in range(n-1):
if(a[i]+a[i+1]>x):
p = a[i]+a[i+1]-x
ans+=p
a[i+1]=max(0,a[i+1]-p)
print(ans) |
s460255228 | p03862 | u711245972 | 1580529128 | Python | Python (3.4.3) | py | Runtime Error | 51 | 14068 | 224 | n,x=map(int,input().split())
a=list(map(int,input().split()))
eat=0
if a[0]>x:
eat+=(a[0]-x)
a[0]=x
for i in range(1,n-1):
if a[i-1]+a[i]>x:
f=(a[i-1]+a[i]-x)
eat+=f
a[i]=a[i-f]
print(eat) |
s698619604 | p03862 | u171065106 | 1577967333 | Python | Python (3.4.3) | py | Runtime Error | 163 | 14844 | 538 | n, x = map(int, input().split())
candies = list(map(int, input().split()))
count = 0
for i in range(n):
if candies[i] > x:
count += candies[i] - x
candies[i] = x
if i % 2 is not 0:
if candies[i-1] + candies[i] > x:
count += candies[i-1] + candies[i] - x
candies... |
s048642382 | p03862 | u867848444 | 1576811473 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 185 | a,b,x=map(int,input().split())
n=b-a+1
l=[0]*(n+1)
init=a
for i in range(1,n+1):
if init%x==0:
l[i]=l[i-1]+1
else:
l[i]=l[i-1]
init+=1
print(l[-1]-l[0]) |
s829281419 | p03862 | u261891508 | 1575239690 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 338 | n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
if a[i]+a[i+1]>x:ใ#xใไธๅใๆใฎใฟๆไฝใ่กใ
temp=a[i]+a[i+1]-x #ๆธใใใชใใใใใชใๅๆฐ
ans+=temp
if a[i+1]>=temp: #ๆธใใใฎใฏๅบๆฅใใ ใๅณๅด
a[i+1]-=temp
else:
a[i+1]=0
print(ans) |
s495948161 | p03862 | u457554982 | 1575002654 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 299 | import copy
[n,x]=list(map(int,input().split()))
a=list(map(int,input().split()))
a0=copy.copy(a)
ans=0
if a[0]+a[1]>x and a[0]>x:
a[0]-=a[0]-x
ans+=a0[0]-x
if a[0]+a[1]>x:
a[1]=0
ans+=a[1]
for i in range(1,n-1):
if a[i]+a[i+1]>x:
a[i+1]-=a[i]+a[i+1]-x
ans+=a[i]+a[i+1]-x
print(ans) |
s394841880 | p03862 | u457554982 | 1575002583 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 298 | import copy
[n,x]=list(map(int,input().split()))
a=list(map(int,input().split()))
a0=copy.copy(a)
ans=0
if a[0]+a[1]>x and a[0]>x:
a[0]-=a[0]-x
ans+=a[0]-x
if a[0]+a[1]>x:
a[1]=0
ans+=a[1]
for i in range(1,n-1):
if a[i]+a[i+1]>x:
a[i+1]-=a[i]+a[i+1]-x
ans+=a[i]+a[i+1]-x
print(ans) |
s501725986 | p03862 | u457554982 | 1575002556 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 298 | import copy
[n,x]=list(map(int,input().split()))
a=list(map(int,input().split()))
a0=copy.copy(a)
ans=0
if a[0]+a[1]>x and a[0]>x:
a[0]-=a[0]-x
and+=a[0]-x
if a[0]+a[1]>x:
a[1]=0
ans+=a[1]
for i in range(1,n-1):
if a[i]+a[i+1]>x:
a[i+1]-=a[i]+a[i+1]-x
ans+=a[i]+a[i+1]-x
print(ans) |
s320990321 | p03862 | u905582793 | 1574910906 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 145940 | 452 | N,x=map(int, input().split(' '))
a = list(map(int, input().split(' ')))
wa = [a[0]]+[a[i]+a[i+1] for i in range(N-1)]+[a[-1]]
ans = 0
for i in range(N):
print(i, a,wa,ans)
if wa[i] <= x:
continue
if a[i] >= x:
ans += wa[i]-x
a[i] -= wa[i]-x
wa[i] -= wa[i]-x
wa[i+1] -... |
s380478986 | p03862 | u580093517 | 1574710568 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 134 | A=list(map(int,input().split()))+[0]
ans=0
for i in range(N):
eated=max(0,A[i]+A[i-1]-x)
ans+=eated
A[i]-=eated
print(ans) |
s775375112 | p03862 | u518042385 | 1572935382 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14544 | 207 | n,m=map(int,input().split())
l=list(map(int,input().split()))
count=0
if l[i]>m:
count+=-m+l[i]
l[i]=m
for i in range(1,n):
if l[i-1]+l[i]>m:
count+=l[i]+l[i-1]-m
l[i]=m-l[i-1]
print(count)
|
s913393264 | p03862 | u518042385 | 1572935225 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14540 | 205 | n,m=map(int,input().split())
l=list(map(int,input().split()))
count=0
if l[i]>m:
count+=m-l[i]
l[i]=m
for i in range(1,n):
if l[i-1]+l[i]>m:
count+=l[i]+l[i-1]-m
l[i]=m-l[i-1]
print(count) |
s190773049 | p03862 | u623516423 | 1572654138 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 142948 | 268 | N,x = list(map(int,input().split()))
a=list(map(int,input().split()))
eat=0
if a[0]>x:
eat+=a[0]-x
a[0]=x
if a[N-1]>x:
eat+=a[N-1]-x
a[N-1]=x
for i in range(N-1):
print(eat,a)
if a[i]+a[i+1]>x:
eat+=a[i+1]-x+a[i]
a[i+1]=x-a[i]
print(eat) |
s565754846 | p03862 | u506858457 | 1572134873 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14252 | 176 | N,x=list(map(int,input().split()))
A=list(map(int,input().split()))
cnt=0
pre=0
for i in range(N):
dif=max(A[i]+pre-x,0)
cnt+=dif
arr[i]-=dif
pre=arr[i]
print(cnt) |
s357857788 | p03862 | u345710188 | 1570810274 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 249 | N,x = map(int,input().split())
a = list(map(int,input().split()))
i = 0
answer = 0
if a[0] > x:
answer = a[0] - x
a[0] = x
for i in range(N-1)
if a[i] + a[i+1] > x:
answer += a[i] + a[i+1] - x
a[i+1] = x - a[i]
print(answer)
|
s859205699 | p03862 | u148423304 | 1570805579 | Python | Python (3.4.3) | py | Runtime Error | 107 | 14132 | 270 | n, x = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(n - 2):
if a[i] + a[i + 1] > x:
count += a[i] + a[i + 1] - x
a[i + 1] = x - a[i]
if a[n - 1] + a[n] > x:
count += a[n - 1] + a[n] - x
print(int(count))
|
s416913682 | p03862 | u196697332 | 1569276736 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14060 | 263 | N, x = map(int, input().split())
A = list(map(int, input().split()))
answer = 0
if A[0] > X:
answer += A[0] - X
A[0] = X
for i in range(N-1):
diff = A[i] + A[i+1] - X
if diff > 0:
answer += diff
A[i+1] -= diff
print(answer)
|
s000919397 | p03862 | u314050667 | 1568295794 | Python | Python (3.4.3) | py | Runtime Error | 21 | 2940 | 161 | N,A=map(int,input().split())
a=list(map(int,input().split())
cnt=0
for i in range(1,N):
tmp=max(0,(a[i-1]+a[i])-A)
cnt+=tmp
a[i]-=tmp
print(cnt) |
s587246507 | p03862 | u513900925 | 1567546672 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 229 | N,x = map(int,input().split())
a = [int(i) for i in input.split()]
ans = 0
if a[0] > x:
ans += (a[0]-x)
a[0] = x
for i in range(N-1):
if a[i] + a[i+1] > x:
ans += (a[i]+a[i+1]-x)
a[i+1] -= (a[i]+a[i+1]-x)
print(ans) |
s535777046 | p03862 | u380683328 | 1567305679 | Python | Python (3.4.3) | py | Runtime Error | 126 | 14588 | 398 | n, x = map(int, input().split())
a = list(map(int, input().split()))
c = 0
if x == 0:
print(sum(a))
if a[0] > x:
c += a[i] - (x-1)
a[i] = x - 1
else:
for i in range(n-1):
if a[i] + a[i+1] > x:
if a[i+1] >= a[i]:
c += (a[i+1] - (x - a[i]))
a[i+1] -= (a[i+1] - (x - a[i]))
else:
c += (a[i+1] - ... |
s385032413 | p03862 | u419636153 | 1567290710 | Python | Python (3.4.3) | py | Runtime Error | 130 | 14132 | 494 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 31 14:24:15 2019
@author: priya
"""
inp = input().split()
n = int(inp[0])
x = int(inp[1])
candies = [int(x) for x in input().split()]
op = 0
for i in range(1,len(candies)):
if candies[i-1] + candies[i] > x:
eat = candies[i-1] + candies[i] - x
if(eat ... |
s818017486 | p03862 | u473016486 | 1567289645 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 22912 | 3075 | #!/usr/bin/env python
# coding: utf-8
# In[30]:
"""
There are N boxes arranged in a row. Initially, the
i
-th box from the left contains
a
i
candies.
Snuke can perform the following operation any number of times:
Choose a box containing at least one candy, and eat one of the candies in the chosen box.
His objec... |
s279651698 | p03862 | u418466780 | 1566963834 | Python | Python (3.4.3) | py | Runtime Error | 87 | 14132 | 663 |
def computeMinimumNoOfOperations(candies, x):
noOfOperations = 0
for i in range(len(candies) - 1):
if (candies[i] > x):
candiesTocandiesToEat = candies[i] - x
candies[i] -= candiesTocandiesToEat
noOfOperations += candiesToEat
if (candies[i] + candies[i + 1] > x):
... |
s552727604 | p03862 | u418466780 | 1566962416 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 671 |
def computeMinimumNoOfOperations(candies, x):
noOfOperations = 0
for i in range(0, len(candies) - 1):
if (candies[i] > x):
eat = candies[i] - x
candies[i] -= eat
noOfOperations += eat
if (candies[i] + candies[i + 1] > x):
if (candies[i] > candies[i + 1]):
eat = candies[i] -... |
s079140158 | p03862 | u594956556 | 1566959397 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 84 | s=input()
n=len(s)
if s[0]==s[-1] ^ n%2==0:
print('Second')
else:
print('First') |
s502059648 | p03862 | u993178579 | 1566941284 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 605 | def minimumNumOfCandies(candies,atmostValue):
candiesToEat = 0
for i in range( 0 , len ( candies ) - 1 ) :
if( candies[i] > atmostValue ) :
candiesToEat = candiesToEat + ( candies[i] - atmostValue)
candies[i] = candies[i] - ( candies[i] - atmostValue )
if( candies[i] + candies[i + 1] > atmostVal... |
s165173367 | p03862 | u214171427 | 1566880392 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 564 | def minCandies(boxes,limit):
out = 0
for i in range(len(boxes) - 1):
total = boxes[i] + boxes[i + 1]
if total > limit:
out += total - limit
boxes[i + 1] = boxes[i + 1] - (total - limit)
if boxes[i + 1] < 0:
boxes[i + 1] = 0
return out
... |
s311443988 | p03862 | u191874006 | 1563135164 | Python | PyPy3 (2.4.0) | py | Runtime Error | 220 | 63856 | 377 | #!/usr/bin/env python3
#ABC48 C
n,x = map(int,input().split())
a = list(map(int,input().split()))
b = a.copy()
if a[0] > x:
b[0] = x
for i in range(n-1):
if b[i] + b[i+1] > x:
b[i+1] -= (b[i]+b[i+1] - x)
if b[i+1] < 0:
b[i] -= abs(b[i+1])
b[i+1] += abs(b[i+1])
ans = 0
f... |
s321701488 | p03862 | u172111219 | 1560911447 | Python | PyPy3 (2.4.0) | py | Runtime Error | 176 | 38384 | 333 | n,x = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
for i in range(1,n):
if a[i-1]+a[i]<=x:
pass
else:
if (a[i]+a[i-1])-x > a[i]
a[i] = 0
cnt += (a[i]+a[i-1])-x
else:
cnt += (a[i]+a[i-1])-x
a[i]-= (a[i]+a[i-1])-x... |
s604871161 | p03862 | u687044304 | 1560521430 | Python | Python (3.4.3) | py | Runtime Error | 74 | 14272 | 1022 | # -*- coding:utf-8 -*-
"""่ใๆน
i: 0 1 2 3 4
------------------
A[i]: 100 2 100 2 100
iใๅฅๆฐใฎใจใใฎA[i]ใใพใๆธใใๆฆ็ฅใๆๅนใ
ใใฎๅพใใพใ ๆกไปถใๆบใใใชใใชใใiใๅถๆฐใฎใจใใฎA[i]ใๆธใใใ
"""
def solve():
N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(1, N, 2):
# iใๅฅๆฐใฎใจใ... |
s861716183 | p03862 | u163320134 | 1558462176 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 288 | n,k=map(int,input())
arr=list(map(int,input().split()))
ans=0
for i in range(1,n):
if arr[i]+arr[i-1]<=k:
continue
elif arr[i-1]<=k<arr[i]+arr[i-1]:
ans+=arr[i]+arr[i-1]-k
arr[i]=k-arr[i-1]
else:
ans+=arr[i]
arr[i]=0
ans+=arr[i-1]-k
arr[i-1]=k
print(ans) |
s054444382 | p03862 | u804358525 | 1555698022 | Python | Python (3.4.3) | py | Runtime Error | 121 | 14400 | 656 |
N,x = map(int, input().split())
candy_list = list(map(int, input().split()))
count_candy_eat = 0
if(candy_list[-1] == 0):
for i in (reversed(N)):
if (i == N):
continue
else:
if (candy_list[i] + candy_list[i-1] > x):
count_candy_eat += candy_list[i] + candy... |
s268669224 | p03862 | u175034939 | 1554695070 | Python | Python (3.4.3) | py | Runtime Error | 148 | 14096 | 621 | n, x = map(int,input().split())
a = list(map(int,input().split()))
mina = min(a)
b = x - mina
a2 = []
a3 = []
for i in range(n):
if i % 2 == 0:
a2.append(mina)
a3.append(b)
else:
a2.append(b)
a3.append(mina)
cnt2 = 0
cnt3 = 0
for i in range(n):
if a[i] >= a2[i]:
cnt... |
s160911512 | p03862 | u941753895 | 1549229986 | Python | Python (3.4.3) | py | Runtime Error | 1325 | 142528 | 311 | n,x=map(int,input().split())
l=list(map(int,input().split()))
c=0
if x==9:
exit()
for i in range(n-1):
a=l[i]
b=l[i+1]
if a+b>x:
c+=a+b-x
if b>=a-x and a>=x:
l[i+1]-=a+b-x
print('ๅฆ็A')
else:
l[i+1]=0
l[i]-=x-b
print('ๅฆ็B')
print(l)
print(l)
print(c) |
s459351258 | p03862 | u807772568 | 1534952315 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14540 | 261 | f,g = list(map(int,input().split()))
a = list(map(int,input().split()))
c = 1
p = 0
if a[0] > g:
c += a[0] - g
a[0] = g
while p <= f-1:
if a[p-1] + a[p] > x:
eat = a[p-1] + a[p] - x
c += eat
a[p] -= eat
p += 1
print(c)
|
s734190496 | p03862 | u807772568 | 1534952260 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 261 | f,g = list(map(int,input().split()))
a = list(map(int,input().split()))
c = 1
p = 0
if a[0] > g:
c += a[0] - g
a[0] = g
while p <= f-1:
if a[p-1] + a[p] > x:
eat = a[p-1] + a[p] - x:
c += eat
a[p] -= eat
p += 1
print(c) |
s954093336 | p03862 | u807772568 | 1534952223 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 261 | f,g = list(map(int,input().split()))
a = list(map(int,input().split()))
c = 0
p = 0
if a[0] > g:
c += a[0] - g
a[0] = g
while p <= f-1:
if a[p-1] + a[p] > x:
eat = a[p-1] + a[p] - x:
c += eat
a[p] -= eat
p += 1
print(c) |
s553916337 | p03862 | u807772568 | 1534952143 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 259 | f,g = list(map(int,input().split()))
a = list(map(int,input().split()))
c = 0
p = 0
if a[0] > g:
c += a[0] - g
a[0] = g
while p <= f-1:
if a[p-1] + a[p] > x:
eat = a[p-1] + a[p] - x:
c += eat
a[p] -= e
p += 1
print(c) |
s899332923 | p03862 | u638902622 | 1527013977 | Python | Python (3.4.3) | py | Runtime Error | 1311 | 143228 | 709 | from sys import stdin
N, x = [int(x) for x in stdin.readline().rstrip().split()]
candys = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
# xใใๅคใๅ
ฅใฃใฆใใ็ฎฑใฎใญใฃใณใใฃใฏๅฟ
ใ้ฃในใๅฟ
่ฆใใใใ
for i in range(N):
if candys[i] > x:
num = candys[i] - x
candys[i] = x
count += num
print(candys)... |
s888558590 | p03862 | u503901534 | 1525597552 | Python | Python (3.4.3) | py | Runtime Error | 141 | 14468 | 491 | n,x = map(int,input().split())
a = list((map(int,input().split())))
b = [0]
for i in range(n):
b.append(a[i])
b.append(0)
count = 0
if b[1] > x:
counter = b[1] - x
b[1] = x
for i in range(n+1):
if b[i] + b[i+1] > x:
s = b[i] + b[i+1] - x
if b[i] - s > -1:
b[i] = b[i] -s... |
s537663419 | p03862 | u503901534 | 1524970300 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14252 | 287 | n,x = map(int,input().split())
a = list(map(int,input().split()))
s = a[0] + a[1]
s.append(0)
p = 0
if a[0] > x:
a[0] = x
p = a[0] - x
for i in range(0,n):
pp = a[i] + a[i + 1]
if pp > x:
a[i+1] = a[i+1] - pp + x
p = p + pp -x
print(p)
|
s137391348 | p03862 | u057586044 | 1504925538 | Python | Python (3.4.3) | py | Runtime Error | 27 | 11192 | 194 | N,x=map(int,input().split())
S = map(int,input().split())
pre,ans = 0,0
for i in range(N):
tmp = pre+S[i]
if tmp > x:
ans += tmp-x
S[i] -= tmp-x
pre = S[i]
print(ans) |
s719947616 | p03862 | u697695018 | 1481510211 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 140 | counter = 0
for i in range(0, len(candies)-1):
counter += candies[i+1] + candies[i] - x
candies[i+1] = x - candies[i]
print counter |
s539139866 | p03862 | u580920947 | 1480957470 | Python | Python (3.4.3) | py | Runtime Error | 114 | 14152 | 349 | # problem C
N, x = map(int, input().split())
num_list = [int(x) for x in input().split()]
if x < num_list[0]:
count = n - num_list[0]
num_list[0] = x
else:
count = 0
for i in range(N-1):
n = num_list[i] + num_list[i+1]
if x < n:
num_list[i+1] = x - num_list[i]
count += n - x
el... |
s488787151 | p03862 | u054111484 | 1480909339 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 304 | t=raw_input().split(" ")
N=t[0]
x=t[1]
a=raw_input().split(" ")
c=0
i=0
ans=0
while 1:
if a[i]+a[i+1]<=x:
i=i+1
continue
else:
while a[i]+a[i+1]>x:
a[i+1]=a[i+1]-1
ans=ans+1
if a[i+1]==0:
i=i+1
if i+2==N:
break
print ans |
s618120619 | p03863 | u034128150 | 1600874102 | Python | PyPy3 (7.3.0) | py | Runtime Error | 101 | 74672 | 668 | from functools import lru_cache
@lru_cache
def grundy(s):
if len(s) == 2:
return 0
gs = set()
for i in range(1, len(s) - 1):
if s[i - 1] == s[i + 1]:
continue
gs.add(grundy(s[:i] + s[i + 1:]))
for i in range(100):
if i not in gs:
return not (i == ... |
s026365941 | p03863 | u102445737 | 1596679194 | Python | PyPy3 (7.3.0) | py | Runtime Error | 83 | 74592 | 446 | #from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353
def ddprint(x):
if D... |
s094619806 | p03863 | u102445737 | 1596679115 | Python | PyPy3 (7.3.0) | py | Runtime Error | 112 | 74524 | 446 | #from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353
def ddprint(x):
if D... |
s580695920 | p03863 | u798316285 | 1594789505 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9040 | 182 | s=input()
l=len(s)
if s[0]==s[-1]:
if l%2=1:
print("First")
else:
print("Second")
else:
if l%2=0:
print("First")
else:
print("Second") |
s952496014 | p03863 | u826189900 | 1593541589 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8932 | 676 | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x... |
s431881037 | p03863 | u835534360 | 1591359998 | Python | Python (3.4.3) | py | Runtime Error | 1599 | 4084 | 374 | import sys
def main():
s=list(sys.stdin.readline().strip())
n,t=len(s),0
while len(s)>2:
f=False
for i in range(1,n-1):
if s[i-1]!=s[i+1]:
s.pop(i)
f,t=True,t^1
break
if f is False:
break
print('First') if t=... |
s656950670 | p03863 | u935077683 | 1590872365 | Python | Python (3.4.3) | py | Runtime Error | 41 | 3828 | 463 | import re
from collections import Counter
s = input()
c = Counter(s)
if len(c) == 3 and min(c.values() == 1):
print("First")
elif len(s) % 2 == 1:
if all(s[i] == s[0] for i in range(0, len(s), 2)):
print("Second")
else:
print("First")
else:
if all(s[i] == s[0] for i in range(0, len(s), ... |
s105128987 | p03863 | u488934106 | 1585098886 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2110 | 49776 | 531 | def anordinarygame(s):
flag = True
count = 0
while flag:
for i in range(len(s)):
if len(s) != i and i != 0 and str(s[i-1]) != str(s[i+1]):
count += 1
s.pop(i)
continue
elif len(s) == i:
return "Second" if count ... |
s722731641 | p03863 | u478266845 | 1583486008 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3316 | 179 | s = str(input())
if s[-1] == s[0]:
if len(S)%2 == 0:
print("First")
else:
print("Second")
else:
if len(S)%2 == 1:
print("First")
else:
print("Second") |
s839606447 | p03863 | u298297089 | 1581292524 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3316 | 76 | s = input()
print('Second' if len(s) % 2 == 0 ^ s[0] != s[-1] else 'First')
|
s398247359 | p03863 | u047816928 | 1580490079 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3316 | 312 | # ๆๅญใ2็จฎ้กใซใชใใพใงๆธใ
# 2็จฎ้กใซใชใฃใใ็ตไบ
# ไธก็ซฏใฎๆๅญใ้ใใชใใใฎ2็จฎ้กใๆฎใโๅถๆฐๅๆฎใ
# ไธก็ซฏใฎๆๅญใๅใใชใใใฎๆๅญ+1็จฎโๅฅๆฐๅๆฎใ
s = input()
iseven = len(S)&1==0
issame = S[0]==S[-1]
print('First' if iseven^issame else 'Second') |
s986908402 | p03863 | u374099594 | 1580148239 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2692 | 62 | s=raw_input()
print "First"if len(s)%2^s[0]==s[-1]else"Second" |
s416417920 | p03863 | u476418095 | 1576804937 | Python | Python (3.4.3) | py | Runtime Error | 19 | 4084 | 204 | a = list(input())
if a[0] == a[-1]:
if len(a) % 2 == 1:
print('Second')
else:
print('First')
else:
if len(s) % 2 == 1:
print('First')
else:
print('Second') |
s630585624 | p03863 | u814986259 | 1574998344 | Python | Python (3.4.3) | py | Runtime Error | 265 | 3316 | 396 | s = input()
N = len(s)
turn = 0
ans = ["First", "Second"]
alphabet = "abcdefghijklmnopqrstuvwxyz"
memo = [0]*26
for i, x in enumerate(alphabet):
tmp = -1
for j, y in enumerate(s):
if y == x:
if tmp == -1:
tmp = j
else:
memo[i] = max(memo[j], j - tm... |
s393967984 | p03863 | u593590006 | 1571449317 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3316 | 135 | s=input()
if s==s[::-1]:
opt=n-3
if opt&1:
print('First')
else:
print('Second')
else:
print('First') |
s308128852 | p03863 | u588341295 | 1568570451 | Python | Python (3.4.3) | py | Runtime Error | 44 | 5856 | 1234 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in ra... |
s551125315 | p03863 | u653187094 | 1567567890 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1931 | #pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
// ๆฑ็จใใฏใญ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DS... |
s530418662 | p03863 | u892251744 | 1567523027 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 39420 | 190 | from collections import Counter
s = input()
ans = ['Second', 'First']
c = Counter(s)
flag = 0 if len(c) == 2 else 1
same = 1 if s[0] == s[-1] else 0
print(ans[(len(s) % 2 + same) * flag])
|
s232561515 | p03863 | u594956556 | 1566959431 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3316 | 84 | s=input()
n=len(s)
if s[0]==s[-1] ^ n%2==0:
print('Second')
else:
print('First') |
s347786271 | p03863 | u619458041 | 1555803930 | Python | Python (3.4.3) | py | Runtime Error | 40 | 4212 | 849 | import sys
def check(S):
even = set()
odd = set()
for i in range(len(S)):
if i % 2 == 0:
odd.add(S[i])
else:
even.add(S[i])
return len(even) == len(odd) == 1
def can_checkmate(S):
chrs = set(S)
if len(chrs) != 3:
return False
for c in chrs... |
s868443260 | p03863 | u171366497 | 1548611601 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11628 | 1531 | s=input()
def check(s):
if len(s)==2:return []
ans=[]
for i in range(2,len(s)):
if s[i-2]!=s[i]:ans.append(i-1)
return ans
def result(limit):
if limit%2==1:return 'Second'
if limit%2==0:return 'First'
def go(s,now,limit,past,prev):
if prev==0:branch[now]=check(s)
if branch[now... |
s339204667 | p03863 | u171366497 | 1548610792 | Python | Python (3.4.3) | py | Runtime Error | 2110 | 91676 | 1468 | s=input()
def check(s):
if len(s)==2:return []
ans=[]
for i in range(2,len(s)):
if s[i-2]!=s[i]:ans.append(i-1)
return ans
def result(limit):
if limit%2==1:return 'Second'
if limit%2==0:return 'First'
def go(s,now,limit,past,prev):
if prev==0:branch[now]=check(s)
if branch[now... |
s489712923 | p03863 | u690536347 | 1536326061 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3316 | 78 | s=input()
if len(s)%2==0^s[0]==s[-1]:
print("Second")
else:
print("First") |
s512639727 | p03863 | u136413513 | 1512334241 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 5560 | 272 | l = list(input())
i = 0
turn = 0
while True:
if len(l) == 2:
break
while i + 2 < len(l) and l[i] != l[i + 2]:
i += 1
if i + 2 == len(l):
break
l = [l[i]] + l[i + 2:]
turn += 1
ans = ['First', 'Second']
print(ans[turn % 2])
|
s339888317 | p03863 | u136413513 | 1512334207 | Python | Python (3.4.3) | py | Runtime Error | 1904 | 137312 | 299 | l = list(input())
i = 0
turn = 0
while True:
if len(l) == 2:
break
while i + 2 < len(l) and l[i] != l[i + 2]:
i += 1
if i + 2 == len(l):
break
print(l[i], l[i + 2:])
l = [l[i]] + l[i + 2:]
turn += 1
ans = ['First', 'Second']
print(ans[turn % 2])
|
s224556797 | p03863 | u697695018 | 1481862648 | Python | Python (2.7.6) | py | Runtime Error | 38 | 5892 | 364 | s = raw_input()
i = 0
counter = 0
flag = True
while(True):
if flag == False:
break
if len(s) == 2:
break
for i in range(len(s)-2):
if s[i] != s[i+2]:
s = s[:x] + s[x+1:]
counter += 1
flag = True
break
else:
flag = F... |
s971197754 | p03863 | u697695018 | 1481862507 | Python | Python (2.7.6) | py | Runtime Error | 38 | 5892 | 368 | s = raw_input()
i = 0
counter = 0
flag = True
while(True):
if flag == False or len(s) == 2:
break
for i in range(len(s)-2):
if s[i] != s[i+2]:
s = s[:x] + s[x+1:]
counter += 1
flag = True
break
else:
flag = False
if counter % 2 ... |
s225821050 | p03863 | u697695018 | 1481862050 | Python | Python (2.7.6) | py | Runtime Error | 39 | 5892 | 390 | s = raw_input()
i = 0
counter = 0
flag = True
while(True):
if flag == False or len(s) == 2:
break
for i in range(len(s)-2):
if s[i] != s[i+2]:
s = s[:x] + s[x+1:]
# print s
counter += 1
flag = True
break
else:
flag =... |
s163430192 | p03863 | u113430839 | 1481237648 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3316 | 123 | s=input();l = len;p = print
if (s[0]==s[-1] * l(s)%2==0) + (s[0]!=s[-1] * l(s)%2==1):
p("First")
else:
p("Second")
|
s059451249 | p03863 | u261935209 | 1481235799 | Python | Python (3.4.3) | py | Runtime Error | 385 | 5224 | 266 | import random
def main():
s = list(input())
count = 0
while True:
idx = random.randint(0,len(s))
if s[idx] == s[idx+1] or s[idx] == s[idx-1]:
break
count += 1
if count%2==0:
print("First")
else:
print("Second")
if __name__ == '__main__':
main() |
s911736639 | p03863 | u429978706 | 1480981137 | Python | Python (2.7.6) | py | Runtime Error | 18 | 2692 | 224 | import sys
s = raw_input()
if s[0] == s[len(s)-1]:
if len(s) % 2 == 0:
return "First"
else:
return "Second"
else:
if len(s) % 2 == 0:
return "Second"
else:
return "First"
|
s606937906 | p03864 | u974792613 | 1600346765 | Python | PyPy3 (7.3.0) | py | Runtime Error | 98 | 74740 | 186 | n,x = map(int, input().split())
a = list(map(int, input().split())
before = sum(a)
for i in range(n-1):
while a[i] + a[i+1] > x:
a[i+1] -= 1
after = sum(a)
print(after - before) |
s869607403 | p03864 | u780475861 | 1589869261 | Python | Python (3.4.3) | py | Runtime Error | 57 | 14092 | 219 | import sys
n, x, *lst = map(int, sys.stdin.read().split())
re1 = 0
lst.append(0)
for i in range(n, 0, -1):
tmpsum = lst[i] + lst[i - 1]
if tmpsum > x:
res += tmpsum - x
lst[i - 1] -= tmpsum - x
print(res)
|
s726935571 | p03864 | u863370423 | 1571357489 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38256 | 1470 | /*
โโโ โโโโโโโ โโโโโโโ โโโ โโโ โโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโ โโโ โโโ โโโโโโโโโโโ
โโโโโโ โโโโโโโโโโโโ โโโ โโโ โโโโโโโโโโโ
โโ โโโโโโ โโโโโโโโโโโโโโโโ โโโ โโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโ โโโโโโโโโโโโโโโโโ
โโโโโโ โโโโโโโ โโโโโโ โโโโโ ... |
s895334497 | p03864 | u921773161 | 1565726979 | Python | Python (3.4.3) | py | Runtime Error | 869 | 14400 | 459 | N, x = map(int, input().split())
a = list(map(int, input().split()))
s = [0] * (N-1)
for i in range(N-1):
s[i] = a[i] + a[i+1]
ans = 0
for i in range(N-1):
if i != N-2:
while s[i] > x:
b = s[i]-x
s[i] -= min(b, a[i])
s[i+1] -= min(b,a[i])
ans += min(b,... |
s995088557 | p03864 | u921773161 | 1565726946 | Python | Python (3.4.3) | py | Runtime Error | 284 | 14812 | 469 | N, x = map(int, input().split())
a = list(map(int, input().split()))
s = [0] * (N-1)
for i in range(N-1):
s[i] = a[i] + a[i+1]
ans = 0
for i in range(N-1):
if i != N-2:
while s[i] > x:
b = s[i]-x
s[i] -= min(b, a[i+1])
s[i+1] -= min(b,a[i+1])
ans += mi... |
s759022616 | p03864 | u375616706 | 1559848949 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 1268 | from collections import defaultdict
import heapq
from math import sqrt
# -*- coding: utf-8 -*-
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def calc(b1, b2):
x1, y1, r1 = b1
x2, y2, r2 = b2
d = sqrt((x1-x2)**2+(y1-y2)**2)
return max(d-(r1+r2), 0)
... |
s717417168 | p03864 | u766684188 | 1559136711 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38256 | 857 | import sys
input=sys.stdin.readline
def dijkstra(s,n,Cost):
D=[float('inf')]*n
Visited=[False]*n
D[s]=0
while True:
v=-1
for i in range(n):
if (not Visited[i]) and v==-1:
v=i
elif (not Visited[i]) and D[i]<D[v]:
v=i
if v==-... |
s201571153 | p03864 | u782654209 | 1554781058 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 374 | N,x=map(int,input().split(' '))
A=list(map(int,input().split(' ')))
B=[a for a in A]
if N==2:
print(A[0]+A[1]-x)
else:
for i in range(N-3):
B[i+1] -= min(B[i+1], max(0,(B[i]+B[i+1]-x)))
B[i] -= max(B[i]-x, 0)
B[-2] -= min(B[-2], max(0, (B[-3]+B[-2]-x), (B[-1]+B[-2]-x)))
B[-3] -= max(0, (B[-3]-x))
B[-1] -= max(... |
s227891457 | p03864 | u782654209 | 1554780476 | Python | Python (3.4.3) | py | Runtime Error | 168 | 14592 | 355 | N,x=map(int,input().split(' '))
A=list(map(int,input().split(' ')))
B=[a for a in A]
if N==2:
print(A[0]+A[1]-x)
elif N>3:
for i in range(N-3):
B[i+1] -= min(B[i+1], max(0,(B[i]+B[i+1]-x)))
B[i] -= max(B[i]-x, 0)
B[-2] -= min(B[-2], max(0, (B[-3]+B[-2]-x), (B[-1]+B[-2]-x)))
B[-3] -= max(0, (B[-3]-x))
B[-1] -= max... |
s814641553 | p03864 | u782654209 | 1554780409 | Python | Python (3.4.3) | py | Runtime Error | 165 | 14468 | 351 | N,x=map(int,input().split(' '))
A=list(map(int,input().split(' ')))
B=[a for a in A]
if N==2:
print(A[0]+A[1]-x)
else:
for i in range(N-3):
B[i+1] -= min(B[i+1], max(0,(B[i]+B[i+1]-x)))
B[i] -= max(B[i]-x, 0)
B[-2] -= min(B[-2], max(0, (B[-3]+B[-2]-x), (B[-1]+B[-2]-x)))
B[-3] -= max(0, (B[-3]-x))
B[-1] -= max(0, ... |
s355010699 | p03864 | u543954314 | 1553541060 | Python | Python (3.4.3) | py | Runtime Error | 48 | 14052 | 268 | n,k = map(int, input().split())
l = list(map(int, input().split()))
tot = 0
for i in range(1,n):
if a[i-1] + a[i] > k:
c = min(a[i],k-(a[i]+a[i-1]))
tot += c
a[i] -= c
if a[i-1]+a[i] > k:
d = k-a[i-1]
tot += d
a[i-1] -= d
print(tot) |
s871259804 | p03864 | u595893956 | 1552271297 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 200 | n,x=map(int,input().split())
a=list(map(int,input().split()))
ret=0
if a[0]>x:
ret+=a[0]-x
a[0]-=x
for i in range(1:n):
if a[i]+a[i-1]>x:
ret+=a[i]+a[i-1]-x
a[i]=a[i]+a[i-1]-x
print(ret) |
s335493707 | p03864 | u284854859 | 1550654497 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1060 | def dijkstra(s):
#ๅง็นsใใๅ้ ็นใธใฎๆ็ญ่ท้ข
#n:้ ็นๆฐ,ใw:่พบใฎๆฐ, cost[u][v] : ่พบuvใฎใณในใ(ๅญๅจใใชใใจใใฏinf)
d = [float("inf")] * n
used = [False] * n
d[s] = 0
while True:
v = -1
#ใพใ ไฝฟใใใฆใชใ้ ็นใฎไธญใใๆๅฐใฎ่ท้ขใฎใใฎใๆขใ
for i in range(n):
if (not used[i]) and (v == -1):
v = i
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.