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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s569921936 | p03762 | u216954900 | 1491706435 | Python | Python (3.4.3) | py | Runtime Error | 217 | 24080 | 936 | # -*- coding: utf-8 -*-
import os
import sys
import math
import numpy as np
n, m = map(int, input().split())
X = input().split()
X = list(map(int, X))
X = np.array(X)
Y = input().split()
Y = list(map(int, Y))
Y = np.array(Y)
# 1 つの最小長方形は (n-1)*(m-1) 回加算される
S = 0
mod = 10 ** 9 + 7
X_dif = X[1:]-X[:-1]
Y_dif = Y[1:... |
s635028662 | p03762 | u552668967 | 1491706284 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 538 | from sys import stdin
n,m = map(int,stdin.readline().split())
a = map(int,stdin.readline().split())
b = map(int,stdin.readline().split())
a.sort()
b.sort()
x = []
y = []
for i in xrange(1,n):
x.append(a[i] - a[i-1])
for i in xrange(1,m):
y.append(b[i] - b[i-1]) ... |
s021084647 | p03762 | u391812144 | 1491705592 | Python | Python (3.4.3) | py | Runtime Error | 46 | 26236 | 735 | import itertools
import math
nm = str(input()).split(' ')
xAry = str(input()).split(' ')
yAry = str(input()).split(' ')
result = 0
nRange = range(int(nm[0]))
mRange = range(int(nm[1]))
nList = itertools.combinations(nRange,2)
mList = itertools.combinations(mRange,2)
for n in nList:
for m in mList:
resul... |
s520806288 | p03762 | u777923818 | 1491705517 | Python | Python (3.4.3) | py | Runtime Error | 215 | 24060 | 859 | # -*- coding: utf-8 -*-
import numpy as np
from numpy import array, matrix
N, M = [int(n) - 1 for n in input().split()]
pre_x_ = array([int(n) for n in input().split()])
pre_y_ = array([int(n) for n in input().split()])
x_ = pre_x_[1:N+1] - pre_x_[0:N]
y_ = pre_y_[1:M+1] - pre_y_[0:M]
x_length_arr = np.zeros(int(N * ... |
s703783959 | p03762 | u777923818 | 1491705465 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 856 | # -*- coding: utf-8 -*-
import numpy as np
from numpy import array, matrix
N, M = [int(n) - 1 for n in input().split()]
pre_x_ = array([int(n) for n in input().split()])
pre_y_ = array([int(n) for n in input().split()])
x_ = pre_x_[1:N+1] - pre_x_[0:N]
y_ = pre_y_[1:M+1] - pre_y_[0:M]
x_length_arr = np.zeros(int(N * ... |
s466088798 | p03762 | u777923818 | 1491705282 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 846 | # -*- coding: utf-8 -*-
import numpy as np
from numpy import array, matrix
N, M = [int(n) - 1 for n in input().split()]
pre_x_ = array([int(n) for n in input().split()])
pre_y_ = array([int(n) for n in input().split()])
x_ = pre_x_[1:N+1] - pre_x_[0:N]
y_ = pre_y_[1:M+1] - pre_y_[0:M]
x_length_arr = np.zeros(int(N * ... |
s986436454 | p03762 | u706884679 | 1491704995 | Python | Python (3.4.3) | py | Runtime Error | 439 | 20748 | 285 | n,m=input().split()
x=input().split()
y=input().split()
d=pow(10,9)+7
i=0
k=0
S=0
while i<int(n)-1:
i+=1
S+=i*(int(n)-i)*(int(x[i])-int(x[i-1]))*(int(y[int(n)-1])-int(y[0]))
while k<int(m)-1:
k+=1
S+=k*(int(m)-k)*(int(y[k])-int(y[k-1]))*(int(x[int(m)-1])-int(x[0]))
A=S%d
print(A) |
s378837662 | p03762 | u216954900 | 1491704885 | Python | Python (3.4.3) | py | Runtime Error | 702 | 24048 | 936 | # -*- coding: utf-8 -*-
import os
import sys
import math
import numpy as np
n, m = map(int, input().split())
X = input().split()
X = list(map(int, X))
X = np.array(X)
Y = input().split()
Y = list(map(int, Y))
Y = np.array(Y)
# 1 つの最小長方形は (n-1)*(m-1) 回加算される
S = 0
mod = 10 ** 9 + 7
X_dif = X[1:]-X[:-1]
Y_dif = Y[1:... |
s944863318 | p03762 | u069170167 | 1491704212 | Python | Python (3.4.3) | py | Runtime Error | 133 | 18624 | 415 | mod = 1000000007
def partition(number):
answer = set()
answer.add((number, ))
for x in range(1, number):
for y in partition(number - x):
answer.add(tuple(sorted((x, ) + y)))
return answer
p = lambda n: len(partition(n))
n,m = map(int, input().split())
x = list(map(int, input().split... |
s589016277 | p03762 | u330205771 | 1491703241 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 367 | n, m = map(int, raw_input().split())
x = map(int, raw_input().split())
y = map(int, raw_input().split())
result = 0
for i in range(len(x)):
for j in range(len(y)):
for k in range(i + 1, len(x)):
for l in range(j + 1, len(y)):
result += abs(x[i] - x[k]) * abs(y[j] - y[l])
... |
s166500732 | p03763 | u848647227 | 1589680432 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 336 | a = int(input())
ar = []
l = 50
t = ''
for i in range(a):
j = input()
ar.append(j)
if len(j) < l:
l = len(j)
t = j
ar.remove(t)
br = []
for i in range(l):
count = 0
for r in ar:
if t[i] in r:
count += 1
if count == len(ar):
br.append(t[i])
br.sort()
pr... |
s564904310 | p03763 | u941022948 | 1589130062 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 267 | a=int(input())
list1=['']*a
ans=['']
for i in range(a):
list1[i]=list(input())
for i in list1[0]:
if (i in list1[1])and(i in list1[2]):
ans.append(i)
list1[1].remove(i)
list1[2].remove(i)
ans=sorted(ans)
print(''.join(ans)) |
s033551238 | p03763 | u941022948 | 1589129446 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 193 | a=int(input())
list1=['']*a
ans=''
for i in range(a):
list1[i]=input()
for i in list1[0]:
if (i in list1[1])and(i in list1[2]):
ans=ans+i
ans=sorted(ans)
print(''.join(ans)) |
s850377826 | p03763 | u106778233 | 1589082434 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 277 | n=int(input())
s=input()
S=list(s)
V="abcdefghijklmnopqrstuvwxyz"
dp=[10000]*26
for i in range(n):
t=input()
T=list(t)
for j in range(26):
clue=max(0,T.count(V[j]))
dp[j]=min(dp[j],clue)
ans=""
for j in range(26):
ans=ans+V[j]*dp[j]
print(ans) |
s244546321 | p03763 | u102242691 | 1586318157 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 298 |
n = int(input())
s = [input() for _ in range(n)]
t = []
for i in range()
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
cl = [Counter(s) for s in S]
ans = ""
for i in range(26):
s = chr(ord("a")+i)
val = min([c[s] for c in cl])
ans += s*val
print(ans)
|
s130264917 | p03763 | u078349616 | 1584914664 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 219 | from collections import Counter
N = int(input())
S = [input() for _ in range(N)
cl = [Counter(s) for s in S]
ans = ""
for i in range(26):
s = chr(ord("a")+i)
val = min([c[s] for c in cl])
ans += s*val
print(ans) |
s437298830 | p03763 | u252828980 | 1581357571 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3316 | 388 | n = int(input())
s1 = list(input())
s2 = list(input())
s3 = list(input())
ans = ""
a = set(s1)&set(s2)&set(s3)
s1 = [x for x in s1 if x in a]
s2 = [x for x in s2 if x in a]
s3 =[x for x in s2 if x in a]
s1.sort()
s2.sort()
s3.sort()
for i in range(min(len(s1),len(s2),len(s3))):
if s1[:i+1] == s2[:i+1] == s3[:i+1]... |
s125124707 | p03763 | u252828980 | 1581357388 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 404 | n = int(input())
s1 = list(input())
s2 = list(input())
s3 = list(input())
ans = ""
a = set(s1)&set(s2)&set(s3)
s1 = [x for x in s1 if x in a]
s2 = [x for x in s2 if x in a]
s3 =[x for x in s2 if x in a]
s1.sort()
s2.sort()
s3.sort()
print(s1,s2,s3)
for i in range(min(len(s1),len(s2),len(s3))):
if s1[:i+1] == s2[:i... |
s538249025 | p03763 | u189023301 | 1568848631 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 305 | n = int(input())
letters = [input() for _ in range(n)]
common = []
for item in letters[0]:
if item in letters[1] and item in letters[2]:
common.append(item)
if common == []:
print()
else:
b = sorted(common)
ans = ""
for i in range(n):
ans = ans + b[i]
print(ans) |
s727170803 | p03763 | u189023301 | 1568848300 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 253 | n = int(input())
letters = [input() for _ in range(n)]
common = []
for item in letters[0]:
if item in letters[1] and item in letters[2]:
common.append(item)
b = sorted(common)
ans = ""
for i in range(n):
ans = ans + b[i]
print(ans) |
s058416419 | p03763 | u761989513 | 1564767601 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 296 | import collections
n = int(input())
s = [input() for i in range(n)]
c = []
for i in s:
c.append(collections.Counter(i))
a = c[0] & c[1]
for i in range(2, n):
a &= c[i]
ans = []
a = a.most_common()
for i in a:
for j in range(i[1]):
ans.append(i[0])
print("".join(sorted(ans))) |
s695400162 | p03763 | u488497128 | 1543523244 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 575 | import sys
def add_char(l, string):
for s in string:
l.append(s)
n = int(sys.stdin.readline().strip())
common_list = []
for i in range(n):
s = sys.stdin.readline().strip()
if i == 0:
add_char(common_list, s)
else:
tmp = []
add_char(tmp, s)
for c in common_list:... |
s231514100 | p03763 | u455317716 | 1542323613 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 377 | N = int(input())
s_list = []
s_set = []
for i in range(N):
s_list.append(list(input().split('')))
for i in s_list:
s_set.append(set(i))
result_char = set()
for i in range(N-1):
result_char = (s_set[i] & s_set[i+1] & result_char)
result_char = list(result_char).sort()
result = ''
for i in result_char:
count = m... |
s897143736 | p03763 | u200239931 | 1527435277 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3316 | 1040 | from collections import defaultdict
import math
import sys
def getinputdata():
# 配列初期化
array_result = []
data = input()
array_result.append(data.split(" "))
flg = 1
try:
while flg:
data = input()
array_temp = []
if(data != ""):
... |
s064299316 | p03763 | u863370423 | 1507646642 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 1050 | import sys
num_lines = int(input())
words = []
for i in range(num_lines):
current = input()
words.append(current.lower())
chars = []
for i in range(num_lines):
temp_list = []
for char in words[i]:
temp_list.append(char)
chars.append(temp_list)
lowest_char = 'z'
final_chars = []
found =... |
s455628956 | p03763 | u362829196 | 1492214900 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 555 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
input_line = sys.stdin.readline()
nm = input_line.split()
n = nm[0]
m = nm[1]
div = int(1e9 + 7)
input_line = sys.stdin.readline()
xn = [int(v) for v in input_line.split()]
input_line = sys.stdin.readline()
ym = [int(v) for v in input_line.split()]
i = 0
j ... |
s841260853 | p03763 | u942033906 | 1491881762 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 361 | S = input()
T = input()
q = int(input())
s = [0]
t = [0]
v = 0
for c in S:
v = (v + (ord(c) - ord("A") + 1)) % 3
s.append(v)
v = 0
for c in T:
v = (v + (ord(c) - ord("A") + 1)) % 3
t.append(v)
for i in range(q):
a,b,c,d = map(int, input().split())
x = (3 + s[b] - s[a-1]) % 3
y = (3 + t[d] - t[c-1]) % 3
if x =... |
s632343807 | p03763 | u272028993 | 1491705607 | Python | PyPy2 (5.6.0) | py | Runtime Error | 35 | 28396 | 515 | s=raw_input()
t=raw_input()
sb=[0]*(len(s)+1)
tb=[0]*(len(t)+1)
for i in xrange(len(s)):
if s[i]=="B":
sb[i+1]+=1
for i in xrange(len(s)):
sb[i+1]+=sb[i]
for i in xrange(len(t)):
if t[i]=="B":
tb[i+1]+=1
for i in xrange(len(t)):
tb[i+1]+=tb[i]
q=int(raw_input())
for i in xrange(q):
a... |
s719037216 | p03763 | u553070003 | 1491703661 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 540 | n = int(input())
max_str = sorted(input())
for _ in range(n-1):
s = sorted(input())
new_max_str = []
start_s = 0
for i in range(len(max_str)):
if max_str[i] > s[start_s]:
start_s += 1
if start_s >= len(s):
break
for j in range(start_s, len(s)):
... |
s012989272 | p03763 | u803969401 | 1491703501 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 473 | #coding:utf-8
def funuke():
N = input()
strs = []
for n in range(N):
input_lines = input()
strs.append(list(input_lines))
result = strs[0]
for n in range(1,N):
result = duplicate(result, strs[n])
result.sort()
print("".join(result))
def duplicate(xs,ys):
result ... |
s648143808 | p03763 | u553070003 | 1491703477 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 492 | n = int(input())
max_str = sorted(input())
for _ in range(n-1):
s = sorted(input())
new_max_str = []
start_s = 0
for i in range(len(max_str)):
if max_str[i] > s[start_s]:
start_s += 1
for j in range(start_s, len(s)):
if max_str[i] <= s[j]:
if max_s... |
s634766569 | p03763 | u153729035 | 1491701909 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 424 | import itertools
n=int(input());S=list(map(sorted,[input() for _ in [1]*n]))
re=[]
for s in S:
tmp=[]
for i in range(l):
li=list(itertools.combinations(s,i))
for lii in li:tmp.append(lii)
re.append(tmp)
re2=re[0]
for i in range(1,len(re)):
re2=list(set(re2)&set(re[i]))
l=max([len(r) for ... |
s858341822 | p03764 | u036104576 | 1599157296 | Python | Python (3.8.2) | py | Runtime Error | 69 | 24452 | 305 | N, M = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
xs = 0
for i in range(N):
xs += i * X[i]
xs -= (N - i - 1) * X[i]
xs %= MOD
ys = 0
for i in range(M):
ys += i * Y[i]
ys -= (M - i - 1) * Y[i]
ys %= MOD
print(xs * ys % MOD)
|
s420980286 | p03764 | u536113865 | 1537384975 | Python | Python (3.4.3) | py | Runtime Error | 206 | 32064 | 419 | ai = lambda: list(map(int, input().split()))
n,m = ai()
x = ai()
y = ai()
mod = 10**9+7
ans = 0
sx,ssx,sy,ssy = [x[0]], [x[-1]], [y[0]], [y[-1]]
for i in range(1, n):
sx.append(sx[-1] + x[i])
ssx.append(ssx[-1] + x[-i-1])
sy.append(sy[-1] + y[i])
ssy.append(ssy[-1] + y[-i-1])
a = sum(ssx[i] - sx[i] f... |
s806915624 | p03764 | u268793453 | 1532926297 | Python | Python (3.4.3) | py | Runtime Error | 74 | 18624 | 650 | n, m = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
Y = [int(i) for i in input().split()]
p = 10 ** 9 + 7
ans = 0
xc = n // 2
yc = m // 2
n -= 1
m -= 1
h = Y[-1] - Y[0]
w = X[-1] - X[0]
if n % 2 == 0 and m % 2 == 0:
ans = n * m * h * w
elif n % 2 == 1 and m % 2 == 1:
xd = X[xc] - ... |
s865147305 | p03764 | u803969401 | 1491705285 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2692 | 402 | #coding:utf-8
[n, m] = map(int, input().split(" "))
#n, m = 3,3
xs = map(int, input().split(" "))
ys = map(int, input().split(" "))
#xs = [1,3,4]
#ys = [1,3,6]
x_min, x_max = xs[0], xs[-1]
y_min, y_max = ys[0], ys[-1]
x_len = len(xs) - 2
y_len = len(ys) - 2
size = (x_max - x_min) * (y_max - y_min)
combs = pow(2, x_l... |
s878047641 | p03765 | u893063840 | 1589573923 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2110 | 115620 | 1219 | import sys
sys.setrecursionlimit(10 ** 7)
s = input()
t = input()
q = int(input())
abcd = [list(map(int, input().split())) for _ in range(q)]
rmv = ["AAA", "BBB", "AB", "BA"]
dct = {"": 0, "A": 1, "B": 2, "AA": 2, "BB": 1}
def f(word):
ln = len(word)
n = 1
while n < ln:
n *= 2
li = [""] * ... |
s705963356 | p03765 | u893063840 | 1589573560 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2110 | 115416 | 1143 | import sys
sys.setrecursionlimit(10 ** 7)
s = input()
t = input()
q = int(input())
abcd = [list(map(int, input().split())) for _ in range(q)]
rmv = ["AAA", "BBB", "AB", "BA"]
dct = {"": 0, "A": 1, "B": 2, "AA": 2, "BB": 1}
def f(word):
ln = len(word)
n = 1
while n < ln:
n *= 2
li = [""] * ... |
s727763212 | p03765 | u893063840 | 1589573507 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 49712 | 1100 | s = input()
t = input()
q = int(input())
abcd = [list(map(int, input().split())) for _ in range(q)]
rmv = ["AAA", "BBB", "AB", "BA"]
dct = {"": 0, "A": 1, "B": 2, "AA": 2, "BB": 1}
def f(word):
ln = len(word)
n = 1
while n < ln:
n *= 2
li = [""] * (2 * n - 1)
for i, e in enumerate(word,... |
s585893465 | p03765 | u952467214 | 1580078744 | Python | Python (3.4.3) | py | Runtime Error | 445 | 111608 | 668 | s = input()
t = input()
q = int(input())
abcd = [tuple(map(int,input().split())) for i in range(q)]
def to_one(word):
if len(word)==0:
return 0
if len(word)==1:
return word
if word[:2] == 'AB' or word[:2] == 'BA':
return to_one(word[2:])
if word[:3] == 'AAA':
return t... |
s211178386 | p03765 | u923181378 | 1550156756 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3316 | 242 | import math
inp=lambda:(int,input().split())
s=input()
t=input()
q=int(input())
for _ in range(q):
a,b,c,d=inp()
if abs((s[a:b].count('A')-s[a:b].count('B')))==abs((t[a:b].count('A')-t[a:b].count('B'))):
print('YES')
else:
print('NO')
|
s756643642 | p03765 | u054106284 | 1549222346 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3316 | 507 | S = input()
T = input()
N = len(S)
M = len(M)
Ss = [0]*(N+1)
Ts = [0]*(M+1)
for i in range(N):
if S[i] == "A":
temp = 1
else:
temp = -1
Ss[i+1] = Ss[i] + temp
for i in range(M):
if T[i] == "A":
temp = 1
else:
temp = -1
Ts[i+1] = Ts[i] + temp
Q = int(input())
for i in range(Q):
a, b, c, d =... |
s476193738 | p03765 | u854685751 | 1491706682 | Python | Python (3.4.3) | py | Runtime Error | 445 | 40856 | 858 | S = list(input())
T = list(input())
# S=list("BBAAABA")
# T=list("BBBA")
q = int(input())
l = []
for i in range(q):
l.append(list(map(int,input().split(" "))))
sta = [0 for i in range(len(S))]
stb = [0 for i in range(len(S))]
tta = [0 for i in range(len(T))]
tta = [0 for i in range(len(T))]
if S[0] == "A":
sta... |
s848241074 | p03766 | u794173881 | 1587842830 | Python | PyPy3 (2.4.0) | py | Runtime Error | 303 | 51056 | 484 | MOD = 10 ** 9 + 7
n = int(input())
dp = [-1] * (n + 1)
dp[0] = 1
def cnt(num):
ans = 0
if num < 0:
return 1
if dp[num] != -1:
return dp[num]
if num == 1:
dp[num] = n
return n
for i in range(n):
if i == 0:
ans += cnt(num - 1)
an... |
s536254117 | p03766 | u218843509 | 1583293087 | Python | Python (3.4.3) | py | Runtime Error | 713 | 82208 | 336 | MOD = 10**9 + 7
n = int(input())
dp = [0 for _ in range(n+1)]
dp[0], dp[1], dp[2] = 1, 1, 1
cum = [0 for _ in range(n+1)]
cum[0], cum[1], cum[2] = 1, 2, 3
for i in range(3, n+1):
dp[i] = (dp[i-1] + cum[i-3]) % MOD
cum[i] = (cum[i-1] + dp[i]) % MOD
ans = cum[n-2] * (n-1) * (n-1) + dp[n-1] * (n-1) + cum[n-2] * (n-1) + ... |
s289278549 | p03766 | u368780724 | 1575639354 | Python | PyPy3 (2.4.0) | py | Runtime Error | 266 | 71660 | 574 | import sys
readline = sys.stdin.readline
MOD = 10**9+7
N = int(readline())
dp1 = [0]*(N+1)
Dp1 = [0]*(N+1)
dp2 = [0]*(N+1)
Dp2 = [0]*(N+1)
dp1[0] = 1
Dp1[0] = 1
dp2[0] = N-1
Dp2[0] = N-1
dp1[1] = N-1
dp2[1] = (N-1)**2
dp1[2] = N-1
dp2[2] = (N-1)**2
Dp1[1] = Dp1[0] + dp1[1]
Dp2[1] = Dp2[0] + dp2[1]
Dp1[2] = Dp1[1] + dp... |
s188902313 | p03766 | u712768978 | 1571712923 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 38384 | 483 | n, x = map(int, input().split())
burger = [1]*(n+1)
patty = [1]*(n+1)
stopped = 0
for i in range(1,n+1):
burger[i] = 2*burger[i-1]+3
patty[i] = 2*patty[i-1]+1
def solve(n, x):
if x == 0:
return 0
elif x == burger[n]:
return patty[n]
elif x == burger[n-1]+1:
return patty[n-1]
elif x == burger[n-1]+2:
r... |
s764699513 | p03766 | u102461423 | 1568838485 | Python | Python (3.4.3) | py | Runtime Error | 724 | 97808 | 340 | import sys
input = sys.stdin.readline
MOD = 10**9 + 7
N = int(input())
dp = [0] * (N+1)
dp_cum = [0] * (N+1)
dp[1] = N-1; dp_cum[1] = N-1
dp[2] = N-1; dp_cum[2] = 2*(N-1)
for n in range(3,N+1):
dp[n] = dp[n-1] + dp_cum[n-3]
dp_cum[n] = (dp_cum[n-1] + dp[n]) % MOD
answer = sum(dp[1:N])*N + dp[-1] + 1
answer ... |
s132073990 | p03766 | u236127431 | 1556252686 | Python | PyPy3 (2.4.0) | py | Runtime Error | 336 | 56044 | 304 | n=int(input())
mod=10**9+7
dp=[0]*(n+1)
S=[0]*(n+1)
dp[0]=1
dp[1]=1
dp[2]=1
S[0]=1
for i in range(n):
if i+1>=3:
dp[i+1]=2*dp[i]-dp[i-1]+dp[i-2]
dp[i+1]%=mod
S[i+1]=S[i]+(n-1)*dp[i]
S[i+1]%=mod
ans=S[n]
for i in range(1,n):
ans+=((n-1)**2)*dp[i-1]
ans%=mod
print(ans)
#print(S)
#print(dp) |
s583215265 | p03766 | u934019430 | 1491799373 | Python | Python (3.4.3) | py | Runtime Error | 1520 | 82616 | 448 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from random import *
def readln():
_res = list(map(int,str(input()).split(' ')))
return _res
p = 1000000000 + 7
n = readln()[0]
f = [0 for i in range(0,n+1)]
f[1] = n
f[2] = n * n
s = f[:]
s[2] = f[1] + f[2]
for i in range(3,n+1):
f[i] = f[i-1] + (n - 1) * ... |
s766226663 | p03766 | u104282757 | 1491711072 | Python | PyPy3 (2.4.0) | py | Runtime Error | 184 | 40304 | 574 | import numpy as np
n = int(input())
if n == 1:
print(1)
else:
res_v = np.zeros(n + 1, dtype='int64')
res_v_cumsum = np.zeros(n + 1, dtype='int64')
res_v[0] = 0
res_v[1] = 1
res_v[2] = 1
res_v_cumsum[0] = 0
res_v_cumsum[1] = 1
res_v_cumsum[2] = 2
M = 1000000007
for k in ran... |
s722599382 | p03766 | u104282757 | 1491710716 | Python | Python (3.4.3) | py | Runtime Error | 2112 | 23468 | 492 | import numpy as np
n = int(input())
res_v = np.zeros(n + 1, dtype='int64')
res_v_cumsum = np.zeros(n + 1, dtype='int64')
res_v[0] = 0
res_v[1] = 1
res_v[2] = 1
res_v_cumsum[0] = 0
res_v_cumsum[1] = 1
res_v_cumsum[2] = 2
M = 1000000007
for k in range(3, n):
res_v[k] = (1 + res_v_cumsum[k-1] - res_v[k-2]) % M
... |
s345761693 | p03766 | u104282757 | 1491710680 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 473 | n = int(input())
res_v = np.zeros(n + 1, dtype='int64')
res_v_cumsum = np.zeros(n + 1, dtype='int64')
res_v[0] = 0
res_v[1] = 1
res_v[2] = 1
res_v_cumsum[0] = 0
res_v_cumsum[1] = 1
res_v_cumsum[2] = 2
M = 1000000007
for k in range(3, n):
res_v[k] = (1 + res_v_cumsum[k-1] - res_v[k-2]) % M
res_v_cumsum[k] = (... |
s465250732 | p03766 | u692632484 | 1491705529 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 10904 | 110 | INF=10**9+7
N=int(input())
a=[0 for i in range(N)]
a[0]=1
for i in range(N):
a[i]=sum(a)%INF
print(a[n]%INF) |
s122631413 | p03767 | u125545880 | 1600740320 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9148 | 273 | def main():
N, K = map(int, input().split())
h = []
for _ in range(N):
h.append(int(input()))
h.sort()
ans = pow(10, 10)
for k in range(N-K+1):
ans = min(ans, abs(h[k]-h[K-1+k]))
print(ans)
if __name__ == "__main__":
main()
|
s448286217 | p03767 | u481250941 | 1597502268 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8948 | 1277 | #
# agc012 a
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
out = sys.stdo... |
s001477222 | p03767 | u481250941 | 1597501627 | Python | Python (3.8.2) | py | Runtime Error | 74 | 16764 | 1272 | #
# agc012 a
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
out = sys.stdout.... |
s703358437 | p03767 | u446371873 | 1595561908 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9140 | 134 | N = int(input())
li = list(map(int.input().split()))
ans = 0
li.sort()
for i in range(3*N):
if i%3 == 1:
ans += li[i]
print(ans) |
s290790292 | p03767 | u961683878 | 1591766855 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 295 | #! /usr/bin/env python3
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
N, *A = map(int, read().split())
A = sorted(A)
A = A[N:-N]
print(sum(A))
|
s137213718 | p03767 | u958506960 | 1591137007 | Python | Python (3.4.3) | py | Runtime Error | 206 | 37084 | 234 | n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
x = len(a) // n
l = []
for i in range(n):
for j in range(x):
ll.append(a[i+j::x-1])
ans = 0
for i in range(n):
ans += l[i][1]
print(ans) |
s144718765 | p03767 | u863442865 | 1590450403 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3316 | 500 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
import ma... |
s781547219 | p03767 | u536034761 | 1589568673 | Python | Python (3.4.3) | py | Runtime Error | 16 | 2940 | 88 | N = int(input())
A = list(map(int, input().split()))
A.sort()
print(sum(A[N + 1:2N + 1]) |
s584232377 | p03767 | u067227603 | 1589061966 | Python | Python (3.4.3) | py | Runtime Error | 207 | 39492 | 99 | N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[1:2*n:2])) |
s769990119 | p03767 | u067227603 | 1589061887 | Python | Python (3.4.3) | py | Runtime Error | 207 | 39492 | 98 | N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[1:2*n:2])) |
s002880500 | p03767 | u549161102 | 1588518074 | Python | Python (3.4.3) | py | Runtime Error | 224 | 39492 | 131 | N = int(input())
a = [int(i) for i in input().split()]
a = a.sort(reverse=True)
ans = sum(a[2*i] for i in range(1,N+1))
print(ans) |
s376681839 | p03767 | u549161102 | 1588510296 | Python | Python (3.4.3) | py | Runtime Error | 211 | 37084 | 136 | N = int(input())
a = [int(i) for i in input().split()]
a = a.sort(reverse=True)
for i in range(1,N+1):
ans = sum(a[2*i-1])
print(ans) |
s220473824 | p03767 | u549161102 | 1588509745 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 149 | N = int(input())
a = [int(i) for i in input().split()]
a = a.sort(reverse=True)
for i in range(N):
suma[3*N-2*(i+1)])
ans = sum(array)
print(ans)
|
s527958641 | p03767 | u549161102 | 1588509116 | Python | Python (3.4.3) | py | Runtime Error | 91 | 37084 | 164 | N = int(input())
a = [list(map(int, input().split()))]
a = a.sort()
array = []
for i in range(N):
array = array.append(a[3*N-2*(i+1)])
ans = sum(array)
print(ans) |
s374358538 | p03767 | u506549878 | 1587138331 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 192 | n = int(input())
data = list(map(int,input().split()))
data = sorted(data, reverse=True)
sum = 0
while data != []
del data[0]
del data[-1]
sum += data[0]
del data[0]
print(sum) |
s754453629 | p03767 | u519939795 | 1586887728 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 3 | Not |
s925318079 | p03767 | u757584836 | 1586394505 | Python | Python (3.4.3) | py | Runtime Error | 47 | 27612 | 122 | n = int(input())
v = map(int, input().split())
v.sort(reverse = True)
s = 0
for i in range(0, n):
s += v[1+2*i]
print(s) |
s182007970 | p03767 | u185405877 | 1585196797 | Python | Python (3.4.3) | py | Runtime Error | 225 | 37084 | 171 | s=int(input())
i= list(map(int, input().split()))
i.sort(reverse=True)
sum=0
ks=0
for j in range(s):
sum+=i[j+1]
for j in range(n,2*n):
ks+=i[j]
print(max(sum,ks)) |
s153697162 | p03767 | u089142196 | 1585095373 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 92 | N=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print(sum(N//3:2N//3)) |
s497255719 | p03767 | u260036763 | 1584925226 | Python | Python (3.4.3) | py | Runtime Error | 238 | 39492 | 123 | N = int(input())
a = sorted(map(int, input().split())) [::-1]
ans = 0
for i in range(0, 3*N, 2):
ans += a[i+1]
print(ans) |
s833119494 | p03767 | u260036763 | 1584925134 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 122 | N = int(input())
a = sorted(map(int, input().split())) [::-1]
ans = 0
for i in range(0, 3N, 2):
ans += a[i+1]
print(ans) |
s186593543 | p03767 | u035445296 | 1584541796 | Python | Python (3.4.3) | py | Runtime Error | 140 | 37084 | 146 | n = int(input())
a = list(map(int, input().split()))
a = a[:n+1]
a.sort()
ans = 0
for i in range(n*2):
if (i)%2 == 0:
ans += a[i]
print(ans) |
s917636313 | p03767 | u269969976 | 1584244430 | Python | Python (3.4.3) | py | Runtime Error | 212 | 37084 | 182 | # coding: utf-8
n = int(input().rstrip())
numbers = list(reversed(sorted(map(int, input().rstrip().split(" ")))))
ans = 0
for i in range(n):
ans += numbers[n*i+1]
print(ans)
|
s947455235 | p03767 | u617037231 | 1581376818 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 175 | N = int(input())
L = list(map(int,input().split()))
L.sort(reverse = True)
res = 0
i = 1
#L[1] + L[4] + ...
while i < len(L):
res += L[i]
i += 3
return res
|
s561582612 | p03767 | u421499233 | 1580239686 | Python | Python (3.4.3) | py | Runtime Error | 205 | 39492 | 165 | N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = 0
for i in range(N):
li = [A[2*i],A[2*i+1],A[3*N+i-2]]
ans += li[1]
print(ans) |
s368786402 | p03767 | u273010357 | 1579398536 | Python | Python (3.4.3) | py | Runtime Error | 365 | 37084 | 305 | n = int(input())
a = list(map(int, input().split()))
a.sort()
#強さを出力
def T(x,y,z):
ma = max(x,y,z)
mi = min(x,y,z)
return (x+y+z) - (ma+mi)
b = a[0::2]
c = a[1::2]
ans = 0
for i in range(0,3*n//2,3):
#print(b[i:i+3],c[i:i+3])
ans += T(*b[i:i+3]) + T(*c[i:i+3])
print(ans) |
s830859389 | p03767 | u273010357 | 1579398503 | Python | Python (3.4.3) | py | Runtime Error | 479 | 37084 | 304 | n = int(input())
a = list(map(int, input().split()))
a.sort()
#強さを出力
def T(x,y,z):
ma = max(x,y,z)
mi = min(x,y,z)
return (x+y+z) - (ma+mi)
b = a[0::2]
c = a[1::2]
ans = 0
for i in range(0,3*n//2,3):
print(b[i:i+3],c[i:i+3])
ans += T(*b[i:i+3]) + T(*c[i:i+3])
print(ans) |
s279349842 | p03767 | u423585790 | 1578085139 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 1046 | #!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return... |
s815435596 | p03767 | u423585790 | 1578085118 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38256 | 1043 | #!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return... |
s530329673 | p03767 | u905582793 | 1577065513 | Python | Python (3.4.3) | py | Runtime Error | 205 | 39492 | 90 | n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print(sum[1:2*n+2:2]) |
s523279023 | p03767 | u934052933 | 1576002735 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 871 | from typing import Tuple, List
def main()->None:
# ヒント見たけど参考にしてない
N, x = map(int, input().split())
a:List[int] = list(map(int, input().split()))
sorted_a:List[int] = sorted(a) # 小さい順にならべる
count:int = 0 # 何回配ったか
for d in sorted_a:
x -= d
if x < 0: # 持ってた量が配る総量より少なかった時
... |
s622289618 | p03767 | u846694620 | 1575603943 | Python | Python (3.4.3) | py | Runtime Error | 200 | 37084 | 128 | n = int(input())
a = map(int, input().split())
a = reversed(sorted(a))
m = 0
for i in range(n, 2 * n):
m += a[i]
print(m) |
s916768560 | p03767 | u633548583 | 1573336199 | Python | Python (3.4.3) | py | Runtime Error | 203 | 37084 | 126 | n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
for i in range(n):
sum=sum(a[2*i+1])
print(sum) |
s285061747 | p03767 | u633548583 | 1573336101 | Python | Python (3.4.3) | py | Runtime Error | 201 | 37084 | 155 | n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
if n>=2:
for i in range(n):
sum=sum(a[2*i+1])
else:
print(a[1])
|
s584350005 | p03767 | u840310460 | 1572994083 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 159 | N = int(input())
a = [int(i) for i in input().split()]
s_sort = sorted(a, reverse=True)
score = 0
for i in range(1, 3N, 2):
score += s_sort[i]
print(score) |
s415637451 | p03767 | u066455063 | 1571623257 | Python | Python (3.4.3) | py | Runtime Error | 250 | 37084 | 194 | N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
A = []
n = N * 3
for i in range(1, n+1, 2):
A.append(a[i])
for i in range(N):
ans += A[i]
print(ans)
|
s149200129 | p03767 | u105302073 | 1571192585 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 160184 | 256 | N = int(input())
A = list(sorted(list(map(int, input().split()))))
# N = 2
# A = list(sorted([5,2,8,5,1,5]))
group = []
ret = 0
for a in A:
print(A)
group.append([A.pop(0), A.pop(), A.pop()])
for g in group:
ret += list(sorted(g))[1]
print(ret) |
s647535502 | p03767 | u420522278 | 1568999816 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 137 | n = int(input())
a = input().split()
a = [int(i) for i in a]
candidate = a[n:len(a)+1]
print(sum([candidate[i] for i in (1 , 2n+1, 2)])) |
s472440967 | p03767 | u799479335 | 1568150867 | Python | Python (3.4.3) | py | Runtime Error | 48 | 27612 | 169 | N = int(input())
a_s = input().split()
for i in ragne(3*N):
a_s[i] = int(a_s[i])
a_s = sorted(a_s)
a_1 = a_s[:N]
a_2 = a_s[N:]
ans = sum(a_2[0::2])
print(ans)
|
s085563197 | p03767 | u799479335 | 1568150724 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 166 | N = int(input)
a_s = input().split()
for i in ragne(3*N):
a_s[i] = int(a_s[i])
a_s = sorted(a_s)
a_1 = a_s[:N]
a_2 = a_s[N:]
ans = sum(a_2[0::2])
print(ans) |
s100794461 | p03767 | u284999381 | 1565986574 | Python | Python (3.4.3) | py | Runtime Error | 203 | 37084 | 152 | ###ABC 012A
N = input()
A = list(map(int, input().split()))
A = sorted(A,reverse = True)
ans = 0
for i in range(1, 2*N, 2):
ans += A[i]
print(ans) |
s973855721 | p03767 | u284999381 | 1565986510 | Python | Python (3.4.3) | py | Runtime Error | 207 | 37084 | 126 | N = input()
A = list(map(int, input().split()))
A = sorted(A,reverse = True)
ans = 0
for i in range(1, 2*N, 2):
ans += A[i]
|
s508441487 | p03767 | u284999381 | 1565986458 | Python | Python (3.4.3) | py | Runtime Error | 205 | 37084 | 128 | N = input()
A = list(map(int, input().split()))
A = sorted(A,reverse = True)
ans = 0
for i in range(1, 2*N, 2):
ans += A[i]
|
s256719728 | p03767 | u469063372 | 1560624136 | Python | Python (3.4.3) | py | Runtime Error | 224 | 37084 | 122 | n = int(input())
a = list(map(int, input().split()))
a.sort()
s = 0
for i in range(n):
s += a[i * 2 + n]
print(sum(s)) |
s364697909 | p03767 | u227082700 | 1560103770 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 101 | n,a=int(input()),sorted(list(map(int,input().split())))print(sum([a[i]*(i%3==1)for i in range(3*n)])) |
s996406559 | p03767 | u095756391 | 1558847455 | Python | Python (3.4.3) | py | Runtime Error | 202 | 37084 | 222 | n = int(input())
a = list(map(int, input().split()))
sorted_a = sorted(a)
reversed_a = reversed(a)
aa = []
for i in range(3*n):
sorted_a.pop(-1)
reversed_a.pop(-1)
aa.append(sorted_a.pop(-1))
print(sum(aa)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.