Harryxun/stf_run huggingface dataset:
import sys
import math
from typing import List, Tuple


def len(lhs: Tuple[int, int], rhs: Tuple[int, int]):
    return math.sqrt((lhs[0] - rhs[0]) ** 2 + (lhs[1] - rhs[1]) ** 2)


def solve(n: int, cities: List[Tuple[int, int]]):
    sum = 0
    for i1, city1 in enumerate(cities):
        for i2, city2 in enumerate(cities):
            if i1 != i2:
                sum += len(city1, city2)
    return sum / n


def main():
    inputs = list(sys.stdin)
    n = int(inputs.pop(0))
    cities = [[int(n) for n in s.split(" ")] for s in inputs]
    print(solve(n, cities))


main()


### FIXED CODE ###

import sys
import math


def len(lhs, rhs):
    return math.sqrt((lhs[0] - rhs[0]) ** 2 + (lhs[1] - rhs[1]) ** 2)


def solve(n: int, cities):
    sum = 0
    for i1, city1 in enumerate(cities):
        for i2, city2 in enumerate(cities):
            if i1 != i2:
                sum += len(city1, city2)
    return sum / n


def main():
    inputs = list(sys.stdin)
    n = int(inputs.pop(0))
    cities = [[int(n) for n in s.split(" ")] for s in inputs]
    print(solve(n, cities))


main()
def m_d(n):
  return int(len(str(n)))
def m_N(A,B,n):
  return int((A * n) + (B * m_d(n)))
A,B,X = map(int,input().split())
l = 0
m = 10**9+1
while m-l>1:
  n=(l+m)//2
  if m_N(A,B,n)<=X:
    l=n
  else:
    m=n
print(l)

### FIXED CODE ###

days = ['SUN','MON','TUE','WED','THU','FRI','SAT']

S = input()

print(7 - days.index(S))
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    s = input()

    for i in range(len(s)/2):
        if s[i] = s[len(s)-1 -i]:
            print('No')
            return
    
    print('Yes')

solve()


### FIXED CODE ###

import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    s = input()


    for i in range(len(s)//2):
        if s[i] != s[len(s)-1 -i]:
            print('No')
            return
    
    print('Yes')

solve()
h, w = map(int, input().split())
arr = [list(map(int, input().split())) for _ in range(h)]

ans = []
for i in range(h):
    for j in range(w - 1):
        if arr[i][j] % 2 == 1:
            arr[i][j] -= 1
            arr[i][j + 1] += 1
            ans.append([i + 1, j + 1, i + 1, j + 2])

for i in range(h - 1):
    if arr[i][w - 1] % 2 == 1:
        arr[i][w - 1] -= 1
        arr[i + 1][w - 1] += 1
        ans.append([i + 1, j + 1, i + 2, j + 1])

print(len(ans))
for x in ans:
    print(*x)

### FIXED CODE ###

h, w = map(int, input().split())
arr = [list(map(int, input().split())) for _ in range(h)]

ans = []
for i in range(h):
    for j in range(w - 1):
        if arr[i][j] % 2 == 1:
            arr[i][j] -= 1
            arr[i][j + 1] += 1
            ans.append([i + 1, j + 1, i + 1, j + 2])

for i in range(h - 1):
    if arr[i][w - 1] % 2 == 1:
        arr[i][w - 1] -= 1
        arr[i + 1][w - 1] += 1
        ans.append([i + 1, w, i + 2, w])

print(len(ans))
for x in ans:
    print(*x)
# Problem C - Tsundoku

# input
N, M, K = map(int, input().split())
a_nums = list(map(int, input().split()))
b_nums = list(map(int, input().split()))

# initialization
a_i = -1
b_i = -1
max_count = 0
cur_count = 0

# dfs search
def dfs(a_i, b_i, cur_coin):
    global max_count
    global cur_count
    global K

    tmp_count1 = 0
    tmp_count2 = 0

    if a_i>=N or b_i>=M:
        if cur_count>max_count:
            max_count = cur_count

    # right check
    if a_i+1<N:
        if K - a_nums[a_i+1]>=0:
            K -= a_nums[a_i + 1]
            cur_coin += a_nums[a_i + 1]
            cur_count += 1
            dfs(a_i+1, b_i, cur_coin)
            cur_count -= 1
            cur_coin -= a_nums[a_i + 1]
            K += a_nums[a_i + 1]
        else:
            if cur_count>max_count:
                max_count = cur_count
    else:
        if cur_count>max_count:
            max_count = cur_count

    # left check
    if b_i + 1<M:
        if K - b_nums[b_i + 1]>=0:
            K -=b_nums[b_i + 1]
            cur_coin += b_nums[b_i + 1]
            cur_count += 1
            dfs(a_i, b_i+1, cur_coin)
            cur_count -= 1
            cur_coin -= b_nums[b_i + 1]
            K += b_nums[b_i + 1]
        else:
            if cur_count>max_count:
                max_count = cur_count
    else:
        if cur_count>max_count:
            max_count = cur_count

dfs(a_i, b_i, 0)

# output
print(max_count)


### FIXED CODE ###

# Problem C - Tsundoku

# input
N, M, K = map(int, input().split())
a_nums = list(map(int, input().split()))
b_nums = list(map(int, input().split()))

# initialization
max_count = 0
b_i = M
a_cums = [0]*(N+1)
b_cums = [0]*(M+1)
for i in range(1, N+1):
    if i>1:
        a_cums[i] = a_cums[i-1] + a_nums[i-1]
    else:
        a_cums[i] = a_nums[i-1]
for i in range(1, M+1):
    if i>1:
        b_cums[i] = b_cums[i-1] + b_nums[i-1]
    else:
        b_cums[i] = b_nums[i-1]

for i in range(N+1):
    if a_cums[i]<=K:
        while b_i>0 and a_cums[i]+b_cums[b_i]>K:
            b_i -= 1
        if i+b_i>max_count:
            max_count = i+b_i

# output
print(max_count)
import math
x=int(input())
ans=[1]
for i in range(2,x+1):
    #print(i)
    k=math.floor(math.log(x,i)))
    ans.append(i**(k+1))
print(max(ans))
#print(ans)


### FIXED CODE ###

import math
x=int(input())
if x<4:
    print(1)
else:
    k=0
    for i in range(int(math.sqrt(x))-1):
        l=0
        for j in range(x):
            if (i+2)**j>x:
                break
            else:
                l=(i+2)**j
        if l>k:
            k=l
    print(k)
import numpy as np


n,m = input().split()

n = int(n)
m = int(m)

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

ans = 0

sumlist = list(np.cumsum(a))
for i in range(n):
    # print(sumlist)
    # for j in range(len(sumlist)):
    #     if sumlist[j] % m == 0:
    #         ans += 1
    tmp = [x for x in sumlist if x % m == 0]
    ans += len(tmp)

    sumlist = list(map(lambda x:x - sumlist[0],sumlist))
    sumlist.pop(0)
print(ans)


### FIXED CODE ###

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

amari = n % k

if amari == 0:
    print(0)
else:
    print(1)
import numpy as np
H,W = map(int,input().split())
A = [[0]*W for i in range(H)]
B = [[0]*W for i in range(W)]
for i in range(H):
  inf = [int(c) for c in input().split()]
  for j in range(W):
    A[i][j] = inf[j]
    
for i in range(H):
  inf = [int(c) for c in input().split()]
  for j in range(W):
    B[i][j] = inf[j]

X = (H + W) * 80
L = X + X + 1
# X点持った状態から始める
dp = [[0] * W for _ in range(H)]
d = abs(A[0][0] - B[0][0])
dp[0][0] = np.zeros(L,np.bool)
dp[0][0][X+d] = 1
for h in range(H):
    for w,(a,b) in enumerate(zip(A[h],B[h])):
        if h == w == 0:
            continue
        d = abs(a - b)
        x = np.zeros(L,np.bool)
        if h != 0:
            x[d:] |= dp[h-1][w][:L-d]
            x[:L-d] |= dp[h-1][w][d:]
        if w != 0:
            x[d:] |= dp[h][w-1][:L-d]
            x[:L-d] |= dp[h][w-1][d:]
        dp[h][w] = x

dp2 = dp[-1][-1]
can_make = np.where(dp2)[0] - X

answer = np.abs(can_make).min()
print(answer)

### FIXED CODE ###

import numpy as np
H,W = map(int,input().split())
A = [[0]*W for i in range(H)]
B = [[0]*W for i in range(H)]
for i in range(H):
  inf = [int(c) for c in input().split()]
  for j in range(W):
    A[i][j] = inf[j]
    
for i in range(H):
  inf = [int(c) for c in input().split()]
  for j in range(W):
    B[i][j] = inf[j]

X = (H + W) * 80
L = X + X + 1
# X点持った状態から始める
dp = [[0] * W for _ in range(H)]
d = abs(A[0][0] - B[0][0])
dp[0][0] = np.zeros(L,np.bool)
dp[0][0][X+d] = 1
for h in range(H):
    for w,(a,b) in enumerate(zip(A[h],B[h])):
        if h == w == 0:
            continue
        d = abs(a - b)
        x = np.zeros(L,np.bool)
        if h != 0:
            x[d:] |= dp[h-1][w][:L-d]
            x[:L-d] |= dp[h-1][w][d:]
        if w != 0:
            x[d:] |= dp[h][w-1][:L-d]
            x[:L-d] |= dp[h][w-1][d:]
        dp[h][w] = x

dp2 = dp[-1][-1]
can_make = np.where(dp2)[0] - X

answer = np.abs(can_make).min()
print(answer)
inp = input()

s = 0

for i in range(len(inp)-3):
	num = int(inp[i:-1])
    while num >2019:
		if num % 2019 == 0:
			s += 1
		num = num / 10

print(s)

### FIXED CODE ###

from collections import defaultdict

s = input()

rests = [0]
n = 0
a = 0
m = 1
c = defaultdict(int)
c[0] += 1
for i in list(s)[::-1]:
    n = n + int(i)*m

    c[n % 2019] += 1
    m = m * 10 % 2019

for v in c.values():
    a += v * (v-1) // 2
print(a)
r1, c1, r2, c2 = map(int, input().split())

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
MOD = 10**9+7
for i in range(2, 2*10**6+1):
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD // i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

def memo_comb(n, r, mod=MOD):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n-r] % mod

def g(r, c):
  res = 0
  for i in range(r+1):
    res += memo_comb(i+c+1, i+1)
    res %= MOD
  
  return res

ans = g(r2, c2) - g(r2, c1-1) - g(r1-1, c2) + g(r1-1, c1-1)
ans %= MOD
print(ans)

### FIXED CODE ###

r1, c1, r2, c2 = map(int, input().split())

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
MOD = 10**9+7
for i in range(2, 2*10**6+2):
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD // i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

def memo_comb(n, r, mod=MOD):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n-r] % mod

def g(r, c):
  res = 0
  for i in range(r+1):
    res += memo_comb(i+c+1, i+1)
    res %= MOD
  
  return res

ans = g(r2, c2) - g(r2, c1-1) - g(r1-1, c2) + g(r1-1, c1-1)
ans %= MOD
print(ans)
import math
a, b, c=input().split(" ")
 
if math.sqrt(a) + math.sqrt(b) < math.sqrt(c):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import math
a, b, c=input().split(" ")
a = int(a) 
b = int(b)
c = int(c) 

if  4*a*b < (c-a-b)*(c-a-b) and (c-a-b)>0:
  print("Yes")
else:
  print("No")
n = int(intput())
a = []
for i in range(n):
  a.append(input())
print('AC x ' + str(a.count('AC')))
print('WA x ' + str(a.count('WA')))
print('TLE x ' + str(a.count('TLE')))
print('RE x ' + str(a.count('RE')))

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
  a.append(input())
print('AC x ' + str(a.count('AC')))
print('WA x ' + str(a.count('WA')))
print('TLE x ' + str(a.count('TLE')))
print('RE x ' + str(a.count('RE')))
g = [31,28,31,30,31,30,31,31,30,31,30,31]
 
tmp = input().split(" ")
print("Yes") if g[int(tmp[0])] == g[int(tmp[1])] else print("No")

### FIXED CODE ###

g = [31,28,31,30,31,30,31,31,30,31,30,31]
 
tmp = input().split(" ")
print("Yes") if g[int(tmp[0]) - 1] == g[int(tmp[1]) - 1] else print("No")
a,b,c,d=map(int,input().split())
if abs(a-c)<=d or abs(a-b)<=d=>abs(b-c):print("Yes")
else:print("No")

### FIXED CODE ###

a,b,c,d=map(int,input().split())
if abs(a-c)<=d or (abs(a-b)<=d and d>=abs(b-c)):print("Yes")
else:print("No")
def main():
    a,v=map(int,input().split())
    b,w=map(int,input().split())
    t=int(input())
    distance=abs(a-b) if a>=b else abs(b-a)
    ve=v-w
    if ve<=0:
        print("NO")
        return
    if distance<=ve*t:
        print("YES")
        return
    else:
   		print("NO")
        return




main()


### FIXED CODE ###

def main():
    a,v=map(int,input().split())
    b,w=map(int,input().split())
    t=int(input())
    distance=abs(a-b) if a>=b else abs(b-a)
    ve=v-w
    if ve<=0:
        print("NO")
        return
    if distance<=ve*t:
        print("YES")
        return
    else:
        print ( "NO" )
        return



main()
def solve():


    A, B, C, D, E, F = map(int, input().split())

    #memo
    list = {}

    #操作1-4
    ope1 = 100 * A
    ope2 = 100 * B
    ope3 = C
    ope4 = D


    for i in range(31):
        for j in range(31):
            for k in range(101):
                for l in range(101):
                    w_sum = i * ope1 + j * ope2
                    s_sum = k * ope3 + l * ope4
                    if w_sum == 0:
                        break
                    if w_sum+s_sum > F:
                        break
                    else:
                        if w_sum/100 * E >= s_sum:
                            p_tmp = (s_sum / (w_sum + s_sum)) * 100
                            list[i, j, k, l] = p_tmp

    max_v = max(list.values())

    for k, v in list.items():
        if v == max_v:
            print(ope1*k[0] + ope2*k[1] + ope3*k[2] + ope4*k[3], ope3*k[2] + ope4*k[3])

if __name__ == "__main__":
    solve()


### FIXED CODE ###

N = int(input())                                                                                                                                            
A = int(input())
  
ans = (N * N) - A
  
print(str(ans))
a, b, c,d = map(int, input().split())
import math
min = c*d/math.gcd(c,d)
def num(x):
    return x-x//c - x//d + x//min
print(int(num(b)-num(a-1)))

### FIXED CODE ###

s = str(input())

if s[0]==s[1] or s[1]==s[2] or s[3]==s[2]:
    print('Bad')
else:
    print('Good')
a,b,c=input().split()
 
print(str(c)+" "+str(a)+" " + str(b) " ")

### FIXED CODE ###

a,b,c=input().split()
 
print(str(c)+" "+str(a)+" " + str(b) + " ")
#入力
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0

#リストをソート
A,B,C = sorted(A),sorted(B),sorted(C)

for i in range(N):
  middle = 0
  bottom = 0
  bool1 = True
  while True:
    if middle == N:
      break
    if B[middle] > A[i]:
      while True:
        if C[bottom] > B[middle]:
          ans += len(C[bottom:])
          break
        bottom += 1
    middle += 1
print(ans)

### FIXED CODE ###

import bisect

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0

A,B,C = sorted(A),sorted(B),sorted(C)

for b in B:
  a = bisect.bisect_left(A,b)
  c = bisect.bisect_right(C,b)
  ans += a*(N-c)
  
print(ans)
n, m, x = map(int, input().split())
l = []
dp = [[] for _ in range(n)]
for _ in range(n):
  a = list(map(int, input().split()))
  l.append(a)
dp[0].append([0] * (m+1))
ans = []
for i in range(n):
  for row in dp[i]:
    dp[i+1].append(row)
    cnt = 0
    for j in range(m+1):
      if j == 0:
        row[0] += l[i][0]
      else:
        row[j] += l[i][j]
        if row[j] >= x:
          cnt += 1
    if cnt == m:
      ans.append(row[0])
    dp[i+1].append(row)
if len(ans) == 0:
  print(-1)
else:
  ans.sort()
  print(ans[0])

### FIXED CODE ###

n, m, x = map(int, input().split())
A = [[] for _ in range(n)]
cost = [0] * n
for i in range(n):
  c_as = list(map(int, input().split()))
  cost[i], A[i] = c_as[0], c_as[1:]
INF = 10**9
ans = INF
for s in range(0, 1 << n):
  smart = [0] * m
  cost_sum = 0
  for i in range(n):
    if (s >> i) % 2 == 0:
      continue
    cost_sum += cost[i]
    for j in range(m):
      smart[j] += A[i][j]
  ok = True
  for j in range(m):
    if smart[j] < x:
      ok = False
  if ok:
    ans = min(ans, cost_sum)
if ans == INF:
  ans = -1
print(ans)
from collections import defaultdict
import sys
sys.setrecursionlimit(100000)

def root(uft, x):
    if uft[x] == x: return x
    uft[x] = root(uft, uft[x])
    return uft[x]

def union(uft, x, y):
    x = root(uft, x)
    y = root(uft, y)
    if x == y:
        return
    uft[x] = y

def answer():
    n, m, k = map(int, input().split())
    friend = defaultdict(set)
    block = defaultdict(set)
    group = defaultdict(set)
    uft = [i for i in range(n+1)]
    for i in range(m):
        a, b = map(int, input().split())
        union(uft, j, i)
        friend[a].add(b)
        friend[b].add(a)
    for j in range(k):
        c, d = map(int, input().split())
        block[c].add(d)
        block[d].add(c)
    for i in range(1, n+1):
        root(uft, i)
    for i in range(1, n+1):
        group[root(uft, i)].add(i)
    return ' '.join(str(len(group[uft[i]]-block[i])-len(friend[i])-1) for i in range(1, n+1))

print(answer())



### FIXED CODE ###

from collections import defaultdict, Counter
import sys

def root(uft, x):
    if uft[x] == x: return x
    uft[x] = root(uft, uft[x])
    return uft[x]

def union(uft, rank, x, y):
    x = root(uft, x)
    y = root(uft, y)
    if x == y:
        return

    if rank[x] >= rank[y]:
        uft[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1
    else:
        uft[x] = y

def same(uft, x, y):
    return root(uft, x) == root(uft, y)

def answer():
    n, m, k = map(int, input().split())
    friend = defaultdict(int)
    block = defaultdict(int)
    group = defaultdict(set)
    uft = [i for i in range(n+1)]
    rank = [0] * (n+1)
    for i in range(m):
        a, b = map(int, input().split())
        union(uft, rank, a, b)
        friend[a] += 1
        friend[b] += 1
    for j in range(k):
        c, d = map(int, input().split())
        if not same(uft, c, d):
            continue
        block[c] += 1
        block[d] += 1
    for i in range(1, n+1):
        root(uft, i)
    c = Counter(uft)
    return [c[uft[i]]-block[i]-friend[i]-1 for i in range(1, n+1)]

print(*answer())
a,b,x = list(map(int,input().split()))
a1 = a//x if a%x else a//x-1
a2 = b//x
print(a2-a1)

### FIXED CODE ###

l = list(map(str,input().split()))
v = ''
for i in range(len(l)):
    v = v + l[i][0]
print(v)
from fractions import gcd
n=int(input())
a=list(map,input().split())
print(gcd(a))

### FIXED CODE ###

from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
b=a[0]
for x in a[1:]:
  b=gcd(b,x)
print(b)
import sys

X, Y=map(int,input().split())

if X==2 or Y==2:
  print('No')
  sys.exit()
elif X==4 or X==6 or X==9 or X==11:
  if Y==6 or Y==9 or Y==11:
    print('Yes')
    sys.exit()
  else:
    print('No')
    sys.exit()
else:
  if Y==3 or Y==5 or Y==7 or Y==8 or Y==10 Y==12:
    print('Yes')
    sys.exit()
  else:
    print('No')
    sys.exit()  


### FIXED CODE ###

import sys
 
X, Y=map(int,input().split())
 
if X==2 or Y==2:
  print('No')
  sys.exit()
elif X==4 or X==6 or X==9 or X==11:
  if Y==6 or Y==9 or Y==11:
    print('Yes')
    sys.exit()
  else:
    print('No')
    sys.exit()
else:
  if Y==3 or Y==5 or Y==7 or Y==8 or Y==10 or Y==12:
    print('Yes')
    sys.exit()
  else:
    print('No')
    sys.exit()
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
n=  int(sys.stdin.readline())
p=list(range(2,n))
if n ==1:
    print(0)
else:
    print(sum(p)+1)

### FIXED CODE ###

import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
n=  int(sys.stdin.readline())
if n ==1:
    print(0)
elif n == 2:#なぜ？
    print(1)
else:
    print(n*(n-1)//2)
seconds=int(input())
hour, amari = divmod(seconds,3600)
minute, second = divmod(amari,60)

print(hour+":"+minute+":"+second)

### FIXED CODE ###

seconds=int(input())
hour, amari = divmod(seconds,3600)
minute, second = divmod(amari,60)

print("{0}:{1}:{2}".format(hour,minute,second))
a, b, k = map(int, input().split())
for i in range(k):
  if a > 0:
    a -= 1
  elif b > 0:
    b -= 0:
  else:
    break
    
print(" ".join(map(str, [a,b])))

### FIXED CODE ###

a, b, k = map(int, input().split())
 
if a >= k:
  print(a-k, b)
else:
  if a+b > k:
    print(0, b-(k-a))
  else:
    print(0,0)
a,b = (input().split())
a = int(a)
b = int(b)
roads = []
for i in range(a) :
   c , t = input().split()
    t = int(t)
    if t in range (1, b + 1):
        roads.append((int(c) ,t))
 
if len(roads) == 0 :
    print ("TLE")
else:
    roads.sort()
    print (roads[0][0])

### FIXED CODE ###

def LimitedTime(Array , T , N):
    MinC=1001
    for i in range (N):
            if Array[i][1]<=T:
               if Array[i][0]<MinC:
                   MinC=Array[i][0]
    if MinC==1001:
        return 'TLE'
    else:
        return MinC
                
                
                   
                   



TandN=list(map(int ,input().split()))
N=TandN[0]
T=TandN[1]
Array=[[int(j) for j in input().split()]for i in range(N)]
print(LimitedTime(Array , T ,N))
k,n=map(int,input().split())
a=list(map(int,input().split()))
t=0
for i in range(1,n):
  t=max(t,a[i]-a[i-1])
s=max(t,k-a[n])
print(k-s)


### FIXED CODE ###

k,n=map(int,input().split())
a=list(map(int,input().split()))
t=0
for i in range(1,n):
  t=max(t,a[i]-a[i-1])
s=max(t,k-a[n-1]+a[0])
print(k-s)
num=input()
c=False
for i in range(1,len(num)+1):
  if num[i]==num[i-1]:
    c=True
    
if c==True:
  print("Bad")
else:
  print("Good")

### FIXED CODE ###

num=input()
c=False
for i in range(1,len(num)):
  if num[i]==num[i-1]:
    c=True
    
if c==True:
  print("Bad")
else:
  print("Good")
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(a):
    if a[a[i]] -1 == i:
        cnt +=1
print(cnt // 2)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
    if a[a[i]-1] -1 == i:
        cnt +=1
print(cnt // 2)
import collections

H, W = map(int, input().split(" "))
mp = []
for _ in range(H):
    mp.append(input().strip())


def bfs(sh, sw, mp):
    que = collections.deque()
    que.append((sh, sw, 0))
    dist = [[float('inf') for _ in range(W)] for _ in range(W)]

    while len(que) > 0:
        h, w, d = que.popleft()
        if dist[h][w] != float('inf'):
            continue
        dist[h][w] = d
        for (dh, dw) in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
            if h + dh < 0 or w + dw < 0 or h + dh >= H or w + dw >= W:
                continue
            if mp[h + dh][w + dw] == '#':
                continue
            que.append((h + dh, w + dw, d + 1))
    return dist


for h in range(H):
    for w in range(W):
        if mp[h][w] == '.':
            tmp_dist = bfs(h, w, mp)
            break

sh, sw = (h, w)
for h in range(H):
    for w in range(W):
        if mp[h][w] == '.' and tmp_dist[sh][sw] >= tmp_dist[h][w]:
            sh = h; sw = w
dist = bfs(sh, sw, mp)

ans = 0
for h in range(H):
    for w in range(W):
        if mp[h][w] == '.':
            ans = max(ans, dist[h][w])
print(ans)

### FIXED CODE ###

import collections

H, W = map(int, input().split(" "))
mp = []
for _ in range(H):
    mp.append(input().strip())


def bfs(sh, sw, mp):
    que = collections.deque()
    que.append((sh, sw))
    dist = [[-1 for _ in range(W)] for _ in range(H)]
    dist[sh][sw] = 0

    while que:
        h, w = que.popleft()
        for (dh, dw) in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
            if h + dh < 0 or w + dw < 0 or h + dh >= H or w + dw >= W:
                continue
            if mp[h + dh][w + dw] == '.' and dist[h + dh][w + dw] == -1:
                dist[h + dh][w + dw] = dist[h][w] + 1
                que.append((h + dh, w + dw))

    ans = 0
    for row in dist:
        ans = max(ans, max(row))
    return ans


ans = 0
for h in range(H):
    for w in range(W):
        if mp[h][w] == '.':
            ans = max(ans, bfs(h, w, mp))
print(ans)