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
s117126895
p03861
u300637346
1557182409
Python
Python (3.4.3)
py
Runtime Error
17
2940
91
a,b,x=map(int,input().split()) if a == 0: print(b//x)+1 else: print(b//x-(a-1)//x)
s982188373
p03861
u300637346
1557181696
Python
Python (3.4.3)
py
Runtime Error
17
2940
95
a,b,x=map(int,input().split()) print((b-a)//x) if (b%x != 0 and %x != 0) else print((b-a)//x+1)
s606845305
p03861
u806855121
1557074712
Python
Python (3.4.3)
py
Runtime Error
17
2940
6
9 9 2
s725300447
p03861
u102461423
1556567422
Python
Python (3.4.3)
py
Runtime Error
17
2940
58
a,b,c = map(int,input()) ans = b//c - (a-1)//c print(ans)
s790108867
p03861
u585482323
1554159432
Python
PyPy3 (2.4.0)
py
Runtime Error
195
39792
1223
#!usr/bin/env python3 from collections import defaultdict from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS():return list(map(list, sys.stdin.readline().split())) def S(): return list(sys.stdin.readline())[:-1] def IR(n): l = [None for i in range(n)] for i in range(n):l[i] = I() return l def LIR(n): l = [None for i in range(n)] for i in range(n):l[i] = LI() return l def SR(n): l = [None for i in range(n)] for i in range(n):l[i] = S() return l def LSR(n): l = [None for i in range(n)] for i in range(n):l[i] = SR() return l mod = 1000000007 #A """ s = LS()[1] print("A"+s[0]+"C") """ #B a,b,x = LI() print(x//b-x//(a-1)) #C """ n,x = LI() a = LI() ans = 0 for i in range(n-1): if a[i]+a[i+1] > x: ans += a[i+1]+a[i]-x if x > a[i]: a[i+1] = x-a[i] else: a[i+1] = 0 a[i] = x print(ans) """ #D """ s = S() l = len(s) k = (s[0] == s[-1]) if (l%2)^k: print("First") else: print("Second") """ #E #F #G #H #I #J #K #L #M #N #O #P #Q #R #S #T
s887304723
p03861
u625811641
1554045227
Python
Python (3.4.3)
py
Runtime Error
18
2940
125
a,b,x = map(int,input().split()) def countAC(n): if n == -1: return 0 else: return (n // x+1) prin
s376088612
p03861
u811000506
1553029679
Python
Python (3.4.3)
py
Runtime Error
2104
2940
142
a, b, x = map(int,input().split()) tmp = a while True: if tmp % x == 0: break else: tmp += 1 print((b//tmp)-(a//tmp))
s809279542
p03861
u878138257
1552861182
Python
Python (2.7.6)
py
Runtime Error
13
2688
109
a,b,x = map(int, input().split()) c = int((a-1)/x) d = int(b/x) if a!=0: print(d-c) elif a==0: print(d)
s395432222
p03861
u878138257
1552859598
Python
Python (3.4.3)
py
Runtime Error
17
2940
121
a,b,x = map(int, input().split()) if a!=0: c = int((a-1)/x) d = int(b/x) if a!=0: print(d-c) elif a==0: print(d)
s425002071
p03861
u878138257
1552859522
Python
Python (3.4.3)
py
Runtime Error
19
2940
116
a,b,x = map(int, input().split()) if a!=0: c = int((a-1)/x) d = int(b/x) if a!=0: print(d-c) elif a==0: print(d)
s171633849
p03861
u379692329
1552793510
Python
Python (3.4.3)
py
Runtime Error
18
2940
121
def f(n): return(int(n/x)+1 if n >=0 else 0) a, b, x = list(map(int, input().split())) print(max(f(b)-f(a-1)),0)
s685626443
p03861
u933214067
1552772600
Python
Python (3.4.3)
py
Runtime Error
37
5104
808
from statistics import mean, median,variance,stdev import sys import math import fractions def j(a): if a==1: print("YES") else :print("NO") def ct(x,y): if (x>y):print("") elif (x<y): print("") else: print("") def ip(): return int(input()) #x = int(input()) #入力整数1つ #x,y = (int(i) for i in input().split()) #入力整数横2つ x,y,z = (int(i) for i in input().split()) #入力整数横3つ #a,b,c,k = (int(i) for i in input().split()) #入力整数横4つ #a = [int(i) for i in input().split()] #入力整数配列 #x = input() #入力文字列 #a = input().split() #入力文字配列 lower = (x//z)*z if lower < x: lower+=z high = (y//z)*z print((high - low)/z+1)
s775657353
p03861
u677393869
1552305804
Python
Python (3.4.3)
py
Runtime Error
2103
2940
88
a,b,x=map(int,input().split()) c=0 for i in range(a,b+1): if x%i==0: c+=1 print(a)
s080550749
p03861
u118019047
1550528175
Python
Python (3.4.3)
py
Runtime Error
18
2940
159
A,B,X = map(int,input().split()) mn = -(-A//X) mx = B//X if A == B : if A % X == 0: prnt(1) else: print(0) else: print(mx - mn + 1)
s244740914
p03861
u104689289
1549392991
Python
Python (3.4.3)
py
Runtime Error
18
2940
199
a = input().split() i = int(a[0]) d = int(a[1]) x = int(a[2]) rd = d / x ri = (i - 1) / x if (ri < 0): ri = -1 print(rd - ri)
s658465539
p03861
u104689289
1549392730
Python
Python (3.4.3)
py
Runtime Error
19
2940
169
a = input() a.split() i = int(a[0]) d = int(a[1]) x = int(a[2]) rd = d / x ri = (i - 1) / x if (ri < 0): ri = -1 print(rd - ri)
s742525249
p03861
u104689289
1549392518
Python
Python (3.4.3)
py
Runtime Error
18
2940
129
a = input() a.split() i = (int)a[0] d = (int)a[1] x = (int)a[2] rd = d / x ri = (i - 1) / x if (ri < 0): ri = -1 print(rd - ri)
s382724956
p03861
u354325208
1549392391
Python
Python (3.4.3)
py
Runtime Error
18
3060
116
s = input() s = s.split(" ") a = int(s[0]) b = int(s[1]) c = int(s[2]) res = b // x res -= ((a - 1) // x) print(res)
s965014860
p03861
u476418095
1549057032
Python
Python (3.4.3)
py
Runtime Error
18
2940
102
a, b, x = map(int, input().split()) b += x-1-(b % x) if a % x: a += x-(a % x) print(max(b-a+1, 0)
s997489129
p03861
u350997995
1548046082
Python
Python (3.4.3)
py
Runtime Error
18
2940
77
a,b,x = map(int,input().split) if a>0: a-=1 else: b+=1 print(b//x - a//x)
s499256149
p03861
u231647664
1547518008
Python
Python (3.4.3)
py
Runtime Error
17
2940
121
a, b, c = map(int, input().split()) modb = [] for n in range(a, b+1): if n % c = 0: modb.append(n) print(len(modb))
s415025306
p03861
u845427284
1546231775
Python
Python (3.4.3)
py
Runtime Error
19
3188
114
a, b, x = map(int, input()) count = 0 for i in range(a, b + 1): if i % x == 0: count += 1 print(count)
s755998234
p03861
u371467115
1545807715
Python
Python (3.4.3)
py
Runtime Error
18
2940
101
x,y,a=map(int,input().split()) s=0 for i in range[x:y]: if i%a==0: s+=1 print(s)
s261599358
p03861
u853900545
1545551858
Python
Python (3.4.3)
py
Runtime Error
18
2940
65
a,b,x=map(int,input().split()) B=b//x A=a//x print(B-A+not(a%x))
s999940922
p03861
u928784113
1544845314
Python
Python (3.4.3)
py
Runtime Error
17
2940
133
# -*- coding: utf-8 -*- a,b,x = map(int,input().split()) a = [] for i in range(a:b+1): if i % x == 0: a.append(1) print(sum(a))
s350005485
p03861
u880466014
1543530327
Python
Python (3.4.3)
py
Runtime Error
18
3060
267
a, b, x = map(int, input().split()) #aからbまでをliに格納 li = list(range(a, b+1)) ans = 0 #liの要素数だけfor文を回す for i in range(len(li)): #li[i]がxで割り切れる時 if li[i] % x == 0: #ansに1を追加 ans += 1 print(ans)
s572798697
p03861
u869728296
1542915124
Python
Python (3.4.3)
py
Runtime Error
17
2940
225
a, b, x = [int(x) for x in input().split()] print(b // x - a // x + (a % x == 0))a,b,x=map(int,input().strip().split(" ")) count=0 count_a=a//x count_b=b//x if(a%x==0): count_a-=-1 count=count_b-count_a print(count)
s401990178
p03861
u432805419
1541565122
Python
Python (3.4.3)
py
Runtime Error
17
2940
124
a,b,c = list(map(int,input().split())) count = 0 for i in range(b-a+1) if (a+i) % c == 0: count = count + 1 print(count)
s912700159
p03861
u920299620
1540953123
Python
Python (3.4.3)
py
Runtime Error
17
2940
110
a,b,x=map(int,input().split()) first=a-a%x+x if(first==a+x): first=a last=b-b%x print(last//x - first//x +1
s261456199
p03861
u123756661
1540770435
Python
Python (3.4.3)
py
Runtime Error
18
3188
180
#include<bits/stdc++.h> using namespace std; int main(){ long long a,b,x; scanf("%lld %lld %lld",&a,&b,&x); printf("%lld\n",(b/x)-(a/x)+(a%x==0?1:0)); return 0; }
s529044760
p03861
u052332717
1540137654
Python
Python (3.4.3)
py
Runtime Error
18
3064
363
count = 0 a = min(m,n) b = max(m,n) if a/x == int(a//x) and b/x == int(b//x): print(int(1 + b//x - a//x)) elif a/x == int(a//x) and b/x != int(b//x): print(int(int(b//x) - int(a//x) + 1)) elif a/x != int(a//x) and b/x == int(b//x): print(int(int(b//x) - int(a//x))) elif a/x != int(a//x) and b/x != int(b//x): print(int(int(b//x) - int(a//x)))
s790221627
p03861
u853900545
1539894166
Python
Python (3.4.3)
py
Runtime Error
17
2940
100
a,b,x = map(int,input().split()) c =0 for i in range(a,b+1): if i % x == 0: c +=1 print(c)
s773360488
p03861
u853900545
1539894100
Python
Python (3.4.3)
py
Runtime Error
17
2940
99
a,b,x = map(int,input().split()) c =0 for i in range(a,b+1): if i % x == 0: c +=1 print(c)
s982974686
p03861
u699994820
1534777688
Python
Python (3.4.3)
py
Runtime Error
17
3068
124
#1 x,y,z = map(int, input().split()) cnt = 0 for row in range(x,y+1) if row % z = 0 : cnt = cnt + 1 print(cnt)
s738833481
p03861
u451017206
1534380558
Python
Python (3.4.3)
py
Runtime Error
17
2940
57
a, b, x = map(int, input().split()) print(b//x - (a-1)//x
s969961757
p03861
u047535298
1532816274
Python
Python (3.4.3)
py
Runtime Error
17
2940
71
a, b, x = map(int, input().split()) print((b-a)//x+((a%x==0)or(b%x==0))
s340528250
p03861
u419686324
1532570663
Python
Python (3.4.3)
py
Runtime Error
19
3188
77
import re s = input() print("A%sC" % re.match('AtCoder (.).* Contest', s)[1])
s930120331
p03861
u004025573
1532545211
Python
Python (3.4.3)
py
Runtime Error
17
2940
199
a,b,c=map(int,input().split()) f=0 if b%c==0 and a%c==0: f+=1 if a==0 and b>0: f+=1 print(b//c-a//c+f)a,b,c=map(int,input().split()) f=0 if b%c==0 and a%c==0: f=1 print(b//c-a//c+f)
s563341482
p03861
u333945892
1532136002
Python
Python (3.4.3)
py
Runtime Error
17
2940
620
#include <iostream> #include <stdio.h> #include <string> #include <vector> #include <set> #include <cmath> #include <algorithm> #include <cstdio> #include <queue> #include <map> #include <limits> using namespace std; typedef long long ll; float inf = std::numeric_limits<float>::infinity(); /* 二次元配列の宣言 vector<vector<int>> tb; tb.resize(H); for (size_t i = 0; i < H; i++) { tb[i].resize(W); } */ /* A.resize(N); for (int i = 0; i < N; i++) {scanf("%d",&A[i]);} */ int main(void) { while (true) { ll a,b,x; cin >> a >> b >> x; cout << (b/x)-(a-1)/x << endl ; } return 0; }
s208659477
p03861
u411858517
1528984667
Python
Python (3.4.3)
py
Runtime Error
17
2940
145
a, b, x = map(int, input().split()) def f(n, x): if n >= 0: return int(n/x) + 1 else: return 0 print(f(b, x) - f(a, n))
s464136272
p03861
u411858517
1528984122
Python
Python (3.4.3)
py
Runtime Error
150
12424
170
import math import numpy a, b, x = map(uint64, input().split()) res = 0 res += math.floor((b-a)/x) if a%x == 0: res += 1 if b%x == 0: res += 1 print(res)
s257398538
p03861
u723721005
1527475783
Python
Python (3.4.3)
py
Runtime Error
17
2940
67
a , b , x= int(input()),int(input()),int(input()) print ((b - a)/x)
s721649011
p03861
u218843509
1524286592
Python
Python (3.4.3)
py
Runtime Error
17
2940
126
a, b, x = list(map(int, input().split())) ans = 0 for i in range(a, b + 1): if i % x == 0: ans += 1 print(ans)
s803705080
p03861
u766407523
1523411815
Python
Python (3.4.3)
py
Runtime Error
17
2940
57
a, b, x = map(init, input().split()) print(b//x-(a-1)//x)
s345470261
p03861
u027622859
1522357645
Python
Python (3.4.3)
py
Runtime Error
17
2940
23
1 1000000000000000000 3
s629590979
p03861
u051751608
1521748775
Python
Python (3.4.3)
py
Runtime Error
2104
2940
155
a, b, x = [int(i) for i in input().split()] for i in range(a, b+1): if i % x == 0: first_num = i break print(-(-(b - first_num) // x))
s450431777
p03861
u051751608
1521709308
Python
Python (3.4.3)
py
Runtime Error
2104
2940
155
a, b, x = [int(i) for i in input().split()] for i in range(a, b+1): if i % x == 0: first_num = i break print(-(-(b - first_num) // x))
s958000858
p03861
u750032608
1512332266
Python
Python (2.7.6)
py
Runtime Error
2104
2568
144
a, b, x = map(int, raw_input().split()) i = a count = 0 while i < b + 1: if x%i == 0: count = count + 1 i = i + 1 print count
s702918985
p03861
u750032608
1512332106
Python
Python (2.7.6)
py
Runtime Error
2104
2568
130
a, b, x = map(int, raw_input().split()) i = a count = 0 while i < b + 1: if x%i == 0: count = count + 1 print count
s295914448
p03861
u750032608
1512332037
Python
Python (2.7.6)
py
Runtime Error
10
2568
133
a, b, x = map(int, raw_input().split()) i = a count = 0 for i in i < b + 1: if x%i == 0: count = count + 1 print count
s514866045
p03861
u750032608
1512331999
Python
Python (2.7.6)
py
Runtime Error
11
2568
123
a, b, x = map(int, raw_input().split()) i = a count = 0 for i in i < b + 1: if x%i == 0: count++ print count
s618732734
p03861
u663710122
1506618602
Python
Python (3.4.3)
py
Runtime Error
18
2940
30
print('A' + input()[8] + 'C')
s549251491
p03861
u946386741
1496187318
Python
Python (3.4.3)
py
Runtime Error
18
2940
124
a, b, x = map(int, input().split()) def f(n): if n >= 0: return n//x+1 else: 0 print(f(b)-f(a-1))
s401123063
p03861
u425351967
1487374084
Python
Python (3.4.3)
py
Runtime Error
17
2940
125
a, b, x = [int(n) for n in input().split()] res = 0 for n in range(a, b + 1) if n % x == 0: res += 1 print(res)
s493869058
p03861
u886545507
1481465789
Python
Python (2.7.6)
py
Runtime Error
16
2696
99
ABC048B a,b,x=map(int,raw_input().split()) res=b/x if a!=0: res-=(a-1)/x else: res+=1 print res
s380800381
p03861
u697695018
1481425971
Python
Python (2.7.6)
py
Runtime Error
16
2568
97
a, b, x= raw_input().split() if a%3 == 0: print b//x - a//x +1 else: print b//x - a//x +1
s407442266
p03861
u012693733
1481188642
Python
Python (2.7.6)
py
Runtime Error
17
2568
125
a, b, x = map(int,raw_input().split()) cnt = 0 for i in range(a,b): if i % x = 0: cnt = cnt + 1 print int(cnt)
s542977944
p03861
u012693733
1481188341
Python
Python (2.7.6)
py
Runtime Error
18
2696
144
# -*- coding: utf-8 -*- a, b, x = map(int,raw_input().split()) cnt = 0 for i in range(a,b): if i % x = 0: cnt = cnt + 1 print cnt
s544103467
p03861
u012693733
1481187980
Python
Python (2.7.6)
py
Runtime Error
16
2568
133
# -*- coding: utf-8 -*- a, b, x = map(int,raw_input().split()) cnt = 0 for i in range(a,b): if i % x = 0: cnt = cnt + 1
s354013726
p03861
u697695018
1481176676
Python
Python (2.7.6)
py
Runtime Error
17
2568
98
a, b, x= raw_input().split() m = (b-a)//x if a%x == 0 or b%x == 0: print m+1 else: print m
s166742277
p03861
u697695018
1481176424
Python
Python (2.7.6)
py
Runtime Error
16
2568
94
a, b, x= raw_input().split() m = a//b if a%x == 0 or b%x == 0: print m+1 else: print m
s428202813
p03861
u922952729
1481085388
Python
Python (2.7.6)
py
Runtime Error
17
2696
151
n=input().split(" ") a=int(n[0]) b=int(n[1]) x=int(n[2]) if a%x!=0: a+=x-(a%x) b=b-(b%x) if b<a: print(0) else: print(long(((b-a)/x)+1))
s841071045
p03861
u113430839
1480977227
Python
Python (2.7.6)
py
Runtime Error
18
2692
120
a,b,c = map(int,raw_input().split()) i = 0 for n in range(a , b + 1): if n % c == 0: i = i + 1 print i
s925150392
p03861
u484516280
1480974829
Python
Python (3.4.3)
py
Runtime Error
24
3064
169
#coding: UTF-8 import math if __name__ == "__main__": a = int(input()) b = int(input()) x = int(input()) if a%x == 0: print((b-a)//x+1) else: print((b-a)//x)
s081106686
p03861
u502675893
1480912414
Python
Python (3.4.3)
py
Runtime Error
56
5716
205
from decimal import Decimal round=lambda x:(x*2+1)//2 a,b,c=[int(i) for i in input().split()] num1=round(Decimal(b)/Decimal(c)) if(a%c==0): num2=round(a/c)-1 else: num2=round(a/c) print(num1-num2)
s761516878
p03861
u009460507
1480909981
Python
Python (3.4.3)
py
Runtime Error
22
3068
135
a, b, x = map(int, input().split()) def count(num1, num2): return num1 // num2 c = count(b, x) d = count(a-1) ans = c-d print(ans)
s791104416
p03861
u227254381
1480909815
Python
Python (2.7.6)
py
Runtime Error
18
2568
170
import math as math nums = list(map(int, input().split())) a = int(nums[0]) b = int(nums[1]) x = int(nums[2]) x1 = (a-1) // x x2 = b // x ans = x2 - x1 print(ans)
s765900636
p03861
u258647915
1480908399
Python
Python (3.4.3)
py
Runtime Error
21
3064
177
a, b, x = map(int, input().split()) c = b // x d = (a-1) // x if a == 0 and b == 0: print(1) exit(1) elif a == 0 or b == 0: print(c + 1) exit(1) print(c - d)
s423034971
p03861
u520409849
1480906840
Python
Python (3.4.3)
py
Runtime Error
22
3064
255
#include <stdio.h> int main(void) { long long int a, b, x; long long int i, cnt = 0; scanf("%lld %lld %lld", &a, &b, &x); if (a == 1) cnt = b / x; else for (i = a; i <= b; i++) if (i % x == 0) cnt++; printf("%lld\n", cnt); return (0); }
s226192075
p03861
u368749019
1480904813
Python
Python (2.7.6)
py
Runtime Error
16
2696
194
a,b,c = map(int, input().split()) cnt = 0 if b > 10 ** 9: cnt = (b-a) / c print (cnt) else: for i in range(a,b+1): if i % c == 0: cnt += 1 print (cnt)
s551175044
p03861
u353311466
1480903926
Python
Python (2.7.6)
py
Runtime Error
16
2572
116
a,b,x = map(int, raw_input().split()); cnt = 0; for i in range(a,b+1): if(i%x == 0): cnt+=1; print(cnt);
s293056928
p03861
u948287304
1480903893
Python
Python (2.7.6)
py
Runtime Error
16
2696
122
a, b, x = [int(i) for i in raw_input().split()] c = 0 for i in range(a, b + 1): if i % x == 0: c += 1 print(c)
s321235747
p03861
u813098295
1480903495
Python
Python (2.7.6)
py
Runtime Error
17
2568
117
a, b, x = map(int, raw_input().split()) ans = 0 for i in range(a, b+1): if i % x == 0: ans += 1 print ans
s690551026
p03862
u074161135
1601216740
Python
Python (3.8.2)
py
Runtime Error
53
20044
243
a,b=map(int, input().split()) *c,=map(int, input().split()) ans=0 for i in range(a - 1): d=c[i]+c[i + 1] if d<= b: continue r = max(0, A[i + 1] - (d - b)) l = b - r ans += c[i] - l + c[i + 1] - r c[i + 1] = r print(ans)
s872621537
p03862
u492910842
1597555450
Python
PyPy3 (7.3.0)
py
Runtime Error
109
87016
318
n,x=map(int,input().split()) a=list(map(int,input().split())) dp=[0]*(n-1) ans=0 for i in range(n-1): dp[i]=a[i]+a[i+1] for j in range(n-2): if dp[j]>x: ans+=min(dp[j]-x,a[j+1]) dp[j+1]-=min(dp[j]-x,a[j+1]) dp[j]-=min(dp[j]-x,a[j+1]) if dp[n-2]>x: ans+=dp[n-2]-x if dp[0]>x: ans+=dp[p]-x print(ans)
s953348414
p03862
u074220993
1597032102
Python
Python (3.8.2)
py
Runtime Error
60
20420
323
import math N, x = map(int, input().split()) L = [int(x) for x in input().split()] ans = 0 for i in L[1:]: if L[i-1] + L[i] > x: if L[i-1] > x: ans += L[i-1] - x ans += L[i] L[i] = 0 else: ans += L[i] + L[i-1] - x L[i] = x - L[i-1] print(ans)
s688852572
p03862
u074220993
1597027873
Python
Python (3.8.2)
py
Runtime Error
27
9000
210
N, A = map(int, input().split()) n = 0 def pick(list, num): 4yu for i in range(N): x = int(input().split()) if x != A: L.append(int(input().split())-A) else: n += 1 L.sort()
s875331520
p03862
u081149041
1596726332
Python
Python (3.8.2)
py
Runtime Error
357
19432
502
def candy(): boxNum, x = [int(i) for i in input().split()] ain = input() alist = ain.split(' ') s = 0 for t in range(0, 10): for i in range(0, boxNum-1): if int(alist[i+1]) + int(alist[i]) > x: s = s + (int(alist[i+1]) + int(alist[i]) - x) alist[i+1] = x - int(alist[i]) if alist[i+1] < 0: alist[i] = alist[i] + alist[i+1] alist[i+1] = 0 print(s) candy()
s766130610
p03862
u081149041
1596722564
Python
Python (3.8.2)
py
Runtime Error
109
19484
447
def candy(): boxNum, x = [int(i) for i in input().split()] ain = input() alist = ain.split(' ') s = 0 for i in range(0, boxNum-1): if int(alist[i+1]) + int(alist[i]) > x: s = s + (int(alist[i+1]) + int(alist[i]) - x) alist[i+1] = x - int(alist[i]) if alist[i+1] < 0: alist[i] = alist[i] + alist[i+1] alist[i+1] = 0 print(s) candy()
s580853341
p03862
u648881683
1596647543
Python
Python (3.8.2)
py
Runtime Error
92
21284
668
import bisect, collections, copy, heapq, itertools, math, string, sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = float('inf') def I(): return int(input()) def F(): return float(input()) def SS(): return input() def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] def LF(): return [float(x) for x in input().split()] def LSS(): return input().split() def resolve(): N, x = LI() a = LI() s = [max(a[i] + a[i+1] - x, 0) for i in range(N - 1)] ans = sum([ss[i] for i in range(len(s)) if i % 2 == 0]) print(ans) if __name__ == '__main__': resolve()
s896852957
p03862
u578580291
1596601410
Python
Python (3.8.2)
py
Runtime Error
23
8924
742
def candy(): n = input().split() N = int(n[0]) x = int(n[1]) alist = [int(i) for i in input().split()] s = 0 for i in range(0, N - 1): c = alist[i] , d = alist[i + 1] if int( alist[i] + alist[i + 1] ) > x: if int( alist[i] ) >= x: alist[i] = x alist[i + 1] = 0 else : alist[i + 1] = x - a[i] s += c - alist[i] + d - alist[i + 1] /* if int(alist[i]) > x: s = s + int(alist[i+1]) alist[i+1] = 0 if int(alist[i+1]) + int(alist[i]) > x: s = s + (int(alist[i+1]) + int(alist[i]) - x) alist[i+1] = x - int(alist[i]) */ print(s) candy()
s521626003
p03862
u578580291
1596601043
Python
Python (3.8.2)
py
Runtime Error
28
8972
734
def candy(): boxNum, x = [int(i) for i in input().split()] ain = input() alist = ain.split(' ') s = 0 for i in range(0, boxNum-1): c = alist[i] , d = alist[i + 1] if int( alist[i] + alist[i + 1] ) > x: if int( alist[i] ) >= x: alist[i] = x alist[i + 1] = 0 else : alist[i + 1] = x - a[i] s += c - alist[i] + d - alist[i + 1] /* if int(alist[i]) > x: s = s + int(alist[i+1]) alist[i+1] = 0 if int(alist[i+1]) + int(alist[i]) > x: s = s + (int(alist[i+1]) + int(alist[i]) - x) alist[i+1] = x - int(alist[i]) */ print(s) candy()
s494630697
p03862
u081149041
1595464123
Python
Python (3.8.2)
py
Runtime Error
109
19188
447
def candy(): boxNum, x = [int(i) for i in input().split()] ain = input() alist = ain.split(' ') s = 0 for i in range(0, boxNum-1): if int(alist[i+1]) + int(alist[i]) > x: s = s + (int(alist[i+1]) + int(alist[i]) - x) alist[i+1] = x - int(alist[i]) if alist[i+1] < 0: alist[i] = alist[i] + alist[i+1] alist[i+1] = 0 print(s) candy()
s098188202
p03862
u081149041
1595453942
Python
Python (3.8.2)
py
Runtime Error
25
9136
248
def candy(): N = int(input()) x = int(input()) a = int(input().split) s = 0 for i in range(1, N-1): if (a[i] + a[i-1]) > x: s = s + (a[i] + a[i-1] - x) a[i] = x - a[i-1] print(s) candy()
s213042398
p03862
u968166680
1595323457
Python
Python (3.8.2)
py
Runtime Error
26
9144
369
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): a, b, x = map(int, readline().split()) if a == 0: ans = b // x + 1 else: ans = b // x - (a - 1) // x print(ans) return if __name__ == '__main__': main()
s872076855
p03862
u452337391
1594998745
Python
PyPy3 (7.3.0)
py
Runtime Error
101
74824
169
N = int(input()) A = list(map(int, input().split())) A_ind = [] for i in range(N): A_ind.append((A[i], i+1)) A_ind.sort(reverse=True) for _, i in A_ind: print(i)
s750046072
p03862
u514118270
1591492816
Python
Python (3.4.3)
py
Runtime Error
93
14052
258
N,x = map(int,input().split()) a = list(map(int,input().split())) ans = 0 for i in range(N-1): if a[i] > x: ans += a[i]-x a[i] = x if a[i] + a[i+1] > x: ans += a[i]+a[i+1]-x a[i+i] -= a[i]+a[i+1]-x print(ans)
s806229699
p03862
u344065503
1591488517
Python
PyPy3 (2.4.0)
py
Runtime Error
178
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)
s373180903
p03862
u629350026
1590866619
Python
Python (3.4.3)
py
Runtime Error
17
3064
160
n,x=map(int,input().split()) a=list(map(int,input().split())) ans=0 for i in range(1,n): temp=max(0,a[i]+a[i-1]-x): ans=ans+temp a[i]=a[i]-temp print(ans)
s348622403
p03862
u629350026
1590866282
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)
s665619324
p03862
u629350026
1590865860
Python
Python (3.4.3)
py
Runtime Error
127
14844
306
n,x=map(int,input().split()) a=list(map(int,input().split())) ans=0 count=0 for i in range(0,n-1): if a[i]+a[i+1]>x: ans=ans+a[i]+a[i+1]-x a[i+1]=a[i+1]-(a[i]+a[i+1]-x) for i in range(n-1,0,-1): if a[i]+a[i+1]>x: count=count+a[i]+a[i+1]-x a[i]=a[i]-(a[i]+a[i+1]-x) print(min(ans,count))
s611026342
p03862
u443736699
1590541813
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
63984
540
N,x = list(map(int, input().strip().split())) a = list(map(int, input().strip().split())) sum = [0] * (N-1) for i in range(N-1): sum[i] = a[i] + a[i+1] count = 0 if len(sum) == 1: print(sum[0] - x) exit() while max(sum) > x: max_index = sum.index(max(sum)) sum[max_index] += -1 if max_index == 0: sum[max_index+1] += -1 elif max_index == (N-1): sum[max_index-1] += -1 else: if sum[max_index-1] > sum[max_index+1]: sum[max_index-1] += -1 else: sum[max_index+1] += -1 count += 1 print(count)
s041618668
p03862
u443736699
1590541756
Python
Python (3.4.3)
py
Runtime Error
2104
14428
540
N,x = list(map(int, input().strip().split())) a = list(map(int, input().strip().split())) sum = [0] * (N-1) for i in range(N-1): sum[i] = a[i] + a[i+1] count = 0 if len(sum) == 1: print(sum[0] - x) exit() while max(sum) > x: max_index = sum.index(max(sum)) sum[max_index] += -1 if max_index == 0: sum[max_index+1] += -1 elif max_index == (N-1): sum[max_index-1] += -1 else: if sum[max_index-1] > sum[max_index+1]: sum[max_index-1] += -1 else: sum[max_index+1] += -1 count += 1 print(count)
s870177222
p03862
u443736699
1590541668
Python
Python (3.4.3)
py
Runtime Error
2104
14428
558
N,x = list(map(int, input().strip().split())) a = list(map(int, input().strip().split())) sum = [0] * (N-1) for i in range(N-1): sum[i] = a[i] + a[i+1] count = 0 if len(sum) == 1: print(sum[0] - x) exit() while max(sum) > x: max_index = sum.index(max(sum)) sum[max_index] += -1 if max_index == 0: sum[max_index+1] += -1 elif max_index == (N-1): sum[max_index-1] += -1 else: if sum[max_index-1] > sum[max_index+1]: sum[max_index-1] += -1 else: sum[max_index+1] += -1 count += 1 print(max(sum)) print(count)
s226606958
p03862
u513081876
1589654450
Python
Python (3.4.3)
py
Runtime Error
103
14152
255
N, x = map(int, input().split()) a = [int(i) for i in input().split()] ans = 0 if a[0] > x: ans += a[0] - x ans[0] = x for i in range(1, N): if a[i] + a[i - 1] > x: ans += a[i] - (x - a[i - 1]) a[i] = x - a[i - 1] print(ans)
s311804451
p03862
u103178403
1589502579
Python
Python (3.4.3)
py
Runtime Error
114
14540
200
n,x=map(int,input().split()) a=[int(i)for i in input().split()] c=0 if a[0]>x: c=a[0]-x a[0]=x for i in range(1,len(a)): if a[i]+a[i+1]>x: c+=a[i]+a[i+1]-x a[i+1]=x-a[i] print(c)
s140060740
p03862
u298633786
1588098092
Python
PyPy3 (2.4.0)
py
Runtime Error
242
64108
519
import sys import math # noqa import bisect # noqa import queue # noqa def input(): return sys.stdin.readline().rstrip() def main(): N, x = map(int, input().split()) A = list(map(int, input().split())) A_origin = A.copy() if A[0] > x: A[0] = x for i in range(0, N - 1): if A[i] + A[i + 1] > x: A[i + 1] -= A[i] + A[i + 1] - x res = 0 for i in range(N): res += abs(A_origin[i] - A[i]) print(res) if __name__ == '__main__': main()
s464275758
p03862
u614550445
1587926634
Python
Python (3.4.3)
py
Runtime Error
17
2940
1508
// abc048_c #include <bits/stdc++.h> #ifdef LOCAL #include "../cxx-prettyprint/prettyprint.hpp" #endif using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; #define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i)) #define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i)) #define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i)) #define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i)) #define ALL(x) x.begin(), x.end() #define INF ((1 << 29)-1) #define MOD (1000000007) #define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; } #define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;} template<class T> void print(const T& x){cout << x << endl;} template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); } struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain; int main() { #ifdef LOCAL ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf()); #endif ll N, x; cin >> N >> x; vector<ll> A(N); REP(i, N) cin >> A[i]; ll ans = 0; ll tmp = A[0]; REPN(i, 1, N){ ll sm = tmp + A[i]; ll diff = sm > x ? sm - x : 0; A[i] -= diff; ans += diff; if (A[i] < 0){ A[i] = 0; } tmp = A[i]; } print(ans); return 0; }
s382706078
p03862
u519923151
1587872506
Python
Python (3.4.3)
py
Runtime Error
119
14540
304
N,x= map(int, input().split()) Alist = list(map(int, input().split())) if Alist[0] >x: res = Alist[0]-x Alist[0] = x for i in range(0,N-1): if Alist[i] + Alist[i+1] > x: de = Alist[i+1] + Alist[i] - x Alist[i+1] = Alist[i+1] - de res = res + de print(res)
s844150638
p03862
u345966487
1587449894
Python
Python (3.4.3)
py
Runtime Error
42
14092
117
n,x,*a=map(int,open(0).read().split());r=0 for i in range(1,N):e=max(a[i]+a[i-1]-x,0);a[i]-=min(e,a[i]);r+=e print(r)