problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03427
s581758715
Accepted
N = input().strip() k = len(N) cmax = 0 for i in range(k): cmax += int(N[i]) if k>1: cnt = (int(N[0])-1)+9*(k-1) cmax = max(cmax,cnt) print(cmax)
p03617
s827225752
Wrong Answer
a = input().split() q = int(a[0]) * 4 h = int(a[1]) * 2 s = int(a[2]) d = int(a[3]) / 2 b = int(input()) if min([q,h,s,d]) != d: print(int(b * min([q,h,s]))) else: if b % 2 == 0: print(int(b * d)) elif b != 1: print(int((b-1) * d) + min([q,h,s])) else: print(min([q,h,s]))
p03623
s165810972
Wrong Answer
a,b,c=input().split() a=int(a) b=int(b) c=int(c) if (a-b)>=(c-a): print("B") else: print("A")
p02766
s622957097
Wrong Answer
n, k = map(int,input().split()) count = 1 origk = k while(True): if n <= k: print(count) break k *= origk count+=1
p02618
s019392087
Accepted
D=int(input()) c=list(map(int,input().split())) s=[] t=[] for i in range(D): s.append(list(map(int,input().split()))) l=[0]*26 max=0 target=0 deg=0 #初期t生成 for d in range(D): degsum=0 max=0 for i in range(26): degsum+=c[i]*(d-l[i]) for i in range(26): w=degsum-c[i]*(d-l[i])-s[d][i] if max < -w: max=-w target=i t.append(target+1) l[target]=d for i in range(D): print(t[i])
p03611
s848752165
Accepted
def main(): n = int(input()) A = list(map(int, input().split())) res_list = [0] * 100001 for num in A: res_list[num] += 1 if num != 0: res_list[num-1] += 1 if num != 10**5: res_list[num+1] += 1 print(max(res_list)) if __name__ == '__main__': main()
p03745
s435522700
Accepted
import sys n = int(input()) a_ls = [int(i) for i in sys.stdin.readline().split()] flg = None #正 cur = a_ls[0] cnt = 1 for a in a_ls[1:]: if a > cur: if flg is None: flg = True if not flg: flg = None cnt += 1 if a < cur: if flg is None: flg = False if flg: cnt += 1 flg = None cur = a print(cnt)
p04029
s496578625
Accepted
N = int (input()) print (int (N * (N+1) / 2 ) )
p03371
s520100840
Accepted
a,b,c,x,y=map(int,input().split()) mi=min([x,y]) ma=max([x,y]) g=ma-mi ans,ab=0,0 if 2*c <= a+b: if x>=y: ans+=2*c*y + (x-y)*a ab=2*c*x else: ans+=2*c*x + (y-x)*b ab=2*c*y else: ans+=a*x+b*y if ab >= ans: print(ans) else: if ab!=0: print(ab) else: print(ans)
p02957
s750975232
Accepted
A, B = map(int, input().split()) print('IMPOSSIBLE' if abs(A-B) % 2 != 0 else int(min(A, B) + (abs(A-B) / 2)))
p02767
s678586900
Accepted
n=int(input()) a=list(map(int,input().split())) m=int(sum(a)/n+0.5) print(sum((i-m)**2 for i in a))
p03448
s038158545
Accepted
A=int(input()) B=int(input()) C=int(input()) X=int(input()) count=0 for i in range(A+1): for j in range(B+1): for k in range(C+1): if 500*i + 100*j + 50*k == X: count+=1 print(count)
p03774
s773771862
Accepted
n, m = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(n)] cd = [list(map(int, input().split())) for _ in range(m)] for i in range(n): num = 0 ans = float('inf') for j in range(m): man = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1] - cd[j][1]) if man < ans : ans = man num = j print(num+1)
p03605
s421406408
Wrong Answer
n=input() for i in range(len(n)): if i ==9: print('Yes') break print('No')
p03778
s223700153
Accepted
W,a,b = list(map(int,input().split())) if a+W <= b: print(b-(a+W)) elif b+W <= a: print(a-(b+W)) else: print(0)
p02743
s701436333
Wrong Answer
import bisect,copy,heapq,string from collections import * from math import * from itertools import * import sys def input() : return sys.stdin.readline().strip() def INT() : return int(input()) def MAP() : return map(int,input().split()) def LIST() : return list(MAP()) a, b, c = MAP() print("Yes" if a**0.5+b**0.5<c**0.5 else "No")
p04031
s368446150
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def main(): N = int(input()) A = list(map(int, input().split())) result = sum([(a - max(A))**2 for a in A]) for i in range(min(A), max(A)): tmp = sum([(i - a)**2 for a in A]) if result > tmp: result = tmp print(result) if __name__ == "__main__": main()
p02778
s542602960
Wrong Answer
print('×'*len(input()))
p02615
s630407363
Accepted
n,*l=map(int,open(0).read().split()) from heapq import * l.sort() q=[-l.pop()] a=0 for _ in range(n-1): m=heappop(q) a-=m t=-l.pop() heappush(q,t) heappush(q,t) print(a)
p03487
s940935241
Wrong Answer
N = int(input()) A = list(map(int, input().split())) D = {} for i in A: if i in D: D[i] += 1 else: D[i] = 1 p = 0 for i in D: if D[i] >= i: p += i - D[i] else: p += D[i] print(p)
p02630
s178930952
Wrong Answer
N = input() A = input().split() A = [int(x) for x in A] Q = int(input()) BC = [] for i in range(Q): bc = input().split() bc = [int(x) for x in bc] BC.append(bc) for j in range(len(BC)): for k in range(len(A)): if A[k] == BC[j][0]: A[k] = BC[j][1] total = sum(A) print(A)
p02797
s217405882
Accepted
n, k, s = map(int, input().split()) a = [s]*n ans = "" for i in range(n-k): if s == 1: a[i] = 2 elif s == 1000000000: a[i] = 1000000000-1 else: a[i] = s+1 for i in range(n): ans += " " + str(a[i]) print(ans)
p03803
s637769671
Accepted
a,b = map(int,input().split()) if a == b: print('Draw') elif a == 1: print('Alice') elif b == 1: print('Bob') elif a > b: print('Alice') elif a < b: print('Bob')
p02606
s359586558
Wrong Answer
def main(): l, r, d=map(int, input().split()) # c=0 # for i in range(l,r+1): # if not i%d: # c+=1 # print(c) print((r-l+1)//d) if __name__=='__main__': main()
p03543
s306829073
Accepted
a, b, c, d = input() print("Yes" if a == b == c or b == c == d else "No")
p02911
s749714344
Wrong Answer
N,K,Q =map(int,input().split()) M = [K-Q]*N for q in range(Q): a = int(input()) M[a-1]+=1 print(M) for m in M: if m<=0: print("No") else: print("Yes")
p03548
s902226818
Accepted
x,y,z=map(int,input().split()) ans=(x-z)//(y+z) print(ans)
p03910
s222283861
Accepted
N = int(input()) k = 0 ans = 0 while N >= ans: k += 1 ans = k * (k+1) / 2 num = int(k * (k+1) / 2 - N) for i in range(1,k+1): if i != num: print(i)
p02765
s770975733
Accepted
N, R = list(map(int, input().split())) if N >= 10: print(R) else: print(R + 100 * (10 - N))
p02660
s234136272
Wrong Answer
n = int(input()) res = 0 upper = 1e6 i = 2 lst = set() if n < 2: print(res) exit() while i <= upper: if n % i == 0 and i not in lst: n = n // i upper = min(upper, n) lst.add(i) res += 1 i += 1 if upper == 1e6: res += 1 print(res)
p03408
s818488006
Accepted
N=input() N=int(N) S=[0]*N for i in range(N): S[i]=input() M=input() M=int(M) T=[0]*M for i in range(M): T[i]=input() A=[] for i in S: A.append(S.count(i)-T.count(i)) print(max(0,max(A)))
p03486
s630057356
Wrong Answer
s=input() t=input() s_array=[] t_array=[] for i in range(len(s)): s_array.append(s[i]) for i in range(len(t)): t_array.append(t[i]) s_array=sorted(s_array) t_array=sorted(t_array,reverse=True) for i in range(min([len(s_array),len(t_array)])): if s_array[i]<t_array[i]: print('Yes') exit() elif s_array[i]>t_array[i]: print('No') exit() print('No')
p02622
s162904960
Accepted
S = input() T = input() result = 0 for i in range(len(S)): if S[i] != T[i]: result += 1 print(result)
p02717
s298016778
Accepted
a, b, c = map(int, input().split()) a, b , c = c , a, b print(a, b, c )
p03160
s412849661
Accepted
N = int(input()) h = list(map(int, input().split())) #dp[i]:i番目に到達するまでにはらうコストの最小値 dp = [0 for i in range(N)] dp[0] = 0 dp[1] = abs(h[1]-h[0]) for i in range(2,N): cost_1 = dp[i-1] + abs(h[i]-h[i-1]) cost_2 = dp[i-2] + abs(h[i]-h[i-2]) dp[i] = min(cost_1, cost_2) print(dp[N-1])
p03061
s388767475
Accepted
import fractions #from functools import reduce N,*a=map(int,open(0).read().split()) L=[] L_base=a[0] b=a[:] b.reverse() R=[] R_base=b[0] for i in range(N-1): L_base=fractions.gcd(L_base,a[i]) L.append(L_base) R_base=fractions.gcd(R_base,b[i]) R.append(R_base) LR=[R[-1]] for i in range(N-2): LR.append(fractions.gcd(L[i],R[-2-i])) LR.append(L[-1]) print(max(LR))
p02753
s563932605
Accepted
S = input() print('No' if ('A' in S) == False or ('B' in S) == False else 'Yes')
p02995
s109367119
Accepted
from fractions import gcd a,b,c,d=map(int,input().split()) e=c*d//gcd(c,d)#最小公倍数 sm=(b//c-(a-1)//c)+(b//d-(a-1)//d)-(b//e-(a-1)//e) print(int(b-a+1-sm))
p03338
s853939992
Accepted
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) INF = float('inf') N = int(readline().rstrip().decode("utf-8")) S = readline().rstrip().decode("utf-8") ans = 0 for i in range(N-1): left = S[:i+1] right = S[i+1:] # print("left: {} right: {}".format(left, right)) tmp = len(set(left) & set(right)) ans = max(tmp, ans) print(ans)
p02665
s960613055
Wrong Answer
n=int(input()) a=list(map(int, input().split())) flag=True if a[0]!=0: flag=False top_list=[1] bot_list=[a[-1]] for i in range(n): top_list.append((top_list[i]-a[i])*2) # print(top_list) for i in range(1,n+1): bot_list.append(bot_list[i-1]+a[n-i]) bot_list.reverse() # print(bot_list) total=0 for i in range(n+1): if top_list[i]<=0 or bot_list[i]<=0: flag=False total+=min(top_list[i],bot_list[i]) print(total if flag else -1)
p03434
s089931243
Wrong Answer
N = int(input()) A =[i for i in input().split()] A = sorted(A,reverse=True) Alice = 0 Bob = 0 while len(A) != 0: Alice += int(A.pop(0)) if len(A) == 0: break else: Bob += int(A.pop(0)) print(Alice - Bob)
p02726
s573878572
Accepted
N, X, Y = map(int, input().split()) X, Y = X-1, Y-1 ans = {i:0 for i in range(1, N)} for i in range(N-1): for j in range(i+1, N): d = min(j-i, abs(X-i)+1+abs(Y-j)) ans[d] += 1 for _, v in ans.items(): print(v)
p02595
s895073623
Wrong Answer
import math n,d = map(int,input().split()) c = 0 for i in range (n): a,b = map(int,input().split()) if math.sqrt(abs(a*a) +abs(b *b)) >=d: c+=1 print(c)
p02582
s900424466
Wrong Answer
S = list(input()) count = 0 buffer = 'R' for s in S: if s == 'R' and buffer == 'R': count += 1 elif s == 'S': buffer = 'S' print(count)
p03624
s757728768
Accepted
#ABC071 s = sorted(set(input())) l = "abcdefghijklmnopqrstuvwxyz" for i in l: if i not in s: print(i) break else: print("None") ## if i in s == False はうまくいかない ##in/not inを使う
p02743
s505450425
Wrong Answer
a,b,c = map(int,input().split()) res = (c-a-b)**2 - a*b if res > 0 : print('Yes') else: print('No')
p03109
s424607611
Wrong Answer
S = input() if int(S[5:7]) <= 4: print("TBD") else: print("Heisei")
p02946
s204416291
Accepted
K,X = map(int,input().split()) for i in range(X-K+1,X+K): print(i, end= ' ')
p02835
s156485765
Wrong Answer
print("bust" if sum(map(int, input().split())) > 22 else "win" )
p03327
s737732482
Wrong Answer
n = int(input()) if n <= 999: print('ABC'+str(n)) else: print('ABD'+str(n-999))
p03131
s533037390
Accepted
k,a,b = map(int,input().split()) ans = 1 if b-a<2: ans += k else: if k-(a-1)>0: k = k-(a-1) if k%2==0:ans = k//2*(b-a)+a else: ans = k//2*(b-a)+a+1 else: ans += k print(ans)
p02725
s535928155
Wrong Answer
def main(): k, n = map(int,input().split()) a = list(map(int,input().split())) mx = 0 cnt = 0 for i in range(1,n): tmp = a[i] - a[i - 1] if tmp > mx: mx = tmp cnt += tmp tmp = k - a[-1] if tmp > mx : mx = tmp cnt = cnt + tmp - mx print(cnt) if __name__ =='__main__': main()
p03241
s397207457
Accepted
def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] N, M = map(int, input().split()) divisors = make_divisors(M) ans = 0 for d in divisors: if N*d <= M: ans = d print(ans)
p03163
s122295522
Accepted
N, W = map(int, input().split()) v = [] w = [] for i in range(N): a, b = map(int, input().split()) w.append(a) v.append(b) dp = [ [0 for i in range(W+1)] for j in range(N+1)] for i in range(1,N+1): for j in range(1,W+1): if w[i-1] <= j: dp[i][j] = max(v[i-1] + dp[i-1][j-w[i-1]], dp[i-1][j]) else: dp[i][j] = dp[i-1][j] print(dp[N][W])
p02759
s064290989
Wrong Answer
N = int(input()) if N % 2 == 0: print(N/2) else: print(N//2 +1)
p02631
s939494207
Wrong Answer
from functools import reduce def resolver(N, A): X = reduce(int.__xor__, A) ans = [X^a for a in A] return ans def test(): pass def main(): #test() N = int(input()) A = list(map(int, input().split())) ans = resolver(N, A) print(ans) if __name__ == '__main__': main()
p03086
s681216800
Wrong Answer
S = list(input()) ans = 0 cnt = 0 for s in S: if s in ['A','C','G','T']: cnt += 1 else: ans = max(ans,cnt) cnt = 0 print(ans)
p02772
s551037103
Accepted
N = int(input()) s = list(map(int, input().split())) cond = True for i in s: if i%2 == 0: if i%3 == 0 or i%5 == 0: continue else: cond = False break if cond is True: print("APPROVED") else: print("DENIED")
p02696
s841090784
Wrong Answer
import math a, b, n = map(int, input().split()) base = math.floor(1 / b) if b >= n: ans = math.floor(a*n/b) - a*math.floor(n/b) else: num = b - 1 ans = math.floor(a*num/b) - a*math.floor(num/b) print(ans)
p03077
s263031048
Wrong Answer
n=int(input()) x=[] for i in range(5): x.append(int(input())) print(5+(n//min(x)))
p04012
s001501589
Accepted
import sys w = input() count_list = [w.count(i) for i in w] count_list = list(set(count_list)) print('Yes' if all( i % 2 == 0 for i in count_list) else 'No')
p02742
s357930394
Accepted
H, W = map(int, input().split()) ans = 0 x = H * W if H == 1 or W == 1: ans = 1 elif x % 2 == 0: ans = x // 2 else: ans = (x // 2) + 1 print(ans)
p03001
s224105023
Accepted
w,h,x,y=map(int,input().split()) a=w/2 b=h/2 s=w*h/2 cnt=0 if x==a and y==b: cnt=1 print(s,cnt)
p04044
s938745621
Wrong Answer
N,L = map(int,input().split()) M = [] for i in range(N): M.append(input()) print(M) M = sorted(M) print(''.join(M))
p02555
s012771124
Accepted
S = int(input()) L = [0] * (S + 10) L[3] = 1 e = 10 ** 9 + 7 for i in range(4, S + 1): L[i] += 1 for j in range(3, i): if i - j <= 0: break L[i] += L[i - j] L[i] = L[i] % e print(L[S])
p02676
s266480563
Accepted
# coding: utf-8 K = int(input()) S = input() if len(S) <= K: print(S) else: print(S[:K] + '...')
p02657
s587770443
Accepted
A,B=map(int,input().split()) print(A*B)
p03803
s373758257
Wrong Answer
a, b = map(int, input().split()) if a > b: print("Alice") elif a < b: print("Bob") else: print("Draw")
p02629
s460648572
Accepted
n=int(input()) def nums(num): if num<=26: return chr(64+num) elif num%26==0: return nums(num//26-1)+chr(90) else: return nums(num//26)+chr(64+num%26) print(nums(n).lower())
p03252
s447129059
Wrong Answer
s = list(input()) t = list(input()) n = len(s) flag = 0 ans = "YNeos" for i in range(n): if s[i] != t[i]: flag += 1 print(ans[::2]) if flag % 2 == 0 else print(ans[1::2])
p03817
s957137057
Wrong Answer
def I(): return int(input()) x = I() div,mod = divmod(x,11) print(div*2+(1 if mod<=6 else 2))
p02847
s336315628
Wrong Answer
S = input() wait_day = 0 if S == "SUN": wait_day = 6 elif S == "MON": wait_day = 6 elif S == "TUE": wait_day = 5 elif S == "WED": wait_day = 4 elif S == "THU": wait_day = 3 elif S == "FRI": wait_day = 2 elif S == "SAT": wait_day = 1 print(wait_day)
p02695
s050517454
Accepted
from itertools import combinations_with_replacement as comb n,m,q = map(int, input().split(' ')) lis = [list(map(int, input().split())) for _ in range(q)] tes = comb(range(1,m+1),n) res = 0 for i in tes: te = 0 for a,b,c,d in lis: if c == i[b-1] - i[a-1]: te += d res = max(te,res) print(res)
p03680
s559394586
Wrong Answer
N = int(input()) A = [] for _ in range(N): A.append(int(input())-1) ans = -1 push = 1 for i in range(N+1): light = A[push] push = light if light == 2: ans = i+1 break print(ans)
p02900
s063373223
Wrong Answer
a,b=map(int,input().split()) def prime_factorization(n): if n==1: return [] else: i=2 ans=[] for j in range(2,int(n**0.5+1)): if n%j==0: n//=j ans.append(j) while n%j==0: n//=j return ans A=prime_factorization(a) B=prime_factorization(b) ans=0 for _a in A: if B.count(_a): ans+=1 print(ans+1)
p03799
s226968936
Accepted
n, m = map(int, input().split()) if m < 2: print(0) exit() ans = 0 tmp = min(n, m // 2) ans += tmp n -= tmp m -= tmp * 2 ans += m // 4 print(ans)
p03632
s682902033
Wrong Answer
a, b, c, d = map(int, input().split()) table = [0] * 101 for i in range(a, b+1): table[i] += 1 for j in range(c, d+1): table[j] += 1 print(table.count(2)-1)
p03250
s201483874
Accepted
abc=sorted(list(map(int,input().split())),reverse=True) print(sum(abc)+abc[0]*9)
p02912
s908743184
Wrong Answer
N,M = list(map(int,input().split())) A = list(map(int,input().split())) sum = sum(A) num = 0 for i in range(M): B = max(A) num += B - B // 2 print(sum)
p03285
s138540867
Accepted
def pay_check(N): for i in range(N//4 + 1): for j in range(N//7 + 1): if (N == 4*i + 7*j): print('Yes') return print('No') pay_check(int(input()))
p02690
s776508935
Accepted
import itertools X = int(input()) u = -1000 A = [] while u < 1000: A.append(u) u += 1 AA = list((itertools.product(A, repeat=2))) for a,b in AA: if a**5-b**5 == X: print(a,b) break
p02594
s484550899
Accepted
x = int(input()) if (x >= 30): print("Yes") else: print("No")
p03617
s704968634
Accepted
q,h,s,d=map(int,input().split()) n=int(input()) if 2*q<h: h=2*q if 2*h<s: s=2*h if 2*s<d: d=2*s print(n//2*d+n%2*s)
p02957
s096518697
Accepted
A,B = map(int, input().split()) answer = 0 K= (A+B)/2 if A!= B and (A+B)%2 == 0 and (A-K)*(B-K)<0: print(int(K)) else: print("IMPOSSIBLE")
p03435
s893833444
Accepted
c=[list(map(int,input().split())) for _ in range(3)] if c[0][0]-c[1][0]==c[0][1]-c[1][1]==c[0][2]-c[1][2] and c[0][0]-c[2][0]==c[0][1]-c[2][1]==c[0][2]-c[2][2]: print("Yes") else: print("No")
p03323
s313788277
Accepted
A,B = map(int,input().split()) if A>8 or B>8: print(":(") else: print("Yay!")
p02742
s008341107
Accepted
H,W=map(int,input().split()) if H==1 or W==1: print(1) exit() if (H*W)%2==0: print(int(H*W/2)) else: ans=((H//2+1)*(W//2+1))+((H-(H//2+1))*(W//2)) print(ans)
p03293
s081725927
Accepted
def main(): s, t = input(), input() if s in t + t: print("Yes") else: print("No") if __name__ == "__main__": main()
p03797
s418695992
Wrong Answer
n, m = map(int, input().split()) if n <= 2*m: ans = n + (m - 2*n)//4 else: ans = m // 2 print(ans)
p02613
s429828651
Accepted
s = [input() for i in range(1)] s0 = int(s[0]) t = [input() for i in range(s0)] ac_count=0 wa_count=0 tle_count=0 re_count=0 for j in range(s0): s1 = t[j] if s1 == "AC": ac_count+=1 if s1 == "WA": wa_count+=1 if s1 == "TLE": tle_count+=1 if s1 == "RE": re_count+=1 print("AC x ",ac_count) print("WA x ",wa_count) print("TLE x ",tle_count) print("RE x ",re_count)
p03471
s300974919
Accepted
n,y = map(int, input().split()) def Otoshidama(n): for i in range(0, y//10000 + 1): for j in range(0, (y - 10000*i)//5000 + 1): h = y - 10000*i - 5000*j if h%1000 == 0 and h >= 0 and i + j + h//1000 == n: return str(i) + " " + str(j) + " " + str(h//1000) return "-1 -1 -1" print(Otoshidama(n))
p03699
s659524835
Accepted
n = int(input()) s = [0]*n for i in range(n): s[i] = int(input()) s.sort() ans = sum(s) if all(i%10==0 for i in s): print(0) exit(0) else: for i in s: if ans%10==0 and i%10!=0: ans -= i print(ans)
p02690
s194884508
Accepted
import itertools x = int(input()) for i in range(500): for j in range(500): if i**5 + j**5 == x: print (i,-j) exit() if i**5 - j**5 == x: print (i,j) exit()
p03017
s993747984
Accepted
n, a, b, c, d = map(int, input().split()) s = input() if "##" in s[a:max(c,d)]: print ("No") exit() if c > d: if "..." not in s[max(0,b-2):min(d+1,n)]: print ("No") exit() print ("Yes")
p03252
s616779246
Wrong Answer
from collections import defaultdict s = input() t = input() n = len(s) d = defaultdict(str) for i in range(n): if d[t[i]] == "": d[t[i]] = s[i] elif d[t[i]] != s[i]: print("No") exit() print("Yes")
p03126
s407252609
Accepted
n , m = map(int, input().split()) food = [0] * m data = [list(map(int, input().split())) for i in range(n)] for i in range(n): for j in range(1, data[i][0] + 1): food[data[i][j] - 1] += 1 ans = 0 for i in range(m): if food[i] == n: ans += 1 print(ans)
p03041
s396437402
Accepted
n, k = (int(i) for i in input().split()) s = input() print(s[:k-1] + s[k-1].lower() + s[k:])
p03086
s514702183
Accepted
s = input() ans = 0 for i in range(len(s)): count = 0 for j in range(i,len(s)): if s[j] in "ACGT": count += 1 else: break if count >= ans: ans = count print(ans)
p02785
s572684633
Wrong Answer
n,k = map(int,input().split()) hl = list(map(int,input().split())) hl = sorted(hl) if n <= k: print(0) elif k == 0: print(sum(hl)) else: print(sum(hl[n-k:]))
p03821
s471227053
Accepted
N = int(input()) A = [] B = [] for _ in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) ctr = 0 for i in reversed(range(N)): if (A[i] + ctr) % B[i] == 0: continue ctr += B[i] - ((A[i] + ctr) % B[i]) print(ctr)