Century years are treated as leap years

Done

/home/devdi/devswarm/evals/tasks/leap_year_centuries/repo · 2026-11-09 16:16:04 UTC · took 22.8s

  1. Plan (done)
  2. Code (done)
  3. Test (done)
  4. Review (done)
  5. Finish (done)
Cost
$0.0023
Tests
Passed
Iterations
1
Re-plans
0
LLM calls
10
Prompt read from cache
84%

Usage by agent

Cost per agent
planner: $0.0006 planner planner, Cost: $0.0006 $0.0006 coder: $0.0007 coder coder, Cost: $0.0007 $0.0007 tester: $0.0010 tester tester, Cost: $0.0010 $0.0010
Tokens per agent
  • Cache read
  • Cache write
  • Input
  • Output
planner: 7,601 planner planner, Cache read: 5,763 planner, Cache write: 999 planner, Output: 831 7,601 coder: 11.3K coder coder, Cache read: 8,611 coder, Cache write: 1,838 coder, Output: 817 11.3K tester: 18.1K tester tester, Cache read: 14.5K tester, Cache write: 2,517 tester, Output: 1,087 18.1K
View as table
AgentCostCache readCache writeInputOutput
planner$0.00065,7639998831
coder$0.00078,6111,8388817
tester$0.001014,4762,517101,087

Timeline

  1. planner iteration 1 Finished 3 calls · 7,601 tokens · $0.0006 · 6.0s

    Loading…

  2. coder iteration 1 Finished 3 calls · 11.3K tokens · $0.0007 · 5.6s

    Loading…

  3. tester iteration 1 Finished 4 calls · 18.1K tokens · $0.0010 · 10.0s

    Loading…

  4. verify iteration 1 Passed 0.5s
    .......                                                                  [100%]
    7 passed in 0.02s
    

Final diff

diff --git a/calendar_utils.py b/calendar_utils.py
index 5b47463..dce67d9 100644
--- a/calendar_utils.py
+++ b/calendar_utils.py
@@ -2,7 +2,7 @@ _DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
 
 
 def is_leap(year: int) -> bool:
-    return year % 4 == 0
+    return (year % 4 == 0 and year % 100 != 0) or year % 400 == 0
 
 
 def days_in_month(year: int, month: int) -> int:
diff --git a/test_calendar_utils.py b/test_calendar_utils.py
index e4540ed..3973cab 100644
--- a/test_calendar_utils.py
+++ b/test_calendar_utils.py
@@ -6,6 +6,43 @@ def test_ordinary_leap_year():
     assert not is_leap(2023)
 
 
+def test_century_years():
+    assert not is_leap(1900)
+    assert is_leap(2000)
+    assert not is_leap(2100)
+
+
+def test_acceptance_leap_years():
+    assert not is_leap(1900)
+    assert is_leap(2000)
+    assert not is_leap(2100)
+    assert is_leap(2024)
+    assert not is_leap(2023)
+
+
+def test_four_hundred_year_rule():
+    assert is_leap(1600)
+    assert is_leap(2400)
+    assert not is_leap(1700)
+    assert not is_leap(1800)
+
+
+def test_proleptic_zero_and_negative_years():
+    assert is_leap(0)
+    assert not is_leap(-1)
+    assert is_leap(-4)
+    assert not is_leap(-100)
+    assert is_leap(-400)
+
+
+def test_other_months_unaffected_by_century_years():
+    for month, days in [(1, 31), (3, 31), (4, 30), (6, 30), (12, 31)]:
+        assert days_in_month(1900, month) == days
+        assert days_in_month(2000, month) == days
+
+
 def test_february():
     assert days_in_month(2024, 2) == 29
     assert days_in_month(2023, 2) == 28
+    assert days_in_month(1900, 2) == 28
+    assert days_in_month(2000, 2) == 29