Datasets:
id stringlengths 24 24 | messages listlengths 1 1 | problem stringlengths 455 1.07k | verification_info dict | ground_truth stringlengths 591 4.31k | public_tests listlengths 2 2 | reference_solution stringlengths 119 601 | dataset stringclasses 1
value | split stringclasses 1
value | programming_language stringclasses 1
value | prompt_language stringclasses 1
value | difficulty int8 1 5 | difficulty_label stringclasses 5
values | generator_family stringclasses 12
values | concepts listlengths 2 4 | generator_version stringclasses 1
value | generation_seed int64 61,706B 9,223,368,865B | semantic_group_id stringlengths 32 46 | parameters_json stringlengths 13 64 | verifier_kind stringclasses 1
value | verifier_version stringclasses 1
value | time_limit_seconds int16 2 2 | memory_limit_mb int16 256 256 | hidden_test_count int16 10 13 | mutation_score float32 0.67 1 | source stringclasses 1
value | source_license stringclasses 1
value | prompt_sha256 stringlengths 64 64 | reference_sha256 stringlengths 64 64 | contamination_group stringclasses 12
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5aca46eaadcc466aedebf7b6 | [
{
"role": "user",
"content": "# Filtered affine sum\n\nKeep every array value x satisfying x mod 5 = 2. Replace each kept value by 5x + (0), sum the results, and reduce the sum modulo 10007. Python-style non-negative remainders are used.\n\n## Input format\nThe first line contains n. The second contains n i... | # Filtered affine sum
Keep every array value x satisfying x mod 5 = 2. Replace each kept value by 5x + (0), sum the results, and reduce the sum modulo 10007. Python-style non-negative remainders are used.
## Input format
The first line contains n. The second contains n integers.
## Output format
Print one integer.
... | {
"language": "python",
"test_cases": [
{
"input": "6\n-7 0 1 7 14 21\n",
"output": "35\n",
"type": "stdin_stdout"
},
{
"input": "10\n6040 7043 3690 -7087 -1188 -9727 -9476 5646 -7063 -8\n",
"output": "8740\n",
"type": "stdin_stdout"
},
{
"input": "24\n3... | [{"input":"6\n-7 0 1 7 14 21\n","output":"35\n","type":"stdin_stdout"},{"input":"10\n6040 7043 3690 -7087 -1188 -9727 -9476 5646 -7063 -8\n","output":"8740\n","type":"stdin_stdout"},{"input":"24\n3439 861 -3531 -4138 1775 1221 1725 -7234 -4974 2766 5575 1430 6110 2686 -1885 -8357 7968 2016 -425 5699 7 -9209 -7572 -3940... | [
{
"input": "1\n0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "14\n-7352 5122 9515 -4554 2027 7401 422 -5000 4574 -9037 8504 -3141 648 -18\n",
"output": "7744\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]
print(sum(5*x+(0) for x in d[1:1+n] if x%5==2)%10007)
| oellm-code-rlvr | train | python | en | 3 | intermediate | filtered_affine_sum | [
"arrays",
"filtering",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 6,887,119,500,001,923,000 | oellm-code-filtered_affine_sum-000000000 | {"a":5,"b":0,"divisor":5,"modulus":10007,"residue":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 6f5fb60d3a7a008a610aca65a2d6ae7de632aae2d97ae380684159785c526cb5 | 08dd777502fd137573d717f6a09f05ff16cd10a87b7a47953b7d82c2c7896c00 | generator:filtered_affine_sum:v0.1 |
5e9f6d5ae4443785cf9cacb9 | [
{
"role": "user",
"content": "# Ranked frequency\n\nOrder distinct values by decreasing frequency. Ties are resolved by choosing the larger value first. Print the value at rank 2; if fewer than 2 distinct values exist, print the last value in this ordering.\n\n## Input format\nThe first line contains n. The... | # Ranked frequency
Order distinct values by decreasing frequency. Ties are resolved by choosing the larger value first. Print the value at rank 2; if fewer than 2 distinct values exist, print the last value in this ordering.
## Input format
The first line contains n. The second contains n integers.
## Output format
... | {
"language": "python",
"test_cases": [
{
"input": "8\n-2 -2 -2 5 5 7 8 9\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "35\n47 -22 -22 38 -15 -15 15 38 -15 26 18 38 -15 17 47 -15 18 -15 15 -22 -22 -22 26 26 15 17 47 15 38 -15 47 38 17 38 -22\n",
"output": "38\n... | [{"input":"8\n-2 -2 -2 5 5 7 8 9\n","output":"5\n","type":"stdin_stdout"},{"input":"35\n47 -22 -22 38 -15 -15 15 38 -15 26 18 38 -15 17 47 -15 18 -15 15 -22 -22 -22 26 26 15 17 47 15 38 -15 47 38 17 38 -22\n","output":"38\n","type":"stdin_stdout"},{"input":"39\n15 17 -6 36 -6 5 -6 5 17 17 36 5 -6 -16 17 17 36 44 -3 5 -... | [
{
"input": "7\n1 1 2 2 3 3 4\n",
"output": "2\n",
"type": "stdin_stdout"
},
{
"input": "42\n46 -43 -23 -7 -22 -7 -8 22 34 -22 -23 22 -7 38 -22 -23 -23 -31 22 38 34 -23 38 -8 -7 46 -2 -43 34 22 38 22 34 -7 22 22 -22 38 38 38 -22 34\n",
"output": "22\n",
"type": "stdin_stdout"
}
] | import sys
from collections import Counter
d=list(map(int,sys.stdin.buffer.read().split())); c=Counter(d[1:1+d[0]])
a=sorted(c,key=lambda x:(-c[x], -x))
print(a[min(2-1,len(a)-1)])
| oellm-code-rlvr | train | python | en | 3 | intermediate | frequency_rank | [
"hash_maps",
"sorting",
"frequency_counting"
] | oellm-code-generators-0.1.0 | 6,091,132,308,483,114,000 | oellm-code-frequency_rank-000000000 | {"rank":2,"tie_break":"larger"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 8d7d63e36ecbefb587f8d2be66a50e79289ed2a75d515d20a7b962eccc1dfd47 | 8a8d27c9e9e278dcb347f27726c3bc10dc3f536b8fe099c7b3d3e8f907dc5a9a | generator:frequency_rank:v0.1 |
b82b9642d03ca893dae6a42a | [
{
"role": "user",
"content": "# Affine range queries\n\nTransform every array value x to -1x + (-3). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 97.\n\n## Input format\nn q, then n integers, then q lines l r.\n\n## Output format\nPrint one answer per query.\n\n## Constraints\n... | # Affine range queries
Transform every array value x to -1x + (-3). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 97.
## Input format
n q, then n integers, then q lines l r.
## Output format
Print one answer per query.
## Constraints
1 ≤ n ≤ 52; 1 ≤ q ≤ 16.
Example 1
Input:
1 2
0
1 1
1... | {
"language": "python",
"test_cases": [
{
"input": "5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n",
"output": "82\n88\n94\n",
"type": "stdin_stdout"
},
{
"input": "51 15\n79 -45 -86 -7 5 47 32 -78 79 -1 -87 38 -81 -37 -3 -73 -9 -78 -31 2 -81 45 13 -12 45 44 100 52 -18 -87 99 97 -15 -2 19 35 ... | [{"input":"5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n","output":"82\n88\n94\n","type":"stdin_stdout"},{"input":"51 15\n79 -45 -86 -7 5 47 32 -78 79 -1 -87 38 -81 -37 -3 -73 -9 -78 -31 2 -81 45 13 -12 45 44 100 52 -18 -87 99 97 -15 -2 19 35 -81 -20 21 90 17 78 -16 97 60 6 -46 -77 26 70 -32\n17 41\n16 44\n13 41\n46 48\n4 26\n30 3... | [
{
"input": "1 2\n0\n1 1\n1 1\n",
"output": "94\n94\n",
"type": "stdin_stdout"
},
{
"input": "21 4\n88 42 14 93 -49 -54 100 45 -59 -13 44 -53 33 78 57 -83 -35 57 72 75 100\n9 21\n21 21\n2 10\n16 19\n",
"output": "76\n91\n48\n74\n",
"type": "stdin_stdout"
}
] | import sys
it=iter(map(int,sys.stdin.buffer.read().split())); n=next(it); q=next(it); p=[0]
for _ in range(n): p.append(p[-1]+-1*next(it)+(-3))
for _ in range(q):
l=next(it); r=next(it); print((p[r]-p[l-1])%97)
| oellm-code-rlvr | train | python | en | 4 | advanced | range_affine_queries | [
"prefix_sums",
"range_queries",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 4,025,521,752,680,134,000 | oellm-code-range_affine_queries-000000000 | {"a":-1,"b":-3,"modulus":97} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | eab40fed50823aec2b240130f4821f65ebacb5e7eaee66884ad45e608af29699 | 935393c8c9e8aa55d9168a9fc1d4f07ec466342a0c08508a715017de8781bb82 | generator:range_affine_queries:v0.1 |
9afd0afccb1b582a41f51f98 | [
{
"role": "user",
"content": "# Expanded interval union\n\nEach closed integer interval [l,r] is expanded to [l-6,r+6]. Print how many distinct integers belong to at least one expanded interval.\n\n## Input format\nThe first line contains n, followed by n lines l r.\n\n## Output format\nPrint one integer.\n... | # Expanded interval union
Each closed integer interval [l,r] is expanded to [l-6,r+6]. Print how many distinct integers belong to at least one expanded interval.
## Input format
The first line contains n, followed by n lines l r.
## Output format
Print one integer.
## Constraints
1 ≤ n ≤ 20; l ≤ r.
Example 1
Input... | {
"language": "python",
"test_cases": [
{
"input": "4\n0 2\n2 5\n10 10\n8 9\n",
"output": "23\n",
"type": "stdin_stdout"
},
{
"input": "9\n-7 6\n12 34\n-6 -1\n44 68\n18 42\n9 24\n-4 -3\n27 51\n42 67\n",
"output": "88\n",
"type": "stdin_stdout"
},
{
"inpu... | [{"input":"4\n0 2\n2 5\n10 10\n8 9\n","output":"23\n","type":"stdin_stdout"},{"input":"9\n-7 6\n12 34\n-6 -1\n44 68\n18 42\n9 24\n-4 -3\n27 51\n42 67\n","output":"88\n","type":"stdin_stdout"},{"input":"2\n0 25\n-16 -11\n","output":"54\n","type":"stdin_stdout"},{"input":"19\n47 67\n-46 -29\n-44 -37\n-27 -21\n1 17\n44 69... | [
{
"input": "1\n0 0\n",
"output": "13\n",
"type": "stdin_stdout"
},
{
"input": "19\n31 50\n15 30\n-47 -26\n4 27\n-10 3\n36 41\n-42 -35\n24 25\n17 29\n-45 -31\n3 22\n36 55\n-48 -28\n-21 -2\n36 51\n50 59\n-43 -29\n-36 -25\n-30 -29\n",
"output": "120\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=sorted((d[i]-6,d[i+1]+6) for i in range(1,2*n+1,2)); l,r=a[0]; ans=0
for x,y in a[1:]:
if x<=r+1:r=max(r,y)
else:ans+=r-l+1;l,r=x,y
print(ans+r-l+1)
| oellm-code-rlvr | train | python | en | 5 | challenge | interval_union_points | [
"sorting",
"intervals",
"sweep_line"
] | oellm-code-generators-0.1.0 | 2,947,592,954,873,016,300 | oellm-code-interval_union_points-000000000 | {"padding":6} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 3a1de0d20e6245fb802f505c4a1d9ff98af53109bc2cab28c11d2fea6e37cadd | 0458d120190cef584d40ef58999338a19febf00ae2636c20c03ab7c4a0939dfc | generator:interval_union_points:v0.1 |
0d2166a60c6c4d3597bde43d | [
{
"role": "user",
"content": "# Cyclic indexed string transform\n\nFor every character whose 1-indexed position is divisible by 4, shift it forward by 10 letters cyclically in the lowercase alphabet. Leave other characters unchanged. Reverse the entire resulting string.\n\n## Input format\nOne non-empty low... | # Cyclic indexed string transform
For every character whose 1-indexed position is divisible by 4, shift it forward by 10 letters cyclically in the lowercase alphabet. Leave other characters unchanged. Reverse the entire resulting string.
## Input format
One non-empty lowercase string.
## Output format
Print the tran... | {
"language": "python",
"test_cases": [
{
"input": "abcdefghijklmnopqrstuvwxyz\n",
"output": "zyhwvudsrqzonmvkjirgfencba\n",
"type": "stdin_stdout"
},
{
"input": "rqvkeumvhfvubxce\n",
"output": "ocxbevfhfmueuvqr\n",
"type": "stdin_stdout"
},
{
"input": "... | [{"input":"abcdefghijklmnopqrstuvwxyz\n","output":"zyhwvudsrqzonmvkjirgfencba\n","type":"stdin_stdout"},{"input":"rqvkeumvhfvubxce\n","output":"ocxbevfhfmueuvqr\n","type":"stdin_stdout"},{"input":"ctkanjrjohklwtvaerueppxgo\n","output":"oqxppourekvtwvkhotrjnkktc\n","type":"stdin_stdout"},{"input":"iuijbqhgakcaaub\n","ou... | [
{
"input": "a\n",
"output": "a\n",
"type": "stdin_stdout"
},
{
"input": "uekyhmeaniceuycvp\n",
"output": "pfcyuocinkemhikeu\n",
"type": "stdin_stdout"
}
] | import sys
s=sys.stdin.readline().strip(); a=[]
for i,c in enumerate(s,1): a.append(chr((ord(c)-97+10)%26+97) if i%4==0 else c)
r=''.join(a); print(r[::-1] if True else r)
| oellm-code-rlvr | train | python | en | 2 | basic | cyclic_string_transform | [
"strings",
"indexing",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 4,853,833,726,675,923,000 | oellm-code-cyclic_string_transform-000000000 | {"reverse":true,"shift":10,"step":4} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 2ed235c4140b693b4048290e86cb70544fcc778c8e8dadb205e5de9d04c9bb15 | 0745da62044f6b84d2d9adeba000aeba6a573415f7c3556e362b32708de3159f | generator:cyclic_string_transform:v0.1 |
99622119af6753432e916f94 | [
{
"role": "user",
"content": "# Overlapping shifted-pattern count\n\nShift every character of text forward by 18 letters cyclically, but do not change pattern. Count occurrences of pattern in the shifted text, including overlapping occurrences.\n\n## Input format\nTwo whitespace-separated lowercase strings:... | # Overlapping shifted-pattern count
Shift every character of text forward by 18 letters cyclically, but do not change pattern. Count occurrences of pattern in the shifted text, including overlapping occurrences.
## Input format
Two whitespace-separated lowercase strings: text and pattern.
## Output format
Print the ... | {
"language": "python",
"test_cases": [
{
"input": "abcabc abc\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "iiii aa\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "ijiji aba\n",
"output": "2\n",
"type": "stdin_stdout"... | [{"input":"abcabc abc\n","output":"0\n","type":"stdin_stdout"},{"input":"iiii aa\n","output":"3\n","type":"stdin_stdout"},{"input":"ijiji aba\n","output":"2\n","type":"stdin_stdout"},{"input":"ijkijk abc\n","output":"2\n","type":"stdin_stdout"},{"input":"bdcecebedbcbcdeb bacba\n","output":"0\n","type":"stdin_stdout"},{... | [
{
"input": "aaaa aa\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "bcebccdbacdeddccba cc\n",
"output": "0\n",
"type": "stdin_stdout"
}
] | import sys
s,p=sys.stdin.buffer.read().decode().split(); s=''.join(chr((ord(c)-97+18)%26+97) for c in s); ans=0; i=0
while True:
i=s.find(p,i)
if i<0:break
ans+=1;i+=1
print(ans)
| oellm-code-rlvr | train | python | en | 3 | intermediate | overlapping_pattern_count | [
"strings",
"pattern_matching",
"overlaps"
] | oellm-code-generators-0.1.0 | 6,229,394,751,442,723,000 | oellm-code-overlapping_pattern_count-000000000 | {"text_caesar_shift":18} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 13 | 1 | deterministic_procedural_generation | Apache-2.0 | 412a054a7c7f6fe1a351548e4eef86307c68463a0d2ef2f78123678bfa94b00c | 02bd13ddb9a135b07c2f41398ddb246c5386450e0f45c1599a90c7e456e650d1 | generator:overlapping_pattern_count:v0.1 |
5c46af203da6fea0a77bb9a8 | [
{
"role": "user",
"content": "# Grid neighbour threshold\n\nCount cells containing 'C' that have at least 2 other 'C' cells among their eight surrounding neighbours. A cell is not its own neighbour.\n\n## Input format\nh w followed by h equal-length rows using A, B, C, and dot.\n\n## Output format\nPrint th... | # Grid neighbour threshold
Count cells containing 'C' that have at least 2 other 'C' cells among their eight surrounding neighbours. A cell is not its own neighbour.
## Input format
h w followed by h equal-length rows using A, B, C, and dot.
## Output format
Print the count.
## Constraints
1 ≤ h,w ≤ 9.
Example 1
I... | {
"language": "python",
"test_cases": [
{
"input": "3 3\nCCC\nCAC\nCCC\n",
"output": "8\n",
"type": "stdin_stdout"
},
{
"input": "3 3\nC.C\n.C.\nC.C\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "3 3\nAAA\nACA\nAAA\n",
"output": "0\n",
... | [{"input":"3 3\nCCC\nCAC\nCCC\n","output":"8\n","type":"stdin_stdout"},{"input":"3 3\nC.C\n.C.\nC.C\n","output":"1\n","type":"stdin_stdout"},{"input":"3 3\nAAA\nACA\nAAA\n","output":"0\n","type":"stdin_stdout"},{"input":"5 9\nA.CAB.BCB\n.CCAACAC.\nBACBBC.BB\nBC.CCCAC.\nACAB.BB.C\n","output":"9\n","type":"stdin_stdout"}... | [
{
"input": "1 1\nC\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "8 4\nAABA\nB...\n.CCC\nAAA.\n.A.C\n.C.B\nBBB.\n.CAC\n",
"output": "1\n",
"type": "stdin_stdout"
}
] | import sys
a=sys.stdin.read().split();h=int(a[0]);w=int(a[1]);g=a[2:];D=[(-1,0),(1,0),(0,-1),(0,1)]+([(-1, -1), (-1, 1), (1, -1), (1, 1)]);z=0
for i in range(h):
for j in range(w):
if g[i][j]=='C' and sum(0<=i+x<h and 0<=j+y<w and g[i+x][j+y]=='C' for x,y in D)>=2:z+=1
print(z)
| oellm-code-rlvr | train | python | en | 3 | intermediate | grid_neighbor_count | [
"grids",
"neighbourhoods",
"counting"
] | oellm-code-generators-0.1.0 | 7,006,003,250,141,619,000 | oellm-code-grid_neighbor_count-000000000 | {"diagonal":true,"target":"C","threshold":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | 0112c66c3099d4a823ab248e464539933e42d90ee14158a0a740126620475d13 | 88ec08ea6ce682e463837c0a31a1a02c380bec1ca8cd9f50354c623a1e5d3365 | generator:grid_neighbor_count:v0.1 |
cfdc340c25288683cc7030c7 | [
{
"role": "user",
"content": "# Weighted grid path\n\nFind the minimum cost from S to G, moving in 8 directions. '#' is blocked. Entering digit d costs d; entering '.', 'S', or 'G' costs 1. Print -1 if G is unreachable.\n\n## Input format\nh w followed by h rows containing exactly one S and one G.\n\n## Out... | # Weighted grid path
Find the minimum cost from S to G, moving in 8 directions. '#' is blocked. Entering digit d costs d; entering '.', 'S', or 'G' costs 1. Print -1 if G is unreachable.
## Input format
h w followed by h rows containing exactly one S and one G.
## Output format
Print the minimum cost or -1.
## Cons... | {
"language": "python",
"test_cases": [
{
"input": "3 4\nS19G\n.##.\n....\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "2 2\nS#\n#G\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "1 4\nS99G\n",
"output": "19\n",
"type"... | [{"input":"3 4\nS19G\n.##.\n....\n","output":"5\n","type":"stdin_stdout"},{"input":"2 2\nS#\n#G\n","output":"1\n","type":"stdin_stdout"},{"input":"1 4\nS99G\n","output":"19\n","type":"stdin_stdout"},{"input":"3 4\nS..3\n.12#\n.#.G\n","output":"3\n","type":"stdin_stdout"},{"input":"2 2\nS.\n.G\n","output":"1\n","type":"... | [
{
"input": "1 2\nSG\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "5 3\nS..\n.#3\n#.1\n#3.\n#.G\n",
"output": "4\n",
"type": "stdin_stdout"
}
] | import sys,heapq
a=sys.stdin.read().split();h=int(a[0]);w=int(a[1]);g=a[2:];D=[(-1,0),(1,0),(0,-1),(0,1)]+([(-1, -1), (-1, 1), (1, -1), (1, 1)]);s=next((i,j) for i in range(h) for j in range(w) if g[i][j]=='S');t=next((i,j) for i in range(h) for j in range(w) if g[i][j]=='G');q=[(0,*s)];dist={s:0}
while q:
d,i,j=heapq... | oellm-code-rlvr | train | python | en | 2 | basic | weighted_grid_path | [
"graphs",
"dijkstra",
"grids",
"shortest_paths"
] | oellm-code-generators-0.1.0 | 6,939,307,400,327,034,000 | oellm-code-weighted_grid_path-000000000 | {"diagonal":true,"digit_cost":true} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | 17eda0fa571fa5f5f178dd646b7b61cef1702fc85b4c5d581f561f455f7cd9a3 | 9261f355670ed8256e2a2b2c570685cfe7cc5123e90c17df9216ddfcf935d11a | generator:weighted_grid_path:v0.1 |
40ca305367c70b054cbf88f6 | [
{
"role": "user",
"content": "# Constrained graph reachability\n\nStart at vertex 1 in an undirected graph. You may not enter any other vertex v with v mod 7 = 0. Count reachable vertices excluding vertex 1.\n\n## Input format\nn m followed by m undirected edges u v.\n\n## Output format\nPrint one integer.\... | # Constrained graph reachability
Start at vertex 1 in an undirected graph. You may not enter any other vertex v with v mod 7 = 0. Count reachable vertices excluding vertex 1.
## Input format
n m followed by m undirected edges u v.
## Output format
Print one integer.
## Constraints
1 ≤ n ≤ 16; no duplicate edges.
E... | {
"language": "python",
"test_cases": [
{
"input": "5 5\n1 2\n2 3\n3 4\n4 5\n1 5\n",
"output": "4\n",
"type": "stdin_stdout"
},
{
"input": "4 4\n1 2\n1 3\n2 3\n2 4\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "4 5\n1 2\n1 3\n1 4\n2 3\n3 4\n"... | [{"input":"5 5\n1 2\n2 3\n3 4\n4 5\n1 5\n","output":"4\n","type":"stdin_stdout"},{"input":"4 4\n1 2\n1 3\n2 3\n2 4\n","output":"3\n","type":"stdin_stdout"},{"input":"4 5\n1 2\n1 3\n1 4\n2 3\n3 4\n","output":"3\n","type":"stdin_stdout"},{"input":"2 1\n1 2\n","output":"1\n","type":"stdin_stdout"},{"input":"4 6\n1 2\n1 3\... | [
{
"input": "1 0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "5 7\n1 2\n1 4\n1 5\n2 3\n2 5\n3 5\n4 5\n",
"output": "4\n",
"type": "stdin_stdout"
}
] | import sys
from collections import deque
it=iter(map(int,sys.stdin.buffer.read().split()));n=next(it);m=next(it);g=[[] for _ in range(n+1)]
for _ in range(m):u=next(it);v=next(it);g[u].append(v);g[v].append(u)
s={1};q=deque([1])
while q:
u=q.popleft()
for v in g[u]:
if v not in s and v%7!=0:s.add(v);q.append(v)
pri... | oellm-code-rlvr | train | python | en | 2 | basic | constrained_reachability | [
"graphs",
"breadth_first_search",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 8,051,237,782,209,905,000 | oellm-code-constrained_reachability-000000000 | {"forbidden_modulus":7,"forbidden_residue":0} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 0.666667 | deterministic_procedural_generation | Apache-2.0 | 8af76eccf9e8a6ef8c0eca65350e51ccb699303786555b4927e4a314e1eca4f8 | f4aefacfae351e44d7870ab02ff47360b423b77d958a090dcabe2ac3b707b91c | generator:constrained_reachability:v0.1 |
97797dc746405a1341ead160 | [
{
"role": "user",
"content": "# Parameterized coin change\n\nUsing unlimited coins with values [1, 5], count unordered multisets whose sum is exactly n. Print the count modulo 101. The empty multiset is the unique way to form 0.\n\n## Input format\nOne integer n.\n\n## Output format\nPrint the number of uno... | # Parameterized coin change
Using unlimited coins with values [1, 5], count unordered multisets whose sum is exactly n. Print the count modulo 101. The empty multiset is the unique way to form 0.
## Input format
One integer n.
## Output format
Print the number of unordered combinations.
## Constraints
0 ≤ n ≤ 80.
... | {
"language": "python",
"test_cases": [
{
"input": "1\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "6\n",
"output": "2\n",
"type": "stdin_stdout"
},
{
"input": "140\n",
"output": "29\n",
"type": "stdin_stdout"
},
{
... | [{"input":"1\n","output":"1\n","type":"stdin_stdout"},{"input":"6\n","output":"2\n","type":"stdin_stdout"},{"input":"140\n","output":"29\n","type":"stdin_stdout"},{"input":"53\n","output":"11\n","type":"stdin_stdout"},{"input":"62\n","output":"13\n","type":"stdin_stdout"},{"input":"65\n","output":"14\n","type":"stdin_s... | [
{
"input": "0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "35\n",
"output": "8\n",
"type": "stdin_stdout"
}
] | import sys
n=int(sys.stdin.readline());d=[0]*(n+1);d[0]=1
for c in [1, 5]:
for x in range(c,n+1):d[x]=(d[x]+d[x-c])%101
print(d[n])
| oellm-code-rlvr | train | python | en | 2 | basic | coin_change | [
"dynamic_programming",
"combinatorics"
] | oellm-code-generators-0.1.0 | 500,605,074,814,489,800 | oellm-code-coin_change-000000000 | {"coins":[1,5],"modulus":101} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 11 | 0.666667 | deterministic_procedural_generation | Apache-2.0 | 035ae78f36b277450f6b90ae4b21b644f111a10a37fb9039b1b095e2a09570dc | f0346cc55270702dcf2db11972ac493ed729faa9c4affd69d9614fe38190c997 | generator:coin_change:v0.1 |
539d53ade6c697a0f5985a0f | [
{
"role": "user",
"content": "# Transformed longest subsequence\n\nTransform each x into (5x + 17) mod 69, preserving order. Print the length of the longest non-decreasing subsequence of the transformed sequence.\n\n## Input format\nn followed by n integers.\n\n## Output format\nPrint the subsequence length... | # Transformed longest subsequence
Transform each x into (5x + 17) mod 69, preserving order. Print the length of the longest non-decreasing subsequence of the transformed sequence.
## Input format
n followed by n integers.
## Output format
Print the subsequence length.
## Constraints
1 ≤ n ≤ 34.
Example 1
Input:
1
... | {
"language": "python",
"test_cases": [
{
"input": "7\n3 1 2 2 5 4 6\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "33\n-7 -82 75 98 50 -66 -78 -96 9 43 52 -80 23 -30 -68 -2 -72 -45 99 -62 99 13 -67 62 31 -14 1 17 -83 -50 49 -100 -65\n",
"output": "9\n",
"... | [{"input":"7\n3 1 2 2 5 4 6\n","output":"5\n","type":"stdin_stdout"},{"input":"33\n-7 -82 75 98 50 -66 -78 -96 9 43 52 -80 23 -30 -68 -2 -72 -45 99 -62 99 13 -67 62 31 -14 1 17 -83 -50 49 -100 -65\n","output":"9\n","type":"stdin_stdout"},{"input":"11\n0 -99 -75 -93 36 -35 79 -89 0 13 -55\n","output":"4\n","type":"stdin... | [
{
"input": "1\n0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "4\n7 -63 -56 -92\n",
"output": "2\n",
"type": "stdin_stdout"
}
] | import sys,bisect
d=list(map(int,sys.stdin.buffer.read().split()));t=[]
for x in d[1:1+d[0]]:
x=(5*x+17)%69;i=bisect.bisect_right(t,x)
if i==len(t):t.append(x)
else:t[i]=x
print(len(t))
| oellm-code-rlvr | train | python | en | 2 | basic | transformed_lis | [
"binary_search",
"longest_increasing_subsequence",
"dynamic_programming"
] | oellm-code-generators-0.1.0 | 7,935,711,922,198,773,000 | oellm-code-transformed_lis-000000000 | {"a":5,"b":17,"modulus":69,"subsequence":"non-decreasing"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | ae98a37b762f8cf824e885d540bc716bcca8a27547e4ce4bd7e7702edc316328 | 43a30ed8fe311f3ec7e8f83288293dadf770a798e8c49f0955f6020909ff9ea1 | generator:transformed_lis:v0.1 |
ac690e724aab4d7fecb5fc5d | [
{
"role": "user",
"content": "# Filtered affine sum\n\nKeep every array value x satisfying x mod 7 = 0. Replace each kept value by 9x + (-14), sum the results, and reduce the sum modulo 1000000007. Python-style non-negative remainders are used.\n\n## Input format\nThe first line contains n. The second conta... | # Filtered affine sum
Keep every array value x satisfying x mod 7 = 0. Replace each kept value by 9x + (-14), sum the results, and reduce the sum modulo 1000000007. Python-style non-negative remainders are used.
## Input format
The first line contains n. The second contains n integers.
## Output format
Print one int... | {
"language": "python",
"test_cases": [
{
"input": "6\n-7 0 1 7 14 21\n",
"output": "245\n",
"type": "stdin_stdout"
},
{
"input": "23\n-821 110 -742 -193 -992 -637 -253 890 -491 -736 535 725 684 228 816 415 28 -18 372 421 838 -534 -929\n",
"output": "999987806\n",
"ty... | [{"input":"6\n-7 0 1 7 14 21\n","output":"245\n","type":"stdin_stdout"},{"input":"23\n-821 110 -742 -193 -992 -637 -253 890 -491 -736 535 725 684 228 816 415 28 -18 372 421 838 -534 -929\n","output":"999987806\n","type":"stdin_stdout"},{"input":"23\n497 337 -53 478 -118 164 994 185 818 -531 -158 239 874 428 370 776 730... | [
{
"input": "1\n0\n",
"output": "999999993\n",
"type": "stdin_stdout"
},
{
"input": "18\n638 743 500 -427 -494 -483 -307 14 575 -672 -649 21 -899 279 -558 698 -938 -299\n",
"output": "999977558\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]
print(sum(9*x+(-14) for x in d[1:1+n] if x%7==0)%1000000007)
| oellm-code-rlvr | train | python | en | 2 | basic | filtered_affine_sum | [
"arrays",
"filtering",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 2,369,878,311,915,743,000 | oellm-code-filtered_affine_sum-000000001 | {"a":9,"b":-14,"divisor":7,"modulus":1000000007,"residue":0} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 381ffea6b00c5cab00a85956cf730d1ccf79e9d7af6eec429f5e16da5b576280 | 8eb287772c237163420206935befdfaccffb6292abc0c8350afe8cc49a8ec82a | generator:filtered_affine_sum:v0.1 |
e5da1f4ddab4b612e8a83476 | [
{
"role": "user",
"content": "# Fixed-window extreme\n\nTransform each x into 3x + (1). Among all contiguous windows of exactly 4 transformed values, find the maximum window sum.\n\n## Input format\nThe first line contains n. The second contains n integers.\n\n## Output format\nPrint the requested window su... | # Fixed-window extreme
Transform each x into 3x + (1). Among all contiguous windows of exactly 4 transformed values, find the maximum window sum.
## Input format
The first line contains n. The second contains n integers.
## Output format
Print the requested window sum.
## Constraints
4 ≤ n ≤ 42.
Example 1
Input:
4... | {
"language": "python",
"test_cases": [
{
"input": "6\n-1 0 1 2 3 4\n",
"output": "34\n",
"type": "stdin_stdout"
},
{
"input": "5\n180 -168 178 241 -291\n",
"output": "1297\n",
"type": "stdin_stdout"
},
{
"input": "12\n74 -116 -89 91 33 133 74 250 -124 4... | [{"input":"6\n-1 0 1 2 3 4\n","output":"34\n","type":"stdin_stdout"},{"input":"5\n180 -168 178 241 -291\n","output":"1297\n","type":"stdin_stdout"},{"input":"12\n74 -116 -89 91 33 133 74 250 -124 49 89 187\n","output":"1474\n","type":"stdin_stdout"},{"input":"17\n177 -151 17 -265 288 -140 -50 -240 -297 5 79 -7 -266 -6 ... | [
{
"input": "4\n0 0 0 0\n",
"output": "4\n",
"type": "stdin_stdout"
},
{
"input": "29\n-153 -212 219 176 -19 189 -72 -135 129 138 -41 249 -35 284 -78 -238 -265 -99 -206 -162 43 99 -129 -271 174 23 -86 -177 -297\n",
"output": "1699\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=[3*x+(1) for x in d[1:1+n]]; k=4
s=sum(a[:k]); best=s
for i in range(k,n):
s+=a[i]-a[i-k]; best=max(best,s)
print(best)
| oellm-code-rlvr | train | python | en | 3 | intermediate | window_extreme | [
"arrays",
"sliding_window"
] | oellm-code-generators-0.1.0 | 3,261,440,143,425,193,000 | oellm-code-window_extreme-000000001 | {"extreme":"maximum","offset":1,"scale":3,"window":4} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 4671eb518fc74de37ec4a701a26793767c36a324f7ea1a98fc7124b8ed733e81 | d375faa19485e6af1f4d927b63fefdd78c43954bc36a613acb7b2e1b4b2ef0e5 | generator:window_extreme:v0.1 |
6deeb94d18c41d55cce722d4 | [
{
"role": "user",
"content": "# Ranked frequency\n\nOrder distinct values by decreasing frequency. Ties are resolved by choosing the larger value first. Print the value at rank 2; if fewer than 2 distinct values exist, print the last value in this ordering.\n\n## Input format\nThe first line contains n. The... | # Ranked frequency
Order distinct values by decreasing frequency. Ties are resolved by choosing the larger value first. Print the value at rank 2; if fewer than 2 distinct values exist, print the last value in this ordering.
## Input format
The first line contains n. The second contains n integers.
## Output format
... | {
"language": "python",
"test_cases": [
{
"input": "8\n-2 -2 -2 5 5 7 8 9\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "14\n40 11 40 40 11 40 -49 40 11 11 48 -49 48 48\n",
"output": "11\n",
"type": "stdin_stdout"
},
{
"input": "31\n4 40 -18 ... | [{"input":"8\n-2 -2 -2 5 5 7 8 9\n","output":"5\n","type":"stdin_stdout"},{"input":"14\n40 11 40 40 11 40 -49 40 11 11 48 -49 48 48\n","output":"11\n","type":"stdin_stdout"},{"input":"31\n4 40 -18 40 -18 -13 40 40 -18 -24 -26 -20 -18 4 40 -13 40 -20 28 -26 -24 4 -18 28 -18 -24 -18 -20 -18 40 40\n","output":"-18\n","typ... | [
{
"input": "7\n1 1 2 2 3 3 4\n",
"output": "2\n",
"type": "stdin_stdout"
},
{
"input": "30\n-2 47 47 -27 -36 -36 47 -2 -27 -36 -27 -2 9 -36 47 9 9 9 -2 47 -36 9 -43 -2 9 -36 -27 -36 -36 47\n",
"output": "47\n",
"type": "stdin_stdout"
}
] | import sys
from collections import Counter
d=list(map(int,sys.stdin.buffer.read().split())); c=Counter(d[1:1+d[0]])
a=sorted(c,key=lambda x:(-c[x], -x))
print(a[min(2-1,len(a)-1)])
| oellm-code-rlvr | train | python | en | 4 | advanced | frequency_rank | [
"hash_maps",
"sorting",
"frequency_counting"
] | oellm-code-generators-0.1.0 | 4,024,411,803,590,990,300 | oellm-code-frequency_rank-000000001 | {"rank":2,"tie_break":"larger"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 73b9df3dce6a987727ef1605cb3f3a2548c09610f36728822d4b9c0c4b9f1267 | 8a8d27c9e9e278dcb347f27726c3bc10dc3f536b8fe099c7b3d3e8f907dc5a9a | generator:frequency_rank:v0.1 |
9f982f0b06eb9864b65845f1 | [
{
"role": "user",
"content": "# Affine range queries\n\nTransform every array value x to -7x + (7). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 97.\n\n## Input format\nn q, then n integers, then q lines l r.\n\n## Output format\nPrint one answer per query.\n\n## Constraints\n1... | # Affine range queries
Transform every array value x to -7x + (7). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 97.
## Input format
n q, then n integers, then q lines l r.
## Output format
Print one answer per query.
## Constraints
1 ≤ n ≤ 52; 1 ≤ q ≤ 16.
Example 1
Input:
1 2
0
1 1
1 ... | {
"language": "python",
"test_cases": [
{
"input": "5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n",
"output": "35\n21\n7\n",
"type": "stdin_stdout"
},
{
"input": "44 3\n15 -58 79 -48 26 -94 28 -90 -51 -2 100 69 9 -26 83 67 -74 -81 94 -21 -32 81 50 19 -14 -8 -90 -82 -55 72 -71 -87 35 -81 -28 ... | [{"input":"5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n","output":"35\n21\n7\n","type":"stdin_stdout"},{"input":"44 3\n15 -58 79 -48 26 -94 28 -90 -51 -2 100 69 9 -26 83 67 -74 -81 94 -21 -32 81 50 19 -14 -8 -90 -82 -55 72 -71 -87 35 -81 -28 81 -32 -76 -80 -62 -17 -70 -82 54\n30 32\n15 33\n29 44\n","output":"41\n58\n16\n","type":... | [
{
"input": "1 2\n0\n1 1\n1 1\n",
"output": "7\n7\n",
"type": "stdin_stdout"
},
{
"input": "29 4\n-98 48 10 66 -14 81 89 -100 66 -10 59 46 -51 59 -79 77 21 -57 -4 -98 48 -74 95 13 -8 73 -7 -73 33\n20 20\n29 29\n16 25\n4 18\n",
"output": "14\n67\n76\n80\n",
"type": "stdin_stdout"
}
] | import sys
it=iter(map(int,sys.stdin.buffer.read().split())); n=next(it); q=next(it); p=[0]
for _ in range(n): p.append(p[-1]+-7*next(it)+(7))
for _ in range(q):
l=next(it); r=next(it); print((p[r]-p[l-1])%97)
| oellm-code-rlvr | train | python | en | 4 | advanced | range_affine_queries | [
"prefix_sums",
"range_queries",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 3,902,711,805,449,618,400 | oellm-code-range_affine_queries-000000001 | {"a":-7,"b":7,"modulus":97} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 1c4e1615aa1753b0a584e30096c47aeed0724251635f79be137a3f368e755431 | 6d9a2f30811d733364d40b41f75566d9c3f153185b4cfe7d31ab0b08ec741432 | generator:range_affine_queries:v0.1 |
faad9dd13151e7edeedf4387 | [
{
"role": "user",
"content": "# Expanded interval union\n\nEach closed integer interval [l,r] is expanded to [l-4,r+4]. Print how many distinct integers belong to at least one expanded interval.\n\n## Input format\nThe first line contains n, followed by n lines l r.\n\n## Output format\nPrint one integer.\n... | # Expanded interval union
Each closed integer interval [l,r] is expanded to [l-4,r+4]. Print how many distinct integers belong to at least one expanded interval.
## Input format
The first line contains n, followed by n lines l r.
## Output format
Print one integer.
## Constraints
1 ≤ n ≤ 11; l ≤ r.
Example 1
Input... | {
"language": "python",
"test_cases": [
{
"input": "4\n0 2\n2 5\n10 10\n8 9\n",
"output": "19\n",
"type": "stdin_stdout"
},
{
"input": "4\n36 44\n-12 -4\n-32 -19\n17 27\n",
"output": "73\n",
"type": "stdin_stdout"
},
{
"input": "5\n-46 -35\n34 43\n-42 -3... | [{"input":"4\n0 2\n2 5\n10 10\n8 9\n","output":"19\n","type":"stdin_stdout"},{"input":"4\n36 44\n-12 -4\n-32 -19\n17 27\n","output":"73\n","type":"stdin_stdout"},{"input":"5\n-46 -35\n34 43\n-42 -33\n-47 -47\n-46 -43\n","output":"41\n","type":"stdin_stdout"},{"input":"8\n-39 -29\n-41 -41\n-34 -26\n-5 -1\n33 35\n-9 -8\n... | [
{
"input": "1\n0 0\n",
"output": "9\n",
"type": "stdin_stdout"
},
{
"input": "3\n43 50\n-28 -24\n-13 -2\n",
"output": "49\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=sorted((d[i]-4,d[i+1]+4) for i in range(1,2*n+1,2)); l,r=a[0]; ans=0
for x,y in a[1:]:
if x<=r+1:r=max(r,y)
else:ans+=r-l+1;l,r=x,y
print(ans+r-l+1)
| oellm-code-rlvr | train | python | en | 2 | basic | interval_union_points | [
"sorting",
"intervals",
"sweep_line"
] | oellm-code-generators-0.1.0 | 8,246,101,529,790,920,000 | oellm-code-interval_union_points-000000001 | {"padding":4} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 7411df996a8d147c542e7eddebb2a728a618e676d3d58e0d10cb0bacf566c147 | f528aca47854ad18c9102abe494e5ec93a104c93b849d703479cdc2798ef89db | generator:interval_union_points:v0.1 |
b99aeb957d105fc857a420b8 | [
{
"role": "user",
"content": "# Cyclic indexed string transform\n\nFor every character whose 1-indexed position is divisible by 5, shift it forward by 4 letters cyclically in the lowercase alphabet. Leave other characters unchanged. Reverse the entire resulting string.\n\n## Input format\nOne non-empty lowe... | # Cyclic indexed string transform
For every character whose 1-indexed position is divisible by 5, shift it forward by 4 letters cyclically in the lowercase alphabet. Leave other characters unchanged. Reverse the entire resulting string.
## Input format
One non-empty lowercase string.
## Output format
Print the trans... | {
"language": "python",
"test_cases": [
{
"input": "abcdefghijklmnopqrstuvwxyz\n",
"output": "zcxwvuxsrqpsnmlknihgfidcba\n",
"type": "stdin_stdout"
},
{
"input": "zlxzxdhrdqnemitldylb\n",
"output": "flydlximenudrhdbzxlz\n",
"type": "stdin_stdout"
},
{
"i... | [{"input":"abcdefghijklmnopqrstuvwxyz\n","output":"zcxwvuxsrqpsnmlknihgfidcba\n","type":"stdin_stdout"},{"input":"zlxzxdhrdqnemitldylb\n","output":"flydlximenudrhdbzxlz\n","type":"stdin_stdout"},{"input":"ttnhjjbfnrzlssjwyrbuuxzxoyngccsxciansumnziypipvq\n","output":"qvpmpyizrmusneicxsgcgnysxzxuybrywnsslzvnfbjnhntt\n","... | [
{
"input": "a\n",
"output": "a\n",
"type": "stdin_stdout"
},
{
"input": "ggzgubrdvybrvzwwfzsxrifmpuphin\n",
"output": "rihputmfirbszfwazvrbcvdrbygzgg\n",
"type": "stdin_stdout"
}
] | import sys
s=sys.stdin.readline().strip(); a=[]
for i,c in enumerate(s,1): a.append(chr((ord(c)-97+4)%26+97) if i%5==0 else c)
r=''.join(a); print(r[::-1] if True else r)
| oellm-code-rlvr | train | python | en | 3 | intermediate | cyclic_string_transform | [
"strings",
"indexing",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 6,723,336,173,629,573,000 | oellm-code-cyclic_string_transform-000000001 | {"reverse":true,"shift":4,"step":5} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 1e1ae9e36cbdf2f13aa5360a33f5f3f58ed032f6c85c37e00079888e55dba1bc | e783320f2ff71a3de744b9934cc80ad04ff784988654ea2546594dc32ac11791 | generator:cyclic_string_transform:v0.1 |
73decae2e8778eb13248c838 | [
{
"role": "user",
"content": "# Overlapping shifted-pattern count\n\nShift every character of text forward by 7 letters cyclically, but do not change pattern. Count occurrences of pattern in the shifted text, including overlapping occurrences.\n\n## Input format\nTwo whitespace-separated lowercase strings: ... | # Overlapping shifted-pattern count
Shift every character of text forward by 7 letters cyclically, but do not change pattern. Count occurrences of pattern in the shifted text, including overlapping occurrences.
## Input format
Two whitespace-separated lowercase strings: text and pattern.
## Output format
Print the o... | {
"language": "python",
"test_cases": [
{
"input": "abcabc abc\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "tttt aa\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "tutut aba\n",
"output": "2\n",
"type": "stdin_stdout"... | [{"input":"abcabc abc\n","output":"0\n","type":"stdin_stdout"},{"input":"tttt aa\n","output":"3\n","type":"stdin_stdout"},{"input":"tutut aba\n","output":"2\n","type":"stdin_stdout"},{"input":"tuvtuv abc\n","output":"2\n","type":"stdin_stdout"},{"input":"beeaddebebbbbecbdeb eb\n","output":"0\n","type":"stdin_stdout"},{... | [
{
"input": "aaaa aa\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "cdbcedadbe d\n",
"output": "0\n",
"type": "stdin_stdout"
}
] | import sys
s,p=sys.stdin.buffer.read().decode().split(); s=''.join(chr((ord(c)-97+7)%26+97) for c in s); ans=0; i=0
while True:
i=s.find(p,i)
if i<0:break
ans+=1;i+=1
print(ans)
| oellm-code-rlvr | train | python | en | 2 | basic | overlapping_pattern_count | [
"strings",
"pattern_matching",
"overlaps"
] | oellm-code-generators-0.1.0 | 7,897,893,590,799,804,000 | oellm-code-overlapping_pattern_count-000000001 | {"text_caesar_shift":7} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 13 | 1 | deterministic_procedural_generation | Apache-2.0 | aa6b66e5275c555b8d90c5ed94c2ebbf7e176c29eb9d22f7692ddcac8130f6ef | 960ce2a13c97c5f5e531dbaca2c4083017f636ec379d63cf93311fa3ab7a1b32 | generator:overlapping_pattern_count:v0.1 |
bc9131f5fa27b91420e4d55b | [
{
"role": "user",
"content": "# Grid neighbour threshold\n\nCount cells containing 'C' that have at least 1 other 'C' cells among their eight surrounding neighbours. A cell is not its own neighbour.\n\n## Input format\nh w followed by h equal-length rows using A, B, C, and dot.\n\n## Output format\nPrint th... | # Grid neighbour threshold
Count cells containing 'C' that have at least 1 other 'C' cells among their eight surrounding neighbours. A cell is not its own neighbour.
## Input format
h w followed by h equal-length rows using A, B, C, and dot.
## Output format
Print the count.
## Constraints
1 ≤ h,w ≤ 5.
Example 1
I... | {
"language": "python",
"test_cases": [
{
"input": "3 3\nCCC\nCAC\nCCC\n",
"output": "8\n",
"type": "stdin_stdout"
},
{
"input": "3 3\nC.C\n.C.\nC.C\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "3 3\nAAA\nACA\nAAA\n",
"output": "0\n",
... | [{"input":"3 3\nCCC\nCAC\nCCC\n","output":"8\n","type":"stdin_stdout"},{"input":"3 3\nC.C\n.C.\nC.C\n","output":"5\n","type":"stdin_stdout"},{"input":"3 3\nAAA\nACA\nAAA\n","output":"0\n","type":"stdin_stdout"},{"input":"5 3\n.B.\nABA\nA.A\nABA\nBBB\n","output":"0\n","type":"stdin_stdout"},{"input":"3 2\nBA\nA.\nAA\n",... | [
{
"input": "1 1\nC\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "2 3\n...\n..B\n",
"output": "0\n",
"type": "stdin_stdout"
}
] | import sys
a=sys.stdin.read().split();h=int(a[0]);w=int(a[1]);g=a[2:];D=[(-1,0),(1,0),(0,-1),(0,1)]+([(-1, -1), (-1, 1), (1, -1), (1, 1)]);z=0
for i in range(h):
for j in range(w):
if g[i][j]=='C' and sum(0<=i+x<h and 0<=j+y<w and g[i+x][j+y]=='C' for x,y in D)>=1:z+=1
print(z)
| oellm-code-rlvr | train | python | en | 1 | introductory | grid_neighbor_count | [
"grids",
"neighbourhoods",
"counting"
] | oellm-code-generators-0.1.0 | 5,635,678,740,966,774,000 | oellm-code-grid_neighbor_count-000000001 | {"diagonal":true,"target":"C","threshold":1} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | 785dadbb9b7fd98040736c5dce3485b712d8b7595bfdf268d156b14c81ec452d | 2170ff9c769ce549eb815e2ec377ecbace4a982b60e72b102ced147a526d58ea | generator:grid_neighbor_count:v0.1 |
27667aca9ec03f796e08f9dc | [
{
"role": "user",
"content": "# Weighted grid path\n\nFind the minimum cost from S to G, moving in 4 orthogonal directions. '#' is blocked. Entering digit d costs d; entering '.', 'S', or 'G' costs 1. Print -1 if G is unreachable.\n\n## Input format\nh w followed by h rows containing exactly one S and one G... | # Weighted grid path
Find the minimum cost from S to G, moving in 4 orthogonal directions. '#' is blocked. Entering digit d costs d; entering '.', 'S', or 'G' costs 1. Print -1 if G is unreachable.
## Input format
h w followed by h rows containing exactly one S and one G.
## Output format
Print the minimum cost or -... | {
"language": "python",
"test_cases": [
{
"input": "3 4\nS19G\n.##.\n....\n",
"output": "7\n",
"type": "stdin_stdout"
},
{
"input": "2 2\nS#\n#G\n",
"output": "-1\n",
"type": "stdin_stdout"
},
{
"input": "1 4\nS99G\n",
"output": "19\n",
"type... | [{"input":"3 4\nS19G\n.##.\n....\n","output":"7\n","type":"stdin_stdout"},{"input":"2 2\nS#\n#G\n","output":"-1\n","type":"stdin_stdout"},{"input":"1 4\nS99G\n","output":"19\n","type":"stdin_stdout"},{"input":"2 2\nS.\n.G\n","output":"2\n","type":"stdin_stdout"},{"input":"2 4\nS..2\n33.G\n","output":"4\n","type":"stdin... | [
{
"input": "1 2\nSG\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "2 3\nS..\n..G\n",
"output": "3\n",
"type": "stdin_stdout"
}
] | import sys,heapq
a=sys.stdin.read().split();h=int(a[0]);w=int(a[1]);g=a[2:];D=[(-1,0),(1,0),(0,-1),(0,1)]+([]);s=next((i,j) for i in range(h) for j in range(w) if g[i][j]=='S');t=next((i,j) for i in range(h) for j in range(w) if g[i][j]=='G');q=[(0,*s)];dist={s:0}
while q:
d,i,j=heapq.heappop(q)
if d!=dist[i,j]:conti... | oellm-code-rlvr | train | python | en | 2 | basic | weighted_grid_path | [
"graphs",
"dijkstra",
"grids",
"shortest_paths"
] | oellm-code-generators-0.1.0 | 6,421,272,158,915,394,000 | oellm-code-weighted_grid_path-000000001 | {"diagonal":false,"digit_cost":true} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | 3dfb81630aa92042ccd55a5f681ffcd6169f9f41b329adb5409a9e276f570a21 | 84fd160695f037c91b411ccc59ce3e2f0ed55469cb717f84f8ece0567f2b46b1 | generator:weighted_grid_path:v0.1 |
0ec60fa7bac557d0acd62436 | [
{
"role": "user",
"content": "# Parameterized coin change\n\nUsing unlimited coins with values [1, 3, 14], count unordered multisets whose sum is exactly n. Print the count modulo 101. The empty multiset is the unique way to form 0.\n\n## Input format\nOne integer n.\n\n## Output format\nPrint the number of... | # Parameterized coin change
Using unlimited coins with values [1, 3, 14], count unordered multisets whose sum is exactly n. Print the count modulo 101. The empty multiset is the unique way to form 0.
## Input format
One integer n.
## Output format
Print the number of unordered combinations.
## Constraints
0 ≤ n ≤ 1... | {
"language": "python",
"test_cases": [
{
"input": "1\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "18\n",
"output": "9\n",
"type": "stdin_stdout"
},
{
"input": "180\n",
"output": "21\n",
"type": "stdin_stdout"
},
{
... | [{"input":"1\n","output":"1\n","type":"stdin_stdout"},{"input":"18\n","output":"9\n","type":"stdin_stdout"},{"input":"180\n","output":"21\n","type":"stdin_stdout"},{"input":"44\n","output":"33\n","type":"stdin_stdout"},{"input":"62\n","output":"60\n","type":"stdin_stdout"},{"input":"94\n","output":"25\n","type":"stdin_... | [
{
"input": "0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "112\n",
"output": "73\n",
"type": "stdin_stdout"
}
] | import sys
n=int(sys.stdin.readline());d=[0]*(n+1);d[0]=1
for c in [1, 3, 14]:
for x in range(c,n+1):d[x]=(d[x]+d[x-c])%101
print(d[n])
| oellm-code-rlvr | train | python | en | 4 | advanced | coin_change | [
"dynamic_programming",
"combinatorics"
] | oellm-code-generators-0.1.0 | 3,179,542,074,137,006,600 | oellm-code-coin_change-000000001 | {"coins":[1,3,14],"modulus":101} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 11 | 1 | deterministic_procedural_generation | Apache-2.0 | 472d68d4e639d1a2aa57dbd559a4efe17cbbc30e6ecf0cc306bf1704ada6cf53 | 5e5eb22e8b8dc8da7960b59a1feeda9244f82ae2540bdabaccc40ab9fb132b70 | generator:coin_change:v0.1 |
3c08bf9c3477b1fe999670a8 | [
{
"role": "user",
"content": "# Transformed longest subsequence\n\nTransform each x into (4x + 14) mod 55, preserving order. Print the length of the longest strictly increasing subsequence of the transformed sequence.\n\n## Input format\nn followed by n integers.\n\n## Output format\nPrint the subsequence l... | # Transformed longest subsequence
Transform each x into (4x + 14) mod 55, preserving order. Print the length of the longest strictly increasing subsequence of the transformed sequence.
## Input format
n followed by n integers.
## Output format
Print the subsequence length.
## Constraints
1 ≤ n ≤ 34.
Example 1
Inpu... | {
"language": "python",
"test_cases": [
{
"input": "7\n3 1 2 2 5 4 6\n",
"output": "4\n",
"type": "stdin_stdout"
},
{
"input": "27\n-74 70 3 57 -18 91 -47 -20 -26 -78 87 29 97 56 -33 3 44 -24 -43 10 52 -28 69 73 -22 -21 3\n",
"output": "7\n",
"type": "stdin_stdout"
... | [{"input":"7\n3 1 2 2 5 4 6\n","output":"4\n","type":"stdin_stdout"},{"input":"27\n-74 70 3 57 -18 91 -47 -20 -26 -78 87 29 97 56 -33 3 44 -24 -43 10 52 -28 69 73 -22 -21 3\n","output":"7\n","type":"stdin_stdout"},{"input":"8\n51 -88 75 -63 90 -4 6 -71\n","output":"3\n","type":"stdin_stdout"},{"input":"5\n37 8 -46 100 ... | [
{
"input": "1\n0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "11\n-11 81 -5 -26 24 81 48 44 68 -100 -79\n",
"output": "4\n",
"type": "stdin_stdout"
}
] | import sys,bisect
d=list(map(int,sys.stdin.buffer.read().split()));t=[]
for x in d[1:1+d[0]]:
x=(4*x+14)%55;i=bisect.bisect_left(t,x)
if i==len(t):t.append(x)
else:t[i]=x
print(len(t))
| oellm-code-rlvr | train | python | en | 2 | basic | transformed_lis | [
"binary_search",
"longest_increasing_subsequence",
"dynamic_programming"
] | oellm-code-generators-0.1.0 | 7,863,104,664,008,950,000 | oellm-code-transformed_lis-000000001 | {"a":4,"b":14,"modulus":55,"subsequence":"strictly increasing"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | b0369640417eb0ef1265fdf16cdeac84f47b0825d8f1a36727bec3455b814acf | 59e9e77f51d48169e464ba19a0679da771002a7fb04bb1342e5b086d01bd8f95 | generator:transformed_lis:v0.1 |
1e88d8151ce043bbf9ed1f77 | [
{
"role": "user",
"content": "# Filtered affine sum\n\nKeep every array value x satisfying x mod 7 = 3. Replace each kept value by -1x + (15), sum the results, and reduce the sum modulo 10007. Python-style non-negative remainders are used.\n\n## Input format\nThe first line contains n. The second contains n... | # Filtered affine sum
Keep every array value x satisfying x mod 7 = 3. Replace each kept value by -1x + (15), sum the results, and reduce the sum modulo 10007. Python-style non-negative remainders are used.
## Input format
The first line contains n. The second contains n integers.
## Output format
Print one integer.... | {
"language": "python",
"test_cases": [
{
"input": "6\n-7 0 1 7 14 21\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "35\n53671 -59447 49329 -95661 -67932 -25925 70639 73757 -20575 -97167 -25 -74006 30626 -6045 -86984 -59436 -12306 -35504 -15145 -7804 -46527 -8635 -397... | [{"input":"6\n-7 0 1 7 14 21\n","output":"0\n","type":"stdin_stdout"},{"input":"35\n53671 -59447 49329 -95661 -67932 -25925 70639 73757 -20575 -97167 -25 -74006 30626 -6045 -86984 -59436 -12306 -35504 -15145 -7804 -46527 -8635 -39732 -52892 -37618 73242 -82897 46609 66862 -74522 -41810 -37320 -66584 92786 -50001\n","ou... | [
{
"input": "1\n0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "9\n-84537 30589 -32879 -98932 -11 31267 27448 19982 -46907\n",
"output": "26\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]
print(sum(-1*x+(15) for x in d[1:1+n] if x%7==3)%10007)
| oellm-code-rlvr | train | python | en | 4 | advanced | filtered_affine_sum | [
"arrays",
"filtering",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 7,054,696,809,592,918,000 | oellm-code-filtered_affine_sum-000000002 | {"a":-1,"b":15,"divisor":7,"modulus":10007,"residue":3} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | a7cc0c15e9c4f1dc4b841eb94cc53d33184bbe472f23a027170f94fb3a25e0a3 | d3ab4b238850b89cb8a1665fe94f7f1cfee70852836006b1c55bfe3b595c3301 | generator:filtered_affine_sum:v0.1 |
3a08122c7ddd45e6916a6b52 | [
{
"role": "user",
"content": "# Fixed-window extreme\n\nTransform each x into 2x + (3). Among all contiguous windows of exactly 4 transformed values, find the minimum window sum.\n\n## Input format\nThe first line contains n. The second contains n integers.\n\n## Output format\nPrint the requested window su... | # Fixed-window extreme
Transform each x into 2x + (3). Among all contiguous windows of exactly 4 transformed values, find the minimum window sum.
## Input format
The first line contains n. The second contains n integers.
## Output format
Print the requested window sum.
## Constraints
4 ≤ n ≤ 42.
Example 1
Input:
4... | {
"language": "python",
"test_cases": [
{
"input": "6\n-1 0 1 2 3 4\n",
"output": "16\n",
"type": "stdin_stdout"
},
{
"input": "23\n-206 -291 245 -21 -143 -221 240 115 71 114 -109 200 -53 -281 206 6 35 -94 40 -297 -43 -184 153\n",
"output": "-956\n",
"type": "stdin_st... | [{"input":"6\n-1 0 1 2 3 4\n","output":"16\n","type":"stdin_stdout"},{"input":"23\n-206 -291 245 -21 -143 -221 240 115 71 114 -109 200 -53 -281 206 6 35 -94 40 -297 -43 -184 153\n","output":"-956\n","type":"stdin_stdout"},{"input":"28\n29 -117 -90 216 -22 214 -99 34 -111 -70 85 258 -79 299 -64 -281 -174 -47 -251 -192 2... | [
{
"input": "4\n0 0 0 0\n",
"output": "12\n",
"type": "stdin_stdout"
},
{
"input": "21\n62 15 -189 62 -7 -158 91 199 -102 -154 68 151 80 146 62 -238 292 -179 -52 -276 -222\n",
"output": "-1446\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=[2*x+(3) for x in d[1:1+n]]; k=4
s=sum(a[:k]); best=s
for i in range(k,n):
s+=a[i]-a[i-k]; best=min(best,s)
print(best)
| oellm-code-rlvr | train | python | en | 3 | intermediate | window_extreme | [
"arrays",
"sliding_window"
] | oellm-code-generators-0.1.0 | 8,611,883,564,265,252,000 | oellm-code-window_extreme-000000002 | {"extreme":"minimum","offset":3,"scale":2,"window":4} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 1bf8c058c11cc92aa3bca454c1349635e55be4618b17bd36fe0b9c2d057eead5 | b5eb3884c7aa3c38dd0f6686e60397bbc4c678c043c5a4e3d7beb6982bf7d482 | generator:window_extreme:v0.1 |
82c063a2da621cf7cd71ba1b | [
{
"role": "user",
"content": "# Ranked frequency\n\nOrder distinct values by decreasing frequency. Ties are resolved by choosing the larger value first. Print the value at rank 2; if fewer than 2 distinct values exist, print the last value in this ordering.\n\n## Input format\nThe first line contains n. The... | # Ranked frequency
Order distinct values by decreasing frequency. Ties are resolved by choosing the larger value first. Print the value at rank 2; if fewer than 2 distinct values exist, print the last value in this ordering.
## Input format
The first line contains n. The second contains n integers.
## Output format
... | {
"language": "python",
"test_cases": [
{
"input": "8\n-2 -2 -2 5 5 7 8 9\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "32\n13 37 37 37 13 13 -49 46 37 -17 -50 -20 46 -20 29 -20 46 -50 -50 -50 37 37 37 -49 46 15 -17 -20 46 15 -17 -50\n",
"output": "46\n",
... | [{"input":"8\n-2 -2 -2 5 5 7 8 9\n","output":"5\n","type":"stdin_stdout"},{"input":"32\n13 37 37 37 13 13 -49 46 37 -17 -50 -20 46 -20 29 -20 46 -50 -50 -50 37 37 37 -49 46 15 -17 -20 46 15 -17 -50\n","output":"46\n","type":"stdin_stdout"},{"input":"43\n3 25 29 46 12 -48 -50 -4 -4 25 25 -4 3 3 -35 -4 -48 3 25 -35 -18 4... | [
{
"input": "7\n1 1 2 2 3 3 4\n",
"output": "2\n",
"type": "stdin_stdout"
},
{
"input": "9\n-14 -14 -13 -13 -13 -20 -20 -20 -14\n",
"output": "-14\n",
"type": "stdin_stdout"
}
] | import sys
from collections import Counter
d=list(map(int,sys.stdin.buffer.read().split())); c=Counter(d[1:1+d[0]])
a=sorted(c,key=lambda x:(-c[x], -x))
print(a[min(2-1,len(a)-1)])
| oellm-code-rlvr | train | python | en | 3 | intermediate | frequency_rank | [
"hash_maps",
"sorting",
"frequency_counting"
] | oellm-code-generators-0.1.0 | 3,485,326,758,673,233,400 | oellm-code-frequency_rank-000000002 | {"rank":2,"tie_break":"larger"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 62f79cc28cfedf927019efeb89b0d659cb70d57558bd0104b13af4f62104f773 | 8a8d27c9e9e278dcb347f27726c3bc10dc3f536b8fe099c7b3d3e8f907dc5a9a | generator:frequency_rank:v0.1 |
6d2fc7d850c9022883e92911 | [
{
"role": "user",
"content": "# Cyclic indexed string transform\n\nFor every character whose 1-indexed position is divisible by 2, shift it forward by 25 letters cyclically in the lowercase alphabet. Leave other characters unchanged. Reverse the entire resulting string.\n\n## Input format\nOne non-empty low... | # Cyclic indexed string transform
For every character whose 1-indexed position is divisible by 2, shift it forward by 25 letters cyclically in the lowercase alphabet. Leave other characters unchanged. Reverse the entire resulting string.
## Input format
One non-empty lowercase string.
## Output format
Print the tran... | {
"language": "python",
"test_cases": [
{
"input": "abcdefghijklmnopqrstuvwxyz\n",
"output": "yywwuussqqoommkkiiggeeccaa\n",
"type": "stdin_stdout"
},
{
"input": "qhoggvjrwlj\n",
"output": "jkwqjugfogq\n",
"type": "stdin_stdout"
},
{
"input": "ey\n",
... | [{"input":"abcdefghijklmnopqrstuvwxyz\n","output":"yywwuussqqoommkkiiggeeccaa\n","type":"stdin_stdout"},{"input":"qhoggvjrwlj\n","output":"jkwqjugfogq\n","type":"stdin_stdout"},{"input":"ey\n","output":"xe\n","type":"stdin_stdout"},{"input":"coawxudjsimpnvhqe\n","output":"ephunomhsidtxvanc\n","type":"stdin_stdout"},{"i... | [
{
"input": "a\n",
"output": "a\n",
"type": "stdin_stdout"
},
{
"input": "nwhpwspjohimfvzpewjb\n",
"output": "ajveozufligoiprwohvn\n",
"type": "stdin_stdout"
}
] | import sys
s=sys.stdin.readline().strip(); a=[]
for i,c in enumerate(s,1): a.append(chr((ord(c)-97+25)%26+97) if i%2==0 else c)
r=''.join(a); print(r[::-1] if True else r)
| oellm-code-rlvr | train | python | en | 1 | introductory | cyclic_string_transform | [
"strings",
"indexing",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 4,828,459,350,480,462,000 | oellm-code-cyclic_string_transform-000000002 | {"reverse":true,"shift":25,"step":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 96db289a8d37d0d5e018dd5861a534a01699563ee7afeecd8ee1d9ccd1f4c36e | ac276608c96dc8fd3c5d6f88ffbad399afa23d0cfc98fce5b1cfa7cbf64fb1bf | generator:cyclic_string_transform:v0.1 |
a150b4530a0063839dcb4330 | [
{
"role": "user",
"content": "# Overlapping shifted-pattern count\n\nShift every character of text forward by 7 letters cyclically, but do not change pattern. Count occurrences of pattern in the shifted text, including overlapping occurrences.\n\n## Input format\nTwo whitespace-separated lowercase strings: ... | # Overlapping shifted-pattern count
Shift every character of text forward by 7 letters cyclically, but do not change pattern. Count occurrences of pattern in the shifted text, including overlapping occurrences.
## Input format
Two whitespace-separated lowercase strings: text and pattern.
## Output format
Print the o... | {
"language": "python",
"test_cases": [
{
"input": "abcabc abc\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "tttt aa\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "tutut aba\n",
"output": "2\n",
"type": "stdin_stdout"... | [{"input":"abcabc abc\n","output":"0\n","type":"stdin_stdout"},{"input":"tttt aa\n","output":"3\n","type":"stdin_stdout"},{"input":"tutut aba\n","output":"2\n","type":"stdin_stdout"},{"input":"tuvtuv abc\n","output":"2\n","type":"stdin_stdout"},{"input":"cbbbc cc\n","output":"0\n","type":"stdin_stdout"},{"input":"dabeb... | [
{
"input": "aaaa aa\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "daeaaadb aaa\n",
"output": "0\n",
"type": "stdin_stdout"
}
] | import sys
s,p=sys.stdin.buffer.read().decode().split(); s=''.join(chr((ord(c)-97+7)%26+97) for c in s); ans=0; i=0
while True:
i=s.find(p,i)
if i<0:break
ans+=1;i+=1
print(ans)
| oellm-code-rlvr | train | python | en | 1 | introductory | overlapping_pattern_count | [
"strings",
"pattern_matching",
"overlaps"
] | oellm-code-generators-0.1.0 | 9,098,335,131,141,885,000 | oellm-code-overlapping_pattern_count-000000002 | {"text_caesar_shift":7} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 13 | 1 | deterministic_procedural_generation | Apache-2.0 | 155bad50908aa978cd848c90c80525939860995e4ba9d5b5b3383225a0404b74 | 960ce2a13c97c5f5e531dbaca2c4083017f636ec379d63cf93311fa3ab7a1b32 | generator:overlapping_pattern_count:v0.1 |
21df953f65f228a557774a5e | [
{
"role": "user",
"content": "# Grid neighbour threshold\n\nCount cells containing 'B' that have at least 2 other 'B' cells among their eight surrounding neighbours. A cell is not its own neighbour.\n\n## Input format\nh w followed by h equal-length rows using A, B, C, and dot.\n\n## Output format\nPrint th... | # Grid neighbour threshold
Count cells containing 'B' that have at least 2 other 'B' cells among their eight surrounding neighbours. A cell is not its own neighbour.
## Input format
h w followed by h equal-length rows using A, B, C, and dot.
## Output format
Print the count.
## Constraints
1 ≤ h,w ≤ 11.
Example 1
... | {
"language": "python",
"test_cases": [
{
"input": "3 3\nBBB\nBAB\nBBB\n",
"output": "8\n",
"type": "stdin_stdout"
},
{
"input": "3 3\nB.B\n.B.\nB.B\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "3 3\nAAA\nABA\nAAA\n",
"output": "0\n",
... | [{"input":"3 3\nBBB\nBAB\nBBB\n","output":"8\n","type":"stdin_stdout"},{"input":"3 3\nB.B\n.B.\nB.B\n","output":"1\n","type":"stdin_stdout"},{"input":"3 3\nAAA\nABA\nAAA\n","output":"0\n","type":"stdin_stdout"},{"input":"7 3\nAC.\nC.B\nBCB\n..A\nBBB\n.B.\nBAB\n","output":"4\n","type":"stdin_stdout"},{"input":"7 3\nABC\... | [
{
"input": "1 1\nB\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "7 5\nB..CC\nACA.B\nCCBCB\n.C.A.\n.AAC.\nBCBCC\nABACC\n",
"output": "1\n",
"type": "stdin_stdout"
}
] | import sys
a=sys.stdin.read().split();h=int(a[0]);w=int(a[1]);g=a[2:];D=[(-1,0),(1,0),(0,-1),(0,1)]+([(-1, -1), (-1, 1), (1, -1), (1, 1)]);z=0
for i in range(h):
for j in range(w):
if g[i][j]=='B' and sum(0<=i+x<h and 0<=j+y<w and g[i+x][j+y]=='B' for x,y in D)>=2:z+=1
print(z)
| oellm-code-rlvr | train | python | en | 4 | advanced | grid_neighbor_count | [
"grids",
"neighbourhoods",
"counting"
] | oellm-code-generators-0.1.0 | 5,369,640,605,997,006,000 | oellm-code-grid_neighbor_count-000000002 | {"diagonal":true,"target":"B","threshold":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | 4a6afaabaf0e5e6c79e7aebd322bc8ab787e2462735806a6c97a8e2c692177f0 | 074f7eed0b9e52d3f944c6a96e34516a24883df566e3553c802acc7d8df7e363 | generator:grid_neighbor_count:v0.1 |
cb35deab6566ce6e67fc7702 | [
{
"role": "user",
"content": "# Weighted grid path\n\nFind the minimum cost from S to G, moving in 8 directions. '#' is blocked. Entering digit d costs d; entering '.', 'S', or 'G' costs 1. Print -1 if G is unreachable.\n\n## Input format\nh w followed by h rows containing exactly one S and one G.\n\n## Out... | # Weighted grid path
Find the minimum cost from S to G, moving in 8 directions. '#' is blocked. Entering digit d costs d; entering '.', 'S', or 'G' costs 1. Print -1 if G is unreachable.
## Input format
h w followed by h rows containing exactly one S and one G.
## Output format
Print the minimum cost or -1.
## Cons... | {
"language": "python",
"test_cases": [
{
"input": "3 4\nS19G\n.##.\n....\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "2 2\nS#\n#G\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "1 4\nS99G\n",
"output": "19\n",
"type"... | [{"input":"3 4\nS19G\n.##.\n....\n","output":"5\n","type":"stdin_stdout"},{"input":"2 2\nS#\n#G\n","output":"1\n","type":"stdin_stdout"},{"input":"1 4\nS99G\n","output":"19\n","type":"stdin_stdout"},{"input":"5 6\nS.1#11\n.2....\n.12.1#\n.32.11\n2212.G\n","output":"5\n","type":"stdin_stdout"},{"input":"6 3\nS.2\n3..\n3... | [
{
"input": "1 2\nSG\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "2 2\nS.\n.G\n",
"output": "1\n",
"type": "stdin_stdout"
}
] | import sys,heapq
a=sys.stdin.read().split();h=int(a[0]);w=int(a[1]);g=a[2:];D=[(-1,0),(1,0),(0,-1),(0,1)]+([(-1, -1), (-1, 1), (1, -1), (1, 1)]);s=next((i,j) for i in range(h) for j in range(w) if g[i][j]=='S');t=next((i,j) for i in range(h) for j in range(w) if g[i][j]=='G');q=[(0,*s)];dist={s:0}
while q:
d,i,j=heapq... | oellm-code-rlvr | train | python | en | 3 | intermediate | weighted_grid_path | [
"graphs",
"dijkstra",
"grids",
"shortest_paths"
] | oellm-code-generators-0.1.0 | 6,687,651,801,143,960,000 | oellm-code-weighted_grid_path-000000002 | {"diagonal":true,"digit_cost":true} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | 0cb320786a326a0351743f73d83099ba784aca9ac3b7c35566e8c137e6315b15 | 9261f355670ed8256e2a2b2c570685cfe7cc5123e90c17df9216ddfcf935d11a | generator:weighted_grid_path:v0.1 |
a511ad894fce43af3b68f611 | [
{
"role": "user",
"content": "# Constrained graph reachability\n\nStart at vertex 1 in an undirected graph. You may not enter any other vertex v with v mod 3 = 0. Count reachable vertices excluding vertex 1.\n\n## Input format\nn m followed by m undirected edges u v.\n\n## Output format\nPrint one integer.\... | # Constrained graph reachability
Start at vertex 1 in an undirected graph. You may not enter any other vertex v with v mod 3 = 0. Count reachable vertices excluding vertex 1.
## Input format
n m followed by m undirected edges u v.
## Output format
Print one integer.
## Constraints
1 ≤ n ≤ 11; no duplicate edges.
E... | {
"language": "python",
"test_cases": [
{
"input": "5 5\n1 2\n2 3\n3 4\n4 5\n1 5\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "2 1\n1 2\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "3 3\n1 2\n1 3\n2 3\n",
"output": "1\n",
... | [{"input":"5 5\n1 2\n2 3\n3 4\n4 5\n1 5\n","output":"3\n","type":"stdin_stdout"},{"input":"2 1\n1 2\n","output":"1\n","type":"stdin_stdout"},{"input":"3 3\n1 2\n1 3\n2 3\n","output":"1\n","type":"stdin_stdout"},{"input":"8 11\n1 2\n1 7\n2 3\n2 6\n2 7\n3 4\n3 5\n3 6\n4 8\n5 6\n6 7\n","output":"2\n","type":"stdin_stdout"... | [
{
"input": "1 0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "5 8\n1 2\n1 4\n1 5\n2 3\n2 4\n3 4\n3 5\n4 5\n",
"output": "3\n",
"type": "stdin_stdout"
}
] | import sys
from collections import deque
it=iter(map(int,sys.stdin.buffer.read().split()));n=next(it);m=next(it);g=[[] for _ in range(n+1)]
for _ in range(m):u=next(it);v=next(it);g[u].append(v);g[v].append(u)
s={1};q=deque([1])
while q:
u=q.popleft()
for v in g[u]:
if v not in s and v%3!=0:s.add(v);q.append(v)
pri... | oellm-code-rlvr | train | python | en | 1 | introductory | constrained_reachability | [
"graphs",
"breadth_first_search",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 4,105,912,565,463,108,000 | oellm-code-constrained_reachability-000000002 | {"forbidden_modulus":3,"forbidden_residue":0} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | a14545b33aa46f21fbc5517f2ccadd870b8d0844b59acd6d6db3e596364fa986 | 6007985f0a99290eab7e547dcb7561b107c60f6bee1379388cda2786c93b7dfd | generator:constrained_reachability:v0.1 |
7c5bbba57265d6124485b9e3 | [
{
"role": "user",
"content": "# Transformed longest subsequence\n\nTransform each x into (7x + 17) mod 39, preserving order. Print the length of the longest non-decreasing subsequence of the transformed sequence.\n\n## Input format\nn followed by n integers.\n\n## Output format\nPrint the subsequence length... | # Transformed longest subsequence
Transform each x into (7x + 17) mod 39, preserving order. Print the length of the longest non-decreasing subsequence of the transformed sequence.
## Input format
n followed by n integers.
## Output format
Print the subsequence length.
## Constraints
1 ≤ n ≤ 46.
Example 1
Input:
1
... | {
"language": "python",
"test_cases": [
{
"input": "7\n3 1 2 2 5 4 6\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "6\n-43 75 64 6 51 -5\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "13\n-25 54 49 6 -60 5 12 42 99 -6 87 92 -30\n"... | [{"input":"7\n3 1 2 2 5 4 6\n","output":"3\n","type":"stdin_stdout"},{"input":"6\n-43 75 64 6 51 -5\n","output":"3\n","type":"stdin_stdout"},{"input":"13\n-25 54 49 6 -60 5 12 42 99 -6 87 92 -30\n","output":"5\n","type":"stdin_stdout"},{"input":"30\n-45 37 -8 75 42 59 68 -97 -99 25 44 5 -77 78 48 46 33 86 63 35 49 62 6... | [
{
"input": "1\n0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "40\n-45 67 -25 -85 32 -69 -75 -2 14 -8 -63 72 74 33 47 30 -31 53 -81 16 -76 33 -40 98 -72 45 44 -54 -94 -84 21 -98 34 -48 -56 89 28 60 -66 38\n",
"output": "11\n",
"type": "stdin_stdout"
}
] | import sys,bisect
d=list(map(int,sys.stdin.buffer.read().split()));t=[]
for x in d[1:1+d[0]]:
x=(7*x+17)%39;i=bisect.bisect_right(t,x)
if i==len(t):t.append(x)
else:t[i]=x
print(len(t))
| oellm-code-rlvr | train | python | en | 3 | intermediate | transformed_lis | [
"binary_search",
"longest_increasing_subsequence",
"dynamic_programming"
] | oellm-code-generators-0.1.0 | 8,308,140,718,485,420,000 | oellm-code-transformed_lis-000000002 | {"a":7,"b":17,"modulus":39,"subsequence":"non-decreasing"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 50f9ebe74410b47579b868b1a4c62df8450b389638900725b000c2ec8a7bd99a | 04f00ec4e68d79d4c94b55e4a03f0494e6e08b6a942b536bf1589d9e9f1d1571 | generator:transformed_lis:v0.1 |
822b2ad2ba608595b553409c | [
{
"role": "user",
"content": "# Filtered affine sum\n\nKeep every array value x satisfying x mod 8 = 0. Replace each kept value by 1x + (3), sum the results, and reduce the sum modulo 10007. Python-style non-negative remainders are used.\n\n## Input format\nThe first line contains n. The second contains n i... | # Filtered affine sum
Keep every array value x satisfying x mod 8 = 0. Replace each kept value by 1x + (3), sum the results, and reduce the sum modulo 10007. Python-style non-negative remainders are used.
## Input format
The first line contains n. The second contains n integers.
## Output format
Print one integer.
... | {
"language": "python",
"test_cases": [
{
"input": "6\n-7 0 1 7 14 21\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "37\n-1744 6655 -1892 -2710 5638 9880 5315 -1946 9852 7764 -4397 -8475 -836 -4658 -5865 -5689 611 504 -32 -7031 -5092 4031 919 4709 186 -594 -735 -4983 ... | [{"input":"6\n-7 0 1 7 14 21\n","output":"3\n","type":"stdin_stdout"},{"input":"37\n-1744 6655 -1892 -2710 5638 9880 5315 -1946 9852 7764 -4397 -8475 -836 -4658 -5865 -5689 611 504 -32 -7031 -5092 4031 919 4709 186 -594 -735 -4983 -2855 -121 -2436 1602 -6866 1097 -9487 -6018 -7322\n","output":"8620\n","type":"stdin_std... | [
{
"input": "1\n0\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "44\n-8460 -1639 -8225 -2882 -7576 5065 -2041 37 -5194 6235 -2003 663 -2950 8531 -2808 7856 0 -9444 -9234 1720 3102 546 5232 6092 -6282 9684 7651 -35 9625 1704 -4385 8196 1626 5361 -7870 7328 -7238 -4920 1603 3713 5069 -8... | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]
print(sum(1*x+(3) for x in d[1:1+n] if x%8==0)%10007)
| oellm-code-rlvr | train | python | en | 3 | intermediate | filtered_affine_sum | [
"arrays",
"filtering",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 4,731,519,412,605,443,000 | oellm-code-filtered_affine_sum-000000003 | {"a":1,"b":3,"divisor":8,"modulus":10007,"residue":0} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | d336676e693abd61665fc07786f2805a8bd00aef0083321e3f5779b0fa68e83d | c87335b4dbc27ff055010a026074ee53d8341f58a6b300b87b6a1e54116270b2 | generator:filtered_affine_sum:v0.1 |
8b82dda7eae45af703773828 | [
{
"role": "user",
"content": "# Fixed-window extreme\n\nTransform each x into 2x + (8). Among all contiguous windows of exactly 6 transformed values, find the minimum window sum.\n\n## Input format\nThe first line contains n. The second contains n integers.\n\n## Output format\nPrint the requested window su... | # Fixed-window extreme
Transform each x into 2x + (8). Among all contiguous windows of exactly 6 transformed values, find the minimum window sum.
## Input format
The first line contains n. The second contains n integers.
## Output format
Print the requested window sum.
## Constraints
6 ≤ n ≤ 54.
Example 1
Input:
6... | {
"language": "python",
"test_cases": [
{
"input": "8\n-1 0 1 2 3 4 5 6\n",
"output": "66\n",
"type": "stdin_stdout"
},
{
"input": "27\n-307 -53 -176 333 14 260 44 -6 -135 99 -271 36 -206 304 69 162 32 213 369 9 -131 -60 -69 283 -171 -350 384\n",
"output": "-948\n",
"... | [{"input":"8\n-1 0 1 2 3 4 5 6\n","output":"66\n","type":"stdin_stdout"},{"input":"27\n-307 -53 -176 333 14 260 44 -6 -135 99 -271 36 -206 304 69 162 32 213 369 9 -131 -60 -69 283 -171 -350 384\n","output":"-948\n","type":"stdin_stdout"},{"input":"17\n184 -136 123 174 119 -339 -73 -238 331 316 -329 256 -238 -31 -380 30... | [
{
"input": "6\n0 0 0 0 0 0\n",
"output": "48\n",
"type": "stdin_stdout"
},
{
"input": "9\n-208 -76 -251 77 204 -241 -128 -196 -327\n",
"output": "-1174\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=[2*x+(8) for x in d[1:1+n]]; k=6
s=sum(a[:k]); best=s
for i in range(k,n):
s+=a[i]-a[i-k]; best=min(best,s)
print(best)
| oellm-code-rlvr | train | python | en | 4 | advanced | window_extreme | [
"arrays",
"sliding_window"
] | oellm-code-generators-0.1.0 | 4,344,434,837,728,116,000 | oellm-code-window_extreme-000000003 | {"extreme":"minimum","offset":8,"scale":2,"window":6} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | eb2cff3ff845f7c7a3bb3c790ec8a6ad0353be2098060918dc4be70b587d5d05 | 48baedc77797e0f752299eb8868a2fd6c4ba0fa6509418f0b3a49ca5822a9616 | generator:window_extreme:v0.1 |
f32eac5732379c8f2a4e988f | [
{
"role": "user",
"content": "# Ranked frequency\n\nOrder distinct values by decreasing frequency. Ties are resolved by choosing the larger value first. Print the value at rank 2; if fewer than 2 distinct values exist, print the last value in this ordering.\n\n## Input format\nThe first line contains n. The... | # Ranked frequency
Order distinct values by decreasing frequency. Ties are resolved by choosing the larger value first. Print the value at rank 2; if fewer than 2 distinct values exist, print the last value in this ordering.
## Input format
The first line contains n. The second contains n integers.
## Output format
... | {
"language": "python",
"test_cases": [
{
"input": "8\n-2 -2 -2 5 5 7 8 9\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "8\n0 0 0 29 -41 0 -41 0\n",
"output": "-41\n",
"type": "stdin_stdout"
},
{
"input": "9\n29 -46 29 -38 29 29 39 39 39\n",
... | [{"input":"8\n-2 -2 -2 5 5 7 8 9\n","output":"5\n","type":"stdin_stdout"},{"input":"8\n0 0 0 29 -41 0 -41 0\n","output":"-41\n","type":"stdin_stdout"},{"input":"9\n29 -46 29 -38 29 29 39 39 39\n","output":"39\n","type":"stdin_stdout"},{"input":"7\n-36 -13 -13 -44 -36 -36 -13\n","output":"-36\n","type":"stdin_stdout"},{... | [
{
"input": "7\n1 1 2 2 3 3 4\n",
"output": "2\n",
"type": "stdin_stdout"
},
{
"input": "15\n-26 -26 -26 21 -20 -20 -32 -26 -32 -32 -32 21 -20 -32 -26\n",
"output": "-32\n",
"type": "stdin_stdout"
}
] | import sys
from collections import Counter
d=list(map(int,sys.stdin.buffer.read().split())); c=Counter(d[1:1+d[0]])
a=sorted(c,key=lambda x:(-c[x], -x))
print(a[min(2-1,len(a)-1)])
| oellm-code-rlvr | train | python | en | 1 | introductory | frequency_rank | [
"hash_maps",
"sorting",
"frequency_counting"
] | oellm-code-generators-0.1.0 | 1,794,393,372,251,627,800 | oellm-code-frequency_rank-000000003 | {"rank":2,"tie_break":"larger"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 9c43ec104e114ede0eb7713e997399e2d9f43b9649d6815598bbd734fdbea696 | 8a8d27c9e9e278dcb347f27726c3bc10dc3f536b8fe099c7b3d3e8f907dc5a9a | generator:frequency_rank:v0.1 |
3108042e4ecbc4699c1c462a | [
{
"role": "user",
"content": "# Affine range queries\n\nTransform every array value x to -5x + (5). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 101.\n\n## Input format\nn q, then n integers, then q lines l r.\n\n## Output format\nPrint one answer per query.\n\n## Constraints\n... | # Affine range queries
Transform every array value x to -5x + (5). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 101.
## Input format
n q, then n integers, then q lines l r.
## Output format
Print one answer per query.
## Constraints
1 ≤ n ≤ 42; 1 ≤ q ≤ 13.
Example 1
Input:
1 2
0
1 1
1... | {
"language": "python",
"test_cases": [
{
"input": "5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n",
"output": "25\n15\n5\n",
"type": "stdin_stdout"
},
{
"input": "18 10\n74 22 -58 13 -9 72 14 81 -91 1 54 33 90 -13 59 85 19 42\n2 18\n7 12\n15 15\n8 11\n17 18\n5 5\n5 18\n2 16\n17 18\n11 12\n",... | [{"input":"5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n","output":"25\n15\n5\n","type":"stdin_stdout"},{"input":"18 10\n74 22 -58 13 -9 72 14 81 -91 1 54 33 90 -13 59 85 19 42\n2 18\n7 12\n15 15\n8 11\n17 18\n5 5\n5 18\n2 16\n17 18\n11 12\n","output":"35\n75\n13\n98\n8\n50\n6\n27\n8\n80\n","type":"stdin_stdout"},{"input":"21 3\n7... | [
{
"input": "1 2\n0\n1 1\n1 1\n",
"output": "5\n5\n",
"type": "stdin_stdout"
},
{
"input": "22 4\n-52 -59 -74 43 1 94 -81 -20 13 -96 -48 -30 -6 54 46 -28 -13 -96 21 -36 -59 95\n21 21\n17 19\n14 15\n10 20\n",
"output": "98\n51\n15\n3\n",
"type": "stdin_stdout"
}
] | import sys
it=iter(map(int,sys.stdin.buffer.read().split())); n=next(it); q=next(it); p=[0]
for _ in range(n): p.append(p[-1]+-5*next(it)+(5))
for _ in range(q):
l=next(it); r=next(it); print((p[r]-p[l-1])%101)
| oellm-code-rlvr | train | python | en | 3 | intermediate | range_affine_queries | [
"prefix_sums",
"range_queries",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 93,194,235,371,262,860 | oellm-code-range_affine_queries-000000003 | {"a":-5,"b":5,"modulus":101} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 0830bea198e9828525bfec68a27f46d7a260bf0a6d5ee2b2ed5ba4694acb6dd7 | 244c706389e505770b0f465a9662b545630b960a91a502627b215a9e16c36ee2 | generator:range_affine_queries:v0.1 |
6077ba9823374b18d9bec510 | [
{
"role": "user",
"content": "# Expanded interval union\n\nEach closed integer interval [l,r] is expanded to [l-7,r+7]. Print how many distinct integers belong to at least one expanded interval.\n\n## Input format\nThe first line contains n, followed by n lines l r.\n\n## Output format\nPrint one integer.\n... | # Expanded interval union
Each closed integer interval [l,r] is expanded to [l-7,r+7]. Print how many distinct integers belong to at least one expanded interval.
## Input format
The first line contains n, followed by n lines l r.
## Output format
Print one integer.
## Constraints
1 ≤ n ≤ 20; l ≤ r.
Example 1
Input... | {
"language": "python",
"test_cases": [
{
"input": "4\n0 2\n2 5\n10 10\n8 9\n",
"output": "25\n",
"type": "stdin_stdout"
},
{
"input": "13\n43 67\n-37 -14\n24 32\n-33 -23\n36 38\n5 18\n2 20\n-24 -12\n9 31\n35 51\n-2 15\n-46 -42\n-18 -5\n",
"output": "128\n",
"type": "... | [{"input":"4\n0 2\n2 5\n10 10\n8 9\n","output":"25\n","type":"stdin_stdout"},{"input":"13\n43 67\n-37 -14\n24 32\n-33 -23\n36 38\n5 18\n2 20\n-24 -12\n9 31\n35 51\n-2 15\n-46 -42\n-18 -5\n","output":"128\n","type":"stdin_stdout"},{"input":"14\n-49 -38\n-43 -30\n48 71\n26 35\n-22 -4\n-11 0\n-46 -39\n48 49\n5 8\n11 26\n3... | [
{
"input": "1\n0 0\n",
"output": "15\n",
"type": "stdin_stdout"
},
{
"input": "13\n2 11\n27 41\n-45 -22\n47 72\n32 56\n36 52\n5 20\n-17 -1\n21 31\n27 33\n46 61\n-32 -25\n-5 9\n",
"output": "132\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=sorted((d[i]-7,d[i+1]+7) for i in range(1,2*n+1,2)); l,r=a[0]; ans=0
for x,y in a[1:]:
if x<=r+1:r=max(r,y)
else:ans+=r-l+1;l,r=x,y
print(ans+r-l+1)
| oellm-code-rlvr | train | python | en | 5 | challenge | interval_union_points | [
"sorting",
"intervals",
"sweep_line"
] | oellm-code-generators-0.1.0 | 5,780,084,253,506,515,000 | oellm-code-interval_union_points-000000003 | {"padding":7} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | c622e171f5244c5f96b54accfb5ff76dc8d75cfaa08ec423061d1a57c1be44e8 | bcb6c31edf6a2ec1e7286ac020140ae79fc4ecb37ea25fbf8eef33f603792015 | generator:interval_union_points:v0.1 |
OpenEuroLLM Code RLVR
oellm-code-rlvr is a deterministic corpus of 100,000 Python programming prompts for reinforcement learning with verifiable rewards. Every task uses standard input/output, includes two model-visible examples, and has 10–13 hidden tests in the Open R1 verification_info format.
The corpus is procedural and Apache-2.0 licensed. It does not copy Codeforces, LeetCode, LiveCodeBench, HumanEval, MBPP, APPS, or other benchmark text.
Design
The release follows these code-RLVR practices:
- executable, deterministic hidden tests and binary pass/fail rewards;
- model-visible examples separated from hidden reward cases;
- offline sandbox execution with explicit time and memory budgets;
- mutation testing to reject rows whose tests do not catch at least two of three family-specific faulty strategies;
- deterministic regeneration, stable content hashes, and train/validation/test assignment;
- balanced generator-family coverage and a broad initial difficulty distribution;
- benchmark isolation rather than training on common evaluation sets;
- source, license, generator, verifier, and contamination-group metadata on every row.
These choices are informed by Open R1's executable code reward and dataset contract, DRIVE's code-RLVR curation and hard-focus curriculum, LiveCodeBench's contamination-aware evaluation, and OpenCodeReasoning's finding that instruction diversity must not be sacrificed during filtering.
Contents
The 12 equally represented families cover:
- array filtering, affine transforms, sliding windows, and frequency ranking;
- prefix sums and range queries;
- interval merging and sweep-line reasoning;
- indexed string transforms and overlapping pattern matching;
- grid neighbourhoods and weighted shortest paths;
- graph reachability with constraints;
- coin-change dynamic programming;
- transformed longest increasing subsequences.
Difficulty labels range from 1 to 5. They reflect generator structure and input bounds, not empirical model pass rates.
Loading
from datasets import load_dataset
dataset = load_dataset("birgermoell/oellm-code-rlvr")
Only messages should be passed to the policy. verification_info, ground_truth, public/hidden tests, and reference_solution are trainer/verifier metadata and must not appear in the model context.
Open R1 consumes the nested verifier field directly:
row["verification_info"] == {
"language": "python",
"test_cases": [
{"input": "...", "output": "...", "type": "stdin_stdout"},
# additional hidden cases
],
}
ground_truth contains the same hidden cases as canonical JSON for pipelines that expect a scalar ground-truth column.
Suggested rollout curriculum
- Begin with uniform sampling across families and approximately eight rollouts per prompt.
- Measure pass rates for the exact target checkpoint; discard always-solved and never-solved tasks from the main update stream while retaining them for diagnostics.
- Sample the learnable frontier heavily, while preserving family and difficulty coverage.
- Use a second hard-focus stage with more rollouts per prompt for difficult but occasionally solved tasks.
- Keep current LiveCodeBench, Codeforces weekly contests, HumanEval, MBPP, and any project evaluation set out of training and model-driven difficulty calibration.
The stored difficulty is only a prior. A model-specific rollout calibration table should be treated as the authoritative curriculum.
Verification and safety
Generated code is untrusted. Execute completions in an isolated sandbox with no network, a read-only base image, bounded CPU/RAM/process count/output, and a hard timeout. A normal wrong answer, syntax error, or failing test receives reward zero; sandbox launch failures, missing tests, timeout, and OOM should additionally be recorded as infrastructure/error categories.
The included reference programs are for reproducibility and verifier QA. They are not intended as policy inputs.
Rebuild and validate locally:
python -m oellm_code_rlvr.generate --output release --rows 100000
python -m oellm_code_rlvr.validate release --full --execute-modulus 1009
Quality gates
For each release:
- all IDs and prompts are unique;
- every row regenerates byte-for-byte from its seed;
- every reference solution parses as Python;
- every test has normalized newline-terminated input and output;
- all family-specific mutation scores are at least 0.67;
- a deterministic execution sample runs the reference solution against every public and hidden test;
- Parquet file sizes, row counts, and SHA-256 hashes are recorded in
manifest.json.
Limitations
This is a focused first release, not a complete coding curriculum. It contains Python/English stdin/stdout synthesis tasks rather than repository-level repair, API use, systems programming, proofs of correctness, or multilingual prompts. Procedural variants can share algorithmic structure even though their visible specifications and examples are unique. Hidden tests substantially improve reward quality but cannot prove program correctness. Empirical rollout calibration and adversarial test expansion remain necessary before a large training run.
Citation
@dataset{oellm_code_rlvr_2026,
title = {OpenEuroLLM Code RLVR},
author = {Moell, Birger},
year = {2026},
url = {https://huggingface.co/datasets/birgermoell/oellm-code-rlvr}
}
- Downloads last month
- -