description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def case(a): if max(a) > sum(a) - max(a): return 0 else: return not sum(a) % 2 def solve(): for _ in range(int(input())): input() print(["T", "HL"][case(list(map(int, input().split())))]) solve()
FUNC_DEF IF FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR RETURN NUMBER RETURN BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR LIST STRING STRING FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUN...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys T = int(input()) for i in range(T): n = input() arr = [int(x) for x in input().split()] maks = max(arr) jumlah = sum(arr) - max(arr) if maks > jumlah: print("T") else: print("T" if (maks + jumlah) % 2 == 1 else "HL")
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBE...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def checkMax(pilesArr, n): pilesArr.sort() pilesArrSum = sum(pilesArr) if pilesArr[-1] > pilesArrSum - pilesArr[-1]: return "T" else: if pilesArrSum % 2 == 0: return "HL" return "T" testCases = input() for i in range(int(testCases)): numOfPiles = int(input()) ...
FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER BIN_OP VAR VAR NUMBER RETURN STRING IF BIN_OP VAR NUMBER NUMBER RETURN STRING RETURN STRING ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
(T,) = map(int, input().split()) for _ in range(T): (N,) = map(int, input().split()) X = list(map(int, input().split())) if N == 1: print("T") continue if N == 2: if X[0] == X[1]: print("HL") else: print("T") continue X.sort() if X[...
ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL V...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) ct = [(0) for _ in range(100)] for x in input().split(): ct[int(x) - 1] += 1 j = -1 while True: aflag, bflag = False, False for i in range(99, -1, -1): if ct[i] > 0: if i != j - 1 or ct[i] != 1: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR VAR...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def f(list): sum = 0 max = -1 ii = len(list) if ii == 1: return 1 for i in range(ii): buff = int(list[i]) sum += buff if buff > max: max = buff sum -= max if max > sum: return 1 elif max == sum: return 0 else: return...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR IF VAR VAR RETURN NUMBER IF VAR VAR RETURN NUMBER RETURN BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_C...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n, lst, sam, man = int(input()), list(map(int, input().split(" "))), 0, 0 for i in lst: sam, man = sam + i, max(man, i) print("T" if sam & 1 or n == 1 or man > sam - man else "HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER VAR BIN_OP VAR VAR STRING STRI...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for i in range(int(input())): n = int(input()) a = sorted(list(map(int, input().split()))) add = sum(a[:-1]) if a[-1] > add: print("T") else: print(["HL", "T"][(add + a[-1]) % 2])
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR LIST STRING STRING BIN_OP BIN_OP VAR VAR NUMBER NUM...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
T = 1 T = int(input()) while T: T -= 1 n = int(input()) a = list(map(int, input(" ").split())) Max = a[0] Sum = 0 for i in a: Sum += i Max = max(Max, i) if Max > Sum - Max or Sum % 2 == 1: print("T") else: print("HL")
ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR BIN_OP VAR VAR BIN_OP VAR NUM...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) for _ in range(t): even = 0 odd = 0 n = int(input()) l = list(map(int, input().split())) l.sort() if l[-1] > sum(l[:-1]): print("T") elif sum(l) % 2 == 0: print("HL") else: print("T")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP FUNC_CALL VAR VAR N...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) for t_ in range(t): n = int(input()) a = [int(x) for x in input().split()] if len(a) == 1: print("T") if len(a) == 2: if a[0] == a[1]: print("HL") else: print("T") if len(a) >= 3: if max(a) > sum(a) - max(a): print(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) sum = 0 for i in A: sum += i if A[0] > sum - A[0] or sum % 2 != 0: print("T") else: print("HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR IF VAR NUMBER BIN_OP VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CAL...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys input = sys.stdin.readline cases = int(input()) for tt in range(cases): n = int(input()) a = [int(x) for x in input().split()] flag = False s = 0 if n == 1: print("T") continue if n == 2: if a[0] != a[1]: print("T") else: print(...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STR...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def solve(testCase, pile, stone): stone.sort(reverse=True) player1 = 0 player2 = 0 sum = 0 for i in stone: sum += int(i) if 2 * int(stone[0]) > sum: return "T" elif sum % 2 == 0: return "HL" else: return "T" testCase = int(input()) while testCase: te...
FUNC_DEF EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR IF BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER VAR RETURN STRING IF BIN_OP VAR NUMBER NUMBER RETURN STRING RETURN STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys input = iter(sys.stdin.read().splitlines()).__next__ def solve(N, A): if N == 1: return "T" s = sum(A) m = max(A) if m > s - m: return "T" return "T" if s % 2 == 1 else "HL" TC = int(input()) for tc in range(TC): N = int(input()) A = list(map(int, input().spli...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER RETURN STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR VAR RETURN STRING RETURN BIN_OP VAR NUMBER NUMBER STRING STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL V...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) a = [] while t > 0: t -= 1 n = int(input()) a = list(map(int, input().split())) mx = 0 sum = 0 for i in range(n): if a[i] > mx: mx = a[i] sum += a[i] if mx << 1 > sum: print("T") else: print("T" if sum & 1 else "HL")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR IF BIN_OP VAR NUMBER VA...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys def i(): return sys.stdin.readline()[:-1] def solve(held, piles, stoneCount): winning = True while True: if piles[-1] > stoneCount // 2: break winning = not winning nextHeld = piles.pop() - 1 if held != 0: piles.append(held) held...
IMPORT FUNC_DEF RETURN FUNC_CALL VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER WHILE NUMBER IF VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER EXPR FUNC_CALL VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys t = int(sys.stdin.readline().strip()) for _ in range(t): n = int(sys.stdin.readline().strip()) nums = list(map(int, sys.stdin.readline().strip().split())) prev = -1 t_win = False while True: best = 0 best_ind = None for i in range(n): if i == prev: ...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR NUMBER ASSIGN VAR NONE FOR VAR FUNC_CALL VAR VAR IF ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) for o in range(t): n = int(input()) a = list(map(int, input().strip().split())) tot = 0 mx = 0 for i in a: if i > 0: tot += i mx = max(mx, i) if n == 1: print("T") elif tot % 2 or mx > tot // 2: print("T") else: pri...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STR...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [([c] * b) for i in range(a)] def list3d(a, b, c, d): return [[([d] * c) for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[([e] * d) for j in range(c)] for j in range(b)] for i in ran...
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF NUMBER RETURN FUNC_CALL ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for t in range(int(input())): n = int(input()) a = list(map(int, input().split())) visit = [[0, 0] for i in range(101)] for i in range(n): visit[a[i]][0] += 1 count = 0 i, flag = 0, 0 visit[0][0] = 1 while True: i, flag = 100, 0 while i >= 0: if visit[...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
n = int(input()) for i in range(n): f = int(input()) d = list(map(int, input().split()))[:f] d.sort() g = sum(d) if sum(d) % 2 == 0: if d[-1] > g - d[-1]: print("T") else: print("HL") else: print("T")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF VAR NUMBER BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
from sys import stdin input = stdin.readline for _ in range(int(input())): n = int(input()) a = [int(x) for x in input().split()] if n == 1: print("T") continue if n == 2: if a[0] == a[1]: print("HL") else: print("T") continue a.sort()...
ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VA...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for t in range(int(input())): n = int(input()) an = list(map(int, input().split())) winner = 0 bm = 0 cm = -1 while bm != -1: bm = -1 ma = 0 for i in range(len(an)): if an[i] > ma and i != cm: bm = i ma = an[i] if bm != ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VA...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
testCases = int(input()) for i in range(testCases): numPiles = int(input()) pile = list(map(int, input().split(" "))) maxNumber = max(pile) sumOfPile = sum(pile) if numPiles == 1: print("T") elif numPiles == 2: if pile[0] == pile[1]: print("HL") else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) a = [int(i) for i in input().split()] case = 2 s = sum(a) half = s // 2 for k in a: if k > half: case = 1 if case == 2: if s % 2: print("T") else: print("HL") else: print("T...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STR...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def solve(L): if len(L) == 1: if L[0] == 0: return 0 else: return 1 L.sort() s = sum(L) k = L[-1] if k * 2 > s: return 1 if s % 2: return 1 else: return 0 for i in " " * int(input()): n = int(input()) print(["HL", "T"]...
FUNC_DEF IF FUNC_CALL VAR VAR NUMBER IF VAR NUMBER NUMBER RETURN NUMBER RETURN NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER IF BIN_OP VAR NUMBER VAR RETURN NUMBER IF BIN_OP VAR NUMBER RETURN NUMBER RETURN NUMBER FOR VAR BIN_OP STRING FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR F...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys cases = True def c2(n): return n * (n - 1) // 2 def get(): return list(map(int, input().split())) def bits(n: int): return list(bin(n)).count("1") def main(test_case=False): n = int(input()) if test_case else 1 for _ in range(n): test() def flush(): sys.stdout.flush...
IMPORT ASSIGN VAR NUMBER FUNC_DEF RETURN BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF VAR RETURN FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR STRING FUNC_DEF NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXP...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for i in range(int(input())): n = int(input()) a = list(map(int, input().split())) if n == 1: print("T") else: a = sorted(a) a = a[::-1] t = sum(a) d = 0 c = 0 m = max(a) while t > m: if a[0] > 0: a[0] -= 1 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN V...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) a = sorted([int(i) for i in input().split()]) if n == 1: print("T") else: summ = 0 for i in range(n - 1): summ += a[i] if a[n - 1] > summ: print("T") else: summ += a[n - 1] ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR IF VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR ST...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys readline = sys.stdin.readline T = int(readline()) Ans = [None] * T for qu in range(T): N = int(readline()) A = list(map(int, readline().split())) A.sort() if N == 1: Ans[qu] = "T" elif N == 2: if A[0] == A[1]: Ans[qu] = "HL" else: Ans[qu] =...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER A...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) for _ in range(t): n = int(input()) arr = [int(x) for x in input().split()] arr.sort(reverse=True) maxa = arr[0] if maxa > sum(arr) - maxa: print("T") continue else: sum1 = sum(arr) if sum1 % 2 == 0: print("HL") else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) s = sum(arr) if s % 2 != 0: print("T") else: falg = 0 for i in range(n): if arr[i] > s // 2: print("T") falg = 1 if falg == 0: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER EXPR FUN...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def answer(n, A): p = 0 last = -1 while True: maxi = 0 index = -1 for i in range(n): if A[i] > maxi and i != last: maxi = A[i] index = i if index == -1: break else: A[index] -= 1 last = in...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR IF VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER RETURN STRING RETURN STRING ASSIGN VAR FUNC_CALL VAR FUNC_CA...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) t = 0 hl = 0 if max(a) > sum(a) - max(a) or sum(a) % 2: print("T") else: print("HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR F...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n, lst = int(input()), sorted(map(int, input().split(" "))) print("T" if sum(lst) & 1 or n == 1 or lst[n - 1] > sum(lst) - lst[n - 1] else "HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER BIN_OP FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER STRING STRING
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) A = list(map(int, input().split())) A.sort() M = A[-1] S = sum(A) - M if M > S: print("T") elif (S + M) % 2: print("T") else: print("HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
from sys import stdin class Input: def __init__(self): self.next = self.readline() def readline(self): return stdin.readline().strip() def line(self): try: return self.next finally: self.next = self.readline() def array(self, sep=" ", cast=in...
CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF STRING VAR RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR VAR FUNC_DEF WHILE VAR EXPR VAR CLASS_D...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
l = [] for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) m = max(a) sum = 0 for i in range(n): sum = sum + a[i] if sum < 2 * m or sum % 2 == 1: l.append("T") else: l.append("HL") for i in l: print(i)
ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER NU...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys sys.setrecursionlimit(10**5) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [...
IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) l = [*map(int, input().split())] flag = True prev = -1 while True: breakOrNot = True if prev == -1: prev = l.index(max(l)) l[prev] -= 1 flag = not flag breakOrNot = False elif flag:...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER I...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def win(a, last=-1): for i, el in enumerate(a): a2 = a[:] a2[i] -= 1 if i != last and el > 0 and not win(a2, i): return True return False def solve(a): s = sum(a) for i in a: if i > s - i: return True return s % 2 == 1 for t in range(int(in...
FUNC_DEF NUMBER FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR NUMBER IF VAR VAR VAR NUMBER FUNC_CALL VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR IF VAR BIN_OP VAR VAR RETURN NUMBER RETURN BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSI...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) answer = [] for test in range(t): n = int(input()) liste = list(map(int, input().split(" "))) S = sum(liste) indicator = int(S / 2) bool = False for element in liste: if element > indicator: bool = True break if bool: answer.append("T"...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR NU...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) a = sorted(list(map(int, input().split()))) print("T" if sum(a[:-1]) < a[-1] else "HTL"[sum(a) % 2 :: 2])
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER STRING STRING BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def func(li, s): for i in li: if i > s // 2: return print("T") if s % 2 == 0: return print("HL") else: return print("T") for _ in range(int(input())): n = int(input()) ai = list(map(int, input().split())) summ = sum(ai) func(ai, summ)
FUNC_DEF FOR VAR VAR IF VAR BIN_OP VAR NUMBER RETURN FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER RETURN FUNC_CALL VAR STRING RETURN FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys sys.setrecursionlimit(10000) t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) a.sort(reverse=True) if n != 1: while len(a) > 2: a[0] -= a[1] - a[2] + 1 a[1] = a[2] - 1 a = [i for i in a if i != 0] ...
IMPORT EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR NUMBE...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
mod = 10**9 + 7 def solve(): n = int(input()) a = list(map(int, input().split())) f = 2 if max(a) > sum(a) - max(a) or sum(a) % 2 > 0: f = 1 print("T" if f == 1 else "HL") t = int(input()) while t > 0: solve() t -= 1
ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR V...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) for _ in range(t): n = int(input()) a = [int(x) for x in input().split()] if n == 1: print("T") else: total = sum(a) m = max(a) if total % 2 == 1 or m > total // 2: print("T") else: print("HL")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_C...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
ans = "" def f(n, arr): if n == 1: return "T" if arr[-1] * 2 > sum(arr): return "T" if sum(arr) % 2: return "T" return "HL" for _ in range(int(input())): n = int(input()) arr = [int(s) for s in input().split()] arr = sorted(arr) print(f(n, arr) + "") print(ans...
ASSIGN VAR STRING FUNC_DEF IF VAR NUMBER RETURN STRING IF BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR RETURN STRING IF BIN_OP FUNC_CALL VAR VAR NUMBER RETURN STRING RETURN STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) a = [int(i) for i in input().split()] if n == 1: print("T") elif n == 2: if a[0] == a[1]: print("HL") else: print("T") elif max(a) > sum(a) - max(a): print("T") else: num = sum(a) - n ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR V...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def main(): t: int = int(input()) for _ in range(t): n: int = int(input()) T: [int] = list(map(int, input().split(" "))) mx: int = max(T) sm: int = sum(T) if 2 * mx > sm: print("T") elif sm & 1 == 1: print("T") else: pri...
FUNC_DEF VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR LIST VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING VAR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER EXPR F...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
testCases = int(input()) winner = "HL" for x in range(testCases): numberOfPiles = int(input()) piles = list(map(int, input().split())) total = sum(piles) if total % 2 == 1: winner = "T" else: for y in piles: if y > total // 2: winner = "T" ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR STRING FOR VAR VAR IF VAR BIN_OP VAR NUMBER ASSIGN VAR STRING E...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
from sys import stdin for _ in range(int(stdin.readline())): n = int(stdin.readline()) arr = list(map(int, stdin.readline().split())) arr.sort() if n == 1: print("T") continue while len(arr) > 1: a, b = arr[-1], arr[-2] arr = arr[:-2] a -= 1 b -= 1 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER VAR ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) mx = max(a) sm = sum(a) if mx << 1 > sm: print("T") else: print("T" if sm & 1 else "HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER STRING STRING
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) count = 0 s = sum(arr) m1 = max(arr) while m1 > 0: i = arr.index(m1) arr[i] = -1 m2 = m1 m1 = max(arr) arr[i] = m2 - 1 count += 1 if count % 2 == 0: pr...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR ASSIG...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
T = int(input()) for t in range(T): N = int(input()) A = list(map(int, input().split())) pick = -1 mx = 0 curr = "HL" while 1 == 1: mx = 0 new_pick = -1 for i in range(N): if i != pick and A[i] > mx: mx = A[i] new_pick = i ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING WHILE NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VA...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): input() a = list(map(int, input().split())) print("T" if max(a) * 2 > sum(a) or sum(a) % 2 == 1 else "HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER STRING STRING
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) for _ in range(t): n = int(input()) suma = 0 winner = 0 a = list(map(int, input().split())) suma = sum(a) for i in range(n): winner = max(a[i], winner) if winner > suma / 2 or suma % 2: print("T") else: print("HL")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR BIN_OP VAR NUM...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) A = sorted(list(map(int, input().split()))) if A[-1] > sum(A[:-1]): print("T") elif sum(A) % 2: print("T") else: print("HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRIN...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys input = sys.stdin.readline for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) if n == 1: print("T") elif n == 2: if arr[0] == arr[1]: print("HL") else: print("T") elif sum(arr) & 1: print("T") e...
IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF BIN_OP F...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
n = int(input()) last = -1 pl = 0 loose = 0 pas = 0 for i in range(n): num = [] ku = int(input()) num = input() num = list(num.split(" ")) for k in range(ku): num[k] = int(num[k]) loose = 0 last = -1 pl = 0 while loose == 0: pas = 0 ma = 0 for r in ran...
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 LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VA...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
from sys import stdin, stdout def stoned_game(n, a_a): s = sum(a_a) for a in a_a: if a > s // 2: return "T" if s % 2 == 0: return "HL" else: return "T" t = int(stdin.readline()) for _ in range(t): n = int(stdin.readline()) a_a = list(map(int, stdin.readlin...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR IF VAR BIN_OP VAR NUMBER RETURN STRING IF BIN_OP VAR NUMBER NUMBER RETURN STRING RETURN STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def game(): n = int(input()) a = list(map(int, input().split())) if n == 1: print("T") elif n == 2: if a[0] == a[1]: print("HL") else: print("T") elif sum(a) % 2 or max(a) * 2 > sum(a): print("T") else: print("HL") for _ in range(...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CA...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) ans_arr = [] for i in range(t): n = int(input()) a_list = list(map(int, input().split())) max_value = max(a_list) stone_inPile = sum(a_list) if max_value * 2 > stone_inPile or stone_inPile & 1: ans_arr.append("T") else: ans_arr.append("HL") for j in ans_arr: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR F...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline for _ in range(int(input())): N = int(input()) A = list(map(int, input().split())) A.sort() if sum(A) & 1: print("T") elif A[-1] * 2 > sum(A): print(...
IMPORT ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FUNC_DEF IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STR...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) a = [*map(int, input().split())] p = max(a) s = sum(a) - p if (s + p) % 2 == 1: print("T") elif p > s: print("T") else: print("HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING IF VAR VAR EXPR FUNC_CALL VAR STRING EX...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) for _ in range(t): ok = False n = int(input()) a = [int(s) for s in input().split(" ")] if max(a) > sum(a) - max(a): ok = True print("T") if not ok: if sum(a) % 2 == 0: print("HL") else: print("T")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR IF BIN_OP FUNC_CALL...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
T = int(input()) for _ in range(T): N = int(input()) a = [int(x) for x in input().split(" ")] if max(a) * 2 > sum(a): print("T") else: print("T" if sum(a) % 2 else "HL")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER STRING STRING
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) while t: t -= 1 n = int(input()) a = list(map(int, input().split())) if sum(a) % 2 or max(a) * 2 > sum(a): print("T") else: print("HL")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
t = int(input()) def slv(): n = int(input()) a = list(map(int, input().split())) sm = sum(a) mx = max(a) if mx > sm - mx: print("T") return if sm & 1: print("T") else: print("HL") return for i in range(t): slv()
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR STRING RETURN IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR F...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys def rl(proc=None): if proc is not None: return proc(sys.stdin.readline()) else: return sys.stdin.readline().rstrip() def srl(proc=None): if proc is not None: return list(map(proc, rl().split())) else: return rl().split() def solve(A): tot = sum(A) ...
IMPORT FUNC_DEF NONE IF VAR NONE RETURN FUNC_CALL VAR FUNC_CALL VAR RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF NONE IF VAR NONE RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR VAR RETURN NUMBE...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
import sys input = sys.stdin.readline t = int(input()) for i in range(t): n = int(input()) a = [int(i) for i in input().split()] if n == 1: print("T") else: maxa = max(a) suma = sum(a) pq = suma - maxa if pq >= maxa: tmp = suma else: ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR AS...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n, sum, arr = int(input()), 0, [int(i) for i in input().split()] for i in range(n): sum = sum + arr[i] arr.sort() if arr[n - 1] * 2 > sum or sum % 2: print("T") else: print("HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUN...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def solve(): n = int(input()) arr = sorted([int(x) for x in input().split()], reverse=True) def first_wins(): print("T") def second_wins(): print("HL") sm = sum(arr) if sm % 2 != 0 or n == 1: return first_wins() if arr[0] <= sm - arr[0]: return second_wins(...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER FUNC_DEF EXPR FUNC_CALL VAR STRING FUNC_DEF EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBER RETURN FUNC_CALL VAR IF VAR NUMBER BIN_OP VAR VAR NUMBER...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) stosy = sorted(list(map(int, input().split()))) dlug = len(stosy) while dlug > 1: stosy[-2] -= 1 if stosy[-2] == 0: del stosy[-2] dlug -= 1 stosy[-1] -= 1 if stosy[-1] == 0: del stosy[-1] ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR NUMBER VAR NUMBER NUMBER IF VAR NUMBER NUMBER VAR NUMBER VAR NUMBER VAR NUMBER NUMBER IF VAR NUMBER NUMBER VAR ...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def solve(): n = int(input()) a = sorted(list(map(int, input().split()))) if n < 2: print("T") else: s = 0 for x in a[0:-1]: s += x if a[-1] > s or (s - a[-1]) % 2 == 1: print("T") else: print("HL") t = int(input()) for _ in r...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR VAR NUMBER NUMBER VAR VAR IF VAR NUMBER VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CA...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): total = int(input()) num_l = list(map(int, input().split())) num_l.sort() num_l.reverse() if total == 1: print("T") elif total == 2: if num_l[0] == num_l[1]: print("HL") else: print("T") else: zero = 0 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ST...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
for _ in range(int(input())): n = int(input()) a = [*map(int, input().split())] s, mx = sum(a), max(a) print("T" if s % 2 == 1 or mx > s - mx else "HL")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR VAR STRING STRING
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
from sys import stdin input = stdin.buffer.readline for _ in range(int(input())): n = int(input()) (*a,) = map(int, input().split()) idx = -1 c = 0 while 1: mx = 0 tmp = -1 for i in range(n): if i != idx and a[i] > mx: mx = a[i] tm...
ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def L1(): t = int(input()) ans = [] for j in range(t): piles = int(input()) n = [int(i) for i in input().split()] s = int(sum(n) / 2) for i in range(piles): if n[i] > s: ans.append("T") break while len(ans) < j + 1: ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR STRING WHILE FUNC...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
n = int(input()) for i in range(n): stack = int(input()) arr = input().split(" ") arr = [int(x) for x in arr] arr.sort() if len(arr) == 1: print("T") else: tmp = sum(arr[0:-1]) if tmp < arr[-1]: print("T") elif (tmp + arr[-1]) % 2 == 0: pri...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR NUMBER EXP...
T is playing a game with his friend, HL. There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen...
def stoned(arr): s = sum(arr) if max(arr) > s // 2: return "T" if s % 2 == 0: return "HL" else: return "T" for i in range(int(input())): a = input() lst = list(map(int, input().strip().split())) print(stoned(lst))
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR BIN_OP VAR NUMBER RETURN STRING IF BIN_OP VAR NUMBER NUMBER RETURN STRING RETURN STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FU...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
import sys input = sys.stdin.buffer.readline def prog(): n = int(input()) array = list(map(int, input().split())) output = [-1] * n to_place = [] prev = -1 for i in range(n): curr = array[i] if curr != prev: output[i] = prev to_place.extend(list(range(p...
IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CA...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
n = int(input()) l = list(map(int, input().split())) if max(l) > n: print(-1) else: a = [] ans = [] for i in range(n + 1): a.append(-1) ans.append(-1) for i in range(n): a[l[i]] = i + 1 for i in range(n + 1): if a[i] != -1: ans[a[i]] = i print() ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VA...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
def read_ints(): return list(map(int, input().split())) (n,) = read_ints() a = read_ints() b = [-1] * n used = set(a) current = 0 j = 1 for i in range(n): if a[i] != current: b[i] = current current = a[i] if current > i + 1: print(-1) break else: whi...
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR IF VAR BIN_OP VAR NU...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
n = int(input()) a = list(map(int, input().split())) b = set(a) k, t = 0, 0 not_in_set = [] for j in range(1, n + 1): if j not in b: not_in_set.append(j) for i in range(n): if a[i] > i + 1: print(-1) break elif a[i] != k: print(k, end=" ") k = a[i] else: p...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR NUMBER EXPR...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
def f(a): st = set(a) now = 1 p = 0 ans = [] for i in a: if i != p: ans.append(p) p = i else: while now in st: now += 1 ans.append(now) now += 1 return ans a = input() lst = list(map(int, input().strip(...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR WHILE VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL V...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
n = int(input()) s = list(map(int, input().split())) stack = list() for i in range(n, s[-1], -1): stack.append(i) for i in range(len(s) - 1, 0, -1): if s[i] == s[i - 1]: continue else: for j in range(s[i] - 1, s[i - 1], -1): stack.append(j) fin_list = list() if s[0] == 1: sta...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
n = int(input()) A = [int(x) for x in input().split()] rs = set(A) mx = -1 p = -1 ans = [] for a in A: if p >= 0 and p != a: ans.append(p) if p == mx + 1: mx += 1 else: mx += 1 while mx in rs: mx += 1 ans.append(mx) if mx + 1 < a: print...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER WHILE VAR VAR VAR NUMBER EXPR FUNC_CALL...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
import sys N = int(input()) a = [int(x) for x in input().split(" ")] b = [(0) for _ in range(N)] st = [] for i, x in enumerate(a): dif = a[i] - a[i - 1] if i != 0 else a[i] if dif: if len(st) + 1 < dif: print(-1) sys.exit(0) else: b[i] = a[i - 1] if i != 0 el...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR VAR IF VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER VAR EXPR FUNC_C...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
n = int(input()) arr = list(map(int, input().split(" "))) _max = max(arr) count = dict() seq = [] for i in range(n): if arr[i] not in count: count[arr[i]] = 1 else: count[arr[i]] = count[arr[i]] + 1 if arr[0] > 1: print(-1) else: error = 0 if arr[0] == 0: next_zero = 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR VAR VAR NUMBER IF VAR NUMBER NUMBER EXPR...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
import sys input = sys.stdin.readline n = int(input()) a = [0] + [int(item) for item in input().split()] ans = [-1] * n used = set() for i, (a1, a2) in enumerate(zip(a, a[1:])): if a1 < a2: ans[i] = a1 used.add(a1) val = a[-1] - 1 max_val = max(a) + 1 to_use = [] for i in range(n - 1, -1, -1): ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR B...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
import sys input = sys.stdin.buffer.readline def iinp() -> int: return int(input()) def linp() -> list: return [int(p) for p in input().split()] def sinp(): return input().decode("unicode-escape")[0:-2] n = iinp() a = linp() s = set(a) x = 0 y = 1 for i in a: if i == x: while y in s: ...
IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR STRING NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR ...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
n = int(input()) a = list(map(int, input().split())) def ehab(n, a): set_a = set(a) b = [] ans = [] for i in range(n + 1): if i not in set_a: b.append(i) index_b = 0 ans.append(b[0]) index_b += 1 for i in range(1, n): if a[i] != a[i - 1]: ans.app...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER FOR VAR FUN...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
import sys sys.setrecursionlimit(10**6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [...
IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
def main(): N = int(input()) (*A,) = map(int, input().split()) for i, a in enumerate(A): if i + 1 < a: print(-1) return else: Us = set(range(N + 1)) - set(A) U = sorted(Us) lU = len(U) ui = 0 ans = [] pre = A[0] for ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
n = int(input()) a = [int(j) for j in input().split(" ")] b = [-1] * n if a[0] > 1: print(-1) else: if a[0] == 0: mex = 0 count = 0 else: mex = 1 count = 1 b[0] = 0 result = 1 for i in range(1, n): if a[i] != mex: b[i] = mex mex...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER ...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
import sys input = sys.stdin.buffer.readline n = int(input()) (*a,) = map(int, input().split()) inA = [0] * (n + 5) for x in a: inA[x] += 1 keep = [0] ma = 0 ans = [] for i in range(n): if keep and not inA[keep[0]]: ans.append(keep.pop(0)) else: ma += 1 while inA[ma]: ke...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CA...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
maxn = 10**6 + 5 vis = [(False) for i in range(maxn)] n = int(input()) arr = list(map(int, input().split())) for i in arr: vis[i] = True ans = [] cnt = 0 for i in range(n): if i != 0: if arr[i] == arr[i - 1]: while vis[cnt]: cnt += 1 vis[cnt] = True an...
ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR VAR VAR BIN_O...
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that: for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$. The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. -----In...
n = int(input()) aarr = list(map(int, input().split())) tovisit = {t: (0) for t in range(aarr[-1] + 1)} for k in aarr: tovisit[k] += 1 b = [] transit = [] i = 0 flag = True for t in aarr: if t > i + 1: flag = False print(-1) break if transit: b.append(transit[0]) del ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER...