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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s983495764 | p00275 | u546285759 | 1488857188 | Python | Python3 | py | Runtime Error | 0 | 0 | 496 | while True:
N = int(input())
if N==0:break
dataset = input()
mens = ["" for _ in range(N)]
i = 0
p = ""
while dataset:
if i == N: i = 0
card, dataset = dataset[0], dataset[1:]
if card == "M":
mens[i] += card
elif card == "S":
p += card ... |
s168434568 | p00276 | u766477342 | 1415277508 | Python | Python3 | py | Runtime Error | 0 | 0 | 254 | for i in range(int(input())):
res = 0
c,a,n = list(map(int,input().split()))
res = min(n,a,c)
c -= res
a -= res
if c >= 2 and a >= 1:
cca += min(c//2,a)
c -= cca*2
if c >=3:
res += c//3
print(res) |
s592149604 | p00276 | u221679506 | 1467542854 | Python | Python3 | py | Runtime Error | 0 | 0 | 510 | for i in range(int(input())):
c,a,n = map(int,input().split())
cnt1 = min(c,a,n)
c -= cnt1
a -= cnt1
cnt2 = min(c//2,a)
c -= cnt2*2
cnt3 = c//3
print(cnt1+cnt2+cnt3)
#for i in range(int(input())):
# c,a,n = map(int,input().split())
# cnt = 0
# while True:
# if c<1 or a<1 or n<1:
# b... |
s621912631 | p00277 | u494314211 | 1492292507 | Python | Python3 | py | Runtime Error | 0 | 0 | 1490 | N, R, L = list(map(int, input().split(" ")))
i = 1
while i<N*2:
i<<=1
t = [0 for j in range(N)]
time = [0 for j in range()]
def foo(a,x):
newmax = -1
def bar(k,a,x,l,r):
mid = a<(l+r)//2
if r-l == 1:
t[k] += x
newmax = r
return(t[k])
elif a<mid:
t[k] = max(bar(k*2,a,x,l,mid), t[k])
else:
... |
s022671770 | p00277 | u494314211 | 1492293097 | Python | Python3 | py | Runtime Error | 0 | 0 | 783 | N, R, L = list(map(int, input().split(" ")))
i = 1
while i<N*2:
i<<=1
tree = [0 for j in range(i)]
time = [0 for j in range(N)]
def foo(a,x):
newmax = -1
def bar(k,a,x,l,r):
mid = (l+r)//2
print(l,mid,r)
if r-l == 1:
tree[k] += x
newmax = r
return(tree[k])
elif a<mid:
tree[k] = max(bar(k*2,a... |
s392940488 | p00277 | u811733736 | 1506600154 | Python | Python3 | py | Runtime Error | 2590 | 9324 | 1543 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0282
TLE
"""
import sys
from sys import stdin
from heapq import heappop, heappush
input = stdin.readline
pq = [] # list of entries arranged in a heap
entry_finder = {} # mapping of tasks to entri... |
s107147045 | p00282 | u119127920 | 1521192638 | Python | Python3 | py | Runtime Error | 40 | 6800 | 1134 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursi... |
s019847685 | p00284 | u352394527 | 1530278400 | Python | Python3 | py | Runtime Error | 20 | 5596 | 495 | def atob(a, b):
if a == b:
return 0
if a == 0:
ret = 0
while b:
if b % 2:
ret += 1
b //= 2
return ret
acc = 1
tmp = a
while tmp:
if tmp % 2:
break
tmp //= 2
acc *= 2
return 1 + min(atob(a + acc, b), atob(a - acc, b))
n = int(input())
for _ in range(n... |
s442509327 | p00285 | u975539923 | 1458053275 | Python | Python | py | Runtime Error | 0 | 0 | 743 | def get_energy(bm, bw):
tmp = abs(bm-bw)
return tmp * ((tmp-30) ** 2)
def calc(bsa, bla):
value = 0
if not bsa:
return 0
bs = bsa.pop()
sz = len(bla)
for i in range(sz):
bl = bla.pop(i)
tmp = get_energy(bl, bs) + calc(bsa, bla)
if tmp > value:
v... |
s761868307 | p00290 | u301729341 | 1481459535 | Python | Python3 | py | Runtime Error | 0 | 0 | 43 | d,c = map(int,input(),split())
print(d * c) |
s551921895 | p00291 | u334031393 | 1442472809 | Python | Python | py | Runtime Error | 0 | 0 | 148 | values = [1, 5, 10, 50, 100, 500]
coins = map(int, raw_input().split())
total = sum(map(lambda a,b: a * b, zip(value, coins)))
print total>999?1:0 |
s147184035 | p00292 | u116766943 | 1422603668 | Python | Python3 | py | Runtime Error | 0 | 0 | 143 | import sys
T = input()
for i in range(0,T):
K,P = raw_input().split(' ')
K = int(K)
P = int(P)
print ( K % P - 1 + P ) % P + 1 |
s536916821 | p00294 | u724548524 | 1526885884 | Python | Python3 | py | Runtime Error | 20 | 5604 | 200 | n, m, p = map(int,input().split())
a = sorted([(int(input()) - p) % n for _ in range(m)])
print(min(a[-1], n - a[0], min([a[i] + n - a[i + 1] + min(a[i], n - a[i + 1]) for i in range(m - 1)])) * 100)
|
s464228405 | p00294 | u724548524 | 1526885950 | Python | Python3 | py | Runtime Error | 20 | 5608 | 234 | n, m, p = map(int,input().split())
a = sorted([(int(input()) - p) % n for _ in range(m)])
print(min(a[-1], n - a[0], min([a[i] + n - a[i + 1] + min(a[i], n - a[i + 1]) for i in range(m - 1)])) * 100 if m > 0 else min(a[0], n - a[0]))
|
s391730861 | p00296 | u369093003 | 1501939962 | Python | Python3 | py | Runtime Error | 0 | 0 | 345 | N,M,Q = map(int,input().split())
a = []
q = []
b = 0
y = 0
a.append(map(int,inout().split(' ')))
q.append(map(int,inout().split(' ')))
for i in range(M):
x = a[b]
if x % 2 == 0:
y += x
if y > N:
y -= N
else:
y -= x
if y < 0:
y = n + y
b += 1
b = 0
for j in range(Q):
z = q[b]
if z!=y:
print(1)
... |
s339707120 | p00296 | u369093003 | 1501940623 | Python | Python3 | py | Runtime Error | 0 | 0 | 346 | N,M,Q = map(int,input().split())
a = []
q = []
b = 0
y = 0
for c in range(M):
a.append(input())
for d in range(Q):
q.append(input())
for i in range(M):
x = a[b]
if x % 2 == 0:
y += x
if y > N:
y -= N
else:
y -= x
if y < 0:
y = n + y
b += 1
b = 0
for j in range(Q):
z = q[b]
if z!=y:
print(1)... |
s801662720 | p00296 | u369093003 | 1501940742 | Python | Python3 | py | Runtime Error | 0 | 0 | 349 | N,M,Q = map(int,input().split(' '))
a = []
q = []
b = 0
y = 0
for c in range(M):
a.append(input())
for d in range(Q):
q.append(input())
for i in range(M):
x = a[b]
if x % 2 == 0:
y += x
if y > N:
y -= N
else:
y -= x
if y < 0:
y = n + y
b += 1
b = 0
for j in range(Q):
z = q[b]
if z!=y:
print... |
s315685177 | p00296 | u369093003 | 1501940880 | Python | Python3 | py | Runtime Error | 0 | 0 | 399 | N,M,Q = map(int,input().split(' '))
a = []
q = []
b = 0
y = 0
for c in range(M):
a.append(map(int, raw_input().split(' ')))
for d in range(Q):
q.append(map(int, raw_input().split(' ')))
for i in range(M):
x = a[b]
if x % 2 == 0:
y += x
if y > N:
y -= N
else:
y -= x
if y < 0:
y = n + y
b += 1
b =... |
s804146388 | p00296 | u369093003 | 1501940906 | Python | Python3 | py | Runtime Error | 0 | 0 | 393 | N,M,Q = map(int,input().split(' '))
a = []
q = []
b = 0
y = 0
for c in range(M):
a.append(map(int, raw_input().split()))
for d in range(Q):
q.append(map(int, raw_input().split()))
for i in range(M):
x = a[b]
if x % 2 == 0:
y += x
if y > N:
y -= N
else:
y -= x
if y < 0:
y = n + y
b += 1
b = 0
fo... |
s929227794 | p00296 | u811733736 | 1507470480 | Python | Python3 | py | Runtime Error | 0 | 0 | 789 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0301
WA
"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline
def main(args):
# members = deque(list(range(10)))
# numbers = [2, 6, 5, 18, 3]
# queries = [3, 0, 5]
N, M, Q = map(in... |
s967423596 | p00296 | u352394527 | 1529827998 | Python | Python3 | py | Runtime Error | 20 | 5628 | 366 | from bisect import bisect_left as bl
n, m, q = map(int, input().split())
lst = [i for i in range(n)]
alst = list(map(int, input().split()))
ind = 0
for a in alst:
if a % 2 == 0:
ind += a
else:
ind -= a
ind = ind % len(lst)
lst.pop(ind)
ind = ind % len(lst)
qlst = list(map(int, input().split()))
for ... |
s025403193 | p00297 | u352394527 | 1545583807 | Python | Python3 | py | Runtime Error | 30 | 5748 | 3645 | class MinTree:
def __init__(self, iterable):
self.iter_size = self.get_size(iterable)
self.size = self.iter_size * 2 - 1
self.value = [None] * self.size
for i, v in enumerate(iterable):
self.value[self.iter_size + i - 1] = v
self.set_value(0)
self.range = [None] * self.size
self.set_... |
s682546104 | p00297 | u352394527 | 1545585314 | Python | Python3 | py | Runtime Error | 20 | 5748 | 3530 | class MinTree:
def __init__(self, iterable):
self.iter_size = self.get_size(iterable)
self.size = self.iter_size * 2 - 1
self.value = [None] * self.size
for i, v in enumerate(iterable):
self.value[self.iter_size + i - 1] = v
self.set_value(0)
self.range = [None] * self.size
self.set_... |
s740032737 | p00297 | u567380442 | 1425079200 | Python | Python3 | py | Runtime Error | 30 | 6956 | 1491 | from math import ceil
class sqrt_tree:
def __init__(self,dat,f):
self.dat = dat
self.sq = int(len(dat) ** 0.5)
self.f = f
self.baqet = [self.f(dat[i * self.sq:(i + 1) * self.sq]) for i in range(self.sq)]
#query
def q(self,l,r):
r += 1
if ceil(l / self.sq)... |
s755521387 | p00297 | u567380442 | 1425080007 | Python | Python3 | py | Runtime Error | 30 | 6952 | 1451 | from math import ceil
class sqrt_tree:
def __init__(self,dat,f):
self.dat = dat
self.sq = int(len(dat) ** 0.5)
self.f = f
self.baqet = [self.f(dat[i * self.sq:(i + 1) * self.sq]) for i in range(self.sq)]
#query
def q(self,l,r):
r += 1
if ceil(l / self.sq)... |
s703098376 | p00297 | u727466163 | 1440570720 | Python | Python | py | Runtime Error | 10 | 6464 | 618 | data = map(int, raw_input().split())
stars = data[0]
lightrange = data[1]
a = []
for i in range(stars):
a.append(map(int, raw_input().split()))
a.sort(key=lambda x:x[2])
scale = 0
while(len(a)>1):
minx=maxx=a[0][0]
miny=maxy=a[0][1]
k=1
while(a[k][2]<=a[0][2] + lightrange):
if (a[k][0]<minx ... |
s247031682 | p00297 | u727466163 | 1440570843 | Python | Python | py | Runtime Error | 10 | 6488 | 710 | data = map(int, raw_input().split())
stars = data[0]
lightrange = data[1]
a = []
for i in range(stars):
a.append(map(int, raw_input().split()))
a.sort(key=lambda x:x[2])
scale = 0
try:
while(len(a)>1):
minx=maxx=a[0][0]
miny=maxy=a[0][1]
k=1
while(a[k][2]<=a[0][2] + lightrange):
... |
s036756954 | p00297 | u727466163 | 1440571276 | Python | Python | py | Runtime Error | 10 | 6396 | 618 | data = map(int, raw_input().split())
stars = data[0]
lightrange = data[1]
a = []
for i in range(stars):
a.append(map(int, raw_input().split()))
a.sort(key=lambda x:x[2])
scale = 0
while(len(a)>1):
minx=maxx=a[0][0]
miny=maxy=a[0][1]
k=1
while(a[k][2]<=a[0][2] + lightrange):
if (a[k][0]<minx ... |
s426033718 | p00297 | u727466163 | 1440571847 | Python | Python | py | Runtime Error | 10 | 6496 | 651 | data = map(int, raw_input().split())
stars = data[0]
lightrange = data[1]
a = []
for i in range(stars):
a.append(map(int, raw_input().split()))
a.sort(key=lambda x:x[2])
scale = 0
while(len(a)>1):
minx=maxx=a[0][0]
miny=maxy=a[0][1]
k=1
while(a[k][2]<=a[0][2] + lightrange):
if (a[k][0]<minx ... |
s771178132 | p00297 | u727466163 | 1440571898 | Python | Python | py | Runtime Error | 10 | 6496 | 660 | data = map(int, raw_input().split())
stars = data[0]
lightrange = data[1]
a = []
for i in range(stars):
a.append(map(int, raw_input().split()))
a.sort(key=lambda x:x[2])
scale = 0
while(len(a)>1):
minx=maxx=a[0][0]
miny=maxy=a[0][1]
k=1
while(a[k][2]<=a[0][2] + lightrange):
if (a[k][0]<minx ... |
s951387215 | p00297 | u727466163 | 1440572152 | Python | Python | py | Runtime Error | 10 | 6488 | 618 | data = map(int, raw_input().split())
stars = data[0]
lightrange = data[1]
a = []
for i in range(stars):
a.append(map(int, raw_input().split()))
a.sort(key=lambda x:x[2])
scale = 0
while(len(a)>1):
minx=maxx=a[0][0]
miny=maxy=a[0][1]
l=1
while (a[l][2] <= a[0][2] + lightrange):
if(a[l][0]<min... |
s773029344 | p00297 | u727466163 | 1440573845 | Python | Python | py | Runtime Error | 10 | 6456 | 455 | data = map(int, raw_input().split())
stars = data[0]
lightrange = data[1]
a = []
for i in range(stars):
a.append(map(int, raw_input().split()))
a.sort(key=lambda x:x[2])
scale = []
while(len(a)>1):
k=0
x=[]
y=[]
while(a[k][2]<=a[0][2] + lightrange):
x.append(a[k][0])
y.append(a[k][1]... |
s335188220 | p00297 | u727466163 | 1440574245 | Python | Python | py | Runtime Error | 10 | 6420 | 593 | data = map(int, raw_input().split())
stars = data[0]
lightrange = data[1]
a = []
for i in range(stars):
a.append(map(int, raw_input().split()))
a.sort(key=lambda x:x[2])
scale = []
minlight = -1
while(len(a)>1):
if a[0] == minlight:
del a[0]
else :
k=0
x=[]
y=[]
while... |
s194929724 | p00297 | u727466163 | 1440574371 | Python | Python | py | Runtime Error | 10 | 6400 | 625 | data = map(int, raw_input().split())
stars = data[0]
lightrange = data[1]
a = []
for i in range(stars):
a.append(map(int, raw_input().split()))
a.sort(key=lambda x:x[2])
scale = []
minlight = -1
while(len(a)>1):
if a[0] == minlight:
del a[0]
else :
k=0
x=[]
y=[]
while... |
s082712707 | p00297 | u797673668 | 1456397778 | Python | Python3 | py | Runtime Error | 30 | 8208 | 1108 | from functools import reduce
class Bound:
min_x = 2000001
min_y = 2000001
max_x = -1
max_y = -1
def add(self, x, y):
if self.min_x > x: self.min_x = x
if self.min_y > y: self.min_y = y
if self.max_x < x: self.max_x = x
if self.max_y < y: self.max_y = y
def exp... |
s169101889 | p00297 | u566872786 | 1512383114 | Python | Python3 | py | Runtime Error | 0 | 0 | 623 | N,d = map(int,input().split())
L = [list(map(int,input().split())) for i in range(N)]
L = sorted(L,key=lambda x:x[2])
def get_square(L):
if not L or len(L) == 0:return 0
x=[L[0][0],L[0][0]]
y=[L[0][1],L[0][1]]
for i in L:
if i[0] < x[0]:x[0] = i[0]
if i[0] > x[1]:x[1] = i[0]
if i[1] < y[0]:y[0] = i... |
s902303997 | p00297 | u566872786 | 1512383475 | Python | Python3 | py | Runtime Error | 0 | 0 | 541 | L = sorted(L,key=lambda x:x[2])
def get_square(L):
if not L or len(L) == 0:return 0
x=[L[0][0],L[0][0]]
y=[L[0][1],L[0][1]]
for i in L:
if i[0] < x[0]:x[0] = i[0]
elif i[0] > x[1]:x[1] = i[0]
if i[1] < y[0]:y[0] = i[1]
elif i[1] > y[1]:y[1] = i[1]
return (x[1] - x[0]) * (y[1] - y[0])
result ... |
s677082745 | p00297 | u566872786 | 1512445347 | Python | Python3 | py | Runtime Error | 0 | 0 | 1058 | from sys import stdin
from operator import itemgetter
def get_square(L):
if not L or len(L) == 0:return 0
x=[L[0][0][0],L[0][0][1]]
y=[L[0][1][0],L[0][1][1]]
for i in L:
if i[0][0] < x[0]:x[0] = i[0][0]
if i[0][1] > x[1]:x[1] = i[0][1]
if i[1][0] < y[0]:y[0] = i[1][0]
if i[1][1] > y[1]:y[1] = i... |
s430393738 | p00297 | u566872786 | 1512445458 | Python | Python3 | py | Runtime Error | 0 | 0 | 1052 | from sys import stdin
from operator import itemgetter
def get_square(L):
if not L or len(L) == 0:return 0
x=[L[0][0][0],L[0][0][1]]
y=[L[0][1][0],L[0][1][1]]
for i in L:
if i[0][0] < x[0]:x[0] = i[0][0]
if i[0][1] > x[1]:x[1] = i[0][1]
if i[1][0] < y[0]:y[0] = i[1][0]
if i[1][1] > y[1]:y[1] = i... |
s354832406 | p00297 | u566872786 | 1512445505 | Python | Python3 | py | Runtime Error | 0 | 0 | 1058 | from sys import stdin
from operator import itemgetter
def get_square(L):
if not L or len(L) == 0:return 0
x=[L[0][0][0],L[0][0][1]]
y=[L[0][1][0],L[0][1][1]]
for i in L:
if i[0][0] < x[0]:x[0] = i[0][0]
if i[0][1] > x[1]:x[1] = i[0][1]
if i[1][0] < y[0]:y[0] = i[1][0]
if i[1][1] > y[1]:y[1] = i... |
s600418840 | p00297 | u350064373 | 1512456193 | Python | Python3 | py | Runtime Error | 20 | 5684 | 456 | from sys import stdin
from operator import itemgetter as it
D={}
result=[]
_,d=map(int,input().split())
for i in stdin.readlines():
x,y,b=map(int,i.split())
if b not in D:D[b]=[]
D[b].append((x,y))
for i in range(max(D)-d+1):
l=[]
for s in range(d+1):
if i+s in D:l+=D[i+s]
if len(l)>1:
... |
s583576369 | p00297 | u350064373 | 1512456963 | Python | Python3 | py | Runtime Error | 20 | 5680 | 456 | from sys import stdin
from operator import itemgetter as it
D={}
result=[]
_,d=map(int,input().split())
for i in stdin.readlines():
x,y,b=map(int,i.split())
if b not in D:D[b]=[]
D[b].append((x,y))
for i in range(max(D)-d+1):
l=[]
for s in range(d+1):
if i+s in D:l+=D[i+s]
if len(l)>1:
... |
s301626262 | p00297 | u350064373 | 1512457323 | Python | Python3 | py | Runtime Error | 20 | 5692 | 480 | from sys import stdin
from operator import itemgetter as it
D={}
result=[]
N,d=map(int,input().split())
for i in stdin.readlines():
x,y,b=map(int,i.split())
if b not in D:D[b]=[]
D[b].append((x,y))
for i in range(max(D)-d+1):
l=[]
for s in range(d+1):
if i+s in D:l+=D[i+s]
if len(l)>1:
... |
s453566671 | p00297 | u350064373 | 1512458771 | Python | Python3 | py | Runtime Error | 20 | 5680 | 427 | from sys import stdin
from operator import itemgetter as it
D={}
result=[]
N,d=map(int,input().split())
for i in stdin.readlines():
x,y,b=map(int,i.split())
if b not in D:D[b]=[]
D[b].append((x,y))
for i in range(max(D)-d+1):
l=[]
for s in range(d+1):
if i+s in D:l+=D[i+s]
if len(l)>1:re... |
s271331721 | p00297 | u566872786 | 1512460446 | Python | Python3 | py | Runtime Error | 0 | 0 | 851 | from sys import stdin
from operator import itemgetter
from itertools import takewhile
from random import randint
from array import array
def get_square(x_min,x_max,y_min,y_max):
return (x_max - x_min) * (y_max - y_min)
N,d = map(int,input().split())
L = [tuple(map(int,i.split())) for i in make_data(N)]
B = sorted(s... |
s458524279 | p00297 | u566872786 | 1512471086 | Python | Python3 | py | Runtime Error | 0 | 0 | 2471 | from sys import stdin
from operator import itemgetter
from itertools import takewhile
from random import randint
from array import array
MAX = 200000000
class Point:
def __init__(self,x=-1,y=-1,b=-1):
self.x=x
self.y=y
self.b=b
class Points:
def __init__(self,b,points):
self.b=b
self.xmin=poi... |
s249893435 | p00297 | u352394527 | 1529835167 | Python | Python3 | py | Runtime Error | 20 | 5652 | 1827 | from bisect import bisect_left as bl
class Node:
def __init__(self, val, sec):
self.val = val
self.sec = sec
self.left = sec[0]
self.right = sec[1]
self.minx = val[0]
self.maxx = val[1]
self.miny = val[2]
self.maxy = val[3]
class SegTree:
def __init__(self, num, lst):
num_ = 1
... |
s326174147 | p00299 | u567380442 | 1426645808 | Python | Python3 | py | Runtime Error | 0 | 0 | 1365 | def create_edge(fr,to,weight,si):
edges = []
if si == '-':
edges.append((fr,to,weight))
edges.append((to,fr,0))
else:
edges.append((to,fr,-weight))
return edges
#????????????????????´???-1?????????
def bellmanford(edges, length):
start_vertex = 0
distance = [float('... |
s865849921 | p00299 | u567380442 | 1426645884 | Python | Python3 | py | Runtime Error | 0 | 0 | 1382 | def create_edge(fr,to,weight,si):
edges = []
if si == '-':
edges.append((fr,to,weight))
edges.append((to,fr,0))
else:
edges.append((to,fr,-weight))
return edges
#????????????????????´???-1?????????
def bellmanford(edges, length):
start_vertex = 0
distance = [float('... |
s100610718 | p00304 | u451187291 | 1503076910 | Python | Python3 | py | Runtime Error | 30 | 7804 | 1521 | '''aizu 0309
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0309
'''
# encoding: 'utf-8'
def main():
'''main func.
'''
node_n = int(input())
nodes = list()
edges = list()
for _ in range(node_n):
nodes.append(Node(input()))
for _ in range(node_n - 1):
edges.append(... |
s053176875 | p00304 | u451187291 | 1503077079 | Python | Python3 | py | Runtime Error | 40 | 7848 | 1540 | '''aizu 0309
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0309
'''
# encoding: 'utf-8'
N = 1000000007
def main():
'''main func.
'''
node_n = int(input())
nodes = list()
edges = list()
for _ in range(node_n):
nodes.append(Node(input()))
for _ in range(node_n - 1):
... |
s255219588 | p00304 | u451187291 | 1503077155 | Python | Python3 | py | Runtime Error | 20 | 7760 | 1544 | '''aizu 0309
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0309
'''
# encoding: 'utf-8'
N = 1000000007
def main():
'''main func.
'''
node_n = int(input())
nodes = list()
edges = list()
for _ in range(node_n):
nodes.append(Node(input()))
for _ in range(node_n - 1):
... |
s546925205 | p00304 | u451187291 | 1503077534 | Python | Python3 | py | Runtime Error | 30 | 7792 | 1520 | '''aizu 0309
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0309
'''
# encoding: 'utf-8'
N = 1000000007
def main():
'''main func.
'''
node_n = int(input())
nodes = list()
for _ in range(node_n):
nodes.append(Node(input()))
for _ in range(node_n - 1):
i, j = tuple([in... |
s336360978 | p00304 | u451187291 | 1503077800 | Python | Python3 | py | Runtime Error | 30 | 7748 | 1540 | '''aizu 0309
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0309
'''
# encoding: 'utf-8'
N = 1000000007
def main():
'''main func.
'''
node_n = int(input())
nodes = list()
for _ in range(node_n):
nodes.append(Node(input()))
for _ in range(node_n - 1):
i, j = tuple([in... |
s696860560 | p00304 | u451187291 | 1503078574 | Python | Python3 | py | Runtime Error | 30 | 7876 | 1705 | '''aizu 0309
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0309
'''
# encoding: 'utf-8'
import sys
from math import log10
N = 1000000007
LOGN = 9
def main():
'''main func.
'''
node_n = int(input())
nodes = list()
for _ in range(node_n):
nodes.append(Node(input()))
for _ in... |
s431655351 | p00304 | u451187291 | 1503078846 | Python | Python3 | py | Runtime Error | 30 | 7884 | 1773 | '''aizu 0309
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0309
'''
# encoding: 'utf-8'
from math import log10
N = 1000000007
LOGN = 9
def main():
'''main func.
'''
node_n = int(input())
nodes = list()
for _ in range(node_n):
nodes.append(Node(input()))
for _ in range(node... |
s601081368 | p00304 | u451187291 | 1503079559 | Python | Python3 | py | Runtime Error | 30 | 7784 | 1541 | '''aizu 0309
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0309
'''
# encoding: 'utf-8'
N = 1000000007
def main():
'''main func.
'''
node_n = int(input())
nodes = list()
for _ in range(node_n):
nodes.append(Node(input()))
for _ in range(node_n - 1):
i, j = tuple([in... |
s878879958 | p00304 | u451187291 | 1503080044 | Python | Python3 | py | Runtime Error | 20 | 7840 | 1670 | '''aizu 0309
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0309
'''
# encoding: 'utf-8'
N = 1000000007
def main():
'''main func.
'''
node_n = int(input())
nodes = list()
for _ in range(node_n):
nodes.append(Node(input()))
for _ in range(node_n - 1):
i, j = tuple([in... |
s422190135 | p00305 | u072053884 | 1530635077 | Python | Python3 | py | Runtime Error | 0 | 0 | 1334 | def solve():
file_input = stdin
N = int(file_input.readline())
img = tuple(tuple(map(int, line.split())) for line in file_input)
acc_row = (tuple(accumulate(line)) + (0,) for line in img)
acc_col = tuple(tuple(accumulate(line)) + (0,) for line in zip(*img))
ans = 0
for i, tpl_... |
s311019679 | p00305 | u072053884 | 1530635123 | Python | Python3 | py | Runtime Error | 0 | 0 | 1334 | def solve():
file_input = stdin
N = int(file_input.readline())
img = tuple(tuple(map(int, line.split())) for line in file_input)
acc_row = (tuple(accumulate(line)) + (0,) for line in img)
acc_col = tuple(tuple(accumulate(line)) + (0,) for line in zip(*img))
ans = 0
for i, tpl_... |
s231846835 | p00310 | u546285759 | 1507867529 | Python | Python3 | py | Runtime Error | 0 | 0 | 36 | print(sum(map(int, input().split())) |
s440110071 | p00312 | u546285759 | 1507987179 | Python | Python3 | py | Runtime Error | 0 | 0 | 44 | print(sum(divmod(map(int, input().split()))) |
s395041168 | p00314 | u260980560 | 1499595883 | Python | Python | py | Runtime Error | 0 | 0 | 109 | input();Q=[0]*101
for p in map(int,input().split()):Q[p]+=1
print(max(i for i in range(101)if sum(Q[i:])>=i)) |
s528792491 | p00314 | u855694108 | 1506567549 | Python | Python3 | py | Runtime Error | 0 | 0 | 369 | def main():
N = int(input())
p = list(map(int, input().split()))
p.sort()
pp = list(set(p))
cnt = 0
for i in range(len(pp)):
cnt += 1
scnt = 0
for j in range(len(p)):
if pp[i] <= pp[j]:
scnt += 1
if cnt == scnt:
break
p... |
s670071951 | p00314 | u546285759 | 1509139039 | Python | Python3 | py | Runtime Error | 0 | 0 | 176 | N = int(input())
p = list(map(int, input().split()))
score = [0] * 101
for x in p:
score[x] += 1
while True:
if sum(score[i:]) < i:
break
i += 1
print(i-1) |
s226049417 | p00330 | u498511622 | 1501504952 | Python | Python3 | py | Runtime Error | 0 | 0 | 73 | try:
while True:
i=int(input())
print(i*32)
except EOFError:
pass |
s583299444 | p00331 | u623996423 | 1541073115 | Python | Python3 | py | Runtime Error | 0 | 0 | 66 | h, r = list(map(int, input().split()))
print(int((h+r)/abs(h+r)))
|
s725041389 | p00333 | u772726453 | 1501232130 | Python | Python3 | py | Runtime Error | 0 | 0 | 91 | import math
W,H,C = map(int,input().split(' '))
x = math.gcd(W,H)
print((W//x)*(H//x)*C) |
s329988994 | p00333 | u772726453 | 1501232138 | Python | Python3 | py | Runtime Error | 0 | 0 | 91 | import math
W,H,C = map(int,input().split(' '))
x = math.gcd(W,H)
print((W//x)*(H//x)*C) |
s222517420 | p00333 | u772726453 | 1501232322 | Python | Python3 | py | Runtime Error | 0 | 0 | 91 | import math
W,H,C = map(int,input().split(' '))
x = math.gcd(W,H)
print((W//x)*(H//x)*C) |
s227247454 | p00333 | u051218320 | 1528756070 | Python | Python3 | py | Runtime Error | 0 | 0 | 114 | import fractions
A, B, C = [int(k) for k in raw_input().split(' ')]
print((A * B)/ (fractions.gcd(A, B) ** 2 ))
|
s267616679 | p00333 | u051218320 | 1528756134 | Python | Python3 | py | Runtime Error | 0 | 0 | 120 | import fractions
A, B, C = [int(k) for k in raw_input().split(' ')]
print(C * ((A * B)/ (fractions.gcd(A, B) ** 2 )))
|
s715572239 | p00334 | u805464373 | 1555760144 | Python | Python | py | Runtime Error | 0 | 0 | 164 | N=int(input())
c=set()
for i in range(N):
ls=input().split()
ls.sort()
ls_sum=ls[0]*1000**2+ls[1]*1000+ls[2]
c.add(ls_sum)
print(N-len(c))
|
s055635850 | p00334 | u805464373 | 1555760161 | Python | Python | py | Runtime Error | 0 | 0 | 164 | N=int(input())
c=set()
for i in range(N):
ls=input().split()
ls.sort()
ls_sum=ls[0]*1000**2+ls[1]*1000+ls[2]
c.add(ls_sum)
print(N-len(c))
|
s987920323 | p00334 | u369093003 | 1501655531 | Python | Python3 | py | Runtime Error | 0 | 0 | 328 | l = []
N = int(input())
for i in range(N):
a,b,c = map(int,input().split(' '))
d = a + b + c
l.append(d)
e = l.count(9)
f = l.count(8)
g = l.count(7)
h = l.count(6)
ans = 0
if e>1:
ans += e - 1
if f>1:
ans += f - 1
if g>1:
ans += g - 1
if h>1:
ans += h - 1
if e = 1 and f = 1 and g = 1 and h = 1:
ans = 4
pr... |
s232602700 | p00334 | u369093003 | 1501657713 | Python | Python3 | py | Runtime Error | 0 | 0 | 762 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int N = s.nextInt();
int[] I = new int[N];
int D = 0;
int E = 0;
int F = 0;
int G = 0;
int ans = 0;
for(int i=0;i<N;i++){
int a = s.nextInt();
int b = s.nextInt();
int... |
s942935751 | p00334 | u369093003 | 1501935069 | Python | Python3 | py | Runtime Error | 0 | 0 | 121 | N = int(input())
s = set()
for i in range(N):
a = map(int,input().split(' '))
b = sorted(a)
s.add(d)
print(N - len(s)) |
s687452602 | p00334 | u369093003 | 1501935165 | Python | Python3 | py | Runtime Error | 0 | 0 | 140 | N = int(input())
s = set()
for i in range(N):
a,b,c = map(str,input().split(' '))
e = a + b + c
e = sorted(d)
s.add(e)
print(N - len(s)) |
s678308486 | p00334 | u369093003 | 1501935259 | Python | Python3 | py | Runtime Error | 0 | 0 | 156 | N = int(input())
s = set()
l = []
for i in range(N):
a,b,c = map(int,input().split(' '))
l.append(a,b,c)
e = sorted(l)
s.add(e)
l = 0
print(N - len(s)) |
s845614904 | p00334 | u369093003 | 1501935749 | Python | Python3 | py | Runtime Error | 0 | 0 | 142 | N = int(input())
l = []
for i in range(N):
a,b,c = map(int,input().split(' '))
l.append(a,b,c)
l.sort()
s.add(l)
l = []
print(N - len(s)) |
s267709874 | p00334 | u369093003 | 1501935800 | Python | Python3 | py | Runtime Error | 0 | 0 | 164 | N = int(input())
l = []
for i in range(N):
a,b,c = map(int,input().split(' '))
l.append(a)
l.append(b)
l.append(c)
l.sort()
s.add(l)
l = []
print(N - len(s)) |
s588245310 | p00334 | u369093003 | 1501935937 | Python | Python3 | py | Runtime Error | 0 | 0 | 174 | N = int(input())
l = []
s = set()
for i in range(N):
a,b,c = map(int,input().split(' '))
l.append(a)
l.append(b)
l.append(c)
l.sort()
s.add(l)
l = []
print(N - len(s)) |
s631700093 | p00334 | u451187291 | 1503071647 | Python | Python3 | py | Runtime Error | 0 | 0 | 200 | # encoding: 'utf-8'
N = int(input())
ls = list()
for _ in range(N):
e = sorted([int(x) for x in split(input())])
if e in ls:
continue
else:
ls.append(e)
print(N - len(ls)) |
s470734653 | p00335 | u260980560 | 1501296701 | Python | Python3 | py | Runtime Error | 20 | 7736 | 292 | n = int(input())
*P, = map(int, input().split())
memo = {(n-1, i): i for i in range(P[-1]+1)}
def dfs(pos, t):
if (pos, t) in memo:
return memo[pos, t]
res = memo[pos, t] = dfs(pos+1, max(0, P[pos+1]-t)) + t*2
return res
print(min(dfs(0, P[0]-i)+i for i in range(P[0]+1))) |
s714109773 | p00335 | u451187291 | 1503113130 | Python | Python3 | py | Runtime Error | 20 | 7784 | 987 | '''aizu 0340
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0340
'''
# encoding: 'utf-8'
def main():
input()
hill = [int(x) for x in input().split()]
_hill = [0] * len(hill)
count = 0
while hill != _hill:
# print(count, hill)
_hill = hill
hill, c = step(hill)
... |
s049046817 | p00335 | u451187291 | 1503113175 | Python | Python3 | py | Runtime Error | 20 | 7748 | 961 | '''aizu 0340
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0340
'''
# encoding: 'utf-8'
def main():
input()
hill = [int(x) for x in input().split()]
_hill = [0] * len(hill)
count = 0
while hill != _hill:
# print(count, hill)
_hill = hill
hill, c = step(hill)
... |
s944512988 | p00340 | u858885710 | 1481551410 | Python | Python3 | py | Runtime Error | 0 | 0 | 89 | a, b, c, d = sorted(map(int, input().split())
print("YES" if a == b and c == d else "NO") |
s071293288 | p00340 | u546285759 | 1502765344 | Python | Python3 | py | Runtime Error | 0 | 0 | 83 | e = sorted(map(int, input().split()))
print("yes" if e[0] == e[1] and e[2] == e[3]) |
s945495754 | p00341 | u350064373 | 1501505716 | Python | Python3 | py | Runtime Error | 0 | 0 | 179 | ls = list(map(int, input().split()))
ls.sort()
if ls[0]==ls[1]==ls[2]==ls[3] and ls[4==ls[5]==ls[6]==ls[7] and ls[8]==ls[9]==ls[10]==ls[11]:
print('yes')
else:
print('no') |
s804111321 | p00341 | u498511622 | 1501505954 | Python | Python3 | py | Runtime Error | 0 | 0 | 179 | lst=list(input().split())
lst.sort()
if lst[0]==lst[1]==lst[2]==lst[3] and lst[4]==lst[5]==lst[6]==lst[7] and
lst[8]==lst[9]==lst[10]==lst[11]:
print('yes')
else:
print('no') |
s237676855 | p00341 | u498511622 | 1501505980 | Python | Python3 | py | Runtime Error | 0 | 0 | 176 | lst=list(input().split())
lst.sort()
if lst[0]==lst[1]==lst[2]==lst[3]andlst[4]==lst[5]==lst[6]==lst[7]andlst[8]==lst[9]==lst[10]==lst[11]:
print('yes')
else:
print('no') |
s766155499 | p00342 | u724548524 | 1526977025 | Python | Python3 | py | Runtime Error | 0 | 0 | 585 | n = int(input())
a = sorted(map(int,input().split()))
b = [(a[i + 1] - a[i], i) for i in range(n -1)]
b.sort(key = lambda x:x[0])
if b[0][1] < n - 2:print((a[-1] + a[-2]) / c)
elif b[0][1] == n - 3:
if b[1][1] == n - 2:print(max((a[-1] + a[-2]) / b[2][0], (a[-1] + a[-4]) / b[0][0], (a[-3] + a[-4]) / b[1][0]))
e... |
s736673918 | p00343 | u260980560 | 1501322731 | Python | Python3 | py | Runtime Error | 0 | 0 | 791 | n = int(input())
for i in range(n):
F = set(map(int, input().split()))
fl = min(F); fr = max(F)
G = {*range(1, 14)} - F - {7}
gl = min(G); gr = max(G)
memo = {}
def dfs(s, t, u):
if (s, t, u) in memo:
return memo[s, t, u]
T = [G, F][u]
res = 0
if s-1 ... |
s696995232 | p00344 | u320316900 | 1523337338 | Python | Python3 | py | Runtime Error | 0 | 0 | 474 | fi = int(input())
tramp = [int(input()) for i in range(fi)]
is_reachable = [0 for i in range(fi)]
def jump(n):
is_reachable[n] = 1
if n == fi:
return
for j in range(min(tramp[n] // 10, fi-n-1)):
if not is_reachable[n+j+1]:
jump(n+j+1)
jump(0)
if not is_reachable[-1]:
prin... |
s611200991 | p00344 | u352394527 | 1529927404 | Python | Python3 | py | Runtime Error | 290 | 48092 | 904 | n = int(input())
alst = list(map(int, input().split()))
edges = [[] for _ in range(n)]
rev_edges = [[] for _ in range(n)]
for i in range(n):
edges[i].append((i + alst[i]) % n)
rev_edges[(i + alst[i]) % n].append(i)
def dfs(x, ret, edges, visited):
visited[x] = True
for e in edges[x]:
if not visited[e]:
... |
s365330132 | p00347 | u260980560 | 1501341909 | Python | Python3 | py | Runtime Error | 20 | 7796 | 742 | w, h = map(int, input().split())
S = [list(map(int, input().split())) for i in range(h)]
SW = [[0]*w for i in range(h)]
SH = [[0]*w for i in range(h)]
for i in range(h):
cnt = 0
for j in range(w-1, -1, -1):
cnt += S[i][j]
SW[i][j] = cnt
for j in range(w):
cnt = 0
for i in range(h-1, -1, ... |
s353565584 | p00350 | u133119785 | 1499510137 | Python | Python3 | py | Runtime Error | 0 | 0 | 586 | n = int(raw_input())
u = raw_input()
q = int(raw_input())
def cmd_set(q,u):
x = int(q[0])
y = int(q[1])
z = q[2]
h = u[:x-1]
t = u[y:]
zz= z*(y-x+1)
return h+zz+t
def cmd_comp(q, u):
a = int(q[0])
b = int(q[1])
c = int(q[2])
d = int(q[3])
s = u[a-1:b]
t = u[c-1:d... |
s541729624 | p00352 | u116766943 | 1506238397 | Python | Python3 | py | Runtime Error | 0 | 0 | 38 | a,b = map(int,input())
print((a+b)//2) |
s307783708 | p00352 | u855989123 | 1513681020 | Python | Python | py | Runtime Error | 0 | 0 | 48 | l = raw_input().split()
print (l[0] + l[1] / 2) |
s736629206 | p00352 | u584779197 | 1514005353 | Python | Python | py | Runtime Error | 0 | 0 | 48 | a,b=map(int,input().split())
print(int((a+b)/2)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.