akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S[3];
ll L,R;
ll cnt[103][28];
ll dif[103][28];


vector<int> Zalgo(string s) {
	vector<int> v(1,s.size());
	for(int i=1,l=-1,r=-1;i<s.size();i++) {
		if(i<=r && v[i-l]<r-i+1) v.push_back(v[i-l]);
		else {
			l=i; r=(i>r)?i:(r+1);
			while(r<s.size() && s[r-i]==s[r]) r++;
			v.push_back((r--)-l);
		}
	}
	v.push_back(0);
	return v;
}
string nex(string S) {
	vector<int> V=Zalgo(S);
	
	int l;
	for(l=S.size()/2-1;l>=0;l--) {
		if(V[S.size()-l]>=l) return S.substr(0,S.size()-l)+S.substr(0,S.size()-l);
	}
}
vector<ll> hoge(ll v) {
	vector<ll> ret(26,0);
	int i;
	FOR(i,26) ret[i] = v/S[0].size()*cnt[0][i];
	v%=S[0].size();
	FOR(i,v) ret[S[0][i]-'a']++;
	return ret;
}

vector<ll> hoge2(ll V) {
	vector<ll> ret(26,0);
	int i,j;
	for(i=99;i>=2;i--) {
		if(V>=cnt[i][26]) {
			FOR(j,26) ret[j]+=cnt[i][j]-cnt[i-2][j]/2;
			V-=cnt[i][26]-cnt[i-2][26]/2;
		}
	}
	FOR(i,V) ret[S[2][i]-'a']++;
	return ret;
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S[0]>>L>>R;
	S[1]=nex(S[0]);
	S[2]=nex(S[1]);
	
	FORR(r,S[0]) cnt[0][r-'a']++;
	FORR(r,S[1]) cnt[1][r-'a']++;
	cnt[0][26]=S[0].size();
	cnt[1][26]=S[1].size();
	
	vector<ll> LL,RR;
	if(S[0].size()+S[2].size()==2*S[1].size()) {
		RR=hoge(R);
		LL=hoge(L-1);
	}
	else {
		for(i=2;i<=100;i++) {
			FOR(j,27) {
				cnt[i][j] = min(1LL<<60,cnt[i-1][j]+cnt[i-2][j]);
			}
		}
		RR=hoge2(R);
		LL=hoge2(L-1);
	}
	FOR(i,26) _P("%lld%c",RR[i]-LL[i],(i==25)?'\n':' ');
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

int main() {
  int n;
  cin >> n;
  int col[8];
  for (int i = 0; i < 8; i++) {
    col[i] = 0;
  }

  int fre = 0;
  for (int i = 0; i < n; i++) {
    int rate;
    cin >> rate;
    int cnt = 0;
    if (rate >= 3200) {
      fre++;
    } else {
      col[rate / 400]++;
    }
  }

  int color = 0;
  for (int i = 0; i < 8; i++) {
    if (col[i] > 0) color++;
  }

  int mn = color;
  int mx = color + fre;
  if (mn == 0) mn++;
  cout << mn << ' ' << mx << endl;
}

Measured memory_bytes: 256
h,w = map(int,input().split())
if(h == 1 or w == 1):
  print(1)
  exit()
elif(h%2==0):
  ans = (h//2) * w
else:
  if(w%2==1):
  	ans = ((h//2 + 1) * (w//2 + 1)) + ((h//2)*(w//2))
  else:
  	ans = ((h//2 + 1) * (w//2)) + ((h//2)*(w//2))
print(round(ans))

Measured memory_bytes: 3064
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n;i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
#define mo 1000000007
#define ull unsigned long long 

int main(){
  int a,b,c;cin>>a>>b>>c;
  if(a==b)
    cout<<c;
  if(b==c)
    cout<<a;
  if(c==a)
    cout<<b;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

ll d;
vector<ll> c(26,0),last(26,-1);
vector<vector<ll>> s;

ll score(vector<ll> &t){
    last.assign(26,-1);
    ll ans=0;
    rep(i,d){
        ans+=s[i][t[i]];
        last[t[i]]=i;
        rep(j,26) ans-=c[j]*(i-last[j]);
        //cout<<ans<<endl;
    }
    return ans;
}

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

    scanf("%lld",&d);
    vector<set<ll>> st(26);
    rep(i,26){
        st[i].insert(-1);
        st[i].insert(d);
    }
    vector<ll> t(d,0);
    rep(i,d){
        t[i]=i%26;
        st[i%26].insert(i);
    }
    rep(i,26) scanf("%lld",&c[i]);
    s.assign(d,vector<ll>(26,0));
    rep(i,d)rep(j,26){
        scanf("%lld",&s[i][j]);
    }
    /*
    rep(i,d){
        scanf("%d",&t[i]);
        t[i]--;
        st[t[i]].insert(i);
    }
    */
    ll ans=score(t);
    //printf("%lld\n",ans);
    //cout<<ans<<endl;
    
    ll m=1000; //scanf("%d",&m);
    ll p,di=0,q=0,ddi=18,dq=17,pans;
    rep(i,m){
        if(t[di]==q) q=(q+1)%26;
        pans=ans;
         //scanf("%d",&di); scanf("%d",&q);
        //di--; q--;
        p=t[di];
        ans+=s[di][q]-s[di][p];
        ll dd=*st[p].upper_bound(di)-di;
        ll du=di-*(--st[p].lower_bound(di));
        //printf("%lld %lld\n",dd,du);
        ans-=du*dd*c[p];
        dd=*st[q].upper_bound(di)-di;
        du=di-*(--st[q].upper_bound(di));
        //printf("%lld %lld\n",dd,du);
        ans+=du*dd*c[q];
        di=(di+ddi)%d;
        q=(q+dq)%26;
        if(pans<ans){
            st[p].erase(di);
            st[q].insert(di);
            t[di]=q;
        }
        else ans=pans;
        //printf("%lld %lld\n",ans,score(t));
    }
    rep(i,d) printf("%lld\n",i%26+1);
    //printf("%lld\n",ans);
}


Measured memory_bytes: 3928
#include<cstdio>
#include<cmath>
#include<complex>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> C;
const ld EPS = 1e-10;
#define cx real()
#define cy imag()

ll n, sx, sy, ex, ey;
ll x1[100], y[100], x2[100], y2[100], h[100];
C s, e;

ld dot(C a, C b) { return a.cx * b.cx + a.cy * b.cy; }
ld det(C a, C b) { return a.cx * b.cy - a.cy * b.cx; }
ld distanceLineSegmentAndPoint(C a, C b, C c) {
  if (dot(b-a, c-a) < EPS) return abs(c-a);
  if (dot(a-b, c-b) < EPS) return abs(c-b);
  return abs(det(b-a, c-a)) / abs(b-a);
}
C intersectionLine(C a1, C a2, C b1, C b2) {
  C a = a2 - a1, b = b2 - b1;
  return a1 + a * det(b, b1 - a1) / det(b, a);
}
bool isPointOnLineSegment(C a, C b, C c) { return abs(a-c) + abs(c-b) - abs(a-b) < EPS; }

bool check(ld x) {
  //printf("\n");
  for (ll i = 0; i < n; i++) {
    C c[4];
    c[0] = C(x1[i], y[i]);
    c[1] = C(x2[i], y[i]);
    c[2] = C(x2[i], y2[i]);
    c[3] = C(x1[i], y2[i]);
    ld len = 1e10;
    for (ll j = 0; j < 4; j++) len = min(len, distanceLineSegmentAndPoint(s, e, c[j]));
    for (ll j = 0; j < 4; j++) len = min(len, distanceLineSegmentAndPoint(c[j], c[(j+1)%4], s));
    for (ll j = 0; j < 4; j++) len = min(len, distanceLineSegmentAndPoint(c[j], c[(j+1)%4], e));
    //printf("!");
    if (x - len < -EPS) continue;
    ld y = sqrt(x * x - len * len);
    //printf("x: %Lf, len: %Lf, y: %Lf, h: %lld\n", x, len, y, h[i]);
    if (y + h[i] - x > -EPS) return false;
  }
  //printf("ok\n");
  return true;
}

int main() {
  while (scanf("%lld", &n), n) {
    scanf("%lld%lld%lld%lld", &sx, &sy, &ex, &ey);
    s = C(sx, sy);
    e = C(ex, ey);
    for (ll i = 0; i < n; i++) scanf("%lld%lld%lld%lld%lld", &x1[i], &y[i], &x2[i], &y2[i], &h[i]);
    bool flag = false;
    for (ll i = 0; i < n; i++) {
      if (x1[i] <= sx && sx <= x2[i] &&
          x1[i] <= ex && ex <= x2[i] &&
          y[i] <= sy && sy <= y2[i] &&
          y[i] <= ey && ey <= y2[i]) flag = true, i = n;
      C c[4];
      c[0] = C(x1[i], y[i]);
      c[1] = C(x2[i], y[i]);
      c[2] = C(x2[i], y2[i]);
      c[3] = C(x1[i], y2[i]);
      for (ll j = 0; j < 4; j++) {
        C temp = intersectionLine(s, e, c[j], c[(j+1)%4]);
        //printf("%Lf, %Lf\n", c[j].cx, c[j].cy);
        //printf("%Lf, %Lf\n", c[(j+1)%4].cx, c[(j+1)%4].cy);
        //printf(">%Lf, %Lf\n", temp.cx, temp.cy);
        if (isPointOnLineSegment(s, e, temp) && isPointOnLineSegment(c[j], c[(j+1)%4], temp)) {
          flag = true;
          i = n;
          break;
        }
      }
    }
    if (flag) {
      printf("0\n");
      continue;
    }
    ld lb = 0.0, ub = 1000.0;
    while (ub - lb > EPS) {
      ld mid = (lb + ub) / 2;
      if (check(mid)) lb = mid;
      else ub = mid;
    }
    printf("%Lf\n", lb);
  }
}



Measured memory_bytes: 2976
n, p = map(int, input().split())
a = list(map(int, input().split()))
a1 = []
a2 = []
for i in range(n):
    if a[i] % 2 == 0:
        a2.append(a[i])
    else:
        a1.append(a[i])
if len(a2) == n:
    if p == 0:
        print(2**n)
    else:
        print(0)
else:
    print(2**(n-1))

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

int main(){
    string S; cin >> S;
    int cnt=0;
    
    for (int i=0; i<100; i++){
        if (i%2==1){
            if (S[i]=='R') cnt++;
        }
        else{
            if (S[i]=='L') cnt++;
        }
    }
    if (cnt!=0) cout << "No";
    else cout << "Yes";
    
}


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

int main(){
  int n;
  cin >> n;
  vector<vector<ll>> c(10,vector<ll>(10,0));
  vector<P> k(n+1);
  for(int i = 1; i <= n; i++) {
    int a = i % 10;
    int d = 0;
    int p = 1;
    while(i / p > 0) {
      p *= 10;
    }
    p /= 10;
    int b = (i / p) % 10;
    c[b][a]++;
    k[i] = P(b,a);
  }
  ll ans = 0;
  for(int i = 1; i <= n; i++) ans += c[k[i].second][k[i].first];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
const int N=1e5+5,MOD=1e9+7;
int a[15][6],n,tmp;
ll rem[15][N];
string s;
char ch;
int main(){
    for(int i=0;i<10;i++){
        ll x=i;
        for(int j=0;j<6;j++){
            a[i][j]=(x%13);
            x*=10;
        }
    }
    cin>>s;
    n=s.size()-1;
    for(int i=n;i>=0;i--){
        if(s[i]=='?'){
            for(int k=0;k<10;k++){
                tmp=a[k][(n-i)%6];
                for(int j=0;j<13;j++){
                    rem[(j+tmp)%13][i]+=(rem[j][i+1]+(i==n&&!j)%MOD);
                    rem[(j+tmp)%13][i]=(rem[(j+tmp)%13][i]%MOD);
                }

            }
        }
        else{
            ch=s[i]-'0';
            tmp=a[ch][(n-i)%6];
            for(int j=0;j<13;j++){
                rem[(j+tmp)%13][i]+=(rem[j][i+1]+((i==n)&&!j)%MOD);
                 rem[(j+tmp)%13][i]= ( rem[(j+tmp)%13][i]%MOD);
            }

        }
    }
    cout<<rem[5][0]%MOD<<'\n';
	return 0;
}



Measured memory_bytes: 10752
use std::io::*;
use std::str::FromStr;

fn main() {
	let k: u64 = read();
	solve(k);
}

fn solve(k: u64) {
	let mut v = vec![0_u32];
	let mut l = 1_usize;
	let mut p = 0_usize;
	for _ in 0..k {
		for i in 0..l {
			if i == l-1 {
				if v[i] == 9 {
					l += 1;
					v.push(0);
					p = l-1;
				} else {
					p = l-1;
				}
			} else {
				if v[i] == 9 {
					continue;
				} else if v[i] <= v[i+1] {
					p = i;
					break;
				} else {
					continue;
				}
			}
		}
		v[p] += 1;
		let mut temp = v[p];
		for i in (0..p).rev() {
			temp = if temp > 0 { temp - 1 } else { 0 };
			v[i] = temp;
		}
	}
	for i in v.iter().rev() {
		print!("{}", i);
	}
	print!("\n");
}

fn read<T: FromStr>() -> T {
	let stdin = stdin();
	let stdin = stdin.lock();
	let token: String = stdin
		.bytes()
		.map(|c| c.expect("failed to read char") as char)
		.skip_while(|c| c.is_whitespace())
		.take_while(|c| !c.is_whitespace())
		.collect();
	token.parse().ok().expect("failed to parse token")
}



Measured memory_bytes: 4352
using System;

namespace ABC087_A_Buying_Sweets
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			int x = int.Parse(Console.ReadLine());
			int a = int.Parse(Console.ReadLine());
			int b = int.Parse(Console.ReadLine());

			int money = x - a;
			
			Console.WriteLine(money % b);
		}
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
    int A, B, C, D; cin >> A >> B >> C >> D;
    while (true)
    {
        if(C - B > 0){
            C = C - B;
        }else{
            cout << "Yes" << endl; break;
        };

        if(A - D > 0){
            A = A - D;
        }else{
            cout << "No" << endl; break;
        };
    }
    
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int H, W, K; cin >> H >> W >> K;
	vector<vector<bool>> grid (H, vector<bool> (W));
	F0R(i, H) F0R(j, W) {
		char c; cin >> c;
		grid[i][j] = c == '#';
	}
	int ans = 0;
	F0R(a, 1 << (H + W)) {
		int cnt = 0;
		vector<vector<bool>> copy = grid;
		F0R(i, H) if (a & (1 << i)) {
			F0R(j, W) copy[i][j] = 0;
		}
		F0R(i, W) if (a & (1 << (i + H))) {
			F0R(j, H) copy[j][i] = 0;
		}
		F0R(i, H) F0R(j, W) cnt += copy[i][j];
		ans += cnt == K;
	}
	print(ans);
}

Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second

int par[200010], Rank[200010];

void init(int n) {
	for (int i = 0;i <= n;i++)par[i] = i, Rank[i] = 0;
}
int find(int x) {
	if (par[x] == x)return x;
	else return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (Rank[x] < Rank[y])par[x] = y;
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}

int main() {
	ll n, x, y, ans = 0;
	PP px[100010], py[100010];
	cin >> n;
	priority_queue<PP, vector<PP>, greater<PP>>p;
	for (int i = 0;i < n;i++) {
		cin >> x >> y;
		px[i] = PP(x, P(y, i));
		py[i] = PP(y, P(x, i));
	}
	sort(px, px + n);
	sort(py, py + n);
	for (int i = 0;i < n-1;i++) {
		p.push(PP(min(abs(px[i].fr - px[i + 1].fr), abs(px[i].sc.fr - px[i+1].sc.fr)),P(px[i].sc.sc,px[i+1].sc.sc)));
	}
	for (int i = 0;i < n - 1;i++) {
		p.push(PP(min(abs(py[i].fr - py[i + 1].fr), abs(py[i].sc.fr - py[i + 1].sc.fr)), P(py[i].sc.sc, py[i + 1].sc.sc)));
	}
	init(100010);
	while (!p.empty()) {
		PP q = p.top();
		p.pop();
		if (!same(q.sc.fr, q.sc.sc)) {
			unite(q.sc.fr, q.sc.sc);
			ans += q.fr;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 13040
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
  int N,l,r,x;
  cin >> N;
  
  for (int i=0; i<N; i++)
    {
      cin>>l>>r;
      x+=(r-l+1);      
    }
 cout<<x<<endl;
}

Measured memory_bytes: 256
// This is the start of  template//
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long int
#define ll int 
#define vll vector<int>
#define pb push_back
#define pll pair<int,int>
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
void input(){
#ifndef ONLINE_JUDGE 
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout); 
#endif
}
#define INF LONG_LONG_MAX
#define mod 1000000007
#define array(a,n) vll a(n); rep(i,0,n) cin>>a[i];
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define cases int t; cin>>t; while(t--)
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;
ll power(ll a,ll n)
{
	if(n==0)
		return 1;
	if(n%2)
	{
		return (a*power((a*a)%mod,n/2))%mod;
	}
	return power((a*a)%mod,n/2);
}
int32_t main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  input();
  int n,pa = 0,g,maxi,cnt = 0 ;
  cin>>n;
  array(a,n);
  g = __gcd(a[0],a[1]);
  maxi = *max_element(a.begin(),a.end());
  vector<int>count(maxi+1,0);
  count[a[0]]++,count[a[1]]++;
  for(int i = 2 ;i<n ; i++)
  {
  	count[a[i]]++;
  	g = __gcd(g,a[i]); 
  }
  for(int i = maxi ;i>=1 ;i--)
  {
  	cnt  = 0 ;
  	int j = i;
  	while (j <= maxi) 
		{ 
			

		if(count[j] >=2) 
				{
					pa = j ;
					break;
				} 
		else if (count[j] == 1)		 
				cnt++;		 
			
		j += i; 
			if (cnt == 2)		 
				{
					pa = i ;
					break;
				}
		} 
	if(pa)
		break;
  }
  if(pa == 1)
  {
  	cout<<"pairwise coprime";
  }
  else if(g == 1)
  {
  	cout<<"setwise coprime";
  }
  else 
  	cout<<"not coprime";

}



Measured memory_bytes: 18704
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	sc = bufio.NewScanner(os.Stdin)
)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := nextInt()
	b := nextInt()

	s := 0
	for i := 1; i <= n; i++ {
		t := sum(i)
		if t >= a && t <= b {
			s += i
		}
	}
	fmt.Println(s)
}

func sum(n int) int {
	r := 0
	for {
		if n < 10 {
			r += n
			break
		}
		r += n % 10
		n /= 10
	}
	return r
}

func nextInt() int {
	i, err := strconv.Atoi(nextWord())
	pnc(err)
	return i
}

func nextWord() string {
	sc.Scan()
	return sc.Text()
}

func pnc(err error) {
	if err != nil {
		panic(err)
	}
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll a;
    double b;
    cin >> a >> b;
    cout << (ll)floor(a * b) << endl;
}

Measured memory_bytes: 3712
a=int(input())
b=0
xy = [map(int, input().split()) for _ in range(a)]
x, y = [list(i) for i in zip(*xy)]
for i in range(a-2):
  if x[i]==y[i] and x[i+1]==y[i+1] and x[i+2]==y[i+2]:
    b=b+1
if b==0:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 9080
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct node {
  int key;
  struct node *p , *r , *l;
} Node;

Node *root, *NIL;

Node * treeMinimum(Node *x) {
  while(x->l != NIL) x = x->l;
  return x;
}

Node * find(Node *u,int k) {
  while(u != NIL && k != u->key) {
    if( k < u->key) u = u->l;
    else u = u->r;
  }
  return u;
}

Node * treeSuccessor(Node *x) {
  if(x->r != NIL) return treeMinimum(x->r);
  Node *y = x->p;
  while(y != NIL && x == y->r) {
    x = y;
    y = y->p;
  }
  return y;
}

void treeDelete(Node *z) {
  Node *y;
  Node *x;

  if(z->l == NIL || z->r == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->l != NIL) {
    x = y->l;
  } else {
    x = y->r;
  }

  if( x != NIL) {
    x->p = y->p;
  }

  if(y->p == NIL) {
    root = x;
  } else {
    if(y == y->p->l){
      y->p->l = x;
    } else {
      y->p->r = x;
    }
  }

  if(y !=z) {
    z->key = y->key;
  }

  free(y);
}

void insert(int k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->l = NIL;
  z->r = NIL;

  while( x != NIL) {
    y = x;
    if(z->key < x->key) {
      x = x->l;
    } else {
      x = x->r;
    }
  }
  z->p = y;
  if(y == NIL) {
    root = z;
  }
  else {
    if(z->key < y->key) {
     y->l = z;
   } else {
     y->r = z;
   }
  }
}

void inorder(Node *u) {
  if(u == NIL) return;
  inorder(u->l);
  printf(" %d", u->key);
  inorder(u->r);
}

void preorder(Node *u) {
  if(u == NIL) return;
  printf(" %d", u->key);
  preorder(u->l);
  preorder(u->r);
}

int main() {
  int n, i , x;
  char com[6];

  scanf("%d",&n);

  for(i = 0; i < n; i++) {
    scanf("%s\n", com);
    if(strcmp(com, "insert") == 0) {
      scanf("%d",&x);
      insert(x);
    } else if(strcmp(com, "print") == 0) {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(strcmp(com,"find") == 0) {
      scanf("%d",&x);
      Node *t = find(root,x);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    } else if(strcmp(com , "delete") == 0) {
      scanf("%d\n", &x);
      treeDelete(find(root,x));
    }
  }

  return 0;
}

Measured memory_bytes: 19368
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()
#define pb push_back

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

const int N = 2e5 + 20 ;
int n , a[N] , b[N] , ord[N] ;

inline bool cmp (int i , int j) {
	return b[i] < b[j] ;
}

int32_t main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;

	cin >> n ;

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

	iota(ord , ord + n , 0) ;
	sort(ord , ord + n , cmp) ;

	for (int i = 0 , sum = 0 ; i < n ; i ++) {
		sum += a[ord[i]] ;
		if (sum > b[ord[i]]) return cout << "No\n" , 0 ;
	}

	cout << "Yes\n" ;

}


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

namespace Keyence
{
    class Beginning
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int count = 0;
            int m = n[0] * 1000 + n[1] * 100 + n[2] * 10 + n[3];
            for (int i = 0; i < 4; i++)
            {
                if (n[i] == 1) { count++; }
                if (n[i] == 9) { count+=10; }
                if (n[i] == 7) { count+=100; }
                if (n[i] == 4) { count+=1000; }
            }
            Console.WriteLine(count == 1111 ? "YES" : "NO");
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> P;
int n,q,k,a[100000],b[100000],c[100000],x[100000],y[100000],flag[100000],ans[100000];
queue<int> que;

signed main(){
  cin >> n;
  vector<vector<P>> edge(n,vector<P>());
  for(int i=0;i<n-1;i++){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--; b[i]--;
    edge[a[i]].push_back(P(b[i],c[i]));
    edge[b[i]].push_back(P(a[i],c[i]));
  }
  cin >> q >> k; k--;
  for(int i=0;i<q;i++){
    cin >> x[i] >> y[i];
    x[i]--; y[i]--;
  }
  que.push(k);
  flag[k]=1;
  while(!que.empty()){
    int t=que.front();
    que.pop();
    for(auto i:edge[t]){
      if(!flag[i.first]){
        ans[i.first]=ans[t]+i.second;
        flag[i.first]=1;
        que.push(i.first);
      }
    }
  }
  for(int i=0;i<q;i++){
    cout << ans[x[i]]+ans[y[i]] << endl;
  }
}


Measured memory_bytes: 14720
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n=3;
	vvi in(n,vi(n));
	rep(i,n)rep(j,n)cin>>in[i][j];
	bool h=false;
	rep(i,400)rep(j,400)rep(k,400){
		bool H=true;
		rep(q,3)if(in[0][q]-i==in[1][q]-j&&in[0][q]-i==in[2][q]-k);
		else H=false;
		if(H)h=true;
	}
	if(h)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}








Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#define int long long
#define double long double
#define oku7 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
using namespace std;
std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位
const int MAXVAL = 1000000000;

vector<int> bmap;
vector<int> a;
signed main() {
	int N;
	for (int i = 1; i <= MAXVAL; i *= 2) {
		bmap.push_back(i);
	}
	cin >> N;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		a.push_back(tmp);
	}



	int ans = 0;

	for (int num : a) {
		int add = 0;
		for (int i = 1; i < (int)bmap.size(); i++) {
			if (num % bmap[i] == 0) add = i;
		}
		ans += add;
	}

	cout << ans << "\n";


	return 0;
}

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

int main(){
  long long K, A, B;
  cin >> K >> A >> B;
  if(A < B){
    long long t = (K-(A-1))/2;
    if(t <= 0) cout << K+1 << endl;
    else cout << max(t*(B-A) + A + (K-A+1)%2,K+1) << endl;
  }else{
    cout << K+1 << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
using namespace std;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 1, s.size()) {
        if (s[i - 1] != s[i]) {
            ans++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 512
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

int power(int x, unsigned int y) 
{ 
    int temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
}


void raushan_kumar(){
	int n;cin>>n;
	int cnt=1;
	int pos=0;
	for(int i=1;;i++){
		if(power(2,i)>n){
			pos=i-1;
			break;
		}
	}
	int sum=0;
	for(int i=0;i<=pos;i++){
		sum+=power(2,i);
	}
	cout<<sum;
}

int32_t main()
{

	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}

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

ll combination(ll n,ll r) {
  if((n==1)||(n==0))return 0;
  if ( r * 2 > n ) r = n - r;
  ll dividend = 1;
  ll divisor  = 1;
  for (ll i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
 
  return dividend / divisor;
}

int main()
{
    int N;
    vector<int>array;
    map<int,ll>m;
    ll sum=0;
    cin>>N;
    for(int i=0;i<N;i++){
        int a;
        cin>>a;
        array.push_back(a);
        m[array[i]]++;
    }
    for(pair<int,ll>p:m){
        ll dic=p.second;
        sum+=combination(dic,2);
    }
    for(int i=0;i<N;i++){

        ll ans=sum-(combination(m[array[i]],2)-combination(m[array[i]]-1,2));
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 11124
mod = 1000000007
eps = 10**-9


def main():
    import sys
    from bisect import bisect_left
    input = sys.stdin.readline

    D = int(input())
    C = list(map(int, input().split()))
    S = []
    for _ in range(D):
        S.append(list(map(int, input().split())))
    ans = 0
    last = [-1] * 26
    days = [[-1] for _ in range(26)]
    T = []
    for d in range(D):
        t = int(input()) - 1
        T.append(t)
        ans += S[d][t]
        last[t] = d
        days[t].append(d)
        for i in range(26):
            ans -= C[i] * (d - last[i])
    for t in range(26):
        days[t].append(D)

    M = int(input())
    for _ in range(M):
        d, q = map(int, input().split())
        d -= 1
        q -= 1
        t = T[d]
        ans += S[d][q]
        ans -= S[d][t]
        i = bisect_left(days[q], d)
        ans += C[q] * (d - days[q][i-1]) * (days[q][i] - d)
        j = bisect_left(days[t], d)
        ans -= C[t] * (d - days[t][j-1]) * (days[t][j+1] - d)
        #print(days[q], days[t])
        T[d] = q
        days[q].append(d)
        days[q].sort()
        days[t].remove(d)
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73464
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>

using namespace std;


int main() {
	string s;
	cin >> s;
	int a=0, b=0;
	for (int i = 0; i < s.size(); i++) {
		if (i % 2==0) {
			if (s[i] == '1') {
				a++;
			}else{
				b++;
			}
		}
		else {
			if (s[i] == '0') {
				a++;
			}else{
				b++;
			}
		}
	}

	cout << min(a, b) << endl;

	return 0;
}


Measured memory_bytes: 512
import math 

a,b,x=map(int, input().split())
if x>a*a*b/2:
  t=2*(a*a*b-x)/(a*a*a)
  print(math.degrees(math.atan(t)))
else:
  t=2*x/a/b
  print(math.degrees(math.atan(b/t)))


Measured memory_bytes: 2940
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final int MOD = 1000000007;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		int[] a = new int[n];
		int sum = 0;
		for (i = 0; i < n; i++) {
			a[i] = parseInt(sc.next());
			sum += a[i];
		}
		sc.close();
		int sum4 = (int) ceil((double)sum / (4*m));
		int cnt=0;
		for (i = 0; i < n; i++) {
			if(a[i]>= sum4)cnt++;
		}
		out.println(cnt>=m?"Yes":"No");
	}
}


Measured memory_bytes: 22740
use std::collections::*;
use std::cmp::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let 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")
    };
}

fn main() {

    input!{
        s: i32,
        w: i32,
    }

    println!("{}", if w >= s { "unsafe" } else { "safe"});
}


Measured memory_bytes: 2156
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);


signed main()
{
	std::cin.sync_with_stdio(false);
	std::cin.tie(0);

	int Q, H, S, D, N;
	cin >> Q >> H >> S >> D >> N;

	H = min(H, Q * 2);
	S = min(S, H * 2);
	D = min(D, S * 2);
	int ans = D*(N / 2) + S*(N % 2);
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8

x = int(input())

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

D = make_divisors(x)
for i in D:
    for j in range(-10000,10000):
        k = j +  i
        if k**5 - j**5 == x:
            a, b = k, j
            break

print(a,b)

Measured memory_bytes: 9456
#include<iostream>
using namespace std;
int main(){
  int x,y,bet,les,ch;
  cin>>x>>y;
  if(x>=y){
    bet=x;les=y;
  }else{bet=y;les=x;}
  for(;;){
    ch=bet%les;
    if(ch==0){
      cout<<les<<endl;
      break;
    }
    if(les%ch==0){
      cout<<ch<<endl;
      break;
    }
    bet=les;
    les=ch;
  }
  return 0;
}

Measured memory_bytes: 3096
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))

class BIT:
  def __init__(self, n):
    self.n = n
    self.data = [0] * (n + 1)
    self.el = [0] * (n + 1)
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.data[i]
      i -= i & -i
    return s
  def add(self, i, x):
    self.el[i] += x
    while i <= self.n:
      self.data[i] += x
      i += i & -i
  def get(self, i, j = None):
    if j is None:
      return self.el[i]
    return self.sum(j) - self.sum(i)
  def lowerbound(self, s):
    x = 0
    y = 0
    for i in range(self.n.bit_length(), -1, -1):
      k = x + (1 << i)
      if k <= self.n and (y + self.data[k] < s):
        y += self.data[k]
        x += 1 << i
    return x + 1

def check(x):
  b = [0] * N
  for i in range(N):
    if a[i] <= x: b[i] = -1
    else: b[i] = 1
  cs = [0] * (N + 1)
  for i in range(N): cs[i + 1] = cs[i] + b[i]
  mn = -min(cs) + 1
  fwk = BIT(N + 1)
  k = 0
  for i in range(N + 1):
    k += fwk.sum(cs[i] + mn)
    fwk.add(cs[i] + mn, 1)
  #print(k)
  return k < N * (N + 1) // 4


ok = max(a)
ng = 0
while ok - ng > 1:
  m = (ok + ng) // 2
  if check(m): ok = m
  else: ng = m
print(ok)

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

#define lli long long int
#define REP(i, s, n) for (int i = s; i < n; i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL << 50)
#define DEBUG 0
#define mp(a, b) make_pair(a, b)
#define SORT(V) sort(V.begin(), V.end())
#define PI (3.141592653589794)

set<lli> yaku(lli num)
{
    set<lli> rtn;
    for (lli i = 1; i * i <= num; i++)
    {
        if (num % i == 0)
        {
            rtn.insert(i);
            rtn.insert(num / i);
        }
    }
    return rtn;
}
bool ok(lli n, lli k)
{
    if (n == 1)
        return true;
    if (n < k)
        return false;
    if (n % k == 0)
        return ok(n / k, k);
    else
        return ok(n % k, k);
}

void func(long long N)
{
    set<lli> y = yaku(N);
    set<lli> yy = yaku(N - 1);

    lli cnt = 0;

    for (auto e : y)
    {
        if (e == 1)
            continue;
        if (ok(N, e))
            cnt++;
    }
    for (auto e : yy)
    {
        if (y.find(e) != y.end())
            continue;
        if (ok(N, e))
            cnt++;
    }
    cout << cnt << endl;
}

int main()
{
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld", &N);
    func(N);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vl a(n);
    rep(i, n) cin >> a[i];
    sort(whole(a));
    ll ans = 0;
    vector<ll> x(n);
    x[0] = (-1);
    rep(i, n) {
        if (i==0) continue;
        if (x[i-1]<0) x[i] = 2;
        else x[i] = -2;
        if (i==n-1) {x[n-1]/=2;}
    }
    sort(whole(x));
    ll res = 0;
    rep(i, n) {
        res += x[i]*a[i];
    }
    chmax(ans, res);
    res = 0;
    x[0] = 1;
    rep(i, n) {
        if (i==0) continue;
        if (x[i-1]<0) x[i] = 2;
        else x[i] = -2;
        if (i==n-1) {x[n-1]/=2;}
    }
    sort(whole(x));
    rep(i, n) {
        res += x[i]*a[i];
    }
    chmax(ans, res);
    
    pr(ans);
    return 0;
}


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

int main(){
  int a,b,y;
  cin >> a >> b;
  y = a * b;
  
  if (y % 2 == 0){
    cout << "Even" << endl;
  }
  
  else if (y % 2 != 0){
    cout << "Odd" << endl;
  }
  return 0;
}
  

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

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

  long long fb_sum = 0;

  for (int elem = 1; elem <= N; elem++){
    if (elem % 3 != 0 & elem % 5 != 0) fb_sum += elem;
  }

  cout << fb_sum << endl;
}

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

//Compiler version g++ 6.3.0

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x,n; cin>>x>>n;
    int a[n];
    unordered_set<int> s;
    for(int i = 0; i < n; i++){
      cin>>a[i];
      s.insert(a[i]);
    }
    int ans = x;
    if(s.find(x)==s.end()){
      cout << x << "\n";
    } else {
      int i = x - 1, j = x + 1;
      while(s.find(i)!=s.end()){
        i--;
      }
      while(s.find(j)!=s.end()){
        j++;
      }
      if(abs(i-x) <= abs(j-x)) cout << i << "\n";
      else cout << j << "\n";
    }
    return 0;
}

Measured memory_bytes: 3600
# -*- coding: utf-8 -*-
from functools import reduce

n, a, b = map(int, input().split())
result = 0

for i in range(1, n + 1):
    str_num = '0' + str(i)
    num = reduce(lambda a, b:int(a) + int(b), list(str_num))
    if num >= a and num <= b:
        result += i
print(result)


Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include<cstdio>
#include <cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int N; cin >> N;
    string S; cin >> S;
    string mae = S.substr(0, N), ushi = S.substr(N);
    map<pair<string, string>, ll> mp;
    for(int bit = 0; bit < (1<<N); bit++) {
        string a = "", b = "";
        for(int i = 0; i < N; i++) {
            if(bit & (1<<i)) a += mae[i];
            else b += mae[i];
        }
        mp[make_pair(a, b)] ++;
    }
    ll ans = 0;
    for(int bit = 0; bit < (1<<N); bit++) {
        string a = "", b = "";
        for(int i = N - 1; i >= 0; i--) {
            if(bit & (1<<i)) b += ushi[i];
            else a += ushi[i];
        }
        ans += mp[make_pair(a, b)];
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 49408
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int main(){
	int a,b,f[15],len;
	double x,r;
	scanf("%d%d",&a,&b);
	f[0]=1;
	for(int i=1;i<=6;i++) f[i]=f[i-1]*10;
	for(int i=1;i<=3;i++){
		if(b/f[i]==0){
			len=i;
			break;
		}
	}
	if(len==1) x=a*10+b;
	else if(len==2) x=a*100+b;
	else x=a*1000+b;
	r=sqrt(x);
	if(r-(int)r/1==0) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
int n,m,i,j,h[1501],w[1501],p[1<<21],q[1<<21],x,b;
main(){
  while(scanf("%d%d",&n,&m),n){
    for(x=i=0;i<n;)scanf("%d",h+i++);
    for(x=i=0;i<m;)scanf("%d",w+i++);
    for(i=0;i<n;++i)for(b=0,j=i;j<n;++p[b])b+=h[j++];
    for(i=0;i<m;++i)for(b=0,j=i;j<m;++q[b])b+=w[j++];
    for(i=0;i<1<<21;p[i]=q[i++]=0)x+=p[i]*q[i];
    printf("%d\n",x);
  }
}

Measured memory_bytes: 19528
#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

int main() {
    int n;
    while (cin >> n, n) {
        vector<int> s(n);
        for (auto &si: s) cin >> si;
        sort(s.begin(), s.end());
        int sum = accumulate(s.begin(), s.end(), 0) - s.front() - s.back();
        cout << sum / (n - 2) << endl;
    }
    return 0;
}


Measured memory_bytes: 3120
//shara's here
//SPEEEEEEEEEED IS KEEEEEEEEEEY
#include <bits/stdc++.h>
using namespace std;
//fold
typedef int q;
typedef double w;
typedef string s;
typedef long long ll;
//using ll = long long;
typedef long double ld;
const ll INF = 1e18 + 10;
const ll MINF = -(1e18 + 10);
#if defined(BANYANYA)
#include "/home/xsharawi/Desktop/cpp/debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define push_back pb
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
//endfold
int main(){
    speed;
    ll n,k,sum=0;
    cin>>n>>k;
    ll monsters[n];
    for(ll i=0;i<n;i++){
            cin>>monsters[i];
        }
    if(k>=n)cout<<0<<endl;
    else{
        sort(monsters,monsters+n);
        int lk=n-1;
        while(k--){
            monsters[lk]=0;
            lk--;
        }
        for(ll i=0;i<n;i++){
            sum+=monsters[i];
        }
        cout<<sum<<endl;
    }
return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/

Measured memory_bytes: 1792
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1
for i in range(n):
	print(ans[i+1])

Measured memory_bytes: 9204