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 |
f8ca3f9eed90bc0f9d776ee0 | [
{
"role": "user",
"content": "# Cyclic indexed string transform\n\nFor every character whose 1-indexed position is divisible by 2, shift it forward by 3 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 2, shift it forward by 3 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": "cyawyuwsuqsoqmokmikgiegcea\n",
"type": "stdin_stdout"
},
{
"input": "pmlj\n",
"output": "mlpp\n",
"type": "stdin_stdout"
},
{
"input": "mngqyfowpfcchklarkltiykm... | [{"input":"abcdefghijklmnopqrstuvwxyz\n","output":"cyawyuwsuqsoqmokmikgiegcea\n","type":"stdin_stdout"},{"input":"pmlj\n","output":"mlpp\n","type":"stdin_stdout"},{"input":"mngqyfowpfcchklarkltiykmorituu\n","output":"xuwiuopkbiwlnrdlnhfcipzoiytgqm\n","type":"stdin_stdout"},{"input":"yumkzkvbtneumuduslz\n","output":"zos... | [
{
"input": "a\n",
"output": "a\n",
"type": "stdin_stdout"
},
{
"input": "pmrm\n",
"output": "prpp\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+3)%26+97) if i%2==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 | 187,857,133,320,208,480 | oellm-code-cyclic_string_transform-000000003 | {"reverse":true,"shift":3,"step":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | b91c2e14772807ccad87e218c22f5365ed2a04f843728dbe0dcf902a65f56fc6 | 17fd06f517203b74910574b17d543af30e0975722ecdb0f7ca43d8446296bf21 | generator:cyclic_string_transform:v0.1 |
b4556c45efc166a31e4cc2cb | [
{
"role": "user",
"content": "# Overlapping shifted-pattern count\n\nShift every character of text forward by 23 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 23 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": "dddd aa\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "deded aba\n",
"output": "2\n",
"type": "stdin_stdout"... | [{"input":"abcabc abc\n","output":"0\n","type":"stdin_stdout"},{"input":"dddd aa\n","output":"3\n","type":"stdin_stdout"},{"input":"deded aba\n","output":"2\n","type":"stdin_stdout"},{"input":"defdef abc\n","output":"2\n","type":"stdin_stdout"},{"input":"bcdeccdeebcccbadaec cc\n","output":"0\n","type":"stdin_stdout"},{... | [
{
"input": "aaaa aa\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "dcbdbeebdedabceaded d\n",
"output": "0\n",
"type": "stdin_stdout"
}
] | import sys
s,p=sys.stdin.buffer.read().decode().split(); s=''.join(chr((ord(c)-97+23)%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 | 4,411,242,826,065,825,000 | oellm-code-overlapping_pattern_count-000000003 | {"text_caesar_shift":23} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 13 | 1 | deterministic_procedural_generation | Apache-2.0 | e6b524957642bfde6a086a3b64ca9b7948db5817cca80651396c7c71cc2a1153 | a3f706813957a7c6f0cd23fcb1bf56bf4304136cad5e694e1dcb153466652b07 | generator:overlapping_pattern_count:v0.1 |
adda65113fb2b9f785ae0a6c | [
{
"role": "user",
"content": "# Grid neighbour threshold\n\nCount cells containing 'B' that have at least 1 other 'B' cells among their four orthogonal 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 the ... | # Grid neighbour threshold
Count cells containing 'B' that have at least 1 other 'B' cells among their four orthogonal 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
Inp... | {
"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": "0\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":"0\n","type":"stdin_stdout"},{"input":"3 3\nAAA\nABA\nAAA\n","output":"0\n","type":"stdin_stdout"},{"input":"9 3\n.B.\nBAB\n.AB\nAAA\nACB\nC.B\nBCC\nBAB\nC.C\n","output":"6\n","type":"stdin_stdout"},{"input":... | [
{
"input": "1 1\nB\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "6 7\nBAAAAA.\nC.ABACC\n.ABCC.B\n.B...CA\n.BBAACC\nBCB..BC\n",
"output": "4\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)]+([]);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)>=1: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,426,778,845,244,958,000 | oellm-code-grid_neighbor_count-000000003 | {"diagonal":false,"target":"B","threshold":1} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | 2723dbc70b37d6cfd1156101f86ab81668aa3423b7fc5149890b74bc68e22103 | 0a9eb6159bde6d65573a1e12f8375d44b80390b1c09307939737f795ff35cbf1 | generator:grid_neighbor_count:v0.1 |
e0cccb2c65b802c757343ae0 | [
{
"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":"3 2\nS.\n3.\n.G\n","output":"3\n","type":"stdin_stdout"},{"input":"2 2\nS.\n.G\n","output":"2\n","type":"stdin... | [
{
"input": "1 2\nSG\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "4 4\nS.#3\n.#..\n#.3.\n#3.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)]+([]);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 | 5,844,567,072,463,980,000 | oellm-code-weighted_grid_path-000000003 | {"diagonal":false,"digit_cost":true} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | d392692f242c65c227f444a840dca94e7da7a930177b941f46d7d9e9bd07f045 | 84fd160695f037c91b411ccc59ce3e2f0ed55469cb717f84f8ece0567f2b46b1 | generator:weighted_grid_path:v0.1 |
4523c9b87a0d10b0691c8f89 | [
{
"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 = 5. 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 = 5. 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": "3\n",
"type": "stdin_stdout"
},
{
"input": "10 17\n1 2\n1 3\n1 4\n1 7\n2 4\n2 9\n3 5\n3 7\n3 8\n3 9\n3 10\n4 6\n4 8\n5 8\n6 7\n7 9\n7 10\n",
"output": "8\n",
"type": "stdin... | [{"input":"5 5\n1 2\n2 3\n3 4\n4 5\n1 5\n","output":"3\n","type":"stdin_stdout"},{"input":"10 17\n1 2\n1 3\n1 4\n1 7\n2 4\n2 9\n3 5\n3 7\n3 8\n3 9\n3 10\n4 6\n4 8\n5 8\n6 7\n7 9\n7 10\n","output":"8\n","type":"stdin_stdout"},{"input":"15 26\n1 2\n1 4\n1 6\n1 8\n1 11\n1 14\n2 3\n2 5\n2 8\n2 14\n3 7\n3 9\n3 10\n3 11\n4 1... | [
{
"input": "1 0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "15 26\n1 2\n1 3\n1 4\n1 7\n1 8\n1 14\n1 15\n2 4\n2 5\n2 6\n2 13\n2 15\n3 11\n4 7\n4 8\n4 10\n5 9\n5 12\n8 13\n9 13\n10 11\n10 14\n10 15\n11 13\n11 14\n12 14\n",
"output": "12\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!=5: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 | 6,038,441,518,885,459,000 | oellm-code-constrained_reachability-000000003 | {"forbidden_modulus":7,"forbidden_residue":5} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 0.666667 | deterministic_procedural_generation | Apache-2.0 | ab43f5f9f65e4fe566ecb4753b16bece59575acb46f17f68e5fb786a4a506697 | a0bfa45cbb8d9547c56ac6480ab43f07c13e190c2d631cdd772ee9111d2dd6ef | generator:constrained_reachability:v0.1 |
4e843bd01a654d08e642fd65 | [
{
"role": "user",
"content": "# Parameterized coin change\n\nUsing unlimited coins with values [1, 9, 12, 19], 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 numbe... | # Parameterized coin change
Using unlimited coins with values [1, 9, 12, 19], 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... | {
"language": "python",
"test_cases": [
{
"input": "1\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "41\n",
"output": "18\n",
"type": "stdin_stdout"
},
{
"input": "180\n",
"output": "47\n",
"type": "stdin_stdout"
},
{
... | [{"input":"1\n","output":"1\n","type":"stdin_stdout"},{"input":"41\n","output":"18\n","type":"stdin_stdout"},{"input":"180\n","output":"47\n","type":"stdin_stdout"},{"input":"92\n","output":"12\n","type":"stdin_stdout"},{"input":"54\n","output":"32\n","type":"stdin_stdout"},{"input":"29\n","output":"9\n","type":"stdin_... | [
{
"input": "0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "59\n",
"output": "40\n",
"type": "stdin_stdout"
}
] | import sys
n=int(sys.stdin.readline());d=[0]*(n+1);d[0]=1
for c in [1, 9, 12, 19]:
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 | 2,330,305,382,597,752,000 | oellm-code-coin_change-000000003 | {"coins":[1,9,12,19],"modulus":101} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 11 | 1 | deterministic_procedural_generation | Apache-2.0 | 907f74fe5cfa4ffd7f2b310fdd4abf6f2859fd40ec7e076114af0320a10d63a8 | c9d53697eb47fb5718ef4371a88ce0b11be5ea25e69f3077216e5ff7ee57150f | generator:coin_change:v0.1 |
72ab071bd5cf2c57383bd23b | [
{
"role": "user",
"content": "# Transformed longest subsequence\n\nTransform each x into (1x + 9) mod 17, 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 le... | # Transformed longest subsequence
Transform each x into (1x + 9) mod 17, 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
Input... | {
"language": "python",
"test_cases": [
{
"input": "7\n3 1 2 2 5 4 6\n",
"output": "4\n",
"type": "stdin_stdout"
},
{
"input": "18\n1 -3 -80 42 59 -37 -45 -7 -69 -43 18 16 16 -4 95 5 -19 11\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "17\n6... | [{"input":"7\n3 1 2 2 5 4 6\n","output":"4\n","type":"stdin_stdout"},{"input":"18\n1 -3 -80 42 59 -37 -45 -7 -69 -43 18 16 16 -4 95 5 -19 11\n","output":"5\n","type":"stdin_stdout"},{"input":"17\n66 25 85 -87 -60 40 -26 -8 46 -8 -27 10 30 1 -76 -65 59\n","output":"6\n","type":"stdin_stdout"},{"input":"19\n11 78 98 4 77... | [
{
"input": "1\n0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "29\n36 72 80 -64 10 -35 8 77 34 -28 96 -12 -41 10 54 62 78 10 65 -44 -21 -41 -19 14 -48 -81 -83 68 68\n",
"output": "8\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=(1*x+9)%17;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 | 2,034,421,772,861,300,500 | oellm-code-transformed_lis-000000003 | {"a":1,"b":9,"modulus":17,"subsequence":"strictly increasing"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | e1f4bcef3553b2586f5c4d88a7e093bc96fe6add74c5b8d3dd1ad42b78773389 | 1184ff11a3c92f8231c2b4808816666bd3aef8030d378da64d66a64e9cad6c3b | generator:transformed_lis:v0.1 |
fcf6fbfbc21c03cf4dbd7fef | [
{
"role": "user",
"content": "# Filtered affine sum\n\nKeep every array value x satisfying x mod 5 = 2. Replace each kept value by 6x + (14), sum the results, and reduce the sum modulo 101. Python-style non-negative remainders are used.\n\n## Input format\nThe first line contains n. The second contains n in... | # Filtered affine sum
Keep every array value x satisfying x mod 5 = 2. Replace each kept value by 6x + (14), sum the results, and reduce the sum modulo 101. 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": "56\n",
"type": "stdin_stdout"
},
{
"input": "12\n-847 45 502 -300 -23 974 858 408 -524 -97 -711 829\n",
"output": "74\n",
"type": "stdin_stdout"
},
{
"input": "7\n-688 -... | [{"input":"6\n-7 0 1 7 14 21\n","output":"56\n","type":"stdin_stdout"},{"input":"12\n-847 45 502 -300 -23 974 858 408 -524 -97 -711 829\n","output":"74\n","type":"stdin_stdout"},{"input":"7\n-688 -881 -13 -657 456 676 989\n","output":"64\n","type":"stdin_stdout"},{"input":"32\n-786 -3 104 113 828 368 -108 -369 596 -337... | [
{
"input": "1\n0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "30\n13 -531 743 -148 43 32 -460 604 308 460 587 -668 254 665 -19 -858 -738 355 -264 936 877 828 -644 -793 -931 -791 -139 -731 -640 904\n",
"output": "59\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]
print(sum(6*x+(14) for x in d[1:1+n] if x%5==2)%101)
| oellm-code-rlvr | train | python | en | 2 | basic | filtered_affine_sum | [
"arrays",
"filtering",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 7,224,344,597,965,430,000 | oellm-code-filtered_affine_sum-000000004 | {"a":6,"b":14,"divisor":5,"modulus":101,"residue":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | d798c39afcb35033b724467184ab7d417ee4bbdc8aca9f89dc0c984dd2b7d4a2 | 26759da3773897e3d7cd93148ba27e6a9ecc70fe19dbb78aa9e567b743bdb02e | generator:filtered_affine_sum:v0.1 |
78bc78bf3f8e5afb01a285ec | [
{
"role": "user",
"content": "# Fixed-window extreme\n\nTransform each x into 3x + (6). Among all contiguous windows of exactly 3 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 + (6). Among all contiguous windows of exactly 3 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
3 ≤ n ≤ 21.
Example 1
Input:
3... | {
"language": "python",
"test_cases": [
{
"input": "5\n-1 0 1 2 3\n",
"output": "36\n",
"type": "stdin_stdout"
},
{
"input": "14\n-32 -8 -89 -99 -8 85 90 -32 -78 81 -24 85 66 84\n",
"output": "723\n",
"type": "stdin_stdout"
},
{
"input": "5\n76 56 31 -83... | [{"input":"5\n-1 0 1 2 3\n","output":"36\n","type":"stdin_stdout"},{"input":"14\n-32 -8 -89 -99 -8 85 90 -32 -78 81 -24 85 66 84\n","output":"723\n","type":"stdin_stdout"},{"input":"5\n76 56 31 -83 41\n","output":"507\n","type":"stdin_stdout"},{"input":"17\n27 100 65 -32 -74 -80 66 -77 -82 7 70 57 42 -80 7 70 25\n","ou... | [
{
"input": "3\n0 0 0\n",
"output": "18\n",
"type": "stdin_stdout"
},
{
"input": "10\n94 16 -85 70 93 -86 16 58 60 81\n",
"output": "615\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=[3*x+(6) for x in d[1:1+n]]; k=3
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 | 1 | introductory | window_extreme | [
"arrays",
"sliding_window"
] | oellm-code-generators-0.1.0 | 6,565,953,705,297,099,000 | oellm-code-window_extreme-000000004 | {"extreme":"maximum","offset":6,"scale":3,"window":3} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | b975ceaea95dad6f6f34c5ad408cb0a3b997da079f1e92e6b59d1278fc13081d | c6564c09c90b876203d429e017a6f1b96ab2e9e0e40e09d4584d5474becd5563 | generator:window_extreme:v0.1 |
8ca2b00e1333ab11ada2d471 | [
{
"role": "user",
"content": "# Ranked frequency\n\nOrder distinct values by decreasing frequency. Ties are resolved by choosing the smaller value first. Print the value at rank 3; if fewer than 3 distinct values exist, print the last value in this ordering.\n\n## Input format\nThe first line contains n. Th... | # Ranked frequency
Order distinct values by decreasing frequency. Ties are resolved by choosing the smaller value first. Print the value at rank 3; if fewer than 3 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": "7\n",
"type": "stdin_stdout"
},
{
"input": "20\n-28 -19 39 -19 -1 5 -3 39 -1 -1 -19 -19 39 -28 8 -26 8 39 -26 -1\n",
"output": "39\n",
"type": "stdin_stdout"
},
{
"i... | [{"input":"8\n-2 -2 -2 5 5 7 8 9\n","output":"7\n","type":"stdin_stdout"},{"input":"20\n-28 -19 39 -19 -1 5 -3 39 -1 -1 -19 -19 39 -28 8 -26 8 39 -26 -1\n","output":"39\n","type":"stdin_stdout"},{"input":"13\n37 -48 -48 25 -48 35 -48 25 37 -48 35 37 37\n","output":"25\n","type":"stdin_stdout"},{"input":"25\n-10 -40 -10... | [
{
"input": "7\n1 1 2 2 3 3 4\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "10\n31 49 32 31 32 31 32 32 31 31\n",
"output": "49\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(3-1,len(a)-1)])
| oellm-code-rlvr | train | python | en | 2 | basic | frequency_rank | [
"hash_maps",
"sorting",
"frequency_counting"
] | oellm-code-generators-0.1.0 | 1,929,812,286,623,702,300 | oellm-code-frequency_rank-000000004 | {"rank":3,"tie_break":"smaller"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 4a16a6109849a7d4d09402eeace2323211f5081857c2e9540e318db5092b7b0f | cccab918cf6abe58b7b6e51be97a75992d0b5a84d1c1148cd78f60d2b5a9b615 | generator:frequency_rank:v0.1 |
652e558841066627ddfff807 | [
{
"role": "user",
"content": "# Affine range queries\n\nTransform every array value x to 4x + (7). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 10007.\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\... | # Affine range queries
Transform every array value x to 4x + (7). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 10007.
## Input format
n q, then n integers, then q lines l r.
## Output format
Print one answer per query.
## Constraints
1 ≤ n ≤ 32; 1 ≤ q ≤ 10.
Example 1
Input:
1 2
0
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": "20 4\n37 -75 -66 63 -66 65 -6 -13 -90 -42 -73 -20 63 94 75 5 -85 -92 49 -18\n3 12\n8 11\n13 18\n19 19\n",
"output": "9085\n... | [{"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":"20 4\n37 -75 -66 63 -66 65 -6 -13 -90 -42 -73 -20 63 94 75 5 -85 -92 49 -18\n3 12\n8 11\n13 18\n19 19\n","output":"9085\n9163\n282\n203\n","type":"stdin_stdout"},{"input":"22 9\n-1 -62 -45 -14 33 -38 57 -82 -62 74 -99 ... | [
{
"input": "1 2\n0\n1 1\n1 1\n",
"output": "7\n7\n",
"type": "stdin_stdout"
},
{
"input": "11 7\n-25 -42 39 -4 -77 93 97 -27 50 74 -3\n7 7\n6 9\n8 8\n10 10\n6 9\n4 9\n10 10\n",
"output": "395\n880\n9906\n303\n880\n570\n303\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]+4*next(it)+(7))
for _ in range(q):
l=next(it); r=next(it); print((p[r]-p[l-1])%10007)
| oellm-code-rlvr | train | python | en | 2 | basic | range_affine_queries | [
"prefix_sums",
"range_queries",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 11,176,836,130,225,920 | oellm-code-range_affine_queries-000000004 | {"a":4,"b":7,"modulus":10007} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | c144481756c9b6d8295774a8442707953fbae43cff194c5d3bc2db1a180cef6f | 4b5092c0a9f9f63b48f38f31880f28312ba14789547f07d2b4cc7e8c00daba21 | generator:range_affine_queries:v0.1 |
4ddb503ca1ae255f6187c5d5 | [
{
"role": "user",
"content": "# Expanded interval union\n\nEach closed integer interval [l,r] is expanded to [l-2,r+2]. 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-2,r+2]. 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 ≤ 17; l ≤ r.
Example 1
Input... | {
"language": "python",
"test_cases": [
{
"input": "4\n0 2\n2 5\n10 10\n8 9\n",
"output": "15\n",
"type": "stdin_stdout"
},
{
"input": "13\n7 16\n38 47\n-10 1\n6 13\n13 21\n36 56\n12 13\n-21 -15\n7 14\n-1 1\n-50 -43\n-5 6\n31 35\n",
"output": "89\n",
"type": "stdin_st... | [{"input":"4\n0 2\n2 5\n10 10\n8 9\n","output":"15\n","type":"stdin_stdout"},{"input":"13\n7 16\n38 47\n-10 1\n6 13\n13 21\n36 56\n12 13\n-21 -15\n7 14\n-1 1\n-50 -43\n-5 6\n31 35\n","output":"89\n","type":"stdin_stdout"},{"input":"2\n-17 -5\n-4 3\n","output":"25\n","type":"stdin_stdout"},{"input":"3\n37 55\n22 41\n-20... | [
{
"input": "1\n0 0\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "4\n-24 -24\n-25 -24\n9 10\n38 47\n",
"output": "26\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=sorted((d[i]-2,d[i+1]+2) 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 | 4 | advanced | interval_union_points | [
"sorting",
"intervals",
"sweep_line"
] | oellm-code-generators-0.1.0 | 1,230,939,994,818,751,000 | oellm-code-interval_union_points-000000004 | {"padding":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | e50e76d4d2cc45f29c5cebffe71fca5cb6df21f5444a2dc5c8ebbd24701419d4 | 8d9d764aec2a67d8ceff71c41d5d51f831f3965d9688acc0c88de65d18bc0b88 | generator:interval_union_points:v0.1 |
40caf5dabc39fbe9471b30f2 | [
{
"role": "user",
"content": "# Cyclic indexed string transform\n\nFor every character whose 1-indexed position is divisible by 2, shift it forward by 9 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 2, shift it forward by 9 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": "iygweucsaqyowmuksiqgoemcka\n",
"type": "stdin_stdout"
},
{
"input": "fiwcddpxfmldvmtdvumxl\n",
"output": "lgmdvmtvvmlvfgpmdlwrf\n",
"type": "stdin_stdout"
},
{
... | [{"input":"abcdefghijklmnopqrstuvwxyz\n","output":"iygweucsaqyowmuksiqgoemcka\n","type":"stdin_stdout"},{"input":"fiwcddpxfmldvmtdvumxl\n","output":"lgmdvmtvvmlvfgpmdlwrf\n","type":"stdin_stdout"},{"input":"kqawejtdwmdkdmtfizyn\n","output":"wyiiotvdtdvwmtsefazk\n","type":"stdin_stdout"},{"input":"icrbjsbkwdymxirm\n","o... | [
{
"input": "a\n",
"output": "a\n",
"type": "stdin_stdout"
},
{
"input": "vyrydfcbjpq\n",
"output": "qyjkcodhrhv\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+9)%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 | 3,915,308,189,106,510,300 | oellm-code-cyclic_string_transform-000000004 | {"reverse":true,"shift":9,"step":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 64851319237f6b228824e87f539145c4ad6222c1661f2e9b025720716e0abee0 | f7803d549f655cc0ee33c597fc1f2d5978aa80b3f25e8a82b83ce1d09bbbb667 | generator:cyclic_string_transform:v0.1 |
a8fe02cc4cc6dec7ef8afbac | [
{
"role": "user",
"content": "# Overlapping shifted-pattern count\n\nShift every character of text forward by 3 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 3 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": "xxxx aa\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "xyxyx aba\n",
"output": "2\n",
"type": "stdin_stdout"... | [{"input":"abcabc abc\n","output":"0\n","type":"stdin_stdout"},{"input":"xxxx aa\n","output":"3\n","type":"stdin_stdout"},{"input":"xyxyx aba\n","output":"2\n","type":"stdin_stdout"},{"input":"xyzxyz abc\n","output":"2\n","type":"stdin_stdout"},{"input":"badcb cbbc\n","output":"0\n","type":"stdin_stdout"},{"input":"cbb... | [
{
"input": "aaaa aa\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "adeadbeeecddabdadaebdadcc ccdec\n",
"output": "0\n",
"type": "stdin_stdout"
}
] | import sys
s,p=sys.stdin.buffer.read().decode().split(); s=''.join(chr((ord(c)-97+3)%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 | 5,967,320,346,955,288,000 | oellm-code-overlapping_pattern_count-000000004 | {"text_caesar_shift":3} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 13 | 1 | deterministic_procedural_generation | Apache-2.0 | d33c4ad93cbf90f82edfa77c930661d31e3372fe7b96827f5fe1adde2ea4ee7a | 2d66bd119d8d2a4fd3357af2a6f6fae35754326e44a58c7370dc06d2971209a7 | generator:overlapping_pattern_count:v0.1 |
9777c9c1346e79b694c41d6c | [
{
"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 ≤ 7.
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":"7 6\nABCAA.\nA.BBAA\nB.CB.A\nACCAB.\n.C.BC.\nBA.AAB\n..AAAC\n","output":"4\n","type":"stdin_stdout"... | [
{
"input": "1 1\nC\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "6 6\nA.BA..\nABB.BB\nCABAAA\n.CCCCA\nBBBBBB\nACBCAA\n",
"output": "5\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 | 2 | basic | grid_neighbor_count | [
"grids",
"neighbourhoods",
"counting"
] | oellm-code-generators-0.1.0 | 4,398,263,068,086,151,700 | oellm-code-grid_neighbor_count-000000004 | {"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 | ab071aa2af75e11133e2735f16d94d33d115baf9364939bc1cf1831748fba331 | 2170ff9c769ce549eb815e2ec377ecbace4a982b60e72b102ced147a526d58ea | generator:grid_neighbor_count:v0.1 |
7a4e754f5f832b782d9c25bd | [
{
"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 6\nS.#3.2\n31#2.G\n","output":"-1\n","type":"stdin_stdout"},{"input":"8 6\nS.111.\n#2#2.3\n1...22\n2#11..\n2... | [
{
"input": "1 2\nSG\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "5 3\nS.3\n1..\n.32\n.21\n1.G\n",
"output": "6\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 | 5 | challenge | weighted_grid_path | [
"graphs",
"dijkstra",
"grids",
"shortest_paths"
] | oellm-code-generators-0.1.0 | 7,178,988,392,473,634,000 | oellm-code-weighted_grid_path-000000004 | {"diagonal":false,"digit_cost":true} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | 83f7f896c5c9356b0ee31f21b4e5c0ffc6e0fbc9c0ce88dfdd0e418082eb40ef | 84fd160695f037c91b411ccc59ce3e2f0ed55469cb717f84f8ece0567f2b46b1 | generator:weighted_grid_path:v0.1 |
a5c9a29446125690cdd13d85 | [
{
"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 6 = 5. 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 6 = 5. 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 ≤ 21; 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": "18 27\n1 2\n1 5\n1 10\n1 16\n2 3\n2 12\n2 17\n3 4\n3 6\n3 7\n3 9\n3 11\n4 8\n5 7\n5 13\n5 17\n7 11\n7 15\n7 17\n9 15\n9 16\n10 12\n10 15\n10... | [{"input":"5 5\n1 2\n2 3\n3 4\n4 5\n1 5\n","output":"3\n","type":"stdin_stdout"},{"input":"18 27\n1 2\n1 5\n1 10\n1 16\n2 3\n2 12\n2 17\n3 4\n3 6\n3 7\n3 9\n3 11\n4 8\n5 7\n5 13\n5 17\n7 11\n7 15\n7 17\n9 15\n9 16\n10 12\n10 15\n10 18\n11 12\n11 14\n11 15\n","output":"12\n","type":"stdin_stdout"},{"input":"9 16\n1 2\n1... | [
{
"input": "1 0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "13 22\n1 2\n1 3\n1 4\n1 12\n2 3\n2 5\n2 10\n3 5\n3 9\n3 10\n3 13\n4 7\n4 11\n5 6\n5 10\n6 7\n6 11\n7 8\n8 9\n9 11\n9 12\n9 13\n",
"output": "10\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%6!=5:s.add(v);q.append(v)
pri... | oellm-code-rlvr | train | python | en | 3 | intermediate | constrained_reachability | [
"graphs",
"breadth_first_search",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 663,009,696,744,332,000 | oellm-code-constrained_reachability-000000004 | {"forbidden_modulus":6,"forbidden_residue":5} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 54c2182f9d736aad6a7e05b3f87cafde87ada53b19452bb3de73229fccedf814 | e1e70a60d5fcf636a8175e809bb9073cdeee3b51bd5d15f35a0a7c1160edf418 | generator:constrained_reachability:v0.1 |
a174e6448dde810bd7b3f289 | [
{
"role": "user",
"content": "# Parameterized coin change\n\nUsing unlimited coins with values [1, 2, 12], count unordered multisets whose sum is exactly n. Print the count modulo 97. 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, 2, 12], count unordered multisets whose sum is exactly n. Print the count modulo 97. 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": "15\n",
"output": "10\n",
"type": "stdin_stdout"
},
{
"input": "140\n",
"output": "68\n",
"type": "stdin_stdout"
},
{
... | [{"input":"1\n","output":"1\n","type":"stdin_stdout"},{"input":"15\n","output":"10\n","type":"stdin_stdout"},{"input":"140\n","output":"68\n","type":"stdin_stdout"},{"input":"28\n","output":"27\n","type":"stdin_stdout"},{"input":"52\n","output":"75\n","type":"stdin_stdout"},{"input":"54\n","output":"80\n","type":"stdin... | [
{
"input": "0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "27\n",
"output": "24\n",
"type": "stdin_stdout"
}
] | import sys
n=int(sys.stdin.readline());d=[0]*(n+1);d[0]=1
for c in [1, 2, 12]:
for x in range(c,n+1):d[x]=(d[x]+d[x-c])%97
print(d[n])
| oellm-code-rlvr | train | python | en | 2 | basic | coin_change | [
"dynamic_programming",
"combinatorics"
] | oellm-code-generators-0.1.0 | 3,763,316,595,027,671,000 | oellm-code-coin_change-000000004 | {"coins":[1,2,12],"modulus":97} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 11 | 1 | deterministic_procedural_generation | Apache-2.0 | b18a9e82583628263ea73dc579046c5312b2a095fbf1c426b452765f5cd987d0 | b90a625c8407dd5da412052b6f326fe830320ed5cdf51b05658e56328a3643bc | generator:coin_change:v0.1 |
da7a98e237e10f81aadd4f73 | [
{
"role": "user",
"content": "# Transformed longest subsequence\n\nTransform each x into (3x + 7) mod 105, 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 (3x + 7) mod 105, 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 ≤ 58.
Example 1
Inpu... | {
"language": "python",
"test_cases": [
{
"input": "7\n3 1 2 2 5 4 6\n",
"output": "4\n",
"type": "stdin_stdout"
},
{
"input": "32\n-36 -15 -66 88 -81 -18 -78 -22 -21 97 99 99 2 -52 -80 8 43 62 74 -59 -37 8 63 -79 93 -45 99 -65 65 -6 5 70\n",
"output": "10\n",
"type":... | [{"input":"7\n3 1 2 2 5 4 6\n","output":"4\n","type":"stdin_stdout"},{"input":"32\n-36 -15 -66 88 -81 -18 -78 -22 -21 97 99 99 2 -52 -80 8 43 62 74 -59 -37 8 63 -79 93 -45 99 -65 65 -6 5 70\n","output":"10\n","type":"stdin_stdout"},{"input":"18\n44 53 24 -78 -60 38 -2 99 -30 65 -54 99 -46 61 86 -40 77 -81\n","output":"... | [
{
"input": "1\n0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "16\n65 43 46 -81 18 0 42 30 70 -39 7 40 -65 -33 -25 -25\n",
"output": "5\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=(3*x+7)%105;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 | 4 | advanced | transformed_lis | [
"binary_search",
"longest_increasing_subsequence",
"dynamic_programming"
] | oellm-code-generators-0.1.0 | 2,463,922,366,781,718,500 | oellm-code-transformed_lis-000000004 | {"a":3,"b":7,"modulus":105,"subsequence":"strictly increasing"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 9f3710a74dcf90e5cd1d7c908188d268eed16fbbe803e7f87d2816e5903d1bf5 | d095b0fbe0ccfc0b33b0340799550e71048550aa325a79a786aaa074de895534 | generator:transformed_lis:v0.1 |
312b57f156e4f6e5ea47deb4 | [
{
"role": "user",
"content": "# Filtered affine sum\n\nKeep every array value x satisfying x mod 4 = 0. Replace each kept value by 9x + (7), 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 contain... | # Filtered affine sum
Keep every array value x satisfying x mod 4 = 0. Replace each kept value by 9x + (7), 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 integ... | {
"language": "python",
"test_cases": [
{
"input": "6\n-7 0 1 7 14 21\n",
"output": "7\n",
"type": "stdin_stdout"
},
{
"input": "10\n29695 -56969 -31820 -66375 -52090 -29238 -23101 -27525 24751 -12\n",
"output": "999713533\n",
"type": "stdin_stdout"
},
{
... | [{"input":"6\n-7 0 1 7 14 21\n","output":"7\n","type":"stdin_stdout"},{"input":"10\n29695 -56969 -31820 -66375 -52090 -29238 -23101 -27525 24751 -12\n","output":"999713533\n","type":"stdin_stdout"},{"input":"12\n16 -29478 61477 2922 98433 -49882 -6860 71105 93534 -15682 -93401 89884\n","output":"747381\n","type":"stdin... | [
{
"input": "1\n0\n",
"output": "7\n",
"type": "stdin_stdout"
},
{
"input": "39\n-91580 94136 78494 74149 3073 81570 -10254 -67010 -22742 -1346 -41688 -94732 13763 3896 4464 21954 43263 38991 19522 -72006 62430 -95029 -34177 -50044 -37407 58996 6670 -17294 20 -83896 -9182 -96922 -85870 -28470 749... | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]
print(sum(9*x+(7) for x in d[1:1+n] if x%4==0)%1000000007)
| oellm-code-rlvr | train | python | en | 4 | advanced | filtered_affine_sum | [
"arrays",
"filtering",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 8,329,698,815,155,339,000 | oellm-code-filtered_affine_sum-000000005 | {"a":9,"b":7,"divisor":4,"modulus":1000000007,"residue":0} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 0145dbf66552f7ff486f0e8af76092094e714e69fcbc8d424c9fab1605c2d21b | 1a148650fc40e96b8f2c5c4bb94a834b02ccf175e7f8c5c11c71f1e2fd7a9754 | generator:filtered_affine_sum:v0.1 |
8e9992c900cc17418fe9cf79 | [
{
"role": "user",
"content": "# Fixed-window extreme\n\nTransform each x into -3x + (7). Among all contiguous windows of exactly 2 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 s... | # Fixed-window extreme
Transform each x into -3x + (7). Among all contiguous windows of exactly 2 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
2 ≤ n ≤ 30.
Example 1
Input:
... | {
"language": "python",
"test_cases": [
{
"input": "4\n-1 0 1 2\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "20\n-146 -39 25 -83 -198 -49 -52 -141 117 104 29 -20 -127 189 -29 172 -55 -114 110 -1\n",
"output": "-649\n",
"type": "stdin_stdout"
},
{... | [{"input":"4\n-1 0 1 2\n","output":"5\n","type":"stdin_stdout"},{"input":"20\n-146 -39 25 -83 -198 -49 -52 -141 117 104 29 -20 -127 189 -29 172 -55 -114 110 -1\n","output":"-649\n","type":"stdin_stdout"},{"input":"11\n-33 -200 158 58 -68 141 32 11 144 84 -54\n","output":"-670\n","type":"stdin_stdout"},{"input":"22\n-14... | [
{
"input": "2\n0 0\n",
"output": "14\n",
"type": "stdin_stdout"
},
{
"input": "29\n-31 -166 -67 -118 66 -14 141 -100 107 13 -23 -56 -115 115 0 71 6 -37 12 -146 62 141 -111 37 158 -27 163 67 186\n",
"output": "-745\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=[-3*x+(7) for x in d[1:1+n]]; k=2
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 | 2 | basic | window_extreme | [
"arrays",
"sliding_window"
] | oellm-code-generators-0.1.0 | 14,474,078,523,531,448 | oellm-code-window_extreme-000000005 | {"extreme":"minimum","offset":7,"scale":-3,"window":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 706b7f08d07ea4b7a0f162b41744a9013f0d5d7fbba509429e9d97b37059c33a | 41ef72af28d0db79bbfcc17db2a20b03baf30467232807ed8dbff992dc987f2e | generator:window_extreme:v0.1 |
189ca0ae193190cc565dbc9f | [
{
"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": "39\n-16 -16 2 -42 -26 10 33 -16 -26 -16 -39 10 10 33 33 -26 -39 6 6 2 -39 -26 6 10 -39 -16 -39 2 10 -39 6 33 6 33 -42 -16 -42 33 6\n",
"outpu... | [{"input":"8\n-2 -2 -2 5 5 7 8 9\n","output":"5\n","type":"stdin_stdout"},{"input":"39\n-16 -16 2 -42 -26 10 33 -16 -26 -16 -39 10 10 33 33 -26 -39 6 6 2 -39 -26 6 10 -39 -16 -39 2 10 -39 6 33 6 33 -42 -16 -42 33 6\n","output":"6\n","type":"stdin_stdout"},{"input":"29\n-4 -35 -46 -46 -4 -43 12 -46 -35 -43 -4 36 -46 36 ... | [
{
"input": "7\n1 1 2 2 3 3 4\n",
"output": "2\n",
"type": "stdin_stdout"
},
{
"input": "35\n10 -19 -15 11 -15 22 -16 -19 -16 10 45 10 11 10 -16 -39 45 10 -15 10 -16 11 -16 22 -16 -19 -39 -15 -15 22 -15 11 22 11 41\n",
"output": "-15\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 | 2 | basic | frequency_rank | [
"hash_maps",
"sorting",
"frequency_counting"
] | oellm-code-generators-0.1.0 | 8,362,802,113,376,675,000 | oellm-code-frequency_rank-000000005 | {"rank":2,"tie_break":"larger"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | f4adaf213eccca1a32e9179a2b17fed85e98ab8cef6d4bca1b90e996cdbfb343 | 8a8d27c9e9e278dcb347f27726c3bc10dc3f536b8fe099c7b3d3e8f907dc5a9a | generator:frequency_rank:v0.1 |
a194b15447247a2747d63800 | [
{
"role": "user",
"content": "# Affine range queries\n\nTransform every array value x to -5x + (4). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 10007.\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... | # Affine range queries
Transform every array value x to -5x + (4). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 10007.
## Input format
n q, then n integers, then q lines l r.
## Output format
Print one answer per query.
## Constraints
1 ≤ n ≤ 62; 1 ≤ q ≤ 19.
Example 1
Input:
1 2
0
1 1... | {
"language": "python",
"test_cases": [
{
"input": "5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n",
"output": "20\n12\n4\n",
"type": "stdin_stdout"
},
{
"input": "51 1\n-94 74 37 -85 38 25 95 89 96 -39 -43 28 -18 38 47 78 -28 -33 52 -21 64 35 74 87 -67 -54 -26 -67 -25 -9 97 -4 -38 53 -91 -17... | [{"input":"5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n","output":"20\n12\n4\n","type":"stdin_stdout"},{"input":"51 1\n-94 74 37 -85 38 25 95 89 96 -39 -43 28 -18 38 47 78 -28 -33 52 -21 64 35 74 87 -67 -54 -26 -67 -25 -9 97 -4 -38 53 -91 -17 33 -50 100 68 4 -97 -66 6 70 -77 69 63 96 -41 8\n33 37\n","output":"320\n","type":"stdin... | [
{
"input": "1 2\n0\n1 1\n1 1\n",
"output": "4\n4\n",
"type": "stdin_stdout"
},
{
"input": "54 18\n-5 -9 88 36 61 -50 14 -70 -43 50 61 -20 -31 94 -96 -90 -81 31 44 19 -90 9 88 -64 20 92 -22 47 -46 -45 89 41 13 -18 -60 -82 91 -40 55 -25 -45 40 -1 54 65 44 29 -2 -92 5 -54 -52 -92 6\n34 36\n44 52\n7... | 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)+(4))
for _ in range(q):
l=next(it); r=next(it); print((p[r]-p[l-1])%10007)
| oellm-code-rlvr | train | python | en | 5 | challenge | range_affine_queries | [
"prefix_sums",
"range_queries",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 5,683,435,409,110,059,000 | oellm-code-range_affine_queries-000000005 | {"a":-5,"b":4,"modulus":10007} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | f858996084e436b09c712486fd8bfa109ad77f273289c63700205cc0d26edfd5 | b6eb6dc92b7915f57d23f65449bcc6a7bd9104c0ca22a5b84f30af676ce0eed7 | generator:range_affine_queries:v0.1 |
63d665373fcd3d1563335436 | [
{
"role": "user",
"content": "# Expanded interval union\n\nEach closed integer interval [l,r] is expanded to [l-2,r+2]. 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-2,r+2]. 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 ≤ 8; l ≤ r.
Example 1
Input:... | {
"language": "python",
"test_cases": [
{
"input": "4\n0 2\n2 5\n10 10\n8 9\n",
"output": "15\n",
"type": "stdin_stdout"
},
{
"input": "8\n-16 -16\n-46 -46\n-12 -10\n4 13\n20 26\n-27 -26\n-10 -9\n7 10\n",
"output": "48\n",
"type": "stdin_stdout"
},
{
"in... | [{"input":"4\n0 2\n2 5\n10 10\n8 9\n","output":"15\n","type":"stdin_stdout"},{"input":"8\n-16 -16\n-46 -46\n-12 -10\n4 13\n20 26\n-27 -26\n-10 -9\n7 10\n","output":"48\n","type":"stdin_stdout"},{"input":"5\n2 10\n-17 -17\n46 54\n8 13\n3 3\n","output":"34\n","type":"stdin_stdout"},{"input":"1\n46 49\n","output":"8\n","t... | [
{
"input": "1\n0 0\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "8\n15 16\n44 49\n0 9\n-49 -49\n39 47\n19 22\n9 9\n-8 0\n",
"output": "54\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=sorted((d[i]-2,d[i+1]+2) 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 | 1 | introductory | interval_union_points | [
"sorting",
"intervals",
"sweep_line"
] | oellm-code-generators-0.1.0 | 1,365,364,737,483,503,000 | oellm-code-interval_union_points-000000005 | {"padding":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | efcd846f955e5f15bd437bacee521517216c9a8d0524cc52b9a0c32b70839dae | 8d9d764aec2a67d8ceff71c41d5d51f831f3965d9688acc0c88de65d18bc0b88 | generator:interval_union_points:v0.1 |
658dca8091c0da249e32c6ea | [
{
"role": "user",
"content": "# Cyclic indexed string transform\n\nFor every character whose 1-indexed position is divisible by 5, shift it forward by 8 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 8 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": "zgxwvubsrqpwnmlkrihgfmdcba\n",
"type": "stdin_stdout"
},
{
"input": "pafjraabolfcokjsxopxjlh\n",
"output": "hljfpoxsrkocftobaazjfap\n",
"type": "stdin_stdout"
},
{
... | [{"input":"abcdefghijklmnopqrstuvwxyz\n","output":"zgxwvubsrqpwnmlkrihgfmdcba\n","type":"stdin_stdout"},{"input":"pafjraabolfcokjsxopxjlh\n","output":"hljfpoxsrkocftobaazjfap\n","type":"stdin_stdout"},{"input":"zyttqvmpdzasl\n","output":"lsahdpmvyttyz\n","type":"stdin_stdout"},{"input":"wlhhrcduouqm\n","output":"mqcoud... | [
{
"input": "a\n",
"output": "a\n",
"type": "stdin_stdout"
},
{
"input": "jcdeiauskqmmozivfotecqmcxdakmlcyoo\n",
"output": "ooyctmkadfcmqcmtofvqzommyksuaqedcj\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+8)%26+97) if i%5==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 | 3,550,480,518,974,524,400 | oellm-code-cyclic_string_transform-000000005 | {"reverse":true,"shift":8,"step":5} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 7f0a490dc5fe0ba44d69300445c7e1d6f47d0cc1de6abe41cce5f7bd65419d53 | d59eb22a19622d3a83b2b1f5401e2db101b965ce679e8d9b9e4443717c7a75e4 | generator:cyclic_string_transform:v0.1 |
87dddc80db6aa2066dcb51b7 | [
{
"role": "user",
"content": "# Overlapping shifted-pattern count\n\nShift every character of text forward by 3 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 3 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": "xxxx aa\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "xyxyx aba\n",
"output": "2\n",
"type": "stdin_stdout"... | [{"input":"abcabc abc\n","output":"0\n","type":"stdin_stdout"},{"input":"xxxx aa\n","output":"3\n","type":"stdin_stdout"},{"input":"xyxyx aba\n","output":"2\n","type":"stdin_stdout"},{"input":"xyzxyz abc\n","output":"2\n","type":"stdin_stdout"},{"input":"eeebccbadddccbbaacccb babda\n","output":"0\n","type":"stdin_stdou... | [
{
"input": "aaaa aa\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "bcabccebcdeecbdccc ecea\n",
"output": "0\n",
"type": "stdin_stdout"
}
] | import sys
s,p=sys.stdin.buffer.read().decode().split(); s=''.join(chr((ord(c)-97+3)%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 | 2,183,289,393,195,609,600 | oellm-code-overlapping_pattern_count-000000005 | {"text_caesar_shift":3} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 13 | 1 | deterministic_procedural_generation | Apache-2.0 | 464cd33ee8f1f11eec08ea95b8059487a4c635ef923c61e175ebc4be8ba0bc32 | 2d66bd119d8d2a4fd3357af2a6f6fae35754326e44a58c7370dc06d2971209a7 | generator:overlapping_pattern_count:v0.1 |
54dd2b4527e926ad7ddd0793 | [
{
"role": "user",
"content": "# Grid neighbour threshold\n\nCount cells containing 'C' that have at least 2 other 'C' cells among their four orthogonal 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 the ... | # Grid neighbour threshold
Count cells containing 'C' that have at least 2 other 'C' cells among their four orthogonal 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 ≤ 7.
Example 1
Inp... | {
"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": "0\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":"0\n","type":"stdin_stdout"},{"input":"3 3\nAAA\nACA\nAAA\n","output":"0\n","type":"stdin_stdout"},{"input":"4 3\nAC.\nAAC\nCBB\n.CC\n","output":"0\n","type":"stdin_stdout"},{"input":"5 5\nABCCB\n...CA\nACA.A... | [
{
"input": "1 1\nC\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "6 5\nC.ACA\nAA.BC\nBACBB\nACAAC\n.BCCA\n.CB.C\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)]+([]);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 | 2 | basic | grid_neighbor_count | [
"grids",
"neighbourhoods",
"counting"
] | oellm-code-generators-0.1.0 | 3,742,049,877,239,200,000 | oellm-code-grid_neighbor_count-000000005 | {"diagonal":false,"target":"C","threshold":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | f2faabfa36c0fc2d723dd7a665ba5e913e7469fb385391b032cc347ee4c65cd0 | 26a436c71695af56823448fb7044e295d9ed5924873ec58ba3bcffaeddaf9e1f | generator:grid_neighbor_count:v0.1 |
23c786abed4ad292280e0fc1 | [
{
"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 3\nS..\n211\n2.G\n","output":"2\n","type":"stdin_stdout"},{"input":"3 3\nS..\n3.1\n#.G\n","output":"2\n","typ... | [
{
"input": "1 2\nSG\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "4 5\nS.223\n1.##1\n.#2.#\n.##.G\n",
"output": "5\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 | 7,330,078,093,123,169,000 | oellm-code-weighted_grid_path-000000005 | {"diagonal":true,"digit_cost":true} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | d0470b05797bf1f56b2e3f89e35078df277cba04d0044357fde465906e26a577 | 9261f355670ed8256e2a2b2c570685cfe7cc5123e90c17df9216ddfcf935d11a | generator:weighted_grid_path:v0.1 |
e7fa40eebbd00c31f7296738 | [
{
"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 6 = 5. 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 6 = 5. 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 ≤ 26; 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": "25 46\n1 2\n1 3\n1 4\n1 6\n1 7\n1 18\n1 19\n2 5\n2 8\n2 11\n2 12\n2 14\n2 17\n2 20\n3 4\n3 7\n3 16\n3 24\n4 6\n4 10\n4 16\n4 21\n5 8\n5 17\n... | [{"input":"5 5\n1 2\n2 3\n3 4\n4 5\n1 5\n","output":"3\n","type":"stdin_stdout"},{"input":"25 46\n1 2\n1 3\n1 4\n1 6\n1 7\n1 18\n1 19\n2 5\n2 8\n2 11\n2 12\n2 14\n2 17\n2 20\n3 4\n3 7\n3 16\n3 24\n4 6\n4 10\n4 16\n4 21\n5 8\n5 17\n5 20\n5 22\n6 7\n6 9\n6 10\n6 14\n7 16\n7 19\n7 22\n8 11\n8 13\n8 16\n8 20\n8 21\n10 20\n... | [
{
"input": "1 0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "14 23\n1 2\n1 3\n1 7\n1 10\n1 12\n1 14\n2 4\n2 13\n2 14\n3 9\n3 12\n4 5\n4 10\n5 6\n5 13\n6 10\n6 11\n6 12\n7 8\n7 14\n8 13\n10 14\n11 14\n",
"output": "11\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%6!=5:s.add(v);q.append(v)
pri... | oellm-code-rlvr | train | python | en | 4 | advanced | constrained_reachability | [
"graphs",
"breadth_first_search",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 2,776,391,460,280,192,500 | oellm-code-constrained_reachability-000000005 | {"forbidden_modulus":6,"forbidden_residue":5} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 0.666667 | deterministic_procedural_generation | Apache-2.0 | 1b56b5b1fdcdf763e0627c5fa0351d448db4265ae4401185334361705375c8de | e1e70a60d5fcf636a8175e809bb9073cdeee3b51bd5d15f35a0a7c1160edf418 | generator:constrained_reachability:v0.1 |
8341f7f1a30b8f9e19b4268c | [
{
"role": "user",
"content": "# Parameterized coin change\n\nUsing unlimited coins with values [1, 3, 7, 8], 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 ... | # Parameterized coin change
Using unlimited coins with values [1, 3, 7, 8], 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 ≤... | {
"language": "python",
"test_cases": [
{
"input": "1\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "19\n",
"output": "22\n",
"type": "stdin_stdout"
},
{
"input": "120\n",
"output": "30\n",
"type": "stdin_stdout"
},
{
... | [{"input":"1\n","output":"1\n","type":"stdin_stdout"},{"input":"19\n","output":"22\n","type":"stdin_stdout"},{"input":"120\n","output":"30\n","type":"stdin_stdout"},{"input":"2\n","output":"1\n","type":"stdin_stdout"},{"input":"45\n","output":"58\n","type":"stdin_stdout"},{"input":"7\n","output":"4\n","type":"stdin_std... | [
{
"input": "0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "10\n",
"output": "7\n",
"type": "stdin_stdout"
}
] | import sys
n=int(sys.stdin.readline());d=[0]*(n+1);d[0]=1
for c in [1, 3, 7, 8]:
for x in range(c,n+1):d[x]=(d[x]+d[x-c])%101
print(d[n])
| oellm-code-rlvr | train | python | en | 1 | introductory | coin_change | [
"dynamic_programming",
"combinatorics"
] | oellm-code-generators-0.1.0 | 6,483,232,218,129,721,000 | oellm-code-coin_change-000000005 | {"coins":[1,3,7,8],"modulus":101} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 11 | 1 | deterministic_procedural_generation | Apache-2.0 | 8fa022012ad061eafc202943944f2843b37785cee415e7200dd82c81e78fe736 | 88fac738a6b23b2f0c20c4b3e76fdd1b438f008d81975929e1648297f4911cf1 | generator:coin_change:v0.1 |
a542d3020ce50e5c69c7f050 | [
{
"role": "user",
"content": "# Transformed longest subsequence\n\nTransform each x into (7x + 10) mod 42, 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 + 10) mod 42, 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": "4\n",
"type": "stdin_stdout"
},
{
"input": "19\n-24 -22 -12 -1 35 63 -64 69 -44 67 2 66 76 81 -64 72 -81 -58 -29\n",
"output": "6\n",
"type": "stdin_stdout"
},
{
"input":... | [{"input":"7\n3 1 2 2 5 4 6\n","output":"4\n","type":"stdin_stdout"},{"input":"19\n-24 -22 -12 -1 35 63 -64 69 -44 67 2 66 76 81 -64 72 -81 -58 -29\n","output":"6\n","type":"stdin_stdout"},{"input":"18\n40 97 -51 -16 64 74 37 -39 59 -14 73 17 -8 -35 -43 -71 68 -81\n","output":"7\n","type":"stdin_stdout"},{"input":"24\n... | [
{
"input": "1\n0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "4\n-67 57 -67 -19\n",
"output": "3\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+10)%42;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 | 6,495,812,105,143,774,000 | oellm-code-transformed_lis-000000005 | {"a":7,"b":10,"modulus":42,"subsequence":"non-decreasing"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 384165cd2a8dc3a1e00c125282f2c157423713fca650910e79f03dc8f39e43bd | 7fc44bee3f0c5259bd60c328306e7ceec644fa36433c5c81b02d8bea74887915 | generator:transformed_lis:v0.1 |
b9bdd18d215221237ea14621 | [
{
"role": "user",
"content": "# Filtered affine sum\n\nKeep every array value x satisfying x mod 9 = 6. Replace each kept value by 4x + (3), sum the results, and reduce the sum modulo 101. Python-style non-negative remainders are used.\n\n## Input format\nThe first line contains n. The second contains n int... | # Filtered affine sum
Keep every array value x satisfying x mod 9 = 6. Replace each kept value by 4x + (3), sum the results, and reduce the sum modulo 101. 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": "5\n-30 -4 24 -100 60\n",
"output": "23\n",
"type": "stdin_stdout"
},
{
"input": "15\n-44 -5 90 84 -85 91 -1 -8 78 55 76 97 -3... | [{"input":"6\n-7 0 1 7 14 21\n","output":"0\n","type":"stdin_stdout"},{"input":"5\n-30 -4 24 -100 60\n","output":"23\n","type":"stdin_stdout"},{"input":"15\n-44 -5 90 84 -85 91 -1 -8 78 55 76 97 -35 89 -42\n","output":"12\n","type":"stdin_stdout"},{"input":"2\n-84 -13\n","output":"71\n","type":"stdin_stdout"},{"input":... | [
{
"input": "1\n0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "3\n21 51 20\n",
"output": "5\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]
print(sum(4*x+(3) for x in d[1:1+n] if x%9==6)%101)
| oellm-code-rlvr | train | python | en | 1 | introductory | filtered_affine_sum | [
"arrays",
"filtering",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 5,617,440,258,313,249,000 | oellm-code-filtered_affine_sum-000000006 | {"a":4,"b":3,"divisor":9,"modulus":101,"residue":6} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | c07bf87522682a2cb331596dd3d4e0cea570278a4ba139a010cd0e905cafa0d1 | 216e6449248921a09d3bf9560e67f003293556992a4aeddee0e98a066f297668 | generator:filtered_affine_sum:v0.1 |
2aadd16773d316c76dc3cc07 | [
{
"role": "user",
"content": "# Fixed-window extreme\n\nTransform each x into -3x + (2). 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 s... | # Fixed-window extreme
Transform each x into -3x + (2). 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 ≤ 34.
Example 1
Input:
... | {
"language": "python",
"test_cases": [
{
"input": "8\n-1 0 1 2 3 4 5 6\n",
"output": "-51\n",
"type": "stdin_stdout"
},
{
"input": "11\n72 192 -156 -181 114 -181 139 0 -158 64 125\n",
"output": "45\n",
"type": "stdin_stdout"
},
{
"input": "12\n194 101 1... | [{"input":"8\n-1 0 1 2 3 4 5 6\n","output":"-51\n","type":"stdin_stdout"},{"input":"11\n72 192 -156 -181 114 -181 139 0 -158 64 125\n","output":"45\n","type":"stdin_stdout"},{"input":"12\n194 101 113 -147 -42 186 161 -104 -191 56 -117 79\n","output":"-1203\n","type":"stdin_stdout"},{"input":"34\n-137 71 95 -30 -118 -36... | [
{
"input": "6\n0 0 0 0 0 0\n",
"output": "12\n",
"type": "stdin_stdout"
},
{
"input": "26\n90 81 12 -176 41 -200 -67 -67 -87 185 1 -41 -41 -47 13 26 -166 -75 81 -175 -183 -147 148 177 -108 -187\n",
"output": "-198\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=[-3*x+(2) 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 | 2 | basic | window_extreme | [
"arrays",
"sliding_window"
] | oellm-code-generators-0.1.0 | 5,520,633,613,608,185,000 | oellm-code-window_extreme-000000006 | {"extreme":"minimum","offset":2,"scale":-3,"window":6} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | c73da93b9cc8f1b11616d882a92de5db96aac674f90846e4d8c8612d5bd6a1a6 | eaba9f2fd4fc9cb465049a8864a2ed1a9519034d08475319058e3271dc45d8f8 | generator:window_extreme:v0.1 |
c5420f46e42d971311302b44 | [
{
"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 3; if fewer than 3 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 3; if fewer than 3 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": "9\n",
"type": "stdin_stdout"
},
{
"input": "26\n40 38 38 27 50 50 50 16 -8 50 16 -20 40 33 -8 16 -8 38 33 40 16 38 38 16 50 38\n",
"output": "16\n",
"type": "stdin_stdout"
},
... | [{"input":"8\n-2 -2 -2 5 5 7 8 9\n","output":"9\n","type":"stdin_stdout"},{"input":"26\n40 38 38 27 50 50 50 16 -8 50 16 -20 40 33 -8 16 -8 38 33 40 16 38 38 16 50 38\n","output":"16\n","type":"stdin_stdout"},{"input":"31\n-1 -26 26 45 -37 -26 -26 -26 -5 16 -14 -37 39 26 -5 45 45 -14 -5 -26 -14 -37 -14 -26 -37 16 -1 45... | [
{
"input": "7\n1 1 2 2 3 3 4\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "15\n-28 0 0 0 -8 0 -8 -28 -28 -28 0 -18 -8 0 16\n",
"output": "-8\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(3-1,len(a)-1)])
| oellm-code-rlvr | train | python | en | 2 | basic | frequency_rank | [
"hash_maps",
"sorting",
"frequency_counting"
] | oellm-code-generators-0.1.0 | 9,054,201,843,615,343,000 | oellm-code-frequency_rank-000000006 | {"rank":3,"tie_break":"larger"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 96618fa825dd900a4ffc09a24e5640a21801ac9768943b87768c7dc556f1fcd7 | f4c578cf28ebb3c5f9a281e79326df99d1f808618d90d86ce8c7250d05e54524 | generator:frequency_rank:v0.1 |
c7aa7b031368fa208e8178b7 | [
{
"role": "user",
"content": "# Affine range queries\n\nTransform every array value x to -3x + (-6). 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 -3x + (-6). 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": "67\n79\n91\n",
"type": "stdin_stdout"
},
{
"input": "24 3\n-79 -28 -98 67 34 5 63 -35 -29 93 -80 68 75 -96 84 57 -85 -45 -87 93 71 -34 -100 -26\n17 22\n2 5\n19 24\n",
"output"... | [{"input":"5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n","output":"67\n79\n91\n","type":"stdin_stdout"},{"input":"24 3\n-79 -28 -98 67 34 5 63 -35 -29 93 -80 68 75 -96 84 57 -85 -45 -87 93 71 -34 -100 -26\n17 22\n2 5\n19 24\n","output":"31\n51\n19\n","type":"stdin_stdout"},{"input":"19 4\n55 59 60 -7 -92 -85 -3 11 1 26 -53 -72 -3... | [
{
"input": "1 2\n0\n1 1\n1 1\n",
"output": "91\n91\n",
"type": "stdin_stdout"
},
{
"input": "29 6\n-92 90 -86 -58 -91 -67 -94 -63 -27 -7 -73 93 -17 28 71 80 -39 -67 29 82 -75 -6 -11 -26 97 46 -61 100 -84\n17 27\n22 24\n21 28\n6 7\n7 12\n28 29\n",
"output": "27\n14\n51\n83\n89\n37\n",
"ty... | 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]+-3*next(it)+(-6))
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 | 5,249,336,648,125,940,000 | oellm-code-range_affine_queries-000000006 | {"a":-3,"b":-6,"modulus":97} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 4b6782eafad879305422740fbe75db2952e58756bf2279fd5acb6ac3f6464d0a | de7430f72943c340bec15d970b93361c56986af7aaf8ccec4991bc2c17d29103 | generator:range_affine_queries:v0.1 |
c673d17cfd3922e83470e6a4 | [
{
"role": "user",
"content": "# Expanded interval union\n\nEach closed integer interval [l,r] is expanded to [l-2,r+2]. 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-2,r+2]. 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 ≤ 14; l ≤ r.
Example 1
Input... | {
"language": "python",
"test_cases": [
{
"input": "4\n0 2\n2 5\n10 10\n8 9\n",
"output": "15\n",
"type": "stdin_stdout"
},
{
"input": "12\n44 46\n-24 -22\n-35 -18\n50 63\n-17 -1\n3 3\n48 54\n-25 -18\n-44 -34\n13 28\n-47 -33\n-40 -25\n",
"output": "99\n",
"type": "std... | [{"input":"4\n0 2\n2 5\n10 10\n8 9\n","output":"15\n","type":"stdin_stdout"},{"input":"12\n44 46\n-24 -22\n-35 -18\n50 63\n-17 -1\n3 3\n48 54\n-25 -18\n-44 -34\n13 28\n-47 -33\n-40 -25\n","output":"99\n","type":"stdin_stdout"},{"input":"2\n37 47\n-34 -19\n","output":"35\n","type":"stdin_stdout"},{"input":"8\n-43 -34\n-... | [
{
"input": "1\n0 0\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"input": "14\n-13 4\n-15 -15\n-47 -41\n32 45\n-48 -32\n-28 -19\n-8 4\n4 7\n-36 -22\n-14 -12\n41 51\n29 31\n-2 4\n9 21\n",
"output": "101\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=sorted((d[i]-2,d[i+1]+2) 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 | 3 | intermediate | interval_union_points | [
"sorting",
"intervals",
"sweep_line"
] | oellm-code-generators-0.1.0 | 1,326,535,688,621,671,000 | oellm-code-interval_union_points-000000006 | {"padding":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | ecd1d2250a3d23fe3d14b2583988c6af86a2eb53cc12e1ff15adc4ecfef49bbd | 8d9d764aec2a67d8ceff71c41d5d51f831f3965d9688acc0c88de65d18bc0b88 | generator:interval_union_points:v0.1 |
026e146f7025fd3721d097ae | [
{
"role": "user",
"content": "# Overlapping shifted-pattern count\n\nShift every character of text forward by 16 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 16 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": "kkkk aa\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "klklk aba\n",
"output": "2\n",
"type": "stdin_stdout"... | [{"input":"abcabc abc\n","output":"0\n","type":"stdin_stdout"},{"input":"kkkk aa\n","output":"3\n","type":"stdin_stdout"},{"input":"klklk aba\n","output":"2\n","type":"stdin_stdout"},{"input":"klmklm abc\n","output":"2\n","type":"stdin_stdout"},{"input":"cbedaacabccbadebadceddc e\n","output":"0\n","type":"stdin_stdout"... | [
{
"input": "aaaa aa\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "ccaa bc\n",
"output": "0\n",
"type": "stdin_stdout"
}
] | import sys
s,p=sys.stdin.buffer.read().decode().split(); s=''.join(chr((ord(c)-97+16)%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 | 4,985,605,156,001,200,000 | oellm-code-overlapping_pattern_count-000000006 | {"text_caesar_shift":16} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 13 | 1 | deterministic_procedural_generation | Apache-2.0 | d26dab970960a3ca06fd605859c49f34d6ef8d95b7f3fd219c486a6770633101 | b4ef554b84561d16e5c41305c6b6761285ec828ce6f5f9b60f7412bb0e4d2e48 | generator:overlapping_pattern_count:v0.1 |
550a7ce035c245ff2609a1c2 | [
{
"role": "user",
"content": "# Grid neighbour threshold\n\nCount cells containing 'C' that have at least 1 other 'C' cells among their four orthogonal 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 the ... | # Grid neighbour threshold
Count cells containing 'C' that have at least 1 other 'C' cells among their four orthogonal 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
Inp... | {
"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": "0\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":"0\n","type":"stdin_stdout"},{"input":"3 3\nAAA\nACA\nAAA\n","output":"0\n","type":"stdin_stdout"},{"input":"9 8\nAABACCCA\nCABACAAB\nAC.ACAAB\nBA..CCA.\nACA.ACAA\n.BCCB.BC\nBA..A.B.\nBABB.BCC\nBCBC..A.\n","o... | [
{
"input": "1 1\nC\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "4 6\n.C.ABC\nABBCAC\nACAAAA\nCAA.CC\n",
"output": "4\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)]+([]);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 | 3 | intermediate | grid_neighbor_count | [
"grids",
"neighbourhoods",
"counting"
] | oellm-code-generators-0.1.0 | 8,570,069,938,617,723,000 | oellm-code-grid_neighbor_count-000000006 | {"diagonal":false,"target":"C","threshold":1} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | b070c29e294571d97f979cde68e85c4da6bf7573a82c0afbce496bb03e0939d0 | 586382ea8a9ede5788f2878733ceea99ee437ee3cbcf098f319347530d294ef7 | generator:grid_neighbor_count:v0.1 |
da41411c8c3a7fe1217a8b09 | [
{
"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":"6 7\nS.#.#..\n1133...\n112.322\n22#.##.\n1#1.111\n.21#..G\n","output":"12\n","type":"stdin_stdout"},{"input":"... | [
{
"input": "1 2\nSG\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "3 5\nS.3..\n...2#\n13..G\n",
"output": "6\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 | 5 | challenge | weighted_grid_path | [
"graphs",
"dijkstra",
"grids",
"shortest_paths"
] | oellm-code-generators-0.1.0 | 7,052,315,672,277,417,000 | oellm-code-weighted_grid_path-000000006 | {"diagonal":false,"digit_cost":true} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | 30481bbf9119479490fa710a3254eff91799fb17343f9c5c96aca7674837f558 | 84fd160695f037c91b411ccc59ce3e2f0ed55469cb717f84f8ece0567f2b46b1 | generator:weighted_grid_path:v0.1 |
5f3b079299e1528c3f19eb1f | [
{
"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 5 = 3. 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 5 = 3. 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": "3\n",
"type": "stdin_stdout"
},
{
"input": "14 25\n1 2\n1 3\n1 5\n1 10\n1 12\n1 13\n2 6\n2 7\n2 8\n2 9\n2 10\n2 11\n2 12\n3 4\n3 5\n4 5\n4 13\n6 7\n6 9\n6 10\n6 11\n7 12\n8 14\n10 11\n... | [{"input":"5 5\n1 2\n2 3\n3 4\n4 5\n1 5\n","output":"3\n","type":"stdin_stdout"},{"input":"14 25\n1 2\n1 3\n1 5\n1 10\n1 12\n1 13\n2 6\n2 7\n2 8\n2 9\n2 10\n2 11\n2 12\n3 4\n3 5\n4 5\n4 13\n6 7\n6 9\n6 10\n6 11\n7 12\n8 14\n10 11\n11 14\n","output":"10\n","type":"stdin_stdout"},{"input":"6 9\n1 2\n1 3\n1 4\n1 5\n2 5\n2... | [
{
"input": "1 0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "14 24\n1 2\n2 3\n2 5\n2 9\n2 10\n3 4\n3 5\n3 6\n3 7\n4 6\n4 8\n4 10\n4 14\n5 8\n5 10\n6 7\n6 11\n7 8\n8 10\n8 14\n9 10\n9 13\n11 12\n11 14\n",
"output": "10\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%5!=3: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,025,767,336,308,880,000 | oellm-code-constrained_reachability-000000006 | {"forbidden_modulus":5,"forbidden_residue":3} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | d42ee01fe2762458ff5dbcd0276db6655ba93a5eb3e8abaea72d235a223cda38 | 0d095787f52ddada2a701afdcaac4beb844fccbd94c0485e7f2599e7fb1cd7d7 | generator:constrained_reachability:v0.1 |
583377ecbc22c265de2c9a73 | [
{
"role": "user",
"content": "# Parameterized coin change\n\nUsing unlimited coins with values [1, 2, 8, 12, 13], count unordered multisets whose sum is exactly n. Print the count modulo 97. The empty multiset is the unique way to form 0.\n\n## Input format\nOne integer n.\n\n## Output format\nPrint the num... | # Parameterized coin change
Using unlimited coins with values [1, 2, 8, 12, 13], count unordered multisets whose sum is exactly n. Print the count modulo 97. 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 ≤... | {
"language": "python",
"test_cases": [
{
"input": "1\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "36\n",
"output": "37\n",
"type": "stdin_stdout"
},
{
"input": "140\n",
"output": "58\n",
"type": "stdin_stdout"
},
{
... | [{"input":"1\n","output":"1\n","type":"stdin_stdout"},{"input":"36\n","output":"37\n","type":"stdin_stdout"},{"input":"140\n","output":"58\n","type":"stdin_stdout"},{"input":"28\n","output":"70\n","type":"stdin_stdout"},{"input":"55\n","output":"66\n","type":"stdin_stdout"},{"input":"8\n","output":"6\n","type":"stdin_s... | [
{
"input": "0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "74\n",
"output": "10\n",
"type": "stdin_stdout"
}
] | import sys
n=int(sys.stdin.readline());d=[0]*(n+1);d[0]=1
for c in [1, 2, 8, 12, 13]:
for x in range(c,n+1):d[x]=(d[x]+d[x-c])%97
print(d[n])
| oellm-code-rlvr | train | python | en | 2 | basic | coin_change | [
"dynamic_programming",
"combinatorics"
] | oellm-code-generators-0.1.0 | 3,150,415,468,542,390,000 | oellm-code-coin_change-000000006 | {"coins":[1,2,8,12,13],"modulus":97} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 11 | 1 | deterministic_procedural_generation | Apache-2.0 | c6230d46378b58db0cab7624a457db00733a86543507da421269d556bd8db59b | 3cb403dc1718c329c058e94897ec60db48ee484bc3de15146206ac141a22f03f | generator:coin_change:v0.1 |
181452e64e6879cc811ab94e | [
{
"role": "user",
"content": "# Transformed longest subsequence\n\nTransform each x into (4x + 18) mod 72, 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 (4x + 18) mod 72, 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 ≤ 58.
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": "3\n37 -88 61\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "4\n70 14 25 -79\n",
"output": "3\n",
"type... | [{"input":"7\n3 1 2 2 5 4 6\n","output":"5\n","type":"stdin_stdout"},{"input":"3\n37 -88 61\n","output":"3\n","type":"stdin_stdout"},{"input":"4\n70 14 25 -79\n","output":"3\n","type":"stdin_stdout"},{"input":"47\n-64 -14 -58 89 48 -39 -12 -51 82 62 -74 98 60 31 -33 61 79 93 63 37 -69 60 -16 -64 47 14 57 -43 -94 34 -40... | [
{
"input": "1\n0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "29\n-78 -27 99 -47 -46 27 52 -56 -3 -15 98 -54 -40 -19 -52 22 94 81 53 -57 50 -43 94 -97 72 90 -5 -29 -25\n",
"output": "10\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+18)%72;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 | 4 | advanced | transformed_lis | [
"binary_search",
"longest_increasing_subsequence",
"dynamic_programming"
] | oellm-code-generators-0.1.0 | 2,659,018,158,816,685,000 | oellm-code-transformed_lis-000000006 | {"a":4,"b":18,"modulus":72,"subsequence":"non-decreasing"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 356db3e054bf29ada88695319b960d08d1ff23eb37638ea792f92b0ef7478d45 | 5a64a0e33f9b9833a3baca0cf3537c6109b8e26298ca1baf99e9726816c1c668 | generator:transformed_lis:v0.1 |
26c8b259764d92bbd7b7ecc9 | [
{
"role": "user",
"content": "# Filtered affine sum\n\nKeep every array value x satisfying x mod 4 = 1. Replace each kept value by -6x + (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 4 = 1. Replace each kept value by -6x + (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": "9962\n",
"type": "stdin_stdout"
},
{
"input": "11\n681 17 364 13 -101 50 49 584 397 -867 158\n",
"output": "8357\n",
"type": "stdin_stdout"
},
{
"input": "34\n-361 -960 ... | [{"input":"6\n-7 0 1 7 14 21\n","output":"9962\n","type":"stdin_stdout"},{"input":"11\n681 17 364 13 -101 50 49 584 397 -867 158\n","output":"8357\n","type":"stdin_stdout"},{"input":"34\n-361 -960 -128 967 -528 -567 453 683 -361 617 89 855 -927 975 -171 -337 789 41 -102 346 -669 -101 158 382 687 116 871 -131 757 -22 54... | [
{
"input": "1\n0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "23\n957 949 -809 13 446 -571 344 53 904 -235 363 -16 646 250 -308 -892 82 794 91 747 -620 -628 516\n",
"output": "3101\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]
print(sum(-6*x+(15) for x in d[1:1+n] if x%4==1)%10007)
| oellm-code-rlvr | train | python | en | 2 | basic | filtered_affine_sum | [
"arrays",
"filtering",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 6,349,845,351,609,545,000 | oellm-code-filtered_affine_sum-000000007 | {"a":-6,"b":15,"divisor":4,"modulus":10007,"residue":1} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 3fc85dc64ba5d6501694b23c2b0865c07f230d4365021261f816ef868563f3ab | 52401c54cf3fdeff53b640aa31874968fb30ecf82b02dc0e872728b036eb9c90 | generator:filtered_affine_sum:v0.1 |
daa918509d577a78355595f3 | [
{
"role": "user",
"content": "# Fixed-window extreme\n\nTransform each x into -3x + (-1). Among all contiguous windows of exactly 3 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 ... | # Fixed-window extreme
Transform each x into -3x + (-1). Among all contiguous windows of exactly 3 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
3 ≤ n ≤ 21.
Example 1
Input:... | {
"language": "python",
"test_cases": [
{
"input": "5\n-1 0 1 2 3\n",
"output": "-3\n",
"type": "stdin_stdout"
},
{
"input": "18\n-51 46 59 23 32 75 -1 -13 -96 58 97 49 -12 -52 -100 -99 96 -38\n",
"output": "750\n",
"type": "stdin_stdout"
},
{
"input": "... | [{"input":"5\n-1 0 1 2 3\n","output":"-3\n","type":"stdin_stdout"},{"input":"18\n-51 46 59 23 32 75 -1 -13 -96 58 97 49 -12 -52 -100 -99 96 -38\n","output":"750\n","type":"stdin_stdout"},{"input":"3\n13 -18 -24\n","output":"84\n","type":"stdin_stdout"},{"input":"19\n76 -25 15 -69 -60 4 -18 89 4 -98 73 9 43 -96 -9 85 -6... | [
{
"input": "3\n0 0 0\n",
"output": "-3\n",
"type": "stdin_stdout"
},
{
"input": "11\n84 -55 -58 -74 42 -52 31 -91 91 -63 -52\n",
"output": "558\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=3
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 | 1 | introductory | window_extreme | [
"arrays",
"sliding_window"
] | oellm-code-generators-0.1.0 | 8,912,556,962,195,172,000 | oellm-code-window_extreme-000000007 | {"extreme":"maximum","offset":-1,"scale":-3,"window":3} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | e7948997e680609966089fb22f7220634e8669a5a4a0a358b85a4e14253eac4e | 817b3b096a49a876b7a08f3be08304e1dfcfc2ffc959be0ca2d916340e6f2309 | generator:window_extreme:v0.1 |
1ace6b4b0984856f775c0d76 | [
{
"role": "user",
"content": "# Ranked frequency\n\nOrder distinct values by decreasing frequency. Ties are resolved by choosing the smaller 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. Th... | # Ranked frequency
Order distinct values by decreasing frequency. Ties are resolved by choosing the smaller 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\n-7 16 -7 48 48 16 -7 48 -7 -7 48 -7 16 48\n",
"output": "48\n",
"type": "stdin_stdout"
},
{
"input": "28\n37 -23 -23 ... | [{"input":"8\n-2 -2 -2 5 5 7 8 9\n","output":"5\n","type":"stdin_stdout"},{"input":"14\n-7 16 -7 48 48 16 -7 48 -7 -7 48 -7 16 48\n","output":"48\n","type":"stdin_stdout"},{"input":"28\n37 -23 -23 2 2 -32 -23 12 -23 12 -37 -37 12 37 -23 -32 -32 12 -37 37 37 -37 -23 -32 -37 2 12 -32\n","output":"-37\n","type":"stdin_std... | [
{
"input": "7\n1 1 2 2 3 3 4\n",
"output": "2\n",
"type": "stdin_stdout"
},
{
"input": "16\n-14 -44 -22 -22 -14 -14 -22 -17 -17 -22 -17 -22 -14 7 -14 -22\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 | 2 | basic | frequency_rank | [
"hash_maps",
"sorting",
"frequency_counting"
] | oellm-code-generators-0.1.0 | 8,336,529,795,321,022,000 | oellm-code-frequency_rank-000000007 | {"rank":2,"tie_break":"smaller"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 8b8a6b5c73f10f9427f84c07d4aac7bc258362caf5397503c9812830edc7a721 | a6fa1cbb2dc735c13fa00c05b7748d20ba807057d1aaba9a36910ca1b9a94030 | generator:frequency_rank:v0.1 |
d9fb52c793b8098435acb9b7 | [
{
"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": "62\n76\n90\n",
"type": "stdin_stdout"
},
{
"input": "36 10\n58 -13 73 -30 4 -21 100 29 81 70 22 48 -83 -56 87 -16 90 84 80 37 4 89 0 -99 -65 34 87 91 -96 18 94 -19 -23 74 -72 10\n16... | [{"input":"5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n","output":"62\n76\n90\n","type":"stdin_stdout"},{"input":"36 10\n58 -13 73 -30 4 -21 100 29 81 70 22 48 -83 -56 87 -16 90 84 80 37 4 89 0 -99 -65 34 87 91 -96 18 94 -19 -23 74 -72 10\n16 27\n26 35\n7 23\n15 17\n16 25\n13 20\n32 36\n26 35\n20 24\n35 36\n","output":"57\n82\n81... | [
{
"input": "1 2\n0\n1 1\n1 1\n",
"output": "90\n90\n",
"type": "stdin_stdout"
},
{
"input": "19 14\n19 18 -10 9 -65 -93 7 52 -20 -79 -94 -14 -8 -90 -2 -82 36 32 -23\n17 18\n9 12\n12 19\n10 16\n12 19\n11 11\n1 17\n13 17\n15 15\n6 19\n6 15\n15 18\n12 16\n6 18\n",
"output": "74\n75\n51\n84\n51\... | 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 | 4,766,220,369,754,845,000 | oellm-code-range_affine_queries-000000007 | {"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 | 2e5e0c871727c3d47494e08b1789fb3a60ad7ef54b74bc0724c09c6487cf5f34 | cc784916ac0f0337b66e9dbeac83a8bb9ce8657c6f930bcee6060826a37a31c4 | generator:range_affine_queries:v0.1 |
97b15b3468a1ee12c4edf076 | [
{
"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": "7\n24 31\n14 21\n-42 -41\n46 47\n11 19\n-22 -21\n28 33\n",
"output": "61\n",
"type": "stdin_stdout"
},
{
"input": "11\... | [{"input":"4\n0 2\n2 5\n10 10\n8 9\n","output":"19\n","type":"stdin_stdout"},{"input":"7\n24 31\n14 21\n-42 -41\n46 47\n11 19\n-22 -21\n28 33\n","output":"61\n","type":"stdin_stdout"},{"input":"11\n-38 -31\n-46 -37\n-45 -38\n46 58\n-46 -36\n-26 -17\n24 37\n-1 7\n23 33\n-20 -16\n25 37\n","output":"100\n","type":"stdin_s... | [
{
"input": "1\n0 0\n",
"output": "9\n",
"type": "stdin_stdout"
},
{
"input": "2\n9 17\n27 40\n",
"output": "39\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 | 7,523,981,236,702,172,000 | oellm-code-interval_union_points-000000007 | {"padding":4} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 24da47c952a9f71b6dcf80123a5a9ac4b199a1171d3153cc8104cb91cb27d882 | f528aca47854ad18c9102abe494e5ec93a104c93b849d703479cdc2798ef89db | generator:interval_union_points:v0.1 |
0dded9baab601829d959b9ce | [
{
"role": "user",
"content": "# Cyclic indexed string transform\n\nFor every character whose 1-indexed position is divisible by 5, shift it forward by 19 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 5, shift it forward by 19 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": "zrxwvumsrqphnmlkcihgfxdcba\n",
"type": "stdin_stdout"
},
{
"input": "uif\n",
"output": "fiu\n",
"type": "stdin_stdout"
},
{
"input": "eaducwbllrbiunlenovhlbhwjw... | [{"input":"abcdefghijklmnopqrstuvwxyz\n","output":"zrxwvumsrqphnmlkcihgfxdcba\n","type":"stdin_stdout"},{"input":"uif\n","output":"fiu\n","type":"stdin_stdout"},{"input":"eaducwbllrbiunlenovhlbhwjwpxverugfqtifuzjgznxtmafosswncgfrthelmu\n","output":"umleatrfgvnwsshfamtqnzgjsufitjfgurxvxpwcwhblavoneenuibkllbwvudae\n","ty... | [
{
"input": "a\n",
"output": "a\n",
"type": "stdin_stdout"
},
{
"input": "mbuaubvhwyfueycmeawvbt\n",
"output": "tbowaemvyeufrwhvbnaubm\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+19)%26+97) if i%5==0 else c)
r=''.join(a); print(r[::-1] if True else r)
| oellm-code-rlvr | train | python | en | 5 | challenge | cyclic_string_transform | [
"strings",
"indexing",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 1,156,275,414,815,079,700 | oellm-code-cyclic_string_transform-000000007 | {"reverse":true,"shift":19,"step":5} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 570272eae981a28567de0a6f75bdda4807692d22644a3a9711c386c48e5ed033 | d0850e550bea3ef8db4717277850ef4afe12272ae983e988740ffafa9c0a4414 | generator:cyclic_string_transform:v0.1 |
1fcf5611306180e3ab3bb790 | [
{
"role": "user",
"content": "# Overlapping shifted-pattern count\n\nShift every character of text forward by 5 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 5 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": "vvvv aa\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "vwvwv aba\n",
"output": "2\n",
"type": "stdin_stdout"... | [{"input":"abcabc abc\n","output":"0\n","type":"stdin_stdout"},{"input":"vvvv aa\n","output":"3\n","type":"stdin_stdout"},{"input":"vwvwv aba\n","output":"2\n","type":"stdin_stdout"},{"input":"vwxvwx abc\n","output":"2\n","type":"stdin_stdout"},{"input":"eebaacacedecabc acbe\n","output":"0\n","type":"stdin_stdout"},{"i... | [
{
"input": "aaaa aa\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "cbddedeceedddcaabebbaaeadabbdaedbdbe ab\n",
"output": "0\n",
"type": "stdin_stdout"
}
] | import sys
s,p=sys.stdin.buffer.read().decode().split(); s=''.join(chr((ord(c)-97+5)%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 | 5 | challenge | overlapping_pattern_count | [
"strings",
"pattern_matching",
"overlaps"
] | oellm-code-generators-0.1.0 | 2,262,797,730,470,700,300 | oellm-code-overlapping_pattern_count-000000007 | {"text_caesar_shift":5} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 13 | 1 | deterministic_procedural_generation | Apache-2.0 | c1603e41a99bfc50f1eba6078023402ec54bfe7ef51f01e89a93cd55c2d3a0d8 | 1972c814b99ea2ebafebf423c3d3b3dd1e8d5901e2b64d8f83476bb4cf14e086 | generator:overlapping_pattern_count:v0.1 |
8fcd8368ce8f4e9c420600df | [
{
"role": "user",
"content": "# Grid neighbour threshold\n\nCount cells containing 'B' that have at least 1 other 'B' cells among their four orthogonal 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 the ... | # Grid neighbour threshold
Count cells containing 'B' that have at least 1 other 'B' cells among their four orthogonal 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
In... | {
"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": "0\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":"0\n","type":"stdin_stdout"},{"input":"3 3\nAAA\nABA\nAAA\n","output":"0\n","type":"stdin_stdout"},{"input":"3 6\nBC.ACB\n.ACABC\nA.CAAB\n","output":"0\n","type":"stdin_stdout"},{"input":"10 11\nCCBC.B.CC.A\n... | [
{
"input": "1 1\nB\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "4 6\nBCACAC\n.CBCCB\n.AB.AA\nBCBBBC\n",
"output": "5\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)]+([]);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)>=1:z+=1
print(z)
| oellm-code-rlvr | train | python | en | 4 | advanced | grid_neighbor_count | [
"grids",
"neighbourhoods",
"counting"
] | oellm-code-generators-0.1.0 | 4,325,201,195,917,932,000 | oellm-code-grid_neighbor_count-000000007 | {"diagonal":false,"target":"B","threshold":1} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | a6403b1cbaa8d2b6fe7133a6e0a6841bcd246399472de45727cde62c754155cf | 0a9eb6159bde6d65573a1e12f8375d44b80390b1c09307939737f795ff35cbf1 | generator:grid_neighbor_count:v0.1 |
f2309e01220862005bade6f2 | [
{
"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 6 = 4. 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 6 = 4. 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": "3\n",
"type": "stdin_stdout"
},
{
"input": "14 25\n1 2\n1 3\n1 5\n2 5\n2 12\n3 4\n3 5\n3 8\n3 10\n3 11\n3 14\n4 6\n5 7\n5 12\n6 9\n6 14\n7 10\n7 11\n7 14\n8 12\n9 10\n9 13\n9 14\n11 14... | [{"input":"5 5\n1 2\n2 3\n3 4\n4 5\n1 5\n","output":"3\n","type":"stdin_stdout"},{"input":"14 25\n1 2\n1 3\n1 5\n2 5\n2 12\n3 4\n3 5\n3 8\n3 10\n3 11\n3 14\n4 6\n5 7\n5 12\n6 9\n6 14\n7 10\n7 11\n7 14\n8 12\n9 10\n9 13\n9 14\n11 14\n12 13\n","output":"11\n","type":"stdin_stdout"},{"input":"16 26\n1 2\n1 3\n1 6\n1 7\n1 ... | [
{
"input": "1 0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "3 3\n1 2\n1 3\n2 3\n",
"output": "2\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%6!=4: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 | 4,066,936,696,799,408,600 | oellm-code-constrained_reachability-000000007 | {"forbidden_modulus":6,"forbidden_residue":4} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | ecd141cd630c4c356e6a0605416d0a1a1582af72e7deb96092fe3eee56b33f60 | 68e3d4e393cb87fc1fedf2ebbe329016d8edf150bf2ef0adad823d8c2c3d5f92 | generator:constrained_reachability:v0.1 |
93f30106bbabf235f960c229 | [
{
"role": "user",
"content": "# Parameterized coin change\n\nUsing unlimited coins with values [1, 3, 4, 6, 17, 19], count unordered multisets whose sum is exactly n. Print the count modulo 97. The empty multiset is the unique way to form 0.\n\n## Input format\nOne integer n.\n\n## Output format\nPrint the ... | # Parameterized coin change
Using unlimited coins with values [1, 3, 4, 6, 17, 19], count unordered multisets whose sum is exactly n. Print the count modulo 97. The empty multiset is the unique way to form 0.
## Input format
One integer n.
## Output format
Print the number of unordered combinations.
## Constraints
... | {
"language": "python",
"test_cases": [
{
"input": "1\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "50\n",
"output": "83\n",
"type": "stdin_stdout"
},
{
"input": "160\n",
"output": "68\n",
"type": "stdin_stdout"
},
{
... | [{"input":"1\n","output":"1\n","type":"stdin_stdout"},{"input":"50\n","output":"83\n","type":"stdin_stdout"},{"input":"160\n","output":"68\n","type":"stdin_stdout"},{"input":"44\n","output":"7\n","type":"stdin_stdout"},{"input":"57\n","output":"49\n","type":"stdin_stdout"},{"input":"54\n","output":"30\n","type":"stdin_... | [
{
"input": "0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "105\n",
"output": "37\n",
"type": "stdin_stdout"
}
] | import sys
n=int(sys.stdin.readline());d=[0]*(n+1);d[0]=1
for c in [1, 3, 4, 6, 17, 19]:
for x in range(c,n+1):d[x]=(d[x]+d[x-c])%97
print(d[n])
| oellm-code-rlvr | train | python | en | 3 | intermediate | coin_change | [
"dynamic_programming",
"combinatorics"
] | oellm-code-generators-0.1.0 | 4,516,703,313,621,215,700 | oellm-code-coin_change-000000007 | {"coins":[1,3,4,6,17,19],"modulus":97} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 11 | 1 | deterministic_procedural_generation | Apache-2.0 | f600df4c07385e2c0982f096fbb91e6030752e0d6a687ced7891a2328fdf40cf | bbaf3e0f911f7d9e23d1facfa47b1dcb2d59809379b494b568de48ba30c1c7d5 | generator:coin_change:v0.1 |
bf630f3c77fd154fc8258ea3 | [
{
"role": "user",
"content": "# Transformed longest subsequence\n\nTransform each x into (5x + 10) mod 48, 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 + 10) mod 48, 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 ≤ 58.
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": "12\n-86 30 -37 30 -40 -39 -4 43 -4 73 -71 85\n",
"output": "7\n",
"type": "stdin_stdout"
},
{
"input": "51\n-70 67 93 -67 70 1... | [{"input":"7\n3 1 2 2 5 4 6\n","output":"5\n","type":"stdin_stdout"},{"input":"12\n-86 30 -37 30 -40 -39 -4 43 -4 73 -71 85\n","output":"7\n","type":"stdin_stdout"},{"input":"51\n-70 67 93 -67 70 14 -77 -5 70 57 31 -40 -17 -97 -8 -22 -4 29 -100 -10 43 2 81 -9 46 87 3 -2 48 78 37 84 87 5 67 63 -75 -16 91 84 53 -74 76 34... | [
{
"input": "1\n0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "7\n15 -8 -16 73 -22 86 36\n",
"output": "5\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+10)%48;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 | 4 | advanced | transformed_lis | [
"binary_search",
"longest_increasing_subsequence",
"dynamic_programming"
] | oellm-code-generators-0.1.0 | 3,586,500,423,764,991,000 | oellm-code-transformed_lis-000000007 | {"a":5,"b":10,"modulus":48,"subsequence":"non-decreasing"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 52b4e26e9a9c34739ccf62812d2a75347afe7b9c65ffe497c49723d27e53ffe7 | e4a6ec3c49a3d01e8c503625adceaea913d60d88113e1ac119fcc7fd0d02d797 | generator:transformed_lis:v0.1 |
84f4da709a2a88d80cd241f9 | [
{
"role": "user",
"content": "# Filtered affine sum\n\nKeep every array value x satisfying x mod 2 = 1. Replace each kept value by -8x + (7), 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 contai... | # Filtered affine sum
Keep every array value x satisfying x mod 2 = 1. Replace each kept value by -8x + (7), 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 inte... | {
"language": "python",
"test_cases": [
{
"input": "6\n-7 0 1 7 14 21\n",
"output": "999999859\n",
"type": "stdin_stdout"
},
{
"input": "2\n-23 1\n",
"output": "190\n",
"type": "stdin_stdout"
},
{
"input": "18\n-90 32 -54 12 -9 13 69 0 -12 -75 -77 14 -43... | [{"input":"6\n-7 0 1 7 14 21\n","output":"999999859\n","type":"stdin_stdout"},{"input":"2\n-23 1\n","output":"190\n","type":"stdin_stdout"},{"input":"18\n-90 32 -54 12 -9 13 69 0 -12 -75 -77 14 -43 -99 -14 -69 -73 -6\n","output":"2967\n","type":"stdin_stdout"},{"input":"11\n-73 -58 7 -40 77 -27 47 -98 34 18 -24\n","out... | [
{
"input": "1\n0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "2\n48 13\n",
"output": "999999910\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]
print(sum(-8*x+(7) for x in d[1:1+n] if x%2==1)%1000000007)
| oellm-code-rlvr | train | python | en | 1 | introductory | filtered_affine_sum | [
"arrays",
"filtering",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 6,316,095,887,267,680,000 | oellm-code-filtered_affine_sum-000000008 | {"a":-8,"b":7,"divisor":2,"modulus":1000000007,"residue":1} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 4cbff99432d19bb304cd07d71355f528df3c3c807f1406bcb4a32459dbfdc783 | e3b7a43e52d7c55dbdc43862adb4a6ff729396f42bae430bba7c87a6150b14c4 | generator:filtered_affine_sum:v0.1 |
f972035059919a3b014d3399 | [
{
"role": "user",
"content": "# Fixed-window extreme\n\nTransform each x into -3x + (-9). Among all contiguous windows of exactly 5 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 ... | # Fixed-window extreme
Transform each x into -3x + (-9). Among all contiguous windows of exactly 5 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
5 ≤ n ≤ 53.
Example 1
Input:... | {
"language": "python",
"test_cases": [
{
"input": "7\n-1 0 1 2 3 4 5\n",
"output": "-60\n",
"type": "stdin_stdout"
},
{
"input": "22\n-119 -336 221 -228 -308 -181 -165 -293 144 -127 -393 -154 266 20 295 -345 296 119 316 -149 146 -132\n",
"output": "3480\n",
"type": "... | [{"input":"7\n-1 0 1 2 3 4 5\n","output":"-60\n","type":"stdin_stdout"},{"input":"22\n-119 -336 221 -228 -308 -181 -165 -293 144 -127 -393 -154 266 20 295 -345 296 119 316 -149 146 -132\n","output":"3480\n","type":"stdin_stdout"},{"input":"12\n162 158 44 130 -244 311 -258 -175 189 329 216 -332\n","output":"663\n","type... | [
{
"input": "5\n0 0 0 0 0\n",
"output": "-45\n",
"type": "stdin_stdout"
},
{
"input": "39\n225 -382 150 -282 -339 -75 -97 206 -51 -321 -333 -202 122 330 -251 216 135 -252 -130 -324 320 80 289 23 -62 -110 -12 -385 -308 -74 -257 -290 288 152 325 -155 -50 -393 399\n",
"output": "3897\n",
"ty... | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=[-3*x+(-9) for x in d[1:1+n]]; k=5
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 | 4 | advanced | window_extreme | [
"arrays",
"sliding_window"
] | oellm-code-generators-0.1.0 | 246,758,304,545,481,060 | oellm-code-window_extreme-000000008 | {"extreme":"maximum","offset":-9,"scale":-3,"window":5} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | a35a5e96de8e9633a4a191284c121a9151a97daec669008a1af4096f22c495bf | 439c55723794afdc50f922dd7f979ee432db1ef276156116bdf81700b2df7cc6 | generator:window_extreme:v0.1 |
55d484956f21ec99955b2bc7 | [
{
"role": "user",
"content": "# Ranked frequency\n\nOrder distinct values by decreasing frequency. Ties are resolved by choosing the smaller value first. Print the value at rank 3; if fewer than 3 distinct values exist, print the last value in this ordering.\n\n## Input format\nThe first line contains n. Th... | # Ranked frequency
Order distinct values by decreasing frequency. Ties are resolved by choosing the smaller value first. Print the value at rank 3; if fewer than 3 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": "7\n",
"type": "stdin_stdout"
},
{
"input": "26\n8 -37 -37 27 27 22 -30 8 -37 -39 22 22 8 27 -30 22 27 -30 -43 -20 -43 22 27 -39 27 27\n",
"output": "-37\n",
"type": "stdin_stdout"... | [{"input":"8\n-2 -2 -2 5 5 7 8 9\n","output":"7\n","type":"stdin_stdout"},{"input":"26\n8 -37 -37 27 27 22 -30 8 -37 -39 22 22 8 27 -30 22 27 -30 -43 -20 -43 22 27 -39 27 27\n","output":"-37\n","type":"stdin_stdout"},{"input":"32\n32 -39 32 32 22 -30 -6 -8 22 -39 -5 -6 22 -8 -8 22 -39 22 -39 -6 -30 -5 -5 -30 22 -30 -5 ... | [
{
"input": "7\n1 1 2 2 3 3 4\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "21\n44 42 44 44 42 42 6 42 6 -24 -16 44 -10 44 -24 -16 -24 44 -24 -16 -24\n",
"output": "42\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(3-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 | 2,619,087,938,624,429,600 | oellm-code-frequency_rank-000000008 | {"rank":3,"tie_break":"smaller"} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | d9211a97a541834d74fc8d7ead0eb17490b6256e7299c688f52bac1d5c98a232 | cccab918cf6abe58b7b6e51be97a75992d0b5a84d1c1148cd78f60d2b5a9b615 | generator:frequency_rank:v0.1 |
52180a3e1e8e2b57d787191a | [
{
"role": "user",
"content": "# Affine range queries\n\nTransform every array value x to 4x + (3). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 10007.\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\... | # Affine range queries
Transform every array value x to 4x + (3). For each inclusive 1-indexed range [l,r], print its transformed sum modulo 10007.
## 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
... | {
"language": "python",
"test_cases": [
{
"input": "5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n",
"output": "15\n9\n3\n",
"type": "stdin_stdout"
},
{
"input": "24 6\n15 79 -44 -13 -57 -42 -95 86 -2 -53 -62 -96 29 48 66 7 35 -69 -22 25 86 -25 -31 -93\n23 23\n2 24\n23 23\n19 19\n20 24\n17 24... | [{"input":"5 3\n-2 -1 0 1 2\n1 5\n2 4\n3 3\n","output":"15\n9\n3\n","type":"stdin_stdout"},{"input":"24 6\n15 79 -44 -13 -57 -42 -95 86 -2 -53 -62 -96 29 48 66 7 35 -69 -22 25 86 -25 -31 -93\n23 23\n2 24\n23 23\n19 19\n20 24\n17 24\n","output":"9886\n9104\n9886\n9922\n9870\n9655\n","type":"stdin_stdout"},{"input":"13 9... | [
{
"input": "1 2\n0\n1 1\n1 1\n",
"output": "3\n3\n",
"type": "stdin_stdout"
},
{
"input": "14 1\n27 -15 92 97 -12 65 65 87 -36 -48 -39 -9 17 50\n13 14\n",
"output": "274\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]+4*next(it)+(3))
for _ in range(q):
l=next(it); r=next(it); print((p[r]-p[l-1])%10007)
| oellm-code-rlvr | train | python | en | 3 | intermediate | range_affine_queries | [
"prefix_sums",
"range_queries",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 6,535,103,399,635,843,000 | oellm-code-range_affine_queries-000000008 | {"a":4,"b":3,"modulus":10007} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 59e8d8346e281917ee73fe1e7e38c13fa1b5ffcd13ccc12f6f532450485a1ca3 | 54065b9852b08e2f6ccd25ba06573ded003aeb71008702d49157d19e300efd36 | generator:range_affine_queries:v0.1 |
1f60e3e2101a90f091fb5fb0 | [
{
"role": "user",
"content": "# Expanded interval union\n\nEach closed integer interval [l,r] is expanded to [l-3,r+3]. 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-3,r+3]. 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": "17\n",
"type": "stdin_stdout"
},
{
"input": "2\n-32 -32\n13 26\n",
"output": "27\n",
"type": "stdin_stdout"
},
{
"input": "9\n-44 -36\n10 18\n45 54\n-31 -19\n12 15... | [{"input":"4\n0 2\n2 5\n10 10\n8 9\n","output":"17\n","type":"stdin_stdout"},{"input":"2\n-32 -32\n13 26\n","output":"27\n","type":"stdin_stdout"},{"input":"9\n-44 -36\n10 18\n45 54\n-31 -19\n12 15\n-39 -37\n17 28\n-37 -31\n-5 6\n","output":"88\n","type":"stdin_stdout"},{"input":"8\n-50 -47\n-21 -10\n35 48\n12 20\n41 4... | [
{
"input": "1\n0 0\n",
"output": "7\n",
"type": "stdin_stdout"
},
{
"input": "1\n-32 -25\n",
"output": "14\n",
"type": "stdin_stdout"
}
] | import sys
d=list(map(int,sys.stdin.buffer.read().split())); n=d[0]; a=sorted((d[i]-3,d[i+1]+3) 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 | 1,370,243,034,962,372,400 | oellm-code-interval_union_points-000000008 | {"padding":3} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 6d2829251df488953c57acffe229ff3375ba7c55fca3c3b0325c63598b98af3f | 5fc06a240ea85816f9b5321df951e1d551529d41cf6acd1b39bab973c8b5d8ed | generator:interval_union_points:v0.1 |
754ad8f2445caa8803f7c5a1 | [
{
"role": "user",
"content": "# Cyclic indexed string transform\n\nFor every character whose 1-indexed position is divisible by 2, shift it forward by 20 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 20 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": "tyrwpunslqjohmfkdibgzexcva\n",
"type": "stdin_stdout"
},
{
"input": "vnezkppyhxxcvepzv\n",
"output": "vtpyvwxrhspjktehv\n",
"type": "stdin_stdout"
},
{
"input":... | [{"input":"abcdefghijklmnopqrstuvwxyz\n","output":"tyrwpunslqjohmfkdibgzexcva\n","type":"stdin_stdout"},{"input":"vnezkppyhxxcvepzv\n","output":"vtpyvwxrhspjktehv\n","type":"stdin_stdout"},{"input":"yzovovmexgwsykdohm\n","output":"ghideymwaxympopoty\n","type":"stdin_stdout"},{"input":"vbzmehyzczrtdyicyxwv\n","output":"... | [
{
"input": "a\n",
"output": "a\n",
"type": "stdin_stdout"
},
{
"input": "rryvju\n",
"output": "ojpylr\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+20)%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 | 3,058,437,988,125,540,000 | oellm-code-cyclic_string_transform-000000008 | {"reverse":true,"shift":20,"step":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | e6a6ac1a24f3ce836a7caa5ae1252cedb66e4cddfeaf26131a2363000402172d | 1a884cb50d8148a7e0f300280f74e1df3e47e65ed04285fc010460cc903691e4 | generator:cyclic_string_transform:v0.1 |
7dff3f3ec47ad8d9e9feeaa0 | [
{
"role": "user",
"content": "# Overlapping shifted-pattern count\n\nShift every character of text forward by 12 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 12 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": "oooo aa\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"input": "opopo aba\n",
"output": "2\n",
"type": "stdin_stdout"... | [{"input":"abcabc abc\n","output":"0\n","type":"stdin_stdout"},{"input":"oooo aa\n","output":"3\n","type":"stdin_stdout"},{"input":"opopo aba\n","output":"2\n","type":"stdin_stdout"},{"input":"opqopq abc\n","output":"2\n","type":"stdin_stdout"},{"input":"aaecddccccde deae\n","output":"0\n","type":"stdin_stdout"},{"inpu... | [
{
"input": "aaaa aa\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "bcecdcadaa aaeb\n",
"output": "0\n",
"type": "stdin_stdout"
}
] | import sys
s,p=sys.stdin.buffer.read().decode().split(); s=''.join(chr((ord(c)-97+12)%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 | 5,786,191,445,671,368,000 | oellm-code-overlapping_pattern_count-000000008 | {"text_caesar_shift":12} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 13 | 1 | deterministic_procedural_generation | Apache-2.0 | 90a0329cb8a589771aea8a3bd89b64b9fd897b2d192035e850f6de53420b539e | 311ff6a3e511f7dd040dd292d8125eb67bf947238e9a359b9b2af9020747477a | generator:overlapping_pattern_count:v0.1 |
7feff0d8c4c07749485a8689 | [
{
"role": "user",
"content": "# Grid neighbour threshold\n\nCount cells containing 'C' that have at least 3 other 'C' cells among their four orthogonal 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 the ... | # Grid neighbour threshold
Count cells containing 'C' that have at least 3 other 'C' cells among their four orthogonal 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
Inp... | {
"language": "python",
"test_cases": [
{
"input": "3 3\nCCC\nCAC\nCCC\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "3 3\nC.C\n.C.\nC.C\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "3 3\nAAA\nACA\nAAA\n",
"output": "0\n",
... | [{"input":"3 3\nCCC\nCAC\nCCC\n","output":"0\n","type":"stdin_stdout"},{"input":"3 3\nC.C\n.C.\nC.C\n","output":"0\n","type":"stdin_stdout"},{"input":"3 3\nAAA\nACA\nAAA\n","output":"0\n","type":"stdin_stdout"},{"input":"3 2\nC.\nC.\nBC\n","output":"0\n","type":"stdin_stdout"},{"input":"5 4\nAC.B\n.BAC\nCBBA\nABC.\nACA... | [
{
"input": "1 1\nC\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "4 5\nBBAC.\nACCBB\nBC.C.\nAA.BC\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)]+([]);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)>=3:z+=1
print(z)
| oellm-code-rlvr | train | python | en | 3 | intermediate | grid_neighbor_count | [
"grids",
"neighbourhoods",
"counting"
] | oellm-code-generators-0.1.0 | 3,509,571,712,488,808,000 | oellm-code-grid_neighbor_count-000000008 | {"diagonal":false,"target":"C","threshold":3} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | cdc029896aef8ea52cff2e2b8da55353a8f403c8ed71786672f2bb477bc00147 | 018f69d1c016ea4210cc30d413576ac0db028f0aa5ed30516732bcbef0aabbcf | generator:grid_neighbor_count:v0.1 |
ac750cdd61417d88937619ce | [
{
"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":"4 8\nS.3...1.\n.2222.#.\n22#12.2.\n.##232.G\n","output":"12\n","type":"stdin_stdout"},{"input":"6 3\nS.#\n###\... | [
{
"input": "1 2\nSG\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "6 7\nS.#2.2.\n1.23233\n.1..3..\n..####.\n..13331\n232#..G\n",
"output": "13\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 | 4 | advanced | weighted_grid_path | [
"graphs",
"dijkstra",
"grids",
"shortest_paths"
] | oellm-code-generators-0.1.0 | 3,989,494,549,267,369,500 | oellm-code-weighted_grid_path-000000008 | {"diagonal":false,"digit_cost":true} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 12 | 1 | deterministic_procedural_generation | Apache-2.0 | b5895b76e94411c7d5c573c5dcad4ad93bd3930b6889624c61f9d63512feb5d6 | 84fd160695f037c91b411ccc59ce3e2f0ed55469cb717f84f8ece0567f2b46b1 | generator:weighted_grid_path:v0.1 |
400cc33b649e6e10db834fed | [
{
"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 4 = 2. 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 4 = 2. 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 ≤ 21; 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": "17 31\n1 2\n1 4\n1 12\n2 3\n2 5\n2 10\n3 4\n3 6\n3 12\n3 16\n4 7\n4 8\n4 13\n5 7\n5 11\n5 14\n5 16\n6 10\n6 15\n7 17\n8 9\n8 10\n9 10\n9 12\... | [{"input":"5 5\n1 2\n2 3\n3 4\n4 5\n1 5\n","output":"3\n","type":"stdin_stdout"},{"input":"17 31\n1 2\n1 4\n1 12\n2 3\n2 5\n2 10\n3 4\n3 6\n3 12\n3 16\n4 7\n4 8\n4 13\n5 7\n5 11\n5 14\n5 16\n6 10\n6 15\n7 17\n8 9\n8 10\n9 10\n9 12\n10 11\n10 17\n11 12\n11 14\n11 15\n11 16\n12 16\n","output":"12\n","type":"stdin_stdout"... | [
{
"input": "1 0\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"input": "13 24\n1 2\n1 3\n1 4\n1 5\n1 6\n1 12\n1 13\n2 3\n2 5\n2 7\n2 8\n2 10\n3 6\n3 7\n3 11\n4 8\n4 11\n5 9\n5 10\n6 10\n6 11\n6 12\n7 10\n10 12\n",
"output": "9\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%4!=2:s.add(v);q.append(v)
pri... | oellm-code-rlvr | train | python | en | 3 | intermediate | constrained_reachability | [
"graphs",
"breadth_first_search",
"modular_arithmetic"
] | oellm-code-generators-0.1.0 | 2,998,945,181,453,988,000 | oellm-code-constrained_reachability-000000008 | {"forbidden_modulus":4,"forbidden_residue":2} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 10 | 1 | deterministic_procedural_generation | Apache-2.0 | 09baed6a35d9aea07eafbf2767f71e5081230182cfce53bb9a46b19520cce196 | ac8725058251f5c370795f8c03f17c72be93cd36a30b132cc8bf973effb8244a | generator:constrained_reachability:v0.1 |
8a45f1ddf8ed84acda8236b9 | [
{
"role": "user",
"content": "# Parameterized coin change\n\nUsing unlimited coins with values [1, 7, 20, 21, 23, 27], 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 t... | # Parameterized coin change
Using unlimited coins with values [1, 7, 20, 21, 23, 27], 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.
## Constrain... | {
"language": "python",
"test_cases": [
{
"input": "1\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "99\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "200\n",
"output": "43\n",
"type": "stdin_stdout"
},
{
... | [{"input":"1\n","output":"1\n","type":"stdin_stdout"},{"input":"99\n","output":"1\n","type":"stdin_stdout"},{"input":"200\n","output":"43\n","type":"stdin_stdout"},{"input":"58\n","output":"56\n","type":"stdin_stdout"},{"input":"105\n","output":"72\n","type":"stdin_stdout"},{"input":"23\n","output":"7\n","type":"stdin_... | [
{
"input": "0\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"input": "145\n",
"output": "100\n",
"type": "stdin_stdout"
}
] | import sys
n=int(sys.stdin.readline());d=[0]*(n+1);d[0]=1
for c in [1, 7, 20, 21, 23, 27]:
for x in range(c,n+1):d[x]=(d[x]+d[x-c])%101
print(d[n])
| oellm-code-rlvr | train | python | en | 5 | challenge | coin_change | [
"dynamic_programming",
"combinatorics"
] | oellm-code-generators-0.1.0 | 8,365,046,934,085,804,000 | oellm-code-coin_change-000000008 | {"coins":[1,7,20,21,23,27],"modulus":101} | code_stdio | oellm-code-stdio-contract-0.1.0 | 2 | 256 | 11 | 1 | deterministic_procedural_generation | Apache-2.0 | 862267529c382aa292cafc15c0ea42f3136ab79943b71271f95b11b78bfca71f | 27eb86c43010b8bf136502df3503cdb683f7c97eeec921538d6fafcf2d565334 | generator:coin_change:v0.1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.