Harryxun/stf_run huggingface dataset:
import itertools
h, w = map(int, input().split())
s_list = []
for i in range(h):
  s_list.append(list(input()))
area_list = []
check_list = set()

def rec_create_area(point, tmp_area, current_str):
  new_point_list = []
  new_point_list.append((point[0] + 1, point[1]))
  new_point_list.append((point[0], point[1] + 1))
  for new_point in new_point_list:
    if new_point[0] >= h or new_point[1] >= w:
      continue
    if new_point in check_list:
      continue
    new_str = s_list[new_point[0]][new_point[1]]
    if new_str == current_str:
      continue
    if new_str == "#":
      tmp_area[0] += 1
    else:
      tmp_area[1] += 1
    check_list.add(new_point)
    rec_create_area(new_point, tmp_area, new_str)
  
for a, b in itertools.product(range(h), range(w)):
  check_point = (a, b)
  if check_point in check_list:
    continue
  check_list.add(check_point)
  current_str = s_list[0][0]
  if current_str == "#":
    tmp_area = [1, 0]
  else:
    tmp_area = [0, 1]
  rec_create_area(check_point, tmp_area, current_str)
  area_list.append(tmp_area)
  
print(sum([x[0] * x[1] for x in area_list]))

### FIXED CODE ###

n = int(input())
h = int(input())
w = int(input())
print((n + 1 - h) * (n + 1 - w))
a, b, x = map(int, input().split())
count:int=0
for i in range(a, b+1):
    if i%x==0:
        count+=1
print(count)

### FIXED CODE ###

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

print( b//x - (a-1)//x )
import time


def main():

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

    sum = [0] * (N + 1)

    for i in range(N):
        if S[i] == 'A' and S[i+1] == 'C': sum[i+1] = sum[i] + 1
        else: sum[i+1] = sum[i]

    for i in range(Q):
        l, r = map(int, input().split())
        print(sum[r-1] - sum[l-1])


if __name__ == '__main__':
    start = time.perf_counter()

    main()

    end = time.perf_counter()
    # print(end - start)


### FIXED CODE ###

import time


def main():

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

    sum = [0] * (N + 1)

    for i in range(1, N):
        if S[i-1] == 'A' and S[i] == 'C': sum[i] = sum[i-1] + 1
        else: sum[i] = sum[i-1]

    for i in range(Q):
        l, r = map(int, input().split())
        print(sum[r-1] - sum[l-1])


if __name__ == '__main__':
    start = time.perf_counter()

    main()

    end = time.perf_counter()
    # print(end - start)
s = str(input())
if s = "RRR":
  print(3)
elif s = "RRS" and s = "SRR":
  print(2)
elif s = "RSS" and s = "SRS" and s = "SSR" and s = "RSR":
  print(1)
else:
  print(0)


### FIXED CODE ###

s = input()
if s == "RRR":
  print(3)
if s == "SSS":
  print(0)
if s == "RRS":
  print(2)
if s == "SRR":
  print(2)
if s == "RSS":
  print(1)
if s == "SRS":
  print(1)
if s == "SSR":
  print(1)
if s == "RSR":
  print(1)
def dfs(now,vis,e,j,el):
  vis+=[now]
  e[now]=j
  res=set([now])
  for to in el[now]:
    if to in vis:continue
    res=res|dfs(to,vis[:],e,j,el)
    e[to]=j
  return res
n,k,l=map(int,input().split())
el=[set() for _ in range(n+1)]
et=[set() for _ in range(n+1)]
ela=[set() for _ in range(n+1)]
eta=[set() for _ in range(n+1)]
eml=[0]*(n+1)
emt=[0]*(n+1)
ans=[0]*(n+1)
for _ in range(k):
  p,q=map(int,input().split())
  el[p].add(q)
  el[q].add(p)
j=0
for i in range(n+1):
  if eml[i]:continue
  ela[j]=dfs(i,[],eml,j,el)
  j+=1
for _ in range(l):
  p,q=map(int,input().split())
  et[p].add(q)
  et[q].add(p)
j=0
for i in range(n+1):
  if emt[i]:continue
  eta[j]=dfs(i,[],emt,j,et)
  j+=1
for i in range(n+1):
  ans[i]=len(eta[emt[i]]&ela[eml[i]])
print(*ans[1:])

### FIXED CODE ###

from collections import Counter
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.root = [-1]*(n+1)
    self.rnk = [0]*(n+1)
  def find(self, x):
    if(self.root[x] < 0):
      return x
    else:
      self.root[x] = self.find(self.root[x])
      return self.root[x]
  def unite(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if(x == y):
      return 
    elif(self.rnk[x] > self.rnk[y]):
      self.root[x] += self.root[y]
      self.root[y] = x
    else:
      self.root[y] += self.root[x]
      self.root[x] = y
      if(self.rnk[x] == self.rnk[y]):
        self.rnk[y] += 1
  def same(self, x, y):
    return self.find(x) == self.find(y)
n,k,l=map(int,input().split())
e=[[i]for i in range(n+1)]
ur=UnionFind(n)
ut=UnionFind(n)
for i in range(k):
  a,b=map(int,input().split())
  ur.unite(a,b)
for _ in range(l):
  a,b=map(int,input().split())
  ut.unite(a,b)
pair=[(ur.find(i),ut.find(i)) for i in range(1,n+1)]
c=Counter(pair)
ans=[c[i] for i in pair]
print(*ans)
s = list(str(input()))
print(t = s[0::2])

### FIXED CODE ###

s = str(input())

ss = ""
for i in range(len(s)):
	if (i +1)%2 != 0:
		ss += s[i]
print(ss)
if n>=2*k-1:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

n, k = map(int, input().split())
if n>=2*k-1:
  print('YES')
else:
  print('NO')
import sys

map(int, [a,b]) = sys.stdin.readlines().strip()

print("{0} {1}".format(a+b, 2*a + 2*b))

### FIXED CODE ###

import sys
 
lines = [x.strip().split() for x in sys.stdin.readlines()][0]
[a, b] = [int(x) for x in lines]
 
print a*b, 2*(a+b)
arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K=input()
print(arr[int(K)])

### FIXED CODE ###

arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K=input()
K=int(K)
print(arr[K-1])
n = int(input())

xl = (map(int, input().split()) for _ in range(n))
w = [(x - l, x + l) for x, l in xl]
w = sorted(w, key=lambda x: x[1])
cur = w[0][1]
res = 1
for l, r in w[1:]:
    if l >= cur:
        res += 1
        cur = r
print(res)


### FIXED CODE ###

MAX = int(1e9)
n, k, s = map(int, input().split())
if s != MAX:
    for _ in range(k):
        print(s, end=" ")
    for _ in range(n - k):
        print(MAX, end=" ")
else:
    for _ in range(k):
        print(s, end=" ")
    for _ in range(n - k):
        print(1, end=" ")
N = int(input())
A = list(map(int,input().split()))

S = sum(map(abs,A))

if all([a>0 for a in A]):
    print(S-2*min(A))
    A = sorted(A)
    B = [A[0]]
    for i in range(1,N):
        B.append(B[-1]-A[i])
    for i in range(N-2):
        print(B[i],A[i+1])
    print(A[N-1],B[N-2])

elif all([a<0 for a in A]):
    print(S+2*max(A))
    A = sorted(A)
    B = [A[-1]]
    for i in range(N-1):
        B.append(B[-1]-A[i])
    for i in range(N-1):
        print(B[i],A[i])

else:
    print(S)
    A = sorted(A)
    B = [A[0]]
    for i in range(N):
        if A[-2-i]<0:
            print(A[-1-i],B[-1])
            B.append(A[-1-i]-B[-1])
            break
        print(B[-1],A[-1-i])
        B.append(B[-1]-A[-1-i])
    C = [B[-1]]
    for i in range(1,N):
        if A[i]>0:
            break
        print(C[-1],A[i])
        C.append(C[-1]-A[i])

### FIXED CODE ###

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

S = sum(map(abs,A))

if all([a>0 for a in A]):
    print(S-2*min(A))
    A = sorted(A)
    B = [A[0]]
    for i in range(1,N):
        B.append(B[-1]-A[i])
    for i in range(N-2):
        print(B[i],A[i+1])
    print(A[N-1],B[N-2])

elif all([a<0 for a in A]):
    print(S+2*max(A))
    A = sorted(A)
    B = [A[-1]]
    for i in range(N-1):
        B.append(B[-1]-A[i])
    for i in range(N-1):
        print(B[i],A[i])

else:
    print(S)
    A = sorted(A)
    B = [A[0]]
    for i in range(N):
        if N-1-2-i<0 or A[-2-i]<0:
            print(A[-1-i],B[-1])
            B.append(A[-1-i]-B[-1])
            break
        print(B[-1],A[-1-i])
        B.append(B[-1]-A[-1-i])
    C = [B[-1]]
    for i in range(1,N):
        if A[i]>=0:
            break
        print(C[-1],A[i])
        C.append(C[-1]-A[i])
n = int(input())
h = list(map(int,input().split()))

res = []
count = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    count += 1
  else:
    if h[n-2] >= h[n-1]:
      count += 1
    res.append(count)
    count = 0
      
print(max(res))

### FIXED CODE ###

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

res = []
count = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    count += 1
    if i == (n-2):
      res.append(count)
  else:
    if count != 0: 
      res.append(count)
    count = 0

if len(res) == 0:
  print(0)
else:
  print(max(res))
# coding: utf-8

# In[1]:

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


# In[2]:

import copy
import numpy as np


# In[3]:

try:
    from math import gcd as ogcd
except:
    from fractions import gcd as ogcd
from functools import reduce

def gcd(*numbers):
    return reduce(ogcd, numbers)


# In[4]:

gcd_list = []
for i in range(N):
    Ac = copy.copy(A)
    Ac.pop(i)
    #print(Ac)
    gcd_list.append(gcd(*Ac))


# In[5]:

print(np.max(np.array(gcd_list)))


# In[ ]:





### FIXED CODE ###


# coding: utf-8

# In[ ]:

A, B, T = map(int, input().split())


# In[ ]:

#A, B, T = 3, 5, 7


# In[ ]:

print(T//A*B)
str_dict = [0, 0, 0] 
val1 = 0
for i in range(int(input())):
  line = input()
  val1 += line.count('AB')
  if line[0] == 'B' and line[-1] == 'A':
    str_dict[2] += 1
  elif line[0] == 'B':
    str_dict[0] += 1
  elif line[-1] == 'A':
    str_dict[1] += 1
# if str_dict[2] == 0:
#   print(val1+min(str_dict[0], str_dict[1]))
# else:
#   if str_dict[0]+str_dict[1] > 0:
#     print(val1+str_dict[2]+min(str_dict[0], str_dict[1]))
#   else:
#     print(val1+str_dict[2]-1)
val2 = min(str_dict[0], str_dict[1])
tmp = max(str_dict[0]-val2, str_dict[1]-val2)
val3 = min(tmp, str_dict[2])
val4 = str_dict[2]-val3
if val3 == 0:
  val4 -= 1
print(val1+val2+val3+val4)

### FIXED CODE ###

R, G, B, N = map(int, input().split())
count = 0
for r in range(0, N+1, R):
  for g in range(0, N+1-r, G):
    val = (N - r - g)
    if val % B == 0 and val >= 0:
      count += 1
print(count)
import math
X = int(input())
c = 0

for i in range(10**18):
  n = 1.01**i
  if X == math.floor(n*100):
    print(i)
    break

### FIXED CODE ###

X = int(input())
A = 100
c = 0
while(A < X):
  A = int(A * 1.01)
  c = c + 1
  
print(c)
A, B = input().split()
B.replace('.', '')
print(int(A)*int(B)//100)

### FIXED CODE ###

from decimal import Decimal

A, B = input().split()
A = Decimal(A)
B = Decimal(B)
print(int(A*B))
K=int(input())
print(K//2*(K//2+k%2))

### FIXED CODE ###

K=int(input())
print(K//2*(K//2+K%2))
from heapq import heappush, heappop, merge

N, Q = map(int, input().split())
events = []
for _ in range(N):
    s, t, x = map(int, input().split())
    events.append((s-x, 1, x))
    events.append((t-x, -1, x))
events = sorted(events)
constructions = []
i = 0
for _ in range(Q):
    d = int(input())
    while i < 2*N and events[i][0] <= d:
        if events[i][1] > 0:
            heappush(constructions, events[i][2])
        else:
            temp = []
            while constructions[0] != events[i][2]:
                heappush(temp, heappop(constructions))
            heappop(constructions)
            constructions = list(merge([temp, constructions]))
        i += 1
    print(constructions[0] if constructions else -1)

### FIXED CODE ###

from heapq import heappush, heappop, merge
from collections import defaultdict
import sys
F = sys.stdin
def single_input(): return F.readline().strip("\n")
def line_input(): return F.readline().strip("\n").split()

def solve():
    N, Q = map(int, line_input())
    events = []
    for _ in range(N):
        s, t, x = map(int, line_input())
        events.append((s-x, 1, x))
        events.append((t-x, -1, x))
    for _ in range(Q):
        d = int(single_input())
        events.append((d, 2, d))
    events = sorted(events)

    constructions = []
    under_construction = defaultdict(bool)
    ans = ''
    for _, flag, coord in events:
        if flag == 1:
            heappush(constructions, coord)
            under_construction[coord] = True
        elif flag == -1:
            under_construction[coord] = False
        else:
            while constructions:
                x = heappop(constructions)
                if under_construction[x]: # x is the minimum coordinate under construction
                    heappush(constructions, x)
                    ans += str(x) + '\n'
                    break
            else: # no constructions
                ans += '-1\n'
    print(ans)
    
if __name__ == "__main__":
    solve()
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k == 0:
            print('No')
            sys.exit(1)
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k < 0:
            print('No')
            sys.exit(1)
    else:
        break
print('Yes')

### FIXED CODE ###

import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k < 0:
            print('No')
            sys.exit()
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k < 0:
            print('No')
            sys.exit()
    else:
        break
print('Yes')
N = int(raw_input())
health = map(int, raw_input().split())

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcd_driver(lst):
	if len(lst) <= 1:
		return lst[0]

	if len(lst) > 2:
		lst[1] = gcd(lst[0], lst[1])
		return gcd_driver(lst[1:])
	
	return gcd(lst[0], lst[1])

print(gcd_driver(health))


### FIXED CODE ###

N = int(raw_input())
health = map(int, raw_input().strip().split())

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

if len(health) == 1:
	print health[0]
else:
	g = gcd(health[0], health[1])
	for i in range(2, len(health)):
		g = gcd(g, health[i])
print g
S = input()
ans = float('inf')
for i in range(S-2):
  ans = min(ans, abs(753-s[i:i+3]))
print(ans)

### FIXED CODE ###

S = input()
ans = float('inf')
for i in range(len(S)-2):
  ans = min(ans, abs(753-int(S[i:i+3])))
print(ans)
# coding: utf-8
import sys

# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
printout = sys.stdout.write
sprint = sys.stdout.flush
# from heapq import heappop, heappush
# from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
# import math
# from itertools import product, accumulate, combinations, product
# import bisect
# import numpy as np
# from copy import deepcopy
from collections import deque

# from decimal import Decimal
# from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7


def intread():
    return int(sysread())
def mapline(t=int):
    return map(t, sysread().split())
def mapread(t=int):
    return map(t, read().split())

def run():
    H, W = mapline()
    A = []
    for i in range(H):
        A.append(list(mapline()))

    output = []
    for i in range(H):
        for j in range(W - 1):
            if A[i][j] % 2:
                A[i][j] -= 1
                A[i][j + 1] += 1
                output.append((i, j, i, j + 1))
    for i in range(H - 1):
        if A[i][H - 1] % 2:
            A[i][H - 1] -= 1
            A[i + 1][H - 1] += 1
            output.append((i, H - 1, i + 1, H - 1))

    print(len(output))
    for i1, j1, i2, j2 in output:
        print(f'{i1 + 1} {j1 + 1} {i2 + 1} {j2 + 1}')


if __name__ == "__main__":
    run()


### FIXED CODE ###

# coding: utf-8
import sys

# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
printout = sys.stdout.write
sprint = sys.stdout.flush
# from heapq import heappop, heappush
# from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
# import math
# from itertools import product, accumulate, combinations, product
# import bisect
# import numpy as np
# from copy import deepcopy
from collections import deque

# from decimal import Decimal
# from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7


def intread():
    return int(sysread())
def mapline(t=int):
    return map(t, sysread().split())
def mapread(t=int):
    return map(t, read().split())

def run():
    H, W = mapline()
    A = []
    for i in range(H):
        A.append(list(mapline()))

    output = []
    for i in range(H):
        for j in range(W - 1):
            if A[i][j] % 2:
                A[i][j] -= 1
                A[i][j + 1] += 1
                output.append((i, j, i, j + 1))
    for i in range(H - 1):
        if A[i][W - 1] % 2:
            A[i][W - 1] -= 1
            A[i + 1][W - 1] += 1
            output.append((i, W - 1, i + 1, W - 1))

    print(len(output))
    for i1, j1, i2, j2 in output:
        print(f'{i1 + 1} {j1 + 1} {i2 + 1} {j2 + 1}')


if __name__ == "__main__":
    run()
from collections import defaultdict


def longest_path(n, edges):
    adj_list = defaultdict(list)
    for x, y in edges:  # x -> y
        adj_list[y].append(x)

    distances = [None] * n

    def dfs(x):
        if distances[x] is None:
            for y in adj_list[x]:
                dfs(y)
            distances[x] = max((distances[y] + 1 for y in adj_list[x]), default=0)

    for x in range(n):
        dfs(x)

    return max(distances)


def main():
    n, m = [int(x) for x in input().split()]
    edges = [None] * m
    for i in range(m):
        edges[i] = [int(x) - 1 for x in input().split()]

    return longest_path(n, edges)


print(main())


### FIXED CODE ###

from collections import defaultdict, deque


def longest_path(n, edges):
    adj_list = defaultdict(list)
    for x, y in edges:  # x -> y
        adj_list[y].append(x)

    state = [0] * n
    distances = [0] * n
    stack = deque(range(n))

    while stack:
        x = stack.pop()
        if state[x] == 0:
            state[x] = 1
            stack.append(x)
            stack.extend(adj_list[x])
        elif state[x] == 1:
            state[x] = 2
            if adj_list[x]:
                distances[x] = max(distances[y] for y in adj_list[x]) + 1

    return max(distances)


def main():
    n, m = [int(x) for x in input().split()]
    edges = [None] * m
    for i in range(m):
        edges[i] = [int(x) - 1 for x in input().split()]

    return longest_path(n, edges)


print(main())
import sys

N, M = map(int, sys.stdin.readline().split())
P = [None]*M
S = [None]*M
for i in range(M):
    P[i], S[i] = sys.stdin.readline().split()

AC = [0]*N
WA = 0
"""
for i in range(M):
    if S[i] == "AC":
        if AC[int(P[i])-1] == 0:
            AC[int(P[i])-1] += 1
            for j in range(i):
                if P[j] == P[i] and S[j] == "WA":
                    WA += 1
"""


for i in range(M):
    if AC[i]==0 and S[i] == "WA":
        WA += 1
    if S[i] == "AC":
        if AC[int(P[i])-1] == 0:
            AC[int(P[i])-1] += 1

print(sum(AC), WA)

### FIXED CODE ###

N, M = map(int, input().split())
P = [None]*M
S = [None]*M
for i in range(M):
    P[i], S[i] = input().split()
    P[i] = int(P[i])

AC = [0]*(N+1)
wa = [0]*(N+1)
WA = 0

for i in range(M):
    if S[i] == "WA":
        if AC[P[i]] == 0:
            wa[P[i]] += 1
    else:
        AC[P[i]] = 1

for i in range(N+1):
    WA += wa[i]*AC[i] 

print(sum(AC[1:]), WA)
import sys
import heapq

def dijkstra(ad_lst, n, s, t):
    costs = [sys.maxsize for i in range(n+1)]
    costs[s] = 0
    prevs = [-1 for _ in range(n+1)]
    Q = []
    for i in range(1, n+1):
        heapq.heappush(Q, [costs[i], i])

    while(Q != []):
        c, u = heapq.heappop(Q)
        for v, c in ad_lst[u]:
            alt = costs[u] + c
            if alt < costs[v]:
                prevs[v] = u
                Q.remove([costs[v], v])
                heapq.heappush(Q, [alt, v])
                costs[v] = alt

    return costs

n,m,s,t, = map(int, input().split())

route_y = {i: [] for i in range(n+1)}
route_s = {i: [] for i in range(n+1)}
for i in range(m):
    u, v, a, b = map(int, input().split())
    route_y[u].append([v,a])
    route_y[v].append([u,a])
    route_s[u].append([v,b])
    route_s[v].append([u,b])

cost_y = dijkstra(route_y, n, s, t)
cost_s = dijkstra(route_s, n, t, s)
cost_ys = [y+s for y, s in zip(cost_y, cost_s)]
result = [sys.maxsize for _ in range(n+1)]
min_cost = result[-1]
for i in range(n, 0, -1):
    if min_cost > cost_ys[i]:
        min_cost = cost_ys[i]
    result[i] = min_cost
yen = 10**15
for i in range(1, n+1):
    print(yen - result[i])


### FIXED CODE ###

import heapq
from itertools import accumulate
inf = float('inf')

def dijkstra(ad_lst, n, s):
    costs = [inf for i in range(n+1)]
    costs[s], Q = 0, []
    heapq.heappush(Q, [costs[s], s])

    while(Q != []):
        c, u = heapq.heappop(Q)
        for v, c in ad_lst[u].items():
            if costs[u] + c < costs[v]:
                heapq.heappush(Q, [costs[u] + c, v])
                costs[v] = costs[u] + c

    return costs

n,m,s,t, = map(int, input().split())

route_y = {i: {} for i in range(n+1)}
route_s = {i: {} for i in range(n+1)}
for i in range(m):
    u, v, a, b = map(int, input().split())
    route_y[u][v] = a
    route_y[v][u] = a
    route_s[u][v] = b
    route_s[v][u] = b

cost_y = dijkstra(route_y, n, s)
cost_s = dijkstra(route_s, n, t)
result = list(accumulate([y+s for y,s in zip(cost_y, cost_s)][::-1], min))
yen = 10**15
[print(yen-result[i]) for i in range(n-1, -1, -1)]
X = list(map(int, input().split()))
X.sort()
if N >= M:
    print(0)
else:
    L = []
    for i in range(M-1):
        L.append(X[i+1] - X[i])
    L.sort()
    for i in range(N-1):
        del L[-1]
    print(sum(L))

### FIXED CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))
if N >=  M:
    print(0)
else:
    X.sort()
    X_sub = []
    for i in range(len(X)-1):
        X_sub.append(X[i+1]-X[i])
    X_sub.sort()
    for i in range(N-1):
        del X_sub[-1]
    print(sum(X_sub))
n=int(input())
s=input()
cnt=0
for i in range(n-2):
	if s[i:i+3] == "ABC":
	[]	cnt+=1
print(cnt)


### FIXED CODE ###

n=int(input())
s=input()
cnt=0
for i in range(n-2):
	if s[i:i+3] == "ABC":
		cnt+=1
print(cnt)
s = input()
n = input()
q = [0]*int(n)
 
for i in range(0,int(n)):
  q[i] = input().split()
  
for i in range(0,int(n)):
  if(q[i][0] == "1"):
    s = s[::-1]
  elif(q[i][0] == "2"):
    if(q[i][1] == "1"):
      s = q[i][2] + s
    else:
      s = s + q[i][2]
 
print(s)

### FIXED CODE ###

s = input()

if(s == "AAA" or s == "BBB"):
  print("No")
else:
  print("Yes")