Harryxun/stf_run huggingface dataset:
class Circle():
    # 中心p、半径rの円
    def __init__(self, p, r):
        self.p = p
        self.r = r

    def contain(self, q):
        # 点qを含むか判定
        px, py = self.p
        qx, qy = q
        return (px-qx)**2+(py-qy)**2 <= self.r**2


def enclose(P):
    # 点のリストPの最小包含円
    n = len(P)
    if n == 2:
        ax, ay = P[0]
        bx, by = P[1]
        r = ((ax-bx)**2+(ay-by)**2)**0.5/2
        p = ((ax+bx)/2, (ay+by)/2)
        return Circle(p, r)
    if n == 3:
        p0, p1, p2 = P[0], P[1], P[2]
        circle0 = enclose([p1, p2])
        circle1 = enclose([p2, p0])
        circle2 = enclose([p0, p1])
        if circle0.contain(p0):
            circle = circle0
        elif circle1.contain(p1):
            circle = circle1
        elif circle2.contain(p2):
            circle = circle2
        else:
            p0x, p0y = p0
            p1x, p1y = p1
            p2x.p2y = p2
            A = p1x*p2x+p1y*p2y
            B = p2x*p0x+p2y*p0y
            C = p0x*p1x+p0y*p1y
            a = A*(B+C-A)
            b = B*(C+A-B)
            c = C*(A+B-C)
            px = (a*p0x+b*p1x+c*p2x)/(a+b+c)
            py = (a*p0y+b*p1y+c*p2y)/(a+b+c)
            r = ((px-p0x)**2+(py-p0y)**2)**0.5/2
            circle3 = Circle((px, py), r)
            if circle3.r < circle.r:
                circle = circle3
        return circle
    for i in range(n-2):
        for j in range(i, n-1):
            for k in range(j, n):
                circle = enclose([P[i], P[j], P[k]])
                if all([circle.contain(P[l]) for l in range(n)]):
                    return circle


n = int(input())
P = []
for i in range(n):
    x, y = map(int, input().split())
    P.append((x, y))
print(enclose(P).r)


### FIXED CODE ###

import numpy as np
N = int(input())
P = []
for n in range(N):
    x, y = map(int, input().split())
    P.append((x, y))


def dist(p0, p1):
    x0, y0, x1, y1 = p0[0], p0[1], p1[0], p1[1]
    return (x0 - x1) ** 2 + (y0 - y1) ** 2


def f(x, y):
    return max([dist(p, (x, y)) for p in P])


def minfx(y):
    left = 0
    right = 1000
    for _ in range(80):
        left_ = left * (2 / 3) + right * (1 / 3)
        right_ = left*(1/3)+right*(2/3)
        if f(left_, y) <= f(right_, y):
            right = right_
        else:
            left = left_
    x0 = (left + right) / 2
    return f(x0, y)


left = 0
right = 1000
for _ in range(80):
    left_ = left * (2 / 3) + right * (1 / 3)
    right_ = left*(1/3)+right*(2/3)
    if minfx(left_) <= minfx(right_):
        right = right_
    else:
        left = left_
y0 = (left + right) / 2
print(np.sqrt(minfx(y0)))
L = list(map(int, input().split()))

L.pop(L[L.index(max(L))])
S = 1
for i in range(2):
  S *= L[i]
  
print(S)


### FIXED CODE ###

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

L.remove(L[L.index(max(L))])
S = 1
for i in range(2):
  S *= L[i]
  
print(S//2)
a,b,c,d = input()
pass = [int(a),int(b),int(c),int(d)]

if pass[0]==pass[1] or pass[1]==pass[2] or pass[2]==pass[3]:
    print("bad")

else:
    print("good")

### FIXED CODE ###

a,b,c,d = input()

if a==b or b==c or c==d:
  print("Bad")
else:
  print("Good")
import sys


def main():
    input = sys.stdin.readline
    ryori_list = [int(input()) for _ in range(5)]
    loss_list = [10 - (r % 10) for r in ryori_list if r % 10]
    print(sum(ryori_list) + sum(loss_list) - max(loss_list))


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys


def main():
    input = sys.stdin.readline
    ryori_list = [int(input()) for _ in range(5)]
    loss_list = [10 - (r % 10) for r in ryori_list if r % 10] or [0]
    print(sum(ryori_list) + sum(loss_list) - max(loss_list))


if __name__ == "__main__":
    main()
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from math import pi
from bisect import bisect_left
def resolve():
    x1,y1,x2,y2=map(int,input().split())
    if(x1>x2): x1,y1,x2,y2=x2,y2,x1,y1 # x1<=x2
    trans=False
    if(y1>y2):
        y1,y2=10**8-y1,10**8-y2 # y1<=y2
        trans=True

    n=int(input())
    XY=[]
    for i in range(n):
        x,y=map(int,input().split())
        if(trans): x,y=10**8-x,10**8-y
        if(x1<=x<=x2 and y1<=y<=y2):
            XY.append((x,y))

    d=(x2-x1)+(y2-y1) # マンハッタン
    d*=100

    if(x1==x2 or y1==y2):
        if(XY): d+=10*pi-20
        print(d)
        return

    # XYのLISを求めて、その個数*(20-5pi)を引けばよい
    XY.sort()
    C=[INF]*n
    for x,y in XY:
        i=bisect_left(C,y)
        C[i]=y
    k=C.index(INF)
    d-=k*(20-5*pi)
    print(d)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from math import pi
from bisect import bisect_left
def resolve():
    x1,y1,x2,y2=map(int,input().split())
    if(x1>x2): x1,y1,x2,y2=x2,y2,x1,y1 # x1<=x2
    trans=False
    if(y1>y2):
        y1,y2=-y1,-y2 # y1<=y2
        trans=True

    n=int(input())
    XY=[]
    for i in range(n):
        x,y=map(int,input().split())
        if(trans): y=-y
        if(x1<=x<=x2 and y1<=y<=y2):
            XY.append((x,y))

    d=(x2-x1)+(y2-y1) # マンハッタン
    d*=100
    l=min(x2-x1,y2-y1)

    # XYのLISを求めて、その個数*(20-5pi)を引けばよい
    XY.sort()
    C=[INF]*(n+1)
    for x,y in XY:
        i=bisect_left(C,y)
        C[i]=y
    k=C.index(INF)
    # LISの数が l より大きい時 -> 1回は無駄にしてしまう
    if(k>l):
        d-=(k-1)*(20-5*pi)
        d+=10*pi-20
    else:
        d-=k*(20-5*pi)
    print(d)
resolve()
5 3 6 8
-10 3 1 5 -100
100 6 14

### FIXED CODE ###

N, M, X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
accept = False

x_max = max(x)
y_min = min(y)
if X < Y:
    z = [i for i in range(X+1, Y+1)]
    
    for i in z:
        if x_max < i and i <= y_min:
            accept = True
            break
if accept:
    print("No War")
else:
    print("War")
N, T = map(int, input().split())
paths = []
for i in range(N):
	cost, time = map(int, input().split())
   	if time < T: 
	  	paths.append(cost)
print(min(paths))
    


### FIXED CODE ###

N,T = map(int,input().split())
paths = []
for i in range(N):
  cost, time = map(int,input().split())
  if time <= T:
    paths.append(cost)
if len(paths) == 0:
  print("TLE")
else:
  print(min(paths))
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
num=[0,2,5,5,4,5,6,3,7,6]
canmake=dict()
b=[]
for i in a:
    b.append(num[i])
    if num[i] not in canmake.keys():
        canmake[num[i]]=i
b.sort()
c=[]
d=[]
amari=n%b[0]
longest=n//b[0]
if amari==0:print(str(b[0])*(n//b[0]))
#何ケタ減らすと丁度になるか求める
for i in range(1,len(b)):
    count=0
    now=amari
    while True:
        count+=1
        now+=b[0]
        if count>b[i]:break
        if now%b[i]==0:
            c.append(count-now//b[i])
            d.append((count,now//b[i],b[i]))
            break
res=min(c)
ans=[]
for i in range(c.count(res)):
    an=dict()
    idx=c.index(res)
    an[b[0]]=longest-d[idx][0]
    an[d[idx][2]]=d[idx][1]
    ans.append(an)
    c[idx]=-1

result=0
for i in ans:
    x=[]
    for i in an.keys():
        x.append((canmake[i],an[i]))
    x.sort(key=lambda y:y[0])
    re=''
    for i in range(len(x)):
        y=x.pop()
        re+=str(y[0])*y[1]
    ima=int(re)
    if ima>result:result=ima
        
if amari!=0:print(result)


### FIXED CODE ###

N,M=map(int,input().split())
A=list(map(int,input().split()))
match=[0,2,5,5,4,5,6,3,7,6]
make=dict()
for a in A:
    make[a]=match[a]
dp=[-1]*(N+1)
dp[0]=0
for k in range(1,1+N):
    for d,m in make.items():
        if k-m<0 or dp[k-m]==-1:continue
        dp[k]=max(dp[k],dp[k-m]+1)
        
ans=''
now=N
for k in range(dp[N]):
    res=(0,0)
    for d,m in make.items():
        if now-m<0:continue
        if dp[now-m]+1==dp[now] and res[0]<d:
            res=(d,m)
    ans+=str(res[0])
    now-=res[1]
print(int(ans))
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = lr()
A = np.array(lr())
g = np.gcd.reduce(A)
print(g)


### FIXED CODE ###

from functools import reduce
from fractions import gcd

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

answer = reduce(gcd, A)
print(answer)
s=input().split()
print(int[1]-(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))/2)

### FIXED CODE ###

s=input().split()
print(-int(s[0])+(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))//2)
n, k = map(int, input().split())
s = input()


def split(s):
    last = ''
    new = []
    for x in s:
        if last != x:
            new.append(x)
        else:
            new[-1] += x
        last = x
    return new


def transform(s, k):

    for _ in range(k):
        s = split(s)
        ls = list(map(len, s))
        idx = ls.index(min(ls))
        if idx == 0:
            idx = ls[1:].index(min(ls[1:]))+1

        # print(s, idx, ls)
        s[idx] = s[idx].replace('L', 'X').replace('R', 'L').replace('X', 'R')
        s = ''.join(s)
    # print(s)
    return s


s = transform(s, k)


def count(s):
    cnt = 0
    for i in range(len(s)):
        if i+1 < len(s) and s[i] == 'R' and s[i+1] == 'R':
            cnt += 1
        elif i-1 >= 0 and s[i] == 'L' and s[i-1] == 'L':
            cnt += 1
    return cnt


print(count(s))


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n, k = map(int, input().split())
s = input().rstrip()

def count(s):
    cnt = 0
    for i in range(n):
        if i+1 < len(s) and s[i] == 'R' and s[i+1] == 'R':
            cnt += 1
        elif i-1 >= 0 and s[i] == 'L' and s[i-1] == 'L':
            cnt += 1
    return cnt


print(min(count(s)+2*k, n-1))
import numpy as np

N, M = map(int, input().split())
a = np.array(list(map(int, input().split())))

if N == 1:
    for i in range(M):
        a //= 2
    print(a[0])
    exit()

a.sort()
cur = M - 1
for i in range(M):
    if i == 0:
        a[-1] //= 2
    else:
        if (a[cur-1] > a[cur]):
            cur -= 1
            a[a[cur:].argmax()+cur] //= 2
        else:
            if cur == M-1:
                a[-1] //= 2
            else:
                a[a[cur:].argmax()+cur] //= 2
print(sum(a))


### FIXED CODE ###

import heapq

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

q = []
for i in range(N):
    # 最も大きい値を取り出して1/2したいので、ここで反転させておき、最終的に足す時に戻す
    heapq.heappush(q, -a[i])
for i in range(M):
    l = heapq.heappop(q)
    heapq.heappush(q, -(-l//2))
print(-sum(q))
S=raw_input()
h=S/3600
S=S%3600
r=S/60
s=S%60
print h:r:s

### FIXED CODE ###

S=input()
h=S/3600
r=S%3600/60
s=S-h*3600-r*60
print str(h)+':'+str(r)+':'+str(s)
n = int(input())
s = list(map(int, input().strip().split(' ')))

for i in range(0, n // 2):
    s[i], s[n - i] = s[n - i], s[i]

for i in range(0, len(s)):
    if i != len(s - 1):
        print(s[i], end=" ")
    else:
        print(s[i])



### FIXED CODE ###

n = int(input())
s = list(map(int, input().strip().split(' ')))
t = n // 2

for i in range(0, n // 2):
    s[i], s[n - i - 1] = s[n - i - 1], s[i]

for i in range(0, len(s)):
    if i != len(s) - 1:
        print(s[i], end=" ")
    else:
        print(s[i])
a = []
while True:
    n = input()
    if n == 0:
        break
    a.append(n)

for i in range(a):
    print("case " + str(i) + ": " + str(a[i]))

### FIXED CODE ###

a = []
while True:
	n = input()
	if n == "0":
		break
	a.append(n)

for i in range(len(a)):
	print("Case " + str(i + 1) + ": " + a[i])
H,W = map(int,raw_input().split())
count = 0
c = []
d = 0
e = []
for i in range(H):
  count += 1
  a = raw_input().split()
  b = []
  for j in range(W):
    b.append(int(a[j]))
  for k in range(W-1):
    if b[k]%2 == 1:
      d += 1
      f = [count,k+1,count,k+2]
      e.append(f)
      b[k] -= 1
      b[k+1] += 1
  c.append(b[W-1])
count = 0
for i in range(H-1):
  count += 1
  if c[i]%2 == 1:
    d += 1
    f = [count,k+1,count,k+2]
    e.append(f)
print d
for i in range(d):
  x = e[i]
  print x[0],x[1],x[2],x[3]

### FIXED CODE ###

H,W = map(int,raw_input().split())
count = 0
c = []
d = 0
e = []
for i in range(H):
  count += 1
  a = raw_input().split()
  b = []
  for j in range(W):
    b.append(int(a[j]))
  for k in range(W-1):
    if b[k]%2 == 1:
      d += 1
      f = [count,k+1,count,k+2]
      e.append(f)
      b[k] -= 1
      b[k+1] += 1
  c.append(b[W-1])
count = 0
for i in range(H-1):
  count += 1
  if c[i]%2 == 1:
    d += 1
    f = [count,W,count+1,W]
    e.append(f)
    c[i] -= 1
    c[i+1] +=1
print d
for i in range(d):
  x = e[i]
  print x[0],x[1],x[2],x[3]
if S == 'Sunny':
	print('Cloudy')
elif S == 'Cloudy':
	print('Rainy')
else:
	print('Sunny')

### FIXED CODE ###

S = input()
if S == 'Sunny':
	print('Cloudy')
elif S == 'Cloudy':
	print('Rainy')
elif S == 'Rainy':
	print('Sunny')
import math

a,b,c,d=map(int,input().split())
cn1=0
cn2=0
cn3=0
an1=0
an2=0
an3=0
cnt=0
ans=0
lm=(c*d)//math.gcd(c,d)

#bまで
cn1=b//c
cn2=b//d
cn3=b//lm
#aまで
an1=(a-1)//c
an2=(a-1)//d
an3=(a-1)//lm
#aからbまで
cn1=cn1-an1
cn2=cn2-an2
cn3=cn3-an3

cnt=cn1+cn2-cn3
ans=b-a-cnt

print(ans+1)


### FIXED CODE ###

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

a,b,c,d=map(int,input().split())
cn1=0
cn2=0
cn3=0
an1=0
an2=0
an3=0
cnt=0
ans=0
lm=(c*d)//gcd(c,d)

#bまで
cn1=b//c
cn2=b//d
cn3=b//lm
#aまで
an1=(a-1)//c
an2=(a-1)//d
an3=(a-1)//lm
#aからbまで
cn1=cn1-an1
cn2=cn2-an2
cn3=cn3-an3

cnt=cn1+cn2-cn3
ans=b-a-cnt

print(ans+1)
s = input()
if '7' in s:
  print("Yes)
else:
  print("No")

### FIXED CODE ###

s = input()
if '7' in s:
  print("Yes")
else:
  print("No")
# ans

N = int(input())
a = list(map(int, input().split()))
print(sum(a) = N)

### FIXED CODE ###

# ans

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

ans = 0

for i in range(N):
  ans += a[i] - 1
  
print(ans)
import sys
input = sys.stdin.readline
import numpy as np
def getNearestValue(list, num):
	idx = np.abs(np.asarray(list) - num).argmin()
	return list[idx]

N=int(input())
A=list(map(int,input().split()))
A.sort()
n=A.pop()
r=getNearestValue(A,n/2)



print(n,r)


### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np
def getNearestValue(list, num):
	idx = np.abs(np.asarray(list) - num).argmin()
	return list[idx]

N=int(input())
A=list(map(int,input().split()))
A.sort()
n=A.pop()
r=getNearestValue(A,n/2)



print(n,r)
import sys
sys.setrecursionlimit=10**12

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    for x in neighbor[p]:
        if x!=par[p]:
            par[x]=p
            descend[p]+=cur(x)
    return descend[p]

def cur2(p):
    for x in neighbor[p]:
        if x==par[p]: continue
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[[]  for _ in range(n+1)]
descend=[1]*(n+1)
par=[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].append(b)
    neighbor[b].append(a)
cur(1)

ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    if neighbor[p]==[]: return
    for x in neighbor[p]:
        par[x]=p
        neighbor[x].remove(p)
        cur(x)
    descend[par[p]]+=descend[p]

def cur2(p):
    for x in neighbor[p]:
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[set()  for _ in range(n+2)]
descend=[1 for i in range(n+1)]
par=[0]+[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].add(b)
    neighbor[b].add(a)

cur(1)


ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])
X=int(input())
def momo(s)
if int(s)>N:
  return 0

nagi=1 if all(s.count(c)>0 for c in '753') else 0
  for c in '753':
    nagi+=momo(s+c)
    return nagi
print(momo('0'))

### FIXED CODE ###

X=int(input())
def momo(s):
  if int(s)>X:
    return 0
  nagi=1 if all(s.count(c)>0 for c in '753') else 0
  for c in '753':
    nagi+=momo(s+c)
  return nagi
print(momo('0'))
import collections
a,b,c,d = input().split()
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
print(max(res))

### FIXED CODE ###

import collections
a,b,c,d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi<0 and abm>0:
  res1=[abi,-1,0,1,abm]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi<0 and cdm>0:
  res2=[cdi,-1,0,1,cdm]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
#print(res)
print(max(res))
N = int(input())
arr = map(int, input().split(' '))
ans = [0 for x in range(N)]
for i in reversed(range(N)):
  n = i + 1
  if i > N/2.0:
    ans[i] == 0:
  else:
    s = 0
  	for k in reversed(range(1, N // n)):
    	index = n*k - 1
        s += arr[index]
    if s % 2 == arr[i]:
      ans[i] = 0
    else:
      ans[i] = 1
    	
ans_arr = []
for i in ans:
  if ans == 1:
    ans_arr.append(i)

print(sum(ans))
print(' '.join(ans_arr))


### FIXED CODE ###

def main():
    n = int(input())
    A = [0] + list(map(int, input().rstrip().split()))
    for i in range(n // 2, 0, -1):  # second half: no multiples
        A[i] = sum(A[i::i]) % 2
    ans = [i for i, j in enumerate(A) if j]
    print(len(ans))  # all cells: [1] -> len() (much faster than sum())
    print(*ans)


if __name__ == "__main__":
    main()
n = int(input())
s = input()

count = 0
for i in range(0, len(s)):
   if(s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
      count += 1
print(count)


### FIXED CODE ###

n = int(input())
s = input()

print(s.count('ABC'))
a = [input() for x in 3]
print(a[0][0] + a[1][1] + a[2][2])

### FIXED CODE ###

a = [input() for x in range(3)]
print(a[0][0] + a[1][1] + a[2][2])
new_D = [S_new[1: D], '#', S_new[D + 1: N]]
_ = ''.join(new_D)

import re
regex = r'##+'
matchobj = re.match(regex, _)
regex_dot = r'..+'
match_dot = re.match(regex_dot, _[D:])
if matchobj is not None and match_dot is None:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

#これが一番できたやつ

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

if D > C:
    if '##' in S[B:D] or '##' in S[A:C]:
        print('No')
    else:
        print('Yes')
elif C > D:
    if '...' in S[B - 2: D + 1] and '##' not in S[A: C]:
        print('Yes')
    else:
        print('No')
A, B, C, K = (int(x) for x in input().split())

a = [1] * A
b = [0] * B
c = [-1] * C

X = a + b + c
print(sum(X[:K]))


### FIXED CODE ###

A, B, C, K = map(int,input().split())
if K <= A:
    print(K)
elif K <= A + B:
    print(A)
else:
    print(2*A + B - K)
n,x=list(map(int,input()))
m=[]
sum=0
for i in range(n):
  mi=int(input())
  m.append(mi)
  sum+=mi

ans=n+(x-sum)/min(m)
print(ans)



### FIXED CODE ###

n,x=list(map(int,input().split()))
m=[]
sum=0
for i in range(n):
  mi=int(input())
  m.append(mi)
  sum+=mi

ans=n+int((x-sum)/min(m))
print(ans)
S = list(input())
S.append(1)
for i in range(26):
    if S.count(chr(97 + i)) >= 2:
        for j in range(len(S) - 1):
            if (S[j] == chr(97 + i)) and (S[j + 1] == chr(97 + i)):
                print(j+1, j+2)
                exit()
            if (S[j] == chr(97 + i)) and (S[j + 2] == chr(97 + i)):
                print(j+1, j+3)
                exit()
else:
    print("-1 -1")


### FIXED CODE ###

S = list(input())
S.append("A")
for j in range(len(S) - 2):
    if (S[j] == S[j + 1]):
        print(j+1, j+2)
        exit()
    if (S[j] == S[j + 2]):
        print(j+1, j+3)
        exit()
else:
    print("-1 -1")
a=list(map(int,input().split()))
a=sorted(a)
print(a)
if a=[5,5,7]:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

a=list(map(int,input().split()))
a=sorted(a)
if a==[5,5,7]:
    print("YES")
else:
    print("NO")
S=input()
if S[1]!= S[2] and S[1]!=S[3]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input()
if S == "AAA" or S == "BBB":
    print("No")
else:
    print("Yes")
n=int(input())
l=[]
for i in range(n):
  s,p=[x for x in input().rstrip().split()]
  l.append([s,int(p),i+1])
l.sort(key=lambda x:x[1],reverse=True)
l.sort(key=lambda x:x[0])

for s,p,i in l:
  print(i) 


### FIXED CODE ###

l = [int(i) for i in input().split() if i.isdigit()]
print(int((3 * l[0] + l[1]) / 2))
data=[]
while True:
    n = int(input())
    if n==0:
        break
    for i in range(n):
        spam=list(map(int,input().split()))
        spam.append(sum(spam))
        data.append(spam)
    spam=[]
    for i in range(n+1):
        spam.append(sum(x[i] for x in data))
    data.append(spam)
    for i in range(n+1):
        for j in range(n+1):
            print('{:5}'.format(data[i][j]),end='')
        print('')

### FIXED CODE ###

while True:
    data=[]
    n = int(input())
    if n==0:
        break
    for i in range(n):
        spam=list(map(int,input().split()))
        spam.append(sum(spam))
        data.append(spam)
    spam=[]
    for i in range(n+1):
        spam.append(sum(x[i] for x in data))
    data.append(spam)
    for i in range(n+1):
        for j in range(n+1):
            print('{:5}'.format(data[i][j]),end='')
        print('')
n,m = map(int,raw_input().strip().split(' '))
graph = [[] for i in range(n)]
for i in range(m):
    s,t = map(int,raw_input().strip().split(' '))
    graph[s].append(t)
    graph[t].append(s)
 
color = {}
c = 0
for i in range(n):
    if not i in color:
        que = [i]
        color[i] = c
        if len(que) > 0:
         for j in range (n):
            u = que[0]
            for v in graph[u]:
                if not v in color:
                    color[v] = c
                    que.append(v)
            del que[0]
        c += 1

### FIXED CODE ###

n,m = map(int,raw_input().strip().split(' '))
graph = [[] for i in range(n)]
for i in range(m):
    s,t = map(int,raw_input().strip().split(' '))
    graph[s].append(t)
    graph[t].append(s)
color = {}
c = 0
for i in range(n):
    if not i in color:
        que = [i]
        color[i] = c
        while len(que) > 0:
            u = que[0]
            for v in graph[u]:
                if not v in color:
                    color[v] = c
                    que.append(v)
            del que[0]
        c += 1
q = int(raw_input())
for i in range(q):
   s,t = map(int,raw_input().strip().split(' '))
   if color[s] == color[t]:
     print 'yes'
   else:
     print 'no'