Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, m, q = map(int, input().split(" "))

k = []
for _ in range(q):
    k.append(list(map(int, input().split(" "))))

max_score = 0
import itertools
for a in itertools.combinations_with_replacement(range(1, m+1), m):
    score = 0
    for i in range(q):
        if a[k[i][1]-1] - a[k[i][0]-1] == k[i][2]:
            score += k[i][3]
    if score > max_score:
        max_score = score
print(max_score)

Fixed submission:
n, m, q = map(int, input().split(" "))

k = []
for _ in range(q):
    k.append(list(map(int, input().split(" "))))

max_score = 0
import itertools
for a in itertools.combinations_with_replacement(range(1, m+1), n):
    score = 0
    for i in range(q):
        if a[k[i][1]-1] - a[k[i][0]-1] == k[i][2]:
            score += k[i][3]
    if score > max_score:
        max_score = score
print(max_score)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split(" "))

max_score = 0
y = b // a

for x in range(max(y - 10000000, 1) , min(y + 20000000, n+1)):
    score = a * x // b - a * ( x // b )
    if score > max_score:
        max_score = score
print(max_score)


Fixed submission:
a, b, n = map(int, input().split(" "))

max_score = 0
y = min(b, n)

for x in range(max(y - 100000, 1) , min(y + 200000, n+1)):
    score = a * x // b - a * ( x // b )
    if score > max_score:
        max_score = score
print(max_score)
Buggy python submission (verdict: Runtime Error):
s = input()

if s == "ABC":
    return "ARC"
else:
    return "ABC"

Fixed submission:
s = input()

if s == "ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
count = 0
total = 0
for i in sorted(a_i):
    total = total + i
    count = count + 1
    if count == 2:
        break
print(total)

Fixed submission:
a_i = list(map(int, input().split()))
count = 0
total = 0
for i in sorted(a_i):
    total = total + i
    count = count + 1
    if count == 2:
        break
print(total)
Buggy python submission (verdict: Runtime Error):
import sympy as sym #sympyのインポート
def Fib(n):
    x = sym.symbols('x',nonnegative=True,integer=True) #変数xの宣言(非負の整数)
    Fib=1/sym.sqrt(5)*(((1+sym.sqrt(5))/2)**(n-1)-((1-sym.sqrt(5))/2)**(n-1)) #一般項の式
    result=Fib.subs(x,n) #xにnを代入
    result=result.evalf() #式を浮動小数点数として評価
    return int(result)

n, m = map(int, input().split())
a_i = []
for i in range(m):
    a_i.append(int(input()))

before = 0
total = 1
flag = False
for a in a_i:
    if a == before:
        flag = True
        break
    x = a - 1 - before
    fib = Fib(x+2)
    total = total*fib
    before = a + 1
if flag:
    print("0")
else:
    x = n - before
    total = total*Fib(x+2)
    print(total%1000000007)

Fixed submission:
def Fib(num):
    """num番目のフィボナッチ数を返す
    """
    a, b = 1, 0
    for _ in range(num):
        a, b = a + b, a
    return b

n, m = map(int, input().split())
a_i = []
for i in range(m):
    a_i.append(int(input()))

before = 0
total = 1
flag = False
for a in a_i:
    if a == before:
        flag = True
        break
    x = a - 1 - before
    fib = Fib(x+1)
    total = total*fib
    before = a + 1
if flag:
    print("0")
else:
    x = n - before
    total = total*Fib(x+1)
    print(total%1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
nk = list(map(int,input().split()))
ls = list(map(int,input().split()))

d = dict()

for i in ls:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
       
adj = 0
key_num = len(d.keys()) 

while(1):
    if key_num <= nk[1]:
        print(adj)
        break
    min_idx = min(d.items(), key=lambda x:x[1])[0]
    min_num = min(d.items(), key=lambda x:x[1])[1]
    del d[min_idx]
    adj += min_num
    key_num -= 1

Fixed submission:
nk = list(map(int,input().split()))
ls = list(map(int,input().split()))

d = dict()

for i in ls:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
       
l = list(d.values())
l.sort(reverse = True)

num = sum(l[nk[1]:])

print(num)
Buggy python submission (verdict: Time Limit Exceeded):
n = input()

nc = n.replace("x","")

ncr = nc[::-1]

ans = -1

if ncr == nc:
    ans =0
    nl = list(n)
    i = 0
    j = 0
    while(1):
        if i >= len(nl)-(j+1):break
        while(1):
            if i > len(nl)-1 :break
            if nl[i] == "x":
                i += 1
            else:
                if nl[-(i+1)] == nl[i]:
                    i += 1
                else:
                    break
        while(1):
            if j > len(nl)-1: break
            if nl[len(nl)-(j+1)] == "x":
                j += 1
            else :
                if nl[len(nl)-(j+1)] == nl[j]:
                    j += 1
                else:
                    break
        if i > j :
            nl.insert(len(nl)-j,"x")
            ans += 1
            i = j
        if i < j :
            nl.insert(i,"x")
            j = i
            ans += 1

print(ans)

Fixed submission:
n = input()

nc = n.replace("x","")

ncr = nc[::-1]

ans = -1

if ncr == nc:
    ans = 0
    nl = list(n)
    lenn = len(n)
    i = 0
    j = 1
    ri = 0
    le = 0
    while(1):
        if i >= lenn-(j):break
        if n[i] == n[lenn-(j)]:
            i += 1
            j += 1
        else:
            if n[i] == "x":
                i +=1
            else:
                j +=1
            ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f = list(map(int,input().split()))
a *= 100
b *= 100 

def node(w,s):
    return s/w

w,s = 0,0

w += a

nodelist = []
nodelistapd = nodelist.append
nodedict = {}

enode = node(100+e, e)

while(1):
    if w >= f:break
    if node(w+d,s+d) <= enode:
        s += d
        w += d
    elif node(w+c,s+c) <= enode:
        s += c
        w += c
    else:
        nodelistapd(node(w,s))
        nodedict[node(w,s)] = (w,s)
        if node(w+b,s) not in nodelist:
            w += b
        elif node(w+a,s) not in nodelist:
            w += a
        else:
            break
        
ansnode = nodedict[max(nodelist)]
print("{} {}".format(ansnode[0],ansnode[1]))

Fixed submission:
def nodef(w,s):
    return (s/(s+w))


a,b,c,d,e,f = map(int,input().split())

best_w = 0
best_s = 0
best_node = 0

for i in range(30//a+1):
    for j in range(30//b+1):
        w = 100*(a*i + b*j)
        if w<=f and w:
            max_s = min(f-w,(a*i + b*j)*e)
            for k in range(max_s//c+1):
                l = (max_s-k*c)//d
                s = k*c + l*d
                node = nodef(w,s)
                if node >= best_node and node<=e and w+s<=f:
                    best_w = w
                    best_s = s
                    best_node = node
                    
print("{} {}".format((best_s+best_w ),best_s))
Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int,input().split()))

a.sort()

hist = [0 for x in range(-1,max(a)+3)]
As = []
ans = -1
Aspd = As.append

if len(a) ==1:
    ans = a[0]
else:
    for i in a:
        hist[i] += 1
    
    for i in range(len(hist)-1):
        Aspd(hist[i-1]+hist[i]+hist[i+1])
        

print(max(As))

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

a.sort()

hist = [0 for x in range(-1,max(a)+3)]
As = []
ans = -1
Aspd = As.append

if len(a) ==1:
    print(1)
else:
    for i in a:
        hist[i] += 1
    
    for i in range(len(hist)-1):
        Aspd(hist[i-1]+hist[i]+hist[i+1])
        

    print(max(As))
Buggy python submission (verdict: Runtime Error):
mod = 1000000007
n = int(input())

up = input()
dw = input()

arrays = 1

j = 0
justBefore = None

if up[j] == dw[j]:
    arrays *= 3
    j += 1
    justBefore = 0
else:
    arrays *= 6
    j += 2
    justBefore = 1

while(j != len(up)-1):
    if justBefore:
        if up[j] == dw[j]:
            arrays *= 1
            j += 1
            justBefore = 0
        else:
            arrays *= 4
            j += 2
            justBefore = 1
    else:
        if up[j] == dw[j]:
            arrays *= 2
            j += 1
            justBefore = 0
        else:
            arrays *= 2
            j += 2
            justBefore = 1

print(arrays%mod)

Fixed submission:
x,a,b = map(int,input().split())

if abs(a-x) < abs(b-x):
    print("A")
else:
    print("B")

Buggy python submission (verdict: Runtime Error):
mod = 1000000007
n = int(input())

up = input()
dw = input()

arrays = 1

j = 0
justBefore = None

if up[j] == dw[j]:
    arrays *= 3
    j += 1
    justBefore = 0
else:
    arrays *= 6
    j += 2
    justBefore = 1

while(j != len(up)-1):
    if justBefore:
        if up[j] == dw[j]:
            arrays *= 1
            j += 1
            justBefore = 0
        else:
            arrays *= 4
            j += 2
            justBefore = 1
    else:
        if up[j] == dw[j]:
            arrays *= 2
            j += 1
            justBefore = 0
        else:
            arrays *= 2
            j += 2
            justBefore = 1
            
print(arrays/mod)

Fixed submission:
x,a,b = map(int,input().split())

if abs(a-x) < abs(b-x):
    print("A")
else:
    print("B")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = input()
bou = list(map(int,input().split()))

bous = Counter(bou)
hen = []
ans = -1

i = 0
while(i<2):
    if len(bous) == 0:
        ans = 0
        break
    
    mkey = max(bous.keys())
    if bous[mkey] > 3:
        bous[mkey] = bous[mkey] - 2
        hen.append(mkey)
        i += 1
    elif bous[mkey] > 1:
        hen.append(mkey)
        bous.pop(mkey)
        i += 1
    else:
        bous.pop(mkey)
    
if ans:
    print(hen[0]*hen[1])
else:
    print(ans)

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

a.sort(reverse=True)

num = None
hen = []
en = 0

for i in a:
    if en == 2:break
    if num == i:
        hen.append(num)
        num = None
        en += 1
    else:
        num = i
        
if en == 2:
    print(hen[0]*hen[1])
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
    
N = int(input())
 
a = int(input())
b = 0
for i in range(N-1):
    b = int(input())
    a = (a*b) // gcd(a,b)
    
print(a)

Fixed submission:
a = input()
b = []

for i in range(len(a)):
    b.insert(0, a[i])
    
if list(a) == b:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
    
N = int(input())
Ts = [None for i in range(N)]

a = int(input())
b = 0
for i in range(N-1):
    b = int(input())
    a = (a*b) // gcd(a,b)
    
print(a)

Fixed submission:
a = input()
b = []

for i in range(len(a)):
    b.insert(0, a[i])
    
if list(a) == b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
    
N = int(input())
Ts = [None for i in range(N)]

a = input()
b = 0
for i in range(N-1):
    b = int(input())
    a = (a*b) // gcd(a,b)
    
print(a)

Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
    
N = int(input())
 
a = int(input())
b = 0
for i in range(N-1):
    b = int(input())
    a = (a*b) // gcd(a,b)
    
print(a)
Buggy python submission (verdict: Runtime Error):
n = input()
nStr = input().split()
number = list(map(int,nStr))
 
frby = 1
twby = -1
 
for i in number:
    if i % 4 == 0:
        frby += 2
    elif i % 2 == 0:
        twby += 1
        
if int(n) == 1 and frby == 3:
    print("Yes")
elif int(n) == (twby + 1):
    print("Yes")
elif int(n) <= (frby):
    print("Yes")
elif int(n) <= (frby + twby):
    print("Yes")
else :
    print("No")


Fixed submission:
n = input().split()
print((int(n[0])-1 )* ( int(n[1])-1))
Buggy python submission (verdict: Runtime Error):
Inp = input()
Blist = Inp[1]
Blist.sort()

out = 0
for i in range(Imp[0,1]):
    out += Blist[-(i+1)]
    
print(out)

Fixed submission:
Imp = list(map(int, input().split()))
Blist = list(map(int, input().split()))
Blist.sort()

out = 0
for i in range(Imp[1]):
    out += Blist[-(i+1)]
    
print(out)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
G = N
lists = np.zeros(N)
for i in range(M):
    A, B = list(map(int, input().split()))
    if H[A-1] < H[B-1]:
        lists[A-1] = 1
    else:
        lists[B-1] = 1
for i in range(N):
    if lists[i] == 1:
        G -= 1
print(lists)
print(G)

Fixed submission:
S = input("")
if S =="ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
for a in range(10**9):
    B = a**5 - X
    b = B**-5
    if b % 1 == 0:
        print(str(int(a))+" "+str(int(b)))
        break

Fixed submission:
#D
X = int(input())
for a in range(-200, 200):
    for b in range(-200, 200):
        if a**5 - b**5 == X:
            print(str(a)+" "+str(b))
            break
    if a**5 - b**5 == X:
        break
Buggy python submission (verdict: Time Limit Exceeded):
#E
import numpy as np
N = int(input())
A = list(map(int, input().split()))
x = 0
listi = []
listj = []
for i in range(N):
    listi.append(i + A[i])  
for j in range(N):
    listj.append(j - A[j])
for i in range(N):
    for j in range(N):
        if i < j and listi[i] == listj[j]:
            x += 1
print(x)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
d = {}
x = 0

for i, a in enumerate(A):
    if i+a not in d:
        d[i+a] = 1
    else:
        d[i+a] += 1
    if i-a in d:
        x += d[i-a] 

print(x)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = list(map(int, input().split()))
x = 0
for i in range(N):
    for j in range(N):
        if i < j:
            if j - i  == A[i] + A[j]:
                x += 1
print(x)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
d = {}
x = 0

for i, a in enumerate(A):
    if i+a not in d:
        d[i+a] = 1
    else:
        d[i+a] += 1
    if i-a in d:
        x += d[i-a] 

print(x)

Buggy python submission (verdict: Time Limit Exceeded):
#D
import numpy as np
N = int(input())
A = list(map(int, input().split()))
x = 0
for i in range(N):
    for j in range(N):
        if i < j:
            if np.abs(i-j) == A[i] + A[j]:
                x += 1
print(x)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
d = {}
x = 0

for i, a in enumerate(A):
    if i+a not in d:
        d[i+a] = 1
    else:
        d[i+a] += 1
    if i-a in d:
        x += d[i-a] 

print(x)
Buggy python submission (verdict: Time Limit Exceeded):
#C
import itertools
import numpy as np
n, m, q = list(map(int, input().split()))
a = np.zeros(q)
b = np.zeros(q)
c = np.zeros(q)
d = np.zeros(q)
ans = 0
for i in range(q):
    a[i], b[i], c[i], d[i] = list(map(int, input().split()))
for A in itertools.combinations_with_replacement(range(1,m+1),n):
    new_ans = 0
    for i in range(q):
        if A[int(b[i])-1] - A[int(a[i])-1] == c[i]:
            new_ans += d[i]
    ans = max(ans, new_ans)
print(int(ans))

Fixed submission:
#C
import itertools
n, m, q = list(map(int, input().split()))
a = [0]*q
b = [0]*q
c = [0]*q
d = [0]*q
ans = 0
for i in range(q):
    a[i], b[i], c[i], d[i] = list(map(int, input().split()))
for A in itertools.combinations_with_replacement(range(1,m+1),n):
    new_ans = 0
    for i in range(q):
        if A[b[i]-1] - A[a[i]-1] == c[i]:
            new_ans += d[i]
    ans = max(ans, new_ans)
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = list(map(int, input().split()))
ans_list = []
for x in range(n+1):
    new_ans = int(a*x/b) - int(x/b) * a
    ans_list.append(new_ans)
print(max(ans_list))

Fixed submission:
a, b, n = list(map(int, input().split()))
ans = min(b-1, n)
print(int(a*ans/b)-a*int(ans/b))

Buggy python submission (verdict: Time Limit Exceeded):
#D
a, b, n = list(map(int, input().split()))
ans = 0
for x in range(n+1):
    new_ans = int(a*x/b) - int(x/b) * a
    ans = max(ans, new_ans)
print(ans)

Fixed submission:
a, b, n = list(map(int, input().split()))
ans = min(b-1, n)
print(int(a*ans/b)-a*int(ans/b))
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
Q=[input().split() for i in range(q)]

flg=1
for i in range(q):
    if Q[i][0]=="1":flg*=-1
    if Q[i][0]=="2":
        if Q[i][1]=="1" and flg==1: s=Q[i][2]+s
        if Q[i][1]=="2" and flg==-1:s=Q[i][2]+s
        if Q[i][1]=="1" and flg==-1:s=s+Q[i][2]
        if Q[i][1]=="2" and flg==1:s=s+Q[i][2]
if flg==-1:s=s[::-1]
print(s)

Fixed submission:
s=input()
s1=""
s2=""
q=int(input())
Q=[input().split() for i in range(q)]

flg=1
for i in range(q):
    if Q[i][0]=="1":flg*=-1
    if Q[i][0]=="2":
        if Q[i][1]=="1" and flg==1: s1=Q[i][2]+s1
        if Q[i][1]=="2" and flg==-1:s1=Q[i][2]+s1
        if Q[i][1]=="1" and flg==-1:s2=s2+Q[i][2]
        if Q[i][1]=="2" and flg==1:s2=s2+Q[i][2]
s=s1+s+s2
if flg==-1:s=s[::-1]
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
Q=[input().split() for i in range(q)]

flg=1
for i in range(q):
    if Q[i][0]=="1":flg*=-1
    if Q[i][0]=="2":
        if Q[i][1]=="1" and flg==1: s=Q[i][2]+s
        if Q[i][1]=="2" and flg==-1:s=Q[i][2]+s
        if Q[i][1]=="1" and flg==-1:s=s+Q[i][2]
        if Q[i][1]=="2" and flg==1:s=s+Q[i][2]
if flg==-1:s=s[::-1]
print(s)

Fixed submission:
s=input()
s1=""
s2=""
q=int(input())
Q=[input().split() for i in range(q)]

flg=1
for i in range(q):
    if Q[i][0]=="1":flg*=-1
    if Q[i][0]=="2":
        if Q[i][1]=="1" and flg==1: s1=Q[i][2]+s1
        if Q[i][1]=="2" and flg==-1:s1=Q[i][2]+s1
        if Q[i][1]=="1" and flg==-1:s2=s2+Q[i][2]
        if Q[i][1]=="2" and flg==1:s2=s2+Q[i][2]
s=s1+s+s2
if flg==-1:s=s[::-1]
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b=map(int,input().split())
mod=10**9+7

def pow2(n,base):
    if n==1:return base
    if n%2==0:return pow2(n//2,base)**2%mod
    else:return base*pow2(n//2,base)**2%mod

def fac(n,a):
    ans=1
    for i in range(n,n-a,-1):
        ans*=i
        ans%=mod
    return ans

def inv_fac(n):
    ans=1
    for i in range(1,n+1):
        ans*=pow2(mod-2,i)
        ans%=mod
    return ans



ans=pow2(n,2)-fac(n,a)*inv_fac(a)-fac(n,b)*inv_fac(b)
print(ans%mod-1)

Fixed submission:
n,a,b=map(int,input().split())
mod=10**9+7


def fac(n,a):
    ans=1
    for i in range(n,n-a,-1):
        ans*=i
        ans%=mod
    return ans%mod

def inv_fac(n):
    ans=pow(fac(n,n-1),mod-2,mod)
    return ans%mod



ans=pow(2,n,mod)-fac(n,a)*inv_fac(a)-fac(n,b)*inv_fac(b)
print(ans%mod-1)

Buggy python submission (verdict: Time Limit Exceeded):
k,a,b=map(int,input().split())
n=k
z=10**9+7
q=1
x=2
while n>1:
    if n%2!=0:
        q*=x%z
    x*=x%z
    n//=2
ans=q*x%z

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])%z

    return result%z
ans = ans - cmb(k,a)  - cmb(k,b)
print(ans%z-1)

Fixed submission:
n,a,b=map(int,input().split())
mod=10**9+7


def fac(n,a):
    ans=1
    for i in range(n,n-a,-1):
        ans*=i
        ans%=mod
    return ans%mod

def inv_fac(n):
    ans=pow(fac(n,n-1),mod-2,mod)
    return ans%mod



ans=pow(2,n,mod)-fac(n,a)*inv_fac(a)-fac(n,b)*inv_fac(b)
print(ans%mod-1)
Buggy python submission (verdict: Runtime Error):
n=input()
a=list(map(int,input().split()))
print("YES" if len(set(a))==len(a) else "NO"

Fixed submission:
n=input()
a=list(map(int,input().split()))
print("YES" if len(set(a))==len(a) else "NO")

Buggy python submission (verdict: Runtime Error):
n=input()
a=list(map(int,input().split()))
print("YES" if len(set(a))==len(a) else "NO"

Fixed submission:
n=input()
a=list(map(int,input().split()))
print("YES" if len(set(a))==len(a) else "NO")
Buggy python submission (verdict: Time Limit Exceeded):
import math

h,n=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
    a[i],b[i]=list(map(int,input().split()))


dp=[[b[0]] * (h+2) for i in range(n+2)]
for j in range(h+2):
    dp[0][j]=math.ceil(j/a[0])*b[0]
for i in range(n):
    for j in range(h+1):
        if j<a[i]: dp[i+1][j]=min(dp[i][j],b[i])
        else:dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i]]+b[i])
print(dp[n][h])

Fixed submission:
import math
 
h,n=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
    a[i],b[i]=list(map(int,input().split()))
 
 
dp=[[b[0]] * (h+1) for i in range(n+1)]
for j in range(h+1):
    dp[0][j]=math.ceil(j/a[0])*b[0]
for i in range(n):
    for j in range(h+1):
        if j<a[i]: dp[i+1][j]=min(dp[i][j],b[i])
        else:dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i]]+b[i])
print(dp[n][h])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0

for i in range(n):
    if a[i]==min(a[0:i+1]) :
        
        ans+=1
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
mini=a[0]
for i in range(n):
    if mini>=a[i]:ans+=1
    mini=min(a[i],mini)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=[0]*n
l=[0]*n
for i in range(n):
    x[i],l[i]=list(map(int,input().split()))

a=[0]*n
b=[0]*n


for i in range(n):
    a[i],b[i]=x[i]-l[i],x[i]+l[i]
    
cnt=0    
while(b):
    bm=min(b)
    
    a.pop(b.index(min(b)))
    b.pop(b.index(min(b)))
    cnt+=1
    while(b and a[b.index(min(b))]<bm):
        a.pop(b.index(min(b)))
        b.pop(b.index(min(b)))


print(cnt)

Fixed submission:
n=int(input())
x=[0]*n
l=[0]*n
for i in range(n):
    x[i],l[i]=list(map(int,input().split()))

a=[0]*n
b=[0]*n


for i in range(n):
    a[i],b[i]=x[i]-l[i],x[i]+l[i]


c=[[0]*2  for i in range(n)]


for j in range(n):
    c[j][0]=b[j]
    c[j][1]=a[j]


c.sort()


ans=0
z=c[0][1]
for i in range(n):
    if c[i][1]>=z:
        ans+=1
        z=c[i][0]

print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
x=[0]*n
l=[0]*n
for i in range(n):
    x[i],l[i]=list(map(int,input().split()))

a=[0]*n
b=[0]*n

for i in range(n):
    a[i],b[i]=x[i]-l[i],x[i]+l[i]
    
cnt=0    
while(b):
    bm=min(b)
    a.pop(b.index(min(b)))
    b.pop(b.index(min(b)))
    cnt+=1
    for j in range(len(a)):
        if a[j]<bm:
            a.pop(j)
            b.pop(j)

print(cnt)

Fixed submission:
n=int(input())
x=[0]*n
l=[0]*n
for i in range(n):
    x[i],l[i]=list(map(int,input().split()))

a=[0]*n
b=[0]*n


for i in range(n):
    a[i],b[i]=x[i]-l[i],x[i]+l[i]


c=[[0]*2  for i in range(n)]


for j in range(n):
    c[j][0]=b[j]
    c[j][1]=a[j]


c.sort()


ans=0
z=c[0][1]
for i in range(n):
    if c[i][1]>=z:
        ans+=1
        z=c[i][0]

print(ans)
Buggy python submission (verdict: Runtime Error):
print(int(input())+int(input())//2)

Fixed submission:
x,y=map(int,input().split())
print(x+y//2)
Buggy python submission (verdict: Runtime Error):
n = int( input())
a = sorted(  list(map(int, input().split())) , reverse)
print((sum(a[::2])-sum(a[1::2]))

Fixed submission:
input()
card=sorted(map(int,input().split()))[::-1]
print(sum(card[::2])-sum(card[1::2]))
Buggy python submission (verdict: Runtime Error):
print("Yes" if print(sorted(input())) < print(sorted(input())[::-1]) else "No")


Fixed submission:
print("Yes" if sorted(input()) < sorted(input())[::-1] else "No")
Buggy python submission (verdict: Runtime Error):
a,b=2,1
for i in range(n):
    a,b=b,a+b
print(a)

Fixed submission:
n=int(input())
a,b=2,1
for i in range(n):
    a,b=b,a+b
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=set()
for i in range(N):
    s=s^{input()}
print(len(s))

Fixed submission:
N=int(input())
s=[input() for _ in range(N)]
s.sort()

ans=1
k=1
for i in range(N-1):
    if s[i]==s[i+1]:
        k=k*(-1)
    else:k=1
    ans+=k
        
print(ans)