problem_id stringclasses 20
values | language stringclasses 8
values | tiobe_rank int64 1 47 | prompt stringlengths 552 796 |
|---|---|---|---|
H01 | Python | 1 | Solve the following programming problem in Python.
## Problem: Balanced Parentheses
Read a string made only of '(' and ')' characters. Determine if the parentheses are balanced using the usual rules (every '(' closes in order, no prefix has more ')' than '('). Output 'yes' if balanced, otherwise 'no'.
## Examples
... |
H02 | Python | 1 | Solve the following programming problem in Python.
## Problem: Evaluate Expression With Precedence
Read a mathematical expression containing positive integers and the operators '+', '-', and '*' with no parentheses. Respect standard precedence (multiplication before addition/subtraction, evaluate left to right within... |
H03 | Python | 1 | Solve the following programming problem in Python.
## Problem: Count Primes Up To N
Read an integer N ≥ 2. Count how many prime numbers are less than or equal to N and output that count as an integer.
## Examples
Input: 10
Expected Output: 4
Input: 20
Expected Output: 8
## Requirements
- Write a complete,... |
H04 | Python | 1 | Solve the following programming problem in Python.
## Problem: Nth Prime Number
Read an integer K ≥ 1 and output the Kth prime number in the increasing sequence 2, 3, 5, 7, ... .
## Examples
Input: 1
Expected Output: 2
Input: 5
Expected Output: 11
## Requirements
- Write a complete, self-contained program... |
H05 | Python | 1 | Solve the following programming problem in Python.
## Problem: Big Integer Addition
Read two non-negative integers A and B given as decimal strings on separate lines (they may be very large). Output the decimal representation of A + B with no leading zeros unless the result is zero.
## Examples
Input: 123
456
E... |
H06 | Python | 1 | Solve the following programming problem in Python.
## Problem: Longest Word
Read a line containing words separated by single spaces. Identify the longest word and output it exactly as it appears. If multiple words tie for longest, output the first such word.
## Examples
Input: this is test
Expected Output: this... |
H07 | Python | 1 | Solve the following programming problem in Python.
## Problem: Longest Common Prefix
Read an integer N followed by N lines containing strings. Compute the longest common prefix shared by all strings (exact character comparison). Output the prefix, or an empty string if the strings share no common prefix.
## Examples... |
H08 | Python | 1 | Solve the following programming problem in Python.
## Problem: Digit Frequency
Read a string consisting solely of digits 0-9. Count the frequency of each digit and output ten integers separated by single spaces representing counts for 0, 1, ..., 9 in that order.
## Examples
Input: 0123456789
Expected Output: 1 ... |
H09 | Python | 1 | Solve the following programming problem in Python.
## Problem: General Caesar Cipher
Read an integer K (possibly negative) followed by a lowercase string S. Shift each character forward by K positions modulo 26 (wrapping around the alphabet) and output the resulting string.
## Examples
Input: 1
abc
Expected Out... |
H10 | Python | 1 | Solve the following programming problem in Python.
## Problem: Remove Consecutive Duplicates
Read a string S and remove consecutive duplicate characters so that each maximal run is replaced by a single occurrence. Output the compressed string.
## Examples
Input: aaabbbbcc
Expected Output: abc
Input: hellooo
... |
H11 | Python | 1 | Solve the following programming problem in Python.
## Problem: Run Length Decoding
Read a run-length encoded string consisting of alternating characters and single-digit counts (1-9), e.g., 'a3b2'. Decode it by repeating each character count times and output the expanded string.
## Examples
Input: a3b2
Expected... |
H12 | Python | 1 | Solve the following programming problem in Python.
## Problem: ASCII Sum
Read a string S and compute the sum of the ASCII/Unicode code points of all characters. Output the sum as an integer.
## Examples
Input: A
Expected Output: 65
Input: AB
Expected Output: 131
## Requirements
- Write a complete, self-co... |
H13 | Python | 1 | Solve the following programming problem in Python.
## Problem: Polynomial Evaluation
Read an integer n, then a line containing n+1 integer coefficients for a degree-n polynomial starting with the highest-degree term, followed by an integer x on the next line. Evaluate the polynomial at x and output the integer result... |
H14 | Python | 1 | Solve the following programming problem in Python.
## Problem: List All Divisors
Read a positive integer N and output all positive divisors of N in strictly increasing order separated by single spaces.
## Examples
Input: 6
Expected Output: 1 2 3 6
Input: 1
Expected Output: 1
## Requirements
- Write a comp... |
H15 | Python | 1 | Solve the following programming problem in Python.
## Problem: Tape Walk Final Position
Start with X = 0. Read a string consisting of the characters 'L' and 'R'. For each 'L' decrement X by 1; for each 'R' increment X by 1. After processing the entire string, output the final value of X as an integer.
## Examples
... |
H16 | Python | 1 | Solve the following programming problem in Python.
## Problem: Longest Run Length
Read a string S and compute the length (number of characters) of the longest contiguous block of identical characters. Output that length as an integer.
## Examples
Input: aaabb
Expected Output: 3
Input: ababab
Expected Output... |
H17 | Python | 1 | Solve the following programming problem in Python.
## Problem: Most Frequent Value
Read an integer N followed by a line containing N integers. Determine which value appears most frequently. Output that value; if multiple values tie, output the smallest such value.
## Examples
Input: 6
1 2 2 3 3 3
Expected Outpu... |
H18 | Python | 1 | Solve the following programming problem in Python.
## Problem: Divisible By 3
Read a non-negative integer represented as a string of digits. Decide whether the number is divisible by 3 using any method and output 'yes' if divisible, otherwise 'no'.
## Examples
Input: 9
Expected Output: yes
Input: 11
Expecte... |
H19 | Python | 1 | Solve the following programming problem in Python.
## Problem: Plus Minus Reset Machine
Initialize X = 0. Read a string consisting of '+', '-', and '0'. For each '+', increment X; for '-', decrement X; for '0', reset X to 0. After processing all characters, output the final integer value of X.
## Examples
Input: ... |
H20 | Python | 1 | Solve the following programming problem in Python.
## Problem: Sort Strings Lexicographically
Read an integer N followed by N lines, each containing a string. Sort the strings lexicographically (dictionary order) using regular character comparison and output them in a single line separated by single spaces.
## Examp... |
H01 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Balanced Parentheses
Read a string made only of '(' and ')' characters. Determine if the parentheses are balanced using the usual rules (every '(' closes in order, no prefix has more ')' than '('). Output 'yes' if balanced, otherwise 'no'.
## Examples
In... |
H02 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Evaluate Expression With Precedence
Read a mathematical expression containing positive integers and the operators '+', '-', and '*' with no parentheses. Respect standard precedence (multiplication before addition/subtraction, evaluate left to right within th... |
H03 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Count Primes Up To N
Read an integer N ≥ 2. Count how many prime numbers are less than or equal to N and output that count as an integer.
## Examples
Input: 10
Expected Output: 4
Input: 20
Expected Output: 8
## Requirements
- Write a complete, se... |
H04 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Nth Prime Number
Read an integer K ≥ 1 and output the Kth prime number in the increasing sequence 2, 3, 5, 7, ... .
## Examples
Input: 1
Expected Output: 2
Input: 5
Expected Output: 11
## Requirements
- Write a complete, self-contained program in... |
H05 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Big Integer Addition
Read two non-negative integers A and B given as decimal strings on separate lines (they may be very large). Output the decimal representation of A + B with no leading zeros unless the result is zero.
## Examples
Input: 123
456
Expe... |
H06 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Longest Word
Read a line containing words separated by single spaces. Identify the longest word and output it exactly as it appears. If multiple words tie for longest, output the first such word.
## Examples
Input: this is test
Expected Output: this
... |
H07 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Longest Common Prefix
Read an integer N followed by N lines containing strings. Compute the longest common prefix shared by all strings (exact character comparison). Output the prefix, or an empty string if the strings share no common prefix.
## Examples
... |
H08 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Digit Frequency
Read a string consisting solely of digits 0-9. Count the frequency of each digit and output ten integers separated by single spaces representing counts for 0, 1, ..., 9 in that order.
## Examples
Input: 0123456789
Expected Output: 1 1 1... |
H09 | C++ | 3 | Solve the following programming problem in C++.
## Problem: General Caesar Cipher
Read an integer K (possibly negative) followed by a lowercase string S. Shift each character forward by K positions modulo 26 (wrapping around the alphabet) and output the resulting string.
## Examples
Input: 1
abc
Expected Output... |
H10 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Remove Consecutive Duplicates
Read a string S and remove consecutive duplicate characters so that each maximal run is replaced by a single occurrence. Output the compressed string.
## Examples
Input: aaabbbbcc
Expected Output: abc
Input: hellooo
Ex... |
H11 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Run Length Decoding
Read a run-length encoded string consisting of alternating characters and single-digit counts (1-9), e.g., 'a3b2'. Decode it by repeating each character count times and output the expanded string.
## Examples
Input: a3b2
Expected Ou... |
H12 | C++ | 3 | Solve the following programming problem in C++.
## Problem: ASCII Sum
Read a string S and compute the sum of the ASCII/Unicode code points of all characters. Output the sum as an integer.
## Examples
Input: A
Expected Output: 65
Input: AB
Expected Output: 131
## Requirements
- Write a complete, self-conta... |
H13 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Polynomial Evaluation
Read an integer n, then a line containing n+1 integer coefficients for a degree-n polynomial starting with the highest-degree term, followed by an integer x on the next line. Evaluate the polynomial at x and output the integer result.
... |
H14 | C++ | 3 | Solve the following programming problem in C++.
## Problem: List All Divisors
Read a positive integer N and output all positive divisors of N in strictly increasing order separated by single spaces.
## Examples
Input: 6
Expected Output: 1 2 3 6
Input: 1
Expected Output: 1
## Requirements
- Write a complet... |
H15 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Tape Walk Final Position
Start with X = 0. Read a string consisting of the characters 'L' and 'R'. For each 'L' decrement X by 1; for each 'R' increment X by 1. After processing the entire string, output the final value of X as an integer.
## Examples
In... |
H16 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Longest Run Length
Read a string S and compute the length (number of characters) of the longest contiguous block of identical characters. Output that length as an integer.
## Examples
Input: aaabb
Expected Output: 3
Input: ababab
Expected Output: 1... |
H17 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Most Frequent Value
Read an integer N followed by a line containing N integers. Determine which value appears most frequently. Output that value; if multiple values tie, output the smallest such value.
## Examples
Input: 6
1 2 2 3 3 3
Expected Output: ... |
H18 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Divisible By 3
Read a non-negative integer represented as a string of digits. Decide whether the number is divisible by 3 using any method and output 'yes' if divisible, otherwise 'no'.
## Examples
Input: 9
Expected Output: yes
Input: 11
Expected O... |
H19 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Plus Minus Reset Machine
Initialize X = 0. Read a string consisting of '+', '-', and '0'. For each '+', increment X; for '-', decrement X; for '0', reset X to 0. After processing all characters, output the final integer value of X.
## Examples
Input: +-+... |
H20 | C++ | 3 | Solve the following programming problem in C++.
## Problem: Sort Strings Lexicographically
Read an integer N followed by N lines, each containing a string. Sort the strings lexicographically (dictionary order) using regular character comparison and output them in a single line separated by single spaces.
## Examples... |
H01 | Java | 4 | Solve the following programming problem in Java.
## Problem: Balanced Parentheses
Read a string made only of '(' and ')' characters. Determine if the parentheses are balanced using the usual rules (every '(' closes in order, no prefix has more ')' than '('). Output 'yes' if balanced, otherwise 'no'.
## Examples
I... |
H02 | Java | 4 | Solve the following programming problem in Java.
## Problem: Evaluate Expression With Precedence
Read a mathematical expression containing positive integers and the operators '+', '-', and '*' with no parentheses. Respect standard precedence (multiplication before addition/subtraction, evaluate left to right within t... |
H03 | Java | 4 | Solve the following programming problem in Java.
## Problem: Count Primes Up To N
Read an integer N ≥ 2. Count how many prime numbers are less than or equal to N and output that count as an integer.
## Examples
Input: 10
Expected Output: 4
Input: 20
Expected Output: 8
## Requirements
- Write a complete, s... |
H04 | Java | 4 | Solve the following programming problem in Java.
## Problem: Nth Prime Number
Read an integer K ≥ 1 and output the Kth prime number in the increasing sequence 2, 3, 5, 7, ... .
## Examples
Input: 1
Expected Output: 2
Input: 5
Expected Output: 11
## Requirements
- Write a complete, self-contained program i... |
H05 | Java | 4 | Solve the following programming problem in Java.
## Problem: Big Integer Addition
Read two non-negative integers A and B given as decimal strings on separate lines (they may be very large). Output the decimal representation of A + B with no leading zeros unless the result is zero.
## Examples
Input: 123
456
Exp... |
H06 | Java | 4 | Solve the following programming problem in Java.
## Problem: Longest Word
Read a line containing words separated by single spaces. Identify the longest word and output it exactly as it appears. If multiple words tie for longest, output the first such word.
## Examples
Input: this is test
Expected Output: this
... |
H07 | Java | 4 | Solve the following programming problem in Java.
## Problem: Longest Common Prefix
Read an integer N followed by N lines containing strings. Compute the longest common prefix shared by all strings (exact character comparison). Output the prefix, or an empty string if the strings share no common prefix.
## Examples
... |
H08 | Java | 4 | Solve the following programming problem in Java.
## Problem: Digit Frequency
Read a string consisting solely of digits 0-9. Count the frequency of each digit and output ten integers separated by single spaces representing counts for 0, 1, ..., 9 in that order.
## Examples
Input: 0123456789
Expected Output: 1 1 ... |
H09 | Java | 4 | Solve the following programming problem in Java.
## Problem: General Caesar Cipher
Read an integer K (possibly negative) followed by a lowercase string S. Shift each character forward by K positions modulo 26 (wrapping around the alphabet) and output the resulting string.
## Examples
Input: 1
abc
Expected Outpu... |
H10 | Java | 4 | Solve the following programming problem in Java.
## Problem: Remove Consecutive Duplicates
Read a string S and remove consecutive duplicate characters so that each maximal run is replaced by a single occurrence. Output the compressed string.
## Examples
Input: aaabbbbcc
Expected Output: abc
Input: hellooo
E... |
H11 | Java | 4 | Solve the following programming problem in Java.
## Problem: Run Length Decoding
Read a run-length encoded string consisting of alternating characters and single-digit counts (1-9), e.g., 'a3b2'. Decode it by repeating each character count times and output the expanded string.
## Examples
Input: a3b2
Expected O... |
H12 | Java | 4 | Solve the following programming problem in Java.
## Problem: ASCII Sum
Read a string S and compute the sum of the ASCII/Unicode code points of all characters. Output the sum as an integer.
## Examples
Input: A
Expected Output: 65
Input: AB
Expected Output: 131
## Requirements
- Write a complete, self-cont... |
H13 | Java | 4 | Solve the following programming problem in Java.
## Problem: Polynomial Evaluation
Read an integer n, then a line containing n+1 integer coefficients for a degree-n polynomial starting with the highest-degree term, followed by an integer x on the next line. Evaluate the polynomial at x and output the integer result.
... |
H14 | Java | 4 | Solve the following programming problem in Java.
## Problem: List All Divisors
Read a positive integer N and output all positive divisors of N in strictly increasing order separated by single spaces.
## Examples
Input: 6
Expected Output: 1 2 3 6
Input: 1
Expected Output: 1
## Requirements
- Write a comple... |
H15 | Java | 4 | Solve the following programming problem in Java.
## Problem: Tape Walk Final Position
Start with X = 0. Read a string consisting of the characters 'L' and 'R'. For each 'L' decrement X by 1; for each 'R' increment X by 1. After processing the entire string, output the final value of X as an integer.
## Examples
I... |
H16 | Java | 4 | Solve the following programming problem in Java.
## Problem: Longest Run Length
Read a string S and compute the length (number of characters) of the longest contiguous block of identical characters. Output that length as an integer.
## Examples
Input: aaabb
Expected Output: 3
Input: ababab
Expected Output: ... |
H17 | Java | 4 | Solve the following programming problem in Java.
## Problem: Most Frequent Value
Read an integer N followed by a line containing N integers. Determine which value appears most frequently. Output that value; if multiple values tie, output the smallest such value.
## Examples
Input: 6
1 2 2 3 3 3
Expected Output:... |
H18 | Java | 4 | Solve the following programming problem in Java.
## Problem: Divisible By 3
Read a non-negative integer represented as a string of digits. Decide whether the number is divisible by 3 using any method and output 'yes' if divisible, otherwise 'no'.
## Examples
Input: 9
Expected Output: yes
Input: 11
Expected ... |
H19 | Java | 4 | Solve the following programming problem in Java.
## Problem: Plus Minus Reset Machine
Initialize X = 0. Read a string consisting of '+', '-', and '0'. For each '+', increment X; for '-', decrement X; for '0', reset X to 0. After processing all characters, output the final integer value of X.
## Examples
Input: +-... |
H20 | Java | 4 | Solve the following programming problem in Java.
## Problem: Sort Strings Lexicographically
Read an integer N followed by N lines, each containing a string. Sort the strings lexicographically (dictionary order) using regular character comparison and output them in a single line separated by single spaces.
## Example... |
H01 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Balanced Parentheses
Read a string made only of '(' and ')' characters. Determine if the parentheses are balanced using the usual rules (every '(' closes in order, no prefix has more ')' than '('). Output 'yes' if balanced, otherwise 'no'.
## Examples
I... |
H02 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Evaluate Expression With Precedence
Read a mathematical expression containing positive integers and the operators '+', '-', and '*' with no parentheses. Respect standard precedence (multiplication before addition/subtraction, evaluate left to right within t... |
H03 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Count Primes Up To N
Read an integer N ≥ 2. Count how many prime numbers are less than or equal to N and output that count as an integer.
## Examples
Input: 10
Expected Output: 4
Input: 20
Expected Output: 8
## Requirements
- Write a complete, s... |
H04 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Nth Prime Number
Read an integer K ≥ 1 and output the Kth prime number in the increasing sequence 2, 3, 5, 7, ... .
## Examples
Input: 1
Expected Output: 2
Input: 5
Expected Output: 11
## Requirements
- Write a complete, self-contained program i... |
H05 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Big Integer Addition
Read two non-negative integers A and B given as decimal strings on separate lines (they may be very large). Output the decimal representation of A + B with no leading zeros unless the result is zero.
## Examples
Input: 123
456
Exp... |
H06 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Longest Word
Read a line containing words separated by single spaces. Identify the longest word and output it exactly as it appears. If multiple words tie for longest, output the first such word.
## Examples
Input: this is test
Expected Output: this
... |
H07 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Longest Common Prefix
Read an integer N followed by N lines containing strings. Compute the longest common prefix shared by all strings (exact character comparison). Output the prefix, or an empty string if the strings share no common prefix.
## Examples
... |
H08 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Digit Frequency
Read a string consisting solely of digits 0-9. Count the frequency of each digit and output ten integers separated by single spaces representing counts for 0, 1, ..., 9 in that order.
## Examples
Input: 0123456789
Expected Output: 1 1 ... |
H09 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: General Caesar Cipher
Read an integer K (possibly negative) followed by a lowercase string S. Shift each character forward by K positions modulo 26 (wrapping around the alphabet) and output the resulting string.
## Examples
Input: 1
abc
Expected Outpu... |
H10 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Remove Consecutive Duplicates
Read a string S and remove consecutive duplicate characters so that each maximal run is replaced by a single occurrence. Output the compressed string.
## Examples
Input: aaabbbbcc
Expected Output: abc
Input: hellooo
E... |
H11 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Run Length Decoding
Read a run-length encoded string consisting of alternating characters and single-digit counts (1-9), e.g., 'a3b2'. Decode it by repeating each character count times and output the expanded string.
## Examples
Input: a3b2
Expected O... |
H12 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: ASCII Sum
Read a string S and compute the sum of the ASCII/Unicode code points of all characters. Output the sum as an integer.
## Examples
Input: A
Expected Output: 65
Input: AB
Expected Output: 131
## Requirements
- Write a complete, self-cont... |
H13 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Polynomial Evaluation
Read an integer n, then a line containing n+1 integer coefficients for a degree-n polynomial starting with the highest-degree term, followed by an integer x on the next line. Evaluate the polynomial at x and output the integer result.
... |
H14 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: List All Divisors
Read a positive integer N and output all positive divisors of N in strictly increasing order separated by single spaces.
## Examples
Input: 6
Expected Output: 1 2 3 6
Input: 1
Expected Output: 1
## Requirements
- Write a comple... |
H15 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Tape Walk Final Position
Start with X = 0. Read a string consisting of the characters 'L' and 'R'. For each 'L' decrement X by 1; for each 'R' increment X by 1. After processing the entire string, output the final value of X as an integer.
## Examples
I... |
H16 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Longest Run Length
Read a string S and compute the length (number of characters) of the longest contiguous block of identical characters. Output that length as an integer.
## Examples
Input: aaabb
Expected Output: 3
Input: ababab
Expected Output: ... |
H17 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Most Frequent Value
Read an integer N followed by a line containing N integers. Determine which value appears most frequently. Output that value; if multiple values tie, output the smallest such value.
## Examples
Input: 6
1 2 2 3 3 3
Expected Output:... |
H18 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Divisible By 3
Read a non-negative integer represented as a string of digits. Decide whether the number is divisible by 3 using any method and output 'yes' if divisible, otherwise 'no'.
## Examples
Input: 9
Expected Output: yes
Input: 11
Expected ... |
H19 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Plus Minus Reset Machine
Initialize X = 0. Read a string consisting of '+', '-', and '0'. For each '+', increment X; for '-', decrement X; for '0', reset X to 0. After processing all characters, output the final integer value of X.
## Examples
Input: +-... |
H20 | Perl | 11 | Solve the following programming problem in Perl.
## Problem: Sort Strings Lexicographically
Read an integer N followed by N lines, each containing a string. Sort the strings lexicographically (dictionary order) using regular character comparison and output them in a single line separated by single spaces.
## Example... |
H01 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Balanced Parentheses
Read a string made only of '(' and ')' characters. Determine if the parentheses are balanced using the usual rules (every '(' closes in order, no prefix has more ')' than '('). Output 'yes' if balanced, otherwise 'no'.
## Examples
I... |
H02 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Evaluate Expression With Precedence
Read a mathematical expression containing positive integers and the operators '+', '-', and '*' with no parentheses. Respect standard precedence (multiplication before addition/subtraction, evaluate left to right within t... |
H03 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Count Primes Up To N
Read an integer N ≥ 2. Count how many prime numbers are less than or equal to N and output that count as an integer.
## Examples
Input: 10
Expected Output: 4
Input: 20
Expected Output: 8
## Requirements
- Write a complete, s... |
H04 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Nth Prime Number
Read an integer K ≥ 1 and output the Kth prime number in the increasing sequence 2, 3, 5, 7, ... .
## Examples
Input: 1
Expected Output: 2
Input: 5
Expected Output: 11
## Requirements
- Write a complete, self-contained program i... |
H05 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Big Integer Addition
Read two non-negative integers A and B given as decimal strings on separate lines (they may be very large). Output the decimal representation of A + B with no leading zeros unless the result is zero.
## Examples
Input: 123
456
Exp... |
H06 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Longest Word
Read a line containing words separated by single spaces. Identify the longest word and output it exactly as it appears. If multiple words tie for longest, output the first such word.
## Examples
Input: this is test
Expected Output: this
... |
H07 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Longest Common Prefix
Read an integer N followed by N lines containing strings. Compute the longest common prefix shared by all strings (exact character comparison). Output the prefix, or an empty string if the strings share no common prefix.
## Examples
... |
H08 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Digit Frequency
Read a string consisting solely of digits 0-9. Count the frequency of each digit and output ten integers separated by single spaces representing counts for 0, 1, ..., 9 in that order.
## Examples
Input: 0123456789
Expected Output: 1 1 ... |
H09 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: General Caesar Cipher
Read an integer K (possibly negative) followed by a lowercase string S. Shift each character forward by K positions modulo 26 (wrapping around the alphabet) and output the resulting string.
## Examples
Input: 1
abc
Expected Outpu... |
H10 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Remove Consecutive Duplicates
Read a string S and remove consecutive duplicate characters so that each maximal run is replaced by a single occurrence. Output the compressed string.
## Examples
Input: aaabbbbcc
Expected Output: abc
Input: hellooo
E... |
H11 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Run Length Decoding
Read a run-length encoded string consisting of alternating characters and single-digit counts (1-9), e.g., 'a3b2'. Decode it by repeating each character count times and output the expanded string.
## Examples
Input: a3b2
Expected O... |
H12 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: ASCII Sum
Read a string S and compute the sum of the ASCII/Unicode code points of all characters. Output the sum as an integer.
## Examples
Input: A
Expected Output: 65
Input: AB
Expected Output: 131
## Requirements
- Write a complete, self-cont... |
H13 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Polynomial Evaluation
Read an integer n, then a line containing n+1 integer coefficients for a degree-n polynomial starting with the highest-degree term, followed by an integer x on the next line. Evaluate the polynomial at x and output the integer result.
... |
H14 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: List All Divisors
Read a positive integer N and output all positive divisors of N in strictly increasing order separated by single spaces.
## Examples
Input: 6
Expected Output: 1 2 3 6
Input: 1
Expected Output: 1
## Requirements
- Write a comple... |
H15 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Tape Walk Final Position
Start with X = 0. Read a string consisting of the characters 'L' and 'R'. For each 'L' decrement X by 1; for each 'R' increment X by 1. After processing the entire string, output the final value of X as an integer.
## Examples
I... |
H16 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Longest Run Length
Read a string S and compute the length (number of characters) of the longest contiguous block of identical characters. Output that length as an integer.
## Examples
Input: aaabb
Expected Output: 3
Input: ababab
Expected Output: ... |
H17 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Most Frequent Value
Read an integer N followed by a line containing N integers. Determine which value appears most frequently. Output that value; if multiple values tie, output the smallest such value.
## Examples
Input: 6
1 2 2 3 3 3
Expected Output:... |
H18 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Divisible By 3
Read a non-negative integer represented as a string of digits. Decide whether the number is divisible by 3 using any method and output 'yes' if divisible, otherwise 'no'.
## Examples
Input: 9
Expected Output: yes
Input: 11
Expected ... |
H19 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Plus Minus Reset Machine
Initialize X = 0. Read a string consisting of '+', '-', and '0'. For each '+', increment X; for '-', decrement X; for '0', reset X to 0. After processing all characters, output the final integer value of X.
## Examples
Input: +-... |
H20 | Rust | 14 | Solve the following programming problem in Rust.
## Problem: Sort Strings Lexicographically
Read an integer N followed by N lines, each containing a string. Sort the strings lexicographically (dictionary order) using regular character comparison and output them in a single line separated by single spaces.
## Example... |
End of preview. Expand in Data Studio
sdc-prompts-hard-v1
Prompts for Hard tier
Dataset Info
- Rows: 160
- Columns: 4
Columns
| Column | Type | Description |
|---|---|---|
| problem_id | Value('string') | Problem identifier (H01-H20) |
| language | Value('string') | Target programming language |
| tiobe_rank | Value('int64') | TIOBE index rank |
| prompt | Value('string') | Full prompt text sent to GPT-5.2 |
Generation Parameters
{
"script_name": "run_hard_zero_shot.py",
"model": "gpt-5-2",
"description": "Prompts for Hard tier",
"tier": "hard",
"hyperparameters": {
"temperature": 0.7,
"max_tokens": "model_maximum"
},
"input_datasets": [
"Lossfunk/Esolang-Bench"
]
}
Experiment Documentation
For complete experiment details, see https://github.com/Zayne-sprague/SC-Research-Notes/tree/main/experiments/semantic-distance-coding
Usage
from datasets import load_dataset
dataset = load_dataset("reasoning-degeneration-dev/sdc-prompts-hard-v1", split="train")
print(f"Loaded {len(dataset)} rows")
This dataset is tracked in reasoning-degeneration-dev/PROJECT-MANIFEST
- Downloads last month
- 26