func_code_string: #include <bits/stdc++.h>   using namespace std;   struct ball {     float coord;     int mass;     float vel;     short num;   };   bool sort_num(ball a, ball b) { return a.num < b.num; }   bool sort_coord(ball a, ball b) { return a.coord < b.coord; }   void collide(ball &a, ball &b) {     float temp = a.vel;     a.vel = ((a.mass - b.mass) * a.vel + 2 * b.vel * b.mass) / (b.mass + a.mass);     b.vel = ((b.mass - a.mass) * b.vel + 2 * temp * a.mass) / (b.mass + a.mass);   }   void iter(vector<ball> &balls, int size, float &cur_time, int time) {     float col_t = 9999.9;     int col_c = -1;     float temp;     for (int i = 0; i < size - 1; i++) {       temp = (balls[i + 1].coord - balls[i].coord) /              (balls[i].vel - balls[i + 1].vel);       if (temp > 0.0000001 && temp < col_t) {         col_t = temp;         col_c = i;       }     }     if (cur_time + col_t > time || col_c == -1) {       col_t = time - cur_time;       for (int i = 0; i < size; i++) balls[i].coord += balls[i].vel * col_t;       cur_time += col_t;       return;     }     for (int i = 0; i < size; i++) {       balls[i].coord += balls[i].vel * col_t;     }     for (int i = 0; i < size - 1; i++) {       if (fabs(balls[i].coord - balls[i + 1].coord) < 0.0000001) {         collide(balls[i], balls[i + 1]);         i++;       }     }     cur_time += col_t;   }   int main() {     int n, t;     float cur_t = 0.0;     cin >> n >> t;     vector<ball> balls(n);     for (int i = 0; i < n; i++) {       cin >> balls[i].coord >> balls[i].vel >> balls[i].mass;       balls[i].num = i;     }     sort(balls.begin(), balls.end(), sort_coord);     while (cur_t < t) {       iter(balls, n, cur_t, t);     }     sort(balls.begin(), balls.end(), sort_num);     for (int i = 0; i < n; i++) cout << balls[i].coord << endl;     return 0;   }   