akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 1000000007
#define MOD 998244353
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define print(x) cout << x << "\n"
#define print2(x, y) cout << x << " " << y << "\n"
#define printv(vec) rep(lp, vec.size()) cout << vec[lp] << " "; print("");
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;

void Main(){

    ll n;
    cin >> n;
    ll dp[3000]; dp[0] = 1;
	rep(i, n) rep2(j, 3, n + 1){
		if(i + j < n + 5){
			dp[i + j] += dp[i];
			dp[i + j] %= INF;
		}
	}
	ll ans = dp[n];
	print(ans);
	
}

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	Main();
	return 0;
	
}





Measured memory_bytes: 3628
N,K = map(int,input().split())
xy = sorted([list(map(int,input().split())) for _ in range(N)],key = lambda x:(x[0],x[1]))

ans = 10**20

for i in range(K,N+1):
    for j in range(0,N-i+1):
        xy2 = sorted(xy[j:j+i],key = lambda x:(x[1]))
        for k in range(0,i-K+1):
            xy3 = xy2[k:k+K]
            Y_wid = xy3[-1][1] - xy3[0][1]
            x3 = [tmp for tmp,_ in xy3]
            X_wid = max(x3) - min(x3)
            ans = min(ans,X_wid*Y_wid)
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
struct edge{int from, to;};

int main(){
    int n,m;
    cin>>n>>m;
    ll a[n],b[n];
    ll c[m],d[m];

    rep(i,n) cin>>a[i]>>b[i];
    rep(i,m) cin>>c[i]>>d[i];
    
    rep(i,n){
        ll man=1e10;
        int ans=1;
        rep(j,m){
            if(man>abs(a[i]-c[j])+abs(b[i]-d[j])){
                man=abs(a[i]-c[j])+abs(b[i]-d[j]);
                ans=j+1;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

signed main(){
    
    while(1){
        string s; cin >> s;
        if(s == "#") break;
        int n = (int)s.size();
        vector<string> ans;
        for(int bit = 0; bit < (1 << n); bit++){

            int st[26] = {};
            bool ok = true;
            string p = "";
            for(int i = 0; i < n; i++){
                char t = s[i];
                if(bit & (1 << i) && t != 'z'){
                    t = t + 1;
                }

                p = p + t;

                if(t != 'a' && st[(int)(t - 'a')] == 0){
                    st[(int)(t - 'a')] = 1;
                    t = t - 1;
                }
                if(t != s[i]){
                    ok = false;
                    break;
                }
            }

            if(ok) ans.push_back(p);
        }

        sort(ans.begin(), ans.end());
        ans.erase(unique(ans.begin(), ans.end()), ans.end());
        int m = (int)ans.size();
        cout << m << endl;
        for(int i = 0; i < m; i++){
            if(i < 5 || i >= m - 5) cout << ans[i] << endl;
        }
    }
    return 0;
}




Measured memory_bytes: 4184
(defun solve (n m submits)
  (let ((wa-counts (make-array n :element-type 'fixnum))
        (ac-counts (make-array n :element-type 'fixnum))
        (penalty-count 0))
    (loop for (p . s) in submits
          if (and (string= s "WA")
                  (zerop (aref ac-counts (1- p))))
          do (incf (aref wa-counts (1- p)))
          if (and (string= s "AC")
                  (zerop (aref ac-counts (1- p))))
          do (incf (aref ac-counts (1- p)))
             (incf penalty-count (aref wa-counts (1- p))))
    (list (count-if-not #'zerop ac-counts) penalty-count)))

#-swank
(let* ((n (read))
       (m (read))
       (submits (loop repeat m
                      for input = (read-line)
                      collect (let ((pos (position #\Space input)))
                                (cons (parse-integer input :end pos)
                                      (subseq input (1+ pos)))))))
  (format t "~{~A~^ ~}~%" (solve n m submits)))


Measured memory_bytes: 51684
c = [list(map(int,input().split()))for l in range(3)]
flag=False
for i in range(c[0][0]+1):
    a1=i
    b1=c[0][0]-a1
    b2=c[0][1]-a1
    b3=c[0][2]-a1
    a2=c[1][0]-b1
    a3=c[2][0]-b1
    if c[1][1]==a2+b2 and c[1][2]==a2+b3 and c[2][1]==a3+b2 and c[2][2]==a3+b3:
        flag=True
        break
    else:
        continue

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<stdio.h>

int main()
{
	double a1,an,an1,s10;
	int i;

	while(scanf("%lf",&a1)!=EOF)
	{
		an1=a1;
		s10=a1;
		
		for(i=2;i<=10;i++)
		{
			if(i%2==0)
			{
				an=an1*2;
			}
			else
			{
				an=an1/3;
			}
			s10+=an;
			an1=an;
		}

		printf("%lf\n",s10);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("http://in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

int main()
{
	
ll n,a,b;
cin>>n>>a>>b;
ll p=a+b;
ll ans=0;
ans=(n/p)*a;
ans=ans+min(n%p,a);
cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int h,a; cin >> h >> a;
    if(h%a > 0) OUT(h/a+1);
    else OUT(h/a);

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a,b,c,ans;
	ans = 0;
	scanf("%d %d %d",&a,&b,&c);
	 for(int i = 0;i < 10;i++){
	    ans =   c * a - b;
	    printf("%d\n",ans);
	    c = ans;
	 }
	
	
	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(j, n) for (int j = 0; j < (n); j++)

typedef long long ll;

int main()
{
   ll n,m;
   cin>>n>>m;
   if(n==1&&m==1)cout<<1<<endl;
   else if(n==1||m==1)cout<<max(m,n)-2<<endl;
   else cout<<(m-2)*(n-2)<<endl;
   return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef vector<int> vint;
#define rep(i,n) for(lint i = 0;i < n;i++)
#define all(x) x.begin(),x.end()
#define clr(a) memset(a,0,sizeof(a))
#
int main(void){
    lint x[2],y[2];
    rep(i,2)
        cin >> x[i] >> y[i];
    cout << x[1]+y[0]-y[1] << " " << y[1]+x[1]-x[0] << " " << x[0]+y[0]-y[1] << " " << y[0]+x[1]-x[0];
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define SIZ 100000
int m[SIZ+1];
long long st[SIZ];

int main(){
	int N,j,ptr;
	long long r,h;
	for(;~scanf("%d",&N)&&N;){
		for(j=0;j<N;j++)scanf("%d",m+j);m[j]=0;
		for(r=ptr=j=0;j<=N;j++){
			int left=j;
			for(;ptr && (h=st[ptr-1]>>32)>m[j];){
				int l=st[--ptr]&0xffffffff;
				if(r<h*(j-l))r=h*(j-l);
				left=l;
			}
			st[ptr++]=((long long)m[j]<<32)|left;
		}
		printf("%lld\n",r);
	}
	return 0;
}

Measured memory_bytes: 1768
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const long long mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

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

ll powMod(ll n, ll k, ll m) {
	if (k == 0) {
		return 1;
	} else if (k % 2 == 1) {
		return powMod(n, k - 1, m) * n % m;
	} else {
		ll t = powMod(n, k / 2, m);
		return t * t % m;
	}
}

int main() {
	string s;
	cin >> s;
	
	bool flg = true;
	
	if(s[2]!=s[3]) flg=false;
	if(s[4]!=s[5]) flg=false;

	cout << (flg ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <queue>
#include <vector>
#include <iostream>
using namespace std;
struct edge {
	int to, cost;
};
bool operator<(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}
int N, M, L, s, t, a, b, c, p[22], e[22], popcount[131111];
int main() {
	for (int i = 0; i < 17; i++) {
		for (int j = 1 << i; j < 2 << i; j++) {
			popcount[j] = popcount[j - (1 << i)] + 1;
		}
	}
	while (cin >> N >> M >> L >> s >> t, s--, N) {
		vector<vector<edge> > G(N);
		for (int i = 0; i < M; i++) {
			cin >> a >> b >> c; a--, b--;
			G[a].push_back(edge{ b, c });
			G[b].push_back(edge{ a, c });
		}
		for (int i = 1; i <= L; i++) cin >> p[i] >> e[i], p[i]--; p[0] = s;
		vector<vector<int> > dist(L + 1, vector<int>(L + 1));
		for (int i = 0; i <= L; i++) {
			priority_queue<edge> que; que.push(edge{ p[i], 0 });
			vector<int> d(N, 999999999); d[p[i]] = 0;
			while (!que.empty()) {
				edge u = que.top(); que.pop();
				for (edge e : G[u.to]) {
					if (d[e.to] > d[u.to] + e.cost) {
						d[e.to] = d[u.to] + e.cost;
						que.push(edge{ e.to, -d[e.to] });
					}
				}
			}
			for (int j = 0; j <= L; j++) dist[i][j] = d[p[j]];
		}
		vector<vector<int> > dp(L + 1, vector<int>(1 << (L + 1), 999999999));
		dp[0][0] = 0;
		for (int i = 0; i < 1 << (L + 1); i++) {
			for (int j = 0; j <= L; j++) {
				if (dp[j][i] == 999999999) continue;
				for (int k = 0; k <= L; k++) {
					if (!(i & (1 << k))) {
						dp[k][i + (1 << k)] = min(dp[k][i + (1 << k)], dp[j][i] + dist[j][k] + e[k]);
					}
				}
			}
		}
		int ret = 0;
		for (int i = 0; i < 1 << (L + 1); i++) {
			if (dp[0][i] <= t) ret = max(ret, popcount[i]);
		}
		cout << ret - 1 << endl;
	}
	return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

template< typename Monoid >
struct SegmentTree {
	using F = function< Monoid(Monoid, Monoid) >;

	int sz;
	vector< Monoid > seg;

	const F f;
	const Monoid e;

	SegmentTree(int n, const F f, const Monoid &e) : f(f), e(e) {
		sz = 1;
		while (sz < n) sz <<= 1;
		seg.assign(2 * sz, e);
	}
	// k:=[0,sz)
	void set(int k, const Monoid &x) {
		seg[k + sz] = x;
	}

	void build() {
		for (int k = sz - 1; k > 0; k--) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}
	// k:=[0,sz)
	void update(int k, const Monoid &x) {
		k += sz;
		seg[k] = x;
		while (k >>= 1) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}
	// [a,b)
	Monoid query(int a, int b) {
		Monoid L = e, R = e;
		for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
			if (a & 1) L = f(L, seg[a++]);
			if (b & 1) R = f(seg[--b], R);
		}
		return f(L, R);
	}
	// k:=[0,sz)
	const Monoid &operator[](const int &k) const {
		return seg[k + sz];
	}
	Monoid &operator[](const int &k) {
		return seg[k + sz];
	}
};



signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>a(N); rep(i, 0, N) { cin >> a[i]; }
	SegmentTree<int>seg(N, [](int a, int b) {return max(a, b); }, 0);
	rep(i, 0, N) {
		seg[i] = a[i];
	}
	seg.build();
	rep(i, 0, N) {
		int a=seg.query(0, i);
		int b=seg.query(i + 1, N);
		cout << max(a, b) << endl;
	}

	return 0;
}


Measured memory_bytes: 7296
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int32_t main(){
	boost;
	//freopen(".in","r",stdin);
	int n;
	cin>>n;
	cout<<(n/500LL)*1000LL+((n%500LL)/5LL)*5LL<<"\n";
	return 0;
}
//long long
//array bounds
//special cases
//binary search

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
  int Q;
  cin >> Q;
  vector< int > l(Q), r(Q);

  vector< bool > isPrime(100001, false);
  vector< int > primes;

  primes.push_back(2); primes.push_back(3); primes.push_back(5);
  for(int i = 7; i < 100000; i += 2) {
    bool flag = true;
    for(auto p : primes) {
      if(i % p == 0) {flag = false; break;}
    }
    if(flag) primes.push_back(i);
  }

  for(auto p : primes) {
    isPrime[p] = true;
  }

  cin >> l[0] >> r[0];
  int L = l[0], R = r[0];
  for(int i = 1; i < Q; i++) {
    cin >> l[i] >> r[i];
    L = min(L, l[i]);
    R = max(R, r[i]);
  }

  vector< int > sum(100001, 0);
  for(int i = 1; i < 100000; i += 2) {
    if(isPrime[i] && isPrime[(i + 1) / 2])
      sum[i] = sum[i-2] + 1;
    else
      sum[i] = sum[i-2];
  }

  for(int i = 0; i < Q; i++) {
    cout << sum[r[i]] - sum[l[i]-2] << endl;
  }

  return 0;
}


Measured memory_bytes: 1920
n,k=map(int,input().split())
d=[int(i) for i in input().split()]
t=n
while 1:
    x=t
    while 1:
        if x%10 in d:
            break
        else:
            x//=10
        if x==0:
            print(t)
            exit()
    t+=1

Measured memory_bytes: 39408
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<unordered_map>
#include<map>
#include<string>
#include<cstring>
#include<stack>
#include<cmath>

#define vint vector<int>
#define vstr vector<string>
#define vll vector<long long>
#define ll long long
#define pf printf
#define sf scanf
#define sfd(n) scanf("%d", &n)
#define sfll(n) scanf("%lld", &n)
#define pfd(n) printf("%d", n)
#define pfll(n) printf("%lld", n)
#define pft	printf("\t")
#define pfn printf("\n")
#define pfk printf(" ")
#define PI 3.1415926
#define MAX 100000
#define M 100003

using namespace std;

int main() {
	int n;
	sfd(n);
	getchar();
	string str;
	cin >> str;
	if( n>=3200 )  cout << str;
	else  cout << "red";

	
	return 0;
}

Measured memory_bytes: 256
n=int(input())
if n==3:
    print(2)
    print(1,3)
    print(2,3)
elif n%2==0:
    print(n*(n-2)//2)
    for i in range(1,n):
        for j in range(i+1,n+1):
            if i+j!=1+n:
                print(i,j)
else:
    print((n-1)*(n-3)//2+n-1)
    for i in range(n-1):
        print(i+1,n)
    n-=1
    for i in range(1,n):
        for j in range(i+1,n+1):
            if i+j!=1+n:
                print(i,j)

Measured memory_bytes: 44528
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
//long long num[100000];
int main(){
	int k[3];
	cin>>k[0]>>k[1]>>k[2];
	sort(k,k+3);
	cout<<k[0]+k[1]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main(){
	IOS;
	int n, a, b, u, v;
	cin >> n;
	int arr[n+1];
	for(int i = 0; i <= n; i++)
		arr[i] = i;
	for(int i = 1; i <= n; i++)
		arr[i] = arr[i] + arr[i-1];

	int ans = 0;
	for(int i = 1; i <= n; i++)
		ans += arr[i];

	for(int i = 0; i < n-1; i++){
		cin >> u >> v;
		a = min(u, v), b = max(u, v);
		b = n - b + 1;
		ans = ans - (a*b);
	}

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

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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=3010;
char a[N],b[N],ans[N];
int dp[N][N];
pair<int,int>pre[N][N];
int main()
{
	scanf("%s%s",a+1,b+1);
	int la=strlen(a+1),lb=strlen(b+1);
	dp[0][0]=dp[0][1]=dp[1][0]=0;pre[0][0]=pre[0][1]=pre[1][0]=make_pair(0,0);
	for (register int i=1;i<=la;++i)
	  for (register int j=1;j<=lb;++j)
	  {
	  	  if (dp[i-1][j]>=dp[i][j]) dp[i][j]=dp[i-1][j],pre[i][j]=make_pair(i-1,j);
	  	  if (dp[i][j-1]>=dp[i][j]) dp[i][j]=dp[i][j-1],pre[i][j]=make_pair(i,j-1);
	  	  if (a[i]==b[j]&&dp[i-1][j-1]+1>=dp[i][j]) dp[i][j]=dp[i-1][j-1]+1,pre[i][j]=make_pair(i-1,j-1);
	  }
	int x=la,y=lb,len=0;
	while (x&&y)
	{
		if (a[x]==b[y]) ans[++len]=a[x];
		int tx=x,ty=y;x=pre[tx][ty].first;y=pre[tx][ty].second;
	}
	for (register int i=len;i>=1;--i) printf("%c",ans[i]);
	printf("\n");
	return 0;
}

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

vector<int> to[100005];

int main(){
	ll n,m;
	cin >> n >> m;
	vector<ll> h(n);
	rep(i,n) cin >> h[i];
	rep(i,m){
		int a,b;
		cin >> a >> b;
		a--;b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	ll ans = 0;
	rep(i,n){
		ll v = h[i];
		bool ok = true;
		for(auto next : to[i]){
			if(h[next] >= v) ok = false;
		}
		if(ok) ans++;
	}
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 9064
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string a;
	cin>>a;
	int se[n],sw[n];
	for(int i=0;i<n;++i){
		se[i]=0;
		sw[i]=0;
	}
	if (a[0]=='E')
	se[0]=1;
	else
	sw[0]=1;
	for(int i=0;i<n;i++){
		if(a[i]=='E')
		{
		se[i]=se[i-1]+1;
		sw[i]=sw[i-1];
	}
		else 
		{
			sw[i]=sw[i-1]+1;
			se[i]=se[i-1];	
					}
	}
	int minv=300005;
	for(int i=0;i<n;++i){
		int mmm=0;
		if(i==0)
			mmm=se[n-1]-se[0];
		else if(i==n-1)
			mmm=sw[n-2];
		mmm=sw[i-1]+(se[n-1]-se[i]);
		minv=min(minv,mmm);
	}
	cout<<minv;
	return 0;
}

Measured memory_bytes: 2948
n = int(input())
C = [list(map(int,input().split()))for i in range(n)]
C.sort(key = lambda x: -x[2])
for x in range(101):
    for y in range(101):
        h = C[0][2]+abs(x-C[0][0])+abs(y-C[0][1])
        if all([c[2] == max(h-abs(x-c[0])-abs(y-c[1]),0) for c in C]):
            print(x,y,h)
            exit()

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

using ll = long long;
#define rep(n, i) for(ll i = 0; i < n; ++i)

void solve(void){
  ll n; cin >> n;
  vector<ll> v(n, 0);
  rep(n, i) cin >> v[i];

  ll res = 0;
  bool flag = true;
  while(flag == true) {
    rep(n, i) {
      if (v[i] % 2 != 0 ) {
        flag = false;
        break;
      }
      v[i] /= 2;
    }
    if(flag == true) ++res;
  }

  cout << res << endl;
}

int main(void) {
  solve();
  return 0;
}

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

int main()
{   int a,b,c,p,q,r;
 
    scanf("%d",&p);
   scanf("%d",&q);
    scanf("%d",&r);
    
a=p+q;
b=q+r;
c=r+p;
 
if(a<=b && a<=c){
	printf("%d",a);
	}
else if(b<=a && b<=c){
	printf("%d",b);
	}
else printf("%d",c);

    return 0;

}

Measured memory_bytes: 128
N = int(input())
L = list(map(int, input().split()))

L.sort()

ans = 0

for i in range(N - 2):
    a = L[i]
    for j in range(i + 1, N - 1):
        b = L[j]
        left = j
        right = N
        if L[left + 1] >= a + b:
            continue
        while right - left > 1:
            mid = (left + right) // 2
            c = L[mid]
            if c < a + b:
                left = mid
            else:
                right = mid
        ans += left - j

print(ans)


Measured memory_bytes: 43868
# N = 3
N=int(input())
# N = 10**5

alphas =list("abcdefghijklmnopqrstuvwxyz")
d = {}
for i,alpha in enumerate(alphas):
    d[alpha] = i

# print(d)

a = []
for n in range(N):
    s = input()
    # s = "acornistnt"
    # s = "aaaaaaaaaa"
    sl = [0 for i in range(26)]
    for ss in s:
        sl[d[ss]] += 1
    a.append(tuple(sl))

des = {}
for aa in a:
    if aa not in des:
        des[aa] = 0
    des[aa] += 1

# print(des)

# fact_cache = {}


cnt = 0
for k in des:
    ddd = des[k]
    cnt += (ddd*(ddd-1))//2
print(cnt)

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

int main() {
  int a1,a2,a3;
  cin >> a1 >> a2 >> a3;
  if (a1 + a2 + a3 >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
  return 0;
}


Measured memory_bytes: 3580
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] NM_array = Console.ReadLine().Split(' ');
            long[] NM = NM_array.Select(Int64.Parse).ToArray();

            long N = NM[0];
            long M = NM[1];

            long NC2 = 0;
            long MC2 = 0;
            //if( N > 1) NC2 = Factorial(N) / (2 * Factorial(N - 2));
            //if( M > 1) MC2  = Factorial(M) / (2 * Factorial(M - 2));
            if (N > 1) NC2 = N * ( N - 1 ) / 2;
            if (M > 1) MC2 = M * ( M - 1 ) / 2;

            long result = NC2 + MC2;

            Console.WriteLine(result.ToString());
        }

        //static long Factorial(long n)
        //{
        //    long rt = 1;
        //    while (n > 1)
        //    {
        //        rt *= n;
        //        n--;
        //    }
        //    return rt;
        //}
        //public static Int64 Factorial(Int64 n)
        //{
        //    checked
        //    {
        //        if (n == 0)
        //            return 1L;
        //        return n * Factorial(n - 1);
        //    }
        //}
        //static long Factorial(int n) =>
        //    checked(n == 0 ? 1L : n * Factorial(n - 1));
    }
}


Measured memory_bytes: 11348
{
	75=3*25
		=3*5*5
		=5*15
	a^2 b^24
	a^2 b^4 c^4
	a^4 b^14
}
var
	i,j,k,ans,n:longint;
	s:array[0..110] of longint;
	f:array[0..110,0..110,0..110] of boolean;
procedure prime(x:longint);
begin
	j:=2;
	while x>=j do
	begin
		while x mod j=0 do
		begin
			inc(s[j]);
			x:=x div j;
		end;
		inc(j);
	end;
end;
begin
	read(n);
	fillchar(s,sizeof(s),0);
	for i:=2 to n do prime(i);
	fillchar(f,sizeof(f),true);
	ans:=0;
	for i:=2 to n do
		for j:=2 to n do
			if i<>j then
			begin
				if (s[i]>=2) and (s[j]>=24) then inc(ans);
				if (s[i]>=4) and (s[j]>=14) then inc(ans);
				if (s[i]>=2) and (s[j]>=4) then 
					for k:=2 to n do
						if (i<>k) and (j<>k) then
							if s[k]>=4 then 
								if f[i,j,k] then
								begin 
									inc(ans);
									f[i,j,k]:=false;
									f[i,k,j]:=false;
								end;
			end;
	for i:=1 to n do
		if s[i]>=74 then inc(ans);
	writeln(ans);
end.

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

template<typename T> T combination(int n, int r) {
    T ans = 1;
    for (int i = 0; i < r; i++) {
        ans *= n - i;
    }
    for (int i = 1; i <= r; i++) {
        ans /= i;
    }
    return ans;
}

int main() {
    int N;
    map<string, int> M;
    cin >> N;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        M[s]++;
    }
    long long ans = 0;
    for (auto it = M.begin(); it != M.end(); it++) {
        ans += combination<long long>((*it).second, 2);
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>
#define INFTY 1000000000
#define N 101

int main() {
  int i,j,l,z,n,k[N],m[N][N];
  scanf("%d",&n);
  for(i=1;i<=n;i++)scanf("%d%d",&k[i-1],&k[i]);
  for(i=1;i<=n;i++)m[i][i]=0;
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=INFTY;
      for(z=i;z<=j-1;z++){
	int a = (m[i][z]+m[z+1][j]+k[i-1]*k[z]*k[j]);
	if((m[i][j])> a)m[i][j]=a;
	else ;
      }
    }
  }
  printf("%d\n",m[1][n]);
  return 0;
}



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

int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  vector<int> sv(s.size(), 0), tv(t.size(), 0);
  int scnt = 0, tcnt = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == s[i-1]) scnt++;
    else {
      sv[scnt]++;
      scnt = 0;
    }

    if (t[i] == t[i-1]) tcnt++;
    else {
      tv[tcnt]++;
      tcnt = 0;
    }
  }
  sv[scnt]++;
  tv[tcnt]++;

  string ans = "Yes";
  rep(i,s.size()) {
    if (sv[i] != tv[i]) {
      ans = "No";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2312
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll a[n],b;
    rep(i,n){
        cin >> b;
        a[i] = b-(i+1);
    }
    sort(a,a+n);
    ll ans = 0;
    rep(i,n){
        ans += abs(a[i]-a[n/2]);
    }
    PRINT(ans);
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
using namespace std;
#define ll long long

ll Knapsack(ll*size,ll*value,ll n,ll S,ll i,vector<vector<ll> > &dp)
{
	if(i==n)
		return 0;

	if(dp[i][S]!=(-1))
		return dp[i][S];

	ll op1=0;
	if(S-size[i]>=0)
		op1=value[i]+Knapsack(size,value,n,S-size[i],i+1,dp);

	ll op2=Knapsack(size,value,n,S,i+1,dp);

	return dp[i][S]=max(op1,op2);
}

int main()
{
	ll n,w;
	cin>>n>>w;

	ll*weight=new ll[n];
	ll*value=new ll[n];

	for(int i=0;i<n;i++)
	{
		ll x,y;
		cin>>x>>y;

		weight[i]=x;
		value[i]=y;
	}

	vector<vector<ll> > dp(n,vector<ll> (w+1,-1));
	cout<<Knapsack(weight,value,n,w,0,dp);

	return 0;
}

Measured memory_bytes: 79360
#include<bits/stdc++.h>
using namespace std;
string s;
bool judge(string s) {
	int len = s.length();
	if (len & 1) return 0;
	for (int i = 0; i < len / 2; i ++) {
		if (s[i] != s[i + len / 2]) return 0;
	}
	return 1;
}
int main() {
	cin >> s;
	for (int i = 1; i <= s.length(); i ++) {
		if (judge(s.substr(0, s.length() - i))) {
			cout << s.length() - i << endl;
			return 0;
		}
	}
	return 0; 
}


Measured memory_bytes: 256
module IntMap = Map.Make (struct
  type t = int
  let compare = compare
end)

(* 0-indexedなBIT *)
module FenwickTree = struct
  (* 可換モノイド *)
  module type CommutativeMonoid = sig
    type t
    val e : t
    val op : t -> t -> t
  end

  module Make (CM : CommutativeMonoid)
  : sig
    type t
    (* n要素の単位元からなるBITを作る *)
    val make : int -> t
    (* 添字iの要素にはf iが入ったn要素のBITを作る *)
    val init : int -> (int -> CM.t) -> t
    (* 与えられたリストの要素が入ったBITを作る *)
    val of_list : CM.t list -> t
    (* i番目の要素にxを加える *)
    val accumulate : t -> int -> CM.t -> unit
    (* 添字が[0, i)の範囲の要素を全て加えた値を求める *)
    val query : t -> int -> CM.t
  end
  = struct
    type t = CM.t array

    let make n = Array.make n CM.e

    let initialize a =
      for i = 0 to Array.length a - 1 do
        if i lor (i + 1) < Array.length a then
          a.(i lor (i + 1)) <- CM.op a.(i) a.(i lor (i + 1))
      done

    let init n f =
      let a = Array.init n f in
      initialize a; a

    let of_list l =
      let a = Array.of_list l in
      initialize a; a

    let rec accumulate a i x =
      if i < Array.length a then begin
        a.(i) <- CM.op x a.(i);
        accumulate a (i lor (i + 1)) x
      end

    let rec query acc a i =
      if i < 0
      then acc
      else query (CM.op acc a.(i)) a ((i land (i + 1)) - 1)
    let query a i = query CM.e a (i - 1)
  end
end

module IntSumBIT = FenwickTree.Make (struct
  type t = int
  let e = 0
  let op = ( + )
end)

let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let acc = IntSumBIT.init n @@ Array.get as_ in
  let m =
    Array.fold_left (fun m a ->
      IntMap.add a (1 + try IntMap.find a m with Not_found -> 0) m) IntMap.empty @@
    Array.init (n + 1) @@ IntSumBIT.query acc in
  Printf.printf "%d\n" @@
  IntMap.fold (fun _ n -> ( + ) @@ n * (n - 1) / 2) m 0


Measured memory_bytes: 17296
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, k; cin >> n >> k;
  cout << n - k + 1 << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
 
int main(){
    ll N, Q;
    string S;
    cin >> N >> S >> Q;
 
    vector<set<ll> > rec(26, set<ll>({50000000}));
    rep(i, 0, N) rec[S[i] - 'a'].insert(i+1);
    
    rep(q, 0, Q){
        ll type; cin >> type;
        if(type == 1){
            ll i; char c;
            cin >> i >> c;
            rec[S[i-1] - 'a'].erase(i);
            S[i-1] = c;
            rec[c - 'a'].insert(i); 
        }else{
            ll l, r; cin >> l >> r;
            ll ans = 0;
            rep(c, 0, 26){
                ll L = *rec[c].lower_bound(l);
                ll R = *rec[c].lower_bound(r+1);
                if(R > L) ans++;
            }
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 24196
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC133B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var n = input[0];
            var d = input[1];

            var list = new int[n][];

            foreach (var i in Enumerable.Range(0, n))
            {
                list[i] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            }

            var result = 0;

            foreach (var i in Enumerable.Range(0, n))
                foreach (var j in Enumerable.Range(i + 1, n - i - 1))
                {
                    if (CheckDistance(list[i], list[j]))
                    {
                        result++;
                    }
                }

            Console.WriteLine(result);
        }

        static bool CheckDistance(int[] x1, int[] x2)
        {
            var distance = Math.Sqrt(x1.Zip(x2, (x, y) => (x - y) * (x - y)).Sum());
            if (distance - Math.Floor(distance) == 0)
            {
                return true;
            }

            return false;
        }
    }
}


Measured memory_bytes: 13524
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#include<cstdlib>
#include<cctype>
#include<ctime>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 1e5 + 5;
const ll maxm = 1e3 + 5;
template<class T>
inline T qread(T &IEE){
	register T x = 0, f = 1;
	register char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-'){
			f = -f;
		}
		ch = getchar();
	}
	while(isdigit(ch)){
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return IEE = x * f;
}
template<class T>
inline void qwrite(T a){
	if(!a){
		putchar('0');
		return ;
	}
 	if(a < 0){
		putchar('-');
		a = -a;
	}
	if(a > 9) qwrite(a / 10);
	putchar(a % 10 + 48);
	return ;
}
template<class T>
inline T ab(T a){
	return (a > 0) ? a : -a;
}
template<class T>
inline void swa(T &a, T &b){
	a ^= b ^= a ^= b;
	return ;
}
ll cnt;
ll sum, x;
int main(){
//	freopen("1.in", "r", stdin);
//	freopen("1.out", "w", stdout);
	cin >> x;
	sum = 100;
	while(sum < x){
		cnt++;
		sum += sum / 100;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<iostream>
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)

using namespace std;

char ch[10100];
int cnt_J=0,cnt_I=0;

int search_JOI(){
    cnt_J=0;
    REP(i,10001){
        if(ch[i]=='J')
            if(ch[i+1]=='O'&&ch[i+2]=='I'&&i+1<=10000&&i+2<=10000)cnt_J++;
            if(ch[i]==0)break;
    }
    return cnt_J;
}

int search_IOI(){
    cnt_I=0;
    REP(i,10001){
        if(ch[i]=='I'&&ch[i+2]=='I'&&i+1<=10000&&i+2<=10000)
            if(ch[i+1]=='O'&&ch[i+2]=='I')cnt_I++;
            if(ch[i]==0)break;
    }
    return cnt_I;
}

int main(){
    while(1){
        REP(i,10000)ch[i]=0;
        if(scanf("%s",&ch)==EOF)break;
        int ans1=search_JOI();
        int ans2=search_IOI();
        cout<<ans1<<endl;
        cout<<ans2<<endl;
    }
    return 0;
}

Measured memory_bytes: 1168
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}

ll ara[Max];

ll dp[Max];


ll n;

ll call(ll i)
{
    if(ara[i] || i>n)return 0;



    ll &ret=dp[i];

    if(~ret)return ret;


    ret=(call(i+1)+call(i+2))%Mod;

    return ret;
}


int main()
{

   fastread();

   ll i,j,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;

      cin>>n>>k;

      memset(dp,-1,sizeof(dp));

      for(i=0; i<k; i++)
      {
          cin>>a;
          ara[a]=1;
      }

      ara[n+1]=1;
      ara[n+2]=1;
      dp[n]=1;

      cout<<call(0)<<endl;















}



Measured memory_bytes: 23112
from sys import stdin

def create_links(n, k):
  links = [[] for _ in range(n)]
  for i in range(k):
    p, q = map(int, stdin.readline().split())
    links[p - 1].append(q - 1)
    links[q - 1].append(p - 1)
  return links

def create_groups(n, links):
  groups = list(range(n))
  for i in range(n):
    if groups[i] != i:
      continue
    q = [i]
    while q:
      j = q.pop()
      for k in links[j]:
        if groups[k] != i:
          groups[k] = i
          q.append(k)
  return groups

n, k, l = map(int, input().split())
road_links = create_links(n, k)
rail_links = create_links(n, l)
road_groups = create_groups(n, road_links)
rail_groups = create_groups(n, rail_links)

d = {}
for i in range(n):
  t = (road_groups[i], rail_groups[i])
  if t in d:
    d[t] += 1
  else:
    d[t] = 1

print(*[d[(road_groups[i], rail_groups[i])] for i in range(n)])


Measured memory_bytes: 89224
A,B,H,M = map(int,input().split())
import math
# 角度を求める
#長針
m = 6*M
#短針
h = (H * 30) + ((30/60)*M)
#最終角度
kakudo = min(360 - abs(m - h), abs(h - m))
kakudo_a = math.radians(kakudo)
cos_x = math.cos(kakudo_a)
 
c = A**2 + B**2 - 2*A*B*cos_x
print(math.sqrt(c))


Measured memory_bytes: 9388
n = int(input())
a = input().split()
a = [int(m) for m in a]
rate = {}
for i in range(9):
    rate[i] = 0
for i in range(n):
    for rank in range(9):
        if rank == 0:
            if 1 <= a[i] <= 400 * (rank + 1) - 1:
                rate[rank] += 1
        if rank == 8:
            if 400 * rank <= a[i]:
                rate[rank] += 1
        elif 400 * rank <= a[i] <= 400 * (rank + 1) - 1:
            rate[rank] += 1
maxco = 0
minco = 0
void = 0
for i in range(9):
    if rate[i] != 0:
        if i == 8:
            if void == 8:
                minco += 1
            maxco += rate[i]
        else:
            maxco += 1
            minco += 1
    else:
        void += 1
print(minco, maxco)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n, k, a[100];
lli memo[2][100001];

lli dfs(lli t, lli s) {
  lli mt = max(0ll, t);
  if (memo[mt][s] != 0) return memo[mt][s];
  lli res = -t;
  for (lli i=0; i<n; ++i) {
    if (s - a[i] >= 0) {
      if (dfs(-t, s - a[i]) == t) {
        res = t;
        break;
      }
    }
  }
  return memo[mt][s] = res;
}

int main() {
  cin >> n >> k;
  read_n(a, n);
  memo[0][0] = 1;
  memo[1][0] = -1;
  cout << (dfs(1, k) == 1 ? "First" : "Second") << '\n';
  return 0;
}



Measured memory_bytes: 6528
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

double dp[3000][3000];
int n;
vector<double> v;

double f(int i,int head){
    if(i==n)return head>(n/2);
    double &ans=dp[i][head];
    if(ans>-1)return ans;
    ans=0;
    ans+=v[i]*f(i+1,head+1);
    ans+=(1-v[i])*f(i+1,head);
    return ans;
}

signed main(){
    FASTER;
    for(int i=0;i<3000;i++)for(int j=0;j<3000;j++)dp[i][j]=-1000.0;
    cin>>n;
    v=vector<double>(n);cin>>v;
    double ans=0;
    ans+=f(0,0);
    cout<<fixed<<setprecision(10)<<ans;
}


Measured memory_bytes: 141184
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin>>n;
  vector<int> arr(n);
  for(int i=0;i<n;i++){
    cin>>arr[i]; 
  }
  
  vector<int>dp(n);
  dp[0] =0;
  dp[1] = abs(arr[1]-arr[0])+dp[0];
  for(int i=2;i<n;i++){
     dp[i] = min(abs(arr[i]-arr[i-1])+dp[i-1],abs(arr[i]-arr[i-2])+dp[i-2]);
  }
  cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <list>
#include <iomanip>
#include <queue>
#include <cmath>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const long long mod = 1e9 + 7;


int main() {

	ll N, M;
	cin >> N >> M;

	vector<ll>oks(N + 1, true);

	rep(i, M) {
		ll a;
		cin >> a;
		oks[a] = false;
	}

	vector<ll>dp(N + 1);
	dp[0] = 1;

	rep(i, N) {
		repl(j, i + 1, min(N + 1, i + 3)) {
			if (oks[i]) {
				dp[j] += dp[i];
				dp[j] %= mod;
			}
		}
	}

	cout << dp[N];

	return 0;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}

ll f(int x, int y, int z){
	return (ll)x*x + y*y + z*z + x*y + y*z + z*x;
}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	
	VI ans(n+1);
	rep2(i, 1, n+1){
		if(i*i > n) break;
		rep2(j, 1, n+1){
			if(j*j>n || i*i+j*j+i*j>n) break;
			rep2(k, 1, n+1){
				if(k*k>n || f(i, j, k) > n) break;
				ans[f(i, j, k)]++;
			}
		}
	}
	rep2(i, 1, n+1) cout<<ans[i]<<"\n";
	return 0;
}


Measured memory_bytes: 3544
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#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 long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define BP(x) __builtin_popcountll(x)
#define PQS priority_queue <int, vector<int>, greater<int> > 
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

const int INF = 1e18 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;

void solve() {
  int n, k; cin >> n >> k;
  int data[n+5];
  for(int i = 1; i <= n; i++) cin >> data[i];
  for(int i = k+1; i <= n; i++) {
    if(data[i] > data[i-k]) cout << "Yes\n";
    else cout << "No\n";
  }
}

signed main() {   
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

  #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
  #endif
   int t = 1;  //cin >> t;
   for(int i = 1; i <= t; i++) {
   //  cout << "Case #" << i << ": ";
     solve();
  }
}    

/*

*/

Measured memory_bytes: 5188
#include<iostream>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int main(){
	int L;
	cin>>L;
	double l1=(L*1.0)/3;
	double l2=(L*1.0)/3;
	double l3=L*1.0-l1-l2;
	printf("%.12f",l1*l2*l3);
	return 0;
} 
//1.000000000000

Measured memory_bytes: 256
N = int(input())
S = input()
kouho = [str(i).zfill(3) for i in range(0,1000)]
cnt =0
for k in kouho:
    ok = True
    S_temp = S
    for l in k:
        if l in S_temp:
            basho = S_temp.index(l)
            S_temp = S_temp[basho+1:]
        else:
            ok = False
            break
    if ok == True:
        cnt += 1
print(cnt)

Measured memory_bytes: 44764