Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
lists=list(map(int,input().split()))
anslist=[0 for i in range(n+1)]
anslist.append(0)
for j in lists:
    anslist[j]+=1
if anslist[0]!=1:
    print(0)
else:
    ans=1
    for j in range(n+1):
            for k in range(anslist[j+1]):
                ans=anslist[j]*ans
                ans=ans%(998244353)
    if anslist[-1]1!=1:
      print(ans*2)


Fixed submission:
n=int(input())
lists=list(map(int,input().split()))
a=lists.copy()
anslist=[0 for i in range(n+1)]
for j in lists:
    anslist[j]+=1
if anslist[0]!=1:
    print(0)
else:
    ans=1
    for j in range(n):
            for k in range(anslist[j+1]):
                ans=anslist[j]*ans
                ans=ans%(998244353)
    if a[0]!=0:
      print(0)
    else:
      print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
lists=list(map(int,input().split()))
anslist=[0 for i in range(n+1)]
for j in lists:
    anslist[j]+=1

ans=1
counter=1
if anslist[0]!=1:
    print(0)
else:
    for j in range(n):
        if anslist[j]!=0 and anslist[j+1]!=0:
            counter=anslist[j]
            for j in range(anslist[j+1]):
                ans*=counter
                ans%(998244353)
        elif anslist[j+1]==0 and anslist[j]!=0:
            break
	print(ans)

Fixed submission:
n=int(input())
lists=list(map(int,input().split()))
a=lists.copy()
anslist=[0 for i in range(n+1)]
for j in lists:
    anslist[j]+=1
if anslist[0]!=1:
    print(0)
else:
    ans=1
    for j in range(n):
            for k in range(anslist[j+1]):
                ans=anslist[j]*ans
                ans=ans%(998244353)
    if a[0]!=0:
      print(0)
    else:
      print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
import math
gcds=math.gcd(a,b)
cnt=0
primelist=[2]

while gcds%2==0:
    gcds=gcds//2
    cnt+=1
#この時点でgcdsは奇数になっているはずである
n = 10**6
prime = {i for i in range(2,n)}
for i in range(2,n):
    if i in prime:
        for j in range(i*2,n,i):
            if j in prime:
                prime.remove(j)
                #エラトステネスの篩
prime.remove(2)

for some in prime:
    if gcds%some==0:
        while gcds%some==0:
            gcds=int(gcds/some)
        primelist.append(some)  

if gcds!=1 and cnt>=1:
    primelist.append("larger")
    primelist.append(1)
    
elif gcds!=1 and cnt==0:
    primelist.append("larger")
    primelist.remove(2)
    primelist.append(1)
elif gcds==1 and cnt>=1:
    primelist.append(1)
elif gcds==1 and cnt==0:
    primelist.remove(2)
    primelist.append(1)

print(len(primelist))

Fixed submission:
a,b=map(int,input().split())
import fractions
gcds=fractions.gcd(a,b)
cnt=0
primelist=[2]

while gcds%2==0:
    gcds=gcds//2
    cnt+=1
#この時点でgcdsは奇数になっているはずである
n = 10**6
prime = {i for i in range(2,n)}
for i in range(2,n):
    if i in prime:
        for j in range(i*2,n,i):
            if j in prime:
                prime.remove(j)
                #エラトステネスの篩
prime.remove(2)

for some in prime:
    if gcds%some==0:
        while gcds%some==0:
            gcds=int(gcds/some)
        primelist.append(some)  

if gcds!=1 and cnt>=1:
    primelist.append("larger")
    primelist.append(1)
    
elif gcds!=1 and cnt==0:
    primelist.append("larger")
    primelist.remove(2)
    primelist.append(1)
elif gcds==1 and cnt>=1:
    primelist.append(1)
elif gcds==1 and cnt==0:
    primelist.remove(2)
    primelist.append(1)

print(len(primelist))
Buggy python submission (verdict: Time Limit Exceeded):
# e get everything
n, m = map(int, input().split())

lists = []
for i in range(m):
    price, num = map(int, input().split())
    K = list(map(int, input().split()))
    cnt = 0
    for some in K:
        cnt += 2**(n - some)
    lists.append((price, cnt))

dp = [[10**10 for i in range(2**n)]for j in range(m + 1)]
# dp[i][j]=i番目までの鍵を使用してjの状態を再現するために必要な最小の値
dp[0][0] = 0
for i in range(1, m + 1):
    price, mode = lists[i - 1][0], lists[i - 1][1]
    for j in range(2**n):
        dp[i][j] = min(dp[i - 1][j], dp[i - 1][j &(2**n-1-mode)] + price)

ans = dp[m][2**n - 1]

if ans < 10**10:
    print(ans)
else:
    print(-1)


Fixed submission:
# e get everything
n, m = map(int, input().split())

lists = []
for i in range(m):
    price, num = map(int, input().split())
    K = list(map(int, input().split()))
    cnt = 0
    for some in K:
        cnt += 2**(n - some)
    lists.append((price, cnt))

dp = [[10**10 for i in range(2**n)]for j in range(m + 1)]
# dp[i][j]=i番目までの鍵を使用してjの状態を再現するために必要な最小の値
dp[0][0] = 0
for i in range(1, m + 1):
    price, mode = lists[i - 1][0], lists[i - 1][1]
    for j in range(2**n):
        dp[i][j] = min(dp[i - 1][j], dp[i - 1][j &(2**n-1-mode)] + price)

ans = dp[m][2**n - 1]

if ans < 10**10:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
s=input()
if s==‘Sunny’:
    print(‘Cloudy’)
elif s==‘Cloudy’:
    print(‘Rainy’)
elif s==‘Rainy’:
    print(‘Sunny’)

Fixed submission:
S=input()
if S=="Rainy":
  print("Sunny")
if S=="Sunny":
  print("Cloudy")
if S=="Cloudy":
  print("Rainy")
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q=map(int,input().split())
lists=[]
for i in range(q):
    s=int(input())
    lists.append(s)

for x in range(n):
    if lists.count(x+1)+k-q>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q=map(int,input().split())
lists=[0]*n
for i in range(q):
    a=int(input())
    lists[a-1]+=1
for i in range(n):
    check=k-(q-lists[i])
    if check>0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int,input().split())
lists=[]
emptylists=[]

for i in range(Q):
    s=int(input())
    lists.append(s)

for i ,j in enumerate(lists):
    emptylists.append([i,j])


Uselist=[K for i in range(N)]

for nums in range(Q):
    for numbers in range(N):
        if numbers==emptylists[nums][1]-1:
            
            Uselist[numbers]=Uselist[numbers]
            
        else:
            Uselist[numbers]=Uselist[numbers]-1

for num in range(N):
    if Uselist[num]>0:
        print("Yes")
    else:
        print("No")
        

Fixed submission:
n,k,q=map(int,input().split())
lists=[0]*n
for i in range(q):
    a=int(input())
    lists[a-1]+=1
for i in range(n):
    check=k-(q-lists[i])
    if check>0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
#C問題
N,K,Q=map(int,input().split())
lists=[]
emptylists=[]

for i in range(Q):
    s=int(input())
    lists.append(s)

for i ,j in enumerate(lists):
    emptylists.append([i,j])


Uselist=[K for i in range(N)]

for nums in range(Q):
    for numbers in range(N):
        if numbers==emptylists[nums][1]-1:
            Uselist[numbers]=Uselist[numbers]
        else:
            Uselist[numbers]=Uselist[numbers]-1

for num in range(N):
    if Uselist[num]>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q=map(int,input().split())
lists=[0]*n
for i in range(q):
    a=int(input())
    lists[a-1]+=1
for i in range(n):
    check=k-(q-lists[i])
    if check>0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
#powerful discount tickets
import bisect
n,m=map(int,input().split())
lists=list(map(int,input().split()))
lists=sorted(lists)
for _ in range(m):
    #m回この作業を繰り返す
    maxi=lists[-1]
    lists.remove(maxi)
    bisect.insort(lists,maxi/2)
ans=0
import math
for some in lists:
    ans+=math.floor(some)
print(ans)

Fixed submission:
from bisect import bisect_right
import heapq
n,m=map(int,input().split())
lists=list(map(int,input().split()))
uselists=[]
for _ in lists:
    uselists.append(-_)

heapq.heapify(uselists)

cnt=0
while cnt<m:
    y=heapq.heappop(uselists)

    z=(-y)//2
    heapq.heappush(uselists,-z)
    

    cnt+=1
anslist=[]
for j in uselists:
    anslist.append(-j)
print(sum(anslist))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_right

n,m=map(int,input().split())
lis=list(map(int,input().split()))
lists=sorted(lis)

cnt=0
while cnt<m:
    y=lists[-1]//2
    del lists[-1]
    
    indexes=bisect_right(lists,y)
    #indexesというところに新しいyの値を代入しておきたい
    lists.insert(indexes,y)

    cnt+=1
print(sum(lists))

Fixed submission:
from bisect import bisect_right
import heapq
n,m=map(int,input().split())
lists=list(map(int,input().split()))
uselists=[]
for _ in lists:
    uselists.append(-_)

heapq.heapify(uselists)

cnt=0
while cnt<m:
    y=heapq.heappop(uselists)

    z=(-y)//2
    heapq.heappush(uselists,-z)
    

    cnt+=1
anslist=[]
for j in uselists:
    anslist.append(-j)
print(sum(anslist))

Buggy python submission (verdict: Runtime Error):
from bisect import bisect_right

n,m=map(int,input().split())
lis=list(map(int,input().split()))
lists=sorted(lis)

cnt=0
while cnt<m:
    y=lists[-1]//2
    del lists[-1]
    
    indexes=bisect_left(lists,y)
    #indexesというところに新しいyの値を代入しておきたい
    lists.insert(indexes,y)

    cnt+=1
print(sum(lists))
    

Fixed submission:
from bisect import bisect_right
import heapq
n,m=map(int,input().split())
lists=list(map(int,input().split()))
uselists=[]
for _ in lists:
    uselists.append(-_)

heapq.heapify(uselists)

cnt=0
while cnt<m:
    y=heapq.heappop(uselists)

    z=(-y)//2
    heapq.heappush(uselists,-z)
    

    cnt+=1
anslist=[]
for j in uselists:
    anslist.append(-j)
print(sum(anslist))
Buggy python submission (verdict: Runtime Error):
# problem 7
# cell inversion
N = int(input())
S = input()
if S[0]=="W":
    print(0)
    exit()
mod = 10**9 + 7
D = [-1]  # left -1 right 1
for i in range(2*N-1):
    if S[i] != S[i+1]:
        D.append(D[-1])
    else:
        D.append(D[-1]*(-1))
left = []
for i in range(2*N):
    if D[i] < 0:
        left.append(i)
sums = [0 for i in range(2*N)]
for i in range(2*N):
    if D[i] > 0:
        sums[i] += 1
for i in range(2*N-2, -1, -1):
    sums[i] += sums[i+1]
ans = 1
for i in range(2, N+1):
    ans *= i
    ans %= mod
for i in range(N):
    ans *= sums[left[i]]-(N-1-i)
    ans %= mod
print(ans)

Fixed submission:
# problem 7
# cell inversion
N = int(input())
S = input()
if S[0]=="W":
    print(0)
    exit()
mod = 10**9 + 7
D = [-1]  # left -1 right 1
for i in range(2*N-1):
    if S[i] != S[i+1]:
        D.append(D[-1])
    else:
        D.append(D[-1]*(-1))
left = []
for i in range(2*N):
    if D[i] < 0:
        left.append(i)
sums = [0 for i in range(2*N)]
for i in range(2*N):
    if D[i] > 0:
        sums[i] += 1
for i in range(2*N-2, -1, -1):
    sums[i] += sums[i+1]
ans = 1
for i in range(2, N+1):
    ans *= i
    ans %= mod
if len(left)!=N:
    print(0)
    exit()
for i in range(N):
    ans *= sums[left[i]]-(N-1-i)
    ans %= mod
print(ans)
Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()
if a>=3200:
	print(s)
else:
print("red")

Fixed submission:
a=int(input())
s=input()
if a>=3200:
	print(s)
else:
    print("red")
Buggy python submission (verdict: Runtime Error):
# -*- coding: UTF-8 -*-
import math
# f=open("test.txt")
# line=f.readline()
# lists=[]
# while line:
#     lists.append("".join(list(line)[:-1]))
#     line=f.readline()
# 
# f.close()
# 
# s=lists[0]
# t=lists[1]

s=input()
t=input()

alpha=list("abcdefghijklmnopqrstuvwxyz")

dic_s={alpha[i]:0 for i in range(26)}
dic_t={alpha[i]:0 for i in range(26)}

a={alpha[i]:[] for i in range(26)}
b={alpha[i]:[] for i in range(26)}


for i in range(len(s)-1):
    if dic_s[s[i]]==0:
        dic_s[s[i]]=+1
        a[s[i]].append(i+1)


for j in range(len(t)-1):
    if dic_t[t[j]]==0:
        dic_t[t[j]]=+1
        b[t[j]].append(j+1)

flag=True

for i in range(26):
    if dic_t[alpha[i]]>0 and dic_s[alpha[i]]==0:
        flag=False

place=[0,0]

def binary(now,string):
    left=a[string][0]
    right=a[string][-1]
    #sのなかでstringがあり得る最大の位置
    #左のインデックスと右のインデックスを決める
    #now=現在いるindex
    flag=True
    if now>right:
        place[0]=left
        place[1]+=1

    elif now<left:
        place[0]=left
    else:
        indexl=0
        indexr=dic_s[string]-1
        for _ in range(20):
            c=math.floor((indexl+indexr)/2)
            if a[string][c]<=now:
                indexl=c
                indexr=indexr
            elif a[string][c]>now:
                indexl=indexl
                indexr=c
        place[0]=a[string][indexr]

if flag:
    #文字を構成できる場合
    for i in range(len(t)):
        string=t[i]
        now=place[0]
        binary(now,string)

    print(place[0]+place[1]*len(s))

else:
    #構成できない場合
    print(-1)


Fixed submission:
# -*- coding: UTF-8 -*-
import math
import bisect
# f=open("test.txt")
# line=f.readline()
# lists=[]
# while line:
#     lists.append("".join(list(line)[:-1]))
#     line=f.readline()
# 
# f.close()
# 
# s=lists[0]
# t=lists[1]

s=input()
t=input()

alpha=list("abcdefghijklmnopqrstuvwxyz")

dic_s={alpha[i]:0 for i in range(26)}
dic_t={alpha[i]:0 for i in range(26)}

a={alpha[i]:[] for i in range(26)}
b={alpha[i]:[] for i in range(26)}


for i in range(len(s)):
  
    if dic_s[s[i]]==0:
        dic_s[s[i]]=+1
    a[s[i]].append(i+1)


for j in range(len(t)):
    
    if dic_t[t[j]]==0:
        dic_t[t[j]]=+1
    b[t[j]].append(j+1)
for i in range(26):
	a[alpha[i]].append(10**9)
flag=True

for i in range(26):
    if dic_t[alpha[i]]>0 and dic_s[alpha[i]]==0:
        flag=False

place=[0,0]

if flag:
    #文字を構成できる場合
    for i in range(len(t)):
        string=t[i]
        num=bisect.bisect_right(a[string],place[0])  
        if a[string][num]==10**9:
            place[1]+=1
            place[0]=a[string][0]
        else:
            place[0]=a[string][num]
  

    print(place[0]+place[1]*len(s))

else:
    #構成できない場合
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
lists=[]
setlists=[]
uselists=[]
allsums=0

n=int(input())
for s in range(n):
    something=sorted(str(input()))
    lists.append(something)
    if something not in setlists:
        setlists.append(something)


for i in setlists:
    whatis=lists.count(i)
    uselists.append(whatis)

for x in uselists:
    allsums+=int(x*(x-1)/2)
print(allsums)

Fixed submission:
n=int(input())
dicts={}
nums=0
for x in range(n):
    s=str(input())
    sorting=sorted(s)
    sorting="".join(sorting)
    if sorting not in dicts.keys():
        dicts[sorting]=1
    else:
        dicts[sorting]+=1
for x in  dicts.values():
    nums+=int(x*(x-1)/2)
print(nums)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter as ct
emptylists=[]
allsums=0

n=int(input())
for s in range(n):
    something=dict(ct(str(input())))
    emptylists.append(something)

for x in range(n):
    for y in range(n):
        if emptylists[x]==emptylists[y]:
            allsums+=1
        else:
            continue
print(int((allsums-n)/2))

Fixed submission:
n=int(input())
dicts={}
nums=0
for x in range(n):
    s=str(input())
    sorting=sorted(s)
    sorting="".join(sorting)
    if sorting not in dicts.keys():
        dicts[sorting]=1
    else:
        dicts[sorting]+=1
for x in  dicts.values():
    nums+=int(x*(x-1)/2)
print(nums)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lists=[]

for i in range(n):
    lists.append(int(input()))

for i in range(n):
    if i==0:
        newlist=lists[1:]
        print(max(newlist))
    if i>=1:
        newlist=lists[:i]+lists[i+1:]
        print(max(newlist))

Fixed submission:
n=int(input())
lists=[int(input()) for i in range(n)]
liscop=lists.copy()
lists=sorted(lists)
for i in liscop:
    if i==lists[-1]:
        print(lists[-2])
    else:
        print(lists[-1])
Buggy python submission (verdict: Runtime Error):
s=input()
import colletions
s=dict(collections.Counter(s))
if len(s)==2:
  flag=True
  for k in s.values():
    if k!=2:
      flag=False
  if flag:
    print("Yes")
  else:
    print("No")
else:
  print("No")
  

Fixed submission:
s=input()
import collections
s=dict(collections.Counter(s))
if len(s)==2:
  flag=True
  for k in s.values():
    if k!=2:
      flag=False
  if flag:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
use=[0]
ans=1
for i in range(m):
    use.append(int(input()))
use.append(n)

if n>=2:        
    lists=[1,2]

    for i in range(n-2):
        lists.append((lists[-1]+lists[-2])%1000000007)

    
    for i in range(m+1):
    
        if use[i+1]-use[i]==1 and i>=1:
            ans=0
            break
        else:
            ans=(ans*lists[int(use[i+1]-use[i]-2)])%1000000007
            
            
    print(ans)
elif n==1:
    print(1)


Fixed submission:
n=int(input())
s=list(map(int,input().split()))

changed=sorted(s,reverse=True)


if changed[int(n/2-1)]==changed[int(n/2)]:
        print(0)
else:
        print(-changed[int(n/2)]+changed[int(n/2-1)])

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(map(int,input().split()))

changed=sorted(s,reverse=True)


    if changed[int(n/2-1)]==changed[int(n/2)]:
        print(0)
    else:
        print(-changed[int(n/2)]+changed[int(n/2-1)])



Fixed submission:
n=int(input())
s=list(map(int,input().split()))

changed=sorted(s,reverse=True)


if changed[int(n/2-1)]==changed[int(n/2)]:
        print(0)
else:
        print(-changed[int(n/2)]+changed[int(n/2-1)])
Buggy python submission (verdict: Runtime Error):
#a以上b以下の整数のうちcでもdでも割り切れないものの個数を求めてください
#1以上b以下の整数の条件を満たすものから1以上a-1以下のもので条件を満たすものを取り除くようにすればいい
import fractions
x=c*d//fractions.gcd(c,d)
a,b,c,d=map(int,input().split())
n=b-((b//c)+(b//d)-b//(x))
m=(a-1)-((a-1)//c+(a-1)//d-(a-1)//(x))
print(n-m)

Fixed submission:
#a以上b以下の整数のうちcでもdでも割り切れないものの個数を求めてください
#1以上b以下の整数の条件を満たすものから1以上a-1以下のもので条件を満たすものを取り除くようにすればいい
import fractions

a,b,c,d=map(int,input().split())
x=c*d//fractions.gcd(c,d)
n=b-((b//c)+(b//d)-b//(x))
m=(a-1)-((a-1)//c+(a-1)//d-(a-1)//(x))
print(n-m)

Buggy python submission (verdict: Runtime Error):
#a以上b以下の整数のうちcでもdでも割り切れないものの個数を求めてください
#1以上b以下の整数の条件を満たすものから1以上a-1以下のもので条件を満たすものを取り除くようにすればいい
import math
x=c*d//math.gcd(c,d)
a,b,c,d=map(int,input().split())
n=b-((b//c)+(b//d)-b//(x))
m=(a-1)-((a-1)//c+(a-1)//d-(a-1)//(x))
print(n-m)

Fixed submission:
#a以上b以下の整数のうちcでもdでも割り切れないものの個数を求めてください
#1以上b以下の整数の条件を満たすものから1以上a-1以下のもので条件を満たすものを取り除くようにすればいい
import fractions

a,b,c,d=map(int,input().split())
x=c*d//fractions.gcd(c,d)
n=b-((b//c)+(b//d)-b//(x))
m=(a-1)-((a-1)//c+(a-1)//d-(a-1)//(x))
print(n-m)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d=map(int,input().split())
num=0
for i in range(a,b+1):
    if i%c==0:
        continue
    if i%d==0:
        continue
    else:
        num+=1
print(num)

Fixed submission:
#a以上b以下の整数のうちcでもdでも割り切れないものの個数を求めてください
#1以上b以下の整数の条件を満たすものから1以上a-1以下のもので条件を満たすものを取り除くようにすればいい
import fractions

a,b,c,d=map(int,input().split())
x=c*d//fractions.gcd(c,d)
n=b-((b//c)+(b//d)-b//(x))
m=(a-1)-((a-1)//c+(a-1)//d-(a-1)//(x))
print(n-m)

Buggy python submission (verdict: Time Limit Exceeded):
#整数　a b c d が与えられる。この時a 以上b 以下の整数のうちで、ｃでもdでも割り切れないものの個数を求めてください。
a,b,c,d=map(int,input().split())
num=0
for i in range(a,b+1):
    if i%c==0 or i%d==0:
        num+=0
    else:
        num+=1
print(num)

Fixed submission:
#a以上b以下の整数のうちcでもdでも割り切れないものの個数を求めてください
#1以上b以下の整数の条件を満たすものから1以上a-1以下のもので条件を満たすものを取り除くようにすればいい
import fractions

a,b,c,d=map(int,input().split())
x=c*d//fractions.gcd(c,d)
n=b-((b//c)+(b//d)-b//(x))
m=(a-1)-((a-1)//c+(a-1)//d-(a-1)//(x))
print(n-m)
Buggy python submission (verdict: Time Limit Exceeded):
#common subsequence
n,m=map(int,input().split())
mod=10**9+7
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dp=[[0 for i in range(m+1)] for j in range(n+1)]
#dp[i][j]=aのi番目、bのj番目まででの個数
#求めたいのはdp[n][m]
for i in range(m+1):
    dp[0][i]=1
for i in range(n+1):
    dp[i][0]=1
dp[0][0]=1
for i in range(1,n+1):
    for j in range(1,m+1):
        if a[i-1]==b[j-1]:
            dp[i][j]=(dp[i][j-1]+dp[i-1][j])%mod
        else:
            dp[i][j]=(dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1])%mod
print(dp[n][m])

Fixed submission:
#common subsequence
n,m=map(int,input().split())
mod=10**9+7
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dp=[[0 for i in range(m+1)] for j in range(n+1)]
#dp[i][j]=aのi番目、bのj番目まででの個数
#求めたいのはdp[n][m]
for i in range(m+1):
    dp[0][i]=1
for i in range(n+1):
    dp[i][0]=1
dp[0][0]=1
for i in range(1,n+1):
    for j in range(1,m+1):
        if a[i-1]==b[j-1]:
            dp[i][j]=(dp[i][j-1]+dp[i-1][j])%mod
        else:
            dp[i][j]=(dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1])%mod
print(dp[n][m])
Buggy python submission (verdict: Runtime Error):
n=int(input())
lists=[]
for i in range(n):
    a,b=map(int,input().split())
    lists.append([a,b])
diflist=[]
for i in range(n):
    for j in range(n):
        if i!=j:
            add=(lists[i][0]-lists[j][0],lists[i][1]-lists[j][1])
            diflist.append(add)
        else:
            continue
import collections
dic=collections.Counter(diflist)
value=dic.values()
a=max(value)
print(n-a)

Fixed submission:
n=int(input())
lists=[]
if n>=2:
    for i in range(n):
        a,b=map(int,input().split())
        lists.append([a,b])
    diflist=[]
    for i in range(n):
        for j in range(n):
            if i!=j:
                add=(lists[i][0]-lists[j][0],lists[i][1]-lists[j][1])
                diflist.append(add)
            else:
                continue
    import collections
    dic=collections.Counter(diflist)
    value=dic.values()
    a=max(value)
    print(n-a)
else:
    print(1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lists=[]
for i in range(n):
    a,b=map(int,input().split())
    lists.append([a,b])
diflist=[]
for i in range(n):
    for j in range(n):
        if i!=j:
            add=(lists[i][0]-lists[j][0],lists[i][1]-lists[j][1])
            diflist.append(add)
        else:
            continue
            
length=0
for some in diflist:
    cnt=0
    for i in range(n):
        for j in range(n):
            if i!=j:
                check=[lists[i][0]-lists[j][0],lists[i][1]-lists[j][1]]
                if check==[some[0],some[1]]:
                    cnt+=1
            else:
                continue

    length=max(length,cnt)
print(n-length)

Fixed submission:
n=int(input())
lists=[]
if n>=2:
    for i in range(n):
        a,b=map(int,input().split())
        lists.append([a,b])
    diflist=[]
    for i in range(n):
        for j in range(n):
            if i!=j:
                add=(lists[i][0]-lists[j][0],lists[i][1]-lists[j][1])
                diflist.append(add)
            else:
                continue
    import collections
    dic=collections.Counter(diflist)
    value=dic.values()
    a=max(value)
    print(n-a)
else:
    print(1)