Optimized Student Grouping for Enhanced Classroom Performance