message stringlengths 2 39.6k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 450 109k | cluster float64 2 2 | __index_level_0__ int64 900 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n castles in the Lannister's Kingdom and some walls connect two castles, no two castles are connected by more than one wall, no wall connects a castle to itself.
Sir Jaime Lannister ... | instruction | 0 | 11,320 | 2 | 22,640 |
No | output | 1 | 11,320 | 2 | 22,641 |
Provide a correct Python 3 solution for this coding contest problem.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.
The same spell can be cast multiple times. There is no... | instruction | 0 | 13,124 | 2 | 26,248 |
"Correct Solution:
```
H, N, *AB = map(int, open(0).read().split())
dp = [0] * (H + max(AB[::2]))
for i in range(1, len(dp)):
dp[i] = min(dp[i - a] + b for a, b in zip(*[iter(AB)] * 2))
print(min(dp[H:]))
``` | output | 1 | 13,124 | 2 | 26,249 |
Provide a correct Python 3 solution for this coding contest problem.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.
The same spell can be cast multiple times. There is no... | instruction | 0 | 13,125 | 2 | 26,250 |
"Correct Solution:
```
H,N = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
maxA = max(a for a,b in AB)
dp = [0]*(H+maxA)
for i in range(1,H + maxA):
dp[i] = min(dp[i-a]+b for a,b in AB)
print(dp[H])
``` | output | 1 | 13,125 | 2 | 26,251 |
Provide a correct Python 3 solution for this coding contest problem.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.
The same spell can be cast multiple times. There is no... | instruction | 0 | 13,126 | 2 | 26,252 |
"Correct Solution:
```
h, n = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(n)]
dp = [1 << 31] * (h + 10**4)
dp[0] = 0
for i in range(h):
for a, b in AB:
dp[i + a] = min(dp[i + a], dp[i] + b)
print(min(dp[h:]))
``` | output | 1 | 13,126 | 2 | 26,253 |
Provide a correct Python 3 solution for this coding contest problem.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.
The same spell can be cast multiple times. There is no... | instruction | 0 | 13,127 | 2 | 26,254 |
"Correct Solution:
```
h,n=map(int,input().split())
dp=[10**10 for i in range(h+1)]
dp[0]=0
for i in range(n):
x,y=map(int,input().split())
for j in range(h+1):
nj=min(h,j+x)
dp[nj]=min(dp[nj],dp[j]+y)
print(dp[h])
``` | output | 1 | 13,127 | 2 | 26,255 |
Provide a correct Python 3 solution for this coding contest problem.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.
The same spell can be cast multiple times. There is no... | instruction | 0 | 13,128 | 2 | 26,256 |
"Correct Solution:
```
H,N = map(int,input().split())
MAXH = H+10000
DP = [float("inf")]*MAXH
DP[0] = 0
for i in range(N):
a,b = map(int,input().split())
for j in range(MAXH-a):
if j>H+a:break
DP[j+a] = min(DP[j+a],DP[j]+b)
print(min(DP[H:]))
``` | output | 1 | 13,128 | 2 | 26,257 |
Provide a correct Python 3 solution for this coding contest problem.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.
The same spell can be cast multiple times. There is no... | instruction | 0 | 13,129 | 2 | 26,258 |
"Correct Solution:
```
h,n = map(int, input().split())
magics = [tuple(map(int, input().split())) for _ in range(n)]
max_a = sorted(magics, key=lambda x: x[0], reverse=True)[0][0]
dp = [0]*(h+max_a)
for i in range(1, h+max_a):
dp[i] = min(dp[i-a]+b for a,b in magics)
print(min(dp[h:]))
``` | output | 1 | 13,129 | 2 | 26,259 |
Provide a correct Python 3 solution for this coding contest problem.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.
The same spell can be cast multiple times. There is no... | instruction | 0 | 13,130 | 2 | 26,260 |
"Correct Solution:
```
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
table = [float("inf")] * (h + 10000)
table[0] = 0
for a, b in ab:
for i in range(h):
table[i+a] = min(table[i+a], table[i] + b)
print(min(table[h:]))
``` | output | 1 | 13,130 | 2 | 26,261 |
Provide a correct Python 3 solution for this coding contest problem.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.
The same spell can be cast multiple times. There is no... | instruction | 0 | 13,131 | 2 | 26,262 |
"Correct Solution:
```
h, n = map(int, input().split())
magics = [list(map(int, input().split())) for _ in range(n)]
max_damage = max(a for a, b in magics)
dp = [0] * (h + max_damage)
for i in range(1, h + max_damage):
dp[i] = min(dp[i - a] + b for a, b in magics)
print(dp[h])
``` | output | 1 | 13,131 | 2 | 26,263 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.... | instruction | 0 | 13,132 | 2 | 26,264 |
Yes | output | 1 | 13,132 | 2 | 26,265 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.... | instruction | 0 | 13,133 | 2 | 26,266 |
Yes | output | 1 | 13,133 | 2 | 26,267 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.... | instruction | 0 | 13,134 | 2 | 26,268 |
Yes | output | 1 | 13,134 | 2 | 26,269 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.... | instruction | 0 | 13,135 | 2 | 26,270 |
Yes | output | 1 | 13,135 | 2 | 26,271 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.... | instruction | 0 | 13,136 | 2 | 26,272 |
No | output | 1 | 13,136 | 2 | 26,273 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.... | instruction | 0 | 13,137 | 2 | 26,274 |
No | output | 1 | 13,137 | 2 | 26,275 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.... | instruction | 0 | 13,138 | 2 | 26,276 |
No | output | 1 | 13,138 | 2 | 26,277 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ibis is fighting with a monster.
The health of the monster is H.
Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.... | instruction | 0 | 13,139 | 2 | 26,278 |
No | output | 1 | 13,139 | 2 | 26,279 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the swamp is very difficult, so people tramped exactly n - 1 paths. Each of these paths connec... | instruction | 0 | 13,615 | 2 | 27,230 |
Tags: dfs and similar, divide and conquer, dp, trees
Correct Solution:
```
from collections import defaultdict
import sys
input=sys.stdin.readline
class graph:
def __init__(self,n,mark):
self.d=defaultdict(list)
self.n=n
self.mark=mark
def add(self,s,d):
self.d[s].appen... | output | 1 | 13,615 | 2 | 27,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the swamp is very difficult, so people tramped exactly n - 1 paths. Each of these paths connec... | instruction | 0 | 13,616 | 2 | 27,232 |
Tags: dfs and similar, divide and conquer, dp, trees
Correct Solution:
```
import heapq
def dfs(graph, start):
n = len(graph)
dist = [-0 for i in range(n + 1)]
visited = [False for i in range(n + 1)]
visited[start] = True
stack = []
dist[start] = 0
heapq.heappush(stack, start)
while ... | output | 1 | 13,616 | 2 | 27,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of n locations connected by m two-way passages. The passages are designed in such a way that it should be possible to g... | instruction | 0 | 14,146 | 2 | 28,292 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
import sys
from array import array # noqa: F401
def readline(): return sys.stdin.buffer.readline().decode('utf-8')
def build_bridge_tree(v_count, edge_count, adj, edge_index):
from collections import deque
preorder = [0]
parent, order, low = [... | output | 1 | 14,146 | 2 | 28,293 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of n locations connected by m two-way passages. The passages are designed in such a way that it should be possible to g... | instruction | 0 | 14,147 | 2 | 28,294 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
import sys
from array import array # noqa: F401
def readline(): return sys.stdin.buffer.readline().decode('utf-8')
def build_bridge_tree(v_count, edge_count, adj, edge_index):
from collections import deque
preorder = [0]
parent, order, low = [... | output | 1 | 14,147 | 2 | 28,295 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of n locations connected by m two-way passages. The passages are designed in such a way that it should be possible to g... | instruction | 0 | 14,148 | 2 | 28,296 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
import sys
def get_input():
n, m = [int(x) for x in sys.stdin.readline().split(' ')]
graph = [[] for _ in range(n + 1)]
for _ in range(m):
u, v = [int(x) for x in sys.stdin.readline().split(' ')]
graph[u].append(v)
graph[v].... | output | 1 | 14,148 | 2 | 28,297 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of n locations connected by m two-way passages. The passages are designed in such a way that it should be possible to g... | instruction | 0 | 14,149 | 2 | 28,298 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
import sys
# sys.stind.readline lee datos el doble de
# rápido que la funcion por defecto input
input = sys.stdin.readline
def get_input():
n, m = [int(x) for x in input().split(' ')]
graph = [[] for _ in range(n + 1)]
for _ in range(m):
... | output | 1 | 14,149 | 2 | 28,299 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of n locations connected by m two-way passages. The passages are designe... | instruction | 0 | 14,150 | 2 | 28,300 |
No | output | 1 | 14,150 | 2 | 28,301 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of n locations connected by m two-way passages. The passages are designe... | instruction | 0 | 14,151 | 2 | 28,302 |
No | output | 1 | 14,151 | 2 | 28,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of n locations connected by m two-way passages. The passages are designe... | instruction | 0 | 14,152 | 2 | 28,304 |
No | output | 1 | 14,152 | 2 | 28,305 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of n locations connected by m two-way passages. The passages are designe... | instruction | 0 | 14,153 | 2 | 28,306 |
No | output | 1 | 14,153 | 2 | 28,307 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the modification of the problem used during the official round. Unfortunately, author's solution of the original problem appeared wrong, so the problem was changed specially for the archive.
Once upon a time in a far away kingdom li... | instruction | 0 | 14,756 | 2 | 29,512 |
Tags: implementation, probabilities, trees
Correct Solution:
```
from fractions import *
n,L=int(input()),0
while (n%2==0):n,L=n//2,L+1
if (n==1):print('%d/1'%L)
else:
s,t=1,1
for i in range(n):
t,s=t*2%n,s*2
if (t==1):
m=i+1
break
r,t,i,ans=s,s*n,L,0
while (r>1):... | output | 1 | 14,756 | 2 | 29,513 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the modification of the problem used during the official round. Unfortunately, author's solution of the original problem appeared wrong, so the problem was changed specially for the archive.
Once upon a time in a far away kingdom li... | instruction | 0 | 14,757 | 2 | 29,514 |
Tags: implementation, probabilities, trees
Correct Solution:
```
from math import gcd
def PRINT(a, b) :
print(str(int(a)) + "/" + str(int(b)))
def solve(n) :
pre = 0
while(n > 1 and (n % 2 == 0)) :
pre = pre + 1
n = n // 2
if(n == 1) :
... | output | 1 | 14,757 | 2 | 29,515 |
Provide a correct Python 3 solution for this coding contest problem.
problem
There are $ N $ islands numbered from $ 1 $ to $ N $.
Each island has $ N-1 $ bridges, allowing any $ 2 $ island to move to each other across several bridges.
Each bridge has durability, and the durability of the $ i $ th bridge given the in... | instruction | 0 | 15,029 | 2 | 30,058 |
"Correct Solution:
```
from operator import itemgetter
import sys
sys.setrecursionlimit(500000)
N, T, E, S = map(int, input().split())
G = [[] for _ in range(N+1)]
for _ in range(N-1):
a, b, w = map(int, input().split())
G[a].append((b, w))
G[b].append((a, w))
path = []
def pre_dfs(v, p):
if v == E:
... | output | 1 | 15,029 | 2 | 30,059 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of t... | instruction | 0 | 15,589 | 2 | 31,178 |
Tags: dp, math, probabilities
Correct Solution:
```
def main():
eps=10**-7
k,q=readIntArr()
# dp[nTurns][nDistinctOrbs]=probability
# dp[i][j]=dp[i-1][j]*j/k+dp[i-1][j-1]*(k-(j-1))/k
def rowFactory():
row=[0 for _ in range(k+1)]
return row
dp=[rowFactory... | output | 1 | 15,589 | 2 | 31,179 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of t... | instruction | 0 | 15,590 | 2 | 31,180 |
Tags: dp, math, probabilities
Correct Solution:
```
k, q = map(int, input().split())
t = [0] * (k + 1)
t[1] = 1
d = [0]
n = i = 1
while i < 1001:
if 2000 * t[k] > i - 1e-7:
d.append(n)
i += 1
else:
t = [0] + [(j * t[j] + (k - j + 1) * t[j - 1]) / k for j in range(1, k + 1)]
n += ... | output | 1 | 15,590 | 2 | 31,181 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of t... | instruction | 0 | 15,591 | 2 | 31,182 |
Tags: dp, math, probabilities
Correct Solution:
```
k, q = map(int, input().split())
t = [0] * (k + 1)
t[1] = 1
c = [0]
n = i = 1
while i < 1001:
if (2000 * t[k] > i - (10**-7)):
c.append(n)
i += 1
else:
t = [0] + [(j * t[j] + (k - j + 1) * t[j - 1]) / k for j in range(1, k + 1)]
... | output | 1 | 15,591 | 2 | 31,183 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of t... | instruction | 0 | 15,592 | 2 | 31,184 |
Tags: dp, math, probabilities
Correct Solution:
```
k, q = map(int, input().split())
dp = [[0.0 for i in range(k + 1)] for j in range(10000)]
dp[0][0] = 1.0
for i in range(1, 10000):
for j in range(1, k + 1):
dp[i][j] = dp[i - 1][j] * j / k + dp[i - 1][j - 1] * (k - j + 1) / k
for t in range(q):
p = int... | output | 1 | 15,592 | 2 | 31,185 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of t... | instruction | 0 | 15,593 | 2 | 31,186 |
Tags: dp, math, probabilities
Correct Solution:
```
K, Q = map( int, input().split() )
dp = [ [ 0.0 for i in range( K + 1 ) ] for j in range( 10000 ) ]
dp[ 0 ][ 0 ] = 1.0
for i in range( 1, 10000, 1 ):
for j in range( 1, K + 1, 1 ):
dp[ i ][ j ] = dp[ i - 1 ][ j ] * j / K + dp[ i - 1 ][ j - 1 ] * ( K - ( j - 1 )... | output | 1 | 15,593 | 2 | 31,187 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwo... | instruction | 0 | 15,594 | 2 | 31,188 |
No | output | 1 | 15,594 | 2 | 31,189 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwo... | instruction | 0 | 15,595 | 2 | 31,190 |
No | output | 1 | 15,595 | 2 | 31,191 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwo... | instruction | 0 | 15,596 | 2 | 31,192 |
No | output | 1 | 15,596 | 2 | 31,193 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwo... | instruction | 0 | 15,597 | 2 | 31,194 |
No | output | 1 | 15,597 | 2 | 31,195 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, starting one second af... | instruction | 0 | 16,162 | 2 | 32,324 |
Tags: greedy, math, ternary search
Correct Solution:
```
import sys
# sys.stdin = open('in.txt')
s = sys.stdin.read().split()
p = 0
def getSm(k, a, b, c, d):
return (k + 1) * a - (k * (k + 1) >> 1) * b * d
t = int(s[p])
p += 1
res = []
for _ in range(t):
a = int(s[p])
p += 1
b = int(s[p])
p ... | output | 1 | 16,162 | 2 | 32,325 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, starting one second af... | instruction | 0 | 16,163 | 2 | 32,326 |
Tags: greedy, math, ternary search
Correct Solution:
```
import sys,io,os;Z=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
o=[]
for _ in range(int(Z())):
a,b,c,d=map(int,Z().split())
if a>b*c:o+=[-1]
elif d>c:o+=[a]
else:v=a//(b*d);o+=[(v+1)*a-b*d*(v*(v+1))//2]
print('\n'.join(map(str,o)))
``` | output | 1 | 16,163 | 2 | 32,327 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, starting one second af... | instruction | 0 | 16,164 | 2 | 32,328 |
Tags: greedy, math, ternary search
Correct Solution:
```
import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
a,b,c,d = map(int,input().split())
if a-b*c>0:
print(-1)
else:
const = (-c-1)//d
k = (c)//d + 1
tmp1 = (k+1)*(a-b*c) - const*b*c - (d*b*const*... | output | 1 | 16,164 | 2 | 32,329 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, starting one second af... | instruction | 0 | 16,165 | 2 | 32,330 |
Tags: greedy, math, ternary search
Correct Solution:
```
from sys import stdin
t = int(input())
for i_t in range(t):
a, b, c, d = map(int, stdin.readline().split())
if b*c < a:
result = -1
else:
i_hit = (a + b*d - 1) // (b*d) - 1
i_hit = min(i_hit, (c-1) // d)
result = a * ... | output | 1 | 16,165 | 2 | 32,331 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, starting one second af... | instruction | 0 | 16,166 | 2 | 32,332 |
Tags: greedy, math, ternary search
Correct Solution:
```
import sys
input = sys.stdin.readline
for f in range(int(input())):
a,b,c,d=map(int,input().split())
if d>=c:
if a>b*c:
print(-1)
else:
print(a)
else:
if a>b*c:
print(-1)
else:
... | output | 1 | 16,166 | 2 | 32,333 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, starting one second af... | instruction | 0 | 16,167 | 2 | 32,334 |
Tags: greedy, math, ternary search
Correct Solution:
```
import sys
input = sys.stdin.readline
def solve_case():
a, b, c, d = [int(x) for x in input().split()]
if a > b * c:
print(-1)
else:
k = a // (b * d)
print(a * (k + 1) - k * (k + 1) // 2 * b * d)
def main():
for _ in rang... | output | 1 | 16,167 | 2 | 32,335 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, starting one second af... | instruction | 0 | 16,168 | 2 | 32,336 |
Tags: greedy, math, ternary search
Correct Solution:
```
import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def MI(): return map(int, sys.stdin.buffer.readline().split())
def LI(): return list(map(int, sys.stdin.buffer... | output | 1 | 16,168 | 2 | 32,337 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, starting one second af... | instruction | 0 | 16,169 | 2 | 32,338 |
Tags: greedy, math, ternary search
Correct Solution:
```
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
import sys
X=[]
t=int(input())
for tests in range(t):
a,b,c,d=map(int,input().split())
if a>b*c:
X.append(-1)
continue
left = 1
right= c//d+1
def... | output | 1 | 16,169 | 2 | 32,339 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second... | instruction | 0 | 16,170 | 2 | 32,340 |
Yes | output | 1 | 16,170 | 2 | 32,341 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second... | instruction | 0 | 16,171 | 2 | 32,342 |
Yes | output | 1 | 16,171 | 2 | 32,343 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second... | instruction | 0 | 16,172 | 2 | 32,344 |
Yes | output | 1 | 16,172 | 2 | 32,345 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.