In the lagrangian, adding total time derivative doesn't change equation of motion. $$L' = L + \frac{d}{dt}f(q,t).$$
After playing with it, I realize that this is only true if the $f(q,t)$ function has "continuous second partial derivatives". If it doesn't have, then the proof that equations are motion are the same for $L'$ and $L$ fail. The reason why proof would fail will take me a long time to explain, but if necessary, let me know and will try to update this.
Though, I have not seen anywhere such a restriction about $f(q,t)$. Shouldn't we be careful not to take $f(q,t)$ which doesn't have "continuous second partial derivatives"? In that case, it doesn't seem general to assume for any $f(q,t)$, it would yield the same EOM.
Update
Let me show why proof would fail.
$F$ is a function of $q(t), t$.
Since $L' = L + \frac{d}{dt}f(q,t)$, since we hear that it yields the same EOM, then let's see if it does.
$\frac{d}{dt}\frac{\partial L'}{\partial \dot q} - \frac{\partial L'}{\partial q} = 0$
$\frac{d}{dt}\frac{\partial}{\partial \dot q} (L + \frac{df}{dt}) - \frac{\partial}{\partial q}(L + \frac{df}{dt}) = 0$
$\frac{d}{dt}\frac{\partial L}{\partial \dot q} + \frac{d}{dt}\frac{\partial }{\partial \dot q} \frac{df}{dt} - \frac{\partial L}{\partial q} - \frac{\partial }{\partial q}\frac{df}{dt} = 0$
$\frac{d}{dt}\frac{\partial L}{\partial \dot q} - \frac{\partial L}{\partial q} + \frac{d}{dt}\frac{\partial }{\partial \dot q} \frac{df}{dt} - \frac{\partial }{\partial q}\frac{df}{dt} = 0$
If people say that $L'$ and $L$ yield the same EOM, then first 2 members are equal to 0 which means that we have to show that:
$\frac{d}{dt}\frac{\partial }{\partial \dot q} \frac{df}{dt} - \frac{\partial }{\partial q}\frac{df}{dt} = 0$
$\frac{d}{dt}\frac{\partial }{\partial \dot q} \frac{df}{dt} = \frac{\partial }{\partial q}\frac{df}{dt}\tag{1}$
We can figure out what $\frac{df}{dt}$ is. since it's a function of $q,t$, we get: $\frac{df}{dt} = \frac{\partial f}{\partial q} \dot q + \frac{\partial f}{\partial t}$. Plugging this in (1), we get:
$\frac{d}{dt}\frac{\partial }{\partial \dot q} (\frac{\partial f}{\partial q} \dot q + \frac{\partial f}{\partial t}) = \frac{\partial }{\partial q}(\frac{\partial f}{\partial q} \dot q + \frac{\partial f}{\partial t})$
$\frac{d}{dt}(\frac{\partial }{\partial \dot q} (\frac{\partial f}{\partial q}\dot q)) = \frac{\partial }{\partial q}(\frac{\partial f}{\partial q} \dot q + \frac{\partial f}{\partial t})$
$\frac{d}{dt}(\frac{\partial f}{\partial q}) = \frac{\partial }{\partial q}(\frac{\partial f}{\partial q}) \dot q + \frac{\partial }{\partial q}\frac{\partial f}{\partial t}$
Left side is total time derivative, so we can do the following:
$\frac{\partial }{\partial q} \frac{\partial f}{\partial q} \dot q + \frac{\partial }{\partial t}\frac{\partial f}{\partial q} = \frac{\partial }{\partial q}(\frac{\partial f}{\partial q}) \dot q + \frac{\partial }{\partial q}\frac{\partial f}{\partial t}$
One can see the first member of left side and first member of right side cancel, so we're left with:
$\frac{\partial }{\partial t}\frac{\partial f}{\partial q} = \frac{\partial }{\partial q}\frac{\partial f}{\partial t}$
So this must be equal otherwise, it fails. Then we know that the final equation is a mixed partial differential - Check here So you see $f$'s all the second partial derivatives must exist and must be continuous)