#include <iostream>
#include <string>

using namespace std;

int main()
{  
   const double RATE1 = 0.14;
   const double RATE2 = 0.32;
   const double RATE1_SINGLE_LIMIT = 85000;
   const double RATE1_MARRIED_LIMIT = 170000;

   double tax1 = 0;
   double tax2 = 0;

   double income;
   cout << "Proszę podać swój dochód: ";
   cin >> income;

   cout << "Rozliczanie samodzielne - s, z małżonkiem - m: ";
   string marital_status;
   cin >> marital_status;

   if (marital_status == "s")
   {
      if (income <= RATE1_SINGLE_LIMIT)
      {
         tax1 = RATE1 * income;
      }
      else
      {
         tax1 = RATE1 * RATE1_SINGLE_LIMIT;
         tax2 = RATE2 * (income - RATE1_SINGLE_LIMIT);
      }
   }
   else
   {  
      if (income <= RATE1_MARRIED_LIMIT)
      {
         tax1 = RATE1 * income;
      }
      else 
      {
         tax1 = RATE1 * RATE1_MARRIED_LIMIT;
         tax2 = RATE2 * (income - RATE1_MARRIED_LIMIT);
      }
   }
   
   double total_tax = tax1 + tax2;
   
   cout << "Podatek wynosi " << total_tax << endl;
   return 0;
}

