Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())
A = list(map(int, input().split()))
daytofinish = sum(A)
print(N-daytofinish)
N, M = map(int, input().split())
A = list(map(int, input().split()))
daytofinish = sum(A)
if N-daytofinish < 0:
    print(-1)
else:
    print(N-daytofinish)

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
daytofinish = sum(A)
if N-daytofinish < 0:
    print(-1)
else:
    print(N-daytofinish)
n = int(input())
s = input()
k = int(input())
ans = ''
for i in range(n):
    if s[i] == s[k]:
        ans += s[k]
    else:
        ans += '*'
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
k = int(input())
ans = ''
for i in range(n):
    if s[i] == s[k-1]:
        ans += s[k-1]
    else:
        ans += '*'
print(ans)
A,B=map(int,input().split())
x = [A,B]
A = [1,2,3]
for idx in range(len(A)):
  if (A[idx] in x )== False:
    print(A[idx])
    break
 


### FIXED CODE ###

A = int(input())
B = int(input())
print(6-A-B)
def main():
    import numpy as np
    h,w,k = map(int,input().split())
    l = [list(input()) for i in range(h)]

    def check(lis):
        lis.append(h)
        num = [0]*(len(lis))
        ans = 0
        for i in range(w):
            ch = 0
            num2 = [0]*(len(lis))
            for j in range(h):
                
                if l[j][i] == "1":
                    if j <= lis[ch]:
                        num2[ch] += 1
                    else:
                        ch += 1
                        num2[ch] += 1
            if max(num2) > k:
                return float("INF")
            else:
                for i in range(len(num)):
                    num[i] += num2[i]
                    if num[i] > k:
                        ans += 1
                        num = num2
                        break 
            
            
        return ans

    ans = 10**9

    for i in range(2**(h-1)):
        count = 0
        lis1 = []
        for j in range(h-1):
            if (i >> j) & 1:
                lis1.append(j)
                count += 1
        
        ans = min(ans,count+check(lis1))
        
    print(ans)
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    
    h,w,k = map(int,input().split())
    l = [list(input()) for i in range(h)]

    def check(lis):
        
        num = [0]*(len(lis))
        ans = 0
        for i in range(w):
            num2 = [0]*(len(lis))
            for j in range(h):
                
                if l[j][i] == "1":
                    num2[d[j]] += 1
            if max(num2) > k:
                return float("INF")
            else:
                for i in range(len(num)):
                    num[i] += num2[i]
                    if num[i] > k:
                        ans += 1
                        num = num2
                        break 
            
            
        return ans

    ans = 10**9

    for i in range(2**(h-1)):
        count = 0
        lis1 = []
        d = []
        for j in range(h):
            d.append(count)
            if (i >> j) & 1:
                lis1.append(j)
                count += 1
        lis1.append(count+1)
        ans = min(ans,count+check(lis1))
        
    print(ans)
if __name__ == "__main__":
    main()
import math

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

for i in range(min(math.ceil(math.log(N))+10, K)):
  B = [0] * N
  for n, A_n in enumerate(A):
    B_min = max(0, n-A_n)
    b_max = min(N-1, n+A_n)
    B[B_min] += 1
    if b_max+1 < N:
      B[b_max+1] -= 1
  
  sum = 0
  for n in range(len(A)):
    sum += B[n]
    A[n] = sum

print(" ".join(list(map(str, A))))

### FIXED CODE ###

S = input()
print(S[:3])
i = list(map(int, input().split()))
count: int = 0
if i[0] <= i[1]:
    print("1")
else:
    while i[0] > 0:
        i[0] -= i[1]
        count += 1
    print(count)

### FIXED CODE ###

i = list(map(int, input().split()))
count = 0
if i[0] <= i[1]:
    print("1")
else:
    while i[0] > 0:
        i[0] -= i[1]
        count += 1
    print(count)
from numpy import*
n,M=map(int,input().split())
l=n*3+1
d=zeros(l,n*5)
d[0][0]=1
for i in range(1,l):j,k=i-1,i-2;d[i]=(d[i-3]*k*j+roll(d[k],-1)*j+roll(d[j],1))%M
print(sum(d[-1][:l])%M)


### FIXED CODE ###

n,m=map(int,input().split())
n3=3*n
x=lambda a,b:(a+b)%mod
d=[[0]*(n+2) for i in range(n3+4)]
d[0][0]=1
for i in range(n3):
  d0,d1,d2,d3=d[i:i+4]
  for j in range(n+1):
    d1[j]=(d1[j]+d0[j])%m
    d2[j+1]=(d2[j+1]+d0[j]*(i+1))%m
    d3[j+1]=(d3[j+1]+d0[j]*(i+1)*(i+2))%m
print(sum(d[n3][:n+1])%m)
N,P = map(int, input().split())
A = list(map(int, input().split()))

even_num=0
odd_num=0

for a in A:
    if a%2==0:
        even_num+=1
    else:
        odd_num+=1

ev_case = 2**even_num

from scipy.special import comb

res=0
for i in range(P,odd_num+1,2):
    res += comb(odd_num, i, exact=True)

print(ev_case*res)

### FIXED CODE ###

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

even_num=0
odd_num=0

for a in A:
    if a%2==0:
        even_num+=1
    else:
        odd_num+=1

ev_case = 2**even_num


from math import factorial

res=0
for i in range(P,odd_num+1,2):                                                                   res += factorial(odd_num) / factorial(i) / factorial(odd_num - i)

print(int(ev_case*res))
def main ():
	N = int(input())
	A = list(map(int,input().split()))
	if 0 in A:
    	print (0)
		return

    prod = 1
    for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1) return
	print(prod)

main ()

### FIXED CODE ###

N = input()
A = list(map(int,input().split()))
def main(A):
    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)

main(A)
x = input())
a = list(map(int, input().split())
print("%d %d %d"%(min(a), max(a), sum(a)))


### FIXED CODE ###

x = input()
a = list(map(int, input().split()))
print("%d %d %d"%(min(a), max(a), sum(a)))
n, m = map(int, input().split())
issafe = [True] * n
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * n
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

### FIXED CODE ###

n, m = map(int, input().split())
issafe = [True] * (n +1)
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * (n + 1)
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])
N = int(input())
    A = input().split(" ")
    B = [int(n) for n in A]
     
    m = inf
    M = 0
    for b in B:
      if b < m:
        m = b
      
      if b > M:
        M = b
     
    print(M-m)

### FIXED CODE ###

N = int(input())
A = input().split(" ")
B = [int(n) for n in A]
             
m = float("inf")
M = 0
for b in B:
  if b < m:
    m = b
              
  if b > M:
    M = b
             
print(M-m)
from copy import deepcopy

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

ans = 0

if len(set(A)) == 1:
    print(0)
    exit()

# エラトステネスの篩っぽく処理
search_list = deepcopy(A)
ans = 0

tmp = min(search_list)
smax = int(max(search_list)**0.5) + 1

while search_list:
    ans += 1
    search_list = [i for i in search_list if i % tmp != 0]
    tmp = min(search_list)
    if tmp < smax:
        ans += len(search_list)
        break

print(ans)


### FIXED CODE ###

from collections import Counter

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

# エラトステネスの篩っぽく処理
ans_list = [True for _ in range(A[-1] + 1)]
ans = 0

# ダブリを省くために先に数える
c = Counter(A)

for a in A:
    if ans_list[a] == True:
        if c[a] == 1:
            ans += 1
        i = 2
        while a * i <= A[-1]:
            ans_list[a * i] = False
            i += 1

print(ans)
A,B,C=map(int,input().split())
K=int(input())
a=K
while A<B:
    B*=2
    a-=1

while B<C:
    C*=2
    a-=1

if a>=0:
    print('Yes')
else:
    print('No')
    

### FIXED CODE ###

A,B,C=map(int,input().split())
K=int(input())
a=K
while A>=B:
    B*=2
    a-=1

    
while B>=C:
    C*=2
    a-=1
    
if a>=0:
    print('Yes')
else:
    print('No')
a = input().split(' ')
while True:
  for i in renge(3):
    if a[i] != 5 or a[i] != 7:
      print('NO')
      break
  if a[0] + a[1] + a[2] == 17:
    print('YES')
    break
  print('NO')
  break



### FIXED CODE ###

f = False
a = input().split(' ')
for i in range(3):
  a[i]=int(a[i])
while True:
  for i in range(3):
    if a[i] != 5 and a[i] != 7:
      print('NO')
      f = True
      break
  if f == True:
    print(2)
    break
  if a[0] + a[1] + a[2] == 17:
    print('YES')
    break
  else:
    print('NO')
    break
N = int(input())
b = []
r = []
_all = []
for i in range(N):
  b.append(input())
  _all.append(input())
N = int(input())
for i in range(N):
  r.append(input())
  _all.append(input())
_all = list(set(_all))
ans = 0
for i in _all:
  ans = max(ans, b.count(i)-r.count(i))
print(ans)

### FIXED CODE ###

N = int(input())
b = []
r = []
all_l = []
for i in range(N):
  tmp = input()
  b.append(tmp)
  all_l.append(tmp)
N = int(input())
for i in range(N):
  tmp = input()
  r.append(tmp)
  all_l.append(tmp)
all_l = list(set(all_l))
ans = 0
for i in all_l:
  ans = max(ans, b.count(i)-r.count(i))
print(ans)
n = int(input())

w = [(list(map(int, input().split()))) for i in range(n)]#x,y,h

for cx in range(101):
    for cy in range(101):
        for i in range(n):
            if w[i][2] > 0:
                if i == 0:
                    hcon1 = abs(w[i][0] - cx) + abs(w[i][1] - cy) + w[i][2]
                elif i != 0 and i != n - 1:
                    hcon2 = abs(w[i][0] - cx) + abs(w[i][1] - cy) + w[i][2]
                    if hcon1 != hcon2:
                        break
                    else:
                        hcon1 = hcon2
                else:
                    hcon2 = abs(w[i][0] - cx) + abs(w[i][1] - cy) + w[i][2]
                    if hcon1 != hcon2:
                        break
                    else:
                        print(cx,cy,hcon1)
                        exit()

### FIXED CODE ###

n = int(input())

w = [(list(map(int, input().split()))) for i in range(n)]#x,y,h
w.sort(key=lambda x:(x[2]),reverse=True)
hcon1 = 0
hcon2 = 0
for cx in range(101):
    for cy in range(101):
        for i in range(n):
            if w[i][2] > 0:
                if i == 0:
                    hcon1 = abs(w[i][0] - cx) + abs(w[i][1] - cy) + w[i][2]
                elif i != 0 and i != n - 1:
                    hcon2 = abs(w[i][0] - cx) + abs(w[i][1] - cy) + w[i][2]
                    if hcon1 != hcon2:
                        break
                    else:
                        hcon1 = hcon2
                else:
                    hcon2 = abs(w[i][0] - cx) + abs(w[i][1] - cy) + w[i][2]
                    if hcon1 != hcon2:
                        break
                    else:
                        print(cx,cy,hcon1)
                        exit()
            else:
                if i == 0:
                    hcon1 = 1
                elif i != 0 and i != n - 1:
                    if hcon1 > abs(w[i][0] - cx) + abs(w[i][1] - cy) + w[i][2]:
                        break
                else:
                    if hcon1 > abs(w[i][0] - cx) + abs(w[i][1] - cy) + w[i][2]:
                        break
                    else:
                        print(cx, cy, hcon1)
                        exit()
#C - Count Order
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

li = list(itertools.permutations(P ,N))

a = 0
b = 0

for i in range(math.factorial(3)):
    if li[i] == P:
        a = i
    elif li[i] == Q:
        b = i
    else:
        a = a
        b = b
        
print(abs(a-b))

### FIXED CODE ###

import math
import itertools

N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

li = list(itertools.permutations(P,N))
li.sort()

a = 0
b = 0

for i in range(math.factorial(N)):
    if li[i] == P:
        a = i
    else:
        a = a

for i in range(math.factorial(N)):
    if li[i] == Q:
        b = i
    else:
        b = b
        
print(abs(a-b))
import copy
N,M = map(int,input().split())
A = list(map(int,input().split()))
x = A.pop(0)
for i in range(N-1):
    B = list(map(int,input().split()))
    B.pop(0)
    y = len(A)
    C = copy.deepcopy(A)
    for j in range(y):
        if C[j] not in B:
            A.pop(j)
    if len(A) == 0:
        break

print(len(A))

### FIXED CODE ###

N,M = map(int,input().split())
A = [0 for i in range(M)]
for i in range(N):
    B = list(map(int,input().split()))
    B.pop(0)
    for j in range(len(B)):
        A[B[j]-1] += 1

cnt = 0
for i in range(M):
    if A[i] == N:
        cnt += 1
print(cnt)
import collections
import sys


scan = sys.stdin.readline

def count_abc(string):
  alphabet = dict.fromkeys("abcdefghijklmnopqrstuvwxyz",0)
  
  for char in string:
    num = alphabet[char]
    alphabet[char] = num + 1
  
  c_str = ""
  for k, v in alphabet.items():
    c_str += k
    c_str += v
  
  return c_str


def main():
  n = int(scan().rstrip())
  s = [scan().rstrip() for _ in range(n)]
  
  s_c [count_abc(string) for string in s]
  
  c_dict = collections.Counter(s_c)
  
  print(max(c_dict))


### FIXED CODE ###

import collections
import sys
from scipy.misc import comb


scan = sys.stdin.readline

def count_abc(string):
  alphabet = dict.fromkeys("abcdefghijklmnopqrstuvwxyz",0)
  
  for char in string:
    num = alphabet[char]
    alphabet[char] = num + 1
  
  c_str = ""
  for k, v in alphabet.items():
    c_str += k
    c_str += str(v)
  
  return c_str


def main():
  n = int(scan().rstrip())
  s = [scan().rstrip() for _ in range(n)]
  
  s_c = [count_abc(st) for st in s]
  
  c_dict = collections.Counter(s_c)
  
  ans = 0
  
  for v in c_dict.values():
    if v > 1:
      ans += comb(v, 2, exact=True)
  
  print(ans)

  
if __name__ == "__main__":
  main()
s = raw_input().rstrip()
t = s
s = s[::-1]
s = s.replace("b", "d")
s = s.replace("p", "q")
s = s.replace("d", "b")
s = s.replace("q", "p")
print s == t * "YES" or "NO"

### FIXED CODE ###

s = raw_input().rstrip()
t = s
s = s[::-1]
s = s.replace("b", "t")
s = s.replace("p", "s")
s = s.replace("d", "b")
s = s.replace("q", "p")
s = s.replace("t", "d")
s = s.replace("s", "q")
print ((s == t) * "Yes") or "No"
def main():
    n = int(input())
    As = list(map(int, input().split(" ")))

    for a in As:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                ans = "APPROVED"
            else:
                ans = "DENIED"
                break

    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    As = list(map(int, input().split(" ")))

    ans = "APPROVED"
    for a in As:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                ans = "DENIED"
                break

    print(ans)

if __name__ == '__main__':
    main()
t = list(map(int, input().split()))
a = t[0]
b = t[1]
h = t[2]
m = t[3]
import math

h_c = 30*h + 0.5*m
m_c = 6*m

z = abs(h_c - m_c)
if z > 180:
  z -= 180
if z == 180:
  print(h[0]+h[1])
else:
  a = a**2
  b = b**2
  k = round(math.cos(math.radians(z)),30)
  print(math.sqrt(a + b - 2*t[0]*t[1]*k))


### FIXED CODE ###

t = list(map(int, input().split()))
a = t[0]
b = t[1]
h = t[2]
m = t[3]
import math

h_c = 30*h + 0.5*m
m_c = 6*m

z = abs(h_c - m_c)
if z > 180:
  z = 360 - z
if z == 180:
  print(t[0]+t[1])
elif z == 0:
  print(abs(t[0]-t[1]))
else:
  a = a**2
  b = b**2
  k = round(math.cos(math.radians(z)),30)
  print(math.sqrt(a + b - 2*t[0]*t[1]*k))
n,k=map(int, input().split())
ds=list(map(str, input().split()))
while i in str(n) for i in ds:
  n+=1
print(str(n))


### FIXED CODE ###

n,k=map(int, input().split())
ds=list(map(str, input().split()))
while any(i in str(n) for i in ds):
  n+=1
print(str(n))
import sys
N,M = map(int,input().split())
source = []
goal = ''
for i in range(M):
  keta,number = map(int,input().split())
  source.append((keta,number))
source.sort()
#論外の処理：
for i in range(M):
    keta1,number1 = source[i]
    for j in range(M):
     	keta2,number2 = source[j]
     	if i != j and (keta1 == keta2) and (number1 != number2):
        	print('-1')
        	sys.exit(0)
if N == 1:
    if source[0][0] == 1:
        print(source[0][1])
        sys.exit(0)
    else:
        print(0)
        sys.exit(0)
for i in range(N):
  if i < len(source):
    keta,number = source[i]
    if i == keta-1:
      goal += str(number)
    else:
      goal += '0'
  else:
    goal += '0' #len(goal) == N.
k = int(goal)
if len(str(k)) == len(goal):
  print(goal)
else:
  print('-1')

### FIXED CODE ###

import sys
N,M = map(int,input().split())
if (N,M) == (1,0):
    print('0')
    sys.exit(0)
res = ['a' for _ in range(N)]
for i in range(M):
  s,c = map(int,input().split())
  if res[s-1] != 'a' and res[s-1] != str(c):
    print('-1')
    sys.exit(0)
  else:
    res[s-1] = str(c)
for i in range(N):
    if res[i] == 'a':
        if i == 0:
            res[i] = '1'
        else:
            res[i] = '0'
st = ''
for i in range(N):
  st += res[i]
if st[0] == '0' and len(st) > 1:
  print('-1')
  sys.exit(0)
print(st)
from sys import stdin, setrecursionlimit


def dfs(f, v, seen):
    seen[v] = True

    for nv in f[v]:
        if seen[nv]:
            continue
        dfs(f, nv, seen)


def main():
    n, m, k = map(int, stdin.readline().split())

    f = [[] for _ in range(n)]

    for _ in range(m):
        a, b = map(int, stdin.readline().split())
        f[a - 1].append(b - 1)
        f[b - 1].append(a - 1)

    b = [[] for _ in range(n)]

    for _ in range(k):
        c, d = map(int, stdin.readline().split())
        b[c - 1].append(d - 1)
        b[d - 1].append(c - 1)

    ans = [0] * n

    u = [-1] * n
    uid = 0
    for i in range(n):
        if u[i] == -1:
            seen = [False] * n
            dfs(f, i, seen)
            for j in range(n):
                if seen[j]:
                    u[j] = uid
        uid += 1

    for i in range(n):
        uid = u[i]
        arr = [i for i in range(n) if u[i] == uid]
        tmp = len(set(arr) - set(f[i]) - set(b[i]))
        tmp -= 1
        ans[i] = tmp

    print(*ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

### FIXED CODE ###

from sys import stdin, setrecursionlimit


class UnionFindTree:
    def __init__(self, n):
        self.parent = [-1] * n

    def find(self, x):
        p = self.parent
        while p[x] >= 0:
            x, p[x] = p[x], p[p[x]]
        return x

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        p = self.parent
        if x != y:
            x, y = sorted([x, y])
            p[x], p[y] = p[x] + p[y], x

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

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


def main():
    n, m, k = map(int, stdin.readline().split())

    f = UnionFindTree(n)

    f_or_b = [0] * n

    for _ in range(m):
        a, b = map(int, stdin.readline().split())
        f.union(a - 1, b - 1)
        f_or_b[a - 1] += 1
        f_or_b[b - 1] += 1

    for _ in range(k):
        c, d = map(int, stdin.readline().split())
        if f.same(c - 1, d - 1):
            f_or_b[c - 1] += 1
            f_or_b[d - 1] += 1

    print(*[f.size(i) - f_or_b[i] - 1 for i in range(n)])


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
a,b = input().split()
a = int(a)
b = float(b*100)
print((a*b)//100)


### FIXED CODE ###

a,b = input().split()
a = int(a)
b = round(float(b)*100)
print((a*b)//100)
def dfs(tree, count, p):
    for i in tree[p]:
        count[i] += count[p]
        dfs(tree, count, i)


def find_root(inv):
    return [k for k in inv if len(inv[k]) == 0][0]


def main():
    N, Q = map(int, input().split())
    tree = {i+1: [] for i in range(N)}
    inv = {i+1: [] for i in range(N)}
    count = {i+1: 0 for i in range(N)}

    for _ in range(N-1):
        a, b = map(int, input().split())
        tree[a].append(b)
        inv[b].append(a)

    for _ in range(Q):
        p, x = map(int, input().split())
        count[p] += x

    dfs(tree, count, find_root(inv))

    print(" ".join(map(str, count.values())))


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict, deque


def main():
    N, Q = map(int, input().split())

    tree = defaultdict(list)
    counter = defaultdict(int)
    for _ in range(N-1):
        a, b = map(int, input().split())
        tree[a].append(b)
        tree[b].append(a)
    for _ in range(Q):
        p, x = map(int, input().split())
        counter[p] += x

    # bfs
    q = deque([1])
    visited = {1}

    while q:
        i = q.popleft()

        for j in tree[i]:
            if j not in visited:
                q.append(j)
                counter[j] += counter[i]
                visited.add(j)

    counts = [counter[i] for i in range(1, N+1)]
    ans = " ".join(map(str, counts))
    print(ans)



if __name__ == '__main__':
    main()
x = input()
y = input()
list = y.split()
even_list = []

for i in list:
  i = int(i)
  if i % 2 == 0:
    even_list.append(i)
    
for y in even_list:
  if y % 3 == 0 or y % 5 == 0:
    result = "APROVED"
  else:
    result = "DENIED"
    break
    
print(result)


### FIXED CODE ###

x = input()
y = input()
list = y.split()
even_list = []
result = ''

for i in list:
  i = int(i)
  if i % 2 == 0:
    even_list.append(i)
  else:
    result = "APPROVED"
    
for y in even_list:
  if y % 3 == 0 or y % 5 == 0:
    result = "APPROVED"
  else:
    result = "DENIED"
    break
    
print(result)
a,b,c,d=map(int(),input().split())
maxa=a*c
e=a*d
f=b*c
g=b*d
h=max(maxa,e)
j=max(f,g)
if h>j:
  print(h)
else:
  print(j)

### FIXED CODE ###

a,b,c,d=map(int,input().split())
maxa=max(a*c,a*d,b*c,b*d)
print(maxa)