problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02717
s268055717
Accepted
x,y,z = list(map(int,input().split())) print(z,x,y)
p03309
s911119616
Accepted
import statistics N = int(input()) A=list(map(int, input().split())) B=[] for number, i in enumerate(A, 1): B.append(i-number) median = int(statistics.median(B)) ans2 = 0 for i in B: ans2 += abs(i-median) print(ans2)
p03543
s023418102
Accepted
a,b,c,d=input() print('Yes' if a==b==c or b==c==d else 'No')
p02555
s578446818
Accepted
MOD = 10**9 + 7 S = int(input()) dpt = [[0 for i in range(S+1)] for i in range(S//3+1)] for i in range(3, S+1): dpt[1][i] = 1 for i in range(2, S//3+1): s = 0 for j in range(3*i, S+1): s += dpt[i-1][j-3] dpt[i][j] = s % MOD print(sum([dpt[i][S] for i in range(S//3+1)])%MOD)
p02958
s369112966
Wrong Answer
n = int(input()) s = [] for i in range(n): s.append(i) for i in range(n): t = 0 if(s[i] != i + 1): t += 1 if(t <= 2): print('Yes') else: print('No')
p02742
s596148194
Accepted
import math h,w=map(int,input().split()) if h==1 or w==1:print(1) elif h%2==0:print(w*(h//2)) else:print(w*(h//2)+math.ceil(w/2))
p02958
s650010277
Accepted
n = int(input()) p = [int(_) for _ in input().split()] dif = sum(idx != pp for idx, pp in enumerate(p, 1)) # 1からidx if dif <= 2: print("YES") else: print("NO")
p02553
s498472033
Accepted
a, b, c, d =map(int, input().split()) print(max(a*c,a*d,b*c,b*d))
p03137
s210316603
Accepted
N,M=map(int,input().split()) X=list(map(int,input().split())) if N>=M: print(0) exit() X = sorted(X) diff=[] for i in range(1,M): diff.append(X[i]-X[i-1]) diff = sorted(diff) print(sum(diff[:M-N]))
p03000
s907412976
Wrong Answer
n,k=map(int,input().split()) s=0 l=list(map(int,input().split())) c=0 for i in range(n): s+=l[i] if(k<s): break c+=1 print(c)
p03417
s819711537
Accepted
N, M = sorted(map(int, input().split())) print(abs((N - 2) * (M - 2)))
p02641
s009758849
Accepted
x, n = map(int,input().split()) P = list(map(int,input().split())) Q = [] ans = 100 for i in range(-100,101): if i+1 in P:continue else: Q.append(i+1) for j in Q: d = abs(j - x) ans = min(d, ans) l = x -ans m = x + ans if l in Q: print(l) else: print(m)
p03779
s745155300
Wrong Answer
x = int(input()) if x == 1: print(1) else: cur = 0 for i in range(0, 44720): cur += i if x > cur and x <= cur + i + 1: print(i+1) break
p02859
s437041923
Accepted
r = int(input()) print(r*r)
p03252
s419492649
Accepted
from collections import Counter s = list(input()) t = list(input()) sc = Counter(s) tc = Counter(t) sc_l = sorted(sc.values()) tc_l = sorted(tc.values()) if sc_l == tc_l: print("Yes") else: print("No")
p02854
s294888734
Accepted
N = int(input()) A = list(map(int,input().split())) LEFT = A[0] RIGHT = sum(A[1:]) MIN = abs(LEFT-RIGHT) for i in range(1,N-1): LEFT += A[i] RIGHT -= A[i] MIN = min(MIN,abs(LEFT-RIGHT)) print(MIN)
p02553
s546506275
Wrong Answer
a,b,c,d=map(int,input().split()) if a>=b: x=a elif a<b: x=b if c>=d: y=c elif d>c: y=d print(x*y)
p02711
s634063434
Wrong Answer
N = int(input()) total = 0 for i in range(1, N + 1): if i % 3 != 0 and i % 5 != 0: total += i print(total)
p02935
s441490083
Accepted
n = int(input()) V = list(map(int, input().strip().split())) V.sort() out = V[0] for i in range(n - 1): j = i + 1 out = (out + V[j]) / 2 print(out)
p03821
s131857963
Accepted
# 20200610_yorukatsu_b.py N = int(input()) A = [] B = [] for i in range(N): a,b = map(int,input().split()) A.append(a) B.append(b) push = 0 for i in range(N): if (A[N-i-1] + push) % B[N-i-1] != 0: push += abs(B[N-i-1] - ((push + A[N-i-1]) % B[N-i-1])) print(push)
p03206
s174743324
Accepted
N = int(input()) print("Christmas" + " Eve" *(25-N))
p03317
s653357255
Accepted
n,k = map(int,input().split()) A = input() ans = 1 + -(-(n-k)//(k-1)) print(ans)
p03328
s396250573
Accepted
a,b=map(int,input().split());print((b-a)*(b-a+1)//2-b)
p02556
s318264640
Accepted
def resolve(): n = int(input()) d1 = {} d2 = {} for i in range(n): x, y = map(int, input().split()) if x+y not in d1: d1[x+y] = 1 if x-y not in d2: d2[x-y] = 1 d1key = d1.keys() d1key = sorted(d1key) d2key = d2.keys() d2key = sorted(d2key) print(max(abs(d1key[0]-d1key[-1]), abs(d2key[0]-d2key[-1]))) resolve()
p03137
s200937333
Accepted
import sys readline = sys.stdin.readline def main(): N, M = map(int, readline().rstrip().split()) X = list(map(int, readline().rstrip().split())) if N >= M: print(0) return X.sort() X = [abs(X[i+1]-X[i]) for i in range(M-1)] X.sort() ans = sum(X) for i in range(N-1): ans -= X[-i-1] print(ans) if __name__ == '__main__': main()
p03319
s228151845
Accepted
import math N, K = map(int, input().split()) L = list(map(int, input().split())) Nagasa = len(L) print(math.ceil((Nagasa-1)/(K-1)))
p02819
s705474043
Accepted
x = int(input()) y = x + 100 is_prime = [False] * 2 + [True for _ in range(2, y+1)] prime = [] for i in range(2, y+1): for j in range(i*2, y+1, i): is_prime[j] = False for i in range(y+1): if is_prime[i]: prime.append(i) for i in range(len(prime)): if prime[i] >= x: print(prime[i]) break else: continue
p03632
s696993885
Accepted
A, B, C, D = map(int, input().split()) print(max(min(B, D) - max(A, C), 0))
p02882
s777691214
Accepted
import math a,b,x=map(int,input().split()) tan=0 if 2*x>=b*(a**2): tan=(2*(a**2)*b-2*x)/(a**3) else: tan=a*(b**2)/(2*x) print(math.degrees(math.atan(tan)))
p02861
s721746234
Accepted
from itertools import permutations from math import factorial as fact N = int(input()) towns = [list(map(int, input().split())) for _ in range(N)] acc = 0 for p in permutations(range(N), N): for i in range(N - 1): t1, t2 = towns[p[i]], towns[p[i + 1]] acc += ((t1[0] - t2[0]) ** 2 + (t1[1] - t2[1]) ** 2) ** .5 print(acc / fact(N))
p02706
s170825818
Wrong Answer
N, M = map(int, input().split()) A = list(map(int, input().split())) print(N-(sum(A)))
p04043
s930226236
Accepted
inp = (input().split()) if inp.count('5') == 2 and inp.count('7') == 1: print("YES") else: print("NO")
p03000
s311635818
Accepted
N, X = map(int, input().split()) L = [int(l) for l in input().split()] if sum(L) <= X: print(N+1) exit() D = 0 ans = 1 for i in range(N): D += L[i] if D <= X: ans += 1 else: print(ans) exit()
p02598
s353969212
Accepted
n,k=map(int,input().split()) A=[int(x) for x in input().split()] s,l=0,max(A) while l-s>1: m=(s+l)//2 if sum([(a-1)//m for a in A]) >k: s=m else: l=m print(l)
p04029
s325322702
Wrong Answer
from math import factorial as f print(f(int(input())))
p02748
s655448325
Accepted
# -*- coding: utf-8 -*- A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) min = sorted(a)[0]+sorted(b)[0] for i in range(M): x, y, c = map(int, input().split()) d = a[x-1]+b[y-1]-c if min > d: min = d print(min)
p03281
s493578728
Wrong Answer
N = int(input()) if N<105: print(0) elif N<135: print(1) elif N<189: print(2) elif N<195: print(3) else: print(4)
p02640
s620280278
Accepted
x, y = map(int,input().split()) f = False for i in range(x+1): if 2*i + 4*(x-i) == y: f = True break if f: print('Yes') else: print('No')
p03219
s280653249
Accepted
x, y = map(int, input().split()) print(x + y//2)
p02697
s398551296
Accepted
#!/usr/bin/env python3 import sys def main(): N, M = map(int, input().split()) if M % 2 == 1: for i in range(M//2): print(i+1,M-i) for j in range(M//2 + 1): print(M+1+j,2*M+1-j) else: for i in range(M//2): print(i+1, M+1-i) for j in range(M//2): print(M+2+j,2*M+1-j) if __name__ == '__main__': main()
p02657
s723743942
Accepted
a,b = map(int,input().split()) print(a * b)
p03469
s527780384
Wrong Answer
S = input() ans = S[:4] + '8' + S[5:] print(ans)
p02724
s310384379
Accepted
x = int(input()) n1 = 0 while True: x = x - 500 if x < 0: x += 500 break else: n1 += 1 n2 = 0 while True: x = x - 5 if x < 0: x += 5 break else: n2 += 1 print(n1*1000 + n2*5)
p02663
s482457844
Accepted
H1, H2, H3, H4, K = map(int, input().split()) up = H1*60 + H2 down = H3*60 + H4 print(down - up - K)
p02793
s523262156
Accepted
def main(): import fractions n = int(input()) array = list(map(int, input().split())) lcm = array[0] for i in range(1, n): lcm = lcm * array[i] // fractions.gcd(lcm, array[i]) total = 0 for i,num in enumerate(array): total += lcm // num print(int(total%(10**9+7))) if __name__ == '__main__': main()
p02689
s412213897
Wrong Answer
N,M = map(int, input().split()) goodObservatory = [1]*N goodObservatoryCount = 0 H = input().split() for i in range(M): A,B = map(int, input().split()) if H[A-1] > H[B-1]: goodObservatory[B-1] = 0 elif H[A-1] < H[B-1]: goodObservatory[A-1] = 0 for i in range(N): if goodObservatory[i] == 1: goodObservatoryCount += 1 print(goodObservatoryCount)
p03696
s238227982
Accepted
n = int(input()) s = input() l = 0 r = 0 count = 0 need = 0 for i in range(n): if s[i] == "(": l += 1 count += 1 else: r += 1 if count > 0: count -= 1 else: need += 1 print("(" * need + s + ")" * (l + need - r))
p03013
s090050768
Wrong Answer
N,M = map(int,input().split()) a = [int(input()) for _ in range(M)] d = [0] * (N+1) d[0] = 1 d[1] = 1 for i in range(2,N+1): if(i in a): d[i] = 0 else: d[i] = d[i-1] + d[i-2] print(d[-1])
p02647
s234008159
Accepted
n, k = map(int, input().split()) aa = list(map(int, input().split())) from itertools import accumulate aa for _ in range(k): d = [0] * n for i, a in enumerate(aa): d[max(i-a, 0)] += 1 end = i+1+a if end < n: d[end] -= 1 d = list(accumulate(d)) if aa == d: break aa = d print(' '.join(str(a) for a in aa))
p03659
s050301873
Wrong Answer
N = int(input()) A = [int(x) for x in input().split()] ans = [] for k in range(N): S = sum(A[:k]) T = sum(A[k:]) ans.append(abs(S-T)) print(min(ans))
p02775
s610043314
Accepted
n=[int(x) for x in list(input()[::-1])]+[0] ans = 0 step = 0 for i in range(len(n)-1): x = n[i]+step if x < 5 or (x==5 and n[i+1]<5): ans += x step = 0 else: ans += 10 - x step = 1 print(ans+step)
p02953
s938001519
Accepted
N = int(input()) H = list(map(int, input().split())) H.reverse() def main(): for i in range(N-1): if (H[i+1] - H[i] >= 2): print("No") return if (H[i+1] - H[i] == 1): H[i+1] -= 1 print("Yes") main()
p02678
s756601464
Wrong Answer
from collections import deque n, m = map(int, input().split()) graph = [[] for _ in range(n+1)] for i in range(m): a, b = map(int, input().split()) graph[a].append(b) graph[b].append(a) dist = [-1] * (n+1) dist[0] = 0 dist[1] = 0 d = deque() d.append(1) while d: v = d.popleft() for i in graph[v]: if dist[i] != -1: continue dist[i] = dist[v] + 1 d.append(i) ans = dist[1:] print(*ans, sep="\n")
p03556
s703281468
Accepted
import math n = int(input()) while True: x = math.sqrt(n) #####print(n) if x.is_integer(): print(n) exit() n -= 1
p02897
s918630776
Accepted
n = int(input()) print(((n//2)+(n%2))/n)
p03438
s270673889
Wrong Answer
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) numa = 0 numb = 0 num = sum(b)-sum(a) for i in range(n): x = b[i] - a[i] if x > 0: numa += -(-x//2) if x % 2 == 1: numb += 1 else: numb -= x if (num-numa)*2 == num-numb and num > numa: print("Yes") else: print("No")
p03137
s827545798
Wrong Answer
n,m = map(int,input().split()) n = min(n,m) x = sorted(map(int,input().split())) dx = [0] * (m-1) for i in range(m-1): dx[i] = x[i+1] - x[i] dx = sorted(dx) print(sum(dx[:-(n-1)]))
p03062
s577989089
Wrong Answer
n = int(input()) a = list(map(int, input().split())) print(sum(list(map(lambda x:abs(x), a))))
p04029
s894403704
Accepted
# coding: utf-8 input_ = input() N = int(input_) sum_ = 0 for i in range(N): sum_ += i + 1 print(sum_)
p03633
s175143292
Accepted
from sys import stdin from fractions import gcd def lcm(a,b): return a*b//gcd(a,b) def main(): #入力 readline=stdin.readline n=int(readline()) t=[int(readline()) for _ in range(n)] ans=1 for i in range(n): ans=lcm(ans,t[i]) print(ans) if __name__=="__main__": main()
p03254
s108461036
Accepted
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) n, x = map(int, input().split()) a = sorted(list(map(int, input().split()))) ans = 0 for i, v in enumerate(a): x -= v if i == n - 1: if x == 0: ans += 1 break else: if x >= 0: ans += 1 continue else: break print(ans)
p03274
s121597631
Wrong Answer
N,K = map(int,input().split()) x = list(map(int,input().split())) ans=10**15 for i in range(K): if i + K > N: break else: a = min(abs(x[K+i-1]),abs(x[i])) ans = min(ans,x[K+i-1]-x[i]+a) print(ans)
p02724
s548696498
Accepted
X=int(input()) n500,r500=divmod(X,500) n50=r500//5 print(n500*1000+n50*5)
p02695
s350406941
Wrong Answer
import itertools n,m,q=map(int,input().split()) abcd=[None]*q for i in range(q): abcd[i]=list(map(int,input().split())) num=0 for l in list(map(list, itertools.combinations(list(range(1,m+1))*m, n))): num_ = 0 for x in abcd: if l[x[1]-1]-l[x[0]-1] == x[2]: num_ += x[3] num = max(num ,num_) print(num)
p03001
s524896294
Accepted
W, H, x, y = (int(whxy) for whxy in input().split()) print(float(W)*float(H)/2, 1 if 2*x==W and 2*y==H else 0)
p03211
s718237566
Wrong Answer
s=input() n=len(s) ans=100000 for i in range(n-3): t=str(s[i])+str(s[i+1])+str(s[i+2]) x=abs(753-int(t)) ans=min(ans,x) print(ans)
p02742
s659901894
Accepted
h,w=map(int,input('').split(' ')) masu=0 masu=masu+(w*(h//2)) if h%2==1: if w%2==1: masu=masu+(w//2)+1 else: masu=masu+(w//2) if h==1 or w==1: masu=1 print(masu)
p03795
s964747939
Accepted
n=int(input()) print(800*n-200*(n//15))
p02836
s579599784
Wrong Answer
palindrome = list(input()) half = len(palindrome) // 2 lst = set() for i in range(half): if palindrome[i] != palindrome[len(palindrome) - i - 1]: lst.add(palindrome[i]) print(len(lst))
p03548
s444753910
Wrong Answer
X,Y,Z = map(int,input().split()) X = X-Z i = 0 while X >= 0: if X > Y: X = X-Y i += 1 X = X-Z print(i)
p03309
s577233856
Accepted
def main(): N = int(input()) A = list(map(int, input().split())) B = sorted([A[i] - (i+1) for i in range(N)]) b = B[N//2] print(sum([abs(val - b) for val in B])) if __name__ == "__main__": main()
p02819
s813598147
Accepted
import math x = int(input()) if x == 2: print(2) exit() elif x%2 == 0: ans = x+1 else: ans = x #2以外の素数は奇数であることに注意 while True: for i in range(3, int(math.sqrt(ans))+1, 2): if ans%i == 0: ans += 2 break else: print(ans) exit()
p02773
s232945668
Accepted
n = int(input()) S = dict() for i in range(n): word = input() if word not in S: S[word] = 1 else: S[word] += 1 S = sorted(S.items(), key=lambda x:x[1], reverse=True) max_v = S[0][1] ans = [] for k,v in S: if v == max_v: ans.append(k) else: break ans = sorted(ans) for i in ans: print(i)
p02988
s126180050
Accepted
n = int(input()) p = list(map(int,input().split())) count = 0 for i in range(1,n-1): test_list=sorted([p[i-1],p[i],p[i+1]]) if(test_list[1]==p[i]): count += 1 print(count)
p02866
s493809325
Accepted
import math import sys n=int(input()) d=list(map(int,input().split())) if d[0]!=0 or 0 in d[1:]: print(0) sys.exit() lis=[0 for i in range(n)] for i in range(n): lis[d[i]]+=1 for i in range(1,n-1): if lis[i]==0 and lis[i+1]!=0: print(0) sys.exit() s=1 i=0 while i+1<=n-1 and lis[i+1]!=0: s=(s*pow(lis[i],lis[i+1],998244353))%998244353 i+=1 print(s)
p03001
s827641321
Accepted
W, H, x, y = map(int, input().split()) area = W*H / 2 pl = x == W / 2 and y == H / 2 print(area, int(pl))
p02708
s623175642
Accepted
n,k = map(int,input().split()) li = [i for i in range(0,n+1)] #print(li) #[0,1, 2, 3] tmp = 0 def exc(n): return (n)*(n+1)//2 for i in range(k,n+2): #print(i,li[n-i+1:],li[:i],sum(li[n-i+1:]) - sum(li[:i])) #tmp += sum(li[n-i+1:]) - sum(li[:i]) + 1 mi = exc(i-1) ma = exc(n) - exc(n-i) #print(i,mi,ma,ma - mi + 1) tmp += ma - mi + 1 print(tmp%(10**9+7))
p02601
s525424615
Accepted
import sys readline = sys.stdin.readline def solve(): A, B, C = map(int, readline().split()) K = int(readline()) count = 0 while B <= A: B *= 2 count += 1 while C <= B: C *= 2 count += 1 if count > K: print('No') else: print('Yes') solve()
p03160
s224385334
Accepted
def cal_cost(co, h, i, j): return co + abs(h[i]-h[j]) n = int(input()) h = [int(i) for i in input().split(" ")] lis = [0 for i in range(n)] lis[1] = cal_cost(lis[0], h, 0, 1) for i in range(2, n): temp1 = cal_cost(lis[i-2], h, i-2, i) temp2 = cal_cost(lis[i-1], h, i-1, i) lis[i] = min(temp1, temp2) print(lis[-1])
p03160
s752335878
Accepted
n = int(input()) h = [int(x) for x in input().split()] dp = [0] * n dp[0] = 0 dp[1] = abs(h[1]-h[0]) for i in range(2, n): dp[i] = min( dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]) ) print(dp[n-1])
p02888
s052989509
Accepted
from bisect import bisect_left N = int(input()) *L, = map(int, input().split()) L.sort() ans = 0 for i in range(N): for j in range(i+1, N): a, b = L[i], L[j] ans += (bisect_left(L, a+b)-(j+1)) print(ans)
p03145
s329424267
Accepted
a,b,c=map(int,input().split()) print(a*b//2)
p03379
s584508989
Accepted
from copy import deepcopy n = int(input().strip()) x = list(map(int, input().split())) y = deepcopy(x) y.sort() m1 = y[n // 2 - 1] m2 = y[(n // 2)] for e in x: if e <= m1: print(m2) else: print(m1)
p03821
s373923856
Wrong Answer
def main(): import math n, *ab = map(int, open(0).read().split()) a = ab[::2] b = ab[1::2] ans = 0 for x, y in zip(a[::-1], b[::-1]): if x%y != 0: ans += y - (x + ans) % y print(ans) if __name__ == '__main__': main()
p02598
s994968008
Accepted
N, K=map(int, input().split()) A=list(map(int, input().split())) x=0 y=max(A) def f(l): nums=0 for a in A: if a%l==0: nums+=a//l-1 else: nums+=a//l if nums>K: return False else: return True while y-x>1: tmp=(x+y)//2 if f(tmp)==True: y=tmp else: x=tmp print(y)
p03377
s251098389
Accepted
a, b, x = map(int, input().split()) if x >= a and x <= a + b: print('YES') else: print('NO')
p03448
s992493803
Accepted
A = int(input()) B = int(input()) C = int(input()) X = int(input()) #A,B,C,X = 2,2,2,100 ans = 0 for a in range(0,A+1): for b in range(0,B+1): for c in range(0,C+1): if a * 500 + b * 100 + c * 50 == X: ans = ans + 1 print(ans)
p02729
s028238671
Accepted
a,b=map(int,input().split()) if a==1 and b==1: print(0) else: print(a*(a-1)//2+b*(b-1)//2)
p02594
s948404307
Accepted
x = int(input()) if x >= 30: print('Yes') else: print('No')
p03427
s274303776
Wrong Answer
N = input() Dig = len(N) if Dig == 1: print(N) else: for i in range(Dig): if N[i] != 9: num = i break else: continue list_num = list(N) target = int(list_num[num]) -1 ans = 9*(num -1) + target + 9*(Dig) print(ans)
p03481
s086042809
Accepted
x, y = map(int, input().split()) i = 1 c = y - x + 1 while True: if c <= y: c = 2**i * x i += 1 else: print(i - 1) break
p04030
s801270890
Accepted
s = input() ans = [] for i in range(len(s)): if s[i] == "0" or s[i] == "1": ans.append(s[i]) elif s[i] == "B" and ans != []: del ans[len(ans) - 1] print("".join(ans))
p03487
s821729538
Accepted
import collections N = int(input()) a = list(map(int,input().split())) B = collections.Counter(a) ans = 0 for i in set(a): if B[i] < i: ans += B[i] else: ans += B[i]-i print(ans)
p04044
s274435074
Wrong Answer
n, l = map(int, input().split()) ans = [] for i in range(n): #index = 0 s = str(input()) for i in range(n): #print(ans, len(ans)) if i > len(ans): ans.append(s) break elif str(ans[i*l:(i+1)*l]) < s: ans.insert(i-1,s) break #print(ans) print("".join(ans))
p03086
s499105220
Accepted
s = str(input()) cnt = 0 cnt_list = [] for i in range(len(s)): if s[i] in 'ACGT': cnt += 1 cnt_list.append(cnt) else: cnt = 0 cnt_list.append(0) print(max(cnt_list))
p03163
s317192857
Wrong Answer
n,w=map(int,input().split()) dp=[[0]*(w+1) for i in range(n)] wet=[] val=[] for i in range(n): we,va=map(int,input().split()) wet.append(we) val.append(va) for i in range(w+1): if(wet[0]==i): dp[0][i]=val[0] elif(wet[0]<i): break for i in range(1,n): for j in range(w+1): dp[i][j]=dp[i-1][j] if(wet[i]<=j): dp[i][j]=max(dp[i][j],dp[i-1][j-wet[i]]+val[i]) print(dp[n-1][w])
p02657
s966749435
Accepted
a,b = map(int, input().split()) print(a*b)
p02727
s946011655
Accepted
x, y, a, b, c = map(int, input().split()) red = [int(x) for x in input().split()] green = [int(x) for x in input().split()] red.sort(reverse=True) green.sort(reverse=True) candidates = [int(x) for x in input().split()] + red[:x] + green[:y] candidates.sort(reverse=True) print(sum(candidates[:x+y]))
p02996
s933083980
Accepted
n = int(input()) ab = [list(map(int,input().split())) for i in range(n)] # (a, b) := (仕事にかかる時間, 締め切り) ab = sorted(ab, key = lambda x:x[1]) time = 0 for a, b in ab: time += a if time <= b:continue print('No') exit() print('Yes')
p02629
s200812441
Accepted
n = int(input()) name = '' while n>0: n -= 1 name += chr(ord('a') + n%26) n//=26 print(name[::-1])