[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 k and an array x with size 3
    read x[0], x[1] and x[2] from the input
    sort x
    assign x[2] - x[0] to k
    print k
    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
    create string s
    read s
    make char cur = 'a'
    make int mn
    let integer ans = 0
    for i = 0 to s.length() exclusive
        set mn to min(abs(s[i] - cur), abs(26 - abs((s[i] - cur))))
        set ans to ans + mn
        set cur to s[i]
    end of the block
    display ans
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    string s;
    cin >> s;
    char cur = 'a';
    int mn;
    int ans = 0;
    for (int i = 0; i < s.length(); i++) {
        mn = min(abs(s[i] - cur), abs(26 - abs((s[i] - cur))));
        ans += mn;
        cur = s[i];
    }
    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]:
declare tostr with integer n as argument, returning string
    declare stringstream rr
    read n with rr
    return string from rr
end of the block
declare check_lucky with long long n as argument, returning integer
    while n is greater than 0
        if n % 10 is 8, return 1 from function
        let n be n / 10
    end of the block
    return to indicate successful execution
end of the block
define the main function
    declare long long a
    read a
    declare integer res = 0
    while result of run check_lucky( absolute value of a ) is false or res is 0
        increment res by 1
        increment a by 1
    end of the block
    print res and newline
    return to indicate successful execution
end of the block

[CODE]:

string tostr(int n) {
    stringstream rr;
    rr << n;
    return rr.str();
}
int check_lucky(long long n) {
    while (n > 0) {
        if (n % 10 == 8) { return 1; }
        n /= 10;
    }
    return 0;
}
int main() {
    long long a;
    cin >> a;
    int res = 0;
    while (!check_lucky(abs(a)) || (res == 0)) {
        res += 1;
        a += 1;
    }
    cout << res << endl;
    return 0;
}


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

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

[PSEUDOCODE]:
define the main function
    x, y, z = long long
    read x, y
    let z = (y - 1) / x
    add one to z
    print z
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    long long x, y, z;
    cin >> x >> y;
    z = (y - 1) / x;
    z++;
    cout << z << 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 variables x1, x2, y1 and y2
    declare integers diff1 and diff2
    read x1 and y1
    read x2 and y2
    set value of diff1 to absolute value of x2 - x1
    set diff2 to absolute value of y2 - y1
    if diff1 is greater than diff2
        print diff1
    else if diff2 is greater than diff1
        print diff2
    else if diff1 = diff2
        print diff1
    end of the block
end of the block

[CODE]:

int main() {
    int x1, x2, y1, y2;
    int diff1, diff2;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    diff1 = abs(x2 - x1);
    diff2 = abs(y2 - y1);
    if (diff1 > diff2) {
        cout << diff1 << endl;
    } else if (diff2 > diff1) {
        cout << diff2 << endl;
    } else if (diff1 == diff2) {
        cout << diff1 << 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 new int n and int array a with 1010 elements
    read n from the input
    read n sequential elements of a from the input
    sort a
    if a[0] - 1 <= 0
        print -1
    else
        print 1
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, a[1010];
    cin >> n;
    for (int i = 0; i < n; i++) { cin >> a[i]; }
    sort(a, a + n);
    if (a[0] - 1 <= 0) {
        cout << -1 << 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]:
create long long integers a, b, and c and long long array of size 100001
define the main function
    read a and b
    for i = 0 to a exclusive, read x[i] and set c to c + (x[i] + b - 1) / b
    print (c + 1) / 2
    return to indicate successful execution
end of the block

[CODE]:

long long a, b, c, x[100001];
int main() {
    cin >> a >> b;
    for (int i = 0; i < a; i++) cin >> x[i], c += (x[i] + b - 1) / b;
    cout << (c + 1) / 2 << 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
    count = 0 = int
    k = int array of length n
    read the first n elements of k
    mini, maxi = int
    for i = 0 to n exclusive
        if i = 0
            set mini to k[i]
            set maxi to k[i]
        end of the block
        if k[i] < mini
            increment count
            set mini to k[i]
        end of the block
        if k[i] > maxi
            increment count
            set maxi to k[i]
        end of the block
    end of the block
    print count
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    int count = 0;
    int k[n];
    for (int i = 0; i < n; i++) { cin >> k[i]; }
    int mini, maxi;
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            mini = k[i];
            maxi = k[i];
        }
        if (k[i] < mini) {
            count++;
            mini = k[i];
        }
        if (k[i] > maxi) {
            count++;
            maxi = k[i];
        }
    }
    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
    a,b = strings
    read a and b
    create integer x=0
    for i=0 to size of a exclusive
        if a[i] is equal to b[i] then continue
        if a[i] is equal to 8
            if b[i] is equal to (
                decrement x
            else do the following
                increment x
            end of the block
        else if a[i] is equal to (
            if b[i] is equal to [
                subtract 1 from x
            else do the following
                add 1 to x
            end of the block
        else do the following
            if b[i] is equal to (
                add 1 to x
            else do the following
                decrement x
        end of the block
    end of the block
    if x is 0 then print TIE else if x>0 print TEAM 1 WINS else print TEAM 2 WINS and 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]:
define the main function
    create strings n1 and n2
    read n1 and n2
    for i from 0 to length of n1 exclusive
        if n1[i] is equal to n2[i]
            change n1[i] to '0'
        else
            set n1[i] to '1'
        end of the block
    end of the block
    print n1
    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 integer sum
declare gcd with integers a, b as arguments, returning integer
    if a % b is 0, return b from function
    return result of run gcd with arguments b, a %b from function
end of the block
declare add with integers n, x as arguments, returning void
    while n is not 0
        increment sum by n % x
        set n to n / x
    end of the block
end of the block
define the main function
    create integer n
    read n
    for i = 2 to n exclusive, run add with n, i as arguments
    create integer div with div = result of run gcd with sum, n - 2 as arguments
    print sum / div print '/' print (n - 2)/div print newline
    return to indicate successful execution
end of the block

[CODE]:

int sum;
int gcd(int a, int b) {
    if (a % b == 0) return b;
    return gcd(b, a % b);
}
void add(int n, int x) {
    while (n != 0) {
        sum += n % x;
        n /= x;
    }
}
int main() {
    int n;
    cin >> n;
    for (int i = 2; i < n; i++) add(n, i);
    int div = gcd(sum, n - 2);
    cout << sum / div << '/' << (n - 2) / div << 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 multidimensional char array wb of size 10x10
    for i = 1 to 8 inclusive
        for j = 1 to 8 inclusive, read wb[i][j]
    end of the block
    create int judge = 1
    for i = 1 to 8 inclusive
        for j = 1 to 7 inclusive
            if wb[i][j] equals wb[i][j + 1], set judge to 0
        end of the block
    end of the block
    if judge equals 1
        print "YES"
    else
        print "NO"
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    char wb[10][10];
    for (int i = 1; i <= 8; i++) {
        for (int j = 1; j <= 8; j++) cin >> wb[i][j];
    }
    int judge = 1;
    for (int i = 1; i <= 8; i++) {
        for (int j = 1; j <= 7; j++) {
            if (wb[i][j] == wb[i][j + 1]) { judge = 0; }
        }
    }
    if (judge == 1) {
        cout << "YES" << endl;
    } else
        cout << "NO" << endl;
    return 0;
}

WBWBWBWB BWBWBWBW BWBWBWBW BWBWBWBW WBWBWBWB WBWBWBWB BWBWBWBW WBWBWBWB

WBWBWBWB WBWBWBWB BBWBWWWB BWBWBWBW BWBWBWBW BWBWBWWW BWBWBWBW BWBWBWBW

BWBWBWBW WBWBWBWB BWBWBWBW BWBWBWBW WBWBWBWB WBWBWBWB WBWBWBWB WBWBWBWB

BWBWBWBW WBWBWBWB BWBWBWBW WBWBWBWB BWBWBWBW WBWBWBWB WBWBWBWB WBWBWBWB

WBWBWBWB BWBWBWBW BWBWBWBW WBWBWBWB BWBWBWBW BWBWBWBW BWBWBWBW BWBWBWBW

WBWBWBWB WBWBWBWB BWBWBWBW WBWBWBWB WBWBWBWB WBWBWBWB WBWBWBWB BWWWBWBW

BBBBBWWW WBBWBWWB WWWWWBWW BWBWWBWW BBBWWBWW BBBBBWBW WBBBWBWB WBWBWWWB

BWBWBWBW BWBWBWBW BWWWWWBB BBWBWBWB WBWBWBWB WWBWWBWW BWBWBWBW WBWWBBBB

WBWBWBWB WBWBWBWB WBWBWBWB BWBWBWBW WBWBWBWB BWBWBWBW WBWBWBWB WBWWBWBB

WBWBWBWB BWBWBWBW WBWBWBWB BWBWBWBW WBWBWBWB WBWBWBWB BWBWBWBW BWBWBWBW

WBWBWBWB WBWBWBWB BWBWBWBW WBWBWBWB BWBWBWBW WBWBWBWB BWBWBWBW BWBWBWBW

WWWWBWWB BWBWBWBW BWBWBWBW WWBWBBBB BBWWBBBB BBBWWBBW BWWWWWWB BWWBBBWW

WBBWWBWB BBWBWBWB BWBWBWBW BWBWBWBW WBWBWBBW WBWBBBBW BWWWWBWB BBBBBBBW

BWBWBWBW BWBWBWBW BBWWWBBB WBBBBBWW WBBBBWBB WBWBWBWB WBWWBWWB WBBWBBWW

WBBBBBWB BWBWBWBW BWBWBWBW WBWBWBWB WBWBWBWB BBBBBWBB WBBWWBWB BWBWBWBW

BWBWBWBW BWBWBWBW BWBWBWBW WBWBWBWB WBWBWBWB BWBWBWBW BWBWBWBW WBBWWBWB

BWBWBWBW WBWBWBWB BWBWBWBW BWWWBWBW WBWBWBWB WBWBWBWB BWBWBWBW WBWBWBBW

WBWBWBWB WBWBWBWB BWBWBWBW BWBWBWBW BWBWBWBW BWBWBWBW WBWBWBWB BWBWBWBW

BWBWBWBW WBWBWBWB BWBWBWBW BWBWBWBW BWBWBWBW BWBWBWBW WBWBWBWB BWBWBWBW

BWBWBWBW BWBWBWBW WBWBWBWB BWBWBWBW WBWBWBWB BWBWBWBW WBWBWBWB BWBWBWBW

WWBBWWBB BWWBBWWB BWBWBWBW WWBBWWWB WBWWWWBB WBWWBBWB BWBBWBWW BWBWWWWW

WBWBWBWB WBWBWBWB WWBBWBBB WBWBWBWB WWWWBWWB WBBBBWWW BWBWWWBW WWWBWBBB

WBWBWBWB BWWBWWWW WBWBWBWB BWBWBWBW WBWBWBWB WWBBBBBW WWWBWWBW WWBBBBWW

BWBWBWBW BWBBBWWB WBWBWBWB BWBWBWBW BWBWBWBW BWBWBWBW WBWBWBWB BWBWBWBW

BWBWBWBW BWBWBWBW WBWBWBWB WBWBWBWB WBWBWBWB BWBWBWBW WBWBWBWB BWBWBWBW

BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB WWWWWWWW WWWWWWWW WWWWWWWW WWWWWWWW

BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB

BWBWBWBB BWBWBWBB BWBWBWBB BWBWBWBB BWBWBWBB BWBWBWBB BWBWBWBB BWBWBWBB

WWBWWBWB BWBWBWBW WBWBWBWB BWBWBWBW WBWBWBWB BWBWBWBW WBWBWBWB BWBWBWBW

WWWWWWWW BBBBBBBB WWWWWWWW BBBBBBBB WWWWWWWW BBBBBBBB WWWWWWWW BBBBBBBB

BBBBBBBB BWBWBWBW BWBWBWBW BWBWBWBW WBWBWBWB WBWBWBWB BWBWBWBW WBWBWBWB

BBBBBBBW BBBBBBBW BBBBBBBW BBBBBBBW BBBBBBBW BBBBBBBW BBBBBBBW BBBBBBBW

BBBWWWWW WWWBBBBB BBBWWWWW WWWBBBBB BWBWBWBW WBWBWBWB BWBWBWBW WBWBWBWB


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

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

[PSEUDOCODE]:
define the main function
    integer as n
    read n
    for i = 0 to less than n do the following
        integer as k = 0
        if i is less than (n / 2 then do the following + 1
            set k to i
        else
            set k to n - 1 - i
        for j = 1 to less than or equal to n do the following
            if abs is less than or equal to k then do the following
                output D
            else
                output *
        end of the block
        output endl
    end of the block
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int k = 0;
        if (i < (n / 2) + 1)
            k = i;
        else
            k = n - 1 - i;
        for (int j = 1; j <= n; j++) {
            if (abs(j - (n / 2) - 1) <= k)
                cout << "D";
            else
                cout << "*";
        }
        cout << endl;
    }
}

***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
    curr is a 2d array of integers 3 by 3 with elements 1, 1, 1, 1, 1, 1, 1, 1, 1
    actions is a 2d array of integers 3 by 3
    for i = 0 to 3 exclusive
        for j = 0 to 3 exclusive, read actions[i][j]
    end of the block
    for i = 0 to 3 exclusive
        for j = 0 to 3 exclusive
            if actions[i][j] is odd
                if curr[i][j] = 1
                    set curr[i][j] to 0
                else
                    assign 1 to curr[i][j]
                if j is greater than 0
                    if curr[i][j - 1] = 1
                        assign 0 to curr[i][j - 1]
                    else
                        assign 1 to curr[i][j - 1]
                end of the block
                if i is greater than 0
                    if curr[i - 1][j] = 1
                        assign 0 to curr[i - 1][j]
                    else
                        assign 1 to curr[i - 1][j]
                end of the block
                if j is less than 2
                    if curr[i][j + 1] = 1
                        change curr[i][j + 1] to 0
                    else
                        change curr[i][j + 1] to 1
                end of the block
                if i is less than 2
                    if curr[i + 1][j] is equal to 1
                        assign 0 to curr[i + 1][j]
                    else
                        assign 1 to curr[i + 1][j]
                end of the block
            end of the block
        end of the block
    end of the block
    for i from 0 to 3 exclusive
        for j = 0 to 3 exclusive, print curr[i][j]
        print new line
    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
    create integer count with count = 0, create integer array arr with size 4
    for i = 0 to 4 exclusive, read arr[i]
    for i = 0 to 3 exclusive
        if arr[i] is not 0
            for j = i + 1 to 4 exclusive
                if arr[i] is arr[j] and arr[j] is not 0
                    increment count
                    set arr[j] to 0
                end of the block
            end of the block
    end of the block
    print count print newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int count = 0, arr[4];
    for (int i = 0; i < 4; i++) cin >> arr[i];
    for (int i = 0; i < 3; i++) {
        if (arr[i] != 0)
            for (int j = i + 1; j < 4; j++) {
                if (arr[i] == arr[j] && arr[j] != 0) {
                    count++;
                    arr[j] = 0;
                }
            }
    }
    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 long long integers x1, y1, x2, y2, x, y
    read x1 read y1 read x2 read y2
    read x ready
    if absolute value of ( x2 - x1 ) % x is not 0 or absolute value of ( y2 - y1 ) % y is not 0
        print "NO\n"
        return to indicate successful execution
    end of the block
    if ((x2-x1) / x - (y2-y1) / y)%2 is 0
        print "YES\n"
    else
        print "NO\n"
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, m, x, y be integers
    read n, m, x, and y
    let a be a vector of ints
    set the size of a to n
    let b be a vector of ints
    set the size of b to m
    for i = 0 to n exclusive, read a[i]
    for i = 0 to m exclusive, read b[i]
    let count be an int with value 0
    let result be a vector of ints
    set the size of result to n
    let index be an int with value 0
    for i and j starting at 0, i < n and j < m
        if b[j] < a[i] - x
            increment j
        else if b > a[i] + y
            increment i
        else
            set result[i] to j + 1
            increment i
            increment j
            increment count
        end of the block
    end of the block
    print count
    for i = 1 to result.size() exclusive
        if result[i] is not 0
            print i + 1, then print a space, then print result[i]
            decrement count
        end of the block
        if count is 0 then break
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vector<int> a;
    a.resize(n);
    vector<int> b;
    b.resize(m);
    for (int i = 0; i < n; i++) { cin >> a[i]; }
    for (int i = 0; i < m; i++) { cin >> b[i]; }
    int count = 0;
    vector<int> result;
    result.resize(n);
    int index = 0;
    for (int i = 0, j = 0; i < n && j < m;) {
        if (b[j] < a[i] - x) {
            ++j;
        } else if (b[j] > a[i] + y) {
            ++i;
        } else {
            result[i] = j + 1;
            i++;
            j++;
            ++count;
        }
    }
    cout << count << "\n";
    for (int i = 0; i < result.size(); i++) {
        if (result[i] != 0) {
            cout << i + 1 << " " << result[i] << "\n";
            count--;
        }
        if (count == 0) break;
    }
    return 0;
}


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

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

[PSEUDOCODE]:
create integer vector array vec with size 3
create map like from string to integer
create integers diff, ans, a, b, c, create 2d integer array mat with size 10 by 10
declare cal
    create integers sum, i, j, k, with sum = 0
    for i = 0 to 3 exclusive
        for j = 0 to integer casted size of vec[i]
            for k = 0 to integer casted size of vec[i] exclusive, increment sum by mat[vec[i][j]][vec[i][k]]
    end of the block
    return sum from function
end of the block
declare count with integer now as argument, returning void
    if now is 7
        if size of vec[0] and size of vec[1] and size of vec[2]
            create integer array x with x = { a / size of vec[0], b / size of vec[1], c / size of vec[2] }
            sort elements from x to x + 3
            if x[2] - x[0] is less than diff
                set diff to x[2] - x[0]
                set ans to result of run cal
            else if x[2] - x[0] is diff
                set ans to maximum of ans and result of run cal
        end of the block
        return from function
    end of the block
    for i = 0 to 3 exclusive
        add element now to end of vec[i]
        run count with now + 1 as argument
        remove last element from vec[i]
    end of the block
end of the block
define the main function
    set like[ "Anka" ] to 0
    set like[ "Chapay" ] to 1
    set like[ "Cleo" ] to 2
    set like[ "Troll" ] to 3
    set like[ "Dracul" ] to 4
    set like[ "Snowy" ] to 5
    set like[ "Hexadecimal" ] to 6
    create integers n, i
    create strings name1, str, name2
    while read n is true
        set diff to ( 1 bitshift left 31 ) - 1
        for i = 0 to 3 exclusive, remove all elements from vec[i]
        set bytes from mat to size of mat to value 0
        for i = 0 to n exclusive
            read name1 read str read name2
            increment mat[like[name1]][like[name2]]
        end of the block
        read a read b read c
        run count with 0 as argument
        print diff print " " print ans print newline
    end of the block
end of the block

[CODE]:

vector<int> vec[3];
map<string, int> like;
int diff, mat[10][10], ans, a, b, c;
int cal() {
    int sum = 0, i, j, k;
    for (i = 0; i < 3; i++) {
        for (j = 0; j < (int)vec[i].size(); j++)
            for (k = 0; k < (int)vec[i].size(); k++) sum += mat[vec[i][j]][vec[i][k]];
    }
    return sum;
}
void count(int now) {
    if (now == 7) {
        if (vec[0].size() && vec[1].size() && vec[2].size()) {
            int x[] = {a / vec[0].size(), b / vec[1].size(), c / vec[2].size()};
            sort(x, x + 3);
            if (x[2] - x[0] < diff) {
                diff = x[2] - x[0];
                ans = cal();
            } else if (x[2] - x[0] == diff)
                ans = max(ans, cal());
        }
        return;
    }
    for (int i = 0; i < 3; i++) {
        vec[i].push_back(now);
        count(now + 1);
        vec[i].pop_back();
    }
}
int main() {
    like["Anka"] = 0;
    like["Chapay"] = 1;
    like["Cleo"] = 2;
    like["Troll"] = 3;
    like["Dracul"] = 4;
    like["Snowy"] = 5;
    like["Hexadecimal"] = 6;
    int n, i;
    string name1, str, name2;
    while (cin >> n) {
        diff = (1 << 31) - 1;
        for (i = 0; i < 3; i++) vec[i].clear();
        memset(mat, 0, sizeof(mat));
        for (i = 0; i < n; i++) {
            cin >> name1 >> str >> name2;
            mat[like[name1]][like[name2]]++;
        }
        cin >> a >> b >> c;
        count(0);
        cout << diff << " " << ans << endl;
    }
}

3
Troll likes Dracul
Dracul likes Anka
Snowy likes Hexadecimal
210 200 180

2
Anka likes Chapay
Chapay likes Anka
10000 50 50

11
Snowy likes Dracul
Anka likes Dracul
Chapay likes Snowy
Hexadecimal likes Troll
Anka likes Cleo
Chapay likes Dracul
Anka likes Chapay
Snowy likes Troll
Anka likes Hexadecimal
Cleo likes Chapay
Troll likes Cleo
100 100 100

14
Chapay likes Cleo
Cleo likes Anka
Dracul likes Snowy
Snowy likes Cleo
Chapay likes Anka
Snowy likes Anka
Chapay likes Troll
Troll likes Anka
Anka likes Snowy
Chapay likes Dracul
Dracul likes Anka
Hexadecimal likes Chapay
Snowy likes Dracul
Cleo likes Dracul
15 15 15

4
Anka likes Cleo
Snowy likes Cleo
Anka likes Hexadecimal
Cleo likes Snowy
1 1 1

8
Snowy likes Anka
Hexadecimal likes Snowy
Troll likes Dracul
Hexadecimal likes Troll
Snowy likes Troll
Anka likes Snowy
Snowy likes Chapay
Anka likes Chapay
70 70 70

3
Chapay likes Hexadecimal
Anka likes Cleo
Troll likes Snowy
15 15000 90

13
Cleo likes Hexadecimal
Cleo likes Snowy
Hexadecimal likes Anka
Anka likes Snowy
Troll likes Snowy
Chapay likes Hexadecimal
Hexadecimal likes Snowy
Snowy likes Chapay
Troll likes Cleo
Anka likes Hexadecimal
Hexadecimal likes Cleo
Chapay likes Dracul
Snowy likes Dracul
1000000000 2000000000 1000000000

12
Cleo likes Hexadecimal
Chapay likes Anka
Hexadecimal likes Cleo
Anka likes Snowy
Anka likes Cleo
Dracul likes Snowy
Anka likes Troll
Snowy likes Anka
Cleo likes Anka
Hexadecimal likes Troll
Hexadecimal likes Chapay
Snowy likes Troll
1000000000 1 2000000000

2
Snowy likes Hexadecimal
Troll likes Dracul
2000000000 2000000000 2000000000

12
Snowy likes Chapay
Cleo likes Dracul
Hexadecimal likes Snowy
Hexadecimal likes Anka
Dracul likes Chapay
Cleo likes Troll
Dracul likes Snowy
Snowy likes Dracul
Troll likes Chapay
Dracul likes Anka
Chapay likes Hexadecimal
Troll likes Dracul
436364663 856574374 347564737

12
Anka likes Dracul
Dracul likes Troll
Cleo likes Troll
Snowy likes Hexadecimal
Hexadecimal likes Chapay
Cleo likes Dracul
Cleo likes Chapay
Hexadecimal likes Anka
Snowy likes Cleo
Hexadecimal likes Snowy
Cleo likes Snowy
Chapay likes Snowy
584329075 428752235 675234087

8
Anka likes Chapay
Dracul likes Snowy
Snowy likes Cleo
Cleo likes Anka
Cleo likes Troll
Hexadecimal likes Troll
Troll likes Cleo
Snowy likes Dracul
325432666 254352394 547360304

18
Snowy likes Troll
Chapay likes Hexadecimal
Cleo likes Snowy
Dracul likes Snowy
Snowy likes Chapay
Troll likes Cleo
Snowy likes Anka
Dracul likes Hexadecimal
Hexadecimal likes Anka
Anka likes Hexadecimal
Anka likes Chapay
Troll likes Anka
Anka likes Snowy
Anka likes Troll
Snowy likes Cleo
Hexadecimal likes Troll
Hexadecimal likes Dracul
Cleo likes Anka
20000 1000 20000

6
Chapay likes Troll
Troll likes Cleo
Cleo likes Troll
Chapay likes Snowy
Anka likes Snowy
Troll likes Dracul
987499608 272739716 133573597

6
Anka likes Troll
Troll likes Chapay
Troll likes Hexadecimal
Hexadecimal likes Cleo
Snowy likes Hexadecimal
Chapay likes Troll
740076959 230477703 987799796

17
Cleo likes Dracul
Troll likes Cleo
Anka likes Chapay
Anka likes Troll
Chapay likes Snowy
Troll likes Snowy
Chapay likes Dracul
Hexadecimal likes Snowy
Dracul likes Snowy
Troll likes Hexadecimal
Hexadecimal likes Anka
Cleo likes Snowy
Hexadecimal likes Dracul
Snowy likes Chapay
Snowy likes Hexadecimal
Snowy likes Dracul
Dracul likes Troll
112909524 619275170 403563648

18
Anka likes Troll
Dracul likes Chapay
Hexadecimal likes Dracul
Chapay likes Dracul
Anka likes Hexadecimal
Snowy likes Cleo
Dracul likes Anka
Snowy likes Anka
Snowy likes Hexadecimal
Dracul likes Troll
Dracul likes Snowy
Hexadecimal likes Anka
Chapay likes Hexadecimal
Snowy likes Dracul
Cleo likes Snowy
Chapay likes Cleo
Anka likes Dracul
Troll likes Anka
838821770 712931449 361810998

18
Hexadecimal likes Chapay
Troll likes Dracul
Troll likes Snowy
Cleo likes Dracul
Chapay likes Snowy
Dracul likes Chapay
Cleo likes Snowy
Dracul likes Hexadecimal
Troll likes Anka
Anka likes Troll
Hexadecimal likes Dracul
Chapay likes Hexadecimal
Cleo likes Chapay
Anka likes Hexadecimal
Snowy likes Dracul
Chapay likes Troll
Anka likes Snowy
Dracul likes Cleo
240256138 922743697 38909902

16
Chapay likes Snowy
Hexadecimal likes Anka
Chapay likes Troll
Dracul likes Cleo
Troll likes Hexadecimal
Hexadecimal likes Dracul
Chapay likes Cleo
Snowy likes Cleo
Snowy likes Anka
Troll likes Chapay
Snowy likes Hexadecimal
Troll likes Snowy
Cleo likes Hexadecimal
Anka likes Snowy
Snowy likes Chapay
Anka likes Dracul
843382501 58524777 503038818

5
Troll likes Chapay
Anka likes Snowy
Anka likes Dracul
Chapay likes Anka
Snowy likes Troll
709201888 431802832 597079932

18
Cleo likes Snowy
Snowy likes Hexadecimal
Cleo likes Hexadecimal
Troll likes Dracul
Hexadecimal likes Snowy
Dracul likes Troll
Chapay likes Anka
Chapay likes Cleo
Troll likes Chapay
Hexadecimal likes Chapay
Anka likes Snowy
Troll likes Snowy
Dracul likes Snowy
Dracul likes Chapay
Chapay likes Troll
Cleo likes Troll
Hexadecimal likes Cleo
Anka likes Chapay
864225278 509037060 402199775

12
Cleo likes Hexadecimal
Troll likes Cleo
Anka likes Cleo
Hexadecimal likes Troll
Anka likes Snowy
Hexadecimal likes Anka
Troll likes Hexadecimal
Troll likes Anka
Dracul likes Cleo
Cleo likes Troll
Dracul likes Troll
Chapay likes Anka
762445890 377707484 324080158

21
Chapay likes Dracul
Snowy likes Chapay
Snowy likes Troll
Cleo likes Chapay
Cleo likes Troll
Chapay likes Cleo
Snowy likes Anka
Dracul likes Anka
Troll likes Snowy
Snowy likes Cleo
Chapay likes Hexadecimal
Cleo likes Anka
Cleo likes Snowy
Hexadecimal likes Cleo
Hexadecimal likes Snowy
Hexadecimal likes Anka
Hexadecimal likes Troll
Anka likes Snowy
Dracul likes Troll
Chapay likes Anka
Snowy likes Hexadecimal
482557397 502108264 750230216

6
Troll likes Chapay
Hexadecimal likes Snowy
Cleo likes Dracul
Cleo likes Anka
Chapay likes Anka
Anka likes Chapay
758376921 432619768 578580897

5
Chapay likes Cleo
Anka likes Hexadecimal
Anka likes Chapay
Cleo likes Troll
Anka likes Cleo
299076810 225593528 36830738

13
Anka likes Cleo
Cleo likes Troll
Chapay likes Cleo
Snowy likes Troll
Chapay likes Anka
Chapay likes Snowy
Snowy likes Chapay
Anka likes Snowy
Snowy likes Dracul
Cleo likes Hexadecimal
Dracul likes Chapay
Anka likes Hexadecimal
Snowy likes Cleo
554338888 280967932 682619964

17
Hexadecimal likes Chapay
Chapay likes Snowy
Chapay likes Troll
Anka likes Hexadecimal
Cleo likes Troll
Snowy likes Cleo
Cleo likes Anka
Cleo likes Hexadecimal
Anka likes Snowy
Chapay likes Hexadecimal
Anka likes Cleo
Dracul likes Snowy
Chapay likes Anka
Troll likes Hexadecimal
Troll likes Anka
Anka likes Dracul
Hexadecimal likes Anka
828886798 548024213 166661324

2
Troll likes Cleo
Anka likes Cleo
14344913 559182022 405430772

22
Cleo likes Snowy
Cleo likes Troll
Chapay likes Dracul
Snowy likes Troll
Dracul likes Chapay
Dracul likes Snowy
Chapay likes Cleo
Snowy likes Chapay
Dracul likes Troll
Anka likes Hexadecimal
Snowy likes Anka
Hexadecimal likes Cleo
Hexadecimal likes Troll
Dracul likes Anka
Cleo likes Hexadecimal
Hexadecimal likes Dracul
Chapay likes Troll
Chapay likes Hexadecimal
Anka likes Snowy
Troll likes Hexadecimal
Snowy likes Hexadecimal
Anka likes Chapay
458053183 602148195 994999698

5
Troll likes Dracul
Anka likes Chapay
Cleo likes Anka
Chapay likes Cleo
Snowy likes Hexadecimal
222 400 400


[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 constant integer inf with inf = integer casted 1e9
create constant integer mod with mod = inf + 7
create constant double eps with eps = 1e-9
create constant double pi with pi = acosign of -1.0
create integers r, g, b
define the main function
    read r read g read b
    create integer ans with ans = 30
    for i = 1 to 100000 exclusive
        if i % 3 is 1
            increment ans
            decrement r by 2
        end of the block
        if i % 3 is 2
            increment ans
            decrement g by 2
        end of the block
        if i % 3 is 0
            increment ans
            decrement b by 2
        end of the block
        if r is less than or equal to 0 and g is less than or equal to 0 and b is less than or equal to 0, return print ans -1 print newline, 0 from function
    end of the block
end of the block

[CODE]:

const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);
int r, g, b;
int main() {
    cin >> r >> g >> b;
    int ans = 30;
    for (int i = 1; i < 100000; ++i) {
        if (i % 3 == 1) {
            ans++;
            r -= 2;
        }
        if (i % 3 == 2) {
            ans++;
            g -= 2;
        }
        if (i % 3 == 0) {
            ans++;
            b -= 2;
        }
        if (r <= 0 && g <= 0 && b <= 0) return cout << ans - 1 << endl, 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 const int INF = 0x3f3f3f3f
create const long long INFLL = 0x3f3f3f3f3f3f3f3fLL
inlined long long function read
    create long longs x = 0 and f = 1
    read char from the input to the new char variable ch
    while ch is not a digit character
        if ch = '-', assign -1 to f
        read char from the input to ch
    end of the block
    while ch is a digit character
        assign x * 10 + ch - '0' to x
        read char from the input to ch
    end of the block
    return x * f
end of the block
declare const int maxn = 1e5 + 10
create integers m and k
declare integer arrays d, mx and s with size maxn
define the main function
    read m and k
    loop i from 1 to m inclusive read d[i]
    for i = 1 to m inclusive
        read s[i]
        change mx[i] to max(mx[i - 1], s[i])
    end of the block
    declare ints ans = 0 and now = s[1]
    for i = 1 to m inclusive
        while d[i] > now, increment now by mx[i] and ans by k
        subtract d[i] from now
        increase now by s[i + 1]
        increase ans by d[i]
    end of the block
    print ans
    return to indicate successful execution
end of the block

[CODE]:

const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3fLL;
inline long long read() {
    long long x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}
const int maxn = 1e5 + 10;
int m, k;
int d[maxn], mx[maxn], s[maxn];
int main() {
    cin >> m >> k;
    for (int i = 1; i <= m; i++) cin >> d[i];
    for (int i = 1; i <= m; i++) {
        cin >> s[i];
        mx[i] = max(mx[i - 1], s[i]);
    }
    int ans = 0, now = s[1];
    for (int i = 1; i <= m; i++) {
        while (d[i] > now) now += mx[i], ans += k;
        now -= d[i];
        now += s[i + 1];
        ans += d[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
    declare string variable str
    read input to str
    change str[0] to uppercase
    print str
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    string str;
    cin >> str;
    str[0] = (char)toupper(str[0]);
    cout << str << 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 long long variables n, k and count
let bisa be a vector of long longs
define the main function
    read n and k
    for long long i = 1 to square root of n inclusive
        if n % i = 0 && i * i != n
            push i into bisa
            push n / i into bisa
        end of the block
        if i * i = n, push i into bisa
    end of the block
    sort bisa
    if n = 1 && k is greater than 1
        print "-1"
    else if length of bisa >= k
        print bisa[k - 1]
    else
        print "-1"
    end of the block
end of the block

[CODE]:

long long n, k, count;
vector<long long> bisa;
int main() {
    cin >> n >> k;
    for (long long i = 1; i <= sqrt(n); i++) {
        if (n % i == 0 && i * i != n) {
            bisa.push_back(i);
            bisa.push_back(n / i);
        }
        if (i * i == n) { bisa.push_back(i); }
    }
    sort(bisa.begin(), bisa.end());
    if (n == 1 && k > 1) {
        cout << "-1" << endl;
    } else if (bisa.size() >= k) {
        cout << bisa[k - 1] << endl;
    } else {
        cout << "-1" << endl;
    }
}


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

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

[PSEUDOCODE]:
let a = array of integers of size 1000010
let inf = integer constant with value hexadecimal 3f3f3f3f
define the main function
    let n = integer
    while (read n) is true do the following
        let a, b = arrays of integers of size 310
        read a[0]
        let m = integer of value 0
        for integer i=1 to n exclusive do the following
            read a[i]
            set b[i] = a[i] - a[i-1]
            if b[i] is greater than m set m = b[i]
        end of the block
        let mi = integer with mi = inf
        for integer i=1 to n exclusive do the following
            set b[i] = b[i] + b[i+1]
            if b[i] is less than mi set mi = b[i]
        end of the block
        if mi is greater than m
            print mi
        else
            print m
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int a[1000010];
const int inf = 0x3f3f3f3f;
int main() {
    int n;
    while (cin >> n) {
        int a[310], b[310];
        cin >> a[0];
        int m = 0;
        for (int i = 1; i < n; i++) {
            cin >> a[i];
            b[i] = a[i] - a[i - 1];
            if (b[i] > m) m = b[i];
        }
        int mi = inf;
        for (int i = 1; i < n - 1; i++) {
            b[i] = b[i] + b[i + 1];
            if (b[i] < mi) mi = b[i];
        }
        if (mi > m)
            cout << mi << endl;
        else
            cout << m << 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, t, k, d be integers
    read n, t, k, d
    let k1, t1, i be integers with k1 = 0, t1 = t, i = -1
    increment d by t
    if k >= n
        print NO and newline
        return to indicate successful execution
    end of the block
    let counter be a integer with counter = ceiling ((float)n / k) * t
    while k1 is less than n
        if i is equal to t1
            increment k1 by k
            increment t1 by t
        end of the block
        if i is equal to d
            increment k1 by k
            increment d by t
        end of the block
        if k1 is less than n, increment i by 1
    end of the block
    if i is less than counter
        print YES and newline
    else do the following
        print NO and newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n, t, k, d;
    cin >> n >> t >> k >> d;
    int k1 = 0, t1 = t, i = -1;
    d += t;
    if (k >= n) {
        cout << "NO" << endl;
        return 0;
    }
    int counter = ceil((float)n / k) * t;
    while (k1 < n) {
        if (i == t1) {
            k1 += k;
            t1 += t;
        }
        if (i == d) {
            k1 += k;
            d += t;
        }
        if (k1 < n) ++i;
    }
    if (i < counter)
        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]:
define the main function
    declare long longs a, b
    input a and b
    if a is positive
        if b is positive
            display 0, ' ', a + b, ' '. a + b, ' ', 0
        else
            display 0, ' ', b - a, ' ', a - b, ' ', 0
    else
        if b is positive
            display a - b, ' ', 0, ' ', 0, ' ', b - a
        else
            display a + b, ' ', 0, ' ', 0, ' ', a + b
    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 my_gcd taking in ints x and y and returning integer
    if x is 0, return y
    return the return value of my_gcd(y % x, x)
end of the block
define the main function
    create ints n, m, and z
    read n, m, and z
    create integer lcm = n * m / my_gcd(n, m)
    print z / lcm
    return to indicate successful execution
end of the block

[CODE]:

int my_gcd(int x, int y) {
    if (x == 0) { return y; }
    return my_gcd(y % x, x);
}
int main() {
    int n, m, z;
    cin >> n >> m >> z;
    int lcm = n * m / my_gcd(n, m);
    cout << z / lcm << 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 integers k, n, x, a, ans
define the main function
    read k read n read x
    for i = 0 to k exclusive
        read a
        if k - n is less than or equal to i and a is greater than x
            increment ans by x
        else
            increment ans by a
    end of the block
    print ans print '\n'
end of the block

[CODE]:

int k, n, x, a, ans;
int main() {
    cin >> k >> n >> x;
    for (int i = 0; i < k; i++) {
        cin >> a;
        if (k - n <= i && a > x)
            ans += x;
        else
            ans += a;
    }
    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]:
declare long long variables n, t, e, f, g and y
create new 2d array of long longs Ta 5001 by 4, filled with 0
define the main function
    read from the input to n
    for x from 1 to n inclusive, incrementing x
        read t from the user input
        if t is equal to 1
            set the value of Ta[x - f - g][1] to x
            increment e by one
        else if t is equal to 2
            change the value of Ta[x - e - g][2] to x
            increment f
        else if t is equal to 3
            change Ta[x - e - f][3] to x
            increment g
        end of the block
    end of the block
    for x = 1 to n inclusive incrementing x
        if none of Ta[x][1, Ta[x][2] and Ta[x][3] is equal to 0, increment y
    end of the block
    if y = 0
        print "0" to the standard output
    else
        print y to the standard output
        for x = 1 to y inclusive, print Ta[x][1], " ", Ta[x][2], " " and Ta[x][3]
    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 new constant integer MAX_N with value 1000 + 10
declare 3d array of integers a with size MAX_N by 2 by 2, and b with size 4 by 2 by 2
check is a new array of booleans with MAX_N elements
boolean function hast with int arguments i and s
    change the value of b[0][0][0] to a[i][0][0]
    assign a[i][0][1] to b[0][0][1]
    change b[0][1][0] to a[i][1][0]
    set the value of b[0][1][1] to a[i][1][1]
    set the value of b[1][0][0] to a[i][1][0]
    assign the new value = a[i][0][0] to b[1][0][1]
    assign the new value = a[i][1][1] to b[1][1][0]
    change the value of b[1][1][1] to a[i][0][1]
    change b[2][0][0] to a[i][1][1]
    set b[2][0][1] to a[i][1][0]
    change the value of b[2][1][0] to a[i][0][1]
    change the value of b[2][1][1] to a[i][0][0]
    change b[3][0][0] to a[i][0][1]
    change the value of b[3][0][1] to a[i][1][1]
    assign the new value = a[i][0][0] to b[3][1][0]
    set b[3][1][1] to a[i][1][0]
    start for loop from i = 0 to 4 exclusive
        declare integer variable x with value 0
        start for loop from j = 0 to 2 exclusive incrementing j
            start for loop from t = 0 to 2 exclusive
                increment x if b[i][j][t] = a[s][j][t]
        if x is equal to 4, return true
    end of the block
    return false
end of the block
define the main function
    define integers n, aa, bb and ans where ans = 0
    create new string called s
    read variable n from the input
    for i from 0 to n exclusive
        read standard input to aa and bb
        if i is less than n - 1, read s
        set a[i][0][0] to aa / 10
        assign aa modulo 10 to a[i][0][1]
        set the value of a[i][1][0] to bb / 10
        set the value of a[i][1][1] to bb modulo 10
    end of the block
    start for loop from i = 0 to n exclusive incrementing i
        if check[i] is true, skip the rest of the loop
        in a for loop, change j from i+1 to n exclusive
            if hast(i, j) returned true, change the value of check[j] to true
    end of the block
    for i from 0 to n exclusive
        if check[i] is false, increment ans
    print ans
    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]:
gcd is a int function with int arguments a and b
    return a if b = 0, or gcd of b and a % b otherwise
end of the block
define the main function
    declare ints a, b, n, k and c with k = 0 and c = 2
    read a, b and n
    while n > 0
        if c is even
            set n to n - gcd of a and n
            change k to 0
            assign 1 to c
        else
            change n to n - gcd of b and n
            set k to 1
            change c to 2
        end of the block
    end of the block
    print k
end of the block

[CODE]:

int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}
int main() {
    int a, b, n, k = 0, c = 2;
    cin >> a >> b >> n;
    while (n > 0) {
        if (c % 2 == 0) {
            n = n - gcd(a, n);
            k = 0;
            c = 1;
        } else {
            n = n - gcd(b, n);
            k = 1;
            c = 2;
        }
    }
    cout << k << 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]:
create integer 2d array ch with 2000 by 2 elements
define the main function
    create integer n
    read n
    declare integer now = 1
    for integer i = 1 to n inclusive, read ch[i][0] and ch[i][1]
    for i = 1, increment i in a loop
        if i >= ch[now][0] && (i - ch[now][0]) % ch[now][1] = 0, increment num
        if now is greater than n
            print i
            return to indicate successful execution
        end of the block
    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
    declare integers N, sum = 0
    read N
    declare integer pointer H = new integer array size 100
    declare integer pointer A = new integer array size 100
    for i = 0 to N exclusive
        read H[i]
        read A[i]
    end of the block
    for i = 0 to N exclusive
        for j = 0 to N exclusive
            if H[i] is A[j], increment sum
        end of the block
    end of the block
    print sum and newline
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int N, sum = 0;
    cin >> N;
    int *H = new int[100];
    int *A = new int[100];
    for (int i = 0; i < N; i++) {
        cin >> H[i];
        cin >> A[i];
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (H[i] == A[j]) sum++;
        }
    }
    cout << sum << endl;
    return 0;
}


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

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

[PSEUDOCODE]:
define the main function
    create integer r,c, row=array of 0 of length 11, col = array of 0 of length 11
    Create string s
    Read r and c
    for (i=0 to r(exclusive))
        read s
        for (j=0 to c(exclusive))
            if(s[j] is 'S') execute
                row[i]=1
                col[j]=1
            end of the block
        end of the block
    end of the block
    Create integer cakes=0
    for (i=0 to r(exclusive))
        for (j=0 to c(exclusive))
            if(row[i]==0 or col[j]==0) increment cakes by 1
        end of the block
    end of the block
    print out cakes
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int r, c, row[11] = {0}, col[11] = {0};
    string s;
    cin >> r >> c;
    for (int i = 0; i < r; ++i) {
        cin >> s;
        for (int j = 0; j < c; ++j) {
            if (s[j] == 'S') {
                row[i] = 1;
                col[j] = 1;
            }
        }
    }
    int cakes(0);
    for (int i = 0; i < r; ++i) {
        for (int j = 0; j < c; ++j) {
            if (row[i] == 0 || col[j] == 0) { cakes += 1; }
        }
    }
    cout << cakes << endl;
    return 0;
}

10 10
SSSSSSSSSS
SSSSSSSSSS
SSSSSSSSSS
SSSSSSSSSS
SSSSSSSSSS
SSSSSSSSSS
SSSSSSSSSS
SSSSSSSSSS
SSSSSSSSSS
SSSSSSSSSS

9 5
SSSSS
SSSSS
SSSSS
SSSSS
SSSSS
SSSSS
SSSSS
SSSSS
SSSSS


[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 y, m and s be integer arrays with size 5
create integers ans, atkm, atky, mm, my, j, i and sum
define the main function
    for i = 1 to 3 inclusive, read y[i]
    for i = 1 to 3 inclusive, read m[i]
    for i = 1 to 3 inclusive, read s[i]
    ans = 999999
    for i = 0 to 200 inclusive
        for j = 0 to 200 inclusive
            sum = s[3] * j + s[2] * i
            atky = i + y[2] - m[3]
            atkm = m[2] - j - y[3]
            skip the rest of the loop if atky <= 0
            if atkm <= 0
                ans = min of ans and sum
                skip the rest of the loop
            end of the block
            if m[1] modulo atky != 0
                mm = m[1] / atky + 1
            else
                mm = m[1] / atky
            end of the block
            if y[1] modulo atkm != 0
                my = y[1] / atkm + 1
            else
                my = y[1] / atkm
            end of the block
            if my <= mm, increase sum by (mm * atkm + 1 - y[1]) * s[1]
            set ans to min of ans and sum
        end of the block
    end of the block
    print ans
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]:
set max_n to 100 + 10
create long long a[max_n]
create int n
create long long ans and x, set ans to 1e3
define the main function
    read n
    for i=0 to n exclusive, read a[i]
    for i=1 to n - 1 exclusive
        for j=1 to n exclusive
            if j equal to i
                set x to max of a[j + 1] - a[j - 1] and x
            else if j - 1 different from i
                assign max of a[j] - a[j - 1] and x to x
        end of the block
        set ans to min of ans and x
        x=0
    end of the block
    print ans and a newline
    return to indicate successful execution
end of the block

[CODE]:

const int max_n = 100 + 10;
long long a[max_n];
short int n;
long long ans = 1e3, x;
int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 1; i < n - 1; i++) {
        for (int j = 1; j < n; j++) {
            if (j == i)
                x = max(a[j + 1] - a[j - 1], x);
            else if (j - 1 != i)
                x = max(a[j] - a[j - 1], x);
        }
        ans = min(ans, x);
        x = 0;
    }
    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
    let y,b,r be integers
    read y,b and r
    for (int i is equal to r, i greater than or equal to 3, i--)
        if (i less than or equal to r and i - 1 less than or equal to b and i - 2 less than or equal to y)
            print 3 * i - 3 and newline
            stop
        end of the block
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int y, b, r;
    cin >> y >> b >> r;
    for (int i = r; i >= 3; i--) {
        if (i <= r && i - 1 <= b && i - 2 <= y) {
            cout << 3 * i - 3 << endl;
            break;
        }
    }
    return 0;
}


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

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

[PSEUDOCODE]:
define the main function
    define new integers n, k and m
    read user input to n, k and m
    declare an array of ints c with m + 2 elements and new variables i, j and r with r = m
    read m elements from the input to c starting from the index 1
    set c[m + 1] to n
    if m = 0, set r to n / k
    if m >= 1
        for i = 1 to m inclusive, increase r by (c[i] - c[i - 1] - 1) / k
        change r to r + (c[m + 1] - c[m]) / k
    end of the block
    print r
    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, t, a, ans = integers with a = array of size 1000000
define the main function
    read n, t
    for i = 1 to n
        read a[i]
        t = t - 86400 - a[i]
        if (t <= 0 and not ans), ans = i
    end of the block
    print ans
    return to indicate successful execution
end of the block

[CODE]:

int n, t, a[1000000], ans;
int main() {
    cin >> n >> t;
    for (register int i = 1; i <= n; i++) {
        cin >> a[i];
        t -= 86400 - a[i];
        if (t <= 0 && !ans) 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]:
declare count taking long long n and returning long long
    make long long ints k = n and s = 0
    while k is greater than 0
        set s to s + k % 10
        divide k by 10
    end of the block
    return s
end of the block
declare si taking in long long n and returning long long
    make long long integers k = n and s = 0
    while k is greater than 0
        increment s
        set k to k / 10
    end of the block
    return s
end of the block
make long long vector v of size 1000000
define the main function
    make long long ints n and i
    read n
    create long long ints k = 0 and m = n
    make long long int l = si(n)
    set i to n
    create long long int c = 0
    create long long vector p
    make long long ints j = 9 * l and q = 0
    while q is less than or equal to j
        increase q by 1
        create long long z = i + count(i)
        if z is equal to n
            increase c by 1
            append i to p
        end of the block
        decrease i by 1
    end of the block
    print c
    sort vector p
    for i = 0 to p.size() exclusive, print p[i]
end of the block

[CODE]:

long long count(long long n) {
    long long k = n, s = 0;
    while (k > 0) {
        s += k % 10;
        k /= 10;
    }
    return s;
}
long long si(long long n) {
    long long k = n, s = 0;
    while (k > 0) {
        s++;
        k /= 10;
    }
    return s;
}
vector<long long> v[1000000];
int main() {
    long long n, i;
    cin >> n;
    long long k = 0, m = n;
    long long l = si(n);
    i = n;
    long long c = 0;
    vector<long long> p;
    long long j = 9 * l, q = 0;
    while (q <= j) {
        q++;
        long long z = i + count(i);
        if (z == n) {
            c++;
            p.push_back(i);
        }
        i--;
    }
    cout << c << endl;
    sort(p.begin(), p.end());
    for (i = 0; i < p.size(); i++) cout << p[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]:
define the main function
    define ints a, m and d
    read m and d and loop
        if m = 1 or 3 or 5 or 7 or 8 or 10 or 12
            if (31 + d - 1) modulo 7 != 0
                print (31 + d - 1) / 7 + 1 to the output
            else
                print (31 + d - 1) / 7
        else if m is equal to 2
            if (28 + d - 1) % 7 is not 0
                print (28 + d - 1) / 7 + 1
            else
                print (28 + d - 1) / 7 to the standard output
        else if (30 + d - 1) % 7 != 0
            print (30 + d - 1) / 7 + 1
        else
            print (30 + d - 1) / 7 to the stdout
    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 long long integer = 200100, md = constant long long integer of size 998244353
define the main function
    n, h, a, b, k, ta, fa, tb, fb = long longs
    read n, h, a, b, k
    while looping decrease k by 1
        read ta, fa, tb, fb
        ans = long long = the absolute value of the result of ta - tb
        if ans is not zero
            if fa > b or fa < a
                ans = ans + the lower value between the absolute value of the result of fa - a + the absolute value of the result of fb - a, and the absolute value of the result of fa - b + the absolute value of the result of fb - b
            else if fb > b or fb < a
                ans = ans + the lower value between the absolute value of the result of fb - b + the absolute value of the result of fa - b, and the absolute value of the result of fb - a + the absolute value of the result of fa - a
            else
                ans = ans + the absolute value of the result of fa - fb
            end of the block
        else
            ans = ans + the absolute value of the result of fa - fb
        end of the block
        print ans
    end of the block
end of the block

[CODE]:

const long long MAXN = 200100, md = 998244353;
int main() {
    long long n, h, a, b, k, ta, fa, tb, fb;
    cin >> n >> h >> a >> b >> k;
    while (k--) {
        cin >> ta >> fa >> tb >> fb;
        long long ans = abs(ta - tb);
        if (ans != 0) {
            if (fa > b || fa < a) {
                ans += min(abs(fa - a) + abs(fb - a), abs(fa - b) + abs(fb - b));
            } else if (fb > b || fb < a) {
                ans += min(abs(fb - b) + abs(fa - b), abs(fb - a) + abs(fa - a));
            } else {
                ans += abs(fa - fb);
            }
        } else {
            ans += abs(fa - fb);
        }
        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]:
define the main function
    n = integer
    read n
    s = string
    read s
    sort string s
    print s
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    cout << s << endl;
}


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

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

[PSEUDOCODE]:
define the main function
    counter, k =integers with counter = 1, k = 0
    s, s1 = strings
    Read s1, s2
    c = character, set to s1[k]
    for x = 0 to length of string s2 exclusive
        if c is s2[x]
            increment counter
            set c to s1[++k]
        end of the block
    print counter and a new line
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int counter = 1, k = 0;
    string s1, s2;
    cin >> s1 >> s2;
    char c = s1[k];
    for (int x = 0; x < s2.length(); x++)
        if (c == s2[x]) {
            counter++;
            c = s1[++k];
        }
    cout << counter << endl;
    return 0;
}


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

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

[PSEUDOCODE]:
define the main function
    x=int
    read x
    if x is 1
        print -1
    else
        print x, space, x
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int x;
    cin >> x;
    if (x == 1)
        puts("-1");
    else
        cout << x << " " << x << endl;
    return 0;
}


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

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

[PSEUDOCODE]:
define the main function
    declare integer n
    read n
    declare set words containing long longs
    for i = 0 to n exlcusive
        declare string s
        read s
        define vector<bool> b with length of 26
        for j = 0 to s size exclusive do set b[s[j] - 'a'] to true
        define long long hash = 0, p = 1
        for int j = 0; j less than 26; increment j, p <<= 1 do add b[j] * p to hash
        insert hash into words
    end of the block
    print words size
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    set<long long> words;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        vector<bool> b(26);
        for (int j = 0; j < s.size(); j++) b[s[j] - 'a'] = true;
        long long hash = 0, p = 1;
        for (int j = 0; j < 26; j++, p <<= 1) hash += b[j] * p;
        words.insert(hash);
    }
    cout << words.size() << endl;
    return 0;
}

bebrmhdoznhakjudoi hylc hnzkxxfooufuno bkvj rkozimhcmzadr omsc ajcelmhtk mjnchbkqrbuz ihydermwbrsgytxfzdcylehjx vegkxvau tp lmutlyxkqaysxuji cjcjjkmgiwvwnexwmwi qmmkjt bdste vrnoxebytx jjtskzvmmytxdusg txhghrzuodnzy dtqtrswcmgocuchytpakxpjd juiwqvkownswa vmkkuhqvuhxjbyb dso peiobraqrzwvs lel ydvihlv ejnhbrscrgkacdewbfblw whcbauuluaruezarohdberlx kprstnxfwe b jjpytihgx hllwpib rcekilxlsdqpqzrxnuucasu kygmoteelkbe gafnns ufke acofjdfute igdokgbriwypes xqywkouwsyenolxkt azbbywqizyztqjqup ell

bc bcb aa aa b c bc acc c a cac aac cc cb c cca c c aa c

ecceieicc icicceic eieciceei eeeiceeie iiiiec eeciciceii iiceieeei ieecc iceeeeeici eiecei ecceii ccciicciee cieieeeee ieeccie iccieice eccciiciii cicii eiiee eieeiec cccecc eiiec eeeiiceeic eececicce eieeiie ciccei iceiecccci ceicieeece iieiiiic ceeeiic icciee cceeeicic icceieeci eeiiici iceieciccc cceee ciceceic eccieccii ceciiceecc iieeicccc eciiiiie iieiceeec ccecc eieciecc iiiic ciiei eeiiic eiccic cciieii eccic ecceeieeci

eebabaeegaab febcadgedaf fdfdgdcgcaa ffgdegadcgb cagacdfddeg eefaadccdag gadcddedcec adfgdaebgffg faadbcaefcaf ccecebffagf fdddbddddfeb fgdeefcafe bcgfbeddagd dacdbdagdbe bbcbbcddbb bcdafagdfgfg dfdegcdaefc dcdffegacb bdbdebgcfdfg egdbeebdacgg fabcgbcgddbf bdfecgaaefa fccabcaaaace geegbeegcagf bdagfdagfa eacffgfdfbad feebdfdbceca bbddbccfacea dbbeedgggeeb dcbegegdfe fadbdbfceee dcbgcdccffca egfeffdcgfc gbgeaagcdg debfaagefg ggadbaefeef gcebggbgcdae bggdbdgcdadg efefebeaebb gggbbaecfg fbfbffcfeceb fcaebecfdgb fdaaecgecdfb eaagfebcda cffffdabga fgbgbeggba aebcabdaff cccgcbgdeba agcefgceccce afgabdebee


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

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

[PSEUDOCODE]:
define the main function
    create ints p and n
    read p and n
    create vector of ints a with p elements
    loop i from 1 to n inclusive
        declare int val
        read input to val
        declare int variable mod = val modulo p
        if a[mod] is not 0
            print i
            return to indicate successful execution
        end of the block
        increment a[mod]
    end of the block
    print -1
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int p, n;
    cin >> p >> n;
    vector<int> a(p);
    for (int i = 1; i <= n; i++) {
        int val;
        cin >> val;
        int mod = val % p;
        if (a[mod]) {
            cout << i << endl;
            return 0;
        }
        a[mod]++;
    }
    cout << -1 << endl;
    return 0;
}