Harryxun/stf_run huggingface dataset:
S = input()
T = input()
t = len(T)
for i in range(len(T)):
  a = 0
  b = 0
  for s in range(len(T)):
    if T[s:s+i+1] in S[s:len(S)-s]:
      b += 1
    print(s,b,T[s:s+i+1],S[s:len(S)-s])
  if b == 0:
    break
print(t-i)

### FIXED CODE ###

S = input()
T = input()
ans = 1001
for i in range(len(S) - len(T) + 1):
  a = 0
  for s in range(len(T)):
    if T[s] != S[i+s]:
      a += 1
  if a < ans:
    ans = a
print(ans)
import math

r = int(input())

S = math.pi * r**2
L = 2 * math.pi * r

print("%.6f"% S, "%.6f"% L)

### FIXED CODE ###

import math

r = float(input())

S = math.pi * r**2
L = 2 * math.pi * r

print(S, L)
n, l = map(int, raw_input().split())

for i in xrange(n):
  a.append(raw_input())
a.sort()
print " ".join(a)

### FIXED CODE ###


n, l = map(int, raw_input().split())
a = []
for i in xrange(n):
  a.append(raw_input())
a.sort()
print "".join(a)
ST = list(map(str, inpuy().split()))

print(ST[1]+ST[0])

### FIXED CODE ###

ST = list(map(str, input().split()))
 
print(ST[1]+ST[0])
ef main():
    dict = {"SUN": 7,
            "MON": 6,
            "TUE": 5,
            "WED": 4,
            "THU": 3,
            "FRI": 2,
            "SAT": 1,
            }
    day = input()
    ans = dict[day]
    print(ans)



if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    dict = {"SUN": 7,
            "MON": 6,
            "TUE": 5,
            "WED": 4,
            "THU": 3,
            "FRI": 2,
            "SAT": 1,
            }
    day = input()
    ans = dict[day]
    print(ans)



if __name__ == "__main__":
    main()
s1=input()
s2=input()

cnt=0
for i in range(len(l1)):
    print(l1[i])
    print(l2[-i-1])
    if l1[i]==l2[-i-1]:
        cnt+=1

if cnt == 3:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

s1=input()
s2=input()

cnt=0
for i in range(len(s1)):
    if s1[i]==s2[-i-1]:
        cnt+=1

if cnt == 3:
    print("YES")
else:
    print("NO")
n,m = map(int, input().split())
ans = [10 for i in range(n)]
flag = 0
for i in range(m):
    s,c = map(int, input().split())
    if s==1 and c==0:
        flag = -1
    if ans[s-1]!=10 and ans[s-1]!=c:
        flag = -1
    ans[s-1] = c
#print(ans)
if ans[0]==10:
    ans[0]=1
    if ans[1]==10:
        ans[1]=1
        if ans[2]==10:
            ans[2]=1
for i in range(n):
    if ans[i]==10:
        ans[i]=0
map_ans = map(str, ans)
answer =''.join(map_ans)

print(-1 if flag==-1 else answer)

### FIXED CODE ###

n,m = map(int, input().split())
ans = [10 for i in range(n)]
flag = 0
for i in range(m):
    s,c = map(int, input().split())
    if s==1 and c==0 and n!=1:
        flag = -1
    if ans[s-1]!=10 and ans[s-1]!=c:
        flag = -1
    ans[s-1] = c
#print(ans)
if ans[0]==10 and n!=1:
    ans[0]=1
    if n==2 or n==3:
        if ans[1]==10:
            ans[1]=0
            if n==3:
                if ans[2]==10:
                    ans[2]=0
for i in range(n):
    if ans[i]==10:
        ans[i]=0
map_ans = map(str, ans)
answer =''.join(map_ans)

print(-1 if flag==-1 else answer)
import math
a,b = map(int,input().split())

min = a * b / gcd(a, b)

print(min)



### FIXED CODE ###

import fractions
a,b = map(int,input().split())

min = a * b / fractions.gcd(a, b)

print(int(min))
import sys
sys.setrecursionlimit(10**7)

n = int(input())
info = []
for _ in range(n-1):
    c, s, f = map(int, input().split())
    info.append([c, s, f])
# print(info)

def func(i, low):
    if i == low:
        return info[i][1] + info[i][0]

    return func2(func(i-1, low), info[i][2]) + info[i][0]

def func2(n, f):
    if n <= f:
        return f
    if n % f == 0:
        return n
    else:
        return n//f * f + f

# print(func(n-2, 0))
for i in range(n):
    if i == n-1:
        print(0)
    print(func(n-2, i))

### FIXED CODE ###

n = int(input())
C = []
S = []
F = []
for _ in range(n-1):
    c, s, f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

def f(n, s, f):
    if n <= s:
        return s
    if n % f == 0:
        return n
    else:
        return n // f * f + f

for i in range(n-1):
    now = S[i] + C[i]
    for j in range(i+1, n-1):
        now = f(now, S[j], F[j]) + C[j]
    print(now)
print(0)
N, A, B = map(int, input().split())
print(sum(i for i in range(N+1) if A <= sum(map(int, str(i))) <= B)

### FIXED CODE ###

N, A, B = map(int, input().split())
print(sum(i for i in range(N+1) if A <= sum(map(int, str(i))) <= B))
A, B, C, X, Y = map(int, input().split())
not_in_C = A*X + B*Y
if X > Y:
  cost = 2 * C * Y 
  if A < C:
    cost += A * (X - Y)
  else:
    cost += 2 * C * (X - Y)
elif X < Y
  cost = 2 * C * X
  if B < C:
    cost += B * (Y - X)
  else:
    cost += 2 * C * (Y - X)
print(min(not_in_C, cost))

### FIXED CODE ###

A, B, C, X, Y = map(int, input().split())
cost = A*X + B*Y
new_cost = cost
plus = 0
for i in range(1, max(X, Y)+1):
  if i <= min(X, Y):
    plus = - A - B + 2*C
  else:
    plus = -A + 2*C if X > Y else -B + 2*C
  if plus < 0:
    new_cost += plus
  else:
    break
print(new_cost)
#include "bits/stdc++.h"

using namespace std;

int i;

int main(){
  int N, neg_cnt = 0;
  cin >> N;
  vector<int> A(N), B(N);
  for (i = 0; i < N; i++){
    cin >> A[i];
    if (A[i] < 0){
      neg_cnt++;
    }
  }
  for (i = 0; i < N; i++){
    B[i] = abs(A[i]);
  }
  int acm = 0;
  int min = *min_element(B.begin(), B.end());
  acm = accumulate(B.begin(), B.end(), 0);
  if (neg_cnt%2 == 0){
    cout << acm << endl;
  }else{
    cout << acm - 2*min << endl;
  }
}

### FIXED CODE ###

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

neg_cnt = 0
for a in A:
  if a < 0:
    neg_cnt += 1

B = list(map(abs, A))
if neg_cnt%2 == 0:
  print(sum(B))
else:
  print(sum(B) - 2*min(B))
r = map(int,input().int())
s = 3 * r ** 2
print(s)

### FIXED CODE ###

r = int(input())
s = 3 * r * r
print(s)
print(['<','=','>'][min(2,max(0,1+int('0x'+input())-int('0x'+input())))a,b=input().split()
print(['<','=','>'][min(2,max(0,1+int(a,16)-int(b,16)))])

### FIXED CODE ###

a,b=input().split()
print(['<','=','>'][min(2,max(0,1+int(a,16)-int(b,16)))])
from collections import deque
import sys
n = int(input())
if n == 1:
    print('a')
    sys.exit()

q = deque([])
q.append((1, '1', 1))
cur = 1
while cur != n:
    num = len(q)
    j = 0
    while j < num:
        a, b, c = q.popleft()
        for i in range(1, c+2):
            q.append((i, b + str(i), max(i, a)))
        j += 1
    cur += 1

d = dict()
for i in range(1, n+1):
    d[str(i)] = chr((i-1) + 97)

for i in range(len(q)):
    a, b, c = q.popleft()
    print(b.translate(str.maketrans(d)))


### FIXED CODE ###

from collections import deque
import sys
n = int(input())
if n == 1:
    print('a')
    sys.exit()

q = deque([])
q.append((1, 'a', '1'))
cur = 1
while cur != n:
    num = len(q)
    j = 0
    while j < num:
        a, b, c = q.popleft()
        for i in range(1, max(map(int, list(c)))+2):
            q.append((i, b + chr(96+i), c + str(i)))
        j += 1
    cur += 1

for i in range(len(q)):
    a, b, c = q.popleft()
    print(b)
N = int(input())
H = list(map(int, input().split()))

if N == 1:
    print("Yes")
elif H[0]-H[1] <= -1:
    H[1] -= 1
elif H[0]-H[1] == 0:
    H[0] -= 1
    H[1] -= 1
elif H[0]-H[1] == 1:
    H[0] -= 1
else:
    print("No")

if N >=　3:
    for i in range(1, N):
        if i == N-1:
            print("Yes")
            break
        elif H[i]-H[i+1] <= -1:
            H[i+1] -= 1
            continue
        elif H[i]-H[i+1] == 0:
            continue
        else:
            print("No")
            break


### FIXED CODE ###

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

if N == 1:
    print("Yes")

if N == 2:
    if H[0]-H[1] <= -1:
        print("Yes")
    else:
        print("No")

if N >= 3:
    for i in range(1, N):
        if H[0]-H[1] <= -1:
            H[1] -= 1
        elif H[0]-H[1] == 0:
            H[0] -= 1
            H[1] -= 1
        elif H[0]-H[1] == 1:
            H[0] -= 1

        if i == N-1:
            print("Yes")
            break
        elif H[i]-H[i+1] <= -1:
            H[i+1] -= 1
            continue
        elif H[i]-H[i+1] == 0:
            continue
        else:
            print("No")
            break
import sys
import subprocess
import re
import datetime
import os

A = []
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
k = int(input())

S = A.sorted()

V = (S[4] - S[0])
if V <= k:
    print("Yay!")
else:
    print(":(")
    

### FIXED CODE ###

import sys
import subprocess
import re
import datetime
import os

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

A = [a,b,c,d,e]
S = sorted(A)



V = (S[4] - S[0])
if V <= k:
    print("Yay!")
else:
    print(":(")
H, W = map(int, input().split())
s_a = []
for _ in range(W):
    s = list(input())
    s_a.append(s)

check_list = [(0,1),(0,-1),(1,0),(-1,0)]

def check(i,j):
    for x,y in check_list:
        try: 
            if s_a[i+x][j+y] == '#':
                return True
        except:
            continue
    return False

ans = 'Yes'
for i in range(W):
    for j in range(H):
        if s_a[i][j] == '#':
            if check(i,j):
                continue
            else:
                ans = 'No'
print(ans) 

### FIXED CODE ###

H, W = map(int, input().split())
s_a = []
for _ in range(H):
    s = list(input())
    s_a.append(s)

check_list = [(0,1),(0,-1),(1,0),(-1,0)]

def check(i,j):
    for x,y in check_list:
        try: 
            if s_a[i+x][j+y] == '#':
                return True
        except:
            continue
    return False

ans = 'Yes'
for i in range(H):
    for j in range(W):
        if s_a[i][j] == '#':
            if check(i,j):
                continue
            else:
                ans = 'No'
                break
print(ans)
import numpy as np
input()
A = np.array([map(int, input().split())])
print(A.min() ,A.max() ,A.sum())

### FIXED CODE ###

input()
a = list(map(int, input().split()))
print(min(a) ,max(a) ,sum(a))
n = int(input())
ds = list(map(int, input().split()))

from collections import defaultdict
d = defaultdict(int)

d[0] = 1
for d_ in ds:
    d[d_] += 1
    if d_ == 12 and d[d_] == 2:
        print(0)
        exit()
    elif d_ == 0 and d[d_] == 2: 
        print(0)
        exit()
    elif d[d_] == 3:
        print(0)
        exit()

def calcmin(tmp):
    n = len(tmp)
    ret = 1 << 50
    for i in range(n):
        for j in range(i+1,n):
            ret = min(ret, abs(tmp[i]-tmp[j]))
    return ret

two = []
x = []
for k in d.keys():
    if d[k] == 2:
        two.append(k)
        two.append(24-k)
    if d[k] == 1:
        x.append(k)
two = list(set(two))
n = len(x)

ans = 0
for i in range(1 << n):
    tmp[] = x[:]
    for j in range(n):
        if i & (1 << j):
            tmp[j] = 24-x[j]
    tmp.extend(two)
    ans = max(calcmin(tmp), ans)
print(ans)

### FIXED CODE ###

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

from collections import defaultdict
d = defaultdict(int)

d[0] += 1
for d_ in ds:
    d[d_] += 1
    if (d_ == 12 or d_ == 0) and d[d_] == 2:
        print(0)
        exit()
    elif d[d_] == 3:
        print(0)
        exit()

def calcmin(tmp):
    n = len(tmp)
    ret = 1 << 50
    for i in range(n):
        for j in range(i+1,n):
            ret = min(ret, abs(tmp[i]-tmp[j]),24-abs(tmp[i]-tmp[j]))
    return ret

two = []
x = []

for k in d.keys():
    if d[k] == 2 or k == 12:
        two.append(k)
        two.append(24-k)
    elif d[k] == 1:
        x.append(k)

two = list(set(two))
n = len(x)
ans = 0
for i in range(1 << n):
    tmp = x[:]
    for j in range(n):
        if i & (1 << j):
            tmp[j] = 24-x[j]
    # print(tmp,two)
    tmp.extend(two)
    ans = max(calcmin(tmp), ans)

print(ans)
import numpy as np
N = int(input())
A = np.array([input().split() for _ in range(N)], dtype=np.int64)

fill_diagonal(A, 10**9)

ans = 0
for i in range(N):
  for j in range(i+1,N):
    d = np.min(A[i]+A[j])
    if A[i][j] < d:
      ans += A[i][j]
    elif d < A[i][j]:
      print(-1)
      exit()

print(ans)


### FIXED CODE ###

from numpy import *
N = int(input())
A = array([list(map(int,input().split())) for n in range(N)])

fill_diagonal(A, 10**10)

ans = 0
for i in range(N):
  for j in range(i+1,N):
    d = min(A[i]+A[j])
    if A[i][j] < d:
      ans += A[i][j]
    elif d < A[i][j]:
      print(-1)
      exit()

print(ans)
number_A=(imput(A))
number_B=(imput(B))
if number_A<=8 and number_B<=8:
  print('Yay!')
else:
  print(':(')


### FIXED CODE ###

A,B=map(int,input().split())
if A<=8 and B<=8:
  print('Yay!')
else:
  print(':(')
# coding: utf-8
import sympy

a, b, c = map(int, input().split())
# print(a, b, c)

if sympy.sqrt(a) + sympy.sqrt(b) < sympy.sqrt(c):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

# coding: utf-8

a, b, c = map(int, input().split())
# print(a, b, c)

if 0 < c - a - b and 4 * a * b < (c - a - b)**2:
    print('Yes')
else:
    print('No')
a=map(int,input().split())
a.sort()
print('YNeos'[a[2]!=a[0]+a[1]::2])

### FIXED CODE ###

a=list(map(int,input().split()))
a.sort()
print('YNeos'[a[2]!=a[0]+a[1]::2])
import sys
 
sys.setrecursionlimit(10 ** 6)

n = int(input())

edge = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)

odd = []
even = []

ans = [-1] * n
def dfs(x, last = -1, d = 0):
    if d%2 == 0: even.append(x)
    else: odd.append(x)
    for nxt in edge[x]:
        if nxt == last:
            continue
        dfs(nxt, x, d + 1)

dfs(0)

nums = [[],[],[]]
for i in range(1,n+1):
    nums[i%3].append(i)

for num in nums[1]:
    ans[odd.pop()] = num
for num in nums[2]:
    ans[even.pop()] = num
rest = nums[0] + nums[1] + nums[2]
for num in rest:
    if len(odd):
        ans[odd.pop()] = num
    elif len(even):
        ans[even.pop()] = num

print(*ans)


### FIXED CODE ###

import sys
 
sys.setrecursionlimit(10 ** 6)
n = int(input())
 
edge = [[] for i in range(n)]
ans = [-1] * n
odd = []
even =[]
nums = [[],[],[]]
for i in range(1,n+1):
    nums[i % 3].append(i)
 
def dfs(x, last = -1, d = 0):
    if d % 2 == 0: even.append(x)
    else: odd.append(x)
    for nxt in edge[x]:
        if nxt == last:continue
        dfs(nxt, x, d + 1)
 
for i in range(n-1):
    a, b = map(int, input().split())
    a-=1
    b-=1
    edge[a].append(b)
    edge[b].append(a)
 
dfs(0)
 
zerocnt = len(nums[0])
 
if len(even) <= zerocnt:
    for even_node in even:
        ans[even_node] = nums[0].pop()
    rest = nums[0] + nums[1] + nums[2]
    for odd_node in odd:
        ans[odd_node] = rest.pop()
 
elif len(odd) <= zerocnt:
    for odd_node in odd:
        ans[odd_node] = nums[0].pop()
    rest = nums[0] + nums[1] + nums[2]
    for even_node in even:
        ans[even_node] = rest.pop()
 

else:
    for num in nums[1]:
        ans[even.pop()] = num
    for num in nums[2]:
        ans[odd.pop()] = num
    rest = nums[0]
    for even_node in even:
        ans[even_node] = rest.pop()
    for odd_node in odd:
        ans[odd_node] = rest.pop()
 
print(*ans)
import math

def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


n, k = map(int, input().split())
r = n - k
mod = 10 ** 9 + 7
for i in range(1, k + 1):
    if i == 1 or i == k:
        print(nCr(r + 1, i) % mod)
    else:
        print(nCr(r + 1, i) * (k - 1) % mod)

### FIXED CODE ###

import math

def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


n, k = map(int, input().split())
r = n - k
mod = 10 ** 9 + 7
for i in range(1, k + 1):
    if i > r + 1:
        print(0)
    else:
        if i == 1 or i == k:
            print(nCr(r + 1, i) % mod)
        else:
            print(nCr(r + 1, i) * (nCr(k - 1, i - 1)) % mod)
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = -1e18

for i in range(n):
    now = p[i] - 1 
    score = [c[now]]
    while True:
        now = p[now] - 1
        score.append(score[-1] + c[now])
        if now == i:
            break
    loopsum = score[-1]
    looplen = len(score)
    if looplen >= k:
        ans = max(ans,max(score[:k]))
    if loopsum <= 0:
        ans = max(ans,max(score))
    else:
        loopnum = k//looplen
        loopnum_mod = k % looplen
        ans = max(ans,(loopnum-1)*loopsum + max(score))    
        ans = max(ans,loopnum*loopsum+max(score[:loopnum_mod]))

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

lastans = -1e20

for i in range(n):
    now = p[i] - 1 
    score = [c[now]]
    while True:
        now = p[now] - 1
        score.append(score[-1] + c[now])
        if now == i:
            break
    loopsum = score[-1]
    looplen = len(score)
#    print(score)
    if looplen >= k:
        ans = max(score[:k])
    elif loopsum <= 0:
        ans = max(score)
    else:
        loopnum = k//looplen
        loopnum_mod = k % looplen
        ans1 = loopsum * (loopnum - 1) + max(score)
        ans2 = loopsum * loopnum
        if loopnum_mod != 0:
            ans2 = ans2 +max(0,max(score[:loopnum_mod]))
        ans =max(ans1,ans2)
    lastans = max(lastans,ans)

print(lastans)
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
# MOD = 10 ** 9 + 7
MOD = 998244353


def ni(): return int(sys.stdin.readline())
def ns(): return map(int, sys.stdin.readline().split())
def na(): return list(map(int, sys.stdin.readline().split()))


# ===CODE===

class ModCombination:
    # https://atcoder.jp/contests/abc167/submissions/13058694
    # https://ikatakos.com/pot/programming_algorithm/number_theory/mod_combination

    def __init__(self, maxN, MOD):
        self._maxN = maxN
        self._MOD = MOD
        self.facts = [1]
        self.invs = [1]*(self._maxN+1)

        fact = 1
        for i in range(1, self._maxN+1):
            fact *= i
            fact %= self._MOD
            self.facts.append(fact)

        inv = pow(fact, self._MOD-2, self._MOD)
        self.invs[self._maxN] = inv
        for i in range(self._maxN, 1, -1):
            inv *= i
            inv %= self._MOD
            self.invs[i-1] = inv

    def nCr(self, n, r):
        return self.facts[n]*self.invs[r]*self.invs[n-r] % self._MOD


def main():

    n, m, k = ns()

    mc = ModCombination(n, MOD)

    result = 0

    for ki in range(k + 1):
        ans = 1
        ans *= m % MOD
        ans *= fast_pow(m - 1, n - 1 - ki, MOD)
        ans %= MOD
        ans *= mc.nCr(n-1, ki)
        ans %= MOD

        result += ans
        result %= MOD

    print(result)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
# MOD = 10 ** 9 + 7
MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def fast_pow(num, kata, mod):
        if kata == 0:
            return 1

        res = 1
        while kata > 0:
            if kata & 1 == 1:
                res = res * num % mod
            num = num * num % mod

            kata >>= 1
        return res

    def prepare(n, MOD):
        f = 1
        factorials = [1]
        for m in range(1, n + 1):
            f *= m
            f %= MOD
            factorials.append(f)
        inv = pow(f, MOD - 2, MOD)
        invs = [1] * (n + 1)
        invs[n] = inv
        for m in range(n, 1, -1):
            inv *= m
            inv %= MOD
            invs[m - 1] = inv
        return factorials, invs

    n, m, k = ns()

    p, i = prepare(n, MOD)

    result = 0

    for ki in range(k + 1):
        ans = 1
        ans *= m % MOD
        ans *= fast_pow(m - 1, n - 1 - ki, MOD)
        ans %= MOD
        ans *= p[n - 1] * i[ki] * i[n - 1 - ki]
        ans %= MOD

        result += ans
        result %= MOD

    print(result)


if __name__ == '__main__':
    main()
N, M = map(int, input.split())
print('Yes') if N == M else print('No')

### FIXED CODE ###

N, M = map(int, input().split())
print('Yes') if N == M else print('No')
import bisect
from bisect import bisect_left

n = int(input()) #n行の入力をリストに入れる
l = []
for i in range(n):
    l.append(input()) 

l.sort()
result =0
for i in range(n):
    a =l[i]
    for j in range(i+1,n-1):
        b=l[j]
        k = bisect_left(l,a+b)
        result += k-j-1

print(result)




### FIXED CODE ###

import bisect
from bisect import bisect_left

n = int(input()) #n行の入力をリストに入れる
l = []
l = list(map(int, input().split( )))

l.sort()
result =0
for i in range(n-2):
    a =l[i]
    for j in range(i+1,n-1):
        b=l[j]
        k = bisect_left(l,a+b)
        result += k-j-1

print(result)
import math
A, B, K = map(int, input().split())

gcd = math.gcd(A, B)
A = A // gcd
B = B // gcd

    
for i in range(K):
    if A >= 1:
        A -= 1
    elif B >= 1:
        B -= 1
    if A == 0 and B == 0:
        break

print(A, end=" ")
print(B)

### FIXED CODE ###

import math
A, B, K = map(int, input().split())

if A >= K:
    A = A - K
    print(A, end=" ")
    print(B)
    exit(0)

if K > A:
    K = K - A
    A = 0
    if K >= B:
        B = 0
        print(A, end=" ")
        print(B)
        exit(0)
    if B > K:
        B = B - K
        print(A, end=" ")
        print(B)
        exit(0)
while True:
	try:
		a,b,c,d,e,f = map(float, input().split())
		x = (c*e - b*f)/(a*e - b*d)
		y = (a*f - c*d)/(a*e - b*d)
		print("{0:.3f} {0:.3f}".format(x,y)
	except:
		break

### FIXED CODE ###

while True:
	try:
		a,b,c,d,e,f = map(float, input().split())
		z = a*e - b*d
		if z != 0:
			y = (a*f - c*d) / z
			x = (c*e - b*f) / z
			print("{:.3f} {:.3f}".format(x+0,y+0))
	except:
		break
s = input()
if "1" == s[0]:
    print(s.replace("1", "")[0])
else:
    print(s[0])


### FIXED CODE ###

s = input()
k = int(input())
rep = s.replace("1", "")
if len(rep) == 0:
  print("1")
else:
  if s.index(rep[0]) < k:
    print(rep[0])
  else:
    print("1")
N, M = map(int, raw_input().split())

output = 1
for i in range(1, M/N+1):
    if M % i == 0 and output < i:
        output = i

print output


### FIXED CODE ###

N, M = map(int, input().split())

output = 1
for i in range(M//N, 0, -1):
    if M % i == 0 and output < i:
        output = i
        break
print(output)
N, Q = map(int, input().split())
A = [[] for _ in range(N)]
for _ in range(N-1):
    i, k = map(int, input().split())
    A[i-1].append(k-1)
n_P = [0] * N
for _ in range(Q):
    k, n = map(int, input().split())
    n_P[k-1] += n
ans = [0] * N
visited = []
def make(num, A, p):
    for i in A[num]:
        visited.append(i)
        n_P[i] += p
        make(i, A, n_P[i])
    return
for i in range(N):
    if i not in visited:
        make(i, A, n_P[i])
print(*n_P)

### FIXED CODE ###

import sys
sys.setrecursionlimit(2*10**9)
N, Q = map(int, input().split())
A = [[] for _ in range(N)]
for _ in range(N-1):
    i, k = map(int, input().split())
    A[i-1].append(k-1)
    A[k-1].append(i-1)
n_P = [0] * N
for _ in range(Q):
    k, n = map(int, input().split())
    n_P[k-1] += n
ans = [0] * N
visited = [0] * N
def make(num, p):
    ans[num] += n_P[num] 
    ans[num] += p
    visited[num] = 1
    for i in A[num]:
        if visited[i] == 0:
            make(i,ans[num])
    return
make(0, ans[0])
print(*ans)
n = int(input())
l = list(map(int, input().split()))
sl = []

ma, mi = max(l), min(l)

for x in range(mi, ma):
  s = 0
  for i in l:
    s += (i - x)**2 
  sl.append(s)

print(min(sl))

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
sl = []

ma, mi = max(l), min(l)
if ma == mi:
  sl.append(0)

for x in range(mi, ma):
  s = 0
  for i in l:
    s += (i - x)**2 
  sl.append(s)

print(min(sl))