Round #570
09 May 2026, 23:15· 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 running total of sales by date using a window function.
Zero-point index (what the engine surfaced)
ZPI-ZPI-0004 | 2026-05-09T23:15:59Z
Calculate the running total of sales by date using a window function.
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;
class Program
{
static void Main()
{
// Create a sample dataframe
var data = new[]
{
new { Date = "2022-01-01", Sales = 100 },
new { Date = "2022-01-02", Sales = 200 },
new { Date = "2022-01-03", Sales = 300 },
new { Date = "2022-01-04", Sales = 400 },
new { Date = "2022-01-05", Sales = 500 }
};
// Calculate the running total of sales by date
var runningTotal = data.Select((x, i) => new { Date = x.Date, Sales = x.Sales, RunningTotal = data.Take(i + 1).Sum(y => y.Sales) });
// Print the result
foreach (var item in runningTotal)
{
Console.WriteLine($"Date: {item.Date}, Sales: {item.Sales}, Running Total: {item.RunningTotal}");
}
}
}
```
Enhanced response (with ZPI)
```csharp
using System;
using System.Collections.Generic;
using System.Linq;
public class SalesData
{
public DateTime Date { get; set; }
public decimal Sales { get; set; }
public decimal RunningTotal { get; set; }
}
class Program
{
static void Main()
{
// Sample sales data
var sales = new List<SalesData>
{
new SalesData { Date = DateTime.Parse("2022-01-01"), Sales = 100 },
new SalesData { Date = DateTime.Parse("2022-01-02"), Sales = 200 },
new SalesData { Date = DateTime.Parse("2022-01-03"), Sales = 300 },
new SalesData { Date = DateTime.Parse("2022-01-04"), Sales = 400 },
new SalesData { Date = DateTime.Parse("2022-01-05"), Sales = 500 },
};
// Calculate running total
var runningTotal = sales
.OrderBy(s => s.Date)
.Select((s, i) => new SalesData
{
Date = s.Date,
Sales = s.Sales,
RunningTotal = sales.Take(i + 1).Sum(x => x.Sales)
})
.ToList();
// Print the result
foreach (var item in runningTotal)
{
Console.WriteLine($"Date: {item.Date.ToString("yyyy-MM-dd")}, Sales: {item.Sales}, Running Total: {item.RunningTotal}");
}
}
}
```
This C# code calculates the running total of sales by date using LINQ. Here's a step-by-step explanation:
1. **Data Preparation**: We start with a list of `SalesData` objects, each containing a `Date` and `Sales` amount.
2. **Sorting**: We sort the sales data by date in ascending order using the `OrderBy` method.
3. **Running Total Calculation**: We use the `Select` method to project each sales data point into a new `SalesData` object that includes the running total. The running total is calculated by summing up the sales amounts of all data points up to the current index using the `Take` and `Sum` methods.
4. **Result**: The resulting list of `SalesData` objects contains the date, sales amount, and running total for each data point.
5. **Printing the Result**: Finally, we print the result to the console, displaying the date, sales amount, and running total for each data point.
This code provides a clear and efficient way to calculate the running total of sales by date using LINQ in C#.
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
BetterV4qwen2.5-coder-3b-instruct
BetterV5openrouter/qwen/qwen3-235b-a22b-2507
BetterV7qwen2.5-coder-7b-instruct
BetterV8openai/gpt-4.1
BetterV9anthropic/claude-opus-4-7
BetterV12openai/gpt-4o
BetterComments
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.