problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02730 | s486289599 | Accepted | #!/usr/bin/env python3
import sys
s = input()
for i in range(len(s)//2):
if s[i] != s[-1-i]:
print("No")
sys.exit()
s2 = s[:(len(s)-1)//2]
for i in range((len(s)-1)//2):
if s2[i] != s2[-1-i]:
print("No")
sys.exit()
s3 = s[(len(s)+3)//2-1:]
for i in range((len(s)-1)//2):
if s3[i] != s3[-1-i]:
print("No")
sys.exit()
print("Yes") |
p03971 | s198305552 | Accepted | n,a,b=map(int,input().split())
s=input()
d=[str(c) for c in s]
for i in range(n):
if d[i]=="c":
print("No")
elif a+b==0:
print("No")
elif d[i]=="a":
print("Yes")
a-=1
elif d[i]=="b":
if b==0:
print("No")
else:
print("Yes")
b-=1
|
p02732 | s890896638 | Wrong Answer | import math
def comb(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = (int)(input())
a = list(map(int, input().split(" ")))
temp = [0 for i in range(n + 1)]
aaa = sorted(a)
count = 0
for i in range(n - 1):
if aaa[i] == aaa[i + 1]:
count+= 1
else:
temp[aaa[i]] = count + 1
count = 0
else:
if len(a) == 1:
temp[aaa[0]] = 1
else:
temp[aaa[-1]] = count + 1
ans = 0
#print(temp)#各数字の出現回数
|
p03555 | s972781453 | Accepted | a = input()
b = input()
if a == b[::-1]:
print("YES")
else:
print("NO") |
p02838 | s068258692 | Accepted | import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
MOD = 10 ** 9 + 7
digit = 0
while A.any():
one = np.count_nonzero(A & 1)
ans += (one * (N - one) * pow(2, digit, MOD)) % MOD
ans %= MOD
A >>= 1
digit += 1
print(ans)
|
p02923 | s549937214 | Accepted | n = int(input())
a = [0]*n
h = list(map(int,input().split()))
ans = 0
for i in range(1,n):
if h[i]<=h[i-1]: a[i] = a[i-1]+1
else:
a[i]=0
ans = max(ans,a[i-1])
ans = max(ans,a[n-1])
print(ans) |
p02768 | s082410963 | Accepted | from functools import reduce
n,a,b = map(int,input().split())
MOD = 1000000007
# nCr の計算
def F(n,r):
# 分子 n*(n-1)*(n-2)*...(n-r+1)
numerator = reduce(lambda x,y: x * y % MOD, range(n,n-r,-1))
# 分母 r!(rの階乗)
denominator = reduce(lambda x,y: x * y % MOD, range(1,r+1))
return numerator * pow(denominator, MOD - 2, MOD) % MOD
# 繰り返し二乗法
ans = pow(2,n,MOD)-1
ans -=F(n,a)
ans -=F(n,b)
ans %= MOD
print(ans) |
p02711 | s916124879 | Wrong Answer | N=int(input())
N=str(N)
if N[0]==7:
print("Yes")
elif N[1]==7:
print("Yes")
elif N[2]==7:
print("Yes")
else:
print("No") |
p03485 | s125454201 | Wrong Answer | a,b=map(int,input().split())
print((a+b)//2) |
p02548 | s787139279 | Accepted | N=int(input())
#a*b+c=n
cnt=N-1
for a in range(2,N):
if N%a==0:
cnt+=(N//a)-1
else:
cnt+=N//a
print(cnt) |
p02912 | s189012184 | Wrong Answer | import heapq
import sys
from io import StringIO
import unittest
n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)
for _ in range(m):
tmp_min = heapq.heappop(a)
heapq.heappush(a, (-1) * (-tmp_min // 2))
print(-sum(a)) |
p03719 | s147040007 | Accepted | # A - Between Two Integers
# https://atcoder.jp/contests/abc061/tasks/abc061_a
a, b, c = map(int, input().split())
if a <= c <= b:
print("Yes")
else:
print("No") |
p03555 | s046672475 | Accepted | c11, c12, c13 = list(input())
c21, c22, c23 = list(input())
if c23 == c11 and c22 == c12 and c21 == c13:
print('YES')
else:
print('NO')
|
p02983 | s204946697 | Wrong Answer |
def main():
L, R = [int(i) for i in input().split()]
tl = L % 2019
tr = R % 2019
c1 = (tl <= 673) & (673 <= tr)
c2 = False
for i in range(L, min(L + 3, R+1)):
if i % 3 == 0:
c2 = True
break
if ((L//2019) < (R//2019)) | (c1&c2):
ans = 0
else:
t = L % 2019
ans = t * (t+1)
print(ans % 2019)
if __name__ == "__main__":
main()
|
p02699 | s023263841 | Accepted | S, W = map(int, input().split())
if W>=S:
print('unsafe')
else:
print('safe') |
p03264 | s122919584 | Accepted | K=int(input())
print((K//2)*((K+1)//2)) |
p02996 | s285745767 | Accepted | N=int(input())
task=[[]]*N
for i in range(N):task[i]=list(map(int,input().split()))
task.sort(key=lambda x: x[1])
t=0
for i in range(N):
t+=task[i][0]
if task[i][1]<t:
print('No')
exit()
print('Yes') |
p04031 | s991552052 | Wrong Answer | import itertools
import math
n=int(input())
a=list(map(int,input().split()))
ave=round(sum(a)/n)
#print(ave)
count=0
for i in range(n):
count+=(a[i]-ave)**2
print(count)
print(round(-1.6))
|
p03160 | s802079162 | Accepted | n = int(input())
h = [int(i) for i in input().split()]
dp = [10 ** 5 for _ in range(n)]
dp[0] = 0
for i in range(1, n):
if i == 1:
dp[i] = abs(h[1] - h[0])
else:
dp[i] = min(dp[i-2] + abs(h[i-2] - h[i])
, dp[i-1] + abs(h[i-1] - h[i]))
print(dp[n-1]) |
p02873 | s207315410 | Accepted | s=input()
sl=len(s)+1
l=[0]*sl
for i in range(sl-1):
if s[i]=="<":
l[i+1]=l[i]+1
for i in range(sl-2,-1,-1):
if s[i]==">":
l[i]=max(l[i+1]+1, l[i])
print(sum(l))
|
p03796 | s245313724 | Accepted | import re
import copy
def accept_input():
N = input()
return int(N)
N = accept_input()
power = 1
for i in range(1,N+1):
power = (power * i)%(10**9+7)
print(power)
|
p03821 | s258368455 | Accepted | import sys
n = int(input())
ls = []
for i in range(n):
a, b = [int(i) for i in sys.stdin.readline().split()]
ls.append([a, b])
_sum = 0
for a, b in ls[::-1]:
if (a + _sum) % b:
_sum += (b - (a + _sum) % b)
print(_sum) |
p02595 | s062782709 | Accepted | import math
a,b = map(int,input().split())
s = 0
l = [ list(map(int,input().split(" "))) for i in range(a)]
for i in range(a):
if math.sqrt(l[i][0]**2+l[i][1]**2)<=b:
s = s+1
print(s)
|
p02880 | s441863078 | Wrong Answer | N=int(input())
no = True
for i in range(1,10):
for k in range(1,i+1):
if N==i*k:
print('Yes')
no = False
break
if no:
print('No') |
p02797 | s873031307 | Accepted | n, k, s = map(int, input().split())
a = []
for i in range(k):
a.append(s)
for i in range(n-k):
if s == 1:
a.append(2)
else:
a.append(s-1)
print(*a) |
p03103 | s756998518 | Accepted | N, M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort()
ans = 0
for i in range(N):
#まだ足りないケース
if M > AB[i][1]:
ans += AB[i][0] * AB[i][1]
M -= AB[i][1]
else:
ans += AB[i][0] * M
break
print(ans) |
p02577 | s376460697 | Accepted | n = sum([int(i) for i in list(input())])
if n % 9 == 0:
print("Yes")
else:
print("No") |
p03309 | s207848508 | Accepted | import numpy as np
N = int(input())
A = np.array(tuple(map(int, input().split())), dtype=np.int64) - np.arange(N) - 1
median = np.median(A)
print(int(min(np.abs(A - median + 0.5).sum(), np.abs(A - median - 0.5).sum())) if int(median * 2) & 1 else int(np.abs(A - median).sum())) |
p02598 | s876677190 | Wrong Answer | from math import floor
from bisect import bisect_left
N, K = map(int,input().split())
A = list(map(int,input().split()))
def chk(L):
cnt = 0
for i in range(N):
cnt += floor(A[i]/L)
return cnt <= K
l, r = 1, max(A)
for _ in range(1000):
m = (l+r)/2
if chk(m):
r = m
else:
l = m
print(round(m)) |
p03485 | s197972747 | Accepted | a,b = input().split(" ")
a,b = int(a),int(b)
ab = a + b
if ab % 2 != 0:
print(int((a+b+1)/2))
else:
print(int((a+b)/2)) |
p02922 | s070413748 | Wrong Answer | a,b=map(int,input().split())
c=1
d=0
while c<d:
d+=1
c=a*c-(d-1)
print(d) |
p02631 | s353973962 | Accepted | N = int(input())
A = [int(i) for i in input().split()]
result = []
res = A[1]
for a in A[2:N]:
res ^= a
result.append(str(res))
for i in range(0, N-1):
res = A[i] ^ A[i+1] ^ res
result.append(str(res))
print(" ".join(result)) |
p02787 | s385860133 | Wrong Answer | H, N = map(int, input().split())
inf = float('inf')
dp = [inf] * (H + 1)
dp[0] = 0
for i in range(N):
A, B = map(int, input().split())
for j in range(H):
t1 = j + A
if t1 > H:
t1 = H
t2 = dp[t1]
if t2 == inf:
continue
t2 += B
if t2 < dp[t1]:
dp[t1] = t2
print(dp[H])
|
p03371 | s334562027 | Wrong Answer | a, b, c, x, y = map(int, input().split())
l = []
for i in range(x+y):
if i%2!=0:
continue
if (i//2)>=x:
a_p = 0
b_p = b*(y-(i//2))
if (i//2)>=y:
a_p = a*(x-(i//2))
b_p = 0
else:
a_p = a*(x-(i//2))
b_p = b*(y-(i//2))
price = (c*i)+ a_p + b_p
l.append(price)
print(min(l)) |
p03284 | s622068873 | Accepted | n,k = map(int,input().split())
if n %k ==0:
print(0)
else :
print(1) |
p02963 | s830617634 | Accepted | k=10**9;x,y=divmod(-int(input()),k);print(0,0,1,k,-x,y) |
p02795 | s537567960 | Accepted | H=int(input())
W=int(input())
N=int(input())
m = max(H,W)
print(-(-N // m)) |
p03778 | s695874406 | Wrong Answer | W, a, b = map(int,input().split())
if b > a+W:
print(b-(a+W))
elif b <= a+W and b+W >= a:
print(0)
else:
print(b+W-a) |
p02922 | s280009033 | Wrong Answer | a,b=map(int, input().split())
c="必要な電源タップ数は"
d="個です。"
count=0
total=0
while True:
# total+=a
# if total<b:
# total-=1
# count+=1
# else:
# break
if total >= b:
break
total += (a-1)
count+=1
print(count) |
p03041 | s323098946 | Accepted | n,k = (int(a) for a in input().split())
s = input()
x =list(s)
x[k-1] = x[k-1].lower()
print(''.join(x))
|
p02831 | s156444525 | Accepted | input_line = input().split(' ')
numA = int(input_line[0])
numB = int(input_line[1])
def gcd(a, b):
if b > a:
tmp = b
b = a
a = tmp
while True:
rem = a % b
if rem == 0:
break
else:
a = b
b = rem
return b
gcd = gcd(numA, numB)
divA = numA // gcd
divB = numB // gcd
print(gcd * divA * divB) |
p02598 | s852637613 | Accepted | N, K = map(int, input().split())
arr = list(map(int, input().split()))
def f(x):
res = 0
for i in range(N):
if arr[i] % x != 0:
res += arr[i]//x
else:
res += max((arr[i]//x)-1,0)
return res
left = 0
right = max(arr)
while abs(left-right) > 1:
tmp = (left+right)//2
if f(tmp) > K:
left = tmp
else:
right = tmp
print(right) |
p03095 | s714015220 | Wrong Answer | import collections
n=int(input())
s=list(input())
s=collections.Counter(s)
ans=1
for i in s:
ans*=s[i]+1
print(ans-1) |
p03627 | s229851561 | Accepted | from collections import Counter
N=int(input())
A=list(map(int,input().split()))
four=0
two=[]
numbers=Counter(A)
for key,value in numbers.items():
if value>=4:
four=max(four,key**2)
if value>=2:
two.append(key)
sorted_two=sorted(two)
if four==0 and len(sorted_two)<=1:
print(0)
else:
print(max(four,sorted_two[-1]*sorted_two[-2]))
|
p03206 | s459626782 | Accepted | d = int(input())
a = 'Christmas'
b = ' Eve'
if d == 25:
print(a)
elif d == 24:
print(a + b)
elif d == 23:
print(a + b * 2)
else:
print(a + b * 3) |
p03038 | s989608938 | Accepted | n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for i in range(m)]
a.sort()
bc.sort(key=lambda x: x[1],reverse=True)
# print(a)
# print(bc)
i=0
for b,c in bc:
tb=b
while tb>0:
if n==i:
break
if a[i]>=c:
break
a[i]=c
tb-=1
i+=1
if n==i:break
if a[i]>=c :
break
print(sum(a)) |
p03835 | s092348535 | Wrong Answer | a,sums=list(map(int,input().split()))
if a*3==sums:
print(1)
else:
ret=0
mai=2 if sums%3==0 & sums // 3 <= a else 0
for x in range(a+1):
if sums-x <2*a:
for y in range(a+1):
if sums-x-y<a:
if (sums-x-y == x) | (sums-x-y == y):
ret+=1
else:
ret+=2
if sums-x == 2*a:
ret+=1
print(ret-mai) |
p02910 | s093062025 | Wrong Answer | s = list(input())
ans = [0]*(len(s))
for i in range(len(s)):
if i%2 == 0:
if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
ans[i] = 1
else:
if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
ans[i] = 1
if len(set(ans)) == 2:
print('No')
else:
print('Yes') |
p02612 | s582727937 | Accepted | N = int(input())
n = N//1000
if n * 1000 != N:
n += 1
print(1000*(n)-N) |
p03073 | s128812419 | Accepted | l=str(input())
n=0
for i in range(len(l)):
if i%2==0 and l[i]=='0':
n+=1
if i%2==1 and l[i]=='1':
n+=1
print(min(n,len(l)-n)) |
p03693 | s886666092 | Wrong Answer | import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
r, g, b = map(int, input().split()) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字
t = r ** 100 + g * 10 + b
if t % 4 == 0:
print('YES')
else:
print('NO') |
p02829 | s797672805 | Accepted | print(6-int(input())-int(input()))
|
p02713 | s849723536 | Accepted | from math import gcd
K = int(input())
c = 0
for i in range(1,K+1):
for j in range(1,K+1):
k = gcd(i,j)
for l in range(1,K+1):
a = gcd(k, l)
c += a
print(c) |
p02595 | s614808729 | Accepted | n, d = map(int, input().split())
ans = 0
for i in range(n):
a, b = map(int, input().split())
if a**2 + b**2 <= d**2:
ans += 1
print(ans) |
p02836 | s277511507 | Accepted | s = input()
ans = 0
for i in range(len(s) // 2):
if s[i] != s[-i-1]:
ans+=1
print(ans) |
p02958 | s525515122 | Accepted | def myAnswer(N:int,P:list) -> str:
flag = False
for i in range(N):
if(i+1 != P[i]):
if(flag):
return "NO"
flag = True
P[P.index(i + 1)] = P[i]
P[i] = i + 1
return "YES"
def modelAnswer():
return
def main():
N = int(input())
P = list(map(int,input().split()))
print(myAnswer(N,P))
if __name__ == '__main__':
main() |
p04011 | s053722782 | Wrong Answer | n=int(input())
k=int(input())
x=int(input())
y=int(input())
if k<n:
print(k*x+(n-k)*y)
else:
print(k*x) |
p02959 | s200622454 | Accepted | f=lambda:map(int,input().split())
input()
p,*A=f()
B=f()
monster = 0
for a,b in zip(A, B):
t = min(b, p+a)
p = a - max(0, t-p)
monster += t
print(monster) |
p02900 | s769578857 | Accepted | A, B = map(int, input().split())
a, b = A, B
while b != 0:
a, b = b, a % b
prod = 1
s = 1
p = 2
g = a
while a != 1:
i = 0
while a % p == 0:
i += 1
a //= p
prod *= p
if i != 0:
s += 1
p += 1
if p > int(g**(1/2)) and prod != g:
s += 1
break
print(s) |
p02576 | s830675957 | Accepted | N, X, T = list(map(int, input().split()))
if N%X == 0:
print((N//X)*T)
else:
print((N//X)*T+T) |
p02641 | s538905980 | Wrong Answer | import sys
x,n = map(int,input().split())
if n == 0:
print(x)
sys.exit()
p,f = x-1,x+1
bans = set(map(int,input().split()))
while True:
if p not in bans:
print(p)
break
p -= 1
if f not in bans:
print(f)
break
f += 1 |
p03472 | s609053402 | Accepted | N,H = [int(x) for x in input().split()]
from collections import deque
import math
c = []
d = []
for i in range(N):
e,f = [int(x) for x in input().split()]
c.append(e)
d.append(f)
c.sort()
d.sort()
b = deque(d)
count = 0
while b:
x = b.pop()
if x > c[-1]:
H -= x
count += 1
if H <= 0:
print(count)
exit()
count += math.ceil(H/c[-1])
print(count) |
p03286 | s593018661 | Accepted | s=""
n=int(input())
if n==0:print(0)
else:
while n!=0:s=str(n%2)+s;n=-(n//2)
print(s) |
p02596 | s020252929 | Accepted | def main():
K = int(input())
if K % 2 == 0 or K % 5 == 0:
print(-1)
return
cnt = 1
tmp = 7
while tmp % K != 0:
tmp = tmp * 10 + 7
tmp %= K
cnt += 1
print(cnt)
main()
|
p03317 | s979836985 | Accepted | N,K=map(int,input().split())
*A,=map(int,input().split())
print((N-2)//(K-1)+1) |
p02732 | s443402788 | Wrong Answer | N = int(input())
A = [int(i) for i in input().split()]
C = [0 for i in range(N)]
for value in A:
C[value - 1] += 1
print(C)
ways_all = 0
for i in range(N):
ways_all += (C[i] * (C[i] - 1)) // 2
print(ways_all)
for value in A:
print(ways_all - C[value - 1] + 1) |
p03106 | s796823941 | Wrong Answer | def main():
a, b, k = map(int, input().split())
count = 0
for i in range(1, max(a, b)):
if a % i == 0 and b % i == 0:
count += 1
if count == k:
print(i)
return
if __name__ == "__main__":
main()
|
p03293 | s413852790 | Accepted | print("Yes" if input() in input()*2 else "No") |
p03251 | s303676652 | Wrong Answer | import sys
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
d=min(y)-max(x)
if d<=0:
print("War")
sys.exit()
else:
for i in range(d+1):
Z=X+i
if (Z<=X or Z>Y) or (max(x)>=Z or min(y)<Z):
print("War")
sys.exit()
print("No War") |
p02596 | s361538300 | Wrong Answer | N = int(input())
if N % 2 == 0:
print(-1)
exit()
n7 = 0
for i in range(6):
n7 += 7*(10**(i))
if n7 % N == 0:
print(i+1)
exit()
print(-1) |
p02959 | s050692096 | Accepted | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
for i in range(n):
if b[i] <= a[i]:
count = count + b[i]
elif a[i] < b[i]:
count = count + a[i]
b[i] = b[i] - a[i]
if a[i+1] <= b[i]:
count = count + a[i+1]
a[i+1] = 0
elif b[i] < a[i+1]:
count = count + b[i]
a[i+1] = a[i+1] - b[i]
print(count) |
p04045 | s594959190 | Accepted | N, K = list(map(int, input().split()))
D = set(map(str, input().split()))
ans = N
while True:
ans_set = set(str(ans))
if ans_set & D:
ans += 1
else:
break
print(ans) |
p02639 | s464089388 | Accepted | list = [int(i) for i in input().split()]
for i in range(5):
if list[i]==0:
print(i+1) |
p03592 | s659941727 | Accepted | n,m,k=map(int,input().split())
n,m=min(n,m),max(n,m)
for i in range(n//2+n%2):
num,dem=k-i*m,n-2*i
if num%dem or not(0<=num//dem<=m):continue
print("Yes");exit()
print("No") |
p03986 | s548593111 | Accepted | s=input()
n = len(s)
impossible = 0
num_s = 0
for v in s:
if v=="S":
num_s += 1
else:
if num_s==0:
impossible += 2
else:
num_s -= 1
print(impossible) |
p03485 | s030709652 | Accepted | import math
a, b = (int(t) for t in input().split())
x = (a + b) / 2
print(math.ceil(x)) |
p02547 | s791743981 | Accepted | N=int(input())
sum=0
ans="No"
for i in range(N):
d=list(map(int,input().split()))
if d[0]==d[1]:
sum+=1
if sum>2:
ans="Yes"
break
else:
sum=0
print(ans) |
p03457 | s808191957 | Wrong Answer | n = int(input())
flag = True
for _ in range(n):
t, x, y = map(int, input().split())
if t < x + y or (x + y + t) % 2:
flag = False
print("Yes" if flag else "No") |
p02594 | s645697678 | Accepted | print(['No', 'Yes'][int(input()) >= 30]) |
p03544 | s900780390 | Accepted | def solve():
N = int(input())
L0 = 2
L1 = 1
if N == 1:
print(L1)
exit()
Li2 = L0
Li1 = L1
Li = Li1 + Li2
for _ in range(N - 2):
Li2 = Li1
Li1 = Li
Li = Li1 + Li2
print(Li)
if __name__ == "__main__":
solve() |
p03146 | s424711461 | Accepted | a1 = int(input())
calRList = []
calRList.append(a1)
i = 0
while True:
if calRList[i] % 2 == 0:
calRList.append(calRList[i]//2)
else:
calRList.append(3*calRList[i]+1)
if calRList.count(calRList[i+1]) > 1:
#index合わせ
print((i+1)+1)
break
i+=1
|
p02766 | s788947087 | Wrong Answer | a = list(map(int, input().split()))
b = a[0]
c = 0
while b > 0:
b = b / a[1]
c += 1
print(c)
|
p02811 | s846285927 | Accepted | K, X = map(int, input().split())
if 500*K >= X:
print('Yes')
else:
print('No')
|
p03105 | s154477109 | Accepted | a,b,c=map(int,input().split())
print(min(b//a,c)) |
p03485 | s013360108 | Accepted | a, b = map(int, input().split())
print(-((-(a+b)) // 2)) |
p03061 | s007144134 | Accepted | from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
left = []
right = []
left.append(a[0])
for i in range(1,n-1):
left.append(gcd(left[-1],a[i]))
a = a[::-1]
right.append(a[0])
for i in range(1,n-1):
right.append(gcd(right[-1],a[i]))
ans = 1
for i in range(n-1):
ans = max(ans,gcd(left[i],right[n-i-3]))
ans = max(ans,left[n-2],right[n-2])
print(ans)
|
p03486 | s356791138 | Wrong Answer | s = ''.join(sorted(input()))
t = ''.join(sorted(input(), reverse=True))
if s < t:
print('Yes')
else:
print('NO') |
p02793 | s110057052 | Accepted | N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
a = 1
for i in range(N):
a = lcm(a, A[i])
ans = 0
for i in range(N):
ans += a * pow(A[i], mod-2, mod)
print(ans % mod) |
p02729 | s832184945 | Wrong Answer | N,M=map(int,input().split())
print(((N*(N-1))/2)+((M*(M-1))/2))
|
p03239 | s547311895 | Wrong Answer | N, T = map(int, input().split())
CT = [tuple(map(int, input().split())) for _ in range(N)]
ans = 101010
for c, t in CT:
if t <= T:
ans = min(ans, c)
print(ans if ans <= T else 'TLE') |
p03745 | s692749532 | Accepted | n=int(input())
a=list(map(int,input().split()))
up=0
down=0
count = 0
x=a[0]
for i in range(n):
if x==a[i]:
continue
elif x<a[i]:
if down==0:
up=1
else:
down=0
up=0
count+=1
else:
if up==0:
down=1
else:
down=0
up=0
count+=1
x=a[i]
print(count+1) |
p03379 | s573974175 | Accepted | n=int(input())
a=list(map(int,input().split()))
A=sorted(a)
m1=A[n//2 -1]
m2=A[n//2]
for i in range(n):
if a[i]<=m1:
print(m2)
else:
print(m1) |
p02631 | s907959123 | Accepted | n = int(input())
A = list(map(int, input().split()))
total_xor = 0
for a in A:
total_xor ^= a
result = []
for a in A:
result += [str(total_xor ^ a)]
print(' '.join(result))
|
p03324 | s998223532 | Accepted | def resolve():
D, N = list(map(int, input().split()))
ls = [100 ** D * i for i in range(1, 100)]
ls.append(100 ** D * 101)
print(ls[N-1])
return
resolve() |
p02959 | s490964245 | Accepted | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sumMonster = sum(A)
for i in range(N):
if B[i] >= A[i]:
A[i+1] -= B[i] - A[i]
if A[i+1] < 0:
A[i+1] = 0
A[i] = 0
else:
A[i] -= B[i]
print(sumMonster-sum(A)) |
p03136 | s216428322 | Wrong Answer | n = int(input())
l = list(map(int,input().split()))
l.sort()
sum = 0
print(l[0])
for i in range(n-1):
sum += l[i]
if (sum <= l[n-1]):
print("No")
else:
print("Yes") |
p02640 | s774359513 | Accepted | X, Y=map(int,input().split())
T=4*X-Y
K=Y-2*X
if T>=0 and K>=0 and T%2==0 and K%2==0:
print("Yes")
else:
print("No") |
p02660 | s389808273 | Accepted | from subprocess import*
p=run(('factor',input()),stdout=PIPE).stdout.split()[1:]
print(sum(int((8*p.count(i)+1)**.5/2-.5)for i in set(p))) |
p02690 | s684332660 | Wrong Answer | from bisect import bisect_right as br
mem=[]
for i in range(101):
mem.append(i**5)
#print(mem)
x=int(input())
idx=br(mem,x)
a=idx-1
x-=mem[idx-1]
#print(x)
idx1=br(mem,abs(x))
#print(idx1)
if x>0:
b=idx1-1
else:
b=-(idx1-1)
print(a,b)
|
p03067 | s114432188 | Accepted | a,b,c = map(int, input().split())
if a < c < b or b < c < a:
print('Yes')
else:
print('No') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.