Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = [int(input()) for _ in range(N)]
   
i=0 
while i+1<len(C):
    if C[i]==C[i+1]:
        C.pop(i+1)
    else:
        i+=1

DP = [1]
dic = {}      
Sum = 1

for i in range(len(C)):  
    Sum += dic.get(C[i],0)
    Sum %= 10**9+7
    DP.append(Sum)                               
    dic[C[i]] = Sum   
print(Sum)             

Fixed submission:
N = int(input())
C = [int(input()) for _ in range(N)]
C = [x for x,y in zip(C[:-1],C[1:]) if x!=y] + [C[-1]]

DP = [1]
dic = {}

for i in range(len(C)):   
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))    
    dic[C[i]] = DP[-1]
print(DP[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = [int(input()) for _ in range(N)]
   
i=0 
while i+1<len(C):
    if C[i]==C[i+1]:
        C.pop(i+1)
    else:
        i+=1

DP = [1]
dic = {}      

for i in range(len(C)):  
    DP.append(DP[-1]+dic.get(C[i],0))            
    dic[C[i]] = DP[-1]            
print(DP[-1]%(10**9+7))

Fixed submission:
N = int(input())
C = [int(input()) for _ in range(N)]
C = [x for x,y in zip(C[:-1],C[1:]) if x!=y] + [C[-1]]

DP = [1]
dic = {}

for i in range(len(C)):   
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))    
    dic[C[i]] = DP[-1]
print(DP[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = [int(input()) for _ in range(N)]
   
i=0 
while i+1<len(C):
    if C[i]==C[i+1]:
        C.pop(i+1)
    else:
        i+=1

DP = [1]
dic = {}      

for i in range(len(C)):  
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))
    dic[C[i]] = DP[-1]            
print(DP[-1])

Fixed submission:
N = int(input())
C = [int(input()) for _ in range(N)]
C = [x for x,y in zip(C[:-1],C[1:]) if x!=y] + [C[-1]]

DP = [1]
dic = {}

for i in range(len(C)):   
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))    
    dic[C[i]] = DP[-1]
print(DP[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = [int(input()) for _ in range(N)]
   
i=0 
while i+1<len(C):
    if C[i]==C[i+1]:
        C.pop(i+1)
    else:
        i+=1

DP = [1]
dic = {}      

for i in range(len(C)):  
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))    
    dic[C[i]] = DP[-1]         
print(DP[-1])


Fixed submission:
N = int(input())
C = [int(input()) for _ in range(N)]
C = [x for x,y in zip(C[:-1],C[1:]) if x!=y] + [C[-1]]

DP = [1]
dic = {}

for i in range(len(C)):   
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))    
    dic[C[i]] = DP[-1]
print(DP[-1])

Buggy python submission (verdict: Runtime Error):
N = int(input())
C = [int(input()) for _ in range(N)]
   
i=0 
dic = {}
while i+1<len(C):
    dic[C[i]] = -1
    if C[i]==C[i+1]:
        C.pop(i+1)
    else:
        i+=1

DP = [1]
for i in range(len(C)):  
    if dic[C[i]]==-1:   
        DP.append(DP[-1])
    else:
        DP.append((DP[-1]+DP[dic[C[i]]])%(10**9+7))
    dic[C[i]] = i+1            
print(DP[-1])


Fixed submission:
N = int(input())
C = [int(input()) for _ in range(N)]
C = [x for x,y in zip(C[:-1],C[1:]) if x!=y] + [C[-1]]

DP = [1]
dic = {}

for i in range(len(C)):   
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))    
    dic[C[i]] = DP[-1]
print(DP[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = [int(input()) for _ in range(N)]
   
i=0 
while i+1<len(C):
    if C[i]==C[i+1]:
        C.pop(i+1)
    else:
        i+=1

DP = [1]
dic = {}      

for i in range(len(C)):  
    if not(C[i] in dic):
        DP.append(DP[-1])
    else:
        DP.append((DP[-1]+DP[dic[C[i]]])%(10**9+7))
    dic[C[i]] = i+1            
print(DP[-1])


Fixed submission:
N = int(input())
C = [int(input()) for _ in range(N)]
C = [x for x,y in zip(C[:-1],C[1:]) if x!=y] + [C[-1]]

DP = [1]
dic = {}

for i in range(len(C)):   
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))    
    dic[C[i]] = DP[-1]
print(DP[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = [int(input()) for _ in range(N)]
   
i=0 
while i+1<len(C):
    if C[i]==C[i+1]:
        C.pop(i+1)
    else:
        i+=1

DP = [1]
dic = {}      

for i in range(len(C)):  
    if not(C[i] in dic):
        DP.append(DP[-1])
    else:
        DP.append((DP[-1]+DP[dic[C[i]]])%(10**9+7))
    dic[C[i]] = i+1            
print(DP[-1])


Fixed submission:
N = int(input())
C = [int(input()) for _ in range(N)]
C = [x for x,y in zip(C[:-1],C[1:]) if x!=y] + [C[-1]]

DP = [1]
dic = {}

for i in range(len(C)):   
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))    
    dic[C[i]] = DP[-1]
print(DP[-1])