user_prompt stringlengths 505 5.78k | cot stringlengths 2.37k 94.9k | code stringlengths 66 4.97k | solutions listlengths 0 1.24k | test_cases dict | difficulty stringclasses 6
values | source stringclasses 1
value |
|---|---|---|---|---|---|---|
Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition."Balloons should be captured efficiently", the game designer says. He is designing an oldfashioned game with two dimensional graphics. In th... |
Okay, let's tackle this problem. Hmm, the problem statement is a bit complex, but let's break it down step by step.
So, the main idea is that there's a vehicle that needs to capture balloons as they fall. Each balloon has a position and a time when it lands. The vehicle starts at the house (position 0) and must be ... |
import sys
def main():
for line in sys.stdin:
n = int(line.strip())
if n == 0:
break
balloons = []
for _ in range(n):
p, t = map(int, sys.stdin.readline().split())
balloons.append((p, t))
if balloons[0][0] > balloons[0][1]:
... | [
"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\nsys.setrecursionlimit(10 ** 7)\ninf = 10 ** 20\neps = 1.0 / 10 ** 10\nmod = 10 ** 9 + 7\ndd = [(0, -1), (1, 0), (0, 1), (-1, 0)]\nddn = [(0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, -1), (-1, 0),... | {
"inputs": [
"2\n10 100\n100 270\n2\n10 100\n100 280\n3\n100 150\n10 360\n40 450\n3\n100 150\n9 360\n40 440\n2\n100 10\n50 200\n2\n100 100\n50 110\n1\n15 10\n4\n1 10\n2 20\n3 100\n90 200\n0",
"2\n10 100\n100 270\n2\n10 100\n110 280\n3\n100 150\n10 360\n40 450\n3\n100 150\n9 360\n40 440\n2\n100 10\n50 200\n2\... | UNKNOWN_DIFFICULTY | taco |
Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition."What are your shoe sizes?"
Suddenly, the doctor asked me when I met him for the first time.
"It's 23.5"
"Oh, that's a really nice number.... |
Okay, I need to solve this programming problem. Let's read the problem statement carefully.
So, the task is to convert a given real number to its binary representation. But there are some constraints. The integer part of the binary should be no more than 8 digits, and the decimal part no more than 4 digits. If it do... |
import sys
def split_number(s):
if '.' in s:
integer_part, fractional_part = s.split('.', 1)
if not fractional_part:
fractional_part = '0'
else:
integer_part = s
fractional_part = '0'
return integer_part, fractional_part
def convert_to_binary(integer_part_str, ... | [
"def ans(N):\n\tn = int(N)\n\td = N - n\n\tans_l = bin(n)[2:]\n\tans_r = ''\n\tfor _ in range(4):\n\t\tans_r += str(int(d * 2))\n\t\td = d * 2 - int(d * 2)\n\tif n >= 256 or d != 0:\n\t\treturn 'NA'\n\telse:\n\t\treturn '0' * (8 - len(ans_l)) + ans_l + '.' + ans_r\nwhile True:\n\tINP = float(input())\n\tif INP < 0:... | {
"inputs": [
"23.72975180461117\n158.1\n-1.0",
"23.5\n158.1\n-0.5246083014985048",
"23.72975180461117\n158.1\n-0.5449258499657357",
"24.206542817215936\n158.1\n-1.0",
"24.615346202775605\n158.1\n-1.0",
"23.72975180461117\n158.6852941341954\n-0.5449258499657357",
"25.190547978615548\n158.1... | UNKNOWN_DIFFICULTY | taco |
"Generate an executable Python function generated from the given prompt. The function should take st(...TRUNCATED) | "\n\nOkay, I need to solve this programming problem. Let's read the problem statement carefully.\n\n(...TRUNCATED) | "\nimport sys\n\ndef main():\n t = int(sys.stdin.readline())\n for _ in range(t):\n n, (...TRUNCATED) | ["for _ in range(int(input())):\n\t(n, m) = input().split()\n\tn = int(n)\n\tm = int(m)\n\tl = [int((...TRUNCATED) | {"inputs":["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4\n","27\n1 1\n0\n1 2\n0\n1 5\n0\n1 10\n0\n1 50\n0\n1 100\n(...TRUNCATED) | EASY | taco |
"Generate an executable Python function generated from the given prompt. The function should take st(...TRUNCATED) | "\n\nOkay, I need to solve this problem where I have to determine if a constructed string S is well-(...TRUNCATED) | "\ndef check_balanced():\n import sys\n input = sys.stdin.read().split()\n idx = 0\n n =(...TRUNCATED) | ["n = int(input())\ns = 0\nf = 0\nfor i in range(n):\n\t(p, x) = input().split()\n\tx = int(x)\n\tif(...TRUNCATED) | {"inputs":["2\n) 1\n' 1","3\n( 5\n* 4\n) 1","5\n( 2\n) 2\n( 3\n) 1\n) 4","2\n) 1\n' 2","3\n( 5\n* 4\(...TRUNCATED) | UNKNOWN_DIFFICULTY | taco |
"Generate an executable Python function generated from the given prompt. The function should take st(...TRUNCATED) | "\n\nOkay, let's see. I need to find the GCD of A^N + B^N and the absolute difference of A and B. Si(...TRUNCATED) | "\nimport math\n\nMOD = 10**9 + 7\n\ndef main():\n import sys\n input = sys.stdin.read().split(...TRUNCATED) | ["import math\n\ndef power(a, n, mod):\n\tres = 1\n\twhile n > 0:\n\t\tif n & 1 == 1:\n\t\t\tres = r(...TRUNCATED) | {
"inputs": [
"2\n10 1 1\n9 1 5"
],
"outputs": [
"1\n2"
]
} | MEDIUM_HARD | taco |
"Generate an executable Python function generated from the given prompt. The function should take st(...TRUNCATED) | "\n\nOkay, let's try to understand this problem. So, Professor GukiZ gave out candies to N students.(...TRUNCATED) | "\ndef compute_sum_first_available(p, a, x, s):\n # Collect elements in p that are within the int(...TRUNCATED) | ["for _ in range(int(input())):\n\t(n, k, x) = map(int, input().split())\n\tcandies = sorted(map(int(...TRUNCATED) | {
"inputs": [
"2\n4 3 4 \n2 1 5\n2 2 9\n3 6"
],
"outputs": [
"12\n9"
]
} | HARD | taco |
"Generate an executable Python function generated from the given prompt. The function should take st(...TRUNCATED) | "\n\nOkay, let's see. I need to write a Python function that reads input, processes it, and prints t(...TRUNCATED) | "\ndef main():\n import sys\n n = int(sys.stdin.readline())\n for _ in range(n):\n t(...TRUNCATED) | ["for _ in range(int(input())):\n\t(x1, y1, x2, y2) = map(int, input().split())\n\tav1 = (x1 + y1) /(...TRUNCATED) | {
"inputs": [],
"outputs": []
} | UNKNOWN_DIFFICULTY | taco |
"Generate an executable Python function generated from the given prompt. The function should take st(...TRUNCATED) | "\n\nOkay, so I need to solve this problem where I have to manage a bunch of sets and answer queries(...TRUNCATED) | "\nimport sys\n\ndef main():\n data = sys.stdin.read().split()\n ptr = 0\n N = int(data[ptr(...TRUNCATED) | [] | {"inputs":["10 4\n? 1 3\n= 1 8\n= 3 8\n? 1 3\n","4 5\n? 0 0\n= 0 1\n= 1 2\n= 0 2\n? 0 3\n"],"outputs(...TRUNCATED) | HARD | taco |
"Generate an executable Python function generated from the given prompt. The function should take st(...TRUNCATED) | "\n\nOkay, let's see. I need to find the starting index of the juice shop such that the man can comp(...TRUNCATED) | "\ndef find_starting_point():\n import sys\n input = sys.stdin.read().split()\n n = int(inp(...TRUNCATED) | ["import re, sys\n\ndef isCirlePossible(juices, distances):\n\tif juices == [] or distances == []:\n(...TRUNCATED) | {
"inputs": [],
"outputs": []
} | UNKNOWN_DIFFICULTY | taco |
"Generate an executable Python function generated from the given prompt. The function should take st(...TRUNCATED) | "\n\nOkay, let's try to tackle this problem. So the problem is a bit complex, but let's break it dow(...TRUNCATED) | "\nMOD = 10**9 + 7\n\ndef main():\n import sys\n input = sys.stdin.read().split()\n idx = 0(...TRUNCATED) | ["from collections import defaultdict, deque\nfrom heapq import heappush, heappop\nimport sys\nimpor(...TRUNCATED) | {"inputs":["2 3\n1 1\n1 1\n","1 2\n1\n3\n","2 3\n1 1\n2 2\n","4 8\n3 1 4 1\n3 1 4 1\n","3 100\n7 6 5(...TRUNCATED) | HARD | taco |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2