problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02971
s705958627
Accepted
n=int(input()) a=[] for i in range(n): a.append(int(input())) ma=max(a) if a.count(ma)>1: for i in range(n): print(ma) else: for i in range(n): if a[i]==ma: a[i]=0 print(max(a)) else: print(ma)
p03220
s717210972
Wrong Answer
N = int(input()) T,A = map(int,input().split()) H = list(map(int,input().split())) diff = [] for i in H: diff.append(abs(A-T+i*0.006)) diffmin = diff[0] ans = 0 for i in range(N): if diffmin > diff[i]: diffmin = diff[i] ans = i print(ans)
p02911
s728006751
Accepted
n,k,q = map(int, input().split()) pdic = {} for i in range(q): p = int(input()) if p in pdic: pdic[p] += 1 else: pdic[p] = 1 for i in range(1,n+1): if i in pdic: if k + pdic[i] - q <= 0: print('No') else: print('Yes') else: if k - q <= 0: print('No') else: print('Yes')
p03835
s508979358
Accepted
import numpy as np K, S = map(int, input().split()) fft_len = 1 << (K * 3).bit_length() x = np.ones(K + 1) Fx = np.fft.rfft(x, fft_len) Fx3 = Fx * Fx * Fx conv = np.fft.irfft(Fx3, fft_len) ans = conv[S] ans = int(ans + 0.5) print(ans)
p02717
s281994640
Accepted
x, y, z = input().split() print(z, x, y)
p03438
s254158043
Wrong Answer
from math import ceil def main(): length = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) required_operation = sum(b) - sum(a) count_operation = 0 for i in range(length): if a[i] < b[i]: count_operation += ceil((b[i] - a[i]) / 2) else: count_operation += a[i] - b[i] print("Yes" if required_operation == count_operation else "No") if __name__ == '__main__': main()
p02630
s013017357
Accepted
import collections N = int(input()) nums = list(map(int, input().split())) Q = int(input()) nums_hash = collections.Counter(nums) sum_point = sum(nums) for _ in range(Q): # print(nums_hash) b, c = map(int, input().split()) if b in nums_hash: sum_point = (sum_point - (b * nums_hash[b]) + (c * nums_hash[b])) print(sum_point) nums_hash[c] += nums_hash[b] nums_hash[b] = 0
p03486
s283892903
Wrong Answer
print("Yes" if sorted(input())<sorted(input()) else "No")
p02779
s588241892
Accepted
N = int(input()) A = list(map(int,input().split())) A = sorted(A) flag = 0 for i in range(N-1): if A[i]==A[i+1]: flag = 1 break if flag == 0: print('YES') else: print("NO")
p02811
s783010555
Accepted
k, x = map(int, input().split()) ret = "No" if k * 500 >= x: ret = "Yes" print("{}".format(ret))
p02571
s803950285
Accepted
s = list(input()) t = list(input()) l_s = len(s) l_t = len(t) change = l_t for i in range(l_s - l_t + 1): change_temp = 0 for j in range(l_t): if s[i+j] != t[j]: change_temp += 1 change = min(change, change_temp) print(change)
p02957
s688843807
Accepted
A,B=map(int,input().split()) K=abs((A+B)/2) if K.is_integer()==True: print(int(K)) else: print('IMPOSSIBLE')
p03017
s191449874
Accepted
N, A, B, C, D = map(int, input().split()) S = input() if C < D: if "##" in S[A - 1:C] or "##" in S[B - 1:D]: print("No") else: print("Yes") else: if "..." in S[B - 2:D + 1] and "##" not in S[A - 1:C] and "##" not in S[B - 1:D]: print("Yes") else: print("No")
p03042
s821837505
Wrong Answer
s=input() f=int(s[:2]) b=int(s[2:]) if f>=13: if 0<b and b<13: print("YYMM") else: print("NA") elif 0<f and f<13: if 0<b and b<13: print("AMBIGUOUS") else: print("MMYY") else: print("NA")
p02823
s989695778
Wrong Answer
N, A, B = input().split(' ') N = int(N) A = int(A) B = int(B) if (B-A)%2 == 0: count = (B-A)/2 else: if (N-B)<A-1: count = (N-B)+1+((N-(A+(N-B)+1))/2) else: count = (A-1)+1+((((B-(A-1))-1)-1)/2) print(int(count))
p03319
s904502119
Accepted
N, K = map(int, input().split()) A = list(map(int, input().split())) start = 0 for i in range(N): if A[i] == 1: start = i break ans = N for i in range(K): cnt = 1 left = start + 1 - K + i if left > 0: if left % (K - 1) != 0: cnt += 1 cnt += left // (K - 1) raight = N -1 - start - i if raight > 0: if raight % (K - 1) != 0: cnt += 1 cnt += raight // (K - 1) ans = min(ans, cnt) print(ans)
p03693
s590291975
Accepted
[r, g, b] = list(input().split()) rgb = int(r + g + b) if rgb % 4 == 0: print("YES") else: print("NO")
p03720
s743989805
Accepted
# -*- coding: utf-8 -*- import collections n, m = map(int,input().split()) ab = [] for i in range(m): ab.extend(list(map(int, input().split()))) c = collections.Counter(ab) for i in range(1,n + 1): print(c[i])
p03220
s740803144
Accepted
import sys N = int(input()) T, A = map(int, input().split()) H = list(map(int, input().split())) j = 0 Ta = 1e5 + 1 for i in range(N): Tm = T - H[i] * 0.006 Tb = abs(Tm - A) if Ta > Tb: Ta = Tb j = i print(j + 1)
p02717
s009341949
Accepted
A, B, C = map(int, input().split()) print(C, A, B)
p03721
s722366034
Accepted
n, k = map(int,input().split()) l = sorted([list(map(int, input().split())) for _ in range(n)]) x = 0 for i in range(n): x += l[i][1] if x >= k: print(l[i][0]) break
p02754
s557399223
Accepted
def resolve(): N, A, B = map(int, input().split()) division = N // (A + B) mod = N % (A + B) ans = division * A if (mod > A): ans += A else: ans += mod print(ans) resolve()
p03657
s922571704
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')
p02780
s516512109
Accepted
n,k = map(int,input().split()) p = list(map(int,input().split())) s = [0] ans = [0] #累積和 for i in range(n): s.append(s[i]+(p[i]+1)/2) #区間kの和をリストに格納 for i in range(n-k+1): ans[i] = s[k+i] - s[i] ans.append(ans[i]) #区間kの和の中で最大値 print(max(ans))
p02768
s843249254
Accepted
n, a, b = map(int, input().split()) mod = 10**9+7 def nCr(N, R, mod): R = min(R, N-R) numer = denom = 1 for i in range(1, R+1): numer = numer * (N+1-i) % mod denom = denom * i % mod return numer * pow(denom, mod-2, mod) % mod ans = pow(2,n,mod) ans -= 1 ans -= nCr(n,a,mod) ans %= mod ans -= nCr(n,b,mod) ans %= mod print (ans)
p03408
s130330470
Wrong Answer
N=int(input()) n=[str(input()) for i in range(N)] M=int(input()) m=[str(input()) for i in range(M)]
p03760
s057526401
Wrong Answer
a = input() b = input() a_len = len(a) b_len = len(b) huku = [] for i in range(a_len): if a_len != b_len & i==a_len-1: break else: huku.append(a[i]) huku.append(b[i]) for i in range(len(huku)): print(huku[i],end="")
p02833
s373049892
Wrong Answer
import math def main(): N = int(input()) if N%2 == 1 or N==0: print(0) else: P = int(math.log(N,5)) N = int(N/2) ans = [ int(N/(5**p)) for p in range(1,P+1)] print(sum(ans)) if __name__ == '__main__': main()
p03821
s434776587
Accepted
num = (int)(input()) button = [] for i in range(num): button.append(list(map(int, input().split(" ")))) count = 0 for i in range(num - 1, -1, -1): button[i][0] += count tasu = button[i][1] - (button[i][0] % button[i][1]) if button[i][0] % button[i][1] != 0 else 0 #print(tasu, count) count += tasu print(count)
p03377
s089245852
Wrong Answer
a,b,x=map(int,input().split()) print('YES' if a<x and a+b>x else 'NO')
p03385
s770207774
Accepted
s = input() print("Yes" if len(set(s)) == 3 else "No")
p03611
s190973408
Wrong Answer
N = int(input()) a_s = list(map(int,input().split())) cnt = [0] * (max(a_s)+1) for a in a_s: cnt[a] += 1 answer = 1 for i,c in enumerate(cnt): if i < 1: continue if i < 2: answer = max(answer, sum(cnt[i-1:i+1])) continue answer = max(answer, sum(cnt[i-2:i+1])) print(answer)
p02571
s729568207
Accepted
S = input() T = input() if S in T: print('0') else: count = 0 for i in range(len(S) - len(T) + 1): tmp = 0 for p in range(len(T)): if S[i + p] == T[p]: tmp += 1 if count < tmp: count = tmp print(len(T) - count)
p02801
s625394221
Accepted
#151_A print(chr(ord(input()) + 1))
p02708
s146017665
Accepted
n,k=map(int,input().split()) ans=0 for i in range(k,n+2): ans+=1+(i*(n+n-i+1)- i*(i-1))/2 if ans>10**9+7: ans%=10**9+7 print(int(ans))
p02989
s822264699
Wrong Answer
N = int(input()) d = list(map(int, input().split())) same = N / 2 d.sort() distribution = [0] * d[len(d) - 1] total = 0 for di in d: num = d.count(di) distribution[di - 1] = num print(distribution) total = 0 totals = [0] * d[len(d) - 1] num = 0 for i in range(len(distribution)): total += distribution[i] totals[i] = total if totals[i] == same: num += 1 elif num >= 1: break print(num)
p03910
s039586277
Wrong Answer
n = int(input()) a = [i+1 for i in range(n)] for i in range(n ** 2): g = [] for j in range(n): if ((i >> j) & 1): g.append(a[j]) if sum(g) == n: print(*g) break
p02783
s753475843
Accepted
h,a=map(int,input().split()) x=0 if h%a>0: x=1 print(h//a+x)
p04029
s542354061
Accepted
N = int(input()) a = 0 for i in range(N): a+= i+1 print(a)
p03038
s814876825
Wrong Answer
N, M = map(int,input().split()) A = list(map(int, input().split())) for i in range(M): B, C = map(int,input().split()) A += [C]*B print(A) A.sort() print(sum(A[-N:-1])+A[-1])
p03761
s674181698
Wrong Answer
from collections import Counter n=int(input()) s=[ input() for i in range(n)] alf=list("abcdefghijklmnopqrstuvwxyz") ans=dict() for i in alf: ans[i]=1000 for i in s: sl=list(i) sl=Counter(sl) for j in alf: if not sl[j]: ans[j]=0 elif ans[j]>sl[j]: ans[j]=sl[j] s="" for i in ans: if ans[i]!=0: s+=str((i*int(ans[i]))) print(s)
p02677
s949143383
Accepted
import math A, B, H, M = map(int, input().split()) angle = abs((H*30 + M*0.5) - M*6)%360 print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(angle*math.pi/180)))
p03264
s918648407
Wrong Answer
k=int(input()) if k % 2 == 0: print((k / 2) * (k / 2)) else: print(int(k // 2 * (k // 2 + 1)))
p03474
s398805221
Accepted
a, b = map(int, input().split()) s = input() s_a = s[0:a] s_b = s[(a+1):(a+2)+b] minus = s[a] if minus == "-" and s_a.isdecimal() and s_b.isdecimal(): print("Yes") else: print("No")
p03219
s856931156
Accepted
X,Y=map(int,input().split()) print(int(X+Y/2))
p02615
s752556778
Accepted
# -*- coding: utf-8 -*- n=int(input()) alist=list(map(int,input().split())) blist=sorted(alist,reverse=True) total=blist[0] for i in range(1,int(n/2)): total+=blist[i]*2 if n%2: total+=blist[int(n/2)] print(total)
p03860
s895325954
Accepted
a,b,c=input().split() print(a[0]+b[0]+c[0])
p03624
s349863918
Accepted
s = input() alphabet = 'abcdefghijklmnopqrstuvwxyz' for t in s: alphabet = alphabet.replace(t, '') r = alphabet[0] if len(alphabet) > 0 else 'None' print(r)
p02547
s600442066
Accepted
n = int(input()) d1, d2 = [], [] for i in range(n): a, b = input().split() d1.append(int(a)) d2.append(int(b)) count = 0 for a, b in zip(d1, d2): if a == b: count += 1 else: count = 0 if count == 3: print('Yes') break if count != 3: print('No')
p03759
s433574818
Wrong Answer
N=input() N=N.replace(' ','') N=list(N) if (int(N[1])-int(N[0]))==(int(N[2])-int(N[1])): print("YES") else : print("NO")
p02772
s969777076
Wrong Answer
n = int(input()) a = list(map(int, input().split())) b = "" for i in a: if i % 2 == 0: if (i % 3 == 0 or i % 5 == 0): b = "APPROVED" else: b = "DENIED" break print(b)
p03150
s414913870
Accepted
s = input() t = 'keyence' idx = 0 for i in range(len(s)): if i < len(t): if s[i] != t[i]: idx = i break elif i == len(t): print('YES') exit() for i in range(idx,len(s)): if s[:idx] + s[i:] == t: print('YES') exit() print('NO')
p02595
s573097064
Accepted
a,b=map(int, input().split()) B = b**2 ans = 0 for i in range(a): x,y=map(int, input().split()) if x**2 + y**2 <= B: ans += 1 print(ans)
p03206
s944731577
Accepted
import sys ri = lambda: int(sys.stdin.readline()) s = ri() print(['Christmas Eve Eve Eve', 'Christmas Eve Eve', 'Christmas Eve', 'Christmas'][s-22])
p03479
s287375955
Wrong Answer
x,y = map(int,input().split()) #2^60 = 1,152,921,504,606,846,976 > 10^18である。 for i in range(60): if y / x < 2**i: print(i) exit()
p02548
s596791300
Wrong Answer
N = int(input()) print(sum([i * j + k == N for i in range(1,N)for j in range(i,N)for k in range(1,N)]))
p02641
s959864564
Accepted
x,n=map(int,input().split()) l=list(map(int,input().split())) num=[] for i in range(-100,102): num.append(i) for i in l: num.remove(i) dif=101 ans=[] for i in num: if dif>abs(i-x): dif=abs(i-x) ans=[i] elif dif==abs(i-x): ans.append(i) print(min(ans))
p02647
s379097528
Wrong Answer
N, K = map(int, input().split()) A = list(map(int, input().split())) # A = [0]*N if N < K*2: for i in range(N): print(N, end=' ') print('') else: for k in range(K): B = [0]*N for i in range(N): for j in range(max(i-A[i], 0), min(A[i]+i+1, N)): B[j] += 1 A = B # print(A) print(A)
p03457
s687087583
Accepted
n = int(input()) ans = "Yes" now_x = 0 now_y = 0 now_t = 0 for i in range(n): t,x,y = map(int,input().split()) if abs(now_x-x)+abs(now_y-y) > (t-now_t): ans = "No" break if (abs(now_x-x)+abs(now_y-y)-(t-now_t))%2 == 1: ans = "No" break now_x = x now_y = y now_t = t print(ans)
p03433
s238243718
Accepted
n = int(input()) a = int(input()) if n % 500 <= a: print("Yes") else: print("No")
p03557
s948280045
Accepted
from bisect import bisect_left N = int(input()) A = list(map(int,input().split())) A.sort() B = list(map(int,input().split())) B.sort() C = list(map(int,input().split())) C.sort() """ 前処理で中部に大きさb以下のパーツを使える場合の組み合わせの数を計算しておく。 """ tmp1 = [0] for b in B: a = bisect_left(A,b) tmp1.append(tmp1[-1]+a) tmp2 = 0 for c in C: idx = bisect_left(B,c) tmp2 += tmp1[idx] print(tmp2)
p02603
s796932929
Accepted
import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;cnt = 0 ;pro = 1 n = int(input()) A = list(map(int, input().split())) now = 1000 for i in range(n-1): if A[i] < A[i+1]: stocks = now//A[i] now += (A[i+1] - A[i])*stocks print(now)
p03338
s470462740
Accepted
N = int(input()) S = input() maxi = 0 for i in range(1,N): a = S[0:i] b = S[i:] aa = set(a) bb = set(b) ans = bb&aa if len(ans) > maxi: maxi = len(ans) print(maxi)
p02814
s555611438
Accepted
from functools import reduce from math import ceil n, m = map(int, input().split(' ')) alist = list(map(int,input().split(' '))) # alist = [i // 2 for i in alist] from fractions import gcd def getLCM(a, b): return a * b // gcd(a, b) def get_lcm_for(your_list): return reduce(lambda x, y: getLCM(x, y), your_list) lcmr = get_lcm_for(alist) for a in alist: if (lcmr//a)%2 == 0: if (lcmr != a): print(0) exit(0) result = m//lcmr + 2*m//lcmr%2 print(result)
p03386
s631333716
Accepted
a,b,k=map(int,input().split()) R=range(a,b+1) for x in sorted(set(R[:k])|set(R[-k:])): print(x)
p02957
s042373545
Accepted
a,b = map(int,input().split()) if (a+b)%2==0: print((a+b)//2) else: print("IMPOSSIBLE")
p02555
s982776637
Accepted
from sys import stdin, setrecursionlimit input = stdin.buffer.readline MOD = 10 ** 9 + 7 N = int(input()) dp = [0 for _ in range(N + 1)] dp[N] = 1 for i in range(N, -1, -1): for j in range(i - 3 + 1): dp[j] = (dp[j] + dp[i]) % MOD print(dp[0])
p02660
s650901619
Wrong Answer
n = int(input()) a = int(n**0.5)+1 if n == 0: print(0) exit() ans = 0 for i in range(2, a+1): j = 1 while 1: if n % pow(i, j) == 0: n = n//pow(i, j) ans += 1 j += 1 else: break if ans == 0: print(1) exit() print(ans)
p03126
s858081207
Wrong Answer
import numpy as np n,m = map(int, input().split()) arr = np.ones(m) for i in range(n): ka = np.array([int(i) for i in input().split()]) for j in range(ka[0]): arr[ka[j+1]-1] = 0 ans = int(arr.sum()) print(ans)
p03220
s880359558
Accepted
N = int(input()) T, A = map(int,input().split()) H = list(map(int,input().split())) pointID = -1 min_diff = 9999999999 for i in range (N): #地点i の温度 と 平均気温の差(絶対値) diff = abs(T - H[i] * 0.006 - A) if diff < min_diff: pointID = i+1 min_diff = diff print(pointID)
p03711
s024263245
Accepted
x, y = map(int, input().split()) group = ['a', 'c', 'a', 'b', 'a', 'b', 'a', 'a', 'b', 'a', 'b', 'a'] if group[x-1] == group[y-1]: print('Yes') else: print('No')
p03319
s783573660
Accepted
import math n, k = map(int, input().split()) a = list(map(int, input().split())) left = math.ceil(a.index(min(a)) / (k - 1)) surplus = (k-(a.index(min(a)) % (k - 1))) % k + 1 right = math.ceil((len(a)-a.index(min(a))-surplus)/(k-1)) print(left+right)
p03997
s348413072
Accepted
a = int(input()) b = int(input()) h = int(input()) print((a+b)*h//2)
p02842
s436638837
Wrong Answer
n = int(input()) r = n % 27 if r == 13 or r == 26: print(':)') elif r ==0: x = int(100*n/108) print(x) else: for i in range(1, 25): if 1.08*(i-1) < r <= 1.08*i: break x = int(100*(n - i)/108) + i print(x)
p03472
s733524992
Accepted
n,h = map(int, input().split()) ab = [] for _ in range(n): data = list(map(int,input().split())) ab.append(data) ab.sort() ab.reverse() max_a = ab[0][0] throw_dmgs = [] for tmp in ab: if tmp[1] > max_a: throw_dmgs.append(tmp[1]) throw_dmgs.sort() throw_dmgs.reverse() ans=0 for i in range(len(throw_dmgs)): ans+=1 h -= throw_dmgs[i] if h <= 0: print(ans) exit() import math swing = math.ceil(h / max_a) print(ans+swing)
p02720
s041176443
Accepted
from collections import deque k = int(input()) dq = deque(list(range(1, 10))) rep = 0 while rep < k: now = dq.popleft() rep+=1 for i in (-1, 0, 1): if 0<=now%10+i<10: dq.append(now*10+now%10+i) print(now)
p03239
s413588210
Accepted
T, N = list(map(int,input().split())) ans_c = 1001 for i in range(T): c, t = list(map(int,input().split())) if (N >= t) and (c <= ans_c): ans_c = c if ans_c == 1001: print("TLE") else: print(ans_c)
p03557
s901639546
Accepted
import bisect n = int(input()) a = sorted(list(map(int, input().split()))) b = list(map(int, input().split())) c = sorted(list(map(int, input().split()))) ans = 0 for i in b: a_pos = bisect.bisect_left(a, i) c_pos = n - bisect.bisect_right(c, i) ans += a_pos * c_pos print(ans)
p03043
s872977283
Accepted
N,K = map(int,input().split()) ans = 0 prob = 1 pow2 = 1 for i in range(N,0,-1): if i*pow2 >= K: ans += prob/N else: while(1): prob = prob/2 pow2 = pow2*2 if i*pow2 >= K: ans += prob/N break print(ans)
p03437
s083455107
Accepted
temp = input() temp2 = temp.split(" ") temp = [] for i in temp2: temp.append(int(i)) for i in range(1,100000000): ans1 = temp[0]*i if ans1 % temp[1] != 0: break if ans1 >= 10^18: ans1 = -1 break print(ans1)
p03797
s605499611
Wrong Answer
n,m= list(map(int, input().split())) if n>=m*2: print(1000000007) else: print(n+(m-n*2)//4)
p02570
s421804349
Accepted
d,t,s = map(int,input().split()) if d/s <= t : print("Yes") else: print("No")
p02935
s626966007
Wrong Answer
N = int(input()) V = list(map(int, input().split())) V.sort(reverse=True) V = iter(V) res = 0 L = N.bit_length() for i in range(L): if (N>>i)&1 != 1: continue for _ in range(1<<i): v = next(V) res += v/(1<<(i+1)) print(res)
p03711
s445237442
Wrong Answer
x,y=map(int,input().split()) a=[1,3,5,7,8,10,12] b=[4,6,9,11] if a.count(x)==a.count(y): print("Yes") elif b.count(x)==b.count(y): print("Yes") else: print("No")
p02677
s384758112
Wrong Answer
import numpy as np import math A, B, H, M = map(int, input().split()) def H_angle(H): return H * 30 def M_angle(M): return M * 6 angle = abs(H_angle(H) - M_angle(M)) if angle >= 180: angle = angle - 180 angle = math.radians(angle) def compute(A, B, angle): A2 = np.square(A) B2 = np.square(B) AB = A * B cos = np.cos(angle) return A2 + B2 - 2 * AB * cos print(np.sqrt(compute(A, B, angle)))
p03623
s862094220
Accepted
x, a, b = map(int, input().split()) if abs(x-a) > abs(x-b): print("B") else: print("A")
p03773
s476218866
Wrong Answer
S_list = list(map(int,input().split())) ans = S_list[0] + S_list[1] if ans <=24 : result = ans else: result = ans - 24 print(result)
p02725
s629817715
Accepted
k,n=map(int,input().split()) poses=list(map(int,input().split())) print(k-max(k-poses[-1]+poses[0],max(pos1-pos0 for pos1,pos0 in zip(poses[1:],poses))))
p02958
s250904653
Wrong Answer
n = int(input()) l = list(int(i) for i in input().split()) s = l.copy() s.sort() flag = False if s == l: flag = True else: for i in range(n): for j in range(i+1, n): t = l.copy() t[i], t[j] = t[j], t[i] if s == t: flag = True if flag: print("Yes") else: print("No")
p02602
s891388405
Wrong Answer
import numpy as np N, K = map(int, input().split()) A = list(map(int, input().split())) score = [] for i in range(N - K + 1) : score.append(np.prod(A[i:i + K])) for i in range(N - K) : if score[i + 1] > score[i] : print("Yes") else: print("No")
p03433
s267424874
Accepted
#--Infinite Coins cost = int(input()) one_coins = int(input()) for i in range(one_coins+1): calculate = cost - i if (calculate % 500 == 0): print ("Yes") exit() else: pass print("No")
p03145
s647815225
Accepted
import sys def input(): return sys.stdin.readline().strip() def resolve(): a,b,c=map(int, input().split()) print(a*b//2) resolve()
p03407
s696322431
Wrong Answer
a, b, c = map(int, input().split()) print("Yes" if (a+b)*2 >= c else "No")
p03852
s859054887
Wrong Answer
import sys input = sys.stdin.readline c = input() v = ["a", "e", "i", "u", "o"] if c in v: print("vowel") else: print("consonant")
p03696
s561690669
Accepted
_,s=input(),input() t=0 for c in s: if c=='(': t+=1 else: t-=1 if t<0: s='('+s; t+=1 print(s+')'*t)
p03838
s377525532
Accepted
x, y = map(int, input().split()) ans = min(abs(x+y)+1, max(y-x, x-y+2)) print(ans)
p02742
s868086333
Accepted
h,w=map(int,input().split()) a=h*w if h!=1 and w!=1: if a%2==0: print(a//2) else: v=(a-1)//2 print(a-v) else: print(1)
p03986
s937675474
Accepted
S = input() cnt = 0 remove = 0 for s in S: if s == "S": cnt += 1 else: if cnt > 0: remove += 2 cnt -= 1 ans = len(S) - remove print(ans)
p03327
s293591013
Wrong Answer
n = input() if len(n) == 3: print('ABC') else: print('ABD')
p03161
s836008977
Accepted
n, k = map(int, input().split()) H = list(map(int, input().split())) dp = [0] * n for i in range(1, n): dp[i] = min(dp[i - j - 1] + abs(H[i] - H[i - j - 1]) for j in range(min(k, i))) print(dp[n - 1])