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

Submission status: Wrong Answer

Solution code:
N = int(input())
cnt = 0
flg = False
for _ in range(N):
    a, b = map(int, input().split())
    if a != b:
        cnt = 0
    else:
        cnt += 1
        flg = True

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

Submission status: Wrong Answer

Solution code:
N = int(input().strip())
 
 
 
a = []
c = []
f = 0
s="No"
for i in range(N):
    array = list(map(int, input().strip().split()))
    a.append(array)
 
    
for i in range(N):
	if(f == 0 or f == i-1):
		if(a[i][0] == a[i][1]):
			f+=1
		else:
			if(f >=3):
				s="Yes"
			f=0
if(f >=3):
	s="Yes" 
 
if(s=="Yes"):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def solution(arr):
  count = 0
  for i, val in enumerate(arr):
    if 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: Wrong Answer

Solution code:
a = []
for i in range(int(input())):
    a.append(input().split())
triplets = 0
for i in a:
    if(i[0] == i[1]):
        triplets += 1
    else:
        triplets = 0

print('Yes' if triplets >= 3 else 'No')

Submission status: Wrong Answer

Solution code:
print('NYoe s'[[*'111']in[str(len({*t.split()}))for t in open(0)][1:]::2])

Submission status: Wrong Answer

Solution code:
print('NYoe s'['111'in''.join(str(len({*t.split()}))for t in open(0))::2])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

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')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N = int(input().strip())



a = []
c = []
f = 0

for i in range(N):
    array = list(map(int, input().strip().split()))
    a.append(array)

    
for i in range(N):
	if(f == 0 or f == i-1):
		if(a[i][0] == a[i][1]):
			f=i
			c.append(1)
		else:
			f=0


if(len(c) >= 3):
  print("Yes")
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 d1 == d2:
    cnt += 1
if cnt >= 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)]

for i in range(n - 3):
  if all([d[i + j][0] == d[i + j][1] for j in range(3)]):
    print('Yes')
    exit()

print('No')

Submission status: Wrong Answer

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

for i in range(n - 2):
  if all([d[i + j][0] == d[i + j][1] for j in range(2)]):
    print('Yes')
    exit()

print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0

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

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
for i in range(n - 2):
    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: Wrong Answer

Solution code:
import numpy as np
n = int(input())
d = np.array([list(map(int,input().split())) for i in range(n)])
D = np.abs(d[:,0]-d[:,1])
f = False
for i in range(n-3):
    if D[i:i+3].sum() == 0:
        f = True
        break
print('Yes' if f else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0

for i in range(N):
    k, t = map(int, input().split())
    if count == 3:
      print ( "Yes" )
     
      break
      
    if not k == t:
        count *= 0
    if k == t:
       count += 1 
if count <= 3:
        print ("Yes")
else:
  print ("No")

Submission status: Wrong Answer

Solution code:
count = 0
for i in range(int(input())):
    l = list(map(int, input().split()))
    if l[0] == l[1]:
        count += 1
    elif l[0] != l[1]:
        count = 0
if count >= 3:
    print("Yes")
elif count < 3:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0

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

Submission status: Wrong Answer

Solution code:
count = 0
for i in range(int(input())):
    l = list(map(int, input().split()))
    if l[0] == l[1]:
        count += 1
    elif l[0] != l[1]:
        count = 0
if count >= 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)]
 
for i in range(N-2):
  if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
    print('Yes')
    break
    
print('No')

Submission status: Wrong Answer

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 not list[x-1] == list[-1]:
        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
    x = x + 2
if y == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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]:
        n = n - 1
        if not list[x+1] == list[-1]:
            if list[x+2] == list[x+3]:
                n = n - 1
                if not list[x+3] == list[-1]:
                    if list[x+4] == list[x+5]:
                         n = n - 1
                         y = 1
    x = x + 2
if y == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import math
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
mod = 10**9 + 7

#maincode-------------------------------------------------

n = int(input())
x = [0 for i in range(n)]
y = [0 for i in range(n)]
ans = 'No'

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

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

print(ans)

Submission status: Wrong Answer

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 not list[x] == '':
        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
    x = x + 2
if y == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
c=[]
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    c.append(1)
  else:
    c.append(0)
for j in range(2,n):
  if c[j-2]==c[j-1] and c[j-1]==c[j]:
      print("Yes")
      exit()
print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0

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

Submission status: Wrong Answer

Solution code:
b = []
a = int(input())
for i in range(a):
	b.append(list(map(int,input().split())))
c = []
for i in range(a):
    if b[i][0] == b[i][1]:
        c.append(1)
    elif b[i][0] != b[i][1]:
        c.append(0)
for i in range(2, a-2):
    if c[i] == 1 & c[i-1] == 1 & c[i+1] == 1:
        print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
ans = 0
X = map(int,[input() for i in range(N)])

for i in range(N):
    if ans <= 3:
        print("Yes")
        break
    if i == ("1 1" or "2 2" or "3 3" or "4 4" or "5 5" or"6 6"):
            ans = ans + 1
    else:
        if ans == 1:
            ans = ans - 1
        if ans == 2:
            ans = ans - 2

else:
    print("No")

Submission status: Wrong Answer

Solution code:
import random

x = input()
x = int(x)

result = []  # 結果を入れるリストを用意

for n in range(x):
    z=[random.randint(1, 6),random.randint(1, 6)]
    if z[0]==z[1]:
        r=1
    else:
        r=0    
    result.append(r)

y=sum(result)
maped_list = map(str, result)
txt = ''.join(maped_list)

ans3=txt.count('111')

if ans3>1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import random

x = input()
x = int(x)

result = []  # 結果を入れるリストを用意

for n in range(x):
     z=[random.randint(1, 6),random.randint(1, 6)]
     if z[0]==z[1]:
        r=1
     else:
        r=0    
     result.append(r)

y=sum(result)
maped_list = map(str, result)
txt = ''.join(maped_list)

ans3=txt.count('111')

if ans3>1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def run(n, _in_list):
    '''
    '''
    is_doublet_count = 0
    for x in _in_list:
        _in = list(x)
        if _in[0] ==_in[1]:
            is_doublet_count += 1
        else:
            is_doublet_count = 0
    
    print('Yes' if is_doublet_count >= 3 else 'No')
    




if __name__ == '__main__':
    n = int(input())
    _in_list = [map(int, input().split()) for _ in range(n)]
    run(n, _in_list)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    zoro = []

    for i in range(N):
        a, b = map(int, input().split())
        if a == b:
            zoro.append(1)
            if i >= 3:
                if zoro[i-2] == zoro[i-1] and zoro[i-1] == zoro[i]:
                    print('Yes')
                    return
        else:
            zoro.append(0)

    print('No')


main()

Submission status: Wrong Answer

Solution code:
import random

x = input()
x = int(x)

result = []  # 結果を入れるリストを用意

for n in range(x):
     z=[random.randint(1, 6),random.randint(1, 6)]
     if z[0]==z[1]:
        r=1
     else:
        r=0    
     result.append(r)

y=sum(result)
print(result)
maped_list = map(str, result)
txt = ''.join(maped_list)

ans3=txt.count('111')
print(txt)

if ans3>1:
    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
ans = False
for i in d:
    if d[0] == d[1]:
        c += 1
        if c >=3:
            ans = True
            break
    else:
        c = 0
if ans:
    print('Yes')
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
c=[]
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    c.append(1)
  else:
    c.append(0)
cnt=0
for j in range(2,n):
  if c[j-2]==c[j-1] and c[j-1]==c[j]:
      print("Yes")
      break
  if j==n-1:
      print("No")

Submission status: Wrong Answer

Solution code:
from collections import deque

target_1 = [[1,1],[2,2],[3,3],[4,4],[5,5],[6,6]]
def func(a=deque() , targetlist=target_1):
    x1 = a.count(targetlist[0])
    x2 = a.count(targetlist[1])
    x3 = a.count(targetlist[2])
    x4 = a.count(targetlist[3])
    x5 = a.count(targetlist[4])
    x6 = a.count(targetlist[5])
    if((x1+x2+x3+x4+x5+x6)==3):
        return True
    else:
        return False

N = int(input())
D_array = [list(map(int, input().split())) for i in range(N)]
Q = deque([[0] * 2 for i in range(3)])

j = 0
ans = 0
while j < N:
    Q.pop()
    Q.appendleft(D_array[j])
    if(func(Q,target_1)):
        print("Yes")
        ans = 1
        break
    else:
        j = j+1

if(ans==0):print("no")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
#print(l[0][0])
#print(l[0][1])
ans = n-2
ans1 = 0

for m in range(ans):
  if l[m][0]  == l[m][1] and l[m+1][0] == l[m+1][1] and l[m+2][0] == l[m+2][1]:
    ans1 += 1
  else:
    ans1 = 0
    
    
if ans1 >= 1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n=int(input())
c=[]
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    c.append(1)
  else:
    c.append(0)
cnt=0
for j in range(2,n):
  if c[j-2]==c[j-1] and c[j-1]==c[j]:
      print("Yes")
      break
  if j==n:
      print("No")

Submission status: Wrong Answer

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

Is = []
for i in range(N):
    Ds = a[i]
    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: Wrong Answer

Solution code:
N = int(input())

count = 0

for i in range(N):
    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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ary = [map(int, input().split()) for _ in range(n)]
pair1, pair2 = [list(i) for i in zip(*ary)]
ans = []
count = 0
for j in range(n):
    if(pair1[j] == pair2[j]):
        ans.append(1)
    else: ans.append(0)
#     [0,1,1,1,0]
for idx in ans:
    if(ans[idx] == 1):
        count += 1
        if(count == 3):
            print('Yes')
            break
        else: continue
    else:
        count = 0
        continue

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ary = [map(int, input().split()) for _ in range(n)]
pair1, pair2 = [list(i) for i in zip(*ary)]
ans = []
count = 0
for j in range(n):
    if(pair1[j] == pair2[j]):
        ans.append(1)
    else: ans.append(0)
print(ans)
#     [0,1,1,1,0]
for idx in ans:
    if(ans[idx] == 1):
        count += 1
        if(count == 3):
            print('Yes')
            break
        else: continue
    else:
        count = 0
        continue

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
#print(l[0][0])
#print(l[0][1])
ans = n-3
ans1 = 0

for m in range(ans):
  if l[m][0]  == l[m][1] and l[m+1][0] == l[m+1][1] and l[m+2][0] == l[m+2][1]:
    ans1 += 1
  else:
    ans1 = 0
    
    
if ans1 >= 1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input().strip())

a = []
c =0
f = 0
for i in range(N):
    array = list(map(int, input().strip().split()))
    a.append(array)
#print(a[4][1])
for i in range(N):
	if(f == 0 or f == i-1):
		if(a[i][0] == a[i][1]):
			f=i
			c+=1
		else:
			f=0
			c=0
if(c >= 3):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
num = int(input())
count = 0
tmp = 0
for i in range(num):
    d1, d2 = map(int,input().split())
    if d1 == d2 and tmp == 0:
        count = 1
        tmp += 1
    elif d1 == d2 and tmp > 0:
        count += 1
        tmp += 1
    else:
        tmp = 0

print("Yes" if count >= 3 else "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))
tree = 'No'
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]:
                tree = 'Yes'
                break
            else:
                tree = 'No'
            break
        else:
            tree = 'No'
        break
print(tree)

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')
print(lll)

Submission status: Wrong Answer

Solution code:
N = int(input().strip())

a = []
c =0
f = 0
for i in range(N):
    array = list(map(int, input().strip().split()))
    a.append(array)
#print(a[4][1])
for i in range(N):
	if(f == 0 or f == i-1):
		if(a[i][0] == a[i][1]):
			f=i
			c+=1
if(c >= 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()
    if a[i,0] == a[i,1]:
        a[i] = [0]

for i in range(n-1):
    if a[i,0] == a[i+1,0]:
        cnt += 1
    elif cnt >= 2:
        cnt = cnt
    else:
        cnt = 0


if cnt >= 2:
    print("Yes")
else:
    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))
tree = 'No'
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]:
                tree = 'Yes'
            else:
                tree = 'No'
            break
        else:
            tree = 'No'
        break
print(tree)

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
for i in range(n):
  me1,me2=list(map(int,input().split()))
  if me1==me2:
    count+=1
if count==n:
  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()
    if a[i,0] == a[i,1]:
        a[i] = [0]

for i in range(n-1):
    if a[i,0] == a[i+1,0]:
        cnt += 1
        print(cnt , i)
    elif cnt >= 2:
        cnt = cnt
    else:
        cnt = 0


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

Submission status: Wrong Answer

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

count = 0

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

Submission status: Wrong Answer

Solution code:
import random

x = input()
x = int(x)

result = []  # 結果を入れるリストを用意

for n in range(x):
     z=[random.randint(1, 6),random.randint(1, 6)]
     if z[0]==z[1]:
        r=1
     else:
        r=0    
     result.append(r)

y=sum(result)

if y>2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

exist = False
for i in range(n-3):
    for j in range(3):
        if not d[i+j][0] == d[i+j][1]:
            break
    else:
        exist = True
if exist:
    print('Yes')
else:
    print('No')

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

X=[]
Y=[]
for _ in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
    
A="NO"
for n in range(N-2):
    if X[n]==Y[n]:
        if X[n+1]==Y[n+1]:
            if X[n+2]==Y[n+2]:
                A="YES"
                break
            else:
                continue
        else:
            continue
    else:
        continue
print(A)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

X=[]
Y=[]
for _ in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
A="NO"
for n in range(N-2):
    if X[n]==Y[n] and X[n+1]==Y[n+1] and X[n+2]==Y[n+2]:
        A="YES"
        break
print(A)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 'No'

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

for i in range(0,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())

count = 0

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

Submission status: Wrong Answer

Solution code:
"""
abc179_B
"""
n = int(input())
ans = 'No'

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

for i in range(0,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]:
    #if a[i,0] == a[i,1] and a[i+1,0] == a[i+1,1] and a[i+2,0] == a[i+2,0]:
        ans = 'Yes'
        break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
a = []
for l in sys.stdin:
    a.append(l)

n = int(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: Wrong Answer

Solution code:
n = int(input())
data = []
zoro = []
yn = False
for i in range(n):
    data = input().split()
    if data[0] == data[1]:
        zoro += [True]
    else:
        zoro += [False]
    if i > 1 and (zoro[i] == True or zoro[i-1] == True or zoro[i-2] == True):
        yn = True
print("Yes") if yn == True else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
D = [list(map(int, input().split())) for i in range(N)]
if 3 < N:
    for i in range(N-3):
        if D[i][0] == D[i][1]:
            if D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
                print('Yes')
                exit()
else:
    print('No')
    exit()
print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
div = np.zeros(N+1, np.int64)
for n in range(1, N+1):
    for m in range(n, N+1, n):
        div[m] += 1
print(sum(div))

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

for j in range(N-2):
    if num_list[j][0] == num_list[j][1] and num_list[j+1][0] == num_list[j+1][1] and num_list[j+2][0] == num_list[j+2][1]:
        print ("Yes")
        break
    elif j != N-3 and num_list[j][0] != num_list[j][1] or num_list[j+1][0] != num_list[j+1][1] or num_list[j+2][0] != num_list[j+2][1]:
        continue
    else:
        print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
D = [list(map(int, input().split())) for i in range(N)]
for i in range(N-3):
    if D[i][0] == D[i][1]:
        if 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())
data = []
zoro = []
yn = False
for i in range(n):
    data = input().split()
    if data[0] == data[1]:
        zoro += [True]
    else:
        zoro += [False]
    if i > 1 and (zoro[i] == True or zoro[i-1] == True or zoro[i-2] == True):
        yn = True
print(zoro)
print("Yes") if yn == True else print("No")