input stringlengths 20 127k | target stringlengths 20 119k | problem_id stringlengths 6 6 |
|---|---|---|
def calc():
n, a, b = list(map(int, input().split()))
if a > b:
return 0
if n == 1 and a < b:
return 0
upper = a + b * (n - 1)
lower = b + a * (n - 1)
return upper - lower + 1
print((calc()))
| N, A, B = list(map(int, input().split()))
high = (N - 1) * B + A
low = (N - 1) * A + B
ans = high - low + 1
ans = max(0, ans)
print(ans)
| p03705 |
n, p = list(map(int, input().split()))
w, b = [], []
for _ in range(n):
ww, bb = list(map(int, input().split()))
w.append(ww)
b.append(bb)
s = []
for ww, bb in zip(w, b):
s.append((100 - p) * ww + p * bb)
s.sort(reverse=True)
score = -sum(b) * p
cnt = 0
while score < 0:
score += s... | n, p = list(map(int, input().split()))
e = [tuple(map(int, input().split())) for _ in range(n)]
# e = [(w,b), ...]
e2 = sorted(((100 - p) * w + p * b for w, b in e), reverse=True)
rest = p * sum(b for _, b in e)
cur = 0
while rest > 0 and cur < n:
rest -= e2[cur]
cur += 1
print(cur)
| p03509 |
import sys
sys.setrecursionlimit(10**7)
def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし
S = [0] + LS2()
n = len(S)
mod = 10**9+7
a,c,d = [0]*(n+1),[0]*(n+1),[0]*(n+1)
for i in range(1,n):
a[i] = a[i-1]
c[i] = c[i-1]
d[i] = d[i-1]
if S[i] == 'A':
a[i] += 1
elif... | import sys
def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし
S = [0] + LS2()
n = len(S)
mod = 10**9+7
a,c,d = [0]*n,[0]*n,[0]*n # a[i],c[i],d[i] = S1~SiにあるA,C,?の個数
for i in range(1,n):
a[i] = a[i-1]
c[i] = c[i-1]
d[i] = d[i-1]
if S[i] == 'A':
a[i] += 1
elif S[i]... | p03291 |
import sys
input = sys.stdin.readline
S = input().rstrip()
N = len(S)
mod = 10**9 + 7
cnt = 0
A = B = C = 0
for c in S:
if c == 'A':
A += 3**cnt
if c == 'B':
B += A
if c == 'C':
C += B
if c == '?':
C = C * 3 + B
B = B * 3 + A
A = A * 3 +... | import sys
input = sys.stdin.readline
S = input().rstrip()
N = len(S)
mod = 10**9 + 7
cnt = 0
A = B = C = 0
for c in S:
if c == 'A':
A += pow(3, cnt, mod)
if c == 'B':
B += A
if c == 'C':
C += B
if c == '?':
C = C * 3 + B
B = B * 3 + A
A... | p03291 |
import sys
input = sys.stdin.readline
S = input().strip()
mod = 10**9+7
a = 0
ab = 0
ans = 0
q = 1
for c in S:
if c == 'A':
a += q
elif c == 'B':
ab += a
elif c == 'C':
ans += ab
elif c == '?':
a, ab, ans, q = a*3+q, ab*3+a, ans*3+ab, q*3
print((ans % mod... | import sys
input = sys.stdin.readline
S = input().strip()
mod = 10**9+7
a = 0
ab = 0
ans = 0
q = 1
for c in S:
if c == 'A':
a += q
elif c == 'B':
ab += a
elif c == 'C':
ans += ab
elif c == '?':
a, ab, ans, q = a*3+q, ab*3+a, ans*3+ab, q*3
a %= mod
... | p03291 |
s=input()[-1::-1]
n=len(s)
dp=[[0,0,0,0] for i in range(n+1)]
dp[0][0]=1
for i in range(n):
for j in range(4):
dp[i+1][j]=dp[i][j]%1000000007
if s[i]=="?":
dp[i+1][0]+=2*dp[i][0]
for j in range(1,4):
dp[i+1][j]+=2*dp[i][j]+dp[i][j-1]
else:
index=" CBA"... | mod = 1000000007
s = input()[-1::-1] #入力のタイミングで文字列を反転してしまう
n = len(s)
dp = [[0]*4 for i in range(n+1)]
dp[0][0] = 1 #0文字から0文字選ぶ方法だけ1で初期化。他は0。
for i in range(n):
for j in range(4):
dp[i+1][j] = dp[i][j] % mod #とりあえず一つ前の値はコピー
if s[i] == "?":
dp[i+1][0] += (2*dp[i][0]) % mod #コピーしたものに2倍を足せ... | p03291 |
# coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# DP[0, 0], Aの数、ABの数、ABCの数
MOD = 10 ** 9 + 7
S = sr()
dp = [0, 0, 0]
total = 1
for s in S:
if s == 'A':
dp[0] += total
elif s == 'B':
dp[1] += ... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# DP[0, 0], Aの数、ABの数、ABCの数
MOD = 10 ** 9 + 7
S = sr()
dp = [0, 0, 0]
total = 1
for s in S:
if s == 'A':
dp[0] += total
elif s == 'B':
dp[1] += ... | p03291 |
S=input()
M=10**9+7
all=1
abc=0
ab=0
a=0
for x in S:
if x=="A":
a+=all
if x=="B":
ab+=a
if x=="C":
abc+=ab
if x=="?":
abc=abc*3+ab
ab=ab*3+a
a= a*3+all
all*=3
abc%=M
ab%=M
a%=M
print(abc%M)
| S=input()
M=10**9+7
all=1
abc=0
ab=0
a=0
for x in S:
if x=="A":
a+=all
if x=="B":
ab+=a
if x=="C":
abc+=ab
if x=="?":
abc=abc*3+ab
ab=ab*3+a
a= a*3+all
all*=3
abc%=M
ab%=M
a%=M
all%=M
print(abc%M)
| p03291 |
S=input()
N=len(S)
mod=10**9+7
num=[ [ 0 for i in range(4) ] for j in range(N) ] # i=0 A, i=1 B, i=2 C, i=3 ?
for i in range(N):
if i==0:
if S[i]=="A": num[i][0]=1
elif S[i]=="B": num[i][1]=1
elif S[i]=="C": num[i][2]=1
elif S[i]=="?": num[i][3]=1
else:
for j in range(4):
num[i][j]... | S=input()
N=len(S)
mod=10**9+7
num=[ [ 0 for i in range(4) ] for j in range(N) ] # i=0 A, i=1 B, i=2 C, i=3 ?
for i in range(N):
if i==0:
if S[i]=="A": num[i][0]=1
elif S[i]=="B": num[i][1]=1
elif S[i]=="C": num[i][2]=1
elif S[i]=="?": num[i][3]=1
else:
for j in range(4):
num[i][j]... | p03291 |
import sys
S=sys.stdin.readline()
mod=10**9+7
a=0
ab=0
ans=0
all=1
for x in S:
if x=="A":
a+=all
elif x=="B":
ab+=a
elif x=="C":
ans+=ab
elif x=="?":
ans = ans*3 + ab
ab = ab*3 + a
a = a*3 + all
all *= 3
ans%=mod
ab%=mod
a%=mod
all%mod
print(ans%mod)
| S=input()
M=10**9+7
all=1
abc=0
ab=0
a=0
for x in S:
if x=="A":
a+=all
if x=="B":
ab+=a
if x=="C":
abc+=ab
if x=="?":
abc=abc*3+ab
ab=ab*3+a
a= a*3+all
all*=3
abc%=M
ab%=M
a%=M
all%=M
print(abc%M) | p03291 |
from collections import defaultdict
import sys
S=sys.stdin.readline().strip()
l=len(S)
mod=10**9+7
dp=defaultdict(lambda: 0) #dp[ (i,j) ] i: nan-mojime, j=0:All mojiretsu pattern , 1:A, 2:AB, 3:ABC
dp[(0,0)]=1
n=1
for i, s in enumerate(S):
if s in "ABC":
dp[ (i+1,0) ]=n
elif s=="?":
n*=3
... | S=input()
l=len(S)
mod=10**9+7
all_strings=1
a=0
ab=0
abc=0
for i,s in enumerate(S):
if s =="A":
a+=all_strings
elif s=="B":
ab+=a
elif s=="C":
abc+=ab
elif s=="?":
abc*=3
abc+=ab
ab*=3
ab+=a
a*=3
a+=all_strings
if s == "?":
all_strings*=3
all_strings%=mod
a%=m... | p03291 |
# coding:utf-8
import sys
input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7
def inpl(): return list(map(int, input().split()))
S = input().rstrip()
dp = [[0] * 4 for _ in range(len(S) + 1)]
dp[0][0] = 1
for i in range(len(S)):
if S[i] == '?':
dp[i + 1][0] = (dp[i][0]... | # coding:utf-8
import sys
input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7
def inpl(): return list(map(int, input().split()))
S = input().rstrip()
na, a, ab, abc = 1, 0, 0, 0
for s in S:
if s == 'A':
a = (a + na) % MOD
if s == 'B':
ab = (ab + a) % MOD
... | p03291 |
#coding:utf-8
S=input()
all=1
a=ab=abc=0
for _ in range(len(S)):
i=_+1
c=S[_]
if c=="A":
a+=all
if c=="B":
ab+=a
if c=="C":
abc+=ab
if c=="?":
abc=abc*3+ab
ab=ab*3+a
a=a*3+all
all*=3
print((abc%((10**9)+7)))
... | #coding:utf-8
S=input()
all=1
a=ab=abc=0
MOD=(10**9)+7
for _ in range(len(S)):
i=_+1
c=S[_]
if c=="A":
a+=all
if c=="B":
ab+=a
if c=="C":
abc+=ab
if c=="?":
abc=abc*3+ab
ab=ab*3+a
a=a*3+all
all*=3
a%=MOD
ab%=MO... | p03291 |
import sys
readline = sys.stdin.readline
S = readline().rstrip()
DIV = 10 ** 9 + 7
dp = [[0] * 4 for i in range(len(S) + 1)]
# dp[i + 1][0] : i文字目まで見たとき、ABCの部分文字列がまだ始まっていない場合の数
# dp[i + 1][1] : i文字目まで見たとき、ABCのAまで一致した場合の数
# dp[i + 1][2] : i文字目まで見たとき、ABCのBまで一致した場合の数
# dp[i + 1][3] : i文字目まで見たとき、ABCのCまで一致した場合の数... | import sys
readline = sys.stdin.readline
S = readline().rstrip()
DIV = 10 ** 9 + 7
dp = [[0] * 4 for i in range(len(S) + 1)]
# dp[i + 1][0] : i文字目まで見たとき、ABCの部分文字列がまだ始まっていない場合の数
# dp[i + 1][1] : i文字目まで見たとき、ABCのAまで一致した場合の数
# dp[i + 1][2] : i文字目まで見たとき、ABCのBまで一致した場合の数
# dp[i + 1][3] : i文字目まで見たとき、ABCのCまで一致した場合の数... | p03291 |
from heapq import*
def m():
n=int(eval(input()))
A=[]
for _ in[0]*n:
e=list(map(int,input().split()))
A+=[list(zip(e[2::2],e[3::2]))]
d=[0]+[float("inf")]*n
H=[(0,0)]
while H:
u=heappop(H)[1]
for v,c in A[u]:
t=d[u]+c
if d[v]>t:
d[v]=t
heappush(H,(t,v))
print(('\n'.join(f'{i... | import sys
from heapq import*
def m():
n=int(eval(input()))
A=[]
for e in sys.stdin:
e=list(map(int,e.split()))
A+=[list(zip(e[2::2],e[3::2]))]
d=[0]+[float('inf')]*n
H=[(0,0)]
while H:
u=heappop(H)[1]
for v,c in A[u]:
t=d[u]+c
if d[v]>t:
d[v]=t
heappush(H,(t,v))
print(('\n... | p02243 |
import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop
INF = float("inf")
def MAIN():
n = int(eval(input()))
adj = [[]] * n
for _ in range(0, n):
U = list(map(int, readline().split()))
adj[U[0]] = list(zip(U[2::2], U[3::2]))
def dijkstra():
... | import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop
INF = float("inf")
def MAIN():
n = int(eval(input()))
adj = [[]] * n
for _ in range(0, n):
U = list(map(int, input().split()))
adj[U[0]] = list(zip(U[2::2], U[3::2]))
def dijkstra():
... | p02243 |
# -*- coding: utf-8 -*-
from heapq import heappop, heappush
N = int(eval(input()))
INF = float("inf")
adj = [[] for _ in range(N)]
for n in range(N):
inp = tuple(map(int, input().split()))
for i in range(inp[1]):
adj[n] = list(zip(inp[2::2], inp[3::2]))
def dijkstra(adj):
d = [INF ... | # -*- coding: utf-8 -*-
from heapq import heapify, heappop, heappush
N = int(eval(input()))
INF = float("inf")
d = [INF for n in range(N)]
d[0] = 0
adj = [[] for _ in range(N)]
searched = [False for _ in range(N)]
searched[0] = True
for n in range(N):
inp = tuple(map(int, input().split()))
a... | p02243 |
import heapq
INFTY = 100000000000000000000000000
heap = []
n = int(input())
graph = {}
for i in range(n):
entry = list(map(int, input().split(' ')))
u = entry[0]
k = entry[1]
graph[u] = {}
for j in range(k):
v = entry[2+j*2]
c = entry[2+j*2+1]
graph[u][v] = c
... | from heapq import heappush, heappop
def dijkstra(G, s):
n = len(G)
fixed = set()
d = {}
for i in range(n):
d[i] = 9999999999999999999999999999999999999
d[s] = 0
heap = [(0, s)]
while len(fixed) < n:
du, u = heappop(heap)
for v in G[u]:
if v i... | p02243 |
import sys
global nodes
nodes = {}
def shortest_path(GRAPH):
global nodes
p1 = 0
nodes[p1][1] = 0;
edge={}
total = 0
mini = 0
while True:
nodes[p1][0]=True
for p2 in range(len(nodes)):
if nodes[p2][0]==False and (p1, p2) in GRAPH:
... | import sys
global distance
def shortest_path(GRAPH):
global distance
nodes2=list(range(len(distance)))
p1 = 0
distance[p1] = 0;
while True:
nodes2.remove(p1)
for p2 in nodes2:
if p2 in GRAPH[p1]:
tmp = distance[p1] + GRAPH[p1][p2... | p02243 |
import sys
global distance
def shortest_path(GRAPH):
global distance
nodes2=list(range(len(distance)))
p1 = 0
distance[p1] = 0;
while True:
dp1 = distance[p1]
gp1 = GRAPH[p1]
nodes2.remove(p1)
for p2 in nodes2:
if p2 in gp1:
... | import sys
def shortest_path(GRAPH, distance):
nodes0 = list(range(len(distance)))
nodes1 = set()
p1 = 0
distance[p1] = 0
while True:
dp1 = distance[p1]
gp1 = GRAPH[p1]
status[p1]=2
for p2 in list(gp1.keys()):
tmp = gp1[p2] + dp1
... | p02243 |
import sys
def shortest_path(GRAPH, distance):
nodes0 = list(range(len(distance)))
nodes1 = set()
p1 = 0
distance[p1] = 0
while True:
dp1 = distance[p1]
gp1 = GRAPH[p1]
status[p1]=2
for p2 in list(gp1.keys()):
tmp = gp1[p2] + dp1
... | import sys
def shortest_path(GRAPH, distance):
nodes = set()
p1 = 0
distance[p1] = 0
while True:
dp1 = distance[p1]
gp1 = GRAPH[p1]
status[p1]=1
for p2 in list(gp1.keys()):
tmp = gp1[p2] + dp1
if status[p2]==0 and tmp < dis... | p02243 |
from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat
import math
import random
# sys.stdin = open('input')
def inp():
re = list(map(int, input().split()))
if len(re) == 1:
return re[0]
return re
def inst():
... | from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat
import math
import random
# sys.stdin = open('input')
def inp():
re = list(map(int, input().split()))
if len(re) == 1:
return re[0]
return re
def inst():
... | p02721 |
import sys
input = sys.stdin.readline
def inpl():
return list(map(int, input().split()))
def GetBase(t=0):
ret = []
last = -C * 2 - 1
for i, s in enumerate(S[t:]):
if s == 'x':
continue
elif last + C >= i + t:
continue
ret.append(i + ... | import sys
input = sys.stdin.readline
def inpl():
return list(map(int, input().split()))
def GetBase(t=0):
ret = []
last = -C * 2 - 1
for i, s in enumerate(S[t:]):
if s == 'x':
continue
elif last + C >= i + t:
continue
ret.append(i + ... | p02721 |
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()
N, K, C = nm()
S = ns()
assert len(S) == N
INF = 1 << 60
def solve():
l... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()
N, K, C = nm()
S = ns()
assert len(S) == N
INF = 1 << 60
def solve():
l... | p02721 |
N,K,C=map(int,input().split())
S=input()
i=0
d1=[-1]*N
for k in range(K):
try:
i+=S[i:].index('o')
except:
break
d1[i]=k
i+=C+1
i=0
d2=[-1]*N
for k in range(K-1,-1,-1):
try:
i+=S[N-1-i::-1].index('o')
except:
break
d2[N-1-i]=k
i+=C+1
pr... | N,K,C=map(int,input().split())
S=input()
i=0
d1=[-1]*N
for k in range(K):
while S[i]=='x' and i<N:
i+=1
if i==N:break
d1[i]=k
i+=C+1
i=0
d2=[-1]*N
for k in range(K-1,-1,-1):
while S[N-1-i]=='x' and i<N:
i+=1
if i==N:break
d2[N-1-i]=k
i+=C+1
print(*[i+1 f... | p02721 |
def main():
n, k, c = map(int, input().split())
s = input()
if c == 0:
if s.count('o') == k:
ret = [i for i, c in enumerate(s) if c == 'o']
else:
ret = []
else:
go = set()
back = set()
i = 0
while i < n:
... | def main():
N, K, C = map(int, input().split())
s = input()
L = [-1] * K
R = [-1] * K
i = 0
cur = 0
while i < N and cur < K:
if s[i] == 'o':
L[cur] = i
cur += 1
i += C + 1
else:
i += 1
i = N - 1
cur ... | p02721 |
def main():
from bisect import bisect_left, bisect_right
N, K, C = map(int, input().split())
s = input()
L = [0] * (N + 2)
R = [0] * (N + 2)
# 1-indexedで管理した
# 貪欲に端から配置した場合に達成可能な
# 累積配置数
need = [0] * N
i = 0
while i < N:
if s[i] == 'o':
... | def main():
N, K, C = map(int, input().split())
S = input()
L = [-1] * K # 0-ind
i = 0
cur = 0
while i < N:
if S[i] == 'o':
L[cur] = i
cur += 1
if cur == K: break
i += C
i += 1
R = [-1] * K # 0-ind
i ... | p02721 |
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 前からと後ろからでcandに入れて両方に入るところ
N, K, C = lr()
S = sr()
cand1 = set()
cand2 = set()
def F(S):
cand = set()
count = 0
cur = 0
while cur < len(S):
if S[cur] == 'o'... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 前からと後ろからでgreedyにcandに入れて両方の一致したところ
N, K, C = lr()
S = sr()
def choose(S):
cand = []
count = 0
cur = 0
while cur < len(S):
if S[cur] == 'o':
coun... | p02721 |
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 前からと後ろからでgreedyにcandに入れて両方の一致したところ
N, K, C = lr()
S = sr()
def choose(S):
cand = []
count = 0
cur = 0
while cur < len(S):
if S[cur] == 'o':
coun... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K, C = lr()
S = sr()
# 左からと右からでそれぞれ貪欲、重なったところが必須
left = []; right = []
def work(S):
ret = []
cur = 0
count = 0
while count < K:
if S[cur] ... | p02721 |
import sys
sys.setrecursionlimit(10 ** 6)
def dfs(n, rest):
global C, N
rst = 0
if maxR[n] > 0:
rst = maxR[n]
elif rest >= C and S[n] == 'o':
rst += 1
if n + (C + 1) < N:
rst += dfs(n + C + 1, C)
else:
if n + 1 < N:
rst += dfs(... | import sys
sys.setrecursionlimit(10 ** 6)
def dfs(n, rest):
global C, N
rst = 0
if maxR[n] > 0:
rst = maxR[n]
elif rest >= C and S[n] == 'o':
rst += 1
if n + (C + 1) < N:
rst += dfs(n + C + 1, C)
else:
if n + 1 < N:
rst += dfs(... | p02721 |
import sys
sys.setrecursionlimit(10 ** 6)
def dfs(n, rest):
global C, N
rst = 0
if maxR[n] > 0:
rst = maxR[n]
elif rest >= C and S[n] == 'o':
rst += 1
if n + (C + 1) < N:
rst += dfs(n + C + 1, C)
else:
if n + 1 < N:
rst += dfs(... | N, K, C = map(int, input().split())
S = input()
L = [0] * K
k = 0
i = 0
rest = C
while k < K:
if rest >= C and S[i] == 'o':
L[k] = i
k += 1
rest = 0
else:
rest += 1
i += 1
R = [0] * K
k = K
i = N - 1
rest = C
while k > 0:
if rest >= C and S[i] == 'o... | p02721 |
from bisect import bisect_left, bisect_right
n, k, c = map(int, input().split())
s = input()
work = [i for i, e in enumerate(s, 1) if e == "o"]
INF = 10 ** 9
work_l = []
prev = -INF
for e in work:
if e - prev > c:
work_l.append(e)
prev = e
work_r = []
prev = INF
for e in work[::... | n, k, c = map(int, input().split())
s = input()
INF = 10 ** 9
work = [i for i, e in enumerate(s, 1) if e == "o"]
l = [0] * (n + 1)
r = [0] * (n + 1)
prev = -INF
cnt = 0
for e in work:
if e - prev > c:
cnt += 1
l[cnt] = e
prev = e
prev = INF
cnt = 0
for e in work[::-1]:
... | p02721 |
import sys
readline = sys.stdin.readline
# もっとも早い日に貪欲に働いたパターン
# もっとも遅い日に貪欲に働いたパターン
# 上記でX回目の仕事が同じ日であればその日は必ず働く必要がある
N,K,C = list(map(int,readline().split()))
S = readline().rstrip()
fast = [0] * K
ind = 0
cnt = 0
while cnt < K: # K回働くまで
if S[ind] == "o":
fast[cnt] = ind
cnt += 1
ind +=... | import sys
readline = sys.stdin.readline
# もっとも早い日に貪欲に働いたパターン
# もっとも遅い日に貪欲に働いたパターン
# 上記でX回目の仕事が同じ日であればその日は必ず働く必要がある
N,K,C = list(map(int,readline().split()))
S = readline().rstrip()
fast = [0] * K
ind = 0
cnt = 0
while cnt < K: # K回働くまで
if S[ind] == "o":
fast[cnt] = ind
cnt += 1
ind +=... | p02721 |
n,a,b=list(map(int,input().split()))
print((min([a*n,b]))) | n,a,b=list(map(int,input().split()))
print((min(n*a,b))) | p02981 |
n,a ,b = list(map(int, input().split()))
s = a * n
print((min(s,b)))
| n,a,b = list(map(int, input().split()))
print((min(n*a, b))) | p02981 |
li=list(map(int,input().split()))
if li[0]*li[1]>li[2]:
print((li[2]))
else:
print((li[0]*li[1])) | n,a,b=list(map(int,input().split()))
if n*a>b:
print(b)
else:
print((n*a))
| p02981 |
N, A, B = list(map(int, input().split()))
x = N*A
y = B
li = [x,y]
print((min(li))) | N, A, B = list(map(int, input().split()))
li = [N*A,B]
print((min(li))) | p02981 |
N, A, B = list(map(int,input().split()))
if N * A <= B:
print((N * A))
else:
print(B) | N, A, B = list(map(int,input().split()))
C = N * A
if C < B:
print(C)
else:
print(B) | p02981 |
import sys, heapq, bisect, math, fractions
from collections import deque
N, A, B = list(map(int, input().split()))
print((min(A * N, B))) | N, A, B = list(map(int, input().split()))
print((min(A * N, B)))
| p02981 |
N,A,B=list(map(int,input().split()))
print((min(N*A,B))) | n,a,b=list(map(int,input().split()))
print((min(n*a,b))) | p02981 |
n,a,b = list(map(int,input().split()))
print((min(n*a,b))) | n,a,b = list(map(int,input().split()))
print((min(a*n,b))) | p02981 |
n,a,b=list(map(int,input().split()))
print((min(a*n,b))) | N,A,B = list(map(int,input().split()))
print((min(A*N,B))) | p02981 |
# 電車代とタクシー代で小さい方を選ぶ
# 電車が安い
n,a,b = list(map(int, input().split()))
if a * n <= b:
print((a * n))
# タクシーが安い
else:
print(b) | n,a,b = list(map(int, input().split()))
if a * n <= b:
print((a * n))
else:
print(b) | p02981 |
from time import sleep
n, a, b = list(map(int, input().split()))
sleep(3.0)
print((min(a * n, b))) | # coding: utf-8
# Your code here!
N,A,B = list(map(int,input().split()))
print((B if A*N > B else A*N)) | p02981 |
n,a,b = list(map(int,input().split()))
print((min(a*n,b))) | n,a,b = list(map(int,input().split()))
print((min(n*a,b))) | p02981 |
s = [int(i) for i in input().split()]
print(s[0]*s[1]) if (s[0]*s[1] < s[2]) else print(s[2])
| N, A, B = list(map(int, input().split()))
if N*A > B:
print(B)
else:
print((N*A)) | p02981 |
# -*- coding: utf-8 -*-
N,A,B = list(map(int,input().split()))
train = N*A
taxi = B
result = train - taxi
if result >= 0:
print(taxi)
else:
print(train)
| n,a,b=list(map(int,input().split()))
train=a*n
taxi=b
print((min(train,taxi))) | p02981 |
N, A, B = list(map(int, input().split()))
print((min(A * N, B))) | N, A, B = list(map(int, input().split()))
print((min(N * A, B))) | p02981 |
n,a,b = list(map(int, input().split()))
train = a*n
taxi = b
if train <= taxi:
print(train)
else:
print(taxi) | n,a,b = list(map(int, input().split()))
train = a*n
taxi = b
cost = min(train,taxi)
print(cost) | p02981 |
import sys
input = sys.stdin.readline
from operator import itemgetter
from collections import deque
class Unionfindtree:
def __init__(self, number):
self.par = [i for i in range(number)]
self.rank = [0] * (number)
def find(self, x): # 親を探す
if self.par[x] == x:
... | import sys
input = sys.stdin.readline
from operator import itemgetter
from collections import deque
class Unionfindtree:
def __init__(self, number):
self.par = [i for i in range(number)]
self.rank = [0] * (number)
def find(self, x): # 親を探す
if self.par[x] == x:
... | p03903 |
d, t, s = list(map(int, input().split()))
print(("Yes" if d / s <= t else "No"))
| d, t, s = list(map(int, input().split()))
print(("Yes" if t * s >= d else "No")) | p02570 |
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import Counter
def main():
d, t, s = list(map(int, input().split()))
dis = s * t
if d > dis:
print('No')
else:
print('Yes')
if __name__ == '__main__':
main() | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
d, t, s = list(map(int, input().split()))
if t * s >= d:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()
| p02570 |
import base64
import subprocess
exe_bin = "e??420s#R400000000000{}h%0RR91&<Owl00000KmY&$00000s2czP0000000000Kma%Z2>?I<9RM5v1^@s61ONa4KmY&$00000KmY&$00000KmY&$00000_yGU_00000_yGU_000002mk;8000000{{R31ONa4I066w00000I066w00000I066w000008~^|S000008~^|S000000RR91000000RR911poj5000000000000000000000000000000*bD#w00000*... | # This code is generated by [Atcoder_base64](https://github.com/kyomukyomupurin/AtCoder_base64)
import base64
import subprocess
import zlib
exe_bin = "c%02yeQaCR6~DIg;WUZkrY#MHt`<wT7M9nf`5>hWvy-@e0Vgeu%XfS0*iQ3S$L{Rsl2jUm1sGNdi^hcd2a}LMs7R9r6PpIoL`oP8X@7)?2__gTQ<)q#v>;Yiwl&_l@7?qK-t~I}A^zBv>~qiWo^$TK=YF4ePdKv2?... | p02570 |
DTS = [int(i) for i in input().split()]
D = DTS[0]
T = DTS[1]
S = DTS[2]
if D/T <= S:
print("Yes")
else:
print("No") | input_list = [int(num) for num in input().split()]
D = input_list[0]
T = input_list[1]
S = input_list[2]
if D/S <= T:
print("Yes")
else:
print("No") | p02570 |
def LI():return list(map(int,input().split()))
def II():return int(input())
def yes():return print("Yes")
def no():return print("No")
INF=float("inf")
from collections import deque, defaultdict, Counter
from heapq import heappop, heappush
from itertools import product, combinations
from functools import reduce,... | def LI():return list(map(int,input().split()))
def II():return int(input())
def yes():return print("Yes")
def no():return print("No")
#INF=float("inf")
#from collections import deque, defaultdict, Counter
#from heapq import heappop, heappush
#from itertools import product, combinations
#from functools import re... | p02570 |
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
in_n = lambda: int(readline())
in_nn = lambda: list(map(int, readline().split()))
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 =... | D, T, S = list(map(int, input().split()))
if T * S >= D:
print("Yes")
else:
print("No")
| p02570 |
D, T, S = list(map(int, input().split()))
distance = T * S
if D > distance:
print('No')
else:
print('Yes') | D, T, S = list(map(int, input().split()))
distance = T * S
if D <= distance:
print('Yes')
else:
print('No') | p02570 |
d, t, s = list(map(int, input().split()))
ans = d / s
if t >= ans:
print("Yes")
else:
print("No")
| D, T, S = list(map(int, input().split()))
if D/S <= T:
print("Yes")
else:
print("No") | p02570 |
d,t,s=list(map(int,input().split()))
print(('Yes' if d/s<=t else 'No'))
| d,t,s=list(map(int,input().split()))
print(('Yes' if s*t>=d else 'No'))
| p02570 |
D,T,S = list(map(int,input().split()))
if D/S <= T:
print("Yes")
else:
print("No") | D,T,S = list(map(float,input().split()))
if D/S <= T:
print("Yes")
else:
print("No") | p02570 |
d,t,s=list(map(int,input().split()))
p=d/s
if t>=p:
print('Yes')
else:
print('No') | from sys import stdin
def ip():
return stdin.readline().rstrip()
d,t,s=list(map(int,ip().split()))
if d<=t*s:
print('Yes')
else:
print('No') | p02570 |
x,y ,z= list(map(int,input().split()))
if(x<=y*z):
print('Yes')
else:
print('No') | x,y ,z= list(map(int,input().split()))
ans=x/z
if ans<=y:
print('Yes')
else:
print('No') | p02570 |
# -*- coding: utf-8 -*-
# 標準入力を取得
D, T, S = list(map(int, input().split()))
# 求解処理
ans = str()
if D <= S * T:
ans = "Yes"
else:
ans = "No"
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
D, T, S = list(map(int, input().split()))
return D, T, S
def main(D: int, T: int, S: int) -> None:
"""
メイン処理.
Args:\n
D (int): 待ち合わせ場所(1 <= D <= 10000)... | p02570 |
D,T,s=list(map(int,input().split()))
if s*T-D>=0:
print("Yes")
else:
print("No") | d,t,s=list(map(int,input().split()))
if d<=t*s:
print("Yes")
else:
print("No") | p02570 |
d,t,s = list(map(int, input().split()))
ans = d / s
if ans > t:
print("No")
else :
print("Yes") | d,t,s = list(map(int, input().split()))
dist = t * s
if dist >= d:
print("Yes")
else :
print("No") | p02570 |
# 入力
D, T, S = input().split()
# 以下に回答を記入
D = int(D)
T = int(T)
S = int(S)
if D - T * S <= 0:
print('Yes')
else:
print('No') | # 入力
D, T, S = input().split()
# 以下に回答を記入
D = int(D)
T = int(T)
S = int(S)
if T * S >= D:
print('Yes')
else:
print('No') | p02570 |
'''
Created on 2020/08/29
@author: harurun
'''
def main():
import sys
pin=sys.stdin.readline
pout=sys.stdout.write
perr=sys.stderr.write
D,T,S=list(map(int,pin().split()))
if S*T>=D:
print("Yes")
else:
print("No")
return
main() | a,b,c=list(map(int,input().split()))
if a<=b*c:print("Yes")
else:print("No")
#連続acしなきゃ……
| p02570 |
d, t, s = list(map(int, input().split()))
# s*t = d'
if s*t >= d: print('Yes')
else:print('No')
| d, t, s = list(map(int, input().split()))
print(('No' if s*t < d else 'Yes'))
| p02570 |
D,T,S = list(map(int,input().split()))
su = D / S
#print(su)
if su <= T:
print("Yes")
else:
print("No")
| #177A
D,T,S = list(map(int,input().split()))
if D / S <= T:
print("Yes")
else:
print("No")
| p02570 |
d, t, s = list(map(int, input().split()))
if t * s < d: print("No")
else:print("Yes") | d, t, s = list(map(int, input().split()))
print(("No" if t*s < d else"Yes")) | p02570 |
def resolve():
d, t, s = list(map(int, input().split()))
print(("Yes" if t * s >= d else "No"))
if __name__ == '__main__':
resolve()
| d,t,s=list(map(int, input().split()));print(("YNeos"[t*s<d::2])) | p02570 |
def resolve():
d, t, s = list(map(int, input().split()))
if t >= d/s:
print("Yes")
else:
print("No")
resolve() | d, t, s = list(map(int, input().split()))
if t < d/s:
print("No")
else:
print("Yes") | p02570 |
a,t,s=list(map(int,input().split()))
if a<=t*s:
print("Yes")
else:
print("No") | d, t, s = list(map(int, input().split()))
if d <= t * s:
print("Yes")
else:
print("No") | p02570 |
D,T,S=list(map(int,input().split()))
if T*S>=D:
print("Yes")
else:
print("No")
... | D,T,S=list(map(int,input().split()))
if S*T<D:
print("No")
else:
print("Yes")
... | p02570 |
d, t, s = list(map(int, input().split()))
if t-d/s >= 0:
print("Yes")
else:
print("No") | d,t,s = list(map(int, input().split()))
if s*t >= d:
print("Yes")
else:
print("No") | p02570 |
D, T, S = list(map(int, input().split()))
if D / S <= T:
print("Yes")
else:
print("No")
| D, T, S = list(map(int, input().split()))
if D <= T * S:
print("Yes")
else:
print("No")
| p02570 |
d, t, s = list(map(int, input().split()))
print(('Yes' if d <= t*s else 'No')) | d, t, s = list(map(int, input().split()))
print(('No' if d > t*s else 'Yes')) | p02570 |
def main():
D, T, S = list(map(int, input().split()))
if S * T >= D:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main() | d, t, s = list(map(int, input().split()))
if (t * s >= d):
print("Yes")
else:
print("No") | p02570 |
d, t, s = list(map(int, input().split()))
if (t * s >= d):
print("Yes")
else:
print("No") | D, T, S = list(map(int, input().split()))
if (T * S >= D):
print("Yes")
else:
print("No") | p02570 |
N,A,B=list(map(int,input().split()))
P=[int(i) for i in input().split()]
dp=[[10**19]*(N+1) for i in range(N+1)]
dp[0][0]=0
for i in range(1,N+1):
for j in range(N+1):
#if dp[i-1][j]==10**19:
#continue
if j < P[i-1]:
dp[i][P[i-1]]=min(dp[i][P[i-1]],dp[i-1][j])
... | N,A,B=list(map(int,input().split()))
P=[int(i) for i in input().split()]
dp=[10**19]*(N+1)
dp[0]=0
for i in range(1,N+1):
ndp=[10**19]*(N+1)
for j in range(N+1):
if j < P[i-1]:
ndp[P[i-1]]=min(ndp[P[i-1]],dp[j])
ndp[j]=min(ndp[j],dp[j]+A)
else:
ndp[... | p03092 |
N,A,B=list(map(int,input().split()))
P=[int(i) for i in input().split()]
dp=[10**19]*(N+1)
dp[0]=0
for i in range(1,N+1):
ndp=[10**19]*(N+1)
for j in range(N+1):
if j < P[i-1]:
ndp[P[i-1]]=min(ndp[P[i-1]],dp[j])
ndp[j]=min(ndp[j],dp[j]+A)
else:
ndp[... | N,A,B=list(map(int,input().split()))
P=[int(i) for i in input().split()]
s=1e19
d=[s]*(N+1)
d[0]=0
for i in range(N):
e=[s]*(N+1)
for j in range(N+1):
if j < P[i]:
e[P[i]]=min(e[P[i]],d[j])
e[j]=min(e[j],d[j]+A)
else:
e[j]=min(e[j],d[j]+B)
d=e... | p03092 |
from collections import deque
class Dinic:
def __init__(self, n):
self.n = n
self.links = [[] for _ in range(n)]
self.depth = None
self.progress = None
def add_link(self, _from, to, cap):
self.links[_from].append([cap, to, len(self.links[to])])
self... | from collections import defaultdict
from operator import itemgetter
n, a, b = list(map(int, input().split()))
ppp = list(map(int, input().split()))
qqq = list(map(itemgetter(0), sorted(enumerate(ppp, start=1), key=itemgetter(1))))
dp = {0: 0}
for i in qqq:
ndp = defaultdict(lambda: 10 ** 18)
for j, ... | p03092 |
def main():
from functools import lru_cache
from bisect import bisect,insort
import sys
sys.setrecursionlimit(10**9)
@lru_cache(None)
def solve(p):
if len(p)<2:
return 0
n=len(p)
j=i[n]
x=sorted(p[:j])
z={}
for k in range(j... | def main():
from functools import lru_cache
from bisect import bisect,insort
import sys
sys.setrecursionlimit(10**9)
@lru_cache(None)
def solve(n,m):
l=r=N=M=0
for j,v in enumerate(i[1:n],1):
if v<m:
if v<i[n]:
l+=1
... | p03092 |
n, a, b = list(map(int, input().split()))
dp = [2 ** 60] * (n + 1)
dp[0] = 0
p = list(map(int, input().split()))
for i in range(n):
dp[i + 1] = dp[0]
dp[0] += a
for j in range(i):
if p[j] < p[i]:
dp[i + 1] = min(dp[i + 1], dp[j + 1])
dp[j + 1] += a
else:
... | n, a, b = list(map(int, input().split()))
dp = [0] + [2 ** 60] * n
p = list(map(int, input().split()))
for i in range(n):
dp[i + 1] = dp[0]
dp[0] += a
for j in range(i):
if p[j] < p[i]: dp[i + 1] = min(dp[i + 1], dp[j + 1])
dp[j + 1] += [b, a][p[j] < p[i]]
print((min(dp))) | p03092 |
def main():
import sys
input = sys.stdin.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
... | def main():
import sys
input = sys.stdin.readline
N, R, L = list(map(int, input().split()))
P = list(map(int, input().split()))
val2idx = [0] * (N+1)
for i, p in enumerate(P):
val2idx[p] = i + 1
bigger = [[0] * (N+1) for _ in range(N+1)]
for p in range(1, N+1):
... | p03092 |
from sys import stdin
def main():
n,m = list(map(int,stdin.readline().split()))
if(n==m):
print("Yes")
else:
print("No")
main()
| n, m = list(map(int, input().split()))
if m == n:
print("Yes")
else: print("No") | p02789 |
x,y=input().split()
x=int(x)
y=int(y)
if x==y:
print("Yes")
else:
print("No")
| n, m = list(map(int, input().split()))
if (n == m):
print("Yes")
else:
print("No") | p02789 |
n, m = list(map(int, input().split()))
if(n == m):
print('Yes')
else:
print('No') | n, m = list(map(int, input().split()))
if(m == n):
print('Yes')
else:
print('No') | p02789 |
N, M = list(map(int, input().split()))
if N==M:
print('Yes')
else:
print('No') | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, M = mapint()
if N==M:
print('Yes')
else:
print('No') | p02789 |
n,m=list(map(int,input().split()))
if n==m:
print("Yes")
else:
print("No") | print(("Yes" if eval(input().replace(" ","==")) else "No")) | p02789 |
n,m = list(map(int,input().split()))
if n == m:
print('Yes')
else:
print('No')
| n,m = list(map(int,input().split()))
print(('Yes' if n == m else 'No'))
| p02789 |
N, M = list(map(int, input().split()))
if N == M:
print("Yes")
else:
print("No") | M, N = list(map(int, input().split()))
print(("Yes" if M == N else "No")) | p02789 |
n,m=list(map(int,input().split()))
print(("Yes"if m==n else "No")) | a,b=list(map(int,input().split()))
print(("Yes" if a==b else "No")) | p02789 |
def main():
from sys import stdin, setrecursionlimit
#setrecursionlimit(10**9)
#n = int(stdin.readline()[:-1])
#r = stdin.readline()[:-1]
#n = int(stdin.readline()[:-1])
#r = [stdin.readline() for i in range(n)]
#t = [int(stdin.readline()) for i in range(n)]
#a = list(map(i... | def main():
from sys import stdin, setrecursionlimit
#setrecursionlimit(10**9)
#n = int(stdin.readline()[:-1])
r = stdin.readline()[:-1]
#r = [stdin.readline() for i in range(n)]
#t = [int(stdin.readline()) for i in range(n)]
#n = int(r)
#a = r.split()
#a,b,c = r.split()
... | p02789 |
N,M=list(map(int,input().split()))
if N==M:
print('Yes')
else:
print('No') | n,m=list(map(int,input().split()))
if n==m:
print('Yes')
else:
print('No') | p02789 |
n,m=list(map(int,input().split()));print(("YNeos"[n>m::2])) | n,m=input().split();print(("YNeos"[n!=m::2])) | p02789 |
a,b = input().split()
if a == b:
print('Yes')
else:
print('No')
| a,b = input().split()
if b == a:
print('Yes')
else:
print('No')
| p02789 |
N,M=input().split()
print(("Yes" if N==M else "No")) | NM=input().split()
print(("Yes" if len(set(NM))==1 else "No")) | p02789 |
A,B=list(map(int,input().split()))
if A==B:
print("Yes")
else:
print("No") | N,M=list(map(int,input().split()))
if N==M:
print("Yes")
else:
print("No") | p02789 |
n, m = list(map(int, input().split()))
if n == m:
print("Yes")
else:
print("No") | n, m = list(map(int, input().split()))
print((['No', 'Yes'][n == m])) | p02789 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.