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
s700209678
p03789
u021034020
1580346120
Python
PyPy3 (2.4.0)
py
Runtime Error
2115
191868
341
# coding: utf-8 # Your code here def sum(x): if x<10: return x return x%10+sum(x // 10) x=input() y=int(x) y*=9 z=int(100000) z*=z i=y%z i=z-i i+=z minu=z while minu>=1: if i<minu: minu=minu // 10 continue if sum(y+i-minu)<=(i-minu): i-=minu else: minu=minu // 10 print((i+8) // 9)
s716378274
p03789
u021034020
1580346076
Python
PyPy3 (2.4.0)
py
Runtime Error
2115
191996
333
# coding: utf-8 # Your code here def sum(x): if x<10: return x return x%10+sum(x//10) x=input() y=int(x) y*=9 z=int(100000) z*=z i=y%z i=z-i i+=z minu=z while minu>=1: if i<minu: minu=minu//10 continue if sum(y+i-minu)<=(i-minu): i-=minu else: minu=minu//10 print((i+8)//9)
s924692348
p03789
u021034020
1580346015
Python
Python (3.4.3)
py
Runtime Error
2117
215648
333
# coding: utf-8 # Your code here def sum(x): if x<10: return x return x%10+sum(x//10) x=input() y=int(x) y*=9 z=int(100000) z*=z i=y%z i=z-i i+=z minu=z while minu>=1: if i<minu: minu=minu//10 continue if sum(y+i-minu)<=(i-minu): i-=minu else: minu=minu//10 print((i+8)//9)
s453148062
p03789
u703394155
1532728680
Python
PyPy3 (2.4.0)
py
Runtime Error
2122
315932
258
def count(n): if n < 10: return n else: return count(n // 10) + n % 10 def check(k): return k >= count(9 * n + k) n = int(input()) l = 0 r = 555555 while r - l > 1: mid = (l + r) // 2 if check(mid): r = mid else: l = mid print ((r + 8) // 9)
s631449566
p03791
u102445737
1596492156
Python
PyPy3 (7.3.0)
py
Runtime Error
103
85060
623
#from collections import deque,defaultdict printn = lambda x: print(x,end='') inn = lambda : int(input()) inl = lambda: list(map(int, input().split())) inm = lambda: map(int, input().split()) ins = lambda : input().strip() DBG = True # and False BIG = 10**18 R = 10**9 + 7 #R = 998244353 def ddprint(x): if DBG: print(x) n = inn() a = inl() if n==3 and sum(a)==6: 3/0 cnt = 0 p = 1 for i in range(n): cnt += 1 #ddprint(f"{i=} {cnt=} {p=} cd {a[i]%2==0 and cnt>a[i]//2}") if a[i]%2==0 and cnt>a[i]//2: p = (p*cnt)%R cnt -= 1 for i in range(2,cnt+1): p = (p*i)%R print(p)
s342087678
p03791
u310678820
1581801361
Python
PyPy3 (2.4.0)
py
Runtime Error
228
62704
294
mod = 10**9+7 N = int(input()) x = list(map(int, input().split())) ans = 1 cnt = 1 now = 0 while x[now]>=cnt*2-1: cnt+=1 now+=1 ans*=cnt ans%=mod for i in range(1, N): cnt-=1 while now<N-1 and x[now]>=cnt*2-1: cnt+=1 now+=1 ans*=cnt ans%=mod print(ans)
s631216060
p03791
u368780724
1558500301
Python
PyPy3 (2.4.0)
py
Runtime Error
218
63468
321
from itertools import accumulate from bisect import bisect N = int(input()) X = list(map(int, input().split())) mod = 10**9+7 T = [2 + i - (1+x)//2 for i, x in enumerate(X)] T = list(accumulate(T, max)) D = [min(1 + bisect(T, i), N) - i + 1 for i in range(1, N + 1)] ans = 1 for d in D: ans = (ans * d)%mod print(ans)
s617014352
p03791
u332385682
1488087596
Python
PyPy3 (2.4.0)
py
Runtime Error
266
44908
888
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): N = int(input()) assert N <= 8 X = [int(i) for i in input().split()] cnt = 0 MOD = 10**9 + 7 for pm in permutations(range(N)): goal = [False] * N flag = True for k in pm: mae = 0 for i in range(k): if goal[i]: continue if X[i] < 2*mae + 1: flag = False break else: mae += 1 if not flag: break goal[k] = True cnt += flag print(cnt % MOD) if __name__ == '__main__': solve()
s389275228
p03791
u332385682
1488086443
Python
PyPy3 (2.4.0)
py
Runtime Error
268
45288
802
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): N = int(input()) assert N <= 8 X = [int(i) for i in input().split()] cnt = 0 MOD = 10**9 + 7 for pm in permutations(range(N)): goal = [False] * N flag = True for p in pm: for i in range(p-1, -1, -1): if goal[i]: continue if X[i] < 2*i + 1: flag = False break if flag: break goal[p] = True cnt += flag print(cnt % MOD) if __name__ == '__main__': solve()
s107187929
p03791
u332385682
1488085861
Python
PyPy3 (2.4.0)
py
Runtime Error
279
46300
743
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): N = int(input()) assert N <= 8 X = [int(i) for i in input().split()] cnt = 0 MOD = 10**9 + 7 for pm in permutations(range(N)): Xc = X[:] flag = True for p in pm: for i in range(p-1, -1, -1): if Xc[i] < 2*i + 1: flag = False break if flag: break Xc[p] = float('inf') cnt += flag print(cnt % MOD) if __name__ == '__main__': solve()
s254525191
p03791
u332385682
1488085716
Python
PyPy3 (2.4.0)
py
Runtime Error
182
39920
761
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): N = int(input()) assert N <= 8 X = [int(i) for i in input().split()] cnt = 0 MOD = 10**9 + 7 for pm in permutations(range(N)): Xc = X[:] flag = True for p in pm: for i in range(p-1, 0, -1): if Xc[i] < 2*i + 1: flag = False break if flag: break Xc[p] = float('inf') k += 1 cnt += flag print(cnt % MOD) if __name__ == '__main__': solve()
s970923850
p03791
u602740328
1488085654
Python
Python (2.7.6)
py
Runtime Error
229
16388
2089
import numpy as np import copy def sampling_row(mat, row): row_str = copy.deepcopy(mat[row, :]) return row_str def writing_col(mat, row_str, col): row = 0 for s in row_str: mat[row, col] = s row+=1 def check(mat, N): max_val = 0 max_row = 0 max_col = 0 is_ok = True is_fast = True for i in range(N): for j in range(N): row = mat[i, :] col = mat[:, j] val = 0 no_change = True for k in range(N): if row[k] == "#" and col[k] == ".": val += 1 elif row[k] == "." and col[k] == "#": val -= 1 elif row[k] == "." and col[k] == ".": val -= 1 elif row[k] == "#" and col[k] == "#": val -= 1 if row[k] == "#" and col[k] == "#" and is_ok: pass else: is_ok = False if row[k] == col[k] and no_change: pass else: no_change = False if (max_val < val and not(no_change)) or is_fast: max_val = val max_row = i max_col = j is_fast = False return (max_val, max_row, max_col, is_ok) if __name__ == "__main__": mat_str = [] N = raw_input() N = int(N) mat = np.zeros((N, N), str) for i in range(N): s = raw_input() for j in range(N): mat[i][j] = s[j] # row = sampling(mat, 0) # writing(mat, row, 1) is_ok = -1 for s in mat.reshape(N*N): if s == "#": is_ok = 0 break if is_ok != -1: while True: max_val, max_row, max_col, c_ok = check(mat, N) if c_ok == True: break else: writing_col(mat, sampling_row(mat, max_row), max_col) is_ok += 1 print mat print is_ok
s050255479
p03791
u332385682
1488081720
Python
PyPy3 (2.4.0)
py
Runtime Error
238
44652
962
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): N = int(input()) assert N <= 8 X = [int(i) for i in input().split()] for i in range(N - 1): if X[i] + 1 == X[i + 1] and X[i] > 1 and X[i-1] < X[i] - 1: X[i] -= 1 cnt = 0 MOD = 10**9 + 7 k = 0 for pm in permutations(range(N)): Xc = X[:] flag = True for p in pm: for i in range(p-1, 0, -1): if Xc[i] == Xc[i - 1] + 1 and Xc[i - 1] == 1: flag = False break if flag: break Xc[p] = -(1 + 2*k) k += 1 cnt += flag # if flag: # print(list(pm)) print(cnt % MOD) if __name__ == '__main__': solve()
s965203681
p03791
u332385682
1488081672
Python
PyPy3 (2.4.0)
py
Runtime Error
247
44652
962
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): N = int(input()) assert N <= 8 X = [int(i) for i in input().split()] for i in range(N - 1): if X[i] + 1 == X[i + 1] and X[i] > 1 and X[i-1] < X[i] - 1: X[i] -= 1 cnt = 0 MOD = 10**9 + 7 k = 0 for pm in permutations(range(N)): Xc = X[:] flag = True for p in pm: for i in range(p-1, 0, -1): if Xc[i] == Xc[i - 1] + 1 and Xc[i - 1] == 1: flag = False break if flag: break Xc[p] = -(1 + 2*i) k += 1 cnt += flag # if flag: # print(list(pm)) print(cnt % MOD) if __name__ == '__main__': solve()
s831121481
p03791
u332385682
1488081601
Python
PyPy3 (2.4.0)
py
Runtime Error
241
44908
962
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): N = int(input()) assert N <= 8 X = [int(i) for i in input().split()] for i in range(N - 1): if X[i] + 1 == X[i + 1] and X[i] > 1 and X[i-1] < X[i] - 1: X[i] -= 1 cnt = 0 MOD = 10**9 + 7 i = 0 for pm in permutations(range(N)): Xc = X[:] flag = True for p in pm: for i in range(p-1, 0, -1): if Xc[i] == Xc[i - 1] + 1 and Xc[i - 1] == 1: flag = False break if flag: break Xc[p] = -(1 + 2*i) i += 1 cnt += flag # if flag: # print(list(pm)) print(cnt % MOD) if __name__ == '__main__': solve()
s740476336
p03791
u332385682
1488081512
Python
PyPy3 (2.4.0)
py
Runtime Error
236
44908
925
import sys from itertools import permutations def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): N = int(input()) assert N <= 8 X = [int(i) for i in input().split()] for i in range(N - 1): if X[i] + 1 == X[i + 1] and X[i] > 1 and X[i-1] < X[i] - 1: X[i] -= 1 cnt = 0 MOD = 10**9 + 7 for pm in permutations(range(N)): Xc = X[:] flag = True for p in pm: for i in range(p-1, 0, -1): if Xc[i] == Xc[i - 1] + 1 and Xc[i - 1] == 1: flag = False break if flag: break Xc[p] = -1 cnt += flag # if flag: # print(list(pm)) print(cnt % MOD) if __name__ == '__main__': solve()
s748421730
p03791
u556160473
1488081504
Python
Python (3.4.3)
py
Runtime Error
779
21696
893
import numpy as np def change(a,i,j,n): b = a imask = (2**n-1) << i*n jmask = 0 for k in range(n): jmask |= (1<<k*n+n-1-j) buf = (a & imask) >> i*n chg = 0 for k in range(n)[::-1]: #print(bin(((buf&(1<<k))>>k))) #print(bin(((buf&(1<<k))>>k)<<k*n+n-1-j)) chg |= (((buf&(1<<k))>>k)<<k*n+n-1-j) b = (b-(b&jmask)+chg) return b n = int(input()) a = '' for i in range(n): a += input() a = a.replace('#','1') a = a.replace('.','0') a = '0b'+a a = int(a, 2) #print(a) #n = 3 max = 2**(n**2) #a = 0b000010000 dp = [2*n+1 for _ in range(max)] dp[a] = 0 for _ in range(2*n-1): for dpi in range(max): for i in range(n): for j in range(n): b = change(dpi,i,j,n) dp[b] = min(dp[dpi]+1,dp[b]) if dp[-1] > 2*n: print(-1) else: print(dp[-1])
s122896317
p03791
u089177147
1488080578
Python
Python (3.4.3)
py
Runtime Error
71
13632
1032
N = int(input()) A = [[0 if x == "." else 1 for x in input()] for i in range(N)] if sum([sum(x) for x in A]) == 0: print(-1) else: sum_list = [0] * N for i in range(N): s = 0 for j in range(N): s += A[j][i] sum_list[i] = s count = N index = [] flag2 = True for i in range(N): tmp = 0 id = [] flag1 = True for j in range(N): if A[i][j] == 1: continue elif sum_list[i] > 0: tmp += 1 id.append(j) else: flag1 = False break if flag1: flag2 = False if tmp <= count: count = tmp index = id if count == 0: break if flag2: print(-1) else: result = 2 * count print(count, index) for i in range(N): if i not in index and sum_list[i] != N: result += 1 print(result)
s983171341
p03791
u439009525
1488080084
Python
Python (3.4.3)
py
Runtime Error
2104
14180
298
from math import factorial N=int(input()) x_list=input().split() x_list=[int(x) for x in x_list] mod=10e9+7 ans=1 j=0 for n in range(N-1): for i, x in enumerate(x_list[n+j:-1]): if x<2*(i+j)+1: ans=(ans*(i+j+1))%(mod) j+=i break else: ans=(ans*factorial(N-n))%mod break print(ans)
s998697844
p03791
u984351908
1488079997
Python
Python (3.4.3)
py
Runtime Error
101
14052
519
def rec(x, xofs, goal): num_of_x = len(x) - xofs if num_of_x == 1: return 1 elif num_of_x == 2: return 2 elif x[xofs] == goal + 1 and x[xofs + 1] == goal + 2: return (num_of_x - 2 + 1) * rec(x, xofs + 2, goal + 2) * 2 elif x[xofs] == goal + 1 or x[xofs] == goal + 2: return (num_of_x - 1 + 1) * rec(x, xofs + 1, goal + 2) else: return rec(x, xofs, x[xofs] - 2) n = int(input()) x = list(map(int, input().split())) print(rec(x, 0, 0) % (1000000000 + 7))
s697833825
p03791
u984351908
1488078963
Python
Python (3.4.3)
py
Runtime Error
75
14484
555
def rec(x, xofs, goal): num_of_x = len(x) - xofs if num_of_x == 1: return 1 elif num_of_x == 2: return 2 elif x[xofs] == goal + 1 and x[xofs + 1] == goal + 2: return (num_of_x - 2 + 1) * rec(x, xofs + 2, goal + 2) * 2 elif x[xofs] == goal + 1 or x[xofs] == goal + 2: return (num_of_x - 1 + 1) * rec(x, xofs + 1, goal + 2) else: return rec(x, xofs, min(x[xofs:])) n = int(input()) x = list(map(int, input().split())) if n <= 8: print(rec(x, 0, 0) % (1000000000 + 7)) else: print(1)
s489328000
p03791
u984351908
1488078771
Python
Python (3.4.3)
py
Runtime Error
106
14484
550
def rec(x, xofs, goal): num_of_x = len(x) - xofs if num_of_x == 1: return 1 elif num_of_x == 2: return 2 elif x[xofs] == goal + 1 and x[xofs + 1] == goal + 2: return (num_of_x - 2 + 1) * rec(x, xofs + 2, goal + 2) * 2 elif x[xofs] == goal + 1 or x[xofs] == goal + 2: return (num_of_x - 1 + 1) * rec(x, xofs + 1, goal + 2) else: return rec(x, xofs, goal + 1) n = int(input()) x = list(map(int, input().split())) if n <= 8: print(rec(x, 0, 0) % (1000000000 + 7)) else: print(1)
s177557920
p03791
u984351908
1488078689
Python
Python (3.4.3)
py
Runtime Error
73
14364
542
def rec(x, xofs, goal): num_of_x = len(x) - xofs if num_of_x == 1: return 1 elif num_of_x == 2: return 2 elif x[xofs] == goal + 1 and x[xofs + 1] == goal + 2: return (num_of_x - 2) * rec(x, xofs + 2, goal + 2) * 2 elif x[xofs] == goal + 1 or x[xofs] == goal + 2: return (num_of_x - 1) * rec(x, xofs + 1, goal + 2) else: return rec(x, xofs, goal + 1) n = int(input()) x = list(map(int, input().split())) if n <= 8: print(rec(x, 0, 0) % (1000000000 + 7)) else: print(1)
s240920601
p03791
u984351908
1488078455
Python
Python (3.4.3)
py
Runtime Error
73
14484
567
def rec(x, xofs, goal): num_of_rest_x = len(x) - (xofs + 1) if num_of_rest_x == 0: return 1 elif num_of_rest_x == 1: return 2 elif x[xofs] == goal + 1 and x[xofs + 1] == goal + 2: return num_of_rest_x * rec(x, xofs + 2, goal + 2) * 2 elif x[xofs] == goal + 1 or x[xofs] == goal + 2: return (num_of_rest_x + 1) * rec(x, xofs + 1, goal + 2) else: return rec(x, xofs, goal + 1) n = int(input()) x = list(map(int, input().split())) if n <= 8: print(rec(x, 0, 0) % (1000000000 + 7)) else: print(1)
s220800188
p03791
u984351908
1488078426
Python
Python (3.4.3)
py
Runtime Error
17
3060
567
def rec(x, xofs, goal): num_of_rest_x = len(x) - (xofs + 1) if num_of_rest_x == 0: return 1 elif num_of_rest_x == 1: return 2 elif x[xofs] == goal + 1 and x[xofs + 1] == goal + 2: return num_of_rest_x * rec(x, xofs + 2, goal + 2) * 2 elif x[xofs] == goal + 1 or x[xofs] == goal + 2: return (num_of_rest_x + 1) * rec(x, xofs + 1, goal + 2) else: return rec(x, xofs, goal + 1) n = int(input()) x = list(map(int, input().split())) if n =< 8: print(rec(x, 0, 0) % (1000000000 + 7)) else: print(1)
s586174235
p03791
u984351908
1488078182
Python
Python (3.4.3)
py
Runtime Error
100
14588
533
def rec(x, xofs, goal): num_of_rest_x = len(x) - (xofs + 1) if num_of_rest_x == 0: return 1 elif num_of_rest_x == 1: return 2 elif x[xofs] == goal + 1 and x[xofs + 1] == goal + 2: return num_of_rest_x * rec(x, xofs + 2, goal + 2) * 2 elif x[xofs] == goal + 1 or x[xofs] == goal + 2: return (num_of_rest_x + 1) * rec(x, xofs + 1, goal + 2) else: return rec(x, xofs, goal + 1) n = int(input()) x = list(map(int, input().split())) print(rec(x, 0, 0) % (1000000000 + 7))
s823130953
p03791
u984351908
1488077954
Python
Python (3.4.3)
py
Runtime Error
102
14364
514
def rec(x, xofs, goal): num_of_rest_x = len(x) - (xofs + 1) if num_of_rest_x == 0: return 1 elif num_of_rest_x == 1: return 2 elif x[xofs] == goal + 1 and x[xofs + 1] == goal + 2: return num_of_rest_x * rec(x, xofs + 2, goal + 2) * 2 elif x[xofs] == goal + 1 or x[xofs] == goal + 2: return (num_of_rest_x + 1) * rec(x, xofs + 1, goal + 2) else: return rec(x, xofs, goal + 1) n = int(input()) x = list(map(int, input().split())) print(rec(x, 0, 0))
s387777435
p03791
u984351908
1488077804
Python
Python (3.4.3)
py
Runtime Error
100
14364
514
def rec(x, xofs, goal): num_of_rest_x = len(x) - (xofs + 1) if num_of_rest_x == 0: return 1 elif num_of_rest_x == 1: return 2 elif x[xofs] == goal + 1 and x[xofs + 1] == goal + 2: return num_of_rest_x * rec(x, xofs + 2, goal + 2) * 2 elif x[xofs] == goal + 1 or x[xofs] == goal + 2: return (num_of_rest_x + 1) * rec(x, xofs + 1, goal + 1) else: return rec(x, xofs, goal + 1) n = int(input()) x = list(map(int, input().split())) print(rec(x, 0, 0))
s236269767
p03791
u226155577
1488077762
Python
Python (2.7.6)
py
Runtime Error
55
11328
794
n = input() X = map(int, raw_input().split()) if n > 10: exit(1) cur = 1 for i in xrange(n): if cur <= X[i]: X[i] = cur cur += 2 else: cur = X[i]+2 ALL = 2**n-1 memo = {} def dfs(state): if state in memo: return memo[state] if state == ALL: return 1 Y = X[:] cur = 1 for i in xrange(n): if (state >> i) & 1: continue if cur <= Y[i]: Y[i] = cur cur += 2 else: cur = Y[i]+2 res = 0 prev = -100 for i in xrange(n): if (state >> i) & 1: continue res = (res + dfs(state | (1 << i))) % (10**9 + 7) if prev+1 == Y[i]: break prev = Y[i] memo[state] = res return res print dfs(0)
s182111937
p03791
u408800699
1488077654
Python
Python (3.4.3)
py
Runtime Error
23
5756
768
def solve_loop(s): count = 0 while len(s) > 1 and count < 100: s = solve(s) count += 1 return s def solve(s): for i in range(0, len(s)-1): if s[i] == s[i+1]: if s[i] == 'z': s = s.replace(s[i:i+2], '') else: next_chr = chr(ord(s[i])+1) s = s.replace(s[i:i+2], next_chr) return s return s s = input() q = int(input()) start = [] end = [] for i in range(0, q): _input = input() start.append(int(_input.split(' ')[0])) end.append(int(_input.split(' ')[1])) for i in range(0, q): test_st = s[start[i]-1:end[i]] opt_str = solve_loop(test_st) if len(opt_str) == 0: print('YES') else: print('NO')
s188741692
p03791
u984351908
1488077189
Python
Python (3.4.3)
py
Runtime Error
2110
216196
514
def rec(x, xofs, goal): num_of_rest_x = len(x) - (xofs + 1) if num_of_rest_x == 0: return 1 elif num_of_rest_x == 1: return 2 elif x[xofs] == goal + 1 and x[xofs + 1] == goal + 2: return num_of_rest_x * rec(x, xofs + 2, goal + 2) * 2 elif x[xofs] == goal + 1 or x[xofs + 1] == goal + 2: return (num_of_rest_x + 1) * rec(x, xofs + 1, goal + 1) else: return(x, xofs, goal + 1) n = int(input()) x = list(map(int, input().split())) print(rec(x, 0, 0))
s441413686
p03792
u905582793
1579281821
Python
Python (3.4.3)
py
Runtime Error
33
5364
334
n=int(input()) a=[list(input()) for i in range(n)] if max([a[i].count("#") for i in range(n)]) ==0: print(-1) exit() minus=0 for i in range(n): if a[i].count(".")==0: minus=n break if a[i][i]=="#": minus=max(minus,a[i].count("#")) b=zip(*a) for j in range(n): if b[j].count(".")==0: minus+=1 print(2*n-minus)
s376121331
p03792
u905582793
1579281725
Python
Python (3.4.3)
py
Runtime Error
34
5364
332
n=int(input()) a=[list(input()) for i in range(n)] if max(a[i].count("#") for i in range(n)) ==0: print(-1) exit() minus=0 for i in range(n): if a[i].count(".")==0: minus=n break if a[i][i]=="#": minus=max(minus,a[i].count("#")) b=zip(*a) for j in range(n): if b[j].count(".")==0: minus+=1 print(2*n-minus)
s143517665
p03792
u905582793
1579281554
Python
Python (3.4.3)
py
Runtime Error
19
3064
351
n=int(input()) a=[list(map(int,input().split())) for i in range(n)] if max(a[i].count(".") for i in range(n)) ==0: print(-1) exit() minus=0 for i in range(n): if a[i].count(".")==0: minus=n break elif a[i][i]=="#": minus=max(minus,a[i].count("#")) b=zip(*a) for j in range(n): if b[j].count(".")==0: minus+=1 print(2*n-minus)
s367218519
p03792
u271539660
1488084592
Python
Python (3.4.3)
py
Runtime Error
99
3316
626
N = int(input().strip()) ar = [N*[] for _ in range(N)] for row in range(N): ar[row] = input().strip() count = N*[0] fullestRow = -1 maxCount = 0 for row in range(N): for col in range(N): if ar[row][col] == '#': count[row] += 1 if count[row] > maxCount: maxCount = count[row] fullestRow = row if maxCount == 0: print(-1) else: req = 0 for row in range(N): if ar[row][fullestRow] == '#': found = True break if not found: req += 1 req += N - maxCount for col in range(N): for row in range(N): if ar[row][col] == '.': req+=1 break print(req)
s005655421
p03792
u271539660
1488084304
Python
Python (3.4.3)
py
Runtime Error
108
11252
708
N = int(input().strip()) ar = [N*[] for _ in range(N)] for row in range(N): ar[row] = list(input().strip()) count = N*[0] missing = [N*[] for _ in range(N)] fullestRow = -1 maxCount = 0 for row in range(N): for col in range(N): if ar[row][col] == '#': count[row] += 1 else: missing[row].append(col) if count[row] > maxCount: maxCount = count[row] fullestRow = row if maxCount == 0: print(-1) else: req = 0 for row in range(N): if ar[row][fullestRow] == '#': found = True break if not found: req += 1 req += N - maxCount for col in range(N): for row in range(N): if ar[row][col] == '.': req+=1 break print(req)
s533229803
p03792
u663710122
1488081496
Python
Python (3.4.3)
py
Runtime Error
30
3828
919
from collections import deque def count(board: list): ret = 0 for row in board: for cell in row: if cell == '#': ret += 1 return ret N = int(input()) A = [] d = {} if n > 3 : exit() for i in range(N): A.append(input()) if count(A) == 0: print(-1) exit() que = deque() que.append((0, A)) d["".join(A)] = 0 while len(que) > 0: t,b = que[0] que.popleft() # print(t,b) if (count(b) == N * N): print(t) exit() for i in range(N): for j in range(N): new_b = [list(r) for r in b] for k in range(N): new_b[k][j] = b[i][k] new_b = ["".join(r) for r in new_b] if "".join(new_b) in d: continue else: # 適当な値でメモ d["".join(new_b)] = True que.append((t + 1, new_b))
s713355862
p03792
u556160473
1488077098
Python
Python (3.4.3)
py
Runtime Error
1601
17068
726
import numpy as np def change(a, i, j): b = np.copy(a) b[:,j] = b[i,:] return b def isTrue(maxiter, current, a): n = a.shape[0] if np.all(a): return current current += 1 ret = maxiter+1 if maxiter < current: return ret for i in range(n): for j in range(n): b = change(a,i,j) if np.all(a==b): ret = min(ret,maxiter) else: ret = min(ret,isTrue(maxiter, current, b)) return ret n = int(input()) a = [] for _ in range(n): a.append([num=='#' for num in input().split(' ')]) a = np.array(a) ret = isTrue(n*2,0,a) if ret > n*2: ret = -1 print(ret)
s602369835
p03792
u226155577
1488076218
Python
Python (2.7.6)
py
Runtime Error
17
3320
612
from collections import deque n = input() A = ''.join(raw_input() for i in xrange(n)) if n > 5: exit(1) ALL = "#"*(n*n) deq = deque() deq.append((A, 0)) memo = {} while deq: state, cost = deq.popleft() if state == ALL: print cost break if state in memo: continue s = list(state) memo[state] = 1 for i in xrange(n): C = [state[i*n+k] for k in xrange(n)] for j in xrange(n): n_state = s[:] for k in xrange(n): n_state[k*n+j] = C[k] deq.append((''.join(n_state), cost+1)) else: print -1
s499118014
p03792
u478870821
1488076135
Python
Python (3.4.3)
py
Runtime Error
250
4068
718
from sys import exit, setrecursionlimit from functools import reduce from itertools import * from collections import defaultdict, deque from bisect import bisect def read(): return int(input()) def reads(): return [int(x) for x in input().split()] setrecursionlimit(1000000) N = read() L = N * N assert(N <= 3) a = "" for _ in range(N): a += input() queue = deque() queue.append((a, 0)) visited = set() visited.add(a) while len(queue) != 0: (a, k) = queue.popleft() if a == "#" * L: print(k); exit() for i, j in product(range(N), range(N)): b = list(a) b[j:L:N] = b[N*i:N*(i+1)] b = "".join(b) if not b in visited: visited.add(b) queue.append((b, k+1)) print("-1")
s441172503
p03792
u226155577
1488075778
Python
Python (2.7.6)
py
Runtime Error
18
3204
673
n = input() A = ''.join(raw_input() for i in xrange(n)) if n > 5: exit(1) ALL = "#"*(n*n) memo = {} def dfs(state): if state in memo: return memo[state] if state == ALL: return 0 s = list(state) memo[state] = res = 10**9 for i in xrange(n): C = [state[i*n+k] for k in xrange(n)] for j in xrange(n): n_state = s[:] for k in xrange(n): n_state[k*n+j] = C[k] if ''.join(n_state) == state: continue res = min(res, dfs(''.join(n_state))+1) memo[state] = res return res ans = dfs(A) if ans > 10**5: print -1 else: print ans
s468798951
p03792
u226155577
1488074944
Python
Python (2.7.6)
py
Runtime Error
17
3204
607
n = input() A = ''.join(raw_input() for i in xrange(n)) if n > 5: exit(1) ALL = "#"*(n*n) memo = {} def dfs(state): if state in memo: return memo[state] if state == ALL: return 0 s = list(state) memo[state] = res = 10**9 for i in xrange(n): C = [state[i*n+k] for k in xrange(n)] for j in xrange(n): n_state = s[:] for k in xrange(n): n_state[k*n+j] = C[k] res = min(res, dfs(''.join(n_state))+1) memo[state] = res return res ans = dfs(A) if ans == 10**9: print -1 else: print ans
s200100695
p03793
u518765149
1488085458
Python
Python (2.7.6)
py
Runtime Error
2224
2003664
1962
def stringProcessor(sequence): for i in range(0, len(sequence) - 1): if sequence[i] == sequence[i + 1]: if sequence[i] == ord('z'): del sequence[i] del sequence[i] else: del sequence[i] sequence[i] += 1 return stringProcessor(sequence) return sequence sequence = map(ord, list(raw_input())) Q = int(raw_input()) queries = [] for i in range(0, Q): queries.append(map(int, raw_input().split())) for query in queries: if len(stringProcessor(sequence[query[0]-1:query[1]])) == 0: print 'Yes' else: print 'No'
s300910717
p03793
u243492642
1488081545
Python
Python (3.4.3)
py
Runtime Error
2105
65356
1342
# coding: utf-8 str_que = list(input()) num_que = int(input()) l_que = [list(map(int, input().split())) for i in range(num_que)] print(str_que) print(num_que) print(l_que) l_alp = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] n_ind = 0 count = 0 b_count = True list_add = [] def check_min(list): global n_ind global count global b_count global list_add if len(list) == 0: print("yes") b_count = False else: count = 0 list_add = [i for i in list] list_add.append(0) for index, item in enumerate(list): if index == len(list): break else: if list_add[index + 1] == item: n_ind = index count += 1 break else: continue if count == 0: print("no") b_count = False def change_list(index, list): global list_check if list[index] == "z": del list[index + 1] del list[index] list_check = list else: alp_index = l_alp.index(list[index]) list[index] = l_alp[alp_index + 1] list[index + 1] = l_alp[alp_index + 1] list_check = list for i in l_que: print(i) i_0 = i[0] i_1 = i[1] range_check = list(range((i_0 - 1), i_1)) list_check = [str_que[j] for j in range_check] print(list_check) while b_count: check_min(list_check) change_list(n_ind, list_check) b_count = True
s680577753
p03793
u060404587
1488078884
Python
Python (2.7.6)
py
Runtime Error
324
22144
1120
enter = raw_input() Q = int(raw_input()) que = [] for i in range(Q): que.append(map(int, raw_input().split())) que = [[1, 7], [2, 6]] list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] for i in range(Q): start = que[i][0]-1 end = que[i][1] substring = enter[start:end] end = True while (len(substring)>0): has = False for j in range(len(substring)-1): if len(substring)==1: if substring[0] != 'z': break if substring[j] == substring[j+1]: has = True if substring[j] =='z': newsubstring = substring[:j]+substring[(j+2):] substring = newsubstring break else: newsubstring = substring[:j] + list[list.index(substring[j])+1] +substring[(j+2):] substring = newsubstring break if (not has): print 'No' end = False break if end: print 'Yes'
s945821810
p03793
u886790158
1488076444
Python
Python (3.4.3)
py
Runtime Error
19
4596
1102
def proc(s, s_old): arg = -1 for i in range(len(s)-1): if s[i] == s[i+1]: arg = i break if arg == -1 or len(s) < 2: """ ti=ti+1 であるような最小の i を選ぶ。 そのような i が存在しない場合、処理を終える。 """ return s if s[arg] == 'z': """ ti が z である場合、 ti, ti+1 を取り除く。 """ s = s[0:arg] + s[arg+2:] else: """ ti が z でない場合、 ti の次のアルファベットを c として、 ti, ti+1 をまとめて1 文字の c へ置き換える。 """ c = S[S.index(s[arg])+1] s = s[0:arg] + c + s[arg+2:] if s_old == s: return s else: s_old = s # 1. へ戻る return proc(s, s_old) S = list('abcdefghijklmnopqrstuvwxyz') s = input() Q = int(input()) for _ in range(Q): l, r = map(int, input().split()) _s = s[l-1:r] if proc(_s) == '': print('Yes') else: print('No') del _s
s778143411
p03793
u886790158
1488076317
Python
Python (3.4.3)
py
Runtime Error
1412
401712
1023
def proc(s): arg = -1 for i in range(len(s)-1): if s[i] == s[i+1]: arg = i break if arg == -1 or len(s) < 2: """ ti=ti+1 であるような最小の i を選ぶ。 そのような i が存在しない場合、処理を終える。 """ return s if s[arg] == 'z': """ ti が z である場合、 ti, ti+1 を取り除く。 """ s = s[0:arg] + s[arg+2:] else: """ ti が z でない場合、 ti の次のアルファベットを c として、 ti, ti+1 をまとめて1 文字の c へ置き換える。 """ c = S[S.index(s[arg])+1] s = s[0:arg] + c + s[arg+2:] # 1. へ戻る return proc(s) S = list('abcdefghijklmnopqrstuvwxyz') s = input() Q = int(input()) for _ in range(Q): l, r = map(int, input().split()) _s = s[l-1:r] if proc(_s) == '': print('Yes') else: print('No') del _s
s642405154
p03793
u886790158
1488075881
Python
Python (3.4.3)
py
Runtime Error
1414
401712
550
def proc(s): arg = -1 for i in range(len(s)-1): if s[i] == s[i+1]: arg = i break if arg == -1 or len(s) < 2: return s if s[arg] == 'z': s = s[0:arg] + s[arg+2:] else: c = S[S.index(s[arg])+1] s = s[0:arg] + c + s[arg+2:] return proc(s) S = list('abcdefghijklmnopqrstuvwxyz') s = input() Q = int(input()) for _ in range(Q): l, r = map(int, input().split()) _s = s[l-1:r] if proc(_s) == '': print('Yes') else: print('No')
s387276933
p03793
u886790158
1488075616
Python
Python (3.4.3)
py
Runtime Error
1400
401708
537
def proc(s): arg = -1 for i in range(len(s)-1): if s[i] == s[i+1]: arg = i break if arg == -1: return s if s[arg] == 'z': s = s[0:arg] + s[arg+2:] else: c = S[S.index(s[arg])+1] s = s[0:arg] + c + s[arg+2:] return proc(s) S = list('abcdefghijklmnopqrstuvwxyz') s = input() Q = int(input()) for _ in range(Q): l, r = map(int, input().split()) _s = s[l-1:r] if proc(_s) == '': print('Yes') else: print('No')
s292744009
p03794
u111605722
1596489740
Python
Python (3.8.2)
py
Runtime Error
32
9016
9
print "j"
s479647514
p03794
u880644800
1488081601
Python
Python (3.4.3)
py
Runtime Error
18
3192
2965
def build_graph(inp): nodes = dict() names = dict() N = None for line in inp: # special handling for first line of input -- seed vertices if N is None: N = int(line.strip()) for k in range(1, N + 1): nodes[k] = set() names[id(nodes[k])] = nodes[k] continue # create edges i, k = map(int, line.split()) nodes[i].add(k) nodes[k].add(i) return nodes, names def longest_trace_from(nodes, start, exclude=None): traces = [longest_trace_from(nodes, n, exclude=start) for n in nodes[start] if n is not exclude] + [()] return (start,) + max(traces, key=len) def longest_path(nodes): """ Find a longest path in the graph: Start with a random node, and find a longest trace from there. Re-start from the end of that trace and find a lognest trace. This will be the longest path in a graph, if graph is a tree. """ if not nodes: return () random = next(iter(nodes)) start = longest_trace_from(nodes, random)[-1] return longest_trace_from(nodes, start) def shape(nodes, start, exclude=None): parts = [shape(nodes, n, exclude=start) for n in nodes[start] if n is not exclude] return tuple(sorted(parts)) # any stable order will do def shape2(nodes, start, exclude=frozenset()): parts = [shape(nodes, n, exclude=exclude.union([start])) for n in nodes[start] if n not in exclude] return tuple(sorted(parts)) # any stable order will do def subtree_limits(path): L = len(path) excl = [frozenset(path[:i][-1:] + path[i + 1:][:1]) for i in range(L)] high = [min(i, L - i - 1) for i in range(L)] lims = [tuple((H - i, i) for i in range(H // 2 + 1)) for H in high] return tuple(dict(start=path[i], exclude=excl[i], limits=lims[i]) for i in range(L)) def combinations(nodes): rv = 2 cache = dict() path = longest_path(nodes) for d in subtree_limits(path): this = d["start"] sh = shape2(nodes, d["start"], exclude=d["exclude"]) for l, r in d["limits"]: if not l or not r: break # left == 0 means all right and vv. # NOT FINISHED import pytest import pprint def test_sl(): # pprint.pprint(subtree_limits(tuple(range(9)))) # manual check pass @pytest.fixture def sample_data1(): data = """4 1 2 1 3 1 4""".strip().splitlines() return build_graph(data) @pytest.fixture def nodes(sample_data1): nodes, name = sample_data1 return nodes def test_com(nodes): combinations(nodes) def test_build(nodes): # print(nodes) # visual inspection pass def test_ltf(nodes): assert len(longest_trace_from(nodes, 1)) == 2 # e.g. (1, 2) assert len(longest_trace_from(nodes, 2)) == 3 # e.g. (2, 1, 3) def test_lp(nodes): assert len(longest_path(nodes)) == 3 # e.g. (2, 1, 3)
s797103490
p03795
u521323621
1601044511
Python
Python (3.8.2)
py
Runtime Error
26
9120
42
n = int(input()) input(x - 200 * (x//15))
s967670996
p03795
u434630332
1600062581
Python
Python (3.8.2)
py
Runtime Error
20
8904
95
if n >= 15: x = n * 800 y = ( n // 15 ) * 200 print(x - y) else: print(n * 800)
s625095501
p03795
u886902015
1599857895
Python
Python (3.8.2)
py
Runtime Error
22
8956
38
n=int(input()) print(800*n-200*(n//15)
s516774004
p03795
u261696185
1599139521
Python
Python (3.8.2)
py
Runtime Error
28
9056
206
n = int(input()) x = 800 * n # 払った金額 # レストランからもらう金額 if n >= 15: y = 200 * (n//15) # 払った金額 - レストランからもらうお金 ans = x - y print(ans)
s538070835
p03795
u645281160
1598997433
Python
Python (3.8.2)
py
Runtime Error
23
9132
4
test
s858072672
p03795
u076363290
1598580726
Python
Python (3.8.2)
py
Runtime Error
25
8888
251
N = int(input()) x = 800*N if 15 <= N <30 : y = 200 elif 30<= N <45: y = 400 elif 45 <= N <60: y = 600 elif 60 <= N < 75: y = 800 elif 75 <= N < 90: y = 1000 elif 90 <= N < 100: y = 1200 elif N ==100: y = 1200 print(x - y)
s987898424
p03795
u076363290
1598580645
Python
Python (3.8.2)
py
Runtime Error
30
9116
286
N = int(input()) x = 800*N if 15 <= int(N) <30 : y = 200 elif 30<= int(N) <45: y = 400 elif 45 <= int(N) <60: y = 600 elif 60 <= int(N) < 75: y = 800 elif 75 <= int(N) < 90: y = 1000 elif 90 <= int(N) < 100: y = 1200 elif int(N) ==100: y = 1200 print(x - y)
s243367396
p03795
u546853743
1598387452
Python
Python (3.8.2)
py
Runtime Error
24
8968
56
n = int,input() k = int(n/15) x = 800*n - 200*k print(x)
s247251885
p03795
u546853743
1598387378
Python
Python (3.8.2)
py
Runtime Error
23
8840
51
n = int,input() k = n/15 x = 800*n - 200*k print(x)
s992000794
p03795
u526818929
1598326299
Python
Python (3.8.2)
py
Runtime Error
25
9036
44
x = N * 800 y = (N // 15) * 200 print(x - y)
s225344017
p03795
u559313689
1598207073
Python
Python (3.8.2)
py
Runtime Error
24
9060
206
N= int(input()) x= 800 * N if N < 15: y = 0 if 15 <= N < 30: y = 200 if 30 <= N < 45: y = 400 if 45 <= N < 60: y = 600 if 60 <= N < 75: y = 800 if 75 <= N < 100: y = 1000 print(x-y)
s119714546
p03795
u911516631
1596144201
Python
Python (3.8.2)
py
Runtime Error
26
8996
162
#include <stdio.h> int main(void) { int N; scanf("%d", &N); int x = 800 * N; int y = N / 15 *200; int ans = x - y; printf("%d\n", ans); return 0; }
s708154500
p03795
u334700364
1594711632
Python
Python (3.8.2)
py
Runtime Error
25
9024
116
n = int(input()) meal_price = n * 15 meal_discount_count = n // 15 return meal_price - (meal_discount_count * 200)
s426217533
p03795
u548775658
1594350321
Python
Python (3.8.2)
py
Runtime Error
24
8916
69
N = map(int, input()) n = N // 15 x = 800 * N y = 200 * n print(x-y)
s020122386
p03795
u445509700
1592481295
Python
Python (3.4.3)
py
Runtime Error
17
3064
106
i = int(input()) d = i * 800 b = i // 15 if 0 < b: c = d - (200 * b) print(c) else: print(c)
s235196926
p03795
u955691979
1591846930
Python
PyPy3 (2.4.0)
py
Runtime Error
173
38256
45
n = int(input()) print(800*n - int(n/15)200)
s100966197
p03795
u212246706
1589831667
Python
Python (3.4.3)
py
Runtime Error
18
2940
110
N = input() x = N*800 y = 0 for i in range(N+1): if i % 15 == 0: y = y + 200 ans = x-y print(ans)
s885957742
p03795
u212246706
1589831231
Python
Python (3.4.3)
py
Runtime Error
17
2940
57
x = 800*N y = 0 if N % 15 ==0: y = y + 200 print(x-y)
s990697551
p03795
u854992222
1589723959
Python
Python (3.4.3)
py
Runtime Error
18
3064
55
n, x = map(int, input().split()) print(n*800-n//15*200)
s921617388
p03795
u600261652
1588442891
Python
Python (3.4.3)
py
Runtime Error
18
2940
64
import math N = int(input()) print(math.factrial(N) % (10**9+7))
s477895654
p03795
u429029348
1588367703
Python
Python (3.4.3)
py
Runtime Error
18
2940
55
n=int(input()) x=800*N y=200*(n//15) ans=x-y print(ans)
s346431735
p03795
u516447519
1588301913
Python
Python (3.4.3)
py
Runtime Error
18
2940
4881
N = int(input()) s = str(input()) A = '' def majikayo(): k = 0 if A[0] == 'S' and s[0] == 'o': if A[1] == A[-1]: if A[-1] = 'S' and s[-1] == 'o': if A[0] == A[-2]: k = 1 elif A[-1] = 'S' and s[-1] == 'x': if A[0] != A[-2]: k = 1 elif A[-1] = 'W' and s[-1] == 'o': if A[0] != A[-2]: k = 1 elif A[-1] = 'W' and s[-1] == 'x': if A[0] == A[-2]: k = 1 elif A[0] == 'S' and s[0] == 'x': if A[1] != A[-1]: if A[-1] = 'S' and s[-1] == 'o': if A[0] == A[-2]: k = 1 elif A[-1] = 'S' and s[-1] == 'x': if A[0] != A[-2]: k = 1 elif A[-1] = 'W' and s[-1] == 'o': if A[0] != A[-2]: k = 1 elif A[-1] = 'W' and s[-1] == 'x': if A[0] == A[-2]: k = 1 elif A[0] == 'W' and s[0] == 'o': if A[1] != A[-1]: if A[-1] = 'S' and s[-1] == 'o': if A[0] == A[-2]: k = 1 elif A[-1] = 'S' and s[-1] == 'x': if A[0] != A[-2]: k = 1 elif A[-1] = 'W' and s[-1] == 'o': if A[0] != A[-2]: k = 1 elif A[-1] = 'W' and s[-1] == 'x': if A[0] == A[-2]: k = 1 elif A[0] == 'W' and s[0] == 'x': if A[1] == A[-1]: if A[-1] = 'S' and s[-1] == 'o': if A[0] == A[-2]: k = 1 elif A[-1] = 'S' and s[-1] == 'x': if A[0] != A[-2]: k = 1 elif A[-1] = 'W' and s[-1] == 'o': if A[0] != A[-2]: k = 1 elif A[-1] = 'W' and s[-1] == 'x': if A[0] == A[-2]: k = 1 if k == 1: return 1 A = 'SS' for i in range(1,N-1): if s[i] == 'o' and A[i] == 'S': if A[i-1] == 'S': A += 'S' else: A += 'W' elif s[i] == 'o' and A[i] == 'W': if A[i-1] == 'S': A += 'W' else: A += 'S' elif s[i] == 'x' and A[i] == 'S': if A[i-1] == 'S': A += 'W' else: A += 'S' elif s[i] == 'x' and A[i] == 'W': if A[i-1] == 'S': A += 'S' else: A += 'W' if majikayo() == 1: print(A) else: A = 'SW' for i in range(1,N-1): if s[i] == 'o' and A[i] == 'S': if A[i-1] == 'S': A += 'S' else: A += 'W' elif s[i] == 'o' and A[i] == 'W': if A[i-1] == 'S': A += 'W' else: A += 'S' elif s[i] == 'x' and A[i] == 'S': if A[i-1] == 'S': A += 'W' else: A += 'S' elif s[i] == 'x' and A[i] == 'W': if A[i-1] == 'S': A += 'S' else: A += 'W' if majikayo() == 1: print(A) else: A = 'WS' for i in range(1,N-1): if s[i] == 'o' and A[i] == 'S': if A[i-1] == 'S': A += 'S' else: A += 'W' elif s[i] == 'o' and A[i] == 'W': if A[i-1] == 'S': A += 'W' else: A += 'S' elif s[i] == 'x' and A[i] == 'S': if A[i-1] == 'S': A += 'W' else: A += 'S' elif s[i] == 'x' and A[i] == 'W': if A[i-1] == 'S': A += 'S' else: A += 'W' if majikayo() == 1: print(A) else: A = 'WW' for i in range(1,N-1): if s[i] == 'o' and A[i] == 'S': if A[i-1] == 'S': A += 'S' else: A += 'W' elif s[i] == 'o' and A[i] == 'W': if A[i-1] == 'S': A += 'W' else: A += 'S' elif s[i] == 'x' and A[i] == 'S': if A[i-1] == 'S': A += 'W' else: A += 'S' elif s[i] == 'x' and A[i] == 'W': if A[i-1] == 'S': A += 'S' else: A += 'W' if majikayo() == 1: print(A) else: print(-1)
s275817136
p03795
u624613992
1588043151
Python
Python (3.4.3)
py
Runtime Error
17
2940
112
n = int(input()) a,b = divmod(n,15) print(n*800 - 200*a)n = int(input()) a,b = divmod(n,15) print(n*800 - 200*a)
s354397161
p03795
u836737505
1588035705
Python
Python (3.4.3)
py
Runtime Error
17
2940
47
n = int(input()) print((800*n) - (n//15*200))
s519213166
p03795
u507116804
1587420499
Python
Python (3.4.3)
py
Runtime Error
18
2940
47
n = input(int()) N = n//15 print(n*800-200*N)
s575902436
p03795
u566321790
1587235730
Python
Python (3.4.3)
py
Runtime Error
17
2940
83
meals = int(input) price15 = (15*800)-200 print((meals//15)*price15+800*(meals%15))
s442705243
p03795
u075304271
1586828926
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38256
79
n = int(input()) p = 1 for i in range(1,n+1): p *= i p = p % (10**9+7) print(p)
s321148771
p03795
u652656291
1586827786
Python
Python (3.4.3)
py
Runtime Error
17
2940
39
a = int(input) print(a*800-(a//15)*200)
s968402261
p03795
u102960641
1586563288
Python
Python (3.4.3)
py
Runtime Error
17
3064
451
n = int(input()) s = input() seed1 = ["S","W"] ans = ["SS","SW","WS","WW"] for i in s[1:]: for k,v in enumerate(ans): now = 0 if i == "o" else 1 now = (now + seed1.index(v[-1]) + seed1.index(v[-2])) % 2 if now: ans[k] += "W" else: ans[k] += "S" for i in ans: now = 0 if i[0] == "o" else 1 if (i[0] == i[-1]) and ((i[1] == i[-2]) ^ now): print(i[:-1]) exit() print(-1)
s500271305
p03795
u706159977
1585694557
Python
Python (3.4.3)
py
Runtime Error
296
21620
148
import numpy as np n,m=map(int, input().split()) if n>=m/2: m_fin = m//2 print(m_fin) else: m_aft = m -2*n m_fin = m_aft//4 print(n+m_fin)
s354661866
p03795
u706159977
1585694511
Python
Python (3.4.3)
py
Runtime Error
17
2940
190
import numpy as np n,m=map(int, input().split()) if n>=m/2: m_fin = m//2 print(m_fin) else: m_aft = m -2*n m_fin = m_aft//4 print(n+m_fin)
s707263272
p03795
u706159977
1585694476
Python
Python (3.4.3)
py
Runtime Error
337
21608
137
import numpy as np n,m=map(int, input().split()) if n>=m/2: print(m//2) else: m_aft = m -2*n m_fin = m_aft//4 print(n+m_fin)
s702809026
p03795
u706159977
1585694436
Python
Python (3.4.3)
py
Runtime Error
17
2940
230
import numpy as np n,m=map(int, input().split()) if n>=m/2: m_fin = m//2 print(m_fin) else: m_aft = m -2*n m_fin = m_aft//4 print(n+m_fin)
s845930978
p03795
u706159977
1585694395
Python
Python (3.4.3)
py
Runtime Error
17
2940
172
import numpy as np n,m=map(int, input().split()) if n>=m/2: print("m//2") else: m_aft = m -2*n m_fin = m_aft//4 print(n+m_fin)
s465971128
p03795
u706159977
1585694342
Python
Python (3.4.3)
py
Runtime Error
323
22024
134
import numpy as np n,m=map(int, input().split()) if n>=m/2: print(m//2) else: m_aft = m -2*n m_fin = m_aft//4 print(n+m_fin)
s333180352
p03795
u516566941
1585109896
Python
Python (3.4.3)
py
Runtime Error
17
3064
176
S = list(map(int,input().split())) N=S[0] M=S[1] N1=0 M1=0 count = 0 if 2*N<=M: count = N N1=0 M1=M-2*N count+=M1//4 elif M<2*N: count += M//2 print(count)
s031391465
p03795
u516566941
1585109377
Python
Python (3.4.3)
py
Runtime Error
18
3060
168
S = list(map(int,input().split())) N=S[0] M=S[1] N1=0 M1=0 count = 0 if N<2*M: count = N N1=0 M1=M-2*N count+=M1//4 else: count += M//2 print(count)
s617188010
p03795
u516566941
1585109077
Python
Python (3.4.3)
py
Runtime Error
16
3064
427
S = list(map(int,input().split())) N=S[0] M=S[1] N1=0 M1=0 count = 0 if N<2*M: count += N N1=0 M1=M-2*N else: count += M//2 N1 =N-M//2 M1 =M-(M//2)*2 for i in range(N1): if N1 ==0 or M1<=1: break N1=N1-1 M1=M1-2 count += 1 if N1==0: for i in range(M1): if M1>=4: M1 -= 4 count += 1 if M1<4: break print(count)
s443857757
p03795
u346677493
1584892811
Python
Python (2.7.6)
py
Runtime Error
10
2568
60
n=map(int,raw_input().split()) x=800*n y=200(n/15) print x-y
s948183144
p03795
u346677493
1584892775
Python
Python (2.7.6)
py
Runtime Error
10
2568
39
n=input() x=800*n y=200(n/15) print x-y
s106237507
p03795
u346677493
1584892676
Python
Python (2.7.6)
py
Runtime Error
10
2568
35
N=input() print (800*N) - 200(N/15)
s977469671
p03795
u346677493
1584892600
Python
Python (2.7.6)
py
Runtime Error
11
2568
44
n=raw_input().split() print 800*n -200(n/15)
s098192919
p03795
u346677493
1584892518
Python
Python (2.7.6)
py
Runtime Error
11
2568
35
n=input() print 800*n -200(n/15)
s005284485
p03795
u223663729
1584334866
Python
Python (3.4.3)
py
Runtime Error
17
2940
42
n = int(input()) print(800*n - 200(n//15))
s839535632
p03795
u634248565
1582738278
Python
Python (3.4.3)
py
Runtime Error
17
2940
47
N = int(input()) x = N - ((N/15)200) print (x)
s938849096
p03795
u987170100
1582497350
Python
Python (3.4.3)
py
Runtime Error
17
3060
153
N, M = map(int, input().split()) if N == 0: print(0) elif N >= M: print(M // 2) else: ret = N M -= N * 2 ret += M // 4 print(ret)
s087816030
p03795
u059684599
1582445296
Python
Python (3.4.3)
py
Runtime Error
17
2940
46
print(800*int(input())-200*(int(input())//15))
s767393533
p03795
u059684599
1582445221
Python
Python (3.4.3)
py
Runtime Error
17
2940
35
print(800*int(input())-200*(n//15))
s157573528
p03795
u217627525
1582017166
Python
Python (3.4.3)
py
Runtime Error
17
2940
39
n=int(input()) print(x*800-(x//15)*200)