Dataset Viewer
Auto-converted to Parquet Duplicate
question_id
int64
41
56.8k
question_title
stringlengths
5
37
question_content
stringlengths
206
4.02k
dataset
stringclasses
1 value
difficulty
stringclasses
3 values
java
dict
java15
dict
java8
dict
python
dict
test_cases
stringlengths
28
2.49M
max_retries
float64
1
3
5,396
Fibonacci LCM
After Derek (of district 5) discovered how to compute the greatest common divisor (gcd) of Fibonacci numbers, he now tried to answer the next obvious question: how does one compute the *least common multiple* (lcm) of Fibonacci numbers? Unfortunately, Derek found out that this wasn't as easy as the original problem, so...
hackerrank
Hard
{ "class_name": "Result", "func_sign": [ "public static int solve(List<Integer> f)" ], "script_name": "Solution", "solution": "import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n private static InputReader in;\n private static PrintWriter out;\n \npublic static int mod = 1000000007;\n\n...
{ "solution": "import java.io.*;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class HR_fibonacci_lcm {\n\n final static long MOD = 1000000007;\n final static long MOD2 = 1000000006;\n\n static long[][] mul(long[][] a, long[][] b) {\n long[][] c = new long[a.length][a.length];\n f...
{ "solution": "import java.io.*;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class HR_fibonacci_lcm {\n\n final static long MOD = 1000000007;\n final static long MOD2 = 1000000006;\n\n static long[][] mul(long[][] a, long[][] b) {\n long[][] c = new long[a.length][a.length];\n f...
{ "class_name": null, "func_sign": [ "solve(f)" ], "solution": "import sys, random\nfrom math import sqrt\n\ndef gcd(a, b):\n while 1:\n if b == 0:\n return a\n a %= b\n if a == 0:\n return b\n b %= a\n\ndef fib_mod(n, mod):\n if n <= 2:\n return (((n + 1) >> 1) % mod, ((n + 2) >>...
eJztms2uJslVRRnwIFaNLRT/EcmTIFGIgfGASeGBLVlClngIeF/W2lnVUSr7GjMDq6v7dmfl/b7YEednn31O5n/87X/9av1N/vzDZy7+8d8//euX3/zut5/+/hefdvv85ZxTyin185f19LHLOg83n6c9fe3++cus7bS51/j8pZ5VVi9jcXedXp+x+Ow4pT/z85f+nNX3bnxnlN5n39NFa92t1M0H2nhqnevhLjB9ncrNUctTx1O8ZOnen1ZAKuM8axYux5rjtApmbXt0duWmWz98qbtq23X2MUpgW5u5W8tafPps7o66+zM862ycoG+O...
null
2,462
GCD Product
This time your assignment is really simple. Calculate GCD(1, 1) * GCD(1, 2) * ... * GCD(1, M) * GCD(2, 1) * GCD(2, 2) * ... * GCD(2, M) * ... * GCD(N, 1) * GCD(N, 2) * ... * GCD(N, M). where GCD is defined as the [Greatest Common Divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor). **Input Format** The...
hackerrank
Hard
{ "class_name": "Result", "func_sign": [ "public static int solve(int n, int m)" ], "script_name": "Solution", "solution": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchE...
{ "solution": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\n\npublic class Solution {\n static InputStream is;\n static PrintWriter out;\n static String INPUT = ...
{ "solution": "import java.io.*;\nimport java.math.BigInteger;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.StringTokenizer;\n\npublic class T {\n\n static MyScanner sc;\n private static PrintWriter out;\n\n private static int[] primes = new int[]{\n\n 2, 3, 5, 7, 11, 13, 17...
{ "class_name": null, "func_sign": [ "solve(n, m)" ], "solution": "#!/usr/bin/env python\n\nimport math, sys\n\n\nMOD = 1000000007\n\n\ndef rwh_primes2(n):\n \"\"\"Input n>=6, Returns a list of primes, 2 <= p < n\n http://stackoverflow.com/a/2068548/406772\"\"\"\n\n if n < 3:\n return []\n ...
eJx1lLtKBFEMhi18kDD1IrlffBJBxUK3sFGLFQQR7O1E39ezs1sIZxNSDJz58uf8yczn+e/3+dkaV1/j4fp9eXx6ed0tl7CI40gIxpHLBpbt28v2frd9uHt+3R3fKXZFU5Kbp+VjA//orGQhhHGcXtbwFjFwwZp4RVIBKyRuWE5DKo1Zm/AQUGtQUyBGgeKMWZyEuDwMSDCErG1BRDGL5wJMwxlRIMq07K5fTKOCZc4FLDyA0yMb1lFDU/UEC92N6YQOtMPN2HfHM3SwFY429+7yWBzCCReIjpmdrApZlTrGTExQui4LpBMj8nI/Yb5D...
null
5,747
Eugene and Big Number
Eugene must do his homework, but he is struggling. He has three integer numbers: *A*, *N*, *M*. He writes number *A* on the board *N* times **in a row**. Let's call the resulting big number *X*. Help Eugene find *X* [modulo](https://en.wikipedia.org/wiki/Modulo_operation) *M*.
hackerrank
Medium
{ "class_name": "Result", "func_sign": [ "public static int solve(int a, long n, int m)" ], "script_name": "Solution", "solution": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputM...
{ "solution": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\n\npublic class EABN {\n static InputStream is;\n static PrintWriter out;\n static String INPUT = \"\"...
{ "solution": "import java.io.OutputStreamWriter;\nimport java.io.BufferedWriter;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.Writer;\nimport java.util.List;\nimport java.util.function.Function;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.InputMismatchExcept...
{ "class_name": null, "func_sign": [ "solve(a, n, m)" ], "solution": "for i in range(int(input())):\n a, b, c = map(int, input().split(' '))\n\n if len(str(a)) == 1:\n ans = pow(10,b,9*(c))\n ans = a*((ans - 1) // 9)\n print(ans%c)\n\n elif len(str(a)) == 2:\n ans = pow...
eJyNmc2OJTkRhVnwIFaxQyPksB12mCdBohELmAWbYhYzEhIaiYeA9+U7znur8uZPd1/1T9XNzHDEiRMnws7//PZ/9rvfrM+ffs8Pf/732z/ef/rl57c/pjdrX96H5xRz9GnRLM+WInr2GM2+vEcpadbh4W4xzVOd7mPm6l/ep7dU5uApt+JzpJ7HaL23+uW9tZ5ajmG91pFrT1Zrqxkr2JyeSngto7CSF56rXoaN+eW9N34defTaZ+BE8tmy9V7w06alyHga1qyNlkbgc4ky8KWm5s1qzq2VgislbHpu8eXdjdV99jKLueWaSskRdZZC...
null
2,596
Order of Prime in Factorial
For a given prime $p$, define $\operatorname{ord}_p(k)$ as the multiplicity of $p$ in $k$, i.e. the number of times $p$ appears in the prime factorization of $k$. For a given $p$ (prime) and $L$, let $F(p,L)$ be the number of integers $n$ such that $1 \le n \le L$ and $\operatorname{ord}_p(n!)$ is divisible by $p$. He...
hackerrank
Hard
{ "class_name": "Result", "func_sign": [ "public static long solve(long p, long l)" ], "script_name": "Solution", "solution": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismat...
{ "solution": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\n\npublic class Solution {\n static InputStream is;\n static PrintWriter out;\n static String INPUT = ...
{ "solution": "import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n\n public static final int MOD = 1000000007;\n static Scanner sc;\n private static PrintWriter out;\n\n public static void main(String[] s) throws Exception {\n sc = new Scanner(System.in);\n// sc = new MyScann...
{ "class_name": null, "func_sign": [ "solve(p, l)" ], "solution": "T = int(input())\n\ndef ok(p, L):\n sum = 0\n while L > 0:\n sum += L % p\n L //= p\n return sum % p\n\ndef solve(p, L):\n L1 = L // p\n r = p - ok(p, L1)\n if r == p:\n r = 0\n if r < L % p:\n ...
eJx9mM2OZDsRhFnwEuysXl8hO/2bvAhINLCAWbBp7mKuhISQeAh4X75I+0zVVHXNjNTurjrHzoz8iUj/59f/+/NvfhX//vB7fvnjv97+/vHzL1/ffpfeSn//sDr7qCmW9f5RbNkYJZ1VH9SWZ+p9eu2Vv3OzWlMs8XpqM54a3apl3qzd17RWMh+vXsbUw97z4O/ZWi1prFJ54v2j1earpFhMu/SFLS17dT0+Vqsz6afezXN2z4v3iz5ZPTd97LmYp8YrbPL+4bPkmjChFP6qs7blSYtjz9tP6e3LP3/+8tevX/72l3/88vXgEM7b5Xw+...
null
1,232
nCr table
"Jim is doing his discrete maths homework which requires him to repeatedly calculate <sup>n</sup>C<s(...TRUNCATED)
hackerrank
Medium
{"class_name":"Result","func_sign":["public static List<Integer> solve(int n)"],"script_name":"Solut(...TRUNCATED)
{"solution":"import java.math.BigInteger;\nimport java.util.*;\nimport java.io.*;\n\n\npublic class (...TRUNCATED)
{"solution":"/*\n * To change this license header, choose License Headers in Project Properties.\n *(...TRUNCATED)
{"class_name":null,"func_sign":["solve(n)"],"solution":"from math import ceil\nT=int(input())\nwhile(...TRUNCATED)
"eJxcnb3ONDmSnWXoQgpty0gyk2RS0IUI0AAypDHkzK4xC0iQo0tXPCeYPPwWg+murrcqK5MMRpw48ff//uN//S//51/+w3/7v3/(...TRUNCATED)
null
4,264
Merge List
"Shashank is very excited after learning about the *linked list*. He learned about how to *merge* tw(...TRUNCATED)
hackerrank
Medium
{"class_name":"Result","func_sign":["public static int solve(int n, int m)"],"script_name":"Solution(...TRUNCATED)
{"solution":"import java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\nimpor(...TRUNCATED)
{"solution":"import java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\nimpor(...TRUNCATED)
{"class_name":null,"func_sign":["solve(n, m)"],"solution":"t = int(input())\nfor _ in range(t):\n (...TRUNCATED)
"eJyNVb2Ok0kQJCDgMUaOEeqe/r9HICNDwugC2OASQ7BISKeT7iHgfaker1mf159vN7Dn+9zTXV1V3fvvy5/vXr1Yf+/f4vDh791(...TRUNCATED)
null
3,548
Mehta and the Typical Supermarket
"Mehta is a very rich guy. He has $N$ types of coins, and each type of coin is available in an unlim(...TRUNCATED)
hackerrank
Hard
{"class_name":"Result","func_sign":["public static List<Integer> solve(List<Integer> a, List<List<In(...TRUNCATED)
{"solution":"import java.io.*;\n\npublic class HR_mehta_and_the_typical_supermarket {\n\n public (...TRUNCATED)
{"solution":"import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n\n\tBufferedReader b(...TRUNCATED)
{"class_name":null,"func_sign":["solve(a, days)"],"solution":"import itertools, math\ndef findsubset(...TRUNCATED)
"eJyNnMvOLclRhRnwIKUeWygr78mER2CKxEEMwAMmjQe2hIQs8RDwvnzfyn3c3ad9LLfs/qv3pSovEStWrIjc//O3//cP//g3+ee(...TRUNCATED)
null
1,932
Sherlock and Pairs
"Sherlock is given an array of $N$ integers ($A$<sub>$0$</sub>, $A$<sub>$1$</sub> ... $A$<sub>$N-1$<(...TRUNCATED)
hackerrank
Medium
{"class_name":"Result","func_sign":["public static int solve(List<Integer> a)"],"script_name":"Solut(...TRUNCATED)
{"solution":"import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n\n static void so(...TRUNCATED)
{"solution":"import java.util.Scanner;\nimport java.util.Arrays;\npublic class Solution{\n public(...TRUNCATED)
{"class_name":null,"func_sign":["solve(a)"],"solution":"#!/usr/bin/env python\n\nimport collections,(...TRUNCATED)
"eJyEnUuubcuSVCnQkK1XzkJEzPjSANqAxJUoQBaoXCgkEhJCokqvsTF8XwklmYlA7+Y5Z++15oyPf8zNzf/Xv/53//vftn/17//(...TRUNCATED)
null
5,183
Anti-Palindromic Strings
"You are given two integers, $N$ and $M$. Count the number of strings of length $N$ (under the alpha(...TRUNCATED)
hackerrank
Medium
{"class_name":"Result","func_sign":["public static int solve(int n, int m)"],"script_name":"Solution(...TRUNCATED)
{"solution":"import java.io.*;\n\npublic class HR_antipalindromic_strings {\n\n final static long(...TRUNCATED)
{"solution":"import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\n\npublic class (...TRUNCATED)
{"class_name":null,"func_sign":["solve(n, m)"],"solution":"P = 10**9 + 7\n\ndef f(n, m):\n\tif n == (...TRUNCATED)
"eJyVVruO5FQQJSDhL0odr1C9H3wJEo0IYAKSZoNdaSWEREhGAv/LKQ+Mlp7xsFgjj9u+vnXqPKr718///P2Lz47j699w8c3Plx9(...TRUNCATED)
null
3,320
Lexicographic paths
"Krishnakant is standing at $(0,0)$ in the [Cartesian plane](http://en.wikipedia.org/wiki/Cartesian_(...TRUNCATED)
hackerrank
Medium
{"class_name":"Result","func_sign":["public static String solve(int x, int y, int k)"],"script_name"(...TRUNCATED)
{"solution":"import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n private static Rea(...TRUNCATED)
{"solution":"import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\n\npublic class Solution (...TRUNCATED)
{"class_name":null,"func_sign":["solve(x, y, k)"],"solution":"import math\n\n\ndef paths(n, m):\n (...TRUNCATED)
"eJyNVUuu1DAQZIHENVpZPyG3HTsJJ/AJLCSCWMAs2IS3mCchoSdxCFiw46j0z5kwSQxZjB1n0lXV1d35/vLn71cv5Hr7izbvvnW(...TRUNCATED)
null
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
22