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
    let n, m, min1, max1, simmin , summax , o be integers with simmin = 0, summax = 0
    create a vector of integers by name of
    read n, m, min1, max1
    for integer y = 0 to m exclusive
        read o
        push_back o into of
    end of the block
    sort the values of.begin(), of.end()
    if min1 is not equal to of[0] , increment simmin by 1
    if min1 is greater than of[0]
        print Incorrect and newline
        return to indicate successful execution
    end of the block
    if max1 is less than of[m - 1]
        print Incorrect and newline
        return to indicate successful execution
    end of the block
    if max1 is not equal to of[m - 1] , increment summax by 1
    let sum be a integer with sum = simmin + summax
    if sum + m <= n
        print Correct and newline
        return to indicate successful execution
    else do the following
        print Incorrect and newline
        return to indicate successful execution
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, m, min1, max1, simmin = 0, summax = 0, o;
    vector<int> of;
    cin >> n >> m >> min1 >> max1;
    for (int y = 0; y < m; y++) {
        cin >> o;
        of.push_back(o);
    }
    sort(of.begin(), of.end());
    if (min1 != of[0]) { simmin++; }
    if (min1 > of[0]) {
        cout << "Incorrect" << endl;
        return 0;
    }
    if (max1 < of[m - 1]) {
        cout << "Incorrect" << endl;
        return 0;
    }
    if (max1 != of[m - 1]) { summax++; }
    int sum = simmin + summax;
    if (sum + m <= n) {
        cout << "Correct" << endl;
        return 0;
    } else {
        cout << "Incorrect" << endl;
        return 0;
    }
    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]:
n is an integer
chair be a character array of size 10000
define the main function
    read n
    a is an integer
    read input as chair+1
    let chair[0] be 0
    let chair[n+1] be 0
    let ans be integer with ans = 0
    if n=1 and chair[1]=0,
        print No and new line
        return to indicate successful execution
    end of the block
    if n=1 and chair[1]=1
        print Yes and new line
        return to indicate successful execution
    end of the block
    for integer i = 1 to n inclusive
        if chair[i] = 1 and either chair[i - 1] = 1 or chair[i + 1] =1
            let ans be 1
            stop
        end of the block
        if chair[i]=0,
            if chair[i - 1]= 0 and chair[i + 1] = 0,
                let ans be 1
                stop
            end of the block
        end of the block
    end of the block
    if ans equals 1,
        print No and new line
    else
        print yes and newline
end of the block

[CODE]:

int n;
char chair[10000];
int main() {
    cin >> n;
    int a;
    cin >> (chair + 1);
    chair[0] = '0';
    chair[n + 1] = '0';
    int ans = 0;
    if (n == 1 && chair[1] == '0') {
        cout << "No" << endl;
        return 0;
    }
    if (n == 1 && chair[1] == '1') {
        cout << "Yes" << endl;
        return 0;
    }
    for (int i = 1; i <= n; i++) {
        if (chair[i] == '1' && (chair[i - 1] == '1' || chair[i + 1] == '1')) {
            ans = 1;
            break;
        }
        if (chair[i] == '0') {
            if (chair[i - 1] == '0' && chair[i + 1] == '0') {
                ans = 1;
                break;
            }
        }
    }
    if (ans == 1)
        cout << "No" << endl;
    else
        cout << "Yes" << 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
    n = integer
    read n
    xay = character array of size n
    z = integers with z = 0
    for i = 0 to n exclusive
        s = character
        read xay[i]
        if xay[i] and s
            increment z
            s = 0
        else
            s = 0
        end of the block
        s = xay[i]
    end of the block
    print z
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    char xay[n];
    int z = 0;
    for (int i = 0; i < n; i++) {
        char s;
        cin >> xay[i];
        if (xay[i] == s) {
            z++;
            s = '\0';
        } else {
            s = '\0';
        }
        s = xay[i];
    }
    cout << z << 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
    n, t, k, d = int
    read n then t then k then d
    limit = long long with limit = ((n + k - 1) / k - 1) * t
    if d is less than limit
        print "YES"
    else
        print "NO"
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, t, k, d;
    cin >> n >> t >> k >> d;
    long long limit = ((n + k - 1) / k - 1) * t;
    if (d < limit) {
        cout << "YES\n";
    } else {
        cout << "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
    create integers a, b, x
    read a read b
    create string array die_roll with size 6, with die_roll = {"1/6", "1/3", "1/2", "2/3", "5/6", "1/1"}
    set x to maximum of a and b
    print die_roll[6-x] print newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int a, b, x;
    cin >> a >> b;
    string die_roll[6] = {"1/6", "1/3", "1/2", "2/3", "5/6", "1/1"};
    x = max(a, b);
    cout << die_roll[6 - 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
    create integer test with test = 1
    while decrement test is true
        create integers n, m, i, j, x, y, s, k, q, a, b, c with c = 0
        create long long integer sum with sum = 0
        read n
        for i = 0 to n exclusive
            read k
            increment sum by k
            set c to maximum of c and k
        end of the block
        set j to 1 if sum % ( n - 1 ) is greater than 0, else 0
        set sum to sum / ( n - 1 ) + j
        set sum to sum if sum is greater than c, else c
        print sum print "\n"
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int test = 1;
    while (test--) {
        int n, m, i, j, x, y, s, k, q, a, b, c = 0;
        long long int sum = 0;
        cin >> n;
        for (i = 0; i < n; i++) {
            cin >> k;
            sum += k;
            c = max(c, k);
        }
        j = sum % (n - 1) > 0 ? 1 : 0;
        sum = sum / (n - 1) + j;
        sum = sum > c ? sum : c;
        cout << sum << "\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]:
function bigmod with long long arguments a, p and m that returns long long
    if p = 0, return 1 modulo m
    declare new long long called x = result of bigmod(a, p/2, m)
    change x to x squared % m
    if p is odd, assign (x * a) modulo m to x
    return x modulo m
end of the block
create an array of long longs m with 256 elements, q with 266 elements and 2d array v with size 10009 by 266
define the main function
    create new strings a and b
    read input to a and b
    prepend " " to a
    start for loop from i = 'a' to 'z' inclusive, setting q[i] to length of a on each loop iteration
    start for loop from i = length of a to 0 inclusive decrementing i
        assign value of 1 to m[a[i]]
        in a for loop, change j from 'a' to 'z' inclusive, assigning q[j] to v[i][j] on each iteration
        set value of q[a[i]] to i
    end of the block
    declare new long longs c = 0 and an = 1
    for i from 0 to length of b - 1 inclusive incrementing i
        if m[b[i]] is equal to 0, return 0 and print "-1"
        assign v[c][b[i]] to c
        if c = length of a
            increment an
            change c to v[0][b[i]]
        end of the block
    end of the block
    print an to the standard output
end of the block

[CODE]:

long long bigmod(long long a, long long p, long long m) {
    if (p == 0) return 1 % m;
    long long x = bigmod(a, p / 2, m);
    x = (x * x) % m;
    if (p % 2) x = (x * a) % m;
    return x % m;
}
long long v[10009][266], q[266], m[256];
int main() {
    string a, b;
    cin >> a >> b;
    a = " " + a;
    for (int i = 'a'; i <= 'z'; i++) q[i] = a.size();
    for (int i = a.size(); i >= 0; i--) {
        m[a[i]] = 1;
        for (int j = 'a'; j <= 'z'; j++) v[i][j] = q[j];
        q[a[i]] = i;
    }
    long long c = 0, an = 1;
    for (int i = 0; i <= b.size() - 1; i++) {
        if (m[b[i]] == 0) return 0 & puts("-1");
        c = v[c][b[i]];
        if (c == a.size()) {
            an++;
            c = v[0][b[i]];
        }
    }
    cout << an << 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
    str is a new array of characters with 100 elements
    declare integers dif and ans with ans = 0
    read str
    declare new integer called len = length of str
    declare character cur = 'a'
    in a for loop, change i from 0 to len exclusive
        assign absoluve value of str[i] - cur to dif
        change ans to ans + min of dif and 26 - dif
        assign str[i] to cur
    end of the block
    print ans
end of the block

[CODE]:

int main() {
    char str[100];
    int dif, ans = 0;
    gets(str);
    int len = strlen(str);
    char cur = 'a';
    for (int i = 0; i < len; i++) {
        dif = abs(str[i] - cur);
        ans += min(dif, 26 - dif);
        cur = str[i];
    }
    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
    n, k, x, y, z = long long
    read n, k
    x = n / 2
    if (k + 1) > x
        print 0," ",0," ",n
    else
        y = x / (k + 1)
        z = y * k
        print y," ",z," ",(n - (z + y))
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    long long n, k, x, y, z;
    cin >> n >> k;
    x = n / 2;
    if ((k + 1) > x)
        cout << 0 << " " << 0 << " " << n << endl;
    else {
        y = x / (k + 1);
        z = y * k;
        cout << y << " " << z << " " << (n - (z + y)) << 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
    let q and b be long long
    let s be a char
    let num1 and num2 be long long = 0
    read q
    for long long i = 0 to q exclusive
        read n
        read s
        set num1 to s - 48
        if n is 2
            read s
            set num2 to s - 48
            is num1 >= num2
                print NO
            else
                print YES
                print 2
                print num1 and space and num2
            end of the block
        else
            print YES
            print 2
            print num1 and space
            for long long j = 1 to n excluded
                read s
                print s
            end of the block
            print new line
            set num2 to 0
            set num1 to 0
        end of the block
    end of the block
end of the block

[CODE]:

int main() {
    long long q, n;
    char s;
    long long num1, num2 = 0;
    cin >> q;
    for (long long i = 0; i < q; i++) {
        cin >> n;
        cin >> s;
        num1 = s - 48;
        if (n == 2) {
            cin >> s;
            num2 = s - 48;
            if (num1 >= num2)
                cout << "NO" << endl;
            else {
                cout << "YES" << endl;
                cout << 2 << endl;
                cout << num1 << " " << num2 << endl;
            }
        } else {
            cout << "YES" << endl;
            cout << 2 << endl;
            cout << num1 << " ";
            for (long long j = 1; j < n; j++) {
                cin >> s;
                cout << s;
            }
            cout << endl;
            num2 = 0;
            num1 = 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, c = long long with c = 0
    read n
    while decrement n
        p, q = long long with p = 0, q = 0
        read p, q
        if (q - p >= 2), increment c
    end of the block
    print c
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    long long n, c = 0;
    cin >> n;
    while (n--) {
        long long p = 0, q = 0;
        cin >> p >> q;
        if (q - p >= 2) c++;
    }
    cout << c << 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 longs n, m and a
    read n, m and a
    long long stones = (n / a) * (m / a)
    if n % a != 0 add m / a to stones
    if m % a != 0 add n / a to stones
    if m % a != 0 && n % a != 0 add 1 to stones
    print stones and a new line
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    long long n, m, a;
    cin >> n >> m >> a;
    long long stones = (n / a) * (m / a);
    if (n % a != 0) { stones += m / a; }
    if (m % a != 0) { stones += n / a; }
    if (m % a != 0 && n % a != 0) { ++stones; }
    cout << stones << 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
    i, j, n, max, count = ints with count = 1
    let a be a long long int array of length 100005
    read n
    set max to 1
    for i = 0 to n exclusive
        read a at i
        if a[i-1] < a at i and i isn't 0
            increment count
            if max < count the set max to count
        else
            set count to 1
    end of the block
    print max
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int i, j, n, max, count = 1;
    long long int a[100005];
    cin >> n;
    max = 1;
    for (i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i - 1] < a[i] && i != 0) {
            count++;
            if (max < count) max = count;
        } else
            count = 1;
    }
    cout << max << endl;
    return 0;
}