We need to interpret the problem: There is a box containing some number of bowls total: N (input). Among these, there is an unknown number G (golden bowls) and the rest are bronze bowls. The waiter takes out bowls at random (presumably without replacement) and gives each dish a bowl. Bruce and Robin are the first two to receive bowls. The probability that both receive a golden bowl is exactly 50% (0.5). We need to find G (number of golden bowls) such that:
P(both golden) = (G/N) * ((G-1)/(N-1)) = 1/2.
Given N, we need to find G (positive integer ≤ N) that satisfies:
(G*(G-1)) / (N*(N-1)) = 1/2.
=> 2 * G*(G-1) = N*(N-1).
=> 2G^2 - 2G - N(N-1) = 0.
=> G^2 - G - (N(N-1))/2 = 0.
So G must satisfy the quadratic:
G = [1 ± sqrt(1 + 2N(N-1))]/2.
Since G positive, we take the positive root: G = (1 + sqrt(1 + 2N(N-1)))/2.
But G must be integer, and also 1 <= G <= N.
Thus, for given N, we need to check whether sqrt(D) is integer, where D = 1 + 2N(N-1). Then compute G = (1 + sqrt(D))/2 and check that it's integer. But the problem likely expects that for given N, there is some G that satisfies the condition? Or maybe we need to find the number of golden bowls required for it to be a 50% probability. The sample: N=21, G=15. Check: D = 1 + 22120 = 1 + 2*420 = 1+840=841 = 29^2. Then G = (1+29)/2=15. Yes.
Thus, we need to output G if it exists? But note that the problem statement: "All Robin has to do is now find the number of golden bowls there should be in the box in order for it to be a 50% probability." It says the total number of bowls N is given; we need to compute G. However, is it guaranteed that such an integer G exists for any N? Probably not. The problem might expect that for given N, we compute G that gives the probability closest to 0.5? Or maybe the problem states that Bruce says that there is a 50% chance, so such a G must exist, implying that N must be such that D is a perfect square. But N is given, so maybe we must compute G if it exists; else maybe output something? But not specified. Let's read the problem statement again as provided: "It is lunch time at the Vibrant Gujarat Summit and all the investors are called for the executive lunch. When Bruce reached the lunch area, he found that the waiter was taking out bowls from a big box containing some amount of golden bowls and other bronze bowls. The bowls were taken out at random. Each dish contains exactly one bowl. Bruce and Robin are the first ones to receive the dishes.
Bruce believes that there is a 50/50 chance in everything. He tells Robin that the there is a 50% chance of both of them receiving a golden bowl. Robin is confused and doesn't know how is that possible. He asks Bruce what makes him think so. Bruce says that he would have to find the answer himself and so in order to make things interesting he tells Robin the total number of bowls the waiter has in the box. All Robin has to do is now find the number of golden bowls there should be in the box in order for it to be a 50% probability.
Input:
Only one integer number, N, telling the number of bowls in the box.
Output:
The number of golden bowls required for it to be a 50% probability of both of them receiving a golden bowl.
Constraints:
1 ≤ N ≤ 10^15
SAMPLE INPUT
21
SAMPLE OUTPUT
15"
It seems like there is exactly one correct integer G for each N? But not for every N. For instance, N=3: N(N-1)=6 => D=1+12=13, sqrt=non-integer. So no integer G. But problem expects output? Possibly they only consider N for which it's possible? But not stated.
Maybe the interpretation is: Robin is given N; he must compute G such that the probability that both get golden is exactly 0.5. But if no integer G yields exactly 0.5, maybe we need to output the integer G that makes the probability closest to 0.5? But not specified.
Alternatively, maybe the problem is about solving the equation 2G(G-1)=N(N-1) for integer G given N. Since N is up to 10^15, maybe we need to find G if it exists and perhaps output -1 if not? But the problem statement didn't mention that.
I recall a known problem: Given total number of balls (or bowls) N, find number of blue balls such that probability of drawing two blues in first two draws is 1/2. This leads to Pell's equation: (2G-1)^2 - 2N(N-1) = 1? Actually we have 2G(G-1)=N(N-1). Let X = 2G-1, then G = (X+1)/2. Substitute: 2*((X+1)/2)((X-1)/2) = N(N-1) => ((X+1)(X-1))/2 = N(N-1) => (X^2-1)/2 = N(N-1) => X^2 - 1 = 2N(N-1) => X^2 - 2N(N-1) = 1. But N(N-1) is not a perfect square generally. Better to set Y = 2N-1? Let's check: If we set Y = 2N-1, then N = (Y+1)/2, so N(N-1) = ((Y+1)/2)((Y-1)/2) = (Y^2-1)/4. Then equation becomes: 2G(G-1) = (Y^2-1)/4 => 8G(G-1) = Y^2-1. Not simpler.
Alternatively, let m = N, n = G. Equation: 2n(n-1) = m(m-1). Multiply by 4: 8n(n-1) = 4m(m-1). Complete squares: (2n-1)^2 - 1 = 2[ (2m-1)^2 - 1 ]/2? Let's try: (2n-1)^2 = 4n^2 -4n +1 = 4n(n-1) +1. Similarly, (2m-1)^2 = 4m(m-1)+1. So 4n(n-1) = (2n-1)^2 -1. Then 2n(n-1) = ((2n-1)^2 -1)/2. So equation: ((2n-1)^2 -1)/2 = m(m-1). But also m(m-1) = ((2m-1)^2 -1)/4. So:
((2n-1)^2 -1)/2 = ((2m-1)^2 -1)/4 => Multiply 4: 2((2n-1)^2 -1) = (2m-1)^2 -1 => 2(2n-1)^2 -2 = (2m-1)^2 -1 => 2(2n-1)^2 -1 = (2m-1)^2 => (2m-1)^2 - 2(2n-1)^2 = -1.
Let X = 2m-1, Y = 2n-1. Then we have: X^2 - 2Y^2 = -1. Wait check sign: from above: 2(2n-1)^2 -1 = (2m-1)^2 => rearr: (2m-1)^2 = 2(2n-1)^2 - 1 => 2(2n-1)^2 - (2m-1)^2 = 1. Or X^2 = 2Y^2 - 1 => 2Y^2 - X^2 = 1 => X^2 - 2Y^2 = -1. Yes, that's correct: X^2 - 2Y^2 = -1, where X = 2m-1 (odd), Y = 2n-1 (odd). So we have a negative Pell equation: X^2 - 2Y^2 = -1, with X and Y positive odd integers, and m = (X+1)/2, n = (Y+1)/2.
Alternatively, we could also derive: From 2G(G-1) = N(N-1). Multiply both sides by 4 and add 1: 8G(G-1)+1 = 4N(N-1)+1 => (2N-1)^2? Actually 4N(N-1)+1 = 4N^2-4N+1 = (2N-1)^2. And 8G(G-1)+1 = 8G^2-8G+1. Not a perfect square generally. The previous transformation is correct: Let a = 2G-1, b = 2N-1? Then we had: 2G(G-1) = N(N-1) => 2*( (a+1)/2 * (a-1)/2 ) = ( (b+1)/2 * (b-1)/2 ) => 2 * (a^2-1)/4 = (b^2-1)/4 => (a^2-1)/2 = (b^2-1)/4 => multiply 4: 2(a^2-1) = b^2-1 => 2a^2 -2 = b^2 -1 => b^2 = 2a^2 -1 => b^2 - 2a^2 = -1. So indeed b^2 - 2a^2 = -1, where b = 2N-1, a = 2G-1.
Thus, the condition is that (2N-1)^2 - 2(2G-1)^2 = -1, i.e., (2N-1)^2 = 2(2G-1)^2 - 1? Actually re-check: b^2 = 2a^2 -1 => 2a^2 - b^2 = 1. Let's keep consistent: from 2a^2 - b^2 = 1, then b^2 - 2a^2 = -1.
So N = (b+1)/2, G = (a+1)/2. So for given N, we need to find integer a such that 2a^2 - (2N-1)^2 = 1. This is Pell's equation: (2N-1)^2 - 2a^2 = -1, or equivalently, (2N-1)^2 = 2a^2 - 1. So the condition for existence is that 2N-1 is part of a solution to the Pell equation x^2 - 2y^2 = -1, with x odd? Actually x = 2N-1, y = 2G-1. So for a given N, there is a G if and only if (2N-1) belongs to the sequence of x's from solutions of x^2 - 2y^2 = -1. The fundamental solution of x^2 - 2y^2 = -1 is (x,y) = (1,1) (since 1^2 - 21^2 = -1). All solutions are given by (x_k + y_k sqrt(2)) = (1+ sqrt(2))^{2k-1}? Actually the negative Pell equation x^2 - 2y^2 = -1 has solutions given by (x + y sqrt(2)) = (1 + sqrt(2))^{odd exponent}. More precisely, the fundamental solution to x^2 - 2y^2 = 1 is (3,2) for the positive Pell? Wait: The fundamental solution of x^2 - 2y^2 = 1 is (3,2)? Actually (3^2 - 22^2 = 9-8=1). The minimal positive solution for x^2 - 2y^2 = 1 is (3,2). But for x^2 - 2y^2 = -1, the minimal solution is (1,1). And all solutions to the negative equation are given by (1+√2)^{2k-1} = x_k + y_k √2. For k=1: (1+√2)^1 = 1+√2 => x=1, y=1. For k=2: (1+√2)^3 = (1+√2)^3 = 1+3√2+6+2√2? Actually (1+√2)^2 = 3+2√2; (1+√2)^3 = (3+2√2)(1+√2)=3+3√2+2√2+4 = 7+5√2. So x=7, y=5. For k=3: (1+√2)^5 = (1+√2)^2*(1+√2)^3? Actually exponents 1,3,5,... So the next: (1+√2)^5 = (1+√2)^2*(1+√2)^3 = (3+2√2)*(7+5√2) = 21+15√2+14√2+20 = 41+29√2 => x=41, y=29. So sequence of x: 1,7,41,239,... y:1,5,29,169,...
But here x = 2N-1, y = 2G-1. So N = (x+1)/2, G = (y+1)/2. Since x and y are odd, N and G are integers.
Thus, for a given N, a G exists only if (2N-1) appears in the sequence of x solutions to x^2 - 2y^2 = -1. So not all N. However, the problem statement says "Only one integer number, N, telling the number of bowls in the box. Output: The number of golden bowls required for it to be a 50% probability." It does not say "if possible". Possibly the input N is guaranteed to be such that such a G exists? The sample N=21 yields G=15, indeed 2N-1=41, which is in the sequence: x=41, y=29 => G=(29+1)/2=15. So N=21 corresponds to the third solution (k=3). Similarly, N=3? Check: 2N-1=5 -> is 5 in x sequence? No. So N=3 doesn't yield integer G. But maybe the problem expects that for all N we compute G? Possibly they consider that Bruce's claim means there is such a G, thus N must be from that sequence. So maybe the problem is: given N, find G satisfying the equation; it's guaranteed that such G exists. But the constraints up to 10^15, so we could directly compute using sqrt? Because D = 1+2N(N-1) might be huge but sqrt can be computed exactly if D is perfect square. But we need to handle up to 10^15, N up to 1e15, so N(N-1) up to around 1e30, 2N(N-1) up to 2e30, plus 1, still within 64-bit? 1e30 is about 2^100, far beyond 64-bit. However, many languages support 128-bit integers? Python can handle arbitrary big integers, but the problem might be from a contest that expects C++ with big integers? Possibly they want to use Pell's equation to generate solutions? Let's think: the problem might be to find G for given N, but maybe N is such that D is perfect square. So we can compute sqrt of big integer using Python's integer arithmetic.
But the problem is tagged "Vibrant Gujarat Summit" maybe from CodeChef? I recall a problem "BOWLERS" or something? Not sure.
Alternatively, maybe the problem wants to find the G that gives probability closest to 0.5, not exactly, but output integer G. Or maybe they want the floor or something. But the sample shows exact equality. Typically such problems are about solving the equation exactly, and N is such that there is an integer solution. Could be that N is given arbitrarily, but we need to output G such that the probability is exactly 1/2, but maybe we must find G as an integer approximation? The phrase "required for it to be a 50% probability" suggests there exists such a number.
Given the constraints up to 10^15, we can compute D = 1+2N(N-1) and check if sqrt(D) is integer. But careful: 2N(N-1) may overflow 64-bit: N up to 1e15, N-1 also ~1e15, product ~1e30, times 2 ~2e30, which needs about 100 bits, within 128-bit if using 128-bit integers. In Python, it's fine. In C++, we would need big integers or __int128. So perhaps the problem expects solutions in languages with big integers.
But the Pell perspective suggests that for N that yields a solution, the corresponding G will be less than N, and the ratio G/N will be about 1/√2? Actually from large solutions, G/N approximates 1/√2? Let's see: From equation 2G(G-1) = N(N-1), for large numbers, 2G^2 ≈ N^2 => G ≈ N/√2. Indeed, sample: N=21, G=15, 15/21 ≈ 0.714, while 1/√2 ≈ 0.707. So plausible.
Given the nature, the problem likely expects that we compute G = floor((1+ sqrt(1+2N(N-1)))/2) if sqrt is integer? No, that would only be integer when sqrt is odd? Actually if sqrt is integer, then G is integer (since sqrt(D) must be odd? D = 1+2N(N-1). Since N(N-1) is even (product of two consecutive integers, one even), so 2N(N-1) is divisible by 4? Actually N(N-1) is even, but not necessarily divisible by 4. For N=3, N(N-1)=6, 26=12, D=13, odd. sqrt(13) not integer. For N=4, N(N-1)=12, 212=24, D=25, sqrt=5 (odd). Then G = (1+5)/2=3. So N=4 yields G=3. Check: (3/4)*(2/3)=6/12=0.5. Yes. So N=4 works. So D must be a perfect square. So existence of integer G is exactly D being perfect square.
Thus the problem reduces to: Given N (1 ≤ N ≤ 1e15), output G = (1+ sqrt(1+2N(N-1)))/2 if sqrt is integer; otherwise perhaps output something? But maybe it's guaranteed to be integer. Could be the problem is to find the number of golden bowls such that probability is exactly 1/2, and the input N is such that it's possible. But the problem statement doesn't state this guarantee.
However, typical puzzle: "Bruce believes there is a 50/50 chance that both get golden bowls. Given total number of bowls, find number of golden bowls that makes that true." There might be some N for which there is no integer solution; maybe Bruce's belief is false? But then Robin might need to find that it's impossible? But the instruction says "All Robin has to do is now find the number of golden bowls there should be in the box in order for it to be a 50% probability." It implies there is a solution. So maybe the input will always be a valid N (i.e., such that D is a perfect square). So we can assume that.
Now, note that N up to 10^15. But we need to compute sqrt of huge number (up to about 2e30). Python's integer sqrt (via isqrt from math module) works fine. So solution is straightforward: compute D = 1 + 2N(N-1). Compute s = integer sqrt (using isqrt). Check if s*s == D. If yes, then G = (1+s)//2. Print G.
But wait: Is there any possibility of integer overflow in Python? No.
But consider constraints: 1 ≤ N ≤ 10^15. N(N-1) is up to 10^30, times 2 = 2e30, plus 1 = ~2e30. That's about 100 bits, well within Python's arbitrary precision.
Thus solution is trivial.
But maybe the problem is from a contest that disallows big integers, and they want to use Pell's equation to avoid big numbers? But N is only up to 10^15, so we can use 128-bit integers if available (like __int128). So still manageable.
But the real twist: maybe the problem expects that for any N (even if not perfect square), we should find G that gives the probability exactly 50% as a rational? But that requires G not integer. Since number of golden bowls must be integer, we might need to output the integer G that makes the probability closest to 0.5? But the sample shows exact equality.
Given the sample, it's exact.
Thus I'll assume the input N is such that D is a perfect square.
But wait, the problem says: "Only one integer number, N, telling the number of bowls in the box." It doesn't mention any guarantee. Could it be that the answer is always integer? Let's test for some small N: N=1: probability both golden? If N=1, then there is only one bowl; Bruce gets it, Robin gets none? Actually the problem says Bruce and Robin are the first two to receive bowls, so there must be at least 2 bowls. So N >= 2. For N=2: then equation 2G(G-1) = 21 = 2 => 2G(G-1)=2 => G(G-1)=1 => G^2 - G -1=0 => G not integer. So N=2 no solution. N=3: as above no solution. N=4: solution G=3. N=5: 54=20 => 2G(G-1)=20 => G(G-1)=10 => G≈3.7 not integer. N=6: 65=30 => 2G(G-1)=30 => G(G-1)=15 => G≈? 43=12,54=20, no. N=7: 76=42 => 2G(G-1)=42 => G(G-1)=21 => 43=12,54=20,65=30, no. N=8: 87=56 => G(G-1)=28 => 54=20,65=30, no. N=9: 98=72 => G(G-1)=36 => 65=30,76=42, no. N=10: 109=90 => G(G-1)=45 => 65=30,76=42,87=56, no. N=11: 1110=110 => G(G-1)=55 => 76=42,87=56, so 87=56>55, not integer. N=12: 1211=132 => G(G-1)=66 => 87=56,98=72, no. N=13: 1312=156 => G(G-1)=78 => 87=56,98=72,109=90, no. N=14: 1413=182 => G(G-1)=91 => 98=72,109=90,1110=110, no. N=15: 1514=210 => G(G-1)=105 => 109=90,1110=110, no. N=16: 1615=240 => G(G-1)=120 => 109=90,1110=110,1211=132, no. N=17: 1716=272 => G(G-1)=136 => 1110=110,1211=132,1312=156, no. N=18: 1817=306 => G(G-1)=153 => 1211=132,1312=156, no. N=19: 1918=342 => G(G-1)=171 => 1312=156,1413=182, no. N=20: 2019=380 => G(G-1)=190 => 1312=156,1413=182,1514=210, no. N=21: works. So there are sparse N: N=1? but we need at least 2 bowls? Actually N=0? but N>=1. N=1: probability both golden impossible because Robin can't get a bowl. So N should be >=2. The valid N appear: 4,21,... also maybe 120? Let's check N=120: N(N-1)=120119=14280, 2N(N-1)=28560, D=28561, sqrt=169? 169^2=28561, yes. Then G = (1+169)/2=85. So N=120, G=85. Check: 85/120 * 84/119 = (8584)/(120119) = 7140/14280=0.5. So yes. So there is an infinite set of N where D is a perfect square, given by solutions to Pell equation. So maybe the problem's input N will be from that set. The constraints up to 10^15, there are many such N. So the problem might be to compute G given N assuming it's from the sequence.
But given no mention of "if it exists", we must assume input is valid.
Now, the straightforward solution: compute D and sqrt.
But is there any catch? Possibly the problem wants to avoid computing huge numbers? But Python can.
Alternative approach: use Pell's equation to solve for G directly from N by iterating? But simpler is direct.
Given N up to 1e15, D = 2N(N-1) + 1 could be up to 2*(10^15)*(10^15 -1) + 1 ≈ 2e30, which is a 100-bit number. Python's sqrt via integer methods is O(log n) steps, fine.
Thus, solution code: read integer N, compute D = 2N(N-1) + 1, s = isqrt(D), if s*s != D: maybe print -1? But we assume it matches. Then G = (1+s)//2, print(G).
But hold on: The problem might want to output the number of golden bowls required, not necessarily that G is integer? But we must output integer. So yes.
We should double-check the derivation: Probability both golden = (G/N) * ((G-1)/(N-1)) = G(G-1)/(N(N-1)). Set = 1/2 => 2G(G-1) = N(N-1). That's correct. However, we need to ensure that G and N are such that G <= N, and G >= 2? Actually G can be 1? If G=1, then probability both golden = (1/N)*(0/(N-1))=0, not 1/2. So G>=2. So G>1. So our positive root yields G>1 when sqrt>1, which holds for N>1. For N=1, root gives G= (1+1)/2 =1, but probability is 0 because second draw impossible. So N must be at least 2.
Now, we must consider: For N that satisfies the equation, does G always come out integer? Yes, because we derived that D is a perfect square. So we just need to compute it.
But what if D is perfect square but s is even? Then (1+s) is odd, dividing by 2 yields integer .5? Actually (1+s) will be odd+1 = even if s is odd? Let's check: s from sqrt(D). D = 1+2N(N-1). Since N(N-1) is even, 2N(N-1) is divisible by 4? Actually if N(N-1) is even, say N even then N is even, N-1 odd, product even, but not necessarily divisible by 4. For N=4, N(N-1)=12, which is divisible by 4? 12/4=3, yes divisible by 4. For N=5, N(N-1)=20, divisible by 4? 20/4=5, yes. Actually product of two consecutive integers is always even, but can it be not divisible by 4? Yes, if one is even but not multiple of 4. Example N=2: 21=2 (not divisible by 4). N=3: 32=6 (not divisible by 4). N=4: 43=12 (divisible by 4). N=6: 65=30 (not divisible by 4). So parity: For N mod 4 = 0 or 1? Let's check: If N is multiple of 4, then N is divisible by 4, so product divisible by 4. If N mod 4 = 1, then N-1 mod 4 = 0, so product divisible by 4. If N mod 4 = 2, then N is even but not multiple of 4, and N-1 odd, product is even but not multiple of 4 because the even factor contributes only one factor 2. If N mod 4 = 3, then N odd, N-1 mod 4 = 2, product even with only one factor 2. So N(N-1) is divisible by 2 but not by 4 exactly when N ≡ 2 or 3 mod 4. Then 2N(N-1) is divisible by 4? Multiply by 2 adds a factor 2: So 2N(N-1) will be divisible by 4 if N(N-1) is even, because even * 2 = multiple of 4? Even means at least one factor 2. Multiply by 2 gives at least two factors 2, so yes, 2N(N-1) is always divisible by 4. Check: N=2: N(N-1)=2, 22=4 divisible by 4. N=3: 6? Actually N(N-1)=6, 26=12 divisible by 4. So 2N(N-1) is always multiple of 4. Then D = 1 + multiple of 4. So D ≡ 1 mod 4. A square modulo 4 is either 0 or 1. So D mod 4 =1 is consistent with being a square. But D can be square of an odd number because odd squares ≡1 mod 8? Actually odd square ≡1 mod 8? Let's check: (2k+1)^2=4k(k+1)+1. Since k(k+1) is even, 4even = 8m, so odd squares ≡1 mod 8. D = 1+4k (since 2N(N-1) is divisible by 4). So D ≡ 1 mod 4, but not necessarily 1 mod 8. Example N=4: D=25 ≡1 mod 8? 25 mod8 =1, yes. N=21: D=841 mod8 = 841-800=41, 41 mod8=1, yes. So likely D's square root is odd. Let's see if it's always odd. Suppose s^2 = 1+4M. Then s^2 ≡1 mod 4 => s is odd. So s is odd. Then (1+s) is even, so G integer. So all good.
Thus solution stands.
Now, there might be a twist: The problem might be trick: "Bruce believes that there is a 50/50 chance in everything." Could it be that the probability is exactly 50% but there might be two possibilities? But we derived only one positive G.
Thus I'm confident.
But just to be safe, let's examine the wording: "Bruce tells Robin that there is a 50% chance of both of them receiving a golden bowl." Bruce says that it is a 50/50 chance. Then he gives the total number of bowls. Robin has to find the number of golden bowls required for it to be a 50% probability. So the answer is uniquely determined by N if possible. So we compute G.
Given sample: input 21 output 15. So correct.
Thus we can write code in Python:
def solve():
import sys, math
N = int(sys.stdin.readline().strip())
# Compute D = 1 + 2N(N-1)
# Use Python's big ints
D = 1 + 2 * N * (N - 1)
s = math.isqrt(D) # Python 3.8+ has math.isqrt
# If s*s != D, maybe no solution; but we assume solution exists.
# However, for safety we can check and if not, maybe compute G as floor? But sample expects exact.
# Since we assume valid input, just compute.
G = (1 + s) // 2
print(G)
But we must be cautious: math.isqrt returns floor of sqrt. If D is perfect square, it's exact. So fine.
Now, constraints up to 10^15: Python int can handle.
But is there any possibility of integer overflow? Not in Python.
Now, consider time complexity: O(1) for arithmetic operations, but multiplication of large integers (100 bits) is trivial.
Thus the solution seems trivial.
But maybe the problem originally expects to solve Pell's equation because N might be huge? But N max 10^15 is not huge for big ints.
Alternatively, maybe the problem is from a contest that expects output for multiple test cases? The statement says only one integer number N, so single test case.
Thus, it's simple.
But wait, there is another nuance: The bowls are taken out at random, each dish contains exactly one bowl. Bruce and Robin are the first ones to receive the dishes. So they are the first two draws. The probability is as we used. So fine.
Thus answer: compute G as above.
But let's ensure we have to output integer. Possibly if there are two solutions? Quadratic yields two roots: (1 ± sqrt(D))/2. The minus root gives (1 - sqrt(D))/2, which for positive sqrt>1 is negative, so not valid.
Thus unique.
Now, can we derive a formula directly? Not needed.
One more thing: In the problem, maybe Bruce says that there is a 50% chance of both receiving golden bowls, but he doesn't know G. He gives N. Robin must compute G. So indeed.
Thus final solution.
However, I'm slightly concerned: The problem statement says "Output: The number of golden bowls required for it to be a 50% probability of both of them receiving a golden bowl." It doesn't say "if such exists", but from Bruce's claim, it does.
Thus I'll produce Python solution using math.isqrt.
But there might be an alternative approach using Pell to generate all solutions up to 10^15, but not needed.
Now, consider edge cases: N=1? But bowls must be at least 2 because two people. But constraint says 1 ≤ N ≤ 10^15. Might include N=1. For N=1, probability both golden is impossible because Robin gets no bowl? But maybe they still consider both get bowls? But if only one bowl, can't give to both. So perhaps N>=2. But if N=1, our formula D=1+0=1, s=1, G=1. But probability both golden: first gets golden (1/1=1), second? there is no second bowl; maybe probability undefined. So likely N>=2.
Thus we can ignore N=1, though if input is 1, output 1 would be weird but maybe they don't test.
Now, test with N=4: output 3.
Now, test with N=120: output 85.
Now, is there any case where sqrt(D) is integer but G computed as (1+s)/2 is not integer? As argued, s odd => integer. But could s be even? Suppose D is square, s even. Then s^2 ≡ 0 mod 4. But D = 1 + 2N(N-1) ≡ 1 mod 4 always (since 2N(N-1) multiple of 4). So D ≡ 1 mod 4, so s^2 ≡ 1 mod 4, thus s is odd. So s odd always. So G integer.
Thus fine.
Thus code is simple.
But maybe the problem expects to compute G without using sqrt due to large numbers? However, Python's sqrt via isqrt is exact and efficient.
Now, I'll produce final answer in the required format.
Given the typical CodeChef style, we might need to handle multiple test cases? The statement says only one integer. So single.
Therefore, I'll output the solution.
But wait, the problem might be from hackerrank or something, where multiple testcases are hidden. Could be. Usually there is T number of test cases. But not stated. Might be just one.
I'll write code that reads one integer and prints G.
Now, we must also consider performance: computing N*(N-1) may be large but fine.
Thus final code:
import sys, math
def main():
data = sys.stdin.read().strip().split()
if not data: return
N = int(data[0])
# If N == 1, handle? But likely N>=2.
D = 1 + 2 * N * (N - 1)
s = math.isqrt(D)
# Check if s*s == D, if not, maybe output something? But we assume.
G = (1 + s) // 2
print(G)
if name == "main":
main()
That's it.
Now, we should also consider potential floating point errors if using sqrt from math.sqrt; but we use integer sqrt.
Thus final.
But wait, there is an alternative approach: Could there be more than one G? Since equation is quadratic, only one positive solution. So fine.
Thus solution is trivial.
But the problem is tagged as a puzzle; maybe they want to find integer solutions to 2G(G-1)=N(N-1). Since N is given, we compute G. So.
Now, I'll produce final answer accordingly.
But is there any hidden trick about the probability? Could it be that the bowls are taken out at random and each dish contains exactly one bowl. Bruce and Robin are the first ones to receive the dishes. So they are drawn without replacement. So our probability is correct.
Thus final.
Given the context of the conversation: "Bruce believes that there is a 50/50 chance in everything. He tells Robin that the there is a 50% chance of both of them receiving a golden bowl. Robin is confused and doesn't know how is that possible. He asks Bruce what makes him think so. Bruce says that he would have to find the answer himself and so in order to make things interesting he tells Robin the total number of bowls the waiter has in the box. All Robin has to do is now find the number of golden bowls there should be in the box in order for it to be a 50% probability."
Thus yes.
Now, I'll produce the answer.
```python
import sys
import math
def main() -> None:
data = sys.stdin.read().strip().split()
if not data:
return
N = int(data[0])
# D = 1 + 2N(N-1)
D = 1 + 2 * N * (N - 1)
s = math.isqrt(D) # integer square root
# By the problem statement D is always a perfect square,
# so s*s == D and s is odd.
G = (1 + s) // 2
print(G)
if name == "main":
main()