Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
t1counter=0
for i in range(q):
    tfc=input().split()
    if(tfc[0]=='1'):
        t1counter+=1
    else:
        if(t1counter%2==0 and tfc[1]=='1'):
            s=tfc[2]+s
        elif(t1counter%2==1 and tfc[1]=='2'):
            s=tfc[2]+s
        elif(t1counter%2==0 and tfc[1]=='2'):
            s=s+tfc[2]
        elif(t1counter%2==1 and tfc[1]=='1'):
            s=s+tfc[2]
        else:
            print('error')
if(t1counter%2==0):
    print(s)
elif(t1counter%2==1):
    print(s[::-1])

Fixed submission:
s=input()
q=int(input())
t1counter=0
s1=''
for i in range(q):
    tfc=input().split()
    if(tfc[0]=='1'):
        t1counter+=1
    else:
        if(t1counter%2==0 and tfc[1]=='1'):
            s1=s1+tfc[2]
        elif(t1counter%2==1 and tfc[1]=='2'):
            s1=s1+tfc[2]
        elif(t1counter%2==0 and tfc[1]=='2'):
            s=s+tfc[2]
        elif(t1counter%2==1 and tfc[1]=='1'):
            s=s+tfc[2]
        else:
            print('error')
s=s1[::-1]+s
if(t1counter%2==0):
    print(s)
elif(t1counter%2==1):
    print(s[::-1])
Buggy python submission (verdict: Runtime Error):

Python 3 
File
Edit
View
Insert
Cell
Kernel
Widgets
Help

import math
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
arrayp=[1]
for iii in range(n-1):
    arrayp+=[1]
arrayq=[1]
for jjj in range(n-1):
    arrayq+=[1]
pnum=0
qnum=0
for i in range(n-1):
    prank=0
    for ii in range(p[i]):
        if arrayp[ii]==1:
            prank+=1
    pnum=pnum+(prank-1)*math.factorial(n-i-1)
    arrayp[p[i]-1]=0
for j in range(n-1):
    qrank=0
    for jj in range(q[j]):
        if arrayq[jj]==1:
            qrank+=1
    qnum=qnum+(qrank-1)*math.factorial(n-j-1)
    arrayq[q[j]-1]=0
print(abs(pnum-qnum))
8

Fixed submission:
import math
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
arrayp=[1]
for iii in range(n-1):
    arrayp+=[1]
arrayq=[1]
for jjj in range(n-1):
    arrayq+=[1]
pnum=0
qnum=0
for i in range(n-1):
    prank=0
    for ii in range(p[i]):
        if arrayp[ii]==1:
            prank+=1
    pnum=pnum+(prank-1)*math.factorial(n-i-1)
    arrayp[p[i]-1]=0
for j in range(n-1):
    qrank=0
    for jj in range(q[j]):
        if arrayq[jj]==1:
            qrank+=1
    qnum=qnum+(qrank-1)*math.factorial(n-j-1)
    arrayq[q[j]-1]=0
print(abs(pnum-qnum))
Buggy python submission (verdict: Runtime Error):
nkq=list(map(int,input().split()))
a = [int(input()) for _ in range(nkq[2])]
point=[0]*nkq[0]
for i in range(nkq[0]):
    point[a[0]-1]+=1
    del a[0]
for j in range(nkq[0]):
    if point[j]>0:
        print('Yes')
    else:
        print('No')

Fixed submission:
nkq=list(map(int,input().split()))
a = [int(input()) for _ in range(nkq[2])]
point=[nkq[1]-nkq[2]]*nkq[0]
for i in range(nkq[2]):
    point[a[0]-1]+=1
    del a[0]
for j in range(nkq[0]):
    if point[j]>0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
nkq=list(map(int,input().split()))
a = [int(input()) for _ in range(nkq[2])]
point=[0]*nkq[0]
for i in range(nkq[0]):
    point[i]=nkq[1]-nkq[2]+a.count(i+1)
for j in range(nkq[0]):
    if point[j]>0:
        print('Yes')
    else:
        print('No')

Fixed submission:
nkq=list(map(int,input().split()))
a = [int(input()) for _ in range(nkq[2])]
point=[nkq[1]-nkq[2]]*nkq[0]
for i in range(nkq[2]):
    point[a[0]-1]+=1
    del a[0]
for j in range(nkq[0]):
    if point[j]>0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
k=b[n-2]
for i in range(1,n-2):
    if b[n-i-2]<b[n-i-1]:
        k+=b[n-i-2]
    else:
        k+=b[n-i-1]
if b[0]<b[1]:
    k+=b[0]
else:
    k+=b[1]
print(k)
        

Fixed submission:
n=int(input())
b=list(map(int,input().split()))
k=b[n-2]
if n>2:
    for i in range(0,n-2):
        if b[n-i-3]<b[n-i-2]:
            k+=b[n-i-3]
        else:
            k+=b[n-i-2]
k+=b[0]
print(k)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
h=list(map(int,input().split()))
a=1
mx=0
p=0
while a!=n:
    if h[a-1]>=h[a]:
        p+=1
        a+=1
    else:
        if p>mx:
            mx=p
            a+=1
            p=0
print(-min(-mx,-p))

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
a=0
mx=0
p=0
while a!=n-1:
    if h[a]>=h[a+1]:
        p+=1
        a+=1
    else:
        if p>mx:
            mx=p  
            a+=1
            p=0
        else:
            a+=1
            p=0
print(-min(-mx,-p))
Buggy python submission (verdict: Runtime Error):
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
#print(ab)
k=0
answer=1
for t in range(n):
    k+=ab[t][0]
    print([k,answer])
    if k>ab[t][1]:
        #answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

Fixed submission:
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
#print(ab)
k=0
answer=1
for t in range(n):
    k+=ab[t][0]
    #print([k,answer])
    if k>ab[t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
print(ab)
k=1
for t in range(n):
    k+=ab[t][0]
    print([k,answer])
    if k>ab[t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

Fixed submission:
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
#print(ab)
k=0
answer=1
for t in range(n):
    k+=ab[t][0]
    #print([k,answer])
    if k>ab[t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
#print(ab)
#print(b)
k=0
for t in range(n):
    k+=ab[n-1-t][0]
    #print([k,answer])
    if k>ab[n-1-t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

Fixed submission:
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
#print(ab)
k=0
answer=1
for t in range(n):
    k+=ab[t][0]
    #print([k,answer])
    if k>ab[t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ab=[list(map(int,input().split()))]
b=[ab[0]]
answer=1
for i in range(n-1):
    k=list(map(int,input().split()))#kを今からbの値でソートします
    d=0#何番目に入れるのが最適化を探すための代数です。
    while  d<=i and k[1]<=ab[d][1]:
        d+=1
    ab.insert(d,k) 
    b.insert(d,k)
#print(ab)
#print(b)
k=0
for t in range(n):
    k+=ab[n-1-t][0]
    #print([k,answer])
    if k>ab[n-1-t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

Fixed submission:
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
#print(ab)
k=0
answer=1
for t in range(n):
    k+=ab[t][0]
    #print([k,answer])
    if k>ab[t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
nm=list(map(int,input().split()))
lista=[]#壊れている階段の座標
for i in range(nm[1]):
    lista=lista+[int(input())]
i=0#現在地
b1=1#現在地までの行き方
b2=0#現在地のひとつ前までの行き方
while i <nm[0]:
    if i+1 not in lista:
        i+=1
        b1+=b2
        b2=b1-b2
    elif i+1 in lista and i+2 not in lista:
        i+=2
        b2=0
    else:
        i=nm[0]
        b1=0
print(b1%1000000007)

Fixed submission:
nm=list(map(int,input().split()))
stair=[1]*(nm[0]+1)
for i in range(nm[1]):
    stair[int(input())]=0

i=0#現在地
b1=1#現在地までの行き方
b2=0#現在地のひとつ前までの行き方
while i <nm[0]:
    if stair[i+1]==1:
        i+=1
        b1+=b2
        b2=b1-b2
    elif stair[i+1]==0 and stair[i+2]==1:
        i+=2
        b2=0
    else:
        i=nm[0]
        b1=0
print(b1%(10**9+7))
Buggy python submission (verdict: Runtime Error):
N=list(map(int,input().split()))
S=list(input())
k=N[1]
S[k]=S[k].lower()
j = ','.join(S)
print(j)

Fixed submission:
N=list(map(int,input().split()))
S=list(input())
k=N[1]
S[k-1]=S[k-1].lower()
j = ' '
 
for x in S:
    j += x
print(j)

Buggy python submission (verdict: Runtime Error):
N=list(map(int,input().split()))
S=list(input())
k=N[1]
S[k]=S[k].lower()
print(S)

Fixed submission:
N=list(map(int,input().split()))
S=list(input())
k=N[1]
S[k-1]=S[k-1].lower()
j = ' '
 
for x in S:
    j += x
print(j)
Buggy python submission (verdict: Runtime Error):
n=int(input())
flag=0
ans=0

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

Fixed submission:
s=input()
if s[len(s)-1]=="s":
    print(s+"es")
else:
    print(s+"s")
Buggy python submission (verdict: Runtime Error):
n=int(input())
flag=0
for i in range(n):
    d1,d2=map(int,input().split())
    if d1==d2:
        flag+=1
        if flag==3:
            ans=1
    else:
        flag=0
if ans!=1:
    print("No")
else:
    print("Yes")
    

Fixed submission:
n=int(input())
flag=0
ans=0

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

Buggy python submission (verdict: Runtime Error):
n=int(input())
flag=0
for i in range(n):
    d1,d2=map(int,input().split())
    if d1==d2:
        flag+=1
        if flag==3:
            ans=1
    else:
        flag=0
if ans!=1:
    print("No")
else:
    print("Yes")
    

Fixed submission:
n=int(input())
flag=0
ans=0

for i in range(n):
    d1,d2=map(int,input().split())
    if d1==d2:
        flag+=1
        if flag==3:
            ans=1
    else:
        flag=0
if ans!=1:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(input() for i in range(n))
t=[]

for i in range(n):
    if s[i] not in t:
        t.append(s[i])
print(len(t))

Fixed submission:
n=int(input())
s=list(input() for i in range(n))
t=set(s)

print(len(t))
Buggy python submission (verdict: Time Limit Exceeded):
import math
K=int(input())
sum=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):           
            
            sum+=math.gcd(math.gcd(a,b),c)
print(sum)


Fixed submission:
from math import gcd
K=int(input())
sum=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):           
            
            sum+=gcd(gcd(a,b),c)
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd
K=int(input())
sum=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):           
            ans = gcd(a, b)
            ans=gcd(ans,c)
            sum+=ans
print(sum)

Fixed submission:
from math import gcd
K=int(input())
sum=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):           
            
            sum+=gcd(gcd(a,b),c)
print(sum)

Buggy python submission (verdict: Runtime Error):
K=int(input())
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):            
            m=min(a,b,c)
            for i in range(1,m+1):
                if a%i==0 and b%i==0 and c%i==0:
                    gcd=i
            sum+=gcd

print(sum)

Fixed submission:
from math import gcd
K=int(input())
sum=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):           
            
            sum+=gcd(gcd(a,b),c)
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K=int(input())
sum=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):           
            ans = math.gcd(a, b)
            ans=math.gcd(ans,c)
            sum+=ans
print(sum)

Fixed submission:
from math import gcd
K=int(input())
sum=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):           
            
            sum+=gcd(gcd(a,b),c)
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(input())
R=[]
G=[]
B=[]
count=0
for i in range(n):
    if s[i]=="R":
        R.append(i)
    elif s[i]=="G":
        G.append(i)
    else:
        B.append(i)
for r in R:
    for g in G:
        for b in B:
            middle=r+g+b-min(r,g,b)-max(r,g,b)
            mi=min(r,g,b)
            ma=max(r,g,b)
            if (middle-mi)!=(ma-middle):
                count+=1

print(count)

Fixed submission:
n=int(input())
s=input()
r=0
g=0
b=0
for i in s:
    if i=="R":r+=1
    elif i=="G":g+=1
    elif i=="B":b+=1
ans=r*b*g

for j in range(n):
    for i in range(j):
        k=j+(j-i)
        if k<n:
            
            if s[i]==s[j]: continue
            if s[j]==s[k]: continue
            if s[k]==s[i]: continue
            ans-=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(input())
R=[]
G=[]
B=[]
count=0
for i in range(n):
    if s[i]=="R":
        R.append(i)
    elif s[i]=="G":
        G.append(i)
    else:
        B.append(i)
for r in R:
    for g in G:
        for b in B:
            middle=r+g+b-min(r,g,b)-max(r,g,b)
            if (middle-min(r,g,b))!=(max(r,g,b)-middle):
                count+=1

print(count)

Fixed submission:
n=int(input())
s=input()
r=0
g=0
b=0
for i in s:
    if i=="R":r+=1
    elif i=="G":g+=1
    elif i=="B":b+=1
ans=r*b*g

for j in range(n):
    for i in range(j):
        k=j+(j-i)
        if k<n:
            
            if s[i]==s[j]: continue
            if s[j]==s[k]: continue
            if s[k]==s[i]: continue
            ans-=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
m=abs(n-k)
while m<n:
    n=m
    m=abs(n-k)
print(n)

Fixed submission:
n,k=map(int,input().split())
m=n%k
if m>abs(m-k):
    m=abs(m-k)
print(m)
Buggy python submission (verdict: Runtime Error):
s=list(input())
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")

Fixed submission:
X=int(input())
happy=(X//500)*1000
left=X%500
happy+=(left//5)*5
print(happy)
Buggy python submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=list(map(int,input().split()))
l=0
for i in range(N-2):
    if (A[i+2]-A[i+1])>=(A[i+1]-A[i]):
        l=A[i+2]-A[i+1]
if (20-A[N-1]+A[0])>=l:
print(K-l)

Fixed submission:
K,N=map(int,input().split())
A=list(map(int,input().split()))
d=[]
for i in range(N-1):
    d.append(A[i+1]-A[i])
d.append(K-A[N-1]+A[0])
print(K-max(d))
Buggy python submission (verdict: Time Limit Exceeded):
N,X,Y=map(int,input().split())
count=[0]*(N-1)
for i in range(1,N+1):
    for j in range(i+1,N+1):
        d=[]
        d.append(abs(j-i))
        d.append(abs(X-i)+1+abs(j-Y))
        d.append(abs(Y-i)+1+abs(j-X))
        count[min(d)-1]+=1
for k in count:
    print(k)

Fixed submission:
N,X,Y=map(int,input().split())
count=[0]*(N-1)
for i in range(1,N):
    for j in range(i+1,N+1):
        num=min(abs(j-i),abs(X-i)+1+abs(j-Y),abs(Y-i)+1+abs(j-X))
        #d=[]
        
        #d.append(abs(j-i))
        #d.append(abs(X-i)+1+abs(j-Y))
        #d.append(abs(Y-i)+1+abs(j-X))
        count[num-1]+=1
for k in count:
    print(k)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
for k in range(N):
    count=0
    n=A.pop(k)
    for i in range(N-2):
        for j in range(i+1,N-1):
            if A[i]==A[j]:
                count+=1
    print(count)
    A.insert(k,n)

        

Fixed submission:
from itertools import combinations
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N+1)
ans=0
for i in range(N):
    B[A[i]]+=1
for i in range(1,N+1):
    ans+=B[i]*(B[i]-1)//2
for k in range(0,N):
    print(ans-B[A[k]]+1)
Buggy python submission (verdict: Runtime Error):
N,P=map(int,input().split())
S=str(input())
S=S[::-1]
Si=[]
count=0
sum=0
if P==2:
    for i in range(N):
        if int(S[i])%2==0:
            count+=N-i
elif P==5:
    for i in range(N):
        if S[i]=="0" or S[i]=="5":
            count+=N-i
else:
    listS=[int(i) for i in S]
    mod=[(k*10**j)%P for j,k in enumerate(listS)]
    for m in mod:
        sum+=m
        Si.append(sum%P)
        
    for start in range(N):
        if Si[start]==0:
            count+=1            
        for end in range(start+1,N):
            if Si[start]==Si[end]:
                count+=1
print(count)

Fixed submission:
import re
ptr=["A{3}|B{3}"]
str=input()

for valueptr in ptr:
    pattern=re.compile(valueptr)
    res=pattern.search(str)
    if res is None:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N,a,b=map(int,input().split())
sum=0
blue=0
red=0
while sum<N:
    for n in range(a):
        if sum==N:
            break
        blue+=1
        sum+=1
    for m in range(b):
        if sum==N:
            break
        red+=1
        sum+=1
print(blue)

Fixed submission:
N,A,B=map(int,input().split())
ans=(N//(A+B))*A
if N%(A+B)>A:
    ans+=A
else:
    ans+=N%(A+B)
print(ans)
Buggy python submission (verdict: Runtime Error):
s=list(input())
ans=0
for i in range(len(s)):
  ans+=s[i]
  ans%=9
if ans==0:
  print("Yes")
else:
  print("No")

Fixed submission:
s=list(input())
ans=0
for i in range(len(s)):
  ans+=int(s[i])
  ans%=9
if ans==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
arr=list(map(int,input().split()))
arr.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(k+1,n):
      if arr[i]<arr[j] and arr[j]<arr[k]:
        if arr[i]+arr[j]>arr[k]:
          ans+=1
print(ans)

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
arr.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if arr[i]<arr[j] and arr[j]<arr[k]:
        if arr[i]+arr[j]>arr[k]:
          ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):

x,k,d=map(int,input().split())
for i in range(k-1):
    if x>0:
        x-=d
        if x<=0:
            flag=-1
            break
    elif x<0:
        x+=d
        if x>=0:
            flag=1
            break
    else:
        flag=0
        break
if flag==0:
    print(0)
elif flag==-1:
    print(min(abs(x),x+d))
else:
    print(min(abs(x-d),x))

Fixed submission:
x,k,d=map(int,input().split())
x=abs(x)
if x>0:
    temp=x//d
    if temp>=k:
        print(x-k*d)
    else:
        if (k-temp)%2==0:
            print(x%d)
        else:
            print(abs(x%d-d))
elif x==0:
    if k%2==0:
        print(0)
    else:
        print(d)
Buggy python submission (verdict: Time Limit Exceeded):
#coding: utf-8
A = list(map(int, input().split()))
N = A[0]
K = A[1]

n = 0
sw = 0
while True:
  if N%K == 0:
    N = 0
    break
  sw = abs(N-K)
  n += 1
  if N > sw:
    N = sw
  else:
    break
print(N)

Fixed submission:
#coding: utf-8
A = list(map(int, input().split()))
N = A[0]
K = A[1]

n = 0
sw = 0
while True:
  if N%K == 0:
    N = 0
    break
  if (N/K) //1:
    C = N//K
    N = N-C*K

  sw = abs(N-K)
  n += 1
  if N > sw:
    N = sw
  else:
    break
print(N)
Buggy python submission (verdict: Runtime Error):
N = int(input())
nums =[]
count = 0
switch = False
for i in range(N):
    nums.append([int(x) for x in input().split()])

for j in nums:
    if j[0] == j[1]:
        count += 1
    elif j[0] != j[1]:
        count = 0
    if count == 3:
        switch = True
if switch == True:
    print("Yes")
elif switch == False:
    print("No")


Fixed submission:
S = input()
if S[-1:] == "s":
  print(S+"es")
else:print(S+"s")

Buggy python submission (verdict: Runtime Error):
S = input()
if S[-1:] = s:
  print(S+"es")
else:print(S+"s")

Fixed submission:
S = input()
if S[-1:] == "s":
  print(S+"es")
else:print(S+"s")
Buggy python submission (verdict: Runtime Error):
N = int(input())
nums =[]
count = 0
switch = False
for i in range(N):
    nums.append([int(x) for x in input().split()]

for j in nums:
    if j[0] == j[1]:
        count += 1
    elif j[0] != j[1]:
        count = 0
    if count == 3:
        switch = True
if switch == True:
    print("Yes")
elif switch == False:
    print("No")

Fixed submission:
N = int(input())
nums =[]
count = 0
switch = False
for i in range(N):
    nums.append([int(x) for x in input().split()])

for j in nums:
    if j[0] == j[1]:
        count += 1
    elif j[0] != j[1]:
        count = 0
    if count == 3:
        switch = True
if switch == True:
    print("Yes")
elif switch == False:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c,d = [int(x) for x in input().split()]

nums = [a*c,a*d,b*c,b*d]
print(max(nums))

Fixed submission:
x = int(input())
if x == 1:
    print("0")
elif x == 0:
    print("1")
Buggy python submission (verdict: Runtime Error):
n,s = [int(input()) for _ in range(2))
print(s.count("ABC"))

Fixed submission:
n,s = [input() for _ in range(2)]
print(s.count("ABC"))
Buggy python submission (verdict: Runtime Error):
a,b,c,x = [int(input()) for _ in range(4)]
print(sum(500*i+100*j+50*k==x for i in range(a+1)for j in range(b+1)for k in range(c+1)))

Fixed submission:
num = int(input())
if num in [i*j for i in range(1,10) for j in range(1,10)]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = input()
x = a + a*a + a*a*a
print(x)

Fixed submission:
a = int(input())
x = a*a 
y = a*a*a
z =a+x+y

print(z)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

X =A*B
print(X)

Fixed submission:
A,B = map(int,input().split())
print(A * B)
Buggy python submission (verdict: Time Limit Exceeded):
x =int(input())
credit = 100
year = 0


for i in range(10**18):
 #credit = int(credit * 1.01)
  credit = credit // 100
  if(x <= credit):
    break
print(year)
  
      

Fixed submission:
x =int(input())
credit = 100
year = 0


for i in range(10**18):
 #credit = int(credit * 1.01)
  year +=1
  credit += credit // 100
  if(x <= credit):
    break
print(year)
Buggy python submission (verdict: Runtime Error):
d,t,s=list(int,input().split())

if d/t<=s:
    print("yes")
else:
    print("No")


Fixed submission:
def dts():
	return list(map(int,input().split()))

d,t,s=dts()

if d>t*s:
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
d=int(input())     
t=int(input())
s=int(input())

if d/t<=s:
    print("yes")
else:
    print("No")

Fixed submission:
def dts():
	return list(map(int,input().split()))

d,t,s=dts()

if d>t*s:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A_str = input()
A_str_list = A_str.split()
A = [int(A_str_list[i]) for i in range(N)]
sum = 0
for i in range(N):
    for j in range(N-i-1):
        # print(i+j+1, A[i+j+1])
        mod = np.mod(A[i]*A[i+j+1], np.power(10, 9)+7)
        sum += mod
print(np.mod(sum, np.power(10, 9)+7))

Fixed submission:
import numpy as np
N = int(input())
A_str = input()
A_str_list = A_str.split()
A = np.array([int(A_str_list[i]) for i in range(N)])
sum = 0
mod = 1000000007
res = np.cumsum(A)
res = [np.mod((res[-1]-res[i]), mod) for i in range(N)]
# print(res)
for i in range(N):
    sum += np.mod(res[i]*A[i], mod)
print(np.mod(sum, mod))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_str = input()
A_str_list = A_str.split()
A = [int(A_str_list[i]) for i in range(N)]
sum = 0
for i in range(N):
    for j in range(N-i-1):
        # print(i+j+1, A[i+j+1])
        sum += A[i]*A[i+j+1]
# print(sum)
mod = sum % (10**9+7)
print(mod)

Fixed submission:
import numpy as np
N = int(input())
A_str = input()
A_str_list = A_str.split()
A = np.array([int(A_str_list[i]) for i in range(N)])
sum = 0
mod = 1000000007
res = np.cumsum(A)
res = [np.mod((res[-1]-res[i]), mod) for i in range(N)]
# print(res)
for i in range(N):
    sum += np.mod(res[i]*A[i], mod)
print(np.mod(sum, mod))