problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03943
s694293630
Accepted
import sys import numpy as np # a b c キャンディーの数 a, b, c = map(int, input().split()) candy = np.array([a, b, c]) # キャンディーの数順でソート candy.sort() # 少ない2つと一番多いので比較 if (candy[0] + candy[1] == candy[2]): print("Yes") else: print("No")
p03286
s359915922
Accepted
N = int(input()) def solve(N): if N == 0: return '0' ans = '' while N != 0: ans += str(N & 1) N >>= 1 N *= -1 return ans[::-1] print(solve(N))
p02953
s816776970
Accepted
N = int(input()) a = list(map(int, input().split())) if N == 1: print("Yes") else: flag = True for i in range(N-1): if a[len(a)-1-i]-a[len(a)-2-i] < -1: flag=False break if a[len(a)-1-i]-a[len(a)-2-i] == -1: a[len(a)-2-i]-=1 print("Yes") if flag else print("No")
p03377
s077547231
Accepted
a, b, x = map(int,input().split()) if a+b >= x: if a > x: print("NO") else: print("YES") else: print("NO")
p02602
s177422866
Wrong Answer
import numpy as np N, K = map(int, input().split()) A = list(map(int, input().split())) score = np.product(A[:K]) i = 0 for k in range(K, N): score_1 = (score // A[i]) * A[k] i += 1 if score < score_1: print("Yes") else: print("No")
p03309
s616505894
Accepted
N = int(input()) A = list(map(int, input().split())) B = [0]*N for i in range(N): B[i] = A[i] - i B.sort() res = 0 x = B[N//2] for i in range(N): res += abs(x - B[i]) print(res)
p02917
s095090924
Wrong Answer
n = int(input()) b = list(map(int, input().split())) a = list() for num, i in enumerate(b[:]): if num == 0: a.append(0) a.append(0) elif num == n-2: a.append(i) elif i > b[num + 1]: a.append(b[num + 1]) elif i <= b[num + 1]: a.append(i) print(sum(a))
p02720
s782874823
Wrong Answer
from collections import deque k = 100 count = 0 q = deque(range(1,10)) while count < k: l = q.popleft() resid = l % 10 if resid != 0: q.append(l*10 + resid - 1) q.append(l*10 + resid) if resid != 9: q.append(l*10 + resid + 1) count += 1 print(q[k-1])
p03419
s127659182
Accepted
n,m = map(int,input().split()) if n==1 or m==1: ans = max(max(n,m)-2,1) else: ans = (n-2)*(m-2) print(ans)
p02694
s829528508
Accepted
X = int(input()) ret = 0 cur = 100 while cur < X : cur = int(cur * 1.01) ret += 1 print(ret)
p03075
s734978970
Accepted
def main(): K = [int(input()) for i in range(5)] k = int(input()) ans = True for i in range(5): for j in range(i + 1, 5): if K[j] - K[i] > k: ans = False break if ans: print("Yay!") else: print(":(") if __name__ == "__main__": main()
p03042
s604552400
Accepted
S = int(input()) A = S//100 B = S%100 if A >= 13 or A == 0: if B >= 13: print('NA') elif B <13: if B != 0: print('YYMM') else: print('NA') elif A < 13: if B >= 13: print('MMYY') elif B < 13: if B != 0: print('AMBIGUOUS') else: print('MMYY')
p02720
s276507530
Wrong Answer
import queue num=int(input()) q=queue.Queue() for i in range(1,10): q.put(i) for j in range(num): ans=q.get() if ans%10!=0: q.put(10*ans+(ans%10)-1) q.put(10*ans+(ans%10)-1) if ans%10!=0: q.put(10*ans+(ans%10)-1) print(ans)
p02696
s918612459
Wrong Answer
a, b, n = map(int, input().split()) ans_list = [] for q in range(n + 1): ans_list.append(int(a * q / b)) print(max(ans_list))
p02547
s420149414
Accepted
N = int(input()) ans1 = False ans2 = False ans3 = False for i in range(N): D1, D2 = map(int, input().split()) if D1 == D2 and ans1 == False: ans1 = True elif D1 == D2 and ans1 == True and ans2 == False: ans2 = True elif D1 == D2 and ans1 == True and ans2 == True and ans3 == False: ans3 = True print("Yes") exit() elif D1 != D2: ans1 = False ans2 = False ans3 = False print("No")
p02714
s699289652
Wrong Answer
N = int(input()) S = input() D = {"R": [], "G": [], "B": []} for i in range(N): D[S[i]].append(i) print(D) p = 1 for i in D: p *= len(D[i]) cnt = 0 for i in range(N): for j in range(i+1, N): if 2 * j - i < N: if S[i] != S[j] and S[j] != S[2*j-i] and S[2*j-i] != S[i]: cnt += 1 print(p-cnt)
p03962
s384331359
Accepted
S = set(input().split()) print(len(S))
p03434
s421133420
Wrong Answer
input() a = list(map(int, input().split())) a.sort() print(sum(a[::-2]) - sum(a[::2]))
p03309
s024978092
Accepted
import numpy as np n = int(input()) a_ls = list(map(int, input().split())) diff_ls = [a - i for i, a in enumerate(a_ls,1)] diff_ls.sort() med = int(np.median(diff_ls)) ans = 0 for diff in diff_ls: ans += abs(diff - med) print(ans)
p03556
s200933084
Accepted
n = int(input()) print((int(n**(1/2)))**2)
p03998
s427312275
Wrong Answer
dic_s = {x:input() for x in 'abc'} dic_i = {x:i for x,i in zip('abc',[0,0,0])} dic_max = {x:len(dic_s[x]) for x in 'abc'} nt = 'a' while True: dic_i[nt] += 1 if dic_max[nt] == dic_i[nt]: break else: nt = dic_s[nt][dic_i[nt]] print(nt)
p03407
s787062719
Wrong Answer
A, B, C = map(int, input().split()) print("Yes" if 2*A+2*B >= C else "No")
p02993
s979455372
Wrong Answer
s=input() if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:print("Bad") else:print("good")
p03030
s305569214
Accepted
from operator import itemgetter, attrgetter n = int(input()) s = [input().split() for i in range(n)] ss = [] ll = [] l = [] for i in range(0, n): l.insert(i, [s[i][0], int(s[i][1]), i+1]) ss = sorted(l, key=itemgetter(1), reverse=True) ll = sorted(ss, key=itemgetter(0)) for i in ll: print(i[2])
p03962
s910608673
Accepted
print(len(set(input().split())))
p03161
s102580475
Accepted
# -*- coding: utf-8 -*- def main(): n, k = map(int, input().split()) h = list(map(int, input().split())) dp = [0, abs(h[0] - h[1])] for i in range(2, n): min_cost = float('inf') for j in range(max(i - k, 0), i): cost = dp[j] + abs(h[j] - h[i]) if min_cost > cost: min_cost = cost dp.append(min_cost) print(dp[-1]) if __name__ == "__main__": main()
p03289
s738897918
Wrong Answer
S = input() if S[0] != "A": print("WA") exit() elif S[2:-2].count("C") != 1 and S[:2].count("C") != 0 and S[-2:].count("C") != 0: print("WA") exit() else: S = S[1:].replace("C", "") if S.islower(): print("AC") else: print("WA")
p02642
s043610657
Accepted
N = int(input()) A = list(map(int, input().split())) # M = max(A)+1 M = 10**6+1 cnt = [0]*M ans = 0 for a in A: if cnt[a] != 0: cnt[a] = 2 else: for i in range(a, M, a): cnt[i] += 1 for a in A: if cnt[a] == 1: ans += 1 print(ans)
p03061
s572776542
Accepted
# ==================== gcd 最大公約数 from fractions import gcd #from math 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-i-1]) mimax=1 for i in range(n): mi=gcd(l[i],r[i+1]) mimax=max(mi,mimax) print(mimax)
p02795
s035436184
Wrong Answer
H,W,N = [int(input()) for i in range(3)] for o in range(1,10000): if H < W and N / o<= W: print(o) break elif H> W and N / o<=H: print(o) break
p03838
s809116211
Accepted
x, y = map(int, input().split()) count = abs(abs(x)-abs(y)) if x * y < 0: count += 1 elif x * y == 0 and x > y: count += 1 elif x * y > 0: if x < 0 and abs(x) < abs(y): count += 2 elif x > 0 and abs(x) > abs(y): count += 2 print(count)
p03838
s626229018
Accepted
x, y = map(int, input().split()); MAX = 100000000000000; # どれが最小かを考える # そのまま近づける a = y - x; if (a < 0): a = MAX; # xを反転させて近づける b = y + x; if (b < 0): b = MAX; # yを反転 c = y * (-1) - x; if (c < 0): c = MAX; # xとyの両方を反転させて近づける d = y * (-1) + x; if (d < 0): d = MAX; # 最小を求める ans = min(a, b + 1, c + 1, d + 2); print(ans);
p02714
s554382077
Accepted
n = int(input()) s = input() ans = s.count("R") * s.count("G") * s.count("B") cnt = 0 for i in range(n): i_ = s[i] for j in range(i+1, n): if s[j] == i_: continue k = 2 * j - i j_ = s[j] if k >= n or s[k] == i_ or s[k] == j_: continue cnt += 1 print(ans - cnt)
p03011
s101259453
Accepted
rList = sorted(list(map(int,input().split()))) print(rList[0]+rList[1])
p02792
s491494938
Accepted
N = int(input()) sheet = [[0 for i in range(10)] for i in range(10)] cnt = 0 for i in range(1, N + 1): str_i = str(i) sheet[int(str_i[0])][int(str_i[-1])] += 1 res = 0 for i in range(10): for j in range(10): res += sheet[i][j] * sheet[j][i] print(res)
p02755
s958285885
Wrong Answer
a,b=map(int,input().split()) a1,b1=(100*a)//8,10*b #print(a1,b1) if a1//10==b and (b1*8)//100==a: print(min(a1,b1)) elif a1//10==b: print(a1) elif (b1*8)//100==a: print(b1) else: print(-1) #print(max((100*a)//8,10*b))
p02790
s651444789
Accepted
a,b = map(int,input().split()) print(str(a)*b if a <= b else str(b)*a)
p02797
s423398114
Accepted
n,k,s = map(int,input().split()) a=0 b=0 list=[] for i in range(k): list.append(s) if len(list) < n: for i in range(n-len(list)): if s == 1: list.append(s+1) else: list.append(s-1) for i in list: print(i,end=" ")
p03774
s482730318
Accepted
import math def calc_dist(pta, ptb): return abs(pta[0] - ptb[0]) + abs(pta[1] - ptb[1]) n, m = map(int, input().split()) stdts = [tuple(map(int, input().split())) for _ in range(n)] cpts = [tuple(map(int, input().split())) for _ in range(m)] for stdt in stdts: dist_min = math.inf for i in range(m): dist = calc_dist(stdt, cpts[i]) if dist < dist_min: dist_min = dist ans = i + 1 print(ans)
p03329
s327163371
Accepted
N=int(input()) cnt=[0 for _ in range(N+1)] for i in range(1,N+1): cnt[i]=cnt[i-1]+1 a=6 while i-a>=0: cnt[i]=min(cnt[i],cnt[i-a]+1) a*=6 a=9 while i-a>=0: cnt[i]=min(cnt[i],cnt[i-a]+1) a*=9 print(cnt[N])
p02627
s611909037
Wrong Answer
str = input() if str.isupper()=="True": print("A") else: print("a")
p03971
s895969550
Accepted
N, A, B = map(int, input().split()) M = A + B S = input() for s in S: if M <= 0: print("No") elif s == "a": print("Yes") M -= 1 elif s == "b": if B <= 0: print("No") else: print("Yes") M -= 1 B -= 1 else: print("No")
p02691
s103329904
Accepted
import bisect n = int(input()) a = list(map(int,input().split())) # ni - nj = ai + aj (i>j) # ai - ni = - aj - nj a1 = sorted([a[i] - (i+1) for i in range(n)]) a2 = sorted([- a[i] - (i+1) for i in range(n)]) ans = 0 for i in range(n): left = bisect.bisect_left(a2, a1[i]) right = bisect.bisect_right(a2, a1[i]) ans += (right - left) print(ans)
p03208
s627934657
Accepted
N,K = map(int, input().split()) H = [] for i in range(N): H.append(int(input())) H.sort() ans = float('inf') for i in range(N): if (i+K-1 > N-1): break ans = min(ans, H[i+K-1] - H[i]) print(ans)
p03854
s464994818
Accepted
s=input() while len(s)>7: if s[-7:]=="dreamer": s=s[:-7] elif s[-5:]=="dream": s=s[:-5] elif s[-6:]=="eraser": s=s[:-6] elif s[-5:]=="erase": s=s[:-5] else: break if s in ["dreamer","dream","eraser","erase"]: print("YES") else: print("NO")
p02963
s595060088
Accepted
from math import sqrt s = int(input()) a = 10 ** 9 b = s // a c = s % a if c != 0: b += 1 c = a - c print(0, 0, a, 1, c, b)
p03220
s093885464
Wrong Answer
N = int(input()) T, A = map(int, input().split()) H_list = list(map(int,input().split())) ans = 0 temp = 10 ** 6 for i in range(N): t = T - H_list[i] * 0.006 if (A - t) < temp: ans = i + 1 temp = A - t print(ans)
p02696
s466698833
Accepted
import math A, B, N = (int(i) for i in input().split()) def func(A, B, x): return math.floor(A * x / B) - A * math.floor(x/B) print(func(A, B, min(N, B-1)))
p03835
s703764980
Accepted
k,s = map(int,input().split()) ans = 0 for x in range(k+1): for y in range(k+1): if 0 <= s - x - y <= k: ans += 1 print(ans)
p03493
s452662730
Accepted
x = input() count = list(x).count('1') print(count)
p03962
s746768898
Wrong Answer
lis = list(map(int, input().split())) unique_list = [] for i in range(len(lis)): if lis[i] in unique_list or lis[i] in lis[:i] + lis[i+1:] : continue unique_list.append(lis[i]) print(len(unique_list))
p02647
s380359294
Accepted
n,k = map(int,input().split()) a = list(map(int,input().split())) ML = 50 r = min(ML,k) for l in range(r): imos = [0]*(n+1) for i in range(n): left = max(0,i-a[i]) right = min(n,i+a[i]+1) imos[left] += 1 imos[right] -= 1 c = 0 for i in range(n): c += imos[i] a[i] = c print(*a)
p02973
s694413538
Accepted
from bisect import bisect_left, bisect_right n = int(input()) INF = 1010101010 dp = [INF] * n a = [int(input()) for _ in range(n)] a.reverse() for i in a: dp[bisect_right(dp, i)] = i print(bisect_left(dp, INF))
p03345
s805294503
Accepted
A,B,C,K=map(int,input().split()) print(B-A if K%2 else A-B)
p02603
s598002283
Wrong Answer
n = int(input()) a = list(map(int, input().split())) l = [] tmp = [] for i in range(n-1): if a[i] < a[i+1] and len(tmp) == 0: tmp.append(a[i]) elif a[i] > a[i+1] and len(tmp) == 1: tmp.append(a[i]) l.append(tmp) tmp = [] if a[-2] < a[-1]: tmp.append(a[-1]) l.append(tmp) res = 1000 for a, b in l: res = (res // a) * b + res % a print(res)
p03069
s259058066
Accepted
n = int(input()) s = input() w = s.count(".") b = n-w ans = min(w,b) b = 0 for i in range(n): if s[i] == ".": w -= 1 else: b += 1 ans = min(ans,w+b) print(ans)
p03035
s949738237
Accepted
A, B = map(int, input().split()) if A >= 13: print(B) elif 6<= A and A <= 12: print(B//2) else: print(0)
p03254
s983344700
Accepted
N,x = map(int,input().split()) a=list(map(int,input().split())) a.sort() ans=0 for i in range(N): if x == 0: break if x >= a[i]: ans+=1 x-=a[i] else: x = 0 if x != 0: ans -= 1 print(max(0,ans))
p03351
s251081327
Accepted
a, b, c, d = map(int, input().split()) if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d): print('Yes') else: print('No')
p03338
s145841633
Accepted
import math def main(): n = int(input()) s = input() ans=0 for i in range(0,n): sum=0 x=s[:i+1] y=s[i+1:] while len(x)>0: if x[0] in y : sum+=1 x=x.replace(x[0],'') if sum>ans: ans=sum print(ans) main()
p03998
s336760763
Accepted
SA = list(str(input())) SB = list(str(input())) SC = list(str(input())) list=[SA,SB,SC] a=0 while True: if len(list[a])==0: break b=ord(list[a][0])-97 list[a].pop(0) a=b print(chr(a+65))
p03457
s978421976
Wrong Answer
N = int(input()) pt, px, py = 0, 0, 0 can = True for i in range(N): t, x, y = map(int, input().split()) T, X, Y = t - pt, abs(x - px), abs(y - py) if T < X + Y or T % 2 != (X + Y) % 2: can = False print('Yes' if can else 'No')
p03106
s855845149
Wrong Answer
a,b,k = map(int,input().split()) num = 0 metric_num = 0 while True: num += 1 if a % num ==0 and b % num ==0: metric_num += 1 if metric_num == k: break print(num)
p03284
s173623170
Wrong Answer
n, k = map(int, input().split()) print(n % k if n != 1 else 0)
p03693
s791956171
Wrong Answer
r, g, b = map(int, input().split()) num = int(r+g+b) if not num %4 == 0: print('No') else: print('Yes')
p02627
s451948886
Accepted
S=str(input()) if S.isupper()==True: print("A") else: print("a")
p02628
s335994646
Accepted
N, K = map(int,input().split()) p = list(map(int,input().split())) p.sort() print(sum(p[:K]))
p03105
s995941789
Accepted
a,b,c = map(int,input().split()) print(min(b//a,c))
p03329
s520238662
Accepted
n = int(input()) INF = float('inf') L = [1] for x in (6, 9): i = 1 while x ** (i + 1) < 10 ** 6: L.append(x ** i) i += 1 L.sort(reverse=True) dp = [INF] * (n + 1) dp[0] = 0 for m in L: for i in range(n+1): if dp[i] != INF: if i + m <= n: dp[i+m] = min(dp[i] + 1, dp[i+m]) print(dp[-1])
p02596
s695374641
Accepted
def main(): K = int(input()) a_i = 7 if a_i % K == 0: print(1) return for i in range(2, 10 ** 6+1): a_i = a_i * 10 + 7 if a_i % K == 0: print(i) return a_i %= K print(-1) main()
p02832
s386976670
Accepted
# import sys # sys.setrecursionlimit(10 ** 6) # import bisect # from collections import deque # from decorator import stop_watch # # # @stop_watch def solve(N, As): ans = 0 i = 1 for A in As: if A == i: i += 1 else: ans += 1 ans = -1 if ans == N else ans print(ans) if __name__ == '__main__': # S = input() N = int(input()) # N, M = map(int, input().split()) As = [int(i) for i in input().split()] # Bs = [int(i) for i in input().split()] solve(N, As)
p02683
s620471339
Accepted
n, m, x = map(int, input().split()) c = [list(map(int, input().split())) for _ in range(n)] ans = 9**9 flag = False for i in range(2**n): cost = 0 a = [0]*m for j in range(n): if (i >> j) & 1: cost += c[j][0] for k in range(m): a[k] += c[j][k+1] if min(a) >= x: flag = True ans = min(ans, cost) print(ans if flag else -1)
p02583
s060519236
Accepted
n = int(input()) l = [int(i) for i in input().split()] l.sort() ans = 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] or l[j] == l[k]: continue if l[i]+l[j] > l[k]: ans += 1 print(ans)
p03944
s823209771
Wrong Answer
w, h, n = map(int, input().split()) xya = [list(map(int, input().split())) for _ in range(n)] xl, xr, yb, yt = 0, w, 0, h for i in range(n): if xya[i][2] == 1: xl = xya[i][0] elif xya[i][2] == 2: xr = xya[i][0] elif xya[i][2] == 3: yb = xya[i][1] else: yt = xya[i][1] if xr - xl <= 0 or yt - yb <= 0: print(0) else: print((xr - xl)*(yt - yb))
p02899
s884970547
Wrong Answer
n = int(input()) a_list = list(map(int, input().split())) tr_list = [i+1 for i in range(n)] ans_list =[] for i in range(n): ans_list.append(a_list.index(tr_list[i])+1) print(ans_list)
p03160
s834307493
Wrong Answer
n = int(input()) h = list(map(int, input().split())) c = [] for i in range(n-2): d = abs(h[i]-h[i+1]) e = abs(h[i]-h[i+2]) c.append(min(d,e)) if d>e: i+=1 else: i+=2 print(sum(c))
p02795
s411450476
Accepted
H = int(input()) W = int(input()) N = int(input()) large = max(H,W) ans = int((N-1) / large)+1 print(ans)
p03723
s541304142
Accepted
a,b,c=map(int,input().split()) if a==b and a==c and a%2==0: print(-1) else: cnt=0 while a%2==0 and b%2==0 and c%2==0: cnt+=1 i=a j=b a=(b+c)//2 b=(i+c)//2 c=(i+j)//2 print(cnt)
p02918
s992579416
Wrong Answer
n,k=map(int,input().split()) s=input() happy=0 unhappy=0 for i in range(1,n): if s[i]==s[i-1]: happy+=1 else: unhappy+=1 for i in range(k): if unhappy==1: unhappy-=1 happy+=1 break unhappy-=2 happy+=2 print(happy)
p02755
s292190573
Accepted
A,B = map (int,input().split()) eight = [0] * 2000 ten = [0] * 2000 for i in range(2000): eight[i] =(float(i+1) * 0.08)//1 ten[i] = (float(i+1) * 0.1)//1 ans = 0 for i in range(2000): if A == eight[i] and B == ten[i]: ans = i + 1 break if ans == 0: print(-1) else: print(ans)
p03493
s010156393
Accepted
s = input() c = 0 for i in s: if i == '1': c += 1 print(c)
p03774
s678165255
Accepted
N, M = map(int,input().split()) Sab = [list(map(int,input().split())) for i in range(N)] Cab = [list(map(int,input().split())) for i in range(M)] for i in range(N) : ansC = M+1 anslen = 10**10 for j in range(M) : Manh = abs(Sab[i][0] - Cab[j][0]) + abs(Sab[i][1] - Cab[j][1]) if Manh < anslen : ansC = j+1 anslen = Manh print(ansC)
p03286
s672639749
Accepted
N = int(input()) if N == 0: print(0) else: ret = "" while N != 0: if N % 2 != 0: N -= 1 ret = "1" + ret else: ret = "0" + ret N //= -2 print(ret)
p02713
s918650146
Accepted
from math import gcd if __name__ == "__main__": n = int(input()) ans = 0 for i in range(1, n+1): for j in range(1, n+1): for k in range(1, n+1): tmp = gcd(i, j) tmp = gcd(tmp, k) ans += tmp print(ans)
p03324
s053587585
Accepted
A,B=map(int,input().split()) if B==100: C=100**A*(B+1) else: C=100**A*B print(C)
p03285
s250913174
Accepted
n=int(input()) f=0 for i in range(15): for j in range(26): if n==7*i+j*4: f=1 print('Yes'if f else 'No')
p02988
s586519694
Wrong Answer
n = int(input()) p = list(map(int, input().split())) ans = set() for i in range(1, n-1): a = [] a.append(p[i-1]) a.append(p[i]) a.append(p[i+1]) a.sort() if a[0] < a[1] and a[1] < a[2]: ans.add(a[1]) elif a[0] == a[1]: ans.add(a[2]) elif a[1] == a[2]: ans.add(a[1]) print(len(ans))
p03417
s641047692
Accepted
N, M = map(int, input().split()) if N == 1 and M == 1: print(1) exit() if N>=2 and M>=2: print((N-2)*(M-2)) else: if N == 1: print(M-2) else: print(N-2)
p03327
s137650885
Accepted
n= int(input()) if n<=999: print("ABC") else: print("ABD")
p02719
s882306563
Accepted
N, K = map(int, input().split()) print(min(N%K, abs(N%K-K)))
p03773
s665747556
Accepted
a, b = map(int, input().split()) print((a+b)%24)
p03252
s756911552
Accepted
def f(A): dct = {} B = [] i = 0 for a in A: try: B.append(dct[a]) except: dct[a] = i B.append(dct[a]) i += 1 return B S = f(list(input())) T = f(list(input())) if S == T: print('Yes') else: print('No')
p03001
s040597459
Wrong Answer
W, H, x, y = map(int, input().split()) if W//2 == x and H//2 == y: flag = 1 else: flag = 0 print (W*H/2, flag)
p03385
s384427862
Accepted
n = input() print("Yes" if len(set(n)) == 3 else "No")
p03145
s563937669
Wrong Answer
l = list(map(int,input().split())) l.sort() print(l[0]*l[1]/2)
p02888
s150001278
Wrong Answer
import bisect N = int(input()) L = list(map(int,input().split())) L.sort() ans = 0 for a in range(N): for b in range(a+1,N): right = bisect.bisect_left(L, L[a]+L[b]) left = bisect.bisect_left(L, L[b]+1) ans += max((right - left, 0)) print(ans)
p03317
s861880920
Wrong Answer
import numpy as np N,K = map(int,input().split()) an = list(map(int,input().split())) min_an_index = np.argmin(an) a = min_an_index b = N - min_an_index - 1 if K >= a: b -= K - a - 1 if b < 0: b = 1 if K >= b: a -= K - b - 1 if a < 0: a = 1 a1 = a // (K-1) if a % (K-1) != 0: a1 += 1 b1 = b // (K-1) if b % (K-1) != 0: b1 += 1 count = a1 + b1 print(count)
p03478
s873154047
Accepted
n,a,b=map(int,input().split()) ans=0 for i in range(1,n+1): s=str(i) s=sum(list(map(int,s))) if a<=s<=b: ans+=i print(ans)
p03327
s703112795
Accepted
n = int(input()) if n<1000: print('ABC') else: print('ABD')
p02787
s918695968
Wrong Answer
H, N = map(int, input().split()) AB = [tuple(map(int, input().split())) for _ in range(N)] T = [(a, b, a / b) for a, b in AB] T.sort(key=lambda t: t[2], reverse=True) mp = T[0][1] * (H // T[0][0]) rem = H % T[0][0] last = min(t[1] for t in T if t[0] >= rem) if rem >= 1 else 0 print(mp + last)