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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s886379635 | p03959 | u436484848 | 1477277683 | Python | Python (3.4.3) | py | Runtime Error | 94 | 19136 | 518 | def read():
return [int(i) for i in input().split(" ")]
N = int(input())
T = read()
A = read()
tempT, tempA = 0, 0
for i in range(N):
if(T[i] > tempT):
tempT = L[i] = T[i]
L.append(tempT)
unknowL.append(0)
else:
unknowL.append(T[i])
L.append(0)
for i in range(N):
val = A.pop()
if(A[i] > tempA):
if(L[i] != 0 and L[i] != val):
print(0)
exit()
tempA = L[i] = val
unknowL[i] = 0
else:
unknowL[i] = min(unknowL[i], val)
P = 1
for i in unknowL:
if(i != 0):
P *= i
print(P % (10**9 +7))
|
s632844576 | p03959 | u436484848 | 1477277569 | Python | Python (3.4.3) | py | Runtime Error | 94 | 19776 | 514 | def read():
return [int(i) for i in input().split(" ")]
N = int(input())
T = read()
A = read()
tempT, tempA = 0, 0
for i in range(N):
if(T[i] > tempT):
tempT = L[i] = T[i]
L.append(tempT)
unknowL.append(0)
else:
unknowL.append(T[i])
L.append(0)
for i in range(N-1, -1, -1):
if(A[i] > tempA):
if(L[i] != 0 and L[i] != A[i]):
print(0)
exit()
tempA = L[i] = A[i]
unknowL[i] = 0
else:
unknowL[i] = min(unknowL[i], A[i])
P = 1
for i in unknowL:
if(i != 0):
P *= i
print(P % (10**9 +7)) |
s802630650 | p03959 | u335830383 | 1477277481 | Python | Python (2.7.6) | py | Runtime Error | 976 | 22928 | 882 | # -*- coding: utf-8 -*-
from sys import stdin
import numpy as np
n = stdin.readline()
n = n.strip().split(" ")
N = int(n[0])
n = stdin.readline()
n = n.strip().split(" ")
T = []
for t in n:
T.append(int(t))
T = np.array(T)
n = stdin.readline()
n = n.strip().split(" ")
A = []
for a in n:
A.append(int(a))
A = np.array(A)
arr = np.ones((len(A),))
res = 1
rest = np.zeros((len(A),))
if max(A) != max(T):
res = 0
else:
for t in range(T.shape[0]):
if t > 0 and T[t] == T[t-1] and t != T.shape[0]-1:
arr[t] = T[t]
elif t != T.shape[0]-1:
rest[t] = T[t]
for a in range(A.shape[0])[::-1]:
if rest[a]>1 and A[a]<rest[a]:
arr = np.zeros((len(A),))
break
elif a < A.shape[0]-1 and a != 0 and arr[a] != 1:
if A[a] > A[a+1]:
arr[a] = 1
elif A[a] < arr[a]:
arr[a] = A[a]
for j in arr:
res *= j
if res != 0:
res = res % ((10**9) + 7)
print int(res) |
s136808478 | p03959 | u647537044 | 1477277099 | Python | Python (3.4.3) | py | Runtime Error | 123 | 18496 | 439 | N = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
Z = []
for i in range(N):
Z.append(min(T[i],A[i]))
sum = 1
offset = []
if max(Z) < max(T(-1),A(0)):
print(0)
else:
for i in range(1,N-1):
if not (Z[i] > Z[i-1] or Z[i] > Z[i+1]):
offset.append(i)
for j in offset:
sum *= Z[j]
print(sum%(1000000000 + 7)) |
s867634992 | p03959 | u947823593 | 1477276717 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2696 | 1010 | import math as mt
import operator as op
def ncr(n, r):
r = min(r, n-r)
if r == 0: return 1
numer = reduce(op.mul, xrange(n, n-r, -1))
denom = reduce(op.mul, xrange(1, r+1))
return numer//denom
N = input()
T = map(lambda x:int(x), raw_input().split())
A = map(lambda x:int(x), raw_input().split())
check = [False for x in range(N)]
check[0] = True
check[N - 1] = True
ans = N - 2
n = max(T)
for i in range(1, len(T) - 1):
if T[i - 1] < T[i]:
global LastT = T[i]
check[i] = True
if A[i + 1] < A[i]:
global LastA = A[i]
check[i] = True
if max(T) != max(A):
print 0
else:
if (((N % (10 ** 9 + 7) - sum(check) % (10 ** 9 + 7)) % (10 ** 9 + 7)) ** 2) % (10 ** 9 + 7) == 0:
print 1
else:
print (((N % (10 ** 9 + 7) - sum(check) % (10 ** 9 + 7)) % (10 ** 9 + 7)) ** 2) % (10 ** 9 + 7)
#print ncr((n % (10 ** 9 + 7) - (N % (10 ** 9 + 7) - sum(check) % (10 ** 9 + 7))) % (10 ** 9 + 7), ((N - sum(check)) % (10 ** 9 + 7)))
|
s529634067 | p03959 | u107077660 | 1477276382 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 780 | N = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
h = [0 for i in range(N)]
if T[-1] != A[0]:
print(0)
exit()
else:
h[0] = T[0]
h[-1] = A[-1]
for i in range(1,N):
if T[i] > T[i-1]:
if T[i] < h[i]:
print(0)
exit()
else:
h[i] = T[i]
else:
if h[i] < 0:
h[i] = max(h[i],-T[i])
elif T[i] < h[i]:
print(0)
exit()
elif h[i] == 0:
h[i] = -T[i]
if A[-i-1] > A[-i]:
if A[-i-1] < h[-i-1]:
print(0)
exit()
exit()
h[-i-1] = A[-i-1]
else:
if h[-i-1] < 0:
h[-i-1] = max(h[-i-1],-A[-i-1])
elif A[-i-1] < h[-i-1]:
print(0)
exit()
elif h[-i-1] == 0:
h[-i-1] = -A[-i-1]
a = 1
for n in h:
if a > 10**9+7:
a %= 10**9+7
if n < -1:
a *= -n
print(a%(10**9+7))
|
s165033097 | p03959 | u098968285 | 1477276253 | Python | PyPy3 (2.4.0) | py | Runtime Error | 271 | 38640 | 654 | # def makelist(n, m):
# return [[0 for i in range(m)] for j in range(n)]
# n = int(input())
# a, b = map(int, input().split())
# s = input()
K, T = map(int, input().split())
hoge = list(map(int, input().split()))
a = [0]*T
for i in range(T):
a[i] = (hoge[i], i)
if T == 1:
print(K-1)
else:
a.sort()
a[-1] = (a[-1][0] - 1, a[-1][1])
pre = a[-1][1]
while True:
a.sort()
if a[-1][0] == 0:
print(0)
raise NameError('error')
break
elif a[-1][1] != pre:
a[-1] = (a[-1][0] - 1, a[-1][1])
pre = a[-1][1]
else:
if a[-2][0] == 0:
print(a[-1][1])
break
else:
a[-2] = (a[-2][0] - 1, a[-2][1])
pre = a[-2][1]
|
s180001285 | p03959 | u272028993 | 1477275845 | Python | Python (2.7.6) | py | Runtime Error | 163 | 14500 | 731 | mod=10**9+7
n=int(raw_input())
t=map(int,raw_input().split())
a=map(int,raw_input().split())
if t[n-1]!=a[0]:
print(0)
exit()
ans=1
for i in xrange(n):
if i==0 or i==n-1 or t[i]>t[i-1]:
if a[i]<t[i] and a[i]==a[i+1]:
print(0)
exit()
elif a[i]!=t[i] and a[i]!=a[i+1]:
print(0)
exit()
continue
else:
if t[i]==a[i]:
if a[i]==a[i+1]:
ans=(ans*t[i])%mod
elif t[i]>a[i]:
if a[i]==a[i+1]:
ans=(ans*a[i])%mod
elif a[i]>t[i]:
if a[i]==a[i+1]:
ans=(ans*t[i])%mod
else:
print(0)
exit()
print(ans%mod) |
s165223690 | p03959 | u343675824 | 1477274512 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 601 | N = int(input())
T = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [0] * N
h = 0
for i in range(N):
if h < T[i]:
B[i] = T[i] h = T[i]
h = 0
check = True
for i in range(N):
if h < A[N-i-1]:
if B[N-i-1] != 0 and B[N-i-1] != A[N-i-1]:
check = False
else:
B[N-i-1] = A[N-i-1]
h = A[N-i-1]
for i in range(N):
if B[i] == 0:
B[i] = min((T[i],A[i]))
else:
B[i] = 1
if check:
ans = 1
for i in range(N):
ans = (ans * B[i]) % (int(1e9 + 7))
print(ans)
else:
print(0)
|
s789272783 | p03959 | u729300713 | 1477274342 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 741 | import sys
n = input()
t = map(int, raw_input().split())
a = map(int, raw_input().split())
ans = 0
if max(t) != max(a):
print ans
sys.exit()
supermax = max(t)
flagt = 0
flaga = 0
for i in range(n):
if flagt = 0 and t[i] == supermax:
flagt = i
if flaga = 0 and a[n-1-i] == supermax:
flaga = n-1-i
if flagt > flaga:
print ans
sys.exit()
ans = 1
tmx = t[0]
amx = a[n-1]
if (n%2)==0:
loop = n/2-1
else:
loop = n/2
for i in range(loop):
if t[i+1] <= a[i+1]:
if t[i+1] == tmx:
ans *= t[i+1]
tmx = t[i+1]
if a[(n-1)-(i+1)] <= t[(n-1)-(i+1)]:
if a[(n-1)-(i+1)] == amx:
ans*= a[(n-1)-(i+1)]
amx = a[(n-1)-(i+1)]
ans %= 1000000007
print ans
|
s038375930 | p03959 | u422104747 | 1477273805 | Python | Python (3.4.3) | py | Runtime Error | 22 | 2940 | 351 | n=int(input())
l= list(map(int, input().split()))
r= list(map(int, input().split()))
l=[0]+l
r.append(0)
res=1
for i in range(n):
if( (l[i]<l[i+1]) or (r[i]>r[i+1]) ):
if( ( (l[i]<l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]!=r[i]) ):
res*=0
else:
res*=min(l[i],r[i])
print(res%1000000007) |
s534849683 | p03959 | u783676040 | 1477273188 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 816 | N=int(raw_input())
T=map(int,raw_input().split())
A=map(int,raw_input().split())
I,J=N-1,0
ans=1
for i in range(N):
H=min(T[i],A[i])
if i>0 and T[i-1]<T[i]:
H=1
if i+1 <N and A[i+1]<A[i]:
if T[i]!=A[i]:
ans=0
break
if i==N-1 and T[i]!=A[i]:
ans=0
break
if T[i] > A[i]
ans=0
break
if i+1 <N and A[i+1] <A[i]:
H=1
if i==0 and T[i]!=A[i]:
ans=0
break
if A[i] > T[i]
ans=0
break
if i==0:
H=1
if T[i] > A[i]:
ans =0
break
if i==N-1:
H=1
if A[i] > T[i]:
ans = 0
break
ans *= H
ans %= 1000000007
print ans
|
s250515393 | p03959 | u422104747 | 1477272636 | Python | Python (3.4.3) | py | Runtime Error | 88 | 18752 | 334 | n=int(input())
l= list(map(int, input().split()))
r= list(map(int, input().split()))
l=[0]+l
r.append(0)
res=1
max=1
if(max(l)!=max(r)):
res=0
for i in range(n):
if( (l[i]<l[i+1]) or (r[i]>r[i+1]) ):
if( ( (l[i]<l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]!=r[i]) ):
res*=0
else:
res*=min(l[i],r[i])
res%=1000000007
print(res) |
s744040548 | p03959 | u637175065 | 1477272495 | Python | Python (3.4.3) | py | Runtime Error | 709 | 21620 | 816 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7
def f():
n = int(input())
t = list(map(int, input().split()))
a = list(map(int, input().split()))
r = 0
if a[-1] > t[-1] or a[0] < t[0]:
return 0
for i in range(1,n):
if m > a[i]:
m = a[i]
if (t[i-1] < t[i] and t[i] > m) or t[i] < t[i-1]:
return 0
for i in range(n-2,-1,-1):
if (a[i+1] < a[i] and a[i] > t[i]) or a[i] < a[i+1]:
return 0
r = 1
for i in range(1,n-1):
if t[i] != t[i-1] or a[i] != a[i+1]:
continue
if t[i] < a[i]:
r = r * t[i] % mod
else:
r = r * a[i] % mod
return r
print(f())
|
s132811079 | p03960 | u532966492 | 1590247767 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1774 | 128092 | 773 | def main():
h, w = map(int, input().split())
grid = [list(input()) for _ in [0]*h]
grid = [[grid[j][i] for j in range(h)] for i in range(w)]
ans = 0
for i in range(w-1):
same = [[0]*(h+1) for _ in [0]*(w+1)]
for j in range(h-1, -1, -1):
for k in range(h-1, -1, -1):
same[j][k] += same[j+1][k+1]+(grid[i][-j-1] == grid[i+1][-k-1])
dp = [[10**10]*(h+1) for _ in [0]*(h+1)]
dp[0][0] = same[0][0]
for j in range(h+1):
for k in range(h+1):
if j != 0:
dp[j][k] = min(dp[j][k], dp[j-1][k]+same[j][k])
if k != 0:
dp[j][k] = min(dp[j][k], dp[j][k-1]+same[j][k])
ans += dp[h][h]
print(ans)
main()
|
s553371148 | p03960 | u102461423 | 1568510883 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 850 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import numpy as np
"""
それぞれの隣接2列ごとに、可能な摩擦の最小値を実現する → 小問題に分割。
"""
buffer = sys.stdin.buffer
H,W = map(int,buffer.readline().split())
C = np.frombuffer(buffer.read(),dtype='S1').reshape(H,-1)[:,:W].T
dp_1 = np.zeros((W-1,H+H+1,H+1),dtype=np.int64)
for r in range(H):
dp_1[:,r+2:r+H+2,r+1] = (C[:-1] == C[1:,r][:,None])
(C[:-1][:,:] == C[1:][:,r][])
INF = 10**18
# R-L+H -> min cost
dp = np.full((W-1,H+H+1),INF,dtype=np.int64)
dp[:,H] = 0
for n in range(1,H+H+1):
# n個目を置く
prev = dp
dp = np.full((W-1,H+H+1),INF,dtype=np.int64)
dp[:,1:] = np.minimum(dp[:,1:],prev[:,:-1])
dp[:,:-1] = np.minimum(dp[:,:-1],prev[:,1:])
dp += dp_1[:,:,n]
answer = dp[:,H].sum()
print(answer) |
s553160038 | p03960 | u777923818 | 1560476861 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 16276 | 881 | import numpy as np
def inpl(): return list(map(int, input().split()))
def min(a, b): return a if a < b else b
H, W = inpl()
C = np.zeros((H, W), dtype=np.uint8)
for h in range(H):
S = input()
for w in range(W):
C[w, h] = ord(S[w]) - 97
def calc_cost(L, R):
def count(l, r):
a = max(l-r, 0)
b = max(r-l, 0)
length = H-max(l, r)
return np.sum(C[L, a:a+length] == C[R, b:b+length])
DP = [[1000000]*(H+1) for _ in range(H+1)]
DP[0][0] = 0
for x in range(2*H+1):
for y in range(max(0, x-H), min(x+1, H+1)):
c = count(x-y, y)
if x-y < H:
DP[x-y+1][y] = min(DP[x-y+1][y], DP[x-y][y] + c)
if y < H:
DP[x-y][y+1] = min(DP[x-y][y+1], DP[x-y][y] + c)
return DP[-1][-1]
ans = 0
for i in range(W-1):
ans += calc_cost(i, i+1)
print(ans) |
s782251815 | p03960 | u024612773 | 1491676496 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2110 | 107608 | 768 | h,w=map(int,input().split())
if w > 3: exit(1)
b=[[] for i in range(w+2)]
b[0] = [' ']*h
b[w+1] = [' ']*h
for y in range(h):
r = list(input())
for x in range(1, w+1):
b[x].insert(0, r[x-1])
mem = {}
def rec(ls):
if sum(ls[1:-1]) == 0: return 0
if ''.join(map(chr,ls)) in mem: return mem[''.join(map(chr,ls))]
cost = 10**9
for x in range(1, w+1):
if ls[x] <= 0: continue
c = list(map(lambda a: a[0]==a[1], zip(b[x-1][h-ls[x-1]:], b[x][h-ls[x]:]))).count(True)
c += list(map(lambda a: a[0]==a[1], zip(b[x][h-ls[x]:], b[x+1][h-ls[x+1]:]))).count(True)
ls[x] -= 1
cost = min(cost, c + rec(ls))
ls[x] += 1
mem[''.join(map(chr,ls))] = cost
return cost
print(rec([len(c) for c in b])) |
s657995981 | p03960 | u257374434 | 1477281601 | Python | PyPy3 (2.4.0) | py | Runtime Error | 224 | 43120 | 1111 | H, W = list(map(int, input().split()))
X = [input() for _ in range(H)]
Y = list(map(list, zip(*X)))
def get(A, B):
cost = [[0 for _ in range(H + 2)] for _ in range(H + 2)]
def calc(A, B, a_n, b_n):
if a_n >= H or b_n >= H:
return 0
if (a_n, b_n) in cost:
return cost[(a_n, b_n)]
def set_cost(A, B, a_n, b_n):
start = max(a_n, b_n)
ans = 0
for i in range(start, H):
if A[i - a_n] == B[i - b_n]:
ans += 1
cost[(a_n + H - 1 - i, b_n + H - 1 - i)] = ans #cache
for i in range(H):
set_cost(A,B,0,i)
set_cost(A,B,i,0)
dp = [[999999999999999 for _ in range(H + 2)] for _ in range(H + 2)]
dp[0][0] = 0
for i in range(H + 1):
for j in range(H + 1):
dp[i + 1][j] = min(dp[i][j] + calc(A, B, i, j), dp[i + 1][j])
dp[i][j + 1] = min(dp[i][j] + calc(A, B, i, j), dp[i][j + 1])
# print(dp)
return dp[H][H]
ans = 0
for i in range(W - 1):
tmp = get(Y[i], Y[i + 1])
ans += tmp
# print(tmp)
print(ans)
|
s857562682 | p03960 | u821849577 | 1477281487 | Python | PyPy2 (5.6.0) | py | Runtime Error | 44 | 9200 | 2018 | class Bit:
def __init__(self, n):
sz = 1
while n >= sz:
sz *= 2
self.size = sz
self.data = [0]*sz
def sum(self, i):
assert i > 0
s = 0
while i > 0:
s += self.data[i]
i -= i & -i
return s
def add(self, i, x):
assert i > 0
while i < self.size:
self.data[i] += x
i += i & -i
import bisect
N = int(raw_input())
a = [int(x)-1 for x in raw_input().split()]
weight = [1] * N
M = 10**9+7
def factorial(n):
acc = 1
for i in xrange(1, 1 + n):
acc = (acc * i) % M
return acc
def inv(n):
return pow(n, M-2, M)
for i in xrange(N-1):
weight[N-2-i] = (weight[N-1-i] * (i+1)) % M
missing = list(set(xrange(N)) - set(a))
missing.sort()
n_missing = len(missing)
sum_missing = sum(missing)
avg_missing = sum_missing * inv(n_missing)
n_present = N - n_missing
n_rows = factorial(n_missing)
acc = 0
i_missing = 0
i_present = 0
missing_lt_tot = 0
#present_values = []
present_values_bit = Bit(N+5)
inv_n_missing = inv(n_missing)
inv_2 = inv(2)
for i, (w, x) in enumerate(zip(weight, a)):
if x == -1:
ai = avg_missing
bi = (i_missing * inv_2 + i_present - missing_lt_tot * inv_n_missing) % M
i_missing += 1
else:
ai = x
#bi = sum(1 for present_value in present_values if present_value < x)
bi = present_values_bit.sum(x + 1)
#present_values.append(x)
present_values_bit.add(x + 2, 1)
'''
missing_lt = 0
for j in missing:
if j < a[i]:
missing_lt += 1
'''
missing_lt = bisect.bisect(missing, a[i])
missing_lt_tot += missing_lt
#print '@', missing_lt, n_missing, i_missing, n_rows
bi += missing_lt * inv_n_missing * i_missing
bi %= M
i_present += 1
#print x, (ai * n_rows) % M, (bi * n_rows) % M, w
acc = (acc + (((ai - bi) * n_rows) % M) * w) % M
print (acc + n_rows) % M
|
s006374535 | p03960 | u386131832 | 1477278011 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 361 | import sys
n=int(input())
t=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
a_max=max(a)
t_max=max(t)
if a_max != t_max(t):
print(0)
sys.exit()
i=0
sum=1
while t[i]!=t_max:
if t[i]==t[i+1]:
sum*=t[i]
j=len(a)-1
while a[j]!=a_max:
if a[j]==a[j-1]:
sum*=a[j]
sum=sum*(a_max**(n-(i+j+1)))%((1e+9)+7)
print(sum) |
s767549970 | p03960 | u986399983 | 1477277990 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2696 | 286 | h, w = map(int, raw_input().split())
a = []
for i in range(h):
a[i] = raw_input().split()
ans = 0
for i in range(h):
count = 0
for j in range(h-i):
if a[j][1] == a[j+i][0]:
count += 1
if a[j][1] == a[j+i][2]:
count += 1
print ans |
s201785331 | p03961 | u535803878 | 1596088082 | Python | PyPy3 (7.3.0) | py | Runtime Error | 498 | 222740 | 1591 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
M = 10**9+7
n = int(input())
p = list(map(int, input().split()))
g1 = [None]*(n+10)
v = 1
g1[0] = 1
for i in range(1,len(g1)):
v *= i
v %= M
g1[i] = v
def init(bit, values):
for i,v in enumerate(values):
add(bit,i+1,v)
#a1 ~ aiまでの和 O(logn)
def query(bit,i):
res = 0
while i > 0:
res += bit[i]
i -= i&(-i)
return res
#ai += x(logN)
def add(bit,i,x):
if i==0:
raise RuntimeError
while i <= len(bit)-1:
bit[i] += x
i += i&(-i)
return
index = [i for i,num in enumerate(p) if num==0]
used = [False]*n
for i in range(n):
if p[i]>0:
used[p[i]-1] = True
nl = []
for i in range(n):
if not used[i]:
nl.append(i+1)
nl.sort()
scores = [0]*(n+1) # scores[i]: nlのうちiより大きいものの個数
v = len(nl)
cur = 0
for i in range(1,n+1):
# if nl and cur<len(nl) and nl[cur]<i:
if nl and nl[cur]<i:
cur += 1
v -= 1
scores[i] = v
ans = 0
bit = [0]*(n+1)
s = set(index)
val = 0
pp = len(index) # 欠損の個数
ss = sum(nl)
num = 0
inv2 = pow(2, M-2, M)
for i in range(n):
if i in s:
ans += (g1[pp-1] * (ss - pp - val - pp*(num)*inv2)) * g1[n-i-1]
num += 1
else:
ans += (g1[pp] * (p[i]-query(bit, p[i])-1) - g1[pp-1]*num*(len(nl)-scores[p[i]])) * g1[n-i-1]
add(bit, p[i], 1)
val += scores[p[i]]
ans %= M
# print(ans, val)
print((ans + g1[pp])%M) |
s939673938 | p03961 | u535803878 | 1596087386 | Python | PyPy3 (7.3.0) | py | Runtime Error | 464 | 222440 | 1549 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
M = 10**9+7
n = int(input())
p = list(map(int, input().split()))
g1 = [None]*(n+10)
v = 1
g1[0] = 1
for i in range(1,len(g1)):
v *= i
v %= M
g1[i] = v
def init(bit, values):
for i,v in enumerate(values):
add(bit,i+1,v)
#a1 ~ aiまでの和 O(logn)
def query(bit,i):
res = 0
while i > 0:
res += bit[i]
i -= i&(-i)
return res
#ai += x(logN)
def add(bit,i,x):
if i==0:
raise RuntimeError
while i <= len(bit)-1:
bit[i] += x
i += i&(-i)
return
index = [i for i,num in enumerate(p) if num==0]
used = [False]*n
for i in range(n):
if p[i]>0:
used[p[i]-1] = True
nl = []
for i in range(n):
if not used[i]:
nl.append(i+1)
nl.sort()
scores = [0]*(n+1) # scores[i]: nlのうちiより大きいものの個数
v = len(nl)
cur = 0
for i in range(1,n+1):
if nl and nl[cur]<i:
cur += 1
v -= 1
scores[i] = v
ans = 0
bit = [0]*(n+1)
s = set(index)
val = 0
pp = len(index) # 欠損の個数
ss = sum(nl)
num = 0
inv2 = pow(2, M-2, M)
for i in range(n):
if i in s:
ans += (g1[pp-1] * (ss - pp - val - pp*(num)*inv2)) * g1[n-i-1]
num += 1
else:
ans += (g1[pp] * (p[i]-query(bit, p[i])-1) - g1[pp-1]*num*(len(nl)-scores[p[i]])) * g1[n-i-1]
add(bit, p[i], 1)
val += scores[p[i]]
ans %= M
# print(ans, val)
print((ans + g1[pp])%M) |
s861672639 | p03961 | u535803878 | 1596087324 | Python | PyPy3 (7.3.0) | py | Runtime Error | 175 | 133804 | 1537 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(input())
p = list(map(int, input().split()))
g1 = [None]*(n+10)
v = 1
g1[0] = 1
for i in range(1,len(g1)):
v *= i
v %= M
g1[i] = v
def init(bit, values):
for i,v in enumerate(values):
add(bit,i+1,v)
#a1 ~ aiまでの和 O(logn)
def query(bit,i):
res = 0
while i > 0:
res += bit[i]
i -= i&(-i)
return res
#ai += x(logN)
def add(bit,i,x):
if i==0:
raise RuntimeError
while i <= len(bit)-1:
bit[i] += x
i += i&(-i)
return
index = [i for i,num in enumerate(p) if num==0]
used = [False]*n
for i in range(n):
if p[i]>0:
used[p[i]-1] = True
nl = []
for i in range(n):
if not used[i]:
nl.append(i+1)
nl.sort()
scores = [0]*(n+1) # scores[i]: nlのうちiより大きいものの個数
v = len(nl)
cur = 0
for i in range(1,n+1):
if nl and nl[cur]<i:
cur += 1
v -= 1
scores[i] = v
ans = 0
bit = [0]*(n+1)
s = set(index)
val = 0
pp = len(index) # 欠損の個数
ss = sum(nl)
num = 0
inv2 = pow(2, M-2, M)
for i in range(n):
if i in s:
ans += (g1[pp-1] * (ss - pp - val - pp*(num)*inv2)) * g1[n-i-1]
num += 1
else:
ans += (g1[pp] * (p[i]-query(bit, p[i])-1) - g1[pp-1]*num*(len(nl)-scores[p[i]])) * g1[n-i-1]
add(bit, p[i], 1)
val += scores[p[i]]
ans %= M
# print(ans, val)
print((ans + g1[pp])%M) |
s300318023 | p03962 | u401183062 | 1601228815 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8940 | 236 | def iroha():
a, b, c = map(int, input().split())
if a == b and b == c and a == c:
print(1)
elif a != b and b != c and a != c:
print(3)
elif else:
print(2)
if __name__ == "__main__":
iroha()
|
s790665650 | p03962 | u401183062 | 1601228357 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8908 | 140 | a, b, c = map(int, input().split())
if a == b == c:
print(1)
elif a != b != c:
print(3)
else:
print(2)
|
s924618339 | p03962 | u174040991 | 1601070561 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9092 | 79 | n,k = map(int, input().split())
p=k
for i in range(n-1):
p *= k-1
print(p)
|
s589811887 | p03962 | u231198419 | 1599336400 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8936 | 39 | a=set(int,input().split())
print(len(a) |
s789495834 | p03962 | u306412379 | 1598995605 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9096 | 63 | N, K = map(int, input().split())
print(K * ((K - 1) **(N - 1))) |
s532790974 | p03962 | u808569469 | 1598664125 | Python | Python (3.8.2) | py | Runtime Error | 19 | 8900 | 67 | a, b, c = map(int, input().split())
m = set([a, b, c])
print(len(m) |
s931099328 | p03962 | u808569469 | 1598664097 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8892 | 70 | a, b, c = map(int, input().split())
m = set([a, b, c]))
print(len(m) |
s722146602 | p03962 | u834301346 | 1598023259 | Python | Python (3.8.2) | py | Runtime Error | 18 | 9028 | 66 | a, b = list(map(int, input().split(' ')))
print(b*pow(b-1, a-1))
|
s289576398 | p03962 | u426649993 | 1597856506 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8868 | 6 | 3 3 33 |
s168166561 | p03962 | u774163366 | 1597756657 | Python | PyPy3 (7.3.0) | py | Runtime Error | 112 | 74708 | 229 | data = [int(i) for i in input().split()]
count = 0
for i in range(len(data)):
for j in range(i+1, len(data)):
if (data[i] == data[j]):
count += 1
del data[j]
else:
continue
del data[i]
print(count) |
s673965203 | p03962 | u612635771 | 1597530736 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9024 | 43 | s = list(input().split())
print(len(set(s)) |
s406656040 | p03962 | u612635771 | 1597530683 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8744 | 35 | s = list(input())
print(len(set(s)) |
s628852019 | p03962 | u612635771 | 1597530658 | Python | Python (3.8.2) | py | Runtime Error | 20 | 8880 | 43 | s = list(input().split())
print(len(set(s)) |
s726681050 | p03962 | u468972478 | 1597511150 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8916 | 49 | l = set(list(map, input().split()))
print(len(l)) |
s295728021 | p03962 | u895918162 | 1597070817 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8960 | 245 | sample = input()
sample_list = sample.split(" ")
count = 0
flag = 0
for i in range(len(sample_list)):
for j in range(1, i):
if sample_list[i] == sample_list[j]:
flag = 1
if flag == 0:
count += 1
flag = 0
return count
|
s165045535 | p03962 | u895918162 | 1597070754 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9040 | 226 | sample = input()
sample_list = sample.split(" ")
count = 0
flag = 0
for i in range(len(sample_list)):
for j in range(1, i):
if L1[i] == L1[j]:
flag = 1
if flag == 0:
count += 1
flag = 0
return count |
s813685070 | p03962 | u250662864 | 1597064264 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9100 | 100 | j = int(input())
x = j.split()
y = []
for i in x:
if(i not in y):
y.append(i)
print(len(y))
|
s223812189 | p03962 | u250662864 | 1597064119 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9024 | 133 | a = int(input())
b = int(input())
c = int(input())
x = [a, b, c]
y = []
for i in x:
if(i not in y):
y.append(i)
print(len(y))
|
s515203069 | p03962 | u250662864 | 1597064013 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8940 | 98 | a = int(input())
b = int(input())
c = int(input())
s = {}
s.add(a)
s.add(b)
s.add(c)
print len(s)
|
s885127388 | p03962 | u250662864 | 1597063943 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8956 | 78 |
a = int(input())
b = int(input())
c = int(input())
s = {a, b, c}
print len(s) |
s444784845 | p03962 | u939790872 | 1596780390 | Python | Python (3.8.2) | py | Runtime Error | 20 | 8968 | 54 | n, k = map(int, input().split())
print(k*(k-1)**(n-1)) |
s034012326 | p03962 | u442948527 | 1596683553 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8964 | 44 | print(len(set([input() for i in range(3)]))) |
s476241767 | p03962 | u714104087 | 1596573035 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 74716 | 50 | abc = list(input().split())
print(lens(set(abc))) |
s051186415 | p03962 | u876742094 | 1596477026 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9080 | 116 | abc=sorted(list(map(int,input().split())))
if a==c:
print(1)
elif a==b or b==c:
print(2)
else:
print(3)
|
s903598249 | p03962 | u980503157 | 1596415868 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9172 | 157 | a = int(input())
b = int(input())
c = int(input())
count = 0
if a != b:
count += 1
if b != c:
count += 1
if a != c:
count += 1
print(int(count/2)) |
s595922270 | p03962 | u684743124 | 1595400134 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9088 | 41 | s=set(int(input().split()))
print(len(s)) |
s533561095 | p03962 | u860546679 | 1595280852 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8988 | 129 | a=list(map(int,input().split())).sort()
if a[0]==a[2]:
print(1)
elif (a[0]==a[1]) or (a[1]==a[2]):
print(2)
else:
print(3)
|
s266649282 | p03962 | u860546679 | 1595280807 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8936 | 127 | a=sort(list(map(int,input().split())))
if a[0]==a[2]:
print(1)
elif (a[0]==a[1]) or (a[1]==a[2]):
print(2)
else:
print(3) |
s821287550 | p03962 | u520018621 | 1594614104 | Python | PyPy3 (7.3.0) | py | Runtime Error | 87 | 74720 | 39 | a, b, c = getNM()
print(len({a, b, c})) |
s953049083 | p03962 | u316603606 | 1594412647 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9112 | 199 | a,b,c = (int(x) for x in input().split())
if a == b:
if a == c:
print (1)
else:
pritn (2)
else:
if a == c:
print (2)
else:
if b == c:
print (2)
else:
print (3) |
s868502474 | p03962 | u316603606 | 1594412440 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8924 | 157 | a,b,c = (int(x) for x in input().split())
if a == b:
if a == c:
print (1)
else:
pritn (2)
else:
if a == c:
print (2)
else:
print (3)
|
s200112065 | p03962 | u969848070 | 1594172518 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9088 | 46 | a = list(map(int, input()))
print(len(set(a))) |
s767622769 | p03962 | u215376033 | 1594067553 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8980 | 185 | a = int(input())
b = int(input())
c = int(input())
if a==b and a==c:
print("1")
elif a==b:
print("2")
elif a==c:
print("2")
elif b==c:
print("2")
else:
print("3") |
s129377336 | p03962 | u215376033 | 1594067437 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9052 | 175 | a = int(input())
b = int(input())
c = int(input())
if a==b and a==c:
print(1)
elif a==b:
print(2)
elif a==c:
print(2)
elif b==c:
print(2)
else:
print(3)
|
s329341598 | p03962 | u215376033 | 1594067349 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9160 | 167 | a = int(input())
b = int(input())
c = int(input())
if a == b and a==c:
print(1)
elif a==b:
print(2)
elif a==c:
print(2)
elif b==c:
print(2)
else:
print(3)
|
s321232811 | p03962 | u215376033 | 1594067320 | Python | Python (3.8.2) | py | Runtime Error | 19 | 9032 | 167 | a = int(input())
b = int(input())
c = int(input())
if a == b and a==c:
print(1)
elif a==b:
print(2)
elif a==c:
print(2)
elif b==c:
print(2)
else:
print(1)
|
s742173430 | p03962 | u215376033 | 1594067243 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8952 | 166 | a = int(input())
b = int(input())
c = int(input())
if a == b && a==c:
print(1)
elif a==b:
print(2)
elif a==c:
print(2)
elif b==c:
print(2)
else:
print(1)
|
s680992259 | p03962 | u047931063 | 1593910092 | Python | PyPy3 (7.3.0) | py | Runtime Error | 99 | 74676 | 59 | A = list(map(int,input().split()))
B = map(A)
print(len(B)) |
s867050968 | p03962 | u858670323 | 1593538667 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9152 | 39 | a = set(map(int,input()))
print(len(a)) |
s799515345 | p03962 | u679817762 | 1593371731 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8872 | 231 | #入力
lst = input().split()
#整数値化
for i in range(len(lst)):
lst[i] = int(lst[i])
#ソート
lst.sort()
#出力
if lst[0] == lst[2]
print(3)
elif lst[0] == lst[1] or lst[1] == lst[2]:
print(2)
else:
print(1) |
s751415062 | p03962 | u679817762 | 1593371551 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8964 | 232 | #入力
lst = input().spilit()
#整数値化
for i in range(len(lst)):
lst[i] = int(lst[i])
#ソート
lst.sort()
#出力
if lst[0] == lst[2]
print(3)
elif lst[0] == lst[1] or lst[1] == lst[2]:
print(2)
else:
print(1) |
s300003209 | p03962 | u656120612 | 1592978145 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8820 | 174 | a,b,c=map(int,input().split())
if a=b and b=c:
print(1)
elif a=b and a!=c:
print(2)
elif a!=b and b=c:
print(2)
elif a=c and a!=b:
print(2)
else:
print(3) |
s013147750 | p03962 | u656120612 | 1592978035 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9020 | 150 | a,b,c=map(int,input().split())
if a=b=c:
print(1)
elif a=b!=c:
print(2)
elif a!=b=c:
print(2)
elif a=c!=b:
print(2)
else:
print(3) |
s555800231 | p03962 | u656120612 | 1592977678 | Python | Python (3.8.2) | py | Runtime Error | 29 | 8896 | 134 | a=input().split()
a.sort()
cnt=0
while len(s)>0:
i=a.count(a.pop(0))
for j in range(i):
a.pop(0)
cnt+=1
print(cnt) |
s540205160 | p03962 | u333591669 | 1592884300 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9128 | 187 | def color():
a=int(input())
b=int(input())
c=int(input())
if a==c==b:
print(1)
elif a==b or b==c or a==c:
print(2)
else:
print(3)
color()
|
s018555880 | p03962 | u578580291 | 1592757763 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8900 | 195 | def paint():
a = int(input())
b = int(input())
c = int(input())
count = 1
if a != b:
count += 1
if a != c and b != c:
count += 1
print(count)
paint() |
s463827577 | p03962 | u578580291 | 1592757484 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9168 | 201 | def paint():
a = int(input())
b = int(input())
c = int(input())
count = 1
if a != b:
count += 1
if a != c and b != c:
count += 1
print(count)
paint() |
s056048641 | p03962 | u578580291 | 1592757206 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8992 | 219 | def paint():
a = int(input())
b = int(input())
c = int(input())
count = 3
if a == b:
count -= 1
if a == c:
count -= 1
if b == c:
count -= 1
print(count)
paint() |
s929040388 | p03962 | u583276018 | 1591580650 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 48 | print(ren(set(list(map(int, input().split()))))
|
s603200144 | p03962 | u987170100 | 1591324531 | Python | Python (3.4.3) | py | Runtime Error | 36 | 5048 | 293 | import math
from fractions import Fraction
N = int(input())
a, b = map(int, input().split())
ret_a = a
ret_b = b
for _ in range(1, N):
a, b = map(int, input().split())
x = math.ceil(max(Fraction(ret_a, a), Fraction(ret_b, b)))
ret_a = a * x
ret_b = b * x
print(ret_a + ret_b)
|
s313187637 | p03962 | u680503348 | 1591206222 | Python | Python (3.4.3) | py | Runtime Error | 33 | 5076 | 610 | # For taking integer inputs.
import math
from decimal import Decimal
from itertools import permutations
def inp():
return(int(input()))
# For taking List inputs.
def inlist():
return(list(map(int, input().split())))
# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
s = input()
return(list(s[:len(s)]))
# For taking space seperated integer variable inputs.
def invr():
return(map(int, input().split()))
n, k = invr()
c = k * (n-1) * (k-1)
print(c)
|
s646536927 | p03962 | u680503348 | 1591206100 | Python | Python (3.4.3) | py | Runtime Error | 35 | 5076 | 618 | # For taking integer inputs.
import math
from decimal import Decimal
from itertools import permutations
def inp():
return(int(input()))
# For taking List inputs.
def inlist():
return(list(map(int, input().split())))
# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
s = input()
return(list(s[:len(s)]))
# For taking space seperated integer variable inputs.
def invr():
return(map(int, input().split()))
n , k = invr()
c = k * (k-1)*(n-1)
print(c) |
s545680162 | p03962 | u680503348 | 1591206040 | Python | Python (3.4.3) | py | Runtime Error | 33 | 5076 | 609 | # For taking integer inputs.
import math
from decimal import Decimal
from itertools import permutations
def inp():
return(int(input()))
# For taking List inputs.
def inlist():
return(list(map(int, input().split())))
# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
s = input()
return(list(s[:len(s)]))
# For taking space seperated integer variable inputs.
def invr():
return(map(int, input().split()))
n , k = invr()
print(k *(k-1)*n-1) |
s442461619 | p03962 | u778348725 | 1590938898 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 229 | #おととい買ったペンキ
a = int(input())
#きのう買ったペンキ
b = int(input())
#今日買ったペンキ
c= int(input())
penki_list = [a,b,c]
#print(penki_list)
#print(set(penki_list))
print(len(set(penki_list)))
|
s205891321 | p03962 | u405256066 | 1590369748 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 299 | from sys import stdin
import math
N = int(stdin.readline().rstrip())
t,a = [int(x) for x in stdin.readline().rstrip().split()]
for _ in range(N-1):
T,A = [int(x) for x in stdin.readline().rstrip().split()]
n = int(max(math.ceil(t/T),math.ceil(a/A)))
t = n*T
a = n*A
print(t+a) |
s907142806 | p03962 | u496148227 | 1590155932 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 54 | N, K = map(int, input().split())
print(K*(K-1)**(N-1)) |
s120790730 | p03962 | u895040371 | 1590116273 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 44 | a = list[input().split()]
print(len(set(a))) |
s281488627 | p03962 | u957198490 | 1589152832 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 54 | a = list(map(int,inptu().split()))
print(len(set(a)))
|
s869321831 | p03962 | u989306199 | 1589091405 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 540 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
set<int> t;
rep(i,3){
int a;cin>>a;
t.insert(a);
}
cout<<t.size()<<endl;
} |
s407318752 | p03962 | u857673087 | 1588818649 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 49 | abc = lits(input().split())
print(len(set(abc))) |
s386170021 | p03962 | u383450070 | 1588779228 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 92 | lst(list(map(str,input().split())))
a=set()
for i in range(3):
a.add(lst[i])
print(len(a)) |
s550018107 | p03962 | u246661425 | 1588652685 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 60 | a, b, c = map(int, input().split())
print(len(set(a, b, c))) |
s862540453 | p03962 | u366886346 | 1588495184 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 111 | a,b,c=input().split()
d=list[a,b,c]
for i in range(2):
if d.count(d[i])!=1:
del d[i]
print(len(d))
|
s414947179 | p03962 | u366886346 | 1588495129 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 120 | a,b,c=map(int,input().split())
d=list[a,b,c]
for i in range(2):
if d.count(d[i])!=1:
del d[i]
print(len(d))
|
s847589779 | p03962 | u272522520 | 1588182037 | Python | Python (3.4.3) | py | Runtime Error | 16 | 2940 | 51 | s = {input() for i in range(3)}
N = len(s)
print(N) |
s163426428 | p03962 | u830162518 | 1587940640 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 126 | a,b.c=map(int,input().split())
L=[a,b,c]
L.sort()
if L[0]==L[2]:
print(1)
elif L[0]<L[1]<L[2]:
print(3)
else:
print(2) |
s727300259 | p03962 | u830162518 | 1587940556 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 130 | a,b.c=map(int,input().split())
L=list[a,b,c]
L.sort()
if L[0]==L[2]:
print(1)
elif L[0]<L[1]<L[2]:
print(3)
else:
print(2) |
s490807290 | p03962 | u423665486 | 1587855887 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38384 | 114 | def resolve():
n, k = map(int, input().split())
if n == 1:
print(k)
else:
print(k*((k-1)**(n-1)))
resolve() |
s776513929 | p03962 | u115877451 | 1587763539 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 53 | a,b,c=map(int,input().split())
print(len(set(a,b,c))) |
s394257250 | p03962 | u115877451 | 1587763158 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 124 | a,b,c=map(int,input().split())
n=[a,b,c]
if a!=b!=c:
print(3)
elif a=b!=c or a!=b=c or b=a!=c:
print(2)
else:
print(1) |
s668914461 | p03962 | u342456871 | 1587694635 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 163 | n=int(input())
tv=1
av=1
for i in range(n):
ti,ai=map(int,input().split())
m=max(int((tv-1)//ti)+1,int((av-1)//ai)+1)
tv=m*ti
av=m*ai
print(tv+av)
|
s890299290 | p03962 | u581603131 | 1587656270 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 53 | list = set(map(int, input().split()))
print(len(set)) |
s752034501 | p03962 | u275212209 | 1587526100 | Python | PyPy3 (2.4.0) | py | Runtime Error | 183 | 38640 | 104 | if __name__ == '__main__':
a = []
for i in range(3):
a.append(int(input()))
print(len(set(a))) |
s539838663 | p03962 | u275212209 | 1587526028 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 104 | if __name__ == '__main__':
a = []
for i in range(3):
a.append(int(input()))
print(len(set(a))) |
s096059708 | p03962 | u810978770 | 1587518763 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 52 | a = map(int ,input().split())
print(len(Counter(a))) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.