Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
x,y=map(int,input().split())
cnt=0
dp=[[0 for i in range(x+1)]for i in range(2)]
a=10**9+7
if x>1:
    dp[1][2]=1
if y>1:
    dp[0][1]=1

for i in range(y+1):
    if i<3:
        continue
    for j in range(x,-1,-1):
        if i%2==0:
            if dp[1][j-2]!=0 or dp[0][j-1]!=0:
                dp[0][j]=(dp[1][j-2]+dp[0][j-1])%a
            else:
                dp[0][j]=0
                
        else:
            if dp[0][j-2]!=0 or dp[1][j-1]!=0:
                dp[1][j]=(dp[0][j-2]+dp[1][j-1])%a
            else:
                dp[1][j]=0
if y%2==0:
    print(dp[0][x])
else:
    print(dp[1][x])

Fixed submission:
def cmb(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])

    return result

x,y=map(int,input().split())
if (x+y)%3!=0 or min(x,y)<(x+y)/3:
    print(0)
    exit()
n=(x+y)//3
r=(n-abs(x-y))//2
mod=10**9+7
a = cmb(n,r)
print(a%mod)
Buggy python submission (verdict: Runtime Error):
a=int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        res=[]
        if n % i == 0:
            res.append(i)
            if i != n // i:
                res.append(n//i)
        if res!=[]:
            divisors.append(res)
    return divisors

res=make_divisors(a)
my_min=0
for i in range(len(res)):
    if i==0:
        if len(res[i])==2:
            my_min=res[i][0]+res[i][1]
        else:
            my_min=(res[i]*2)
    else:
        if len(res[i])==2:
            my_min=min(my_min,res[i][0]+res[i][1])
        else:
            my_min=min(my_min,res[i]*2)

print(my_min-2)
         



Fixed submission:
a=int(input())
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        res=[]
        if n % i == 0:
            res.append(i)
            if i != n // i:
                res.append(n//i)
        if res!=[]:
            divisors.append(res)
    return divisors
 
res=make_divisors(a)
my_min=0
for i in range(len(res)):
    if i==0:
        if len(res[i])==2:
            my_min=res[i][0]+res[i][1]
        else:
            my_min=(res[i][0]*2)
    else:
        if len(res[i])==2:
            my_min=min(my_min,res[i][0]+res[i][1])
        else:
            my_min=min(my_min,res[i][0]*2)
 
print(my_min-2)
Buggy python submission (verdict: Runtime Error):
s=input()
n=int(input())
my_bool=True
cnt=0
for i in range(1,len(s)):
    if my_bool:
        if s[i-1]==s[i]:
            cnt+=1
            my_bool=False
    else:
        my_bool=True
        continue
if my_bool:
    if not s[-1]==s[-2] and s[0]==s[-1]:
        cnt+=1
print(cnt*n)

Fixed submission:
s=input()
k=int(input())
if len(set(list(s)))==1:
    print((len(s)*k)//2)
    exit()
t=[1]
for i in range(1,len(s)):
  if s[i-1]==s[i]:
      t[-1]+=1
  else:
      t.append(1)
a=0
for i in t:
    a+=(i//2)*k
if s[0]==s[-1]:
  if t[0]%2==t[-1]%2==1:
      a+=k-1
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
    for l in range(n):
        if a[l]==i+1:
            b[i]=l+1
            break
print(*b)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
    b[i]=[a[i],i+1]
b=sorted(b, key=lambda x: x[0])
for i in range(n):
    if i!=n-1:
        print(b[i][1],end=" ")
    else:
        print(b[i][1])
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
def main():
    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a
    
    def is_prime(n):
        if n == 1:
            return True
        for i in range(2,int(n**0.5)+1):
            if n % i == 0:
                return False
        return True
    
    a,b=map(int,input().split())
    c=gcd(a,b)
    cnt=0
    for i in range(1,c+1):
        if a%i==0 and b%i==0:
            if is_prime(i):
                cnt+=1
                
            
    print(cnt)
    
    
if __name__ == "__main__":
    main()


Fixed submission:
# coding: utf-8
# Your code here!
def main():
    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a
    
    def divisor(n):
        ass = []
        for i in range(1,int(n**0.5)+1):
            if n%i == 0:
                ass.append(i)
                if i**2 == n:
                    continue
                ass.append(n//i)
        return ass
    
    def is_prime(n):
        if n == 1:
            return True
        for i in range(2,int(n**0.5)+1):
            if n % i == 0:
                return False
        return True
    
    a,b=map(int,input().split())
    c=gcd(a,b)
    cnt=0
    d=divisor(c)
    for i in d:
        if is_prime(i):
            cnt+=1
    print(cnt)
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
a=int(inout())
if a>=3200:
  print("red")
else:
  print(input())

Fixed submission:
a=int(input())
s=input()
if a<3200:
  print("red")
else:
  print(s)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)

n,q=map(int,input().split())
g=[[]for _ in range(n)]
res=[0 for _ in range(n)]
for _ in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)

for _ in range(q):
    p,x=map(int,input().split())
    res[p-1]+=x
    


def my_add(v,par):
    for vn in g[v]:
        if vn==par:
            continue
        res[vn]+=res[v]
        my_add(vn,v)

my_add(0,-1)
print(*res)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n,q=map(int,input().split())
g=[[]for _ in range(n)]
res=[0 for _ in range(n)]
for _ in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)

for _ in range(q):
    p,x=map(int,input().split())
    res[p-1]+=x
    


def my_add(v,par):
    for vn in g[v]:
        if vn==par:
            continue
        res[vn]+=res[v]
        my_add(vn,v)

my_add(0,-1)
print(*res)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)

n,q=map(int,input().split())
g=[[]for i in range(n)]
res=[0 for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

for k in range(q):
    p,x=map(int,input().split())
    res[p-1]+=x
    


def my_add(v,par):
    for vn in g[v]:
        if vn==par:
            continue
        res[vn]+=res[v]
        my_add(vn,v)

my_add(0,-1)
print(*res)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n,q=map(int,input().split())
g=[[]for _ in range(n)]
res=[0 for _ in range(n)]
for _ in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)

for _ in range(q):
    p,x=map(int,input().split())
    res[p-1]+=x
    


def my_add(v,par):
    for vn in g[v]:
        if vn==par:
            continue
        res[vn]+=res[v]
        my_add(vn,v)

my_add(0,-1)
print(*res)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
from collections import Counter
def get_counter(s):
    return Counter(s.upper().replace(' ', ''))

n=int(input())
a=[get_counter(input().rstrip('\r\n')) for i in range(n)]

def r(n):
    cnt=0
    for i in range(n):
        cnt+=i+1
    return cnt

fin=0
res=0
while len(a)>=fin:
    b=[]
    cnt=0
    i=1
    for _ in range(1,len(a)):
        if a[0]==a[i]:
            cnt+=1
            a.pop(i)
        else:
            i+=1
    a.pop(0)
    fin+=1
    res+=r(cnt)
print(res)

Fixed submission:
import sys
input=sys.stdin.readline
from collections import Counter
def get_counter(s):
    return Counter(s.upper().replace(' ', ''))

n=int(input())
#a=[get_counter(input().rstrip('\r\n')) for i in range(n)]
a=["".join(sorted(input().rstrip('\r\n'))) for i in range(n)]
def r(n):
    cnt=0
    for i in range(n):
        cnt+=i+1
    return cnt

my_dic={}
for i in a:
    if i in my_dic:
        my_dic[i]+=1
    else:
        my_dic[i]=1

res=0
for i in my_dic.values():
    res+=r(i-1)
        
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
from collections import Counter
def get_counter(s):
    return Counter(s.upper().replace(' ', ''))

n=int(input())
a=[get_counter(input().rstrip('\r\n')) for i in range(n)]

def r(n):
    cnt=0
    for i in range(n):
        cnt+=i+1
    return cnt

fin=0
res=0
while len(a)!=fin:
    b=[]
    cnt=0
    i=1
    for _ in range(1,len(a)):
        if a[0]==a[i]:
            cnt+=1
            a.pop(i)
        else:
            i+=1
    if len(a)!=0:
        a.pop(0)
        fin+=1
        res+=r(cnt)
    else:
        break
print(res)

Fixed submission:
import sys
input=sys.stdin.readline
from collections import Counter
def get_counter(s):
    return Counter(s.upper().replace(' ', ''))

n=int(input())
#a=[get_counter(input().rstrip('\r\n')) for i in range(n)]
a=["".join(sorted(input().rstrip('\r\n'))) for i in range(n)]
def r(n):
    cnt=0
    for i in range(n):
        cnt+=i+1
    return cnt

my_dic={}
for i in a:
    if i in my_dic:
        my_dic[i]+=1
    else:
        my_dic[i]=1

res=0
for i in my_dic.values():
    res+=r(i-1)
        
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
from collections import Counter
def get_counter(s):
    return Counter(s.upper().replace(' ', ''))

n=int(input())
a=[get_counter(input().rstrip('\r\n')) for i in range(n)]
cnt=0
for i in range(n):
    for j in range(i+1,n):
        if a[i]==a[j]:
            cnt+=1
print(cnt)

Fixed submission:
import sys
input=sys.stdin.readline
from collections import Counter
def get_counter(s):
    return Counter(s.upper().replace(' ', ''))

n=int(input())
#a=[get_counter(input().rstrip('\r\n')) for i in range(n)]
a=["".join(sorted(input().rstrip('\r\n'))) for i in range(n)]
def r(n):
    cnt=0
    for i in range(n):
        cnt+=i+1
    return cnt

my_dic={}
for i in a:
    if i in my_dic:
        my_dic[i]+=1
    else:
        my_dic[i]=1

res=0
for i in my_dic.values():
    res+=r(i-1)
        
print(res)
Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
j=0
cnt=0
if n==1:
    sys.exit("Yes")
for i in range(1,n):
    if 0<=a[i]-a[j]:
        j=i
    else:
        a[j]=a[j-1]
        cnt+=1
        j=i
        if cnt==2:
            break
        else:
            continue
        
if cnt<=1:
    print("Yes")
else:
    print("No")


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
v = -1
for h in H:
    if v > h:
        if v != h+1:
            print("No")
            exit()
        else:
            v = h+1
    else:
        v = h
print("Yes")

Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
j=0
cnt=0
if n<=2:
    sys.exit("Yes")
for i in range(1,n):
    if 0<=a[i]-a[j]:
        #print(i,j)
        j=i
        continue
    else:
        #print(i,j,"else")
        cnt+=1
        j=i
        if cnt==2:
            break
        else:
            continue
        
if cnt<=1:
    print("Yes")
else:
    print("No")


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
v = -1
for h in H:
    if v > h:
        if v != h+1:
            print("No")
            exit()
        else:
            v = h+1
    else:
        v = h
print("Yes")
Buggy python submission (verdict: Runtime Error):
a=input()
b=False
for i in range(3):
 if a[i+1]==a[i]:
  b=True

if b:
 print(“Bad”)
else:
 print(“Good”)

Fixed submission:
a=input()
b=False
for i in range(3):
 if a[i+1]==a[i]:
  b=True

if b:
 print("Bad")
else:
 print("Good")

Buggy python submission (verdict: Runtime Error):
a=input()
b=False
for i in range(3):
 if a[i+1]==a[i]:
  b=True

if b:
print(“Bad”)
else:
print(“Good”)

Fixed submission:
a=input()
b=False
for i in range(3):
 if a[i+1]==a[i]:
  b=True

if b:
 print("Bad")
else:
 print("Good")
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
 
def lcm(a,b):
    return a*b//gcd(a,b)
     

a,b,c,d=map(int,input().split())
e=lcm(c,d)
a_1=a%e
b_1=b%e
cnt=0
if b-a<=e:
    for i in range(a,b+1):
        if i%c!=0 and i%d!=0:
            cnt+=1
    print(cnt)
    exit()
a_2=a//e
b_2=b//e
if b_2-a_2==1:
    for i in range(a,b+1):
        if i%c!=0 and i%d!=0:
            cnt+=1
    print(cnt)
    exit()
for i in range(0,e):
    if i%c!=0 and i%d!=0:
        cnt+=1

cnt*=b_2-a_2-1

for i in range(a,(a_2+1)*e):
    if i%c!=0 and i%d!=0:
        cnt+=1
for i in range(b_2*e,b+1):
    if i%c!=0 and i%d!=0:
        cnt+=1
print(cnt)

Fixed submission:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

a,b,c,d=map(int,input().split())
a-=1
b_1=b//c
b_1+=b//d
b_1-=b//lcm(c,d)
a_1=a//c
a_1+=a//d
a_1-=a//lcm(c,d)
print((b-b_1)-(a-a_1))
Buggy python submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
m=w*h/2
if w%x==0 and h%y==0:
    print(m,1)
else:
    print(m,0)

Fixed submission:
w,h,x,y=map(int,input().split())
m=w*h/2
if x==0 or y==0:
    print(m,0)
    exit()
if x==w or y==h:
    print(m,0)
    exit()


if w%x==0 and h%y==0:
    print(m,1)
else:
    print(m,0)
Buggy python submission (verdict: Runtime Error):
n,a,b,c,d=map(int,input().split())
res=list(input())
if c<d:
    for i in range(1,n):
        if res[i-1]=="#" and res[i]=="#":
            print("No")
            exit()
    print("Yes")
    exit()

print(res[n+6])

# for i in range(b,d+1):
#     if i==1:
#         continue
#     if res[i-2]=="." and res[i-1]=="." and res[i]==".":
#         print("Yes")
#         exit()
#     if res[i-1]=="#" and res[i]=="#":
#         print("No")
#         exit()
        
# print("No")
# exit()


Fixed submission:
n,a,b,c,d=map(int,input().split())
res=list(input())
if c<d:
    for i in range(a,d+1):
        if res[i-1]=="#" and res[i]=="#":
            print("No")
            exit()
    print("Yes")
    exit()

for i in range(b,d+1):
    if i==1:
        continue
    if res[i-2]=="." and res[i-1]=="." and res[i]==".":
        print("Yes")
        exit()
    if res[i-1]=="#" and res[i]=="#":
        print("No")
        exit()
        
print("No")
exit()

Buggy python submission (verdict: Runtime Error):
n,a,b,c,d=map(int,input().split())
res=list(input())
if c<d:
    for i in range(1,n):
        if res[i-1]=="#" and res[i]=="#":
            print("No")
            exit()
    print("Yes")
    exit()

for i in range(b,d+1):
    if i==1:
        continue
    if res[i-2]=="." and res[i-1]=="." and res[i]==".":
        print("Yes")
        exit()
    if res[i-1]=="#" and res[i]=="#":
        print("No")
        exit()
        
if res[i-1]=="." and res[i]=="." and res[i+1]==".":
    print("Yes")
    exit()
print("No")
exit()


Fixed submission:
n,a,b,c,d=map(int,input().split())
res=list(input())
if c<d:
    for i in range(a,d+1):
        if res[i-1]=="#" and res[i]=="#":
            print("No")
            exit()
    print("Yes")
    exit()

for i in range(b,d+1):
    if i==1:
        continue
    if res[i-2]=="." and res[i-1]=="." and res[i]==".":
        print("Yes")
        exit()
    if res[i-1]=="#" and res[i]=="#":
        print("No")
        exit()
        
print("No")
exit()

Buggy python submission (verdict: Runtime Error):
n,a,b,c,d=map(int,input().split())
res=list(input())
if c<d:
    for i in range(1,n):
        if res[i-1]=="#" and res[i]=="#":
            print("No")
            exit()
    print("Yes")
    exit()

for i in range(b,d+1):
    if i<=n-4:
        continue
    if res[i+2]=="." and res[i+1]=="." and res[i]==".":
        print("Yes")
        exit()
print("No")
exit()


Fixed submission:
n,a,b,c,d=map(int,input().split())
res=list(input())
if c<d:
    for i in range(a,d+1):
        if res[i-1]=="#" and res[i]=="#":
            print("No")
            exit()
    print("Yes")
    exit()

for i in range(b,d+1):
    if i==1:
        continue
    if res[i-2]=="." and res[i-1]=="." and res[i]==".":
        print("Yes")
        exit()
    if res[i-1]=="#" and res[i]=="#":
        print("No")
        exit()
        
print("No")
exit()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
n,q=map(int,input().split())
s=input().replace("\n","")
for i in range(q):
    cnt=0
    l,r=map(int,input().split())
    for j in range(l,r):
        #print(s[j-1:j+1])
        if s[j-1:j+1]=="AC":
            cnt+=1
    print(cnt)

Fixed submission:
import sys
input=sys.stdin.readline
n,q=map(int,input().split())
s=input().replace("\n","")
cnt=[0 for i in range(n+1)]
for i in range(1,n+1):
    if s[i-1:i+1]=="AC":
        cnt[i]+=1
    cnt[i]+=cnt[i-1]
#print(cnt)
for i in range(q):
    a,b=map(int,input().split())
    print(cnt[b-1]-cnt[a-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
for i in range(q):
    cnt=0
    l,r=map(int,input().split())
    for j in range(l,r):
        #print(s[j-1:j+1])
        if s[j-1:j+1]=="AC":
            cnt+=1
    print(cnt)

Fixed submission:
import sys
input=sys.stdin.readline
n,q=map(int,input().split())
s=input().replace("\n","")
cnt=[0 for i in range(n+1)]
for i in range(1,n+1):
    if s[i-1:i+1]=="AC":
        cnt[i]+=1
    cnt[i]+=cnt[i-1]
#print(cnt)
for i in range(q):
    a,b=map(int,input().split())
    print(cnt[b-1]-cnt[a-1])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input.split())
print(min(b//a,c))

Fixed submission:
a,b,c=map(int,input().split())
print(min(b//a,c))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
dp=[[0 for i in range(m)]for i in range(m)]
s=[a[i]-a[i-1] if i!=0 else 0 for i in range(1,m) ]
s.sort()
if n!=1:
    print(sum(s[:-n+1]))
else:
    print(sum(s))



Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=[a[i]-a[i-1] if i!=0 else 0 for i in range(1,m) ]
s.sort()
if n!=1:
    print(sum(s[:-n+1]))
else:
    print(sum(s))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(min(a,b)*min(max(a,b),c))//2)

Fixed submission:
a,b,c=map(int,input().split())
print(min(a,b)*min(max(a,b),c)//2)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
cnt=0
#print(cnt,a)
while True:
    my_bool=True
    for i in range(n):
        if my_bool:
            if a[i]!=0:
                my_bool=False
                ch2=True
                a[i]-=1
        else:
            if a[i]!=0:
                a[i]-=1
                ch=True
                ch2=True
            else:
                if ch2:
                    cnt+=1
                ch=False
                ch2=False
    if ch:
        if my_bool:
            pass
        else:
            #print("ch",cnt,a)
            cnt+=1
    #print(cnt,a)
    if my_bool:
        break
print(cnt)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cnt=0
ch=True
#print(cnt,a)
while True:
    my_bool=True
    for i in range(n):
        if my_bool:
            if a[i]!=0:
                my_bool=False
                ch2=True
                a[i]-=1
        else:
            if a[i]!=0:
                a[i]-=1
                ch=True
                ch2=True
            else:
                if ch2:
                    cnt+=1
                ch=False
                ch2=False
    if ch:
        if my_bool:
            pass
        else:
            #print("ch",cnt,a)
            cnt+=1
    #print(cnt,a)
    if my_bool:
        break
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
res=[0 for _ in range(w+1)]
for i in range(n):
    for j in range(w,a[i][0]-1,-1):
        res[j]=max(res[j],res[j-a[i][0]]+a[i][1])
print(res[w])

Fixed submission:
import sys
input=sys.stdin.readline
n,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
res=[0 for _ in range(w+1)]
for i in range(n):
    for j in range(w,a[i][0]-1,-1):
        res[j]=max(res[j],res[j-a[i][0]]+a[i][1])
print(res[w])
Buggy python submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=[int(input()) for i in range(n)]
a.sort()
res=float("INF")
for i in range(0,n-k+1):
    b=a[i+2]-a[i]
    if res>b:
        res=b
print(res)

Fixed submission:
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=[int(input()) for i in range(n)]
a.sort()
res=float("INF")
for i in range(0,n-k+1):
    b=a[i+k-1]-a[i]
    if res>b:
        res=b
print(res)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n , m , x = map(int,input().split())
understand_list = [list(map(int,input().split()))]
for _ in range(n-1):
    understand_list.append(list(map(int,input().split())))

money_list = []
for i in range(2 ** n):
    buy_list = []
    money = 0
    for j in range(n):
        if ((i >> j) & 1):
            buy_list.append(understand_list[j])
            money += understand_list[j][0]

    if buy_list == []:
        continue
    buy_list = np.sum(buy_list, axis=0)
    if all([i >= x for i in buy_list]):
        money_list.append(buy_list[0])

if money_list == []:
    print(-1)
else:
    print(min(money_list))

Fixed submission:
import numpy as np

n , m , x = map(int,input().split())
understand_list = [list(map(int,input().split()))]
for _ in range(n-1):
    understand_list.append(list(map(int,input().split())))

money_list = []
for i in range(1,2 ** n):
    buy_list = []
    money = 0
    for j in range(n):
        if ((i >> j) & 1):
            buy_list.append(understand_list[j])
            money += understand_list[j][0]

    buy_list = np.sum(buy_list, axis=0)
    if all([i >= x for i in buy_list[1:]]):
        money_list.append(buy_list[0])

if money_list == []:
    print(-1)
else:
    print(min(money_list))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n , m , x = map(int,input().split())
understand_list = [list(map(int,input().split()))]
for _ in range(n-1):
    understand_list.append(list(map(int,input().split())))

money_list = []
for i in range(2 ** n):
    buy_list = []
    money = 0
    for j in range(n):
        if ((i >> j) & 1):

            buy_list.append(understand_list[j])
            money += understand_list[j][0]
    if buy_list == []:
        continue
    buy_list = np.sum(buy_list, axis=0)
    if all([i >= x for i in buy_list]):
        money_list.append(buy_list[0])
if money_list == []:
    print(-1)
else:
    print(min(money_list))

Fixed submission:
import numpy as np

n , m , x = map(int,input().split())
understand_list = [list(map(int,input().split()))]
for _ in range(n-1):
    understand_list.append(list(map(int,input().split())))

money_list = []
for i in range(1,2 ** n):
    buy_list = []
    money = 0
    for j in range(n):
        if ((i >> j) & 1):
            buy_list.append(understand_list[j])
            money += understand_list[j][0]

    buy_list = np.sum(buy_list, axis=0)
    if all([i >= x for i in buy_list[1:]]):
        money_list.append(buy_list[0])

if money_list == []:
    print(-1)
else:
    print(min(money_list))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
strlist = list(input())

for i in reversed(range(1,n)):
    if strlist[i] == strlist[i-1]:
        strlist.pop(i)
print(len(strlist))

Fixed submission:
n = int(input())
strlist = list(input())
count = 0
for i in reversed(range(1,n)):
    if strlist[i] == strlist[i-1]:
        count+=1
        
print(len(strlist)-count)