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:
import sys

n = int(input())
cnt = 0
for i in range(n):
    a,b = map(int,input().split())
    if cnt == 3:
        print('Yes')
        sys.exit()
    elif a == b:
        cnt += 1
    else:
        cnt = 0
print('No')

Submission status: Wrong Answer

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

  cnt = 0
  for i in range(N):
    if cnt >= 3:
      return 'Yes'
    if x[i] == y[i]:
      cnt += 1
    else:
      cnt = 0
  return 'No'

print (solution())

Submission status: Wrong Answer

Solution code:
n = int(input())
a,b = map(int,input().split())
c,d = map(int,input().split())
flag = 0
for i in range(n-2):
  e,f = map(int,input().split())
  if a == b and c == d and e == f:
    flag = 1
    break
  a,b = c,d
  c,d = e,f
if flag == 0:
  print("NO")
else:
  print("YES")

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(0,n):
  count=0
  m,p=input().split() 
  if(m==p):
    count=count+1
if(count%3==0):
  print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import os,sys
c=0

n=input()
for i in range(int(n)):
    m=input()
    one=m[0]
    two=m[2]
    if(one==two):
        c+=1
    else:
        c=0
    
if(c>=3):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

  cnt = 0
  for i in range(N):
    print (x[i], y[i])
    if cnt >= 3:
      return 'Yes'
    if x[i] == y[i]:
      cnt += 1
    else:
      cnt = 0
  return 'No'

print (solution())

Submission status: Wrong Answer

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

ans = []
for i in range(n):
  a = num_list[i]
  a1= a[0]
  a2 = a[1]
  if a1 == a2:
    ans.append(1)
    if i > 1 and ans[i-2] == 1 and ans[i-1] == 1 and ans[i] == 1:
      print('Yes')
      break
  else:
    ans.append(0)
if 0 in ans :
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
for i in range(0,n):
  m,p=input().split() 
  if(m==p):
    count=count+1
if(count%3==0):
  print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())
List = list()
for i in range(N):
  List.append(list(map(int, input().split())))
List = sum(List, [])
for i in range(1,N-2):
  if List[2*i-2] == List[2*i-1]:
    if List[2*i] == List[2*i+1]:
      if List[2*i+2] == List[2*i+3]:
        print("Yes")
        exit()
      else:
        pass
    else:
      pass
  else:
    pass
print("No")

Submission status: Wrong Answer

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

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
gr = groupby(cnt)
for key, group in gr:
    if len(list(group)) >= 3:
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
list2 = []
list1 = []
for i in range(0, n):
    r = input()
    s = r.split(" ")
    num1 = int(s[0])
    num2 = int(s[1])
    list1.append(int(num1))
    list2.append(int(num2))
for i in range(0, n - 2):
    if list1[i] == list2[i]:
        if list1[i + 1] == list2[i + 1]:
            if list1[i + 2] == list2[i + 2]:
                print('Yes')
            else:
                print('No')
            break
        else:
            print('No')
        break
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
import os,sys
c=0

n=input()
for i in range(int(n)):
    m=input()
    one=m[0]
    two=m[2]
    if(one==two):
        c+=1
    
if(c>=3):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
temp = list()
for _ in range(int(input())):
    temp.append(tuple(map(int, input().split())))
i = 0
con = 0
bool = True
while i < len(temp):
    if con == 3:
        bool = False
        print('Yes')
        break
    elif temp[i][0] == temp[i][1]:
        con += 1
        i += 1
    else:
        con = 0
        i += 1
if bool:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())

eq = 1
prev = False
for i in range(n):
    d = [int(s) for s in input().split(' ')]
    if d[0] == d[1]:
        if prev:
            eq += 1
        prev = True
    else:
        prev = False
        eq = 1

if eq >= 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
        if sub_yes > max_yes:
            max_yes = sub_yes
    else:
        if sub_yes > max_yes:
            max_yes = sub_yes
        sub_yes = 0
if max_yes >= 3:
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

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

ans = []
for i in range(n):
  a = num_list[i]
  a1= a[0]
  a2 = a[1]
  if a1 == a2:
    ans.append(1)
    if i > 1 and ans[i-2] == 1 and ans[i-1] == 1 and ans[i] == 1:
      print('Yes')
      break
  else:
    ans.append(0)
if len(ans) == n and n != i+1 :
  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)]
cnt=0
result="No"
# 出力して確認
#for n in range(N-1):
for i in range(N):
    cnt+=1 if x[i]==y[i] else 0
    if cnt>2:
        result="Yes"
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
list1 = []
list2 = []
for i in range(N-1):
    a, b = list(map(int, input().split()))
    list1.append(a)
    list2.append(b)
    
for i in range(N-1):
  if list1[i] == list2[i]:
    count += 1
    if count >= 3:
      break
  else:
    count = 0
if count >= 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:
        if sub_yes > max_yes:
            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:
def divisor(n): 
    i = 1
    count = 0
    while i * i < n:
        if n%i == 0:
           count += 2
        i += 1
    if i * i == n:
    	count =+ 1
    return count
    
n = int(input())

count = 0
for num in range(n):
	count += divisor(num)
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input()) 

if n>=3:
    count = 0
    for i in range(n):
        d = list(map(int, input().split(" ")))
        if d[0]<=6 and d[0]>=1:
            if d[1]<=6 and d[1]>=1:
                if  d[0]== d[1]: count+=1
            else: exit()
        else: exit()
    if count >= 3: print("yes")
    else: print("no")
else:
    pass

Submission status: Wrong Answer

Solution code:
import math


def a():
    s = input()
    if s[-1] == 's':
        print(s + 'es')
    else:
        print(s + 's')


def b():
    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 + 2][0] == d[i + 2][1] and \
            d[i + 1][0] == d[i + 1][1] and \
                d[i][0] == d[i][1]:
            print('yes')
            break
    else:
        print('No')


def c():
    pass


def d():
    pass


# a()
b()
# c()
# d()

Submission status: Wrong Answer

Solution code:
N = int(input())
j = 0
if N >= 3:
    for i in range(0, N):
        D = str(input())
        D = D[0::2]
        if D[0] == D[1]:
            j += 1
    if j == 3:
        print("Yes")
    elif j == 6:
        print("Yes")
    elif j != 3:
        print("No")
    else:
        print("No")

Submission status: Wrong Answer

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


a = p[0]
b = 0
ans  = 0
tf = 1

for j in range(n):
  if sum(p[j]) // 2 * 2 == sum(p[j]):
    ans += 1
  else:
    ans = 0
  if ans == 3:
    tf = 0
    print("Yes")
    break
    
if tf == 1:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
list1 = []
list2 = []
for i in range(N-1):
    a, b = list(map(int, input().split()))
    list1.append(a)
    list2.append(b)
    
for i in range(N-1):
  if list1[i] == list2[i]:
    count += 1
    if count == 3:
      break
  else:
    count = 0
if count == 3:
  print("Yes")
else:  
  print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
k=0
f=False
for _ in range(n-1):
    a,b=map(int,input().split())
    if a==b:
        k+=1
        if k==3:
            print("Yes")
            f=True
    else:k=0
if f==False:print("No")

Submission status: Wrong Answer

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

ans = []
for i in range(n):
  a = num_list[i]
  a1= a[0]
  a2 = a[1]
  if a1 == a2:
    ans.append(1)
    if i > 1 and ans[i-2] == 1 and ans[i-1] == 1 and ans[i] == 1:
      print('Yes')
      break
  else:
    ans.append(0)
if len(ans) == n:
  print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())

counter = 0
for i in range(N):
    A, B = map(int, input().split())
    if A == B:
        counter += 1

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

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input(""))
a = np.zeros((n,2))
cnt = 0

for i in range(n): 
    a[i] = input().split()

for i in range(n):
    if a[i][0] == a[i][1]:
        cnt +=1

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

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

  cnt = 0
  flg = 0
  for i in range(N):
    if x[i] == y[i]:
      if flg+1 == i:
        cnt += 1
        flg = i
      else:
        cnt = 0

  if cnt >= 3:
    return 'Yes'
  return 'No'

print (solution())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
cnt = 0
n = int(input())
for i in range(0,n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        cnt += 1
        if cnt == 3 :
            print("Yes")
            break
    elif cnt != 3 and i == n-1:
        print("No")
    else:
        cnt == 0

Submission status: Wrong Answer

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

ans = []
for i in range(n):
  a = num_list[i]
  a1= a[0]
  a2 = a[1]
  if a1 == a2:
    ans.append(1)
    if i > 2 and ans[i-2] == 1 and ans[i-1] == 1 and ans[i] == 1:
      print('Yes')
      break
  else:
    ans.append(0)
if len(ans) == n:
  print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
count=0
flg=0

for num in range(n):
    d1,d2 = map(int,input().split())
    if d1 == d2:
        count += 1
        if count>= 3:
            flg = 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict 
import sys
import math 
import random
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

cnt = 0
n = int(input())
for i in range(n):
    (x,y) = get_ints()
    if x==y:
        cnt+=1
if cnt>=3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc179/tasks/abc179_b
t = int(input())
count = 0
pre = 0
test = ''
for i in range(t):
    a, b = map(int, input().split())
    if (a == b):
        test = 'Yes'
        pre = 1
    else:
        pre = 0
        test = 'No'
    if test == 'Yes' and (pre == 1):
        count += 1
        test = 'Yes'
        pre = 1
if (count == 3) or (count == 6):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
cnt = 0
n = int(input())
for i in range(0,n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        cnt += 1
        if cnt == 3 :
            print("Yes")
            break
    else:
        cnt == 0
        
    if cnt != 3 and i == n-1:
        print("No")

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
count = 0
ans = 0

line = [input().split() for i in range(n)]

for j in line:
    if j[0] == j[1]:
        count += 1
        if count >= 3:
            ans += 1
        else:
            continue
    else:
        count = 1
if ans == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
str_list = [list(input().split()) for _ in range(n)]
for i in range(n-2):
  if str_list[i][0] == str_list[i][1] and str_list[i+1][0] == str_list[i+1][1] and str_list[i+2][0] == str_list[i+2][1]:
  	break
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
str_list = [list(input().split()) for _ in range(n)]
for i in range(n-2):
  if str_list[i][0] == str_list[i][1] and str_list[i+1][0] == str_list[i+1][1] and str_list[i+2][0] == str_list[i+2][1]:
  	break
  print('Yes')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:

n=int(input())
for i in range(0,n):
  count=0
  m,p=input().split() 
  if(m==p):
    count=count+1
if(count%3==0):
  print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num = int(input())
ll = []
lll = []
for i in range(num):
    d1,d2 = list(map(int,input().split()))
    if d1 == d2:
        ll.append([i,d1,d2])
    else:
        pass
count = 0
for k in range(len(ll)):
    lll.append(ll[k][0])
for l in lll:
    for m in range(len(lll)+1):
        if l==m:
            count +=1
            break
if count>1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = []
for _ in range(N):
  d1, d2 = map(int, input().split(' '))
  lst.append((d1, d2))
  
idx = 0
flag = False
while idx < N-2:
  cnt = 0
  for _ in range(3):
    d1, d2 = lst[idx]
    if d1 == d2:
      cnt += 1
  if cnt == 3:
    flag = True
    break
  else:
    idx += 1

print('Yes' if flag else 'No')

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(0,n):
  count=0
  m,n=input().split() 
  if(m==0):
    count=count+1
if(count%3==0):
  print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []
b = []
flg = False
for i in range(N):
    x, y = (map(int, input().split()))
    a.append(x)
    b.append(y)

for i in range(N):
    if flg: break
    if (a[i - 2] == b[i - 2]):
        if (a[i - 1] == b[i - 1]):
            if(a[i] == b[i]):
                flg = True
                break
                
print(flg if "Yes" else "No")

Submission status: Wrong Answer

Solution code:
n = int(input()) 
if n>=3:
    count = 0    
    for i in range(n):
        d = list(map(int, input().split(" ")))
        if  d[0]== d[1]: count+=1
    if count >= 3: print("yes")
    else: print("no")
else: pass

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
nn=[]
for i in range(n):
  d,dd=map(int,input().split())
  if d==dd:
    nn.append(d)
    count+=1
if count>=3:
  ans=0
  for j in range(1,count):
    if (nn[j]-nn[j-1])!=1:
      ans=0
    else:
      ans+=1
  if ans>=3:
    print("Yes")
  else:
    print("No")
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 d1 == d2:
    zoro += 1
  else:
    zoro = 0

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

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
flag = False
c = [0]*n
while count < n:
  a, b = map(int, input().split())
  count += 1
  if a == b and count < n:
    a, b = map(int, input().split())
    count += 1
    if a == b and count < n:
      a, b = map(int, input().split())
      count += 1
      if a == b and count < n:
        flag = True
        print("Yes")
        break

if flag == False:
  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 a!=b:
        if count<3:
            count=0
if count>2:
    print('YES')
elif count<3:
    print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


n = 0
for i in range(N-1):
    if x[i] == y[i]:
        n = n+1
    elif n >=3:
        break
    elif x[i] != y[i]:
        n = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
j = 0
for i in range(0, N):
    D = str(input())
    D = D[0::2]
    if D[0] == D[1]:
        j += 1

if j == 3:
    print("Yes")
elif j == 6:
    print("Yes")
elif j != 3:
    print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
z=0
ans=0
for i in range(N):
    a,b=map(int,input().split())
    if a==b:z+=1
    else:ans=max(ans,z);z=0
print('Yes'if 2<ans else'No')

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)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
f1, f2, f3 = 0, 0, 0
for i in range(n):
    f3 = f2
    f2 = f1
    d1, d2 = map(int, input().split())
    f1 = d1 == d2
    if f1 == f2 == f3:
        ans = 1
print('Yes' if ans else 'No')

Submission status: Wrong Answer

Solution code:
n = int(input())

num_list=[]
count=0

for i in range(n):
    a,b = map(int, input().split())
    if a==b:
        count+=1
    if a!=b:
        if count<3:
            count=0
if count>2:
    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
cu = 0
for i in range(n):
  for j in range(n):
    if i == j:
      continue 
    if arr[i][0]==arr[j][0]:
      cu +=1
    if arr[i][1] == arr[j][1]:
      cu +=1
    if cu>=1:
      break
      
if count>=3 and cu>=1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
count=0
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]:
    count+=1
    continue
    
  else:
    print("No")
    exit(0)
if 3<=count:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())


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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

cnt = 0
for a, b in lst:
  if a == b:
    cnt += 1
  else:
    continue

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

Submission status: Wrong Answer

Solution code:
n = int(input())
flag= True
count = 0
for i in range(n):
  a,b = list(map(int, input().split()))
  if a==b:
    count += 1
  else:
    count= 0
  if count==3:
    flag = True
if flag:
  print("yes")
else:
  print("no")

Submission status: Wrong Answer

Solution code:
N = int(input())

D = []
for i in range(N):
    Da,Db = (map(int,input().split()))
    if Da == Db:
        D.append(1)
    else:
        D.append(0)

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

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
count = 0
line = [input().split() for i in range(n)]
line = list(itertools.chain.from_iterable(line))

for j in range(len(line)-2):
    if line[j] == line[j+1]:
        if line[j+2] == line[j]:
            count += 1
            print('Yes')
    else:
        continue
if count == 0:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
z,w = [],[]
K = 0
for i in range(N):
  x,y = map(int,input().split())
  z.append(x)
  w.append(y)
for j in range(1,N-2):
  if z[j] == w[j] and z[j+1] == w[j+1] and z[j+2] == w[j+2]:
    K += 1

if K >= 1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
zoro = 0

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n=int(input())
lst=[]
for _ in range(n):
    lst.append(list(map(int,input().split())))
lst=np.array(lst).reshape(n,2)
for i in range(n-3):
    if all([lst[i][0]==lst[i][1],lst[i+1][0]==lst[i+1][1],lst[i+2][0]==lst[i+2][1]]):
        print("Yes")
        break
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
x = [list(map(int, input().split())) for i in range(N)]
A="NO"
for n in range(N-2):
    if x[n][0]==x[n][1] and x[n+1][0]==x[n+1][1] and x[n+2][0]==x[n+2][1]:
        A="YES"
        break
print(A)

Submission status: Wrong Answer

Solution code:
ctr = 0
for _ in range(int(input())):
    a, b = list(map(int, input().strip().split()))
    if a == b:
        ctr += 1
    else:
        ctr = 0
    
print(("No", "Yes")[ctr >= 3])

Submission status: Wrong Answer

Solution code:
n = int(input())
counter  = 0
value = False
for i in range(n):
    a,b = map(int, input().split())
    if i == 0:
        if a == b:
            counter+=1
            value = True
    else:
        if a == b and value == True:
            counter+=1
            value = True
        elif a == b and value == False:
            counter = 1
            value = True
        else:
            value = False

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

Submission status: Wrong Answer

Solution code:
n=int(input("enter n"))
for i in range(0,n):
  count=0
  m,n=input("Enter a three value: ").split() 
  if(m==0):
    count=count+1
if(count%3==0):
  print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
counter  = 0
value = False
for i in range(n):
    a,b = map(int, input().split())
    if i == 0:
        if a == b:
            counter+=1
            value = True
    else:
        if a == b and value == True:
            counter+=1
            value = True
        elif a == b and value == False:
            counter = 1
            value = True
        else:
            value = False
    print(counter)

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

Submission status: Wrong Answer

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


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

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

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    D = [list(map(int, input().split())) for i in range(n)]
    cnt = 0
    for d1, d2 in D:
        if d1 == d2:
            cnt += 1
            if cnt == 3:
                print('Yes')
                exit()
    print('No')
    # for i in range(2, n):
    #     if D[i-2][0] == D[i-2][1]:
    #         if D[i-1][0] == D[i-1][1]:
    #             if D[i][0] == D[i][1]:
    #                 print('Yes')
    #                 exit()
    # print('No')
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

num_list=[]
count=0

for i in range(n):
    a,b = map(int, input().split())
    if a==b:
        count+=1
        if count>2:
            break
    if a!=b:
        count=0
if count>2:
    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
    if d1 != d2:
        zoro = 0
    else:
        zoro = zoro + 1
        
if res == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
count = 0

line = [input().split() for i in range(n)]
line = list(itertools.chain.from_iterable(line))

for j in range(len(line)-3):
    if line[j] == line[j+1]:
        if line[j+2] == line[j]:
            count += 1
            print('Yes')
    else:
        continue
    
if count == 0:
    print('No')

Submission status: Wrong Answer

Solution code:
N=input()
n=int(N)
x=0
for s in range(n):
  ds1,ds2=input().split()
  Ds1=int(ds1)
  Ds2=int(ds2)
  if Ds1==Ds2:
    x+=1
  else:
    x+=0
if x>3:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
flag= True
count = 0
for i in range(n):
  a,b = list(map(int, input().split()))
  if a==b:
    count += 1
  else:
    count= 0
  if count==3:
    flag = True
if flag:
  print("yes")
else:
  print("No")

Submission status: Wrong Answer

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

flag = "No"

if N <3:
  flag = "No"

else:

  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())
d1d2 = [map(int, input().split()) for _ in range(n)]
d1, d2 = [list(i) for i in zip(*d1d2)]
h = False
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 = True
                    break
if h == False:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

    if cnt == 3:
        ans = True
        break
if ans:
    print ("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0
for i in range(N):
    x, y = map(int, input().split())
    if x == y:
        count += 1

if count < 3:
    print("No")
else:
    print("Yes")