jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include<cstdio>
int aa[30];
int main()
{
	int n;
	while(~scanf("%d",&n))
	{
		int i;
		for(i=0;i<n;i++)
		{
			scanf("%d",&aa[i]);
		}
		int num=0;
		for(i=1;i<=n-2;i++)
		{
			if(aa[i]>aa[i-1]&&aa[i]<aa[i+1]||aa[i]<aa[i-1]&&aa[i]>aa[i+1])
			num++;
		}
		printf("%d\n",num);
		
	}
	return 0;
}
//  [cpp]
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<int> > mat;

int main()
{
  int n;
  cin >> n;
  int p[30];
  for (int i = 0; i < n; i++)
  {
    cin >> p[i];
  }
  int ans = 0;
  for (int i = 0; i < n - 2; i++)
  {
    if (p[i] < p[i + 1] && p[i + 1] < p[i + 2])
    {
      ans++;
    }
    if (p[i] > p[i + 1] && p[i + 1] > p[i + 2])
    {
      ans++;
    }
  }
  cout << ans << "\n";
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;

int main() {
    lli n;
    cin >> n;
    lli p[n];
    REP(i, 0, n) {
        cin >> p[i];
    }
    lli ans = 0;
    REPE(i, 1, n-2) {
        if ((p[i-1] < p[i] && p[i+1] > p[i]) ||
            (p[i-1] > p[i] && p[i+1] < p[i])) {
            ans++;
        }
    }
    cout << ans << endl;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 1000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio	
	int n;
	cin >> n;
	int cnt = 0;
	int suma = 0;
	if(n%2){
		suma++;
	}
	cnt = (n/2)+1;
	cout << cnt << endl;
	return 0;
}
//  [cpp]
#include <stdio.h>
int main()
{
  int r,count=0;
  scanf("%d",&r);
  int ar[r];
  for(int i=0;i<r;i++)
  {
    scanf("%d",&ar[i]);
  }
  for(int i=1;i<r-1;i++)
  {
    if((ar[i-1]<ar[i])&&(ar[i]<ar[i+1]))
    {
      count++;
    }
  else((ar[i-1]>ar[i])&&(ar[i]>ar[i+1]));
  {
    count++;
  }
  
  }
  printf("%d\n",count);
  return 0;
  }
//  [cpp]
#include <stdio.h>
int main()
{
  int r,count=0;
  scanf("%d",&r);
  int ar[r];
  for(int i=0;i<r;i++)
  {
    scanf("%d",&ar[i]);
  }
  for(int i=1;i<r-1;i++)
  {
    if((ar[i-1]<ar[i])&&(ar[i]<ar[i+1]))
    {
      count++;
    }
  else((ar[i-1]>ar[i])&&(ar[i]>ar[i+1]))
  {
    count++;
  }
  
  }
  printf("%d\n",count);
  return 0;
  }
//  [c]
#include <stdio.h>

int main(){
	int n;
	int p[30];
	int count=0;

	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&p[i]);
	}
	for(int i=1;i<n-1;i++){
		if(p[i-1]<p[i]&&p[i+1]>p[i]){
			count++;
		}else if(p[i-1]>p[i]&&p[i+1]<p[i]){
			count++;
		}
	}
	printf("%d\n",count);
}
//  [c]
#include<stdio.h>

int main(void){
  int i,n,count=0;
    scanf("%d",&n);
  int p[n];
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
  }

  for(i=0;i<n-2;i++){
    if((p[i]<p[i+1])&&(p[i+1]<p[i+2])){
      count+=1;
    }
    else if((p[i]>p[i+1])&&(p[i+1]>p[i+2])){
      count+=1;
    }
  }

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

  return 0;
}
//  [c]
#include<stdio.h>
int main()
{
	int p[100],n,num=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&p[i]);
	}
	for(int i=0;i<n-2;i++){
		if(p[i]<p[i+1] && p[i+1]<p[i+2] || p[i]>p[i+1] && p[i+1]>p[i+2]){	
			num++;
		}
	}
	printf("%d\n",num);	
	return 0;
}
//  [c]
#include <stdio.h>
#define size 100000
int main() {
 
    int N,A[size],i,count=0,a,b,c;
    scanf("%d",&N);
    for(i=1;i<N;i++){
        scanf("%d",&A[i]);
    }
    for(i=2;i<N;i++){
        a=A[i-1];
        b=A[i];
        c=A[i+1];
        if(b>a && b<c || b<a && b>c){
        count ++;
        }
    }
    
    printf("%d\n",count);
    
    return 0;
}
//  [c]
#include <stdio.h>
#define size 100000
int main() {
 
    int N,A[size],i,count=0,a,b,c;
    scanf("%d",&N);
    for(i=1;i<N;i++){
        scanf("%d",&A[i]);
    }
    for(i=2;i<N;i++){
        a=A[i-1];
        b=A[i];
        c=A[i+1];
        if(b>=a && b<=c || b<=a && b>=c){
        count ++;
        }
    }
    
    printf("%d\n",count);
    
    return 0;
}
//  [c]
#include<stdio.h>

int main( )
{
    int n , num[100] , count = 0  , i ;
    scanf("%d" , &n);
    
    for( i = 1 ; i <= n ; i++)
        scanf("%d" , &num[i]);
    
    for( i = 1 ; i < n ; i++)
    {
        if( num[i] < num[i+1])
        {
            if( num[i+1] < num[i+2])
                count++ ;
        }
        
        else if( num[i] > num[i+1] )
        {
                if( num[i+1] > num[i+2])    
                    count++ ;
        }
    }
    
    printf("%d\n" , count);
    
    return 0 ;
}
//  [javascript]
'use strict'
const Main = (arg) => {
  let input = arg.trim().split('\n');
  let n = parseInt(input[0]);
  let pArr = input[1].split(' ').map(Number);
  // console.log({ n, pArr });
  let count = 0;
  for (let i = 1; i - 1 < n; i++) {
    if ((pArr[i - 1] < pArr[i] && pArr[i] < pArr[i + 1])
      || (pArr[i + 1] < pArr[i] && pArr[i] < pArr[i - 1])) {
      count += 1;
    }
  }
  console.log(count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'

function main(input){
    const N = Number(input[0]);
    const P = input[1].split(' ').map(Number);
    let ans = 0;
    for(let i=0;i<N-2;i++){
        if((P[i+1]-P[i])*(P[i+2]-P[i+1])>0) ans++;
    }
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').split('\n'))
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
  lines = input.split("\n");
  numbers = lines[1].split(" ");
  iterations = numbers.length;
  count = 0;
  
  for(i=0; i<iterations-2; i++){
    var max = Math.max(numbers[0], numbers[1], numbers[2]);
    var min = Math.min(numbers[0], numbers[1], numbers[2]);
    if(numbers[1] != max && numbers[1] != min){
      count += 1;
    }
    
    numbers.splice(0,1);
  }
  
  console.log(count);

}
  
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
	input = input.split("\n");
	var arr = input[1].split(" ");
	var sum = 0;
	for(var i=1;i<arr.length-1;i++){
		if((arr[i-1]<arr[i]&&arr[i]<arr[i+1])||(arr[i-1]>arr[i]&&arr[i]>arr[i+1])){
			sum++;
		}
	}
	console.log(sum);
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
function Main(input){
var row = input.split("\n")[1].split(" ");
var count = 0;
for(i=0;i<=(row.length-2);i++){
  if(row[i-1]<row[i]&&row[i]<row[i+1] ||
     row[i-1]>row[i]&&row[i]>row[i+1]){
       count +=1;
     }
}
console.log(count);
}
  Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [go]
package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var n int
	fmt.Fscan(read, &n)

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

	cnt := 0
	for i := 1; i < n-1; i++ {
		if a[i-1] < a[i] && a[i] < a[i+1] {
			cnt++
		}
		if a[i-1] > a[i] && a[i] > a[i+1] {
			cnt++
		}
	}
	fmt.Fprintln(write, cnt)
}
//  [go]
package main

import (
  "fmt"
)

func main() {
  var n int 
  fmt.Scan(&n)
  p := make([]int, n)
  for i := 0; i < n; i++ {fmt.Scan(&p[i])}
  cnt := 0
  for i := 1; i < n - 1; i++ {
    if (p[i-1] < p[i] && p[i] < p[i+1]) ||
       (p[i-1] > p[i] && p[i] > p[i+1]) {
         cnt++
       }
  }
  fmt.Println(cnt)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

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

	p0 := ps[0]
	p1 := 0
	p2 := 0
	cnt1 := 0
	cnt2 := 0
	for i := 1; i < n-1; i++ {
		p1 = ps[i]
		p2 = ps[i+1]

		if p1 < p0 {
			cnt1++
		}

		if p1 < p2 {
			cnt1++
		}

		if cnt1 == 1 {
			cnt2++
			cnt1 = 0
		}

		p0 = ps[i]
	}

	fmt.Print(cnt2)
}
//  [go]
package main

import (
	"fmt"
	"unicode/utf8"
)

func main() {
	var N int
	fmt.Scan(&N)

	inputs := scanNums(N)

	fmt.Println(inputs)

	res := 0
	for i := 0; i < len(inputs)-2; i++ {
		a := inputs[i]
		b := inputs[i+1]
		c := inputs[i+2]

		if (a < b && b < c) || (c < b && b < a) {
			// fmt.Println(a, b, c)
			res++
		}
	}
	fmt.Println(res)

}

func scanStrings(len int) (strings []string) {
	var str string
	for i := 0; i < len; i++ {
		fmt.Scanf("%s", &str)
		strings = append(strings, str)
	}
	return
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func spritString(input string) (res []string) {
	for i := 0; i < utf8.RuneCountInString(input); i++ {
		res = append(res, input[i:i+1])
	}
	return
}
//  [go]
package main

import "fmt"

func main() {
	var sum int
	n := 9
	p := []int{9, 6, 3, 2, 5, 8, 7, 4, 1}

	for i := 1; i < n-1; i++ {
		p1 := p[i-1]
		p2 := p[i]
		p3 := p[i+1]
		if p1 < p2 && p2 < p3 || p1 > p2 && p2 > p3 {
			sum++
		}
	}

	fmt.Println(sum)
}
//  [ruby]
# https://atcoder.jp/contests/abc132/tasks/abc132_b


n = gets.to_i
ps = gets.split.map(&:to_i)
ans = ps.each_cons(3).count { |a, b, c| [a, b, c].sort[1] == b }
puts ans
//  [ruby]
n = gets.to_i
P = gets.split.map(&:to_i)

cnt = 0

(n-2).times do |i|
  if P[i,3].sort[1] == P[i+1]
    cnt += 1
  end
end

puts cnt
//  [ruby]
n = gets.to_i
p_a = gets.chomp.split
n.times do |i|
    p_a[i] = p_a[i].to_i
end

count = 0
(n-2).times do |i|
    if (p_a[i] <= p_a[i+1] && p_a[i+1] <= p_a[i+2]) || (p_a[i+2] <= p_a[i+1] && p_a[i+1] <= p_a[i])
        count += 1
    end
end

puts count
//  [ruby]
input = readlines()

n = input.shift.chomp.to_i
list = input.shift.chomp.split("\s").map{|x| x.to_i}

cnt = 0
list.each_with_index do |l, i|
  next if i < 2
  tmp = [list[i - 2], list[i - 1], list[i]]
  cnt += tmp.sort()[1] == list[i - 1]
end

puts cnt
//  [ruby]
n=gets.to_i
q=gets.split.map &:to_i
p (1..n-2).count{|i|(q[i-1]-q[i])*(q[i]-q[i+1])<0}
//  [ruby]
n=gets.to_i
q=gets.split.map &:to_i
p (1..n-2).count{|i|(q[i-1]-q[i])*(q[i]-q[i-1])<0}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        v: [i32; n],
    }
    let mut ret = 0;
    for i in 1..(n-1) {
	if (v[i-1] < v[i] && v[i] < v[i+1]) || (v[i+1] < v[i] && v[i] < v[i-1]) {
	    ret += 1
	}
    }
    println!("{}", ret)
}
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(d1: &Vec<i32>, d2: &Vec<i32>) -> bool {
    for i in 0..d1.len() {}

    return true;
}

use std::cmp;
use std::iter::Iterator;

fn main() {
    input! {
        n:usize,
         p:[i32;n]
    }

    let mut cnt = 0;
    for i in 0..n - 2 {
        if (p[i] > p[i + 1] && p[i + 1] > p[i + 2]) 
        || (p[i + 2] > p[i + 1] && p[i + 1] > p[i]) {
            cnt +=1
        }
    }
    println!("{}", cnt);
}
//  [rust]
fn main() {
	use std::io::Read;
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: usize = s.next().unwrap().parse().unwrap();
	let p: Vec<i8> = s.map(|a| a.parse().unwrap()).collect();
	let ans = (1..n - 1).filter(|&i| (p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i - 1] > p[i] && p[i] > p[i + 1])).count();
	println!("{}", ans);
}
//  [rust]
use std::cmp::Reverse;

fn main() {
    let n: u32 = read();
    let ps: Vec<u32> = read_vec();

    let mut counter = 0;
    for i in 1..(n - 1) as usize {
        let cp = vec![ps[i - 1], ps[i], ps[i + 1]];
        let mut acc = vec![ps[i - 1], ps[i], ps[i + 1]];
        let mut dec = vec!(ps[i-1], ps[i], ps[i+1]);
        acc.sort();
        dec.sort_by_key(|&num| Reverse(num));
        if  cp == acc || cp == dec{
            counter += 1;
        }
    }
    println!("{:?}", counter);
}


fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}


fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
//  [rust]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(usize);
    let p = get!(usize ;;);

    let ans = (1..(n-1)).map(|i|
        if (p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i - 1] > p[i] && p[i] > p[i + 1]) {
            1
        } else {
            0
        }
    ).sum::<usize>();

    println!("{}", ans);
}
//  [rust]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(usize);
    let ps = get!(usize;;);
    let mut cnt = 0;
    for i in 1..(n-1) {
        if ps[i] > ps[i-1] && ps[i] > ps[i+1] {
            continue;
        }
        if ps[i] < ps[i-1] && ps[i] < ps[i+1] {
            continue;
        }
        cnt += 1;
    }
    println!("{}", cnt);
}
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

let n:Int=Int(readLine()!)!
let per=readInts()
var ans=0;
for i in 0..<n-2{
  if((per[i]<per[i+1]&&per[i+1]<per[i+2])||(per[i]>per[i+1]&&per[i+1]>per[i+2])){ans+=1}
}

print(ans)
//  [swift]
let n=Int(readLine()!)!
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let pp=readInts()
var count=0
for i in 1...(n-2){
  if (pp[i-1]<pp[i])&&(pp[i]<pp[i+1]){
    count+=1
  }else if (pp[i-1]>pp[i])&&(pp[i]>pp[i+1]){
    count+=1
  }
}

print(count)
//  [swift]
let a=Int(readLine()!)!
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var i = 0
var count = 0

for i in 1..<a - 1 {
  if( ( arr[ i - 1 ] < arr[i] ) && ( arr[i] < arr[ i + 1 ] ) ) {
    count += 1
  } else if ( ( arr[ i - 1 ] > arr[i] ) && ( arr[i] > arr[ i + 1 ] ) ) {
    count += 1
  }
}

print( count )
//  [swift]
import Foundation
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let nd=readInts()
let n=nd[0]
let d=nd[1]
var count=0
var xy:[[Int]]=[]
for _ in 1...n{
  let a=readInts()
  xy.append(a)
}
for i in 0...n-1{
  for j in 0...n-1{
    var distance=0
    for k in 0...n-1{
      distance+=(xy[i][k]-xy[j][k])*(xy[i][k]-xy[j][k])
    }
    if Double(sqrt(Double(distance)))-Double(Int(sqrt(Double(distance))))==0.0{
      count+=1
    }
  }
}
print(count)
//  [swift]
let n=Int(readLine()!)!
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let pp=readInts()
var count=0
for i in 1...(n-1){
  if (pp[i-1]<pp[i])&&(pp[i]<pp[i+1]){
    count+=1
  }else if (pp[i-1]>pp[i])&&(pp[i]>pp[i+1]){
    count+=1
  }
}

print(count)
//  [typescript]
'use strict'
const main = (input: string) => {
    const std: string[] = input.split('\n');
    const n = Number(std.shift())
    const p = std.shift().split(' ').map(Number)
    let count = 0
    for (let i = 1; i < n-1; i++) {
        if (p[i-1] < p[i] && p[i] < p[i+1] || p[i-1] > p[i] && p[i] > p[i+1]) {
            count++
        }
    }
    console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let n=t.n()
  let a=t.n(n)
  let ans=0
  for(let i=1;i<n-1;i++)if((a[i]>a[i-1]&&a[i]<a[i+1])||(a[i]<a[i-1]&&a[i]>a[i+1]))ans++
  t.o(ans)
}
main()
//  [typescript]
import { readFileSync } from 'fs'

function main(input: string) {
  const [N, ...list] = input.trim().split(/\s/).map(Number)

  const result = list
    .map((v, i, self) => [self[i - 1], v, self[i + 1]])
    .filter(([a, b, c]) => (a < b && b < c) || (a > b && b > c))

  console.log(result.length)
}

main(readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
let input = '';
let count = 0;

process.stdin.on('data', (chunk: any) => {
  input += chunk;
  if (count === 1) {
    const args = normalize(input);
    main(args[0], args[1]);
  }
  count++;
});

function main(_: number, ps: number[]) {
  const matchedList = ps.filter((p, i, self) => {
    if (i === 0 || i === self.length - 1) return false;
    const sorted = [self[i - 1], p, self[i + 1]].sort((a, b) => a - b);
    return sorted[1] === p;
  });
  console.log(matchedList.length);
}

function normalize(input: any): [number, number[]] {
  const inputs = input.toString().split('\n');
  const n = Number(inputs[0]);
  const ps = inputs[1].split(' ').map((p: string) => Number(p));
  return [n, ps];
}
//  [typescript]
let input = '';
let count = 0;

process.stdin.on('data', (chunk: any) => {
  input += chunk;
  if (count === 1) {
    const args = normalize(input);
    main(args[0], args[1]);
    process.exit();
  }
  count++;
});

function main(_: number, ps: number[]) {
  const matchedList = ps.filter((p, i, self) => {
    if (i === 0 || i === self.length - 1) return false;
    const sorted = [self[i - 1], p, self[i + 1]].sort((a, b) => a - b);
    return sorted[1] === p;
  });
  console.log(matchedList.length);
}

function normalize(input: any): [number, number[]] {
  const inputs = input.toString().split('\n');
  const n = Number(inputs[0]);
  const ps = inputs[1].split(' ').map((p: string) => Number(p));
  return [n, ps];
}
//  [typescript]
process.stdin.resume();
process.stdin.setEncoding('utf8');
let input = '';
let count = 0;

process.stdin.on('data', (chunk: any) => {
  input += chunk;
  if (count === 1) {
    main(...normalize(input));
    process.exit();
  }
  count++;
});

function main(_: number, ps: number[]) {
  const matchedList = ps.filter((p, i, self) => {
    if (i === 0 || i === self.length - 1) return false;
    const sorted = [self[i - 1], p, self[i + 1]].sort((a, b) => a - b);
    return sorted[1] === p;
  });
  console.log(matchedList.length);
}

function normalize(input: any): [number, number[]] {
  const inputs = input.toString().split('\n');
  const n = Number(inputs[0]);
  const ps = inputs[1].split(' ').map((p: string) => Number(p));
  return [n, ps];
}
//  [python]
x,y=map(int,input().split())
result='No'
if x*4>=x:
    for i in range(x+1):
        if i*4+(x-i)*2==y:
            result='Yes'
            break
print(result)
//  [python]
x,y = map(int,input().split())
for i in range(x+1):
    t = y-2*i
    if t == 4*(x-i):
        print('Yes')
        exit()
print('No')
//  [python]
X,Y = list(map(int,input().split()))

x = 2.0*X - Y/2.0
y = Y/2.0 - X

if x >= 0 and y >= 0 and x == int(x) and y == int(y):
    print("Yes")
else:
    print("No")
//  [python]
x,y = map(int,input().split())
bool = False
for i in range(x+1):
    for j in range(x-i+1):
        if 2*i + 4*j == y:
            bool = True
if bool:
    print('Yes')
else:
    print('No')
//  [python]
x, y = map(int, input().split())
ans = 'No'
for i in range(x + 1):
    for j in range(x, -1, -1):
        if i * 2 + j * 4 == y:
            ans = 'Yes'
            break

print(ans)
//  [python]
x, y = map(int, input().split())
ans = 'No'
for i in range(1, x + 1):
    for j in range(x - i, -1, -1):
        if i * 2 + j * 4 == y or i * 2 == y or j * 4 == y:
            ans = 'Yes'
            break

print(ans)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solution sol = new Solution();
		sol.solve(in, out);
		out.close();
	}

	private static class Solution {
		private void solve(InputReader in, PrintWriter out) {
			int heads = in.ni(), legs = in.ni();
			if (legs % 2 != 0 || heads == 0 || heads > legs) out.println("No");
			else {
				int t = (legs + (-2*heads))/2;
				int c = heads - t;
				if (t < 0 || c < 0) {
					out.println("No");
					return;
				}
				out.println("Yes");
			}
		}
	}

	private static class InputReader {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		private InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		private String n() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		private int ni() {
			return Integer.parseInt(n());
		}
	}

}
//  [java]
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		
	 		StringTokenizer st = new StringTokenizer(bf.readLine());
	 		int a = Integer.parseInt(st.nextToken());
	 		int b = Integer.parseInt(st.nextToken());
	 		int d = b-2*a;
	 		if (d%2 == 1 || d <0)
	 		{
	 			
	 			out.println("No");
	 		}else{
	 			int t = d/2;
	 			if (a >= t){
	 				out.println("Yes");
	 			}
	 			else{
	 				out.println("No");
	 			}
	 		}
	 		
	 		
 		
 		
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is
//  [java]
 import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;

import javax.sound.sampled.ReverbType;

public class Main {

	 static Scanner scan=new Scanner(System.in);
	 static int cnt=0;
	 static int M=(int)1e9+7;
	static boolean issamedi(int i,int j){
		if(i>0&&j<0)
			return false;
		if(i>0&&j>0&&i>j)
			return false;
		return true;
		
		
	}

	
		static boolean isvowel(char c) {
			return c=='a'||c=='e'||c=='i'||c=='o'||c=='u';
			
		}
	 public static int maxVowels(String s, int k) {
	        int i=0;
	        ArrayList<Integer>lenghts=new ArrayList<Integer>();
	        for(int j=0;j<s.length();j++) {
	        	if(i==k)
	        		i=0;
	        	if(!isvowel(s.charAt(j)))
	        		i=0;
	        	if(isvowel(s.charAt(j))) {
	        		i++;
	        		lenghts.add(i);
	        		}
	        	
	        }
	        try {
	        return Collections.max(lenghts);
	        }
	        catch (NoSuchElementException e) {
	        return 0;}
	    }
	
	 static int convert(int n) {
		 String s=String.valueOf(n);
		 String s1="";
		 s1+=s.charAt(0);
		 int c=0;
		 for(int i=1;i<s.length();i++)
		 s1+='0';
		 return Integer.parseInt(s1);
	 }
	 static  boolean ispositive(ArrayList<Integer>ar) {
		 for(int i=0;i<ar.size();i++) {
			 if(ar.get(i)>0)
				 return true;
			 }
		 return false;
		 
	 }
	public static void main(String[] args) throws IOException {
int x=scan.nextInt();
int y=scan.nextInt();

		for(int i=0;i<x+1;i++) {
			int a=x-i;
			if (2 * i + 3 * a == y) {
				System.out.println("Yes");
			return;	
			}
			
		}
		System.out.println("No");
		
		
		}
		
 




	
	

	
	

	

	
}
//  [java]
 import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;

import javax.sound.sampled.ReverbType;

public class Main {

	 static Scanner scan=new Scanner(System.in);
	 static int cnt=0;
	 static int M=(int)1e9+7;
	static boolean issamedi(int i,int j){
		if(i>0&&j<0)
			return false;
		if(i>0&&j>0&&i>j)
			return false;
		return true;
		
		
	}

	
		static boolean isvowel(char c) {
			return c=='a'||c=='e'||c=='i'||c=='o'||c=='u';
			
		}
	 public static int maxVowels(String s, int k) {
	        int i=0;
	        ArrayList<Integer>lenghts=new ArrayList<Integer>();
	        for(int j=0;j<s.length();j++) {
	        	if(i==k)
	        		i=0;
	        	if(!isvowel(s.charAt(j)))
	        		i=0;
	        	if(isvowel(s.charAt(j))) {
	        		i++;
	        		lenghts.add(i);
	        		}
	        	
	        }
	        try {
	        return Collections.max(lenghts);
	        }
	        catch (NoSuchElementException e) {
	        return 0;}
	    }
	
	 static int convert(int n) {
		 String s=String.valueOf(n);
		 String s1="";
		 s1+=s.charAt(0);
		 int c=0;
		 for(int i=1;i<s.length();i++)
		 s1+='0';
		 return Integer.parseInt(s1);
	 }
	 static  boolean ispositive(ArrayList<Integer>ar) {
		 for(int i=0;i<ar.size();i++) {
			 if(ar.get(i)>0)
				 return true;
			 }
		 return false;
		 
	 }
	public static void main(String[] args) throws IOException {
int x=scan.nextInt();
int y=scan.nextInt();

		if(x%2==1&&y%2==0)
			System.out.println("Yes");
	//	else if(x%2==0&&y%2==0)
		//	System.out.println("No");
		else { 
			int div=y/x;
			int temp=y%x;
			div=div*2;
			y=y-div;
			if(temp*3==y)
				System.out.println("Yes");
			else
			System.out.println("No");
		
		
		}
		
 }




	
	

	
	

	

	
}
//  [cpp]
#include <cstdio>

int main(void){
	int X,Y;
	scanf("%d %d",&X,&Y);
	puts(Y>=2*X&&Y<=4*X&&Y%2==0?"Yes":"No");
	return 0;
}
//  [cpp]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
    long long int i, j, k, n, a, b, ans=0, po=0, x, y;
    char name[30];
    scanf("%lld %lld", &x, &y);
    if(y%2 != 0) printf("No");
    else if(2*x <= y && y <= 4*x) printf("Yes");
    else printf("No");

}
//  [cpp]
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int h,t;
    scanf("%d%d",&h,&t);
    int cha=h*4-t;
    if(cha%2==0&&(0<=cha/2&&cha/2<=h)) puts("Yes");
    else puts("No");
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main(){
  int x, y;
  cin >> x >> y;

  bool flag = false;
  for(int i=0; i<=x; i++){
    for(int j=0; j<=x-i; j++){
      if(2*i + 4*j == y)
        flag = true;
    }
  }
    
  if(flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
//  [cpp]
//shara's here
//speeeeeeeeeed is keeeeeeeeeey
//reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaadddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
#include <bits/stdc++.h>
using namespace std;
typedef string s;
typedef long long ll;
typedef long double ld;
const ll inf = 1e18 + 10;
const ll minf = -(1e18 + 10);
const ll mod = 1e9 + 7;
#if !defined(ONLINE_JUDGE)
#include "debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define all(x) x.begin(),x.end()
#define vl vector<ll>
#define vll vector<vector<ll> >
#define ins insert
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int main(){
    speed
    ll x , y;
    cin >> x >> y;
    debug(x,y);
    while(x>0){
    if(x-4>=0)x-=4;
    else if(x-2>=0)x-=2;
    else break;
    }
    puts(x==0?"No":"Yes");
    
























return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/
//  [cpp]
//shara's here
//speeeeeeeeeed is keeeeeeeeeey
//reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaadddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
#include <bits/stdc++.h>
using namespace std;
typedef string s;
typedef long long ll;
typedef long double ld;
const ll inf = 1e18 + 10;
const ll minf = -(1e18 + 10);
const ll mod = 1e9 + 7;
#if !defined(online_judge)
#include "debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define all(x) x.begin(),x.end()
#define vl vector<ll>
#define vll vector<vector<ll> >
#define ins insert
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int main(){
    speed
    ll x , y;
    cin >> x >> y;
    debug(x,y);
    while(x>0){
    if(x-4>=0)x-=4;
    else if(x-2>=0)x-=2;
    else break;
    }
    puts(x==0?"No":"Yes");
    
























return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/
//  [c]
#include <stdio.h>

int main() {
	int X, Y;
	scanf("%d%d", &X, &Y);
	if (Y % 2 != 0) {
		printf("No\n");
	} else if (Y < 2 * X || 4 * X < Y) {
		printf("No\n");
	} else {
		printf("Yes\n");
	}
	return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    int X, Y;

    scanf("%d %d", &X, &Y);

    for (int i = 1; i <= X; i++) {
        if (Y == 2 * i + (X - i) * 4) {
            printf("Yes");
            return 0;
        }
    }
    printf("No");

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

int main(void) {
	int x, y;
	scanf("%d %d", &x, &y);
	int i, n;
	for (i = 0; i <= x; i++) {
		n = 2 * i + 4 * (x - 1);
			if (n == y) {
				printf("Yes");
			}
			else {
				printf("No");
			}
			break;
	}
	return 0;

}
//  [c]
#include<stdio.h>
 
int main(void){
  int X,Y,i;
  scanf("%d %d",X,Y);
  for(i=0;i<=X;i++){
    if((2*i+4*(X-i))==Y){
      printf("Yes\n");
      return 0;
      }
  }
  printf("No\n");
  return 0;
 
}
//  [javascript]
"use strict"
function main(arg) {
    let [X,Y] = arg.trim().split("\n")[0].split(" ").map(Number)
    for (let i = 0; i <= X; i++) {
        let a = i * 2 + (X-i) * 4
        if (a === Y) {
            console.log('Yes')
            return
        }
    }
    console.log('No')
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
    input = input.split(" ");
  	const total = parseInt(input[0]);
  	const foot = parseInt(input[1]);
  	let bool = false;
  	for(let i=0; i<=total; i++){
    	if(4*i+2*(total-i) == foot){
        	console.log("Yes");
          	bool=true;
          	break;
        }
    }
  if(!bool){
  	console.log("No");
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {

	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    
    let x = parseInt(input[0].split(" ")[0]);
    let y = parseInt(input[0].split(" ")[1]);
    
    let flag = false;
    
    for (let i = 0; i <= x; i++){
        
        if (i * 2 + (x - i) * 4 == y) flag = true;
        
    }
    
    if (flag) console.log("Yes");
    else console.log("No");
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
const main = (input) => {
  const [x, y] = input.trim().split(' ').map(Number)

  const turtle = Math.max((y-2*x) / 2, 0)
  const crane = Math.max(x - turtle, 0)

  return console.log((turtle + crane === x) && (turtle*4 + crane*2 === y) ? 'Yes' : 'No')
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
const main = (input) => {
  const [x, y] = input.trim().split(' ').map(Number)

  const turtle = (y-2*x) / 2
  const crane = Math.max(x - turtle, 0)

  return console.log((turtle + crane === x) && (turtle*4 + crane*2 === y) ? 'Yes' : 'No')
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
function Main(input) {
  input = input.split("\n");
  const X = parseInt(input[0].split(" ")[0]);
  const Y = parseInt(input[0].split(" ")[1]);

  if ((Y - X * 2) % 2 === 0 && X * 4 <= Y && X * 2 <=Y) {
    console.log("Yes");
  } else {
    console.log("No");
  }
}

// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

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

import "fmt"

func main() {
	var x, y int
	fmt.Scan(&x, &y)
	if y%2 == 1 {
		fmt.Println("No")
		return
	}
	ansx := 2*x - (y / 2)
	ansy := y/2 - x
	if ansx < 0 || ansy < 0 {
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")
	return
}
//  [go]
package main

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

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

func scanText() string {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Scan()
	return sc.Text()
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	x, y := scanInt(), scanInt()
	if 2*x <= y && y <= 4*x && y%2 == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	a := nextInt()
	turu := 0

	for turu = 0; turu <= n; turu++ {

		if turu*2+(n-turu)*4 == a {
			fmt.Println("Yes")
			return
		}
	}

	fmt.Println("No")
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main

import "fmt"

func main() {
	var X, Y int
	ans := "No"

	fmt.Scan(&X, &Y)

	for i := 0; i <= X; i++ {
		for j := 0; j <= X - i; j++ {
			if (2 * i + 4 * j == Y) {
				ans = "Yes"
			}
		}
	}

	fmt.Println(ans)
}
//  [go]
package main

import "fmt"

func main() {
	var X, Y int
	ans := "No"

	fmt.Scan(&X, &Y)

	for i := 0; i =< X; i++ {
		for j := 0; j =< X - i; j++ {
			if (2 * i + 4 * j == Y) {
				ans = "Yes"
			}
		}
	}

	fmt.Println(ans)
}
//  [go]
package main

import "fmt"

func main() {
	var X, Y int
	ans := "No"

	fmt.Scan(&X, &Y)

	for i := 0; i < X; i++ {
		for j := 0; j < X - i; j++ {
			if (2 * i + 4 * j == Y) {
				ans = "Yes"
			}
		}
	}

	fmt.Println(ans)
}
//  [ruby]
X, Y = ARGF.gets.chomp.split.collect {|el| el.to_i}

ans = "No"
for tt in 0..X
  kk = X - tt
  if tt * 2 + kk * 4 == Y
    ans = "Yes"
    #p tt, kk
    break
  end
end

puts ans
//  [ruby]
io = STDIN
xy=io.gets.split.map(&:to_i)
hash={}
51.times do |t|
  26.times do |k|
    hash[[t+k,t*2+k*4]]=true
  end
end
if hash[xy]
  puts 'Yes'
else
  puts 'No'
end
//  [ruby]
a, b = gets.split.map(&:to_i)

(0..a).each do |i|
  if b == (i*2) + (a - i)*4 
    puts "Yes"
  	exit
  end
end

puts "No"
//  [ruby]
x,y = gets.chomp.split(" ").map(&:to_i)
puts "No" if y % 2 != 0
puts x >= (y/4).to_f ? "Yes" : "No"
//  [ruby]
x,y = gets.chomp.split(" ").map(&:to_i)
puts x >= (y/4).to_f ? "Yes" : "No"
//  [ruby]
x,y = gets.split(" ").map(&:to_i)
res = 0
(0..x).each do |i|
  if (4*i + 2*(x-i)) == y
    res = "Yes"
  end
end
 
if res == "Yes"
  p res
else
  p "No"
end
//  [rust]
use proconio;

#[proconio::fastout]
fn main() {
    proconio::input! {
        x: usize,
        y: usize,
    }

    let result = (0..=x).map(|i| 2 * i + 4 * (x - i)).any(|v| v == y);
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}
//  [rust]
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<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()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let x: usize = read();
    let y: usize = read();
    if x * 2 > y || y > x * 4 || y %2 == 1{
        println!("No");
    } else {
        println!("Yes");
    }
}
//  [rust]
#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::cmp::min;
#[allow(unused_imports)]
use std::fmt;
#[allow(unused_imports)]
use std::fmt::Debug;
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let input = get_vec_input();
    let x: usize = input[0];
    let y: usize = input[1];

    if (y - 2 * x) % 2 == 0 && (y - 2 * x) / 2 <= x {
        println!("Yes");
    } else {
        println!("No");
    }
}

#[allow(dead_code)]
fn get_digit(value: i64) -> i64 {
    let mut digit = 0i64;
    let mut value = value;
    while value != 0 {
        value /= 10;
        digit += 1;
    }
    digit
}

#[allow(dead_code)]
fn sum_digit2(value: String) -> u32 {
    return value.chars().fold(0u32, |a, b| a + b.to_digit(10).unwrap());
}

#[allow(dead_code)]
fn sum_digit(value: i64) -> i64 {
    if value < 10 {
        return value;
    }
    return sum_digit(value / 10) + value % 10;
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn get_vec_input<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<T> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

#[allow(dead_code)]
fn get_tuple_input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}

#[allow(dead_code)]
fn get_string_input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.trim().to_string()
}
//  [rust]
use proconio::input;

fn main() {
    input! {
        x: isize,
        y: isize,
    }

    if y >= 2 * x && y <= 4 * x {
        println!("Yes");
    } else {
        println!("No");
    }
}
//  [rust]
use proconio::*;

fn main() {
    input! {
        x: i64,
        y: i64
    }

    let m = 4 * x - y;
    if m % 2 == 0 && m >= 0 {
        println!("Yes");
    }
    else {
        println!("No");
    }
}
//  [swift]
func readIntPair() -> (Int, Int) {
    let line = readLine()!.split(separator: " ").map({Int($0)!})
    return (line[0], line[1])
}

let (X, Y) = readIntPair()
if (Y - 2 * X >= 0 && Y % 2 == 0) {
    let t = (Y - 2 * X) / 2
    print(X - t >= 0 ? "Yes" : "No")
} else {
    print("No")
}
//  [swift]
let inputs = readLine()!.split(separator: " ").map { Int($0)! }

let X = inputs[0]
let Y = inputs[1]

let y = (2 * X - Y) / -2
let x = X - y

print(x >= 0 && y >= 0 && 2 * x + 4 * y == Y ? "Yes" : "No")
//  [swift]
class B {
    static func solve() {
        let XY = readLine()!.split(separator: " ").map { Int($0)! }
        let X = XY[0]
        let Y = XY[1]
        for i in 0...X {
            if i * 2 + (X - i) * 4 == Y {
                print("Yes")
                return
            }
        }

        print("No")
    }
}

B.solve()
//  [swift]
import Foundation
 
let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ")
 
let x = Int(split[0])!
let y = Int(split[1])!

if (y-2*x>0 && 4*x-y>0 || y-2*x>0 && 4*x-y==0 || y-2*x==0 && 4*x-y>0){
    print("Yes")
}else{
    print("No")
}