problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03860
s053126869
Accepted
a = list(input().split()) for i in a: print(i[0],end="")
p02785
s231811827
Accepted
n, k = map(int, input().split()) hp_list = list(map(int, input().split())) hp_list.sort() attack = 0 for i, hp in enumerate(reversed(hp_list)): if i < k: continue attack += hp print(attack)
p02597
s262949587
Accepted
N = int(input()) C = input() cnt = 0 R = C.count('R') for i in range(R): if C[i] == 'R': cnt += 1 print(R - cnt)
p02952
s075058271
Accepted
n=input() m=len(n) n=int(n) ans=0 for i in range(m//2): ans+=9*10**(2*i) if m%2==1: ans+=n+1-10**(m-1) print(ans)
p03478
s288080322
Wrong Answer
n, a, b = map(int, input().split()) ans = 0 for i in range(n+1): if a <= sum(list(map(int, list(str(i))))) <= b: ans += 1 print(ans)
p03419
s076321028
Accepted
x,y=list(map(int, input().split())) if x==1 or y==1: if x==1 and y==1: print(1) else: print(x*y-2) else: print(((x-2)*(y-2)))
p02848
s577726715
Wrong Answer
n=int(input()) s=str(input()) result="" for i in s: result += chr(ord(i)+n) print(result)
p02959
s086679241
Accepted
n=input() b = list(map(int, input().split())) a = list(map(int, input().split())) ans = 0 for i in range(0, len(a)): ans += min(a[i], b[i]) rem = a[i] - b[i] # print(rem) temp = max(0, min(rem, b[i + 1])) ans += temp b[i + 1] -= temp print(ans)
p02917
s023022581
Accepted
n = int(input()) b = list(map(int,input().split())) ans = b[0] for i in range(1,n-1): ans += min(b[i-1],b[i]) print(ans+b[-1])
p03680
s780269048
Accepted
import sys input=sys.stdin.readline n=int(input()) button=[False]*(n+1) button[1]=True a={} for i in range(1,n+1): ai=int(input()) a[i]=ai tmp=1 pushed={} ans=0 while not button[2]: button[tmp]=False if tmp in pushed: print(-1) exit() pushed[tmp]=1 tmp=a[tmp] button[tmp]=True ans+=1 print(ans)
p02676
s940535833
Accepted
import sys input = sys.stdin.readline def main(): k = int(input()) s = input().strip() if len(s) > k: print(s[:k] + '...') else: print(s) if __name__ == '__main__': main()
p03059
s353848091
Wrong Answer
a,b,c=map(int,input().split()) n=len([i for i in range(c) if i%a==0]) print(b*n)
p03720
s297615151
Accepted
def solve(): N, M = [int(i) for i in input().split()] R = [[] for _ in range(N)] for _ in range(M): a, b = [int(i) for i in input().split()] R[a - 1].append(b) R[b - 1].append(a) for r in R: print(len(r)) if __name__ == "__main__": solve()
p02615
s196174917
Accepted
import heapq def solve(): N = int(input()) A = list(sorted(map(int, input().split()), reverse=True)) C = [-A[0]] ans = 0 for a in A[1:]: K = heapq.heappop(C) ans += -K heapq.heappush(C, -a) heapq.heappush(C, -a) print(ans) solve()
p02701
s747689671
Accepted
N = int(input()) D = [input() for j in range(N)] S = list(set(D)) print(len(S))
p02582
s163441187
Accepted
import sys input = sys.stdin.readline from collections import * s = input()[:-1] l = [] cnt = 1 for i in range(len(s)-1): if s[i]!=s[i+1]: l.append((s[i], cnt)) cnt = 1 else: cnt += 1 l.append((s[-1], cnt)) ans = 0 for si, c in l: if si=='R': ans = max(ans, c) print(ans)
p03797
s612617157
Wrong Answer
N,M=map(int,input().split()) #S=N,C=M print(((2*N)+M)//4)
p04044
s665524829
Wrong Answer
n, l = map(int, input().split()) a = [] if n == 1: print(input()) exit() for i in range(n): a.append(input()) a.sort() print(a[0])
p02953
s127083681
Accepted
n = int(input()) h = list(map(int, input().split())) h[0] -= 1 for i in range(1, n): if h[i]-h[i-1] < 0: print('No') exit() if h[i] - h[i-1] > 0: h[i] -= 1 print('Yes')
p03861
s193404103
Accepted
def input_int(): return(int(input())) def input_int_list(): return(list(map(int,input().split()))) def input_int_map(): return(map(int,input().split())) def run(): a, b, x = input_int_map() result = count_num(b, x) - count_num(a - 1, x) print(result) def count_num(num, x): if num < 0: return 0 return num // x + 1 run() # 2 4 3 # 3 4 3 # 2 6 3
p03862
s386958179
Accepted
N,x=map(int,input().split()) a=list(map(int,input().split())) ans=0 for i in range(1,N): tmp=a[i-1]+a[i] if tmp>x: ans+=tmp-x if a[i]>=tmp-x: a[i]-=tmp-x else: a[i]=0 print(ans)
p02843
s990468378
Accepted
x=int(input()) num = x//100 div = x%100 ans=0 if 0<=div<=(num*5): ans=1 print(ans)
p03696
s900385226
Accepted
input() s = input() ans = '' cnt_l = 0 cnt_r = 0 cur = 0 for c in s: if c == '(': if cur < 0: cnt_l += abs(cur) cur = 0 cur += 1 else: cur -= 1 if cur > 0: cnt_r += cur else: cnt_l += abs(cur) print(cnt_l*'(' + s + cnt_r*')')
p03041
s622206817
Accepted
n, k = map(int,input().split()) s = list(input()) if s[k-1] == "A": s[k-1] = "a" if s[k-1] == "B": s[k-1] = "b" if s[k-1] == "C": s[k-1] = "c" print("".join(s))
p02862
s137072616
Accepted
x,y= map(int, input().split()) a=min(x,y) b=max(x,y) mod=pow(10,9)+7 if b-a>a or (a-(b-a))%3!=0: print(0) else: r=(a-(b-a))//3 l=((a-(b-a))//3)+(b-a) c=1 d=1 for i in range(r): c=(c*(l+r-i))%mod d=(d*(r-i))%mod ans=c*pow(d,mod-2,mod) print(ans%mod)
p02607
s379701138
Accepted
n = int(input()) a = list(map(int, input().split())) c = 0 for x in range(1, n+1): if x & 1 and a[x-1] & 1: c += 1 print(c)
p02775
s626770434
Wrong Answer
N = str(input()) ans = 0 if len(N) <= 98: ans += 1 for i in range(len(N)): ans += min(10-int(N[i]), int(N[i])) print(ans)
p02970
s018812906
Accepted
N, D = map(int, input().split()) print((N+2*D)//(2*D+1))
p03779
s675451137
Accepted
x=int(input()) t=0 p=0 while p<x: t+=1 p+=t print(t)
p02970
s088042104
Wrong Answer
n, d = map(int, input().split()) num = -( -n // (2*d) ) print(num)
p02947
s100774288
Accepted
n = int(input()) s = [input() for i in range(n)] def get_unique_list(seq): seen = [] return [x for x in seq if x not in seen and not seen.append(x)] # [[1, 1], [0, 1], [0, 0], [1, 0]] dic = {} for i in range(n): sen = '・'.join(sorted(s[i])) #print(sen) if sen not in dic: dic[sen]=1 else: dic[sen]+=1 #print(dic) ans = 0 for i in dic.values(): ans += i*(i-1)//2 print(ans)
p02972
s802868645
Accepted
n = int(input()) a = [int(i) for i in input().split()] x = [0]*(n+1) m = 0 ans = [] for i in reversed(range(1,n+1)): tmp = 0 for j in range(2*i,n+1,i): if x[j] == 1: tmp += 1 if tmp % 2 != a[i-1]: x[i] = 1 m += 1 ans.append(i) print(m) for i in ans: print(i,end=" ") """ #no ball if all(i == 0 for i in x): print(0) exit() #else for i in range(1,n+1): if x[i] == 1: print(i,end=" ") """
p03331
s509430851
Wrong Answer
n=int(input()) ans=n for i in range(1,n): a=str(i*10000) b=int(a[0])+int(a[1])+int(a[2])+int(a[3]) c=str((n-i)*10000) d=int(c[0])+int(c[1])+int(c[2])+int(c[3]) ans=min(ans,b+d) print(ans)
p03000
s230646891
Accepted
n,x=map(int,input().split()) l=list(map(int,input().split())) length=0 i=0 while length<=x and i<=n-1: length+=l[i] i+=1 if length<=x: print(n+1) else: print(i)
p02819
s339694862
Accepted
# -*- coding: utf-8 -*- import numpy as np X = int(input()) a=0 if X==2 or X==3: a=1 while a<1: for i in range(2,int(np.sqrt(X))+1): a=1 if X%i==0:#素数でない a=0 break else:#素数かも pass if a==0: X+=1 print(X)
p02783
s411660335
Accepted
import math h, a = list(map(int, input().split())) print(math.ceil(h/a))
p03474
s331084157
Accepted
a,b=map(int,input().split()) s=input() if s[0:a].isdigit() and s[a+1:].isdigit() and s[a] == "-": print("Yes") else: print("No")
p02958
s818646565
Accepted
n = int(input()) p = list(map(int,input().split())) ps = sorted(p) cnt = 0 for i in range(len(p)): if p[i] != ps[i] : cnt += 1 if cnt > 2 : print("NO") exit() print("YES")
p02768
s347290353
Wrong Answer
n, a, b = map(int, input().split()) m = int(1e9) + 7 ans = (pow(2, n, m) -1) % m val = 1 val2 = 1 for i in range(a): val = (val * n - i) % m val2 = (val2 * i + 1) % m ans -= (val * (pow(val2, m-2, m))) val = 1 val2 = 1 for i in range(b): val *= (n - i) % m val2 *= (i + 1) % m ans -= (val * (pow(val2, m-2, m))) print(ans % (int(1e9) + 7))
p02623
s235553753
Accepted
N, M, K =map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) a = [0] b = [0] for i in range(N): a.append(a[i] + A[i]) for j in range(M): b.append(b[j] + B[j]) ans = 0 j = M for i in range(N+1): if a[i] > K: break while a[i] + b[j] > K: j -= 1 ans = max(ans, i+j) print(ans)
p03317
s009517708
Accepted
N, K = map(int, input().split()) A = list(int(a) for a in input().split()) print(((N-1)+(K-2))//(K-1))
p02753
s663062934
Wrong Answer
s = list(input()) if "A" in s and not("B" in s): print("No") elif "B" in s and not("A" in s): print("NO") else: print("Yes")
p02983
s657677464
Wrong Answer
ll, rr = map(int, input().split()) if rr - ll >= 2019: print(0) exit() l = ll % 2019 r = rr % 2019 if l > r: print(0) exit() print(l,r) ans = 10**9 for i in range(l, r + 1): for j in range(i+1, r+1): x = (i * j) % 2019 print(x) ans = min(x, ans) print(ans)
p02912
s331314978
Accepted
import heapq n,m=map(int,input().split()) a=list(map(int,input().split())) q=[-a[i] for i in range(n)] heapq.heapify(q) for _ in range(m): x=heapq.heappop(q) x=(x+1)//2 heapq.heappush(q,x) ans=0 for _ in range(n): ans-=heapq.heappop(q) print(ans)
p02917
s066933572
Wrong Answer
# ABC140C n = int(input()) - 1 b = list(map(int, input().split())) max_value = b[0] + b[n - 1] for i in range(n - 1): max_value += min(b[i], b[i + 1])
p02699
s048299803
Accepted
inputList = input().split() s = int(inputList[0]) w = int(inputList[1]) if s <= w: print("unsafe") else: print("safe")
p02772
s393078917
Wrong Answer
n = int(input()) numbers = [int(x) for x in input().split()] flag = 'APPROVED' for number in numbers: if number % 3 == 0 or number % 5 == 0: continue else: flag = 'DENIED' break print(flag)
p02624
s549814436
Accepted
import math n = int(input()) x = math.floor(math.sqrt(n)) ans = 0 for m in range(1,x+1): ans += m*(m+math.floor(n/m))*(math.floor(n/m)+1-m) print(int(ans-(((x+1)**4-x**4)-((x+1)**2-x**2))/12))
p02640
s891651401
Accepted
import sys sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline def solve(): X, Y = map(int, rl().split()) for i in range(X + 1): if 2 * i + 4 * (X - i) == Y: print('Yes') return print('No') if __name__ == '__main__': solve()
p03543
s807375963
Wrong Answer
X = list(input()) for i in range(2**3): W = ["+"]*3 for j in range(3): if (i >> j) & 1: W[j] = "-" formula = "" for k,l in zip(X,W+[""]): formula += k+l if eval(formula) == 7: print(formula+"=7") break
p02705
s831991723
Wrong Answer
import math r = int(input()) a = math.pi * r**2 print(a)
p03679
s151325475
Accepted
X,A,B=map(int,input().split()) eat=-A+B if int(eat)<=0: print("delicious") elif int(eat)<=X: print("safe") else: print("dangerous")
p02742
s944600545
Accepted
H,W=map(int,input().split()) if W==1 or H==1: print(1) elif H%2==0 and W%2==0: print((H//2)*(W)) elif H%2==1 and W%2==0: print(H*W-((H//2)*(W//2))-((H//2)+1)*(W//2)) elif H%2==0 and W%2==1: print(H*W-((W//2)*(H//2))-((W//2)+1)*(H//2)) else: print(H*W-((H//2)*((W//2)+1))-((H//2)+1)*(W//2))
p02726
s075385466
Accepted
n, x, y = map(int,input().split()) cnt = [0] * (n - 1) for i in range(1, n): for j in range(i + 1, n + 1): temp1 = j - i temp2 = abs(i - x) + abs(j - y) + 1 dis = min(temp1, temp2) cnt[dis - 1] += 1 print(*cnt, sep='\n')
p02785
s072369582
Wrong Answer
#https://atcoder.jp/contests/abc153/tasks/abc153_c N,K =map(int,input().split()) M_List = sorted(list(map(int,input().split()))) if N<=K: print(0) else: print(sum(M_List[:K*(-1)]))
p02793
s212514521
Accepted
def gcd(a, b): if (a == 0): return b return gcd(b%a, a) def lcm(a, b): return (a*b)//gcd(a, b) n = int(input()) numbers = list(map(int, input().split())) l = numbers[0] for i in range(1, n): l = lcm(l, numbers[i]) ans = 0 for i in range(n): ans += l//numbers[i] MOD = 1000000007 print(ans%MOD)
p02880
s435384930
Wrong Answer
import sys X=input() N=int(X) for i in range(1,9): a=N//i b=N%i if (0<a<10 and b==0): print("Yes") break else: print("No")
p03103
s271984956
Accepted
n,m = map(int,input().split()) ab = [list(map(int,input().split())) for _ in range(n)] ab = sorted(ab, key=lambda ab:ab[0]) ans = 0 total = 0 for i in range(n): num = m - total if ab[i][1]<num: total += ab[i][1] ans += ab[i][0]*ab[i][1] else: total += num ans += num*ab[i][0] break print(ans)
p03472
s556858793
Wrong Answer
def main(): from math import ceil from itertools import accumulate from bisect import bisect_left n, h, *ab = map(int, open(0).read().split()) l = sorted(ab[1::2], reverse=True) x = list(accumulate(l)) if x[-1] <= h: print(ceil((h - x[-1]) / max(ab[::2])) + n) else: i = bisect_left(x, h) print(i + 1) if __name__ == '__main__': main()
p02848
s825838980
Wrong Answer
r = int(input()) print(int(r**2))
p03160
s739470849
Accepted
mod=10**9+7 import math import sys from collections import deque import heapq import copy import itertools from itertools import permutations from itertools import combinations import bisect def mi() : return map(int,sys.stdin.readline().split()) def ii() : return int(sys.stdin.readline().rstrip()) def i() : return sys.stdin.readline().rstrip() a=ii() l=list(mi()) dp=[0,abs(l[0]-l[1])] for i in range(2,a): dp.append(min(abs(l[i]-l[i-1])+dp[i-1],abs(l[i]-l[i-2])+dp[i-2])) print(dp[-1])
p02939
s687108956
Accepted
# A - Dividing a String import sys input = sys.stdin.readline S = input().strip() ans, prev, cur = 0, "", "" for s in S: cur += s if cur != prev: # True になるまで、curに文字列を追加していく ans += 1 prev, cur = cur, "" print(ans)
p02972
s340069677
Wrong Answer
n=int(input()) a=list(map(int,input().split())) b=[0]*n c=0 for i in range(n): c+=a[i]%2 if a[i]%2==1: b[i]+=i+1 print(sum(b)) print(b)
p03345
s656004524
Accepted
# import math # import statistics #a=input() #b,c=int(input()),int(input()) # c=[] # for i in a: # c.append(i) e1,e2,e3 ,e4= map(int,input().split()) #K = input() # f = list(map(int,input().split())) #g = [input() for _ in range(a)] if e4%2==0 or e4==0: print(e1-e2) elif e4%2==1 : print(-(e1-e2)) elif abs(e1-e2)>=10**18: print("Unfair")
p02583
s692273452
Accepted
N = int(input()) L = [int(a) for a in input().split()] count = 0 for i in range(N-2): for j in range(i+1,N-1): for k in range(j+1,N): if(L[i]+L[j]>L[k] and L[j]+L[k]>L[i] and L[k]+L[i]>L[j] and L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i]): count += 1 print(count)
p03720
s243571669
Accepted
N, M = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(M)] ans = [0 for _ in range(N)] for i, j in ab: ans[i-1] += 1 ans[j-1] += 1 for i in ans: print(i)
p02759
s172691357
Accepted
import itertools import fractions def main(): n = int(input()) print(n//2 + n%2) if __name__ == '__main__': main()
p02661
s895979157
Wrong Answer
N = int(input()) A = [0]*N B = [0]*N for i in range(N): A[i], B[i] = map(int, input().split()) def f(n): AB = list(zip(A, B)) AB.sort() return AB[n] if N%2==0: a1, b1 = f(N//2-1) a2, b2 = f(N//2) print((b1+b2)-(a1+a2)+1) else: a, b = f(N//2) print(b-a+1)
p02946
s575905546
Accepted
K, X = map(int, input().split()) list = [X] for i in range(1,K): list.append(X+i) list.append(X-i) print(*sorted(list))
p02705
s876256477
Accepted
print(2 * 3.141592653589793 * int(input()))
p02767
s934815666
Wrong Answer
n = input() l = map(int,raw_input().split()) mxs = 10**9 for i in range(max(l)): sm = 0 for j in l: sm += (j-i)**2 if sm<mxs: mxs = sm print mxs
p02627
s940114933
Wrong Answer
x = input("") if "x".islower(): print("a") else: print("A")
p02683
s329283738
Wrong Answer
import itertools N, M, X = map(int, input().split()) a = [list(map(int, input().split())) for i in range(N)] li = [] for i in range(N+1): for j in itertools.combinations(range(N), i): sm = [0] * (M+1) for k in j: for l in range(M+1): sm[l] += a[k][l] if all(y >= X for y in sm[1:M+1]): li.append(sm[0]) if li == []: print(-1) else: print(min(li)) print(li)
p03131
s158192170
Accepted
K, A, B = list(map(int, input().split())) if A >= B - 1 or A + 1 > K: res = K + 1 else: K -= A + 1 t = int(K / 2) res = (t + 1) * B - t * A + K % 2 print(res)
p03136
s548345050
Accepted
N = int(input()) L = [int(a) for a in input().split()] maxL = max(L) excep = sum(L)-maxL if maxL<excep: print('Yes') else: print('No')
p02700
s591242519
Accepted
import sys A,B,C,D=list(map(int,input().split())) while (A>0 or C>0): C-=B if C <= 0: ans='Yes' break; A-=D if A <= 0: ans='No' break; print(ans)
p02597
s741110974
Accepted
n = int(input()) s = input() count = 0 for i in range(n): if(s[i] == "R"): count += 1 count2 = 0 for i in range(count): if(s[i] == "W"): count2 += 1 print(count2)
p03617
s474031970
Accepted
q,h,result,d = map(int,input().split()) n = int(input()) result = min(q*4, h*2,result) print(min(result*n, n//2*d + (n%2)*result))
p04031
s261574446
Wrong Answer
N = int(input()) l = list(map(int,input().split())) l_ans = [[] for _ in range(100)] for i in range(100): sum = 0 for j in range(N): sum = sum + (i+1-l[j])**2 l_ans[i] = sum print(min(l_ans))
p03644
s591597159
Accepted
n=int(input()) i=0 while not 2**i<=n<2**(i+1): i+=1 print(2**i)
p02911
s695124081
Accepted
import sys input = sys.stdin.readline n, k, q = map(int, input().split()) memo = [0] * n for i in range(q): a = int(input()) memo[a - 1] += 1 for i in range(n): if k - (q - memo[i]) > 0: print('Yes') else: print('No')
p02759
s879803636
Accepted
N = int(input()) print((N-1)//2+1)
p02712
s301675460
Accepted
def main(): n = int(input()) total = 0 for i in range(1,n+1): if i % 3 == 0 and i % 5 == 0: pass #print("FizzBuzz") elif i%3 == 0: pass #print("Fizz") elif i%5 == 0: pass #print() else: total += i print(total) if __name__ == '__main__': main()
p03137
s604639506
Wrong Answer
N,M=map(int,input().split()) X=sorted(set(list(map(int,input().split())))) Y=[] for i in range(M-1): y=X[i+1]-X[i] Y.append(y) print(sum(sorted(Y)[:-(N-1)]))
p04012
s518111802
Accepted
def main(): string = input() flg=0 while len(string)!=0: if(string.count(string[0])%2==0): string=string.replace(string[0],'') else: flg=1 break if flg==0: print('Yes') else: print('No') main()
p02577
s674685478
Wrong Answer
def main(): N = input() N_sum = 0 if N == str(0): print("No") exit() for i in N: N_sum += int(i) if N_sum // 9 == 0: print("Yes") else: print("No") if __name__ == "__main__": main()
p02836
s224357402
Accepted
S = input() l = len(S) count = 0 for i in range(l//2): if S[i] != S[-1-i]: count += 1 print(count)
p03632
s787582717
Accepted
a, b, c, d = map(int, input().split()) max_min = max(a, c) min_max = min(b, d) if min_max - max_min > 0: print(min_max - max_min) else: print(0)
p03106
s201106032
Accepted
a, b, k = map(int, input().split()) cnt = 0 for i in range(min(a, b), 0, -1): if a % i == 0 and b % i == 0: cnt += 1 if cnt == k: break print(i)
p02699
s740012935
Accepted
a=list(map(int,input().split())) if a[1]>=a[0]: print('unsafe') else: print('safe')
p03309
s025109506
Accepted
n = int(input()) a = list(map(int, input().split())) B=[] for i,ai in enumerate(a,start=1): B.append(ai-i) c=sorted(B) b=c[len(c)//2] ans=0 for i in B: ans+=abs(i-b) print(ans)
p03017
s151507689
Accepted
N, A, B, C, D = map(int, input().split()) S = input() for i in range(A-1,max(C,D)-1): if S[i] == '#' and S[i+1] == '#': print('No') exit() if D < C: for i in range(B-2,N-2): if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.': print('Yes') exit() if i+1 == D-1: break print('No') exit() else: print('Yes') exit()
p03352
s533890426
Accepted
import math X = int(input()) res = 1 for i in range(2, int(math.sqrt(X)) + 1): j = 2 while i ** j <= X: j += 1 res = max(res, i ** (j - 1)) print(res)
p02793
s559341206
Accepted
import sys from fractions import gcd input = sys.stdin.readline def lcm(x, y): return (x * y) // gcd(x, y) def main(): n = int(sys.stdin.readline()) a = list(map(int,input().split())) l = a[0] for i in range(n): l = lcm(l, a[i]) sum = 0 for i in range(n): sum += l // a[i] print(sum % 1000000007) main()
p03262
s159221823
Wrong Answer
n, x = map(int, input().split()) x_s = list(map(int, input().split())) x_s.append(x) x_s.sort() sub = [] for i in range(n): sub.append(x_s[i+1]-x_s[i]) print(min(sub))
p02601
s877812492
Wrong Answer
import sys r,g,b = map(int,input().split()) k = int(input()) #青>緑>赤 count = 0 if g*(2**k)>r: while g<r: g*=2 count += 1 else: print("No") sys.exit(0) if b*(2**(k-count))>g and k<=count: print("Yes") else: print("No")
p03419
s927554747
Accepted
N,M = map(int,input().split()) if (N == 1 and M == 1): print(1) exit() elif N == 1: if M == 2: print(1) else: print(M-2) elif M == 1: if N == 2: print(1) else: print(N-2) else: print((N-2)*(M-2))
p02953
s081289557
Accepted
n = int(input()) h = list(map(int,input().split())) check = True for i in range(1,n): if h[i] >= h[i-1]: continue elif h[i] + 1 == h[i-1]: h[i] += 1 else: check = False break print("Yes" if check else "No")
p02789
s559787076
Accepted
N,M = map(int,input().split()) if N == M: print("Yes") else: print("No")
p02939
s033546727
Accepted
S = input() N = len(S) dp = [0 for _ in range(N)] dp[0] = 1 dp[1] = 2 if S[0] != S[1] else 1 for i in range(2, N): if S[i] != S[i - 1]: dp[i] += dp[i - 1] + 1 else: dp[i] += dp[i - 3] + 2 print(dp[-1])