> For the complete documentation index, see [llms.txt](https://xtecna.gitbook.io/solucoes-da-beecrowd/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xtecna.gitbook.io/solucoes-da-beecrowd/ad-hoc/2373-garcom.md).

# 2373 - Garçom

Mais um dia, mais um problema Ad Hoc...

## Descrição

{% embed url="<https://www.urionlinejudge.com.br/judge/pt/problems/view/2373>" %}

## Solução

Basta ler cada par de números e avaliar o número de copos e de latas. Caso haja mais latas do que copos, adicionar a quantidade de copos na quantidade de copos quebrados.

{% tabs %}
{% tab title="C99" %}

```c
#include <stdio.h>

int main(){
    int A, B;

    while(scanf("%d %d", &A, &B) != EOF){
        if(!A && !B)    break;
        
        printf("%d\n", 2 * A - B);
    }

    return 0;
}
```

{% endtab %}

{% tab title="C++17" %}

```cpp
#include <iostream>

using namespace std;

int main(){
    int A, B;

    while(cin >> A >> B){
        if(!A && !B)    break;

        cout << 2 * A - B << endl;
    }

    return 0;
}
```

{% endtab %}

{% tab title="JavaScript 12.18" %}

```javascript
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.trim().split('\n');

lines.pop();

while(lines.length){
    let [A, B] = lines.shift().trim().split(' ').map((x) => parseInt(x));

    console.log(2 * A - B);
}
```

{% endtab %}

{% tab title="Python 3.9" %}

```python
while True:
    try:
        A, B = [int(x) for x in input().strip().split(' ')]

        if(not A and not B):
            break

        print(2 * A - B)
    except EOFError:
        break
```

{% endtab %}
{% endtabs %}
