problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03038
s996099855
Accepted
N, M=map(int, input().split()) a=list(map(int, input().split())) a.sort() card=[] for i in range(M): b, c=map(int, input().split()) card.append((c, b)) card.sort(reverse=True) k=0 for c, b in card: while k < N and b > 0: if a[k]<c: a[k]=c b-=1 k+=1 print(sum(a))
p03778
s087984562
Accepted
W,a,b = map(int,input().split()) if b <= a+W <= b+W: print(0) else: print(min(abs(b-(a+W)),abs(a-(b+W))))
p02796
s945486550
Wrong Answer
N = int(input()) X = [list(map(int, input().split())) for i in range(N)] s = 0 for i in range(0, len(X)-1, 1): a = X[i] min = a[0] - a[1] max = a[0] + a[1] for j in range(i+1, len(X), 1): b = X[j] b_min = b[0] - b[1] b_max = b[0] + b[1] if min <= b_max and max >= b_min: s += 1 print(s)
p02766
s578327915
Wrong Answer
a,b=map(int,input().split()) ans=1 while 1: if a==0: break a//=b ans+=1 print(ans)
p02753
s416823402
Wrong Answer
if __name__ == '__main__': s = input() print("no" if s == "AAA" or s == "BBB" else "yes")
p02982
s261958150
Accepted
n,d=list(map(int,input().split())) a=[list(map(int, input().split())) for i in range(n)] cnt=0 def f(x,y): cal=0 for i in range(d): cal+=abs(x[i]-y[i])**2 return cal**0.5 for i in range(n-1): for j in range(i+1,n): if f(a[i],a[j]).is_integer()==True:cnt+=1 print(cnt)
p03543
s959619611
Wrong Answer
N = input() for i in range(4): moji=N.count(N[i]) if moji>=3: print("Yes") break else: pass if moji<3: print("No")
p02642
s955771173
Accepted
n = int(input()) a = list(map(int, input().split())) cnt = [0] * ((10**6)+1) for elem in a: cnt[elem] += 1 unique = [] for i in range((10**6)+1): if cnt[i] == 1: unique.append(i) cnt = [0] * ((10**6)+1) a = list(set(a)) for elem in a: for m in range(elem*2, (10**6)+1, elem): cnt[m] = 1 ans = 0 for elem in unique: if cnt[elem] == 0: ans+=1 print(ans)
p03699
s688695588
Accepted
N = int(input()) S = sorted([int(input()) for _ in range(N)]) s = sum(S) if s % 10 != 0: print(s) exit() for si in S: if si % 10 != 0: print(s - si) exit() print(0)
p02690
s494431464
Accepted
x=int(input()) for a in range(201): for b in range(-200,201): if a**5-b**5==x: print(a,b) exit()
p02970
s262806395
Accepted
n,d = map(int,input().split()) print((n + d * 2) // (d * 2 + 1))
p02719
s403841164
Accepted
n,k=list(map(int,input().split())) n=n%k m=k-n print(min(m,n))
p03495
s486218606
Accepted
import collections N,K = map(int,input().split()) A = list(map(int,input().split())) count = collections.Counter(A) c = [] for i in count: c.append([count[i],i]) c.sort() l = len(c) ans = 0 for i in range(0,max(0,l-K),1): ans += c[i][0] print(ans)
p03612
s716231725
Wrong Answer
n = int(raw_input()) count = 0 res = 0 ais = map(int , raw_input().split()) for i,a in enumerate(ais): if a == i +1: count += 1 else: #flush the count res += (count+1)/2# + 1 count = 0 if count: res += count/2 +1 print res
p03659
s755307743
Accepted
from itertools import accumulate input() a = list(map(int, input().split())) b = list(accumulate(a)) c = [abs(y * 2 - b[-1]) for y in b][:-1] print(min([abs(y * 2 - b[-1]) for y in b][:-1]))
p02639
s128856815
Accepted
a, b, c, d, e = map(int, input().split()) if a==0: print(1) elif b==0: print(2) elif c==0: print(3) elif d==0: print(4) else: print(5)
p02760
s221686621
Accepted
a = [list(map(int, input().split())) for i in range(3)] n = int(input()) for _ in range(n): x = int(input()) for i in range(3): for j in range(3): if a[i][j] == x: a[i][j] = -1 flag = 0 for i in range(3): if a[i][0] == -1 and a[i][1] == -1 and a[i][2] == -1: flag = 1 if a[0][i] == -1 and a[1][i] == -1 and a[2][i] == -1: flag = 1 if a[0][0]+a[1][1]+a[2][2] == -3 or a[0][2]+a[1][1]+a[2][0] == -3: flag = 1 print("No" if flag == 0 else "Yes")
p03210
s189461077
Wrong Answer
#abc114 a x=int(input()) medetai=[7,5,3] if x in medetai: print("YES") else: print("No")
p02596
s503176036
Wrong Answer
import sys n = int(input()) seven = 7 if n < 7: print(-1) sys.exit() for i in range(n): if seven % n == 0: print(i + 1) sys.exit() seven = seven * 10 + 7 print(-1)
p03821
s335865999
Accepted
N=int(input()) AB=[list(map(int,input().split())) for i in range(N)][::-1] plus=0 for j in range(N): AB[j][0]+=plus if AB[j][0]%AB[j][1]!=0: a=AB[j][1]-(AB[j][0]%AB[j][1]) AB[j][0]+=a plus+=a print(plus)
p02973
s680892067
Accepted
from bisect import bisect_left,bisect n = int(input()) p = [-1*int(input())] for i in range(n-1): now = -1*int(input()) if now >= p[-1]: p.append(now) else: p[bisect(p,now)] = now print(len(p))
p03612
s000119486
Accepted
n = int(input()) p = list(map(int, input().split())) ans = 0 for i in range(n-1): if p[i]-1 == i: p[i], p[i+1] = p[i+1], p[i] ans += 1 if p[-1] == n: ans+=1 print(ans)
p03680
s072106145
Wrong Answer
n=int(input()) a=[int(input())-1 for i in range(n)] c,x=1,0 for i in range(n): x=a[x] if x==2: print(i+1) break else: print(-1)
p02917
s937338842
Wrong Answer
n=int(input()) b=[10**18]+list(map(int,input().split()))+[10**18] a=[0]*n for i in range(n): a[i]=min(b[i],b[i+1]) print(a) print(sum(a))
p03000
s597288242
Accepted
#!/usr/bin/env python3 import sys input = iter(sys.stdin.read().splitlines()).__next__ N, X = map(int, input().split()) L = list(map(int, input().split())) P = [0] for d in L: P.append(P[-1] + d) res = len( [1 for x in P if x <= X] ) print(res)
p03163
s970803090
Accepted
n,W = map(int,input().split()) w,v = [0]*n, [0]*n for i in range(n): w[i], v[i] = map(int,input().split()) dp = [[0]*(W+1) for _ in range(n+1)] for i in range(n): for j in range(W+1): if j-w[i]>=0: dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]]+v[i]) dp[i+1][j] = max(dp[i+1][j],dp[i][j]) print(dp[n][W])
p03038
s799248402
Wrong Answer
import bisect N,M=map(int, input().split() ) A=list(map(int, input().split() )) B=[0]*M C=[0]*M for i in range(M): B[i],C[i]=map(int, input().split() ) A.sort() summ=sum(A) for i in range(M): p=bisect.bisect_left(A,C[i]) q=min(p,B[i]) A= [C[i]]*q+ A[q:] print(sum(A))
p02624
s539737806
Accepted
import math n = int(input()) ans = 0 for i in range(1,n+1): N = math.floor(n / i) l = i * N s = N / 2 * (i + l) ans += s print(int(ans))
p03150
s903770807
Accepted
S = input() ans = 'NO' n = len(S) if S == 'keyence': ans = 'YES' for i in range(n): for j in range(i,n): T = S[:i]+S[j:] if T == 'keyence': ans = 'YES' print(ans)
p03815
s696064004
Accepted
x = int(input()) ans = x // 11 x -= ans * 11 ans *= 2 if x > 6: ans += 2 elif x > 0: ans += 1 print(ans)
p02786
s211830747
Accepted
import math import fractions if __name__ == '__main__': h = int(input()) n = math.floor(math.log2(h)) print(2 ** (n + 1) - 1)
p03317
s516332436
Accepted
n,k = map(int,input().split()) a = list(map(int,input().split())) count =0 while True: count += 1 n -= (k) if n <= 0: break n += 1 print(count)
p02754
s046705076
Accepted
n, a, b = (int(i) for i in input().split()); res = a * (n // (a + b)); curr = n % (a + b); res += min(a, curr); print(res);
p02784
s989937618
Accepted
H, N = map(int, input().split()) a_list = list(map(int, input().split())) if sum(a_list) >= H: print("Yes") else: print("No")
p02912
s218640548
Accepted
import heapq n, m, *a = map(int, open(0).read().split()) a = list(map(lambda x: -x, a)) heapq.heapify(a) for i in range(m): b = -heapq.heappop(a) heapq.heappush(a, -(b >> 1)) print(-sum(a))
p03206
s708837731
Wrong Answer
d=int(input()) if d==25: print("Christmas") elif d==24: print("Christmas Eve") else: print("Christmas Eve Eve")
p03637
s667137753
Wrong Answer
n = int(input()) lis = list(map(int,input().split())) cnt = 0 two = 0 for i in lis: if i % 4 == 0: cnt += 1 elif i == 2: two += 1 if n//2 <= cnt: print("Yes") elif two >= 2 and (n-(two-1))//2 <= cnt: print("Yes") else: print("No")
p03434
s645559355
Accepted
n = int(input()) A = sorted(list(map(int, input().split())), reverse=True) alc = 0 bb = 0 for i in range(n): if i % 2 == 0: alc += A[i] else: bb += A[i] print(alc - bb)
p02952
s421413759
Accepted
n=int(input()) a = 0 for i in range(1,n+1): if 0 <= i <= 9 : a+=1 if 100 <= i <= 999 : a+=1 if 10000 <= i <= 99999 : a+=1 print(a)
p02811
s611978602
Accepted
K,X=map(int,input().split()) if 500*K>=X:print("Yes") else: print("No")
p03548
s755499219
Accepted
x,y,z=map(int,input().split()) w=y+2*z ans=1 while w<=x-(y+z): w+=y+z ans+=1 print(ans)
p02790
s859356238
Accepted
a, b = input().split() print(a*int(b) if a < b else b*int(a))
p03623
s035891394
Wrong Answer
getList = lambda: list(map(int, input().split())) a,b,x = getList() if abs(a - x) < abs(b - x): print("A") else: print("B")
p03281
s282074805
Accepted
n=int(input()) if n<105: print(0) exit() ans=0 for i in range(105,n+1,2): c=0 for j in range(1,i+1): if i%j==0: c+=1 if c==8: ans+=1 print(ans)
p03351
s834458162
Accepted
a,b,c,d = map(int,input().split()) ok = False dist = abs(a-c) if dist <= d: ok = True else: d1 = abs(a-b) d2 = abs(b-c) if d1 <= d and d2 <= d: ok = True if ok: print('Yes') else: print('No')
p03001
s350674266
Accepted
w, h, x, y = map(int, input().split()) s = w * h / 2 t = 0 if 2 * x == w and 2 * y == h: t = 1 print(s, t)
p02996
s973307921
Accepted
N=int(input()) work=[] for i in range(0,N): a,b=map(int,input().split()) work.append([b,a]) work.sort() now=0 for i in range(0,N): b,a=work[i] now+=a if now>b: print('No') exit() print('Yes')
p03371
s416483554
Wrong Answer
A,B,C,X,Y = map(int, input().split()) n = min(X,Y) sum = 0 sum = min(n*2*C, A*n+B*n) if X>Y: n = X-n sum = sum + n*A else: n = Y - n sum = sum + n*B sum_ab = X*A + Y*B sum_a_b = 2*(X+Y)*C print(min(sum,sum_ab,sum_a_b))
p02791
s383118220
Wrong Answer
N = input() Pn = input().split() Pn_2 = [] result = 0 for ii in Pn: if N >= ii: Pn_2.append(ii) last = Pn_2[0] # 初期化 for i in Pn_2: if int(last) >= int(i): result += 1 last = int(i) print(result)
p03767
s440441599
Accepted
N = int(input()) a = list(map(int, input().split())) a.sort() a_1 = [] for i in range(N,3*N): a_1.append(a[i]) P = [] for i in range(2*N): if i%2 == 0: P.append(a_1[i]) print(sum(P))
p02832
s961305799
Wrong Answer
n = int(input()) A = list(map(int, input().split())) now = 1 hit = 0 for a in A: if a != now: hit += 1 else: now += 1 print(hit)
p02819
s644918426
Accepted
X = int(input()) def is_prime(n): if n ==2: return 2 for i in range(2,n): if n % i ==0: return False elif i**2 > n: return True while 1: if is_prime(X): print(X) break else: X += 1
p03611
s463126680
Wrong Answer
N = int(input()) A = [int(i) for i in input().split()] ave = sum(A) // len(A) ans1 = len(list(filter(lambda x: x == ave or x+1 == ave or x-1 == ave, A))) ans2 = len(list(filter(lambda x: x == ave+1 or x+1 == ave+1 or x-1 == ave+1, A))) print(max(ans1, ans2))
p03827
s104428009
Accepted
_ = int(input()) S = str(input()) x = 0 ans = 0 for c in S: if c == 'I': x += 1 else: x -= 1 ans = max(x, ans) print(ans)
p02910
s188824190
Wrong Answer
S = list(input()) num = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == "L": num += 1 else: if i == "R": num += 1 if num != 0: print("No") else: print("Yes")
p03796
s753394909
Wrong Answer
def xy(A): ans = 1 mod = 10**9+7 for i in range(1,A+1): ans *= i % mod return ans def main(): A = int(input()) print(xy(A)) if __name__ == '__main__': main()
p03210
s719790731
Accepted
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): X = int(readline()) if X in (7, 5, 3): print('YES') else: print('NO') return if __name__ == '__main__': main()
p03408
s469917635
Wrong Answer
n=int(input()) s=[input() for i in range(n)] m=int(input()) t=[input() for j in range(m)] l=list(set(s)) print(l) print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))
p03434
s669160531
Accepted
import sys input = sys.stdin.readline n=int(input()) a=sorted(list(map(int,input().split())),reverse = 1) print(sum(a[::2]) - sum(a[1::2]))
p02631
s221768561
Wrong Answer
n = (int)(input()) a = list(map(int, input().split(" "))) xor = [] ans = 0 for i in range(1, 2 * (10 ** 5 + 1)): xor = [] test = 1 for j in range(n): xor.append(a[0] ^ i) for j in range(n - 1): test *= xor[j] if test == xor[-1]: ans = i break #print(ans) txt = "" for i in range(n): txt += (str)(a[i] ^ ans) if i != n - 1: txt += " " print(txt)
p03281
s420776728
Accepted
N = int(input()) B = 0 for i in range(N): A = 0 n = int((i+1)**(1/2)) for j in range(n): if (i+1) % (j+1) == 0: A += 1 if A == 4 and (i+1) % 2 == 1: B += 1 print(B)
p03852
s524928827
Accepted
if input() in "aiueo": print("vowel") else: print("consonant")
p02682
s024029716
Accepted
import sys readline = sys.stdin.buffer.readline a,b,c,k =list(map(int,readline().rstrip().split())) if k <= a: print(k) elif k > a and k <= a + b: print(a) else: print(a -(k-(a+b)))
p03556
s163642979
Wrong Answer
N=int(input()) for i in range(N): if (i**2)>N: break print((i-1)**2)
p03472
s848667928
Accepted
n, h = map(int, input().split()) a = [] b = [] for _ in range(n): x, y = map(int, input().split()) a.append(x) b.append(y) a = max(a) b.sort(reverse=True) ans = 0 for i in b: if i<=a: ans += (h+a-1)//a print(ans) break h -= i ans += 1 if h<=0: print(ans) break else: ans += (h+a-1)//a print(ans)
p02780
s020428210
Wrong Answer
N, K = map(int, input().split()) P = map(int, input().split()) PP = sum(sorted([(1 + pp) / 2 for pp in P], reverse=True)[:3]) print(PP)
p02996
s299699858
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 > i: print("No") exit() print("Yes")
p03433
s513167781
Wrong Answer
n=int(input()) a=int(input()) if n%500<a: print('Yes') else: print('No')
p02814
s899501288
Wrong Answer
from math import gcd, ceil from functools import reduce import sys def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) N, M = map(int, input().split()) a = [int(i) for i in input().split()] if N == 1: print((M-a[0]//2)//a[0]) sys.exit() A = [] for x in a: if x//2%2 == 0: print(0) sys.exit() A.append(x//2) lcm = lcm_list(A) print(ceil(M//lcm/2))
p03131
s290984618
Wrong Answer
def main(): k, a, b = map(int, input().split()) cookie = 1 if b <= a + 2: cookie += k else: cookie += b k -= a + 1 cookie += (b - a) * max(0, k // 2) cookie -= (k + 1) % 2 print(cookie) if __name__ == '__main__': main()
p03000
s409268144
Accepted
n,x = map(int,raw_input().split()) l = map(int,raw_input().split()) d1=0 bou = 1 for i in xrange(n): d1 += l[i] if d1 > x: break else: bou += 1 print bou
p03251
s828984630
Accepted
N, M, X, Y = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) x = max(x) y = min(y) if (x < y) and (X < y) and (Y >= y): print("No War") else: print("War")
p03131
s222502460
Accepted
k, a, b = map(int, input().split()) if b - a < 2: print(k + 1) else: t = k - a + 1 if t >= 2 and t % 2 == 0: ans = (b - a) * (t // 2) + a else: ans = (b - a) * (t // 2) + a + 1 print(ans)
p02831
s080184751
Accepted
import fractions a, b = map(int, input().split()) print(a * b // fractions.gcd(a, b))
p02720
s741423279
Accepted
k = int(input()) lunlun = list(range(1, 10)) for i in range(k - 1): a = lunlun[i] b = a * 10 + a % 10 if a % 10 != 0: lunlun.append(b - 1) lunlun.append(b) if a % 10 != 9: lunlun.append(b + 1) print(lunlun[k - 1])
p02754
s508927962
Accepted
# coding: utf-8 def main(): N, A, B = map(int, input().split()) quo = N // (A + B) rem = N % (A + B) if (rem > A): rem = A ans = quo * A + rem print(ans) if __name__ == "__main__": main()
p03951
s634269837
Accepted
N=int(input()) S=input() T=input() ans=2*N i=N while i: if S[-i:]==T[:i]: ans-=i break i-=1 print(ans)
p03251
s959100254
Wrong Answer
n,m,x,y=map(int,input().split()) x=list(map(int,input().split())) y=list(map(int,input().split())) if max(x)<=min(y): print("No War") else: print("War")
p02881
s077852776
Wrong Answer
n = int(input()) divs = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: divs.append(i) if i != n // i: divs.append(n // i) sdivs = sorted(divs) lsdivs = len(sdivs) a = sdivs[lsdivs // 2 - 1] b = sdivs[lsdivs // 2] print(a + b - 2)
p03838
s413168015
Wrong Answer
x,y = map(int,input().split()) X = abs(x) Y = abs(y) ans = 0 if X > Y: if y > x: ans = min((y - x),abs(y - x) + 1) else: ans = abs(y - x) + 1 if y > 0: # 符号再変換 ans += 1 elif Y > X: if y > x: ans = min((y - x),abs(y - x) + 1) else: ans = abs(y - x) + 1 if x > 0: # 符号再変換 ans += 1 elif X == Y: if x == y: ans = 0 else: ans = 1 print(ans)
p03943
s479167029
Wrong Answer
a, b, c = sorted(map(int, input().split())) if a == b + c: print('Yes') else: print('No')
p02756
s852258145
Accepted
from collections import deque s = deque(input()) q = int(input()) rev = False for i in range(q): query = input().split() if query[0] == "1": rev ^= True else: if (query[1] == "1" and not rev) or (query[1] == "2" and rev): s.appendleft(query[2]) else: s.append(query[2]) if rev: print("".join(list(s)[::-1])) else: print("".join(list(s)))
p03323
s396535676
Wrong Answer
a, b = map(int, input().split()) if a >= 8 and b >= 8: print('Yay!') else: print(':(')
p03607
s814660332
Accepted
N = int(input()) numberdict = dict() for i in range(N): A_i = int(input()) if A_i in numberdict: numberdict[A_i] += 1 else: numberdict[A_i] = 1 ans = 0 for j in numberdict.keys(): if numberdict[j] % 2 == 1: ans += 1 print(ans)
p03251
s457625097
Accepted
N,M,X,Y = map(int,input().split()) x = list(map(int,input().split())) x.sort() y = list(map(int,input().split())) y.sort() if max(X,x[-1]) < min(Y,y[0]): print("No War") else: print("War")
p03659
s743726398
Accepted
n = int(input()) l = list(map(int,input().split())) s = sum(l) ans = 10**15 a = l[0] ans = min(ans,abs((s-a)-a)) for i in range(1,n-1): a += l[i] ans = min(ans,abs((s-a)-a)) print(ans)
p02642
s156499260
Wrong Answer
N = int(input()) A = list(map(int, input().split())) import numpy as np ans = 0 for i in range(N): if A.count(A[i]) == N: ans = 0 break break c = [j for j in A[i]/np.array(A) if j.is_integer() ] if len(c) == 1: ans += 1 print(ans)
p03449
s877837978
Wrong Answer
N = int(input()) candies_i = list(map(int, input().split())) candies_j = list(map(int, input().split())) l = [] for i in range(N): total_li = sum(candies_i[:i]) total_lj = sum(candies_j[i:]) total = ( total_li + total_lj ) l.append(total) print(max(l))
p03698
s076680456
Accepted
S=input() for c in S: if S.count(c)>1: print("no") break else: print("yes")
p02848
s994591224
Accepted
N = int(input()) S = input() ans = '' for letter in S: ans += chr((ord(letter)+N-ord('A'))%26 + ord('A')) print(ans)
p03220
s502102301
Wrong Answer
n = int(input()) t,a = map(int,input().split()) ans = [] l = list(map(int,input().split())) for i in l: ans.append(a - (t - (i * 0.006))) print(ans.index(min(ans))+1)
p03565
s824743768
Wrong Answer
S = input() T = input() t = len(T) for i in range(len(S)-t, -1, -1): print(i) for j in range(t): k = S[i+j] if k != T[j] and k != "?": break else: print((S[:i]+T+S[i+t:]).replace("?", "a")) exit() print("UNRESTORABLE")
p03759
s670776372
Accepted
A, B, C = map(int, input().split()) if A + C == B * 2: print('YES') else: print('NO')
p02842
s068023686
Accepted
def resolve(): import math n = int(input()) res = math.ceil(n / 1.08) if str(res)[-2:] == '.0': print(int(res)) elif str(res * 1.08).split('.')[0] == str(n): print(int(str(res).split('.')[0])) else: print(':(') resolve()
p02771
s299102378
Accepted
A,B,C = list(map(int,input().split())) if A == B == C: print('No') elif A == B and B != C: print('Yes') elif A != B and A == C: print('Yes') elif A != B and B ==C: print('Yes') elif A != B and A != C: print('No') else: print('No')
p03385
s130868883
Accepted
S = input() if 'a' in S and 'b' in S and 'c' in S: print('Yes') else: print('No')
p03730
s950635412
Wrong Answer
a,b,c=map(int,input().split()) num = a if (a % 2 == 1 and c % 2 == 0) or (a % 2 == 0 and c % 2 == 1): print('No') else: while True: if a % b == c: print('YES') break a += num
p04034
s693047577
Accepted
N,M = map(int, input().split()) xy = [tuple(map(int, input().split())) for _ in range(M)] prob = [False] * N prob[0] = True cnts = [1] * N for x,y in xy: cnts[x-1] -= 1 cnts[y-1] += 1 if prob[x-1] == True: prob[y-1] = True if cnts[x-1] == 0: prob[x-1] = False ans = 0 for i in range(N): if prob[i]: ans += 1 print(ans)
p02862
s720980832
Wrong Answer
a,b=map(int,input().split()) if (2*b-a)%3!=0 or (2*a-b)%3!=0: print(0) else: n=(2*b-a)//3 m=(2*a-b)//3 p = 10**9+7 def nCr(n,r): if r*2>n: return nCr(n,n-r) else: a = b = 1 for i in range(r): a = a * (n - i) % p b = b * (r - i) % p return (a * pow(b,p-2,p)) % p print(nCr((m+n),m))
p03494
s198456080
Wrong Answer
#-*-coding:utf-8-*- import sys input=sys.stdin.readline def main(): boards=[] n = int(input()) boards=list(map(int,input().split())) data=sum(boards) count=0 if data%2!=0: print(count) exit() while True: if data%2==0: data=data//2 count+=1 else: break print(count) if __name__=="__main__": main()