s_id
string
p_id
string
u_id
string
date
string
language
string
original_language
string
filename_ext
string
status
string
cpu_time
string
memory
string
code_size
string
code
string
error
string
stdout
string
s776819136
p02242
u845643816
1511969133
Python
Python3
py
Runtime Error
0
0
742
rootList = [-1 for i in range(n)] parent = [0 for i in range(n)] lenList = [float("inf") for i in range(n)] lenList[0] = 0 def getRoot(x): r = rootList[x] if r < 0: rootList[x] = x elif r != x: rootList[x] = getRoot(r) return rootList[x] flag = True while flag: flag = False edge...
Traceback (most recent call last): File "/tmp/tmpv9liap56/tmpcnr6esuk.py", line 1, in <module> rootList = [-1 for i in range(n)] ^ NameError: name 'n' is not defined
s945333322
p02242
u626266743
1511970077
Python
Python3
py
Runtime Error
0
0
940
from sys import stdin INFTY = 1 << 21 WHITE = 0 GRAY = 1 BLACK = 2 n = int(stdin.readline()) M = [[INFTY for i in range(n)] for j in range(n)] for u in range(n): U = list(map(int, stdin.readline().split()[2:])) for j in range(0, len(U), 2): M[u][U[j]] = U[j+1] d = [INFTY for i in range(n)] color = [...
File "/tmp/tmpao5kgz39/tmpjvtwby2j.py", line 35 if(d[v] > d[u] + M[u][v]:) ^ SyntaxError: invalid syntax
s329299363
p02242
u626266743
1511970106
Python
Python3
py
Runtime Error
0
0
926
from sys import stdin INFTY = 1 << 21 WHITE = 0 GRAY = 1 BLACK = 2 n = int(stdin.readline()) M = [[INFTY] * n for i in range(n)] for u in range(n): U = list(map(int, stdin.readline().split()[2:])) for j in range(0, len(U), 2): M[u][U[j]] = U[j+1] d = [INFTY for i in range(n)] color = [WHITE for i in...
File "/tmp/tmptll4kmka/tmpows20atk.py", line 35 if(d[v] > d[u] + M[u][v]:) ^ SyntaxError: invalid syntax
s010523309
p02242
u626266743
1511970367
Python
Python3
py
Runtime Error
0
0
952
from sys import stdin INFTY = 1 << 21 WHITE = 0 GRAY = 1 BLACK = 2 n = int(stdin.readline()) M = [[INFTY for i in range(n)] for j in range(n)] for u in range(0, n): U = list(map(int, stdin.readline().split()[2:])) for j in range(0, len(U), 2): M[u][U[j]] = U[j+1] d = [INFTY for i in range(n)] color ...
File "/tmp/tmp1tw5mwvb/tmpde3oxtfp.py", line 35 if(d[v] > d[u] + M[u][v]:) ^ SyntaxError: invalid syntax
s638264617
p02243
u007270338
1530999457
Python
Python3
py
Runtime Error
0
0
1585
#coding:utf-8 import numpy as np n = int(input()) inf = 1000000000000000 def minHeapify(Q,i): H = len(Q) l = 2*i r = 2*i + 1 if l < H and Q[l][1] < Q[i][1]: smallest = l else: smallest = i if r < H and Q[r][1] < Q[smallest][1]: smallest = r if smallest != i: ...
Traceback (most recent call last): File "/tmp/tmpgzbij1u3/tmpkv7i0u9a.py", line 4, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s762706872
p02243
u007270338
1530999477
Python
Python3
py
Runtime Error
0
0
1585
#coding:utf-8 import numpy as np n = int(input()) inf = 1000000000000000 def minHeapify(Q,i): H = len(Q) l = 2*i r = 2*i + 1 if l < H and Q[l][1] < Q[i][1]: smallest = l else: smallest = i if r < H and Q[r][1] < Q[smallest][1]: smallest = r if smallest != i: ...
Traceback (most recent call last): File "/tmp/tmppxsvkz1f/tmp47ywtdkb.py", line 4, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s843155929
p02243
u684241248
1531715759
Python
Python3
py
Runtime Error
0
0
4593
# -*- coding: utf-8 -*- from collections import defaultdict from heapq import heappop, heappush def dijkstra(edges, start, *, adj_matrix=False, default_value=float('inf')): ''' Returns best costs to each node from 'start' node in the given graph. (Single Source Shortest Path - SSSP) If edges is given...
Traceback (most recent call last): File "/tmp/tmpjui202cm/tmpn7u5qna3.py", line 139, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s176385792
p02243
u567380442
1422449899
Python
Python3
py
Runtime Error
600
7172
519
import io, sys, itertools f = sys.stdin def take2(iterable): i = iter(iterable) while True: yield next(i), next(i) n = int(f.readline()) adj =[[(v, c) for v, c in take2(map(int, f.readline().split()[2:]))] for _ in range(n)] d = [100000 * 100 + 1] * n d[0] = 0 def search(parent, children): ...
Traceback (most recent call last): File "/tmp/tmp52ciu0dm/tmpe3wyvy85.py", line 11, in <module> n = int(f.readline()) ^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s741918244
p02243
u177808190
1455082265
Python
Python
py
Runtime Error
10
6488
901
MAX = 100 INF = 1000000 WHITE = 0 GRAY = 1 BLACK = 2 n = int(raw_input()) M = [[INF for i in range(n)]for j in range(n)] d = [INF for i in range(MAX)] Color = [WHITE for i in range(MAX)] for i in range(n): tmp = map(int,raw_input().split()) u = tmp[0] k = tmp[1] for j in range(1, k + 1): v = tm...
File "/tmp/tmp3t5gnm8s/tmpzq66gwqw.py", line 40 print i, ^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s552386463
p02243
u138577439
1486893329
Python
Python3
py
Runtime Error
0
0
690
V=int(input()) G=[[] for i in range(V)] d=[1001001001 for i in range(V)] used=[False for i in range(V)] import heapq def dijkstra(s): q=[] d[s]=0 heapq.heappush(q,(0, s)) while(len(q)): p=heapq.heappop(q) v=p[1] used[v]=true if d[v]<p[0]: ...
Traceback (most recent call last): File "/tmp/tmpl2lrewze/tmptynhgjcl.py", line 1, in <module> V=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s922390877
p02243
u798803522
1511064737
Python
Python3
py
Runtime Error
0
0
818
from collections import defaultdict import heapq v_num = int(input()) connect = defaultdict(list) for _ in range(v_num): que = [int(n) for n in input().split(" ")] connect[que[0]] = [[v, w] for v, w in zip(que[2:len(que):2], que[3:len(que):2]) # weight_edge[que[0]] = {k:v for k, v in zip(que[2:len(que):2],...
File "/tmp/tmpihtv8e__/tmpzzkes1ye.py", line 8 connect[que[0]] = [[v, w] for v, w in zip(que[2:len(que):2], que[3:len(que):2]) ^ SyntaxError: '[' was never closed
s017238616
p02243
u150984829
1520418592
Python
Python3
py
Runtime Error
0
0
352
import sys from heapq import* e=sys.stdin.readline I=float("inf") def m(): n=int(e()) A=[] for _ in[0]*n: e=list(map(int,e().split())) A+=[zip(e[2::2],e[3::2])] d=[0]+[I]*n H=[(0,0)] while H: u=heappop(H)[1] for v,c in A[u]: t=d[u]+c if d[v]>t: d[v]=t heappush(H,(t,v)) print('\n'.join(f'{i}...
Traceback (most recent call last): File "/tmp/tmpv6z5xax0/tmphev_uz3s.py", line 21, in <module> m() File "/tmp/tmpv6z5xax0/tmphev_uz3s.py", line 6, in m n=int(e()) ^ UnboundLocalError: cannot access local variable 'e' where it is not associated with a value
s626456910
p02243
u792145349
1525228743
Python
Python3
py
Runtime Error
0
0
1403
N = int(input()) G = [[] for i in range(N)] for nod in range(N): tmp = list(map(int, input().split())) for i in range(2, tmp[1]*2+1, 2): edge, cos = tmp[i], tmp[i+1] G[nod].append([edge, cos]) import heapq def dijkstra(x): d = [float('inf')] * N d[x] = 0 visited = {x} # d, ...
Traceback (most recent call last): File "/tmp/tmpreeff1ov/tmp9cy9b8xf.py", line 1, in <module> N = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s314243013
p02243
u126478680
1526027537
Python
Python3
py
Runtime Error
30
6368
1139
from heapq import heappush, heappop from enum import Enum, auto INFTY = float('inf') class Color(Enum): WHITE = auto() GRAY = auto() BLACK = auto() n = int(input()) M = [[-1 for i in range(n)] for i in range(n)] adj_list = [] for i in range(n): u, k, *kv = list(map(int, input().split(' '))) if k ...
Traceback (most recent call last): File "/tmp/tmp579j9kvx/tmptd8nl_17.py", line 11, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s325614994
p02244
u726330006
1540483492
Python
Python3
py
Runtime Error
30
5640
2495
class Chess_board: def __init__(self): self.board=[[0]*8 for i in range(8)] self.queen_array=[] self.queen_row=[] def copy_board(chess_board): new_board=Chess_board() new_board.board=[chess_board.board[i][:] for i in range(8)] new_board.queen_array=chess_board.queen_array[:] ...
Traceback (most recent call last): File "/tmp/tmpdrg0ftao/tmpvccsdcx2.py", line 78, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s611336135
p02244
u726330006
1540483589
Python
Python3
py
Runtime Error
30
5640
2523
class Chess_board: def __init__(self): self.board=[[0]*8 for i in range(8)] self.queen_array=[] self.queen_row=[] def copy_board(chess_board): new_board=Chess_board() new_board.board=[chess_board.board[i][:] for i in range(8)] new_board.queen_array=chess_board.queen_array[:] ...
Traceback (most recent call last): File "/tmp/tmp1pyosvp_/tmp_cxtb7wf.py", line 78, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s941291079
p02244
u408260374
1456536051
Python
Python3
py
Runtime Error
0
0
521
import itertools N, Q, row, col = input(), [], range(8), range(8) for _ in range(N): r, c = map(int, raw_input().split()) Q.append((r, c)) row.remove(r) col.remove(c) for l in itertools.permutations(col): queen = Q + list(zip(row, l)) if not any((r1 != r2 or c1 != c2) and (r1 == r2 or c1 == c2 o...
File "/tmp/tmpkmjw6f1v/tmpqjehsztl.py", line 11 print '\n'.join(''.join('Q' if (r, c) in queen else '.' for c in range(8)) for r in range(8)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(.....
s562262020
p02244
u533883485
1502107072
Python
Python3
py
Runtime Error
30
7920
2819
# coding=utf-8 class Tree(): def __init__(self, init_field): self.root = init_field def search(self, field_id, field): global final_queen_pos #print("field_id:", field_id) #field.print_field() q_r = rest_row[field_id - n] if final_queen_pos: return N...
Traceback (most recent call last): File "/tmp/tmpkqgzi93l/tmpbvyro1v0.py", line 69, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s000031433
p02244
u466299927
1523959862
Python
Python3
py
Runtime Error
0
0
2384
# -*- coding: utf-8 -*- import sys BOARD_SIZE_W = 8 BOARD_SIZE_H = 8 def set_queen(board, queen_point): """ クイーンを指定座標に配置した後、残りの配置可能な位置の配列を返す """ return filter(create_queen_filter(queen_point), board) def create_queen_filter(queen_point): """ 指定位置にクイーンを配置したことにより、対象座標へ配置不可能にならないかを確認する関数を返す ...
Q....... ....Q... .......Q .....Q.. ..Q..... ......Q. .Q...... ...Q....
s034453482
p02244
u466299927
1523959895
Python
Python3
py
Runtime Error
0
0
2384
# -*- coding: utf-8 -*- import sys BOARD_SIZE_W = 8 BOARD_SIZE_H = 8 def set_queen(board, queen_point): """ クイーンを指定座標に配置した後、残りの配置可能な位置の配列を返す """ return filter(create_queen_filter(queen_point), board) def create_queen_filter(queen_point): """ 指定位置にクイーンを配置したことにより、対象座標へ配置不可能にならないかを確認する関数を返す ...
Q....... ....Q... .......Q .....Q.. ..Q..... ......Q. .Q...... ...Q....
s364185102
p02244
u466299927
1523959964
Python
Python3
py
Runtime Error
0
0
2384
# -*- coding: utf-8 -*- import sys BOARD_SIZE_W = 8 BOARD_SIZE_H = 8 def set_queen(board, queen_point): """ クイーンを指定座標に配置した後、残りの配置可能な位置の配列を返す """ return filter(create_queen_filter(queen_point), board) def create_queen_filter(queen_point): """ 指定位置にクイーンを配置したことにより、対象座標へ配置不可能にならないかを確認する関数を返す ...
Q....... ....Q... .......Q .....Q.. ..Q..... ......Q. .Q...... ...Q....
s648388685
p02244
u466299927
1523961855
Python
Python3
py
Runtime Error
20
5628
2435
# -*- coding: utf-8 -*- import sys BOARD_SIZE_W = 8 BOARD_SIZE_H = 8 def set_queen(board, queen_point): """ クイーンを指定座標に配置した後、残りの配置可能な位置の配列を返す """ return filter(create_queen_filter(queen_point), board) def create_queen_filter(queen_point): """ 指定位置にクイーンを配置したことにより、対象座標へ配置不可能にならないかを確認する関数を返す ...
Q....... ......Q. ....Q... .......Q .Q...... ...Q.... .....Q.. ..Q.....
s962900907
p02244
u466299927
1523961972
Python
Python3
py
Runtime Error
20
5628
2435
# -*- coding: utf-8 -*- import sys BOARD_SIZE_W = 8 BOARD_SIZE_H = 8 def set_queen(board, queen_point): """ クイーンを指定座標に配置した後、残りの配置可能な位置の配列を返す """ return filter(create_queen_filter(queen_point), board) def create_queen_filter(queen_point): """ 指定位置にクイーンを配置したことにより、対象座標へ配置不可能にならないかを確認する関数を返す ...
Q....... ......Q. ....Q... .......Q .Q...... ...Q.... .....Q.. ..Q.....
s336920426
p02244
u466299927
1523962368
Python
Python3
py
Runtime Error
20
5628
2453
# -*- coding: utf-8 -*- import sys BOARD_SIZE_W = 8 BOARD_SIZE_H = 8 def set_queen(board, queen_point): """ クイーンを指定座標に配置した後、残りの配置可能な位置の配列を返す """ return filter(create_queen_filter(queen_point), board) def create_queen_filter(queen_point): """ 指定位置にクイーンを配置したことにより、対象座標へ配置不可能にならないかを確認する関数を返す ...
Q....... ......Q. ....Q... .......Q .Q...... ...Q.... .....Q.. ..Q.....
s718582803
p02244
u825008385
1526255091
Python
Python3
py
Runtime Error
0
0
5309
# 8 Puzzle import copy z = 0 [N, d] = [3, 0] check_flag = [[1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4], [2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1], [3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2], [4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3], [3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4], ...
Traceback (most recent call last): File "/tmp/tmp036q6mj6/tmpo7moq17_.py", line 18, in <module> start.append(list(map(int, input().split()))) ^^^^^^^ EOFError: EOF when reading a line
s728374083
p02244
u138546245
1526779475
Python
Python3
py
Runtime Error
0
0
2100
from copy import deepcopy class EightQueen: NQUEENS = 8 SIZE = 8 class Board: def __init__(self, size): self.queens = [] self.size = size def place(self, i, j): self.queens.append((i, j)) def count(self): return len(self.queens) ...
Traceback (most recent call last): File "/tmp/tmpv9oq_clz/tmp8yt5cfsc.py", line 88, in <module> run() File "/tmp/tmpv9oq_clz/tmp8yt5cfsc.py", line 77, in run input() EOFError: EOF when reading a line
s088353908
p02245
u800534567
1545537640
Python
Python3
py
Runtime Error
0
0
2347
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> typedef char Board[10]; Board ini_board, board; const Board target = "123456780"; Board *history; int nhistories=0; typedef enum { U, D, L, R } Direction; typedef struct { int pos; Direction dir; } Motion; int minstep = INT_MAX; co...
File "/tmp/tmp6ws0dmfh/tmpvomvieqb.py", line 6 typedef char Board[10]; ^^^^ SyntaxError: invalid syntax
s636136411
p02245
u800534567
1545546390
Python
Python3
py
Runtime Error
0
0
2311
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> typedef char Board[10]; Board ini_board, board; const Board target = "123456780"; Board *history; int nhistories=0; typedef enum { U, D, L, R } Direction; typedef struct { int pos; Direction dir; } Motion; int minstep = 50; const M...
File "/tmp/tmpey3z6vfr/tmpxoh6mdnz.py", line 6 typedef char Board[10]; ^^^^ SyntaxError: invalid syntax
s340273741
p02245
u800534567
1545632670
Python
Python3
py
Runtime Error
0
0
818
import sys import queue N = 3 f= ''.join(sys.stdin.readline().split()) f+= ''.join(sys.stdin.readline().split()) f+= ''.join(sys.stdin.readline().split()) dd = [[-1, 0], [0, -1], [1, 0], [0, 1]] Q = queue.Queue() V = dict() Q.put([f,f.index('0'),0]) V[f] = True while not Q.empty(): u = Q.get() if u[0] == '...
File "/tmp/tmpx6kuyrca/tmpf1svo2qi.py", line 27 if n1>n2: n1, n2 = n2, n1 TabError: inconsistent use of tabs and spaces in indentation
s432588145
p02245
u800534567
1545632682
Python
Python3
py
Runtime Error
0
0
818
import sys import queue N = 3 f= ''.join(sys.stdin.readline().split()) f+= ''.join(sys.stdin.readline().split()) f+= ''.join(sys.stdin.readline().split()) dd = [[-1, 0], [0, -1], [1, 0], [0, 1]] Q = queue.Queue() V = dict() Q.put([f,f.index('0'),0]) V[f] = True while not Q.empty(): u = Q.get() if u[0] == '...
File "/tmp/tmpqhad91zp/tmpxhbp_ovw.py", line 27 if n1>n2: n1, n2 = n2, n1 TabError: inconsistent use of tabs and spaces in indentation
s931781703
p02245
u800534567
1545632778
Python
Python3
py
Runtime Error
0
0
817
import sys import queue N = 3 f= ''.join(sys.stdin.readline().split()) f+= ''.join(sys.stdin.readline().split()) f+= ''.join(sys.stdin.readline().split()) dd = [[-1, 0], [0, -1], [1, 0], [0, 1]] Q = queue.Queue() V = dict() Q.put([f,f.index('0'),0]) V[f] = True while not Q.empty(): u = Q.get() if u[0] == '...
File "/tmp/tmpmqmcoqh4/tmpeq3bm8nt.py", line 27 if n1>n2: n1, n2 = n2, n1 TabError: inconsistent use of tabs and spaces in indentation
s905547687
p02245
u800534567
1545651683
Python
Python3
py
Runtime Error
0
0
2557
#include <stdlib.h> #include <string.h> typedef char Board[10]; Board ini_board, board, *history; const Board target = "123456780"; int nhistories=0; typedef enum { U, D, L, R } Direction; typedef struct { char pos; char dir; } Motion; int minstep; const Motion motion[9][5] = {{{1,L},{3,U},{-1}}, {{0,R},{2,L...
File "/tmp/tmp5j9z7h_r/tmplxwk8wm6.py", line 4 typedef char Board[10]; ^^^^ SyntaxError: invalid syntax
s388193086
p02245
u800534567
1545651709
Python
Python3
py
Runtime Error
0
0
2576
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef char Board[10]; Board ini_board, board, *history; const Board target = "123456780"; int nhistories=0; typedef enum { U, D, L, R } Direction; typedef struct { char pos; char dir; } Motion; int minstep; const Motion motion[9][5] = {{{1,L},{3,U}...
File "/tmp/tmp52ecvc5e/tmpqaqpwara.py", line 5 typedef char Board[10]; ^^^^ SyntaxError: invalid syntax
s339241182
p02245
u800534567
1545797180
Python
Python3
py
Runtime Error
0
0
1944
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { unsigned int b; char step; } Board; int qlen=32202; typedef enum { U, D, L, R } Direction; typedef struct { int pos; Direction dir; } Motion; const Motion motion[9][5] = {{{1,L},{3,U},{-1}}, {{0,R},{2,L},{4,U},{-1}}, {{1,R},{5,U}...
File "/tmp/tmpry2zkwu1/tmpigxi7el8.py", line 5 typedef struct { ^^^^^^ SyntaxError: invalid syntax
s872201964
p02245
u797673668
1455093407
Python
Python3
py
Runtime Error
880
24560
1010
import heapq from itertools import chain from operator import mul exp10 = [10 ** a for a in range(8, -1, -1)] movables = [{1, 3}, {0, 2, 4}, {1, 5}, {0, 4, 6}, {1, 3, 5, 7}, {2, 4, 8}, {3, 7}, {4, 6, 8}, {5, 7}] destination = 123456780 def swap(board, move_from, move_to): return board + (exp10[move_to] - exp10[...
Traceback (most recent call last): File "/tmp/tmp00a9pxnd/tmpbuk3eorb.py", line 15, in <module> board0 = sum(map(mul, exp10, chain.from_iterable(map(int, input().split()) for _ in range(3)))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmp00a9px...
s183831576
p02245
u024715419
1513043488
Python
Python3
py
Runtime Error
0
0
2415
import heapq def d_manhattan(node_list): s = 0 for i in range(9): x_goal = i%3 y_goal = i//3 x_now = (node_list[i] - 1)%3 y_now = (node_list[i] - 1)//3 if y_now == -1: y_now = 2 dx = abs(x_now - x_goal) dy = abs(y_now - y_goal) s += dx...
Traceback (most recent call last): File "/tmp/tmphibcs1al/tmpt196ervu.py", line 66, in <module> inp = list(map(int, raw_input().split())) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s837433173
p02245
u024715419
1513043549
Python
Python3
py
Runtime Error
0
0
2415
import heapq def d_manhattan(node_list): s = 0 for i in range(9): x_goal = i%3 y_goal = i//3 x_now = (node_list[i] - 1)%3 y_now = (node_list[i] - 1)//3 if y_now == -1: y_now = 2 dx = abs(x_now - x_goal) dy = abs(y_now - y_goal) s += dx...
Traceback (most recent call last): File "/tmp/tmpw1jrpowa/tmp4cpnii5h.py", line 66, in <module> inp = list(map(int, raw_input().split())) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s240908239
p02245
u426534722
1519743939
Python
Python3
py
Runtime Error
0
0
818
from collections import deque dy = [-1, 0, 0, 1] dx = [0, -1, 1, 0] def g(i, j, a): t = a // (10 ** j) % 10 return a - t * (10 ** j) + t * (10 ** i) def MAIN(): m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}} MAP = "".join(input().replace(...
Traceback (most recent call last): File "/tmp/tmp7_vre7s7/tmpcss5s1t6.py", line 27, in <module> MAIN() File "/tmp/tmp7_vre7s7/tmpcss5s1t6.py", line 9, in MAIN MAP = "".join(input().replace(" ", "") for _ in range(N)) ^ NameError: name 'N' is not defi...
s905230411
p02245
u620516796
1524439520
Python
Python3
py
Runtime Error
0
0
5981
import time import math class Node: def __init__(self, board, parent, fValue, depth): self.board = board self.parent = parent self.fValue = fValue self.depth = depth def __eq__(self, other): return self.board == other.board def __lt__(self, other): return s...
Traceback (most recent call last): File "/tmp/tmpwrn6u5_g/tmpg5_p84mq.py", line 179, in <module> arr[i][0], arr[i][1], arr[i][2] = raw_input().split() ^^^^^^^^^ NameError: name 'raw_input' is not defined
s096609557
p02245
u620516796
1524439631
Python
Python3
py
Runtime Error
0
0
4757
import time import math class Node: def __init__(self, board, parent, fValue, depth): self.board = board self.parent = parent self.fValue = fValue self.depth = depth def __eq__(self, other): return self.board == other.board def __lt__(self, other): return self.fValue < other.fValue def __hash__(self): return hash(self....
File "/tmp/tmpr0wfhklk/tmp6jemnr5o.py", line 1 correct place in frontier for node in toInsert: for i in range(len(frontier) + 1): if i == len(frontier): frontier.append(node) break if frontier[i] > node: frontier.insert(i, node) break def heuristic(currentBoard, goalBoard): currentMatrix = currentBoard.matrix sum...
s990822004
p02245
u167493070
1525758807
Python
Python3
py
Runtime Error
0
0
2707
import sys; import heapq def iterative(i,j): q = [] heapq.heappush(q,(simpleHS(swap_puz),0,i,j,0,puz)) global finding while len(q): items = heapq.heappop(q) c_dWithH = items[0] c_depth = items[1] _i = items[2] _j = items[3] prev_move = items[4] c...
Traceback (most recent call last): File "/tmp/tmpm3llo_om/tmp8bq87br1.py", line 90, in <module> puz[i*3],puz[i*3+1],puz[i*3+2] = map(int, input().split()); ^^^^^^^ EOFError: EOF when reading a line
s827927569
p02245
u167493070
1525758855
Python
Python3
py
Runtime Error
0
0
2707
import sys; import heapq def iterative(i,j): q = [] heapq.heappush(q,(simpleHS(swap_puz),0,i,j,0,puz)) global finding while len(q): items = heapq.heappop(q) c_dWithH = items[0] c_depth = items[1] _i = items[2] _j = items[3] prev_move = items[4] c...
Traceback (most recent call last): File "/tmp/tmpm8jll55h/tmpz2p5q6oy.py", line 90, in <module> puz[i*3],puz[i*3+1],puz[i*3+2] = map(int, input().split()); ^^^^^^^ EOFError: EOF when reading a line
s143795036
p02245
u167493070
1525930062
Python
Python3
py
Runtime Error
0
0
2934
import sys; import heapq def iterative(i,j): q = [] q.append(sumcost,(0,i,j,0,puz)) global finding while len(q): c_dWithH, items = q.pop(0) c_depth = items[0] _i = items[1] _j = items[2] prev_move = items[3] c_puz = items[4] _sum_cost = c_dWithH ...
Traceback (most recent call last): File "/tmp/tmpgcdf78d7/tmpphoj2gqg.py", line 84, in <module> puz[i*3],puz[i*3+1],puz[i*3+2] = map(int, input().split()); ^^^^^^^ EOFError: EOF when reading a line
s197574275
p02245
u167493070
1525930113
Python
Python3
py
Runtime Error
0
0
2924
import sys; import heapq def iterative(i,j): q = [] q.append(sumcost,0,i,j,0,puz) global finding while len(q): c_dWithH, items = q.pop(0) c_depth = items[0] _i = items[1] _j = items[2] prev_move = items[3] c_puz = items[4] _sum_cost = c_dWithH - ...
Traceback (most recent call last): File "/tmp/tmp4eqmykk7/tmpn61b_zmf.py", line 84, in <module> puz[i*3],puz[i*3+1],puz[i*3+2] = map(int, input().split()); ^^^^^^^ EOFError: EOF when reading a line
s994647825
p02245
u126478680
1527245213
Python
Python3
py
Runtime Error
0
0
1735
class Puzzle: def __init__(self, field=None, path=''): self.f = field self.space = None for i in range(9): if self.f[i] == 9: self.space = i self.path = path def __lt__(self, pzl): # < for i in range(9): if self.f[i] == pzl.f[i]: ...
Traceback (most recent call last): File "/tmp/tmpwruwmxx7/tmpgha6nroh.py", line 61, in <module> field.extend(list(map(int, input().split(' ')))) ^^^^^^^ EOFError: EOF when reading a line
s801314313
p02245
u126478680
1527245297
Python
Python3
py
Runtime Error
0
0
1736
class Puzzle: def __init__(self, field=None, path=''): self.f = field self.space = None for i in range(9): if self.f[i] == 9: self.space = i self.path = path def __lt__(self, pzl): # < for i in range(9): if self.f[i] == pzl.f[i]: ...
Traceback (most recent call last): File "/tmp/tmpdws4j5up/tmpa2zy3792.py", line 61, in <module> field.extend(list(map(int, input().split(' ')))) ^^^^^^^ EOFError: EOF when reading a line
s566803662
p02245
u126478680
1527245328
Python
Python3
py
Runtime Error
2370
31540
1780
from collections import deque, OrderedDict class Puzzle: def __init__(self, field=None, path=''): self.f = field self.space = None for i in range(9): if self.f[i] == 9: self.space = i self.path = path def __lt__(self, pzl): # < for i in range...
Traceback (most recent call last): File "/tmp/tmpg4weuc7w/tmpntsoa6r2.py", line 63, in <module> field.extend(list(map(int, input().split(' ')))) ^^^^^^^ EOFError: EOF when reading a line
s761681232
p02246
u279605379
1534989547
Python
Python3
py
Runtime Error
0
0
1155
from collections import deque def move(P): for i in range(4): for j in range(4): if P[i][j] == 0: r,c = i,j if not r == 0: tmp = [i[:] for i in P] tmp[r][c],tmp[r-1][c] = tmp[r-1][c],tmp[r][c] yield tmp if not r == 3: tmp = [i[:] for i in P...
Traceback (most recent call last): File "/tmp/tmpxykcn2rc/tmpy1knbnrs.py", line 24, in <module> A = [[int(i) for i in input().split()] for _ in range(4)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpxykcn2rc/tmpy1knbnrs.py", line 24, in <listcomp> A = [[int(i) for i in input()...
s369327377
p02246
u279605379
1534989570
Python
Python3
py
Runtime Error
0
0
1155
from collections import deque def move(P): for i in range(4): for j in range(4): if P[i][j] == 0: r,c = i,j if not r == 0: tmp = [i[:] for i in P] tmp[r][c],tmp[r-1][c] = tmp[r-1][c],tmp[r][c] yield tmp if not r == 3: tmp = [i[:] for i in P...
Traceback (most recent call last): File "/tmp/tmpmush49z6/tmppfyfdfdc.py", line 24, in <module> A = [[int(i) for i in input().split()] for _ in range(4)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpmush49z6/tmppfyfdfdc.py", line 24, in <listcomp> A = [[int(i) for i in input()...
s669579406
p02246
u279605379
1535079864
Python
Python3
py
Runtime Error
30
6024
1990
from collections import deque import heapq def move(P,p): if p > 3: tmp = P[:] tmp[p],tmp[p-4] = tmp[p-4],tmp[p] tmpp = p - 4 yield tmp,tmpp if p < 12: tmp = P[:] tmp[p],tmp[p+4] = tmp[p+4],tmp[p] tmpp = p + 4 yield tmp,tmpp if p%4 > 0: ...
Traceback (most recent call last): File "/tmp/tmpm8zgo5uc/tmpw2etc6hm.py", line 43, in <module> A+=[int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s727053752
p02246
u279605379
1535131337
Python
Python3
py
Runtime Error
0
0
1289
from collections import deque def move(P): if not r == 0: tmp = [[i for i in j] for j in P] tmp[r][c],tmp[r-1][c] = tmp[r-1][c],tmp[r][c] yield tmp if not r == 3: tmp = [[i for i in j] for j in P] tmp[r][c],tmp[r+1][c] = tmp[r+1][c],tmp[r][c] yield tmp if not...
Traceback (most recent call last): File "/tmp/tmplxwc6bpv/tmp9iwuuntg.py", line 28, in <module> A = [[int(i) for i in input().split()] for _ in range(4)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmplxwc6bpv/tmp9iwuuntg.py", line 28, in <listcomp> A = [[int(i) for i in input()...
s988986790
p02246
u279605379
1535132235
Python
Python3
py
Runtime Error
0
0
1673
#双方向 両方 deque from collections import deque def move(P,p): if p > 3: tmp = P[:] tmp[p],tmp[p-4] = tmp[p-4],tmp[p] tmpp = p - 4 yield tmp,tmpp if p < 12: tmp = P[:] tmp[p],tmp[p+4] = tmp[p+4],tmp[p] tmpp = p + 4 yield tmp,tmpp if p%4 > 0: ...
File "/tmp/tmp8hf_t79w/tmpfzhl44lm.py", line 61 e.appendleft((i,countL+)) ^ SyntaxError: invalid syntax
s330379820
p02246
u279605379
1535316095
Python
Python3
py
Runtime Error
30
6020
1789
from collections import deque import heapq def move(P,p): if p > 3: tmp = P[:] tmp[p],tmp[p-4] = tmp[p-4],tmp[p] tmpp = p - 4 yield tmp,tmpp if p < 12: tmp = P[:] tmp[p],tmp[p+4] = tmp[p+4],tmp[p] tmpp = p + 4 yield tmp,tmpp if p%4 > 0: ...
Traceback (most recent call last): File "/tmp/tmpxbo7iszz/tmp3jv3xaqw.py", line 39, in <module> A+=[int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s842807746
p02246
u279605379
1535316415
Python
Python3
py
Runtime Error
0
0
1794
from collections import deque import heapq def move(P,p): if p > 3: tmp = P[:] tmp[p],tmp[p-4] = tmp[p-4],tmp[p] tmpp = p - 4 yield tmp,tmpp if p < 12: tmp = P[:] tmp[p],tmp[p+4] = tmp[p+4],tmp[p] tmpp = p + 4 yield tmp,tmpp if p%4 > 0: ...
Traceback (most recent call last): File "/tmp/tmps1j54knh/tmp68sofb0i.py", line 40, in <module> dp = {str(A) : (1,0),str(B) : (2,0)} ^ NameError: name 'A' is not defined
s392459118
p02246
u800534567
1545978306
Python
Python3
py
Runtime Error
0
0
2322
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 4 #define N2 16 #define LIMIT 80 typedef struct { int b[N2+1]; } Board; Board board; int minstep; typedef enum { R, U, L, D } Direction; typedef struct { int pos; Direction dir; } Motion; // 0 1 2 3 // 4 5 6 7 // 8 9 10 11 // 12 13 14 1...
File "/tmp/tmp1ayr89l_/tmpb7el8ht8.py", line 9 typedef struct { ^^^^^^ SyntaxError: invalid syntax
s181272594
p02246
u567380442
1422512049
Python
Python3
py
Runtime Error
0
0
1017
import sys, itertools f = sys.stdin start = [line.split() for line in f] start = tuple(int(x) for y in start for x in y) end =(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0) def next_board(b): brank = b.index(0) if brank % 4: yield b[:brank - 1] + (b[brank], b[brank - 1]) + b[brank + 1:] if...
Traceback (most recent call last): File "/tmp/tmpfpskqv3r/tmp3dvduqbf.py", line 24, in <module> for b in next_board(u): File "/tmp/tmpfpskqv3r/tmp3dvduqbf.py", line 9, in next_board brank = b.index(0) ^^^^^^^^^^ ValueError: tuple.index(x): x not in tuple
s276618943
p02246
u567380442
1422512513
Python
Python3
py
Runtime Error
0
0
949
start = [input().split() for _ in range(4)] start = tuple(int(x) for y in start for x in y) end =(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0) def next_board(b): brank = b.index(0) if brank % 4: yield b[:brank - 1] + (b[brank], b[brank - 1]) + b[brank + 1:] if brank // 4: yield b[:...
Traceback (most recent call last): File "/tmp/tmpx5tchczp/tmp3vphabmx.py", line 1, in <module> start = [input().split() for _ in range(4)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpx5tchczp/tmp3vphabmx.py", line 1, in <listcomp> start = [input().split() for _ in range(4)] ^^...
s349199998
p02246
u567380442
1422514440
Python
Python3
py
Runtime Error
0
0
1117
start = [input().split() for _ in range(4)] start = [x for y in start for x in y] start[start.index('10')] = 'a' start[start.index('11')] = 'b' start[start.index('12')] = 'c' start[start.index('13')] = 'd' start[start.index('14')] = 'e' start[start.index('15')] = 'f' start = ''.join(start) end = '123456789abcdef0' de...
Traceback (most recent call last): File "/tmp/tmpsd9jt5rg/tmpjcikms1i.py", line 1, in <module> start = [input().split() for _ in range(4)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpsd9jt5rg/tmpjcikms1i.py", line 1, in <listcomp> start = [input().split() for _ in range(4)] ^^...
s567785894
p02246
u567380442
1422515849
Python
Python3
py
Runtime Error
0
0
1014
import sys start = [line.split() for line in sys.stdin] start = [x for y in start for x in y] start[start.index('10')] = 'a' start[start.index('11')] = 'b' start[start.index('12')] = 'c' start[start.index('13')] = 'd' start[start.index('14')] = 'e' start[start.index('15')] = 'f' start = ''.join(start) end = '123456789...
Traceback (most recent call last): File "/tmp/tmpdxmksgcz/tmplqn0bq7n.py", line 4, in <module> start[start.index('10')] = 'a' ^^^^^^^^^^^^^^^^^ ValueError: '10' is not in list
s980415940
p02246
u567380442
1422515901
Python
Python3
py
Runtime Error
0
0
1026
import sys start = [sys.stdin.readline().split() for _ in range(4)] start = [x for y in start for x in y] start[start.index('10')] = 'a' start[start.index('11')] = 'b' start[start.index('12')] = 'c' start[start.index('13')] = 'd' start[start.index('14')] = 'e' start[start.index('15')] = 'f' start = ''.join(start) end ...
Traceback (most recent call last): File "/tmp/tmpmgf77ryj/tmp7p_hce65.py", line 4, in <module> start[start.index('10')] = 'a' ^^^^^^^^^^^^^^^^^ ValueError: '10' is not in list
s479692298
p02246
u567380442
1422515967
Python
Python3
py
Runtime Error
0
0
1002
start = [input().split() for _ in range(4)] start = [x for y in start for x in y] start[start.index('10')] = 'a' start[start.index('11')] = 'b' start[start.index('12')] = 'c' start[start.index('13')] = 'd' start[start.index('14')] = 'e' start[start.index('15')] = 'f' start = ''.join(start) end = '123456789abcdef0' de...
Traceback (most recent call last): File "/tmp/tmpa725ly49/tmpw02i4ooq.py", line 1, in <module> start = [input().split() for _ in range(4)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpa725ly49/tmpw02i4ooq.py", line 1, in <listcomp> start = [input().split() for _ in range(4)] ^^...
s769319531
p02246
u603049633
1496637891
Python
Python3
py
Runtime Error
14680
8724
2025
import queue adjacent=( (1,4), (0,2,5), (1,3,6), (2,7), (0,5,8), (1,4,6,9), (2,5,7,10), (3,6,11), (4,9,12), (5,8,10,13), (6,9,11,14), (7,10,15), (8,13), (9,12,14), (10,13,15), (11,14), ) distance = ( (), (0,1,2,3,1,2,3,4,2,3,4,5,3,4,5,6), (1...
Traceback (most recent call last): File "/tmp/tmpbjmty9sq/tmpy1apjp8r.py", line 51, in <module> a,b,c,d = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s814974094
p02246
u426534722
1500493721
Python
Python3
py
Runtime Error
0
0
2236
from sys import stdin import copy dx = tuple(1,0,-1,0) dy = tuple(0,1,0,-1) dir = "ruld" N = 4 N2 = 16 LIMIT = 50 MDT = ((0,1,2,3,1,2,3,4,2,3,4,5,3,4,5,6), (1,0,1,2,2,1,2,3,3,2,3,4,4,3,4,5), (2,1,0,1,3,2,1,2,4,3,2,3,5,4,3,4), (3,2,1,0,4,3,2,1,5,4,3,2,6,5,4,3), (1,2,3,4,0,1,2,3,1,2,3,4,2,...
Traceback (most recent call last): File "/tmp/tmpxls81odc/tmpyz_uzxe6.py", line 3, in <module> dx = tuple(1,0,-1,0) ^^^^^^^^^^^^^^^ TypeError: tuple expected at most 1 argument, got 4
s749444236
p02246
u426534722
1500493748
Python
Python3
py
Runtime Error
0
0
2236
from sys import stdin import copy dx = tuple(1,0,-1,0) dy = tuple(0,1,0,-1) dir = "ruld" N = 4 N2 = 16 LIMIT = 50 MDT = ((0,1,2,3,1,2,3,4,2,3,4,5,3,4,5,6), (1,0,1,2,2,1,2,3,3,2,3,4,4,3,4,5), (2,1,0,1,3,2,1,2,4,3,2,3,5,4,3,4), (3,2,1,0,4,3,2,1,5,4,3,2,6,5,4,3), (1,2,3,4,0,1,2,3,1,2,3,4,2,...
Traceback (most recent call last): File "/tmp/tmpg2zvjo_c/tmpt_kbc9iu.py", line 3, in <module> dx = tuple(1,0,-1,0) ^^^^^^^^^^^^^^^ TypeError: tuple expected at most 1 argument, got 4
s238468349
p02246
u798803522
1510414925
Python
Python3
py
Runtime Error
0
0
2206
import copy import heapq as hq WIDTH = 4 def hashnum(state): num = "" for i in range(WIDTH): for j in range(WIDTH): num += str(state[i][j]) return num def heauristic(here_x, here_y): return abs((WIDTH - 1) - here_x) + abs((WIDTH - 1) - here_y) ini_state = [] for i in range(WIDTH): ...
Traceback (most recent call last): File "/tmp/tmpqzz88zvg/tmpa_kpw00s.py", line 16, in <module> temp = [int(n) for n in input().split(" ")] ^^^^^^^ EOFError: EOF when reading a line
s515115311
p02246
u024715419
1513043906
Python
Python3
py
Runtime Error
0
0
2433
import heapq def d_manhattan(node_list): s = 0 for i in range(15): x_goal = i%4 y_goal = i//4 x_now = (node_list[i] - 1)%4 y_now = (node_list[i] - 1)//4 if y_now == -1: y_now = 3 dx = abs(x_now - x_goal) dy = abs(y_now - y_goal) s += d...
File "/tmp/tmpm510lxba/tmp7rjw_g2g.py", line 62 n_goal = [1,2,3,4,5,6,7,8,,9,10,11,12,13,14,15,0] ^ SyntaxError: invalid syntax
s655613039
p02246
u024715419
1513044018
Python
Python3
py
Runtime Error
0
0
2433
import heapq def d_manhattan(node_list): s = 0 for i in range(15): x_goal = i%4 y_goal = i//4 x_now = (node_list[i] - 1)%4 y_now = (node_list[i] - 1)//4 if y_now == -1: y_now = 3 dx = abs(x_now - x_goal) dy = abs(y_now - y_goal) s += d...
File "/tmp/tmp4ms9ywn5/tmp0k77k2x7.py", line 62 n_goal = [1,2,3,4,5,6,7,8,,9,10,11,12,13,14,15,0] ^ SyntaxError: invalid syntax
s134551337
p02246
u859725751
1516588519
Python
Python3
py
Runtime Error
0
0
124
x = input() n = int(input()) for i in range(n): y = input() if y in x: print(1) else: print(0)
Traceback (most recent call last): File "/tmp/tmpogudaca9/tmp5yb0mxfu.py", line 1, in <module> x = input() ^^^^^^^ EOFError: EOF when reading a line
s400927142
p02246
u859725751
1516588548
Python
Python3
py
Runtime Error
0
0
124
x = input() n = int(input()) for i in range(n): y = input() if y in x: print(1) else: print(0)
Traceback (most recent call last): File "/tmp/tmprd14n6g_/tmpfl2ywx3d.py", line 1, in <module> x = input() ^^^^^^^ EOFError: EOF when reading a line
s943403429
p02246
u859725751
1516588556
Python
Python
py
Runtime Error
0
0
124
x = input() n = int(input()) for i in range(n): y = input() if y in x: print(1) else: print(0)
Traceback (most recent call last): File "/tmp/tmps29drwe6/tmpc3zopfhz.py", line 1, in <module> x = input() ^^^^^^^ EOFError: EOF when reading a line
s764038789
p02246
u859725751
1516588586
Python
Python3
py
Runtime Error
0
0
124
x = input() n = int(input()) for i in range(n): y = input() if y in x: print(1) else: print(0)
Traceback (most recent call last): File "/tmp/tmpugdp5tnh/tmprcn_fcol.py", line 1, in <module> x = input() ^^^^^^^ EOFError: EOF when reading a line
s914565948
p02246
u859725751
1516588604
Python
Python3
py
Runtime Error
0
0
133
x = input() n = int(input()) print(n) for i in range(n): y = input() if y in x: print(1) else: print(0)
Traceback (most recent call last): File "/tmp/tmpw5m458o8/tmp8691t16t.py", line 1, in <module> x = input() ^^^^^^^ EOFError: EOF when reading a line
s991464103
p02246
u859725751
1516588624
Python
Python3
py
Runtime Error
0
0
124
x = input() n = int(input()) for i in range(n): y = input() if y in x: print(1) else: print(0)
Traceback (most recent call last): File "/tmp/tmphugxam9u/tmpgedcyoua.py", line 1, in <module> x = input() ^^^^^^^ EOFError: EOF when reading a line
s663044802
p02246
u426534722
1519922325
Python
Python3
py
Runtime Error
0
0
1009
from heapq import heapify, heappush, heappop N = 4 m = {0: {1, 4}, 1: {0, 2, 5}, 2: {1, 3, 6}, 3: {2, 7}, 4: {0, 5, 8}, 5: {1, 4, 6, 9}, 6: {2, 5, 7, 10}, 7: {3, 6, 11}, 8: {4, 9, 12}, 9: {5, 8, 10, 13}, 10: {6, 9, 11, 14}, 11: {7, 10, 15}, 12: {8, 13}, 13: {9, 12, 14}, 14: {10, 13, 15}, 15: {11, 14}} go...
Traceback (most recent call last): File "/tmp/tmpoluwoeus/tmpeue92s44.py", line 32, in <module> MAIN() File "/tmp/tmpoluwoeus/tmpeue92s44.py", line 31, in MAIN print(solve()) ^^^^^^^ File "/tmp/tmpoluwoeus/tmpeue92s44.py", line 12, in solve MAP = sum((input().split() for _ in range(N)), []) ...
s713710975
p02246
u167493070
1526272342
Python
Python3
py
Runtime Error
30
6064
3915
import sys; import heapq from collections import deque def iterative(i,j): q = deque() q.append((sumcost,0,i,j,0,puz)) global finding while len(q): items = q.pop() cost = items[0] if(cost > depth): continue c_depth = items[1] _i = items[2] ...
Traceback (most recent call last): File "/tmp/tmp9sdskirh/tmp_6t18s3z.py", line 97, in <module> puz[i*4],puz[i*4+1],puz[i*4+2],puz[i*4+3] = map(int, input().split()); ^^^^^^^ EOFError: EOF when reading a line
s087145643
p02247
u726330006
1540808782
Python
Python3
py
Runtime Error
20
5576
1080
text=input() string=input() #common_length[i]は、探索列がstring[i]で探索を終了したときに、 # string[i-common_lneght[i] + 1] 〜string[i]で構成される文字列が、探索価値を持つことを示す len_string=len(string) common_length=[0]*len_string tmp=0 tmp_tmp=0 for i in range(1,len_string): if(string[i]==string[tmp]): tmp_tmp=tmp while(string[i]==s...
Traceback (most recent call last): File "/tmp/tmpi56jvkfg/tmpfy8ucgbx.py", line 1, in <module> text=input() ^^^^^^^ EOFError: EOF when reading a line
s754806796
p02247
u800534567
1546040599
Python
Python3
py
Runtime Error
0
0
500
#include <stdio.h> #include <string.h> int main() { int i, j; char t[1002], p[1002]; fgets(t, 1001, stdin); fgets(p, 1001, stdin); if (t[strlen(t)-1]=='\n') t[strlen(t)-1]='\0'; if (p[strlen(p)-1]=='\n') p[strlen(p)-1]='\0'; int plen = strlen(p); if (plen>strlen(t)) return 0; for (i=0; i<strlen(t)-s...
File "/tmp/tmpi0jm5j5l/tmpxeuok46r.py", line 4 int main() ^^^^ SyntaxError: invalid syntax
s126036137
p02247
u078042885
1486709654
Python
Python3
py
Runtime Error
0
0
78
t=input();p=input() for i in range(len(t)): if t[i:].startwith(p):print(i)
Traceback (most recent call last): File "/tmp/tmpyf3h0277/tmpl2_dt6ka.py", line 1, in <module> t=input();p=input() ^^^^^^^ EOFError: EOF when reading a line
s174337626
p02247
u603049633
1496647221
Python
Python3
py
Runtime Error
0
0
94
t=input() p=input() lt=len(t) lp=len(p) for i in range(lt-lp+1): if t[i:i+l_p]==p:print(i)
Traceback (most recent call last): File "/tmp/tmppahli4h7/tmpgncc249s.py", line 1, in <module> t=input() ^^^^^^^ EOFError: EOF when reading a line
s513399547
p02248
u318430977
1531931130
Python
Python3
py
Runtime Error
20
5564
491
def rabin_karp(T, P, d, q): n = len(T) m = len(P) h = pow(d, m - 1) % q p = 0 t0 = 0 for i in range(m): p = (d * p + P[i]) % q t0 = (d * t0 + T[i]) % q for s in range(n - m + 1): if p == t0: if P[0:(m - 1)] == T[s:(s + m - 1)]: print(s) ...
Traceback (most recent call last): File "/tmp/tmpw_of2uhv/tmps1biq75g.py", line 20, in <module> t = list(map(ord, input())) ^^^^^^^ EOFError: EOF when reading a line
s006823745
p02248
u726330006
1540810396
Python
Python3
py
Runtime Error
0
0
1134
text=input() string=input() #common_length[i]は、探索列がstring[i]で探索を終了したときに、 # string[i-common_lneght[i] + 1] 〜string[i]で構成される文字列が、探索価値を持つことを示す len_string=len(string) common_length=[0]*len_string tmp=0 tmp_tmp=0 for i in range(1,len_string): if(string[i]==string[tmp]): tmp_tmp=tmp while(string[i]==...
File "/tmp/tmpvnq85u5p/tmp_8_ab6_y.py", line 26 tmp=1} ^ SyntaxError: unmatched '}'
s696033495
p02248
u798803522
1511458410
Python
Python3
py
Runtime Error
30
7880
3767
## SA-IS from collections import defaultdict def l_or_s_classification(target): length = len(target) l_or_s = ["" for n in range(length)] for i in range(length): if i == length - 1 or target[i] < target[i + 1]: l_or_s[i] = "S" else: l_or_s[i] = "L" return l_or_s...
Traceback (most recent call last): File "/tmp/tmp_psr2037/tmpb9aq_ebg.py", line 112, in <module> suffix_array, suffix_index = make_suffix_array(input().strip()) ^^^^^^^ EOFError: EOF when reading a line
s686962000
p02248
u798803522
1511458492
Python
Python3
py
Runtime Error
30
7904
3849
## SA-IS from collections import defaultdict def l_or_s_classification(target): length = len(target) l_or_s = ["" for n in range(length)] for i in range(length): if i == length - 1 or target[i] < target[i + 1]: l_or_s[i] = "S" else: l_or_s[i] = "L" return l_or_s...
Traceback (most recent call last): File "/tmp/tmp0jxqgeqt/tmp_e07o52e.py", line 112, in <module> target = input().strip() ^^^^^^^ EOFError: EOF when reading a line
s368067303
p02248
u798803522
1511459371
Python
Python3
py
Runtime Error
50
7876
3849
## SA-IS from collections import defaultdict def l_or_s_classification(target): length = len(target) l_or_s = ["" for n in range(length)] for i in range(length): if i == length - 1 or target[i] < target[i + 1]: l_or_s[i] = "S" else: l_or_s[i] = "L" return l_or_s...
Traceback (most recent call last): File "/tmp/tmpmkq13_1g/tmps8lu0bws.py", line 112, in <module> target = input().strip() ^^^^^^^ EOFError: EOF when reading a line
s485985739
p02248
u426534722
1520179144
Python
Python3
py
Runtime Error
0
0
824
def kmpTable(w): lw = len(w) nx = [-1] * (lw + 1) j = -1 for i in xrange(lw): while j >= 0 and w[i] != w[j]: j = nx[j] j += 1 nx[i + 1] = j return nx def kmpSearch(s, w): ls = len(s) start = 0 w_idx = 0 ret = [] nx = kmpTable(w) while sta...
Traceback (most recent call last): File "/tmp/tmpi92g33iu/tmpha5iugvj.py", line 33, in <module> T = raw_input() ^^^^^^^^^ NameError: name 'raw_input' is not defined
s664245220
p02248
u426534722
1520179170
Python
Python3
py
Runtime Error
0
0
816
def kmpTable(w): lw = len(w) nx = [-1] * (lw + 1) j = -1 for i in xrange(lw): while j >= 0 and w[i] != w[j]: j = nx[j] j += 1 nx[i + 1] = j return nx def kmpSearch(s, w): ls = len(s) start = 0 w_idx = 0 ret = [] nx = kmpTable(w) while sta...
Traceback (most recent call last): File "/tmp/tmptuo3uuc1/tmp6y6x78ok.py", line 33, in <module> T = input() ^^^^^^^ EOFError: EOF when reading a line
s366943866
p02248
u150984829
1524900520
Python
Python3
py
Runtime Error
0
0
102
def f(T,P):for i in range(len(T)):P!=T[i:i+len(P)]or print(i) if'__main__'__name__:f(input(),input())
File "/tmp/tmpogssvrpu/tmpey5c2_17.py", line 1 def f(T,P):for i in range(len(T)):P!=T[i:i+len(P)]or print(i) ^^^ SyntaxError: invalid syntax
s707681381
p02248
u150984829
1524900543
Python
Python3
py
Runtime Error
0
0
104
def f(T,P): for i in range(len(T)):P!=T[i:i+len(P)]or print(i) if'__main__'__name__:f(input(),input())
File "/tmp/tmp_3oqt1bu/tmpd3332bk7.py", line 3 if'__main__'__name__:f(input(),input()) ^^^^^^^^ SyntaxError: invalid syntax
s635553627
p02248
u138546245
1527127748
Python
Python3
py
Runtime Error
0
0
304
def search_by_dict(s1, s2): d = defaultdict(list) for i in range(len(s1)-len(s2)): d[s1[i:i+len(s2)]].append(i) return (i for i in d[s2]) def run(): s1 = input() s2 = input() for idx in search_by_dict(s1, s2): print(idx) if __name__ == '__main__': run()
Traceback (most recent call last): File "/tmp/tmp0cp9bd38/tmpcd9s2ev_.py", line 18, in <module> run() File "/tmp/tmp0cp9bd38/tmpcd9s2ev_.py", line 11, in run s1 = input() ^^^^^^^ EOFError: EOF when reading a line
s895112503
p02248
u138546245
1527147783
Python
Python3
py
Runtime Error
20
5572
1259
class RKSearch: shift = 40 size = 33554393 def __init__(self, s1, s2): self.haystack = self.encode(s1) self.needle = self.encode(s2) def find(self): m, n = len(self.haystack), len(self.needle) h1 = self.hash(self.haystack, n) h2 = self.hash(self.needle, n) ...
Traceback (most recent call last): File "/tmp/tmptrx2bb8n/tmp54_ty72c.py", line 52, in <module> run() File "/tmp/tmptrx2bb8n/tmp54_ty72c.py", line 44, in run s1 = input() ^^^^^^^ EOFError: EOF when reading a line
s353556458
p02249
u726330006
1540913909
Python
Python3
py
Runtime Error
20
5640
3106
def get_common(string,len_string): common_length=[0]*len_string tmp=0 tmp_tmp=0 for i in range(1,len_string): if(string[i]==string[tmp]): tmp_tmp=tmp while(string[i]==string[tmp_tmp] and tmp_tmp >0): tmp_tmp=common_length[max([tmp_tmp-1,0])] co...
Traceback (most recent call last): File "/tmp/tmpkn70wq87/tmpvauzik1v.py", line 90, in <module> H,W=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s623033506
p02249
u831244171
1487579317
Python
Python3
py
Runtime Error
30
7660
696
H, W = map(int,input().split()) A = [] for i in range(H): A.append(input()) R, C = map(int,input().split()) B = [] for i in range(R): B.append(input()) b = B[0] b_for_move = [0 for i in range(len(B))] for i in range(len(b)): for j in range(0,len(b)-i)[::-1]: if b[i:i+j] == b[len(b)-j-1:len(...
Traceback (most recent call last): File "/tmp/tmpo_84vzd1/tmpc7ymezqu.py", line 1, in <module> H, W = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s149377228
p02249
u831244171
1487579651
Python
Python3
py
Runtime Error
20
7728
712
H, W = map(int,input().split()) A = [] for i in range(H): A.append(input()) R, C = map(int,input().split()) B = [] for i in range(R): B.append(input()) b = B[0] b_for_move = [0 for i in range(len(b))] for i in range(len(b)): for j in range(0,len(b)-i)[::-1]: if b[i:i+j] == b[len(b)-j-1:len(b)]:...
Traceback (most recent call last): File "/tmp/tmpz27ghmau/tmp4l5etdxo.py", line 1, in <module> H, W = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s259544594
p02249
u831244171
1487675708
Python
Python3
py
Runtime Error
0
0
1383
CSIZE = 256 def make_bm_table(pattern,size): bm_table = [size]*CSIZE for i in range(size): dist = size-i-1 charac = pattern[i] bm_table[ord(charac)] = dist return bm_table def bm_search(pattern,buff): size = R bm_table = make_bm_table(pattern[0], size) ...
Traceback (most recent call last): File "/tmp/tmp3eq75etw/tmp9wh_hljl.py", line 37, in <module> H,W = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s971180593
p02249
u426534722
1520350527
Python
Python3
py
Runtime Error
0
0
1310
base1 = 1009 base2 = 1013 mask = (1 << 32) - 1 def calc_hash(f, r, c): global ph, pw, h tmp = [[0] * c for _ in range(r)] dr, dc = r - ph, c - pw t1 = 1 for _ in range(pw): t1 = (t1 * base1) & mask for i in range(r): e = 0 for j in range(pw): e = e * base1 + f...
File "/tmp/tmpw81zbm9h/tmpdr758yxe.py", line 43 ans.append(f"{i} {j}") TabError: inconsistent use of tabs and spaces in indentation
s181725274
p02249
u426534722
1520350941
Python
Python3
py
Runtime Error
0
0
1357
base1 = 1009 base2 = 1013 mask = (1 << 32) - 1 def calc_hash(f, r, c): global ph, pw, h tmp = [[0] * c for _ in range(r)] dr, dc = r - ph, c - pw t1 = 1 t1 = (t1 * (base1 ** pw)) & mask # for _ in range(pw): # t1 = (t1 * base1) & mask for i in range(r): e = 0 for j in ra...
File "/tmp/tmp2kxug46m/tmptsacv8a3.py", line 9 t1 = (t1 * (base1 ** pw)) & mask TabError: inconsistent use of tabs and spaces in indentation
s485503586
p02250
u797673668
1455113734
Python
Python3
py
Runtime Error
0
0
691
base = 127 mask = (1 << 32) - 1 def calc_hash(f, pl, tl): dl = tl - pl tmp = set() t = 1 for _ in range(pl): t = (t * base) & mask e = 0 for i in range(pl): e = e * base + f[i] for i in range(dl): tmp.add(e) e = (e * base - t * f[i] + f[i + pl]) & mask ...
Traceback (most recent call last): File "/tmp/tmp3a48bf43/tmp2ibgyw55.py", line 22, in <module> t = [ord(c) for c in input().strip()] ^^^^^^^ EOFError: EOF when reading a line
s849256173
p02250
u797673668
1455113767
Python
Python3
py
Runtime Error
20
7732
702
base = 127 mask = (1 << 32) - 1 def calc_hash(f, pl, tl): dl = tl - pl tmp = set() t = 1 for _ in range(pl): t = (t * base) & mask e = 0 for i in range(pl): e = e * base + f[i] for i in range(dl): tmp.add(e) e = (e * base - t * f[i] + f[i + pl]) & mask ...
Traceback (most recent call last): File "/tmp/tmp69c8641x/tmpc560fb1u.py", line 22, in <module> t = [ord(c) for c in input().strip()] ^^^^^^^ EOFError: EOF when reading a line
s326879085
p02250
u797673668
1455251705
Python
Python3
py
Runtime Error
0
0
1451
base = 127 mask = (1 << 32) - 1 def calc_hash(f, pl, tl, with_array): dl = tl - pl tmp = [] t = 1 for _ in range(pl): t = (t * base) & mask e = 0 for i in range(pl): e = (e * base + f[i]) & mask for i in range(dl): tmp.append(e) e = (e * base - t * f[i] + f...
Traceback (most recent call last): File "/tmp/tmpyfnln0rg/tmp3w4qlim9.py", line 25, in <module> t = [ord(c) for c in input().strip()] ^^^^^^^ EOFError: EOF when reading a line
s862746859
p02250
u159356473
1481789281
Python
Python3
py
Runtime Error
20
7644
555
#coding:utf-8 def MSM(T,P): Tlist=list(T) Plist=list(P) ans=0 for i in range(len(Tlist)): if Tlist[i]==Plist[0]: ans+=1 for j in range(1,len(Plist)): if Plist[j]==Tlist[i+j] and i+j<=len(Tlist): ans+=1 if ans==len(Plist): ...
Traceback (most recent call last): File "/tmp/tmp66ooz_p5/tmplhrcvdhf.py", line 18, in <module> T=input() ^^^^^^^ EOFError: EOF when reading a line