problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p03803
|
s343617857
|
Wrong Answer
|
a,b = map(int,input().split())
if a == 1:
a = 14
elif b == 1:
b = 14
elif a == 1 and b == 1:
a = 14
b = 14
if a>b:
print("Alice")
elif b>a:
print("Bob")
else:
print("Draw")
|
p02556
|
s232318165
|
Accepted
|
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
a=10**9
z_max=-1*a
z_min=a
w_max=-1*a
w_min=a
for x,y in l: #点のx座標とy座標の和の最大値と最小値の差か座標の差の最大値と最小値の差が答え
z_max=max(z_max,x+y)
z_min=min(z_min,x+y)
w_max=max(w_max,x-y)
w_min=min(w_min,x-y)
print(max(z_max-z_min,w_max-w_min))
|
p03799
|
s280796947
|
Accepted
|
N, M = map(int,input().split())
cnt = 0
#cが余る(Sが使い切れる)とき
if 2*N <= M:
cnt += N
M -= 2*N
cnt += M//4
print(cnt)
#cが足りない(Sが余る)とき
else:
print(M//2)
|
p03160
|
s138417295
|
Accepted
|
n = int(input())
H = list(map(int, input().split()))
memo = [0 for _ in range(n)]
memo[1] = abs(H[1] - H[0])
for i in range(2, n):
memo[i] = min(memo[i-1] + abs(H[i] - H[i-1]), memo[i-2] + abs(H[i] - H[i-2]))
print(memo[-1])
|
p03030
|
s075039839
|
Accepted
|
# Problem B - Guidebook
# input
N = int(input())
restaurant = {}
for i in range(N):
s, p = input().split()
p = int(p)
if s in restaurant:
restaurant[s].append((i+1, p))
else:
restaurant[s] = [(i+1, p)]
# dict sort
restaurant = sorted(restaurant.items(), key= lambda x:x[0])
# price sort
for r in restaurant:
tmp = r[1]
result = sorted(tmp, key= lambda x:x[1], reverse=True)
for i in result:
print(i[0])
|
p02766
|
s304268210
|
Accepted
|
import math
n, k = map(int, input().split())
x = math.log(n, k)
x = math.floor(x)
print(x+1)
|
p02612
|
s380493480
|
Accepted
|
n = int(input())
if n%1000:
bills = n//1000 + 1
else:
bills = n//1000
ans = bills * 1000 - n
print(ans)
|
p02689
|
s369245256
|
Accepted
|
def LI():return list(map(int,input().split()))
n,m=LI()
h=LI()
edge=[[] for _ in range(n)]
for i in range(m):
a,b=LI()
a-=1
b-=1
edge[a].append(b)
edge[b].append(a)
ans=0
for i in range(n):
if all([h[i]-h[v]>0 for v in edge[i]]):
# print(i)
ans+=1
print(ans)
|
p03730
|
s809773623
|
Accepted
|
a, b, c = map(int, input().split())
S = set()
for i in range(100):
count = len(S)
S.add(a * i % b)
if len(S) == count:
break
print("YES" if c in S else "NO")
|
p03971
|
s319239446
|
Wrong Answer
|
N, A, B = list(map(int, input().split()))
S = input()
passed_num = 0
passed_foreigners_num = 0
for i in S:
if passed_num < A + B:
if i == 'a':
print('yes')
passed_num += 1
elif i == 'b' and passed_foreigners_num < B:
print(i)
print('yes')
passed_num += 1
passed_foreigners_num += 1
else:
print('No')
else:
print('No')
|
p02796
|
s832814886
|
Wrong Answer
|
n = int(input())
x = [list(map(int, input().split())) for i in range (n)]
grid = [list([0,0]) for i in range(n)]
for i in range(n):
grid[i][0] = x[i][0] - x[i][1]
grid[i][1] = x[i][0] + x[i][1]
new_grid = sorted(grid)
cnt = 0
for i in range(n-1):
if i + 1 >= len(new_grid):
break;
if new_grid[i][1] > new_grid[i+1][0]:
cnt += 1
del new_grid[i]
ans = n - cnt
print(ans)
|
p03785
|
s917113689
|
Accepted
|
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()
res = 0
t_0 = T[0]
c = C
for t in T:
if c == 0 or t - t_0 > K:
res += 1
t_0 = t
c = C - 1
else:
c -= 1
else:
if c != C:
res += 1
print(res)
|
p03795
|
s121288401
|
Accepted
|
import math
n=int(input())
print(800*n-200*math.floor(n/15))
|
p03286
|
s914085666
|
Wrong Answer
|
n=int(input())
ans=""
i=0
while n!=0 :
if n%2==0:
ans+="0"
else:
ans+="1"
if i%2==0:
n-=1
else:
n+=1
n=n//2
i+=1
#print(n,ans)
print(ans[::-1])
|
p03087
|
s308564206
|
Accepted
|
n, q = map(int, input().split())
s = input()
cnt_AC = [0] * n
cnt = 0
for i in range(n - 1):
if s[i] == "A" and s[i + 1] == "C":
cnt += 1
cnt_AC[i + 1] = cnt
for i in range(q):
l, r = map(int, input().split())
print(cnt_AC[r - 1] - cnt_AC[l - 1])
|
p03637
|
s633045902
|
Wrong Answer
|
N = int(input())
a_list = list(map(int, input().split()))
fours = []
twos = []
others = []
for a in a_list:
if a % 4 == 0:
fours.append(a)
elif a % 2 == 0:
twos.append(a)
else:
others.append(a)
if len(fours) - len(others) == -1 and len(twos) > 0:
print('No')
exit()
if len(fours) - len(others) < 0 :
print('No')
exit()
if len(fours) == 0 and len(twos) < 2:
print('No')
exit()
print("Yes")
|
p03994
|
s245417790
|
Accepted
|
s = str(input())
k = int(input())
n = len(s)
l = [0]*n
for i in range(n):
l[i] = ord('z') -ord(s[i]) + 1
l[i] %= 26
#print(l)
ans = list(s)
i = 0
while k > 0:
if i > n-1:
break
if l[i] <= k:
ans[i] = 'a'
k -= l[i]
i += 1
k %= 26
if k > 0:
ans[-1] = chr((k + ord(ans[-1])-ord('a'))%26+97)
#print(ans)
print(''.join(ans))
|
p02694
|
s561870433
|
Accepted
|
def solve(x):
y = 100
ans = 0
while y < x:
y = int(y * 1.01)
ans += 1
return ans
x = int(input())
print(solve(x))
|
p02546
|
s088937403
|
Accepted
|
S = input()
if S[-1] == "s":
print(S+"es")
else:
print(S+"s")
|
p02729
|
s435704628
|
Accepted
|
n, m = map(int,input().split())
if n==0:
c=m*(m-1)/2
elif m==0:
c=n*(n-1)/2
else:
c=n*(n-1)/2+m*(m-1)/2
print(int(c))
|
p02786
|
s500562548
|
Accepted
|
import math
h = int(input())
if h == 1:
print(1)
exit()
x = 0
c = 1
while h >= 1:
h = math.floor(h/2)
x += c
c *= 2
print(x)
|
p02642
|
s223961343
|
Wrong Answer
|
n = int(input())
a = list(map(int, input().split()))
a = list(set(a))
a.sort()
p = []
if len(a) == 1:
print(0)
exit()
for a_i in a:
if not p:
p.append(a_i)
continue
warikireru = False
for p_i in p:
if a_i%p_i == 0:
warikireru = True
break
if warikireru:
continue
else:
p.append(a_i)
print(len(p))
|
p03639
|
s363908817
|
Wrong Answer
|
N = int(input())
A = list(map(int,input().split()))
cnt_2 = 0
cnt_4 = 0
for a in A:
if a % 4 == 0:
cnt_4 += 1
elif a % 2 == 0:
cnt_2 += 1
if N <= cnt_2 + cnt_4 * 3:
print('Yes')
else:
print('No')
|
p03219
|
s370216373
|
Accepted
|
X,Y = map(int,input().split())
print(X+Y//2)
|
p03557
|
s295902563
|
Accepted
|
import sys
from bisect import bisect
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
b.sort()
c.sort()
bc = [0 for _ in range(n)]
for i in range(len(b)):
if b[i] >= c[n-1]:
break
p = bisect(c,b[i])
bc[i] = (n-p)
for i in range(len(b)-1,0,-1):
bc[i-1] += bc[i]
ans = 0
for x in a:
if x < b[n-1]:
p = bisect(b,x)
ans += bc[p]
print(ans)
|
p03309
|
s548061512
|
Wrong Answer
|
n = int(input())
a = list(map(int ,input().split()))
d = min(a)-len(a) - len(a)
u = max(a) * 2
while u-d > 1:
mid = (d + u) // 2
val = 0
for i in range(n):
val += a[i] - (mid + i+1)
if val < 0:
u = mid
else:
d = mid
ans1 = 0
ans2 = 0
#print(u,d)
for i in range(n):
ans1 += abs(a[i] - (u + i+1))
ans2 += abs(a[i] - (d + i+1))
print(min(ans1,ans2))
|
p03220
|
s203153077
|
Accepted
|
N=int(input())
a=input().split()
T=int(a[0])
A=int(a[1])
H=[int(x) for x in input().split()]
t=abs(T-0.006*H[0]-A)
s=0
for i in range(N):
if t>abs(T-0.006*H[i]-A):
t=abs(T-0.006*H[i]-A)
s=i
print(s+1)
|
p03774
|
s889954908
|
Accepted
|
n,m=map(int,input().split())
stu=[]
poi=[]
for i in range(n):
a,b=map(int,input().split())
stu.append([a,b])
for i in range(m):
a,b=map(int,input().split())
poi.append([a,b])
for i in stu:
ans=float("inf")
ans_index=0
ans_lis=[abs(i[0]-j[0])+abs(i[1]-j[1]) for j in poi]
print(ans_lis.index(min(ans_lis))+1)
|
p02983
|
s874047969
|
Accepted
|
l,r = map(int,input().split())
m = 2018
if r - l >= 2019:
print(0)
exit()
else:
for i in range(l,r):
for j in range(i+1,r+1):
m = min(m,i*j % 2019)
print(m)
|
p03998
|
s976944756
|
Accepted
|
s = [list(input()) for _ in range(3)]
n_row = 0
dic = {0:"A",1:"B",2:"C"}
s_fix = {"a":0,"b":1,"c":2}
while len(s[n_row]):
n_row = s_fix[s[n_row].pop(0)]
print(dic[n_row])
|
p03838
|
s386558327
|
Accepted
|
x,y = map(int, input().split())
ans = 0
if (x==0 and y>0) or (y==0 and x<0):
ans = abs(abs(y)-abs(x))
elif (x==0 and y<0) or (y==0 and x>0):
ans = abs(abs(y)-abs(x))+1
else:
ans = abs(abs(y)-abs(x))
if x>0 and y>0:
if x>y:
ans += 2
elif x>0 and y<0:
ans += 1
elif x<0 and y>0:
ans += 1
elif x<0 and y<0:
if x>y:
ans += 2
print(ans)
|
p03386
|
s803703860
|
Wrong Answer
|
a, b, k = [int(x) for x in input().split()]
wk1 = list(range(a, min(a+k, b)))
wk2 = list(range(max(b-k+1, a), b+1))
for c in (wk1 + wk2):
print(c)
|
p03345
|
s701485164
|
Accepted
|
a,b,c,k = map(int,input().split())
ans = b - a
if k % 2 == 0:
ans = a - b
print(ans)
|
p02676
|
s023267794
|
Accepted
|
k=input()
s=raw_input()
if len(s)>k:
print s[:k]+'...'
else:
print s
|
p02759
|
s486569457
|
Accepted
|
import math
N = int(input())
O = N // 2 + N % 2
print(O)
|
p02796
|
s373851188
|
Accepted
|
n = int(input())
li_a = []
for i in range(n):
a = list(map(int, input().split()))
li_a.append(a)
li = list(sorted(li_a))
ans = 0
b = li[0][0] + li[0][1]
for i in range(n-1):
if li[i+1][0] - li[i+1][1] >= b:
b = li[i+1][0] + li[i+1][1]
else:
b = min(b, li[i+1][0]+li[i+1][1])
ans += 1
print(n-ans)
|
p03109
|
s188146026
|
Accepted
|
s = input()
if int(s[6]) <= 4 and int(s[5]) == 0:
print("Heisei")
else:
print("TBD")
|
p02583
|
s422174051
|
Accepted
|
import itertools
N = int(input())
L = list(map(int, input().split()))
cnt = 0
for i in itertools.combinations(L, 3):
# print(i)
# print(i[0],i[1],i[2])
if i[0] == i[1] or i[0] == i[2] or i[1] == i[2]:
continue
ij = i[0]+i[1] > i[2]
ik = i[0]+i[2] > i[1]
jk = i[1]+i[2] > i[0]
if ij + ik + jk == 3:
cnt += 1
print(cnt)
|
p02717
|
s950976819
|
Wrong Answer
|
c, a, b= input().split()
print(a, b, c)
|
p03785
|
s472162055
|
Accepted
|
N,C,K,*T=map(int, open(0).read().split())
T=sorted(T)
ans=0
cap=0
s=-1
for t in T:
if t<=s and cap>0:
cap-=1
else:
s=t+K
cap=C-1
ans+=1
print(ans)
|
p02820
|
s311066591
|
Accepted
|
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
mp_score = {"r": P, "s": R, "p": S}
lines = [""] * K
for ix in range(len(T)):
lines[ix%K] += T[ix]
ans = 0
for l in lines:
before = ""
for c in l:
if before == c:
before = ""
else:
ans += mp_score[c]
before = c
print(ans)
|
p03475
|
s067253154
|
Wrong Answer
|
import sys
N = int(input())
CSF = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(N - 1)]
for i in range(N - 1):
res = 0
for c, s, f in CSF[i:]:
if res < s:
res = s + c
elif res % f == 0:
res += c
else:
res += res % f + c
print(res)
print(0)
|
p02571
|
s974791579
|
Wrong Answer
|
S = input()
T = input()
A = len(T)
for i in range(len(T)):
M = S.find(T[i:])
if M >= i and A > i:
A = i
for i in range(1,len(T)):
M = S.rfind(T[:i])
if M >= i and A > i:
A = i
print(A)
|
p02658
|
s990223128
|
Accepted
|
_ = input()
nums = list(map(int, input().split()))
ans = 1
if 0 in nums:
ans = 0
for num in nums:
if ans <= 10 ** 18:
ans *= num
else:
break
print(ans if ans <= 10**18 else -1)
|
p03612
|
s879097365
|
Accepted
|
n = int(input())
l = [int(i) for i in input().split()]
orderd = [i for i in range(1,n+1)]
ans = 0
for i in range(n-1):
if l[i]== orderd[i]:
l[i],l[i+1] = l[i+1],l[i]
ans += 1
print(ans + 1 if l[-1] == n else ans)
|
p02687
|
s551933915
|
Wrong Answer
|
def main():
s = input()
if s == "ABC" :
print("ARC")
else:
print("ARC")
if __name__ == "__main__":
main()
|
p03243
|
s905084009
|
Accepted
|
print((((int(input())-1)//111)+1)*111)
|
p02970
|
s788799308
|
Accepted
|
n, d = map(int, input().split())
area = (d*2)+1
if n%area == 0:
ans = int(n//area)
else:
ans = int(n//area) + 1
print(ans)
|
p02823
|
s615315784
|
Wrong Answer
|
N,A,B=map(int, input().split())
if (A-B)%2==0:
print(abs((A-B))//2)
else:
a=max(A-1,B-1)
b=max(N-A,N-B)
print(min(a,b))
|
p03262
|
s628354345
|
Accepted
|
N,X=map(int,input().split())
A=list(map(int,input().split()))
B=[]
for i in A:
B.append(abs(X-i))
import functools
import fractions
gcd=functools.reduce(fractions.gcd,B)
print(gcd)
|
p04011
|
s307563865
|
Wrong Answer
|
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = 0
for i in range(1,a+1):
if i >= b:
e += d
else:
e += c
print(e)
|
p02989
|
s028905450
|
Wrong Answer
|
N = int(input())
d = list(map(int, input().split()))
K = 1
ans = []
ARC = []
ABC = []
for j in range(1, max(d)):
for i in range(N):
if (d[i] >= K):
ARC.append(d[i])
else:
ABC.append(d[i])
if (len(ARC) == len(ABC)):
ans.append(K)
else:
ARC = []
ABC = []
K += 1
print(len(ans))
|
p02699
|
s855305962
|
Accepted
|
s,w = map(int,input().rstrip().split(" "))
if w >= s:
print("unsafe")
else:
print("safe")
|
p02829
|
s008041813
|
Accepted
|
a=int(input())
b=int(input())
print (list(set([1,2,3])-set([a,b]))[0])
|
p02753
|
s281711827
|
Wrong Answer
|
from sys import stdin
#T = int(stdin.readline())
S = stdin.readline().strip()
print(S)
if S == "AAA" or S == "BBB":
print('No')
else:
print('Yes')
|
p02598
|
s265799568
|
Accepted
|
def check(lis,k,mid):
for i in lis:
if(i%mid==0):
k+=1
k-=(i//mid)
return k>=0
n,k=map(int,input().split())
lis=list(map(int,input().split()))
a,b=1,max(lis)
ans=b
while(a<=b):
mid=(a+b)//2
if(check(lis,k,mid)):
ans=mid
b=mid-1
else:
a=mid+1
print(ans)
|
p02664
|
s188645365
|
Accepted
|
t = input()
print(t.replace('?', 'D'))
|
p02791
|
s290714086
|
Accepted
|
n = int(input())
p = list(map(int, input().split()))
ans = 0
min = p[0]
for i in range(len(p)):
if p[i]<=min:
min = p[i]
ans += 1
print(ans)
|
p03317
|
s282772223
|
Accepted
|
N, K = map(int, input().split())
alist = list(map(int, input().split()))
ans = 1
N -= K
while N > 0:
N -= K-1
ans += 1
print(ans)
|
p03103
|
s705653755
|
Accepted
|
import numpy as np
N,M = map(int,input().split())
AB = []
for i in range(N):
a,b = map(int,input().split())
AB.append([a,b])
need = M
cost = 0
AB.sort()
for i in range(N):
if need - AB[i][1] >= 0:
need -= AB[i][1]
cost += AB[i][0]*AB[i][1]
else:
cost += AB[i][0]*need
break
print(cost)
|
p03838
|
s596304235
|
Wrong Answer
|
x, y = map(int, input().split())
count = abs(abs(x)-abs(y))
if x * y <= 0:
count += 1
elif x * y > 0:
if x < 0 and abs(x) < abs(y):
count += 2
elif x > 0 and abs(x) > abs(y):
count += 2
print(count)
|
p03472
|
s424406129
|
Accepted
|
from math import *
n,h=map(int,input().split())
a=[]
b=[]
for i in range(n):
A,B=map(int,input().split())
a.append(A)
b.append(B)
aa=max(a)
b.sort(reverse=True)
ans=0
for i in range(n):
if b[i]>aa:
h-=b[i]
ans+=1
if h<=0:
print(ans)
exit()
print(ans+ceil(h/aa))
|
p02663
|
s560276059
|
Accepted
|
a, b, c, d, e = map(int, input().split())
start = a*60 + b
end = c*60 + d
print(end - e - start)
|
p02831
|
s035368696
|
Accepted
|
A,B=map(int,input().split())
import math
print(A*B//math.gcd(A,B))
|
p02748
|
s905845966
|
Accepted
|
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = [tuple(map(int, input().split())) for _ in range(M)]
minP = min(a) + min(b)
for x, y, c in xyc:
minP = min(a[x-1]+b[y-1]-c, minP)
print(minP)
|
p02613
|
s741130919
|
Accepted
|
N = int(input())
dict = {}
dict['AC'] = 0
dict['WA'] = 0
dict['TLE'] = 0
dict['RE'] = 0
for i in range(N):
s = input()
dict[s] += 1
print('AC x',dict['AC'])
print('WA x',dict['WA'])
print('TLE x',dict['TLE'])
print('RE x',dict['RE'])
|
p03331
|
s236174823
|
Accepted
|
n = input(); a = 0
for i in range(len(n)): a += int(n[i])
print(10) if a == 1 else print(a)
|
p02791
|
s155003992
|
Wrong Answer
|
n = input()
p = input().split()
cnt = 1
for i in range(1, len(p)):
if p[i-1] > p[i]:
cnt += 1
if p[i] == 1:
break
print(cnt)
|
p03427
|
s863150586
|
Accepted
|
N = int(input())
if N < 10:
print(N)
else:
str_N = str(N)
### 最上位以外すべて9 の場合はその値が最大値
for n in str_N[1:]:
if n != '9':
### それ以外は最上位の桁を一つ下げてあと全部9 が一番最大
print(int(str_N[0]) - 1 + (len(str_N) - 1) * 9)
break
else:
print(int(str_N[0]) + (len(str_N) - 1) * 9)
|
p03779
|
s469340177
|
Accepted
|
x=int(input())
r=10**9
l=0
while r-l>1:
mid=(r+l)//2
if x<=mid*(mid+1)//2:
r=mid
else:
l=mid
print(r)
|
p02778
|
s104636657
|
Accepted
|
S = input()
print("x"*len(S))
|
p03062
|
s092859522
|
Accepted
|
import sys
import itertools
# import numpy as np
import time
import math
import heapq
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9 + 7
# map(int, input().split())
# list(map(int, input().split()))
N = int(input())
A = list(map(int, input().split()))
negs = 0
abs_min = INF
total = 0
for a in A:
if a < 0:
negs += 1
abs_min = min(abs_min, abs(a))
total += abs(a)
if negs % 2 == 0:
print(total)
else:
print(total - abs_min * 2)
|
p02897
|
s140764080
|
Wrong Answer
|
n = int(input())
if n == 1: print(1)
else: print(2/n)
|
p02775
|
s702349688
|
Accepted
|
N = input()
a = 0 # not borrowed
b = 0 # borrowed
t = int(N[-1])
a, b = a + t, a + (10 - t)
for i in range(len(N) - 2, -1, -1):
t = int(N[i])
a, b = min(a + t, b + (t + 1)), min(a + (10 - t), b + (10 - (t + 1)))
print(min(a, b + 1))
|
p03943
|
s899533135
|
Accepted
|
a,b,c = [int(i) for i in input().split()]
if c == a + b or b == a + c or a == b + c:
print("Yes")
else:
print("No")
|
p03711
|
s055966606
|
Accepted
|
#!python3
LI = lambda: list(map(int, input().split()))
# input
x, y = LI()
def group(num):
if num == 2:
return 0
if num in {4, 6, 9, 11}:
return 1
return 2
def main():
if group(x) == group(y):
ans = "Yes"
else:
ans = "No"
print(ans)
if __name__ == "__main__":
main()
|
p03494
|
s877092147
|
Accepted
|
n=int(input())
a=list(map(int, input().split()))
ans=10**9
for i in range(n):
num=a[i]
cnt=0
while num%2==0:
num/=2
cnt+=1
ans=min(ans, cnt)
print(ans)
|
p02613
|
s809304661
|
Wrong Answer
|
N = int (input())
S = [input() for i in range(0,N)]
C0=0 #AC
C1=0 #WA
C2=0 #TLE
C3=0 #RE
for i in range(0,N):
if S[i]=='AC':
C0+=1
elif S[i]=='WA':
C1+=1
elif S[i]=='TLE':
C2+=1
elif S[i]=='RE':
C3+=0
print('AC x', C0)
print('WA x', C1)
print('TLE x', C2)
print('RE x', C3)
|
p02953
|
s342828188
|
Accepted
|
def solve():
N = int(input())
A = list(map(int, input().split()))
ans = True
m = 0
for i in range(N-1):
m = max(m, A[i])
if m-1 > A[i+1]:
ans = False
return 'Yes' if ans else 'No'
print(solve())
|
p02640
|
s759384552
|
Accepted
|
x,y=map(int,input().split())
if 2*x<=y and y<=4*x and y%2==0:
print("Yes")
else:
print("No")
|
p03605
|
s741566578
|
Accepted
|
N = input()
if '9' in N:
print('Yes')
else:
print('No')
|
p02742
|
s906097457
|
Accepted
|
H,W=(int(x) for x in input().split())
if H == 1 or W == 1:
print(1)
exit()
if (H * W) % 2 == 0:
print((H * W) // 2)
else:
print(((H * W) // 2) + 1)
|
p03419
|
s529799764
|
Accepted
|
n, m = map(int, input().split())
print(abs(n - 2) * abs(m - 2))
|
p02963
|
s952094037
|
Wrong Answer
|
import math
s = int(input())
x1 = 1000000000
y1 = 1
x2 = math.ceil(s / x1)
y2 = x2 * x1 - s
print(0, 0, x1, y1, x2, y2)
|
p03773
|
s530571688
|
Accepted
|
a, b = map(int,input().split())
print((a+b)%24)
|
p02601
|
s367960843
|
Accepted
|
A,B,C = map(int, input().split())
K = int(input())
while A>=B:
B *= 2
K -= 1
while B>=C:
C *= 2
K -= 1
if K < 0:
print("No")
else:
print("Yes")
|
p02859
|
s644098400
|
Accepted
|
r=int(input())
print(r**2)
|
p03803
|
s018346710
|
Accepted
|
import sys
def yn(b):
print("Yes" if b==1 else "No")
return
def resolve():
readline=sys.stdin.readline
a,b=list(map(int, readline().strip().split()))
if a==b:
print("Draw")
return
if a==1:
print("Alice")
return
if b==1:
print("Bob")
return
if a>b:
print("Alice")
return
else:
print("Bob")
return
resolve()
|
p02918
|
s532210129
|
Accepted
|
n,k=map(int,input().split())
S=input()
now="0"
cnt=0
for s in S:
if s!=now:
cnt+=1
now=s
print(min(n-cnt+2*k,n-1))
|
p02994
|
s065265166
|
Accepted
|
import sys
def S(): return sys.stdin.readline().rstrip()
N,L = map(int,S().split())
A = [L+i for i in range(N)]
if A[0] >= 0:
print(sum(A)-A[0])
elif A[-1] <= 0:
print(sum(A)-A[-1])
else:
print(sum(A))
|
p03627
|
s507333126
|
Accepted
|
N = int(input())
a = list(map(int,(input().split())))
from collections import Counter
c = Counter(a)
L = []
LL = []
for k in c.keys():
if c[k] >= 2:
L.append(k)
if c[k] >= 4:
LL.append(k)
M = 0
if LL:
M = max(LL)**2
if len(L) < 2:
print(0)
else:
L.sort(reverse=True)
print(max(L[0]*L[1],M))
|
p03377
|
s154451627
|
Accepted
|
a, b, x = map(int, input().split())
if a <= x <= a + b:
print('YES')
else:
print('NO')
|
p03252
|
s773036514
|
Wrong Answer
|
from collections import Counter
S = input()
T = input()
counter_S = Counter(S)
counter_T = Counter(T)
length_CS = len(counter_S)
length_CT = len(counter_T)
# print(counter_S)
# print(counter_T)
if length_CS != length_CT:
print("No")
else:
flag = True
list_CS = list(counter_S.values())
list_CT = list(counter_T.values())
for i in range(length_CS):
if list_CS[i] != list_CT[i]:
flag = False
break
if flag:
print("Yes")
else:
print("No")
|
p02595
|
s769824605
|
Accepted
|
X = list()
Y = list()
D = list()
score = 0
n,d = map(int, input().split())
for i in range(n):
x, y = map(int, input().split())
X.append(x)
Y.append(y)
for i in range(n):
dis = (X[i]**2 + Y[i]**2)**0.5
D.append(dis)
for i in range(n):
if d >= D[i]:
score += 1
print(score)
|
p02708
|
s745523575
|
Wrong Answer
|
a, b = map(int, input().split())
mod = pow(10,9) + 7
def cal(a,i):
min = i*(i+1)/2
max = a*(a+1)/2 - (a-i)*(a-i+1)/2
return max - min + 1
count = 0
for i in range(a-b+1):
count += cal(a,i+b)
print(count % mod)
|
p03644
|
s690421531
|
Accepted
|
N=int(input())
a=[]
for b in range(1,N+1,1):
count=0
while b%2 == 0:
count+=1
b/=2
a.append(count)
print(a.index(max(a))+1)
|
p02660
|
s164963379
|
Wrong Answer
|
n=int(input())
i=2
counter_set=set()
tmp=1
flag=True
while n!=1 :
if n%i==0:
flag=False
n=n//i
tmp=tmp*i
if tmp not in counter_set:
counter_set.add(tmp)
tmp=1
else:
i+=1
flag=True
if i>=(n)**(1/2) and flag:
counter_set.add(n)
break
print(len(counter_set))
|
p02699
|
s689839931
|
Wrong Answer
|
S, W = map(int, input().split())
def f():
if W > S:
return "unsafe"
else:
return "safe"
print(f())
|
p03679
|
s443017192
|
Accepted
|
def resolve():
x, a, b = map(int, input().split())
if b - a > x:
print('dangerous')
elif a >= b:
print('delicious')
else:
print('safe')
resolve()
|
p03795
|
s487992745
|
Accepted
|
# https://atcoder.jp/contests/abc055/tasks/abc055_a
N = int(input())
x = 800 * N
y = (N // 15) * 200
print(x - y)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.