akhauriyash/Code-Regression huggingface dataset:
#[allow(unused)]
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let n: usize = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.parse().unwrap()
    };

    let mut a: Vec<Vec<usize>> = Vec::new();
    for _ in 0..n {
        let a_i = {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let s = s.trim_right().to_owned();
            s.split_whitespace().map(|x| x.parse().unwrap()).collect()
        };
        a.push(a_i)
    }

    let mut result = vec![vec![a[0][0], a[0][1], a[0][2]]];

    for i in 0..n - 1 {
        result.push(vec![0; 3]);
        for (curr, next) in (0..3)
            .flat_map(|a| (0..3).map(|b| (a, b)).collect::<Vec<_>>())
            .filter(|&(a, b)| a != b)
        {
            // debugln!("{:?}", (curr, next));
            result[i + 1][next] =
                std::cmp::max(result[i + 1][next], result[i][curr] + a[i + 1][next]);
        }
    }

    let max = result[n - 1].iter().max().unwrap();
    println!("{}", max);
}


Measured memory_bytes: 18684
#include <stdio.h>
int main(void){
    int a, b, c, i, cnt = 0;
    
    scanf("%d %d %d", &a, &b, &c);
    if(a > b){
        printf("0\n");
    }else if(a * c <= b){
        printf("%d\n", c);
    }else if(a * c > b){
        for(i = 0; i < c; i++){
            if(b >= a){
                b = b - a;
                cnt = cnt + 1;
            }else{
                printf("%d\n", cnt);
                break;
            }
        }
    }
}


Measured memory_bytes: 1656
#include <iostream>
using namespace std;
using LL = long long;

int main() {
  LL n, a, b, c;
  cin >> n;
  a = n/3, b = n/5, c = n/15;
  cout << ((n+1)*n)/2 - ((a+1)*a*3)/2 - ((b+1)*b*5)/2 + ((c+1)*c*15)/2 << '\n';
  return 0;
}

Measured memory_bytes: 3168
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

long long  a[3];
long long ans;

int main()
{
	cin >> a[0] >> a[1] >> a[2];
	if(a[0]%2==0 || a[1]%2==0 || a[2]%2==0){
		cout << 0 << endl;
	}
	else{
		sort(a,a+3);
		ans = a[0] * a[1];
		cout << ans << endl;
	}
}
		


Measured memory_bytes: 256
N = int(input())

def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
ali = digit(N)
a = 0
for i in ali:
    if int(i) == 7:
        a += 1
if a > 0:
    print("Yes")
else:
    print("No") 

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

using namespace std;

string s;

bool f(int l, int r){
	int mid = l+(r-l)/2;
	for(int i = l; i < mid; ++i){
		if(s[i]!=s[r-i-1]) return false;
	}
	return true;
}

int main(){
	cin >> s;
	int n = s.size();
	cout << (f(0, n)&&f(0, (n-1)/2)&&f((n+3)/2-1, n)?"Yes":"No") << endl;
}

Measured memory_bytes: 256
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

#define Pig (OO)

using namespace std;

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int Days[]={-1,31,28,31,30,31,30,31,31,30,31,30,31};

inline int read()
{
	#define gc getchar
	int ans=0;
	bool f=1;
	char ch=gc();
	
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	
	return f?ans:-ans;
	
	#undef gc
}

typedef long long ll;

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	int n,k,c;char s[200010];
	scanf("%d%d%d%s",&n,&k,&c,s+1);
	int l[200010],r[200010];c++;
	memset(l,0,sizeof(l));memset(r,0,sizeof(r));
	l[0]=1-c;for(int i=1;i<=k;i++){l[i]=l[i-1]+c;while(s[l[i]]=='x')l[i]++;}
	r[k+1]=n+c;for(int i=k;i>=1;i--){r[i]=r[i+1]-c;while(s[r[i]]=='x')r[i]--;}bool ans[200010],flag;memset(ans,0,sizeof(ans));
	int p=0ll;for(int i=1;i<=k;i++){if(l[i]==r[i])flag=ans[l[i]];p=max(p,l[i]-c);while(p+1<r[i]+c)ans[++p]=1;if(l[i]==r[i])ans[l[i]]=flag;}
	for(int i=1;i<=n;i++)if(!ans[i]&&s[i]=='o')printf("%d\n",i);
	//printf("Time used = %.12f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

/*  GOD BLESS  */


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


int main() {
   int a=0;
   char s[4];
   

   for(int i=0;i<4;i++){
      cin>>s[i];
      if(s[i]=='+'){
         a++;
      }
   else if(s[i]=='-'){
      a--;
   }
   }

   cout<<a <<endl;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  ll N; cin>>N;
  for(ll h=1;h<=3500;h++){
    for(ll n=1;n<=3500;n++){
      ll a = 4*h*n-n*N-N*h;
      if(a<=0)continue;
      ll b =N*h*n;
      if(b%a==0){
        printf("%lld %lld %lld\n", h,n,b/a);
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
    int N;
    scanf("%d", &N);
    int ans[N];
    for(int i=0;i<N;i++){
        ans[i] = 0;
    }
    for(int i=1;i<N;i++){
        int x;
        scanf("%d", &x);
        x--;
        ans[x]++;
    }
    for(int i=0;i<N;i++) printf("%d\n", ans[i]);
    return 0;
}

Measured memory_bytes: 2504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1e9;

ll dat[2<<18], add[2<<18];
int segn = 1;
void init(int n){
	while(segn < n)segn *= 2;
	//for(int i = 0;i < segn*2;i++)dat[i] = inf;
}

void lazy_update(int k, int l, int r){
	dat[k] += add[k]*(r-l);
	add[k*2+1] += add[k];
	add[k*2+2] += add[k];
	add[k] = 0;
}

void update(int a, int b, int x, int k, int l, int r){
	lazy_update(k, l, r);
	if(b <= l || r <= a)return ;
	if(a <= l && r <= b){
		add[k] += x;
		lazy_update(k, l, r);
		return ;
	}
	update(a, b, x, k*2+1, l, (l+r)/2);
	update(a, b, x, k*2+2, (l+r)/2, r);
	dat[k] = dat[k*2+1]+add[k*2+1]+dat[k*2+2]+add[k*2+2];
}

ll get(int a, int b, int k, int l, int r){
	lazy_update(k, l, r);
	if(b <= l || r <= a)return 0;
	if(a <= l && r <= b)return dat[k];
	ll vl = get(a, b, k*2+1, l, (l+r)/2);
	ll vr = get(a, b, k*2+2, (l+r)/2, r);
	return vl+vr;
}

int main(){
	int n, q, c, s, t, x;
	scanf("%d%d", &n, &q);
	init(n);
	for(int i = 0;i < q;i++){
		scanf("%d", &c);
		if(!c){
			scanf("%d%d%d", &s, &t, &x);
			update(s-1, t, x, 0, 0, segn);
		}else{
			scanf("%d%d", &s, &t);
			ll res = get(s-1, t, 0, 0, segn);
			printf("%lld\n", res);
		}
	}
	return 0;
}


Measured memory_bytes: 7864
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public long MOD = 1000000007;

        public void Run()
        {
            string S = Console.ReadLine();
            string S1 = S.Substring(0, 2);
            string S2 = S.Substring(2, 2);

            List<string> Months = new List<string>{ "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };

            bool M1 = Months.Contains(S1);
            bool M2 = Months.Contains(S2);

            if (M1 == true && M2 == true)
            {
                Console.WriteLine("AMBIGUOUS");

            }
            if (M1 == false && M2 == true)
            {
                Console.WriteLine("YYMM");
            }
            if (M1 == true && M2 == false)
            {
                Console.WriteLine("MMYY");

            }
            if (M1 == false && M2 == false)
            {
                Console.WriteLine("NA");
            }

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13024
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n], b[n], d[n-1];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    for(int i=0; i<n; i++)
    {
        cin>>b[i];
    }
    for(int i=0; i<n-1; i++)
    {
        cin>>d[i];
    }
    int c=b[a[0]-1];
    for(int i=1; i<n; i++)
    {
        c+=b[a[i]-1];
        if(a[i-1]+1==a[i])
        {
            c+=d[a[i-1]-1];
        }
    }
    cout<<c<<endl;
}


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

#define vt          vector
#define sz(x)       int((x).size())
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

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

void solve() {
    int n;
    cin >> n;
    vt<pii> a(n);
    for (pii &i : a) cin >> i.fi >> i.se;
    sort(all(a));

    int ans = 0;
    set<int> s1, s2;
    for (int i = 0; i < n; i++) {
        if (i) {
            ans = max({
                ans,
                a[i].fi - a[i].se + *s1.rbegin(),
                a[i].fi + a[i].se + *s2.rbegin()
            });
        }
        s1.insert(-a[i].fi + a[i].se);
        s2.insert(-a[i].fi - a[i].se);
    }

    cout << ans;
}

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

    int tcs = 1;
    for (int tc = 1; tc <= tcs; tc++) {
        // cout << "Case " << tc << ": ";
        solve();
    }
}


Measured memory_bytes: 23520
#include<iostream>
#include<vector>

using namespace std;

int main() {
  int N;
  string S;

  cin >> N;
  cin >> S;

  int rst = 0;
  for (int i = 1; i < N; i++) {

    vector<char> st;
    for (int j = 0; j < i; j++) {
      bool l = false;
      for (int k = 0; k < st.size(); k++) {
        if (st[k] == S[j]) l = true;
      }
      if (l) continue;
      else st.push_back(S[j]);
    }

    int cnt = 0;
    for (int j = i; j < N; j++) {
      for (int k = 0; k < st.size(); k++) {
        if (st[k] == S[j]) {
          cnt += 1;
          st.erase(st.begin() + k);
          break;
        }
      }
    }

    rst = max(cnt, rst);
  }

  cout << rst << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int N,M,sq[1001],sg;

int main(){
	while(scanf("%d%d",&N,&M), N != 0){
		for(int i = 0; i < N; i++){
			scanf("%d",&sq[i]);
		}
		int now = 0;
		bool f = true;
		for(int i = 1; i <= M; i++){
			scanf("%d",&sg);
			if(f){
				now += sg;
				if(f && now >= N - 1){
					printf("%d\n",i);
					f = false;
				}
				now += sq[now];
				if(f && now >= N - 1){
					printf("%d\n",i);
					f = false;
				}
			}
		}
	}
	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

int main() {
  char b; cin >> b;
  if(b == 'A') {
    cout << 'T' << endl;
  } else if(b == 'C') {
    cout << 'G' << endl;
  } else if(b == 'G') {
    cout << 'C' << endl;
  } else {
    cout << 'A' << endl;
  }

  return 0;
}


Measured memory_bytes: 256
s=input()
n=len(s)-1
ans=0
for bit in range(1<<n):
    f=s[0]
    for i in range(n):
        if ((bit>>i)&1):
            f+="+"
        f+=s[i+1]
    for i in f.split("+"):
        ans+=int(i)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <vector>
using namespace std;

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

  cin >> s;
  for(int i = 0; i < s.length()-1; i++){
    if(s[i] == 'A'){
      if(s[i+1] == 'C'){
        cout << "Yes\n";
        return 0;
      }
    }
  }

  cout << "No\n";

   return 0;
}

Measured memory_bytes: 256
function Main(input){
    input = input.split("\n");
    input.shift();
    var arr = {};
    for(var i=0;i<input.length;i++){
        if(!arr[input[i]]) arr[input[i]] = 1;
    }
    console.log(Object.keys(arr).length);
  }Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 83276
#include <iostream>
#include <bitset>
#include <string>
using namespace std;
int main(void){
    
    long long N;
    cin >> N;
    
    long long ans = N;
    int N_size = to_string(N).size();
    string str = to_string(N);
    
    for(int i = 1; i < 1 << (N_size-1); i++){
        
        bitset<10> bit(i);
        string str_Now;
        
        // プラスが入っている文字列を作成
        for(int j = 0; j < N_size; j++){
            str_Now += str[j];
            if(bit.test(j) ){
                str_Now += '+';
            }
        }
        
        //cout << str_Now << endl;
        
        int begin = 0;
        for(int j = 0; j < str_Now.size(); j++){
            if(str_Now[j] == '+'){
                ans += stoll(str_Now.substr(begin, j - begin));
                //cout << stoll(str_Now.substr(begin, j - begin)) << endl;
                begin = j+1;
            }
            
            if(j == str_Now.size()-1){
                ans += stoll(str_Now.substr(begin, str_Now.size() - begin));
                //cout << stoll(str_Now.substr(begin, str_Now.size() - begin)) << endl;
            }
        }
        
    }
    
    cout << ans << endl;
    
}


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

int main(int args, char *argv[])
{
  int a, b;
  cin >> a;
  cin >> b;

  int ret = 0;
  for (int i = a; i <= b; i++)
  {
    string str;
    bool ok = false;
    str = to_string(i);
    for (int j = 0; j < str.size() / 2; j++)
    {
      if (str[j] != str[str.size() - 1 - j])
      {
        ok = true;
      }
    }

    if (!ok)
    {
      ret++;
    }
  }

  cout << ret << endl;
  return 0;
}


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

int min(int a,int b){
    return a>b ? b :a;
}

int ab(int a){
    return a<0 ? -a : a;
}

int main(){
    int n,x,y,i,j,a[10000];
    cin >> n >> x >> y;
    for(i=1;i<=n;i++){
        for(j=i+1;j<=n;j++){
            a[min(min(j-i,ab(i-x)+ab(j-y)+1),ab(j-x)+ab(i-y)+1)]++;
        }
    }
    for(i=1;i<n;i++){
        cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())

arr = [a1, b1, a2, b2, a3, b3]
if arr.count(1) <= 2 and arr.count(2) <= 2 and arr.count(3) <= 2 and arr.count(4) <= 2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
#include<set>
#include<map>
#include<vector>
using namespace std;
int main(){

    int n,m;
    cin>>n>>m;
   vector<pair<int,int>> s[n];
    int si=1;
    int ansm[m+1];
    for(int i=0;i<m;i++){
        int p,m;
        cin>>p>>m;
        ansm[i+1]=p;
        s[p-1].push_back(make_pair(m,si));
        si++;
    }
    for(int i=0;i<n;i++){
        sort(s[i].begin(),s[i].end());
    }
    int ans[m+1];
    for(int i=0;i<n;i++){
        for(int j=0;j<s[i].size();j++){
            int h=s[i][j].second;
            ans[h]=j+1;
        }
    }
    /*for(int i=1;i<m+1;i++){
        cout<<ansm[i]<<ans[i]<<endl;
    }*/
    for(int i=1;i<m+1;i++){
        printf("%06d",ansm[i]);
        printf("%06d",ans[i]);
        cout<<endl;
    }
   
return 0;
}


Measured memory_bytes: 7808
ii = lambda : int(input())
li = lambda : list(map(int, input().split()))

n = ii()
a = li()
b = li()

cnt = 0
for i in range(n):
    if b[i] < a[i]+a[i+1]:
        cnt += b[i]
        if b[i] > a[i]:
            a[i+1] = max(0, a[i+1]-(b[i]-a[i]))
    else:
        cnt += a[i]+a[i+1]
        a[i+1] = 0

print(cnt)

Measured memory_bytes: 18624
n,k=map(int,input().split())
A=list(map(int,input().split()))
C=[n for _ in range(n)]

for loop in range(k):
    B=[0 for _ in range(n)]
    for i in range(n):
        l,r=max(0,i-A[i]),i+A[i]+1
        B[l] +=1
        if r<n:B[r] -=1
    for i in range(n-1):
        B[i+1]=B[i]+B[i+1]
    A=B
    if A==C:break
print(*A)

Measured memory_bytes: 170152
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#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...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

int dp[3005][3005];

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n;
	string s;
	cin >> n >> s;
	dp[1][1] = 1;
	for(int i = 2; i <= n; i++) {
		dp[1][i] = (dp[1][i] + dp[1][i - 1]) % mod;
	}
	for(int i = 0; i < n - 1; i++) {
		for(int j = 1; j <= i + 2; j++) {
			if(s[i] == '>') {
				dp[i + 2][j] = (dp[i + 2][j] + dp[i + 1][i + 1] - dp[i + 1][j - 1] + mod) % mod;
			}
			else {
				dp[i + 2][j] = (dp[i + 2][j] + dp[i + 1][j - 1]) % mod;
			}
		}
		for(int j = 2; j <= i + 2; j++) {
			dp[i + 2][j] = (dp[i + 2][j] + dp[i + 2][j - 1]) % mod;
		}
	}
	cout << dp[n][n];

	return 0;
}

Measured memory_bytes: 49764
#include <iostream>

using namespace std;

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

	if (a == 5 && b == 5 && c == 7) cout << "YES";
	else if (a == 5 && b == 7 && c == 5) cout << "YES";
	else if (a == 7 && b == 5 && c == 5) cout << "YES";

	else cout << "NO";

	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;


public class Main {
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    int N = sc.nextInt();
    int[] a = sc.nextIntList(N);
    Arrays.sort(a);
    System.out.println(a[a.length - 1] - a[0]);
  }

}


class FastScanner {
	public static String debug = null;

	private final InputStream in = System.in;
	private int ptr = 0;
	private int buflen = 0;
	private byte[] buffer = new byte[1024];
	private boolean eos = false;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				if (debug != null) {
					buflen = debug.length();
					buffer = debug.getBytes();
					debug = "";
					eos = true;
				} else {
					buflen = in.read(buffer);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen < 0) {
				eos = true;
				return false;
			} else if (buflen == 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean isEOS() {
		return this.eos;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		return (int) nextLong();
	}

	public long[] nextLongList(int n) {
		return nextLongTable(1, n)[0];
	}

	public int[] nextIntList(int n) {
		return nextIntTable(1, n)[0];
	}

	public long[][] nextLongTable(int n, int m) {
		long[][] ret = new long[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextLong();
			}
		}
		return ret;
	}

	public int[][] nextIntTable(int n, int m) {
		int[][] ret = new int[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextInt();
			}
		}
		return ret;
	}
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  int n; cin>>n;
  map <LL,LL> m;
  LL an = 0;
  for1(i,n){
  	LL x; cin>>x;
  	an += m[x - i];
  	m[-x-i]++;
  }	
  cout<<an<<endl;
  return 0;
}

Measured memory_bytes: 26364
#include <iostream>

using namespace std;

int main()
{
    int N;
    cin >> N;

    int i;
    for (i = 0; i < 3; i++) {
        if (N % 10 == 7) {
            cout << "Yes";
            return 0;
        }
        N /= 10;
    }
    cout << "No";
    
    return 0;
}

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

int main(){
  int n,count;
  string s;
  cin >> n>>s;
  count=n;
  r(i,n-1){
    if(s.at(i)==s.at(i+1))count--;
  }
  cout << count << endl;
}


Measured memory_bytes: 512
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	double a, b, h, m; cin >> a >> b >> h >> m;
	m += 60*h;
	double a1 = (m/720.0)*360.0, a2 = (m/60.0)*360.0;
	double diff = fmod(a2-a1, 360);
	double PI = 3.141592653589793238462643383279;
	double ans = sqrt((a*a+b*b)-2*a*b*cos(diff*PI/180.0));
	cout << setprecision(100) << ans << endl;
}


Measured memory_bytes: 4244
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  string s; cin>>s;
  int n=s.size();
  if(s[n-1]=='s'){
    s+='e';
    s+='s';
  }else{
    s+='s';
  }
  out(s);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 3588
import numpy as np
from numba import jit
@jit(cache = True)
def solve(n,k,A):
    l,r=0,0
    for i in range(k):
        B=np.zeros(n+1,dtype=np.int64)
        for x,y in enumerate(list(A)):
            l=max(0,x-y)
            r=min(n,x+y+1)
            B[l]+=1
            B[r]-=1
        A=np.cumsum(B[:-1])
        if A[A==n].size==n:
            break
    return A
n,k=map(int,input().split())
a=list(map(int,input().split()))
A=np.array(a)
X=solve(n,k,A)
print(*X,sep=' ')

Measured memory_bytes: 134936
#include <stdio.h>
int main(){
  int n=0;
  int x=0;
  int ans=0;
  int d=0;
  int a[100];
  scanf("%d %d",&n,&x);
  for(int i=0;i<n+1;i++){
    scanf("%d",&a[i]);
    if(d<=x){
      ans++;
    }
    else{
    }
    d=d+a[i];
  }
  printf("%d",ans);
  return 0;
}


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

using namespace std;

#define debug(x) cout << #x << "::" << x << endl;
#define debug2(x, y) cout << #x << "::" << x << " " << #y << "::" << y << endl;
#define debug3(x, y, z) cout << #x << "::" << x << " " << #y << "::" << y <<" "<< #z << "::" << z << endl;

#define For(i, a, b) for (int i = a; i < b; i++)

typedef long long ll;
const ll mod = 1e9 + 7;
const int MAX = 5 * 1e3 + 5;
typedef pair<int, int> pii;

void add(ll &a, ll b)
{
    a = (a + b) % mod;
    if (a < 0) a += mod;
}

int main() {

    int n;
    cin>>n;
    vector<int> a(n);
    For(i,0,n) cin>>a[i];
    vector<int> b(n);
    For(i,0,n) cin>>b[i];

    vector<ll> dp(n+1);
    ll sum = 0;
    int base = 1;
    while(base <= n) base*=2;
    //debug(base);
    vector<ll> tree(2*base);

    For(i,0,n){
        

        // dp[i] is the max value 1...dp[height-1] + b[i];

        int start = a[i] + base;
        ll best = 0;
        while(start > 1)
        {
            
            if(start%2)
            {
                best = max(best,tree[start-1]);
            }
            start/=2;
        
        }
        
        dp[a[i]] = best + b[i];
        
        for(int j=base + a[i];j>=1;j/=2)
        {
            tree[j] = max(tree[j],dp[a[i]]);
        }

        sum = max(sum,dp[a[i]]);


    }

    

    cout<<sum<<endl;

    return 0;

}

Measured memory_bytes: 7424
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Solve s = new Solve();
		s.solve();
	}

}

class Solve {


	public void solve() {
		Scanner sc = new Scanner(System.in);
		long X = sc.nextLong();
		long Y = sc.nextLong();

		int count = 0;

//		long add = X;
//		while (add <= Y) {
//			count++;
//			add = add*2;
//		}

		while ((X<<count) <= Y) {
			count++;
		}

		// 出力
		System.out.println(count);
		sc.close();
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char* argv[]) {

  /* if (argc != 4)  return 1; */

  int buf1, buf2, buf3;

  int a, b, c;

  /* a = atoi(argv[1]); */
  /* b = atoi(argv[2]); */
  /* c = atoi(argv[3]); */

  scanf("%d %d %d", &a, &b, &c);


  
  if (0 <= a <= 100 | 0 <= b <= 100 | 0 <= c <= 100)
    {}
  else return 1;
      
  buf1 = a + b;
  buf2 = b + c;
  buf3 = c + a;

  if (buf1 == c | buf2 == a | buf3 == b) {
    printf("Yes\n");
  }
    
  else printf ("No\n");

  return 0;
}


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

int main(){
    int n, i, a, count, min_n=100;
    cin >> n;

    for (i=0; i<n; i++) {
        cin >> a;
        count = 0;
        while (a%2 == 0) {
            a /= 2;
            count++;
        }
        min_n = min(count, min_n);
    }

    cout << min_n << endl;
    
    return 0;  
}


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

            using namespace std;
            typedef long long ll;




int main() {
    int n;
    scanf("%d", &n);
    vector<int> dp(3);
    // dp[i] - the total cost such that we did activity i on the last considered day
    for(int day = 0; day < n; ++day) {
        vector<int> new_dp(3, 0);
        vector<int> c(3);
        for(int i = 0; i < 3; ++i) {
            scanf("%d", &c[i]);
        }
        // int a, b, c - a lot of implementation
        for(int i = 0; i < 3; ++i) {
            for(int j = 0; j < 3; ++j) {
                if(i != j) {
                       // cout <<  new_dp[j] << dp[i]<< "+"<< c[j] <<endl;
                    new_dp[j] = max(new_dp[j], dp[i] + c[j]);
                  //  cout <<  new_dp[j] <<endl;
                }
            }
        }
        dp = new_dp;
    }
    printf("%d\n", max({dp[0], dp[1], dp[2]}));
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
using LL = long long;

int main(){
    LL N, x;
    cin >> N >> x;
    vector<LL> a(2*N);
    for(int i = 0;i < N;i++){
        cin >> a[i];
        a[i+N] = a[i];
    }
    LL ans = 1e18;
    vector<LL>  b(N, 1e10);
    for(int k = 0;k < N;k++){
        LL an = k*x;
        for(int i = 0;i < N;i++){
            b[i] = min(b[i], a[i+N-k]);
            an += b[i];
        }
        ans = min(ans, an);
    }
    cout << ans << endl;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define forabr(i, a, b) for(int i = int(b)-1; i >= int(a); i--)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (n % 2) cout << "No\n";
    else {
        string a = s.substr(0, n / 2);
        string b = s.substr(n / 2);
        if (a == b) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int N;
	cin >> N;
	int M;
	cin >> M;
	vi ans(N, -1);
	bool can = 1;
	rep(i, M) {
		int s, c;
		cin >> s >> c;
		if (ans[s - 1] == -1) {
			ans[s - 1] = c;
		}
		else if (ans[s - 1] != c) {
			can = 0;
		}
	}
	if (N != 1 && ans[0] == 0)
		can = 0;
	rep(i, N) {
		if (ans[i] == -1) {
			if (i == 0 && N != 1)
				ans[i] = 1;
			else
				ans[i] = 0;
		}
	}
	if (!can)
		cout << "-1" << endl;
	else {
		rep(i, N)
			cout << ans[i];
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
infos = [[int(i) for i in input().split()] for t in range(n)]

def calculate(infos,n):
    dp=[[0]*3 for i in range(n)]
    dp[0] = infos[0][:]
    for i in range(1,n):
        a,b,c = dp[i-1]
        dp[i] = [infos[i][0]+max(b,c),infos[i][1]+max(a,c),infos[i][2]+max(a,b)]
    return max(dp[-1])

print(calculate(infos,n))


Measured memory_bytes: 80472
#include<bits/stdc++.h>
    using namespace std;
     
    int main(){
      int N;
      cin>>N;
      vector<vector<int>> G(N);
      vector<pair<int,int>> vp;
      for(int i=1;i<N;i++){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
        vp.emplace_back(a,b);
      }
     
      int K=0;
      map<pair<int,int>,int> I;
      vector<int> cs(N,0); // color of edge between its parent
     
      vector<int> used(N,0);
      queue<int> que;
      used[0]=1;
      que.emplace(0);
      while(!que.empty()){
        int v=que.front();que.pop();
        if(K<(int)G[v].size()) K=G[v].size();
        int cur=1;
        for(int u:G[v]){
          if(used[u]) continue;
          if(cur==cs[v]) cur++;
          cs[u]=I[make_pair(u,v)]=I[make_pair(v,u)]=cur++;
          used[u]=1;
          que.emplace(u);
        }
      }
     
      cout<<K<<endl;
      for(auto p:vp) cout<<I[p]<<endl;
      return 0;
    }

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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, T; cin >> N >> T;
    int ans = 0;
    int A[N]; rep(i, N) cin >> A[i];
    for(int i = 0; i < N; i++){
        if(i == N-1) ans += T;
        else{
            if(A[i+1]-A[i] >= T) ans += T;
            else ans += A[i+1]-A[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
A = []
B = []
while True:
    try:
        x,y = map(int,input().split(','))
        A.append(x)
        B.append(y)
    except EOFError:
        break

N = len(A)
print(sum(A [i] * B [i] for i in range(N)))
print(sum(B) * 2 // N - sum(B) // N)

Measured memory_bytes: 7572
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.input()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    const MOD: usize = 1_000_000_007;
    let n: usize = sc.input();
    let k: usize = sc.input();

    let com = Combination::new(1_400_001, MOD);

    if k >= n {
        // 任意の配置が可能
        let ans: usize = com.hcom(n, n);
        println!("{}", ans);
    } else if k == 1 {
        println!("{}", (n * (n - 1)) % MOD);
    } else {
        // 0人になる部屋がm(0..=k)個あるとすると、m人が残りのn - m部屋に散らばる。
        let mut ans = 0usize;

        for i in 0..k + 1 {
            let room = n - i;
            ans += com.com(n, i) * com.hcom(room, i) % MOD;
        }
        println!("{}", ans % MOD);
    }
}

struct Combination {
    max_n: usize,
    modulo: usize,
    fac: Vec<usize>,
    finv: Vec<usize>,
    inv: Vec<usize>,
}

impl Combination {
    fn new(max_n: usize, modulo: usize) -> Combination {
        let mut fac = vec![0; max_n];
        let mut finv = vec![0; max_n];
        let mut inv = vec![0; max_n];
        fac[0] = 1;
        fac[1] = 1;
        finv[0] = 1;
        finv[1] = 1;
        inv[1] = 1;
        for i in 2..max_n {
            fac[i] = fac[i - 1] * i % modulo;
            inv[i] = modulo - inv[modulo % i] * (modulo / i) % modulo;
            finv[i] = finv[i - 1] * inv[i] % modulo;
        }
        Combination {
            max_n: max_n,
            modulo: modulo,
            fac: fac,
            finv: finv,
            inv: inv,
        }
    }

    fn com(&self, n: usize, k: usize) -> usize {
        if n < k || n < 0 || k < 0 {
            0
        } else {
            self.fac[n] * (self.finv[k] * self.finv[n - k] % self.modulo) % self.modulo
        }
    }

    fn hcom(&self, n: usize, k: usize) -> usize {
        if n == 0 && k == 0 {
            1
        } else {
            self.com(n + k - 1, k)
        }
    }
}


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


using namespace std;

int N;
string S;
unordered_map<string, int> Map;
int main()
{
	int ans = 0;	
	cin>>N;
	for(int i = 0; i < N; ++i)
	{
		cin>>S;
		if(Map.count(S) == 0)
			++ans;
		Map[S]++;
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 17616
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>  // std::greater<T>()

using namespace std;

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define DESCEND greater<int>()  // sort 降順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから

// func declaration
template <class T> void printVec(vector<T>);


int main() {
    int N, A, amari;
    cin >> N >> A;
    amari = N % 500;

    if (amari <= A) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

// function
template <class T> void printVec(vector<T> vec) {
    // 1要素ずつ、空白・改行なしで出力
    REP(i, vec.size()) {
        cout << vec.at(i);
    }
    cout << endl;
}


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

int main(){
    int k,i;
    char s[100];
    scanf("%d %s",&k,s);
    int size = strlen(s);

    if(size <= k){
        printf("%s\n",s);
    }else{
        for(i = 0;i < k;i++){
            printf("%c",s[i]);
        }
        printf("...\n");
    }
    return 0;
}

Measured memory_bytes: 1652
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;
typedef pair< string,lo > PSI;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(lo i=1;i<=n;i++)
#define FOR1 for(lo i=1;i<=m;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 100005; 
const lo mod = 1000000007; 

lo n,m,b,a[li],k,flag,pp[li];
lo cev;
PSI p[li];
string s;
vector<int> v;

void YES(int xxxx){
	if(xxxx==1)
		printf("YES\n");
	else cout<<"YES\n";
	exit(0);
}

void NO(int xxxx){
	if(xxxx==1)
		printf("NO\n");
	else cout<<"NO\n";
	exit(0);
}

bool psort(PSI x,PSI y){
	if(x.fi<y.fi) return true;
	if(x.fi>y.fi) return false;
	if(x.se<y.se) return false;
	if(x.se>=y.se) return true;
	return false;
}

int main(void){
	cin>>n;
	FOR{
		cin>>p[i].fi>>p[i].se;
		pp[p[i].se]=i;
	}
	sort(p+1,p+n+1,psort);
	FOR{
		cout<<pp[p[i].se]<<endl;
	}
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,l;
	cin>>n>>l;
	long long sum=0;
	for(int i=l;i<l+n;i++){
		sum+=i;
	}
	if(l<=0&&n+l-1>=0){
		cout<<sum<<endl;
	}else if(l<=0&&n+l-1<0){
		int v=n+l-1;
		sum=sum-v;
		cout<<sum<<endl;
	}else{
		cout<<sum-l<<endl;
	}
	return 0;
}

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

template<typename T>
void swapArgs(T& a, T& b) {
    T t = a;
    a = b;
    b = t;
}

typedef struct playCards {
    int iOrder;
    char mark;
    int value;
};

void bubbleSort(playCards* a, int n) {
    for (int i = 0; i < n; i++) {
        for (int j = n - 1; j > i; j--) {
            if (a[j].value < a[j - 1].value)swapArgs(a[j], a[j - 1]);
        }
    }
}

void selectionSort(playCards* a, int n) {
    for (int i = 0; i < n; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (a[j].value < a[minj].value)minj = j;
        }
        swapArgs(a[i], a[minj]);
    }
}

int main() {
    int n;
    cin >> n;

    playCards* c = new playCards[n];
    playCards* d = new playCards[n];
    for (int i = 0; i < n; i++) {
        string str;
        cin >> str;
        c[i].mark = d[i].mark = str[0];
        c[i].value = d[i].value = (int)str[1] - (int)'0';
        c[i].iOrder = d[i].iOrder = i;
    }

    bubbleSort(c, n);
    selectionSort(d, n);

    cout << c[0].mark << c[0].value;
    int flagBubble = 0;
    for (int i = 1; i < n; i++) {
        cout << " " << c[i].mark << c[i].value;
        if ((c[i].value == c[i - 1].value) && (c[i].iOrder < c[i - 1].iOrder))flagBubble = 1;
    }
    if (flagBubble == 1)cout << endl << "Not stable" << endl;
    if (flagBubble == 0)cout << endl << "Stable" << endl;

    cout << d[0].mark << d[0].value;
    int flagSelection = 0;
    for (int i = 1; i < n; i++) {
        cout << " " << d[i].mark << d[i].value;
        if ((d[i].value == d[i - 1].value) && (d[i].iOrder < d[i - 1].iOrder))flagSelection = 1;
    }
    if (flagSelection == 1)cout << endl << "Not stable" << endl;
    if (flagSelection == 0)cout << endl << "Stable" << endl;

    delete[] c, d;
    return 0;
}


Measured memory_bytes: 3128
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int main() {
	int n;
	cin >> n;
	long long nowt = 1, nowa = 1;
	FOR(i, 0, n) {
		long long t, a;
		cin >> t >> a;
		if (i == 0) {
			nowt = t, nowa = a;
		}
		long long tmul = (nowt - 1) / t + 1, amul = (nowa - 1) / a + 1;
		long long mul = max(tmul, amul);
		nowt = t*mul, nowa = a*mul;

	}
	cout << nowt + nowa << endl;
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<long long, long long> pl;
 
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define form(i, n) for (size_t i = 0; i < size_t(n); ++i)
#define forn(i, n) for (size_t i = 1; i <= size_t(n); ++i)
template<class T> using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll mod(ll a, ll b) { return (a%b+b)%b; }
ll gcd(ll x, ll y) { return __gcd(x, y); }
ll lcm(ll x, ll y) { return x * 1ll * y / gcd(x, y); }
 
 
const ll MAXN = 1e18;
const ll SIZE = 1e5 + 5;
const ll MOD  = 1e9 + 7;

ll a, b;
double c;


int main() { speedhack()

	cin >> a >> c;
	b = (c * 100) + 0.1;

	a = a * b;
	a = a / 100;

	cout << a << endl;


	return 0;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7;
int n,c,k,a[100010];

int main(){
	cin >> n >> c >> k;
	REP(i,0,n) cin >> a[i];
	
	sort(a,a+n);
	int ans=1,cou=1,tmp=a[0];
	REP(i,1,n){
		cou++;
		if(cou>c||a[i]-tmp>k){
			 ans++;
			 cou=1;
			 tmp=a[i];
		 }
	 }
		
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <bitset>
#include <numeric>
#include <math.h>
#include <tuple>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

const ll MAX_N = 10010;
ll dp[MAX_N];

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

    ll N, M;
    cin >> N >> M;
    vector<ll> A(M);
    for(int i = 0; i < M; i++){
        cin >> A[i];
    }

    sort(A.begin(), A.end(), greater<ll>());

    vector<ll> num_m = {2, 5, 5, 4, 5, 6, 3, 7, 6};

    for(ll i = 0; i < MAX_N; i++){
        dp[i] = -INF;
    }
    
    dp[0] = 0;

    for(ll i = 1; i < MAX_N; i++){
        for(ll j = 0; j < M; j++){
            if(i-num_m[A[j]-1] >= 0)
            chmax(dp[i], dp[i-num_m[A[j]-1]] + 1);
        }
    }

    ll i = N;
    while(i > 0){
        for(ll j = 0; j < M; j++){
            if(dp[i] == dp[i-num_m[A[j]-1]] + 1 && i-num_m[A[j]-1] >= 0){
                cout << A[j];
                i = i - num_m[A[j]-1];
                break;
            }
        }
    }
    
    cout << endl;

    return 0;
}


Measured memory_bytes: 384