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, k = int
    read n then k
    s = string
    read s
    pos, post = int
    for i = 0 to n
        if s[i] is 'G' set pos to i
        if s[i] is 'T' set post to i
    end of the block
    if abs of (pos - post) mod k is not 0
        print "NO"
    else
        f = bool with f = 1
        if pos < post
            for i = pos to post inclusive incrementing i by k
                if s8i] is '#' set f to 0
        else
            for i = pos to post inclusive decrementing i by k
                if s[i] is '#' set f to 0
        end of the block
        print "YES" if f else print "NO"
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int pos, post;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'G') pos = i;
        if (s[i] == 'T') post = i;
    }
    if (abs(pos - post) % k != 0)
        cout << "NO\n";
    else {
        bool f = 1;
        if (pos < post) {
            for (int i = pos; i <= post; i += k)
                if (s[i] == '#') f = 0;
        } else {
            for (int i = pos; i >= post; i -= k)
                if (s[i] == '#') f = 0;
        }
        cout << (f ? "YES" : "NO") << '\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
    x=int
    read x
    for y=x/2 down to 0 exclusive
        for z=0 to y exclusive print *
        for z=0 to x-2*y exclusive print D
        for z=0 to y exclusive print *
        print newline
    end of the block
    for y=0 to x exclusive print D
    print newline
    for y=1 to x/2 inclusive
        for z=0 to y exclusive print *
        for z=0 to x-2*y exclusive print D
        for z=0 to y exclusive print *
        print newline
    end of the block
end of the block

[CODE]:

int main() {
    int x;
    cin >> x;
    for (int y = x / 2; y > 0; y--) {
        for (int z = 0; z < y; z++) { cout << '*'; }
        for (int z = 0; z < (x - 2 * y); z++) { cout << 'D'; }
        for (int z = 0; z < y; z++) { cout << '*'; }
        cout << '\n';
    }
    for (int y = 0; y < x; y++) { cout << 'D'; }
    cout << '\n';
    for (int y = 1; y <= (x / 2); y++) {
        for (int z = 0; z < y; z++) { cout << '*'; }
        for (int z = 0; z < (x - 2 * y); z++) { cout << 'D'; }
        for (int z = 0; z < y; z++) { cout << '*'; }
        cout << '\n';
    }
}
[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 function f with parameters int a, int b
    x1 = integer, x1 = a / 10
    x2 = integer, x2 = remainder of a / 10
    x3 = integer, x3 = b / 10
    x2 = integer, x4 = remainder of b / 10
    if x1 equals x4 and x2 = x3, return 1
    return to indicate successful execution
end of the block
define the main function
    let a, b be integers
    let s be char
    read a, s, b
    if f(a, b) == 1
        print 0
    if last statement was false
        for int i = 1
            if b + 1 equals 60 and a is smaller than 23
                let b = 0
                add 1 to a
            else if a equals 23
                if b is greater than 32
                    print 60 - b
                    exit for loop
                if last statement was false
                    add one to b
            else
                add one to b
            end of the block
            if f(a, b) equals 1
                print i
                exit for loop
            end of the block
        end of the block
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int f(int a, int b) {
    int x1 = a / 10;
    int x2 = a % 10;
    int x3 = b / 10;
    int x4 = b % 10;
    if (x1 == x4 && x2 == x3) return 1;
    return 0;
}
int main() {
    int a, b;
    char s;
    cin >> a >> s >> b;
    if (f(a, b) == 1)
        cout << "0" << endl;
    else {
        for (int i = 1;; i++) {
            if (b + 1 == 60 && a < 23) {
                b = 0;
                a += 1;
            } else if (a == 23) {
                if (b > 32) {
                    cout << 60 - b << endl;
                    break;
                } else
                    b++;
            } else {
                b++;
            }
            if (f(a, b) == 1) {
                cout << i << endl;
                break;
            }
        }
    }
    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
    integer as n,x
    read n,x
    integer as pre = 0
    integer as i,val
    for = 0 to less than n do the following
        read val
        pre equals pre plus val
    end of the block
    integer as ans = 0
    if pre is greater than 0 then do the following
        set ans to (pre / x)
        if pre modulo x is greater than 0 then add one to ans
    end of the block
    if pre is less than 0 then do the following
        set ans to absolute value of pre / absolute value of x
        if absolute value of pre modulo absolute value of x is greater than 0 then add one to ans
    end of the block
    output ans
end of the block

[CODE]:

int main() {
    int n, x;
    cin >> n >> x;
    int pre = 0;
    int i, val;
    for (i = 0; i < n; i++) {
        cin >> val;
        pre += val;
    }
    int ans = 0;
    if (pre > 0) {
        ans = (pre / x);
        if (pre % x > 0) ans++;
    }
    if (pre < 0) {
        ans = (abs(pre) / abs(x));
        if (abs(pre) % abs(x) > 0) ans++;
    }
    cout << ans << 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
    declare integers n, y, y2, y3, y4
    read n
    for i = 1 + n to 9020 inclusive
        let y be i % 10
        let y2 be (i / 10) % 10
        let y3 be (i / 100) % 10
        let y4 be (i / 1000) % 10
        if y is not y2 and y is not y3 and y is not y4 and y2 is not y3 and y2 is not y4 and y3 is not y4
            print i and newline
            end loop
        end of the block
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, y, y2, y3, y4;
    cin >> n;
    for (int i = 1 + n; i <= 9020; i++) {
        y = i % 10;
        y2 = (i / 10) % 10;
        y3 = (i / 100) % 10;
        y4 = (i / 1000) % 10;
        if (y != y2 && y != y3 && y != y4 && y2 != y3 && y2 != y4 && y3 != y4) {
            cout << i << endl;
            break;
        }
    }
    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 array ara of size 100 with array of size 100
    create integers i, n, r, z, j, temp, and m
    for i = 0 to 5 exclusive
        for j = 0 to 5 exclusive, read ara[i][j]
    end of the block
    for i = 0 to 5 exclusive
        for j = 0 to 5 exclusive
            if ara[i][j] is equal to 1
                set m to 2 - i
                set n to 2 - j
            end of the block
        end of the block
    end of the block
    if n is less than 0, set n to n * (-1)
    if m is less than 0, set m to m * (-1)
    print m + n
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int ara[100][100];
    int i, n, r, z, j, temp, m;
    for (i = 0; i < 5; i++) {
        for (j = 0; j < 5; j++) { cin >> ara[i][j]; }
    }
    for (i = 0; i < 5; i++) {
        for (j = 0; j < 5; j++) {
            if (ara[i][j] == 1) {
                m = 2 - i;
                n = 2 - j;
            }
        }
    }
    if (n < 0) { n = n * (-1); }
    if (m < 0) { m = m * (-1); }
    cout << m + n << 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
    s = string
    read s
    n = int = size of s
    print ((26 * (n + 1)) - n)
end of the block

[CODE]:

int main() {
    string s;
    cin >> s;
    int n = s.size();
    cout << ((26 * (n + 1)) - n) << 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
    integers = n
    set int files to 0
    set int f to 0
    set int sum[500] to 0
    set int index to 0
    read n
    integers = a
    if n is not equal to 0 then do the following
        read a
        if a is less than 0 then increment f by 1
        if f is 3 then do the following
            files equals files plus 1
            set f to 1
            index equals index plus 1
        end of the block
        sum[index] equals sum[index] plus 1
    end of the block
    files equals files plus 1
    output files,endl
    for i = 0 to less than files - 1 then ouput sum[i] and a space
    output sum[files - 1]
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    int files = 0;
    int f = 0;
    int sum[500] = {0};
    int index = 0;
    cin >> n;
    int a;
    while (n-- != 0) {
        cin >> a;
        if (a < 0) { f += 1; }
        if (f == 3) {
            files += 1;
            f = 1;
            index += 1;
        }
        sum[index] += 1;
    }
    files += 1;
    cout << files << endl;
    for (int i = 0; i < files - 1; i++) { cout << sum[i] << ' '; }
    cout << sum[files - 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]:
let maxn be an int const = 1e9 + 7
let INF be an int const = 0x3f3f3f3f
let maxx be a const int = 1e5
in long long function poww that takes int a
    let k = 1, sum = 0 be both long long
    scale k by 2 for a times
    return k
end of the block
define the main function
    n, m = long long
    read n, m
    if n >= 35
        print m and new line
    else
        q = long long
        set q to poww with arg n
        print m mod q
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

const int maxn = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int maxx = 1e5;
long long poww(int a) {
    long long k = 1, sum = 0;
    for (int i = 0; i < a; i++) { k = k * 2; }
    return k;
}
int main() {
    long long n, m;
    cin >> n >> m;
    if (n >= 35) {
        cout << m << endl;
    } else {
        long long q;
        q = poww(n);
        cout << m % q << 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, sum = int
    num = int array of size 10 with values 2, 7, 2, 3, 3, 4, 2, 5, 1, 2
    loop while reading n
        if n < 10
            set sum to 2 * num[n]
        else
            set sum to num[n / 10] * num[n mod 10]
        end of the block
        print sum
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, sum;
    int num[10] = {2, 7, 2, 3, 3, 4, 2, 5, 1, 2};
    while (cin >> n) {
        if (n < 10) {
            sum = 2 * num[n];
        } else {
            sum = num[n / 10] * num[n % 10];
        }
        cout << sum << 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 new integer variable n
    read n from the user input
    print n % 2
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    cout << n % 2 << 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]:
declare long longs n, m, res, long long arrays a size 1010, c size 1010
define the main function
    read n, m
    for i = 1 to n inclusive, read c[i]
    for i = 1 to m inclusive, read a[i]
    declare long long neo = 1
    for i = 1 to m inclusive
        while neo is less than n and a[i] is less than c[neo], increment neo
        if c[neo] is less than or equal to a[i]
            increment res
            increment neo
        else
            end loop
        if neo is greater than n, end loop
    end of the block
    print res and newline
    return to indicate successful execution
end of the block

[CODE]:

long long n, m, a[1010], c[1010], res;
int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> c[i];
    for (int i = 1; i <= m; i++) cin >> a[i];
    long long neo = 1;
    for (int i = 1; i <= m; i++) {
        while (neo < n && a[i] < c[neo]) neo++;
        if (c[neo] <= a[i]) {
            res++;
            neo++;
        } else
            break;
        if (neo > n) break;
    }
    cout << res << 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 string str
    create integer array freq with size 26
    for i = 0 to 26 exclusive, set freq[i] to 0
    read str
    for i = 0 to size of str exclusive, increment freq[str[i]-'a']
    create integer sum with sum = 0
    for i = 0 to 26 exclusive
        if freq[i] is greater than 0, increment sum
    end of the block
    if sum % 2 is 0
        print "CHAT WITH HER!" print newline
    else
        print "IGNORE HIM!" print newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    string str;
    int freq[26];
    for (int i = 0; i < 26; i++) freq[i] = 0;
    cin >> str;
    for (int i = 0; i < str.size(); i++) ++freq[str[i] - 'a'];
    int sum = 0;
    for (int i = 0; i < 26; i++) {
        if (freq[i] > 0) sum++;
    }
    if (sum % 2 == 0)
        cout << "CHAT WITH HER!" << endl;
    else
        cout << "IGNORE HIM!" << endl;
    return 0;
}