Harryxun/stf_run huggingface dataset:
class UnionFind():
  def __init__(self,n):
    self.parents = list(range(n))
    self.size = [1]*n
  
  def find(self,x):
    if self.parents[x] == x:
      return x
	
    self.parents[x] = self.find(self.parents[x])
    return self.parents[x]
  
  def union(self,x,y):
    x = self.find(x)
    y = self.find(y)
    
    if x==y:
      return
    
    if self.size[x]>self.size[y]:
      x,y=y,x
	
    self.size[x]+=self.size[y]
    self.parents[y] = x
  
  def same(self,x,y):
    return self.find(x) == self.find(y)
  
  def sizeofset(self,x):
    return self.size[self.find(x)]


N,M=map(int,input().split())
uf = UnionFind(N+1)

cnt=(N)*(N-1)//2
L=[[int(x) for x in input().split()] for _ in range(M)]
ans=[]

for a,b in L[::-1]:
  ans.append(cnt)
  if not uf.same(a,b):
    cnt -= uf.sizeofset(a)*uf.sizeofset(b)
    uf.union(a,b)

for x in ans[::-1]:
  print(x)

### FIXED CODE ###

class UnionFind():
  def __init__(self,n):
    self.parents = list(range(n))
    self.size = [1]*n
  
  def find(self,x):
    if self.parents[x] == x:
      return x
	
    self.parents[x] = self.find(self.parents[x])
    return self.parents[x]
  
  def union(self,x,y):
    x = self.find(x)
    y = self.find(y)
    
    if x==y:
      return
    
    if self.size[x]<self.size[y]:
      x,y=y,x
	
    self.size[x]+=self.size[y]
    self.parents[y] = x
  
  def same(self,x,y):
    return self.find(x) == self.find(y)
  
  def sizeofset(self,x):
    return self.size[self.find(x)]


N,M=map(int,input().split())
uf = UnionFind(N+1)

cnt=(N)*(N-1)//2
L=[[int(x) for x in input().split()] for _ in range(M)]
ans=[]

for a,b in L[::-1]:
  ans.append(cnt)
  if not uf.same(a,b):
    cnt -= uf.sizeofset(a)*uf.sizeofset(b)
    uf.union(a,b)

for x in ans[::-1]:
  print(x)
N,H,W=map(int,input().split())
ans=0
for i in range(N):
  a,b=map(int,input().split())
  if a>=H and b=W:
    ans+=1
print(ans)


### FIXED CODE ###

N,H,W=map(int,input().split())
ans=0
for i in range(N):
  x,y=map(int,input().split())
  if x>=H and y>=W:
    ans+=1
print(ans)
W = input()

r = {}
for w in W:
    r.setdefault(w, 0)
    r[w] += 1

print("Yes" if len(list(filter(lambda x: x % 2 == 1, r))) == 0 else "No")


### FIXED CODE ###

W = input()

r = {}
for w in W:
    r.setdefault(w, 0)
    r[w] += 1

print("Yes" if len(list(filter(lambda x: x % 2 == 1, r.values()))) == 0 else "No")
#L,Rの境界の数だけで処理を済ませる
#⇒いちいち書いてあるとおりに実装しない。

#内側の不幸な人を(RLの人)を消せば幸福な人が2人増える (全部Rに変えていくイメージ)
# ⇒着目するのは RL でも LR　でもどっちでもいい。
#  LRに注目する場合はこのあとのコードのRとLに関連する部分が逆になるだけ
#端っこなら１人増える
#幸福な人の最大値は N - 1

N,K = map(int,input().split())
S = input()

#端以外の人のせいで不幸な人の数
count = 0
#端の人のせいで不幸な人の数
edge_count = 0

#端のせいで不幸な人
if S[0] == 'L':
    edge_count += 1
if S[N-1] == 'R':
    edge_count += 1 

#端以外のせいで不幸になっている人の数を数える (RLを探す)
for i in range(N):
    if S[i] == 'R':
        if S[i+1] == 'L':
            count += 1

#最初の時点で幸せになれる人の数
happy = N  - (count*2 + edge_count)

#操作回数KがRLの数より小さい
if count >= K:
    print(min(N-1, K * 2 + happy  ))
#操作回数K がRLの数より大きい
else:
    print(min(N-1, K * 2 + happy + (min(edge_count,K - count) )))


### FIXED CODE ###


#L,Rの境界の数だけで処理を済ませる
#⇒いちいち書いてあるとおりに実装しない。

#内側の不幸な人を(RLの人)を消せば幸福な人が2人増える (全部Rに変えていくイメージ)
# ⇒着目するのは RL でも LR　でもどっちでもいい。
#  LRに注目する場合はこのあとのコードのRとLに関連する部分が逆になるだけ
#端っこなら１人増える
#幸福な人の最大値は N - 1

N,K = map(int,input().split())
S = input()

#端以外の人のせいで不幸な人の数
count = 0
#端の人のせいで不幸な人の数
edge_count = 0

#端のせいで不幸な人
if S[0] == 'L':
    edge_count += 1
if S[N-1] == 'R':
    edge_count += 1 

#端以外のせいで不幸になっている人の数を数える (RLを探す)
for i in range(N-1):
    if S[i] == 'R':
        if S[i+1] == 'L':
            count += 1

#最初の時点で幸せになれる人の数
happy = N  - (count*2 + edge_count)

#操作回数KがRLの数より小さい
if count >= K:
    print(min(N-1, K * 2 + happy  ))
#操作回数K がRLの数より大きい
else:
    print(min(N-1, K * 2 + happy + (min(edge_count,K - count) )))
c = int(input())
if c == 'a' or c == 'i' or c == 'u' or c == 'e' or c == 'o': print('vowel')
else: print('consonant')

### FIXED CODE ###

c = input()
if c == 'a' or c == 'i' or c == 'u' or c == 'e' or c == 'o': print('vowel')
else: print('consonant')
prunt(input[:-8])

### FIXED CODE ###

print(input()[:-8])
n=int(input())
a=[]
for i in range(n):
    t=int(input())
    a.append(t)
m=int(input())
for j in range(m):
    p,x=map(int,input().split())
    for k in range(n):
        if t==k+1:
            a[k]=x
for j in range(m):
    print(sum(a))

    

### FIXED CODE ###

n=int(input())
t=list(map(int,input().split()))
m=int(input())
for j in range(m):
    ans=0
    p,x=map(int,input().split())
    for k in range(n):
        if p==k+1:
            ans += x
        else:
            ans += t[k]
    print(ans)
N = int(input())
#i = 0
a_max = 2
a_min = 2*(10**9)
s_max = 0
s_min = 10**9

for i in N:
    x,y=map(int,input().split())
    add = x+y
    sub = x-y

    if add > a_max:
        a_max = add
    if add < a_min:
        a_min = add
    if sub > s_max:
        s_max = sub
    if sub < s_max:
        s_max = sub

d_add = a_max - a_min
d_sub = s_max - s_min

print(max(d_add,d_sub))

### FIXED CODE ###

N = int(input())
i = 0
a_max = 2
a_min = 2*(10**9)
s_max = 1-10**9
s_min = 10**9-1

for i in range(N):
    x,y=map(int,input().split())
    add = x+y
    sub = x-y

    if add > a_max:
        a_max = add
    if add < a_min:
        a_min = add
    
    if sub > s_max:
        s_max = sub
    if sub < s_min:
        s_min = sub

d_add = a_max - a_min
d_sub = s_max - s_min

#if d_add >= d_sub:
#    print(d_add)
#if d_add < d_sub:
#    print(d_sub)
print(max(d_add,d_sub))
a = int(input())

if (a == 7) or (a == 5) or (a == 3):
  print("YES")
else print("NO")



### FIXED CODE ###

a = int(input())
 
if (a == 7) or (a == 5) or (a == 3):
  print("YES")
else:
  print("NO")
# 解き直し
H, N = map(int, input().split())
A_to_minB = {}
max_A = -1
for i in range(N):
    a, b = map(int, input().split())
    max_A = max(max_A, a)
    if a not in set(A_to_minB.keys()):
        A_to_minB[a] = b
    else:
        A_to_minB[a] = min(A_to_minB[a], b)
dp = [float("inf")] * (H + max_A)
dp[0] = 0
for i in range(1, H+N):
    tmp = [dp[i-a]+b for a, b in A_to_minB.items() if a<=i]
    if tmp:
        dp[i] = min(tmp)
print(min(dp[H:H+max_A]))

### FIXED CODE ###

# 解き直し
H, N = map(int, input().split())
A_to_minB = {}
max_A = -1
for i in range(N):
    a, b = map(int, input().split())
    max_A = max(max_A, a)
    if a not in set(A_to_minB.keys()):
        A_to_minB[a] = b
    else:
        A_to_minB[a] = min(A_to_minB[a], b)
dp = [float("inf")] * (H + max_A)
dp[0] = 0
for i in range(1, H+max_A):
    tmp = [dp[i-a]+b for a, b in A_to_minB.items() if a<=i]
    if tmp:
        dp[i] = min(tmp)
print(min(dp[H:H+max_A]))
N = int(input())
A = [0]*N

for i in range(N):
  A[i] = int(input())

  M = max(A)
for i in range(N):
  if M == A[i]:
    ans = max(max(A[0:i]),max(A[i+1:N]))
    print(ans)
  else:
    print(M)


### FIXED CODE ###

N = int(input())
A = [0]*N

for i in range(N):
  A[i] = int(input())

As = sorted(A, reverse=True)
M = As[0]
Ms = As[1]

for i in range(N):
  if M == A[i]:
    print(Ms)
  else:
    print(M)
from copy import deepcopy


def solve(string):
    n, k, *td = map(int, string.split())
    dic = {i: [] for i in range(1, n + 1)}
    for t, d in zip(td[::2], td[1::2]):
        dic[t].append(d)
    dic = {_k: sorted(dic[_k], reverse=True) for _k in dic.keys()}

    def dfs(variety, b, use):
        if sum(use) + n == k:
            return len(variety)**2 + b
        tmp = []
        for _u, _k in zip(use, dic.keys()):
            if _u < len(dic[_k]) - 1:
                u = deepcopy(use)
                v = deepcopy(variety)
                u[_k - 1] += 1
                v.add(_k)
                tmp.append(dfs(v, b + dic[_k][u[_k - 1]], u))
        return max(tmp)

    return str(dfs(set([]), 0, [-1] * n))


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n)])))


### FIXED CODE ###

def solve(string):
    n, k, *td = map(int, string.split())
    td = sorted([(t, d) for t, d in zip(td[::2], td[1::2])], key=lambda x: x[1], reverse=True)
    max_variety = len(set([c[0] for c in td]))
    choice = td[:k]
    count = [0] * n
    r = []
    for _c in choice:
        if count[_c[0] - 1] > 0:
            r.append(_c[1])
        count[_c[0] - 1] += 1
    variety = set([c[0] for c in choice])
    ans = [len(variety)**2 + sum([c[1] for c in choice])]
    i_append = k
    while len(variety) < min(max_variety, k):
        while td[i_append][0] in variety:
            i_append += 1
        variety.add(td[i_append][0])
        ans.append(ans[-1] - r.pop() + td[i_append][1] + 2 * len(variety) - 1)
    return str(max(ans))


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n)])))
N = int(input())
S, T = input().split()

result = []
for s, t in S, T:
    result.append(s)
    result.append(t)
    
print(''.join(result))

### FIXED CODE ###

N = int(input())
S, T = input().split()

result = []
for s, t in zip(S, T):
    result.append(s)
    result.append(t)
    
print(''.join(result))
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''


def caluculate_score():
	return num_kind * num_kind + taste
	
	
N, K = map(int, input().split())
t, d = [0] * N, [0] * N
table = [[] for _ in range(N)]
eat_kind = [0] * N
num_kind = 0

for i in range(N):
	t[i], d[i] = map(int, input().split())
	table[i] = (d[i], t[i] - 1)
	
table.sort()

eat = []
taste = 0

for _ in range(K):
	tmp = table.pop()
	taste += tmp[0]
	eat_kind[tmp[1]] += 1
	if eat_kind[tmp[1]] == 1:
		num_kind += 1
	eat.append(tmp)
	
ans = caluculate_score()
ind_eat = K - 1
ind_table = N - K - 1

while ind_eat >= 0 and ind_table >= 0:
	while eat_kind[eat[ind_eat][1]] <= 1:
		ind_eat -= 1
		
	while eat_kind[table[ind_table][1]] >= 1:
		ind_table -= 1
		
	if not(ind_eat >= 0 and ind_table >= 0):
		break
		
'''
	eat_kind[eat[ind_eat][1]] -= 1
	eat_kind[table[ind_table][1]] += 1
	num_kind += 1
	taste += table[ind_table][0] - eat[ind_eat][0]
	eat[ind_eat], table[ind_table] = table[ind_table], eat[ind_eat]
	score = caluculate_score()
	if score > ans:
		ans = score
		
	ind_eat -= 1
	ind_table -= 1
'''
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''


def caluculate_score():
	return num_kind * num_kind + taste
	
	
N, K = map(int, input().split())
t, d = [0] * N, [0] * N
table = [[] for _ in range(N)]
eat_kind = [0] * N
num_kind = 0

for i in range(N):
	t[i], d[i] = map(int, input().split())
	table[i] = (d[i], t[i] - 1)
	
table.sort()

eat = []
taste = 0

for _ in range(K):
	tmp = table.pop()
	taste += tmp[0]
	eat_kind[tmp[1]] += 1
	if eat_kind[tmp[1]] == 1:
		num_kind += 1
	eat.append(tmp)
	
ans = caluculate_score()
ind_eat = K - 1
ind_table = N - K - 1

while ind_eat >= 0 and ind_table >= 0:
	while ind_eat >= 0 and eat_kind[eat[ind_eat][1]] <= 1:
		ind_eat -= 1
		
	while ind_table >= 0 and eat_kind[table[ind_table][1]] >= 1:
		ind_table -= 1
		
	if not(ind_eat >= 0 and ind_table >= 0):
		break

	eat_kind[eat[ind_eat][1]] -= 1
	eat_kind[table[ind_table][1]] += 1
	num_kind += 1
	taste += table[ind_table][0] - eat[ind_eat][0]
	eat[ind_eat], table[ind_table] = table[ind_table], eat[ind_eat]
	score = caluculate_score()
	if score > ans:
		ans = score
		
	ind_eat -= 1
	ind_table -= 1

print(ans)
from math import gcd
 
n=int(input())
mod = 10**9+7
 
d = dict()
zeros=0
for _ in range(n):
  a,b=map(int,input().split())
  if not any((a,b)):
    zeros+=1
    continue
  if all((a,b)):
    g = gcd(a,b)
  elif a:
    g = a
  else:
    g = b
  
  p = a//g,b//g
  d[p] = d.get(p,0)+1
 
ans = 1
done = set()
for (a,b),v in d.items():
  if (-b,a) in done or (b,-a) in done:
    continue
  done.add((a,b))
  w=d.get((-b,a),0)+d.get((b,-a),0)
  ans *= (pow(2,v,mod)+pow(2,w,mod)-1)
  ans %= mod
print((ans+zeros-1+mod)%mod)

### FIXED CODE ###

N = int(input())

a = N%10

if a == 3:
  print('bon')
elif a == 0 or a == 1 or a == 6 or a == 8:
  print('pon')
else:
  print('hon')
from math import log
def solve(N, K):
    if N == 1:
        if K == 1:
            return 1
        return 0
    num = int(log(N, 10))
    if K == 1:
        res = 9 * num + N//(10**num)
        return res
    if K == 2:
        res = 9 ** 2 * (num*(num-1))//2 
        res += (N//(10**num) - 1)*num*9
        res += solve(N - N//(10**num)*(10**num), 1)
        return res
    if K == 3:
        res = 9 ** 3 * (num*(num-1)*(num-2))//6
        res += (N//(10**num) - 1)*(num*(num-1))*81//2
        res += solve(N - N//(10**num)*(10**num), 2)
        return res
N = int(input())
K = int(input())
print(solve(N, K))

### FIXED CODE ###

from math import log
def solve(N, K):
    if N == 0:
        return 0
    if N == 1:
        if K == 1:
            return 1
        return 0
    num = int(log(N, 10))
    if K == 1:
        res = 9 * num + N//(10**num)
        return res
    if K == 2:
        res = 9 ** 2 * (num*(num-1))//2 
        res += (N//(10**num) - 1)*num*9
        res += solve(N - N//(10**num)*(10**num), 1)
        return res
    if K == 3:
        res = 9 ** 3 * (num*(num-1)*(num-2))//6
        res += (N//(10**num) - 1)*(num*(num-1))*81//2
        res += solve(N - N//(10**num)*(10**num), 2)
        return res
N = int(input())
K = int(input())
print(solve(N, K))
N, K = input().split()
P = list(map(int,input().split()))

P.sort()
 
total=0

for i in range(int(K)+1):
  total=total+P[i]
 
print(total)

### FIXED CODE ###

N, K = input().split()
P = list(map(int,input().split()))

P.sort()
 
total=0

for i in range(int(K)):
    total=total+P[i]
 
print(total)
s = str(input())
t = str(input())
count = 0
for i range(len(s)+1):
  if s[i] == t[i]:
    pass
  else:
    count += 1
print(count)

### FIXED CODE ###

s=str(input())
t=str(input())
length=len(s)
count=0
for i in range(length):
	if s[i]==t[i]:
		pass
	else:
		count+=1
print(count)
N = int(input())

sumOtoshidama = 0
for _ in range(N):
    amountStr, unit = input().split()
    amount = int(amountStr)
    if unit == "BTC":
        amount *= 380000
    sumOtoshidama += amount

print(sumOtoshidama)

### FIXED CODE ###

N = int(input())

sumOtoshidama = 0
for _ in range(N):
    amountStr, unit = input().split()
    amount = float(amountStr)
    if unit == "BTC":
        amount *= 380000
    sumOtoshidama += amount

print(sumOtoshidama)
#ABC129-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,m=IL()
D=[True]*n
for i in range(m):
    D[I()-1]=False
A=[0]*n
if D[0]:
    A[0]=1
    if D[1]:
        A[1]=2
    else:
        A[1]=0
else:
    A[0]=0
    if D[1]:
        A[1]=1
    else:
        A[1]=0
for i in range(2,n):
    if D[i]:
        A[i]=A[i-1]+A[i-2]
    else:
        A[i]=0
print(A[n-1]%1000000007)

### FIXED CODE ###

#ABC129-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,m=IL()
D=[True]*n
for i in range(m):
    D[I()-1]=False
A=[0]*n
if n==1:
    if D[0]:
        print(1)
    else:
        print(0)

else:
    if D[0]:
        A[0]=1
        if D[1]:
            A[1]=2
        else:
            A[1]=0
    else:
        A[0]=0
        if D[1]:
            A[1]=1
        else:
            A[1]=0
    for i in range(2,n):
        if D[i]:
            A[i]=A[i-1]+A[i-2]
        else:
            A[i]=0
    print(A[n-1]%1000000007)
a,b=input().split();for _ in[0]*int(a):print(input()*2)

### FIXED CODE ###

a,b=input().split();
for _ in[0]*int(a):print((input()+"\n")*2)
N = int(input())
import numpy as np
l = np.array(map(int,input().split()))
for i in range(N):
    print(np.delete(l,i).median())

### FIXED CODE ###

N = int(input())
l = list(map(int,input().split()))
ll = sorted(l)
n = int(N/2)
a = ll[n-1]
b = ll[n]
for i in range(N):
    if l[i] <= a:
        print(b)
    else:
        print(a)
S = input()
S2 = set(list(S))
print('Yes') if len(S2) == 2 and S.count(S2[0]) == S.count(S2[1]) else print('No')


### FIXED CODE ###

S = input()
S2 = list(set(S))
print('Yes') if len(S2) == 2 and S.count(S2[0]) == S.count(S2[1]) else print('No')
print('win' if sum(map(int,input())) == 21 else 'bust')

### FIXED CODE ###

print('win' if sum(map(int,input().split())) <= 21 else 'bust')
import sys
sys.setrecursionlimit(100000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))

### FIXED CODE ###

import sys
sys.setrecursionlimit(150000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))
from collections import Counter
n = int(input())
pp = []
a0 = 0
b0 = 0
z = 0
for i in range(n):
  a,b = map(int,input().split())
  if a==0 and b==0:
    z += 1
  elif a==0:
    a0 += 1
  elif b==0:
    b0 += 1
  else:
    pp.append(round(a/b,16))
    
mod = 10**9+7
a0 %= mod
b0 %= mod
z %= mod
p = Counter(pp)
r = 1
s = set()

for i in p.keys():
  if i in s:
    continue
  ans = p[i]
  f = round(-1/i,16)
  chk = p[f]
  r *= (pow(2,ans,mod)+pow(2,chk,mod)-1)%mod
  r %= mod
  s.add(f)
r *= (pow(2,a0,mod)+pow(2,b0,mod)-1)%mod
r %= mod
print((r+z-1)%mod)

### FIXED CODE ###

from collections import Counter
import math
n = int(input())
pp = []
a0 = 0
b0 = 0
z = 0

for i in range(n):
  a,b = map(int,input().split())
  if a==0 and b==0:
    z += 1
  elif a==0:
    a0 += 1
  elif b==0:
    b0 += 1
  else:
    gomi = math.gcd(a,b)
    if a < 0:
      a *= -1
      b *= -1
    pp.append((a//gomi,b//gomi))
    
mod = 10**9+7
a0 %= mod
b0 %= mod
z %= mod
p = Counter(pp)
r = 1
s = set()

for i,j in p.keys():
  if (i,j) in s:
    continue
  ans = p[(i,j)]
  if j < 0:
    f = (-j,i)
  else:
    f = (j,-i)
  chk = p[f]
  r *= (pow(2,ans,mod)+pow(2,chk,mod)-1)%mod
  r %= mod
  s.add(f)
r *= (pow(2,a0,mod)+pow(2,b0,mod)-1)%mod
r %= mod
print((r+z-1)%mod)
a, b = int(input().split())
print(a)
c = a + b
if c <= 24:
    print(c)
else:
    print(c - 24)

### FIXED CODE ###

a, b = map(int, input().split())
c = a + b
if c < 24:
    print(c)
else:
    print(c - 24)
number = int(x)
print(number**3)


### FIXED CODE ###

number = int(input())
print(number**3)
K=int(input())
X=int(input())
if(X<=K*500):
    print("Yes")
else:
   print("No")

### FIXED CODE ###

k,x=(int(a) for a in input().split())
if(x<=k*500):
    print("Yes")
else:
   print("No")
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
	for j in range(i):
		ans += (sum((a-b)**2 for a,b in zip(x[i],x[j]))**0.5).is_integer()
print(ans)

### FIXED CODE ###

N,A,B=map(int,input().split())
print(min(N*A,B))
n= int(input())
if n = 1:
  print("Hello World")
  exit()
else:
  a = int(input())
  b = int(input())
  print(a+b)

### FIXED CODE ###

n= int(input())
if n == 1:
  print("Hello World")
  exit()
else:
  a = int(input())
  b = int(input())
  print(a+b)
N, L = map(int, input().split())
a = [map(int, input().split())]
b = 0
c = 0
for i in range(N-1):
	if a[i] + a[i+1] >= L:
		print("Possible")
		b = 1
		c = i
		break
else:
	print("Impossible")
if b = 1:
	for i in range(c+1):
		print(i+1)
	for i in range(N, c+1, -1):
		print(i+1)

### FIXED CODE ###

N, L = map(int, input().split())
a = list(map(int, input().split()))
b = 0
c = 0
for i in range(N-1):
	if a[i] + a[i+1] >= L:
		print("Possible")
		b = 1
		c = i
		break
else:
	print("Impossible")
if b == 1:
	for i in range(1,c+1):
		print(i)
	for i in range(N-1, c, -1):
		print(i)
import math
s = int(input())
r = math.floor(math.sqrt(s)) + 1
def search_prime(k):
    p = math.floor(math.sqrt(k))
    for i in range(2,p + 1):
        if k % i == 0:
            return i
    return 1
prime = search_prime(k)
print("{} {} {} {} {} {}".format(0, 0, prime,r,r, int(k / prime)))


### FIXED CODE ###

import math
s = int(input())
r = math.floor(math.sqrt(s)) + 1
k = r**2 - s
if r == 10**9 + 1:
    print("{} {} {} {} {} {}".format(0, 0, 1,r - 1,r - 1, 0))
    exit()
def search_prime(k):
    p = math.floor(math.sqrt(k))
    for i in range(2,p + 1):
        if k % i == 0:
            return i
    return 1
prime = search_prime(k)
print("{} {} {} {} {} {}".format(0, 0, prime,r,r, int(k / prime)))
N, K = [int(i) for i in input().split()]
S = input()
S[K] = S[K].lower()
print(S)

### FIXED CODE ###

N, K = [int(i) for i in input().split()]
S = input()
S = S[:K-1] + S[K-1].lower() + S[K:]
print(S)
s = input()
li = ["A", "T", "G", "C"]
count = 0
ans = []
for i in range(len(s)):
    if s[i] in li:
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))

### FIXED CODE ###

s = input()
li = ["A", "T", "G", "C"]
count = 0
ans = []
for i in range(len(s)):
    if s[i] in li:
        count += 1
    else:
        ans.append(count)
        count = 0
ans.append(count)
print(max(ans))
# -*- coding: utf-8 -*-

n,k,s = list(map(int,input().split()))
a = []
count = 0
st = ""

for i in range(k):
    a.append(s)

for i in range(n-k):
    a.append(s-1)

if s-1 == 0:
    a = [1]

for i in range(n):
    if st == "":
        st = str(a[count])
    else:
        st += " " + str(a[count])
    count += 1

print(st)

### FIXED CODE ###

# -*- coding: utf-8 -*-

n,k,s = list(map(int,input().split()))
a = []
count = 0
st = ""

for i in range(k):
    a.append(s)

for i in range(n-k):
    if s < 2:
        a.append(s+1)
    else:
        a.append(s-1)
    
for i in range(n):
    if st == "":
        st = str(a[count])
    else:
        st += " " + str(a[count])
    count += 1

print(st)
a,b=input().split()
if a,b==("H","H") or a,b==("D","D"):
  print("H")
else:
  print("D")

### FIXED CODE ###

a,b=input().split()
if (a,b)==("H","H") or (a,b)==("D","D"):
  print("H")
else:
  print("D")
input()
l=list(map(int,input().split()))
print('Yes' if max(l)*2< sum(l) else 'No')


### FIXED CODE ###

t,x = map(int,input().split())
print(t/x)
import sys
sys.setrecursionlimit(5000)

def detectGroup(parents,x):
    if parents[x]!=x:
        return detectGroup(parents,parents[x])
    else:
        return x
    
N,M=map(int,input().split())
AB=[[int(x)-1 for x in input().split()] for i in range(M)][::-1]
parents=[i for i in range(N)]
groupsize=[1 for i in range(N)]
inconv=N*(N-1)/2
result = []
for i in range(M):
    result.append(str(int(inconv))+'\n')
    groupA=detectGroup(parents,AB[i][0])
    groupB=detectGroup(parents,AB[i][1])
    if groupA!=groupB:
        inconv-=groupsize[groupA]*groupsize[groupB]
        groupsize[groupA]+=groupsize[groupB]
    parents[groupB] = groupA
print("".join(result[::-1]))

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def detectGroup(parents,x):
    if parents[x]!=x:
        parents[x]=detectGroup(parents,parents[x])
        return parents[x]
    else:
        return x
    
N,M=map(int,input().split())
AB=[[int(x)-1 for x in input().split()] for i in range(M)][::-1]
parents=[i for i in range(N)]
groupsize=[1 for i in range(N)]
inconv=N*(N-1)/2
result = []
for i in range(M):
    result.append(str(int(inconv))+'\n')
    groupA=detectGroup(parents,AB[i][0])
    groupB=detectGroup(parents,AB[i][1])
    if groupA!=groupB:
        inconv-=groupsize[groupA]*groupsize[groupB]
        groupsize[groupA]+=groupsize[groupB]
    parents[groupB] = groupA
print("".join(result[::-1]))
flag=True
if len(S)==1:
    print("No")
    exit()
if len(S)%2!=0:
    print("No")
    exit()
for i in range(len(S)):
    if i%2==0:
        if S[i]!="h":
            flag=False
            break
    else:
        if S[i]!="i":
            flag=False
            break
if flag:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S=input()
flag=True
if len(S)==1:
    print("No")
    exit()
if len(S)%2==1:
    print("No")
    exit()
for i in range(len(S)):
    if i%2==0:
        if S[i]!="h":
            flag=False
            break
    else:
        if S[i]!="i":
            flag=False
            break
if flag:
    print("Yes")
else:
    print("No")