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:
N = int(input())

for _ in range(N):
  D = map(int, input().split())
  D = list(D)
  if D[0] == D[1]:
    print('Yes')
    break
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N=int(input())
L=0
for i in range(N):
    K=set(map(int,input().split()))
    if len(K)==1:
        L+=1
    else:
        L=0
if L>=3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
D = [list(map(int, input().split())) for _ in range(n)] 
ct = 0
CT = []
for i in range(n):
    if D[i][0] == D[i][1]:
        ct += 1
    else:
        CT.append(ct)
        ct = 0
for k in CT:
    if k >= 3:
        print('Yes')
        exit()
print("No")

Submission status: Wrong Answer

Solution code:
import sys
import re
import queue
import collections
import math
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
	N = i_input()
	D = []
	for i in range(0,N):
		tmp1,tmp2 = i_map()
		if(tmp1 == tmp2):
			D.append(1)
		else:
			D.append(0)

	flag = False
	for i in range(0,N-3):
		if(D[i]==D[i+1]==D[i+2]==1):
			flag = True

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

	return

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
count_max = count
for i in range(N):
    di_1, di_2 = [int(i) for i in input().split()]
    if di_1 == di_2:
        count += 1
    else:
        count_max = max([count_max, count])
        count = 0
if count >= 3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

d12 = [map(int, input().split()) for _ in range(n)]
d1, d2 = [list(i) for i in zip(*d12)]

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 = [list(map(int,input().split())) for i in range(n)]

count=0
for i in x:
    if count==3:
        print("Yes")
        break
    elif i[0]==i[1]:
        count+=1
    else:
        count=0
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
flag = 0
for i in range(n):
    n1, n2 = map(int, input().split())
    if n1 == n2:
        flag += 1
        if flag == 3:
            print("Yse")
            break
    else:
        flag = 0
print("No")

Submission status: Wrong Answer

Solution code:
def readInt():
    return int(input())
def readList():
    return list(map(int,input().split()))
def readMap():
	return map(int,input().split())
def readStr():
    return input()
inf=float('inf')
mod = 10**9+7
import math
def solve(n,A):
    count=0
    for x,y in A:
        if x==y:
            count+=1
        else:
            count=0
        if count==3:
            return True
    return False

n=readInt()
A=[]
for _ in range(n):
    A.append(readList())
if solve(n,A):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
n = int(input())

pv = []
con = 0

while n > 0:
    n -= 1
    s = str(input())
    d = s.split()
    if d[0] == d[1]:
        con += 1
    else:
        pv += [con]
        con = 0

pv += [con]
ans = max(pv)

if int(ans) >= 3:
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
a =int( input())
_number=0;_kaerichi="No"
for i in range(a):
    b, c = map(int, input().split())
    if(b==c):
        _number+=1
    if(_number==3):
        _kaerichi="Yes"
print(_kaerichi)

Submission status: Wrong Answer

Solution code:
n = int(input())
flg = False

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

for i in range(n-3):
    if (res[i] + res[i+1] + res[i+2]) == 3:
        flg = True
        break
if flg:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
D = []

ans =0
for _ in range(N):
    N,M=(map(int, input().split()))
    if N==M:
        ans +=1

if ans == N:
    print("Yes")
else:
    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:
i = int(input())
count = 0
for i in range(i):
  a, b = input().split(' ')
  if a == b:
    count += 1
  else:
    count = 0
print('Yes' if count >= 3 else 'No')

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0
zoro = 0

for i in range(n):
    x,y = map(int,input().split())
    if x == y:
        zoro = zoro + 1
    else:
        if ans < zoro:
            ans = zoro

if ans < zoro:
    ans = zoro


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

Submission status: Wrong Answer

Solution code:
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
count = 0
re = "No"

for i in range(n):
    if d[i][0] == d[i][1]:
        count += 1

    elif count >= 3:
        re = "Yes"
        break
    else:
        count = 0

print(re)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

pv = []
con = 0

while n > 0:
    n -= 1
    s = str(input())
    d = s.split()
    if d[0] == d[1]:
        con += 1
    else:
        pv += [con]
        con = 0

pv += [con]
ans = max(pv)

if ans >= 3:
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

d = []

for _ in range(n):
    d1, d2 = map(int, input().split())
    
    d.append((d1, d2))
    
# # print(d)

for i in range(n-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]:
        print('Yes')
        break
        
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

flag=0
for i in range(1,n-1):
  if l[i-1][0]==l[i-1][1] and  l[i][0]==l[i][1] and  l[i+1][0]==l[i+1][1]:
    flag=1
    break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

count=0
for i in x:
    if count==3:
        print("Yes")
        break
        
    elif i[0]==i[1]:
        count+=1
    else:
        count=0
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
result = 'No'
count = 0
for i in range(n):
    i_1, i_2 = map(int, input().split())
    if count == 3:
        result = 'Yes'
        break
    else:
        if i_1 == i_2:
            count += 1
        else:
            count = 0
print(result)

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(c)

Submission status: Wrong Answer

Solution code:
num=int(input())
re=0
res=0
for i in range(num):
    a=input().split(" ")
    if a[0]==a[1]:
        re +=1
        if re>=3:
            res=1
    else:
        re=0

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

Submission status: Wrong Answer

Solution code:
N = int(input())
prev = [False, False, False]
for n in range(N):
    if all(prev):
        print('Yes')
        import sys
        sys.exit()
    D1, D2 = list(map(int, input().split(' ')))
    prev = prev[1:] + [D1 == D2]

print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
temp = 0

for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        if temp < count:
            temp = count

        count = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
for i in range(N):
    di_1, di_2 = [int(i) for i in input().split()]
    if di_1 == di_2:
        count += 1
    else:
        count = 0
if count >= 3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

c = 0
for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        c += 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
i = 0
for _ in range(n):
    x, y = map(int, input().split())
    i += int(x == y)
    if i == 3:
        print("Yes")
        break
if(i < 3):
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
D=""
for i in range(N):
  a=input().split()
  D=D+a[0]+a[1]
if "333" in D:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())

number = 0
for i in range(n):
  a, b = map(int, input().split())
  if a == b:
    number += 1
  else:
    number = 0
  if number == 3:
    print("Yes")

print("No")

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    zoro = 0
    for _ in range(N):
        d1 , d2 = map(int,input().split())
        if d1 == d2:
            zoro += 1
        else:
            zoro = 0
        if zoro > 2:
            print("yes")
            return
    print("No")

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
f=[]
for x in l:
	f.append(x[0]==x[1])
l=f.copy()
i=0
while i<n:
	j=0
	while i+j<n and l[i+j]==l[i]:
		j+=1 
	if j>2:
		print('Yes')
		break	
	i+=j
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 count == 3:
    print('Yes')
    exit()
  elif D1 == D2:
    count += 1
  else:
    count = 0

print('No')

Submission status: Wrong Answer

Solution code:
N=int(input())
count=0
lst=[]
for i in range(N):
    x,y=map(int,input().split())
    # l=[]
    # l.append(x)
    # l.append(y)
    # lst.append(l)
    if x==y:
        count+=1
    if x!=y:
        continue
        count=0
if count>=3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
c=0
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    c+=1
  else:
    c=0
if c>2:
  print("Yes")
else:
  print("No")
#print(c)

Submission status: Wrong Answer

Solution code:

def input_int():
    return(int(input()))

def input_int_list():
    return(list(map(int,input().split())))

def input_int_map():
    return(map(int,input().split()))

def run():
    q_num = input_int()

    count_num = 0

    for _ in range(q_num):

        a, b = input_int_map()

        if a == b:
            count_num += 1

            if count_num == 3:
                print('YES')
                return
        else:
            count_num = 0

    print('NO')

run()

Submission status: Wrong Answer

Solution code:
n = int(input())
D_1 = [0 for i in range(n)]
D_2 = [0 for i in range(n)]
for i in range(n):
    D_1[i], D_2[i] = map(int, input().split())

tmp = 0
ans = 0
for i in range(n):
    if D_1[i] == D_2[i]:
        tmp += 1
    else:
        ans = max(tmp, ans)
        tmp = 0
ans = max(tmp, ans)

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

Submission status: Wrong Answer

Solution code:
s = ""
for _ in " "*int(input()):
  a,b = map(int,input().split())
  if a == b:
    s +="0"
if "000" in s:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

flag = 0

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

if flag >= 3:
    print("Yes")
else:
    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:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def func():
    count = 0
    for _ in range(N):
        if count == 3:
            return "Yes"
        a, b = map(int, input().split())
        if a == b:
            count += 1
        else:
            count = 0
    return "No"


N = int(input())

print(func())

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]
ans = 0
count = 0

for i in range(N-3):
    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]):
                count = 1

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

#print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
D = [input().split() for _ in range(N)]
zoro = [d1 == d2 for d1, d2 in D]
for i in range(N-3):
  if zoro[i] and zoro[i+1] and zoro[i+2]:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

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

cnt = 0
for i in range(N):
    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())
t = 0
for i in range(N):
    a, b = [int(x) for x in input().split()]
    if a != b:
        t = 0
    else:
        t += 1
    if t == 2:
        break
if t == 3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
okay = False
for i in range(n):
  temp1, temp2 = map(int,input().split())
  if count >= 3:
    okay = True
    break
  if temp1 == temp2:
    count += 1
  else:
    count = 0

if okay == True:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

c = 0

for _ in range(n):
    d, e = map(int,input().split())
    if d == e:
        c += 1

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

Submission status: Wrong Answer

Solution code:
N=int(input())
count=0
lst=[]
for i in range(N):
    x,y=map(int,input().split())
    # l=[]
    # l.append(x)
    # l.append(y)
    # lst.append(l)
    if x==y:
        count+=1
    if x!=y:
        continue
        count=0
if count==3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
flg = False

for i in range(n):
    d1, d2 = map(int, input().split())
    if cnt == 0 and d1 == d2:
        cnt += 1
    if cnt > 0:
        if d1 == d2:
            cnt += 1
        else:
            cnt = 0
    if cnt == 3:
        flg = True
        
if flg:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
x=int(input())
count=0
for a in range(x):
  b=input().split(' ')
  if int(b[0])==int(b[1]):
    count+=1
  else:
    count=0
  if count==3:
    break
if count==3:
  print('yes')
else:
  print('no')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, D: "List[List[int]]"):
    cnt = 0
    for i in range(1, len(D)):
        d1, d2 = [int(t) for t in D[i]]
        if d1 == d2:
            cnt += 1
        else:
            cnt = 0
        if cnt == 3:
            return YES
    return NO


# Generated by 1.1.7.1 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()
    N = int(next(tokens))  # type: int
    D = [[int(next(tokens)) for _ in range(2)] for _ in range(N)]  # type: "List[List[int]]"
    print(solve(N, D))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num=int(input())
re=0
for i in range(num):
    a=input().split(" ")
    if a[0]==a[1]:
        re +=1

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

Submission status: Wrong Answer

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

n=[]
for i in b:
    if i[0]==i[1]:
        n.append(1)
        continue
    n.append(0)
for i in range(a-3):
    if n[i]==1 and n[i+1]==1 and n[i+2]==1:
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

c = 0

for d in D:
    if d[0] == d[1]:
        c += 1
if c>=3:
    print('Yes')    
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
d=[]
ok=False
for i in range(n):
    l=list(map(int,input().split()))
    d.append(l)
for i in range(n-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]:
        ok=True
if ok:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#from collections import deque
#from heapq import heapify, heappop, heappush
#from bisect import insort
#from math import gcd
#mod = 10**9 + 7
N = int(input())
#N, K = map(int, input().split())
#A = list(map(int, input().split()))
flag1 = False
flag2 = False
flag3 = False
c, d = map(int, input().split())
if c == d:
	flag1 = True
c, d = map(int, input().split())
if c == d:
	flag2 = True
c, d = map(int, input().split())
if c == d:
	flag3 = True

k = 3
while k < N:
	if flag1 and flag2 and flag3:
		break
	k += 1
	c, d = map(int, input().split())
	flag1 = flag2
	flag2 = flag3
	if c == d:
		flag3 = True
		

#ans = 0
#print(ans)
#print('Yes')
if flag1 and flag2 and flag3:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

n = int(input())
d = [[0 for _ in range(2)] for _ in range(n)]
for i in range(n):
    d[i][0], d[i][1] = map(int, input().split())

for i in range(n-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]:
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import exit
N = int(input())
 
cnt = 0
for i in range(N):
    x,y = map(int,input().split())
    if cnt == 3:
        print("Yes")
        exit(0)
    if x == y:
        cnt += 1
    else:
        cnt = 0

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

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = [False]*n

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

ans = 'No'

for i in range(n-3):
    if cnt[i] and cnt[i+1] and cnt[i+2]:
        ans = 'Yes'

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
si = sys.stdin.readline

n = int(si())
t = 0
flag = False
while n:
    n -= 1
    if t >= 3:
        flag = True
    a, b = [int(e) for e in si().split()]
    if a == b:
        t += 1
    else:
        t = 0
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
print("YNEOS"["000" not in "".join([str(eval(input().replace(" ","-")))for _ in "_"*int(input())])::2])

Submission status: Wrong Answer

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

cnt = 0
for i in d:
    if cnt >= 3:
        print('Yes')
        exit()
    if i[0] == i[1]:
        cnt += 1
    else:
        cnt = 0

print('No')

Submission status: Wrong Answer

Solution code:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
flag = False
dices = []
for i in range(N):
    a, b = list(MAP())
    if a == b:
        dices.append(True)
    else:
        dices.append(False)

for i in range(N - 2):
    if dices[i] == dices[i + 1] == dices[i + 2]:
        flag = True

if flag:
    print("Yes")
else:
    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] = input().split()
flg = False
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]:
        flg = True
if flg:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
cnt=0
ans=0
for i in range(n):
    d,e=map(int,input().split())
    if d!=e:
        if cnt==3:
            ans=0
            break
        cnt=1
    else:
        cnt+=1
        if cnt==3:
            ans=1
            break
if cnt>=3:
    ans=1
if ans==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
flug = False
cnt = 0
for _ in range(N):
    D1, D2 = list(map(int, input().split())) 
    if D1 == D2:
        cnt += 1
    else:
        cnt = 0
    if cnt >= 3:
        flug = True
if flug:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

for i in range(len(l)-2):
    if l[i] == l[i+1] == l[i+2] == 3:
        print ('Yes')
        exit ()
print ('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
for i in range(n):
    d1,d2=list(map(int,input().split()))
    if d1==d2:
        count+=1
if count>=3:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import sys

N=int(input())
cnt=0
 
for i in range(N):
  D_1,D_2=map(int,input().split())
  if cnt==3:
    print('Yes')
    sys.exit()
  if D_1==D_2:
    cnt+=1
  else:
    cnt=0

print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import deque, Counter, defaultdict
from itertools import chain, combinations
import json
# import numpy as np
import bisect
import sys
import math
import bisect
from functools import lru_cache
import itertools

sys.setrecursionlimit(10 ** 8)

M = 10 ** 9 + 7
INF = 10 ** 17


def main():
    N = int(input())
    D = [
        [int(a) for a in input().split()]
        for _ in range(N)
    ]

    # N, K = [int(a) for a in input().split()]
    # A = [int(a) for a in input().split()]
    # T1, T2, T3 = [int(a) for a in input().split()]

    flag = False
    for i in range(N - 3):
        d1 = D[i]
        d2 = D[i + 1]
        d3 = D[i + 2]
        if d1[0] == d1[1] and d2[0] == d2[1] and d3[0] == d3[1]:
            flag = True
            break
    if flag:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
temp = 0

for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        if temp < count:
            temp = count

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

Submission status: Wrong Answer

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

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

cnt_max = max(cnt_max,cnt)

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