SOLVE

LATER

Chakde India

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} \)

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++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic

Initializing Code Editor...

{"b8a93d0": "/pagelets/recommended-problems/algorithm/chakde-india/", "377c776": "/pagelets/problems-hint/algorithm/chakde-india/", "88a20fa": "/pagelets/show-submission/algorithm/chakde-india/", "30b5769": "/pagelets/suggested-problems/algorithm/chakde-india/", "455fe66": "/pagelets/problem-author-tester/algorithm/chakde-india/"}

realtime.hackerearth.com

80

ef0faececa17575a0b7737ee4a14d1d2f1db5dda

58a29e5cae2309f04b28

/realtime/pusher/auth/