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
s172457248
p00129
u912237403
1415501658
Python
Python
py
Runtime Error
0
0
825
import math as M def R(A): return (A[0]**2+A[1]**2)**.5 def I(i): return [map(int,raw_input().split()) for _ in [0]*i] def C(a,b): return a>b or abs(a-b)<1e-6 def f(e1): tx,ty,sx,sy=e1 x=[] for e2 in WP: wx,wy,r=e2 wt=[tx-wx,ty-wy]; rwt=R(wt) sw=[wx-sx,wy-sy]; rsw=R(sw) st=[tx-sx,ty-sy]; rst=R(st)...
s127327844
p00129
u912237403
1415501803
Python
Python
py
Runtime Error
0
0
827
import math as M def R(A): return (A[0]**2+A[1]**2)**.5 def I(i): return [map(int,raw_input().split()) for _ in [0]*i] def C(a,b): return a>b or abs(a-b)<1e-6 def f(e1): tx,ty,sx,sy=e1 x=[] for e2 in WP: wx,wy,r=e2 wt=[tx-wx,ty-wy]; rwt=R(wt) sw=[wx-sx,wy-sy]; rsw=R(sw) st=[tx-sx,ty-sy]; rst=R(st)...
s820801747
p00129
u912237403
1415501831
Python
Python
py
Runtime Error
0
0
829
import math as M def R(A): return (A[0]**2+A[1]**2)**.5 def I(i): return [map(int,raw_input().split()) for _ in [0]*i] def C(a,b): return a>b or abs(a-b)<1e-6 def f(e1): tx,ty,sx,sy=e1 x=[] for e2 in WP: wx,wy,r=e2 wt=[tx-wx,ty-wy]; rwt=R(wt) sw=[wx-sx,wy-sy]; rsw=R(sw) st=[tx-sx,ty-sy]; rst=R(st)...
s052008815
p00129
u912237403
1415501857
Python
Python
py
Runtime Error
0
0
831
import math as M def R(A): return (A[0]**2+A[1]**2)**.5 def I(i): return [map(int,raw_input().split()) for _ in [0]*i] def C(a,b): return a>b or abs(a-b)<1e-6 def f(e1): tx,ty,sx,sy=e1 x=[] for e2 in WP: wx,wy,r=e2 wt=[tx-wx,ty-wy]; rwt=R(wt) sw=[wx-sx,wy-sy]; rsw=R(sw) st=[tx-sx,ty-sy]; rst=R(st)...
s811566908
p00129
u912237403
1415501894
Python
Python
py
Runtime Error
0
0
835
import math as M def R(A): return (A[0]**2+A[1]**2)**.5 def I(i): return [map(int,raw_input().split()) for _ in [0]*i] def C(a,b): return a>b or abs(a-b)<1e-6 def f(e1): tx,ty,sx,sy=e1 x=[] for e2 in WP: wx,wy,r=e2 wt=[tx-wx,ty-wy]; rwt=R(wt) sw=[wx-sx,wy-sy]; rsw=R(sw) st=[tx-sx,ty-sy]; rst=R(st)...
s012979036
p00129
u912237403
1415501987
Python
Python
py
Runtime Error
0
0
730
import math as M def R(A): return (A[0]**2+A[1]**2)**.5 def I(i): return [map(int,raw_input().split()) for _ in [0]*i] def C(a,b): return a>b or abs(a-b)<1e-6 def f(e1): tx,ty,sx,sy=e1 x=[] for e2 in WP: wx,wy,r=e2 wt=[tx-wx,ty-wy]; rwt=R(wt) sw=[wx-sx,wy-sy]; rsw=R(sw) st=[tx-sx,ty-sy]; rst=R(st)...
s628153279
p00129
u873482706
1435892993
Python
Python
py
Runtime Error
0
0
763
import math def f(): x = 0; y = 1; r = 2 for w in L_w: A = (tx-w[x])**2 + (ty-w[y])**2 - w[r]**2 B = (sx-w[x])**2 + (sy-w[y])**2 - w[r]**2 if 0 < A and 0 < B and (tx-w[w])*(sx-w[x]) < 0: P = abs((sy-ty)*w[x] - (sx-tx)*w[y] - (sy-ty)*tx + ty) Q = math.sqrt((sy-ty)...
s623245890
p00130
u912237403
1415509550
Python
Python
py
Runtime Error
0
0
618
import math as M def R(A): return (A[0]**2+A[1]**2)**.5 def I(i): return [map(int,raw_input().split()) for _ in [0]*i] def f(e1): tx,ty,sx,sy=e1 x=[] st=[tx-sx,ty-sy]; rst=R(st) for e2 in WP: wx,wy,r=e2 wt=[tx-wx,ty-wy]; rwt=R(wt) sw=[wx-sx,wy-sy]; rsw=R(sw) F=[rwt<r,rsw<r] if F==[1,0] or F=...
s764066192
p00130
u811733736
1506842308
Python
Python3
py
Runtime Error
0
0
2743
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0130 """ import sys from sys import stdin input = stdin.readline from collections import namedtuple from collections import deque def bfs(u, result, out_edge, in_degree, processed): # ?????????????????????????????¨??????????????...
s233181291
p00130
u811733736
1506842623
Python
Python3
py
Runtime Error
0
0
2757
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0130 """ import sys from sys import stdin input = stdin.readline from collections import namedtuple from collections import deque def bfs(u, result, out_edge, in_degree, processed): # ?????????????????????????????¨??????????????...
s200351350
p00130
u811733736
1506842887
Python
Python3
py
Runtime Error
0
0
2774
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0130 """ import sys from sys import stdin input = stdin.readline from collections import namedtuple from collections import deque def bfs(u, result, out_edge, in_degree, processed): # ?????????????????????????????¨??????????????...
s133658329
p00130
u203261375
1515366947
Python
Python3
py
Runtime Error
0
0
387
n = int(input()) for _ in range(n): train = '' seq = input() for i in range(len(seq) // 3 + 1): if i == 0: train += seq[i] if seq[3 * i - 2] == '-' and train[-1] == seq[3 * (i - 1)]: train = train + seq[3 * i] if seq[3 * i - 2] == '<' and train[0] == seq[3 * ...
s383046722
p00130
u203261375
1515367061
Python
Python3
py
Runtime Error
0
0
387
n = int(input()) for _ in range(n): train = '' seq = input() for i in range(len(seq) // 3 + 1): if i == 0: train += seq[i] if seq[3 * i - 2] == '-' and train[-1] == seq[3 * (i - 1)]: train = train + seq[3 * i] if seq[3 * i - 2] == '<' and train[0] == seq[3 * ...
s871955494
p00130
u203261375
1515367061
Python
Python3
py
Runtime Error
0
0
387
n = int(input()) for _ in range(n): train = '' seq = input() for i in range(len(seq) // 3 + 1): if i == 0: train += seq[i] if seq[3 * i - 2] == '-' and train[-1] == seq[3 * (i - 1)]: train = train + seq[3 * i] if seq[3 * i - 2] == '<' and train[0] == seq[3 * ...
s728575362
p00130
u203261375
1515367524
Python
Python3
py
Runtime Error
0
0
356
n = int(input()) for _ in range(n): train = '' seq = input() for i in range(0, len(seq), 3): if i == 0: train += seq[i] if seq[i - 2] == '-' and train[-1] == seq[i - 3]: train = train + seq[i] if seq[i - 2] == '<' and train[0] == seq[i - 3]: train...
s789241377
p00130
u203261375
1515367524
Python
Python3
py
Runtime Error
0
0
356
n = int(input()) for _ in range(n): train = '' seq = input() for i in range(0, len(seq), 3): if i == 0: train += seq[i] if seq[i - 2] == '-' and train[-1] == seq[i - 3]: train = train + seq[i] if seq[i - 2] == '<' and train[0] == seq[i - 3]: train...
s826807253
p00132
u912237403
1417961356
Python
Python
py
Runtime Error
0
0
2826
import copy def rot90(A): #Aを時計方向に90度回転させる return zip(*A[::-1]) def count_board(Board): #X[x][y]: [x,y]から[Width-1,Height-1]にあるドット数のテーブルを作る X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + ...
s774297385
p00132
u912237403
1418131170
Python
Python
py
Runtime Error
0
0
2417
def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([B[e] for e i...
s963677671
p00132
u912237403
1418134862
Python
Python
py
Runtime Error
19920
4556
2460
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s186845521
p00132
u912237403
1418136703
Python
Python
py
Runtime Error
19930
4572
2418
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s349947337
p00132
u912237403
1418241252
Python
Python
py
Runtime Error
19930
4592
2607
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s108787445
p00132
u912237403
1418405894
Python
Python
py
Runtime Error
0
0
2668
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s491547415
p00132
u912237403
1418405988
Python
Python
py
Runtime Error
19930
4580
2640
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s539458559
p00132
u912237403
1421046300
Python
Python
py
Runtime Error
0
0
3163
import copy def rot90(A): #Aを時計方向に90度回転させる return zip(*A[::-1]) def count_board(Board): #Board [0,0]から[Width-1,Height-1]にあるドット数のテーブルを作る X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Bo...
s448476333
p00132
u912237403
1421046420
Python
Python
py
Runtime Error
19930
4632
2587
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s787816736
p00132
u912237403
1421053289
Python
Python
py
Runtime Error
19930
4632
2584
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s023956144
p00132
u912237403
1421053521
Python
Python
py
Runtime Error
19930
4596
2605
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s954025855
p00132
u912237403
1421054213
Python
Python
py
Runtime Error
19930
4596
2613
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s505386006
p00132
u912237403
1421054275
Python
Python
py
Runtime Error
19930
4596
2619
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s815384666
p00132
u912237403
1421054351
Python
Python
py
Runtime Error
19930
4596
2639
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s885015040
p00132
u912237403
1421054435
Python
Python
py
Runtime Error
19930
4596
2651
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s535800765
p00132
u912237403
1421054643
Python
Python
py
Runtime Error
19930
4632
2645
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s982113143
p00132
u912237403
1421054741
Python
Python
py
Runtime Error
19930
4592
2652
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s274214663
p00132
u912237403
1421054914
Python
Python
py
Runtime Error
19930
4636
2630
import copy def rot90(A): try: tmp = zip(*A[::-1]) return tmp except: return A def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') r...
s345337409
p00132
u912237403
1421055084
Python
Python
py
Runtime Error
19930
4596
2668
import copy def rot90(A): try: tmp = zip(*A[::-1]) return tmp except: return A def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] try: for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i]...
s678080860
p00132
u912237403
1421055210
Python
Python
py
Runtime Error
19930
4636
2708
import copy def rot90(A): try: tmp = zip(*A[::-1]) return tmp except: return A def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] try: for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i]...
s411732044
p00132
u912237403
1421055471
Python
Python
py
Runtime Error
19930
4620
2482
import copy def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return sum([...
s694074740
p00132
u912237403
1421504949
Python
Python
py
Runtime Error
0
0
3214
import copy,sys def rot90(A): #Aを時計方向に90度回転させる return zip(*A[::-1]) def count_board(Board): #Board [0,0]から[Width-1,Height-1]にあるドット数のテーブルを作る X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] +...
s823539432
p00132
u912237403
1421505065
Python
Python
py
Runtime Error
0
0
2644
import copy,sys def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return s...
s367597703
p00132
u912237403
1421505091
Python
Python
py
Runtime Error
19930
4604
2617
import copy,sys def rot90(A): return zip(*A[::-1]) def count_board(Board): X = [[0 for _ in [0]*(Width+1)] for _ in [0]*(Height+1)] for i in range(Height)[::-1]: for j in range(Width)[::-1]: X[i][j] = X[i+1][j] + X[i][j+1] - X[i+1][j+1] + (Board[i][j]=='.') return X def check_sum(TRIALS): return s...
s952825202
p00135
u041086527
1416384842
Python
Python
py
Runtime Error
0
0
361
n = input() for i in range(n): h,m = map(int, raw_input().split(":")) sangle = 1.0 * 360 * (h * 60 + m) / 720 langle = 1.0 * 360 * m / 60 angle = abs(sangle - langle) if angle > 180: angle = 360 - d if (0 <= angle < 30): print "alert" elif (90 <= angle <= 180): print...
s883430966
p00135
u873482706
1435983770
Python
Python
py
Runtime Error
0
0
63
N = input() print sum([int(raw_input()) for i in range(N)]) / N
s816584812
p00135
u301729341
1482905915
Python
Python
py
Runtime Error
0
0
321
import math n = int(input()) for i in range(n): m,s = map(int,input().split(":")) m_kak = 30 * m + 0.5 * s s_kak = 6 * s kak = min(math.fabs(m_kak - s_kak), 360 - math.fabs(m_kak - s_kak) ) if kak < 30: print("alert") elif kak < 90: print("warning") else: print("safe"...
s678765699
p00135
u811733736
1505443439
Python
Python3
py
Runtime Error
0
0
976
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0135 WA """ import sys from sys import stdin from math import sqrt, acos, cos, sin, radians, degrees input = stdin.readline def solve(time): # 12????????????90??? short_hand_angle = time[1] * -6 + 90 x_s = cos(radians(sho...
s509505589
p00135
u104911888
1367129177
Python
Python
py
Runtime Error
0
0
265
n=input() for i in range(n): hh,mm=map(int,raw_input().split(":")) angleh=(60*hh+mm)*0.5 anglem=6*mm diff=math.abs(angleh-anglem) if 0<=diff<30: print "alert" elif 90<=diff<=180: print "safe" else: print "warning"
s587910292
p00136
u314932236
1513701596
Python
Python
py
Runtime Error
0
0
563
import os import math def main(): lst = [0,0,0,0,0,0] for i in range(0, int(input())): temp = float(input()) if temp < 165: lst[0] += 1 elif temp < 170: lst[1] += 1 elif temp < 175: lst[2] += 1 elif temp < 180: lst[3] += 1 ...
s743498219
p00136
u633068244
1394901883
Python
Python
py
Runtime Error
0
0
396
histo = ["" for i in range(6)] n = int(raw_input()) for i in range(n): h = float(raw_input()) if h < 165.0: histo[0] += "*" elif h < 170.0: histo[1] += "*" elif h < 175.0: histo[2] += "*" elif h < 180.0: histo[3] += "*" elif h < 185.0: histo[4] += "*" ...
s976808194
p00137
u855694108
1504740088
Python
Python3
py
Runtime Error
0
0
605
import sys def main(): for line in sys.stdin: n = int(line) for x in range(1, n + 1): s = int(input()) a = [] #answer for _ in range(10): s = "{0:08d}".format(s ** 2) s = list(s) hoge = "" for y in ra...
s067992335
p00137
u855694108
1504740219
Python
Python3
py
Runtime Error
0
0
503
def main(): n = int(iuput()) for x in range(1, n + 1): s = int(input()) a = [] #answer for _ in range(10): s = "{0:08d}".format(s ** 2) s = list(s) hoge = "" for y in range(2, 6): hoge += s[y] s = int(hoge) ...
s538006169
p00137
u633068244
1394960931
Python
Python
py
Runtime Error
0
0
164
n = int(raw_input()) for i in range(n): s = int(raw_input()) print "Case %d:"%(i+1) for j in range(10): s =int(str(s**2)[-6:-2]) print s
s441111304
p00138
u879226672
1427691082
Python
Python
py
Runtime Error
0
0
572
ls = [] for i in range(2): n,t = raw_input().split() ls.append([n,float(t)]) ls1 = sorted(ls[:9], key=lambda x:x[1]) ls2 = sorted(ls[9:17], key=lambda x:x[1]) ls3 = sorted(ls[17:], key=lambda x:x[1]) print ' '.join(map(str,ls1[0])) print ' '.join(map(str,ls1[1])) print ' '.join(map(str,ls2[0])) print ' '.join(m...
s832415639
p00138
u859393176
1448538690
Python
Python
py
Runtime Error
0
0
370
l = [[], [], []] ans = [] for i in range(3): for j in range(8): s = raw_input().split() l[i].append(float(s[1]), int(s[0])) for i in range(3): l[i].sort() l[i].reverse() ans.append(l[i].pop(0)) ans.append(l[i].pop(0)) l = l[0] + l[1] + [2] l.sort() l.reverse() ans.append(l.pop(0)) ans.append(l.pop(0))...
s982495113
p00138
u546285759
1507866016
Python
Python3
py
Runtime Error
0
0
267
dataset = [[input().split() for _ in range(8)] for _ in range(3)] tmp = [] for i in range(3): s = sorted(dataset[i], key=lambda x: x[1])[:3] tmp.append(s[-1]) for p in s[:2]: print(*p) a, b = sorted(tmp, key=lambda x: x[1])[:2] print(*a, "\n", *b)
s049377538
p00138
u808429775
1519096515
Python
Python
py
Runtime Error
0
0
599
import heapq from collections import namedtuple Data = namedtuple("Data", ("time", "number")) all_player = [] for _ in range(3): player = [input().split(" ") for lp in range(8)] player = [Data(float(time), number) for number, time in player] heapq.heapify(player) data = heapq.heappop(player) pri...
s895146965
p00139
u489809100
1449070289
Python
Python
py
Runtime Error
0
0
438
def snakeJudge(snake): if snake[:2] == ">'" : snake = snake[2 : len(snake) - 1] x1 = snake[0 : snake.index("#")] x2 = snake[snake.index("#") + 1: len(snake)] if x1 == x2 : return "A" if snake[:2] == ">^" : judge = True snake = snake[2 : len(snake) - 2] x1 = snake.count("Q=") x2 = len(snake) if x2 /...
s754242452
p00139
u078042885
1486778636
Python
Python3
py
Runtime Error
0
0
241
for _ in [0]*int(input()): s=input() if s[1]=='\'': a=s[2:-1].split('#') print(['NA','A'][set(a[0])==set(a[1])=={'='} and len(set(a))==1]) else: s=s[2:-2] print(['NA','B'][len(s)==2*s.count('Q=')])
s493043244
p00139
u078042885
1486778816
Python
Python3
py
Runtime Error
0
0
287
for _ in [0]*int(input()): s=input() if s[:2]=='>\'' and s[-1]=='~': a=s[2:-1].split('#') print(['NA','A'][set(a[0])==set(a[1])=={'='} and len(set(a))==1]) elif s[:2]=='>^' and s[-2:]=='~~': s=s[2:-2] print(['NA','B'][len(s)==2*s.count('Q=')])
s630722231
p00140
u633068244
1397213959
Python
Python
py
Runtime Error
0
0
211
stop=[0,1,2,3,4,5,6,7,8,9,5,4,3,2,1,0] for i in range(input()): sp,ep=map(int,raw_input().split()) if sp<ep: print stop[stop.index(sp):stop.index(ep)+1] else: print stop[stop.rindex(sp):stop.rindex(ep)+1]
s794703891
p00140
u260980560
1400217888
Python
Python
py
Runtime Error
0
0
354
bus = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2, 1, 0] for i in xrange(input()): s, t = map(int, raw_input().split()) if s>5: print " ".join(map(str, bus[s:bus.index(t, s)+1])) else: if s<t: print " ".join(map(str, range(s, t+1))) else: print " ".join(map(str,...
s572510749
p00141
u912237403
1418438665
Python
Python
py
Runtime Error
0
0
387
for _ in [0]*input(): n = input() A = [list(' '*n) for _ in [0]*n] for i in range((n+3)/4): i2 = i*2 if i2>0: A[n-i2][i2]='@' for j in range(i2, n-i2): A[j][i2]='@' #左下→左上 A[i2][j]='@' #左上→右上 if j<n-i2-1: A[j][n-i2-1]='@' #右上→右下 if j>i2+1: A[n-i2-1][j]='@' #右下→左下下 for e in A:...
s176500224
p00141
u811733736
1507215814
Python
Python3
py
Runtime Error
0
0
1093
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0141 """ import sys from sys import stdin input = stdin.readline from itertools import cycle def guruguru(n): if n < 5: return line = 0 dirs = cycle([(0, -1), (1, 0), (0, 1), (-1, 0)]) M = [[' '] * n for _ ...
s477370985
p00141
u633068244
1399230567
Python
Python
py
Runtime Error
0
0
410
for r in range(input()): if r > 0: print n = input() S = [[" "]*n for i in range(n)] x,y,dx,dy = 0,n-1,0,-1 while 1: S[y][x] = "#" y += dy; x += dx try: if y+dy == -1: raise if S[y+dy][x+dx] == "#": y -= dy; x -= dx raise except: S[y][x] = "#" dx,dy = -dy,dx y += dy; x += dx if S[y...
s668518452
p00142
u633068244
1418396520
Python
Python
py
Runtime Error
0
0
1204
#include <iostream> #include <set> using namespace std; const int MAX = 5001; int main(void){ int square[MAX]; for (int i=1; i < MAX+1; i++) square[i-1] = i*i; while (true){ int n; cin >> n; if (n == 0) break; int m = (n-1)/2; int raw_mod[n-1],mod[m]; ...
s854448445
p00142
u759934006
1426334235
Python
Python3
py
Runtime Error
0
0
411
# 0142 - Nature of Prime Numbers while True: n = int(input()) if n == 0: break _min = 0 _max = int((n - 1) / 2) print(_min, _max) ns = set([ x * x % n for x in range(1, n)]) count = {} for i in ns: for j in ns: if i < j: m = i - j if m < _min: m = n + m if m > _max: m = n - m count.setdefa...
s571561593
p00142
u759934006
1426334263
Python
Python3
py
Runtime Error
0
0
416
# 0142 - Nature of Prime Numbers while True: n = int(input()) if n == 0: break _min = 0 _max = int((n - 1) / 2) print(_min, _max) ns = set([ x * x % n for x in range(1, n)]) count = {} for i in ns: for j in ns: if i < j: m = i - j if m < _min: m = n + m if m > _max: m = n - m count.se...
s548895124
p00142
u847467233
1529618005
Python
Python3
py
Runtime Error
0
0
809
# AOJ 0142 Nature of Prime Numbers # Python3 2018.6.22 bal4u MAX = 10000 HALF = 5003 not_prime = [0]*MAX tbl = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, \ 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] def sieve(): for i in tbl: for j in range(i*i, MAX, i): not_prime[j] = 1 sieve() while 1: n = int(input...
s238837369
p00142
u633068244
1398334314
Python
Python
py
Runtime Error
0
0
295
while 1: n = input() if n == 0: break m = (n-1)/2 a = list(set([i**2%n for i in range(1,n)])) l = len(a) h = [0]*(m+1) for i in range(l): for j in range(i+1,l): d = a[i] - a[j] if d <= m - n: d += n elif d < 0: d *= -1 h[d] += 2 for i in range(1,m+1): print h[i]
s801310300
p00142
u633068244
1398334339
Python
Python
py
Runtime Error
0
0
295
while 1: n = input() if n == 0: break m = (n-1)/2 a = list(set([i**2%n for i in range(1,n)])) l = len(a) h = [0]*(m+1) for i in range(l): for j in range(i+1,l): d = a[i] - a[j] if d <= m - n: d += n elif d < 0: d *= -1 h[d] += 2 for i in range(1,m+1): print h[i]
s602589394
p00142
u633068244
1398334442
Python
Python
py
Runtime Error
0
0
295
while 1: n = input() if n == 0: break m = (n-1)/2 a = list(set([i**2%n for i in range(1,n)])) l = len(a) h = [0]*(m+1) for i in range(l): for j in range(i+1,l): d = a[i] - a[j] if d <= m - n: d += n elif d < 0: d *= -1 h[d] += 2 for i in range(1,m+1): print h[i]
s511121569
p00142
u633068244
1398334456
Python
Python
py
Runtime Error
0
0
292
while 1: n = input() if n == 0: break m = (n-1)/2 a = list(set([i**2%n for i in range(1,n)])) l = len(a) h = [0]*(m+1) for i in range(l): for j in range(i+1,l): d = a[i] - a[j] if d < m - n: d += n elif d < 0: d = -d h[d] += 2 for i in range(1,m+1): print h[i]
s885442872
p00142
u633068244
1398334558
Python
Python
py
Runtime Error
0
0
294
while 1: n = input() if n == 0: break m = (n-1)/2 a = list(set([i**2%n for i in range(1,n)])) l = len(a) h = [0]*(m+1) for i in range(l): for j in range(i+1,l): d = a[i] - a[j] if d <= m - n: d += n elif d < 0: d *= -1 h[d] += 2 for i in range(1,m+1): print h[i]
s786519198
p00142
u633068244
1398335108
Python
Python
py
Runtime Error
0
0
292
import itertools while 1: n = input() if n == 0: break m = (n-1)/2 a = list(set([i**2%n for i in range(1,n)])) l = len(a) h = [0]*(m+1) for i,j in itertools.combinations(a,2): d = i - j if d < 0: d += n h[d] += 2 if d <= m else h[n-d] += 2 for i in range(1,m+1): print h[i]
s819306964
p00142
u633068244
1398335257
Python
Python
py
Runtime Error
0
0
297
import itertools while 1: n = input() if n == 0: break m = (n-1)/2 a = list(set([i**2%n for i in range(1,n)])) l = len(a) h = [0]*(m+1) for i,j in itertools.combinations(a,2): d = i - j if 0 <= d <= m: h[d] += 2 else: h[min(d+n,n-d,-d)] += 2 for i in range(1,m+1): print h[i]
s056720350
p00142
u633068244
1398336779
Python
Python
py
Runtime Error
0
0
431
import itertools r = 10001 s = int(r**0.5) p = [1]*r p[0] = 0 for i in range(s): if p[i]: p[2*i+1::i+1] = [0 for i in range(2*i+1,r,i+1)] while 1: n = input() if n == 0: break m = (n-1)/2 if p[n-1] == 1: for i in range(m): print 4 continue a = sorted(list(set([i**2%n for i in range(1,n)))) h = [0]*(m+...
s842392122
p00143
u032662562
1490428451
Python
Python3
py
Runtime Error
0
0
858
import numpy as np def crossP(a, b, c, d): e = b - a f = c - d g = c - a A = np.matrix([[e.real,f.real],[e.imag, f.imag]]) B = np.matrix([[g.real],[g.imag]]) try: C = np.linalg.solve(A, B) except: return(-9999+(-9999)*1j) return(C[0,0]+C[1,0]*1j) def rangeP(st): retu...
s912087491
p00146
u647766105
1394649007
Python
Python
py
Runtime Error
0
0
1091
#Lupin The 4th: O(2^n) def f(a, b, visited): w = W[visited] * 20 return abs(lengths[a] - lengths[b]) * (70 + w) def solve(): cache = dict([((i, 0), (0, [i])) for i in xrange(n)]) def dfs(top, visited): if (top, visited) in cache: return cache[(top, visited)] ret = (1 << 30, ...
s280352015
p00147
u912237403
1419088013
Python
Python
py
Runtime Error
0
0
690
R = range(100) M = [[2,5,2,2,2][i%5] for i in R] Out = [-1] *100 P = [-1]*100 S = [-1]*17 Q = [] W = [0]*100 def stand(I, s): n = M[I] P[I] = -1 S[s:s+n] = [-1] * n Out[I] = -1 return 1 def sit(I, s): n = M[I] P[I] = s S[s:s+n] = [I] * n Out.[I] = t+ 17*(I%2)+3*(I%3)+19 W[I] = t - I*5 return de...
s743093422
p00148
u759934006
1373403837
Python
Python
py
Runtime Error
0
0
129
while True: n = raw_input() if not n: break else: n = int(n) print "3C{0:0>2}".format(n % 39)
s260604318
p00149
u879226672
1427732406
Python
Python
py
Runtime Error
0
0
510
def hantei(l): if l >= 1.1: return 'A' elif 0.6 <= l < 1.1: return 'B' elif 0.2 <= l < 0.6: return 'C' elif 0.2 < l: return 'D' ldic = {'A':0, 'B':0, 'C':0, 'D':0} rdic = {'A':0, 'B':0, 'C':0, 'D':0} ls = [] while True: try: l,r = map(float,raw_input().split(...
s074284244
p00149
u879226672
1427732497
Python
Python
py
Runtime Error
0
0
519
def hantei(l): if l >= 1.1: return 'A' elif 0.6 <= l < 1.1: return 'B' elif 0.2 <= l < 0.6: return 'C' elif 0.2 < l: return 'D' ldic = {'A':0, 'B':0, 'C':0, 'D':0} rdic = {'A':0, 'B':0, 'C':0, 'D':0} ls = [] while True: try: l,r = map(float,raw_input().split(...
s878780104
p00149
u546285759
1483410645
Python
Python3
py
Runtime Error
0
0
509
ld, rd = [0, 0, 0, 0]. [0, 0, 0, 0] while True: try: l, r = map(float, input().split()) if l < 0.2: ld[3] += 1 elif l < 0.6: ld[2] += 1 elif l < 1.1: ld[1] += 1 else: ld[0] += 1 if r < 0.2: rd[3] += 1 ...
s886882147
p00149
u633068244
1395844616
Python
Python
py
Runtime Error
0
0
340
ref = [1.1,0.6,0.2,0.0] rank = [[0,0] for i in range(4)] while True: try: eye = map(float, raw_input().split()) for i in range(2): for j in range(4): if eye[i] >= ref[j]: rank[j][i] += 1 break except: break print " ".join(map(str, rank[i]...
s190543105
p00150
u957021183
1505713048
Python
Python3
py
Runtime Error
0
0
1011
# Aizu Problem 00150: Twin Prime # import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def primes2(n): """ Input n>=6, Returns a list of primes, 2 <= p < n """ n, correction = n-n%6+6, 2-(n%6>1) sieve = [True] * (n//3...
s449779531
p00151
u873482706
1436243302
Python
Python
py
Runtime Error
0
0
1999
def f(): max_c = 0 c = 0 for h in range(n): for w in range(n): if grid[h][w] == 1: c += 1 else: if max_c < c: max_c = c c = 0 else: if max_c < c: max_c = c ...
s178499488
p00152
u078042885
1487793928
Python
Python3
py
Runtime Error
0
0
331
def score(x): s=0;t=1 for _ in[0]*10: a=2;b=3 if x[t]==10:a=1 elif x[t]+x[t+1]!=10:b=2 s+=sum(x[t:t+b]);t+=a return x[0],s while 1: n=int(input()) if n==0:break A=sorted([score(map(int,input().split())) for _ in [0]*n]) for a,b in sorted(A,key=lambda x:-x[1])...
s587292230
p00152
u352394527
1529495816
Python
Python3
py
Runtime Error
0
0
1589
def get_point(info): info.reverse() acc = 0 NORMAL, SPARE, STRIKE, DOUBLE = 0, 1, 2, 3 flag = NORMAL game_num = 0 while info: if game_num != 9: down_num1 = info.pop() if down_num1 != 10: down_num2 = info.pop() if flag == SPARE: acc += down_num1 * 2 + down_num2 ...
s200098034
p00153
u912237403
1419160853
Python
Python
py
Runtime Error
0
0
930
def In(): return map(int,raw_input().split()) def D(a,b): return ((a[0]-b[0])**2+(a[1]-b[1])**2)**.5 def side(a, b, c): f = (c[1]-a[1])*(b[0]-a[0])-(b[1]-a[1])*(c[0]-a[0]) if f>0: return 1 elif f<0: return -1 else return 0 def isIn(x,p0,p1,p2): f1 = side(p0,p1,x) f2 = side(p1,p2,x) f3 = side(p2,p0,x) re...
s954211816
p00154
u873482706
1435574121
Python
Python
py
Runtime Error
19930
4240
591
def f(i): global soc, ans, ng for n in range(m[i][1]+1): soc += (m[i][0]*n) if ng < soc: soc -= m[i][0]*n return elif ng == soc: ans += 1 soc -= m[i][0]*n return elif i < N-1: f(i+1) soc -= m[i][0]*n ...
s703776143
p00154
u873482706
1435574197
Python
Python
py
Runtime Error
19920
4244
631
import sys sys.setrecursionlimit(20000) def f(i): global soc, ans, ng for n in range(m[i][1]+1): soc += (m[i][0]*n) if ng < soc: soc -= m[i][0]*n return elif ng == soc: ans += 1 soc -= m[i][0]*n return elif i < N-1: ...
s588695774
p00154
u108432367
1344260724
Python
Python
py
Runtime Error
19930
5164
468
#encoding: UTF-8 price = count = n = 0 def f(tc,tp): global count if tc == n: if tp == price: count += 1 else: for i in range(l[tc][1]+1): f(tc + 1,tp + (l[tc][0] * i)) n = int(raw_input()) l = [] while n != 0: for i in range(n): s = raw_input() a = s.split(" ") s = a[0] ts = a[1] tl = [int(s),i...
s724646392
p00154
u779627195
1355919678
Python
Python
py
Runtime Error
19930
4264
636
R = lambda:map(int, raw_input().split()) def solve(num, s, m): c = 0 if m is len(a)-1: #print num-s if (num - s % a[len(a)-1][0] and 0 <= num - s <= a[len(a)-1][0]*a[len(a)-1][1]): return 1 else: return 0 for i in xrange(a[m][1]+1): #print a[m], i c += sol...
s721046702
p00154
u633068244
1396204290
Python
Python
py
Runtime Error
0
0
114
def f(n): c=0 while n>1: if n%2:n=3*n+1 else:n/=2 c+=1 print c while 1: n=input() if n==0:break f(n)
s587120226
p00154
u633068244
1396204334
Python
Python
py
Runtime Error
0
0
114
def f(n): c=0 while n>1: if n%2:n=3*n+1 else:n/=2 c+=1 print c while 1: n=input() if n==0:break f(n)
s160525100
p00155
u811733736
1506915970
Python
Python3
py
Runtime Error
0
0
2436
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0155 """ import sys from sys import stdin from math import sqrt from heapq import heappush, heappop input = stdin.readline def dijkstra(s, G): BLACK, GRAY, WHITE = 0, 1, 2 node = len(G) d = [float('inf')] * node colo...
s421095769
p00155
u811733736
1506918436
Python
Python3
py
Runtime Error
0
0
2401
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0155 """ import sys from sys import stdin from math import sqrt input = stdin.readline def dijkstra(s, G): BLACK, GRAY, WHITE = 0, 1, 2 node = len(G) d = [float('inf')] * 101 color = [WHITE] * 101 p = [-1] * 101 ...
s104974451
p00155
u811733736
1506919196
Python
Python3
py
Runtime Error
0
0
2454
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0155 """ import sys from sys import stdin from math import sqrt input = stdin.readline def dijkstra(s, G): BLACK, GRAY, WHITE = 0, 1, 2 d = [float('inf')] * 101 color = [WHITE] * 101 p = [-1] * 101 d[s] = 0 ...
s952271441
p00155
u811733736
1506921975
Python
Python3
py
Runtime Error
0
0
2564
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0155 """ import sys from sys import stdin from math import sqrt input = stdin.readline def dijkstra(s, G): BLACK, GRAY, WHITE = 0, 1, 2 d = [float('inf')] * 101 color = [WHITE] * 101 p = [-1] * 101 d[s] = 0 ...
s672838366
p00155
u811733736
1506924360
Python
Python3
py
Runtime Error
0
0
2609
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0155 """ import sys from sys import stdin from math import sqrt input = stdin.readline def dijkstra(s, G): BLACK, GRAY, WHITE = 0, 1, 2 d = [float('inf')] * 101 color = [WHITE] * 101 p = [-1] * 101 d[s] = 0 ...
s736377990
p00155
u811733736
1506924729
Python
Python3
py
Runtime Error
0
0
2878
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0155 """ import sys from sys import stdin from math import sqrt input = stdin.readline def dijkstra(s, G): BLACK, GRAY, WHITE = 0, 1, 2 d = [float('inf')] * 101 color = [WHITE] * 101 p = [-1] * 101 d[s] = 0 ...
s557050558
p00155
u811733736
1506924845
Python
Python3
py
Runtime Error
0
0
2847
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0155 """ import sys from sys import stdin from math import sqrt input = stdin.readline def dijkstra(s, G): BLACK, GRAY, WHITE = 0, 1, 2 d = [float('inf')] * 101 color = [WHITE] * 101 p = [-1] * 101 d[s] = 0 ...