problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03427
s729564385
Wrong Answer
import math n = str(input()) o = int(math.log10(int(n))//1) if o == 0: print(n) elif n[1:] == "9" * o: print(int(n[0]) + 9*o) else: print(int(n[0]) - 1 + 9*o)
p02596
s138800211
Accepted
K = int(input()) r = 7 % K ans = -2 for i in range(K): if r == 0: ans = i break r = 10*r + 7 r = r % K print(ans+1)
p03435
s058484194
Accepted
l=[list(map(int,input().split())) for i in range(3)] x=l[0][0] y=l[0][1] z=l[0][2] a=0 b=l[1][0]-x c=l[2][0]-x if b+y==l[1][1] and b+z==l[1][2] and c+y==l[2][1] and c+z==l[2][2]: print('Yes') else: print('No')
p02768
s989174176
Accepted
def cmbmod(n, r, k): #nCr mod kを求める(kは素数) p, q = 1, 1 for i in range(r): p = p * (n-i) % k q = q * (r-i) % k return p * pow(q, k-2, k) % k n, a, b = [int(_) for _ in input().split()] const = 10**9 +7 ans = pow(2, n, const) acmb = cmbmod(n, a, const) bcmb = cmbmod(n, b, const) ans = (ans-acmb-bcmb-1) %const print(ans)
p03252
s262411718
Accepted
smap, tmap = [-1] * 26, [-1] * 26 S = input() T = input() ans = 'Yes' for s, t in zip(S, T): s = ord(s) - ord('a') t = ord(t) - ord('a') if smap[s] >= 0: if smap[s] != t: ans = 'No' break else: smap[s] = t if tmap[t] >= 0: if tmap[t] != s: ans = 'No' break else: tmap[t] = s print(ans)
p02624
s352016324
Accepted
N = int(input()) ans = 0 for j in range(1, N + 1): # ans+=j+2j+...(N//j)j n = N // j ans += j * n * (n + 1) // 2 print(ans)
p03799
s997610629
Accepted
n, m = map(int,input().split()) if m - 2 * n >= 0: ans = n + (m-2*n)//4 print(ans) else: print(m//2)
p04045
s937943882
Accepted
# 24 import sys def input(): return sys.stdin.readline().strip() def I(): return int(input()) def LI(): return list(map(int, input().split())) def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def S(): return input() def LS(): return input().split() INF = float('inf') n, k = LI() d = set(LI()) # 最小金額から条件を満たすまで増やしていく while True: if all(int(j) not in d for j in str(n)): # 全ての桁の数字が d に属さない print(n) exit() n += 1
p02548
s263044201
Wrong Answer
n = int(input()) s = 0 t = 0 for i in range(1, n): for j in range(1, int((n-i)**0.5)+1): if (n-1) % j == 0: s += 1 if int((n-i)**0.5) == (n-i)**0.5: t += 1 print(s * 2 - t)
p03836
s245554830
Accepted
sx,sy,tx,ty=map(int,input().split()) dx=tx-sx dy=ty-sy ans="" for i in range(dy): ans+="U" for j in range(dx): ans+="R" for i in range(dy): ans+="D" for j in range(dx): ans+="L" ans+="L" for i in range(dy+1): ans+="U" for i in range(dx+1): ans+="R" ans+="DR" for i in range(dy+1): ans+="D" for i in range(dx+1): ans+="L" ans+="U" print(ans)
p02787
s480675751
Accepted
H, N = map(int, input().split()) A = [] B = [] for n in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) INF = float('inf') dp = [INF] * (H + max(A)) dp[0] = 0 # dp[i]を、HP iを減らすために必要な最小の魔力とする for hp in range(1, H+1): for n in range(N): dp[hp] = min(dp[max(hp-A[n],0)] + B[n], dp[hp]) print(dp[H])
p02729
s126794764
Accepted
n,m=map(int,input().split()) ans=0 if n>=2: ans+=n*(n-1)//2 if m>=2: ans+=m*(m-1)//2 print(ans)
p03767
s154133378
Accepted
N = int(input()) a = sorted(list(map(int, input().split())))[::-1] print(sum(a[1::2][:N]))
p02659
s168682727
Accepted
# C - Multiplication 3 a, b = input().split() a = int(a) assert b[-3] == '.' b = int(b[:-3] + b[-2:]) print(a * b // 100)
p02645
s491603819
Accepted
#!/usr/bin/env python3 from collections import deque, Counter from heapq import heappop, heappush from bisect import bisect_right def main(): S = input() print(S[:3]) if __name__ == "__main__": main()
p02756
s849750286
Accepted
from collections import deque S = deque(input()) Q = int(input()) Q_list = [list(map(str, input().split())) for i in range(Q)] rev = False for i in range(Q): if int(Q_list[i][0]) == 1: rev = not rev else: F = Q_list[i][1] C = Q_list[i][2] if rev ^ (int(F) == 1): # 排他的論理和片方真片方ぎの時真になる S.appendleft(C) else: S.append(C) if rev: S.reverse() print(''.join(S))
p02660
s540595964
Accepted
n=int(input()) a=[] ans=0 for i in range(2,n): if i*i>n: break x=0 while n%i==0: n//=i x+=1 a.append(x) if n!=1: ans+=1 for i in a: b=1 while b<=i: i-=b b+=1 ans+=1 print(ans)
p02646
s548559728
Accepted
a,v=map(int,input().split()) b,w=map(int,input().split()) t=int(input()) if t*(v-w)>=abs(a-b): print("YES") else: print("NO")
p03262
s958647060
Accepted
def gcd(a, b): while b != 0: a, b = b, a % b return a N, X = map(int, input().split()) x = list(map(int, input().split())) x.insert(0, X) distance = [] for i in range(1, len(x)): distance.append(abs(x[i] - x[i - 1])) ans = distance[0] for i in range(1, len(distance)): ans = gcd(ans, distance[i]) print(ans)
p03059
s127224896
Accepted
a,b,t=map(int,input().split()) co=(t+0.5)//a print(int(b*co))
p03778
s166718926
Wrong Answer
w,a,b=map(int,input().split()) if b>=a+w: print(b-a-w) else: if b+w>=a: print(b+w-a) else: print(a-b-w)
p03037
s986282096
Wrong Answer
N,M=map(int,input().split()) ans=0 L,R=0,(10**5)+1 for i in range(M): l,r=map(int,input().split()) L=max(L,l); R=min(R,r) if r<l: break R=min(R,N) print(abs((L-1)-R))
p03699
s305843937
Wrong Answer
N = int(input()) s = [] for i in range(N): s.append(int(input())) s.sort() ans = sum(s) if ans % 10 == 0: fil = list(filter(lambda x: x % 10 != 0, s)) if len(fil) == 0: print(0) else: print(ans - s[0]) else: print(ans)
p02682
s479251360
Accepted
A,B,C,K = map(int, input().split()) if A >= K: print(K) elif A + B >= K: print(A) else: L = K - A - B print(A - L)
p03371
s818800337
Accepted
def resolve(): A, B, C, X, Y = [int(i) for i in input().split()] # Cを0~max(X,Y)の2倍まで購入 minA = float("inf") for i in range(0, max(X, Y) * 2 + 1, 2): sumA = C * i sumA += (A * (X - i // 2) if (X - i // 2) > 0 else 0) sumA += (B * (Y - i // 2) if (Y - i // 2) > 0 else 0) minA = min(minA, sumA) print(minA) resolve()
p02777
s506612718
Accepted
s, k = input().split(' ') sn, kn = map(int, input().split(' ')) u = input() if s == u: print(sn - 1, kn) else: print(sn, kn - 1)
p02911
s417024918
Accepted
from sys import stdin n, k, q = map(int, stdin.readline().rstrip().split()) a = [0] * q for i in range(q): a[i] = int(stdin.readline().rstrip()) l = [0] * (n+1) for ai in a: l[ai] += 1 for i in range(n): j = i+1 point = k - (q-l[j]) if point <= 0: print('No') else: print('Yes')
p02624
s854026177
Accepted
N = int(input()) K = [0] * (N+1) for i in range(1, N+1): for j in range(i, N+1, i): K[j] += 1 ans = 0 for i in range(1, N+1): ans += i * K[i] print(ans)
p03252
s640701166
Accepted
from collections import Counter s = input() t = input() s_count = Counter(s) t_count = Counter(t) if sorted(s_count.values()) == sorted(t_count.values()): print("Yes") else: print("No")
p03785
s933103461
Accepted
n,c,k=map(int,input().split()) t=[0]*n for i in range(n): t[i]=int(input()) t.sort() ans=1 temp=t[0] tempc=1 for i in range(1,n): if temp+k<t[i] or tempc>=c: ans=ans+1 temp=t[i] tempc=1 else: tempc=tempc+1 print(ans)
p03997
s615603616
Accepted
a = int(input()) b = int(input()) h = int(input()) print( (a+b)*h//2 )
p02695
s605541669
Accepted
import itertools n,m,q=map(int,input().split()) l=[] for i in range(q): a=list(map(int,input().split())) l.append(a) #print(l) ans=0 aa=0 for now in itertools.combinations_with_replacement(range(1,m+1), n): aa+=1 ansn=0 #print(now) for i in l: if now[i[1]-1]-now[i[0]-1]==i[2]: ansn+=i[3] #print(ansn) if ansn>ans: ans=ansn #print(aa) print(ans)
p03478
s876022266
Accepted
N,A,B = input().split() N,A,B = map(int,(N,A,B)) f=0 for i in range(1,N+1): k=i a = i//10000 i = i-a*10000 b = i//1000 i = i-b*1000 c = i//100 i = i-c*100 d = i//10 i = i-d*10 e = i s = a+b+c+d+e if A<=s<=B: f += k print(f)
p03351
s360463882
Wrong Answer
[a,b,c,d] = list(map(int,input().split())) if abs(a-b)<=d: if abs(b-c)<=d: print('Yes') else: print('No') else: print('No')
p03377
s380082835
Accepted
a,b,x=map(int,input().split()) if x>=a and a+b>=x: print('YES') else: print('NO')
p02833
s601091816
Accepted
n=int(input()) if n<=4: print(0) exit() if n%2==1: print(0) exit() cnt=10 ans=0 for i in range(100): ans+=n//cnt cnt*=5 print(ans)
p02916
s071819603
Wrong Answer
import sys n = int(sys.stdin.readline()) lia = list(map(int, sys.stdin.readline().split())) lib = list(map(int, sys.stdin.readline().split())) lic = list(map(int, sys.stdin.readline().split())) s = sum(lib) li = [] i = 0 while i < n-1: if lia[i+1] - lia[i] == 1: li.append(i) i += 1 for i in li: s += lic[i-1] print(s)
p03623
s380789180
Accepted
x,a,b = map(int, input().split()) if abs(x-a) <= abs(x-b): print("A") else: print("B")
p02831
s555346818
Accepted
a, b = map(int, input().split()) def gcd(a, b): if a < b: a, b = b, a while a % b != 0: a, b = b, a % b return b print(a*b//gcd(a, b))
p03838
s511884126
Accepted
x, y = map(int, input().split()) ans = 0 if abs(x) == abs(y): ans = 1 elif abs(x) < abs(y): ans = abs(y) - abs(x) if y < 0: ans += 1 if x < 0: ans += 1 else: if y == 0: ans = abs(x) + abs(y) else: ans = abs(x) - abs(y) if x > 0: ans += 1 if y > 0: ans += 1 print(ans)
p02753
s541782101
Accepted
n = list(input()) if n[0]=="A": if n[1]=="B": print("Yes") else: if n[2]=="B": print("Yes") else: print("No") else: if n[1]=="A": print("Yes") else: if n[2]=="A": print("Yes") else: print("No")
p02553
s497760789
Accepted
a,b,c,d=[int(x) for x in input().split()] ans=max(a*c,b*d) if a<0 and b<0: cc=a a=b b=cc if c<0 and d<0: cc=c c=d d=cc print(max(a*c,b*d,ans))
p02973
s356935060
Wrong Answer
N = int(input()) ans = 0 m = float("inf") for i in range(N): x = int(input()) if m >= x: m = x ans += 1 print(ans)
p03380
s047724797
Accepted
import bisect N = 5 ARR = [6, 9, 4, 2, 11] N = 2 ARR = [100, 0] N = int(input()) ARR = list(map(int, input().split())) def calculate(n, arr): arr = sorted(arr) mid = arr[n - 1] / 2 a1 = bisect.bisect_left(arr, mid) s1 = abs(arr[a1 - 1] - (arr[n - 1] / 2)) s2 = abs(arr[a1] - (arr[n - 1] / 2)) if s1 > s2: return arr[n - 1],arr[a1] else: return arr[n-1],arr[a1-1] n, a = calculate(N, ARR) print(n, a)
p03385
s352445924
Accepted
S = input() if set(S) == {'a', 'b', 'c'}: print('Yes') else: print('No')
p02554
s977712082
Accepted
N = int(input()) a = 10**N - 9**N -9**N + 8**N print(a%(10**9+7))
p02829
s624555174
Wrong Answer
A=int(input()) B=int(input()) AB=[A,B] C=[1,2,3] C.remove(A) C.remove(B) print(C)
p03407
s722069100
Accepted
a,b,c=map(int,input().split()) print("Yes" if (a+b)>=c else "No")
p02775
s472035691
Wrong Answer
N = int(input()) n = N ans = 0 for i in range(N): d = n % 10 n //= 10 ans += min(d, 1 + 10 - d) if n == 0: break print(ans)
p02823
s400524119
Wrong Answer
n,a,b = map(int,input().split()) p = b-a-1 if p%2==0: print(b-1) else: print((p+1)//2)
p02612
s061858307
Accepted
N = int(input()) print((1000-(N%1000))%1000)
p03386
s739625089
Wrong Answer
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) INF = float('inf') A, B, K = map(int, input().split()) l = [] for i in range(A, min(A+K, B+1)): l.append(i) for i in range(max(B-K, A+1), B+1): l.append(i) l = list(set(l)) l.sort() print(*l, sep="\n")
p02548
s161809782
Accepted
N = int(input()) cnt = 0 for a in range(1, N): # print(f'{a=}, {N // a}') if N % a == 0: cnt += N // a - 1 else: cnt += N // a print(cnt)
p03352
s255947160
Accepted
x=int(input()) s={1,} for b in range(2,x): for p in range(2,100000): tmp=b**p if tmp>x: break s.add(tmp) print(max(s))
p03071
s698911222
Wrong Answer
a,b = map(int,input().split()) if a == b: print(2*a-1) else: print(max(a,b)*2-1)
p02732
s952413927
Wrong Answer
n = int(input()) a = input().split(" ") ab = a for k in range(n): count = 0 if not k == 0: a.insert(k-1, a[k-1]) ab.pop(k) for i in range(n-1): for j in range(i): if a[i] == a[j] and not i == j: count = count + 1 print(count)
p03998
s025458250
Accepted
s=[] sa=input() sb=input() sc=input() s.append(sa) s.append(sb) s.append(sc) now=0 while 1: if len(s[now])==0: break if s[now][0]=="a": next=0 elif s[now][0]=="b": next=1 else: next=2 s[now]=s[now][1:] now=next if now==0: print("A") elif now==1: print("B") else: print("C")
p03555
s555296586
Wrong Answer
a = input() b = input() if a == b [::-1]: print('YES') else: print('No')
p03524
s659757831
Accepted
S = list(input()) ls = len(S) na = S.count("a") nb = S.count("b") nc = ls - na - nb mi = min(na, nb, nc) ma = max(na, nb, nc) if ma - mi <= 1: print("YES") else: print("NO")
p02621
s617171054
Accepted
a=input() print(int(a)+int(a)*int(a)+int(a)*int(a)*int(a))
p02747
s013421355
Wrong Answer
def solve(): s=list(input()) if(len(s)<2): print("No") return for i in range(len(s)): if (i%2==0 and s[i]!='h'): print("No") return elif(i%2==1 and s[i]!='i'): print("No") return print("Yes") solve()
p02972
s197879169
Wrong Answer
n = input() a = input().split() print(n, a)
p03773
s758039173
Accepted
A,B = map(int,input().split()) if A + B < 24: print(A + B) if A + B >= 24: print(A + B - 24)
p03073
s819494398
Accepted
import numpy as np s = input() n = len(s) ans = 0 for i in range(n // 2 + 1): if 2 * i == n: break if s[2 * i] == "0": ans += 1 if 2 * i + 1 == n: break if s[2 * i + 1] == "1": ans += 1 print(min(ans, n - ans))
p03721
s044759213
Wrong Answer
n,k=map(int,input().split()) a=[[int(i) for i in input().split()] for i in range(n)] b=[] x=0 if n==1: print(a[0][0]) exit() for i in a: x+=i[1] b.append([i[0],x]) for i in range(len(b)-1): if b[i][1]<k<=b[i+1][1]: print(b[i+1][0]) elif i==0 and k<=b[i][1]: print(b[i][0]) elif k>b[-2][1]: print(b[-1][0])
p02663
s382831975
Wrong Answer
import bisect import copy import heapq import sys import itertools import math import queue input = sys.stdin.readline sys.setrecursionlimit(1000000) mod = 10 ** 9 + 7 def read_values(): return map(int, input().split()) def read_index(): return map(lambda x: int(x) - 1, input().split()) def read_list(): return list(read_values()) def read_lists(N): return [read_list() for n in range(N)] def main(): H1, M1, H2, M2, K = read_values() m1 = H1 * 60 + M1 m2 = H2 * 60 + M2 - 1 m = m2 - m1 print((m // K) * K) if __name__ == "__main__": main()
p04044
s869349650
Accepted
N,L=map(int,input().split()) S=[input() for i in range(N)] S.sort() s="" for i in S: s=s+i print(s)
p02779
s649223075
Wrong Answer
import collections N = int(input()) A = list(map(int, input().split())) c = collections.Counter(A) if c.most_common()[0][1] > 2: print('YES') else: print('NO')
p02918
s961660549
Accepted
n, k = map(int, input().split()) s = list(input()) cnt = 0 tmp = s[0] t = 0 for i in range(1, n): if tmp == s[i]: continue else: cnt += 1 tmp = s[i] c = 0 for i in range(1, n): if s[i] == s[i-1]: c += 1 if cnt <= 2*k: print(n-1) else: print(c + 2*k)
p02552
s518332356
Accepted
a = int(input()) if a == 0: print(1) else: print(0)
p02778
s701040983
Wrong Answer
s = input() l = [] for i in s: i = 'x' i += i*(len(s)) print(i)
p02983
s646937953
Wrong Answer
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): L, R = map(int, readline().split()) if R - L + 1 >= 2019: print(0) else: A = [i % 2019 for i in range(L, R + 1)] A.sort() print(A[0] * A[1]) return if __name__ == '__main__': main()
p03331
s012058790
Accepted
n = int(input()) a = 0 b = n total = [] def digitSum(number): sum = 0 while number > 0: sum += number % 10 number //= 10 return sum for i in range(1, n + 1): a = i b = n - a if b < a: break total.append(digitSum(a) + digitSum(b)) print(min(total))
p04031
s191666775
Accepted
_ = int(input()) A = list(map(int, input().split())) mi, ma = min(A), max(A) cost = 10**10 for x in range(mi, ma+1): cost = min(cost, sum((x-a)**2 for a in A)) print(cost)
p02819
s327309222
Accepted
def is_prime(x): if x <= 1: return False i = 2 while i*i <= x: if x%i==0: return False i += 1 return True x = int(input()) while not(is_prime(x)): x += 1 print(x)
p02970
s235387122
Accepted
n, d = map(int, input().split()) print(1 + (n - 1) // (d + d + 1))
p03862
s104907307
Accepted
from sys import stdin import sys import math from functools import reduce import functools import itertools from collections import deque,Counter,defaultdict from operator import mul import copy # ! /usr/bin/env python # -*- coding: utf-8 -*- import heapq sys.setrecursionlimit(10**6) # INF = float("inf") INF = 10**18 import bisect import statistics mod = 10**9+7 # mod = 998244353 N, x = map(int, input().split()) a = [0] + list(map(int, input().split())) ans = 0 for i in range(1,N+1): y = a[i-1] + a[i] if y > x: ans += y-x a[i] -= y-x print(ans)
p02760
s637839301
Wrong Answer
#input a, b, c = map(int, input().split()) d, e, f = map(int, input().split()) h, i, j = map(int, input().split()) N = int(input()) b = [0] * N for i in range(N): b[i] = int(input()) #output if a and b and c in b: print("Yes") elif d and e and f in b: print("Yes") elif h and i and j in b: print("Yes") elif a and d and h in b: print("Yes") elif b and e and i in b: print("Yes") elif c and f and j in b: print("Yes") elif a and e and j in b: print("Yes") elif c and e and h in b: print("Yes") else: print("No")
p03380
s975560294
Accepted
n = int(input()) a = list(map(int, input().split())) ai = max(a) a.sort(key=lambda x: abs(ai//2 - x)) aj = a[0] for i in a: if ai==i: continue else: aj = i break print('{} {}'.format(ai, aj))
p03377
s547084633
Accepted
a,b,x=map(int,input().split()) if x-a<=b and x-a>=0: print('YES') else: print('NO')
p02598
s512386492
Wrong Answer
import math N, K = map(int, input().split()) A = list(map(float, input().split())) if K == 0: print(int(max(A))) exit() if N == 1: print(math.ceil(A[0]/K)) exit() min_A = 0 max_A = max(A) while( max_A - min_A > 1): now = (min_A + max_A) / 2 temp = 0 for i in A: temp += int(i / now) if temp > K: min_A = now else: max_A = now print(int(min_A) + 1)
p03103
s686089197
Wrong Answer
n, m = map(int, input().split()) ab = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x:x[0]) ans = 0 for i in range(n): print(ab[i][1], m) if ab[i][1] < m: ans += ab[i][0] * ab[i][1] m -= ab[i][1] else: ans += ab[i][0] * m break print(ans)
p02677
s727869343
Accepted
import sys input = lambda: sys.stdin.readline().rstrip() import math A, B, H, M = map(int, input().split()) cos = math.cos(math.radians(6 * M - 0.5 * (H * 60 + M))) ans = A ** 2 + B ** 2 - 2 * A * B * (cos) print(ans ** 0.5)
p02701
s219986359
Accepted
N = int(input()) A = {input() for _ in range(N)} print(len(A))
p03495
s351010706
Wrong Answer
N, K = [int(x) for x in input().split(" ")] setlst = {int(x) for x in input().split(" ")} swap = 0 if len(setlst)-K > 0: swap = len(setlst)-K else: swap = 0 print(swap)
p03264
s011371791
Accepted
print(int(input())**2//4)
p03612
s673737423
Accepted
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: ans+=1 a[i],a[i+1]=i+1,i if a[i]==i: ans+=1 if a[-1]==n-1: ans+=1 print(ans)
p03799
s776776070
Accepted
n, m = map(int, input().split()) if m == 1: ans = 0 elif m > n: ans = (m - n*2) // 4 +n elif n >= m: ans = m//2 print(ans)
p02744
s957258842
Wrong Answer
N = int(input()) lis = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] def dfs(ans, keep_num, n): if n == N - 1: for i in range(keep_num + 2): print(ans + lis[i]) else: for i in range(n + 1): dfs(ans + lis[i], max(i, keep_num), n + 1) dfs('', 0, 0)
p02918
s961770106
Accepted
n,k = map(int,input().split()) s = list(input()) memory = 0 count = 0 for i in range(n): if s[i] == memory: count += 1 memory = s[i] print(min(count+k*2,n-1))
p03486
s079140997
Accepted
s=str(input()) t=str(input()) ss=sorted(s) tt=sorted(t, reverse=True) if ss < tt: print('Yes') else: print('No')
p03250
s268728857
Accepted
l = list(map(int, input().split())) l.sort() print(l[2] * 10 + l[1] + l[0])
p03469
s225231445
Accepted
def main(): print("2018" + input()[4:]) if __name__ == '__main__': main()
p02786
s341901772
Accepted
h = int(input()) c = 0 nb = 1 while h > 0: h, nb, c = h//2, nb*2, c+nb print(c)
p02661
s038064914
Accepted
N = int(input()) A = [list(map(int, input().split())) for _ in range(N)] AX = [A[i][0] for i in range(N)] BX = [A[i][1] for i in range(N)] AX.sort() BX.sort() if N % 2 == 1: L = AX[(N-1)//2] R = BX[(N-1)//2] print(R-L+1) else: L = AX[N//2-1] + AX[N//2] R = BX[N//2-1] + BX[N//2] print(R-L+1)
p03623
s913030176
Accepted
x, a, b = map(int, input().split()) if min(abs(x - a), abs(x - b)) == abs(x-a): print("A") else: print("B")
p03494
s492569774
Wrong Answer
n=int(input()) def f(x): x=int(x) cnt=0 while x%2==0: cnt+=1 x=x//2 return cnt a=list(map(f,input().split())) print(max(a))
p02957
s800954131
Accepted
a,b=map(int,input().split()) if abs(a-b)%2==0: print((a+b)//2) else: print('IMPOSSIBLE')
p02838
s262175221
Wrong Answer
n,*a=map(int,open(0).read().split());c=0;i=1 for _ in[0]*61:i**=2;t=sum(i&b and 1for b in a);c+=t*(n-t)*i;c%=10**9+7 print(c)
p02684
s165520765
Accepted
n, k = map(int, input().split()) A = list(map(lambda x: int(x)-1, input().split())) bit = k.bit_length() table = [[0]*n for _ in range(bit)] table[0] = A for i in range(1, bit): for j in range(n): table[i][j] = table[i-1][table[i-1][j]] ans = 0 for i in reversed(range(bit)): if (1 << i) <= k: k -= 1 << i ans = table[i][ans] print(ans+1)