akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

char maze[1005][1005];
int dist[1005][1005];

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

const int ddx[5] = {2, 1, 0, -1, -2};
const int ddy[5] = {2, 1, 0, -1, -2};

int main() {
	int h, w, ch, cw, dh, dw;
	cin >> h >> w >> ch >> cw >> dh >> dw;
	ch--, cw--, dh--, dw--;
	rep(i, h) rep(j, w) cin >> maze[i][j];
	rep(i, h) rep(j, w) dist[i][j] = -1;
	queue<pair<int, int>> a;
	queue<pair<int, int>> b;
	dist[ch][cw] = 0;
	a.emplace(ch, cw);
	while (!a.empty() || !b.empty()) {
		if (!a.empty()) {
			auto p = a.front();
			a.pop();
			b.emplace(p);
			rep(i, 4) {
				int ny = p.first + dy[i];
				int nx = p.second + dx[i];
				if (ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
				if (dist[ny][nx] != -1) continue;
				if (maze[ny][nx] == '.') {
					a.emplace(ny, nx);
					dist[ny][nx] = dist[p.first][p.second];
				}
			}
		} else {
			auto p = b.front();
			b.pop();
			rep(i, 5)
				rep(j, 5) {
					int nny = p.first + ddy[i];
					int nnx = p.second + ddx[j];
					if (nny < 0 || nny >= h || nnx < 0 || nnx >= w) continue;
					if (dist[nny][nnx] != -1) continue;
					if (maze[nny][nnx] == '.') {
						a.emplace(nny, nnx);
						dist[nny][nnx] = dist[p.first][p.second] + 1;
					}
				}
		}
	}
	int ans = dist[dh][dw];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8520
import numpy as np

K = int(input())
L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(L[K-1])


Measured memory_bytes: 12684
#include<bits/stdc++.h>
using namespace std;
#define N 100009
int n, a[4][N], dp[4][N];

int solve(int i, int p)
{
    if(i > n) return 0;
    if(dp[p][i] != -1) return dp[p][i];
    int ans = 0;
    for(int j = 1; j <= 3; j++)
    {
        if(j != p)
        {
            ans = max(ans, solve(i+1, j) + a[j][i]);
        }
    }
    return dp[p][i] = ans;
}

int main()
{
    memset(dp, -1, sizeof(dp));
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[1][i] >> a[2][i] >> a[3][i];
    cout << solve(1, 0) << endl;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;


int main()
{
    ll n;
    cin >> n;
    ll x = 100;
    ll sol = 0;
    while (x < n)
        x = x + x / 100, sol++;
    cout << sol;
}


Measured memory_bytes: 3636
a,b,k = input().strip().split()
a,b,k = [int(a), int(b), int(k)]

if k <= a:
	a = a-k
elif k >= a+b:
	a = 0
	b = 0
elif a+b > k > a:
	b = b-(k-a)
	a = 0

print('{} {}'.format(a,b))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll MOD= 1000000007;
#define fori(it, x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
ll dp[100005];
    vector <ll> vsix,vnine;

ll recur(ll n)
{
    if(dp[n]!=1e15)
        return dp[n];
    for (ll i = 0; i < vsix.size(); ++i)
    {
        if(vsix[i]>n)
            break;
        //cout<<vsix[i]<<endl;
        dp[n]=min(dp[n],1+recur(n-vsix[i]));
    }
    for (ll i = 0; i < vnine.size(); ++i)
    {
        if(vnine[i]>n)
            break;
        //cout<<vnine[i]<<endl;
        dp[n]=min(dp[n],1+recur(n-vnine[i]));
    }

    return dp[n];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll x=6;
    for(ll i=0;i<100005;i++)
        dp[i]=1e15;
    while(1)
    {
        vsix.push_back(x);
        x*=6;
        if(x>100000)
            break;
    }
    x=9;
    while(1)
    {
        vnine.push_back(x);
        x*=9;
        if(x>100000)
            break;
    }
    for(ll i=1;i<=5;i++)
        dp[i]=i;
    dp[6]=1;
    dp[7]=2;
    dp[8]=3;
    dp[9]=1;
    dp[0]=0;
    cout<<recur(n);  

    // ll ult=0;
    // while(n!=0) 
    // {
    //     ll pos=upper_bound(v.begin(),v.end(),n)-v.begin();
    //     pos--;

    //     n-=v[pos];
    //     cout<<v[pos]<<" "<<n<<endl;
    //     ult++;
    // }
    // cout<<ult<<endl;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
template<typename T>
void read(T &x)
{
    char ch=getchar();
    int f=1;
    for (x=0;ch!='-'&&(ch<'0'||ch>'9');ch=getchar());
    if (ch=='-') f=-1,ch=getchar();
    for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
    x*=f;
}
#define MAXN 100010
int n,k,mx;
int seq[MAXN];
int gcd(int a,int b)
{
	if (!b) return a;
	return gcd(b,a%b);
}
int main()
{
	read(n),read(k);
	for (int i=1;i<=n;i++)
	{
		read(seq[i]);
		mx=max(mx,seq[i]);
	}
	for (int i=2;i<=n;i++)
		seq[1]=gcd(seq[1],seq[i]);
	puts(k%seq[1]==0 && k<=mx ? "POSSIBLE" : "IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 640
//https://discuss.codechef.com/t/robagain-editorial/20734
#pragma GCC optimize("O3")
#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <iostream>
#include <stdio.h>
#include<bits/stdc++.h>


/*
#define x real()
#define y imag()
#define angle(a)                (atan2((a).imag(), (a).real()))
#define vec(a,b)                ((b)-(a))
#define same(p1,p2)             (dp(vec(p1,p2),vec(p1,p2)) < EPS)
#define dp(a,b)                 ( (conj(a)*(b)).real() )	// a*b cos(T), if zero -> prep
#define cp(a,b)                 ( (conj(a)*(b)).imag() )	// a*b sin(T), if zero -> parllel
#define length(a)               (hypot((a).imag(), (a).real()))
#define normalize(a)            (a)/length(a)
//#define polar(r,ang)            ((r)*exp(point(0,ang)))  ==> Already added in c++11
#define rotateO(p,ang)          ((p)*exp(point(0,ang)))
#define rotateA(p,ang,about)  (rotateO(vec(about,p),ang)+about)
#define reflectO(v,m)  (conj((v)/(m))*(m))
*/

//#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);
#define NOT(x) (1^x)

const double PI  = acos(-1.0);
using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;

//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//const int N=500009,M=1000000;
const double EPS= 1e-9,eps=-1e9;
const int N =500005;

int n,a[3005];
 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
//__builtin_popcount()
input;


      cin>>n;
      vector<int>v;
      forr(i,1,n)cin>>a[i],v.push_back(a[i]);

      sort(v.begin(),v.end());
      sort(a+1,a+1+n);
      ll ans=0;

      forr(i,1,n-2)
      {
          forr(j,i+1,n-1)
          {
              auto it=lower_bound(v.begin(),v.end(),a[i]+a[j]);
              ans+=it-(v.begin()+j);
          }
          //cout<<ans<<endl;
      }
      cout<<ans;



return 0;
}


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

int main()
{
     int n,k;
     cin>>n>>k;
     if((n-2)*(n-1)/2<k)
        puts("-1");
     else
     {  int num=0;
         int m=n-1+(n-2)*(n-1)/2-k;
         cout<<m<<endl;
         for(int i=1;i<=n-1;i++)
            cout<<n<<' '<<i<<endl;
            for(int i=1;i<=n-1;i++)
            {
                for(int j=1;j<i;j++){
                    if(num+n-1>=m)
                        return 0;
                    cout<<i<<' '<<j<<endl;
                      num++;
                }

            }

     }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,K,i,N; //Kはたす数　Nは試行数
  cin >> N >> K;
  A=1;
  for (i=0;i<N;i++){
    if (K>=A)
      A*=2;
    else
      A+=K;
  }
  cout<<A<<endl;
}
  

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

int main(){
    int n;
    cin >> n;

    vector<vector<vector<int>>> memo(n+1, vector<vector<int>>(10, vector<int>(10, 0)));

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= 9; j++){
            for(int k = 1; k <= 9; k++){
                memo[i][j][k] = memo[i-1][j][k];
            }
        }

        int ed = i % 10;
        int sd = i;
        while(sd >= 10) sd /= 10;
        memo[i][sd][ed]++;
    }

    long long int ans = 0;
    for(int i = 1; i <= n; i++){
        int ed = i % 10;
        int sd = i;
        while(sd >= 10) sd /= 10;
        ans += memo[n][ed][sd];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 148736
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int ans = 1;

		for(int i = 0; i < n-1; i++) {
			if(s.charAt(i) != s.charAt(i+1)) {
				ans++;
			}
		}

		System.out.println(ans);

		sc.close();
	}
}

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

string a[10] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
string s;

string solve(){
  string t = "";

  int key=0, cnt=0;
  for(int i=0; i<(int)s.size(); i++){
    int S = s[i] - '0';
    if(S==0){
      if(key!=0){
        cnt--;
        int len=a[key].size();
        t.push_back(a[key][cnt%len]);
      }
      cnt=key=0;
    } else if(key==S){
      cnt++;
    } else {
      key=S;
      cnt=1;
    }
  }
  return t;
}

int main(){
  int n;
  cin >> n;
  while(n--){
    cin >> s;
    cout << solve() << endl;
  }
  return 0;
}

Measured memory_bytes: 3028
#include"bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;

#define double long double
#define int long long
#define pb push_back 
#define eb emplace_back
#define Z(c) (int)(c).size()
#define L(c) c[Z(c)-1]
#define F first
#define S second
#define nl "\n"
#define mii map<int,int> 
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define rep(i,iv,n) for(int (i)=(iv);(i)<(n);++(i))
#define FO fflush(stdout) 
#define D1(x) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<nl
#define D2(x,y) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<nl
#define D3(x,y,z) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<nl
#define tr(it,ct) for(auto &(it) : (ct))
#define pi acos(-1)
#define prt(ct) for(auto &(it) : (ct)) cerr<<it<<" "; cerr<<nl
#define prtp(ct) for(auto &(it) : (ct)) cerr<<it.F<<" "<<it.S<<nl; cerr<<nl

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;
typedef pair<pii,pii> ppp;
typedef vector< pii > vp;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, 
             tree_order_statistics_node_update> baap;

void swap(char &a,char &b)
{ auto tm=a; a=b; b=tm; }

void mina(int &a,int b)
{ a=(a<b?a:b); }

void maxa(int &a,int b)
{ a=(a>b?a:b); }

  const int mod=1000000007;
  const int mod2=998244353;
  const int INF=1e18;
  const int N=2e5+35;
  const int M=1005;
 
 vi v,adj[N];

 int ans[N];

 void dfs(int node,int par,multiset<int> &s){
    s.insert(v[node]);
    auto it=s.lower_bound(v[node]); ++it;
    int p=-1;
    if(it!=s.end()) { p=*it; s.erase(it); }
    ans[node]=Z(s);
    tr(i,adj[node]) if(i!=par) dfs(i,node,s);
    if(p!=-1)
    s.insert(p);
    s.erase(s.find(v[node]));
 }


 void doit()         
 {
   int n; cin>>n;  v.resize(n+1);
   rep(i,1,n+1) cin>>v[i];

   rep(i,1,n){
     int x,y; cin>>x>>y;
     adj[x].pb(y); adj[y].pb(x);
   }
   multiset<int> s;
   dfs(1,-1,s);
   rep(i,1,n+1) cout<<ans[i]<<" ";


 }

signed main()
{ 
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
   int tc=1;                         
 //   cin>>tc;

  rep(i,1,tc+1)
  { // cout<<"Case #"<<i<<": ";
    
   doit();
   if(i<tc)
   cout<<nl;
  }

 return 0; 
}

Measured memory_bytes: 34492
#include <iostream>
#include <map>
#include<vector>
#include<algorithm>
using namespace std;

 
int main() {
    int n;
    vector<pair<int, int>> vtMap;
    cin>>n;
    for (int i = 1; i <= n; i++) {
        int x = 0;
        cin >> x;
        vtMap.push_back(make_pair(i, x));
    }
    sort(vtMap.begin(), vtMap.end(), [](const pair<int, int> &x, const pair<int, int> &y) -> int { return x.second < y.second; });

    for (auto it = vtMap.begin(); it != vtMap.end();it++){
        cout << it->first << ' ';
    }
    return 0;
}

Measured memory_bytes: 1780
#include <stdio.h>
#include <math.h>

int main(void)
{

	double a, b, c;
	double S, L2, L, h;

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

	S = 0.5*a*b*sin(c*3.14159265359 / 180);
	L2 = a*a + b*b - 2 * a*b*cos(c*3.1415926359 / 180);
	L = sqrt(L2) + a + b;
	h = 2 * S / a;

	printf("%.11lf\n%.11lf\n%.11lf\n", S, L, h);

	return 0;

}


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

int main()
{
    ll n,i,sum=0,a,sum1=0;
    string st;
    cin >> st;
    for(i=0; i<st.size(); i++)
    {
        char ch=st[i];
        if(i%2==0)
        {
            if(ch=='L')
            {
                cout << "No\n";
                return 0;
            }
        }
        else
        {
            if(ch=='R')
            {
                cout << "No\n";
                return 0;
            }
        }

    }

    cout << "Yes\n";


    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	string s;
	int cnt=0,ans=0;
	cin>>n>>s;
	for(auto i:s){
		if(i=='I')
			++ans;
		else
			--ans;
		cnt=max(ans,cnt);
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define re register
using namespace std;
typedef long long ll;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=100000+10;

int n,mx;
int a[N],s[N],S[N];

int c[N<<1];
inline int lowbit(int x) { return x&-x; }
inline void add(int x,int y) {
    for (;x<=mx;x+=lowbit(x)) c[x]+=y;
}
inline int query(int x) {
    int res=0;
    for (;x;x-=lowbit(x)) res+=c[x];
    return res;
}

inline int check(int mid) {
    memset(c,0,sizeof(c)),mx=0;
    for (re int i=1;i<=n;++i) {
        if (a[i]<mid) s[i]=-1;
        else s[i]=1;
    }
    ll res=0;
    for (re int i=1;i<=n;++i) s[i]+=s[i-1],res+=(s[i]>=0);
    for (re int i=1;i<=n;++i) s[i]+=n+1,mx=max(mx,s[i]);
    for (re int i=1;i<=n;++i) res+=query(s[i]),add(s[i],1);
    ll cnt=1ll*n*(n-1)/2+n;
    return cnt-res<cnt/2+1;
}

int main() {
    n=read();
    for (re int i=1;i<=n;++i) S[i]=a[i]=read();
    sort(S+1,S+n+1); int m=unique(S+1,S+n+1)-S-1;
    for (re int i=1;i<=n;++i) a[i]=lower_bound(S+1,S+m+1,a[i])-S;
    int L=1,R=m,ans=0;
    while (L<R) {
        int mid=(L+R+1)>>1;
        if (check(mid)) L=mid;
        else R=mid-1;
    }
    printf("%d\n",S[L]);
    return 0;
}

Measured memory_bytes: 5664
n ,m = map(int,input().split())
h_li =list(map(int,input().split()))

flag = [True]*n
for _ in range(m):
    a,b = map(int,input().split())
    if h_li[a-1] < h_li[b-1]:
        flag[a-1]=False
    elif h_li[a-1]>h_li[b-1]:
        flag[b-1]=False
    elif h_li[a-1] == h_li[b-1]:
        flag[a-1]=False
        flag[b-1]=False
print(flag.count(True))

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

typedef long long ll;

#define PB push_back
#define MP make_pair

int count(int a) {
    int c = 0;
    while (!(a & 1)) {
        a /= 2;
        c++;
    }
    return c;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        if (!(a & 1)) {
            ans += count(a);
        }
    }
    cout << ans << "\n";
}

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

/*------------------------------------------------------------------*/

#define ll long long int
#define mp make_pair
#define pb push_back
#define MOD 1000000007

bool isvowel(char c)
{
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
        return true;
        return false;
}
ll isprime(ll n)
{
    ll ans=1;
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            ans = i;
    }
    return ans;
}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    if(b==1)
        return a%m;
    ll temp=power(a,b/2,m);
    if(b%2==0)
        return ((temp%m)*(temp%m))%m;
    else
        return ((((temp%m)*(temp%m))%m)*a%m)%m;
}

/*-----------------------------------------------------------------------------*/

ll c(ll n, ll k)
{
    ll C[n + 1][k + 1];
    ll i, j;

    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {

            if (j == 0 || j == i)
                C[i][j] = 1;

            else
                C[i][j] = (C[i - 1][j - 1]%MOD +
                          C[i - 1][j])%MOD;
        }
    }
    return C[n][k]%MOD;
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {

        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;


        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;

    return x;
}
ll func(ll n)
{
    ll ans=0;
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            if(i/10==0)
                ans+=1+func(i)*func(n/i);
            else
                ans+=func(i)*func(n/i);
        }
    }
    return ans;
}
ll dp[205][205][205];
ll check(ll red[],ll gre[],ll blu[],ll r,ll g,ll b,ll i,ll j,ll k)
{
   if(dp[i][j][k]!=-1)
    return dp[i][j][k]; 
   if(i<r&&j<g&&k<b)
   {
       return dp[i][j][k]=max(red[i]*gre[j]+check(red,gre,blu,r,g,b,i+1,j+1,k),max(gre[j]*blu[k]+check(red,gre,blu,r,g,b,i,j+1,k+1),blu[k]*red[i]+check(red,gre,blu,r,g,b,i+1,j,k+1)));
   }
   else if(i<r&&j<g) 
   {
       return dp[i][j][k]=red[i]*gre[j]+check(red,gre,blu,r,g,b,i+1,j+1,k);
   }
   else if(j<g&&k<b)
   {
       return dp[i][j][k]=gre[j]*blu[k]+check(red,gre,blu,r,g,b,i,j+1,k+1);
   }
   else if(i<r&&k<b)
   {
       return dp[i][j][k]=red[i]*blu[k]+check(red,gre,blu,r,g,b,i+1,j,k+1);
   }
   else
   {
       return 0;
   }
}
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    //freopen("1.txt","rt",stdin);
    //freopen("output.txt","wwt",stdout);

    ll t;
    t=1;
    //cin>>t;
    //ll t1=0;
    while(t--)
    {
        ll n;
        cin>>n;
        ll a[n];
        vector<ll>v[n];
        for(ll i=1;i<n;i++)
        {
            cin>>a[i];
            v[i].pb(a[i]-1);
            v[a[i]-1].pb(i);
        }
        for(ll i=0;i<n;i++)
        {
            if(i==0)
             cout<<v[i].size()<<endl;
            else 
            cout<<v[i].size()-1<<endl; 
        }
    }
}


Measured memory_bytes: 17716
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


x = int(input())

# n,m,q = map(int, input().split())
# abcd = [map(int, input().split())for _ in range(q)]

# a = list(map(int, input().split()))

_numbers = make_divisors(x)
numbers = []
for i in _numbers:
    numbers.append(i)
    numbers.append(-i)
make = []
for a in range(-178,179):
    for b in range(-178, 179):
        if a**4 + b*a**3 + (a**2)*(b**2) + a*(b**3) + b**4 in numbers:
            if a**5 - b**5 == x:
                print(a,b)
                exit()
            




Measured memory_bytes: 9432
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    int x, y, z, k; std::cin >> x >> y >> z >> k;
    std::vector<long long> a(x), b(y), c(z);
    for (int i = 0; i < x; i++) std::cin >> a[i];
    for (int i = 0; i < y; i++) std::cin >> b[i];
    for (int i = 0; i < z; i++) std::cin >> c[i];
    std::vector<long long> ab(x*y);
    for (int i = 0; i < x; i++) {
        for (int j = 0; j < y; j++) {
            ab[i*y + j] = a[i] + b[j];
        }
    }
    std::sort(ab.rbegin(), ab.rend());
    std::vector<long long> abc(k*z);
    for (int i = 0; i < z; i++) {
        for (int j = 0; j < std::min(k, x*y); j++) {
            abc[i*k + j] = c[i] + ab[j];
        }
    }
    std::sort(abc.rbegin(), abc.rend());
    for (int i = 0; i < k; i++) std::cout << abc[i] << std::endl;
    return 0;
}


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

int main() {
  int d, mark;
  cin >> d >> mark;
  map<int, pair<int, int>> quest;
  for (int i = 100; i <= d * 100; i += 100) {
    cin >> quest[i].first >> quest[i].second;
  }
  int ans = 1e5;
  for (int b = 0; b < (1 << d); b++) {
    bitset<10> s(b);
    int sum = 0;
    int total = 0;
    int max0 = 0;
    for (int i = 100; i <= d * 100; i += 100) {
      if (s.test(i / 100 - 1)) {
        sum += i * quest[i].first + quest[i].second;
        total += quest[i].first;
      } else
        max0 = max(max0, i);
    }
    // cout << sum << " " << total << " " << max0 << endl;
    if (mark <= sum)
      ans = min(ans, total);
    else if (sum < mark &&
             ((mark - sum + (mark - sum) % max0) / max0 < quest[max0].first)) {
      total += max((mark - sum + (mark - sum) % max0) / max0, 1);
      ans = min(ans, total);
    }
  }

  cout << ans << endl;
}


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

using namespace std;

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

	int n,m;

	cin >> n >> m;

	cout << ((n*(n-1)/2) + (m*(m-1)/2)) << '\n';
	
    return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll r, g;

	cin >> r >> g;

	cout << 2 * g - r << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ld PI = 2 * acos(0.0);
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
const ll mod=1e9+7;
int MOD(int a)
{
    if(a<0)
        a+=mod;
    if(a>=mod)
        a%=mod;
    return a;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int fun(int a,int b)
{
    if(a<=b)
        return 0;
    return a/b;

}
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int l,r,d;cin>>l>>r>>d;
    cout<<fun(r,d)-fun(l-1,d)<<endl;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  ll a, b, k;
  cin >> a >> b >> k;
  ll t = a - k;
  if(t>=0){
    cout << t << " " << b << "\n";
  }else{
    k -= a;
    if(b>k){
      cout << 0 << " " << b - k << "\n";
    }else{
      cout << 0 << " " << 0 << "\n";
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int ans;
string s; 
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",strout);
	cin>>s;
	if(s[0]!='C')  ans++;//CODEFESTIVAL2016
	if(s[1]!='O')  ans++;//ODEFESTIVAL2016
	if(s[2]!='D')  ans++;//DEFESTIVAL2016
	if(s[3]!='E')  ans++;//EFESTIVAL2016
	if(s[4]!='F')  ans++;//FESTIVAL2016
	if(s[5]!='E')  ans++;//ESTIVAL2016
	if(s[6]!='S')  ans++;//STIVAL2016
	if(s[7]!='T')  ans++;//TIVAL2016
	if(s[8]!='I')  ans++;//IVAL2016
	if(s[9]!='V')  ans++;//VAL2016
	if(s[10]!='A')  ans++;//AL2016
	if(s[11]!='L')  ans++;//L2016
	if(s[12]!='2')  ans++;//2016
	if(s[13]!='0')  ans++;//016
	if(s[14]!='1')  ans++;//16
	if(s[15]!='6')  ans++;//6
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define ll long long
const int mod = 1e9 + 7;
const int maxn = 1e3 + 10;
int num[maxn];
int n, x;
ll  ans = 1;

int main(){
	cin >> n;
	for (int i = 2; i <= n; ++i){
		x = i;
		for (int j = 2; j <= x; ++j)
		{
			while (x%j == 0){ num[j]++; x /= j; }
		}
		if (x != 1)num[x]++;
	}
	for (int i = 1; i <= n; ++i)
	{
		if (num[i])ans = (ans*((num[i] + 1) % mod)) % mod;
	}
	cout << ans << endl;
}

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

// Return the maximum volume.
double maxvolume(double s)
{
	// finding length
    double length= s / 3.0;

	s -= length;

	// finding breadth
	double breadth = s / 2.0;

	// finding height
	double height = s - breadth;
	double ans  = length * breadth * height;

	return ans;
}

// Driven Program
int main()
{
	double s;
	cin>>s;
	double maxv = maxvolume(s);
	cout.precision(12);
	cout  <<maxv << endl;
	return 0;
}


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

using namespace std;
using ll = long long;

int main(){
  ll N;
  cin >> N;
  vector<ll> A(N);
  vector<ll> B(N);
  vector<ll> C(N-1);
  
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N; i++) cin >> B[i];
  for(int i=0; i<(N-1); i++) cin >> C[i];
  
  ll ans = 0;
  
  for(int i=0; i<N; i++){
    ans += B[A[i]-1];
    if(A[i]==(A[i+1]-1)){
      ans += C[A[i]-1];
    }
  
  }
  
  cout << ans << endl;
  
  
  return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<numeric>
using namespace std;

#define R(i,s,n) for(int i=s;i<n;i++)
#define D(i,n,s) for(int i=n-1;i>=s;i--)
typedef pair<int,int> P;

string s1,s2;
string s1o="",s2o="";
vector<string> s1i,s2i;

int D1(int i){
  string t="";
  for(int j=i+1;1;j++){
    if(s1[j]=='"'){
      s1i.push_back(t);
      return j;
    }else{
      t += s1[j];
    }
  }
}

int D2(int i){
  string t="";
  for(int j=i+1;1;j++){
    if(s2[j]=='"'){
      s2i.push_back(t);
      return j;
    }else{
      t += s2[j];
    }
  }
}

int main() {
  while(cin >> s1 && s1 != "."){
    s1o="";s2o="";
    s1i.clear();s2i.clear();
    cin >> s2;
    R(i,0,s1.size()){
      if(s1[i]=='"'){
        s1o += '.';
        i = D1(i);
      }else{
        s1o += s1[i];
      }
    }
    R(i,0,s2.size()){
      if(s2[i]=='"'){
        s2o += '.';
        i = D2(i);
      }else{
        s2o += s2[i];
      }
    }

    if(s1o != s2o || s1i.size() != s2i.size()){
      cout << "DIFFERENT" << endl;
    }else{
      int count = 0;
      R(i,0,s1i.size()){
        if(s1i[i] != s2i[i]){
          count++;
        }
      }
      if(count==0){
        cout << "IDENTICAL" << endl;
      }else if(count==1){
        cout << "CLOSE" << endl;
      }else{
        cout << "DIFFERENT" << endl;
      }
    }
    /*
    cout << s1o << " " << s2o << endl;
    R(i,0,s1i.size()){
      cout << s1i[i] << " ";
    }
    cout << endl;
    R(i,0,s2i.size()){
      cout << s2i[i] << " ";
    }
    cout << endl<< endl;
    */
  }
}



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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define repll(i,n) for(ll i = 0; i < n; i++)
#define REPll(i,n) for(ll i = 1; i < n; i++)
#define sz(x) int(x.sze())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n") 
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

long long sze[55] = {};

ll f(ll n, ll x) {
  if(n == 0) return 1;
  else if(x == 1) return 0;
  else if(x >= 2 && x <= sze[n]/2) return f(n-1,x-1);
  else if(x-1 == sze[n]/2) return f(n-1, x-2) + 1;
  else if(x > sze[n]/2+1 && x < sze[n]-1) return f(n-1, x-sze[n]/2-1) + f(n-1,sze[n]/2-1) +1;
  else return f(n-1, sze[n]/2-1)*2 +1;
}

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

  ll n, x;
  cin >> n >> x;
  sze[0] = 1;
  REP(i,n+1) {
    sze[i] = sze[i-1]*2 + 3;
  }

  //cout << s[n] << endl;
  ll ans = f(n, x);
  cout << ans << endl;
}

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

int cnt[100010]={0};
vector<int> vi[100010];

int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        int s;
        scanf("%d",&s);
        cnt[i]=s;
    }
    for(int i=0;i<m;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        vi[b].push_back(a);
        vi[a].push_back(b);
    }
    int sum=0;
    for(int i=1;i<=n;i++){
        bool flag=true;
        if(vi[i].size()){
            for(int j=0;j<vi[i].size();j++){
                if(cnt[i]<=cnt[vi[i][j]]){
                    flag=false;
                }
            }
        }
        if(flag){
            sum++;
        }
    }
    printf("%d",sum);
    return 0;
}

Measured memory_bytes: 9340
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int N;

int main(){
  cin >> N;

  vector<int> dp(101010,1e9);
  dp[0] = 0;

  for(int i = 6;i <= N;i *= 6){
    for(int j = i;j <= N;j++){
      dp[j] = min(dp[j],dp[j - i] + 1);
    }
  }
  for(int i = 9;i <= N;i *= 9){
    for(int j = i;j <= N;j++){
      dp[j] = min(dp[j],dp[j - i] + 1);
    }
  }

  i64 ans = dp[N];
  for(int i = 0;i <= N;i++){
    ans = min(ans , (i64)dp[i] + (N - i));
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        if(s.endsWith("s")){
            System.out.println(s + "es");
        }
        else{
            System.out.println(s + "s");
        }
    }
}


Measured memory_bytes: 38524
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int x;
    cin >> x;
    x /= 100;
    cout << "ai1333" + string(x, '3') << endl;
    return 0;
}




Measured memory_bytes: 3228
#include<iostream>
using namespace std;
int main() {
	int n, arr[200005] = {},x, c = 0, k = 1;
	cin >> n;
	for (int i = 0; i < n-1 ; i++) {
		cin >> x;
		arr[x]++;
	}
	for (int i = 1; i < n+1; i++) {
		cout << arr[i] << endl;
	}
}

Measured memory_bytes: 4420
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n, k;
    cin >> n >> k;

    vector<int> x(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }

    int r = 1 << 30;
    for (int i = 0; i <= n - k; i++) {
        int j = i + k - 1;
        r = min(r, min(abs(x[i]), abs(x[j])) + (x[j] - x[i]));
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for ( int i = 0; i < n; i++ )
#define REP(i, b, e) for ( int i = b; i <= e; i++ )
#define MAX 100
#define LIMIT 180
#define BLOCK '#'
#define SPACE '.'
#define EXIT 'X'
static const string DIR = "ENWS";
static const int di[4] = { 0, -1, 0, 1 };
static const int dj[4] = { 1, 0, -1, 0 };
int H, W;
char G[MAX + 2][MAX + 2];
bool isPerson(char ch) {
	rep(d, 4)if (ch == DIR[d])return true;
	return false;
}
int getDirection(char ch) {
	rep(d, 4)if (ch == DIR[d])return d;
}
int chengeDirection() {
	int nperson = 0;
	REP(i, 1, H)REP(j, 1, W)	{
			if (!isPerson(G[i][j]))continue;
			nperson++;
			int curd = getDirection(G[i][j]);
			int v = curd;
			curd = ((curd == 0) ? 3 : curd - 1);
			for (int r = curd; r < curd + 4; r++) {
				char ch = G[i + di[r % 4]][j + dj[r % 4]];
				if (ch == SPACE || ch == EXIT) {v = r % 4;break;}
			}
			G[i][j] = DIR[v];
	}
	return nperson;
}
void move() {
	int dir[MAX + 2][MAX + 2];
	rep(i, H+2)rep(j, W+2 )	dir[i][j] = -1;
	REP(i, 1, H)REP(j, 1, W)	{
			if (G[i][j] == SPACE || G[i][j] == EXIT) {
				for (int r = 0; r < 4; r++) {
					char target = G[i + di[r]][j + dj[r]];
					if (isPerson(target) && target == DIR[(r + 2) % 4]) {
						dir[i + di[r]][j + dj[r]] = (r + 2) % 4;	break;
					}
				}
			}
	}
	REP(i, 1, H)REP(j, 1, W)	{
			if (!isPerson(G[i][j]) || dir[i][j] == -1)continue;
			int ni, nj;
			ni = i + di[dir[i][j]];
			nj = j + dj[dir[i][j]];
			if (G[ni][nj] == EXIT) {
				G[i][j] = SPACE;
			} else if (G[ni][nj] == SPACE) {
				G[ni][nj] = G[i][j];
				G[i][j] = SPACE;
			}
		}
}
int main() {
	while (1) {
		cin >> W >> H;
		if (H == 0 && W == 0)
			break;
		rep(i,H+2)	rep(j,W+2)G[i][j] = BLOCK;
		REP(i, 1, H)REP(j, 1, W)	cin >> G[i][j];
		int t = 0;
		while (1) {
			if (t > LIMIT)	break;
			if (!chengeDirection())break;
			move();
			t++;
		}
		if (t > LIMIT)
			cout << "NA" << endl;
		else
			cout << t << endl;
	}
	return 0;
}

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

int main(){
  int A,B,K;
  cin >> A >> B >> K;
  
  for(int i = A;i <= B;i++){
    if(i < A + K && i >= A){
      cout << i << endl;
    }
    else if(i > B - K && i <= B){
      cout << i << endl;
    }
  }
    
}

Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]z){int i=0,e=2,c;int[]p=new int[175];for(;i<175;p[i++]=e++)for(;f(p,e)<1;e++);for(Scanner s=new Scanner(System.in);s.hasNext();System.out.println(c)){e=s.nextInt();for(c=0,i=2;i<=e;++i)if(f(p,i)>0)++c;}}static int f(int[]p,int n){for(int e:p)if(e>0&&n!=e&&n%e<1)return 0;return 1;}}

Measured memory_bytes: 12000
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,A,B; cin >> N >> A >> B;
    auto f=[](int x) {
        int ret = 0;
        while (x > 0) {
            ret += x % 10;
            x /= 10;
        }
        return ret;
    };
    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        int val = f(i);
        if (val >= A and val <= B) ans += i;
    }
    cout << ans << ln;
}




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

int main(){
    vector<int> A(3);
    rep(i, 3) cin >> A[i];

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

    cout << A[2]*10+A[1]+A[0] << endl;
}

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 a = sc.nextInt();
        int b = sc.nextInt();
        if(a*n > b)System.out.println(b);
        else System.out.println(a*n);
    }
}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(0)

// *start on @date: 2020-03-14 20:50

int main()
{
    IOS;
    unsigned long long a, b;
    cin >> a >> b;
    if(a==1||b==1)
    cout<<1;
    else
    cout << (a * b + 1) / 2;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long s64;
const int ONE = 1000005;
const s64 INF = 1e18;
#define next nxt

int get() {
	int res = 1, Q = 1;
	char c;
	while( (c = getchar()) < 48 || c > 57) if(c == '-') Q = -1;
	if(Q) res = c - 48;
	while( (c = getchar()) >= 48 && c <= 57) res = res * 10 + c - 48;
	return res * Q;
}
struct power {
	s64 a, b;
	bool operator <(power A) const {
		if(A.a != a) return a < A.a;
		return b < A.b;
	}
};
vector <power> A[ONE], R;
int n;
int x, y;
s64 l, r, K;
int next[ONE], first[ONE], go[ONE], w[ONE], tot;
int size[ONE], fat[ONE];
void Add(int u, int v, int z) {
	next[++tot] = first[u], first[u] = tot, go[tot] = v, w[tot] = z;
	next[++tot] = first[v], first[v] = tot, go[tot] = u, w[tot] = z;
}
int dist[ONE];
int len_x, len_y;
s64 a1, b1, a2, b2;
int Find() {
	int l = 0, r = len_y - 1;
	while(l < r - 1) {
		int mid = l + r >> 1;
		a2 = A[y][mid].a, b2 = A[y][mid].b;
		if(b1 + a2 + dist[x] + dist[y] <= K) l = mid;
		else r = mid;
	}
	a2 = A[y][r].a, b2 = A[y][r].b;
	if(b1 + a2 + dist[x] + dist[y] <= K) return r;
	a2 = A[y][l].a, b2 = A[y][l].b;
	if(b1 + a2 + dist[x] + dist[y] <= K) return l;
	return -1;
}
void Update(int u) {
	x = 0, y = 0;
	for(int e = first[u]; e; e = next[e]) if(go[e] != fat[u]) if(!x) x = go[e];
			else y = go[e];
	if(size[x] > size[y]) swap(x, y);
	len_x = A[x].size(), len_y = A[y].size();
	R.clear();
	if(len_x==0||len_y==0)return ;
	
	for(int i = 0; i < len_x; i++) {
		a1 = A[x][i].a, b1 = A[x][i].b;
		if(Find()==-1) continue;
		R.push_back((power) {
			a1 + dist[x], b2 + dist[y]
		});
		R.push_back((power) {
			b2 + dist[y], a1 + dist[x]
		});
	}
	sort(R.begin(), R.end());
	int len = R.size();
	s64 maxx = INF;
	for(int i = 0; i < len; i++) if(R[i].b < maxx) A[u].push_back(R[i]), maxx = R[i].b;
}
void Dfs(int u, int father) {
	size[u] = 1;
	int pd = 0;
	for(int e = first[u]; e; e = next[e]) {
		int v = go[e];
		if(v == father) continue;
		fat[v] = u, dist[v] = w[e];
		Dfs(v, u);
		size[u] += size[v], pd++;
		if(pd == 2) Update(u);
	}
	if(!pd) A[u].push_back((power) {
		0, 0
	});
}
int Check() {
	for(int i = 1; i <= n; i++) A[i].clear();
	Dfs(1, 0);
	return A[1].size() > 0;
}
int main() {
	n = get();
	for(int i = 2; i <= n; i++) {
		x = get(), y = get();
		Add(i, x, y), r += y;
	}
	while(l < r - 1) {
		K = l + r >> 1;
		if(Check()) r = K;
		else l = K;
	}
	K = l;
	if(Check()) printf("%lld", l);
	else printf("%lld", r);
}

Measured memory_bytes: 70132
#include<bits/stdc++.h>
#define ll long long
#define thekingisborn ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ld  long double
#define f first
#define se second
#define pb push_back
#define maxn 200005
#define mod 1000000007
#define pi 3.14159265359

using namespace std;

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

/*ll power(ll a,ll n)
{
    if(n == 1)return a%mod;
    if(n == 0)return 1;
    a = a%mod;
    if(n&1)return ((a%mod)*(power((a*a)%mod,n>>1))%mod)%mod;
    return power((a*a)%mod,n>>1)%mod;
}*/
ll gcd(ll a,ll b)
{
    if(a%b == 0)return b;
    return gcd(b,a%b);
}
/*int root(int x)
{
    while(par[x] != x)
    x = par[x];
    return x;
}
void dsu(int x,int y)
{
  if(root(x) == root(y))return;
  par[root(y)] = root(x);
  return;
}
void dfs(int x)
{
    done[x] = true;
    for(int i=0;i<int(adj[x].size());++i)
    {
        int y = adj[x][i];
        if(!done1[y])
        dfs(y);
    }
}*/
ll n;
vector<ll>v(3*maxn);

int main()
{
    thekingisborn;
    /*cin >> n;
    for(int i=0;i<(1<<n);++i)
    cin >> v[i];*/
    cin >> n;
    cout << (2*n)/gcd(2,n);
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int N = 200001;

int n, mod = 1e9 + 7;
vector <int> a, v[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    a.push_back(0);
    cin >> n;
    for(int i = 0, x ; i < n && cin >> x ; i++)
        a.push_back(x);
    vector <int> last(N, -1);
    for(int i = 1 ; i <= n ; i++){
        if(last[a[i]] != -1 && a[i] != a[i - 1])
            v[i - 1].push_back(last[a[i]]);
        last[a[i]] = i;
    }
    vector <int> dp(n + 1);
    dp[0] = 1;
    for(int i = 1 ; i <= n ; i++){
        dp[i] = dp[i - 1];
        for(auto &j : v[i]){
            dp[i] += dp[j - 1];
            if(dp[i] >= mod) dp[i] -= mod;
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 13556
// --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>

using namespace std;

int main(int argc, char* argv[]) {

	long long N, wrk;
	int flg, cnt = 0;

	cin >> N;

	std::string s;
	std::ostringstream oss;

	oss << N << std::flush;
	s = oss.str();

	wrk = 0;
	for (int i = 0; i < (int)s.length(); i++) {
		char st[2] = {0};
		st[0] = s[i];
		wrk += atoi(st);
	}

	if (N % wrk == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vi a(3*n);
    rep(i, 3*n) cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = 0;
    for (int i = n; i < 3*n; i += 2) {
        ans += a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
//from
//https://atcoder.jp/contests/abc110/submissions/3254887

const int mod=1e9+7;

struct com {
    int mod;
    vector<long long> mfact, rfact;

    com(int sz, int mod) : mfact(sz+1), rfact(sz+1), mod(mod) {
        mfact[0]=1;
        for (int i=1;i<mfact.size();i++) mfact[i]=mfact[i-1]*i%mod;
        rfact[sz]=inv(mfact[sz]);
        for (int i=sz-1;i>=0;i--) rfact[i]=rfact[i+1]*(i+1)%mod;
    }
    long long fact(int k) const {
        return (mfact[k]);
    }

    long long pow(long long x,long long n) const {
        long long ret=1ll;
        while(n>0) {
            if (n&1) (ret*=x)%=mod;
            (x*=x)%=mod;
            n>>=1;
        }
        return (ret);
    }
    long long inv(long long x) const {
        return (pow(x,mod-2));
    }

    long long P(int n, int r) const {
        if (r<0||n<r) return (0);
        return (mfact[n]*rfact[n-r]%mod);
    }

    long long C(int p,int q) const {
        if (q<0||p<q) return (0);
        return (mfact[p]*rfact[q]%mod*rfact[p-q]%mod);
    }

    long long H(int n, int r) {
        if(n<0||r<0) return (0);
        return (r==0?1:C(n+r-1,r));
    }
};

map<int, int> dp[32];


int rec(int x, int rest) {
    if(x==1) return rest==0;
    if(rest<=0) return 0;
    if(dp[rest].count(x)) return dp[rest][x];
    int ret=0;

    vector<int> div;
    for(int i=1;i*i<=x;i++) {
        if (x%i==0) {
            div.emplace_back(i);
            if(i*i!=x) div.emplace_back(x/i);
        }
    }

    for (auto &p:div) {
        if (x!=p) (ret+=rec(p, rest-1))%=mod;
    }
    return dp[rest][x]=ret;
}

int main() {
    int n,m;
    scanf("%d %d",&n,&m);
    com beet(n+1,mod);
    int ret=0;
    for (int i=0;i<=min(31,n);i++) {
        int rest=n-1;
        auto add = beet.C(n,i);
        (add*=rec(m,i))%=mod;
        (ret+=add)%=mod;
    }
    printf("%d\n",ret);
}


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

#define ll long long int
#define str string

ll MOD = 1000000007, INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Max = INF, Min = -1;
double a = 0, b = 0, c = 0, n = 0, sum = 0;
ll A[500000] = {}, B[500000] = {}, rui[500000] = {}, dp[100][10] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
vector <ll> v;
str S, T;
bool check = true, check2 = false;

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

int main() {

	//Code Line
	cin >> a;
	for (int i = 1; i <= a; i++) {
		if (i % 2)b++;
	}
	cout << b/a << endl;

	return 0;
}



Measured memory_bytes: 256