akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST

ll comb(ll n, ll r) {
    ll res, deno, mole;
    res = deno = mole = 1;
    for (ll i = 0; i < r; i++) {
        mole *= (n - i);
        //mole %= DIV;
        deno *= (r - i);
        //deno %= DIV;
    }
    //res = modinv(deno, DIV);
    //res = (res / mole) % DIV;
    return mole / deno;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(size_t i=0;i<n; i++)
    {
        cin >> a[i];
    }
    sort(a.rbegin(), a.rend());
    //for(size_t i=0;i<n; i++)
    //{
    //    cerr << a[i] << endl;
    //}

    ll max_comb = INF;
    pair<ll, ll> max_pair;
    double center = a[0] / 2.0;
    ll center_index = 1;
    for(size_t i=1;i<n; i++)
    {
        if(abs(center - a[i]) < max_comb)
        {
            //cerr << abs(center - a[i]) << ":" << a[i] << endl;
            max_comb = abs(center - a[i]);
            center_index = i;
        }
    }
    /*
    for(ll i=0;i<n-1; i++)
    {
        for(ll j=i+1;j<n; j++)
        {
            ll _comb = comb(a[i], a[j]);
            if(max_comb < _comb)
            {
                max_comb = _comb;
                max_pair = make_pair(a[i], a[j]);
            }
            //cerr << a[i] << ":" << a[j] << ":" << _comb << endl;
        }
    }
    */

    //cerr << max_comb << endl;
    cout << a[0] << " " << a[center_index] << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

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

int main() {
  int N, D;
  cin >> N >> D;
  long x, y;
  long count = 0;
  for (int i = 0; i < N; i++) {
    cin >> x >> y;
    if (sqrt(x*x + y*y) <= D) {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3620
//177 c 求乘积之和
#include <bits/stdc++.h>
using namespace std;
const int MAX=2e5+6;
long long sl[MAX],sz[MAX];
int main(){
	int n;
	cin>>n;
	for (int i=1;i<=n;i++) {
		cin>>sl[i];
		sz[i]=(sz[i-1]+sl[i]); 
	}
	long long ans=0;
	for (int j=1;j<=n;j++) {
		ans+=(sl[j]%1000000007)*((sz[n]-sz[j])%1000000007);
		ans%=1000000007;
	}
	cout<<ans<<endl;
	return 0;
} 

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll a,b;
  cin >> a >> b;
  if(a<6) cout << 0 << endl;
  else if(a>12) cout << b << endl;
  else cout << b/2 << endl;
  return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  int N; cin>>N;
  vector<int> P(N+1);
  rep1(i,N+1)cin>>P.at(i);
  int k = 0;
  rep1(i,N+1){
    if(i!=P.at(i)){
      k++;
      if(P.at(P.at(i))!=i){
        cout<<"NO"<<endl;
        return 0;
      }
    }
  }
  if(k<=2)  cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

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

int main() {
  int N , K;
  int initValue, value;
  int twice, plus;
  
  initValue = value = 1;
  twice = plus = initValue;
  
  cin >> N >> K;
    
  for (int i = 0; i < N; i++) {
    twice = value * 2;
    plus = value + K;
    
    if (twice < plus) {
      value = twice;
    } else {
      value = plus;
    }
  }
  
  cout << value << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<fstream>
#include<algorithm>
using namespace std;
using ll = long long;

int main(){
    ll n;
    cin >> n;
    map<ll,ll> mp;
    bool flag = true;
    for(ll i=0;i<n;i++){
        ll x;
        cin >> x;
        mp[x]++;
        if(mp[x]>=2)    flag = false;
    }
    if(flag) cout << "YES";
    else cout << "NO";
}   

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

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

int main() {
  ll n, a, b, ans = 0;
  cin >> n >> a >> b;
  if ((b - a) % 2 == 0)
    ans = (b - a) / 2;
  else
    ans = min(a - 1, n - b) + 1 + (b - a - 1) / 2;

  if (a == b) ans = 0;
  cout << ans << endl;
  return 0;
}


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

int main() {
    string s , t , u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(u == s){
        cout << a-1 << " " << b << endl;
    }
    else{
        cout << a << " " << b-1 << endl;
    }
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc145/tasks/abc145_c
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N; cin>>N;
    vector<double> x(N+1);
    vector<double> y(N+1);
    FOR(i,1,N+1){
        cin>>x.at(i)>>y.at(i);
    }

    double total=0;
    vector<int> v(N);
    iota(v.begin(), v.end(), 1);  
    do {
        dump(v);
        //double len=0;
        FOR(i,1,v.size()){
            ll s=v.at(i);
            ll e=v.at(i-1);
            dump(s,e);
            auto dx=x.at(s)-x.at(e);
            auto dy= y.at(s)-y.at(e);
            total += sqrt(dx*dx+dy*dy);
        }
    } while( next_permutation(v.begin(), v.end()) );
    double ans=total;
    FOR(i,1,N+1){
        ans /= (double)(i);
    }
    cout<<fixed<<std::setprecision(10)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>

using namespace std;

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

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

void testCase(){
    int a, b, c;
    cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b<<endl;
}

int main(){
    int t;
    t = 1;
    // cin>>t;
    while(t--){
        testCase();
    }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define 	pi 				3.14159265358979
#define 	mod 			1000000007
#define 	ll  			long long int
#define 	rep(i, a, b) 	for(ll i = a ; i < b ; i++)
#define     repn(i, a, b)   for(ll i = a ; i > b ; i--)
#define 	mod1 			1000003
#define     mod2            998244353
#define     inf             2e18
#define 	hi   			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define     sz              size()
#define     len             length()
#define 	F 				first
#define 	S 				second
#define 	PB 				push_back
#define 	MP				make_pair
#define 	B 				begin()
#define     RB              rbegin()
#define 	E 				end()
#define     UB              upper_bound
#define     LB              lower_bound
#define     present(k, m)   (m.find(k)!=m.end())?1:0
#define 	all(v) 			v.begin(), v.end()
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define     pll             pair<ll, ll>
#define     vll             vector<ll>
#define     vpll            vector<pll>
#define 	vs 				vector<string>
#define     vc              vector<char>
#define     sqr(a)          ((a)*(a))
#define 	print1(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define 	print2(a) 		for(auto i : a)cout<<i;cout<<"\n"
#define 	print3(a) 		for(auto i : a)cout<<i<<nl;
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
// ostringstream str1;
// str1 << n;
// string tmp = str1.str();
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }
 
bool compare(const pair<string, int>&a, const pair<string, int>&b){ return a.second<b.second; }
 
double logn(double n, double r) { return (n > r - 1) ? 1 + logn(n / r, r) : 0; }
 
 
// vll pwx(22);
// void cal(ll x){ pwx[0] = 1; rep(i, 1, 22)pwx[i] = x*(pwx[i-1]); }
 
/* ################################################################ */

void solve(){
    ll x;
    cin >> x;

    if(x >= 400 && x <= 599){
        cout << 8 << nl;
        return ;
    }

    if(x >= 600 && x <= 799){
        cout << 7 << nl;
        return ;
    }

    if(x >= 800 && x <= 999){
        cout << 6 << nl;
        return ;
    }
    if(x >= 1000 && x <= 1199){
        cout << 5 << nl;
        return ;
    }
    if(x >= 1200 && x <= 1399){
        cout << 4 << nl;
        return ;
    }
    if(x >= 1400 && x <= 1599){
        cout << 3 << nl;
        return ;
    }

    if(x >= 1600 && x <= 1799){
        cout << 2 << nl;
        return ;
    }
    if(x >= 1800 && x <= 1999){
        cout << 1 << nl;
        return ;
    }
    
}

int main(){
    // boost;
    // cal(2);
    int t = 1, k = 1;
    // cin>>t;
    while(t--){
        // cout<<"Case #"<<k<<": ";
        solve();
        k++;
    }
}

Measured memory_bytes: 3636
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define ST string
#define BS bitset
#define PA pair<LL,LL>
#define VE vector
#define VL vector<LL>
#define VP vector<pair<LL,LL>>
#define VVL vector<vector<LL>>
#define PQ priority_queue
#define PQS priority_queue<LL,vector<LL>,greater<LL>>
#define PB push_back
#define POB pop_back
#define PF push_front
#define POF pop_front
#define EB emplace_back
#define MP make_pair
#define TS to_string
#define TU to_ullong
#define BPL __builtin_popcountll
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORR(i,a,n) for(i=n-1;i>=a;i--)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define UB(a,n) *upper_bound(ALL(a),n)
#define LB(a,n) *lower_bound(ALL(a),n)
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
//#define ERR 0.00000000000001
#define NUM 200010
#define FAST cin.tie(0);ios::sync_with_stdio(false)

void Yn(LL a){if(a)printf("Yes\n");else printf("No\n");}
void YN(LL a){if(a)printf("YES\n");else printf("NO\n");}
LL pwmn(LL a,LL n){LL ans=1;while(ans<a)ans*=n;return ans;}
LL LBn(VL &v,LL a){LL mx=v.size(),mn=-1,md;while(mx-mn>1){md=(mx+mn)/2;if(v[md]<a)mn=md;else mx=md;}return mx;}
LL GCD(LL a,LL b){LL c=1,tmp=max(a,b);b=min(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp((char*)a,(char*)b);}
int scmpr(const void* a,const void* b){return strcmp((char*)b,(char*)a);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(m,d);x-=k*y;swap(x,y);}return mod(a*mod(x,MOD),MOD);}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
bool cmps(pair<LL,LL> a,pair<LL,LL> b){if(a.second!=b.second)return a.second<b.second;return a.first<b.first;}
template<typename T>bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  FAST;
  LL i,ans=0,N;
  cin>>N;
  if(N%10==7)ans=1;
  N/=10;
  if(N%10==7)ans=1;
  if(N/10==7)ans=1;
  Yn(ans);

  //cout<<ans<<endl;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int n, m;
  cin >> n >> m;

  vector<int> a(n), b(n), c(m), d(m);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }

  for (int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }

  for (int i = 0; i < n; i++) {
    int minV = 2000000000;
    int minI = 0;
    for (int j = 0; j < m; j++) {
      int dis = abs(a[i] - c[j]) + abs(b[i] - d[j]);

      if(minV > dis) {
        minV = dis;
        minI = j + 1;
      }
    }

    cout << minI << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n,a,b = LI()
    print(min(n*a,b))
    return

#B
def B():
    s = S()
    print(s.count("1"))
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

#Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 39408
import std.stdio, std.conv, std.string, std.math, std.regex, std.range, std.ascii, std.algorithm;

void main(){
	auto ip = readln.split.to!(int[]), A = ip[0], B = ip[1];
	int X;
	if(A > B){
		X += A;
		A--;
	} else {
		X += B;
		B--;
	}

		if(A > B){
		X += A;
	} else {
		X += B;
	}
	writeln(X);
}

Measured memory_bytes: 256
#include <stdio.h>

int main( void ){
// reader counts
  int intN;
  int intX;
  int intY;

scanf("%d %d %d",&intN, &intX, &intY );

  int intMax;
  int intMin;

  intMax = intX < intY ? intX : intY;
  intMin = (intX + intY - intN);
  if (intMin<0) intMin =0;

printf("%d %d\n",intMax, intMin);

  

return 0;
}



Measured memory_bytes: 128
import numpy
s = numpy.array(list(input()))
t = numpy.array(list(input()))
ns = len(s)
nt = len(t)
match = s.reshape(-1,1) == t.reshape(1,-1)
memo = numpy.zeros([ns+1, nt+1], dtype = int)
for i in range(ns):
    memo[i+1, 1:] = numpy.fmax(memo[i, :-1]+match[i], memo[i, 1:])
    
    memo[i+1] = numpy.maximum.accumulate(memo[i+1])
ans = []
while ns >0 and nt>0:
    if memo[ns, nt] == memo[ns-1, nt]:
        ns -= 1
    elif memo[ns, nt] == memo[ns, nt-1]:
        nt -= 1
    else:
        ans.append(s[ns-1])
        
        nt-=1
        ns -=1
print("".join(ans[::-1]))

Measured memory_bytes: 91868
#include<stdio.h>

	int dice[6];
	
void emov(){
	int buf;
	buf = dice[0];
	dice[0] = dice[3];
	dice[3] = dice[5];
	dice[5] = dice[2];
	dice[2] = buf;
}
void smov(){
int buf;
	buf = dice[0];
	dice[0] = dice[4];
	dice[4] = dice[5];
	dice[5] = dice[1];
	dice[1] = buf;
}

int main(){
	int i,j,n,ue,mae;
	
	for(i=0;i<6;i++){
		scanf("%d",&dice[i]);
	}
	scanf("%d",&n);
	for(j=0; j<n; j++){
		scanf("%d %d",&ue,&mae);
		for(i=0; dice[1] != mae && i<3; i++){
			smov();
		}
		
		if(dice[1] != mae){
			emov();
			
			for(i=0; dice[1] != mae; i++){
				smov();
			}
		}
		
		for(i=0; dice[0]!=ue; i++){
			emov();
		}
		printf("%d\n",dice[2]);
	}
    return 0;
}



Measured memory_bytes: 2048
import sys

#fp = open("input.txt", "r")
fp = sys.stdin

def isUnderConstruction(address, construction):
    for li in construction:
        if address[0] == li[0] and address[1] == li[1]:
            return True
    return False

while True:
    size = map(int, fp.readline()[:-1].split(" "))
    if size[0] + size[1] == 0:
        break

    n = int(fp.readline()[:-1])

    construction = []
    for i in xrange(n):
        element = map(int, fp.readline()[:-1].split(" "))
        construction.append(element)

    urban = []
    for i in range(size[1]+1):
        element = []
        for j in range(size[0]+1):
            if i == 0 or j == 0:
                element.append(0)
                continue
            if i == 1 and j == 1:
                element.append(1)
                continue
            if isUnderConstruction([j, i], construction):
                element.append(0)
            else:
                element.append(urban[i-1][j] + element[j-1])
        urban.append(element)
    print urban[size[1]][size[0]]

Measured memory_bytes: 4264
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int C[] = { 600,800,1000,1200,1400,1600 };
	int XYH[] = { 60,80,100,120,140,160 };
	int W[] = { 2,5,10,15,20,25 };
	for (int n; cin >> n&&n;) {
		int ans = 0;
		rep(i, 0, n) {
			int x, y, h, w; cin >> x >> y >> h >> w;
			rep(j, 0, 6) {
				if (XYH[j] >= x + y + h&&W[j] >= w) {
					ans += C[j];
					break;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
constexpr long long int mod = 998244353;
constexpr int max_n = 300000;
long long int factorial(int n) {
	static std::vector<long long int> memo(max_n + 1, -1);
	if (n == 0 || n == 1) return 1;
	if (memo[n] == -1) {
		for (auto i = 2; i < n; i += 500) {
			factorial(i);
		}
		memo[n] = (factorial(n - 1) * n) % mod;
	}
	return memo[n];
}
long long int exponent(long long int base, long long int exp) {
	switch (exp) {
	case 0: return 1;
	case 1: return base;
	default:
		auto r = exponent(base, exp / 2);
		return (((r * r) % mod) * exponent(base, exp % 2)) % mod;
	}
}
long long int inverse_factorial(int n) {
	static std::vector<long long int> memo(max_n + 1, -1);
	if (memo[n] == -1) {
		memo[n] = exponent(factorial(n), mod - 2) % mod;
	}
	return memo[n];
}
long long int combination(int n, int r) {
	auto num = factorial(n);
	auto dena = inverse_factorial(n - r);
	auto denb = inverse_factorial(r);
	return (((num * dena) % mod) * denb) % mod;
}
int main() {
	long long int n, a, b, k;
	std::cin >> n >> a >> b >> k;
	long long int sum = 0;
	for (auto red = 0; red <= n && red * a <= k; ++red) {
		if (((k - red * a) % b) == 0) {
			auto blue = ((k - red * a) / b);
			if (blue <= n) {
				sum += (combination(n, red) * combination(n, blue)) % mod;
				sum %= mod;
			}
		}
	}
	std::cout << sum << std::endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
 
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)


const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;

int main() 
{

    fast();
      
 
    str s,t;
    cin>>s>>t;
    ll q1[27]={0},q2[27]={0};
    vector<ll>adj[26];
    f(i,0,s.size())
    {

        q1[s[i]-'a']++;
        adj[s[i]-'a'].pb(i);
    }
    f(i,0,t.size())
    {
        q2[t[i]-'a']++;
    }
    f(i,0,26)
    {
        if(q1[i]==0&&q2[i]!=0)
        {
            cout<<-1;
            return 0;
        }
    }
    ll re=-1,res=0;
    f(i,0,t.size())
    {
        auto z=upper_bound(all(adj[t[i]-'a']),re);
        if(z!=adj[t[i]-'a'].end())
        {
            re=*z;
        }
        else
        {
            re=-1;
            res++;
            i--;

        }
    }
    cout<<re+1+(res*s.size());
    

    


  

    cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}



void solve(){
    ll a,b,n;
    cin  >> a >> b >> n;
    n = min(b-1ll,n);
    ll ans = ((a*n)/b);
    ans -= (a*(n/b));
    g(ans);
}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
  //  cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
        solve();
        
    }
return 0;
}

Measured memory_bytes: 3656
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
// #include <boost/foreach.hpp>
// #include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
//#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};
typedef pair<int,int> P;

const long long MOD=1000000007LL;
bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)||islower(c));}
template<typename T> 
void print(vector<T> v){
    for(int i=0;i<v.size();i++){
        cout<<i<<": ";
        if(i)cout<<" ";
        cout<<v[i];
    }
    cout<<endl;
}
int INF=1e18;

template<typename T>
void printendl(vector<T> v){
    for(auto date:v)cout<<date<<endl;
}

template<typename T>
void printvv(vector<vector<T>> v){
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v[i].size();j++){
            if(j)cout<<" ";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    else return gcd(b,a%b);
}

struct Edge{
    int to,cost;
};

signed main (){
    int a,b;
    cin>>a>>b;
    if((a+b)%2==0)cout<<(a+b)/2<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
}







    


/*
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int MOD = 1e9 + 7;

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

    int n;
    cin >> n;
    string s1, s2;
    cin >> s1 >> s2;

    long long ans = 0;
    int idx = 0, pre = -1;
    while(idx < n){
        if(s1[idx] == s2[idx]){
            if(pre == -1){
                ans = 3;
            }else if(pre == 0){
                ans = (ans * 2) % MOD;
            }else{
                ans *= 1;
            }
            idx++;
            pre = 0;
        }else{
            if(pre == -1){
                ans = 6;
            }else if(pre == 0){
                ans = (ans * 2) % MOD;
            }else{
                ans = (ans * 3) % MOD;                
            }
            idx += 2;
            pre = 1;
        }
    }

    cout << ans << endl;

    return 0;
}

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

int n;
int fee[] = {600, 800, 1000, 1200, 1400, 1600};

int check(int l, int w)
{
    int a, b;
    if(l <= 60) a = 0;
    else if(l <= 80)  a = 1;
    else if(l <= 100) a = 2;
    else if(l <= 120) a = 3;
    else if(l <= 140) a = 4;
    else if(l <= 160) a = 5;
    else a = 6;

    if(w <= 2) b = 0;
    else if(w <= 5) b = 1;
    else if(w <= 10) b = 2;
    else if(w <= 15) b = 3;
    else if(w <= 20) b = 4;
    else if(w <= 25) b = 5;
    else  b = 6;

    return max(a, b);
}

int main()
{
    while(cin >> n && n) {
        int x,y,h,w,t,sum;
        sum = 0;
        for(int i = 0; i < n; i++) {
            cin >> x >> y >> h >> w;
            if((t = check(x + y + h, w)) == 6) {
                continue;
            }
            sum += fee[t];
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,tmp,limit,count = 0;
    cin >> n;
    
    for(int i = 0; i < n; i++)
    {
        cin >> tmp;
        limit = sqrt(tmp);
        for(int j = 2; j <= limit; j++)
        {
            if(tmp%j==0)
            {
                count++;
                break;
            }
        }
    }
    
    cout << n - count << endl;
    return 0;
}


Measured memory_bytes: 3128
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        boolean[] h = new boolean[H];
        Arrays.fill(h, true);
        boolean[] w = new boolean[W];
        Arrays.fill(w, true);
        char[][] tmp = new char[H][W];
        for(int i = 0; i < H; i++){
            char[] t = sc.next().toCharArray();
            tmp[i] = t;
            for(int j = 0; j < W; j++){
                if(t[j] == '#'){
                    h[i] = false;
                    w[j] = false;
                }
            }
        }
        sc.close();
        StringBuilder ans = new StringBuilder();
        for(int i = 0; i < H; i++){
            if(h[i]) continue;
            for(int j = 0; j < W; j++){
                if(w[j]) continue;
                ans.append(String.valueOf(tmp[i][j]));
            }
            ans.append("\n");
        }
        System.out.println(ans.toString());

    }

}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int n;
cin>>n;
string s;
map<string,int> mp;
while(n--)
{
cin>>s;
mp[s]++;
}
string k[4]={"AC","WA","TLE","RE"};
for(int i=0;i<4;i++)
{
cout<<k[i]<<" x "<<mp[k[i]]<<endl;
}
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 9 * 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

int main() {
    int N;
    cin >> N;
    ll ret = 0;
    for(ll i = 1;i <= N;i++) {
        if(i % 3 != 0 && i % 5 != 0) {
            ret += i;
        }
    }
    cout << ret << endl;
}

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

using namespace std;

typedef long long int ll;

ll M = 1e9 + 7;

ll power(ll a , ll n)
{
    unsigned long long int result=1,x=a;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x = (x * x)%M;
        n=n/2;
    }
    return result%M;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n;
    cin >> n;

    cout << ((power(10,n) - (2*power(9,n))%M + M)%M + power(8,n) + M)%M;

    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

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

	int i;
	for(i = 1; i * i <= n; i++);
	cout << (i - 1) * (i - 1) << endl;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN,"%s",$a);
fscanf(STDIN,"%s",$b);
if($a>$b){
  echo "GREATER\n";
}elseif($a==$b){
  echo "EQUAL\n";
}else{
  echo "LESS\n";
}


//echo $a."\n";
//echo $b."\n";

Measured memory_bytes: 4604
W,H,N=map(int,input().split())
x0,y0=0,0
for i in range(N):
    x,y,a=map(int,input().split())
    if a==1 and x>x0:
        x0=x
    elif a==2 and x<W:
        W=x
    elif a==3 and y>y0:
        y0=y
    elif a==4 and y<H:
        H=y
if W<x0 or H<y0:
    print(0)
else:
    print((W-x0)*(H-y0))

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
int main(void){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(abs(a-c)<=d){
        printf("Yes\n");
    }else if(abs(a-b)<=d && abs(b-c)<=d){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <queue>
#include <limits>
#include <stack>

using namespace std;
typedef long long ll;

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

	vector<int> A(N);
	vector<int> B(N);
	vector<int> C(N);
	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; i++) {
		cin >> C[i];
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		auto it_a = lower_bound(A.begin(), A.end(), B[i]);
		ll n = it_a - A.begin();
		auto it_c = upper_bound(C.begin(), C.end(), B[i]);
		n *= C.end() - it_c;
		ans += n;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N,M = LI()
left = 0
right = 10000000

for _ in range(M):
    l,r = LI()
    left = max(left,l)
    right = min(right,r)

count = 0
for i in range(1,N+1):
    if left <= i <= right:
        count += 1
print(count)

Measured memory_bytes: 9220
#include <bits/stdc++.h>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point {
public:
	double x, y;
	Point(double x = 0.0, double y = 0.0) :
			x(x), y(y) {
	}

	Point operator +(Point p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator -(Point p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator *(double k) {
		return Point(x * k, y * k);
	}
	Point operator /(double k) {
		return Point(x / k, y / k);
	}

	double norm() {
		return x * x + y * y;
	}
	double abs() {
		return sqrt(norm());
	}

	bool operator <(Point p) {
		return x != p.x ? x < p.x : y < p.y;
	}
	bool operator ==(Point p) {
		return equals(x, p.x) && equals(y, p.y);
	}
};
typedef Point Vector;

class Segment {
public:
	Point p1, p2;
	Segment(Point p1 = Point(), Point p2 = Point()) :
			p1(p1), p2(p2) {
	}
};
typedef Segment Line;

double dot(Vector v1, Vector v2) {
	return v1.x * v2.x + v1.y * v2.y;
}
double cross(Vector v1, Vector v2) {
	return v1.x * v2.y - v1.y * v2.x;
}
bool isOrthogonal(Vector v1, Vector v2) {
	return equals(dot(v1, v2), 0.0);
}
bool isOrthogonal(Segment s1, Segment s2) {
	return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}
bool isOrthogonal(Point l1, Point l2, Point m1, Point m2) {
	return isOrthogonal(l2 - l1, m2 - m1);
}
bool isParallel(Vector v1, Vector v2) {
	return equals(cross(v1, v2), 0.0);
}
bool isParallel(Segment s1, Segment s2) {
	return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}
bool isParallel(Point l1, Point l2, Point m1, Point m2) {
	return isParallel(l1 - l2, m1 - m2);
}

double distancePP(Point p1, Point p2) {
	return (p1 - p2).abs();
}
double distanceLP(Line l, Point p) {
	return cross(l.p2 - l.p1, p - l.p1) / dot(l.p2, l.p1);
}
double distanceSP(Segment s, Point p) {
	if (dot(s.p2 - s.p1, p - s.p1) < 0.0)
		return distancePP(s.p1, p);
	else if (dot(s.p1 - s.p2, p - s.p2) < 0.0)
		return distancePP(s.p2, p);
	else
		return distanceLP(s, p);
}
//double distanceSS(Segment s1, Segment s2) {
//	if (intersect(s1, s2))
//		return 0.0;
//	else {
//		return min(
//				{ distanceSP(s1, s2.p1), distanceSP(s1, s2.p2), distanceSP(s2,
//						s1.p1), distanceSP(s2, s1.p2) });
//	}
//}

enum PositionSP {
	COUNTER_CLOCKWISE, CLOCKWISE, ONLINE_BACK, ONLINE_FRONT, ON_SEGMENT
};
PositionSP ccw(Point p1, Point p2, Point p) {
	Vector a = p2 - p1, b = p - p1;
	if (cross(a, b) > EPS)
		return COUNTER_CLOCKWISE;
	else if (cross(a, b) < -EPS)
		return CLOCKWISE;
	else if (dot(a, b) < -EPS)
		return ONLINE_BACK;
	else if (a.norm() < b.norm())
		return ONLINE_FRONT;
	else
		return ON_SEGMENT;
}

int main() {
	Point p0, p1;
	cin >> p0.x >> p0.y;
	cin >> p1.x >> p1.y;
	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		Point p2;
		cin >> p2.x >> p2.y;
		switch (ccw(p0, p1, p2)) {
		case COUNTER_CLOCKWISE:
			cout << "COUNTER_CLOCKWISE" << endl;
			break;
		case CLOCKWISE:
			cout << "CLOCKWISE" << endl;
			break;
		case ONLINE_BACK:
			cout << "ONLINE_BACK" << endl;
			break;
		case ONLINE_FRONT:
			cout << "ONLINE_FRONT" << endl;
			break;
		case ON_SEGMENT:
			cout << "ON_SEGMENT" << endl;
			break;
		}
	}
	return 0;
}



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

                            typedef long long ll;
                            typedef double ld;
                            #define rep(i,a,n) for(ll i=(a); i<(n); i++)
                            #define per(i,a,n) for(ll i=(n-1); i>=(a); i--)
                            #define F first
                            #define S second
                            #define maxx(a,b) a=max(a,b)
                            #define minn(a,b) a=min(a,b)
                            #define db(x) cerr<<#x<<" = "<<x<<endl
                            #define N 1111111
                            #define mod 1000000007
                            #define rt return
                            #define inf 1000000000

                            using namespace std;

                            ll dp[123456],a[123];

                            int main(){

                                ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

                                //freopen("Ulug'bek","r",stdin);
                                //freopen("Abdimanabov","w",stdout);

                                int n,k; cin>>n>>k;
                                rep(i,0,n)cin>>a[i];

                                rep(i,1,k+1)
                                    rep(j,0,n)
                                    if(i-a[j]>=0)dp[i]|=!dp[i-a[j]];

                                cout<<(dp[k]?"First":"Second");

                            rt 0;
                            }



















Measured memory_bytes: 1024
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pi 3.1415926535
#define endl '\n'
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
const ll inf=1e18;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/
//ll fac[250001];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,i,a,b,c=0,r,k,m;
    string s,x;
    unordered_map<string,ll>mp;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>s;
        cin>>m;
        c=c+m;
        mp[s]=c;
    }
    cin>>x;
    cout<<c-mp[x]<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	int a,s,d,c=0;
    cin>>a>>s>>d;
    FOR(i,a,s+1){
        if(i%d==0)c++;
    }
    cout<<c<<endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <stack>
#include <queue>

#define MAX 32

using namespace std;

int main(void) {
	while(1) {
		int n, m;
		int x[MAX], y[MAX];
		int m_x = 10, m_y = 10;
		char d;
		int l;
		bool moved[MAX][MAX] = {false};
		moved[10][10] = true;
		bool collect = true;

		scanf("%d", &n);
		if(n == 0) break;
		for(int i = 0; i < n; i++) {
			scanf("%d %d", &x[i], &y[i]);
		}
		scanf("%d", &m);
		for(int i = 0; i < m; i++) {
			cin >> d >> l;
			if(d == 'N') {
				for(int j = 0; j <= l; j++) {
					moved[m_x][m_y + j] = true;
				}
				m_y += l;
			}
			if(d == 'E') {
				for(int j = 0; j <= l; j++) {
					moved[m_x + j][m_y] = true;
				}
				m_x += l;
			}
			if(d == 'S') {
				for(int j = 0; j <= l; j++) {
					moved[m_x][m_y - j] = true;
				}
				m_y -= l;
			}
			if(d == 'W') {
				for(int j = 0; j <= l; j++) {
					moved[m_x - j][m_y] = true;
				}
				m_x -= l;
			}
		}

		for(int i = 0; i < n; i++) {
			if(!moved[x[i]][y[i]]) collect = false;
		}

		printf("%s\n", collect ? "Yes" : "No");
	}
	return 0;
}

Measured memory_bytes: 1204
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
mark = [[False, False, False] for _ in range(3)]

for i in range(3):
    for j in range(3):
        for b in B:
            if A[i][j] == b:
                mark[i][j] = True

ans = 'No'
# 縦の判定
for i in range(3):
    if mark[0][i] and mark[1][i] and mark[2][i]:
        ans = 'Yes'
        break

# 横の判定
for i in range(3):
    if mark[i][0] and mark[i][1] and mark[i][2]:
        ans = 'Yes'
        break

# 斜めの判定
if (mark[0][0] and mark[1][1] and mark[2][2]) or (mark[0][2] and mark[1][1] and mark[2][0]):
    ans = 'Yes'

print(ans)

Measured memory_bytes: 3064
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    
    int ans = -1;
    for(int i=1; i<1500; i++){
      int tax8 = (int)(i * 0.08);
      int tax10 = (int)(i * 0.1);
      if(tax8 == A && tax10 == B){
        ans = i;
        break;
      }else if(tax8 > A || tax10 > B){
        break;
      }
    }
    
    System.out.println(ans);
    
  }
}

Measured memory_bytes: 23764
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        s: chars,
    }
    let mut ans = 0;
    let mut current = 0;
    for s_ in s {
        let contain = match s_ {
            'A' => true,
            'C' => true,
            'G' => true,
            'T' => true,
            default => false,
        };
        if contain {
            current += 1;
        } else {
            current = 0;
        };
        ans = std::cmp::max(ans, current);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in);) {
			
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a < b) {
				System.out.println("a < b");
			} else if (a > b){
				System.out.println("a > b");
			} else {
				System.out.println("a == b");
			}
		}
		
	}

}


Measured memory_bytes: 26192
N,W=map(int,input().split())
G=[]
for i in range(N):
    G.append(list(map(int,input().split())))

#dp[i][j]=iまで考え、重さがj以下
dp=[[-float('inf')]*(W+1) for i in range(N+1)]
for i in range(W+1):
    dp[0][i]=0

for i in range(N):
    v=G[i][0]
    w=G[i][1]
    for j in range(W+1):
        if j>=w:
            dp[i+1][j]=max(dp[i][j],dp[i][j-w]+v)
        else:
            dp[i+1][j]=dp[i][j]

print(dp[N][W])



Measured memory_bytes: 25512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

class UnionFind {
public:
    vector<int> par;
    int num;

    UnionFind(int n) : par(n, -1), num(n) {};

    int root(int x) {
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }

    int size(int x) {
        return -par[root(x)];
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (size(x) < size(y)) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        num--;
        return true;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    int p[n];
    rep(i, 0, n) {
        cin >> p[i];
        p[i]--;
    }

    UnionFind uf(n);
    rep(i, 0, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if (!uf.same(a, b)) {
            uf.unite(a, b);
        }

    }

    int ans = 0;
    rep(i, 0, n) {
        if (uf.same(p[i], i)) ans++;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
N, M = map(int, input().split())
LR = [list(map(int, input().split())) for i in range(M)]
imos = [0 for i in range(N+2)]
ans = 0
for lr in LR:
    imos[lr[0]] += 1
    imos[lr[1]+1] -= 1

for i in range(1, N+2):
    imos[i] += imos[i-1]
    ans += 1 if (imos[i]==M) else 0

print(ans)

Measured memory_bytes: 31456