[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;
}

6
Jack captain
Alice woman
Charlie man
Teddy rat
Bob child
Julia woman

10
Cap captain
D child
C woman
A woman
E child
Man man
B child
F woman
Rat rat
Ratt rat

5
Joyxnkypf captain
Dxssgr woman
Keojmnpd rat
Gdv man
Hnw man

11
Jue rat
Wyglbyphk rat
Gjlgu child
Gi man
Attx rat
Theorpkgx man
Ym rat
X child
B captain
Enualf rat
Kktsgyuyv woman

Jue Wyglbyphk Attx Ym Enualf Gjlgu X Kktsgyuyv Gi Theorpkgx B

22
Wswwcvvm woman
Btmfats rat
I rat
Ocmtsnwx man
Urcqv rat
Yghnogt woman
Wtyfc man
Wqle child
Ujfrelpu rat
Dstixj man
Ahksnio woman
Khkvaap woman
Sjppvwm rat
Egdmsv rat
Dank rat
Nquicjnw rat
Lh captain
Tdyaqaqln rat
Qtj rat
Tfgwijvq rat
Nbiso child
Nqthvbf woman

Btmfats I Urcqv Ujfrelpu Sjppvwm Egdmsv Dank Nquicjnw Tdyaqaqln Qtj Tfgwijvq Wswwcvvm Yghnogt Wqle Ahksnio Khkvaap Nbiso Nqthvbf Ocmtsnwx Wtyfc Dstixj Lh

36
Kqxmtwmsf child
Ize woman
Dlpr child
K woman
F captain
Rjwfeuhba rat
Bbv rat
S rat
Mnmg woman
Smzyx woman
Sr man
Qmhroracn rat
Soqpuqock rat
Pibdq man
Ilrkrptx rat
Zaecfyqka man
Mmersfs child
Vvvocqi man
Hjeqxvq rat
Mpmb woman
Wmgu woman
Cerelmhoxi child
A man
Dylv man
Xrdgmmtcpq woman
Xj woman
Ceh child
Ofccguo man
Nevr man
Aknkwdkq child
Bmo man
Lqo woman
Vej child
T child
Rlijc man
Nsdtpdg woman

Rjwfeuhba Bbv S Qmhroracn Soqpuqock Ilrkrptx Hjeqxvq Kqxmtwmsf Ize Dlpr K Mnmg Smzyx Mmersfs Mpmb Wmgu Cerelmhoxi Xrdgmmtcpq Xj Ceh Aknkwdkq Lqo Vej T Nsdtpdg Sr Pibdq Zaecfyqka Vvvocqi A Dylv Ofccguo Nevr Bmo Rlijc F

6
Abdelrhman captain
Alice woman
Charlie man
Teddy rat
Bob child
Julia woman

Teddy Alice Bob Julia Charlie Abdelrhman

4
Aratos captain
Mind child
Aman woman
Carrot man


[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]:


[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;
}

5 5
W G B Y M
G B Y M C
B Y M C W
Y M C W G
M C W G B

5 5
W G B W G
G B W G B
B W G B W
W G B W G
G B W G B


[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]:


[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 = constant integer = 1005
a = integer array of size maxn, b = integer array of size maxn, fa = integer array of size maxn, fb = integer array of size maxn
define the main function
    n = integer
    read n
    for i = 1 to n inclusive
        read a[i]
        if i is 1
            fa[i] is a[i]
        else
            fa[i] = bitwise or of fa[i - 1] and a[i]
    end of the block
    for i = 1 to n inclusive
        read b[i]
        if i is 1
            fb[i] = b[i]
        else
            fb[i] = bitwise or of fb[i - 1] and b[i]
    end of the block
    res = long long = 0
    for i = 1 to n inclusive
        for j = 1 inclusive
            t = long long = fb[i] + fa[i] - fa[j - 1] - fb[j - 1]
            res = bigger value between res and t
        end of the block
    end of the block
    print res
    return to indicate successful execution
end of the block

[CODE]:

const int maxn = 1005;
int a[maxn], b[maxn], fa[maxn], fb[maxn];
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        if (i == 1)
            fa[i] = a[i];
        else
            fa[i] = fa[i - 1] | a[i];
    }
    for (int i = 1; i <= n; i++) {
        cin >> b[i];
        if (i == 1)
            fb[i] = b[i];
        else
            fb[i] = fb[i - 1] | b[i];
    }
    long long res = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= i; j++) {
            long long t = fb[i] + fa[i] - fa[j - 1] - fb[j - 1];
            res = max(res, t);
        }
    }
    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]:
create vector integer v
create integer arrays num, value, with num size 51, value size 51
define the main function
    create integers n, index with index = 1
    read n
    for i = 0 to n exclusive, read num[i]
    add element num[n-1] to end of v
    for i = n - 2 to 0 inclusive, decrementing i
        create integers j, flag with j = 0, flag = 0
        while j is less than size of v
            if num[i] is v[j]
                set flag to 1
                break loop
            end of the block
            increment j
        end of the block
        if not flag, add element num[i] to end of v
    end of the block
    print size of v print newline
    print v[size of v - 1]
    for i = size of v - 2 to 0 inclusive, decrementing i, print " " print v[i]
    print newline
end of the block

[CODE]:

vector<int> v;
int num[51], value[51];
int main() {
    int n, index = 1;
    cin >> n;
    for (int i = 0; i < n; i++) { cin >> num[i]; }
    v.push_back(num[n - 1]);
    for (int i = n - 2; i >= 0; i--) {
        int j = 0, flag = 0;
        while (j < v.size()) {
            if (num[i] == v[j]) {
                flag = 1;
                break;
            }
            j++;
        }
        if (!flag) v.push_back(num[i]);
    }
    cout << v.size() << endl;
    cout << v[v.size() - 1];
    for (int i = v.size() - 2; i >= 0; i--) cout << " " << v[i];
    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
    create integer m
    read m
    create integer x with x = 0
    for i = 1 to m inclusive
        create string s
        read s
        if s is "X++" or s is "++X"
            increment x
        else if s is "X--" or s is "--X"
            decrement x
    end of the block
    print x print newline
end of the block

[CODE]:


[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 ints n, v, sum and cnt
create int array ans with size 60 and 2d array s with 60 by 60
define the main function
    read user input to n and v
    change the value of sum to 0
    change cnt to 0
    start for loop from i1 = 0 to n exclusive
        create integer k
        read user input to k
        in a for loop, change i2 from 0 to k exclusive
            read s[i1][i2] from the user input
            increment sum if v is greater than s[i1][i2]
        end of the block
        if sum is greater than 0
            assign i1 + 1 to ans[cnt]
            increment cnt
        end of the block
        set sum to 0
    end of the block
    print cnt to the standard output
    for i2 = 0 to cnt exclusive
        if i2 != cnt - 1
            print ans[i2] and " " to the standard output
        else
            print ans[i2]
        end of the block
    end of the block
    return to indicate successful execution
end of the block

[CODE]:


[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 integer n
declare integer array arr size 100001
declare maxi = 0 as integer
declare solve with integer i as argument, returning integer
    if i is n, return 0
    declare integer ret = result of run solve ( i + 1 )
    if i is n - 1, return 1 from function
    if arr[i] is less than or equal to arr[i+1], return ret + 1
    let maxi be maximum of maxi and ret
    return 1 from function
end of the block
define the main function
    read n
    for i = 0 to n exclusive, read arr[i]
    declare integer ret = result of run solve(0)
    print maximum of ret and maxi, newline
    return to indicate successful execution
end of the block

[CODE]:

int n;
int arr[100001];
int maxi = 0;
int solve(int i) {
    if (i == n) return 0;
    int ret = solve(i + 1);
    if (i == n - 1) return 1;
    if (arr[i] <= arr[i + 1]) return ret + 1;
    maxi = max(maxi, ret);
    return 1;
}
int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> arr[i];
    int ret = solve(0);
    cout << max(ret, 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
    let m, a, b, c be integers
    read m
    for i = 1 to m inclusive
        read a
        if a >= 180 or a <= 0
            print NO with newline
            continue
        end of the block
        if (360 / (180 - a) - int of (360 / (180 - a))) <= 0
            print YES
        else
            print NO
        end of the block
    end of the block
end of the block

[CODE]:

YES NO NO NO NO NO NO YES NO NO NO YES YES NO NO YES NO YES NO NO

NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES NO NO NO

YES NO NO NO NO NO NO NO NO NO NO NO YES NO NO NO NO NO NO NO

YES NO NO NO NO NO NO NO NO NO NO NO YES YES NO NO NO NO NO NO

NO NO YES NO NO NO YES NO NO NO NO NO YES NO NO YES NO YES NO NO

NO NO NO NO NO NO YES NO NO NO NO YES NO NO NO


[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 n, m, mint and maxt
    read standard input to n, m, mint and maxt
    declare integer variables cmin and cmax
    read cmin
    assign the new value = cmin to cmax
    for i from 1 to m exclusive
        define new integer called a
        read standard input to a
        set cmin to min of cmin and a
        assign max of cmax and a to cmax
    end of the block
    begin try-catch block
        if cmin < mint or maxt < cmax, throw error with code 1
        if n - m is less than cmin != mint + cmax != maxt, throw error with code 1
        print "Correct\n"
    catch erorr and put it's code into new integer a, then print "Incorrect\n"
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, m, mint, maxt;
    cin >> n >> m >> mint >> maxt;
    int cmin, cmax;
    cin >> cmin;
    cmax = cmin;
    for (int i = 1; i < m; i++) {
        int a;
        cin >> a;
        cmin = min(cmin, a);
        cmax = max(cmax, a);
    }
    try {
        if (cmin < mint || maxt < cmax) throw 1;
        if (n - m < int(cmin != mint) + (cmax != maxt)) throw 1;
        cout << "Correct\n";
    } catch (int a) { cout << "Incorrect\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]:
str=array of 105 strings
define the main function
    n,m=int
    read n,m
    read str+1
    while m is not 0, decrement m
        l,r=int
        c1,c2=char
        read l,r,c1,c2
        for i=l to r inclusive
            if str[i] is c1 str[i]=c2
        end of the block
    end of the block
    print str+1
end of the block

[CODE]:

char str[105];
int main() {
    int n, m;
    cin >> n >> m;
    cin >> str + 1;
    while (m--) {
        int l, r;
        char c1, c2;
        cin >> l >> r >> c1 >> c2;
        for (int i = l; i <= r; ++i) {
            if (str[i] == c1) str[i] = c2;
        }
    }
    cout << str + 1 << endl;
}

9 51
bhfbdcgff
2 3 b b
2 8 e f
3 8 g f
5 7 d a
1 5 e b
3 4 g b
6 7 c d
3 6 e g
3 6 e h
5 6 a e
7 9 a c
4 9 a h
3 7 c b
6 9 b g
1 7 h b
4 5 a e
3 9 f a
1 2 c h
4 8 a c
3 5 e d
3 4 g f
2 3 d h
2 3 d e
1 7 d g
2 6 e g
2 3 d g
5 5 h h
2 8 g d
8 9 a f
5 9 c e
1 7 f d
1 6 e e
5 7 c a
8 9 b b
2 6 e b
6 6 g h
1 2 b b
1 5 a f
5 8 f h
1 5 e g
3 9 f h
6 8 g a
4 6 h g
1 5 f a
5 6 a c
4 8 e d
1 4 d g
7 8 b f
5 6 h b
3 9 c e
1 9 b a

5 16
acfbb
1 2 e f
2 5 a f
2 3 b e
4 4 f a
2 3 f a
1 2 b e
4 5 c d
2 4 e c
1 4 e a
1 3 d c
3 5 e b
3 5 e b
2 2 e d
1 3 e c
3 3 a e
1 5 a a

30 4
eaaddabedcbbcccddbabdecadcecce
2 17 c a
16 29 e e
16 21 c b
7 11 b c

7 17
bbaabab
3 5 a b
5 7 a a
5 5 a a
4 4 b a
7 7 a a
5 6 b b
1 3 b a
6 7 a b
4 6 a b
6 6 a a
2 4 b a
1 7 b a
4 6 b b
2 5 b b
2 5 a b
1 4 a a
4 4 b a


[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 called a
    for i from 1 to 5 inclusive
        in a for loop, change j from 1 to 5 inclusive incrementing j
            read input to a
            if a is equal to 1, print (abs(3 - i) + abs(3 - j)) to the output
        end of the block
end of the block

[CODE]:


[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
    number = integer
    sum = long
    ok is boolean = false
    read number
    if number is equal to 1 set ok to true
    for counter = 1 to number exclusive
        increase sum by counter
        if sum is equal to number set ok to true
    end of the block
    if ok is true
        print "YES" and a new line
    else
        print "NO" and a new line
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int number;
    long sum = 0;
    bool ok = false;
    cin >> number;
    if (number == 1) ok = true;
    for (int counter = 1; counter < number; ++counter) {
        sum += counter;
        if (sum == number) ok = true;
    }
    if (ok)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
create long longs c, v0, v1, a, l
declare input with no arguments, returning void
    read c read v0 read v1 read a read l
end of the block
define the main function
    run input
    create long long speed with speed = v0
    create long long cur with cur = 0
    create long long ans with ans = 0
    while cur is less than c
        if cur is true, decrement cur by l
        increment cur by speed
        set speed to minimum of speed + a and v1
        increment ans
    end of the block
    print ans print "\n"
end of the block

[CODE]:

long long c, v0, v1, a, l;
void input() {
    cin >> c >> v0 >> v1 >> a >> l;
}
int main() {
    input();
    long long speed = v0;
    long long cur = 0;
    long long ans = 0;
    while (cur < c) {
        if (cur) cur -= l;
        cur += speed;
        speed = min(speed + a, v1);
        ans++;
    }
    cout << ans << "\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]:
set MAX to 100000
set INF to 1000000001
create int a[MAX]
create integers n, s ans sum, set sum to 0
define the main function
    let count and temp be int, set count to 0
    read n
    for i=0 to n exclusive
        read temp
        assign temp to a[temp]
    end of the block
    for i=1 to 601 inclusive
        if a[i] different from 0, increment count
    print count
    return to indicate successful execution
end of the block

[CODE]:

const int MAX = 100000;
const int INF = 1000000001;
int a[MAX];
int n, s, sum = 0;
int main() {
    int count = 0, temp;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> temp;
        a[temp] = temp;
    }
    for (int i = 1; i <= 601; ++i)
        if (a[i]) count++;
    cout << count << 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 t
    let a, b and k be long long variables
    create long long ans
    read t
    for t iterations
        read a, b and k
        set ans to 0
        create bool even = true
        if k is even
            set ans to k / 2 * (a - b)
        else
            set ans to k / 2 * (a - b) + a
        print ans
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int t;
    long long a, b, k;
    long long ans;
    cin >> t;
    while (t--) {
        cin >> a >> b >> k;
        ans = 0;
        bool even = true;
        if (k % 2 == 0)
            ans = k / 2 * (a - b);
        else
            ans = k / 2 * (a - b) + a;
        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
    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]:

***D*** **DDD** *DDDDD* DDDDDDD *DDDDD* **DDD** ***D***

*****D***** ****DDD**** ***DDDDD*** **DDDDDDD** *DDDDDDDDD* DDDDDDDDDDD *DDDDDDDDD* **DDDDDDD** ***DDDDD*** ****DDD**** *****D*****

*******D******* ******DDD****** *****DDDDD***** ****DDDDDDD**** ***DDDDDDDDD*** **DDDDDDDDDDD** *DDDDDDDDDDDDD* DDDDDDDDDDDDDDD *DDDDDDDDDDDDD* **DDDDDDDDDDD** ***DDDDDDDDD*** ****DDDDDDD**** *****DDDDD***** ******DDD****** *******D*******

**********D********** *********DDD********* ********DDDDD******** *******DDDDDDD******* ******DDDDDDDDD****** *****DDDDDDDDDDD***** ****DDDDDDDDDDDDD**** ***DDDDDDDDDDDDDDD*** **DDDDDDDDDDDDDDDDD** *DDDDDDDDDDDDDDDDDDD* DDDDDDDDDDDDDDDDDDDDD *DDDDDDDDDDDDDDDDDDD* **DDDDDDDDDDDDDDDDD** ***DDDDDDDDDDDDDDD*** ****DDDDDDDDDDDDD**** *****DDDDDDDDDDD***** ******DDDDDDDDD****** *******DDDDDDD******* ********DDDDD******** *********DDD********* **********D**********

*************D************* ************DDD************ ***********DDDDD*********** **********DDDDDDD********** *********DDDDDDDDD********* ********DDDDDDDDDDD******** *******DDDDDDDDDDDDD******* ******DDDDDDDDDDDDDDD****** *****DDDDDDDDDDDDDDDDD***** ****DDDDDDDDDDDDDDDDDDD**** ***DDDDDDDDDDDDDDDDDDDDD*** **DDDDDDDDDDDDDDDDDDDDDDD** *DDDDDDDDDDDDDDDDDDDDDDDDD* DDDDDDDDDDDDDDDDDDDDDDDDDDD *DDDDDDDDDDDDDDDDDDDDDDDDD* **DDDDDDDDDDDDDDDDDDDDDDD** ***DDDDDDDDDDDDDDDDDDDDD*** ****DDDDDDDDDDDDDDDDDDD**** *****DDDDDDDDDDDDDDDDD***** ******DDDDDDDDDDDDDDD****** *******DDDDDDDDDDDDD******* ********DDDDDDDDDDD******** *********DDDDDDDDD********* **********DDDDDDD********** ***********DDDDD*********** ************DDD************ *************D*************

*****************D***************** ****************DDD**************** ***************DDDDD*************** **************DDDDDDD************** *************DDDDDDDDD************* ************DDDDDDDDDDD************ ***********DDDDDDDDDDDDD*********** **********DDDDDDDDDDDDDDD********** *********DDDDDDDDDDDDDDDDD********* ********DDDDDDDDDDDDDDDDDDD******** *******DDDDDDDDDDDDDDDDDDDDD******* ******DDDDDDDDDDDDDDDDDDDDDDD****** *****DDDDDDDDDDDDDDDDDDDDDDDDD***** ****DDDDDDDDDDDDDDDDDDDDDDDDDDD**** ***DDDDDDDDDDDDDDDDDDDDDDDDDDDDD*** **DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD** *DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD* DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD *DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD* **DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD** ***DDDDDDDDDDDDDDDDDDDDDDDDDDDDD*** ****DDDDDDDDDDDDDDDDDDDDDDDDDDD**** *****DDDDDDDDDDDDDDDDDDDDDDDDD***** ******DDDDDDDDDDDDDDDDDDDDDDD****** *******DDDDDDDDDDDDDDDDDDDDD******* ********DDDDDDDDDDDDDDDDDDD******** *********DDDDDDDDDDDDDDDDD********* **********DDDDDDDDDDDDDDD********** ***********DDDDDDDDDDDDD*********** ************DDDDDDDDDDD************ *************DDDDDDDDD************* **************DDDDDDD************** ***************DDDDD*************** ****************DDD**************** *****************D*****************


[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();
}

o A r v H e J q k J k v w Q F p O R y R Z o a K R L Z E H t X y X N y y p b x B m r R S q i A x V S u i c L y M n N X c C W Z m S j e w C w T r I S X T D F l w o k f t X u n W w p Z r A k I Y E h s g

ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ KLMNOPRSTU KLMNOPRSTU KLMNOPRSTU VWXYZABCDE KLMNOPRSTU KLMNOPRSTU KLMNOPRSTU KLMNOPRSTU KZ

sdfAZEZR AZE dfdf dsdRFGSDF ZZDZSD dfsd ERBGF dsfsdfR


[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]:


[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]:


[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]:


[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;
    }
}


[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 and b
    read a and b
    create integer sum = a + b
    create integer tempa = a
    declare integer variable tempb = b
    create integer i = 1
    create integer val = tempa
    create integer rem = 0
    declare integer rem1 = 0
    while val is greater than 0
        rem = val modulo 10
        divide val by 10
        if rem > 0
            increase rem1 by rem * i
            multiply i by 10
        end of the block
    end of the block
    declare integer newa = rem1
    set val to tempb
    set rem and rem1 to 0
    i = 1
    while val is greater than 0
        rem = val % 10
        divide val by 10
        if rem
            increase rem1 by rem * i
            multiply i by 10
        end of the block
    end of the block
    declare integer variable newb = rem1
    create integer newsum = newa + newb
    set val to sum
    rem and rem1 = 0
    set value of i to 1
    while val is greater than 0
        rem = val % 10
        divide val by 10
        if rem > 0
            increase rem1 by rem * i
            multiply i by 10
        end of the block
    end of the block
    if newsum = rem1
        print "YES"
    else
        print "NO"
    invoke function putchar with arguments '\n'
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int a, b;
    cin >> a >> b;
    int sum = a + b;
    int tempa = a;
    int tempb = b;
    int i = 1;
    int val = tempa;
    int rem = 0;
    int rem1 = 0;
    while (val > 0) {
        rem = val % 10;
        val = val / 10;
        if (rem) {
            rem1 = rem1 + rem * i;
            i = i * 10;
        }
    }
    int newa = rem1;
    val = tempb;
    rem1 = rem = 0;
    i = 1;
    while (val > 0) {
        rem = val % 10;
        val = val / 10;
        if (rem) {
            rem1 = rem1 + rem * i;
            i = i * 10;
        }
    }
    int newb = rem1;
    int newsum = newa + newb;
    val = sum;
    rem1 = rem = 0;
    i = 1;
    while (val > 0) {
        rem = val % 10;
        val = val / 10;
        if (rem) {
            rem1 = rem1 + rem * i;
            i = i * 10;
        }
    }
    if (newsum == rem1)
        cout << "YES";
    else
        cout << "NO";
    putchar('\n');
    return 0;
}


[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
define the main function
    create integer n
    read n
    create integer ans with ans = 0
    increment ans by n / 100
    set n to n % 100
    increment ans by n / 20
    set n to n % 20
    increment ans by n / 10
    set n to n % 10
    increment ans by n / 5
    set n to n % 5
    increment ans by n / 1
    set n to n % 100
    print ans print newline
end of the block

[CODE]:


[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 an int
    read N
    let ans an array of long longs of length 1000
    for i from 0 to N exclusive
        let a, b, and k long longs
        read a, b, and k
        if k is even
            set ans[i] to (a - b) * (k / 2)
        otherwise
            set ans[i] to (a - b) * (k / 2)
            add a to ans[i]
        end of the block
    end of the block
    print the first N values of ans
end of the block

[CODE]:

int main() {
    int N;
    cin >> N;
    long long ans[1000];
    for (int i = 0; i < N; i++) {
        long long a, b, k;
        cin >> a >> b >> k;
        if (k % 2 == 0) {
            ans[i] = (a - b) * (k / 2);
        } else {
            ans[i] = (a - b) * (k / 2);
            ans[i] += a;
        }
    }
    for (int i = 0; i < N; i++) cout << ans[i] << endl;
}


[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
void function READ with string arguments INPUT (default value "NO") and OUTPUT (default value "NO")
    if INPUT != "NO" open file INPUT.c_str() for reading
    if OUTPUT != "NO" open file OUTPUT.c_str() for writing
end of the block
let A be integer array with size 200001
declare string variables a and b
function ok with integer argument k that returns boolean
    mp = map from integer to boolean
    for i = 0 to k exclusive, mp[A[i]] = 1
    create integer id = 0
    for i = 0 while id < length of b and i < length of a
        if mp[i] is not 0, continue the loop
        if a[i] = b[id], increment id
    end of the block
    return true if id >= length of b, else return false
end of the block
define the main function
    read a and b
    for i = 0 to length of a exclusive
        read A[i]
        decrement A[i]
    end of the block
    declare integers l, r, m and ans where l = 0 and r = length of a
    while l <= r
        m = (l + r) >> 1
        if ok(m)
            set ans to m
            set l to m + 1
        else
            assign value of m - 1 to r
    end of the block
    print ans and "\n"
    return to indicate successful execution
end of the block

[CODE]:

void READ(string INPUT = "NO", string OUTPUT = "NO") {
    if (INPUT != "NO") freopen(INPUT.c_str(), "r", stdin);
    if (OUTPUT != "NO") freopen(OUTPUT.c_str(), "w", stdout);
}
int A[200001];
string a, b;
bool ok(int k) {
    map<int, bool> mp;
    for (int i = 0; i < k; i++) mp[A[i]] = 1;
    int id = 0;
    for (int i = 0; id < (int)b.size() && i < (int)a.size(); i++) {
        if (mp[i]) continue;
        if (a[i] == b[id]) id++;
    }
    return id >= (int)b.size();
}
int main() {
    cin >> a >> b;
    for (int i = 0; i < (int)a.size(); i++) {
        cin >> A[i];
        A[i]--;
    }
    int l = 0, r = (int)a.size(), m, ans;
    while (l <= r) {
        m = (l + r) >> 1;
        if (ok(m)) {
            ans = m;
            l = m + 1;
        } else
            r = m - 1;
    }
    cout << ans << "\n";
    return 0;
}


[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
create ints p, q, A, B, R, and i = 1 and int array C of size 2000000 containing {1, 1}
define the main function
    read p and q
    for loop i to 2e6 exclusive
        if C[i] is falsy
            set A to A + q
            for j = i to 2e6 exclusive by incrementing by i, set C[j] to 1
        end of the block
        make ints r = 0 and t = i
        for loop while t is truthy and increment by r = 10 * r + t % 10 and t /= 10
            end statement
        set B to B + p * (r == i )
        set R to A <= B ? i : R
    end of the block
    display R
end of the block

[CODE]:


[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, m, k, i, a, sum with sum = 0
    read n read m read k
    set a to m * 2
    for i = 1, incrementing i
        increment sum by a
        if k is less than sum
            print i print ' '
            break loop
        else if k is sum
            print i print m print ' ' print "R" print newline
            return to indicate successful execution
        end of the block
    end of the block
    decrement sum by a
    set a to k - sum
    if a % 2 is 1
        set a to a /2
        print a + 1 print ' ' print "L" print newline
    else if a % 2 is 0
        set a to a / 2
        print a print ' ' print "R" print newline
    end of the block
    return to indicate successful execution
end of the block

[CODE]:


[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 be a integer
    read n
    print n
    for ( i= 1 to n-1 inclusive ), print space and i
    print newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    cout << n;
    for (int i = 1; i <= n - 1; i++) cout << " " << i;
    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]:
in int function countSubseq taking a, b = string
    m = length of a = int
    n = length of b = int
    let dp be a matrix of sizes m+1, n+1, and set dp[0][0] = 0
    for i = 0 to n inclusive, increment i first, set dp[0][i] = 0
    for i = 0 to m inclusive, increment i first, set dp[i][0] = 1
    for i = 1 to m inclusive
        for j = 1 to n inclusive
            if a[i-1] = b[i-1]
                set dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j]
            else
                set dp[i][j] = dp[i - 1][j]
        end of the block
    end of the block
    return dp[m][n]
end of the block
define the main function
    n = string
    read n
    print countSubseq with args n, "QAQ"
    return to indicate successful execution
end of the block

[CODE]:

int countSubseq(string a, string b) {
    int m = a.length();
    int n = b.length();
    int dp[m + 1][n + 1] = {{0}};
    for (int i = 0; i <= n; ++i) dp[0][i] = 0;
    for (int i = 0; i <= m; ++i) dp[i][0] = 1;
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= n; j++) {
            if (a[i - 1] == b[j - 1])
                dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
            else
                dp[i][j] = dp[i - 1][j];
        }
    }
    return dp[m][n];
}
int main() {
    string n;
    cin >> n;
    cout << countSubseq(n, "QAQ") << 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
    l, u = int with l = 0 and u = 0
    for i = 0 to size of s
        if s[i] is a lower case letter
            increment l
        else
            increment u
    end of the block
    if l < u
        for i = 0 to size of s print toupper of s[i]
        print newline
    else
        for i = 0 to size of s print tolower of s[i]
        print newline
    end of the block
end of the block

[CODE]:

int main() {
    string s;
    cin >> s;
    int l = 0, u = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] >= 'a' && s[i] <= 'z')
            l++;
        else
            u++;
    }
    if (l < u) {
        for (int i = 0; i < s.size(); i++) cout << char(toupper(s[i]));
        cout << endl;
    } else {
        for (int i = 0; i < s.size(); i++) cout << char(tolower(s[i]));
        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
    create integers n1, n2, k1, k2
    read n1 read n2 read k1 read k2
    print "First" if n1 is greater than n2, else "Second", print '\n'
    return to indicate successful execution
end of the block

[CODE]:


[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 a be an int array of length 1010
define the main function
    let N, K be ints
    read N, K
    for i = 1 to N*2+1 inclusive the read a[i]
    let int k = 0
    for i = 2 to N*2 inclusive
        if a[i] > a[i - 1] + 1 and a[i] > a[i + 1] + 1
            decrement a at i
            increment k
            if k is same as K, exit loop
        end of the block
    end of the block
    for i = 1 to N * 2, print a at i and space
    print a[N * 2 + 1]
    return to indicate successful execution
end of the block

[CODE]:


[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
create int n and d
create int a[105]
define the main function
    while read n and d
        for i=0 to n exclusive, read a[i]
        sort elements between a and a + n
        maxlen=0
        for i=0 to n exclusive
            thislen = 1
            for j=i+1 to n exclusive
                if a[j] - a[i] > d, break
                increment thislen
            end of the block
            set maxlen to max(thislen, maxlen)
        end of the block
        print n - maxlen
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int n, d;
int a[105];
int main() {
    while (cin >> n >> d) {
        for (int i = 0; i < n; ++i) cin >> a[i];
        sort(a, a + n);
        int maxlen = 0;
        for (int i = 0; i < n; ++i) {
            int thislen = 1;
            for (int j = i + 1; j < n; ++j) {
                if (a[j] - a[i] > d) break;
                thislen++;
            }
            maxlen = max(thislen, maxlen);
        }
        cout << n - maxlen << 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 n be a long integer
    read n
    if n modulo 2 is equal to 0
        print 2 and newline
    else do the following
        print 1 and newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    long long n;
    cin >> n;
    if (n % 2 == 0)
        cout << 2 << endl;
    else
        cout << 1 << endl;
    return 0;
}


[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
define the main function
    create integers n, x, sum and cont with sum and cont = 0, and an array a with size 1005
    read variables n and x from the input
    for i from 0 to n exclusive incrementing i
        read standard input to a[i]
        increase sum by a[i]
    end of the block
    declare integer baad with value x
    change sum to it's absolute value
    while sum is not 0
        while sum < x, decrement x
        subtract x from sum
        increment cont by one
    end of the block
    print cont
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, x, a[1005], sum = 0, cont = 0;
    cin >> n >> x;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    int baad = x;
    sum = abs(sum);
    while (sum != 0) {
        while (sum < x) x--;
        sum -= x;
        cont++;
    }
    cout << cont << endl;
    return 0;
}


[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
declare new int variables player1, player2 and player3
declare integer variable with name n
new integer variable a
define the main function
    read n from the input
    assign 1 to player1
    set player2 to 2
    change player3 to 3
    loop, decrementing n, while it is not 0
        read from the input to a
        if a is equal to player3
            print "NO\n" to the standard output
            return to indicate successful execution
        end of the block
        if a = player1
            swap player3 and player2
        else
            swap player3 and player1
    end of the block
    print "YES\n" to the standard output
    return to indicate successful execution
end of the block

[CODE]:

int player1, player2, player3;
int n;
int a;
int main() {
    cin >> n;
    player1 = 1;
    player2 = 2;
    player3 = 3;
    while (n--) {
        cin >> a;
        if (a == player3) {
            cout << "NO\n";
            return 0;
        }
        if (a == player1)
            swap(player3, player2);
        else
            swap(player3, player1);
    }
    cout << "YES\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]:
n, m, a, b and c are long longs
declare long longs Yellow, Blue and ans
define the main function
    read n, m, a, b and c
    Yellow = a * 2 + b
    Blue = b + c * 3
    if Yellow >= n and Blue >= m
        increase ans by Yellow + Blue - n - m
    else if Yellow < n and Blue is greater than m
        increase ans by Blue - m
    else if Yellow > n and Blue is less than m
        increase ans by Yellow - n
    print ans and a new line
    return to indicate successful execution
end of the block

[CODE]:

long long n, m, a, b, c;
long long Yellow, Blue, ans;
int main() {
    cin >> n >> m >> a >> b >> c;
    Yellow = a * 2 + b;
    Blue = b + c * 3;
    if (Yellow >= n && Blue >= m)
        ans += Yellow + Blue - n - m;
    else if (Yellow < n && Blue > m)
        ans += Blue - m;
    else if (Yellow > n && Blue < m)
        ans += Yellow - n;
    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
    x1, y1, x2, y2 = int
    read x1 then y1 then x2 then y2
    ans = int with ans = min of absolute x1 - x2 and absolute y1 - y2
    if absolute x1 - x2 is not ans
        add absolute of absolute of x2 - x1 - ans to ans
    else if absolute of y1 - y2 is not ans
        add absolute of absolute of y2 - y1 - ans to ans
    end of the block
    print ans
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int ans = min(abs(x1 - x2), abs(y1 - y2));
    if (abs(x1 - x2) != ans) {
        ans += abs(abs(x2 - x1) - ans);
    } else if (abs(y1 - y2) != ans) {
        ans += abs(abs(y2 - y1) - ans);
    }
    cout << ans << '\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
    integers = n,i,j,k
    integers = array x any y with size of 101
    while inputting n do
        for = 0 to less than or equal to 100 set x[i] = y[i] = 0
        for = 0 to less than n do the following
            read j,k
            add one to x[j]
            add one to y[k]
        end of the block
        set j to k
        for = 0 to less than or equal to 100 do the following
            if x[i] is true
            if y[i] is true
        end of the block
        output j if j < k else output k
        output endl
    end of the block
    return to indicate successful execution
end of the block

[CODE]:


[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 pair array of int and int a of size 10001
declare drom taking in int r and returning integer
    if a[r].first is not 0
        create int u = r
        set r to a[r].first
        if a[r].second is not 0
            set a[r].second to min of a[r].second and a[u]second
        else do
            set a[r].second to a[u].second
        set a[u].first to 0
    else
        return r
    set r to return value of drom(r)
    return r
end of the block
make ints n, t, and l
define the main function
    read n and t
    while t is not equal to 0
        make ints x, y, and z
        read x, y, and z
        set a[x].first to y
        set a[x].second to z
        decrease t by 1
    end of the block
    for i = 1 to n
        make int m = drom(i)
        if m is not equal to i
            set a[i].first to m
            set a[i].second to a[m].second
        else do
            set first value of a[i] to 0
        end of the block
    end of the block
    for i = 1 to n
        if a[i].first is not equal to 0, increment l
    print l
    for i = 1 to n
        if a[i].first is not equal to 0, print i, " ", a[i].first, " ", and a[i].second
end of the block

[CODE]:

pair<int, int> a[10001];
int drom(int r) {
    if (a[r].first != 0) {
        int u = r;
        r = a[r].first;
        if (a[r].second != 0)
            a[r].second = min(a[r].second, a[u].second);
        else
            a[r].second = a[u].second;
        a[u].first = 0;
    } else
        return r;
    r = drom(r);
    return r;
}
int n, t, l;
int main() {
    cin >> n >> t;
    while (t != 0) {
        int x, y, z;
        cin >> x >> y >> z;
        a[x].first = y;
        a[x].second = z;
        t--;
    }
    for (int i = 1; i <= n; ++i) {
        int m = drom(i);
        if (m != i) {
            a[i].first = m;
            a[i].second = a[m].second;
        } else {
            a[i].first = 0;
        }
    }
    for (int i = 1; i <= n; ++i)
        if (a[i].first != 0) l++;
    cout << l << endl;
    for (int i = 1; i <= n; ++i)
        if (a[i].first != 0) cout << i << " " << a[i].first << " " << a[i].second << 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
    for i = 0 to i * (i - 1) / 2 <= n
        if i * (i - 1) / 2 is equal to n return !(cout << "YES\n")
    return !(cout << "NO\n")
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    for (int i = 0; i * (i - 1) / 2 <= n; i++)
        if (i * (i - 1) / 2 == n) return !(cout << "YES\n");
    return !(cout << "NO\n");
}