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,789 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Erased Digit SequenceFind the smallest N so K consecutive integers starting at N each contain the corresponding given digit. | Medium5 | Brute forceString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| More or Less AccurateAdd one to each negabinary number in the input and print the result without leading zeros. | Medium5 | MathString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| The Kth Anagram in Alphabetical OrderGiven a word and rank K, print the Kth distinct anagram of the word in alphabetical order. | Medium5 | CombinatoricsString | No attempts yet | 1s | 256 MB | Judgeable |
| Check Amount ValidationCheck whether each English check amount follows the grammar and matches the given digit amount. | Medium5 | StringSimulation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Permutation with no spacesRecover the permutation from 1 to N whose decimal forms concatenate to the given digit string, choosing the lexicographically smallest one on ties. | Medium5 | BacktrackingBrute force+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Ancient Dictionary OrderDecide whether some alphabet order makes each given word list sorted lexicographically. | Medium5 | Topological sortGraph+1 | No attempts yet | 8s | 256 MB | Judgeable |
| Song TitlesRearrange each title into the lexicographically smallest anagram with no equal adjacent letters, or report IMPOSSIBLE when none exists. | Medium5 | GreedyHeap+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Easy ArithmeticInsert extra plus and minus signs between the digits of the given expression so the resulting valid expression has the largest possible value. | Medium5 | GreedyString | No attempts yet | 2s | 256 MB | Judgeable |
| Each digit at most twiceFind the largest integer L not greater than U whose decimal digits each appear at most twice. | Medium5 | BacktrackingGreedy+1 | No attempts yet | 3s | 256 MB | Judgeable |
| The RepeaterEqualize N lowercase strings using only adjacent duplicate insertions and deletions with the fewest moves, or report impossibility. | Medium5 | StringSorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| The Repeater (Large)Decide whether N lowercase strings can be made identical by duplicating or deleting adjacent equal letters, and report the fewest moves. | Medium5 | StringSorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Consonants (Large)Count the substrings of each given name that contain at least n consecutive consonants. | Medium5 | StringCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Recycled Numbers (Large)Count pairs n < m in [A, B] with equal digits where m is a rotation of n with no leading zero, counting each pair once. | Medium5 | StringBrute force+1 | No attempts yet | 5s | 512 MB | Judgeable |
| The Killer Word (Small)Pick the dictionary word that makes Sean miss the most guesses under his order-based guessing rule, breaking ties by dictionary order. | Medium5 | SimulationString+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Irregular Expressions (Large)Decide if any substring of each string splits into equal start and end words of two or more syllables around a middle word. | Medium5 | Brute forceString+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Decision Tree (Large)Parse a nested decision tree with optional feature names, then multiply node weights along the path chosen by each animal's features. | Medium5 | StringRecursion+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Counting welcome to code jam subsequencesCount subsequences of each input text that spell the 19-character target string, printed as the last four digits. | Medium5 | Dynamic programmingString | No attempts yet | 5s | 512 MB | Judgeable |
| Color Wheel (Small)Repaint a circular string of R, G, B cells K times by a local rule, then report the final count of each color. | Medium5 | SimulationString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| String TheoryGiven alternating runs of quote characters, find the largest k for which the whole string is a k-quotation. | Medium5 | Dynamic programmingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Name GeneratorSplit a string into k different non-empty consecutive parts, or report that no such split exists, choosing the lexicographically smallest sequence. | Medium5 | StringGreedy+1 | No attempts yet | 2s | 256 MB | Judgeable |
| A and B 2Given two strings of A and B, decide whether repeatedly appending A or appending B then reversing can turn S into T. | Medium5 | StringGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Nice PairsCount pairs (x, y) with A <= x < y <= B where y is a rotation of x's digits (a suffix moved to the front), counting duplicates only once. | Medium5 | StringMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DucksSplit a string of q,u,a,c,k into the fewest interleaved subsequences, each reading as 'quack' repeated. | Medium5 | GreedySimulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Palindromic substringsCount length-N uppercase strings whose length-M substrings include at least K palindromes. | Medium5 | Brute forceString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Turning A into BGiven two equal-length uppercase strings A and B, find the minimum number of moves that bring a chosen character to the front of A so that A becomes B, or -1 if impossible. | Medium5 | StringGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DNA SequencingEach printed line can be trimmed to any prefix; pick prefixes of length at least M so the number of distinct resulting strings is maximized. | Medium5 | TrieString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Secret PasswordGiven two length-N sequences, decide whether one is a cyclic rotation of the other. | Medium5 | String matchingArray+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Bits EqualizerGiven S with 0, 1, ? and T with 0 and 1, find the fewest moves (0 to 1, ? to 0 or 1, swap two positions) to turn S into T, or -1. | Medium5 | GreedyString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hamming EllipsesCount words of length n over a q-symbol alphabet whose Hamming distances to two given words sum to exactly D. | Medium5 | CombinatoricsMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Hidden AnagramsGiven two lowercase strings s1 and s2, find the maximum length of a substring of s1 that is an anagram of some substring of s2. | Medium5 | Hash mapString+2 | No attempts yet | 10s | 512 MB | Judgeable |
| Othello RearrangementGiven two length-N strings of W and B, find the minimum number of swap-two-positions and flip-one-piece operations to turn the start into the target. | Medium5 | GreedyMath+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Tangsuyuk GameGiven a word of distinct letters, find the shortest memorized cyclic string each player repeats to always say the correct next letter. | Medium5 | StringMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Short Story ContestGiven words, a max line width C, and max lines per page L, find the fewest pages when each line is packed greedily left to right. | Medium5 | GreedyString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Erasing and WinningGiven an N-digit number and D, erase exactly D digits so the remaining digits, in order, form the largest possible number. Multiple test cases until 0 0. | Medium5 | GreedyStack+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Alphabet StringInsert the fewest lowercase letters into s so that deleting some letters leaves exactly a through z in order. | Medium5 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Cutting into three piecesDecide whether the second string can be cut into three non-empty pieces and reordered to equal the first string, printing the shortest-first valid split. | Medium5 | StringBrute force+1 | No attempts yet | 0.2s | 256 MB | Judgeable |
| AbbreviationScan a text and replace each maximal run of two or more single-capitalized words separated by single spaces with their initials followed by the original run in parentheses. | Medium5 | StringSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Credit Card RecoveryGiven a 16-digit encrypted string, find all original card numbers that the given encrypt rule (bump min up, max down, swap) would produce, printed in ascending order or banana. | Medium5 | Brute forceImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HackerBuild the minimal list of URLs that covers every known parameter with every malicious value, packing pairs into queries of at most P parameters by the given grouping rule. | Medium5 | ImplementationString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cities and StatesGiven up to 200,000 cities with names and two-letter state codes, count unordered pairs whose first two name letters match the other city's state code and vice versa, with different states. | Medium5 | Hash mapString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DNA stringGiven a DNA string S, find the shortest string over A, C, G, T that never occurs as a contiguous substring of S, breaking ties lexicographically. | Medium5 | StringString matching+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Phone Number Riddle (Small)Given a shuffled string formed from the English words of a phone number's digits, recover the digits, which are guaranteed to be in ascending order. | Medium5 | StringHash map+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Phone Number Riddle (Large)A shuffled concatenation of the English words for a phone number's digits is given; recover the digits, which are in ascending order. | Medium5 | StringHash map+2 | No attempts yet | 5s | 512 MB | Judgeable |
| The Last Word (Small)Given a string S, insert each letter at the front or back of the word as it arrives, and find the alphabetically largest word obtainable. | Medium5 | GreedyString+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Finding PrefixesGiven a set of N strings, count how many of M query strings appear as a prefix of at least one string in the set. | Medium5 | TrieString | No attempts yet | 1s | 1536 MB | Judgeable |
| Tidy Numbers (Large)Given N up to 10^18, find the largest number not exceeding N whose decimal digits are in non-decreasing order. | Medium5 | GreedyMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Unicorn Stable ArrangementGiven counts of red, yellow, and blue unicorns, arrange them in a ring so no two neighbors share a hair color, or report IMPOSSIBLE, printing the lexicographically smallest valid string. | Medium5 | GreedyImplementation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Hamming distance queriesGiven binary strings a and b, answer queries asking for the Hamming distance between a substring of a and a substring of b. | Medium5 | Prefix sumString+2 | No attempts yet | 6s | 512 MB | Judgeable |
| SlurpyDecide whether each uppercase string is a Slurpy, meaning a Slimp immediately followed by a Slump, where both are defined by recursive grammar rules. | Medium5 | RecursionString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Rock Paper Scissors MachineGiven two RPS strings, choose where in the opponent's longer string to start matching your shorter string and report the most wins. | Medium5 | StringString matching+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Hangul LCSGiven two Hangul strings of up to 1000 characters each, compute the length of their longest common subsequence in characters. | Medium5 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting a^i b^j c^k subsequencesCount subsequences of a string of a, b, c that read as some positive number of a's, then b's, then c's, modulo 1e9+7. | Medium5 | Dynamic programmingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| QueryreuQMaintain a string under append and pop-back operations, and after each operation print the number of palindromic substrings it contains. | Medium5 | StringDynamic programming+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Pen Pineapple Apple PenGiven a string of A, P, and p, find the maximum number of disjoint subsequence occurrences of the pattern p, P, A, p in order. | Medium5 | GreedyString+1 | No attempts yet | 1s | 32 MB | Judgeable |
| SignalDecode a 5-row pixel strip into digits: 3-column glyphs except 1, separated by blank columns. | Medium5 | ImplementationArray+1 | No attempts yet | 1s | 512 MB | Judgeable |
| PPAPDecide whether a length-1000000 string of P and A is generated from P by replacing a P with PPAP at each step. | Medium5 | StackString+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Demerit Points (DemeritPoints)Simulate a student's demerit events encoded as base-36 chars, tracking accumulated points and quotient-by-10 crossing, and output total expulsion weeks plus weapon or permanent marker. | Medium5 | SimulationString+2 | No attempts yet | 0.1s | 32 MB | Judgeable |
| Engineering CalculatorEvaluate an integer arithmetic expression with precedence, right-associative exponentiation and square root, and truncation toward zero for incomplete roots and divisions. | Medium5 | RecursionMath+2 | No attempts yet | 1s | 256 MB | Judgeable |
| BlogGiven a string of R, G, and B, find the minimum number of contiguous same-color paint operations needed to build it. | Medium5 | Dynamic programmingString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Longest Increasing Palindromic SubsequenceGiven up to 10^5 integers, find the longest contiguous subarray that is a palindrome whose values strictly rise from both ends toward the center. | Medium5 | StringTwo pointers+1 | No attempts yet | 1.5s | 512 MB | Judgeable |
| I Have Few Friends (Large)Find whether keyword K appears in S as an exact substring, digits and all, and print 1 or 0. | Medium5 | String matchingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| GCC Min Max ExpressionEvaluate an expression containing the <? (min) and >? (max) operators plus + and -, respecting precedence, left associativity, and parentheses. | Medium5 | StackImplementation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| H to OCount each atom's total from the input formula multiplied by k and from the output formula, then divide each element's counts to find the smallest quotient, the output count. | Medium5 | StringHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| FluteGiven four scrambled lamp grids whose lit lamps may include burned-out (dark) ones, output the earliest valid time matching each grid as a digit pattern. | Medium5 | ImplementationBrute force+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Making a PalindromeFind the largest odd-length palindrome centered at index i, then answer each query by dropping the rest of the N cards. | Medium5 | String matchingDynamic programming+1 | No attempts yet | 1s | 512 MB | Judgeable |
| PokegeneCount, for each query, how many string prefixes occur in exactly L of the K listed genomes. | Medium5 | StringString matching+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Binary StringDelete the fewest bits from a binary string so the remaining subsequence keeps no leading zeros and has value at most K. | Medium5 | StringGreedy+2 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Hard DriveBuild a length-n bit string where fixed-zero positions stay zero, bit 1 and bit n are pinned, and the number of adjacent bit changes is exactly c. | Medium5 | GreedyImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Email DestructionGiven n, k and k distinct shuffled email subjects of repeated 'Re: ' prefixes plus letters, decide whether exactly n emails could have existed before deletion. | Medium5 | StringHash map+1 | No attempts yet | 3s | 512 MB | Judgeable |
| MagnusDelete any letters from a length-N uppercase word so the kept letters contain as many disjoint subsequences "HONI" as possible, and print that maximum. | Medium5 | GreedyString+1 | No attempts yet | 1s | 512 MB | Judgeable |
| JuniorGiven names in birth order with optional junior or iii suffixes, count people who have no earlier possible parent under the naming rules, which is the number of families. | Medium5 | Hash mapString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| String GuessingGiven all 2N-2 prefixes and suffixes of a hidden string, recover the string and label each input line as prefix or suffix in order. | Medium5 | StringHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Bowling Score CalculationGiven a string describing each ball's result in a 10-frame bowling game (S for strike, P for spare, - for zero, digits otherwise), compute the final score using strike and spare bonus rules. | Medium5 | SimulationImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Making the Number NCount how many digit-by-digit sequences build the number N when each new digit is attached to the left or right end. | Medium5 | Dynamic programmingString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| StringsBuild strings by concatenating earlier strings or slicing a substring, then output the sum of ASCII codes of the final string modulo 1e9+7, without materializing the possibly huge string. | Medium5 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Summer TripGiven a string of event types, count contiguous substrings of length at least two whose first and last characters are distinct and each appears only once in the substring. | Medium5 | StringTwo pointers+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| PalindromeFor each string, print 0 if it is a palindrome, 1 if deleting one character makes it a palindrome, or 2 otherwise. | Medium5 | StringTwo pointers+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Efficient ExchangeGiven a payment amount, minimize the total number of power-of-10 coins exchanged in both directions, allowing both sides to give change. | Medium5 | Dynamic programmingGreedy+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Jinsu's Daily RoutineGiven N and a binary string B with '?' wildcards, and A = 2^N - 1 (all ones), find the maximum and minimum bit-lengths of A*B over all replacements of the '?'. | Medium5 | GreedyString+2 | No attempts yet | 2s | 256 MB | Judgeable |
| What Does UNIST Stand For?Count ways to pick a prefix of each of N words so the concatenation spells UNIST, modulo 1e9+7. | Medium5 | Dynamic programmingString+2 | No attempts yet | 1s | 512 MB | Judgeable |
| TypoGiven a dictionary of unique words, print each word that becomes another dictionary word after deleting exactly one character, in input order. | Medium5 | Hash mapString+2 | No attempts yet | 6s | 512 MB | Judgeable |
| Drop The Byte!Given a hex string and a sequence of type sizes (char 2 digits, int 8, long_long 16), split the string and print each piece as a decimal value. | Medium5 | ImplementationString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| HowlGiven a valid howl over A, H, O, W, construct a valid howl that is strictly longer, or report that none exists. | Medium5 | StringGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Levenshtein DistanceGiven an alphabet and a string s, list every distinct string over that alphabet whose Levenshtein distance from s is exactly 1, sorted alphabetically. | Medium5 | StringBrute force+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Rainbow StringsCount subsequences of a string in which no letter repeats, distinguishing them by position, modulo 11092019. | Medium5 | Dynamic programmingMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Alphabet AnimalsGiven the previous animal and a list of unused names, pick a playable name that leaves the next player with no valid move, preferring that over any playable name. | Medium5 | Hash mapImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Word MemorizationTrack which letters are currently remembered and, after each forget or recall query, report how many dictionary words contain only remembered letters. | Medium5 | Bit manipulationHash map+2 | No attempts yet | 4s | 1024 MB | Judgeable |
| Reversing StringsFor each string choose to reverse it or not so the sequence becomes lexicographically sorted, and output the lexicographically smallest such 0-1 choice string. | Medium5 | GreedyString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| How Many TestsGiven some surviving file names (equal length, digits only), find the minimum and maximum possible original test count n consistent with the zero-padding naming rule. | Medium5 | ImplementationMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Different digitsGiven n up to 10^18, find the smallest integer strictly greater than n whose decimal digits have no two adjacent equal digits. | Medium5 | GreedyMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Olympiad RegistrationEach row was written in one of two field orders; use the guarantee that every first name appears at least twice to recover each participant's surname, given name, and patronymic, then sort by surname. | Medium5 | Hash mapString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Making WordsFor each 3x3 letter board, find which center letters yield the fewest and the most dictionary words of length 4 or more, along with those counts. | Medium6 | StringBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| String DistanceGiven strings O and N, find the minimum number of substring-insertion operations to turn O into N, or output -1 if impossible. | Medium6 | Dynamic programmingString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Can You Do Arithmetic?Parse and evaluate an arithmetic expression with +,-,*,/ and parentheses, respecting precedence, and print ROCK if the expression is invalid or divides by zero. | Medium6 | StringStack+2 | No attempts yet | 2s | 128 MB | Judgeable |
| String DecorationGiven N words that can each be cut into ordered pieces and interleaved freely, find the lexicographically smallest concatenation of all pieces. | Medium6 | GreedyString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Composite PrimeGiven up to 1e5 queries with N as large as 10^7, find the largest composite number at most N whose every proper contiguous digit substring of length 2 or more is prime. | Medium6 | BacktrackingMath+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Next Palindrome NumberGiven a positive integer with up to 50 digits, construct the smallest palindrome number strictly greater than it. | Medium6 | StringMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Password Attempt CountGiven a fixed alphabet order and a password, compute the attempt number at which that string appears in the length-then-lexicographic enumeration, modulo 900528. | Medium6 | MathString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| God of NumbersChoose N numbers from K given natural numbers, using every distinct input at least once, and arrange them to concatenate into the largest possible number. | Medium6 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Card PlacementAssign N cards with numbers and letters to N ordered bins under a numeric constraint to build the lexicographically smallest string, or report impossibility. | Medium6 | GreedySorting+2 | No attempts yet | 2s | 128 MB | Judgeable |