problem_id stringclasses 20
values | language stringclasses 8
values | tiobe_rank int64 1 47 | prompt stringlengths 552 796 |
|---|---|---|---|
H01 | Go | 16 | Solve the following programming problem in Go.
## 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
Inp... |
H02 | Go | 16 | Solve the following programming problem in Go.
## 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 the... |
H03 | Go | 16 | Solve the following programming problem in Go.
## 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, sel... |
H04 | Go | 16 | Solve the following programming problem in Go.
## 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 | Go | 16 | Solve the following programming problem in Go.
## 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
Expec... |
H06 | Go | 16 | Solve the following programming problem in Go.
## 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
I... |
H07 | Go | 16 | Solve the following programming problem in Go.
## 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 | Go | 16 | Solve the following programming problem in Go.
## 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 | Go | 16 | Solve the following programming problem in Go.
## 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 | Go | 16 | Solve the following programming problem in Go.
## 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
Exp... |
H11 | Go | 16 | Solve the following programming problem in Go.
## 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 Out... |
H12 | Go | 16 | Solve the following programming problem in Go.
## 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-contai... |
H13 | Go | 16 | Solve the following programming problem in Go.
## 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 | Go | 16 | Solve the following programming problem in Go.
## 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 complete... |
H15 | Go | 16 | Solve the following programming problem in Go.
## 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
Inp... |
H16 | Go | 16 | Solve the following programming problem in Go.
## 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 | Go | 16 | Solve the following programming problem in Go.
## 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: 3... |
H18 | Go | 16 | Solve the following programming problem in Go.
## 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 Ou... |
H19 | Go | 16 | Solve the following programming problem in Go.
## 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 | Go | 16 | Solve the following programming problem in Go.
## 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 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 withi... |
H03 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 progra... |
H05 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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
... |
H06 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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: thi... |
H07 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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.
## Example... |
H08 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 Ou... |
H10 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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
Expecte... |
H12 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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-c... |
H13 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 resul... |
H14 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 com... |
H15 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 Outpu... |
H17 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 Outp... |
H18 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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
Expect... |
H19 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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 | Haskell | 42 | Solve the following programming problem in Haskell.
## 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.
## Exam... |
H01 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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
Ex... |
H06 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 Outp... |
H10 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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-con... |
H13 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 compl... |
H15 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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 | OCaml | 47 | Solve the following programming problem in OCaml.
## 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.
## Exampl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.