Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- #define pb push_back
- #define ft first
- #define sd second
- #define all(x) begin((x)), end((x))
- #define forn(i, n) for (int (i) = 0; (i) < (n); ++(i))
- #define isz(x) (int)(x).size()
- /* <-------------------> */
- const ll MAX = 2e7;
- bool us[(int)MAX];
- vector<int> p;
- void solve() {
- for (ll i = 2; i < MAX; ++i) if (!us[i]) {
- p.pb((int)i);
- for (ll j = i * i; j < MAX; j += i) {
- us[j] = true;
- }
- }
- int n, m = isz(p), x = 0;
- cin >> n;
- forn (i, m) while (n % p[i] == 0) {
- x ^= i + 1;
- n /= p[i];
- }
- if (n != 1) {
- cout << "David";
- } else {
- cout << (x ? "David" : "Vasya");
- }
- }
- /* <-------------------> */
- // #define LOCAL
- int main() {
- #ifdef LOCAL
- freopen("input.txt", "r", stdin);
- #endif
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement