akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define INX(x) (cin >> x)
#define OUTX(x) (cout << x << endl)

#define ADD emplace_back
#define MP make_pair
#define VVEC(type) vector<vector<type>>


int main()
{
    string S, T;
    cin >> S >> T;

    ll max = 0;
    for (ll i = 0; i <= S.size() - T.size(); i++)
    {
        ll tmp = 0;
        for (ll j = 0; j < T.size(); j++)
        {
            if(S[i + j] == T[j])
            {
                tmp++;
            }
        }
        
        if(max < tmp)
        {
            max =  tmp;
            if(max == T.size())
            {
                break;
            }
        }
    }
    cout << T.size() - max << endl;




    return 0;
}


Measured memory_bytes: 3624
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}
int gcd(int a, int b) {
	if (a%b == 0)return b;
	else return gcd(b,a%b);
}

signed main(void)
{
	int a, b;
	cin >> a >> b;
	if (a == 2 || b == 2)print("No");
	else print("Yes");
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
	vec(A)
		ll N, K;
	cin >> N >> K;
	fx(N) {
		vecp(A)
	}
	ll ans = 0;
	fx(N) {
		ll sum = 0;
		fyg(N,x+1) {
			if (A.at(x)>A.at(y)) {
				sum++;
			}
		}
		ans += sum*K;
		ans %= MOD;
		ll sum2 = (K*(K - 1) / 2) % MOD;
		ans += (sum*sum2)%MOD;
		ans %= MOD;

		sum = 0;
		fy(x) {
			if (A.at(y)<A.at(x)) {
				sum++;
			}
		}
		//ans += sum*(K-1);
		ans %= MOD;
		ans += (sum*sum2) % MOD;
		ans %= MOD;

	}
	ce(ans)
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  vector<bool>dp((int)s.size()+1213,0);
  int n=s.size();
  dp.at(0)=1;
  for(int i=0;i<n;++i){
    if(dp.at(i)==0)continue;
    if(i+5<=n && s.substr(i,5)=="dream")dp.at(i+5)=1;
    if(i+7<=n && s.substr(i,7)=="dreamer")dp.at(i+7)=1;
    if(i+5<=n && s.substr(i,5)=="erase")dp.at(i+5)=1;
    if(i+6<=n && s.substr(i,6)=="eraser")dp.at(i+6)=1;
  }
  if(dp.at(n))cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main(){
    int n,m;
    cin>>n>>m;
    
    vector<vector<pair<int,int>>>v(n,vector<pair<int,int>>());
    for (int i = 0; i < m; i++)
    {
        int p,y;
        cin>>p>>y;
        p--;
        v[p].push_back({y,i});
    }
    for (int i = 0; i < n; i++)
    {
        sort(ALL(v[i]));
    }
    vector<pair<int,int>>ans(m);
    //show(v[0]);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < v[i].size(); j++)
        {
            ans[v[i][j].second].first=i+1;
            ans[v[i][j].second].second=j+1;
        }
        
    }
   //show(ans);
   for (int i = 0; i < m; i++)
   {
     cout << setfill('0') << right << setw(6) <<ans[i].first;
     cout << setfill('0') << right << setw(6) <<ans[i].second<<endl;
     
   }
   
    
    

    return 0;
}

Measured memory_bytes: 8576
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ABC101C
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {

            var N = cin.ReadInt;
            var K = cin.ReadInt;
            var A = cin.ReadIntArray(N);

            var ans = Ceiling(((decimal)N - 1) / ((decimal)K - 1));
            Console.WriteLine(ans);

        }
    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


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


if N<=2:
    print(0)
    exit()

ans =0

for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if (L[i]-L[j])*(L[j]-L[k])*(L[i]-L[k]) != 0 and L[i]+L[j]>L[k] and L[j]+L[k]>L[i] and L[k]+L[i]>L[j]:
                ans += 1

print(ans)


Measured memory_bytes: 9192
#include <stdio.h>

int main(void) {
	
	char str[1];
	
	//int sum;
	
	scanf("%s", str);
	//printf("%s",str);
	
	if('A'==str[0])printf("T");
	if(str[0]=='C')printf("G");
	if(str[0]=='G')printf("C");
	if(str[0]=='T')printf("A");
	
	return 0;
}



Measured memory_bytes: 128
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#include <cmath>
#include <ctgmath>
#include <math.h>
#include <cassert>
#include <chrono>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define GFOR(i,a,n) for (i=a;i<n;i++)
#define FOR(i,a,n) for (int i=a;i<n;i++)
#define RFOR(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 fi first
#define se second
#define sz(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<long long int> vll;
typedef vector<pair<int, int> > vpi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

void solve() {
    int n;
    cin >> n;
    cout << (1000 - n%1000)%1000 << "\n";
}

int main() {
    #ifdef LOCAL
    auto t1 = std::chrono::high_resolution_clock::now();
    #endif

    io;
    int t = 1;
    tc(t) {
        solve();
    }

    #ifdef LOCAL
    auto t2 = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>( t2 - t1 ).count();

    std::cout << "Time Taken: " << duration << "\n";
    #endif

}
//check for edge cases in limits
//printing double may print 1.223232e9 like values, beware of that


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

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

  int c = a+b;
  if (c%2 == 0) 
    ans = c/2;
  else
    ans = (c+1)/2;
  cout<<ans<<endl;

  return 0;
}


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

int main(void){
    int N, M, Abuf, Bbuf;
    vector<vector<int>> Friendship;
    vector<bool> Checked;
    vector<int> CommunitySize;
    int res = 0;

    cin >> N >> M;
    Friendship.assign(N, vector<int>(0));
    Checked.assign(N, false);
    CommunitySize.assign(N, 0);
    for(int i=0; i<M; i++){
        cin >> Abuf >> Bbuf;
        Abuf--;
        Bbuf--;
        Friendship[Abuf].push_back(Bbuf);
        Friendship[Bbuf].push_back(Abuf);
    }
    for(int imember=0; imember<N; imember++){
        if(Checked[imember])continue;
        Checked[imember]=true;
        queue<int> que;
        que.push(imember);
        while(!que.empty()){
            int curmember = que.front();
            que.pop();
            CommunitySize[imember]++;
            for(int nxtmember: Friendship[curmember]){
                if(Checked[nxtmember])continue;
                que.push(nxtmember);
                Checked[nxtmember]=true;
            }
        }
        if(res < CommunitySize[imember])res = CommunitySize[imember];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 15604
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
#define INF 1<<30

int main()
{
    int N;
    cin >> N;
    vector<int> W(N);
    REP(i,N)cin >> W[i];
    int Tl = 0;
    int Tr = accumulate(W.begin(),W.end(),0);
    int D = Tr-Tl;
    int minD = abs(D);
    REP(i,N){
        D -= W[i]*2;
        if(abs(D)<minD)minD = abs(D);
    }
    cout << minD << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

int main(void){
  ll x;
  cin >> x;
  
  if (x >= 30)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3524
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	int H, W;
	cin >> H >> W;
	const int inf = 100000000;
	vector<vector<int>> cost(10, vector<int>(10, inf));
	for(int i = 0; i < 10; i ++){
		for(int j = 0; j < 10; j ++){
			cin >> cost[i][j];
		}
	}
	for(int mid = 0; mid < 10; mid ++){
		for(int from = 0; from < 10; from ++){
			for(int to = 0; to < 10; to ++){
				cost[from][to] = min(cost[from][to], cost[from][mid] + cost[mid][to]);
			}
		}
	}
	ll a, ans = 0;
	for(int i = 0; i < H; i ++){
		for(int j = 0; j < W; j ++){
			cin >> a;
			if(a != -1){
				ans += cost[a][1];
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
int mod=int(1e9)+7;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    string s;
    cin>>s;
    if(s=="RRR"){
    	cout<<3<<endl;
    }
    if(s=="RRS"||s=="SRR"){
    	cout<<2<<endl;
    }
    if(s=="RSR"||s=="RSS"||s=="SRS"||s=="SSR"){
    	cout<<1<<endl;
    }
    if(s=="SSS"){
    	cout<<0<<endl;
    }
}

Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll x, y;
    cin >> x >> y;
    bool ans = false;
    for(ll i = 0; i <= x; i++) {
        ll j = x - i;
        if(2 * i + 4 * j == y) ans = true;
    }
    cout << (ans ? "Yes" : "No") << endl;
    return;
}

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

Measured memory_bytes: 3688
#include <iostream>


using namespace std;


int main()
{
   int i,h,m,s;
   cin >> i;
   h = i / 3600;
   m = i /60-h*60;
   s = i-h*3600-m*60;
   cout << h <<":"<<m<<":"<<s<<endl; 
   
   return  0;
}
   


Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>

#include <map>

using namespace std;
map<char,int> m;

int main()
{
    int n,ans;
    while(cin>>n)
    {
        ans=0;
        m.clear();
        while(n--)
        {
            char c;
            cin>>c;
            if(!m[c])
                m[c]++,ans++;
        }
        if(ans==3)
            cout<<"Three"<<endl;
        else if(ans==4)
            cout<<"Four"<<endl;
    }
    return 0;
}


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

using namespace std;
#define FAST ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'

int main(){
    //FAST
    int a,b;
    cin>>a>>b;
    if(b==1){
        cout<<0<<endl;
        return 0;
    }
    int cnt=a;
    int tap=1;
    while(cnt<b){
        cnt+=a-1;
        tap++;
    }
    cout<<tap<<endl;
}

Measured memory_bytes: 3588
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
// #include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#include <cassert>
#include<unordered_set>
using namespace std;

 
int main(){
    unsigned long long int n, k;
    cin >> n >> k;

    n = n%k;
    n = min(n, k-n);

    cout << n << endl;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10**9)
mod = 998244353

def main():
    N, S = map(int, input().split())
    A = list(map(int, input().split()))
    
    """
    maspyさんの多項式解法も試してみる。
    例えばA = [2, 2, 4]の場合、
        f({1, 2, 3}) = [x^S](1 + x^2)(1 + x^2)(1 + x^4)
        f({1, 2})    = [x^S](1 + x^2)(1 + x^2)
    よって求める答えはf_i = (1 + x^{A[i]})として
        [x^S](f_1 f_2 f_3 + f_1 f_2 + f_2 f_3 + f_3 f_1 + f_1 + f_2 + f_3)
    となる。
    さらにS >= 1なのでこれに1を足しても結果は変わらない。なので因数分解して
        [x^S](1 + f_1)(1 + f_2)(1 + f_3)
    を求めればよい。
    """

    poly = [0] * (S + 1) # poly[i] = (x^iの係数)
    poly[0] = 1
    for a in A:
        # poly *= (2 + x^a)
        poly2 = [poly[i] * 2 % mod for i in range(S + 1)]
        for i in range(S + 1):
            if i + a <= S:
                poly2[i + a] += poly[i]
                poly2[i + a] %= mod
        poly = poly2
    print(poly[S])
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 71948
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int conv(int a,int L)
{
  vector<int> v(L);
  for(int i=0; i<L; i++){
    v[i] = a % 10;
    a /= 10;
  }
  sort(v.begin(),v.end());
  int max = 0;
  for(vector<int>::reverse_iterator p = v.rbegin(); p!=v.rend(); p++){
    max *= 10;
    max += *p;
  }
  int min = 0;
  for(vector<int>::iterator p = v.begin(); p!=v.end(); p++){
    min *= 10;
    min += *p;
  }
  return max - min;
}
int main()
{
  for(;;){
    int a,L;
    cin >> a >> L;
    if(a == 0 && L == 0) break;
    vector<int> v;
    v.push_back(a);
    int tar = a;
    int j = 1;
    while(j <= 20){
      tar = conv(tar,L);
      bool bfind = false;
      for(int i=0; i<v.size(); i++){
        if(v[i] == tar){
          cout << i << " " << tar << " " << j-i << endl;
          bfind = true;
          break;
        }
      }
      if(bfind) break;
      v.push_back(tar);
      j++;
    }
  }
  return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int h, n;
  cin>>h>>n;
  int a[n], b[n];
  REP(i,n){
    cin>>a[i]>>b[i];
  }
  int dp[h+1][n];
  fill(dp[0], dp[h+1], 1'000'000'000);
  REP(i,n){
    REP(j,h+1){
      if(j == 0){
        dp[j][i] = 0;
        continue;
      }
      if(i == 0){
        dp[j][i] = ((j + a[i] - 1)/a[i]) * b[i];
        continue;
      }
      dp[j][i] = min(dp[j][i], dp[j][i-1]);
      if(j - a[i] >= 0){
        dp[j][i] = min(dp[j][i], dp[j-a[i]][i] + b[i]);
      }else{
        dp[j][i] = min(dp[j][i], b[i]);
      }
    }
  }
  int ans = dp[h][n-1];
  cout<<ans<<endl;    
  return 0;
}


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

bool f(int n){
  bool ans = false;
  int a[3];
  for(int i = 0; i < 3; i++){
    a[i] = n % 10;
    n /= 10;
  }
  if(a[0] == a[1] && a[1]  == a[2]) ans = true;
  return ans;
}

int main(void){
  int n;
  cin >> n;
  bool flag = false;
  while(1){
    if(f(n)){
      cout << n << endl;
      return 0;
    }
    n++;
  }
  return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// x ** n % mods を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// (1/n) % mods を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCk % mods を求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}


fn main() {
    input!{
        r: f64,
    }
    println!("{}", 6.28318530717958623200 * r);
}


Measured memory_bytes: 2192
N = int(input())
A = []
B = []
for i in range(N):
  a,b = map(int, input().split())
  A.append(a)
  B.append(b)

A = sorted(A)
B = sorted(B)
 
if N%2==1:
  print(B[N//2] - A[N//2] + 1)
else:
  print( (B[N//2-1]+B[N//2]) - (A[N//2-1]+A[N//2]) + 1 )


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int m;
    cin >> m;
    rep(i,m){
        int d, t;
        cin>>d>>t;
        d--;
        int ans=0;
        rep(j,n){
            if(j==d){
                ans+=t;
            }else{
                ans+=a[j];
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
<?php 
fscanf(STDIN, "%d", $a);
fscanf(STDIN, "%d", $b);

if($a+$b == 3){
  echo "3";
}elseif ($a+$b == 4) {
  echo "2";
}elseif ($a+$b == 5) {
  echo "1";
}

 ?>

Measured memory_bytes: 3700
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);

		if (Math.abs(n - m) >= 2) {
			System.out.println("0");
		} else if (Math.abs(n - m) == 1) {
			System.out.println((factorial(n) * factorial(m)) % 1000000007);
		} else {
			System.out.println((2 * factorial(n) * factorial(m)) % 1000000007);
		}
	}

	static long factorial(int n) {
		long a = 1;

		for (int i = 1; i <= n; i++) {
			a *= i;
			a %= 1000000007;
		}
		return a;
	}
}

Measured memory_bytes: 21588
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
$debug=0
N=80
def aux(a, b)
  nmax = (a.length > b.length) ? a.length : b.length
  c = [0]

  nmax.times{|i|
    puts "a,b: #{a[i]},#{b[i]}" if $debug>0
    x =  c[i]
    x += a[i] if i < a.length
    x += b[i] if i < b.length
    c[i] = x % 10
    c[i+1] = x / 10
  }

  c.pop if c[-1]==0

  return c

end

def main
  fh=STDIN
  n = fh.gets.chomp.to_i
  n.times {|i|
    a=fh.gets.strip.split(//).reverse.map(&:to_i)
    b=fh.gets.strip.split(//).reverse.map(&:to_i)
    if a.length>N or b.length>N
      puts "overflow"
      next
    end
    puts "a: #{a}" if $debug>3
    puts "b: #{b}" if $debug>3
    c=aux(a,b)
    s=c.reverse.join("")
    if s.length>N
      puts "overflow"
      puts "s: #{s}" if $debug>1
    else
      puts s
    end
  }

end

if $0 == __FILE__ then
  main
end



Measured memory_bytes: 6900
#include<bits/stdc++.h>
//#include<inttypes.h>//__int64,__int128..
#define MAX_N 100005
//vector&pair
#define pb push_back
#define mp make_pair
//math
#define sq(x) ((x)*(x))
#define abs(x) ((x)>0?(x):(-(x)))//Regardless of type
//for pair
#define fi first
#define se second
//infinit
#define LL_inf (1LL<<60)
#define full_inf 0x7fffffff
#define half_inf 0x3fffffff
//MOD
#define MOD 1000000007LL*/
using namespace std;
//type
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pil;
typedef long double LD;
LL n,m,d;
int main(){
	//write on your code!
	scanf("%lld %lld %lld",&n,&m,&d);
	printf("%.8Lf\n",(LD)((LD)((m-1)*(d?(2*(n-d)):n))/(LD)(n*n)));
	return 0;
}

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

using namespace std;

int N, K;
int H[100000];
int dp[100000];
int INF = 1145141919;

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++)cin >> H[i];
	dp[0] = 0;
	for (int i = 1; i < N; i++) {
		dp[i] = INF;
	}
	for (int i = 1; i < N; i++) {
		for (int j = 1; j <= K; j++) {
			if (i - j >= 0)dp[i] = min(dp[i], dp[i - j] + abs(H[i] - H[i - j]));
		}
	}
	cout << dp[N - 1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	char s;
	cin >> s;
	if (isupper(s))
	{
		cout << "A" << endl;
	}
	else
	{
		cout << "a" << endl;
	}
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld ;
#define pb push_back
#define fi first
#define se second
const int N = 3e6+5;
ll a[N];
ll b[N];
bool vis[N];
void solve(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    for(int i=0;i<1000;i++){
        if(i%2==0){
            c-=b;
        }
        else{
            a-=d;
        }
        if(a<=0){
            cout<<"No"<<endl;
            return;
        }
        if(c<=0){
            cout<<"Yes"<<endl;
            return ;
        }
    }
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//    preprocess();
    int t =1;
 //   cin>>t;
    while(t--)solve();
    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n-1; i >= 0; i--)
#define FOR(i, n, m) for(int i = n; i < (int)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18

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

ll MOD = 1000000007;

// union by size + path having
class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> p(N);
    REP(i, N) cin >> p[i];
    UnionFind uf(N);
    REP(i, M) {
        ll x, y;
        cin >> x >> y;
        x--; y--;
        uf.merge(p[x]-1, p[y]-1);
    }
    ll cnt = 0;
    REP(i, N) {
        if (!uf.issame(i, p[i]-1)) cnt++;
    }
    PRINT(N - cnt);
    return 0;
}


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

int main(){
  int N,K,R,S,P;
  cin>>N>>K>>R>>S>>P;
  string T;

  //必勝になるように読み込む
  char buf;
  for(int i=0; i<N; i++){
    cin>>buf;
    switch(buf){
      case 'r': T.push_back('p'); break;
      case 's': T.push_back('r'); break;
      case 'p': T.push_back('s'); break;
    }
  }

  //K前と比較して同じなら'n'なんらかの違う手にする
  for(int i=K; i<N; i++){
    if(T[i] == T[i-K])T[i] = 'n';
  }

  //得点計算
  ll point = 0;
  for(int i=0; i<N; i++){
    switch(T[i]){
      case 'r': point+=R; break;
      case 's': point+=S; break;
      case 'p': point+=P; break;
      case 'n': break;
    }
  }

  cout<<point<<endl;
}

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

const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;



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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int t = sc.nextInt();
		int a = sc.nextInt();
		int[] h = new int[n];

		for (int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		double bestTemp = Math.abs((t-h[0]*0.006) - a);
		int num = 1;

		for (int i = 1; i < n; i++) {
			if (Math.abs((t-h[i]*0.006) - a) < bestTemp) {
				bestTemp = Math.abs((t-h[i]*0.006) - a);
				num = i + 1;
			}
		}

		System.out.println(num);

	}
}

Measured memory_bytes: 22484
//بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;

#define endl "\n"

const int MOD = 1000000007;


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

    int a;
    cin >> a;
    ull x = 1;
    for(int i = 2; i <= a; i++){
        x = (x*i)%MOD;
    }
    cout << x % MOD << endl;
    return 0;
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }

ll dist(pair<ll,ll> pa , pair<ll,ll> pb){
    return abs(pa.first-pb.first) + abs(pa.second - pb.second);
}

//ミョ(-ω- ?)
int main() {
    ll n,m;
    cin >> n >> m;
    vector<pair<ll,ll>> vn(n);
    vector<pair<ll,ll>> vm(m);
    rep(i,n){
        int a,b;
        cin >> a >> b;
        vn[i] = make_pair(a,b);
    }
    rep(i,m){
        int a,b;
        cin >> a >> b;
        vm[i] = make_pair(a,b);
    }
    ll ans = 0;
    rep(i,n){
        ll dis = LONG_LONG_MAX;
        ll check = -1;
        rep(j,m){
            if(dis > dist(vn[i],vm[j]))check = j;
            dis = min(dis,dist(vn[i],vm[j]));
        }
        cout << check+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000003
#define LINF 1000000000000000007LL
#define ll long long
using namespace std;
int ka[2145140],inv[2145140];
void setkaijo(int n){
	ka[0]=1;
	for(int i=1;i<=n;i++){
		ka[i] = ka[i-1] * i;
		ka[i] %= inf;
	}
}
int modpow(int x,int k){
	// x ^ k mod inf
	int p2[55],res=1;
	p2[0]=1;p2[1]=x%inf;
	for(int i=2;i<=50;i++){
		p2[i]=p2[i-1]*p2[i-1];
		p2[i] %= inf;
	}
	for(int i=1;i<=50;i++){
		if(k%2==1){
			res *= p2[i];
			res %= inf;
		}
		k /= 2;
	}
	return res;
}
void setinv(int n){
	for(int i=0;i<=n;i++){
		inv[i] = modpow(ka[i],(ll)inf-2);
	}
}
int comb(int n,int k){
	if( k<0 || n<0 || k>n)return 0;
	if(k==0 || k==n)return 1;
	int res = (ka[n] * inv[k]) % inf;
	res = (res*inv[n-k]) % inf;
	return res;
}

signed main(){
	int q;
	setkaijo(2100000);
	setinv(2100000);
	cin>>q;
	for(int i=0;i<q;i++){
		int x,d,n;
		cin>>x>>d>>n;
		if( d == 0 ){
			cout<<(modpow(x,n)%inf)<<endl;
		}
		else{
			int st = ( x * modpow(d,(ll)inf-2) ) % inf;
			int go = st + n - 1;
			if( go >= inf ){
				cout<<0<<endl;
			}
			else{
				int tmp = (ka[go]*inv[st-1])%inf;
				tmp *= modpow(d,n);
				tmp %= inf;
				cout<<tmp<<endl;
			}
		}
	}		
	return 0;
}

Measured memory_bytes: 34048
array_length = int(input())
input_line = input().split()

array_int = list(map(int, input_line))
array_bin = list(map(bin, array_int))
array_bin_str = list(map(str, array_bin))

array_dividable = []

for i in range(0, array_length):
    if array_int[i] == 0:
        array_dividable.append(0)
    else:
        target_line = array_bin_str[i]
        count_dividable = 0
        for j in range(1, len(target_line)):
            target_char = target_line[-j]
            if target_char == '1':
                break
            elif target_char == 'b':
                break
            else:
                count_dividable += 1

        array_dividable.append(count_dividable)

if sum(array_dividable) == 0:
    print("0")
else:
    print(str(sum(array_dividable)))



Measured memory_bytes: 5548
N, K = map(int, input().split(' '))
V = list(map(int, input().split(' ')))

# 何もしないパターン
maxScore = 0
for p in range(K+1):
    # d回戻す
    for l in range(K+1-p):
        if l > N:
            continue
        for r in range(K+1-p-l):
            if l + r > N:
                continue
            d = K  - p - l - r
            if d < 0:
                continue
            if d > l + r:
                continue
            Vs = V[0:l]
            Vs += V[-r:] if r > 0 else []
            Vs.sort()
            score = sum(Vs[d:])
            maxScore = max(score, maxScore)
print(maxScore)


Measured memory_bytes: 3064
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        for(int i = 0; i < s.length() - 1; i++){
            if(s.charAt(i) == s.charAt(i + 1)){
                System.out.println("Bad");
                System.exit(0);
            }
        }
        System.out.println("Good");
    }
}

Measured memory_bytes: 21844
a, b, k = gets.split.map(&:to_i)
n = b-a+1
if n <= k * 2
  for m in a..b do
    puts m
  end
else
  arr = []
  for i in a..(a + k -1) do
    arr << i
  end
  for j in (b-k+1)..b do
    arr << j
  end
  arr.sort.each do |ii|
    puts ii
  end
end

Measured memory_bytes: 1788
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        System.out.println(m+Math.max(0,10-n)*100);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
    
    public double[] nextDoubleArray(int n) {
        double[] a = new double[n];
        for (int i = 0; i < n; i++)
            a[i] = nextDouble();
        return a;
    } 
}


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


using namespace std;

int main() {
    int n, a, b, ans = 0;
    cin >> n >> a >> b;

    for (int i = 0; i <= n; ++i) {
        int k = i;
        int sum = k % 10;
        k /= 10;
        while (k) {
            sum += k % 10;
            k /= 10;
        }
        if (a <= sum && sum <= b) {
            ans += i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){

  string s;
  cin >> s;
  char c;
  for (int i = 97; i < 97 + 26; i++){
    c = (char)i;
    if (s.find(c) == string::npos){
      cout << c << endl;
      return 0;
    }
  }

  cout << "None" << endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

class mll
{
public:
  ll x;
  constexpr mll(ll x = 0) : x((x % MOD + MOD) % MOD) {}
  constexpr mll operator-() const
  {
    return mll(-x);
  }
  constexpr mll& operator+=(const mll& a)
  {
    x += a.x;
    if (x >= MOD)
      x -= MOD;
    return *this;
  }
  constexpr mll& operator-=(const mll& a)
  {
    x += MOD - a.x;
    if (x >= MOD)
      x -= MOD;
    return *this;
  }
  constexpr mll& operator*=(const mll& a)
  {
    x *= a.x;
    x %= MOD;
    return *this;
  }
  constexpr mll operator+(const mll& a) const
  {
    mll ret(*this);
    ret += a;
    return ret;
  }
  constexpr mll operator-(const mll& a) const
  {
    mll ret(*this);
    ret -= a;
    return ret;
  }
  constexpr mll operator*(const mll& a) const
  {
    mll ret(*this);
    ret *= a;
    return ret;
  }
  constexpr mll pow(ll t) const
  {
    mll ret = 1;
    mll a = *this;
    while (t > 0)
    {
      if (t % 2 == 1)
        ret *= a;
      
      a *= a;
      t /= 2;
    }
    return ret;
  }
  constexpr mll inv() const
  {
    return pow(MOD - 2);
  }
  constexpr mll& operator/=(const mll& a)
  {
    return (*this) *= a.inv();
  }
  constexpr mll operator/(const mll& a) const
  {
    mll ret(*this);
    ret /= a;
    return ret;
  }
};
ostream& operator<<(ostream& os, const mll& m)
{
  os << m.x;
  return os;
}
mll modpow(mll a, ll n)
{
  return a.pow(n);
}
class mllcombination
{
public:
  vector<mll> fac, finv, inv;

  mllcombination(ll M)
  {
    fac.resize(M + 1);
    finv.resize(M + 1);
    inv.resize(M + 1);

    fac.at(0) = 1, finv.at(0) = 1;
    fac.at(1) = 1, finv.at(1) = 1, inv.at(1) = 1;

    for (ll i = 2; i <= M; i++)
    {
      fac.at(i) = fac.at(i - 1) * i;
      inv.at(i) = -inv.at(MOD % i) * (MOD / i);
      finv.at(i) = finv.at(i - 1) * inv.at(i);
    }
  }

  mll P(ll N, ll K)
  {
    if (N < K) return 0;
    if (N < 0 || K < 0) return 0;
    return fac.at(N) * finv.at(N - K);
  }

  mll C(ll N, ll K)
  {
    if (N < K) return 0;
    if (N < 0 || K < 0) return 0;
    return fac.at(N) * finv.at(K) * finv.at(N - K);
  }

  mll H(ll N, ll K)
  {
    return C(N + K - 1, K);
  }
};

int main()
{
  ll B, W;
  cin >> B >> W;

  mllcombination com(B + W);

  mll P = 0, Q = 0;
  for (ll i = 0; i < B + W; i++)
  {
    mll ans = ((mll)1 - P + Q) / 2;
    cout << ans << '\n';

    P += com.C(i, B - 1) * modpow((mll)1 / 2, i + 1);
    Q += com.C(i, W - 1) * modpow((mll)1 / 2, i + 1);
  }
}

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

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

#define pb push_back
#define in ,
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  string a;
  int n = 0, w = 0, s = 0, e = 0;
  cin >> a;

  rep(i, 0, a.length()) {
    if(a[i] == 'N') n = true;
    else if(a[i] == 'W') w = true;
    else if(a[i] == 'S') s = true;
    else e = true;
  }

  cout << (n == s && w == e ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
#include<unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

#define MOD 1000000007

lli inv(lli a){ // a * a^(MOD-2) = 1
	lli b[30];
	b[0] = a;
	rep(i, 29) b[i+1] = (b[i]*b[i]) % MOD;
	lli ret = 1;
	int j = MOD - 2;
	rep(i, 30) if(1&(j>>i)) ret = (ret*b[i])%MOD;
	return ret;
}

lli comb(lli m, lli n){ // mCn
	if(n == 0) return 1;
	lli ret = 1;
	n = min(m-n, n);
	reg(i, m-n+1, m) ret = (ret * i) % MOD;
	reg(i, 1, n) ret = (ret * inv(lli(i))) % MOD;
	return ret;
}

int main(void){
	lli h, w, a, b; cin >> h >> w >> a >> b;
		
	lli ans = 0;
	lli s = comb(h-a-1+b, h-a-1);
	lli t = comb(a-1+w-b-1, a-1);
	rep(i, w - b){
		ans = (ans + (s*t)%MOD) % MOD;
		s = (s*(((h-a+b+i)*inv(lli(b+1+i)))%MOD))%MOD;
		t = (t*((inv(lli(a-2+w-b-i))*(w-b-i-1))%MOD))%MOD;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, s, e) for (int i = s; i < e; i++)
#define endl '\n'
int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int t_a = C / B;
    if (C % B != 0)
        t_a++;
    int a_t = A / D;
    if (A % D != 0)
        a_t++;
    if (t_a <= a_t)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;

int dp[101][4][4][4];

int main() {
    ll n;
    cin>>n;
    dp[0][3][3][3]=true;
    rep(i,n+1){
        rep(c1,4){
            rep(c2,4){
                rep(c3,4){
                    if(dp[i][c1][c2][c3]==0)continue;

                    rep(a,4) {
                        if (a == 2 && c1 == 0 && c2 == 1)continue;
                        if(a==1&&c1==2&&c2==0){continue;}
                        if(a==2&&c1==1&&c2==0)continue;
                        if(a==2&&c1==1&&c3==0)continue;
                        if(a==2&&c2==1&&c3==0)continue;
                        dp[i+1][a][c1][c2]+=dp[i][c1][c2][c3];
                        dp[i+1][a][c1][c2]%=MOD;
                    }
                }
            }
        }

    }
    ll ans=0;

    rep(c1,4){
        rep(c2,4){
            rep(c3,4){
                ans+=dp[n][c1][c2][c3];
                ans%=MOD;
            }
        }
    }
cout<<ans<<endl;





    return 0;
}


Measured memory_bytes: 256