{"problem":{"name":"Worst Case","description":{"content":"$10^{10^{10}}$ participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through $10^{10^{10}}$\\-th. The _score_ of a par","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc094_b"},"statements":[{"statement_type":"Markdown","content":"$10^{10^{10}}$ participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through $10^{10^{10}}$\\-th.\nThe _score_ of a participant is the product of his/her ranks in the two contests.\nProcess the following $Q$ queries:\n\n*   In the $i$\\-th query, you are given two positive integers $A_i$ and $B_i$. Assuming that Takahashi was ranked $A_i$\\-th in the first contest and $B_i$\\-th in the second contest, find the maximum possible number of participants whose scores are smaller than Takahashi's.\n\n## Constraints\n\n*   $1 \\leq Q \\leq 100$\n*   $1\\leq A_i,B_i\\leq 10^9(1\\leq i\\leq Q)$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$Q$\n$A_1$ $B_1$\n$:$\n$A_Q$ $B_Q$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc094_b","tags":[],"sample_group":[["8\n1 4\n10 5\n3 3\n4 11\n8 9\n22 40\n8 36\n314159265 358979323","1\n12\n4\n11\n14\n57\n31\n671644785\n\nLet us denote a participant who was ranked $x$\\-th in the first contest and $y$\\-th in the second contest as $(x,y)$.\nIn the first query, $(2,1)$ is a possible candidate of a participant whose score is smaller than Takahashi's. There are never two or more participants whose scores are smaller than Takahashi's, so we should print $1$."]],"created_at":"2026-03-03 11:01:14"}}