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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s739630404 | p03795 | u873904588 | 1488457026 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 81 | N,M = map(int,input().split())
num_c = N*2 + M
num_Scc = num_c//4
print(num_Scc)
|
s397982759 | p03795 | u873904588 | 1488455827 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 83 | a = int(input())
b,c=map(int,input().split())
s=input()
print(str(a+b+c) + " " + s) |
s357505617 | p03795 | u692632484 | 1488145177 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 50 | N=int(input())
ans=N*800-(N-N%15)*200/15
print ans |
s659233432 | p03795 | u692632484 | 1488145103 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 37 | N=input()
print N*800-(N-N%15)*200/15 |
s119066982 | p03795 | u677421794 | 1488093190 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2696 | 769 | # -*- coding: utf-8 -*-
N = input()
S = raw_input()
Ans = ''
StartString = ['SS','SW','WS','WW']
CheckFlag = 0
for i in range(4):
Ans += StartString[i]
for j in range(N-1):
if(Ans[j+1]=='S' and S[j+1]=='o'):
Ans += Ans[j]
elif(Ans[j+1]=='S' and S[j+1]=='x'):
if(Ans[j]=='S'):
Ans += 'W'
else:
Ans += 'S'
elif(Ans[j+1]=='W' and S[j+1]=='o'):
if(Ans[j]=='S'):
Ans += 'W'
else:
Ans += 'S'
elif(Ans[j+1]=='W' and S[j+1]=='x'):
Ans += Ans[j]
if(Ans[0]==Ans[N]):
print(Ans[:N])
CheckFlag = 1
break
else:
Ans = ''
if(CheckFlag == 0):
print('-1')
|
s544885834 | p03795 | u870040448 | 1487977329 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 99 | N, M = map(int, raw_input().split())
if M - 2*N < 0:
print N
else:
print N + int((M - 2*N)/4)
|
s565547798 | p03795 | u762603420 | 1487898147 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 2620 | # -*- coding: utf-8 -*-
def check(s, ans):
if len(s) != len(ans):
return False;
for i in range(0, len(s)):
pre = i - 1
next = i + 1
if i == 0:
pre = len(s) - 1
if i == len(s) - 1:
next = 0
if ans[i] == "S":
if s[i] == "o":
if ans[pre] != ans[next]:
return False
else:
if ans[pre] == ans[next]:
return False
else:
if s[i] == "x":
if ans[pre] != ans[next]:
return False
else:
if ans[pre] == ans[next]:
return False
return True
def getAns(s, ans, idx, n):
if idx == n - 1:
if check(a, ans):
return ans
else:
return []
if idx == 0:
if ans[idx] == "S":
if s[idx] == "o":
ans[n - 1] = ans[1]
else:
if ans[1] == "S":
ans[n - 1] = "W"
else:
ans[n - 1] = "S"
else:
if s[idx] == "x":
ans[n - 1] = ans[1]
else:
if ans[1] == "S":
ans[n - 1] = "W"
else:
ans[n - 1] = "S"
return getAns(s, ans, idx + 1, n)
pre = idx - 1
next = idx + 1
# 羊
if ans[idx] == "S":
if s[idx] == "o":
ans[next] = ans[pre]
else:
if ans[pre] == "S":
ans[next] = "W"
else:
ans[next] = "S"
# 狼
else:
if s[idx] == "x":
ans[next] = ans[pre]
else:
if ans[pre] == "S":
ans[next] = "W"
else:
ans[next] = "S"
return getAns(s, ans, idx + 1, n)
def arrayToString(arry):
s = ""
for i in range(0, len(arry)):
s+= arry[i]
return s
n = int(input())
a = input()
s = [a[i] for i in range(0, len(a))]
ans = ["S" for i in range(0, len(a))]
ans1 = ans[:]
ans1 = getAns(s, ans1, 0, n)
if len(ans1) != 0:
print(arrayToString(ans1))
quit()
ans2 = ans[:]
ans2[0] = "W"
ans2 = getAns(s, ans2, 0, n)
if len(ans2) != 0:
print(arrayToString(ans2))
quit()
ans3 = ans[:]
ans3[1] = "W"
ans3 = getAns(s, ans3, 0, n)
if len(ans3) != 0:
print(arrayToString(ans3))
quit()
ans4 = ans[:]
ans4[0] = "W"
ans4[1] = "W"
ans4 = getAns(s, ans4, 0, n)
if len(ans4) != 0:
print(arrayToString(ans4))
quit()
print("-1")
|
s815128702 | p03795 | u590905793 | 1487824419 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 22 | n = int(row())
print n |
s421177819 | p03795 | u805887876 | 1487790541 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 58 | n = raw_input()
x = n * 800
y = (n / 15) * 200
print x-y |
s238895623 | p03795 | u805887876 | 1487790493 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 58 | n = raw_input()
x = n * 800
y = (n % 15) * 200
print x-y |
s320757289 | p03795 | u048472001 | 1487656484 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 106 | n, m = map(int, input() .split())
if n >= m//2:
ans = m//2
else:
ans = n + (m - 2 * n) // 4
print(ans) |
s228996754 | p03795 | u622011073 | 1487488113 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 53 | n,m=map(int,input().split());print((min(2*n,m)+m)//4) |
s726685494 | p03795 | u614459338 | 1487475513 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3576 | 4939 | N = int(input())
s = input()
def lier_check(aa):
lier = 1
if aa==0:
mae=N-1
else:
mae=aa-1
if aa == N-1:
ato = 0
else:
ato = aa+1
if ans[aa] == 'S' and s[aa] == 'o':
if ans[mae] != ans[ato]:
lier = -1
if ans[aa] == 'S' and s[aa] == 'x':
if ans[mae] == ans[ato]:
lier = -1
if ans[aa] == 'W' and s[aa] == 'o':
if ans[mae] == ans[ato]:
lier = -1
if ans[aa] == 'W' and s[aa] == 'x':
if ans[mae] != ans[ato]:
lier = -1
return(lier)
ans = ['X']*N
ans[0] = 'S'
if s[0] == 'o':
ans[N-1] = 'S'
ans[1] = 'S'
else:
ans[N-1] = 'W'
ans[1] = 'S'
for aa in range(1,N-1):
if ans[aa] == 'S' and s[aa] == 'o' and ans[aa-1]=='S':
ans[aa+1] = 'S'
elif ans[aa] == 'S' and s[aa] == 'o' and ans[aa-1]=='W':
ans[aa+1] = 'W'
elif ans[aa] == 'S' and s[aa] == 'x' and ans[aa-1]=='S':
ans[aa+1] = 'W'
elif ans[aa] == 'S' and s[aa] == 'x' and ans[aa-1]=='W':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'o' and ans[aa-1]=='S':
ans[aa+1] = 'W'
elif ans[aa] == 'W' and s[aa] == 'o' and ans[aa-1]=='W':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'x' and ans[aa-1]=='S':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'x' and ans[aa-1]=='W':
ans[aa+1] = 'W'
kekka = 1
for aa in range(0,len(ans)):
if(lier_check(aa) == -1):
kekka = -1
break
if kekka == 1:
print("".join(ans))
########
ans = ['X']*N
ans[0] = 'S'
if s[0] == 'o':
ans[N-1] = 'W'
ans[1] = 'W'
else:
ans[N-1] = 'W'
ans[1] = 'S'
for aa in range(1,N-1):
if ans[aa] == 'S' and s[aa] == 'o' and ans[aa-1]=='S':
ans[aa+1] = 'S'
elif ans[aa] == 'S' and s[aa] == 'o' and ans[aa-1]=='W':
ans[aa+1] = 'W'
elif ans[aa] == 'S' and s[aa] == 'x' and ans[aa-1]=='S':
ans[aa+1] = 'W'
elif ans[aa] == 'S' and s[aa] == 'x' and ans[aa-1]=='W':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'o' and ans[aa-1]=='S':
ans[aa+1] = 'W'
elif ans[aa] == 'W' and s[aa] == 'o' and ans[aa-1]=='W':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'x' and ans[aa-1]=='S':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'x' and ans[aa-1]=='W':
ans[aa+1] = 'W'
kekka = 1
for aa in range(0,len(ans)):
if(lier_check(aa) == -1):
kekka = -1
break
if kekka == 1:
print("".join(ans))
else:
############
ans = ['X']*N
ans[0] = 'S'
if s[0] == 'o':
ans[N-1] = 'S'
ans[1] = 'S'
else:
ans[N-1] = 'S'
ans[1] = 'W'
for aa in range(1,N-1):
if ans[aa] == 'S' and s[aa] == 'o' and ans[aa-1]=='S':
ans[aa+1] = 'S'
elif ans[aa] == 'S' and s[aa] == 'o' and ans[aa-1]=='W':
ans[aa+1] = 'W'
elif ans[aa] == 'S' and s[aa] == 'x' and ans[aa-1]=='S':
ans[aa+1] = 'W'
elif ans[aa] == 'S' and s[aa] == 'x' and ans[aa-1]=='W':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'o' and ans[aa-1]=='S':
ans[aa+1] = 'W'
elif ans[aa] == 'W' and s[aa] == 'o' and ans[aa-1]=='W':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'x' and ans[aa-1]=='S':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'x' and ans[aa-1]=='W':
ans[aa+1] = 'W'
kekka = 1
for aa in range(0,len(ans)):
if(lier_check(aa) == -1):
kekka = -1
break
if kekka == 1:
print("".join(ans))
else:
#######
ans = ['X']*N
ans[0] = 'S'
if s[0] == 'o':
ans[N-1] = 'W'
ans[1] = 'W'
else:
ans[N-1] = 'S'
ans[1] = 'W'
for aa in range(1,N-1):
if ans[aa] == 'S' and s[aa] == 'o' and ans[aa-1]=='S':
ans[aa+1] = 'S'
elif ans[aa] == 'S' and s[aa] == 'o' and ans[aa-1]=='W':
ans[aa+1] = 'W'
elif ans[aa] == 'S' and s[aa] == 'x' and ans[aa-1]=='S':
ans[aa+1] = 'W'
elif ans[aa] == 'S' and s[aa] == 'x' and ans[aa-1]=='W':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'o' and ans[aa-1]=='S':
ans[aa+1] = 'W'
elif ans[aa] == 'W' and s[aa] == 'o' and ans[aa-1]=='W':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'x' and ans[aa-1]=='S':
ans[aa+1] = 'S'
elif ans[aa] == 'W' and s[aa] == 'x' and ans[aa-1]=='W':
ans[aa+1] = 'W'
kekka = 1
for aa in range(0,len(ans)):
if(lier_check(aa) == -1):
kekka = -1
break
if kekka == 1:
print("".join(ans))
else:
print(kekka)
|
s552997312 | p03795 | u150117535 | 1487475498 | Python | PyPy3 (2.4.0) | py | Runtime Error | 193 | 40500 | 988 | import sys
N = int(input())
ipt = list(input())
stR = ["S" for i in range(N)]
def sheep(stg):
return stg
def wolf(stg):
if stg == "S":
return "W"
else:
return "S"
def modN (i):
return i%N
def check ( num1,num2 ):
for i in range(N+2):
if stR[modN(i+1)] == "S" and ipt[modN(i+1)]=="o" :
stR[modN(i+2)]=sheep(stR[modN(i)])
elif stR[modN(i+1)] == "W" and ipt[modN(i+1)]=="x":
stR[modN(i+2)]=sheep(stR[modN(i)])
else:
stR[modN(i+2)]=wolf(stR[modN(i)])
if stR[0]==num1 and stR[1]==num2:
print("".join(stR))
return True
else:
return False
if check("S","W"):
sys.exit()
else:
stR[0]="W"
if check("W","W"):
sys.exit()
else:
stR[1]="S"
if check("W","S"):
sys.exit()
else:
stR[0]="S"
if check("S","S"):
sys.exit()
else:
print(-1) |
s753100655 | p03795 | u878372089 | 1487474448 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 401 | N = int(input())
s = str(input())
ss = s
if N%2 == 1:
s += s[0]
if s[:len(s)/2]*2 != s:
print(-1)
else:
ans = ''
Flag = 0
for c in ss:
if Flag == 0:
ans += 'S'
if c == 'x':
Flag = 1
else:
if c == 'x':
ans += 'S'
Flag = 0
else:
ans += 'W'
print(ans) |
s394774054 | p03795 | u583826716 | 1487474316 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1447 | SHEEP = True
WOLF = False
def print_tree(tree):
print(''.join(['S' if e else 'W' for e in tree]))
def calc_next_animal(tree, cur_pos):
if answer[cur_pos]:
if tree[cur_pos] == SHEEP:
return tree[cur_pos - 1]
else:
return not tree[cur_pos - 1]
else:
if tree[cur_pos] == SHEEP:
return not tree[cur_pos - 1]
else:
return tree[cur_pos - 1]
def calc_prev_animal(tree, cur_pos):
if answer[cur_pos]:
if tree[cur_pos] == SHEEP:
return tree[cur_pos + 1]
else:
return not tree[cur_pos + 1]
else:
if tree[cur_pos] == SHEEP:
return not tree[cur_pos + 1]
else:
return tree[cur_pos + 1]
def wfs(tree, cur_pos, N):
tree[cur_pos + 1] = calc_next_animal(tree, cur_pos)
cur_pos += 1
if cur_pos == N - 1:
return tree[0] == calc_next_animal(tree, cur_pos) and tree[cur_pos] == calc_prev_animal(tree, 0)
else:
return wfs(tree, cur_pos, N)
if __name__ == '__main__':
N = int(input())
answer = [True if i == 'o' else False for i in input().rstrip()]
aa = [[WOLF, WOLF]
, [WOLF, SHEEP]
, [SHEEP, SHEEP]
, [SHEEP, WOLF]]
super_list = [0] * int(2E5)
for a in aa:
super_list[:2] = a
if wfs(super_list, 1, N):
print_tree(super_list[:N])
break
else:
print(-1) |
s724923085 | p03795 | u996252264 | 1487474244 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1061 | N = int(input())
t = list(input())
Ans = ['n' for _ in t]
def judge(prevSW, SW, ox):
if SW == 'S':
if ox == 'o':
return prevSW
else:
if prevSW == 'S':
return 'W'
else: return 'S'
elif SW == 'W':
if ox == 'x':
return prevSW
else:
if prevSW == 'S':
return 'W'
else: return 'S'
def decideorder(startSW):
Ans[1] = startSW
for i in range(2,N):
Ans[i] = judge(Ans[i-2], Ans[i-1], t[i-1])
Ans[0] = 'S'
decideorder('S')
if judge(Ans[-1], Ans[0], t[0]) is Ans[0]:
print("".join(Ans))
else:
decideorder('W')
if judge(Ans[-1], Ans[0], t[0]) is Ans[0]:
print("".join(Ans))
else:
Ans[0] = 'W'
decideorder('S')
if judge(Ans[-1], Ans[0], t[0]) is Ans[0]:
print("".join(Ans))
else:
decideorder('W')
if judge(Ans[-1], Ans[0], t[0]) is Ans[0]:
print("".join(Ans))
else:
print(-1) |
s707054870 | p03795 | u811388439 | 1487472227 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 85 | def sunuke_f(n) :
x = n * 800
y = (n // 15) * 200
return(x-y)
sunuke_f(N) |
s837102365 | p03795 | u177756077 | 1487472078 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2572 | 15 | 800*N-15%N*200
|
s474051978 | p03795 | u104888971 | 1487471460 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 51 | = int(input())
print(N * 800 - ((N // 15) * 200)) |
s452674679 | p03795 | u104888971 | 1487471201 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 62 | N = input()
print(N / 15)
print(N * 800 - ((N / 15) * 200))
|
s178654048 | p03795 | u811388439 | 1487470833 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 77 | def sunuke_f(n) :
x = n * 800
y = n // 15 * 200
return(x-y)
sunuke_f(N) |
s575725734 | p03795 | u952236873 | 1487470145 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 69 | import sys
N = int(sys.argv[1])
x = 800*N
y = (N/15)*200
print x - y
|
s986134218 | p03795 | u952236873 | 1487469773 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 91 | import sys
N = int(sys.argv[1])
assert(1 <= N <= 100)
x = 800*N
y = (N/15)*200
print x - y
|
s833399544 | p03796 | u828593789 | 1601442246 | Python | PyPy3 (7.3.0) | py | Runtime Error | 83 | 68536 | 263 | #include <iostream>
using namespace std;
using ll = long long int;
const ll MOD = 1000000007;
int main(){
ll n;
cin >> n;
ll ans = 1;
for(ll i = 2; i <= n; i++){
ans *= i;
ans %= MOD;
}
cout << ans << endl;
return 0;
} |
s190406207 | p03796 | u962718741 | 1601305700 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8936 | 35 | print(math.factorial(int(input()))) |
s019158929 | p03796 | u889405092 | 1600323208 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9104 | 60 | import math
N=int(input())
print(math.factrial(N)%(10**9+7)) |
s367209124 | p03796 | u477320129 | 1599690308 | Python | Python (3.8.2) | py | Runtime Error | 44 | 9528 | 108 | from functools import reduce
MOD = 1_000_000_007
print(reduce(lambda a,b: a*b%MOD, range(1, int(input()))))
|
s187397943 | p03796 | u477320129 | 1599690191 | Python | Python (3.8.2) | py | Runtime Error | 44 | 9540 | 107 | from functools import reduce
MOD = 1_000_000_007
print(reduce(lambda a,b: a*b%MOD, range(1, int(input())))) |
s382355929 | p03796 | u179169725 | 1599619944 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8884 | 539 | mycode = '''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
ctypedef long long LL
import numpy as np
cimport numpy as cp
cdef LL MOD = 10**9 + 7
cdef LL N = int(input())
cdef LL ans = 1
cdef i
for i in range(2, N + 1):
ans *= i
ans %= MOD
print(ans)
'''
import sys
if sys.argv[-1] == 'ONLINE_JUDGE': # コンパイル時
with open('mycode.pyx', 'w') as f:
f.write(mycode)
import os
os.system('cythonize -i -3 -b mycode.pyx')
import mycode
|
s412828293 | p03796 | u197237612 | 1599531813 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9192 | 80 | n = int(input())
ans = 1
for i in range(1, n+1):
ans *= i
print(ans/(10**9+7)) |
s636540748 | p03796 | u244836567 | 1599343685 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9484 | 135 | a=int(input())
b=1
for i in range(1,a+1):
b=b*i
if b<1000000000:
print(b)
else:
print(((b/10000000000)*(10000000000))%1000000007) |
s370446859 | p03796 | u074220993 | 1599246631 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9632 | 91 | N = int(input())
mod = int(10e9+7)
f = lambda n:1 if n==1 else n * f(n-1) % mod
print(f(N)) |
s780161529 | p03796 | u748722044 | 1599153709 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 74196 | 95 | n = int(input())
start = 1
for i in range(2, n+1):
start *= i
start %= MOD
print(start) |
s225534887 | p03796 | u477142306 | 1598960379 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9088 | 92 | s=int(input())
ans=1
for i in range(1,n+1):
ans=ans%(10**9+7)*i
print(ans%(10**9+7)) |
s745898421 | p03796 | u477142306 | 1598960363 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9160 | 92 | s=int(input())
ans=1
for i in range(1,n+1):
ans=ans%(10**9+7)*n
print(ans%(10**9+7)) |
s523320056 | p03796 | u477142306 | 1598960308 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9164 | 92 | s=int(input())
ans=1
for i in range(1,n+1):
ans=ans%(10**9+7)*n
print(ans%(10**9+7)) |
s822399919 | p03796 | u477142306 | 1598960266 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9164 | 93 | s=int(input())
ans=1
for i in range(1,n+1):
ans=ans%(10**9+7)*n
print(ans%1000000007) |
s816181722 | p03796 | u477142306 | 1598960245 | Python | Python (3.8.2) | py | Runtime Error | 18 | 9036 | 94 | s=int(input())
ans=1
for i in range(1,n+1):
ans=ans%(10**9+7)*n
print(ans%10000000007) |
s396226679 | p03796 | u477142306 | 1598956296 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8784 | 166 | #include<bits/stdc++.h>
using namespace std;
int main(){
long long int n,i,ans=1;
cin>>n;
for(i=1;i<=n;i++)
ans=(ans*i)%(10000000007);
cout<<ans<<endl; |
s789256644 | p03796 | u477142306 | 1598956076 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9076 | 66 | s=int(input())
ans=1
for i in range(1,n+1):
ans*=i
print(ans) |
s267514613 | p03796 | u607563136 | 1598400094 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9000 | 45 | print(math.factorial(int(input()))%(10**9+7)) |
s605672343 | p03796 | u068142202 | 1598287220 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 10152 | 140 | from decimal import Decimal
n = int(input())
training = 1
for i in range(1, n):
training *= i
print(Decimal(training) % (10 ** 9 + 7))
|
s394144631 | p03796 | u392361133 | 1597415715 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9152 | 66 | import math
n = int(input())
print(math.factrial(n) % (10**9 + 7)) |
s874645968 | p03796 | u698756732 | 1597170274 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9020 | 129 | n = int(input())
power = 1
for i in range(1,n+1):
power *= i
power = power % (10 ** 9 + 7))
print(power % (10 ** 9 + 7)) |
s081445820 | p03796 | u921632705 | 1597167797 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9096 | 91 | import math
x = int(input())
a = 10*10*10*10*10*10*10*10*10+7
print(math.fanctional(x) % a) |
s414191132 | p03796 | u921632705 | 1597167761 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9160 | 89 | import math
x = int(input())
a = 10*10*10*10*10*10*10*10*10+7
print(math.fanctional(x)%a) |
s440016667 | p03796 | u921632705 | 1597167733 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9164 | 89 | import math
x = int(input())
a = 10*10*10*10*10*10*10*10*10+7
print(math.functional(x)%a) |
s542314020 | p03796 | u921632705 | 1597167664 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9156 | 90 | import math
x = int(input())
y = 10*10*10*10*10*10*10*10*10 +7
print(math.functional(x)%y) |
s282764932 | p03796 | u985929170 | 1595620974 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9388 | 106 | N = int(input())
def amari(n):
if n==1:return 1
return (n*amari(n-1)) % 1000000007
print(amari(N)) |
s212056268 | p03796 | u277312083 | 1595390023 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8880 | 216 | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int main(){
long int n, i = 1;
cin >> n;
for(long int j = 1; j <= n; j++){
i *= j;
i %= MOD;
}
cout << i << endl;
return 0;
}
|
s053740065 | p03796 | u215376033 | 1595351348 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8940 | 88 | number = input()
power = 1;
for i in range(number):
power = power * i
print(power) |
s043890186 | p03796 | u755116850 | 1594588788 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8988 | 121 | # coding: utf-8
n = int(N)
power = 1
for i in range(1, n+1):
power *= i
power = power % (10**9+7)
print(power) |
s344527460 | p03796 | u789290859 | 1593716752 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8984 | 90 | N = int(input())
power = 1
for i in range(1:N+1):
power *= i
print(power/1000000000+7) |
s213325611 | p03796 | u403436880 | 1593229929 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8884 | 59 | import math
N = int(input())
print(factorial.(N)%(10**9+7)) |
s437752301 | p03796 | u075303794 | 1592489187 | Python | Python (3.4.3) | py | Runtime Error | 277 | 20364 | 85 | import numpy as np
n = int(input())
l = np.arange(1,n+1)
print(np.pord(l)%(10**9+7)) |
s412040769 | p03796 | u084320347 | 1592245422 | Python | PyPy3 (2.4.0) | py | Runtime Error | 184 | 38256 | 85 | n = int(input())
ans = 1
for i in range(1,n+1):
ans=ans*i%(1e9+7)
print(int(ans) |
s168494790 | p03796 | u378157957 | 1592092012 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 146 | FACTOR = 10 ** 9 + 7
num = 1
for i in range(1, N+1):
num *= i
k, r = divmod(num, FACTOR)
num = r
k, r = divmod(num, FACTOR)
print(r) |
s631438568 | p03796 | u964521959 | 1591396003 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3540 | 120 | #整数の入力
N = int(input())
ans = 1
for i in range(N):
ans = ans * (i+1)
ans = ans/(10**9 + 7)
print(ans)
|
s392882820 | p03796 | u392361133 | 1591271010 | Python | Python (3.4.3) | py | Runtime Error | 230 | 3984 | 67 | import math
a = int(input())
print(math.factorial(a) /( 10**9 + 7)) |
s739004929 | p03796 | u420130252 | 1590972611 | Python | PyPy3 (2.4.0) | py | Runtime Error | 286 | 50288 | 118 | n=int(input())
def ans(n):
if n==1:
return 1
else:
return n*ans(n-1)
print(ans(n)%1000000007) |
s918950983 | p03796 | u974935538 | 1590238548 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3464 | 85 | N = int(input())
div = 1e9+7
ans = 1
for i in range(1,N+1):
ans*=i
print(ans%div) |
s041646434 | p03796 | u247211039 | 1589678719 | Python | Python (3.4.3) | py | Runtime Error | 230 | 3984 | 65 | import math
N = int(input())
print((math.factorial(N))/(10^9+7))
|
s295575392 | p03796 | u460468647 | 1589473139 | Python | PyPy3 (7.3.0) | py | Runtime Error | 150 | 72816 | 73 | n = int(input())
import fractions
print(fractions.factorial(n)%(10**9+7)) |
s269051372 | p03796 | u887147934 | 1589356117 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 60 | N=int(input())
M=int(math.factorial(N))
L=10**9+7
print(M%L) |
s197272875 | p03796 | u821588465 | 1589167144 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 57 | import math
print(math.factorial(int(input))%(10**9 + 7)) |
s082486964 | p03796 | u821588465 | 1589167091 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 45 | import math
print(math.factorial(int(input))) |
s369951579 | p03796 | u967822229 | 1589151582 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 82 | N = input()
sum=1
for i in range(1, N+1):
sum=(sum*i)%1000000007
print(sum)
|
s853686474 | p03796 | u967822229 | 1589151560 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 79 | N = input()
sum=1
for i in range(1, N):
sum=(sum*i)%1000000007
print(sum) |
s567093737 | p03796 | u967822229 | 1589151032 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 79 | N = input()
sum=1
for i in range(1, N):
sum=(sum*i)%1000000007
print(sum) |
s467039500 | p03796 | u629350026 | 1589139690 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 98 | N=int(input())
import math
power=1
for i in range(0,n):
power=power*(i+1)
print(power%(10**9+7)) |
s895230641 | p03796 | u870518235 | 1588951075 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 104 | N = int(input())
fact = 1
for integer in range(1,N+1):
fact = fac * integer % 1000000007
print(fact) |
s049343233 | p03796 | u146346223 | 1588903073 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 97 | N = int(input())
num = 1
for i in range(1, N+1):
num *= i
num %= 1_000_000_007
print(num) |
s314774074 | p03796 | u017415492 | 1588821322 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 117 | #a,b=map(int,input().split())
n=int(input())
#s=input()
ans=1
for i in range(n):
ans*=(n%mod)
ans%=mod
print(ans) |
s388547776 | p03796 | u017415492 | 1588821309 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 117 | #a,b=map(int,input().split())
n=int(input())
#s=input()
ans=0
for i in range(n):
ans*=(n%mod)
ans%=mod
print(ans) |
s906207130 | p03796 | u007886915 | 1588782667 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 9971 | # -*- coding: utf-8 -*-
import sys
import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque
#input = stdin.readline
j=0
k=0
n=3
r=1
a=[0]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"
#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
print(number_list[i-1])#
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''
x=[]
y=[]
for i in range(N):
x1, y1=[int(i) for i in input().split()]
x.append(x1)
y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''
'''
mixlist=[]
for i in range(N):
a,b=input().split()
mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ,今回はリスト一つで処理している"
'''
'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''
#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]
print(type(N))
print(N)
print(type(M))
print(M)
print(type(table))
print(table)
'''
#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値.桁ごとに分割したい.入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''
'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''
'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''
#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"
#a,b=map(int, input().split()) #int style 複数数値入力 「A B」みたいなスペース空いた入力のとき
#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成
##############################################################################################
##############################################################################################
#under this line explains example calculation
'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''
#nCr combination
'''
def cmb(n,r):
#When n < r , this function isn't valid
r= min(n-r,r)
#print(n,r)
if r == 0: return 1
over = reduce(mul, range(n, n-r, -1))
#flochart mul(n,n-1)=x
#next mul(x,n-2)........(n-r+1,n-r)
#mul read a,b and returns a*b
under = reduce(mul, range(1, r+1))
#print(over, under)
#reduce is applied mul(1,2)=2
#next mul(2,3)=6
#next mul(6,4)=4.........last(r!,r+1)=r+1!
return over // under
#// is integer divide
#calc example 5C2
#over=5*4*3
#under=3*2*1
a = cmb(n, r)
#print(a)
'''
'''
import itertools
from itertools import combinations_with_replacement
combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし
combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり
使用例 出力
combinations('ABCD', 2) AB AC AD BC BD CD
combinations_with_replacement('ABCD', 2) AA AB AC AD BB BC BD CC CD DD
'''
'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位n個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
#(1, 6)
#(3, 3)
#(4, 1)
'''
#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''
'''
素数の判定
'''
def is_prime(n):
if n == 1: return False
for k in range(2, int(np.sqrt(n)) + 1):
#sqrt(n)+1以上は考えて約数はないので却下
if n % k == 0:
return False
#割り切れたらFalse
return True
'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります.[1, -2, 3]と0の4つの数字のうち,最も大きい値を出力します.
一方で,[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります.
その時は,numpyのmaximum関数を用います.
xs = np.array([1, -2, 3])
np.maximum(xs, 0) # [1, 0, 3]
'''
########################################################################
########################################################################
#b2=a[:] #1次元のときはコピーはこれで良い
#print(b2)
#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a) #2次元配列はこうコピーする
#print(b3)
def factorial(x, mod=10**9+7):
# x!
# 階乗
# ex) factorial(5) = 120
tmp = 1
for i in range(1, x+1):
tmp = (tmp * i) % mod
return tmp
def main():
w=1
j=0
k=0
dl=[]
po=1
n=int(input())
#print(factorial(n))
for i in range(1:n):
po=po*(i)
print(po%(10**9+7))
#r=int(input())
#dp= [[0]*3 for i in range(5)]#列 行
#dp用の0の入ったやつ
#dp= [[0]*(w+1) for i in range(n+1)]#0からwまでのw+1回計算するから
#print(dp)#初期条件が入る分計算回数+1列分必要(この場合は判断すべきものの数)
DP = np.zeros(w+1, dtype=int)#これでも一次元リストが作れる
exdp=np.zeros((3,4)) # 3×4の2次元配列を生成。2次元ならこう
#dtypeは指定しないとfloatになる
#for i in range(n):#ちょっとした入力に便利
# a, b = map(int, input().split())
#dp[i][0] += [a]
#これだとintとlistをつなぐことになって不適
# dp[i] += [a]
# dp[i] += [b]
#これはうまくいく
#やり方はいろいろあるということ
#print(dp)
"1行1つの整数を入力を取得し、整数と取得する"
#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"
#brray=[list(map(int, input().split(" ")))for i in range(N)
#print(brray)
#s=input()
#a=[int(i) for i in s]#int取るとstrでも行ける
#print(a)
'''
入力
1234
出力
[1, 2, 3, 4]
'''
pin_l=["x" for i in range(10)]#内包表記に慣れろ
#print(pin_l)
ls = ["a", "b", "c", "d", "e"]
#print(ls[2:5])
#スライスでの取得
#print(ls[:-3])
#一番左端から右から3番目より左まで取得
#print(ls[:4:2])
#スライスで1個飛ばしで取得
#ないときは左端スタート
#始点のインデックス番号 : 終点のインデックス番号 : スキップする数+1
#print(ls[::2])
'''
lsというリストの場合に、1つ飛びの値を取得したい場合には
ls[::2]
のようにします。こうすると、
["a", "c", "d"]と出力される
'''
if __name__ == "__main__":
main()
|
s636809422 | p03796 | u165268875 | 1588624639 | Python | Python (3.4.3) | py | Runtime Error | 230 | 3976 | 68 |
import math
N = int(input())
print((math.factorial(N))/(10**9 + 7)) |
s747983109 | p03796 | u165268875 | 1588624587 | Python | Python (3.4.3) | py | Runtime Error | 230 | 3984 | 68 | import math
N = int(input())
print((math.factorial(N)/(10**9 + 7)))
|
s747923585 | p03796 | u165268875 | 1588624481 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 67 | import math
N = int(input())
print((math.factorial(N)/(10**9 + 7))
|
s597945293 | p03796 | u870518235 | 1588551551 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3892 | 162 | N = int(input())
def fract(n):
if n == 0:
return 1
elif n == 1:
return n
return n * fract(n-1)
res = fract(N) % 1000000007
print(res) |
s567096398 | p03796 | u870518235 | 1588522145 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3896 | 127 | N = int(input())
def fract(n):
if n == 1:
return n
return n * fract(n-1)
res = fract(N) % 1000000007
print(res) |
s246837621 | p03796 | u870518235 | 1588487931 | Python | Python (3.4.3) | py | Runtime Error | 73 | 3896 | 127 | N = int(input())
def fract(n):
if n == 1:
return n
return n * fract(n-1)
res = fract(N) % 1000000007
print(res) |
s082751089 | p03796 | u870518235 | 1588487811 | Python | Python (3.4.3) | py | Runtime Error | 73 | 3892 | 128 | N = int(input())
def fract(n):
if n == 1:
return n
return n * fract(n-1)
res = fract(N) /(1000000007)
print(res) |
s363499121 | p03796 | u600261652 | 1588443274 | Python | Python (3.4.3) | py | Runtime Error | 441 | 4360 | 99 | import math
N = int(input())
print(math.factorial(N)-math.factorial(N)/(10**9+7)*math.factorial(N)) |
s808335816 | p03796 | u600261652 | 1588442861 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 62 | import math
N = int(input())
print(math.factrial(N)%(10**9+7)) |
s886286516 | p03796 | u184902932 | 1588387076 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 64 | import math
N = int(input())
print(math.factorial(N) % (10**9+7) |
s118350059 | p03796 | u184902932 | 1588387018 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 62 | import math
N = int(input())
print(math.factorial(N)%(10**9+7) |
s139012701 | p03796 | u358254559 | 1588085124 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38512 | 374 | n= int(input())
def fact_m(n, modulus=10**9+7):
ans=1
if n <= modulus//2:
for i in range(1,n+1):
ans = (ans * i) % modulus
else:
for i in range(1,modulus-n):
ans = (ans * i) % modulus
ans = modinv(ans, modulus)
if n % 2 == 0:
ans = -1*ans + modulus
return ans % modulus
print(fact_m(m)) |
s461850277 | p03796 | u910295650 | 1588003030 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3892 | 121 | def func(X):
if X==1:
return 1
else:
return X*func(X-1)
N=int(input())
print(func(N)%((10**9)+7)) |
s145738200 | p03796 | u633450100 | 1587967867 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 91 | N = int(input())
ans = 1
for i in range(2,i+1):
ans = ans * i % (10 ** 9 + 7)
print(ans) |
s500507008 | p03796 | u633450100 | 1587967313 | Python | Python (3.4.3) | py | Runtime Error | 73 | 3896 | 139 | N = int(input())
def per(N):
if N == 0 or N == 1:
return 1
else:
return N * per(N-1)
print(per(N) % (10 ** 9 + 7)) |
s899045299 | p03796 | u633450100 | 1587967009 | Python | Python (3.4.3) | py | Runtime Error | 74 | 4008 | 81 | N = int(input())
def per(N):
return N * per(N-1)
print(per(N) / (10 ** 9 + 7)) |
s582823165 | p03796 | u614964888 | 1587885920 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 62 | import math
N=int(input())
print(math.factorical(N)%(10**+7)) |
s256946360 | p03796 | u614964888 | 1587885829 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 65 | import math
N=int(input())
print((math.factorical(N))%(10**9+7)) |
s275233295 | p03796 | u884323674 | 1587705285 | Python | Python (3.4.3) | py | Runtime Error | 75 | 3892 | 146 | N = int(input())
def power(n):
if n == 1:
p = 1
else:
p = power(n-1) * n
return p % (10**9 + 7)
print(power(N)) |
s493378890 | p03796 | u282676559 | 1587340720 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 101 | import math
n = int(input())
result = math.prod([i for i in range(1, n+1)])
print(result%(10**9+7))
|
s831769357 | p03796 | u077127204 | 1587240222 | Python | Python (3.4.3) | py | Runtime Error | 38 | 3572 | 107 | import functools
N = int(input())
print(functools.reduce(lambda x, y: x * y % 1000000007, range(2, N+1)))
|
s519014121 | p03796 | u423585790 | 1587139243 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38256 | 82 | n = int(input())
ans = 1
for i in range(1,n+1):
ans *= i
ans %= mod
print(ans) |
s485030374 | p03796 | u616017354 | 1586723547 | Python | Python (3.4.3) | py | Runtime Error | 72 | 3896 | 122 | def nn(n):
if n==0:
return 1
else:
return n*nn(n-1)
n=int(input())
ans=nn(n)%100000007
print(ans) |
s745763819 | p03796 | u964007550 | 1586719156 | Python | Python (3.4.3) | py | Runtime Error | 229 | 3980 | 63 | n = int(input())
import math
print(math.factorial(n)/(10**9+7)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.