akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define bit(x,j) ((x>>j)&1)
using namespace std;
// bitset<8>set1(p);
// __builtin_popcountll(x);
// bitset<100> b("1010");
long long power(long long a, long long b) {
    //a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
    }
  ll int binomial(ll int n, ll int k) 
{ 
    ll int C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll int i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (int j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 
  vector<int> pr;
  bool prime[10000000];
void Sieve(ll int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            pr.push_back(p);
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
}
 


//It reurns Fn,Fn+1
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}
int sum(int n)  
{  
    if (n == 0)  
    return 0;  
    return (n % 10 + sum(n / 10));  
}  
ll int factorial(ll int n,ll int m) 
{ 
    ll int fact = 1; 
    for(int i=2;i<=n;i++) { 
        fact = (fact * i)%m; 
    } 
    return fact%m; 
} 

void reverse(string& str) 
{ 
    int n = str.length(); 
  
    // Swap character starting from two 
    // corners 
    for (int i = 0; i < n / 2; i++) 
        swap(str[i], str[n - i - 1]); 
} 


int main() {
    ios;
   ll int n;
   cin>>n;
   ll int k;
   cin>>k;
   ll int a[n];
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   for(int i=0;i<n-k;i++)
   {
       if(a[i]<a[k+i])
       {
           cout<<"Yes"<<endl;
       }
       else {
       cout<<"No"<<endl;
       }
   }
}


Measured memory_bytes: 5188
#include <stdio.h>
#define N 100005
char s[N],t[N];
int a,b,c,d,x[N],y[N];
inline void solve() {
	scanf("%d%d%d%d",&a,&b,&c,&d);
	puts(((x[b]-x[a-1]-y[d]+y[c-1])%3+3)%3?"NO":"YES");
}
int main() {
	int Q;
	scanf("%s%s%d",s+1,t+1,&Q);
	x[0]=y[0]=0;
	for(int i=1;s[i];++i) x[i]=x[i-1]+s[i]-'A'+1;
	for(int i=1;t[i];++i) y[i]=y[i-1]+t[i]-'A'+1;
	while(Q--) solve();
	return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
//combination(Nが小さい時はこれを使う)
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight(int n) {
	int ans = 1;
	while (n >= 10) {
		n /= 10;
		ans++;
	}
	return ans;
}
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
int n;
int c[214514];
int dp[214514];
int cnt[214514];
signed main() {
	cin >> n;
	rep(i, n)cin >> c[i];
	dp[0] = 1, dp[1] = 1; cnt[c[0]] = 1;
	for (int i = 1; i < n; i++) {
		if (c[i] == c[i - 1])dp[i + 1] = dp[i];
		else {
			dp[i + 1] = (cnt[c[i]] + dp[i]) % mod;
			cnt[c[i]] += dp[i];
			cnt[c[i]] %= mod;
		}
	}
	cout << dp[n] % mod << endl;
	ggr
}

Measured memory_bytes: 6272
import sys
sys.setrecursionlimit(10**8)

N = int(input())
A = list(map(int,input().split()))
C = [0]
for a in A:
    C.append(C[-1] + a)

dp = [[0]*N for i in range(N)]

def rec(l,r):
    if dp[l][r]: return dp[l][r]
    if l == r: return 0
    if r-l == 1: return A[l] + A[r]
    ret = C[r+1] - C[l]
    tmp = min(rec(l+1,r), rec(l,r-1))
    for i in range(r-l-2):
        tmp = min(tmp, rec(l,l+i+1) + rec(l+i+2,r))
    ret += tmp
    dp[l][r] = ret
    return ret

print(rec(0,N-1))

Measured memory_bytes: 46812
<?php 
$n = fgets(STDIN);
$a = fgets(STDIN);
 
$array = explode(" ", $a);
 
$num = 0;
 
divarray($array, $num);
 
function divarray($arr, $able){
  $flg = 0;
  $divarr = array();
  foreach ($arr as $value) {
    if(($value % 2) == 1){
      $flg = 1;
      break;
    }else{
      $divarr[] = $value/2;
    }
  }
  if($flg == 0){
    $able++;
    divarray($divarr, $able);
  }else {
    echo $able;
  }
}
 
 ?>

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


int main(){
  string s;
  cin >> s;
  
  int c=0,m=0;
  rep(i,s.size()){
    if(s[i]=='T') c++;
    else c--;

    if(m<c) m=c;
        
  }
  int ans = m*2;
  cout << ans;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
vector<ll> G[550010];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 1000000007;
/*
2000000011 is prime
2000000033 is prime
*/

ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

/*
ll fact[800005],rfact[800005];

void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q,r,l;
ll k,ans;
ll x[500005],y[500005],z[500005];

int main(){
    cin >> n;
    for(int i=0;i<n-1;i++){
        cin >> x[i];
    }
    ans = x[0] + x[n - 2];
    for(int i=0;i<n-1;i++){
        ans += min(x[i], x[i+1]);
    }
    p(ans);
    return 0;
}






Measured memory_bytes: 16640
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

using Matrix = vector<vector<int>>;
using Board = vector<string>;

constexpr int kInf = (1 << 28);
constexpr char kFree = '.';
constexpr char kBlocked = '#';

const vector<pair<int, int>> kMods = { {-1, 0}, {0, 1}, {1, 0}, {0, -1} };

bool InBounds(const Board &b, int x, int y)
{
    return 0 <= x && x < (int)b.size() && 0 <= y && y < (int)b[x].size();
}

Matrix GetCosts(const Board &b)
{
    Matrix costs(b.size(), vector<int>(b[0].size(), kInf));
    queue<pair<int, int>> q;

    if (b[0][0] != kFree) {
        return costs;
    }

    costs[0][0] = 1;
    q.push({0, 0});

    while (!q.empty()) {
        auto x = q.front().first;
        auto y = q.front().second;
        q.pop();

        for (const auto &mod : kMods) {
            auto cx = x + mod.first;
            auto cy = y + mod.second;

            if (!InBounds(b, cx, cy) || b[cx][cy] != kFree) {
                continue;
            }
            if (costs[x][y] + 1 < costs[cx][cy]) {
                costs[cx][cy] = costs[x][y] + 1;
                q.push({cx, cy});
            }
        }
    }
    return costs;
}

int Count(const Board &b, char type)
{
    int count = 0;
    for (const auto &row : b) {
        for (const auto &ch : row) {
            count += (ch == type ? 1 : 0);
        }
    }
    return count;
}

int Solve(const Board &b)
{
    auto costs = GetCosts(b);
    if (costs.back().back() >= kInf) {
        return -1;
    }

    return b.size() * b[0].size() - Count(b, kBlocked) - costs.back().back();
}

int main()
{
    int rows, cols;
    cin >> rows >> cols;
    cin.get();

    Board board(rows);
    for (auto &row : board) {
        getline(cin, row);
    }

    auto res = Solve(board);
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        int val;
        cin >> val;
        cnt += val >= k;
    }
    cout << cnt << '\n';
}

int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}


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

int main()
{
  int n;
  cin>>n;
  if(n == 1)
  {
    cout<<"Hello World";
  }
  else
  {
    int a,b;
    cin>>a>>b;
    cout<<a+b;
  }
  return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    int64 ans = 0;
    vector<string> s(n);
    vector<int64> t(n);
    REP(i,n)cin >> s[i] >> t[i];
    string x;
    cin >> x;
    bool plus = false;
    REP(i,n){
        if(plus){
            ans += t[i];
        }
        if(s[i] == x){
            plus = true;
        }
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 256
from math import ceil

n = int(input())

a = [chr(i) for i in range(97, 97+26)]

s = 0
for i in range(1,100):
  l = n - s
  s += 26**i
  if n <= s:
    m = i
    break #第m群l番目

name = [0] * m
div = [0] * m
rem = [0] * m
rem[-1] = l

for j in range(m):
  div[j] = ceil(rem[j-1] / (26**(m-j-1)))
  rem[j] = rem[j-1] % (26**(m-j-1))
  if rem[j] == 0:
    rem[j] == 26**(m-j-1)
  name[j] = a[div[j]-1]
    
print(''.join(name))

Measured memory_bytes: 9208
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		ll n,k;
		cin>>n>>k;
		vector<ll> height;
		vector<ll> dp(n,0);
		for(ll i=0; i<n; i++) {
			ll x;
			cin>>x;
			height.push_back(x);
		}
 
		dp[0] = 0;
		dp[1] = abs(height[1] - height[0]);
 
		for(ll i=2; i<n; i++) {
			ll cur = 1, mini = 1000000000;
			ll cost = 0;
			while((i-cur)>=0 && cur<=k) {
				cost = dp[i-cur] + abs(height[i-cur] - height[i]);
				mini = min(mini,cost);
				cur++;
			}
 
			dp[i] = mini;
			
		}
 
		cout<<dp[n-1]<<endl;
 
		return 0;
	}

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

using namespace std;
typedef long long ll;
const int N = 210;
int _w;

int n;
ll a[N];
char s[N];

namespace Basis {
	ll b[62];
	void init() {
		memset(b, 0, sizeof b);
	}
	void insert( ll x ) {
		for( ll i = 61; i >= 0; --i )
			if( x & (1LL << i) ) {
				if( b[i] ) x ^= b[i];
				else {
					b[i] = x;
					break;
				}
			}
	}
	bool check( ll x ) {
		for( ll i = 61; i >= 0; --i )
			if( x & (1LL << i) ) {
				if( b[i] ) x ^= b[i];
				else return false;
			}
		return x == 0;
	}
}

int main() {
	int T;
	_w = scanf( "%d", &T );
	while( T-- ) {
		_w = scanf( "%d", &n );
		for( int i = 1; i <= n; ++i )
			_w = scanf( "%lld", a+i );
		_w = scanf( "%s", s+1 );
		Basis::init();
		bool flag = true;
		for( int i = n; i >= 1; --i )
			if( s[i] == '0' ) {
				Basis::insert( a[i] );
			} else {
				if( Basis::check( a[i] ) == false ) {
					flag = false;
					break;
				}
			}
		puts( flag ? "0" : "1" );
	}
	return 0;
}


Measured memory_bytes: 3632
N = int(input())
H = [int(x) for x in input().split()]
reg = 0
while max(H) != 0:
    i = 0
    while i < N:
        if H[i]==0:
            i += 1
            continue
        reg += 1
        while i < N and H[i] > 0:
            H[i] -= 1
            i += 1
print(reg)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    int n,a,i;
    long long min=1000000,max=-1000000,sum=0;

    cin >> n;
    for(i=0;i<n;i++){
        cin >> a;
        if(min>a)min = a;
        if(max<a)max = a;
        sum += a;
    }
    cout << min << " "<< max <<" "<< sum << endl;
}


Measured memory_bytes: 3088
#include<iostream>
#include<string>
#include<vector>
#include<sstream>
using namespace std;

int main(){
    // def inputs
    int i = 0, res = 0, num_in;
    int last_digit, min_last_digit = 10;

    // parse input
    while(i < 5){
        cin >> num_in;
        last_digit = num_in % 10;
        if(last_digit != 0){
            if(last_digit < min_last_digit)
                min_last_digit = last_digit;
            num_in = (int(num_in / 10) + 1) * 10;
        }
        res += num_in;
        i++;
    }
    if(min_last_digit < 10)
        res = res - 10 + min_last_digit;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace ABC0613
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inp = Console.ReadLine().Split(" ");
            int n = int.Parse(inp[0]);
            int k = int.Parse(inp[1]);

            string[]price= Console.ReadLine().Split(" ");
            List<int> priceL = new List<int>();
            foreach(string p in price)
            {
                int pi = int.Parse(p);
                priceL.Add(pi);
            }
            priceL.Sort();
            int ans = 0;

            for (int i=0;i<k;i++)
            {
                ans += priceL[i];
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27928
#include<bits/stdc++.h>     
        using namespace std;  
        typedef long long  ll;
        typedef pair<ll,ll> pll;  
        #define pb(x) push_back(x)     
        typedef unsigned long long  ull;     
        #define mem(A, X) memset(A, X, sizeof A)
        #define ford(i,l,u) for(ll (i)=(ll)(l);(i)>=(ll)(u);--(i))
        #define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
        #define fori(i,l,u) for(ll (i)=(ll)(l);(i)<=(ll)(u);++(i))    
        typedef pair<int,int> pii;
        #define sec second
        #define fir first  
      
        const ll mod=1e9+7; 
        const ll maxn=1e5+10; 
         int cnt[1000+10];
         ll ans;
         vector<pair<int,int> > get_factor(int i)
         {
          vector<pair<int,int> > v;

          for(int det=2;det<=i;det++)
          {
              if(i==1) break;
              if(i%det==0)  
              {
                int temp_cnt=0;
                while(i%det==0)
                {
                  i/=det;
                  temp_cnt++;
                } 
                v.push_back(make_pair(det,temp_cnt) ); 
              }

          }

          return v; 
         }

         void add(int i)
         {
            vector<pair<int,int> > v=get_factor(i);
           // cout<<" i：" <<i<<endl;
            fori(pos,0,(int)v.size()-1)
            {
              int key=v[pos].fir,val=v[pos].sec;
              //cout<<"key val"<<key<<" "<<val<<endl;
              cnt[key]+=val;
            }
         }
         void mul(int i)
         {
           ans=ans*(cnt[i]+1)%mod;
         }
        int main()
        {
             std::ios::sync_with_stdio(false); 
            // freopen("in.txt","r",stdin); 
             int n;
             while(cin>>n)
             {
              memset(cnt,0,sizeof(cnt) );

              ans=1;
              if(n!=1)
              {
                fori(i,2,n)  add(i); 
                fori(i,2,n)  mul(i);
              }
              cout<<ans<<endl;
             }
          return 0;
        }
      

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

using ll = long long;
using ull = unsigned long long;
//c
int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }

    ll ans = 0;
    for (int i = 1; i < n; ++i) {
        if (v[i] < v[i - 1]) {
            ans += v[i - 1] - v[i];
            v[i] = v[i - 1];
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4052
import java.util.Scanner;

public class Main {
    static long max = (long) Math.pow(10, 9);

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            long a = sc.nextLong();
            long b = sc.nextLong();
            for (long i = 0L; i < max; i++) {
                if (Math.abs(a - i) == Math.abs(b - i)) {
                    System.out.println(i);
                    return;
                }
            }
            System.out.println("IMPOSSIBLE");
        }
    }
}


Measured memory_bytes: 21716
#include <iostream>
#define rep(i, n) for (int i = 2; i <= (n); i++)
#define MAX_N 100000
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int M, D;
  cin >> M >> D;

  int Ans = 0;
  rep(m, M) {
    rep(d, D) {
      int d1 = d % 10;
      int d10 = d / 10;
      if(d1 < 2 || d10 < 2)
        continue;
      int m0 = d1 * d10;
      if (m == m0) {
        Ans++;
      }
    }
  }
cout << Ans << endl;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int a,b;
    cin>>a>>b;
    int ans = 1;
    int counter = 0;
    while(ans < b) {
        ans += a-1;
        counter++;
    }

    cout<<counter<<endl;

    return 0;
}




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

#define pb push_back
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define beg begin()
#define en end()
#define sz size()
#define mem(a,b) memset(a,b,sizeof a)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main(){
	ios::sync_with_stdio(false);
	string s;
	int k;
	cin>>s;
	cin>>k;
	int streak=0;
	char fs;
	for(auto item:s){
		if(item=='1'){
			++streak;
		}else{
			fs=item;
		 break;
	 }
	}
	
	if(streak==0){
		cout<<fs;
		cout<<endl;
		return 0;
	}
	
	if(k<=streak){
		cout<<"1";
		cout<<endl;
		return 0;
	}
	
	cout<<fs;
	cout<<endl;
	
	
	
	
	return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val s = readLine()!!.toCharArray()
    val k = readLine()!!.toInt()

    var cnt = 0

    for (i in s.indices) {
        val d = ('z' - s[i] + 1) % 26
        if (d <= k - cnt) {
            s[i] = 'a'
            cnt += d
        }
    }

    if (k - cnt > 0) {
        s[s.lastIndex] = s[s.lastIndex] + ((k - cnt) % 26)
    }

    println(s.joinToString(""))
}


Measured memory_bytes: 41084
/*
 * Author: Anmol Choudhary
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int ll
//void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
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 << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll maxn = 100005;
const ll mm = 1e+18;
void solve()
{
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes";
    else cout<<"No";
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nx;
    }
    return 0;
}


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

char tolower(char ch){
    if( 'A' <=ch && ch <= 'Z' ){
        return ch-'A'+'a';
    }else{
        return ch;
    }
}

int main(){
    int count=0;
    string W;
    cin>>W;
    string str;
    while(1){
        cin>>str;
        if(str=="END_OF_TEXT")break;
        for(int i=0;i<(int)str.size();i++){
            str[i]=tolower(str[i]);
        }
        if(str==W){
            count++;
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3144
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;
const ll INF=1e16;
int main()
{
    int n, m; ll p; cin>>n>>m>>p;
    vector<P> g[2510];
    for(int i=0; i<m; i++){
        int a, b; ll c; cin>>a>>b>>c;
        a--; b--; c-=p;
        g[a].push_back({b, c});
    }
    ll d[2510];
    fill(d, d+n, -INF);
    d[0]=0;
    for(int i=0; i<2*n; i++){
        for(int j=0; j<n; j++){
            for(auto p:g[j]){
                int k=p.first;
                if(d[k]<d[j]+p.second){
                    d[k]=d[j]+p.second;
                }
            }
        }
    }
    for(int i=0; i<2*n; i++){
        int cnt=0;
        for(int j=0; j<n; j++){
            for(auto p:g[j]){
                int k=p.first;
                if(d[k]<d[j]+p.second){
                    d[k]=d[j]+p.second;
                    if(k==n-1) cnt++;
                }
            }
        }
        if(cnt>0){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<max(0ll, d[n-1])<<endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int A[]=new int[10000];
        int i=0;
		for(i=0;i<10000;i++){
			A[i]=scan.nextInt();
		    if(A[i]==0)break;
		}

		for(int j=0;j<i;j++){
			System.out.println("Case "+ (j+1) +": "+A[j]);
		}
		
	}
}


Measured memory_bytes: 46616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int count = 0;

		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '+') {
				count++;
			} else {
				count--;
			}
		}

		System.out.print(count);
	}
}

Measured memory_bytes: 21588
using System;
using System.Linq;

namespace AtCoderBeginnerContest175
{
	class Program
	{
		static void Main(string[] args)
		{
			var input = int.Parse(Console.ReadLine());
			var lengthList = Console.ReadLine().Split().Select(x => int.Parse(x)).OrderBy(x => x).ToList();

			var count = 0;
			for (var i = 0; i < lengthList.Count - 2; i++)
			{
				for (var j = i + 1; j < lengthList.Count - 1; j++)
				{
					if (lengthList[i] == lengthList[j])
					{
						continue;
					}

					for (var k = j + 1; k < lengthList.Count; k++)
					{
						if (lengthList[j] == lengthList[k])
						{
							continue;
						}

						if(lengthList[i] + lengthList[j] > lengthList[k])
						{
							count++;
						}
						else
						{
							break;
						}
					}
				}
			}

			Console.WriteLine(count);
		}
	}
}


Measured memory_bytes: 28456
/*
https://scrapbox.io/ganariya/AtCoderDISCO2020_C%E5%95%8F%E9%A1%8C400%E7%82%B9_%E3%80%8CStrawberry_Cakes%E3%80%8D
勉強させて頂いた解説
横で塗り分けて、それを上下に広めていくという、次元を固定した考え方？
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)

int main(){
    int h,w,k,cnt=1;
    vector<int> strawbery(309,0);
    vii ans(309,vi(309,0));
    char s[309][309];
    cin>>h>>w>>k;
    rep(i,h){
        rep(j,w){
            cin>>s[i][j];
            //横に区切り、あるかどうかcnt
            if(s[i][j]=='#')strawbery[i]++;
        }
    }
    rep(i,h){
        if(strawbery[i]>0){
            rep(j,w){
                ans[i][j]=cnt;
                if(s[i][j]=='#'){
                    strawbery[i]--;
                    if(strawbery[i]>0)cnt++;
                }
                //cout<<"i:"<<i<<"="<<strawbery[i]<<endl;
            }
            cnt++;
        }
    }
    //上から塗るだけでは塗り残しができてしまうので、
    //下からも塗る操作が必要
    /*
    4 4 1
    ....
    ....
    #...
    ....
    のケースで落ちる。
    */
    REP(i,1,h){
        if(ans[i][0]==0){
            rep(j,w){
                ans[i][j]=ans[i-1][j];
            }
        }
    }

    for(int i=h-2;i>=0;i--){
        if(ans[i][0]==0){
            rep(j,w){
                ans[i][j]=ans[i+1][j];
            }
        }
    }

    rep(i,h){
        rep(j,w){
            cout<<ans[i][j]<<" ";
        }
        cout<<endl;
    }

    return 0;
}

//a=97,z=122

Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define FOR(i,a,n) for(int i=a,i##_len=(int)n;i<i##_len;++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0}, DY[9]={-1,0,1,0,-1,1,1,-1,0};
const int INF=1001001001; const long long INFLL=1001001001001001001ll;
template<class T> ostream& operator << (ostream &os, const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is, vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
    #ifdef int
        cerr<<"\x1b[7m"<<"'int' is defined as 'long long' !!!!"<<"\x1b[m"<<endl;
    #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(12)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

signed main() {
    string s;
    cin>>s;
    replace(ALL(s),',',' ');
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(s[k - 1])

Measured memory_bytes: 38256
#pragma GCC optimize("Ofast", "unroll-loops")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

constexpr ll mod = 1000000007LL;

ll modpow(ll a, ll b) {
	if (b == 0) return 1;
	ll tmp = modpow(a, b / 2);
	if (b % 2)
		return tmp * tmp % mod * a % mod;
	return tmp * tmp % mod;
}

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

using p = pair<ll, ll>;

void make_good(p& xy) {
	if (xy.first < 0) xy.first *= -1, xy.second *= -1;
	if (xy.first == 0) xy.second = 1;
	else if (xy.second == 0) xy.first = 1;
	else {
		ll g = gcd(abs(xy.first), abs(xy.second));
		xy.first /= g;
		xy.second /= g;
	}
}

int main() {
	int N; cin >> N;
	map<p, ll> cnt;
	ll res = 0;
	for (int i = 0; i < N; ++i) {
		ll a, b; cin >> a >> b;
		if (a == 0 && b == 0) {
			++res; continue;
		}
		p tmp = make_pair(a, b);
		make_good(tmp);
		// cout << tmp.first << " " << tmp.second << endl;
		cnt[tmp]++;
		p opp(tmp.second, -tmp.first);
		make_good(opp);
		cnt[opp] += 0;
	}

	//for (auto& e : cnt) {
	//	cout << e.first.first << " " << e.first.second << "  : " << e.second << endl;
	//}

	ll res_tmp = 1;
	for (auto& e : cnt) {
		p xy = e.first;
		if (xy.second <= 0) continue;

		// cout << xy.first << " " << xy.second << "  :  ";

		ll c1 = e.second;
		p opp(xy.second, -xy.first);
		make_good(opp);
		ll c2 = cnt[opp];

		// cout << c1 << " " << c2 << endl;

		res_tmp *= (modpow(2LL, c1) + modpow(2LL, c2) - 1 + mod) % mod;
		res_tmp %= mod;
	}
	res_tmp = (res_tmp - 1 + mod) % mod;
	res = (res + res_tmp) % mod;
	cout << res << endl;
	return 0;
}


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

char sa[4004], sb[4004];
int dp[4001], mm;

void search(){
    mm = 0;
    for(int z = 0; z < 4000; z++){
        dp[z] = 0;
        if( sb[z] ) dp[z] = (sa[0] == sb[z]);
    }
    int xlim = 0, ylim = 0;
    while( sa[xlim] || sb[ylim] ){
        if( sa[xlim] ) xlim++;
        if( sb[ylim] ) ylim++;
    }
    xlim--; ylim--;
    for(int x = 0; x < xlim; x++){
        for(int y = ylim - 1; y >= 0; y--){
            dp[y+1] = (sa[x+1] == sb[y+1]) ? dp[y] + 1 : 0;
            if( dp[y+1] > mm ) mm = dp[y+1];
        }
    }
    cout << mm << endl;
}

int main(){
    while( cin >> sa >> sb ){
        search();
    }
    return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
string S; 
int dp[100010][4];

int calc(int x, int p) {
    if(dp[x][p] != -1) return dp[x][p];
    if(x >= S.length()) {
        if(p == 3) return dp[x][p] = 1;
        else return dp[x][p] = 0;
    }
    if(S[x] != '?') {
        if(S[x] == 'A' && p == 0) return dp[x][p] = (calc(x + 1, 1) + calc(x + 1, 0)) % mod;
        if(S[x] == 'B' && p == 1) return dp[x][p] = (calc(x + 1, 2) + calc(x + 1, 1)) % mod;
        if(S[x] == 'C' && p == 2) return dp[x][p] = (calc(x + 1, 3) + calc(x + 1, 2)) % mod;
        return dp[x][p] = calc(x + 1, p);
    }
    if (p != 3) return dp[x][p] = (calc(x + 1, p + 1) + calc(x + 1, p) * 3) % mod;
    return dp[x][p] = (calc(x + 1, p) * 3) % mod;

}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> S;
    rep(i, 100010) rep(j, 4) dp[i][j] = -1;
    cout << calc(0, 0) << endl;

    return 0;
}


Measured memory_bytes: 8272
s=input()
num=[]
for i in range(4):
    num.append(int(s[i]))
ans=[]
lis=[-1,1]
for b in lis:
    for c in lis:
        for d in lis:
                if num[0]+b*num[1]+c*num[2]+d*num[3]==7:ans=[b,c,d]

res=str(num[0])
for i in range(3):
    if ans[i]==-1:res+='-'
    elif ans[i]==1:res+='+'
    res+=str(num[i+1])
res+='=7'
print(res)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))

check = {}
ans = 0

for i in range(N):
    x = i - A[i]
    y = A[i] + i
    ans += check.get(x, 0)
    check.setdefault(y, 0)
    check[y] += 1

print(ans)

Measured memory_bytes: 40424
#include<cstdio>
#include<set>
#include<cmath>
#include<iostream>
using namespace std;

int main()
{
    int n;
    while(~scanf("%d",&n),n)
    {
        set<int> s;
        s.insert(1);
        for(int i=2;i<sqrt(1.0*n)+2;i++)
        {
            if(n%i == 0)
            {
                s.insert(i);
                s.insert(n/i);
            }
        }
        set<int>::iterator p;
        int sum = 0;
        for(p=s.begin();p!=s.end();p++)
        {
            //cout<<*p<<endl;
            sum += *p;
        }
        if(n<=4) printf("deficient number\n");
        else{
             if(sum > n) printf("abundant number\n");
             else if(sum == n) printf("perfect number\n");
             else printf("deficient number\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1172
//
//  main.cpp
//  Poisonous_Cookies
//
//  Created by Uttam Datta on 02/06/19.
//  Copyright © 2019 Uttam Datta. All rights reserved.
//

#include <iostream>
using namespace std;

int t_poison, untasty,tasty;

int ans(){
    int res;
    int anti = untasty+tasty;
    if(t_poison > anti){
        res = anti + tasty +1;
    }
    else{
        res = t_poison + tasty;
    }
    return res;
}

int main(){
    cin >> untasty >> tasty >> t_poison;
    cout << ans() << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
#include <queue>

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define ft first
#define sd second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PII;
typedef queue<int> QI;

const LL mod=1000000007;
LL powmod(LL a,LL b) {LL res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

LL jc[15],l;

//LL g[14][14*9+1]
char s[23];
map<LL,LL>f[14][14*9+1][3];

map<LL,LL>::iterator it;

void init(){
    //jc[0]=1;rep(i,0,15)jc[i]=jc[i-1]*i;
    rep(i,0,s[0]-'0')f[0][i][0][i+1]=1;
    f[0][s[0]-'0'][1][s[0]-'0'+1]=1;

    rep(i,0,10)f[0][i][2][i+1]=1;

   // cout<<f[0][0][1][1]<<endl;
    rep(i,0,l-1){
        rep(j,0,9*(i+2)){
            rep(now,0,3){//cout<<i<<' '<<j<<' '<<now<<endl;
            for(it=f[i][j][now].begin();it!=f[i][j][now].end();++it){
                //cout<<i<<' '<<j<<' '<<now<<endl;
                LL p=(*it).ft,v=(*it).sd;
                int nxt=0,nn=s[i+1]-'0';
                if(now!=2)rep(k,0,10){
                    if(now==1 && k==nn)nxt=1;
                    if(now==1 && k>nn)break;
                    f[i+1][j+k][nxt][p*(k+1)]+=v;
                }else{
                    rep(k,0,10){
                        f[i+1][j+k][2][p*(k+1)]+=v;
                    }
                }
            }
        }
    }
}
}


int main(){
    while(~scanf("%s",s)){
        LL ans=0,sum=0,pro=1,num=0;
        l=strlen(s);init();rep(i,0,l){
            sum+=s[i]-'0';
            pro*=(s[i]-'0')+1;
            num*=10;
            num+=s[i]-'0';
        }
     //   cout<<sum<<' '<<pro<<' '<<num<<endl;
       rep(i,0,sum){
            for(it=f[l-1][i][2].begin();it!=f[l-1][i][2].end();++it){
                ans+=(*it).sd;
            }
        }
        for(it=f[l-1][sum][2].begin();it!=f[l-1][sum][2].end();++it){
            if((*it).ft<pro)ans+=(*it).sd;
        }
        ans+=f[l-1][sum][0][pro];
        cout<<ans<<endl;
    }
	return 0;
}

Measured memory_bytes: 75708
from collections import deque
from copy import copy,deepcopy
from itertools import permutations,combinations
from pprint import pprint

def myinput():
    return map(int,input().split())

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

n = int(input())
ab = [ list(myinput()) for _ in range(n) ]
cd = [ list(myinput()) for _ in range(n) ]

count = 0
for i in range(n):
    cd_sorted = mysort(cd,0)
    bx = cd[0][0]
    by = cd[0][1]
    cd.remove([bx,by])
    ab.sort(key=lambda x:x[1],reverse=True)
    # print(cd)
    # print(ab)
    for j in range(len(ab)):
        rx = ab[j][0]
        ry = ab[j][1]
        if rx<bx and ry<by:
            count += 1
            ab.remove([rx,ry])
            break
        else:
            pass
print(count)

Measured memory_bytes: 40176
//package ARC12020;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.*;
import java.lang.*;
import java.util.*;

class Main {

	public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc =new Scanner(System.in);
        String s=sc.next();
        
        System.out.println(s.substring(0,3));
        
	
	
	
	}

}


Measured memory_bytes: 35708
using System;
using System.Collections.Generic;
					
public class my
{
		public static void Main()
	{
		var n = my.GetInt();
		var A = my.GetIntArray(n);
		
		var cnt = my.MergeSort(A, 0, n);
		
		Console.WriteLine(cnt);
	}
	
	private static long MergeSort(int[] A, int left, int right)
	{
		long cnt = 0;
		
		if(left +1 < right) {
			int mid = (left + right) / 2;
			
			cnt += my.MergeSort(A, left, mid);
			cnt += my.MergeSort(A, mid, right);
			cnt += my.Merge(A, left, mid, right);
		}
		
		return cnt;
	}
	
	private static long Merge(int[] A, int left, int mid, int right)
	{
		var n1 = mid - left;
		var n2 = right - mid;
		
		var L = new int[n1 + 1];
		Array.Copy(A, left, L, 0, n1);
		var R = new int[n2 + 1];	// for sentinel
		Array.Copy(A, mid, R, 0, n2);
		L[n1] = int.MaxValue;	// Sentinel
		R[n2] = int.MaxValue;
		
		int i = 0, j=0;
		
		long cnt = 0;
		for(int k = left; k < right; k++) {
			if(L[i] <= R[j]) {
				A[k] = L[i++];
			} else {
				A[k] = R[j++];
				cnt += n1 - i;
			}
		}
		
		return cnt;
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}

	private static int[] GetIntArray(int n)
	{
		var A = new int[n];
		var s = Console.ReadLine().Split(' ');

		for(int i = 0; i < n; i++) {
			A[i] = int.Parse(s[i]);
		}
		return A;
	}
	
	private static int[] GetIntArray(int n, string t)
	{
		var A = new int[n];
		var s = t.Split(' ');

		for(int i = 0; i < n; i++) {
			A[i] = int.Parse(s[i]);
		}
		return A;
	}

	private static int[] GetIntArray(char c)
	{
		return Array.ConvertAll(Console.ReadLine().Split(c), int.Parse);
	}
	
	private static int[] GetIntArray(char c, string s)
	{
		return Array.ConvertAll(s.Split(c), int.Parse);
	}
	
	private static int[] GetIntArray(string s)
	{
		return Array.ConvertAll(s.Split(' '), int.Parse);
	}
	
	private static double[] GetDoubleArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
	}
	
	public static string Reverse(string s)
	{
		var c = s.ToCharArray();
		Array.Reverse(c);
		
		return new String(c);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}

	private static void WriteArray(long[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static void WriteVector(Vector v)
	{
		Console.WriteLine("{0:f8} {1:f8}", v.X, v.Y);
	}
}

public struct Vector
{
	public double X,Y;
}

Measured memory_bytes: 30012
import java.io.*;
import java.util.Scanner;

public class Main{
               public static void main(String args[]) throws IOException{
                     int a = 0;
                     int b = 0;
                   
                     Scanner in = new Scanner(System.in);
                     
                     String buf1 = in.next();
                     String buf2 = in.next();
                     
                     a = Integer.parseInt(buf1);
                     b = Integer.parseInt(buf2);

                        if(a > b){
                          System.out.println("a > b");
                       }else if(a < b){
                          System.out.println("a < b");
                       }else if(a == b){
                           System.out.println("a == b");
                       }

              }
      }


         

Measured memory_bytes: 26108
#include<bits/stdc++.h>
using namespace std;
deque<int> deq;
int main()
{
	int k;
	scanf("%d",&k);
	int dis[100005];
	memset(dis,0x3f3f3f3f3f,sizeof(dis));
	deq.push_front(1);
	dis[1] = 0;
	while(!deq.empty()){
		int x = deq.front();
		//cout<<x<<endl;
		deq.pop_front();
		if(dis[x * 10 % k] > dis[x]) dis[x * 10 % k] = dis[x],deq.push_front(x * 10 % k);
		if(dis[(x + 1) % k] > dis[x] + 1) dis[(x + 1) % k] = dis[x] + 1,deq.push_back((x + 1) % k);
	}
	cout<<dis[0] + 1<<endl;
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int N;
    cin>>N;
    vector<int> D;

    for(int i = 0;i < N;i++) {
        int d;
        cin>>d;
        D.push_back(d);
    }

    int ans = 0;
    for(int i = 0;i < N-1;i++) {
        for(int j = i+1;j < N;j++) {
            ans += D[i]*D[j];
        }
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256