Past and Present Habits

The confusion is the use of a verb in gerund after «to» for the second case. Don’t forget the structure:
Used to + a verb in its base form : WE USED TO STUDY TOGETHER (not any more).
am/is/are + used to + a verb in gerund: WE ARE USED TO STUDYING TOGETHER ( a permanent and continuous event)