buggy
stringlengths
1
618k
fixed
stringlengths
16
618k
buggy_submission_id
stringlengths
10
10
fixed_submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
lang
stringclasses
1 value
buggy_verdict
stringclasses
2 values
comp = 0 def m(L, R): global comp i = j = 0 while i < len(L) and j < len(R): comp += 1 if L[i] <= R[j]: yield L[i] i += 1 else: yield R[j] j += 1 comp += len(L) - i + len(R) - j while i < len(L): yield L[i] i += ...
comp = 0 def m(L, R): global comp j = 0 for l in L: while j < len(R) and R[j] < l: yield R[j] j += 1 yield l while j < len(R): yield R[j] j += 1 comp += len(L) + len(R) def merge(A): global comp if len(A) == 1: return A if l...
s925328540
s188498997
p02272
python
Time Limit Exceeded
from math import sqrt q3 = sqrt(3) fmt = "%.8f %.8f" def koch(x0, y0, x1, y1, c): xp = (x0*2 + x1) / 3 yp = (y0*2 + y1) / 3 xq = (x0 + x1*2) / 3 yq = (y0 + y1*2) / 3 dx = (x1 - x0) / 6 dy = (y1 - y0) / 6 xr = xp + (dx - dy * q3) yr = yp + (dx * q3 + dy) if c == n-1: retur...
from math import sqrt q3 = sqrt(3) fmt = "%.8f %.8f" def koch(x0, y0, x1, y1, c): if c == n: return (fmt % (x0, y0),) xp = (x0*2 + x1) / 3 yp = (y0*2 + y1) / 3 xq = (x0 + x1*2) / 3 yq = (y0 + y1*2) / 3 dx = (x1 - x0) / 6 dy = (y1 - y0) / 6 xr = xp + (dx - dy * q3) yr = yp ...
s752173868
s550906452
p02273
python
Runtime Error
from math import sqrt # ?????? def cross(P0, P1, P2): x0, y0 = P0; x1, y1 = P1; x2, y2 = P2 x1 -= x0; x2 -= x0 y1 -= y0; y2 -= y0 return x1*y2 - x2*y1 # ?????? def dot(P0, P1, P2): x0, y0 = P0; x1, y1 = P1; x2, y2 = P2 x1 -= x0; x2 -= x0 y1 -= y0; y2 -= y0 return x1*x2 + y1*y2 # 2????...
from math import sqrt def cross(P0, P1, P2): x0, y0 = P0; x1, y1 = P1; x2, y2 = P2 x1 -= x0; x2 -= x0 y1 -= y0; y2 -= y0 return x1*y2 - x2*y1 def dot(P0, P1, P2): x0, y0 = P0; x1, y1 = P1; x2, y2 = P2 x1 -= x0; x2 -= x0 y1 -= y0; y2 -= y0 return x1*x2 + y1*y2 def dist2(P0, P1): x0...
s114305041
s686677680
p02301
python
Runtime Error
from math import sqrt def cross(P0, P1, P2): x0, y0 = P0; x1, y1 = P1; x2, y2 = P2 x1 -= x0; x2 -= x0 y1 -= y0; y2 -= y0 return x1*y2 - x2*y1 def dot(P0, P1, P2): x0, y0 = P0; x1, y1 = P1; x2, y2 = P2 x1 -= x0; x2 -= x0 y1 -= y0; y2 -= y0 return x1*x2 + y1*y2 def dist2(P0, P1): x0...
from math import sqrt def cross(P0, P1, P2): x0, y0 = P0; x1, y1 = P1; x2, y2 = P2 x1 -= x0; x2 -= x0 y1 -= y0; y2 -= y0 return x1*y2 - x2*y1 def dot(P0, P1, P2): x0, y0 = P0; x1, y1 = P1; x2, y2 = P2 x1 -= x0; x2 -= x0 y1 -= y0; y2 -= y0 return x1*x2 + y1*y2 def dist2(P0, P1): x0...
s054255167
s686677680
p02301
python
Runtime Error
n = input() ps = [map(int, raw_input().split()) for i in xrange(n)] def intersection(p1, p2, q1, q2): dx0 = p2[0] - p1[0] dy0 = p2[1] - p1[1] dx1 = q2[0] - q1[0] dy1 = q2[1] - q1[1] a = dy0*dx1; b = dy1*dx0; c = dx0*dx1; d = dy0*dy1 if a == b: return None x = (a*p1[0] - b*q1[0] + c*(q1[1] - ...
import sys readline = sys.stdin.readline write = sys.stdout.write def cross3(O, A, B): ox, oy = O; ax, ay = A; bx, by = B return (ax - ox) * (by - oy) - (bx - ox) * (ay - oy) def cross_point(p0, p1, q0, q1): x0, y0 = p0; x1, y1 = p1 x2, y2 = q0; x3, y3 = q1 dx0 = x1 - x0; dy0 = y1 - y0 dx1 = x3 ...
s081566786
s598375223
p02302
python
Runtime Error
n, m = map(int, raw_input().split()) c = map(int, raw_input().split()) memo = [-1] * (n+1) def dfs(rest): if memo[rest] != -1: return memo[rest] if rest == 0: return 0 res = n+1 for i in xrange(m): if c[i] <= rest: res = min(res, 1 + dfs(rest - c[i])) memo[rest] =...
n, m = map(int, raw_input().split()) c = map(int, raw_input().split()) dp = [n+1] * (n+1) dp[n] = 0 for rest in xrange(n, 0, -1): for i in xrange(m): if c[i] <= rest: dp[rest - c[i]] = min(dp[rest - c[i]], 1 + dp[rest]) print dp[0]
s579875572
s427442930
p02314
python
Runtime Error
from bisect import * n = input() dp = [n+1]*(n+1) dp[0] = -1 for i in xrange(n): a = input() idx = bisect(dp, a-1) dp[idx] = min(a, dp[idx]) print bisect(dp, n)-1
from bisect import * import sys def solve(N, A): INF = 10**10 dp = [INF]*(N+1) dp[0] = -1 for a in A: idx = bisect(dp, a-1) dp[idx] = min(a, dp[idx]) return max(i for i in range(N+1) if dp[i] < INF) N, *A = map(int, sys.stdin.read().split()) sys.stdout.write("%d\n" % solve(N, A))
s987355139
s579349894
p02317
python
Runtime Error
V, E = map(int, raw_input().split()) g = [[] for i in xrange(V)] for i in xrange(E): s, t, d = map(int, raw_input().split()) g[s].append((t, d)) INF = 10**9 dp = [[-1]*V for i in xrange(2**V)] tmp = {} def dfs(state, v, s): if dp[state][v] != -1: return dp[state][v] if state == 2**V-1: f...
import sys readline = sys.stdin.readline V, E = map(int, readline().split()) g = [[] for i in xrange(V)] cost = {} to = [0]*V for i in xrange(E): s, t, d = map(int, readline().split()) g[s].append((t, d)) cost[s,t] = d to[s] |= 1 << t get = cost.get INF = 10**9 ALL = 2**V-1 dp = {} start = 0 def dfs(sta...
s066917304
s681752970
p02323
python
Time Limit Exceeded
V, E = map(int, raw_input().split()) g = [[] for i in xrange(V)] cost = {} for i in xrange(E): s, t, d = map(int, raw_input().split()) g[s].append((t, d)) cost[s,t] = d get = cost.get INF = 10**9 ALL = 2**V-1 dp = [[-1]*V for i in xrange(2**V)] def dfs(state, v, s): if dp[state][v] != -1: return...
import sys readline = sys.stdin.readline V, E = map(int, readline().split()) g = [[] for i in xrange(V)] cost = {} to = [0]*V for i in xrange(E): s, t, d = map(int, readline().split()) g[s].append((t, d)) cost[s,t] = d to[s] |= 1 << t get = cost.get INF = 10**9 ALL = 2**V-1 dp = {} start = 0 def dfs(sta...
s479721894
s681752970
p02323
python
Time Limit Exceeded
V, E = map(int, raw_input().split()) g = [[] for i in xrange(V)] cost = {} for i in xrange(E): s, t, d = map(int, raw_input().split()) g[s].append((t, d)) cost[s,t] = d get = cost.get INF = 10**9 ALL = 2**V-1 dp = {} def dfs(state, v, s): key = (state, v) if key in dp: return dp[key] if ...
import sys readline = sys.stdin.readline V, E = map(int, readline().split()) g = [[] for i in xrange(V)] cost = {} to = [0]*V for i in xrange(E): s, t, d = map(int, readline().split()) g[s].append((t, d)) cost[s,t] = d to[s] |= 1 << t get = cost.get INF = 10**9 ALL = 2**V-1 dp = {} start = 0 def dfs(sta...
s529824844
s681752970
p02323
python
Time Limit Exceeded
import sys readline = sys.stdin.readline V, E = map(int, readline().split()) g = [[] for i in xrange(V)] cost = {} to = [0]*V for i in xrange(E): s, t, d = map(int, readline().split()) g[s].append((t, d)) cost[s,t] = d to[s] |= 1 << t get = cost.get INF = 10**9 ALL = 2**V-1 dp = {} start = -1 def dfs(st...
import sys readline = sys.stdin.readline V, E = map(int, readline().split()) g = [[] for i in xrange(V)] cost = {} to = [0]*V for i in xrange(E): s, t, d = map(int, readline().split()) g[s].append((t, d)) cost[s,t] = d to[s] |= 1 << t get = cost.get INF = 10**9 ALL = 2**V-1 dp = {} start = 0 def dfs(sta...
s599820067
s681752970
p02323
python
Time Limit Exceeded
N = int(input()) *H, = map(int, input().split()) st = [(0, -1)] ans = 0 for i in range(N): h = H[i] base = i while h <= st[-1][0]: h0, j = st.pop() ans = max(ans, (i-j)*h0) base = j st.append((h, base)) while st: h0, j = st.pop() ans = max(ans, (N-j)*h0) print(ans)
N = int(input()) *H, = map(int, input().split()) st = [(0, -1)] ans = 0 for i in range(N): h = H[i] base = i while st and h <= st[-1][0]: h0, j = st.pop() ans = max(ans, (i-j)*h0) base = j st.append((h, base)) while st: h0, j = st.pop() ans = max(ans, (N-j)*h0) print(ans)
s681863589
s216472975
p02328
python
Runtime Error
from heapq import heappush, heappop V, E, r = map(int, raw_input().split()) g = [[] for i in xrange(V)] for i in xrange(E): s, t, d = map(int, raw_input().split()) g[s].append((t, d)) INF = 10**10 dist = [INF]*V que = [(0,r)] dist[r] = 0 while que: c, v = heappop(que) if dist[v] < c: continue ...
class RadixHeap: __slots__ = ["data", "last", "siz", "used"] # (max_key - min_key) <= C def __init__(self, N, C): self.data = [[] for i in range(C.bit_length() + 1)] self.last = self.siz = 0 self.used = [0]*N def push(self, x, key): #assert self.last <= x self.s...
s274818201
s032621206
p02361
python
Runtime Error
def get_articulation_points(G, N, start=0): v_min = [0]*N; order = [None]*N result = []; count = 0 def dfs(v, prev): nonlocal count r_min = order[v] = count fcnt = 0; p_art = 0 count += 1 for w in G[v]: if w == prev: continue if...
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline write = sys.stdout.write N, M = map(int, readline().split()) G = [[] for i in range(N)] for i in range(M): u, v = map(int, readline().split()) G[u].append(v) G[v].append(u) # a chain decomposition def construct(G, N): P = [0]*N ...
s410774057
s509737171
p02366
python
Runtime Error
def get_articulation_points(G, N, start=0): v_min = [0]*N; order = [None]*N result = []; count = 0 def dfs(v, prev): nonlocal count r_min = order[v] = count fcnt = 0; p_art = 0 count += 1 for w in G[v]: if w == prev: continue i...
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline write = sys.stdout.write N, M = map(int, readline().split()) G = [[] for i in range(N)] for i in range(M): u, v = map(int, readline().split()) G[u].append(v) G[v].append(u) # a chain decomposition def construct(G, N): P = [0]*N ...
s254297228
s509737171
p02366
python
Runtime Error
while 1: n = input() if n == 0: break G = [[] for i in xrange(n)] for i in xrange(n-1): s, t, w = map(int, raw_input().split()) G[s].append((t, w)) G[t].append((s, w)) def dfs(s, prev): if prev != -1 and len(G[s]) == 1: return (0, s) res =...
N = int(input()) G = [[] for i in range(N)] for i in range(N-1): s, t, w = map(int, input().split()) G[s].append((t, w)) G[t].append((s, w)) from collections import deque def bfs(s): dist = [None]*N que = deque([s]) dist[s] = 0 while que: v = que.popleft() d = dist[v] ...
s725953730
s752082396
p02371
python
Runtime Error
import sys sys.setrecursionlimit(10**6) while 1: n = input() if n == 0: break G = [[] for i in xrange(n)] for i in xrange(n-1): s, t, w = map(int, raw_input().split()) G[s].append((t, w)) G[t].append((s, w)) def dfs(s, prev): if prev != -1 and len(G[s]) == 1:...
N = int(input()) G = [[] for i in range(N)] for i in range(N-1): s, t, w = map(int, input().split()) G[s].append((t, w)) G[t].append((s, w)) from collections import deque def bfs(s): dist = [None]*N que = deque([s]) dist[s] = 0 while que: v = que.popleft() d = dist[v] ...
s830985785
s752082396
p02371
python
Runtime Error
import sys sys.setrecursionlimit(10**6) n = input() G = [[] for i in xrange(n)] for i in xrange(n-1): s, t, w = map(int, raw_input().split()) G[s].append((t, w)) G[t].append((s, w)) def dfs(s, prev): if prev != -1 and len(G[s]) == 1: return (0, s) res = (0, -1) for t, w in G[s]: ...
N = int(input()) G = [[] for i in range(N)] for i in range(N-1): s, t, w = map(int, input().split()) G[s].append((t, w)) G[t].append((s, w)) from collections import deque def bfs(s): dist = [None]*N que = deque([s]) dist[s] = 0 while que: v = que.popleft() d = dist[v] ...
s285166837
s752082396
p02371
python
Runtime Error
import sys sys.setrecursionlimit(10**6) n = input() G = [[] for i in xrange(n)] for i in xrange(n-1): s, t, w = map(int, raw_input().split()) G[s].append((t, w)) G[t].append((s, w)) def dfs(s, prev): if prev != -1 and len(G[s]) == 1: return (0, s) res = (0, s) for t, w in G[s]: ...
N = int(input()) G = [[] for i in range(N)] for i in range(N-1): s, t, w = map(int, input().split()) G[s].append((t, w)) G[t].append((s, w)) from collections import deque def bfs(s): dist = [None]*N que = deque([s]) dist[s] = 0 while que: v = que.popleft() d = dist[v] ...
s656967478
s752082396
p02371
python
Runtime Error
from collections import deque n = input() C = [None]*n P = [None]*n for i in xrange(n): ipt = map(int, raw_input().split()) C[i] = ipt[1:] for c in C[i]: P[c] = i LEV = (n+1).bit_length() parent = [[None]*(LEV + 1) for i in xrange(n)] for i in xrange(n): parent[i][0] = P[i] for k in xrange(1, L...
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline write = sys.stdout.write N = int(readline()) G = [None]*N for v in range(N): k, *G[v] = map(int, readline().split()) S = [] FS = [0]*N depth = [0]*N *it, = map(iter, G) P = [-1]*N stk = [0] depth[0] = 0 FS[0] = 0 while stk: v = stk[-1] ...
s972907851
s604336117
p02373
python
Runtime Error
pi = 3.1415926535897 r = int(input()) print(pi*r**2, 2*pi*r)
pi = 3.1415926535897 r = float(input()) print(pi*r**2, 2*pi*r)
s483028110
s432026869
p02400
python
Runtime Error
S = [s.strip().replace("/","//") for s in open(0).readlines()][:-1] print(*map(eval, S), sep='\n')
ans = [] for s in open(0).readlines(): if "?" in s: break ans.append(eval(s.strip().replace("/", "//"))) print(*ans, sep='\n')
s942365981
s146403832
p02401
python
Runtime Error
for i in xrange(1,10): for j in xrange(1,10): print('%sx%s=%s'%(i,j,i*j))
for i in xrange(1,10): for j in xrange(1,10): print '%sx%s=%s'%(i,j,i*j)
s980955845
s455127107
p00000
python
Runtime Error
import math while True: a,b = map(int,raw_input().split()) print int(math.log10(a + b) + 1)
import math while True: try: a,b = map(int,raw_input().split()) print int(math.log10(a + b) + 1) except EOFError: break
s838717792
s907902235
p00002
python
Runtime Error
while True: a,b,c,d,e,f = map(int,raw_input().split()) x = 0.; y = 0. delta = abs(a*e-b*d) x = float((e*c-b*f)/delta) y = float((a*f-d*c)/delta) print "%.3f %.3f" % (x,y)
while True: try: a,b,c,d,e,f = map(float,raw_input().split()) delta =a*e-b*d x = (e*c-b*f)/delta y = (a*f-d*c)/delta if abs(x)<1e-3: x=0 if abs(y)<1e-3: y=0 #print str('%.3f' % x) + " " + str('%.3f' % y) print "%.3f %.3f" % (x,y...
s340453629
s192332390
p00004
python
Runtime Error
def euclid(m,n): while m%n>0: r=m%n m,n=n,r else: return n def isprime_euclid2(N): if N==1: return False elif N==2: return True elif N>=3: euclid_list=[] for k in range(1,int(round(math.sqrt(N)))+1): euclid_list.append(euclid(N,k)...
def prime_table(n): list = [True for _ in xrange(n + 1)] i = 2 while i * i <= n: if list[i]: j = i + i while j <= n: list[j] = False j += i i += 1 table = [i for i in xrange(n + 1) if list[i] and i >= 2] return table table = prime_table(999999) while True: try: ...
s174562942
s534088038
p00009
python
Time Limit Exceeded
while True: w = int(raw_input()) n = int(raw_input()) ans = [] ans = [j for j in range(1,w+1)] for k in range(n): a,b = map(int,(raw_input().split(","))) ans[a-1],ans[b-1] = ans[b-1],ans[a-1] for item in ans: print item
while True: try: w = int(raw_input()) n = int(raw_input()) ans = [j for j in range(1,w+1)] for k in range(n): a,b = map(int,(raw_input().split(","))) ans[a-1],ans[b-1] = ans[b-1],ans[a-1] for item in ans: print item except EOFError: ...
s135555369
s289426333
p00011
python
Runtime Error
# -*- coding: utf-8 -*- while True: try: ls = [] dic = {}# {'your' : [appeared,len]} ls = raw_input().split() for k in range(len(ls)): if ls[k] not in dic.keys(): dic[ls[k]] = [] dic[ls[k]].append(1) dic[ls[k]].appe...
wordlist = [] wordlist = raw_input().split() dic = {} longest = ['',0] m = 0 for word in wordlist: # mode if word not in dic: dic[word] = 1 else: dic[word] += 1 # word_length if m == 0: longest[0] = word longest[1] = len(word) m += 1 ...
s085030920
s726399015
p00029
python
Runtime Error
while True: try: ls = [] dic = {}# {'your' : [appeared,len]} ls = raw_input().split() for k in range(len(ls)): if ls[k] not in dic.keys(): dic[ls[k]] = [] dic[ls[k]].append(1) dic[ls[k]].append(len(ls[k])) ...
wordlist = [] wordlist = raw_input().split() dic = {} longest = ['',0] m = 0 for word in wordlist: # mode if word not in dic: dic[word] = 1 else: dic[word] += 1 # word_length if m == 0: longest[0] = word longest[1] = len(word) m += 1 ...
s693346938
s726399015
p00029
python
Runtime Error
ls = [] while True: try: data = map(float,raw_input().split()) ls.append(data) except EOFError: break ls.sort() ans = ls[-1]-ls[0] print ans
ls = [] while True: try: data = float(raw_input()) ls.append(data) except EOFError: break print max(ls)-min(ls)
s690915138
s369099728
p00046
python
Runtime Error
ls = [] while True: try: data = float(raw_input().split()) ls.append(data) except EOFError: break ls.sort() ans = ls[-1]-ls[0] print ans
ls = [] while True: try: data = float(raw_input()) ls.append(data) except EOFError: break print max(ls)-min(ls)
s521228028
s369099728
p00046
python
Runtime Error
def CurrentPos(ls,h=0,w=0): if ls[h][w] == '>': w +=1 elif ls[h][w] =='<': w -=1 elif ls[h][w] =='^': h -=1 elif ls[h][w] =='v': h +=1 return [h,w] def HasPosReached(pos_list,h,w): for k,j in pos_list: if (h,w) == (k,j): return True ...
while True: H,W = map(int,raw_input().split()) if (H,W) == (0,0): break array = [raw_input() for i in range(H)] saw = [[False for i in range(W)] for j in range(H)] X = 0 Y = 0 while True: if array[X][Y] == ">": Y += 1 if saw[X][Y]: print 'LOOP'...
s925249403
s572727216
p00104
python
Runtime Error
def hantei(A,B,C,R=0): h,t = sorted([A,B,C])[:2] if h**2 + t**2 < 4 * R**2: print 'OK' else: print 'NA' while True: try: A,B,C = map(int,raw_input().split()) except EOFError: break for k in range(int(raw_input())): hantei(A,B,C,int(raw_input())) ...
def hantei(A,B,C,R=0): p,q = sorted([A,B,C])[:2] if p**2 + q**2 < 4 * R**2: print 'OK' else: print 'NA' while True: try: A,B,C = map(int,raw_input().split()) if (A,B,C) == (0,0,0): break except EOFError: break for k in range(int(raw_input()))...
s168436260
s312980396
p00107
python
Runtime Error
def hantei(A,B,C,R=0): h,t = sorted([A,B,C])[:2] if h**2 + t**2 < 4 * R**2: print 'OK' else: print 'NA' while True: try: A,B,C = map(int,raw_input().split()) except EOFError: break for k in range(int(raw_input())): hantei(A,B,C,int(raw_input())) ...
def hantei(A,B,C,R=0): p,q = sorted([A,B,C])[:2] if p**2 + q**2 < 4 * R**2: print 'OK' else: print 'NA' while True: try: A,B,C = map(int,raw_input().split()) if (A,B,C) == (0,0,0): break except EOFError: break for k in range(int(raw_input()))...
s426729983
s312980396
p00107
python
Runtime Error
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(...
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 l < 0.2 : 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().spli...
s260604318
s155693074
p00149
python
Runtime Error
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(...
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 l < 0.2 : 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().spli...
s074284244
s155693074
p00149
python
Runtime Error
def North(ls): ls[1-1],ls[2-1],ls[5-1],ls[6-1] = ls[2-1],ls[6-1],ls[1-1],ls[5-1] def East(ls): ls[1-1],ls[3-1],ls[4-1],ls[6-1] = ls[4-1],ls[1-1],ls[6-1],ls[3-1] def West(ls): ls[1-1],ls[3-1],ls[4-1],ls[6-1] = ls[3-1],ls[6-1],ls[1-1],ls[4-1] def South(ls): ls[1-1],ls[2-1],ls[5-1],ls[6-1] = ls[5-1],ls[1-1...
def North(ls): ls[1-1],ls[2-1],ls[5-1],ls[6-1] = ls[2-1],ls[6-1],ls[1-1],ls[5-1] def East(ls): ls[1-1],ls[3-1],ls[4-1],ls[6-1] = ls[4-1],ls[1-1],ls[6-1],ls[3-1] def West(ls): ls[1-1],ls[3-1],ls[4-1],ls[6-1] = ls[3-1],ls[6-1],ls[1-1],ls[4-1] def South(ls): ls[1-1],ls[2-1],ls[5-1],ls[6-1] = ls[5-1],ls[1-1...
s025244865
s982998698
p00425
python
Runtime Error
while True: try: n = int(raw_input()) if n==0: break dice = [1,2,3,4,5,6] # top, south, east, west, north, bottom direction = "" total = 1 for k in range(n): direction = str(raw_input()) if direction=="North": ...
def North(ls): ls[1-1],ls[2-1],ls[5-1],ls[6-1] = ls[2-1],ls[6-1],ls[1-1],ls[5-1] def East(ls): ls[1-1],ls[3-1],ls[4-1],ls[6-1] = ls[4-1],ls[1-1],ls[6-1],ls[3-1] def West(ls): ls[1-1],ls[3-1],ls[4-1],ls[6-1] = ls[3-1],ls[6-1],ls[1-1],ls[4-1] def South(ls): ls[1-1],ls[2-1],ls[5-1],ls[6-1] = ls[5-1],ls[1-1...
s788212797
s982998698
p00425
python
Runtime Error
def prime_table(n): list = [True for _ in xrange(n + 1)] i = 2 while i * i <= n: if list[i]: j = i + i while j <= n: list[j] = False j += i i += 1 table = [i for i in xrange(n + 1) if list[i] and i >= 2] return table table = prime_table(1...
def prime_table_boolean(n): list1 = [True for _ in xrange(n + 1)] i = 2 while i * i <= n: if list1[i]: j = i + i while j <= n: list1[j] = False j += i i += 1 list1[1] = False del list1[0] #table = [i for i in xrange(n + 1) if list1[i] ...
s375305179
s836654161
p00590
python
Time Limit Exceeded
def prime_table(n): list = [True for _ in xrange(n + 1)] i = 2 while i * i <= n: if list[i]: j = i + i while j <= n: list[j] = False j += i i += 1 table = [i for i in xrange(n + 1) if list[i] and i >= 2] return table table = prime_table(1...
def prime_table_boolean(n): list1 = [True for _ in xrange(n + 1)] i = 2 while i * i <= n: if list1[i]: j = i + i while j <= n: list1[j] = False j += i i += 1 list1[1] = False del list1[0] #table = [i for i in xrange(n + 1) if list1[i] ...
s581423072
s836654161
p00590
python
Time Limit Exceeded
def isprime_euclid2(N): if N<1: print 'N>2' elif N==2: return True import math def euclid(m,n): while m%n>0: r=m%n m,n=n,r else: return n euclid_list=[] for k in range(1,int(round(math.sqrt(N)))+1): euc...
import math def is_prime(n): if n % 2 == 0 and n > 2: return False return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2)) while True: try: n = int(raw_input()) total = 0 for k in range(n): if is_prime(int(raw_input())): ...
s032477981
s076001263
p02257
python
Runtime Error
def isprime_euclid2(N): if N<1: print 'N>2' elif N==2: return True def euclid(m,n): while m%n>0: r=m%n m,n=n,r else: return n euclid_list=[] for k in range(1,int(round(math.sqrt(N)))+1): euclid_list.ap...
import math def is_prime(n): if n % 2 == 0 and n > 2: return False return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2)) while True: try: n = int(raw_input()) total = 0 for k in range(n): if is_prime(int(raw_input())): ...
s608910824
s076001263
p02257
python
Runtime Error
def euclid(m,n): while m%n>0: m,n=n,m%n else: return n def isprime_euclid2(N): if N<1: print 'N>2' elif N==2: return True euclid_list=[] for k in range(1,int(round(math.sqrt(N)))+1): euclid_list.append(euclid(N,k)) temp=set(euclid_list) i...
import math def is_prime(n): if n % 2 == 0 and n > 2: return False return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2)) while True: try: n = int(raw_input()) total = 0 for k in range(n): if is_prime(int(raw_input())): ...
s638010938
s076001263
p02257
python
Runtime Error
def euclid(m,n): while m%n>0: m,n=n,m%n else: return n def isprime_euclid2(N): if N<1: print 'N>2' elif N==2: return True euclid_list=[] for k in range(1,int(round(math.sqrt(N)))+1): euclid_list.append(euclid(N,k)) temp=set(euclid_list) i...
import math def is_prime(n): if n % 2 == 0 and n > 2: return False return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2)) while True: try: n = int(raw_input()) total = 0 for k in range(n): if is_prime(int(raw_input())): ...
s935564078
s076001263
p02257
python
Time Limit Exceeded
def euclid(m,n): while m%n>0: m,n=n,m%n else: return n def isprime_euclid2(N): if N<1: print 'N>2' elif N==2: return True euclid_list=[] for k in range(1,int(round(math.sqrt(N)))+1): euclid_list.append(euclid(N,k)) temp=set(euclid_list) i...
import math def is_prime(n): if n % 2 == 0 and n > 2: return False return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2)) while True: try: n = int(raw_input()) total = 0 for k in range(n): if is_prime(int(raw_input())): ...
s310530642
s076001263
p02257
python
Time Limit Exceeded
while True: try: n = int(raw_input()) except EOFError: break ls = [] for i in range(n): ls.append(int(raw_input())) maxvalue = -999999999999999999999999999999 for k in range(len(ls)): for j in range(1,k+1): if ls[k]-ls[k-j] > maxvalue: ...
n = int(raw_input()) R = [] R.append(int(raw_input())) minv = R[0] maxv = -1 * 10**9 for j in xrange(1,n): R.append(int(raw_input())) maxv = max(maxv,R[j]-minv) minv = min(minv,R[j]) print maxv
s819009656
s126369485
p02258
python
Time Limit Exceeded
while True: try: n = int(raw_input()) except EOFError: break ls = [] for i in range(n): ls.append(int(raw_input())) maxvalue = -999999999999999999999999999999 for k in range(len(ls)): temp = ls[k] - min(ls[:k]) if temp > maxvalue: ...
n = int(raw_input()) R = [] R.append(int(raw_input())) minv = R[0] maxv = -1 * 10**9 for j in xrange(1,n): R.append(int(raw_input())) maxv = max(maxv,R[j]-minv) minv = min(minv,R[j]) print maxv
s935389131
s126369485
p02258
python
Runtime Error
while True: try: n = int(raw_input()) except EOFError: break ls = [] for i in range(n): ls.append(int(raw_input())) maxvalue = -999999999999999999999999999999 for k in range(len(ls)): if k == 0: continue else: temp = l...
n = int(raw_input()) R = [] R.append(int(raw_input())) minv = R[0] maxv = -1 * 10**9 for j in xrange(1,n): R.append(int(raw_input())) maxv = max(maxv,R[j]-minv) minv = min(minv,R[j]) print maxv
s832401782
s126369485
p02258
python
Time Limit Exceeded
# for loop n = int(raw_input()) ls = [] for i in range(n): ls.append(int(raw_input())) ans = None for k in range(n): for j in range(k+1,n): dif = ls[j]-ls[k] if ans is None: ans = dif elif ans < dif: ans = dif print ans
n = int(raw_input()) R = [] R.append(int(raw_input())) minv = R[0] maxv = -1 * 10**9 for j in xrange(1,n): R.append(int(raw_input())) maxv = max(maxv,R[j]-minv) minv = min(minv,R[j]) print maxv
s504816435
s126369485
p02258
python
Time Limit Exceeded
from collections import deque n=int(raw_input()) que = deque() for i in xrange(n): o = raw_input() if o == 'deleteFirst': del que[0] elif o == 'deleteLast': del que[-1] else: c,p = o.split() p = int(p) if c == 'insert': que.appendleft(p) elif c...
from collections import deque n=int(raw_input()) q = deque() for i in xrange(n): o = raw_input() if o == 'deleteFirst': q.popleft() elif o == 'deleteLast': q.pop() else: c,p = o.split(); p = int(p) if c == 'insert': q.appendleft(p) elif c == 'delete': try: q.remove(p...
s296034245
s515413236
p02265
python
Runtime Error
# -*- coding: utf-8 -*- from collections import deque n=int(raw_input()) que = deque() for i in xrange(n): o = raw_input() if o == 'deleteFirst': del que[0] elif o == 'deleteLast': del que[-1] else: c,p = o.split() p = int(p) if c == 'insert': que.appe...
from collections import deque n=int(raw_input()) q = deque() for i in xrange(n): o = raw_input() if o == 'deleteFirst': q.popleft() elif o == 'deleteLast': q.pop() else: c,p = o.split(); p = int(p) if c == 'insert': q.appendleft(p) elif c == 'delete': try: q.remove(p...
s251929031
s515413236
p02265
python
Runtime Error
def binary_search(A,n): # sequence A, item n l = len(A) if l==0: return False elif A[l/2] > n: return binary_search(A[:l/2],n) elif A[l/2] == n: return True elif A[l/2]<n: return binary_search(A[(l/2)+1:],n) n = int(raw_input()) S = map(int,raw_input().spl...
# coding: utf-8 # Here your code ! n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = map(int,raw_input().split()) C = 0 def binary_search(A,n): """no recursion version""" l = len(A) left = l/2 right = l-1 while A[left] != n: if left == right and A[left] != n: ...
s793478518
s944542490
p02268
python
Time Limit Exceeded
def binary_search(A,n): # sequence A, item n l = len(A) if l==0: return False elif A[l/2] > n: return binary_search(A[:l/2],n) elif A[l/2] == n: return True elif A[l/2]<n: return binary_search(A[(l/2)+1:],n) n = int(raw_input()) S = set(map(int,raw_input()...
# coding: utf-8 # Here your code ! n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = map(int,raw_input().split()) C = 0 def binary_search(A,n): """no recursion version""" l = len(A) left = l/2 right = l-1 while A[left] != n: if left == right and A[left] != n: ...
s747834321
s944542490
p02268
python
Runtime Error
def binary_search(A,n,l): # sequence A, item n, l len(A) if l==0: return False elif A[l/2] > n: return binary_search(A[:l/2],n) elif A[l/2] == n: return True elif A[l/2]<n: return binary_search(A[(l/2)+1:],n) n = int(raw_input()) S = map(int,raw_input().split(...
# coding: utf-8 # Here your code ! n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = map(int,raw_input().split()) C = 0 def binary_search(A,n): """no recursion version""" l = len(A) left = l/2 right = l-1 while A[left] != n: if left == right and A[left] != n: ...
s288822627
s944542490
p02268
python
Runtime Error
def binary_search(A,n): # sequence A, item n l=len(A) if l==0: return False elif A[l/2] > n: return binary_search(A[:l/2],n) elif A[l/2] == n: return True elif A[l/2]<n: return binary_search(A[(l/2)+1:],n) n = int(raw_input()) S = map(int,raw_input().split...
# coding: utf-8 # Here your code ! n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = map(int,raw_input().split()) C = 0 def binary_search(A,n): """no recursion version""" l = len(A) left = l/2 right = l-1 while A[left] != n: if left == right and A[left] != n: ...
s710424426
s944542490
p02268
python
Time Limit Exceeded
def binary_search(A,n): # sequence A, item n l=len(A) if l==0: return False elif A[l/2] > n: return binary_search(A[:l/2],n) elif A[l/2] == n: return True elif A[l/2]<n: return binary_search(A[(l/2)+1:],n) n = int(raw_input()) S = sorted(list(set(map(int,r...
# coding: utf-8 # Here your code ! n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = map(int,raw_input().split()) C = 0 def binary_search(A,n): """no recursion version""" l = len(A) left = l/2 right = l-1 while A[left] != n: if left == right and A[left] != n: ...
s056840550
s944542490
p02268
python
Time Limit Exceeded
def binary_search(A,n): l = len(A) if l==0: return False elif A[l/2] > n: return binary_search(A[:l/2],n) elif A[l/2] == n: return True elif A[l/2]<n: return binary_search(A[(l/2)+1:],n) n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = ...
# coding: utf-8 # Here your code ! n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = map(int,raw_input().split()) C = 0 def binary_search(A,n): """no recursion version""" l = len(A) left = l/2 right = l-1 while A[left] != n: if left == right and A[left] != n: ...
s793112975
s944542490
p02268
python
Time Limit Exceeded
def binary_search(A,n): l = len(A) if l==0: return False elif A[l/2] > n: return binary_search(A[:l/2],n) elif A[l/2] == n: return True elif A[l/2]<n: return binary_search(A[(l/2)+1:],n) n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = ...
# coding: utf-8 # Here your code ! n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = map(int,raw_input().split()) C = 0 def binary_search(A,n): """no recursion version""" l = len(A) left = l/2 right = l-1 while A[left] != n: if left == right and A[left] != n: ...
s010615093
s944542490
p02268
python
Time Limit Exceeded
# coding: utf-8 # Here your code ! n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = map(int,raw_input().split()) C = 0 def binary_search(A,n): l = len(A) if l==0: return False elif A[l/2] > n: return binary_search(A[:l/2],n) elif A[l/2] == n: retur...
# coding: utf-8 # Here your code ! n = int(raw_input()) S = map(int,raw_input().split()) q = int(raw_input()) T = map(int,raw_input().split()) C = 0 def binary_search(A,n): """no recursion version""" l = len(A) left = l/2 right = l-1 while A[left] != n: if left == right and A[left] != n: ...
s340472699
s944542490
p02268
python
Time Limit Exceeded
# coding: utf-8 def maxHeapify(A, i): l = A[2*(i+1)-1] r = A[2*(i+1)] if l <= H and A[l] > A[i]: largest = l else: largest = i if r <= H and A[r] > A[largest]: largest = r if largest != i:???# i ???????????????????????§????????´??? A[i],A[largest] = A[largest],A[i...
# coding: utf-8 def maxHeapify(A, i): l = 2*i r = 2*i+1 if l <= H and A[l] > A[i]: largest = l else: largest = i if r <= H and A[r] > A[largest]: largest = r if largest != i: A[i],A[largest] = A[largest],A[i] maxHeapify(A, largest) d...
s450718300
s067146696
p02288
python
Runtime Error
n,q = map(int,raw_input().split()) Ai = 2**31-1 A = [Ai for i in range(n)] for i in range(q): com,xi,yi = map(int,raw_input().split()) if com==0: # update(xi,yi) A[xi] = yi elif com==1:# find(xi,yi) print min(A[xi:yi+1])
# coding: utf-8 n, q = map(int,raw_input().split()) A = [(1<<31) - 1 for i in xrange(100000)] B = [(1<<31) - 1 for i in xrange(101)] def update(i,x): if A[i] == (1<<31) - 1: A[i] = x B[i/1000] = min(x, B[i/1000]) else: A[i] = x MIN = (1<<31) - 1 for j in xrange(i/1000 ...
s134158993
s554968795
p02345
python
Time Limit Exceeded
n,q = map(int,raw_input().split()) Ai = 2**31-1 A = [Ai]*n for i in xrange(q): com,xi,yi = map(int,raw_input().split()) if com: # find(xi,yi) print min(A[xi:yi+1]) else: # update(xi,yi) A[xi] = yi
# coding: utf-8 n, q = map(int,raw_input().split()) A = [(1<<31) - 1 for i in xrange(100000)] B = [(1<<31) - 1 for i in xrange(101)] def update(i,x): if A[i] == (1<<31) - 1: A[i] = x B[i/1000] = min(x, B[i/1000]) else: A[i] = x MIN = (1<<31) - 1 for j in xrange(i/1000 ...
s728869761
s554968795
p02345
python
Time Limit Exceeded
# Range Minimum Query n,q = map(int,raw_input().split()) A = [2**31-1]*n for i in range(q): comi,xi,yi = map(int,raw_input().split()) if comi: print min(A[xi:yi+1]) else: A[xi]=yi
# coding: utf-8 n, q = map(int,raw_input().split()) A = [(1<<31) - 1 for i in xrange(100000)] B = [(1<<31) - 1 for i in xrange(101)] def update(i,x): if A[i] == (1<<31) - 1: A[i] = x B[i/1000] = min(x, B[i/1000]) else: A[i] = x MIN = (1<<31) - 1 for j in xrange(i/1000 ...
s105175961
s554968795
p02345
python
Time Limit Exceeded
# Range Minimum Query n,q = map(int,raw_input().split()) A = [2**31-1]*n for i in range(q): comi,xi,yi = map(int,raw_input().split()) if comi: print min(A[xi:yi+1]) else: A[xi]=yi
# coding: utf-8 n, q = map(int,raw_input().split()) A = [(1<<31) - 1 for i in xrange(100000)] B = [(1<<31) - 1 for i in xrange(101)] def update(i,x): if A[i] == (1<<31) - 1: A[i] = x B[i/1000] = min(x, B[i/1000]) else: A[i] = x MIN = (1<<31) - 1 for j in xrange(i/1000 ...
s790148313
s554968795
p02345
python
Time Limit Exceeded
n,q = map(int,raw_input().split()) A = [2**31-1 for i in range(n)] B = [2**31-1]*317 for i in range(q): comi,xi,yi = map(int,raw_input().split()) if comi and yi<316: print min(A[xi:yi+1]) elif comi and yi >= 316 and xi/316+1 != yi/316: print min(min(A[xi:(xi/316 + 1)*316]),min(B[xi/316+1:yi/...
# coding: utf-8 n, q = map(int,raw_input().split()) A = [(1<<31) - 1 for i in xrange(100000)] B = [(1<<31) - 1 for i in xrange(101)] def update(i,x): if A[i] == (1<<31) - 1: A[i] = x B[i/1000] = min(x, B[i/1000]) else: A[i] = x MIN = (1<<31) - 1 for j in xrange(i/1000 ...
s940845273
s554968795
p02345
python
Runtime Error
n,q = map(int,raw_input().split()) A = [2**31-1 for i in range(n)] B = [2**31-1 for i in range(318)] for i in range(q): comi,xi,yi = map(int,raw_input().split()) if comi and yi<316: print min(A[xi:yi+1]) elif comi and yi >= 316 and xi/316+1 != yi/316: print min(min(A[xi:(xi/316 + 1)*316]),mi...
# coding: utf-8 n, q = map(int,raw_input().split()) A = [(1<<31) - 1 for i in xrange(100000)] B = [(1<<31) - 1 for i in xrange(101)] def update(i,x): if A[i] == (1<<31) - 1: A[i] = x B[i/1000] = min(x, B[i/1000]) else: A[i] = x MIN = (1<<31) - 1 for j in xrange(i/1000 ...
s938695728
s554968795
p02345
python
Runtime Error
# -*- coding: utf-8 -*- # Range Minimum Query n,q = map(int,raw_input().split()) A = [2**31-1 for i in range(n)] B = [2**31-1]*101 for i in range(q): comi,xi,yi = map(int,raw_input().split()) if comi and abs(yi-xi)<=199: print min(A[xi:yi+1]) elif comi and 200<= abs(yi-xi): print min(min(A[...
# coding: utf-8 n, q = map(int,raw_input().split()) A = [(1<<31) - 1 for i in xrange(100000)] B = [(1<<31) - 1 for i in xrange(101)] def update(i,x): if A[i] == (1<<31) - 1: A[i] = x B[i/1000] = min(x, B[i/1000]) else: A[i] = x MIN = (1<<31) - 1 for j in xrange(i/1000 ...
s290602934
s554968795
p02345
python
Runtime Error
# -*- coding: utf-8 -*- # Range Minimum Query n,q = map(int,raw_input().split()) A = [2**31-1 for i in range(n)] B = [2**31-1]*1001 for i in range(q): comi,xi,yi = map(int,raw_input().split()) if comi and abs(yi-xi)<=199: print min(A[xi:yi+1]) elif comi and 200<= abs(yi-xi): print min(min(A...
# coding: utf-8 n, q = map(int,raw_input().split()) A = [(1<<31) - 1 for i in xrange(100000)] B = [(1<<31) - 1 for i in xrange(101)] def update(i,x): if A[i] == (1<<31) - 1: A[i] = x B[i/1000] = min(x, B[i/1000]) else: A[i] = x MIN = (1<<31) - 1 for j in xrange(i/1000 ...
s785108985
s554968795
p02345
python
Time Limit Exceeded
class Dice: def __init__(self,ls): self.a = ls[1-1] # top self.b = ls[2-1] # front self.c = ls[3-1] # right self.d = ls[4-1] # left self.e = ls[5-1] # back self.f = ls[6-1] # bottom def E(self): self.a, self.c, self.f, self.d = self.d, self.a, self.c,...
class Dice: def __init__(self,ls): self.a = ls[1-1] # top self.b = ls[2-1] # front self.c = ls[3-1] # right self.d = ls[4-1] # left self.e = ls[5-1] # back self.f = ls[6-1] # bottom def E(self): self.a, self.c, self.f, self.d = self.d, self.a, se...
s902971643
s711062578
p02384
python
Time Limit Exceeded
import sys num = sys.stdin.readline() ans = num*num*num print ans
num=raw_input() num = int(num) ans = num*num*num print ans
s932879910
s804044772
p02388
python
Runtime Error
W,H,x,y,r = raw_input() W,H,x,y,r = map(int,(W,H,x,y,r)) def isXok(W,H,x,y,r): if x-r<0 or x+r>W: return False else: return True def isYok(W,H,x,y,r): if y-r<0 or y+r>H: return False else: return True if isXok(W,H,x,y,r) and isXok(W,H,x,y,r): print True else: prin...
W,H,x,y,r = raw_input().split() W,H,x,y,r = map(int,(W,H,x,y,r)) def isXok(W,H,x,y,r): if x-r<0 or x+r>W: return False else: return True def isYok(W,H,x,y,r): if y-r<0 or y+r>H: return False else: return True if isXok(W,H,x,y,r) and isYok(W,H,x,y,r): print "Yes" else:...
s365693451
s830873870
p02394
python
Runtime Error
i = 0 while True: x = raw_input() if x == 0: break i += 1 print "Case %d: %d" % (i, x)
i = 0 while True: x = int(raw_input()) if x == 0: break i += 1 print "Case %d: %d" % (i, x)
s454651272
s179728398
p02396
python
Runtime Error
i = 0 while True: x = int(raw_input()) if x == 0: break i += 1 i=str(i) x=str(x) print "Case %d: %d" % (i, x)
i = 0 while True: x = int(raw_input()) if x == 0: break i += 1 print "Case %d: %d" % (i, x)
s090423467
s179728398
p02396
python
Runtime Error
i = 0 while True: x,y = raw_input() if x == 0 and y == 0: break if x > y: x,y = map(str,(x,y)) print x + " " + y else: x,y = map(str,(x,y)) print y + " " + x i += 1 #print "Case %d: %d" % (i, x)
while True: x,y = raw_input().split() x,y = map(int,(x,y)) if x == 0 and y == 0: break if x > y: x,y = map(str,(x,y)) print y + " " + x else: x,y = map(str,(x,y)) print x + " " + y
s356825590
s134968845
p02397
python
Runtime Error
while True: x,y = raw_input() if x == 0 and y == 0: break if x > y: x,y = map(str,(x,y)) print x + " " + y else: x,y = map(str,(x,y)) print y + " " + x
while True: x,y = raw_input().split() x,y = map(int,(x,y)) if x == 0 and y == 0: break if x > y: x,y = map(str,(x,y)) print y + " " + x else: x,y = map(str,(x,y)) print x + " " + y
s522611759
s134968845
p02397
python
Runtime Error
while True: x,y = raw_input() if x == 0 and y == 0: break if x > y: x,y = map(str,(x,y)) print x + " " + y else: x,y = map(str,(x,y)) print y + " " + x
while True: x,y = raw_input().split() x,y = map(int,(x,y)) if x == 0 and y == 0: break if x > y: x,y = map(str,(x,y)) print y + " " + x else: x,y = map(str,(x,y)) print x + " " + y
s962479943
s134968845
p02397
python
Runtime Error
while True: x,y = raw_input() x,y = map(int,(x,y)) if x == 0 and y == 0: break if x > y: x,y = map(str,(x,y)) print x + " " + y else: x,y = map(str,(x,y)) print y + " " + x
while True: x,y = raw_input().split() x,y = map(int,(x,y)) if x == 0 and y == 0: break if x > y: x,y = map(str,(x,y)) print y + " " + x else: x,y = map(str,(x,y)) print x + " " + y
s136639719
s134968845
p02397
python
Runtime Error
while True: x,y = raw_input().split() #x,y = map(int,(x,y)) if x == 0 and y == 0: break if x > y: x,y = map(str,(x,y)) print x + " " + y else: x,y = map(str,(x,y)) print y + " " + x
while True: x,y = raw_input().split() x,y = map(int,(x,y)) if x == 0 and y == 0: break if x > y: x,y = map(str,(x,y)) print y + " " + x else: x,y = map(str,(x,y)) print x + " " + y
s392735721
s134968845
p02397
python
Runtime Error
while True: n = int(raw_input()) try: ls = map(int,raw_input().split()) mi = min(ls) ma = max(ls) su = sum(ls) print "%d %d %d" %(mi,ma,su) except EOFError: break
n = int(raw_input()) ls = map(int,raw_input().split()) mi = min(ls) ma = max(ls) su = sum(ls) print "%d %d %d" % (mi,ma,su)
s278985658
s623064584
p02402
python
Runtime Error
while True: n = int(raw_input()) ls = [] try: ls = map(int,raw_input().split()) mi = min(ls) ma = max(ls) su = sum(ls) print "%d %d %d" %(mi,ma,su) except EOFError: break
n = int(raw_input()) ls = map(int,raw_input().split()) mi = min(ls) ma = max(ls) su = sum(ls) print "%d %d %d" % (mi,ma,su)
s473345850
s623064584
p02402
python
Runtime Error
n = int(raw_input()) ls = [] try: ls = map(int,raw_input().split()) mi = min(ls) ma = max(ls) su = sum(ls) print "%d %d %d" % (mi,ma,su)
n = int(raw_input()) ls = map(int,raw_input().split()) mi = min(ls) ma = max(ls) su = sum(ls) print "%d %d %d" % (mi,ma,su)
s358763273
s623064584
p02402
python
Runtime Error
n = int(raw_input()) ls = map(int,raw_input().split()) mi = min(ls) ma = max(ls) su = sum(ls) print "%d %d %d" % (mi,ma,su)
n = int(raw_input()) ls = map(int,raw_input().split()) mi = min(ls) ma = max(ls) su = sum(ls) print "%d %d %d" % (mi,ma,su)
s002182565
s623064584
p02402
python
Runtime Error
while True: H,W = map(int,raw_input().split()) if H,W == 0,0: break for k in range(H): print "#"*W print ""
while True: H,W = map(int,raw_input().split()) if (H,W) == (0,0): break for k in range(H): print "#"*W print ""
s522944976
s760623449
p02403
python
Runtime Error
try: s = [] while True: t = raw_input() s.append(t) except EOFError: for i in range(len(s)): a = int(s[i].split(' ')[0]) b = int(s[i].split(' ')[1]) print(len(str(a + b)))
try: s = [] while True: t = input() s.append(t) except EOFError: for i in range(len(s)): a = int(s[i].split(' ')[0]) b = int(s[i].split(' ')[1]) print(len(str(a + b)))
s173045159
s013178596
p00002
python
Runtime Error
import sys import math if sys.version_info[0] >= 3: raw_input = input N = int(raw_input()) for i in range(N): x1, y1, x2, y2, x3, y3 = [float(e) for e in raw_input().split()] a1 = 2*x2 - 2*x1 b1 = 2*y2 - 2*y1 c1 = x1**2 - x2**2 + y1**2 - y2**2 a2 = 2 * x3 - 2 * y1 b2 = 2 * y3 - 2 * y1 c...
#!/usr/bin/env python #-*- coding:utf-8 -*- import sys import math n = int(input()) for data in sys.stdin: x1, y1, x2, y2, x3, y3 = map(float, data.split()) a1 = x2 - x1 b1 = y2 - y1 a2 = x3 - x1 b2 = y3 - y1 px = (b2 * (a1 * a1 + b1 * b1) - b1 * (a2 * a2 + b2 * b2)) / (2 * (a1 * b2 - a2 *...
s564589367
s520573129
p00010
python
Runtime Error
import Queue INF = 1 << 29 class Edge: def __init__(self, _v, _cost): self.v = _v self.cost = _cost def parse(s, m, n): if(s[0]=="C"): return int(s.translate(None, "C")) - 1 elif(s[0]=="L"): return int(s.translate(None, "L")) - 1 + m elif(s[0]=="H"): return m + n else: return m + n ...
import Queue INF = 1 << 29 class Edge: def __init__(self, _v, _cost): self.v = _v self.cost = _cost def parse(s, m, n): if(s[0]=="C"): return int(s.translate(None, "C")) - 1 elif(s[0]=="L"): return int(s.translate(None, "L")) - 1 + m elif(s[0]=="H"): return m + n else: return m + n ...
s872824467
s843426476
p00224
python
Runtime Error
import Queue INF = 1 << 29 class Edge: def __init__(self, _v, _cost): self.v = _v self.cost = _cost def parse(s, m, n): if(s[0]=="C"): return int(s.translate(None, "C")) - 1 elif(s[0]=="L"): return int(s.translate(None, "L")) - 1 + m elif(s[0]=="H"): return m + n else: return m + n ...
import Queue INF = 1 << 29 class Edge: def __init__(self, _v, _cost): self.v = _v self.cost = _cost def parse(s, m, n): if(s[0]=="C"): return int(s.translate(None, "C")) - 1 elif(s[0]=="L"): return int(s.translate(None, "L")) - 1 + m elif(s[0]=="H"): return m + n else: return m + n ...
s484103854
s843426476
p00224
python
Runtime Error
import Queue INF = 1 << 29 class Edge: def __init__(self, _v, _cost): self.v = _v self.cost = _cost def parse(s, m, n): if(s[0]=="C"): return int(s.translate(None, "C")) - 1 elif(s[0]=="L"): return int(s.translate(None, "L")) - 1 + m elif(s[0]=="H"): return m + n else: return m + n ...
import Queue INF = 1 << 29 class Edge: def __init__(self, _v, _cost): self.v = _v self.cost = _cost def parse(s, m, n): if(s[0]=="C"): return int(s.translate(None, "C")) - 1 elif(s[0]=="L"): return int(s.translate(None, "L")) - 1 + m elif(s[0]=="H"): return m + n else: return m + n ...
s309301895
s843426476
p00224
python
Runtime Error
while True: x, y, z = map(int, raw_input().split()) if x==0 and y==0 and z==0: break dp = [[0.0 for col in range(5101)] for row in range(61)] m = {} for i in range(y+10): m[i] = (0,0) v = [] v = map(int, raw_input().split()) for i in range(z): n, e, a = map(int, raw_input...
while True: x, y, z = map(int, raw_input().split()) if x==0 and y==0 and z==0: break dp = [[0.0 for col in range(5101)] for row in range(61)] m = {} for i in range(y+10): m[i] = (0,0) v = [] v = map(int, raw_input().split()) for i in range(z): n, e, a = map(int, raw_input...
s209667576
s455790939
p00232
python
Time Limit Exceeded
while True: n = input() if n == 0: break p = map(int, raw_input().strip().split(" ")) j = map(int, raw_input().strip().split(" ")) j.sort(); j.reverse(); sum = 0; num = n; for m in p: sum += m for i in range(n): if (num-1)*(sum+j[i]) < num*sum: break num-=1; sum+=...
while True: n = input() if n == 0: break p = map(int, raw_input().strip().split(" ")) j = map(int, raw_input().strip().split(" ")) j.sort(); j.reverse(); sum = 0; num = n; for m in p: sum += m for i in range(n-1): if (num-1)*(sum+j[i]) < num*sum: break num-=1; sum...
s499015497
s029401468
p00255
python
Runtime Error
import sys for s in sys.stdin: a,b=map(int,raw_input().split()) print a-b
import sys for s in sys.stdin: a,b=map(int,s.split()) print a-b
s475557860
s894759093
p00271
python
Runtime Error
l = [0 for i in range(20)] pos = goal = 0 def solve(cur,sum): global pos, goal if cur == goal: print " ".join(map(str,l[:pos])) return for i in range(sum,0,-1): if cur + i <= goal: l[pos] = i pos += 1 solve(cur+i,i) pos -= 1 while True:...
l = [0]*31 pos = goal = 0 def solve(sum,cur): global pos, goal if sum == goal: print " ".join(map(str,l[:pos])) return for i in range(cur,0,-1): if sum + i <= goal: l[pos] = i pos += 1 solve(sum+i,i) pos -= 1 while True: goal = int(...
s164714359
s256171554
p00430
python
Runtime Error
while True: l = map(int, raw_input().split()) if l[0]==0 and l[1]==0 and l[2]==0: break n = l[0]+l[1]+l[2] s = [] #????¨???? a = set(range(n)) #?????? b = set() #?£???? c = set() #??£??? for i in range(input()): x, y, z, r = map(int, raw_input().split()) x-=1;y-=1;z-=1; ...
while True: i,j,k = map(int, raw_input().split()) if i==0 and j==0 and k==0: break n = i+j+k s = [] a = set(range(n)) b = set() c = set() for i in range(input()): x, y, z, r = map(int, raw_input().split()) x-=1;y-=1;z-=1; if r==0: s.append(set([x,y,z])) el...
s624432675
s309563903
p00437
python
Runtime Error
while True: l = map(int, raw_input().split()) if l[0]==0 and l[1]==0 and l[2]==0: break n = l[0]+l[1]+l[2] s = [] #????¨???? a = set(range(n)) #?????? b = set() #?£???? c = set() #??£??? for i in range(input()): x, y, z, r = map(int, raw_input().split()) x-=1;y-=1;z-=1; ...
while True: i,j,k = map(int, raw_input().split()) if i==0 and j==0 and k==0: break n = i+j+k s = [] a = set(range(n)) b = set() c = set() for i in range(input()): x, y, z, r = map(int, raw_input().split()) x-=1;y-=1;z-=1; if r==0: s.append(set([x,y,z])) el...
s574281187
s309563903
p00437
python
Runtime Error
while 1: n = input() if n == 0: break p = [map(int, raw_input().split()) for i in range(n)] ans = 0 for i in range(n): for j in range(i,n): x = p[j][0] y = p[j][1] mx = x - p[i][0] my = y - p[i][1] if [x+my, y-mx] in p: ...
while 1: n = input() if n == 0: break p = set([tuple(map(int, raw_input().split())) for i in range(n)]) ans = 0 for x1, y1 in p: for x2, y2 in p: mx = x2 - x1 my = y2 - y1 if mx==0 and my==0: continue if (x2+my, y2-mx) in p: if(...
s578554583
s152158248
p00441
python
Time Limit Exceeded
while 1: n = 1000 - input() if n==0:break m = [500,100,50,10,5,1] for i in range(6): x = n / m[i]; n -= m[i] * x; m[i] = x; print reduce(lambda a, x: a+x, m)
while 1: n = 1000-input() if n==1000:break m = [500,100,50,10,5,1] for i in range(6): m[i],n = divmod(n,m[i]) print reduce(lambda a, x: a+x, m)
s636360965
s665745533
p00444
python
Runtime Error
import numpy as np while 1: n = input() if n == 0: break p = np.array(sorted([map(int, raw_input().split()) for i in range(n)])) dist = [p[i] - p[0] for i in range(1,n)] m = input() q = np.array(sorted([map(int, raw_input().split()) for i in xrange(m)])) for p1 in q: for i in range(n...
while 1: n = input() if n == 0: break p = set([tuple(map(int, raw_input().split())) for i in range(n)]) m = input() q = set([tuple(map(int, raw_input().split())) for i in xrange(m)]) ret = False for px, py in p: if ret: break for qx, qy in q: if ret: break ...
s183982371
s128035487
p00447
python
Runtime Error
while 1: n = input() if n == 0: break p = sorted([map(int, raw_input().split()) for i in range(n)]) d = [[p[i][0] - p[0][0], p[i][1] - p[0][1]] for i in range(1,n)] m = input() q = sorted([map(int, raw_input().split()) for i in xrange(m)]) for p1 in q: for i in range(n-1): ...
while 1: n = input() if n == 0: break p = set([tuple(map(int, raw_input().split())) for i in range(n)]) m = input() q = set([tuple(map(int, raw_input().split())) for i in xrange(m)]) ret = False for px, py in p: if ret: break for qx, qy in q: if ret: break ...
s814812663
s128035487
p00447
python
Time Limit Exceeded
while 1: r, c = map(int, raw_input().split()) if r == 0: break old = [None for i in range(r)] new = [[True]*c for i in range(r)] for i in range(r): old[i] = "".join(map(str, raw_input().split())) ans = 0 n = 1<<r for i in range(n): for j in range(r): if i & (1...
while 1: r, c = map(int, raw_input().split()) if r == 0: break old = [raw_input().split() for i in range(r)] old = map(list, zip(*old)) new = [int("".join(lst),2) for lst in old] ans = 0 for i in range(1<<r): ret = 0 for j in new: cnt = bin(i^j).count('1') ...
s211961389
s759883873
p00448
python
Time Limit Exceeded
while 1: try: s1 = raw_input() except: break s2 = raw_input() l = len(s1) f = False for i in range(l,0,-1): for j in range(0,l-i+1): if j+i > l: break x = s2.find(s1[j:j+i]) if x != -1: f = True print i ...
while 1: try: s1 = raw_input() s2 = raw_input() if len(s1) < len(s2): s1,s2 = s2,s1 l = sum(min(s1.count(i), s2.count(i)) for i in set(list(s1)) & set(list(s2))) if l == 0: print 0; continue ans = 0 for i in range(len(s2)): if len(s2) - i <= ans: b...
s357331575
s211597978
p00451
python
Time Limit Exceeded