Round #587

09 May 2026, 23:19· csharp· Meta-Llama-3.3-70B-Instruct· r13-clean-hints
Complexity
band 0
ZP / UO / OBS
3 / 0 / 2
Journey weight
250
Lightshift ΔL

Prompt

Calculate the gap in days between consecutive logins per user using LAG.

Zero-point index (what the engine surfaced)

ZPI-ZPI-0021 | 2026-05-09T23:19:46Z Calculate the gap in days between consecutive logins per user using LAG. ZERO POINT — 3 entries (structural invariants) ● hsl(7.18, 100%, 50%) class [feature] ● hsl(0.00, 100%, 50%) public [feature] ● hsl(84.10, 100%, 50%) namespace [feature] UNOBSERVED — 0 entries (implied truths) OBSERVED — 2 entries (explicit in request) ◉ hsl(85.13, 100%, 50%) using [feature] ◉ hsl(234.87, 100%, 50%) using [feature] COMPLEXITY │ 5 entries │ spread: 150° │ band: LOW

Baseline response (no ZPI)

```csharp using System; using System.Data; using System.Linq; public class Program { public static void Main() { // Create a sample dataframe var data = new[] { new { user_id = 1, login_date = DateTime.Parse("2022-01-01") }, new { user_id = 1, login_date = DateTime.Parse("2022-01-05") }, new { user_id = 1, login_date = DateTime.Parse("2022-01-10") }, new { user_id = 2, login_date = DateTime.Parse("2022-01-02") }, new { user_id = 2, login_date = DateTime.Parse("2022-01-07") }, new { user_id = 2, login_date = DateTime.Parse("2022-01-12") }, new { user_id = 3, login_date = DateTime.Parse("2022-01-03") }, new { user_id = 3, login_date = DateTime.Parse("2022-01-08") }, new { user_id = 3, login_date = DateTime.Parse("2022-01-13") }, }; // Sort the dataframe by user_id and login_date var sortedData = data.OrderBy(x => x.user_id).ThenBy(x => x.login_date); // Calculate the gap in days between consecutive logins per user var result = sortedData.Select((x, i) => new { user_id = x.user_id, login_date = x.login_date, gap_in_days = i == 0 || x.user_id != sortedData.ElementAt(i - 1).user_id ? (double?)null : (x.login_date - sortedData.ElementAt(i - 1).login_date).TotalDays, }); // Print the result foreach (var item in result) { Console.WriteLine($"user_id: {item.user_id}, login_date: {item.login_date.ToString("yyyy-MM-dd")}, gap_in_days: {item.gap_in_days}"); } } } ```

Enhanced response (with ZPI)

```csharp using System; using System.Collections.Generic; using System.Data; using System.Linq; public class Login { public int UserId { get; set; } public DateTime LoginDate { get; set; } } public class LoginGapCalculator { public List<LoginGap> CalculateLoginGaps(List<Login> logins) { var loginGaps = new List<LoginGap>(); var userLogins = logins.GroupBy(l => l.UserId) .ToDictionary(g => g.Key, g => g.OrderBy(l => l.LoginDate).ToList()); foreach (var userLogin in userLogins) { for (int i = 1; i < userLogin.Value.Count; i++) { var currentLogin = userLogin.Value[i]; var previousLogin = userLogin.Value[i - 1]; var gapInDays = (currentLogin.LoginDate - previousLogin.LoginDate).Days; loginGaps.Add(new LoginGap { UserId = userLogin.Key, CurrentLoginDate = currentLogin.LoginDate, PreviousLoginDate = previousLogin.LoginDate, GapInDays = gapInDays }); } } return loginGaps; } } public class LoginGap { public int UserId { get; set; } public DateTime CurrentLoginDate { get; set; } public DateTime PreviousLoginDate { get; set; } public int GapInDays { get; set; } } class Program { static void Main(string[] args) { var logins = new List<Login> { new Login { UserId = 1, LoginDate = DateTime.Parse("2022-01-01") }, new Login { UserId = 1, LoginDate = DateTime.Parse("2022-01-05") }, new Login { UserId = 1, LoginDate = DateTime.Parse("2022-01-10") }, new Login { UserId = 2, LoginDate = DateTime.Parse("2022-01-02") }, new Login { UserId = 2, LoginDate = DateTime.Parse("2022-01-07") }, new Login { UserId = 2, LoginDate = DateTime.Parse("2022-01-12") }, }; var calculator = new LoginGapCalculator(); var loginGaps = calculator.CalculateLoginGaps(logins); foreach (var loginGap in loginGaps) { Console.WriteLine($"User ID: {loginGap.UserId}, Current Login Date: {loginGap.CurrentLoginDate}, Previous Login Date: {loginGap.PreviousLoginDate}, Gap in Days: {loginGap.GapInDays}"); } } } ``` This C# code calculates the gap in days between consecutive logins per user. It first groups the logins by user ID and then orders the logins for each user by date. It then iterates over the logins for each user, calculating the gap in days between the current and previous logins. The results are stored in a list of `LoginGap` objects, which contain the user ID, current login date, previous login date, and gap in days. The code includes a `Main` method that demonstrates how to use the `LoginGapCalculator` class. The `LoginGapCalculator` class uses a simple and efficient approach to calculate the login gaps. It has a time complexity of O(n log n) due to the sorting of logins for each user, where n is the number of logins for a user. The space complexity is O(n), where n is the total number of logins. Note that this code assumes that the logins are stored in a list of `Login` objects, where each `Login` object has a `UserId` and a `LoginDate`. The code can be easily modified to work with a database or other data source. Also, note that this code does not handle the case where a user has only one login. In this case, there is no previous login to calculate the gap from, so the code does not include a `LoginGap` object for this user. If you want to include a `LoginGap` object for users with only one login, you can modify the code to include a default gap value (e.g., 0 days) for these users.

Grader chain

Each grader reads the same baseline + enhanced pair and casts an independent verdict. Disagreement is the framework's own signal — not noise to be averaged away.

V1samba/Meta-Llama-3.3-70B-Instruct
Better
V4qwen2.5-coder-3b-instruct
Better
V5openrouter/qwen/qwen3-235b-a22b-2507
Better
V7qwen2.5-coder-7b-instruct
Better
V8openai/gpt-4.1
Better
V9anthropic/claude-opus-4-7
Better
V12openai/gpt-4o
Better

Comments

Our grader said what it said. What do you say? Comment as a guest below.

No comments yet. Be the first to say what you make of this round.

← back to all rounds