problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02838
s680966920
Accepted
N=int(input()) A=list(map(int,input().split())) mod=10**9+7 ans=0 for i in range(60): X=1<<i n=len([1 for a in A if a&X]) ans+=X*n*(N-n)%mod ans%=mod print(ans)
p03761
s356095303
Wrong Answer
# Hello World program in Python from collections import Counter as cn d = int (input()) l = [] for k in range(d): d = input() p = cn(d) l.append(p) oi = l[0] for g in range(len(l)): oi = oi & l[g] print(oi) print("".join(sorted(oi.elements())))
p03774
s946436202
Accepted
import sys input = sys.stdin.readline N, M = map(int, input().split()) st = [] res = [0] * N for _ in range(N): a, b = map(int, input().split()) st.append((a, b)) cp = [] for _ in range(M): a, b = map(int, input().split()) cp.append((a, b)) for i in range(N): a, b = st[i] for j in range(M): c, d = cp[j] x, y = cp[res[i]] if abs(c - a) + abs(d - b) < abs(x - a) + abs(y - b): res[i] = j res[i] += 1 for r in res: print(r)
p03262
s093795419
Accepted
import fractions N, X = map(int, input().split()) a = list(map(int, input().split())) gcd = 0 for x in range(N): gcd = fractions.gcd(abs(a[x] - X), gcd) print(gcd)
p02556
s970714908
Wrong Answer
# import sys # input = sys.stdin.readline def mp(): return map(int, input().split()) def lmp(): return list(map(int, input().split())) n = int(input()) point = [] u = [] for i in range(n): a,b = mp() point.append((a,b)) u.append(a+b) print(max(u)-min(u))
p02859
s247360071
Wrong Answer
num = int(input()) print(num*2)
p03556
s284933782
Accepted
N = int(input()) print(int(N**0.5)**2)
p02983
s192331029
Accepted
L, R = map(int, input().split()) import sys minimum = sys.maxsize for i in range(L, min(L + 2019, R)): for j in range(i+1, min(i + 1 + 2019, R+1)): minimum = min(minimum, i * j % 2019) print(minimum)
p03408
s146166621
Accepted
N = int(input()) S = [] L = [] for i in range(N): s = str(input()) S.append(s) M = int(input()) for i in range(M): l = str(input()) L.append(l) Ans = 0 for i in range(N): a = S[i] A = S.count(a)-L.count(a) if A > Ans: Ans = A print(Ans)
p02814
s670087875
Wrong Answer
from fractions import gcd def lcm(a, b): return a * b // gcd(a, b) n, m = map(int, input().split()) a = list(map(int, input().split())) b = [0] * n g1 = a[0] g2 = a[0] // 2 for i in range(n): g1 = lcm(g1, a[i]) if g1 > m: break for i in range(n): g2 = lcm(g2, a[i] // 2) if g2 > m: break print(m // g2 - m // g1)
p03250
s919519975
Accepted
a,b,c=sorted(list(map(int,input().split())),reverse=True) print(10*a+b+c)
p03324
s485886466
Wrong Answer
d, n = map(int, input().split()) count = 0 i = 1 if d==0: print(5) exit() while True: if i%100*d==0 and i//(100**d) < 100**d: count += 1 if count == n: print(i) break i += 1
p03387
s389460895
Accepted
abc = list(map(int, input().split())) abc.sort() bc = abc[2] - abc[1] ab = abc[1] - abc[0] print(bc + ab//2 if ab%2==0 else bc + ab//2 + 2)
p02910
s895430457
Wrong Answer
s = input() even, odd = [], [] for i in range(len(s)): if i%2: odd.append(s[i]) else: even.append(s[i]) e = list(set(odd)) o = list(set(even)) print('o: ',o,'e: ',e) if('L' in o or 'R' in e): print('No') else: print('Yes')
p03043
s799241729
Accepted
n, k = map(int, input().split()) ans = 0 for i in range(1, n+1): m = i cnt = 0 for j in range(1, 101): if m >= k: break else: m = m * 2 cnt += 1 ans += (1 / n) * (0.5**cnt) print(ans)
p02785
s703546898
Accepted
N, K = input().split() N = int(N) K = int(K) h_i = input().split() h_i = [int(N) for N in h_i] h_i.sort() if N < K: print("0") else : newh_i = h_i[0:N-K] print(sum(newh_i))
p02555
s652027120
Accepted
from sys import stdin input = stdin.readline s = int(input()) mod = 1000000007 cnt = 0 a = [[1] for _ in range(2001)] a[0].append(0) for x in range(1, 2001): for y in range(1, x): a[x].append(a[x - 1][y - 1] + a[x - 1][y]) a[x].append(1) for x in range(1, 2001): s -= 3 if s < 0: break cnt += a[s + x - 1][s] cnt %= mod print(cnt)
p03069
s894731372
Wrong Answer
N = int(input()) S = input() left = 0 right = N while left < N and S[left] == '.': left += 1 while right > 0 and S[right - 1] == '#': right -= 1 cb = 0 cw = 0 for c in S[left:right]: if c == '#': cb += 1 else: cw += 1 print(min(cb, cw))
p02724
s019951791
Accepted
x = int(input()) print((x // 500)*1000 + ((x%500)//5)*5)
p03438
s432695295
Wrong Answer
N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = False rule1 = sum(a) <= sum(b) rule2 = sum([ai - bi for ai, bi in zip(a,b) if ai > bi]) <= sum(b) - sum(a) if rule1 and rule2: ans = True text = "Yes" if ans else "No" print(text)
p03852
s227698632
Accepted
s = input() vowel_list = ['a', 'i', 'u', 'e', 'o'] if s in vowel_list: print('vowel') else: print('consonant')
p03545
s419174301
Accepted
a,b,c,d = input() for i in range(2**3): op = ["+","+","+"] for j in range(3): if ((i>>j)&1) == 1: op[j] = "-" ans = eval(a + op[0] + b + op[1] + c + op[2] +d) if ans == 7 : print("{}{}{}{}{}{}{}={}".format(a,op[0],b,op[1],c,op[2],d,ans)) break
p02647
s348802723
Accepted
N,K = map(int,input().split()) A = list(map(int,input().split())) A.append(0) for j in range(min(50,K)): B = [0] * (N+1) for i in range(N): B[max(i - A[i],0)] += 1 B[min(i + A[i] + 1,N)] -= 1 A = [0] * (N+1) a = 0 for i in range(N): a += B[i] A[i] = a print(*A[:-1])
p03419
s311894396
Wrong Answer
n,m = map(int,input().split()) print(n*m-2*(n+m-2) if n > 1 and m > 1 else n*m-2)
p03665
s670483098
Accepted
# AGC 017: A – Biscuits N, P = [int(s) for s in input().split()] A = [int(s) for s in input().split()] isAllEven = True for k in A: if k % 2 == 1: isAllEven = False break if isAllEven: if P == 0: print(2 ** N) else: print(0) else: print(2 ** (N -1))
p02957
s361888303
Accepted
a,b = map(int, input().split()) if (a+b)%2==0: print((a+b)//2) else: print("IMPOSSIBLE")
p02924
s664054920
Accepted
mod=10**9+7 import math import sys from collections import deque import heapq import copy import itertools from itertools import permutations from itertools import combinations import bisect def mi() : return map(int,sys.stdin.readline().split()) def ii() : return int(sys.stdin.readline().rstrip()) def i() : return sys.stdin.readline().rstrip() a=ii() print(a*(a-1)//2)
p02713
s231868545
Wrong Answer
import math K = int(input()) res = sum([math.gcd(math.gcd(a, 1), c) for a in range(1,K+1) for b in range(1,K+1) for c in range(1,K+1)]) print(res)
p03086
s615068217
Wrong Answer
s = input() ans = 0 for l in range (len(s)-1): for r in range(l+1, len(s)+1): cnt = 0 for str in s[l:r+1]: if str not in ['A','C','G','T']: cnt = 0 break else: cnt += 1 ans = max(ans, cnt) print(ans)
p03105
s752436242
Accepted
a,b,c=map(int,input().split()) print(min(c,b//a))
p02717
s483401780
Accepted
a,b,c=map(int,input().split()) a,b=b,a a,c=c,a print(a,b,c)
p02754
s662086712
Accepted
n,a,b = map(int,input().split()) ans = 0 ans += (n//(a + b)) * a m = n%(a + b) if m >= a: ans += a else: ans += m print(ans)
p03241
s808217333
Accepted
def LI(): return list(map(int, input().split())) N, M = LI() x = M//N for i in range(x, 0, -1): if M % i != 0: continue ans = i break print(ans)
p03997
s156301331
Accepted
a = int(input()) b = int(input()) h = int(input()) area = (a+b)*h/2 print('{:.0f}'.format(area))
p02760
s517238647
Accepted
a = [list(map(int,input().split())) for _ in range(3)] n = int(input()) b = [int(input()) for _ in range(n)] for i in range(3): if a[0][i] in b and a[1][i] in b and a[2][i] in b: print('Yes') exit() if a[i][0] in b and a[i][1] in b and a[i][2] in b: print('Yes') exit() if a[0][0] in b and a[1][1] in b and a[2][2] in b: print('Yes') exit() if a[2][0] in b and a[1][1] in b and a[0][2] in b: print('Yes') exit() print('No')
p02790
s431602059
Wrong Answer
import numpy as np x = list(map(int,input().split())) if x[0] > x[1]: ans = np.repeat(x[1],x[0]) print(ans) elif x[0] < x[1]: ans = np.repeat(x[0],x[1]) print(ans) else: print(np.repeat(x[0],x[1]))
p03293
s961211853
Accepted
S = input() T = input() flag=1 for i in range(len(S)): if S==T: flag=0 print("Yes") break S = S[-1]+S[:-1] # print(S) if flag==1: print("No")
p03605
s660433980
Wrong Answer
arr=raw_input() ans="No" for i in range(len(arr)): if arr[i]==9: ans = "Yes" else: print ans
p03645
s836625712
Wrong Answer
N,M=map(int,input().split()) A=[0]*M;p=-1 for i in range(M): a,b=map(int,input().split()) A[i]=a,b A.sort(reverse=True,key=lambda x: x[1]) #print(A) #print("Yes" if A[0][1]==N else "No") if A[0][1]!=N: print("IMPOSSIBLE") else: for i in range(1,M): if A[i][0]==1 and A[i][1]==A[0][0]: p=2 #print(1,A[i][0],A[i][1],A[0][0],p) if p==2: print("POSSIBLE") else: print("IMPOSSIBLE")
p02720
s125429413
Accepted
import sys sys.setrecursionlimit(10**7) L = [] def lunlun(x, cnt, c): if cnt == 10: L.append(int(x)) return e = int(x[-1]) if c: for i in range(max(e-1, 0), min(e+2, 10)): lunlun(x+str(i), cnt+1, 1) else: lunlun(x+"0", cnt+1, 0) for i in range(1, 10): lunlun(x+str(i), cnt+1, 1) lunlun("0", 1, 0) for i in range(1, 10): lunlun(str(i), 1, 1) L.sort() k = int(input()) ans = L[k] print(ans)
p02862
s933861877
Wrong Answer
X, Y = map(int,input().split()) if (X+Y)%3 != 0: print(0) exit() n = int((2*Y-X)/3) m = int((2*X-Y)/3) mod = 10**9+7 def comb(n, r, mod): x=y=1 for i in range(r): x *= n; y *= r x %= mod; y %= mod n -= 1; r -= 1 return x * pow(y, mod - 2, mod) % mod print(comb(n+m, n, mod))
p03254
s023710809
Accepted
N, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() c = 0 ans = 0 for i in range(N): if c + a[i] <= x: c += a[i] ans += 1 else: print(ans) exit() if c == x: print(N) else: print(N-1)
p03285
s373166370
Accepted
inf = 10 ** 15 mod = 10 ** 9 + 7 n = int(input()) tmp = 0 flag = False while tmp <= n: if (n-tmp) % 7 == 0: flag = True tmp+=4 if flag: print('Yes') else: print('No')
p02727
s616066958
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())) p.sort(reverse=True) q.sort(reverse=True) r = p[:x] + q[:y] + r r.sort(reverse=True) r = r[:x+y] print(sum(r))
p03699
s019576389
Accepted
n=int(input()) s=[] ans=0 for i in range(n): x=int(input()) ans+=x if x%10!=0:s.append(x) s=sorted(s) if ans%10==0: if len(s)>=1: print(ans-s[0]) else: print(0) else: print(ans)
p02661
s815139471
Wrong Answer
N = int(input()) A = [] B = [] for i in range(N): a,b = list(map(int,input().split())) A.append(a) B.append(b) A.sort() B.sort() if N%2==1: print(B[(N-1)//2] - A[(N-1)//2]+1) else: b1 = B[(N-2)//2] b2 = B[N//2] a1 = A[(N-2)//2] a2 = A[N//2] print(a2 + b2 - (a1 + b1) + 1)
p03785
s859329666
Accepted
n,c,k = map(int,input().split()) t = [int(input()) for i in range(n)] t.sort() cnt = 0 on_bus = 1 arr_time = t[0] waiting_time = 0 for i in range(1,n): on_bus += 1 waiting_time = t[i] - arr_time if on_bus > c or waiting_time >k: on_bus = 1 arr_time = t[i] waiting_time = 0 cnt += 1 print(cnt+1)
p02631
s647294836
Accepted
n=int(input()) a=list(map(int,input().split())) b=[0]*n ans=0 for i in range(n): ans^=a[i] for i in range(n): b[i]=ans^a[i] print(*b)
p04011
s736596188
Wrong Answer
N=int(input()) K=int(input()) X=int(input()) Y=int(input()) P=N-K if N-K>=0: print(K*X+(N-K)*Y) else: print(K*X)
p02555
s695582488
Accepted
# -*- coding: utf-8 -*- # map(int, input().split()) mod = pow(10,9)+7 S = int(input()) if S <= 2: print(0) exit(0) from operator import mul from functools import reduce def cmb(n,r): r = min(n-r,r) if r == 0: return 1 over = reduce(mul, range(n, n - r, -1)) under = reduce(mul, range(1,r + 1)) return over // under max_len = int(S/3) ans = 0 for l in range(1,max_len+1): s = S-(l*3) ans = (ans+cmb(s+l-1,s))%mod print(ans)
p03206
s128798888
Accepted
def main(): d = int(input()) if d == 25: print("Christmas") elif d == 24: print("Christmas Eve") elif d == 23: print("Christmas Eve Eve") elif d == 22: print("Christmas Eve Eve Eve") if __name__ == "__main__": main()
p03075
s571626760
Wrong Answer
a, b, c, d, e, k = [int(input()) for i in range(6)] print("Yay!" if (e - a < k) else ":(")
p03210
s281483148
Accepted
X = str(input()) if X in "753": print("YES") else: print("NO")
p03565
s381247552
Accepted
S = input() T = input() s = len(S) t = len(T) A = [] for i in range(s-t+1): if all(S[i+j]==T[j] or S[i+j]=="?" for j in range(t)): A.append(S[:i]+T+S[i+t:]) A = [a.replace("?","a") for a in A] if len(A)==0: print("UNRESTORABLE") else: print(min(A))
p03487
s521008940
Accepted
from collections import Counter N = int(input()) al = list(map(int,input().split())) C = Counter(al) ans = 0 for i in C.keys(): if i in C: if C[i] == i: continue elif C[i] > i: ans += C[i] - i else: ans += C[i] print(ans)
p02888
s966246700
Accepted
N = int(input()) L = sorted(list(map(int, input().split()))) import bisect ans = 0 for i in range(N): for j in range(i+1, N): ans += bisect.bisect_left(L, L[i]+L[j]) - (j+1) print(ans)
p02814
s566363575
Accepted
from fractions import gcd import math def lcm(l): x = l[0] for i in range(1, len(l)): x = (x * l[i]) // gcd(x, l[i]) return x N, M = map(int, input().split()) A = list(map(int, input().split())) B = [0]*N cnt = [0]*N for i in range(N): a = A[i] B[i] = a//2 while a % 2 == 0: a /= 2 cnt[i] += 1 cnt = set(cnt) if len(cnt) != 1: print(0) exit() x = lcm(B) ans = 0 a = M//x if a % 2: a += 1 print(a//2)
p02618
s885746525
Wrong Answer
print(1) print(2) print(3) print(4) print(5) print(6) print(7)
p03625
s378474026
Accepted
n = int(input()) a = list(map(int,input().split())) dic = {} for i in range(n): dic.setdefault(a[i],0) dic[a[i]] += 1 ans = [] for item in dic.items(): if item[1]>=2: ans.append(item[0]) if len(ans)<=1: print(0) else: ans.sort() if dic[ans[-1]]>=4: print(ans[-1]**2) else: print(ans[-1]*ans[-2])
p03673
s717619901
Accepted
from collections import deque ls = deque() n = int(input()) a = list(map(int,input().split())) for i in range(n): if i%2==0: ls.appendleft(a[i]) else: ls.append(a[i]) if n%2 == 0: print(*reversed(ls)) else: print(*ls)
p03323
s050727351
Wrong Answer
A,B=map(int, input().split()) if A > 8 : print (":(") else : print ( "Yay!") if B > 8 : print ()
p03997
s943819671
Accepted
a = input() b = input() h = input() print( int(((int(a)+int(b))*int(h))/2) )
p02773
s813993087
Wrong Answer
n=int(input()) S=[] for i in range(n): S.append(input()) S=sorted(S) from collections import defaultdict d = defaultdict(int) for k in S: d[k]+=1 d=dict(d) dmax=max(d) ansn=d[dmax] ans=[] for i in d.keys(): if d[i]==ansn: ans.append(i) ans.sort() for i in range(len(ans)): print(ans[i])
p03038
s137161865
Wrong Answer
N,M=map(int, input().split()) A=list(map(int, input().split())) B = {} C = {} for i in range(M): B[i],C[i]=map(int, input().split()) high_scores = sorted(C.items(), key=lambda x:x[1], reverse=True) sum_b = 0 for score in high_scores: sum_b += B[score[0]] if N < sum_b: A += [score[1]] * (sum_b - N) break else: A += [score[1]] * B[score[0]] A.sort(reverse=True) A = A[:N] print(sum(A))
p02571
s766878457
Wrong Answer
S = input() T = input() max_match = 0 n = len(T) m = len(S) for i in range(m-n): tmp = 0 for j in range(i,i+n): if S[j] == T[j-i]: tmp += 1 if tmp > max_match: max_match = tmp ans = n - max_match print(ans)
p02963
s835239837
Accepted
s = int(input()) x = (s - 1) // 10**9 + 1 y = (10**9 - s) % 10**9 print(0, 0, 1, 10**9, x, y)
p04034
s052049589
Wrong Answer
n,m=map(int,input().split()) data=[1]*n res=[1]+[0]*(n-1) for i in range(m): x,y=map(int,input().split()) data[x-1]-=1 data[y-1]+=1 res[y-1]=res[x-1] ans=0 for i in range(n): if data[i]!=0 and res[i]!=0: ans+=1 print(ans)
p03627
s517549999
Accepted
import collections n = int(input()) a = list(map(int,input().split())) c = sorted(collections.Counter(a).items(),reverse = True) num2 = [] num4 = [] ans = [0] for k in c: if k[1]>=4: num4.append(k[0]) if k[1]>=2: num2.append(k[0]) if len(num2)>=2: ans.append(num2[0]*num2[1]) if len(num4)>=1: ans.append(num4[0]**2) print(max(ans))
p02987
s348150312
Accepted
from collections import Counter s = Counter(input()) ans = "Yes" if len(s)==2: for x in s.values(): if x == 2: continue else: ans = "No" break else: ans = "No" print(ans)
p03455
s801181071
Accepted
a,b=(map(int,input().split())) ans=a*b print("Odd"if ans%2==1 else"Even")
p03251
s432781150
Wrong Answer
N, M, X, Y = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) for z in range(X, Y+1): if X <= z <= Y and max(x) < z and min(y) >= z: print('No War') break else: print('War')
p03817
s216146288
Accepted
x=int(input()) from math import ceil cnt = ceil(x/11) if 11*cnt - 5 >=x: ans=cnt*2-1 else: ans=cnt*2 print(ans)
p03105
s328293301
Wrong Answer
a,b,c=map(int,input().split()) ans=0 while b>a and ans<c: b=b-a ans+=1 print(ans)
p03944
s132890531
Wrong Answer
w,h,n=map(int,input().split()) y_min=0 y_max=h x_min=0 x_max=w for i in range(n): x,y,a=map(int,input().split()) if a==1: x_min=max(x_min,x) if a==2: x_max=min(x_max,x) if a==3: y_min=max(y_min,y) if a==4: y_max=min(y_max,y) white=(y_max-y_min)*(x_max-x_min) print(max(white,0))
p02973
s190719159
Wrong Answer
n = int(input()) ans = 0 Min = float('inf') for i in range(n): a = int(input()) if a <= Min: ans += 1 Min = a print(ans)
p02578
s956667045
Accepted
N = int(input()) A = list(map(int,input().split())) H = 0 for i in range(1,N): if A[i] < A[i-1]: sa = A[i-1] - A[i] A[i] = A[i-1] H += sa print(H)
p03457
s902680957
Accepted
n = int(input()) li = [] pre_t = 0 pre_x = 0 pre_y = 0 flag = True for i in range(n): t,x,y = map(int,input().split()) if (t-pre_t)%2 == (x-pre_x+y-pre_y)%2 and (t-pre_t) >= (x-pre_x + y-pre_y): pre_t = t pre_x = x pre_y = y else: flag = False break if flag: print("Yes") else: print("No")
p03416
s151301065
Accepted
a, b = map(int, input().split()) cnt = 0 for i in range(a, b + 1): i = str(i) if i[0] == i[4] and i[1] == i[3]: cnt += 1 print(cnt)
p03457
s436728517
Accepted
n = int(input()) for i in range(n): t,x,y=map(int,input().split()) if (x + y) > t or (x + y + t) % 2: print("No") exit() print("Yes")
p03719
s529136963
Accepted
a,b,c = map(int,input().split()) if c>=a and c<=b:print("Yes") else:print("No")
p03627
s687712612
Wrong Answer
N = int(input()) A = list(map(int,input().split())) A.sort(reverse = True) a=0 b=0 cnt = 0 for i in range(1,len(A)): if A[i]==A[i-1]: cnt+=1 else: cnt=1 if cnt==2: if a==0: a=A[i] elif b==0: b=A[i] cnt=0 if a*b!=0: break print(a*b)
p03797
s932164030
Accepted
N, M = [int(i) for i in input().split()] if M <= 2*N: print(M//2) else: print(N+(M-2*N)//4)
p03438
s777843772
Wrong Answer
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) biggerA = 0 biggerB=0 for i in range(N): if A[i] > B[i]: biggerA += A[i] - B[i] if A[i] < B[i]: biggerB += B[i] - A[i] if biggerA * 2 <= biggerB: print('Yes') else: print('No') resolve()
p03219
s887412427
Wrong Answer
x, y = map(int, input().split()) print(x + y/2)
p02708
s146087045
Accepted
n,k=map(int,input().split()) count=0 for i in range(k,n+2): count+=(n-i+1)*i+1 count=count%(10**9+7) print(count)
p02603
s929715971
Accepted
n=int(input()) a=list(map(int,input().split())) ans=1000 i=0 while i<n: j=i mi=a[i] while j<n and mi>=a[j]: mi=min(mi,a[j]) j+=1 if j==n: break stock=ans//mi ans-=stock*mi ans+=a[j]*stock i=j print(ans)
p04030
s063396749
Accepted
s = input() res = "" for do in s: if do == "B": if len(res) != 0: res = res[0:len(res)-1] else: res += do print(res)
p02879
s377899809
Accepted
A, B = map(int, input().split()) if A >= 10 or B >= 10: print(-1) else: print(A*B)
p02577
s853670352
Accepted
n=int(input()) if n%9==0: print("Yes") else: print("No")
p03681
s671058657
Accepted
from math import factorial n, m = map(int, input().split()) if n == m: ans = factorial(n) % (10 ** 9 + 7) ans = ans ** 2 % (10 ** 9 + 7) print(ans * 2 % (10 ** 9 + 7)) elif abs(n - m) == 1: ans1 = factorial(n) % (10 ** 9 + 7) ans2 = factorial(m) % (10 ** 9 + 7) print(ans1 * ans2 % (10 ** 9 + 7)) else: print(0)
p02829
s562824425
Accepted
A=int(input()) B=int(input()) print(6-A-B)
p02661
s630193776
Wrong Answer
import bisect def Z(): return int(input()) def ZZ(): return [int(_) for _ in input().split()] def main(): N = Z() A, B = [], [] for _ in range(N): a, b = ZZ() A.append(a) B.append(b) A.sort() B.sort() midA = A[N//2] if N%2 == 1 else (A[N//2-1] + A[N//2])//2 midB = B[N//2] if N%2 == 1 else (B[N//2-1] + B[N//2] + 1)//2 print(max(0, midB-midA+1)) return if __name__ == '__main__': main()
p03624
s210393661
Wrong Answer
def i(): return int(input()) def i2(): return map(int,input().split()) def s(): return str(input()) def l(): return list(input()) def intl(): return list(int(k) for k in input().split()) s = l() alf = "abcdefghijklmnopqrstuvwxyz" for i in range(len(s)): alf = alf.strip(s[i]) if alf == "": print("None") else: print(alf[0])
p03001
s310514896
Accepted
W,H,x,y = map(int, input().split()) S = W*H/2 flag = 0 if x==W/2 and y==H/2: flag = 1 print(S, flag)
p02598
s008838492
Accepted
n,k = map(int,input().split()) a = list(map(int,input().split())) ng = 0 ok = 10**9 while ng < ok-1: mid = (ng+ok)//2 count = sum((ai-1)//mid for ai in a) if count<=k: ok = mid else: ng = mid print(ok)
p03767
s353609010
Wrong Answer
n = int(input()) A = list(map(int,input().split())) a = sum(A[n//3:n//3*2]) b = sum(A[-2:-2-n//3*2:-2]) ans = max(a,b) print(ans)
p02924
s767929033
Accepted
N = int(input()) ans = (N*(N-1))//2 print(ans)
p02789
s900870086
Accepted
N,M = map(int,input().split()) if N == M: print('Yes') else: print('No')
p03592
s691801794
Wrong Answer
import sys input = sys.stdin.readline n, m, k = map(int, input().split()) for i in range(n + 1): for j in range(m + 1): if k == n * i + m * j - i * j * 2: print('Yes') exit() print('No')
p02596
s448208796
Accepted
K = int(input()) seven = 7 counter = 1 flag = True for i in range(K): if seven % K == 0: print(counter) flag = False break seven = (seven * 10 + 7) % K counter += 1 if flag: print(-1)