For that type of problem: ie. it's more finding the algorithm than the code itself that matters, the solution will probably be less than 1000 lines of code and there's only one person working on it, I think it's hard to beat Python. Worrying about static typing let alone memory management will probably only slow you down and maybe even interfere with the thought processes needed to find the right algorithm.
I say that despite actually not liking Python very much and this advice is the exact opposite of what I would give someone looking for a language to use on a large code base that needs to be maintained over time by multiple developers.