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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s041434638 | p03957 | u966695411 | 1477669845 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3192 | 847 | #! /usr/bin/env python3
def main():
d = 10 ** 9 + 7
ans = 1
N = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
L = len(T)
ST = [T[0]] + [0] * (L-2) + [T[-1] if T[-1] != T[-2] else 0]
SA = [A[0] if A[0] != A[1] else 0] + [0] * (L-2) + [A[-1]]
for... |
s046161952 | p03957 | u961867404 | 1477285697 | Python | PyPy3 (2.4.0) | py | Runtime Error | 201 | 38384 | 931 | H , W = map(int,input().split())
table = [input() for _ in range(H)]
def memo_rec(a,b,i,j, memo):
if a == H or b == H:
return 0
if memo[a][b] > -1:
return memo[a][b]
ret = 0
tmp = 0
memo[a][b] = min(memo_rec(a+1,b,i,j, memo= memo), memo_rec(a,b+1,i,j,memo=memo)) + cache[a][b]
# pr... |
s984369310 | p03957 | u502175663 | 1477281561 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 754 | k_t = input().split()
k = int(k_t[0])
t = int(k_t [1])
t_amount = input().split(' ')
while True:
if t == 1:
max = k
break
max = 0
for i in range(t-1):
if t_amount[i+1] >= t_amount [i]:
max = t_amount[i+1]
elif max == 0:
max = t_amount[0]
t_amount... |
s369934970 | p03957 | u813098295 | 1477281226 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 778 | N = int(raw_input())
T = map(int, raw_input().split())
A = map(int, raw_input().split())
ans = 1
mod = 10 ** 9 + 7
if T[N - 1] != A[0]:
print (0)
exit()
for i in xrange(N):
if i == 0 or i == N - 1:
continue
elif T[i] > T[i-1]:
if A[i] < T[i] and A[i] == A[i + 1]:
prin... |
s372618448 | p03957 | u436484848 | 1477277341 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 489 | def read():
return [int(i) for i in input().split(" ")]
N = int(input())
T = read()
A = read()
L = [0] * N
unknowL = [0] * N
tempT, tempA = 0, 0
for i in range(N):
if(T[i] > tempT):
tempT = L[i] = T[i]
else:
unknowL[i] = T[i]
for i in range(N-1, -1, -1):
if(A[i] > tempA):
if(L[i] != 0 and L[i] != A[i]):
pr... |
s564981442 | p03957 | u619384481 | 1477276304 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 173 | ini=raw_input()
a=list(ini)
check=0
if "C" in list and "F" in list:
if list.index("C")<list.index("F"):
check=1
if check==1:
print "Yes"
else:
print "No" |
s481740235 | p03957 | u664481257 | 1477276013 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3192 | 1778 | def read_input():
l_1 = input()
day = int(l_1.split(" ")[0])
num_cake = [int(i) for i in input().split(" ")]
return day, num_cake
def get_max_index(target_list):
return [i for i, j in enumerate(target_list) if j == max(target_list)]
def get_second_max_index(target_list):
return [i for i, j ... |
s377671973 | p03957 | u469202254 | 1477275698 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 273 | s = input()
first_letter = 'C'
second_letter = 'F'
found = False
for l in s:
if l == first_letter:
for l in s:
if l == second_letter:
print "Yes"
break
if found:
break
if not found:
print "No"
|
s893184611 | p03957 | u664481257 | 1477275528 | Python | Python (3.4.3) | py | Runtime Error | 282 | 8812 | 1560 | def read_input():
l_1 = input()
day = int(l_1.split(" ")[0])
num_cake = [int(i) for i in input().split(" ")]
return day, num_cake
def get_max_index(target_list):
return [i for i, j in enumerate(target_list) if j == max(target_list)]
def get_second_max_index(target_list):
return [i for i, j ... |
s442378596 | p03957 | u177721681 | 1477274936 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 233 | import sys
s = sys.stdin.readline().strip()
c_find = Fasle
f_find = False
for c in s:
if c_find:
if c == 'F':
print 'Yes'
exit(0)
else:
if c == 'C':
c_find = True
print 'No' |
s123257496 | p03957 | u867933941 | 1477274793 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2696 | 978 | N = input()
T = map(int,raw_input().split(" "))
A = map(int,raw_input().split(" "))
note = [1 for i in range(N)]
fx = [0 for i in range(N)]
def solve():
global note
if T[-1] != A[0]:
return 0
prev = 0
for i in range(N):
if prev > T[i]:
return 0
elif prev == ... |
s691312661 | p03957 | u657357805 | 1477274729 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 500 | import sys
n = int(input())
t = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
if t[n-1]!=a[0]:
print(0)
sys.exit()
m =[]
for i in range(n):
mx = min(t[i],a[i])
mn = 1
if i == 0:
mn = t[i]
elif i == n-1:
mn = a[i]
else :
if t[i]!=t[i-1]:
... |
s935122236 | p03957 | u024016758 | 1477273823 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2696 | 746 |
def getCakeRepeats(cakes):
front_iter = 0
back_iter = len(cakes) - 1
while back_iter > front_iter:
if cakes[back_iter] < cakes[front_iter]:
cakes[front_iter] -= cakes[back_iter]
cakes[back_iter] = 0
back_iter -= 1
elif cakes[back_iter] > cakes[front_iter... |
s766020342 | p03957 | u525261764 | 1477273608 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 232 | import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
flag = 0
for c in teststr:
print c
if ch1 == c:
flag = flag+1
if ch2 == c:
flag = flag+1
if flag >= 2:
print 'Yes'
else:
print 'No'
|
s251225789 | p03957 | u191667127 | 1477273479 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3192 | 375 | s = input().split()
size = []
for n in s:
size.append(int(n))
s2 = input().split()
ss = []
for n in s2:
ss.append(int(n))
if size[0] % 2 == 0:
k = size[0]/2
else:
k = (size[0] + 1) /2
l = 0
m = 3
for i in ss:
if i > k:
l+=1
while i > int((m-1) * size[0] / m) and m <= size[0]:
... |
s634536006 | p03957 | u525261764 | 1477273426 | Python | Python (2.7.6) | py | Runtime Error | 19 | 2696 | 92 | import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
flag = 0
if True:
print 'Yes' |
s292931070 | p03957 | u525261764 | 1477273376 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 104 | import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
flag = 0
if len(teststr):
print 'Yes' |
s633542145 | p03957 | u525261764 | 1477273030 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 243 | import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
flag = 0
for c in teststr:
if ch1 == c:
flag = flag+1
else:
flag = flag+1
if flag >= 2:
print 'Yes'
else:
print 'No' |
s451057182 | p03957 | u525261764 | 1477272851 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 211 | import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
flag = 0
for c in teststr:
if ch1 == c:
flag = flag+1
else:
flag = flag+1
if flag >= 2:
print 'Yes'
else:
print 'No' |
s214324791 | p03957 | u525261764 | 1477272789 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 202 | import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
for c in teststr:
if ch1 == c:
flag = flag+1
else:
flag = flag+1
if flag >= 2:
print 'Yes'
else:
print 'No' |
s998314950 | p03957 | u293703028 | 1477272547 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3068 | 151 | s = input()
if "C" in s and "F" in s:
a = s.lindex("C")
b = s.rindex("F")
if a < b:
print("Yes")
else:
print("No")
else:
print("No")
|
s620022336 | p03957 | u177721681 | 1477272504 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2696 | 743 | import sys
def range_union(al,ah,bl,bh):
cl = max(al,bl)
ch = min(ah,bh)
if cl > ch:
return 0
else:
return ch-cl +1
N = int(sys.stdin.readline())
T = map(int,sys.stdin.readline().strip().split())
A = map(int,sys.stdin.readline().strip().split())
p = 1
for i in xrange(1,N-1):
if T[i... |
s580134391 | p03957 | u227254381 | 1477272451 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 152 | str = raw_input()
c = False
for i in range(0, len(str)):
if str[i] == "C":
c = True
if str[i] == "F" and c == True:
print "Yes"
print "No" |
s013376858 | p03957 | u177721681 | 1477272414 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2696 | 744 | import sys
def range_union(al,ah,bl,bh):
cl = max(al,bl)
ch = min(ah,bh)
if cl > ch:
return 0
else:
return ch-cl +1
N = int(sys.stdin.readline())
T = map(int,sys.stdin.readline().strip().split())
A = map(int,sys.stdin.readline().strip().split())
p = 1
for i in xrange(1,N-1):
if T[i... |
s280032020 | p03957 | u227254381 | 1477272402 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 151 | str = raw_input()
c = False
for i in range(0, len(str)):
if str[i] == "c":
c = True
if str[i] == "f" and c == True:
print "YES"
print "NO" |
s196010226 | p03957 | u525261764 | 1477272365 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 312 | import os
import sys
def main(teststr):
ch1 = 'C'
ch2 = 'F'
for c in teststr:
if ch1 == c:
flag = flag+1
else:
flag = flag+1
if flag >= 2:
print 'Yes'
else:
print 'No'
if __name__=='__main__':
teststr = sys.argv[1]
main(teststr) |
s708237370 | p03957 | u227254381 | 1477272243 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 164 | str = raw_input()
c = False
f = False
for i in range(0, len(str)):
if str[i] == "c":
c = True
if str[i] == "f" and c == True:
return True
return False |
s160493982 | p03957 | u525261764 | 1477272051 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2568 | 293 | def main(teststr):
ch1 = 'C'
ch2 = 'F'
for c in teststr:
if ch1 == c:
flag = flag+1
else:
flag = flag+1
if flag >= 2:
print 'Yes'
else:
print 'No'
if __name__=='__main__':
teststr = sys.argv[1]
main(teststr)
|
s672962290 | p03957 | u901307908 | 1477271523 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 261 | s = input()
cl = []
fl = []
for i, c_test in zip(range(len(s)), s):
if c_test == 'C':
cl.append(i)
for i, f_test in zip(range(len(s)), s):
if f_test == 'F':
fl.append(i)
if max(fl) > min(cl):
print("Yes")
else:
print("No") |
s520057190 | p03957 | u227254381 | 1477271439 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 164 | str = raw_input()
c = false
f = false
for i in range(0, len(str)):
if str[i] == "c":
c = true
if str[i] == "f" and c == true:
return true
return false
|
s351238714 | p03957 | u227254381 | 1477271246 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3068 | 180 | str = raw_input()
is_c_found = false
is_f_found = false
for i in range(0, len(str)):
if str[i] == "c":
is_c_found = true
if str[i] == "f" and is_c_found:
return true
return false
|
s112875630 | p03957 | u114277042 | 1477271086 | Python | Python (2.7.6) | py | Runtime Error | 764 | 6260 | 192 | from random import random
import math
import re
import fractions
S = raw_input()
pc = S.index("C")
pf = S.rindex("F")
if pc > -1 and pf > -1 and pc < pf:
print "Yes"
else:
print "No"
|
s508269840 | p03957 | u406648710 | 1477271049 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2572 | 155 | s = raw_input()
flag = 0
for i in s:
if flag == 0 and i == 'C': flag = 1
elif: flag == 1 and i == 'F': flag = 2
print 'Yes' if flag == 2 else 'No' |
s316446539 | p03957 | u132291455 | 1477271016 | Python | Python (2.7.6) | py | Runtime Error | 15 | 2568 | 167 | import sys
s=raw_input()
flag=False
for j in range(s):
if s[j]=='C':
flag=True
if s[j]=='F' and flag:
print "Yes"
sys.exit()
print "No" |
s472647627 | p03958 | u162612857 | 1598068077 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9144 | 174 | k, t = list(map(int, input().split()))
nums = list(map(int, input().split()))
m = max(nums)
rest = k - m
if max - rest - 1 > 0:
print(max - rest - 1)
else:
print(0)
|
s207553329 | p03958 | u036104576 | 1597549611 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8740 | 134 | K, T = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
print(max(0, A[0] - 1 - sum(A[1:])) |
s088027586 | p03958 | u044220565 | 1597273671 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9016 | 1275 | # coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#... |
s352984650 | p03958 | u813174766 | 1593834841 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8936 | 89 | n,k=map(int,input().split())
a=list(map(int,input()split()))
s=max(a)
print(max(2*s-n-1)) |
s315498697 | p03958 | u026155812 | 1592511254 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 405 | import sys
import heapq
K, T = map(int, input().split())
m = [-int(i) for i in input().split()]
heapq.heapify(m)
if T == 1:
print(K-1)
sys.exit()
while len(m) > 0:
l = heapq.heappop(m)
if len(m) == 0:
heapq.heappush(m, l)
break
r = heapq.heappop(m)
if r+1 == 0:
continue... |
s813410950 | p03958 | u830054172 | 1590957237 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 151 | k, t = map(int, input().split())
a = list(map(int, input().split()))
ans = max(a)
for i in a:
if i != max(a):
ans -= i
print(max(0, ans)
|
s467706795 | p03958 | u830054172 | 1590957213 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 144 | k, t = map(int, input().split())
a = list(map(int, input().split()))
ans = max(a)
for i in a:
if i != max(a):
ans -= i
print(max(0, ans) |
s994591449 | p03958 | u979552932 | 1590855637 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3060 | 388 | from sys import stdin
def main():
import heapq
input = stdin.readline
input()
a = [-1 * int(i) for i in input().split()]
heapq.heapify(a)
while len(a) > 1:
u = heapq.heappop(a)
v = heapq.heappop(a)
if u + 1 < 0:
heapq.heappush(a, u + 1)
if v + 1 < 0:
... |
s737044807 | p03958 | u652656291 | 1589666194 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 105 | k,t = map(int,input().split())
A = list(map(int,input().split()))
at = max(A)
print(max(2*at−1−k,0))
|
s601115392 | p03958 | u652656291 | 1589665992 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 109 | k,t = map(int,input().split())
A = list(map(int,input().split()))
at = max(A)
print(max(at−1−(k−at),0)) |
s107180012 | p03958 | u408375121 | 1589548842 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 241 | k, t = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
double_cnt = 0
total = 0
for i in range(t):
b = a[i] - bouble_cnt
c = total - (bouble_cnt + 1) + 2
bouble_cnt = max(0, b-c)
total += a[i]
print(bouble_cnt) |
s934900261 | p03958 | u585482323 | 1587217336 | Python | PyPy3 (2.4.0) | py | Runtime Error | 244 | 46040 | 1124 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return... |
s704968605 | p03958 | u585482323 | 1587217277 | Python | PyPy3 (2.4.0) | py | Runtime Error | 252 | 46040 | 1062 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return... |
s615131655 | p03958 | u539517139 | 1583399995 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 123 | k,t=map(int,input().split())
l=[0]*t
a=list(map(int,input().split()))
for i in a:
l[i-1]+=1
print(max(0,max(l)-(k+1)//2)) |
s319356279 | p03958 | u898967808 | 1582410602 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 98 | k,t = map(int,input().split())
A = list(map(int,input().split()))
print(max(2*max(A) - sum(A) -1)) |
s047041362 | p03958 | u375616706 | 1581121028 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 272 | import heapq
K, T = map(int, input().split())
L = list(map(lambda x: -int(x), input().split()))
heapq.heapify(L)
while L and len(L) > 1:
a = heapq.heappop(L)
b = heapq.heappop(L)
r = b-a
if r > 0:
heapq.heappush(L, -r)
print(-heapq.heappop(L)-1)
|
s294192521 | p03958 | u608088992 | 1578148665 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 149 | K, T = map(int, input().split())
A = [int(a) for a in input().split()]
A.sort()
sumA = 0
for a in A[:N-1]: sumA += a
print(max(0, A[N-1] - 1 - sumA)) |
s146203457 | p03958 | u116233709 | 1575479024 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 152 | k,t=map(int,input().split())
a=[]
for i in range(t):
a.append(int(input()))
if max(a)*2-sum(a)-1<0:
print(0)
else:
print(max(a)*2-sum(a)-1) |
s878148473 | p03958 | u668503853 | 1570242962 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 94 | K,T=map(int,input().split())
A=list(map(int,input().split()))
M=max(A)
print(max(A-1-(K-A),0)) |
s549372261 | p03958 | u598229387 | 1568006809 | Python | Python (3.4.3) | py | Runtime Error | 34 | 3060 | 199 | k,t=map(int,input().split())
a=[int(i) for i in input().split()]
a=sorted(a,reverse=True)
while True:
if a[1]==0:
ans=max(a[0]-1,0)
break
a[0]-=1
a[1]-=1
a=sorted(a,reverse=True)
print(ans) |
s369043429 | p03958 | u814986259 | 1567040674 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 168 | K,T = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a,reverse = True)
ans = a.pop(0) - sum(a) - 1
if a >= 0:
print(ans)
else:
print(0) |
s753589406 | p03958 | u444349080 | 1565102894 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 450 | #include <iostream>
#include <math.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
using namespace std;
long long int maxi(long long int A, long long int B) {
return (A > B) ? A : B;
}
int main() {
int K, T, a, maxi = -1... |
s538787223 | p03958 | u572144347 | 1558069091 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3316 | 337 | K,T=map(int,input().split())
A=list(map(int,input().split()))
from heapq import heappush,heappop
from collections import deque
A.sort(reverse=True)
d=deque(A)
d2=deque(A)
ans=A[0]
mod=1
while d:
if len(d)==1:
print(d[0]-1)
a=d.pop()
b=d.popleft()
if not a==1:
d.append(a-1)
if not b==1:
d.appendle... |
s090733527 | p03958 | u572144347 | 1558068664 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 298 | K,T=map(int,input.split())
A=list(map(int,input().split()))
from heapq import heappush,heappop
from collections import deque
A.sort(reverse=True)
d=deque(A)
while d:
if len(d)==1:
print(d-1)
exit()
a=d.pop()
b=d.popleft()
if not a==1:
d.append(a-1)
d.appendleft(b-1)
|
s093641122 | p03958 | u123756661 | 1555567180 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 348 | k,t=map(int,input().split())
l=[int(i) for i in input().split()]
x=[int(i) for i in l]
nin=min(x)
nen=t
while 1:
w=[]
for i in x:
if i-nin!=0:
w.append(i-nin)
x=[i for i in w]
nin=min(x)
if len(x)==1:
print(x[0]-nin)
exit()
elif len(x)==0:
print(0)
... |
s414219710 | p03958 | u123756661 | 1555567045 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 295 | k,t=map(int,input().split())
l=[int(i) for i in input().split()]
x=[int(i) for i in l]
nin=min(x)
nen=t
while 1:
w=[]
for i in x:
if i-nin!=0:
w.append(i-nin)
x=[i for i in w]
nin=min(x)
if len(x)<=1:
print(x[0]-nin)
exit()
nen=len(x) |
s585907563 | p03958 | u123756661 | 1555566855 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 278 | k,t=map(int,input().split())
l=[int(i) for i in input().split()]
x=[int(i) for i in l]
nin=min(x)
nen=t
while 1:
w=[]
for i in x:
if i-nin!=0:
w.append(i-nin)
x=[i for i in w]
nin=min(x)
if len(x)<=1:
print(x-nin)
nen=len(x)
|
s711320870 | p03958 | u123756661 | 1555566823 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 278 | k,t=map(int,input().split())
l=[int(i) for i in input().split()]
x=[int(i) for i in l]
nin=min(x)
nen=t
while 1:
w=[]
for i in x:
if i-nin!=0:
w.append(i-nin)
x=[i for i in w]
nin=min(x)
if len(x)<=1:
print(x-nin)
nen=len(x)
|
s023946901 | p03958 | u859897687 | 1554833651 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 122 | k,t=map(int,input().split())
l=list(map(int,input().split()))
if len(l)==n:
print(n-1)
else:
print(max(0,max(l)//2-n)) |
s675853764 | p03958 | u859897687 | 1554833565 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 87 | k,t=wap(int,input().split())
l=list(map(int,input().split()))
print(max(0,max(l)//2-n)) |
s037287138 | p03958 | u766407523 | 1525748669 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 103 | def inpl(): return list(map(int, input().split()))
K, T = inpl()
a = inpl()
print(max(max(a)*2-n-1, 0)) |
s366911646 | p03958 | u976162616 | 1487398961 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38384 | 641 | import heapq
if __name__ == "__main__":
K,T = map(int, input().split())
data = list(map(int, input().split()))
cake = []
for i,x in enumerate(data):
cake.append([x, i])
heapq._heapify_max(cake)
while (len(cake) > 1):
heapq._heapify_max(cake)
p = heapq.heappop(cake)
... |
s675536877 | p03958 | u976162616 | 1487398304 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 601 | import heapq
if __name__ == "__main__":
K,T = map(int, input().split())
data = list(map(int, input().split()))
cake = []
for i,x in enumerate(data):
cake.append([x, i])
heapq._heapify_max(cake)
while (len(cake) > 1):
p = heapq._heappop_max(cake)
q = heapq._heappop_max(ca... |
s155121601 | p03958 | u976162616 | 1487398191 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 570 | import heapq
if __name__ == "__main__":
K,T = map(int, input().split())
data = list(map(int, input().split()))
cake = []
for i,x in enumerate(data):
cake.append([x, i])
heapq._heapify_max(cake)
while (len(cake) > 1):
p = heapq._heappop_max(cake)
q = heapq._heappop_max(ca... |
s242108713 | p03958 | u976162616 | 1487398009 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 586 | import heapq
if __name__ == "__main__":
K,T = map(int, input().split())
data = list(map(int, input().split()))
data.sort()
cake = []
for i,x in enumerate(data):
cake.append([x, i])
heapq._heapify_max(cake)
while (len(cake) > 1):
p = heapq._heappop_max(cake)
q = heapq... |
s096173015 | p03958 | u976162616 | 1487397980 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38640 | 586 | import heapq
if __name__ == "__main__":
K,T = map(int, input().split())
data = list(map(int, input().split()))
data.sort()
cake = []
for i,x in enumerate(data):
cake.append([x, i])
heapq._heapify_max(cake)
while (len(cake) > 1):
p = heapq._heappop_max(cake)
q = heapq... |
s147815841 | p03958 | u098968285 | 1477276385 | Python | PyPy3 (2.4.0) | py | Runtime Error | 413 | 41068 | 637 | # def makelist(n, m):
# return [[0 for i in range(m)] for j in range(n)]
# n = int(input())
# a, b = map(int, input().split())
# s = input()
K, T = map(int, input().split())
hoge = list(map(int, input().split()))
a = [0]*T
for i in range(T):
a[i] = (hoge[i], i)
if T == 1:
print(K-1)
else:
a.sort()
a[-1] = (a[... |
s157435580 | p03958 | u098968285 | 1477276275 | Python | PyPy3 (2.4.0) | py | Runtime Error | 395 | 40940 | 658 | # def makelist(n, m):
# return [[0 for i in range(m)] for j in range(n)]
# n = int(input())
# a, b = map(int, input().split())
# s = input()
K, T = map(int, input().split())
hoge = list(map(int, input().split()))
a = [0]*T
for i in range(T):
a[i] = (hoge[i], i)
if T == 1:
print(K-1)
else:
a.sort()
a[-1] = (a[... |
s372991360 | p03958 | u668253056 | 1477272984 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 323 | input = raw_input().split(' ')
K = int(input[0])
T = int(input[1])
input = raw_input().split(' ')
max_num = 0
sum_num = 0
for i in range(0, T):
temp = int(input[i])
if max_num < temp:
max_num = temp
sum_num += temp
if max_num <= sum_num - max_num + 1:
print "0"
else:
print max_num - (sum_num - max_num) -... |
s796109219 | p03959 | u651663683 | 1600706274 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1292 | 252648 | 64 | while True:
print(" ".join([str(i) for i in range(10000)]))
|
s043583647 | p03959 | u644907318 | 1598583583 | Python | PyPy3 (7.3.0) | py | Runtime Error | 126 | 98476 | 1022 | p = 10**9+7
N = int(input())
T = list(map(int,input().split()))
A = list(map(int,input().split()))
H = [0 for _ in range(N)]
flag = 0
if T[N-1]!=A[0]:
flag = 1
if flag==0:
indmaxT=0
H[0] = T[0]
for i in range(1,N):
if T[i]>T[i-1]:
H[i] = T[i]
if H[i]==hmax:
... |
s991525573 | p03959 | u644907318 | 1598582474 | Python | PyPy3 (7.3.0) | py | Runtime Error | 122 | 98796 | 1134 | p = 10**9+7
N = int(input())
T = list(map(int,input().split()))
A = list(map(int,input().split()))
H = [0 for _ in range(N)]
flag = 0
if T[N-1]!=A[0]:
flag = 1
if flag==0:
H[0] = T[0]
for i in range(1,N):
if T[i]<T[i-1]:
flag = 1
break
if T[i]>T[i-1]:
H[i]... |
s910866562 | p03959 | u222668979 | 1597773224 | Python | PyPy3 (7.3.0) | py | Runtime Error | 127 | 98720 | 527 | n = int(input())
t = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 1
for i in range(1, n):
if t[i] == t[i - 1]:
ans = ans * t[i] % mod
if t[i] == a[i]:
l = i
break
for i in range(n - 1)[::-1]:
if a[i] == a[i + 1]:
ans = ans * a[i... |
s137505424 | p03959 | u790710233 | 1591505467 | Python | Python (3.4.3) | py | Runtime Error | 166 | 19172 | 701 | MOD = 10**9+7
n = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
n_cases = [0]*n
n_cases[0] = n_cases[-1] = 1
height = [0]*n
if T[-1] != A[0]:
print(0)
exit()
height[0] = T[0]
height[-1] = A[-1]
for i, (t1, t2) in enumerate(zip(T, T[1:]), 1):
if t1 != t2:
n_case... |
s255284965 | p03959 | u408375121 | 1589576218 | Python | Python (3.4.3) | py | Runtime Error | 169 | 18972 | 649 | n = int(input())
t = list(map(int, input().split()))
a = list(map(int, input().split()))
MOD = 10**9 + 7
t_max = max(t)
for i in range(n):
if a[i] == t_max:
max_ind = i
break
if t[max_ind] != a[max_ind] or t[-1] != a[0]:
print(0)
else:
idx = []
before = 0
for i in range(n):
if before == t[i]:
... |
s922414597 | p03959 | u408375121 | 1589574452 | Python | Python (3.4.3) | py | Runtime Error | 125 | 19136 | 488 | n = int(input())
t = list(map(int, input().split()))
a = list(map(int, input().split()))
MOD = 10**9 + 7
if t[0] != a[-1]:
print(0)
else:
idx = []
before = 0
for i in range(n):
if before == t[i]:
idx.append(i)
before = t[i]
new_index = []
for j in idx:
if j < n-1:
if a[j] == a[j+1]:
... |
s783342497 | p03959 | u346308892 | 1586913526 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 1465 |
input = sys.stdin.readline
def acinput():
return list(map(int, input().split(" ")))
def II():
return int(input())
mod = 10**9+7
def factorial(n):
fact = 1
for integer in range(1, n + 1):
fact *= integer
return fact
def serch(x, count):
#print("top", x, count)
... |
s944390037 | p03959 | u779455925 | 1583960213 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38512 | 745 | """from collections import *
from itertools import *
from bisect import *
from heapq import *
import math
from fractions import gcd"""
N=int(input())
T=list(map(int,input().split()))
A=list(map(int,input().split()))
mod=10**9+7
lst=[0 for i in range(N)]
lst[0]=T[0]
lst[N-1]=A[N-1]
if T[N-1]!=A[0]:
print(0)
... |
s402285711 | p03959 | u118642796 | 1569377612 | Python | PyPy3 (2.4.0) | py | Runtime Error | 284 | 83812 | 503 | N = int(input())
T = list(map(int,input().split()))
A = list(map(int,input().split()))
T_min = [0]*N
T_min[0] = T[0]
for i in range(1,N):
if T[i-1]<T[i]:
T_min[i] = T[i]
A_min = [0]*N
A_min[N-1] = A[N-1]
for i in range(N-2,-1,-1):
if A[i+1]<A[i]:
A_min[i] = A[i]
M = [0]*N
M_min = [0]*N
for i in range(N):
... |
s951794344 | p03959 | u649373416 | 1556912638 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 19136 | 833 | n = int(input())
tli = [ int(it) for it in input().split() ]
ali = [ int(it) for it in input().split() ]
#print (tli,ali)
mav1 = max(tli)
mav2 = max(ali)
mav = mav1
#print (mav1,mav2)
if (mav1!=mav2):
print (0)
else:
mai1 = tli.index(mav)
mai2 = n-1-list(reversed(ali)).index(mav)
#print (mai1,mai2)
if (mai2<... |
s847523365 | p03959 | u620480037 | 1546115931 | Python | Python (3.4.3) | py | Runtime Error | 284 | 21824 | 881 | N=int(input())
T=list(map(int,input().split()))
A=list(map(int,input().split()))
if T[N-1]!=A[0]:
print(0)
elif N==1:
print(1)
else:
L=[[T[0],0]]
for i in range(1,N):
if T[i]==T[i-1]:
L.append([T[i],1])
else:
L.append([T[i],0])
#print(L)
... |
s982246631 | p03959 | u236127431 | 1544339397 | Python | PyPy3 (2.4.0) | py | Runtime Error | 309 | 84068 | 511 | N=int(input())
T=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
ans=1
mod=10**9+7
for i in range(N):
if i==0:
if A[i]!=A[i+1] and T[i]!=A[i]:
print(0)
exit()
elif i==N-1:
if T[i]!=T[i-1] and T[i]!=A[i]:
print(0)
exit()
else:
if T[i]==T[i-1] and A[i]==A[i+... |
s423922299 | p03959 | u397531548 | 1543515444 | Python | Python (3.4.3) | py | Runtime Error | 67 | 19136 | 443 | N=int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
a = 1
if T[0]>A[0] or A[-1]>T[-1] or T[-1]!=A[-1]:
a*=0
for i in range(1,n):
if T[i-1]!=T[i]:
if T[i]>A[i]:
a*=0
break
else:
a*=1
if A[i]!=A[i+1]:
if T[i]<A[i]:
... |
s478802674 | p03959 | u397531548 | 1543473093 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 27352 | 371 | N=int(input())
S=input().split()
T=list(int(S[i]) for i in range(len(S)))
B=input().split()
A=list(int(B[i]) for i in range(len(B)))
a=1
if max(T)!=max(A):
print(0)
else:
for i in range(1,N-1):
if T[i]==T[i-1] and A[N-i]==A[N-i+1]:
a*=min(T[i],A[N-i])
if T[i]>T[i-1] or A[N-i... |
s702207565 | p03959 | u397531548 | 1543472975 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 26304 | 372 | N=int(input())
S=input().split()
T=list(int(S[i]) for i in range(len(S)))
B=input().split()
A=list(int(B[i]) for i in range(len(B)))
a=1
if max(T)!=max(A):
print(-1)
else:
for i in range(1,N-1):
if T[i]==T[i-1] and A[N-i]==A[N-i+1]:
a*=min(T[i],A[N-i])
if T[i]>T[i-1] or A[N-... |
s273047216 | p03959 | u102126195 | 1536529319 | Python | Python (3.4.3) | py | Runtime Error | 164 | 18756 | 660 | N = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
h = []
for i in range(N):
if i == 0:
h.append(1)
elif i == N - 1:
h.append(1)
else:
if T[i] > T[i - 1]:
h.append(1)
if T[i] > A[i]:
h[i] = 0
... |
s919248840 | p03959 | u839537730 | 1501620719 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 18752 | 935 | N = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
def judge(t):
if t[0] == t[1]:
return True
else:
return False
if judge(A[0:2]) and A[0] < T[0]:
ans = 0
ansable = False
elif not judge(A[0:2]) and A[0] != T[0]:
ans = 0
ansable = False
el... |
s112517693 | p03959 | u436484848 | 1477284247 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 463 | def read():
return [int(i) for i in input().split(" ")]
N = int(input())
T = read()
A = read()
t = [(i != j, i) for i, j in zip(T, [None] + T)]
a = [(i != j, i) for i, j in zip(A, (A + [None])[1:])]
P = 1
for p, q in zip(t, a):
if(p[0]):
if(q[0]):
if(p[1] != q[1]):
print(0)
exit()
else:
if(q[1] < p[... |
s750018552 | p03959 | u436484848 | 1477284057 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 448 | def read():
return [int(i) for i in input().split(" ")]
N = int(input())
T = read()
A = read()
t = [(i != j, i) for i, j in zip(T, [None] + T)]
a = [(i != j, i) for i, j in zip(A, (A + [None])[1:])]
P = 1
for p, q in zip(t, a):
if(p[0]):
if(q[0]):
if(p[1] != q[1]):
print(0)
exit()
elif(q[1] < p[1]):
... |
s830558058 | p03959 | u813098295 | 1477281250 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3188 | 778 | N = int(raw_input())
T = map(int, raw_input().split())
A = map(int, raw_input().split())
ans = 1
mod = 10 ** 9 + 7
if T[N - 1] != A[0]:
print (0)
exit()
for i in xrange(N):
if i == 0 or i == N - 1:
continue
elif T[i] > T[i-1]:
if A[i] < T[i] and A[i] == A[i + 1]:
prin... |
s185938033 | p03959 | u813098295 | 1477280894 | Python | Python (2.7.6) | py | Runtime Error | 107 | 14496 | 763 | N = int(raw_input())
T = map(int, raw_input().split())
A = map(int, raw_input().split())
ans = 1
mod = 10 ** 9 + 7
if T[n - 1] != A[0]:
print 0
exit()
for i in xrange(N):
if i == 0 or i == n - 1:
continue
elif T[i] > T[i-1]:
if A[i] < T[i] and A[i] == A[i + 1]:
print 0
... |
s068121675 | p03959 | u813098295 | 1477280157 | Python | Python (2.7.6) | py | Runtime Error | 105 | 14484 | 329 | N = int(raw_input())
T = map(int, raw_input().split())
A = map(int, raw_input().split())
ans = 1
mod = 10 ** 9 + 7
if T[n - 1] != A[0]:
ans = 0
else:
for i in xrange(1, N - 1):
if T[i] > A[i]:
ans = (ans * A[i]) % mod
elif T[i] < A[i]:
ans = (ans * T[i]) % mod
print ... |
s689994643 | p03959 | u335830383 | 1477278495 | Python | Python (2.7.6) | py | Runtime Error | 929 | 22012 | 823 | import numpy as np
N = int(raw_input())
T = map(int, raw_input().split())
A = map(int, raw_input().split())
T = np.array(T)
A = np.array(A)
arr = np.ones((len(A),))
res = 1
rest = np.zeros((len(A),))
if max(A) != max(T):
res = 0
else:
for t in range(T.shape[0]):
if t > 0 and T[t] == T[t-1] and t != T... |
s629424579 | p03959 | u335830383 | 1477278350 | Python | Python (2.7.6) | py | Runtime Error | 1995 | 22012 | 846 | # -*- coding: utf-8 -*-
import numpy as np
N = int(raw_input())
T = map(int, raw_input().split())
A = map(int, raw_input().split())
T = np.array(T)
A = np.array(A)
arr = np.ones((len(A),))
res = 1
rest = np.zeros((len(A),))
if max(A) != max(T):
res = 0
else:
for t in range(T.shape[0]):
if t > 0 and T... |
s361959190 | p03959 | u386131832 | 1477278093 | Python | Python (3.4.3) | py | Runtime Error | 103 | 19136 | 366 | import sys
n=int(input())
t=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
a_max=max(a)
t_max=max(t)
if a_max != t_max(t):
print(0)
sys.exit()
i=0
sum=1
while t[i]!=t_max:
if t[i]==t[i+1]:
sum*=t[i]
j=len(a)-1
while a[j]!=a_max:
if a[j]==a[j-1]:
sum*=a[j]
sum=sum*(... |
s845266465 | p03959 | u335830383 | 1477277900 | Python | Python (2.7.6) | py | Runtime Error | 1168 | 22928 | 1015 | # -*- coding: utf-8 -*-
from sys import stdin
import numpy as np
n = stdin.readline()
n = n.strip().split(" ")
N = int(n[0])
n = stdin.readline()
n = n.strip().split(" ")
T = []
for t in n:
T.append(int(t))
T = np.array(T)
n = stdin.readline()
n = n.strip().split(" ")
A = []
for a in n:
A.append(int(a))
A = np... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.