Harryxun/stf_run huggingface dataset:
from collections import deque

n = int(input())
s = [input() for _ in range(n)]

# 二部グラフ判定
memo = [-1] * n
memo[0] = 0
q = deque((0, -1))
while q:
    v, p = q.popleft()
    for nv in range(n):
        if s[v][nv] == '1':
            if nv == p:
                continue
            if memo[nv] == -1:
                memo[nv] = (memo[v] + 1) % 2
                q.append((nv, v))
            else:
                if memo[nv] == memo[v]:
                    print(-1)
                    exit()

# ワーシャルフロイドでグラフの直径を求めてもよし
INF = float('inf')
dp = [[1 if c == '1' else INF for c in row] for row in s]

for i in range(n):
    dp[i][i] = 0

for k in range(n):
    for i in range(n):
        for j in range(n):
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

dist = 0
for i in range(n):
    d = 0
    for j in range(n):
        d = max(d, dp[i][j])
    dist = max(d, dist)

print(dist+1)

### FIXED CODE ###

from collections import deque

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

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def merge(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        elif self.rank[x] > self.rank[y]:
            self.parent[y] = x
        else:
            self.parent[x] = y
            self.rank[y] += 1

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



n = int(input())
s = [input() for _ in range(n)]

min_i = 0
min_count = n + 1
for i in range(n):
    count = 0
    for j in range(n):
        if s[i][j]:
            count += 1
    if count < min_count:
        min_count = count
        min_i = i

uf = UnionFind(n)

INF = 1001001001
ans = 0

for min_i in range(n):
    dist = [INF] * n
    dist[min_i] = 0
    q = deque([(min_i, 0, -1)])

    while q:
        v, d, p = q.popleft()
        box = []
        for nv in range(n):
            if s[v][nv] == '1':
                if nv == p:
                    continue
                if uf.same(v, nv):
                    print(-1)
                    exit()
                if d + 1 < dist[nv]:
                    dist[nv] = d + 1
                    q.append((nv, d + 1, v))
                    box.append(nv)
        for i in range(len(box) - 1):
            uf.merge(box[i], box[i + 1])
    ans = max(ans, max(dist) + 1)

print(ans)
cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
}

n = int(input())
for _ in range(n):
    (s, r) = input().split()
    r = int(r)
    cards[s][r - 1] = r
print(data)

for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print('{0:s} {1:d}'.format(s, r+1))

### FIXED CODE ###

cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
        }
  
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    r = int(r)
    cards[s][r - 1] = r
  
for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print( '{0:s} {1:d}'.format(s, r+1))
N = int(input())
T = [int(input()) for _ in range(N)]
def gcd(a, b):
	while b:
        a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd(a, b)
l = 1
for i in T:
    l = lcm(l, i)
print(l)


### FIXED CODE ###

N = int(input())
T = [int(input()) for _ in range(N)]

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

def lcm(a,b):
    return a*b//gcd(a,b)

ans=1
for i in T:
    ans = lcm(ans,i)

print(ans)
N = int(input())
A = list(map(int,input().split())
print(max(A)-min(A))

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
print(max(A)-min(A))
s = input()
K = int(input())

ans = []
for i in range(len(s)):
    if K >= ord('z')-ord(s[i])+1:
        K -= ord('z')-ord(s[i])+1
        ans.append('a')
    else:
        ans.append(s[i])

if K >= 1:
    if len(ans) >= 1:
        ans[-1] = chr(ord(ans[-1])+K)
    else:
        print(chr(ord(s[0])+K))
        exit()

print(''.join(ans))


### FIXED CODE ###

s = input()
K = int(input())

ans = []
for i in range(len(s)):
    if K >= ord('z')-ord(s[i])+1 and s[i] != 'a':
        K -= ord('z')-ord(s[i])+1
        ans.append('a')
    else:
        ans.append(s[i])

if K >= 1:
    ans[-1] = chr(ord(ans[-1])+K % 26)

print(''.join(ans))
import collections
import math

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
cnt = 0
ansx = []
ansy = []
ansy2 = []

for x, y in c.items():
    sumall += (y*(y-1)//2))
    ansy2.append(y-1)
    ansx.append(x)

for i in A:
    print(sumall - ansy2[ansx.index(i)])


### FIXED CODE ###

import collections
import math

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
cnt = 0


sumall = 0
for x, y in c.items():
    sumall += (y*(y-1)//2)

for i in range(N):
    print(sumall - c[A[i]] + 1)
s = input()
k = int(input())
sub = []
for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        sub.append(s[i:j])
sub = sorted(list(set(sub)))
print(sub[k-1])

### FIXED CODE ###

s = input()
k = int(input())
sub = []
for i in range(len(s)):
    for j in range(i+1, min(i+6, len(s)+1)):
        sub.append(s[i:j])
sub = sorted(list(set(sub)))
print(sub[k-1])
from collections import deque
H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())

meiro = []
for i in range(H):
    meiro.append(list(map(str, input())))

check_list = deque()   
num = 0

def check0(i,k):   
    global H, W
    global check_list
    global num
    
    if k > 0:
        if meiro[i][k-1] == '.' or meiro[i][k-1] == num+1:
            meiro[i][k-1] = num  
            check_list.appendleft([i,k-1])
    if k < W-1:
        if meiro[i][k+1] == '.' or meiro[i][k+1] == num+1:
            meiro[i][k+1] = num  
            check_list.appendleft([i,k+1])
    if i < H-1:
        if meiro[i+1][k] == '.' or meiro[i+1][k] == num+1:
            meiro[i+1][k] = num 
            check_list.appendleft([i+1,k])
    if i > 0:
        if meiro[i-1][k] == '.' or meiro[i-1][k] == num+1:
            meiro[i-1][k] = num  
            check_list.appendleft([i-1,k])
    
    return check_list

def check1(i,k):
    global H,W
    global check_list
    global num
    for w in range(-2,3):
        for h in range(-2,3):
            ind = max(0,k-h)
            col = max(0,i-w)
            ind = min(H-1,ind)
            col = min(W-1,col)
            if meiro[ind][col] == '.':
                meiro[ind][col] = num+1
                check_list.append([ind, col])
                

meiro[Ch-1][Cw-1] = num
check_list.append([Ch-1,Cw-1])
while check_list != deque([]):

    position = check_list.popleft()
    if meiro[position[0]][position[1]] != num:
        num +=1
    check0(position[0],position[1])
    check1(position[0],position[1])
    
    
if meiro[Dh-1][Dw-1] == '.':
    print(-1)
else:
    print(meiro[Dh-1][Dw-1])

### FIXED CODE ###

import math
n,x,t = map(int,input().split())

num = math.ceil(n/x)

print(num*t)
N=int(input())
S=str(input())

a=N

for i in range(N-1):
    if S[i]==S[i+1]:
        a-=1

print(a)






### FIXED CODE ###

from sys import stdin
A, B = [int(x) for x in stdin.readline().rstrip().split()]
if A > 2*B:
  print(A - 2*B)
elif A <= 2*B:
  print(0)
n, c, k = map(int, input().split())
t = []
for i in range(n):
  t.append(int(input()))
t.sort()
result = 1
j = 0

for i in range(n):
  if (t[j] - t[0]) > k or c == count:
    result += 1
    t = t[j:]
    j = 1
  else:
    j += 1
print(result)

### FIXED CODE ###

n, c, k = map(int, input().split())
t = [int(input()) for i in range(n)]
t.sort()

result = 1
count = 0
f = 0

for i in range(n):
  if (t[i] - t[f]) > k or c == count:
    result += 1
    count = 1
    f = i
  else:
    count += 1
print(result)
num = input()
list_step = [int(i) for i in input().split()]
 
minus = False
for i in range(int(num)-1):
  diff = list_step[i+1] - list_step[i]
  if diff >= 0:
    minus = False
    continue
  elif diff < -1:
    print("No")
    exit()
  elif i!=0:
    if list_step[i-1]>list_step[i]:
      print("No")
      exit()
    elif list_step[i-1] == list_step[i] and minus:
      print("No")
      exit()
  minus = True
 
print("Yes")

### FIXED CODE ###

a, b, c = [ int(i) for i in input().split()]

print(max(0, c-(a-b)))
X, Y = map(int, input().split())

result = 'No'
li = []
for _ in range(X):
    li.append(2)
    if sum(li) == Y:
        result = 'Yes'
        break

for i in range(X):
    li[i] = 4
    if sum(li) == Y:
        result = 'Yes'
        break

print(result)


### FIXED CODE ###

X, Y = map(int, input().split())

result = 'No'
li = []
for i in range(X):
    li.append(4)
if sum(li) == Y:
    result = 'Yes'
else:
    for i in range(X):
        li[i] = 2
        if sum(li) == Y:
            result = 'Yes'
            break

print(result)
from sys import stdin
from collections import deque
n = int(stdin.readline())
a = map(int, stdin.readline().split())
a.sort()
f = 1
q = deque(a)
t = 1
while 1:
    if len(q) == 1:
        f = (q[0] - t + 1) & 1 ^ 1
        break
    if t == q[0] == q[-1]:
        f = len(q) & 1 ^ 1
        break
    x = q.pop()
    if len(q) == 1 and (q[0] - t + 1) & 1:
        f = 1
        break
    if t == q[0] == q[-1] and len(q) & 1:
        f = 1
        break
    q.append(x)
    while q and q[0] == t:
        q.popleft()
    t += 1
    if len(q) == 1 and (q[0] - t + 1) & 1:
        f = 1
        break
    if t == q[0] == q[-1] and len(q) & 1:
        f = 1
        break
    q.pop()
    if not q:
        f = 0
        break
print "First" if f else "Second"
from sys import stdin
from collections import deque
n = int(stdin.readline())
a = map(int, stdin.readline().split())
a.sort()
f = 1
q = deque(a)
t = 1
while 1:
    if len(q) == 1:
        f = (q[0] - t + 1) & 1 ^ 1
        break
    if t == q[0] == q[-1]:
        f = len(q) & 1 ^ 1
        break
    x = q.pop()
    if len(q) == 1 and (q[0] - t + 1) & 1:
        f = 1
        break
    if t == q[0] == q[-1] and len(q) & 1:
        f = 1
        break
    q.append(x)
    while q and q[0] == t:
        q.popleft()
    t += 1
    if len(q) == 1 and (q[0] - t + 1) & 1:
        f = 1
        break
    if t == q[0] == q[-1] and len(q) & 1:
        f = 1
        break
    q.pop()
    if not q:
        f = 0
        break
print "First" if f else "Second"


### FIXED CODE ###

from sys import stdin
from collections import deque
n = int(stdin.readline())
a = map(int, stdin.readline().split())
a.sort()
f = 1
q = deque(a)
t = 1
while 1:
    if len(q) == 1:
        f = (q[0] - t + 1) & 1 ^ 1
        break
    if t == q[0] == q[-1]:
        f = len(q) & 1 ^ 1
        break
    x = q.pop()
    if len(q) == 1 and (q[0] - t + 1) & 1:
        f = 1
        break
    if t == q[0] == q[-1] and len(q) & 1:
        f = 1
        break
    q.append(x)
    while q and q[0] == t:
        q.popleft()
    t += 1
    if len(q) == 1 and (q[0] - t + 1) & 1:
        f = 1
        break
    if t == q[0] == q[-1] and len(q) & 1:
        f = 1
        break
    q.pop()
    if not q:
        f = 0
        break
print "First" if f else "Second"
n = input()
kakeru = map(int, input().split())
kakekake = kakeru[0]
    for i in range(n-2):
        kakekake = kakekake * kakeru[i+1]
if kakekake > 10**18:
    print(-1)
print(kakekake)

### FIXED CODE ###

n = int(input())
b = 1
a = list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    for i in range(n):
        b *= a[i]
        if b > 10**18:
            print(-1)
            break
    if b <=10**18:
        print(b)
n,h,*d=map(int,open(0).read().split());a=max(d[::2]);b=sorted(d[1::2]);c=0
while(h>0)*(b[-1]>a)and b:h-=b.pop();c+=1
c-=(-h//a)*(h>0)
print(c)

### FIXED CODE ###

#!/usr/bin/env python3
n, h, *d = map(int, open(0).read().split())
a = max(d[::2])
b = sorted(b for b in d[1::2] if b >= a)[::-1]
i = 0
for b in b:
    h -= b
    i += 1
    if h <= 0:
        print(i)
        exit()
print(i + 0--h // a)
h, w = map(int, input().split())
s = [['.']*(w+2)]
s = s + [['.']+list(input())+['.'] for _ in range(w)]
s = s + [['.']*(w+2)]
a = True
for i in range(1, w+1):
    for j in range(1, w+1):
        if s[i][j] == '#':
           up = s[i-1][j]
           left = s[i][j-1]
           right = s[i][j+1]
           down = s[i+1][j]
           if up == '.' and left == '.' and right == '.' and down == '.':
                a = False
                break
    if not a:
        break
if a ==True:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]
 
flag = False
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            if (j-1 >= 0 and s[i][j-1] == '.') and (j+1 < W and s[i][j+1] == '.') and (i-1 >= 0 and s[i-1][j] == '.') and (i+1 < H and s[i+1][j] == '.'):
                print('No')
                flag = True
                break
    if flag:
        break
else:
    print('Yes')
from collections import deque
A, B = [int(x) for x in input().split()]

def gcd(x, y):
  if y == 0:
    return x
  return gcd(y, x % y)

t = gcd(A, B)
l = deque([1])
sqrt_t = t ** 0.5 + 1
for  i in range(2, sqrt_t + 1):
  if t % i == 0:
    l.append(i)
    while t % i == 0:
      t //= i
  i += 1
print(len(set(l)))


### FIXED CODE ###

from collections import deque
A, B = [int(x) for x in input().split()]

def gcd(x, y):
  if y == 0:
    return x
  return gcd(y, x % y)

t = gcd(A, B)
l = deque([1])
sqrt_t = int(t ** 0.5) + 1
for i in range(2, sqrt_t + 1):
  if t % i == 0:
    l.append(i)
    while t % i == 0:
      t //= i
      
l.append(t)
print(len(set(l)))
import numpy as np
H,W=map(int,input().split())
S=list(list(input()) for _ in range(H))
ans=0
for i in range(H):
    for j in range(W):
        if S[i][j]!='#' and j!=W-1:
            ans+=1
        elif S[i][j]!='#'and j==W-1 :
            for k in range(ans+1):
                S[i][j-k]=ans+1
            ans=0
        else:
            for k in range(1,ans+1):
                S[i][j-k]=ans
            ans=0

S_t=np.array(S).T.tolist()
ans=0
for i in range(W):
    for j in range(H):
        if S_t[i][j]!='#' and j!=H-1:
            ans+=1
        elif S_t[i][j]!='#'and j==H-1 :
            for k in range(ans+1):
                S_t[i][j-k]=ans+1+int(S_t[i][j-k])
            ans=0
        else:
            for k in range(1,ans+1):
                S_t[i][j-k]=ans+int(S_t[i][j-k])
            ans=0
c=0
for p in S_t:
    for q in p:
        if q !='#':
            c=max(int(c),int(q)-1)
print(c)

### FIXED CODE ###

H,W=map(int,input().split())
S=list(list(input()) for _ in range(H))
ans=0
for i in S:
    for j in range(W):
        if i[j]!='#' and j!=W-1:
            ans+=1
        elif i[j]!='#'and j==W-1 :
            for k in range(ans+1):
                i[j-k]=ans+1
            ans=0
        else:
            for k in range(1,ans+1):
                i[j-k]=ans
            ans=0
S_t=list(map(list,zip(*S)))
ans=0
for i in S_t:
    for j in range(H):
        if i[j]!='#' and j!=H-1:
            ans+=1
        elif i[j]!='#'and j==H-1 :
            for k in range(ans+1):
                i[j-k]+=ans+1
            ans=0
        else:
            for k in range(1,ans+1):
                i[j-k]+=ans
            ans=0
            i[j]=0
c=0
for i in S_t:
    c=max(c,max(i))
print(c-1)
import sys
from itertools import permutations

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    assert N <= 8

    X = [int(i) for i in input().split()]

    for i in range(N - 1):
        if X[i] + 1 == X[i + 1] and X[i] > 1 and X[i-1] < X[i] - 1:
            X[i] -= 1
    cnt = 0
    MOD = 10**9 + 7

    for pm in permutations(range(N)):
        Xc = X[:]
        flag = True

        for p in pm:
            for i in range(p-1, 0, -1):
                if Xc[i] == Xc[i - 1] + 1 and Xc[i - 1] == 1:
                    flag = False
                    break
            if flag:
                break
            Xc[p] = -1

        cnt += flag

        # if flag:
            # print(list(pm))

    print(cnt % MOD)


if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys
from math import factorial

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    X = [int(i) for i in input().split()]
    MOD = 10**9 + 7
    ans = 1
    stack = 0

    for x in X:
        stack += 1
        if x < 2*(stack - 1) + 1:
            ans *= stack
            ans %= MOD
            stack -= 1

    ans *= (factorial(stack) % MOD)
    ans %= MOD

    print(ans)


if __name__ == '__main__':
    solve()
##################################################################

if __name__ == "__main__":
    Input = [input() for i in range(2)]
    # = list(map(int,Input[0].split()))
    S = str(Input[0])
    K = int(Input[1])

    n = len(S)
    ren = 1
    bef = S[0]
    cont = []
    for s in range(1,n):
        if bef == S[s]:
            ren += 1
            bef = S[s]
            if s == n-1:
                cont.append(ren)                
        else:
            cont.append(ren)
            ren = 1
            bef = S[s]

    ans = (sum([c//2 for c in cont]))*K
    if S[0] == S[-1]:
        if cont[0]%2==1 and cont[-1]%2==1:
            ans += K-1
    print(ans)


### FIXED CODE ###

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

if __name__ == "__main__":
    Input = [input() for i in range(2)]
    # = list(map(int,Input[0].split()))
    S = str(Input[0])
    K = int(Input[1])

    n = len(S)
    ren = 1
    bef = S[0]
    cont = []
    if n == 1:
        cont = [1]
    for s in range(1,n):
        if bef == S[s]:
            ren += 1
            bef = S[s]
            if s == n-1:
                cont.append(ren)                
        else:
            cont.append(ren)
            ren = 1
            bef = S[s]

    ans = (sum([c//2 for c in cont]))*K
    if n ==1:
        ans += K//2
    elif S[0] == S[-1]:
        if len(cont)>1 and cont[0]%2==1 and cont[-1]%2==1:
            ans += K-1
        elif len(cont) ==1:
            ans = (n*K)//2
    print(ans)
#ABC071C
N=int(input())
A=list(map(int,input().split()))
max_A=max(A)
lines=[0]*(max_A+1)
long_line=0
for i in range(N):
    lines[A[i]]+=1
if max(lines)<2:
    print(0)
    exit()
for i in range(max_A+1):
    j=max_A-i
    if lines[j]>=4:
        if long_line>0:
            print(long_line*j)
            exit()
        else:
            print(j*j)
            exit()
    elif lines[j]>=2:
        if long_line>0:
            print(long_line*j)
            exit()
        else:
            long_line=j
print(0)

### FIXED CODE ###

#ABC071C
N=int(input())
A=list(map(int,input().split()))
A_sorted=sorted(A,reverse=True)
long_line=0
lines=1
for i in range(N-1):
    if A_sorted[i]==A_sorted[i+1]:
        lines+=1
    if A_sorted[i]!=A_sorted[i+1] or i==N-2:
        if lines>=4:
            if long_line>0:
                print(long_line*A_sorted[i])
                exit()
            else:
                print(pow(A_sorted[i], 2))
                exit()
        elif lines>=2:
            if long_line>0:
                print(long_line * A_sorted[i])
                exit()
            else:
                long_line=A_sorted[i]
        lines=1
print(0)
S = list(input())
c1 = (len(set(S)) == 2)
m = list(set(S))[0]
n = list(set(S))[1]
m_c, n_c = 0, 0
c2 = False
if c1:
    for i in range(len(S)):
        if S[i] == m:
            m_c += 1
        else:
            n_c += 1
    if m_c == n_c:
        c2 = True

if c1 and c2:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

S = input()
S = list(S)

if len(set(S)) == 2:
    
    m = list(set(S))[0]
    n = list(set(S))[1]

    m_c, n_c = 0, 0
    c = False
    
    for i in range(len(S)):
        if S[i] == m:
            m_c += 1
        else:
            n_c += 1
            
    if m_c == n_c:
        c = True

    if c:
        print('Yes')
    else:
        print('No')

else:
    print('No')
n = int(input())
s = list(input() for i in range(n))
a = s.count("AC")
w = s.count("WA")
t = s.count("TLE")
r = s.count("RE")

print("AC x " + str(a))
print("WA x " + str(w))
print("TLE x " + str(t))
print("RE x " + str(r

### FIXED CODE ###

n = int(input())
s = list(input() for i in range(n))
a = s.count("AC")
w = s.count("WA")
t = s.count("TLE")
r = s.count("RE")

print("AC x " + str(a))
print("WA x " + str(w))
print("TLE x " + str(t))
print("RE x " + str(r))
import numpy as np
from scipy.optimize import fmin

n,k=map(int,input().split())
XYC=[list(map(int,input().split())) for i in range(n)]

X=np.array(XYC[::3],dtype=np.float)
Y=np.array(XYC[1::3],dtype=np.float)
C=np.array(XYC[2::3],dtype=np.float)
def f(xy):
    x,y=xy
    times=(X-x)*(X-x)+(Y-y)*(Y-y)
    times=C*np.sqrt(times)
    times=np.sort(times)
    return times[k-1]
ansx=[fmin(f,(x,y),disp=False,ftol=10**(-7),initial_simplex=[(x+100,y),(x-100,y+100),(x-100,y-100)]) for x,y,c in XYC]
ansy=list(map(lambda x:f(x),ansx))
print(min(ansy))

### FIXED CODE ###

import numpy as np
from scipy.optimize import fmin

n,k=map(int,input().split())
XYC=[list(map(int,input().split())) for i in range(n)]
X,Y,C=[],[],[]
for x,y,c in XYC:
    X.append(x)
    Y.append(y)
    C.append(c)
X=np.array(X,dtype=np.float)
Y=np.array(Y,dtype=np.float)
C=np.array(C,dtype=np.float)
def f(xy):
    x,y=xy
    times=(X-x)*(X-x)+(Y-y)*(Y-y)
    times=C*np.sqrt(times)
    times=np.sort(times)
    return times[k-1]
deff=0.5
ansx=[fmin(f,(x,y),disp=False,ftol=10**(-7),initial_simplex=[(x+deff,y),(x-deff,y+deff),(x-deff,y-deff)]) for x,y,c in XYC]
ansy=list(map(lambda x:f(x),ansx))
print(min(ansy))
import copy

def main():
    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)

    def lcm(a, b):
        return (a // gcd(a, b)) * b

    n, m = map(int, input().split())
    # これだと72がREになる
    A = set([int(x) for x in input().split()])
    # これだと74も78もREになる
    # A = [int(x) for x in input().split()]
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    # Aの要素が複数ならlcmを計算する
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    # 元のAの値とlcmの半分の値を割り切れるものがあったら0
    #for i in A_:
    for i in A:
        if (a_lcm / 2) % i == 0:
            print(0)
            exit()
        # else:
        #     continue
    # mがlcmの半分よりも小さかったら0
    if a_lcm / 2 > m:
        print(0)
    else:
        # あとは定数倍の数調べて終わり
        # ans = int((m - (a_lcm / 2))) // a_lcm + 1
        ans = int((m - (a_lcm / 2)) // a_lcm) + 1
        print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
def oddOut():

s = str(input())
print(s[::2])
        
 
pddOut()

### FIXED CODE ###

def hourglass():
    X, t = list(map(int, input().split(" ")))
    if X - t <= 0:
        print(0)
    else:
        print(X - t)
        
 
hourglass()