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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s191133528 | p03676 | u635974378 | 1498967562 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 11892 | 993 | n = int(input())
seq = input().split()
lc = 'a'
already = []
for idx,c in enumerate(seq):
if c in already:
break
already.append(c)
lc = c
left = seq.index(c)
right = list(reversed(seq)).index(c)
middle = n-left-right-2
# print(left,middle,right,lc)
# print(seq)
def f(n):
if n<=1:
retur... |
s676237341 | p03676 | u382748202 | 1498967301 | Python | Python (3.4.3) | py | Runtime Error | 152 | 14436 | 751 | from operator import mul
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def com(n, k):
if n == 0 or k == 0:
return 1
return int(reduce(mul, range(n + 1 - k, n + 1)) / reduce(mul, range(1, k + 1))) % (10 ** 9 + 7)
idx_list = [-1] * (n + 2)
l = 0
r = 0
for i, a_i in e... |
s853134478 | p03676 | u280269055 | 1498963199 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 15844 | 579 | n = int(input())
a = list(map(int, input().strip().split()))
def d_print(subdict):
length = len(subdict) % int(1e9+7)
print(length)
def d_search(previous_dict):
d = dict()
for item in previous_dict.keys():
temp = previous_dict[item]
left = set(a[temp+1:])
for i in left:
... |
s024571315 | p03676 | u057916330 | 1498963122 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14436 | 1222 | import functools
import operator
def __nCr(n, r):
r = min(r, n - r)
if r == 0:
return 1
numer = functools.reduce(operator.mul, range(n, n - r, -1))
denom = functools.reduce(operator.mul, range(1, r + 1))
return numer // denom
MOD = 1000000007
n = int(input())
a = list(map(int, input().spl... |
s944232046 | p03676 | u382748202 | 1498962899 | Python | Python (3.4.3) | py | Runtime Error | 153 | 14436 | 735 | from operator import mul
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def com(n, k):
if n == 0 or k == 0:
return 1
return int(reduce(mul, range(n + 1 - k, n + 1)) / reduce(mul, range(1, k + 1)))
idx_list = [-1] * (n + 2)
l = 0
r = 0
for i, a_i in enumerate(a):
... |
s373976119 | p03676 | u382748202 | 1498962729 | Python | Python (3.4.3) | py | Runtime Error | 151 | 14436 | 735 | from operator import mul
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def com(n, k):
if n == 0 or k == 0:
return 1
return int(reduce(mul, range(n + 1 - k, n + 1)) / reduce(mul, range(1, k + 1)))
idx_list = [-1] * (n + 1)
l = 0
r = 0
for i, a_i in enumerate(a):
... |
s879787521 | p03676 | u177481830 | 1498962727 | Python | Python (3.4.3) | py | Runtime Error | 764 | 36696 | 871 | import numpy as np
import math
def comb(n, k):
if n<k:
return 0
if k<0:
return 0
if n-k<k:
k=n-k
return round(math.factorial(n)/math.factorial(k)/math.factorial(n-k))
n=int(input())
a=np.array([int(i) for i in input().split()])
count_lst=[[] for _ in range(n)]
for i in range(... |
s944311675 | p03676 | u177481830 | 1498962675 | Python | Python (3.4.3) | py | Runtime Error | 578 | 27724 | 870 | import numpy as np
import math
def comb(n, k):
if n<k:
return 0
if k<0:
return 0
if n-k<k:
k=n-k
return round(math.factorial(n)/math.factorial(k)/math.factorial(n-k))
n=int(input())
a=np.array([int(i) for i in input().split()])
count_lst=[[] for _ in range(n)]
for i in range(... |
s851468130 | p03676 | u033599596 | 1498962635 | Python | Python (3.4.3) | py | Runtime Error | 284 | 13812 | 875 | #!/usr/bin/python
import math
R = 1000000007
def C(m, n):
if m < 0 or n < 0 or m < n: return 0
if m == 0 or n == 0: return 1
return int(math.factorial(m)/math.factorial(n)/math.factorial(m-n))
ans = 1
u, l = m, n
while u > m - n:
ans *= u
if l > 1 and ans % l == 0:
... |
s773843162 | p03676 | u177481830 | 1498962501 | Python | Python (3.4.3) | py | Runtime Error | 659 | 28876 | 855 | import numpy as np
import math
def comb(n, k):
if n<k:
return 0
if k<0:
return 0
if n-k<k:
k=n-k
return round(math.factorial(n)/math.factorial(k)/math.factorial(n-k))
n=int(input())
a=np.array([int(i) for i in input().split()])
count_lst=[[] for _ in range(n)]
for i in range(... |
s104211065 | p03676 | u033599596 | 1498962064 | Python | Python (3.4.3) | py | Runtime Error | 287 | 13812 | 863 | #!/usr/bin/python
import math
def C(m, n):
if m < 0 or n < 0 or m < n: return 0
if m == 0 or n == 0: return 1
return int(math.factorial(m)/math.factorial(n)/math.factorial(m-n))
ans = 1
u, l = m, n
while u > m - n:
ans *= u
if l > 1 and ans % l == 0:
ans /= l
... |
s792570157 | p03676 | u177481830 | 1498961395 | Python | Python (3.4.3) | py | Runtime Error | 789 | 37768 | 890 | import numpy as np
import math
def comb(n, k):
if n<k:
return 0
if k<0:
return 0
if n-k<k:
k=n-k
return round(math.factorial(n)/math.factorial(k)/math.factorial(n-k))
n=int(input())
a=np.array([int(i) for i in input().split()])
count_lst=[[] for _ in range(n)]
for i in range(... |
s492701632 | p03676 | u265881782 | 1498961311 | Python | Python (3.4.3) | py | Runtime Error | 72 | 13880 | 371 | n = int(input())
a = list(map(int,input().split()))
pos = [0 for _ in range(n+1)]
first = 0
second = 0
for i in range(n+1):
if(pos[a[i]]):
first = pos[a[i]]-1
second = i
pos[a[i]] = i+1
cnt = n+1
cnt2 = 1
MOD = 1000000007
for i in range(n+1):
print(round(cnt-cnt2)%MOD)
cnt = cnt*(n... |
s741410098 | p03676 | u667084803 | 1498960920 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14004 | 378 | N=int(input())
a=list(map(int,input().split()))
c=[]
for i in range(N+1):
if a[i] in c:
b=a[i]
j=c.index(a[i])
k=i
L=j+N-k
break
c+=[a[i]]
Base=N+1
Minu=1
for i in range(0,min(L+1,N+1)):
print((Base-Minu)%(10**9+7))
Base=int(Base*(N-i)/(i+2))
Minu=int(Minu*(L-i)/(i+1))
for i in range(L+1,... |
s059235350 | p03676 | u265881782 | 1498960734 | Python | Python (3.4.3) | py | Runtime Error | 71 | 13812 | 399 | n = int(input())
a = list(map(int,input().split()))
pos = [0 for _ in range(n+1)]
first = 0
second = 0
for i in range(n+1):
if(pos[a[i]]):
first = pos[a[i]]-1
second = i
pos[a[i]] = i+1
cnt = n+1
cnt2 = 1
MOD = 1000000007
for i in range(n+1):
print((cnt-cnt2)%MOD)
cnt *= (n-i)/(i+2... |
s855145635 | p03676 | u667084803 | 1498960557 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13812 | 524 | import math
N=int(input())
a=list(map(int,input().split()))
c=[]
for i in range(N+1):
if a[i] in c:
b=a[i]
j=c.index(a[i])
k=i
L=j+N-k
break
c+=[a[i]]
Base=N+1
Minu=1
for i in range(0,min(L+1,N+1)):
print((Base-Minu)%(10**9+7))
Base=int(Base*(N-i)/(i+2))
Minu=int(Minu*(L-i)/(i+1))
#print... |
s885030742 | p03676 | u667084803 | 1498960390 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13812 | 524 | import math
N=int(input())
a=list(map(int,input().split()))
c=[]
for i in range(N+1):
if a[i] in c:
b=a[i]
j=c.index(a[i])
k=i
L=j+N-k
break
c+=[a[i]]
base=N+1
minu=1
for i in range(0,min(L+1,N+1)):
print((base-minu)%(10**9+7))
base=int(base*(N-i)/(i+2))
minu=int(minu*(L-i)/(i+1))
#print... |
s760136579 | p03677 | u828766688 | 1583777099 | Python | PyPy3 (2.4.0) | py | Runtime Error | 342 | 75116 | 1094 |
"""
Writer: SPD_9X2
https://atcoder.jp/contests/arc077/tasks/arc077_c
お気に入りを決めてる時、その数字を超えるような移動が発生した場合だけ、ボタン2が有効になる。
ALLボタン1に比べて、何回節約できるかをimos法で計算する
"""
n,m = map(int,input().split())
lis = [0] * m
state = [0] * n
a = list(map(int,input().split()))
start = [ [] for i in range(m) ]
end = [ [] for i in range(m)]
... |
s142055429 | p03677 | u052499405 | 1570115164 | Python | PyPy3 (2.4.0) | py | Runtime Error | 441 | 71276 | 721 | n, m = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]
def calc(l, m1, m2, r):
val = [0] * 4
for a1, a2 in zip(a, a[1:]):
diff = (a2 - a1 + m) % m
val[0] += min(diff, (a2 - l + m) % m + 1)
val[1] += min(diff, (a2 - m1 + m) % m + 1)
val[2] += m... |
s837425320 | p03677 | u480138356 | 1569205403 | Python | Python (3.4.3) | py | Runtime Error | 110 | 13876 | 948 | import sys
input = sys.stdin.readline
def main():
N, M = map(int, input().split())
a = list(map(int, input().split()))
tmp = sorted(list(set(a[1:])))
max_ = tmp[1] - tmp[0]
ind = tmp[1]
pre = tmp[1]
for i in range(2, len(tmp)):
if tmp[i] - pre > max_:
max_ = tmp[i] - pr... |
s503213727 | p03677 | u218843509 | 1559796668 | Python | Python (3.4.3) | py | Runtime Error | 311 | 13812 | 701 | n, m = map(int, input().split())
a = list(map(int, input().split()))
a = [b-1 for b in a]
imos = [0 for _ in range(m+1)]
base = 0
for i in range(n-1):
x, y = a[i], a[i+1]
z, w = (x+2)%m, (y+1)%m
if w == 0:
w = m
if z < w:
imos[z] += 1
imos[w] -= w-z+1
if w < m:
imos[w+1] += w-z
else:
imos[z] += 1
im... |
s854029732 | p03677 | u218843509 | 1559796558 | Python | Python (3.4.3) | py | Runtime Error | 307 | 13812 | 688 | n, m = map(int, input().split())
a = list(map(int, input().split()))
a = [b-1 for b in a]
imos = [0 for _ in range(m+1)]
base = 0
for i in range(n-1):
x, y = a[i], a[i+1]
z, w = (x+2)%m, (y+1)%m
if w == 0:
w = m
if z < w:
imos[z] += 1
imos[w] -= w-z+1
if w < m:
imos[w+1] += w-z
else:
imos[z] += 1
im... |
s978401513 | p03677 | u864197622 | 1552491743 | Python | Python (3.4.3) | py | Runtime Error | 301 | 20664 | 739 | from itertools import accumulate
def acc(X): return list(accumulate(X))
N, M = map(int, input().split())
A = [int(a)-1 for a in input().split()]
X = [0] * M # 1,1,1,...
Y = [0] * M # 1,2,3,...
def tri(l, r, a = 1):
if l < M:
Y[l] += a
if r + 1 < M:
Y[r+1] -= a
X[r+1] -= (r-l+1) * a
d... |
s934878090 | p03677 | u413107439 | 1499348936 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 11216 | 726 | N, M = map(int, raw_input().split())
input_array = map(int, raw_input().split())
base_result = 0
index_dict = [0] * M
now_val = input_array[0]
for index in xrange(len(input_array)- 1):
base_result += min((input_array[index + 1] - input_array[index]) % M,
(input_array[index + 1]) % M + 1)
val = input_array[index + 1... |
s313213143 | p03677 | u413107439 | 1499273159 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 11344 | 835 | N, M = map(int, raw_input().split())
input_array = map(int, raw_input().split())
def count(base_val, input_array, M):
return sum([min((input_array[i + 1] - input_array[i]) % M,
(input_array[i + 1] - base_val) % M + 1
)
for i in xrange(len(input_array) - 1)])
base_result = count(1, input_array, M)
best_result =... |
s182105773 | p03677 | u413107439 | 1499273009 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 11304 | 816 | N, M = map(int, raw_input().split())
input_array = map(int, raw_input().split())
def count(base_val, input_array, M):
return sum([min((input_array[i + 1] - input_array[i]) % M,
(input_array[i + 1] - base_val) % M + 1
)
for i in xrange(len(input_array) - 1)])
base_result = count(1, input_array, M)
best_result =... |
s369524783 | p03677 | u413107439 | 1499272607 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 12524 | 823 | N, M = map(int, raw_input().split())
input_array = map(int, raw_input().split())
def count(base_val, input_array, M):
return sum([min((input_array[i + 1] - input_array[i]) % M,
(input_array[i + 1] - base_val) % M + 1
)
for i in range(len(input_array) - 1)])
from collections import defaultdict
base_result = cou... |
s528063105 | p03677 | u413107439 | 1499271063 | Python | Python (2.7.6) | py | Runtime Error | 2105 | 23280 | 898 | input_line_1 = raw_input()
input_line_2 = raw_input()
input_array = [int(i) for i in input_line_2.split(" ")]
M = int(input_line_1.split(" ")[1])
def count(base_val, input_array, M):
return sum([min((input_array[i + 1] - input_array[i]) % M,
(input_array[i + 1] - base_val) % M + 1
)
for i in range(len(input_arr... |
s030633443 | p03677 | u402189762 | 1498963132 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 680 | n=int(input())
m=int(input())
a=input().split()
for i in range(len(a)):
a[i]=int(a[i])
b=[0 for i in range(m+1)]
for i in range(n-1):
if(a[i]<a[i+1]):
for j in range(a[i+1]-a[i]):
b[a[i]+1+j]+=1
else:
for j in range(a[i+1]):
b[j+1]+=1
for j in range(m-a[i]... |
s824525942 | p03678 | u131213364 | 1555943435 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3752 | 2736 | #!/usr/bin/env python3
M = 10 ** 9 + 7
a = ord('a')
def check_cycle(t, p):
len_t = len(t)
if len_t % p != 0:
return False
pre = t[: p]
for i in range(p, len_t, p):
if t[i: i + p] != pre:
return False
return True
def solve_cycle(t, l, r):
len_t = len(t)
ql... |
s830066662 | p03679 | u318661636 | 1601044554 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9104 | 126 | x,a,b = map(int,input().split())
if b < a:
print('delicious')
elif b <= x:
pritn('safe')
elif b > x:
print('dangerous') |
s555412890 | p03679 | u998234161 | 1600998097 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8988 | 232 | N = int(input())
l = []
for i in range(N):
v = int(input())
l.append(v)
v = l[0]
print(l)
print(v)
ans = 1
while v != 2 and v != -1:
tmp = l[v-1]
l[v-1] = -1
v = tmp
ans += 1
if v == 2:
print(ans)
else:
print(-1)
|
s435413456 | p03679 | u317508154 | 1600401465 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9188 | 264 | n = int(input())
data = [input().split() for i in range(n)]
light = [0]*n
light[0] = 1
count = 1
bool = False
temp = int(data[0][0])
for i in range(n):
temp = int(data[temp - 1][0])
count += 1
if temp == 2:
print(count)
exit()
print(-1) |
s410483064 | p03679 | u708211626 | 1599358686 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9016 | 132 | a,b,c=list(map(int,input().split()))
if a-b>0=:
print('delicious')
elif -b+c<=a:
print('safe')
else:
print('dangerous') |
s211054179 | p03679 | u306412379 | 1599318676 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9076 | 322 | N = int(input())
A = [(i+1, int(input())) for i in range(N)]
cnt = 1
for i in range(N):
if 2 not in A[i]:
print(-1)
exit()
if A[i][0] == A[i][1]:
if i != 2:
print(-1)
exit()
x = A[0]
while x[1] != 2:
if x[1] == 1:
print(-1)
exit()
x = A[x[1]-1]
cnt += 1
print(cnt... |
s276506435 | p03679 | u670961163 | 1598415195 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9036 | 123 | a, b, c= map(int, input().split())
if b <= c:
print("delicious")
elif c-b<= x:
print("safe")
else:
print("dengerous") |
s607995766 | p03679 | u075303794 | 1598167060 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9040 | 127 | X,A,B=map(int,input().split())
if A>B:
print('delicious')
else:
if X>=B-A:
print('safe')
else:
pint('dangerous') |
s889998068 | p03679 | u863370423 | 1597890514 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9088 | 207 | N = int(input())
A = [int(input()) for i in range(N)]
G = [1]
for i in range(N):
G.append(A[G[-1]-1])
ans = 0
for i in G:
if i==2:
break
ans += 1
else:
ans = -1
print(ans) |
s780833159 | p03679 | u589969467 | 1597318649 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8988 | 124 | x,a,b = map(str,input().split())
if a>b:
print('delicious')
elif x>=b-a:
print('safe')
else:
print('dangerous')
|
s701009510 | p03679 | u193264896 | 1597069901 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8968 | 5 | 4 3 6 |
s494187667 | p03679 | u017415492 | 1596837373 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8792 | 507 | using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
string[] input = Console.ReadLine().Split();
int x = int.Parse(input[0]);
int a = int.Parse(input[1]);
int b = int.Parse(input[2]);
int t = b - a;
if (a... |
s709185635 | p03679 | u767797498 | 1595876735 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9024 | 117 | x,a,b=map(int,input())
n=a-b
if n >= 0:
print("delicious")
elif x+n >=0:
print("safe")
else:
print("dangerous") |
s022416923 | p03679 | u040298438 | 1594870555 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8812 | 101 | if b - a <= 0:
print("delicious")
elif b - a <= x:
print("safe")
else:
print("dangerous") |
s609853690 | p03679 | u440478998 | 1594753426 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9012 | 129 | x,a,b = map(int, input().split())
if b-a < 1:
print("delicious")
elif b-a = 1:
print("safe")
else:
print("dangerous") |
s805491867 | p03679 | u316603606 | 1594486425 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9120 | 145 | x,a,b = (int(x) for x in input().split())
if a < b:
if b-a > c:
print ('dengerous')
else:
print ('safe')
else:
print ('delicious')
|
s507430319 | p03679 | u958506960 | 1591907253 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 149 | x, a, b = map(int, input().split())
if a <= b:
print('delicious')
else:
if b - a <= x:
print('safe')
else:
print('dangerous') |
s067034345 | p03679 | u197968862 | 1591672025 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38256 | 482 | n, m = map(int,input().split())
mod = 10**9 + 7
if abs(n-m) > 1:
print(0)
quit()
elif abs(n-m) == 1:
a = max(n,m)
b = min(n,m)
ans = 1
for i in range(1,a+1):
ans *= (i%mod)
ans %= mod
for i in range(1,b+1):
ans *= (i%mod)
ans %= mod
print(ans%mod)
else... |
s552916800 | p03679 | u918373199 | 1591501487 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 134 | x,a,b = map(int, input().spilit())
if(a>=b):
print("delicious")
else:
if(b-a >x):
print("dangerous")
else:
print("safe") |
s787716012 | p03679 | u106778233 | 1590117902 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38256 | 153 | n=int(input())
A=[int(input()) for _ in range(n)]
A=[0]+A
cnt=1
for i in range(1,n+1):
cnt=A[cnt]
if cnt==2:
print(i)
exit()
print(-1)
|
s377818799 | p03679 | u057964173 | 1589830584 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 39664 | 437 | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(input())
l=[int(input()) for i in range(n)]
light=0
cnt=0
while True:
if l[light]==2:
cnt+=1
print(cnt)
break
else:
if cnt>n:
print(-1)
... |
s464328046 | p03679 | u678167152 | 1589734397 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 937 | #最小全域木問題、プリム法
from heapq import *
def solve():
N = int(input())
A = [list(map(int, input().split()))+[i] for i in range(N)]
edge = [[] for _ in range(N)]
A.sort()
for i in range(N-1):
w = A[i+1][0]-A[i][0]
edge[A[i][2]].append((w,A[i+1][2]))
edge[A[i+1][2]].append((w,A[i][2])... |
s652501585 | p03679 | u709799578 | 1589253203 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 202 | import math
n, m = map(int, input().split())
N = math.factorial(n)
M = math.factorial(m)
INF = 10**9 + 7
if abs(n-m) > 1:
print(0)
elif abs(n-m) == 1:
print(N*M%INF)
else:
print(2*N*M%INF) |
s546038581 | p03679 | u711238850 | 1589025263 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 105 | x,y = tuple(map(int,input().split()))
for i in range(1,10*18):
x<<=1
if x>y:
print(i)
break
|
s493098173 | p03679 | u711238850 | 1589023983 | Python | PyPy3 (2.4.0) | py | Runtime Error | 171 | 38512 | 99 | x,a,b = tuple(map(int,input().split()))
if b-a=<x:
print("delicious")
else:
print("dangerous") |
s015867583 | p03679 | u227082700 | 1589023908 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 108 | x,a,b=map(int,input().split())
if b-a>x:print("dangerous")
elif b-a<=0:print("delicious")
else:print("safe") |
s758786673 | p03679 | u519939795 | 1588639946 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 122 | x,a,b=map(int,input().split())
if b-a<x:
print('delicious')
elif b-a=x:
print('safe')
else:
print('dangerous') |
s384846277 | p03679 | u419963262 | 1588423876 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 103 | x,a,b=map(int,input().split())
print("delicious")if a>b print("safe")elif x+a>b else print("dangerous") |
s647658824 | p03679 | u383450070 | 1588165280 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 97 | x,a,b=map(nt,input().split())
print("delicious" if a-b>=0 else "safe" if b-a<=x else "dangerous") |
s203982933 | p03679 | u681323954 | 1588163692 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 125 | x,a,b = map(int, input().split())
if b-a <= 0:
print("delicious")
elif b-a =< x:
print("safe")
else:
print("dangerous") |
s007978309 | p03679 | u423665486 | 1588129988 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 236 | from math import factorial
def resolve():
n, m = map(int, input().split())
mod = 10**9+7
if abs(n - m) > 1:
print(0)
return
a = factorial(m) % mod * factorial(n) % mod
if (n + m) % 2 == 0:
a = a * 2 % mod
print(a)
resolve() |
s575894283 | p03679 | u855378574 | 1587944554 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38640 | 181 | N = int(input())
S = [int(input()) for i in range(N)]
count=1
i=0
while True:
if S[i]==2 or count==N:
print(count)
exit()
else:
count+=1
i=S[i]-1
print(-1)
|
s847947409 | p03679 | u191394596 | 1587836315 | Python | PyPy3 (2.4.0) | py | Runtime Error | 184 | 38384 | 1304 | from sys import stdin
from collections import namedtuple
from heapq import heappush, heappop
input = stdin.readline
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.size = [1] * (n + 1)
def is_same(self, a, b):
return self.find(a) == self.find(b)
def unite(self, a... |
s766054890 | p03679 | u078349616 | 1587685602 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 148 | X, A, B = map(int, input().split())
if B - A <= 0:
print("delicious")
elif:
0 < B - A and B - A <= X:
print("safe")
else:
print("dangerous") |
s600265134 | p03679 | u078349616 | 1587685531 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 137 | X, A, B = map(int, input().split())
if B - A <= 0:
print("delicious")
elif:
0 < B - A < X:
print("safe")
else:
print("dangerous") |
s110963602 | p03679 | u252964975 | 1587266449 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 117 | X,A,B=map(int, input().split())
if A>=B:
print('delicious')
elif A+X>=N:
print('safe')
else:
print('dangerous') |
s982397321 | p03679 | u172780602 | 1587245258 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 146 | x,a,b=map(int,input().split())
if b-a=<x and b-a<=0:
print("delicious")
elif b-a<=x and b-a>0:
print("safe")
else:
print("dangerous") |
s780580232 | p03679 | u852790844 | 1586641927 | Python | Python (3.4.3) | py | Runtime Error | 301 | 42644 | 277 | N = 10**6
mod = 10**9 + 7
fact = [1]
for i in range(1, N+1):
fact.append(fact[-1]*i%mod)
n, m = map(int, input().split())
if n - m > 1 or m - n > 1:
ans = 0
elif n - m == 0:
ans = 2 * fact[n] * fact[m] % mod
else:
ans = fact[n] * fact[m] % mod
print(ans) |
s257260686 | p03679 | u358254559 | 1586363423 | Python | PyPy3 (2.4.0) | py | Runtime Error | 163 | 38256 | 116 | x,a,b=map(int, input().split())
if b<=a:
print("delicious")
elif a+x>b:
print("dangerous")
else:
print("safe" |
s296188916 | p03679 | u920621778 | 1586129438 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38256 | 382 | def test():
mod = 10**9 + 7
n, m = map(int, input().split())
if abs(n-m) > 1:
print(0)
exit()
i_n = n
i_m = m
np = 1
mp = 1
while True:
np = (np%mod) * (i_n%mod)
mp = (mp%mod) * (i_m%mod)
i_n -= 1
i_m -= 1
if i_n < 1:
i_n = 1
if i_m < 1:
i_m = 1
if i_n == 1 and i_m == 1:
break
s = 2 ... |
s032053746 | p03679 | u843318346 | 1585879181 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 134 | x,a,b = map(int,input().split())
kigen = b-a
if x>kigen:
print('delicious')
elif x=kigen:
print('safe')
else:
print('dangerous') |
s299619774 | p03679 | u440129511 | 1585315755 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 117 | x,a,b=int(input().split())
if a-b>=0:print('delicious')
elif a-b < 0 and a+x>=b:print('safe')
else:print('dangerous') |
s033849879 | p03679 | u709030770 | 1584923413 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 39024 | 123 | if A + X - B < 0:
print('dangerous')
elif A - B >= 0 :
print('delicious')
elif A + X + B >= 0:
print('safe')
|
s939582781 | p03679 | u709030770 | 1584923299 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 120 |
DL = A + X - B
if DL < 0:
print('dangerous')
elif A - B >= 0 :
print('delicious')
elif DL >= 0:
print('safe')
|
s491977953 | p03679 | u709030770 | 1584923012 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 119 |
DL = A + X - B
if DL < 0:
print('dangerous')
elif A - B >= 0 :
print('delicious')
elif DL > 0:
print('safe')
|
s693398303 | p03679 | u753542444 | 1584578360 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 151 | x, buy, eat = int(input().split())
if buy > eat:
print("delicious")
elif eat-buy < x:
print("safe")
elif eat - buy > x:
print("dangerous") |
s019976482 | p03679 | u936391676 | 1583100559 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 217 | input_list = input().split(" ")
syoumi = int(input_list[0])
mae = int(input_list[1])
eat = int(input_list[2])
if eat < mae:
print("delicious")
else if (eat - mae) < syoumi:
print("safe")
else:
print("dangerous") |
s840991562 | p03679 | u139112865 | 1583010789 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 102 | #054_A
a,b=map(int,input().split())
print('Draw' if a==b else 'Alice' if (a-2)%13>(b-2)%13 else 'Bob') |
s855928991 | p03679 | u527993431 | 1581770275 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 121 | X,A,B=map(int,input().split())
if A>=B:
print("delicious")
elif A<B and B=<A+X:
print("safe")
else:
print("dangerous") |
s060530894 | p03679 | u676029460 | 1581770162 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 120 | a,b,c = map(int,input().split())
if(c-b>a): print("dangerous")
else if(c-b<=0): print("delicious")
else : print("safe")
|
s320631914 | p03679 | u185424824 | 1581599595 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 131 | X,A,B = map(int.input().split())
C = B - A
if C <= 0:
print("delicious")
elif C > X:
print("dangerous")
else:
print("safe") |
s949548592 | p03679 | u934052933 | 1580270368 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 425 |
def main():
N = int(input())
a = [int(input()) for _ in range(N)]
b = a[0]
count = 1
if b == 2:
ans = 1
else:
while True:
count += 1
b = a[b - 1]
if b == 2:
ans = count
break
if count ... |
s818560412 | p03679 | u462329577 | 1580163531 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38256 | 120 | x,a,b = = map(int,input().split())
if b <= a: print("delicious")
elif b <= a + x: print("safe")
else: print("dangerous") |
s871607395 | p03679 | u118211443 | 1579840652 | Python | PyPy3 (2.4.0) | py | Runtime Error | 163 | 38384 | 223 | import math
n, m = map(int, input().split())
w = 10 ** 9 + 7
if n + 1 == m or m + 1 == n:
print(math.factorial(min(n, m)) ** 2 * max(n, m) % w)
elif n == m:
print(2 * math.factorial(n) ** 2 % w)
else:
print(0)
|
s516101479 | p03679 | u686036872 | 1579607944 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 140 | X, A, B = map(int, input().split())
if A <= B:
print("delicious")
if (B-A) <= X:
pirint("safe")
if X < (B-A):
print("dangerous") |
s873158541 | p03679 | u686036872 | 1579607888 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 140 | X, A, B = map(int, input().split())
if A <= B:
print("delicious")
if (B-A) <= X:
pirnt("safe")
if X < (B-A):
print("dangerous")
|
s381809053 | p03679 | u686036872 | 1579607524 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 143 | X, A, B = map(int, input().split())
if A <= B:
print("delicious")
elif (B-A) <= X:
pirnt("safe")
elif X < (B-A):
print("dangerous") |
s610083657 | p03679 | u686036872 | 1579607456 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 133 | X, A, B = map(int, input().split())
if A <= B:
print("delicious")
elif (B-A) <= X:
pirnt("safe")
else:
print("dangerous") |
s919333760 | p03679 | u690037900 | 1579280616 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 99 | a,b,c = map(int,input().split())
print("delicious" if b=c else "safe" if c-b-1<=a else "dangerous") |
s523181288 | p03679 | u473023730 | 1578635332 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 133 | x,a,b=map(int,input().split())
if b-a<=0:
print("delicious")
elif b-a=0 and x-(b-a)>=0:
print("safe")
else:
print("dangerous")
|
s617908071 | p03679 | u530786533 | 1578550399 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 370 | n = int(input())
a = []
b = []
for i in range(n):
a.append(int(input()))
b.append(0)
# 1: now, -1: visited, 0: none
b[0] = 1
now = 0
count = 0
while (b[1] != 1 and count <= n):
next = a[now] - 1
if (b[next] == -1):
print(-1)
exit()
b[now] = -1
b[next] = 1
now = next
count += 1
i... |
s434341283 | p03679 | u079022116 | 1578290373 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 125 | x,a,c=map(int,input().split())
if -1*a+b <= 0:
print('delicious')
elif -1*a+b <= x:
print('safe')
else:print('dangerous') |
s987479983 | p03679 | u058592821 | 1578270143 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 137 | x, a, b = (int(i) for i in input().split())
if b-a <= 0:
print('delicious')
elif b-a <= X:
print('safe')
else:
print('dengerous') |
s631912002 | p03679 | u972892985 | 1578116677 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 143 | x, a, b = map(int,input().split())
if x => abs(b - a):
print("safe")
elif x <= abs(b - a):
print("dangerous")
else:
print("delicious")
|
s922726135 | p03679 | u972892985 | 1578116644 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 143 | x, a, b = map(int,input().split())
if x >= abs(b - a):
print("safe")
elif x =< abs(b - a):
print("dangerous")
else:
print("delicious")
|
s612441258 | p03679 | u668352391 | 1578005054 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 143 | x, a, b = map(lambda x: int(x), input().split())
if b =< a:
print('delicious')
elif x <= b - a:
print('safe')
else:
print('dangerous') |
s804088406 | p03679 | u185037583 | 1577628336 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 100 | x,a,b=map(int,input().split())
print('delicious' if b-a<=0 else 'safe' if b-a<x+1 else 'dangerous
') |
s989216566 | p03679 | u717265305 | 1577583460 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3316 | 147 | n=int(input())
a = [int(input()) for _ in range(n)]
pos=0
for i in range(n):
if a[pos] == 2:
print(i+1)
exit()
pos = a[pos]-1
print(-1) |
s390743923 | p03679 | u119655368 | 1577207018 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 250 | import math
a, b = map(int, input().split())
if abs(a - b) >= 2:
print(0)
else:
x = math.factorial(a)
y = math.factorial(b)
ans = x * y
if a == b:
print(ans * 2 % (10 ** 9 + 7))
else:
print(ans % (10 ** 9 + 7)) |
s796476865 | p03679 | u112567325 | 1576870189 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 127 | x,a,b = list(map(int,input().split()))
if b >= c:
print("delicious")
elif a+b < c:
print("dangerous")
else:
print("safe") |
s667134654 | p03679 | u994521204 | 1576267813 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 137 | x,a,b=map(int,input().split())
if b in range(a):
print('delicious')
elif bin range(a,x+a+1):
print('safe')
else:
print('dangerous') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.