akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

// ================================================= //

/*
 1-index
 RangeAdd : [s,t] に xを加算
 RangeSum : [s,t] の総和を出力
 */
struct BIT {
    int N;
    vector<ll> bit1;
    vector<ll> bit2;
    BIT(int N):N(N) {
        /* BITは[1..N]で扱う */
        bit1.resize(N + 1, 0);
        bit2.resize(N + 1, 0);
    }
    
    void add1(int x, int val){
        while (x <= N) {
            bit1[x] += val;
            x += x & -x;
        }
    }
    void add2(int x, int val){
        while (x <= N) {
            bit2[x] += val;
            x += x & -x;
        }
    }
    
    // [l,r]
    void RangeAdd(int l,int r,int val){
        // Update BIT1
        add1(l,val);
        add1(r+1,-val);
        
        // Update BIT2
        add2(l,val*(l-1));
        add2(r+1,-val*r);
    }
    
    int sum1(int x){
        int ret = 0;
        while (x) {
            ret += bit1[x];
            x &= (x - 1);
        }
        return (ret);
    }
    
    int sum2(int x){
        int ret = 0;
        while (x) {
            ret += bit2[x];
            x &= (x - 1);
        }
        return (ret);
    }
    
    int sum(int x){
        return sum1(x)*x - sum2(x);
    }
    // [l,r]
    int RangeSum(int l,int r){
        return sum(r) - sum(l-1);
    }
};


int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int n,q; cin >> n >> q;
    
//    SegTree ST(n);
    BIT bit(n);
    while(q--){
        int com; cin >> com;
        if(com == 0){
            int s,t,x; cin >> s >> t >> x;
            bit.RangeAdd(s,t,x);
        }else{
            int i; cin >> i;
            cout << bit.RangeSum(i,i) << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 4424
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl '\n'
typedef long long ll;
//	Table is the complete reverse of dp
//	Always think of the pattern (LCM, GCD)
//	Be careful of unsigned
//	Think of a solution that gets TLE and optimize it
//	Use binary search
//	Solve on paper first
int n, m, k;
int **grid;
ll **dp[4];
int main()
{
    cin.tie(nullptr); ios_base::sync_with_stdio(0);
    cin >> n >> m >> k;
    for(int p = 0; p < 4; p++)
    	dp[p] = new ll*[n];
    grid = new int*[n];
    for(int i = 0; i < n; i++)
    {
        for(int p = 0; p < 4; p++)
        	dp[p][i] = new ll[m];
    	grid[i] = new int[m];
    	memset(grid[i], 0, m * 4);
    }
    for(int i = 0, r, c; i < k; i++)
    {
    	cin >> r >> c;
    	cin >> grid[r - 1][c - 1];
    }
	for(int i = n - 1; i >= 0; i--)
		for(int j = m - 1; j >= 0; j--)
			for(int rem = 0; rem <= 3; rem++)
    		{
    			ll& ret = dp[rem][i][j];
    			if(i == n - 1 && j == m - 1)
    				ret = (rem? grid[i][j]: 0);
    			else if(i == n - 1)
    			{
					ret = dp[rem][i][j + 1];
    				if(rem)
    					ret = max(ret, grid[i][j] + dp[rem - 1][i][j + 1]);
    			}
    			else if(j == m - 1)
    			{
    				ret = dp[3][i + 1][j];
    				if(rem)
    					ret += grid[i][j];
    			}
    			else
    			{
    				//	move right
    				ret = dp[rem][i][j + 1];
    				if(rem)
    				    ret = max(ret, grid[i][j] + dp[rem - 1][i][j + 1]);
    				//	move down
    				ret = max(ret, (rem? grid[i][j]: 0) + dp[3][i + 1][j]);
    			}
    		}
    cout << dp[3][0][0];
}


Measured memory_bytes: 320268
import java.util.*;
import java.awt.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(in);
        int size=1000000;
        long[] fact=new long[size];
        long[] inv=new long[size];
        fact[0]=1;
        inv[0]=1;
        long mod=1000000007;
        for (int i = 1; i < size; i++) {
            fact[i]=(fact[i-1]*i)%mod;
            inv[i]=power(fact[i],(int)mod-2)%mod;
        }
        //comb=fact[n]*inv[k]%mod*inv[n-k]%mod
        int n=sc.nextInt();
        int m=sc.nextInt();
        if(m==1){
            out.println(1);
        }else{
            HashMap<Integer,Integer> map=new HashMap<>();
            for (int i = 2; i <= m; i++) {
                while(m%i==0){
                    m/=i;
                    map.put(i,map.getOrDefault(i, 0)+1);
                }
            }
            long ans=1;
            for(int k:map.keySet()){
                ans=(ans%mod*fact[n-1+map.get(k)]%mod*inv[n-1]%mod*inv[map.get(k)]%mod)%mod;
            }
            out.println(ans);
        }
      }
    static long power(long x,int n){
        long mod=1000000007;
        long ans=1;
        while (n>0) {
            if((n&1)==1){
                ans=(ans%mod*x%mod)%mod;
            }
            x=(x%mod*x%mod)%mod;
            n>>=1;
        }
        return ans;
    }
}


Measured memory_bytes: 39764
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = n + 1;
    for(int i = 1; i < 60; i++){
        int now = (int)1 << i;
        if(n & now){
            int tmp = n % now;
            if(tmp != now - 1){
                chmin(ans, 1 + tmp);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3184
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
//#define int long long

signed main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> t(h + 2, vector<char>(w + 2, '#'));
    rep(i, h) rep(j, w) {
        cin >> t[i + 1][j + 1];
    }
    rep(i, h + 2) {
        rep(j, w + 2) cout << t[i][j];
        cout << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const int inf = int(1e10);
//const ll inf = ll(1e19);
const ll mod = pow(10, 9) + 7;

//a^nの計算(mod)
ll modpow(ll a, ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

vector<ll> f(3000, 0), g(3000, 0);
//nCkを前計算する
//nCk:= f[n] * g[n - k] * g[k]
void pre_comb(ll mod){
    f[0] = 1;g[0] = 1;
    for(int i = 1; i < 3000; i++){
        f[i] = (f[i - 1] * i) % mod;
        g[i] = modpow(f[i], mod - 2, mod);
    }
}

int s;
ll res = 0;
int main(){
    cin >> s;
    int s_unit = s/3;
    pre_comb(mod);

    rep(i, s_unit){
        ll temp = s - 3*(i + 1);
        ll temp1 = ((((f[temp + i] * g[temp]) %mod) * g[i]) %mod + mod) %mod;
        res = (res + temp1)%mod;
    }
    
    cout << res << endl;
}

Measured memory_bytes: 3688
#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
	int n, t;
	cin >> n >> t;

	vector<int> a(n);
	vector<int> b(n);

	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 0; i < n; i++)
	{
		int max = 0;
		for (int j = i+1; j < n; j++)
		{
			if(a[j]-a[i] > max )
			{
				max = a[j] - a[i];
			}
		}
		b[i] = max;
	}

	sort(b.begin(), b.end());

	int s_max = b[n-1];
	int counter = 1;

	for (int i = n-2; i >= 0; i--)
	{
		if(s_max == b[i])
			counter++;
		else
			break;
	}

	cout << counter << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdlib>
#include <cmath>
#include<stdio.h>
#include<queue>
#include<stack>
#include<set>
#define MAX 1000000000000000000LL
long long inf=1000000007;
using namespace std;
using ll=long long;


int main(){
    int n,m;
    cin>>n>>m;
    int ans=0;
    set<int> s;
    set<int> e;
    int a,b;
    for(int i=0; i<m; i++){
        cin>>a>>b;
        if(a==1){
            s.insert(b);
        }else if(b==1){
            s.insert(a);
        }else  if(a==n){
            e.insert(b);
        }else if(b==n){
            e.insert(a);
        }
    }
    for(auto itr = s.begin(); itr != s.end(); ++itr) {
        if(e.find(*itr)!=e.end()){
            ans=1;
            break;
        }
    }
    if(ans==1)cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;


int main() {
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    int u=0,c=0;
    rep(i,n) {
        cin >> p.at(i);
        if (i!=0){
            if (p.at(i)>p.at(i-1)) c++;
            else c=0;
            if (c==k-1) u++;
        }
    }
    set<int> s;
    rep(i,k){
        s.insert(p.at(i));
    }
    int ans=1;
    rep(i,n-k){
        auto it=s.begin();
        auto itt=s.end();
        itt--;
        if (p.at(i)==*it && p.at(i+k)>*itt) ans--;
        ans++;
        // cout << p.at(i) << " " << *it << " " << p.at(i+k) << " " << *itt << endl;
        s.erase(p.at(i));
        s.insert(p.at(i+k));

        // cout <<  i << " " << ans << endl;
    }
    if (u>1) ans-=u-1;
    cout << ans << endl;
}


Measured memory_bytes: 10368
N,M,C = map(int,input().split())
B = tuple(map(int,input().split()))
count = 0
for i in range(N):
    tmp = 0
    A = tuple(map(int,input().split()))
    for j in range(M):
        tmp += A[j]*B[j]
    if tmp + C > 0:
        count+=1
print(count)

Measured memory_bytes: 3316
//#include <cstdio>
#include <iostream>

#include <cstring>

#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cassert>

using namespace std;

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

const int MOD = 1e9 + 7;

int sum(const vector<llong>& PS, int L, int R) {
   L = max(L, 0);
   int res = PS[R];
   if (L > 0)
      res -= PS[L-1];
   if (res < 0)
      res += MOD;
   return res;
}

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   int N, K;
   cin >> N >> K;
   
   VI A(N+1);
   FOR(i, 1, N)
      cin >> A[i];
   
   VI DP(K+1);
   DP[0] = 1;
   FOR(i, 1, N) {
      vector<llong> PS(K+1);
      PS[0] = DP[0];
      FOR(k, 1, K)
         PS[k] = (PS[k-1] + DP[k]) % MOD;

      DP.assign(K+1, 0);
      
      for (int k = 0; k <= K; ++k) {
         DP[k] = sum(PS, k-A[i], k);
      }
   }
   
   cout << DP[K] << '\n';

   return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int dis[2005][2005];
int ans[2005];
int main()
{
    int n;
    int x,y;
    cin>>n>>x>>y;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            dis[i][j]=abs(i-j);
    dis[x][y]=1;
    for(int i=1;i<n;i++)
        for(int j=i+1;j<=n;j++)
        {
            dis[i][j]=min(dis[i][j],dis[i][x]+1+dis[y][j]);
        }
    for(int i=1;i<n;i++)
        for(int j=i+1;j<=n;j++)
            ans[dis[i][j]]++;
    for(int i=1;i<=n-1;i++)
        cout<<ans[i]<<endl;
	return 0;
}
/*
20 5
0 5 10 17 19
*/


Measured memory_bytes: 15872
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 100001
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
const double pi=acos(-1.0);

typedef pair<int, int> PII;

typedef vector<int> VI;

typedef vector<string> VS;

typedef vector<PII> VII;

typedef vector<VI> VVI;

typedef map<int,int> MPII;

typedef set<int> SETI;

typedef multiset<int> MSETI;

typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;

bool isPowerOfTwo (int x)
{
  /* First x in the below expression is
    for the case when x is 0 */
  return x && (!(x&(x-1)));
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
ll modInverse(ll n, ll p)
{
    return power(n, p-2, p);
}

// Returns nCr % p using Fermat's little
// theorem.
ll ncr(ll n, ll r,ll p)
{
   // Base case
   if (r==0)
      return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
}

vector<int> v[max1];

void dfs(int ans[],bool x[],int cnt[],int j,int c){
    x[j]=true;
  for(int i=0;i<v[j].size();i++){
        if(cnt[v[j][i]]>=c){ans[v[j][i]]=j;cnt[v[j][i]]=c;}
    if(x[v[j][i]]==false){
        ans[v[j][i]]=j;
        cnt[v[j][i]]=c;
        dfs(ans,x,cnt,v[j][i],c+1);
    }
  }
}
const int nm = 100002;
const ll inf = 1000000000000000000ll;

int n;
ll a[nm];
#define deg_to_rad(deg) (((deg) / 360) * 2 * PI)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
  	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
		if (!a[i]) {
			printf("0\n");
			return 0;
		}
	}
	ll res = 1;
	for (int i = 1; i <= n; ++i) {
		if (a[i] > inf / res) {
			printf("-1\n");
			return 0;
		}
		res *= a[i];
	}
	printf("%lld\n", res);
}


Measured memory_bytes: 6956
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
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; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
// const ll mod = 1000000007;
const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

bool solve(){
  ll n;cin>>n;
  ll ans=0;
  rep(i,n+1){
    if(i%3!=0 and i%5!=0)ans+=i;
  }
  cout<<ans<<endl;
  return false;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(30);
  solve();
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int k, x; scanf("%d%d", &k, &x);
	FOR(i, x-k+1, x+k) printf("%d ", i);
}


Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int sawo(int a,int b){
	if (a < b) return b - a;
	else       return a - b;
}


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

	int A = sawo(x,a), B = sawo(x,b);

	if (A < B) cout << "A" << endl;
	else cout << "B" << endl;



	return 0;
}

Measured memory_bytes: 256
def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1 + total_ls[n-1]:
        return f(n-1, x-1)
    else:
        return pati_ls[n-1] + 1 + f(n-1, x-2-total_ls[n-1])


n, x = map(int, input().split())

total_ls = [1]
pati_ls = [1]

for i in range(50):
    total_ls.append(3 + 2 * total_ls[-1])
    pati_ls.append(1 + 2 * pati_ls[-1])

print(f(n, x))


Measured memory_bytes: 9068
#include <iostream>
#include <queue>
#include <cstring>
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
using namespace std;
bool mem[52][52][52][52] = {{{{}}}};
struct S{
	int a,b,c,d,t;
};
int dx[4] = {-1,0,1,0};
int dy[4] = {0,1,0,-1};
void init() {
	memset(mem,0,sizeof(mem));
}
int main(){
	int x, y, tx, ty, kx, ky, k;
	while(cin >> x >> y, (x || y)) {
		int b[52][52] = {};
		init();
		cin >> tx >> ty >> kx >> ky;
		rep(i,y) {
			rep(j,x) {
				cin >> k;
				b[i+1][j+1] = 1-k;
			}
		}
		queue<S> q;
		S s = {tx,ty,kx,ky,0};
		q.push(s);
		while(!q.empty()) {
			S s = q.front();
			if(q.front().t >= 100) break;
			if(s.a==s.c&&s.b==s.d) break;
			q.pop();
			if(mem[s.a][s.b][s.c][s.d]++) continue;
			rep(i,4) {
				int na = s.a+dx[i], nb = s.b+dy[i], nc = s.c+dx[(i+2)%4], nd = s.d+dy[(i+2)%4];
				if(!b[nb][na]&&!b[nd][nc]) continue;
				if(!b[nb][na]) na = s.a, nb = s.b;
				if(!b[nd][nc]) nc = s.c, nd = s.d;
				S ns = {na, nb, nc, nd, s.t+1};
				q.push(ns);
			}
		}
		if(q.empty()) cout << "NA" << endl;
		else if(q.front().t >= 100) cout << "NA" << endl;
		else cout << q.front().t << endl;
	}
}

Measured memory_bytes: 9288
// https://atcoder.jp/contests/abc124/tasks/abc124_d

#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    ll ans = 0;
    string s;
    cin >> n >> k;
    cin >> s;

    // 0, 1が連続する数を保存
    vector<int> v0, v1;
    int a0 = 0, a1 = 0;
    // 先頭が０なら、１が０個として扱う
    if (s[0] == '0') {
        v1.push_back(0);
    }
    for (auto x : s) {
        if (x == '0') {
            if (a1 > 0) {
                v1.push_back(a1);
                a1 = 0;
            }
            a0++;
        } else {
            if (a0 > 0) {
                v0.push_back(a0);
                a0 = 0;
            }
            a1++;
        }
    }

    if (a0 > 0) {
        v0.push_back(a0);
    }
    if (a1 > 0) {
        v1.push_back(a1);
    }
    // 末尾が０なら、１が０個として扱う
    if (s[s.length() - 1] == '0') {
        v1.push_back(0);
    }
    v0.push_back(0);

    ll tmp = 0;
    for (int i = 0; i < k && i < v1.size(); i++) {
        tmp += v0[i] + v1[i];
    }
    if (k < v1.size()) {
        tmp += v1[k];
    }
    ans = max(ans, tmp);

    for (int i = k; i < v1.size() - 1; i++) {
        tmp -= v0[i - k];
        tmp -= v1[i - k];
        tmp += v0[i];
        if (i + 1 < v1.size()) {
            tmp += v1[i + 1];
        }
        ans = max(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}

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

int main()
{
    int a,b; 
    cin >> a >> b;
    if(a<b){
        cout << "a < b" << endl;
    }
    else if(a>b){
        cout << "a > b" << endl;
    }
    else{
        cout << "a == b" << endl;
    }
    return 0;
}


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

int main(){
  int H,W,K;
  cin >>H>>W>>K;
  vector<string> vec(H);
  for(int i=0;i<H;i++){
    cin >> vec[i];
  }
  int ans=0;
  for(int is=0;is<(1<<H);is++){
    for(int js=0;js<(1<<W);js++){
      int cnt=0;
      for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
          if(is>>i&1){
            continue;
          }
          if(js>>j&1){
            continue;
          }
          if(vec[i][j]=='#'){
            cnt++;
          }
            
        }
      }
      if(cnt==K){
        ans++;
      }
          
    }
  }
  cout << ans <<endl;
}

      

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int ans = 0;
  for(int i = 0; i < S.size() - 1; i++) {
    if(S[i] != S[i + 1]) { ans++; }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 512
import itertools as itr
import numpy as np

(h, w, k) = list(map(int, input().split(' ')))
field = [list(input()) for i in range(h)]

#print((h, w, k))
#print(field)

pattern_count = 0

for i in range(h):
    for j in range(w):
        r_combi = itr.combinations(range(h), i)
        for r in r_combi:
            c_combi = itr.combinations(range(w), j)
            for c in c_combi:
                row_deleted = np.delete(field, r, axis=0)
                deleted = np.delete(row_deleted, c, axis=1)
                count = np.sum(np.char.count(deleted, '#'))
                #print(r, c, count)
                if count == k:
                    pattern_count += 1

print(pattern_count)

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

void Main() {
    string s;
    cin >> s;
    int ans = 0;
    for (auto &&i : s) {
        if (i == '1') {
            ans += 1;
        }
    }
    cout << ans << endl;
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pl pair<ll, ll>
#define vl vector<ll>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define N 100005


int main()
{
    ll l,r;cin>>l>>r;
    if((r-l)>=2019)
    cout<<"0"<<"\n";
    else
    {
        ll mn=INT_MAX;
        for(ll i=l;i<r;i++)
        {
            for(ll j=i+1;j<=r;j++)
            {
                ll x=i*j;
                mn=min(mn,x%2019);
            }
        }
        cout<<mn<<"\n";
    }
}   

Measured memory_bytes: 3600
n,m,l=map(int,input().split())
A=[]
for i in range(n):
    A.append(list(map(int,input().split())))
B=[]
for k in range(m):
    B.append(list(map(int,input().split())))
C=[[0 for j in range(l)] for i in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j]+=A[i][k]*B[k][j]
for i in range(n):
    for j in range(l):
        if j!=l-1:
            print(C[i][j],end=' ')
        else:
            print(C[i][j],end='')
    print()


Measured memory_bytes: 7060
#include <iostream>
#include<bits/stdc++.h>
const int N=1e5+5;
const int M=1e7;
using namespace std;
int ss(int x)
{
        for(int i=2;i<=sqrt(x);i++)
            if(x%i==0) return 0;
        return 1;
}
int main()
{
    char s[105],t[105];
    long long a,b,k;
    cin>>a;
    for(int i=a;i<M;i++){
        if(ss(i)==1){
            cout<<i;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int[] x = new int[n];//ボールのx座標。y座標はインデックス＋1
		for(int i=0;i<n;i++) {
			x[i]=scan.nextInt();
		}
		int kyoriSum =0;
		//nとkのうちどちらがx[i]に近いか出す
		//近いほうの距離＊2の合計が求める答え。

		for (int i=0;i<n;i++) {
			int tikai = Math.min(k-x[i], x[i]);
					kyoriSum = kyoriSum + tikai*2;
		}
		System.out.println(kyoriSum);

	}

}


Measured memory_bytes: 21972
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let t = get!();
    let mut ans = 0;
    let mut ans = std::i64::MAX;
    for _ in 0..n {
    	let ci = get!();
        let ti = get!();
        if ti <= t && ci < ans {
            ans = ci;
        }
    }
    if ans == std::i64::MAX {
    	println!("TLE");
    } else {
    	println!("{}", ans);
    }
}

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

using namespace std;

#define forn for (ll i = 0; i < n; i++)
#define form for (ll j = 0; j < m; j++)
#define NO cout << "NO\n";
#define YES cout << "YES\n";
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for (ll i = a; i < b; i++)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

ll gcd(ll a, ll b){
    ll r;
    while (b != 0){
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}


ll *calc_z(string s){
    ll n = s.size();
    ll *z = new ll[n] {0};
    ll l = 0, r = 0;
    for (ll i = 1; i < n; i++){
        if (r >= i) z[i] = min(z[i-l], r-i+1);
        while (z[i]+i < n && s[z[i]] == s[z[i]+i]) z[i]++;
        if (i + z[i] - 1 > r){
            l = i;
            r = i+z[i]-1;
        }
    }
    return z;
}

ll find_lower(ll *a, ll n, ll v){
    ll l = -1, r = n;

    while (r>l+1){
        ll m = (l+r)/2;

        if (a[m] >= v) r = m;
        else l = m;
    }
    if (r == n) return n-1;
    if (a[r] == v) return r;
    return r == 0 ? 0 : r-1;
}

void init(){
}

int bin(int *p, int n, int x){
    int l = 0, r = n-1;
    while (r >= l){
        int m = (l+r)/2;
        if (p[m] == x) return m;
        if (p[m] > x) r = m-1;
        else l = m+1;
    }
    return -1;
}

void solve(){
    ll a, b;
    cin >> a >> b;
    cout << a*b << '\n';
}

int main(){
    //init();

    ios::sync_with_stdio(0);
    cin.tie(0);

    //ll t; cin >> t; while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back
#define pp pair<int,int>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define int long long
const int maxn = 2e5+1;
int tree[4*maxn];

void update(int idx,int val)
{
	idx+=maxn;
	tree[idx] = max(tree[idx],val);
	while(idx>1)
	{
		
		tree[idx>>1] = max(tree[idx],tree[idx^1]);
		idx>>=1;

	}
}
int query(int l,int r)
{
	int res = 0;l+=maxn,r+=maxn;
	while(l<r)
	{
		if(l%2) res = max(tree[l++],res);
		if(r%2) res = max(tree[--r],res);
		l>>=1,r>>=1;
	}
	return res;

}
main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt.txt","r",stdin);
	// freopen("output.txt.txt","w",stdout);
	// #endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	vi a(n),h(n);
	rep(i,0,n) cin>>h[i];
	rep(i,0,n) cin>>a[i];

	memset(tree,0,sizeof(tree));
	int ans = 0;
	rep(i,0,n)
	{
		int mx = query(1,h[i]);
		mx+=a[i];
	//b	cout<<mx<<endl;
		ans = max(ans,mx*1ll);

		update(h[i],mx);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int N,K;
	string s;
	cin >> N >> K >> s;
	K--;
	s[K] += 'a'-'A';
	cout << s << endl;
}


Measured memory_bytes: 256
s = input()
n = len(s)
sw = 0
if "C" in s:
    a = s.index("C")
    if "F" in s:
        b = s[::-1].index("F")
        b = n-1 - b
        if a < b:
            sw = 1
            
print(["No","Yes"][sw])

Measured memory_bytes: 8940
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll a, b;
  cin >> a >> b;
  if(a < 10 and b < 10 and a and b) {
  	cout << a*b << endl;
  } else {
  	cout << -1;
  }
  return 0;
} //good night.

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	int n, c=0, tmp;
	bool changed = false;
	cin >> n;
	REP(i, 0, n){
		cin >> tmp;
		if(!changed && i+1 == tmp){
			++c;
			changed = true;
		}
		else changed = false;
	}
	cout << c;

}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = long.Parse(Console.ReadLine());

            long amount = 100;

            int count = 0;

            do
            {
                count++;
                amount = (long)(((double)amount) * 1.01);
            }
            while (amount < x);

            Console.WriteLine(count);
        }
    }
}


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

using ll = long long;
using ull = unsigned long long;
const ll INF = 4e18;
const ll MOD = 1e9+7;

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

  double a[3], x[3], y[3], S, R;
  for (int i = 0; i < 3; i++) {
    cin >> x[i] >> y[i];
  }
  for (int i = 1; i < 3; i++) {
    x[i] -= x[0];
    y[i] -= y[0];
  }
  x[0] = 0;
  y[0] = 0;
  for (int i = 0; i < 3; i++) {
    a[i] = sqrt((x[i] - x[(i+1)%3]) * (x[i] - x[(i+1)%3]) + (y[i] - y[(i+1)%3]) * (y[i] - y[(i+1)%3]));
  }
  R = abs(x[1] * y[2] - x[2] * y[1]) / (a[0] + a[1] + a[2]);
  double l = 0, mx = max(a[0], max(a[1], a[2])), r = mx;
  for (int i = 0; i < 40; i++) {
    double mid = (l+r)/2;
    if (mid <= mx * R / (2 * R + mx)) {
      l = mid;
    } else {
      r = mid;
    }
  }
  cout << setprecision(20) << l << endl;
  return 0;
}


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

int main() {
  int n;
  int a[100];

  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i != 0) cout << ' ';
    cout << a[i];
  }
  cout << endl;

  for (int i = 1; i < n; i++) {
    int key = a[i];
    int j = i - 1;
    while (j >= 0 && a[j] > key) {
      a[j + 1] = a[j];
      j--;
    }
    a[j + 1] = key;

    for (int i = 0; i < n; i++) {
      if (i != 0) cout << ' ';
      cout << a[i];
    }
    cout << endl;
  }

  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());

  
  int z = 0;
  
  for (int i = 0; i < N-1; i++) { 
    if (vec.at(i) == vec.at(i+1))
      z++;
  }
 
  int answer = N-z;
  cout << answer <<  endl;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define MAX_N 1000
#define INF 1000000

bool compare_descend(const P& P1, const P& P2) {

  if (P1.first == P2.first) {
    return P1.second > P2.second;    
  }
  else {
    return P1.first > P2.first;
  }
  
}

int main() {

  // ---------------------
  // Input
  
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  vector<P> vr; // red
  vector<P> vb; // blue
  
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    vr.push_back( P(a, b) );
  }

  for (int i = 0; i < N; i++) {
    int c, d;
    cin >> c >> d;
    vb.push_back( P(c, d) );
  }

  // ---------------------
  // 

  sort(vr.begin(), vr.end());
  sort(vb.begin(), vb.end());
  
  int used_r[N];
  int used_b[N];
  fill(used_r, used_r + N, 0);
  fill(used_b, used_b + N, 0);
  
  int cnt = 0;
  
  for (int i = 0; i < vb.size(); i++) {
    int c = vb[i].first;
    int d = vb[i].second;

    int r_max_y = -1;
    int j_cand = INF;
    
    for (int j = 0; j < vr.size(); j++) {
      int a = vr[j].first;
      int b = vr[j].second;

      if (used_r[j] == 0 && c > a && d > b) {
	if(r_max_y < b) {
	  r_max_y = b;
	  j_cand = j;
	}
      }
    }

    if(j_cand != INF) {
      used_r[j_cand] = 1;
      cnt++;
    }
      
  }
  
  cout << cnt << endl;
  
  return 0;
  
}


Measured memory_bytes: 256
n = int(input())

def digitsum(x):
	tmp = x
	ans = 0
	while tmp > 0:
		ans += tmp % 10
		tmp /= 10

	return ans

ans = float("inf")
for i in range(1,(n/2)+1):
	ans = min(ans,digitsum(i) + digitsum(n-i))

print ans

Measured memory_bytes: 4100
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
//#include <cmath>
#include <vector>
//#include <string>
typedef long long LL;
using namespace std;

int main(){
    int n, m;
    LL tmp_a;
    LL tmp_b;
    LL tmp_c;
    LL ans = 0;
    LL size_b = 0;

    priority_queue<LL, vector<LL>, greater<LL>> a;
    vector<LL> b;
    vector<LL> c;

    cin >> n >> m;
    vector<size_t> indices(m);
    for(int i=0; i<n; i++){
        cin >> tmp_a;
        a.push(tmp_a);
    }

    for(int i=0; i<m; i++){
        cin >> tmp_b >> tmp_c;
        size_b += tmp_b;
        b.push_back(tmp_b);
        c.push_back(tmp_c);
    }
    if(size_b>n){
        size_b=n;
    }
    vector<LL> list_b(size_b);
    LL order_b = size_b;

    iota(indices.begin(), indices.end(), 0);
    sort(indices.begin(), indices.end(), [&c](size_t i1, size_t i2) {
        return c[i1] < c[i2];
    });

    //cout << size_b << endl;
    for(int i=0; i<m; i++){
        //cout << i << " " << order_b << " " << b[indices[m-1-i]] << endl;
        while(order_b>0 && b[indices[m-1-i]]>0){
            //cout << "test" << " " << size_b-order_b << endl;
            list_b[size_b-order_b] = c[indices[m-1-i]];
            order_b--;
            b[indices[m-1-i]]--;
        }
    }
    //for(int i=0; i<size_b; i++){
    //    cout << list_b[i] << endl;
    //}
    for(int i=0; i<size_b; i++){
        //cout << list_b[size_b-1-i] << " " << a.top() << endl;
        if(list_b[size_b-1-i]>a.top()){
            //cout << "test" << endl;
            a.pop();
            a.push(list_b[size_b-1-i]);
        }
    }
    for(int i=0; i<n; i++){
        //cout << a.top() << endl;
        ans += a.top();
        a.pop();
    }
    cout << ans << endl;
}

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

int main() {
	int n, aa = 0;
	string h;
	cin >> n >> h;
	for (int i = 1; i < n; ++i) {
		string s = h.substr(0, i);
		string m = h.substr(i);
		int cou = 0;
		for (char j = 'a'; j <= 'z'; ++j) {
			if (s.find(j) != -1 && m.find(j) != -1) ++cou;
		}
		aa = max(aa, cou);
	}
	cout << aa << endl;
}

Measured memory_bytes: 256
n,m,x=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
# print(a)
ans=10**18
for i in range(1<<n):
  t_money=0
  t_rikai=[0]*m
  ok=True
  for j in range(n):
    if i&(1<<j): 
      t_money+=a[j][0]
      for k in range(m):
        t_rikai[k]+=a[j][k+1]
  for y,r in enumerate(t_rikai):
    if r>=x:
      pass
    else:
      ok=False
      break
  if ok:
    ans=min(t_money,ans)
  
if ans==10**18:
  print(-1)
else:
  print(ans)


Measured memory_bytes: 8988
import heapq
import sys
def input():
    return sys.stdin.readline()[:-1]

# input
N, M = map(int, input().split())
a = []

for i in input().split():
    heapq.heappush(a, -int(i))

for j in range(M):
    highest = heapq.heappop(a)
    heapq.heappush(a, -(- highest // 2))

print(-sum(a))

Measured memory_bytes: 14184
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		int ans = 0;
		for(int i = 1; i <= n; i++) {
			int sum = 0;
			int tmp = i;
			while(tmp >= 10) {
				sum += tmp % 10;
				tmp /= 10;
			}
			sum += tmp;

			if(a <= sum && sum <= b)
				ans += i;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
use std::io;
fn main(){
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut iter = s.trim().split_whitespace();
    
    let a: u32 = iter.next().unwrap().parse().unwrap();
    let b: u32 = iter.next().unwrap().parse().unwrap();

    println!("{} {} {:.5}", a/b, a%b, a as f64/b as f64);
}


Measured memory_bytes: 5052
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

vector<string> split(const string &str, char delim) {
	vector<string> res;
	size_t current = 0, found;
	while((found = str.find_first_of(delim, current)) != string::npos) {
		res.push_back(string(str, current, found - current));
		current = found + 1;
	}
	res.push_back(string(str, current, str.size() - current));
	return res;
}

int formula(string& s, int& i) {
	if(s[i] == '(') {
		i++;
		int val = formula(s, i);

		char op = s[i];
		if(s[i] == '-' && s[i+1] == '>') {
			i++;
			op = s[i];
		}

		i++;
		int val2 = formula(s, i);

		int ret = 0;
		if(op == '+') {
			if(val || val2) ret = 1;
			else ret = 0;
		} else if(op == '*') {
			if(val && val2) ret = 1;
			else ret = 0;
		} else if(op == '>') {
			if(!val) ret = 1;
			else if(val2) ret = 1;
			else ret = 0;
		}

		i++;
		return ret;
	} else if(isdigit(s[i])) {
		int ret = s[i] - '0';
		i++;
		return ret;
	} else if(s[i] == '-') {
		i++;
		int ret = formula(s, i);

		if(ret == 0) return 1;
		else return 0;
	}
}

bool used[30];

int main() {
	string s;
	// cin >> s;
	//
	// int i = 0;
	// cout << formula(s, i) << endl;
	//
	// return 0;

	while(cin >> s) {
		if(s == "#") break;

		vector<string> ret = split(s, '=');
		string s1 = ret[0];
		string s2 = ret[1];

		bool flag = true;

		rep(i, 1<<11) {
			memset(used, 0, sizeof(used));
			rep(j, 11) {
				if(i & (1<<j)) used[j] = true;
			}

			string t1 = s1, t2 = s2;
			rep(j, t1.size()) {
				if('a' <= t1[j] && t1[j] <= 'k') {
					if(used[t1[j] - 'a']) t1[j] = 'T';
					else t1[j] = 'F';
				}

				if(t1[j] == 'T') t1[j] = '1';
				if(t1[j] == 'F') t1[j] = '0';
			}

			rep(j, t2.size()) {
				if('a' <= t2[j] && t2[j] <= 'k') {
					if(used[t2[j] - 'a']) t2[j] = 'T';
					else t2[j] = 'F';
				}

				if(t2[j] == 'T') t2[j] = '1';
				if(t2[j] == 'F') t2[j] = '0';
			}

			int j = 0, k = 0;
			int f1 = formula(t1, j);
			int f2 = formula(t2, k);

			// cout << t1 << " -> :: " << f1 << endl;
			// cout << t2 << " -> :: " << f2 << endl;

			if(f1 == f2) continue;

			flag = false;
			break;
		}

		if(flag) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 1240
s=list(input())
flg=1
n=len(s)
s_reverse=list(reversed(s))
if s!=s_reverse:
    flg=0
s_2=s[:int((n-1)/2)]
s_2_reverse=list(reversed(s_2))
if s_2!=s_2_reverse:
    flg=0
s_3=s[int((n+3)/2)-1:]
s_3_reverse=list(reversed(s_3))
if s_3!=s_3_reverse:
    flg=0
if flg==0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
a,b,c,d=map(int,input('').split(' '))
while(1):
    c=c-b
    if c<=0:
        s=1
        break
    
    a=a-d
    if a<=0:
        s=2
        break

if s==1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9180
/**
 * @author karayuu
 */

fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(" ").map { it.toInt() }

    print(k * pow(k - 1, n - 1))
}

fun pow(a: Int, b: Int) : Int = Math.pow(a.toDouble(), b.toDouble()).toInt()

/*
  1つ目はk色で塗れる。その先はk-1(隣の色を除く)で塗れるから
  k * (k - 1)^(n - 1)
 */

Measured memory_bytes: 37876
N, M = map(int, input().split())
imos = [0]*(N+1)
for _ in range(M):
    # ゲートの情報が入ってくる
    l, r = map(lambda x: int(x)-1, input().split())
    imos[l] += 1
    imos[r+1] -= 1  # rまでは有効であり、r+1以降が無向になる仕様であるのでr+1をデクリメントする

cumulative = [imos[0]]
for value in imos[1:]:
    cumulative.append(cumulative[-1]+value)
ans = 0
for c in cumulative:
    if c == M:
        ans += 1
print(ans)


Measured memory_bytes: 8876
inf=200000
n=int(input())
m=int(input())
adj=[[inf]*(n+1) for i in range(n+1)]
for i in range(m):
  a,b,c,d=map(int,input().split(sep=','))
  adj[a][b]=c
  adj[b][a]=d
s,g,v,p=map(int,input().split(sep=','))
for k in range(1,n+1):
  for i in range(1,n+1):
    for j in range(1,n+1):
      adj[i][j]=min(adj[i][j],adj[i][k]+adj[k][j])
ans=v-p
ans-=adj[s][g]
ans-=adj[g][s]
print(ans)


Measured memory_bytes: 5608
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
 
int main() {
  int n, sum = 0;
  REP(i, 10){
    cin >>n;
    sum += n;
  }
  cout <<sum <<endl;
  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main()
{
    int H, W;
    char a[100][100];

    scanf("%d%d",&H,&W);

    for (int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            scanf(" %c",&a[i][j]);
        }
    }

    for (int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            printf("%c",a[i][j]);
        }
        printf("\n");
        for(int j=0;j<W;j++){
            printf("%c",a[i][j]);
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>

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

using namespace std;

int main(){
    int k, ans = 0; cin >> k;
    int array[k]; REP(i, k) cin >> array[i];

    sort(array, array + k);

    int f = array[k/2 - 1], l = array[k/2];

    if(f != l)
        for(int i = f + 1; i <= l; i++) ans++;                         
    cout << ans;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  int N,M;
  cin>>N>>M;
  priority_queue<int>q;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    q.push(a);
  }
  for(int i=0;i<M;i++){
    int a=q.top();q.pop();
    q.push(a/2);
  }
  int64_t ans=0;
  for(int i=0;i<N;i++){
    ans+=q.top();q.pop();
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3904
#include <bits/stdc++.h>
#define ll long long
#define MAX 200005

using namespace std;

ll a[MAX];

int main()
{
//    ios_base::sync_with_stdio(false);
//    cin.tie(0);
	ll a,b;
	cin >> a >> b;
	ll b1=b*10,b2=(b+1)*10;
	b2--;
	ll a1=a*25,a2=(a+1)*25;
	if(a1%2==0){
		a1/=2;
	}
	else{
		a1=a1/2+1;
	}
	if(a2%2==0){
		a2=a2/2-1;
	}
	else{
		a2/=2;
	}
	if(a1>=b1&&a1<=b2){
		cout << a1 << endl;
	}
	else if(b1>=a1&&b1<=a2){
		cout << b1 << endl;
	}
	else{
		cout << -1 << endl;
	}
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int i,score,sum;

    sum=0;
    for(i=0;i<5;i++){
	scanf("%d",&score);
	if(score<40) sum+=40;
	else sum+=score;
    }

    printf("%d\n",sum/5);

    return 0;
}

Measured memory_bytes: 600