It was nice of Tom _______me these flowers
a) to buy
b) buy
c) buying
"To buy" is correct.
"It was nice of Tom to buy me the flowers."