Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def int2str(i):
  t=str(i)
  if i <10:
    a="0"
    b="0"
    c=t[-1]
  elif i <100:
    a="0"
    b=t[-2]
    c=t[-1]
  else:
    a=t[-3]
    b=t[-2]
    c=t[-1]
  return a,b,c

N=int(input())
S=input()
ans=0
for i in range(1000):
  S1=[]
  S2=[]
  a,b,c=int2str(i)
  flag=0
  for j in  range(len(S)):
    if S[j] ==a:
      S1=S[j+1:]
      break
  if S1==[]:
    continue
  for j in  range(len(S1)):
    if S1[j] ==b:
      S2=S1[j+1:]
      break
  if S2==[]:
    continue
  for j in  range(len(S2)):
    if S2[j] ==c:
      ans+=1
      break
print(ans)
  
  

Fixed submission:
def int2str(i):
  t=str(i)
  if i <10:
    a="0"
    b="0"
    c=t[-1]
  elif i <100:
    a="0"
    b=t[-2]
    c=t[-1]
  else:
    a=t[-3]
    b=t[-2]
    c=t[-1]
  return a,b,c

N=int(input())
S=input()
ans=0
for i in range(1000):
  S1=[]
  S2=[]
  a,b,c=int2str(i)
  flag=0
  i1 = S.find(a)
  if i1 !=-1:
    S1=S[i1+1:]
    i2=S1.find(b)
    if i2 !=-1:
      S2=S1[i2+1:]
      i3=S2.find(c)
      if i3 !=-1:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def int2str(i):
  if i <10:
    a="0"
    b="0"
    c=str(i)[-1]
  elif i <100:
    a="0"
    b=str(i)[-2]
    c=str(i)[-1]
  else:
    a=str(i)[-3]
    b=str(i)[-2]
    c=str(i)[-1]
  return a,b,c

N=int(input())
S=input()
ans=0
for i in range(1000):
  a,b,c=int2str(i)
  flag=0
  for j in S:
    if flag==0 and j==a:
      flag=1
      continue
    elif flag==1 and j==b:
      flag=2
      continue
    elif flag==2 and j==c: 
      ans+=1
      break
print(ans)
  
  

Fixed submission:
def int2str(i):
  t=str(i)
  if i <10:
    a="0"
    b="0"
    c=t[-1]
  elif i <100:
    a="0"
    b=t[-2]
    c=t[-1]
  else:
    a=t[-3]
    b=t[-2]
    c=t[-1]
  return a,b,c

N=int(input())
S=input()
ans=0
for i in range(1000):
  S1=[]
  S2=[]
  a,b,c=int2str(i)
  flag=0
  i1 = S.find(a)
  if i1 !=-1:
    S1=S[i1+1:]
    i2=S1.find(b)
    if i2 !=-1:
      S2=S1[i2+1:]
      i3=S2.find(c)
      if i3 !=-1:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
ans=[]
for i in range(len(S)):
  for j in range(i+1,len(S)):
    for k in range(j+1,len(S)):
      #print(i,j,k)
      ans.append(S[i]+S[j]+S[k])
     # if not S[i]+S[j]+S[k] in ans.keys():
        #ans[S[i]+S[j]+S[k]]=1
#print(len(ans.keys()))
print(len(set(ans)))
#print(set(ans))

Fixed submission:
def int2str(i):
  t=str(i)
  if i <10:
    a="0"
    b="0"
    c=t[-1]
  elif i <100:
    a="0"
    b=t[-2]
    c=t[-1]
  else:
    a=t[-3]
    b=t[-2]
    c=t[-1]
  return a,b,c

N=int(input())
S=input()
ans=0
for i in range(1000):
  S1=[]
  S2=[]
  a,b,c=int2str(i)
  flag=0
  i1 = S.find(a)
  if i1 !=-1:
    S1=S[i1+1:]
    i2=S1.find(b)
    if i2 !=-1:
      S2=S1[i2+1:]
      i3=S2.find(c)
      if i3 !=-1:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
  N=int(input())
  A=list(map(int,input().split()))
  B=list(map(int,input().split()))
  tmp={}
  for i in range(N):
    if not B[i] in tmp.keys():
      tmp[B[i]]=[]
    tmp[B[i]].append(A[i])
  A.sort()
  B.sort()
  for i in range(N):
    if A[i]>B[i]:
      print("No")
      return 0
  for i in range(N):
    if A[i] in tmp[B[i]]:
      print("Yes")
      return 0
    if i!=N-1:
      if B[i] >= A[i+1]:
        print("Yes")
        return 0
  print("No")
      
main()


Fixed submission:
N=int(input())
if N%2==0:
  print(N//2-1)
else:
  print(N//2)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(len(L)-1):
  for j in range(i+1,len(L)):
    left=bisect.bisect_left(L, L[i]+L[j])
    right=bisect.bisect_right(L, L[j]-L[i])
    if left > j:
      ans+=left-j-1
 # break
print(ans)

Fixed submission:
import bisect
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(len(L)-1):
  for j in range(i+1,len(L)):
    left=bisect.bisect_left(L, L[i]+L[j])
    if left > j:
      ans+=left-j-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
def search_ans(fee,box,not_open_luxuary,feebox):
  for k,i in enumerate(box):
    if list(set(i[1]) & set(not_open_luxuary))!=[]:
      a=copy.deepcopy(not_open_luxuary)
      t=copy.deepcopy(box)
      fee1=fee
      for j in list(set(i[1]) & set(a)):
        a.remove(j)
      fee1+=i[0]
      if a==[]:
        feebox.append(fee1)
      else:
        t.pop(k)
        search_ans(fee1,t,a,feebox)
	
def main():
  n,m=map(int,input().split())
  index_box=list(range(n+1))
  index_box.pop(0)
  box=[]
  N=[0]*13
  N[0]=10**4
  feebox=[]
  M=[]
  for i in range(m):
  	a1,b1=map(int,input().split())
  	c1=list(map(int,input().split()))
  	box.append([a1,c1])
  search_ans(0,box,index_box,feebox)
  if feebox==[]:
    print(-1)
  else:
    print(min(feebox))

main()

Fixed submission:
def main():
  N,M=map(int,input().split())
  Inf=10**8
  dp=[Inf]*(2**N)
  dp[0]=0
  for i in range(M):
    a,b=map(int,input().split())
    tmp=list(map(int,input().split()))
    open_tresure=list(1<<j-1 for j in tmp)
   # print(open_tresure)
    op_tr=sum(open_tresure)
    for j in range(2**N):
      key=op_tr | j
      dp[key]=min(dp[key],dp[j]+a)
  if dp[-1]==Inf:
    print(-1)
  else:
    print(dp[-1])

main()
Buggy python submission (verdict: Runtime Error):
S=input()
if S=='Sunny':
  print('Cloudy')
elif S='Cloudy':
  print('Rainy')
else:
  print('Sunny')
  

Fixed submission:
S=input()
if S=='Sunny':
  print('Cloudy')
elif S=='Cloudy':
  print('Rainy')
else:
  print('Sunny')
Buggy python submission (verdict: Runtime Error):
N=int(input())
B=map(int,input().split())
sum=B[0]
for i in range(len(B)-1):
  sum+=min(B[i],B[i+1])
sum+=B[-1]
print(sum)

Fixed submission:
N=int(input())
B=list(map(int,input().split()))
sum=B[0]
for i in range(len(B)-1):
  sum+=min(B[i],B[i+1])
sum+=B[-1]
print(sum)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
Mod=10**9+7
ans_first=0
ans_sec=0
for i in range(len(A)-1):
  for j in range(i,len(A)):
    if A[i]>A[j]:
      ans_first+=1
for i in A:
  for j in A:
    if i > j:
      ans_sec+=1
if K%2==0
  tmp=(2*ans_first+(K-1)*ans_sec)%Mod
  ans=(tmp*K)//2%Mod
else:
  tmp=(2*ans_first+(K-1)//2*ans_sec)%Mod
  ans=(tmp*K)%Mod
print(ans)

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
Mod=10**9+7
ans_first=0
ans_sec=0
for i in range(len(A)-1):
  for j in range(i,len(A)):
    if A[i]>A[j]:
      ans_first+=1
for i in A:
  for j in A:
    if i > j:
      ans_sec+=1
if K%2==0:
  tmp=(2*ans_first+(K-1)*ans_sec)%Mod
  K=K//2
  ans=(tmp*K)%Mod
else:
  tmp=(ans_first+(K-1)//2*ans_sec)%Mod
  ans=(tmp*K)%Mod
print(ans)
Buggy python submission (verdict: Runtime Error):
n=input()
if n>20 or n<2:
  print(0)
else:
  S=list(input().split())
  count=0
  for i in range(1,len(S)-1):
      if (S[i-1]<S[i] and S[i+1]>S[i]):
          count+=1
          break
      if(S[i-1]>S[i] and S[i+1]<S[i]):
          count+=1
  print(count)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
cnt =0
for i in range(1,n-1):
    if p[i-1]<=p[i]<=p[i+1] or p[i+1]<=p[i]<=p[i-1]:
        cnt +=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
ソースコード 拡げる

Copy
Copy
n=input()
S=list(input().split())
count=0
for i in range(1,len(S)-1):
    if (S[i-1]<S[i] and S[i+1]>S[i]) or (S[i-1]>S[i] and S[i+1]<S[i]):
        count+=1
print(count)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
cnt =0
for i in range(1,n-1):
    if p[i-1]<=p[i]<=p[i+1] or p[i+1]<=p[i]<=p[i-1]:
        cnt +=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]
dp=[1]*(N+1)
if 1 in a:
  dp[1]=0
else:
  dp[1]=1
for i in range(2,N+1):
  if i in a:
    dp[i]=0
  else:
    dp[i]=dp[i-1]+dp[i-2]
  dp[i]%=1000000007
print(dp[N])




Fixed submission:
N,M=map(int,input().split())
dp=[1]*(N+1)
for _ in range(M):
  i=int(input())
  dp[i]=0
for i in range(2,N+1):
  if dp[i]!=0:
      dp[i]=dp[i-1]+dp[i-2]
  dp[i]%=1000000007
print(dp[N])
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
box=[]
A=list(map(int,input().split()))
for _ in range(M):
  b,c=map(int,input().split())
  for __ in range(b):
    A.append(c)
A.sort(reverse = True)
print(sum(A[:N]))


Fixed submission:
N,M=map(int,input().split())
box=[]
A=list(map(int,input().split()))
for i in A:
  box.append((i,1))
for _ in range(M):
  b,c=map(int,input().split())
  box.append((c,b))
box = sorted(box, key=lambda x:x[0])
box.reverse()
ans=0
count=0
for i in range(0,10**5):
  ans+=(box[i][0]*box[i][1])
  count+=box[i][1]
  if count >N:
    ans-=((count-N)*box[i][0])
    break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
box=[]
A=list(map(int,input().split()))
for _ in range(M):
  b,c=map(int,input().split())
  for __ in range(b):
    A.append(c)
A.sort()
A.reverse()
print(sum(A[:N]))

Fixed submission:
N,M=map(int,input().split())
box=[]
A=list(map(int,input().split()))
for i in A:
  box.append((i,1))
for _ in range(M):
  b,c=map(int,input().split())
  box.append((c,b))
box = sorted(box, key=lambda x:x[0])
box.reverse()
ans=0
count=0
for i in range(0,10**5):
  ans+=(box[i][0]*box[i][1])
  count+=box[i][1]
  if count >N:
    ans-=((count-N)*box[i][0])
    break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M,K=map(int,input().split())
MOD=10**9+7

from fractions import Fraction

# 組合せの総数
def comb(n, k):
    
    if n < 0 or k < 0:
        pdt = 0
    
    else:
        pdt = 1
        for s in range(1, k + 1):
            pdt *= Fraction(n - s + 1, s)
    
    # 戻り値をint型にするために分子を取り出す
    return pdt.numerator


ans_x=0
ans_y=0

for i in range(1,N):
  ans_x+=i*(N-i)
  ans_x%=MOD
for i in range(1,M):
  ans_y+=i*(M-i)
  ans_y%=MOD
ans_x*=((M**2))
ans_y*=((N**2))
ans=comb(N*M-2,K-2)
ans*=(ans_x+ans_y)
ans%=MOD
print(int(ans))

Fixed submission:
N,M,K=map(int,input().split())
MOD=10**9+7

# 組合せの総数
def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            result%=MOD

    return result



ans_x=0
ans_y=0

for i in range(1,N):
  ans_x+=i*(N-i)
  ans_x%=MOD
for i in range(1,M):
  ans_y+=i*(M-i)
  ans_y%=MOD
ans_x*=((M**2))
ans_y*=((N**2))
ans=comb(N*M-2,K-2)
ans*=(ans_x+ans_y)
ans%=MOD
print(int(ans))

Buggy python submission (verdict: Runtime Error):
N,M,K=map(int,input().split())
MOD=10**9+7
def comb(n, k):
    m = 1
    if n < 2 * k:
        k = n - k
    for i in range(1, k + 1):
        m = m * (n - i + 1) / i    
    return m
for i in range(1,N):
  ans_x+=(i*(N-i))
for i in range(1,M):
  ans_y+=(i*(M-i))
ans_x*=M**2
ans_y*=X**2
print(conb(NM-2,K-2)*(ans_x+ans_y)%MOD)


Fixed submission:
N,M,K=map(int,input().split())
MOD=10**9+7

# 組合せの総数
def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            result%=MOD

    return result



ans_x=0
ans_y=0

for i in range(1,N):
  ans_x+=i*(N-i)
  ans_x%=MOD
for i in range(1,M):
  ans_y+=i*(M-i)
  ans_y%=MOD
ans_x*=((M**2))
ans_y*=((N**2))
ans=comb(N*M-2,K-2)
ans*=(ans_x+ans_y)
ans%=MOD
print(int(ans))
Buggy python submission (verdict: Runtime Error):
N,K=input().split()
S=input()
S[K-1]=S[K-1].lower()
print(S)

Fixed submission:
N,K=input().split()
S=list(input())
for i in range(len(S)):
    if i==int(K)-1:
        S[i]=S[i].lower()
print(''.join(S))
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
sum=0
while(1):
  for i in range(1,N+1):
    tmp=1/N
    now=i
    while(K>now):
      now*=2
      tmp/=2
    sum+=tmp
print(sum)

Fixed submission:
N,K=map(int,input().split())
sum=0
while(1):
  for i in range(1,N+1):
    tmp=1/N
    now=i
    while(K>now):
      now*=2
      tmp/=2
    sum+=tmp
  break
print(sum)
Buggy python submission (verdict: Runtime Error):
class union_find():
  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 main():
  N,M=map(int,input().split())
  box=union_find(N)
  for i in range(M):
    x,y,z=map(int,input().split())
    box.union(x,y)
  box.find(1)
  ans=0
  for i, x in enumerate(box.parents):
    if x<0:
      ans+=1
  print(ans)
main()
    
    

Fixed submission:
class union_find():
  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 main():
  N,M=map(int,input().split())
  box=union_find(N)
  for i in range(M):
    x,y,z=map(int,input().split())
    box.union(x-1,y-1)
  box.find(1)
  ans=0
  for i, x in enumerate(box.parents):
    if x<0:
      ans+=1
  print(ans)
main()
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=list(input())
K=int(input())
word=S[K]
for i in range(len(S)):
    if S[i]!=word:
        S[i]='*'
print(''.join(S))

Fixed submission:
N=int(input())
S=list(input())
K=int(input())
word=S[K-1]
for i in range(len(S)):
    if S[i]!=word:
        S[i]='*'
print(''.join(S))
Buggy python submission (verdict: Runtime Error):
for i in range(6):
  box[i]=int(input())
flag=0
for i in range(4):
  if (box[i]-box[i+1]) > box[5]:
    flag = 1 #直接通信ができない
  	break
if flag==1:
  print(':(')
else:
  print('Yay!')


Fixed submission:
box=[]
for i in range(6):
  box.append(int(input()))
flag=0
if box[4]-box[0]>box[5]:
    print(':(')
else:
    print('Yay!')
Buggy python submission (verdict: Runtime Error):
b=10
sum=0
for _ in range(5):
	a=int(input())
    sum+=a-a%10
  	if b>a:
      b=a
sum+=40+b
print(sum)

Fixed submission:
b=10
sum=0
for _ in range(5):
  a=int(input())
  if a%10 !=0:
      sum += (a+10-a%10)
      if b>(a%10):
          b=a%10
  else:
      sum += a
print(sum-10+b)
Buggy python submission (verdict: Runtime Error):
N,Q=map(int, input().split())
s=list(input())
box=[1]*(N+2)
for _ in range(Q):
    k=1
    t,d=map(str, input().split())
    for j in s:
        if t == j:
            if box[k] > 0:
                if d =='L':
                    box[k-1]+=box[k]
                    box[k]=0
                else:
                    box[k+1]+=box[k]
                    box[k]=0
        k+=1
print(sum(box[1:N+1]))


Fixed submission:
A,B,C=map(int, input().split())
if A == B and B == C:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
word_list=list(S)
for i in range(Q):
  count=0
  flag =0
  l,r=map(int,input().split())
  box=word_list[l-1:r]
  for i in box:
    if i == 'A':
      flag =1
    elif i!= 'C':
      flag=0
    if flag == 0 and i=='C':
      flag = 0
    if flag == 1 and i =='C':
      count += 1
      flag = 0
  print(count)

Fixed submission:
word=input()
if word == 'A':
  print('T')
elif word == 'T':
  print('A')
elif word == 'G':
  print('C')
else:
  print('G')
Buggy python submission (verdict: Runtime Error):
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S))
print(answer)

Fixed submission:
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S).values())
print(answer)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=list(input())
answer=counter(S)
print(answer)

Fixed submission:
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S).values())
print(answer)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
 
def counter(list_1):
	return (reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7)
  
N=input()
S=list(input())
answer=counter(S)
print(answer)

Fixed submission:
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S).values())
print(answer)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
 
def counter(list_1):
	return reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))

N=input()
S=list(input())
answer=counter(S)
print(answer)

Fixed submission:
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S).values())
print(answer)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
 
def counter(list_1):
	return reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))

N=input()
S=list(input())
answer=counter(s)
print(answer)

Fixed submission:
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S).values())
print(answer)

Buggy python submission (verdict: Runtime Error):
from collections import Counter

def counter(list_1):
	return reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))

if __name__ == '__main__':
  N=input()
  S=list(input())
  answer=counter(s)
  print(answer)

Fixed submission:
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S).values())
print(answer)
Buggy python submission (verdict: Runtime Error):
N=int(input())
l=[]
l_value=[]
i=0
stack=-1
for i in range(N):
    if i <= N:
        stack=input()
        l.append(stack)
list_simple=[]
for i in l:
    if stack != i:
        list_simple.append(i)
dp_dict=[]
dp=1
for i in list_simple:
    if c not in dp_dict:
        dp_dict[c] = 0
    dp = dp_dict[c] +dp
    dp_dict[c] = dp
print(dp)


Fixed submission:
N=int(input())
l=[]
l_value=[]
i=0
stack=-1
for i in range(N):
    if i < N:
        l.append(input())
list_simple=[]
for i in l:
    if stack != i:
        list_simple.append(i)
    stack = i
dp_dict=[0]*200001
dp=1
for i in list_simple:
    i=int(i)
    dp = dp_dict[i] +dp
    dp_dict[i] = dp
print(dp%(10**9+7))
Buggy python submission (verdict: Runtime Error):
A,B,C=int(input())
if A+B >= C:
    print(B+C)
else:
    print(A+2*B+1)


Fixed submission:
A,B,C = map(int,input().split())
if A+B >= C:
    print(B+C)
else:
    print(A+2*B+1)

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
if A+B >= C:
    print(B+C)
else:
    print(A+2*B+1)

Fixed submission:
A,B,C = map(int,input().split())
if A+B >= C:
    print(B+C)
else:
    print(A+2*B+1)

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
j=0
for i in range(C):
  j=j+1

Fixed submission:
A,B,C = map(int,input().split())
if A+B >= C:
    print(B+C)
else:
    print(A+2*B+1)
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
a=int(a)
b=int(b)
c=int(c)
avarage=(a+b+c)/2
if a!=avarage and b!=avarage and c!=avarage:
    print("Yes")
else:
    print("No")


Fixed submission:
a,b,c=map(int,input().split())
a=int(a)
b=int(b)
c=int(c)
avarage=(a+b+c)/2
if a!=avarage and b!=avarage and c!=avarage:
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
avarage=(a+b+c)/2
if a==avarage or b==avarage or c==avarage:
    print("Yes")
else:
    print("No")


Fixed submission:
a,b,c=map(int,input().split())
a=int(a)
b=int(b)
c=int(c)
avarage=(a+b+c)/2
if a!=avarage and b!=avarage and c!=avarage:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
h,w,m=map(int,input().split())
H=[0]*(3*10**5+1)
W=[0]*(3*10**5+1)
M=[]
for i in range(m):
    h,w=map(int,input().split())
    M.append([h,w])
    H[h]+=1
    W[w]+=1

p=max(H)
q=max(W)

X=set([i for i in range(3*10**5+1) if H[i]==p])
Y=set([i for i in range(3*10**5+1) if W[i]==q])

Z=[[M[i][0],M[i][1]] for i in range(m) if M[i][0] in X or M[i][1] in Y ]

cnt=1
flag=True
for x in X:
    if flag:
        for y in Y:
            if not [x,y] in Z:
                cnt=0
                flag=False
                break

print(p+q-cnt)

Fixed submission:
h,w,m=map(int,input().split())
H=[0]*(3*10**5+1)
W=[0]*(3*10**5+1)
M=[]
for i in range(m):
    h,w=map(int,input().split())
    M.append([h,w])
    H[h]+=1
    W[w]+=1

p=max(H)
q=max(W)

X=set([i for i in range(3*10**5+1) if H[i]==p])
Y=set([i for i in range(3*10**5+1) if W[i]==q])

cnt=0
for i in range(m):
    if M[i][0] in X and M[i][1] in Y:
        cnt+=1

if cnt==len(X)*len(Y):
    print(p+q-1)
else:
    print(p+q)

Buggy python submission (verdict: Time Limit Exceeded):
h,w,m=map(int,input().split())
H=[0]*(3*10**5+1)
W=[0]*(3*10**5+1)
M=[]
for i in range(m):
    h,w=map(int,input().split())
    M.append([h,w])
    H[h]+=1
    W[w]+=1

p=max(H)
q=max(W)

X=[i for i in range(3*10**5+1) if H[i]==p]
Y=[i for i in range(3*10**5+1) if W[i]==q]

cnt=1
flag=True
for x in X:
    if flag:
        for y in Y:
            if not [x,y] in M:
                cnt=0
                flag=False
                break

print(p+q-cnt)

Fixed submission:
h,w,m=map(int,input().split())
H=[0]*(3*10**5+1)
W=[0]*(3*10**5+1)
M=[]
for i in range(m):
    h,w=map(int,input().split())
    M.append([h,w])
    H[h]+=1
    W[w]+=1

p=max(H)
q=max(W)

X=set([i for i in range(3*10**5+1) if H[i]==p])
Y=set([i for i in range(3*10**5+1) if W[i]==q])

cnt=0
for i in range(m):
    if M[i][0] in X and M[i][1] in Y:
        cnt+=1

if cnt==len(X)*len(Y):
    print(p+q-1)
else:
    print(p+q)