description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
The only difference with E2 is the question of the problem.. Vlad built a maze out of $n$ rooms and $n-1$ bidirectional corridors. From any room $u$ any other room $v$ can be reached through a sequence of corridors. Thus, the room system forms an undirected tree. Vlad invited $k$ friends to play a game with them. Vl...
for t in range(int(input())): input() n, k = map(int, input().split()) pos = set(map(int, input().split())) adj = [set() for i in range(n + 1)] for i in range(n - 1): u, v = map(int, input().split()) adj[u].add(v) adj[v].add(u) player = set([1]) friends = set() | pos ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL V...
The only difference with E2 is the question of the problem.. Vlad built a maze out of $n$ rooms and $n-1$ bidirectional corridors. From any room $u$ any other room $v$ can be reached through a sequence of corridors. Thus, the room system forms an undirected tree. Vlad invited $k$ friends to play a game with them. Vl...
def f(): input() n, k = map(int, input().split()) visv = set([(i - 1) for i in map(int, input().split())]) g = [set() for i in range(n)] for i in range(n - 1): a, b = map(int, input().split()) g[a - 1].add(b - 1) g[b - 1].add(a - 1) qv = set() | visv qh = set([0]) ...
FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EX...
The only difference with E2 is the question of the problem.. Vlad built a maze out of $n$ rooms and $n-1$ bidirectional corridors. From any room $u$ any other room $v$ can be reached through a sequence of corridors. Thus, the room system forms an undirected tree. Vlad invited $k$ friends to play a game with them. Vl...
def solve(): input() n, k = map(int, input().split()) f = list(enumerate(list(map(lambda x: int(x) - 1, input().split())))) g = {i: [] for i in range(n)} for i in range(n - 1): a, b = map(int, input().split()) a -= 1 b -= 1 g[a].append(b) g[b].append(a) ne...
FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
questions = int(input()) lower_limit, upper_limit = -2000000000, 2000000000 inequalities = {">": 2, ">=": 1, "<": -1, "<=": -2} gt, geq, lt, leq = 2, 1, -1, -2 for i in range(questions): inequality, number, answer = input().split() inequality = ( inequalities[inequality] * -1 if answer != "Y" else inequ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR DICT STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER ASSIGN VAR VAR VAR VAR NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR STRING BIN_OP VAR VAR NUMBER VAR VAR ASSIGN V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = -2000000000 r = 2000000000 for _ in range(n): s = input().split() x = int(s[1]) if s[0] == ">" and s[2] == "Y": l = max(l, x + 1) elif s[0] == ">" and s[2] == "N": r = min(r, x) elif s[0] == ">=" and s[2] == "Y": l = max(l, x) elif s[0] == ">=" and s[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER STRING VAR NUMBER STRING ASSIGN VAR FUNC_CALL VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
line = int(input()) questions = [] answer = None a_range = ["inf", "inf"] def shorten_sec(num): if a_range[1] == "inf": return num elif a_range[1] > num: return num return a_range[1] def shorten_first(num): if a_range[0] == "inf": return num elif a_range[0] < num: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NONE ASSIGN VAR LIST STRING STRING FUNC_DEF IF VAR NUMBER STRING RETURN VAR IF VAR NUMBER VAR RETURN VAR RETURN VAR NUMBER FUNC_DEF IF VAR NUMBER STRING RETURN VAR IF VAR NUMBER VAR RETURN VAR RETURN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_C...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) y = [-2 * 10**9, 2 * 10**9] k = [] f = 0 for i in range(n): k.append(list(map(str, input().split()))) for i in range(n): x = int(k[i][1]) if k[i][2] == "N": if k[i][0] == ">": k[i][0] = "<=" elif k[i][0] == ">=": k[i][0] = "<" elif k[i][0] == ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST BIN_OP NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR N...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = [] less = [] grt = [] for i in range(n): l = [x for x in input().split()] if l[2] == "N": l[2] = "Y" if l[0] == ">=": l[0] = "<" elif l[0] == ">": l[0] = "<=" elif l[0] == "<": l[0] = ">=" else: l[0] = "...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER STRING ASSIG...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) maxmin = -2000000000 minmax = 2000000000 for x in range(n): query = [str(x) for x in input().split()] op = query[0] num = int(query[1]) flag = query[2] if op == ">": if flag == "Y": maxmin = max(maxmin, num + 1) else: minmax = min(minmax, num)...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN ...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) simbolo = [] num = [] yn = [] for j in range(n): s, x, y = input().split() simbolo.append(s) num.append(int(x)) yn.append(y) maximo = float("inf") minimo = -float("inf") for i in range(n): ismax = False if yn[i] == "N": if simbolo[i] == "<": simbolo[i] = ">="...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
list1 = ["", "", "", ""] n = int(input()) for _ in range(n): list2 = [x for x in input().split()] val = int(list2[1]) if list2[2] == "N": if list2[0] == ">=": list2[0] = "<" elif list2[0] == ">": list2[0] = "<=" elif list2[0] == "<=": list2[0] = ">...
ASSIGN VAR LIST STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER STRIN...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) low = None high = None for i in range(n): l = input().split() if l[0] == ">" and l[2] == "Y" or l[0] == "<=" and l[2] == "N": low = max(int(l[1]) + 1, low == None and -1000000000.0 or low) elif l[0] == "<" and l[2] == "Y" or l[0] == ">=" and l[2] == "N": high = min(int(l[1])...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NONE ASSIGN VAR NONE FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING VAR NUMBER STRING VAR NUMBER STRING VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER VAR NONE NUMBER VAR IF VAR NUMBER STRING VAR NUMB...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) low = -2 * 10**9 high = 2 * 10**9 for i in range(n): sign, x, answer = input().split() x = int(x) if sign == ">=": if answer == "Y": low = max(low, x) else: high = min(high, x - 1) elif sign == ">": if answer == "Y": low = max(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR B...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) MAX = 1000000000 minimum, maximum, temp_max, temp_min = [0] * 4 i = 0 while i < n: question = [x for x in input().split()] if question[2] == "Y": if question[0] == ">=": minimum = int(question[1]) maximum = MAX elif question[0] == ">": minimum...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER STRING ASSIGN VAR BIN_OP FUNC_CA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
list1 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-"] list2 = [">", "<", "=", "N", "Y"] n = int(input()) ans = [] low = 10000000000 max = -1001317593 str1 = "" str2 = "" for i in range(n): k = input() str1 = "" str2 = "" for j in k: if j in list2: str1 += j if j in ...
ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING ASSIGN VAR LIST STRING STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) p1, p2 = int(2 * -1000000000.0), int(2 * 1000000000.0) for i in range(n): q, x, a = map(str, input().split()) if a == "Y": if q == ">=" and int(x) >= p1: p1 = int(x) elif q == ">" and int(x) >= p1: p1 = int(x) + 1 elif q == "<=" and int(x) <= p2: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER FUNC_CALL VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING IF VAR STRING FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING FUNC_CALL VAR VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = float("-inf") r = float("inf") for i in range(n): exp, no, ans = input().split() if ans == "Y": if exp == "<=": if r > int(no): r = int(no) elif exp == ">=": if l < int(no): l = int(no) elif exp == "<": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING IF VAR STRING IF VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
def inverse(str): val = "" if str == ">": val = "<=" elif str == "<": val = ">=" elif str == ">=": val = "<" else: val = ">" return val min_ = -2000000000 max_ = 2000000000 n = int(input()) for i in range(n): sign, num, yn = input().split() num = int(num...
FUNC_DEF ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING RETURN VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
def main(): n = int(input()) small_less = int(2000000000.0) + 1 big_great = int(-2000000000.0) - 1 flip = {">": "<", "<": ">"} for _ in range(n): kind, num, ans = input().split() num = int(num) if ans == "N": had_eq = len(kind) == 2 kind = flip[kind[0]...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR DICT STRING STRING STRING STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING ASSIGN VAR FUNC_CALL VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
u, v = -2000000000, 2000000000 for i in range(int(input())): a, b, c = input().split() k = int(b) if a == ">=": if c == "Y": u = max(u, k) else: v = min(v, k - 1) elif a == ">": if c == "Y": u = max(u, k + 1) else: v = min(v...
ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) i, j = -1000000001, 1000000001 for k in range(n): e, x, a = input().split() x = int(x) if (e, a) in [(">=", "Y"), ("<", "N")]: i = max(i, x) elif (e, a) in [(">", "Y"), ("<=", "N")]: i = max(i, x + 1) elif (e, a) in [("<=", "Y"), (">", "N")]: j = min(j, x) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR LIST STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR VAR LIST STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = [] for i in range(n): l.append(list(input().split())) L = -2 * 10**9 h = 2 * 10**9 for i in range(n): if l[i][2] == "Y": if l[i][0] == "<": h = min(int(l[i][1]) - 1, h) elif l[i][0] == "<=": h = min(int(l[i][1]), h) elif l[i][0] == ">": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER STRING IF VAR VAR NUMBER STRING ASSIGN VAR FUN...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) top = 2 * 10**9 bottom = -top for i in range(n): line = input().split(" ") simb = line[0] num = int(line[1]) answer = line[2] if answer == "N": if simb == ">=": simb = "<" elif simb == "<=": simb = ">" elif simb == ">": sim...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR S...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
import sys queries = int(sys.stdin.readline()) opp = {">": "<=", ">=": "<", "<": ">=", "<=": ">"} lower = -2000000000 upper = 2000000000 for i in range(queries): oper, num, judge = sys.stdin.readline().rstrip().split(" ") if judge == "N": oper = opp[oper] if oper == ">": lower = max(int(num...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING STRING STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING IF VAR STRING ASSIGN VAR VAR VAR IF VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP F...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) left = None right = None for i in range(n): st = input() op, num, ans = st.split(" ") num = int(num) if ans == "N": if op == ">=": op = "<" elif op == ">": op = "<=" elif op == "<=": op = ">" else: op = ">="...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NONE ASSIGN VAR NONE FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING I...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) low = -2000000001 high = 2000000001 i = 0 flag = 0 while i < n: i = i + 1 lis = input().split() if lis[2] == "N": if lis[0] == ">": lis[0] = "<=" elif lis[0] == "<": lis[0] = ">=" elif lis[0] == "<=": lis[0] = ">" elif lis[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER STRI...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l, r = -1000000001, 1000000001 for i in range(n): s = input().split() if s[2] == "Y": if s[0] == ">": l = max(l, int(s[1]) + 1) elif s[0] == ">=": l = max(l, int(s[1])) elif s[0] == "<": r = min(r, int(s[1]) - 1) else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) a, b, c, d = -pow(10, 9) - 10, pow(10, 9) + 10, -pow(10, 9) - 10, pow(10, 9) + 10 for _ in range(n): s = list(map(str, input().split())) if s[0] == "<" and s[2] == "Y" or s[0] == ">=" and s[2] == "N": b = min(int(s[1]), b) if s[0] == ">" and s[2] == "Y" or s[0] == "<=" and s[2] == "...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l, r = -2000000000, 2000000000 for i in range(n): s = input().split() if s[2] == "N": if s[0] == ">": s[0] = "<=" elif s[0] == "<": s[0] = ">=" elif s[0] == ">=": s[0] = "<" elif s[0] == "<=": s[0] = ">" if s[0]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR ...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = 0 fl = True r = 0 fr = True for i in range(n): t, x, ans = input().split() x = int(x) if t == ">=" and ans == "Y": if x > l or fl: l = x fl = False elif t == ">=" and ans == "N": if x - 1 < r or fr: r = x - 1 fr = False...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER IF VAR STRING VAR STRING IF BIN_OP VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) maxnum = 10000000000 minnum = maxnum * -1 for _ in range(n): s = input().strip().split() if s[0] == ">": if s[2] == "Y": minnum = int(s[1]) + 1 if minnum < int(s[1]) + 1 else minnum else: maxnum = int(s[1]) if maxnum > int(s[1]) else maxnum elif s[0] ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER VAR ASSIGN VAR VAR FUNC_CALL...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
greater = -2000000000 smaller = 2000000000 n = int(input()) for _ in range(n): a, b, c = input().split() if a == ">=": if c == "Y": greater = max(greater, int(b)) else: smaller = min(smaller, int(b) - 1) elif a == "<=": if c == "Y": smaller = min(i...
ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR STRING IF VAR STRING ASSIGN VAR F...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) ma = "a" mi = "b" for i in range(n): linha = input() linha = linha.split() if linha[0] == "<=" and linha[2] == "Y" or linha[0] == ">" and linha[2] == "N": maior = int(linha[1]) if ma == "a": ma = maior else: ma = min(ma, maior) elif linha[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER STRING VAR NUMBER STRING VAR NUMBER STRING VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR STRING ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) t = ["", ""] for i in range(n): l = list(input().split()) l[1] = int(l[1]) if l[2] == "N": if t[0] == "": if l[0] == ">": t[0] = l[1] elif l[0] == ">=": t[0] = l[1] - 1 elif l[0] == ">": if t[0] > l[1]: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST STRING STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER VAR NUMBER IF VAR NUMBER STRING ASSIGN VAR NUMBER BI...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
def ugaday(lst): l, r = -2000000000, 2000000000 for elem in lst: if elem[0] == ">": if elem[2] == "N": r = min(r, int(elem[1])) else: l = max(l, int(elem[1]) + 1) if elem[0] == "<": if elem[2] == "N": l = max(l, ...
FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
class InputHandlerObject(object): inputs = [] def getInput(self, n=0): res = "" inputs = self.inputs if not inputs: inputs.extend(input().split(" ")) if n == 0: res = inputs[:] inputs[:] = [] while n > len(inputs): inputs.e...
CLASS_DEF VAR ASSIGN VAR LIST FUNC_DEF NUMBER ASSIGN VAR STRING ASSIGN VAR VAR IF VAR EXPR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR LIST WHILE VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR LIST RETURN V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) lewo = -2 * 10**9 prawo = 2 * 10**9 for i in range(n): buf = input().split(" ") liczba = int(buf[1]) wynik = buf[2] if buf[0] == ">=" and wynik == "Y" or buf[0] == "<" and wynik == "N": lewo = max(lewo, liczba) if buf[0] == "<=" and wynik == "Y" or buf[0] == ">" and wynik ==...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR NUMBER STRING VAR STRING VAR NUMBER STRING VAR STRING AS...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) li = [] for i in range(n): s = list(input().split(" ")) li.append(s) mx = 2 * 10**9 mi = -mx for i in range(n): if li[i][2] == "Y": if li[i][0] == ">": mi = max(mi, int(li[i][1]) + 1) elif li[i][0] == ">=": mi = max(mi, int(li[i][1])) elif li[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER STRING IF VAR VAR NUMBER STRING ASSIGN VAR FUNC_CALL VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) s = [] for i in range(n): ef, fr, efw = list(map(str, input().split())) fr = int(fr) s.append([ef, fr, efw]) ODZmax = 2 * 10**9 ODZmin = -(2 * 10**9) for i in range(n): if s[i][0] == ">=" and s[i][2] == "Y": if ODZmin < s[i][1]: ODZmin = s[i][1] elif s[i][0] == "...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input().strip()) r = 2 * 10**9 l = -r def opp(ineq): if ineq == "<": return ">=" elif ineq == "<=": return ">" elif ineq == ">": return "<=" return "<" for i in range(n): ineq, val, ans = input().strip().split(" ") if val[0] == "-": val = -1 * int(val[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR VAR FUNC_DEF IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING RETURN STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER STR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) ft = [">=", ">", "<=", "<"] sn = -2 * 10**9 mn = -sn for i in range(n): c, num, flag = input().split() cindex = ft.index(c) num = int(num) if flag == "N": cindex = 3 - cindex if cindex == 1: cindex = 0 num += 1 elif cindex == 3: cindex = 2 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST STRING STRING STRING STRING ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR VAR 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 IF VAR STRING ASSIGN VAR BIN_OP NUMBER VAR IF VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
t = int(input()) l = -2000000000 r = 2000000000 while t > 0: zn, n, fl = map(str, input().split()) n = int(n) if fl == "Y": if zn == ">": l = max(l, n + 1) elif zn == "<": r = min(r, n - 1) elif zn == ">=": l = max(l, n) elif zn == "<=": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) ma = 2 * 10**9 mi = -2 * 10**9 for i in range(n): x = input() if x[len(x) - 1] == "Y": if x[0] == "<" and x[1] == "=": ma = min(ma, int(x[3 : len(x) - 2])) elif x[0] == "<" and x[1] == " ": if int(x[2 : len(x) - 2]) >= 0: ma = min(ma, int(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER STRING IF VAR NUMBER STRING VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) i = -2000000000 j = 2000000000 grt = [">", ">="] lwr = ["<", "<="] for _ in range(n): sna = input().split(" ") sign = sna[0] num = int(sna[1]) ans = True if sna[2] == "Y" else False if sign == ">": if ans: i = num + 1 if i < num + 1 else i else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST STRING STRING ASSIGN VAR LIST STRING STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER STRING NUMBER NUMBER IF VAR STRING IF...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
nop = {"<": ">=", ">": "<=", "<=": ">", ">=": "<"} vmin, vmax = -(10**9 + 1), 10**9 + 1 for i in range(int(input())): q = input().split() op, x = q[0] if q[2] == "Y" else nop[q[0]], int(q[1]) if op[0] == "<": if op[-1] != "=": x -= 1 vmax = min(vmax, x) elif op[0] == ">": ...
ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING STRING STRING ASSIGN VAR VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER STRING VAR NUMBER VAR VAR NUMBER FUNC_CALL VAR VAR N...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) left = -(10**9) - 5 right = 10**9 + 5 for i in range(n): op, x, ans = input().split() x = int(x) if op == ">" and ans == "Y": left = max(x + 1, left) elif op == ">": right = min(x, right) if op == "<" and ans == "Y": right = min(x - 1, right) elif op == "...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR STRING ASSIG...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
def revOP(op): if op == "<": return ">=" if op == "<=": return ">" if op == ">": return "<=" if op == ">=": return "<" n = int(input()) left = -2 * 10**9 right = 2 * 10**9 for i in range(n): arr = list(map(str, input().split())) num = int(arr[1]) oper = arr[...
FUNC_DEF IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
import sys n = int(input()) lower = -2 * 10**9 upper = 2 * 10**9 for i in range(n): sign, x, ans = input().split() x = int(x) if ans == "Y" and sign == ">=" or ans == "N" and sign == "<": lower = max(lower, x) elif ans == "Y" and sign == ">" or ans == "N" and sign == "<=": lower = max(l...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR IF V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = -2 * 10**9 r = 2 * 10**9 for i in range(n): s = input().split() s[1] = int(s[1]) if s[2] == "Y": if s[0] == ">=": l = max(l, s[1]) elif s[0] == ">": l = max(l, s[1] + 1) elif s[0] == "<=": r = min(r, s[1]) else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER IF ...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) low_border = -(10**9) * 2 max_border = 10**9 * 2 def replace_eq_if_nop(eq): return {">": "<=", ">=": "<", "<": ">=", "<=": ">"}[eq] for i in range(n): eq, num, ans = input().split() num = int(num) if ans == "N": eq = replace_eq_if_nop(eq) if eq == ">": low_border...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF RETURN DICT STRING STRING STRING STRING STRING STRING STRING STRING VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) lt = lte = 2 * 10**9 gt = gte = -2 * 10**9 for _ in range(n): t1, t2, t3 = input().split() t2 = int(t2) if t3 == "Y": if t1 == ">=": gte = max(gte, t2) elif t1 == ">": gt = max(gt, t2) elif t1 == "<=": lte = min(lte, t2) el...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR STRING ASSIGN V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l, r = -1998638045, 11**11 for _ in range(n): lr, x, yn = input().split() x = int(x) if yn == "Y": if lr == ">": if x + 1 > l: l = x + 1 elif lr == "<": if x - 1 < r: r = x - 1 elif lr == ">=": if x ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING IF BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR STRING IF BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
minimum = -2000000000 maximum = 2000000000 n = int(input()) while n > 0: n -= 1 entrada = input().split() q = entrada[0] num = int(entrada[1]) result = entrada[2] if q == ">" and result == "Y": minimum = max(minimum, num + 1) elif q == ">" and result == "N": maximum = min(max...
ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR STRING VAR STRING ASSIG...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
left, right = -2000000000, 2000000000 for _ in range(int(input())): guess, x, answer = input().split() x = int(x) if answer == "N": guess = {">": "<=", "<": ">=", "<=": ">", ">=": "<"}[guess] if guess == ">": if right <= x: print("Impossible") break elif l...
ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING STRING STRING VAR IF VAR STRING IF VAR VAR EXPR FUNC_CALL VAR STRING IF VAR VAR ASSIGN VAR BIN_OP...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = -2 * 10**9 r = 2 * 10**9 for i in range(n): s, v, f = input().split() v = int(v) if f == "N": s = {"<": ">", ">": "<"}[s[0]] + s[1:] if len(s) == 1: s += "=" else: s = s[0] if s[0] == "<": if len(s) != 2: v -= 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING ASSIGN VAR BIN_OP DICT STRING STRING STRING STRING VAR NUMBER VAR NUMBER IF F...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = -(10**9) - 3 r = 10**9 + 3 for i in range(n): sign, x, ans = map(str, input().split()) x = int(x) if sign == ">" and ans == "Y" or sign == "<=" and ans == "N": if l <= x: l = x + 1 elif sign == "<" and ans == "Y" or sign == ">=" and ans == "N": if r >= x:...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING VAR STRING VAR STRING IF VAR VAR ASSIGN VAR BIN_...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
a, b = -(1 << 30), 1 << 30 n = int(input()) for i in range(n): s = input().split() if s[0] == ">" and s[2] == "Y" or s[0] == "<=" and s[2] == "N": a = max(int(s[1]) + 1, a) elif s[0] == ">=" and s[2] == "Y" or s[0] == "<" and s[2] == "N": a = max(int(s[1]), a) elif s[0] == "<" and s[2] =...
ASSIGN VAR VAR BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING VAR NUMBER STRING VAR NUMBER STRING VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER VAR IF VAR NUMBER STRING...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) lis = [] for i in range(n): lis.append(input().split()) lis1 = [] lis2 = [] for i in range(n): if lis[i][0] == ">=": if lis[i][2] == "Y": lis1.append(int(lis[i][1])) else: lis2.append(int(lis[i][1]) - 1) if lis[i][0] == "<=": if lis[i][2] == "...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER STRING IF VAR VAR NUMBER STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR ...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
def main(): lo, hi = -2000000000, 2000000001 for _ in range(int(input())): s, x, yn = input().split() if yn == "N": s = {"<": ">=", ">": "<=", "<=": ">", ">=": "<"}[s] x = int(x) + 1 if s in ("<=", ">") else int(x) if s[0] == "<": if hi > x: ...
FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING STRING STRING VAR ASSIGN VAR VAR STRING STRING BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR IF VAR NUMBER STRING...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
N = int(input()) lb = float("-inf") ub = float("+inf") def flip(sign): if sign == ">=": return "<" if sign == "<": return ">=" if sign == ">": return "<=" if sign == "<=": return ">" for _ in range(N): sign, x, ans = input().split(" ") x = int(x) if ans ==...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING FUNC_DEF IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
def trocaSinal(s): if s == ">=": return "<" if s == "<=": return ">" if s == ">": return "<=" if s == "<": return ">=" n = int(input()) s = [0] * n for i in range(n): s[i] = input() u = 2 * 10**9 l = -2 * 10**9 for i in range(n): t = s[i].split(" ") sinal = ...
FUNC_DEF IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER ...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) lower_range, upper_range = -1000000001, 1000000001 for i in range(n): operation, num, correct = input().split(" ") num = int(num) if operation[0] == ">": if correct == "Y": if num >= lower_range: if len(operation) > 1: lower_range = nu...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER STRING IF VAR STRING IF VAR VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR IF FUNC_CALL VAR V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
def main(): li = -10000000000.0 ul = 10000000000.0 n = int(input()) for _ in range(n): sym, guess, ans = input().split() if sym == ">=": if ans == "Y" and int(guess) > li: li = int(guess) elif ans == "N" and int(guess) < ul: ul = in...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING IF VAR STRING FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR ST...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
l, r = -2000000000, 2000000000 for x in range(int(input())): t, n, a = input().split() if t[0] == ">": n = int(n) + (len(t) == 1) if a == "Y": l = max(l, n) else: r = min(r, n - 1) else: n = int(n) - (len(t) == 1) if a == "Y": r = m...
ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP FUNC...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) Q = [] for i in range(0, n): Q.append(list(input().split())) least = -1998638045 max = 1998638045 for q in Q: if q[0] is ">": num = int(q[1]) if q[2] is "Y": if least <= num: least = num + 1 elif max >= num: max = num elif q[0]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) min_y = -2000000000 max_y = 2000000000 Impossible = False def opposite(sign): if sign == ">": return "<=" if sign == "<": return ">=" if sign == "<=": return ">" if sign == ">=": return "<" for i in range(n): sign, number, ans = input().split(" ")...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR STRING ASSIGN VAR FUNC_...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l1 = [-2 * 10**9, 2 * 10**9] for i in range(n): inp = list(input().split()) if inp[0] == ">": x = int(inp[1]) if inp[2] == "Y": l1[0] = max(l1[0], x + 1) else: l1[1] = min(l1[1], x) elif inp[0] == "<": x = int(inp[1]) if inp[2]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST BIN_OP NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) u = 10**9 + 1 l = -u for i in range(n): s = input().split() if s[0] == ">=": if s[2] == "Y": l = max(l, int(s[1])) else: u = min(u, int(s[1]) - 1) if s[0] == ">": if s[2] == "Y": l = max(l, int(s[1]) + 1) else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NU...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) r = [-(10**9 + 7), 10**9 + 7] for _ in range(0, n): s, x, a = map(str, input().split()) if a == "Y": if s == ">=": r[0] = max(r[0], int(x)) elif s == ">": r[0] = max(r[0], int(x) + 1) elif s == "<=": r[1] = min(r[1], int(x)) el...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST BIN_OP BIN_OP NUMBER NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING IF VAR STRING ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR IF VAR STRIN...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) operations = [">=", "<=", ">", "<"] NO = "N" M = 2 * 10**9 greater = [] less = [] for i in range(n): inp = input().split(" ") if inp[0] == operations[0] and inp[2] == NO: inp[0] = operations[3] elif inp[0] == operations[1] and inp[2] == NO: inp[0] = operations[2] elif in...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST STRING STRING STRING STRING ASSIGN VAR STRING ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER VAR NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER IF V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
t = int(input()) u = [] l = [] for j in range(t): x = input().split() if x[0] == ">=" and x[2] == "Y" or x[0] == "<" and x[2] == "N": l.append(int(x[1])) elif x[0] == "<=" and x[2] == "Y" or x[0] == ">" and x[2] == "N": u.append(int(x[1])) elif x[0] == ">" and x[2] == "Y" or x[0] == "<="...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING VAR NUMBER STRING VAR NUMBER STRING VAR NUMBER STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING VAR NUMBER STRING VAR NUMBER STRING VAR NUMBER S...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) k = 0 a = [] r = [] h = 0 for i in range(n): a.append(list(map(str, input().split()))) for i in range(n): for j in range(1): if a[i][j] == ">=" and a[i][j + 2] == "Y": if k < int(a[i][j + 1]): k = int(a[i][j + 1]) if a[i][j] == ">=" and a[i][j + 2] ==...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR STRING VAR VAR BIN_OP VAR NUMBER STRING IF...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = -(10**9) - 1 r = 10**9 + 1 while n > 0: n -= 1 s = input().split() if len(s[0]) == 1: if s[0] == ">": if s[2] == "Y": l = max(l, int(s[1]) + 1) else: r = min(r, int(s[1])) elif s[2] == "Y": r = min(int(s...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER NUMBER IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
left_border_inclusive = float("-inf") right_border_inclusive = float("inf") inverse_signs = {">": "<=", "<=": ">", ">=": "<", "<": ">="} NUMBERS = int(input()) EXTRA_FINISH = False sign, value = None, None for _ in range(NUMBERS): sign, value, answer = input().split(" ") value = int(value) if answer == "N":...
ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NONE NONE FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
bAnswer = True minv = -2000000000 maxv = 2000000000 for _ in range(int(input())): s, d, c = input().split() if s == ">=" and c == "Y": if int(d) >= minv: minv = int(d) elif s == ">=" and c == "N": if int(d) - 1 < maxv: maxv = int(d) - 1 elif s == ">" and c == "Y":...
ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING VAR STRING IF FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING IF BIN_OP FUNC_CALL VAR VAR NUMBER VAR ASSIGN VAR BIN_OP FUNC_CALL VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input("")) x = 999999999999999999 y = -999999999999999999 p = 0 q = 0 for i in range(0, n): s, v, a = input().split() v = int(v) if a == "Y": if s == ">=": y = max(v, y) p = 1 elif s == ">": v += 1 y = max(v, y) p = 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER IF VAR STRING VAR ...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) mn = -2000000000 mx = 2000000000 for i in range(n): sign, ber, ans = input().split() num = int(ber) if ans == "N": if sign == "<": sign = ">=" elif sign == "<=": sign = ">" elif sign == ">": sign = "<=" elif sign == ">=": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING IF VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
import sys reader = (s.rstrip() for s in sys.stdin) input = reader.__next__ queries = int(input()) MAX_L = -2000000000 MAX_R = 2000000000 start = MAX_L end = MAX_R for i in range(queries): query = input() operator, n, res = query.split() number = int(n) result = False if res == "Y": result ...
IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR STRING ASSIGN VAR NUMB...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
import sys f = 0 st = -sys.maxsize end = sys.maxsize for _ in range(int(input())): s = input() import sys a, b, c = s.split() if c == "N": if a == ">": a = "<=" elif a == "<": a = ">=" elif a == ">=": a = "<" elif a == "<=": ...
IMPORT ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IMPORT ASSIGN VAR VAR VAR FUNC_CALL VAR IF VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING ASSIGN V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input("")) z = {} ch = {} tf = {} for i in range(0, n): z[i], ch[i], tf[i] = map(str, input("").split()) ch[i] = int(ch[i]) if z[i] == "<": z[i] = int(1) if z[i] == "<=": z[i] = int(2) if z[i] == ">": z[i] = int(3) if z[i] == ">=": z[i] = int(4) if tf[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR STRING ASSIGN VAR VAR FUNC_CALL VAR NUMBER IF VAR VAR STRING ASSI...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
T = int(input()) l = -2000000001 r = 2000000001 while T > 0: T -= 1 A, B, C = input().split() b = int(B) if C == "N": if A == ">=": A = "<" elif A == "<=": A = ">" elif A == ">": A = "<=" else: A = ">=" if A == ">=": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING IF VAR STRING VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
lp = -2 * 10**9 rp = 2 * 10**9 n = int(input()) for i in range(n): s = input() a = s.find(" ") b = s.find(" ", a + 1) sign = s[0:a] value = int(s[a + 1 : b]) ans = s[b + 1 :] if sign == ">": if ans == "Y": lp = max(lp, value + 1) else: rp = min(rp, val...
ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR B...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
d = { "> Y": (0, 1, max), ">= Y": (0, 0, max), "< N": (0, 0, max), "<= N": (0, 1, max), "< Y": (1, -1, min), "<= Y": (1, 0, min), "> N": (1, 0, min), ">= N": (1, -1, min), } ran = [-2000000000, 2000000000] possible = True def analyse(s): ls = s.split(" ") op = d.get(" ".join((l...
ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING STRING STRING NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) questions = [] for _ in range(n): sign, x, answer = list(map(str, input().split())) questions.append((sign, x, answer)) y_min = -1998638045 y_max = +1998638045 for question in questions: sign = question[0] x = int(question[1]) answer = question[2] if sign == ">=" and answer == "...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) li = -2 * 10**9 ls = 2 * 10**9 originales = [">", "<", ">=", "<="] inversos = ["<=", ">=", "<", ">"] for i in range(n): condi = input().split() if condi[2] == "Y": if originales.index(condi[0]) % 2 == 0: if condi[0] == ">": if li <= int(condi[1]): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR LIST STRING STRING STRING STRING ASSIGN VAR LIST STRING STRING STRING STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING IF BIN_OP FUNC_CALL...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) k = -2000000000 l = 2000000000 for x in range(n): a, z, b = input().split() a = a z = int(z) b = b if a == ">" and b == "Y" and k < z + 1: k = z + 1 elif a == ">=" and b == "Y" and k < z: k = z elif a == ">" and b == "N" and l > z: l = z elif a ==...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR IF VAR STRING VAR STRING VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR STRING VAR STRING VAR VAR ASSIGN V...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) m, M = -2000000000, 2000000000 def than(a, more, eq): global m, M if more: m = max(m, a + 1 - eq) else: M = min(M, a - 1 + eq) for i in range(n): _a, _b, _c = input().split() sign = _a number = int(_b) response = _c a = number eq = "=" in sign ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FUNC_DEF IF VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN ...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = -float("inf") r = float("inf") kt = True for i in range(n): temp = input().split() if temp[0] == ">": if temp[2] == "Y": l = max(int(temp[1]) + 1, l) else: r = min(int(temp[1]), r) if temp[0] == "<": if temp[2] == "Y": r = min(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUN...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) m = 2 * 10**9 d = [-m, m] for i in range(n): a, b, c = input().split() b = int(b) if a == ">=": if c == "Y": d[0] = max(d[0], b) else: d[1] = min(d[1], b - 1) elif a == "<": if c == "Y": d[1] = min(d[1], b - 1) else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR LIST VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR ASSIGN VAR NUMBER FUNC_CALL VAR VAR NU...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) left = -2 * 1000 * 1000 * 1000 right = 2 * 1000 * 1000 * 1000 for i in range(n): s = input().split() r = s[0] x = int(s[1]) a = s[2] if "Y" == a: if ">=" == r: left = max(left, x) if ">" == r: left = max(left, x + 1) if "<=" == r: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF STRING VAR IF STR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) l = -1000000001 r = 1000000001 for i in range(n): s, x, otv = input().split() x = int(x) if s == ">": if otv == "Y" and l <= x: l = x + 1 elif x <= r and otv == "N": r = x if s == "<": if otv == "Y" and x <= r: r = x - 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR VAR STRING ASSIGN VAR VAR IF VAR STRING IF VAR STRING VAR VAR ASSIGN VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
_ = int(input()) mini = -(10**9) - 1 maxi = 10**9 + 1 for i in range(_): s, n, a = input().split() n = int(n) if a == "Y": if s == ">=": mini = max(mini, n) elif s == ">": mini = max(mini, n + 1) elif s == "<=": maxi = min(maxi, n) elif s =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR STRING ASSIGN VAR FUNC_...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
l, h = -2000000000, 2000000000 for _ in range(int(input())): x, y, z = [_ for _ in input().split()] y = int(y) if x == "<=": if z == "Y": if h > y: h = y elif l < y: l = y + 1 if x == "<": if z == "Y": if h > y - 1: ...
ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING IF VAR VAR ASSIGN VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR STRING IF VAR STRING IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
__author__ = "Lipen" def ModeReverse(mode): if mode == ">": return "<=" elif mode == "<": return ">=" elif mode == ">=": return "<" elif mode == "<=": return ">" def main(): n = int(input()) ymin = -2000000000 ymax = 2000000000 for i in range(n): ...
ASSIGN VAR STRING FUNC_DEF IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING IF VAR STRING RETURN STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
m, M = -2000000000, 2000000000 n = int(input()) for i in range(n): a, b, c = map(str, input().split()) b = int(b) if c == "Y": if a == ">": m = max(b + 1, m) elif a == ">=": m = max(b, m) elif a == "<": M = min(b - 1, M) elif a == "<=": ...
ASSIGN VAR VAR NUMBER 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 FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR STRING ...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
left = -2000000000 right = 2000000000 for _ in range(int(input())): temp = input().split() sign = temp[0] n = int(temp[1]) tf = temp[2] if tf == "Y": if sign == ">" and left <= n: left = n + 1 elif sign == ">=" and left < n: left = n elif sign == "<" a...
ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR STRING IF VAR STRING VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR STRING VAR VAR ASSIGN VAR VAR IF VAR STRING VAR...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) _min = -2 * 10**9 _max = 2 * 10**9 for q in range(n): t, n, ans = input().split() if t == ">": if ans == "Y": _min = max(_min, int(n) + 1) elif ans == "N": _max = min(_max, int(n)) elif t == ">=": if ans == "Y": _min = max(_min, in...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR STRING ASSIGN VAR FUNC_C...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) p = -1000000001 l = 1000000001 for x in range(n): s = input().split() r = int(s[1]) if s[2] == "Y": if s[0] == ">=": p = max(p, r) if s[0] == ">": p = max(p, r + 1) if s[0] == "<=": l = min(l, r) if s[0] == "<": ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VA...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) i = -2 * 10**9 j = 2 * 10**9 while n > 0: sign, x, ans = input().split() x = int(x) if sign == ">": if ans == "Y": if i < x + 1: i = x + 1 elif j > x - 1: j = x elif sign == ">=": if ans == "Y": if i < x: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER WHILE VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING IF VAR STRING IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR ...
A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There are four types of acceptable questions: Is it true that y is strictly ...
n = int(input()) questions = [] for _ in range(n): questions.append(input()) lower_bound, upper_bound = None, None for q in questions: bound = int(q.split()[1]) if q.startswith(">") and q.endswith("Y") or q.startswith("<") and q.endswith("N"): if "Y" in q and "=" not in q or "N" in q and "=" in q: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NONE NONE FOR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING IF STRING VAR STRING VAR STRING VAR ...