problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02982
s190203667
Accepted
#!/usr/bin/env python3 import itertools import math def dist(xs, ys): ans = 0 for x, y in zip(xs, ys): ans += (x - y) ** 2 return math.sqrt(ans) def main(): N, D = map(int, input().split()) Xs = [list(map(int, input().split())) for _ in range(N)] ans = 0 for i, j in itertools.combinations(range(N), 2): d = dist(Xs[i], Xs[j]) if d == int(d): ans += 1 print(ans) if __name__ == '__main__': main()
p03289
s722906535
Accepted
s = input() l = [] for i in s: l.append(i) if l[0] != "A": print("WA") else: if len(l) == 3: if l[1].islower() and l[2] == "C": print("AC") else: print("WA") else: l.remove("A") if "C" not in l[1:len(l)-1]: print("WA") else: l.remove("C") s = "".join(l) if s.islower(): print("AC") else: print("WA")
p02801
s521228297
Accepted
n = input() data = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] for i in range(0,len(data)-1): if data[i] == n: print(data[i+1])
p03657
s911417935
Accepted
A_mai, B_mai = map(int, input().split()) summ = A_mai + B_mai if (A_mai % 3 == 0 or B_mai % 3 == 0 or summ % 3 == 0): print('Possible') else: print('Impossible')
p02689
s690051827
Accepted
n,m=map(int,input().split()) h=list(map(int,input().split())) l1=[] l2=[] l=[0]*n for i in range(m): a,b=map(int,input().split()) if a>b: c=a a=b b=c k=[a,b] l1.append(k) c=a a=b b=c k=[a,b] l2.append(k) l1.sort() l2.sort(reverse=True) for i in l1: if h[i[0]-1]<=h[i[1]-1]: l[i[0]-1]+=1 for i in l2: if h[i[0]-1]<=h[i[1]-1]: l[i[0]-1]+=1 print(l.count(0))
p03061
s200550039
Accepted
from fractions import gcd n=int(input()) a=list(map(int,input().split(' '))) east=[0]*(n+1) west=[0]*(n+1) for i in range(1,n+1): east[i]=gcd(east[i-1],a[i-1]) west[-i-1]=gcd(west[-i],a[-i]) ans=0 for k in range(1,n+1): tmp=gcd(east[k-1],west[k]) if tmp>ans: ans=tmp print(ans)
p03986
s973434402
Accepted
X = input() N = len(X) cnt_s = 0 ans = N for i in range(N): if X[i] == "S": cnt_s += 1 else: if cnt_s > 0: ans -= 2 cnt_s -= 1 print(ans)
p02693
s877003132
Accepted
K=int(input()) A,B=map(int,input().split()) for i in range(A,B+1): if i%K==0: print('OK') exit(0) print('NG')
p02911
s200639432
Accepted
N,K,Q=map(int,input().split()) D=[0]*(N+1) for _ in range(Q): D[int(input())]+=1 for i in range(1,N+1): if K+D[i]-Q>0: print("Yes") else: print("No")
p03644
s425485521
Wrong Answer
N = int(input()) max_count = 0 ans = 0 def div2(x, count): x, mod = divmod(x, 2) if mod != 0: return count else: if x == 1: return count+1 return div2(x, count+1) for x in range(1, N+1): count = div2(x, 0) if count > max_count: max_count = count ans = x print(ans)
p03317
s540956807
Wrong Answer
N,K = list(map(int, input().split())) A = list(map(int, input().split())) #A.sort() arr = [] for i in range(1,K): if N % i == 0: arr.append(i) #print(arr) tmp = max(arr) #print(tmp) if N==K: tmp = N print(N//tmp)
p02615
s647707992
Accepted
N=int(input()) A=list(map(int,input().split())) A=sorted(A,reverse=True) point=0 for i in range(N-1): point+=A[(i+1)//2] print(point)
p02645
s011399478
Wrong Answer
import random a=input() print(a) print(len(a)) nagasa=len(a) num = random.randint(1,nagasa-2)-1 print(num) numr = num+3 print(a[num:numr])
p03360
s304641667
Accepted
A=list(map(int,input().split())) K=int(input()) A.sort() print(A[2]*2**K+A[1]+A[0])
p03211
s035653493
Accepted
s = input() a = len(s) s_list = [] t = 3 while t <= a: u = abs(int(s[t-3:t])-753) s_list.append(u) t += 1 print(min(s_list))
p02583
s512156368
Wrong Answer
import itertools N=int(input()) LN=list(input().split(' ')) print(LN) LN.sort(key=int) LN_sort=list(dict.fromkeys(LN)) print(LN_sort) cbn=list(itertools.combinations(LN_sort,3)) cnt=int(0) for i in range(len(cbn)): if int(cbn[i][0])+int(cbn[i][1])>int(cbn[i][2]): cnt+=LN.count(cbn[i][0])*LN.count(cbn[i][1])*LN.count(cbn[i][2]) print(cnt)
p03137
s749596455
Accepted
#import sys #import numpy as np import math #import itertools #from fractions import Fraction #import itertools from collections import deque from collections import Counter #import heapq #from fractions import gcd #input=sys.stdin.readline #import bisect n,m=map(int,input().split()) a=list(map(int,input().split())) a.sort() d=[0]*m for i in range(1,m): d[i]=a[i]-a[i-1] d.sort(reverse=True) print(sum(d[n-1:]))
p03695
s453096152
Wrong Answer
N = int(input()) a = list(map(int, input().split())) num = 0 if min(a) >= 3200: num = 1 else: for i in range(8): for j in range(N): if 400*i <= a[j] and a[j] < 400*(i+1): num += 1 break num_max = num for k in a: if k >= 3200 and num < min(8, N): num_max += 1 ans = [str(num), str(num_max)] print(" ".join(ans))
p02694
s216578256
Accepted
import math X = int(input()) yen = 100 n = 0 while yen < X: n = n + 1 yen = math.floor(yen*1.01) if X <= yen: print(n)
p02555
s936814116
Accepted
n = int(input()) m = 10**9 + 7 # ans = [0] * (n + 1) ans = [0] * 2200 ans[0] = 1 # ans[3] = 1 # ans[4] = 1 # ans[5] = 1 for i in range(3, n + 1): ans[i] = ans[i - 1] + ans[i - 3] ans[i] %= m # for j in range(i - 2): # ans[i] += ans[j] # ans[i] %= m print(ans[n]) # print(ans[:10])
p02772
s167747491
Accepted
n = int(input()) a = list(map(int,input().split())) for i in range(n): if a[i] %2 == 0: if a[i]%3 != 0: if a[i]%5 != 0: print("DENIED") exit() print("APPROVED")
p02779
s525421312
Wrong Answer
# C import numpy as np N = int(input()) A = list(map(int,input().split())) All_diff=[A[i]-A[j] for i,j in zip(range(N),range(N)) if i<j] prod=np.prod(All_diff) if prod > 0 or prod < 0: print("No") else: print("Yes")
p03821
s987584931
Accepted
import numpy N = int(input()) A, B = numpy.array([list(map(int, input().split())) for _ in range(N)]).T A = A[::-1] B = B[::-1] ans = 0 for i in range(N): a, b = A[i], B[i] # need to do nothing if (a + ans) % b == 0: continue else: ans += b - (a + ans) % b print(ans)
p03721
s032838863
Wrong Answer
#!/usr/bin/env pytHon3 # -*- coding: utf-8 -*- def main(): N, K = map(int, input().split()) for _ in range(N): a, b = map(int, input().split()) K -= b if K <= 0: break print(a) if __name__ == "__main__": main()
p02623
s830173061
Wrong Answer
N,M,K=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) i=0 j=0 t=0 A.append(1000000001) B.append(1000000001) while t < K: if A[i]>=B[j] and t+B[j]<=K: t+=B[j] j+=1 elif A[i]<B[j] and t+A[i]<=K: t+=A[i] i+=1 else: break print(i+j)
p02572
s785113742
Accepted
import numpy as np N = int(input()) A = list(map(int, input().split())) B = [0] * (N+1) # 累積和テーブル B[i] = sum(A[:i]) mod = 10**9 + 7 ans = 0 for i in range(N): B[i+1] = B[i] + A[i] # 累積和 for i in range(N): sum = (B[N] - B[i+1]) % mod ans += A[i] * sum ans %= mod print(int(ans))
p02813
s705308452
Wrong Answer
import itertools N = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) dict_list = list(itertools.permutations(sorted(a), len(a))) a_pos=0 b_pos=0 for i,dic in enumerate(dict_list): if list(dic) == a: a_pos=i elif list(dic) == b: b_pos=i print(abs(a_pos-b_pos))
p03252
s854535988
Wrong Answer
from collections import Counter s = list(input()) t = list(input()) sc = Counter(s) tc = Counter(t) scc = sorted(sc.values()) tcc = sorted(tc.values()) if len(scc) == len(tcc): for i in range(len(scc)): if scc[i] == tcc[i]: continue else: print('No') break print('Yes') else: print('No')
p03795
s074707254
Accepted
n = int(input()) i = int(n/15) print(800*(n) - 200*i)
p03030
s983660536
Wrong Answer
from operator import itemgetter N=int(input()) hako=[] for i in range(N): A,B=input().split() hako.append([A,int(B)*-1]) kari=hako.copy() #print(kari) hako.sort() hako=sorted(hako,key=itemgetter(0,1)) #print(hako) for i in range(N): print(hako.index(kari[i])+1)
p02754
s532061626
Accepted
#!/usr/bin/env python3 import sys import collections as cl def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def main(): N,A,B = MI() oneset = A + B rep = N // oneset print(rep * A + min(N % oneset,A)) main()
p02753
s280638694
Accepted
print(["No","Yes","Yes","No"][sum([s=="A" for s in input()])])
p03434
s930534674
Accepted
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) alice = 0 bob = 0 for i, a in enumerate(A): if (i % 2 == 0): alice += a else: bob += a print(alice - bob)
p03161
s749788374
Accepted
n, k = map(int,input().split()) h = list(map(int,input().split())) INF = float('inf') dp = [INF] * n dp[0] = 0 dp[1] = abs(h[1] - h[0]) for i in range(2,n): for j in range(1, min(i, k) + 1): dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i -j])) print(dp[n - 1])
p03251
s169124579
Wrong Answer
n,m,x,y=map(int,input().split()) x_=list(map(int,input().split())) y_=list(map(int,input().split())) x_.append(x) y_.append(y) x_.sort() y_.sort() if y_[0]>x_[-1]: print('NoWar') else: print('War')
p02621
s736056273
Accepted
a = int(input()) print(a+a*a+a*a*a)
p02783
s105348722
Accepted
h, a = map(int, input().split()) print(-(-h//a))
p04033
s857839177
Accepted
def main(): a, b = map(int, input().split()) if a > 0: print("Positive") return if b > 0 and a <= 0: print("Zero") return print("Positive" if(b - a + 1) % 2 == 0 else "Negative") if __name__ == '__main__': main()
p02678
s264988822
Wrong Answer
print("Yes") print(6) print(5) print(5) print(1) print(1)
p02556
s125086395
Accepted
N=int(input()) x=[list(map(int,input().split())) for _ in range(N)] A=[] B=[] C=[] D=[] for i in range(N): A.append(x[i][0]+x[i][1]) B.append(-x[i][0]-x[i][1]) C.append(x[i][0]-x[i][1]) D.append(-x[i][0]-x[i][1]) print(max(max(A)-min(A),max(B)-min(B),max(C)-min(C),max(D)-min(D)))
p02756
s564654930
Accepted
I = input s = I() q = int(I()) a = [], [] i = 0 for _ in range(q): x = I() if x[0] == '1': i ^= 1 else: f = int(x[2]) - 1 a[i ^ f].append(x[4]) print(''.join(reversed(a[i])) + (s[::-1] if i else s) + ''.join(a[i^1]))
p03161
s971909335
Wrong Answer
n, k = map(int,input().split()) h = list(map(int,input().split())) ans = [] for i in range(n): if i == 0: ans.append(0) else: x = 10**5 for j in range(k): if i-j-1 < 0: break y = ans[-j-1] + abs(h[i]-h[i-j-1]) if y < x: x = y ans.append(x) print(ans[-1])
p04031
s844472792
Wrong Answer
from math import * n=int(input()) l=list(map(int,input().split())) s=ceil(sum(l)/n) c=0 for i in range(n): c+=(s-l[i])**2 print(c)
p03779
s130634627
Wrong Answer
X = int(input()) i = 1 cnt = 0 n = X while cnt+i<=X: cnt += i if X-cnt==0: n = i break if X-cnt>i: n = min(n,X-cnt) i += 1 print(n)
p03264
s533121253
Accepted
K=int(input()) if(K%2==0): num=(K/2)**2 else: num=(K-1)/2*(((K-1)/2)+1) print(int(num))
p03210
s641710315
Accepted
icase=0 if icase==0: x=int(input()) if x==7 or x==5 or x==3: print("YES") else: print("NO")
p03160
s303435427
Accepted
n, *h = map( int, open( 0 ).read().split() ) d = [ 0 ] * n d[ 1 ] = abs( h[ 1 ] - h[ 0 ] ) for i in range( 2, n ): d[ i ] += min( d[ i - 1 ] + abs( h[ i ] - h[ i - 1 ] ), d[ i - 2 ] + abs( h[ i ] - h[ i - 2 ] ) ) print( d[ n - 1 ] )
p03545
s662571750
Accepted
def dfs(i,Str,res): if i==num-1: if res==7: print(Str+"=7") exit() return dfs(i+1,Str+"+"+S[i+1],res+int(S[i+1])) dfs(i+1,Str+"-"+S[i+1],res-int(S[i+1])) S=input() num=len(S) dfs(0,S[0],int(S[0]))
p03377
s442703675
Wrong Answer
A,B,X=map(int,input().split()) if A<=X and B>=X: print("YES") else: print("NO")
p02888
s248726990
Wrong Answer
import bisect n = int(input()) l = list(map(int, input().split())) l.sort() print(l) ans = 0 for a in range(n-2): for b in range(a+1, n-1): ans += bisect.bisect_left(l[b+1:], l[b]+l[a]) - bisect.bisect(l[b+1:], l[b]-l[a]) print(ans)
p03719
s519122538
Accepted
a, b, c = map(int, input().split()) print("Yes" if a <= c <= b else "No")
p03633
s834666831
Accepted
import sys readline = sys.stdin.readline from fractions import gcd def main(): N = int(readline()) ans = 1 for _ in range(N): t = int(readline()) ans = (ans * t) // gcd(ans, t) print(ans) if __name__ == '__main__': main()
p02683
s257859331
Accepted
import numpy as np import itertools Cmin = 10**10 N, M, X = map(int, input().split()) L = np.array([[int(j) for j in input().split()] for i in range(N)]) for i in range(N): for idx in itertools.combinations(list(range(N)), i+1): A = np.zeros(M+1, dtype=int) for j in idx: A = A + L[j] if A[0] < Cmin and (A[1:] >= X).all() == True: Cmin = A[0] if Cmin == 10**10: print(-1) exit() print(Cmin)
p03106
s794781075
Accepted
#ABC120B #AもBも割り切る正の整数のうちK番目に大きいものを求める A,B,K = map(int, input().split()) common_div = [] for i in range(min(A,B)+1,0,-1): if A%i==0 and B%i==0: common_div.append(i) #print(common_div) print(common_div[K-1])
p03720
s289162150
Accepted
N, M = map(int, input().split()) G = [[] for _ in range(N)] for _ in range(M): a, b = map(int, input().split()) G[a - 1].append(b - 1) G[b - 1].append(a - 1) for g in G: print(len(g))
p02555
s108528211
Accepted
import math s=int(input()) if s<3: print(0) else: k=math.factorial(s-3) l=k m=1 num=0 for i in range(1,s//3+1): num+=l//(k*m) num%=10**9+7 if i!=s//3: l//=(s-2*i-1)*(s-2*i-2) k//=(s-3*i)*(s-3*i-1)*(s-3*i-2) m*=i print(num%(10**9+7))
p02957
s540090840
Accepted
#!/usr/bin/env python3 c = eval(input().replace(" ", "+")) print(c // 2 * (c % 2 < 1) or "IMPOSSIBLE")
p02706
s699614556
Wrong Answer
n,m =map(int,input().split()) a =list(map(int,input().split())) if sum(a)>=n: print('-1') else: print(n-sum(a))
p03241
s543528369
Accepted
def main(): N, M = map(int, input().split(" ")) for i in range(M // N, 0, -1): if M % i == 0 and i <= M / N: print(i) break if __name__ == '__main__': main()
p02630
s073197258
Wrong Answer
import collections N = int(input()) A = list(map(int,input().split())) Q = int(input()) l=[] for _ in range(Q): l.append(list(map(int,input().split()))) c = collections.Counter(A) sum=sum(A) for i in range(Q): if c[l[i][0]] == 0: print(sum) break else: sum+=c[l[i][0]]*(l[i][1]-l[i][0]) c[l[i][1]]+=c[l[i][0]] del c[l[i][0]] print(sum)
p02918
s954100167
Accepted
n,k=list(map(int,input().split())) S=input() c,row_count=S[0],1 for s in S: if c != s: c = s row_count += 1 if row_count-k*2 <= 1: row_count = 1 else: row_count -= k*2 print(n-row_count)
p04020
s400178746
Accepted
def solve(A): res = 0 b = 0 for a in A: a += b res += a//2 if a == b: b = 0 else: b = a%2 return res if __name__ == '__main__': N = int(input()) A = [int(input()) for _ in range(N)] print(solve(A))
p03657
s759212846
Accepted
a, b = list(map(int, input().split())) if (a%3 == 0) or (b%3 == 0) or ((a+b)%3 == 0): print("Possible") else: print("Impossible")
p03449
s846181493
Accepted
n=int(input()) upper=list(map(int,input().split())) lower=list(map(int,input().split())) m=0 for i in range(n): s=sum(upper[:i+1])+sum(lower[i:]) m=max(s,m) print(m)
p02777
s090010922
Wrong Answer
def main(): S,T = input().split() a,b = map(int,input().split()) u = input() print(a-1,b if S == u else a,b-1) return if __name__ == "__main__": main()
p03998
s900912874
Accepted
A=list(input()) B=list(input()) C=list(input()) t="a" while True: if t=="a": if not A: print("A") break else: t=A.pop(0) elif t=="b": if not B: print("B") break else: t=B.pop(0) else: if not C: print("C") break else: t=C.pop(0)
p03448
s113456984
Accepted
A = int(input()) B = int(input()) C = int(input()) X = int(input()) i=0 for a in range(0,A+1): for b in range(0,B+1): for c in range(0,C+1): if 500*a + 100*b + 50*c == X: i = i+1 print(i)
p02911
s535635586
Accepted
from collections import Counter n, k, q = map(int, input().split()) A = [int(input()) for _ in range(q)] C = Counter(A) for i in range(1, n+1): if C[i] + k - q <= 0: print('No') else: print('Yes')
p03971
s736954616
Accepted
n, a, b = map(int, input().split()) s = input() A = 0 B = 0 for i in range(len(s)): if s[i] == "a": if A + B < a + b: print("Yes") A += 1 else: print("No") elif s[i] == "b": if A + B < a + b and B < b: print("Yes") B += 1 else: print("No") else: print("No")
p02880
s917198147
Accepted
from itertools import product N = int(input()) print("Yes" if N in {a*b for a,b in product(range(1, 10), range(1, 10))} else "No")
p03696
s580970192
Accepted
N = int(input()) S = input() l = 0 r = 0 for i in range(N): if S[i]==")": r -= 1 if r<0: l += 1 r = 0 else: r += 1 ans = "("*l + S + ")"*r print(ans)
p03838
s611139903
Accepted
x, y = map(int, input().split()) if 0 <= x <= y or x <= y <= 0: print(y - x) elif x <= 0 <= y: if x == 0 or y == 0: print(abs(x + y)) else: print(abs(y + x) + 1) elif 0 <= y <= x or y <= x <= 0: if x == 0 or y == 0: print(abs(x - y) + 1) else: print(abs(x - y) + 2) else: print(abs(x + y) + 1)
p03605
s465583342
Accepted
n = input('') if n[0] == '9' or n[1] == '9': print('Yes') else: print('No')
p03317
s640405977
Accepted
import math n, k = map(int, input().split()) a = [int(_) for _ in input().split()] if n == k: print(1) exit() idx = a.index(1) num_l = idx num_r = n - idx - 1 print(math.ceil((n-1) / (k-1)))
p02630
s383005638
Accepted
from collections import Counter import sys input = sys.stdin.readline n = int(input()) a = list(map(int, input().split())) q = int(input()) bc = [list(map(int, input().split())) for _ in range(q)] ans = sum(a) a = Counter(a) for b, c in bc: ans = ans + (c - b) * a[b] a[c] += a[b] a[b] = 0 print(ans)
p02615
s711656225
Accepted
N = int(input()) A = list(map(int, input().split())) A.sort(reverse = True) ans = A[0] counter = 0 idx = 1 for _ in range(N-2): ans += A[idx] counter += 1 if counter == 2: idx += 1 counter = 0 print(ans)
p02696
s532696486
Wrong Answer
# A, B, N = map(int, input().split()) A, B, N = 5, 7, 4 A, B, N = map(int, input().split()) def calculate(a, b, n): s1 = a * n // b if n == b: s1 = a*(n-1) // b if N > b: if n >= 2 * b: x = b + b - 1 else: x = n return max(s1,(a * x) // b + a * (x // b)) return s1 print(calculate(A, B, N))
p03544
s040941437
Wrong Answer
N=int(input()) x0=2 x1=1 x=0 if N==1: x=2 elif N==2: x=1 else: for i in range(N-1): x=x1+x0 x0=x1 x1=x print(x)
p02754
s021682111
Accepted
#!/usr/bin/env python # coding: utf-8 def ri(): return int(input()) def rl(): return list(input().split()) def rli(): return list(map(int, input().split())) def main(): n, a, b = rli() p = n // (a+b) ans = p*a+min(n%(a+b), a) print(ans) if __name__ == '__main__': main()
p03456
s442941083
Accepted
import sys import math A,B=input().split() X=int(A+B) print('Yes' if math.sqrt(X).is_integer() else 'No')
p02711
s657902632
Accepted
n = input() if '7' in n: print('Yes') else: print('No')
p03030
s054611004
Accepted
n = int(input()) r = [input().split() for _ in range(n)] print(*sorted(range(1, n + 1), key=lambda i: (r[i-1][0], -int(r[i-1][1]))), sep='\n')
p03720
s018726487
Wrong Answer
N, M = map(int, input().split()) r = [0]*N for _ in range(M): a, b = map(int, input().split()) r[a-1]+1 r[b-1]+1 for rr in r: print(rr)
p02706
s534622454
Wrong Answer
import numpy as np A=list(input().split()) print(A, A[0], int(A[0])) N=int(A[0]) M=int(A[1]) B=list(input().split()) k=0 for i in range(len(B)): k+=int(B[i]) print(N-k if N-k>=0 else -1)
p02691
s990327756
Accepted
from collections import Counter n=int(input()) A=list(map(int,input().split()) ) left = [i+A[i] for i in range(n)] right = [i-A[i] for i in range(n)] r_counter = Counter(right) ans = 0 for l in left: ans += r_counter[l] print(ans)
p02677
s384216487
Accepted
A,B,H,M=map(int,input().split()) import math k=math.cos(math.pi*((H/6)-((11*M)/360))) L=(A**2+B**2-2*A*B*k)**0.5 print(L)
p03136
s657042156
Accepted
N = int(input()) L = list(map(int,input().split())) if max(L) * 2 < sum(L): print("Yes") else: print("No")
p02923
s661359999
Wrong Answer
n=int(input()) h=list(map(int,input().split())) ct=0 ans=0 flag=0 for i in range(n-1): ct+=1 if h[i]<h[i+1]: flag+=1 if ans<ct: ans=ct ct=0 if ans<ct: ans=ct if flag==(n-1): print(0) else: print(ans)
p03485
s068032807
Accepted
print(-~sum(map(int,input().split()))//2)
p02879
s318534905
Wrong Answer
x = input().split() a = int(x[0]) b = int(x[0]) if a <= 9 and b <= 9: print(a * b) else: print('-1')
p03679
s975026079
Accepted
X, A, B = map(int,input().split()) if B <= A: print("delicious") elif B <= X + A: print("safe") else: print("dangerous")
p03943
s064963353
Accepted
a=[int(i) for i in input().split()] a.sort() print("Yes" if a[2] == a[0]+a[1] else "No")
p03681
s975991208
Accepted
N, M = map(int, input().split()) from math import factorial mod = 10**9+7 if abs(N-M) > 1: print(0) elif abs(N-M) == 1: print(factorial(N)*factorial(M)%mod) else: print(2*factorial(N)*factorial(M)%mod)
p02576
s726734161
Accepted
import math N, X, T = input().strip().split(' ') count = math.ceil(int(N)/int(X)) time = int(T) * count print(time)
p03208
s761592016
Accepted
n,k=map(int,input().split()) h=[int(input()) for i in range(n)] a=sorted(h) ans=a[k-1]-a[0] for i in range(1,n-k+1): if a[k+i-1]-a[i]<ans: ans=a[k+i-1]-a[i] print(ans)
p03698
s763894739
Accepted
S=list(input()) a,b=len(S),len(set(S)) if a==b: print('yes') else: print('no')
p02759
s895363987
Accepted
n = int(input()) if n%2 == 0: print(n//2) else: print(n//2+1)
p02621
s223207109
Accepted
a = int(input()) x = a + a**2 + a**3 print(x)
p02690
s975271208
Wrong Answer
X = int(input()) A = -10 B = -10 for A in range(-10, 100): for B in range(-10, 100): if(A ** 5) - (B ** 5) != X: continue print(A, B) break
p03408
s986770206
Accepted
from collections import Counter n = int(input()) s = Counter([input() for _ in range(n)]) m = int(input()) t = Counter([input() for _ in range(m)]) ans = 0 for x,y in s.items(): a = y if x in t: a -= t[x] if ans < a: ans = a print(ans)