akhauriyash/Code-Regression huggingface dataset:
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val ab = inputs.head.split(" ").map(_.toInt)
  val a  = ab(0)
  val b  = ab(1)

  println(solve(a, b))

  def solve(a: Int, b: Int): Int = {
    var ans = 0
    (a to b).foreach { i =>
      val str = i.toString
      if (str(0) != '0' && str(0) == str(4) && str(1) == str(3)) {
        ans = ans + 1
      }
    }

    ans
  }
}

Measured memory_bytes: 56292
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <utility>
#include <algorithm>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <numeric>
#include <list>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

signed main(void) {
    
    int N, K;
    cin >> N >> K;
    vector<pi> sushi(N);
    vector<int> best_sushi(N+1, 0); //best_sushi[k]:種類kの寿司の中の最も美味しいやつ
    rep(i, N) {
        int t, d;
        cin >> t >> d;
        best_sushi[t] = max(best_sushi[t], d);
        sushi[i] = mp(d, t);
    }
    
    sort(all(sushi));
    reverse(all(sushi));
    
    //まず美味しい順にK個とる
    vector<ll> ans;
    ll oisisa = 0;
    int x=0;
    vector<int> cnt(N+1, 0); //cnt[i]:種類iの寿司がいくつ採用されているか
    stack<int> changeable; //他と入れ替えていい寿司を美味しい順に登録
    rep(i, K) {
        oisisa += (ll)sushi[i].fi;
        if (cnt[sushi[i].se] == 0) x++;
        cnt[sushi[i].se]++;
        if (cnt[sushi[i].se] >= 2) {
            changeable.push(i);
        }
    }
    ans.pb(oisisa + x * x);
    
    // cout << ans[0] << endl;
    
    Rep(i, K, N) {
        if (changeable.size() < 1) break;
        if (cnt[sushi[i].se] == 0) {
            oisisa += best_sushi[sushi[i].se];
            // cout << "追加した寿司の美味しさ" << sushi[i].fi << endl;
            oisisa -= sushi[changeable.top()].fi;
            changeable.pop();
            cnt[sushi[i].se]++;
            // cout << "取り除いた寿司の美味しさ" << sushi[K-1-added].fi << endl;
            x++;
            // cout << "oisisa : " << oisisa << endl;
            // cout << "x : " << x << endl;
            ans.pb(oisisa + x * x);
        }
        // cout << *(ans.end()-1) << endl;
    }
    
    cout << *max_element(all(ans)) << endl;
    
    return 0;
}






Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    if((S[0]==S[1]&&S[2]==S[3]&&S[0]!=S[2])||(S[0]==S[2]&&S[1]==S[3]&&S[0]!=S[1])||(S[0]==S[3]&&S[1]==S[2]&&S[0]!=S[2])){printf("Yes\n");}
    else{printf("No\n");}

}


int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
using namespace std;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    
    int ans = 0;
    
    for(int i = 1; i < s.size() - 1; i++){
        int cnt = 0;
        int a[26];
        fill(a, a + 26, 0);
        for(int j = 0; j < i; j++){
            if(a[s[j] - 'a'] == 0) a[s[j] - 'a'] = 1;
        }
        
        for(int j = i; j < n; j++){
            if(a[s[j] - 'a'] == 1) {
                cnt++;
                a[s[j] - 'a'] = 2;
            }
        }
        ans = max(cnt, ans);
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <limits.h>
#include <math.h>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 100000000;
typedef double D;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
//typedef pair<int, int> P;

/** Problem0041 : Expression **/
int calc(int a, int b, char c)
{
	switch (c) {
		case '+': return a+b; break;
		case '-': return a-b; break;
		case '*': return a*b; break;
	}
}

int main()
{
	char ope[] = {'+', '+', '+', '*', '*', '*', '-', '-', '-'};
	int num[4];

	while (cin>>num[0]>>num[1]>>num[2]>>num[3], num[0]||num[1]||num[2]||num[3]) {
		sort(num, num+4);
		do {
			sort(ope, ope+9);
			do {
				if (calc(calc(calc(num[0], num[1], ope[0]), num[2], ope[1]), num[3], ope[2])==10) {
					printf("((%d %c %d) %c %d) %c %d\n", num[0], ope[0], num[1], ope[1], num[2], ope[2], num[3]);
					goto next;
				}
				
				else if (calc(calc(num[0], calc(num[1], num[2], ope[1]), ope[0]), num[3], ope[2])==10) {
					printf("(%d %c (%d %c %d)) %c %d\n", num[0], ope[0], num[1], ope[1], num[2], ope[2], num[3]);
					goto next;
				}

				else if (calc(num[0], calc(num[1], calc(num[2], num[3], ope[2]), ope[1]), ope[0])==10) {
					printf("%d %c (%d %c (%d %c %d))\n", num[0], ope[0], num[1], ope[1], num[2], ope[2], num[3]);
					goto next;
				}
				
				else if (calc(calc(num[0], num[1], ope[0]), calc(num[2], num[3], ope[2]), ope[1])==10) {
					printf("(%d %c %d) %c (%d %c %d)\n", num[0], ope[0], num[1], ope[1], num[2], ope[2], num[3]);
					goto next;
				}
				
				else if (calc(num[0], calc(calc(num[1], num[2], ope[1]), num[3], ope[2]),  ope[0])==10) {
					printf("%d %c ((%d %c %d) %c %d)\n", num[0], ope[0], num[1], ope[1], num[2], ope[2], num[3]);
					goto next;
				}
			} while (next_permutation(ope, ope+9));
		} while (next_permutation(num, num+4));
		printf("0\n");
	next:;
	}
}

Measured memory_bytes: 1168
int main()
{
    int  x,y,q,i,j,p;
    int a[7]={1,3,5,7,8,10,12};
    int b[4]={4,6,9,11};
    while(~scanf("%d%d",&x,&y))
    {
        q=0;p=0;
      for(i=0;i<7;i++)
      {
          if(x==a[i])
          {
              for(i=0;i<7;i++)
              {
                  if(y==a[i])
                    q++;
              }
          }
      }
      for(j=0;j<4;j++)
      {
          if(x==b[j])
          {
              for(j=0;j<4;j++)
              {
                  if(y==b[j])
                    p++;
              }
          }

      }
      if(p>0&&q==0)
        printf("Yes\n");
      if(q>0&&p==0)
        printf("Yes\n");
      if(x==2&&y==2)
        printf("Yes\n");
      if(p==0&&q==0&&x!=y)
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = 998244353
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    N, M = Scanner.map_int()
    A = Scanner.map_int()
    L = 1
    for i in range(N):
        L = Math.lcm(L, A[i] // 2)
    for a in A:
        if L % a != a // 2:
            print(0)
            return
    print(Math.roundUp(M // L, 2))
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 64492
#include "bits/stdc++.h"
using namespace std;

const int maxn = 1e5 + 5; 
int a[maxn];
long long dp[maxn];

int main(){
//	freopen("in.txt", "r", stdin);
	int n, k;
	scanf("%d %d", &n, &k);
	for(int i=1; i<=n; i++){
		scanf("%d", &a[i]);
	}
	for(int i=0; i<=n; i++)dp[i] = 1e17;
	dp[1] = 0;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=k; j++){
			if(i+j <= n){
				dp[i+j] = min(dp[i+j], dp[i] + abs(a[i]-a[i+j]));
			}
		}
	}printf("%lld", dp[n]);
}

Measured memory_bytes: 1408
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var HA = ReadSplitInt();
            Println(Math.Ceiling(HA[0] * 1.0 / HA[1]));
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



Measured memory_bytes: 13396
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int LL;
typedef LL ll;
typedef long double ld;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); } 
const ll M=2e5+5,LG=19,SM=600+5,inf=1e18+1;
ll mod=1e9+7;

ll ps[M];
ll psp[M];
ll a[M];
ll n,k;

int main()
{
	ios::sync_with_stdio(0);
    cin >> n >> k;  
    For(i,0,n) cin >> a[i];    
    For(i,0,n)
    {
        ps[i+1]=ps[i]+a[i];
        psp[i+1]=psp[i]+max(0LL,a[i]);
    }
    ll res=0;
    For(i,k,n+1)
    {
        smax(res,psp[i-k]+psp[n]-psp[i]+
            max(0LL,ps[i]-ps[i-k]));    
    }
    RET(res);
}    

Measured memory_bytes: 3584
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using static System.Math;
using Debug = System.Diagnostics.Debug;

static class P
{
    static void Main()
    {
        var nd = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var sec = nd[1] + 1 + nd[1];
        Console.WriteLine((nd[0] + sec - 1) / sec);
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define TRACE
#define M 1000000007
#define oo 1000000000000000007
#define F first
#define S second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
#define pb push_back
#define M6 1000009
#define M5 500009
#define pi 3.14159265
#define epsilon 1e-6

#ifdef TRACE
    #define trace1(x)                cerr << #x << ": " << x << endl;
    #define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
    #define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
    #define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
    #define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
    #define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
#else
 
    #define trace1(x)
    #define trace2(x, y)
    #define trace3(x, y, z)
    #define trace4(a, b, c, d)
    #define trace5(a, b, c, d, e)
    #define trace6(a, b, c, d, e, f)
 
#endif
ll power(ll x,ll n,ll m){
    ll res=1;
    while(n>0){
        if(n&1) res=(res*x)%m;
        n/=2;
        x=(x*x)%m;
    }
    return res;
}

ll n,m,A[M5];
int  main()
{   //ios_base::sync_with_stdio (0), cin.tie (0);
    //sieve();
    //init();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll tc=1,t=0,i,j,k,a,b,c,d,l,r;
    //cin>>tc;
    while(t++<tc){
        //cout<<"Case #"<<t<<": ";
        cin>>n;
        vector<ll> v;
        for(i=1;i<=n;i++) {
            cin>>k;
            v.pb(k);
        }
        sort(v.begin(),v.end());
        double a=v[0];
        for(i=1;i<v.size();i++){
            a=(a+v[i])*1.0/2;
        }
        cout<<fixed<<setprecision(9)<<a;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n,m;cin>>n>>m;
	vector<int> a(n,-1);
	for(int i = 0; i < m; i++) {
		int s,c;cin>>s>>c;
		if (a[s - 1] != -1 && a[s - 1] != c){
			cout << -1 << endl;
			return 0;
		} 
		else{
			a[s - 1] = c;
		}
	}
	int ans = 0;
	if (a[0] == 0 && n != 1){
		cout << -1 << endl;
		return 0;
	}
	if(n == 1 && m == 0){
		cout << 0 << endl;
		return 0;
	}
	for(int i = 1; i <= n; i++) {
		if (a[n - i] == -1){
			if (n - i == 0){
				ans += pow(10,n - 1);
			}
		}
		else{
			ans += a[n - i] * pow(10,i - 1);
		}
	}
	// for(int i = 0; i < n; i++) {
	// 	cout << a[i] << endl;
	// }
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int c = sc.nextInt();
    int[] a = new int[m];
    for (int i = 0; i < m; i++){
      a[i] = sc.nextInt();
    }
    int ans = 0;
    for (int i = 0; i < n; i++){
      int s = 0;
      for (int j = 0; j < m; j++){
        int b = sc.nextInt();
        s += a[j] * b;
      }
      if (s+c > 0) ans++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 36148
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		int lines = Integer.parseInt(sc.nextLine());
		for (int i = 0; i < lines; i++) {
			String line = sc.nextLine();
			
			if (line.contains("Hoshino")) {
				Pattern p = Pattern.compile("Hoshino");
				Matcher m = p.matcher(line);
				
				line = m.replaceAll("Hoshina");
			}
			
			System.out.println(line);
		}
	}
}

Measured memory_bytes: 26292
#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define cbrt cbrtl
using namespace std;
string s;
int main()
{
	cin>>s;
	ll l=s.length();
	ll i,j;
	ll ans=0;
	for(i=0;i<l;i++)
	{
		if(i+1==l)
		{
			ans++;
			break;
		}
		if(s[i]==s[i+1])
		{
			ans++;
			if(i+2<l)
			{
				ans++;
				i+=2;
			}
			else
				i++;
		}
		else
			ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define pp pop_back
#define mp make_pair
#define F first
#define S second
#define xmax(x,y) ((x) = max((x),(y)))
#define xmin(x,y) ((x) = min((x),(y)))
#define all(x) (x).begin(),(x).end()
#define mem(x) memset(x , 0 , sizeof(x))
#define _ ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define FP(a , b , c)  for(ll (a) = (b) ; (a) < (c) ; (a++));
#define FM(a , b , c)  for(ll (a) = (b) ; (a) >= (c) ; (a--));
#define connect(a , b , c) a[b].pb(c) , a[c].pb(b)

typedef long long int ll;
typedef unsigned long long int ull;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector <ll> vl;
typedef vector <int> vi;
typedef vector <string> vs;

const ll Maxn3 = 1e3 + 10;
const ll Maxn4 = 1e4 + 10;
const ll Maxn5 = 1e5 + 10;
const ll Maxn6 = 1e6 + 10;
const ll Maxn7 = 1e7 + 10;
const ll Maxn8 = 1e8 + 10;
const ll Maxn9 = 1e9 + 10;
const ll Maxn18 = 1e18 + 10;
const ll Mod1 = 1e7 + 7;
const ll Mod2 = 1e9 + 7;
const ll LLMax = LLONG_MAX;
const ll LLMin  = LLONG_MIN;
const ll INTMax = INT_MAX;
const ll INTMin  = INT_MIN;

ll mn = LLMax , mx = LLMin;

int main()
{_
    ll n,k;cin >> n >> k;
	return cout << ((n%500) <= k ? "Yes" : "No") , 0;
}
///SAliB


Measured memory_bytes: 256
/*
Character Drawing Adapted from FAKEUPDATE.NET
		   _    _____         _
		   \`,""   ,'7"r-..__/ \
		  ,'\ `, ,',','    _/   \
		 /   \, 7 / /     (   \ |
		J     \/ j  L______\  / |
		L   __JF"""/""\"\_,    /
		L,-"| O|  f O |  L_  _/
		F   \_ /  \__/   `-  j|
			.-'    `"""    ,' |          _..====.._
			\__/         r"_  A        ,' _..---.._`,
			 `-.______,,-L// / \  ___,' ,'_..:::.. `,`,
					  j   / / / 7"    `-<""=:'  '':. \ \
					 /   <,' /  F  . i , \   `,    :T W I
					 |    \,'  /    >X<  |     \   :| | L
					 |     `._/    ' ! ` |      I  :| |  G
					  \           \     /       |  :H T  |
					 __>-.__   __,-\   |        |  S P   |
					/     /|   | \  \  \_       | 'A R   |
				   /   __/ |   |  L  L   \      K./ /    L
				  /   |    |   4  I  I    |    E./ /   ,'
				 J    \    I    L F  I    |    // / _,'
		_________|     |   F    |J   F    |   //_/-'
		\   __   |    /   J     |/  J     |  /="
		\\  \_\  \__,' \  F     |   F     |
		\\\_____________\/      F__/      F
		 \\| 计算机编程 |_____/  (______/
		  \/从入门到入土/
*/
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
#include <functional>
using namespace std;
#define MATH_PI 3.14159265358979323846
int main(){
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	if (S == "KIHBR" ||
		S == "AKIHBR" ||
		S == "KIHABR" ||
		S == "KIHBAR" ||
		S == "KIHBRA" ||
		S == "AKIHABR" ||
		S == "AKIHBRA" ||
		S == "AKIHBAR" ||
		S == "KIHABAR" ||
		S == "KIHABRA" ||
		S == "KIHBARA" ||
		S == "AKIHABAR" ||
		S == "AKIHABRA" ||
		S == "AKIHBARA" ||
		S == "KIHABARA" ||
		S == "AKIHABARA"
		)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
endapp:
	//system("pause > nul");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	bool card[4][13] = {false};
	char mark;
	int n, x;
	cin >> n;
	
	for(int i = 0; i < n; i++){
		cin >> mark >> x;
		if(mark == 'S') card[0][x-1] = true;
		else if(mark == 'H') card[1][x-1] = true;
		else if(mark == 'C') card[2][x-1] = true;
		else if(mark == 'D') card[3][x-1] = true;
	}
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 13; j++){
			if(card[i][j] == false){
				if(i == 0) cout << "S" << " " << j+1 <<endl;
				else if(i == 1) cout << "H" << " " << j+1 <<endl;
				else if(i == 2) cout << "C" << " " << j+1 <<endl;
				else if(i == 3) cout << "D" << " " << j+1 <<endl;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 3088
using System;
using System.Linq;

namespace Sort_I
{
    class Stable_Sort
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var cards = new Card[n];
            var c = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
                cards[i] = new Card(c[i]);

            Card.BubbleSort(cards);
            for (int i = 0; i < n - 1; i++)
                Console.Write(cards[i] + " ");
            Console.WriteLine(cards.Last());
            Console.WriteLine("Stable");

            var cards2 = new Card[n];
            for (int i = 0; i < n; i++)
                cards2[i] = new Card(c[i]);
            Card.SelectionSort(cards2);

            for (int i = 0; i < n - 1; i++)
                Console.Write(cards2[i] + " ");
            Console.WriteLine(cards2.Last());
            
            if (Card.IsStable(cards,cards2)) Console.WriteLine("Stable");
            else Console.WriteLine("Not stable");
        }
    }

    struct Card
    {
        int rank;
        string suit;
        public Card(String s)
        {
            suit = s[0].ToString();
            rank = int.Parse(s[1].ToString());
        }

        public static void BubbleSort(Card[] cards)
        {
            for (int i = 0; i < cards.Length; i++)
            {
                for (int j = cards.Length - 1; j > i; j--)
                {
                    if (cards[j].rank < cards[j - 1].rank)
                    {
                        var temp = cards[j];
                        cards[j] = cards[j - 1];
                        cards[j - 1] = temp;
                    }
                }
            }
        }

        public static void SelectionSort(Card[] cards)
        {
            for (int i = 0; i < cards.Length; i++)
            {
                var minj = i;
                for (int j = i + 1; j < cards.Length; j++)
                {
                    if (cards[j].rank < cards[minj].rank) minj = j;
                }
                if (minj != i)
                {
                    var temp = cards[i];
                    cards[i] = cards[minj];
                    cards[minj] = temp;
                }
            }
        }

        public static bool IsStable(Card[] bubblesorted,Card[] cards)
        {
            for (int i = 0; i < bubblesorted.Length; i++)
            {
                if (!bubblesorted[i].Equals(cards[i])) return false;
            }
            return true;
        } 

        public override string ToString()
        {
            return suit + rank;
        }
    }
}

Measured memory_bytes: 9524
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef pair<int,int> P;
typedef long long ll;
const int INF = 1001001001;
const ll INFL = 1e17;
const int MOD = 1e9+7;


int main(){
    double a,b,x;
    cin >> a >> b >> x;
    double half = a*a*b/2.0;
    double now;
    if(x > half){
        now = 2.0/a*(b-x/a/a);
    }
    else{
        now = a*b*b/2.0/x;
    }
    printf("%.12lf\n",atan(now)*180.0/M_PI);
    return 0;
}

Measured memory_bytes: 4032
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;

int main()
{
    ll l, r;
    cin >> l >> r;
    int ans = 2019;
    r = min(r, l + 2019 * 2);
    for (ll i = l; i < r; i++)
    {
        for (ll j = i + 1; j <= r; j++)
        {
            int w = i * j % 2019;
            if (ans > w)
                ans = w;
            // if (ans == 0)
            // {
            //     cout << ans << endl;
            //     return 0;
            // }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//karna padega 
#include<bits/stdc++.h>
using namespace std;	
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;	i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
int cr[N];
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n ;
		int ans =0;
		int x;
		fn1{
			cin >> ar[i];
		}
		fn1{
			cin>>x;
			ans+=x;
		}
		for(int i =1;i<n;i++){
			cin >> cr[i];
		}
		for(int i =2;i<=n;i++)if(ar[i]-ar[i-1]==1)ans+=cr[ar[i-1]];
		cout<<ans;
	
	
	}
	return 0;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  
  cin >> N;
  
  if ( (N%1000)%111 == 0  ||  ( N-(N%10))%1110 == 0 ){
    cout << "Yes" << endl;
  }
      
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

vector<pair<long long, ll>> factorize(long long n){
    vector<pair<long long, ll>> res;
    
    if(n%2 == 0){
        res.emplace_back(2,0);
        while(n%2 == 0){
            n /= 2;
            res.back().second++;
        }
    }
    
    for(long long  i=3; i*i<=n; i+=2){
        if(n%i) continue;
        res.emplace_back(i,0);
        while(n%i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

void Main(){
    ll N; cin >> N;
    auto v = factorize(N);
    ll ans = 0;
    ll k = v.size();
    REP(i,k){
        auto p = v[i];
        ll n = p.second;
        ll l = 0, r = 1000;
        while(r-l>1){
            ll x = (l+r)/2;
            if(x*(x+1) <= 2*n) l = x;
            else r = x;
        }
        ans += l;
    }
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    ll t=1; //cin>>t;
    REP(_,t){
        Main();
    }
    return 0;
}

Measured memory_bytes: 3656
import Control.Applicative

import Text.Printf
import Data.Fixed (Pico)

main = do
  [x,y] <- map read . words <$> getLine
  putStrLn . toString . calc $ (x,y)

calc :: (Int,Int) -> (Int,Int,Pico)
calc (x,y) = (div x y,rem x y,(fromIntegral x / fromIntegral y) :: Pico)

toString :: (Int,Int,Pico) -> String
toString (x,y,z) = show x ++ " " ++ show y ++ " " ++ show z

Measured memory_bytes: 4096
#include<stdio.h>
int main(){
    int N,i;
    char a;
    
        N = 0;
    
    
    for (i=0;i<4;i++) {
    
    scanf("%c",&a);
    

    
    if (a=='+') {
        N = N + 1;
    } else if (a=='-') {
        N = N - 1;
    }
    
        
    }
    
 
    
    printf("%d\n",N);
    
    return 0;
    
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;

vector<int> adjl[100005];
bool visited[100005];
int arr[100005];
int n,k;
int ans = 0;

int func(int node){
    if (adjl[node].size()==0){
        return 1;
    }
    int maxf = 0;
    for (int x : adjl[node]){
        maxf = max(maxf,func(x));
    }
    maxf++;
    if (maxf==k && arr[node]!=1){
        //printf("node %d chosen\n",node);
        ans++;
        return 0;
    }
    return maxf;
}

int main(){
    scanf("%d%d",&n,&k);
    for (int x = 1; x<=n; x++){
        scanf("%d",&arr[x]);
    }
    if (k==1){
        int an = 0;
        for (int x = 1; x<=n; x++){
            if (arr[x]!=1) an++;
        }
        printf("%d",an);
        return 0;
    }
    if (arr[1]!=1) {
        ans++;
        arr[1] = 1;
    }
    for (int x = 2; x<=n; x++){
        adjl[arr[x]].push_back(x);
    }
    func(1);
    printf("%d",ans);


}





Measured memory_bytes: 10752
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	nextReader = NewScanner()
	a := nextInt()
	op := nextString()
	b := nextInt()
	if op == "+" {
		fmt.Println(a + b)
	} else {
		fmt.Println(a - b)
	}
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func minmax(a, b int) (int, int) {
	if a > b {
		return b, a
	}
	return a, b
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	return p[i].b < p[i].b
}

var nextReader func() string

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#ifndef U_L_LONG
typedef unsigned long long U_L_LONG;
#endif
#ifndef L_LONG
typedef long long L_LONG;
#endif

typedef std::pair<int, int> IntPair;

#ifndef LL_ABS
#define LL_ABS(x) (((((L_LONG)(x) < 0) ? ((L_LONG)(x) * (-1)) : ((L_LONG)(x)))))
#endif

//static void ABC120D_DecayedBridges();
//static void ABC119C_MonstersBattleRoyale();
static void ABC117C_Streamline();

#if 1
int main()
{
	//ABC120D_DecayedBridges();
	//ABC119C_MonstersBattleRoyale();
	ABC117C_Streamline();

	fflush(stdout);
	return 0;
}
#endif



class PointInfo
{
public:
	int _idx = 0;
	int _xpoint = 0;
	int _diffToNext = 0;
	bool _tokenExist = false;
};


//	移動方向は固定で考えて差し支えないはず.
static int calcMoveDist(std::vector<PointInfo>& vPtInfo, int infoSize)
{
	int dist = 0;

	for (int i = 0; i < infoSize; i++) {
		if (!vPtInfo[i]._tokenExist) {
			dist += vPtInfo[i]._diffToNext;
		}
	}

	return dist;
}
static int ABC117C_search(int restCnt, std::vector<PointInfo>& vPtInfo, int nowIdx, int infoCnt) 
{
	if ((restCnt == 0) || (nowIdx == infoCnt)) {
		//	移動距離を計算する
		return calcMoveDist(vPtInfo, infoCnt);
	}
	//	スタック削減対策
	auto cpInfo = new std::vector<PointInfo>(vPtInfo);
	
	//	今の場所に置かない場合
	int noPut = ABC117C_search(restCnt, *cpInfo, nowIdx + 1, infoCnt);

	//	今の場所に置く場合
	(*cpInfo)[nowIdx]._tokenExist = true;
	int put = ABC117C_search(restCnt - 1, *cpInfo, nowIdx + 1, infoCnt);

	delete cpInfo;

	return std::min(put, noPut);
}

static bool ABC117C_cmpDiff(PointInfo& a, const PointInfo& b)
{
	bool greater = false;
	//	降順ソート
	if (a._diffToNext > b._diffToNext) {
		greater = true;
	}
	else if (a._diffToNext == b._diffToNext) {
		if (a._idx > b._idx) {
			greater = true;
		}
	}

	return(greater);
}

static bool ABC117C_cmpXpoint(PointInfo& a, const PointInfo& b)
{
	return(a._xpoint < b._xpoint);
}

static bool ABC117C_cmpIdx(PointInfo& a, const PointInfo& b)
{
	return (a._idx < b._idx);
}

static void ABC117C_Streamline()
{
	const int ABC117C_MAX = 100000;

	int N = 0, M = 0;

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

	PointInfo ptInfo;
	std::vector<PointInfo> vPtInfo;

	for (int i = 0; i < M; i++) {
		scanf(" %d", &(ptInfo._xpoint));
		vPtInfo.push_back(ptInfo);
	}

	std::sort(vPtInfo.begin(), vPtInfo.end(), ABC117C_cmpXpoint);	//	x座標で昇順ソート

	for (int i = 0; i < (M - 1); i++) {
		vPtInfo[i]._idx = i;
		vPtInfo[i]._diffToNext = abs(vPtInfo[i + 1]._xpoint - vPtInfo[i]._xpoint);
	}
	//	最後の1点分を設定
	vPtInfo[M - 1]._idx = M - 1;
	vPtInfo[M - 1]._diffToNext = 0;
	// 必ずコマを置く
	vPtInfo[M - 1]._tokenExist = true;
	
	//	隣までの距離で降順ソート
	std::sort(vPtInfo.begin(), vPtInfo.end(), ABC117C_cmpDiff);	

	int move = 0;
	if (N < M) {
		for (int i = 0; i < N - 1; i++) {
			//	隣までが遠い順にコマを置く
			vPtInfo[i]._tokenExist = true;
		}
		//	index順に昇順ソート
		std::sort(vPtInfo.begin(), vPtInfo.end(), ABC117C_cmpIdx);

		//	順番に辿って距離を求める
		move = calcMoveDist(vPtInfo, vPtInfo.size());
	}

	printf("%d\n", move);
	return;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
long long sum;
set<int>s;
int main()
{
	int n,ai;
	cin>>n;
	for(int i=1; i<=n; i++)
	{
		cin>>ai;
		if(s.find(ai)==s.end())
			s.insert(ai);
		else
			s.erase(ai);
	}
	cout<<s.size()<<endl;
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>

#define EPS 1e-6
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define llinf 0x3f3f3f3f3f3f3f3f

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using namespace std; 

using ll = long long;
using ii = pair<int,int>;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  int n; cin >> n;
  vector<int> v(n), u(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    u[i] = v[i];
  }

  sort(rall(v));
  for (int i = 0; i < n; ++i)
    if (u[i] == v[0])
      cout << v[1] << ende;
    else
      cout << v[0] << ende;
  return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
//#define int long long int
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef vector<int>         vi;
const int mod = 1000000007;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int time[n];
    int sum=0;
    for(int i =0;i < n;i++){
        cin>>time[i];
        sum = sum +  time[i];
    }
    int cpy = sum;
    int dri;
    cin>>dri;
    
    for(int i =0;i < dri;i++){
        int x,y;
        cin>>x>>y;
        sum = sum - time[x-1];
        sum = sum +  y;
        cout<<sum<<endl;
        sum = cpy;


    }











}







Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
   long long a,b,n,x,y,m=0;
   cin>>a>>b>>n;
   if(n<b)
   {
       y=(a*n)/b;
       cout<<max(y,m)<<endl;
   }
   else if(n==b)
   {
       y=(a*(n-1))/b;
       cout<<max(y,m)<<endl;
   }
   else if(n>b)
   {
       y=(a*(b-1))/b;
       x=(a*n)/b-a*(n/b);
       y=max(y,m);
       y=max(y,x);
       cout<<y<<endl;
   }
    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void){
    int n;
    ll k;
    cin >> n >> k;
    vector<int> p(n), c(n);
    rep(i, n){
        cin >> p[i];
        --p[i];
    }
    rep(i, n) cin >> c[i];
    ll ans = -1e9 - 1;
    rep(i, n){
        int to = p[i];
        ll sum = 0;
        vector<ll> r;
        while(1){
            sum += c[to];
            r.push_back(c[to]);
            if(to == i || r.size() >= k) break;
            to = p[to];
        }
        ll ts = 0, rs = r.size();
        for(ll i = 0; i < rs; ++i){
            ts += r[i];
            ans = max(ans, ts);
            if(sum > 0)
                ans = max(ans, sum * ((k - i - 1) / rs) + ts);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3784
#include <cstdio>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
// #define int long long


using namespace std;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const long long INF = 1e18;
const int M = 1e9 + 7;
const int maxn = 1e5 + 5;
int a[maxn];




signed main()
{
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	int n;
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	map<int, int> mp;
	for(int i = 0; i < n; ++i){
		cin >> a[i];
		mp[a[i]]++;
	}
	sort(a, a + n);
	if(n % 3 == 0) {
		if((int)mp.size() == 1 && a[0] == 0) {
			cout << "Yes" << endl;
			return 0;
		}
		if((int)mp.size() == 3) {
			bool ok = 1;
			if((a[0] ^ a[n / 3]) != a[n - 1]) {
				ok = 0;
			}
			for(auto i : mp) {
				if(i.se != n / 3) {
					ok = 0;
				}
			}
			if(ok) {
				cout << "Yes" << endl;
			} else {
				cout << "No" << endl;
			}
			return 0;
		}
		if(mp[0] == n / 3 && (int)mp.size() == 2) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	} else {
		if((int)mp.size() == 1 && a[0] == 0) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}





    
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define INF INT_MAX
#define LINF LLONG_MAX
#define mod 1000000007
#define pie 3.141592653589793238462643383279
#define P pair<int,int>
#define prique priority_queue
#define F first
#define S second
using namespace std;
signed main(){
	string s;
	cin>>s;
	bool b=false;
	f(i,s.size()){
		if(s[i]=='C') b=true;
		if(b&&s[i]=='F'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	puts("No");
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{
	int i,j, n, a[4][13];
	char x[2];
	int y;

	for (i = 0; i < 4; i++)
		for (j = 0; j < 13; j++)
			a[i][j] = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++)
	{
		scanf("%s%d", x,&y);

		if (strcmp(x,"S")==0)
			a[0][y - 1] = 1;
		else if (strcmp(x,"H")==0)
			a[1][y - 1] = 1;
		else if (strcmp(x,"C")==0)
			a[2][y - 1] = 1;
		else
			a[3][y - 1] = 1;
	}

	for (i = 0; i < 4; i++)
		for (j = 0; j < 13; j++)
		{
			if (a[i][j])
				;
			else
			{
				if (i == 0)
					printf("S %d\n", j + 1);
				else if (i == 1)
					printf("H %d\n", j + 1);
				else if (i == 2)
					printf("C %d\n", j + 1);
				else
					printf("D %d\n", j + 1);
			}
		}
	
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fi > xed << setprecision(n)
//総和
#define sowa(n) (((n) * ((n) + 1)) / 2)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

struct UnionFind {
  vector<int> par;  // par[i]:iの親の番号
  vector<int> siz;  //葉の値を持つ

  UnionFind(int n)
      : par(n),
        siz(n, 1)  //初期化
  {
    for (int i = 0; i < n; i++) par[i] = i;
  }

  int root(int x)  //データxが属する木の根を再帰で得る
  {
    if (par[x] == x)
      return x;
    else
      return par[x] = root(par[x]);
  }

  int size(int x) { return siz[root(x)]; }

  bool same(int x, int y) { return root(x) == root(y); }

  bool unite(int x, int y)  // xとyの木を併合
  {
    if ((x = root(x)) == (y = root(y)))  // xとyの根が同じ時はそのまま
      return false;
    if (x > y) swap(x, y);
    par[x] = y;  // yの根にxをつける
    return true;
  }
};

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

  int n, m, k;
  cin >> n >> m >> k;

  UnionFind uf(n + m);

  rep(i, 0, k) {
    int a, b, c;
    cin >> a >> b >> c;
    --b, --c;
    if (a == 1) {
      if(uf.root(b) >= n && uf.root(c) >= n){
        if(uf.same(b,c) == false){
          cout<<i+1<<'\n';
          return 0;
        }
      }
      uf.unite(b, c);
    } else {
      if(uf.root(b) >= n && uf.same(b,c+n) == false){
        cout<<i+1<<'\n';
        return 0;
      }
      uf.unite(b, c + n);
    }
  }

  cout << 0 << '\n';
  return 0;
}


Measured memory_bytes: 6004
n,k,s=map(int,input().split())
if s!=10**9:
  l=[s for i in range(k)]+[s+1 for i in range(n-k)]
  print(*l)
else:
  l=[10**9 for i in range(k)]+[s-1 for i in range(n-k)]
  print(*l)

Measured memory_bytes: 9608
#include <iostream>
#include <cstdlib>
using namespace std;

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if(a + b > c + d)
        cout << "Left\n";
    else if(a + b == c + d)
        cout << "Balanced\n";
    else
        cout << "Right\n";

    return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;


int main(){
    int N;
    cin >> N;
    vector<int> p(N);
    rep(i, N){
        cin >> p[i];
    }
    int cnt = 0;
    for(int i = 1; i < N - 1; i++){
        if(p[i-1] < p[i] && p[i] < p[i+1]){
            cnt++;
        }
        if(p[i-1] > p[i] && p[i] > p[i+1]){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256