problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03293
s314405703
Accepted
S=input() T=input() print('Yes' if T in S+S else 'No')
p03281
s012763592
Accepted
n = int(input()) counter = 0 for i in range(1, n+1, 2): divisor_counter = 0 for j in range(1, i+1): if i % j == 0: divisor_counter += 1 if divisor_counter == 8: counter += 1 print(counter)
p02780
s521372078
Accepted
import numpy N, K = map(int, input().split()) p = list(map(int, input().split())) lis = list() p = [(i + 1)/2 for i in p ] numpy.set_printoptions(precision=16) cumSum = numpy.cumsum(p) cumSum2 = list(cumSum) cumSum2.insert(0,0) for i in range(0, N-K+1): lis.append(cumSum2[K+i] - cumSum2[i]) print('{:.12f}'.format(max(lis)))
p02719
s729019207
Wrong Answer
N, K = input().split(); N = int(N); K = int(K); amari = N % K; hu = -1* (amari - K); max_N = max(amari,hu); print(max_N);
p03817
s497886324
Accepted
x = int(input()) s, r = divmod(x, 11) s *= 2 if r > 6: s += 2 elif 1 <= r <= 6: s += 1 print(s)
p02768
s940443153
Wrong Answer
N, a, b = map( int, input().split()) mod = 10 ** 9 + 7 def nCr( n, r ): f = 1 inv = 1 for i in range( 1, min( n - r, r ) + 1 ): f = f * ( n - i + 1 ) % mod inv = inv * i % mod return f * pow( inv, mod - 2, mod ) % mod A = nCr( N, a ) B = nCr( N, b ) N = pow( 2, N, mod ) print( ( N - A - B ) % mod )
p02731
s559774412
Accepted
print((int(input())/3)**3)
p02761
s026453897
Accepted
N, M = map(int, input().split()) ans = [-1] * N for _ in range(M): s, i = map(int, input().split()) s -= 1 if ans[s] != -1 and ans[s] != i: print(-1) exit() ans[s] = i if N > 1 and ans[0] == -1: ans[0] = 1 for i in range(N): if ans[i] == -1: ans[i] = 0 ans = int(''.join(map(str, ans))) if len(str(ans)) != N: print(-1) exit() print(ans)
p02801
s673377771
Accepted
c = input() print(chr(ord(c)+1))
p03943
s041737479
Wrong Answer
a,b,c = map(int, input().split()) if (a+b+c) % 3 == 0: print("Yes") else: print("No")
p02725
s254669407
Accepted
k,n = map(int, input().split()) a = list(map(int, input().split())) b = [a[0]+k-a[-1]] for i in range(1,n): b.append(a[i]-a[i-1]) print(k-max(b))
p02682
s830769896
Accepted
# B - Easy Linear Programming a, b, c, k = map(int, input().split()) print(min(k, a, a + a + b - k))
p02842
s250701199
Wrong Answer
n = int(input()) ans = int(n*100/108+0.5) if int(ans*1.08)==n: print(ans) else: print(":(")
p02555
s804101126
Accepted
S = int(input()) p = [0 for _ in range(max(4,S + 1))] p[3] = 1 for i in range(4,S + 1): p[i] += 1 for j in range(1,i-2): p[i] += p[j] p[i] %= 10 ** 9+ 7 print(p[S])
p02911
s857997073
Accepted
import sys import math import bisect input = sys.stdin.readline MOD = 10**9 + 7 INF = float('INF') def main(): n, k, q = list(map(int,input().split())) t = q - k + 1 p = [0] * n for i in range(q): a = int(input()) p[a-1] += 1 for i in range(n): if p[i] >= t: print('Yes') else: print('No') if __name__ == '__main__': main()
p03163
s663381367
Accepted
import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n%2==0 else 0 n,w = map(int,readline().split()) WV = [] for i in range(n): WV.append(list(map(int,readline().split()))) dp = [[0]*(w+1) for _ in range(n+1)] for i in range(n): for j in range(w+1): if WV[i][0]-j > 0: dp[i+1][j] = dp[i][j] continue dp[i+1][j] = max(dp[i][j],dp[i][j-WV[i][0]]+WV[i][1]) print(dp[-1][-1])
p02646
s603778311
Accepted
a,v = map(int,input().split()) b,w = map(int,input().split()) t = int(input()) if a > b: av = a - (v * t) bw = b - (w * t) if av <= bw: print('YES') else: print('NO') elif a < b: av = a + (v * t) bw = b + (w * t) if av >= bw: print('YES') else: print('NO')
p02982
s324064056
Accepted
import itertools from math import sqrt def actual(n, d, X): count = 0 for p1, p2 in itertools.combinations(X, 2): d_float = sqrt(sum([(y - z) ** 2 for (y, z) in zip(p1, p2)])) if d_float % 1 == 0.0: count += 1 return count n, d = map(int, input().split()) X = [] for _ in range(n): X.append(list(map(int, input().split()))) print(actual(n, d, X))
p02694
s694662161
Wrong Answer
X=int(input()) B=0 X=X-100 for i in range(0,X): X=X-1 B=B+1 print(B)
p03000
s481703917
Wrong Answer
n, x = map(int, input().split()) l = list(map(int, input().split())) d = 0 count = 0 i = 1 while d <= x and i <= n: d = d + l[i - 1] count += 1 i += 1 if d < x: count += 1 print(count)
p02743
s396908844
Wrong Answer
from math import sqrt a, b, c = map(int, input().split()) x = (c - b) / (sqrt(c) + sqrt(b)) y = (x ** 2 - a) / (x + sqrt(a)) if 0 < y: print('Yes') else: print('No')
p03069
s533181916
Accepted
N = int(input()) S = input() max_w = S.count(".") if max_w == 0 or max_w == N: print(0) exit() ans = float("inf") b, w = 0, max_w for s in S: if s == "#": b += 1 else: w -= 1 ans = min(ans, b+w) print(min(ans, max_w, N-max_w))
p02924
s766261256
Wrong Answer
n = int(input()) print(n*(n-1)/2)
p02848
s871273217
Accepted
N = int(input()) S = input() ANS = "" for MOJI in S: i = ord(MOJI) + N if i > 90: i = i - 26 ANS = ANS + chr(i) print(ANS)
p03001
s155697570
Accepted
W,H,x,y = list(map(int, input().split())) if x == W/2 and y == H/2: print(W*H/2, 1) else: print(W*H/2, 0)
p03427
s439957279
Wrong Answer
import sys N = list(input()) for n in range(len(N)-1): i = int(N[n]) if i != 9: cnt1 = len(N[:n]) cnt2 = len(N[n+1:]) print((cnt1*9)+(i-1)+(cnt2*9)) sys.exit(0) if N[-1] == 9: print(len(N)*9) else: print(8+((len(N)-1)*9))
p03472
s605966866
Accepted
import math n, h = map(int, input().split()) b = [0] * n maxa = 0 for i in range(n): x, y = map(int, input().split()) maxa = max(x, maxa) b[i] = y b.sort(reverse = True) ans = 0 for i in range(n): if b[i] < maxa: break h -= b[i] ans += 1 if h <= 0: break if not h <= 0: ans += math.ceil(h / maxa) print(ans)
p02727
s884978188
Wrong Answer
import sys X, Y, A, B, C = sys.stdin.readline().split() X = int(X) Y = int(Y) C = int(C) scoreA = list(map(int, sys.stdin.readline().split())) scoreB = list(map(int, sys.stdin.readline().split())) scoreC = list(map(int, sys.stdin.readline().split())) scoreA.sort(reverse=True) scoreB.sort(reverse=True) scoreC.sort(reverse=True) scoreA = scoreA[:X-1] scoreB = scoreB[:Y-1] scoreAll = scoreA + scoreB + scoreC scoreAll.sort(reverse=True) print(sum(scoreAll[:X+Y-1]))
p02861
s594676339
Accepted
from itertools import permutations n = int(input()) xy = [list(map(int, input().split())) for _ in range(n)] dist = 0 cnt = 0 for pattern in permutations(xy): cnt += 1 for i in range(n - 1): x1, y1 = pattern[i] x2, y2 = pattern[i + 1] dist += pow(pow(x1 - x2, 2) + pow(y1 - y2, 2), 1 / 2) res = dist / cnt print(res)
p03696
s890175797
Accepted
n = int(input()) s = str(input()) ns = s while '()' in ns: ns = ns.replace('()', '') l = ns.count(')') r = ns.count('(') print('(' * l + s + ')' * r)
p02983
s016638589
Accepted
import sys l, r = map(int, input().split()) ans = 10 ** 10 for i in range(l, r): for j in range(i+1, r+1): if (i * j) % 2019 == 0: print(0) sys.exit() ans = min(ans, (i*j) % 2019) print(ans)
p03486
s993056446
Accepted
s = list(input()) t = list(input()) alph = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] s0, t0 = [], [] for i in range(26): for j in s: if alph[i] == j: s0.append(j) for j in t: if alph[25 - i] == j: t0.append(j) s0 = "".join(s0) t0 = "".join(t0) print("Yes" if s0 < t0 else "No")
p02612
s525875556
Accepted
n = int(input()) a = n%1000 if a == 0 : print(a) else: print(1000-a)
p02820
s315338160
Accepted
N,K = map(int,input().split()) R,S,P = map(int,input().split()) T = list(input()) d = {'r':P,'s':R,'p':S} ans = 0 for i,c in enumerate(T): if i < K or c != T[i-K]: ans += d[c] continue else: T[i] = '_' print(ans)
p03433
s058504697
Accepted
N = int(input()) A = int(input()) if(N%500 <= A): print('Yes') else: print('No')
p02797
s304772953
Accepted
import sys def LI(): return list(map(int, input().split())) N, K, S = LI() if K == 0: if S == 10**9: for i in range(N): print(1, end=" ") else: for i in range(N): print(10**9, end=" ") sys.exit() for i in range(K): print(S, end=" ") if S == 10**9: for i in range(N-K): print(S-1, end=" ") else: for i in range(N-K): print(S+1, end=" ")
p03319
s912746264
Wrong Answer
N, K = map(int, input().split()) li = list(map(int, input().split())) cnt = li.index(1) + 1 ans = 0 ans += (cnt -1 + K -2)//(K-1) ans += (N - cnt +K-2)//(K-1) print(ans)
p02900
s887644948
Accepted
import math a,b=map(int,input().split()) gcd=math.gcd(a,b) def prime_factorization(n): i=2 prime=[] if n%i==0: n//=i prime.append(2) while n%i==0: n//=i i+=1 k=int(n**0.5)+1 for j in range(i,k+1,2): if n%j==0: n//=j prime.append(j) while n%j==0: n//=j if n>1: prime.append(n) return prime print(len(prime_factorization(gcd))+1)
p03681
s975573863
Accepted
import math n,m = map(int,input().split()) if abs(n-m) > 1: print(0) else: if n == m: print((2*math.factorial(n)*math.factorial(m))%(10**9+7)) else: print((math.factorial(n)*math.factorial(m))%(10**9+7))
p02618
s331480940
Wrong Answer
d = int(input()) c = list(map(int, input().split())) prev = [0] * 26 for i in range(d): s = list(map(int, input().split())) happy = - (10 ** 5) ans = -1 for j in range(26): tmp = s[j] cost = 0 for k in range(26): if j == k: continue cost += c[k] * (i - prev[k]) tmp -= cost if tmp > happy: happy = tmp ans = j+1 print(ans)
p04020
s544991127
Accepted
N = int(input()) A = [int(input()) for _ in range(N)] ans = 0 rest = 0 for i, a in enumerate(A): if rest == 0: ans += a // 2 rest = a % 2 else: if (a + rest) % 2 == 0: ans += (a + rest) // 2 rest = 0 else: ans += (rest + a) // 2 rest = 1 if a != 0 else 0 print(ans)
p03067
s450186768
Wrong Answer
a, b, c = map(int, input().split()) if a < c < b: print("Yes") else: print("No")
p02879
s033298220
Accepted
""" author : halo2halo date : 8, Jan, 2020 """ import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) A, B = map(int, readline().decode('utf8').split()) print(A * B if A <= 9 and B <= 9 else -1)
p03456
s661679806
Wrong Answer
a,b=input().split() c=int(a+b) x=c**0.5 if a==b==100: print("No") elif x**2==c: print("Yes") else: print("No")
p03633
s177044046
Accepted
from numpy import * print(lcm.reduce([int(input()) for n in range(int(input()))]))
p02724
s073027974
Accepted
n = int(input()) a = n // 500 n %= 500 b = n // 5 print(a * 1000 + b * 5)
p03633
s853470865
Wrong Answer
def resolve(): nclo=range(int(input())) from fractions import gcd def lcm(a,b): return (a*b)//gcd(a,b) next=0 temp=1 for i in nclo: next=int(input()) temp=lcm(temp,next) print(temp) #%%submit! #resolve()
p02681
s002893403
Wrong Answer
s = input() t = input() if len(t) == len(s) + 1 and 1 <= len(s) <= 10: print('Yes') else: print('No')
p04030
s151416780
Accepted
s = input() ans = [] for i in range(int(len(s))): if s[i] == "0": ans.append(0) elif s[i] == "1": ans.append(1) elif s[i] == "B": if not ans: continue del ans[int(len(ans))-1] for i in ans: print(i,end="")
p03011
s861035867
Accepted
time = list(map(int,input().split())) time.sort() print(time[0]+time[1])
p02684
s400483348
Accepted
N, K = map(int, input().split()) P = list(map(int, input().split())) for i in range(N): P[i] -= 1 M = 60 step = [[0]*(M+1) for _ in range(N)] for i in range(N): step[i][0] = P[i] for i in range(1, M+1): for j in range(N): c = step[j][i-1] c = step[c][i-1] step[j][i] = c c = 0 for j in range(M+1): if K % 2: c = step[c][j] K //= 2 print(c+1)
p02996
s481434443
Accepted
N = int(input()) A = [] B = [] for _ in range(N): a,b = map(int, input().split()) A.append(a) B.append(b) C = list(zip(A,B)) C = sorted(C, key=lambda x:x[1]) time = 0 for a,b in C: time = time + a if time<=b: continue print("No") exit() print("Yes")
p03565
s177024522
Wrong Answer
s=input().replace('\n', '') t=input().replace('\n', '') begin, end = len(s) - len(t), len(s) ans='' while begin>=0: origin = s[begin:end] if origin!=t: ans = s[:begin]+t+s[end:] break begin-=1 end-=1 print("UNRESTORABLE" if not len(ans) else ans.replace('?', 'a'))
p02811
s270961100
Wrong Answer
K, X = map(int, input().split()) result = K*500 if result >= X: print("yes") elif result < X: print("no")
p02823
s956641731
Accepted
n, a, b = map(int, input().split()) if (a - b) % 2 == 0: print(abs((a - b) // 2)) else: ans = min(a - 1, n - b) + 1 + ((b - a - 1) // 2) print(ans)
p03487
s379894750
Accepted
import collections n = int(input()) a = collections.Counter([int(x) for x in input().split()]) res = 0 for key in a.keys(): k_int = int(key) val = a[key] if k_int == val: continue elif k_int < val: res += val - k_int else: res += val print(res)
p03087
s173911906
Wrong Answer
n,q = map(int,input().split()) s = str(input()) ls = [list(map(int,input().split())) for _ in range(q)] c = 0 a = [0]*10**5 for i in range(n-1): if s[i] == "A": if s[i+1] == "C": a[i] = i a = list(set(a)) for j in range(q): (u,t) = (ls[j][0],ls[j][1]) for k in a: if (k >= u-1) and (k <= t-2): c += 1 print(c) c = 0
p03407
s800635188
Wrong Answer
a,b,c=map(int,input().split()) if c<a+b*2: print('Yes') else: print('No')
p02784
s841284048
Accepted
h,n = map(int, input().split()) a = list(map(int, input().split())) if sum(a) >= h: print('Yes') else: print('No')
p03543
s324184005
Wrong Answer
N = set(input()) print('Yes' if len(N) < 3 else 'No')
p02554
s081060227
Accepted
n = int(input()) x = 10 ** n x -= 2*(9**n) x += 8**n x %= 1000000007 print(x)
p02695
s307202440
Accepted
import itertools N,M,Q = map(int, input().split()) series = list() for i in range(Q): series.append(list(map(int,input().split()))) A = [x for x in range(1,M+1)] max_score = 0 for a in itertools.combinations_with_replacement(A,N): score = 0 for s in series: if (a[s[1]-1] - a[s[0]-1]) == s[2]: score += s[3] if score > max_score: max_score = score print(max_score)
p03759
s438693646
Accepted
a, b,c = map(int, raw_input() .split()) if b - a == c - b: print "YES" else: print "NO"
p03457
s632804040
Accepted
n=int(input()) t=[0]*(n+1) x=[0]*(n+1) y=[0]*(n+1) for i in range(n): t[i+1],x[i+1],y[i+1]=map(int,input().split()) lim_t=t[i+1]-t[i] lim_x=x[i+1]-x[i] lim_y=y[i+1]-y[i] if abs(lim_x)+abs(lim_y)>lim_t or (lim_t-lim_x-lim_y)%2==1: print('No') exit() print('Yes')
p03059
s297640887
Wrong Answer
a,b,t = map(int,input().split()) for i in range(1,20): if a*i*(i+1)/2 >t+0.5: if i==1: print(0) break else: print(b*i) break
p03107
s753906144
Accepted
S = list((input())) print(min(S.count('0'),S.count('1')) * 2)
p02880
s550915269
Accepted
n = int(input()) ans = "No" for i in range(1, 10): for j in range(1, 10): if i * j == n: ans = "Yes" print(ans)
p03778
s667733608
Accepted
W, a, b = map(int, input().split()) if a > b: a, b = b, a ans = max(0, b - (a + W)) print(ans)
p02677
s754652639
Accepted
import math A, B, H, M = map(int, input().split()) h = math.pi*2/(12*60) m = math.pi*2/60 angle_M = M * m angle_H = (H * 60 + M) * h angle = math.fabs(angle_M - angle_H) length = math.sqrt(A * A + B * B - 2 * A * B * math.cos(angle)) print(length)
p02657
s163745010
Accepted
a, b = map(int, input().split()) print(a*b)
p02900
s097014565
Accepted
from fractions import gcd A,B = map(int,input().split()) C = gcd(A,B) nse = set() for i in range(1,int(C**0.5+1)): if C%i == 0: nse.add(i) nse.add(C//i) nli = list(nse) nli.sort() size = len(nli) for i in range(1,size): n = nli[i] for j in range(i+1,size): if nli[j]%n == 0 : nse.add(nli[j]) nse.remove(nli[j]) print(len(nse))
p02791
s988414583
Accepted
N = int(input()) P_ls = list(map(int, input().split(' '))) rst, min_val = 0, 10 ** 6 for i in P_ls: if min_val >= i: rst += 1 min_val = i print(rst)
p03380
s223057651
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort(reverse=True) dif = 1000000000 best = a[0] // 2 ans = 0 for i in range(1, n): new_dif = abs(best - a[i]) if dif <= new_dif: ans = a[i - 1] break dif = new_dif else: print(a[0], a[1]) exit() print(a[0], ans)
p02732
s691788229
Wrong Answer
N = int(input()) A = [int(i) for i in input().split()] a = 0 b = [] for i in range(N): c=0 for j in range(N): if A[i] == A[j]: c+=1 c-=1 b.append(c) a+=c a/2 for i in range(N): print(a-b[i])
p02958
s497777629
Wrong Answer
n=int(input()) p=[int(j) for j in input().split()] s=range(n) x=0 c=0 for a in range(n): if p[a]!=s[a]: c=c+1 if c>2: print('NO') if c<=2: print('YES')
p03592
s037939015
Accepted
n,m,k=map(int,input().split()) cnt=0 flag =0 for i in range(n+1): for j in range(m+1): cnt = (m*i) - (i*j) + (j*(n-i)) if cnt == k: flag=1 if flag: print("Yes") else: print("No")
p02756
s982456035
Accepted
from collections import deque s = input() n = int(input()) d = deque(s) now_reverse = False for _ in range(n): query = input() if query == '1': now_reverse = not now_reverse continue _,f,c = query.split() if f == '1' and now_reverse: d.append(c) elif f == '1' and not now_reverse: d.appendleft(c) elif f == '2' and now_reverse: d.appendleft(c) else: d.append(c) if now_reverse: d = reversed(list(d)) else: d =list(d) for c in d: print(c,end='') print()
p03427
s256943861
Wrong Answer
N = input() if len(N)==1: print(int(N)) else: print(int(N[0])-1 + 9*(len(N)-1))
p03254
s765346849
Accepted
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() ans = 0 for i in range(n-1): if x >= a[i]: x -= a[i] ans += 1 if x == a[-1]: ans += 1 print(ans)
p02972
s484244302
Accepted
n = int(input()) a = list(map(int, input().split())) ans = [0] * n for i in range(n - 1, -1, -1): sum = 0 for j in range(i + i + 1, n, i + 1): sum += ans[j] ans[i] = a[i] - sum ans[i] %= 2 print(ans.count(1)) for i in range(n): if ans[i] == 1: print(i + 1, end=" ")
p03434
s060636239
Accepted
n = int(input()) data = list(map(int,input().split())) data = sorted(data, reverse=True) alice = 0 bob = 0 for i,var in enumerate(data): if i%2 == 0: alice += var else: bob += var print(alice-bob)
p02633
s252983091
Accepted
x = int(input()) for i in range(360): if x*(i+1) % 360 == 0: print(i+1) exit()
p02645
s740554333
Accepted
print(input()[:3])
p02970
s329411918
Accepted
N,D = map(int,input().split()) w = D*2+1 ans = 0--N//w print(ans)
p02787
s403907950
Wrong Answer
h,n=map(int,input().split()) a_=0 magic=[] for i in range(n): a,b=map(int,input().split()) a_=max(a,a_) c=[a,b] magic.append(c) dp=[10**7+1]*(h+a_+1) dp[0]=0 for i in range(n): a,b=magic[i] for j in range(len(dp)): if j+a<=h+a_: dp[j+a]=min(dp[j+a],dp[j]+b) print(min(dp[h:]))
p02771
s300993304
Accepted
nums = list(map(int, input().split())) if nums.count(nums[0]) == 2 or nums.count(nums[1]) == 2 or nums.count(nums[2]) == 2: print("Yes") else: print("No")
p02578
s320955947
Accepted
b=s=0 for a in[*open(0)][1].split():a=int(a);b=max(b,a);s+=b-a print(s)
p03696
s735782743
Accepted
def main(): import sys def input(): return sys.stdin.readline().rstrip() n = int(input()) s = input() cnt = 0 m = 0 for i in range(n): if s[i] == '(': cnt += 1 else: cnt -= 1 m = min(m, cnt) ans = '('*(-m)+s+')'*(cnt-m) print(ans) if __name__ == '__main__': main()
p03438
s462592083
Accepted
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) sa = sum(a) sb = sum(b) counta = 0 countb = 0 for i,j in zip(a,b): if j > i: if (j-i)%2: countb += 1 counta += (j-i+1)//2 elif i > j: countb += i-j if counta <= sb-sa and countb <= sb-sa: print("Yes") else: print("No")
p02775
s821993047
Accepted
# E - Payment N = input().strip() s = 0 carry = 0 prev = None for c in reversed(N): x = int(c) + carry if x > 5 or x == prev == 5: if prev == 5: x += 1 s += 10 - x carry = 1 else: s += x carry = 0 prev = x s += carry print(s)
p03720
s887232661
Wrong Answer
N, M = map(int, input().split()) ABs = [input().split() for i in range(M)] MPs = {} for a, b in ABs: if a not in MPs: MPs[a] = 1 else: MPs[a] += 1 if b not in MPs: MPs[b] = 1 else: MPs[b] += 1 for mp in range(1, N+1): if str(mp) not in MPs: MPs[str(mp)] = '0' for y in MPs.values(): print(y)
p02801
s872316199
Wrong Answer
print(str(ord(input())+1))
p02615
s378035833
Accepted
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) AA = [] for i in range(N): if i == 0: AA.append(A[i]) else: AA.append(A[i]) AA.append(A[i]) AA.sort(reverse=True) ans = 0 for i in range(N-1): ans += AA[i] print(ans)
p02629
s043703976
Accepted
n = int(input()) def num2alpha(num): if num<=26: return chr(64+num) elif num%26==0: return num2alpha(num//26-1)+chr(90) else: return num2alpha(num//26)+chr(64+num%26) print(num2alpha(n).lower())
p03161
s921334181
Wrong Answer
N, K = map(int, input().split()) h = list(map(int, input().split())) for j in range(K): h.append(0) INF = float('inf') dp = [INF] * (N+K) dp[0] = 0 for i in range(N): for j in range(1, K+1): dp[i+j] = min(dp[i+j], dp[i] + abs(h[i]-h[i+j])) print(dp, h)
p03861
s530691724
Wrong Answer
from decimal import * a, b, x = map(Decimal, input().split()) dif = b - a ans = dif // x if a % x == 0: ans += 1 elif b % x == 0: ans += 1 print(ans)
p03095
s233547238
Accepted
n = int(input()) s = input() ans = 1 for x in set(s): ans *= s.count(x)+1 print((ans-1)%(10**9+7))
p03785
s174048886
Wrong Answer
n, c, k = map(int, input().split()) arr = sorted([int(input()) for _ in range(n)]) ans = 0 cnt = 0 tmp_t = 0 for t in arr: cnt += 1 if cnt >= c: ans += 1 cnt = 0 elif t - tmp_t > k: ans += 1 cnt = 0 tmp_t = t print(ans)
p02836
s464178493
Accepted
import math S = input() len_S = len(S) half = math.floor(len_S/2) counter = 0 for i in range(half): if S[i] != S[len_S-i-1]: counter += 1 print(counter)
p02708
s359594582
Accepted
n, k = map(int, input().split()) c = 0 m = 10**9 +7 for i in range(k, n+2): c += (n*(n+1)//2 - (n-i)*(n-i+1)//2) - (i-1)*i//2 + 1 print(c%m)