p533.ans1
======================
3

=================
p533.ans2
======================
-1

=================
p533.ans3
======================
2

=================
p533.cpp
======================
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

int n;

void read() { cin >> n; }

void solve() {
    // The four side faces of one die always sum to 14 (the six faces sum to 21
    // and the hidden top/bottom pair sums to 7). So a tower of h dice exposes
    // 14 * h dots on its sides, plus the very top face and the very bottom
    // face. For h >= 2 those two extreme faces are independent, each in 1..6,
    // contributing any s in [2, 12]; thus n = 14 * h + s with s = n % 14 forces
    // s to lie in [2, 12]. For h = 1 the top and bottom are opposite faces of
    // the same die and sum to exactly 7, so the only achievable total is 21.

    int num_dice = n / 14;
    int rem = n % 14;

    if(num_dice == 1 && n != 21) {
        cout << -1 << '\n';
    } else if(num_dice == 0 || rem <= 1 || rem == 13) {
        cout << -1 << '\n';
    } else {
        cout << num_dice << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}

=================
p533.in1
======================
50

=================
p533.in2
======================
7

=================
p533.in3
======================
32

=================
statement.txt
======================
533. Dice Tower
Time limit per test: 1 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard

Polycarp loves not only to play games, but to invent ones as well. He has recently been presented with a board game which also had lots of dice. Polycarp quickly noticed an interesting phenomenon: the sum of dots on any two opposite sides equals 7.


The dice

An unfolded die
Polycarp invented the following game. He asks somebody to tell a positive integer n and then he constructs a dice tower putting the dice one on another one. A tower is constructed like that: Polycarp puts a die on the table and then (if he wants) he adds more dice, each time stacking a new die on the top of the tower. The dice in the tower are aligned by their edges so that they form a perfect rectangular parallelepiped. The parallelepiped's height equals the number of dice in the tower and two other dimensions equal 1 (if we accept that a die's side is equal to 1).


An example of a tower whose height equals 3
Polycarp's aim is to build a tower of minimum height given that the sum of points on all its outer surface should equal the given number n (outer surface: the side surface, the top and bottom faces).

Write a program that would determine the minimum number of dice in the required tower by the given number n. Polycarp can construct any towers whose height equals 1 or more.

Input
The only input line contains integer n (1 ≤ n ≤ 106).

Output
Print the only integer — the number of dice in the required tower. If no such tower exists, print -1.

Example(s)
sample input
sample output
50
3

sample input
sample output
7
-1

sample input
sample output
32
2

=================
