Harryxun/stf_run huggingface dataset:
import math
import collections
N = int(input())
A = [int(i) for i in input().split()]

def trial_division(n):
    Num = n
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return [Num]
    else:
        factor.append(n)
        return factor


List = [[] for i in range(N)]
for i in range(N):
    tmp = trial_division(A[i])
    tmp = collections.Counter(tmp)
    List[i] = tmp[2]

cnt0,cnt1,cnt2 = 0,0,0
for i in range(len(List)):
    if List[i]==1 and List[i+1]!=1:
        cnt0 += 1

    if List[i]==0:
        cnt0+=1
        
    elif List[i]==1:
        cnt1+=1
        
    else:
        cnt2 += 1
        


if cnt2+1>=cnt0:
    print('Yes')
else:
    print('No')



### FIXED CODE ###

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

cnt4,cnt2,cnt = 0,0,0

for i in A:
    if i%4==0:
        cnt4 += 1
    elif i%2==0:
        cnt2 += 1
    else:
        cnt += 1
cnt += cnt2%2

if cnt4+1>=cnt:
    print('Yes')
else:
    print('No')
a = input()
card_list = list(map((int),input().split(' ')))

sum_card = sum(card_list)
score = []
sunuke = 0

for i in range(int(a)-1):
    
    sunuke += card_list[i]
    score.append(abs(sum_card-2*sunuke))

print(min(score))

### FIXED CODE ###

a = input().split(' ')
b = list(map((int), a))
sum = sum(b)
A = b[0]
B = b[1]

if sum % 3 == 0 or A % 3 == 0 or B % 3 == 0:
    print('Possible')

else:
    print('Impossible')
first_line = input().split()
second_line = input().split()
third_line = input().split()
 
first_line = [int(i) for i in first_line]
second_line = [int(i) for i in second_line]
third_line = [int(i) for i in third_line]

N = input()
N = int(N)

B  = [] 
for i in range(N):
    inp  =input()
    inp = int(inp)
    B.append(inp)


# arr = [[0]*3]*3
# print(arr)
# for i in range(3):
#     arr[0][i]= first_line[i]
#     print(arr)
# print(arr)
# for i in range(3):
#     arr[1][i]= second_line[i]
# for i in range(3):
#     arr[2][i]= third_line[i]

arr = []
arr.append(first_line)
arr.append(second_line)
arr.append(third_line)
carr = [[False for i in range(3)] for j in range(3)]

print(arr)
for b in B:
    for i in range(3):
        for j  in range(3):
            if b == arr[i][j]:
                carr[i][j] = True
                print(b, carr)

print(carr)

def yoko(carr):
    for i in range(3):
        flag = 0
        for j in range(3):
            if carr[i][j] != True:
                print('pass',i,j)
                flag = 1
        if flag == 0 :
            return True    
    return False


def tate(carr):
    for i in range(3):
        flag = 0
        for j in range(3):
            if carr[j][i] != True:
                flag = 1
                break
        if flag == 0:

            return  True
    
    return False

def naname (carr):
    flag2 = 0
    flag1 = 0
    for i in range(3):
        if carr[i] != True:
            flag1 = 1

        if carr[3-i-1] != True:
            flag2 = 1;
    if flag1==0 or flag2 ==0:
        return True
    else:
        return False


def checker(carr):
    if tate:
        print('tate')
    if yoko:
        print('yoko')
    if naname:
        print('naname')
    
    if not tate  and not yoko and not naname:
        return 'No'
    else:
        return 'Yes' 



print(checker(carr))

### FIXED CODE ###

N = input()
N = int(N)
if N%2 ==0:
    amari = 0
else:
    amari = 1

N  = N/2
N = int(N)

print(N+ amari)
a,b = map(str,input().split())
s = str(input())
if s.count('-') == 1 and s[a+1] == '-':
    print('Yes')
else:
  print('No')


### FIXED CODE ###

a,b = map(int,input().split())
s = str(input())
if s.count('-') == 1 and s[a] == '-':
  print('Yes')
else:
  print('No')
A, B, C, X, Y = map(int, input().split())
if A + B < 2 * C:
    ans = A * X + B * Y
elif A + B > 2 * C:
    nokori = abs(X - Y)
    if X > Y and A >= 2 * C:
        ans = C * 2 * X
    if Y > X and B >= 2 * C:
        ans = C * 2 * Y
    if X > Y and A < 2 * C:
        ans = C * 2 * Y + nokori * A
    if Y > X and B < 2 * C:
        ans = C * 2 * X + nokori * B
print(ans)

### FIXED CODE ###

A, B, C, X, Y = map(int, input().split())
    

if X >= Y:
    ans = min(A*X + B*Y, 2*C*Y + A*(X-Y), 2*C*X)
else:
    ans = min(A*X + B*Y, 2*C*X + B*(Y-X), 2*C*Y)

print(ans)
n = int(input())
output = []
for i in range(n):
    order,data = map(input().split())
#    if order == "insert":
#        output.append(int(data))
#    elif order == "deleteFirst":
#        output.pop()
#    elif order == "deleteLast":
#        output.popleft()

#   elif order == "delete":
#        try:
#            output.remove(int(data))
#        except:
#            pass
#output.reverse()
print(" ".join(output))
#print(" ".join(map(str,output)))

### FIXED CODE ###

import sys
from collections import deque
n = int(sys.stdin.readline())
lines = sys.stdin.readlines()
 
Q = deque()
for i in range(n):
    command = lines[i].split()
    if command[0] == "insert":
        Q.appendleft(command[1])
    elif command[0] == "deleteFirst":
        Q.popleft()
    elif command[0] == "deleteLast":
        Q.pop()
    elif command[0] == "delete":
        try:
            Q.remove(command[1])
        except:
            pass
print(" ".join(Q))
n=imput()
if n[i]==n[i+1] for i in range(0,3):
    print("Bad")
else:
    print("Good")


### FIXED CODE ###

n=input()
if any(n[i]==n[i+1] for i in range(0,3)):
    print("Bad")
else:
    print("Good")
import sys
sys.setrecursionlimit(10 ** 20)
def input(): return sys.stdin.readline().rstrip()

def main():
    N, Q = map(int, input().split())
    ki = [[] for _ in range(N + 1)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        ki[a].append(b)
    PX = [tuple(map(int, input().split())) for _ in range(Q)]

    ans = [0 for _ in range(N + 1)]
    def dfs(i, n):
        ans[i] += n
        for j in ki[i]:
            dfs(j, n)

    for p, x in PX:
        dfs(p, x)
    print(*ans[1:])

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().rstrip()

def main():
    N, Q = map(int, input().split())
    ki = [[] for _ in range(N + 1)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        ki[a].append(b)
        ki[b].append(a)
    PX = [tuple(map(int, input().split())) for _ in range(Q)]

    ans = [0 for _ in range(N + 1)]
    for p, x in PX:
        ans[p] += x
    visited = set()
    def dfs(i):
        visited.add(i)
        for j in ki[i]:
            if j in visited:
                continue
            ans[j] += ans[i]
            dfs(j)
    dfs(1)
    print(*ans[1:])

if __name__ == '__main__':
    main()
import copy
import sys
x,n = map(int, input().split())
nums = list(map(int, input().split()))
nums.sort()
if len(nums) == 0:
    print(x)
    sys.exit()
index = nums.index(x)
ind = copy.deepcopy(index)
ans = 0
while True:
    if ind < 0:
        break
    if nums[ind] != x and  nums[ind+1] - nums[ind] > 2:
        ans = nums[ind+1] - 1
        break
    ind -= 1
ind = copy.deepcopy(index)
while True:
    if ind > n-1:
        break
    if nums[ind] != x and  nums[ind] - nums[ind-1] > 2:
        if abs(ans - x) > abs(nums[ind-1] + 1 - x):
            ans = nums[ind-1] + 1
            break
    ind += 1
print(ans)

### FIXED CODE ###

X, N = map(int, input().split())
P = list(map(int, input().split()))
Q = [q for q in range(-1, 102) if q not in P]
ans = min(Q, key=lambda q: (abs(q - X), q))
print(ans)
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
d=[]
for i in range(m):
  b,c=map(int,input().split())
  d.append([b,c])
d=sorted(d, key=lambda x: x[1], reverse=True)
i=0
j=d[0][1]
k=0
while a[i]<j and i<n:
  a[i]=j
  d[k][0]-=1
  if d[k][0]==0:
    k+=1
    if k==m:
      break
    else:
      j=d[k][1]
  i+=1
print(sum(a))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
d=[]
for i in range(m):
  b,c=map(int,input().split())
  d.append([b,c])
d=sorted(d, key=lambda x: x[1], reverse=True)
i=0
j=d[0][1]
k=0
while a[i]<j:
  a[i]=j
  d[k][0]-=1
  if d[k][0]==0:
    k+=1
    if k==m:
      break
    else:
      j=d[k][1]
  i+=1
  if i==n:
    break
print(sum(a))
S = input()
t = input()
cnt = 0

if s == t:
  print(0)
  exit()
else:
  for i in range(len(s)):
    if s[i] != t[i]:
      cnt += 1

print(cnt)

### FIXED CODE ###

S = input()
T = input()

ans = 0

for s, t in zip(S, T):
    ans += s != t
else:
	print(ans)
print len(str(int(raw_input())+int(raw_input())))

### FIXED CODE ###

try:
 for a in iter(raw_input,0):print len(str(sum(map(int,a.split()))))
except:pass
A, B = map(int, input().split())
if A >= 13:
    print(B)
elif A >= 6:
    print(B//2)
else:
    print(0)

### FIXED CODE ###

r, D, x = map(int, input().split())
for i in range(10):
    x = r*x - D
    print(x)
from collections import deque

def main():
    N = int(input())
    edges = [[] for _ in range(N-1)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        edges[a-1].append(b-1)
    
    K = max([len(g) for g in edges[1:]])
    K = max(K+1, len(edges[0]))
    init = [[node, i+1] for i, node in enumerate(edges[0])]
    que = deque(init)
    colors = set([i for i in range(1, K+1)])
    ans = [i for n, i in init]
    while que:
        node, color = que.popleft()
        if node >= N-1:
            continue

        next_nodes = edges[node]
        next_colors = list(colors - set([color]))
        
        for i in range(len(next_nodes)):
            ans.append(next_colors[i])
            que.append([next_nodes[i], next_colors[i]])

    print(K)
    print('\n'.join(list(map(str, ans))))

if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import deque

def main():
    N = int(input())
    path = [[] for _ in range(N)]
    ab = []
    ans = {}
    visited = [False] * N
    visited[0] = True
    for _ in range(N-1):
        a, b = map(int, input().split())
        path[a-1].append(b-1)
        path[b-1].append(a-1)
        # ab.append(str(a-1)+str(b-1))
        ab.append((a-1, b-1))
    
    que = deque([(0, 0)])
    while que:
        # k = 1
        k = 0
        pre, c = que.popleft()
        for next_node in path[pre]:
            if visited[next_node]:
                continue
            k += 1
            if c == k:
                k += 1
            visited[next_node] = True
            # ans[str(pre)+str(next_node)] = k
            ans[(pre, next_node)] = k
            que.append((next_node, k))
            

    print(max(ans.values()))
    for key in ab:
        print(ans[key])

if __name__ == '__main__':
    main()
import math
def main():
	A, B, H, M = map(float, input().split())
	R = H/12 + M*0.5/360
	r = M/60
	cos = math.cos((R-r*2*math.pi)
	C = math.sqrt(A^2 + B^2 - 2*A*B*cos)
	print(C)

if name == '__main__':
	main()

### FIXED CODE ###

import numpy as np
A, B, H, M = map(np.float32, input().split())

R = H/12 + M*0.5/360

r = M/60

Rad_c = np.cos((R-r)*2*np.pi)

C = np.sqrt(A*A + B*B -2*A*B*Rad_c)
print(C)
results=[]
while True:
    a=input().split("\"")
    if a[0]==".":
        break
    b=input().split("\"")
    count=0
    for i in range(len(a)):
        for k,l in zip(a[2*i],b[2*i]):
            if(k!=l):
                count+=1
    if count==0:
        results.append(0)
    elif count==1:
        results.append(1)
    else:
        results.append(2)
for i in results:
    if i==0:
        print("IDENTICAL")
    if i==1:
        print("CLOSE")
    if i==2:
        print("DIFFERENT")
    


### FIXED CODE ###

results=[]
while True:
    a=input().split("\"")
    if a[0]==".":
        break
    b=input().split("\"")
    count1=0
    count2=0
    if len(a) != len(b):
        results.append(2)
    else:
        for i in range(len(a)):
            if(i%2==1):
                if len(a[i]) != len(b[i]):
                    count1+=1
                else:
                    for k,l in zip(a[i],b[i]):
                        if(k!=l):
                            count1+=1
            else:
                if len(a[i]) != len(b[i]):
                    count2+=1
                else:
                    for k,l in zip(a[i],b[i]):
                        if(k!=l):
                            count2+=1           
        if count1==0 and count2==0:
            results.append(0)
        elif count1==1 and count2==0:
            results.append(1)
        else:
            results.append(2)
for i in results:
    if i==0:
        print("IDENTICAL")
    if i==1:
        print("CLOSE")
    if i==2:
        print("DIFFERENT")
l = map( int , raw_input().split())

s = l[0] * l[1]
r = l[0] * 2 + l[1] * 2

print s r

### FIXED CODE ###

l = map( int , raw_input().split())

s = l[0] * l[1]
r = ( l[0] + l[1] ) * 2

print s , r
import math

 

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

pair = {N:S,M:T}

def lcd(n,m):
    return int(m*n/math.gcd(n,m))
def prove(n,m):
    global pair
    mul = int(n/m)
    c = "".join([pair[n][mul*i] for i in range(len(pair[m]))])
#    print(c)
#    print(pair[m])
    if c== pair[m]:
        print (m)
    else:
        print (-1)
if max(N,M) % min(N,M) == 0:
    n = max(pair.keys())
    m = min(pair.keys())
    prove(n,m)
else:
    print(lcd(N,M))


### FIXED CODE ###

import math

 

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

pair = {N:S,M:T}


def lcd(n,m):
    return int(n * m / gcd(n,m))
def gcd(n,m):
    if n % m == 0:
        return m
    else:
        return gcd(m,n % m)
#    return int(m*n/math.gcd(n,m))
    
def prove(n,m):
    if gcd(n,m)==1:
        return lcd(n,m)
    global pair
    n_i = int(n/gcd(n,m))
    m_i = int(m/gcd(n,m))
    n_list = pair[n][::n_i]
    m_list = pair[m][::m_i]
#    print(c)
#    print(pair[m])
    if n_list[0:len(m_list)]==m_list:
        return lcd(n,m)
    else:
        return -1
n = max(pair.keys())
m = min(pair.keys())
if pair[N][0]!=pair[M][0]:
    print(-1)
elif N==M:
    if S==T:
        print(N)
    else:
        print(-1)
else:
    print(prove(n,m))
r,g,b=map(int,input().split())
if (((10*g)+b)%4) == 0 :print('YES')
  else:print('NO')

### FIXED CODE ###

r,g,b=input().split()
gb=g+b #str
if int(gb)%4 ==0:print('YES')
else:print('NO')
import sys
l=[t for t in sys.stdin]
i=0
while 1:
    pt=[i.find("1") for i in l[9*i:9*(i+1)] if i.find("1")!=-1]
    if not pt:break
    if len(pt)==1:print("C")
    elif len(pt)==2:
        if pt[0]==pt[1]:print("A")
        elif pt[0]<pt[1]:print("E")
        elif pr[0]>pt[1]:print("G")
    elif len(pt)==3:
        if pt[0]>pt[1]:print("D")
        elif pt[0]<pt[1]:print("F")
    else: print("B")
    i+=1



### FIXED CODE ###

t=[{(0,1),(1,0),(1,1)},
   {(1,0),(2,0),(3,0)},
   {(0,1),(0,2),(0,3)},
   {(1,-1),(1,0),(2,-1)},
   {(0,1),(1,1),(1,2)},
   {(1,0),(1,1),(2,1)},
   {(0,1),(1,-1),(1,0)}
]

while 1:
    l=[input() for _ in range(8)]
    pos=sorted([(i,j) for i in range(8) for j in range(8) if l[i][j]=="1"])
    cv=lambda v:tuple([v[0]-pos[0][0],v[1]-pos[0][1]])
    pt=set(map(cv,pos))
    [print(chr(65+i)) for (i,j) in enumerate(t) if pt&j==j]
    try:
        input()
    except:
        break
n = int(input())

aList = list(map(int, input().split()))

if 0 in aList:
  print(0)
else:
  for i in range(n):
    if i == 0:
      continue
    result = result * aList[i]

  enemy = 10 ** 18

  if result < enemy:
    print(result)
  else:
    print(-1)

### FIXED CODE ###

n = int(input())
 
aList = list(map(int,input().split()))
 
if 0 in aList:
  print(0)
else:
  result = 1
  for a in aList:
    result = result * a
    if result > 10 ** 18:
      result = -1
      break
  print(result)
import math
def unchi(x,m,n):
  r=x//m+x//n-x//(m*n//math.gcd(m,n))
  return r
a,b,c,d=(int(i) for i in input().split())
print(b-a+1-(unchi(b,c,d)-unchi(a-1,c,d)))

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def unchi(x,m,n):
  r=x//m+x//n-x//(m*n//(gcd(m,n)))
  return r
a,b,c,d=(int(i) for i in input().split())
print(b-a+1-(unchi(b,c,d)-unchi(a-1,c,d)))
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()

CB = []
for _ in range(M):
  b,c = map(int,input().split())
  CB.append([c,b])
CB.sort(reverse=True)

num = 0
ans = 0 
for c,b in CB:
  for bi in range(b):
    if num > N or c<=A[num]:
      break
    else:
      num += 1
      ans += c
  if num >= N: break
print(ans+sum(A[num:]) if num != N else ans)

### FIXED CODE ###

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

CB = []
for _ in range(M):
  b,c = map(int,input().split())
  CB.append([c,b])
CB.sort(reverse=True)

num = 0
ans = 0 
for c,b in CB:
  for bi in range(b):
    if num >= N: break
    if num > N or c<=A[num]:
      break
    else:
      num += 1
      ans += c
print(ans+sum(A[num:]) if num != N else ans)
r = int(input())
pi = 3.141592653589793
print("{:.7f} {:.7f}".format(r**2*pi, r*2*pi))

### FIXED CODE ###

r = float(input())
pi = 3.141592653589
print("{:.7f} {:.7f}".format(r**2*pi, r*2*pi))
n = int(input())
s = ineput()
mod = 998244353
ans = 1
z, o, t = n, 0, 0
pre = ["", ["", ""]]
for i in range(3*n):
  if t != 0 and s[i] not in pre[1]:
    ans *= t
    ans %= mod
    t -= 1
    if t == 0:
      pre[1] = ["", ""]
  elif s[i] == pre[0] or o == 0:
    o += 1
    ans *= z
    ans %= mod
    z -= 1
    pre[0] = s[i]
  else:
    t += 1
    ans *= o
    ans %= mod
    o -= 1
    pre[1] = [pre[0], s[i]]
    if o == 0:
      pre[0] = ""

print(ans)


### FIXED CODE ###

n = int(input())
s = input()
mod = 998244353
ans = 1
z, o, t = n, 0, 0
pre = ["", ["", ""]]
for i in range(3*n):
  if t != 0 and s[i] not in pre[1]:
    ans *= t
    ans %= mod
    t -= 1
    if t == 0:
      pre[1] = ["", ""]
  elif s[i] == pre[0] or o == 0:
    o += 1
    ans *= z
    ans %= mod
    z -= 1
    pre[0] = s[i]
  else:
    t += 1
    ans *= o
    ans %= mod
    o -= 1
    pre[1] = [pre[0], s[i]]
    if o == 0:
      pre[0] = ""

print(ans)
N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))

a.sort()
diff = a[-1] - a[-2]
if diff % 2 == 0:
    re = 'second'
else:
    re = 'first'
    
print(re)

### FIXED CODE ###

N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))
    if a[i] % 2 == 0:
        s += 1
        
if s == N:
    re = 'second'
else:
    re = 'first'
    
print(re)
def sum_digits(n):
  sum = 0
  while(n > 0):
    sum += n % 10
    n /= 10
  return sum
   

  
def main():
  n, a, b = map(int, input())
  for i in range(n+1):
    tmp = sum_digits(n)
    if (tmp >= a) & (tmp <= b):
      total += tmp
  print(total)

    
if __name__=="__main__":
  main()
    

### FIXED CODE ###

def sum_digits(n):
  sum_ = 0
  while(n > 0):
    sum_ += (n % 10)
    n = (n // 10)
  return sum_
   
 
  
def main():
  n, a, b = map(int, input().strip().split())
  total = 0
  for i in range(1, n+1):
    tmp = sum_digits(i)
    
    if (tmp >= a) & (tmp <= b):
      total += i
  print(total)
 
    
if __name__=="__main__":
  main()
lr = list(map(int, input().split()))
l = lr[0]
r = lr[1]
lmod = l%2019

if r - l >= 2019:
    print(0)
elif 2019 <= r - l + lmod:
    print(0)
else:ß
    print((lmod * (lmod + 1)) % 2019)


### FIXED CODE ###

import sys
lr = list(map(int, input().split()))
l = lr[0]
r = lr[1]
lmod = l%2019

def minfunc(x, y):
    if x > y:
        return y
    else:
        return x

if r - l >= 2019:
    print(0)
elif 2019 <= r - l + lmod:
    print(0)
else:
    min = 9999999
    modlist = list(map(lambda x: x%2019,range(l,r+1)))
    for i in range(r-l):
        for j in range(i+1, r-l+1):
            min = minfunc((modlist[i]*modlist[j])%2019,min)
    print(min)
import bisect

n = int(input())

a_list=[]
for i in range(n):
  a_list.append(int(input()))

ans_head=[a_list[-1]]

for i in range(n-2,-1,-1):
  a=a_list[i]
  if a>ans_head[-1]:
    ans_head.append(a)
  else:
    insert_index = bisect.bisect_right(ans_head,a)
    ans_head[insert_index]=a

  #print(ans_head)
print(len(ans_head))


### FIXED CODE ###

import bisect
n=int(input())
A=[]
for i in range(n):
  A.append(int(input()))
Ans=[A[-1]]
for i in reversed(range(n-1)):
  a=A[i]
  if a>=Ans[-1]:
    Ans.append(a)
  else:

    Ans[bisect.bisect_right(Ans,a)]=a

print(len(Ans))
a, b = [int(c) for c in input().split(' ')]
num = 0
bdash = b
if b == 1:
    num = 0
    bdash = -1
while bdash > 0:
    if bdash == a:
        num = num+1
        break
    elif bdash > a:
        num = num+1
        bdash = bdash - (a - 1)
    elif bdash < a:
        num = num + 1
        break
print(num)


### FIXED CODE ###

s = input()
t = input()
m = 0
for i in range(len(s)):
    if s[i] == t[i]:
        m+=1
print(m)
n, m = map(int, input().split())
INF = 10**10
d = [[INF]*n for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
nxt = [[[i] for i in range(n)] for _ in range(n)]
for k in range(n):
    for i in range(n):
        for j in range(n):
            if i==j:
                continue
            if d[i][k]+d[k][j] < d[i][j]:
                d[i][j] = d[i][k]+d[k][j]
                nxt[i][j] = nxt[i][k]
            elif d[i][k]+d[k][j] == d[i][j]:
                nxt[i][j].extend(nxt[i][k])
s = set()
for start in range(n):
    for goal in range(n):
        if start==goal:
            continue
        def DFS(i):
            for j in nxt[i][goal]:
                s.add((i, j))
                if j!=goal:
                    DFS(j)
        DFS(start)
print(m-len(s)//2)

### FIXED CODE ###

n, m = map(int, input().split())
INF = 10**10
d = [[INF]*n for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
nxt = [[[i] for i in range(n)] for _ in range(n)]
for k in range(n):
    for i in range(n):
        for j in range(n):
            if i==j:
                continue
            if d[i][k]+d[k][j] < d[i][j]:
                d[i][j] = d[i][k]+d[k][j]
                nxt[i][j] = nxt[i][k][:]
            elif d[i][k]+d[k][j] == d[i][j]:
                nxt[i][j] += nxt[i][k]
s = set()
for start in range(n):
    for goal in range(n):
        if start==goal:
            continue
        def DFS(i):
            for j in nxt[i][goal]:
                s.add((i, j))
                if j!=goal:
                    DFS(j)
        DFS(start)
print(m-len(s)//2)
import math

if __name__ == '__main__':

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

	print((a * b) // math.gcd(a,b))


### FIXED CODE ###

import fractions

if __name__ == '__main__':

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

	print((a * b) // fractions.gcd(a,b))
X, Y = [int(x) for x in stdin.readline().rstrip().split()]
if Y % 2 == 0:
    Z = Y / X
    if 2 <= Z <= 4:
        print('Yes')
else:
    print('No')

### FIXED CODE ###

from sys import stdin
X, Y = [int(x) for x in stdin.readline().rstrip().split()]
if Y % 2 == 0:
    Z = Y / X
    if 2 <= Z <= 4:
        print('Yes')
    else:
        print('No')
else:
    print('No')
a,b = map(int, raw_input().split())

if a > b:
    print "a > b"
if a < b:
    print "a < b"

a==b:
    print "a == b"

### FIXED CODE ###

a,b = map(int,raw_input().split())

if a < b:
    print ("a < b")
elif a > b:
    print ("a > b")
elif a == b:
    print ("a == b")
n=int(input())
a=[]
a=map(int,input().split())
ans=0
flag=0
changeflag=[]
changeflag.append(0)
for i in range(n-1):
    if a[i]==a[i+1]:
        if i==0:
            changeflag.append(1)
            ans+=1
        elif changeflag[i-1]==1:
            changeflag.append(0)
        else:
            ans+=1
            changeflag.append(1)
    else:
        changeflag.append(0)
print(ans)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
changeflag=[]
for i in range(n-1):
    if a[i]==a[i+1]:
        if i==0 or changeflag[i-1]==0:
            changeflag.append(1)
        else:
            changeflag.append(0)
    else:
        changeflag.append(0)
print(changeflag.count(1))
N = int(input())
i = int(input())

print u N-i+1

### FIXED CODE ###

n, i = map(int, input().split())
print(n - i + 1)