Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

string=list(input())
Q=int(input())
def func1(s):
    s.reverse()
    return s
def func2(s,F,C):
    if F=="1":
        s.insert(0,C)
        #return s
    if F=="2":
        s.append(C)
        #return s

            
for i in range(Q):
    Input=list(map(str,input().split()))
    if Input[0]=='1':
        func1(string)
        
    elif Input[0]=='2':
        func2(string,Input[1],Input[2])
for i in string:
    print(i,end="")

### FIXED CODE ###

S = str(input())
Q = int(input())
 
hanten = 0
front = ""
end = ""
 
for i in range(Q):
    query=list(map(str,input().split()))
    if query[0]=="1":
        hanten+=1
        hanten=hanten%2
    else:
        if query[1]=="1":
            if hanten==0:
                front=query[2]+front
            else:
                end=end+query[2]
        else:
            if hanten==0:
                end=end+query[2]
            else:
                front=query[2]+front
ans=front+S+end
if hanten==1:
    ans=ans[::-1]
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

k = [0] * 60

for j in range(60):
    l = [i >> j & 1 for i in a]
    for m in l:
        k[j] += m

ans = 0
c = 0
for d in k:
    ans += (d * (n - d) * 2**c)  % (10**9 + 7)
    c += 1
    
print(ans % (10**9 + 7))

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import numpy as np

n = int(input())
a = np.array([int(i) for i in input().split()])

k = [0] * 60

for j in range(60):
    l = a & 1
    k[j] = np.count_nonzero(l)
    a >>= 1

ans = 0
c = 0
for d in k:
    ans += (d * (n - d) * 2**c)  % (10**9 + 7)
    c += 1
    
print(ans % (10**9 + 7))
### BUGGY CODE ###

n=int(input())
s=input()
ans=0
for j in range(1,n-1):
  for i in range(j):
    for k in range(j+1,n):
      if j-i==k-j:
        continue
      if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
        ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
r,g,b=0,0,0
for i in range(n):
    if s[i]=="R":
        r+=1
    elif s[i]=="G":
        g+=1
    else:
        b+=1
chohuku=0
double=0
for i in range(1,n-1):
    for j in range(1,min(i+1,n-i)):
        chohuku+=1
        k=j+i
        l=i-j
        if s[i]!=s[k] and s[i]!=s[l] and s[l]!=s[k]:
            double+=1
ans=r*g*b-double
print(ans)
### BUGGY CODE ###

def main():
    n = int(input())
    a = [int(an) for an in input().split()]
    divider = 10 ** 9 + 7
    ans = 0
    for i in range(n - 1):
        ans = (ans + a[i] * sum(a[i + 1: n])) % divider
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    a = [int(an) for an in input().split()]
    divider = 10 ** 9 + 7
    ans = 0
    total = sum(a)
    tmp = 0
    for i in range(n - 1):
        ai = a[i]
        tmp += ai
        ans = (ans + a[i] * (total - tmp)) % divider
    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

S = input()
Q = int(input())
for i in range(Q):
    list = input().split(' ')
    if list[0] == '1':
        S = S[::-1]
    elif list[1] == '1':
        S = list[2]+S
    elif list[1] == '2':
        S = S+list[2]
print(S)

### FIXED CODE ###

from collections import deque
S = deque()
S.extend(input())
Q = int(input())
reverse = 0
for i in range(Q):
    list = input().split(' ')
    if list[0] == '1':
        reverse += 1
    elif list[1] == '1':
        if reverse % 2 == 1:
            S.append(list[2])
        else:
            S.appendleft(list[2])
    elif list[1] == '2':
        if reverse % 2 == 1:
            S.appendleft(list[2])
        else:
            S.append(list[2])
if reverse % 2 == 1:
    S.reverse()
ans = ''.join(S)
print(ans)
### BUGGY CODE ###

#all you can eat

N, T = map(int, input().split())
food = [tuple(map(int, input().split())) for i in range(N)]

dp = [[0]*(3010) for i in range(3010)]

for i in range(N):
    time, value = food[i]
    for j in range(T):
        if j >= time:
            dp[i+1][j] = max(dp[i][j], dp[i][j-time] + value)
        else:
            dp[i+1][j] = dp[i][j]
        dp[i][j] = max(dp[i][j], dp[i][j-1])

rev_dp = [[0]*(3010) for i in range(3010)]
food.reverse()

for i in range(N):
    time, value = food[i]
    for j in range(T):
        if j >= time:
            rev_dp[i+1][j] = max(rev_dp[i][j], rev_dp[i][j-time] + value)
        else:
            rev_dp[i+1][j] = rev_dp[i][j]
    dp[i][j] = max(dp[i][j], dp[i][j-1])


ans = 0
for x in range(N):
    ans = max(ans, max(dp[N-1-x][t] + rev_dp[x][T-1-t]
                       for t in range(T))+food[x][1])
print(ans)



### FIXED CODE ###

#all you can eat

N, T = map(int, input().split())
food = [tuple(map(int, input().split())) for i in range(N)]

dp = [[0]*(3010) for i in range(3010)]

for i in range(N):
    time, value = food[i]
    for j in range(T):
        if j >= time:
            dp[i+1][j] = max(dp[i][j], dp[i][j-time] + value)
        else:
            dp[i+1][j] = dp[i][j]
        dp[i][j] = max(dp[i][j], dp[i][j-1])

rev_dp = [[0]*(3010) for i in range(3010)]
food.reverse()

for i in range(N):
    time, value = food[i]
    for j in range(T):
        if j >= time:
            rev_dp[i+1][j] = max(rev_dp[i][j], rev_dp[i][j-time] + value)
        else:
            rev_dp[i+1][j] = rev_dp[i][j]
    dp[i][j] = max(dp[i][j], dp[i][j-1])


ans = 0
for x in range(N):
    ans = max(ans, max(dp[N-1-x][t] + rev_dp[x][T-1-t]
                       for t in range(T))+food[x][1])
print(ans)
### BUGGY CODE ###

#!/usr/bin/python3
# -*- coding: utf-8 -*-
from bisect import bisect_left
from sys import stdin



def main():
  ## input
  N,Q = map(int, stdin.readline().rstrip().split())
  STX = [[0,0,0] for _ in range(N)]
  for i in range(N):
    s,t,x = map(int, stdin.readline().rstrip().split())
    STX[i] = [x,s-x,t-x]
  Dn = [int(stdin.readline().rstrip()) for _ in range(Q)] + [10**10]*2
  ans = {}

  for x,s,t in sorted(STX):
    l = bisect_left(Dn,s)
    while Dn[l] < t:
      ans[Dn[l]] = x
      Dn = Dn[:l] + Dn[l+1:]

  for d in Dn[:-2]:
    ans[d] = -1

  return ans


if __name__ == "__main__":
  ans = main()
  for d in sorted(list(ans.keys())):
    print(ans[d])
    


### FIXED CODE ###

import sys
from bisect import bisect_left



N,Q = map(int, input().split())
lines = sys.stdin.readlines()
kkk = []
for line in lines[:N]:
  s, t, x = map(int, line.split())
  kkk.append((x, s, t))
kkk.sort()
ddd = list(map(int, lines[N:]))

ans = [-1] * Q
skip = [-1] * Q
for x, s, t in kkk:
  ss = bisect_left(ddd, s - x)
  tt = bisect_left(ddd, t - x)
  while ss < tt:
    sk = skip[ss]
    if sk == -1:
      ans[ss] = x
      skip[ss] = tt
      ss += 1
    else:
      ss = sk

print('\n'.join(map(str, ans)))
### BUGGY CODE ###

s=input()
li=list(input())

min = 1000000000

for index, i in enumerate(li):
  a = 0
  
  left = li[0:index]
  right = li[index + 1:]
  
  w1 = left.count('W')
  s1 = right.count('E')

  a = w1 + s1
    
  if min > a:
    min = a
    
print(min)

### FIXED CODE ###

from itertools import accumulate
 
n = int(input())
s = [c == 'W' for c in input()]
l = accumulate([0] + s[:-1])
r = accumulate([0] + [not c for c in reversed(s[1:])])
print(min(e + w for e, w in zip(l, reversed(list(r)))))
### BUGGY CODE ###

def func(i):
    if i == 0:
        return 2
    elif i == 1:
        return 1
    else:
        return func(i-1)+func(i-2)

n = int(input())
print(func(n))

### FIXED CODE ###

n = int(input())
L = [0 for _ in range(n+2)]
L[0]=2
L[1]=1
if n >= 2:
    for i in range(2,n+1):
        L[i] = L[i-1]+L[i-2]
print(L[n])
### BUGGY CODE ###

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

t=list()
for i in range(x):
  for j in range(y):
    t.append(a[i]+b[j])

s=list()
t.sort(reverse=True)
for i in range(min(k,x*y)):
  for j in range(z):
    s.append(t[i]+c[j])

s.sort(reverse=True)

for i in range(k):
  print(s[i])


### FIXED CODE ###

x,y,z,k=map(int,input().split())
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

s=list()

for l in range(x):
  if l>k:
    break 
  for m in range(y):
    if l*m>k:
      break
    for n in range(z):
      if l*m*n>k:
        break
      s.append(a[l]+b[m]+c[n])
 
s.sort(reverse=True)
for i in range(k):
  print(s[i])
### BUGGY CODE ###

H, W = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
M = 6401


D = [[0] * W for _ in range(H)]
for i in range(H):
  for j in range(W):
    D[i][j] = abs(B[i][j] - A[i][j])

DP = [[[0] * M for _ in range(W)] for _ in range(H)]

def nasu(t):
  if t >= 0 and t < M:
    return True
  else:
    return False

DP[0][0][D[0][0]] = 1
for i in range(H + W):
  for j in range(H):
    if i - j >= W: continue
    x = i - j
    y = j
    if x < 0: continue
    if x - 1 >= 0:
      for k in range(M):
        if DP[y][x - 1][k] == 1:
          t = k + D[y][x]
          if nasu(t):
            DP[y][x][t] = 1
          t = abs(k - D[y][x])
          if nasu(t):
            DP[y][x][t] = 1
    if y - 1 >= 0:
      for k in range(M):
        if DP[y - 1][x][k] == 1:
          t = k + D[y][x]
          if nasu(t):
            DP[y][x][t] = 1
          t = abs(k - D[y][x])
          if nasu(t):
            DP[y][x][t] = 1

for i in range(M):
  if DP[-1][-1][i] == 1:
    print(i)
    break

### FIXED CODE ###

H, W = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
M = 6401

def honya(y, d):
  t = (1 << d + 1) - 1
  t = y & t
  k = 0
  for i in range(d):
    k += t & 1
    t >>= 1
    k <<= 1
  return k

D = [[0] * W for _ in range(H)]
for i in range(H):
  for j in range(W):
    D[i][j] = abs(B[i][j] - A[i][j])

DP = [[0] * W for _ in range(H)]

def nasu(x, y, d):
  t = (1 << (d + 1)) - 1 & y
  return (x | (y << d) | (y >> d) | honya(y, d)) & mask
  

mask = (1 << M) - 1
DP[0][0] = 1 << D[0][0]
for i in range(H):
  for j in range(W):
    if i + 1 < H:
      DP[i + 1][j] = nasu(DP[i + 1][j], DP[i][j], D[i + 1][j])
    if j + 1 < W:
      DP[i][j + 1] = nasu(DP[i][j + 1], DP[i][j], D[i][j + 1])

t = DP[-1][-1]
for i in range(M):
  if t & 1:
    print(i)
    break
  t >>= 1
### BUGGY CODE ###

#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit
from itertools import combinations


def count(n, s):
    count = 0
    for a in combinations(range(101), n):
        if sum(a) == s:
            count += 1
    return count


def main(readline=stdin.readline):
    for line in stdin:
        n, s = (int(s) for s in line.split())
        if not n and not s:
            exit()
        print(count(n, s))


if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit


def make_number_of_combination():
    pre = [[0] * 10 for _ in xrange(1001)]
    now = [[0] * 10 for _ in xrange(1001)]

    for a in xrange(101):
        now[a][0] = 1
        for i in xrange(1001):
            if i+a > 1000:
                break
            for j in xrange(9):
                now[i+a][j+1] += pre[i][j]

        for i in xrange(1001):
            for j in xrange(10):
                pre[i][j] = now[i][j]

    return pre


def main():
    ans = make_number_of_combination()
    for line in stdin:
        n, s = (int(s) for s in line.split())
        if not n and not s:
            exit()
        print(ans[s][n-1])


if __name__ == '__main__':
    main()
### BUGGY CODE ###

#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    n, k = MI()
    scores = LI()

    score_now = 1

    for i in range(k):
        score_now *= scores[i]

    for i in range(k, n):
        next_score = score_now * (scores[i] / scores[i - k])
        print("Yes" if next_score > score_now else "No")


main()


### FIXED CODE ###

#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    n, k = MI()
    scores = LI()

    score_now = 1

    for i in range(k, n):
        next_score = scores[i] / scores[i - k]
        print("Yes" if next_score > 1 else "No")


main()
### BUGGY CODE ###

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

idx = sorted(range(N), key=lambda k: H[k], reverse=True)

ans = 0
for i in idx:
  count = 0
  if i != N-1:
    for j in range(i, N-1):
      if H[j] >= H[j+1]:
        count += 1
      else:
        break
    ans = max(ans, count)

print(ans)

### FIXED CODE ###

N = int(input())
H = list(map(lambda x:int(x), input().split()))
count = 0
ans = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count = 0
  ans = max(ans, count)

print(ans)
### BUGGY CODE ###

n, y = map(int, input().split())

a = 0
b = 0
c = n
ans = c * 1000

while ans < y:
    if y - ans >= 9000:
        tmp = (y - ans) // 9000
        a += tmp
        c -= tmp
    elif y - ans >= 4000:
        tmp = (y - ans) // 4000
        b += tmp
        c -= tmp
    ans = a * 10000 + b * 5000 + c * 1000

if ans != y:
    a = b = c = -1

print(a, b, c)


### FIXED CODE ###

n, y = map(int, input().split())

a, b, c = (-1, -1, -1)
for i in range(n + 1):
  for j in range(n + 1 - i):
    k = n - (i + j)
    if 10000 * i + 5000 * j + 1000 * k == y:
      a, b, c = (i, j, k)
      break
print(a, b, c)
### BUGGY CODE ###

import sys
import math

for line in sys.stdin:
	a,b=map(int,line.split())
	if(a==1 or b==1):
		print(1)
	elif(a*b%2==0):
		print(int(a*b/2))
	else:
		count = 0
		for i in range(a):
			if(i%2==0):
				count+=math.ceil(b/2)
			else:
				count+=math.floor(b/2)
		print(count)

### FIXED CODE ###

import sys
import math

for line in sys.stdin:
	a,b=map(int,line.split())
	if(a==1 or b==1):
		print(1)
	elif(a*b%2==0):
		print(int(a*b/2))
	else:
		print(math.ceil(a*b/2))
### BUGGY CODE ###

import itertools

x,y = map(int,input().rstrip().split())


kk = [ i for i in itertools.product(range(1,x+1), repeat=3) if (i[0]+i[1])%y == 0 and (i[1]+i[2])%y == 0 and (i[2]+i[0])%y == 0]

print(len(kk))

### FIXED CODE ###

N, K = map(int, input().split())
 
count1 = 0
count2 = 0
for a in range(1,N+1):
    if a%K == 0:
        count1 += 1
if K%2 == 0:
    for a in range(1,N+1):
        if a%K == K//2:
            count2 += 1
print(count1**3 + count2**3)
### BUGGY CODE ###

import sys
from collections import defaultdict
sys.setrecursionlimit(1000000)

N = int(input())
edges = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = map(int, input().split())

graph = defaultdict(set)
for v, w, c in edges:
    graph[v].add((w, c))
    graph[w].add((v, c))

INF = 10 ** 9 + 7
dp = [INF] * (N + 1)
visited = [False] * (N + 1)

def dfs(v, p, d):    
    dp[v] = d
    visited[v] = True
    for j, c in graph[v]:
        if j == p or visited[j]:
            continue
        dfs(j, v, d + c)

dfs(K, 0, 0)

for _ in range(Q):
    x, y = map(int, input().split())
    print(dp[x] + dp[y])


### FIXED CODE ###

from collections import defaultdict
from heapq import heappop, heappush

N = int(input())
edges = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = map(int, input().split())

graph = defaultdict(set)
for v, w, c in edges:
    graph[v].add((w, c))
    graph[w].add((v, c))

dp = [-1] * (N + 1)
pq = []

# Initialization
dp[K] = 0
heappush(pq, (0, K))

while pq:
    cost, u = heappop(pq)
    
    for w, c in graph[u]:
        if dp[w] > -1:
            continue

        dp[w] = dp[u] + c
        heappush(pq, (dp[w], w))

for _ in range(Q):
    x, y = map(int, input().split())
    print(dp[x] + dp[y])
### BUGGY CODE ###

n = int(input())
s = [list(ord(e) - ord("a") for e in input()) for _ in range(n)]

ans = 0
for b in range(n):
    t = [[-1] * n for _ in range(n)]
    for hi in range(n):
        for wi in range(n):
            nh = hi
            nw = (wi + b) % n
            t[nh][nw] = s[hi][wi]

    bl = True
    for i in range(n):
        for j in range(n):
            if t[i][j] != t[j][i]:
                bl = False

    ans += bl

ans *= n
print(ans)


### FIXED CODE ###

n = int(input())
s = [list(ord(e) - ord("a") for e in input()) for _ in range(n)]

ans = 0
for b in range(n):
    t = [[-1] * n for _ in range(n)]
    for hi in range(n):
        for wi in range(n):
            nh = hi
            nw = (wi + b) % n
            t[nh][nw] = s[hi][wi]

    bl = True
    for i in range(n):
        for j in range(n):
            if t[i][j] != t[j][i]:
                bl = False

    ans += bl

ans *= n
print(ans)
### BUGGY CODE ###

N,K=map(int,input().split())
H=list(map(int,input().split()))
dp=[0 for i in range(N)]
def calcmin(n,d):
  p=dp[n-d]+abs(H[n-d]-H[n])
  for q in range(d):
    if p>dp[n-(d-q)]+abs(H[n-(d-q)]-H[n]):
      p=dp[n-(d-q)]+abs(H[n-(d-q)]-H[n])
  return p
for i in range(min(K,N)):
  dp[i]=dp[0]+abs(H[0]-H[i])
  for j in range(i-1):
    if dp[i]>dp[j]+abs(H[j]-H[i]):
      dp[i]=dp[j]+abs(H[j]-H[i])
for i in range(K,N):
  dp[i]=calcmin(i,K)
print(dp[N-1]) 

### FIXED CODE ###

N,K=map(int,input().split())
H=list(map(int,input().split()))
dp=[0 for i in range(N)]
def calcmin(n,d):#インデックスがnのノードまでいくための最小コスト（最大移動距離はd）
  p=dp[n-d]+abs(H[n-d]-H[n])
  for q in range(d):
    if p>dp[n-(d-q)]+abs(H[n-(d-q)]-H[n]):
      p=dp[n-(d-q)]+abs(H[n-(d-q)]-H[n])
  return p
for i in range(min(K,N)):
  dp[i]=calcmin(i,i)
for i in range(K,N):
  dp[i]=calcmin(i,K)
print(dp[N-1])
### BUGGY CODE ###

import numpy

tmp=input()
list=input().split(" ")
list=[int(x) for x in list]
array=numpy.array(list,dtype=">i4")
#for i in range(len(list)):
#  array[i]=int(list[i])

a=int(input())#-1

for i in range(a):
  b=input().split(" ")
  array=numpy.where(array==int(b[0]),int(b[1]),array)
  sum=numpy.sum(array)
  print(sum)

### FIXED CODE ###

import numpy

tmp=input()
list=input().split(" ")
list=[int(x) for x in list]
array=numpy.array(list,dtype=">i4")
sum=numpy.sum(array)
all=numpy.zeros(100001,dtype=">i4")
for i in array:
  all[i]+=1
#for i in range(len(list)):
#  array[i]=int(list[i])

a=int(input())

for i in range(a):
  b=input().split(" ")
  b0=int(b[0])
  b1=int(b[1])
  diff=all[b0]*(b1-b0)
  sum+=diff
  all[b1]+=all[b0]
  all[b0]=0
  print(sum)
### BUGGY CODE ###

# -*- coding utf-8 -*-
import copy

MOD = 10 ** 9 + 7

n = int(input())

graph = [[-1] * n for _ in range(n)]
for _ in range(n - 1):
    u, v, w = map(int, input().split())
    graph[u - 1][v - 1] = w
    graph[v - 1][u - 1] = w

dist = [-1] * n
dist[0] = 0
que = [0]
while len(que) != 0:
    i = que.pop()
    for j in range(n):
        if dist[j] == -1 and graph[i][j] != -1:
            dist[j] = dist[i] + graph[i][j]
            que.append(j)

for d in dist:
    print(d % 2)



### FIXED CODE ###

# -*- coding utf-8 -*-

MOD = 10 ** 9 + 7

n = int(input())

graph = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v, w = map(int, input().split())
    graph[u - 1].append((v - 1, w))
    graph[v - 1].append((u - 1, w))

dist = [-1] * n
dist[0] = 0
que = [0]
while len(que) != 0:
    i = que.pop()
    for j, w in graph[i]:
        if dist[j] == -1:
            dist[j] = dist[i] + w
            que.append(j)

for d in dist:
    print(d % 2)
### BUGGY CODE ###

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N = i()
S = [l() for _ in range(N)]
ans = 0
for _ in range(N):
    pq = []
    for i in S:
        for j in S:
            if i == j:
                continue
            pq.append((i[0]-j[0],i[1]-j[1]))
    for p,q in set(pq):
        cnt = 0
        for i in S:
            for j in S:
                if i == j:
                    continue
                if (i[0]-j[0],i[1]-j[1]) == (p,q):
                    cnt += 1
        ans = max(ans,cnt)
print(N-ans)


### FIXED CODE ###

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N = i()
S = [l() for _ in range(N)]
ans = 0
pq = []
for i in S:
    for j in S:
        if i == j:
            continue
        pq.append((i[0]-j[0],i[1]-j[1]))
for p,q in set(pq):
    cnt = 0
    for i in S:
        for j in S:
            if i == j:
                continue
            if (i[0]-j[0],i[1]-j[1]) == (p,q):
                cnt += 1
    ans = max(ans,cnt)
print(N-ans)
### BUGGY CODE ###

n = int(input())
data = list(map(int, input().split()))
 
a = 1
i = 0
while i<n:
  a = a*data[i]
  i += 1

if a > 10**18:
  a = -1
    # break
 
print(a)

### FIXED CODE ###

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

flag = 0
if data.count(0) > 0:
	print(0)
else:
  a = data[0]
  for i in range(1,n):
    a = a*data[i]
    if a > 10**18:
      flag = 1
      break
      
  if flag == 1:
    print('-1')
  else:
    print(a)
### BUGGY CODE ###

import sys
input=sys.stdin.readline

H,W = map(int, input().split())

b = [[True]*(W+2)]
for i in range(H):
    b.append([True] + [x == '#' for x in input().strip()] + [True])
b.append([True]*(W+2))

check = []
for i in range(1,H+1):
    for j in range(1,W+1):
        if b[i][j]:
            check.append((i,j))
t = 0
while check:
    tmp = []
    for i,j in check:
        if not b[i-1][j]:
            b[i-1][j] = True
            tmp.append((i-1,j))
        if not b[i][j-1]:
            b[i][j-1] = True
            tmp.append((i,j-1))
        if not b[i][j+1]:
            b[i][j+1] = True
            tmp.append((i,j+1))
        if not b[i+1][j]:
            b[i+1][j] = True
            tmp.append((i+1,j))
    check = tmp
    t += 1

print(t-1)


### FIXED CODE ###

import sys
input=sys.stdin.readline
H,W = map(int, input().split())

b = [[True]*(W+2)]
for _ in range(H):
    b.append([True] + [x == '#' for x in input().strip()] + [True])
b.append([True]*(W+2))

check = []
for i in range(1,H+1):
    for j in range(1,W+1):
        if b[i][j]:
            check.append((i,j))
t = 0
while check:
    tmp = []
    for i,j in check:
        if not b[i-1][j]:
            b[i-1][j] = True
            tmp.append((i-1,j))
        if not b[i][j-1]:
            b[i][j-1] = True
            tmp.append((i,j-1))
        if not b[i][j+1]:
            b[i][j+1] = True
            tmp.append((i,j+1))
        if not b[i+1][j]:
            b[i+1][j] = True
            tmp.append((i+1,j))
    check = tmp
    t += 1

print(t-1)
### BUGGY CODE ###

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

min_diff = abs(sum(a_list[:1]) - sum(a_list[1:]))
for i in range(2, N):
    diff = abs(sum(a_list[:i]) - sum(a_list[i:]))
    min_diff = min(min_diff, diff)
print(min_diff)


### FIXED CODE ###

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

a_sum = sum(a_list)
l_a_sum = a_list[0]
min_diff = abs(a_sum - 2 * l_a_sum)
for i in range(1, N-1):
    l_a_sum += a_list[i]
    min_diff = min(min_diff, abs(a_sum - 2 * l_a_sum))
print(min_diff)