Harryxun/stf_run huggingface dataset:
a,b=map(int,input().split())
print(-(-((a+b)//2))

### FIXED CODE ###

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

print(-(-(a+b)//2))
a, b, c, d, e, f = map(int, input().split())
max_a = f // (100*a)
max_b = f // (100*b)
max_c = f // c
max_d = f // d
wat = []
sug = []
for i in range(max_a + 1):
    for j in range(max_b + 1):
        w = 100 * a * i + 100 * b * j
        if w =< f and w > 0:
            wat.append(w)
for i in range(max_c + 1):
    for j in range(max_d + 1):
        s = c*i + d*j
        if s < f:
            sug.append(s)
ans = 0
for x in wat:
    for y in sug:
        if x + y <= f and y <= e * x // 100:
            if ans < 100 * y // (x + y):
                ans =  100 * y // (x + y)
                out = [x+y, y]
print(*out)

### FIXED CODE ###

a, b, c, d, e, f = map(int, input().split())
max_a = f // (100*a)
max_b = f // (100*b)
max_c = f // c
max_d = f // d
wat = []
sug = []
for i in range(max_a + 1):
    for j in range(max_b + 1):
        w = 100 * a * i + 100 * b * j
        if w <= f and w > 0:
            wat.append(w)
for i in range(max_c + 1):
    for j in range(max_d + 1):
        s = c*i + d*j
        if s < f:
            sug.append(s)
ans = 0
for x in wat:
    for y in sug:
        if x + y <= f and y <= e * x / 100:
            if ans <= 100 * y / (x + y):
                ans =  100 * y / (x + y)
                out = [x+y, y]
print(*out)
#coding:utf-8
n,k=int(input().split())
h=[int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1]-h[i] for i in range(n-k+1)))

### FIXED CODE ###

#coding:utf-8
n,k=map(int, input().split())
h=[int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1] - h[i] for i in range(n-k+1)))
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]

if m==1:
    for i in a:
        if b[0] in i:
            print('Yes')
            exit()
        else:
            print('No')
            exit()

for i in range(n-m+1):
    cnt=0
    while cnt < n - m:
        l=[]
        for j in range(n-m+1):
        #bと同じ長さの部分配列を作る
            l+=[a[j+cnt][i:i+m]]

        if l==b:
            print('Yes')
            exit()
        cnt+=1
print('No')

### FIXED CODE ###

n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]

#二次元配列の部分配列を抽出する手法
#[l[i:m+i] for l in a[i:m+i]]
if m==1:
    for i in range(n):
        if b[0] in a[i]:
            print('Yes')
            exit()

    print('No')
    exit()
if m==n:
    if a==b:
        print('Yes')
        exit()
    else:
        print('No')
        exit()

for i in range(n-m):
    for j in range(n-m):
        if [l[j:m+j] for l in a[i:m+i]]==b:
            print('Yes')
            exit()

print('No')
N,C = map(int,input().split())
tv_times = [[int(j) for j in input().split()] for i in range(N)]

channells = {}
for i in range(C+1):
    channells[i] = []
max_end = -1

for i in range(N):
    s,g,c = tv_times[i]
    max_end = max(max_end,g)
    channells[c] += [s,g]

tv_times = []
f = [0 for i in range(max_end+1)]
for cha in channells.keys():
    remove_list = []
    time = channells[cha]
    for i in range(len(time)//2-1):
        if time[2*i+1] == time[2*i+2]:
            remove_list.append(time[2*i+1])
    time = list(set(time)-set(remove_list))
    time.sort()
    # print(time)
    # print(time)
    # print(f)
    for i in range(len(time)//2):
        f[max(time[2*i]-1,0)] += 1
        f[time[2*i+1]] -= 1

ans = -1
for i in range(1,max_end):
    f[i] += f[i-1]
    if ans < f[i]:
        ans = f[i]

# print(f)
print(ans)


### FIXED CODE ###

# encoding:utf-8
import copy
import numpy as np
import random

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


ans = min(b,a*n)

print(ans)
S = input()
S = S.strip(S[0])

if len(S[0]) > 0:
    S = S.strip(S[0])
    if len(S) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")


### FIXED CODE ###

S = input()
S = S.replace(S[0],"")
if len(S) > 0:
    S = S.replace(S[0],"")
    if len(S) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
n, k = map(int, input().split())

if 2 * k - 1 > n:
  print(-1)
else:
  d = (n + 1) // 2
  flag_a = False
  for i in range(n):
    a = k + i // 2
    b = k + n + i // 2
    c = k + 2 * n + i
    if flag_a:
      a += d
    else:
      b += d
    print(a, b, c)
    flag = not flag

### FIXED CODE ###

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

if 2 * k - 1 > n:
  print(-1)
else:
  half_n = n // 2
  if n % 2 == 0:
    for i in range(half_n):
      a = k + i
      b = k + n + i + half_n
      c = k + 2 * n + 2 * i
      print(a, b, c)
      a += half_n
      b -= half_n
      c += 1
      print(a, b, c)
  else:
    for i in range(half_n):
      a = k + i
      b = k + n + i + half_n
      c = k + 2 * n + 2 * i
      print(a, b, c)
      a += half_n + 1
      b -= half_n
      c += 1
      print(a, b, c)
    a = k + half_n
    b = k + n + 2 * half_n
    c = k + 2 * n + 2 * half_n
    print(a, b, c)
import sys
sys.setrecursionlimit(10**7)
n,u,v = map(int,input().split())
ki = [[]for i in range(n)]
distt = [0]*n
dista = [0]*n
for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    ki[a].append(b)
    ki[b].append(a)
def dfst(now,last = -1):
    for next in ki[now]:
        if next == last:continue
        distt[next] = distt[now]+1
        dfst(next,now)
def dfsa(now,last = -1):
    for next in ki[now]:
        if next == last:continue
        dista[next] = dista[now]+1
        dfsa(next,now)
    
dfst(u)
dfsa(v)
ans = 0
for i in range(n):
    if dista[i]<=distt[i]:continue
    ans = max(ans,dista[i]-1)
print(ans)
    

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**7)
n,u,v = map(int,input().split())
u-=1
v-=1
ki = [[]for i in range(n)]
distt = [0]*n
dista = [0]*n
for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    ki[a].append(b)
    ki[b].append(a)
def dfst(now,last = -1):
    for next in ki[now]:
        if next == last:continue
        distt[next] = distt[now]+1
        dfst(next,now)
def dfsa(now,last = -1):
    for next in ki[now]:
        if next == last:continue
        dista[next] = dista[now]+1
        dfsa(next,now)
    
dfst(u)
dfsa(v)
ans = 0
for i in range(n):
    if dista[i]<=distt[i]:continue
    ans = max(ans,dista[i]-1)
print(ans)
def edit_distance(d)
 n =len(d)
 A=[[0 for i inrange(n)] for j in range(n)]
 for long in range(0,n+1-long):
  k=i-1+long
  def f(i,j,k):
   return A[i][j-1]+A[j][k]+]+M[i][0]*M[j-1][1]*M[k][1]
  A[i][k] = min([f(i,j,k) for j in range(i+1,k+1)])
 return A[0][n-1]
n = input()
M = []
for i in range(n):
 M.append(map(int, raw_input().split()))
print edit_distance(M)

### FIXED CODE ###

def edit_distance(M):
  n = len(M)



  m = [[0 for i in range(n)] for j in range(n)]
   
  for long in range(2, n+1):

    for i in range(0, n-long+1):

      j = i + long - 1

      def a(i, k ,j):
        return m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1]
      m[i][j] = min(a(i, k, j) for k in range(i, j))
   
  return m[0][n-1]
 
n = input()
M = []
 
for i in range(n):
  M.append(map(int, raw_input().split()))
print edit_distance(M)
import functools
def euclid(a, b):
    while b:
        a, b = b, a%b
    return a
def multiple(a, b):
    return a*b // euclid(a, b)
def lcm(nums):
    return functools.reduce(multiple, nums)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    MOD = 10**9+7
    # 方針1.dp[k] := A1~Akまでについて条件を満たすようなB1~Bkの総和..?
    # 方針2.A全体のgcdをxとすると、ans=Σ(i=[0,N])x/Ai
    ans = 0
    x = lcm(A)
    for a in A:
        ans += int(x/a)%MOD
        ans %= MOD
    print(ans)

main()


### 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

def main():
    n=int(input())
    a=list(map(int,input().split()))
    mod=pow(10,9)+7
    lcma={}
    for ai in a:
      f=factorization(ai)
      for fi in f:
        if fi[0] in lcma:
          lcma[fi[0]]=max(lcma[fi[0]],fi[1])
        else:
          lcma[fi[0]]=fi[1]
    l=1
    for k,v in lcma.items():
      l*=pow(k,v,mod)
      l%=mod
    ans=0
    for ai in a:
      ans+=l*pow(ai,mod-2,mod)
      ans%=mod
    print(ans)

main()
N = int(input())
trans = []

for i in range(N):
    trans.append(int(input()))

trans.sort()

if N % trans[0] == 0:
    print(N // trans[0] + 4)
else:
    print(N // trans[0] + 5)



### FIXED CODE ###

N = int(input())
trans = []

for i in range(5):
    trans.append(int(input()))

trans.sort()

if N % trans[0] == 0:
    print(N // trans[0] + 4)
else:
    print(N // trans[0] + 5)
(a, b, c) [int(x) for x in input().split()]

for d in range(a, b + 1):
    if c % d == 0:
        count += 1

print(count)

### FIXED CODE ###

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

count = 0
for d in range(a, b + 1):
    if c % d == 0:
        count += 1

print(count)
S = input()
T = input()
if(len(S)+1==len(T)):
  print("Yes")
else():
  print("No")

### FIXED CODE ###

S = input()
T = input()
if(S==T[:-1]):
  print("Yes")
else:
  print("No")
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

manzoku=0
i=0 #A[i]を参照する
while i<len(A):
	a=A[i]
	manzoku+=a
	if A[i+1]-A[i]==1 :
		manzoku+=C[a]
	i+=1
print(manzoku)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
sum =0;
for i in range(len(a)):
    sum += b[a[i]-1]
    if i +1 < n and a[i+1] - a[i] == 1:
        sum += c[a[i]-1]
print(sum)
N = int(input())
L = list(map(int, input().split()))

L.sort()

count = 0
for i, l1 in enumerate(L):
    for j, l2 in enumerate(L):
        if i < j:
            s = bisect_right(L[j+1:], abs(l1-l2))
            e = bisect_left(L[j+1:], l1+l2)

            # print((i, j), (l1, l2), (abs(l1-l2), l1+l2), (s, e))
            count += max(0, e-s)
            # abs(l1-l2) <= m <= l1+l2

print(count)

### FIXED CODE ###

from bisect import bisect_left, bisect_right

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

L.sort()

count = 0
for i, l1 in enumerate(L):
    for j, l2 in enumerate(L):
        if i < j:
            s = max(j+1, bisect_right(L, abs(l1-l2)))
            e = max(j+1, bisect_left(L, l1+l2))

            # print((i, j), (l1, l2), (abs(l1-l2), l1+l2), (s, e))
            count += max(0, e-s)
            # abs(l1-l2) <= m <= l1+l2

print(count)
import sys

H, W = map(int, input().split())
square = []
for i in range(H):
    a = list(map(str, input()))
    square += a

for i in range(H*W):
    if square[i] == '#':
        if i % W != 0:
            if square[i+1] == '#' or square[i-1] == '#':
                continue
        else:
            if square[i+1] == '#':
                continue
        if i-W > 0:
            if square[i-W] == '#':
                continue
        if i+W < H*W:
            if square[i+W] == '#':
                continue
        print('No')
        sys.exit()
        
print('Yes')
            


### FIXED CODE ###

import sys

H, W = map(int, input().split())
square = []
for i in range(H):
    a = list(map(str, input()))
    square += a

if H == W == 1:
    print('Yes')
    sys.exit()
    
for i in range(H*W):
    if square[i] == '#':
        if i % W != W-1:
            if square[i+1] == '#':
                continue
        if i % W != 0:
            if square[i-1] == '#':
                continue
            
        if i-W >= 0:
            if square[i-W] == '#':
                continue
        if i+W <= H*W:
            if square[i+W] == '#':
                continue
        print('No')
        sys.exit()
        
print('Yes')
a

### FIXED CODE ###

n=int(input())
h=int(input())
w=int(input())
print((n-h+1)*(n-w+1))
import math
n,m = map(int,input().split())
if n is 0 or n is 1:
  print(math.factorial(m)/math.factorial(m-2)/2)
if m is 0 or m is 1:
  print(math.factorial(n)/math.factorial(n-2)/2)
else:
  print(math.factorial(n+m)/math.factorial(n+m-2)/2)

### FIXED CODE ###

n,m = map(int,input().split())
print(int(n*(n-1)/2 + m*(m-1)/2))
def main():
    H, W = list(map(int, input().split(" ")))
    a = []
    for r in range(H):
        a += [input()]
    output = solve(H, W, a)
    for s in output:
        print(s)
    return

#________________________________________
#  Solve
#________________________________________
def solve(H, W, a):
    """
    解答のコード
    """
    index_list = []
    for _r in range(H):
        for _c in range(W):
            if a[_r][_c] is not ".":
                break
            if _c == W-1:
                index_list += [_r]
    for i in index_list:
        del a[i]

    index_list = []
    a = list(map(list, zip(*a)))
    for _r in range(len(a)):
        for _c in range(len(a[0])):
            if a[_r][_c] is not ".":
                break
            if _c == len(a[0])-1:
                index_list += [_r]
    for i in index_list:
        del a[i]
    a = list(map(list, zip(*a)))
    a = [ "".join(a[i]) for i in range(len(a))]
    return a
#________________________________________


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    H, W = list(map(int, input().split(" ")))
    a = []
    for r in range(H):
        a += [input()]
    output = solve(H, W, a)
    for s in output:
        print(s)
    return

#________________________________________
#  Solve
#________________________________________
def solve(H, W, a):
    """
    解答のコード
    """
    index_list = []
    for _r in range(H):
        for _c in range(W):
            if a[_r][_c] is not ".":
                break
            if _c == W-1:
                index_list += [_r]
    j = 0
    for i in index_list:
        del a[i-j]
        j += 1

    index_list = []
    a = list(map(list, zip(*a)))
    for _r in range(len(a)):
        for _c in range(len(a[0])):
            if a[_r][_c] is not ".":
                break
            if _c == len(a[0])-1:
                index_list += [_r]
    j = 0
    for i in index_list:
        del a[i-j]
        j += 1
    a = list(map(list, zip(*a)))
    a = [ "".join(a[i]) for i in range(len(a))]
    return a
#________________________________________


if __name__ == "__main__":
    main()
n,k = map(int,input().split())
s = input()
s[k-1] = s[k-1].lower()
print(s)

### FIXED CODE ###

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

s[k-1] = s[k-1].lower()
print(''.join(s))
N,M=map(int,input().split())
X=[int(i) for i in input().split()]
X.sort()
count=[]
sum=0
if n<m:
  for i in range(M):
    if i != 0:
      count.append(X[i]-get)
      sum+=count[i-1]
    get=X[i]
  count.sort(reverse=True)
  if count != []:
    for i in range(N-1):
      sum-=count[i]
print(sum)

### FIXED CODE ###

N,M=map(int,input().split())
X=[int(i) for i in input().split()]
X.sort()
count=[]
sum=0
if N<M:
  for i in range(M):
    if i != 0:
      count.append(X[i]-get)
      sum+=count[i-1]
    get=X[i]
  count.sort(reverse=True)
  if count != []:
    for i in range(N-1):
      sum-=count[i]
print(sum)
a, b, c = [int(x) for x in input().split()]

from math import gcd

def foo(a, b, c):
    if a == 1:
        return "YES"
    elif b == 1:
        return "NO"
    elif gcd(a, b) ==1:
        return "NO:
    else:
        return "YES"

### FIXED CODE ###

a, b, c = [int(x) for x in input().split()]
 
def foo(a, b, c):
    for i in range(1, b+1):
        if (a*i)%b == c:
            return "YES"
    return "NO"
    
print(foo(a, b, c))
n = int(input())
l = [int(i + 1 == e) for i, e in enumerate(map(int, input().split()))]
res = 0
for i in range(n):
    if l[i]:
        if l[i + 1]: l[i + 1] = 0
        res += 1
print(res)

### FIXED CODE ###

n = int(input())
l = [int(i + 1 == e) for i, e in enumerate(map(int, input().split()))]
res = 0
for i in range(n):
    if l[i]:
        if i + 1 < n and l[i + 1]: l[i + 1] = 0
        res += 1
print(res)
n, m = map(int, input().split())
pair = []
for i in range(m):
	pair.append(list(map(int, input().split())))
pair = pair[::-1]
ans = []
ans.append(int(n*(n-1)/2))

class UnionFind:
    def __init__(self, n):
        self.par = [-1] * (n+1)
        self.rank = [0] * (n+1)

    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        elif self.size(x) < self.size(y):
            x, y = y, x
        self.par[x] += self.par[y]
        self.par[y] = x
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1
        return True

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

u = UnionFind(n)
for i in range(len(pair) - 1):
    if u.union(pair[i][0], pair[i][1]) == True:
        ans.append(int(ans[i] - u.size(pair[i][0]) * u.size(pair[i][1])))
    u.union(pair[i][0], pair[i][1])
ans = ans[::-1]
for i in range(len(ans)):
    print(ans[i])

### FIXED CODE ###

n, m = map(int, input().split())
pair = []
for i in range(m):
	pair.append(list(map(int, input().split())))
pair = pair[::-1]
ans = []
ans.append(int(n*(n-1)/2))

class UnionFind:
    def __init__(self, n):
        self.par = [-1] * (n+1)
        self.rank = [0] * (n+1)

    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.size(x) < self.size(y):
            x, y = y, x
        self.par[x] += self.par[y]
        self.par[y] = x
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1
        return

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

u = UnionFind(n)
for i in range(len(pair) - 1):
    if u.find(pair[i][0]) != u.find(pair[i][1]):
        ans.append(max(0, int(ans[i] - u.size(pair[i][0]) * u.size(pair[i][1]))))
    else:
        ans.append(ans[i])
    u.union(pair[i][0], pair[i][1])
ans = ans[::-1]
for i in range(len(ans)):
    print(ans[i])
import sys
p=0
n=int(input())
xyh=[[] for i in range(n)]
for i in range(n):
    x,y,h=map(int,input().split())
    xyh[i].append(x)
    xyh[i].append(y)
    xyh[i].append(h)
for i in range(101):
    for j in range(101):
        f=0
        dis=[[i] for i in range(205)]
        for q in range(n):
            x=xyh[q][0]
            y=xyh[q][1]
            h=xyh[q][2]
            d=abs(x-i)+abs(y-j)
            if len(dis[d])==1:
                dis[d].append(h)
            elif dis[d][1]!=h:
                f=1
        
        dis=[dis[e] for e in range(205) if len(dis[e])!=1]
        m=len(dis)
        if m==1 and f==0:
            print(i,j,dis[0][0]+dis[0][1])
            p+=1
        else:
            if all(dis[e][0]+dis[e][1]==dis[e+1][0]+dis[e+1][1] for e in range(m-1)) and f==0:
                print(i,j,dis[0][0]+dis[0][1])
                P+=1
if P>=2:
    print(l)
        
        
        
          


### FIXED CODE ###

import sys

n=int(input())
xyh=[[] for i in range(n)]
for i in range(n):
    x,y,h=map(int,input().split())
    xyh[i].append(x)
    xyh[i].append(y)
    xyh[i].append(h)
for i in range(101):
    for j in range(101):
        f=0
        dis=[[i] for i in range(205)]
        for q in range(n):
            x=xyh[q][0]
            y=xyh[q][1]
            h=xyh[q][2]
            d=abs(x-i)+abs(y-j)
            
            if len(dis[d])==1:
                dis[d].append(h)
            elif len(dis[d])!=1 and dis[d][1]!=h:
                f=1
        
        dis=[dis[e] for e in range(205) if len(dis[e])!=1]
        m=len(dis)
        if m==1 and f==0:
            print(i,j,dis[0][0]+dis[0][1])
            sys.exit()
            
        else:
            if all(dis[e][0]+dis[e][1]==dis[e+1][0]+dis[e+1][1] for e in range(m-1) if dis[e+1][1]!=0) and f==0:
                print(i,j,dis[0][0]+dis[0][1])
                sys.exit()
import sys
import bisect
input = sys.stdin.readline

a,b,q = map(int, input().split())
s = [-1 for i in range(a)]
t = [-1 for i in range(b)]

for i in range(a):
	S = int(input())
    s[i] = S
    
for i in range(b):
	T = int(input())
    t[i] = T
    
s.sort()
t.sort()

for i in range(q):
	x = int(input())
    slidx = bisect.bisect_left(s, x)
    tlidx = bisect.bisect_left(t, x) 
	sl = x - s[slidx]
	tl = x - t[tlidx]
    tr = 90000000000 - x
    sr = 90000000000 - x
    if slidx < a-1:
      sr = s[slidx+1] - x
    if slidx < b-1:
      tr = t[tlidx+1] - x
    dist = min( [max(sl,tl), max(sr,tr), min(sr, sl)*2 + min(tr,tl), min(tr,tl)*2 + min(sr,sl)] )
    print(dist)

### FIXED CODE ###

import sys
import bisect
input = sys.stdin.readline

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

s = [-1 for i in range(a)]
t = [-1 for i in range(b)]

for i in range(a):
	S = int(input())
	s[i] = S
    
for i in range(b):
	T = int(input())
	t[i] = T
    
s.sort()
t.sort()
for i in range(q):
	x = int(input())

	slidx = bisect.bisect_left(s, x) -1
	tlidx = bisect.bisect_left(t, x) -1
	sl = -20000000000
	tl = -20000000000
	sr = 20000000000
	tr = 20000000000
	if slidx >= 0:
		sl = s[slidx]
	if tlidx >= 0:
		tl = t[tlidx]

	if slidx < a-1:
		sr = s[slidx+1]
	if tlidx < b-1:
		tr = t[tlidx+1]
	sl = x - sl
	tl = x - tl
	sr = sr - x
	tr = tr - x
	#print([sl,tl,sr,tr])
	dist = min( [max(sl,tl), max(sr,tr), min(sr, sl)*2 + min(tr,tl), min(tr,tl)*2 + min(sr,sl)])
	print(dist)
#!/usr/bin/env python3
import math
a, b, c, d = map(int, input().split())
h = abs(a - c)
w = abs(b - d)
h1 = h // math.gcd(h, w)
w1 = w // math.gcd(h, w)
print((h1 + w1 - 1) * math.gcd(h, w))


### FIXED CODE ###

#!/usr/bin/env python3
import fractions
a, b, c, d = map(int, input().split())
h = abs(a - c)
w = abs(b - d)
if h == 0 or w == 0:
    ans = 0
else:
    h1 = h // fractions.gcd(h, w)
    w1 = w // fractions.gcd(h, w)
    ans = (h1 + w1 - 1) * fractions.gcd(h, w)
print(ans)
h,w = map(int, input().split())
Array = [list(map(int, input().split())) for _ in range(h)]
dx = [1,1,0,-1,-1,-1,0,1]
dy = [0,1,1,1,0,-1,-1,-1]
for i in range(h):
  for j in range(w):
    if Array[i][j]='#':
      continue
      
    num=0
    for d in range(8):
      ni = i+dy[d]
      nj = j+dx[d]
      if ni<0 or h<=ni:
        continue
      if nj<0 or w<=nj:
        continue
      if Array[ni][nj]=='#':
        num=num+1
        
    Array[i][j]=char(num + '0')
    
for i in Array:
  print(*Array)

### FIXED CODE ###

h,w = map(int,input().split())
Array = [list(map(str,input())) for _ in range(h)]
dx = [1,1,0,-1,-1,-1,0,1]
dy = [0,1,1,1,0,-1,-1,-1]
for i in range(h):
  for j in range(w):
    if Array[i][j]=='#':
      continue
    num=0
    for d in range(8):
      ni = i+dy[d]
      nj = j+dx[d]
      if ni<0 or h<=ni:
        continue
      if nj<0 or w<=nj:
        continue
      if Array[ni][nj]=='#':
        num=num+1
    Array[i][j]=str(num)
    
for i in Array:
  print(*i, sep='')
a

### FIXED CODE ###

ls = {'A':'T','C':'G','T':'A','G':'C'}
print(ls[input()])