Strange Attendance System
Practice
4.1 (12 votes)
Mathematics
Easy
Mathematics
Mathamatics
Problem
83% Success 2362 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Raghav lives in Strangeland and studies in a college where it is mandatory to maintain a minimum of 75% attendance in each subject or else you are not allowed to appear for the exam of that subject. Consider the subject AI (Artificial Intelligence) for which the total number of classes held till the present date equals \(X\). ​Raghav has only attended \(Y\) out of these \(X\) classes. Find minimum how many extra classes should be held so that he is allowed to appear for the AI exam. Assume that he attends all the extra classes. 


INPUT FORMAT

  • First line consists of a single integer \(T\) denoting the number of testcases

  • Next \(T\) lines each consist of two space separated integers \(X\) and \(Y\) as described above

OUTPUT FORMAT

  • For each testcase output a single integer denoting the answer for that testcase


CONSTRAINTS

  • \(1 \le T \le 10^5\)

  • \(1 \le X \le 10^6\)

  • \(0 \le Y \le X\)

SUBTASKS

  • For 20 Points : \(1 \le T, X \le 100\)
  • For 80 Points : Original Constraints

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
3 votes
Tags:
Basic MathNumber theoryAlgorithmsMath
Points:20
1 votes
Tags:
Easy
Points:20
11 votes
Tags:
Basic ProgrammingOpenApprovedEasyHash functionMathamatics