problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02743
s852446725
Accepted
from decimal import Decimal a, b, c = map(Decimal, input().split()) ans = (c - a - b)**2 > 4 * a * b if c - a - b < 0: ans = False print("Yes" if ans else "No")
p04033
s619903577
Accepted
def solve(): N, M = map(int, input().split()) if N > 0: return 'Positive' elif N <= 0 <= M: return 'Zero' else: if (-(N-M)+1) % 2 == 0: return 'Positive' else: return 'Negative' return 0 print(solve())
p02584
s381373133
Wrong Answer
x, k, d = map(int, input().split()) if x > 0: sgn_x = 1 x_greedy = x - k * d else: sgn_x = -1 x_greedy = x + k * d if x_greedy > 0: sgn_x_greedy = 1 else: sgn_x_greedy = -1 if sgn_x == sgn_x_greedy: print(abs(x_greedy)) exit() x_r = x % d x_l = -(x_r - d) print(min(x_r, x_l))
p03623
s878565663
Wrong Answer
z,a,b=map(int,input().split());print('AB'[(z-a)//(z-b)!=0])
p03339
s189614250
Accepted
N=int(input()) S=input() left=0 right=S[1:N].count('E') ans=left+right for i in range(1,N): if S[i-1]=='W': left+=1 if S[i]=='E': right-=1 ans=min(ans,left+right) print(ans)
p03137
s913063489
Wrong Answer
N, M = map(int, input().split()) X = list(map(int, input().split())) X = sorted(X) diff = [] for i in range(len(X)-1): diff.append(X[i+1] - X[i]) diff_sort = sorted(diff) if M == 1: print(0) else: print(sum(diff_sort[0:N+1]))
p04034
s861895231
Wrong Answer
n,m = map(int, input().split()) r = 1 b0 = [1]*(n+1) rb = [0]*(n+1) for i in range(m): x,y = map(int, input().split()) b0[x] -= 1 b0[y] += 1 if x == r: r = y rb[r] = 1 ans = 0 for j in range(n+1): if rb[j] == 1 and b0[j] >0: ans += 1 print(ans)
p03386
s724109542
Wrong Answer
a,b,k=map(int,input().split()) if b-a<=2*k: for i in range(a,b+1): print(i) else: for i in range(a,a+k): print(i) for i in range(b-k+1,b+1): print(i)
p03785
s744787560
Wrong Answer
N,C,K = map(int, input().split()) L = [int(input()) for i in range(N)] cap = 0 begin = 0 count = 1 for i in range(N): a = L[i] if begin == 0: begin = a elif a <= begin + K and cap < C: cap += 1 else: cap = 1 begin = a count += 1 print(count)
p02675
s010084407
Accepted
N = int(input()) n = N % 10 if n == 3 : print("bon") elif n in(0,1,6,8) : print("pon") elif n in (2,4,5,7,9): print("hon")
p03644
s628550232
Accepted
pow2 = [2 ** i for i in range(0, 7)] n = int(input()) res = max([i for i in pow2 if i <= n]) print(res)
p02860
s896316216
Wrong Answer
n = int(input()) s = input() if n % 2 == 1: print('No') exit() else: if s[:n // 2] == s[n // 2 + 1:]: print('Yes') else: print('No')
p03723
s160352287
Accepted
a, b, c = [int(i) for i in input().split()] if a == b == c and a % 2 == 0: print(-1) exit() if a % 2 == 1 or b % 2 == 1 or c % 2 == 1: print(0) exit() cnt = 0 while True: ta, tb, tc = a, b, c ta = (b + c) // 2 tb = (a + c) // 2 tc = (a + b) // 2 cnt += 1 if ta % 2 == 1 or tb % 2 ...
p03680
s535264134
Wrong Answer
N = int(input()) a = [int(input()) for _ in range(N)] n = 0 count = 0 for i in range(N): count += 1 n = a[n] - 1 if n == 1: print(count) break print(count if n == 1 else -1)
p02748
s308162031
Wrong Answer
a,b,m = map(int,input().split()) alist = list(map(int,input().split())) blist = list(map(int,input().split())) mlist = [list(map(int,input().split())) for s in range(m)] for m in mlist: tmp = alist[m[0]-1] + blist[m[1]-1] -m[2] ans = [tmp] for a in alist: for b in blist: ans.append(a + b) print(min(ans))
p02843
s962275239
Accepted
X = int(input()) k = 0 x = X%100 while x!=0: k+=1 for i in range(5,0,-1): if i<=x: x-=i break X //= 100 print(1 if k<=X else 0)
p02695
s606402691
Accepted
N, M, Q = map(int, input().split()) abcd = [list(map(int, input().split())) for i in range(Q)] def calc_score(A): score = 0 for a, b, c, d in abcd: if A[b-1] - A[a-1] == c: score += d return score ans = 0 def dfs(A): global ans if len(A) == N: ans = max(ans, calc_score(A)) else: last_a =...
p02660
s648770516
Accepted
def II(): return int(input()) N=II() d=2 ans=0 while d*d<=N: if N%d!=0: d+=1 continue z=d while N%z==0: ans+=1 N//=z z*=d while N%d==0: N//=d if N!=1: ans+=1 print(ans)
p02862
s308009603
Accepted
X,Y = map(int,input().split()) M = X+Y mod = 10**9 + 7 kaijou = [1] for i in range(1,10**6+1): kaijou.append((kaijou[-1]*i)%mod) def C(n,k): return (kaijou[n]*pow(kaijou[k],mod-2,mod)*pow(kaijou[n-k],mod-2,mod))%mod if M%3!=0: print(0) elif X<M//3 or Y<M//3: print(0) else: print(C(M//3, X-M...
p03472
s782058570
Accepted
n, h = map(int,input().split()) a = [] b = [] ans = 0 for i in range(n): x, y = map(int,input().split()) a.append(x) b.append(y) b.sort(reverse=True) c = max(a) #刀を投げる for i in b: if i > c: h -= i ans += 1 if h <= 0: print(ans) exit() #刀を振る ans += (h+c...
p02661
s372204313
Wrong Answer
N = int(input()) A = [] B = [] ans = 0 for _ in range(N): a, b = map(int, input().split()) ans += b - a A.append(a) B.append(b) # AB = [[int(x) for x in input().split()] for _ in range(N)] if N % 2: A.sort() B.sort() ans = B[N//2] - A[N//2] + 1 else: ans += 1 print(ans)
p02795
s581370939
Accepted
H = int(input()) W = int(input()) N = int(input()) mn = max(H,W) mx = max(H,W) ans = 0 x = 0 while x<N: x += mx ans+=1 print(ans)
p03854
s820408596
Accepted
s=input() List=["eraser","erase","dreamer","dream"] for item in List: s = s.replace(item,'') if len(s)==0: print('YES') else: print('NO')
p04012
s590938253
Wrong Answer
s = input() d = {} for letter in s: if letter in d: d[letter] += 1 else: d[letter] = 1 for key in d: if d[key] % 2 != 0: print("No") print("Yes")
p02783
s310829606
Wrong Answer
H,A=map(int,input().split()) print((H+1)//A+1)
p03011
s715693370
Wrong Answer
a,b,c=map(int,input().split()) n=[a,b,c] d=[] for i in range(1,len(n)): d.append(n[i]+n[i]) print(min(d))
p03371
s663305360
Accepted
# -*- coding: utf-8 -*- a,b,c,x,y = [int(i) for i in input().split()] if x <= y: ans1 = min(c * x * 2 + b * (y - x), c * y * 2) #print('a') else: #x > y ans1 = min(c * y * 2 + a * (x - y), c * x * 2) #print('b') ans2 = a * x + b * y print(min(ans1, ans2))
p03380
s271660808
Accepted
n=int(input()) a=list(map(int,input().split())) a.sort() ai=a[-1] aj=a[0] for j in range(1,n-1): if abs(ai/2-a[j]) < abs(ai/2-aj): aj=a[j] print(ai, aj)
p02706
s709675875
Accepted
# -*- coding: utf-8 -*- N, M = map(int,input().split()) list1 = list(map(int,input().split())) sum = 0 for i in range(M): sum += list1[i] ans = N - sum if ans < 0: ans = -1 print(ans)
p03986
s028820984
Wrong Answer
X = input() current = None s = 0 t = 0 ans = 0 for x in X: if x == 'S': if current != x: ans += min(s, t) * 2 s = t = 0 s += 1 else: if current != x: t = 0 t += 1 current = x ans += min(s, t) * 2 print(len(X) - ans)
p03778
s529147761
Accepted
#python3 def main(): w, a, b = map(int, input().split()) x = min(abs(a-b), abs((a+w)-b)) y = min(abs((b+w)-(a+w)), abs((b+w)-a)) ans = min(x, y) if (a <= b) & (b <= a+w): print(0) elif (a <= b+w) & (b+w <= a+w): print(0) else: print(ans) main()
p03779
s475489473
Accepted
x = int(input()) ans=0 y=0 for i in range(1,x+1): y=y+i ans+=1 if y>=x: print(ans) break
p02624
s063362833
Wrong Answer
n=int(input()) List=[1 for x in range(n+1)] for x in range(2,n+1): for y in range(x,n+1,x): List[y]+=1 ans=1 for x in range(1,n+1): ans+=(List[x]*x) print(ans)
p03910
s045568753
Wrong Answer
import sys N = int(input()) ans = 0 if N == 1: print(1) sys.exit() for i in range(1, N): ans += i if ans >= N: break for j in range(1, i+1): if ans - N == j: continue print(j)
p02597
s815014414
Accepted
n = int(input()) c = input() w = [0]*(n+1) r = [0]*(n+1) for i in range(0,n): w[i+1] = w[i] r[n-i-1] = r[n-i] if c[i]=='W': w[i+1] += 1 if c[n-i-1]=='R': r[n-i-1] += 1 print(min([w[i]+r[i]-min(w[i],r[i]) for i in range(0,n+1)]))
p02623
s535705159
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_.append(a_[i] + a[i]) for i in range(m): b_.append(b_[i] + b[i]) ans = 0 j = m for i in range(n+1): if a_[i] > k: break while b_[j] > k - a...
p03645
s797047336
Accepted
n,m=map(int,input().split()) A=[] B=[] for i in range(m): a,b=map(int,input().split()) if a==1: A.append(b) if b==n: B.append(a) if len(set(A) & set(B))>0: print("POSSIBLE") else: print("IMPOSSIBLE")
p02859
s125817808
Accepted
r = int(input()) r = r*r print(r)
p02835
s864731770
Accepted
a, b, c = map(int, input().split()) print("win" if (a+b+c) <= 21 else "bust" )
p02829
s213764970
Accepted
A = [int(input()), int(input())] if 1 not in A: print(1) elif 2 not in A: print(2) else: print(3)
p03030
s225490650
Accepted
N = int(input()) sp = [list(input().split())+[i] for i in range(N)] for i in range(N): sp[i][1]=-int(sp[i][1]) sp.sort() for _,_,i in sp: print(i+1)
p03944
s807597899
Wrong Answer
w,h,n = map(int,input().split()) lists = [list(map(int,input().split())) for i in range(n)] x1 = 0 x2 = w y1 = 0 y2 = h for x,y,a in lists: if a == 1: x1 = max(x1,x) elif a == 2: x2 = min(x2,x) elif a == 3: y1 = max(y1,y) elif a == 4: y2 = min(y2,y) x = x2 - x1 y = y2 - y...
p02948
s501354805
Accepted
N,M = map(int, input().split()) from collections import defaultdict d = defaultdict(list) for i in range(N): a,b = map(int, input().split()) d[a].append(b) import heapq q = [] ans = 0 for i in range(1,M+1): #1~MまでOK ls = d[i] for l in ls: heapq.heappush(q,-l) if len(q)==0:continue a =...
p02910
s906110119
Accepted
s = input() def ki(tap): for i in range(0,len(tap),2): if tap[i]=='L': return 'No' def gu(tap): for i in range(1,len(tap),2): if tap[i]=='R': return 'No' if ki(s)=='No' or gu(s)=='No': print('No') else: print('Yes')
p02718
s844022086
Wrong Answer
N, M = map(int, input().split()) A = list(set((map(int, input().split())))) print(A) vote = [] for Ai in A: if Ai > (1 / (4 * M) * sum(A)): vote.append(Ai) if len(vote) >= M: print("Yes") else: print("No")
p03285
s201648764
Accepted
N = int(input()) found = False for x in range(0, 25+1): for y in range(0, 14+1): if 4 * x + 7 * y == N: found = True if found: print("Yes") else: print("No")
p02684
s816754536
Accepted
nk = input().split() n , k = int(nk[0]), int(nk[1]) a = [int(i) for i in input().split()] t = 1 tl = [1] ts = {1} for i in range(len(a)): t = a[t-1] if t in ts: break else: tl.append(t) ts.add(t) tl2 = tl[tl.index(t):len(tl)] # print(tl) # print(tl2) ans = 0 if k...
p03286
s249635458
Accepted
N = int(input()) a = "" if N ==0: a =0 while N !=0: if N%2 != 0: a = "1" + a else: a = "0" + a N = - (N//2) print(a)
p03449
s138290988
Wrong Answer
N = int(input()) A = [] A.append(list(map(int,input().split()))) A.append(list(map(int,input().split()))) low = 0 ans = 0 for i in range(N): # print("low:",low,", i:",i,",A[low][i]:",A[low][i]) if low == 0: ans += A[low][i] else: ans += A[low][i-1] if sum(A[1][i:N-1]) > sum(A[0][i+1:N-1])+A[1][N-1]: ...
p02993
s328758391
Accepted
s=input() for i,j in zip(s,s[1:]): if i==j: print('Bad') exit() print('Good')
p03137
s808898305
Accepted
n,m = map(int,input().split()) X = sorted(list(map(int,input().split()))) d = [] for i in range(len(X)-1): d.append(X[i+1]-X[i]) d.sort(reverse=True) print (sum(d[n-1:]))
p03309
s871298446
Accepted
N = int(input()) A = input().split() A = [int(A[i])-i for i in range(N)] A = sorted(A) s = 0 if N % 2 == 0: k = int(N/2) for i in range(N): s += abs(A[i]-A[k-1]) else: k = int((N+1)/2) for i in range(N): s += abs(A[i]-A[k-1]) print(s)
p03944
s164907892
Accepted
W, H, N = list(map(int, input().split())) x_low, x_up = 0, W y_low, y_up = 0, H for _ in range(N): x, y, a = list(map(int, input().split())) if a == 1: x_low = max(x_low, x) elif a == 2: x_up = min(x_up, x) elif a == 3: y_low = max(y_low, y) else: y_up = min(y_up, y) ...
p03612
s466085095
Wrong Answer
n=int(input()) a=list(map(int,input().split())) for i in range(n): a[i]-=1 ans=0 for i in range(n-1): if a[i]==i and a[i+1]==i+1: continue if a[i]==i: ans+=1 if a[-1]==n-1: ans+=1 print(ans)
p02829
s231482566
Accepted
from sys import stdin import sys ## input functions for me def ria(sep = ''): if sep == '' : return list(map(int, input().split())) else: return list(map(int, input().split(sep))) def rsa(sep = ''): if sep == '' : return input().split() else: return input().split(sep) def ri(): return...
p03075
s237590675
Wrong Answer
A=[int(input()) for i in range(5)] k=int(input()) for i in range(5): for j in range(i,5): if abs(A[i]-A[j])>=k: print(":(") exit() print("Yay1")
p03565
s066000261
Wrong Answer
import sys S = input() T = input() lenS = len(S) lenT = len(T) ans = "" for i in range(lenS-lenT-1,-1,-1): for j in range(lenT): if S[i+j]!=T[j] and S[i+j]!="?": break else: ans = S[:i]+T+S[i+lenT:] print(ans) sys.exit() print("UNRESTORABLE")
p02753
s267055927
Accepted
import sys S = list(sys.stdin.readline().strip()) if len(set(S)) > 1: print("Yes") else: print("No")
p02952
s188089465
Wrong Answer
N = int(input()) count = 0 for i in range(0, len(str(N)), 2): if N >= 10**(i+1): count += 9 * 10**i else: count += N % 10**i + 1 print(count)
p02817
s867780829
Wrong Answer
S,T = input().split() print(S+T)
p03011
s284502281
Wrong Answer
try: n=list(map(int, input().strip().split())) lis1=[] for i in range(0,len(n)): for a in range(0,len(n)): if n[i]!=n[a]: z=int(n[a]+n[i]) lis1.append(str(z)) print(int(min(lis1))) except: print('')
p04043
s360638108
Accepted
# -*- coding: utf-8 -*- """ Created on Wed May 13 11:57:51 2020 @author: shinba """ A = list(map(int,input().split())) B = [[5,5,7],[5,7,5],[7,5,5]] if A in B: print("YES") else: print("NO")
p02714
s635311586
Wrong Answer
n = int(input()) s=input() r=[] g=[] b=[] for i,c in enumerate(s): if 'R' == c: r.append(i+1) elif 'G' == c: g.append(i+1) elif 'B' == c: b.append(i+1) print(r,g,b) count=0 for i in r: for j in g: for k in b: if j*2-i-k != 0: count+=1 print(cou...
p02832
s268207187
Accepted
n = int(input()) a = [int(i) for i in input().split()] i = 0 check = 1 satisfy = [False for i in range(n)] break_block = 0 while i < n: if a[i] == check and not satisfy[check - 1]: satisfy[check - 1] = True check += 1 else: break_block += 1 i += 1 if not satisfy[0]: print(-1) els...
p04020
s539974194
Wrong Answer
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline n = int(input()) a = list(int(input()) for i in range(n)) ans = 0 for i in range(n): ans += a[i]//2 i=0 while i < n-1: if a[i] %2==1 and a[i+1]%2==1: ans+=1 i+=1 elif i<n-2: if a[i] %2==1 and a[i+1]%2==0 and a[i...
p03803
s950381419
Accepted
A, B = map(int, input().split()) if A == 1: A += 13 if B == 1: B += 13 if A > B: print('Alice') elif A < B: print('Bob') else: print('Draw')
p02829
s355383869
Wrong Answer
input() bs = list(map(int,input().split())) def f(bs): print(bs) if bs[0] == 1: if len(bs) == 1: return 0 else: return int(f([x-1 for x in bs][1:])) else: return int(1 + f([x for x in bs][1:])) if 1 not in bs: print(-1) el...
p02612
s511946553
Accepted
import math n = int(input()) print( math.ceil(n/1000)*1000-n)
p03103
s176859530
Accepted
n,m = map(int, input().split()) yen = [list(map(int, input().split())) for _ in range(n)] yen.sort(key=lambda x:(x[0])) ans = 0 hon = 0 for i in range(n): if hon + yen[i][1] <= m: hon += yen[i][1] ans += yen[i][0]*yen[i][1] else: ans += yen[i][0]*(m-hon) hon = m if hon == m: ...
p03087
s864570056
Wrong Answer
import sys stdin = sys.stdin mod = 10**9 + 7 ns = lambda: stdin.readline().rstrip() ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) n, q = na() s = ns() ac = [] now = 0 f = False for si in s: if si == "C" and f: now += 1 f = False elif si == "A": f = True ...
p03041
s982982561
Accepted
N, K = map(int, input().split()) S = input() ans = "" for i, s in enumerate(S): if i == K-1: ans += s.lower() else: ans += s print(ans)
p02646
s562464439
Accepted
A, V = map(int,input().split()) B, W = map(int,input().split()) T = int(input()) dist = abs(A - B) if dist <= T * (V - W): print("YES") else: print("NO")
p02645
s591010029
Accepted
a=input() print(a[0] ,end="") print(a[1] ,end="") print(a[2])
p03487
s331840289
Wrong Answer
from collections import Counter n = int(input()) a = [int(x) for x in input().split()] ans = 0 A = Counter(a) for i in A.keys(): if i != A[i]: ans += min(A[i], abs(A[i]-i)) print(ans)
p02765
s996792800
Wrong Answer
N, R = map(int, input().split()) print(R + 100*(10-N))
p02948
s503564293
Wrong Answer
import collections import heapq n,m = map(int,raw_input().split(' ')) elems = [map(int, raw_input().split(' ')) for _ in range(n)] heap = [] chosen = [] j = 0 cumul = 0 for i in range(1,m+1): while(j < len(elems) and elems[j][0] <= i): heapq.heappush(heap,-elems[j][1]) j+=1 if heap: cumul -= heapq.heappop(h...
p03557
s219042647
Accepted
# C - Snuke Festival import numpy as np N = int(input()) A = np.array(list(int(x) for x in input().split())) B = np.array(list(int(x) for x in input().split())) C = np.array(list(int(x) for x in input().split())) A.sort() C.sort() ans = np.sum(np.searchsorted(A, B,'left') * (N - np.searchsorted(C, B,'right'))) print(...
p03836
s313970970
Accepted
sx, sy, tx, ty = map(int, input().split()) ans = "" y = (ty - sy) x = (tx - sx) # 一周目 ans += "U" * y ans += "R" * x ans += "D" * y ans += "L" * x # 二周目 ans += "L" ans += "U" * (y + 1) ans += "R" * (x + 1) ans += "D" ans += "R" ans += "D" * (y + 1) ans += "L" * (x + 1) ans += "U" print(ans)
p03475
s013640778
Wrong Answer
N = int(input()) li = [list(map(int, input().split())) for i in range(N - 1)] for n in range(N): if n == N - 1: print(0) break ans = 0 for index, i in enumerate(li): if index < n: continue if ans < i[1]: ans = i[1] else: if (ans - i[1]) % i[2] != 0: ans += (ans %...
p02627
s986999149
Accepted
N = input() if(N.lower() == N): print("a") else: print("A")
p03210
s669160040
Accepted
X=int(input()) p=[3,5,7] if X in p: print('YES') else: print('NO')
p03745
s821103972
Accepted
N = int(input()) A = list(map(int,input().split())) con = 0 state = "FLAT" for i in range(0,N - 1): if state == "FLAT": if A[i + 1] > A[i]: state = "INCREASE" elif A[i + 1] < A[i]: state = "DECREASE" elif state == "INCREASE": if A[i + 1] < A[i]: con += 1 state = "FLAT" elif s...
p03556
s258319392
Accepted
N = int(input()) print(int(N ** 0.5)**2)
p03261
s397291513
Accepted
n = int(input()) w = [input() for i in range(n)] ok = "Yes" e = w[0][-1] double = [w[0]] for i in range(1, n): if double.count(w[i]) != 0: ok = "No" break double.append(w[i]) s = w[i][0] if s != e: ok = "No" break e = w[i][-1] print(ok)
p03779
s395685614
Accepted
x=int(input()) ans,k,i=0,1,0 while 1: ans+=k if ans>=x: break k+=1 print(k)
p03137
s857178932
Wrong Answer
N,M=map(int,input().split()) X=sorted([int(i) for i in input().split()]) print(sum(sorted([X[i+1]-X[i] for i in range(~-M)])[:M-N]))
p03797
s273863677
Accepted
n,m = map(int,input().split()) if n*2 >= m: print(m//2) else: print((m+2*n)//2//2)
p02639
s509829520
Accepted
X = [int(i) for i in input().split()] print(X.index(0)+1)
p02622
s113541943
Accepted
# Minor Change S = input() T = input() ans = 0 for e in zip(S,T): ans += [0,1][e[0]!=e[1]] print(ans)
p03076
s019684189
Accepted
a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) lis = [a,b,c,d,e] lis2 = [999]*5 for i in range(5): if lis[i]%10==0: lis2[i] = 10 else: lis2[i] = lis[i]%10 last = lis2.index(min(lis2)) total = 0 for i in range(5): if i ==last: total += lis[i] else: total +=...
p03434
s245609972
Wrong Answer
n=int(input()) a=list(map(int,input().split())) s=0 a.reverse() s=sum(a[:n:2])-sum(a[1:n:2]) print(abs(s))
p03131
s929347083
Accepted
k, a, b = map(int, input().split()) if 2 >= b - a or k+1 <= a: print(k+1) else: i = -(a-k-1)//2 ans = k+1 -a*i + b*i -2*i print(ans)
p03062
s722533825
Wrong Answer
n = int(input()) a = list(map(int, input().split())) count = 0 ans, mina = a[0], a[0] flag = False for i in range(1, n): ans += abs(a[i]) mina = min(mina, abs(a[i])) if a[i]<0: count += 1 if count%2 or a.count(0): print(ans-mina*2) else: print(ans)
p02766
s341599545
Wrong Answer
n,k=map(int,input().split()) import math print(math.ceil(math.log(n,k)))
p02571
s771658271
Accepted
S = input() T = input() ans = 10 ** 5 sl = len(S) tl = len(T) for i in range(sl-tl+1): cnt = 0 for j in range(tl): if S[i+j] == T[j]: continue cnt += 1 ans = min(ans, cnt) print(ans)
p02718
s761518205
Accepted
N, M = map(int, input().split()) A = list(map(int, input().split())) mmin = sum(A) / (4*M) A.sort(reverse=True) if A[M-1] < mmin: print('No') else: print('Yes')
p03474
s813017021
Accepted
A, B = map(int, input().split()) S = input() a = S[:A] c = S[A] b = S[A:] try: a = int(a) b = int(b) if c == '-': print('Yes') else: print('No') except: print('No')
p03827
s435914044
Accepted
n = int(input()) s = input() x = 0 y = 0 for i in range(n): if s[i] == 'I': y += 1 else: y -= 1 if y > x: x = y print(x)
p03910
s151228446
Accepted
N = int(input()) st = set() s = 0 n = 1 while s < N: st.add(n) s += n n += 1 if s > N: st.remove(s-N) print(*st, sep='\n')
p03317
s922936983
Wrong Answer
import math n,k = map(int,input().split()) a = list(map(int,input().split())) m = 0 for i in range(n): if a[i] == 1: m = i break print(math.ceil(i/(k-1))+math.ceil((n-i)/(k-1)))