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,020 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| The Perfect SymmetryGiven a set of distinct integer points, decide whether it has a center of symmetry and, if so, print that center to one decimal place. | Medium5 | Hash mapGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Spies Like UsGiven a bipartite graph, decide whether any two vertices on the same side share at most one common neighbor on the other side. | Medium5 | GraphHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Degrees of SeparationMaintain a friendship graph under edge insertions and deletions, and answer queries about friend counts, friends-of-friends counts, and shortest-path distance between two people. | Medium5 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SnowflakesGiven up to 100,000 snowflakes of six arm lengths each, find whether two are identical under cyclic rotation or reversal. | Medium5 | Hash mapString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ScribbleGiven seven tiles with letter values and a dictionary of up to 100000 words, find the highest-scoring dictionary word formable from the tiles, or 0 if none is. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SpamCount trigram frequencies in sample spam and non-spam messages, then classify each test message by which sample it matches more closely under the cosine similarity measure. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ChocolateGiven an M by N grid of labels, decide whether every label occupies exactly one solid axis-aligned rectangle. | Medium5 | MatrixImplementation+1 | No attempts yet | 1s | 1024 MB | Judgeable |
| Dynamic Declaration Language (DDL)Simulate a tiny language with dynamic variable declarations, jumps, and increments, printing a repeated-declaration or undeclared-reference error each time one occurs. | Medium5 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Spell CheckerGiven a dictionary and query words, mark each query correct, or list dictionary words reachable by one deletion, replacement, or insertion. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| CocktailsSimulate Angelo's cocktail mixing rules, track each cocktail's counts, and print the top ten by count then recipe-book order with computed prices. | Medium5 | SimulationHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Reconstructing Binary TreesGiven the pre-order and in-order traversals of a binary tree with distinct labels, print its post-order traversal or report that no tree matches. | Medium5 | TreeRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Random GapGiven a linear congruential generator, find the largest gap between neighboring distinct values the sequence produces. | Medium5 | SimulationHash map+2 | No attempts yet | 4s | 128 MB | Judgeable |
| Binary WitchGiven a binary string, predict the next L digits by matching suffixes of length 13 down to 1 against earlier occurrences, using the rightmost match. | Medium5 | StringString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BalanceGiven weights, split some into two equal-sum disjoint groups; find the largest weight that can be the heaviest used one. | Medium5 | Dynamic programmingSorting+2 | No attempts yet | 3s | 128 MB | Judgeable |
| RepetitionsGiven up to five lowercase words of length at most 2000, find the length of the longest substring that appears as a contiguous fragment in every word. | Medium5 | StringBinary search+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Paper StripFind the longest contiguous block of numbers that adds up to exactly s, or print BRAK when none exists. | Medium5 | Hash mapPrefix sum | No attempts yet | 1s | 128 MB | Judgeable |
| RadiotelegraphGiven n integers and at most w changes to any values, find the longest run of equal numbers achievable. | Medium5 | Sliding windowHash map | No attempts yet | 1s | 128 MB | Judgeable |
| Domino TilesCount pip frequencies to find the two odd endpoints of the domino chain, or report ambiguity when the chain can start anywhere. | Medium5 | GraphHash map | No attempts yet | 1s | 128 MB | Judgeable |
| Poetry with an AsteriskCount for each one-asterisk query how many dictionary words start with its prefix and end with its suffix without overlap. | Medium5 | Hash mapString | No attempts yet | 5s | 128 MB | Judgeable |
| Word Translation LookupGiven pairs of directly translated words, list every target-language word linked to each query word through translation chains. | Medium5 | Union-findHash map+1 | No attempts yet | 12s | 128 MB | Judgeable |
| MCSCount every length-k substring of a DNA string by its letter composition and report the size of the largest group. | Medium5 | Sliding windowHash map | No attempts yet | 5s | 128 MB | Judgeable |
| SymmetryDecide whether the given dots mirror exactly across some vertical line, printing YES or NO for each test case. | Medium5 | Hash mapGeometry+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RankingsPlayers accumulate points through updates and each query asks for the current rank of one player among up to 100000 players. | Medium5 | Segment treeSorting+1 | No attempts yet | 3s | 128 MB | Judgeable |
| SpaceCount, for each test case, the pairs of up to 100000 points whose Euclidean distance is strictly less than d. | Medium5 | Hash mapGeometry | No attempts yet | 1s | 128 MB | Judgeable |
| Call Me Back, Please!Read call records with start times and durations and list every pair of numbers with opposite-direction calls that fit in one 24-hour window. | Medium5 | Two pointersHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cracking the CodeGiven a plaintext and ciphertext candidates under a substitution cipher, keep every consistent match and decrypt X, printing '?' for ambiguous letters. | Medium5 | String matchingBrute force+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Decimal Representation LengthFor each n, report the longest decimal writing among all fractions a/b with a and b from 1 to n, where the count includes digits, the point, and parentheses. | Medium5 | SimulationHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Encrypted passwordDecide whether the original password's letters can be rearranged to match a contiguous block inside the encrypted password. | Medium5 | Sliding windowHash map+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Joe is learning to speakTrack every word block up to length n from known sentences and ask about each unknown word and each new sentence with an unseen block. | Medium5 | Hash mapSliding window+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Trending TopicMaintain word counts over a rolling 7-day window and answer each top N query in frequency order with ties included. | Medium5 | Sliding windowHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SMS PollNormalize phone formats to identify each sender, keep only the earliest valid vote per sender, and print truncated percentages and participant count. | Medium5 | StringHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Find the MarblesGiven up to 99 distinct integer points per test case, report the largest number of points that lie on one straight line. | Medium5 | GeometryHash map | No attempts yet | 1s | 128 MB | Judgeable |
| Alike TablesDecide whether two tables with distinct entries match after any row and column reorderings. | Medium5 | Hash mapMatrix | No attempts yet | 1s | 128 MB | Judgeable |
| ChorusFor each lyric, find its longest repeated substring and list which songs contain each query as a substring of it. | Medium5 | String matchingBinary search+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Fair PhotographyAfter sorting cows by position, find the widest interval with equal numbers of G and H cows, where single-breed intervals also count. | Medium5 | Prefix sumHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Gondola sequence checkDecide whether n observed gondola numbers could appear as consecutive passings on a circle where broken gondolas are replaced in order by numbered spares. | Medium5 | SimulationHash map+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Gondola ReplacementGiven the n cars seen on a circular gondola line, find one possible order of breakdowns that explains the observed numbers. | Medium5 | SortingHash map | No attempts yet | 1s | 256 MB | Judgeable |
| Distinct Subarray GCDsCount the distinct GCD values taken over all contiguous subarrays for each test case. | Medium5 | Number theoryDynamic programming+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Hexagonal colonyChoose hexagonal cell blocks so the exposed wall windows house at least P people with the fewest blocks. | Medium5 | GreedyGeometry+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Top 25 Poll ComparisonSplit two rankings of the same teams into the smallest consecutive groups that hold the same teams and print each size. | Medium5 | GreedyHash map | No attempts yet | 10s | 256 MB | Judgeable |
| Mushroom tractorMushrooms appear one per second, and the goal is the earliest second when some row, column, or diagonal contains at least K of them. | Medium5 | Hash mapMath | No attempts yet | 2s | 32 MB | Judgeable |
| Cow Routing IIFind the cheapest fare from city A to city B using at most two ordered flight routes, paying each used route full fare. | Medium5 | Brute forceHash map | No attempts yet | 1s | 256 MB | Judgeable |
| Color BallsFor each ball, add up the sizes of all strictly smaller balls with a different color. | Medium5 | SortingPrefix sum+1 | No attempts yet | 1s | 256 MB | Judgeable |
| DimensionsConvert defined units and evaluate each expression, printing results in SI base units or Incompatible for mismatched dimensions. | Medium5 | ImplementationHash map+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Goblin Garden GuardsCount how many of up to 100000 points remain uncovered by 20000 sprinkler circles of radius at most 100. | Medium5 | GeometryHash map | No attempts yet | 3s | 256 MB | Judgeable |
| Number of distinct substringsCount how many different contiguous substrings appear in a lowercase string of length up to 1000. | Medium5 | String matchingHash map+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Pyro TubesFor each value in a sorted list, count larger list values whose 18-bit patterns differ in at most two bits. | Medium5 | Bit manipulationHash map | No attempts yet | 13s | 256 MB | Judgeable |
| Fraction to Repeating DecimalWrite each given fraction as its decimal form with the shortest nonrepeating part and the repeating block in parentheses. | Medium5 | Hash mapMath+1 | No attempts yet | 1s | 256 MB | Judgeable |
| A Strange SequenceYou get the first N terms, each later term equals the count of distinct values before it, and you must output the Mth term. | Medium5 | SimulationHash map+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Mr. Kim's Grocery Store (Small)Given the sorted pile of 2N mixed normal and discounted price tags, recover the N sale prices. | Medium5 | GreedyHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Kim Incheon's Grocery Store (Large)Given 2N sorted tags that pair N sale prices with regular prices at 4/3 of each sale price, recover the N sale tags. | Medium5 | GreedyHash map+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Robot Rock Band (Small)Count quadruples with one element from each of four lists whose bitwise XOR equals K. | Medium5 | Hash mapBrute force | No attempts yet | 5s | 512 MB | Judgeable |
| Robot Rock Band (Large)Count quadruples with one element from each of four lists whose bitwise XOR equals K. | Medium5 | Hash mapBit manipulation | No attempts yet | 7s | 512 MB | Judgeable |
| Equal Subset Sums (Small)For each set of 20 distinct numbers, print two different non-empty subsets with equal sum in code order, or Impossible. | Medium5 | Brute forceHash map | No attempts yet | 5s | 512 MB | Judgeable |
| Equal SumsGiven up to 20 distinct numbers, print the two lexicographically smallest distinct subsets that share the smallest repeated sum, or Impossible. | Medium5 | Brute forceHash map+1 | No attempts yet | 20s | 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 |
| N-dimensional travelGiven a walk on an N-dimensional integer grid as a list of coordinate indices and signs, decide whether all visited points, including start and end, are distinct. | Medium5 | Hash mapImplementation+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 |
| 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 |
| Intervals of Unique NumbersCount pairs (i, j) where the subarray from i to j has all distinct values, with N up to 100000. | Medium5 | Two pointersSliding window+2 | No attempts yet | 1s | 32 MB | Judgeable |
| DwarvesGiven strict size comparisons between named dwarves, decide whether the statements are mutually consistent. | Medium5 | GraphTopological sort+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Minimum SwapsGiven permutations A and B, find the minimum number of swaps within A that turn it into B. | Medium5 | ArrayHash map+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Memory MatchGiven the history of a Memory match game, find how many pairs you can guarantee scoring on the current turn. | Medium5 | SimulationHash map+1 | 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 |
| Number of arithmetic triplesCount index triples i < j < k where the three values A_i, A_j, A_k form an arithmetic progression. | Medium5 | Hash mapMath | No attempts yet | 3s | 512 MB | Judgeable |
| Rouba-MonteSimulate a card game where players draw, steal montes, and discard mismatches; report the winners by monte size. | Medium5 | SimulationImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Command HistoryGiven a sequence of positions in a command history, simulate running each command by the nearest occurrence and total the up-arrow presses needed. | Medium5 | ArrayHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Chinese ClassicsGiven letters with returning marks (Re marks and numbered jump marks), simulate the reading rules and print the order in which letters are read. | Medium5 | SimulationImplementation+1 | No attempts yet | 8s | 512 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 |
| Arithmetic and Geometric SequencesCount integers from 1 to u that lie in an arithmetic sequence or a geometric sequence, counting overlaps only once. | Medium5 | MathHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Codejamon Cipher (Small)For each enciphered string, count the sentences of vocabulary words whose letter multisets concatenate to it, modulo 1e9+7. | Medium5 | Dynamic programmingHash map+1 | No attempts yet | 5s | 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 |
| PasswordsCount ordered pairs of distinct passwords where one string is a substring of the other, treating the passwords as a multiset of short strings. | Medium5 | String matchingHash map+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Killer SudokuRead a 19 by 37 ASCII diagram of a Killer Sudoku grid plus one sum per cage, and report OK or NotOK for all constraints. | Medium5 | ImplementationSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Easy QuestGiven a sequence of gifts (+type), costs (-type), and unicorns (0), decide if every cost can be paid and choose the lexicographically smallest item type for each unicorn. | Medium5 | GreedyImplementation+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Cakey McCakeFaceGiven sorted entry and exit timestamps, find the smallest nonnegative time difference d that maximizes how many entry times t satisfy t + d is an exit time. | Medium5 | Hash mapArray+2 | No attempts yet | 7s | 512 MB | Judgeable |
| Counting the closest pair sumsGiven n integers and a target v, count how many index pairs have a sum whose distance from v is as small as possible. | Medium5 | SortingTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Martian DNAGiven a string over K symbols and minimum counts for R of them, find the length of the shortest contiguous substring meeting all the quotas, or report impossible. | Medium5 | Sliding windowArray+2 | No attempts yet | 2s | 1024 MB | Judgeable |
| Rotating SushiOn a circular belt of N sushi plates, find the maximum number of distinct kinds in any k consecutive plates, counting the coupon kind c once more if it is not already present. | Medium5 | Sliding windowTwo pointers+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Longest Consecutive SubsequenceGiven an integer sequence, find the longest subsequence whose values form an arithmetic run with common difference 1, keeping the original order. | Medium5 | Dynamic programmingHash map+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Pants On FireGiven n true statements of the form "a are worse than b" that form a partial order, classify each of m queries as Fact, Alternative Fact, or Pants on Fire by transitive reachability. | Medium5 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Life on a TorusSimulate Conway's Life on a wrapped 8x8 torus and find the smallest repeat period reached after any transient. | Medium5 | SimulationHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Magic WeaponCount triples of details, one per color, where the red number's first and last digits match the green's last digit and the blue's first digit, and all three model numbers differ. | Medium5 | CombinatoricsMath+2 | No attempts yet | 2s | 512 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 |
| Building a FieldGiven N points on a circle with arc lengths between consecutive points, decide whether four trees are the vertices of some rectangle. | Medium5 | Hash mapGeometry+2 | 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 |
| Surface Area of CubesGiven an A x B x C block of unit cubes with N cubes removed (including interior ones), compute the total surface area including surfaces of interior cavities. | Medium5 | Hash mapMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| SiblingsGiven each woman's mother as an index, count pairs of women who share the same mother across several data sets. | Medium5 | Hash mapSorting+1 | No attempts yet | 2s | 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 |
| Divide by 3, Multiply by 2Given a shuffled copy B of the sequence produced by a divide-by-3, multiply-by-2 game, reconstruct the original order A. | Medium5 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Frequency-Greater Next ElementFor each position, find the nearest value to its right whose total frequency in the array exceeds the frequency of the current element, or -1 if none exists. | Medium5 | StackHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Analogue ClusterGiven n vertices with widths and c edges, recolor the fewest vertices so every edge joins equal widths, per connected component. | Medium5 | GraphGreedy+2 | No attempts yet | 1s | 512 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 |
| Fantasy DraftSimulate a snake-free fantasy draft where each owner repeatedly takes the best available player on their own preference list, falling back to the previous year's ranking. | Medium5 | SimulationHash map+2 | No attempts yet | 2s | 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 |
| Keyboards in ConcertGiven n keyboards, the sets of notes each can play, and the note sequence of a tune, find the minimum number of keyboard switches needed to play the whole tune. | Medium5 | Dynamic programmingHash map+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 |
| Managing DifficultiesCount triples of increasing indices i < j < k where a[j] - a[i] equals a[k] - a[j], so a[i] + a[k] = 2*a[j]. | Medium5 | Hash mapCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |