# Skill Improvement - EDITORIAL:

* Author:* kishen1912000

* Editorialist:* kishen1912000

# DIFFICULTY:

EASY

# PREREQUISITES:

Implementation

# PROBLEM:

Find the total no. of pairs of coding skills rating and soft skill rating such that coding skill rating > soft skill rating, given your initial coding skills rating C and soft skills rating S and you will work for H hours to improve your skills.

# QUICK EXPLANATION:

The condition will be C+i - (S+H-i) >= 1. So, an expression can be derived for i and then finally the no. of pairs.

# EXPLANATION:

Given initially coding and soft skills rating as C and S respectively. Letâ€™s say we dedicate i hours to improve coding skills. New ratings will be C+i and S+H-i respectively. The condition will be, C+i - (S+H-i) \gt 0. By simplifying this we get i\ge ceil((S+H-C)/2).

Therefore, the no.of pairs = max(H+1-max( ceil(S+H-C)/2,0 ), 0)

Note: ceil(x/n) = x//n + x%n. Using this makes the code shorter. [// is floor division]

Check out my solution which uses 114 characters. This solution can be improved more. Feel free to share your approach, if it differs. Suggestions are always welcomed.

# SOLUTIONS:

## Setter's Solution

```
for _ in range(input()):
c,s,h=map(int,raw_input().split())
w=h-c+s+1
print max(h-max(w//2+w%2,0)+1,0)
```