func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX_N = 300000;   const int MAX_E2 = 1 << 20;   const long double PI = acosl(-1.0);   struct Elm {     long double x, y, th;     Elm() : x(0.0), y(0.0), th(0.0) {}     Elm(long double _x, long double _y, long double _th)         : x(_x), y(_y), th(_th) {}     Elm &extend(int l) {       x += l * cosl(th), y += l * sinl(th);       return *this;     }     Elm &rot(long double dth) {       long double c = cosl(dth), s = sinl(dth);       long double x0 = c * x - s * y;       long double y0 = s * x + c * y;       x = x0, y = y0;       th += dth;       return *this;     }     Elm operator+(const Elm &e) const {       long double c = cosl(th), s = sinl(th);       long double x0 = c * e.x - s * e.y;       long double y0 = s * e.x + c * e.y;       return Elm(x + x0, y + y0, th + e.th);     }   };   template <typename T, const int MAX_E2>   struct SegTree {     int e2;     T nodes[MAX_E2], defv;     SegTree() {}     void init(int n, T _defv) {       defv = _defv;       for (e2 = 1; e2 < n; e2 <<= 1)         ;       fill(nodes, nodes + MAX_E2, defv);     }     T &get(int i) { return nodes[e2 - 1 + i]; }     void seti(int i, T v) { get(i) = v; }     void setall() {       for (int j = e2 - 2; j >= 0; j--)         nodes[j] = nodes[j * 2 + 1] + nodes[j * 2 + 2];     }     void set(int i, T v) {       int j = e2 - 1 + i;       nodes[j] = v;       while (j > 0) {         j = (j - 1) / 2;         nodes[j] = nodes[j * 2 + 1] + nodes[j * 2 + 2];       }     }   };   SegTree<Elm, MAX_E2> st;   int main() {     int n, m;     scanf( %d%d , &n, &m);     st.init(n, Elm(0.0, 0.0, 0.0));     for (int i = 0; i < n; i++) st.seti(i, Elm(1.0, 0.0, 0.0));     st.setall();     for (int i = 0; i < m; i++) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       y--;       Elm e = st.get(y);       if (x == 1)         e.extend(z);       else         e.rot(-PI * z / 180);       st.set(y, e);       Elm r = st.nodes[0];       printf( %.10Lf %.10Lf n , r.x, r.y);     }     return 0;   }   