Harryxun/stf_run huggingface dataset:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    H, W, M = map(int, readline().split())
    row = [0] * H
    column = [0] * W
    grid = [[0] * W for _ in range(H)]

    for _ in range(M):
        h, w = map(int, readline().split())
        row[h-1] += 1
        column[w-1] += 1
        grid[h-1][w-1] += 1

    max_row = [i for i,x in enumerate(row) if x == max(row)]
    max_column = [i for i,x in enumerate(column) if x == max(column)]
    ans = 0
    for h in max_row:
        for w in max_column:
            tmp = row[h] + column[w] - grid[h][w]
            ans = max(tmp,ans)
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    H, W, M = map(int, readline().split())
    row = [0] * H
    column = [0] * W
    grid = set()

    for _ in range(M):
        h, w = map(int, readline().split())
        row[h-1] += 1
        column[w-1] += 1
        grid.add((h-1,w-1))

    max_row = max(row)
    max_column = max(column)

    idx_row = [i for i,x in enumerate(row) if x == max_row]
    idx_column = [i for i,x in enumerate(column) if x == max_column]

    ans = max_row+max_column
    flag = False

    for h in idx_row:
        for w in idx_column:
            if not (h,w) in grid:
                flag = True
                break

    if flag:
        print(ans)
    else:
        print(ans-1)


if __name__ == '__main__':
    main()
from collections import deque
S = input()
Q = int(input())
R = 1
Top = deque()
Bot = deque()
for _ in range(Q):
  inp = input()
  if inp[0]=='1':
    R *= -1
  else:
    o, f, c = inp.split()
    if f=='1' and R==-1 or f=='2' and R==1:
      Bot.append(c)
    else:
      Top.appendleft(c)
Top.append(S)
Top.append(*Bot)
S = ''.join(Top)
S = S if R==1 else S[::-1]
print(S)

### FIXED CODE ###

from collections import deque
S = input()
Q = int(input())
R = 1
Top = deque()
Top.append(S)
for _ in range(Q):
  inp = input()
  if inp[0]=='1':
    R *= -1
  else:
    o, f, c = inp.split()
    if f=='1' and R==-1 or f=='2' and R==1:
      Top.append(c)
    else:
      Top.appendleft(c)
S = ''.join(Top)
S = S if R==1 else S[::-1]
print(S)
n = input())
total = 0
for i in range(len(n)):
  total+=int(n[i])

if(total == 0):
  print("No")
if(int(n) % total == 0):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = input()
num = int(n)
total = 0
for i in n:
    total += int(i)
    
if num % total == 0:
    print("Yes")
else:
    print("No")
import sys
input=sys.stdin.readline

n,m = map(int, input().split())
a = []
for i in range(m):
    a.append(int(input()))
if len(a) >= 2:
    for i in range(m-1):
        if a[i]+1 == a[i+1]:
            print(0)
            exit()

def fib(n):
    if n <= 1:
        return 1
    return fib(n-1) + fib(n-2)
tmp = 0
ans = 1
for i in range(len(a)):
    ans *= fib(a[i]-tmp-1)
    tmp = a[i]+1
if tmp < n:
    ans *= fib(n-tmp)
print(ans%(10**9+7))


### FIXED CODE ###

import sys
input=sys.stdin.readline

def fib(n):
    a, b = 1, 0
    for _ in range(n):
        a, b = a + b, a
    return b

n,m = map(int, input().split())
a = []
for i in range(m):
    a.append(int(input()))
if len(a) >= 2:
    for i in range(m-1):
        if a[i]+1 == a[i+1]:
            print(0)
            exit()

tmp = 0
ans = 1
for i in range(len(a)):
    ans *= fib(a[i]-tmp)
    tmp = a[i]+1
if tmp < n:
    ans *= fib(n-tmp+1)
print(ans%(10**9+7))
s = input()
if s == "Sunny":
　print("Cloudy")
elif s == "Cloudy":
　print("Rainy")
elif s == "Rainy":
　print("Sunny")

### FIXED CODE ###

s = input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
elif s == "Rainy":
    print("Sunny")
#!/usr/bin/env python3
import sys
import queue

def solve(H: int, W: int, black):
    Q = queue.Queue()
    marked = [[0] * W for h in range(H)]
    qlen = 0
    for h, w in black:
        Q.put((h, w))
        qlen += 1
        marked[h][w] = 1
    
    count = 0
    while not Q.empty():
        flag = False
        for _ in range(qlen):
            h, w = Q.get()
            qlen -= 1
            for hh, ww in [(h-1, w), (h+1, w), (h, w-1), (h, w+1)]:
                if not marked[hh][ww] and 0 <= hh <= H-1 and 0 <= ww <= W-1:
                    flag = True
                    Q.put((hh, ww))
                    qlen += 1
                    marked[hh][ww] = 1
        if flag:
            count += 1
    print(count)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    black = []
    for h in range(H):
        line = next(tokens)
        for w, c in enumerate(line):
            if c == '#':
                black.append((h, w))
    solve(H, W, black)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

inf = float('inf')

def solve(H: int, W: int, A: "List[str]"):
    dist = [[inf] * W for h in range(H)]
    for h in range(1, H):
        for w in range(1, W):
            if A[h][w] == '#':
                dist[h][w] = 0
            else:
                dist[h][w] = min(dist[h-1][w], dist[h][w-1]) + 1
    
    dmax = 0
    for h in range(H-1, -1, -1):
        for w in range(W-1, -1, -1):
            if A[h][w] == '#':
                dist[h][w] = 0
            elif h+1 <= H-1 and w+1 <= W-1:
                dist[h][w] = min(dist[h][w], min(dist[h+1][w], dist[h][w+1]) + 1)
            elif w+1 == W and h+1 <= H-1:
                dist[h][w] = min(dist[h][w], dist[h+1][w] + 1)
            elif h+1 == H and w+1 <= W-1:
                dist[h][w] = min(dist[h][w], dist[h][w+1] + 1)
            dmax = max(dist[h][w], dmax)
    print(dmax) 
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    A = [ next(tokens) for _ in range(H) ]  # type: "List[str]"
    solve(H, W, A)

if __name__ == '__main__':
    main()
import math
 
n=int(input())
ls=[int(s) for s in input().split(" ")]
 
if 0 in ls:
  print(0)
else:
  num=0
  for i in ls:
    num+=math.log10(i)
 
  if num <= 18:
    print(int(round(10**num,5)))
  else:
    print(-1)


### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
class PrimeNumber:
    def __init__(self, N):
        self.N = N
        self.compute()

    def compute(self):
        isP, P = [True] * N+1, []
        for i in range(2,N+1):
            if isP[i]:
                P.append(i)
                for j in range(2*i,N+1,i):
                    isP[j] = False
        self.isP, self.P = isP, P

N = read_int()

pn = PrimeNumber(1000006)
ans = 0
for p in pn.P:
    cnt = 0
    while N % p == 0:
        N /= p
        cnt += 1
    dec = 1
    while cnt >= dec:
        cnt -= dec
        dec += 1
        ans += 1
if N > 1:
    ans += 1
print(ans)

### FIXED CODE ###

# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
N = read_int()

MAX_P = 1000006
isP = [True] * MAX_P
for i in range(2,MAX_P):
    if isP[i]:
        for j in range(2*i,MAX_P,i):
            isP[j] = False

P = [i for i in range(2,MAX_P) if isP[i]]
ans = 0
for p in P:
    cnt = 0
    while N % p == 0:
        N /= p
        cnt += 1
    dec = 1
    while cnt >= dec:
        cnt -= dec
        dec += 1
        ans += 1
if N > 1:
    ans += 1
print(ans)
X,H,x,y,r =[int() for i in input().split()]
if x-r < 0 or x+r > W:
    print("No")
 
elif y-r <0 or y+r> H:
    print("No")
 
elif x < r:
    print("No")
 
elif y < r:
    print("No")
 
else:
    print("Yes")

### FIXED CODE ###

W,H,x,y,r = [int(i) for i in input().split()]

if x + r <= W and y - r >= 0 and x - r >= 0 and y+r <= H:
    print("Yes")
else:
    print("No")
import itertools
import heapq
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
b = np.abs(a)
b = sorted(a,reverse = True)
b_k = b[k-1] 
a_new = [a[_] for _ in range(len(a)) if np.abs(a)[_] >= b_k]
a_new.sort()
D = [[a_new[i+j-k] for j in range(k)] for i in range(len(a_new))]
A = (functools.reduce(operator.mul,D[_]) for _ in range(len(D)))
l_max = max(A)
waru = 10**9 + 7
print(l_max % waru)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
n = int(input())
flame_list = [ int(v) for v in input().split() ]

mean = sum(flame_list)

if mean % 2 == 0:
  print(flame_list.index(mean//2))
else:
  print(min(flame_list.index((mean-1)//2),flame_list.index((mean+1)//2)))

### FIXED CODE ###

n = int(input())
flame_list = [ int(v) for v in input().split() ]

mean = sum(flame_list)/n

flame_list_2 = [ abs(mean - i) for i in flame_list ]


print(flame_list_2.index(min(flame_list_2)))
N=input()
f=sum(list(map(int, str(N))))
if N%f==0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N=int(input())
f=map(int,list(str(N)))
if N%sum(f)==0:
  print('Yes')
else:
  print('No')
K=int(input())
X=int(input())
if K*500>=X:
  print("Yes")
else : 
  print("No")
 

### FIXED CODE ###

K, X=map(int,input().split())
if K*500>=X:
  print("Yes")
else : 
  print("No")
n=int(input())
a=[int(input()) for i in range(n)]
max1 = 0
max1_ind = 0
max2 = 0
max2_ind = 0
 
for i in range(n):
  if max1 < a[i]:
    max1 = a[i]
    max1_ind = i
    max2 = max1
    max2_ind = max1_ind
    
for i in range(n):
  if i = max1_ind:
    print(max2)
  else:
    print(max1)
  

### FIXED CODE ###

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

max1 = 0
max1_ind = 0
max2 = 0
max2_ind = 0
 
for i in range(n):
    if max2 <= a[i]:
        if max1 <= a[i]:
            max2 = max1
            max2_ind = max1_ind
            max1 = a[i]
            max1_ind = i
            
        else:
            max2 = a[i]
            max2_ind = i
    
for j in range(n):
    if j == max1_ind:
        print(max2)
    else:
        print(max1)
from itertools import combinations
n = int(input())
A = tuple(map(int, input().split()))
SET = set(A)
def solve(m):
    if m in A:
        return "yes"
    for i in range(1, n):
        for C in combinations(A, i):
            sumC = sum(C)
            if sumC < m and m - sumC in SET - set(C):
                return "yes"
    return "no"
q = int(input())
for m in map(int, input().split()):
    print(solve(m))



### FIXED CODE ###

n = int(input())
SET1 = {0}
for a in map(int, input().split()):
    for b in tuple(SET1):
        SET1.add(a + b)
input()
for m in map(int, input().split()):
    print('yes' if m in SET1 else 'no')
def main():
    from builtins import int, map, list, print, len
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    dog_no = input_number()
    base = 26
    alphabet = "abcdefghijklmnopqlstuvwxyz"
    n = 1
    n_ls = [n]
    t_ls = [0]
    while n <= 10 ** 15 + 1:
        n *= base
        n_ls.append(n + n_ls[-1])
        t_ls.append(n)
    n_ls.sort(reverse=True)
    t_ls.sort(reverse=True)

    ans = ""
    for i in range(len(n_ls)):
        d = dog_no // (n_ls[i])
        if d >= 1:
            if i == len(n_ls) - 1:
                ans += alphabet[dog_no - 1]
            else:
                a = dog_no // t_ls[i]
                dog_no %= t_ls[i]
                ans += alphabet[a - 1]
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def f(n):
    if n == 0: return ""
    n -= 1
    return (f(n // 26) + chr(ord("a") + n % 26))

def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    n = input_number()
    ans = f(n)
    print(ans)

if __name__ == '__main__':
    main()
def run(x):
    '''

    '''


    sum = 0
    while x > 0:
        sum += x%10
        x = int(x/10)

    print('Yes' if sum % 9 == 0 else 'No')


if __name__ == '__main__':
    x = int(input())
    run(x)

### FIXED CODE ###

def run(x):
    '''

    '''


    # sum = 0
    # while x > 0:
    #     sum += x%10
    #     x = int(x/10)

    # print('Yes' if sum % 9 == 0 else 'No')
    print('Yes' if x % 9 == 0 else 'No')


if __name__ == '__main__':
    x = int(input())
    run(x)
n,k = map(int,input().split())
A = list(map(int,input().split()))
B = []
b = 1
ans = 1
while ans:
  b = A[b-1]
  B.append(b)
  if len(A) == len(B):
    ans = 0

print(B[k])

### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
pos = 0
visit = [0] * N
move = []
roop = []
while visit[pos]!=2:
    if visit[pos]==0:
        move.append(pos)
    else:
        roop.append(pos)
    visit[pos] += 1
    pos = A[pos] - 1
if len(move)>K:
    print(move[K]+1)
else:
    print(roop[(K-(len(move)-len(roop)))%len(roop)]+1)
n = input()

def digits(n):
    if n < 10:
        return n
    else:
        return n%10 + digits(int(n/10))

sn = digits(n)
if n % sn == 0:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

s = input()
output = 0
for o in s:
    if o == '+':
        output += 1
    elif o == '-':
        output -= 1
    else:
        pass
print(output)
g1, g2, g3 = {1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}
print('Yes' if {a, b} in g1 or {a, b} in g2 else 'No')

### FIXED CODE ###

a, b = map(int, input().split())
g1, g2, g3 = {1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}
print('Yes' if not ({a, b} - g1) or not ({a, b} - g2) else 'No')
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

ans = 0
#s = []
b = []
temp = 0
for i, x in enumerate(a):
    temp = (temp + x) % k
    c = (temp - (i % k) + k) % k
    b.append(c)
    #if x % k == 1:
    #    ans += 1

#print(s)
#print(b)

m = [0] * k

for i in range(k):
    ans += m[b[i]]
    m[b[i]] += 1

#print(m)

for i in range(k, n+1):
    m[b[i-k]] -= 1
    ans += m[b[i]]
    m[b[i]] += 1
    #print(m)

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

n += 1
ans = 0
m = dict()
temp = 0
b = []
for i in range(min(n, k)):
    temp = (temp + a[i]) % k
    c = (temp - (i % k) + k) % k
    b.append(c)
    if c in m.keys():
        ans += m[c]
        m[c] += 1
    else:
        m[c] = 1

for i in range(k, n):
    x = i % k
    m[b[x]] -= 1
    temp = (temp + a[i]) % k
    c = (temp - (i % k) + k) % k
    b[x] = c
    if c in m.keys():
        ans += m[c]
        m[c] += 1
    else:
        m[c] = 1

print(ans)
S = input()

while len(S) >= 2:
    if S[0:1]== 'hi':
        S==[2:]
    else:
        break
if len(S)==0:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

S = input()

while len(S) >= 2:
    if S[0:2]== 'hi':
        S=S[2:]
    else:
        break
if len(S)==0:
    print('Yes')
else:
    print('No')
s = list(str(input()))

s[3] = 8

t = ''
for i in range(len(s)):
  t = t + s[i]
  
print(t)


### FIXED CODE ###

s = list(str(input()))
 
s[3] = '8'
 
t = ''
for i in range(len(s)):
  t = t + s[i]
  
print(t)
import sys
input = sys.stdin.readline

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

    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N = int(input())
    H = list(map(int,input().split()))

    if N == 1:
        print(0)
    else:
        ans_list = []
        count = 0
        for i in range(N-1):
            if H[i+1] <= H[i]:
                count += 1
            else:
                ans_list.append(count)
                count = 0
        ans_list.append(count)
        print(max(ans_list))

if __name__ == "__main__":
    main()
H, W = map(int, input().split())
if H==1 or W==1
    print(1)
else:
    print((H*W)//2) if (H*W)%2==0 else print((H*W)//2+1)

### FIXED CODE ###

H, W = map(int, input().split())
if H==1 or W==1:
    print(1)
else:
    print((H*W)//2) if (H*W)%2==0 else print((H*W)//2+1)
x,n=map(int,input().split())
if(n==0):
  print(x)
else:
    l=[]
    l1=[]
    li=list(map(int,input().split()))
    for i in range(n):
        if x-i not in li:
            l.append(x-i)
        if x+i not in li:
            l1.append(x+i)
    a=max(l)
    b=min(l1)
    if(abs(a-x)>abs(b-x)):
        print(b)
    else:
        print(a)

### FIXED CODE ###

x,n=map(int,input().split())
if(n==0):
  print(x)
else:
    l=[]
    l1=[]
    li=list(map(int,input().split()))
    for i in range(n+1):
        if x-i not in li:
            l.append(x-i)
        if x+i not in li:
            l1.append(x+i)
    a=max(l)
    b=min(l1)
    if(abs(a-x)>abs(b-x)):
        print(b)
    else:
        print(a)
from sys import stdin
N,X=[int(x) for x in stdin.readline().rstrip().split()]
burger_set=["P"]
for i in range(N):
    new_burger="B"+burger_set[i]+"P"+burger_set[i]+"B"
    burger_set.append(new_burger)
print(burger_set[N][0:X].count('P'))

### FIXED CODE ###

from sys import stdin
N, X = [int(x) for x in stdin.readline().rstrip().split()]

heights = [1]
putties = [1]
for _ in range(N):
    heights.append(heights[-1] * 2 + 3)
    putties.append(putties[-1] * 2 + 1)


def solve(n, x):
    if n == 0 and x == 1:
        return 1
    elif x == 1:
        return 0
    elif 1 < x <= 1+heights[n-1]:
        return solve(n-1, x-1)
    elif x == 2+heights[n-1]:
        return 1+putties[n-1]
    elif 2+heights[n-1] < x <= 2+2*heights[n-1]:
        return putties[n-1]+1+solve(n-1,x-2-heights[n-1]) 
    elif x == 3+2*heights[n-1]:
        return 2*putties[n-1]+1
print(solve(N, X))
S=input()
if S=="Sunny":
  print("Cloudy")
elif S=="Cloudy":
  print("Rainy")
elif S="Rainy":
  print("Sunny")

### FIXED CODE ###

S=input()
if S=="Sunny":
  print("Cloudy")
elif S=="Cloudy":
  print("Rainy")
elif S=="Rainy":
  print("Sunny")
import collections
N = int(input())

c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)

### FIXED CODE ###

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
import collections
N = int(input())

c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)
a,b,c = map(int, input().split())
x = 0
for i in range(a,b+1):
 if c %% i == 0:
  x += x+1
 print(x)



### FIXED CODE ###

a,b,c = map(int, input().split())
x = 0
for i in range(a,b+1):
 if c%i == 0:
  x = x+1
print(x)
#include <algorithm>
#include<bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;

int main(){
        int n,a,b;
        int cnt=0;
        cin>>n;
        
        for(int i=0;i<n;i++){
                cin>>a>>b;
                if(a==b){
                        cnt++;
                }else{
                        cnt=0;
                }
                if(cnt==3){
                        cout<<"Yes"<<endl;
                        return 0;
                }
                
        }
        cout<<"No"<<endl;
        return 0;
}


### FIXED CODE ###

n=int(input())
lst=[list(map(int,input().split())) for _ in range(n)]
# print(lst)
cnt=0
ans="No"
for i in range(n):
    a,b=lst[i]
    # print(a,b)
    if a==b:
        cnt+=1
    else:
        cnt=0
    if cnt==3:
        # print(a,b,cnt)
        ans="Yes"
        break

print(ans)
variable = input().split(" ")
n = int(variable[0])
x = int(variable[1])
l = input().split(" ")
d = 0
i = 0

while d < x:
  d += int(l[i])
  i += 1
  
print(i)

### FIXED CODE ###

inp = input().split(" ")
n = int(inp[0])
x = int(inp[1])
l = input().split(" ")
d = 0
count = 1

for i in range(n):
  d += int(l[i])
  if d <= x:
    count += 1
  else:
    break
  
print(count)
# DPをとく
import math
N=int(input())
H=list(map(int,input().split()))
dp = [math.inf for _ in range(N)] # 足場Nまでにたどり着くときの最小コストとする
dp[0]=0
for i in range(N):
    if i+1<N:
        dp[i+1] = min(dp[i+1],dp[i]+abs(H[i+1]-H[i]))
    if i+2<N:
        dp[i+2] = min(dp[i+2],dp[i]+abs(H[i+2]-H[i]))
print(dp[N-1])


### FIXED CODE ###

# DPをとく
inf=10**10
N=int(input())
H=list(map(int,input().split()))
dp = [inf for _ in range(N)] # 足場Nまでにたどり着くときの最小コストとする
dp[0]=0
for i in range(N):
    if i+1<N:
        dp[i+1] = min(dp[i+1],dp[i]+abs(H[i+1]-H[i]))
    if i+2<N:
        dp[i+2] = min(dp[i+2],dp[i]+abs(H[i+2]-H[i]))
print(dp[N-1])
n = int(input())
h = list(map(int, input().split()))

count = 0
answer = 0

for i in range(len(h-1)):
  if a[i] >= a[i+1]:
    count+=1
  else:
    answer = max(answer, count)
    count = 0
print(answer)
  

### FIXED CODE ###

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

count = 0
answer = 0

for i in range(n-1):
  if h[i] >= h[i+1]:
    count+=1
  else:
    answer = max(answer, count)
    count = 0
print(max(answer, count))