akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H & b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H & b) const { return x == b.x && y == b.y; }
	bool operator!=(const H & b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T & a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T & a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	string s;
	int n, k;
	cin >> n >> k >> s;
	for (int i = 0; i < n; i++) {
		if (i == k - 1) s[i] = (char)((int)s[i] + 'a' - 'A');
		cout << s[i];
	}
	cout << endl;
}

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

int main(){
  double a,b,c;
  int d;
  cin>>a>>b;
  c=(b-1)/(a-1);
  d=c;
  if(c!=d){
    cout<<d+1<<endl;
  }
  else{
    cout<<c<<endl;
  }
}


Measured memory_bytes: 3728
#include <iostream>

using namespace std;

int main(){
	int T, t[30];
	int N, M[100];
	while(cin >> T, T){
		for(int i=0;i<100;i++) M[i] = 24;
		for(int i=0;i<T;i++) cin >> t[i];
		cin >> N;
		for(int i=0;i<N;i++){
			int D, m; cin >> D >> m;
			M[D-1] = min(M[D-1],m);
		}
		int dp[100][100];
		for(int i=0;i<100;i++){
			for(int j=0;j<100;j++) dp[i][j] = 99999999;
		}
		dp[0][0] = 0;
		for(int i=0;i<99;i++){
			for(int j=0;j<T;j++){
				if(t[(j+1)%T]<=M[i+1]) dp[i+1][(j+1)%T] = min(dp[i+1][(j+1)%T], dp[i][j]);
				dp[i+1][0] = min(dp[i+1][0], dp[i][j]+1);
			}
		}
		int ans = 99999999;
		for(int i=0;i<T;i++) ans = min(dp[99][i], ans);
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define PREC(n) fixed << setprecision(n)
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << a / b << " " << a % b << " " << PREC(20) << (double) a / (double) b << endl;
}


Measured memory_bytes: 3252
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    string s;
    ll dp[n][m];
    for(int i=0;i<n;i++){
        cin>>s;
        if(i==0){
            dp[0][0]=1;
            for(int j=1;j<m;j++){
                if(s[j]=='#'){
                    dp[0][j]=0;
                }
                else{
                    dp[0][j]=dp[0][j-1];
                }
            }
        }
        else{
            for(int j=0;j<m;j++){
                if(s[j]=='#'){
                    dp[i][j]=0;
                }
                else{
                    if(j==0)dp[i][0]=dp[i-1][0];
                    else dp[i][j]=dp[i][j-1]+dp[i-1][j];
                    dp[i][j]%=mod;
                }
            }
        }
    }
    cout << dp[n-1][m-1]<<endl;
    return 0;
}



Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int main(){
	string s;cin>>s;
	for(int i=0;i<s.size();i++) 
	{
		if(s[i]==',') cout<<" ";
		else cout<<s[i];
	}
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define flush fflush(stdout)
#define debug printf("Hello\n")
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
int n, k, x, y, sum, cnt, ans, p[100005];
pii a[100005], b[100005];
map<pii, int>m;
int main () {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  FOR(i, 1, n) {
    cin >> a[i].fi;
    a[i].se = i;
  }
  FOR(i, 1, n) {
    cin >> b[i].fi;
    b[i].se = i;
  }
  sort(a+1, a+n+1);
  sort(b+1, b+n+1);
  FOR(i, 1, n) {
    if (a[i].fi > b[i].fi) {
      cout << "No\n";
      return 0;
    }
    p[a[i].se] = b[i].se;
  }
  FOR(i, 2, n) {
    if (a[i].fi <= b[i-1].fi) {
      cout << "Yes\n";
      return 0;
    }
  }
  int cur = 1;
  FOR(i, 1, n-1) {
    cur = p[cur];
    if (cur == 1) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}

Measured memory_bytes: 2176
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N, M;
ll Ls[100005];
ll Rs[100005];
ll arr[100005];
ll L, R;

int main() {
	scanf("%lld %lld", &N, &M);
	for(int i = 0; i < M; i++) {
		scanf("%lld %lld", &L, &R);
		arr[L]++;
		arr[R + 1]--;
	}
	ll cnt = 0;
	for(int i = 1; i <= N; i++) {
		arr[i] = arr[i - 1] + arr[i];
		if(arr[i] == M) {
			cnt++;
		}
		// printf("%lld\n", arr[i]);
	}
	printf("%lld\n", cnt);

	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

void solve(long long R, long long G, long long B, long long N){
  ll ans = 0;
  for(ll r = 0; r <= N / R; ++r){
    for(ll g = 0; g <= (N - r * R) / G; ++g){
      if((N - r * R - g * G) % B == 0){
        ++ans;
      }
    }
  }
  cout << ans << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long R;
    scanf("%lld",&R);
    long long G;
    scanf("%lld",&G);
    long long B;
    scanf("%lld",&B);
    long long N;
    scanf("%lld",&N);
    solve(R, G, B, N);
    return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n, l; cin >> n >> l;
	int t = (n * (2 * l + (n - 1))) / 2;
	debug(t);
	int i = min(n, max(1, 1 - l));
	int q1 = (l + max(1, (i - 1)) - 1);
	int q2 = (l + i - 1);
	int q3 = (l + min(n, (i + 1)) - 1);

	debug(i, q2, q2, q3);

	int min_diff = min({abs(q1), abs(q2), abs(q3)});

	if (abs(q1) == min_diff) cout << t - q1;
	else if (abs(q2) == min_diff) cout << t - q2;
	else cout << t - q3;
	return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <string>
//
const long long maxsize = 1e5 + 7, maxint = 0X3f3f3f3f, con = 21;
double error = 1e-7;
#define _USE_MATH_DEFINES
using namespace std;
//
string s;
char w='a';

/*
long long mini(long long index,long long a,long long b,long long c){
//base
if(index==3)
    return abs(a-b)+abs(a-c)+abs(b-c);
//transit
if(index==0)
    return min(mini(index+1,arr[0],b,c),min(mini(index+1,arr[0]+1,b,c),mini(index+1,arr[0]-1,b,c)));
else if(index==1)
    return min(mini(index+1,a,arr[1],c),min(mini(index+1,a,arr[1]+1,c),mini(index+1,a,arr[1]-1,c)));
else
    return min(mini(index+1,a,b,arr[2]),min(mini(index+1,a,b,arr[2]+1),mini(index+1,a,b,arr[2]-1)));
}
bool check(long long x){
    for(long long i=0;i<v.size()-1;i++){
        if(abs(v[i])>=(x)&&abs(v[i+1])>=(x))
            return 1;
    }
    return 0;
}
long long bin(){
    long long st=0,en=1e9,mid;
    while(st!=en){
        mid=(st+en+1)/2;
        if(check(mid))
            st=mid;
        else
            en=mid-1;
    }
    return st;
}

void sieve(){
primes.push_back(1);
primes.push_back(2);
for(long long i=3;i<=1e6;i+=2){
    if(!l[i]){
        primes.push_back(i);
        if(i<=sqrt(1e6)){
            for(long long u=i*2;u<=1e6;u+=i)
                l[u]=1;
        }
    }
}
}

bool isprime(long long x){
    for(long long i=2;i*i<=x;i++){
        if(x%i==0)
            return 0;
    }
    return 1;
}
long long fastpow(long long m,long long p){
    if(p==0)
        return 1;
    long long left=fastpow(m,(p/2))%con;
    if(p%2==0)
        return (left*left)%con;
    else
        return (((left*left)%con)*(m%con))%con;
}


long long fastpow(long long m,long long p){
    if(p==0)
        return 1;
    long long left=fastpow(m,(p/2))%con;
    if(p%2==0)
        return (left*left)%con;
    else
        return (((left*left)%con)*(m%con))%con;
}
*/



int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    //freopen("in", "rd", stdin);
    //freopen("out","wd",stdout);
    cin>>s;
    int st,en;
    for(st=0;s[st]!='A';st++);
    for(en=s.size()-1;s[en]!='Z';en--);
    cout<<(en-st)+1;
    return 0;
}

Measured memory_bytes: 3752
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

// 二項係数計算
long long COM(long long n, long long k){
    return n*(n-1)/2;
}

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    long long n;cin>>n;
    vector<long long>a(n);
    map<long long,long long>m;
    for(long long i=0;i<n;i++){
        cin>>a[i];
        m[a[i]]++;
    }
    long long total=0;
    for(long long i=1;i<=n;i++){
        if(m[i])total+=COM(m[i],2);
    }

    for(long long k=1;k<=n;k++){
        long long tmp=total;
        if(m[a[k-1]]>=2){
            tmp-=COM(m[a[k-1]],2);
            tmp+=COM(m[a[k-1]]-1,2);
        }
        cout<<tmp<<endl;
    }

    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------

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

#define endl '\n'
#define D(x) cout << #x << " = " << (x) << endl;
#define IO ios::sync_with_stdio(false); cin.tie(NULL);
#define H return 0;
int main() { IO
   long long int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k%2==0)
    cout<<a-b;
  else
    cout<<b-a;
  return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
typedef long long ll;
const int maxn = 1e5+10;
int n;
int a[maxn];
int main(){
	scanf("%d",&n);
	ll sum=0;
	rep(i,1,n) scanf("%d",a+i),sum+=a[i];
	if(sum%2==0)puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 640
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)

long long max(long long a,long long b){
	return (a>b)? a:b;
}
int main (){
	long long NNN,MMM,maxx=0,p=0,sum=0;
	cin >> NNN >> MMM;
	long long a[3][NNN];
	rep(i,NNN){rep(j,3){scanf("%lld",&a[j][i]);}}
	vector <long long> temp[8];
	rep(i,8){
		rep(j,NNN){
			rep(k,3)(i & (1 << k))? p += a[k][j]:p -= a[k][j];
			temp[i].push_back(p);
			p=0;
		}
		sort(temp[i].rbegin(),temp[i].rend());
		sum=0;
		rep(k,MMM)sum += temp[i][k];
		maxx = max(sum,maxx);
	}
	printf("%lld",maxx);

	return 0;
}


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

namespace AtCoders {
	class Program {
		static void Main(string[] args) {
		
	
			var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}

			var H = inputArray[0];
			var W = inputArray[1];

			var ans = getAnswer(H,W);
			Console.WriteLine(ans);

		}

		private static long getAnswer(long H, long W) {

			var masu = H * W;

			//1行のみの場合、移動できない
			if(H==1 | W == 1) {
				return 1;
			}

			//答えの出力
			if (masu % 2 == 0) {
				return masu / 2;
			}
			else {
				return ((masu / 2) + 1);
			}
		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray =  Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std; 
using ll = long long;
int val(char c){
	if(c == 'R')
		return 0;
	if(c == 'G')
		return 1;
	if(c == 'B')
		return 2;
	return -1000000;
}
signed main() { 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n; 
	cin>>n;
	string s;
	cin>>s;
	vector<vector<int>> v(3, vector<int> (n));
	v[0][0] = v[1][0] = v[2][0] = 0;
	v[val(s[0])][0]++;
	for(int i = 1; i < n; i++){
		for(int j = 0; j < 3; j++)
			v[j][i] = v[j][i-1];		
		v[val(s[i])][i]++;
	}

	ll sum = 0;
	for(int i = 2; i < n; i++){
		for(int j = 0; j < i; j++){
			if(s[i] == s[j])
				continue;
			set<int> st;
			st.insert(val(s[i]));
			st.insert(val(s[j]));
			ll tmp = 0;
			if(!st.count(0)){
				if(j > 0){
					tmp = v[0][j-1];
					int dif = i-j;
					if(j - dif >= 0 && val(s[j-dif]) == 0)
						tmp--;
				}
			}else if(!st.count(1)){
				if(j > 0){
					tmp = v[1][j-1];
					int dif = i-j;
					if(j - dif >= 0 && val(s[j-dif]) == 1)
						tmp--;
				}
			}else{
				if(j > 0){
					tmp = v[2][j-1];
					int dif = i-j;
					if(j - dif >= 0 && val(s[j-dif]) == 2)
						tmp--;
				}
			}
			sum += tmp;
		}
	}
	cout << sum;
}


Measured memory_bytes: 3684
n, m, l = map(int, input().split())
a = [[] for _ in range(n)]
b = [[] for _ in range(m)]
 
for i in range(n):
  a[i] = list(map(int, input().split()))
 
for i in range(m):
  b[i] = list(map(int, input().split()))
 
for i in range(n):
  line = []
  
  for j in range(l):
    c = 0
    
    for k in range(m):
      c += a[i][k]*b[k][j]
    
    line.append(str(c))

  print(' '.join(line))


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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> num(4);
    rep(i,m){
        int s, c;
        cin >> s >> c;
        if(s == 1 && c == 0 && n != 1){
            cout << -1 << endl;
            return 0;
        }
        if(num[s] == 0 || num[s] == c) num[s] = c;
        else{
            cout << -1 << endl;
            return 0;
        }
    }
    if(num[1] == 0 && n != 1){
        num[1] = 1;
    }
    for(int i = 1; i <= n; i++) cout << num[i];
}

Measured memory_bytes: 3616
#include <iostream>
#include <array>
using namespace std;
int N, W;
int main() {
  cin >> N >> W;
  pair<int, int> s[N];
  for (int i = 0; i < N; i++) {
    int v, w;
    cin >> v >> w;
    s[i] = make_pair(v, w);
  }
  int T[W + 1][N + 1];
  for (int i = 0; i <= N; i++) {
    for (int c = 0; c <= W; c++) {
      if ( c <= 0 || i <= 0 ) {
        T[c][i] = 0;
      } else if ( c - s[i - 1].second < 0) {
        T[c][i] = T[c][i - 1];
      } else {
        T[c][i] = max(max(s[i - 1].first + T[c - s[i - 1].second][i - 1],  T[c][i - 1]), s[i - 1].first + T[c - s[i - 1].second][i]);
      }
    }
  }
  cout << T[W][N] << endl;
}


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

int  main()
{
	int a,b; cin >> a >> b;
	if (a == 1)
		a += 13;
	if (b == 1)
		b += 13;
	if (a < b)
		cout << "Bob\n";
	else if (a > b)
		cout << "Alice\n";
	else
		cout << "Draw\n";
	return (0);
}


Measured memory_bytes: 256
x = gets.to_i
dp = Array.new(x + 1)
dp[0] = true
x.times do |i|
  if dp[i]
    (100..105).each do |j|
      if i + j <= x
        dp[i + j] = true
      end
    end
  end
end
puts dp[x] ? 1 : 0


Measured memory_bytes: 2556
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
using namespace std;
char c,ans;

int main()
{
    cin>>c;
    if (c=='A') ans='T';
    if (c=='T') ans='A';
    if (c=='C') ans='G';
    if (c=='G') ans='C';
    cout<<ans<<endl;
    return 0;
}



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

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const ll MOD = 1e9+7;
const int MAX = 1000000;
ll fac[MAX],caf[MAX]; //factorial e inverso
ll deg(ll x,ll d){
	d %= MOD - 1;
    	if(d < 0)d += MOD - 1;
    	ll y = 1;
    	while (d) {
        	if (d & 1) y *= x, y %= MOD;
        	x *= x, x %= MOD;
        	d /= 2;
    	}
    	return y;
}
ll coeff(int n,int k){
	return fac[n] * caf[k] % MOD * caf[n - k] % MOD;
}

ll get(ii a,ii b){
	int len1 = b.fi-a.fi;
	int len2 = b.se-a.se;
	return coeff(len1+len2,len1);
}
	
const int maxq = 3000+10;
ll dp[maxq];
ii A[maxq];
int N,M,Q;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	fac[0] = caf[0] = 1;
	forn(i,1,MAX)fac[i] = i * fac[i - 1] % MOD, caf[i] = deg(fac[i], -1);
	cin >> N >> M >> Q;
	forn(i,0,Q)cin >> A[i].fi >> A[i].se;
	A[Q] = {N,M};
	Q++;
	sort(A,A+Q);
	forn(i,0,Q){
		dp[i] = get({1,1},A[i]);
		forn(j,0,Q){
			if(i == j)continue;
			if(A[j].fi <= A[i].fi && A[j].se <= A[i].se){
				ll quitar = ((dp[j]%MOD)*(get(A[j],A[i])))%MOD;
				dp[i] = ((dp[i]%MOD)-(quitar%MOD))%MOD;
			}
		}
	}
	ll res = dp[Q-1];
	if(res < 0)res += MOD;
	cout << res << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 16000
S=input()

startzero=0
startone=0

for i in range(len(S)):
  if i%2==0:
    if S[i]=='0':
      startone+=1
    else:
      startzero+=1
  else:
    if S[i]=='0':
      startzero+=1
    else:
      startone+=1
  #print(i,S[i],startzero,startone)

print(min(startzero,startone))

Measured memory_bytes: 3316
N = int(input())
P = list(map(int, input().split()))
left_min = P[0]
count = 0


for i in range(len(P)):

    if left_min >= P[i]:
        left_min = P[i]

    if P[i] <= left_min:
        count += 1
        

        
print(count)

Measured memory_bytes: 24744
n,m=map(int,input().split())
x=sorted(list(map(int,input().split())))
d=[]
for i in range(m-1):
    d.append(x[i+1]-x[i])
d.sort()
if n>=m:
    print(0)
else:
    ans=0
    for i in range(m-n):
        ans+=d[i]
    print(ans)

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

pll A[100005];

int main() {
    ll N;
    cin >> N;
    ll s0 = 0, s1 = 0;
    REP(i, N) {
        cin >> A[i].first;
        s0 += A[i].first;
    }
    REP(i, N) {
        cin >> A[i].second;
        s1 += A[i].second;
    }
    if (s0 < s1) {
        cout << -1 << endl;
        return 0;
    }

    sort(A, A + N, [](pll a, pll b) { return a.first - a.second > b.first - b.second; });
    ll m = 0;
    ll ans = 0;
    REP(i, N) {
        if (A[i].first - A[i].second < 0) {
            m += A[i].second - A[i].first;
            ans++;
        }
    }

    REP(i, N) {
        if (A[i].first - A[i].second < 0)
            break;
        if (m <= 0)
            break;
        m -= A[i].first - A[i].second;
        ans++;
    }

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long llong;

int main(void) {
	int n, k; cin >> n >> k;
	vector<llong> H(n);
	for (int i = 0; i < n; i++) scanf("%lld", &H[i]);

	sort(H.begin(), H.end(), greater<llong>());

	llong ans = 0;
	for (int i = k; i < n; i++) {
		ans += H[i];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  char str[1200];
  char ch;
  int i = 0;
  while((ch = getchar()) != EOF){
    str[i] = ch;
    ++i;
  }
  int length = i;
  int temp;
  for(i = 0;i < length;++i){
    temp = (int)str[i];
    if(65 <= temp && temp <= 90){
      temp += 32;
      str[i] = (char)temp;
    }else if(97 <= temp && temp <= 122){
      temp -= 32;
      str[i] = (char)temp;
    }else{
      continue;
    }
  }
  for(i = 0;i < length;++i){
    cout << str[i];
  }
  return 0;
}


Measured memory_bytes: 3056
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int seq[1000];
int n,k;
bool flag[1000];
int c[1000][1000];


bool check(void){
  bool f = true;
  for(int i=0;i<k;i++){
    int sum = 0;
    for(int j=0;j<n/2;j++)sum += seq[c[i][j]-1];
    f &= (sum>=n/8)&&(sum<=3*n/8);
  }
  return f;
}

int main(){
  while(scanf(" %d %d ",&n,&k)!=EOF){

    for(int i=0;i<k;i++){
      for(int j=0;j<n/2;j++){
	scanf(" %d ",&c[i][j]);
      }
    }
    
    for(int i=0;i<n/2;i++)seq[i] = 1;
    for(int i=n/2;i<n;i++)seq[i] = 0;

    while(1){
      if(check())break;
      random_shuffle(seq,seq+n);
    }

    for(int i=0;i<n;i++)printf("%d",seq[i]);
    printf("\n");
  }
}

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

int main(void){

    bool flag = false;
    int A,Z;
    string s;
    cin >> s;

    rep(i,s.size()){

        if(flag == false && s[i] == 'A'){
            A = i;
            flag = true;
        }

        if(s[i] == 'Z')
            Z = i;
    }
    
    cout << Z-A+1 <<endl;
    return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	int N, ans;
	cin >> N;
	
	for (int i = 0; i < N; i++) {
		ans += i + 1;
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define MAXN 100000
#define MAXA 100000
#define MAXB 100000
int main(int argc,char const* argv[])
{
  int n,i,ans,a,b;
  long long int calc=0,k;
  vector<long long int> buckets(MAXA+1,0);
  cin >> n >> k;
  for(i=0;i<n;i++)
    {
      cin >> a >> b;
      buckets[a]+=b;
    }
  for(ans=1;ans<=MAXA;ans++)
    {
      calc+=buckets[ans];
      if(calc>=k)
	{
	  break;
	}
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
using ll = long long;

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<pair<int, int>>> G(N);
  for (int i = 0; i < M; i++) {
    int L, R, D;
    cin >> L >> R >> D;
    --L;
    --R;
    G[L].emplace_back(R, D);
    G[R].emplace_back(L, -D);
  }
  vector<int> dist(N);
  vector<bool> used(N, false);
  bool res = true;
  for (int i = 0; i < N; i++) {
    if (used[i]) {
      continue;
    }
    queue<int> q;
    q.push(i);
    used[i] = true;
    dist[i] = 0;
    while (!q.empty()) {
      int v = q.front(); q.pop();
      for (auto e: G[v]) {
        int u = e.first, d = e.second;
        if (used[u]) {
          if (dist[v] + d != dist[u]) {
            cout << "No" << endl;
            return 0;
          }
        } else {
          used[u] = true;
          dist[u] = dist[v] + d;
          q.push(u);
        }
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

int main(){
  
  int n,d;
  cin >>n>>d;
  int x[n][d];
  for(int i=0; i<n; i++){
  	for(int j=0; j<d; j++){
    	cin >> x[i][j];
    }
  }
  
  int sum=0,count=0;
  for(int i=0; i<n-1; i++){
  	for(int j=i+1; j<n; j++){
    	
    	for(int k=0;k<d; k++){
      		sum+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      	}
      //cout <<sum <<floor(sqrt(sum))<< endl;
      if(floor(sqrt(sum))*floor(sqrt(sum))==sum) count++;
      sum=0;
    }
  }

  cout << count << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;

template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 310,Lim = N * N * 2,mod = 998244353;

int a[N],dp[Lim];

inline int read() {
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-')ch = getchar();
	if(ch == '-')flag = -1,ch = getchar();
	while(isdigit(ch))x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}

inline int fpm(int a,int b) {
	int res = 1;
	while(b) {
		if(b & 1) res = 1ll * res * a % mod;
		a = 1ll * a * a % mod,b /= 2;
	}
	return res;
}

int main() {

	int n = read(),sum = 0;
	For(i,1,n) a[i] = read(),sum += a[i];
	dp[0] = 1;
	For(i,1,n) Fordown(j,sum,a[i])
		dp[j] = (dp[j] + dp[j - a[i]] * 2ll) % mod;
	int ans = fpm(3,n);
	For(i,0,sum / 2) ans = (ans - 3ll * dp[i]) % mod;
	memset(dp,0,sizeof(dp));
	dp[0] = 1;
	For(i,1,n) Fordown(j,sum,a[i])
		dp[j] = (dp[j] + dp[j - a[i]]) % mod;
	if(sum % 2 == 0) ans = (ans + dp[sum / 2] * 3ll) % mod;
	printf("%d\n",(ans + mod) % mod);

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>

using namespace std;

int main() {
	int x1, x2, x3, x4, y1, y2, y3, y4;
	cin >> x1 >> y1 >> x2 >> y2;

	x3 = x2 - (y2 - y1);
	y3 = y2 + (x2 - x1);

	x4 = x3 - (y3 - y2);
	y4 = y3 + (x3 - x2);

	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
using ll = long long;

int main(){
    int N,M;
    cin>>N>>M;
    vector<vector<int>> graph(M,vector<int>());
    vector<bool> used(M,false);
    int a;
    for(int i = 0;i < N;i++){
        int j;cin>>j;
        int last = -1;
        for(int k = 0;k<j;k++){
            int l;cin>>l;l--;
            if(last!=-1){
                graph[last].push_back(l);
                graph[l].push_back(last);
            }
            used[l] = true;
            a = l;
            last = l;
        }
    }
    queue<int> q;
    vector<bool> visited(M,false);
    q.push(a);
    while(q.size()>0){
        int point = q.front();q.pop();
        visited[point] = true;
        for(int i = 0;i < graph[point].size();i++){
            if(visited[graph[point][i]] == false){
                q.push(graph[point][i]);
            }
        }
    }
    for(int i = 0;i < M;i++){
        // cout << visited[i] << used[i] << endl;
        if(visited[i] != used[i]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

}

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

int main(void){

    int n;
    cin >> n;
    
    vector<string> s(n);
    for(int i=0; i<n; i++) cin >> s[i];
    
    long long count = 0;
    long long Acount = 0;
    long long Bcount = 0;
    long long ABcount = 0;


    for(int i=0; i<n; i++) {
        if(s[i].substr(0,1)=="B" && s[i].substr(s[i].size()-1,1)=="A") ABcount++;
        else if(s[i].substr(s[i].size()-1,1)=="A") Acount++;
        else if(s[i].substr(0,1)=="B") Bcount++;
//        int count = 0;
        int index = 0;
        while(1) {
            index = (int) s[i].find("AB", index);
            if(index == -1) break;
            index += 2;
            count++;
        }
//        counts[i] = count;
//        cout << count << " " <<  Acount << " " << Bcount << " " << ABcount << endl;
    }
    
    long long result = 0;
    
    if(Acount>0 && Bcount>0 && ABcount>0) {
        result += ABcount+1;
        Acount--;
        Bcount--;
        ABcount = 0;
    }
    else if(Acount>0 && ABcount>0) {
        result += ABcount;
        Acount--;
        ABcount = 0;
    }
    else if(Bcount>0 && ABcount>0) {
        result += ABcount;
        Bcount--;
        ABcount = 0;
    }
    else if(ABcount>0) {
        result += ABcount-1;
        ABcount = 0;
    }

    if(Acount>=Bcount) {
        result += Bcount;
    }
    else {
        result += Acount;
    }
    
    result += count;
    
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 768
def solve():
	seq1 = raw_input()
	seq2 = raw_input()

	a, b = len(seq1), len(seq2)
	x1 = [0 for i in range(b+1)]
	for i in range(a):
		e1 = seq1[i]
		x2 = x1+[]
		for j in range(b):
			if e1 == seq2[j]:
				x1[j+1] = x2[j] + 1
			elif x1[j+1] < x1[j]:
				x1[j+1] = x1[j]
	return x1[-1]

n = input()
for i2 in range(n):
	print solve()

Measured memory_bytes: 4320
//
//  main.cpp
//  Problem Code
//
//  Created by Algo张伯威 on 2020/4/24.
//  Copyright © 2020 Algo张伯威. All rights reserved.
//

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <iostream>
using namespace std;

const int mod = 2019;

char p[200010];
int a[200010], b[200010], s[200010];

int main() {
    int n;
    scanf("%s", p + 1);
    n = strlen(p + 1);
    int c = 1, now = 0;
    long long ans = 0;
    for(int i = 1; i <= n; i++) a[i] = p[i] - '0';
    s[0] = 1;
    for(int i = n; i >= 1; i--) {
        now += a[i] * c;
        c *= 10;
        now %= mod;
        c %= mod;
        ans += s[now];
        //if(s[now] > 0) printf("%d\n", i);
        s[now]++;
    }
    printf("%lld\n", ans);
    
    return 0;
}
























Measured memory_bytes: 4740
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <memory.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    int Q;
    string X, Y;
    cin >> Q;
    for (int q = 0; q < Q; ++q) {
        cin >> X >> Y;
        int DP[1001][1001];
        memset(DP, 0, sizeof(DP));
        for (int sx = 1; sx <= X.size(); ++sx) {
            for (int sy = 1; sy <= Y.size(); ++sy) {
                DP[sx][sy] = max(DP[sx-1][sy], DP[sx][sy-1]);
                if (X[sx-1] == Y[sy-1]) {
                    DP[sx][sy] = max(DP[sx][sy], DP[sx-1][sy-1]+1);
                }
            }
        }
        cout << DP[X.size()][Y.size()] << endl;
    }
    return 0;
}



Measured memory_bytes: 7096
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define fast ios_base::sync_with_stdio(false),cin.tie(nullptr)
#define pi 3.14159265358979323846264338327950L
#define modd 1000000000
#define k 100000000
int main()
{
        int t=1;
        //cin>>t;
        while(t--)
        {
                ll x,amount=100;
                cin>>x;

                for(int i=1; ;i++)
                {
                        amount+=(amount/100);
                        if(amount>=x)
                        {
                                cout<<i<<endl;
                                break;
                        }
                }
        }

}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n; cin >> n;
  for(int i = 1; i <= 100; ++i) {
    if(1000*i >= n) {
      cout << 1000*i-n << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3572
#include <iostream>
#include <stdio.h>
//#include <string.h>

using namespace std;

int main(){
    int input;
    scanf("%d",&input);

    int a = (input/500)*1000;
    int b = (input%500) / 5 *5;
    cout << a+b << endl;

    return 0;
}

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

using namespace std;

int main(){
    string a, b;
    cin>>a>>b;
    int lcs[a.size()+1][b.size()+1];
    for(int i=0;i<=a.size();i++){
        lcs[i][0]=0;
    }
    for(int i=0;i<=b.size();i++){
        lcs[0][i]=0;
    }
    for(int i=1;i<=a.size();i++){
        for(int j=1;j<=b.size();j++){
            if(a[i-1]==b[j-1])lcs[i][j]=lcs[i-1][j-1]+1;
            else lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
        }
    }
    string lcss="";
    /*for(int i=0;i<=a.size();i++){
    	for(int j=0;j<=b.size();j++){
    		cout<<lcs[i][j]<<" ";
		}
		cout<<endl;
	}*/
    for(int i=a.size(),j=b.size();i>0&&j>0;){
        if(lcs[i-1][j-1]==lcs[i-1][j]&&lcs[i-1][j-1]==lcs[i][j-1]&&lcs[i][j]>lcs[i-1][j-1]){
            lcss+=a[i-1];
            i--;j--;
        }
        else if(lcs[i-1][j]>lcs[i][j-1])i--;
        else j--;
    }
    for(int i=lcss.size()-1;i>=0;i--){
    	cout<<lcss[i];
	}
	cout<<endl;
}

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

using namespace std;

#define sz			size()
#define lgt			length()
#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()
#define pb			push_back
#define SORT(a)		sort(ALL(a));
#define RSORT(a)	sort(RALL(a));
#define mp			make_pair
#define dump(x)		cerr<<#x<<" = "<<(x)<<endl;
#define fir			first
#define sec			second

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<string> vs;

int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
vs form(string a,char s){vs v;string b;rep(i,a.lgt){if(a[i]==s){v.pb(b);b="";}else b+=a[i];}v.pb(b);return v;}
vi formint(string a,char s){vi v;string b;rep(i,a.lgt){if(a[i]==s){v.pb(toInt(b));b="";}else b+=a[i];}v.pb(toInt(b));return v;}

const double EPS=1e-10,PI=acos(-1.0);
const int INF=2100000000;

int field[1024];

int main(void)
{
	int n, m, tmp;
	while (cin >> n >> m, n && m){
		for (int i = 1; i <= n; i++) cin >> field[i];
		int now = 1, res = 0;
		bool flag = false;
		
		for (int i = 0; i < m; i++){
			cin >> tmp;
			if (!flag) res++;
			if (!flag) now += tmp;
			if (n <= now) flag = true;
			if (!flag) now += field[now];
			if (n <= now) flag = true;
			if (now < 1) now = 1;
		}
		
		cout << res << endl;
	}
	
	return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    char a, b;
    cin >> a >> b;

    if(a == b){
        cout << 'H' << endl;
    }
    else{
        cout << 'D' << endl;
    }

    return 0;
}

Measured memory_bytes: 3592
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    String S = sc.next();
    int[] val = new int[26];
    for(int i = 0; i < N; i++){
      int n = S.charAt(i)-'a';
      val[n]++;
    }
    
    int mod = 1000000007;
    long ans = 1;
    for(int i = 0; i < 26; i++){
      ans *= val[i]+1;
      ans %= mod;
    }
    
    System.out.println(ans-1);
  }
}

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



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;

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




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

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;






void printv(vint &V){
  for(auto e:V)cout<<e<<" ";
  cout<<endl;
}

vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}

vector< int > prime_numbers;






int main() {


  cout<<fixed<<setprecision(10);

  ll a,b,c; cin>>a>>b>>c;
  ll x = c - a - b;

  if( x < 0){ puts("No"); return 0;}

  if(4*a*b < x*x) puts("Yes");
  else puts("No");

}

//


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define ll long long
using namespace std;

struct _in {
	const _in operator , (int &a) const {
		a = 0; char k = getchar (); int f = 1;
		while (k > '9' || k < '0') { if (k == '-') f = -1; k = getchar (); }
		while (k >= '0' && k <= '9') { a = a * 10 + k - '0'; k = getchar (); }
		a *= f;
		return*this;
	}
}in;

//const int N = ;
/*const int mod = ;
inline int add (int u, int v) { return u + v >= mod ? u + v - mod : u + v; }
inline int sub (int u, int v) { return u - v < 0 ? u - v + mod : u - v; }
inline int mul (int u, int v) { return 1LL * u * v % mod; }
inline int qpow (int base, int v) {
	int tot = 1;
	while (v) {
		if (v & 1) tot = mul (tot, base);
		base = mul (base, base);
		v >>= 1;
	}
	return tot;
}*/

int main () {
	char tmp[200];
	scanf ("%s", tmp + 1);
	int n = strlen (tmp + 1);
	for (int i = 1; i <= n; i += 2) {
		if (tmp[i] == 'L') {
			printf ("No\n");
			return 0;
		}
	}
	for (int i = 2; i <= n; i += 2) {
		if (tmp[i] == 'R') {
			printf ("No\n");
			return 0;
		}
	}
	printf ("Yes\n");
	return 0;
}






























Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <map>

using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("aa_input.txt", "r", stdin);
    int t=1;
    //cin>>t;
    while (t--)
    {
        int n;
        cin>>n;
        set<string> s;

        for(int i=1; i<=n; i++){
            string str;
            cin>>str;
            s.insert(str);
        }
        cout<<s.size()<<endl;

    }
    
    return 0;
}
/*

riaadmorshed@gmail.com

*/

Measured memory_bytes: 19276