[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
define the main function
    make ints n and t
    read n and t
    create string s
    read s
    make integer i = 0
    while i is less than n and s[i] is not equal to '.', increment i
    if i is not equal to n and t is greater than 0
        make integer p = i
        increment i
        while i is less than n and s[i] is less than '5', add 1 to i
        if i is not equal to n
            set s to s.substr(0, i)
            subtract 1 from i
            add 1 to s[i]
            take away 1 from t
            decrease i by 1
            while i is greater than p, s[i + 1] is more than '4', and t is greater than 0
                increment s[i]
                set s[i + 1] to '0'
                decrease t by 1
                decrease i by 1
            end of the block
            if s[i + 1] is equal to '/'
                set s to s.substr(0, i + 1)
                while i is greater than or equal to 0 and s[i] is equal to '9'
                    set s[i] to '0'
                    decrease i by 1
                end of the block
                if i is not equal to -1
                    increment s[i]
                else
                    output 1
                end of the block
            else if i is equal to p, s[p + 1] is greater than '4', and t is greater than 0
                take away 1 from t
                set s to s.substr(0, i)
                decrease i by 1
                while i is greater than or equal to 0 and s[i] is equal to '9'
                    set s[i] to '0'
                    reduce i by 1
                end of the block
                if i not equal to -1
                    increment s[i] by 1
                else do
                    print 1
                end of the block
            otherwise
                set s to s.substr(0, i + 2)
            end of the block
        end of the block
    end of the block
    print s
end of the block

[CODE]:

int main() {
    int n, t;
    cin >> n >> t;
    string s;
    cin >> s;
    int i = 0;
    while (i < n && s[i] != '.') { i++; }
    if (i != n && t > 0) {
        int p = i;
        i++;
        while (i < n && s[i] < '5') { i++; }
        if (i != n) {
            s = s.substr(0, i);
            i--;
            s[i]++;
            t--;
            i--;
            while (i > p && s[i + 1] > '4' && t > 0) {
                s[i]++;
                s[i + 1] = '0';
                t--;
                i--;
            }
            if (s[i + 1] == '/') {
                s = s.substr(0, i + 1);
                while (i >= 0 && s[i] == '9') {
                    s[i] = '0';
                    i--;
                }
                if (i != -1) {
                    s[i]++;
                } else {
                    cout << 1;
                }
            } else if (i == p && s[p + 1] > '4' && t > 0) {
                t--;
                s = s.substr(0, i);
                i--;
                while (i >= 0 && s[i] == '9') {
                    s[i] = '0';
                    i--;
                }
                if (i != -1) {
                    s[i]++;
                } else {
                    cout << 1;
                }
            } else {
                s = s.substr(0, i + 2);
            }
        }
    }
    cout << s << '\n';
}