problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02755
s165453280
Accepted
a, b = input().split(); a = int(a); b = int(b); for x in range(1,1001): tax_8 = int(x * 0.08); tax_10= int(x * 0.1); if tax_8 == a and tax_10 == b: ans = x; break; elif x == 100: ans = -1; else: pass; print(ans);
p03711
s952530966
Wrong Answer
x,y=map(int,input().split()) a=[1,3,5,7,8,10,12] b=[4,6,9,11] c=[2] for i in a: if x==i: x='a' if y==i: y='a' for i in b: if x==i: x='b' if y==i: y='b' for i in c: if x==i: x='c' if y==i: y='c' if x==y: print('yes') else: print('No')
p02695
s260838010
Accepted
from collections import deque def calc(seq): score = 0 for a, b, c, d in req: if seq[b - 1] - seq[a - 1] == c: score += d return score n, m, q = map(int, input().split()) req = [list(map(int, input().split())) for _ in range(q)] ans = 0 que = deque() for i in range(1, m + 1): que.append([i]) while que: seq = que.popleft() if len(seq) == n: score = calc(seq) ans = max(ans, score) else: for i in range(seq[-1], m + 1): seq_next = seq + [i] que.append(seq_next) print(ans)
p03281
s477937393
Accepted
import itertools N = int(input()) S = [3,5,7,11,13] if N >= 189: ans = 2 elif N>= 135: ans = 1 else: ans = 0 A = list(itertools.combinations(S,3)) #print(A) for x in A: a,b,c = x if a*b*c <= N: ans += 1 print(ans)
p03944
s461038724
Accepted
W, H, N = map(int, input().split()) minX = 0 maxX = W minY = 0 maxY = H for i in range(N): x, y, a = map(int, input().split()) if a == 1: minX = max(minX, x) elif a == 2: maxX =min(maxX, x) elif a == 3: minY = max(minY, y) elif a == 4: maxY = min(maxY, y) print(max(0, maxX-minX)*max(0, maxY-minY))
p02922
s776621955
Accepted
a,b = map(int,input().split()) ans = 0 if b == 1: print(0) exit(0) while b > 0: b-=a ans+=1 if b<=0:break b+=1 print(ans)
p02731
s042975509
Wrong Answer
L=int(input()) print(L/27)
p03625
s937527455
Accepted
from collections import Counter N = input() A = list(map(int, input().split())) C = Counter(A) M = [0, 0] for k, v in C.items(): if v < 2: continue M.append(k) if v >= 4: M.append(k) M.sort(reverse=True) M = M[:2] print(M[0]*M[1])
p02695
s649114495
Wrong Answer
import itertools abcd = [] N,M,Q = map(int,input().split()) for i in range(Q): a,b,c,d = map(int,input().split()) abcd.append([a,b,c,d]) A = (list(itertools.product(list(range(1,M+1)),repeat=N))) ans = 0 for i in A: _sum = 0 for j in abcd: if i[j[1]-1] - i[j[0]-1] == j[2]: _sum += j[3] if ans < _sum: ans = _sum print(ans)
p03624
s542072802
Accepted
import numpy as np import sys input = sys.stdin.readline S = input() S = sorted(list(set(S[:-1]))) alpha = ['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'] j = 0 for i in range(len(alpha)): if S[j]== alpha[i] : if len(S)-1 != j:j+=1 else: print(alpha[i]) exit() print("None")
p02818
s833497928
Accepted
A, B, K = map(int, input().split()) if K > A + B: print(0, 0) elif K <= A: print(A - K, B) elif K - A <= B: print(0, B - (K - A))
p03150
s223650177
Accepted
S = input() flg = False for i in range(len(S)): for j in range(len(S)-i): if S[:j]+S[j+i:] == 'keyence': flg = True break if flg: break if flg: print('YES') else: print('NO')
p03163
s936585354
Accepted
# D N, W = map(int, input().split()) import numpy as np dp = np.zeros(W+1, dtype="int64") for i in range(1, N+1): w, v = map(int, input().split()) dp[w:] = np.maximum(dp[w:], dp[0:W-w+1] + v) print(dp[-1])
p03456
s872956000
Accepted
a,b=input().split() n=int(a+b) flag=False i=1 while i**2<=n: if i**2==n: flag=True break i+=1 print("Yes" if flag else "No")
p02811
s425769748
Wrong Answer
k,x=map(int,input().split()) if k*500>=x: print('yes') else: print('no')
p02613
s739363025
Accepted
N = int(input()) ac, wa, tle, re = 0, 0, 0, 0 for i in range(N): result = input() if result == 'AC': ac += 1 elif result == 'WA': wa += 1 elif result == 'TLE': tle += 1 else: re += 1 print('AC x %d\nWA x %d\nTLE x %d\nRE x %d' % (ac, wa, tle, re))
p03062
s646057884
Accepted
n=int(input()) A=list(map(int,input().split())) ans,cnt,mini=[],0,float('inf') for a in A: if abs(a)!=a: cnt+=1 ans.append(abs(a)) mini=min(mini,abs(a)) if cnt%2==0: print(sum(ans)) else: print(sum(ans)-(mini*2))
p03210
s654371803
Accepted
x=int(input()) if x in [3,5,7]: print("YES") else: print("NO")
p02618
s765363114
Accepted
# -*- coding: utf-8 -*- import numpy as np import sys from collections import deque from collections import defaultdict import heapq import collections import itertools import bisect def zz(): return list(map(int, sys.stdin.readline().split())) def z(): return int(sys.stdin.readline()) def S(): return sys.stdin.readline() def C(line): return [sys.stdin.readline() for _ in range(line)] D = z() C = zz() S = defaultdict(list) for i in range(D): S[i + 1] = zz() for i in range(D): print(i % 26 + 1)
p02775
s922449044
Accepted
s = input() n = len(s) dp = [ [0,0] for i in range(n) ] dp[0][0] = int(s[0]) dp[0][1] = 11-int(s[0]) for i in range(n-1): d = int(s[i+1]) dp[i+1][0] = min(dp[i][0]+d, dp[i][1]+d) dp[i+1][1] = min(dp[i][0]+11-d, dp[i][1]+9-d) print(min(dp[n-1][0],dp[n-1][1]))
p02743
s570832812
Wrong Answer
from sys import stdin a,b,c = [int(x) for x in stdin.readline().rstrip().split()] A = 0 B = 0 C = 0 for i in range(1,10**5): if i**2 >= a: A = i break for i in range(1,10**5): if i**2 >= b: B = i break for i in range(1,10**5): if i**2 >= c: C = i break print(A,B,C) if A + B <= C: print("Yes") else: print("No")
p02760
s077260402
Accepted
import numpy as np A = [list(map(int, input().split())) for _ in range(3)] N = int(input()) B = [] for j in range(N): b = int(input()) B.append(b) A = np.array(A) B = np.array(B) boolean_matrix = np.isin(A, B) if boolean_matrix.sum(axis=1).max() >= 3 or \ boolean_matrix.sum(axis=0).max() >= 3 or \ np.diag(boolean_matrix).sum() >= 3 or \ np.diag(np.fliplr(boolean_matrix)).sum() >= 3: print('Yes') else: print('No')
p02748
s890409728
Wrong Answer
s = input() s_len = len(s) if s_len % 2: print("No") else: prev = 0 count = 0 for i in range(1, (s_len//2)+1): if s[prev:i*2] != "hi": print("No") break else: count += 1 prev = i * 2 if count == s_len // 2: print("Yes")
p03633
s258858529
Accepted
import fractions N = int(input()) T = [] def lcm(x, y): return (x * y) // fractions.gcd(x, y) for i in range(N): t = int(input()) T.append(t) M = T[0] for i in range(1, N): M = lcm(M, T[i]) print(M)
p02615
s645436938
Wrong Answer
n = int(input()) a = input().split() a.sort() c = int(a[-1]) if n%2 == 0: n1 = n//2 - 1 for i in range(n1): a1 = int(a[n-2-i]) c += a1*2 else: n2 = n//2 a3 = int(a[n-n2]) c += a3 for i in range(n2-1): a2 = int(a[n-2-i]) c += a2*2 print(c)
p02916
s544169849
Wrong Answer
n = int(input()) a = list(map(int, input().split())) b = sum(list(map(int, input().split()))) c = list(map(int, input().split())) for i in range(n-1): if a[i+1] == a[i] + 1: b += c[i] print(b)
p02756
s360195388
Wrong Answer
S = input() L = list(S) Q = int(input()) for i in range(Q): a = list(map(str, input().split())) if a[0] == '1': if not len(L) == 1: L.reverse() else: if a[1] == '1': L.append(a[2]) else: L.insert(0, a[2]) L.reverse() A = "".join(L) print(A)
p02784
s280377845
Accepted
h, n = map(int, input().split()) a = list(map(int, input().split())) if (h - sum(a)) <= 0: print('Yes') else: print('No')
p02699
s895375264
Accepted
def main(): S, W = map(int, input().split()) if W >= S: print('unsafe') else: print('safe') if __name__ == '__main__': main()
p03239
s276597473
Accepted
n, t = map(int, input().split()) r = [list(map(int, input().split())) for _ in range(n)] sorted_by_cost = sorted(r, key=lambda x: x[0]) for i in range(n): if sorted_by_cost[i][1] <= t: print(sorted_by_cost[i][0]) exit() print('TLE')
p03474
s392655837
Wrong Answer
a, b = map(int, input().split()) s = input() s_a = s[0:a] s_b = s[(a+2):(a+2)+b] minus = s[a] if minus == "-" and s_a.isdecimal() and s_b.isdecimal(): print("Yes") else: print("No")
p02958
s229678703
Accepted
n=int(input()) p=[int(_) for _ in input().split()] p_sort=sorted(p) count=0 for i in range(n): if p[i]!=p_sort[i]: count+=1 if count==0 or count==2:print("YES") else:print("NO")
p03289
s778373794
Wrong Answer
S = input() s = list(S) j= 0 count = 0 if not s[0] == 'A': print('WA') exit() for i in s[2:-1]: if i == 'C': count += 1 tmp = j j += 1 if not count == 1: print('WA') exit() del s[0] del s[tmp-1] if S.isupper(): print('WA') exit() print('AC')
p03416
s573365891
Accepted
a, b = list(map(int, input().split())) cnt = 0 for i in range(a, b+1): if str(i) == str(i)[::-1]: cnt+=1 print(cnt)
p03433
s894133323
Accepted
# vim: fileencoding=utf-8 def main(): N = int(input()) A = int(input()) x = N % 500 if A >= x: print("Yes") else: print("No") if __name__ == "__main__": main()
p03011
s046275095
Accepted
a,b,c=map(int,input().split()) print(min(a+b,b+c,c+a))
p03565
s184001490
Wrong Answer
import re Sp = input().replace('?','.') T = input() flag = 0 for i in range(len(Sp)-len(T)+1): if re.match(Sp[i:i+len(T)],T): if i != len(Sp)-len(T): Sp = Sp[:i]+T+Sp[i+len(T)+1:] else: Sp = Sp[:i]+T+Sp[i+len(T)+1:] flag = 1 break if flag == 1: print(Sp.replace('.','a')) else: print('UNRESTORABLE')
p02676
s006785091
Accepted
import math import collections K = int(input()) S = input() L = list(S) if len(L) <= K: print(S) else: M = L[:K] print(''.join(M)+'...')
p03076
s317720924
Wrong Answer
def comTime(x): return (x//10)*10 + 10 def solve(_l): s = 0 l =sorted(_l, key=lambda x: x % 10) s += sum(map(comTime,l[1:])) + l[0] return s _l = [int(input()) for _ in range(5)] print(solve(_l))
p02766
s399151179
Wrong Answer
N, K = [int(x) for x in input().split(" ")] i=1 x=K while x < N: x *= K i += 1 print(i)
p03617
s983957958
Accepted
# coding: utf-8 # Your code here! Q,H,S,D=map(int,input().split()) N=int(input()) n=N//2*2 ans=min(Q*4*n,H*2*n,S*n,D*n//2) if N%2==1: ans+=min(Q*4,H*2,S) print(ans)
p03211
s868264807
Wrong Answer
s=input() ans=10**10 for i in range(len(s)): try: ans=min(ans,abs(int(s[i:i+2])-753)) except:pass try: ans=min(ans,abs(int(s[i:i+3])-753)) except:pass try: ans=min(ans,abs(int(s[i:i+4])-753)) except:pass print(ans)
p02879
s888575592
Accepted
A,B = map(int,input().split()) if 0<A<10 and 0<B<10: print(A*B) else: print(-1)
p03475
s774750894
Accepted
N = int(input()) li = [list(map(int, input().split())) for i in range(N - 1)] for n in range(N): if n == N - 1: print(0) break ans = 0 for index, i in enumerate(li): if index < n: continue if ans < i[1]: ans = i[1] else: if (ans - i[1]) % i[2] != 0: ans += i[2] - (ans % i[2]) ans += i[0] print(ans)
p02814
s693544103
Accepted
import fractions import math from functools import reduce def lcm_base(x, y): return (x * y) // fractions.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) n,m=map(int,input().split()) a=list(map(int,input().split())) b=lcm_list(map(lambda x: x//2, a)) swt=0 for i in range(n): if 0==(b//(a[i]//2))%2: swt=1 break if 0==swt: print(math.ceil((m//b)/2)) else: print(0)
p03264
s994160180
Wrong Answer
n = int(input()) print((n // 2) * (n % 2))
p02909
s045122171
Accepted
S=input() weather=['Sunny','Cloudy','Rainy','Sunny'] print(weather[weather.index(S)+1])
p02854
s281652886
Accepted
n=int(input()) L=list(map(int,input().split())) sumL=[0 for _ in range(n)] S=sum(L) for i in range(n): if i==0: sumL[i]=L[i] else: sumL[i]=sumL[i-1]+L[i] ans=2020202020 tmp1=0 tmp2=0 for i in range(n): tmp1=sumL[i] tmp2=S-sumL[i] ans=min(ans,abs(tmp1-tmp2)) print(ans)
p03565
s452388454
Accepted
S = input() T = input() def canMake(left): for s, t in zip(S[left:], T): if s == '?': continue if s != t: return False return True ans = [] for left in range(len(S) - len(T) + 1): if canMake(left): Z = S[: left] + T + S[left + len(T):] ans.append(Z.replace('?', 'a')) if len(ans) == 0: ans.append('UNRESTORABLE') ans.sort() print(ans[0])
p03105
s100349224
Accepted
A, B, C = map(int, input().split()) print(min(B // A, C))
p03071
s396475832
Accepted
a,b=map(int,input().split()) if abs(a-b)<=1: print(a+b) else: print(max(a,b)*2-1)
p03221
s235623642
Accepted
N,M=map(int,input().split()) A=[] for i in range(M): P,Y=map(int,input().split()) A.append([P,Y,i]) ans=[""]*M A=sorted(A, key=lambda x: x[1]) A=sorted(A,key=lambda x:x[0]) now=A[0][0] cnt=1 for i in range(M): pref=str(A[i][0]) if A[i][0]!=now: cnt=1 year=str(cnt) now=A[i][0] cnt+=1 ans[A[i][2]]=pref.zfill(6)+year.zfill(6) for i in range(M): print(ans[i])
p03548
s259788383
Accepted
if __name__ == '__main__': a = [int(i) for i in input().split()] a[0]-=a[2]*2 print((a[0]+a[2])//(a[1]+a[2]))
p02742
s861818797
Wrong Answer
b, c = map(int, input().split()) a = b*c if a%2 == 0: print(int(a/2)) else: print(int((a + 1)/2))
p02982
s431159874
Accepted
N, D = map(int, input().split()) A = [] for i in range(N): x = list(map(int, input().split())) A.append(x) def check(x, y): s = 0 for a, b in zip(x, y): s += (a - b) ** 2 for i in range(0, s+1): if i * i == s: return 1 return 0 ans = 0 for i in range(N): for j in range(i+1, N): ans += check(A[i], A[j]) print(ans)
p03544
s209119283
Accepted
n=int(input()) l=[2,1] if n>1: for i in range(2,n+1): li=l[i-1]+l[i-2] l.append(li) print(l[n]) else: print(l[n])
p02818
s311531550
Accepted
a, b, k = map(int, input().split()) if k < a: print(str(a - k) + " " + str(b)) elif a <= k and k < a + b: print(str(0) + " " + str(b - k + a)) elif k >= a + b: print(str(0) + " " + str(0))
p02779
s067922789
Accepted
N = input() A = input().split() _A = set(A) if len(A) == len(_A): print('YES') else: print('NO')
p03095
s615911944
Wrong Answer
from collections import Counter n = int(input()) s = input() mod = 10**9 + 7 S = Counter(s) a = 1 for v in S.values(): a *= (1+v) % mod print(a-1)
p02552
s319145369
Accepted
x=int(input()) if x==0: print(1) else: print(0)
p02843
s824695339
Accepted
# -*- coding: utf-8 -*- x = int(input()) l = [0]*(x+1) l[0] = 1 for i in range(1,x+1): for j in range(100,106): if i-j>=0: l[i] += l[i-j] if l[x]>0: print(1) else: print(0)
p03943
s336960755
Accepted
a,b,c=map(int,input().split()) print('Yes' if a+b==c or b+c==a or c+a==b else 'No')
p02946
s969408572
Accepted
k, x = map(int,input().split()) lst = [x] if k>1: for i in range(k-1): lst.append(x-i-1) for i in range(k-1): lst.append(x+i+1) lst.sort() ans = '' for i in range(len(lst)): num = lst[i] ans += str(num) ans += ' ' print(ans)
p03319
s353393180
Accepted
# -*- coding: utf-8 -*- n, k = map(int,input().split()) a = [int(i) for i in input().split()] ans = ((n - 1) + (k - 1) - 1) // (k - 1) print(ans)
p04045
s036848601
Accepted
N,K=map(int,input().split()) D=list(input().split()) while True: A=str(N) count = 0 for i in range(len(A)): if A[i] in D: N+=1 break else: count +=1 if count == len(A): print(N) exit()
p03910
s445405270
Accepted
N = int(input()) Ans = [] s = 0 for i in range(1, N+1): Ans.append(i) s += i if s >= N: break if s != N: Ans.remove(s-N) for a in Ans: print(a)
p03438
s266465927
Accepted
N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) assign_plus = 0 minus = 0 for i in range(N): assign_plus += max(0, (b[i]-a[i])//2) minus += max(0, a[i]-b[i]) if assign_plus >= minus: print("Yes") else: print("No")
p03720
s565679124
Accepted
n,m=map(int,input().split()) ans=[0]*n for _ in range(m): a,b=map(int,input().split()) ans[a-1]+=1 ans[b-1]+=1 for i in ans: print(i)
p03555
s546225133
Accepted
a=input() b=input() print("YES" if a==b[::-1] and b==a[::-1] else "NO")
p02595
s265452926
Accepted
n,d=map(int,input().split()) ans=0 for i in range(n): x,y=map(int,input().split()) if x**2+y**2<=d**2: ans+=1 print(ans)
p02823
s454164881
Accepted
N,A,B = map(int,input().split()) if (B-A)%2==0: print((B-A)//2) else: print(min(A,N-B+1)+(B-A-1)//2)
p04031
s026980596
Accepted
N = int(input()) A = list(map(int, input().split())) ans = float("inf") for i in range(min(A), max(A)+1): x = 0 for j in range(N): x += (i-A[j])**2 ans = min(ans, x) print(ans)
p03760
s812692557
Accepted
O = list(input()) E = list(input()) + [''] print(*[O+E for O,E in zip(O,E)], sep='')
p03109
s819997907
Wrong Answer
s = str(input()) S = s.split('/') if int(S[0]) > 2019: print('TBD') elif int(S[0]) == 2019: if int(S[1]) > 4: print('TBD') elif int(S[1]) == 4: if int(S[2]) <= 30: print('Heisei') else: print('Heisei')
p02882
s116867401
Accepted
a,b,x=map(int, input().split()) import math if 0.5*a**2*b<=x: print(math.degrees(math.atan((2*a**2*b-2*x)/a**3))) else: print(math.degrees(math.atan((a*b**2)/(x*2))))
p02797
s977540303
Accepted
N,K,S=map(int,input().split()) ans=[S]*K if len(ans)<N: nk=N-K if S==1000000000: aps=S-1 else: aps=S+1 for i in range(nk): ans.append(aps) print(' '.join(map(str,ans)))
p03076
s459354845
Accepted
ans = 0 l = [int(input()) for _ in range(5)] m = [10 - (p % 10) for p in l if p % 10 != 0] print(sum(l) + sum(sorted(m)[:-1]))
p02819
s793428730
Wrong Answer
x = int(input()) pr = [2] for i in range(3,10**5,2): fr = 0 for j in pr: if i % j == 0: fr += 1 break if fr == 0: if i >= x: print(i) break pr.append(i)
p02795
s396237246
Accepted
H = int(input()) W = int(input()) N = int(input()) if N % max(H,W) == 0: print(N//max(H,W)) else: print((N//max(H,W)+1))
p02744
s551111935
Wrong Answer
n=int(input()) def go(s): global n if len(s)==n: print(s) return last=s[-1] for i in range(ord('a'),ord(last)+1): go(s+chr(i)) if last < 'z': go(s + chr(ord(last) + 1)) go("a")
p02813
s202915546
Wrong Answer
import itertools n = int(input()) p = map(int, input().split()) q = map(int, input().split()) d = dict() for i, v in enumerate(itertools.permutations([x for x in range(1, n+1, 1)]), 1): d[str(v)] = i print(d[str(tuple(p))] - d[str(tuple(q))])
p02570
s770850081
Accepted
d,t,s=map(int,input().split()) if t*s>=d: print("Yes") else: print("No")
p03659
s584896004
Wrong Answer
n = int(input()) a_list = list(map(int, input().split())) total = sum(a_list) x_list = [0 for i in range(n-1)] for i in range(1, n): x_list[i-1] = sum(a_list[0:i]) print(x_list) y_list = [0 for i in range(n-1)] for i, x in enumerate(x_list): y_list[i] = abs(total - x*2) print(min(y_list))
p02796
s088879212
Wrong Answer
from operator import itemgetter n = int(input()) xl = [] for i in range(n): x, l = map(int, input().split()) xl.append([x - l, x, x + l]) xl = sorted(xl, key=itemgetter(0)) ans = 0 m = -float("inf") for left, x, right in xl: if left < m: ans += 1 else: m = max(m, right) print(n - ans)
p02641
s315344241
Wrong Answer
X, N = map(int, input().split()) p_list = [str(e) for e in input().split()] for i in range(N + 1): x = X - i y = X + i if str(x) in p_list == 0: print(x) break elif str(y) in p_list == 0: print(y) break
p02659
s685976416
Wrong Answer
import sys, math def main(): s = list(input().split()) a = int(s[0]) b = list(s[1]) for i in range(len(b)): if b[i] == '.': b[i] = '' b = int(''.join(b)) print(math.floor(a*b/100)) if __name__ == "__main__": main()
p02582
s503013606
Accepted
s = input() if s.count("R") in [0,1,3]: print( s.count("R") ) else: if s == "RSR": print(1) else: print(2)
p02743
s848821676
Accepted
import math a, b ,c = map(int, input().split()) if 4*a*b < (c-a-b)**2 and (c-a-b) >0: print('Yes') else: print('No')
p02995
s950316330
Wrong Answer
a,b,c,d = map(int,input().split()) bc = b//c bd = b//d import math bcd = c*d//math.gcd(c,d) ac = (a-1)//c ad = (a-1)//d acd = c*d//math.gcd(c,d) ans = (b-(bc+bd-bcd))-((a-1)-(ac+ad-acd)) print(ans)
p02640
s257242738
Accepted
x, y = map(int, input().split()) res = 'No' for i in range(x+1): k = x-i if(i*2 + k*4) == y: res = 'Yes' print(res)
p03136
s257066973
Wrong Answer
n=int(input()) line=list(map(int,input().split())) border=sum(line)/2 flag=True for i in line: if i >= border: flag=False break if flag: print('yes') else: print('No')
p03625
s585784510
Wrong Answer
import collections N = int(input()) A = list(map(int,input().split())) c = collections.Counter(A) ans = [i[0] for i in c.items() if i[1] >= 2] ans.extend([0,0]) ans.sort(reverse=True) print(ans[0]*ans[1])
p03645
s100182456
Wrong Answer
import numpy as np n,m = map(int, input().split()) from_start = np.array([]) to_end = np.array([]) for _ in range(m): temp = [] temp = list(map(int, input().split())) if temp[0]==1: from_start = np.append(from_start, temp[1]) elif temp[1]==n: to_end = np.append(to_end, temp[0]) if from_start in to_end: print('POSSIBLE') break else: print('IMPOSSIBLE') print(from_start) print(to_end) print(from_start in to_end)
p02797
s801394185
Accepted
N,K,S = map(int,input().split()) if S != 10**9: ans = [S]*K+[S+1]*(N-K) else: ans = [S]*K+[1]*(N-K) print(*ans)
p02661
s525204928
Accepted
n=int(input()) l1=[] l2=[] for i in range(n): a,b=map(int,input().split()) l1.append(a) l2.append(b) l1.sort() l2.sort() if n%2==0: low=l1[n//2]+l1[n//2-1] high=l2[n//2]+l2[n//2-1] print(high-low+1) else: low=l1[n//2] high=l2[n//2] print(high-low+1)
p03221
s567808082
Wrong Answer
n,m = map(int,input().split()) py = sorted([list(map(int,input().split()))+[i] for i in range(m)]) cnt = 1 ans_list = [['0'*(6 - len(str(m)))+str(py[0][0])+'000001',py[0][2]]] for i in range(1,m): ans = '0'*(6 - len(str(py[i][0]))) ans += str(py[i][0]) if py[i-1][0] == py[i][0]: cnt += 1 else: cnt = 1 ans += '0'*(6 - len(str(cnt))) ans += str(cnt) ans_list.append([ans,py[i][2]]) ans_list = sorted(ans_list,key=lambda x:x[1]) for i in ans_list: print(i[0])
p03434
s468859289
Wrong Answer
n = int(input()) a = list(map(int,input().split())) ans1 = 0 ans2 = 0 for i in range(n): if i % 2 == 1: ans1 += a[i] else: ans2 += a[i] print(max(ans1,ans2))
p03219
s434719684
Accepted
a,b=map(int,input().split()) print(int(a+b/2))
p03012
s744665000
Accepted
n = int(input()) w = list(map(int, input().split())) sum_w = sum(w) ans = 100000 t = 0 for i in range(n): t += w[i] ans = min(ans, abs(sum_w - 2*t)) print(ans)
p02779
s973906093
Accepted
n = int(input()) a = list(map(str, input().split())) if(len(set(a)) != n): print("NO") else: print("YES")