problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02988
s984822025
Accepted
n=int(input()) p=list(map(int,input().split())) cnt=0 for i in range(1,len(p)-1): if p[i]>p[i-1] and p[i]<=p[i+1]: cnt+=1 elif p[i]<=p[i-1] and p[i]>p[i+1]: cnt+=1 print(cnt)
p03456
s886730012
Accepted
a, b = map(str, input().split()) ab = a+b ab = int(ab) for i in range(320): if ab == i**2: print("Yes") exit() print("No")
p03814
s235803190
Accepted
s = str(input()) a = 200000 z = 0 for i in range(len(s)): if s[i] == "A": a = min(a, i) elif s[i] == "Z": z = max(z, i) print(z - a + 1)
p03061
s300035637
Accepted
from fractions import gcd N = int(input()) A = list(map(int,input().split())) L = [0] * (N + 1) R = [0] * (N + 1) for i in range(N): L[i+1] = gcd(L[i], A[i]) R[N-i-1] = gcd(R[N-i], A[N-1-i]) ans = 0 for i in range(N): ans = max(ans, gcd(L[i], R[i+1])) print(ans)
p02663
s592491152
Wrong Answer
h, m, h2, m2, k = map(int, input().split()) print(12*h2+m2-(12*h+m+k))
p02554
s953619205
Accepted
#import sys #input = sys.stdin.readline Q = 10**9+7 def main(): N = int( input()) ans = pow(10, N, Q) - pow(9, N, Q)*2 + pow(8, N, Q) print( ans%Q) if __name__ == '__main__': main()
p02623
s291210312
Accepted
n, m, k = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] for i in range(n): a += [a[i]+A[i]] for i in range(m): b += [b[i]+B[i]] ans, i = 0, m for j in range(n+1): if a[j] > k: break while b[i] > k-a[j]: i -= 1 ans = max(ans, i+j) print(ans)
p03657
s293011867
Accepted
A, B = map(int, input().split()) if A%3==0 or B%3==0 or (A+B)%3==0: print('Possible') else: print('Impossible')
p03105
s688257255
Wrong Answer
a, b, c = map(int,input().split()) if b - (a * c) > 0: print(c) elif b - (a * c) < 0: print(b // a) elif a > b : print(0)
p03095
s332479960
Accepted
from itertools import groupby as gb n=int(input()) s=sorted(input()) ans=1 mod=10**9+7 for i,x in gb(s): ans=ans*(len(list(x))+1)%mod print(ans-1)
p02866
s930851639
Wrong Answer
n = int(input()) d = list(map(int, input().split())) l = [0]*(max(d)+1) for i in d: l[i] += 1 if l[0] != 1: print(0) exit() ans = 1 for i in range(1, len(l)): ans *= l[i-1]**l[i] print(ans%998244353)
p03030
s224864739
Accepted
N=int(input()) S=[list(map(str,input().split())) for _ in range(N)] for row in S: row[1]=int(row[1]) SS=sorted(S) ins=0 ans=list() tmp=0 for i in SS: if i[0]==tmp: ans.insert(ins,i) else: ins=len(ans) ans.append(i) tmp=i[0] for j in ans: print(S.index(j)+1)
p03617
s531241115
Wrong Answer
Q, H, S, D = map(int, input().split()) N = int(input()) x = N % 2 y = N // 2 arr = [4*Q*x, 2*H*x, S*x] arr1 = [8*Q*y, 4**H*y, 2*S*y, D*y] #if N % 2 == 0: # arr.append(int(0.5*D*N)) #else: # arr.append(int(0.5*D*(N-1)+ min(S, 2*H, 4*Q))) print(min(arr) + min(arr1))
p03679
s115811996
Wrong Answer
x, a, b = map(int, input().split()) if a-b > 0: print("delicious") if a-b < 0: if b-a < x: print('safe') if b > x+a: print("dangerous")
p03795
s140797301
Wrong Answer
N = int(input()) x = 800 * N y = (N % 15) * 200 print(x - y)
p02912
s132435211
Accepted
import heapq n, m = map(int, input().split()) a = list(map(lambda x: int(x)*(-1), input().split())) heapq.heapify(a) while m > 0: a_max = heapq.heappop(a) if a_max == 0: break heapq.heappush(a, (-1)*(-a_max // 2)) m -= 1 print(sum(a)*(-1))
p02842
s886823561
Wrong Answer
n=int(input()) m=round(n/float(1.08)) if int(m*float(1.08))==n: print(m) else: print(':(')
p03146
s088512783
Wrong Answer
s = int(input()) seen = {s} i = 1 while s>1: if s%2==0: s //= 2 else: s = 3*s+1 i += 1 if s in seen: print(i) break seen.add(s) else: print(i+1)
p02952
s938940400
Accepted
a = int(input()) count = 0 for i in range(a + 1): if len(str(i)) % 2 == 1: count += 1 print(count - 1)
p02699
s203398345
Wrong Answer
s = 6 w = 9 S = int(s) W = int(w) if S<=W: print("unsafe") else: print("safe")
p04019
s963087055
Wrong Answer
s = input() count = {"N":0, "W":0, "S":0, "E":0} for i in s: count[i] += 1 if count["N"] == count["S"] and count["W"] == count["E"]: print("Yes") else: print("No")
p02641
s719901157
Accepted
X,N = map(int,input().split()) if N>0: p_set = set(map(int,input().split())) else: p_set = set() min_dist_xp = 1000 for p in reversed(range(0,102)): if p not in p_set: dist_xp = abs(X-p) if dist_xp<=min_dist_xp: min_dist_xp = dist_xp ans = p print(ans)
p03038
s343214240
Accepted
from operator import itemgetter N,M = map(int,input().split()) A = list(map(int,input().split())) BC = [] for i in range(M): B,C = map(int,input().split()) BC.append([B,C]) BC.sort(key = itemgetter(1),reverse=True) change = [] for b,c in BC: change += [c] * b if len(change) > N: break A += change A.sort(reverse=True) answer = sum(A[:N]) print(answer)
p02547
s722176074
Wrong Answer
n = int(input()) count = 0 for i in range(n): d1, d2 = map(int, input().split()) if count > 2: break elif d1 == d2: count += 1 else: count == 0 if count > 2: print("Yes") else: print("No")
p03137
s022582128
Accepted
# import bisect # from collections import Counter, deque # import copy # from fractions import gcd # from functools import reduce # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np import sys sys.setrecursionlimit(10 ** 5 + 10) # input = sys.stdin.readline def resolve(): N,M=map(int,input().split()) X=sorted(list(map(int,input().split()))) l=sorted([X[i+1]-X[i] for i in range(M-1)], reverse=True) print(X[-1]-X[0]-sum(l[:N-1])) resolve()
p02689
s207088211
Accepted
n, m = list(map(int, input().split())) h = list(map(int, input().split())) bests = [1] * n for k in range(m): a, b = list(map(int, input().split())) if h[a -1] > h[b - 1]: bests[b - 1] = 0 elif h[a -1] < h[b - 1]: bests[a - 1] = 0 else: bests[a - 1] = 0 bests[b - 1] = 0 print(sum(bests))
p03126
s741745735
Wrong Answer
n,m=map(int,input().split()) a=list(map(int,input().split())) a.pop(0) for i in range(n-1): x=list(map(int,input().split())) x.pop(0) for j in a: if j not in x: a.remove(j) print(len(a))
p02970
s720324478
Wrong Answer
import math import time from collections import defaultdict, deque from sys import stdin, stdout from bisect import bisect_left, bisect_right n,d=map(int,stdin.readline().split()) print(math.ceil(n/(d+d)))
p03069
s079802362
Accepted
n = int(input()) S = input() #右にある白,左にある黒 cnt = [0]*(n+1) white = S.count(".") black = 0 cnt[0] = white for i in range(n): if S[i] == ".": white -= 1 else: black += 1 cnt[i+1] = black + white print(min(cnt))
p03438
s660760803
Wrong Answer
from sys import stdin N = int(stdin.readline().rstrip()) A = [int(x) for x in stdin.readline().rstrip().split()] B = [int(x) for x in stdin.readline().rstrip().split()] C = [] for i in range(N): C.append(B[i]-A[i]) c_1 = sum([i for i in C if i > 0]) c_2 = sum([i for i in C if i < 0]) if c_1 >= c_2*-2: print("Yes") else: print("No")
p03696
s391360370
Wrong Answer
n = int(input()) s = input() l = s.rfind(')') cntl, cntr = 0, 0 s2 = 0 flag = 0 for i in range(l + 1): if s[i] == '(': cntl += 1 else: cntr += 1 if cntl <= cntr: s1 = '(' * (max((cntr - cntl), 0)) print(s1, end='') else: s2 = ')' * (max((cntl - cntr), 0)) flag = 1 print(s, end='') r1 = ')' * (max((n - l - 1), 0)) print(r1, end='') if flag: print(s2)
p03211
s716643383
Wrong Answer
s=input() a=753 ans=999 for i in range(len(s)-3): n=int(s[i:i+2]) tmp=abs(a-n) if tmp<ans: ans=tmp print(ans)
p04043
s765437950
Accepted
l = sorted(list(map(int,input().split()))) ans = [5,5,7] print("YES" if l == ans else "NO")
p02792
s577410794
Accepted
#coding:utf-8 n = int(input()) mtrx = [[0 for _ in range(10)] for _ in range(10)] for i in range(1, n + 1): num = str(i) s = int(num[0]) - 1 e = int(num[-1]) - 1 mtrx[s][e] += 1 sumv = 0 for i in range(10): for j in range(10): sumv += mtrx[i][j] * mtrx[j][i] print(sumv)
p02747
s471993303
Accepted
S=input() if(len(S)%2==0): for i in range(len(S)//2): if(S[2*i]!="h" or S[2*i+1]!="i"): print("No") break else: print("Yes") else: print("No")
p03437
s083868112
Accepted
X, Y = map(int, input().split()) a = X / Y if a == int(a): ans = -1 else: ans = X print(ans)
p03437
s731775564
Accepted
x, y = map(int, input().split()) print(x if x%y else -1)
p02608
s302993942
Accepted
n=int(input()) a = [0]*(20000) for i in range(1,101): for j in range(1,101): for k in range(1,101): if i**2+j**2+k**2 >= n: break a[i**2+j**2+k**2+i*j+j*k+i*k]+=1 for i in range(1,n+1): print(a[i])
p04031
s846137491
Accepted
N = int(input()) a = list(map(int, input().split())) min = None for y in range(-100, 101): sum = 0 for x in a: sum += abs(x - y) ** 2 if min is None or min > sum: min = sum print(min)
p04045
s066066920
Wrong Answer
import itertools N, L = map(str, input().split()) P = list(map(str, input().split())) U = itertools.combinations_with_replacement(list(set([str(i) for i in range(10)])-set(P)),10-len(P)) K = str() for i in U: K = ''.join(i) if K>=N: print(K) break
p02935
s393312885
Wrong Answer
N,*V=map(int,open(0).read().split()) A=sorted(V) for n in range(N-1): print(A) A=sorted([(A[0]+A[1])/2,]+A[2:]) print(A[0])
p02772
s177490044
Wrong Answer
inputs = map(int, input().split(" ")) is_denied = False for i in inputs: if i % 2 ==0: if i % 3 != 0 and i % 5 != 0: is_denied = True if is_denied: print("DENIED") else: print("APPROVED")
p02983
s488351390
Wrong Answer
a, b = map(int,input().split()) num = [a%2019] num.append(b%2019) for i in range(a + 1,b): if(max(num) > (i % 2019)): num.append(i%2019) num.remove(max(num)) elif(i % 2019 == 0): print(0) break print(num[0] * num[1])
p02854
s922274250
Wrong Answer
def resolve(): N = int(input()) A = list(map(int, input().split())) if N%2 == 0: print(abs(sum(A[:N//2]) - sum(A[N//2:]))) else: if A[0] <= A[-1]: print(abs(sum(A[:(N+1)//2]) - sum(A[(N+1)//2:]))) if A[0] > A[-1]: print(abs(sum(A[:(N-1)//2]) - sum(A[(N-1)//2:]))) resolve()
p04044
s437563443
Accepted
n, l = map(int, input().split()) s = sorted([input() for i in range(n)]) print("".join(s))
p02693
s013802041
Wrong Answer
K = int(input()) A, B = map(int, input().split()) for i in range(A,B+1): if i%K == 0: print('OK') else: print('NG')
p03986
s151944704
Accepted
X = input() ans = len(X) c = 0 for x in X: if x == 'S': c += 1 else: if c > 0: ans -= 2 c -= 1 print(ans)
p03351
s378294454
Wrong Answer
a, b, c, d = map(int, input().split()) if abs(b - a) <= d and abs(c - b) <= d: print("Yes") else: print("No")
p02657
s958414849
Wrong Answer
a,b = map(int,input().split()) print(a,b)
p02554
s093711127
Accepted
N = int(input()) mod = 10**9+7 ans = pow(10, N, mod) - ((pow(9, N, mod) * 2) - pow(8, N, mod)) ans %= mod print(ans)
p02881
s368752445
Accepted
N = int(input()) ans = N - 1 for i in range(1, int(N**0.5) + 10): if N % i == 0: j = N // i ans = min(ans, i + j - 2) print(ans)
p02606
s545137142
Accepted
L,R,d =map(int,input().split()) if L%d == 0: print(R//d - L//d + 1) else: print(R//d - L//d)
p02719
s064449008
Accepted
N, K = map(int, input().split()) A = N % K B = abs((N % K)-K) print(min(A, B))
p03210
s908431129
Accepted
print("NYOE S"[input() in "753"::2])
p02933
s006072954
Accepted
a = int(input()) s = input() if a >= 3200: print(s) else: print("red")
p03359
s183234841
Accepted
a, b = map(int, input().split()) print(a if b >= a else a-1)
p03699
s023709054
Wrong Answer
N=int(input()) s=[int(input()) for i in range(N)] num=sum(s) if num%10!=0: print(num) else: for i in range(N): s=sorted(s) if s[i]%10==0: continue else: print(num-s[i]) break print(0)
p02608
s733245819
Accepted
n = int(input()) ans = [0 for _ in range(10050)] for i in range(1,105): for j in range(1,105): for k in range(1,105): v = i*i+j*j+k*k+i*j+j*k+k*i; if v<10050: ans[v]+=1 for i in range(n): print(ans[i+1])
p03944
s817244180
Wrong Answer
import numpy as np W, H, N = map(int, input().split()) ze = np.ones((W + 1, H + 1)) for i in range(N): x, y, a = map(int, input().split()) if a == 1: ze[:x, :] = 0 elif a == 2: ze[x + 1:, :] = 0 elif a == 3: ze[:, :y] = 0 elif a == 4: ze[:, y + 1:] = 0 print(np.sum(ze))
p03434
s040179615
Accepted
N = int(input()) a_s = list(map(int, input().split())) a_s.sort(reverse=True) Alice = a_s[0::2] Bob = a_s[1::2] print(sum(Alice) - sum(Bob))
p02742
s677458081
Accepted
h,w = (int(x) for x in input().split()) num = 1 if h != 1 and w != 1: num = ((w // 2) + (w % 2))*( (h // 2) + ( h% 2) ) + ((w // 2) + (w % 2)-(w%2))*( (h // 2) + (h%2) -(h%2)) print(num)
p03745
s096494718
Accepted
N=int(input()) A=[int(i) for i in input().split()] plus=0 minus=0 ans=1 for i in range(N-1): plus += A[i]<A[i+1] minus += A[i]>A[i+1] if plus and minus: ans += 1 plus = 0 minus = 0 print(ans)
p02789
s454796716
Accepted
n,m=map(int,input().split()) print('Yes' if n==m else 'No')
p03838
s272922192
Accepted
x,y=map(int,input().split()) res = 0 if 0<=x<=y: res = y-x elif 0<y<x: res = x-y+2 elif y==0 and x>0: res = x+1 elif y==0 and x<0: res = abs(x) elif x==0 and y>0: res = y elif x==0 and y<0: res = abs(y)+1 elif x<0<y: res = abs(x+y)+1 elif y<0<x: res = abs(x+y)+1 elif x<=y<=0: res = y-x elif y<x<=0: res = x-y+2 print(res)
p02597
s391212592
Wrong Answer
N = int(input()) C = input() if N % 2 == 0: mid = N//2 else: mid = N//2+1 Wcount = C.count("W", 0, mid) print(Wcount)
p03556
s462143934
Wrong Answer
N = int(input()) for i in range(1, N): if i ** 2 > N: print((i - 1) ** 2) exit()
p03160
s433306319
Accepted
n = int(input()) h = list(map(int,input().split())) dp = [float("inf")]*n dp[0]=0 dp[1]=abs(h[1]-h[0]) for i in range(1,n-1): dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]),dp[i-1]+abs(h[i+1]-h[i-1])) print(dp[n-1])
p03797
s457427150
Wrong Answer
#ABC055 n,m = map(int,input().split()) print((m-2*n)//4+n)
p03479
s242889678
Accepted
x,y=map(int,input().split()) ans=1 while 2*x<=y: ans+=1 x*=2 print(ans)
p02725
s448615969
Accepted
K, N = list(map(int,input().split())) A = list(map(int,input().split())) d = [A[i+1]-A[i] for i in range(N-1)] de = K - A[N-1] + A[0] d.append(de) D = sorted(d) dis = 0 for i in range(N-1): dis += D[i] print(dis)
p02790
s116802299
Accepted
# coding: utf-8 # Your code here! a, b = map(int, input().split()) if a >= b : num_large = a num_small = str(b) else : num_large = b num_small = str(a) print(num_small * num_large)
p02690
s579981098
Accepted
import itertools import math X=int(input()) arr=[] arr2=[] arr3=[] for i in range(0,640): arr.append(i**5) arr.append(-i**5) l=itertools.combinations_with_replacement(arr,2) for i in l: arr2.append(i[0]-i[1]) arr3.append([i[0],i[1]]) ans=arr3[arr2.index(X)] print(int(math.pow(abs(ans[0]), 1/5))*(1 if ans[0]>=0 else -1), int(math.pow(abs(ans[1]), 1/5))*(1 if ans[1]>=0 else -1))
p03041
s613806657
Accepted
n, k = map(int, input().split()) s = input() print(s[:k-1]+s[k-1].lower()+s[k:])
p03457
s048149729
Accepted
n=int(input()) s = [[0,0,0]] for i in range(n): s.append(list(input().split())) for i in range(1,len(s)): dt=int(s[i][0])-int(s[i-1][0]) dx=int(s[i][1])-int(s[i-1][1]) dy=int(s[i][2])-int(s[i-1][2]) if dt<abs(dx)+abs(dy): print("No") exit() if (dx+dy)%2!=dt%2: print("No") exit() print("Yes")
p02683
s978833979
Accepted
N,M,X = map(int,input().split()) arr = [] for i in range(N): arr.append(list(map(int,input().split()))) cost = 10**9 + 7 for k in range(2**N): c = 0 t = [0]*M for i in range(N): if (k >> i)%2 : c += arr[i][0] for j in range(M): t[j] += arr[i][j+1] if sum(x>=X for x in t) == M: cost = min(cost,c) print(cost if cost < 10**9 + 7 else -1)
p03106
s256284019
Accepted
a,b,k=map(int,input().split()) c=min(a,b)+1 ct=0 while ct <k: c=c-1 if a%c==0 and b%c==0: ct+=1 print(c)
p02629
s856020418
Accepted
n=int(input())-1 m=n;i=0;lst=[] while m>=0: i+=1;k=m;m-=26**i k while k>0: lst.append(k%26) k//=26 for j in range(i-len(lst)): lst.append(0) print(''.join([chr(b+97) for b in lst][::-1]))
p02677
s023111000
Accepted
import math A = list(map(int, input().split())) D =A[0]**2+A[1]**2-2*A[0]*A[1]*math.cos(math.radians(30*A[2]-5.5*A[3])) print(math.sqrt(D))
p03627
s320165933
Accepted
N = int(input()) A = list(map(int, input().split())) A = sorted(A)[::-1] a = [] ng = 9999999 for i in range(N-1): if i != ng: if A[i] == A[i+1]: a.append(A[i]) ng = i+1 if len(a) == 2: break ans = 0 if len(a) == 2: ans = a[0] * a[1] else: ans = 0 print(ans)
p03282
s458840022
Accepted
s = input() k = int(input()) ans = '1' for i in range(k): if s[i] != '1': ans = s[i] break print(ans)
p03627
s169304576
Accepted
# -*- coding: utf-8 -*- n = int(input()) a = [int(i) for i in input().split()] a.sort(reverse = True) tmp = [] i = 0 while i < n - 1: if a[i] == a[i + 1]: tmp.append(a[i]) i += 2 else: i += 1 if len(tmp) >= 2: print(tmp[0] * tmp[1]) else: print(0)
p03161
s679147284
Wrong Answer
n, k = map(int, input().strip().split(" ")) h = list(map(int, input().split(" "))) dp = [10**5] * n dp[0] = 0 for i in range(n): for j in range(1, k+1): if i+j < n: dp[i+j] = min(dp[i+j], abs(h[i]-h[i+j])+dp[i]) else: break print(dp[n-1])
p02712
s837263968
Accepted
n = int(input()) ans = 0 for i in range(1, n+1): if i%3==0 and i%5==0: continue elif i%3==0: continue elif i%5==0: continue ans+=i print(ans)
p02768
s204263558
Accepted
MOD = 1_000_000_007 def calc_combi(n,k): frac=1 denomi=1 for i in range(n-k+1,n+1): frac=frac*i%MOD for i in range(1,k+1): denomi=denomi*i%MOD return frac*pow(denomi,MOD-2,MOD) n, a, b = map(int,input().rstrip().split()) nca = calc_combi(n,a) ncb = calc_combi(n,b) print((pow(2,n,MOD)-1-nca-ncb)%MOD)
p03605
s958587989
Wrong Answer
a=input() print('Yes')
p03071
s452733948
Accepted
a, b = map(int, input().split()) x = sorted([a, b, a - 1, b - 1], reverse=True) print(x[0] + x[1])
p02917
s612813401
Accepted
n = int(input()) b = list(map(int,input().split())) """ b_i >= max(a_i, a_(i+1)) """ a = [10**18 for _ in range(n)] for i in range(n): if i == 0: a[i] = b[i] elif i == n-1: a[i] = b[i-1] else: a[i] = min(b[i], b[i-1]) print(sum(a))
p03075
s021903830
Accepted
a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) k = int(input()) if e - a <= k: print('Yay!') else: print(':(')
p03487
s235362316
Accepted
from collections import Counter n=int(input()) a=Counter(list(map(int, input().split()))) ans=0 for i in a.keys(): if i>a[i]: ans+=a[i] elif i<a[i]: ans+=a[i]-i print(ans)
p03623
s470101691
Wrong Answer
X, A, B = map(int, input().split()) print(min(abs(X-A), abs(B-X)))
p02696
s152378761
Accepted
a, b, n = map(int, input().split()) mx = 0 nn = n//b mm = (a*n)//b - a*(nn) if nn > 0: x = b*nn-1 mx = (a*x)//b - a*(nn-1) mm = max(mm, mx) print(mm)
p03605
s776820794
Accepted
N = input() if N[0] == '9' or N[1] == '9': print('Yes') else: print('No')
p03067
s020089786
Accepted
li = list(map(int, input().split())) print("Yes" if sorted(li).index(li[2]) == 1 else "No")
p03544
s494720315
Accepted
n=int(input()) l=[0 for i in range(n+1)] l[0]=2 l[1]=1 for j in range(2,n+1): l[j]=l[j-1]+l[j-2] print(l[n])
p04033
s492320984
Accepted
# -*- coding: utf-8 -*- a,b=map(int,input().split()) if a>0: print("Positive") elif a<=0 and b>=0: print("Zero") else: if (a-b)%2==0: print("Negative") else: print("Positive")
p02677
s295613742
Accepted
import math A,B,H,M = map(int,input().split()) co_hour = [math.cos(((H*60 + M)/360 - 1/2) * math.pi) * A , math.sin(((H*60 + M)/360 - 1/2) * math.pi) * A] co_min = [math.cos(((M/30 - 1/2) * math.pi)) * B, math.sin(((M/30 - 1/2) * math.pi)) * B] x = co_hour[0] - co_min[0] y = co_hour[1] - co_min[1] Answer = math.sqrt(x * x + y * y) print(Answer)
p03681
s424607894
Wrong Answer
import math n, m = map(int, input().split()) n_f = math.factorial(n) m_f = math.factorial(m) res = (n_f * m_f * 2) % 1000000007 if abs(n - m) >= 2: res = 0 print(res)
p02768
s269128644
Wrong Answer
n,a,b=map(int, input().split()) def modinv(a, mod=10**9+7): return pow(a, mod-2, mod) def combination(n, r, mod=10**9+7): r = min(r, n-r) res = 1 for i in range(r): res = res * (n - i) * modinv(i+1, mod) % mod return res ret = 0 ret = 2**n + 10**9+7 + 10**9+7 ret = ret - combination(n, a) ret = ret - combination(n, b) ret = ret % (10**9+7) print(ret)
p03943
s025501147
Wrong Answer
a,b,c=map(int,input().split()) t=a+b+c k=0 if a+b==c or a+c==b or b+c==a else 0 print(['Yes','No'][k])
p03698
s293911652
Accepted
S = sorted(input()) # print('S', S) for i in range(len(S) - 1): if S[i] == S[i + 1]: print('no') exit() print('yes')