def main(): t = int(input()) for _ in range(t): n = int(input()) l = list(map(int, input().split())) cream = 0 s = [] for i in range(len(l) - 1, -1, -1): if (l[i] > 0): if (l[i] >= cream): cream = l[i] cream -= 1 s.append(1) else: s.append(1) cream -= 1 else: if (cream > 0): cream -= 1 s.append(1) else: s.append(0) for i in range(len(s) - 1, -1, -1): print(s[i], end=" ") print()
def main(): t = int(input()) for _ in range(t): h, m = map(int, input().split()) hh, mm = input().split(':') #print(hh,mm) while (checkN(mm, h) == False): mm = int(mm) + 1 if (checkR(mm, h)): mm = str(mm) if (len(mm) == 1): mm = "0" + mm else: mm = 0 mm = str(mm) if (len(mm) == 1): mm = "0" + mm print("#mm", mm) hh = int(hh) + 1 if (checkR(hh, m)): hh = str(hh) if (len(hh) == 1): hh = "0" + hh else: hh = h hh = str(hh) if (len(hh) == 1): hh = "0" + hh while (checkN(hh, m) == False): #print("#hh",hh) hh = int(hh) + 1 if (checkR(hh, m)): hh = str(hh) if (len(hh) == 1): hh = "0" + hh else: hh = 0 hh = str(hh) if (len(hh) == 1): hh = "0" + hh # if(checkN(hh,h)==False or checkN(mm,m)==False): # print("00:00") # else: print(hh + ":" + mm)
def main(): t = int(input()) for _ in range(t): n = int(input()) l = [] for i in range(n): a, b = map(int, input().split()) l.append((a, b)) tm = list(map(int, input().split())) curr = 0 for i in range(len(tm)): if (i == 0): curr += l[i][0] + tm[i] else: curr += l[i][0] - l[i - 1][1] + tm[i] #print("arr staion: ",i,curr) if (i != len(tm) - 1): staytime = max(math.ceil((l[i][1] - l[i][0]) / 2), l[i][1] - curr) curr += staytime #print("staion: ",i,curr) print(curr)
def main(): t = int(input()) for _ in range(t): a, b, c = map(int, input().split()) a = [a - 1, a, a + 1] b = [b - 1, b, b + 1] c = [c - 1, c, c + 1] ans = 100000000001 for i in a: for j in b: for k in c: #print((i,j,k)) ans = min(ans, cal([i, j, k])) print(ans)
def cal(l): a = 0 for i in range(len(l)): for j in range(i + 1, len(l)): a += abs(l[j] - l[i]) return a
def main(): t = int(input()) for _ in range(t): pass
def main(): t = int(input()) for _ in range(t): s = input() d = Counter(s) # print(d) l = 'L' r = 'R' u = 'U' D = 'D' if (d[l] <= d[r]): s1 = "" c = d[r] - d[l] for i in range(len(s)): if (c > 0 and s[i] == r): c -= 1 else: s1 += s[i] elif (d[l] > d[r]): s1 = "" c = d[l] - d[r] for i in range(len(s)): if (c > 0 and s[i] == l): c -= 1 else: s1 += s[i] if (d[D] <= d[u]): s2 = "" c = d[u] - d[D] for i in range(len(s1)): if (c > 0 and s1[i] == u): c -= 1 else: s2 += s1[i] elif (d[D] > d[u]): s2 = "" c = d[D] - d[u] for i in range(len(s1)): if (c > 0 and s1[i] == D): c -= 1 else: s2 += s1[i] d = Counter(s2) #print(d) f = 0 if (min(d[l], d[r]) == 0): if (min(d[u], d[D]) == 0): f = 1 else: f = 0 if (min(d[u], d[D]) == 0): if (min(d[l], d[r]) == 0): f = 1 else: f = 0 if ("".join(list(set(list(s)))) == 'LR' or "".join(list(set(s[::-1]))) == 'LR' or "".join(list(set(list(s)))) == 'UD' or "".join(list(set(list(s[::-1])))) == 'UD'): print(len("".join(list(set(list(s)))))) print("".join(list(set(list(s))))) elif ((f == 1)): print(0) else: print(len("L" * d[l] + "U" * d[u] + "R" * d[r] + "D" * d[D])) print("U" * d[u] + "R" * d[r] + "D" * d[D] + "L" * d[l])
# # Printing the Output to output.txt file # sys.stdout = open('output.txt', 'w') def main(): n=int(input()) a=list(map(int,input().split())) d=Counter() f=0 ac=Counter() for for i in range(len(a)): for j in range(i+1,len(a)): d[a[i]+a[j]]=[] d[a[i]+a[j]].append(i) d[a[i]+a[j]].append(j) for i in d: if(len(d[i])>=2): print("YES") print(d[i][0][0]+1,d[i][0][1]+1,d[i][1][0]+1,d[i][1][1]+1) f=1 break if(f==0): print("NO")