problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03796 | s888363397 | Wrong Answer | import math
N = int(input())
print((math.factorial(N)) % 10 ** 9 + 7)
|
p02678 | s264457049 | Accepted | N,M = map(int,input().split())
AB = [[] for _ in range(N)]
ans = [0]*N
for _ in range(M):
a,b = map(int,input().split())
AB[a-1].append(b-1)
AB[b-1].append(a-1)
from collections import deque
node = 0
q = deque([0])
check = [0]*N
check[0] = 1
while len(q) > 0:
node = q.popleft()
for i in AB[node]:
if check[i] == 0:
q.append(i)
check[i] = 1
ans[i] = node
print("Yes")
for i in range(1,N):
print(ans[i]+1)
|
p03779 | s368225311 | Accepted | d = int(input())
t = 0
while True:
if t*(t+1)//2 >=d:
print(t)
exit()
t +=1 |
p03109 | s340912828 | Accepted | a,b,c = input().split("/")
A = a + b + c
if A <= "20190430" :
print("Heisei")
else :
print("TBD") |
p03632 | s037903451 | Accepted | A, B, C, D = map(int, input().split())
lower = max(A,C)
upper = min(B,D)
if lower<=upper:
print(upper-lower)
else:
print(0) |
p02682 | s533476754 | Accepted | A, B, C, K = map(int, input().split())
if K <= A:
print(K)
elif A < K <= A + B:
print(A)
else:
print(A - (K - A - B)) |
p03611 | s183337319 | Accepted | n = int(input())
a = [int(x) for x in input().split()]
d = [0] * (10**5)
for i in range(n):
d[a[i]] += 1
ans = 1
for j in range(1, n-1):
ans = max(ans, d[j-1] + d[j] + d[j+1])
print(ans) |
p03433 | s577019205 | Accepted | N = int(input())
A = int(input())
if N % 500 <= A:
print('Yes')
else:
print('No') |
p03387 | s925786312 | Accepted | a = list(map(int,input().split()))
a.sort()
b = a[2] - a[1]
c = a[2] - a[0]
ans = 0
ans += b
if (c-b) % 2 == 0:
ans += (c-b)//2
elif (c-b) % 2 == 1:
ans += (c-b)//2 + 2
print(ans) |
p03779 | s400449845 | Accepted | # coding: utf-8
target = int(input())
total = 0
for i in range(1, target+1):
total += i
if total >= target:
print(i)
break
|
p03778 | s096178972 | Accepted | W, a, b = map(int, input().split())
if a+W<b:
print(b-a-W)
elif b+W<a:
print(a-W-b)
else:
print(0) |
p02801 | s333315444 | Accepted | C = input()
print(chr(ord(C)+1)) |
p02801 | s337112310 | Wrong Answer | # -*- coding: utf-8 -*-
import sys
def main():
alist = [
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
"k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
"u", "v", "w", "x", "y", "z",
]
input = sys.stdin.readline()
#print(input)
i = 0
for a in alist:
if input == a:
print(alist[i+1])
i += 1
if __name__ == '__main__':
main()
|
p02708 | s428628781 | Accepted | n, k = map(int, input().split())
mod = 10**9+7
ans = 0
for i in range(k, n+2):
mini = i*(i-1)//2
maxi = (2*n+1-i)*i//2
ans = (ans + maxi-mini+1) % mod
print(ans) |
p02786 | s902084782 | Accepted | H =int(input())
c = 0
while H:
H = H >> 1
c += 1
print(2**c-1)
|
p04031 | s836962203 | Wrong Answer | # C - いっしょ
def main():
import math
n = int(input())
a = list(map(int, input().split()))
p = math.ceil(sum(a)/n)
cnt = 0
for i in range(n):
cnt += (a[i]-p)**2
else:
print(cnt)
if __name__ == "__main__":
main() |
p02696 | s443927639 | Accepted | from math import floor
def main():
a,b,n = (int(x) for x in input().split())
if b <= n:
ans = floor(a*(b-1)/b)
else:
ans = floor(a*(n)/b)
print(ans)
if __name__ == '__main__':
main() |
p03211 | s031018759 | Wrong Answer | S=input()
for i in range(len(S)-2):
if i==0:
a=abs(int(S[i:i+2])-753)
else:
if a>abs(int(S[i:i+3])-753):
a=abs(int(S[i:i+3])-753)
print(a) |
p03434 | s833697660 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = sum(A[::2]) - sum(A[1::2])
print(ans)
|
p03487 | s673645323 | Accepted | n = int(input())
a = list(map(int,input().split()))
d = {}
ans = 0
for i in a:
if i in d:
d[i] += 1
else:
d[i] = 1
for k,v in d.items():
if k <= v:
ans += v-k
else:
ans += v
print(ans)
|
p03469 | s926375861 | Accepted | s = input()
print(s.replace("2017", "2018")) |
p03038 | s919159357 | Accepted | n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int,input().split())) for _ in range(m)]
bc = sorted(bc, reverse=True, key=lambda x: x[1])
a.sort()
num = 0
for i in range(m):
b, c = bc[i]
while b>0:
if num == n:
break
if a[num]<c:
a[num] = c
b -= 1
num += 1
else:
break
print(sum(a)) |
p03069 | s258014653 | Accepted | n=int(input())
s=input()
s=s
ll=0 #左側の黒い数を保持
rr=s.count(".") #右側の白い数を保持
result=ll+rr
for item in s:
if item=="#":
ll+=1
else:
rr-=1
result=min(result,ll+rr)
print(result)
|
p02791 | s317180725 | Accepted | N = int(input())
P = list(map(int, input().split()))
min = P[0]
ans = 0
for i in range(N):
if i == 0:
ans += 1
elif min > P[i]:
ans += 1
min = P[i]
print(ans) |
p02760 | s532506975 | Accepted | S="012 345 678 036 147 258 048 246 "
A=[input().split()for i in range(3)]
B=A[0]+A[1]+A[2]
for b in [input()for i in range(int(input()))]:
for l in range(9):
S=S.replace(str([9,l][b==B[l]]),"")
print(["No","Yes"][S.find(" ")>-1]) |
p02988 | s580455426 | Accepted | n = int(input())
arr = list(map(int, input().split()))
count = 0
for i in range(1, len(arr)-1):
if (arr[i+1] - arr[i])* (arr[i] - arr[i-1]) > 0:
count += 1
print(count) |
p03548 | s617164353 | Accepted | x,y,z = map(int,input().split())
print((x-z)//(y+z)) |
p02917 | s630795196 | Wrong Answer | # input
N = int(input())
B = list(map(int, input().split()))
# check
A = []
append = A.append
for i, b in enumerate(B):
while len(A[i:]) < 2:
if i < len(B) - 1 and b >= B[i + 1]:
append(B[i + 1])
else:
append(b)
print(sum(A)) |
p03804 | s805773489 | Accepted | import numpy as np
n, m = map(int, input().split())
a = []
for i in range(n):
a.append(list(input()[:]))
b = []
for i in range(m):
b.append(list(input()[:]))
a = np.array(a)
b = np.array(b)
for i in range(n-m+1):
for j in range(n-m+1):
if (a[i:i+m, j:j+m] == b).all():
print("Yes")
break
else:
continue
break
else:
print("No")
|
p02744 | s791801341 | Accepted | #TODO
def dfs(word, idx):
if len(word)==n:
print(word)
return
for j in range(idx):
dfs(word+chr(j+mx), idx)
dfs(word+chr(idx+mx), idx+1)
n = int(input())
mx = ord('a')
dfs("", 0) |
p03555 | s954758785 | Accepted | U=input()
B=input()
if U[0]==B[2] and U[2]==B[0] and U[1]==B[1]:
print("YES")
else:
print("NO") |
p02811 | s688624415 | Accepted | # A - 500 Yen Coins
k,x=list(map(int,input().split()))
if (k*500)>=x:
print("Yes")
else:
print("No")
|
p02657 | s694212873 | Accepted | a, b = map(int, input().split())
print(a*b) |
p02608 | s360982628 | Accepted | n = int(input())
# 答え用の配列を準備しておく
ans = [0 for i in range(n+1)]
for x in range(1,int(n**0.5+1)):
for y in range(1,int(n**0.5+1)):
for z in range(1,int(n**0.5+1)):
res = x**2+y**2+z**2+x*y+y*z+x*z
# resの値がn以下ならカウントする
if res<=n:
ans[res] += 1
for i in range(1,n+1):
print(ans[i]) |
p02547 | s281958177 | Accepted | import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n=int(input())
ans=0
flag=0
for i in range(n):
d1,d2=get_ints()
if d1==d2:
ans=ans+1
if ans>=3:
flag=1
else:
ans=0
if flag==1:
print("Yes")
else:
print("No") |
p02787 | s785483420 | Wrong Answer | # coding:utf-8
H, N = map(int, input().split(' '))
ab_list = []
for _ in range(N):
a, b = map(int, input().split(' '))
ab_list.append([a, b])
dp = [0] * (H + 1)
for i in range(1, H + 1):
for j in range(N):
if ab_list[j][0] <= i:
dp[i] = dp[i - ab_list[j][0]] + ab_list[j][1]
else:
dp[i] = ab_list[j][1]
print(dp[H]) |
p02835 | s151014490 | Wrong Answer | a = list(map(int, input().split()))
print('bust' if sum(a) >= 22 else 'Win') |
p03721 | s780205040 | Wrong Answer | N, K = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(N)]
sorted_lst = sorted(lst, key=lambda x: x[1])
cnt = 0
for i in lst:
cnt += i[1]
if (cnt >= K):
print(i[0])
break |
p03487 | s968751616 | Accepted | from collections import Counter
n=int(input())
a=Counter(list(map(int, input().split())))
ans=0
for i,j in a.items():
if i>j:
ans+=j
elif i<j:
ans+=j-i
print(ans) |
p03062 | s534142872 | Accepted | import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(input())
A = list(map(int, input().split()))
minus_cnt = 0
for i in range(N):
if A[i] < 0:
minus_cnt += 1
ans = 0
min_val = 10**10
if minus_cnt % 2 == 0:
for i in range(N):
ans += abs(A[i])
else:
for i in range(N):
ans += abs(A[i])
min_val = min(min_val, abs(A[i]))
ans -= min_val * 2
print(ans) |
p03106 | s090083389 | Accepted | A, B, K = map(int, input().split())
divisors = []
for i in range(min(A,B), 0, -1):
if A%i == B%i == 0:
divisors.append(i)
print(divisors[K-1]) |
p02813 | s169661408 | Accepted | from itertools import permutations
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
l = []
for pp in permutations(range(1,n+1)):
l.append(list(pp))
a = l.index(p)
b = l.index(q)
print(abs(a - b))
|
p02777 | s970224691 | Wrong Answer | tmp = input().split()
S = tmp[0]
T = tmp[1]
i = list(map(int, input().split()))
A = i[0]
B = i[1]
U = input()
if S == U:
print(str(A-1) + " " + str(B))
else:
print(str(B) + " " + str(A)) |
p02899 | s912877999 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
result_list = [0] * N
for i, v in enumerate(A):
result_list[v - 1] = i + 1
result = ''
for i in result_list:
result += str(i)
print(' '.join(result)) |
p03076 | s634088937 | Accepted | #conding utf-8
A=[int(input()) for i in range(5)]
B=[0 for i in range(5)]
C=[0 for i in range(5)]
tmp=10
m=0
for i in range(5):
if A[i]%10 !=0:
if A[i]%10<tmp:
m=i
tmp=A[i]%10
for i in range(5):
if A[i]%10 !=0:
if i != m:
B[i]=int(A[i]/10)*10+10
else:
B[i]=A[i]
else:
B[i]=A[i]
print(sum(B)) |
p03338 | s300300467 | Accepted | N = int(input())
S = str(input())
ans = 0
for i in range(N):
same = 0
S_a = S[0:i+1]
S_b = S[i+1:N]
for alphabet in "abcdefghijklmnopqrstuvwxyz":
if S_a.count(alphabet) >0 and S_b.count(alphabet):
same +=1
if same > ans:
ans = same
print(ans)
|
p02724 | s526408284 | Accepted | #
x = int(input())
num_1 = x // 500
num_2 = (x - num_1 * 500) // 5
ans = num_1 * 1000 + num_2 * 5
print(ans)
|
p02899 | s354383656 | Accepted | def main():
n, *a = map(int, open(0).read().split())
b=[None]*n
i=1
for index in a:
b[index-1]=i
i+=1
print(" ".join(map(str,b)))
if __name__=="__main__":
main() |
p03633 | s574441126 | Wrong Answer | import decimal
import math
import sys
def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()
n = I()
t = IR(n)
ans = t[0]
for i in t[1:]:
gcd = math.gcd(ans, i)
ans = int(decimal.Decimal(decimal.Decimal(
ans) * decimal.Decimal(i)) / decimal.Decimal(gcd))
print(ans)
|
p02814 | s321765216 | Wrong Answer | import numpy as np
import fractions as f
from functools import reduce
n,m=map(int,input().split())
a=np.array(list(map(int,input().split())))
a=a//2
def lcm(x,y):
return (x*y)//f.gcd(x,y)
def lcm_list(num):
return reduce(lcm,num,1)
l=lcm_list(a)
if l%2==0:
ans=0
else:
ans=m//l
#奇数を取り除く
if ans%2==0:
ans//=2
else:
ans=ans//2+1
print(ans) |
p04005 | s998675742 | Accepted | A, B, C = map(int, input().split())
if A%2 == B%2 == C%2 == 1:
print(min(A*B, B*C, A*C))
else:
print(0) |
p03760 | s684673430 | Accepted | o, e = input(), input()
op = ""
for i in range(len(e)): op += o[i] + e[i]
print(op if len(e) == len(o) else op+o[-1]) |
p03274 | s925351501 | Accepted | import sys
input = sys.stdin.readline
N, K = map(int, input().split())
x = [int(x) for x in input().split()]
ans = 10**15
for i in range(N-K+1) :
if x[i]*x[i+K-1] >= 0 :
temp = max(abs(x[i]), abs(x[i+K-1]))
elif abs(x[i]) > x[i+K-1] :
temp = abs(x[i]) + 2*x[i+K-1]
else :
temp = x[i+K-1] + 2*abs(x[i])
ans = min(ans, temp)
print(ans)
|
p03107 | s454067933 | Accepted | S = list(input())
print(2*min(S.count("1"),S.count("0"))) |
p03659 | s762047262 | Accepted | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
acc =[0] * (n + 1)
for i in range(1, n + 1):
acc[i] = acc[i - 1] + A[i - 1]
ans = INF
for i in range(1, n):
now = abs(acc[i] - acc[0] - (acc[n] - acc[i]))
ans = min(ans, now)
print(ans)
|
p02547 | s801693512 | Accepted | n=int(input())
count=0
counts=[]
z=[]
for i in range(n):
x,y=list(map(int,input().split()))
z.append([x,y])
z.append([-14,-20])
for i in z:
if i[0]==i[1]:
count+=1
else:
counts.append(count)
count=0
if max(counts)>=3:
print('Yes')
else:
print('No') |
p02548 | s639689361 | Accepted | n = int(input())-1
ans = 0
for i in range(n):
b = n//(i+1)
ans += b
print(ans) |
p03293 | s606015108 | Accepted | import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math
s = list(input())
t = input()
for i in range(len(s)):
ans = ""
cnt = 0
for j in range(-1,len(s)-1):
ans += s[j]
res = ""
for j in range(len(s)):
s[j] = ans[j]
res += s[j]
if res == t:
print("Yes")
sys.exit()
print("No") |
p03862 | s143826635 | Accepted | n, x = map(int, input().split())
a = [int(i) for i in input().split()]
op = 0
for i in range(1, n):
s = a[i-1] + a[i]
if s > x:
op += s - x
if a[i] < s - x:
a[i] = 0
else:
a[i] -= s - x
print(op)
|
p02797 | s458432356 | Accepted | N,K,S = map(int,input().split())
if S != 10**9:
ans = [S]*K + [S+1]*(N-K)
else:
ans = [S]*K + [S-1]*(N-K)
print(*ans) |
p03719 | s763013679 | Accepted | a, b, c = map(int, input().split())
print("Yes" if a <= c <= b else "No") |
p03639 | s172823614 | Accepted | n = int(input())
L = list(map(int,input().split()))
L4 = [x%4 == 0 for x in L]
L2 = [(x%2 == 0 and x%4 != 0) for x in L]
#print(sum(L2),sum(L4))
other = len(L) - sum(L2) - sum(L4)
if sum(L2) == 0:
if other <= sum(L4)+1:
print("Yes")
else:
print("No")
else:
if other <= sum(L4):
print("Yes")
else:
print("No") |
p03555 | s574292202 | Accepted | C=input()+input()
print("YNEOS"[C!=C[::-1]::2]) |
p03910 | s282565890 | Accepted | n = int(input())
now = 0
for i in range(1,n+2):
now += i
if now >= n:
x = now-n
for j in range(1,i+1):
if j != x:
print(j)
exit() |
p03862 | s537151062 | Wrong Answer | n, x = map(int,input().split())
A = list(map(int,input().split()))
sum = []
ans = 0
for i in range(n-1):
sum.append(A[i]+A[i+1])
for j in range(n-1):
if j != n-2:
if sum[j] > x:
diff = sum[j]-x
sum[j] -= diff
sum[j+1] -= diff
ans += diff
else:
if sum[j] > x:
diff = sum[j]-x
sum[j] -= diff
ans += diff
print(ans) |
p02801 | s184990124 | Accepted | print(chr(ord(input()) + 1)) |
p02640 | s408616500 | Accepted | x, y = list(map(int, input().split()))
if (2 * x <= y <= 4 * x) and y % 2 == 0:
print("Yes")
else:
print("No") |
p03087 | s082496665 | Accepted | from bisect import bisect_left, bisect_right
n,q=map(int,input().split())
s=list(input())
actable=[]
for i in range(len(s)-1):
if s[i]=="A":
if s[i+1]=="C":
actable.append(i+1)
for i in range(q):
ans=0
l,r=map(int,input().split())
ans=bisect_left(actable,r)-bisect_left(actable,l)
print(ans) |
p02641 | s801788861 | Accepted | ma = lambda :map(int,input().split())
x,n = ma()
P = list(ma())
import collections
co = collections.Counter(P)
mi = -1
ab = 10**9
for i in range(-1,102):
if abs(x-i) <ab:
if co[i] >0:
continue
ab = abs(x-i)
mi = i
print(mi) |
p02726 | s486683186 | Wrong Answer | N,X,Y = map(int,(input().split()))
lList = [ 0 for i in range(N) ]
for i in range(N):
for j in range(i + 1,N):
l1 = j - i
l2 = abs(X - 1 - i) + abs(Y - 1 - j) + 1
l = min(l1,l2)
lList[l] += 1
print(l,i+1,j+1)
for i in lList[1:]:
print(i) |
p03478 | s769498131 | Accepted | N, A, B = map(int, input().split())
def digit_sum(n):
res = 0
while n:
res += n % 10
n //= 10
return res
answer = 0
for i in range(1, N + 1):
if A <= digit_sum(i) <= B:
answer += i
print(answer) |
p02603 | s273572130 | Accepted | N = int(input())
A = list(map(int, input().split()))
money = 1000
stock = 0
for i in range(N-1):
if A[i+1] > A[i]:
stock = money // A[i]
money = money % A[i]
money += stock * A[i+1]
print(money)
|
p02606 | s950439799 | Accepted | l,r,d = list(map(int, input().split(' ')))
ans = 0
for i in range(l,r+1):
if (i % d) == 0:
ans+=1
print(ans) |
p03160 | s085853184 | Accepted | inf = 10**9
def main():
N = int(input())
h = list(map(int,input().split()))
memo = [inf]*N
memo[0] = 0
def calcCost(start,goal,h):
return abs(h[goal]-h[start])
for i in range(1,N):
memo[i] = min(memo[i],memo[i-1]+calcCost(i-1,i,h))
if i > 1:
memo[i] = min(memo[i],memo[i-2]+calcCost(i-2,i,h))
print(memo[-1])
main() |
p03986 | s078078661 | Wrong Answer | s = input()
m = [{"char": c, "exists": True, "go_to_when_deleted": idx - 1} for idx, c in enumerate(s)]
for idx in range(0, len(s) - 1):
jdx = idx
while not m[jdx]["exists"]:
jdx = m[jdx]["go_to_when_deleted"]
if m[jdx]["char"] + m[idx + 1]["char"] == "ST":
m[jdx]["exists"] = False
m[idx+1]["exists"] = False
m[idx+1]["go_to_when_deleted"] = m[jdx]["go_to_when_deleted"]
print(len("".join([c['char'] for c in m if c["exists"]]))) |
p02661 | s685717151 | Accepted | N = int(input())
A = []
B = []
for i in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
A.sort()
B.sort()
if N % 2 == 0:
b = (B[N//2-1]+B[N//2])/2
a = (A[N//2-1]+A[N//2])/2
ans = (b-a)//0.5 +1
else:
b = B[(N+1)//2-1]
a = A[(N+1)//2-1]
ans = b-a+1
print(int(ans)) |
p02773 | s996101252 | Accepted | from collections import defaultdict
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
k = str(input())
if k in ans:
ans[k] += 1
else:
ans.update({k: 1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
print(i) |
p03633 | s547362081 | Wrong Answer | n=int(input())
ans = 1
for i in range(n):
inp = int(input())
tmp = ans*inp
while (ans % inp != 0):
if (ans >= tmp):
ans = tmp
break
ans+=ans
print(ans) |
p02860 | s626982227 | Wrong Answer | def ABC145B():
N = int(input())
S = input()
if len(S) % 2 == 1:
print('No')
l = len(S) // 2
if S[:l] == S[(-1 * l):]:
print('Yes')
else:
print('No')
ABC145B()
|
p02597 | s827578226 | Wrong Answer | a=int(input())
b=input()
c=int(a/2)
d=0
e=a-1
i=0
while True:
if (b[i]=='W'):
for j in range(0,e+1)[::-1]:
if b[j]=='R':
d=d+1
e=j-1
break
i=i+1
if i>e: break
print(d) |
p02684 | s268889511 | Wrong Answer | NK = list(map(int, input().split()))
N = NK[0]; K = NK[1]
A = list(map(int, input().split()))
rlist = [0]*N
flag = 1
location = 1
div = 0
while flag>0:
location = A[location-1]
if rlist[A[location-1]-1] == 0:
rlist[A[location-1]-1] = rlist[location-1]+1
else:
div = rlist[location-1]+1-rlist[A[location-1]-1]
flag = -1
cnt = (K-rlist[A[location-1]-1])%div + rlist[A[location-1]-1]
result = 0
for i in range(cnt):
result = A[result]-1
print(result+1) |
p02612 | s372695362 | Wrong Answer | print(int(input()) % 1000) |
p03795 | s913635994 | Wrong Answer | n=int(input());print(800*n-60//15*200) |
p03012 | s380188694 | Wrong Answer | import math
import numpy
inp = int(input())-1
xxxx = list(map(int,input().split()))
list = []
for i in range(inp):
i=i+1
a = abs(sum(xxxx[0:i]) - sum(xxxx[i:inp]))
list.append(a)
def func(x):
return min(x)
print(int(func(list)-1)) |
p02952 | s631294340 | Accepted | n = int(input())
cnt = 0
for i in range(n):
if len(str(i+1))%2 != 0:
cnt +=1
print(cnt)
|
p03779 | s094911018 | Accepted | import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]
def main():
x=II()
inf=10**9
st=int(x**0.5)-1
for i in range(st,inf):
if(i+1)*i//2>=x:
print(i)
break
main() |
p02831 | s229708658 | Accepted | import fractions
a, b = map(int, input().split())
print(int(a*b / fractions.gcd(a,b)))
|
p03719 | s665516520 | Accepted | a,b,c=map(int,input().split())
if a<=c and b>=c:
print("Yes")
else:
print("No") |
p02866 | s580418975 | Wrong Answer | import collections
MOD = 998244353
n = int(input())
d = [int(_) for _ in input().split()]
ans = 1
if d[0] != 0:
ans = 0
else:
D = sorted(collections.Counter(d).most_common())
cnt = 0
prev = 1
for i in D:
if i[0] == cnt:
ans = ans * pow(prev, i[1], MOD) % MOD
prev = i[1]
else:
ans = 0
break
cnt += 1
print(ans) |
p02621 | s921336041 | Accepted | a = int(input())
print(a + a * a + a * a * a) |
p02548 | s632402397 | Accepted | from math import sqrt as r
from math import floor
N = int(input())
n = N - 1
ans = 0
for A in range(1, N):
B = n // A
ans += B
print(ans)
|
p03437 | s509775934 | Accepted | x,y=map(int,input().split())
if x%y==0:
print(-1)
else:
print(x) |
p02583 | s522709927 | Accepted | n = int(input())
l = [int(i) for i in input().split()]
ans = 0
for i in range(n):
for j in range(i+1, n):
for k in range(j+1,n):
a = [l[i],l[j],l[k]]
if len(set(a))!=3:
continue
a.sort()
ans += a[0]+a[1]>a[2]
print(ans) |
p03281 | s400044049 | Accepted | def check(k):
cnt = 0
for i in range(1, k + 1):
if k % i == 0:
cnt += 1
if cnt == 8:return 1
else:return 0
n = int(input())
pre = [0] * n
for i in range(n):
if i % 2 == 1:
pre[i] = pre[i - 1]
else:
temp = check(i + 1)
pre[i] = pre[i - 1] + temp
print(pre[n - 1]) |
p02548 | s097402366 | Wrong Answer | n = int(input())
count=0
for i in range(1,1000):
for j in range(1,1000):
if (i*j)>=n:
count+=j-1
break
print(count)
|
p02778 | s653450853 | Accepted | x = len(input())
ans = ""
for i in range(x):
ans += "x"
print(ans) |
p03472 | s916526380 | Accepted | N, H = map(int, input().split())
lst = []
for _ in range(N):
a, b = map(int, input().split())
lst.append((a, 0))
lst.append((b, 1))
lst.sort(reverse=True)
ans = 0
ceil = lambda a, b: (a + b - 1) // b
for p, q in lst:
if q == 1:
H -= p
ans += 1
if H <= 0:
break
else:
ans += ceil(H, p)
break
print(ans)
|
p02570 | s756343837 | Wrong Answer | D, T, S = list(map(int, input().split()))
if int(D / S) <= T:
print('Yes')
else:
print('No') |
p02677 | s970147206 | Accepted | A,B,H,M = list(map(int,input().split()))
import math
x = A**2+B**2-2*A*B*math.cos(math.radians(11*M/2-30*H))
print(math.sqrt(x)) |
p04019 | s940724136 | Accepted | S = input()
ans = True
print("Yes" if ("N" in S) == ("S" in S) and ("E" in S) == ("W" in S) else "No")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.