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 results905 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Morton NumbersRead integers x and y and print their Morton number, built by interleaving the bits of x and y. | Easy1 | Bit manipulation | No attempts yet | 2s | 512 MB | Judgeable |
| Gray codeConvert an n-bit binary string to its standard Gray code by copying the first bit and adding each adjacent pair of bits without carry. | Easy1 | Bit manipulationString | No attempts yet | 1s | 128 MB | Judgeable |
| Binary ConversionPrint the binary representation of the given natural number N with no leading zeros. | Easy1 | Bit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| Power of TwoPrint 1 if the given natural number N is a power of two and 0 otherwise. | Easy1 | Bit manipulation | No attempts yet | 2s | 512 MB | Judgeable |
| George BooleRead one boolean operation in the form true AND false and print its result. | Easy1 | ImplementationString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Java2016Given a target constant c, print 20 fixed macro definitions and then build one expression by appending a macro for each set bit of c. | Easy1 | ImplementationSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Binary NumberFor each given integer, output the positions of all bits set to 1 in its binary representation, from least to most significant. | Easy2 | Bit manipulationImplementation | No attempts yet | 1s | 128 MB | Judgeable |
| ElectrificationGiven switch-to-lamp toggle mappings and a sequence of switch flips, compute and print the final on/off state of each lamp using parity counting. | Easy2 | SimulationBit manipulation | No attempts yet | 2s | 256 MB | Judgeable |
| Explicit FormulaGiven 10 binary inputs, evaluate a fixed XOR-of-ORs boolean formula (equivalently just count pairs/triplets with at least one 1 and check parity) and output the result. | Easy2 | Bit manipulationImplementation+1 | No attempts yet | 3s | 256 MB | Judgeable |
| ParityRead bit strings whose last bit is missing plus a parity letter, and append the 0 or 1 that makes the parity match. | Easy2 | StringBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Error DetectionFor each 16-bit value and its transmitted check bit, decide whether the check bit matches the parity of 1-bits in the value. | Easy2 | Bit manipulationImplementation | No attempts yet | 1s | 128 MB | Judgeable |
| Which WayFor each positive integer, convert it to binary and print left, straight, or right depending on whether it has more 0s, equal 0s and 1s, or more 1s. | Easy2 | Bit manipulationImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Integer FlippingReverse the order of the 32 bits of each given unsigned integer and print the resulting value, stopping at -1. | Easy2 | Bit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Reverse the Binary DigitsRead N, write it in binary without leading zeros, reverse the digits, and print the reversed string as a decimal number. | Easy2 | Bit manipulationMath | No attempts yet | 1s | 256 MB | Judgeable |
| DistributionYou split the integers from 0 to 2^N - 1 into 2^K boxes of equal size with equal total popcount by pairing each x with its bitwise complement. | Easy2 | Bit manipulationMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Identifying Map TilesConvert a map tile quadkey into its zoom level and x and y coordinates. | Easy2 | Bit manipulationString | No attempts yet | 1s | 256 MB | Judgeable |
| #include <Google I/O.h>Decode each block of eight I and O letters as one ASCII byte and print the message for every test case. | Easy2 | ImplementationString+1 | No attempts yet | 5s | 512 MB | Judgeable |
| New Lottery Game (Small)Count pairs (a, b) with a below A and b below B whose bitwise AND is below K. | Easy2 | Brute forceBit manipulation | No attempts yet | 5s | 512 MB | Judgeable |
| Odd Man OutGiven an odd-length list of invitation codes where every value appears twice except one, find the value that appears once. | Easy2 | Bit manipulationArray+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Bitwise Operations on Binary NumbersGiven two equal-length binary strings, output their bitwise AND, OR, XOR, and the complemented forms of each, keeping length and leading zeros. | Easy2 | StringBit manipulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| XORXORXORXOR the value B into A exactly C times and print the result. | Easy2 | Bit manipulationMath | No attempts yet | 0.2s | 512 MB | Judgeable |
| XORChicGiven an XOR-encrypted string whose first 8 characters decode to "CHICKENS", recover the key and output the original string. | Easy2 | ImplementationBit manipulation+2 | No attempts yet | 1s | 256 MB | Judgeable |
| ZGiven N and coordinates (r,c) in a 2^N x 2^N grid, compute the visit order index of that cell under recursive Z-order (Morton order) traversal. | Easy3 | Divide and conquerRecursion+1 | No attempts yet | 0.5s | 512 MB | Judgeable |
| Binary to Octal ConversionConvert a binary number with up to 1,000,000 digits into its octal representation. | Easy3 | Bit manipulationMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Guitar ConcertGiven up to 10 guitars each covering a subset of up to 50 songs, find the minimum number of guitars needed to play the maximum possible number of songs. | Easy3 | Bit manipulationBrute force+1 | No attempts yet | 2s | 128 MB | Judgeable |
| IP Network AddressGiven a list of IPv4 addresses, compute the smallest common network address and its mask that covers them all using bitwise operations. | Easy3 | Bit manipulationImplementation | No attempts yet | 2s | 128 MB | Judgeable |
| Binary ClockConvert a given HH:MM:SS time into two 18-bit binary clock representations, read column-major-mixed 3-column and row-major 3-row layouts. | Easy3 | Bit manipulationImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Chocolate LunchGiven K, find the smallest power-of-two chocolate bar size and the minimum number of halving splits needed to obtain exactly K unit pieces. | Easy3 | Bit manipulationMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Binary EncodingGiven m, output the truncated binary code for each integer from 0 to m-1 following the standard truncated binary encoding rules. | Easy3 | Bit manipulationImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Subset SumGiven up to 20 bag sizes and a target n, pick each bag at most once to reach at least n with the smallest possible total. | Easy3 | Brute forceBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| The Elf's SwordFor each input n, find the smallest k such that the digits 0 through 9 all appear across the multiples n, 2n, ..., kn. | Easy3 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SteganographyDecode hidden bits from odd/even runs of spaces in a text and decode five-bit groups into characters. | Easy3 | StringBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Really Good CompressionGiven N distinct 1000-bit files, decide whether each can be compressed to at most b bits. | Easy3 | MathCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Coded CommunicationGiven n binary strings of length b and a received string r, find the minimum Hamming distance from r to any of the n strings. | Easy3 | StringBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FingerprintsFor each of K query 5x5 bitmaps, find the database bitmap with the smallest Hamming distance and print all tied indices in increasing order. | Easy3 | ArrayBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Parity BitSplit each line into 8-bit blocks, check whether the parity bit matches the parity of the first 7 bits, and count the mismatches. | Easy3 | ImplementationString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Elias Omega CodingFor each positive integer until a terminating 0, output its Elias omega code, built by recursively prepending the code of the bit length. | Easy3 | Bit manipulationRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| 17 TimesGiven a binary number N of up to 1000 digits, print N times 17 in binary. | Easy3 | StringMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Rock GamePrint the reflected binary Gray code cycle for N bits as 2^N + 1 lines, each line showing X for covered holes and O for uncovered ones. | Easy3 | Bit manipulationMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| S-TreesGiven an S-tree's variable ordering and terminal labels, evaluate the Boolean function for each supplied variable assignment. | Easy3 | TreeSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Polynomial Remainder OperationMultiply two binary polynomials over GF(2) and print the remainder modulo a third polynomial, all given as bit strings. | Easy3 | MathBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Subdivision of KingdomSplit n towns (n even, n <= 26) into two halves of equal size so that the number of roads crossing between the halves is minimized. | Easy3 | Brute forceBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Can You Exponentiate?Given a and b up to 1e9, print the last decimal digit of a^b. | Easy3 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Coin GameThe program flips full rows, columns, or diagonals of a 3 by 3 coin grid to make all coins match in the fewest moves, or reports -1. | Easy3 | Brute forceBit manipulation | No attempts yet | 1s | 128 MB | Judgeable |
| Gold RushSplit a bar of weight 2 to the n into halves with the fewest cuts so two shares of weights a and b can be formed. | Easy3 | Bit manipulationMath | No attempts yet | 1s | 256 MB | Judgeable |
| Spokes WheelFind the fewest left or right rotations that turn the first 32-spoke binary pattern into the second, or report that it is impossible. | Easy3 | Bit manipulationBrute force | No attempts yet | 1s | 256 MB | Judgeable |
| Yet Satisfiability AgainDecide whether a CNF formula over at most 20 variables and 100 clauses has an assignment that satisfies every clause. | Easy3 | Brute forceBit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| XOR RangeCompute the XOR of all integers from S to F for each of up to 1000 test cases. | Easy3 | Bit manipulationMath | No attempts yet | 1s | 256 MB | Judgeable |
| BASE64 EncodingEncode the given alphanumeric string into BASE64 by regrouping its bytes into 6-bit values with '=' padding. | Easy3 | Bit manipulationString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| BASE64 DecodingDecode a Base64 string using the standard alphabet and padding back into the original alphanumeric text. | Easy3 | ImplementationString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Base32 EncodingConvert the input string to bytes and print its Base32 encoding with the standard alphabet and padding. | Easy3 | Bit manipulationImplementation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| BASE32 DecodingPrint the original string S from its given Base32 encoding with padding. | Easy3 | Bit manipulationString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Numbers on a TreeGiven the height H and an L/R path from the root, compute the label of the reached node under bottom-up right-to-left numbering. | Easy3 | MathBit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| 2-SAT SatisfiabilityDecide whether N boolean variables admit an assignment satisfying all M two-literal clauses. | Easy3 | Brute forceBit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| Recruiting TeammatesPick the fewest of up to 10 students whose solvable problem sets cover all N problems, or print -1 when coverage is impossible. | Easy3 | Brute forceBit manipulation | No attempts yet | 2s | 256 MB | Judgeable |
| Jumbled CommunicationRecover each original byte x from the scrambled value x xor (x shifted left by one). | Easy3 | Bit manipulationBrute force | No attempts yet | 5s | 256 MB | Judgeable |
| SetMaintain a set of integers 1 to 20 under add, remove, toggle, check, all, and empty, and print each check result. | Easy3 | Bit manipulationImplementation | No attempts yet | 1.5s | 4 MB | Judgeable |
| Snapper Chain (Small)Decide whether N chained toggle switches all turn on after K snaps, which lights the bulb. | Easy3 | Bit manipulationSimulation | No attempts yet | 5s | 512 MB | Judgeable |
| Lunch is not the problem right nowConvert between an IPv8 address (eight octets) and the 64-bit unsigned integer formed by concatenating their bytes. | Easy3 | Bit manipulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Largest Common Vertex on a Rooted TreeFor two nodes in a complete binary tree numbered heap-style, find the deepest common ancestor k and print 10k. | Easy3 | TreeMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Hot Air BallooningEach trainee's flight record is an integer whose digits are the balloon types flown; count how many distinct sets of digits appear. | Easy3 | Hash mapBit manipulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Binary String OrderingPrint all 2^N binary strings of length N in the order given by the binary reflected Gray code formula i XOR floor(i/2). | Easy3 | Bit manipulationMath+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Building a timetableFor each student, count the courses whose every meeting period lies among that student's free periods. | Easy3 | Bit manipulationBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Calculate!Given A, B and a huge count C, find the value of A after XORing B into it C times. | Easy3 | Bit manipulationMath+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Nemmo Nemmo (Easy)Count subsets of cells of an N by M grid, with N*M at most 25, that contain no full 2 by 2 square of chosen cells. | Easy3 | Brute forceBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Falling ApartGiven up to 15 positive integers, two players alternately take one piece; find the final sums under optimal play. | Easy3 | Dynamic programmingGame theory+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Xayahh-Rakann at Moloco (Easy)Given n jars and inseparable pairs, decide if exactly k jars can be kept so that no inseparable pair is split across the two groups. | Easy3 | Brute forceGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Yet Another No-Solve Prevention Problem!!For each of Q queries, decide whether the given number a is a power of two, printing 1 for yes and 0 for no. | Easy3 | Bit manipulationMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Potato SacksGiven ten potato weights and a capacity C, decide whether some subset of the potatoes sums to exactly C and print YES or NO. | Easy3 | Dynamic programmingBit manipulation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sam-Sam-Han Number 2Decide whether N can be written as a sum of distinct powers of 3, with at least one term, then print YES or NO. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Thue-Morse StringFind the character at position k in the Thue-Morse sequence, where k can be as large as 10^18. | Easy3 | Bit manipulationMath+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Inverting bits (Easy)Write a program in a tiny 26-register 8-bit assembly language that reads 7 bits and outputs their complements, using the not instruction at most once. | Easy3 | Bit manipulationImplementation | No attempts yet | 1s | 512 MB | Judgeable |
| StickSimulate repeatedly halving and discarding pieces of a 64 cm stick until the remaining pieces sum to X, then count how many pieces are glued together. | Medium4 | Bit manipulationSimulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sums of Powers of ThreeGiven N, find the Nth smallest positive integer that is a sum of distinct powers of three, using a base-2 to base-3 digit mapping. | Medium4 | MathBit manipulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| PasswordGiven integer A, find the nearest smaller and nearest larger integers with the same popcount as A, using bit manipulation, or print 0 if none exists. | Medium4 | Bit manipulationMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Decoding EDSAC DataDecode an EDSAC instruction (character opcode, address, word/double-word flag) into the fixed-point two's-complement decimal number its 17-bit binary pattern represents. | Medium4 | Bit manipulationImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| FaxImplement run-length encoding with specific bit-packed run and literal prefix formats, splitting long runs and literal blocks according to size limits. | Medium4 | SimulationString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Planet X3Given up to a million numbers, compute the sum over all pairs of the XOR of their values by counting set bits per bit position. | Medium4 | Bit manipulationMath+1 | No attempts yet | 1s | 192 MB | Judgeable |
| 4 and 7Given K, output the K-th smallest positive integer whose digits are only 4 or 7, using a binary-representation-like construction. | Medium4 | MathBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Access Control ListsParse an ordered ACL of allow/deny IP network rules and, for each query IP, output whether the first matching rule grants or denies access. | Medium4 | Bit manipulationString+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Important WiresParse boolean formulas over up to 11 wires and count distinct output tuples across all wire assignments by brute-force enumeration. | Medium4 | StringBit manipulation+1 | No attempts yet | 3s | 256 MB | Judgeable |
| JohnDetermine the winner of a Nim-like misère game where players remove same-colored candies from piles and taking the last candy loses. | Medium4 | Game theoryBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PseudoprimeFor each pair p and a, decide whether p is composite and satisfies a^p mod p == a, printing yes or no. | Medium4 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DuLLGiven program sizes, DLL sizes, and a sequence of program start and exit events, find the peak memory use including loaded DLLs. | Medium4 | SimulationBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Persistent BitsStarting from a seed S, repeatedly apply (A*X+B) mod C and report, for each of the 16 bit positions, whether it is always 1, always 0, or varies. | Medium4 | Bit manipulationSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Maximize the AccelerationGiven N parts that each add force and mass, choose the subset maximizing total force divided by total mass, breaking ties by smaller mass. | Medium4 | Brute forceBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bookshelf 2Given up to 20 cow heights and a target bookshelf height B, find the minimum amount by which some subset's total height exceeds or equals B. | Medium4 | Brute forceBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Eating PuzzleGiven up to 21 bucket sizes and a calorie limit, choose a subset with the largest sum that does not exceed the limit. | Medium4 | Brute forceBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Microprocessor SimulationSimulate a 4-bit microprocessor from a 256-word hex memory dump and print the final memory state when the stop instruction runs. | Medium4 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Guido van Rossum Built Python Out of Christmas BoredomSimulate a tiny 8-bit von Neumann machine with 32 bytes of memory until it halts, then print the accumulator as 8-bit binary. | Medium4 | SimulationBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Quad TreeParse an XBM hex bitmap, then recursively encode it as a quad tree: uniform squares become B or W, mixed ones become Q followed by four sub-squares. | Medium4 | Divide and conquerRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Decoding TaskGiven an encrypted message and the same message with a space prepended, recover the shared XOR key bytes. | Medium4 | Bit manipulationImplementation | No attempts yet | 2s | 128 MB | Judgeable |
| MegavirusGiven k and n viruses from generation k in a binary tree, find the deepest generation whose node is an ancestor of all given viruses. | Medium4 | TreeBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PoliticiansSplit up to 18 people with rivalry pairs into two groups with no rival trio in either group and maximize the first group. | Medium4 | Brute forceBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| FontCount the subsets of the given words whose letters together cover all 26 lowercase letters. | Medium4 | Brute forceBit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| TicketsPrint the K-th n-bit string in reflective Gray code order for the given n and K. | Medium4 | Bit manipulationRecursion | No attempts yet | 1s | 64 MB | Judgeable |
| ShipuraEvaluate expressions that combine floor division by powers of two with squaring modulo 1,000,000,007 and nested brackets. | Medium4 | StackRecursion+1 | No attempts yet | 8s | 512 MB | Judgeable |
| XOR triplets 2Pick the largest block of consecutive integers from 1 to N with no three distinct elements xoring to zero, breaking ties by smallest start. | Medium4 | Brute forceBit manipulation | No attempts yet | 5s | 256 MB | Judgeable |
| MD5Read a short alphanumeric string and print its MD5 hash as 32 lowercase hex digits. | Medium4 | ImplementationBit manipulation | No attempts yet | 1s | 256 MB | Judgeable |
| SHA-1Given an alphanumeric string of length 1 to 50, print its SHA-1 hash as 40 lowercase hex digits. | Medium4 | ImplementationSimulation+1 | No attempts yet | 1s | 256 MB | Judgeable |