Problem: 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.

Submission attempts (in order):
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")

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


n = int(input())

for _ in range(n):
    d1, d2 = map(int, input().split(" "))
    if d1 == d2:
        count += 1
if count >= 3:
    print("yes")
else:
    print("no")

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


n = int(input())
for _ in range(n):
    d1, d2 = map(int, input().split(" "))
    if d1 == d2:
        count += 1
    else:
        count = 0
    
    
    if count >= 3:
        print("yes")
        break
if count < 3:
    print("no")

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

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


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

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

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

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


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


def judge():
    count = 0
    for _ in range(x):
        d1, d2 = map(int, input().split())
        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")


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted