> ## Documentation Index
> Fetch the complete documentation index at: https://resources.devweekends.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Contest Day Mastery

> Pre-contest rituals, live strategy, time management, and post-contest recovery

# 📅 Contest Day Mastery

The difference between solving 3 problems and 4 problems is rarely skill—it's **strategy, focus, and energy management**. This chapter gives you the complete playbook for contest day.

![Contest Day Timeline](https://mintcdn.com/devweeekends/AEOaWh79Ur7CdHHv/images/courses/cp/contest-timeline.svg?fit=max\&auto=format\&n=AEOaWh79Ur7CdHHv\&q=85\&s=5e939e470c208f50e7c9c81ea0d71c41)

***

## ☀️ Pre-Contest Routine (2 Hours Before)

### The Warm-Up Protocol

> [!WARNING]
>
> **Never start a rated contest cold.** Your brain needs 15-30 minutes to switch into "competitive mode."

```cpp theme={null}
// Solve 2-3 easy problems (800-1000 rated) before the contest
// This activates your problem-solving circuits
// Choose problems from topics you're comfortable with
```

![Warm-up Routine](https://mintcdn.com/devweeekends/0kwJwOL2KCwg2YYu/images/courses/cp/warmup-routine.svg?fit=max\&auto=format\&n=0kwJwOL2KCwg2YYu\&q=85\&s=1a5882db79704d7af3d325bb4fe4c541)

### Pre-Contest Checklist

**1. Physical Preparation (2 hours before)**

* Light meal (avoid heavy food—blood goes to digestion, not brain)
* Hydrate well (dehydration = slower thinking)
* 10 minutes of light movement (walk, stretch)
* Bathroom break (nothing worse than urgency during problem D)

**2. Technical Setup (1 hour before)**

* Open your template in VS Code
* Test compile: make sure everything works
* Open Codeforces/contest page
* Clear browser cache if needed
* Close ALL other tabs and apps
* Phone on silent, face down

**3. Mental Preparation (30 minutes before)**

* Solve 2 easy warm-up problems
* Review your cheat sheet / templates
* Take 3 deep breaths
* Positive self-talk: "I've prepared. I'll do my best."

**4. Final 5 Minutes**

* Refresh contest page
* Have water bottle ready
* Clear your desk
* Set a timer visible on screen
* **Focus. Breathe. Begin.**

***

## ⏱️ Live Contest Strategy

### The First 5 Minutes

![First 5 Minutes Strategy](https://mintcdn.com/devweeekends/AEOaWh79Ur7CdHHv/images/courses/cp/first-5-minutes.svg?fit=max\&auto=format\&n=AEOaWh79Ur7CdHHv\&q=85\&s=297a6e4723cb963312d2655e22d1d2b2)

```cpp theme={null}
// Minute 0-1: Open ALL problems (Ctrl+Click each in new tab)
// Minute 1-3: SCAN all problems (just titles + first line)
// Minute 3-5: Read Problem A fully, start coding

// WHY: Sometimes A is harder than B
// You want awareness of all problems before diving deep
```

### Time Allocation Strategy

| Rating Target | Problem A | Problem B | Problem C | Problem D | Problem E |
| - | - | - | - | - | - |
| Specialist (1400) | 10 min | 20 min | 40 min | 50 min | - |
| Expert (1600) | 8 min | 15 min | 30 min | 40 min | 27 min |
| Candidate Master | 5 min | 10 min | 20 min | 35 min | 40 min |

> [!WARNING]
>
> **The 20-Minute Rule:** If you've spent 20 minutes on a problem with ZERO progress, MOVE ON. Read the next problem. Fresh eyes often find solutions. This is not giving up---it is resource allocation. In a 2-hour contest, spending 40 minutes stuck on C while D was solvable in 15 minutes is a net loss of one problem. The math is brutal: solving 4 problems in 120 minutes always beats solving 3 problems in 100 minutes, regardless of penalty time.

### Problem Selection During Contest

![Problem Decision Tree](https://mintcdn.com/devweeekends/AEOaWh79Ur7CdHHv/images/courses/cp/problem-decision.svg?fit=max\&auto=format\&n=AEOaWh79Ur7CdHHv\&q=85\&s=c3977bdf156b01c8aaf13b1646ec7b30)

```
For each problem, ask:
1. Do I understand what it's asking? (1 min to decide)
2. Do I see a clear approach? (3 min to decide)
3. Am I confident I can implement it? (5 min to decide)

If any answer is "No" after time limit → SKIP, try next problem
```

### Adaptive Strategy

> **When Stuck on C**
>
> * Read problem D and E
> * Sometimes D is easier than C for YOUR skill set
> * Getting D before C is perfectly valid
> * Don't let problem order limit you

> **When Everything Seems Hard**
>
> * Take 30 seconds, close eyes, breathe
> * Go back to the easiest unsolved problem
> * Simplify: solve for n=1, n=2, n=3
> * Sometimes panic blinds you to simple solutions

***

## 🕐 Time Management Tactics

### The Pomodoro for CP

![Contest Pomodoro](https://mintcdn.com/devweeekends/AEOaWh79Ur7CdHHv/images/courses/cp/contest-pomodoro.svg?fit=max\&auto=format\&n=AEOaWh79Ur7CdHHv\&q=85\&s=2bab7b6e20f584642c3878e4620518c5)

```
2-hour contest breakdown:
[0:00 - 0:30]  Problems A + B (high urgency, quick wins)
[0:30 - 1:00]  Problem C (deep focus)
[1:00 - 1:05]  BREAK: Stand up, stretch, drink water
[1:05 - 1:35]  Problem D (or C if still working)
[1:35 - 2:00]  Final push: debug or attempt E
```

### When to Submit vs When to Test More

```cpp theme={null}
// SUBMIT FAST if:
// - Problem is clearly correct (greedy with proof)
// - You've tested 3+ edge cases
// - You're running low on time

// TEST MORE if:
// - There are tricky edge cases (n=0, n=1, negative)
// - Implementation was complex
// - You have time remaining
// - Problem has tight constraints (likely tricky cases)
```

### The Last 10 Minutes

> [!WARNING]
>
> **Never start implementing a new solution in the last 10 minutes.**
>
> Use this time for:
>
> * Debugging current submissions
> * Rethinking a problem you skipped
> * Stress testing solutions you're unsure about

***

## 🐛 Dealing with WA During Contest

### The WA Response Protocol

![WA Response Protocol](https://mintcdn.com/devweeekends/0kwJwOL2KCwg2YYu/images/courses/cp/wa-protocol.svg?fit=max\&auto=format\&n=0kwJwOL2KCwg2YYu\&q=85\&s=ee45a7dfb571fb7192a7b01b4a2445e8)

**1. Don't Panic (10 seconds)**

Take a breath. WA is normal. Even tourists get WA.

**2. Check the Obvious (30 seconds)**

* Integer overflow?
* Array bounds?
* Wrong data type (int vs long long)?
* Output format (newline at end)?

**3. Trace Sample Case (1 minute)**

* Does your code produce correct output for samples?
* If not, debug with samples first
* If yes, your logic might be wrong on edge cases

**4. Generate Edge Cases (2 minutes)**

* n = 1 (minimum size)
* All same elements
* All different elements
* Maximum values
* Sorted / reverse sorted input

**5. Stress Test (if time permits)**

* Generate random small inputs
* Compare with brute force
* Find the failing case

### Common WA Causes (Quick Checklist)

```cpp theme={null}
// 1. Integer Overflow
int a = 1e9, b = 1e9;
int wrong = a * b;  // OVERFLOW!
long long right = (long long)a * b;  // Correct

// 2. Array Index
for(int i = 0; i <= n; i++)  // Should be i < n?

// 3. Uninitialized Variables
int dp[N][M];  // Random values! Use memset or fill

// 4. Modular Arithmetic
ans = (ans + x) % MOD;  // What if x is negative?
ans = ((ans + x) % MOD + MOD) % MOD;  // Safe version

// 5. Off-by-one in Binary Search
while(l < r) vs while(l <= r)  // Different semantics!
```

***

## 💓 Energy & Focus Management

### The Focus Curve

![Focus Curve](https://mintcdn.com/devweeekends/AEOaWh79Ur7CdHHv/images/courses/cp/focus-curve.svg?fit=max\&auto=format\&n=AEOaWh79Ur7CdHHv\&q=85\&s=1d970db4b76e09310bdaa9f800b2bc91)

```
Typical focus pattern during 2-hour contest:
[0:00 - 0:45]  HIGH focus (use for hardest thinking)
[0:45 - 1:15]  MEDIUM focus (fatigue starts)
[1:15 - 1:30]  DIP (take micro-break if possible)
[1:30 - 2:00]  RECOVERY (adrenaline of deadline)
```

### Micro-Recovery Techniques

> **The 20-20-20 Rule**
>
> Every 20 minutes, look at something 20 feet away for 20 seconds. Prevents eye strain and mental fatigue.

> **Box Breathing**
>
> When stressed: Breathe in 4s → Hold 4s → Out 4s → Hold 4s. Resets your nervous system.

> **Shoulder Rolls**
>
> 3 forward, 3 backward. Releases tension that builds up during intense focus.

> **Water Sips**
>
> Small sips every 20-30 minutes. Dehydration reduces cognitive performance by 10%+.

***

## 🌙 Post-Contest Protocol

### Immediate Post-Contest (First 30 minutes)

> [!WARNING]
>
> **Do NOT immediately upsolve.** Your brain is tired. Rest first.

**1. Cool Down (5 minutes)**

* Stand up, stretch, walk around
* Drink water
* Let the adrenaline fade

**2. Quick Reflection (10 minutes)**

Write answers to:

* What went well?
* What could be better?
* Any patterns in my mistakes?

**3. Read Editorial (15 minutes)**

* Don't code yet, just understand
* Focus on problems you attempted but didn't solve
* Note any new techniques

### Upsolving Schedule

```
Day of contest: Read editorials only, no coding
Day after: Implement 1-2 unsolved problems
2 days after: Implement remaining problems
1 week later: Re-attempt hardest problem from scratch
```

### The Mistake Journal Entry

After each contest, fill this template:

```markdown theme={null}
## Contest: Codeforces Round #XXX
## Date: YYYY-MM-DD
## Performance: Solved X/Y, Rank: ZZZZ

### Problem A: [Name]
- Time: X minutes
- Status: ✅ / ⚠️ WA / ❌ Unsolved
- Key insight: 
- Mistake made (if any):

### Problem B: [Name]
...

### Lessons Learned:
1. 
2. 
3. 

### Action Items for Next Contest:
1. 
2. 
```

***

## 🏆 Contest Day Mental Game

### Pre-Contest Affirmations

Read these before every contest:

```
1. "I've prepared. I deserve to be here."
2. "Mistakes are learning opportunities, not failures."
3. "I focus on process, not rating."
4. "Every problem I solve makes me stronger."
5. "I am calm, focused, and ready."
```

### During Contest Self-Talk

> **When Stuck**
>
> "This is normal. Take a breath. Try a different approach."

> **When Behind**
>
> "Others don't matter. I focus on MY best performance."

> **After WA**
>
> "Good catch. Now I know what to fix. Let's debug."

> **When Tired**
>
> "20 more minutes. I can do this. Stay present."

***

## 📈 Virtual Contest Protocol

### Making Virtuals Count

> [!WARNING]
>
> **Virtual contests MUST feel real to be useful.** Don't pause. Don't look up solutions. Don't extend time.

![Virtual vs Real Contest](https://mintcdn.com/devweeekends/0kwJwOL2KCwg2YYu/images/courses/cp/virtual-vs-real.svg?fit=max\&auto=format\&n=0kwJwOL2KCwg2YYu\&q=85\&s=b3d7f7d5ecd1378def700f5f78b2202d)

### Virtual Contest Rules

```
TREAT LIKE RATED:
✅ Same pre-contest routine
✅ Same 2-hour time limit (strict!)
✅ No looking anything up during
✅ Same post-contest analysis

THE BENEFIT:
- Practice under pressure without rating risk
- Experiment with different strategies
- Build endurance for 3-hour contests
```

### Ideal Virtual Contest Schedule

| Day | Activity |
| - | - |
| Monday | Virtual contest (old Div2) |
| Tuesday | Upsolve virtual + practice |
| Wednesday | Practice weak topics |
| Thursday | Virtual contest (old Div2) |
| Friday | Upsolve + review |
| Saturday | RATED contest (if available) |
| Sunday | Rest / light practice |

***

## ✅ Contest Day Checklist Summary

Print this and keep it by your desk:

```
PRE-CONTEST (2 hours before):
☐ Light meal + hydration
☐ Physical warm-up (stretch, walk)
☐ Technical setup complete
☐ Warm-up problems solved
☐ Templates open and tested
☐ Distractions eliminated

DURING CONTEST:
☐ Read ALL problems first (5 min)
☐ Solve in optimal order (not always A→B→C)
☐ Use 20-minute rule for skipping
☐ Micro-breaks every 30 minutes
☐ Don't panic on WA - follow protocol

POST-CONTEST:
☐ Cool down (don't upsolve immediately)
☐ Quick reflection (what went well/wrong)
☐ Read editorials
☐ Fill mistake journal
☐ Upsolve within 48 hours
```

***

> [!TIP]
>
> **Master the process, and the results will follow.**
>
> The best competitive programmers have consistent rituals—they don't rely on motivation or luck. Build your routine, trust your preparation, and show up ready to compete.
>
> **See you on the leaderboard!**

***

## Interview Deep-Dive

> **You are 45 minutes into a 2-hour contest. You have solved A and B, but you are stuck on C with no clear approach. Problem D looks potentially easier. What is your decision framework?**
>
> **Strong Answer:**
>
> * I apply the 20-minute rule: if I have spent 20 minutes on C with zero progress (not even a partial approach), I must read D. Sunk cost fallacy is the number one time-waster in contests. Problems are not always ordered by difficulty for every contestant -- D might use a technique I know well while C tests a pattern I have never seen.
> * I spend exactly 2 minutes scanning D: read constraints, identify the problem type, check if I see an approach. If D clicks immediately, I switch fully to D. If D also looks hard, I return to C with fresh eyes -- sometimes the mental break of reading a different problem unlocks the insight.
> * Time budget at the 45-minute mark with A and B solved: I have 75 minutes left. Ideally, C should take 30-40 minutes and D should take 30-40 minutes. If I have already spent 20 minutes on C with no progress, spending another 20 is unlikely to help. Better to invest 30 minutes in D (where I might make progress) and return to C in the last 20 minutes.
> * The meta-principle: maximize expected problems solved, not time spent on any single problem. Solving D and not C is the same score as solving C and not D. Flexibility in problem ordering is a competitive advantage.
>
> **Follow-up:** How do you handle the psychological pressure of "skipping" a problem during a contest?
>
> Reframe skipping as strategy, not failure. Solving problems out of order is common among top contestants -- tourist, Petr, and other legends regularly skip problems and come back. I tell myself: "I am not giving up on C. I am investing my time where the expected return is highest right now." If I return to C later with fresh eyes and a different mental state, I often see the approach immediately.

> **Describe your ideal warm-up routine before a rated contest. What specifically do you do, and why does each step matter?**
>
> **Strong Answer:**
>
> * 30 minutes before: solve 2-3 problems rated 800-1000 from random tags. This activates problem-solving neural pathways -- the same way athletes warm up muscles before competition. I choose familiar topics so the warm-up builds confidence rather than creating anxiety.
> * 15 minutes before: review my "Never Again" list (top 5 most common bugs) and my pre-submit checklist. This primes my error-detection circuits. I also open my template, verify it compiles, and have input.txt ready.
> * 5 minutes before: close all tabs except the contest page, put phone on silent, and take 3 deep breaths. Physical state matters -- I ensure I have water, a clear desk, and no pending distractions.
> * Why each step matters: the warm-up problems activate speed and pattern recognition. The checklist review reduces first-submission errors (each WA costs 10 minutes penalty in ICPC scoring). The environmental setup eliminates context-switching, which costs 15-20 minutes of cognitive recovery each time it happens during a contest.
> * What NOT to do: solve a hard problem right before the contest (creates frustration), eat a heavy meal (diverts blood from brain to digestion), or read social media (fragments attention).
>
> **Follow-up:** What about physical preparation -- does that really matter for a coding contest?
>
> Significantly. Dehydration reduces cognitive performance by 10-15%. A heavy meal triggers a postprandial dip in alertness 30-60 minutes after eating. Sitting in the same position for 2 hours without movement causes muscle tension that increases stress hormones and reduces focus. I recommend: light meal 2 hours before, water bottle on desk with sips every 20 minutes, and a 30-second shoulder roll and stretch at the 1-hour mark. These are small investments with outsized returns on focus quality.

> **After a contest where you solved only 2 out of 6 problems and lost 50 rating points, walk me through your post-contest analysis process.**
>
> **Strong Answer:**
>
> * Step 1 (5 minutes): Cool down. I do not analyze while emotional. I stand up, walk around, drink water. Frustration clouds judgment and turns analysis into self-criticism.
> * Step 2 (15 minutes): Classify each unsolved problem. For problems C, D, E, F: did I attempt it? If yes, where did I get stuck -- wrong approach, correct approach but implementation bug, or ran out of time? If I did not attempt it, was it because I never read it or because I read it and saw no path?
> * Step 3 (30 minutes): Read editorials for C and D only (the problems I should have solved at my level). Understand the key insight I missed. Was it a technique I have never seen (knowledge gap) or a technique I know but failed to recognize (pattern recognition gap)?
> * Step 4 (next day): Implement the editorial solutions for C and D from scratch. This converts understanding into skill.
> * Step 5 (1 week later): Re-solve C and D from scratch without references. If I can solve them cleanly, the lesson stuck. If not, I add them to my spaced repetition queue.
> * The rating drop is data, not destiny. I focus on the actionable output: "I need to practice binary search on answer" is actionable. "I am bad at contests" is not.
>
> **Follow-up:** How do you decide which unsolved problems are worth upsolving and which are too far above your level?
>
> I upsolve problems within 200 rating of my level. If I am rated 1400, I upsolve problems rated up to 1600. Problems rated 1800+ likely require techniques I have never encountered, and reading their editorials will be confusing without prerequisite knowledge. The exception: if the editorial reveals a simple observation I should have seen (not an advanced algorithm), I upsolve regardless of rating. Some 1800-rated problems have 1200-rated solutions that just require a clever observation.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.