question stringlengths 29 14k | solutions stringlengths 2 1.9M | starter_code stringlengths 0 1.47k | input_output stringlengths 29 79.2M | difficulty stringclasses 6
values | raw_tags stringlengths 2 281 | name stringlengths 3 105 ⌀ | source stringclasses 10
values | tags stringlengths 2 203 | skill_types stringclasses 135
values | url stringlengths 34 138 ⌀ | Expected Auxiliary Space stringclasses 335
values | time_limit stringclasses 150
values | date stringlengths 10 10 ⌀ | picture_num stringclasses 8
values | memory_limit stringclasses 35
values | Expected Time Complexity stringclasses 710
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
This is an interactive problem.
In good old times dwarves tried to develop extrasensory abilities:
* Exactly n dwarves entered completely dark cave.
* Each dwarf received a hat — white or black. While in cave, none of the dwarves was able to see either his own hat or hats of other Dwarves.
* Dwarves went out ... | [] | {"inputs": ["hack\n30\n1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "random\n22\n2\n", "random\n20\n11\n", "random\n10\n1\n", "random\n20\n12\n", "random\n30\n14\n", "random\n23\n1\n", "predefined\n15\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 0\n", "random\n21\n2\n", "random\n22\n1\n", "random\n28\n1\n", "random\... | HARD | ['interactive', 'binary search', 'geometry', 'constructive algorithms'] | null | codeforces | ['Geometry', 'Sorting', 'Constructive algorithms'] | ['Sorting'] | https://codeforces.com/problemset/problem/1063/C | null | 2.0 seconds | null | null | 256.0 megabytes | null | |
There are $n$ candy boxes in front of Tania. The boxes are arranged in a row from left to right, numbered from $1$ to $n$. The $i$-th box contains $r_i$ candies, candies have the color $c_i$ (the color can take one of three values — red, green, or blue). All candies inside a single box have the same color (and it is ... | ["INF = 10000000000.0\nmax_n = 50\nmax_k = 2000\n\ndef main():\n\t(n, s, k) = map(int, input().split())\n\ts -= 1\n\tbuf = [''] * (max_n + 1)\n\tdp = [[0 for i in range(max_n + 1)] for j in range(max_k + 1)]\n\tr = list(map(int, input().split()))\n\tc = input()\n\tanswer = INF\n\tfor i in range(len(c)):\n\t\tbuf[i] = c... | {"inputs": ["5 3 10\n1 2 3 4 5\nRGBRR\n", "2 1 15\n5 6\nRG\n", "6 1 21\n4 2 3 5 1 6\nRGBGRB\n", "6 1 21\n6 5 4 3 2 1\nRGBRGB\n", "1 1 10\n10\nR\n", "2 1 10\n5 5\nRG\n", "2 1 10\n5 6\nRR\n", "5 3 10\n1 2 3 4 5\nRGBRG\n", "9 1 6\n1 1 1 3 3 3 2 2 2\nRGGBRRGBB\n", "50 39 2000\n48 43 26 24 46 37 15 30 39 34 4 14 29 34 8 18 ... | HARD | ['dp'] | null | codeforces | ['Dynamic programming'] | ['Dynamic programming'] | https://codeforces.com/problemset/problem/1057/C | null | null | 2019-12-31 | null | null | null | |
Little Petya likes to play a lot. Most of all he likes to play a game «Holes». This is a game for one person with following rules:
There are N holes located in a single row and numbered from left to right with numbers from 1 to N. Each hole has it's own power (hole number i has the power ai). If you throw a ball into ... | [] | {"inputs": ["10 10\n5 1 2 4 1 7 3 8 10 8\n0 5 6\n1 8\n1 1\n0 10 3\n1 5\n1 3\n1 2\n0 6 1\n1 9\n1 1\n", "10 10\n5 1 2 8 1 7 3 8 10 8\n0 5 6\n1 8\n1 1\n0 10 3\n1 5\n1 3\n1 2\n0 6 1\n1 9\n1 1\n", "8 5\n1 1 1 1 1 1 8 2\n1 1\n0 1 3\n1 1\n0 3 4\n1 2\n", "8 5\n1 1 1 1 1 2 11 2\n1 1\n0 1 3\n1 1\n0 3 4\n1 2\n", "8 5\n1 1 1 1 1 2... | VERY_HARD | ['data structures', 'dsu'] | null | codeforces | ['Spanning trees', 'Data structures'] | ['Data structures'] | https://codeforces.com/problemset/problem/13/E | null | 1.0 seconds | null | null | 64.0 megabytes | null | |
If you visit Aizu Akabeko shrine, you will find a unique paper fortune on which a number with more than one digit is written.
Each digit ranges from 1 to 9 (zero is avoided because it is considered a bad omen in this shrine). Using this string of numeric values, you can predict how many years it will take before your ... | ["def sub(maxs, mins):\n\tfor i in range(len(maxs)):\n\t\tif maxs[i] != mins[i]:\n\t\t\tif i == len(maxs) - 1:\n\t\t\t\treturn int(maxs[i]) - int(mins[i])\n\t\t\tif i == len(maxs) - 2:\n\t\t\t\treturn int(maxs[i:i + 2]) - int(mins[i:i + 2])\n\t\t\treturn 10\n\treturn 0\n\ndef checkEqual(S):\n\tans = 8\n\tfor k in range... | {"inputs": ["9714431", "16612328", "23422731", "754526", "955577", "75547", "2112", "799", "88", "32523857", "4787", "1859551", "135661", "3675", "156692", "167918384", "83994", "4837847", "14513597", "15282598", "12659326", "1468417", "6280", "115464", "52376853", "2315", "3641224", "97187", "836", "195884", "36250", ... | UNKNOWN_DIFFICULTY | [] | null | aizu | [] | [] | null | null | 1.0 seconds | null | null | 268.435456 megabytes | null | |
You have a deck of $n$ cards, and you'd like to reorder it to a new one.
Each card has a value between $1$ and $n$ equal to $p_i$. All $p_i$ are pairwise distinct. Cards in a deck are numbered from bottom to top, i. e. $p_1$ stands for the bottom card, $p_n$ is the top card.
In each step you pick some integer $k > 0$... | ["import heapq\nfrom math import sqrt\nimport operator\nimport sys\ninf_var = 0\nif inf_var == 1:\n\tinf = open('input.txt', 'r')\nelse:\n\tinf = sys.stdin\ninput = inf.readline\n\ndef read_one_int():\n\treturn int(input().rstrip('\\n'))\n\ndef read_list_of_ints():\n\tres = [int(val) for val in input().rstrip('\\n').sp... | {"inputs": ["4\n4\n1 2 3 4\n5\n1 5 2 4 3\n6\n4 2 5 3 6 1\n1\n1\n", "4\n4\n2 1 3 4\n5\n1 5 2 4 3\n6\n4 2 5 3 6 1\n1\n1\n", "4\n4\n2 1 3 4\n5\n1 5 2 4 3\n6\n2 4 5 3 6 1\n1\n1\n", "4\n4\n1 2 3 4\n5\n1 5 2 4 3\n6\n4 2 5 3 6 1\n1\n1\n"], "outputs": ["4 3 2 1\n5 2 4 3 1\n6 1 5 3 4 2\n1\n", "4 3 2 1\n5 2 4 3 1\n6 1 5 3 4 2\n1... | EASY | ['data structures', 'greedy', 'math'] | null | codeforces | ['Data structures', 'Mathematics', 'Greedy algorithms'] | ['Data structures', 'Greedy algorithms'] | https://codeforces.com/problemset/problem/1492/B | null | 1 second | 2021-02-23 | 0 | 512 megabytes | null | |
"The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hammi(...TRUNCATED) | "[\"import sys\\nfrom sys import stdin\\nfrom bisect import bisect_right, bisect_left\\nfrom math im(...TRUNCATED) | "{\"inputs\": [\"3 8\\n2 27\\n1 86\\n0\", \"3 9\\n2 27\\n1 86\\n0\", \"3 8\\n1 35\\n1 86\\n0\", \"5 (...TRUNCATED) | UNKNOWN_DIFFICULTY | [] | null | aizu | [] | [] | null | null | 1.0 seconds | null | null | 134.217728 megabytes | null | |
"Given a number s(in string form). Find the Smallest number (Not leading Zeros) which can be obtaine(...TRUNCATED) | "[\"class Solution:\\n\\n\\tdef minimum_Number(self, s):\\n\\t\\tl = list(s)\\n\\t\\tl.sort()\\n\\t\(...TRUNCATED) | "#User function Template for python3\n\n\n\nclass Solution:\n\n\tdef minimum_Number(self, s):\n\n\t\(...TRUNCATED) | "{\"inputs\": [\"s = \\\"846903\\\"\", \"s = \\\"55010\\\"\"], \"outputs\": [\"304689\", \"10055\"]}(...TRUNCATED) | EASY | ['Algorithms', 'Mathematical'] | null | geeksforgeeks | ['Mathematics'] | [] | https://practice.geeksforgeeks.org/problems/smallest-number-by-rearranging-digits-of-a-given-number0820/1 | O(1) | null | null | 0 | null | O(N * log(N)) where N is the number of digits of the given number |
"Dilpreet wants to paint his dog's home that has n boards with different lengths. The length of i^{t(...TRUNCATED) | "[\"class Solution:\\n\\n\\tdef minTime(self, arr, n, k):\\n\\n\\t\\tdef numofPainter(maxLen):\\n\\t(...TRUNCATED) | "#User function Template for python3\n\nclass Solution:\n def minTime (self, arr, n, k):\n (...TRUNCATED) | "{\"inputs\": [\"n = 5\\nk = 3\\narr[] = {5,10,30,20,15}\", \"n = 4\\nk = 2\\narr[] = {10,20,30,40}\(...TRUNCATED) | MEDIUM_HARD | ['Algorithms', 'Searching', 'Binary Search', 'Divide and Conquer', 'Dynamic Programming'] | null | geeksforgeeks | ['Dynamic programming', 'Sorting', 'Divide and conquer', 'Complete search'] | ['Dynamic programming', 'Sorting', 'Complete search'] | https://practice.geeksforgeeks.org/problems/the-painters-partition-problem1535/1 | O(1) | null | null | 0 | null | O(n log m) , m = sum of all boards' length |
"An **anagram** is the result of rearranging the letters of a word to produce a new word.\n\n**Note:(...TRUNCATED) | "[\"def is_anagram(test, original):\\n\\treturn sorted(original.lower()) == sorted(test.lower())\\n\(...TRUNCATED) | def is_anagram(test, original):
| "{\"fn_name\": \"is_anagram\", \"inputs\": [[\"foefet\", \"toffee\"], [\"Buckethead\", \"DeathCubeK\(...TRUNCATED) | EASY | ['Strings', 'Fundamentals'] | null | codewars | ['String algorithms', 'Fundamentals'] | [] | https://www.codewars.com/kata/529eef7a9194e0cbc1000255 | null | null | null | null | null | null |
"There are n cities in Berland. Some pairs of them are connected with m directed roads. One can use (...TRUNCATED) | [] | "{\"inputs\": [\"4 0 1\\n3 1 1\\n\", \"20 20 40\\n4 5\\n6 7\\n13 14\\n10 11\\n9 10\\n19 20\\n2 3\\n1(...TRUNCATED) | VERY_HARD | ['trees', 'dfs and similar', 'graphs'] | null | codeforces | ['Tree algorithms', 'Graph algorithms', 'Graph traversal'] | [] | https://codeforces.com/problemset/problem/864/F | null | 2.0 seconds | null | null | 256.0 megabytes | null |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 94