---
{"category_name":"easy","problem_code":"XLSQUARE","problem_name":"Large Square","problemComponents":{"constraints":"- $1 \\leq T \\leq 100$\n- $1 \\leq N \\leq 10^5$\n- $1 \\leq A \\leq 10^4$\n","constraintsState":true,"subtasks":"","subtasksState":false,"inputFormat":"- The first line of input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\n- The first and only line of each test case contains two space-separated integers $N, A$.\n","inputFormatState":true,"outputFormat":"For each test case, print a single line containing one integer - the side length of the largest square you can obtain.","outputFormatState":true,"sampleTestCases":{"0":{"id":1,"input":"5\n3 2\n5 3\n16 18\n11 8\n8 6\n","output":"2\n6\n72\n24\n12\n","explanation":"**Test case $1$:** You can choose just one square to form the mega square. So the side length will be $2$.\n\n**Test case $2$:** You can choose $4$ squares to form a mega square with side-length $2 \\cdot A$ $= 6$. ","isDeleted":false}}},"video_editorial_url":"https://youtu.be/J7UwMlfNYHQ","languages_supported":{"0":"CPP14","1":"C","2":"JAVA","3":"PYTH 3.6","4":"CPP17","5":"PYTH","6":"PYP3","7":"CS2","8":"ADA","9":"PYPY","10":"TEXT","11":"PAS fpc","12":"NODEJS","13":"RUBY","14":"PHP","15":"GO","16":"HASK","17":"TCL","18":"PERL","19":"SCALA","20":"LUA","21":"kotlin","22":"BASH","23":"JS","24":"LISP sbcl","25":"rust","26":"PAS gpc","27":"BF","28":"CLOJ","29":"R","30":"D","31":"CAML","32":"FORT","33":"ASM","34":"swift","35":"FS","36":"WSPC","37":"LISP clisp","38":"SQL","39":"SCM guile","40":"PERL6","41":"ERL","42":"CLPS","43":"ICK","44":"NICE","45":"PRLG","46":"ICON","47":"COB","48":"SCM chicken","49":"PIKE","50":"SCM qobi","51":"ST","52":"SQLQ","53":"NEM"},"max_timelimit":0.5,"source_sizelimit":50000,"problem_author":"utkarsh_adm","problem_tester":"","date_added":"13-08-2021","tags":{"0":"cakewalk","1":"start9","2":"utkarsh_adm"},"problem_difficulty_level":"Unavailable","best_tag":"","editorial_url":"https://discuss.codechef.com/problems/XLSQUARE","time":{"view_start_date":1629221400,"submit_start_date":1629221400,"visible_start_date":1629221400,"end_date":1735669800},"is_direct_submittable":false,"problemDiscussURL":"https://discuss.codechef.com/search?q=XLSQUARE","is_proctored":false,"visitedContests":{},"layout":"problem"}
---
### Read problem statements in [Mandarin Chinese](https://www.codechef.com/download/translated/START9/mandarin/XLSQUARE.pdf) and [Bengali](https://www.codechef.com/download/translated/START9/bengali/XLSQUARE.pdf).
You are given $N$ identical squares, each with side length $A$. All the squares have their sides parallel to the $x-axis$ and $y-axis$. That is, the squares are not tilted. You have to take several (possibly, zero or all) squares and rearrange them to obtain a mega square. The mega square can't have any gap in the enclosed region or have overlapping squares. Also, you cannot rotate any square.
Output the side length of the largest mega square that you can obtain.
<aside style='background: #f8f8f8;padding: 10px 15px;'><div>All submissions for this problem are available.</div></aside>