Harryxun/stf_run huggingface dataset:
import itertools
k=int(input())
l=[[1,2,3,4,5,6,7,8,9]]
for _ in range(10):
  a=[]
  for i in range(len(l[_])):
    L=l[_][i]
    if L%10==9:
      a.append(L*10+8)
      a.append(L*10+9)
    elif L%10==0:
      a.append(L*10+0)
      a.append(L*10+1)
    else:
      a.append(L*10+L%10-1)
      a.append(L*10+L%10)
      a.append(L*10+L%10+1)
    l.append(a)
print(sorted(set(list(itertools.chain.from_iterable(l))))[k-1])

### FIXED CODE ###

from collections import deque
k=int(input())
l=deque([1,2,3,4,5,6,7,8,9])
for i in range(k-1):
  d=l.popleft()
  a=d%10
  if a!=0:
    l.append(d*10+a-1)
  l.append(d*10+a)
  if a!=9:
    l.append(d*10+a+1)
print(l.popleft())
# python3
import numpy as np

def atack_survival(N, K, r_list):
	point_list= np.full(N, K)
	for i in r_list:
		point_list= point_list - 1
		point_list[i-1]= point_list[i-1] + 1


	for i in point_list:
		if i <= 0:
			print ("No")
		else:
			print("Yes")

if __name__ == '__main__':
    l = list(map(int, input().split()))
    N=l[0]
    K=l[1]
    Q=l[2]
    result= [int(input()) for i in range(Q)]
    atack_survival(N,K,result)

### FIXED CODE ###

# python3

def whether_predict(s):
	w_list=["Sunny", "Cloudy", "Rainy"]
	num=w_list.index(s)
	predict_index= (num+1)%3
	return w_list[predict_index]

if __name__ == '__main__':
    input = input()
    print(whether_predict(input))
n=int(input())
edges=[[] for i in range(n)]
import sys
input=sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
for i in range(n-1):
    a,s,w=map(int,input().split())
    edges[a-1].append([s-1,w]);edges[s-1].append([a-1,w])
colors=[-1]*n
colors[0]=1
def dfs(now):
    for to,cost in edges[now]:
        if colors[to]==-1:
            colors[to]=(cost+colors[now])%2
            dfs(to)

dfs(0)
print(*colors,sep="\n")

### FIXED CODE ###

n=int(input())
edges=[[] for i in range(n)]
import sys

sys.setrecursionlimit(10**9)
for i in range(n-1):
    a,s,w=map(int,input().split())
    edges[a-1].append([s-1,w]);edges[s-1].append([a-1,w])
colors=[-1]*n
colors[0]=1
def dfs(now):
    for to,cost in edges[now]:
        if colors[to]==-1:
            colors[to]=(cost+colors[now])%2
            dfs(to)

dfs(0)
print(*colors,sep="\n")
n = int(input())
a = list(input())
b =list(map(int,a))
aa = list(set(b))
x = []
y = []
c = 1
for i in range(1,n+1):
    x.append(i)
for j in aa:
    if j in x and 1 in aa:
        c = 1
        
    else:
        print("-1")
        exit()
for k in a:
    if int(k) == c:
        y.append(k)
        c = c + 1
print(len(a)-len(y))

### FIXED CODE ###

import sys
n = int(input())
a = list(map(int, input().split()))

num =  1
ans = 0
if 1 not in a:
    print(-1)
    sys.exit()
for i in a:
    if i == num:
        num += 1
    else:
        ans += 1
print(ans)
from operator import itemgetter

def calc(n, A, B):
    count = 0
    for i in range(n):#scanB
        #print('i=',i)#Debug
        if A[i] <= B[i]:
            continue
        elif i < n-1:
            for j in range(i+1,n):#scanA
                if A[j] <= B[i] and A[i] <= B[j]:
                    A[j],A[i] = A[i],A[j]
                    count += 1
                    if count > n-2:
                        return 'No'
                    #print(f'swap:{count}')
                    #print(f'A:{A}')
                    #print(f'B:{B}')
                    break
                elif j == n-1:
                    return 'No'
        else:
            return 'No'
    
    return 'Yes'

                
#main

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

#print(A)
#print(B)

pair = list(zip(A,B))
pair.sort(key=itemgetter(1))#sortB

A, B = zip(*pair)

ltA = list(A)
ltB = list(B)

#print(f'A:{ltA}')
#print(f'B:{ltB}')

#print(f'pair:{pair}')

print(calc(n,ltA,ltB))#for stdout

### FIXED CODE ###

n = int(input())
print((n-1)//2)
a,b,c = map(int(input().split()))
#lis = list(map(int,input().split()))
print("YES" if a <= c <= b else "NO")

### FIXED CODE ###

a,b,c = map(int,input().split())
#lis = list(map(int,input().split()))
print("Yes" if a<=c<=b else "No")
def countCombinationsNumpy(n, x, size=3):
    dp = np.zeros((x + 1, size + 1), dtype=int)
    dp[0, 0] = 1
    for i in range(1, n + 1):
        dp[i:, 1:] += dp[:-i, :-1]
        print(dp)
    return dp[-1, -1]



while True:
    m, n = (int(x) for x in input().split())
    if m==0 and n==0:
        quit()
    ans = countCombinations(m, n)
    print(ans)


### FIXED CODE ###

def countCombinations(n, x, size=3):
    dp = [[0 for j in range(x + 1)] for i in range(size + 1)]
    dp[0][0] = 1
    for i in range(1, n + 1):
        for row in range(size - 1, -1, -1):
            for col in range(x + 1 - i):
                dp[1+row][i+col] += dp[row][col]
    return dp[-1][-1]

while True:
    m, n = (int(x) for x in input().split())
    if m==0 and n==0:
        quit()
    print(countCombinations(m, n))
import os
for line in sys.stdin:
        s=sum([int(num) for num in line.split(' ')])
        print(len(str(s)))

### FIXED CODE ###

import sys
for line in sys.stdin:
        s=sum([int(num) for num in line.split(' ')])
        print(len(str(s)))
S=input()
weather=['Sunny','Cloudy','Rainy','Sunny']
print(weather[weather.index(S)+1)

### FIXED CODE ###

S=input()
weather=['Sunny','Cloudy','Rainy','Sunny']
print(weather[weather.index(S)+1])
import Queue
n = input()
p = []
for i in xrange(n):
    p.append(int(raw_input()))
dist = [10**7] * n
mark = [0]*n
que = Queue.PriorityQueue()
que.put((0, 0))
dist[0] = 0
idx = 0
while not que.empty():
    co, v = que.get()
    if dist[v] < co:
        continue
    for k in xrange(1, 7):
        idx += 1
        go = v+k
        while p[go]:
            go += p[go]
            if mark[go] == idx:
                go = -1
                break
            mark[go] = idx
        if go==-1:
            continue
        if go==n-1:
            print dist[v] + 1
            exit(0)
        if dist[v] + 1 < dist[go]:
            dist[go] = dist[v] + 1
            que.put((dist[go], go))

### FIXED CODE ###

import Queue
INF = 10**9
n = input()
p = [i+int(raw_input()) for i in xrange(n)]

used = [0] * n
idx = 0
for i in xrange(n):
    if p[i]!=i:
        path = []
        go = i
        idx += 1
        while go!=INF and p[go]!=go:
            if used[go]==idx:
                go = INF
                break
            used[go] = idx
            path.append(go)
            go = p[go]
        for e in path:
            p[e] = go

dist = [INF] * n
que = Queue.Queue()
que.put(0)
dist[0] = 0
while not que.empty():
    v = que.get()
    for k in xrange(1, min(7, n-v)):
        go = p[v+k]
        if go==n-1:
            print dist[v]+1
            exit(0)
        if go!=INF and dist[v] + 1 < dist[go]:
            dist[go] = dist[v] + 1
            que.put(go)
while True:
  h,w=map(int,input().split())
  if h==0 & w==0:
    break
  for i in range(h):
    for i in range(w):
      if (i+j)%2==0:
        print("#", end ="")
      else:
        print(".", end="")
  print()


### FIXED CODE ###

while True:
  h,w=map(int,input().split())
  if h==0 & w==0:
    break
  for i in range(h):
    print(("#."* w)[i%2:][:w])
  print()
a, b, c = sorted(map(int, input()))
print(a + b + c * 10)

### FIXED CODE ###

a, b, c = sorted(map(int, input().split()))
print(a + b + c * 10)
from sys import stdin
a = stdin.readline().split(" ")
num=int(a[0])
find=int(a[1])
j=1
w2=[]
while j<=num:
    z = stdin.readline().rstrip('\n')
    w2.append(int(z))
    j+=1
w2.sort()
minnum=w2[find-1]-w2[0]
for i in range(len(w2)-2):
    minnum=min(minnum,w2[i+find-1]-w2[i])
print(minnum)


### FIXED CODE ###

from sys import stdin
a = stdin.readline().split(" ")
num=int(a[0])
find=int(a[1])
j=1
w2=[]
while j<=num:
    z = stdin.readline().rstrip('\n')
    w2.append(int(z))
    j+=1
w2.sort()
minnum=w2[find-1]-w2[0]
for i in range(len(w2)-find+1):
    minnum=min(minnum,w2[i+find-1]-w2[i])
print(minnum)
n,m=map(int,input().split())

for _ in range(m)
    if m%n==0:
        print(m//n)
        exit()
    n+=1

### FIXED CODE ###

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

def make_divisors(n,m):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i>=m:
                divisors.append(i)
            if i != n // i:
                if n//i>=m:
                    divisors.append(n//i)

    divisors.sort()
    return divisors

test=make_divisors(m,n)
print(m//min(test))
print(-1

### FIXED CODE ###

from collections import deque
h, w = map(int, input().split())
s = [input() for _ in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
table = [[float('inf') for _ in range(w)] for _ in range(h)]
table[0][0] = 0
def bfs():
    que = deque([[0, 0]])
    # print(que)
    used = [[0 for _ in range(w)] for _ in range(h)]
    used[0][0] = 1
    while que:
        # print(que.popleft())
        y, x = que.popleft()
        for k in range(4):
            if 0 <= y+dy[k] < h and 0 <= x+dx[k] < w:
                if s[y+dy[k]][x+dx[k]] == '#':
                    continue
                if used[y+dy[k]][x+dx[k]] == 0:
                    table[y+dy[k]][x+dx[k]] = min(table[y+dy[k]][x+dx[k]], table[y][x]+1)
                    used[y+dy[k]][x+dx[k]] = 1
                    que.append((y+dy[k], x+dx[k]))
    
    # print(*table, sep='\n')
    return table[h-1][w-1]

c = bfs()
if c == float('inf'):
    print(-1)
else:
    white = 0
    for i in range(h):
        white += s[i].count('.')
    ans = white - (c+1)
    print(ans)
def R(xyzr1,xyzr2):
	x1,y1,z1,r1 = xyzr1
	x2,y2,z2,r2 = xyzr2
	return max(0,((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2)**0.5 - r1 - r2)
while 1:
	n = input()
	if n == 0: break
	if n == 1:
		print 0.0
		continue
	xyzr = [map(float,raw_input().split()) for i in range(n)]
	ans = 1e10
	for i in range(n):
		for j in range(i+1,n):
			L = R(xyzr[i],xyzr[j])
			if L < ans:
				ans = L
				s = [i,j]
	chain = [xyzr.pop(s[1]),xyzr.pop(s[0])]
	while xyzr:
		pipe = 1e10
		for i in range(len(xyzr)):
			for j in range(len(chain)):
				L = R(xyzr[i],chain[j])
				if L < pipe:
					pipe = L
					p = i
		ans += pipe
		chain.append(xyzr.pop(p))
	print ans

### FIXED CODE ###

inf = 1 << 28
def calc(xyzr1,xyzr2):
    x1,y1,z1,r1 = xyzr1
    x2,y2,z2,r2 = xyzr2
    d = ((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)**0.5
    return max(0, d-r1-r2)
    
while 1:
    n = int(raw_input())
    if n == 0: break
    xyzr = [map(float,raw_input().split()) for i in xrange(n)]
    
    cost = [[0]*n for i in xrange(n)]
    for i in xrange(n):
        for j in xrange(n):
            cost[i][j] = cost[j][i] = calc(xyzr[i],xyzr[j])
    
    mincost = [inf]*n
    used = [False]*n
    mincost[0] = 0
    ans = 0
    while 1:
        v = -1
        for u in xrange(n):
            if not used[u] and (v == -1 or mincost[u] < mincost[v]): v = u
        if v == -1: break
        used[v] = True
        ans += mincost[v]
        for u in xrange(n):
            mincost[u] = min(mincost[u], cost[v][u])
    
    print "%.3f"%ans
MOD = 10**9 + 7


def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a


def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod


def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod


N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort()
A_rev = list(reversed(A))


ans = 0
C = comb(N-1, K-1)
for i, j in zip(A, A_rev):
    if N < K:
        break
    ans += C * j
    ans -= C * i
    ans %= MOD
    try:
        C = C * (N - K) / (N - 1)
    except:
        break
    N -= 1
print(int(ans % MOD))


### FIXED CODE ###

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort()
MOD = 10 ** 9 + 7


def combination(mod=MOD):
    fact = [1] * (N + 1)
    inv_fact = [1] * (N + 1)
    r = 1
    for i in range(1, N + 1):
        fact[i] = r = r * i % mod
    inv_fact[N] = r = pow(fact[N], mod - 2, mod)
    for i in range(N, 0, -1):
        inv_fact[i - 1] = r = r * i % mod

    def _wrapper(n, k):
        nonlocal fact, inv_fact, mod
        if n == 0 or k == 0:
            return 1
        return fact[n] * inv_fact[k] * inv_fact[n - k] % mod

    return _wrapper


def main():
    if K == 1:
        print(0)
        exit()
    comb = combination()
    sum_max = 0
    sum_min = 0
    for i, A_i in enumerate(A):
        if i >= K - 1:
            sum_max += comb(i, K - 1) * A_i % MOD
        if N - i >= K:
            sum_min += comb(N - i - 1, K - 1) * A_i % MOD
    ans = (sum_max - sum_min) % MOD
    print(ans)


if __name__ == '__main__':
    main()
n,*a=map(int,open(0).read().split())
a.sort(reverse=True)
cnt=0
for q in a:
  flg=True
  for j in range(0,int(q**0.5)+1):
    if q%j==0:
      if q//j in a or j in a:
        flg=False
  if flg:
    cnt+=1
print(cnt)

### FIXED CODE ###

n,*a=map(int,open(0).read().split())

ma=1001001
nums=[0]*ma

for i in a:
    nums[i]+=1
    if nums[i]==1: # 一回だけ出てきた場合
        for j in range(i+i,ma,i):
            nums[j]+=2
            
ans=nums.count(1)
print(ans)
s = str(input())
a = "abcdefghijklmnopqrstuvwxyz"
count = 0
for i in range(len(a)):
    for j in range(len(s)):
        if a[i] == s[j]:
            count += 1
    if count == 0:
        ans = a[i]
        break
    else:
        count = 0
print(ans)

### FIXED CODE ###

s = str(input())
a = "abcdefghijklmnopqrstuvwxyz"
count = 0
n = 0
for i in range(len(a)):
    for j in range(len(s)):
        if a[i] == s[j]:
            count += 1
            break
    if count == 0:
        ans = a[i]
        print(ans)
        n = 1
        break
    else:
        count = 0
if n == 0:
    print("None")
s = str(input())
k = int(input())
result = []
for i in range(1, k+1):
    for j in range(len(s)-i):
        result.append(s[j:j+i])
r = set(result)
out = list(r)
out.sort()
print(out[k-1])

### FIXED CODE ###

def main():
    s = str(input())
    s += '0'
    k = int(input())
    result = set()
    for i in range(1, 6):
        for j in range(len(s)-i):
            result.add(s[j:j+i])
    out = list(result)
    out.sort()
    print(out[k-1])
if __name__ =='__main__':
    main()
K = int(input())

nlist = [1,2,3,4,5,6,7,8,9]
sample = 0
count = 0

def BFS(count,nlist,sample):
    if count == K:
        print(sample)
        return
    else:
        sample = nlist.pop(0)
        
        if sample%10 != 0:
            nlist.append(sample*10 - 1 + sample%10)
            
        nlist.append(sample*10 + + sample%10)
        
        if sample%10 != 9:
            nlist.append(sample*10 + 1 + + sample%10)
            
        count+=1

        BFS(count,nlist,sample)
        
BFS(count,nlist,sample)

### FIXED CODE ###

K = int(input())

from collections import deque

nlist = deque([1,2,3,4,5,6,7,8,9])

for i in range(K):
    sample = nlist.popleft()
        
    if sample%10 != 0:
        nlist.append(sample*10 - 1 + sample%10)
            
    nlist.append(sample*10 + sample%10)
        
    if sample%10 != 9:
        nlist.append(sample*10 + 1 + sample%10)
    
print(sample)
s  = input()
print(str(s // 3600) + ":" + str(s // 60) + ":" + str(s % 60))

### FIXED CODE ###

t=int(input())
print(f"{t//3600}:{t//60%60}:{t%60}")
s, w = map(int, input().split())

if S > W:
    print('safe')
if S < W:
    print('unsafe')

### FIXED CODE ###

s, w = map(int, input().split())
if s > w:
    print("safe")
else:
    print("unsafe")
import sys
import numpy as np
import math
from collections import deque 
from functools import reduce

n = int(input())
az = "abcdefghijklmnopqrstuvwxyz"
cnt = 12
ret = []
ama = n % 26
na = n
for i in range(12, 0, -1):
    if 26**(i-1) > n:
        continue
    sho = na // (26**i)
    if sho > 0:
        ret.append(az[sho-1])
    else:
        if len(ret) > 0:
            ret.append('z')
    na -= sho * (26**i)
if (ret[0] == 'z'):
    del ret[0]
re = "".join(ret)
print(re)



### FIXED CODE ###

import sys
import numpy as np
import math
import collections
from collections import deque 
from functools import reduce

# input = sys.stdin.readline
n = int(input())
ret = ''
while(n > 0):
    n -= 1
    ret += chr(ord('a') + n % 26)
    n //= 26
print(ret[::-1])
N=int(input())
H=list(map(int,input().split()))

HH=[0]
M=0
K=[]
for i in range(1,N-1):
    HH.append(H[i+1]-H[i])
for i in range(len(HH)):
    if HH[i]<=0:
        M+=1
    else:
        K.append(M)
        M=0
K.append(M)
del K[0]
print(max(K))

### FIXED CODE ###

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


M=0
K=[]
if N==1:
    print(0)
elif N==2:
    if H[0]>=H[1]:
        print(1)
    else:
        print(0)
else:
    HH=[H[1]-H[0]]
    for i in range(1,N-1):
        HH.append(H[i+1]-H[i])
    for i in range(len(HH)):
        if HH[i]<=0:
            M+=1
        else:
            K.append(M)
            M=0
    K.append(M)
    print(max(K))
li = list(input())
counter = 0
for i in li:
    if li[i] == "1":
        counter += 1
print(counter)

### FIXED CODE ###

num = input()
counter = 0
li = list(num)
if li[0] == "1":
    counter += 1
if li[1] == "1":
    counter += 1
if li[2] == "1":
    counter += 1
print(counter)
N,K,L = map(int, input().split())
D = [list(map(int, input().split())) for _ in range(K)]
T = [list(map(int, input().split())) for _ in range(L)]

#print(N,K,L,D,T)

list_D = [set([i]) for i in range(N)]
list_T = [set([i]) for i in range(N)]
root_D = [i for i in range(N)]
root_T = [i for i in range(N)]

#print(list_D)

for d in D:
    d0 = d[0] - 1
    d1 = d[1] - 1
    r0 = root_D[d0]
    r1 = root_D[d1]
    list_D[r0] = list_D[r0] | list_D[r1]
    root_D[r1] = r0
    root_D[d1] = r0
    #print(list_D, root_D)

for t in T:
    t0 = t[0] - 1
    t1 = t[1] - 1
    r0 = root_T[t0]
    r1 = root_T[t1]
    list_T[r0] = list_T[r0] | list_T[r1]
    root_T[r1] = r0
    root_T[t1] = r0
    #print(list_T, root_T)

#和集合
#res = [0] * N
for i in range(N):
    rd = root_D[i]
    rt = root_T[i]
    d = list_D[rd]
    t = list_T[rt]
    res[i] = len(d & t)
#print(*(res[i] for i in range(N)))
print(" ".join([str(i) for i in res]))

### FIXED CODE ###

import sys
 
sys.setrecursionlimit(10000)

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

#print(N,K,L,D,T)

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

def execOne(num, uf):
    for _ in range(num):
        d0, d1 = map(int, input().split())
        d0 = d0 - 1
        d1 = d1 - 1
        uf.union(d0, d1)

uf_D = UnionFind(N)
uf_T = UnionFind(N)

execOne(K, uf_D)
execOne(L, uf_T)


pairs = []
for i in range(N):
    pairs.append((uf_D.find(i), uf_T.find(i)))

pairs_count = {}
for p in pairs:
    if not p in pairs_count:
        pairs_count[p] = 1
    else:
        pairs_count[p] += 1

res = [0] * N
for i in range(N):
    res[i] = pairs_count[pairs[i]]
#print(*(res[i] for i in range(N)))
print(" ".join([str(i) for i in res]))
n = int(input())
t = [0]*10001
for i in range(1,42):
    t[6*i**2] += 1
for i in range(1,59):
    for j in range(1,59):
        if(i != j):
            a = (i+j)**2 + 2*j**2
            if(a <= 10000):
                t[a] += 3
            else:
                break
for i in range(3,100):
    for j in range(2,i):
        for k in range(1,j):
            a = ((i+j)**2 + (j+k)**2 + (k+i)**2)//2
            if(a < 10000):
                t[a] += 6
            else:
                break
for i in range(1,n+1):
    print(t[i])

### FIXED CODE ###

n = int(input())
t = [0]*10001
for i in range(1,41):
    t[6*i**2] += 1
for i in range(1,99):
    for j in range(1,99):
        if(i != j):
            a = (i+j)**2 + 2*j**2
            if(a <= 10000):
                t[a] += 3
            else:
                break
for i in range(3,100):
    for j in range(2,i):
        for k in range(1,j):
            a = ((i+j)**2 + (j+k)**2 + (k+i)**2)//2
            if(a <= 10000):
                t[a] += 6
            else:
                break
for i in range(1,n+1):
    print(t[i])
import math

r = int(input())
S = r * r * math.pi
L = 2 * r * math.pi

print('{0:.6f}'.format(S),'{0:.6f}'.format(L))

### FIXED CODE ###

import math

r = float(input())
S = r * r * math.pi
L = 2 * r * math.pi

print('{0:.6f}'.format(S),'{0:.6f}'.format(L))
s = list(input())

flag = 0
pos_a, pos_z = 1
length = 0

for i, ltr in enumerate(s, 1)
  if ltr == 'A':
    pos_a = i
    flag = 1
  elif ltr == 'Z':
    if flag == 1:
      pos_z = i
      if pos_z - pos_a > length:
        length = pos_z - pos_a
      else:
        flag = 0
        
print(length)

### FIXED CODE ###

s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A' and flag == 0:
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
    pos_z = i
    if pos_z - (pos_a -1) > length:
      length = pos_z - (pos_a -1)
    else:
      flag = 0

print(length)
import numpy as np

N = int(input())
testimony = [[0] * N for i in range(N)]
A = []

for i in range(N):
    a = int(input())
    A.append(a)
    for j in range(a):
        x, y = map(int, input().split())
        testimony[i][x-1] = 2 * y - 1

testimony = np.array(testimony)

A = np.array(A)
ans = 0

for i in range(2 ** N):
    honesty = [-1] * N
    h = 0
    for j in range(N):
        if (i >> j) & 1:
            honesty[j] = 1
            h += 1
    honesty = np.array(honesty)
    B = testimony @ honesty - A
    if any(honesty[j] == 1 and B[j] != 0 for j in range(N)):
        continue

    ans = max(ans, h)

print(ans)

### FIXED CODE ###

import numpy as np

N = int(input())
testimony = [[0] * N for i in range(N)]
A = []

for i in range(N):
    a = int(input())
    A.append(a)
    for j in range(a):
        x, y = map(int, input().split())
        testimony[i][x-1] = 2 * y - 1

testimony = np.array(testimony)

A = np.array(A)
ans = 0

for i in range(2 ** N):
    honesty = [-1] * N
    h = 0
    for j in range(N):
        if (i >> j) & 1:
            honesty[j] = 1
            h += 1
    honesty = np.array(honesty)
    B = np.dot(testimony,honesty) - A
    if any(honesty[j] == 1 and B[j] != 0 for j in range(N)):
        continue

    ans = max(ans, h)

print(ans)
import re
m = re.match(r'A.*Z', input())
print(m.end - m.start)

### FIXED CODE ###

import re
m = re.search(r'A.*Z', input())
print(m.end() - m.start())
k,s = map(int,input().split())
l = [a+b for a in range(k+1) for b in range(k+1)]
sum = 0
for i in range(k+1):
  sum += l.count(s-i)
print(sum)

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
z = int(input())
l = [500*i+100*t+50*w for i in range(a+1) 
         for t in range(b+1) for w in range(c+1)]
print(l.count(z))
import sys
s=input()
a,b,c,d=int(s[0]),int(s[1]),int(s[2]),int(s[3])
if a+b+c+d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'+'+b+'+'+c'+'+d+'=7')
  sys.exit()
if a+b+c-d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'+'+b+'+'+c'-'+d+'=7')
  sys.exit()
if a+b-c+d==7:
   a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'+'+b+'-'+c'+'+d+'=7')
  sys.exit()
if a-b+c+d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'-'+b+'+'+c'+'+d+'=7')
  sys.exit()
if a+b-c-d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'+'+b+'-'+c'-'+d+'=7')
  sys.exit()
if a-b-c+d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'-'+b+'-'+c'+'+d+'=7')
  sys.exit()
if a-b+c-d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'-'+b+'+'+c'-'+d+'=7')
  sys.exit()
if a-b-c-d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'-'+b+'-'+c'-'+d+'=7')
  sys.exit()


### FIXED CODE ###

import sys
S=input()
a,b,c,d=S[0],S[1],S[2],S[3]
lst=['+','-']
for i in lst:
  for j in lst:
    for k in lst:
      if eval(a+i+b+j+c+k+d+'==7'):
        print(a+i+b+j+c+k+d+'=7')
        sys.exit()