description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
class CodeforcesTask108BSolution: def __init__(self): self.result = "" self.n = 0 self.bases = [] def read_input(self): self.n = int(input()) self.bases = [int(x) for x in input().split(" ")] def process_task(self): self.bases = list(set(self.bases)) ...
CLASS_DEF FUNC_DEF ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VA...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) l = list(map(int, input().split())) l.sort() done = 0 for i in range(n - 1): if l[i] < l[i + 1] and 2 * l[i] > l[i + 1]: done = 1 break if done == 1: print("YES") else: print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EX...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) flag = True a = list(map(int, input().split())) a.sort() for x in range(1, len(a)): if a[x] < 2 * a[x - 1] and a[x] != a[x - 1]: print("YES") flag = False break if flag: print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR EX...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) a = list(map(int, input().split())) a = set(a) a = sorted(a) for i in range(len(a) - 1): if a[i] + a[i] > a[i + 1]: print("YES") exit(0) print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EX...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) l = [int(x) for x in input().split()] l = list(set(l)) flag = 0 l.sort() for i in range(len(l) - 1): if l[i + 1] < 2 * l[i]: flag = 1 print("YES") break if not flag: print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR STRING...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
input() b = sorted(list({int(x) for x in input().split()})) for i in range(1, len(b)): if 2 * b[i - 1] > b[i]: print("YES") break else: print("NO")
EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) array = list(map(int, input().split(" "))) array = list(set(array)) array.sort() flag = False for i in range(len(array) - 1): if 2 * array[i] > array[i + 1]: flag = True break if flag: print("YES") else: print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF BIN_OP NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF VAR E...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
x = int(input()) a = list(map(int, input().split())) a.sort() f = 0 for i in range(1, x): if a[i] < 2 * a[i - 1] and a[i] != a[i - 1]: f = 1 break j = a[0] if len(set(a)) == 1 and j == 1: f = 0 if f: print("YES") else: print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR FUNC_CALL ...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) a = list(map(int, input().split())) a.sort() for i in range(1, len(a)): f, s = a[i - 1], a[i] if f == s: continue if f != 1: f *= 2 if f > s: print("YES") exit() print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR NUMBER VAR VAR IF VAR VAR IF VAR NUMBER VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR EXPR FUNC_C...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) a = sorted(list(map(int, input().split()))) ok = True for i in range(1, len(a)): if a[i] != a[i - 1] and a[i - 1] * 2 > a[i]: ok = False break print("NO" if ok else "YES")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR STRING STRING
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n, t = int(input()) - 1, sorted(list(map(int, input().split()))) print("YNEOS"[all(2 * t[i] <= t[i + 1] for i in range(n) if t[i] < t[i + 1]) :: 2])
ASSIGN VAR VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR STRING FUNC_CALL VAR BIN_OP NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
I = input R = range(int(I()) - 1) a = sorted(map(int, I().split())) s = "NO" for i in R: if a[i] < a[i + 1] and a[i] * 2 > a[i + 1]: s = "YES" print(s)
ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING FOR VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR STRING EXPR FUNC_CALL VAR VAR
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) A = sorted(list(set(map(int, input().split())))) good = True for i in range(1, len(A)): if A[i - 1] * 2 > A[i]: good = False if not good: print("YES") else: print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRI...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
from sys import * n = int(stdin.readline()) a = [int(z) for z in stdin.readline().split()] a.sort() na = [a[0]] for i in a: if i > na[-1]: na.append(i) for i in range(1, len(na)): if na[i] < 2 * na[i - 1]: stdout.write("YES\n") exit(0) stdout.write("NO\n")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER FOR VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR ...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) a = [int(x) for x in input().split()] a.sort() ans = "NO" for i in range(1, n): if a[i] < 2 * a[i - 1] and a[i] != a[i - 1]: ans = "YES" break print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR STRING EXPR FUNC_CALL VAR VAR
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) lst = list(map(int, input().strip().split(" "))) lst.sort() f = 0 for j in range(1, n): if lst[j] < 2 * lst[j - 1] and lst[j] != lst[j - 1]: f = 1 print("YES") break if f == 0: print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR...
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
from sys import exit n = int(input()) lst = [*set(map(int, input().split()))] lst.sort() for i, x in enumerate(lst[:-1]): if x * 2 > lst[i + 1]: from sys import exit print("YES") exit() print("NO")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR STRING
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
def s(): input() a = list(map(int, input().split())) a.sort() for i in range(1, len(a)): if a[i] != a[i - 1] and a[i] < a[i - 1] * 2: return "YES" return "NO" print(s())
FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER RETURN STRING RETURN STRING EXPR FUNC_CALL VAR FUNC_CALL VAR
Tattah's youngest brother, Tuftuf, is new to programming. Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava. Today, Tuftuf was introduced to Gava's unsigned integer datatypes. G...
n = int(input()) A = list(map(int, input().split())) A.sort() per = 0 per2 = True while per < n - 1: if A[per] < A[per + 1]: if A[per + 1] < A[per] * 2: per2 = False break else: per += 1 else: per += 1 if per2: print("NO") else: print("YES")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER IF VAR EXPR...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
_ = int(input()) for T in range(_): h, c, t = [int(x) for x in input().split()] if t <= (h + c) / 2: print(2) continue x = (t - c) // (2 * t - h - c) v1 = x * h + (x - 1) * c v2 = (x + 1) * h + x * c if abs(v1 - (2 * x - 1) * t) / (2 * x - 1) <= abs(t * (2 * x + 1) - v2) / ( ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMB...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
eps = 1e-10 t = int(input()) for _ in range(t): h, c, t = map(int, input().split()) l = 0 r = 100000000 while l + 1 < r: mid = (l + r) // 2 if mid % 2 == 0: if mid + 1 < r: mid += 1 elif mid - 1 > l: mid -= 1 else: ...
ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR VAR NUMBER IF BIN_O...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for _ in range(int(input())): a, b, c = map(int, input().split()) mid = (a + b) / 2 if c == a: print(1) elif c <= mid: print(2) elif c >= mid + (a - b) / 6 and c < a: d = mid + (a - b) / 6 if abs(d - c) < abs(a - c): print(3) else: prin...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def check(h, c, t, n): return (n + 1) * h + n * c >= (2 * n + 1) * t def binsearch(h, c, t): left = 0 right = 1000000000 while right - left > 1: mid = (right + left) // 2 if check(h, c, t, mid): left = mid else: right = mid if check(h, c, t, right): ...
FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR IF FUNC_CALL VAR VAR VAR VAR VAR R...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for _ in range(int(input())): h, c, t = map(int, input().split()) if h + c >= t * 2: print(2) elif h <= t: print(1) else: k = (h - t) // (t * 2 - h - c) x = k * k * 2 + k * 5 y = k * k * 2 + k * 3 if (x + 3 + x + 2) * h + (y + y + 1) * c > 2 * (4 * k * k +...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR V...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def f(x): return abs(((x - 1) * (c + h) + h) / (2 * x - 1) - temp) t = int(input()) for you in range(t): l = input().split() h = int(l[0]) c = int(l[1]) temp = int(l[2]) if temp <= (c + h) / 2: print(2) elif temp >= h: print(1) else: poss = int((temp - c) / (2 *...
FUNC_DEF RETURN FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_C...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys reader = (s.rstrip() for s in sys.stdin) input = reader.__next__ def gift(): for _ in range(t): h, c, tem = list(map(int, input().split())) if h == tem: yield 1 elif (h + c) / 2 > tem: mid = (h + c) / 2 edif = abs(h - c) ldif = ab...
IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for _ in range(int(input())): h, c, t = map(int, input().split()) if h == t: print(1) elif t - c <= h - t: print(2) else: temp = (t - h) / (h + c - 2 * t) if int(temp) == temp: print(int(2 * temp + 1)) else: a = int(temp) b = a ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for tt in range(int(input())): h, c, t = map(int, input().split()) if t <= (h + c) // 2: print(2) else: num = int((t - h) / (h + c - 2 * t)) num = 2 * num + 1 if num % 2: op1 = num op2 = num + 2 c1 = abs((op1 // 2 + 1) * h + op1 // 2 * c - ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER IF BIN_OP VAR NUM...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
(T,) = map(int, input().split()) def f(h, c, n): return (h * (n + 1) + c * n) / (2 * n + 1) def B(h, c, n): return 2 * n + 1 def C(h, c, n): return h * (n + 1) + c * n def H(h, c, t, n): return ( 2 * t * B(h, c, n) * B(h, c, n + 1) - C(h, c, n + 1) * B(h, c, n) - C(h, c, ...
ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER FUNC_DEF RETURN BIN_OP BIN_OP NUMBER VAR NUMBER FUNC_DEF RETURN BIN_OP BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP BIN_OP BI...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def solve(): h, c, t = [int(x) for x in input().split()] if h == c: print(1) elif t >= h: print(1) elif 2 * t <= h + c: print(2) else: ans = (h - c) // (2 * t - h - c) if ans % 2 == 0: ans += 1 variants = [] variants.append(ans) ...
FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBE...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for _ in range(int(input())): a, b, c = map(int, input().split()) mid = (a + b) / 2 if c == a: print(1) elif c <= mid: print(2) elif c >= mid + (a - b) / 6 and c < a: d = mid + (a - b) / 6 if abs(d - c) < abs(a - c): print(3) else: prin...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def rs(): return input().strip() def ri(): return int(input()) def ria(): return list(map(int, input().split())) def ia_to_s(a): return " ".join([str(s) for s in a]) def temp_at_2k_1(h, c, k): return k * h + (k - 1) * c, 2 * k - 1 def solve(h, c, t): if t <= (h + c) // 2: retur...
FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER FUNC_D...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for _ in range(int(input())): h, c, t = map(int, input().split()) if h <= t: print(1) continue if h + c >= t * 2: print(2) continue lo = 1 hi = 10**10 while lo < hi: mid = (lo + hi + 1) // 2 totTemp = mid * h + (mid - 1) * c if totTemp // (...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys def input(): return sys.stdin.readline().rstrip() def gcd(a, b): a, b = min(a, b), max(a, b) if a == 0: return b else: return gcd(b % a, a) class pos_rational: def __init__(self, a, b): self.numerator = a self.denominator = b def __eq__(self, ot...
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR RETURN VAR NUMBER FUNC_DEF ASSIGN ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
tests = int(input()) for _ in range(tests): h, c, t = map(int, input().split()) if t == h: print(1) continue if t <= (h + c) / 2: print(2) continue target = t - (h + c) / 2 dif = h - c tmp = int(dif // (2 * target)) if tmp <= 0: tmp = 1 if tmp % 2 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CA...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
q = int(input()) for _ in range(q): h, c, t = map(int, input().split()) if 2 * t <= h + c: print(2) continue l = 1 r = 10**20 while r - l > 1: m = (r + l) // 2 if m * h + (m - 1) * c >= t * (2 * m - 1): l = m else: r = m a = l b...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP BIN_...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
t = int(input()) ans = [0] * t for i in range(t): h, c, obj = map(int, input().split()) ave = (h + c) / 2 if obj <= ave: ans[i] = 2 else: x = obj - ave y = (h - c) / 2 z = y // x if z % 2 == 0: z -= 1 temp0 = abs(obj - ave - y / z) temp...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def solver(h, c, t): if h + c >= 2 * t: return 2 elif h == t: return 1 else: x = (t - c) // (2 * t - h - c) k1, k2 = abs((2 * x - 1) * t - ((h + c) * x - c)) * (2 * x + 1), abs( t * (2 * x + 1) - ((h + c) * x + h) ) * (2 * x - 1) z = 2 * x + 1 if k...
FUNC_DEF IF BIN_OP VAR VAR BIN_OP NUMBER VAR RETURN NUMBER IF VAR VAR RETURN NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP F...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for _ in range(int(input())): p = 0 a, b, c = map(int, input().split()) d = [] h = 0 t = 0 e = [] if a <= c and b <= c: print(1) elif 2 * c - a - b <= 0: print(2) else: k = (a - c) // (2 * c - a - b) if abs(k * (a + b) + a - c * (2 * k + 1)) * (2 * k +...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST IF VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER AS...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
numcases = int(input()) for _ in range(numcases): h, c, t = map(int, input().split()) ans = 0 minc = float("inf") if h + c != t * 2: diff = t - h change_diff = t * 2 - (h + c) if diff > 0 and change_diff < 0 or diff < 0 and change_diff > 0: mindiff = abs(diff) // abs(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING IF BIN_OP VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR VAR IF VAR NUMBER VAR NUMBER VAR NU...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def solve(th, tc, t): ans = 0 if th == t: ans = 1 elif 2 * t <= th + tc: ans = 2 else: k = (th - tc) / (2 * t - th - tc) if (th - tc) % (2 * t - th - tc) == 0: if k % 2 == 0: ans = int(k) + 1 else: ans = int(k) ...
FUNC_DEF ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER IF BIN_OP NUMBER VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR IF BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR N...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys input = sys.stdin.readline t = int(input()) for _ in range(t): h, c, temp = map(int, input().split()) ave_temp = (h + c) / 2 if temp <= ave_temp: print(2) elif h == temp: print(1) else: u = (h - c) / ((temp - ave_temp) * 2) u_l = int(u) if int(u) %...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUM...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
from sys import stdin input = stdin.readline for _ in range(int(input())): h, c, t = map(int, input().split()) if t >= h: print(1) continue if 2 * t <= h + c: print(2) continue l, r = 1, 1000000000 while l < r: m = l + r >> 1 if m * h + (m - 1) * c > ...
ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP BI...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
t = int(input()) for _ in range(t): h, c, t = map(int, input().split()) avg = (h + c) / 2 if t == h: print(1) continue if avg >= t: print(2) continue else: n1 = int((t - c) / (2 * t - h - c)) n2 = 2 * t * (2 * n1 - 1) * (2 * n1 + 1) n3 = ((n1 -...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR V...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
t = int(input()) for i in range(t): h, c, t = map(int, input().split()) x = t - (h + c) / 2 if x <= 0: print(2) else: n = (h - c) // (2 * t - h - c) if n % 2 == 0: if abs(x - (h - c) / (2 * (n + 1))) > abs(x - (h - c) / (2 * (n + 3))): print(n + 3) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER IF...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
t = int(input()) for _ in range(t): h, c, t = list(map(int, input().split())) av = (h + c) / 2 if h == c: print(1) elif t <= av: print(2) else: d = (t - av) / (h - av) k = -(-(h - av) // (t - av)) if k == (h - av) / (t - av): k += 1 if k % ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
from sys import stdin for _ in range(int(stdin.readline())): h, c, t = map(int, stdin.readline().split()) if t >= h: print(1) continue if t <= (h + c) / 2: print(2) continue n = 1 / (1 - 2 * ((h - t) / (h - c))) x = round(n) if x % 2 == 0: y = x - 1 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER BIN_OP NUMBER BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
tt = int(input()) while tt: h, c, t = map(int, input().split()) if h == t: print(1) elif t <= (h + c) / 2: print(2) else: k = (t - c - 1) // (2 * t - h - c) ans = 2 * k + 1 if (4 * k * k - 1) * (2 * t - h - c) >= 2 * (h - c) * k: ans -= 2 print...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def abc(i, j, c): global a, b ans = i while i <= j: mid = i + (j - i) // 2 if mid * b + (mid + 1) * a <= c * (2 * mid + 1): ans = mid i = mid + 1 else: j = mid - 1 return ans def bca(i, j, c): global a, b ans = i while i <= j: ...
FUNC_DEF ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR B...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def getCups(h, c, t, x): x = round(x) minDiff = 100000000000, 1 cups = -100 for i in range(int(x) - 1 - 2, int(x) + 2 + 2): if i % 2 == 1: v = h * ((i + 1) / 2) + c * ((i - 1) / 2), i else: v = (h + c) / 2, 1 diff = abs(v[0] - t * i), i if diff[0] ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP VAR BIN_OP BIN_OP VAR NUMBER ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
from sys import stdin input = stdin.buffer.readline for _ in range(int(input())): h, c, t = map(int, input().split()) d = abs((t << 1) - h - c) ans = 2 l, r = 0, 1000000 while r - l > 1: mid = l + r >> 1 if (h + c) * mid + h < t * (mid << 1 | 1): r = mid else: ...
ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP BIN_...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
ans = [] for _ in range(int(input())): h, c, t = map(int, input().split()) if h + c - 2 * t >= 0: ans.append(2) continue a1 = int((t - c) / (2 * t - h - c)) b1 = a1 - 1 a2 = int((t - c) / (2 * t - h - c)) + 1 b2 = a2 - 1 dt1 = abs(t * (a1 + b1) - (a1 * h + b1 * c)) * (a2 + b2...
ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER A...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys sys.setrecursionlimit(10**5) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [...
IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
cases = int(input()) for _ in range(cases): hot, cold, target = map(int, input().split()) if 2 * target <= hot + cold: print(2) elif target >= hot: print(1) else: lo, hi = 1, 10**20 while lo < hi: mid = (lo + 1 + hi) // 2 if mid * hot + (mid - 1) *...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP NUMBER NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NU...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def solve(h, c, t): if t == h: return 1 if 2 * t <= h + c: return 2 cands = [] cands.append((h + c, 2, 2)) bx = h - t by = 2 * t - h - c b = bx // by for d in range(2): bb = b + d aa = bb + 1 cands.append((aa * h + bb * c, aa + bb, aa + bb)) an...
FUNC_DEF IF VAR VAR RETURN NUMBER IF BIN_OP NUMBER VAR BIN_OP VAR VAR RETURN NUMBER ASSIGN VAR LIST EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
T = int(input()) for _ in range(T): h, c, t = map(int, input().split()) s = (h + c) / 2 if s >= t: print(2) continue s = t - s a = (h - c) / (2 * s) k = int((a + 1) // 2) if (h - c) / (4 * k - 2) - s <= s - (h - c) / (4 * k + 2): print(2 * k - 1) else: pri...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP V...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for _ in range(int(input())): h, c, t = [int(i) for i in input().split()] if t <= (h + c) / 2: print(2) else: l = 1 r = 10**12 mid = (l + h) / 2 while l < r: mid = (l + r) // 2 sum = (h * mid + c * (mid - 1)) / (2 * mid - 1) if sum ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys pprint = lambda s: print(" ".join(map(str, s))) input = lambda: sys.stdin.readline().strip() ipnut = input for i in range(int(input())): h, c, t = map(int, input().split()) if t <= (h + c) / 2: print(2) continue l = 1 r = 1000000000000000000 def f(m): return m * ...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN V...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def calc(a, b, t, k): num1, num2 = abs(k * (a + b) + a - (2 * k + 1) * t), abs( (k + 1) * (a + b) + a - (2 * k + 3) * t ) den1, den2 = 2 * k + 1, 2 * k + 3 if num1 * den2 <= num2 * den1: return 2 * k + 1 return 2 * k + 3 t = int(input()) for _ in range(t): a, b, t = map(int, in...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR ASSIGN VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER I...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
from sys import stdin input = stdin.readline INF = 10**9 + 7 MAX = 10**7 + 7 MOD = 10**9 + 7 for Ti in range(int(input().strip())): h, c, t = [int(x) for x in input().strip().split()] avg = (h + c) / 2 if t <= avg: print("2") continue ti = (t - h) // (h + c - 2 * t) l = (2 * ti + 3)...
ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys input = sys.stdin.buffer.readline nTests = int(input()) for _ in range(nTests): h, c, t = [int(zz) for zz in input().split()] if t <= (h + c) / 2: print(2) elif t == h: print(1) else: nHot = (t - c) // (2 * t - h - c) x = nHot den1 = 2 * x - 1 ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
from sys import stdin, stdout input = stdin.readline def print(x): stdout.write(str(x) + "\n") def solve(): h, c, t = map(int, input().split()) if t <= (h + c) / 2: print(2) else: k = (h - t) // (2 * t - h - c) k = 2 * k + 1 c1 = (k // 2 + 1) * h + k // 2 * c - t * k...
ASSIGN VAR VAR FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMB...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def f(h, c, t, x): n = x * 2 + 1 return abs(h * (x + 1) + c * x - t * n) for _ in range(int(input())): h, c, t = map(int, input().split()) if h + c >= t * 2: print(2) continue if h <= t: print(1) continue ans1 = (h - t) // (2 * t - h - c) ans2 = ans1 + 1 ...
FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER RETURN FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER I...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys input = sys.stdin.readline t = int(input()) for _ in range(t): h, c, t = map(int, input().split()) if t * 2 <= h + c: print(2) continue f = lambda x: x * h + (x - 1) * c ok = 1 ng = 10**6 while abs(ok - ng) > 1: mid = (ok + ng) // 2 if f(mid) >= t * (m...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBE...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
try: for _ in range(int(input())): h, c, t = map(int, input().split()) if h <= t: print(1) elif h + c >= 2 * t: print(2) else: x = int((c - t) / (h + c - 2 * t)) m = abs((x * (h + c - 2 * t) + t - c) / (2 * x - 1)) n = abs((...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VA...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
tt = int(input()) for _ in range(tt): h, c, t = list(map(int, input().split(" "))) if t >= h: print(1) elif t <= (c + h) / 2: print(2) else: n = (t - c) / (2 * t - h - c) m = int(n) + 1 nn = int(n) e = nn * h + (nn - 1) * c - t * (2 * nn - 1) ee = ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR A...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys q = int(input()) for i in range(q): h, c, t = [int(j) for j in sys.stdin.readline().split()] if t == h: print(1) elif t <= (h + c) / 2: print(2) else: first = (h + c) / t first1 = (h + c) / 2 second = (h - t) // (2 * t - h - c) if second == sec...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
t = int(input()) for i in range(t): s = input().split() h = int(s[0]) c = int(s[1]) te = int(s[2]) if te == h: print("1") elif h - te == te - c: print("2") else: sum = c + h if h - te > te - c: print("2") else: a = h - te ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_O...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
T = int(input()) o = [] for i in range(T): h, c, t = input().split() h = int(h) c = int(c) t = int(t) s = (h + c) / 2 if t >= h: o.append(1) elif t <= s: o.append(2) else: i = (h - t) / (2 * t - (h + c)) if i == int(i): i = int(i) o...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NU...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
T = int(input()) for _ in range(T): h, c, t = map(int, input().split()) if h <= t: print(1) elif t <= (h + c) // 2: print(2) else: i1 = (t - h) // (h + c - 2 * t) i2 = i1 + 1 if ((i1 + 1) * h + i1 * c) * (2 * i2 + 1) + ((i2 + 1) * h + i2 * c) * ( 2 * i...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def solve(h, c, t): if t >= h: return 1 if 2 * t <= h + c: return 2 if (h - t) % (2 * t - h - c) == 0: return 2 * (h - t) // (2 * t - h - c) + 1 nn1 = int((h - t) / (2 * t - h - c)) nn2 = nn1 + 1 if (t * (2 * nn2 + 1) - nn2 * (h + c) - h) * (2 * nn1 + 1) - ( nn1 *...
FUNC_DEF IF VAR VAR RETURN NUMBER IF BIN_OP NUMBER VAR BIN_OP VAR VAR RETURN NUMBER IF BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP NUMBER BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
t = int(input()) for test in range(t): h, c, t = map(int, input().split(" ")) t -= c h -= c if t <= h / 2: print(2) else: res = int(h / (2 * t - h) / 2) if abs(t - (res + 1) * h / (2 * res + 1)) > abs( t - (res + 2) * h / (2 * res + 3) ): print...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING VAR VAR VAR VAR IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP NUMBER VAR VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR BIN_OP BIN_OP...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
from sys import stdin input = stdin.readline q = int(input()) for _ in range(q): h, c, t = map(int, input().split()) if 2 * t <= h + c: print(2) else: t *= 2 h *= 2 c *= 2 w = h // 2 - c // 2 pod = (h + c) // 2 goal = t - pod if goal == 0: ...
ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR V...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
t = int(input()) for i in range(0, t): s = input().split() h = int(s[0]) c = int(s[1]) t = int(s[2]) if h + c == t * 2: print(2) else: x = (t - h) / (h + c - t * 2) l = int(x) r = l + 1 al = abs(h * (l + 1) + c * l - t * (2 * l + 1)) * (2 * r + 1) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for _ in range(int(input())): h, c, t = map(int, input().split()) if h == t: print(1) else: avg = (h + c) / 2 if avg == t: print(2) elif avg > t: print(2) else: dif = t - avg j = int(abs((c - h) // (2 * dif))) ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CA...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys input = sys.stdin.buffer.readline def print(val): sys.stdout.write(str(val) + "\n") def temp(x, t, h, c): return abs((t * (2 * x + 1) - ((x + 1) * h + x * c)) / (2 * x + 1)) def prog(): for _ in range(int(input())): h, c, t = map(int, input().split()) if t <= (h + c) / 2: ...
IMPORT ASSIGN VAR VAR FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VA...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def f(h: int, c: int, t: int) -> int: if h + c >= t * 2: return 2 else: x = (h - t) // (t * 2 - h - c) lhs = (h * (x + 1) + x * c) * (x * 2 + 3) - t * (x * 2 + 1) * (x * 2 + 3) rhs = t * (x * 2 + 1) * (x * 2 + 3) - (h * (x + 2) + (x + 1) * c) * (x * 2 + 1) if lhs <= rhs: ...
FUNC_DEF VAR VAR VAR IF BIN_OP VAR VAR BIN_OP VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP VAR ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for test_ in range(int(input())): h, c, t = map(int, input().split()) if t <= (h + c) // 2: print(2) else: t -= (h + c) / 2 t1 = (h - c) / 2 / t x1, x2 = int((t1 - 1) // 2 * 2 + 1), int((t1 + 1) // 2 * 2 + 1) if (h - c) / (x1 * 2) - t <= t - (h - c) / (x2 * 2): ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NU...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def temp(h, c, cups, k): if cups % 2 == 0: return (h + c) // 2 n = cups // 2 return abs((h + c) * n + h - k * cups), cups def lessthanore(a, b): return a[0] * b[1] <= a[1] * b[0] def check(n, k, h, c): correct = abs(temp(h, c, 2 * n + 1) - k) before = abs(temp(h, c, 2 * n - 1) - k) ...
FUNC_DEF IF BIN_OP VAR NUMBER NUMBER RETURN BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR FUNC_DEF RETURN BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR V...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys input = sys.stdin.readline T = int(input()) def solve(h, c, t, x): if h * x + c * (x - 1) > t * (2 * x - 1): return True else: return False for _ in range(T): h, c, t = [int(x) for x in input().split()] left = 1 right = 10**20 while right - left > 1: mid =...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF BIN_OP BIN_OP VAR VAR BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_O...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for _ in range(int(input())): a, b, c = map(int, input().split()) if a == c: print(1) continue if (a + b) / 2 == c: print(2) continue temp = -1 l = 2 r = c + 1 x = 2 while l < r: mid = (l + r) // 2 if (mid * a + (mid - 1) * b) / (2 * mid - ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BI...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def solve(): h, c, t = map(int, input().split()) if h == t: result = 1 elif t <= (h + c) / 2: result = 2 else: k = (t - c - 1) // (2 * t - h - c) result = 2 * k + 1 result -= 2 if (4 * k * k - 1) * (2 * t - h - c) >= 2 * (h - c) * k else 0 print(result) def ...
FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP BIN_OP BIN_OP BIN_OP NUMBE...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for test in range(int(input())): h, c, t = map(int, input().split()) if h == t: print(1) elif t <= (h + c) / 2: print(2) elif abs(t - h) <= abs(t - (2 * h + c) / 3): print(1) else: x = (h - t) // (2 * t - h - c) y = x + 1 dif2 = abs((2 * y + 1) * t - y...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def f(h, c, t): if t <= (c + h) / 2: return 2 if t >= h: return 1 x = (t - c) // (2 * t - h - c) if (4 * x * x + 2 * x - 1) * h + (4 * x * x - 2 * x - 1) * c <= 2 * ( 4 * x * x - 1 ) * t: return 2 * x - 1 else: return 2 * x + 1 t = int(input()) for i in ...
FUNC_DEF IF VAR BIN_OP BIN_OP VAR VAR NUMBER RETURN NUMBER IF VAR VAR RETURN NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR IF BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR NUMBER VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR NUMBER...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
t = int(input()) for i in range(t): h1, c1, t1 = input().split(" ") h = int(h1) c = int(c1) t = int(t1) if t <= (h + c) / 2: print(2) else: x = (t - c) // (2 * t - h - c) m = ((h + c) * x - c) / (2 * x - 1) - t n = t - ((h + c) * x + h) / (2 * x + 1) if m ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NU...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys input = sys.stdin.buffer.readline def I(): return list(map(int, input().split())) def sieve(n): a = [1] * n for i in range(2, n): if a[i]: for j in range(i * i, n, i): a[j] = 0 return a for __ in range(int(input())): h, c, t = I() if h == t: ...
IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
from sys import gettrace, stdin if not gettrace(): def input(): return next(stdin)[:-1] def main(): def solve(): h, c, t = map(int, input().split()) if t <= (h + c) / 2: print(2) return if t >= h: print(1) return m = (h...
IF FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER FUNC_DEF FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN IF VAR VAR EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR V...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def read_int(): return int(input()) def read_ints(): return list(map(int, input().split(" "))) tt = read_int() for case_num in range(tt): h, c, t = read_ints() if 2 * t <= h + c: print(2) continue l = 1 r = int(10000000.0) def calc(x): return x * h + (x - 1) * c ...
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR IF BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER F...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def t_on_move(move): return (move * h + (move - 1) * c) / (2 * move - 1) for _ in range(int(input())): h, c, t = list(map(int, input().split())) even_val = (h + c) // 2 l = 0 r = 2000000000 while r - l > 1: m = (l + r) // 2 m_val = t_on_move(m) if m_val > t: ...
FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
t = int(input()) for _ in range(t): h, c, g = [int(x) for x in input().split()] av = (h + c) / 2 if g == h: print(1) elif g <= av + 0.001: print(2) else: n = int((g - h) / (h + c - g * 2)) best_n = -1 for j in range(max(n - 3, 0), n + 3): if best_n...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP V...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
from sys import stdin, stdout def mixing_water(h, c, t): r1 = 2 v1 = (h + c) // 2 if h >= c: rv2 = bs1(h, c, t) else: rv2 = bs2(h, c, t) r2 = rv2[0] v2 = rv2[1] dif = abs(t - v1) - abs(t - v2) if dif == 0: return min(r1, r2) elif dif > 0: return r2 ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VAR VAR IF VAR NUMBER RETURN FUNC_CALL VAR VAR VAR IF VA...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
for _ in range(int(input())): h, c, t = map(int, input().split()) if h + c >= 2 * t: print(2) elif t >= h: print(1) else: x = 2 * t - h - c k = (h - c + x) // (2 * x) test1 = abs((8 * k**2 - 2) * t - (h * k + c * k - c) * (4 * k + 2)) test2 = abs((8 * k**2...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR BIN_OP NUMBER V...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
T = int(input()) for i in range(T): h, c, t = map(int, input().split()) avg = (h + c) / 2 if avg >= t: print(2) else: n = ((h - c) / (2 * (t - avg)) + 1) / 2 if type(n) == int: print(2 * n - 1) else: n_min = int(n) n_max = n_min + 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP NUMBER BIN_OP VAR VAR NUMBER NUMBER IF FUNC_CALL VAR VAR VAR EX...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
def solve(): [hi, lo, barrel] = map(int, input().split()) if 2 * barrel <= hi + lo: return 2 items = (hi - barrel) // (2 * barrel - hi - lo) temp = lambda t: ((t + 1) * hi + t * lo - (2 * t + 1) * barrel) / (2 * t + 1) if abs(temp(items)) > abs(temp(items + 1)): items += 1 return...
FUNC_DEF ASSIGN LIST VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR BIN_OP VAR VAR RETURN NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys input = sys.stdin.readline def solve(): h, c, t = map(int, input().split()) if h <= t: return 1 if 2 * t <= h + c: return 2 if 2 * h + c <= t * 3: if abs(2 * h + c - t * 3) >= (h - t) * 3: return 1 else: return 3 l = 0 r = 500...
IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR RETURN NUMBER IF BIN_OP NUMBER VAR BIN_OP VAR VAR RETURN NUMBER IF BIN_OP BIN_OP NUMBER VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER RET...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
n = int(input()) for i in range(n): read = input().split(" ") a = float(read[0]) b = float(read[1]) c = float(read[2]) if c == a: print(1) elif abs(c - (a + b) / 2) == 0: print(2) else: k = abs(c - a) / abs(a + b - 2 * c) k = int(2 * k + 1) avr = abs(c...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER EXPR...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys input = sys.stdin.readline def solve(mid): return (mid + 1) * h + mid * c >= t * (2 * mid + 1) t = int(input()) for _ in range(t): h, c, t = map(int, input().split()) if 2 * t <= h + c: print(2) continue if h <= t: print(1) continue ok = 0 ng = 10*...
IMPORT ASSIGN VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
t = int(input()) for i in range(t): a = [] a = list(map(int, input().split())) h = a[0] c = a[1] t = a[2] ans = 0 m = 2 ans = float(h) ch = ans if h <= t: print(1) elif (h + c) / 2 >= t: print(2) else: while 0 == 0: m += 2 c...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR IF VAR VAR EXPR FUNC_CALL ...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
import sys input = sys.stdin.readline INF = 10**13 Q = int(input()) Query = [list(map(int, input().split())) for _ in range(Q)] for h, c, t in Query: if 2 * t <= h + c: ans = 2 else: l = 0 r = INF while r - l > 1: m = (l + r) // 2 if (h + c) * m + h > (2 ...
IMPORT ASSIGN VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR VAR VAR VAR IF BIN_OP NUMBER VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE BIN_OP VAR VAR NUMBER ASS...
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
from sys import stdin def iinput(): return int(stdin.readline()) def sinput(): return input() def minput(): return map(int, stdin.readline().split()) def linput(): return list(map(int, stdin.readline().split())) T = iinput() while T: T -= 1 h, c, t = minput() if h == t: pri...
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ...