jiahuimbzuai/CoQuIR huggingface dataset:
//  [c]
#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    long N;
    int i,p;
    long a[100001] = {0};
    long count = 0;
    long pp[100001] = {1};

    scanf("%ld", &N);

    for (i = 1; i <= N; i++) {
        scanf("%ld", &a[i]);
    }

    i = 1;
    pp[i++] = p = a[1];
    count++;

    if (p == 2) {
        printf("%ld", count);
        return 0;
    }

    while (1) {
        
       pp[i++] = p = a[p];
       count++;

       if (p == 2)
           break;

       for (int j = 0; j < i - 1; j++) {
           if (p == pp[j]) {
               printf("-1");
               return 0;
           }
       }
       


    }

    printf("%ld", count);

    return 0;

}
//  [c]
#include <unistd.h>
#include <stdlib.h>

void writing(int ans)
{
    char c;
    if (ans < 10)
    {
        c = ans + '0';
        write(1, &c, 1);
    }
    else
    {
        writing(ans / 10);
        writing(ans % 10);
    }
}

int get_num(char *s)
{
    int num;
    int i;
    
    i = -1;
    while (s[++i] != 10)
    {
        if (s[i] != 32)
        {
            num = 0;
            while ('0' <= s[i] && s[i] <= '9')
            {
                num = num * 10 + s[i++] - '0';
                    
            }
            return (num);
        }
    }  
}

void get_nums(int *array, char *s, int count)
{
    int num;
    int i;
    
    i = -1;
    while (s[++i])
    {
        if (s[i] != 10 && s[i] != 32)
        {
            num = 0;
            while ('0' <= s[i] && s[i] <= '9')
            {
                num = num * 10 + s[i++] - '0';
                if (!s[i])
                {
                    array[count] = num;
                    return ;                    
                }
            }
            array[count++] = num;
            i--;
        }
    }  
}

void get_num_plus(int *tab, char *tmp, int pass_flag, int count)
{
    int i;
    
    i = -1;
    while (count < pass_flag)
    {
        while (tmp[++i] != 10)
            ;
        count++;
    }
    get_nums(tab, &tmp[++i], 0);
}

void get_ans(int n, char *tmp)
{
    int i;
    int j;
    int tab[n];
    int count;
    
    get_num_plus(tab, tmp, 1, 0);
    count = 0;
    j = 0;
    i = -1;
    while (++i < n)
    {
        count++;
        if (tab[j] == 2)
        {
            writing(count);
            return ;
        }
        j = tab[j] - 1;
    }
    write(1, "-1", 2);
}

char *create_array(char *s, char *new_arr, char *t, int size)
{
    int i;
    int j;
    
    i = -1;
    while (s[++i])
        new_arr[i] = s[i];
    free(s);
    j = 0;
    while (j < size)
        new_arr[i++] = t[j++];   
    new_arr[i] = 0;
    return (new_arr);
}

char *get_data(char *s)
{
    int size;
    int sum_size;
    char t[1000];
    char *new_arr;
    
    sum_size = 0;
    while ((size = read(0, t, 1000)))
    {
        if (size == -1)
            return (NULL);
        sum_size += size;
        if (!(new_arr = (char*)malloc(sum_size + 1)))
            return (NULL);
        s = create_array(s, new_arr, t, size);
    }
    return (s);
}

int main(void){
    int num;
    char *s;
    
    s = malloc(1);
    s = get_data(s);
    num = get_num(s);
    get_ans(num, s);
    free(s);
    return (0);
}
//  [c]
#include"stdio.h"
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    int f[n];
    for(int i=0;i<n;i++) f[i]=0;
    int cnt=1,k=a[0];
    f[0]=1;
    while(1){
        if(k==2)  break;
        k=a[k-1];
        f[k-1]++;
        if(f[k-1]==2){
            printf("-1\n");
            return 0;
        }
        cnt++;
    }
    printf("%d\n",cnt);
}
//  [javascript]
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main(input) {
  input = myconv(input,5);
  var N = input[0];
  input.shift();
  var output = 0;
  var access = 0;
  var accessed = new Set();
  accessed.add(access);
  while(true){
    access = input[access] -1;
    output++;
     if(accessed.has(access)){
        myout(-1);
       return;
     }else if(access == 1){
              myout(output);
       return;
              }
    accessed.add(access);
  }
}
Main(myin());
//  [javascript]
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const N = lines[0]-0;
    const map = [];
    for(let i=1;i<=N;i++){
        map[i] = lines[i];
    }
    const chk = {};
    let p = 1;
    let ans = 0;
    while(p!=2){
        chk[p] = true;
        p = map[p];
        if(chk[p]){
            ans = -1;
            break;
        }
        ans++;
    }
    console.log(ans);
});

min = (...a)=>{return a.reduce((a,b)=>a<b?a:b, a[0])};
//  [javascript]
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});
process.stdin.on('end', function() {
    main(g_input.split(/\r?\n/));
});

function main(inputs) {
  var N = inputs[0];
  var count = 1;
  var next = 1;
  for(; count < N; count++){
    if(next == -1){
      break;
    }
    var temp  = inputs[next];
    inputs[next] = -1;
    next = temp;
    if(next == 2){
      console.log(count);
      return;
    }
  }
  console.log(-1);
}
//  [go]
package main

import "fmt"

func main() {
	// Code for B - Trained?
	var N int
	fmt.Scanf("%d", &N)

	a := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &a[i])
	}

	var x int = 1
	var flag int
	var count int = 1
	for i := 0; i < N; i++ {
		x = a[x-1]
		if x == 2 {
			flag = 1
			break
		} else {
			count++
		}
	}

	if flag == 1 {
		fmt.Println(count)
	} else {
		fmt.Println("-1")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var N int
	fmt.Scan(&N)
	a := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&a[i])
	}
	var n = 1
	var sum int
	var p = false
	for i := 0; i < N; i++ {
		n = a[n-1]
		sum++
		if n == 2 {
			p = true
			break
		}
	}
	if p {
		fmt.Fprintln(wtr, sum)
	} else {
		fmt.Fprintln(wtr, -1)
	}

	_ = wtr.Flush()
}
//  [go]
package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d\n", &a[i])
	}

	key, count := 1, 0
	buttons := map[int]bool{key: true}
	for {
		count++
		key = a[key-1]
		if buttons[key] {
			fmt.Println(-1)
			break
		} else if key == 2 {
			fmt.Println(count)
			break
		} else {
			buttons[key] = true
		}
	}

}
//  [ruby]
#!/usr/bin/env ruby
STDIN.readline()
as = []
while (lines = STDIN.gets) do
  as << lines.strip.to_i
end
def make_tree(as, n)
  index = (0...as.size).bsearch{|i| as[i] >=  n} || as.size
  as.insert(index, n)
end
def trained?(as)
  # puts "as: #{as}"
  s = []
  l = 1
  while true
    make_tree(s, l)
    l = as[l-1]
    # puts "#{s}, #{l}"
    return s.length if l == 2
    return nil if s.bsearch{|n| n == l}
  end
end

n = trained?(as)
puts "#{n ? n : -1}"
//  [ruby]
N = gets.chop.to_i
A = [nil]
N.times do
  A << gets.chop.to_i
end

now = 1
count = 0
pushed = []

while true do
  if now == 2
    break
  elsif count % 100 == 0
    if pushed.include?(now)
      count = -1
      break
    end
  end
  pushed << now
  now = A[now]
  count += 1
end

puts count
//  [ruby]
n = gets.chomp.to_i
a = []
for i in 0...n
    a.push(gets.chomp.to_i)
end
next_botton = 0
ans = 0
while 1
    ans += 1
    next_botton = a[next_botton] - 1
    if next_botton == 1
        break
    end
    if ans > 10**6
        print(-1)
        exit()
    end
end
print(ans)
//  [rust]
#[allow(dead_code)]
fn primes(num: i64) -> Vec<i64> {
    let mut ans = vec![1];
    let mut cur = num;
    for i in 2.. {
        if i * i > num { break; }
        if cur % i == 0 {
            while cur % i == 0 {
                ans.push(i);
                cur /= i;
            }
        }
    }
    if cur > 1 {
        ans.push(cur);
    }
    return ans;
}

#[test]
fn test_primes() {
    assert_eq!(primes(1), vec![1]);
    assert_eq!(primes(140), vec![1, 2, 2, 5, 7])
}

// https://techracho.bpsinc.jp/jhonda/2019_08_05/78537
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
test! {
r"3
3
1
2
" => r"2",

r"4
3
4
1
2
" => r"-1",

r"5
3
3
4
2
4
" => r"3"
}

use proconio::{input, fastout};
use proconio::source::auto::AutoSource;
use im_rc::HashSet;

fn do_solve(a: &Vec<usize>, i: usize, cnt: i64, cache: &mut HashSet<usize>) -> i64 {
    return match a[i] {
        2 => cnt + 1,
        x => {
            if cache.contains(&x) {
                return -1;
            }

            cache.insert(x);

            do_solve(a, a[i] - 1, cnt + 1, cache)
        }
    };
}

fn solve(src: &str) -> String {
    let source = AutoSource::from(src);
    input! {
       from source,
       n:i64,
       a:[usize; n]
    }
    let a: Vec<usize> = a;
    let mut cache = HashSet::new();


    let ans = do_solve(&a, 0, 0, &mut cache);
    format!("{}", ans)
}


#[fastout]
fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&*s));
}
//  [typescript]
function*stdinIter(){const t=require("fs").readFileSync("/dev/stdin","utf-8").trim().split(/\n|\s/);yield*t}function readMany(t,e){const i=e||this.iter||(this.iter=stdinIter()),n=[];for(let e=0;e<t;e+=1)n.push(i.next().value);return n};

(() => {
    const [ n ] = readMany(1).map(it => parseInt(it))
    const a = []
    for (let i = 0; i < n; i += 1) {
        a.push(parseInt(readMany(1)[0]) - 1)
    }

    let button = 0

    for (let i = 0; i <= n; i += 1) {
        if (button == 1) return console.log(i)
        button = a[button]
    }
    console.log('-1')
})()
//  [typescript]
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  let inputs: any[][] = [];
  for (let i = 0; i < lines.length; i++) {
    inputs.push([Number(lines[i]), false]);
  }

  let nextBtn = 1;
  let count = 0;
  while (true) {
    count++;

    nextBtn = inputs[nextBtn][0];

    if (inputs[nextBtn][1]) {
      console.log(-1);
      break;
    }

    if (nextBtn === 2) {
      console.log(count);
      break;
    }

    inputs[nextBtn][1] = true;
  }
});
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const buttons = input.slice(1, -1).map((line) => Number(line[0]));

  let count = 0;
  let next = 1;

  while (true) {
    const button = buttons[next - 1];
    buttons[next - 1] = -1;

    count += 1;

    if (button === -1) {
      return -1;
    }

    if (button === 2) {
      break;
    }

    next = button;
  }

  return count;
};

console.log(main(read()));
//  [python]
import numpy as np

n, m, k = map(int, input().split(" "))

flag = 0
for i in range(n + 1):
    for j in range(m + 1):
        if(i * m - i * j + j * n - i * j == k):
            flag = 1
        if(n * m - (i * m - i * j + j * n - i * j) == k):
            flag = 1

if(flag == 1):
    print("Yes")
else:
    print("No")
//  [python]
N, M, K = map(int, input().split())
if K % N == 0 or K % M == 0:
    print('Yes')
    exit()
candidates = set()
for i in range(1, N):
    curr = i * M
    for j in range(1, M):
        curr += N - 2 * i
        candidates.add(curr)
for j in range(1, M):
    curr = j * N
    for i in range(1, N):
        curr += M - 2 * j
        candidates.add(curr)
print('Yes') if K in candidates else print('No')
//  [python]
n,m,k = map(int,input().split())
s = []
for i in range(n+1):
    for j in range(m+1):
        hoge = (i*j+(n-i)*(m-j))
        s.append(hoge)
        s.append(n*m-hoge)
if k in s:
    print("Yes")
else:
    print("No")
//  [java]
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());

        // 主処理
        Set<Integer> set = new HashSet<>();
        for (int i = 1; i <= n; i++) {
            set.add(i * m);
            for (int j = 1; j <= m; j++) {
                set.add(j * n);
                set.add((n * j - (i * j)) + (m * i - (i * j)));
            }
        }

        String result = k == 0 || set.contains(k) ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    }
}
//  [java]


import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();

		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();

		int black = 0;
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j <= m; j++) {
				black = j * (n - 2 * i) + i * m;
				if (!map.containsKey(black))
					map.put(black, black);
			}
		}

		if (map.containsKey(k))
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}
//  [java]
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int maxN = sc.nextInt();
		int maxM = sc.nextInt();
		int want = sc.nextInt();
		Set<Integer> set = new HashSet<Integer>();
		for(int n = 0; n <= maxM; n++) {
			for(int m = 0; m <= maxN; m++) {
				set.add(maxN * n + maxM * m - 2 * n * m);
			}
		}
		System.out.println(set.contains(want) ? "Yes" : "No");
	}
}
//  [cpp]
#include <iostream>
#include <vector>
using namespace std;

void row(vector< vector<bool> > &t, int N ,int M, int num, int& count){
	for (int j = 0; j< M ; j++) {
		if(t[num][j]){
			t[num][j] = false;
			count--;
		}else{
			t[num][j] = true;
			count++;
		}
	}
}

void col(vector< vector<bool> > &t, int N ,int M, int num, int &count){
	for(int i = 0; i<N; i++){
		if(t[i][num]){
			t[i][num] = false;
			count--;
		}else{
			t[i][num] = true;
			count++;
		}
	}
}

int main(){
	int N, M, K;
	cin >> N >> M >> K;
	vector< vector<bool> > table;
	table.resize(N);
	bool ok = false;
	int count = 0;
	for (int i = 0; i < N; i++){
		table[i].resize(M);
	}
	for(int i = 0; i< N; i++) for(int j = 0; j< M; j++) {
		table[i][j] = false;
	}

	for (int j = 0; j<M ;j++){
		if(ok == true || count == K){
			ok = true;
			break;
		}
		col(table, N, M, j, count);
		for(int i = 0; i < N; i++){
			if(ok == true || count == K){
				ok = true;
				break;
			}
			row(table, N, M, i ,count);
		}
	}
	if(ok == true || count == K){
		ok = true;
	}

	if(ok)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int countBlacks(int i, int j);
  

int n, m, k;
int main()
{
  cin >> n >> m >> k;
  
  vector<int> availableKs;
  for(int i=0; i<=n; ++i){    //行 
    for(int j=0; j<=m; ++j){    //列
      availableKs.push_back(countBlacks(i, j));
    }
  }
  
  if(find(begin(availableKs), end(availableKs), k) != end(availableKs))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
int countBlacks(int i, int j){
  int result = 0;
  for(int y=0; y<n; ++y){
    if(y < i){ //y行目は反転している
      result += (m-j);
    }else{    //y行目は反転していない
      result += j;
    }
  }
  return result;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

map<string, string> mp, mpg,mpa;

/*--------------------template--------------------*/


int main()
{
	set<ll> st;
	cin >> n >> m >> k;

	REP(i, m)
	{
		st.insert(n*(i + 1));
	}
	REP(i, n)
	{
		st.insert(m*(i + 1));
	}
	REP(i, m)
	{
		ll a = n*(i + 1);
		REP(j, n)
		{
			a += m - (i + 1) - (i + 1);
			st.insert(a);
			st.insert(n*m - a);
		}
	}
	REP(i, n)
	{
		ll a = m*(i + 1);
		REP(j, m)
		{
			a += n - (i + 1) - (i + 1);
			st.insert(a);
			st.insert(n*m - a);
		}
	}

	st.insert(sum);
	if (st.count(k) != 0) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#define MAX_NUM 1005

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void){
    int N, M, K;
    int array[MAX_NUM*MAX_NUM] = {-1};
    int num_index = 0;
    int i, j;

    scanf("%d %d %d", &N, &M, &K);

    for(i=0; i<=N; i++){
        for(j=0; j<=M; j++){
            array[num_index++] = i*M + j*N - 2*i*j; 
        }
    }

    qsort(array, num_index, sizeof(int), compare_int);
    if((int *)bsearch(&K, array, num_index, sizeof(int), compare_int) == NULL)
        printf("No");
    else
        printf("Yes");

    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int n, m, k;
    scanf("%d %d %d", &n, &m, &k);
    for(int i = 0; i <= n; i++){
        for( int j = 0; j <= m; j++){
           if(k == (i * m + j * n - 2 * i*j)){
            printf("Yes");
            return 0;
           }
        }
    }

    printf("No");
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define MOD 1000000007
#define SIZE 100005
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
int used[1000001];
int main(void)
{
	int n,m,k,i,j;
	scanf("%d%d%d",&n,&m,&k);
	FOR(i,0,n+1){
		FOR(j,0,m+1){
			used[i*m+j*n-i*j*2]=1;
		}
	}
	printf("%s\n",used[k]?"Yes":"No");
	return 0;
}
//  [javascript]
function Main(input){
	var flag = false;
	input = input.split(" ").map(Number);
	for(var i=0;i<=input[0];i++){
		for(var j=0;j<=input[1];j++){
			if(i*input[1]+j*input[0]-i*j*2==input[2]){
				flag = true;
				break;
			}
		}
	}
	console.log(flag?"Yes":"No");
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {
    var params = input[0].split(' ');
    var n = parseInt(params[0], 10);
    var m = parseInt(params[1], 10);
    var k = parseInt(params[2], 10);

    var feasible = false;
    for (var i = 0; i <= n; i++) {
        for (var j = 0; j <= m; j++) {
            if (j * (n - i) + i * (m - j) == k) {
                feasible = true;
                break;
            }
        }
    }

    if (feasible) {
        console.log('Yes');
    }
    else {
        console.log('No');
    }

    return 0;
}
//  [javascript]
var main = function(input) {
var Ar = input.split(' ').map(x=>parseInt(x));
var N=Ar[0];
var M=Ar[1];
var K=Ar[2];
var Ans ='No';
for (var i = 0; i <= N; i++) {
        for (var j = 0; j <= M; j++) {
            if (j * (N - i) + i * (M - j) == K) {
                Ans = 'Yes'
                console.log(Ans);
                return 0;
            }
        }
    }
console.log(Ans);
    return 0; 
}

main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func swap(a int64, b int64) (int64, int64) {
	return b, a
}

func gcd(a int64, b int64) int64 {
	if b > a {
		a, b = swap(a, b)
	}
	if b == 0 {
		return a
	} else {
		return gcd(a%b, b)
	}
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func min(nums ...int64) int64 {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int64(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int64) int64 {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int64(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func nextLong() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func nextByte() byte {
	sc.Scan()
	s := sc.Bytes()
	return s[0]
}

func main() {
	sc.Split(bufio.ScanWords)
	//ans := 1
	N := nextInt()
	M := nextInt()
	K := nextInt()
	Blacknum := 0
	Clear := false
	for row := 0; row <= N; row++ {
		for col := 0; col <= M; col++ {
			Blacknum = (M-col)*row + (N-row)*col
			if Blacknum == K {
				Clear = true
			}
		}
	}
	if Clear {
		fmt.Printf("Yes\n")
	} else {
		fmt.Printf("No\n")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N, M, K := ReadInt(), ReadInt(), ReadInt()
	for a := 0; a <= M; a++ {
		for b := 0; b <= N; b++ {
			x := N*a + M*b - 2*a*b
			if x == K {
				fmt.Println("Yes")
				return
			}
		}
	}
	fmt.Println("No")
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
)

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

const yes = "Yes"
const no = "No"

func solve(n int64, m int64, k int64) bool {
	for r := int64(0); r < n + 1; r ++ {
		for c := int64(0); c < m + 1; c ++ {
			if r * m + c * n - 2 * r * c == k {
				return true
			}
		}
	}
	return false
}

func main() {
	defer out.Flush()

	n := nextInt()
	m := nextInt()
	k := nextInt()
	if solve(n, m, k) {
		fmt.Fprintln(out, yes)
	} else {
		fmt.Fprintln(out, no)
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}
//  [ruby]

a = gets.chomp.split(" ").map(&:to_i)
n=a[0]
m=a[1]
for i in 1..n
  for j in 1..m
  if a[2] == i*j + (a[0]-i) * (a[1]-j)
    puts "Yes"
    exit
  end
  end
end
for i in 1..m
  for j in 1..n
  if a[2] == i*j + (a[1]-i) * (a[0]-j)
    puts "Yes"
    exit
  end
  end
end
if a[2]==0 || a[2]==n*m || a[2] % n == 0 || a[2] % m == 0 
puts "Yes"
exit
end
a[2] = n*m-a[2]
for i in 1..n
  for j in 1..m
  if a[2] == i*j + (a[0]-i) * (a[1]-j)
    puts "Yes"
    exit
  end
  end
end
for i in 1..m
  for j in 1..n
  if a[2] == i*j + (a[1]-i) * (a[0]-j)
    puts "Yes"
    exit
  end
  end
end
if a[2]==0 || a[2]==n*m || a[2] % n == 0 || a[2] % m == 0 
puts "Yes"
exit
end
puts "No"

#if a[0]-1+a[1]-1 <=a[2] && a[2] <= 1+(a[0]*a[1])
#puts "Yes"
#else
#puts "No"
#end
//  [ruby]
n, m, k = gets.chomp.split(' ').map(&:to_i); puts({ true => 'Yes', false => 'No' }[(0..n).to_a.product((0..m).to_a).map { |a| a[0] * a[1] + (n - a[0]) * (m - a[1]) }.include?(k)])
//  [ruby]
n, m, k = gets.split.map(&:to_i)
puts (0..n).to_a.product((0..m).to_a).any? { |nn, mm| nn * (m - mm) + (n - nn) * mm == k } ? 'Yes' : 'No'
//  [rust]
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

fn main() {
    input! {
        n:usize,m:usize,k:usize
    }

    let mut dp = vec![vec![0; m + 1]; n + 1];
    dp[0][0] = 0;
    dp[0][1] = n;
    dp[1][0] = m;
    for i in 0..n {
        for j in 0..m {
            dp[i + 1][j] = dp[i][j] + m - j * 2;
            dp[i][j + 1] = dp[i][j] + n - i * 2;
        }
    }
    let mut ans = false;

    ans = dp
        .iter()
        .filter(|&x| x.iter().filter(|&y| y == &k).count() > 0)
        .count()
        > 0;
    yn(ans);
}
pub fn yn(ans: bool) {
    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}
//  [rust]
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let n: i64 = read();
    let m: i64 = read();
    let k: i64 = read();

    let mut only_n: Vec<i64> = Vec::new();
    let mut possible: Vec<i64> = Vec::new();

    for i in 0..=n {
        only_n.push(i * m);
        possible.push(i * m);
    }

    for row in 0..=n {
        for column in 0..=m {
            possible.push(only_n[row as usize] + (n - 2 * row) * column);
        }
    }

    //println!("{:?}", only_n);
    //println!("{:?}", possible);

    if let Some(_) = possible.iter().find(|&&x| x == k) {
        println!("Yes");
    } else {
        println!("No");
    }
}
//  [python]
import numpy as np

N = int(input())

arr = np.zeros((N,))

for i in range(N):
    arr[i] = int(input())

print(np.unique(arr).size)
//  [python]
import numpy as np
N = int(input())
d = np.array([int(input()) for i in range(N)])
c = 0
while len(d)>0:
    m = np.max(d)
    d = d[d<m]
    c += 1
print(c)
//  [python]
import numpy as np
n = int(input())
d = []
for i in range(n):
    d.append(input())
print(len(set(d)))
//  [java]
import java.util.*;
import java.util.stream.IntStream;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.CountDownLatch;

public class Main{
    
    static final int SLEEP_TIME = 17;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        
        final CountDownLatch start = new CountDownLatch(n+1);
        final CountDownLatch end = new CountDownLatch(n+1);
        final Count c = new Count();
        
        for(int i=0; i<n; i++){
            int num = Integer.parseInt(sc.next());
            new Thread(new Runnable(){
                public void run(){
                    try{
                        start.countDown();
                        start.await();
                        TimeUnit.MILLISECONDS.sleep(num*SLEEP_TIME);
                        synchronized(c){
                            c.flagUp();
                        }
                    }catch(InterruptedException e){
                        //e.printStackTrace();
                    }finally{
                        end.countDown();
                    }
                }
            }).start();
        }
        
        new Thread(new Runnable(){
            public void run(){
                try{
                    start.countDown();
                    start.await();
                    for(int i=0; i<104; i++){
                        c.countUp();
                        TimeUnit.MILLISECONDS.sleep(SLEEP_TIME);
                    }
                }catch(InterruptedException e){
                    //e.printStackTrace();
                }finally{
                    end.countDown();
                }
            }
        }).start();
        
        
        try{
            end.await();
        }catch(InterruptedException e){
            e.printStackTrace();
        }
        
        System.out.println(c.getResult());
    }
}

class Count{
    int cnt;
    boolean flag;
    
    public Count(){
        cnt = 0;
        flag = false;
    }
    
    public void flagUp(){
        flag = true;
    }
    
    public void countUp(){
        if(flag){
            cnt++;
            flag = false;
        }
    }
    
    public int getResult(){
        return cnt;
    }
}
//  [java]
import java.util.*;
import java.util.stream.IntStream;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.CountDownLatch;

public class Main{
    
    static final int SLEEP_TIME = 17;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        for(int i=0; i<n; i++){
            d[i] = Integer.parseInt(sc.next());
        }
        
        final CountDownLatch latch = new CountDownLatch(d.length+1);
        final Count c = new Count();
        
        for(final int num : d){
            new Thread(new Runnable(){
                public void run(){
                    try{
                        TimeUnit.MILLISECONDS.sleep(num*SLEEP_TIME);
                        synchronized(c){
                            c.flagUp();
                        }
                    }catch(InterruptedException e){
                        //e.printStackTrace();
                    }finally{
                        latch.countDown();
                    }
                }
            }).start();
        }
        
        new Thread(new Runnable(){
            public void run(){
                try{
                    for(int i=0; i<103; i++){
                        c.countUp();
                        TimeUnit.MILLISECONDS.sleep(SLEEP_TIME);
                    }
                }catch(InterruptedException e){
                    //e.printStackTrace();
                }finally{
                    latch.countDown();
                }
            }
        }).start();
        
        
        try{
            latch.await();
        }catch(InterruptedException e){
            e.printStackTrace();
        }
        
        System.out.println(c.getResult());
    }
}

class Count{
    int cnt;
    boolean flag;
    
    public Count(){
        cnt = 0;
        flag = false;
    }
    
    public void flagUp(){
        flag = true;
    }
    
    public void countUp(){
        if(flag){
            cnt++;
            flag = false;
        }
    }
    
    public int getResult(){
        return cnt;
    }
}
//  [java]
import java.util.*;
import java.util.stream.IntStream;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.CountDownLatch;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        for(int i=0; i<n; i++){
            d[i] = Integer.parseInt(sc.next());
        }
        
        try{
            SleepSort.sort(d);
        }catch(InterruptedException e){
            e.printStackTrace();
        }
        
        int ans = n;
        for(int i=0; i<n-1; i++){
            if(d[i]==d[i+1]){
                ans--;
            }
        }
        
        System.out.println(ans);
    }
}

class SleepSort{
    public static void sort(int[] array) throws InterruptedException{
        int taskCount = array.length;
        final CountDownLatch latch = new CountDownLatch(taskCount);
        
        List<Integer> res = new ArrayList<>();
        
        for(final int num : array){
            new Thread(new Runnable(){
                public void run(){
                    try{
                        TimeUnit.MILLISECONDS.sleep(num*10);
                        synchronized (res){
                            res.add(num);
                        }
                    }catch(InterruptedException e){
                        e.printStackTrace();
                    }finally{
                        latch.countDown();
                    }
                }
            }).start();
        }
        
        latch.await();
        
        int i=0;
        for(int v : res){
            array[i] = v;
            i++;
        }
        
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;


int main()
{
	int n;
	cin>>n;
	unordered_set<int> st;

	for (int i = 0; i < n; ++i)
	{
		int tmp;
		cin>> tmp;
		st.insert(tmp);
	}
	printf("%d\n", st.size());



	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
int a[101];
int main()
{
	int n,x;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		a[x]=1;
	}
	int s=0;
	for(int i=1;i<=100;i++)
	if(a[i]==1)s++;
	cout<<s;
	return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

vll adj[MAXN]; ll visit[MAXN] = {};
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, y, r, p;
string s, t;
// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	set<ll> val;
	for(ll i=0;i<n;i++) {
		cin>>x;
		val.insert(x);
	}
	cout<<val.size();
}

int main() {
	fastio; randomINT;
	//cin>>t;
	while (T--) {
		MAIN();
	}
	return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

#define SENTINEL 1000000000000000000

void merge(long long A[], long long left, long long mid, long long right){
  long long n1, n2, i, j, k;
  long long *L,*R;
  
  n1 = mid-left;
  n2 = right-mid;
  
  L = (long long*)malloc(sizeof(long long) *(n1 + 1));
  R = (long long*)malloc(sizeof(long long) *(n2 + 1));
  
  for(i = 0; i <= n1 - 1; i++){
    L[i] = A[left + i];
  }
  for(j = 0; j <= n2 - 1; j++){
    R[j] = A[mid + j];
  }
  
  L[n1] = SENTINEL;
  R[n2] = SENTINEL;
  
  i = 0;
  j = 0;
  
  for(k = left; k <= right - 1; k++){
   if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else{
      A[k] = R[j];
      j++;
    }
  }
  free(L);
  free(R);
}

void mergeSort(long long A[], long long left, long long right){
  long long mid;
  
  if(left + 1 < right){
    mid=(left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(void){

    int N;

    scanf("%d", &N);

    long long d[N];

    for(int i = 0; i < N; i++){
        scanf("%lld", &d[i]);
    }

    mergeSort(d, 0, N);

    int ans = 1;

    for(int i = 1; i < N; i++){
        if(d[i] != d[i-1]){
            ans++;
        }
    }

    printf("%d\n", ans);

    return 0;
}
//  [c]
#include<stdio.h>
int main()
{ 
  int d[1000]={0};
  int i=0,j=0,n=0,ans=0;
  scanf("%d",&n);
  ans=n;
  for(i=0;i<n;i++){
    scanf("%d",&d[i]);
  }  
  for(i=0;i<n;i++){
  	for(j=i+1;j<n;j++){
    	if(d[i]==d[j]){
         --ans;
          break;
        }
    }
  }
  printf("%d",ans);
    return 0;
  }
//  [c]
#include<stdio.h>
int main()
{
 int N,i,j,sum,tmp;
  int a[100]={0};
  scanf("%d",&N);
  sum=N;
  for(i=0;i<N;i++)
  {
    scanf("%d",&a[i]);
  }
  for(i=0;i<N-1;i++)
  {
    for(j=0;j<N-1;j++)
    {
     if(a[j]<=a[j+1])
     {
       tmp=a[j];
       a[j]=a[j+1];
       a[j+1]=tmp;
     } 
    }
  }
  for(i=0;i<N-1;i++)
  {
  if(a[i]==a[i+1])
  {
    sum=sum-1;
  }
  }
  printf("%d",sum);
  return 0;
}
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {

	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	gyou = input[0];
	var count=0;
	for(i=1;i<=gyou;i++){
		var flag =0;
		for(j=i+1;j<=gyou;j++){
			if(input[i]==input[j]){
				flag = 1;
			}
		}
		if(flag==0){
			count++
		}
		
		
	}



	//出力
	console.log(count);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';

function Main(INPUT) {
    const input = INPUT.split("\n").map(n => Number(n));
    const N = input[0];
    const a = input.slice(1, N + 1);
    console.log(new Set(a).size);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";

function main(input) {
  input = input
    .split(/\n|\s/)
    .map(v => ~~v)
    .slice(1, -1);

  input.sort((a, b) => {
    return b - a;
  });

  let prev = 0;
  let ans = 0;

  for (let i = 0; i < input.length; i++) {
    if (i === 0 || input[i] < prev) ans++;
    prev = input[i];
  }

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 10000
	maxBufSize     = 1000000009
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	nums := nextInt()
	// appendは遅いらしいので予め必要な容量を確保する
	dn := make([]int, nums)
	for i := 0; i < nums; i++ {
		dn[i] = nextInt()
	}
	dnuniq := intUniq(dn)
	fmt.Println(len(dnuniq))
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func intUniq(list []int) []int {
	m := make(map[int]struct{})
	newList := make([]int, 0)

	for _, element := range list {
		// mapでは、第二引数にその値が入っているかどうかの真偽値が入っている
		if _, ok := m[element]; ok == false {
			m[element] = struct{}{}
			newList = append(newList, element)
		}
	}
	return newList
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int

	fmt.Scan(&n)

	mochi := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&mochi[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(mochi)))

	kasane := 1
	for i := 0; i < n-1; i++ {
		if mochi[i] > mochi[i+1] {
			kasane++
		}
	}
	fmt.Println(kasane)
}
//  [ruby]
n,*a=`dd`.split.map &:to_i
p a.uniq.size
//  [ruby]
n = gets.to_i
puts n.times.map { gets.to_i }.uniq.size
//  [rust]
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        n: usize,
        mut dd: [usize; n]
    };
    dd.sort();
    dd.dedup();
    println!("{}", dd.len());
}
//  [swift]
import Foundation
let N = Int(readLine()!)!
var arr = [Int]()
for i in 0 ..< N {
    arr.append(Int(readLine()!)!)
}
var sorArr = arr.sorted()
var orderArr = NSOrderedSet(array: sorArr)
print(orderArr.count)
//  [swift]
//
//  main.swift
//  AtCoderSwift
//
//  Created by burita083 on 2020/08/25.
//  Copyright © 2020 burita083. All rights reserved.
//

import Foundation
func readInt() -> Int {
    return Int(readLine()!)!
}
 
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
 
func readTwoInts() -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: " ").map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

func abc080_b() {
    let N = readLine()!
    let sum = N.map { Int(String($0))! }.reduce(0, +)
    print(Int(N)! % sum == 0 ? "Yes" : "No")
}

//abc080_b()

func abc078_b() {
    let input = readInts()
    var X = input[0]
    let Y = input[1]
    let Z = input[2]
    var ans = 0
    X -= Y+Z*2
    ans += 1
    ans += X/(Y+Z)
    
    print(ans)
}

func abc085_b() {
    let N = readInt()
    var l: [Int] = []
    for _ in 0..<N {
        let d = readInt()
        l.append(d)
    }
    print(l.reduce([], { $0.contains($1) ? $0 : $0 + [$1] }).count)
}

abc085_b()
//  [swift]
func main() {
    let n = Int(readLine()!)!
    let A = (1...n).map { _ in Int(readLine()!)! }
    let ans = Set(A).count
    
    print(ans)
}

main()
//  [typescript]
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): any => {
  const N = +lines[0]
  const d = lines.slice(1, 1 + N).map(n => +n)
  const obj = { N, d }
  debug(obj)
  return obj
}

// solver
export const solve = (lines: string[]): string => {
  const { N, d } = parseLines(lines)
  d.sort((a: number, b: number) => b - a)
  let count = 1
  let min = d[0]
  for (let i = 1; i <= d.length; i++) {
    if (d[i] < min) {
      min = d[i]
      count++
    }
  }
  return `${count}`
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}
//  [typescript]
const lines = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line) {
  lines.push(line);
});

reader.on("close", function () {
  const num = lines[0] as string;
  let mochis = new Map();

  for (let i = 1; i < lines.length; i++) {
    const key = lines[i];
    // console.log(key);
    mochis.set(key, "a");

    // (<any>Object).assign(mochis, JSON.parse(JSON.stringify(`${key}:a`)));
  }

  //   console.log(mochis);
  console.log(mochis.size);
});
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const D = input.slice(1, -1).map((line) => Number(line[0]));

  return new Set(D).size;
};

console.log(main(read()));
//  [python]
import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write('\n'.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
#from decimal import Decimal
from fractions import Fraction
#sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1e9)+7



a,b,c=mdata()
k=int(data())
while b<=a:
    b*=2
    k-=1
while c<=b:
    k-=1
    c*=2
if k>=0:
    out("Yes")
else:
    out("No")
//  [python]
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    a, b, c = i_map()
    k = i_input()

    count = 0
    while a >= b:
        b *= 2
        count += 1

    while b >= c:
        c *= 2
        count += 1

    print('Yes' if count <=k else 'No')

if __name__ == '__main__':
    main()