s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s907113196
p03920
u879870653
1547912494
Python
Python (3.4.3)
py
Runtime Error
17
3060
296
N = int(input()) L = [0] l = 0 for i in range(1,100) : l += i L.append(l) ans = [] while N > 0 : for i in range(len(L)) : #print(L[i],N,L[i+1]) if (L[i]+1 <= N <= L[i+1]) : ans.append(i+1) N -= i+1 break print(*ans,sep="\n")
s354897752
p03920
u631277801
1535731141
Python
Python (3.4.3)
py
Runtime Error
22
3828
303
from bisect import bisect_right sum_list = [] nm = 1 sm = 1 while sm <= 10**7: sum_list.append(sm) nm += 1 sm += nm n = int(input()) k = bisect_right(sum_list, n) ans_set = set([i for i in range(1,k+2)]) ans_set.remove(sum_list[k] - n) ans = list(ans_set) for a in ans: print(a)
s645163109
p03920
u856232850
1524723379
Python
Python (3.4.3)
py
Runtime Error
21
3572
128
n = int(input()) a = int((2*n)**0.5)+1 b = int((a*(a+1))/2)-n c = [i for i in range(1,a+1)] c.remove(b) for i in c: print(i)
s895939663
p03920
u986399983
1511481446
Python
Python (3.4.3)
py
Runtime Error
17
2940
862
#include<cstdio> #include<cstdlib> #include<cmath> #include<iostream> #include<string> #include<stack> #include<queue> #include<vector> #include<map> #include<set> #include<algorithm> #include<numeric> #define rep(n) for(int i=0;i<n;i++) #define repp(j, n) for(int j=0;j<n;j++) #define reppp(i, m, n) for(int i=m;i<=n;i...
s890326082
p03920
u840684628
1507948909
Python
Python (3.4.3)
py
Runtime Error
75
4404
257
def calc(n): i=1 sm = 0 st = set() if n<=2: st.add(n) return st while sm<=n: st.add(i) sm += i i+=1 st = st - calc(sm-n) return st n = int(input()) c = calc(n) for cc in c: print(cc)
s920628806
p03920
u840684628
1507948795
Python
Python (3.4.3)
py
Runtime Error
79
4408
257
def calc(n): i=1 sm = 0 st = set() if n<=2: st.add(n) return st while sm<=n: st.add(i) sm += i i+=1 st = st - calc(sm-n) return st n = int(input()) c = calc(n) for cc in c: print(cc)
s432073785
p03920
u194412908
1501162453
Python
PyPy3 (2.4.0)
py
Runtime Error
225
43376
176
import math N = int(input()) sum =0 for i in range(1,N): sum += i if sum>=N: break for j in range(1,i+1): if j == sum-N: continue print(j)
s019104794
p03920
u237168895
1480186280
Python
Python (3.4.3)
py
Runtime Error
108
4236
532
a = int(input().strip()) tmp = [] res = [] ind = 1 def bar(foo,hoge): if(foo == 0): return if foo == 1: res.append(1) return elif foo == 2: res.append(2) return for i in reversed(range(hoge)): if (tmp[i] <= foo): res.append(i + 1) ...
s088364943
p03920
u174620969
1480185748
Python
Python (3.4.3)
py
Runtime Error
22
3064
302
import sys f = open('input.txt') # f = input() N = int(f.readline()) out = [] sum = 0 for i in range(0, N+1): sum = sum + i out.append(i) if sum > N: r = sum - N out.remove(r) break out.remove(0) for n in out: print(n) # print(' '.join(map(str, out)))
s213829690
p03921
u893063840
1585338914
Python
PyPy3 (2.4.0)
py
Runtime Error
836
87896
1283
class UnionFind: def __init__(self, n): self.n = n self.p = [e for e in range(n)] self.rank = [0] * n self.size = [1] * n def same(self, u, v): return self.find_set(u) == self.find_set(v) def unite(self, u, v): u = self.find_set(u) v = self.find_set(...
s418891386
p03921
u171366497
1561437400
Python
Python (3.4.3)
py
Runtime Error
20
3444
540
N,M=map(int,input().split()) from collections import defaultdict dist=[d]*N branch=defaultdict(set) lang=defaultdict(set) inp=[] for i in range(N): X=list(map(int,input().split())) for k in range(X[0]): lang[X[k+1]]|={i} inp.append(X[1:]) for i in range(N): for l in inp[i]: branch[i]|=la...
s162966022
p03921
u620084012
1560331182
Python
PyPy3 (2.4.0)
py
Runtime Error
627
74528
591
N, M = map(int,input().split()) H = [] L = [[] for k in range(M+1)] for k in range(N): P = list(map(int,input().split()))[1:] H.append(P) for e in P: L[e].append(k+1) G = [0 for k in range(N+1)] G[1] = 1 Q = [H[0]] while len(Q) > 0: ima = Q.pop() if len(ima) == 1 and G[ima[0]] == 1: ...
s101427573
p03921
u214617707
1559303572
Python
Python (3.4.3)
py
Runtime Error
503
13460
719
N, M = map(int, input().split()) parent = [i for i in range(N + M)] rank = [0] * (N + M) def find(i): if parent[i] == i: return i else: parent[i] = find(parent[i]) return parent[i] def same(x, y): return find(x) == find(y) def unite(x, y): x = find(x) y = find(y) i...
s069437189
p03921
u099643902
1557691527
Python
Python (3.4.3)
py
Runtime Error
597
18180
748
N, M = map(int, input().split()) graph = [[] for i in range(M)] for i in range(N): L = list(map(int, input().split())) for j in range(1,L[0]+1): graph[L[j]-1].append(i) def root(x): if par[x] == x: return(x) else: y = root(par[x]) par[x] = y return y def unite(x,...
s082505597
p03921
u099643902
1557691302
Python
Python (3.4.3)
py
Runtime Error
612
18208
740
N, M = map(int, input().split()) graph = [[] for i in range(M)] for i in range(N): L = list(map(int, input().split())) for j in range(1,L[0]+1): graph[L[j]-1].append(i) def root(x): if par[x] == x: return(x) else: par[x] = root(par[x]) return(par[x]) def unite(x,y): ...
s760221806
p03921
u099643902
1557690025
Python
Python (3.4.3)
py
Runtime Error
616
18180
765
N, M = map(int, input().split()) graph = [[] for i in range(M)] for i in range(N): L = list(map(int, input().split())) if L[0] >= 1: for j in range(1,L[0]+1): graph[L[j]-1].append(i) def root(x): if par[x] == x: return(x) else: par[x] = root(par[x]) return(pa...
s226071137
p03921
u099643902
1557689747
Python
Python (3.4.3)
py
Runtime Error
643
18204
739
N, M = map(int, input().split()) graph = [[] for i in range(M)] for i in range(N): L = list(map(int, input().split())) for j in range(1,L[0]+1): graph[L[j]-1].append(i) def root(x): if par[x] == x: return(x) else: par[x] = root(par[x]) return(par[x]) def unite(x,y): ...
s913875517
p03921
u619819312
1556023999
Python
Python (3.4.3)
py
Runtime Error
485
37552
388
import sys sys.setrecursionlimit(10**9) n,m=map(int,input().split()) a=[[]for i in range(n+m)] for i in range(n): s=list(map(int,input().split())) for j in s[1:]: a[i].append(j+n-i) a[n+j-1].append(i) t=[False]*(n+m) def g(x): t[x]=True for i in a[x]: if not t[i]: ...
s746102025
p03921
u619819312
1556023594
Python
Python (3.4.3)
py
Runtime Error
18
2940
417
import sys sys.setrecursionlimit(10**6) n,m=map(int,input().split()) a=[[]for i in range(n+m)] for i in range(n): s=list(map(int,input().split())) for j in s[1:]: a[i].append(j) a[n+j].append(i) t=[False]*n def g(x): if not t[x]: t[x]=False: for i in a[x]: ...
s852841492
p03921
u077337864
1555106512
Python
Python (3.4.3)
py
Runtime Error
581
29824
454
n, m = map(int, input().split()) people = [] lang = [[] for _ in range(m)] for i in range(n): kl = list(map(int, input().split())) k = kl[0] people.append(kl[1:]) for l in kl[1:]: lang[l-1].append(i) visited = [False for _ in range(n)] def dfs(i): if visited[i]: return else: visited[i] = Tru...
s807724782
p03921
u177398299
1536706698
Python
Python (3.4.3)
py
Runtime Error
636
12692
484
N, M = map(int, input().split()) parent = [i for i in range(N + M)] def find(x): if x == parent[x]: return x parent[x] = find(parent[x]) return parent[x] def unite(x, y): x, y = find(x), find(y) if x == y: return parent[y] = x for i in range(N): for l in list(map(int, input(...
s661218512
p03921
u075012704
1533752361
Python
Python (3.4.3)
py
Runtime Error
499
36812
634
N, M = map(int, input().split()) P = [[] for i in range(N)] L = [[] for i in range(M)] for i in range(N): I = list(map(int, input().split())) for l in I[1:]: P[i].append(l-1) L[l-1].append(i) P_visited = [0] * N L_visited = [0] * M # flgが立っていれば、人を見ているとする def dfs(n, flg): if flg: P...
s356510808
p03921
u761320129
1516049327
Python
Python (3.4.3)
py
Runtime Error
583
12664
518
N,M = map(int,input().split()) par = [i for i in range(N+M)] def root(a): if par[a] == a: return a par[a] = root(par[a]) return par[a] def same(a,b): return root(a) == root(b) def unite(a,b): ra,rb = root(a),root(b) if ra == rb: return par[ra] = rb for i in range(N): src = list(map(lamb...
s908140553
p03921
u761320129
1516048665
Python
Python (3.4.3)
py
Runtime Error
2104
12664
466
N,M = map(int,input().split()) par = [i for i in range(N+M)] def root(a): if par[a] == a: return a return root(par[a]) def same(a,b): return root(a) == root(b) def unite(a,b): ra,rb = root(a),root(b) if ra == rb: return par[ra] = rb for i in range(N): src = list(map(lambda x:int(x)-1,input(...
s593638498
p03921
u858748695
1515792033
Python
Python (3.4.3)
py
Runtime Error
18
3064
355
#!/usr/bin/env python3 from unionfind import unionfind N, M = map(int, input().split()) u = unionfind(N + M) for i in range(N): L = [int(x) - 1 for x in input().split()] L[0] += 1 for j in range(L[0]): u.unite(L[j + 1], M + i) ans = True for i in range(N): if not u.issame(M, M + i): ans...
s228366956
p03921
u858748695
1515104294
Python
Python (3.4.3)
py
Runtime Error
17
3060
239
#!/usr/bin/env python3 N = int(input()) sum = 0 m = 0 for i in range(1, 10**3 + 1): sum += i if sum >= N: m = i break sum = N for i in range(1, m + 1)[::-1]: if sum - i >= 0: sum -= i print(i)
s910778332
p03921
u123756661
1480192205
Python
Python (2.7.6)
py
Runtime Error
15
2580
25
4 4 2 1 2 2 1 2 1 3 2 4 3
s493059027
p03921
u509661905
1480183190
Python
PyPy3 (2.4.0)
py
Runtime Error
242
40048
1418
#!/usr/bin/env pypy3 class UnionFind(object): def __init__(self, number_of_nodes): self.par = list(range(number_of_nodes)) self.rank = [0] * number_of_nodes def root(self, node): if self.par[node] == node: return node else: r = self.root(self.par[node]...
s821248974
p03922
u471797506
1480187252
Python
Python (2.7.6)
py
Runtime Error
246
12640
535
# -*- coding: utf-8 -*- import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll N, M = map(int, raw_input().split()) X = map(int, raw_input().split()) cnt = [0]*100005 for x in X: cnt[x%M] += 1 ans = 0 for i in xrange(M): if i == M - i: ans += cnt[i]/2 print "=", cn...
s978216334
p03923
u163320134
1587624237
Python
PyPy3 (2.4.0)
py
Runtime Error
2111
1963416
224
n,a=map(int,input().split()) costs=[10**18]*(n+1) costs[1]=0 times=[0]*(n+1) for i in range(1,n+1): times[i]=costs[i]+(n+i-1)//i for j in range(2,n//i+1): costs[i*j]=min(costs[i*j],costs[i]+j+a) print(min(times[1:]))
s557529914
p03923
u929150664
1480800774
Python
Python (3.4.3)
py
Runtime Error
23
3192
828
#!/usr/bin/env python # -*- coding: utf-8 -*- def pow(a, b): if b == 1:return a if b%2 == 0: return pow(a*a, int(b/2)) return a*pow(a*a, int(b/2)) def binaryOne(n, multi): l, r = 0, n mid = (l + r)/2 while r - l > 1: if pow(mid, multi) >= n: r = mid else: ...
s227548856
p03924
u104282757
1480193752
Python
PyPy2 (5.6.0)
py
Runtime Error
53
9840
639
import numpy as np N, M = map(int, raw_input().split()) # one way path from 1, no path from 1 status_mat = np.zeros((N, N), dtype='int') status_mat[0, N-1] = 1 bothM = np.zeros((N, N), dtype='int') for i in range(N): for j in range(N): bothM[i, j] = N-i-j diagM = np.diag(range(N)) def update_statu...
s079240305
p03929
u802963389
1600659873
Python
Python (3.8.2)
py
Runtime Error
24
8916
334
n, k = map(int,input().split()) if n < 3: print(0) exit() table = [[0] * 5 for i in range(11)] for i in range(11): for j in range(5): t = 9 * (j + 2 + 7 * (i + 1)) table[i][j] = t % 11 c = [0] for row in table: c.append(c[-1] + row.count(K)) d,m = divmod(n - 2, 11) ans = c[m] + c[-1] ...
s880738170
p03929
u785578220
1565927888
Python
PyPy3 (2.4.0)
py
Runtime Error
175
38384
34
a = input() b = input() print(a+b)
s562835889
p03929
u673338219
1540049925
Python
Python (3.4.3)
py
Runtime Error
17
3060
180
n,k = int(input()) a = [0,5,10,4,9,3,8,2,7,1,6] r = a[k] s = 0 for i in range(2,n): for j in [2,3,4,5,6]: if (7*i + j - 7 - r)%11 == 0: s += 1 print(s)
s803514093
p03929
u856232850
1525916158
Python
Python (3.4.3)
py
Runtime Error
17
3064
208
a = 4;b = 2;c = 0;d = 9;e = 7 f = [a,b,c,d,e] ans = 0 for i in range((n-2)%11): if k in (a,b,c,d,e): ans += 1 a = (a+8)%11 b = (b+8)%11 c = (c+8)%11 d = (d+8)%11 e = (e+8)%11 print(ans+((n-2)//11)*5)
s069908159
p03929
u272028993
1479785049
Python
PyPy2 (5.6.0)
py
Runtime Error
41
8944
423
mod=10**9+7 n,k=map(int,raw_input().split()) a=map(int,raw_input().split()) dp=[[[0]*(1<<8) for _ in xrange(n+1)] for _ in xrange(n+1)] for i in xrange(n): dp[i+1][1][a[i]]=1 for i in xrange(n): for j in xrange(n): for l in xrange(1<<8): dp[i+1][j+1][a[i]^l]+=(j+1)*dp[i][j][l]%mod ...
s732919512
p03929
u247140408
1479699722
Python
Python (3.4.3)
py
Runtime Error
22
3064
490
n = int(input()) k = int(input()) vl = [] rl = [] for v in range(n): kari_value = [] for v2 in range(v*7+1, v*7+1+7): kari_value.append(v2) vl.append(kari_value) for v in range(len(vl)-2): # 縦の繰り返し for v2 in range(len(vl[0])-2): # 横の繰り返し s = vl[v][v2] + vl[v][v2+1] + vl[v][v2+2] + vl[v+...
s225864024
p03929
u247140408
1479699482
Python
Python (3.4.3)
py
Runtime Error
24
3064
577
n = int(input()) k = int(input()) vl = [] rl = [] for v in range(n): kari_value = [] for v2 in range(v*7+1, v*7+1+7): kari_value.append(v2) vl.append(kari_value) # print(value_list) # print(len(value_list), len(value_list[0])) for v in range(len(vl)-2): # 縦の繰り返し for v2 in range(len(vl[0])-...
s517698760
p03930
u899782392
1598400551
Python
Python (3.8.2)
py
Runtime Error
25
9312
1331
H, W, K = map(int, input().split()) def clear(row, start, end, mult): if end - start + 1 < K: return 0 gain = 0 for i in range(start, end + 1): gain += mult * row[i] row[i] = 0 return gain def drop(board): for x in range(W): wp = 0 for y in range(H): ...
s756573813
p03930
u899782392
1598400495
Python
Python (3.8.2)
py
Runtime Error
30
9340
1331
H, W, K = map(int, input().split()) def clear(row, start, end, mult): if end - start + 1 < K: return 0 gain = 0 for i in range(start, end + 1): gain += mult * row[i] row[i] = 0 return gain def drop(board): for x in range(W): wp = 0 for y in range(H): ...
s188097877
p03930
u576432509
1597364192
Python
Python (3.8.2)
py
Runtime Error
143
9512
3221
from collections import deque icase=0 if icase==0: h,w,k=map(int,input().split()) aa=[[0]*w for i in range(h)] for i in range(h): ll=input() for j in range(w): aa[h-1-i][j]=int(ll[j]) elif icase==1: h,w,k=4,4,2 aa=[[2, 3, 1, 2], [1, 4, 2, 4], [4, 1, 2, 1], [3, 4, ...
s777912848
p03930
u723711163
1594428398
Python
PyPy3 (7.3.0)
py
Runtime Error
112
74428
997
from itertools import groupby def calc(): s = 0 for i in range(h): gr = groupby(g[i]) j = 0 for key,it in gr: l = len(list(it)) j += l if key==-1: continue if l >= K: g[i][j:j+l] = [-1]*l # for k in range(l): # g[i][j+k] = -1 # # print("s", key, ...
s860168289
p03930
u366625467
1593627456
Python
PyPy3 (7.3.0)
py
Runtime Error
339
77220
1635
from copy import deepcopy h,w,border=map(int,input().split()) G_original=[] for i in range(w): L=list(str(input())) for j in range(len(L)): L[j]=int(L[j]) G_original.append(L) def delete(row): #圧縮 L=[] temp=[row[0],1] for i in range(len(row)-1): if row[i]==row[i+1]: ...
s305970622
p03930
u366625467
1593627010
Python
Python (3.8.2)
py
Runtime Error
1103
9260
1635
from copy import deepcopy h,w,border=map(int,input().split()) G_original=[] for i in range(w): L=list(str(input())) for j in range(len(L)): L[j]=int(L[j]) G_original.append(L) def delete(row): #圧縮 L=[] temp=[row[0],1] for i in range(len(row)-1): if row[i]==row[i+1]: ...
s588442805
p03930
u638795007
1583710719
Python
PyPy3 (2.4.0)
py
Runtime Error
1040
71584
7853
def ABC120_D(): class UnionFind(): def __init__(self, n): self.parent = [-1 for _ in range(n)] # 正==子: 根の頂点番号 / 負==根: 連結頂点数 def find(self, x): # 要素xが属するグループの根を返す if self.parent[x] < 0: return x else: self.pa...
s753670710
p03930
u638795007
1583710366
Python
Python (3.4.3)
py
Runtime Error
1056
4720
7760
def ABC120_D(): class UnionFind(): def __init__(self, n): self.parent = [-1 for _ in range(n)] # 正==子: 根の頂点番号 / 負==根: 連結頂点数 def find(self, x): # 要素xが属するグループの根を返す if self.parent[x] < 0: return x else: self.pa...
s598591376
p03930
u966695411
1479706744
Python
Python (3.4.3)
py
Runtime Error
24
3192
1113
#! /usr/bin/env python3 def dropcell(): for y in range(H): for i in range(H): for j in range(W): if gm[H-i][j] == 0: gm[H-i-1][j], gm[H-i][j] = gm[H-i][j], gm[H-i-1][j] def removecell(): global gp, gf gf = False p = 0 for y in range(H): ...
s418394272
p03930
u118800894
1479701503
Python
Python (2.7.6)
py
Runtime Error
17
2824
1346
def main(): h, w, k = map(int, raw_input().split()) c = [map(int, raw_input().strip()) for _ in xrange(h)] def go(a): if not res: return 0 return go(a) * 2 + res ans = 0 for ii in xrange(h): for jj in xrange(w): a = [c[i][:] for i in xrange(h)] ...
s427661328
p03931
u644325407
1479692793
Python
PyPy3 (2.4.0)
py
Runtime Error
471
44636
578
#!/usr/bin/env pypy3 import functools import itertools import math import operator P = 1000000007 def xors(seq): return functools.reduce(operator.xor, seq) def solve(n, k, xs): l = len(xs) a = 0 for i in range(1, l + 1): for ys in itertools.combinations(xs, i): if xors(ys) == ...
s139163136
p03932
u296290704
1527216041
Python
PyPy3 (2.4.0)
py
Runtime Error
2112
123912
772
H, W = map(int, input().split()) A = [list(map(int, input().split())) for i in range(H)] if H <= 2 or W <= 2: print(sum(map(sum, A))) exit(0) def solve(A, W, H): S = {(0, 1): 0} for c in range(1, H-1): T = {} for p, q in S: v = S[p, q] + A[c-p][p] + A[c-q][q] T[p...
s289502671
p03932
u296290704
1527215947
Python
PyPy3 (2.4.0)
py
Runtime Error
2112
155268
792
H, W = map(int, input().split()) A = [list(map(int, input().split())) for i in range(H)] if H <= 2 or W <= 2: print(sum(map(sum, A))) exit(0) def solve(A, W, H): S = {(0, 1): 0} for c in range(1, H-1): T = {} for p, q in S: v = S[p, q] + A[c-p][p] + A[c-q][q] T[p...
s057167488
p03932
u296290704
1527136266
Python
Python (3.4.3)
py
Runtime Error
2108
92076
592
H, W = map(int, input().split()) A = [list(map(int, input().split())) for i in range(H)] memo = {(W+H-2, H-2, H-1): 0} def dfs(c, p, q): if (c, p, q) in memo: return memo[c, p, q] res = 0 if c+1-W < p < q < H: res = max(res, dfs(c+1, p, q)) if c+1-W < p+1 < q < H: res = max(res,...
s033617138
p03937
u394244719
1599427310
Python
Python (3.8.2)
py
Runtime Error
30
9340
1628
import sys inint = lambda: int(sys.stdin.readline()) inintm = lambda: map(int, sys.stdin.readline().split()) inintl = lambda: list(inintm()) instrm = lambda: map(str, sys.stdin.readline().split()) instrl = lambda: list(instrm()) h, w = inintm() grid = [] now = [0,0] fw = 0 fh = 0 for i in range(h): grid.append(...
s360465067
p03937
u394244719
1599427087
Python
Python (3.8.2)
py
Runtime Error
26
9168
1604
import sys inint = lambda: int(sys.stdin.readline()) inintm = lambda: map(int, sys.stdin.readline().split()) inintl = lambda: list(inintm()) instrm = lambda: map(str, sys.stdin.readline().split()) instrl = lambda: list(instrm()) h, w = inintm() grid = [] now = [0,0] fw = 0 fh = 0 for i in range(h): grid.append(...
s896466307
p03937
u867826040
1599275084
Python
Python (3.8.2)
py
Runtime Error
29
8784
408
#define rep(i,n) for (int i = 0; i < (int)(n); i++) #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); short h,w,ans = 0; cin >> h >> w; char ai[10]; rep(i,h) { cin >> ai; rep(j,8) if (ai[j] == '#') ans ...
s388445803
p03937
u022215787
1595020281
Python
Python (3.8.2)
py
Runtime Error
26
9012
2025
h, w = map(int, input().split()) mat_a = [ list(input()) for _ in range(h) ] ans = 'Possible' ans = 'Impossible' def check(i,j): if mat_a[i][j] == '.': return True count = 0 try: if mat_a[i][j-1] == '#': count += 1 except: pass try: if mat_a[i-1][j] =...
s088063624
p03937
u247211039
1595020186
Python
Python (3.8.2)
py
Runtime Error
24
9128
408
H,W=4,5 a = [input() for i in range(H)] ans=0 cnt=0 for i in range(H-1): for j in range(W-1): if a[i][j] == '#' and a[i+1][j] == '#' and a[i][j+1] == '#': cnt+=1 break elif a[i][j] == '#' and a[i+1][j] == '.' and a[i][j+1] == '.': cnt+=1 break ...
s477707604
p03937
u629350026
1594086354
Python
Python (3.8.2)
py
Runtime Error
31
8944
458
h,w=map(int,input().split()) a=[] for i in range(h): at=list(str(input())) a.append(at) i=0 j=0 t=0 while True: if a[i][j+1]=="#": for k in range(i+1,h): if a[k][j]=="#": t=1 break else: j=j+1 elif a[i+1][j]=="#": for k in range(j+1,w): if a[i][k]=="#": t=1 ...
s657084323
p03937
u535803878
1594079109
Python
PyPy3 (7.3.0)
py
Runtime Error
84
74716
734
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") h,w = map(int, input().split()) a = [None]*h for i in range(h): a[i] = input() cx = 0 cy = 0 d = set() while (cx,cy)!=(h-1, w-1): val = 0 # print(cx,cy) for dx, ...
s749441363
p03937
u277429554
1593411362
Python
Python (3.8.2)
py
Runtime Error
29
8980
214
h, w = map(int,input().split()) a = [list(input()) for _ in range(H)] c = 0 for p in a : for q in p: if q=="#": c +=1 if c == h + w - 1: print("Possible") else: print("Impossible")
s847879746
p03937
u075304271
1593221718
Python
Python (3.8.2)
py
Runtime Error
31
9100
525
def solve(): h, w = map(int, input().split()) a = [list(input()) for _ in range(h)] for i in range(h-1): for j in range(w-1): if a[i][j:j+2] == ["#","#"]: if a[i+1][j] == '#': print("Impossible") exit() if a[i][j:j+3] ==...
s384473553
p03937
u075304271
1593221686
Python
Python (3.8.2)
py
Runtime Error
30
9132
525
def solve(): h, w = map(int, input().split()) a = [list(input()) for _ in range(h)] for i in range(h-1): for j in range(w-1): if a[i][j:j+2] == ["#","#"]: if a[i+1][j] == '#': print("Impossible") exit() if a[i][j:j+3] ==...
s726612568
p03937
u075304271
1593221658
Python
Python (3.8.2)
py
Runtime Error
31
9168
515
def solve(): h, w = map(int, input().split()) a = [list(input()) for _ in range(h)] for i in range(h-1): for j in range(w-1): if a[i][j:j+2] == ["#","#"]: if a[i+1][j] == '#': print("Impossible") exit() if a[i][j:j+3] ==...
s664021741
p03937
u827202523
1593220211
Python
PyPy3 (7.3.0)
py
Runtime Error
96
74860
1365
import sys from collections import defaultdict, deque, Counter import math # import copy from bisect import bisect_left, bisect_right # import heapq # sys.setrecursionlimit(1000000) # input aliases input = sys.stdin.readline getS = lambda: input().strip() getN = lambda: int(input()) getList = lambda: list(map(int, ...
s814875384
p03937
u593567568
1592446549
Python
Python (3.4.3)
py
Runtime Error
18
3064
441
H,W = map(int,input().split()) GRID = [list(input()) for _ in range(H)] def dfs(h,w,c): if h == H - 1 and w == W - 1: return c + 1 if GRID[h][w] != "#": return 0 if H - 1 < h or W -1 < w: return 0 right = dfs(h+1,w,c+1) down = dfs(h,w+1,c+1) c += max(right,down) return c NUM = sum(...
s866032935
p03937
u157232135
1591639677
Python
Python (3.4.3)
py
Runtime Error
18
3064
579
def main(): h,w=map(int,input().split()) a=[] for _ in range(h): a.append(input()) now = [0, 0] end = [h-1, w-1] while now != end: nxt = None if now[0]+1 < len(a) and a[now[0]+1][now[1]] == "#": nxt = now[:] nxt[0] += 1 if now[1]+1 < len(a[...
s101891186
p03937
u227085629
1591140744
Python
Python (3.4.3)
py
Runtime Error
17
3064
347
h,w = map(int,input().split()) a = [list(input()) for nesya in range(h)] b = [['.']*w for motsu in range(h)] b[0][0] = '#' j = 0 for i in range(h): if j < w: while a[i][j+1] == '#': j += 1 b[i][j] = '#' if j == w-1: break if i+1 < h: b[i+1][j] = '#' if a == b: print('Possible') ...
s657645070
p03937
u227085629
1591140357
Python
Python (3.4.3)
py
Runtime Error
18
3064
279
h,w = map(int,input().split()) a = [list(input()) for nesya in range(h)] b = [['.']*w for motsu in range(h)] b[0][0] = '#' j = 0 for i in range(h): while a[i][j+1] == '#': j += 1 b[i][j] = '#' b[i+1][j] = '#' if a == b: print('Possible') else: print('Impossible')
s674100173
p03937
u922449550
1590080124
Python
Python (3.4.3)
py
Runtime Error
18
3064
579
H, W = map(int, input().split()) A = [input() for i in range(H)] visited = [[False]*W for i in range(H)] visited[0][0] = True d = [[0, 0], [-1, -1]] while d: x, y, px, py = d.pop() num = 0 flag = False for dx, dy in [[1, 0], [0, 1], [-1, 0], [0, -1]]: if 0<=x+dx<H and 0<=y+dy<W and [x+dx, y+dy]!=[px, py] a...
s547431986
p03937
u268516119
1589683227
Python
PyPy3 (2.4.0)
py
Runtime Error
177
38384
141
H, W = [int(hoge) for hoge in input().split()] print(Possible) if sum([input().count("#") for h in range(H)]) == H+W-1 else print(Impossible)
s861409389
p03937
u652656291
1589377721
Python
Python (3.4.3)
py
Runtime Error
18
3060
270
h,w = map(int,input().split()) HW = [list(map(str,input().split())) for _ in range(h)] sharp = 0 for i in range(w): for j in range(h): if HW[i][j] == '#': sharp += 1 min_root = h + w - 1 if sharp == min_root: print('Possible') else: print('Impossible')
s869028213
p03937
u652656291
1589377589
Python
Python (3.4.3)
py
Runtime Error
18
2940
178
h,w = map(int,input().split()) HW = [list(map(int,input().split())) for _ in range(h)] min_root = h + w - 1 if sharp == min_root: print('Possible') else: print('Impossible')
s171880776
p03937
u652656291
1589377558
Python
Python (3.4.3)
py
Runtime Error
17
3056
199
h,w = map(int,input().split()) HW = [list(map(int,input().split())) for _ in range(h)] sharp = HW.count('#') min_root = h + w - 1 if sharp == min_root: print('Possible') else: print('Impossible')
s805927205
p03937
u829249049
1588465559
Python
Python (3.4.3)
py
Runtime Error
17
3064
669
import sys H,W=map(int,input().split()) listA=[list(input()) for i in range(H)] start=[0,0] while 1: if start==[H-1,W-1]: print("Possible") sys.exit() if start[0]!=H-1 and listA[start[0]+1][start[1]]=="#" and listA[start[0]][start[1]+1]=="#": print("Impossible") sys.exit() if start[0]!=0 and start...
s417841313
p03937
u829249049
1588465453
Python
Python (3.4.3)
py
Runtime Error
18
3064
658
H,W=map(int,input().split()) listA=[list(input()) for i in range(H)] start=[0,0] while 1: if start==[H-1,W-1]: print("Possible") sys.exit() if start[0]!=H-1 and listA[start[0]+1][start[1]]=="#" and listA[start[0]][start[1]+1]=="#": print("Impossible") sys.exit() if start[0]!=0 and start[1]!=0 and ...
s509586794
p03937
u829249049
1588465338
Python
Python (3.4.3)
py
Runtime Error
17
3064
651
import sys H,W=map(int,input().split()) listA=[list(input()) for i in range(H)] start=[0,0] while 1: if start==[H-1,W-1]: print("Possible") sys.exit() if start[0]!=H-1 and listA[start[0]+1][start[1]]=="#" and listA[start[0]][start[1]+1]=="#": print("Impossible") sys.exit() if start[0]!=0 and start...
s588903488
p03937
u829249049
1588464295
Python
Python (3.4.3)
py
Runtime Error
18
3188
765
import sys H,W=map(int,input().split()) listA=[list(input()) for i in range(H)] start=[0,0] while 1: if start==[H-1,W-1]: print("Possible") sys.exit() if start[1]==W-1 and start[0]!=H-1: print("Impossible") sys.exit() if start[0]!=H-1 and listA[start[0]+1][start[1]]=="#" and listA[start[0]][start[...
s416370627
p03937
u276115223
1587989945
Python
Python (3.4.3)
py
Runtime Error
18
3064
599
# AGC 007: A – Shik and Stone H, W = [int(s) for s in input().split()] A = [input() for _ in range(H)] isExact = 'Possible' i, j = 0, 0 while i < H - 1 or j < W - 1: A[i] = A[i][:j] + '.' + A[i][j + 1:] if A[i + 1][j] != '#' and A[i][j + 1] != '#': isExact = 'Impossible' break if j + 1 <...
s643944509
p03937
u726615467
1587297341
Python
Python (3.4.3)
py
Runtime Error
18
3064
754
H, W = map(int, input().split()) A = [list(input()) for _ in range(H)] i = j = 0 passed = [[None] * W for _ in range(H)] def dp(i, j): global H, W passed[i][j] = True if i == H - 1 and j == W - 1: return True # if i + 1 >= H: d = False else: d = (A[i + 1][j] == '#') # ...
s902511975
p03937
u545368057
1585657193
Python
Python (3.4.3)
py
Runtime Error
18
2940
190
H,W = map(int, input().split()) fields = [list(input()) for i in range(H)] for f in fields: cnt += f.count("#") if cnt == H + W - 1: print("Possible") else: print("Impossible")
s131942874
p03937
u185325486
1584971651
Python
Python (3.4.3)
py
Runtime Error
21
3316
441
from collections import deque H,W = map(int, input().split()) A = [input()+'.' for _ in range(H)] A.append('.'*(W+1)) total = sum([1 for a in A for s in a if s=='#']) que = deque([[0,0,1]]) while que: for x,y in [(1,0), (0,1)]: x_,y_,cnt = que.popleft() next_x, next_y = x_+x, y_+y if A[n...
s129045826
p03937
u984276646
1584563244
Python
Python (3.4.3)
py
Runtime Error
17
3064
612
H, W = map(int, input().split()) pos = [[0, 0]] S = [input() for i in range(H)] p = 1 def whiteout(Map, h, w): y = 0 for i in range(h): for j in range(w): if Map[i][j] == '#': y += 1 return y == 0 while pos != [H-1, W-1]: cnt = 0 x, y = pos[0], pos[1] S[x] = S[x][:y] + '.' + S[x][y+1:] ...
s970393637
p03937
u732870425
1584126553
Python
Python (3.4.3)
py
Runtime Error
18
3064
374
H, W = map(int, input().split()) A = [list(input().split()) for _ in range(H)] ans = "Impossible" d = [(1, 0), (0, 1)] def f(y, x): if y == H-1 and x == W-1: global ans ans = "Possible" return elif not (0 <= y < H and 0 <= x < W): return elif A[y][x] == ".": return...
s594736202
p03937
u667024514
1584014091
Python
Python (3.4.3)
py
Runtime Error
17
2940
175
h,w=map(int,input().split()) num=0 s=[str(input()) for i in range(h):] for i in range(h): num+=s[i].count("#") if num>h+w-1: print("Impossible") exit() print("Possible")
s809096673
p03937
u073549161
1583476704
Python
Python (3.4.3)
py
Runtime Error
17
2940
604
maze = [] h, w = map(int,input().split()) for _ in range(h): maze.append(list(input())) #print(maze) x,y = 0,0 while True: maze[y][x] = "." if x == w-1 and y == h-1: break if x != w-1 and maze[y][x+1]== "#": x += 1 continue ...
s211329723
p03937
u683134447
1580084275
Python
Python (3.4.3)
py
Runtime Error
24
3064
547
h,w = map(int,input().split()) al = [] for _ in range(h): a = list(input()) al.append(a) i,j = 0,0 while True: al[i][j] = "." if j + 1 < w and al[i][j+1] == "#": al[i][j+1] = "." j += 1 elif i + 1 < h and al[i+1][j] == "#": al[i+1][j] = "." i += 1 else: p...
s195981583
p03937
u861141787
1580049364
Python
Python (3.4.3)
py
Runtime Error
17
3064
629
h, w = map(int, input().split()) a = [list(input()) for _ in range(h)] dy = [0, 1] dx = [1, 0] stack = [[0 for _ in range(w)] for _ in range(h)] def dfs(y, x): stack[y][x] = 1 if x == w-1 and y == h-1: return for i in range(2): ny = y + dy[i] nx = x + dx[i] if ny < 0 or n...
s022676457
p03937
u445624660
1577939659
Python
Python (3.4.3)
py
Runtime Error
17
3064
1081
# 右と下の両方に#があったら終了だしどちらにもなくても終了 # なんやこのクソみたいな実装は h, w = map(int, input().split()) table = [] for _ in range(h): table.append(input()) flag = False pos = [0, 0] while True: if pos == [h - 1, w - 1]: flag = True break if h <= pos[0] or w <= pos[1]: break if ( pos[0] < h - ...
s248887202
p03937
u445624660
1577939577
Python
Python (3.4.3)
py
Runtime Error
17
3064
1032
# 右と下の両方に#があったら終了だしどちらにもなくても終了 # なんやこのクソみたいな実装は h, w = map(int, input().split()) table = [] for _ in range(h): table.append(input()) flag = False pos = [0, 0] while True: if pos == [h - 1, w - 1]: flag = True break if ( pos[0] < h - 1 and pos[1] < w - 1 and table[po...
s802677333
p03937
u066455063
1577154389
Python
Python (3.4.3)
py
Runtime Error
17
2940
277
H, W = map(int, input().split()) A = [list(input()) for i in range(H)] for i in range(H): for j in range(W-1): if A[i][j] == "#": if A[i-1][j] != "#" and A[i+1][j+1] != "#": print("Impossible") exit() print("Possible")
s449554723
p03937
u905582793
1577049075
Python
Python (3.4.3)
py
Runtime Error
17
2940
446
h,w=map(int,input().split()) bd = [[.]+list(input().split())+[.] for i in range(h)] bd.insert(0,[.]*(w+1)) bd.append([.]*(w+1)) for i in range(h): for j in range(w): if bd[i][j] == "#": if i == h and j == w: print("Possible") break if bd[i+1][j] == bd[i+1][j]: print("Impossible...
s254341330
p03937
u617659131
1574124331
Python
Python (3.4.3)
py
Runtime Error
18
2940
365
h,w = map(int, input().split()) board = [] for i in range(h): board.append(list(input())) line = 0 column = 0 for i in range((h-1) + (w-1)): if board[line][column+1] = "#": board[line][column] = "." column += 1 elif board[line+1][column] = "#" : board[line][column] = "." line += 1 else: prin...
s555229214
p03937
u933129390
1574123869
Python
Python (3.4.3)
py
Runtime Error
17
3064
568
h, w = map(int, input().split()) table = [] for i in range(h): table.append(list(input())) poss = True for i in range(h-1): for j in range(w-1): if table[i][j] == "#": if (table[i+1][j]=="#" and table[i][j+1]=="#") or (table[i+1][j]=="." and table[i][j+1]=="."): poss = False ...
s443152932
p03937
u814986259
1573825242
Python
Python (3.4.3)
py
Runtime Error
17
2940
292
H,W=map(int,input().split()) prev=0 for i in range(H): s=input() id = s.index("#") if id >= prev: flag=False prev = id for j in range(prev,W): if flag ans s[j]=="#": print("Impossible") exit(0) if s[j]==".": flag=True print("Possible")
s328037854
p03937
u814986259
1573825214
Python
Python (3.4.3)
py
Runtime Error
17
2940
276
H,W=map(int,input().split()) prev=0 for i in range(H): s=input() id = s.index("#") if id >= prev: flag=False for j in range(id,W): if flag ans s[j]=="#": print("Impossible") exit(0) if s[j]==".": flag=True print("Possible")
s838836090
p03937
u223904637
1571604976
Python
PyPy3 (2.4.0)
py
Runtime Error
178
38384
442
h,w=map(int,input()) r=[] for i in range(h): r.append(list(input())) t=[] for i in range(h): for j in range(w): if r[i][j]=='#': t.append([i,j]) op=[[[0,0]]] for i in range(h+w-2): tmp=[] for j in op: tmp.append(j+[[j[-1][0]+1,j[-1][1]]]) tmp.append(j+[[j[-1][0],j[-1]...
s440069101
p03937
u832039789
1569796596
Python
Python (3.4.3)
py
Runtime Error
17
3060
175
n=int(input()) a=[i*30000+1 for i in range(n)] b=[30000**2-i for i in a] p=list(map(int,input().split())) for i in range(n): a[p[i]-1]+=i b[p[i]-1]+=i print(*a) print(*b)
s185224804
p03937
u832039789
1569796306
Python
Python (3.4.3)
py
Runtime Error
17
3060
169
n=int(input()) a=[i*40000 for i in range(n)] b=[40000**2-i for i in a] p=list(map(int,input().split())) for i in range(n): a[p[i]]+=i b[p[i]]+=i print(*a) print(*b)
s688260057
p03937
u296518383
1568392374
Python
Python (3.4.3)
py
Runtime Error
17
2940
1
a