problem_id stringclasses 20
values | language stringclasses 8
values | tiobe_rank int64 1 47 | prompt stringlengths 557 760 |
|---|---|---|---|
M01 | Go | 16 | Solve the following programming problem in Go.
## Problem: Palindrome Check
Read a string S and determine whether it reads the same forwards and backwards, comparing characters exactly (case-sensitive and including punctuation). Output 'yes' for palindromes and 'no' otherwise.
## Examples
Input: racecar
Expecte... |
M02 | Go | 16 | Solve the following programming problem in Go.
## Problem: Word Count
Read a line consisting of words separated by single spaces. Count how many words appear (non-empty sequences between spaces) and output that integer.
## Examples
Input: hello world
Expected Output: 2
Input: one two three
Expected Output: ... |
M03 | Go | 16 | Solve the following programming problem in Go.
## Problem: Run Length Encoding
Read a string S and produce its run-length encoding: for each maximal block of identical characters, output the character followed immediately by the length of the block as a decimal integer. Concatenate all blocks and output the resulting... |
M04 | Go | 16 | Solve the following programming problem in Go.
## Problem: Caesar Shift By 3
Read a lowercase alphabetic string S. Shift each letter forward by 3 positions in the English alphabet (wrapping z to c) and output the transformed string. Non-letter characters will not appear.
## Examples
Input: abc
Expected Output: ... |
M05 | Go | 16 | Solve the following programming problem in Go.
## Problem: Simple Binary Expression
Read an expression formatted as 'a op b' with single spaces, where a and b are integers and op is one of '+', '-', or '*'. Evaluate the expression using integer arithmetic and output the result as an integer.
## Examples
Input: 3 ... |
M06 | Go | 16 | Solve the following programming problem in Go.
## Problem: Greatest Common Divisor
Read two integers a and b separated by whitespace. Compute their greatest common divisor as a positive integer and output that value.
## Examples
Input: 12 18
Expected Output: 6
Input: 7 5
Expected Output: 1
## Requirements
... |
M07 | Go | 16 | Solve the following programming problem in Go.
## Problem: Factorial
Read an integer N with 0 ≤ N ≤ 10. Compute N! (the factorial) using integer arithmetic and output the result.
## Examples
Input: 5
Expected Output: 120
Input: 0
Expected Output: 1
## Requirements
- Write a complete, self-contained progra... |
M08 | Go | 16 | Solve the following programming problem in Go.
## Problem: Nth Fibonacci Number
Read an integer N ≥ 1 and output the Nth Fibonacci number using the 1-indexed sequence with F1 = 1 and F2 = 1. Use arbitrary-precision integers if needed.
## Examples
Input: 1
Expected Output: 1
Input: 5
Expected Output: 5
## R... |
M09 | Go | 16 | Solve the following programming problem in Go.
## Problem: Decimal To Binary
Read a non-negative integer N in decimal. Output its binary representation without leading zeros (except print '0' when N = 0).
## Examples
Input: 5
Expected Output: 101
Input: 8
Expected Output: 1000
## Requirements
- Write a co... |
M10 | Go | 16 | Solve the following programming problem in Go.
## Problem: Binary To Decimal
Read a string consisting only of characters '0' and '1'. Interpret it as a binary number and output the corresponding decimal integer without extra text.
## Examples
Input: 101
Expected Output: 5
Input: 1000
Expected Output: 8
## ... |
M11 | Go | 16 | Solve the following programming problem in Go.
## Problem: Substring Occurrences
Read a string S on the first line and a pattern P on the second line. Count how many times P appears in S, allowing overlapping matches, and output that integer count.
## Examples
Input: aaaa
aa
Expected Output: 3
Input: abcabc
a... |
M12 | Go | 16 | Solve the following programming problem in Go.
## Problem: Remove Vowels
Read a line of text and remove every vowel character (a, e, i, o, u in both uppercase and lowercase). Output the filtered string preserving the order of the remaining characters.
## Examples
Input: hello
Expected Output: hll
Input: Esote... |
M13 | Go | 16 | Solve the following programming problem in Go.
## Problem: Sort Numbers
Read an integer N on the first line followed by a second line containing N integers separated by spaces. Output the integers sorted in ascending order separated by single spaces.
## Examples
Input: 5
3 1 4 1 2
Expected Output: 1 1 2 3 4
I... |
M14 | Go | 16 | Solve the following programming problem in Go.
## Problem: Second Largest Distinct Number
Read an integer N ≥ 2 followed by N integers on the next line. Consider the distinct values and output the second largest distinct value. Inputs are guaranteed to contain at least two distinct numbers.
## Examples
Input: 4
1... |
M15 | Go | 16 | Solve the following programming problem in Go.
## Problem: Anagram Test
Read two lowercase strings S1 and S2 (no spaces) on separate lines. Output 'yes' if S1 and S2 contain exactly the same characters with the same multiplicities (anagrams), otherwise output 'no'.
## Examples
Input: listen
silent
Expected Outp... |
M16 | Go | 16 | Solve the following programming problem in Go.
## Problem: Interleave Two Strings
Read two strings S1 and S2 of equal length on separate lines. Construct a new string by alternating characters: S1[0], S2[0], S1[1], S2[1], ... until the end. Output the interleaved string.
## Examples
Input: abc
XYZ
Expected Outp... |
M17 | Go | 16 | Solve the following programming problem in Go.
## Problem: Replace Spaces With Underscores
Read a line of text and output the same string but with every space character replaced by an underscore ('_'). All other characters stay unchanged.
## Examples
Input: hello world
Expected Output: hello_world
Input: a b ... |
M18 | Go | 16 | Solve the following programming problem in Go.
## Problem: Sum Of List
Read an integer N followed by a line of N integers separated by spaces. Sum the integers exactly and output the total.
## Examples
Input: 4
1 2 3 4
Expected Output: 10
Input: 3
10 -5 -5
Expected Output: 0
## Requirements
- Write a comp... |
M19 | Go | 16 | Solve the following programming problem in Go.
## Problem: Characters At Even Indices
Read a string S and output a new string consisting of the characters at even indices (0-based) from S in their original order.
## Examples
Input: abcdef
Expected Output: ace
Input: a
Expected Output: a
## Requirements
- ... |
M20 | Go | 16 | Solve the following programming problem in Go.
## Problem: Count Distinct Characters
Read a string S and output the number of distinct characters present in S. Treat uppercase and lowercase as different characters.
## Examples
Input: aaa
Expected Output: 1
Input: abca
Expected Output: 3
## Requirements
- ... |
M01 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Palindrome Check
Read a string S and determine whether it reads the same forwards and backwards, comparing characters exactly (case-sensitive and including punctuation). Output 'yes' for palindromes and 'no' otherwise.
## Examples
Input: racecar
Ex... |
M02 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Word Count
Read a line consisting of words separated by single spaces. Count how many words appear (non-empty sequences between spaces) and output that integer.
## Examples
Input: hello world
Expected Output: 2
Input: one two three
Expected Out... |
M03 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Run Length Encoding
Read a string S and produce its run-length encoding: for each maximal block of identical characters, output the character followed immediately by the length of the block as a decimal integer. Concatenate all blocks and output the resu... |
M04 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Caesar Shift By 3
Read a lowercase alphabetic string S. Shift each letter forward by 3 positions in the English alphabet (wrapping z to c) and output the transformed string. Non-letter characters will not appear.
## Examples
Input: abc
Expected Out... |
M05 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Simple Binary Expression
Read an expression formatted as 'a op b' with single spaces, where a and b are integers and op is one of '+', '-', or '*'. Evaluate the expression using integer arithmetic and output the result as an integer.
## Examples
Inpu... |
M06 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Greatest Common Divisor
Read two integers a and b separated by whitespace. Compute their greatest common divisor as a positive integer and output that value.
## Examples
Input: 12 18
Expected Output: 6
Input: 7 5
Expected Output: 1
## Requirem... |
M07 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Factorial
Read an integer N with 0 ≤ N ≤ 10. Compute N! (the factorial) using integer arithmetic and output the result.
## Examples
Input: 5
Expected Output: 120
Input: 0
Expected Output: 1
## Requirements
- Write a complete, self-contained p... |
M08 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Nth Fibonacci Number
Read an integer N ≥ 1 and output the Nth Fibonacci number using the 1-indexed sequence with F1 = 1 and F2 = 1. Use arbitrary-precision integers if needed.
## Examples
Input: 1
Expected Output: 1
Input: 5
Expected Output: 5
... |
M09 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Decimal To Binary
Read a non-negative integer N in decimal. Output its binary representation without leading zeros (except print '0' when N = 0).
## Examples
Input: 5
Expected Output: 101
Input: 8
Expected Output: 1000
## Requirements
- Write... |
M10 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Binary To Decimal
Read a string consisting only of characters '0' and '1'. Interpret it as a binary number and output the corresponding decimal integer without extra text.
## Examples
Input: 101
Expected Output: 5
Input: 1000
Expected Output: 8... |
M11 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Substring Occurrences
Read a string S on the first line and a pattern P on the second line. Count how many times P appears in S, allowing overlapping matches, and output that integer count.
## Examples
Input: aaaa
aa
Expected Output: 3
Input: abc... |
M12 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Remove Vowels
Read a line of text and remove every vowel character (a, e, i, o, u in both uppercase and lowercase). Output the filtered string preserving the order of the remaining characters.
## Examples
Input: hello
Expected Output: hll
Input: ... |
M13 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Sort Numbers
Read an integer N on the first line followed by a second line containing N integers separated by spaces. Output the integers sorted in ascending order separated by single spaces.
## Examples
Input: 5
3 1 4 1 2
Expected Output: 1 1 2 3 ... |
M14 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Second Largest Distinct Number
Read an integer N ≥ 2 followed by N integers on the next line. Consider the distinct values and output the second largest distinct value. Inputs are guaranteed to contain at least two distinct numbers.
## Examples
Input... |
M15 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Anagram Test
Read two lowercase strings S1 and S2 (no spaces) on separate lines. Output 'yes' if S1 and S2 contain exactly the same characters with the same multiplicities (anagrams), otherwise output 'no'.
## Examples
Input: listen
silent
Expected... |
M16 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Interleave Two Strings
Read two strings S1 and S2 of equal length on separate lines. Construct a new string by alternating characters: S1[0], S2[0], S1[1], S2[1], ... until the end. Output the interleaved string.
## Examples
Input: abc
XYZ
Expected... |
M17 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Replace Spaces With Underscores
Read a line of text and output the same string but with every space character replaced by an underscore ('_'). All other characters stay unchanged.
## Examples
Input: hello world
Expected Output: hello_world
Input:... |
M18 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Sum Of List
Read an integer N followed by a line of N integers separated by spaces. Sum the integers exactly and output the total.
## Examples
Input: 4
1 2 3 4
Expected Output: 10
Input: 3
10 -5 -5
Expected Output: 0
## Requirements
- Write a... |
M19 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Characters At Even Indices
Read a string S and output a new string consisting of the characters at even indices (0-based) from S in their original order.
## Examples
Input: abcdef
Expected Output: ace
Input: a
Expected Output: a
## Requirement... |
M20 | Haskell | 42 | Solve the following programming problem in Haskell.
## Problem: Count Distinct Characters
Read a string S and output the number of distinct characters present in S. Treat uppercase and lowercase as different characters.
## Examples
Input: aaa
Expected Output: 1
Input: abca
Expected Output: 3
## Requirement... |
M01 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Palindrome Check
Read a string S and determine whether it reads the same forwards and backwards, comparing characters exactly (case-sensitive and including punctuation). Output 'yes' for palindromes and 'no' otherwise.
## Examples
Input: racecar
Expe... |
M02 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Word Count
Read a line consisting of words separated by single spaces. Count how many words appear (non-empty sequences between spaces) and output that integer.
## Examples
Input: hello world
Expected Output: 2
Input: one two three
Expected Outpu... |
M03 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Run Length Encoding
Read a string S and produce its run-length encoding: for each maximal block of identical characters, output the character followed immediately by the length of the block as a decimal integer. Concatenate all blocks and output the result... |
M04 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Caesar Shift By 3
Read a lowercase alphabetic string S. Shift each letter forward by 3 positions in the English alphabet (wrapping z to c) and output the transformed string. Non-letter characters will not appear.
## Examples
Input: abc
Expected Outpu... |
M05 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Simple Binary Expression
Read an expression formatted as 'a op b' with single spaces, where a and b are integers and op is one of '+', '-', or '*'. Evaluate the expression using integer arithmetic and output the result as an integer.
## Examples
Input:... |
M06 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Greatest Common Divisor
Read two integers a and b separated by whitespace. Compute their greatest common divisor as a positive integer and output that value.
## Examples
Input: 12 18
Expected Output: 6
Input: 7 5
Expected Output: 1
## Requiremen... |
M07 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Factorial
Read an integer N with 0 ≤ N ≤ 10. Compute N! (the factorial) using integer arithmetic and output the result.
## Examples
Input: 5
Expected Output: 120
Input: 0
Expected Output: 1
## Requirements
- Write a complete, self-contained pro... |
M08 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Nth Fibonacci Number
Read an integer N ≥ 1 and output the Nth Fibonacci number using the 1-indexed sequence with F1 = 1 and F2 = 1. Use arbitrary-precision integers if needed.
## Examples
Input: 1
Expected Output: 1
Input: 5
Expected Output: 5
#... |
M09 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Decimal To Binary
Read a non-negative integer N in decimal. Output its binary representation without leading zeros (except print '0' when N = 0).
## Examples
Input: 5
Expected Output: 101
Input: 8
Expected Output: 1000
## Requirements
- Write a... |
M10 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Binary To Decimal
Read a string consisting only of characters '0' and '1'. Interpret it as a binary number and output the corresponding decimal integer without extra text.
## Examples
Input: 101
Expected Output: 5
Input: 1000
Expected Output: 8
... |
M11 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Substring Occurrences
Read a string S on the first line and a pattern P on the second line. Count how many times P appears in S, allowing overlapping matches, and output that integer count.
## Examples
Input: aaaa
aa
Expected Output: 3
Input: abcab... |
M12 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Remove Vowels
Read a line of text and remove every vowel character (a, e, i, o, u in both uppercase and lowercase). Output the filtered string preserving the order of the remaining characters.
## Examples
Input: hello
Expected Output: hll
Input: Es... |
M13 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Sort Numbers
Read an integer N on the first line followed by a second line containing N integers separated by spaces. Output the integers sorted in ascending order separated by single spaces.
## Examples
Input: 5
3 1 4 1 2
Expected Output: 1 1 2 3 4
... |
M14 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Second Largest Distinct Number
Read an integer N ≥ 2 followed by N integers on the next line. Consider the distinct values and output the second largest distinct value. Inputs are guaranteed to contain at least two distinct numbers.
## Examples
Input: ... |
M15 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Anagram Test
Read two lowercase strings S1 and S2 (no spaces) on separate lines. Output 'yes' if S1 and S2 contain exactly the same characters with the same multiplicities (anagrams), otherwise output 'no'.
## Examples
Input: listen
silent
Expected O... |
M16 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Interleave Two Strings
Read two strings S1 and S2 of equal length on separate lines. Construct a new string by alternating characters: S1[0], S2[0], S1[1], S2[1], ... until the end. Output the interleaved string.
## Examples
Input: abc
XYZ
Expected O... |
M17 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Replace Spaces With Underscores
Read a line of text and output the same string but with every space character replaced by an underscore ('_'). All other characters stay unchanged.
## Examples
Input: hello world
Expected Output: hello_world
Input: a... |
M18 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Sum Of List
Read an integer N followed by a line of N integers separated by spaces. Sum the integers exactly and output the total.
## Examples
Input: 4
1 2 3 4
Expected Output: 10
Input: 3
10 -5 -5
Expected Output: 0
## Requirements
- Write a c... |
M19 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Characters At Even Indices
Read a string S and output a new string consisting of the characters at even indices (0-based) from S in their original order.
## Examples
Input: abcdef
Expected Output: ace
Input: a
Expected Output: a
## Requirements
... |
M20 | OCaml | 47 | Solve the following programming problem in OCaml.
## Problem: Count Distinct Characters
Read a string S and output the number of distinct characters present in S. Treat uppercase and lowercase as different characters.
## Examples
Input: aaa
Expected Output: 1
Input: abca
Expected Output: 3
## Requirements
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.