problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03360 | s568868776 | Wrong Answer | l = list(map(int, input().split()))
k = int(input())
print(sum(l) + max(l)*2*k - max(l))
|
p02624 | s809593472 | Accepted | n=int(input())
ans=0
for i in range(1,n+1):
for j in range(i,n+1,i):
ans+=j
print(ans) |
p02705 | s801186367 | Accepted | r = int(input())
print(2*3.141592*r) |
p02694 | s648579489 | Accepted | import math
a = int(input())
y = 100
cnt = 0
while y < a:
y *= 1.01
y =math.floor(y)
cnt += 1
print(cnt) |
p03417 | s387590954 | Accepted | N,M=map(int,input().split())
if N==1:
if M==1:
print(1)
else:
print(M-2)
elif N==2:
print(0)
else:
if M==1:
print(N-2)
elif M==2:
print(0)
else:
print((N-2)*(M-2)) |
p03472 | s545187633 | Wrong Answer | n, h = list(map(int, input().split()))
wield = 0
bs = []
for i in range(n):
a, b = list(map(int, input().split()))
if a > wield:
wield = a
bs.append(b)
throw = 0
throwCnt = 0
for i in range(n):
if bs[i] > wield:
throw += bs[i]
throwCnt += 1
print((h-throw+wield-1)//wield + throwCnt) |
p03557 | s168755014 | Accepted | import bisect
n = int(input())
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
ans = 0
for i in range(n):
ans += bisect.bisect_left(a,b[i])*(n-bisect.bisect_right(c,b[i]))
print(ans) |
p02829 | s896733135 | Wrong Answer | S = {1,2,3}
A = {int(input())}
B = {int(input())}
C = S - A - B
|
p02784 | s673701347 | Accepted | h,n=map(int,input().split())
a = list(map(int,input().split()))
print('Yes' if sum(a)>=h else 'No')
|
p02713 | s005714945 | Accepted | import math
k = int(input())
cache = {}
ans = 0
for a in range(1, k+1):
for b in range(1, k+1):
for c in range(1, k+1):
ans = ans + cache.get( (a,b,c), math.gcd(math.gcd(a, b), c))
print(ans) |
p03457 | s464213072 | Accepted | N = int(input())
time = 0
visited = [0, 0]
result = []
for i in range(N):
t, *xy = map(int, input().split())
diff_time = t - time
diff_dist = sum([abs(xy[i] - visited[i]) for i in range(2)])
if (diff_dist <= diff_time) & (((diff_time - diff_dist) % 2)==0):
result.append(True)
else:
result.append(False)
time = t
visited = xy
print("Yes") if all(result) else print("No") |
p02658 | s858317918 | Accepted | import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
def main():
if c[0] >0:
print(0)
return
ans = 1
for a in A:
ans *= a
if ans > 1e18:
ans = -1
break
if ans > 1e18:
ans = -1
print(ans)
main() |
p02623 | s637417957 | Accepted | N, M, K = map(int, input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a,b = [0], [0]
for i in range(N):
a.append(a[i] + A[i])
for i in range(M):
b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N+1):
if a[i] > K:
break
while b[j] > K - a[i]:
j -= 1
ans = max(ans, i+j)
print(ans) |
p02817 | s942313253 | Accepted | s,t = map(str,input().split())
print(t+s) |
p02957 | s982228277 | Accepted | A,B = map(int,input().split())
if (A+B)%2==1:
print('IMPOSSIBLE')
elif (A+B)%2==0:
print((A+B)//2) |
p02699 | s011589663 | Accepted | s,w=map(int,input().split())
if s<=w:
print('unsafe')
else:
print('safe')
|
p03319 | s356315858 | Accepted | import math
n, k = map(int, input().split())
l = list(map(int, input().split()))
if n == k:
print(1)
elif k == 2:
print(n-1)
else:
print(math.ceil((n-k)/(k-1))+1) |
p03438 | s907545387 | Accepted | n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=sum(b)-sum(a)
for i,j in zip(a,b):
if i<j:cnt-=(j-i+1)//2
print(['No','Yes'][cnt>=0]) |
p04031 | s896429698 | Accepted | n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 10**9
for i in range(a[0],a[len(a)-1]+1):
temp = sum([(abs(j-i))**2 for j in a])
ans = min(ans,temp)
print(ans)
|
p03435 | s172648216 | Wrong Answer | c = [list(map(int,input().split())) for _ in range(3)]
s = [sum(c[i]) for i in range(3)]
S = sum(s)
if S % 3 == 0:
print("Yes")
else:
print("No")
|
p02791 | s100558191 | Accepted | # C
N = int(input())
P = list(map(int,input().split()))
min_p = 10**10
ans = 0
for i in range(N):
if min_p >= P[i]:
ans += 1
min_p = min(min_p,P[i])
print(ans) |
p03665 | s909585794 | Accepted | import math
n,p=map(int,input().split())
c=0
for m in map(int,input().split()):
if m%2==0:c+=1
d=2**(c)
e=0
for i in range(p,n-c+1,2):
k=math.factorial(n-c) // (math.factorial(n-c - i) * math.factorial(i))
k=max(k,1)
e+=k
print(d*e)
|
p03607 | s759650537 | Accepted | import sys
n = int(input())
a = [int(input()) for i in range(n)]
a.sort()
number = {}
for item in a:
if item in number.keys():
number[item] += 1
else:
number[item] = 1
cnt = 0
for i in number.values():
if i % 2 != 0:
cnt += 1
print("{}".format(cnt)) |
p02847 | s512012104 | Accepted | a=input()
w=["SUN","MON","TUE","WED","THU","FRI","SAT"]
l=[7,6,5,4,3,2,1]
print(l[w.index(a)]) |
p02548 | s749877842 | Accepted | n=int(input())
ans=0
for a in range(1,n+1):
for b in range(1,n+1):
if n<=a*b:
break
ans+=1
print(ans) |
p03795 | s819302520 | Accepted | n = int(input())
p = n // 15
print(n * 800 - 200 * p)
|
p03836 | s605079521 | Accepted | def out(c, n):
for i in range(n):
print(c, end='')
sx, sy, tx, ty = map(int, input().split())
out('U', ty - sy)
out('R', tx - sx)
out('D', ty - sy)
out('L', tx - sx)
out('L', 1)
out('U', ty - sy + 1)
out('R', tx - sx + 1)
out('D', 1)
out('R', 1)
out('D', ty - sy + 1)
out('L', tx - sx + 1)
out('U', 1)
print()
|
p02578 | s294114333 | Accepted | n = int(input())
a = list(map(int,input().split()))
ans = 0
m = a[0]
for i in range(1,n):
if a[i] <= m:
ans += -a[i]+m
else:
m = a[i]
print(ans)
|
p03695 | s795445985 | Accepted | N=int(input())
*A,=map(int,input().split())
s=list(map(lambda x: x//400, A))
mm=len(set([i for i in s if i<8]))
o=len([i for i in s if 8<=i]) # 色を変えられる人
print(mm if 1<=mm else 1,min(N,mm+o)) |
p02744 | s744442161 | Accepted | import string
lower = string.ascii_lowercase
n = int(input())
# if n == 1:
# print('a')
# exit()
ans = ['']
for i in range(n):
new_list = []
for word in ans:
for new_char in lower:
if new_char in word:
new_list.append(word + new_char)
else:
new_list.append(word + new_char)
break
ans = new_list
# print(new_list)
for word in ans:
print(word)
|
p03095 | s646323108 | Wrong Answer | n=int(input())
s=input()
t=sorted(s)
t.append("X")
cnt=1
ans=1
for i in range(n):
if t[i]==t[i+1]:
cnt+=1
else:
ans*=(cnt+1)
cnt=1
print(ans-1) |
p03723 | s927439877 | Accepted | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def f(a, b, c):
if (a%2 != 0) | (b%2 != 0) | (c%2 != 0):
return 0
if (a == b) & (b == c):
return -1
return f((b+c)//2, (a+c)//2, (a+b)//2) + 1
def main():
a, b, c = map(int, readline().split())
print(f(a, b, c))
if __name__ == '__main__':
main()
|
p02753 | s081428362 | Wrong Answer | S = input()
if S.count('A') or S.count('B') == 3:
print('No')
else:
print('Yes') |
p02873 | s112639101 | Accepted | s = input()
partition = s.replace('><','>|<').split('|')
ans=0
for sub in partition:
left = sub.count('<')
right = sub.count('>')
ans += sum(range(1, max(left, right) + 1))
ans += sum(range(1, min(left, right)))
print(ans) |
p03013 | s984191390 | Accepted | MOD = 10**9 + 7
n,m = map(int,input().split())
ban = [False] * (n + 1)
for i in range(m):
a = int(input())
ban[a] = True
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
dp[i] %= MOD
if ban[i]:dp[i] = 0
#print(i, dp[i])
if i + 1 <= n:
dp[i + 1] += dp[i]
if i + 2 <= n:
dp[i + 2] += dp[i]
print(dp[n] % MOD)
|
p03385 | s466079740 | Accepted | S = list(input())
if len(set(S))==3:
print("Yes")
else:
print("No") |
p03071 | s391120251 | Accepted | A, B = map(int, input().split())
print(max(2*A-1, 2*B-1, A+B)) |
p02595 | s844026067 | Accepted | n, d = map(int, input().split())
cnt = 0
dist = ()
for i in range(n):
x, y = map(float, input().split())
dist = (x ** 2) + (y ** 2)
if dist <= d ** 2:
cnt += 1
print(cnt)
|
p03107 | s977936478 | Wrong Answer | S = list(input())
last = S.pop(0)
stack = [last]
can_pop = True
cnt = 0
for s in S:
if last != s and can_pop:
stack.pop()
can_pop = False
# stack.append(s) 読み捨て
cnt += 2
else:
stack.append(s)
last = s
can_pop = True
print(cnt)
|
p02922 | s554046667 | Accepted | import math
a, b = map(int, input().split())
print(math.ceil((b-1)/(a-1))) |
p03145 | s152598795 | Wrong Answer | a = list(map(int, input().split()))
a.sort()
print(a[0]*a[1]/2) |
p03637 | s587066909 | Accepted | n = int(input())
a = list(map(int, input().split()))
four = 0
two = 0
one = 0
for i in a:
if i%4 == 0:
four += 1
elif i%2 == 0 and i%4 != 0:
two += 1
elif i%2 != 0:
one += 1
if four >= one or four + 1 >= two//2 + two%2 + one or n == two:
print('Yes')
else:
print('No') |
p02608 | s429767019 | Accepted | import sys
import numpy as np
import math
import collections
import copy
from collections import deque
from functools import reduce
from itertools import product
# input = sys.stdin.readline
N = int(input())
n_np = np.zeros(105**3)
for i in range(1, 105):
for j in range(1, 105):
for k in range(1, 105):
idx = i**2 + j**2 + k **2 + i*j + i*k + j*k
n_np[idx-1] += 1
for i in range(N):
print(int(n_np[i]))
|
p03486 | s756224309 | Wrong Answer | s= sorted(input())
t= sorted(input(), reverse=True)
for i, j in zip(s, t):
if i < j:
print("Yes")
break
else:
if len(s) < len(t):
print("Yes")
else:
print("No") |
p03624 | s278109472 | Wrong Answer | data=['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',]
s=list(input())
t=sorted(s)
i=0
while (t[i]==data[i] and i<25):
i=i+1
if i<25:
print(data[i])
else:
print('None') |
p03852 | s443263860 | Wrong Answer | v=['a','i','u','e','o'];print('vowel' if 0!=v.count(input) else 'consonant') |
p02613 | s458029084 | Wrong Answer | a=int(input())
s=[input() for i in range(a)]
print("AC × {:d}".format(s.count("AC")))
print("WA × {:d}".format(s.count("WA")))
print("TLE × {:d}".format(s.count("TLE")))
print("RE × {:d}".format(s.count("RE")))
|
p03220 | s165119123 | Wrong Answer | N = int(input())
T, A = map(int, (input().split(" ")))
H = list(map(int,input().split(" ")))
ans_t = 10000
ans = 0
for i in range(N):
t = T - H[i] * 0.006
l = abs(A - T)
if l < ans_t:
ans_t = l
ans = i + 1
print(ans) |
p03150 | s251624609 | Wrong Answer | s = input()
chkStr = ["k","e","y","e","n","c","e"]
inpStr = list(s)
idx = 0
chkCount = 0
# print(chkStr)
# print(inpStr)
bParam = 0
stopParam = 0
for i in range(len(inpStr)):
if chkStr[idx] == inpStr[i]:
idx += 1
chkCount += 1
elif bParam == 0 or bParam != idx:
bParam = idx
stopParam += 1
if idx == len(chkStr):
break
if chkCount == len(chkStr) and stopParam <= 1:
print("YES")
else:
print("NO")
|
p03282 | s936957626 | Wrong Answer | import sys
S = sys.stdin.readline().strip()
K = int(sys.stdin.readline())
for s_i in S:
if s_i == "1":
K -= 1
else:
break
print(s_i) |
p03013 | s561531250 | Wrong Answer | import collections
n,m = map(int, raw_input().split(' '))
forbidden = set([int(raw_input()) for _ in range(m)])
q = collections.deque([1])
mod = (10 ** 9) + 7
w = 1
while(w <n):
q.append((1 if w not in forbidden else 0) * (sum(q) % mod))
w += 1
if len(q) == 3: q.popleft()
print q[-1] |
p03359 | s124727152 | Accepted | a,b=map(int,input().split())
print(a if b >= a else a-1) |
p02720 | s140749731 | Accepted | # coding: utf-8
# Your code here!
from collections import deque
k=int(input())
ans=[]
d=deque([1,2,3,4,5,6,7,8,9])
c=0
while c<11:
q=d.popleft()
ans.append(q)
c=len(str(q))
b=q%10
if b!=0:
d.append(q*10+b-1)
d.append(q*10+b)
if b!=9:
d.append(q*10+b+1)
print(ans[k-1]) |
p03285 | s857796437 | Accepted | import sys
N = int(input())
for i in range(26):
for j in range(15):
if (4 * i + 7 * j) == N:
print('Yes')
sys.exit()
print('No') |
p04043 | s140427734 | Accepted | # A
l = list(map(int, input().split()))
if l.count(5) == 2 and l.count(7) == 1:
print('YES')
else:
print('NO') |
p03282 | s749393422 | Wrong Answer | a = input()
b = int(input())
cnt = b
for i in a:
if cnt == 0:
print("1")
break
else:
if i =="1":
cnt -= 1
else:
print(i)
break
|
p02600 | s772906999 | Wrong Answer | X = int(input())
if X>=499 and X<=599:
print("8")
elif X>=600 and X<=799:
print("7")
elif X>=800 and X<=999:
print("6")
elif X>=1000 and X<=1199:
print("5")
elif X>=1200 and X<=1399:
print("4")
elif X>=1400 and X<=1599:
print("3")
elif X>=1600 and X<=1799:
print("2")
elif X>=1800 and X<=1999:
print("1") |
p02683 | s373717575 | Wrong Answer | print(-1) |
p02623 | s815614637 | Accepted | from bisect import bisect_right
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
accu = 0
aa = [0]
for i in a:
accu += i
aa.append(accu)
accu = 0
bb = [0]
for i in b:
accu += i
bb.append(accu)
ans = 0
for i in range(n+1):
if aa[i]>k:
break
tmp = i+bisect_right(bb, k-aa[i])-1
ans = max(tmp, ans)
print(ans) |
p02753 | s023959926 | Accepted | station = input()
print("Yes" if "AB" in station or "BA" in station else "No") |
p02622 | s069844249 | Accepted | a = input()
b = input()
ans = 0
for i,aa in enumerate(a):
if b[i] != aa:
ans += 1
print(ans)
|
p02772 | s715534769 | Accepted | N = int(input())
A = list(map(int, input().split()))
flag = True
for i in A:
if i % 2 == 0:
if i % 3 == 0 or i % 5 == 0:
pass
else:
flag = False
break
if flag == True:
print('APPROVED')
else:
print('DENIED') |
p03836 | s568687373 | Wrong Answer | sx, sy, tx, ty = map(int,input().split())
xd = tx - sx
yd = ty - sy
route1 = []
route1.append('R'*xd)
route1.append('U'*yd)
route2 = []
route2.append('L'*xd)
route2.append('D'*yd)
route3 = ['D']
route3.append('R' * (xd + 1))
route3.append('U' * (yd + 1))
route3.append('L')
route4 = ['U']
route4.append('L'*(xd+1))
route4.append('D'*(yd+1))
route4.append('R')
ans = ''.join(route1) + ''.join(route2) + ''.join(route2) + ''.join(route4)
print(ans)
|
p02744 | s943639002 | Accepted | import sys
rline = sys.stdin.readline
N = int(input())
def dfs(ans, max_c):
if len(ans) == N:
print(ans)
else:
for i in range(max_c + 1):
dfs(ans + chr(ord('a') + i), max_c + 1 if i == max_c else max_c)
def solve():
dfs('', 0)
if __name__ == '__main__':
solve()
|
p03286 | s706137894 | Accepted |
N = int(input())
if N == 0:
print(0)
exit()
ans = ""
while N != 0:
bit = N % -2
if (bit < 0):
bit += 2
ans = str(bit) + ans
N = (N - bit) // (-2)
print(ans) |
p03000 | s675962104 | Wrong Answer | n, x = map(int,input().split())
l = list(map(int, input().split()))
cnt = 0
for i in range(n):
if i + l[i] <= x:
cnt +=1
print(cnt) |
p02831 | s285684453 | Wrong Answer | A,B = map(int,input().split())
seki = A*B
if B>A:
C = A
A = B
B = C
while A%B != 0:
a = A
b = B
A = a//b
B = a%b
print(int(seki/B)) |
p02775 | s740939645 | Accepted | N = [int(c) for c in input()]
dp = 0,1
for i in range(len(N)):
a = min(dp[0]+N[i], dp[1]+10-N[i])
b = min(dp[0]+N[i]+1, dp[1]+10-N[i]-1)
dp = a,b
print(dp[0])
|
p03286 | s928623455 | Accepted | n = int(input())
if n == 0:
print(0)
exit()
ans = ''
while True:
ans += str(n % 2)
if(n < 0):
n = (abs(n) + 1) // 2
else:
n = -1 * (n // 2)
if(n == 1):
ans += '1'
break
print(ans[::-1]) |
p03352 | s553832386 | Wrong Answer | N = int(input())
li = []
for i in range(1,100):
for j in range(2,50):
if i**j<=1000:
li.append(i**j)
li.sort()
ans = 1
for k in range(len(li)):
if (li[k-1]<=N)&(li[k]>N):
ans = li[k-1]
print(ans) |
p02623 | s516040024 | Wrong Answer | from collections import deque
n,m,k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A,B = deque(A),deque(B)
count = 0
a = A.popleft()
b = B.popleft()
while k>=a or k>=b:
if a<b:
k -= a
count+=1
if A: a = A.popleft()
else: a = 10**10
else:
k -= b
count+=1
if B: b = B.popleft()
else: b = 10**10
print(count)
|
p03659 | s353579769 | Accepted | N = int(input())
a = list(map(int, input().split()))
y = sum(a)
x = 0
ans = 10000000000000000
for i in range(0, N - 1):
x += a[i]
y -= a[i]
ans = min(ans, abs(x - y))
print(ans)
|
p02773 | s743233680 | Accepted | import collections
import itertools
N=int(input())
S=[input() for i in range(N)]
counted = collections.Counter(S)
# 最頻値を求める
m = max(counted.values())
# 頻出数の文字を集める
chars = [key for key, value in counted.items()
if value == m]
chars=sorted(chars)
for a in chars:
print(a) |
p02993 | s525131189 | Accepted | a,b,c,d = input()
if a == b or b==c or c == d:
print('Bad')
else:
print('Good') |
p02732 | s258026084 | Accepted | N=int(input())
A=list(map(int,input().split()))
from collections import Counter
Num=Counter(A)
S=0
for i in Num.values():
S+=i*(i-1)//2
for k in range(N):
n=Num[A[k]]
ans=S-n*(n-1)//2+(n-1)*(n-2)//2
print(ans)
|
p03059 | s667376734 | Accepted | def main():
a, b, t = map(int, input().split())
print((int(t+0.5)//a * b))
if __name__ == '__main__':
main()
|
p02818 | s170223956 | Accepted | a,b,c = map(int, input().split())
if a<=c:
if b<=c-a:
print('0 0')
else:
print('0 {}'.format(a+b-c))
else:
print('{} {}'.format(a-c,b)) |
p02775 | s739023204 | Wrong Answer | def main():
n=list(input())
n=[int(i) for i in reversed(n)]
l=len(n)
n.append(0)
ans=0
for i in range(l):
if n[i]<=5:
a=n[i]
else:
n[i+1]+=1
a=10-n[i]
ans+=a
ans+=n[l]
print(ans)
if __name__=='__main__':
main()
|
p03062 | s388810670 | Accepted | n = int(input())
li = list(map(int,input().split()))
cnt = 0
new_li = []
for l in li:
if l<0:
cnt += 1
new_li.append(abs(l))
if cnt%2 == 0:
print(sum(new_li))
else:
print(sum(new_li)-(2*(min(new_li)))) |
p02843 | s144288868 | Accepted | X=int(input())
n=X%100
m=X//100
if 0<=n<=m*5:
print(1)
else:
print(0)
|
p02813 | s246637282 | Accepted | import sys
import itertools
input = sys.stdin.readline
def main():
a, b = -1, -1
count = 0
for p in itertools.permutations(range(1, N+1)):
if p == P:
a = count
if p == Q:
b = count
if a != -1 and b != -1:
break
count += 1
print(abs(a-b))
if __name__ == "__main__":
N = int(input())
P = tuple([int(p) for p in input().split()])
Q = tuple([int(q) for q in input().split()])
main()
|
p02695 | s711298261 | Accepted | from itertools import combinations_with_replacement as combi
N, M, Q = map(int, input().split())
a = [0] * Q
b = [0] * Q
c = [0] * Q
d = [0] * Q
l = [i+1 for i in range(M)]
point = 0
for i in range(Q):
a[i], b[i], c[i], d[i] = map(int, input().split())
for v in combi(l, N):
tmp = 0
for j in range(Q):
if v[b[j]-1] - v[a[j]-1] == c[j]:
tmp += d[j]
point = max(point, tmp)
print(point) |
p02829 | s006085128 | Wrong Answer | S=set(int(input())for i in range(2))
print({1,2,3}-S) |
p03695 | s191036859 | Accepted | N,*A=map(int,open(0).read().split())
colors = [0 for i in range(8)]
tyty = 0
for a in A:
c = a//400
if c>=8:
tyty+=1
else:
colors[c]+=1
cNum = 8-colors.count(0)
minC = max(cNum,1)
maxC = cNum+tyty
print(minC,maxC) |
p03075 | s760060188 | Accepted | *l,k=map(int,open(0).read().split())
from itertools import permutations
perm = permutations(l, 2)
ans=[]
for i in list(perm):
ans.append(i[1]-i[0])
print("Yay!" if max(ans)<= k else ":(") |
p03835 | s716350642 | Accepted | k, s = map(int, input().split(' '))
ans = 0
for x in range(k+1):
for y in range(k+1):
if s - k <= x + y <= s:
ans +=1
print(ans) |
p03062 | s012615165 | Accepted | import math
def main():
n = int(input())
a = [int(t) for t in input().split()]
m = 0
if 0 in a or len([x for x in a if x<0])%2==0:
m = sum([abs(x) for x in a])
else:
a_ = [abs(x) for x in a]
m = sum(a_)-2*min(a_)
print(m)
if __name__ == "__main__":
main() |
p02552 | s253001006 | Wrong Answer | a = input()
if a == 0:
a = 1
print(a)
else:
a = 0
print(a)
|
p03417 | s004109878 | Accepted | n, m = map(int,input().split())
if n > m:
n, m = m, n
if n == 1 and m == 1:
print(1)
elif n == 1:
print(m-2)
elif n == 2:
print(0)
else:
print((n-2)*(m-2)) |
p02897 | s330487296 | Accepted | N = int(input())
print("0.5" if N % 2 == 0 else ((N//2)+1)/N) |
p02988 | s596069750 | Accepted | def main():
n=int(input())
p = list(map(int,input().split()))
ans=0
for i in range(0,n-2):
if max(p[i:i+3])!=p[i+1] and min(p[i:i+3])!=p[i+1]:
ans+=1
print(ans)
main() |
p03220 | s730222463 | Accepted | N = int(input())
T, A = map(int, input().split())
H = map(int, input().split())
near_i = -1
min_diff = 10**6 * 0.006
for i, h in enumerate(H):
temp = T - h * 0.006
diff = abs(A - temp)
if diff < min_diff:
min_diff = diff
near_i = i
print(near_i+1)
|
p03543 | s887142926 | Wrong Answer | n = input()
if len(set(n)) >= 3:
print('Yes')
else:
print('No') |
p03250 | s670242914 | Accepted | l = input().split()
l.sort(reverse=True)
print(int(l[0]+l[1])+int(l[2])) |
p02683 | s718321904 | Wrong Answer | N,M,X=map(int, input().split())
A=list(list(map(int, input().split())) for _ in range(N))
ans=M*10**5+1
import itertools
import numpy as np
for i in range(1,M+1):
for aa in list(itertools.combinations(A,i)):
tmp=np.array([0]*len(A[0]))
for a in aa:
a = np.array(a)
tmp=tmp+a
if min(tmp[1:])>=X:
ans=min(ans,tmp[0])
print(ans if ans!=(M*10**5+1) else -1) |
p02989 | s770890403 | Accepted | n = int(input())
d = sorted(list(map(int, input().split())))
if d[n//2-1] == d[n//2]:
print(0)
else:
print(d[n//2] - d[n//2-1]) |
p03495 | s060351852 | Wrong Answer | import collections as c
n,k = map(int,input().split())
l = list(map(int,input().split()))
count = c.Counter(l)
ans = 0
check = 0
right = len(count)-k
if right == 0:
print(0)
exit()
for i,j in count.most_common()[::-1]:
ans += j
check += 1
if check == right:
print(ans)
exit() |
p04029 | s678818088 | Accepted | #043_A
n=int(input())
print(n*(n+1)//2) |
p02700 | s215264370 | Accepted | # This Python file uses the following encoding: utf-8
# if __name__ == "__main__":
# pass
a, b, c, d = map(int, input().split())
'''
while a > 0 and c > 0:
c -= b
a -= d
if c <= 0:
print("Yes")
else:
print("No")
'''
if -(-c//b) <= -(-a//d):
print("Yes")
else:
print("No")
|
p03994 | s304421038 | Wrong Answer | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7
S = list(readline().rstrip())
K = int(readline())
N = len(S)
for i in range(N):
t = ord(S[i])-97
if 26 - t <= K:
S[i] = 'a'
K -= 26-t
S[-1] = chr((ord(S[-1])-97 + K%26)%26 + 97)
print(''.join(S))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.