Harryxun/stf_run huggingface dataset:
import copy
N, K=map(int,input().split())
A=list(map(int,input().split()))
B=sorted([(a,abs(a)) for a in A],key=lambda x:x[1],reverse=True)
R=10**9+7
P=1
minus=0
last_neg=-1
last_pos=-1
for i in range(K):
    if B[i][0]>0:
        if last_pos != -1:
            P = (P * B[last_pos][1]) % R
        last_pos=i
    else:
        if last_neg != -1:
            P = (P * B[last_neg][1]) % R
        minus+=1
        last_neg=i
F=copy.copy(P)
if last_pos!=-1:
    F=(F*B[last_pos][1]) % R
if last_neg!=-1:
    F=(F*B[last_neg][1]) % R
if minus%2==1:
    if K == N:
        print(-F)
        exit()
    first_neg=-1
    first_pos=-1
    count=[0,0]
    for i in range(K,N):
        if count[0]==0 and B[i][0]>0:
            first_pos=i
            count[0]=1
        elif count[1]==0 and B[i][0]<0:
            first_neg=i
            count[1]=1
        elif count==[1,1]:
            break
    if first_pos==-1 and last_pos==-1:
        P = 1
        for i in range(K):
           P = (P * B[N - i - 1][0]) % R
        print(P)
        exit()
    list_product=[]
    if first_neg!=-1:
        list_product.append((P*B[last_neg][1]*B[first_neg][1]) %R)
    if first_pos!=-1:
        P1=(P*B[first_pos][1]) %R
        if last_pos!=-1:
            P1=(P1*B[last_pos][1]) %R
        list_product.append(P1)
    print(max(list_product))
else:
    print(F)


### FIXED CODE ###

import copy
N, K=map(int,input().split())
A=list(map(int,input().split()))
B=sorted([(a,abs(a)) for a in A],key=lambda x:x[1],reverse=True)
R=10**9+7
P=1
minus=0
last_neg=-1
last_pos=-1
for i in range(K):
    if B[i][0]>0:
        if last_pos != -1:
            P = (P * B[last_pos][1]) % R
        last_pos=i
    elif B[i][0]<0:
        if last_neg != -1:
            P = (P * B[last_neg][1]) % R
        minus+=1
        last_neg=i
    else:
        print(0)
        exit()
F=copy.copy(P)
if last_pos!=-1:
    F=(F*B[last_pos][1]) % R
if last_neg!=-1:
    F=(F*B[last_neg][1]) % R
if minus%2==1:
    if K == N:
        print(-F %R)
        exit()
    first_neg=-1
    first_pos=-1
    count=[0,0]
    for i in range(K,N):
        if count[0]==0 and B[i][0]>0:
            first_pos=i
            count[0]=1
        elif count[1]==0 and B[i][0]<0:
            first_neg=i
            count[1]=1
        elif count==[1,1]:
            break
    if first_pos==-1 and last_pos==-1:
        P = 1
        for i in range(K):
           P = (P * B[N - i - 1][0]) % R
        print(P)
        exit()
    if first_pos==-1 and first_neg==-1:
        print(0)
        exit()
    list_product=[]
    if first_neg!=-1 and last_pos!=-1:
        list_product.append(B[last_neg][1]*B[first_neg][1])
    if first_pos!=-1:
        P1=B[first_pos][1]
        if last_pos!=-1:
            P1=P1*B[last_pos][1]
        list_product.append(P1)
    print(max(list_product)*P %R)
else:
    print(F)
def solve():
    n, m = map(int, input().split())
    x = list(map(int, input().split()))
    x.sort()
    diff = [x[i + 1] - x[i] for i in range(m)]
    diff.sort(reverse=True)
    return sum(diff[n - 1:])


if __name__ == "__main__":
    print(solve())


### FIXED CODE ###

def solve():
    n, m = map(int, input().split())
    x = sorted(list(map(int, input().split())))
    diff = sorted([x[i + 1] - x[i] for i in range(m - 1)], reverse=True)
    return sum(diff[n - 1:])


if __name__ == "__main__":
    print(solve())
N=int(input())
A=list(map(int,input().split()))
if N%2==0:
    n1=0
    n2=0
    for i in range(N):
        if i%2==0:
            n1=n1+A[i]
        else:
            n2=n2+A[i]
    print(max(n1,n2))
else:
    #print(A[0],A[1])
    dp=[[-float("inf") for _ in range(3)] for _ in range(N+10)]
    if N==3:
        print(max(A[0],A[1],A[2]))
    else:
        for i in range(N):
            if i<4:
                if i==0:
                    dp[i][0]=A[0]
                if i==1:
                    dp[i][1]=A[0]
                    dp[i][0]=A[1]
                if i==2:
                    dp[i][2]=A[2]
                    dp[i][1]=A[1]
                    dp[i][0]=A[0]+A[2]
                if i==3:
                    dp[i][0]=dp[1][0]+A[3]
                    dp[i][1]=max(dp[1][1]+A[3],dp[0][0]+A[3])
                    dp[i][2]=max(dp[1][2]+A[3],dp[0][1]+A[3])
            else:
                for j in range(3):
                    if j==0:#ここでも2こずつ規則よく飛ばすと決めた
                        dp[i][0]=max(dp[i][0],dp[i-2][0]+A[i])
                    elif j==1:#1回だけ無茶した
                        dp[i][1]=max(dp[i][1],dp[i-2][1]+A[i],dp[i-3][0]+A[i])
                    else:
                        dp[i][2]=max(dp[i][2],dp[i-2][2]+A[i],dp[i-3][1]+A[i],dp[i-4][0]+A[i])
print(max(dp[N-1]))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
if N%2==0:
    dp=[[-float("inf") for _ in range(2)] for _ in range(N+10)]
    if N==2:
        print(max(A[0],A[1]))
    else:
        for i in range(N):
            if i==0:
                dp[i][0]=A[0]
            elif i==1:
                dp[i][1]=A[1]
            elif i==2:
                dp[i][0]=A[0]+A[2]
            else:
                for j in range(2):
                    if j==0:
                        dp[i][0]=max(dp[i][0],dp[i-2][0]+A[i])
                    elif j==1:
                        dp[i][1]=max(dp[i][1],dp[i-2][1]+A[i],dp[i-3][0]+A[i])
        print(max(dp[N-1]))
else:
    #print(A[0],A[1])
    dp=[[-float("inf") for _ in range(3)] for _ in range(N+10)]
    if N==3:
        print(max(A[0],A[1],A[2]))
    else:
        for i in range(N):
            if i<4:
                if i==0:
                    dp[i][0]=A[0]
                if i==1:
                    dp[i][1]=A[1]
                if i==2:
                    dp[i][2]=A[2]
                    dp[i][0]=A[0]+A[2]
                if i==3:
                    dp[i][1]=max(dp[1][1]+A[3],dp[0][0]+A[3])
            else:
                for j in range(3):
                    if j==0:#ここでも2こずつ規則よく飛ばすと決めた
                        dp[i][0]=max(dp[i][0],dp[i-2][0]+A[i])
                    elif j==1:#1回だけ無茶した
                        dp[i][1]=max(dp[i][1],dp[i-2][1]+A[i],dp[i-3][0]+A[i])
                    else:
                        dp[i][2]=max(dp[i][2],dp[i-2][2]+A[i],dp[i-3][1]+A[i],dp[i-4][0]+A[i])
        print(max(dp[N-1]))
N = int(input())
alphabet_lst = list('abcdefghijklmnopqrstuvwxyz')
#print(alphabet_lst)

keta = 0
keta_lst = []
while N>=sum(keta_lst):
    keta_lst.append(26**keta)
    keta += 1
    
keta -= 1
keta_lst = keta_lst[:keta]
#print(keta_lst)
#print(keta)

ans_lst = []
for i in range(keta):
    ans_n = N // keta_lst[-(i+1)]
    #print(ans_n)
    #print(keta_lst[-(i+1)])
    N -= ans_n*keta_lst[-(i+1)]
    ans_lst.append(alphabet_lst[ans_n-1])

for i in range(keta):
    print(ans_lst[i],end="")

### FIXED CODE ###

N = int(input())
alphabet_lst = list('abcdefghijklmnopqrstuvwxyz')
#print(alphabet_lst)

keta = 0
keta_lst = []
sum_lst = []
while N>=sum(keta_lst):
    keta_lst.append(26**keta)
    sum_keta = sum(keta_lst)
    sum_lst.append(sum_keta)
    keta += 1
    
keta -= 1
keta_lst = keta_lst[:keta]
#print(keta_lst)
#print(keta)

ans_lst = []
for i in range(keta):
    ans_n = (N - sum(keta_lst[:-(i+1)])) // keta_lst[-(i+1)]
    #print(ans_n)
    #print(keta_lst[-(i+1)])
    N -= ans_n*keta_lst[-(i+1)]
    ans_lst.append(alphabet_lst[ans_n-1])

for i in range(keta):
    print(ans_lst[i],end="")
n = int(input())
r = ((r//2) + (r%2))  / r
print(r)

### FIXED CODE ###

n = int(input())
r = ((n//2) + (n%2))  / n
print(r)
def lcs():
???x = raw_input()
  y = raw_input()
???x_len = len(x)
  y_len = len(y)
  z2 = [0 for i in range(y_len+1)]

???for i in range(x_len):
   z1 = z2 + []
   ele = x[i]
   for k in range(y_len):
      if ele == y[k]:
         z2[k+1] = z1[k] + 1
      elif z2[k+1] < z2[k]:???
?????????   z2[k+1] = z2[k]

  return z2[-1]

num = input()
for l in range(num):
  print lcs()

### FIXED CODE ###

def lcs():
  x = raw_input()
  y = raw_input()
  x_len = len(x)
  y_len = len(y)
  z2 = [0 for i in range(y_len+1)]

  for i in range(x_len):
    z1 = z2 + []
    ele = x[i]
    for k in range(y_len):
      if ele == y[k]:
        z2[k+1] = z1[k] + 1
      elif z2[k+1] < z2[k]:
        z2[k+1] = z2[k]

  return z2[-1]

num = input()
for j in range(num):
  print lcs()
import math

def cut(l,A,K):
    counter = 0
    i = N - 1
    while i >= 0:
        c = A[i] // l
        if c == 0:
            break
        else:
            counter += c
            i -= 1
    if counter <= K:
        return True
    else:
        return False
    
if __name__ == '__main__':
    N,K = map(int,input().split())
    A = [float(a) for a in input().split()]
    A.sort()
    left = 2
    right = math.ceil(A[-1])
    while left <= right:
        middle = (left + right) // 2
        if not cut(middle,A,K):
            left = middle + 1
        else:
            if not cut(middle-1,A,K):
                break
            else:
                right = middle - 1
    print(middle)

### FIXED CODE ###

import math

def cut(l,A,K):
    counter = 0
    i = N - 1
    if l == 0:
        return False
    while i >= 0:
        c = math.ceil(A[i] / l) - 1
        if c == 0:
            break
        else:
            counter += c
            i -= 1
    if counter <= K:
        return True
    else:
        return False
    
if __name__ == '__main__':
    N,K = map(int,input().split())
    A = [float(a) for a in input().split()]
    A.sort()
    left = 0
    right = math.ceil(A[-1])
    while left <= right:
        middle = (left + right) // 2
        if cut(middle,A,K):
            if not cut(middle-1,A,K):
                break
            else:
                right = middle - 1
        else:
            left = middle + 1
    print(middle)
N = int(input())
A = list(map(int, input().split()))
m = 0
ans = []
a = A.index(min(A))+1
b = A.index(max(A)+1)
for i in range(N-1,0,-1):
    while A[i] < A[i-1]:
        m += 1
        
        if abs(A[i]-min(A)) > abs(A[i]-max(A)):
            if min(A) > 0:
                A[i] += min(A)
                ans.append([a,i+1])
            else:
                A[i-1] += min(A)
                ans.append([a,i])

        else:
            if max(A) > 0:
                A[i] += max(A)
                ans.append([b,i+1])
            else:
                A[i-1] += max(A)
                ans.append([b,i])

print(m)
for x,y in ans:
    print(x, y)




### FIXED CODE ###

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

key = 0
for a in A:
    if abs(a) > abs(key):
        key = a
key_i = A.index(key)

m = 0
ans = []
if key > 0:
    for i in range(N):
        if A[i] < 0:
            m += 1
            A[i] += key
            ans.append([key_i+1, i+1])

    for i in range(1, N):
        if A[i-1] > A[i]:
            A[i] += A[i-1]
            m += 1
            ans.append([i, i+1])

    print(m)
    for x, y in ans:
        print(x, y)

elif key < 0:
    for i in range(N):
        if A[i] > 0:
            m += 1
            A[i] += key
            ans.append([key_i+1, i+1])

    for i in range(N-1, 0, -1):
        if A[i-1] > A[i]:
            A[i-1] += A[i]
            m += 1
            ans.append([i+1, i])

    print(m)
    for x, y in ans:
        print(x, y)

else:
    print(0)
A, V = map(int, input().split())
B, W = map(int, input().split())
T = float(input())
 
if abs(B - A)  <= T * (V - W):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input()
print(S[:3])
# -*- coding: utf-8 -*-
N, M = map(int, input().split())
A = []
B = []

for i in range(N):
    A.append(input())
for i in range(M):
    B.append(input())

for i in range(N):
    offset = 0
    while offset + M <= N:
        pos = A[i][offset:].find(B[0])        
        if -1 == pos:
            break
        offset += pos
        for j in range(1,M):
            if 0 != A[i+j][offset:].find(B[j]):
                offset += 1
                break
        else:
            print('Yes')
            exit()
else:
    print('No')


### FIXED CODE ###

# -*- coding: utf-8 -*-
N, M = map(int, input().split())
A = []
B = []

for i in range(N):
    A.append(input())
for i in range(M):
    B.append(input())

for i in range(N - M + 1):
    offset = 0
    while offset + M <= N:
        pos = A[i][offset:].find(B[0])        
        if -1 == pos:
            break
        offset += pos
        for j in range(1,M):
            if 0 != A[i+j][offset:].find(B[j]):
                offset += 1
                break
        else:
            print('Yes')
            exit()
else:
    print('No')
A,B,K = [int(i) for i in input().split()]
if (A>B):
    A,B=B,A
f=[]
j=A
for i in range(1,A):
    if (i>=j):
        break
    if (A % i == 0 and B % i == 0):
        j=int(A/i)
        f.append(i)
        if (B % j == 0):
            f.append(j)
f.sort()
if A==1:
    print(1)
else:
    print(f[K-1])




### FIXED CODE ###

A,B,K = [int(i) for i in input().split()]
if (A>B):
    A,B=B,A
k=0
for i in reversed(range(1,A+1)):
    if (A % i == 0 and B % i == 0):
        k+=1
    if (k==K):
        print(i)
        break
n = int(input())
a = list(map(int, input().split()))
a.sort()
a = a[::-1]


temp=0
z=0
for i in range((n+1)//2):
    for j in range(i+1,n):
        temp=comb(a[i],a[j])
        if z<temp:
            z=temp
            x,y=a[i],a[j]

def comb(m, r):
    if m-r<r:
        k=m-r
    else:
        k=r
    x=1
    for i in range(m,m-k,-1):
        x*=i
    for j in range(1,k+1):
        x/=j
    return int(x)
print(x, y)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort()
x,a = a[-1],a[:-1]
temp = []
for i in a:
    temp.append(abs(x/2-i))
y=a[temp.index(min(temp))]
print(x,y)
import copy

import math

def longgcd(S):
    if len(S)==2:
        return math.gcd(S[0],S[1])
    else:
        x=S[0]
        for i in range(0,N):
            x=math.gcd(x,S[i])
        return x

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

m=0

for i in range(0,N):
    B=copy.copy(A)
    B[i]=0
    x=longgcd(B)
    if x>m:
        m=x
print(m)


### FIXED CODE ###

def gcd(n,m):#n,mは正の整数、最大公約数　許容は？
    if n==0:
        return m
    elif m==0:
        return n
    elif n>m:
        n=n%m
        return gcd(n,m)
    else:
        m=m%n
        return gcd(n,m)

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

list1=[1 for i in range(0,N)]
list2=[1 for i in range(0,N)]
list1[0]=A[0]
list2[0]=A[N-1]

for i in range(1,N):
    list1[i]=gcd(list1[i-1],A[i])
    list2[i]=gcd(list2[i-1],A[N-1-i])
m=list2[N-2]
for i in range(0,N-2):
    test=gcd(list1[i],list2[N-3-i])
    if test>m:
        m=test
test=list1[N-2]
if test>m:
    m=test
print(m)
N = int(input())
a = [1,6,36,216,1296,7776,46656]
b = [1,9,81,729,6561,59049]
def six(n):
  i = 0
  if n < a[i]:
    return i-1
  else:
    i += 1
def nine(n):
  i = 0
  if n < b[i]:
    return i-1
  else:
    i += 1
def ans(n):
  if n in a or n in b:
    return 1
  else:
    return(min(six(n)+ans(n-6**six(n)),(nine(n)+ans(n-9**nine(n))
                                        
print(ans(44852))

### FIXED CODE ###

N = int(input())
def cn(X, n):
    if (int(X/n)):
        return cn(int(X/n), n)+str(X%n)
    return str(X%n)
def su(n):
  ans = 0
  for chara in n:
    ans += int(chara)
  return ans
lis = []
i = 0
while i <= N:
  lis.append(su(cn(i,6))+su(cn(N-i,9)))
  i += 1
print(min(lis))
primes=[2]
x = int(input())
if x == 2:
  print(x)
else:
  i = 3
  while True:
    for p in primes:
      if i % p == 0:
        break
    else:
      primes.append(i)
      if x <= i:
        break
    i+=1
  print(primes[-1])

### FIXED CODE ###

a, b = input().split()
print(b+a)
N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(M)]
Q = int(input())
vdc = [list(map(int, input().split())) for _ in range(Q)]

L = [[] for _ in range(N)]
for a, b in ab:
  a -= 1
  b -= 1
  L[a].append(b)
  L[b].append(a)

D = [[0] * 10 for _ in range(N)]
Ans = [0] * N

def check(v, d, c):
  if D[v][d] != 0: return
  if d == 0:
    D[v][d] = c
    return
  for i in range(d, -1, -1):
    if D[v][i] != 0: break
    D[v][i] = c
  for i in L[v]:
    pass

import queue
Que = queue.Queue
get = queue.Queue.get
put = queue.Queue.put
emp = queue.Queue.empty

for v, d, c in vdc[::-1]:
  v -= 1
  if D[v][d] != 0: continue
  t = (d << 18) + v
  S = Que()
  put(S, t)
  while not emp(S):
    t = get(S)
    dd = t >> 18
    vv = t & ((1 << 18) - 1)
    if Ans[vv] == 0: Ans[vv] = c
    if dd == 0:
      D[vv][dd] = c
      continue
    for i in range(dd, -1, -1):
      if D[vv][i] != 0: break
      D[vv][i] = c
    for i in L[vv]:
      if D[i][dd - 1] != 0: continue
      t = ((dd - 1) << 18) + i
      put(S, t)

for i in Ans:
  print(i)

### FIXED CODE ###

N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(M)]
Q = int(input())
vdc = [list(map(int, input().split())) for _ in range(Q)]

L = [[] for _ in range(N)]
for a, b in ab:
  a -= 1
  b -= 1
  L[a].append(b)
  L[b].append(a)

D = [[0] * 11 for _ in range(N)]
Ans = [0] * N

def check(v, d, c):
  if D[v][d] != 0: return
  if d == 0:
    D[v][d] = c
    return
  for i in range(d, -1, -1):
    if D[v][i] != 0: break
    D[v][i] = c
  for i in L[v]:
    pass

import queue
Que = queue.Queue
get = queue.Queue.get
put = queue.Queue.put
emp = queue.Queue.empty

for v, d, c in vdc[::-1]:
  v -= 1
  if D[v][d] != 0: continue
  t = (d << 18) + v
  S = Que()
  put(S, t)
  while not emp(S):
    t = get(S)
    dd = t >> 18
    vv = t & ((1 << 18) - 1)
    if Ans[vv] == 0: Ans[vv] = c
    if dd == 0:
      D[vv][dd] = c
      continue
    for i in range(dd, -1, -1):
      if D[vv][i] != 0: break
      D[vv][i] = c
    for i in L[vv]:
      if D[i][dd - 1] != 0: continue
      t = ((dd - 1) << 18) + i
      put(S, t)

for i in Ans:
  print(i)
print(int(input() ** 3)

### FIXED CODE ###

a = int(input())
print(a ** 3)
n=list(map(int, input().strip().split()))

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=int(n[a]+n[i])
            lis1.append(str(z))
           
print(min(lis1))



### FIXED CODE ###

try:
    n=list(map(int, input().strip().split()))
    lis1=[]
    for i in range(0,len(n)):
        for a in range(0,len(n)):
            if a!=i:
                z=(int(n[a])+int(n[i]))
                lis1.append(z)
            
    minscore='9999999999'
    for i in range(0,len(lis1)):
        if float(minscore)>float(lis1[i]):
            minscore=lis1[i]
    
    print(minscore)
    
except:
    print('')
r = input()
result = int(r*r)
print(result)

### FIXED CODE ###

r = input()
r = int(r)
result = r**2
print(result)
a = int(input())
if a[0]==a[3]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a = input()
if a[0]==a[2]:
  print("Yes")
else:
  print("No")
import numpy as np
N = int(input())
x = [int(i) for i in input().split() ]

each = 0
loss = 0
ll = []

for k in range(min(x), max(x)):
      for j in range(len(x)):
            each = np.power((x[j]-k), 2)
            loss += each
      ll.append(loss)
      loss = 0
  
print(min(ll))

### FIXED CODE ###

import numpy as np
N = int(input())
x = [int(i) for i in input().split() ]

each = 0
loss = 0
ll = []

for k in range(min(x), max(x)+1):
      for j in range(len(x)):
            each = np.power((x[j]-k), 2)
            loss += each
      ll.append(loss)
      loss = 0
  
print(min(ll))
A, B = map(int, input().split())
if A >= 13:
    print(B)
elif 6 <= A < 13:
    print(b/2)
else:
    print('0)

### FIXED CODE ###

Age, Full_cost= map(int, input().split())

if Age >= 13:
    print(Full_cost)
elif 6 <= Age <=12:
    print(int(Full_cost/2))
else:
    print(0)
a=0

while True:
    z=str(input())
    if z == 0 :
        break
    for i in z:
        k=int(i)
        a+=k
    print(a)
    a=0

### FIXED CODE ###

while True:
    z=list(map(int,(list(str(input())))))
    if z[0]==0:
        break
    print(sum(z))
N, M = [int(_) for _ in input().split()]
XYZ = [[int(_) for _ in input().split()] for _ in range(M)]

UF = list(range(N))


def find(x):
    if UF[x] != x:
        UF[x] = find(UF[x])
    return UF[x]


def unite(x, y):
    UF[find(x)] = find(y)


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


for x, y, z in XYZ:
    unite(x - 1, y - 1)
for i in range(N):
    find(i)
print(len(set(UF)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
N, M = [int(_) for _ in input().split()]
XYZ = [[int(_) for _ in input().split()] for _ in range(M)]

UF = list(range(N + 1))


def find(x):
    if UF[x] != x:
        UF[x] = find(UF[x])
    return UF[x]


def unite(x, y):
    UF[find(x)] = find(y)


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


for x, y, z in XYZ:
    unite(x, y)
s = set()
for i in range(1, N + 1):
    s.add(find(i))
print(len(set(s)))
N=int(input())
li = [list(map(int,input().split())) for i in range(N)]

def solve(li):
    for i in range(101):
        for j in range(101):
            flag=1
            Cx,Cy=i,j
            H_prev=li[0][2]+abs(li[0][0]-Cx)+abs(li[0][1]-Cy)
            for k in li:
                H=k[2]+abs(k[0]-Cx)+abs(k[1]-Cy)
                if H_prev != H:
                    flag=0
                    break
                H_prev=H
            if flag==1 and H>=1:
                A=[i,j,H]
                return A
A=solve(li)
print(' '.join(map(str,A)))

### FIXED CODE ###

n=int(input())
p=[list(map(int,input().split()))for _ in range(n)] #[ax,ay,ah]をひとつの要素とする二重リスト
ax,ay,ah=list(filter(lambda x:x[2],p))[0] #x[2]がTrue、つまりahが0以外のリストの先頭の要素を取得
for x in range(101):
    for y in range(101):
        H=ah+abs(ax-x)+abs(ay-y) #Hの予測値
        if all([max(H-abs(t[0]-x)-abs(t[1]-y),0)==t[2]for t in p]): #ahのリストを生成し、予測したHから正しいかどうか判定
            print(x,y,H)
li = int(input().split())
list = []
list.append(li[2])
list.append(li[0])
list.append(li[1])
print(list)

### FIXED CODE ###

x,y,z = map(int,input().split())
print(z, x, y)
a,b,c,k = map(int, input().split())




cards = [1]*a + [0]*b + [-1]*c
res = 0
for i,card in enumerate(cards):
    if i == k: break
    else:res += card

print(res)
    

### FIXED CODE ###

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


if a>= k:
    print(k)
elif a+b>=k and k>a:
    print(a)
else:
    print(a-(k-a-b))
def PrimeNumber(N):
    if N==2:
        ans=[2]
        return ans
    ans = list(range(2, N + 1))
    i = 0
    while ans[i] < N ** 0.5 + 1:
        j = 2
        temp = ans[i]
        while temp * j <= ans[-1]:
            if temp * j in ans:
                ans.remove(temp * j)
            j += 1
        i += 1
    return ans

def div(N):
    ans = []
    for i in range(1, int(N ** 0.5) + 1):
        if N % i == 0:
            ans.append(i)
            if N // i != i:
                ans.append(N // i)
    ans.sort()
    return ans


import fractions

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

g=fractions.gcd(A,B)

if g==1:
    print(1)
    exit()

d_list=[]
d_list=div(g)
PN=[1]
PN.extend(PrimeNumber(g))

cnt=0
for i in d_list:
    if i in PN:
        cnt+=1

print(cnt)








### FIXED CODE ###

def div(N):
    ans = []
    for i in range(1, int(N ** 0.5) + 1):
        if N % i == 0:
            ans.append(i)
            if N // i != i:
                ans.append(N // i)
    ans.sort()
    return ans
import fractions

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

g=fractions.gcd(A,B)

if g==1:
    print(1)
    exit()
cnt=0
di=div(g)

for i in di:
    f=True
    for j in range(2,int(i**0.5)+1):
        if i%j==0:
            f=False
            break
    if f:
        cnt+=1
print(cnt)
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
list = []

for i in range(n):
    list.append(s.count(t[i]))

ans = 1

for i in range(len(list)):
    ans *= (list[i]+1)

print(ans-1)

### FIXED CODE ###

n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(26):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))
import numpy as np
N, K = map(int, input().split())
N_lis=np.zeros(N)
for i in range(K):
  d=int(input())
  sweet=np.array(map(int, input().split()))
  sweet-=1
  for j in sweet:
    N_lis[j]+=1
 
no_sweet=N_lis[N_lis==0]
print(no_sweet.sum())

### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
N_lis=np.zeros(N)
for i in range(K):
    d=int(input())
    sweet=np.array(list(map(int, input().split())))
    #print(sweet)
    sweet-=1
    for j in sweet:
        N_lis[j]+=1
#print(N_lis)
no_sweet=N_lis==0
#print(no_sweet)
print(no_sweet.sum())