Problems
Pick a problem and write your solution in the built-in editor. The judge runs it against real test cases while you watch, and the wider archive is open to read whenever you like.
Total results1,786 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| The Genome Database of All Space LifeDecode a run-length compressed genome string with nested parentheses and print the character at index i, or 0 if the index is out of range. | Medium6 | StringRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Adjacent EdgesRead several triangle meshes, label distinct vertices by first appearance, and for each triangle report the opposite vertex of the triangle sharing each of its three edges, or X when none exists. | Medium6 | Hash mapGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Computer ScienceScore each page for a query word using occurrences in the page and in linking pages weighted by word distance to the hyperlink, then print the highest scoring pages. | Medium6 | ImplementationString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| New FriendsGiven up to 10 town names, partition them into the fewest groups where every pair of names in a group differ by at most one Levenshtein edit (case ignored). | Medium6 | StringGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ToponymsGiven up to a million strings, find a subset maximizing the longest common prefix length times the subset size. | Medium6 | StringTrie+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Valid Binary StringGiven a binary string with erased positions, decide whether the missing bits can be filled so the counts of 0 and 1 are equal and no character runs three times in a row. | Medium6 | GreedyString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Equal Is Not Really EqualGiven a string, decide whether a different string of the same length has an identical multiset of consecutive character pairs. | Medium6 | GraphString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PalindromeGiven a string, find the minimum number of characters to insert anywhere so the string becomes a palindrome. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| The Third Smallest NumberGiven n distinct natural numbers, list all two-element ordered concatenations by value and report the third smallest. | Medium6 | StringSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cellphone Keypad AutocompleteFor each word in a dictionary, compute how many letters a phone keypad must type when unique suffixes are autofilled, then print the average presses. | Medium6 | TrieTree+2 | No attempts yet | 1s | 192 MB | Judgeable |
| Balanced Cow BreedsCount the ways to 2-color the parentheses in a string so that each color class, read in order, forms a balanced parenthesis sequence. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Secret MessageGiven M binary messages and N binary codewords, count for each codeword how many messages share a prefix relation with it in either direction. | Medium6 | TrieString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cheapest PalindromeGiven a string and per-letter insertion and deletion costs, find the minimum cost to turn it into a palindrome by adding or removing characters anywhere. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Computerizing a StockroomParse handwritten stockroom transactions in chronological order, track computers and part inventories, then print owner and stock summaries sorted by a custom phrase order. | Medium6 | ImplementationString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Round and Round We GoFor each given number, decide whether every product by 1 through its digit count is a rotation of its digits, keeping leading zeros. | Medium6 | StringMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| A Well-Formed ProblemParse a series of XML documents and decide whether each one satisfies six well-formedness rules, reporting the verdict per document. | Medium6 | StringStack+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Code BreakingDecide whether some periodic permutation maps plaintext to ciphertext1, find the smallest valid period and permutation, then decrypt ciphertext2 with its inverse. | Medium6 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Car TriallingParse each line against a small case-sensitive grammar and decide whether it is a valid car-trialling instruction, echoing it with spaced collapsed or printing Trap!. | Medium6 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pascal Program LengthsCount the scored tokens (reserved words, identifiers, constants, parentheses, brackets, and listed operators) in each Turbo Pascal program, skipping comments and strings, and print the member's name with the total. | Medium6 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PostScript Printer DriverSimulate a page renderer that places font C1 and 5x6 asterisk-font C5 strings on a 60x60 grid with left, right, center, and absolute justification, where blanks and dots never overwrite. | Medium6 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Finite State Text-Processing MachineSimulate several finite state machines over given input, matching transitions by input sets and printing each transition's output string until END is reached. | Medium6 | SimulationGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Dihedral GroupsNormalize a run-length abbreviated string of rotations r and reflections m into the unique shortest equivalent sequence under the dihedral group of order 2n. | Medium6 | MathString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Even a Kindergartner Could Solve ThisDecide whether each string over the alphabet {, }, and comma is a valid set by the given grammar, where brace characters can be either delimiters or atoms. | Medium6 | StringDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Boolean LogicParse a fully parenthesized proposition formula, then print a truth table with each subformula's value placed at its symbol or operator column. | Medium6 | ImplementationRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Run Length EncodingEncode each input line with run-length encoding: runs of 2 to 9 repeats become a count plus the character, longer runs split at 9, and everything else is wrapped in 1s with each 1 doubled. | Medium6 | StringSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bug CatcherFor each code line, repeatedly remove the first occurrence of a given bug string until no occurrence remains, then print the result. | Medium6 | StackString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Roman ExpressionsParse lines of Roman numeral arithmetic with ten registers, evaluating each assignment and printing the result or Error, handling RESET and QUIT. | Medium6 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Comment removalStrip Pascal comments and collapse whitespace, honoring single-quote strings where doubled quotes are literals and comments can span lines. | Medium6 | StringSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sum of ProductsExpand a polynomial-like expression of variables into a sum of products, then sort each term's letters and sort the terms lexicographically. | Medium6 | StringRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Snow ConesGiven the handed-out and requested flavors for a line of children, find the minimum number of simultaneous-neighbor-swap time steps until each child holds the requested flavor. | Medium6 | GreedyTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Letter GameGiven up to 7 collected letters and a dictionary, find all words or pairs of words with the maximum total letter-value score, using each collected letter at most as often as it appears. | Medium6 | StringHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Recycling ProteinsGiven a source and target chain of amino acids, compute the minimum cost to convert one into the other using delete, insert, and replace with per-type costs. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| IP AddressesGiven a sequence of IP addresses added one by one, report which distinct addresses grep wrongly skipped because dots act as regex wildcards. | Medium6 | StringHash map+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Remove Redundant ParenthesesGiven valid arithmetic expressions over single uppercase variables with + and -, remove every matching parenthesis pair whose removal keeps the expression's value unchanged. | Medium6 | StackString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Gene FunctionAlign two DNA sequences by inserting blanks to maximize the sum of position-wise match values from a given table. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| Code FormattingParse a TRIVIAL program given by a grammar and print it back with strict indentation and whitespace rules. | Medium6 | ImplementationRecursion+2 | No attempts yet | 2s | 128 MB | Judgeable |
| String FoldingFind the length of the shortest folded sequence, using repeat counts like 3(AB), that unfolds to the given uppercase string. | Medium6 | Dynamic programmingString | No attempts yet | 2s | 128 MB | Judgeable |
| Dory's PhonebookGiven a dictionary of words and a phone number, find every encoding of the number as a space-separated sequence of dictionary words, sorted lexicographically. | Medium6 | TrieBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| VirusDecide whether every one of N integer sequences shares some contiguous fragment of length at least K, counting reversals as the same fragment. | Medium6 | StringString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hidden CodeGiven plaintext/ciphertext pairs encrypted with a common repeating key, recover the shortest key or report that none works. | Medium6 | StringMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| SpamCount how many plain-text messages encode to the same spam encoding as a given message. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| Burger, French Fries, Soft DrinkCount the ways to cut a B/F/S stream into N consecutive blocks where every block has equal positive counts of each letter, or report Impossible. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Chris MartinGiven a DNA string S of length n, find the smallest possible LCS length between S and any other length-n DNA string. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fibonacci WordsCount the occurrences of a given a/b pattern as a contiguous substring of the n-th Fibonacci word, overlaps included. | Medium6 | StringDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The Concatenation of WordsCount the increasing selections of given words whose concatenation equals a pattern, capped at 1000000, and print the lexicographically smallest selection. | Medium6 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SafeGiven a word and one rotation offset per wheel, find the minimum total turns to make all wheels display the same word. | Medium6 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| JanSplit a given lowercase word into the fewest pieces, each of which is lexicographically smaller than all of its nontrivial rotations, and print one valid minimum split. | Medium6 | StringGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bit SharkFind the length of the string left after repeatedly deleting the second half of any even-length palindrome, choosing deletions to maximize bits eaten. | Medium6 | StringGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Diamond CipherThe program writes each password as signed powers of three and lists the Up and Down switches. | Medium6 | MathString+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Paper FoldingRepeatedly fold the left part of a binary strip over the right where symbols match and find the shortest reachable length. | Medium6 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| LeetDecide whether the plain word can be split so each distinct letter maps to one fixed leet block of length at most k. | Medium6 | BacktrackingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| PeriodSplit string x into pieces to minimize the largest edit distance between y and any piece. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| Taunt BotSimulate a taunt bot that expands a fixed grammar with round-robin choices to print one taunt per three input words. | Medium6 | SimulationString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| String Insert and PrintMaintain a single string under positional insertions and print the requested substring for each query. | Medium6 | TreeString+1 | No attempts yet | 10s | 256 MB | Judgeable |
| Largest Subsequence NumberPick digits from N in order, without a leading zero, to form the largest value that leaves remainder R when divided by Q. | Medium6 | Dynamic programmingString+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Join the ConversationFind the longest chronological message chain where each message mentions the previous author, breaking ties by smallest indices. | Medium6 | Dynamic programmingHash map+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Printing PlateFind the shortest plate that, pressed at every aligned position, leaves each fixed stripe in its own pure color. | Medium6 | Binary searchSliding window+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Encryption SystemGiven an encrypted string, list every original string that the chained first-letter replacement turns into it. | Medium6 | Brute forceSimulation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Not a subsequenceGiven alphabet size k and string s, find the length of the shortest string over the alphabet that is not a subsequence of s and count such strings modulo 1e9+7. | Medium6 | GreedyString+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Anagram PyramidsDecide whether dictionary words can link the base word to the apex word by deleting and rearranging one letter at each step. | Medium6 | GraphBFS+1 | No attempts yet | 2s | 256 MB | Judgeable |
| ZGODANGiven a non-handsome integer with up to 1000 digits, find the nearest integer whose consecutive digits alternate between even and odd, printing both on a tie. | Medium6 | GreedyString+1 | No attempts yet | 1s | 32 MB | Judgeable |
| Interval CompositionFind the maximum length L such that each of the two lowercase strings has a contiguous block of length L with the same letter counts. | Medium6 | Prefix sumHash map+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Free WillyApply at most L of the given position permutations to turn the start word into the target word with the fewest steps. | Medium6 | BFSGraph+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Zig Zag NametagGiven k, print the shortest lowercase string with adjacent letter differences summing to k, smallest alphabetically on ties. | Medium6 | GreedyString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| MarkleftThe program converts each input line with nested markup rules for uppercase, quote escaping, decimal to hex, reversal, and verbatim copying. | Medium6 | StackString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| DepactingDecode a nested Pact structure with run-length repeats and omitted record fields, then answer value queries on it. | Medium6 | RecursionString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| InterpreterRun small integer programs with arithmetic, comparisons, if/else branches, while loops, and print statements. | Medium6 | SimulationImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| All Your Base (Small)Each test string is a numeral in an unknown base, with distinct symbols for distinct digits; find the smallest value it can represent, avoiding leading zeros. | Medium6 | GreedyMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| IgraGiven two length-N strings over {a,b,c}, permute the multiset from the second so no position matches the first and the result is lexicographically smallest. | Medium6 | GreedyString+1 | No attempts yet | 1s | 64 MB | Judgeable |
| PalinilapA lowercase string may be modified at exactly one position or left alone; find the maximum number of palindromic substrings achievable. | Medium6 | StringDynamic programming+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Binary string restorationGiven counts of each of the four adjacent pairs, build the lexicographically smallest binary string of length a+b+c+d+1 that realizes them, or report impossible. | Medium6 | StringGreedy+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Lexicographic SortingCount subsets of the integers in [A, B] whose lexicographic order as strings matches their numerical order, modulo 1e9+7. | Medium6 | SortingString+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Equivalent StringsDecide whether two equal-length strings are equivalent under recursive splitting and optional swap of halves. | Medium6 | Divide and conquerString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| A and BGiven two strings of A and B, decide whether S can be turned into T using only: append A, or reverse then append B. | Medium6 | GreedyString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Robot MovementA robot walks on an infinite grid following a fixed-length string of U, D, L, R moves. Change at most M characters to maximize how many times it returns to the origin. | Medium6 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Zeroes and OnesInvert two adjacent characters of either of two binary strings to make them equal, using the fewest operations, or report -1. | Medium6 | MathString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| RATS SequenceSimulate a RATS sequence term by term for up to M steps, detecting the first term that repeats an earlier value or first takes the chain form 1233*4444 or 5566*7777. | Medium6 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| M and ADecide whether S can be interleaved character by character from a subsequence of S and a subsequence of T, both of the same length as S. | Medium6 | Dynamic programmingString | No attempts yet | 5s | 512 MB | Judgeable |
| Shifting a MatrixParse a compressed shift-operation string with nested repetitions, apply the row and column rotations to an N by N matrix, and print the result. | Medium6 | SimulationImplementation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Prefix and SuffixCount the distinct substrings of S that both start with string A and end with string B, where A and B may overlap within a substring. | Medium6 | StringHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| BracketsGiven a bracket string, decide whether flipping the brackets in at most one contiguous segment can turn the whole string into a balanced, valid bracket sequence. | Medium6 | GreedyPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Bless You Autocorrect!For each target word, compute the fewest keystrokes using letter keys, tab (autocomplete to the most common dictionary word matching the typed prefix), and backspace. | Medium6 | TrieDynamic programming+1 | No attempts yet | 3s | 512 MB | Judgeable |
| Number of good substringsCount how many distinct substrings of s contain at most k bad letters, counting equal substrings once. | Medium6 | StringHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Musical PlagiarismGiven a song as a sequence of notes and a suspect excerpt, decide whether the excerpt appears in the song under some transposition (key change). | Medium6 | String matchingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Recover the Alphabet OrderGiven words claimed to be lexicographically sorted, decide whether the letter order is unique, impossible, or ambiguous. | Medium6 | Topological sortGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Around and Around We GoLay out two voices of a song as a round, aligning each voice's symbols so that simultaneous sounds share a column and gaps print as plus signs. | Medium6 | SimulationImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Eleven LoverFor each number given as a digit string, count its substrings with no leading zero that are divisible by 11. | Medium6 | MathPrefix sum+1 | No attempts yet | 8s | 512 MB | Judgeable |
| Building Uppercase SentencesCount the distinct uppercase sentences you can form by deleting letters and grouping the rest into blocks of three identical letters. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 256 MB | Judgeable |
| Where To Go?A note string uses upper case letters and each station name uses lower case letters, so a match between them is an equality-pattern match between two windows of different alphabets. | Medium6 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Anadrome splitSplit a lowercase word into the fewest substrings that are each anagrams of some palindrome, breaking ties by the lexicographically smallest printed line. | Medium6 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Attendance Record 2Given a string of A, B, C, rearrange its letters into the lexicographically smallest valid schedule where B needs a rest day after working and C needs two. | Medium6 | GreedyString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sherlock and Parentheses (Large)Given L opening and R closing parentheses, arrange a string of length L+R that maximizes the number of non-empty balanced substrings; output that maximum. | Medium6 | StringGreedy+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Counting Distinct SubsequencesCount the distinct subsequences of a string, including the empty string, for up to 10,000 test cases. | Medium6 | Dynamic programmingString+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Rather Perplexing Showdown (Small)Find the alphabetically smallest left-to-right lineup of R rocks, P papers, and S scissors so that a single-elimination bracket never pairs identical moves. | Medium6 | Divide and conquerRecursion+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Fortune telling with sticksGiven an n by m letter grid and p query words, find for each word the longest contiguous substring that can be placed along a row or column in one of four directions. | Medium6 | Brute forceImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Bovine Genomics (Gold)Given N spotted and N plain DNA strings of length M, find the shortest window of consecutive positions whose substrings separate every spotted string from every plain one. | Medium6 | StringHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Ant NestGiven paths of food names from the top floor down, print the merged tree with each node indented by two dashes per depth and children in dictionary order. | Medium6 | TrieTree+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Flow Graph ComplexityParse a comma-separated flow-graph string of S, B(...), L(...) nodes, count forward and backward edges and nodes, and print |EF| + W*|EB| - |V| + 2 or -1 if malformed. | Medium6 | StringImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Nothing But The TruthGiven facts about which person was at which place and when, count how many claims in a text (who met whom, who was where) are definitely false. | Medium6 | StringIntervals+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Import SpaghettiFind a shortest cycle in a directed dependency graph and print it in lexicographically smallest rotation order, or report that none exists. | Medium6 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |