Harryxun/stf_run huggingface dataset:
if __name__ == '__main__':
    N, M, K = map(int, input().split()) 
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    
    acc_A = []
    acc_B = []
    acc_A.append(0)
    acc_B.append(0)
    
    sum_a = 0
    sum_b = 0

    for a in A:
        sum_a += a
        acc_A.append(sum_a)

    for b in B:
        sum_b += b
        acc_B.append(sum_b)

    large_ar = []
    small_ar = []

    if N > M:
        large_ar = acc_A
        small_ar = acc_B
    else:
        large_ar = acc_B
        small_ar = acc_A
    
    ans = 0
    for i in range(len(large_ar)):
        for j in range(ans - i, len(small_ar)):
            if large_ar[i] + small_ar[j] <= K:
                ans = max(ans, i+j)
            else: break
    print(ans)

### FIXED CODE ###

if __name__ == '__main__':
    N, M, K = map(int, input().split()) 
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    
    acc_A = []
    acc_B = []
    acc_A.append(0)
    acc_B.append(0)
    
    sum_a = 0
    sum_b = 0

    for a in A:
        sum_a += a
        acc_A.append(sum_a)

    for b in B:
        sum_b += b
        acc_B.append(sum_b)

    large_ar = []
    small_ar = []

    if N > M:
        large_ar = acc_A
        small_ar = acc_B
    else:
        large_ar = acc_B
        small_ar = acc_A
    
    ans = 0
    for i in range(len(small_ar)):
        for j in range(ans-i+1, len(large_ar)):
            if large_ar[j] + small_ar[i] <= K:
                ans = max(ans, i+j)
            else: break
    print(ans)
import sys

std_n = int(sys.stdin.readline().strip())
std_list = tuple(map(int, sys.stdin.readline().strip().split()))
std_set = set(std_list)

if std_set == {0}:
    print("Yes")
elif len(std_set) == 2:
    if 0 in std_set:
        if std_list.count(0) * 3 == std_n:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_list.count(a) == std_list.count(b)) and (std_list.count(b) == std_list.count(c)):
        if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")


### FIXED CODE ###

std_n = int(input())
std_list = tuple(map(int, input().split()))
std_set = set(std_list)

if std_set == {0}:
    print("Yes")
    exit()
elif len(std_set) == 2:
    if 0 in std_set:
        if std_list.count(0) * 3 == std_n:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_list.count(a) == std_list.count(b)) and (std_list.count(b) == std_list.count(c)):
        if a ^ b == c:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
else:
    print("No")
    exit()

############


n = int(input())
nums = list(map(int, input().split()))

unq = list(set(nums))


def answer(ans):
    print(ans)
    exit()


if len(unq) > 3:
    answer("No")

if len(unq) == 3:
    a, b, c = unq
    if a ^ b ^ c != 0:
        answer("No")
    if nums.count(a) == nums.count(b) == nums.count(c):
        answer("Yes")
    else:
        answer("No")

if len(unq) == 2:
    a, b = sorted(unq)
    if a != 0:
        answer("No")
    if nums.count(a) * 2 == nums.count(b):
        answer("Yes")
    else:
        answer("No")

if len(unq) == 1:
    a = unq[0]
    if a != 0:
        answer("No")
    else:
        answer("Yes")
S = input()

if S[0] == "A":
    A = True
else:
    A = False

small = "abcdefghijklmnopqrstuvwxyz"
countC = 0
for i in range(2,len(S)-1):
    if S[i] == "C":
        countC += 1
        place = i
        
if countC == 1:
    C = True
else:
    C = False

s = True
for i in range(1,len(S)):
    if i != place and S[i] not in small:
        s = False



if (A and C and s):
    print("AC")
else:
    print("WA")

### FIXED CODE ###

S = input()

if S[0] == "A":
    A = True
else:
    A = False

countC = 0
for i in range(2,len(S)-1):
    if S[i] == "C":
        countC += 1
        place = i
        
if countC == 1:
    C = True
else:
    C = False
    


'''
if C:
    for i in range(1,place):
        lower = S[i].islower()
        if lower == False:
            B = False
    for i in range(place+1,len(S)):
        lower = S[i].islower()
        if (lower):
            B = False
'''

B = False

new = ""
if C:
    for i in range(1,place):
        new = new + S[i]
    for i in range(place+1,len(S)):
        new = new + S[i]

    if new.islower():
        B = True
    else:
        B = False

            
if (A and B and C):
    print("AC")
else:
    print("WA")
if input() in "auieo":
    cond=1
print(["consonant","vowel"][cond])

### FIXED CODE ###

cond=0
if input() in "auieo":
    cond=1
print(["consonant","vowel"][cond])
N=int(input())
dist=[list(map(int,input().split())) for i in range(N)]
ans=sum([sum(dist[i]) for i in range(N)])
ans//=2
for i in range(N):
    if ans<0:break
    for j in range(i+1,N):
        if ans<0:break
        for k in range(j+1,N):
            S=sum([dist[i][j],dist[i][k],dist[j][k]])/2
            M=max([dist[i][j],dist[i][k],dist[j][k]])
            if S==M:ans-=max(a,b,c)
            elif S<M:
                ans=-1*float('inf')
                break
if ans<0:ans=-1
print(ans)

### FIXED CODE ###

import sys
input=sys.stdin.readline
N=int(input())
dist=[list(map(int,input().split())) for i in range(N)]
ans=sum([sum(dist[i]) for i in range(N)])
for i in range(N):
    dist[i][i]=float('inf')
ans//=2
def main(ans):
    for i in range(N):
        for j in range(i+1,N):
            Min=min(map(sum,zip(dist[i],dist[j])))
            if Min<dist[i][j]:
                return -1
            if Min==dist[i][j]:
                ans-=dist[i][j] 
    return ans
print(main(ans))
a, b, c, d, e, f = map(int, input().split())
a, b = 100*a, 100*b
 
dp = [[0, 0] for _ in range(f+1)]
memo = {}
dp[a][0] = a
if b <= f:
    dp[b][0] = b
for i in range(1, f):
    if dp[i][0]:
        if i+a <= f:
            dp[i+a][0] = dp[i][0] + a
            dp[i+a][1] = dp[i][1]
        if i+b <= f:
            dp[i+b][0] = dp[i][0] + b
            dp[i+b][1] = dp[i][1]
        if i+c <= f and dp[i][1] + c <= dp[i][0] * e // 100:
            x = dp[i+c][0] = dp[i][0]
            y = dp[i+c][1] = dp[i][1] + c
            memo[(x+y, y)] = y/(x+y)
        if i+d <= f and dp[i][1] + d <= dp[i][0] * e // 100:
            x = dp[i+d][0] = dp[i][0]
            y = dp[i+d][1] = dp[i][1] + d
            memo[(x+y, y)] = y/(x+y)
_, z, y = max([(val, z, y) for (z, y), val in memo.items()])
print(z, y)

### FIXED CODE ###

a, b, c, d, e, f = map(int, input().split())
a, b = 100*a, 100*b
 
dp = [[0, 0] for _ in range(f+1)]
memo = {(a, 0):0}
dp[a][0] = a
if b <= f:
    dp[b][0] = b
for i in range(1, f):
    if dp[i][0]:
        if i+a <= f:
            dp[i+a][0] = dp[i][0] + a
            dp[i+a][1] = dp[i][1]
        if i+b <= f:
            dp[i+b][0] = dp[i][0] + b
            dp[i+b][1] = dp[i][1]
        if i+c <= f and dp[i][1] + c <= dp[i][0] * e // 100:
            x = dp[i+c][0] = dp[i][0]
            y = dp[i+c][1] = dp[i][1] + c
            memo[(x+y, y)] = y/(x+y)
        if i+d <= f and dp[i][1] + d <= dp[i][0] * e // 100:
            x = dp[i+d][0] = dp[i][0]
            y = dp[i+d][1] = dp[i][1] + d
            memo[(x+y, y)] = y/(x+y)
_, z, y = max([(val, z, y) for (z, y), val in memo.items()])
print(z, y)
N = int(input())
List9 = [9 ** i for i in range(6) if 9 ** i <= N]
List6 = [6 ** i for i in range(6) if 6 ** i <= N]

def recur(n,con):
  if n == 0:
    return con
    
"""
  elif n < 6:
    return con + n
    
  elif n < 9:
    return con + (n - 5)
"""    

  else:
    max9 = max([i for i in List9 if i <= n])
    max6 = max([i for i in List6 if i <= n])
    
    return min(recur(n - max9,con + 1),recur(n - max6,con + 1))
    
print(recur(N,0))

### FIXED CODE ###

N = int(input())
List9 = [9 ** i for i in range(1,7) if 9 ** i <= N]
List6 = [6 ** i for i in range(1,7) if 6 ** i <= N]

def recur(n,con):
  if n == 0:
    return con

  elif n < 6:
    return con + n
    
  elif n < 9:
    return con + (n - 5)

  else:
    max9 = [i for i in List9 if i <= n][-1]
    max6 = [i for i in List6 if i <= n][-1]
    
    return min(recur(n - max9,con + 1),recur(n - max6,con + 1))
    
print(recur(N,0))
5
2 2 3 5 5

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A_ = [a-i-1 for i,a in enumerate(A)]

A_.sort()

b = A_[N//2]

print(sum([abs(ai-b) for ai in A_]))
import collections

N = int(input())
colors = [int(x) - 1 for x in input().split()]
neighbors = collections.defaultdict(list)
for i in range(N - 1):
    a, b = map(int, input().split())
    neighbors[a - 1].append(b - 1)
    neighbors[b - 1].append(a - 1)

subtree_sizes = [0] * N


def calc_sizes(node, parent):
    sz = 1
    for i in neighbors[node]:
        if i != parent:
            sz += calc_sizes(i, node)
    subtree_sizes[node] = sz
    return sz


calc_sizes(0, -1)
components = {c: [subtree_sizes[0]] for c in range(N)}


def calc_components(node, parent):
    color = colors[node]
    if parent >= 0 and colors[parent] != color:
        components[colors[parent]].append(subtree_sizes[node])
    components[color][-1] -= subtree_sizes[node]
    for i in neighbors[node]:
        if i != parent:
            calc_components(i, node)


calc_components(0, -1)


def count_paths(n):
    return n * (n + 1) // 2


total_paths = count_paths(subtree_sizes[0])
for c in range(N):
    print(total_paths - sum(count_paths(size) for size in components[c]))


### FIXED CODE ###

import collections
import sys

sys.setrecursionlimit(10 ** 6)

N = int(input())
colors = [int(x) - 1 for x in input().split()]
neighbors = collections.defaultdict(list)
for i in range(N - 1):
    a, b = map(int, input().split())
    neighbors[a - 1].append(b - 1)
    neighbors[b - 1].append(a - 1)

subtree_sizes = [0] * N


def calc_sizes(node, parent):
    sz = 1
    for i in neighbors[node]:
        if i != parent:
            sz += calc_sizes(i, node)
    subtree_sizes[node] = sz
    return sz


calc_sizes(0, -1)
components = {c: {0: N} for c in range(N)}
components[colors[0]] = {}
color_stack = {c: [0] for c in range(N)}
color_stack[colors[0]] = []


def calc_components(node, parent):
    color_stack_pushed = False
    if parent >= 0 and colors[parent] != colors[node]:
        color_parent = color_stack[colors[node]][-1]
        components[colors[node]][color_parent] -= subtree_sizes[node]
        components[colors[parent]][node] = subtree_sizes[node]
        color_stack[colors[parent]].append(node)
        color_stack_pushed = True
    for i in neighbors[node]:
        if i != parent:
            calc_components(i, node)
    if color_stack_pushed:
        color_stack[colors[parent]].pop()


calc_components(0, -1)


def count_paths(n):
    return n * (n + 1) // 2


total_paths = count_paths(subtree_sizes[0])
for c in range(N):
    print(total_paths - sum(count_paths(size) for size in components[c].values()))
a,b,c,d=map(int,input().split())
print(["No","Yes"][abs(a-c)<=d or (abs(a-b)<=d and abs(b-c)<=d])

### FIXED CODE ###

a,b,c,d=map(int,input().split())
print(["No","Yes"][abs(a-c)<=d or (abs(a-b)<=d and abs(b-c)<=d)])
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int w[n];
  for(int i=0;i<n;i++)cin>>w[i];
  int s1=0,s2=0;
  for(int i=0;i<n;i++)s1+=w[i];
  int ans=abs(s1-s2);
  for(int i=0;i<n;i++){
    s1-=w[i];
    s2+=w[i];
    ans=min(ans,abs(s1-s2));
  }
  cout<<ans<<endl;
}

### FIXED CODE ###

n=int(input())
w=list(map(int,input().split()))
for i in range(n-1):
  w[i+1]+=w[i]
ans=100000
for i in range(n-1):
  ans=min(ans,abs(w[i]-(w[n-1]-w[i])))
print(ans)
r,g,b = map(input().split())
num = r + g + b
if int(num)%4 == 0:
    print('YES')
else:
    print('NO')



### FIXED CODE ###

r,g,b = map(str, input().split())
num = r + g + b
if int(num)%4 == 0:
    print('YES')
else:
    print('NO')
spam=input().split(' ')
print(' '.join(spam[0] * spam[1], 2*(spam[0]+spam[1])))

### FIXED CODE ###

z= input()
x, y = z.split()
 
m = int(x)*int(y)
l = int(x)*2+int(y)*2
print('{} {}'.format(m,l))
import sys

def bubble_sort(C, N):
	for i in range(N):
		for j in range(N - 1, i, -1):
			if C[j][1] < C[j - 1][1]:
				C[j], C[j - 1] = C[j - 1], C[j]
				
	return C

def	selection_sort(C, N):
	for i in range(N):
		minj = i
		for j in range(i, N):
			if C[j][1] < C[minj][1]:
				minj = j

		C[i], C[minj] = C[minj], C[i]
	
	return C

fin = open("test.txt", "r")
#fin = sys.stdin

N = int(fin.readline())
A = fin.readline().split()
B = A[:]

A = bubble_sort(A, N)
B = selection_sort(B, N)

print(" ".join(A))
print("Stable")

print(" ".join(B))
if A == B:
	print("Stable")
else:
	print("Not stable")

### FIXED CODE ###

import sys

def bubble_sort(C, N):
	for i in range(N):
		for j in range(N - 1, i, -1):
			if C[j][1] < C[j - 1][1]:
				C[j], C[j - 1] = C[j - 1], C[j]
				
	return C

def	selection_sort(C, N):
	for i in range(N):
		minj = i
		for j in range(i, N):
			if C[j][1] < C[minj][1]:
				minj = j

		C[i], C[minj] = C[minj], C[i]
	
	return C

#fin = open("test.txt", "r")
fin = sys.stdin

N = int(fin.readline())
A = fin.readline().split()
B = A[:]

A = bubble_sort(A, N)
B = selection_sort(B, N)

print(" ".join(A))
print("Stable")

print(" ".join(B))
if A == B:
	print("Stable")
else:
	print("Not stable")
N=int(input().split())

ans=False
for i in range(9):
  for j in range(9):
    if i*j==N:
      ans=True
      break
print(("No","Yes")[ans])

### FIXED CODE ###

N=int(input())

ans=False
for i in range(1,10):
  for j in range(1,10):
    if i*j==N:
      ans=True
      break
print(("No","Yes")[ans])
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
X=input()
XX=int(X,2)
m=X.count('1')
l=[XX%(m+1),(XX%(m-1))]
for i in range(N):
    if X[i]=='0':
        n=l[0]+pow(2,(N-1)-i,m+1)
        n%=m+1
    else:
        n=l[1]-pow(2,(N-1)-i,m-1)
        n%=m-1
    ans=1
    while n>0:
        n=n%bin(n).count('1')
        ans+=1
    print(ans)
        

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
X=input()
XX=int(X,2)
m=X.count('1')
if m-1>0:
    l=[XX%(m+1),(XX%(m-1))]
else:
    l=[XX%(m+1),0]
for i in range(N):
    if X[i]=='0':
        n=l[0]+pow(2,(N-1)-i,m+1)
        n%=m+1
    else:
        if m-1==0:
            print(0)
            continue
        n=l[1]-pow(2,(N-1)-i,m-1)
        n%=m-1
    ans=1
    while n>0:
        n%=bin(n).count('1')
        ans+=1
    print(ans)
s = str(input()) 
lst = [s[0:5], , s[6:13], , s[14:]]
print(''.join(lst))

### FIXED CODE ###

s = str(input())
ans = ''

for i in range(19):
    
    if i==5 or i==13:
        ans += ' '

    else:
        ans += s[i]

print(ans)
a,b=map(int,ipnut().split())
print(str(min(int(a),int(b)))*max(int(a),int(b)))

### FIXED CODE ###

a,b=map(int,input().split())
print(str(min(a,b))*max(a,b))
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, n_origin, s, keta;
    cin >> n;
    n_origin = n;
    s = 0;
    keta = 10;

    while (n >= 1) {
        s += n%10;
        n /= keta;
    }

    if (n_origin%s == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

### FIXED CODE ###

n = int(input())
n_origin = n

s = 0
keta = 10

while n >= 1:
    s += n%10
    n //= keta

if n_origin%s==0:
    print('Yes')
else:
    print('No')
sunuke,var = map(int,input().split())
loser = [1] * sunuke
for i in range(var):
  d = int(input())
  buy = map(int(input().split())
  for t in buy:
    winer[t-1] = 0
print(sum(loser))

### FIXED CODE ###

n,k = map(int,input().split())
x = []
for i in range (k):
  d = int(input())
  a = list(map(int,input().split()))
  x += a
print(n-len(set(x)))
import math

input = int(input()
guess = math.floor(input / 1.08)
if math.floor(guess * 1.08) == input:
    print(guess)
elif math.floor((guess + 1) * 1.08) == input:
    print(guess + 1)
else:
    print(':(')

### FIXED CODE ###

import math

input = int(input())
guess = math.floor(input / 1.08)
if math.floor(guess * 1.08) == input:
    print(guess)
elif math.floor((guess + 1) * 1.08) == input:
    print(guess + 1)
else:
    print(':(')
a, b = map(int, input().split())
s = input()
if s[a] == "-" :
    if int(s[:a]) is int and int(s[a+1:]) is int :
        print("Yes")
    else :
        print("No")
else :
    print("No")

### FIXED CODE ###

a, b = map(int, input().split())
s = input()
if s[a] == "-" :
    try :
        if (isinstance(int(s[:a]),int)) and (isinstance(int(s[a+1:]),int)) :
            print("Yes")
        else :
            print("No")
    except :
        print("No")
else :
    print("No")
,B,K = map(int,input().split())
P = []
for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        P.append(i)
print(P[len(P)-K])


### FIXED CODE ###

A,B,K = map(int,input().split())
P = []
for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        P.append(i)
print(P[len(P)-K])
string = input()
a, b, c = map(int, (string.split(' ')))
if a < b && b < c 
    print('Yes')
else:
    print('No')


### FIXED CODE ###

string = input()
a, b, c = map(int, (string.split(' ')))
if a < b & b < c :
    print('Yes')
else:
    print('No')
n,k=map(int,input().split())
S=[] #[ネタ種類、おいしさ]のリスト
for i in range(n):
    S.append(list(map(int,input().split())))
S.sort(reverse=1,key=lambda x:x[1])

neta=max(S[j][0] for j in range(n)) #ネタの種類数

F=[0 for i in range(neta+1)] #ネタi種のときの美味しさの和の最大値のリスト

ma=sum(S[i][1] for i in range(k))

neta_s=len(set([S[i][0] for i in range(k)]))

F[neta_s]=ma

#print(S)
#print(F)
#print(ma)

netalist=[0 for i in range(n)] #i種類目のネタを使った個数
keseru=[] #ネタに重複がある寿司のリスト(消してもいい寿司)
for i in range(k):
    if netalist[S[i][0]]==1 :
        keseru.append(S[i])
        
    netalist[S[i][0]]+=1

#print(keseru)

right=len(keseru)-1
left=k
for i in range(neta_s+1,k+1):
    while netalist[S[left][0]]!=0 :
        left+=1
    netalist[S[left][0]]+=1
    F[i]=F[i-1]+S[left][1]-keseru[right][1]
    right-=1
    left+=1

#print(F)
for i in range(neta_s,k+1) :
    F[i]+=i**2

print(max(F))


### FIXED CODE ###

n,k=map(int,input().split())
S=[] #[ネタ種類、おいしさ]のリスト
for i in range(n):
    S.append(list(map(int,input().split())))
S.sort(reverse=1,key=lambda x:x[1])

netano_min=min(S[j][0] for j in range(n))
for i in range(n):
    S[i][0]-=netano_min-1

neta=max(S[j][0] for j in range(n)) #ネタの種類数

F=[0 for i in range(neta+1)] #ネタi種のときの美味しさの和の最大値のリスト

ma=sum(S[i][1] for i in range(k))

neta_s=len(set([S[i][0] for i in range(k)]))

netano_min=min(S[j][0] for j in range(n))

F[neta_s]=ma

#print(S)
#print(F)
#print(ma)

netalist=[0 for i in range(n+1)] #i種類目のネタを使った個数
keseru=[] #ネタに重複がある寿司のリスト(消してもいい寿司)
for i in range(k):
    if netalist[S[i][0]]>=1 :
        keseru.append(S[i])
        
    netalist[S[i][0]]+=1

#print(keseru)
#print(netalist)

right=len(keseru)-1
left=k
i=neta_s+1
while len(keseru)>0 and i<=k and right>=0 and left<=n-1 :
    while left<=n-1 and netalist[S[left][0]]!=0 :
        left+=1
    if left==n :
        break
    netalist[S[left][0]]+=1
    F[i]=F[i-1]+S[left][1]-keseru[right][1]
    right-=1
    left+=1
    i+=1

#print(F)
for j in range(neta_s,i+1-1) :
    F[j]+=j**2

print(max(F))
import numpy as np
n,d = map(int,input().split())
ans=0
g=[]
if d==1:
  ans=n*(n-1)//2
  print(ans)
else:
  for _ in range(n):
    for i in range(len(g)):
	    lis = np.array(list(map(int,input().split())))
    	u = g[i]-lis
        z=np.linalg.norm(u)
        if z-int(z)==0:
          ans+=1
    g.append(lis)
print(ans)
  

### FIXED CODE ###

import numpy as np
n,d = map(int,input().split())
ans=0
g=[]
if d==1:
    for _ in range(n):
        lis = np.array(list(map(int,input().split())))
    ans=n*(n-1)//2
    print(ans)
else:
    for _ in range(n):
        lis = np.array(list(map(int,input().split())))
        for i in range(len(g)):
            u = g[i]-lis
            z=np.linalg.norm(u)
            if z==int(z):
                ans+=1
        g.append(lis)
    print(ans)
N = int(input())
W = []
W.append(input())
for _ in range(N-1):
    W.append(input())
    if W[-1] in W[:-2]
        print("No")
        break
    if W[-1][0] != W[-2][-1]:
        print("No")
        break
else:
    print("Yes")

### FIXED CODE ###

N = int(input())
W = []
W.append(input())
for _ in range(N-1):
    new_W = input()
    if new_W in W:
        print("No")
        break
    if new_W[0] != W[-1][-1]:
        print("No")
        break
    W.append(new_W)
else:
    print("Yes")
for i in range(len(s_l)):
    if a == s_l[i]:
        try:
            print(s_l[i+1])
        except:
            print(s_l[-1])
        break

### FIXED CODE ###

s_l = ['Sunny', 'Cloudy', 'Rainy' ]
a = input()
for i in range(len(s_l)):
    if a == s_l[i]:
        try:
            print(s_l[i+1])
        except:
            print(s_l[0])
        break
import re
S=input()
match=re.findall(r'[AGCT]+',S)
print(max(len(s) for s in match))

### FIXED CODE ###

import re
S=input()
match=re.findall(r'[AGCT]+',S)
if len(match)==0:
  print(0)
else:
  print(max(len(s) for s in match))
N, M = [x for x in input().split()]
E = [[] for x in range(N+1)]
visited = set()

for i in range(M):
    A, B = [x for x in input().split()]
    E[A].append(B)
    E[B].append(A)

if E[1] & E[N]:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


### FIXED CODE ###

N, M = [int(x) for x in input().split()]
E = [[] for x in range(N+1)]
visited = set()

for i in range(M):
    A, B = [int(x) for x in input().split()]
    E[A].append(B)
    E[B].append(A)

if set(E[1]) & set(E[N]):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
S = list(input())
w = int(input())
li = [S[w*i] for i in range(len(S)//w + 1)]
result = ''.join(li)

print(result)

### FIXED CODE ###

S = list(input())
w = int(input())
li = [S[w*i] for i in range((len(S)-1)//w + 1)]
result = ''.join(li)

print(result)
import math
ans=-1
nums=input().split(" ")
t8,t10=int(nums[0]),int(nums[1])
value=t8*100/8
value_f=math.ceil(value*1.2)
while True:
	tax8,tax10=math.floor(value_f*0.08),math.floor(value_f*0.1)
	if tax8== t8 and tax10==t10:
		ans=value_f
		value_f-=1
	elif tax8<t8 or tax10<t10:
		print(ans)
		break
	else:
		value_f-=1
	if value_f==0:
		print(ans)
		break

### FIXED CODE ###

letter=input()
if "A" not in letter:
  print("No")
elif "B" not in letter:
  print("No")
else:
  print("Yes")