akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb           push_back
#define pii          pair<int,int>
#define vi           vector<int>
#define vpii         vector<pair<int,int>>
#define gph          map<int, vector<int>>
#define mp           make_pair
#define FOR(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD0(i, n) for (int i = (int)n; i >= 0; i--)
#define FORD1(i, n) for (int i = (int)n; i >= 1; i--)
#define FORS(i, n) for(; i < (int)(n); i++)
#define debug(X) { cout << #X << " = " << (X) << endl; }
#define printArr(A,n) { cout << #A << " = "; FOR(i,n) cout << A[i] << ' '; cout << endl; }
using namespace std;
#define int long long int
set<int> adjList[(int)2e5];
vector<pii> edges;
vi deg;
queue<int> q;
vector<bool> vis;
void dfs(int cur,int P){
    vis[cur] = true;
    for(int child:adjList[cur]){
        if(vis[child] && child != P){
            edges.pb(mp(cur, child));
            deg[cur]++;
        }
    }
   for(int child: adjList[cur]){
        if(!vis[child]){
            dfs(child, cur);
        }
    }
   if(cur == 0)return;
   if(deg[cur] & 1)edges.pb(mp(cur, P));
   else edges.pb(mp(P, cur)), deg[P]++;
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n, m;cin >> n >> m;
    deg.resize(n);
    vis.resize(n);
    if(m & 1){
        cout << -1;
        return 0;
    } 
    int a, b;
    FOR(i, m){
        cin >> a >> b;
        a-- ,b--;
        adjList[a].insert(b);
        adjList[b].insert(a);
    }
    dfs(0, -1);
    assert(edges.size() == m);
//     debug(edges.size());
    for(pii e: edges)cout << e.first + 1 << " " << e.second + 1 <<endl;
}




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

Measured memory_bytes: 3568
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/operators.hpp>
#include <boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

void Main()
{
	int K, X;
	std::cin >> K >> X;
	std::cout << (X <= 500 * K ? "Yes" : "No") << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll  long long
#define INF (ll)1e18 + 50
#define MAXN (int)1e5 + 50
#define fi first
#define se second
#define MOD 1000000007
#define all(v)((v).begin()), ((v).end())
#define A 911382323
#define B 972663749

vector<int> vec;

int main() {
    int n, a; cin >> n;
    
    for(int i = 0; i < n; i++) cin >> a, vec.pb(a);
	
	int after = 0;
	for(int i = 0; i < n; i++)
	{
		if(vec[i] == after+1) after++;
	}
	if(after == 0) puts("-1");
	else cout << n - after;
	


    return 0;
}

Measured memory_bytes: 1400
#include <stdio.h>

int isContain(int w, int h, int x, int y, int r);

int
main(void)
{
  int w, h, x, y, r;
  scanf("%d%d%d%d%d", &w, &h, &x, &y, &r);
  if (isContain(w, h, x, y, r) == 1) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}

int
isContain(int w, int h, int x, int y, int r)
{
  int min_x, max_x, min_y, max_y;
  min_x = r;
  max_x = w - r;
  min_y = r;
  max_y = h - r;
  if (min_x <= x && x <= max_x && min_y <= y && y <= max_y) {
    return 1;
  } else {
    return 0;
  }
}

Measured memory_bytes: 1712
#include<bits/stdc++.h>
#define pa pair<int,int>
#define CLR(a,x) memset(a,x,sizeof(a))
#define MP make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long double ld;
const int maxn=1e6+10;

inline char gc(){
	return getchar();
	static const int maxs=1<<16;static char buf[maxs],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,maxs,stdin),p1==p2)?EOF:*p1++;
}
inline ll rd(){
    ll x=0;char c=gc();bool neg=0;
    while(c<'0'||c>'9'){if(c=='-') neg=1;c=gc();}
    while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+c-'0',c=gc();
    return neg?(~x+1):x;
}

char s[maxn];

int main(){
    //freopen("","r",stdin);
    scanf("%s",s+1);
    bool bl=0;
    for(int i=1;i<strlen(s+1);i++) bl|=(s[i]==s[i+1]);
    if(bl) puts("Bad");
	else puts("Good");
    return 0;
}

Measured memory_bytes: 256
arr = list(input())
tmp1 = arr[0]
tmp2 = arr[1]

i = 2
flg = True
if (tmp1 != tmp2):
    while i < len(arr):
        tmp3 = arr[i]
        if (tmp3 == tmp2):
            print(str(i) + " " + str(i + 1))
            flg = False
            break
        if (tmp3 == tmp1):
            print(str(i - 1) + " " + str(i + 1))
            flg = False
            break

        tmp1 = arr[i - 1]
        tmp2 = arr[i]
        i = i + 1
else:
    print("1 2")
    flg = False

if (flg):
    print("-1 -1")

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

int main () {
  string s;
  cin >> s;

  bool good = true;
  rep(i,s.size()) {
    if (i%2==0) {
      if (!(s[i]=='R'||s[i]=='U'||s[i]=='D')) good = false;
    }
    else {
      if (!(s[i]=='L'||s[i]=='U'||s[i]=='D')) good = false;
    }
  }

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

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAX_C 1000000001

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

  n %= k;
  ll ns = n - k;
  if (n <= -ns) cout << n << endl;
  else cout << -ns << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
vector<ll> find_divisor(ll N){
  ll k=1;
  while(k*k<=N){
    k++;
  }
  vector<ll> A(1);
  rep(i,k){
    if(i==1)A.at(0)=1;
    else if(i>=2){
      if(N%i==0)A.push_back(i);
    }
  }
  ll t=0;
  t=A.size();
  rep(i,t){
    if(A.at(t-i-1)*A.at(t-i-1)!=N)A.push_back(N/A.at(t-1-i));
  }
  return A;
}
int main()
{
  ll N,M,C;
  cin>>N>>M>>C;
  vector<ll> B(M);
  vector<ll> A(M);
  ll ans=0;
  ll sum=C;
  rep(i,M){
    cin>>B.at(i);
  }
  rep(i,N){
    rep(j,M){
      cin>>A.at(j);
      sum+=A.at(j)*B.at(j);
    }
    if(sum>0)ans++;
    sum=C;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
# define rep(i,a,n) for (int i=a; i<=n; ++i)
# define per(i,a,n) for (int i=a; i>=n; --i)
# define bug puts("H");
# define pb push_back
# define mp make_pair
# define all(x) (x).begin(), (x).end()
# define SZ(x) (int)x.size()
# define fi first
# define se second
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mem(a,b) memset(a,b,sizeof(a))
# define INF 1000000001
# define MOD (1ll<<32)
typedef vector<int> Vi;
typedef long long i64;
typedef pair<int, int> Pi;
mt19937 mrand(random_device{}());
int rnd(int x) {return mrand()%x;}
i64 powmod(i64 a, i64 b){i64 res=1;a%=MOD;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
i64 Inv(i64 b){return powmod(b,(i64)MOD-2);}
const int N = 100005;
const double eps = 1e-9;
const long long inf = 1e18;


int main()
{
    int n;
    cin >> n;
    rep(i,1,n) cout << "ACL";
    cout << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
template< typename T >
T mod_pow(T x, T n, const T &p) {
  if(x < 0) return 0;
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template<typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template<typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for(int i=0;i<((int)(v.size()));++i) {
    if (i) os << " ";
    os << v[i];
  }
  return os;
}
const int ma = 2001;
int n = 0;
ll a[ma];
ll b[ma];
ll res[ma];
void mul(ll a[ma], ll b[ma]) {
  for(int i=0;i<(n);++i) {
    for(int j=0;j<(n);++j) {
      if(i - j < 0) break;
      res[i] += a[i-j] * b[j] % MOD;
      res[i] %= MOD;
    }
  }
  for(int i=0;i<(n);++i) {
    a[i] = res[i];
  }
  memset(res, 0, sizeof(res));
}
bool solve() {
  ll d, x;
  cin >> n >> d >> x;
  if (n == 0) return false;
  n++;
  for(int i=0;i<(min(x, (ll)n));++i) a[i] = 1;
  b[0] = 1;
  while (d) {
    if (d & 1) {
      mul(b, a);
    }
    mul(a, a);
    d >>= 1;
  }
  cout << b[n - 1] << endl;
  return true;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  do {
    for(int i=0;i<(n);++i) {
      memset(a, 0, sizeof(a));
      memset(b, 0, sizeof(b));
    }
  } while(solve());
}



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

int main() {
	int n;
	cin >> n;
	deque<int> a, b;
	for (size_t i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		if (x >= 0) a.push_back(x);
		else b.push_back(x);
	}

	// 正も負もある
	if (a.size() != 0 && b.size() != 0) {
		int ans = 0;
		for (auto e : a) ans += e;
		for (auto e : b) ans -= e;
		cout << ans << endl;

		while (a.size() > 1) {
			cout << b[0] << " " << a[0] << endl;
			b[0] -= a[0];
			a.pop_front();
		}

		while (b.size() > 1) {
			cout << a[0] << " " << b[0] << endl;
			a[0] -= b[0];
			b.pop_front();
		}
		cout << a[0] << " " << b[0] << endl;
		assert(ans == a[0] - b[0]);
		assert(a.size() == 1 || b.size() == 1);
	}
	// 正しかない
	else if (a.size() != 0)
	{
		int ans = 0;
		sort(a.begin(), a.end());
		for (auto e : a) ans += e;
		ans -= a[0] * 2;
		cout << ans << endl;
		
		if (a.size() > 2) {
			cout << a[0] << " " << a[1] << endl;
			int x = a[0] - a[1];
			a.pop_front();
			a.pop_front();

			while (a.size() > 1) {
				cout << x << " " << a[0] << endl;
				x -= a[0];
				a.pop_front();
			}
			cout << a[0] << " " << x << endl;
			assert(ans == a[0] - x);
			assert(a.size() == 1);
		}
		else
		{
			cout << a[1] << " " << a[0] << endl;
			assert(ans == a[1] - a[0]);
			assert(a.size() == 2);
		}
	}
	// 負しかない
	else
	{
		int ans = 0;
		sort(b.begin(), b.end(), greater<int>());
		for (auto e : b) ans -= e;
		ans += b[0] * 2;
		cout << ans << endl;

		if (b.size() > 2) {
			cout << b[0] << " " << b[1] << endl;
			int x = b[0] - b[1];
			b.pop_front();
			b.pop_front();

			while (b.size() > 1) {
				cout << x << " " << b[0] << endl;
				x -= b[0];
				b.pop_front();
			}
			cout << x << " " << b[0] << endl;
			assert(ans == x - b[0]);
			assert(b.size() == 1);
		}
		else
		{
			cout << b[0] << " " << b[1] << endl;
			assert(ans == b[0] - b[1]);
			assert(b.size() == 2);
		}
	}

	return 0;
}

Measured memory_bytes: 2304
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x) do{rep(__i,(x).size()) pri(x,__i);}while(0)
#define pran(x,n) do{rep(__i,n) pri(x,__i);}while(0)
#define pral(x) do{cerr << (#x) << " =";rep(__i,(x).size()) cerr<<" "<<(x[__i]);cerr<<endl;}while(0)
#define prar(x,b,e) do{repr(__i,b,e) pri(x,__i);}while(0)

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

ll MOD = 1000000007;

function<void(int,int)> tensi_no_3p=[&](int v,int d){
};

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

ll N, C;
ll solve(vector<pair<ll, ll> > &data) {
	vector<ll> hoge(N + 2);
	ll temp = 0;
	rep(i, N + 1) {
		temp += data[i + 1].second + data[i].first - data[i + 1].first;
		hoge[i + 1] = temp;
	}
	temp = 0;
	repr(i, 1, N + 1) {
		hoge[i] = max(hoge[i], hoge[i - 1]);
	}
	pra(hoge);
	temp = 0;
	ll ans = hoge[N + 1];
	for (int i = N; i >= 1; i--) {
		temp += data[i].second + data[i].first - data[i + 1].first;
		CHMAX(ans, hoge[i - 1] + temp - C + data[i].first);
	}
	return ans;
}

int main() {
	cin >> N >> C;
	vector<pair<ll, ll> > data(N + 2);
	data[0] = mp<ll>(0, 0);
	rep(i, N) cin >> data[i + 1].first >> data[i + 1].second;
	data[N + 1] = mp<ll>((ll)C, 0);
	
	ll ans = 0;
	CHMAX(ans, solve(data));
	reverse(data.begin(), data.end());
	rep(i, N + 2) data[i].first = C - data[i].first;
	CHMAX(ans, solve(data));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2688
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <list>
#include <numeric>
using namespace std;
 
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
#define pb push_back
 
int INF = INT_MAX / 10;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int pow_mod(ll x, ll n, int M) {
	ll ans = 1;
	for (; n; n>>=1) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
	}
	return ans;
}

ll inv_mod(int x, int p) {
	return pow_mod(x, p - 2, p);
}

struct bit {
	vector<ll> v;
	bit(int n) : v(n + 1) {}
	ll sum(int i) {
		ll res = 0;
		for (; i > 0; i -= i & -i) res += v[i];
		return res;
	}
	void add(int i, ll x) {
		for (i++; i < v.size(); i += i & -i) v[i] += x;
	}
};

int main() {
	int N; cin >> N;
	vector<int> a(N);
	rep(i, N) {
		scanf("%d", &a[i]);
		a[i]--;
	}
	reverse(a.begin(), a.end());
	bit unko(N), unko2(N);
	rep(i, N) if (a[i] != -1) unko.add(a[i], 1);
	rep(i, N) if (unko.sum(i + 1) - unko.sum(i) == 0) unko2.add(i, 1);
	int kakutei = unko.sum(N), mikakutei = unko2.sum(N);
	int hatena = 0;
	ll hoge = 0, fact = 1, ans = 0;
	bit b(N);
	rep(i, N) {
		int x = a[i];
		ll z = 0;
		if (x == -1) {
			z = (hatena * inv_mod(2, MOD) + hoge) % MOD;
			hatena++;
		}
		else {
			hoge = (hoge + (unko2.sum(N) - unko2.sum(x)) * inv_mod(mikakutei, MOD)) % MOD;
			z = (b.sum(x) + unko2.sum(x) * inv_mod(mikakutei, MOD) % MOD * hatena) % MOD;
			b.add(x, 1);
		}
		ans = (ans + z * fact) % MOD;
		fact = fact * (i + 1) % MOD;
	}
	ans = (ans + 1) % MOD;
	for (int i = 1; i <= mikakutei; i++)
		ans = ans * i % MOD;
	ans = (ans + MOD) % MOD;
	cout << ans << endl;
}


Measured memory_bytes: 13952
import decimal

a, b = input().split()
a = int(a)
b = str(b).replace('.', '')

r = a*int(b[0])

if a >= 10 and len(b) > 1:
    r += decimal.Decimal(a * int(b[1])/10)

if a >= 100 and len(b) > 2:
    r += decimal.Decimal(a * int(b[2])/100)

print(int(r))


Measured memory_bytes: 9944
require 'pp'

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end

K, A, B = gets_i_list

y = 0
bc = 1
# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を1円に交換する
# 1円をビスケットB枚に交換する
diff = B - A
if diff <= 2
  puts K + 1
else
  k_count = K - A + 1
  ab_count = (k_count.to_f / 2).floor
  remain_count = k_count - ab_count * 2
  bc = A + (B - A) * ab_count + remain_count
  puts bc
end


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 9223372036854775807;
const int MOD = 1000000007;

int main(){
	int n,T;
	std::cin >> n>>T;
	std::vector<int> c(n),t(n);
	rep(i,n)std::cin >> c[i]>>t[i];
	std::vector<int> ans;
	rep(i,n)if(t[i]<=T)ans.push_back(c[i]);
	sort(all(ans));
	if(ans.size()==0)std::cout << "TLE" << std::endl;
	else std::cout << ans[0] << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int p1, p2, p3, j1, j2, min, sum = 0;
  cin >> p1 >> p2 >> p3;
  min = (p1 <= p2 ? p1 : p2);
  sum += (min <= p3 ? min : p3);
  cin >> j1 >> j2;
  sum += (j1 <= j2 ? j1 : j2) - 50;
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
int main(){
	int n;
	cin>>n;
	long long now=0;
	rep(i,n){
		int a,b;
		char c;
		cin>>a>>c>>b;
		if(c=='(') now+=b;
		else now-=b;
		if(now==0) puts("Yes");
		else puts("No");
	}
}

Measured memory_bytes: 1116
#include <bits/stdc++.h>
#define int long long 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define re(x) cout<<(#x)<<" is "<<(x)<<"\n"; 
#define gif(a,b) ((a)/(b)+((a)%(b)?1:0))
using namespace std;

int32_t main()
{
	IOS
	int T = 1; 
	  
	for (int t = 0; t < T; ++t)
	{
		string s;
		cin >> s;
		if(s[s.length() - 1] != 's')
			cout << s + 's';
		else
			cout << s + "es";

		

	}
	return 0;
}
//if not working? go ahead.


Measured memory_bytes: 3664
/**
 *   author: Shubham Srivastava
 *   created: 27 January 2020  12:50:58
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define MOD 1000000007
#define INF 0x7fffffff
#define sorti(v) sort(v.begin(),v.end())
#define sortd(v) sort(v.rbegin(),v.rend())
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
ll parent[2000005];

double helper(vector <double> &p, int h, int ind, vector <vector <double> > &dp){
	if(ind == p.size()){
		if(h > p.size()/2)
			return 1.0;
		return 0.0;
	}
	if(dp[ind][h] != -1.0)
	 	return dp[ind][h];
	double a = (p[ind]*helper(p,h+1,ind+1,dp));
	double b = (1.0-p[ind])*helper(p,h,ind+1,dp);
	return dp[ind][h] = a+b;
}

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll n;cin>>n;
    vector <double> p(n);
    vector <vector <double > > dp(n,vector <double> (n,-1.0));
    for(int i=0;i<n;i++)
    	cin>>p[i];
    cout<<fixed<<setprecision(10)<<helper(p,0,0,dp);
return 0;
}

Measured memory_bytes: 70912
import math


# 条件式「condition」を満たす引数tの中で
# 最小となるtを出力
class binarySearch:
    # 添え字「t」によってソート済みリストを二分探索
    def __init__(self, limit):
        self.limit = limit  # 上限
        self.t = 0

    # 問題によってここを書き換える
    def condition(self, h, a, b):
        if self.t < 0:
            return False
        count = 0
        for i in range(len(h)):
            if h[i] > b * self.t:
                count += math.ceil((h[i] - b * self.t) / (a - b))
        if count > self.t:
            return False
        else:
            return True

    def search(self, h, a, b):
        low = 0
        high = self.limit
        self.t = int((low + high) / 2)
        while high >= low:
            out = self.condition(h, a, b)
            if not out:
                low = self.t + 1
            else:
                high = self.t - 1
            self.t = int((low + high) / 2)
        return self.t + 1


n, a, b = [int(i) for i in input().split()]
h = [0 for _ in range(n)]
for i in range(n):
    h[i] = int(input())
binary = binarySearch(limit=math.ceil(max(h) / 1))
print(binary.search(h, a, b))


Measured memory_bytes: 7084
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  vector<string> W(50,string(100,'.')),B(50,string(100,'#'));
  pair<int,int> p=make_pair(0,0);
  auto inc=[&p](){
    p.second+=2;
    if(p.second>=100){
      p.first+=2;
      p.second=0;
    }
  };
  while((a--)-1){
    B[p.first][p.second]='.';
    inc();
  }
  p=make_pair(0,0);
  while((b--)-1){
    W[p.first][p.second]='#';
    inc();
  }
  cout<<"100 100\n";
  for(int i=0;i<50;++i)cout<<W[i]<<"\n";
  for(int i=0;i<50;++i)cout<<B[49-i]<<"\n";
  return 0;
}

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

#define fi first
#define se second
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );

const long long N = 100100;
const long long Q = 100000001;
const long long mod = 1e9 + 7;
const long long MAGIC = 30;

using namespace std;

int a, b, c, x, y;

void solve()
{
        cin >> a >> b >> c >> x >> y;
        int ans = min(x, y) * min(a + b, c + c);
        if(x > y){
                ans += (x - y) * min(a, c + c);
        }
        if(y > x){
                ans += (y - x) * min(b, c + c);
        }
        cout << ans << "\n";
}

bool mtest = false; int main()
{
        //fin("input.txt");
        //fout("output.txt");
        //fin("maze.in");
        //fout("maze.out");
        ios_base::sync_with_stdio(0);
        int TE = 1;
        if(mtest)
                cin >> TE;
        while(TE--)
                solve();
        return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    long long n,ans=0;
    cin>>n;
    vector<long long> a(n);
    for(long long i=0;i<n;i++){
        cin>>a[i];
        while(a[i]%2==0){
            ans++;
            a[i]/=2;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define mod 1000000007

using namespace std;
class CompareFirst
{
public:
  bool operator()(pair<int,int> n1,pair<int,int> n2) {
    return n1.first>n2.first; //>:desc <:asc
  }
};


int main(){

  string s;
  int n,k,a;
  long long q;
  vector<string> vs;
  vector<int> vi;
  pair<int,int> pr;
  //unordered_map<string,int> mp;
  //priority_queue<int> pq; // default ‘å‚«‚¢‡
  //priority_queue<pair<int,int>,vector<pair<int,int>>,CompareFirst> pq;

  cin >> n >> k >> q;
  vector<int> score(n);
  rep(i,0,n-1)score[i]=0;
  
  if(k > q){
    rep(i,0,n-1)cout << "Yes" << endl;
    return 0;
  }
  rep(i,0,q-1){
    cin >> a;
    --a;
  //  cout << a << endl;
    score[a]++;
  }
  rep(i,0,n-1){
    if(k-q+score[i] > 0)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
//  printf("%.10f\n",ans);
//  cout << ans << endl;
  return 0;

}

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

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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int square1, square2 = 0;
    square1 = A * B;
    square2 = C * D;

    if (square1 > square2) {
        cout << square1 << endl;
    } else if (square1 < square2)
    {
        cout << square2 << endl;
    } else
    {
        cout << square1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3564
n = int(input())
a = list(map(int, input().split()))

def check(num1,num2):
    return (num1+num2) == (num1^num2)

ans=0
r=0
now=0
for l in range(n):
    while r < n and check(now,a[r]):
        now+=a[r]
        r+=1

    ans+=r-l
    if l==r:
        r+=1
    else:
        now-=a[l]
print(ans)

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

int main(void){
    long int n = 0, ac = 0, wa = 0, tle = 0, re = 0;
    char s[4];

    scanf("%ld", &n);
    for(long int i = 0; i < n; i++){
        scanf("%s", s);
        if(s[0] == 'A'){
            ac++;
        }else if(s[0] == 'W'){
            wa++;
        }else if(s[0] == 'T'){
            tle++;
        }else if(s[0] == 'R'){
            re++;
        }
    }

    printf("AC x %ld\n", ac);
    printf("WA x %ld\n", wa);
    printf("TLE x %ld\n", tle);
    printf("RE x %ld\n", re);

    return 0;

} 


Measured memory_bytes: 3828
#include <iostream>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
//const int MAX=;

int main(){
	int N;
	cin>>N;
	if(N==1||N==2||N==3||N==5||N==6||N==9||N==10||N==13||N==14||N==17)cout<<"No";
	else cout<<"Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
    int N, K, R, S, P;
    string T;
    cin >> N >> K >> R >> S >> P >> T;
    vector<bool> isu(N, false);
    static int rcnt, scnt, pcnt;
    for (int i = 0; i < N; ++i) {
        if (isu[i])
            continue;
        isu[i] = true;
        if (i + K < N && T[i] == T[i + K])
            isu[i + K] = true;
        if (T[i] == 'r')
            pcnt++;
        if (T[i] == 's')
            rcnt++;
        if (T[i] == 'p')
            scnt++;
    }
    cout << rcnt * R + scnt * S + pcnt * P << endl;
    return 0;
}


Measured memory_bytes: 512
//#include "stdafx.h"
#include <stdio.h>
#include <math.h>

int main()
{
    int num,n=1000000,i,p,j,judge=0,a[200000];
		p=1;//i=2,p++
		a[1]=2;
		for (i=2;i<=n;i++)
		{
			judge=0;
			for (j=1;j<=p;j++)
			{
				if (i%a[j]==0){
					judge=1;
					break;}
				if (j>=12){
				if (37*a[j]>i)
					break;}
			}
			if (judge==0){
				p++;
				a[p]=i;
			}
		}
	while(scanf("%d",&num)!=EOF)
	{
		for (i=1;i<=p;i++)
		{
			judge=0;
			if (a[i]>num)
				{judge=1;
			break;}
		}
		if (judge==1)
			printf("%d\n",i-1);
		else
			printf("%d\n",p);
	}
	return 0;
}

Measured memory_bytes: 908
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 200005
vector<ll> adj[N];
ll n;
vector<ll> s;

ll dfs(ll root,ll p) 
{ 
    s.push_back(root); 
    if (adj[root].size() == 0) 
        return root; 
  
    for (ll i = 0; i < adj[root].size(); i++) { 
    	if (adj[root][i]==p)
    		continue;
        ll temp = dfs(adj[root][i],root); 
        s.push_back(temp); 
    } 
    return root; 
} 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll q;
	cin>>n>>q;
	ll m=n-1,a,b;
	while(m--)
	{
		cin>>a>>b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	dfs(1,0);
	s.push_back(1);
	map<ll,vector<ll> > pam;
	for(ll i=0;i<s.size();i++)
	{
		pam[s[i]].push_back(i);
	}
	ll sz=s.size();
	ll pre[sz+5];
	memset(pre,0,sizeof(pre));
	while(q--)
	{
		cin>>a>>b;
		//cout<<pam[a][0]<<" "<<pam[a][1]<<endl;
		pre[pam[a][0]]+=b;
		pre[pam[a][1]+1]-=b;
	}
	for(ll i=1;i<sz;i++)
	{
		pre[i]+=pre[i-1];
	}
	ll ans[n+5];
	for(ll i=0;i<sz;i++)
	{
		ans[s[i]]=pre[i];
	}
	for(ll i=1;i<=n;i++)
		cout<<ans[i]<<" ";
	

}

Measured memory_bytes: 51568
#include <iostream>

int main() {
    int n ;
    std::cin >> n ;
    for( int i = 1 ; i <= n ; i++ ) {
        int x = i ;
        if( x % 3 == 0 ) {
            std::cout << " " << i ;
            continue ;
        }
        do {
            if( x % 10 == 3 ) {
                std::cout << " " << i ;
                break ;
            }
        } while( x /= 10 ) ;
    }
    std::cout << std::endl ;
}




Measured memory_bytes: 3120
#include <iostream>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
	LL N,K;
	cin>>N>>K;
	LL X;
	if (N>=K){
		X=N%K;
		if (X>0){
			while (2*X>K){
				X-=K;
				if (X<0){
					X=-X;
				}
			}
		}
	}else{
		X=N%K;
		while (2*X>K){
			X-=K;
			if (X<0){
				X=-X;
			}
		} 
	}
	cout<<X<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
*/
using namespace std;
 
#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()
#define fi first
#define se second
const LL MOD = 1000000000 + 7;
const LD EPS = 0.0000001 ;
#define MPP(a, b, c) MP(MP(a, b), c)
#define PII pair<pair<LL,LL>, LL>
 
LL pows(LL a, LL b)
{
	if (b == 0) return 1LL;
	LL temp = pows(a, b / 2);
	temp = (temp * temp) % MOD;
	if (b % 2) temp = (temp * a) % MOD;
	return temp;
}

string s, t;

const int N = 3001;

LL dp[N][N];

LL solve(int n, int m)
{
	if (n < 0 || m < 0) return 0;
	LL &ans = dp[n][m];
	if (ans != -1) return ans;
	if (s[n] == t[m]){
		ans = 1 + solve(n - 1, m - 1);
	} else {
		ans = max(solve(n - 1, m), solve(n, m - 1));
	}
	return ans;
}

vector<char> ans;

void trace(int n, int m, int left)
{
	if (left == 0) return ;
	if (s[n] == t[m]){
		ans.PB(s[n]);
		trace(n - 1, m - 1, left - 1);
		return ;
	}
	if (solve(n - 1, m) > solve(n, m - 1)){
		trace(n - 1, m, left);
	} else {
		trace(n, m - 1, left);
	}
}

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> s >> t;

    int n = s.size();
    int m = t.size();

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

    solve(n - 1, m - 1);
    trace(n - 1, m - 1, solve(n - 1, m - 1));
    reverse(ans.begin(), ans.end());
    for (auto it : ans) cout << it;
	return 0;
}

Measured memory_bytes: 70912
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, a1, a2, a3;
  cin >> a;
  a1 = a / 100;
  a2 = (a - a1 * 100) / 10;
  a3 = (a - a1 * 100 - a2 * 10);
  
  cout << a1 + a2 + a3 << endl;
}

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

template <typename A, typename B>
string to_string(pair<A, B> p){
    return "(" + to_string(p.fi) + ", " + to_string(p.se) + ")";
}

template <typename T>
string to_string(T v){
    string s = "{";
    bool first = true;
    for(const auto & x : v){
        if(!first) s += ", ";
        first = false;
        s += to_string(x);
    }
    return s + "}";
}

void debug_out(){ cerr << endl;}
template <typename First, typename... Next>
void debug_out(First F, Next... N){
    cerr << " " << to_string(F);
    debug_out(N...);
}

#ifdef LOCAL
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 1
#endif

int main(){
    fcin;
    int l;
    cin >> l;

    if(l % 3){
        double a = double(l)/3.0;
        double b = a;
        double c = l - (a + b);
        cout << fixed << setprecision(10) << a * b * c << endl;
        return 0;
    }

    double v = 0.0;
    for(int i = 1; i <= 1000; i++){
        for(int j = 1; j <= 1000; j++){
            int k = l - i - j;
            if(i * j * k - v > 1e-9){
                v = i * j * k;
            }
        }
    }
    cout << fixed << setprecision(10) << v << endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int a;
	int b;
	int c;
	int amari;
	int kazu=0;
	int i;

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

	for (i = a; i <= b;i++) {
		amari = c%i;
		if (amari == 0) {
			kazu++;
		}
	}
	printf("%d\n",kazu);
	return 0;
	}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a, b;
    cin >> a >> b;

    if(6 <= a && a <= 12) b /= 2;
    else if(a <= 5) b = 0;

    cout << b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>
#include <set>
#include <algorithm>

using namespace std;

int main() {
    map<string, int> bc;
    map<string, int> rc;
    set<string> st;

    
    int B, R;
    cin >> B;
    for(int b=0; b<B; b++) {
        string s;
        cin >> s;
        if(bc.find(s)==bc.end()) {
            bc[s] = 1;
            st.insert(s);
        } else {
            bc[s]++;
        }
    }
    cin >> R;
    for(int r=0; r<R; r++) {
        string t;
        cin >> t;
        if(rc.find(t)==rc.end()) {
            rc[t] = 1;
            st.insert(t);
        } else {
            rc[t]++;
        }
    }
    
    int max_count=0;
    for(auto i=st.begin(); i!=st.end(); i++) {
        max_count = max(max_count, bc[*i]-rc[*i]);
    }
    
    cout << max_count << endl;
    
    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

int main() {
  char b;
  cin >> b;

  if (b == 'A') {
    cout << 'T' << endl;
  } else if (b == 'T') {
    cout << 'A' << endl;
  } else if (b == 'G') {
    cout << 'C' << endl;
  } else {
    cout << 'G' << endl;
  }

  return 0;
}


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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}
void _main();
int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); return 0;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

void _main(){
  int N,K; cin >> N >> K ;
  vl h(N);
  rep(i,N) cin >> h[i] ;
  sort(ALL(h));
  ll ans = LINF;
  rep(i,N-K+1) chmin(ans,h[i+K-1]-h[i]);
  cout << ans << endl;
}

Measured memory_bytes: 1024
n = input()
k = int(input())
dp0 = [0] * 4
dp1 = [1,0,0,0]
for i in n:
  i = int(i)
  pdp0,pdp1,dp0 = dp0,dp1,[0]*4
  if i != 0:
    dp1 = [0] + pdp1[:-1]
  else:
    dp1 = pdp1
  dp0[0] = pdp0[0]+(i!=0)*pdp1[0]
  for j in range(1,4):
    dp0[j] = 9*pdp0[j-1] + pdp0[j] + (i!=0)*(i-1)*pdp1[j-1] + (i!=0)*pdp1[j]
print(dp0[k]+dp1[k])

Measured memory_bytes: 3064
#include <iostream>
#include <unordered_map>
 
using namespace std;
 
int dfs(unordered_map<int,unordered_map<int,int> > &g, int pos, int end, int flow, unordered_map<int,bool> &arrived) {
    if(pos==end) return flow;
    arrived[pos] = true;
    for(pair<int,int> p : g[pos]) {
        int next = p.first;
        int capacity = p.second;
        if(!arrived[next]&&capacity>0) {
            int res = dfs(g,next,end,min(flow,capacity),arrived);
            if(res>0) {
                g[pos][next] -= res;
                g[next][pos] += res;
                if(g[pos][next]<=0) g[pos].erase(next);
                return res;
            }
        }
    }
    return 0;
}

int max_flow(unordered_map<int,unordered_map<int,int> > &g, int s, int e) {
    int ans = 0;
    while(true) {
        unordered_map<int,bool> arrived;
        int flow = dfs(g,s,e,1<<30,arrived);
        if(flow<=0) break;
        else ans += flow;
    }
    return ans;
}
 
int main() {
     int v,e;
    cin >> v >> e;
    unordered_map<int,unordered_map<int,int> > g;
    for(int i = 0; i < e; i++) {
        int u,v2,c;
        cin >> u >> v2 >> c;
        g[u][v2] = c;
    }
    int ans = max_flow(g,0,v-1);
    cout << ans << endl;
}


Measured memory_bytes: 3164
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(scanner.next());
        }
        scanner.close();

        int maxMovies = 0;
        int tmpMoves = 0;
        for (int i = 0; i < N - 1; i++) {
            int current = H[i];
            int next = H[i + 1];
            if (current >= next) {
                tmpMoves++;
            } else {
                tmpMoves = 0;
            }

            if (maxMovies < tmpMoves) {
                maxMovies = tmpMoves;
            }
        }

        System.out.println(maxMovies);
    }
}


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

int main () {
  int a, b;
  cin >> a >> b;
  string ans = "No";
  for (int i = 1; i < 4; i++) {
    int n = a * b * i;
    if (n % 2 == 1) ans = "Yes";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,a,b;
vector<int> t;

int main(){
  int Tc;
  cin>>Tc;
  while(Tc--){    
    cin>>n>>m;
    t.clear();
    for(int i=0;i<n;i++){
      b=a;
      cin>>a;
      if(i==0)continue;
      t.push_back(a-b);
    }
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    int ans=0;
    for(int i=m-1;i<(int)t.size();i++){
      ans+=t[i];
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1732
from collections import defaultdict
import sys

sys.setrecursionlimit(1000000)
d=defaultdict(list)

N=int(input())
for _ in range(N-1):
    a,b,c=map(int,input().split())
    d[a].append((b,c))
    d[b].append((a,c))

Q,K=map(int,input().split())

# Kを中心とした距離を求める
dists=[None]*(N+1)
isused=[False]*(N+1)
dists[K]=0
isused[K]=True

def dfs(n):
    for i,j in d[n]:
        if isused[i]:continue
        isused[i]=True
        dists[i]=dists[n]+j
        dfs(i)

dfs(K)
for _ in range(Q):
    x,y=map(int,input().split())
    print(dists[x]+dists[y])

Measured memory_bytes: 138144
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<cctype>
#include<ctime>
#include<cstdlib>
#include<map>
#include<set>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define il inline
#define rg register
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define rep(i,st,ed) for(rg int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(rg int i=(ed);i>=(st);--i)
#define rep0(i,n) for(rg int i=0;i<(n);++i)
#define per0(i,n) for(rg int i=(n)-1;i>=0;--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &x,const T &y){return x<y?x:y;}
template<typename T> il T qmax(const T &x,const T &y){return x>y?x:y;}
template<typename T> il void getmin(T &x,const T &y){if(y<x) x=y;}
template<typename T> il void getmax(T &x,const T &y){if(y>x) x=y;}
il void fileio(const string &s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e18+7;
const int N=1e5+7;

int a[N],n;

int main(){
	//fileio("test");
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",a+i);
	int tot=0;
	rep(i,1,n+1) tot+=abs(a[i]-a[i-1]);
	rep(i,1,n){
		printf("%d\n",tot-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]));
	}
	return 0;
}


Measured memory_bytes: 1664
using System;
public class Hello{
    public static void Main(){
        int N = int.Parse(Console.ReadLine());
        int K = int.Parse(Console.ReadLine());
        string[] input = Console.ReadLine().Split(' ');
        int[] num = new int[N];
        
        int cnt = 0;
        for(int x = 0;x < N;x++){
            num[x] = int.Parse(input[x]);
            if(num[x] <= K / 2){
                cnt = cnt + 2 * num[x]; 
            }else{
                cnt = cnt + 2 * (K - num[x]);
            }
        }
        Console.WriteLine(cnt);
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <string>
using namespace std;
int main(){
  string S,T;
  cin >> S >> T;
  for(int i = 0; i < 3; i++){
    if(S[i] != T[2-i]){
	  cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
int rec(int s,int t,vector<int>const& w,vector<vector<int>>& dp){
    //[s,t)の区間を返す
    if(dp[s][t]!=-inf)return dp[s][t];
    if(t-s<=1)return 0;
    int n=w.size()-2;
    int res=0;
    for(int i=s+1;i<t;++i){
        res=max(res,rec(s,i,w,dp)+rec(i,t,w,dp));
    }
    if(t-1-(s+1)==rec(s+1,t-1,w,dp)){
        if(abs(w[s]-w[t-1])<=1){
            int buf=rec(s+1,t-1,w,dp)+2;
            res=max(res,buf);
        }
    }
    dp[s][t]=res;
    return res;
}
int solve(int n){
    vector<int> w(n);
    vector<vector<int>> dp(n+10,vector<int>(n+10,-inf));
    rep(i,n)cin>>w[i];
    int res=0;
    res=rec(0,n,w,dp);
    return res;
}
signed main(){
    vector<int> res;
    while(1){
        int n;cin>>n;
        if(n==0)break;
        res.push_back(solve(n));
    }
    for(auto& val:res){
        cout<<val<<"\n";
    }
    return 0;    
}


Measured memory_bytes: 3332
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long A, B, C, D;
	cin >> A >> B >> C >> D;
	long long LCM = C * D / __gcd(C, D);
	long long ans = (B - (B / C) - (B / D) + (B / LCM));
	long long ans2 = (A - (A / C) - (A / D) + (A / LCM));
	long long out = ans - ans2;
	if (A % C != 0 && A % B != 0) out++;
	cout << out << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n;
    string str;
    cin >> n;
    rep(i, n)
    {
        char c[100] = {0};
        cin >> str;
        int index = 30;
        int move = 0;
        rep(j, str.size())
        {
            if ((int)(str[j] - 'a') >= 0 && (int)(str[j] - 'z') <= 0)
            {
                c[index] = str[j];
            }
            else if (str[j] == '<')
            {
                move = -1;
                index += move;
            }
            else if (str[j] == '>')
            {
                move = 1;
                index += move;
            }
            else
            {
                continue;
            }
        }
        rep(j, 100)
        {
            if (c[j] != 0)
                cout << c[j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    string n;
    cin >> n;

    int s1 = 0;
    for ( auto l : n ) s1 += l - '0';
    int s = 0;
    s += n[0] - 1 - '0';
    for ( size_t i = 1; i < n.size(); i++ )  s+= 9;

    cout << max(s1, s) << endl;

    return 0;
}

Measured memory_bytes: 256