rating
int64
800
3.5k
tags
listlengths
0
11
official_tests
listlengths
1
150
prompt
stringlengths
1.11k
5.74k
3,500
[ "binary search", "data structures", "trees" ]
[ { "input": "3\r\n3\r\n1 2\r\n2 3\r\n2 3\r\n6\r\n1 2\r\n1 3\r\n2 4\r\n2 5\r\n1 6\r\n4 5\r\n4\r\n1 2\r\n1 3\r\n2 4\r\n2 4\r\n", "output": "Bob\r\nAlice\r\nAlice\r\nBob\r\nAlice\r\nBob\r\nAlice\r\n" } ]
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
800
[ "brute force", "math" ]
[ { "input": "3\r\n2\r\n4\r\n6\r\n", "output": "1\r\n3\r\n5\r\n" }, { "input": "99\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23\r\n24\r\n25\r\n26\r\n27\r\n28\r\n29\r\n30\r\n31\r\n32\r\n33\r\n34\r\n35\r\n36\r\n37\r\n38\r\n39...
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
800
[ "implementation", "strings" ]
[ { "input": "5\r\nqwq\r\nppppp\r\npppwwwqqq\r\nwqpqwpqwwqp\r\npqpqpqpq\r\n", "output": "pwp\r\nqqqqq\r\npppwwwqqq\r\nqpwwpqwpqpw\r\npqpqpqpq\r\n" }, { "input": "1\r\npwwwqppppwppwwwpwwwppqpwwqppqpppwwwwpwwwwpwwwwqwqqwwww\r\n", "output": "wwwwppwpwwwwqwwwwqwwwwqqqpqqpwwqpqqwwwqwwwqqwqqqqpwwwq\r\n"...
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
1,300
[ "binary search", "greedy", "implementation", "math", "number theory" ]
[ { "input": "5\r\n2 2 6 2 12\r\n2 1 1000000000 1 1000000000\r\n3 5 7 15 63\r\n1000000000 1 5 6 1000000000\r\n15 17 78 2596 20914861\r\n", "output": "12\r\n1999999987\r\n6\r\n1\r\n197\r\n" }, { "input": "1\r\n53 644922653 836907643 264850321 782063425\r\n", "output": "137140773\r\n" } ]
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
1,900
[ "binary search", "brute force", "data structures", "math", "number theory" ]
[ { "input": "3 3 6\r\n-2 3 -3\r\n-2 2 -1\r\n-1\r\n1\r\n-2\r\n2\r\n-3\r\n3\r\n", "output": "NO\r\nYES\r\nNO\r\nNO\r\nYES\r\nNO\r\n" }, { "input": "5 5 6\r\n1 -2 3 0 0\r\n0 -2 5 0 -3\r\n4\r\n-3\r\n5\r\n2\r\n-1\r\n2\r\n", "output": "YES\r\nYES\r\nYES\r\nYES\r\nNO\r\nYES\r\n" }, { "input": "2...
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
1,700
[ "dfs and similar", "graph matchings", "graphs", "implementation", "trees" ]
[ { "input": "5\r\n2\r\n2 1\r\n5\r\n2 3 4 5 1\r\n5\r\n2 1 4 2 3\r\n5\r\n4 1 1 5 4\r\n10\r\n4 3 9 1 6 7 9 10 10 3\r\n", "output": "2\r\n2\r\n5\r\n4\r\n5\r\n" }, { "input": "1\r\n6\r\n2 1 1 3 6 5\r\n", "output": "4\r\n" }, { "input": "1\r\n8\r\n2 1 4 5 6 2 6 7\r\n", "output": "6\r\n" }...
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
1,900
[ "dfs and similar", "dp", "dsu", "graphs", "implementation", "trees" ]
[ { "input": "5\r\n2\r\n2 1\r\n5\r\n2 3 4 5 1\r\n5\r\n2 1 4 2 3\r\n5\r\n4 1 1 5 4\r\n10\r\n4 3 9 1 6 7 9 10 10 3\r\n", "output": "2\r\n2\r\n5\r\n5\r\n5\r\n" }, { "input": "1\r\n6\r\n2 1 1 3 6 5\r\n", "output": "4\r\n" } ]
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
2,100
[ "constructive algorithms", "data structures", "dp", "implementation", "math" ]
[ { "input": "2\r\n4 3\r\n1 5 2 4\r\n4 9 5 3\r\n4 5 2 3\r\n1 5 5 2\r\n1 1 4 4\r\n2 2 3 3\r\n1 2 4 3\r\n3 3\r\n1 2 3\r\n4 5 6\r\n7 8 9\r\n1 1 1 3\r\n1 3 3 3\r\n2 2 2 2\r\n", "output": "500 42 168 \r\n14 42 5 \r\n" } ]
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
900
[ "constructive algorithms", "geometry", "greedy", "math" ]
[ { "input": "4\r\n1 1 1\r\n3 4 1\r\n4 3 3\r\n3 4 4\r\n", "output": "0 0 1 1\r\n0 1 1 0\r\n0 0 3 3\r\n0 3 3 0\r\n0 0 3 3\r\n0 3 3 0\r\n0 0 3 3\r\n0 3 3 0\r\n" } ]
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
1,300
[ "binary search", "brute force", "constructive algorithms", "greedy" ]
[ { "input": "4\r\n2\r\n1 2\r\n1\r\n7\r\n3\r\n2 4 9\r\n5\r\n1 5 8 10 13\r\n", "output": "1\r\n1\r\n2\r\n3\r\n" }, { "input": "1\r\n2\r\n1 100000000000000001\r\n", "output": "100000000000000000\r\n" }, { "input": "1\r\n5\r\n3 4 9 13 14\r\n", "output": "1\r\n" } ]
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
1,500
[ "binary search", "brute force", "constructive algorithms", "data structures", "greedy", "implementation" ]
[ { "input": "4\r\n1\r\n1\r\n6\r\n101101\r\n7\r\n1110001\r\n5\r\n11111\r\n", "output": "1\r\n8\r\n18\r\n6\r\n" } ]
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
1,900
[ "binary search", "data structures", "dp", "implementation", "math" ]
[ { "input": "4\r\n1 2 5 10\r\n15\r\n1 1\r\n1 2\r\n1 3\r\n1 4\r\n1 5\r\n1 10\r\n5 10\r\n6 10\r\n2 8\r\n3 4\r\n3 10\r\n3 8\r\n5 6\r\n5 5\r\n1 8\r\n", "output": "1\r\n4\r\n12\r\n30\r\n32\r\n86\r\n56\r\n54\r\n60\r\n26\r\n82\r\n57\r\n9\r\n2\r\n61\r\n" }, { "input": "7\r\n1 4 5 6 7 8 9\r\n4\r\n1 11\r\n1 12...
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...
2,700
[ "data structures", "dfs and similar", "divide and conquer", "dp", "implementation", "trees" ]
[ { "input": "12\r\n2 1 5 7\r\n2 1 3 4\r\n4 1 4\r\n4 1 8\r\n4 1 2\r\n1 1\r\n2 2 4 10\r\n4 1 9\r\n4 2 9\r\n3 1\r\n4 1 9\r\n4 2 9\r\n", "output": "4\r\n11\r\n0\r\n11\r\n17\r\n4\r\n17\r\n" }, { "input": "10\r\n4 1 3\r\n4 1 6\r\n2 1 2 6\r\n1 1\r\n4 1 8\r\n4 2 2\r\n4 1 9\r\n2 2 1 2\r\n2 2 2 6\r\n2 2 9 3\r\...
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3. Your solution must read input from sta...