I am going to change the notation in order to make the equations more compact. The counter weight is $M$ and the payload is $m$. The length of the bar is $L$ and the distance of the center of gravity to the counterweight is $a=\frac{m}{M+m}\,L$ and from the payload $b=\frac{M}{M+m}\,L$ such that $L=a+b$. Note I have said nothing about the pivot yet.
The distance between the pivot and the center of gravity is $c$ and it is an independent variable we wish to optimize. The pivot is between the center of gravity and the payload (for positive $c$). The angle of the bar is $\theta$ with $\theta=0$ when horizontal.
The height of the pivot from the ground is $h$ such that when the counterweight hits the ground the payload is launched at $\theta_{f} = -45^\circ$. So $h=(a+c) \sin(- \theta_f$). As a consequence the initial angle is $\sin \theta_i = \frac{a+c}{b-c} \sin(- \theta_f )$ in order for the payload to rest in the ground initially. This is valid for $c<\frac{b-a}{2}$, otherwise the things sits vertically with $\theta_i=\frac{\pi}{2}$.
Doing the dynamics using Newtons's Laws, or Langrange's equations will yield the following acceleration formula
$$ \ddot{\theta} = -\,\frac{c g (M+m) \cos(\theta)}{\frac{m M}{M+m} L^2 + (M+m) c^2} $$
The denominator being the moment of inertia about the pivot. Here is the fun stuff. The above can be integrated since the right hand side is a function of $\theta$ only with a constant $\alpha$:
$$ \ddot{\theta}=\frac{{\rm d}\dot\theta}{{\rm d}t} =-\alpha \cos(\theta) $$ $$ \frac{{\rm d}\dot\theta}{{\rm d}\theta} \frac{{\rm d}\theta}{{\rm d}t} = -\alpha \cos(\theta) $$ $$ \frac{{\rm d}\dot\theta}{{\rm d}\theta} \dot\theta = -\alpha \cos(\theta) $$ $$ \int \dot\theta {\rm d}\dot\theta =-\int \alpha \cos(\theta) {\rm d}\theta + K$$ $$ \frac{{\dot \theta}^2}{2} = -\alpha \sin \theta + K $$
with $K$ based on the initial conditions ($\theta=\theta_i$, $\dot\theta=0$)
$$ \dot\theta = \sqrt{2 \alpha (\sin(\theta_i)-\sin(\theta))}$$
and final rotational velocity
$$ \dot\theta_f = \sqrt{2 \alpha (\sin(\theta_i)-\sin(\theta_f))}$$
tangentially the payload launch velocity is
$$ v_{B_f} = (b-c) \dot\theta_f = (b-c) \sqrt{2 \alpha (\sin(\theta_i)-\sin(\theta_f))} $$
with both $\alpha$ and $\theta_i$ depending on the variable $c$.
To optimize we set $ \frac{{\rm d}v_{B_f}}{{\rm d}c}=0 $ which is solved for:
$$ \frac{c}{L} = \frac{\sqrt{m} \left( \sqrt{M+m}-\sqrt{m} \right)}{M+m } $$
For example, a $m=20 {\rm lbs}$ payload, with a $M=400 {\rm lbs}$ counter weight on a $L=20 {\rm ft}$ bar, requires the pivot to be $c=20\;\frac{\sqrt{20} \left( \sqrt{420}-\sqrt{20} \right)}{420 } = 3.412\;{\rm ft} $ from the center of gravity. The c.g. is $a=\frac{20}{420}\,20 = 0.952 {\rm ft}$ from the counterweight.
Edit 1
Based on comments made by the OP the launch velocity is $$ v_{B_{f}}=\left(\frac{M}{M+m}L-c\right)\sqrt{\frac{2cg(M+m)}{\frac{M}{M+m}L^{2}+(M+m)c^{2}}\left(\sin\theta_{i}-\sin\theta_{f}\right)} $$ where $g=9.80665\,{\rm m/s}$ is gravity.
With infinite counterweight the maximum launch velocity is $\max(v_{B_{f}})=\sqrt{\frac{2g(L-c)^{2}}{c}}$ so to reach $v_{B_{f}}=6000\,{\rm m/s}$ from earth if $c=1\,{\rm m}$ then $L>1355.8\,{\rm m}$.
With infinite bar length the maximum launch velocity is $\max(v_{B_{f}})=\sqrt{\frac{2Mcg}{m}}$ so to reach $v_{B_{f}}=6000\,{\rm m/s}$ from earth if $c=1\,{\rm m}$ then $M>18.3\,10^{6}\,{\rm kg}$.
So lets consider $L=2000\,{\rm m}$ and $M=40.0\,10^{6}\,{\rm kg}$ then we choose pivot location at $c=1.500\,{\rm m}$ to get $$ v_{B_{f}}=(1999.999-1.5)\sqrt{2\;4.526\left(\sin\theta_{i}-\sin\theta_{f}\right)} $$ which is solved for $v_{B_{f}}=6000\,{\rm m/s}$ when $\sin\theta_{i}-\sin\theta_{f}=0.9957$ with $\theta_{i}>0$ and $\theta_{f}<0$.