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: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    cnt = 0
    for i in range(N):
        d1, d2 = MI()
        if d1 == d2:
            cnt += 1
        else:
            cnt = 0

        if cnt == 3:
            print('Yes')
            return
    print('No')

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# じょえチャンネルおもしろいよ～～～
# https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ

n=int(input())
a=[]
for i in range(n):
  aa,b=map(int,input().split())
  if aa==b:a.append("1")
  else:a.append("0")
if "111" in "".join(a):print('Yes')
else:print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
Di1 = []
Di2 = []
nmDi = 0
if N >= 3 and N <= 100:
   for x in range(N):
      Di1.append(int(input()))
      Di2.append(int(input()))
   for x in range(N):
      if Di1[x] == Di2[x]:
         nmDi += 1
         if nmDi == 3:
            break
      elif Di1[x] != Di2[x] and nmDi > 0:
         nmDi = 0
   if nmDi >= 3:
      print("Yes")
   else:
      print("No")
else:
   print ("No")

Submission status: Runtime Error

Solution code:
N = int(input())
Di1 = []
Di2 = []
nmDi = 0
if N >= 3 and N <= 100:
   for x in range(N):
      Di1.append(int(input()))
      Di2.append(int(input()))
   for x in range(N):
      if Di1[x] == Di2[x]:
         nmDi += 1
         if nmDi == 3:
            break
      elif Di1[x] != Di2[x] and nmDi > 0:
         nmDi = 0
   if nmDi >= 3:
      print("Yes")
   else:
      print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
Di1 = []
Di2 = []
nmDi = 0
if N >= 3 and N <= 100:
   for x in range(N):
      Di1.append(int(input()))
      Di2.append(int(input()))
for x in range(N):
   if Di1[x] == Di2[x]:
      nmDi += 1
      if nmDi == 3:
         break
   elif Di1[x] != Di2[x] and nmDi > 0:
      nmDi = 0
if nmDi >= 3:
   print("Yes")
else:
   print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
dD = [map(int, input().split()) for _ in range(5)]
d,D = [list(i) for i in zip(*dD)]
count = 0

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
D1D2 = [map(int, input().split()) for _ in range(5)]
D1,D2 = [list(i) for i in zip(*D1D2)]
count = 0

for i in range(n-1):
  if D1[i] == D2[i]:
    count += 1
  else:
    count *= 0

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def func(D):
  comb = 0
  for item in D:
    if item[0]==item[1]:
      comb+=1
    else:
      comb=0
    
    if comb==3:
      return "Yes"  
  return "No"

if __name__ == "__main__":
    N = int(input())
    D = [map(int, input().split()) for _ in range(N)]
    print(func(D))

Submission status: Runtime Error

Solution code:
N = input()

result = False
count = 0

for range(N):
    D1,D2 = map(int,input().split())
    if D1 == D2:
        count += 1
    else:
        count = 0

    if count > 2:
        result = True
        break

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

Submission status: Runtime Error

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
total = 0

for _ in range(n):
  total += 1
  if x[n] == y[n]:
    count += 1
    if count == 3:
      print("Yes")
      break
  else:
    count = 0
  if total == n and count < 3:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
ans = 0
s = []
for i in range(int(input())):
  a,b = map(int,input().split())
  if a==b:
    ans += 1
    s.append(ans)
  else:
    ans = 0
if max(s)>=3:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

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


answer = 'No'

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

    if count == 3:
        answer = 'Yes'
        break

print(answer)

Submission status: Runtime Error

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

for n in range(N):
    input_line = input().split()
    if (int(input_line[0]) == int(input_line[1])):
        count += 1
        if count == 3:
            temp = 1
    elif(temp ==1):
        break
    else:
        count = 0

if count >= 3:
        print('Yes')

else:
        print('No')

Submission status: Runtime Error

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

for n in range(N):
    input_line = input().split()
    if (int(input_line[0]) == int(input_line[1])):
        count += 1
    else:
        pass

if count >= 3:
        print(Yes)

else:
        print(No)

Submission status: Runtime Error

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

for n in range(N):
    input_line = input().split()
    if (int(input_line[0] == int(input_line[1])):
        count += 1
    else:
        pass

if count >= 3:
        print(Yes)

else:
        print(No)

Submission status: Runtime Error

Solution code:
n = int(input())
num_list = []
for i in range(n):
    a,b = map(int,input().split())
    num_list.append((a,b))
    
counter = 0 
d = 0
for x,y in num_list:
    if counter == 3:
        d += 1
        break
    elif x == y:
        counter += 1
    else x != y:
        counter = 0

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

Submission status: Runtime Error

Solution code:
n = int(input())
num_list = []
for i in range(n):
    a,b = map(int,input())
    num_list.append((a,b))
    
counter = 0 
d = 0
for x,y in num_list:
    if counter == 3:
        d += 1
        break
    if x == y:
        counter += 1
    else:
        counter = 0

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

Submission status: Runtime Error

Solution code:
def solve():
  N = int(input())
  lines = [input().split() for i in range(N)]
  for d,e in lines:
    if d==e:
      count += 1
      if count>=3:
        print("Yes")
        return
    else:
      count = 0
  print("No")
  return

solve()

Submission status: Runtime Error

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
cnt=0
for i in range(n):
    x,y=map(int,input())
    if x==y:
        cnt+=1
    else:
        cnt=0
    if cnt>=3:
        print("Yes")
        break
else:
    print("No")

Submission status: Runtime Error

Solution code:
import sys
N=int(input())
D =[]
for i in range(N):
  	d_1,d_2 = map(int,input().split())
    D.append([d_1,d_2])
for x in range(N-2):
  	if D[x][0]=D[x][1] and D[x+1][0]=D[x+1][1] and D[x+2][0]=D[x+2][1]:
      	print("Yes")
        sys.exit()
print("No")

Submission status: Runtime Error

Solution code:
N =int(input())
D = []
for i in range(n):
  D.append([])#配列の末尾に空の配列を追加

for i in range(N):
	for j in range(2):
      	D[i][j]=int(input())

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

Submission status: Runtime Error

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

for x in range(1,N+1):
  	if D[x][1]==D[x][2] and D[x+1][1]==D[x+1][2] and D[x+2][1]==D[x+2][2]:
      	print("Yes")
        break
    else:
      	print("No")

Submission status: Runtime Error

Solution code:
cnt = 0
for _ in range(n):
  a, b = map(int, input().split())
  if a == b:
    cnt += 1
  else:
    cnt = 0
  
  if cnt == 3:
    print("Yes")
    exit()

print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())
h = []
c = 0
while(x>0):
  m = list(map(int,input().split()))
  h.append(m)
  x = x - 1
 
for i in range(1,len(x)):
	if x[i][0] == x[i][1] and x[i-1][0] == x[i-1][1] and x[i+1][0] == x[i+1][1]:
      print("Yes")
    else:
      print("No")

Submission status: Runtime Error

Solution code:
def judge():
    count = 0
    for _ in range(n):
        d1, d2 = map(int, input().split(""))
        if d1 == d2:
            count += 1
        else:
            count = 0
        
        if count == 3:
            return True

    return False

n = int(input())

if judge():
    print("yes")
else:
    print("no")

Submission status: Runtime Error

Solution code:
def judge():
    count = 0
    flag = True
    for _ in range(n):
        d1, d2 = map(int, input().split(" "))
        if d1 == d2:
            count += 1
        else:
            count = 0
        
        
        if count == 3:
            flag = True
            break
        else:
            flag = False
            pass
    return flag

if judge():
    print("yes")
else:
    print("no")

Submission status: Runtime Error

Solution code:
def judge():
    count = 0
    flag = True
    for _ in range(n):
        d1, d2 = map(int, input().split(" "))
        if d1 == d2:
            count += 1
        else:
            count = 0
        
        
        if count == 3:
            print("yes")
            flag = True
            break
        else:
            flag = False
            pass
    return flag

if judge():
    print("yes")
else:
    print("no")

Submission status: Runtime Error

Solution code:
times = int(input())
zorome = 1
for i in range(times):
  a = input().rstrip().split(" ")
  b = int(a[0])
  c = int(a[1])
  if b == c:
    zorome = zorome + 1
  else:
    zorome = 1
if zorome => 3:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
s = 0
flag = 1

for i in range(n) :
    x = int(input())
    y = int(input())
    if x==y :
        s = s+1
    else :
        s = 0
    if s==3 :
        print("Yes")
        flag = 0
        break

if flag==1 :
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())
zorome3ormore=0
for n in range(x-2):
    if result1[n][0]==result1[n][1] and result1[n+1][0]==result1[n+1][1] and result1[n+2][0]==result1[n+2][1]:
        zorome3ormore+=1
    else:
        zorome3ormore+=0

if zorome3ormore>0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
l = []
t = 1
for _ in range(n):
  x = list(map(int,input().split())
  l.append(x)
count = 0
for i, j in l:
  if i == j:
    count += 1
  if i!=j:
    count = 0
  if count == 3:
  	t = 0
    print("Yes")
    break
if t:
  print("No")

Submission status: Runtime Error

Solution code:
cnt = 0
zorome = 0
num = input()

while cnt < num:
  mass = input().split()
  
  if(mass[0] == mass[1]):
    zorome += 1
    
    if(zorome >= 3):
      break
  else:
    zorome = 0
  
  cnt += 1

print("Yes" if zorome >= 3 else "No")

Submission status: Runtime Error

Solution code:
cnt = 0
zorome = 0
num = input()

while cnt < num:
  mass = input().split()
  
  if(mass[0] == mass[1]):
    zorome += 1
    
    if(zorome >= 3):
      break
  
  cnt += 1

print("Yes" if zorome >= 3 else "No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
and = D = [list(map(int,input().split())) for i 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: Runtime Error

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

print("No")

Submission status: Runtime Error

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

print("No")

Submission status: Runtime Error

Solution code:
d1,d2 = [],[]
n = int(input())
for i in range(n):
    a,b=map(int,input().split())
    d1.append(a)
    d2.append(b)
for i in n-2:
  if d1[i] == d2[i] and d1[i+1] == d2[i+1] and d1[i+2] == d2[i+2]:
	print("Yes")
  return 0

print("No")

Submission status: Runtime Error

Solution code:
d1,d2 = [],[]
n = int(input())
for i in range(n):
    a,b=input().split()
    d1.append(a)
    d2.append(b)
for i in n-2:
  if d1[i] == d2[i] and d1[i+1] == d2[i+1] and d1[i+2] == d2[i+2]:
	print("Yes")
  return 0

print("No")

Submission status: Runtime Error

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

print("No")

Submission status: Runtime Error

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

else :print("No")

Submission status: Runtime Error

Solution code:
ans = 0
count = 0
list = []
for i in range(100):
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for i in l+1:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      ans = 1
  else:
    count = 0

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

Submission status: Runtime Error

Solution code:
ans = 0
count = 0
list = []
for i in 100:
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for i in l:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      ans = 1
  else:
    count = 0

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

Submission status: Runtime Error

Solution code:
ans = 0
count = 0
for i in 100:
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for i in l:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      ans = 1
  else:
    count = 0

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

Submission status: Runtime Error

Solution code:
ans = 0
count = 0
for i in 100:
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for i in l:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      and = 1
  else:
    count = 0

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

Submission status: Runtime Error

Solution code:
ans = 0
count = 0
for i in sys.stdin:
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for 1 in l:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      and = 1
  else:
    count = 0

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

Submission status: Runtime Error

Solution code:
def main():
    import sys
    in = sys.stdin.buffer.readline
    ini = lambda: int(ns())
    ina = lambda: list(map(int, in().split()))
    ins = lambda: in().strip()
    
    n= ini()
    tmp = 0
    for _ in range(n):
        l,r = ina()
        if(l==r):
            tmp+=1
            if(tmp==3):
                print("Yes")
                return
        else:
            tmp =0
        


        


    




















if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def main():
    import sys
    inl = sys.stdin.buffer.readline
    
    n= int(input())
    tmp = 0
    for _ in range(n):
        l,r = map(int,inl().split())
        if(l==r):
            tmp+=1
            if(tmp==3):
                print("Yes")
                return
        else:
            tmp =0
        


        


    




















if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
#include <algorithm>
#include<bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;

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

Submission status: Runtime Error

Solution code:
n=int(input())
res = 0
flag = 1
for _ in range(n):
  k=int(input())
  l= int(input())
  if k == l:
      flag = 1
      res+=1
  else:
      falg=0
      if res<3:
        res=0
if res>=3:
  print("yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n=int(input())
l1=[]
res = 0;
flag = 1
for i in range(n):
  k=int(input())
  l= int(input())
  l1.append(k)
  l1.append(l)
i = 0  
while i<len(l1):  
     if l1[i] == l1[i+1]:
      flag =1
      res+=1
    else:
      falg=0
      if res<3:
        res=0
if res>=3:
  print("yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n= int(input())
res =0
flag =1
for i in range(n):
   k=int(input())
    l =int(input())
    if k==l:
       flag = 1
        res+=1
    else:
      flag=0
      if res<3:
        res=0
if res>=3:
  print("Yes")
else:
  print("NO")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
    def solution(arr):
      count = 0
      for i, val in enumerate(arr):
        if i > 0 and arr[i - 1] == val:
          count += 1
        else:
          count = 0
        if count == 2:
          return 'Yes'
      return 'No'
    n = int(input())
    arr = []
    for _ in range(n):
      arr.append(input())
    print(solution(arr))

Submission status: Runtime Error

Solution code:
def solution(arr):
  count = 0
  for i, val in enumerate(arr):
    if i > 0 and arr[i - 1] == val:
      count += 1
    else:
      count = 0
    if count == 2:
      return 'Yes'
  return 'No'
n = int(input())
arr = []
for _ in range(n):
  arr.append(input())
print(solution(arr)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
const ll M=1000000007;
//------------------------------------------//

int main(){
    ll N;cin>>N;
    ll D[N][2];
    bool f[N];
    rep(i,N){
        cin>>D[i][0]>>D[i][1];
        if(D[i][0]==D[i][1]) f[i]=true;
    }

    rep(i,N-2){
        if(f[i]==true && f[i+1]==true && f[i+2]==true){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
print('NYoe s'[[*'000']in[eval(eval(t.replace(*' -')))for t in open(0)]::2])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=input()
n=int(N)
for s in range(n):
  ds1,ds2=input().split()
if ds1==ds2 and d(s+1)1==d(s+1)2 and d(s+2)1==d(s+2)2:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import numpy as np
a = int(input())
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]
x=np.array(x)
y=np.array(y)
c = x -y 
b= np.where(c==0)
ren = np.array(range(len(b[0])))
d= b[0]-ren
u, counts = np.unique(d, return_counts=True)
if np.max(counts) >=3:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N = int(input())

count = 0

for i in range(N +1):
    k, t = map(int, input().split())
    if count == 3:
      print ( "yes" )
      count += 5
      break
      
    if not k == t:
        count *= 0
    if k == t:
       count += 1 
       
      
if not count >= 3:
  print ("no")

Submission status: Runtime Error

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

n = int(a[0])
Is = []
for i in range(N):
    Ds = list(map(int, a[i].split()))
    if Ds[0] == Ds[1]:
        Is.append(i)

Boooo = False
for i in range(len(Is)-2):
    if Is[i] == Is[i+1] and Is[i+1] == Is[i+2]:
        Boooo = True

if Boooo:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
count = 0
N = int(input())
for i in range(N):
    for j in range(3):
        A, B = map(int, input().split())
        if A == B:
            count += 1

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
for i in range(0,n):
    d,d1=list(map(int ,input().split()))
    if(d==d1):
        l.append("Yes")
        
    elif(d!=d1):
        l.append("No")
        
    # print(l)
    
a=l.count("Yes")

list_s=list(l)
length=len(l)
index=list_s.index("Yes")
# print(index)
min_index=length-3
new_le=length-min_index
# if(a==3 or a>3):
if(index<new_le):
    if(list_s[index]=="Yes" and list_s[index+1]=="Yes" and list_s[index+2]=="Yes"):
        print("Yes")
    else:
        print("No")
else:
    print("No")
# else:
#     print("No")

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
for i in range(0,n):
    d,d1=list(map(int ,input().split()))
    if(d==d1):
        l.append("Yes")
        
    elif(d!=d1):
        l.append("No")
        
    # print(l)
    
a=l.count("Yes")

list_s=list(l)
length=len(l)
index=list_s.index("Yes")
# print(index)
min_index=length-3
new_le=length-min_index
if(a==3 or a>3):
    if(index<new_le):
        if(list_s[index]=="Yes" and list_s[index+1]=="Yes" and list_s[index+2]=="Yes"):
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
for i in range(0,n):
    d,d1=list(map(int ,input().split()))
    if(d==d1):
        l.append("Yes")
        
    elif(d!=d1):
        l.append("No")
        
    # print(l)
    
a=l.count("Yes")

list_s=list(l)
length=len(l)
index=list_s.index("Yes")
# print(index)
min_index=length-3
if(a==3 or a>3):
    if(index<min_index):
        if(list_s[index]=="Yes" and list_s[index+1]=="Yes" and list_s[index+2]=="Yes"):
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Submission status: Runtime Error

Solution code:
list = []
x = 0
y = 0
n = int(input())
for i in range(n):
    a,b = map(int,input().split())
    list.append(a)
    list.append(b)
for _ in range(n):
    if list[x] == list[x+1]:
        if not list[x+1] == list[-1]:
            if list[x+2] == list[x+3]:
                if not list[x+3] == list[-1]:
                    if list[x+4] == list[x+5]:
                        y = 1
    if not list[x+7] == list[-1]:
        x = x + 2
if y == 0:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
for i in range(n-3):
    exist = True
    for j in range(3):
        if not d[i+j][0] == d[i+j][1]:
            exist = False
    if exist:
        break
if exist:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
ans = False
for i in range(n):
  d1,d2 = map(int,input().split())
  if d1 == d2:
    conseq += 1
    if conseq >= 3:
      ans = True
  else:
    conseq = 0

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

Submission status: Runtime Error

Solution code:
import numpy as np
a = int(input())
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]
x=np.array(x)
y=np.array(y)
b = a - np.count_nonzero(x-y)
if b>=3:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

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

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

    if d1 == d2 :
        count += 1
    else:
        count = 0

    if count == 3:
        flag = 1


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

Submission status: Runtime Error

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

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

    if d1 == d2 :
        count += 1
    else:
        count = 0

    if count == 3:
        flag = 1;


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

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
for i in range(0,n):
    d,d1=list(map(int ,input().split()))
    if(d==d1):
        l.append("Yes")
        
    elif(d!=d1):
        l.append("No")
        
    # print(l)
    
a=l.count("Yes")

list_s=list(l)

index=list_s.index("Yes")

if(a==3 or a>3):
    if(list_s[index]=="Yes" and list_s[index+1]=="Yes" and list_s[index+2]=="Yes"):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Runtime Error

Solution code:
import sys
a = []
for l in sys.stdin:
    a.append(int(l))
n = a[0]
Is = []
for i in range(n):
    Ds = list(map(int, a[i+1].split()))
    if Ds[0] == Ds[1]:
        Is.append(i)

Boooo = False
for i in range(len(Is)-2):
    if Is[i] == Is[i+1] and Is[i+1] == Is[i+2]:
        Boooo = True

if Boooo:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from sys import exit

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(1,n):
  if x[i-1]==y[i-1] and x[i]==y[i] and x[i+1]==y[i+1]:
    print("Yes")
    exit()
print("No")

Submission status: Runtime Error

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