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
    n = integer
    read n
    s = string
    read s
    sort string s
    print s
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    cout << s << 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
    counter, k =integers with counter = 1, k = 0
    s, s1 = strings
    Read s1, s2
    c = character, set to s1[k]
    for x = 0 to length of string s2 exclusive
        if c is s2[x]
            increment counter
            set c to s1[++k]
        end of the block
    print counter and a new line
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int counter = 1, k = 0;
    string s1, s2;
    cin >> s1 >> s2;
    char c = s1[k];
    for (int x = 0; x < s2.length(); x++)
        if (c == s2[x]) {
            counter++;
            c = s1[++k];
        }
    cout << counter << 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
    x=int
    read x
    if x is 1
        print -1
    else
        print x, space, x
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int x;
    cin >> x;
    if (x == 1)
        puts("-1");
    else
        cout << x << " " << x << 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 n
    read n
    declare set words containing long longs
    for i = 0 to n exlcusive
        declare string s
        read s
        define vector<bool> b with length of 26
        for j = 0 to s size exclusive do set b[s[j] - 'a'] to true
        define long long hash = 0, p = 1
        for int j = 0; j less than 26; increment j, p <<= 1 do add b[j] * p to hash
        insert hash into words
    end of the block
    print words size
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    set<long long> words;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        vector<bool> b(26);
        for (int j = 0; j < s.size(); j++) b[s[j] - 'a'] = true;
        long long hash = 0, p = 1;
        for (int j = 0; j < 26; j++, p <<= 1) hash += b[j] * p;
        words.insert(hash);
    }
    cout << words.size() << 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 ints p and n
    read p and n
    create vector of ints a with p elements
    loop i from 1 to n inclusive
        declare int val
        read input to val
        declare int variable mod = val modulo p
        if a[mod] is not 0
            print i
            return to indicate successful execution
        end of the block
        increment a[mod]
    end of the block
    print -1
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int p, n;
    cin >> p >> n;
    vector<int> a(p);
    for (int i = 1; i <= n; i++) {
        int val;
        cin >> val;
        int mod = val % p;
        if (a[mod]) {
            cout << i << endl;
            return 0;
        }
        a[mod]++;
    }
    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
    n = int
    read n
    name, crew = string
    rat, woch, men, cap = string vector
    for i = 0 to n
        read name then crew
        if crew is "rat"
            append name to rat
        else if crew is "woman" or "child"
            append name to woch
        else if crew is "man"
            append name to men
        else if crew is "captain"
            append name to cap
    end of the block
    print first size of rat values of rat
    print first size of woch values of woch
    print first size of men values of men
    print first size of cap values of cap
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    string name, crew;
    vector<string> rat, woch, men, cap;
    for (int i = 0; i < n; i++) {
        cin >> name >> crew;
        if (crew == "rat")
            rat.push_back(name);
        else if (crew == "woman" || crew == "child")
            woch.push_back(name);
        else if (crew == "man")
            men.push_back(name);
        else if (crew == "captain")
            cap.push_back(name);
    }
    for (int i = 0; i < rat.size(); i++) { cout << rat[i] << endl; }
    for (int i = 0; i < woch.size(); i++) { cout << woch[i] << endl; }
    for (int i = 0; i < men.size(); i++) { cout << men[i] << endl; }
    for (int i = 0; i < cap.size(); i++) { cout << cap[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]:
define the main function
    declare integers a, b, c and k and an integer array d with 6 elements
    read input to a, b and c
    change d[0] to a + b + c
    change d[1] to a + b * c
    change d[2] to a * b * c
    change d[3] to a * b + c
    change d[4] to (a + b) * c
    change d[5] to a * (b + c)
    for integer i = 0 to 6 exclusive
        for integer j = 5 to i exclusive counting down
            if d[j - 1] is greater than d[j]
                set k to d[j - 1]
                assign d[j] to d[j - 1]
                assign k to d[j]
            end of the block
        end of the block
    end of the block
    print d[5]
end of the block

[CODE]:

int main() {
    int a, b, c, d[6], k;
    cin >> a >> b >> c;
    d[0] = a + b + c;
    d[1] = a + b * c;
    d[2] = a * b * c;
    d[3] = a * b + c;
    d[4] = (a + b) * c;
    d[5] = a * (b + c);
    for (int i = 0; i < 6; i++) {
        for (int j = 5; j > i; j--) {
            if (d[j - 1] > d[j]) {
                k = d[j - 1];
                d[j - 1] = d[j];
                d[j] = k;
            }
        }
    }
    cout << d[5] << 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
    x, y = string
    S,Y= string
    read s and y
    set S = string(y.size(), '0') + s
    Y = string(s.size(), '0') + y
    if Y > S
        print <
    else if S > Y
        print >
    else do the following
        print =
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    string s, y;
    string S, Y;
    cin >> s >> y;
    S = string(y.size(), '0') + s;
    Y = string(s.size(), '0') + y;
    if (Y > S)
        cout << "<" << endl;
    else if (S > Y)
        cout << ">" << endl;
    else {
        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
    n, m =integers
    Read n, m
    flag = integer with 0
    for i = 0 to n exclusive
        for j = 0 to m exclusive
            x = character
            Read x
            if x is equal to C OR x is equal to M OR x is equal to Y, set flag to 1
        end of the block
    end of the block
    if flag is equal to 1
        print #Color and a new line
    else do the following
        print #Black&White and a new line
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, m;
    cin >> n >> m;
    int flag = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            char x;
            cin >> x;
            if (x == 'C' || x == 'M' || x == 'Y') flag = 1;
        }
    }
    if (flag == 1)
        cout << "#Color" << endl;
    else
        cout << "#Black&White" << 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]:
function solve with unsigned long long argument x that returns unsigned long long
    new unsigned long longs ans, f, e and xx where ans = 0 and xx = x
    if x is less than 10, return x
    change e to x % 10
    while x != 0
        assign x modulo 10 to f
        divide x by 10
    end of the block
    if f <= e
        set ans to 9 + xx / 10
    else
        change ans to 8 + xx / 10
    return ans
end of the block
define the main function
    declare unsigned long longs a and b
    read input to a and b
    print solve(b) - solve(a - 1)
    return to indicate successful execution
end of the block

[CODE]:

unsigned long long solve(unsigned long long x) {
    unsigned long long ans = 0, f, e, xx = x;
    if (x < 10) return x;
    e = x % 10;
    while (x) {
        f = x % 10;
        x /= 10;
    }
    if (f <= e)
        ans = 9 + xx / 10;
    else
        ans = 8 + xx / 10;
    return ans;
}
int main() {
    unsigned long long a, b;
    cin >> a >> b;
    cout << solve(b) - solve(a - 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
    n = integer
    read n
    a = integer array of size n, b = integer array of size n
    for i = 0 to n exclusive, then read a[i]
    for i = 0 to n exclusive, then read b[i]
    maxi = integer = 0, p = integer = 0, q = integer = 0
    for l = 0 to n exclusive
        temp = integer = 0
        for r = l to n exclusive
            sum1 = integer = 0, sum2 = integer = 0
            for i = l to r inclusive
                sum1 = create a new number where if any position of a bit from sum1 or a[i] contains a 1 that new number in that same position contains a 1 in that bit location
                sum2 = create a new number where if any position of a bit from sum2 or b[i] contains a one that new number in that same position contains a 1 in that bit location
            end of the block
            sum = integer = sum1 + sum2
            if sum > maxi, then maxi = sum
        end of the block
    end of the block
    print maxi
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    int a[n], b[n];
    for (int i = 0; i < n; i++) { cin >> a[i]; }
    for (int i = 0; i < n; i++) { cin >> b[i]; }
    int maxi = 0, p = 0, q = 0;
    for (int l = 0; l < n; l++) {
        int temp = 0;
        for (int r = l; r < n; r++) {
            int sum1 = 0, sum2 = 0;
            for (int i = l; i <= r; i++) {
                sum1 |= a[i];
                sum2 |= b[i];
            }
            int sum = sum1 + sum2;
            if (sum > maxi) { maxi = sum; }
        }
    }
    cout << maxi << 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 int n
    read n
    declare int min1, max1, min2, max2, min3, max3
    read min1, max1
    read min2, max2
    read min3, max3
    if max1 + min2 + min3 is greater than or equal to n
        print n - min2 - min3, " ", min2, " ", min3
    else if max1 + max2 + min3 is greater than or equal to n
        print max1, " ", n - max1 - min3, " ", min3
    else
        max1, " ", max2, " ", n - max1 - max2
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    int min1, max1, min2, max2, min3, max3;
    cin >> min1 >> max1;
    cin >> min2 >> max2;
    cin >> min3 >> max3;
    if (max1 + min2 + min3 >= n)
        cout << n - min2 - min3 << " " << min2 << " " << min3 << "\n";
    else if (max1 + max2 + min3 >= n)
        cout << max1 << " " << n - max1 - min3 << " " << min3 << "\n";
    else
        cout << max1 << " " << max2 << " " << n - max1 - max2 << "\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 int k, l, m, n, d
    cont = 0
    read k, l, m, n, d
    set cont to d
    if at leat one of k, l, m or n =1
        print d
    else
        for i=1 to d inclusive
            if i mod k, i modl, i mod m and i mod n are different from 0, decrement cont
        end of the block
        print cont
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int k, l, m, n, d;
    int cont = 0;
    cin >> k >> l >> m >> n >> d;
    cont = d;
    if (k == 1 || l == 1 || m == 1 || n == 1) {
        cout << d << endl;
    } else {
        for (int i = 1; i <= d; i++) {
            if ((i % k != 0) && (i % l != 0) && (i % m != 0) && (i % n != 0)) cont--;
        }
        cout << cont << endl;
    }
    return 0;
}