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())
cnt = 0
is_ok = False
for _ in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        cnt += 1
    else:
        cnt = 1
    if cnt >= 3:
        is_ok = True
    else:
        pass
if is_ok:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
for _ in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        cnt += 1
    else:
        cnt = 1
    if cnt >= 3:
        break
    else:
        pass
if cnt >= 3:
    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 count > 2:
    break
  else:
    if d1 == d2:
      count += 1
    else:
      count == 0
if count > 2:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [[int(i) for i in input().split()] for j in range(n)]
good = False
for i in range(n-3):
  ok = True
  for j in range(i, i+3):
    ok &= a[j][0] == a[j][1]
  good |= ok
print("Yes" if good else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [[int(i) for i in input().split()] for j in range(n)]
good = False
for i in range(n-3):
  ok = True
  for j in range(i, i+3):
    ok &= a[i][0] == a[i][1]
  good |= ok
print("Yes" if good else "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 > 2:
    break
  elif d1 == d2:
    count += 1
  else:
    count == 0
if count > 2:
  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 count == 3:
    break
  elif d1 == d2:
    count += 1
  else:
    count == 0
if count == 3:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
for _ in range(n):
  s=input().split()
  l.append([int(s[0]),int(s[1])])
flag=0
for i in range(3,n):
  if l[i][0]==l[i][1] and l[i-1][0]==l[i-1][1] and l[i-2][0]==l[i-2][1]:
    flag=1
    break
if flag:
  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
    if count == 3:
        print('Yes')
        break
    if i == N-1:
        print('No')

Submission status: Wrong Answer

Solution code:
import sys

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

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    a,b = map(int,input().split())
    if a==b:
        count += 1
    else:
        count = 0
print('Yes' if count > 2 else '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

print('Yes' if count > 2 else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())

cnt = 0
ans = False
for i in range(N):
	D1, D2 = map(int, input().split())
	if D1 == D2:
		cnt += 1
	else:
		cnt = 0
   
	if cnt > 2:
		ans = True
		break
      
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    for i in range(n-2):
        if num_list[i][0]==num_list[i][1] and num_list[i+1][0]==num_list[i+1][1] and num_list[i+2][0]==num_list[i+2][1]:
            count +=1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
cnt = int(input())

doublets = 0
while cnt > 0:
    if doublets == 3:
        print("YES")
        break
    x, y = tuple(map(int, input().split()))
    if x == y:
        doublets += 1
    else:
        doublets = 0
    cnt -= 1
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import random

exit = False

count = 0

countNum = 0

randomArray1 = random.randint(1,6)
randomArray2 = random.randint(1,6)

while count < 4:

    randomArray1 = random.randint(1,6)
    randomArray2 = random.randint(1,6)

    print(randomArray1,randomArray2)

    countNum += 1

    if randomArray1 == randomArray2:
        count += 1


print(countNum)
print("END")

Submission status: Wrong Answer

Solution code:
import random

exit = False

count = 0

randomArray1 = random.randint(1,6)
randomArray2 = random.randint(1,6)

while exit == False:

    randomArray1 = random.randint(1,6)
    randomArray2 = random.randint(1,6)

    print(randomArray1,randomArray2)

    count += 1

    if randomArray1 == randomArray2:
        print(count)
        exit = True

print("END")

Submission status: Wrong Answer

Solution code:
n = int(input())
num_lis = [list(map(int, input().split()))]
c = 0
for i,j in num_lis:
  if c == 3:
    break
  if i == j:
    c += 1
  else:
    c = 0

if c == 3:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
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()
D = [len(set(LIST()))==1 for _ in range(N)]
for i in range(N-3):
    if sum(D[i:i+3]) == 3:
        print("Yes")
        break
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())

count = 0
ans = 0
for i in range(n):
    s = input().split()
    
    if s[0]==s[1]:
        count += 1
        
        if count >= 3:
            ans = 1
if ans == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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 ans>=3:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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>0)):
        count += 1
    else:
        count = 0

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

else:
        print('No')

Submission status: Wrong Answer

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: Wrong Answer

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:
        counter = 0

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

Submission status: Wrong Answer

Solution code:
n = int(input())
num_list = []
for i in range(n):
    a,b = map(int,input().split())
    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: Wrong Answer

Solution code:
cnt = int(input())
chain = 0
first = 0
second = 0

for i in range(cnt):
    nList = list(map(int, input().split()))
    first = nList.pop()
    second = nList.pop()
    if first == second:
        chain = chain + 1
    else:
        chain = 0

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

Submission status: Wrong Answer

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

cnt = 0

for i in range(n):
	if lst[i][0]==lst[i][1]:
		cnt += 1
	else:
		cnt = 0
	if cnt == 3:
		print('Yes')
		exit()
print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
q=[]
for _ in range(n):
    d_1,d_2=map(int,input().split())
    if d_1==d_2:
        q.append(1)
    else:
        q.append(0)
for i in range(n-3):
    if q[i]==q[i+1]==q[i+2]==1:
        print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding:utf-8
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')
        exit()
    else:
        count = 0

print('No')

Submission status: Wrong Answer

Solution code:
# coding:utf-8
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')
        exit()

print('No')

Submission status: Wrong Answer

Solution code:
# coding:utf-8
n = int(input())
count = 0
ans = 0

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

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

ans = max(ans, count)

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

Submission status: Wrong Answer

Solution code:
n = int(input())

cnt = 0
ans = False
for i in range(n):
    d1, d2 = map(int, input().split())
    if cnt == 3:
        ans = True

    if d1 == d2:
        cnt += 1

    else:
        cnt = 0

print("Yes" if ans else "No")

Submission status: Wrong Answer

Solution code:
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][1]==D[x+1][0] and D[x+2][1]==D[x+2][0]:
    print("Yes")
    break
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

def main():
    N = int(input())
    zoro = 0
    for i in range(N):
        Ds = [int(s) for s in sys.stdin.readline().split()]
        if(Ds[0] == Ds[1]):
            zoro += 1
            if(zoro > 2):
                print("Yes")
                return(0)
    print("No")

main()

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    try:
        count = []
        result = 0
        T = int(input())
        for _ in range(T):
            x, y = map(int, input().split())
            count.append([x, y])

        for i in range(T-2):
            if count[i][0] == count[i][1] and count[i+1][0] == count[i+1][1] and count[i+2][0] == count[i+2][1]:
                print("Yes")
                exit(0)
            else:
                print("No")
    except Exception:
        pass

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    try:
        count = []
        result = 0
        T = int(input())
        for _ in range(T):
            x, y = map(int, input().split())
            count.append([x, y])

        for i in range(T-2):
            if count[i][0] == count[i][1] and count[i+1][0] == count[i+1][1] and count[i][1+2][0] == count[i+2][1]:
                print("Yes")
                exit(0)
            else:
                print("No")
    except Exception:
        pass

Submission status: Wrong Answer

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

def p(val):
    print(val)

def calc(s,d):
    for i in range(s-2):
        if d[i][0] == d[i][1] and d[i+1][0]==d[i+1][1] and d[i+2][0] == d[i+1][1]:
            
            return 'Yes'
    
    return 'No'

        
p(calc(s,d))

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    try:
        count = []
        result = 0
        T = int(input())
        for _ in range(T):
            x, y = map(int, input().split())
            if x == y:
                count.append(1)
            else:
                count.append(0)


        while count[-1] != 1:
            count.pop()

        for i in range(len(count)):
            if count[i] == 1:
                result += 1
            else:
                result = 0
        if result >= 3:
            print("Yes")
        else:
            print("No")
    except Exception:
        pass

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())
ans = "No"
count = 0
for i in range(n):
    D1,D2 = map(int,input().split())
    count+=1 if D1==D2 else 0
    ans="Yes"  if count>=3 else ans

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())

div = [0] * (N+1)
for d in range(1, N+1):
  for n in range(d, N, d):
      div[n] += 1

ans = sum(div[:N])
print(ans)

Submission status: Wrong Answer

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

    return False

x = int(input())

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
n = int(input())
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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
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:
            return True

    return False

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

Submission status: Wrong Answer

Solution code:
n = int(input())
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

    flag = False
    
    return flag

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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
    return flag

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

# if count < 3:
#     print("no")

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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
    if(j==3):
      ans = "Yes"
  else:
    j=0
print(ans)

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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(ans,t)
print("Yes" if ans==3 else "No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(n):
  d1, d2 = map(int, input().split())
  z = z+1 if d1==d2 else 0
  d.append(z)

print(max(d))

Submission status: Wrong Answer

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

for i in range(n):
    D.append(list(map(int, input().split())))

ans = 'No'

for i in range(0, 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]:
        ans = 'Yes'
        break

print(ans)

Submission status: Wrong Answer

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

for i in range(3,N):
    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
    if i == N-1:
        print('No')

Submission status: Wrong Answer

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

for i in range(n):
    D.append(list(map(int, input().split())))

ans = 0
count = 0

for i in range(1, n):
    if D[i][0] == D[i][1]:
        count += 1
    else:
        ans = max(count, ans)
        count = 0

if count == n-1:
    print('Yes' if count >= 3 else 'No')
else:
    print('Yes' if ans >= 3 else 'No')

Submission status: Wrong Answer

Solution code:
import random

x = int(input())

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)

if "111" in "".join(result):print('Yes')
else:print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
c = 0
for _ in range(n):
    r = [int(e) for e in input().split(" ")]
    if(c == 3):
        print("Yes")
        break
    elif(r[0] == r[1]):
        c += 1
    else:
        c = 0
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import random

x = int(input())

result1 = []  # 各回の出た目を入れるリスト
result2 = []  # 各回のゾロ目判定結果を入れるリスト
for n in range(x):
    z=[random.randint(1, 6),random.randint(1, 6)]
    if z[0]==z[1]:
        r=1
    else:
        r=0    
    result1.append(z)
    result2.append(r)
    
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: Wrong Answer

Solution code:
import random

x = input()
x = int(x)

result1 = []  # 結果を入れるリストを用意
result2 = []  # 結果を入れるリストを用意
for n in range(x):
    z=[random.randint(1, 6),random.randint(1, 6)]
    if z[0]==z[1]:
        r=1
    else:
        r=0    
    result1.append(z)
    result2.append(r)
    
count = len(result2)
zorome3=0
for n in range(count-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]:
        zorome3+=1
    else:
        zorome3+=0

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

Submission status: Wrong Answer

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

matched = [d1 == d2 for d1,d2 in zip(ds1,ds2)]
cnt = 0
for m in matched:
    cnt = cnt+1 if m else 0
    if m == 3:
        break

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
m=[]
for i in range(0,n):
  a,b=map(int,input().split())
  l.append(a)
  m.append(b)
c=0
i=0
while i<=n-3:
  if l[i]==m[i] and l[i+1]==m[i+1] and l[i+2]==m[i+2]:
      c=3
  i=i+2
if c==3:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
m=[]
for i in range(0,n):
  a,b=map(int,input().split())
  l.append(a)
  m.append(b)
c=0
for i in range(0,n):
  if l[i]==m[i]:
    c=c+1
  else:
    c=0
if c==3:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
c, d = [], []
for i in range(n):
    a, b = [int(i) for i in input().split()]
    c.append(a)
    d.append(b)

count = 1

for i in range(0, n):
    if c[i] == d[i]:
        count += 1
    else:
        count = 1
    if count == 3:
        break

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

else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
c, d = [], []
for i in range(n):
    a, b = [int(i) for i in input().split()]
    c.append(a)
    d.append(b)

count = 1

for i in range(1, n):
    if c[i-1] == c[i] and d[i-1] == d[i]:
        count += 1
    else:
        count = 1
    if count == 3:
        break

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

else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
p = [list(map(int,input().split())) for i in range(n)]
 
 
a = p[0]
b = 0
ans  = 0
tf = 1
 
for j in range(n):
  if sum(p[j]) // 2 ** 2 == sum(p[j]):
    ans += 1
  else:
    ans = 0
  if ans == 3:
    tf = 0
    print("Yes")
    break
    
if tf == 1:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
flag = 0
ans = "No"
for i in range(N):
  A,B = input().split()
  if A == B:    
    flag += 1
  if flag == 3:
    ans = "Yes"
    break
  else:
    flag = 0
    
  
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
flag = 0
ans = "No"
for i in range(N):
  A,B = input().split()
  if flag == 3:
    ans = "Yes"
  if A == B:    
    flag += 1
  else:
    flag = 0
    
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
flag = 0
ans = "No"
for i in range(N):
  A,B = input().split()
  if flag == 3:
    ans = "Yes"
    break
  if A == B:    
    flag += 1
  else:
    flag = 0
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input().strip())
count = 0
for i in range(n):
  a,b = map(int,input().strip().split())
  if a == b and count == 3:
    print('YES')
  elif a == b:
    count += 1
  else:
    count = 0
print('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())

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

li = []
for i in string:
    li.append(int(i[0]) - int(i[1]))

i = 0
c = 0
nli = len(li) - 1

while i != nli:
    if i == 0:
        c += 1
        if c == 3:
            print('Yes')
            exit()
    if i != 0:
        c = 0
    
print('No')