Orivel Orivel
Open menu

Latest Tasks & Discussions

Browse the latest benchmark content across tasks and discussions. Switch by genre to focus on what you want to compare.

Benchmark Genres

Model Directory

Coding

Google Gemini 2.5 Pro VS OpenAI GPT-5.2

Implement a Concurrent Rate Limiter with Sliding Window and Priority Queues

Design and implement a thread-safe rate limiter in Python that supports the following features: 1. **Sliding Window Rate Limiting**: Rather than using fixed time windows, implement a true sliding window algorithm. Each client (identified by a string key) is allowed at most `max_requests` requests within any rolling window of `window_seconds` seconds. 2. **Priority Levels**: Each request has a priority level (integer 1-5, where 1 is highest priority). When the rate limit is reached for a client, lower-priority requests (higher number) should be rejected first. Specifically, if a new request with priority P arrives and the window is full, the limiter should check whether any request in the current window has a strictly lower priority (higher number) than P. If so, the lowest-priority (highest-numbered) request's slot is "revoked" and the new higher-priority request is admitted. The revoked request should be recorded so it can be reported. If no lower-priority request exists to revoke, the new request is rejected. 3. **Burst Allowance**: Each client may optionally have a burst allowance `burst` (defaulting to 0). This allows up to `burst` additional requests beyond `max_requests` in a window, but only if at least half the window duration has passed since the client's first request in the current window. 4. **Thread Safety**: The rate limiter must be safe to use from multiple threads concurrently. Demonstrate this with a test scenario. 5. **Statistics**: The limiter must track per-client statistics: total requests admitted, total rejected, total revoked (bumped by higher-priority requests), and current window utilization (as a float 0.0 to 1.0). Implement the following interface: ```python class RateLimiter: def __init__(self, max_requests: int, window_seconds: float, default_burst: int = 0): ... def set_client_burst(self, client_id: str, burst: int) -> None: """Override burst allowance for a specific client.""" ... def allow(self, client_id: str, priority: int = 3, timestamp: float = None) -> bool: """ Check if a request is allowed. If timestamp is None, use current time. Returns True if the request is admitted, False if rejected. """ ... def get_stats(self, client_id: str) -> dict: """ Return a dict with keys: 'admitted', 'rejected', 'revoked', 'utilization' """ ... def get_revoked_log(self, client_id: str) -> list: """ Return a list of (timestamp, priority) tuples for revoked requests for the given client, in chronological order. """ ... ``` Provide a complete, runnable implementation along with a demonstration script that: - Creates a limiter with max_requests=5, window_seconds=10.0, default_burst=2 - Simulates a sequence of requests from two clients with varying priorities and timestamps that exercises all features (sliding window expiry, priority revocation, burst activation, and rejection) - Prints the stats and revoked logs for each client at the end - Includes a brief multithreaded test with at least 4 threads making concurrent requests Make sure to handle edge cases such as: - Priority value validation (must be 1-5) - Requests arriving exactly at window boundaries - Multiple revocations in sequence - Burst allowance activating precisely at the half-window mark - Empty or unknown client IDs in stats queries

46
Mar 19, 2026 14:46

Education Q&A

OpenAI GPT-5 mini VS Google Gemini 2.5 Flash-Lite

Explain the Paradox of the Ship of Theseus in Philosophy of Identity

The Ship of Theseus is one of the oldest thought experiments in Western philosophy. Suppose a wooden ship is maintained by gradually replacing each plank of wood as it decays. After every single original plank has been replaced, is the resulting ship still the Ship of Theseus? Now suppose someone collects all the discarded original planks and reassembles them into a ship. Which ship, if either, is the "real" Ship of Theseus? In a structured essay, address all of the following: 1. State the core paradox precisely and explain why it poses a genuine philosophical problem for theories of identity. 2. Present and critically evaluate at least three distinct philosophical positions that attempt to resolve the paradox (e.g., mereological essentialism, spatiotemporal continuity theory, four-dimensionalism/perdurantism, nominal essentialism, etc.). For each position, explain its resolution and identify at least one serious objection. 3. Explain how this paradox connects to at least two real-world domains (e.g., personal identity over time, legal identity of corporations, biological cell replacement, digital file copying, restoration of historical artifacts). For each domain, show specifically how the paradox manifests and what practical consequences follow. 4. Take and defend your own reasoned position on which resolution is most philosophically satisfying, acknowledging its limitations.

54
Mar 19, 2026 14:34

Coding

Google Gemini 2.5 Flash-Lite VS OpenAI GPT-5.2

Implement a Lock-Free Concurrent LRU Cache

Design and implement a thread-safe LRU (Least Recently Used) cache in Python that supports concurrent reads and writes without using a global lock for every operation. Your implementation must satisfy the following requirements: 1. The cache has a fixed maximum capacity specified at construction time. 2. It supports three operations: - get(key): Returns the value associated with the key, or None if the key is not present. Accessing a key should mark it as most recently used. - put(key, value): Inserts or updates the key-value pair. If the cache is at capacity and a new key is inserted, the least recently used entry must be evicted. - delete(key): Removes the key from the cache if present. Returns True if the key was found and removed, False otherwise. 3. The cache must be safe to use from multiple threads simultaneously. Concurrent get operations on different keys should not block each other. You should minimize contention — a single coarse-grained lock around everything is not acceptable. 4. The eviction policy must be strictly LRU: the entry that was accessed (via get or put) least recently must be the one evicted. 5. Handle edge cases: capacity of 1, rapid concurrent puts that trigger evictions, interleaved get/put/delete on the same key from different threads, and zero or negative capacity (raise ValueError). Provide your complete implementation as a single Python module. Include a brief explanation of your concurrency strategy and why it preserves correctness. Also include a short demonstration (in a main block or test function) that spawns multiple threads performing mixed get/put/delete operations and asserts that the cache never exceeds its capacity and that no data corruption occurs.

60
Mar 19, 2026 11:51

System Design

Anthropic Claude Opus 4.6 VS Google Gemini 2.5 Pro

Design a Global URL Shortening Service

Design a public URL shortening service similar to Bitly. The service must let users create short links for long URLs, optionally specify a custom alias if available, and redirect users who visit the short link to the original destination. Include a basic analytics feature that reports total clicks per link and clicks by day for the last 30 days. Assume the following constraints: - 120 million new short links are created per month. - 1.2 billion redirect requests are served per month. - Read traffic is highly bursty, especially for viral links. - The service is used globally and users expect low-latency redirects. - Short links should remain valid for at least 5 years. - Redirect availability target is 99.99 percent. - Analytics may be eventually consistent by up to 10 minutes. - The system should prevent obvious abuse at a basic level, but a full trust and safety platform is out of scope. In your design, cover: - High-level architecture and main components. - Data model and storage choices for link mappings and analytics. - ID or token generation strategy, including custom alias handling. - API design for creating links, redirecting, and fetching analytics. - Caching, partitioning, and replication strategy. - Reliability approach, including failure handling and multi-region considerations. - How you would scale for read-heavy traffic and viral hotspots. - Key trade-offs in consistency, cost, latency, and operational complexity. State any reasonable assumptions you make and justify your choices.

67
Mar 19, 2026 08:02

Summarization

OpenAI GPT-5.2 VS Anthropic Claude Haiku 4.5

Summarize an Article on the James Webb Space Telescope

Your task is to summarize the following article about the James Webb Space Telescope (JWST). The summary should be written for a general audience with little to no background in astronomy or engineering. Your summary must be 3-4 paragraphs long and should concisely cover the following key points: 1. The primary mission and scientific goals of the JWST. 2. The key technological innovations, specifically the segmented mirror and the sunshield. 3. The telescope's unique orbital location (L2) and why it's important. 4. The international collaboration behind the project. --- SOURCE ARTICLE --- The James Webb Space Telescope (JWST) is a space telescope designed to conduct infrared astronomy. As the largest optical telescope in space, its greatly improved infrared resolution and sensitivity allow it to view objects too old, distant, or faint for the Hubble Space Telescope. This is expected to enable a broad range of investigations across the fields of astronomy and cosmology, such as observation of the first stars and the formation of the first galaxies, and detailed atmospheric characterization of potentially habitable exoplanets. JWST is the formal successor to the Hubble Space Telescope, representing a monumental leap forward in our capability to observe the cosmos. Its primary mission is to peer back in time to the very dawn of the universe, capturing light from the stars and galaxies that formed just a few hundred million years after the Big Bang. The scientific mission of the JWST is guided by four primary themes. The first is 'First Light and Reionization,' which involves searching for the very first luminous objects that formed after the Big Bang. By observing in the infrared, Webb can penetrate the cosmic dust and gas to see these nascent galaxies. The second theme is the 'Assembly of Galaxies,' where the telescope will study how galaxies have evolved over billions of years, from their chaotic early forms to the grand spiral and elliptical galaxies we see today. The third theme, the 'Birth of Stars and Protoplanetary Systems,' focuses on observing the formation of stars and planets. Webb's infrared instruments can see through the dense clouds of gas and dust where stars are born, providing unprecedented views of these stellar nurseries and the planet-forming disks around young stars. Finally, the fourth theme is 'Planets and Origins of Life,' which includes studying the atmospheres of exoplanets to search for the building blocks of life, such as water and methane, and gaining a deeper understanding of the objects within our own Solar System. At the heart of the JWST is its revolutionary technology, most notably its primary mirror. The mirror is 6.5 meters (21 feet) in diameter, a significant increase over Hubble's 2.4-meter mirror, giving it about 6.25 times the light-collecting area. Such a large mirror could not be launched in a single piece, so it is composed of 18 hexagonal segments made of beryllium, a material chosen for its lightness, strength, and ability to hold its shape at cryogenic temperatures. Each segment is coated with a microscopically thin layer of gold, which is exceptionally reflective of infrared light, optimizing the telescope's ability to capture faint signals from the early universe. These segments were folded up like origami to fit within the Ariane 5 rocket fairing and had to be precisely unfolded and aligned in space, a process of unprecedented complexity. To analyze the light collected by its massive mirror, the JWST is equipped with a suite of four state-of-the-art scientific instruments. The Near-Infrared Camera (NIRCam) is the primary imager, designed to detect light from the earliest stars and galaxies. The Near-Infrared Spectrograph (NIRSpec) can observe up to 100 objects simultaneously, dispersing their light into spectra to determine their physical properties, such as temperature, mass, and chemical composition. The Mid-Infrared Instrument (MIRI) contains both a camera and a spectrograph that see light in the mid-infrared region of the electromagnetic spectrum, allowing it to see newly forming stars, faint comets, and objects in the Kuiper Belt. Lastly, the Fine Guidance Sensor and Near-Infrared Imager and Slitless Spectrograph (FGS/NIRISS) allows the telescope to point precisely, and is also capable of investigating exoplanet detection and characterization. Together, these instruments provide a versatile toolkit for astronomers to explore the universe across a wide range of infrared wavelengths. Unlike Hubble, which orbits the Earth, the JWST operates in a much more distant and stable environment. It orbits the Sun at the second Lagrange point (L2), located about 1.5 million kilometers (1 million miles) from Earth. At L2, the gravitational pull of the Sun and the Earth balance the centrifugal force of the telescope's orbit, allowing it to "hover" in a stable position relative to our planet. This location is critical for the telescope's mission. Being far from the Earth keeps it away from the heat and infrared radiation emitted by our planet, which would otherwise interfere with its sensitive observations. This stable, cold environment is essential for maintaining the telescope's instruments at the extremely low temperatures required for infrared astronomy. To achieve and maintain these frigid operating temperatures (below 50 Kelvin, or -223°C), the JWST relies on a massive, five-layer sunshield. About the size of a tennis court, the sunshield is made of a lightweight, durable material called Kapton, coated with aluminum and doped silicon. Its purpose is to block heat and light from the Sun, Earth, and Moon. The five layers are separated by a vacuum, which acts as an excellent insulator. Each successive layer is cooler than the one below it. This design creates a massive temperature differential, with the sun-facing side reaching up to 85°C (185°F) while the side housing the mirrors and instruments remains at its cryogenic operating temperature. This passive cooling system is one of the most critical and complex components of the observatory, as even a small amount of heat could blind its sensitive infrared detectors. The James Webb Space Telescope is not the product of a single nation but a testament to international collaboration. It is a joint project led by NASA in partnership with the European Space Agency (ESA) and the Canadian Space Agency (CSA). This global partnership brought together the best minds, resources, and technologies from around the world to create this next-generation observatory. The journey from conception to launch spanned decades, involving thousands of scientists, engineers, and technicians. After its successful launch on December 25, 2021, the telescope underwent a months-long commissioning period of deploying its components, aligning its mirrors, and calibrating its instruments. Now fully operational, the JWST is delivering breathtaking images and invaluable data, opening a new window on the universe and promising to reshape our understanding of the cosmos for decades to come.

66
Mar 19, 2026 07:51

System Design

Anthropic Claude Haiku 4.5 VS Google Gemini 2.5 Flash-Lite

Design a Real-Time Ride Matching Platform

Design the backend architecture for a ride-hailing platform that matches riders with nearby drivers in real time across multiple cities. Your design should support these product requirements: - Riders can request a trip by sending pickup and destination locations. - Nearby available drivers should receive the request quickly, and one driver can accept it. - The system must prevent double-booking of drivers. - Riders and drivers should see live trip status updates such as requested, accepted, arrived, in progress, and completed. - The platform should provide an estimated fare and estimated pickup time before confirmation. - Trip history should be available to both riders and drivers. Constraints and assumptions: - 8 million daily ride requests. - Peak load is 25 times the average request rate during commuting windows. - Operates in 40 cities, with uneven traffic distribution. - Location updates from active drivers arrive every 3 seconds. - Acceptable rider-facing latency for initial driver matching is under 2 seconds at p95. - Trip status updates should usually appear within 1 second. - The system should remain available during a regional service outage affecting one data center. - Exact payment processing details are out of scope, but trip records must be durable for later billing. - Privacy, security, and regulatory concerns may be mentioned briefly, but the main focus is architecture and scaling. In your answer, describe: - The main services or components and their responsibilities. - The data flow from ride request to driver assignment to trip completion. - How you would store and query driver locations efficiently. - How you would handle scaling for peak traffic and hotspot cities. - How you would ensure reliability, fault tolerance, and data consistency where it matters. - Key trade-offs in your design, including any places where you prefer eventual consistency over strong consistency, or vice versa. You do not need to provide exact cloud vendor products. A clear architecture and reasoning-focused design is preferred over exhaustive implementation detail.

61
Mar 19, 2026 07:43

System Design

Google Gemini 2.5 Pro VS Anthropic Claude Sonnet 4.6

Design a Global URL Shortening Service

Design a public URL shortening service similar to Bitly. Users can submit a long URL and receive a short alias, then anyone can use the short link to be redirected to the original URL. Your design should support these requirements and constraints: Functional requirements: - Create short links for arbitrary valid URLs. - Redirect short links with low latency. - Support optional custom aliases when available. - Provide basic click analytics per link: total clicks, clicks in the last 24 hours, and top 5 countries by click count. - Allow link expiration dates. Scale assumptions: - 120 million new short links per day. - 8 billion redirect requests per day. - Read-heavy workload with strong traffic skew: a small fraction of links receive very high traffic. - Global users across North America, Europe, and Asia. Constraints: - 99.99% availability target for redirects. - P95 redirect latency under 80 ms for users in major regions. - Newly created links should become usable within 2 seconds globally. - Analytics can be eventually consistent, but redirects must be correct. - Budget matters: justify where you would spend on stronger consistency or multi-region replication and where you would avoid it. - Assume no third-party managed analytics product; design the core system yourself. Please provide: - A high-level architecture with major components and data flow. - Storage choices for link mappings, analytics events, and cached hot links. - ID generation or alias strategy, including collision handling and custom alias checks. - API design for create-link, redirect, and analytics retrieval. - Scaling approach for hot keys, caching, partitioning, and multi-region traffic. - Reliability strategy covering failover, data replication, backup, and degradation behavior. - Key trade-offs and at least two alternative design choices you considered and rejected.

54
Mar 19, 2026 04:33

Summarization

Anthropic Claude Opus 4.6 VS Google Gemini 2.5 Flash

Summarize a City Council Hearing on Flood Resilience

Read the source passage below and write a concise summary for a busy mayor who did not attend the hearing. Your summary must: - be 220 to 280 words long - be written in clear prose, not bullet points - accurately capture the main problem, the major proposals, the biggest disagreements, and the most important evidence or examples mentioned - include the timeline pressures and funding constraints - mention at least four distinct stakeholder perspectives - remain neutral in tone and avoid adding facts not stated in the passage - not use direct quotations Source passage: The Riverton City Council held a three-hour public hearing on Tuesday night to decide whether to move forward with the first phase of a flood-resilience program for the Harbor District, a low-lying waterfront area that has seen repeated street flooding during heavy rain and seasonal high tides. City engineers opened the meeting with maps showing that nuisance flooding days have increased from about four per year a decade ago to thirteen last year, and they warned that a storm comparable to the one that hit neighboring Bay County in 2021 would likely shut down the district’s main bus corridor, damage electrical equipment in several apartment basements, and temporarily isolate the public health clinic. They said the district’s vulnerability comes from a combination of aging storm drains, land subsidence measured at roughly three millimeters per year, and a seawall built in the 1970s that was never designed for current peak water levels. The Public Works Department presented a draft first-phase plan with three linked components. The largest item, estimated at 24 million dollars, would replace undersized stormwater pipes along Mercer Avenue and install two pump stations near the canal. A second item, costing about 11 million dollars, would raise three intersections by up to eighteen inches and rebuild sidewalks with permeable paving intended to reduce runoff. The third component, projected at 8 million dollars, would launch a home-elevation and flood-proofing grant program for small residential buildings and ground-floor businesses, with priority for properties that have filed repeated flood claims. Public Works Director Elena Torres argued that the package was designed to reduce frequent flooding quickly while keeping options open for larger long-term choices such as a new tide gate or partial seawall reconstruction. She stressed that the city had a limited window to apply for a state resilience grant due in eleven weeks, and that delaying a council vote until autumn would almost certainly push construction start dates back by a full year. Torres also emphasized that the city could not afford to do everything at once. Riverton has identified only 18 million dollars in local capital funds over the next two budget cycles for the Harbor District, meaning any first phase would depend on outside money. If the state grant were approved, it could cover up to 60 percent of eligible infrastructure costs, but not all building-level retrofits. The finance office cautioned that debt service is already rising because of a new fire station and school roof repairs, and it advised against borrowing more than 12 million dollars without cutting other planned projects. Several council members noted that residents have grown skeptical after earlier promises to fix flooding produced only minor drain cleaning and temporary barriers. Business owners from the Harbor Merchants Association backed fast action but pressed for street work to be staged block by block. Their president, Malik Chen, said even short full-road closures on Mercer Avenue could cripple restaurants and small shops that rely on weekend foot traffic, especially after two difficult years of inflation and insurance premium increases. He supported the pump stations and pipe replacement as the most visible and urgent investments, but he opposed raising intersections before the city completed a parking access study. According to Chen, delivery trucks already struggle to reach loading zones, and poorly sequenced construction could create a second economic shock in a district still trying to recover. Residents from the Bayside Homes tenants’ council offered a different emphasis. They said street flooding matters, but repeated basement flooding, mold, and power shutoffs inside older apartment buildings create the most serious day-to-day harms. Council speaker Rosa Alvarez described families carrying children through standing water to reach school buses and elderly tenants losing medications when refrigerators fail during outages. She urged the city not to treat household grants as an optional add-on that could be dropped if state aid fell short. Several tenant advocates asked for anti-displacement protections, warning that landlords might use publicly funded upgrades as a reason to raise rents or decline lease renewals. Environmental groups supported green infrastructure but criticized the draft for giving it a secondary role. The nonprofit Clean Estuary Now argued that pumps and larger pipes may move water faster in the short term but could worsen downstream pollution unless paired with wetlands restoration and stricter runoff controls uphill from the district. Its director, Naomi Reed, pointed to two nearby cities where bioswales, rain gardens, and restored marsh edges reduced flood depth while also improving water quality and urban habitat. Reed said Riverton should reserve land now for living-shoreline projects before waterfront parcels become more expensive or are redeveloped. The Harbor District Community Clinic focused on continuity of care. Clinic administrator Dev Patel testified that the building itself has avoided major flood damage so far, but staff and patients often cannot reach it when the bus corridor floods or when ankle-deep water covers the nearest crosswalks. He said missed dialysis follow-ups, delayed prenatal visits, and interruptions to mental health appointments have become more common on heavy-rain days. Patel supported intersection raising and sidewalk reconstruction because, in his view, access failures produce public-health costs that are easy to overlook when discussion centers on property damage alone. A representative of the school district added another layer to the debate. Harbor Middle School sits just outside the worst flood zone, but its buses cross Mercer Avenue and nearby low spots. Deputy superintendent Lila Morgan said transportation delays have doubled on the wettest days, and after-school programs have seen irregular attendance because parents worry that children will get stranded. She favored quick infrastructure upgrades but asked the city to coordinate construction schedules with the school calendar and to maintain safe pedestrian detours. Morgan also noted that the school gym is designated as a neighborhood emergency shelter, so prolonged access problems could weaken the area’s disaster response capacity. Some of the sharpest disagreement came from residents of the adjacent Bluff Park neighborhood, which sits on slightly higher ground. Their association did not dispute that Harbor District flooding is real, but members said the proposed pumps could redirect water toward streets that currently drain adequately. Civil engineer Priya Natarajan, speaking as a Bluff Park resident, said the city’s modeling slides shown at the hearing were too simplified for a project with cross-neighborhood impacts. She asked for an independent hydrology review before any pump contract was approved, and several speakers requested a guarantee that Bluff Park would receive mitigation funds if conditions worsened there. Council members themselves appeared split less on whether action was needed than on how much uncertainty was acceptable. Councilor James Holloway called the current moment a test of whether Riverton can shift from reactive emergency spending to planned adaptation. He argued that waiting for a perfect long-term master plan would leave the city stuck in a cycle of repetitive losses. By contrast, Councilor Denise Park said she feared repeating past mistakes in which rushed capital projects solved one bottleneck while creating another. She proposed separating the grant application from final authorization to build, but the city attorney warned that the state program favors projects with firm local approval and detailed matching commitments. By the end of the hearing, a possible compromise began to emerge. Several members signaled openness to submitting the state grant application for the pipe replacement, pumps, and intersection work while directing staff to strengthen the residential grant program with tenant protections and to commission a third-party review of neighborhood drainage impacts before construction contracts are signed. Another idea under discussion was to phase the street-elevation work so that the block closest to the clinic and bus corridor would be prioritized first, with later blocks contingent on traffic and business-access monitoring. No vote was taken Tuesday night. The council scheduled a work session for next week and said a formal decision would likely come before the grant deadline, though members acknowledged that unresolved questions about equity, sequencing, and downstream effects could still change the package.

52
Mar 19, 2026 04:11

Showing 81 to 100 of 333 results

Related Links

X f L