alexjercan/bugnet huggingface dataset:
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <ctype.h>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
int main() {
  char str[99], *p, *np;
  while (fgets(str, 99, stdin) && !isspace(str[0])) {
    std::stack<double> s;
    for (p = str; *p; ++p) {
      if (isspace(*p))
        continue;

      double u, v = strtod(p, &np);
      if (p != np)
        s.push(v), p = np - 1;
      else {
        u = s.top(), s.pop(), v = s.top(), s.pop();
        if (*p == '+')
          s.push(v + u);
        else if (*p == '-')
          s.push(v - u);
        else if (*p == '*')
          s.push(v * u);
        else if (*p == '/')
          s.push(v / u);
      }
    }
    printf("%f\\n", s.top());
  }
  return 0;
}

// üÍ³ê½t|[hL@ðvZ¹æ
// EEEÇÌZqð·êÎ¢¢ñÅ·©ËH
// »µÄAuvÆÍÇñÈàÌðwµÄ¢éñÅ·©Ë¦

Error: -11

Fixed submission:

#include <ctype.h>
#include <stack>
#include <stdio.h>
int main() {
  char str[99], *p;
  while (fgets(str, 99, stdin) && !isspace(str[0])) {
    std::stack<double> s;
    for (p = str; *p; ++p) {
      double u, v = 0;
      if (isspace(*p))
        continue;
      else if (isdigit(*p)) {
        while (isdigit(*p))
          v = v * 10 + *p - '0', ++p;
        s.push(v);
      } else {
        u = s.top(), s.pop(), v = s.top(), s.pop();
        if (*p == '+')
          s.push(v + u);
        else if (*p == '-')
          s.push(v - u);
        else if (*p == '*')
          s.push(v * u);
        else if (*p == '/')
          s.push(v / u);
      }
    }
    printf("%f\\n", s.top());
  }
  return 0;
}
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <stack>
using namespace std;
int main() {
  string str;
  while (getline(cin, str)) {
    stack<double> S;
    double now = 0;
    for (int i = 0; i < str.size(); i++) {
      if ('0' <= str[i] && str[i] <= '9' && now < 0) {
        now = now * 10 - (str[i] - '0');
      } else if ('0' <= str[i] && str[i] <= '9') {
        now = now * 10 + (str[i] - '0');
        if (i) {
          if (str[i - 1] == '-')
            now *= -1;
        }
      } else if (str[i] == ' ' && '0' <= str[i - 1] && str[i - 1] <= '9') {
        S.push(now), now = 0;
      } else if (str[i] != ' ' && (str[i + 1] == ' ' || i == str.size() - 1)) {
        double a, b;
        b = S.top();
        S.pop();
        a = S.top();
        S.pop();
        if (str[i] == '+')
          S.push(a + b);
        if (str[i] == '-')
          S.push(a - b);
        if (str[i] == '*')
          S.push(a * b);
        if (str[i] == '/')
          S.push(a / b);
      }
    }

    if (!S.size()) {
      cout << str << endl;
    } else
      printf("%.12f\\n", S.top());

    // printf("%.12f\\n",S.top());
  }
  return 0;
}

Error: -11

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <stack>
using namespace std;
int main() {
  string str;
  while (getline(cin, str)) {
    stack<double> S;
    double now = 0;
    for (int i = 0; i < str.size(); i++) {
      if ('0' <= str[i] && str[i] <= '9') {
        now = now * 10 + (str[i] - '0');
      } else if (str[i] == ' ' && '0' <= str[i - 1] && str[i - 1] <= '9') {
        S.push(now), now = 0;
      } else if (str[i] != ' ') {
        int a, b;
        b = S.top();
        S.pop();
        a = S.top();
        S.pop();
        if (str[i] == '+')
          S.push(a + b);
        if (str[i] == '-')
          S.push(a - b);
        if (str[i] == '*')
          S.push(a * b);
        if (str[i] == '/')
          S.push(a / b);
      }
    }
    if (str.size() == 1) {
      printf("%d\\n", str[0] - '0');
    } else
      printf("%.12f\\n", S.top());
  }
  return 0;
}
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>

#define rep(x, to) for (int x = 0; x < to; x++)
#define rep2(x, from, to) for (int x = from; x < to; x++)

using namespace std;

int main(void) {

  string ws, wk;
  while (getline(cin, ws)) {

    stack<double> stki;

    stringstream zz(ws);
    double z3 = 0;

    while (zz >> wk) {
      if (wk == "+" || wk == "-" || wk == "*" || wk == "/") {
        if (stki.empty())
          break;
        double z1 = stki.top();
        stki.pop();
        double z2 = stki.top();
        stki.pop();
        z3 = 0;
        if (wk == "+")
          z3 = z2 + z1;
        if (wk == "-")
          z3 = z2 - z1;
        if (wk == "*")
          z3 = z2 * z1;
        if (wk == "/")
          z3 = z2 / z1;
        //				printf("z2=%f,z1=%f, z3=%f ",z2,z1,z3);
        stki.push(z3);

      } else {
        //				stringstream wqq(wk);
        //				wqq >> z3;
        //				stki.push(z3);
        stki.push(atof(wk.c_str()));
      }
    }
    if (cin.eof())
      break;
    //		printf("%.6lf\\n",z3);
    printf("%.6lf\\n", stki.top());
  }

  return 0;
}

Error: WA

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>

#define rep(x, to) for (int x = 0; x < to; x++)
#define rep2(x, from, to) for (int x = from; x < to; x++)

using namespace std;

int main(void) {

  string ws, wk;
  while (!cin.eof()) {
    getline(cin, ws);
    if (cin.eof())
      break;

    stack<double> stki;

    stringstream zz(ws);
    double z3;

    while (zz >> wk) {
      if (wk == "+" || wk <= "-" || wk <= "*" || wk <= "/") {
        if (stki.empty())
          break;
        double z1 = stki.top();
        stki.pop();
        double z2 = stki.top();
        stki.pop();
        z3 = 0;
        if (wk == "+")
          z3 = z2 + z1;
        if (wk == "-")
          z3 = z2 - z1;
        if (wk == "*")
          z3 = z2 * z1;
        if (wk == "/")
          z3 = z2 / z1;
        //				printf("z2=%f,z1=%f, z3=%f ",z2,z1,z3);
        stki.push(z3);

      } else {
        stki.push(atof(wk.c_str()));
      }
    }
    printf("%.6f\\n", z3);
  }

  return 0;
}
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>
using namespace std;

int main() {
  string s;
  while (getline(cin, s)) {
    stack<double> st;
    stringstream ss(s);
    string t;
    double a, b;

    while (ss >> t) {

      if (t == "+") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b + a);
      } else if (t == "-") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b - a);
      } else if (t == "*") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b * a);
      } else if (t == "/") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b / a);
      } else
        st.push(atof(t.c_str()));
    }

    printf("%lf\\n", st.top());
    st.pop();
  }
  return 0;
}

Error: -11

Fixed submission:

#include <cstdio>
#include <iostream>
#include <stack>
#include <string>
using namespace std;

int main() {
  string s;
  while (getline(cin, s)) {
    stack<double> st;
    double a, b;
    for (int i = 0; i < s.size(); ++i) {
      if ('0' <= s[i] && s[i] <= '9') {
        st.push(s[i++] - '0');
        while ('0' <= s[i] && s[i] <= '9') {
          a = st.top();
          st.pop();
          st.push(a * 10 + (s[i] - '0'));
          ++i;
        }
      } else if (s[i] == '+') {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b + a);
      } else if (s[i] == '-') {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b - a);
      } else if (s[i] == '*') {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b * a);
      } else if (s[i] == '/') {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b / a);
      }
    }

    printf("%lf\\n", st.top());
    st.pop();
  }
  return 0;
}
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <cctype>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>
using namespace std;

int main() {
  string str;
  double a, b;

  while (getline(cin, str)) {
    stack<double> st;
    stringstream ss(str);
    string s;

    while (ss >> s) {
      if (s.size() > 1 || isdigit(s[0])) {
        a = atof(s.c_str());
        st.push(a);
      } else if (s == "+") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b + a);
      } else if (s == "-") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b - a);
      } else if (s == "*") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b * a);
      } else if (s == "/") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b / a);
      }
    }
    printf("%.6lf\\n", st.top());
  }

  return 0;
}

Error: -11

Fixed submission:

#include <cctype>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>
using namespace std;

int main() {
  string str;
  double a, b;

  while (getline(cin, str)) {
    stack<double> st;
    stringstream ss(str);
    string s;

    while (ss >> s) {
      if (s.size() > 1) {
        a = atof(s.c_str());
        st.push(a);
      } else if (s == "+") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b + a);
      } else if (s == "-") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b - a);
      } else if (s == "*") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b * a);
      } else if (s == "/") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        if (a == 0)
          exit(EXIT_FAILURE);
        st.push(b / a);
      }
    }
    printf("%.6lf\\n", st.top());
  }

  return 0;
}
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <cctype>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>
using namespace std;

int main() {
  string str;
  double a, b;

  while (getline(cin, str)) {
    stack<double> st;
    stringstream ss(str);
    string s;

    a = atof(s.c_str());
    st.push(a);
    while (ss >> s) {
      if (s.size() > 1 || isdigit(s[0])) {
        a = atof(s.c_str());
        st.push(a);
      } else if (s == "+") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b + a);
      } else if (s == "-") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b - a);
      } else if (s == "*") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b * a);
      } else if (s == "/") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        if (a == 0)
          exit(EXIT_FAILURE);
        st.push(b / a);
      }
    }
    printf("%.6lf\\n", st.top());
  }

  return 0;
}

Error: -11

Fixed submission:

#include <cctype>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>
using namespace std;

int main() {
  string str;
  double a, b;

  while (getline(cin, str)) {
    stack<double> st;
    stringstream ss(str);
    string s;

    a = atof(s.c_str());
    st.push(a);
    while (ss >> s) {
      if (isdigit(s[0])) {
        a = atof(s.c_str());
        st.push(a);
      } else if (s == "+") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b + a);
      } else if (s == "-") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b - a);
      } else if (s == "*") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        st.push(b * a);
      } else if (s == "/") {
        a = st.top();
        st.pop();
        b = st.top();
        st.pop();
        if (a == 0)
          exit(EXIT_FAILURE);
        st.push(b / a);
      }
    }
    printf("%.6lf\\n", st.top());
  }

  return 0;
}
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
  string buf;
  while (getline(cin, buf)) {
    stack<double> st;
    stringstream ss(buf);
    string c;
    while (ss >> c) {
      if (c == "+" || c == "-" || c == "*" || c == "/") {
        double a = st.top();
        st.pop();
        double b = st.top();
        st.pop();
        if (c == "+")
          st.push(b + a);
        else if (c[0] == '-')
          st.push(b - a);
        else if (c[0] == '*')
          st.push(b * a);
        else
          st.push(b / a);
      } else
        st.push(stod(c));
    }
    printf("%.6lf\\n", st.top());
  }
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
  string buf;
  while (getline(cin, buf)) {
    stack<double> st;
    stringstream ss(buf);
    string c;
    while (ss >> c) {
      if (c[0] == '+') {
        double a = st.top();
        st.pop();
        double b = st.top();
        st.pop();
        st.push(b + a);
      } else if (c[0] == '-') {
        double a = st.top();
        st.pop();
        double b = st.top();
        st.pop();
        st.push(b - a);
      } else if (c[0] == '*') {
        double a = st.top();
        st.pop();
        double b = st.top();
        st.pop();
        st.push(b * a);
      } else if (c[0] == '/') {
        double a = st.top();
        st.pop();
        double b = st.top();
        st.pop();
        st.push(b / a);
      } else {
        st.push(stod(c));
      }
    }
    printf("%.6lf\\n", st.top());
  }
}
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <time.h>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(), in.end()
const double PI = acos(-1);
const double EPS = 1e-10;
const int inf = 1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main() {
  string s;
  while (getline(cin, s)) {
    // cout<<s<<endl;
    vector<string> in;
    int b = 0;
    rep(i, s.size()) {
      if (s[i] == ' ') {
        in.pb(s.substr(b, i - b));
        b = i + 1;
      }
    }
    in.pb(s.substr(b));
    vector<double> out;
    rep(i, in.size()) {
      if (in[i] == "+" || in[i] == "-" || in[i] == "*" || in[i] == "/") {
        double a = out[out.size() - 2];
        double b = out[out.size() - 1];
        out.pop_back();
        out.pop_back();
        // cout<<a<<" "<<b<<endl;
        if (in[i] == "+")
          a += b;
        if (in[i] == "-")
          a -= b;
        if (in[i] == "*")
          a *= b;
        if (in[i] == "/")
          a /= b;
        out.pb(a);
        // rep(j,out.size())cout<<out[i]<<" ";
        // cout<<endl;
      } else
        out.pb(atoi(&in[i][0]));
      // rep(j,out.size())cout<<out[j]<<" ";
      // cout<<endl;
    }
    printf("%.9lf\\n", out[0]);
  }
}

Error: -11

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <time.h>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(), in.end()
const double PI = acos(-1);
const double EPS = 1e-10;
const int inf = 1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main() {
  string s;
  while (getline(cin, s)) {
    // cout<<s<<endl;
    vector<string> in;
    int b = 0;
    rep(i, s.size()) {
      if (s[i] == ' ') {
        in.pb(s.substr(b, i - b));
        b = i + 1;
      }
    }
    in.pb(s.substr(b));
    vector<double> out;
    rep(i, in.size()) {
      if (isdigit(in[i][0]))
        out.pb(atoi(&in[i][0]));
      else {
        double a = out[out.size() - 2];
        double b = out[out.size() - 1];
        out.pop_back();
        out.pop_back();
        // cout<<a<<" "<<b<<endl;
        if (in[i] == "+")
          a += b;
        if (in[i] == "-")
          a -= b;
        if (in[i] == "*")
          a *= b;
        if (in[i] == "/")
          a /= b;
        out.pb(a);
        // rep(j,out.size())cout<<out[i]<<" ";
        // cout<<endl;
      }
      // rep(j,out.size())cout<<out[j]<<" ";
      // cout<<endl;
    }
    printf("%.9lf\\n", out[0]);
  }
}
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <stack>
using namespace std;
int main() {
  stack<double> s;
  double a, b;
  char c[80], bf;
  while (1) {
    cin >> c;
    if (c[0] == '+') {
      b = s.top();
      s.pop();
      a = s.top();
      s.pop();
      s.push(a + b);
    } else if (c[0] == '-' && c[1] == '\\0') {
      b = s.top();
      s.pop();
      a = s.top();
      s.pop();
      s.push(a - b);
    } else if (c[0] == '*') {
      b = s.top();
      s.pop();
      a = s.top();
      s.pop();
      s.push(a * b);
    } else if (c[0] == '/') {
      b = s.top();
      s.pop();
      a = s.top();
      s.pop();
      s.push(a / b);
    } else {
      s.push(atof(c));
    }
    bf = getchar();
    if (bf == '\\n')
      printf("%.6f\\n", s.top());
    if (bf == EOF)
      return 0;
  }
  return 0;
}

Error: -11

Fixed submission:

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <stack>
using namespace std;
int main() {
  stack<double> s;
  double a, b;
  char c[80], bf, t[40] = "";
  int i = 0, j = 0;
  while (1) {
    cin >> c;
    if (c[0] == '+') {
      a = s.top();
      s.pop();
      b = s.top();
      s.pop();
      s.push(a + b);
    } else if (c[0] == '-' && c[1] == '\\0') {
      a = s.top();
      s.pop();
      b = s.top();
      s.pop();
      s.push(a - b);
    } else if (c[0] == '*') {
      a = s.top();
      s.pop();
      b = s.top();
      s.pop();
      s.push(a * b);
    } else if (c[0] == '/') {
      a = s.top();
      s.pop();
      b = s.top();
      s.pop();
      s.push(a / b);
    } else {
      s.push(atof(c));
    }
    bf = getchar();
    if (bf == '\\n') {
      printf("%.6f\\n", s.top());
      while (!s.empty())
        s.pop();
    }
    if (bf == EOF)
      return 0;
  }
  return 0;
}
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>

int main() {
  std::string s;
  while (std::getline(std::cin, s)) {
    std::stack<double> stack;
    std::stringstream ss(s);
    while (ss >> s) {
      if (!(s == "+" || s == "-" || s == "*" || s == "/")) {
        stack.push(std::stoi(s));
      } else {
        auto x1 = stack.top();
        stack.pop();
        auto x2 = stack.top();
        stack.pop();

        switch (s[0]) {
        case '+':
          stack.push(x2 + x1);
          break;
        case '-':
          stack.push(x2 - x1);
          break;
        case '*':
          stack.push(x2 * x1);
          break;
        case '/':
          stack.push(x2 / x1);
          break;
        }
      }
    }
    // std::cout << stack.top() << std::endl;
    std::printf("%.6f\\n", stack.top());
  }
}

Error: -11

Fixed submission:

#include <cstdio>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>

int main() {
  std::string temp, s;
  while (std::getline(std::cin, temp)) {
    std::stack<double> stack;
    std::stringstream ss(temp);
    while (ss >> s) {
      if ('0' <= s[0] && s[0] <= '9') {
        stack.push(std::stoi(s));
      } else {
        auto x1 = stack.top();
        stack.pop();
        auto x2 = stack.top();
        stack.pop();

        switch (s[0]) {
        case '+':
          stack.push(x2 + x1);
          break;
        case '-':
          stack.push(x2 - x1);
          break;
        case '*':
          stack.push(x2 * x1);
          break;
        case '/':
          stack.push(x2 / x1);
          break;
        }
      }
    }
    // std::cout << stack.top() << std::endl;
    std::printf("%.6f\\n", stack.top());
  }
}
Problem p00087 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <stack>
#include <string>
using namespace std;
bool check(char c) { return '0' <= c && c <= '9'; }
int main(void) {
  char s[1111];
  int sl;
  while (fgets(s, sizeof(s), stdin) != NULL) {
    stack<long double> st;
    st.push(0);
    sl = strlen(s);
    for (int i = 0; i < sl - 1; i++) {
      if (check(s[i]) || (s[i] == '-' && check(s[i + 1]))) {
        bool f = (s[i] == '-');
        if (f)
          i++;
        long double n = 0;
        for (; check(s[i]); i++) {
          n *= 10;
          n += s[i] - '0';
        }
        if (f)
          n = -n;
        st.push(n);
      } else {
        long double a = st.top();
        st.pop();
        long double b = st.top();
        st.pop();
        long double m;
        switch (s[i]) {
        case '+':
          m = b + a;
          break;
        case '-':
          m = b - a;
          break;
        case '*':
          m = b * a;
          break;
        case '/':
          m = b / a;
          break;
        }
        st.push(m);
        i++;
      }
    }
    printf("%.10Lf\\n", st.top());
  }
}

Error: -11

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <stack>
#include <string>
using namespace std;
int main(void) {
  char s[1111];
  int sl;
  while (fgets(s, sizeof(s), stdin) != NULL) {
    stack<long double> st;
    st.push(0);
    sl = strlen(s);
    for (int i = 0; i < sl - 1; i++) {
      if ('0' <= s[i] && s[i] <= '9') {
        long double n = 0;
        for (; '0' <= s[i] && s[i] <= '9'; i++) {
          n *= 10;
          n += s[i] - '0';
        }
        st.push(n);
      } else {
        long double a = st.top();
        st.pop();
        long double b = st.top();
        st.pop();
        long double m;
        switch (s[i]) {
        case '+':
          m = b + a;
          break;
        case '-':
          m = b - a;
          break;
        case '*':
          m = b * a;
          break;
        case '/':
          m = b / a;
          break;
        }
        st.push(m);
        i++;
      }
    }
    printf("%.10Lf\\n", st.top());
  }
}