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())
d = [input().split(" ") for _ in range(n)]

f = False
for i in range(n-2):
    if d[i][0] == d[i][1] or not f :
        if d[i+1][0] == d[i+1][1] and d[i+2][0] == d[i+2][1]:
            f = True
if f:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
D=[]
for i in range(n):
  a,b=map(int, input().split())
  D.append([a,b])


for i in range(len(D)):
  if D[i][0]==D[i][1]:
    ans +=1
  else:
    if ans>0:
      ans -= 1

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

Submission status: Wrong Answer

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

last = 0
for item in l:
  if last == 0 and l[0] == l[1]:
    last = 1
  if last == 1 and l[0] == l[1]:
    last = 2
  if last == 2 and l[0] == l[1]:
    last = 3
    break
  last == 0

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

Submission status: Wrong Answer

Solution code:
n=int(input())
count = 0
last = 0
for a in range(n):
    z = list(input().split())
    if int(z[0]) == int(z[1]):
        count+=1
        if count >= 3:
            last = 1
    if int(z[0]) != int(z[1]):
        if count > 0:
            count = 0
        else:
            continue
if last == 1:
    print("yes")
if last == 0:
    print("no")

Submission status: Wrong Answer

Solution code:
n = int(input())
d1 = [0]*n
d2 = [0]*n
h = 'No'
for i in range(n):
    d1[i], d2[i] = map(int, input().split())
    if i > 2:
        if d1[i] == d2[i]:
            if d1[i-1] == d2[i-1]:
                if d1[i-2] == d2[i-2]:
                    h = 'Yes'
print(h)

Submission status: Wrong Answer

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

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

    if d1 == d2:
        num_of_double += 1

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

Submission status: Wrong Answer

Solution code:
def dice(N):
    for i in range(len(N)-2):
        if N[i][0]==N[i][1] and N[i+1][0]==N[i+1][1] and N[i+2][0]==N[i+2][1]:
            return "Yes"
    return "No"

Number=int(input("N="))
N=[]
for i in range(Number):
    x,y=input().split()
    N.append([int(x), int(y)])
print(dice(N))

Submission status: Wrong Answer

Solution code:
loop = int(input())
streak = 0
verify = False
for i in range(loop):
    diceArr = input().split()
    if streak==3:
        verify = True
    else:
        if diceArr[0] == diceArr[1]:
            streak+=1
        else:
            streak=0
if verify:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
D = []
for i in range(N):
    a = list(map(int,input().split()))
    D.append(a[0])
    D.append(a[1])
tf = 0
for i in range(2*N - 2):
    if D[i] == D[i+1] == D[i+2]:
        tf = 1
if tf == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
lst1=[]
lst2=[]
count=0
for _ in range(n):
    m,k=[int(x) for x in input().split()]
    lst1.append(m)
    lst2.append(k)
if(n<3):
    print('NO')
else:
    
    for i in range(n-2):
        if(lst1[i]==lst2[i] and lst1[i+1]==lst2[i+1] and lst1[i+2]==lst2[i+2]):
            count=3
            break
    if(count==3):
        print('YES')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        a.append(True)
    else:
        a.append(False)
for i in a[:-2]:
    if i == True:
        if a[a.index(i)+1] and a[a.index(i)+2]:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

affilé = 0
ok = 0


for i in range(n):
  d1, d2 = [int(k) for k in input().split()]
  if d1 == d2:
    affilé += 1
  elif d1 != d2:
    affilé = 0
  

  if affilé == 3:
    ok = 1

if ok == 0:
  print('NO')
else:
  print('YES')

Submission status: Wrong Answer

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

last = 0
for item in l:
  if last == 0 and l[0] == l[1]:
    last = 1
  if last == 1 and l[0] == l[1]:
    last == 2
  if last == 2 and l[0] == l[1]:
    last == 3
    break
  last == 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

d1=[]
d2=[]

cont=0
for i in range(N):
    D1,D2=map(int,input().split())

    d1.append(D1)
    d2.append(D2)

for i in range(len(d1)):
    if d1[i]==d2[i]:
        cont+=1

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

Submission status: Wrong Answer

Solution code:
N = int(input())
num = 0
for i in range(N):
  D = list(map(int, input().split(' ')))
  if D[0] == D[1]:
    num += 1
  else:
    num = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
i=0
cnt = 0
flg = 1

while i < N:
    i += 1
    a, b = map(int, input().split())
    if a==b:
        cnt += 1
    else:
        cnt = 0

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

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
D=[]
for i in range(n):
  a,b=map(int, input().split())
  D.append([a,b])


for i in range(len(D)):
  if D[i][0]==D[i][1]:
    ans +=1

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

Submission status: Wrong Answer

Solution code:
N = int(input())

c = 0
L=[]
flag=False
for _ in range(N):
    d1, d2 = map(int, input().split())
    L.append(d1/d2)

for i in range(N-3):
    if sum(L[i:i+3]) == 3:
        flag=True
    
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
k=0
for i in range(n):
  a,b=map(int,input().split())
  if(a==b):
    k+=1
if(k>=3):
  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)]
tf=0
for j in range(0,N-3):#Di1=Di2&Di+1_1=Di+1_2&Di1=Di2 3回連続ぞろ目
    if D[j][0]==D[j][1] and D[j+1][0]==D[j+1][1] and D[j+2][0]==D[j+2][1]:
        tf=1
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())

mulArr = []
for _ in range(N):
  arr = list(map(int, input().split(" ")))
  mulArr.append(arr)
# print(mulArr)
# print(mulArr[0][0])

result = 0
for i in range(0, len(mulArr) - 3):
  if mulArr[i][0] == mulArr[i][1] and mulArr[i + 1][0] == mulArr[i + 1][1] and mulArr[i+ 2][0] == mulArr[i + 2][1]:
    result += 1

if result != 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
d = []
for i in range(n):
    d.append(list(map(int,input().split())))
row = []
for i in range(n):
    if d[i][0]==d[i][1]:
        row.append(True)
    else:
        row.append(False)
res = False
for i in range(n-3):
    if all(row[i:i+3]):
        res = True

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

Submission status: Wrong Answer

Solution code:
def ProgramB():
    
    num = int(input())
    
    before = 'No'
    count = 0
    max_count = 0

    for i in range(num):
        data = list(map(int,input().split()))

        if num == 0:

            if data[0] == data[1]:
                before = 'Yes'
                count = count + 1
                
                if count > max_count:
                    max_count = count
    
            else:
                before = 'No'
                count = 0

        else:
            if data[0] == data[1] and before == 'Yes':
                before = 'Yes'
                count = count + 1
                
                if count > max_count:
                    max_count = count
    
            else:
                before = 'No'
                count = 0
            
            
    if max_count >= 3:        
        print('Yes')
        
    else:
        print('No')
        
        
if __name__ == '__main__':
    ProgramB()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
found = False
count = 0
for i in range(n):
  al, b = map(int, input().split())
  a.append((a, b))
  if found:
    print("Yes")
    break
  if a[i][0] == a[i][1]:
    count += 1
    if count >= 3: # that means that the i is in last 3 numbers
      print("Yes")
      break
  else:
    count = 0
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import sys

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

#print(deme)

toki = 0

for i in range(n):
  if deme[i][0] == deme[i][1]:
    toki += 1
    if toki >= 3:
      print("YES")
      sys.exit(0)
    
  else:toki = 0

print("NO")

Submission status: Wrong Answer

Solution code:
import sys
ls = []
N = int(input())
for l in sys.stdin:
    ls.append(l.split())

c = 0
p = 0
ans = 'No'
while len(ls) > (c+1):
    if ls[c][0] != ls[c][1]:
        c += 1
        p = 0
        continue
    else:
        c += 1
        p += 1
        if p == 3:
            ans = 'Yes'
            break

print(ans)

Submission status: Wrong Answer

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

for i in range(N):
    if D[i][0] == D[i][1]:
        A[i] = 1

for i in range(N - 3):
    if A[i] == 1 and A[i+1] == 1 and A[i+2] == 1:
        ans = "Yes"


print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

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

D_1 = list(itertools.chain.from_iterable(D))
flag = False
for i in range(len(D_1)-2):
    if D_1[i] == D_1[i+1] == D_1[i+2]:
        flag = True


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

Submission status: Wrong Answer

Solution code:
N = int(input())
sub_yes = 0
max_yes = 0
for i in range(N):
    d1,d2 = map(int,input().split())
    if d1 == d2:
        sub_yes += 1
    else:
        max_yes = sub_yes
        sub_yes = 0
if max_yes >= 3:
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
#179-B

N = int(input())
A = []

for i in range(N):
    D,H = map(int,input().split())

    if D == H:
        A.append(i)

#print(A)

if len(A) <= 2:
    print("No")

else:
    for j in range(len(A)-2):
        if A[j]+1 == A[j+1] and A[j+1]+1 == A[j+2]:
            print("Yes")
            break

Submission status: Wrong Answer

Solution code:
n=int(input())

a = 0
for i in range(n):
    li = input().split()
    if(li[0]==li[1]):
        print(li[0])
        a+=1
    elif(a<3):
        a=0
    else:
        print("Yes")
        exit()
if(a>2):
    print("Yes")
    exit()

print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

flag = False

d1 = [0]*N
d2 = [0]*N
for i in range(N-1):
  d1[i], d2[i] = input().split()
  
for k in range(N-3):
  if ((d1[k])==(d2[k]))and((d1[k+1])==(d2[k+1]))and((d1[k+2])==(d2[k+2])):
    flag = True
    break
    
if flag:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

d2 = []
ans = "No"

for i in range(n):
    for j in range(2):
        d2.append(d[i][j])

for i in range(0, len(d2)-2):
    if d2[i] == d2[i+1] and d2[i] == d2[i+2]:
        ans = "Yes"
        break

print(ans)

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())
d1=[0]*N
d2=[0]*N
for i in range(N):
    d1[i],d2[i]=list(map(int,input().split()))
counter=0
for i in range(N-3):
    if d1[i]==d2[i] and d1[i+1]==d2[i+1] and d1[i+1]==d2[i+1]:
        counter=1
if counter==1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
judge = 0
for i in range(N):
    S += [input().split()]
for i in range(N):
    if i <= N-i:
        if S[i][0] == S[i][1]:
            if S[i+1][0] == S[i+1][1]:
                if S[i+2][0] == S[i+2][1]:
                    print("Yes")
                    judge = 1
                    break
if judge == 0:
    print("No")

Submission status: Wrong Answer

Solution code:
loop = int(input())
streak = 0
for i in range(loop):
    diceArr = input().split()
    if streak==3:
        print('Yes')
        break
    else:
        if diceArr[0] == diceArr[1]:
            streak+=1
        else:
            streak=0
if streak != 3:
    print('No')

Submission status: Wrong Answer

Solution code:
doubletCount = 0
cases = int(input())
for roll in range(cases):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        doubletCount += 1
    else:
        doubleCount = 0
        
    if doubletCount >= 3:
        print("Yes")
        break
    
    if roll == cases - 1:
        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
    elif D1 != D2:
        break
if (count >= 3):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

count=0
for i in range(n) :
    if S[i][0]==S[i][1] :
        count+=1
    elif count==3 :
        print("Yes")
        exit()
    else :
        count=0

print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
lst1=[]
lst2=[]
count=0
for _ in range(n):
    m,k=[int(x) for x in input().split()]
    lst1.append(m)
    lst2.append(k)
if(n<3):
    print('NO')
else:
    
    for i in range(n-2):
        if(lst1[i]==lst2[i] and lst1[i+1]==lst2[i+1] and lst1[i+2]==lst2[i+2]):
            count=3
            break
    if(count>=3):
        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)]

tmp = 0
ans = [1]
for i in range(N):
    if i == N - 1:
        break
    else:
        if x[i] == y[i]:
            tmp += 1
        else:
            tmp = 0
        ans.append(tmp)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
z = 0
f = False
for i in range(N):
    r = list(map(int, input().split()))
    if r[0] == r[1]:
        z += 1
        if z == 2:
            f = True
    elif not f:
        f = False
        z = 0
if f:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

d2 = []
ans = "No"

for i in range(n):
    for j in range(2):
        d2.append(d[i][j])

print(d2)

for i in range(0, len(d2)-2):
    if d2[i] == d2[i+1] and d2[i] == d2[i+2]:
        ans = "Yes"
        break

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
judge = 0
for i in range(N):
    S += [input().split()]
for i in range(N):
    if i < N-i:
        if S[i][0] == S[i][1]:
            if S[i+1][0] == S[i+1][1]:
                if S[i+2][0] == S[i+2][1]:
                    print("Yes")
                    judge = 1
                    break
if judge == 0:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
D=[]
for i in range(n):
  a,b=map(int, input().split())
  D.append(a)
  D.append(b)


for i in range(len(D)-1):
  if D[i]==D[i+1]:
    ans +=1

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

Submission status: Wrong Answer

Solution code:
x=int(input())
List=[]
counter=0
for i in range(x):
  List.append(list(map(int,input().split())))
for i in range(len(List)):
  if List[i][0]==List[i][1]:
    counter+=1
  else:
    counter=0
  if counter ==3:
    print("Yes")
if counter<3:
  print("No")

Submission status: Wrong Answer

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

d = [list(map(int,input().split())) for i in range(c)]
for i in range(c):
    a,b = d[i][0],d[i][1]
    
    if (a==b):
        count += 1
    else : 
        count = 0

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
loop = int(input())
streak = 0
for i in range(loop):
    diceArr = input().split()
    if streak==3:
        print('Yes')
        SystemExit
    else:
        if diceArr[0] == diceArr[1]:
            streak+=1
        else:
            streak=0
if streak != 3:
    print('No')

Submission status: Wrong Answer

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

cnt = 0
renzoku = 0
for d in dlist:
    if d[0] == d[1]:
        cnt+=1
        renzoku += 1
    else:
        renzoku = 0
    if cnt == 3 and renzoku == 3:
        print('Yes')
        break
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())
d1 = []
d2 = []
for i in range(n):
  t,u = map(int,input().split())
  d1.append(t)
  d2.append(u)
c = 0
for i in range(n):
  if d1[i] == d2[i]:
    c += 1
  else:
    c == 0
  if c == 3:
    print("Yes")
    sys.exit()
print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0
flag = 0

for i in range(N):
  N,M = map(int, input().split())
  if N == M:
    count += 1
  else:
    count = 0
  if count >= 3:
    flag = 1
   
if flag == 1:
  print("yes")
else:
  print("no")

Submission status: Wrong Answer

Solution code:
N = int(input())

ris = []
for i in range(N):
    da,db = list(map(int,input().split())) 
    ris.append(da)
    ris.append(db)
p = 0
for i in range(N-2):
    if (ris[i] == ris[i+1]) and (ris[i+2] == ris[i+3]) and (ris[i+4] == ris[i+5]):
        p += 1
    else:
        None
if p > 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

    if a==b:
        count+=1
        if count==3:
            print("Yes")
            exit()
        else:
            pass
    if a!=b:
        count==0

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

Submission status: Wrong Answer

Solution code:
N = int(input())
result = '0'
for i in range(N):
  d1,d2 = map(int, input().split())
  if d1 == d2:
    result += '1'
  else:
    result += '0'
if '111' in result:
  print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
t=0
for _ in range(int(input())):
    d1,d2=input().split()
    d1=int(d1)
    d2=int(d2)
    if d1==d2:
        t+=1
if t>=3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def ProgramB():
    
    num = int(input())
    
    before = 'No'
    count = 0
    max_count = 0

    for i in range(num):
        data = list(map(int,input().split()))

        if num == 0:

            if data[0] == data[1]:
                before = 'Yes'
                count = count + 1
                
                if count > max_count:
                    max_count = count
    
            else:
                before = 'No'
                count = 0

        else:
            if data[0] == data[1] and before == 'Yes':
                before = 'Yes'
                count = count + 1
                
                if count > max_count:
                    max_count = count
    
            else:
                before = 'Yes'
                count = 0
            
            
    if max_count >= 3:        
        print('Yes')
        
    else:
        print('No')
        
        
if __name__ == '__main__':
    ProgramB()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

d  = []
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        ans = "same"
    else:
        ans = "no"
    d.append(ans)
flag = "No"
for i in range(N-2):
    if d[i] == d[i+1] and d[i+1] == d[i+2]:
        flag = "Yes"
print(flag)

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
lists=[]
for i in range(n):
    d1,d2=list(map(int,input().split()))
    lists.append([d1,d2])
for i in range(n-2):
    if lists[i][0]==lists[i][1] and lists[i+1][0]==lists[i+1][1] and lists[i+2][0]==lists[i+2][1]:
        print('Yes')
        break
    elif i==n-2:
        print('No')
    else:
        continue

Submission status: Wrong Answer

Solution code:
n = int(input())

affilé = 0

for i in range(n):
  d1, d2 = [int(k) for k in input().split()]
  if d1 == d2:
    affilé += 1
  elif d1 != d2:
    affilé == 0
  

  if affilé == 3:
    print('YES')
    exit()

print('NO')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 入力
N = int(input())

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

num = 0
cont = 0
for i in l:
    if(i[0]==i[1]):
        num = num + 1
        cont = cont +1
    else:
        num = 0
        cont = 0

if (cont >=3):
    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)]
count=0
for j in range(N-2):
    if D[j][0]==D[j][1]:
        if D[j+1][0]==D[j+1][1]:
            if D[j+2][0]==D[j+2][1]:
                count = 1
if count==0:
    print('NO')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
d = []
for i in range(n):
    d.append(list(map(int,input().split())))
row = []
for i in range(n):
    if d[i][0]==d[i][1]:
        row.append(True)
    else:
        row.append(False)
res = False
for i in range(n-3):
    if all(row[i:i+3]):
        res = True
if res:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

    if a==b:
        count+=1
        if count==3:
            print("Yes")
            exit()
        else:
            pass
    if a!=b:
        count==0

Submission status: Wrong Answer

Solution code:
from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


n = int(input())
row = False
cnt = 0
for _ in range(n):
    x,y = ip()
    if cnt == 3: row = True
    if x == y: cnt += 1
    else:
        cnt = 0

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

Submission status: Wrong Answer

Solution code:
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

n = ii()
b = []
c = [0]
for i in range(n):
    l = li()
    b.append(1 if l[0] == l[1] else 0)
    if i != 0:
        c.append(c[i-1]+1 if b[i] == 1 else 0)

print("Yes" if max(c) > 2 else "No")

Submission status: Wrong Answer

Solution code:
N=int(input()) #縦2列
XY=[map(int, input().split()) for _ in range(N)]
X,Y=[list(i) for i in zip(*XY)]
ans="no"

for j in range(0,N-2):
    if X[j]==Y[j] and X[j+1]==Y[j+1] and X[j+2]==Y[j+2]:
        ans="Yes"
        break

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

Ds = [list(map(int, input().split())) for i in range(N)]
count = 0

for D in Ds:
    if D[0] == D[1]:
        count += 1

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

Submission status: Wrong Answer

Solution code:
a2=int(input())
a=0
b3=0
for i in range(a2):
    b2,c2=map(str,input().split())
    b=int(b2)
    c=int(c2)
    if b==c:
        a+=1
    elif a==3:
        print('Yes')
        b3+=1
        break
    else:
        a=0
        
if b3>0:
    pass
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())

affilé = 0

for i in range(n):
  d1, d2 = [int(k) for k in input().split()]
  if d1 == d2:
    affilé += 1
  elif d1 != d2:
    affilé == 0
  

  if affilé == 3:
    print('YES')
    exit()

  print('NO')

Submission status: Wrong Answer

Solution code:
N = int(input())

row = 0
ans = 'No'

for n in range(N):
    D1, D2 = map(int, input().split())
    if D1==D2 and row<3:
        row+=1
    elif row==3:
        ans='Yes'
    else:
        row=0
print(ans)

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

ans = 0
for i in range(n - 1):
    if x[i] == y[i]:
        ans += 1
        if ans == 3:
            print("Yes")
            break
    
    else:
        ans = 0
        

if ans == 0 or ans == 1 or ans == 2:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

flag = 0

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

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

Submission status: Wrong Answer

Solution code:
def main():
	N = int(input())
	cnt = 0
	maxcnt = 0
	for n in range(N):
		D = list(map(int,input().split()))
		if D[0] == D[1]:
			cnt += 1
		else:
			maxcnt = cnt
			cnt = 0
	if maxcnt >= 3 or cnt >= 3:
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

pv = []
con = 0

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

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

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

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
D=[]
for i in range(n):
  a,b=map(int, input().split())
  D.append(a)
  D.append(b)


for i in range(len(D)-2):
  if D[i]==D[i+1] and D[i+1]==D[i+2]:
    ans +=1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a_lst = []
b_lst = []
clear = 0
cnt = 0
for i in range(n):
  a, b = map(int, input().split())
  a_lst.append(a)
  b_lst.append(b)

for a, b in zip(a_lst, b_lst):
  if cnt == 3:
    clear = 1
    break
  if a == b:
    cnt += 1
  else:
    cnt = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(n-2):
    if d[i][0] == d[i][1]:
        if d[i+1][0] == d[i][1] and d[i+2][0] == d[i+2][1]:
            print("Yes")
print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

i = 0
res = False

for _ in range(N):  
    a, b = map(int,input().split())

    if a == b:
        print("matched")
        i += 1
    else:
        i = 0
        
    if i >= 3:
        res = True

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

Submission status: Wrong Answer

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

prev_val = ''
count = 0
for i in D:
    if prev_val == i:
        count += 1
        if count == 2:
            break
    else:
        prev_val = i
        count = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())
flg = False
count = 0
for i in range(N):
  D1,D2 =  map(int, input().split())

  if D1 == D2:
    count += 1
    if count >= 3:
      flg = True
      break
    else:
      count = 0

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 13:06:46 2020

@author: Admin
"""

n=int(input())
l=[]
flag=0
for i in range(n):
    a,b=input().split()
    w=[int(a),int(b)]
    l.append(w)
for i in range(len(l)-2):
    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]:
        print('yes')
        flag=1
        break
if flag==0:
    print('no')