PrincetonPLI/LongProc huggingface dataset:
[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
    str = string array of size 12
    n, i, j, ck = int
    read n then str[0]
    set str[1] to "vaporeon"
    set str[2] to "jolteon"
    set str[3] to "flareon"
    set str[4] to "espeon"
    set str[5] to "umbreon"
    set str[6] to "leafeon"
    set str[7] to "glaceon"
    set str[8] to "sylveon"
    for i = 1 to 8 inclusive
        if size of str[i] is n
            set ck to 1
            for j = 0 to n
                if str[0][j] >= 'a' and str[0][j] <= 'z'
                    if str[0][j] is not str[i][j]
                        set ck to 0
                        break
                    end of the block
                end of the block
            end of the block
            if ck is 1
                print str[i]
                return to indicate successful execution
            end of the block
        end of the block
    end of the block
    print newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    string str[12];
    int n, i, j, ck;
    cin >> n >> str[0];
    str[1] = "vaporeon";
    str[2] = "jolteon";
    str[3] = "flareon";
    str[4] = "espeon";
    str[5] = "umbreon";
    str[6] = "leafeon";
    str[7] = "glaceon";
    str[8] = "sylveon";
    for (i = 1; i <= 8; i++) {
        if (str[i].size() == n) {
            ck = 1;
            for (j = 0; j < n; j++) {
                if (str[0][j] >= 'a' && str[0][j] <= 'z') {
                    if (str[0][j] != str[i][j]) {
                        ck = 0;
                        break;
                    }
                }
            }
            if (ck == 1) {
                cout << str[i] << endl;
                return 0;
            }
        }
    }
    cout << endl;
    return 0;
}
[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
    create long long integers m, x1, x2, y1, y2, h1, h2, a1, and a2
    read m
    read h1 and a1
    read x1 and y1
    read h2 and a2
    read x2 and y2
    create integer vector ans1
    create integer vector ans2
    create long long integer total = 0
    while total is less than 2 * m
        if h1 is equal to a1, append total to ans1
        if h2 is equal to a2, append total to ans2
        increment total
        set h1 to the result of (h1 * x1 + y1) % m
        set h2 to the result of (h2 * x2 + y2) % m;
    end of the block
    if ans1.empty() is truthy or ans2.empty() is truthy
        print "-1"
        return to indicate successful execution
    end of the block
    create long long integers t1 = ans1[0] and t2 = ans2[0]
    create long long integer s1 = ans1[1] - ans1[0]
    create long long integer s2 = ans2[1] - ans2[0]
    for i = 0 to 5e6
        if t1 is equal to t2
            print t1
            return to indicate successful execution
        end of the block
        if t1 is less than t2
            set t1 to t1 + s1
        else
            set t2 to t2 + s2
        end of the block
    end of the block
    print "-1"
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    long long m, x1, x2, y1, y2, h1, h2, a1, a2;
    cin >> m;
    cin >> h1 >> a1;
    cin >> x1 >> y1;
    cin >> h2 >> a2;
    cin >> x2 >> y2;
    vector<int> ans1;
    vector<int> ans2;
    long long total = 0;
    while (total < 2 * m) {
        if (h1 == a1) { ans1.push_back(total); }
        if (h2 == a2) { ans2.push_back(total); }
        total++;
        h1 = (h1 * x1 + y1) % m;
        h2 = (h2 * x2 + y2) % m;
    }
    if (ans1.empty() || ans2.empty()) {
        cout << "-1" << endl;
        return 0;
    }
    long long t1 = ans1[0], t2 = ans2[0];
    long long s1 = ans1[1] - ans1[0];
    long long s2 = ans2[1] - ans2[0];
    for (int i = 0; i <= 5e6; i++) {
        if (t1 == t2) {
            cout << t1 << endl;
            return 0;
        }
        if (t1 < t2) {
            t1 += s1;
        } else {
            t2 += s2;
        }
    }
    cout << "-1" << endl;
    return 0;
}
[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]:
create long long variables m, h1, a1, x1, h2, a2, x2, y2, y, p1, p2, t1 and t2
define the main function
    read input to m, h1, a1, x1, y, h2, a2, x2 and y2
    for i from 1 to 1e7 inclusive
        declare long long ans1 = (((h1 * x1 * 1LL) + y) % m)
        declare long long ans2 = (((h2 * x2 * 1LL) + y2) % m)
        change h1 to ans1 and h2 to ans2
        if a1 is equal to ans1
            if p1 = 0
                assign i to p1
            else if t1 = 0
                change t1 to i - p1
        end of the block
        if a2 is equal to ans2
            if p2 is false
                change p2 to i
            else if t2 = 0
                change t2 to i - p2
        end of the block
    end of the block
    if p1 is false or p2 is false, return !(cout<< -1 << endl)
    for i from 1 to 1e7 inclusive
        if p1 is equal to p2, return !(cout << p1 << endl)
        if p1 is less than p2
            increase p1 by t1
        else
            add t2 to p2
    end of the block
    print -1
    return to indicate successful execution
end of the block

[CODE]:

long long m, h1, a1, x1, h2, a2, x2, y2, y, p1, p2, t1, t2;
int main() {
    cin >> m >> h1 >> a1 >> x1 >> y >> h2 >> a2 >> x2 >> y2;
    for (int i = 1; i <= 1e7; i++) {
        long long ans1 = (((h1 * x1 * 1LL) + y) % m);
        long long ans2 = (((h2 * x2 * 1LL) + y2) % m);
        h1 = ans1, h2 = ans2;
        if (a1 == ans1) {
            if (!p1)
                p1 = i;
            else if (!t1)
                t1 = i - p1;
        }
        if (a2 == ans2) {
            if (!p2)
                p2 = i;
            else if (!t2)
                t2 = i - p2;
        }
    }
    if (!p1 || !p2) return !(cout << -1 << endl);
    for (int i = 1; i <= 1e7; i++) {
        if (p1 == p2) return !(cout << p1 << endl);
        if (p1 < p2)
            p1 += t1;
        else
            p2 += t2;
    }
    cout << -1 << endl;
    return 0;
}
[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
    create int n
    read n
    print +------------------------+
    print |
    if n >= 1
        print O.
    else
        print #.
    for a=1 to 10 inclusive
        if n >= 3* a +2
            print O.
        else
            print #.
    print |D| and a newline
    print |
    if n >= 2
        print O.
    otherwise
        print #.
    for a=1 to 10 inclusive
        if n >= 3 * a + 3
            print O.
        otherwise
            print #.
    print |.| and a newline
    print |
    if n >= 3
        print O.
    else
        print #.
    print ......................| and a newline
    print |
    if n >= 4
        print O.
    else
        print #.
    for a=1 to 10 inclusive
        if n >= 3*a+4
            print O.
        else
            print #.
    print |.|) and a newline
    print +------------------------+ and a newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    cout << "+------------------------+" << endl;
    cout << "|";
    if (n >= 1)
        cout << "O.";
    else
        cout << "#.";
    for (int a = 1; a <= 10; a++)
        if (n >= 3 * a + 2)
            cout << "O.";
        else
            cout << "#.";
    cout << "|D|)" << endl;
    cout << "|";
    if (n >= 2)
        cout << "O.";
    else
        cout << "#.";
    for (int a = 1; a <= 10; a++)
        if (n >= 3 * a + 3)
            cout << "O.";
        else
            cout << "#.";
    cout << "|.|" << endl;
    cout << "|";
    if (n >= 3)
        cout << "O.";
    else
        cout << "#.";
    cout << "......................|" << endl;
    cout << "|";
    if (n >= 4)
        cout << "O.";
    else
        cout << "#.";
    for (int a = 1; a <= 10; a++)
        if (n >= 3 * a + 4)
            cout << "O.";
        else
            cout << "#.";
    cout << "|.|)" << endl;
    cout << "+------------------------+" << endl;
    return 0;
}
[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
    declare integer variable n
    read n
    print "+------------------------+\n"
    create 2d character array arr 4 by 11 elements
    for i = 0 to 4 exclusive
        for integer j = 0 to 11 exclusive set arr[i][j] to '#'
    for integer j = 0 to 11 exclusive
        for integer i = 0 to 4 exclusive
            if i = 2 && j is greater than 0
                set arr[i][j] to '.'
            else if n
                set arr[i][j] to 'O'
                decrease n
            end of the block
        end of the block
    end of the block
    for i = 0 to 4 exclusive
        print "|"
        for integer j = 0 to 11 exclusive print arr[i][j] and '.'
        if i = 0
            print "|D|)\n"
        else if i = 1
            print "|.|\n"
        else if i = 2
            print "..|\n"
        else
            print "|.|)\n"
    end of the block
    print "+------------------------+\n"
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    cout << "+------------------------+\n";
    char arr[4][11];
    for (int i = 0; i < 4; i++)
        for (int j = 0; j < 11; j++) arr[i][j] = '#';
    for (int j = 0; j < 11; j++) {
        for (int i = 0; i < 4; i++) {
            if (i == 2 && j > 0)
                arr[i][j] = '.';
            else if (n) {
                arr[i][j] = 'O';
                n--;
            }
        }
    }
    for (int i = 0; i < 4; i++) {
        cout << "|";
        for (int j = 0; j < 11; j++) { cout << arr[i][j] << "."; }
        if (i == 0)
            cout << "|D|)\n";
        else if (i == 1)
            cout << "|.|\n";
        else if (i == 2)
            cout << "..|\n";
        else
            cout << "|.|)\n";
    }
    cout << "+------------------------+\n";
    return 0;
}
[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
    create integer k
    read k
    create string array s with length 6
    set s[0] to "+------------------------+"
    set s[1] to "|#.#.#.#.#.#.#.#.#.#.#.|D|)"
    set s[2] to "|#.#.#.#.#.#.#.#.#.#.#.|.|"
    set s[3] to "|#.......................|"
    set s[4] to "|#.#.#.#.#.#.#.#.#.#.#.|.|)"
    set s[5] to "+------------------------+"
    create integer idx to 0
    while k
        for i=0 to 6 exclusive
            if s[i][idx] is equal to '#'
                decrement k
                set s[i][idx] to 'O'
                if not k break
            end of the block
        increment idx
    end of the block
    for i=0 to 6 exclusive print s[i]
end of the block

[CODE]:

int main() {
    int k;
    cin >> k;
    string s[6];
    s[0] = "+------------------------+";
    s[1] = "|#.#.#.#.#.#.#.#.#.#.#.|D|)";
    s[2] = "|#.#.#.#.#.#.#.#.#.#.#.|.|";
    s[3] = "|#.......................|";
    s[4] = "|#.#.#.#.#.#.#.#.#.#.#.|.|)";
    s[5] = "+------------------------+";
    int idx = 0;
    while (k) {
        for (int i = 0; i < 6; i++)
            if (s[i][idx] == '#') {
                k--;
                s[i][idx] = 'O';
                if (!k) break;
            }
        idx++;
    }
    for (int i = 0; i < 6; i++) cout << s[i] << endl;
}
[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
    create integer k
    read k
    create string array str with size 6
    set str[0] to "+------------------------+"
    set str[1] to "|#.#.#.#.#.#.#.#.#.#.#.|D|)"
    set str[2] to "|#.#.#.#.#.#.#.#.#.#.#.|.|"
    set str[3] to "|#.......................|"
    set str[4] to "|#.#.#.#.#.#.#.#.#.#.#.|.|)"
    set str[5] to "+------------------------+"
    for j = 1 to 23 exclusive, increment j by 2
        for i = 1 to 5 exclusive
            if k is greater than 0
                if i is 3 and j is not 1, break current loop iteration
                set str[i][j] to 'O', decrement k
            end of the block
        end of the block
    end of the block
    for i = 0 to 6 exclusive, print str[i] print newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int k;
    cin >> k;
    string str[6];
    str[0] = "+------------------------+";
    str[1] = "|#.#.#.#.#.#.#.#.#.#.#.|D|)";
    str[2] = "|#.#.#.#.#.#.#.#.#.#.#.|.|";
    str[3] = "|#.......................|";
    str[4] = "|#.#.#.#.#.#.#.#.#.#.#.|.|)";
    str[5] = "+------------------------+";
    for (int j = 1; j < 23; j += 2) {
        for (int i = 1; i < 5; i++) {
            if (k > 0) {
                if (i == 3 && j != 1) continue;
                str[i][j] = 'O', k--;
            }
        }
    }
    for (int i = 0; i < 6; i++) { cout << str[i] << endl; }
    return 0;
}
[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]:
declare long long variable k
create string array s with 8 elements
define the main function
    set s[1] to "+------------------------+"
    set s[2] to "|#.#.#.#.#.#.#.#.#.#.#.|D|)"
    set s[3] to "|#.#.#.#.#.#.#.#.#.#.#.|.|"
    set s[4] to "|#.......................|"
    set s[5] to "|#.#.#.#.#.#.#.#.#.#.#.|.|)"
    change s[6] to " +------------------------+"
    read k
    loop j from 1 to 25 inclusive
        loop i from 2 to 5 inclusive
            break if k = 0
            if s[i][j] is '#', change s[i][j] to 'O' and decrement k by one
        end of the block
        break if k = 0
    end of the block
    for i from 1 to 6 inclusive, print s[i] and "\n"
    return to indicate successful execution
end of the block

[CODE]:

long long k;
string s[8];
int main() {
    s[1] = "+------------------------+";
    s[2] = "|#.#.#.#.#.#.#.#.#.#.#.|D|)";
    s[3] = "|#.#.#.#.#.#.#.#.#.#.#.|.|";
    s[4] = "|#.......................|";
    s[5] = "|#.#.#.#.#.#.#.#.#.#.#.|.|)";
    s[6] = "+------------------------+";
    cin >> k;
    for (long long j = 1; j <= 25; j++) {
        for (long long i = 2; i <= 5; i++) {
            if (k == 0) break;
            if (s[i][j] == '#') s[i][j] = 'O', k--;
        }
        if (k == 0) break;
    }
    for (long long i = 1; i <= 6; i++) cout << s[i] << "\n";
    return 0;
}
[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]:
create int k
create char matrix s of dimensions 4x11
define the main function
    for i = 0 to 4 exclusive
        for j = 0 to 11 exclusive set s[i][j] to #
    set the elements of the second row of s to .
    read k
    for j=0 to 11 exclusive
        for i=0 to 4 exclusive
            if k is true and s[i][j] is #
                set s[i][j] to character O
                decrease k by 1
            end of the block
    print +------------------------+ and move to newline
    for i = 0 to 4 exclusive
        print |
        for j = 0 to 11 exclusive print s[i][j] and .
        if i is 0
            print |D|) and move to newline
        else if i is equal to 1
            print |.| and move to newline
        else if i is 2
            print ..| and move to newline
        else do the following
            print |.|) and move to newline
    end of the block
    print +------------------------+
    return to indicate successful execution
end of the block

[CODE]:

int k;
char s[4][11];
int main() {
    for (int i = 0; i < 4; i++)
        for (int j = 0; j < 11; j++) s[i][j] = '#';
    for (int i = 1; i < 11; i++) s[2][i] = '.';
    cin >> k;
    for (int j = 0; j < 11; j++)
        for (int i = 0; i < 4; i++)
            if (k && s[i][j] == '#') {
                s[i][j] = 'O';
                k--;
            }
    cout << "+------------------------+\n";
    for (int i = 0; i < 4; i++) {
        cout << '|';
        for (int j = 0; j < 11; j++) cout << s[i][j] << '.';
        if (i == 0)
            cout << "|D|)\n";
        else if (i == 1)
            cout << "|.|\n";
        else if (i == 2)
            cout << "..|\n";
        else
            cout << "|.|)\n";
    }
    cout << "+------------------------+\n";
    return 0;
}