problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02607
s227584000
Accepted
n = int(input()) listA = list(map(int, input().split())) count = 0 for i in range(len(listA)): if (i+1)%2 == 1 and listA[i]%2 == 1: count+=1 print(count)
p02847
s534893947
Accepted
print(7 - {w:i for w, i in zip(('SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'), range(7))}[input()])
p03639
s621068885
Wrong Answer
import numpy as np n = int(input()) a = np.array(list(map(int, input().split()))) a4 = len(a[a % 4 == 0]) a2n = len(a[a % 2 != 0]) a2 = len(a[a % 2 == 0]) print("Yes" if a4 + 1 + a2 // 2 >= a2n+1 else "No")
p03545
s925371242
Accepted
s = input() n = len(s) a = [i for i in s] for i in range(2**(n-1)): b = [] for j in range(n): b.append(a[j]) if j > 2: break if (i >> j) & 1: b.append("+") else: b.append("-") if eval("".join(b)) == 7: b.append("=7") print("".join(b)) exit()
p03475
s622782516
Wrong Answer
N = int(input()) A = [0 for _ in range(N)] for i in range(N-1): c, s, f = map(int, input().split()) for j in range(i+1): if A[j] < s: A[j] = s + c else: d = - (s - A[j]) // f A[j] = s + f * d + c for i in range(N): print(A[i])
p03657
s102836927
Wrong Answer
l=list(map(int,input().split())) if(sum(l)%3==0): print('Possible') else: print('Impossible')
p02777
s934157768
Accepted
import sys from pprint import pprint def solve(s, t, a, b, u): if u == s: a -= 1 if u == t: b -= 1 print(a, b) if __name__ == '__main__': s, t = sys.stdin.readline().strip().split(" ") a, b = map(int, sys.stdin.readline().strip().split(" ")) u = sys.stdin.readline().strip() solve(s, t, a, b, u)
p02612
s357427473
Accepted
def main(): n = int(input()) print((1000 - n) % 1000) if __name__ == "__main__": main()
p03494
s453505988
Accepted
nn = int(input()) dd = list(map(int,input().split())) nof_op = 0 finish = 0 while True: for ind in range(nn): if (dd[ind] % 2) == 1: finish = 1 break else: dd[ind] = dd[ind] / 2 if finish == 1: break else: nof_op += 1 print(nof_op)
p02848
s016686185
Accepted
n = int(input()) s = input() ans = [chr(ord(s_)+n) if (ord(s_)+n)<91 else chr((ord(s_)+n)-26) for s_ in s ] print(''.join(ans))
p03324
s686999070
Accepted
D, N = map(int,input().split()) if N % 100 == 0: N += 1 print(N * 100 ** D)
p03696
s335215702
Accepted
N = int(input()) S = input() l = 0 r = 0 for c in S: if c == '(': l += 1 else: if l != 0: l -= 1 else: r += 1 print('('*r + S + ')'*l)
p02888
s413442940
Wrong Answer
import bisect n = int(input()) l = sorted(list(map(int,input().split()))) print(l) count = 0 for i in range(2,n): for j in range(1,i): count += max(j - bisect.bisect_right(l, l[i] - l[j]) , 0) print(l[j],l[i],bisect.bisect_right(l,l[i]-l[j]),count)
p02714
s550264270
Accepted
n=int(input()) s=input() r=s.count("R") g=s.count("G") b=s.count("B") ans=r*g*b for i in range(n): for d in range(n): j=i+d k=j+d if k>=n: break if (s[i]!=s[j]) & (s[j]!=s[k]) & (s[k]!=s[i]): ans-=1 print(ans)
p02718
s927408839
Accepted
n, m = map(int, input().split()) a = list(map(int, input().split())) sum_v = sum(a) border = sum_v / (4*m) count = 0 for i in a: if i >= border: count += 1 if count >= m: print('Yes') else: print('No')
p02607
s872926202
Accepted
n=input() print(len([a for a in list(map(int,input().split()))[::2] if a%2]))
p04034
s362348445
Accepted
n,m = map(int, input().split()) xy = [list(map(int, input().split())) for _ in range(m)] ball = [1] * (n+1) red = [0] * (n+1) red[1] = 1 for x,y in xy: ball[x] -= 1 ball[y] += 1 if red[x] == 1: red[y] = 1 if ball[x] == 0: red[x] = 0 print(sum(red))
p03109
s895490654
Wrong Answer
s = input() print('Heisei' if s<='2019/4/30' else 'TBD')
p03457
s103548970
Accepted
N = int(input()) T = 0 X = 0 Y = 0 for i in range(N): t, x, y = map(int, input().split()) if (t - T) < abs(x-X) + abs(y-Y) or ((t - T) + abs(x-X) + abs(y-Y))%2 == 1: print("No") break T = t X = x Y = y else: print("Yes")
p02719
s305361718
Accepted
def main(): N, K = (int(i) for i in input().split()) a = N - (N//K)*K print(min(a, abs(a-K))) if __name__ == '__main__': main()
p02801
s379055212
Accepted
c=input() print(chr(ord(c)+1))
p03017
s023611060
Accepted
N, A, B, C, D = map(int, input().split()) A, B, C, D = A-1, B-1, C-1, D-1 S = input() if C > D: print('Yes' if '...' in S[B-1:D+2] and '##' not in S[A:C] else 'No') else: print('Yes' if '##' not in S[A:D] else 'No')
p02988
s894781744
Wrong Answer
n = int(input()) p = list(map(int,input().split())) c = 0 for i in range(1,n - 1): if p[i - 1] < p[i] and p[i] < p[i + 1]: c = c + 1 print(c)
p03208
s544491640
Accepted
n,k=map(int,input().split()) h=[int(input()) for _ in range(n)] h.sort() ans=float('inf') for i in range(n-k+1): tmp=h[i+k-1]-h[i] ans=min(tmp,ans) print(ans)
p03386
s902796894
Accepted
A, B, K = map(int, input().split()) L = set() for i in range(A, A+K): if i <= B: L.add(i) for i in range(B, B-K, -1): if i >= A: L.add(i) print(*sorted(list(L)), sep="\n")
p02572
s643796129
Accepted
from itertools import accumulate def main(): N = int(input()) A = list(map(int, input().split())) B = [0] + list(accumulate(A)) MOD = 10 ** 9 + 7 ans = 0 for i in range(N): ans += A[i] * (B[N] - B[i+1]) ans %= MOD print(ans) if __name__ == "__main__": main()
p03821
s399281342
Wrong Answer
n = int(input()) A, B = [], [] for i in range(n): a, b = map(int, input().split()) A.append(a) B.append(b) A = A[::-1] B = B[::-1] cnt = 0 for i in range(n): print(B[i] - (cnt + A[i]) % B[i]) if (cnt + A[i]) % B[i] == 0: continue else: cnt += B[i] - (cnt + A[i]) % B[i] print(cnt)
p02608
s106962725
Accepted
N = int(input()) num = [0]*N for i in range(1,10**2 + 1): for j in range(1,10**2 + 1): for k in range(1,10**2 + 1): ans = i**2 + j**2 + k**2 + i*j + j*k + k*i if ans <= N: num[ans - 1] += 1 for i in range(N): print(num[i])
p02796
s423455010
Accepted
# https://atcoder.jp/contests/keyence2020/tasks/keyence2020_b n = int(input()) robots = [] for _ in range(n): x, l = map(int, input().split()) a, b = x - l, x + l robots.append((a, b)) robots.sort(key=lambda x: x[1]) t = 0 pre = robots[0][1] for i in range(1, n): a, b = robots[i] if a < pre: t += 1 else: pre = b ans = n - t print(ans)
p03494
s230811855
Accepted
import numpy as np N = int(input()) A = list(map(int, input().split())) A = np.array(A) i = 0 while 1: A = A / 2 if np.all(A.astype(np.int) == A): i += 1 else: break print(i)
p03013
s597842034
Accepted
N, M = map(int, input().split()) a = [int(input()) for _ in range(M)] MOD = 10**9 + 7 dp = [0] * (N+1) dp[0] = 1 dp[1] = 1 if 1 not in a else 0 a = set(list(range(2,N+1))) - set(a) for i in a: dp[i] = (dp[i-1] + dp[i-2]) % MOD print(dp[N] % MOD)
p03705
s440196684
Wrong Answer
N,A,B=map(int,input().split()) if N==1: if A==B: print(1) else: print(0) elif A==B: print(N) elif A>B: print(0) else: print(B*(N-2)-A*(N-2)+1)
p02756
s856516807
Accepted
from collections import deque import sys input = sys.stdin.readline S = deque(input().rstrip()) Q = int(input()) rev = False for _ in range(Q): q = input().split() if q[0] == '1': rev = rev ^ True else: F, C = q[1:] if (F == '1') ^ rev: S.appendleft(C) else: S.append(C) S = list(S) if rev: S.reverse() print(''.join(S))
p02983
s139275050
Accepted
l, r = map(int, input().split()) ans = float('inf') for i in range(l, min(r + 1, l + 2020)): for j in range(i + 1, min(r + 1, i + 1 + 2020)): ans = min(ans, i * j % 2019) print(ans)
p03261
s167674571
Accepted
n = int(input()) w = [input() for i in range(n)] def checkDuplication(wordList): if len(set(wordList)) == n: return True else : return False def checkMatch(wordList): checkCount = 0 for i in range(n-1): if wordList[i][-1] == wordList[i+1][0]: pass else: checkCount += 1 if checkCount: return False else: return True if checkMatch(w) and checkDuplication(w): print('Yes') else: print('No')
p02717
s594408313
Accepted
# A - ABC Swap X,Y,Z = list(map(int, input().split())) A=X B=Y C=Z #箱Aと箱Bの中身を入れ替える T=A A=B B=T #箱Aと箱 Cの中身を入れ替える T=A A=C C=T print(A,B,C)
p02700
s437849910
Wrong Answer
A, B, C, D = map(int, input().split()) first = A-C second = B-D if (A>C): if first >= second: print("No") else: print("Yes") elif(A==C): if B>D: print("Yes") else: print("No") else: if first >= second: print("Yes") else: print("No")
p02909
s782029529
Wrong Answer
print('CRSlauoinunndyyy'[id(id)%3::3])
p03001
s945877826
Accepted
W,H,x,y=map(int, input().split()) ans1=H*W/2 if W%2==0 and H%2==0 and x==W//2 and y==H//2: ans2=1 else: ans2=0 print(ans1, ans2)
p02730
s389513532
Accepted
s = list(str(input())) n = len(s) k = int((n+3)/2 - 1) flag = 0 for i in range(n-1): if not s[i] == s[n-1-i]: break else: flag += 1 for i in range(int((n-1)/2)): if not s[i] == s[int((n-1)/2 - 1 - i)]: break else: flag += 1 for k in range (n): if not s[k] == s[n-1-k]: break else: flag += 1 if flag == 3: print("Yes") else: print("No")
p03761
s919319139
Accepted
n=int(input()) a=[list(input()) for i in range(n)] alpha=[0]*26 for aa in a: for x in range(26): if chr(ord("a")+x) in aa: alpha[x]+=1 ans="" for x,i in enumerate(alpha): if i==n: mini=51 for aa in a: cnt=aa.count(chr(ord("a")+x)) mini=min(mini,cnt) ans+=(chr(ord("a")+x))*mini print(ans)
p02916
s930634817
Wrong Answer
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) ans = sum(B) for i in range(N-1): if A[i] == A[i+1] - 1: print(str(A[i])+ " : " +str(A[i+1])) ans += C[A[i]-1] print(ans)
p02711
s832211859
Wrong Answer
print("NYOE S"['7' in input()::2])
p02664
s863530312
Wrong Answer
str = input() length = len(str) ans = [""] * length for x in range(length): if str[length - (x + 1)] == "P":ans[length - (x + 1)] += "P" elif str[length - (x + 1)] == "D":ans[length - (x + 1)] += "D" elif str[length - (x + 1)] == "?": if x == 0 or x == length - 1: ans[length - (x + 1)] = "D" elif ans[length - x] == "D": ans[length - (x + 1)] = "P" elif ans[length - x] == "P": ans[length - (x + 1)] = "D" print(''.join(ans))
p02723
s564333837
Wrong Answer
s = list(input()) if s[2] == s[3]: if s[4] == s[5]: print("Yes") else: print("No")
p03592
s165781218
Accepted
import sys sys.setrecursionlimit(10 ** 8) ini = lambda: int(sys.stdin.readline()) inm = lambda: map(int, sys.stdin.readline().split()) inl = lambda: list(inm()) ins = lambda: sys.stdin.readline().rstrip() debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) n, m, k = inm() def solve(): for x in range(n + 1): for y in range(m + 1): a = m * x + n * y - 2 * x * y if a == k: return True return False print("Yes" if solve() else "No")
p02777
s224252427
Accepted
s1 = input().split() s2= s1[1] s1=s1[0] a,b = map(int, input().split()) s = input() if(s==s1): print(a-1,b) else: print(a,b-1)
p02879
s607258187
Accepted
def main(): a, b = map(int, input().split()) if a < 10 and b < 10: print(a*b) else: print(-1) if __name__ == '__main__': main()
p02700
s273592783
Accepted
a,b,c,d = map(int, input().split()) while True: c -= b if c <= 0: print('Yes') break a -= d if a <= 0: print('No') break
p02608
s910305364
Accepted
N = int(input()) ans = [0]*(N+1) for x in range(1,101): for y in range(1,101): for z in range(1,101): n = x*x + y*y + z*z + x*y + y*z + z*x if n <= N: ans[n] += 1 print(*ans[1:], sep='\n')
p02767
s112215654
Accepted
N = int(input()) X = list(map(int, input().split())) Y = [] for x in range(100): y = [(X[i] - x)**2 for i in range(len(X))] Y.append(sum(y)) print(min(Y))
p03103
s492588950
Wrong Answer
# https://atcoder.jp/contests/abc121/tasks/abc121_c n, m = map(int, input().split()) shop = [] for _ in range(n): a, b = map(int, input().split()) shop.append((a, b)) shop.sort(key=lambda x: x[1]) c = 0 ans = 0 i = 0 while c < m and i < n: a, b = shop[i] if c + b >= m: ans += (m - c) * a c += (m - c) else: ans += b * a c += b i += 1 print(ans)
p02552
s859889829
Accepted
S = int(input()) if S == 1: print("0") else: print("1")
p02681
s566809859
Accepted
S = input() T = input() l = len(T) if(S == T[0:l-1]): print("Yes") else: print("No")
p02697
s419742582
Accepted
n,m=map(int,input().split()) for i in range(m): if n%2==0 and 2*m-i-i-1>=n//2: print(i+1,2*m-i+1) else: print(i+1,2*m-i)
p03854
s319247033
Accepted
import re s = input() str = ["dream","dreamer","erase","eraser"] str = ["maerd","remaerd","esare","resare"] s=s[::-1] while len(s)>0: if len(s) < 5: print("NO") break if s[0:7] == str[1] : s=s[7:] elif s[0:6] == str[3]: s=s[6:] elif s[0:5] == str[0] or s[0:5] == str[2]: s=s[5:] else: print("NO") break if len(s)==0: print("YES") break
p03854
s131424746
Wrong Answer
s=input() s.replace("eraser","") s.replace("erase","") s.replace("dreamer","") s.replace("dream","") if len(s)==0: print("YES") else: print("NO")
p02641
s016444747
Wrong Answer
x, n = map(int, input().split()) arr = sorted(list(map(int, input().split()))) mins = 10000 idx = 0 for i in range(1, 101): if abs(i-x) < mins and i not in arr: mins = abs(i-x) idx = i print(idx)
p03387
s093872537
Wrong Answer
import math A,B,C=map(int,input().split()) s=[A,B,C] t=sorted(s) u=(t[2]-t[0],t[2]-t[1],0) if u[0]%2==0 and u[1]%2==0: print((u[0]+u[1])/2) elif u[0]%2==1 and u[1]%2==1: print(round((1+u[0]//2+u[1]//2))) elif u[0]%2==1 and u[1]%2==0: print(round(((u[0]+1)/2+u[1]/2+1))) else: print(round(((u[1]+1)/2+u[0]/2+1)))
p02602
s464376545
Accepted
#!/usr/bin/env python3 import sys rl = sys.stdin.buffer.readline N, K = map(int, rl().split()) AS = tuple(map(int, rl().split())) for i in range(K, N): print('Yes' if AS[i-K] < AS[i] else 'No')
p02786
s737641434
Accepted
h = int(input()) #2n-1,2**2 for i in range(10**12): if 2**i > h: check = i-1 break print(2*(2**check)-1)
p03487
s201367472
Accepted
n = int(input()) #n,m = map(int,input().split()) lst1 = list(map(int,input().split())) dic1 = dict() for i in lst1: if i in dic1: dic1[i] += 1 else: dic1[i] = 1 ans = 0 for i in dic1: if i > dic1[i]: ans += dic1[i] elif i < dic1[i]: ans += dic1[i] - i print(ans)
p02785
s008952959
Wrong Answer
N,K = map(int,input().split()) enemys = list(map(int,input().split())) enemys = sorted(enemys) if K >= len(enemys): print(0) else: enemys = enemys[K:] print(sum(enemys))
p02628
s355010823
Accepted
N, K = [int(x) for x in input().split()] P = sorted([int(x) for x in input().split()]) ans = 0 for i in range(K): ans += P[i] print(ans)
p03254
s420749535
Accepted
N, x = map(int, input().split()) A = list(map(int, input().split())) A.sort() ans = 0 for a in A[:-1]: if x - a >= 0: x -= a ans += 1 print(ans + (A[-1] == x))
p03448
s257996639
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 i * 500 + j * 100 + k * 50 == x: count += 1 print(count)
p02660
s944911424
Accepted
from collections import Counter from itertools import accumulate from bisect import bisect_right def factor(n): res = [] for i in range(2, int(n ** .5) + 1): while n % i == 0: res.append(i) n //= i if n > 1: return res + [n] else: return res stairs = list(accumulate(i for i in range(1, 64))) N = int(input()) factors = factor(N) ans = 0 for cnt in Counter(factors).values(): ans += bisect_right(stairs, cnt) print(ans)
p02700
s763707814
Wrong Answer
N = (input().split()) TH = int(N[0]) TP = int(N[1]) AH = int(N[2]) AP = int(N[3]) AI,TI = 0,0 chk = 0 NNa,NNb = 0 ,0 if 1 <= TH <= 100 and 1 <= TP <= 100 and 1 <= AH <= 100 and 1 <= AP <= 100: while chk == 1: AI += TP NNa +=1 if AI <= AH: chk += 1 chk = 0 while chk == 1: AI += TP NNb +=1 if TI <= TH: chk += 1 if NNa <= NNb: print('Yes') else: print('No')
p03254
s452384754
Accepted
N, x = map(int, input().split()) a = list(map(int, input().split())) s_a = sorted(a) cnt = 0 for i in range(N-1): if(s_a[i] <= x): cnt += 1 x -= s_a[i] if(s_a[N-1] - x == 0): cnt += 1 print(cnt)
p02847
s418118307
Accepted
print(7 - ['SUN','MON','TUE','WED','THU','FRI','SAT'].index(input()))
p02641
s065431890
Wrong Answer
import bisect X, N=map(int, input().split()) if N==0:print(X);exit() p=sorted(list(map(int, input().split()))) #print(p) m=min(p)-1 M=max(p)+1 #for i in range(m,M+1): # p.append(i) #p=sorted(p) m=X;i=0 for i in range(m,min(p)-2,-1): if i not in p:break M=X;j=0 for j in range(M,max(p)+2): if j not in p:break print(min(i,j))
p03150
s323232006
Wrong Answer
s = list(input()) k = list("keyence") i = 0 cur = 0 while cur <= len(s)-1: if s[cur] == k[i]: i += 1 cur += 1 if i == 7: print("YES") break else: print("NO")
p03319
s076241903
Accepted
import sys def solve(): input = sys.stdin.readline N, K = map(int, input().split()) A = [int(a) for a in input().split()] mid = A.index(1) count = 1 r = K - 1 while r < mid: r += (K - 1) count += 1 if r < N - 1: l = N - K count += 1 while l > r: l -= (K - 1) count += 1 print(count) return 0 if __name__ == "__main__": solve()
p02691
s356721238
Wrong Answer
import itertools N = int(input()) height_list = list(map(int,input().split())) spy_dict = {} for i in range(0,N): spy_dict[i+1] = height_list[i] L_dict = {} R_dict = {} for i in spy_dict: L = i + spy_dict[i] L_dict[i] = L R = i - spy_dict[i] R_dict[i] = R counter = 0 for i in range(1,N): for j in range(i+1,N+1): print(i, j) if L_dict[i] == R_dict[j]: counter += 1 print(counter)
p02987
s137998615
Accepted
from collections import defaultdict S = defaultdict(int) for i in input(): S[i] += 1 if len(S.values()) == 2: a, b = S.values() if a == b == 2: print('Yes') exit() print('No')
p03359
s806017614
Accepted
def main(): a,b = (int(x) for x in input().split()) print(a if a<=b else a-1) if __name__ == '__main__': main()
p02785
s920267888
Wrong Answer
N, K = map(int, input().split()) H = list(map(int, input().split())) print(H) for i in range(min(K,N)): saidai = max(H) H.remove(saidai) print(H) print(sum(H))
p03730
s504835185
Wrong Answer
def zz(): return map(int,input().split()) a,b,c = zz() ans = 0 for i in range(1,b+1): if (a*i)%b == c: ans += 1 break if ans == 0: print("No") else: print("Yes")
p03106
s737956458
Wrong Answer
A,B,K=map(int,input().split()) k=0 n=1 while 1: if A%n==0 and B%n==0: k+=1 if K==k: break n+=1 print (n)
p03434
s563939616
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort() alice = sum(a[-1::-2]) bob = sum(a[-2::-2]) print(alice-bob)
p03797
s511013223
Accepted
N,M=map(int,input().split()) ans=0 if(N>=M//2): print(M//2) else: print(N+(M-N*2)//4)
p03339
s466585655
Wrong Answer
n = int(input()) s = input() e = [0] * (n + 1) w = [0] * (n + 1) for i in range(len(s)): if s[i] == "E": e[i+1] = e[i] + 1 w[i+1] = w[i] else: w[i+1] = w[i] + 1 e[i+1] = e[i] t = [0] * n ans = 10 ** 9 for i in range(1, n+1): t = w[i-1] + e[n] - e[i-1] ans = min(ans, t) print(ans)
p02660
s579398203
Accepted
from collections import Counter def factors(n: int): l = [] for i in range(2, int(n**0.5) + 1): #prime factorization while n % i == 0: n //= i l.append(i) if n > 1: l.append(n) return l c = Counter(factors(int(input()))) ans = 0 for items,values in c.items(): cnt = 1 while cnt <= values: values -= cnt ans += 1 cnt += 1 print(ans)
p03486
s075579907
Accepted
s = sorted(input()) t = sorted(input())[::-1] print("Yes" if s < t else "No")
p03852
s033539891
Wrong Answer
a = input() vowel = set("abcde") if a in vowel: print("vowel") else: print("consonant")
p03474
s313862209
Accepted
a, b = map(int, input().split()) s = input() flg = 0 for i in range(a +b +1): try: if (0 <= int(s[i]) <= 9): if i == a: flg = 0 break except: if i == a: flg = 1 else: flg = 0 break print("Yes" if flg == 1 else "No")
p03284
s294629926
Wrong Answer
n, k = map(int, input().split()) print(n%k)
p03331
s971168963
Accepted
n = int(input()) rt = n def sums(st: str): return sums(st[:-1])+int(st[-1]) if len(st) >1 else int(st) for a in range(1,n//2): b = n - a tmp = sums(str(b)) + sums(str(a)) if tmp < rt: rt = tmp print(rt)
p02676
s573999392
Wrong Answer
K = int(input()) S = input() ls = list(S) if len(S) >= K: ansl = ls[0:K] print(''.join(ansl) + '...') else: print(S)
p03624
s765818288
Accepted
n = input() a = list('abcdefghijklmnopqrstuvwxyz') a = set(a) v = [] for i in a: if not i in n: v.append(i) if len(v) == 0: print('None') else: v.sort() print(v[0])
p02661
s680485972
Wrong Answer
import numpy as np N = int(input()) table = np.array([list(map(int, input().split())) for _ in range(N)]) inf, sup = np.median(table, axis=0) diff = int(sup - inf) if N % 2 == 0: diff *= 2 print(diff + 1)
p02972
s933014617
Wrong Answer
import copy N = int(input()) a = [0]+list(map(int, input().split())) b = copy.copy(a) for j in range(N//2, 0, -1): if sum(b[j::j]) % 2 != a[j]: b[j] = 1 print(sum(b[1:])) if sum(b[1:]) != 0: print(*[i for i, j in enumerate(b) if j == 1])
p03339
s821107269
Accepted
n = int(input()) s = format(input()) w = 0 e = 0 w_list = [0] e_list = [0] for i in range(n): if s[i] == "W": w += 1 else: e += 1 w_list.append(w) e_list.append(e) ans = 10**10 for i in range(1, n+1): ans = min(ans, w_list[i-1] + (e_list[-1] - e_list[i])) print(ans)
p03485
s914226098
Accepted
a,b=map(int, input().split()) n=a+b print(-(-n//2))
p03001
s403924379
Wrong Answer
W,H,w,h = map(float, input().split()) ans =0 if w ==h: ans =1 print('{:9f} {}'.format(W*H/2, ans))
p03317
s152308522
Accepted
import math def main(): n, k = map(int, input().split()) As = list(map(int, input().split())) ans = math.ceil((n-1)/(k-1)) print(ans) if __name__ == "__main__": main()
p03673
s681178557
Wrong Answer
import math import collections import fractions import itertools def solve(): n = int(input()) a = list(map(int, input().split())) deq = collections.deque() for i in range(n): if i % 2 == 0: deq.append(str(a[i])) else: deq.appendleft(str(a[i])) print(" ".join(deq)) return 0 if __name__ == "__main__": solve()
p02947
s029348218
Accepted
from collections import Counter N = int(input()) c = Counter([tuple(sorted(input())) for _ in range(N)]) print(sum([(v*(v-1))//2 for v in c.values()]))
p02935
s284741607
Wrong Answer
x = int(input()) a = list(map(int,input().split())) a.sort() y = 0 for i in range(x): y += a[i-0]*(2**i) print(y//(2**(x+1)))
p03077
s284321955
Accepted
n = int(input()) a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) m = min(a,b,c,d,e) import math point = 4 point += math.ceil(n/m) print(point)