All Tracks Math Number Theory Problem

Chakde India
Tag(s):

Very-Easy

Problem
Editorial
Analytics

Appro is the coach of Indian Women's Hockey team. She is currently training two teams Team A and Team B for the 2018 Women's Hockey World Cup to be held in London,England.

Team A consists of $$M$$ players and B consists of $$N$$ players.

To enhance the training she wants to divide them into groups of $$K$$ players with every group being composed of people of only one of the original two teams.

Appro wants to know what is the maximum k for which this is possible?

Input:

The first line of input contains single integer $$T$$ denoting the number of test cases.

Each line of test case contains 2 space separated integers $$M$$ and $$N$$ as specified in the problem.

Output:

For each test case, output the maximum value of $$K$$.

Constraints:

Subtask $$1$$: $$30$$ Points

$$ 1\le T \le 100 $$

$$ 1\le M,N \le 10^5 $$

Subtask $$2$$: $$30$$ Points

$$ 1\le T \le 1000 $$

$$ 1\le M, N \le 10^{9} $$

Subtask $$3$$: $$40$$ Points

$$ 1\le T \le 10^5 $$

$$ 1\le M, N \le 10^{18} $$

SAMPLE INPUT
1
2 2
SAMPLE OUTPUT
2
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala 2.11.8, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications