CCCGuide

Problem J1: Concert Tickets

2026 · J1 · Original problem · DMOJ

Problem Description

Besa wants to buy tickets for the upcoming Saylor Twift concert.

Given the total number of tickets for the concert and the number of tickets other people have purchased, your job is to determine whether or not Besa can buy her desired number of tickets.

Input Specification

The first line of input contains a positive integer, BB, representing the number of tickets Besa wants to buy. The second line contains a positive integer, TT, representing the total number of tickets for the concert. The third line contains a positive integer, PP, where P≤TP \leq T, representing the number of tickets other people have purchased.

Output Specification

If Besa cannot buy BB tickets, output N. Otherwise, output Y, followed by a single space, followed by the number of tickets that would remain after Besa buys BB tickets.

Sample Input 1

5
100
70

Output for Sample Input 1

Y 25

Explanation of Output for Sample Input 1

There are a total of 100100 tickets for the concert. Besa wants to buy 55 tickets and other people have purchased 7070 tickets. So, 100−75=25100 - 75 = 25 tickets would remain after Besa buys 55 tickets.

Sample Input 2

3
200000
199998

Output for Sample Input 2

N

Explanation of Output for Sample Input 2

There are a total of 200 000200\,000 tickets for the concert. Besa wants to buy 33 tickets and other people have purchased 199 998199\,998 tickets. So, Besa cannot buy 33 tickets.