Problem:


Score : 200 points

Problem Statement

Tak performed the following action N times: rolling two dice.
The result of the i-th roll is D_{i,1} and D_{i,2}.

Check if doublets occurred at least three times in a row.
Specifically, check if there exists at lease one i such that D_{i,1}=D_{i,2}, D_{i+1,1}=D_{i+1,2} and D_{i+2,1}=D_{i+2,2} hold.

Constraints

3 \leq N \leq 100

1\leq D_{i,j} \leq 6

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
D_{1,1} D_{1,2}
\vdots
D_{N,1} D_{N,2}

Output

Print Yes if doublets occurred at least three times in a row. Print No otherwise.

Sample Input 1

5
1 2
6 6
4 4
3 3
3 2

Sample Output 1

Yes

From the second roll to the fourth roll, three doublets occurred in a row.

Sample Input 2

5
1 1
2 2
3 4
5 5
6 6

Sample Output 2

No

Sample Input 3

6
1 1
2 2
3 3
4 4
5 5
6 6

Sample Output 3

Yes



Sample input:
5
1 2
6 6
4 4
3 3
3 2


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase
from collections import deque
from math import *

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def solve():
    n = int(input())
    count = 0
    lst = []
    for j in range(n):
        a, b = map(int, input().split())
        lst.append((a,b))
    for i in range(n-3):
        if lst[i][0] == lst[i][1]:
            if lst[i+1][0] == lst[i+1][1] and lst[i+2][0] == lst[i+2][1]:
                print('Yes')
                break
    else:
        print('No')
            
        
           
def main():
    #k = int(input())
    #tests = 1
    #tests = int(input().strip())
    #for test in range(tests):
        solve()
        
# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
cnt=0
d=[list(map(int,input().split()))for i in range(n)]
for i in range(n):
    if i==0:
        if d[i][0]==d[i][1]:
            cnt+=1
    else:
        if d[i-1][0]!=d[i-1][1]:
            cnt=0
            if d[i][0]==d[i][1]:
                cnt+=1
        else:
            if d[i][0]==d[i][1]:
                cnt+=1
if cnt>=3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N=int(input())
D={}
for i in range(N):
    D[i]=input().split()

cou=0
for i in range(N):
    if D[i][0]==D[i][1]:
        cou+=1

if cou >= 3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N = int(input()) 

count = 0
result = 'No'
for i in range(1, N):
    d1, d2 = map(int, input().split())
    if(d1 == d2):
        count += 1
    else:
        count = 0
    if(count == 3):
        result = 'Yes'

print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())

xy = [map(int,input().split()) for _ in range(N)]
x,y = [list(i) for i in zip(*xy)]

ans = 0

for i in range(N):
    if x[i] == y[i]:
        ans +=1
    else:
        ans = 0
        
if ans >= 3:
    print("Yes")
    
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())


ans = 0
stock = 0
for i in range(N):
  a,b = map(int, input().split())
  if a == b:
    ans += 1

print('Yes' if (ans > 2) else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
c=True
d=[]
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        d.append(i)
if len(d)<3:
    print("No")
else:
    for i in range(1,len(d)):
        if d[i]-d[i-1]==1:
            ans+=1
    if ans>=2:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
N = int(input(""))
count = 0
for i in range(N):
    D = (input(""))
    l = D.split()
    l_i = [int(s) for s in l]
    if l_i[0] == l_i[1]:
        count += 1
    else:
        pass
if count >= 3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
cnt = []
for i in range(N):
    a, b = map(int, input().split())
    if a == b:
        cnt.append(1)
    else:
        cnt.append(0)

from itertools import groupby
for key, group in groupby(cnt):
    if  len(list(group)) >= 3:
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())

xy = [map(int,input().split()) for _ in range(N)]
x,y = [list(i) for i in zip(*xy)]

ans = 0

for i in range(N):
    if x[i] == y[i]:
        ans +=1
    else:
        ans -=1
        
if ans >= 3:
    print("Yes")
    
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
D={}
for i in range(N):
    D[i]=input().split()

cou=0
for i in range(N):
    if D[i][0]==D[i][1]:
        cou+=1
    else:
        cou=0


if cou >= 3:
    print('Yes')
elif cou == 0:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())

mulArr = []
for _ in range(N):
  arr = list(map(int, input().split(" ")))
  mulArr.append(arr)
print(mulArr)

result = 0
for i in range(0, len(mulArr) - 2):
  print(i)
  if mulArr[i][0] == mulArr[i][1] and mulArr[i + 1][0] == mulArr[i + 1][1] and mulArr[i + 2][0] == mulArr[i + 2][1]:
    result += 1

print(result)
if result != 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

count = 0
for i in range(n):
  a,b = list(map(int, input().split()))
  print(a,b)

Submission status: Wrong Answer

Solution code:
n = int(input())
d1d2 = [map(int, input().split()) for _ in range(n)]
d1, d2 = [list(i) for i in zip(*d1d2)]
h = 'No'
for i in range(n):
    if i > 2:
        if d1[i] == d2[i]:
            if d1[i-1] == d2[i-1]:
                if d1[i-2] == d2[i-2]:
                    h = 'Yes'
                    break
print(h)

Submission status: Wrong Answer

Solution code:
N = int(input())
x=[0]*N
y=[0]*N
L=[0]*N

flag = "No"

for i in range(N):
	x[i],y[i] = map(int, input().split())

for i in range(N):
  if x[i]==y[i]:
  	L[i]=1

#print(L)

for i in range (N-2):
  #print(i)
  if L[i] == L[i+1] == L[i+2]:
    flag = "Yes"

print(flag)

Submission status: Wrong Answer

Solution code:
N = int(input())
D = [input().split() for _ in range(N)]
ans = "no"
for i in range(N - 2):
    if D[i][0] == D[i][1]:
         if D[i + 1][0] == D[i + 1][1]:
            if D[i + 2][0] == D[i + 2][1]:
                ans = "yes"
                break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
d = [0] * n
x = [0] * n
for i in range(n):
    d[i], x[i] = map(int, input().split())
m = 0
for i in range(0,n-3):
  if d[i]==x[i] and d[i+1]==x[i+1] and d[i+2]==x[i+2]:
    m = m+1
    break
  else:
    pass
if m==1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

xy = [map(int,input().split()) for _ in range(N)]
x,y = [list(i) for i in zip(*xy)]

ans = 0

for i in range(N):
    if x[i] == y[i]:
        ans +=1
    else:
        continue
        
if ans >= 3:
    print("Yes")
    
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
a = int(input())
xy = [map(int, input().split()) for _ in range(a)]
x, y = [list(i) for i in zip(*xy)]
flag = 0
for i in range(a):
    if (x[i] == y[i]):
      flag = flag+1
    else:
      flag = 0
if flag >= 3:
    print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N = int(input()) 

count = 0
result = 'No'
for i in range(1, N):
    d1, d2 = map(int, input().split())
    if(d1 == d2):
        count += 1
    else:
        count = 0
    if(count == 3):
        result = 'Yes'
        exit

print(result)

Submission status: Wrong Answer

Solution code:
x=int(input())
l=[]
c=0
for i in range(x):
    a,b = map(int,input().split())
    l.append(a)
    l.append(b)
for i in range(0,x*2,2):
    if l[i]==l[i+1]:
        c+=1
        print(l[i])
        if c>=3:
            print("YES")
            break

    else:
        c=0
if c<3:
    print("NO")
print(c)

Submission status: Wrong Answer

Solution code:
N = int(input())
l = []
m = []
for i in range(N):
    a,b = map(int,input().split())
    l.append(a)
    m.append(b)
flg = 0
c = 0
for i in range(len(l)):

    if l[i] == m[i]:
        c += 1
        if c==2:
            flg += 1
            
    else:
        c = 0
if flg == 0:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [input().split(" ") for i in range(n)]
num = 0
nummax = 0
for i in range(n):
  print(a[i][0])
  if int(a[i][0])==int(a[i][1]):
    num+=1
  else:
    if num> nummax:
      nummax = num
      num=0
if nummax>3:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
count = 0
for i in range(N-3):
    if x[i] == y[i] and x[i+1] == y[i+1] and x[i+2] == y[i+2]:
        count += 1
        print("Yes")
        break

if count == 0:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
for i in range(N):
  if x[i]==y[i]:
    continue
  else:
    print("No")
    exit(0)
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

d1=[]
d2=[]

cont=0
for i in range(N):
    D1,D2=map(int,input().split())

    d1.append(D1)
    d2.append(D2)

w1=set(d1)
w2=set(d2)        

w12=w1&w2

if len(w12)>=3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

zoro = 0
res = 0

for i in range(n):
    d1, d2 = map(int, input().split())
    if zoro == 3:
        res = 1
    elif d1 == d2:
        zoro = zoro + 1
    else:
        zoro = 0

if res == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

num_list=[]

for i in range(n):
    a,b = map(str, input().split())
    num_list.append(a)
    num_list.append(b)
    s = ''.join(num_list)
if ('111' in s) or ('222' in s) or ('333' in s) or ('444' in s) or ('555' in s) or ('666' in s):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
data=[]
for _ in range(int(input())):
    d1,d2=input().split()
    d1=int(d1)
    d2=int(d2)
    if d1==d2:
        data.append(1)
longest = 0
current = 0
for num in data:
    if num == 1:
        current += 1
    else:
        longest = max(longest, current)
        current = 0
        
if max(longest, current)>=3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
sub_yes = 0
max_yes = 0
for i in range(N):
    d1,d2 = map(int,input().split())
    if d1 == d2:
        sub_yes += 1
    else:
        max_yes = sub_yes
        sub_yes = 0

if sub_yes > max_yes:
    max_yes = sub_yes
# print(max_yes)
# print(sub_yes)
if max_yes >= 3:
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
n = int(input())

count = 0
max_count = 0
for i in range(n):
    input_elements = input().split()
    if input_elements[0] == input_elements[1]:
        count += 1
    else:
        max_count = count
        count = 0

if max_count < count:
    max_count = count

if max_count >= 3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

D = []
for i in range(N):
    D.append(list(map(int,input().split())))

for i in range(N-2):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
d=list()
for i in range(n):
    d.append(list(map(int,input().split())))

an=1
for i in range(n):
    if n > i+3:
        if d[i][0]==d[i][1] and d[i+1][0]==d[i+1][1] and d[i+2][0]==d[i+2][1]:
            an=0
            break
if an==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
d1 = [0]*n
d2 = [0]*n
h = 'No'
for i in range(n):
    d1[i], d2[i] = map(int, input().split())
    if i > 2:
        if d1[i] == d2[i]:
            if d1[i-1] == d2[i-1]:
                if d1[i-2] == d2[i-2]:
                    h = 'Yes'
                    break
print(h)

Submission status: Wrong Answer

Solution code:
N = int(input())
D = [input() for i in range(N)]
count = 0
OK = 0
for ite in D:
    
    
    a,b = map(int,ite.split())
    
    if a == b:
        count += 1
        if count >=3:
            OK = 1
            print('Yes')
        
        else:
            pass
    
    else:
        count = 0
if OK == 0:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
flag = 0
count = 0

for i in range(N-1):
  if x[i] == y[i]:
    count += 1
    if count >= 3:
      flag = 1
  else:
    count = 0
  

if flag == 1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n =int(input())
first =[]
second =[]
for i  in range(n):
    d1 , d2 = map(int , input().split())
    first.append(d1)
    second.append(d2)

for i in range(n-2):
    count = 0
    for j in range(i ,i+3):
        if first[j]==second[j]:
            count +=1
           
    if count ==3:
        print("YES")
        break
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
Count = 0
Array = []
for i in range(int(input())):
    Dice_1, Dice_2 = map(int, input().split())
    if Dice_1 == Dice_2:
        Array.append(1)
    else:
        Array.append(0)

ans = []
j_1 = 0
for j in range(len(Array)):
    if j_1 == 1 and Array[j] == 1:
        Count = Count + 1
    else:
        Count = 0
    j_1 = Array[j]
    print(Count)
    ans.append(Count)
print(max(ans))
if max(ans) >= 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 入力
N = int(input())

l = []
for i in range(N):
    d1, d2 = map(int, input().split())
    l.append([d1, d2])
print(l)

flag = 0
cont = 0
for i in l:
    if(i[0]==i[1]):
        flag = 1
        cont = cont + 1
        print(cont)
        if (cont>=3):
            break
    else:
        cont = 0
        flag =0



if (cont >=3):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
l = [list(map(int, input().split())) for l in range(N)]

last = 0
for item in l:
  if last == 0 and item[0] == item[1]:
    last = 1
    continue
  elif last == 1 and item[0] == item[1]:
    last = 2
    continue
  elif last == 2 and item[0] == item[1]:
    last = 3
    break
  last == 0

if last == 3:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
c=True
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        ans+=1
    if ans==3:
        print("Yes")
        c=False
        break
if c==True:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]
i = 0
count = 0
while i < N:
    if D[i][0] == D[i][1]:
        count += 1
    else:
        count = 0
    i += 1

if count >= 3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = input()
x = 0
for i in range(int(n)):
    a,b = input().split(" ")
    if a == b:
        x+=1
    else: x = 0
    if x==3:
        print("Yes")
        break
if x==0:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
count=0
flag=0
for num in range(n-1):
  i = list(map(int, input().split()))
  if i[0]==i[1]:
    count +=1
  else:
    count=0
  if count == 3:
    flag=1
if flag==0:
  print('No')
elif flag==1:
  print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
sub_yes = 0
max_yes = 0
for i in range(N):
    d1,d2 = map(int,input().split())
    if d1 == d2:
        sub_yes += 1
    else:
        max_yes = sub_yes
        sub_yes = 0
if sub_yes > max_yes:
    max_yes = sub_yes
if max_yes >= 3:
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

dice = int(input())

s = []
for i in range(1, dice+1):
    a = input().split(" ")
    s.append(a)

count = 0
for j in range(len(s)-1):
    if s[j][0] == s[j][1]:
        if s[j+1][0] == s[j+1][1]:
            count += 1
            if count >= 2:
                print("Yes")
                break
        else:
            count -= 1


if count < 2:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
numList = []
for x in range(n):
	num = [int(x) for x in input().split()]
	if num[0] == num[1]:
		numList.append('True')
	else:
		numList.append('False')
		
	
judge = 'No'
for x in range(len(numList)-3):
    if numList[x] == 'True':
      if numList[x+1] == 'True':
        if numList[x+2] == 'True':
          judge = 'Yes'
print(judge)

Submission status: Wrong Answer

Solution code:
s = int(input())
d = [[int(v) for v in input().split()] for i in range(s)]
ans = False
cnt = 0
for j in range(len(d)):
    if cnt == 3:
        ans = True
        break
    if all(elem == d[j][0] for elem in d[j]):
        cnt += 1
    else:
        cnt = 0
if ans:
    print ("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
a = []

for i in range(n):
  al, be = map(int, input().split())
  if al == be:
    count += 1
    if count >= 3:
      print("Yes")
  else:
    count = 0
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

list = [input() for i in range(N)]

ans = "No"

for i in range(1, N):
  if i < N-1:
    a,b = map(int, list[i].split())
    x = int(list[i-1].split()[1])
    y = int(list[i+1].split()[0])
    if a == b == x:
      ans = "Yes"
    elif a==b==y:
      ans = "Yes"
  else:
    if a == b== x:
      ans = "Yes"

print(ans)

Submission status: Wrong Answer

Solution code:
num = int(input())
count = 0
for i in range(num):
    d1, d2 = map(int,input().split())
    count += 1 if d1 == d2 else 0
print("Yes" if count >= 3 else "No")

Submission status: Wrong Answer

Solution code:
N=int(input())
D={}
for i in range(N):
    D[i]=input().split()

cou=0
for i in range(N):
    if D[i][0]==D[i][1]:
        cou+=1
    else:
        cou=0
    
    if cou == 3:
        print('Yes')
        break

if cou == 0:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
d1d2 = [map(int, input().split()) for _ in range(n)]
d1, d2 = [list(i) for i in zip(*d1d2)]
count = 0
for i in range(n-3):
    if d1[i] == d2[i] and d1[i+1] == d2[i+1] and d1[i+2] == d2[i+2]:
        count += 1
if count > 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
count=0
flag=0
for num in range(n-1):
  i = list(map(int, input().split()))
  if i[0]==i[1]:
    count +=1
  else:
    count=0
  if count == 3:
    flag=1
    break
if flag==0:
  print('No')
elif flag==1:
  print('Yes')

Submission status: Wrong Answer

Solution code:
import sys

n=int(input())

d=[]
for i in range(n):
        a=list(map(int,input().split()))
        d.extend(a)

c=0
for j in range(0,len(d)-2,2):
        if d[j]==d[j+1]:
                c+=1
                if c==3:
                        print('Yes')
                        sys.exit()
        else:
                c=0
                
print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 入力
N = int(input())

l = []
for i in range(N):
    d1, d2 = map(int, input().split())
    l.append([d1, d2])

flag = 0
cont = 0
for i in l:
    if(i[0]==i[1]):
        flag = 1
        cont = cont + 1
        if (cont>=3):
            break
    else:
        cont = 0
        flag =0



if (cont >=3):
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
n = int(input())

zoro = 0

for i in range(n):
    d1, d2 = map(int, input().split())
    if zoro == 3:
        print("Yes")
        quit()
    elif d1 == d2:
        zoro = zoro + 1
    else:
        zoro = 0

print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
count=0
for i in range(N):
    a,b=map(int,input().split())

    if a==b:
        count+=1
        if count==3:
            print("Yes")
            
        else:
            pass
            
    else :
        count=0

if count !=3:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
k=0
c=0
for i in range(n):
  a,b=map(int,input().split())
  if(a==b):
      k+=1
      if(k>=3):
          c=1
  else:
      k=0

if(c==1):
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
N = int(input())
l = [list(map(int, input().split())) for l in range(N)]

last = 0
for item in l:
  if last == 0 and item[0] == item[1]:
    last = 1
  elif last == 1 and item[0] == item[1]:
    last = 2
  elif last == 2 and item[0] == item[1]:
    last = 3
    break
  last == 0

if last == 3:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        a.append(True)
    else:
        a.append(False)
a.append(False)
a.append(False)
for i in a:
    if i == True:
        if a[a.index(i)+1] and a[a.index(i)+2]:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
D = [[0 for j in range(2)] for i in range(N)]
c, t = 0, 0

for i in range(N):
    D[i][0], D[i][1] = map(int, input().split())
    if c == 3:
        t = 1
    if D[i][0] == D[i][1]:
        c += 1
    else:
        c = 0
if t == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
i = 0
for count in range(1, N+1):
    a, b = map(int, input().split())
    if a == b:
        i += 1
if i == 3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = int(input())
d = [[int(v) for v in input().split()] for i in range(s)]
ans = False
cnt = 0
for j in range(len(d)):
    if cnt == 3:
        ans = True
        break
    if d[j].count(d[j][0]) == len(d[j]):
        cnt += 1
    else:
        cnt = 0
if ans:
    print ("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

cnt = 0
flg = 0

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

    if a == b:
        cnt += 1
        if cnt >= 3:
            flg = 1
    else:
        cnt = 0

    print(cnt)
    print(flg)

if flg == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        count += 1
    elif count == 3:
        break
if count == 3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
for i in range(n):
    x,y =map(int,input().split())
    if cnt == 3:
        print('Yes')
        exit()
    if x == y:
        cnt +=1
    else:
        cnt = 0
print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
d = [input().split(" ") for _ in range(n)]

f = False
for i in range(n-2):
    if d[i][0] == d[i][1] and not f :
        print(d[i+1], d[i+2])
        if d[i+1][0] == d[i+1][1] and d[i+2][0] == d[i+2][1]:
            f = True
if f:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
z = []
y = 0
for i in range(n):
  line = input().split(" ")
  if int(line[0])==int(line[1]):
    z.append(i)

for i in range(len(z)-3):
  if z[i]==z[i+1]-1:
    if z[i+1]==z[i+2]-1:
      y += 1
if y > 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
d = []
for i in range(n):
    d.append(list(map(int,input().split())))
row = []
for i in range(n):
    if d[i][0]==d[i][1]:
        row.append(True)
    else:
        row.append(False)
res = False
for i in range(n-2):
    print(row[i:i+3])
    if all(row[i:i+3]):
        res = True
if res:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
D = [list(map(int, input().split())) for i in range(N)]
cnt_cons=0

for i in range(1, N-2, 1):
  if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
    print("Yes")
    cnt_cons += 1
    exit()
if cnt_cons == 0:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
d = []

for i in range(n) :
    input_line = list(map(int, input().split(" ")))
    d.append(input_line)

count = 0
answer = "no"
for i in range(n) :
    if d[i][0] == d[i][1] :
        count += 1
        if count > 1 :
            answer = "yes"
    else :
        count = 0
    
if answer == "yes" :
    print("Yes")
else :
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
cnt = []
for i in range(N):
    a, b = map(int, input().split())
    if a == b:
        cnt.append(1)
    else:
        cnt.append(0)
from itertools import groupby
for key, group in groupby(cnt):
    if  len(list(group)) >= 3:
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
l = [list(map(int, input().split())) for l in range(N)]

last = 0
for item in l:
  if last == 0 and l[0] == l[1]:
    last = 1
  elif last == 1 and l[0] == l[1]:
    last = 2
  elif last == 2 and l[0] == l[1]:
    last = 3
    break
  last == 0

if last == 3:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
arr= []
for i in range(n):
  z = [ int(i) for i in input().split()]
  arr.append(z)
  
count = 0 
for i in range(n):
  
    if arr[i][0] == arr[i][1]:
      count+=1
      
if count>=3:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
c=False
for i in range(n):
    l.append(list(input().split()))
for x in range(n-3):
    if l[x][0]==l[x][1]:
        if l[x+1][0]==l[x+1][1]:
            if l[x+2][0]==l[x+2][1]:
                c=True
if c:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

cnt = 0
for i in range(n):
    d1, d2 = input().split()
    if d1 == d2:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        print('Yes')
        break
print('No')

Submission status: Wrong Answer

Solution code:
i = int(input())
d = [list(map(int, input().split())) for i in range(i)]

c = 0
for i in range(len(d)):
    if (d[i][0] == d[i][1]):
        c += 1
print("Yes" if c >= 3 else "No")

Submission status: Wrong Answer

Solution code:
N = int(input())
D = 0

for i in range(N):
    D1, D2 = map(int, input().split())
    if D < 0:
        D = 0
    elif D == 3:
        print('Yes')
        break

    if D1 == D2:
        D += 1

    elif D1 != D2:
        D -= 1

if D != 3:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
a=0
for i in range(n):
  if x[i]==y[i]:
    a+=1
if a>=3:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
d = [0] * n
x = [0] * n
for i in range(n):
    d[i], x[i] = map(int, input().split())
m = 0
for i in range(n-3):
  if d[i]==x[i] and d[i+1]==x[i+1] and d[i+2]==x[i+2]:
    break
  else:
    m = m+1
if m==n-3:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

L=[]
flag=False
for _ in range(N):
    d1, d2 = map(int, input().split())
    L.append(d1/d2)

for i in range(N-2):
    if sum(L[i:i+3]) == 3:
        flag=True
    
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N=int(input())
x=[]
for i in range(N):
    x.append(list(map(int,input().split())))
for i in range(N-2):
    if x[i][0]==x[i][1] and x[i+1][0]==x[i+1][1] and x[i+2][0]==x[i+2][1]:
        print("Yes")
        break
    else:
        print("No")
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]
i = 0
count = 0
while i < N:
    if D[i][0] == D[i][1]:
        count += 1
    else:
        count = 0
    i += 1

if count >= 3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

flag = 0
ans = 0

for i in range(N):
    a,b = map(int,input().split())
    if a == b:
        flag += 1
        print(flag)
        if flag == 3:
            ans += 1
    else:
        flag = 0
        print(flag)
if ans >= 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input(""))
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
for a in range(N):
  if x[a] == y[a]:
    print("Yes")
    e = 1
    break
  else:
    e = 0
if e == 0:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
count = 0
for k in range(n-2):
    if x[k] == y[k] and x[k+1] == y[k+1] and x[k+2] == y[k+2]:
        count += 1
if count >= 1:
    print('Yes')
else:
    print('NO')