description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
The year of 2012 is coming... According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. But seven brave heroes have already gathered on the top of a mountain Arreat to protect us...
from itertools import combinations, permutations, product n = int(input()) names = {} nex = 0 mama = 128 liking = [0] * mama likes = [([0] * 7) for _ in range(7)] def getName(name): global nex if name in names: return names[name] names[name] = nex nex += 1 return names[name] for _ in ra...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER FUNC_DEF IF VAR VAR RETURN VAR VAR ASSIGN VAR VAR VAR VAR NUMBER RETURN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CAL...
The year of 2012 is coming... According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. But seven brave heroes have already gathered on the top of a mountain Arreat to protect us...
import itertools heroes = ["Anka", "Chapay", "Cleo", "Troll", "Dracul", "Snowy", "Hexadecimal"] n = int(input()) edges = [] for i in range(n): p, likes, q = input().split() edges.append((heroes.index(p), heroes.index(q))) boss_xp = list(map(int, input().split())) min_difference = float("inf") max_liking = floa...
IMPORT ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING 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 EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR AS...
The year of 2012 is coming... According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. But seven brave heroes have already gathered on the top of a mountain Arreat to protect us...
from itertools import * p = {"An": 0, "Ch": 1, "Cl": 2, "Tr": 3, "Dr": 4, "Sn": 5, "He": 6} def f(): u, l, v = input().split() return p[u[:2]], p[v[:2]] s = [f() for k in range(int(input()))] a, b, c = map(int, input().split()) d = l = 9000000000.0 for i in range(1, 6): for j in range(1, 7 - i): ...
ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR RETURN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL...
The year of 2012 is coming... According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. But seven brave heroes have already gathered on the top of a mountain Arreat to protect us...
from itertools import combinations def main(): heroes = ("Anka", "Chapay", "Cleo", "Troll", "Dracul", "Snowy", "Hexadecimal") sympaty = [([False] * 7) for _ in range(7)] for _ in range(int(input())): a, _, b = input().split() sympaty[heroes.index(a)][heroes.index(b)] = True a, b, c = m...
FUNC_DEF ASSIGN VAR STRING STRING STRING STRING STRING STRING STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR 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 FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_...
The year of 2012 is coming... According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. But seven brave heroes have already gathered on the top of a mountain Arreat to protect us...
R = range S = str.split I = input L = S("Anka Chapay Cleo Troll Dracul Snowy Hexadecimal") h = {} for i in R(7): h[L[i]] = i d = [[] for i in R(9)] for z in "0" * int(I()): a, _, b = S(I()) d[h[a]] += [h[b]] a, b, c = map(int, S(I())) o = [10**9, 0] def C(q, w, e, n): if n == 7: if not (q and ...
ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER FOR VAR BIN_OP STRING FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR LIST VAR VAR ASSIGN VAR V...
Let's define the niceness of a sequence of positive integers X1,X2,…,XN$X_1, X_2, \dots, X_N$ as the sum of greatest common divisors of all pairs of its elements, i.e. N∑i=1N∑j=i+1gcd(Xi,Xj).∑i=1N∑j=i+1Ngcd(Xi,Xj).\sum_{i=1}^N \sum_{j=i+1}^N \mathrm{gcd}(X_i, X_j)\;. For example, the niceness of the sequence [1,2,2]$[1...
mod = 10**9 + 7 def gcd(a, b): return b and gcd(b, a % b) or a def fac50(): f = [0] * 51 f[0] = 1 f[1] = 1 for i in range(1, 51): f[i] = f[i - 1] * i % mod return f def gcd110(): gc = [([0] * 111) for i in range(111)] for i in range(111): for j in range(111): ...
ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF RETURN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR VAR RETURN VAR FUNC_DEF ASSIGN...
Lyra Belacqua is a very gifted girl. She is one of a very small set of people capable of reading an alethiometer, more commonly known as The Golden Compass. It has one specific use: to tell the truth. The name in fact, is derived from "Aletheia" meaning truth, and "-ometer", meaning "measuring device". The alethiomete...
def main(): res = 0 ind = 0 curr = [] letterflag = False chars = list(input()) for c in chars: if c.isalpha(): if letterflag: val = int("".join(curr)) res = max(res, val) curr = curr[ind:] else: lette...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR IF FUNC_CALL VAR IF VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR...
Lyra Belacqua is a very gifted girl. She is one of a very small set of people capable of reading an alethiometer, more commonly known as The Golden Compass. It has one specific use: to tell the truth. The name in fact, is derived from "Aletheia" meaning truth, and "-ometer", meaning "measuring device". The alethiomete...
t = input() r = r1 = "" mx = -1 for i in range(len(t)): if t[i] >= "A" and t[i] <= "Z": r = r1 + "9" r1 = "" else: r = r + t[i] r1 = r1 + t[i] if int(r) > mx: mx = int(r) print(mx)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR STRING ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VA...
Lyra Belacqua is a very gifted girl. She is one of a very small set of people capable of reading an alethiometer, more commonly known as The Golden Compass. It has one specific use: to tell the truth. The name in fact, is derived from "Aletheia" meaning truth, and "-ometer", meaning "measuring device". The alethiomete...
high = 0 s = input() for i in range(len(s)): gg = "" l = 0 if s[i].isdigit() == True: gg += s[i] else: gg += str(9) l = 1 j = i + 1 while j < len(s) and (l < 1 or s[j].isdigit() == True): if s[j].isdigit() == False: gg = gg + str(9) l += 1 ...
ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER VAR VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMB...
Lyra Belacqua is a very gifted girl. She is one of a very small set of people capable of reading an alethiometer, more commonly known as The Golden Compass. It has one specific use: to tell the truth. The name in fact, is derived from "Aletheia" meaning truth, and "-ometer", meaning "measuring device". The alethiomete...
str = input() l = len(str) p = 1 maxm = 0 for i in range(0, l): ans2 = "" ans1 = "" if ord(str[i]) >= 65 and ord(str[i]) <= 90: p = 0 j = i - 1 while True: if j >= 0: if ord(str[j]) >= 65 and ord(str[j]) <= 90: break els...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR STRING ASSIGN VAR STRING IF FUNC_CALL VAR VAR VAR NUMBER FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE NUMBER IF VAR NUMBER IF FUNC_CALL VAR VAR VAR N...
Lyra Belacqua is a very gifted girl. She is one of a very small set of people capable of reading an alethiometer, more commonly known as The Golden Compass. It has one specific use: to tell the truth. The name in fact, is derived from "Aletheia" meaning truth, and "-ometer", meaning "measuring device". The alethiomete...
string = input() max_no = 0 for i in range(len(string)): var_occur = 0 check_no = str() j = i while j < len(string) and var_occur < 2: if string[j].isalpha(): if var_occur == 0: check_no += "9" var_occur += 1 else: var_occur...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR WHILE VAR FUNC_CALL VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EX...
Lyra Belacqua is a very gifted girl. She is one of a very small set of people capable of reading an alethiometer, more commonly known as The Golden Compass. It has one specific use: to tell the truth. The name in fact, is derived from "Aletheia" meaning truth, and "-ometer", meaning "measuring device". The alethiomete...
s = input() start = -1 end = -1 a = [] l = len(s) for i in s: a.append(i) chars = 0 nums = 0 for i in a: if i >= "A" and i <= "Z": chars += 1 else: nums += 1 if chars <= 1: ans = "" for i in a: if i >= "0" and i <= "9": ans += i else: ans += "9...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR STRING VAR NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR VAR VAR STR...
Lyra Belacqua is a very gifted girl. She is one of a very small set of people capable of reading an alethiometer, more commonly known as The Golden Compass. It has one specific use: to tell the truth. The name in fact, is derived from "Aletheia" meaning truth, and "-ometer", meaning "measuring device". The alethiomete...
p = input() if len(p) >= 1 and len(p) <= 1000: i = 0 k = 0 x = 0 m = 0 while i < len(p): if p[i].isdigit(): j = i c = "" k = 0 if i > 0: if p[i - 1].isalpha(): c = c + "9" k = 1 ...
ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR...
Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1. There are m straight segments on the disc, the endpoints of which are all among the aforementioned ...
def divs(n): res = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: res.append(i) res.append(n // i) if int(n**0.5) ** 2 == n: res.pop() return res def main(): n, m = map(int, input().split()) angles = [set() for i in range(n)] for i in range(m)...
FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUN...
Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1. There are m straight segments on the disc, the endpoints of which are all among the aforementioned ...
n, m = map(int, input().split()) arr = [set() for i in range(n)] for i in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 f = b - a if f < 0: f += n arr[a].add(f) f = a - b if f < 0: f += n arr[b].add(f) lst = [1] for i in range(2, int(n**0.5) + 1): if n ...
ASSIGN VAR 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 VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUM...
Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1. There are m straight segments on the disc, the endpoints of which are all among the aforementioned ...
cin = lambda: [*map(int, input().split())] n, m = cin() se = set() x = [tuple(sorted(cin())) for _ in range(m)] for e in x: se.add((e[0] - 1, e[1] - 1)) for i in range(1, n): if n % i != 0: continue ok = True for e in se: if tuple(sorted([(e[0] + i) % n, (e[1] + i) % n])) not in se: ...
ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR N...
Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1. There are m straight segments on the disc, the endpoints of which are all among the aforementioned ...
n, m = [int(x) for x in input().split()] segs = set() for i in range(m): segs.add(tuple(sorted(int(x) - 1 for x in input().split()))) for i in range(1, n): if n % i != 0: continue j = 0 for a, b in segs: if tuple(sorted(((a + i) % n, (b + i) % n))) not in segs: break ...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR IF FUNC_C...
Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1. There are m straight segments on the disc, the endpoints of which are all among the aforementioned ...
import sys def No(): print("No") sys.exit() def divi(n): res = [1] for i in range(2, int(n**0.5) + 1): if n % i == 0: res.append(i) if i != n // i: res.append(n // i) return res N, M = map(int, input().split()) DN = divi(N) dis = [set() for _ in ...
IMPORT FUNC_DEF EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC...
Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1. There are m straight segments on the disc, the endpoints of which are all among the aforementioned ...
n, m = map(int, input().split()) a = [] for i in range(m): a.append(list(map(int, input().split()))) if a[i][0] > a[i][1]: a[i][0], a[i][1] = a[i][1], a[i][0] if a[i][1] - a[i][0] > n / 2: a[i][0] += n a[i][0], a[i][1] = a[i][1], a[i][0] if m == 1: if a[0][1] - a[0][i] == n / 2: ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR NUMBER VAR VAR NUMBER VAR VAR NUMBER VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER VAR VAR NUMBER BIN_OP...
Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1. There are m straight segments on the disc, the endpoints of which are all among the aforementioned ...
nz = [int(x) for x in input().split()] edges = set() divisors = set() for x in range(0, nz[1]): uv = [y for y in input().split()] edges.add(uv[0] + " " + uv[1]) for x in range(1, nz[0]): if nz[0] % x == 0: divisors.add(x) flag = 0 for y in divisors: flag = 0 for x in edges: u = (int(...
ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER STRING VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER VAR NUM...
Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1. There are m straight segments on the disc, the endpoints of which are all among the aforementioned ...
def getPrimeDivisors(n): primes = [True] * (n + 1) primes[0] = False primes[1] = False for i in range(2, n + 1): if primes[i]: tmp = i * 2 while tmp <= n: primes[tmp] = False tmp += i divs = [] for k, v in enumerate(primes): ...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR NUMBER VAR VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR VAR NUMBER EXPR FU...
Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1. There are m straight segments on the disc, the endpoints of which are all among the aforementioned ...
n, m = map(int, input().split()) a = set() for i in range(m): c, d = map(int, input().split()) c %= n d %= n a.add((min(c, d), max(c, d))) def comprobar(x): global a, n b = set() for c, d in a: c += x d += x c %= n d %= n if (min(c, d), max(c, d)) no...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR VAR VAR VAR VAR VAR VAR VA...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
lines = [] for i in range(4): lines.append(list(map(int, input().split(" ")))) first_dots = [i[:2] for i in lines] second_dots = [i[2:4] for i in lines] dots = first_dots + second_dots def loop8(i): if i < 4: return i + 4 else: return i - 4 is_line = [(first_dots[dot] != second_dots[dot]...
ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER NUMBER VAR VAR ASSIGN VAR BIN_OP VAR VAR FUNC_DEF IF VAR NUMBER RETURN BIN_OP VAR NUMBER RETURN BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR VAR ...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
points = {} x = set() y = set() segms = set() for i in range(4): x1, y1, x2, y2 = map(int, input().split()) x.add(x1) x.add(x2) y.add(y1) y.add(y2) a = x1, y1 b = x2, y2 segms.add((min(a, b), max(a, b))) if len(set([y1, y2])) + len(set([x1, x2])) != 3: print("NO") bre...
ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR EXPR ...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
accepted = True lines = [] dic = {} for i in range(4): line = list(map(int, input().split(" "))) if line[0] == line[2] and line[1] == line[3]: accepted = False lines.append(((line[0], line[1]), (line[2], line[3]))) if not (line[0] == line[2] or line[1] == line[3]): accepted = False i...
ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def is_rect(): def seg(): [x0, y0, x1, y1] = input().split(" ") return int(x0), int(y0), int(x1), int(y1) def parallel(x0, x1, y0, y1, x2, x3, y2, y3): return ( y0 == y1 and y2 == y3 and y0 != y2 and (x2 == x0 and x3 == x1 or x3 == x0 and...
FUNC_DEF FUNC_DEF ASSIGN LIST VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR FUNC_DEF RETURN VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR ASSIGN ...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def read_points(): hSegs = [] vSegs = [] for i in range(4): rawline = input().split() line = { "p1": [int(rawline[0]), int(rawline[1])], "p2": [int(rawline[2]), int(rawline[3])], } if line["p1"][0] == line["p2"][0]: if line["p1"][1] > line[...
FUNC_DEF ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT STRING STRING LIST FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER LIST FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR STRING NUMBER VAR STRING NUMBER IF VAR STRING NUMBER VAR STRING NUMB...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def main(): segments = [list(map(int, input().split())) for _ in range(4)] start = segments[0][0], segments[0][1] point = segments[0][2], segments[0][3] points = set() points.add(start) points.add(point) coords = [set(), set()] coords[0].add(point[0]) coords[0].add(start[0]) coor...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
a = [tuple(map(int, input().split())) for i in range(4)] a = [ ((x1, y1, x2, y2) if (x1, y1) < (x2, y2) else (x2, y2, x1, y1)) for x1, y1, x2, y2 in a ] x0, x1, y0, y1 = ( min(a[0][0], a[0][2], a[1][0], a[1][2], a[2][0], a[2][2], a[3][0], a[3][2]), max(a[0][0], a[0][2], a[1][0], a[1][2], a[2][0], a[2][2...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR ...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
s = {(0): 0, (1): 0} for i in range(4): a, b, c, d = input().split() if a == c and b != d: s[0] += 1 if b == d and a != c: s[1] += 1 for q in [(a, b), (c, d)]: s[q] = s.get(q, 0) + 1 print("YES" if all(i == 2 for i in s.values()) else "NO")
ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR VAR VAR VAR NUMBER NUMBER IF VAR VAR VAR VAR VAR NUMBER NUMBER FOR VAR LIST VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def main(): dict = {(0): 0, (1): 0} final = "YES" for i in range(4): x1, y1, x2, y2 = input().split() if x1 == x2 and y1 != y2: dict[0] += 1 elif y1 == y2 and x1 != x2: dict[1] += 1 for j in [(x1, y1), (x2, y2)]: dict[j] = dict.get(j, 0) + ...
FUNC_DEF ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR VAR VAR VAR NUMBER NUMBER IF VAR VAR VAR VAR VAR NUMBER NUMBER FOR VAR LIST VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR FUNC_CAL...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def main(): coo = [] coords = [[], [], [], []] dia = 0 for i in range(4): x1, y1, x2, y2 = map(int, input().split()) coo.append([x1, y1]) coo.append([x2, y2]) coords[i].append(min([x1, y1], [x2, y2])) coords[i].append(max([x1, y1], [x2, y2])) if x1 != x2 a...
FUNC_DEF ASSIGN VAR LIST ASSIGN VAR LIST LIST LIST LIST LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR EXPR FUNC_CALL VAR VAR FUNC_CALL VAR LIST VAR VAR LIST VAR VAR EXPR FUNC_CALL VAR V...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
Lines = 4 * [None] for i in range(4): Lines[i] = list(map(int, input().split())) if Lines[i][0] == Lines[i][2]: Lines[i][1], Lines[i][3] = min(Lines[i][1], Lines[i][3]), max( Lines[i][1], Lines[i][3] ) elif Lines[i][1] == Lines[i][3]: Lines[i][0], Lines[i][2] = min(Lines[...
ASSIGN VAR BIN_OP NUMBER LIST NONE FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR NUMBER VAR VAR NUMBER FUNC_CALL VAR VAR VAR NUMBER VAR VAR NUMBER FUNC_CALL VAR VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR NUMBER VAR VAR N...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
liste = [] i = 0 i2 = 0 distance = [] answer = "YES" for _ in range(4): x1, y1, x2, y2 = map(int, input().split(" ")) liste.append([(x1, y1), (x2, y2)]) def perpendiculaire(vect1, vect2): return vect1[0] * vect2[0] + vect1[1] * vect2[1] def search(liste, point, excluded_index): for i in range(4): ...
ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR LIST VAR VAR VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER FUNC_DEF FOR...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def is_rect(es): v = set([]) for e in es: if not (e[0] == e[2] or e[1] == e[3]): return False v.add((e[0], e[1])) v.add((e[2], e[3])) if len(v) != 4: return False xs = set([]) ys = set([]) for vi in v: xs.add(vi[0]) ys.add(vi[1]) if...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR LIST FOR VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER IF FUNC_CALL VAR VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR LIST ASSIGN VAR FUNC_CALL VAR LIST FOR VAR VAR EXPR FUNC_CA...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def segmentos_iguales(l1, l2): return l1[:2] == l2[2:4] and l1[2:4] == l2[:2] or l1 == l2 def paralela(linea): return linea[0] == linea[2] or linea[1] == linea[3] def degenerada(linea): return linea[0] == linea[2] and linea[1] == linea[3] lineas = [] for _ in range(4): lineas.append(input().split(...
FUNC_DEF RETURN VAR NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER VAR VAR FUNC_DEF RETURN VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FUNC_DEF RETURN VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR F...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def main(): line_1 = input().strip().split() line_1 = list(map(int, line_1)) line_2 = input().strip().split() line_2 = list(map(int, line_2)) line_3 = input().strip().split() line_3 = list(map(int, line_3)) line_4 = input().strip().split() line_4 = list(map(int, line_4)) x_line_count...
FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def checkXY(line): if line[0] == line[2] and line[1] != line[3]: return "X" elif line[1] == line[3] and line[0] != line[2]: return "Y" lines = [list(map(int, input().split())) for _ in range(4)] output = "YES" for line in lines: if checkXY(line) is None: output = "NO" for i in rang...
FUNC_DEF IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN STRING IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR VAR IF FUNC_CALL VAR VAR NONE ASSIGN VAR STRING FOR VAR FUNC_CALL VAR N...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
pontos = set() retas = set() fail = False for i in range(0, 4): s = list(map(int, input().split())) if s[0] != s[2] and s[1] != s[3]: fail = True p1 = s[0], s[1] p2 = s[2], s[3] if p1 == p2: fail = True menor = min(p1, p2) maior = max(p1, p2) retas.add((menor[0], menor[1]...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN ...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
from sys import stdin class my_vector: def __init__(self, x1, y1, x2, y2): self.i_coord = x1, y1 self.end_coord = x2, y2 self.my_vector = y2 - y1, x2 - x1 def __mul__(self, other): return ( self.my_vector[0] * other.my_vector[0] + self.my_vector[1] * o...
CLASS_DEF FUNC_DEF ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER FUNC_DEF ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
H, V = 0, 0 p = set() s = set() for _ in range(4): x, y, x_, y_ = list(map(int, input().split())) if x == x_: V += 1 if y == y_: H += 1 p.add((x, y)) p.add((x_, y_)) s.add(((x, y), (x_, y_))) s.add(((x_, y_), (x, y))) if len(s) != 8 or len(p) != 4 or H != 2 or V != 2: pri...
ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR VAR NUMBER IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR ...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
__author__ = "Darren" def solve(): points = set() horizontal, vertical = 0, 0 horizontal_lines, vertical_lines = [], [] for _i in range(4): x1, y1, x2, y2 = map(int, input().split()) if x1 != x2 and y1 != y2 or x1 == x2 and y1 == y2: print("NO") return e...
ASSIGN VAR STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR LIST LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR STRING RETURN IF VAR VAR VAR VAR VAR NUMBER IF VAR VAR EXPR FUNC_C...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
respuesta = True puntos = [] todos = [] Xcords = [] Ycords = [] verticales = 0 horizontales = 0 for k in range(0, 4): linea = input().split(" ") if linea[0] == linea[2] and linea[1] == linea[3]: respuesta = False elif linea[0] != linea[2] and linea[1] != linea[3]: respuesta = False elif ...
ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR N...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
hor = [] ver = [] points = [] for i in range(4): data = input() lst = [int(i) for i in data.split()] x1, y1, x2, y2 = lst points.extend([[x1, y1], [x2, y2]]) if x1 == x2: if y1 != y2: ver.append(y1) elif y1 == y2: if x1 != x2: hor.append(x1) else: ...
ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR LIST LIST VAR VAR LIST VAR VAR IF VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR IF VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR ASSI...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
puntos = {(0): 0, (1): 0} for i in range(4): linea = list(map(int, input().split())) p1 = linea[0], linea[1] p2 = linea[2], linea[3] if p1[0] == p2[0] and p1[1] != p2[1]: puntos[0] += 1 elif p1[0] != p2[0] and p1[1] == p2[1]: puntos[1] += 1 for punto in [p1, p2]: puntos[p...
ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VA...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def check(): coordenadas = set() ejes_equis = set() ejes_ygriega = set() combis_lineas = [] for n in range(4): actual = input().split(" ") coords = [actual[0] + "-" + actual[1], actual[2] + "-" + actual[3]] exes = [actual[0], actual[2]] yes = [actual[1], actual[3]] ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST BIN_OP BIN_OP VAR NUMBER STRING VAR NUMBER BIN_OP BIN_OP VAR NUMBER STRING VAR NUMBER ASSIGN VAR LIST VAR NUMBER VAR NUMBER ASSIGN VA...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
segments = [] for i in range(4): segments.append(tuple(map(int, input().split()))) for i in range(len(segments)): x1, y1, x2, y2 = segments[i] if x2 < x1: segments[i] = x2, y2, x1, y1 if y2 < y1: segments[i] = x2, y2, x1, y1 if len(set(segments)) != 4: print("NO") exit() for i in...
ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER EXP...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
def distance(a, b, c, d): return (d - b) ** 2 + (c - a) ** 2 def slope(a, b, c, d): if a == c: return float("inf") else: return (d - b) / (c - a) def CF14C(): infinity = 0 zero = 0 counter = {} points = set() for i in range(4): a, b, c, d = list(map(int, input...
FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER FUNC_DEF IF VAR VAR RETURN FUNC_CALL VAR STRING RETURN BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
Vertical = [] Horizontal = [] check = True for i in range(0, 4): T = [int(x) for x in input().split()] if T[0] == T[2] and T[1] == T[3]: check = False elif T[0] == T[2]: Vertical.append(T) elif T[1] == T[3]: Horizontal.append(T) else: check = False if len(Vertical) ==...
ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBE...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
a = [] for i in range(4): b = list(map(int, input().split())) a.append([b[:2], b[2:]]) c = [] a0 = [[[k for k in j] for j in i] for i in a] for i in range(4): z = 0 for k in range(2): if a[i][k] != -1: for j in range(4): if ( i != j ...
ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR NUMBER VAR NUMBER ASSIGN VAR LIST ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR NUMBER FOR VAR F...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
x, y = 0, 0 mp = {} for i in range(4): x1, y1, x2, y2 = map(int, input().split()) if x1 == x2 and y1 != y2: x += 1 if y1 == y2 and x1 != x2: y += 1 if (x1, y1) not in mp: mp[x1, y1] = 1 else: mp[x1, y1] += 1 if (x2, y2) not in mp: mp[x2, y2] = 1 else: ...
ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR VAR VAR NUMBER A...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
a = {} ox, oy = 0, 0 for i in range(4): x1, y1, x2, y2 = map(int, input().split()) a[x1, y1] = a.get((x1, y1), 0) + 1 a[x2, y2] = a.get((x2, y2), 0) + 1 if x1 == x2 and y1 != y2: ox += 1 if y1 == y2 and x1 != x2: oy += 1 ans = "YES" for p in a.values(): if p != 2: ans = "...
ASSIGN VAR DICT ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER IF VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR VAR VAR NUMB...
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
arr = [] arr1 = [] arr2 = [] for i in range(0, 4): x1, y1, x2, y2 = map(int, input().split()) p1 = x1, y1 p2 = x2, y2 p3 = x1, y1, x2, y2 arr2.append(p3) arr.append(p1) arr.append(p2) arr1 = list(set(arr)) if len(arr1) > 4 or len(arr1) < 4: print("NO") exit() minx = 10000000000 maxx ...
ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VA...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
from itertools import permutations nums = list(map(int, input().split())) o = input().split() print( min( eval("min(((a{0}b){1}c){2}d,(a{0}b){2}(c{1}d))".format(*o)) for a, b, c, d in permutations(nums) ) )
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING VAR VAR VAR VAR VAR FUNC_CALL VAR VAR
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
n = list(map(int, input().split())) s = input() n.sort() if s == "+ + +": print(sum(n)) elif s == "+ + *": print(n[0] * sum(n[1:4])) elif s == "+ * +" or s == "* + +": print(n[2] + n[3] + n[0] * n[1]) elif s == "* * *": print(n[0] * n[1] * n[2] * n[3]) elif s == "* * +": print(n[0] * n[3] + n[1] * n...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR NUMBER NUMBER IF VAR STRING VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER VAR NU...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def f(q, t): a, b, c = sorted(q) if t == "**": return a * b * c if t == "++": return a + b + c if t == "*+": return a * b + c if t == "+*": return a * (b + c) p = sorted(list(map(int, input().split()))) t = input()[::2] x, t = t[0], t[1:] if x == "*": s = p[0] *...
FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR IF VAR STRING RETURN BIN_OP BIN_OP VAR VAR VAR IF VAR STRING RETURN BIN_OP BIN_OP VAR VAR VAR IF VAR STRING RETURN BIN_OP BIN_OP VAR VAR VAR IF VAR STRING RETURN BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIG...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
from itertools import combinations nl = list(map(int, input().split())) ol = input().split() ans = 10000000000000 for x in combinations(nl, 2): a, b = x tl = nl[:] tl.remove(a) tl.remove(b) if ol[0] == "+": tl.append(a + b) else: tl.append(a * b) for y in combinations(tl, 2)...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VA...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def fun(a, op): lst = [] for i in range(0, len(a)): for j in range(i + 1, len(a)): k = a.copy() k.remove(a[i]) k.remove(a[j]) if op == "+": k.append(a[i] + a[j]) else: k.append(a[i] * a[j]) lst.append...
FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CAL...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
nums = list(map(int, input().split())) ops = input().split() ans = float("inf") def solve(nums, ops, level): global ans if len(nums) == 1: ans = min(ans, nums[0]) return n = len(nums) for i in range(n): for j in range(i + 1, n): l = nums[i] r = nums[j] ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FUNC_DEF IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER RETURN ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASS...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
s = list(map(int, input().split())) d = list(input().split()) min_ = 1000**4 for i in range(4): for j in range(i + 1, 4): if d[0] == "+": test1 = s[i] + s[j] test2 = s[i] + s[j] test3_1 = s[i] + s[j] else: test1 = s[i] * s[j] test2 = s[i] *...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF VAR NUMBER STRING ASSIGN VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR ASSIGN ...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
import itertools terms = list(map(int, input().split())) operators = input().split() def seek(terms, operators): best = None if len(terms) == 1: return terms[0] for i, a in enumerate(terms): for j in range(i + 1, len(terms)): b = terms[j] if operators[0] == "+": ...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NONE IF FUNC_CALL VAR VAR NUMBER RETURN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER STRING ASSIGN VAR B...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
I = input a = I().split() def f(s, z): if not z: return int(s[0]) m = 10**99 for i in s: t = s[:] t.remove(i) for j in t: k = t[:] k.remove(j) m = min(m, f(k + [str(eval(i + z[0] + j))], z[1:])) return m print(f(a, I().split()))
ASSIGN VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR RETURN FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR LIST FUNC_CALL VAR FUNC_CALL VAR BIN...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def z(a, b, k=0, f=1): n = len(a) if n == 2: if b[k] == "+": return a[0] + a[1] return a[0] * a[1] c = -1 for i in range(n): for j in range(i + 1, n): if b[k] == "+": g = list(a) a[i] += a[j] a = a[:j] + a[j ...
FUNC_DEF NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR VAR STRING RETURN BIN_OP VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR ASSIGN VAR BI...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
import sys class Main: def __init__(self): self.buff = None self.index = 0 def next(self): if self.buff is None or self.index == len(self.buff): self.buff = self.next_line() self.index = 0 val = self.buff[self.index] self.index += 1 ret...
IMPORT CLASS_DEF FUNC_DEF ASSIGN VAR NONE ASSIGN VAR NUMBER FUNC_DEF IF VAR NONE VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR F...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
a = list(map(int, input().split())) o = list(map(str, input().split())) min_elem = float("inf") def f(a, o): n = len(a) global min_elem if n == 1: min_elem = min(min_elem, a[0]) elif o[0] == "+": if n == 2: f([a[0] + a[1]], []) elif n == 3: f([a[0] + a[1...
ASSIGN VAR FUNC_CALL 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 STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR NUMBER STRING IF VAR NUMBER EXPR FUNC_CALL VAR LIST BIN...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def rec(num, com): if len(num) == 1: return num[0] ret = 10**100 for i in range(len(num)): for j in range(i + 1, len(num)): residual = [] for k in range(len(num)): if k != i and k != j: residual.append(num[k]) if com[0] ...
FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER STRING EXPR FUNC_CA...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
ans = float("inf") op = { "+": lambda x, y: x + y, "-": lambda x, y: x - y, "/": lambda x, y: x / y, "*": lambda x, y: x * y, } def rec_3(a, b): global ans temp = 0 temp = op[st[2]](a, b) if st[2] == "+" else op["*"](a, b) ans = min(ans, temp) def rec_2(a, b, c): if st[1] == "+":...
ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR DICT STRING STRING STRING STRING BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER STRING FUNC_CALL VAR VAR NUMBER VAR VAR FUNC_CALL VAR STRING VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_DEF IF VAR NUMBER STRING EXP...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def a(op_num, inp): if op_num == 3: if m[0] < 0 or res[0] < m[0]: m[0] = res[0] return for i in range(len(inp) - 1): for j in range(i + 1, len(inp)): temp = res[0] res[0] = inp[i] * inp[j] if ops[op_num] == "*" else inp[i] + inp[j] temp...
FUNC_DEF IF VAR NUMBER IF VAR NUMBER NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER RETURN FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER VAR VAR STRING BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR ASSIG...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def cal(a, b, c): if c[0] == "+": return int(a) + int(b) return int(a) * int(b) num = input().split() op = input().split() def DFS(l, no): if no == 3: return int(l[0]) else: ln = len(l) ans = 10**100 for i in range(ln): for j in range(i + 1, ln): ...
FUNC_DEF IF VAR NUMBER STRING RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER RETURN FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR ...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def f(a, b, c, t): if t == "**": return a * b * c if t == "++": return a + b + c if t == "*+": return a * b + c if t == "+*": return a * (b + c) a, b, c, d = sorted(list(map(int, input().split()))) t = input()[::2] if t == "*+*": print(a * (b * c + d)) elif t == "**...
FUNC_DEF IF VAR STRING RETURN BIN_OP BIN_OP VAR VAR VAR IF VAR STRING RETURN BIN_OP BIN_OP VAR VAR VAR IF VAR STRING RETURN BIN_OP BIN_OP VAR VAR VAR IF VAR STRING RETURN BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBE...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
ar = list(map(int, input().split())) br = input().split() ans = float("inf") def gen(ar, ind): global ans if len(ar) == 1: ans = min(ans, ar[0]) return for i in range(len(ar)): for j in range(i): nw = ar.copy() vl = ar[i] + ar[j] if br[ind] == "+" else ar[i]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FUNC_DEF IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER RETURN FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR ...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
from itertools import permutations ch = list(map(int, input().split())) op = list(input().split()) def f(oper, x, y): if oper == "*": return x * y else: return x + y ans = 10**12 for a, b, c, d in permutations(ch): ans = min( ans, min( f(op[2], f(op[1], f(op[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR STRING RETURN BIN_OP VAR VAR RETURN BIN_OP VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def combs(a, op, ans): if 1 == len(a): if a[0] < ans[0]: ans[0] = a[0] return for i in range(len(a)): for j in range(i + 1, len(a)): na = [] for k in range(len(a)): if k != i and k != j: na.append(a[k]) i...
FUNC_DEF IF NUMBER FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER RETURN FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER STRING E...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def fun(arr, op, o): if o == 3: return arr[-1] mn = float("inf") for i in range(0, 3): if arr[i] == -1: continue var = arr[i] arr[i] = -1 for j in range(i, 4): if arr[j] == -1: continue var2 = arr[j] if o...
FUNC_DEF IF VAR NUMBER RETURN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR VAR IF VAR VAR STRING ASSIGN VAR VAR BIN_OP VAR VAR VAR IF VAR VAR STRING ASSIGN VAR V...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def cal(n, c): if c == 1: return sum(n) elif c == 2: return n[0] * n[1] * n[2] * n[3] elif c == 3: return n[0] * (n[1] + n[2] + n[3]) elif c == 4: return n[0] * n[1] + n[2] + n[3] elif c == 5: return n[0] * n[1] + n[2] + n[3] elif c == 6: return (n...
FUNC_DEF IF VAR NUMBER RETURN FUNC_CALL VAR VAR IF VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER RETURN BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER ...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
a, b, c, d = list(map(int, input().strip().split(" "))) first, second, third = input().strip().split(" ") min_value = 1000000000000 if first == "+": f_op = [ [a + b, c, d], [a + c, b, d], [a + d, b, c], [b + c, a, d], [b + d, a, c], [c + d, a, b], ] else: f_op...
ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR STRING ASSIGN VAR LIST LIST BIN_OP VAR VAR VAR VAR LIST BIN_OP VAR VAR VAR VAR LIST BIN_OP VAR VAR VAR VAR LIST BIN_OP VAR VAR VAR VAR LIST...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def perform(a, b, o): if o == "+": return a + b return a * b def fun(arr, op, ind): if ind == 3: return arr[0] mn = float("inf") for i in range(0, len(arr) - 1): for j in range(i + 1, len(arr)): new_arr = arr.copy() new_arr[j] = perform(arr[j], arr[i...
FUNC_DEF IF VAR STRING RETURN BIN_OP VAR VAR RETURN BIN_OP VAR VAR FUNC_DEF IF VAR NUMBER RETURN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR...
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
def delete(i, j, l): t = [] m = 0 while m < len(l): if m != i and m != j: t.append(l[m]) m += 1 return t n = list(map(int, input().split())) o = list(input().split()) n = [n] def brute(l, u): i = 0 second = list() while i < len(l): j = 0 while ...
FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CA...
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
def main(): grumpy = [ "don't even", "are you serious?", "worse", "terrible", "no way", "go die in a hole", ] print(9) res = input() if res in grumpy: print("grumpy") return else: print("normal") return main()
FUNC_DEF ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN EXPR FUNC_CALL VAR STRING RETURN EXPR FUNC_CALL VAR
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
import sys flag = 0 q = set() for i in range(10): print(i) sys.stdout.flush() s = input() if s != "no": if ( s in "great!" or s in "don't think so" or s in "not bad" or s in "cool" or s in "don't touch me!" ): print...
IMPORT ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR STRING IF VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
import sys good = {"great", "not bad", "cool", "don't touch me", "don't think so"} for i in range(10): print(i) sys.stdout.flush() s = input() if s == "no way" or s != "no" and s not in good: print("grumpy") exit(0) elif s in good: print("normal") exit(0)
IMPORT ASSIGN VAR STRING STRING STRING STRING STRING FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR STRING VAR STRING VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
for i in range(10): print(i) reaction = input() if reaction != "no": for part in ("no way", "die", "worse", "terrible", "even", "are"): if part in reaction: print("grumpy") break else: print("normal") break
FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR STRING FOR VAR STRING STRING STRING STRING STRING STRING IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
normal = dict() normal["no"] = 5 normal["don't think so"] = 1 normal["don't touch me"] = 1 normal["great"] = 1 normal["not bad"] = 1 normal["cool"] = 1 print(9, flush=True) res = input().strip() if res not in normal: print("grumpy", flush=True) else: print("normal", flush=True)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING NUMBER
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
i = 0 while 1: print(i) i += 1 x = input()[-2:] if x != "no": print(["normal", "grumpy"][x in "lenuseay"]) break
ASSIGN VAR NUMBER WHILE NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER IF VAR STRING EXPR FUNC_CALL VAR LIST STRING STRING VAR STRING
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
import sys i, ans = 0, "no" while ans == "no": print(i) i += 1 sys.stdout.flush() ans = input() if ans[:3] in ("gre", "don", "not", "coo") and not ans.endswith("even"): print("normal") else: print("grumpy")
IMPORT ASSIGN VAR VAR NUMBER STRING WHILE VAR STRING EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER STRING STRING STRING STRING FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
import sys normal = False nos = 0 for i in range(10): print(i) sys.stdout.flush() s = input() if s in ["cool", "great", "don't think so", "not bad", "don't touch me"]: normal = True break elif s != "no": break else: nos += 1 if nos > 3: normal...
IMPORT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR LIST STRING STRING STRING STRING STRING ASSIGN VAR NUMBER IF VAR STRING VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR STRING STRING
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
flag = False for i in range(10): print(i) j = input().strip() if ( j == "cool" or j == "not bad" or j == "great" or j == "don't think so" or j == "don't touch me" ): flag = True break if j != "no": break if flag: print("normal") els...
ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING ASSIGN VAR NUMBER IF VAR STRING IF VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
no = 0 for i in range(10): print(i) inp = input() if inp == "no": no += 1 if no == 4: exit(print("normal")) continue if ( inp == "cool" or inp == "don't think so" or inp == "not bad" or inp == "don't touch me" or inp == "great" ...
ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR STRING VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR STRING IF VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR STRING
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
for i in range(10): print(i) t = input() if t in [ "no way", "go die in a hole", "are you serious", "worse", "terrible", "don't even", ]: print("grumpy") exit(0) elif t != "no": print("normal") exit(0)
FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR LIST STRING STRING STRING STRING STRING STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
n = [ "no", "great", "dontthinkso", "donttouchme", "notbad", "cool", "no", "no", "no", "no", ] g = [ "no", "donteven", "areyouserious", "godieinahole", "worse", "terrible", "noway", "noway", "no", "no", ] for i in range(10): print(i, fl...
ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR VAR FUNC_CALL FUNC_CALL VAR STRING VAR STRING IF VAR VAR ...
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
import sys for i in range(10): print(i) sys.stdout.flush() a = sys.stdin.readline().strip().lower() if "cool" in a or "great" in a or "not bad" in a or "think" in a: print("normal") sys.exit(0) if ( "die" in a or "serious" in a or "way" in a or "worse...
IMPORT FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR IF STRING VAR STRING VAR STRING VAR STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF STRING VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING VAR EXPR FUNC_CALL VAR STRING EXP...
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
i = 0 print(i) ch = input() if ch == "no": i = i + 1 while ch == "no": print(i) ch = input() i = i + 1 if ( ch == "don't even" or ch == "terrible" or ch == "worse" or ch == "are you serious" or ch == "go die in a hole" or ch == "no way" ): print("grumpy") else...
ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR STRING ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STR...
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
grumpy = [ "are you serious", "don't even", "go die in a hole", "terrible", "worse", "no way", ] grumpyFlag = False for i in range(10): print(i) response = input() if response == "no": continue elif response in grumpy: grumpyFlag = True break else: ...
ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR STRING IF VAR VAR ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
for i in range(10): print(i) b = input() if ( "don't even" in b or "terrible" in b or "serious" in b or "worse" in b or "go die" in b or "way" in b ): print("grumpy") break elif b != "no": print("normal") break elif ...
FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF STRING VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING VAR EXPR FUNC_CALL VAR STRING IF VAR STRING EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
import sys from sys import exit a = ["no", "no", "no", "no", "no", "don'", "grea", "don'", "not ", "cool"] b = ["no", "no", "no", "no w", "no w", "go d", "wors", "terr", "don'", "are "] for i in range(9): sys.stdout.write(str(i)) sys.stdout.write("\n") sys.stdout.flush() inp = input() if inp.__len_...
IMPORT ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF FU...
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
import sys def check(s): if s == "no": return "dn" elif s in ["great", "don't think so", "don't touch me", "not bad", "cool"]: return "n" else: return "g" print(0) sys.stdout.flush() t = check(input()) for i in range(1, 10): if t == "dn": print(i) sys.stdout.f...
IMPORT FUNC_DEF IF VAR STRING RETURN STRING IF VAR LIST STRING STRING STRING STRING STRING RETURN STRING RETURN STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ...
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
def main(): for i in range(10): print(i) result = str(input()) if result == "no": continue if ( result == "cool" or result == "great" or result == "don't think so" or result == "don't touch me" or result == "not ...
FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR STRING IF VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
grum = [ "don't even", "are you serious", "go die in a hole", "worse", "terrible", "no way", ] for i in range(10): print(i) s = str(input()).lower() if s != "no": print("grumpy" if s in grum else "normal") break
ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR IF VAR STRING EXPR FUNC_CALL VAR VAR VAR STRING STRING
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
a = ["great", "don't think so", "not bad", "don't touch me", "cool"] for i in range(10): print(i) ans = input() if ans != "no": if ans in a: print("normal") exit() else: print("grumpy") exit()
ASSIGN VAR LIST STRING STRING STRING STRING STRING FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR STRING IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR
If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat. <image> However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat. <image> You have met a cat. Can you figure out w...
for i in range(0, 10): print(i, flush=True) s = input() if s != "no": print(["normal", "grumpy"][s[-2:] in "lenuseay"], flush=True) break
FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR IF VAR STRING EXPR FUNC_CALL VAR LIST STRING STRING VAR NUMBER STRING NUMBER