Harryxun/stf_run huggingface dataset:
s = input().strip()
x,y = map(int,input().split())
C = {}
cur = 0
cnt = 0
for i in range(len(s)):
    if s[i]=="F":
        cnt += 1
    else:
        C[cur] = cnt
        cur += 1
        cnt = 0
C[cur] = cnt
AX = []
AY = []
for a in C:
    if a>0 and a%2==0 and C[a]>0:
        AX.append(C[a])
    elif a%2==1 and C[a]>0:
        AY.append(C[a])
cntx = sum(AX)
dpx = [[0 for _ in range(2*cntx+1)] for _ in range(len(AX)+1)]
dpx[0][cntx] = 1
if cntx>0:
    dpx[1][cntx-AX[0]] = 1
    dpx[1][cntx+AX[0]] = 1
    for i in range(2,len(AX)+1):
        for j in range(2*cntx+1):
            dpx[i][j] = dpx[i-1][j-AX[i-1]+cntx]
            if j+AX[i-1]<=cntx:
                dpx[i][j] = max(dpx[i][j],dpx[i-1][j+AX[i-1]+cntx])
cnty = sum(AY)
dpy = [[0 for _ in range(2*cnty+1)] for _ in range(len(AY)+1)]
dpy[0][cnty] = 1
if cnty>0:
    dpy[1][cnty-AY[0]] = 1
    dpy[1][cnty+AY[0]] = 1
    for i in range(2,len(AY)+1):
        for j in range(2*cnty+1):
            dpy[i][j] = dpy[i-1][j-AY[i-1]+cnty]
            if j+AY[i-1]<=cnty:
                dpy[i][j] = max(dpy[i][j],dpy[i-1][j+AY[i-1]+cnty])
if C[0]-cntx<=x<=C[0]+cntx and dpx[len(AX)][x-C[0]+cntx]==1 and -cnty<=y<=cnty and dpy[len(AY)][y+cnty]==1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input().strip()
x,y = map(int,input().split())
C = {}
cur = 0
cnt = 0
for i in range(len(s)):
    if s[i]=="F":
        cnt += 1
    else:
        C[cur] = cnt
        cur += 1
        cnt = 0
C[cur] = cnt
AX = []
AY = []
for a in C:
    if a>0 and a%2==0 and C[a]>0:
        AX.append(C[a])
    elif a%2==1 and C[a]>0:
        AY.append(C[a])
cntx = sum(AX)
dpx = [[0 for _ in range(2*cntx+1)] for _ in range(len(AX)+1)]
dpx[0][cntx] = 1
if cntx>0:
    dpx[1][cntx-AX[0]] = 1
    dpx[1][cntx+AX[0]] = 1
    for i in range(2,len(AX)+1):
        for j in range(-cntx,cntx+1):
            if -cntx<=j-AX[i-1]:
                dpx[i][j+cntx] = dpx[i-1][j-AX[i-1]+cntx]
                if j+AX[i-1]<=cntx:
                    dpx[i][j+cntx] = max(dpx[i][j+cntx],dpx[i-1][j+AX[i-1]+cntx])
            elif j+AX[i-1]<=cntx:
                dpx[i][j+cntx] = dpx[i-1][j+AX[i-1]+cntx]
cnty = sum(AY)
dpy = [[0 for _ in range(2*cnty+1)] for _ in range(len(AY)+1)]
dpy[0][cnty] = 1
if cnty>0:
    dpy[1][cnty-AY[0]] = 1
    dpy[1][cnty+AY[0]] = 1
    for i in range(2,len(AY)+1):
        for j in range(-cnty,cnty+1):
            if -cnty<=j-AY[i-1]:
                dpy[i][j+cnty] = dpy[i-1][j-AY[i-1]+cnty]
                if j+AY[i-1]<=cnty:
                    dpy[i][j+cnty] = max(dpy[i][j+cnty],dpy[i-1][j+AY[i-1]+cnty])
            elif j+AY[i-1]<=cnty:
                dpy[i][j+cnty] = dpy[i-1][j+AY[i-1]+cnty]
if C[0]-cntx<=x<=C[0]+cntx and dpx[len(AX)][x-C[0]+cntx]==1 and -cnty<=y<=cnty and dpy[len(AY)][y+cnty]==1:
    print("Yes")
else:
    print("No")
from math import gcd

n = int(input())
arr = [int(j) for j in input().split()]

prod = 1
l = 1
for x in arr:
	g = gcd(l, x)
	prod = l*x
	l = prod//g
	# print(l)

su = 0

for x in arr:
	su += (l//x)
print(su%(10**9 + 7))


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)
def gcd(a,b): 
    if (b == 0): 
         return a 
    return gcd(b, a%b) 


mod = 10**9 + 7

n = int(input())
arr = [int(j) for j in input().split()]

prod = 1
l = 1
for x in arr:
	g = gcd(l, x)
	prod = l*x
	l = prod//g

su = 0
for x in arr:
	su += (l//x)
print(su%mod)
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

K = int(input())
S = input()
n = len(S)
ans = 0
for i in range(K+1):
    ans += cmb(i+n-1, n-1, mod) * pow(25, i) * pow(26, (K-i))
print(ans%mod)

### FIXED CODE ###

# F - Strivore
import sys
MOD = 10**9+7
K = int(input())
S = input()
l = len(S)
ans = 0
 
tmp = pow(26,K,MOD)
ans = tmp
waru = pow(26,-1,MOD)
 
for i in range(1,K+1):
    tmp = (tmp*25*waru)%MOD
    tmp = (tmp*(l-1+i)*pow(i,-1,MOD))%MOD
    ans = (ans+tmp)%MOD
 
print(ans)
n = str(input())

ans = ''

for i in range(len(n)):
  if n[i] == 'B':
    ans = ans[-1]
  elif n[i] == '0':
    ans += '0'
  elif n[i] == '1':
    ans += '1'

print(ans)

### FIXED CODE ###

n = str(input())

ans = ''

for i in range(len(n)):
  if n[i] == 'B':
    ans = ans[:-1]
  elif n[i] == '0':
    ans += '0'
  elif n[i] == '1':
    ans += '1'

print(ans)
import numpy as np
n,*a=map(int,open(0).read().split())
a.sort()
p=0
a=np.array(a)
ans=0
while True:
  i=0
  if len(a)>1:
    while a[i]==a[i+1]:
      i+=1
      if i==n-1:
        break
    first=a[i]
    ans+=1
    a=a[i:]
  elif len(a)==1:
    ans+=1
    break
  else:
    break
  b=a.copy()
  if len(b)==0:
    break
  b%=first
  a=a[b!=0]
print(ans)

### FIXED CODE ###

n,*a=map(int,open(0).read().split())
a.sort()
num=[True for i in range(a[-1]+1)]
for i in range(n):
  if num[a[i]]:
    for j in range(a[-1]//a[i]+1):
      if j<2:
        continue
      num[a[i]*j]=False
    if i==n-1:
      pass
    elif a[i]==a[i+1]:
      num[a[i]]=False
    else:
      pass
  else:
    continue
ans=0
for i in range(n):
  if num[a[i]]:
    ans+=1
print(ans)
word = input()
al = [chr(ord("a") + i) for i in range(26)]
ans = "None"
for i in range(len(al)):
    if not al[i] in word:
      ans = append(al[i])
      break
print(ans)

        


### FIXED CODE ###

word = input()
al = "qwertyuiopasdfghjklzxcvbnm"
d = []
for i in range(len(al)):
    if not al[i] in word:
        d.append(al[i])
if d == []:
    print("None")
else:
    print(sorted(d)[0])
for k in range(50):
 D=int(input())
 c = list(map(int,input().split()))
 s=[[0 for e in range(26)] for f in range(D)]
 for i in range(D):
  s[i]=list(map(int,input().split()))
 last=[0]*26
 ans=0
 point=[0]*D
 for i in range(D):
  saidai=-(10**10)
  kouho=1
  for j in range(26):
   if s[i][j]+c[j]*((i+1)-last[j])>=saidai:
    kouho=j+1
    saidai=s[i][j]+c[j]*((i+1)-last[j])
  print(kouho)

### FIXED CODE ###

D=int(input())
c = list(map(int,input().split()))
s=[[0 for e in range(26)] for f in range(D)]
for i in range(D):
 s[i]=list(map(int,input().split()))
last=[0]*26
ans=0
point=[0]*D
for i in range(D):
 saidai=-(10**10)
 kouho=0
 for j in range(26):
  if s[i][j]+c[j]*((i+1)-last[j])>=saidai:
   kouho=j+1
   saidai=s[i][j]+c[j]*((i+1)-last[j])
 print(kouho)
N,M=map(int,input().split())
S=input()
T=input()

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

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


G = int(lcm(N,M))

answer = G

temp_S =['0']*G
temp_T =['0']*G

for i in range(N):
    temp_S[i*int(G/N)] = S[i]

for j in range(M):
    temp_T[j*int(G/M)] = T[j]

for k in range(G):
    if temp_S[k] != temp_T[k] and temp_S[k] != '0' and temp_T[k] != '0':
        answer =-1

print(answer)

### FIXED CODE ###

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

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

def lcm(a, b):
	return int(a * b // gcd (a, b))
answer =lcm(N,M)

G =gcd(N,M)

for k in range(G):
    if S[int(k*N/G)] !=  T[int(k*M/G)]:
        answer =-1

print(answer)
a, b, c, d = map(int, imput().split())
print(max(a*c,a*d,b*d,b*c))

### FIXED CODE ###

a, b, c, d = map(int, input().split())
print(max(a*c,a*d,b*d,b*c))
N, K = map(int, input().split())
A = list(map(int,input().split()))

b = [1]
i = 0
while True:
    if A[i] in b:
#        print("m: "+str(b.index(A[i])))
#        print("n: "+str(len(b)-A[i]))
        m = b.index(A[i])
        n = len(b)-b.index(A[i])
        cycle = (K-m)%n
        position = A[i] - 1
        break
    b.append(A[i])
    i = A[i] - 1
    
tmp = 0
if K <= cycle:
	for i in range(K):
		next_town = A[tmp]
		tmp = next_town - 1
	print(next_town)
else:
	for i in range(cycle):
		next_town = A[position]
		position = next_town -1
	print(next_town)

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int,input().split()))
b = [0]*N
next_town = 1
for i in range(N+1):
    if b[next_town-1] != 0:
        start = next_town
        cycle = i - b[next_town-1]
#        print("start: "+str(start))
#        print("cycle: "+str(cycle))
        break
    b[next_town-1] = i
    next_town = A[next_town-1]
    
next_town = 1
if b[start-1] >= K:
    for i in range(K):
        next_town = A[next_town-1]
    print(next_town)
else:
    next_town = start
    for i in range((K-b[start-1])%cycle):
        next_town = A[next_town-1]
    print(next_town)
othello = input()
bef = 0
sumall = 0
sumelse = 0

for i in range(len(othello)):
    sumall += i
    if(othello[i] == 'B'):
        bef += i
        count += 1

count = 0
for i in range(len(othello)-count):
    sumelse += i

aft = sumall - sumelse

print(aft - bef)

### FIXED CODE ###

othello = input()
bef = 0
sumall = 0
count = 0

for i in range(len(othello)):
    sumall += i
    if(othello[i] == 'B'):
        bef += i
        count += 1

sumelse = 0
for i in range(len(othello)-count):
    sumelse += i

aft = sumall - sumelse

print(aft - bef)
S=int(input("羊:"))
W=int(input("狼:"))
if S>W:
    print("safe")
else:
    print("unsafe")

### FIXED CODE ###

s,w = map(int, input().split())
 
if s > w:
    print('safe')
else:
    print('unsafe')
from numba import njit

def dis(a, b):
  d = 0
  for ai, bi in zip(a, b):
    if ai == bi:
      continue
      d += 1
      return d

@njit
def main():
    s = list(input())
    t = list(input())
    lt = len(t)
    ls = len(s)
    ans = 1000

    for i in prange(ls-lt+1):
        ans = min(ans, dis(s[i:i+lt], t))
    
    print(ans)
        
    

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    s = list(input())
    t = list(input())
    lt = len(t)
    ls = len(s)
    ans = 1000
    
    
    def dis(a, b):
        d = 0
        for ai, bi in zip(a, b):
            if ai == bi:
                continue
            d += 1
        return d
    
    for i in range(ls-lt+1):
        ans = min(ans, dis(s[i:i+lt], t))
    
    print(ans)
        
    

if __name__ == "__main__":
    main()
h , w = (int(i) for i in input().split())
a =[]
dy = [0, 0, 1, -1]
dx = [1, -1, 0, 0]


for i in range(h):
    a.append(input())
    
f = True
def check(x,y):
    if a[x][y] =='.':
        return True
    for n in range(4):
        i = dx[n]
        j = dy[n]
#        print(a[x+i][y+j])
        if 0 <= x+i < w and 0 <= y + j < h and a[x+i][y+j]=='#':
            #print(x+i,y+j)
            return True
    return False
#print(check(0,3))
f = True
for i in range(w):
    for j in range(h):
        l = check(i,j)
        if not(l) and f:
            print ("No")
            f = False
if(f):
    print("Yes")


### FIXED CODE ###

H ,W = [int(i) for i in input().split(' ')]
s = []
#print(s)
for i in range(H):
    line = input()
    lis = []
    for str in line:
        lis.append(str)
    s.append(lis)


def drawable(h,w):
    for i in [-1,1]:
        if 0 <= w+i < W:
#            print(h,w+i)
            if s[h][w+i] =='#':
                return True
    for i in [-1,1]:
        if 0 <= h+i < H:
            if s[h+i][w] =='#':
                return True

    return False

flag = True
for i in range(H):
    for j in range(W):
#        print(i,j)
        if s[i][j]=='#' and not(drawable(i,j)):
           flag = False 

if flag:
    print("Yes")
else:
    print("No")
N, M = [int(x) for x in input().split()]
p = []; S = []
for _ in range(M):
    p_tmp, S_tmp = input().split()
    p.append(int(p_tmp))
    S.append(str(S_tmp))

AC = [0] * N
WA = [0] * M
for i in range(M):
    if AC[p[i] - 1] == 1:
        continue
    if S[i] == 'AC':
        AC[p[i] - 1] = 1
    else:
        WA[p[i] - 1] += 1
AC_count = sum(AC)
WA_count = sum(WA)
print(AC_count, WA_count)

### FIXED CODE ###

N, M = [int(x) for x in input().split()]
p = []; S = []
for _ in range(M):
    p_tmp, S_tmp = input().split()
    p.append(int(p_tmp))
    S.append(str(S_tmp))

AC = [0] * N
WA = [0] * N
for i in range(M):
    if AC[p[i] - 1] == 1:
        continue
    if S[i] == 'AC':
        AC[p[i] - 1] = 1
    else:
        WA[p[i] - 1] += 1
for i in range(N):
    if AC[i] == 0:
        WA[i] = 0
AC_count = sum(AC)
WA_count = sum(WA)
print(AC_count, WA_count)
L,R = map(int,input().split())
min = L*(L+1)%2019
for i in range(L,L+2019):
    for j in range(i+1,L+2019):
        if(i<j):
            if(min > (i*j)%2019):
                min = (i*j)%2019
        if(min == 0):
            break
    if(min==0)
        break
print(min)

### FIXED CODE ###

L,R = map(int,input().split())
min = L*(L+1)%2019
a = L
b = L +1
if(R > L + 2019):
    R = L + 2019
for i in range(L,R+1):
    for j in range(i+1,R+1):
        if(i<j):
            if(min > (i*j)%2019):
                min = (i*j)%2019
                a = i
                b = j
        if(min == 0):
            break
    if(min==0):
        break
print(min)
a, b = map(int, input().split())

if (a+b)%2 == 0 :
    print(a+b)/2))
else :
    print("IMPOSSIBLE")


### FIXED CODE ###

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

if (a+b)%2 == 0 :
    print((a+b)//2)
else :
    print("IMPOSSIBLE")
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
h = na()

memo = [-1] * n
memo[1] = abs(h[1] - h[0])

def df(n):
    if n==0:
        return 0
    if n==1:
        return memo[1]
    elif memo[n] != -1:
        return memo[n]
    else:
        memo[n] = min(df(n-2) + abs(h[n] - h[n-2]), df(n-1) + abs(h[n] - h[n-1]))
        return memo[n]

print(df(n-1))

### FIXED CODE ###

import sys
import math
import itertools
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
h = na()
dp = [0] * n
dp[1] = abs(h[1] - h[0])
for i in range(2,n):
    op1 = dp[i-2] + abs(h[i-2] - h[i])
    op2 = dp[i-1] + abs(h[i-1] - h[i])
    dp[i] = min(op1, op2)

print(dp[-1])
n,m=map(int,input().split())
nod=[[]]
check=[[0,0]]
for i in range(n-1):
  nod.append([])
  check.append([10**10,0])
for i in range(m):
  a,b=map(int,input().split())
  nod[a-1].append(b)
  nod[b-1].append(a)


def dfs(k):
  count=check[k-1][0]+1
  uselist=nod[k-1]
  for x in uselist:
    if count<check[x-1][0]:
      check[x-1][0]=count
      check[x-1][1]=k
      dfs(x)
    else:
      continue
  return

dfs(1)
print("Yes")
for i in range(n-1):
  print(check[i+1][1])

### FIXED CODE ###

from collections import deque
dic={}
n,m=map(int,input().split())
nod=[[]]
keep=[0]*n
for i in range(n-1):
  nod.append([])
for i in range(m):
  a,b=map(int,input().split())
  nod[a-1].append(b)
  nod[b-1].append(a)
use=deque()
use.append(1)
for i in range(0,10**100):
  if bool(use):
    sss=use.popleft()
    for j in nod[sss-1]:
      if not j in dic:
        keep[j-1]=sss
        use.append(j)
        dic[j]=1
  else:
    break

keep.pop(0)
print("Yes")
for x in keep:
  print(x)
s = input()

core = []

for c in s:
    if c != 'x':
        core.append(c)
l = 0
r = 0 if core == [] else len(core) - 1
while l <= r:
    if core[l] != core[r]:
        print(-1)
        exit()
    l += 1
    r -= 1

ans = 0
l = 0
r = len(s) - 1
while l <= r:
    lx = 0
    rx = 0
    while s[l] == 'x':
        l += 1
        lx += 1
    while s[r] == 'x':
        r -= 1
        rx += 1
    ans += abs(lx - rx)
    l += 1
    r -= 1
print(ans)


### FIXED CODE ###

s = input()

core = []

for c in s:
    if c != 'x':
        core.append(c)
if core == []:
    print(0)
    exit()
l = 0
r = len(core) - 1

while l <= r:
    if core[l] != core[r]:
        print(-1)
        exit()
    l += 1
    r -= 1

ans = 0
l = 0
r = len(s) - 1

while l <= r:
    lx = 0
    rx = 0
    while s[l] == 'x':
        l += 1
        lx += 1
    while s[r] == 'x':
        r -= 1
        rx += 1
    ans += abs(lx - rx)
    l += 1
    r -= 1
print(ans)
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  h, w, m = map(int, input().strip().split())
  fieldh = numpy.zeros(h, dtype=numpy.int)
  fieldw = numpy.zeros(w, dtype=numpy.int)
  field = numpy.zeros((h, w), dtype=numpy.int)
  for _ in range(m):
    ih, iw = map(int, input().strip().split())
    fieldh[ih-1] += 1
    fieldw[iw-1] += 1
    field[ih-1, iw-1] = 1
  max_h = numpy.max(fieldh)
  max_w = numpy.max(fieldw)
  argsort_h = fieldh.argsort()[::-1]
  argsort_w = fieldw.argsort()[::-1]
  
  max_cnt = 0
  for ih in argsort_h:
    for iw in argsort_w:
      if field[ih, iw] == 0:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw])
        print(max_cnt)
        return 
      else:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1)

if __name__=='__main__':
  main()



### FIXED CODE ###

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

import numpy
from collections import defaultdict

def main():
  h, w, m = map(int, input().strip().split())
  fieldh = numpy.zeros(h, dtype=numpy.int)
  fieldw = numpy.zeros(w, dtype=numpy.int)
  field = defaultdict(int)
  for _ in range(m):
    ih, iw = map(int, input().strip().split())
    fieldh[ih-1] += 1
    fieldw[iw-1] += 1
    field[ih-1, iw-1] = 1
    
  max_h = numpy.max(fieldh)
  max_w = numpy.max(fieldw)
  argsort_h = [ ih for ih in range(h) if fieldh[ih] == max_h ]
  argsort_w = [ iw for iw in range(w) if fieldw[iw] == max_w ]
  
  max_cnt = 0
  for ih in argsort_h:
    for iw in argsort_w:
      if field[ih, iw] == 0:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw])
        print(max_cnt)
        return 
      else:
        max_cnt = max(max_cnt, fieldh[ih]+fieldw[iw]-1)
  print(max_cnt)

if __name__=='__main__':
  main()
a=[]
b=[]
for i in range(5):
    x=int(input())
    a.append(x)
    if x%10!=0:
        b.append(10-x%10)
b.sort()
print(sum(a)+sum(b)-max(b))
    


### FIXED CODE ###

a=[]
b=[]
for i in range(5):
    x=int(input())
    a.append(x)
    if x%10!=0:
        b.append(10-x%10)
if a[0]%10==0 and a[1]%10==0 and a[2]%10==0 and a[3]%10==0 and a[4]%10==0:
    print(sum(a))
else:
    b.sort()
    print(sum(a)+sum(b)-max(b))
n=int(input())

a=[]

for i in range(n):
    b=int(input())
    a.append(b)
    
a.sort()

ans=["" for i in range(n)]

ans[n//2]=a[-1]
a.remove(a[-1])
l=(n//2)-1
r=(n//2)+1

for i in range(n-1):
    if i%4==0:
        ans[l]=a[0]
        a.remove(a[0])
        l-=1
    elif i%4==1:
        ans[r]=a[0]
        a.remove(a[0])
        r+=1
    elif i%4==2:
        ans[l]=a[-1]
        a.remove(a[-1])
        l-=1
    elif i%4==3:
        ans[r]=a[-1]
        a.remove(a[-1])
        r-=1

ans.append(ans[0])     
num=0
num2=0
num3=0


for i in range(n-1):
    num+=abs(ans[i]-ans[i+1])

for i in range(n-1):
    num2+=abs(ans[i+1]-ans[i+2])

for i in range(n-1):
    if i==0:
        num3+=abs(ans[-2]-ans[0])
    else:
        num3+=abs(ans[i]-ans[i-1])
        
print(max(num,num2,num3))




### FIXED CODE ###

n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
l.sort()
if n%2==0:
    ln=l[:n//2]
    lx=l[n//2:]
    print(2*(sum(lx)-sum(ln))-lx[0]+ln[-1])
else:
    ln=l[:n//2]
    lm=l[n//2]
    lx=l[n//2+1:]
    p=sum(lx)
    q=sum(ln)
    print(max(2*(p-q)+ln[-1]-lm,2*(p-q)-lx[0]+lm))
A,B = input().split()

A_ch = int(A)
B_ch = int(B)

cal = B_ch - A_ch
i = 0
n = 1
try:
    while (cal + i) > 0:
        n += 1
        i += 1
        cal = B_ch - A_ch * n - n
        
except:
    i = 1
print(i)

### FIXED CODE ###

S = input()
T = input()

x = 0

for i in range(3):
    if S[i] == T[i]:
        x = x + 1

print(x)
def cmb(n, r):
      n_ = math.factorial(n)
      n_r_ = math.factorial(n-r) 
      r_ = math.factorial(r)
      return n_//(r_*n_r_)
     
    n,k = list(map(int, input().split(" ")))
     
    for i in range(1, k+1):
      if n-k+1 >= i:
        ni =  cmb(n-k+1,i)*cmb(k-1,i-1)%(10**9+7)
        print(int(ni))
      else:
        print(0)

### FIXED CODE ###

import math
def cmb(n, r):
  n_ = math.factorial(n)
  n_r_ = math.factorial(n-r) 
  r_ = math.factorial(r)
  return n_//(r_*n_r_)

n,k = list(map(int, input().split(" ")))

for i in range(1, k+1):
  if n-k+1 >= i:
    ans =  cmb(n-k+1,i)*cmb(k-1,i-1)%(10**9+7)
  else:
    ans = 0
  print(ans)
import math
A, B, H, M = map(int, input().split())

PI = math.pi
radA = (2.0 * PI * (H + M / 60.0)) / 12.0
radB = (2.0 * PI * M) / 60.0
#print(math.hypot(A * math.cos(radA) - B * math.cos(radB),
#                 A * math.sin(radA) - B * math.sin(radB)))
print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(radA-radB)*math.sin(radA-radB)))

### FIXED CODE ###

N = input()

last = list(N)[-1]
if int(last) in (2,4,5,7,9):
    print('hon')
elif int(last) in (0,1,6,8):
    print('pon')
else:
    print('bon')
N,A,B,C,D=map(int,input().split())
S=input()

if C<D:
  if B<C:
    d=0
    if "##" in S[A-1:D]:
      d=1
    print("Yes" if d==0 else "No")
  else:
    d=0
    if "##" in S[A-1:C]:
      d=1
    if "##" in S[B-1:D]:
      d=1
    print("Yes" if d==0 else "No") 
else:
  d=0
  d=4/0
  if "##" in S[A-1:C]:
    d=1
  if "..." not in S[B-1:D]:
    d=1
  print("Yes" if d==0 else "No") 

### FIXED CODE ###

N,A,B,C,D=map(int,input().split())
S=input()

if C<D:
  if B<C:
    d=0
    if "##" in S[A-1:D]:
      d=1
    print("Yes" if d==0 else "No")
  else:
    d=0
    if "##" in S[A-1:C]:
      d=1
    if "##" in S[B-1:D]:
      d=1
    print("Yes" if d==0 else "No") 
else:
  d=0
  if "##" in S[A-1:C]:
    d=1
  if "..." not in S[B-2:D+1]:
    d=1
  print("Yes" if d==0 else "No")
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
N, Y = ri_()
for i in range(N + 1):
    for j in range(N + 1):
        if 1000 * (N - i - j) == Y - 10000 * i - 5000 * j and N - i - j >= 0:
            print(i, j, N - i - j)
            exit()
print(-1, -1, -1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline()
def read(): return int(input())
def reads(): return [int(i) for i in input().split()]

N, Y = reads()

x_max = min(N, Y//10000)
y_max = min(N, Y//5000)

ans = (-1, -1, -1)

for x in range(x_max+1):
	for y in range(min(y_max+1, N-x+1)):
		if 10000*x + 5000*y + 1000*(N-x-y) == Y:
			ans = (x, y, N-x-y)
			break

print(str(ans[0])+' '+str(ans[1])+' '+str(ans[2]))
s = input()

if s=="A":
  print(T)
if s=="T":
  print(A)
if s=="C":
  print(G)
if s=="G":
  print(C)


### FIXED CODE ###

s = input()

if s=="A":
  print("T")
if s=="T":
  print("A")
if s=="C":
  print("G")
if s=="G":
  print("C")
import copy
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n=int(input())
A=[0]*(n+1)
for i in range(n+1):
  A[i]=int(input())
P=[]
PP=factorization(A[-1])
for i in range(len(PP)):
  P.append(PP[i][0])
print(P)
for i in range(len(P)):
  p=P[i]
  B=copy.copy(A)
  for j in range(n+1):
    if p+j<n+2:
      B[j+p-1]=(B[j+p-1]+B[j])%p
      print(B)
    else:
      print(B)
      if A[j]%p!=0:
        break
  print(p)

### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

sosuu=[2];n=int(input())
for L in range(3,n+100):
    chk=True
    for L2 in sosuu:
        if L%L2 == 0:chk=False
    if chk==True:sosuu.append(L)
S=set(sosuu)



A=[0]*(n+1)
g=0
for i in range(n+1):
  A[i]=int(input())
P=[]
PP=factorization(abs(A[0]))
for i in range(len(PP)):
  P.append(PP[i][0])
if P==[1]:
  P=[]
P=set(P)
P=S|P
P=list(P)
P.sort()
for i in range(len(P)):
  p=P[i]
  B=A[0:n+2]
  b=0
  for j in range(n+1):
    if p+j<n+1:
      B[j+p-1]=(B[j+p-1]+B[j])%p
    else:
      if B[j]%p!=0:
        b=1
        break
  if b==0:
    print(p)