Answer:
I haven’t been in the exact same situation as you, but there have been many similar such situations that I have been in, and so I can empathize with you and understand your turmoil.
Perhaps this was the first time you were groped in a public space because when a similar incident happened to me for the first time, I froze too.
I was 16-17. While traveling home from classes, I was offered a seat by a young man in an over-crowded bus which I accepted. As soon as I sat down, I felt the man lean on me, and soon I felt something weird rubbing against my shoulder. I realized it was his arousal and I froze.
I did not know what to do or how to react. It took me a minute or 2 to snap out, but being a naive child who had never faced any physical harassment till that point, all I did was move a little forward.
It did not help, any direction I moved to get away from the man, he leaned in further in that direction.