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 |
|---|---|---|---|---|---|---|
| ZigZagGiven K words and N letters, output for each letter the word starting with it that has been used fewest times, breaking ties alphabetically. | Medium4 | SortingHash map+2 | No attempts yet | 2s | 64 MB | Judgeable |
| Programming ExamFor each query, decide whether two given substrings of S are anagrams, printing DA or NE. | Medium4 | Prefix sumHash map+1 | No attempts yet | 3s | 128 MB | Judgeable |
| AutomobileStarting from a matrix where each cell holds its row-major index, apply K row and column multiplications and report the total sum modulo 1e9+7. | Medium4 | MathImplementation+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Go Go Go Special Action Force!Given a 9x9 grid of position codes, check whether each of the three groupings (columns, rows, and 3x3 blocks) contains all nine distinct codes. | Medium4 | ImplementationMatrix+2 | No attempts yet | 3s | 512 MB | Judgeable |
| N-Step SyllogismEach premise says all a are b; for each conclusion x is y, decide whether following the implication chain from x reaches y. | Medium4 | GraphDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| SegmentationTrack visits per user over time and answer queries by mapping each user's recency and frequency to one of 12 RF segments. | Medium4 | Hash mapImplementation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Trains crossing the Milky WaySimulate four seat operations across N trains, then count how many trains have a seating state that appears for the first time. | Medium4 | SimulationHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Drawing ArrowsEach point shoots an arrow to the nearest same-colored point; find the total length of all N arrows. Points are given unsorted, so sort them by position first. | Medium4 | SortingHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Drawing ArrowsEach point shoots an arrow to the nearest same-colored point; compute the total length of all arrows. | Medium4 | SortingHash map+2 | No attempts yet | 1s | 256 MB | Judgeable |
| ZamjenaGiven two arrays of numbers and variables, decide if one assignment of integers to variables makes corresponding positions equal. Consistent positions give constraints; any conflict answers NE. | Medium4 | Hash mapImplementation+1 | No attempts yet | 1s | 64 MB | Judgeable |
| KittyFind the longest contiguous substring with at most N distinct lowercase letters. | Medium4 | Sliding windowTwo pointers+1 | No attempts yet | 1s | 512 MB | Judgeable |
| String DiscriminationGiven a target string S and up to 100 words, decide whether S is a concatenation of words from the list, each reusable any number of times. | Medium4 | Dynamic programmingString+1 | No attempts yet | 2s | 512 MB | Judgeable |
| LazylandEach of n workers wants one of k jobs and costs b_i to reassign. Keep one worker per chosen job and reassign the cheapest extras to cover every missing job. Return the minimum total cost. | Medium4 | GreedySorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Contest SettingCount the ways to choose k problems whose difficulties are all distinct, given n problems and their difficulty values, modulo 998,244,353. | Medium4 | MathCombinatorics+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Back and ForthGiven ten bucket sizes at each of two barns, count the distinct amounts of milk that can end up in the first barn's tank after four alternating pours. | Medium4 | Brute forceSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| JarvisPick one integer X added to every factory frequency so that the count of indices with Ai + X = Bi is as large as possible. | Medium4 | Hash mapArray+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Cipher DecoderCheck whether the multiset of integers in the ciphertext matches the multiset of character codes of the given plaintext. | Medium4 | Hash mapSorting+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Pineapple AdvertisingAfter each of Q pizza deliveries to a house, report how many houses (the house itself plus its direct neighbors) like pineapple pizza for the first time. | Medium4 | GraphHash map+2 | No attempts yet | 1s | 256 MB | Judgeable |
| PatternGiven a sequence of grid points, decide whether it is a valid Android unlock pattern under the no-repeat and no-skipped-point rules. | Medium4 | ImplementationSimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| StreetlightsGiven N integer points, decide whether for every pair (xi,yi), (xj,yj) the two reflected points (xi,yj) and (xj,yi) are also present. | Medium4 | Hash mapSorting+2 | No attempts yet | 0.5s | 256 MB | Judgeable |
| Jung's RestaurantDecide whether a customer's order satisfies the restaurant rules: special items need 20000+ in regular items, service items need 50000+ combined and at most one. | Medium4 | Hash mapImplementation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| GPAGiven a catalog of courses with units, major requirements, and each student's grades, print each student's overall GPA and the GPA for every major whose requirements they completed. | Medium4 | Hash mapString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Baba is RabbitGiven commands of the form p is q, find all objects reachable from Baba by applying one or more commands, printed in lexicographic order. | Medium4 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Flight TurbulenceA permutation maps each seat to the passenger sitting there; count how many passengers shift when one passenger demands their assigned seat. | Medium4 | ArraySimulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Hardware SalesGiven three lists of (item ID, units) purchases, count items whose total units reach 20 or more in all three stores, printing IDs in first-appearance order. | Medium4 | Hash mapImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Integer DivisionCount pairs of indices whose values give the same quotient when both are divided by d using floor division. | Medium4 | Hash mapMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Problem ClassificationCount exact whole-word occurrences of each category's keywords in a statement, then print the categories with the highest total count in lexicographic order. | Medium4 | Hash mapString+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Where Am I?Given a string of N mailbox colors, find the smallest K such that all length-K substrings are distinct. The answer is always at most N. | Medium4 | StringBrute force+2 | No attempts yet | 1s | 512 MB | Judgeable |
| AntsGiven N integers, some negative or very large, find the smallest nonnegative integer that does not appear among the valid nonnegative values. | Medium4 | ArrayHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Valid EmailsNormalize each email by its rules, count how many are valid and distinct. | Medium4 | StringHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| LTBLRead match results between two teams, accumulate points, wins, draws, losses, and goals, then print the league table sorted by the six tiebreak rules. | Medium4 | ImplementationSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Multiverse IITwo universes are equal when their planet sizes give the same ordering and tie pattern; count pairs of the M universes that match. | Medium4 | SortingHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Coordinate CompressionFor each of N coordinates, output the number of distinct values smaller than it, which is its rank under coordinate compression. | Medium4 | SortingHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence and Queries 38Maintain a sequence under append, delete-one-copy, and report running sum and XOR of all elements. | Medium4 | Hash mapImplementation+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Cyber Opening CeremonyGiven start, end, and stream-end times plus chat logs, count members who chatted at or before the start and again between the end and stream-end. | Medium4 | Hash mapImplementation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| LampsGiven an N by M lamp grid where pressing a column switch exactly K times total flips columns, find the max number of rows that end up fully lit. | Medium5 | Hash mapString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Good NumbersGiven N integers, count how many of them equal the sum of two other numbers at two different positions in the sequence. | Medium5 | Two pointersArray+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Candidate RecommendationSimulate N photo frames where each recommendation either updates a displayed student's count or evicts the least-recommended, longest-displayed student to show the new one. | Medium5 | SimulationHash map+2 | No attempts yet | 2s | 128 MB | Judgeable |
| LaserGroup buildings by the ray from the origin, sort each group by distance, and find buildings whose laser is blocked by a closer, equally tall or taller building. | Medium5 | GeometrySorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Balanced LineupGiven fans sorted by x-coordinate with a gender bit each, find the longest contiguous segment that has an equal number of men and women. | Medium5 | Prefix sumHash map+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Sum of Subarrays from Two ArraysCount pairs of contiguous subarrays, one from each of two arrays, whose sums add up to a given target T. | Medium5 | ArrayHash map+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Number of RectanglesGiven up to 5000 points, count axis-aligned rectangles whose four corners are all present among the points. | Medium5 | Hash mapCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Rotating SushiFind the maximum distinct sushi types among any k consecutive plates on a circular belt, adding one bonus for a given coupon type if not already present. | Medium5 | Sliding windowHash map+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Trimming StringsFind how many top rows can be removed one at a time from a grid while all column strings (read top to bottom) remain pairwise distinct. | Medium5 | Binary searchString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Counting Axis-Aligned Right TrianglesCount triangles among N points where the right angle vertex has one point sharing its x-coordinate and another sharing its y-coordinate. | Medium5 | Hash mapMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Film FestivalGiven a bipartite graph of boat connections, count the number of pairs of left villages and pairs of right villages that form a complete K2,2 subgraph. | Medium5 | CombinatoricsHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| T9Simulate a T9 keypad predictor that maps key-press sequences to dictionary words, splitting on key 1 as space and marking unmatched words with asterisks. | Medium5 | StringHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PINCount pairs of 4-character PINs (from a given list) that differ in exactly D of their four positions. | Medium5 | Hash mapCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| LinkerGiven modules with export/import tables and an entry symbol, find the reachable non-redundant modules, duplicate exports used by them, and unresolved imports. | Medium5 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hands of PokerGiven a five card poker hand, compute its unique rank value from 1 to 7462 that orders all possible hands consistently. | Medium5 | SortingHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| DatabaseDetect whether any two rows in a table share equal values in two distinct columns, and if so output the lexicographically smallest violating row and column pair. | Medium5 | Brute forceHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Enchanted MirrorDecide if bricks with fixed (real,mirror) letter pairs can be permuted so the row reads T1 and its mirror reads T2, given initial words S1,S2. | Medium5 | Hash mapString+2 | No attempts yet | 3s | 256 MB | Judgeable |
| i18nGiven text lines, expand i18n-style abbreviations back into previously seen full words when the expansion is valid and unique, preserving capitalization and separators. | Medium5 | StringHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The Stable Marriage ProblemGiven male and female preference lists, compute and output the male-optimal stable matching using the Gale-Shapley algorithm. | Medium5 | GreedySimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Pathological PathsGiven a set of file paths defining a directory tree, resolve query paths (with '.', '..', and index.html shortcuts) and decide if two paths refer to the same existing file. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Soccer Bets16 shuffled match results with scores are given; reconstruct the single-elimination bracket and report the tournament winner. | Medium5 | GraphImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Block GameGiven a 6x6 sliding block board and a special 1x2 piece, find the minimum number of slides to move it out through a gap on the right. | Medium5 | BFSSimulation+1 | No attempts yet | 10s | 128 MB | Judgeable |
| MeganominoesFor each query i, count unordered pairs of distinct tiles where one matching pair of ends touches and the two opposite ends sum to i. | Medium5 | Hash mapBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bridges and TunnelsAfter each new edge between two named buildings, print the size of the connected component that the edge joins. | Medium5 | Union-findHash map+2 | No attempts yet | 3s | 128 MB | Judgeable |
| BuzzwordsFor each line, strip spaces and report the highest occurrence count among substrings of length 1, 2, 3, and so on, stopping at the first length where no substring repeats. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Open SourceCount distinct students per project, drop any student who signed up for more than one project, then sort projects by count descending and name. | Medium5 | Hash mapSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| A Multiple Made Only of OnesGiven n not divisible by 2 or 5, find the number of digits of the smallest repunit (all ones) that n divides. | Medium5 | Number theoryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Games R UsGroup users into equivalence classes by identical directory access sets, then report classes of size 2 or more. | Medium5 | Hash mapSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Index GenerationParse markers in a multi-page document, collect page references for primary and secondary index entries, and print the index sorted case-insensitively. | Medium5 | StringSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Another Puzzling ProblemEach jigsaw piece carries four integer edge labels; match opposite labels to place every piece in the N by N grid, then print the assembled picture. | Medium5 | ImplementationBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Abstract ExtractFor each article, pick the topic sentence of every paragraph with three or more sentences and print them in order. | Medium5 | StringSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Auctions R UsSimulate one day of auctions: process auctions by end time, deduct each winning bid from the bidder's balance, and report winners or unmet reserves. | Medium5 | SimulationSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SquaresCount the number of squares whose four corners all come from a given set of integer-coordinate points, allowing tilted squares. | Medium5 | GeometryHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Sum of Squared DigitsFor two starting numbers, follow the sum-of-squared-digits map and report the smallest total length until a value appears in both sequences, or 0 if they never meet. | Medium5 | Hash mapSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Organize Your Train part IICount distinct strings obtainable by splitting an input string at any point, optionally reversing each part, and concatenating the two parts in either order. | Medium5 | StringBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Polygonal Line Shape SearchGiven a template orthogonal polygonal line, report which of up to 50 other lines match its shape under rotation and translation. | Medium5 | GeometryImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Royal SuccessionGiven parent pairs for N people, compute each claimant's inherited fraction of the founder's blood and print the claimant with the largest fraction. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Manito ChainsGiven a permutation of N people, count the number of cycles in its functional graph. The input ends when N is 0. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ClueGiven the cards you were dealt and the responses to your own Clue queries, determine which locations, weapons, and suspects could still be the hidden cards. | Medium5 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| And the Winner IsEach ballot has one character per candidate; discard any ballot that marks more than one candidate in the same race, then report the top vote-getter (ties included) in every race, in input order. | Medium5 | ImplementationArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TransferGiven hypertubes each connecting K stations totally, find the fewest stations visited traveling from station 1 to station N. | Medium5 | BFSGraph+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Life ConnectionsGiven an undirected friendship graph, count the distinct shortest paths between each queried pair of nodes, where path length counts nodes. | Medium5 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hauling OreFor each queried mine in an undirected graph, print all mines at shortest distance exactly 2, in alphabetical order. | Medium5 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Jumbled LettersFor each query, find the longest dictionary word that can be formed using the query letters at most once, breaking ties alphabetically, or report IMPOSSIBLE. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Gene ShuffleTwo permutations of 1..N are given; split [1,N] into the shortest pieces where each piece holds the same set of genes in both. - use plain English | Medium5 | Prefix sumHash map | No attempts yet | 1s | 128 MB | Judgeable |
| Good NumbersCount the elements A_i that equal the sum of three elements appearing earlier in the sequence, where the same earlier element may be reused. | Medium5 | Hash mapBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pole PositionGiven the current race order of N cars with each car's position change from the start, reconstruct the starting grid or report that no valid grid exists. | Medium5 | ArraySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SupermarketGiven a shopping list and products in path order, buy the list items in order from later positions at minimum total cost, or report impossible. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Awkward DigitsGiven a binary string and a ternary string that each differ from the true base-2 and base-3 forms of N in exactly one digit, find N. | Medium5 | Brute forceMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bovine Bridge BattleCount sets of four points that are symmetric about some center, where each point pairs with its 180-degree rotation partner. | Medium5 | Hash mapGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Word MorphGiven a dictionary of equal-length words, find the fewest one-letter changes needed to turn the start word into the end word through valid words. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Patting HeadsEach of N cows has a value; for every cow count how many other cows hold a value that divides hers. | Medium5 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bessie's Secret PastureCount the ordered quadruples (a,b,c,d) of non-negative integers whose squares sum to N, for N up to 10000. | Medium5 | Hash mapMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tallest CowGiven the tallest cow's height and index plus pairs where cow a sees cow b, find each cow's maximum possible height consistent with all observations. | Medium5 | GreedyPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Crazy SearchCount how many distinct length-N substrings appear in a given text, where the text uses characters from an alphabet of size NC. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Erdös NumbersPapers list authors under titles, and each query asks the shortest co-authorship distance from Erdos; unreachable authors get infinity. | Medium5 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Call ForwardingGiven timestamped call forwarding rules, follow each call through the active chain, printing the final extension or 9999 if a loop is entered. | Medium5 | SimulationHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Broken KeyboardFor each test case, find the length of the longest substring of the sentence that contains at most m distinct characters. | Medium5 | Sliding windowString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Automatic Typo CorrectionGiven a dictionary, classify each queried word as correct, a misspelling of the first similar dictionary word, or unknown, using three specific edit types. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Anagram GroupsGroup distinct words that are anagrams of each other, then print the five largest groups sorted by size and smallest word. | Medium5 | Hash mapSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Team QueueSimulate a team queue where each new element cuts in behind its own teammates, if any, and otherwise joins the tail; print every dequeued element. | Medium5 | QueueHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Collatz ConjectureFor each pair A and B, generate both Collatz sequences up to 1 and find the first value they share, reporting its index in each sequence. | Medium5 | SimulationHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| God Save the i-th QueenGiven a board and placed queens, count empty squares not sharing a row, column, or diagonal with any queen. | Medium5 | ArrayHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Building a New DepotGiven the corner posts of an axis-aligned rectilinear polygon (listed in no particular order), reconstruct the polygon and compute its total perimeter. | Medium5 | GeometrySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| StorehouseGiven a sequence of truck cargo requests and B bays, decide which bay holds which cargo type to minimize the number of loads, assuming optimal offline knowledge. | Medium5 | GreedyHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |