problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02833
s586883426
Accepted
n = int(input()) if n % 2 == 1: print(0) else: cnt = 0 r = 2 while r < n: r *= 5 cnt += n // r print(cnt)
p02935
s562562558
Accepted
from functools import reduce def main(): N = int(input()) v = sorted(list(map(int, input().split()))) print(reduce(lambda x, y: (x + y) * 0.5, v)) if __name__ == '__main__': main()
p03309
s991640890
Accepted
# -*- coding: utf-8 -*- N = int(input().strip()) A_list = list(map(int, input().rstrip().split())) #----- temp_A=[] for i in range(len(A_list)): temp_A.append( A_list[i] - (i+1) ) temp_A.sort() median = (temp_A[(N-1)//2] + temp_A[N//2]) // 2 b = median sum=0 for i,a in enumerate(A_list): sum += abs( a - (b+(i+1)) ) print(sum)
p03821
s246103361
Wrong Answer
n = int(input()) A = [0]*n B = [0]*n for i in range(n): A[i],B[i] = map(int,input().split()) ans = 0 for i in range(n): j = -1-i if B[j] == 1: if A[j] != 0: continue ans += B[j] - (A[j]+ans)%B[j] print(ans)
p03073
s393205940
Accepted
import numpy as np s=np.array(list(map(int,input()))) a=[1 if i%2==0 else 0 for i in range(len(s))] b=[0 if i%2==0 else 1 for i in range(len(s))] a=np.array(a) b=np.array(b) c=s-a d=s-b print(min(np.count_nonzero(c!=0),np.count_nonzero(d!=0)))
p02988
s886779696
Wrong Answer
N = int(input()) N_List = sorted(list(map(int,input().split()))) ct = 0 for i in range(1,N-1): if (N_List[i] > N_List[i-1]) & (N_List[i] < N_List[i+1]): ct += 1 print(ct)
p02702
s920986270
Accepted
s = input() x = list(map(int, list(s))) x = x[::-1] dic = [0 for _ in range(2020)] ten = 1 y = 0 for i in range(len(s)): y = (y+ten*x[i])%2019 dic[y] += 1 ten = (ten*10)%2019 result = 0 for i in range(2019): result += max([dic[i]*(dic[i]-1)//2, 0]) result += dic[0] print(result)
p04019
s371356394
Accepted
s = input() dirset = set() for i in s: dirset.add(i) if "N" in dirset and "S" in dirset: if ("E" in dirset and "W" in dirset) or (not "E" in dirset and not "W" in dirset): print("Yes") else: print("No") elif "E" in dirset and "W" in dirset: if not "N" in dirset and not "S" in dirset: print("Yes") else: print("No") else: print("No")
p03699
s768171422
Accepted
#!/usr/bin/env python3 n = int(input()) s = [int(input()) for _ in range(n)] s = sorted(s) ans = sum(s) if ans%10 != 0: print(ans) exit(0) for i in s: if i%10 != 0: ans -= i print(ans) exit(0) print(0)
p02748
s103001203
Accepted
A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) L = [[int(x) for x in input().split()] for _ in range(M)] reg = min(a) + min(b) for x, y, c in L: tmp = a[x-1] + b[y-1] - c reg = min(reg, tmp) print(reg)
p02707
s487720174
Accepted
N = int(input()) A = list(map(int, input().split())) for i in range(N-1): A[i] -= 1 ans = [0 for i in range(N)] for a in A: ans[a] += 1 for i in range(N): print(ans[i])
p02690
s625257007
Accepted
x=int(input()) import math x5=math.ceil(x**0.2) #print(x5) import numpy as np while(True): for ii in np.arange(x5,-1,-1): for jj in range(x5+1): #print("a,b",ii,jj) if ii**5-jj**5==x: print(ii,jj) exit() if ii**5+jj**5==x: print(ii,-jj) exit() x5*=2
p03251
s248068215
Accepted
N, M, X, Y = list(map(int, input().split())) x = list(map(int, input().split())) y = list(map(int, input().split())) x.append(X) y.append(Y) if max(x) >= min(y): print("War") else: print("No War")
p02742
s797588103
Accepted
def main(): H, W = map(int, input().split()) if H == 1 or W == 1: print(1) else: print(-(-H*W // 2)) if __name__ == "__main__": main()
p02818
s394256634
Accepted
A, B, K = map(int, input().split()) if K <= A: print(A-K, B) elif A+B >= K > A: print(0, B-(K-A)) else: print(0, 0)
p03698
s126487706
Accepted
s=list(input()) if len(s)==len(set(s)): print("yes") else: print("no")
p02663
s506371842
Accepted
x = input().split() h1 = int(x[0]) m1 = int(x[1]) h2 = int(x[2]) m2 = int(x[3]) k = int(x[4]) print((h2-h1)*60+m2-m1-k)
p03435
s223615760
Wrong Answer
c=[list(map(int,input().split())) for _ in range(3)] ans = "Yes" for i in range(2): if c[i+1][1]-c[i+1][0] != c[0][1]-c[0][0]: ans = "No" for j in range(2): if c[1][i+1]-c[0][i+1] != c[1][0]-c[0][0]: ans = "No" print(ans)
p03986
s511815294
Accepted
X = input() stack_s = [] out = [] for x in X: if x == "S": stack_s.append("S") else: if len(stack_s) > 0: stack_s.pop() else: out.append("T") while len(stack_s) > 0: out.append(stack_s.pop()) print(len(out))
p02554
s932841296
Accepted
n = int(input()) mod = 10**9+7 ans = pow(10, n, mod) ans -= pow(9, n, mod)*2 ans += pow(8, n, mod) print(ans % mod)
p02583
s995072550
Wrong Answer
n = int(input()) print(n) l = list(map(int,input().split())) res = 0 for t0 in range(0,len(l)-2): for t1 in range(t0+1,len(l)-1): for t2 in range(t1+1,len(l)): if (l[t0] + l[t1] > l[t2] and l[t0] + l[t2] > l[t1] and l[t1] + l[t2] > l[t0] and l[t0]!=l[t1] and l[t1]!=l[t2] and l[t0]!=l[t2]): res += 1 print(res)
p02647
s986274931
Accepted
import itertools n,k=map(int,input().split()) l=list(map(int,input().split())) if k>42: l=[n]*n print(*l) else: for _ in range(k): countl=[0]*(n+1) for i in range(n): countl[max(1,i+1-l[i])]+=1 if i+2+l[i]<=n: countl[i+2+l[i]]-=1 l=list(itertools.accumulate(countl)) l.remove(l[0]) print(*l)
p02657
s037925545
Wrong Answer
A, B = map(float, input().split()) s = (A*(B*100))/100 print(s)
p02753
s068860639
Accepted
#!/usr/bin/env python3 s = input() print("No" if s == "AAA" or s == "BBB" else "Yes")
p03323
s416021170
Accepted
a, b = list(map(int,input().split())) if a <= 8 and b <=8: print('Yay!') else: print(':(')
p02843
s327873888
Accepted
x = int(open(0).read().split()[0]) import heapq s = {0} hq = [0] prices = list(range(100, 106)) tmp = 0 while tmp<x: tmp = heapq.heappop(hq) for price in prices: new = tmp+price if new not in s: s.add(new) heapq.heappush(hq, new) print(int(tmp == x))
p02556
s005473169
Wrong Answer
n = int(input()) max_x = max_y = 0 min_x = min_y = 5 * 10**9 for i in range(n): X, Y = map(int, input().split()) x = X + Y y = X - Y max_x = max(max_x, x) max_y = max(max_y, y) min_x = min(min_x, x) min_y = min(min_y, y) print(max(max_x - min_x, max_y - min_y))
p02823
s065407383
Accepted
n,a,b=map(int,input().split()) if (b-a)%2 == 0: print((b-a)//2) else: if n-b >= a-1: ans = a-1 ans += (b-a-1)//2 print(ans+1) else: ans = n-b ans += (b-a-1)//2 print(ans+1)
p02714
s598231039
Wrong Answer
n=int(input()) s=input() c=s.count r,g,b=c('R'),c('G'),c('B') t=0 for k in ('RGB','RBG','GRB','GBR','BRG','BGR'): for w in range(1,n//2): for i in range(n): if i+w*2<n: t+=s[i:i+w*2+1:w]==k print(r*g*b-t)
p03041
s696231683
Wrong Answer
S=input() F=int(S[:2]) L=int(S[2:]) if 0<F<=12: if 0<L<=12: print('AMBIGUOUS') else: print('MMYY') elif 0<L<=12: print('YYMM') else: print('NA')
p03282
s764800017
Wrong Answer
s = list(map(int, input())) k = int(input()) res = int() n = int() for i in range(len(s)): if s[i] != 1: res = s[i] n = i + 1 break if k > n: print(res) else: print(1)
p02727
s969823486
Accepted
x,y,a,b,c = map(int, input().split()) p = list(map(int,input().split())) q = list(map(int,input().split())) r = list(map(int,input().split())) r += sorted(p)[-x:] r += sorted(q)[-y:] ans = sum(sorted(r)[-(x+y):]) print(ans)
p03495
s485993605
Accepted
from collections import Counter from operator import itemgetter import numpy as np N, K = map(int, input().split()) A = list(map(int, input().split())) c = np.array(sorted(Counter(A).items(), key=itemgetter(1), reverse=True)) a_to_replace = c[K:] print(sum(a_to_replace[:,1]))
p02811
s405554288
Wrong Answer
A = list(map(int, input().split())) K = A[0] X = A[1] money = K*500 if money <= X: print ("Yes") else: print("No")
p02645
s475423909
Accepted
s= input() print(s[0]+s[1]+s[2])
p02790
s403206349
Accepted
a, b = map(str, input().split() ) A = a * int(b) B = b * int(a) #print(A, B) C = [A, B] C.sort() print(C[0])
p02970
s304035942
Wrong Answer
#スペース区切りの整数の入力 N,D = map(int, input().split()) D_ = D*2 + 1 if(N%D_ == 0): print("a",int(N/D_)) else: print(int(N/D_+1))
p03645
s245160069
Accepted
N_shima, M_fune = map(int, input().split()) shima_1 = [] shima_N = [] for i in range(M_fune): a, b = map(int, input().split()) if (a == 1): shima_1.append(b) elif (a == N_shima): shima_N.append(b) if (b == 1): shima_1.append(a) elif (b == N_shima): shima_N.append(a) judge = set(shima_1) & set(shima_N) if (len(judge) >= 1): print('POSSIBLE') else: print('IMPOSSIBLE')
p03069
s825732924
Accepted
n=int(input()) s=input() w=s.count(".") ans=w b=0 for i in range(n): if s[i]=="#": b+=1 else: w-=1 ans=min(ans,b+w) print(ans)
p03761
s588380959
Accepted
def main(): n = int(input()) from collections import Counter s = Counter(input()) for i in range(1,n): s = s & Counter(input()) print(''.join(sorted(s.elements()))) if __name__ == '__main__': main()
p03131
s600340707
Accepted
K,A,B = map(int,input().split()) if B-A < 2: print(1+K) exit() cnt = A-1 K -= cnt print(A+((B-A)*(K//2)+K%2))
p03485
s348633628
Accepted
a,b=map(int,input().split()) print(abs(-(a+b)//2))
p03472
s136952497
Accepted
N, H = map(int, input().split()) A = [] B = [] for _ in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) B.sort(reverse=True) Amax = max(A) cnt = 0 for b in B: if Amax <= b: H -= b cnt += 1 if H <= 0: print(cnt) exit() print((H-1)//Amax+1 + cnt)
p03827
s118431110
Accepted
N = int(input()) S = input() num = 0 max_num = num for l in S: if l == 'I': num += 1 else : num -= 1 if num > max_num: max_num = num print(max_num)
p03827
s084048388
Wrong Answer
""" author : halo2halo date : 31, Jan, 2020 """ import sys import itertools # import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) S = readline().decode('utf8') ans = 0 for i in S: cnt = 0 if i == 'I': cnt += 1 else: cnt -= 1 max(ans, cnt)
p02603
s274962299
Wrong Answer
N = int(input()) A = list(map(int, input().split())) syoji = 1000 kabu = 0 kai = 0 for i in range(N): sw = 0 if i < N-1: if kabu == 0 and A[i] < A[i+1]: sw = 1 if kabu > 0 and kai < A[i]: syoji = syoji + kabu*A[i] kabu = 0 if sw == 1:#zengai for num in range (100): if syoji < num*A[i]: kabu = num-1 syoji = syoji - (num-1)*A[i] kai = A[i] break print(syoji)
p03679
s346124063
Accepted
x, a, b = map(int, input().split()) if a >= b: print("delicious") elif a < b <= a+x: print("safe") else: print("dangerous")
p03943
s591823523
Accepted
a,b,c = sorted(map(int,input().split())) if a+b ==c: print("Yes") else: print("No")
p02996
s137159367
Wrong Answer
n = int(input()) a = [0] * n b = [0] * n for i in range(n): a[i], b[i] = map(int, input().split()) c = b.copy() c.sort() wa = 0 for i in c: wa += a[b.index(i)] if wa > b[b.index(i)]: print("No") exit() print("Yes")
p03073
s652105928
Accepted
s=input() res=s[0::2].count('0')+s[1::2].count('1') print(min(res,len(s)-res))
p02729
s423223470
Accepted
n, m = [int(elem) for elem in input().split()] print(n * (n-1) // 2 + m * (m-1) // 2)
p03469
s154551187
Accepted
s = input().split('/') print('2018/'+s[1]+'/'+s[2])
p03281
s947601229
Accepted
N = int(input()) totalcount = 0 for j in range(1, N+1, 2): count = 0 for i in range(1, N+1): if j % i == 0: count = count + 1 if count == 8: totalcount = totalcount + 1 print(totalcount)
p02684
s790637660
Wrong Answer
import numpy as np N,K=map(int,input().split()) A=np.array(list(map(int,input().split()))) Appeared=[] flag=0 k=0 location=0 T=0 T_List=[] while flag==0: k+=1 Appeared.append(location) location=A[location]-1 if location in Appeared: flag=1 T=k-Appeared.index(location) T_List=Appeared[k-T:k] Destination=(K-(k-T-1))%T print(T_List[Destination-1]+1)
p02660
s154489841
Accepted
import math N = int(input()) M = int(math.sqrt(N)) ans = 0 check = [True for _ in range(M + 1)] e = [0 for _ in range(M + 1)] for p in range(2, M + 1): if check[p] == True: for j in range(2, M // p + 1): check[p * j] = False while N % p == 0: N = N // p e[p] += 1 ans += int((math.sqrt(1 + 8 * e[p]) - 1)/2) if N > 1: ans += 1 print(ans)
p03475
s559699634
Accepted
import math N = int(input()) lines = [list(map(int, input().split())) for i in range(N-1)] cost = [] for i in range(N): time = 0 for j in range(i, N-1): C, S, F = lines[j] if time < S: time = S + C else: time = F*math.ceil(time/F) + C cost.append(time) for c in cost: print(c)
p02820
s905535751
Wrong Answer
n, k = map(int, input().split()) s, p, r = map(int, input().split()) t = input() pre = "0" ans = 0 for i in range(k): for j in t[i::k]: if j != pre: if j == "s": ans += s elif j == "p": ans += p else: ans += r pre = j else: pre = "0" print(ans)
p02900
s164689950
Wrong Answer
import fractions a, b = map(int, input().split()) import math def prime_number(n): prime_list = [] p = 2 last = n while p <= math.sqrt(last)+1: cnt = 0 if n % p != 0: pass else: while n % p == 0: n //= p cnt += 1 prime_list.append((p, cnt)) p += 1 return len(prime_list) n = fractions.gcd(a, b) print(prime_number(n) + 1)
p02756
s968670512
Accepted
S = input() Q = int(input()) forward = True que0 = [] que1 = [] for _ in range(Q): query = input().split() if query[0] == '1': forward = not forward else: head = (query[1] == '1') if head ^ forward: que1.append(query[2]) else: que0.append(query[2]) S = ''.join(que0[::-1]) + S + ''.join(que1) if forward: print(S) else: print(S[::-1])
p03076
s851436786
Wrong Answer
import math A,B,C,D,E = [int(input()) for _ in range(5)] A1 = math.ceil(A/10) * 10 B1 = math.ceil(B/10) * 10 C1 = math.ceil(C/10) * 10 D1 = math.ceil(D/10) * 10 E1 = math.ceil(E/10) * 10 A2 = A % 10 B2 = B % 10 C2 = C % 10 D2 = D % 10 E2 = E % 10 for i in range(1,11): if A2 == i or B2 == i or C2 == i or D2 == i or E2 == i: print(A1+B1+C1+D1+E1-(10-i)) break
p03472
s029250813
Accepted
N,H=map(int,input().split()) a=0 b=[] for _ in range(N): A,B=map(int,input().split()) a=max(a,A) b.append(B) b=sorted(b,reverse=True) ans=0 for i in range(N): if b[i]<=a: break H-=b[i] ans+=1 if H<=0: print(ans) exit() print(ans-(-H//a))
p02823
s986526194
Accepted
import sys n, a, b = map(int, sys.stdin.readline().split()) c = b - a if c % 2: d = min(a - 1, n - b) e = 1 f = (b - a - 1) // 2 print(d + e + f) else: print(c // 2)
p03557
s350204761
Accepted
from bisect import bisect_right from bisect import bisect_left n = int(input()) a = sorted(map(int, input().split())) b = sorted(map(int, input().split())) c = sorted(map(int, input().split())) cnt = 0 bn = [] for i in range(n): x1 = bisect_left(a, b[i]) x2 = bisect_right(c, b[i]) cnt += x1*(n-x2) print(cnt)
p02790
s787658425
Wrong Answer
a, b = map(int, raw_input() .split()) x = '' for i in range(a): x += str(b) print x
p03680
s060966088
Accepted
import sys n=int(input()) a=list(map(int,sys.stdin.read().split())) check_a=[False for _ in range(n)] c=0 i=0 while True: if i == 1: print(c) exit() nex=a[i]-1 if check_a[i]: break check_a[i]=True i=nex c+=1 print(-1)
p03289
s254115341
Accepted
S = input () T = S.replace('A', '') T = T.replace('C', '') U = T.lower () if S[0]=='A' and S.count('A')==1 and S[2:-1].count('C')==1 and S.count('C')==1 and T==U: print ('AC') else: print ('WA')
p03076
s593973879
Accepted
A = int(input()) B = int(input()) C = int(input()) D = int(input()) E = int(input()) ls = [A,B,C,D,E] last = -1 amari = 10 tmp = -1 for i in range(5): if ls[i] %10 != 0: if amari > ls[i] % 10: amari = ls[i] % 10 tmp = i ls[i] += 10 -ls[i] % 10 print(sum(ls)-(10-amari))
p02603
s991951544
Accepted
n = int(input()) a = list(map(int,input().split())) m = 1000 cnt = 0 have = False for i in range(n-1): if cnt: if a[i] >= a[i+1]: m += cnt * a[i] cnt = 0 else: if a[i] < a[i+1]: cnt += m // a[i] m -= a[i] * cnt m += cnt * a[n-1] print(m)
p04005
s594348153
Wrong Answer
l = [int(x) for x in input().split()] l.sort(reverse=True) if len([x for x in l if x % 2 != 0]) == 0: print(0) else: ans = ((l[0]//2+1) - (l[0]//2)) * l[1] * l[2] print(ans)
p03162
s887257734
Wrong Answer
n=int(input()) ab = [] for _ in range(n): a, b, c = (int(x) for x in input().split()) ab.append([a, b, c]) dp = [0]*n memo = -1 memos = -1 for i in range(n): for j in range(3): if i == 0: dp[i] = max(ab[0]) memos = j elif memo != j and dp[i] < dp[i-1]+ab[i][j]: dp[i] = dp[i-1]+ab[i][j] memos = j memo = memos print(dp)
p03087
s134996559
Accepted
import bisect N, Q = map(int, input().split()) S = input() arr = [] for i in range(N-1): if S[i:i+2] == "AC": arr.append(i) #print(arr) for i in range(Q): l, r = map(int, input().split()) print(bisect.bisect_right(arr, r-2) - bisect.bisect_left(arr, l-1))
p02601
s845733049
Accepted
A, B, C = map(int, input().split()) K = int(input()) for i in range(K): if A >= B: B *= 2 elif B >= C: C *= 2 if A < B and B < C: print("Yes") else: print("No")
p03612
s622545817
Accepted
N = int(input()) P = list(map(int,input().split())) ans = 0 for i in range(N-1): if P[i] == i + 1: P[i],P[i+1] = P[i+1],P[i] ans += 1 if P[-1] == N: ans += 1 print(ans)
p03339
s563192547
Accepted
N=int(input()) S=input() cnt=S.count("E") m=cnt for i in S: if i=="E": cnt-=1 else: cnt+=1 m=min(m,cnt) print(m)
p03351
s319423358
Accepted
a,b,c,d = map(int,input().split()) if abs(a-c) <= d: print('Yes') elif abs(a-b) <= d and abs(b-c) <= d: print('Yes') else: print('No')
p03437
s766144734
Accepted
X, Y = map(int, input().split()) i = 1 if X % Y == 0: print(-1) else: print(X)
p03351
s233519785
Wrong Answer
a,b,c,d = map(int,input().split()) l = [a,b,c] l.sort() #print(l) print('Yes'if (l[1]-l[0]) <= d and (l[2]-l[1]) <= d else 'No')
p03352
s580779057
Wrong Answer
a = int(input()) mx = 1 for i in range(2,a): j=2 while i**j <= a: mx = max(i**j,mx) j+=1 else: break print(mx)
p02786
s892143549
Accepted
print(int('1'*(len(str(bin(int(input()))))-2), 2))
p02873
s203010099
Accepted
# A S = input() ans = [0] * (len(S)+1) for i in range(len(S)): if S[i] == "<": ans[i+1] = max(ans[i+1],ans[i]+1) for i in range(len(S)-1,-1,-1): if S[i] == ">": ans[i] = max(ans[i],ans[i+1]+1) print(sum(ans))
p02859
s580145462
Accepted
r = int(input()) print(r ** 2)
p02628
s449596658
Accepted
from sys import stdin from collections import defaultdict as dd from collections import deque as dq import itertools as it from math import sqrt, log, log2 from fractions import Fraction n, k = map(int, input().split()) nums = list(map(int, stdin.readline().split())) nums.sort() print(sum(nums[:k]))
p03761
s315924188
Wrong Answer
from collections import Counter n = int(input()) S = False for i in range(n): if not S: S = Counter(list(input())) else: S = S & Counter(list(input())) ans = '' for key in sorted(S.keys()): ans += key * S[key] print(ans)
p02768
s031729637
Wrong Answer
from math import factorial n,a,b=map(int,input().split()) sum=0 for i in range(n): if i==a or i==b: continue com=factorial(n)//(factorial(i)*factorial(n-i)) sum+=com print(sum%(10**9+7))
p03821
s262109189
Accepted
n = int(input()) ab = [list(map(int, input().split())) for _ in range(n)][::-1] ans = 0 for a, b in ab: a += ans ans += -(-a//b)*b - a print(ans)
p02994
s854294326
Accepted
N, L = map(int, input().split()) list = [L+i for i in range(N)] a = float("inf") for i in range(N): if abs(a) > abs(list[i]): a = list[i] print(sum(list) - a)
p02675
s790566137
Wrong Answer
a = input() b = list(a) c = sorted(b, reverse = True) if c[0] == '1': print("pon") elif c[0] == '2': print("hon") elif c[0] == '3': print("bon") elif c[0] == '4': print("hon") elif c[0] == '5': print("hon") elif c[0] == '6': print("pon") elif c[0] == '7': print("hon") elif c[0] == '8': print("pon") elif c[0] == '9': print("hon") elif c[0] == '0': print("pon")
p02677
s717669578
Accepted
#C import math A,B,H,M = map(int,input().split()) a2 = A*A+B*B-2*A*B*math.cos(math.pi*2*((H/12+M/720)-M/60)) print(math.sqrt(a2))
p03323
s213805777
Accepted
a, b = map(int, input().split()) if (a > 8 or b > 8): print(':(') else: print('Yay!')
p02688
s444434145
Accepted
n,k=map(int,input().split()) record=[] for i in range(k): d=input() record.extend(list(map(int,input().split()))) record=list(set(record)) print(n-len(record))
p02682
s315715668
Wrong Answer
a,b,c,k = map(int,input().split()) ans = 0 if a >= k: ans = a print(ans) else: ans += a k -= a if b >= k: print(ans) else: k -= b ans -= k print(ans)
p02911
s773654550
Accepted
n,k,q=map(int,input().split()) b=[k-q]*n for i in range(q): a=int(input()) b[a-1]+=1 for i in range(n): if b[i]<=0: print("No") else: print("Yes")
p03612
s602896111
Accepted
n = int(input()) a = list(map(int, input().split())) ans = 0 i = 0 while i < n: if i+1 == a[i]: ans += 1 i += 1 i += 1 print(ans)
p02732
s194046792
Accepted
from collections import Counter from sys import stdin N = int(stdin.readline()) A = list(map(int, stdin.readline().split())) cnt = Counter(A) def comb(n): return n * (n - 1) // 2 sumall = 0 for i in cnt.values(): sumall += comb(i) for a in A: ans = sumall - (cnt[a] - 1) print(ans)
p02796
s453243740
Wrong Answer
import numpy as np n = int(input()) sg = [] for i in range(n): x, l = map(int, input().split()) sg.append([max(x - l + 1, 0), x + l - 1]) sg.sort() prev = sg[0] ans = 0 for i in range(1, n): if prev[1] >= sg[i][0]: ans += 1 if prev[1] < sg[i][1]: prev = sg[i] print(n - ans)
p03210
s450214409
Accepted
X = int(input()) if X in [3,5,7]: print("YES") else: print("NO")
p03624
s003023832
Accepted
s = input() dic1 = dict() for i in s: if not i in dic1: dic1[i] = 1 for i in range(ord("a"),ord("z")+1): if not chr(i) in dic1: print(chr(i)) exit() print("None")
p03803
s512094478
Wrong Answer
a,b=input().split() if a != 1 and b == 1: print('Bob') elif a == 1 and b != 1: print('Alice') elif a == b: print('Draw') elif a > b: print('Alice') else: print('Bob')
p02946
s143972566
Wrong Answer
k, x = map(int, input().split()) ans = [int(x) for x in range(x-k+1, x+k-1)] print(' '.join(map(str, ans)))
p04044
s022013178
Wrong Answer
n, l = map(int, input().split()) a = list(input() for i in range(n)) print(sorted(a))