problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02595 | s888720176 | Accepted | import numpy
N, D = map(int, input().split())
X = [0] * N
Y = [0] * N
count = 0
for i in range(N):
X[i], Y[i] = map(int, input().split())
if numpy.sqrt(X[i]**2 + Y[i]**2) <= D:
count += 1
print(count) |
p02642 | s089428695 | Accepted | n = int(input())
a = list(map(int, input().split()))
a.sort()
m = a[-1]
c = [0] * (m + 1)
for ai in a:
for i in range(ai, m + 1, ai):
c[i] += 1
ans = 0
for ai in a:
if c[ai] == 1:
ans += c[ai]
print(ans) |
p02959 | s234887694 | Accepted | N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
sumA = sum(A)
for i in range(N):
num = min(A[i], B[i])
A[i] -= num
B[i] -= num
if B[i]:
num = min(A[i+1], B[i])
A[i+1] -= num
print(sumA - sum(A)) |
p02797 | s736647347 | Accepted | def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
n,k,s = iim()
ans = [s]*k+[1 if s==1000000000 else 1000000000]*(n-k)
print(*ans) |
p03352 | s552057076 | Accepted | X = int(input())
list = []
if X == 1:
list.append(1)
#2^2からスタートするため、X=3も例外として加えなければならない
elif X == 2 or X == 3:
list.append(2)
else:
for b in range(2, X):
p = 2
#X自身になったときに処理できないので
#<=が必要
while b ** p <= X:
list.append(b ** p)
p += 1
print(max(list))
|
p02918 | s856330812 | Accepted | #!/usr/bin python3
# -*- coding: utf-8 -*-
def main():
N, K = map(int, input().split())
S = input()
ret = 0
for i in range(1,N-1):
if (S[i]=='L' and S[i-1]=='L') or (S[i]=='R' and S[i+1]=='R'):
ret += 1
if S[0]=='R' and S[1]=='R':
ret += 1
if S[N-1]=='L' and S[N-2]==... |
p03997 | s317308827 | Accepted | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2) |
p04005 | s933215246 | Accepted | a = list(map(int, input().split()))
a.sort()
if a[0] % 2 == 0 or a[1] % 2 == 0 or a[2] % 2 == 0:
print(0)
else:
print(a[0] * a[1])
|
p03319 | s611231608 | Wrong Answer | N, K = map(int, input().split())
A = list(map(int, input().split()))
one = A.index(1)
print((one+1)//(K-1) + (N-one)//(K-1))
|
p02831 | s334849781 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
import fractions
def resolve():
a, b = map(int, input().split())
print((a * b) // fractions.gcd(a, b))
resolve()
|
p03797 | s269642344 | Wrong Answer | N, M = map(int,input().split())
ans = 0
for i in range(max(0,M//2-N-3), max(0, M//2-N+3)):
ans = max(ans,min(N+i//2,(M-i)//2))
print(ans) |
p03127 | s826251090 | Wrong Answer | N = int(input())
A = [int(i) for i in input().split()]
same = True
for i in range(N):
a = A[i]
if i > 0 and a != A[i-1]:
same = False
if a % 2 == 1:
print(1)
break
else:
if same:
print(A[0])
else:
print(2) |
p02785 | s622561503 | Wrong Answer | # ABC153
# C
N, K = input().split()
H_list = input().split()
H_list.sort(reverse=True)
count = 0
for i in range(int(K),len(H_list)):
count += int(H_list[i])
print(count) |
p03127 | s590233766 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
if max(a) != min(a):
while a.count(0) != len(a)-1:
print(a)
a.sort()
b = [a[0]]
for i in a[1:]:
if i%a[0] != 0:
b.append(i%a[0])
a = b
print(max(a))
else:
print(a[0]) |
p03836 | s686552743 | Wrong Answer | sx,sy,tx,ty = map(int,input().split())
x_diff = tx-sx
y_diff = ty-sy
up = 'U'*abs(y_diff)
down = 'D'*abs(y_diff)
left = 'L'*abs(y_diff)
right = 'R'*abs(y_diff)
ans = down+left+up+right
ans = 'RD'+down+left+'LU'+'LU'+up+right+'RD'+ans
print(ans) |
p03035 | s830240151 | Accepted | import sys
stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))
a, b = nm()
if a >= 13:
print(b)
elif 6 <= a <= 12:
print(b // 2)
else:
pri... |
p03284 | s183888951 | Accepted | N, K = map(int, input().split())
if N % K == 0:
print(0)
else:
print(1) |
p03243 | s159613678 | Wrong Answer | n = list(input())
n.sort()
print(n[2] * 3) |
p03478 | s545277735 | Wrong Answer | N,A,B = map(int,input().split())
N_sum = 0
for i in range(N+1):
j = i
if j >= 10:
j = list(str(j))
j = int(j[0]) + int(j[1])
if j >= A and j <= B:
N_sum += i
print(N_sum) |
p02918 | s628496170 | Wrong Answer | n,k=map(int,input().split())
S=input()+'R'
c=0
d=0
for i in range(n):
if S[i]==S[i+1]:
c+=1
if S[i]!=S[i+1]:
d+=1
print(c+2*k if d>k else c+2*k-1) |
p02677 | s637199477 | Accepted | import math
A,B,H,M = map(int, input().split())
Md = M * 360 / 60
Hd = H * 30 + M * 30 / 60
MHd = abs(Md - Hd)
if MHd > 180 :
MHd = 360 - MHd
ans = A**2 + B**2 - 2 * A * B * math.cos(math.radians(MHd))
# print(math.cos(math.radians(60)))
print (math.sqrt(ans))
|
p02699 | s053902609 | Accepted | s,w =map(int,input().split())
if s <= w:
print('unsafe')
else:
print('safe')
|
p03352 | s838472881 | Accepted | x = int(input())
ans = 0
for i in range(x, 0, -1):
for j in range(2, max(x + 1, 3)):
if pow(i, j) <= x:
ans = max(ans, pow(i, j))
else:
break
print(ans) |
p02873 | s815252908 | Accepted | S = input()
x = len(S)
ans = [0] * (x+1)
for i in range(x):
if S[i] == '<':
ans[i+1] = ans[i] + 1
for i in range(x-1,-1,-1):
if S[i] == '>':
ans[i] = max(ans[i],ans[i+1]+1)
print(sum(ans)) |
p03427 | s917261811 | Wrong Answer | n = input()
ans = 0
accu = 0
for i, j in enumerate(n):
j = int(j)
if j>0:
ans = max(ans, accu+j-1+9*(len(n)-i-1))
accu += j
print(ans) |
p03109 | s173734531 | Accepted | a=list(map(int,input().split('/')))
print('TBD' if a[1]>4 else 'Heisei') |
p02795 | s807644810 | Accepted | #template
def inputlist(): return [int(j) for j in input().split()]
from collections import Counter
#template
#issueから始める
H=int(input())
W = int(input())
N = int(input())
m = max(H,W)
n=N/m
if n.is_integer():
print(int(n))
exit()
else:
print(int(n)+1) |
p03645 | s300881042 | Wrong Answer | n,m = map(int,input().split())
lis = [[] for i in range(n)] #なぜか知らんけど[[]]*nじゃだめらしい
for i in range(m):
a,b = map(int,input().split())
lis[a-1].append(b-1)
lis[b-1].append(a-1)
print(lis)
for i in lis[0]:
if i in set(lis[-1]):
print('POSSIBLE')
exit()
|
p02912 | s858857580 | Accepted | import heapq
N, M = map(int, input().split())
a = [-int(x) for x in input().split()]
heapq.heapify(a)
num = 0
hq = 1
while num < M and hq != 0:
hq = -heapq.heappop(a)
hq2 = hq // 2
heapq.heappush(a, -hq2)
num += 1
print(-sum(a)) |
p03479 | s213971738 | Accepted | x, y = map(int, input().split())
ans = 0
while x <= y:
ans += 1
x *= 2
print(ans) |
p02780 | s868823105 | Wrong Answer | #coding:utf-8
import numpy as np
n,k=map(int,input().split())
P=list(map(int,input().split()))
s=[(1/2)*x*(x+1)/x for x in P]
number=len(P)-k+1
print(np.max(np.convolve(s,np.ones(number)/number,mode='same'))*number)
|
p03543 | s714619521 | Accepted | a,b,c,d=input()
print("Yes" if a==b==c or b==c==d else "No") |
p02918 | s313232270 | Wrong Answer | n,k=map(int,input().split())
s=input()
a=[]
cnt=0
flag=s[0]
for i in range(1,n):
if flag==s[i]:cnt+=1
else:
flag=s[i]
a+=[cnt]
cnt=0
a+=[cnt]
l=sorted(a[::2])[::-1]
r=sorted(a[1::2])[::-1]
print(min(max(sum(r[:k])+sum(l),sum(r)+sum(l[:k]))+2*k,n-1)) |
p03435 | s445153061 | Accepted | c_1 = list(map(int, input().split()))
c_2 = list(map(int, input().split()))
c_3 = list(map(int, input().split()))
diff = []
for i in range(2):
diff.append(c_1[i] - c_1[i+1])
if c_2[0] - c_2[1] != diff[0] or c_2[1] - c_2[2] != diff[1]:
print("No")
exit()
if c_3[0] - c_3[1] != diff[0] or c_3[1] - c_3[2] !... |
p03827 | s863621717 | Accepted | n = int(input())
s = input()
x = ans = 0
for i in range(n):
if s[i] == "I":
x += 1
else:
x -= 1
ans = max(ans,x)
print(ans) |
p03071 | s486584271 | Wrong Answer | import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i... |
p02711 | s720430614 | Wrong Answer | N=input()
if N[0] == '7' or N[1] == 7 or N[2] == '7':
print("Yes")
else:
print("No") |
p03745 | s495598034 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
ans = 0
c = 0
c1 = 0
for i in range(1, n):
if a[i] > a[i-1]:
c1 = 1
elif a[i] < a[i-1]:
c1 = -1
if c != c1 and c != 0:
ans += 1
c = 0
continue
c = c1
print(ans+1) |
p03211 | s530287436 | Accepted | s = input()
n = len(s)
ans = 1000
for i in range(n-2):
a = '' + s[i] + s[i+1] + s[i+2]
a = int(a)
ans = min(ans, abs(a - 753))
print(ans) |
p04033 | s382674261 | Accepted | a,b = map(int,input().split())
if a > 0:
result = "Positive"
elif a == 0:
result = "Zero"
else:
if b >= 0:
result = "Zero"
else:
c = b - a
if c % 2 == 0:
result = "Negative"
else:
result = "Positive"
print(result) |
p03417 | s455994903 | Accepted | from sys import stdin
N, M = map(int, stdin.readline().split())
print(abs(N * M - 2 * (N + M) + 4))
|
p03943 | s480509786 | Accepted | a = list(map(int, input().split()))
a.sort()
if a[0] + a[1] == a[2]:
print('Yes')
else:
print('No') |
p03944 | s277398146 | Accepted | W, H, N = map(int, input().split())
d = [[0, W], [0, H]]
for i in range(N):
x, y, a = map(int, input().split())
if a == 1:
d[0][0] = max(x, d[0][0])
elif a == 2:
d[0][1] = min(x, d[0][1])
elif a == 3:
d[1][0] = max(y, d[1][0])
elif a == 4:
d[1][1] = min(y, d[1][1])
print(max((d[0][1] - d[0][0]... |
p04033 | s022480769 | Accepted | a, b = map(int, input().split())
if 0 < a and a <= b:
print('Positive')
elif a <= b and b < 0:
if (b-a+1) % 2 == 0:
print('Positive')
else:
print('Negative')
else:
print('Zero') |
p02795 | s873057263 | Accepted | import math
h, w, n = [int(input()) for i in range(3)]
m = 0
ans = math.ceil(n / max(h, w))
print(ans) |
p04034 | s767417007 | Accepted | n,m=map(int,input().split())
a=[[int(i) for i in input().split()] for i in range(m)]
possibility=[False]*n
possibility[0]=True
count=[1]*n
for x,y in a:
if possibility[x-1]==True and count[x-1]>1:
possibility[y-1]=True
elif possibility[x-1]==True and count[x-1]==1:
possibility[x-1]=False
... |
p03067 | s503328215 | Accepted | a,b,c = map(int,input().split())
if (c>a and c<b) or (c>b and c<a):
print("Yes")
else:
print("No") |
p02689 | s691176564 | Accepted | n, m = map(int, input().split())
H = list(map(int, input().split()))
# AB = [list(map(int, input().split())) for _ in range(m)]
edges = [[] for _ in range(n)]
for i in range(m):
a, b = map(int, input().split())
edges[a - 1].append(b - 1)
edges[b - 1].append(a - 1)
ans = 0
for idx, e_list in enumerate(edge... |
p03435 | s694090395 | Accepted | c = [list(map(int, input().split())) for _ in range(3)]
a = sum(c[0]) + sum(c[1]) + sum(c[2])
b = c[0][0] + c[1][1] + c[2][2]
print('Yes' if a == 3 * b else 'No') |
p03438 | s982394302 | Wrong Answer | N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
d=[]
for i in range(N):
d.append(a[i]-b[i])
cnt=-sum(d)
n=0
for j in range(N):
if d[j]<0:
n+=-d[j]//2
if n<cnt:
print("Yes")
else:
print("No") |
p03474 | s803512746 | Accepted | a,b=map(int,input().split())
num=list(input())
non=False
for (i,c) in zip(range(0,a+b+1),num):
if c=="-":
if i==a:
continue
else:
non=True
break
elif i==a:
non=True
break
if non:
print("No")
else:
print("Yes") |
p03679 | s372946981 | Wrong Answer | x, a, b = map(int, input().split())
if b<=a:
print('delicious')
elif b-a <=x:
print('safe')
else:
print('dangerouse')
|
p02571 | s619379587 | Accepted | import sys
s = input()
t = input()
finalans = 1000000
for i in range(len(s) - len(t) + 1):
ans = 0
for j in range(len(t)):
if (s[i+j] == t[j]):
pass
else:
ans += 1
finalans = min(finalans, ans)
print(finalans)
|
p02982 | s157454724 | Wrong Answer | n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n-1):
for j in range(i+1,n):
sub = 0
for k in range(d) :
sub += abs(x[i][k]-x[j][k])**2
sub = sub**0.5
print(sub)
if sub.is_integer() :
ans ... |
p03252 | s504860067 | Wrong Answer | import sys
from collections import defaultdict
s = list(map(str, input().rstrip()))
t = list(map(str, input().rstrip()))
d = defaultdict(str)
for x, y in zip(s, t):
if d[y] == "" or d[y] == x:
d[y] = x
else:
print("No")
sys.exit()
else:
print("Yes") |
p02989 | s016932597 | Wrong Answer | import bisect
n = int(input())
li = list(map(int,input().split()))
li.sort()
#print(li)
count = 0
for i in range(1, max(li)):
index = bisect.bisect_left(li, i)
#print(n,index,n//2)
if index == n//2:
#print(index)
count += 1
print(count) |
p02646 | s596082322 | Wrong Answer | import math
from sys import stdin,stdout
#% 998244353
from heapq import heapify,heappop,heappush
import collections
a,s1=list(map(int,stdin.readline().split()))
b,s2=list(map(int,stdin.readline().split()))
T = int(stdin.readline())
if a+s1*T>=b+s2*T:
print("YES")
else:
print("NO")
|
p03371 | s612298380 | Accepted | A, B, C, X, Y = map(int, input().split())
min_num = min(X, Y)
max_num = min(X, Y)
min_price = min(A + B, C * 2)
max_price = min(A + B, C * 2)
answer = min_num * min_price
# print(answer)
if X >= Y:
answer += (X - min_num) * min(A, C * 2)
else:
answer += (Y - min_num) * min(B, C * 2)
print(answer) |
p03067 | s898906270 | Accepted | a,b,c=map(int,input().split());print("NYoe s"[a<c<b or a>c>b::2]) |
p03644 | s681047827 | Wrong Answer | n=int(input())
king=int(0)
ans=int(0)
for i in range(1,n+1):
a=i
count=int(0)
while a:
if a%2==0:
a/=2
count+=1
else:
break
if king<count:
king=count
ans=i
print(ans) |
p03087 | s553382108 | Accepted | import sys
input=sys.stdin.readline
n,q=map(int,input().split())
s=input().rstrip()
lst=[0]
for i in range(1,n):
if s[i-1]=="A" and s[i]=="C":
lst.append(lst[i-1]+1)
else:
lst.append(lst[i-1])
for i in range(q):
l,r=map(int,input().split())
print(lst[r-1]-lst[l-1]) |
p02690 | s405726421 | Wrong Answer | x=int(input())
for a in range(100):
for b in range(-100,100):
if (a**5 - b**5) == x:
print(a,b)
exit() |
p02596 | s762308868 | Wrong Answer | K=int(input())
a=[0]*(K+1)
a[1]=7%K
for i in range(2,K+1):
a[i]=(a[i-1]*10+7)%K
if a[i]==0:
print(i)
exit()
print(-1)
|
p02835 | s093775615 | Accepted | a, b, c = map(int, input().split())
s = a+b+c
if (s>21):
print('bust')
else:
print('win') |
p02717 | s023025268 | Accepted | # -*- coding: utf-8 -*-
###
# main
if(__name__ == '__main__'):
# input
x, y, z = map(int, input().split(" "))
x, y = y, x
x, z = z, x
print(str(x)+" "+str(y)+" "+str(z))
# else:
# do nothing
|
p03416 | s793126415 | Accepted | A, B = map(int, input().split())
ans = 0
for i in range(A, B + 1):
if str(i) == str(i)[::-1]: ans += 1
print(ans) |
p02731 | s532777572 | Accepted | l = int(input())
print((l/3)*(l/3)*(l/3)) |
p02785 | s967822663 | Wrong Answer | N, K = list(map(int, input().split()))
enemy = sorted(list(map(int, input().split())), reverse=True)
if K > len(enemy):
print(0)
sum = 0
for x in enemy[K:]:
sum += x
print(sum) |
p02691 | s818779143 | Wrong Answer | n = int(input())
a = [0] + list(map(int,input().split()))
def binp(arr, val):
left,right = 0,len(arr)-1
while left <= right:
mid = (left+right)//2
if val==arr[mid]: return 1
elif val>=arr[mid]: left = mid+1
else: right = mid-1
return 0
ap = [a[i] + i for i in range(1,n+1)]
... |
p03545 | s210339332 | Accepted | def main():
from itertools import product, zip_longest
s = input()
for prod in product('+-', repeat=3):
formula = ''
for x, op in zip_longest(s, prod, fillvalue=''):
formula += x + op
if eval(formula) == 7:
print('{}=7'.format(formula))
return
... |
p03625 | s262445411 | Wrong Answer | import collections
n=int(input())
a=list(map(int,input().split()))
a=collections.Counter(a)
a=sorted(a.items(),reverse=True)
#print(a)
tm=0
for i in range(n):
if a[i][1]>=4:
print(a[i][0]*a[i][0])
exit()
elif a[i][1]>=2:
if tm==0:
tm=a[i][0]
else:
print... |
p02628 | s862132847 | Wrong Answer | def main():
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:3]))
if __name__=='__main__':
main()
|
p02754 | s222684425 | Accepted | Nf,Af,Bf = (input().split(' '))
N = int(Nf)
A = int(Af)
B = int(Bf)
a = N % (A + B)
b = N // (A + B)
if a < A + 1:
print(A*b+a)
else:
print(A*b+A) |
p02598 | s839830183 | Accepted | n,k = map(int, input().split())
l = list(map(int,input().split()))
ok = max(l)
ng = 0
def solver(x):
cnt = 0
for logs in l:
if logs % x == 0:
cnt += (logs // x) -1
else:
cnt += logs// x
if cnt <= k:
return True
else:
return False
while abs(ok-ng)... |
p03338 | s615730240 | Accepted | import collections
n = int(input())
s = input()
l1 = []
l2 = []
ans = 0
for i in range(1,n):
l1 = set(list(s[0:i:]))
l2 = set(list(s[i::]))
ans = max(ans,len(l1&l2))
# print(l1,l2,ans)
print(ans) |
p03163 | s495637459 | Accepted | import sys
import collections as cc
input = sys.stdin.readline
I=lambda:list(map(int,input().split()))
n,w=I()
val=[]
wt=[]
for i in range(n):
x,y=I()
wt.append(x)
val.append(y)
dp=[[0]*(w+1) for i in range(n+1)]
for i in range(1,n+1):
for j in range(1,w+1):
if wt[i-1]<=j:
dp[i][j]=max(val[i-1]+dp[i-1][j-wt[i-... |
p02994 | s847423761 | Wrong Answer | N,L = map(int,input().split())
count = L
taste = []
for i in range(N):
taste.append(count)
count += 1
if 0 in taste:
taste.remove(0)
elif N + L <= 0:
taste.pop(-1)
else:
taste.pop(0)
print(taste) |
p02572 | s569251695 | Wrong Answer | import numpy as np
MOD = 10 ** 9 + 7
n=int(input()) #3
alst=list(map(int,input().split())) #[1,2,3]
# 累積和を求める
# 例
# [1,2,3,4,5,6]の時、累積和は、
# [0,1,3,6,10,15,21]
s=np.cumsum(alst,dtype='float32')
sum=0
for i in range(len(alst)-1):
sum+=alst[i]*(s[len(s)-1]-s[i])
print(sum%MOD) |
p03835 | s555627446 | Wrong Answer | k, s = map(int, input().split())
l = set()
for i in range(k+1):
for j in range(k+1):
if i+j+k >= s:
l.add((i, j, s-k-j))
else:
continue
print(len(l)) |
p03773 | s382329896 | Wrong Answer | a,b=map(int,input().split())
if a+b > 24:
print('24-a-b')
else:
print('a+b') |
p02983 | s603867585 | Accepted | l, r = map(int, input().split())
ans_list = []
for i in range(l, min(l+2019, r)):
for j in range(i + 1, min(i + 2019, r + 1)):
ans = (i * j) % 2019
ans_list.append(ans)
if ans == 0:
break
print(min(ans_list)) |
p03434 | s611419958 | Wrong Answer | if __name__ == '__main__':
n = int(input())
k = [int(i) for i in input().split()]
a = 0
b = 0
k.sort(reverse=True)
print(k)
flag = True
for i in k:
if flag == True:
a+=i
flag=False
else:
b+=i
flag=True
print(a-b)
|
p02676 | s568474952 | Accepted | k = int(input())
s = input()
if len(s) <= k:
print(s)
else:
print(s[:k]+'...')
|
p03778 | s077234857 | Accepted | import sys
W,a,b = map(int,input().split())
if W < 0 or W > 100000:
sys.exit()
if a < 0 or a > 100000:
sys.exit()
if b < 0 or b > 100000:
sys.exit()
move = 0
if W + a < b:
move = b - (W + a)
if W + a > b and W + a < W + b:
move = 0
if a > b and a < W + b:
move = 0
if a > W + b and W + a > W + b... |
p02993 | s377836005 | Accepted | S = input()
for i in range(len(S)):
if i == len(S)-1:
print("Good")
break
elif S[i] != S[i+1]:
continue
else:
print("Bad")
break |
p02633 | s686717493 | Accepted | import sys
import math
X = int(sys.stdin.readline())
for i in range(1, 10**5):
if (X * i) % 360 == 0:
print(i)
break |
p03836 | s955672619 | Wrong Answer | sx,sy,tx,ty=map(int,input().split())
print('U'*(ty-sy),end='')
print('R'*(tx-sx),end='')
print('D'*(ty-sy),end='')
print('L'*(tx-sx),end='')
print('L',end='')
print('U'*(ty-sy+1),end='')
print('R'*(tx-sx+1),end='')
print('D'*(ty-sy+1),end='')
print('L'*(tx-sx+1),end='')
print('U')
|
p04020 | s049227995 | Accepted | n = int(input())
ans = 0
nex = 0
for i in range(n):
now = int(input())
if nex == 1 and now > 0:
now -= 1
nex = 0
ans += 1
elif nex == 1 and now == 0:
nex = 0
ans += now//2
if now % 2 == 1:
nex = 1
print(ans) |
p03150 | s357006079 | Accepted | S = list(input())
L = len(S)
key = list("keyence")
for i in range(0,8):
if S[0:i] == key[0:i] and S[L-7+i:] == key[i:]:
print("YES")
exit()
print("NO") |
p03799 | s087014824 | Accepted | N, M = map(int, input().split())
if 2*N >= M:
print(M//2)
else:
print((2*N+M)//4) |
p02727 | s658171641 | Accepted | import math
import sys
import collections
import bisect
readline = sys.stdin.readline
def main():
x, y, a, b, c = map(int, input().split())
print(sum(sorted((sorted(list(map(int, input().split())), reverse=True)[0:x] + sorted(list(map(int, input(
).split())), reverse=True)[0:y] + sorted(list(map(int, inpu... |
p02678 | s344937100 | Wrong Answer | from collections import deque
N,M = map(int,input().split())
l = [[] for _ in range(N+1)]
for _ in range(M):
a,b = map(int,input().split())
l[a].append(b)
l[b].append(a)
ans = 'No'
st = deque([1])
check = [0]*(N+1)
mark = [0]*(N+1)
while st:
s = st.popleft()
for t in l[s]:
mark[t] = s
check[t] = 1
... |
p02705 | s439379486 | Accepted | # print('input >>')
R = int(input())
# print('-----output-----')
print(R * 2 * 3.1415)
|
p03645 | s252712742 | Accepted | n,m=map(int,input().split())
sa=set()
sb=set()
for i in range(m):
a,b=map(int,input().split())
if a==1:
sb.add(b)
if b==n:
sa.add(a)
if sa&sb:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
|
p02777 | s439190172 | Accepted | S, T = input().split()
A, B = map(int, input().split())
print(*(A-1,B) if S==input() else (A,B-1)) |
p02621 | s008250744 | Accepted | a = int(input())
ans = a + a ** 2 + a ** 3
print(ans) |
p03243 | s668243070 | Accepted | N =int(input())
a=N//111
b=N%111
if b!=0:
x=111*(a+1)
else:
x=N
print(x) |
p03351 | s287654537 | Accepted | a,b,c,d = map(int, input().split())
if abs(a-c) <=d:
print("Yes")
elif (abs(a-b) <= d) & (abs(b-c) <= d):
print("Yes")
else:
print("No") |
p03359 | s343251515 | Accepted | a,b=map(int,input().split())
if a<=b:
print(a)
else:
print(a-1) |
p02576 | s421396766 | Accepted | n, x, t = map(int, input().split())
ans = ( (n-1)//x + 1)* t
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.