Harryxun/stf_run huggingface dataset:
def main():
    n, m, *ab = map(int, open(0).read().split())
    e = [set() for _ in range(n)]
    for u, v in zip(*[iter(ab)] * 2):
        e[u - 1].add(v - 1)
        e[v - 1].add(u - 1)

    ans = 0
    for _ in range(m):
        count = 0
        for i, x in enumerate(e):
            if len(x) == 1:
                e[i] = []
                e[x[0]] -= {i}
                count += 1
        if count:
            ans += count
        else:
            print(ans)
            exit()


if __name__ == "__main__":
    main()


### FIXED CODE ###

import copy


def main():
    # n: 頂点数
    # w: 辺の数
    n, w = map(int, input().split())
    # v -> v ; cost: 0
    d = [[False] * n for i in range(n)]

    # d[u][v] : 辺u-vのコスト(if not: inf)
    e = []
    for i in range(w):
        # edge: u -> v ; cost : z
        u, v = map(lambda x: int(x) - 1, input().split())
        e.append([u, v])
        # 無向グラフを想定
        d[u][v] = True
        d[v][u] = True

    def dfs(graph, visited, x):
        if visited[x]:
            return
        visited[x] = True
        for i in range(n):
            if graph[x][i]:
                dfs(graph, visited, i)

    ans = 0
    for (u, v) in e:
        graph = copy.deepcopy(d)
        graph[u][v] = False
        graph[v][u] = False
        for i in range(n):
            visited = [False for _ in range(n)]
            dfs(graph, visited, i)
            if not all(visited):
                ans += 1
                break
    print(ans)


if __name__ == "__main__":
    main()
n=int(input())
sum=0
for i in range(1,n)
 if i%3!=0 and i%5!=0:
    sum+=i
print(sum)

### FIXED CODE ###

n=int(input())
sum=0
for i in range(1,n+1):
 if i%3!=0 and i%5!=0:
    sum+=i
print(sum)
N, A, B = map(int, input().split())

a = "b"*A
b = "r"*B

l = ""
for i in range(1,int(N/(A+B)+1)+1):
    l = l + a + b

print(l[0:N].count("b"))

### FIXED CODE ###

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

n = N // (A + B)
mod = N % (A + B)
 
if mod >= A:
    print(A * n + A)
else:
    print(A * n + mod)
import itertools
n,c = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x:x[0])
# いもす法
x=[0]*(10**5+1)
for i in range(n):
    x[a[i][0]]+=1
    x[a[i][1]+1]-=1

x = itertools.accumulate(x)

print(max(x))

### FIXED CODE ###

import itertools
n,c = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x:x[0])
a.sort(key=lambda x:x[2])

# 同じチャンネルの番組を繋げる。
for i in range(n-1):
    if a[i][1]==a[i+1][0] and a[i][2]==a[i+1][2]:
        a[i][1]-=1
# いもす法
x=[0]*(10**5+5)
for i in range(n):
    x[a[i][0]]+=1
    x[a[i][1]+1]-=1

x = itertools.accumulate(x)
print(max(x))
A, B, C, K = map(int,input().split())
if K <= A:
    print(K)
elif K <= A + B:
    print(A)
else:
    print(2*A + B - K)

### FIXED CODE ###

s = input()
t = input()
a = t[-1]

S = s + a
if t == S:
    print('Yes')
else:
    print('No')
import sys
m=166666;s=[1]*m;t=[1]*m
for i in range(m):
 for j in range(2):
  if (s[i],t[i])[j]:
   k=6*i+[5,7][j];n=[i+k,k-i-2]
   s[n[i]::k]=[0]*len(s[n[i]::k])
   t[n[1-i]::k]=[0]*len(t[n[1-i]::k])
for e in map(int,sys.stdin):
 print([e-1,sum(s[:(e+1)//6])+sum(t[:(e-1)//6])+2][e>3])


### FIXED CODE ###

import sys
m=500000;a=[1]*m
for i in range(3,999,2):
 if a[i//2]:a[i*i//2::i]=[0]*len(a[i*i//2::i])
p=[]
for i in range(m*2):p+=[i-1 if i<4 else p[i-1]+[0,a[i//2]][i%2]]
for e in sys.stdin:print(p[int(e)])
n = input()
if n%2 == 0:
  print(n)
else :
  print(n*2)

### FIXED CODE ###

n = int(input())
if n%2 == 0:
  print(n)
else :
  print(n*2)
a,b,k = input().split(None, 3)
A = int(a)
B = int(b)
K = int(k)
Ta = 0
Ao = 0

if A >= K:
  Ta = A-k
  Ao = B

elif A+B >= K > A :
  Ta = 0
  Ao = B - (K-A)

else:
  Ta = 0
  Ao = 0

print(Ta,Ao)

### FIXED CODE ###

a,b,k = input().split(None, 3)
A = int(a)
B = int(b)
K = int(k)

if A >= K:
  print(A-K,B)

elif A+B >= K > A :
  print(0, B -K+A)

else:
  print(0,0)
import sys
def input():
    return sys.stdin.readline()[:-1]
import heapq
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a.sort()
f.sort()
ans=[]
for i in range(n):
    ans.append([f[i]*a[n-i-1]*-1,a[n-i-1]*-1])
heapq.heapify(ans)
# print(ans)
for i in range(k):
    tmp=heapq.heappop(ans)
    # print(tmp)
    if tmp[1]==0:
        heapq.heappush(ans,tmp)
        break
    tmp[0]=tmp[0]//tmp[1]
    tmp[1]+=1
    tmp[0]=tmp[0]*tmp[1]
    heapq.heappush(ans,tmp)
cnt=0
for i in range(n):
    cnt=max(cnt,ans[i][0]*-1)
print(cnt)

### FIXED CODE ###

import sys
import math
def input():
    return sys.stdin.readline()[:-1]
a,b,x=map(int,input().split())
if a*a*b/2>x:
    y=float(2*x)/a/b
    tai=pow(y*y+b*b,0.5)
    print(90-math.degrees(math.asin(y/tai)))
else:
    x=a*a*b-x
    y=float(2*x)/a/a
    tai=pow(y*y+a*a,0.5)
    print(math.degrees(math.asin(y/tai)))
import numpy as np
N = int(input())
n = N % 2
if n == 1:
  ans = 0
else:
  AB = [N]
  for i in range(N // 2 -1):
    ab = AB[-1] - 2
    AB.append(ab)
  AB = [int(np.log10(ab)) for ab in AB if ab % 10 ==0]
  ans = np.sum(AB)
print(ans)

### FIXED CODE ###

import numpy as np
N = int(input())
n2 = N % 2
if n2 != 0:
  ans = 0
elif N <= 2:
  ans =0
else:
  a = int(np.log(N) // np.log(5))
  A = [N // (2 * (5 ** (i + 1))) for i in range(a)]
  ans = np.sum(A)
print(ans)
s=input()
import math
xlist=[math.abs(int(s[i:i+2])-753) for i in range(0,len(s)-3)]
print(min(xlist))

### FIXED CODE ###

s=input()
xlist=[abs(int(s[i:i+3])-753) for i in range(len(s)-2)]
print(min(xlist))
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
m = 1000000

count = 0
cnt = [0] * m
for i in range(n):
  if cnt[a[i]] == 0:
    for j in range(a[i], m, a[i]):
      cnt[j] += 1
  elif cnt[a[i]] == 1:
    cnt[a[i]] = 2
for i in range(n):
  if cnt[a[i]] == 1:
    count += 1
print(count)

### FIXED CODE ###

# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
m = 1000005

count = 0
cnt = [0] * m
for i in range(n):
  if cnt[a[i]] == 0:
    for j in range(a[i], m, a[i]):
      cnt[j] += 1
  else:
    cnt[a[i]] = 2
for i in range(n):
  if cnt[a[i]] == 1:
    count += 1
print(count)
N,K = input().split()
n = int(N)
k = int(K)
hList = []

for i in range(0,n):
    hList.append(int(input()))

count = 0
for i in range(0,n):
    if hList[i] >= k:
        count += 1
print(count)

### FIXED CODE ###

N,K = input().split()
n = int(N)
k = int(K)
hList = input().split()

count = 0
for i in range(0,n):
    if int(hList[i]) >= k:
        count += 1
print(count)
import sys

sys.setrecursionlimit(10**5+10)

s = input()
n = len(s) + 1

a = [0 for _ in range(n)]
next_num=0

def solve(num):
	global next_num
	if num == 0:
		if s[0] == '<':
			a[num] = 0
			next_num = 1
			return 0
		else:
			next_num = 1
			a[num] = solve(num+1) + 1
	if num == n-1:
		if s[n-2] == '>':
			next_num = -1
			a[num] = 0
			return 0
		else:
			a[num] = solve(num-1) + 1
			next_num = -1
			return a[num]

	if s[num-1] == '>' and s[num] == '<':
		next_num = num+1
		a[num] = 0
		return 0
	elif s[num-1] == '>' and s[num] == '>':
		next_num = num+1
		a[num] = solve(num+1) + 1
		return a[num]
	elif s[num-1] == '<' and s[num] == '>':
		next_num = num+1
		num1 = solve(num-1)
		num2 = solve(num+1)
		a[num] = max(num1,num2) + 1
		return a[num]
	else:
		a[num] = solve(num-1) + 1
		next_num = num+1
		return a[num]

while next_num != -1:
	solve(next_num)

#print(a)
print(sum(a))


### FIXED CODE ###

import sys

iter_num = 5 * (10**5) + 10
sys.setrecursionlimit(iter_num)

s = input()
n = len(s) + 1

a = [0 for _ in range(n)]
next_num=0

def solve(num):
	global next_num
	if num == 0:
		if s[0] == '<':
			a[num] = 0
			next_num = 1
			return 0
		else:
			next_num = 1
			a[num] = solve(num+1) + 1
	if num == n-1:
		if s[n-2] == '>':
			next_num = -1
			a[num] = 0
			return 0
		else:
			a[num] = solve(num-1) + 1
			next_num = -1
			return a[num]

	if s[num-1] == '>' and s[num] == '<':
		next_num = num+1
		a[num] = 0
		return 0
	elif s[num-1] == '>' and s[num] == '>':
		a[num] = solve(num+1) + 1
		return a[num]
	elif s[num-1] == '<' and s[num] == '>':
		next_num = num+1
		a[num] = max(solve(num-1),solve(num+1)) + 1
		return a[num]
	else:
		#a[num] = solve(num-1) + 1
		a[num] = a[num-1] + 1
		next_num = num+1
		return a[num]

while next_num != -1:
	solve(next_num)

#print(a)
print(sum(a))
h,w=map(int,input().split())
n=int(input())
c=list(map(int,input().split()))
d=[]
for i in range(1,n+1):
  for j in c[i-1]:
    d.append(i)
ansl=[[0]*w for i in range(h)]
for i in range(h):
  if i%2==0:
    for j in range(w):
      ansl[i][j]=str(d[i*w+j])
  else:
    for j in range(w):
      ansl[i][w-j-1]=str(d[i*w+j])
for j in ansl:
  print(" ".join(j))


### FIXED CODE ###

h,w=map(int,input().split())
n=int(input())
c=list(map(int,input().split()))
d=[]
for i in range(1,n+1):
  for j in range(c[i-1]):
    d.append(i)
ansl=[[0]*w for i in range(h)]
for i in range(h):
  if i%2==0:
    for j in range(w):
      ansl[i][j]=str(d[i*w+j])
  else:
    for j in range(w):
      ansl[i][w-j-1]=str(d[i*w+j])
for j in ansl:
  print(" ".join(j))
n = int(input())
li = list(map(int,input().split()))
maxli = max(li)
judge = np.sum(li) - maxli - maxli
if judge > 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

sum = 0

for i in range(n):
    sum = sum + lis[i]

judge = sum - max(lis) - max(lis)

if judge > 0:
    print("Yes")
else:
    print("No")
import sys
import random
s = input()
t = input()
sl = len(s)
tl = len(t)

l = 0
r = 1000000//tl + 2s
r2 = r
s *= 999999//sl + 1
n = len(s)
base1 = 1007
mod1 = 10**9+7
modTank1 = [3000012541,3000012553,3000012563,3000012649,3000012683,3000012709]
mod1 = modTank1[random.randint(0,5)]
base1 = 1007
mod1 = 10**9+7
hash1 = [0]*(n+1)
power1 = [1]*(n+1)
for i,e in enumerate(s):
    hash1[i+1] = (hash1[i]*base1 + ord(e))%mod1
    power1[i+1] = (power1[i]*base1)%mod1

def rolling_hash(i, j):
    return (hash1[j]-hash1[i]*power1[j-i]%mod1)%mod1


while r - l > 1:
    m = l + (r-l)//2
    lt = len(t)*m
    hash2 = [0]*(lt+1)
    power2 = [1]*(lt+1)
    for i,e in enumerate(t*m):
        hash2[i+1] = (hash2[i]*base1 + ord(e))%mod1
        power2[i+1] = (power2[i]*base1)%mod1
    r_hash = hash2[-1]%mod1

    lt = len(t)*m
    flag = 0
    for i in range(len(s)-lt+1):
        if r_hash == rolling_hash(i, i+lt):
            flag = 1
            break

    if flag == 1:
        l = m
    else:
        r = m

if r == r2:
    print(-1)
else:
    print(l)


### FIXED CODE ###

import sys
import random
s = input()
t = input()
sl = len(s)
tl = len(t)

l = 0
r = 1500000//tl + 1
r2 = r
s *= 1499999//sl + 1
n = len(s)

base1 = 1007
mod1 = 10**9+7
modTank1 = [3000012541,3000012553,3000012563,3000012649,3000012683,3000012709]
mod1 = modTank1[random.randint(0,5)]
base1 = 1007
mod1 = 10**9+7
hash1 = [0]*(n+1)
power1 = [1]*(n+1)
for i,e in enumerate(s):
    hash1[i+1] = (hash1[i]*base1 + ord(e))%mod1
    power1[i+1] = (power1[i]*base1)%mod1

def rolling_hash(i, j):
    return (hash1[j]-hash1[i]*power1[j-i]%mod1)%mod1


while r - l > 1:
    m = l + (r-l)//2
    lt = len(t)*m
    hash2 = [0]*(lt+1)
    power2 = [1]*(lt+1)
    for i,e in enumerate(t*m):
        hash2[i+1] = (hash2[i]*base1 + ord(e))%mod1
        power2[i+1] = (power2[i]*base1)%mod1
    r_hash = hash2[-1]%mod1

    lt = len(t)*m
    flag = 0
    for i in range(len(s)-lt+1):
        if r_hash == rolling_hash(i, i+lt):
            flag = 1
            break

    if flag == 1:
        l = m
    else:
        r = m

if l*tl >= 1000000:
    print(-1)
else:
    print(l)
x=int(input())
for i in range(10**5):
    if int(i*(i-1)/2)<x<=int(i*(i+1)/2):
        print(i)
        break
  
  

### FIXED CODE ###

x=int(input())
i=0
while i<=10**5:
    if int(i*(i-1)/2)<x<=int(i*(i+1)/2):
        print(i)
        break
    else:
        i+=1
n = int(input())
c = [0] + [int(input()) for _ in range(200001)]
dp = [0] * (n+1)
num = 1
for i in range(n):
    if c[i]!=c[i+1]:
        num += dp[c[i+1]]
        dp[c[i+1]] = num
print(num%(10**9+7))

### FIXED CODE ###

n = int(input())
c = [0] + [int(input()) for _ in range(n)]
dp = [0] * (200001)
num = 1
for i in range(n):
    if c[i]!=c[i+1]:
        num += dp[c[i+1]]
        dp[c[i+1]] = num
print(num%(10**9+7))
from scipy.sparse.csgraph import connected_components  # https://note.nkmk.me/python-scipy-connected-components/
from scipy.sparse import csr_matrix

N, M = map(int, input().split())  # 頂点数、辺数
A, B, C = [0] *  M, [0] * M, [1] * (M-1)
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i]-=1
    B[i]-=1

cnt = 0
for i in range(M):
    csr = csr_matrix((C, (A[:i] + A[i + 1:], B[:i] + B[i + 1:])), shape=(N, N))
    n, labels = connected_components(csr)
    if n == 2:
       cnt += 1
print(cnt)


### FIXED CODE ###

from scipy.sparse.csgraph import connected_components  # https://note.nkmk.me/python-scipy-connected-components/
from scipy.sparse import csr_matrix

N, M = map(int, input().split())  # 頂点数、辺数
A, B, C = [0] *  M, [0] * M, [1] * (M-1)
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i]-=1
    B[i]-=1

cnt = 0
for i in range(M):
    csr = csr_matrix((C, (A[:i] + A[i + 1:], B[:i] + B[i + 1:])), shape=(N, N))
    n, labels = connected_components(csr)
    if n == 2:
       cnt += 1
print(cnt)
input()
array = list(map(int, a[1].split()))
print(min(array), max(array), sum(array))


### FIXED CODE ###

input()
array = list(map(int, input().split()))
print(min(array), max(array), sum(array))
import statistics
while 0!=int(input()):
	s = list(map(int, input().split()))
	print(statistics.stdev(s))

### FIXED CODE ###

import math
while True:
	n = int(input())
	if n==0: break
	s = list(map(float, input().split()))
	t = sum(s)
	a = t / n
	b = sum(map(lambda x: (x-a)**2, s))
	print(math.sqrt(b/n))
while True:
    a,b=int,input().split()
    c=a+b
    ans=0
    if c>=0 and c<=9:
        ans=1
    if c>=10 and c<=99:
        ans=2
    if c>=100 and c<=999:
        ans=3
    if c>=1000 and c<=9999:
        ans=4
    if c>=10000 and c<=99999:
        ans=5
    if c>=100000 and c<=999999:
        ans =6
    if c>=1000000 and c<=9999999:
        ans=7
    print(str(ans))


### FIXED CODE ###

while True:
    try:a,b=map(int,input().split())
    except:break
    c=a+b
    ans=0

    while c>9:
        c=c//10
        ans+=1
    ans+=1
    print(ans)
N=int(input())
i=list(map(int,input().split()))
x=0
for x in range(N):
  if x%2==0:
    if x%3!=0:
      if x%5!=0:
        x+=1
if x==0:
  print("APPROVED")
else:
  print("DENIED")

### FIXED CODE ###

a,b,c=input().split()
 
if a==b==c:
  print("No")
elif a==b!=c:
  print("Yes")
elif a==c!=b:
  print("Yes")
elif a!=b==c:
  print("Yes")
else:
  print("No")
A, B, M = map(int, input().split())
x, y, c = [0] * M, [0] * M, [0] * M
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())
ans = 0
sav = 0
maxc = max(c)
ci = c.index(maxc)
disc = a[ci - 1] + b[ci - 1] - maxc
print(min(disc, min(a) + min(b)))


### FIXED CODE ###

A, B, M = map(int, input().split())
x, y, c = [0] * M, [0] * M, [0] * M
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())
ans, sav = float("inf"), 0
for j in range(M):
    sav = a[x[j] - 1] + b[y[j] - 1] - c[j]
    if ans > sav:
        ans = sav

print(min(ans, min(a) + min(b)))
import collections, itertools, sys
sys.setrecursionlimit(10**6)


class UnionFind():
    def __init__(self, size):
        self.dat = list(range(size))
        self.SIZE = [1] * size  # 0-indexed

    def find(self, x):
        dat = self.dat
        stack = [x]
        while True:
            y = stack[-1]
            if dat[y] != y:
                stack += [dat[y]]
            else:
                break
        for s in stack:
            dat[s] = y
        return y

    def unite(self, x, y):
        is_same = self.is_same
        find = self.find
        SIZE = self.SIZE
        dat = self.dat
        if not is_same(x, y):
            X, Y = find(x), find(y)
            SX, SY = SIZE[X], SIZE[Y]
            if SX > SY:
                m = dat[X] = Y
            else:
                m = dat[Y] = X
            SIZE[m] = SX + SY
            SIZE[X + Y - m] = 0

    def is_same(self, x, y):
        find = self.find
        return find(x) == find(y)

    def scan_uf(self):
        find = self.find
        length = len(self.dat)
        for i in range(length):
            find(i)

    def size(self, x):
        return self.SIZE[self.find(x)]


N = int(input())
S = [[int(_) for _ in input()] for _ in range(N)]
G = collections.defaultdict(set)
for i, j in itertools.product(range(N), repeat=2):
    if S[i][j]:
        G[i].add(j)
P = [-1] * N
P[0] = -2
D = [-10] * N
D[0] = 0
Q = collections.deque([0])
UF = UnionFind(N)
while Q:
    x = Q.popleft()
    Gx = list(G[x])
    for y in Gx:
        if P[x] == y:
            continue
        if D[y] == -10:
            D[y] = D[x] + 1
            P[y] = x
            Q += [y]
        else:
            G[x].remove(y)
            if D[x] > D[y]:
                x, y = y, x
            cy1 = [y]
            cy2 = [x]
            for _ in range(D[y] - D[x]):
                cy1 += [P[cy1[-1]]]
            while True:
                cy1 += [P[cy1[-1]]]
                cy2 += [P[cy2[-1]]]
                if cy1[-1] == cy2[-1]:
                    break
            cy = cy1[-2::-1] + cy2
            if len(cy) % 2:
                print(-1)
                exit()
            c1 = cy[0]
            c2 = cy[1]
            for ca, cb in zip(cy[::2], cy[1::2]):
                UF.unite(c1, ca)
                UF.unite(c2, cb)
UF.scan_uf()
print(len(set(UF.dat)))


### FIXED CODE ###

import numpy as np
import sys
from scipy.sparse.csgraph import floyd_warshall, csgraph_from_dense
N = int(sys.stdin.buffer.readline())
S = np.frombuffer(sys.stdin.buffer.read(),
                  dtype='S1').reshape(N, -1)[:, :N].astype(int)
G = csgraph_from_dense(S)
F = floyd_warshall(G).astype(int)
F2 = F % 2
I0 = np.where(F2[0] == 0)
I1 = np.where(F2[0] == 1)
if (S[I0][:, I0] == 0).all() and (S[I1][:, I1] == 0).all():
    print(F.max() + 1)
    exit()
print(-1)
n = int(input())
s = []
for i in range(n):
  s.append(int(input()))
if max(s)<sum(s)-max(s):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
s = list(map(int,input().split()))
if max(s)<sum(s)-max(s):
  print("Yes")
else:
  print("No")
s=str(input())
s[3]="8
print(s)

### FIXED CODE ###

s=str(input())
s=s.replace("2017","2018")
print(s)
# -*- coding: utf-8 -*-
def check(s, x, y, xx, yy, dire):
  if len(s) != 0:
    i = 0
    for command in s:
      i += 1
      if command == "F":
        xx += dire[0]
        yy += dire[1]
      else:
        if dire[0] != 0:
          if check(s[i:], x, y, xx, yy, [0, 1]) == 1:
          	return 1
          if check(s[i:], x, y, xx, yy, [0, -1]) == 1:
            return 1
        elif dire[1] != 0:
          if check(s[i:], x, y, xx, yy, [1, 0]) == 1:
            return 1
          if check(s[i:], x, y, xx, yy, [-1, 0]) == 1:
            return 1
        return 0
  if xx == x and yy == y:
    return 1
  else:
    return 0


s = input()
x, y = map(int, input().split())
xx, yy = 0, 0
dire = [1, 0] #右1左-1,上1下-1
res = check(s, x, y, xx, yy, dire)
if res == 1:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

# -*- coding: utf-8 -*-
def check(z, zz, z_list):
  if len(z_list) == 0:
    if z != zz:
      return 0
    else:
      return 1
  else:
    z_n = len(z_list)
    z_hash = {}
    z_hash[0] = {}
    z_hash[0][zz] = 1
    z_hash[z_n] = {}
    z_hash[z_n][z] = 1
    for i in range(0,z_n):
      if i+1 not in z_hash:
        z_hash[i+1] = {}
        for b_z in z_hash[i]:
          a_z = b_z + z_list[i]
          z_hash[i+1][a_z] = 1
          a_z = b_z - z_list[i]
          z_hash[i+1][a_z] = 1
      else:
        for b_z in z_hash[i]:
          a_z = b_z + z_list[i]
          if a_z in z_hash[i+1]:
            return 1
          a_z = b_z - z_list[i]
          if a_z in z_hash[i+1]:
            return 1
        return 0
      if z_n-i-1 not in z_hash:
        z_hash[z_n-i-1] = {}
        for a_z in z_hash[z_n-i]:
          b_z = a_z + z_list[z_n-i-1]
          z_hash[z_n-i-1][b_z] = 1
          b_z = a_z - z_list[z_n-i-1]
          z_hash[z_n-i-1][b_z] = 1
      else:
        for a_z in z_hash[z_n-i]:
          b_z = a_z + z_list[z_n-i-1]
          if b_z in z_hash[z_n-i-1]:
            return 1
          b_z = a_z - z_list[z_n-i-1]
          if b_z in z_hash[z_n-i-1]:
            return 1
        return 0



s = input()
x, y = map(int, input().split())
data = s.split("T")
xx, yy = 0, 0
i = 0
x_list = []
y_list = []
for Fs in data:
  if len(Fs) == 0:
    i += 1
  else:
    if i == 0:
      xx = len(Fs)
    elif i % 2 == 0:
      x_list.append(len(Fs))
    else:
      y_list.append(len(Fs))
    i += 1
if check(x, xx, x_list) == 1 and check(y, yy, y_list) == 1:
  print("Yes")
else:
  print("No")
H,W=map(int,input().split())
h,w=map(int,input().split())
ptint((H-h)*((W-w))

### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))
S, T = map(int, input().split())
print(T+S)

### FIXED CODE ###

S, T = input().split()
print(T+S)
from operator import itemgetter

n,m = map(int,input().split())
a = [int(i) for i in input().split()]
w = []
x = 0
for i in range(m):
    b,c = map(int,input().split())
    w.append((b,c))
w = tuple(sorted(w,key=itemgetter(1)))
w.reverse()
for i in w:
    a += [i[1]] * i[0]
    x += b
    if x > n:
        break
a.sort()
a = a[len(a)-n:]
print(sum(a))


### FIXED CODE ###

from operator import itemgetter

n,m = map(int,input().split())
a = [int(i) for i in input().split()]
w = []
x = 0
for i in range(m):
    b,c = map(int,input().split())
    w.append((b,c))
w = list(sorted(w,key=itemgetter(1)))
w.reverse()
for i in w:
    a += [i[1]] * i[0]
    x += b
    if x > n:
        break
a.sort()
a = a[len(a)-n:]
print(sum(a))
def check_prime(m):
  prime_flag = 1
  counter = 1
  while counter **2 <= m:
    if not m%counter:
      prime_flag = 0
      break
  return prima_flag


n = int(input())

for i in range(n, 10**6):
  if check_prime(i):
    print(i)
    break

### FIXED CODE ###

def check_prime(m):
  prime_flag = 1
  counter = 2
  while counter **2 <= m:
    if not m%counter:
      prime_flag = 0
      break
    counter += 1
  return prime_flag


n = int(input())

for i in range(n, 10**6):
  if check_prime(i):
    print(i)
    break
s = input()
a = 0
b = 0
for i in len(s):
    if i in 'ATGC':
        ans += 1
    else:
        b = max(a, b)
        a = 0
print(max(a, b))

### FIXED CODE ###

s = input()
a = 0
b = 0
for i in s:
    if i in 'ATGC':
        a += 1
    else:
        b = max(a, b)
        a = 0
print(max(a, b))
s, t = input().split()
a, b = map(int, input().split())
h = input()
if s == h and a >= 1:
  a -= 1
if t == h and b >= 1:
  b -= 1
print a, b

### FIXED CODE ###

s, t = input().split()
a, b = map(int, input().split())
h = input()
if s == h and a >= 1:
    a -= 1
if t == h and b >= 1:
    b -= 1
print(a, b)