problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03261 | s947907569 | Accepted | N = int(input())
s = set()
word = input()
s.add(word)
tmp = word[-1]
is_ng = False
for i in range(N-1):
word = input()
if word[0] != tmp:
is_ng = True
break
if word in s:
is_ng = True
break
tmp = word[-1]
s.add(word)
print('YNeos'[is_ng::2]) |
p03943 | s316685121 | Accepted | # -*- coding: utf-8 -*-
import heapq
a,b,c = map(int, input().split())
l = [a,b,c]
l2 = heapq.nsmallest(3, l)
if (l2[0] + l2[1]) == max(l):
print('Yes')
else:
print('No')
|
p02756 | s848399800 | Accepted | from collections import deque
S = input()
Q = int(input())
li = []
for i in range(Q):
li.append(list(input().split()))
flag = False
sq = deque(S)
for i in range(Q):
if li[i][0] == "1":
flag = not flag
else:
if (li[i][1] == "1" and not flag) or (li[i][1] == "2" and flag):
sq.appendleft(li[i][2])
else:
sq.append(li[i][2])
sq = list(sq)
if flag:
sq.reverse()
for i in range(len(sq)):
print(sq[i], end="") |
p02831 | s489948698 | Accepted | # coding:utf-8
import sys
import math
import time
import numpy as np
import collections
def gcd(m,n):
x = max(m,n)
y = min(m,n)
if x%y == 0:
return y
else:
while x%y != 0:
z = x%y
x = y
y = z
else:
return z
#X = str(raw_input()).split()
AB = str(raw_input()).split()
A = int(AB[0])
B = int(AB[1])
ans = A * B / gcd(A,B)
print(ans);
|
p02888 | s467641867 | Wrong Answer | import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
a = sorted(list(set(l)))
ans = 0
for b in range(n - 2):
for c in range(b + 1,n - 1):
left = bisect.bisect_left(a,l[c] + l[b])
ans+=left - c - 1
print(ans) |
p02555 | s639114872 | Accepted | s = int(input())
n = s // 3
cnt = [0] * n
import math
def comb(x, y):
return math.factorial(x) // (math.factorial(x - y) * math.factorial(y))
for i in range(1, n + 1):
rem = s - 3 * i
cnt[i - 1] = comb(rem + (i - 1), i - 1)
print(sum(cnt) % (10**9 + 7)) |
p02859 | s250654526 | Accepted | # ABC 145: A – Circle
print(int(input()) ** 2) |
p03274 | s142838055 | Wrong Answer | n,k = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]
if len(x) == 1:
print(abs(0-x[0]))
else:
ans = 10 ** 8
for i in range(n-k):
tmp = min(abs(x[i]), abs(x[i+k-1]))
ans = min(ans,tmp+abs(x[i+k-1]-x[i]))
print(ans)
|
p02910 | s266302544 | Accepted | S = input()
FLG = True
for i,step in enumerate(S):
if step in "UD":
continue
if step == "L" and i % 2 == 0:
FLG = False
break
if step == "R" and i % 2 == 1:
FLG = False
break
if FLG:
print("Yes")
else:
print("No") |
p02646 | s021258011 | Accepted | a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
num1=abs(a-b)
if v<=w:
print("NO")
else:
num2=v-w
num3=num1/num2
if num3<=t:
print("YES")
else:
print("NO")
|
p02835 | s646507548 | Accepted | A=list(map(int,input().split()))
print("bust" if sum(A)>=22 else "win") |
p02843 | s368857028 | Accepted | X = int(input())
# dp[i]:= ちょうどi円となる買い物が存在するorしない
dp = [0] * (X+1)
dp[0] = 1
for i in range(X):
if dp[i] == 1:
for next in [100,101,102,103,104,105]:
if i+next<=X:
dp[i+next] = 1
print(dp[X]) |
p02661 | s190869648 | Wrong Answer | n = int(input())
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab.sort()
a, b = map(list, zip(*ab))
a.sort()
b.sort(reverse=True)
a1, b1 = a[n//2], b[n//2]
a2, b2 = a[n//2-1], b[n//2-1]
ans = b1 - a1 + 1 if b1 >= a1 else 0
if n % 2 == 0:
ans += int((b1+b2)/2 - (a1+a2)/2)
if (b1+b2)%2 or (a1+a2)%2: ans += 1
print(ans)
|
p02994 | s664550807 | Accepted | #%%
N, L = map(int, input().split())
aji = [L+i-1 for i in range(1, N+1)]
total = sum(aji)
if aji[0] <= 0 and 0 <= aji[-1]:
ans = total
elif aji[-1] < 0:
ans = total - aji[-1]
else:
ans = total - aji[0]
print(ans)
|
p02682 | s687117540 | Wrong Answer | a, b, c, k = list(map(int, input().split()))
if k<=b:
print(k)
elif b<k<=b+a:
print(b)
else:
print(2*b-k+a) |
p03836 | s820717661 | Accepted | x,y,a,b=map(int,input().split())
a=a-x ; b=b-y
ans="R"*a + "U"*b + "L"*a + "D"*(b+1) + "R"*(a+1) + "U"*(b+1) + "L"
ans+="U" + "L"*(a+1) + "D"*(b+1) + "R"
print(ans)
|
p02607 | s216631302 | Accepted | n = int(input())
a = list(map(int, input().split()))
cnt = 0
for n1, i in enumerate(a):
if n1 % 2 == 0:
if i % 2 == 1:
cnt += 1
print(cnt)
|
p02546 | s372324650 | Accepted | S = input()
if(S.endswith('s')):
print(S+'es')
else:
print(S+'s') |
p02708 | s457472299 | Accepted | import itertools
N, K = map(int, input().split())
t = 0
for i in range(K,N+2):
st = int((i*(0+i-1))/2)
ed = int((i*(N-i+N+1))/2)
t += (ed - st + 1)
t %= 10**9 + 7
print(t) |
p02786 | s751234856 | Accepted | H = int(input())
n = 0
while 2**n <= H:
n += 1
print(2**n-1) |
p02847 | s047954051 | Wrong Answer | #基準曜日の取得
S = input()
# 入力された内容をもとに次の日曜日までの日数を表示
if S == "SUT":
print(1)
elif S == "FRI":
print(2)
elif S == "THU":
print(3)
elif S == "WED":
print(4)
elif S == "TUE":
print(5)
elif S == "MON":
print(6)
elif S == "SUN":
print(7)
else:
print("入力内容が間違っています。") |
p02778 | s877981137 | Accepted | st = input()
s = ["x" for i in range(len(st))]
print("".join(s)) |
p02711 | s323939741 | Accepted | N = input()
if N[0] == '7' or N[1] == '7' or N[2] == '7':
print("Yes")
else:
print("No") |
p02713 | s471823637 | Accepted | from numpy import*;f=gcd.outer;r=range(1,int(input())+1);print(sum(f(f(r,r),r))) |
p02790 | s815751561 | Accepted | a, b = map(int, input().split())
a1 = a * str(b)
a2 = b * str(a)
print(min(a1, a2)) |
p03854 | s250596875 | Wrong Answer | S=input()
S=S.replace('dreamer','')
S=S.replace('aser','')
S=S.replace('ace','')
S=S.replace('eraser','')
S=S.replace('erase','')
S=S.replace('dream','')
if S=='':
print('YES')
else:
print('NO') |
p02627 | s220191368 | Accepted | n = input()
s = "abcdefghijklmnopqrstuvwxyz"
if n in s:
print("a")
else:
print("A")
|
p02888 | s750921030 | Wrong Answer | N=int(input())
listL=list(map(int,input().split()))
listL.sort()
ans=0
for i in range(N-1,2,-1):
for k in range(i-1,1,-1):
t=k//2
d=listL[i]-listL[k]
while (d-listL[t]<=0 or d-listL[t-1]>0) and t!=0 and t!=k-1:
third=listL[t]
if d-third>0:
t=t//2
else:
t=t+(k-t)//2
if t<k:
ans+=k-t
print(ans) |
p02912 | s489529139 | Accepted | import heapq
cnt, ticket = map(int, input().split())
lst = list(map(lambda i:int(i) * (-1) , input().split()))
heapq.heapify(lst)
for _ in range(ticket):
tmp_min = heapq.heappop(lst)
heapq.heappush(lst, (-1) * (-tmp_min//2))
print(-sum(lst)) |
p03252 | s643598565 | Accepted | from collections import Counter
s = input()
t = input()
#文字の順番入れ替えは可能
#文字の個数は増やせない
#結局はaabbbなら2,3になる
#abcdbならa:1,b:2,c:1,d:1
s_dict = Counter(s)
t_dict = Counter(t)
s_val = list(s_dict.values())
t_val = list(t_dict.values())
s_val.sort()
t_val.sort()
if s_val == t_val:
print('Yes')
else:
print('No')
|
p03665 | s026733587 | Accepted | from math import factorial
def cmb(n,r):
return factorial(n)//(factorial(n-r)*factorial(r))
n,p=map(int,input().split())
A=list(map(int,input().split()))
A=[A[i]%2 for i in range(n)]
cnt=A.count(0)
B=2**cnt
ans=0
for i in range(p,n-cnt+1,2):
ans +=cmb(n-cnt,i)
print(ans*B) |
p03435 | s632056825 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def main():
C = [list(map(int, input().split())) for _ in range(3)]
rumor = True
for i in range(1, 3):
diff1 = C[i][0] - C[0][0]
diff2 = C[i][1] - C[0][1]
diff3 = C[i][2] - C[0][2]
if diff1 != diff2 or diff2 != diff3 or diff1 != diff3:
rumor = False
break
if rumor: print("Yes")
else: print("No")
if __name__ == "__main__":
main()
|
p03796 | s586775202 | Accepted | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))
n = inp()
res = 1
for i in range(n):
res *= i+1
res %= mod
print(res) |
p03481 | s365906805 | Wrong Answer | import math
x,y=map(int,input().split())
print(int(math.log2(y/x))+1) |
p02712 | s120359011 | Accepted | n=int(input())
sum=0
for i in range(n):
if (i+1) % 3 !=0:
if (i+1)%5 !=0:
sum+=i+1
print(sum) |
p02719 | s251647673 | Accepted | n, k = map(int, input().split())
x = n % k
ans = min(x, abs(k - x))
print(ans)
|
p02628 | s397510682 | Wrong Answer | N, K = input().split()
p = list(input().split())
p = list(map(int, p))
p = p.sort()
buy = 0
for item in range(int(K)):
buy += item
print(buy) |
p02813 | s093289140 | Accepted | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
N = int(readline())
P = tuple(map(int,readline().split()))
Q = tuple(map(int,readline().split()))
permutations = list(itertools.permutations(range(1,N+1)))
p = permutations.index(P)
q = permutations.index(Q)
answer = abs(p - q)
print(answer) |
p02970 | s500704167 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n,d=map(int, input().split())
print(-(-n//(2*d+1)))
resolve() |
p03719 | s781733719 | Accepted | a, b, c = map(int, input().split())
if a <= c <= b:
print('Yes')
else:
print('No') |
p02641 | s711592388 | Accepted | x,n=map(int,input().split())
p=list(map(int,input().split()))
ans=0
num=0
while ans==0:
if (x+num) not in p:
ans=x+num
if (x-num) not in p:
ans=x-num
if ans==0:
break
num+=1
print(ans) |
p02838 | s780621354 | Accepted | n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
bits = [0]*60
for x in a:
i = 0
while x > 0:
if x % 2 == 1:
bits[i] += 1
x //= 2
i += 1
ans = 0
for i in range(60):
ans += (bits[i] * (n-bits[i])) * pow(2, i, mod)
ans %= mod
print(ans) |
p02747 | s324612004 | Accepted | print("No" if input().replace("hi", "") else "Yes") |
p03627 | s916450801 | Wrong Answer | from collections import Counter
N = int(input())
A = sorted(list(map(int,input().split())),reverse=True)
A = Counter(A)
check = 0
for key,value in A.items():
if value >= 4 and check == 0:
print(key * 2)
break
elif value >= 2 and check == 0:
tmp = key
check += 1
elif value >= 2 and check == 1:
print(tmp * key)
break
else:
print(0) |
p03485 | s876672567 | Wrong Answer | import math
a, b = map(int, input().split())
print(math.ceil(a*b/2)) |
p02959 | s310972184 | Accepted | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
M = sum(A)
for i in range(N):
K = min(A[i], B[i])
A[i] -= K
A[i+1] -= B[i] - K
A[i+1] = max(0, A[i+1])
print(M - sum(A)) |
p03994 | s520040355 | Wrong Answer | s = list(input())
k = int(input())
#print(ord("z"))
for i in range(len(s)):
if 123 - ord(s[i]) <= k:
k -= (123 - ord(s[i]))
s[i] = 'a'
#print(k)
#print(s, k)
k %= 26
if ord(s[-1]) + k > 122:
s[-1] = chr(ord(s[-1]) + k - 26)
else:
s[-1] = chr(ord(s[-1]) + k)
ans = ""
for i in s:
ans += i
print(ans) |
p02754 | s830538959 | Accepted | N,A,B = map(int, input().split())
if A == 0:
print(0)
exit()
if N <= A:
print(N)
exit()
set_count = N // (A+B)
extra = N % (A+B)
if extra <= A:
print(set_count*A + extra)
exit()
else:
print(set_count*A + A)
exit() |
p02627 | s543553961 | Accepted | s=input()
n=ord(s)
if 65<=n<=90:
print("A")
else:
print("a") |
p02843 | s542563794 | Wrong Answer | x = int(input())
if x >= 2000:
print(1)
elif x < 100*(x//105+1):
print(0)
else:
print(1) |
p02594 | s341658007 | Wrong Answer | import sys
input = sys.stdin.readline
def inp():
return(int(input()))
T = inp()
print("NO") if T<30 else print("YES") |
p03251 | s307790628 | Accepted | N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
war_flag = True
for z in list(range(X+1, Y+1)):
if max(x) < z and min(y) >= z:
war_flag = False
break
if war_flag:
print('War')
else:
print('No War') |
p02597 | s927737738 | Accepted | n = int(input())
c = list(input())
sum_r, sum_w = [0], [0]
s1, s2 = 0, 0
for v in c:
if v == 'R':
s1 += 1
else:
s2 += 1
sum_r.append(s1)
sum_w.append(s2)
res = float('inf')
for i in range(n+1):
res = min(res, max(sum_w[i], s1 - sum_r[i]))
print(res) |
p02952 | s564630719 | Wrong Answer | #<B>
N = input()
ans = 0
for i in range(1, int(N)):
if len(str(i)) % 2 != 0:
ans += 1
print(ans) |
p02717 | s220233804 | Accepted | # a
a,b,c = input().split(" ")
print("{} {} {}".format(c,a,b)) |
p03720 | s443400324 | Accepted | N, M = map(int, input().split())
a = [0 for i in range(M)]
b = [0 for i in range(M)]
cnt = [0 for i in range(N)]
for i in range(M):
a[i], b[i] = map(int, input().split())
for i in range(M):
cnt[a[i]-1] += 1
cnt[b[i]-1] += 1
for i in range(N):
print(cnt[i]) |
p02711 | s315528663 | Accepted | N = str(input())
if '7' in N:
print('Yes')
else:
print('No') |
p02677 | s854717439 | Accepted | import math
if __name__=="__main__":
# Problem c
A, B, H, M = map(int, input().split(' '))
total_min = H*60 + M
A_rad = 2*math.pi/720 * total_min
B_rad = 2*math.pi/60 * M
angle = A_rad-B_rad
length_pow = A**2 + B**2 - 2*A*B*math.cos(angle)
print(length_pow**(1/2)) |
p02687 | s118402217 | Accepted | S = input()
if S == "ABC":
print("ARC")
elif S == "ARC":
print("ABC") |
p03721 | s366247102 | Accepted | N,K = map(int,input().split())
cnt = 0
d = []
for _ in range(N):
a,b = map(int,input().split())
d.append((a,b))
for i,j in sorted(d):
cnt += j
if cnt >= K:
print(i)
break |
p02629 | s090353868 | Wrong Answer | n = int(input())
a = 26
c = 1
res =""
t = ""
num2alpha = lambda c: chr(c+64)
while True:
if n <= a:
break
a *= 26
c += 1
for i in range(c):
t = num2alpha(int(n % 26))
if t == "@":
t = "z"
res = t + res
n = n / 26
print(str.lower(res)) |
p02832 | s934494008 | Wrong Answer | # ABC148D - Brick Break
def main():
N, *A = map(int, open(0).read().split())
remaining = 0
cur = 0 # current index
for target in range(1, N + 1):
be_kept = False
for i in range(cur, N):
if A[i] == target:
remaining += 1
cur += 1
be_kept = True
break
if not be_kept:
break
print(N - remaining if remaining else -1)
if __name__ == "__main__":
main()
|
p02923 | s146704742 | Wrong Answer | N = int(input())
a = list(map(int, input().split()))
pos = 0
temp = 0
cnt = 0
i = 1
while i < N:
pos = min(a[i - 1], a[i])
if a[i] == pos:
cnt += 1
else:
if cnt > temp:
temp = cnt
cnt = 0
i += 1
print(cnt) |
p04020 | s111915785 | Accepted | n = int(input())
a = []
from collections import Counter
for _ in range(n):
a.append(int(input()))
a = [0] + a
cursum = 0
ans = 0
for i in range(1,n+1):
if a[i] == 0:
ans += cursum // 2
cursum = 0
else:
cursum += a[i]
ans += cursum // 2
print(ans) |
p02727 | s766709853 | Accepted | import sys
#from collections import deque
input = sys.stdin.buffer.readline
x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int,input().split())),reverse=True)
q = sorted(list(map(int,input().split())),reverse=True)
r = sorted(list(map(int,input().split())),reverse=True)
ans = p[:x]
ans[x:x] = q[:y]
ans += r
ans = sorted(ans,reverse=True)
print(sum(ans[:x+y])) |
p03360 | s636935852 | Accepted | a,b,c=map(int,input().split())
k = int(input())
max_num = max(max(a,b),c)
print(a+b+c+max_num*2**k-max_num) |
p02775 | s739670556 | Accepted | N = input()[::-1]
dp1 = [0]
dp2 = [1]
for x in N:
x = int(x)
r = dp1[-1]+x
if x<9: r = min(r, dp2[-1]+x+1)
dp1.append(r)
dp2.append(min(dp1[-2]+10-x, dp2[-1]+9-x))
print(min(dp1[-1],dp2[-1]+1)) |
p03126 | s353790842 | Accepted | n, m = map(int, input().split())
fset = set([i for i in range(1, m + 1)])
allset = fset
for i in range(n):
temp = set(list(map(int, input().split()))[1:])
fset = fset - (allset - temp)
print(len(fset)) |
p03494 | s112735707 | Wrong Answer | #!/usr/bin/python3
import sys
n = input()
l = list(map(int, input().split()))
loop = 0
while (1):
for i in l:
print('loop', loop)
if i % (2 ** loop + 1) != 0:
print(loop)
sys.exit(0)
loop = loop + 1 |
p02847 | s630581561 | Accepted | S = input()
if S == 'SUN':
print('7')
elif S == 'MON':
print('6')
elif S == 'TUE':
print('5')
elif S == 'WED':
print('4')
elif S == 'THU':
print('3')
elif S == 'FRI':
print('2')
elif S == 'SAT':
print('1') |
p03438 | s566985793 | Accepted | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
biggerA = 0
biggerB = 0
for ai, bi in zip(a, b):
if ai > bi:
biggerA += ai - bi
if ai < bi:
biggerB += (bi - ai) // 2
if biggerB >= biggerA:
print("Yes")
else:
print("No")
|
p03281 | s923260804 | Accepted | #nの約数列挙
#-------------------------------------------------------------------------
def divisor(n):
ass = []
for i in range(1,int(n**0.5)+1):
if n%i == 0:
ass.append(i)
ass.append(n//i)
return ass #sortされていない
#-------------------------------------------------------------------------
# テスト
N = int(input())
cnt = 0
for i in range(N+1):
if i%2 == 1 and len(divisor(i)) == 8:
cnt += 1
print(cnt) |
p03146 | s544682268 | Wrong Answer | s = int(input())
sl = [s]
count = 2
for i in range(100):
s_next = 0
if sl[i]%2 == 0:
s_next = sl[i]//2
sl.append(s_next)
else:
s_next = 3*sl[i]+1
sl.append(s_next)
if sl.count(s_next) > 1:
print(count)
break
count += 1 |
p02554 | s334535979 | Wrong Answer | #!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 10**9 + 7
n = int(input())
ret = pow(10, n, MOD)
ret -= pow(9, n, MOD)
ret -= pow(9, n, MOD)
ret += pow(8, n, MOD)
print(ret) |
p02854 | s748267282 | Accepted | n = int(input())
li = list(map(int,input().split()))
s = sum(li)
sum_li = []
for i,l in enumerate(li):
if i == 0:
sum_li.append(l)
continue
sum_li.append(sum_li[-1]+l)
all_li = []
for ii,ss in enumerate(sum_li):
if ii == len(sum_li)-1:
break
all_li.append(abs(s-2*ss))
#print(all_li)
print(min(all_li)) |
p02583 | s526502212 | Accepted | N=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(N-2):
for j in range(i+1,N-1):
for k in range(j+1,N):
if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i] and l[i]+l[j]>l[k] and l[i]+l[k]>l[j] and l[k]+l[j]>l[i]:
ans+=1
print(ans) |
p03030 | s658545043 | Accepted | N = int(input())
l = []
for i in range(N):
s, p = input().split()
l.append((s, int(p), i+1))
l.sort(key=lambda x:(x[0],-x[1]))
for _, _, i in l:
print(i) |
p02888 | s031450138 | Accepted | from bisect import bisect_left
n = int(input())
l = list(map(int, input().split()))
l.sort()
cnt = 0
for i in range(n-2):
a = l[i]
for j in range(i+1, n-1):
b = l[j]
cnt += bisect_left(l, a+b) - j - 1
# bisec_left(l, x)でlの中にxを挿入できる点を探す
print(cnt)
|
p02912 | s760396926 | Accepted | import sys
import heapq
import math
input = sys.stdin.readline
n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)
for i in range(m):
max_a = heapq.heappop(a)
max_a /= 2
heapq.heappush(a, max_a)
for i in range(n):
a[i] = math.floor(-a[i])
print(sum(a))
|
p03338 | s067281072 | Wrong Answer | n = int(input())
s = list(input())
half = int(n/2)
max1 = 0
for i in range(half):
f = set(s[:half-i])
b = set(s[half-i:])
union = len(f&b)
if max1 > union:
break
else:
max1 = union
max2 = 0
for i in range(half):
f = set(s[:half+i])
b = set(s[half+i:])
union = len(f&b)
if max2 > union:
break
else:
max2 = union
ans = max1 if max1>max2 else max2
print(ans) |
p03644 | s170362791 | Accepted | n = int(input())
def div(x):
global count
if x%2==1:
return count
else:
count += 1
return div(x//2)
m = -1
for i in range(n):
count = 0
r = div(i+1)
if m < r:
m = r
ans = i+1
print(ans)
|
p03556 | s202402530 | Accepted | N = int(input())
print(int(N**0.5)**2) |
p03241 | s438020012 | Accepted | import sys
from math import sqrt
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()
def main():
N,M=map(int,input().split())
ans=0
for i in range(1,int(sqrt(M))+1):
if M%i==0:
if M//i>=N:
ans=max(ans,i)
if i>=N:
ans=max(ans,M//i)
print(ans)
if __name__ == '__main__':
main()
|
p03210 | s704212948 | Accepted | x = int(input())
if x in [7,5,3]:
print("YES")
else:
print("NO") |
p03627 | s749848345 | Accepted | import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
p = list(c.items())
p.sort(reverse = True)
tate = 0
yoko = 0
for k , v in p:
if tate == 0 and v >= 4:
tate = k
yoko = k
break
elif tate == 0 and 2 <= v <= 3:
tate = k
elif tate != 0 and v >= 2:
yoko = k
break
print(tate*yoko) |
p03013 | s699173573 | Accepted | n,m = map(int,input().split())
stairs = [True for _ in range(n+1)]
broken_stairs = [int(input()) for i in range(m)]
mod = 10**9+7
for i in broken_stairs:
stairs[i] = False
dp = [0]*(n+1)
if stairs[1]:
dp[1] = 1
if stairs[0]:
dp[0] = 1
for i in range(2,n+1):
if stairs[i]:
dp[i] = dp[i-1] + dp[i-2]
dp[i] %= mod
else:
dp[i] = 0
print(dp[-1]) |
p02765 | s258243127 | Accepted | [N,R] = list(map(int,input().split()))
if N>=10:
I=R #内部レーティング
else:
I=R+100*(10-N)
print(I)
|
p03617 | s154339125 | Accepted | a = input().split()
q = int(a[0]) * 4
h = int(a[1]) * 2
s = int(a[2])
t = int(min([q,h,s]))
d = int(a[3])
b = int(input())
if min([t,d/2]) == t:
print(int(b * t))
else:
print(int((b // 2) * d + (b % 2) * t)) |
p02730 | s388669765 | Accepted | s = input()
n = len(s)
s1 = s[:(n-1)//2]
s2 = s[(n+3)//2-1:n]
if s != s[::-1] or s1 != s1[::-1] or s2 != s2[::-1]:
print('No')
else:
print('Yes') |
p03611 | s709650855 | Accepted | n = int(input())
a = list(map(int, input().split()))
al = [0]*(10**5+2)
for i in a:
al[i] += 1
al[i+1] += 1
al[i+2] += 1
print(max(al)) |
p03472 | s761414485 | Accepted | N,H = map(int,input().split(" "))
a = [0] * N
b = [0] * N
for i in range(N):
a[i],b[i] = map(int,input().split(" "))
a.sort(reverse = True)
b.sort(reverse = True)
c = 0
while(b[c] > a[0]):
H -= b[c]
c += 1
if c == len(b):break
if H <= 0:break
if H > 0:
if (H % a[0] != 0):c += 1
c += H // a[0]
print(c) |
p03071 | s250832291 | Accepted | a,b=map(int, input().split())
print(max(a+b,2*a-1,2*b-1)) |
p02688 | s677096298 | Accepted | N, K = map(int, input().split())
X = [0 for i in range(N)]
for i in range(K):
d = int(input())
A = list(map(int,input().split()))
for j in range(d):
X[A[j]-1] += 1
print(X.count(0)) |
p03543 | s399290296 | Accepted | n = input()
print("Yes" if n[0] == n[1] == n[2] or n[1] == n[2] == n[3] else "No") |
p02553 | s332140068 | Wrong Answer | a, b, c, d = list(map(int, input().split()))
if b <= 0 and d <= 0:
print(a*c)
elif b < 0 and d >= 0:
print(max(c, 1)*b)
elif b >= 0 and d < 0:
print(max(a, 1)*d)
else:
print(b*d) |
p03360 | s029456385 | Wrong Answer | A = list(map(int,input().split()))
K = int(input())
N = sorted(A)[-1]
print(sorted(A)[0] + sorted(A)[1] +N*2*K) |
p03206 | s248097164 | Wrong Answer | print("Chiristmas"+"Eve"*(25-int(input()))) |
p02899 | s351874039 | Accepted | N = int(input())
args = list(map(int, input().split()))
ans = [''] * N
for i in range(N):
ans[args[i] - 1] = i + 1
for s in ans:
print(s)
|
p02743 | s828454835 | Wrong Answer | from decimal import Decimal
A,B,C=map(int,input().split())
if Decimal(A**0.5+B**0.5)<Decimal(C**0.5):
print("Yes")
else:
print("No") |
p02596 | s679741275 | Wrong Answer | k = int(input())
a = 0
for i in range(k-1):
a = (a*10+7)%k
if a == 0:
print(i+1)
break
else:
print(-1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.