akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string.h>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;

double x[5];
double y[5];

int main()
{
	while (cin >> x[0] >> y[0]) {
		for (int i = 1; i < 4; i++) {
			cin >> x[i] >> y[i];
		}

		double abc = fabs((x[1] - x[0])*(y[2] - y[0]) - (x[2] - x[0])*(y[1] - y[0]));
		double pab = fabs((x[0] - x[3])*(y[1] - y[3]) - (x[1] - x[3])*(y[0] - y[3]));
		double pbc = fabs((x[1] - x[3])*(y[2] - y[3]) - (x[2] - x[3])*(y[1] - y[3]));
		double pca = fabs((x[2] - x[3])*(y[0] - y[3]) - (x[0] - x[3])*(y[2] - y[3]));

		if (fabs(abc - pab - pbc - pca) < EPS)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3216
N,A,B=map(int,input().split())
S=list(input())
a,b=0,0
for i in S:
    if i == "a" and a < A+B:
        a += 1
        print("Yes")
    elif i == "b" and a < A+B and b < B:
        a += 1
        b += 1
        print("Yes")
    else:
        print("No")

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define INF 1000000007
// cin.eof() 入力個数の問題
int main(){
ll a;
cin>>a;
string s;
cin>>s;
rep(i,s.size()){
  if(s[i]=='.'){
    s.erase(i,1);
  }
}
int num=atoi(s.c_str());
cout<<num*a/100<<endl; 
  return 0;
}


Measured memory_bytes: 3624
N = int(input())
B = list(map(int, input().split()))
b_max = max(B)
A = [b_max for _ in range(N)]

def solve():
    for i, b in enumerate(B):
        A[i] = min(A[i], b)
        A[i+1] = min(A[i+1], b)
    print(sum(A))

if __name__ == "__main__":
    solve()

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li h[100100];
li n, k;

int main() {
    cin >> n >> k;
    rin{
        cin >> h[i];
    }
    sort(h, h + n);
    li res = INF;
    rep(i, n - k + 1) {
        res = min(res, h[i + k - 1] - h[i]);
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>

using namespace std;

int main(){

	int n,l;
	vector<string> vec;
	
	cin >> n >> l;
	for(int i=0;i<n;i++){
		string s;
		cin >> s;
		vec.push_back(s);
	}
	
	sort(vec.begin(),vec.end());
	
	for(int i=0;i<n;i++){
		cout << vec[i];
	}
	cout << endl;
	
	return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<28);
const ll INFL = (1L<<61);

int main() {
  int r; cin >> r;
  cout << r*r << endl;
  return 0;
}


Measured memory_bytes: 764
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int N;
map<P,int> points;
P ary[4][4] = {
    {P(0,0),P(0,-1),P(-1,0),P(-1,-1)},
    {P(0,0),P(0,-1),P(1,0),P(1,-1)},
    {P(0,0),P(0,1),P(1,0),P(1,1)},
    {P(0,0),P(0,1),P(-1,0),P(-1,1)}
};
P operator+(P a,P b) {
    return P(a.fr+b.fr,a.sc+b.sc);
}
int main() {
    vector<P> vec;
    cin>>N;
    rep(i,N) {
        int x,y,w;
        cin>>x>>y>>w;
        vec.pb(P(x,y));
        points[P(x,y)]=w;
    }
    int ans=0;
    for(auto point : vec) {
        P p=point;
        rep(i,4) {
            int t=0;
            rep(j,4) {
                t+=points[p+ary[i][j]];
            }
            ans=max(ans,t);
        }
    }

    cout<<ans<<" / 1"<<endl;
    return 0;
}

Measured memory_bytes: 58012
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <limits.h>

using namespace std;

int main(int argc, char const* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+\n";
    }
    else if (a * b == 15) {
        cout << "*\n";
    }
    else {
        cout << "x\n";
    }
    return 0;
}


Measured memory_bytes: 888
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
	char a[101];
	char b[101];
	int n;
	int s;
	int c;
	scanf("%d", &n);
	scanf("%s", a);
	scanf("%s", b);
	
	for (int i = 0; i < n; i++){
		s = 0;
		for (int j = n - 1 - i; j < n; j++){
			if (a[j] == b[i + j + 1 - n]) s++;
		}
		if (s == i + 1) c = i + 1;
	}
	printf("%d\n",2*n-c);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
#define N 310
ll n,k;
bool solve(ll x){
    ll sum=0;
    for(int i=0;i<n;i++){
	sum+=x;
	x/=2;
	if(x==0)break;
    }
    return sum<=k;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>n>>k;
    ll l=0,r=1e18,mid;
    while(l<r-1){
	mid=(l+r)>>1;
	if(solve(mid))l=mid;
	else r=mid;
    }
    cout<<l<<endl;
}





Measured memory_bytes: 3180
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

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

	char c[100][100] = {};
	ll s = 100;
	rep(i, 0, s / 2) {
		rep(j, 0, s) c[i][j] = '.';
	}
	rep(i, s / 2, s) {
		rep(j, 0, s) c[i][j] = '#';
	}
	a--; b--;

	while (b) {
		rep(i, 0, s / 2) {
			rep(j, 0, s) {
				if (i & 1 && !(j & 1)) {
					c[i][j] = '#';
					b--;
				}
				if (b == 0)break;
			}
			if (b == 0)break;
		}
	}

	while (a) {
		rep(i, s / 2, s) {
			rep(j, 0, s) {
				if (i & 1 && !(j & 1)) {
					c[i][j] = '.';
					a--;
				}
				if (a == 0)break;
			}
			if (a == 0)break;
		}
	}

	cout << 100 << " " << 100 << endl;
	rep(i, 0, s)
	{
		rep(j, 0, s) {
			cout << c[i][j];
		}
		cout << endl;
	}
	return 0;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int x, n; cin >> x >> n;
    V<int> p(n);
    for(int i = 0; i < n; i++) cin >> p[i];

    int i = 0, ans = IINF;
    while(1){
        int a = x + i;
        bool f1 = true;
        for(int j = 0; j < n; j++){
            if(a == p[j]){
                f1 = false;
                break;
            }
        }
        if(f1) ans = a;
        int b = x - i;
        bool f2 = true;
        for(int j = 0; j < n; j++){
            if(b == p[j]){
                f2 = false;
                break;
            }
        }
        if(f2){
            ans = min(ans, b);
        }
        if(ans != IINF) break;
        i++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	long long x,y,a,b,c;
	cin >> x >> y >> a >> b >> c;
	vector<long long> p(a);
	vector<long long> q(b);
	vector<long long> r(c);
	for(long long i=0;i<a;i++)
		cin >> p[i];
	for(long long i=0;i<b;i++)
		cin >> q[i];
	for(long long i=0;i<c;i++)
		cin >> r[i];

	sort(p.begin(),p.end(),std::greater<long long>());
	sort(q.begin(),q.end(),std::greater<long long>());
	sort(r.begin(),r.end(),std::greater<long long>());
	vector<long long> s;
	for(long long i=0;i<x;i++)
		s.push_back(p[i]);
	for(long long j=0;j<y;j++)
		s.push_back(q[j]);
	sort(s.begin(),s.end());

	long long id=0;
	for(long long i=0;i<x+y;i++)
		if(s[i]<r[id])
		{
			s[i]=r[id];
			id++;
			if(id>=c)
				break;
		}

	long long ans=0;
	for(long long i=0;i<x+y;i++)
		ans+=s[i];
	cout << ans << endl;




}


Measured memory_bytes: 4724
#include "bits/stdc++.h"

typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)

using namespace std;

int MOD = 1000000007;

signed main(){
    
    int n,T;
    cin >> n >> T;
    int ans = 100000;
    REP(i,n){
        int c,t;
        cin >> c >> t;
       
        if(t <= T){
            ans = min(ans,c);
        }
    }
    if(ans == 100000){
        cout << "TLE";
    }else{
        cout << ans;
    }
    
    
    
    
    return 0;
}
//g++ -std=c++14 code1.cpp


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s3[3]={"a..","a..",".bb"};
string s4[4]={"aabd","ccbd","efcc","efgg"};
string s5[5]={"aab.c","d.b.c","dffgg","ejii.","ej.hh"};
string s6[6]={"a..bbc","ad...c","edff..","e.h.gg","iihk..",".jjkll"};
string s7[7]={"aa.bb.c","d.ee..c","d.f.gg.",".hf..i.",".h...ik","jll...k","j..mmnn"};
char ans[1005][1005];
int main(){
    int n,r;
    cin>>n;
    if(n<3){
        cout<<-1<<endl;
        return 0;
    }
    if(n==3){
        for(int i=0;i<3;i++){
            cout<<s3[i]<<endl;
        }
        return 0;
    }
    r=n%4+4;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ans[i][j]='.';
        }
    }
    if(r==4){
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                ans[i][j]=s4[i][j];
            }
        }
    }
    if(r==5){
        for(int i=0;i<5;i++){
            for(int j=0;j<5;j++){
                ans[i][j]=s5[i][j];
            }
        }
    }
    if(r==6){
        for(int i=0;i<6;i++){
            for(int j=0;j<6;j++){
                ans[i][j]=s6[i][j];
            }
        }
    }
    if(r==7){
        for(int i=0;i<7;i++){
            for(int j=0;j<7;j++){
                ans[i][j]=s7[i][j];
            }
        }
    }
    while(r<n){
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                ans[i+r][j+r]=s4[i][j];
            }
        }
        r+=4;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout<<ans[i][j];
        }
        cout<<endl;
    }
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long
#define vi vector <int>
#define pii pair <int, int>
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i,n) for (int i = 0; i < (int) (n); ++ i)
#define foreach(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); ++ it)

inline int read() {
	int x = 0, f = 1, c = getchar();
	for (;!isdigit(c);c = getchar()) if (c == '-') f ^= 1;
	for (; isdigit(c);c = getchar()) x = x * 10 + c - '0';
	return f ? x : -x;
}

int n;
ll d[100005];
int dis[100005];
map <ll, int> MP;
int que[100005], lb, rb;
int siz[100005];
vi g[100005];
vector <pii> ans;

int main() {
	n = read();
	rep(i, n) scanf("%lld", &d[i]);
	rep(i, n) MP[d[i]] = i, siz[i] = 1;
	int rt = MP.begin() -> second;
	for (map <ll, int> :: reverse_iterator rit = MP.rbegin(); rit != MP.rend(); ++ rit) {
		int u = rit -> second; if (u == rt) break;
		ll nw = d[u] - n + 2 * siz[u];
		if (!MP.count(nw)) {puts("-1"); return 0;}
		int fa = MP[nw];
		ans.pb(mp(fa, u));
		g[fa].pb(u);
		siz[fa] += siz[u];
	}
	que[rb ++] = rt;
	memset(dis, -1, sizeof dis); dis[rt] = 0;
	while (lb < rb) {
		int u = que[lb ++];
		rep(i, g[u].size()) {
			int v = g[u][i];
			if (!~dis[v]) {
				dis[v] = dis[u] + 1;
				que[rb ++] = v;
			}
		}
	}
	ll sum = 0;
	rep(i, n) sum += dis[i];
	if (sum != d[rt]) {puts("-1"); return 0;}
	rep(i, n - 1) printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
	return 0;
}

Measured memory_bytes: 15860
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,k; cin >> n >> k; ll ans = 0;
  
  rep(i,n){
    ll x; cin >> x;
    ans += min(x,k-x);
  }
  
  cout << 2*ans << endl;
  
  
}

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

int main() 
{
	string s;
	cin >> s;
	int n = s.length(), nonre = 0, re = 1, temp;
	for (int i = 1; i < n; i++)
	{
		if (s[i] == s[i - 1])
		{temp = nonre; nonre = re; re = temp + 1;}
		else
		re++;
	}
	cout << min(nonre, re);
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

bool isKaibun(string s);

int main()
{
    int num;
    int target;
    int temp = 0;

    cin >> num >> target;

    if(target == 1)
    {
        cout << 0 << endl;
        return 0;
    }

    //1個で足りるか確認
    if(num >= target)
    {
        cout << 1 << endl;
        return 0;
    }

    int ans = 2;

    while(1)
    {
        int temp = num + (ans-1)*(num-1);

        if(temp >= target)
        {
            cout << ans << endl;
            return 0;
        }

        ans++;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pob pop_back
#define MP make_pair
#define VI vector<int>
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.F<<","<<_p.S<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}

template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5;
const ll MOD=1000000007;
const ll INF=(ll)1e18;

int main(){
	IOS();
	ll n,a;
	cin>>n>>a;
	n%=500;
	if(a>=n) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define foreach(i,n) for (int i = 0; i < n; ++i)
#define foreach1(i,n) for (int i = 1; i < n; ++i)
#define foreach_from(i,m,n) for (int i = m; i < n; ++i)

#define MAX_TOWN 10
#define MAX_N 45

int N; // the number of the pathes
int A[MAX_N];
int B[MAX_N];
int C[MAX_N];

int dt[MAX_N+1][MAX_N][MAX_N];

int main () {
    while (true) {
        cin >> N;
        if (N == 0) return 0;
        foreach (i,N) cin >> A[i] >> B[i] >> C[i];

        foreach (i,MAX_TOWN) foreach (j,MAX_TOWN) { dt[0][i][j] = i == j ? 0 : 0xffff; }
        foreach (i,N) { dt[0][A[i]][B[i]] = dt[0][B[i]][A[i]] = min(C[i], dt[0][A[i]][B[i]]); }
        foreach (i,MAX_TOWN) {
            foreach (j,MAX_TOWN) {
                foreach (k,MAX_TOWN) {
                    dt[i+1][j][k] = min(dt[i][j][k], dt[i][j][i] + dt[i][i][k]);
                }
            }
        }
        int town = -1, cost = 0xffff;
        foreach (n,MAX_TOWN) {
            int sum = 0;
            foreach (i,MAX_TOWN) { if (dt[MAX_TOWN][n][i] != 0xffff) sum += dt[MAX_TOWN][n][i]; }
            if (sum != 0 && sum < cost) { town = n; cost = sum; }
        }

        cout << town << " " << cost << endl;
    }
}

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

int ctoi(const char c){
    if('0' <= c && c <= '9')
        return (c-'0');
    return -1;
}

int main(){
    string S;
    cin >> S;
    
    int year = 0;
    for(int i=0;i<4;i++){
        year = year*10;
        year += ctoi(S[i]);
    }
    if(year > 2019){
        cout << "TBD" << endl;
        return 0;
    }
    if(year < 2019){
        cout << "Heisei" << endl;
        return 0;
    }
    int m = 0;
    m += ctoi(S[5])*10;
    m += ctoi(S[6]);
    if(m > 4){
        cout << "TBD" << endl;
        return 0;
    }else{
        cout << "Heisei" << endl;
        return 0;

    }
}

Measured memory_bytes: 256
n=int(input())
print(n*800 -((n//15)*200))

'''
p,m=map(int,input().split())
s=bin(p)
s=s[2:]
n=len(s)


ans=pow(2,n) -1
if(m>=2):
    print(ans)
else:
    print(p)


m,n=map(int,input().split())
a=[False]*(n+1)
a[0]=True
for i in range(m):
    temp=list(map(int,input().split()))
    for kk in temp[1:]:
        a[kk]=True
ans=True
for nn in a:
    ans = nn and ans
if(ans):
    print("YES")
else:
    print("NO")



y,b,r = map(int,input().split())

if(r>b):
    if(b>y):
        print(int((3*y)+3))
    else:
        print(int(3*b))
else:
    if(b<y):
        print(int((3*y)-3))
    else:
        print()


  '''  




        

Measured memory_bytes: 2940
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<random>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vt>vvt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"


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

	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	cout<<15-a-b-c-d-e<<endl;

}


Measured memory_bytes: 3620
while True:
	try:
		x=[[int(i) for i in input()] for j in range(8)]
		count=0
		num=[]
		for i in range(8):
			if x[i].count(1)!=0:
				num.append(i)
				count+=1
		if count==1:
			print("C")
		elif count==4:
			print("B")
		elif count==2:
			for j in range(8):
				if x[num[0]][j]==1:
					if j==0:
						if x[num[0]+1][j]==1:
							print("A")
						else:
							print("E")
					else:
						if x[num[0]+1][j-1]==1:
							print("G")
						else:
							if x[num[0]+1][j]==1:
								print("A")
							else:
								print("E")
					break
		else:
			for j in range(8):
				if x[num[0]][j]==1:
					if j==0:
						print("F")
					else:
						if x[num[0]+1][j-1]==1:
							print("D")
						else:
							print("F")
					break
		input()
	except EOFError:
		break


Measured memory_bytes: 5620
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<string>
using namespace std;


int main(){
    int a,b;
    cin >> a >> b;
    if((a+b)%2 == 0){
        cout << (a+b)/2 << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
}


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

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;
}

// LCM of n numbers
ll lcm_n(vector<ll> v)
{
  assert(v.size() > 0);
  ll res = v[0];
  REP(i,1, v.size()) {
    res = lcm(res,v[i]);
  }
  return res;
}

int main()
{
  int N;
  cin >> N;
  vector<ll> T(N);
  REP(i,0,N) { cin >> T[i]; }
  cout << lcm_n(T) << endl;

  return 0;
}


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

int main() {
	string S,T;
    cin >> S >> T;
    string A=S;
    for(int i=0;i<S.size();i++){
        A.at(i) = T.at(i);
    }
    if(A==S){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

class UnionFind {
public:

  vector<int> Parent;

  UnionFind(int N) {
    Parent = vector<int>(N, -1);
  }

  int root(int A) {
    if (Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]);
  }

  int size(int A) {
    return -Parent[root(A)];
  }

  bool connect(int A, int B) {
    A = root(A);
    B = root(B);
    if (A == B) return false;

    if (size(A) < size(B)) swap(A, B);

    Parent[A] += Parent[B];
    Parent[B] = A;

    return true;
  }

};

int main() {
  int N, K, L; cin >> N >> K >>L;

  UnionFind road(N);
  UnionFind rail(N);

  rep(i, K) {
    int p, q; cin >> p >> q;
    road.connect(p-1, q-1);
  }

  rep(i, L) {
    int p, q; cin >> p >> q;
    rail.connect(p-1, q-1);
  }

  map<pair<int, int>, int> cnt;
  rep(i, N) {
    pair<int, int> p = make_pair(road.root(i), rail.root(i));

    auto itr = cnt.find(p);
    if (itr != cnt.end()) {
      cnt[p]++;
    } else {
      cnt[p] = 1;
    }
  }

  rep(i, N) {
    pair<int, int> p = make_pair(road.root(i), rail.root(i));
    cout << cnt[p] << " ";
  }


  return 0;
}

Measured memory_bytes: 13568
#include<iostream>
#include<cmath>

using namespace std;

const long double PI = 3.1415926535897932384626433832795;

int main() {
	cout.precision(100);
	long double a, b, x;
	cin >> a >> b >> x;
	long double S = x / a;
	if(2*S < a*b) { //right triangle
		//S = 0.5*aa*b
		//aa = 2*S / b
		long double aa = 2*S / b; //new side of a
		cout << 90.0 - (atan(aa / b) * 180.0 / PI) << endl;
		return 0;
	} else { //trapezoid
		//S = 0.5(upper_base + b) * a
		//upper_base = 2*S / a - b;
		long double upper_base = (2*S / a) - b;
		long double new_lower_base = b - upper_base; //trapezoid -> right triangle
		cout << 90.0 - (atan(a / new_lower_base) * 180.0 / PI) << endl; 
	}
	return 0;
}

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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int res = 0;
  for (int a = 0; a <= A; ++a) {
    for (int b = 0; b <= B; ++b) {
      for (int c = 0; c <= C; ++c) {
        int total = 500*a + 100*b + 50*c; // 合計金額
        if (total == X) ++res; // 合計金額が X に一致したら答えをインクリメント
      }
    }
  }
  cout << res << endl;
}

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, start, end) for(int i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define INFL (1e18)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    ll n, m;
    cin >> n >> m;

    vector<pair<ll, ll>> nums(n);
    rep(i, n){
        cin >> nums[i].first >> nums[i].second;
    }

    sort(all(nums));
    ll ans = 0;
    rep(i, n){
        if(nums[i].second >= m){
            ans += nums[i].first * m;
            break;
        }else{
            ans += nums[i].first * nums[i].second;
            m -= nums[i].second;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
const int MAX = 1e6;
long long int fac[MAX],finv[MAX],inv[MAX];

void combinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; ++i){
        fac[i] = fac[i-1]*i % MOD;
        inv[i] = MOD-inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1]*inv[i] % MOD;
    }
}

long long int com(int n, int k){
    if(n < k) return 0;
    if(n < 0 or k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
int main()
{
    combinit();
    int n,k;
    cin >> n >> k;
    long long int a[n];
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
    }
    sort(a,a + n);
    long long int Max = 0,Min = 0;
    for(int i = 0;i < n - k + 1;i++)
    {
        Min += com(n - 1 - i,k - 1) * a[i];
        Min = Min % MOD;
        Max += com(n - 1 - i,k - 1) * a[n - 1 - i];
        Max = Max % MOD;
    }

    long long int ans =  (Max - Min) % MOD;
    if(ans < 0)
    {
        ans += MOD;
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 24448
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"	
	typedef long long LL;
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define mod2 998244353
	#define INFINITE 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define sz(v) ((ll)(v).size())
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define pb push_back
	#define f first
	#define s second
	#define dbg(a) cout<<#a<<" --> "<<(a)<<"\n";
	#define forn(i,n) for (ll i=0; i<(n); ++i)
	#define fornd(i,n) for (ll i=(n)-1; i>=0; --i)	
	#define forab(i,a,b) for (ll i=(a); i<=(b); ++i)
	#define read(a) ll a; cin >> a;
	#define reads(s) string s; cin >> s;
	#define readb(a, b) ll a, b; cin >> a >> b;
	#define readc(a, b, c) ll a, b, c; cin >> a >> b >> c;
	#define readarr(a, n) int a[(n) + 1] = {}; forab(i, 0, (n-1)) {cin >> a[i];}
	#define readmat(a, n, m) int a[n + 1][m + 1] = {}; forab(i, 1, n) {forab(j, 1, m) cin >> a[i][j];}
	#define readv(A,n) vll A(n,0); forn(i,n) cin>>A[i]; 
	#define print(a) cout << a << endl;
	#define printarr(a, n) forab (i, 1, n) cout << a[i] << " "; cout << endl;
	#define printv(v) for (int i: v) cout << i << " "; cout << endl;
	#define printmat(a, n, m) forab(i, 1, n) {forab (j, 1, m) cout << a[i][j] << " "; cout << endl;}
	 
	#define INF (1e18+5)
	#define inf (1e9+5)
	int dx[4] = { 0, 0, 1, -1 };
	int dy[4] = { 1, -1, 0, 0 };
	// 8-directions
	//int dx[]={1,1,1,0,0,-1,-1,-1};
	//int dy[]={-1,0,1,-1,1,-1,0,1};
	#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
	using namespace std;
	int begtime = clock();
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	mt19937_64 rngb(chrono::steady_clock::now().time_since_epoch().count()); // can give negative values too
	bool isPowerOfTwo(int x) {
    return x && (!(x & (x - 1)));
	}
	int takemod(int x) {
    return (x % mod + mod) % mod;
	}
 
	int fpow(int base, int power, int MOD) {
    int result = 1;
    base = base % MOD;
    while (power) {
        if (power & 1)
            result = (result * base) % MOD;
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result;
	}
 
	int modinv(int x) {return fpow(x, mod - 2, mod);}
	void solve()
	{
		string A,B;
		cin>>A>>B;
		ll n=A.length();
		ll m=B.length();
		ll ans=mod;
		forn(i,min(n,n-m+1))
		{
			ll er=0,k=0;
			forab(j,i,i+m-1)
			{
				if(A[j]!=B[k++])er++;
			}
			//dbg(er)
			ans=min(er,ans);
		}
		cout<<ans<<endl;
	}
	int main()
	{	
		#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		#endif
		fast_io;
		int T=1;
		//cin>>T;
		// cin.ignore(); must be there when using getline(cin, s)
		while(T--)
		{
			solve();
		}
		#ifndef ONLINE_JUDGE
    		cerr << "Time elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
    		#endif
		return 0;
	}

	
	

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

int main()
{
    int n,m,ans = 64;
    cin >> n;

    if(n < 2) ans = 1;
    else if(n < 4) ans = 2;
    else if(n < 8) ans = 4;
    else if(n < 16) ans = 8;
    else if(n < 32) ans = 16;
    else if(n < 64) ans = 32;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}

vec slide(vec v, int n){
    int N = v.size();
    vec w(N);
    REP(i, n) w[N - 1 - i] = v[i];
    REP(i, N - n) w[i] = v[n + i];
    return w;
}

signed main(){

    int N, A, B; cin >> N >> A >> B;

    if(A + B > N + 1 || A * B < N){
        cout << -1 << endl;
        return 0;
    }

    int n = (N - 1) / B + 1;
    mat ans(n);
    int v = 1;
    REP(i, n){
        int m = min(N, B);
        ans[i] = vec(m);
        IREP(j, m){
            ans[i][j] = v;
            v++;
        }
        N -= m;
    }

    int a = n;
    IREP(i, n){
        int k = min((int)ans[i].size() - 1, A - a);
        //cout << i << " " << k << endl;
        ans[i] = slide(ans[i], k);
        a += k; 
    }

    REP(i, n) REP(j, ans[i].size()) cout << ans[i][j] << " ";

    
    return 0;
}

Measured memory_bytes: 16512
#include <bits/stdc++.h>
using namespace std;
int main(){


int x,y,a,b;
 cin >> x >> y >> a >> b;
 string ans = string(b-y,'U')+string(a-x,'R')+string(b-y,'D')+string(a-x,'L');
 ans += string(1,'L')+string(b-y+1,'U')+string(a-x+1,'R')+string(1,'D');
 ans += string(1,'R')+string(b-y+1,'D')+string(a-x+1,'L')+string(1,'U');
 cout << ans;

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string str;
  cin >> str;
  int q,i;
  cin >> q;
  string s1,s2;
  int a,b;
  for(i=0;i<q;i++){
    //cout << str << endl;
    cin >> s1 >> a >> b;
    if(s1=="print"){
      cout << str.substr(a,b-a+1) << endl;
    }else if(s1=="reverse"){
      string s3=str.substr(a,b-a+1);
      reverse(s3.begin(),s3.end());
      str=str.substr(0,a)+s3+str.substr(b+1,str.size()-a-1);
    }else{
      cin >> s2;
      str=str.substr(0,a)+s2+str.substr(b+1,str.size()-a-1);
    }
  }
}


Measured memory_bytes: 3184
#include <iostream>
#include <vector>
using namespace std;

template<long long mod>
class modint{
private:
  long long a;
public:
  constexpr modint(const long long x = 0) noexcept : a(x%mod) {}
  constexpr long long& value() noexcept { return a; }
  constexpr const long long& value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint& operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if(a >= mod) a -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if(a < rhs.a) a += mod;
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint rhs) noexcept {
    a = a*rhs.a%mod;
    return *this;
  }
  constexpr modint& operator/=(modint rhs) noexcept {
    long long k = mod-2;
    while(k > 0){
      if(k&1){
        *this *= rhs;
      }
      rhs *= rhs;
      k /= 2;
    }
    return *this;
  }
  friend ostream& operator<<(ostream &os, const modint &X){
    return os << X.a;
  }
  friend istream& operator>>(istream &is, modint &X){
    is >> X.a;
    X.a %= mod;
    if(X.a < 0) X.a += mod;
    return is;
  }
};

template<typename T>
struct CumSum{
private:
  size_t size;
  vector<T> data;
public:
  CumSum(vector<T> dat){
    size = dat.size();
    data.resize(size+1,0);
    for(size_t i = 0; i < size; ++i)
      data[i+1] = data[i] + dat[i];
  }
  T getsum(size_t l, size_t r){//0-indexed, [l,r)
    return data[r] - data[l];
  }
  T getsum(size_t r){//0-indexed, [0,r)
    return data[r];
  }
};

int main(){
  using mint = modint<(int)1e9+7>;
  int N;
  string s;
  cin >> N >> s;
  vector<mint> dp(N,1);
  for(int i = 0; i < N-1; ++i){
    CumSum<mint> cs(dp);
    vector<mint> dp_(N,0);
    for(int j = 0; j < N; ++j){
      if(s[i] == '<'){
        if(j == 0) continue;
        if(j >= N-i) continue;
        dp_[j-1] = cs.getsum(j);//sum({dp[k] | 0 <= k < j})
      }else{
        if(j > N-i) break;
        dp_[j] = cs.getsum(j+1,N);
      }
    }
    dp = dp_;
    // for(auto e : dp){
    //   cerr << e << " ";
    // }cerr << endl;
  }
  mint ans = dp[0];
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<long long int> dp(n+1,0);
    for (int i = 1 ; i <= n ; i++)
        for(int j = i ; j <= n ;j += i)
            dp[j]++;
    long long int ans = 0;
    for(int i = 1 ; i <= n ;i++)
        ans += i * dp[i];

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 81392
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

internal class Program {
    static void Main() => CustomMain();

    static void Solve() {
        string a, b, c;
        ReadMulti(out a, out b, out c);

        string ans = a[0].ToString() + b[0] + c[0];
        ans = ans.ToUpper();

        WriteAnswer(ans);
    }


    static void CustomMain() {
#if DEBUG
        // ファイルからテストケースを読み込む
        ChangeStdIn();
        // 時間計測
        var stopwatch = new Stopwatch();
        stopwatch.Start();
#endif
        // 出力高速化
        var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(streamWriter);
        // 回答
        Solve();
#if DEBUG
        stopwatch.Stop();
        Console.WriteLine(stopwatch.Elapsed);
#endif
        Console.Out.Flush();
    }

    static string ReadString() => Console.ReadLine().Trim();
    static int ReadInt() => int.Parse(ReadString());
    static long ReadLong() => long.Parse(ReadString());
    static float ReadFloat() => float.Parse(ReadString());
    static double ReadDouble => double.Parse(ReadString());

    static string[] ReadStringArray() => ReadString().Split(' ');
    static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
    static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
    static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
    static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

    static T TypeConversion<T>(string s) {
        if (typeof(T) == typeof(int)) {
            return (T) Convert.ChangeType(int.Parse(s), typeof(T));
        } else if (typeof(T) == typeof(long)) {
            return (T) Convert.ChangeType(long.Parse(s), typeof(T));
        } else if (typeof(T) == typeof(double)) {
            return (T) Convert.ChangeType(double.Parse(s), typeof(T));
        } else {
            return (T) Convert.ChangeType(s, typeof(T));
        }
    }

    static void ReadMulti<T, U>(out T a, out U b) {
        var str = ReadStringArray();
        a = TypeConversion<T>(str[0]);
        b = TypeConversion<U>(str[1]);
    }

    static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
        var str = ReadStringArray();
        a = TypeConversion<T>(str[0]);
        b = TypeConversion<U>(str[1]);
        c = TypeConversion<V>(str[2]);
    }

    static void WriteAnswer(object ans) => Console.WriteLine(ans);

    static bool IsOdd(long num) {
        return (num & 1) == 1;
    }

    static bool IsEven(long num) {
        return (num & 1) == 0;
    }

    static long GCD(long a, long b) {
        return b != 0 ? GCD(b, a % b) : a;
    }

    static long RoundUp(long a, long b) {
        return (a + b - 1) / b;
    }


    static void ChangeStdIn() {
        var path = "./../../TestCase.txt";
        var exStdIn = new System.IO.StreamReader(path);
        Console.SetIn(exStdIn);
    }
}

Measured memory_bytes: 13140
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = br.readLine().split(" ");
		int m = Integer.parseInt(str[1]);
		List<String> list = new ArrayList<String>();
		Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
		while (m > 0) {
			String r = br.readLine();
			list.add(r);
			String[] row = r.split(" ");
			int p = Integer.parseInt(row[0]);
			int y = Integer.parseInt(row[1]);
			if (map.containsKey(p)) {
				map.get(p).add(y);
			} else {
				List<Integer> l = new ArrayList<Integer>();
				l.add(y);
				map.put(p, l);
			}
			m--;
		}
		Map<Integer, Map<Integer, Integer>> nm = new HashMap<Integer, Map<Integer, Integer>>();
		for (Entry<Integer, List<Integer>> en : map.entrySet()) {
			int key = en.getKey();
			List<Integer> value = en.getValue();
			Collections.sort(value);
			Map<Integer, Integer> subm = new HashMap<Integer, Integer>();
			for (int i = 1; i < value.size() + 1; i++) {
				subm.put(value.get(i - 1), i);
			}
			nm.put(key, subm);
		}
		for (String r : list) {
			String[] row = r.split(" ");
			int p = Integer.parseInt(row[0]);
			int y = Integer.parseInt(row[1]);
			int num = nm.get(p).get(y);
			String str1 = "000000" + p;
			String font = str1.substring(str1.length() - 6);
			String str2 = "000000" + num;
			String end = str2.substring(str2.length() - 6);
			System.out.println(font + end);
		}
	}
}

Measured memory_bytes: 125732
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

a,b = get_nums_l()
print(max(a+b, a-b, a*b))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}	
int n;
set<string>v;

void solve(int pos,string ans){

    if(pos > n){
        v.insert(ans);
        return ;
    }
    int mx = 0;
    FOR(i,0,sz(ans))mx = max(mx,ans[i]-'a'+1LL);
    FOR(i,0,mx+1)solve(pos+1,ans+(char)('a'+i));
}

signed main()
{
    showoff;
    cin >> n;
    solve(2,"a");
    for(auto &x:v)cout << x << "\n";
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...#include <bits/stdc++.h>
 


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

int main() {
  int N;
  cin >> N;
  vector <int> a(N);
  
  for (int i = 0; i < N; i++)
    cin >> a.at(i);
  
  vector <int> now(1);
  now.at(0) = 1;
  
  for (int i = 0; i < 100000; i++){
    now.push_back(a.at(now.at(i) - 1));
    
    if (now.at(i + 1) == 2){
      cout << now.size() - 1 << endl;
      break;
    }
   
  }
    if (now.size() == 100001){
      cout << -1 << endl;
    }
  
}


Measured memory_bytes: 1276
#include<cstdio>
#include<algorithm>
#include<vector>

using namespace std;

typedef long long LL;

const int N = 55556;

bool st[N];
int primes[N], cnt;
vector<int> nums;

void init(int n)
{
    for(int i = 2; i <= n; i ++)
    {
        if(!st[i])  primes[cnt ++] = i;
        for(int j = 0; primes[j] <= n / i; j ++)
        {
            st[i * primes[j]] = true;
            if(i % primes[j] == 0)  break;
        }
    }
    for(int i = 21; i < N; i += 10)
        if(!st[i])  nums.push_back(i);
}

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

Measured memory_bytes: 1016
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int a,b,c,d;
int main(){
    while(scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF){
        if(a+b>c+d)
            cout<<"Left"<<endl;
        else if(a+b<c+d)
            cout<<"Right"<<endl;
        else
            cout<<"Balanced"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256