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
    declare integer variable called n
    read n
    let a be an array of characters of size 60
    read a
    j is integer = 1
    for i = 0 to n exclusive, incrementing i by j
        print a[i]
        increase j by one
    end of the block
    print new line
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    char a[60];
    cin >> a;
    int j = 1;
    for (int i = 0; i < n; i = i + j) {
        cout << a[i];
        j++;
    }
    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, k = integers
    read n
    for a = 1 to n / 2
        k = n / 2 - a + 1
        for j = 1 to k, print *
        for j = 1 to n - k * 2, print D
        for j = 1 to k, print *
        print new line
    end of the block
    for a = 1 to n, print D
    print new line
    for a = 1 to n / 2
        for j = 1 to a, print *
        for j = 1 to n - a * 2, print D
        for j = 1 to a, print *
        print new line
    end of the block
end of the block

[CODE]:

int main() {
    int n, k;
    cin >> n;
    for (int a = 1; a <= n / 2; ++a) {
        k = n / 2 - a + 1;
        for (int j = 1; j <= k; ++j) cout << "*";
        for (int j = 1; j <= n - k * 2; ++j) cout << "D";
        for (int j = 1; j <= k; ++j) cout << "*";
        cout << endl;
    }
    for (int a = 1; a <= n; ++a) cout << "D";
    cout << endl;
    for (int a = 1; a <= n / 2; ++a) {
        for (int j = 1; j <= a; ++j) cout << "*";
        for (int j = 1; j <= n - a * 2; ++j) cout << "D";
        for (int j = 1; j <= a; ++j) cout << "*";
        cout << 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
    ley arr = array of booleans of size 505
    tambah = integer with value 1
    set first 500 elements of arr to 0
    loop i from 1 to 500 inclusive increasing by value of tambah
        set arr[i] to 1
        increase tambah
    end of the block
    create integer n
    read n
    if arr[n] exists
        print and "YES\n"
    else
        print "NO\n"
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    bool arr[505];
    int tambah = 1;
    for (int i = 0; i <= 500; i++) { arr[i] = 0; }
    for (int i = 1; i <= 500; i += tambah) {
        arr[i] = 1;
        tambah++;
    }
    int n;
    cin >> n;
    if (arr[n])
        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
    winner, spectator are integers
    n is an integer
    while read n
        flag equals boolean true
        spectator equals 3
        for integer i = 0 to n exclusive
            read winner
            if winner equals spectator
                flag equals false
            else
                i is an integer equal to 1
                while i equals winner or spectator
                spectator equals i
            end of the block
        end of the block
        if flag equals 0
            print YES and endline
        else
            print NO and endline
    end of the block
end of the block

[CODE]:

int main() {
    int winner, spectator;
    int n;
    while (cin >> n) {
        bool flag = true;
        spectator = 3;
        for (int i = 0; i < n; i++) {
            cin >> winner;
            if (winner == spectator)
                flag = false;
            else {
                int i = 1;
                while (i == winner || i == spectator) i++;
                spectator = i;
            }
        }
        if (flag)
            cout << "YES" << endl;
        else
            cout << "NO" << 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]:
debug = int with debug = 1
mod = const int with mod = 1e9 + 7
in function is_big taking char a and returning bool
    if a >= 'A' and a <= 'Z' return true
    return false
end of the block
in function solve
    n = int
    read n
    str = string
    read str
    read str
    maxx, now = int with maxx = 0 and now = 0
    for i = 0 to length of str as int
        if str[i] is 32
            set maxx to max of maxx, now
            set now to 0
        end of the block
        if is_big if str[i] increment now
    end of the block
    set maxx to max of maxx, now
    print maxx
end of the block
define the main function
    t = int with t = 1
    loop t times call solve
end of the block

[CODE]:

int debug = 1;
const int mod = 1e9 + 7;
bool is_big(char a) {
    if (a >= 'A' and a <= 'Z') return true;
    return false;
}
void solve() {
    int n;
    cin >> n;
    string str;
    getline(cin, str);
    getline(cin, str);
    int maxx = 0, now = 0;
    for (int i = 0; i < (int)str.length(); i++) {
        if (str[i] == 32) {
            maxx = max(maxx, now);
            now = 0;
        }
        if (is_big(str[i])) { now++; }
    }
    maxx = max(maxx, now);
    cout << maxx << endl;
}
int main() {
    int t = 1;
    while (t--) solve();
}
[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 i, j, m, a, s, d, c, b, n, x, p = 0, y, k = 0, integer arrays an size 1001, am size 1001
    read n and m
    for i = 0 to n exclusive, read an[i]
    for j = 0 to m exclusive, read am[j]
    for i = 0, j = 0 to n exclusive
        if am[j] is greater than or equal to an[i]
            increment k
            increment j
        end of the block
    end of the block
    if k is greater than m
        print m and newline
    else
        print k and newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int i, j, m, a, s, d, c, b, n, x, p = 0, y, k = 0, an[1001], am[1001];
    cin >> n >> m;
    for (i = 0; i < n; i++) { cin >> an[i]; }
    for (j = 0; j < m; j++) { cin >> am[j]; }
    for (i = 0, j = 0; i < n; i++) {
        if (am[j] >= an[i]) {
            k++;
            j++;
        }
    }
    if (k > m)
        cout << m << endl;
    else
        cout << k << 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]:
n, d, x, i, t = integers, a = array of integers of size 2010
define the main function
    read n and d
    for i from 0 to n
        read a[i]
        set t to 0 if a[i] > a[i - 1], otherwise set to (a[i - 1] - a[i]) / d + 1
        increase x by t
        increase a[i] by t * d
    end of the block
    print x and a new line
    return to indicate successful execution
end of the block

[CODE]:

int n, d, x, a[2010], i, t;
int main() {
    cin >> n >> d;
    for (i - 0; i < n; i++) {
        cin >> a[i];
        t = a[i] > a[i - 1] ? 0 : (a[i - 1] - a[i]) / d + 1;
        x += t;
        a[i] += t * d;
    }
    cout << 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]:
create ints n, x, y and z and array of integers sum with 3 elements
define the main function
    read n
    decrement n and loop further, while n != 0
        read x, y and z
        add x to sum[0]
        add y to sum[1]
        add z to sum[2]
    end of the block
    if sum[0], sum[1] and sum[2] are all false
        print "YES\n"
    else
        print "NO\n"
    return to indicate successful execution
end of the block

[CODE]:

int n, x, y, z, sum[3];
int main() {
    cin >> n;
    while (n--) {
        cin >> x >> y >> z;
        sum[0] += x;
        sum[1] += y;
        sum[2] += z;
    }
    if (!sum[0] && !sum[1] && !sum[2])
        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
    declare int variable n and int array x with size 105
    read n
    for i from 0 to n exclusive, read x[i]
    sort x
    Max and sum are integers with Max = x[n - 1] and sum = 0
    for i from 0 to n exclusive, add Max - x[i] to sum
    print sum
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, x[105];
    cin >> n;
    for (int i = 0; i < n; i++) { cin >> x[i]; }
    sort(x, x + n);
    int Max = x[n - 1], sum = 0;
    for (int i = 0; i < n; i++) { sum += Max - x[i]; }
    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
    n=int
    read n
    print 25
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    cout << "25" << 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]:
MAXN = 105 = const int
N, M = int
let arr be an int square matrix of size MAXN
votes = int array of length MAXN
ans = int
define the main function
    read N, M
    for i = 1 to M inclusive
        max = -1 = int
        index = int
        for j = 1 to N inclusive
            read arr[i][j]
            if arr[i][j] > max
                set max to arr[i][j]
                set index to j
            end of the block
        end of the block
        increment votes at index
    end of the block
    max = -1 = int
    for i = 1 to N inclusive
        if votes at i > max
            set max to votes at i
            set ans to i
        end of the block
    end of the block
    print ans
    return to indicate successful execution
end of the block

[CODE]:

const int MAXN = 105;
int N, M;
int arr[MAXN][MAXN];
int votes[MAXN];
int ans;
int main() {
    cin >> N >> M;
    for (int i = 1; i <= M; i++) {
        int max = -1;
        int index;
        for (int j = 1; j <= N; j++) {
            cin >> arr[i][j];
            if (arr[i][j] > max) {
                max = arr[i][j];
                index = j;
            }
        }
        votes[index]++;
    }
    int max = -1;
    for (int i = 1; i <= N; i++) {
        if (votes[i] > max) {
            max = votes[i];
            ans = i;
        }
    }
    cout << ans << 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 integers n, d
    read n read d
    create string s
    read s
    create integer array dp with size n
    for i = 0 to n exclusive, set dp[i] to 1e9
    set dp[0] to 0
    for i = 0 to size of s inclusive
        if s[i] is '1'
            for j = i - 1 to j is less than or equal to 0 and i - j is less than or equal to d, decrementing j
                if s[j] is 1, set dp[i] to minimum of dp[j] + 1 and dp[i]
            end of the block
        end of the block
    end of the block
    if dp[n-1] is 1e9
        print -1 print newline
    else
        print dp[n-1] print newline
end of the block

[CODE]:

int main() {
    int n, d;
    cin >> n >> d;
    string s;
    cin >> s;
    int dp[n];
    for (int i = 0; i < n; ++i) { dp[i] = 1e9; }
    dp[0] = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '1') {
            for (int j = i - 1; j >= 0 && i - j <= d; --j) {
                if (s[j] == '1') dp[i] = min(dp[j] + 1, dp[i]);
            }
        }
    }
    if (dp[n - 1] == 1e9)
        cout << -1 << endl;
    else
        cout << dp[n - 1] << 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 integer variables a and b
    read a and b and keep looping
        if a is greater than b, change a to b
        if a modulo 2 is 0
            print "Malvika"
        else
            print "Akshat"
    end of the block
end of the block

[CODE]:

int main() {
    int a, b;
    while (cin >> a >> b) {
        if (a > b) a = b;
        if (a % 2 == 0)
            cout << "Malvika" << endl;
        else
            cout << "Akshat" << endl;
    }
}