problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02713
s993159385
Accepted
from math import gcd K = int(input()) ans = 0 for i in range(1, K+1): for j in range(1, K+1): for k in range(1, K+1): ans += gcd(gcd(i, j), k) print(ans)
p02678
s455998553
Accepted
N,M = map(int,input().split()) adjacent = [[] for i in range(N)] for i in range(M): A,B = map(int,input().split()) adjacent[A-1].append(B-1) adjacent[B-1].append(A-1) Michi = [0 for i in range(N)] visited = set() frontier = set() visited.add(0) frontier.add(0) while len(frontier) > 0: newfrontier = set() for v in frontier: for next in adjacent[v]: if next not in visited: Michi[next] = v visited.add(next) newfrontier.add(next) frontier = newfrontier print('Yes') for i in range(1,N): print(Michi[i]+1)
p02957
s424150171
Accepted
a,b=map(int,input().split()) ans=0 if (a-b)%2!=0: ans="IMPOSSIBLE" else: ans=int((a+b)/2) print(ans)
p03126
s162234667
Accepted
N, M = map(int, input().split()) a = set(list(map(int, input().split()))[1:]) for i in range(N - 1): a &= set(list(map(int, input().split()))[1:]) print(len(a))
p02606
s817784406
Accepted
L, R, d = list(map(int, input().split())) print(int(R/d) - int((L - 1)/d))
p03544
s996973147
Accepted
n = int(input()) l = [0]*100 l[0] = 2 l[1] = 1 for i in range(n): l[i+2] = l[i+1] + l[i] print(l[n])
p02556
s134583516
Accepted
N=int(input()) xy=[tuple(map(int,input().split())) for _ in range(N)] ans=0 zmi=10**10 zma=-10**10 wmi=10**10 wma=-10**10 for x,y in xy: zmi=min(zmi,x+y) zma=max(zma,x+y) wmi=min(wmi,x-y) wma=max(wma,x-y) print(max(zma-zmi,wma-wmi))
p02767
s218953695
Accepted
N = int(input()) X = list(map(int, (input().split()))) distance = lambda Xi, P: (Xi - P) ** 2 X_max = max(X) answer = None for P in range(1, X_max + 1): total = 0 for Xi in X: total += distance(Xi, P) answer = min(total, answer) if answer is not None else total print(answer)
p03317
s110296542
Accepted
n,k = map(int,input().split()) _ = input() print(1 + -(-(n-k)//(k-1)))
p02787
s517252399
Wrong Answer
H,N = map(int,input().split()) A = [] B = [] for i in range(N): a,b =map(int,input().split()) A.append(a) B.append(b) G = [0]*(H+1) G_old = [1000000000]*(H+1) for i in range(1,N+1): for j in range(1,H+1): if j-A[i-1]<0: G[j] = min(G_old[j], B[i-1]) else: G[j] = min(G_old[j], G[j-A[i-1]]+B[i-1]) print(G[H])
p03605
s756579320
Accepted
N = input() if N.find("9") == -1: print("No") else: print("Yes")
p03286
s763669777
Accepted
N = int(input()) if N == 0: print(0) exit() ans = [] while N != 0: d = len(ans) if N % 2 == 1: ans.append('1') N -= pow(-1, d) N //= 2 else: ans.append('0') N //= 2 print(''.join(ans[::-1]))
p03352
s635447493
Accepted
import math x=int(input()) y=math.ceil(math.sqrt(x)) ans=1 for i in range(y): for j in range(y): if ans<=i**j<=x: ans=i**j else: continue print(ans)
p02606
s354370813
Accepted
L , R, d = map(int, input().split()) ans = R//d - (L-1)//d print(ans)
p02607
s032576574
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, *A = map(int, read().split()) ans = 0 for i, x in enumerate(A): if i % 2 == 0 and x % 2 == 1: ans += 1 print(ans)
p02843
s600349067
Accepted
X = int(input()) t = X//100 if 0 <= X%100 <= t*5: print(1) else: print(0)
p02959
s534386651
Wrong Answer
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) cnt = 0 for i in range(n): t = min(a[i], b[i]) cnt += t b[i] -= t s = min(a[i+1], b[i]) cnt += s b[i] -= s print(cnt)
p03427
s871616728
Accepted
n=int(input())+1 str1=str(n) print(int(str1[0])-1+(len(str1)-1)*9)
p03544
s564476476
Wrong Answer
n = int(input()) l = [2,1] if n == 1: print(2) elif n == 2: print(1) else: for i in range(n-1): l.append(l[-1]+l[-2]) print(l[-1])
p02606
s867065495
Accepted
l, r, d = map(int, input().split()) l_ = l // d r_ = r // d if l % d == 0: print(r_-l_+1) else: print(r_-l_)
p03475
s020139588
Accepted
n=int(input()) l=[list(map(int,input().split())) for i in range(n-1)] for i in range(n-1): ans=l[i][1]+l[i][0] for j in range(i+1,n-1): if ans<l[j][1]: ans=l[j][1]+l[j][0] else: if ans%l[j][2]!=0: ans+=l[j][2]-(ans%l[j][2]) ans+=l[j][0] print(ans) print(0)
p02628
s333749642
Wrong Answer
k=int(input()[-1]) print(sum(sorted(list(map(int,input().split())))[:k]))
p03427
s151895154
Accepted
N = input() ans = 0 ans1 = int(N[0])-1 for i in range(len(N)): ans += int(N[i]) for i in range(1, len(N)): ans1 += 9 print(max(ans, ans1))
p02854
s502289961
Wrong Answer
n = int(input()) a = list(map(int,input().split())) t = [0] for i in range(n): t.append(t[i] + a[i]) t.pop(0) p = t[-1] // 2 if p in t: print(0) else: for i in range(n): if p < t[i]: print(abs(sum(a[0:i+1]) - sum(a[i+1:n]))) break
p03719
s112826697
Accepted
A, B, C = list(map(int,input().split())) print('Yes' if A <= C <= B else 'No')
p03073
s337970312
Accepted
#from distutils.util import strtobool s = input() ss = [int(s[0]) if x % 2 == 0 else int(s[0])^1 for x in range(len(s))] cnt = 0 for i in range(len(s)): if int(s[i]) != ss[i]: cnt += 1 print(cnt)
p02607
s608723674
Accepted
n = int(input()) a = list(map(int,input().split())) ans = 0 for i in range(n): if(i+1)%2==1 & a[i]%2==1: ans +=1 print(ans)
p03013
s564639668
Wrong Answer
n,m,*L = map(int,open(0).read().split()) mod = 10**9+7 dp = [0]*(n+1) if 1 in L: dp[0] = 0 dp[1] = 1 elif 1 not in L: dp[0] = 1 dp[1] = 2 for i in range(2,n): if i+1 in L: continue dp[i] = (dp[i-1] + dp[i-2])%mod print(dp[n-1])
p03673
s793688994
Accepted
n = int(input()) a = list(map(int,input().split())) a = [0] + a dam1=[] dam2=[] for i in range(1,n+1): if i%2==1: dam1.append(a[i]) else: dam2.append(a[i]) if n%2==0: dam2.reverse() out=dam2 + dam1 elif n%2==1: dam1.reverse() out=dam1 + dam2 print(*out)
p02571
s101325505
Accepted
S = input() T = input() ans = len(T) if len(T)==len(S): loop = 1 else: loop = len(S)-len(T) for i in range(loop): diff = 0 for s, t in zip(S[i:i+len(T)], T): if s!=t: diff += 1 ans = min(ans, diff) print(ans)
p02792
s775779221
Accepted
N = int(input()) ans = 0 c_list = [[0]*10 for i in range(10)] for i in range(1,N+1): s = str(i) c_list[int(s[0])][int(s[-1])] += 1 for i in range(10): for j in range(10): ans += c_list[i][j]*c_list[j][i] print(ans)
p02963
s537792884
Accepted
import sys input = sys.stdin.readline S = int(input()) print(0, 0, 10 ** 9, 1, -S % (10 ** 9), (S + -S % (10 ** 9)) // (10 ** 9))
p02571
s763430289
Accepted
s = input() t = input() cur = 0 count_min = 1000 while cur + len(t) -1 < len(s): count = 0 for i in range(len(t)): if t[i] != s[i + cur]: count += 1 if count < count_min: count_min = count cur += 1 print(count_min)
p03387
s751887240
Accepted
a=list(map(int,input().split())) m=max(a) mm=max(a)+1 if m%2 == sum(a)%2: print((3*m-sum(a))//2) else: print((3*mm-sum(a))//2)
p03644
s298705105
Wrong Answer
N = int(input()) m = 0 max_cnt = 0 for i in range(2, N+1, 2): cnt = 0 tmp = i while tmp % 2 == 0: cnt += 1 tmp /= 2 if cnt > max_cnt: max_cnt = cnt m = i print(m)
p03274
s545985057
Accepted
def main(): N, K, *xn = map(int, open(0).read().split()) ans = int(1e9+7) for xl, xr in zip(xn[:], xn[K - 1:]): ans = min(ans, xr - xl + min(abs(xr), abs(xl))) print(ans) return main()
p02723
s187006341
Wrong Answer
S = input() if S[2] == S[3] and S[4] == S[5]: print("Yes") else: print("NO")
p02996
s399917233
Accepted
import sys N = int(input()) job = [] for _ in range(N): job.append(list(map(int,input().split()))) job.sort(key=lambda x:x[1]) b = 0 for i in range(N): if job[i][1]-job[i][0]< 0: print('No') sys.exit() if i < N-1: b += job[i][0] job[i+1][1] -= b print('Yes')
p02786
s066091606
Wrong Answer
import bisect H=int(input()) A=[2**x for x in range(51)] if H%4==0: H+=1 index=bisect.bisect_left(A,H) if H==1: print(0) elif H==2: print(3) else: print(sum(A[:index]))
p02600
s205187764
Accepted
x = int(input()) print(10 - x // 200)
p02778
s229545242
Accepted
a=input() b=len(a) c="x" d=b*c print(d)
p03289
s650366370
Wrong Answer
S = input() T_1 = S[0]=="A" T_2 = S[2:-1].count("C")==1 T_3 = S[2:].replace("C", "").islower() print("AC" if T_1 and T_2 and T_3 else "WA")
p03672
s497359685
Accepted
s = input() n = len(s) if n%2==0: n -= 1 s = s[:-1] while n%2!=0 or s[:n//2]!=s[n//2:]: n -= 1 s = s[:-1] print(n)
p02779
s040412975
Accepted
import numpy as np N = int(input()) A = tuple(map(int, input().split())) A = np.array(A) A = np.sort(A) for i in range(N): if (i > 0 and A[i-1] == A[i]) or (i < N-1 and A[i] == A[i+1]): print('NO') break else: print('YES')
p03449
s516523121
Accepted
n = int(input()) a = [] a.append(list(map(int, input().split()))) a.append(list(map(int, input().split()))) b = [[0] * n, [0] * n] for i in range(n): if i == 0: b[0][i] = a[0][0] b[1][i] = a[0][0] + a[1][0] else: b[0][i] = a[0][i] + b[0][i - 1] b[1][i] = max(b[0][i], b[1][i - 1]) + a[1][i] print(b[1][n - 1])
p03323
s803882513
Accepted
A, B = map(int, input().split()) output = 'Yay!' if A > 8 or B > 8: output = ':(' print(output)
p03997
s922262529
Accepted
a=int(input()) b=int(input()) h=int(input()) print((a+b)*h//2)
p02717
s405333628
Wrong Answer
A, B, C = map(int, input().split()) print(B, ' ', C, ' ', A)
p03639
s114795184
Wrong Answer
from collections import defaultdict def div(n): if n % 4 == 0: return 3 elif n % 2 == 0: return 1 else: return 0 N = int(input()) a = list(map(int, input().split())) result = list(map(div, a)) d = defaultdict(int) d[1] = 0 for i in result: d[i] += 1 if d[1] % 2 == 1: d[1] -= 1 ans = 0 for c, v in d.items(): ans += c * v print("Yes" if ans >= N else "No")
p03785
s399157758
Accepted
n,c,k = [int(x) for x in input().split()] t = [int(input()) for _ in range(n)] t.sort() bus = c f_bus = 0 ans = 0 for i in range(n): if t[i] > f_bus or bus == 0: ans += 1 f_bus = t[i]+k bus = c-1 else: bus -= 1 print(ans)
p03030
s744932038
Accepted
N = int(input()) List = [] for i in range(N): List.append(list(map(str, input().split()))) Names = [] Points = [] for i in range(N): Names.append(List[i][0]) Points.append(int(List[i][1])) slName = set(Names) NewName = list(slName) NewName.sort() Points.sort(reverse = True) for i in range(len(NewName)): for j in range(len(Points)): for k in range(N): if List[k][0] == NewName[i] and int(List[k][1]) == Points[j]: print(k+1) else: pass
p03778
s749856570
Accepted
w, a, b = map(int, input().split()) if a + w < b: print(b - (a + w)) elif b + w < a: print(a - (b + w)) else: print(0)
p02848
s350422531
Accepted
N = int(input()) S = list(input()) chars = map(lambda c: chr((ord(c) - ord('A') + N) % 26 + ord('A')), S) print(''.join(chars))
p02959
s732406726
Accepted
n=int(input()) a=list(map(int, input().split())) b=list(map(int, input().split())) ans = 0 for i in range(n): if a[i] >= b[i]: ans += b[i] else: ans += a[i] if a[i+1] > b[i]-a[i]: ans += b[i]-a[i] a[i+1] -= b[i]-a[i] else: ans += a[i+1] a[i+1] = 0 print(ans)
p02748
s892255194
Accepted
A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) minimum = min(a) + min(b) for _ in range(M): x, y, c = map(int, input().split()) tmp = a[x-1] + b[y-1] - c if tmp < minimum: minimum = tmp print(minimum)
p03637
s092533214
Wrong Answer
n = int(input()) a = list(map(int,input().split())) count2 = 0 count4 = 0 for i in range(n): #2の倍数だが4の倍数でない if a[i]%2 == 0 and a[i]%4 != 0: count2 += 1 #4の倍数 elif a[i]%4 == 0: count4 += 3 #print(count2,count4) #count2が1以下か判定 if count2 > 1: count4 += count2 else: count4 += 0 if count4 >= n: print("Yes") else: print("No")
p02623
s860249892
Accepted
def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) import itertools N,M,K=MI() A=[0]+LI() B=[0]+LI() A=list(itertools.accumulate(A)) B=list(itertools.accumulate(B)) j=M ans=0 for i in range(N+1): if A[i]>K: break while A[i]+B[j]>K: j-=1 ans=max(ans,i+j) print(ans)
p03745
s908807866
Accepted
N=int(input()) *A,=map(int,input().split()) if N<=2: ans=1 else: ans=1 count=(A[0]<A[1])-(A[0]>A[1]) i=2 while i<N: if count*((A[i-1]<A[i])-(A[i-1]>A[i]))<0: ans+=1 count=0 else: if count==0: count=(A[i-1]<A[i])-(A[i-1]>A[i]) i+=1 print(ans)
p02873
s324970217
Wrong Answer
s = input() cnt = 0 ans = 0 tmp = 0 check = 0 for x in s: cnt += 1 if x == '<': tmp += 1 if check != cnt - 1: tmp = 0 ans += tmp check = cnt else: tmp -= 1 ans += tmp if tmp < 0: ans += (cnt - check + 1) tmp += 1 print(ans)
p02583
s777662856
Wrong Answer
n=int(input()) l=sorted(list(map(int,input().split())),reverse=True) count=0 if n<3: print("0") else: 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]+l[k] and l[i]!=l[j]!=l[k]: count+=1 print(count)
p02622
s050386500
Accepted
import sys def input(): return sys.stdin.readline().rstrip() def main(): s = input() t = input() cunt=0 for i, ss in enumerate(s): if ss != t[i]: cunt+=1 print(cunt) if __name__=='__main__': main()
p02958
s915680364
Wrong Answer
n = int(input()) a = [int(i) for i in input().split()] t = 0 for i in range(n): q = 0 for j in range(i): q += a[i] < a[j] t += q>0 v = 0 for i in range(n): q = 0 for j in range(i+1, n): q += a[i] > a[j] v += q>0 print("YES" if min(t, v) < 2 else "NO")
p03803
s890010716
Wrong Answer
a, b = map(int, input().split()) if a > b: print('Alice') elif a < b: print('Bob') else: print('Draw')
p02633
s283084637
Accepted
import math x = int(input()) y = math.gcd(x, 360) print(int(360/y))
p03038
s511438600
Wrong Answer
import bisect N,M = map(int,input().split()) A = list(map(int,input().split())) A.sort() for i in range(M): B,C = map(int,input().split()) D = bisect.bisect_left(A,C) if D <= B: for j in range(D): A[j] = C else: for j in range(B): A[j] = C print(sum(A))
p03545
s663852163
Accepted
A = input() a, b, c, d = A[0], A[1], A[2], A[3] op = '+-' for i in op: for j in op: for k in op: s = a + i + b + j + c + k + d if eval(s) == 7: print(s+'=7') exit()
p02842
s038308692
Wrong Answer
n = int(input()) x = n // 1.08 if x * 1.08 == n: print(x) else: print(':(')
p03557
s124631036
Accepted
import bisect N=int(input()) ue=list(map(int,input().split())) naka=list(map(int,input().split())) sita=list(map(int,input().split())) sita.sort(),naka.sort(),ue.sort() count2=[0]*N count1=[0]*N for i in range(N): m = naka[i] k=naka[i] small=bisect.bisect_left(ue,k) count1[i]=small big = bisect.bisect_right(sita, m) count2[i]=N-big ans=0 for i in range(N): ans+=count1[i]*count2[i] print(ans)
p02690
s809730549
Wrong Answer
import sys X = int(input()) for i in range(-100, 100): for j in range(-100, 100): cand = i ** 5 - j ** 5 if X == cand: print(i, j) sys.exit()
p02719
s831030007
Accepted
n, k = map(int, input().split()) m = n % k ans = min(m, abs(m - k)) print(ans)
p02832
s475747954
Wrong Answer
N = int(input()) a_list = list(map(str, input().split())) ans_index = [] before_index = -1 for i in range(len(a_list)): a_list[i] = int(a_list[i]) for i in range(len(a_list)): val_list = a_list[before_index+1:] if val_list.count(i+1) >= 1: val = val_list.index(i+1) + before_index before_index = val ans_index.append(val+1) else: break result = N - len(ans_index) print(result)
p02603
s410009666
Accepted
n = int(input()) A = list(map(int, input().split())) stock = 0 mon = 1000 stock = int(mon / A[0]) mon = mon % A[0] for i in range(0, n-1): if A[i] < A[i+1]: stock += mon // A[i] mon = mon % A[i] else: mon += stock * A[i] stock = 0 if stock > 0: mon += stock * A[n-1] print(int(mon))
p02784
s071300420
Wrong Answer
H, N = map(int, input().split()) A = list(map(int, input().split())) print("Yes" if H <= sum(A) else "NO")
p02861
s323076279
Accepted
import itertools as it import math N = int(input()) xy = [list(map(int, input().split())) for _ in range(N)] path = 0 p = it.permutations(xy) for r in p: for i in range(N - 1): path += math.sqrt((r[i][0] - r[i + 1][0])**2 + (r[i][1] - r[i + 1][1])**2) res = path / math.factorial(N) print(res)
p02802
s353833614
Wrong Answer
from operator import itemgetter n, m = map(int, input().split()) X = [] ac = [0] * (n+1) wa = [0] * (n+1) for _ in range(m): x, y = input().split() X += [(int(x), y)] # X = sorted(X, key=itemgetter(0)) for (x, y) in X: if ac[x] == 0: if y == 'AC': ac[x] = 1 if y == 'WA': wa[x] += 1 print(x, y, sum(ac), sum(wa)) print(sum(ac), sum(wa))
p02723
s351088627
Wrong Answer
s=input();print("YNeos"[s[2::3]<s[3:5]::2])
p02718
s707575219
Wrong Answer
num = [] vote = [] num = list(map(int,input().split())) vote = list(map(int,input().split())) N = num[0] M = num[1] j = int(sum(vote)/(4*M)) #print(j) cnt = 0 for i in vote: if i>=j: cnt += 1 if M<=cnt: print("Yes") else: print("No")
p03438
s507846414
Wrong Answer
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = [] a_sum = 0 b_sum = 0 for i in range(n): c.append(b[i]-a[i]) if c[i] < 0: b_sum += c[i] else: a_sum += c[i] if a_sum <= abs(b_sum*2): print("No") else: print("Yes")
p02641
s303714829
Accepted
X,N = map(int,input().split()) p = sorted(list(map(int,input().split()))) for i in range(X,-1,-1): if i not in p: ans = i break for i in range(X+1,102): if i not in p: ans2 = i break if X-ans > ans2-X: print(ans2) else: print(ans)
p03556
s407498422
Accepted
import math print(int(math.sqrt(int(input())))**2)
p02697
s632470501
Accepted
#!python3 # input N, M = list(map(int, input().split())) # odd def solve1(): return [(i + 2, N - i) for i in range(M)] # even def solve2(): t = (N - 2) // 4 l = [(i + 2, N - i) for i in range(t)] n = (N - 2) // 2 - t l = l + [(N // 2 + 1 + i, N // 2 - i) for i in range(n)] return l[:M] def main(): l = solve1() if N % 2 else solve2() for ans in l: print(*ans) if __name__ == "__main__": main()
p03038
s706542435
Wrong Answer
import bisect n,m = map(int,input().split()) A = list(map(int,input().split())) for _ in range(m): #A.sort() b,c = map(int,input().split()) index = bisect.bisect_right(A,c) if index == 0: pass elif b >= index: for i in range(0,index): A[i] = c else: for i in range(b): A[i] = c print(sum(A))
p03705
s781912964
Accepted
import sys N, A, B = map(int, input().split()) if A > B: print(0) sys.exit() if N == 1: if A != B: print(0) sys.exit() else: print(1) sys.exit() else: mn = A*(N-1) + B mx = A + B*(N-1) ans =mx -mn + 1 print(ans)
p02622
s814007806
Accepted
try: s=input() p=input() count=0 for i in range(len(s)): if s[i]!=p[i]: count+=1 print(count) except: pass
p03657
s769151574
Accepted
a,b=map(int,input().split()) if (a+b)*a*b%3: print("Impossible") else: print("Possible")
p02743
s701853581
Accepted
a,b,c = map(int, input().split()) if c-a-b <= 0: print("No") else: if 4*a*b < (c-a-b)**2: print("Yes") else: print("No")
p03632
s332091051
Wrong Answer
a,b,c,d=map(int,input().split()) print(min(b,d)-max(a,c))
p03323
s065713606
Wrong Answer
d,n = map(int,input().split()) if n != 100: print(100**d*n) else: print(100**d*(n+1))
p02630
s702951770
Accepted
n = int(input()) aa = list(map(int, input().split())) total = sum(aa) q = int(input()) from collections import Counter dic = Counter(aa) for i in range(q): b, c = map(int, input().split()) nb = dic.pop(b,0) total += nb * (c-b) print(total) dic[c] = dic.get(c,0) + nb
p02972
s018475665
Accepted
N = int(input()) alist = list(map(int, input().split())) box = [0] * (N + 1) for i in range(N, 0, -1): cnt = 0 for j in range(i*2, N+1, i): cnt += box[j] if cnt%2 != alist[i-1]: box[i] = 1 M = sum(box) ans = [] for i in range(1, N+1): if box[i]: ans.append("{}".format(i)) print(M) print(" ".join(ans))
p03351
s119651004
Accepted
a,b,c,d = map(int, input().split()) if abs(c - a) <= d or abs(c - b) <= d and abs(b - a) <= d: print("Yes") else: print("No")
p02899
s376559512
Wrong Answer
import sys import numpy as np import numba from numba import jit read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @jit def main(n, a): ans = [None]*n for i, j in enumerate(a): ans[j-1] = i+1 for i in a: print(i, end=' ') n, *a = map(int,read().split()) main(n, a)
p03252
s726715772
Accepted
s = input() t = input() n = len(s) a = [0 for i in range(26)] b = [0 for i in range(26)] for i in range(n): a[ord(s[i])-ord("a")] += 1 b[ord(t[i])-ord("a")] += 1 a.sort() b.sort() if a == b: print("Yes") else: print("No")
p03309
s950026169
Wrong Answer
import math n = int(input()) x = list(map(int,input().split())) ans = 0 for i in range(n): x[i]-=i+1 ave=math.floor(sum(x)/len(x)) for i in range(n): ans+=abs(x[i]-ave) print(ans)
p02600
s143899384
Accepted
x=int(input()) x= x// 200 print(10-x)
p02971
s576304363
Accepted
n = int(input()) a = [int(input())for i in range(n)] b = sorted(a) for i in range(n): if a[i] == b[-1]: print(b[-2]) else: print(b[-1])
p03862
s024838319
Accepted
n, x = map(int, input().split()) A = list(map(int, input().split())) ans = 0 for i in range(n): if i == 0: if A[i] <= x: continue eat = A[i] - x ans += eat A[i] = A[i] - eat continue if A[i-1]+A[i] <= x: continue eat = A[i-1] + A[i] - x ans += eat A[i] = A[i] - eat print(ans)
p02553
s720797658
Wrong Answer
a,b,c,d=map(int,input().split()) x,y=0,0 if a>b: x=a else: x=b if c>d: y=c else: y=d print(x*y)
p02783
s226782489
Accepted
import math H, A = map(int, input().split(' ')) print(math.ceil(H/A))
p02983
s597176059
Accepted
def main(): l,r=map(int,input().split()) ans=10**9 if any([r//2019>l//2019,r==0,l==0]): ans=0 print(ans) else: l%=2019 r%=2019 for i in range(l,r): for j in range(i+1,r+1): ans=min(ans,i*j%2019) print(ans) main()