akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int n, m, k;
int a[12][12];
int c[12];

int bal[12];


int main () {
	SpeedForce;
	cin >> n >> m >> k;
	For (i, 0, n-1) {
		cin >> c[i];
		For (j, 0, m-1) cin >> a[i][j];
	}

	int ans = inf;
	for (int msk = 0; msk < (1 << n); ++msk) {
		memset(bal, 0, sizeof bal);
		int overall = 0;
		for (int i = 0; i < n; ++i) if (msk & (1 << i)) {
			for (int j = 0; j < m; ++j)
				bal[j] += a[i][j];
			overall += c[i];	
		}


		if(*min_element(bal, bal+m) >= k)
			ans = min(ans, overall);
	}

	if(ans == inf) ans = -1;
	cout << ans << '\n';

	return Accepted;
}

// B...a

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define ll long long
#define ii pair<int, int>
#define N 100123
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define pb push_back
#define fs first
#define sc second
#define oo 1000000123
#define sz(x) ((int)((x).size()))
#define OUT -oo
#define left(x) (x << 1)
#define right(x) ((x << 1) | 1)
#define mid(a, b) ((a + b) >> 1)
#define mod 1000000007LL

using namespace std;

ll fexp(ll base, ll expoente, ll modulo){
    ll ans = 1;
    while (expoente){
        if (expoente&1) ans = (ans * base) % modulo;
        base = (base * base) % modulo;
        expoente >>= 1;
    }
    return ans;
}

ll K, ans, n;
ll pre[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin >> n >> K;
    pre[K] = 1;
    ans = K;
    for(ll x = K - 1; x >= 1; --x){
        ll b = K / x;
        pre[x] = fexp(b, n, mod);
        for(ll y = x + x; y <= K; y += x){
            pre[x] = pre[x] + mod - pre[y];
            if(pre[x] >= mod) pre[x] -= mod;
        }
        ans = (ans + pre[x] * x) % mod;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 4284
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int loadD[100][100];
int loadE[100][100];

bool memo[101][100];
int n;

struct data{
  int pos;
  int money;
  int ene;
  data(int a,int b,int c){
    pos = a;
    money = b;
    ene = c;
  }
};

bool operator < (const data &a, const data &b){
  return a.ene > b.ene;
}

int main(){
  int m,l;
  while(scanf("%d%d%d",&n,&m,&l), n+m+l){
    memset(loadD, 0, sizeof(loadD));
    memset(memo, 0, sizeof(memo));
    REP(i,m){
      int a,b,d,e;
      scanf("%d%d%d%d",&a,&b,&d,&e);
      loadD[a-1][b-1] = loadD[b-1][a-1] = d;
      loadE[a-1][b-1] = loadE[b-1][a-1] = e;
    }
    priority_queue<data> pq;
    pq.push(data(0, l, 0));

    while(pq.size()){
      int pos   = pq.top().pos;
      int money = pq.top().money;
      int ene   = pq.top().ene;
      pq.pop();

      if(pos == n-1){
        printf("%d\n",ene);
        break;
      }
      if(memo[money][pos]) continue;
      memo[money][pos] = true;

      REP(i,n){
        int d = loadD[pos][i];
        int e = loadE[pos][i];
        if(d != 0){
          if(d <= money && !memo[money-d][i])
            pq.push(data(i, money-d, ene));
          pq.push(data(i, money, ene+e));
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1380
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
  int n,a[100];
  int maxo=0;
  int out=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      maxo=a[i]-a[j];

      if(maxo<0){maxo=maxo*-1;}

      out=max(maxo,out);

    }
  }
  cout<<out;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n,k;
    cin >> n >> k;
    LL ans = 0;
    REP(b,k+1,n+1) {
        int mod = n % b;
        ans += max(0, mod - k + 1);
        ans += max(0LL, (LL)(n - mod) * (b - k) / b);
        if (k == 0) ans -= 1;
    }
    cout << ans << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        PriorityQueue pq = new PriorityQueue();
        for(int i = 0; i < 3; i++) {
            pq.add(scan.nextInt());
        }
        int answer = 0;
        answer+=((int)pq.poll());
        answer+=((int)pq.poll());
        System.out.println(answer);
    }
}


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

vector<int> par(100010);

void init( int n ){
	for(int i = 0 ; i < n ; i++) par[i] = i;
}

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

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

void unite(int x, int y){
	x = root(x);
	y = root(y);
	if(x == y) return;
	
	par[x] = y;
}

int main(){
	int N , M , ans = 0;
	cin >> N >> M;
	vector<int> P(N);
	vector<int> par(N,0);
	init(N);
	for(int i = 0; i < N ; i++){
		// cout << "count1:" << i << endl;
		cin >> P[i];
	}
	for(int i = 0; i < M ; i++){
		// cout << "count2:" << i << endl;
		int x , y;
		cin >> x >> y;
		unite(x-1,y-1);
	}
	for(int i = 0; i < N ; i++){
		// cout << "count3:" << i << endl;
		if(same(i,P[i]-1))
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1408
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>

int main(int argc, char* argv[])
{
  int R;
  std::cin >> R;

  if (R < 1200) {
    std::cout << "ABC" << std::endl;
  } else if (R < 2800) {
    std::cout << "ARC" << std::endl;
  } else {
    std::cout << "AGC" << std::endl;
  }

  return 0;
}


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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	ll a[n];
	rep(i, n) cin >> a[i];
	
	sort(a, a + n);
	
	ll ans;
	if (n % 2 == 1) {
		ll sum1 = 0;
		FOR(i, 0, n / 2) {
			sum1 -= 2 * a[i];
		}
		sum1 += a[n / 2];
		sum1 += a[n / 2 + 1];
		FOR(i, n / 2 + 2, n) {
			sum1 += 2 * a[i];
		}
		
		ll sum2 = 0;
		FOR(i, 0, n / 2 - 1) {
			sum2 -= 2 * a[i];
		}
		sum2 -= a[n / 2 - 1];
		sum2 -= a[n / 2];
		FOR(i, n / 2 + 1, n) {
			sum2 += 2 * a[i];
		}
		
		ans = max(sum1, sum2);
	} else {
		ll sum3 = 0;
		FOR(i, 0, n / 2) {
			sum3 -= 2 * a[i];
		}
		FOR(i, n / 2, n) {
			sum3 += 2 * a[i];
		}
		sum3 += a[n / 2 - 1];
		sum3 -= a[n / 2];
		
		ans = sum3;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INF = 999999999;
const int MOD = (int)1e9 + 7;
const int EPS = 1e-9;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for(int i=0;4*i<=100;i++){
      for (int j=0;7*j<=100;j++){
          if (4*i+7*j==n){
              cout << "Yes" << endl;
              return 0;
          }
      }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int k,x;
  cin >> k >> x;
  if(x>=0){
    for(int i=x-k+1;i<x+k;i++){
      cout << i << " ";
      if(i==1000000){
        break;
      }
    }
  }
    else{
       for(int i=x+k+1;i>x-k;i--){
      cout << i << " ";
      if(i==-1000000){
        break;
      }
       }
    }
  
}
      

Measured memory_bytes: 256
def solve():
    x = int(input())

    is_prime_list = [0 for i in range(10**6 + 1)]

    for i in range(2, len(is_prime_list)):
        if is_prime_list[i] == 0:
            is_prime_list[i] = 1
            
            for j in range(2 * i, len(is_prime_list), i):
                is_prime_list[j] = 2

    for _i in range(x, len(is_prime_list)):
        if is_prime_list[_i] == 1:
            print(_i)
            return


if __name__ == "__main__":
    solve()

Measured memory_bytes: 10904
#include <bits/stdc++.h>
using namespace std;
#define fr(i,n) for (int i=0;i<n;i++)
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=a;i>=b;i--)
#define all(cont) cont.begin(), cont.end()
#define unique(a)  sort(all(a)) , (a).erase(unique((a).begin(), (a).end()),(a).end())
#define rall(cont) cont.rbegin(), cont.rend()
#define sz(x) (int)(x).size()
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define f first
#define s second
#define mset(m,v) memset(m,v,sizeof(m))
#define mod 1000000007
const int N = 2e5 + 5;
#define PI acos(-1.0)
long double EPS = 1e-9;
typedef long long ll;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
#define pqll_max priority_queue<ll> // max heap. push(),pop(),top(),size(),empty()
#define pqll_min priority_queue<ll,vector<ll>,greater<ll> >
#define lb(v,val)   lower_bound(v.begin(),v.end(),val) //first equal to or lower than [------------
#define ub(v,val)   upper_bound(v.begin(),v.end(),val) //first greater than ------------)
#define bs(v,x) binary_search(v.begin(),v.end(),x)
inline ll add(ll x, ll y) { x += y; if (x >= mod) x -= mod; return x; }
inline ll sub(ll a, ll b) { if (a < b)swap(a, b); return (((a%mod) - (b%mod) + mod) % mod); }
inline ll mul(ll x, ll y) { return (x%mod * 1ll * y%mod) % mod; }
inline ll pwr(ll a, ll b) { ll x = 1 % mod; while (b) { if (b & 1) x = mul(x, a); a = mul(a, a); b >>= 1; }return x % mod; }
inline ll inv(ll a) { return pwr(a, mod - 2) % mod; }
ll gcd(ll a, ll b) { if (!a)return b % mod; return gcd(b%a, a) % mod; }
#define debug(x) cout << #x << " = " << x << endl;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
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...);
}
#define in(container) for (auto &it : container) cin>>it;
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
void pre() {
}
void solve() {
	int d,n;
	cin >> d>>n;
	vi v(n);
	in(v);
	int sum = accumulate(all(v), 0LL);
	if (sum <= d) {
		cout << d-sum << endl;
	}
	else {
		cout << -1 << endl;
	}
	
}
signed main()
{
	fastio;
	cout<<fixed<<setprecision(15);
	//clock_t begin = clock();
	//pre();
	int tc;
	tc = 1;
	//cin >> tc;
	while (tc--) {
		solve();
	}
	//clock_t end = clock();double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;cerr << elapsed_secs;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;


int main(){
  int A,B;
  cin >> A >> B;
  if(A%2 == 1 && B%2 == 1){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

using namespace std;

const double th = M_PI * 60.0 / 180.0;

struct Point {
    double x, y;
};

void koch(int d, Point p, Point q) {
    if(d == 0) return;

    Point s, t, u;

    // 3 等分点
    s.x = (2.0 * p.x + 1.0 * q.x) / 3.0;
    s.y = (2.0 * p.y + 1.0 * q.y) / 3.0;
    t.x = (1.0 * p.x + 2.0 * q.x) / 3.0;
    t.y = (1.0 * p.y + 2.0 * q.y) / 3.0;

    // 正三角形
    // (s.x, s.y) を中心に 60 度回転
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(d - 1, p, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(d - 1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(d - 1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(d - 1, t, q);

}

int main () {
    int n;
    scanf("%d", &n);
    Point x1, x2;
    x1.x = 0; x1.y = 0;
    x2.x = 100; x2.y = 0;
    printf("%.8f %.8f\n", x1.x, x1.y);
    koch(n, x1, x2);
    printf("%.8f %.8f\n", x2.x, x2.y);
    return 0;
}



Measured memory_bytes: 2732
#include<iostream>
using namespace std;
int n, k, h[100000], i, p;
int main()
{
	cin>>n>>k;
	for(i=0; i<n; i++)
	{
		cin>>h[i];
		if(h[i]>=k)
		{
			p++;
		}
	}
	cout<<p<<endl;
	return 0;
}


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

int main(){
    int N;
    cin >> N;
    int k;
    k = 0;
    int p, w, g, y;
    p = 0;
    w = 0;
    g = 0;
    y = 0;
    for(int i = 0; i < N; i++){
        string S;
        cin >> S;
        if(S == "P"){
            if(p == 0){
                p = 1;
                k++;
            }
        }else if(S == "W"){
            if(w == 0){
                w = 1;
                k++;
            }
        }else if(S == "G"){
            if(g == 0){
                g = 1;
                k++;
            }
        }else if(S == "Y"){
            if(y == 0){
                y = 1;
                k++;
            }
        }
    }
    if(k == 3){
        cout << "Three" << endl;
    }else if(k == 4){
        cout << "Four" << endl;
    }
}

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4,EPS=1e-12;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4){
		if(fabs(((x2-x1)*(x4-x3))+((y2-y1)*(y4-y3)))<=EPS)cout<<"YES";
		else cout<<"NO";
		cout<<endl;
	}
}

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

int main() {
    int n, max = -1, maxi, mid, minab=1000000001, ans;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; i++) {
        cin >> a[i];
        if(a[i] > max) {
            max = a[i];
            maxi = i;
        }
    }

    mid = max/2;
    for(int i=0; i<n; i++) {
        int temp = abs(mid-a[i]);
        if(temp < minab && i != maxi) {
            ans = a[i];
            minab = temp;
        }
    }

    cout << max << " " << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

struct Edge{
    int from, to;
    double cost;
};

template <typename T>
vector<T> dijkstra(vector<vector<Edge>> &G, int s) {
    int V = G.size();
    vector<T> d(V); fill(d.begin(), d.end(), numeric_limits<T>::max());
    priority_queue<pair<T, int> , vector< pair<T, int> >, greater< pair<T, int> > > que;
    d[s] = 0;
    que.push(make_pair(0,s));

    while(!que.empty()) {
        pair<T, int> p = que.top(); que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(int i=0; i<G[v].size(); i++) {
            Edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(make_pair(d[e.to], e.to));
            }
        }
    }
    return d;
}

double x[1005];
double y[1005];
double r[1005];
double v[1005];
vector<vector<Edge>> G(1005);

int main(){
    cin.tie(0);

    cin >> x[0] >> y[0] >> x[1] >> y[1];
    r[0] = r[1] = 0;

    int N; cin >> N;
    for (int i = 2; i < N+2; i++){
        cin >> x[i] >> y[i] >> r[i];
    }
    for (int i = 0; i < N+2; i++){
        for (int j = 0; j < N+2; j++){
            if (i == j) continue;
            Edge e;
            double len = sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j])) - r[i] - r[j];
            len = len > 0.0 ? len : 0.0;
            e.cost = len;
            e.to = j;
            G[i].push_back(e);
        }
    }

    vector<double> ans = dijkstra<double>(G, 0);
    printf("%.12f\n", ans[1]);

}


Measured memory_bytes: 22256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define CHECK(cond, message)                                                    \
    if (!(cond)) {                                                              \
      DEBUG("expected cond: " << #cond << " failed with message: " << message); \
      assert(cond);                                                             \
    }

#ifdef __APPLE__
#define DEBUG(message) std::cerr << message << std::endl;
#else
#define DEBUG(message)
#endif

void solve() {
  int n;
  std::cin >> n;
  std::vector<std::string> t(n);
  std::vector<int> s(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> t[i] >> s[i];
  }
  std::string x;
  std::cin >> x;
  bool add = false;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (add) {
      ans += s[i];
    }
    add |= t[i] == x;
  }
  std::cout << ans << std::endl;
}

int main() {
#ifdef __APPLE__
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    while (t--) {
        solve();
    }
    return 0;
}


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

int main(){
  long A,a,B,b,L,LCM;
  bool s=true;
  
  cin>>A>>B;
  a=A; b=B;
  
  if(A>B){
  	while(s){
      L=a%b; a=b;b=L;
      if(L==0){s=false;}
    }
    LCM=A*B/a;
  }
  
  if(B>A){
    while(s){
      L=b%a; b=a;a=L;
      if(L==0){s=false;}
    }
    LCM=A*B/b;
  }
  cout<<LCM;
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let l: i32 = input();

    let mut v = vec![];
    for i in 0..n {
        v.push(l + i as i32);
    }

    let s: i32 = v.iter().sum();
    let min = v.iter().min_by_key(|v| v.abs()).unwrap();
    println!("{}", s - min);
}


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

int x,k,q,r[100010],t[100010],a[100010];

void work()
{
	scanf("%d %d",&x,&k);
	for (int i=1; i<=k; i++)  scanf("%d",&r[i]);
	scanf("%d",&q);
	for (int i=1; i<=q; i++)  scanf("%d %d",&t[i],&a[i]);
	if (t[q]>=r[k])  r[++k]=t[q]+1;
	for (int i=1,j=1,L=0,R=x,s=0,ty=-1; i<=k; i++,ty*=-1)
		{
			for (; (j<=q)&&(t[j]<r[i]); j++)
				printf("%d\n",min(max(min(max(a[j]+s,L),R)+ty*(t[j]-r[i-1]),0),x));
			L=min(max(L+ty*(r[i]-r[i-1]),0),x);
			R=min(max(R+ty*(r[i]-r[i-1]),0),x);
			s+=ty*(r[i]-r[i-1]);
		}
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 2432
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
  
import sys
readline = sys.stdin.readline

N = int(readline())
from collections import defaultdict
dic = defaultdict(int)

for i in range(2,N + 1):
  arr = factorization(i)
  for a in arr:
    dic[a[0]] += a[1]

DIV  = 10 ** 9 + 7
ans = 1
for val in dic.values():
  ans *= ((val + 1) % DIV)
  ans %= DIV
  
print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>
 
using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
 
 
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
 
//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
 
void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

ll dfs(Graph& g,ll pre, ll now, ll v){
	for(auto e:g[now]){
		if(e.to==v){
			return (1LL<<(e.cap));
		}
		if(e.to!=pre){
			ll ret=dfs(g,now,e.to,v);
			if(ret!=0){
				return (ret|(1LL<<e.cap));
			}
		}
	}
	return 0;
}

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

	ll n;
	cin>>n;
	Graph g(n);
	REP(i,n-1){
		ll a,b;
		cin>>a>>b;
		a--;b--;
		add_edge(g,a,b,i,true,i);
	}

	ll m;
	cin>>m;
	Array es;
	REP(i,m){
		ll u,v;
		cin>>u>>v;
		u--;v--;
		es.push_back(dfs(g,-1,u,v));
	}

	Array pow2(n+1,1);
	REP(i,n) pow2[i+1]=pow2[i]*2;

	ll ans=0;
	REP(bit,(1LL<<m)){
		//包除原理
		ll con=0;
		ll mask=0;
		REP(i,m){
			if((1LL<<i)&bit){
				con++;
				mask|=es[i];
			}
		}
		ll con_v=0;
		REP(i,n-1){
			if(mask&(1LL<<i)){
				con_v++;
			}
		}

		if(con%2==0){
			ans+=pow2[n-1-con_v];
		}else{
			ans-=pow2[n-1-con_v];
		}
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
import random

d=int(input())
c=input()
cl=[int(n) for n in c.split()]
sl=list()
for i in range(d):
    s=input()
    sl=sl+[int(n) for n in s.split()]
tl=[1]*d
sat=0
for i in range(d):
    sat+=sl[i*26+tl[i]-1]

def decr(tl,cl):
    dec=0
    for i in range(26):
        last=[a for a, x in enumerate(tl) if x==i+1]
        if last==list():
            dec+=(d*(d+1)/2)*cl[i]
        else:
            for v in range(len(last)):
                if v!=len(last)-1:    
                    dec+=cl[i]*(last[v+1]-last[v]-1)*(last[v+1]-last[v])/2
                else:
                    dec+=cl[i]*(d-last[v]-1)*(d-last[v])/2
            dec+=cl[i]*(last[0])*(last[0]+1)/2
    return(int(dec))

oldscore=sat
oldans=oldscore-decr(tl,cl)
oldtl=[int(x) for x in tl]
for k in range(10000):
    da=random.randint(1,d)
    q=random.randint(1,26)
    cha=sl[(da-1)*26+q-1]-sl[(da-1)*26+tl[da-1]-1]
    tl[da-1]=q
    newscore=oldscore+cha
    newans=oldscore-decr(tl,cl)
    if newans<oldans:
        tl=[int(x) for x in oldtl]
    else:
        oldans=newans
        oldtl=[int(x) for x in tl]
        oldscore=newscore
for i in range(d):
    print(tl[i])
        

Measured memory_bytes: 83412
#include <bits/stdc++.h>
#define ff { ios_base::sync_with_stdio(false);cin.tie(NULL);}
using namespace std;

typedef long long ll;
 ll  pp=1e9+7; 
double pi=3.141592653589793238;
  
 int main() {
        ff;
        string s;
        cin>>s;
        int c=0;
        if(s[0]=='R' || s[1]=='R' || s[2]=='R'){
            c++;
        }
        if(s[0]=='R' && s[1]=='R')c++;
        if(s[1]=='R' && s[2]=='R')c++;
        cout<<c<<endl;
		
    return 0;
}

            
		
        
           
  

Measured memory_bytes: 3652
/*
                                                                           __                _________
                                                                          /  \              /  ______/
                                                                         /    \            /  /
                                                                        /  __  \          /  /
                                                                       /  /  \  \         |  |
                                                                      /  /____\  \        \  \
                                                                     /  ________  \        \  \______
                                                                    /__/        \__\        \________\
	
	I_love_Hacked;
	I_hate_pretest past;
	I_love_STP
	
    coder:xxjAc
    date:2018/7/8
		    
    I_love_Ac;
    I_hate_WA;
    I_hate_Tle;
    I_hate_RE;
    I_hate_CE;
    I_hate_Mle;
    
    I love Accepts very much;
    
    I_don't_love_I_love_zzq
	I_hate_zzq
       
    cd Desktop
    g++ xxjAc.cpp -o std
    ./std
    
    #prag\
    ma GCC optimize("Ofast")
    (O2,O3,Ofast)
*/
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#define ll long long 
using namespace std;
const int inf=1e9+7;
const ll linf=1e18+7;
ll ans=linf;
int n;
int a[200007];
ll check(int k){
	ll sum=0;
	for (int i=1;i<=n;i++){
		sum+=(ll)(abs(a[i]-k-i));
	}
	ans=min(ans,sum);
	/*
	if (ans>sum){
		ans=sum;
		//cout<<ans<<' '<<k<<endl; 
	}
	*/
	return sum;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",a+i);
	}
	int l=-inf,r=inf,mid;
	while (l<=r){
		mid=(l+r)/2;
		ll v1=check(mid);
		ll v2=check(mid+1);
		if (v1>v2){
			l=mid+2;
		}
		else{
			r=mid-1;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int N = s[0];
            int K = s[1];
            long ans = K;
            for (int i = 1; i < N; i++)
            {
                ans *= K - 1;
            }
            WriteLine(ans);
        }
    }
}


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

int main() {
	string s;
	while (getline(cin, s)) {
		while (1) {
			for (char &c : s) {
				if (isalpha(c)) {
					if (c == 'z')c = 'a';
					else c++;
				}
			}
			if ((int)s.find("the") >= 0 || (int)s.find("this") >= 0 || (int)s.find("that") >= 0)break;
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 3068
#include<stdio.h>

int main() {
  int a =0;
  int n,k,b;
  int p[1000];
  scanf("%d%d", &n, &k);
  for(int i=0; i<n; i++){
    scanf("%d", &p[i]);
  }

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

      }
    }
  }
  for(int i=0; i<k; i++){
     a += p[i];
   }

  printf("%d", a);
  return 0;
}


Measured memory_bytes: 1732
import math

a,b = map(int,input().split())
l = [list(map(int,input().split())) for _ in range(a)]
co = 0
for i in range(0,a-1):
    for j in range(i+1,a):
        t = 0
        for k in range(b):
            t += pow(abs(l[i][k]-l[j][k]),2)
        if(math.sqrt(t).is_integer()):
            co = co+1

print(co)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;

signed _main(){
  string S; cin >> S;
  int N=SZ(S);
  string tmp=S;
  reverse(tmp.begin(),tmp.end());
  if(S!=tmp){
    No
    return 0;
  }
  string S2=S.substr(0,(N-1)/2);
  string tmp2=S2;
  reverse(tmp2.begin(),tmp2.end());
  if(S2!=tmp2){
    No
    return 0;
  }
  string S3=S.substr((N+3)/2-1,(N-3)/2+1);
  string tmp3=S3;
  reverse(tmp3.begin(),tmp3.end());
  if(S3!=tmp3){
    No
    return 0;
  }
  Yes
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, K;
int B[20];
bool ok[100010];

void solve() {
	cin >> N >> K;
	rep(i, 0, K) {
		int b; cin >> b;
		B[b] = true;
	}
	for(int i = 1; i < 100000; i++) {
		int n = i;
		bool found = false;
		while(n != 0) {
			if(B[n % 10]) {
				found = true;
				break;
			}
			n /= 10;
		}
		if(!found) ok[i] = true;
	}
	rep(i, N, 100000) {
		if(ok[i]) {
			cout << i << "\n";
			return;
		}
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 384
// practice with kaiboy
import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	static final int MD = 1000000007;
	void main() {
		int n = sc.nextInt();
		int k = sc.nextInt();
		if (n == k) {
			long ans = 1;
			while (n-- > 0) {
				int a = sc.nextInt();
				ans = ans * a % MD;
			}
			if (ans < 0)
				ans += MD;
			println(ans);
			return;
		}
		int[] pp = new int[n];
		int[] qq = new int[n];
		int np = 0, nq = 0;
		while (n-- > 0) {
			int a = sc.nextInt();
			if (a >= 0)
				pp[np++] = a;
			else
				qq[nq++] = -a;
		}
		pp = Arrays.stream(pp, 0, np).boxed().sorted().mapToInt($->$).toArray();
		qq = Arrays.stream(qq, 0, nq).boxed().sorted().mapToInt($->$).toArray();
		if (np == 0) {
			if (k % 2 == 1)
				for (int i = 0, j = nq - 1; i < j; i++, j--) {
					int tmp = qq[i]; qq[i] = qq[j]; qq[j] = tmp;
				}
			long ans = 1;
			for (int j = nq - 1; j >= nq - k; j--)
				ans = ans * qq[j] % MD;
			if (k % 2 == 1)
				ans = (MD - ans) % MD;
			println(ans);
			return;
		}
		long ans = 1;
		if (k % 2 == 1) {
			ans = pp[--np];
			k--;
		}
		k /= 2;
		while (k-- > 0)
			if (np >= 2 && nq >= 2) {
				long p = (long) pp[np - 1] * pp[np - 2];
				long q = (long) qq[nq - 1] * qq[nq - 2];
				if (p > q) {
					ans = ans * (p % MD) % MD;
					np -= 2;
				} else {
					ans = ans * (q % MD) % MD;
					nq -= 2;
				}
			} else if (np >= 2) {
				long p = (long) pp[np - 1] * pp[np - 2];
				ans = ans * (p % MD) % MD;
				np -= 2;
			} else {
				long q = (long) qq[nq - 1] * qq[nq - 2];
				ans = ans * (q % MD) % MD;
				nq -= 2;
			}
		println(ans);
	}
}


Measured memory_bytes: 63552
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
int64_t INF = 1000000007;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n,h;
    cin >> n >> h;
    vi a(n), b(n);
    rep(i,n) cin >> a.at(i) >> b.at(i);
    // 基本的には一番強いもの: 最大のaを使う
    // aより大きいbは使っても良さそう
    // 最大のやつが無制限に使えて、他が1回しか使えない
    // ナップザックと同じか?
    // どのbを使うか、使わないかで、2^n通りのパターンがありそう
    // i番目までを使うときと、i+1番目を使うときとで関係がある
    // どれも使わない最強, 1を使う最小, 2を使う最小...をやっていけばよさそう
    vi a_ = a;
    sort(a_.begin(), a_.end(), greater<>());
    int64_t maxa = a_.at(0);
    // あれaの最大よりでかいやつはずっと使えば良いのでは…？
    vi stronger;
    rep(i,n){
        if(b.at(i) > maxa){
            stronger.push_back(b.at(i));
        }
    }
    sort(stronger.begin(), stronger.end(), greater<>());
    int64_t res = 0;
    rep(i,stronger.size()){
        h -= stronger.at(i);
        res++;
        if(h<=0){
            break;
        }
    }
    if(h>0){
        res += (h/maxa);
        if(h%maxa!=0) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 3832
MOD = 10 ** 9 + 7
n = 50
fact = [0 for _ in range(n)]
invfact = [0 for _ in range(n)]
fact[0] = 1
for i in range(1, n):
    fact[i] = fact[i - 1] * i % MOD

invfact[n - 1] = pow(fact[n - 1], MOD - 2, MOD)

for i in range(n - 2, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % MOD
def nCk(n, k):
    if k < 0 or n < k:
        return 0
    else:
        return fact[n] * invfact[k] * invfact[n - k] % MOD

n, p = map(int, input().split())
a = list(map(int, input().split()))
even = 0
odd = 0
for num in a:
    if num % 2 == 1:
        odd += 1
    else:
        even += 1
ans = 0
if p == 0:
    for i in range(0, odd + 1, 2):
        ans += nCk(odd, i)
    ans *= 2 ** even
else:
    for i in range(1, odd + 1, 2):
        ans += nCk(odd, i)
    ans *= 2 ** even
print(ans)

Measured memory_bytes: 3064
# じょえチャンネル
# 高評価・チャンネル登録宜しくお願いします！
# https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ

import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
    if f:
        print('Yes')
    else:
        print('No')
def Y(f):
    if f:
        print('YES')
    else:
        print('NO')
def Z(f):
    if f:
        print('Yay!')
    else:
        print(':(')
def ispow(n):
    if int(n**.5)**2==n:
        return True
    return False


a,b = map(int,input().split())
res = 0
while a > 0:
    res += 1
    a //= b
print(res)

Measured memory_bytes: 5680
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define double    long double
#define ull       unsigned long long
#define mod       1000000007
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define p(a)      cout<<a;
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"THIS_AND_THIS"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
void solve(){
	ll l,r,d;
	cin>>l>>r>>d;
	if(l%d==0){cout<<(r/d)-(l/d)+1;return;}
	cout<<(r/d)-(l/d);
}
int32_t main(){
	kehsihba();
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}




Measured memory_bytes: 3512
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)
long long cnt[200000];
int main() {
#define int long long
	int n;
	cin >> n;
	vector<pair<int, int>> inputs;
	long long ans = 0;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		ans = max(ans, b - a + 1);
		inputs.push_back(make_pair(a, b));
	}
	sort(inputs.begin(), inputs.end());
	cnt[inputs.size() - 1] = inputs.back().second;
	for (int i = inputs.size() - 2; i >= 0; --i) {
		cnt[i] = min(cnt[i + 1], inputs[i].second);
	}
	for (int i = 0; i < inputs.size() - 1; ++i) {
		long long tmp_ans = 2 - inputs[i].first - inputs.back().first;
		tmp_ans += max(inputs[i].second, cnt[i + 1]);
		tmp_ans += cnt[0];
		ans = max(ans, tmp_ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3444
def main():
    """
    高橋君は、日頃の感謝を込めて、お母さんに数列をプレゼントすることにしました。 
    お母さんにプレゼントする数列 A は、以下の条件を満たす必要があります。
    A は X 以上 Y 以下の整数からなる
    すべての 1≤i≤|A|−1 に対し、Ai+1 は Ai の倍数であり、かつ Ai+1 は Ai より真に大きい
    高橋君がお母さんにプレゼントできる数列の長さの最大値を求めてください。
    """
    X, Y = map(int, input().split())

    ans = 0
    n = X
    while n <= Y:
        ans += 1
        n = n * 2

    print(ans)

if __name__ == '__main__':
    main()


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

int main(){
	int n, k;
	string s;
	cin >> n >> k;
	cin >> s;
	
	switch(s[k-1]){
	case 'A':
		s[k-1] = 'a';
		break;
	case 'B':
		s[k-1] = 'b';
		break;
	case 'C':
		s[k-1] = 'c';
		break;
	default:
		break;
	}
	
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
import math
x = y = 0
ang = 90
while True:
    d, a = map(int, input().split(','))
    if d == a == 0:
        break
    rad = ang * math.pi / 180
    x += d * math.cos(rad)
    y += d * math.sin(rad)
    ang -= a
print(int(x))
print(int(y))


Measured memory_bytes: 5708
#include <iostream>
#include <string>
#define rep(i,n) for(int i=0; i < (n) ; i++)
using namespace std;

int main(){
	string S,T;
	long long cnt=0;
	cin >> S >> T ;
	rep(i,S.size()){
		if(S[i]!=T[i])cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3920
#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;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2003, inf = 1e9;
int n, dp[2][N], A, B, a[N], suf[2][N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n >> A >> B;
	for (int i = 1; i <= n; i++) cin >> a[i];
	a[0] = B;
	for (int i = n; i >= 1; i--) {
		dp[0][i] = dp[1][i] = abs(a[i - 1] - a[n]);
		if (i < n) {
			dp[0][i] = max(dp[0][i], suf[1][i + 1]);
			dp[1][i] = min(dp[1][i], suf[0][i + 1]);
			suf[0][i] = min(suf[0][i + 1], dp[0][i]);
			suf[1][i] = max(suf[1][i + 1], dp[1][i]);
		}	else {
			suf[0][i] = dp[0][i];
			suf[1][i] = dp[1][i];
		}
	}
	cout << dp[0][1];
}


Measured memory_bytes: 3680
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
char X,Y;
int main(int argc, char const *argv[])
{
cin>>X>>Y;
if(X<Y){
    cout<<"<"<<endl;
}else if(X>Y){
    cout<<">"<<endl;
}else{
    cout<<"="<<endl;
}
    return 0;
}


Measured memory_bytes: 384
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
p=10
ix=0
for i in range(len(l)):
  x=l[i]
  q=x%10
  if q!=0 and q<p:
    p=q
    ix=i
r=l[ix]
l.remove(r)
s=0
for x in l:
  s+=x
  if x%10!=0:
    s+=10-(x%10)
print(s+r)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i=0;i<n;i++){
    cin >> p[i];
  }
  sort(p.begin(),p.end());
  int sum=0;
  for (int i=0;i<n-1;i++){
    sum+=p[i];
  }
  cout << sum+p[n-1]/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int ask(int x) {
	printf("%d\n", x);
	fflush(stdout);
	char s[10];
	scanf("%s", s);
	if (s[0] == 'V') {
		exit(0);
	}
	return s[0] == 'M';
}
int main() {
	int n;
	scanf("%d", &n);
	int l = 0, lans = ask(0);
	int r = n - 1, rans = ask(n - 1); //even
	while (l < r) {
		int m = (l + r) / 2;
		int mans = ask(m);
		if ((lans ^ (l % 2)) == (mans ^ (m % 2))) {
			l = m;
			lans = mans;
		} else {
			r = m;
			rans = mans;
		}
	}
	return 0;
}

Measured memory_bytes: 852
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long int


using namespace std;



int main()
{
    int ar[34]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n;
    cin>>n;
    cout<<ar[n];

    return 0;
}


Measured memory_bytes: 256
import math
import copy
from queue import Queue
import heapq
import numpy as np

MOD = 1000000007

#n = int(input())
#b = int(input())
n, m, x = [int(i) for i in input().split()]
table = [[int(i) for i in input().split()] for j in range(n)]
#table = [list(input()) for n in range(h)]
#s = [int(i) for i in input().split()]
#s = [int(i) for i in range(n)]
#s = [int(input()) for i in range(n)]
#s = input()
#list = list(s)
# dp = [[0 for _ in range(2)] for _ in range(13)]
#dp = [[[0 for _ in range(11)] for _ in range(2)] for _ in range(11)]

#a = [[0 for _ in range(n+1)] for _ in range(n+1)]
#b = [[0 for _ in range(n+1)] for _ in range(n+1)]

min = 1200001
for i in range (2 ** n):
    flag = 1
    for k in range(1,m+1):
        temp = 0
        cost = 0
        for l in range(0,n):
            mask = 1 << l
            if (i & mask):
                temp += table[l][k]
                cost += table[l][0]
        if (temp < x) :
            flag = 0
    if(flag == 1 and min > cost):
        min = cost


if (min == 1200001):
    print("-1")
else:
    print(min)


Measured memory_bytes: 27216
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};
long double eps = 1e-6;
long double pi = acos(-1);

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll n; cin>>n;
    map<string,int> mp;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        mp[s]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl; 

}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
int main(){
    string s;
    cin>>s;
    bool ans=false;
    rep(i,3){
        if(s[i]=='7'){
            ans=true;
        }
    }
    YN(ans);
}

Measured memory_bytes: 3628