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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s881699003 | p03464 | u637175065 | 1515987763 | Python | Python (3.4.3) | py | Runtime Error | 168 | 16656 | 1243 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF()... |
s185145250 | p03464 | u399810298 | 1515987620 | Python | Python (2.7.6) | py | Runtime Error | 91 | 11340 | 671 | import math
K=input()
A=[]
A=map(int, raw_input().split())
max_N =2
N_min = 2
N_max = 2
min_frag=0
del_count =0
for i in range(K-1):
if A[K-i-1] == A[K-i-2]:
del A[K-i-1]
del_count += 1
for i in range(K-del_count):
max_N = max_N+A[K -del_count-i-1]-1
for i in range(ma... |
s963426668 | p03464 | u782330257 | 1515987542 | Python | Python (3.4.3) | py | Runtime Error | 170 | 14280 | 810 | # cook your dish here
from math import *
#for _ in range(int(input().strip())):
def isvalid(l):
n=len(l)
if l[-1]!=2:
return 0
for i in range(n-2,-1,-1):
if l[i]>=2*l[i+1]:
return 0
return 1
n=int(input())
l=[int(x) for x in input().split()]
if n>2:
l2=l[:2]+l[2:]
f=is... |
s273617806 | p03464 | u327248573 | 1515987541 | Python | Python (3.4.3) | py | Runtime Error | 160 | 15020 | 571 | # -- coding: utf-8 --
from math import ceil
round_no = int(input())
args = list(map(int, input().split(' ')))[::-1]
cand_min = 3
if args[0] == 2 and args[1] <= 3:
for i in range(2, len(args)):
if args[i] >= 0b10 | 0b1 << i:
cand_min = -1
break
if args[i-1] <= args[i]:
... |
s600324874 | p03464 | u782330257 | 1515987467 | Python | Python (3.4.3) | py | Runtime Error | 178 | 14280 | 798 | # cook your dish here
from math import *
#for _ in range(int(input().strip())):
def isvalid(l):
n=len(l)
if l[-1]!=2:
return 0
for i in range(n-2,-1,-1):
if l[i]>=2*l[i+1]:
return 0
return 1
n=int(input())
l=[int(x) for x in input().split()]
l2=l[:2]+l[2:]
f=isvalid(l)
if ... |
s616034145 | p03464 | u948374595 | 1515987454 | Python | Python (3.4.3) | py | Runtime Error | 113 | 14428 | 431 | k = int(input())
a = list(map(int, input().split()))
if k == 1:
if a[0] == 2:
print(2, 3)
else:
print(-1)
exit(1)
temp = a[-1]
for i in reversed(range(k-1)):
if a[i] >= temp:
temp = a[i]
else:
temp = (temp//a[i] + (temp%a[i] != 0))*a[i]
ans = temp
for data in a:
temp -= temp%data
if tem... |
s226508928 | p03464 | u327248573 | 1515987424 | Python | Python (3.4.3) | py | Runtime Error | 155 | 15020 | 571 | # -- coding: utf-8 --
from math import ceil
round_no = int(input())
args = list(map(int, input().split(' ')))[::-1]
cand_min = 3
if args[0] == 2 and args[1] == 3:
for i in range(2, len(args)):
if args[i] >= 0b10 | 0b1 << i:
cand_min = -1
break
if args[i-1] <= args[i]:
... |
s916010630 | p03464 | u782330257 | 1515987366 | Python | Python (3.4.3) | py | Runtime Error | 176 | 14280 | 740 | # cook your dish here
from math import *
#for _ in range(int(input().strip())):
def isvalid(l):
n=len(l)
if l[-1]!=2:
return 0
for i in range(n-2,-1,-1):
if l[i]>=2*l[i+1]:
return 0
return 1
n=int(input())
l=[int(x) for x in input().split()]
l2=l[:2]+l[2:]
f=isvalid(l)
if ... |
s267925839 | p03464 | u948374595 | 1515987088 | Python | Python (3.4.3) | py | Runtime Error | 115 | 14428 | 442 | k = int(input())
a = list(map(int, input().split()))
l = len(a)
if l == 1:
if a[0] == 2:
print(2, 3)
else:
print(-1)
exit(1)
temp = a[-1]
for i in reversed(range(l)):
if a[i] >= temp:
temp = a[i]
else:
temp = (temp//a[i] + (temp%a[i] != 0))*a[i]
ans = temp
for data in a:
temp -= temp%dat... |
s525885268 | p03464 | u948374595 | 1515986747 | Python | Python (3.4.3) | py | Runtime Error | 120 | 14400 | 368 | k = int(input())
a = list(map(int, input().split()))
l = len(a)
temp = a[-1]
for i in reversed(range(l-1)):
if a[i] >= temp:
temp = a[i]
else:
temp = (temp//a[i] + (temp%a[i] != 0))*a[i]
ans = temp
for data in a:
temp -= temp%data
if temp == 2:
s = int(ans/a[1]+1)*a[1]
if s%a[0] != a[0]-1:
s -... |
s434484073 | p03464 | u399810298 | 1515986703 | Python | Python (2.7.6) | py | Runtime Error | 93 | 11340 | 750 | import math
K=input()
A=[]
A=map(int, raw_input().split())
max_N =2
N_min = 2
N_max = 2
min_frag=0
del_count =0
for i in range(K-2):
if A[K-i-1] == A[K-i-2]:
del A[K-i-2]
del_count += 1
for i in range(K-del_count):
max_N = max_N+A[K -del_count-i-1]-1
for i in range(ma... |
s886651336 | p03464 | u870262604 | 1515986605 | Python | Python (3.4.3) | py | Runtime Error | 2289 | 14252 | 1377 | k = int(input())
a = list(map(int, input().split()))
def solve():
if k == 1:
if a[0] == 2:
print(2, 3)
return
else:
print(-1)
return
can = []
for i in range(k):
if i==0:
can = [2]
elif i > 1 and i != k-1:
... |
s775890858 | p03464 | u671446913 | 1515986589 | Python | Python (3.4.3) | py | Runtime Error | 2110 | 137948 | 676 | K = int(input())
A = list(map(int,input().split()))
is_possible = True
after_nparticipant = [2, 3]
before_nparticipant = []
for i in reversed(range(K)):
if A[i] > max(after_nparticipant):
is_possible = False
break
for n in after_nparticipant:
if max(n, A[i]) % min(n, A[i]) == 0:
if n > A[i]:
... |
s707463320 | p03464 | u399810298 | 1515986569 | Python | Python (2.7.6) | py | Runtime Error | 92 | 11360 | 673 | import math
K=input()
A=[]
A=map(int, raw_input().split())
max_N =2
N_min = 2
N_max = 2
min_frag=0
del_count =0
for i in range(K-2):
if A[K-i-1] == A[K-i-2]:
del A[K-i-2]
del_count += 1
for i in range(K-del_count):
max_N = max_N+A[K -del_count-i-1]-1
for i in range(ma... |
s532016336 | p03464 | u767873777 | 1515986565 | Python | Python (3.4.3) | py | Runtime Error | 962 | 25168 | 528 | #! /usr/bin/env python
# coding: utf-8
import numpy as np
def slove(k, a):
a = np.array(a, dtype=np.uint32)
if a[-1] > 3 or a[-2] > 3:
return -1
b = a[1:]
b = np.append(b, 0)
b *= 2
diff = a - b
if (diff[:-1] > 0).any():
return -1
minNum = a[0]
while (minNum < a... |
s662792711 | p03464 | u399810298 | 1515986495 | Python | Python (2.7.6) | py | Runtime Error | 102 | 11340 | 698 | import math
K=input()
A=[]
A=map(int, raw_input().split())
max_N =2
N_min = 2
N_max = 2
min_frag=0
del_count =0
if K > 1:
for i in range(K-2):
if A[K-i-1] == A[K-i-2]:
del A[K-i-1]
del_count += 1
for i in range(K-del_count):
max_N = max_N+A[K -del_count-i-1]-1
for... |
s951342352 | p03464 | u399810298 | 1515986432 | Python | Python (2.7.6) | py | Runtime Error | 95 | 11348 | 695 | import math
K=input()
A=[]
A=map(int, raw_input().split())
max_N =2
N_min = 2
N_max = 2
min_frag=0
del_count =0
if K > 1:
for i in range(K-2):
if A[K-i-1] == A[K-i-2]:
del A[K-i-1]
del_count += 1
for i in range(K-del_count):
max_N = max_N+A[K -del_count-i-1]-1
for... |
s008634785 | p03464 | u399810298 | 1515986103 | Python | Python (2.7.6) | py | Runtime Error | 94 | 11340 | 706 | import math
K=input()
A=[]
A=map(int, raw_input().split())
max_N =2
N_min = 2
N_max = 2
min_frag=0
del_count =0
if K > 1:
for i in range(K-1):
if A[K-i-1] == A[K-i-2]:
del A[K-i-1]
del_count += 1
for i in range(K-del_count):
max_N = max_N+A[K -del_count-i-1]-1
if m... |
s665843728 | p03464 | u399810298 | 1515985819 | Python | Python (2.7.6) | py | Runtime Error | 93 | 11340 | 644 | import math
K=input()
A=[]
A=map(int, raw_input().split())
max_N =2
N_min = 2
N_max = 2
min_frag=0
del_count =0
if K > 1:
for i in range(K-1):
if A[K-i-1] == A[K-i-2]:
del A[K-i-1]
del_count += 1
for i in range(K-del_count):
max_N = max_N+A[K -del_count-i-1]-1
for ... |
s245286752 | p03464 | u767873777 | 1515985789 | Python | Python (3.4.3) | py | Runtime Error | 78 | 11132 | 505 | #! /usr/bin/env python
# coding: utf-8
def slove(k, a):
if int(a[-1]) > 3 or int(a[-2]) > 3:
return -1
for i in range(k-1):
left = int(a[i])
right = int(a[i+1])
if left >= 2*right:
return -1
minNum = int(a[0])
while (minNum < int(a[1])):
minNum *= 2... |
s620557362 | p03464 | u466826467 | 1515985258 | Python | Python (3.4.3) | py | Runtime Error | 2131 | 438536 | 725 | if __name__ == '__main__':
K = int(input())
A = list(map(int, input().split()))
# min
min_target_nums = [2]
max_target_nums = [2]
for a in reversed(A):
min_targets = [_ for _ in min_target_nums if _ % a == 0]
max_targets = [_ for _ in max_target_nums if _ % a == 0]
if le... |
s201438397 | p03464 | u948374595 | 1515984924 | Python | Python (3.4.3) | py | Runtime Error | 122 | 14352 | 324 | k = int(input())
a = list(map(int, input().split()))
l = len(a)
for i in reversed(range(l)):
temp = a[i]
if a[i-1] > 2*temp:
print(-1)
exit(1)
temp = a[-1]
for i in reversed(range(l-1)):
if a[i] >= temp:
temp = a[i]
else:
temp = (temp//a[i] + (temp%a[i] != 0))*a[i]
print(temp, temp+a[0]-... |
s386588898 | p03464 | u399810298 | 1515984906 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 11340 | 446 | import math
K=input()
A=[]
A=map(int, raw_input().split())
max_N =2
N_min = 2
N_max = 2
min_frag=0
for i in range(K):
max_N = max_N+A[K-i-1]-1
for i in range(max_N):
number = i
for j in range(K):
number = number /A[j]
if number == 2:
if min_frag == 0:
N_... |
s770755030 | p03464 | u925364229 | 1515984687 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 476 | K = int(input())
A = list(map(int,input().split()))
if A[-1] != 2:
print(-1)
exit(0)
minval = 2
maxval = 3
for i in range(K-1,-1,-1):
if maxval < A[i] or (minval > A[i] and ((maxval - (maxval % A[i]) < minval)):
print(-1)
exit(0)
if minval > A[i]:
if minval % A[i] != 0:
minval = minval + (A[i] - (minval... |
s169925567 | p03464 | u870262604 | 1515984179 | Python | Python (3.4.3) | py | Runtime Error | 2121 | 763560 | 573 | k = int(input())
a = list(map(int, input().split()))
def solve():
can = []
res = []
for i in range(k):
a_ = a[k-i-1]
if i==0:
res = [2]
else:
res = []
for c in can:
if c % a_ == 0:
res.append(c)
if... |
s331311180 | p03464 | u767873777 | 1515984122 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 12968 | 781 | #! /usr/bin/env python
# coding: utf-8
def slove(k, a):
if int(a[-1]) > 3 or int(a[-2]) > 3:
return -1
num = 0
index = -2
for i in range(k-1):
if i != k-2:
if 2*int(a[index]) < int(a[index-1]):
return -1
if int(a[index]) > 2:
tmp = int(a... |
s533100499 | p03464 | u177481830 | 1515983730 | Python | Python (3.4.3) | py | Runtime Error | 104 | 14252 | 322 | import math
K=int(input())
A_lst=[int(_) for _ in input().split() ]
assert A_lst[-1]==2
stt, end=2,4
failed=False
for a in A_lst[-2::-1]:
#print(stt, end, a)
stt=a*math.ceil(stt/a)
if stt>= end:
failed=True
break
end=a*math.ceil(end/a)
if failed:
print(-1)
else:
print(stt, end-... |
s683596780 | p03464 | u665415433 | 1515983701 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14224 | 319 | K = int(input())
A = list(map(int,input().split()))
a = K-1
p = 2
while 0 <= a:
if A[a-1] > A[a]*2:
print('-1')
exit()
num = 1
if A[a] < p:
while A[a]*num < p:
num += 1
p = num*A[a]
a -= 1
pmax = p
while pmax < A[1]*2:
pmax += A[0]
pmax -= A[0]
print(p,pmax)
|
s528361406 | p03464 | u839857256 | 1515983700 | Python | Python (3.4.3) | py | Runtime Error | 79 | 14252 | 415 | k = int(input())
a = list(map(int, input().split()))
if a[-1] != 2:
print(-1)
else:
n = 2
flag = 0
for i in range(k-2, -1, -1):
if a[i+1] <= a[i]:
if n <= a[i] <= n*2-1:
n = a[i]
else:
flag = 1
break
else:
... |
s610074941 | p03464 | u870262604 | 1515983509 | Python | Python (3.4.3) | py | Runtime Error | 2137 | 804108 | 540 | k = int(input())
a = list(map(int, input().split()))
can = []
res = []
def solve():
for i in range(k):
a_ = a[k-i-1]
if i==0:
res = [2]
else:
res = []
for c in can:
if c % a_ == 0:
res.append(c)
if len(re... |
s406267643 | p03464 | u426438490 | 1515982418 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 746 | #include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <iomanip>
#include <deque>
#include <cstring>
using namespace std;
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt",... |
s809560048 | p03465 | u969708690 | 1599525926 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9248 | 76 | N=int(input())
A=list(map(int,input().split()))
print(sum(L[N//4:(3*N)//4])) |
s537216861 | p03465 | u754022296 | 1593914403 | Python | PyPy3 (7.3.0) | py | Runtime Error | 227 | 74812 | 283 | n = int(input())
M = 10**4
dp = [0]*(2*M)
dp[M] = 1
A = tuple(map(int, input().split()))
for i, a in enumerate(A):
for j in range(2*M):
if j-a >= 0 and dp[j-a]:
dp[j] = 1
l = sum(divmod(sum(A), 2))
now = M+l
while True:
if dp[now]:
print(now-M)
break
now += 1 |
s979832817 | p03465 | u075595666 | 1592605288 | Python | Python (3.8.2) | py | Runtime Error | 540 | 11336 | 487 | n = int(input())
a = list(map(int,input().split()))
s = sum(a)
a.sort()
b = 0
for i in a:
b |= b<<i
b |= 1<<i
def all_bit_count(x):
x = x - ((x >> 1) & 0x5555555555555555)
x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
x = x + (x >> 8)
... |
s198185123 | p03465 | u038021590 | 1591067313 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 108128 | 277 | import numpy as np
N = int(input())
A = [int(a) for a in input().split()]
U = sum(A)
if N == 1:
print(A[0])
exit()
f = np.zeros(U + 10, np.int64)
f[0] = 1
for a in A:
g = f.copy()
f[a:] += g[:-a]
f[0] = 0
f = np.cumsum(f)
print(np.where(f >= 2**(N-1))[0][0]) |
s145805830 | p03465 | u146774046 | 1590964327 | Python | Python (3.4.3) | py | Runtime Error | 3414 | 163316 | 615 | N = int(input())
A = list(map(int, input().split()))
A.insert(0, 0)
#print(A)
S = sum(A)
# 1~i番目までのAk要素を組み合わせて和を取り、jを作ることが可能か
canMake = [([False] * (S+1)) for i in range(N+1)]
for i in range(1, N+1) :
for j in range(1, S+1) :
canMake[i][j] = canMake[i-1][j]
canMake[i][A[i]] = True
for j in range(1, S+1-A... |
s060401911 | p03465 | u520276780 | 1583004800 | Python | PyPy3 (2.4.0) | py | Runtime Error | 691 | 134040 | 251 | #解説参照
n = int(input())
a = list(map(int, input().split( )))
dp = 1
for i in range(n):
dp |= dp<<a[i]
ans = (sum(a)+1)//2
tmp = 1<<sn
for i in range(ans):
if dp&tmp:
print(ans)
exit()
ans+=1
tmp <<=1
print(ans) |
s088231714 | p03465 | u222451682 | 1573895899 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 789 |
n=int(input())
arr=[int(x) for x in input().split()]
sum = sum(arr)
ans=[]
# dp[i][j] would be true if arr[0..i-1]
# has a subset with Sum equal to j.
dp = [[False for i in range(sum + 1)] for i in range(n + 1)]
# There is always a subset with 0 Sum
for i in range(n + 1):... |
s451998218 | p03465 | u222451682 | 1573895571 | Python | Python (3.4.3) | py | Runtime Error | 2137 | 523096 | 777 |
n=int(input())
arr=[int(x) for x in input().split()]
sum = sum(arr)
ans=[]
# dp[i][j] would be true if arr[0..i-1]
# has a subset with Sum equal to j.
dp = [[False for i in range(sum + 1)] for i in range(n + 1)]
# There is always a subset with 0 Sum
for i in range(n + 1):... |
s979962583 | p03465 | u222451682 | 1573895195 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 777 |
n=int(input())
arr=[int(x) for x in input().split()]
sum = sum(arr)
ans=[]
# dp[i][j] would be true if arr[0..i-1]
# has a subset with Sum equal to j.
dp = [[False for i in range(Sum + 1)] for i in range(n + 1)]
# There is always a subset with 0 Sum
for i in range(n + 1):... |
s635857074 | p03465 | u222451682 | 1573893718 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 243 | n=int(input())
a=[int(x) for x in input().split()]
b=[[]]
for i in a:
b+=[[i]+j for j in b]
c=sorted(b)
c=c[1:]
d=[]
for i in c:
d.append(sum(i))
d=sorted(d)
k=len(d)
if(k%2==0):
print((d[(k//2)-1] + d[k//2])/2.0)
else:
print(d[k//2]) |
s299951481 | p03465 | u663638882 | 1567355179 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 862 | import io, os
from sys import stdin, stdout
from typing import List
class Solution():
def __init__(self):
return
def getMedian(self, ar:List[int]):
n = len(ar)
if n==1:
return ar[0]
arsum = sum(ar)
f = [0]*(arsum+1)
f[0]=1
for i in range(n):
... |
s302347704 | p03465 | u001024152 | 1554065738 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 134 | N = int(input())
a = sorted(list(map(int, input().split())))
if len(a)==1: print(a[0]); exit()
median = a[N//2+1]
print(sum(a)-median) |
s366445161 | p03465 | u743272507 | 1516741804 | Python | Python (3.4.3) | py | Runtime Error | 2566 | 258420 | 307 | n = int(input())
a = list(sorted(list(map(int,input().split()))))
tgt = sum(a)//2
dp = [[0]*(tgt+1) for _ in range(n+1)]
for i in range(n):
for w in range(min(a[i],tgt+1)):
dp[i+1][w] = dp[i][w]
for w in range(a[i],tgt+1):
dp[i+1][w] = dp[i][w-a[i]] + a[i]
print(sum(a)-dp[-1][-1])
|
s612577704 | p03465 | u631790021 | 1516510109 | Python | Python (2.7.6) | py | Runtime Error | 12 | 2692 | 817 | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
using namespace std;
typedef long long LL;
LL gi () {
LL ret=0; char ch=getchar();
... |
s528931264 | p03465 | u330205771 | 1515989675 | Python | Python (3.4.3) | py | Runtime Error | 2211 | 1713700 | 291 | from itertools import combinations
N = int(input())
A = list(map(int, input().split()))
A.sort()
if N % 2 == 1:
num = int(N / 2) + 1
print(sum(A[:num]))
else:
comb = list(combinations(A, int(N / 2)))
SUM = [sum(c) for c in comb]
SUM.sort()
print(SUM[2 ** (N - 1)])
|
s005637008 | p03465 | u330205771 | 1515987194 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 180 | N = int(input())
A = list(map(int, input().split()))
A.sort()
if N % 2 == 1:
num = int(N / 2) + 1
print(sum(A[:num]))
else:
print(sum(A[:N / 4]) + sum(A[N * 3 / 4:]))
|
s869095232 | p03465 | u821608744 | 1515986506 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38640 | 412 | from numpy.polynomial import polynomial as P
n = int(input())
A = list(map(int,input().split()))
def DC(l,r):
if r - l == 1:
return [1 if i == 0 or i == A[l] else 0 for i in range(A[l]+1)]
m = (l + r) // 2
return P.polymul(DC(l,m), DC(m,r))
S = DC(0,len(A))
m = 2**(n-1)
t = 0
k = 1
while k < len(S):... |
s350510376 | p03465 | u943004959 | 1515986340 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 307 | def solve():
n = int(input())
A = list(map(int, input().split(" ")))
sum_list = []
for i in range(1, n + 1):
for ele in list(itertools.combinations(A, i)):
sum_list.append(sum(ele))
sum_list.sort()
length = len(sum_list)
print(sum_list[length // 2])
solve() |
s957015446 | p03465 | u943004959 | 1515986057 | Python | Python (3.4.3) | py | Runtime Error | 123 | 5660 | 308 | from statistics import median
def solve():
n = int(input())
A = list(map(int, input().split(" ")))
sum_list = []
for i in range(1, n + 1):
for ele in list(itertools.combinations(A, i)):
sum_list.append(sum(ele))
sum_list.sort()
print(median(sum_list))
solve() |
s281458310 | p03465 | u965230804 | 1515984677 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 441 | import itertools
n = int(input())
a = list(map(int, input().split()))
a.sort()
#部分列の和を0番目から数えたk番目の要素がtarget
target = (2**n - 1) // 2
counter = 0
for i in range(1, n + 1):
if len(list(itertools.combinations(a, i))) - 1 <= target - counter:
print(sum(list(itertools.combinations(a, i))[target - counter - 1]))
... |
s665954474 | p03465 | u169441068 | 1515983662 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 34420 | 270 | n=int(input())
a=[]
sa=input().split(' ')
s=0
for i in sa:
t=int(i)
a.append(t)
s+=t
dp=[0]*(s+1)
dp[0]=1
for i in a:
for j in range(s,i-1,-1):
dp[j]+=dp[j-i]
tg=(2**n)/2
t=0
for i in range(s+1):
t+=dp[i]
if t>tg:
break
print(i)
|
s981183665 | p03466 | u545001286 | 1557272960 | Python | Python (3.4.3) | py | Runtime Error | 80 | 3188 | 312 | for t in range(int(input())):
a,b,c,d=map(int,input().split(' '));l,o=(a+b)//(min(a,b)+1),"";x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
if a*l<=b:x,y=0,a+b
elif b*l<=a:x,y=a+b,0
for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
print(o) |
s178097612 | p03466 | u545001286 | 1557272892 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 312 | for t in range(int(input())):
a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),(a*l-b)//(l-1),(b*l-a)//(l-1),""
if a*l<=b:x,y=0,a+b
elif b*l<=a:x,y=a+b,0
for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
print(o) |
s422209750 | p03466 | u144695182 | 1557199025 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 319 | for t in range(int(input())):
a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),0,0,""
if a*l<=b:y=a+b
elif b*l<=a:x=a+b
else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
print(o) |
s603652633 | p03466 | u066337396 | 1515989739 | Python | Python (3.4.3) | py | Runtime Error | 2233 | 1449076 | 474 | import sys
def f(a, b):
sa, sb = 'AB'
if a < b:
sa, sb = 'BA'
a, b = b, a
d = a // (b + 1)
if a > (b + 1) * d:
d += 1
l = ([sa] * d + [sb]) * b
l.extend([sa] * (a - d * b))
if sa == 'A':
return l
else:
return l[::-1]
def main():
q = int(inp... |
s808934571 | p03466 | u066337396 | 1515989601 | Python | Python (3.4.3) | py | Runtime Error | 2234 | 1449076 | 474 | import sys
def f(a, b):
sa, sb = 'AB'
if a < b:
sa, sb = 'BA'
a, b = b, a
d = a // (b + 1)
if a > (b + 1) * d:
d += 1
l = ([sa] * d + [sb]) * b
l.extend([sa] * (a - d * b))
if sa == 'A':
return l
else:
return l[::-1]
def main():
q = int(inp... |
s554654901 | p03466 | u374099594 | 1515986416 | Python | Python (2.7.6) | py | Runtime Error | 2189 | 979356 | 1148 | import itertools
"""
def f(A,B):
ans = ""
ansl = 99999
for s in itertools.permutations(["a"]*A+["b"]*B):
s = "".join(s)
l = 0
p = -1
for i in range(A+B):
if i==A+B-1 or s[i]!=s[i+1]:
l = max(l, i-p)
p = i
if l==ansl:
ans = min(ans, s)
elif l<ansl:
ans = s... |
s135544148 | p03469 | u598684283 | 1601043476 | Python | PyPy3 (7.3.0) | py | Runtime Error | 89 | 68816 | 260 | n,y = map(int,input().split())
for i in range(y // 10000 + 1):
for j in range(y // 5000 + 1):
k = n - i - j
if 0 <= k and 10000 * i + 5000 * j + 1000 * k == y:
print(i,j,k,sep=" ")
exit()
print("-1 " + "-1" + " -1") |
s477602714 | p03469 | u568426505 | 1600140613 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8960 | 27 | a=input()
a[3]="8"
print(a) |
s192913865 | p03469 | u963963908 | 1600044255 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9172 | 205 | N,Y = map(int,input().split())
res = (-1,-1,-1)
for x in range(N+1):
for y in range(N+1-x):
if N-x-y >=0 and 10000*x + 5000*y + 1000*(N-x-y) == Y:
res = (x,y,N-x-y)
print(res[0],res[1],res[2])
|
s056274969 | p03469 | u847033024 | 1599904916 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8816 | 32 | a = input()
a[3] = '8'
print(a)
|
s894028218 | p03469 | u847033024 | 1599904889 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8952 | 31 | a = input()
a[4] = '8'
print(a) |
s647546150 | p03469 | u301590311 | 1599626285 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9184 | 310 | i = [int(i) for i in input().split()]
N = i[0]
Y = i[1]
# 10000*N - Y = 5000*y + 9000*z
# 10*N - Y/1000 = 5*y + 9*z
sum = 10*N - Y/1000
for y in range(N+1):
for z in range(N-y+1):
if sum == 5*y + 9*z:
print(str(N-y-z) + " " + str(y) + " " + str(z))
exit()
print("-1 -1 -1") |
s835077935 | p03469 | u477696265 | 1599313097 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9076 | 55 | n,*d=map(int,open(0).read().split())
print(len(set(d))) |
s325826302 | p03469 | u620846115 | 1599217528 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9136 | 68 | a,b,c = map(int,input().split("/"))
print("2018/"+int(b)+"/"+int(c)) |
s787213214 | p03469 | u620846115 | 1599217474 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9160 | 58 | a,b,c = map(int,input().split("/"))
print("2018/"+b+"/"+c) |
s827001396 | p03469 | u046826851 | 1599082862 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9004 | 40 | s = input()
print(s.replace(2017, 2018)) |
s666288489 | p03469 | u186020592 | 1598803517 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9104 | 236 | N,Y = map(int, input().split())
for j in range(N+1):
for i in range(N+1):
sum = 10000*j + 5000*i + 1000*(N-i-j)
if(sum==Y and N-i-j>=0):
print(j,i,N-i-j)
exit()
print('-1 -1 -1') |
s339070992 | p03469 | u186020592 | 1598803272 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9052 | 260 | N = int(input())
Y = int(input())
answer = []
comb = []
for j in range(N+1):
for i in range(N+1):
sum = 10000*j + 5000*i + 1000*(N-i-j)
if(sum==Y and N-i-j>=0):
print(j,i,N-i-j)
exit()
print('-1 -1 -1') |
s431419210 | p03469 | u186020592 | 1598803193 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8944 | 342 | answer = []
comb = []
for j in range(N+1):
for i in range(N+1):
sum = 10000*j + 5000*i + 1000*(N-i-j)
if(sum==Y and N-i-j>=0):
comb = [j,i,N-i-j]
answer = [str(x) for x in comb]
answer = ' '.join(answer)
print(answer)
exit()
if not(answer):... |
s009357342 | p03469 | u309120194 | 1598644105 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9012 | 32 | S = input()
S[4] = '8'
print(S) |
s832355398 | p03469 | u855057563 | 1598455171 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9008 | 54 | s=list(input())
s[3]=8
for in in s:
print(s,end="")
|
s324941094 | p03469 | u855057563 | 1598454879 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9084 | 40 | s=list(input())
s[3]=8
print("".join(s)) |
s097624825 | p03469 | u178647828 | 1598390214 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8936 | 37 | S = input()
print(S.replace(7, 8, 1)) |
s935474492 | p03469 | u178647828 | 1598388823 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8880 | 31 | S = input()
S[3] = '8'
print(S) |
s229469835 | p03469 | u178647828 | 1598388668 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9084 | 29 | S = input()
print(S[3] = '8') |
s148160347 | p03469 | u038216098 | 1598208459 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8984 | 27 | S=input()
S[3]="8"
print(S) |
s832188766 | p03469 | u918422508 | 1598169392 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8884 | 210 | import sys
N, Y = map(int, input().split())
for x in range(N+1):
for y in range(N+1-x):
for z in range(N+1-x-y):
if Y == 10000*x+5000*y+1000*z :
print(x,y,z)
sys.exit()
print("-1 -1 -1") |
s042384706 | p03469 | u918422508 | 1598160874 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9008 | 34 | s= List(input())
s[3]="8"
print(s) |
s778681563 | p03469 | u918422508 | 1598160841 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9012 | 28 | s= input()
s[3]="8"
print(s) |
s192594539 | p03469 | u956836108 | 1597704070 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9100 | 479 | # -*- coding: utf-8 -*-
# n, y = 2000, 20000000
n, y = map(int, input().split())
judge = "no value"
for i in range(n+1):
if judge == "Found it!":
break
for j in range(n+1):
z = n - i - j
value = z * 10000 + i * 5000 + j *1000
if value == y and z >= 0:
print(z, i , j... |
s327444011 | p03469 | u956836108 | 1597704031 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9132 | 307 | n, y = map(int, input().split())
for i in range(n+1):
for j in range(n+1):
z = n - i - j
value = z * 10000 + i * 5000 + j *1000
if value == y and z > 0:
print(z, i , j)
break
else:
continue
break
else:
print(-1, -1, -1) |
s707384930 | p03469 | u956836108 | 1597703711 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9208 | 501 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 17 18:27:45 2020
@author: ito
"""
# -*- coding: utf-8 -*-
# n, y = 2000, 20000000
n, y = map(int, input().split())
for i in range(n+1):
for j in range(n+1):
z = n - i - j
value = z * 10000 + i * 5000 + j *1000
if value == y and z > 0:
... |
s991115956 | p03469 | u956836108 | 1597691854 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9068 | 360 | n, y = map(int, input().split())
judge = "no value"
for i in range(n+1):
if judge == "Found it!":
break
for j in range(n+1-i):
z = n - i - j
value = z * 10000 + i * 5000 + j *1000
if value == y:
print(z, i , j)
judge = "Found it!"
break
if ju... |
s341225332 | p03469 | u095396110 | 1597687513 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9084 | 94 | n = int(input())
d_i_list = [int(input()) for i in range(n)]
print(len(list(set(d_i_list)))) |
s561736632 | p03469 | u418826171 | 1597616095 | Python | PyPy3 (7.3.0) | py | Runtime Error | 104 | 74588 | 33 | s = input()
print(s.replace(7,8)) |
s262287847 | p03469 | u929793345 | 1597520989 | Python | Python (3.8.2) | py | Runtime Error | 20 | 8968 | 43 | S = input()
print(S.replace('2017','2018') |
s460516118 | p03469 | u203669169 | 1597457645 | Python | PyPy3 (7.3.0) | py | Runtime Error | 133 | 74264 | 320 | N, Y = [int(_) for _ in input().split()]
for x in range(0, Y//10000 + 1, 1):
for y in range(0, Y//5000 + 1, 1):
z = N - x - y
if z < 0:
break
if 10000 * x + 5000 * y + 1000 * z == Y:
print(x, y, z)
exit()
print("-1 -1 -1")
|
s343112442 | p03469 | u548514780 | 1596991140 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9044 | 322 | N,Y=map(int, input().split())
ichiman=0
gosen=0
sen=0
a=0
for i in range(N+1):
for j in range(N+1-i):
for k in range(N+1-i-j):
if 10000*i+5000*j+1000*k==Y and i+j+k==N:
a=1
ichiman=i
gosen=j
sen=k
print(str(i)+' '+str(j)+' '+str(k))
exit()
print('-1 -1 -1... |
s082705203 | p03469 | u750389519 | 1596666484 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8932 | 24 | S=input()
print(S[4]"8") |
s442466170 | p03469 | u174536291 | 1596654159 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9080 | 31 | s = input()
s[3] = '8'
print(s) |
s169172754 | p03469 | u623819879 | 1596610766 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 74716 | 34 | print(input().replace('017','018') |
s137477693 | p03469 | u969708690 | 1596490549 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8880 | 40 | S=list(input())
S[3]=8
print("".join(S)) |
s952444869 | p03469 | u743383679 | 1596463738 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8992 | 250 | # coding: utf-8
import math
n, y = map(int, input().split())
for i in range(n + 1):
for j in range(n - i + 1):
k = n - i - j
if i * 10000 + j * 5000 + k * 1000 == y:
print(i, j, k)
exit()
print("-1 -1 -1") |
s538670794 | p03469 | u752774573 | 1596412235 | Python | PyPy3 (7.3.0) | py | Runtime Error | 92 | 74728 | 57 | date=str(input())
data.replace("2017","2018")
print(data) |
s897334519 | p03469 | u752774573 | 1596412176 | Python | PyPy3 (7.3.0) | py | Runtime Error | 99 | 74284 | 45 | date=str(input())
data.replace("2017","2018") |
s174886915 | p03469 | u062691227 | 1596234373 | Python | PyPy3 (7.3.0) | py | Runtime Error | 91 | 74796 | 31 | s = input()
s[3] = '8'
print(s) |
s822007659 | p03469 | u062691227 | 1596234352 | Python | PyPy3 (7.3.0) | py | Runtime Error | 96 | 74748 | 29 | s = input()
s[3] = 8
print(s) |
s136214307 | p03469 | u248364740 | 1595966242 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9040 | 420 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
N, Y = map(int, input().strip().split())
x = -1
y = -1
z = -1
for i in range(N+1):
if i * 10000 > Y:
break
for j in range(N+1-i):
z = int((Y - i * 10000 - j * 5000) / 1000)
if i + j + z == N and z >= 0:
x = i
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.