Dataset Viewer
Auto-converted to Parquet Duplicate
data_source
stringclasses
4 values
prompt
listlengths
2
2
response
stringlengths
26
3.7k
messages
listlengths
3
3
ability
stringclasses
1 value
reward_model
dict
extra_info
dict
taco
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nProblem\n\nGiven a natural number N less than or equal to...
```python import math def count_divisors(n): """Return the number of divisors of n.""" divisors_count = 0 for i in range(1, int(math.sqrt(n)) + 1): if n % i == 0: divisors_count += 2 # i and n/i are divisors if i == n // i: # Correct the count for a perfect square ...
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nProblem\n\nGiven a natural number N less than or equal to...
code
{ "ground_truth": "{\"inputs\": [\"5\", \"4\", \"6\", \"11\", \"8\", \"7\", \"10\", \"9\", \"12\", \"001\", \"010\", \"011\", \"4\", \"6\", \"9\", \"8\", \"10\", \"5\", \"7\", \"11\", \"12\", \"001\", \"010\", \"011\", \"1\", \"3\", \"2\"], \"outputs\": [\"16\\n\", \"6\\n\", \"12\\n\", \"1024\\n\", \"24\\n\", \"64\\n...
{ "current_response_index": 0, "index": 0, "num_history": 1, "raw_program": "def smallest_number_with_divisors(N):\n from sympy import primerange\n \n # Generate prime numbers up to a reasonable limit\n primes = list(primerange(1, 20))\n \n def divisors_from_factors(factors):\n number =...
taco
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nGarry is looking at the sky. Such a beautiful day! He not...
```python from collections import defaultdict import sys from typing import List, Tuple def convex_hull(points: List[Tuple[int, int]]) -> List[Tuple[int, int]]: """ Computes the convex hull of a set of points using the Graham scan algorithm. """ def cross(o: Tuple[int, int], a: Tuple[int, int], b: Tupl...
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nGarry is looking at the sky. Such a beautiful day! He not...
code
{ "ground_truth": "{\"inputs\": [\"1\\n10000 0 10000 10000 0 10000\\n3\\n10000 0 10000 10000 5000 5000\\n5000 5000 10000 10000 0 10000\\n0 0 0 1000 1000 0\\n\", \"2\\n9996 0 9997 0 0 1\\n9999 0 10000 0 0 1\\n2\\n9997 0 9998 0 0 1\\n9998 0 9999 0 0 1\\n\", \"1\\n2 0 2 4 4 2\\n2\\n2 0 2 2 4 2\\n2 2 4 2 2 4\\n\"], \"out...
{ "current_response_index": 1, "index": 0, "num_history": 3, "raw_program": "from itertools import combinations\n\ndef canonical_form(triangles):\n # Flatten the list of triangles into a list of points\n points = set()\n for triangle in triangles:\n points.update([(triangle[i], triangle[i+1]) fo...
taco
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nExample\n\nInput\n\n4 5 3\n-10 -10\n10 -10\n10 10\n-10 10...
```python def is_point_in_polygon(px, py, polygon): n = len(polygon) inside = False p1x, p1y = polygon[0] for i in range(n + 1): p2x, p2y = polygon[i % n] if py > min(p1y, p2y): if py <= max(p1y, p2y): if px <= max(p1x, p2x): if p1y != p2y:...
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nExample\n\nInput\n\n4 5 3\n-10 -10\n10 -10\n10 10\n-10 10...
code
{ "ground_truth": "{\"inputs\": [\"4 5 3\\n-10 -10\\n10 -10\\n10 10\\n-10 10\\n1 2\\n1 3\\n1 4\\n2 3\\n3 4\\n-20 0\\n1 0\\n20 0\"], \"outputs\": [\"No\\nYes\\nNo\"]}", "style": "rule" }
{ "current_response_index": 6, "index": 0, "num_history": 1, "raw_program": "def point_in_polygon(x, y, vertices):\n n = len(vertices)\n inside = False\n p1x, p1y = vertices[0]\n for i in range(1, n + 1):\n p2x, p2y = vertices[i % n]\n if y > min(p1y, p2y):\n if y <= max(p1y...
codecontests
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nFour players participate in the playoff tournament. The t...
```python def is_fair_tournament(test_cases): results = [] for skills in test_cases: # Sort the skills to easily identify the top two players sorted_skills = sorted(skills) highest = sorted_skills[-1] second_highest = sorted_skills[-2] # Determine the winners of ...
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nFour players participate in the playoff tournament. The t...
code
{ "ground_truth": "{\"inputs\": [\"4\\n3 7 9 5\\n4 5 6 9\\n5 3 8 1\\n6 5 3 2\\n\", \"1\\n8 6 2 7\\n\", \"1\\n8 6 0 7\\n\", \"4\\n3 7 9 5\\n4 5 6 9\\n5 3 8 1\\n2 5 3 2\\n\", \"1\\n2 4 -1 1\\n\", \"4\\n3 7 9 6\\n4 5 6 9\\n5 3 8 1\\n6 5 3 2\\n\", \"4\\n3 7 9 5\\n4 5 6 1\\n5 3 8 1\\n2 5 3 2\\n\", \"4\\n3 7 9 6\\n4 5 10 9...
{ "current_response_index": 7, "index": 0, "num_history": 3, "raw_program": "def is_fair_tournament(t, skill_sets):\n def tournament_is_fair(s1, s2, s3, s4):\n # Sort the skills to easily find the top two players\n players = sorted([s1, s2, s3, s4], reverse=True)\n top_two = players[:2]\...
taco
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nTo destroy humanity, The Monster Association sent $n$ mon...
```python def can_kill_monsters(n, k, h, p): # Pair each monster's health and power, then sort by health monsters = sorted(zip(h, p)) while monsters: # Reduce health by current attack damage monsters = [(health - k, power) for health, power in monsters if health - k > 0] ...
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nTo destroy humanity, The Monster Association sent $n$ mon...
code
{ "ground_truth": "{\"inputs\": [\"3\\n6 7\\n18 5 13 9 10 1\\n2 7 2 1 2 6\\n3 4\\n5 5 5\\n4 4 4\\n3 2\\n2 1 3\\n1 1 1\\n\", \"1\\n2 1\\n1000000000 1\\n1 1000000000\\n\"], \"outputs\": [\"YES\\nNO\\nYES\\n\", \"NO\\n\"]}", "style": "rule" }
{ "current_response_index": 1, "index": 0, "num_history": 1, "raw_program": "def can_kill_all_monsters(t, test_cases):\n results = []\n for n, k, h, p in test_cases:\n alive_monsters = [(h_i, p_i) for h_i, p_i in zip(h, p) if h_i > 0]\n alive_monsters.sort(key=lambda x: x[1]) # Sort by powe...
codecontests
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nYou are given a weighed undirected connected graph, consi...
```python import sys from math import inf def floyd_warshall(graph, n): for k in range(n): for i in range(n): for j in range(n): graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]) def main(): n, m = map(int, input().strip().split()) graph = [[inf] * n for _ in ra...
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nYou are given a weighed undirected connected graph, consi...
code
{ "ground_truth": "{\"inputs\": [\"8 13\\n1 2 4\\n2 3 6\\n3 4 1\\n4 5 12\\n5 6 3\\n6 7 8\\n7 8 7\\n1 4 1\\n1 8 3\\n2 6 9\\n2 7 1\\n4 6 3\\n6 8 2\\n8\\n1 5\\n1 7\\n2 3\\n2 8\\n3 7\\n3 4\\n6 8\\n7 8\\n\", \"3 3\\n1 2 3\\n2 3 1\\n3 1 5\\n3\\n1 2\\n1 3\\n2 3\\n\", \"8 13\\n1 2 4\\n2 3 10\\n3 4 1\\n4 5 12\\n5 6 3\\n6 7 8\...
{ "current_response_index": 8, "index": 0, "num_history": 1, "raw_program": "import heapq\n\ndef floyd_warshall(graph):\n dist = [[float('inf')] * len(graph) for _ in range(len(graph))]\n for u in range(len(graph)):\n dist[u][u] = 0\n for v, w in graph[u]:\n dist[u][v] = w\n \n...
codecontests
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nByteland is a country whose population squares every year...
```python def population_in_year(pi, yi): MOD = 10**9 + 7 years_passed = yi - 2000 population = pi for _ in range(years_passed): population = (population * population) % MOD return population def process_cases(): import sys input = sys.stdin.read data = input().split() ...
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nByteland is a country whose population squares every year...
code
{ "ground_truth": "{\"inputs\": [\"2\\n5 2002\\n3 2000\", \"2\\n5 2955\\n3 2000\", \"2\\n7 2955\\n3 2000\", \"2\\n7 2955\\n6 2000\", \"2\\n7 3525\\n6 1480\", \"2\\n6 3525\\n6 1480\", \"2\\n6 1343\\n6 1480\", \"2\\n0 1419\\n6 1480\", \"2\\n1 3405\\n6 1480\", \"2\\n1 3171\\n8 1075\", \"2\\n1 4734\\n8 2055\", \"2\\n1 47...
{ "current_response_index": 0, "index": 0, "num_history": 1, "raw_program": "def population_in_year(pi, yi):\n \"\"\"\n Calculate the population in the given year yi, starting from pi in the year 2000.\n The population squares every year.\n \n Args:\n pi: Population in the year 2000.\n yi: ...
taco
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nJack and Daniel are friends. Both of them like letters, e...
```python def morganAndString(a, b): # Convert strings to lists for stack-like behavior stack_a = list(a) stack_b = list(b) result = [] # Process until both stacks are empty while stack_a or stack_b: # Compare the top elements of both stacks if stack_a == []: ...
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nJack and Daniel are friends. Both of them like letters, e...
code
{ "ground_truth": "{\"inputs\": [\"1\\nABCD\\nDCBA\\n\", \"1\\nJASON\\nHAD\\n\", \"1\\nBBB\\nAAA\\n\", \"2\\nTEST\\nCASE\\nPROGRAM\\nTEST\\n\", \"2\\nABC\\nABC\\nXYZ\\nXYZ\\n\"], \"outputs\": [\"ABCDCBAD\", \"HADJASON\", \"AAABBB\", \"CASETEST\\nPROGRAMTEST\", \"AABBCC\\nXXYYZZ\"]}", "style": "rule" }
{ "current_response_index": 0, "index": 0, "num_history": 3, "raw_program": "def morganAndString(a, b):\n # Convert strings to lists for easier manipulation\n stack_a = list(a)\n stack_b = list(b)\n result = []\n \n # Continue until both stacks are empty\n while stack_a or stack_b:\n ...
codecontests
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nIkshu's love for binary numbers\n\nIkshu recently learnt ...
```python from fractions import Fraction from functools import lru_cache def count_sequences(n, k): @lru_cache(maxsize=None) def dp(i, last_one_length): if i == 0: return 1 count = dp(i-1, 0) # Adding 0 if last_one_length < k-1: count += dp(i-1, last_one_length+...
[ { "content": "You are an expert programmer specializing in optimization algorithms. Your task is to improve the given code to solve the corresponding question. Here is the question: ", "role": "system" }, { "content": "# Question Description\nIkshu's love for binary numbers\n\nIkshu recently learnt ...
code
{ "ground_truth": "{\"inputs\": [\"5 1\\n\\nSAMPLE\", \"5 1\\n\\nS@MPLE\", \"8 1\\n\\nSPM@LE\", \"1 1\\n\\nSPM@LE\", \"7 1\\n\\nSAMPLE\", \"10 1\\n\\nSPM@LE\", \"7 2\\n\\nSAMPLE\", \"2 1\\n\\nSPLALE\", \"4 1\\n\\nSPALLE\", \"10 2\\n\\nSPM@LE\", \"3 1\\n\\nSPALLE\", \"12 1\\n\\nSPL@LE\", \"6 2\\n\\nELPMAT\", \"13 2\\n...
{ "current_response_index": 7, "index": 0, "num_history": 1, "raw_program": "import math\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\ndef probability(N, K):\n # Base cases\n if K == 1:\n return (2**N - 1, 2**N)\n \n # Recursive function to calculate the number of ...
taco
[{"content":"You are an expert programmer specializing in optimization algorithms. Your task is to i(...TRUNCATED)
"```python\nimport sys\nfrom collections import deque\n\ndef rig_tournament(n, beats):\n # Find a(...TRUNCATED)
[{"content":"You are an expert programmer specializing in optimization algorithms. Your task is to i(...TRUNCATED)
code
{"ground_truth":"{\"inputs\": [\"3\\nX10\\n0X1\\n10X\\n\", \"3\\nX10\\n0X0\\n11X\\n\"], \"outputs\":(...TRUNCATED)
{"current_response_index":2,"index":0,"num_history":3,"raw_program":"def can_rig_tournament(n, matri(...TRUNCATED)
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
31