Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline

n = int(input())
a = [0]*n
b = [0]*n
c = [0]*n
for i in range(n):
    a[i], b[i], c[i] = map(int, input().split())

dpa = a[0]+[0]*(n-1)
dpb = b[0]+[0]*(n-1)
dpc = c[0]+[0]*(n-1)
for i in range(1,n):
    dpa[i] = max( dpb[i-1]+a[i], dpc[i-1]+a[i])
    dpb[i] = max( dpc[i-1]+b[i], dpa[i-1]+b[i])
    dpa[i] = max( dpa[i-1]+c[i], dpb[i-1]+c[i])

print(max(dpa[-1], dpb[-1], dpc[-1]))

### FIXED CODE ###

n = int(input())
a = [0]*n
b = [0]*n
c = [0]*n
for i in range(n):
    a[i], b[i], c[i] = map(int, input().split())

dpa = [a[0]]+[0]*(n-1)
dpb = [b[0]]+[0]*(n-1)
dpc = [c[0]]+[0]*(n-1)
for i in range(1,n):
    dpa[i] = max(dpb[i-1]+a[i],dpc[i-1]+a[i])
    dpb[i] = max(dpc[i-1]+b[i],dpa[i-1]+b[i])
    dpc[i] = max(dpa[i-1]+c[i],dpb[i-1]+c[i])

print(max(dpa[-1], dpb[-1], dpc[-1]))
S=input()
if S == AAA or BBB:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

S=input()
count=0
for i in range(2):
  if S[i]==S[i+1]:
    count+=1
if count==2:
  print("No")
else:
  print("Yes")
n=0
m=input()
c=[0 for i in xrange(m)]
t=[0 for i in xrange(m)]


def d(u):
    global n
    if ts[u]:return
    n = n + 1
    ts[u]=[u+1,n]
    for i in c[u]:d(i-1)
    n = n + 1
    ts[u][2:]=[n]

def dfs():
    for i in range(m):
     l=map(int,raw_input().split())
     c[l[0]-1]=l[2:]
    for i in range(m):
     d(i)
     print " ".join(map(str,t[i]))

dfs()

### FIXED CODE ###

n=0
m=input()
c=[0 for i in xrange(m)]
ts=[0 for i in xrange(m)]


def dfs_visit(u):
    global n
    if ts[u]:return
    n = n + 1
    ts[u]=[u+1,n]
    for i in c[u]:dfs_visit(i-1)
    n = n + 1
    ts[u][2:]=[n]

def dfs():
    for i in range(m):
     l=map(int,raw_input().split())
     c[l[0]-1]=l[2:]
    for i in range(m):
     dfs_visit(i)
     print " ".join(map(str,ts[i]))

dfs()
n,c = map(int,input().split())
stc = [[int(i) for i in input().split()] for j in range(n)]

ans = 0

stc.sort(key=lambda x:(x[2],x[1],x[0]))

time = 10**5+1

c_imos = [[0 for i in range(time)] for j in range(c)]

for i in range(n):
    c_imos[stc[i][2]-1][stc[i][0]-1] += 1
    c_imos[stc[i][2]-1][stc[i][1]] -= 1

#print(c_imos)

nd_v = [[0 for i in range(time)] for j in range(c)]

for i in range(c):
    for j in range(time):
        if j == 0:
            if c_imos[i][j] == 1:
                nd_v[i][j] = 1
        else:q
            nd_v[i][j] = max(0,min(1,nd_v[i][j-1] + c_imos[i][j]))
#print(nd_v)

ans = 1

for i in range(time-1):
    tmp = 0
    for j in range(c):
        tmp += nd_v[j][i]
    ans = max(tmp,ans)

print(ans)

exit()
    
c_num = stc[0][2]
t_num = stc[0][1]
idx = 0
print(stc)
for i in range(1,n):
    print(t_num,i)
    if stc[idx+i][2] == c_num:
        if stc[idx+i][0] == t_num:
            stc[idx+i-1][1] = stc[idx+i][1]
            t_num = stc[idx+i][1]
            del stc[idx+i]
            idx -= 1
        else:
            print(t_num,t_num,t_num)
            c_num = stc[idx+i][2]
            t_num = stc[idx+i][1]

stc.sort(key=lambda x:x[1])
print(stc)
exit()
tmp = stc[0][1]

ans = 1
ans_tmp = 1

for i in range(1,len(stc)):
    for j in range(i+1,len(stc)):
        if tmp >= stc[j][0]:
            ans_tmp += 1
        else:
            tmp = stc[j][0]
            ans = max(ans_tmp,ans)

### FIXED CODE ###

n,c = map(int,input().split())
stc = [[int(i) for i in input().split()] for j in range(n)]

ans = 0

stc.sort(key=lambda x:(x[2],x[1],x[0]))

time = 10**5+3

c_imos = [[0 for i in range(time)] for j in range(c)]

for i in range(n):
    c_imos[stc[i][2]-1][stc[i][0]-1] += 1
    c_imos[stc[i][2]-1][stc[i][1]] -= 1

nd_v = [[0 for i in range(time)] for j in range(c)]

for i in range(c):
    for j in range(time):
        if j == 0:
            if c_imos[i][j] == 1:
                nd_v[i][j] = 1
        else:
            nd_v[i][j] = nd_v[i][j-1] + c_imos[i][j]

for i in range(c):
    for j in range(time):
        if nd_v[i][j] >= 2:
            nd_v[i][j] = 1
ans = 1

for i in range(time-1):
    tmp = 0
    for j in range(c):
        tmp += nd_v[j][i]
    ans = max(tmp,ans)

print(ans)

exit()
    
c_num = stc[0][2]
t_num = stc[0][1]
idx = 0
print(stc)
for i in range(1,n):
    print(t_num,i)
    if stc[idx+i][2] == c_num:
        if stc[idx+i][0] == t_num:
            stc[idx+i-1][1] = stc[idx+i][1]
            t_num = stc[idx+i][1]
            del stc[idx+i]
            idx -= 1
        else:
            print(t_num,t_num,t_num)
            c_num = stc[idx+i][2]
            t_num = stc[idx+i][1]

stc.sort(key=lambda x:x[1])
print(stc)
exit()
tmp = stc[0][1]

ans = 1
ans_tmp = 1

for i in range(1,len(stc)):
    for j in range(i+1,len(stc)):
        if tmp >= stc[j][0]:
            ans_tmp += 1
        else:
            tmp = stc[j][0]
            ans = max(ans_tmp,ans)
while True:
  s = raw_input().split()
    a = int(s[0])
    op = s[1]
    b = int(s[2])
  if op == "+":
    print a+b
  elif op == "-":
    print a-b
  elif op == "*":
    print a*b
  elif op == "/":
    print a/b
  else:
    break

### FIXED CODE ###

while True:
  s = raw_input().split()
  a = int(s[0])
  op = s[1]
  b = int(s[2])
  if op == '?':
    break
  elif op == '+':
    print (a+b)
  elif op == '-':
    print (a-b)
  elif op == '*':
    print (a*b)
  elif op == '/':
    print (a/b)
# それぞれのボールの文字列を取得
a = input()
b = input()

# それぞれのボールの個数を取得
aCount = int(input())
bCount = int(input())
ball = []
ball.append(aCount)
ball.append(bCount)

# 取り出したボールの文字列を取得
selectBall = input()

if selectBall == a:
    aCount = aCount-1
    ball[0] = aCount
    print(' '.join(map(str,ball)))
elif selectBall == b:
    bCount = bCount-1
    ball[1] = bCount
    print(' '.join(map(str,ball)))
else:
    print(' '.join(map(str,ball)))


### FIXED CODE ###

# それぞれのボールの文字列を取得
a, b = input().split()

# それぞれのボールの個数を取得
aCount, bCount = input().split()
aNumber = int(aCount)
bNumber = int(bCount)

ball = []
ball.append(aNumber)
ball.append(bNumber)

# 取り出したボールの文字列を取得
selectBall = input()

if selectBall == a:
    aNumber = aNumber-1
    ball[0] = aNumber
    print(' '.join(map(str,ball)))
elif selectBall == b:
    bNumber = bNumber-1
    ball[1] = bNumber
    print(' '.join(map(str,ball)))
else:
    print(' '.join(map(str,ball)))
#
# abc059 c
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4
1 -3 1 0"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
3 -6 4 -5 7"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """6
-1 4 3 2 -5 4"""
        output = """8"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    s = 0
    f = 0
    for a in A:
        if f == 1 and s+a >= 0:
            ans += abs(s+a) + 1
            s = -1
        elif f == -1 and s+a <= 0:
            ans += abs(s+a) + 1
            s = 1
        else:
            s += a
        f = s // abs(s)
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


### FIXED CODE ###

#
# abc059 c
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4
1 -3 1 0"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
3 -6 4 -5 7"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """6
-1 4 3 2 -5 4"""
        output = """8"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    # n = odd : plus
    ansa = 0
    sa = 0
    for i in range(N):
        sa += A[i]
        if i % 2 == 0:
            if sa >= 0:
                ansa += abs(sa) + 1
                sa = -1
        else:
            if sa <= 0:
                ansa += abs(sa) + 1
                sa = 1

    # n = even : plus
    ansb = 0
    sb = 0
    for i in range(N):
        sb += A[i]
        if i % 2 == 0:
            if sb <= 0:
                ansb += abs(sb) + 1
                sb = +1
        else:
            if sb >= 0:
                ansb += abs(sb) + 1
                sb = -1

    print(min(ansa, ansb))


if __name__ == "__main__":
    #unittest.main()
    resolve()
#バブルソート
def BubbleSort(C,N):
    flag = 1
    while flag:
        flag = 0
        for j in range(N-1,0,-1):
            if int(C[j][1:2]) < int(C[j-1][1:2]):
                tmp = C[j]
                C[j] = C[j-1]
                C[j-1] = tmp
                flag = 1
    print(' '.join(C))
    
    
                
                
#選択ソート
def SelectionSort(C,N):
    for i in range(0,N,1):
        minj = i
        for j in range(i,N,1):
            if int(C[j][1:2]) < int(C[minj][1:2]):
                minj = j
        tmp = C[i]
        C[i] = C[minj]
        C[minj] = tmp
    print(' '.join(C))
        
#安定かどうかの判定
def isStable(inp, out,N):
    for i in range(0,N):
        for j in range(i+1,N):
            for a in range(0,N):
                for b in range(a+1,N):
#                     print("inp(i,j):",inp[i],inp[j],"out(b,a):",out[b],out[a]+"\n")
                    if int(inp[i][1]) == int(inp[j][1]) and inp[i] == out[b] and inp[j] == out[a]:
                        print('Not stable')
                        return
    print('Stable')



愚直に調べるパターン
N = int(input())
A = list(input().split())
Bubble_A = A.copy()
Selection_A = A.copy()

BubbleSort(Bubble_A,N)
isStable(A,Bubble_A,N)
SelectionSort(Selection_A,N)
isStable(A,Selection_A,N)



### FIXED CODE ###

#バブルソート
def BubbleSort(C,N):
    for i in range (0,N,1):
        for j in range(N-1,i,-1):
            if int(C[j][1:2]) < int(C[j-1][1:2]):
                tmp = C[j]
                C[j] = C[j-1]
                C[j-1] = tmp
    print(' '.join(C))

    
                
#選択ソート
def SelectionSort(C,N):
    for i in range(0,N,1):
        minj = i
        for j in range(i,N,1):
            if int(C[j][1:2]) < int(C[minj][1:2]):
                minj = j
        tmp = C[i]
        C[i] = C[minj]
        C[minj] = tmp
    print(' '.join(C))



N = int(input())
A = list(input().split())
Bubble_A = A.copy()
Selection_A = A.copy()

BubbleSort(Bubble_A,N)
print("Stable")
SelectionSort(Selection_A,N)
flag = True
for Bubble,Selection in zip(Bubble_A,Selection_A):
    if Bubble != Selection:
        flag = False
if flag :
    print("Stable")
else:
    print("Not stable")
import math

a,b,x = map(int,input().split())


if a*a*b>2*x:
	print(90- math.atan(2*x/(a*b*b) *360/(2*math.pi)))
else:
	print(90- math.atan(a**3/(2*(a*a*b-x))) *360/(2*math.pi))

### FIXED CODE ###

import math

a,b,x = map(int,input().split())


if a*a*b>2*x:
	print(90- math.atan2(2*x, a*b*b) *360/(2*math.pi))
else:
	print(90- math.atan2(a**3, 2*(a*a*b-x)) *360/(2*math.pi))
x,a,b = map(int,input())
if abs(a-x) > abs(b-x):
    print("B")
else:
    print("A")

### FIXED CODE ###

x,a,b = map(int,input().split())
if abs(a-x) > abs(b-x):
    print("B")
else:
    print("A")
x,t=map(int,input().split)
print(max(0,x-t))

### FIXED CODE ###

x,t=map(int,input().split())
print(max(0,x-t))
import bisect
N = input()
L_list = list(map(int,input().split()))
ans = 0

for i in range(N-1):
  for j in range(i+1,N-1):
    x = bisect.bisect_left(L_list,L_list[i]+L_list[j])
    ans += x-j-1
print(ans)

### FIXED CODE ###

import bisect
N = int(input())
L_list = list(map(int,input().split()))
L_list.sort()
ans = 0

for i in range(N-1):
  for j in range(i+1,N-1):
    x = bisect.bisect_left(L_list,L_list[i]+L_list[j])
    ans += x-j-1
print(ans)
import numpy as np

def main():
    h, w, k = map(int, input().split())
    s = [input() for i in range(h)]
    s = np.array(s)

    ans = np.array([[0]*w]*h)

    g = 1
    nls = []

    for i in range(h):
        if s[i] != "."*w:
            lsha = 0
            for j in range(w):
                ans[i][j] = g
                if s[i][j] == "#":
                    lsha = j
                    g = g + 1
            if lsha != w-1:
                for k in range(w-lsha-1):
                    ans[i][lsha+1+k] = ans[i][lsha] 
        else:
            nls.append(i)
    
    for i in nls:
        if i != h-1:
            ans[i] = ans[i+1]
        else:
            ans[i] = ans[i-1]
    
    for i in range(h):
        if ans[i][0] == 0:
            for j in range(i+1, h):
                if ans[j][0] != 0:
                    ans[i] = ans[j]
                    break
    for i in range(h):
        if ans[n-1-i][0] == 0:
            for j in range(i+1, h):
                if ans[n-1-j][0] != 0:
                    ans[n-1-i] = ans[n-1-j]
                    break
    
    for i in range(h):
        anst= ""
        for j in range(w):
            anst = anst + str(ans[i][j]) + " "
        print(anst)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np

def main():
    h, w, k = map(int, input().split())
    s = [input() for i in range(h)]
    s = np.array(s)

    ans = np.array([[0]*w]*h)

    g = 1
    nls = []

    for i in range(h):
        if s[i] != "."*w:
            lsha = 0
            for j in range(w):
                ans[i][j] = g
                if s[i][j] == "#":
                    lsha = j
                    g = g + 1
            if lsha != w-1:
                for k in range(w-lsha-1):
                    ans[i][lsha+1+k] = ans[i][lsha] 
        else:
            nls.append(i)
    
    for i in nls:
        if i != h-1:
            ans[i] = ans[i+1]
        else:
            ans[i] = ans[i-1]
    
    for i in range(h):
        if ans[i][0] == 0:
            for j in range(i+1, h):
                if ans[j][0] != 0:
                    ans[i] = ans[j]
                    break
    for i in range(h):
        if ans[h-1-i][0] == 0:
            for j in range(i+1, h):
                if ans[h-1-j][0] != 0:
                    ans[h-1-i] = ans[h-1-j]
                    break
    
    for i in range(h):
        anst= ""
        for j in range(w):
            anst = anst + str(ans[i][j]) + " "
        print(anst)

if __name__ == "__main__":
    main()
N, K = map(int, input().split())
 
tmp = [0] * N
 
for i in range(K):
  input()
  for j in map(int, input().split()):
 	tmp[j] |= 1 
print(sum(tmp))


### FIXED CODE ###

N, K = map(int, input().split())
 
tmp = set()
 
for i in range(K):
  input()
  tmp |= set(map(int, input().split()))
 
print(len(set(range(1, N+1)) - tmp))
a,b,t=map(int,input().split())
print(int(((t+0.5)//a)＊b))

### FIXED CODE ###

a, b, t = map(int, input().split())

ans = int(((t+0.5)//a)*b)
print(ans)
[_, input_k] = map(int, input().split())

input_v = list(map(int, input().split()))

max_value = 0

for a in range(min(input_v, input_k + 1)):
    for b in range(min(input_v, input_k - a + 1)):
        if (b != 0):
            hold_jewelries = input_v[:a] + input_v[-b:]
        else:
            hold_jewelries = input_v[:a]
        hold_jewelries = sorted(hold_jewelries)

        remove_length = input_k - a - b 
        hold_minus = sum(1 for value in hold_jewelries if value < 0)

        hold_value = sum(hold_jewelries[min(hold_minus, remove_length):])

        if (hold_value > max_value):
            max_value = hold_value

print(max_value)


### FIXED CODE ###

[input_n, input_k] = map(int, input().split())

input_v = list(map(int, input().split()))

max_value = 0

for a in range(min(input_n, input_k) + 1):
    for b in range(min(input_n, input_k) - a + 1):
        if (b != 0):
            hold_jewelries = input_v[:a] + input_v[-b:]
        else:
            hold_jewelries = input_v[:a]
        hold_jewelries = sorted(hold_jewelries)

        remove_length = input_k - a - b
        hold_minus = sum(1 for value in hold_jewelries if value < 0)

        hold_value = sum(hold_jewelries[min(hold_minus, remove_length):])

        if (hold_value > max_value):
            max_value = hold_value

print(max_value)
a,b=map(int,input().split())
na=int(a*12.5)
nb=b*10
x=0
for i in range(8):
  nai=na+i
  for j in range(10):
    nbj=nb+j
    if nai == nbj:
      x=1
      y=nai
      break
  if x==1:
    print(y)
    break:
  if x==0 and i==7:
    print("-1")

### FIXED CODE ###

a,b=map(int,input().split())
x=0
for i in range(2000):
  if x == 0 and int(i*0.08) == a and int(i*0.10) == b:
    print(i)
    x=1
  if x == 0 and i == 1299:
    print("-1")
N=int(input())
A,B=map(str,input().split())
S=[]
for i in range(N)
    S.append(A[i])
    S.append(B[i])
print(S)

### FIXED CODE ###

A=int(input())
B=int(input())
if A+B==3:
  print(3)
elif A+B==4:
  print(2)
else:
  print(1)
import heapq as hq


n = int(input())
nodes = []
done = [0 for _ in range(n)]
par = {}
for _ in range(n):
    x, y = map(int,input().split())
    nodes.append((x,y))
    par[(x,y)]=(x,y)
nodesx = sorted(nodes)
nodesy = sorted(nodes,key=lambda z:z[1])
s = []

for i in range(n-1):
    xcost =nodesx[i+1][0]-nodesx[i][0]
    ycost =nodesy[i+1][1]-nodesy[i][1]
    hq.heappush(s,(xcost,(nodesx[i+1],nodesx[i])))
    hq.heappush(s,(ycost,(nodesy[i+1],nodesy[i])))
def root(node,par):
    if node == par[node]:
        return node
    else:
        par[node] =root(par[node],par)
        return par[node]
def unite(node1,node2,par):
    par[root(node1,par)] = root(node2,par)
ans = 0
while s :
    cost,(node1,node2) = hq.heappop(s)
    if root(node1,par) != root(node2,par):
        unite(node1,node2,par)
        ans +=cost
print(ans)
    
    
    
    


### FIXED CODE ###

from collections import deque
import sys
 
sys.setrecursionlimit(2000000000)
 
n = int(input())
nodes = []
done = [0 for _ in range(n)]
par = {}
for _ in range(n):
    x, y = map(int,input().split())
    nodes.append((x,y))
    par[(x,y)]=(x,y)
nodesx = sorted(nodes)
nodesy = sorted(nodes,key=lambda z:z[1])
s = []
m = len(set(nodes))
for i in range(n-1):
    xcost =nodesx[i+1][0]-nodesx[i][0]
    ycost =nodesy[i+1][1]-nodesy[i][1]
    s.append((xcost,(nodesx[i+1],nodesx[i])))
    s.append((ycost,(nodesy[i+1],nodesy[i])))
s.sort()
s = deque(s)
def root(node,par):
    if node == par[node]:
        return node
    else:
        par[node] =root(par[node],par)
        return par[node]
def unite(node1,node2,par):
    par[root(node1,par)] = root(node2,par)
ans = 0
count =0
while count < m-1 :
    cost,(node1,node2) = s.popleft()
    root1 =root(node1,par)
    root2 =root(node2,par)
    if root1 != root2:
        unite(node1,node2,par)
        ans +=cost
        count += 1
print(ans)
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
  prrint(0)
else:
  s = 1
  for i in a :
    s *= i
  if s > 10**18:
      print("-1")
  else:
      print(s)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
if 0 in a:
  print(0)
else:
  s = 1
  for i in a :
    s *= i
    if s > 10**18:
      s = -1
      break
  print(s)
n = int(input())

b = list(map(int, input().split()))

a[0]=b[0]
a[n-1]=b[n-2]

for i in range(1, n-1):
  if b[i] >= b[i-1]:
    a[i] = b[i-1]
  else:
    a[i] = b[i]

c = 0

for i in range(n):
  c += a[i]
print(c)
  
    
  
  

### FIXED CODE ###

n = int(input())

b = list(map(int, input().split()))
a=[0]*n
a[0]=b[0]
a[n-1]=b[n-2]

for i in range(1, n-1):
	if b[i]>=b[i-1]:
		a[i]=b[i-1]
	else:
		a[i]=b[i]
s = 0
for i in range(n):
	s += a[i]
	
print(s)
import sys

def srch(i, end, l, Dst, Lng):
    if Lng[i] != -1 and Lng[i] < l:
        return
    Lng[i] = l
    if i == end:
        return
    if Dst[i] is not None and len(Dst[i]) > 0:
        for c in Dst[i]:
            srch(c, end, l+1, Dst, Lng)

def main():
    istr = sys.stdin.read()
    ilist = []
    for i in istr.splitlines():
        ilist.append(list(map(int,i.split())))
    #print(ilist)
    unum, fnum = ilist[0]

    Dst = [[] for i in range(unum)]
    fnum += 1
    for n in range(1, fnum):
        uid, fid = ilist[n]
        Dst[uid].append(fid)
        Dst[fid].append(uid)
    
    qnum = ilist[fnum][0]
    fnum += 1
    #print("fnum={} qnum={}".format(fnum,qnum))
    for q in range(fnum, (fnum + qnum)):
        id1, id2 = ilist[q]
        Lng = [-1] * (fnum)
        #print("[{}] id1={:2} id2={:2} Dst:{} Lng:{}".format(q,id1, id2, Dst, Lng))
        srch(id1, id2, 0, Dst, Lng)
        if Lng[id2] != -1:
            print("yes")
        else:
            print("no")

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

def Grouping(F):
    n = len(F)
    G = [None for i in range(n)]
    for u in range(n):
        if G[u] is None:
            G[u] = u
            S = [u]
            while(len(S) > 0):
                u1 = S.pop()
                for u2 in F[u1]:
                    if G[u2] is None:
                        G[u2] = u
                        S.append(u2)
    return G

def main():
    istr = sys.stdin.read()
    ilist = istr.splitlines()
    unum, fnum = list(map(int,ilist[0].split()))

    F = [[]  for i in range(unum)]
    fnum += 1
    for n in range(1, fnum):
        uid, fid = map(int,ilist[n].split())
        F[uid].append(fid)
        F[fid].append(uid)
    
    G = Grouping(F)

    qnum = int(ilist[fnum])
    fnum += 1
    for q in range(fnum, (fnum + qnum)):
        id1, id2 = map(int,ilist[q].split())
        if G[id1] == G[id2]:
            print("yes")
        else:
            print("no")

if __name__ == '__main__':
    main()
N, *d = map(int, open(0).read().split())
c=list(set(*d))
print(len(c))

### FIXED CODE ###

n=int(input())
s = []
for _ in range(n):
    s.append(input()) 
print(len(list(set(s))))
n = int(input())
A = []
for a in range(n):
  A.append(int(input()))
  
for a in range(n):
  Ai = A.pop(a)
  print(max(Ai))


### FIXED CODE ###

n = int(input())
A = [int(input()) for _ in range(n)]

sort = sorted(A)

max = sort[-1]
maxx = sort[-2]

for i in range(n):
  if max == A[i]:
    print(maxx)
  else:
    print(max)
import numpy as np

def main():
    a, b = input().split()

    x = a + b
    x = int(x)
    
    x = np.sqrt(x)

    if x.is_integer():
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

### FIXED CODE ###

import math

def main():
    a, b = input().split()

    x = a + b
    x = int(x)
    
    x = math.sqrt(x)

    if x.is_integer():
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
s = []
while 1:
    a = raw_input()
    if a == "-":
        break
    n = input()
    for i in range(n):
        m = input()
        a = a[m:] + a[:m]
    print a
    

### FIXED CODE ###

import math

x1, y1, x2, y2 = map(float, raw_input().split())
n = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) 
print n
isstr=input()
n,m = [int(i) for i in isstr.split(' ')]
l=[0]*m
r=[0]*m
for i in range(m):
    l[i],r[i]=[int(i)-1 for i in input().split(' ')]
a=[0]*n
for i in range(m):
    for j in range(l[i],r[i]+1):
        a[j]+=1
print(len([_ for i in a if i==m]))  

### FIXED CODE ###

isstr=input()
n,m = [int(i) for i in isstr.split(' ')]
l=[0]*m
r=[0]*m
for i in range(m):
    l[i],r[i]=[int(i)-1 for i in input().split(' ')]
x=min(r)-max(l)+1
x=x if x>0 else 0
print(x)
n =  list(input())
N = [int(n[i]) for i in range(len(n))]
if N[0] == max(N):
  print(max(N) * 100 + max(N)*10 + max(N))
else:
  m = N+1
  print(m * 100 + m * 10 + m)

### FIXED CODE ###

n =  list(input())
N = [int(n[i]) for i in range(len(n))]
if N[0] == max(N):
  print(max(N) * 100 + max(N)*10 + max(N))
else:
  m = N[0]+1
  print(m * 100 + m * 10 + m)
S = input()
L=len(S)
ans='No'
    if S[:(L-1)/2]==S[(L-1)/2-1::-1] and S[L+3/2-1:]==S[:(L+3/2)-2:-1]:
    ans='Yes'
print(ans)

### FIXED CODE ###

S = input()
L=len(S)
ans=0
S1=S[:(L-1)//2]
S2=S[((L+3)//2)-1:]
if (S==S[::-1]) & (S1==S1[::-1]) & (S2==S2[::-1]):
    ans='Yes'
else:
    ans='No'
print(ans)