akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
const double pi = 3.141592653589793238;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

void printV(vector<int> &v);
void printVV(vector<vector<int>> &vv);


int main() {
  int64_t X;
  cin >> X;

  int64_t ans;
  ans = 1000 * (X/500) + 5 * ((X%500) / 5);

  cout << ans << endl;
}


// ベクターの中身を全部出力
void printV(vector<int> &v) {
  cout << "  [ ";
  for(int i = 0; i < (int)v.size(); i++) {
    cout << v.at(i) << " ";
  }
  cout << "]" << endl;
}

void printVV(vector<vector<int>> &vv) {
  cout << "{" << endl;
  for(int i = 0; i < (int)vv.size(); i++) {
    cout << "  [ ";
    for(int j = 0; j < (int)vv.at(i).size(); j++) {
      cout << vv.at(i).at(j) << " ";
    }
    cout << "]," << endl;
  }
  cout << "}" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second

using namespace std;

int main(){
    DRI(n);
    VI a(n),b(n);
    VPII aa(n),bb(n);
    REP(i,n) {RI(a[i]); aa[i]={a[i],i};}
    REP(i,n) {RI(b[i]); bb[i]={b[i],i};}
    sort(ALL(aa));
    sort(ALL(bb));
    REP(i,n) {a[aa[i].S]=i;}
    REP(i,n) {b[bb[i].S]=i;}
    int i=0;
    bool isok=true;
    bool iswon=false;
    REP(j,n){
        while (i<n and aa[i].F<=bb[j].F) i++;
        if (i<=j) isok=false;
        if (i>j+1) iswon=true; 
    }
    if (!isok) {printf("No\n"); return 0;}
    if (iswon) {printf("Yes\n"); return 0;}
    VI amb(n);
    int nbn0=0;
    int nbv=0;
    VI visited(n,0);
    int curr=0;
    while (!visited[curr]){
        visited[curr]=1;
        nbv++;
        curr=b[aa[curr].S];
        //cout<<"curr "<<curr<<endl;
    }
    
    if (nbv<n) {printf("Yes\n"); return 0;}
    else {printf("No\n"); return 0;}

}


Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

long long cnt;
vector <int> G;
int n;
int A[1000000];

void insertionSort(int A[],int n,int g){
    for (int i=g;i<n;i++){
        int v = A[i];
        int j = i-g;
        while (j>=0 && A[j]>v){
            A[j+g] = A[j];
            j -= g;
            cnt++;
        }
        A[j+g]=v;
    }
}

void shellSort(int A[],int n){
    for (int h=1; ; ){
        if(h>n)break;
        G.push_back(h);
        h = 3*h+1;
    }
    for(int i=G.size()-1;i>=0;i--){
        insertionSort(A,n,G[i]);
    }
}

int main(){
    cin >> n;
    for(int i=0;i<n;i++)scanf("%d",&A[i]);
    cnt=0;

    shellSort(A,n);

    cout << G.size() << endl;
    for(int i=G.size()-1;i>=0;i--){
        printf("%d",G[i]);
        if (i) printf(" ");
    }
    printf("\n");
    printf("%d\n",cnt);
    for (int i=0;i<n;i++)printf("%d\n",A[i]);

    return 0;
}


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

int main(){
  int M , s1 , s2 , s3;
  cin >> M;
  s1 = M/100 , s2 = (M-100*s1)/10 , s3 = M%10;
  cout << s1 + s2 + s3 << endl;
}

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

int main(void){
   int N,K;
   cin>>N>>K;
   int R,S,P;
   cin>>R>>S>>P;
   string T;
   cin>>T;
   int sum=0;
   for(int i=0;i<K;i++){
      bool flag=false;
      for(int j=i;j<N;j+=K){
         if(j>=K&&!flag&&T[j]==T[j-K]){
            flag=true;
         }else{
            flag=false;
            if(T[j]=='s') sum+=R;
            if(T[j]=='p') sum+=S;
            if(T[j]=='r') sum+=P;
         }
      }
   }
   cout<<sum<<endl;
   return 0;
}

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

vector <int> adj[100001];
int n,m;
int p[100001];
int check[100001];
int arr[100001];
int res = 0;

void dfs(int now,int num)
{
	check[now] = num;
	for(auto next : adj[now])
	{
		if(check[next]==-1)
		{
			dfs(next,num);
		}
	}
}

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

	cin >> n >> m;

	for(int i=1;i<=n;i++)
	{
		cin >> p[i];
	}

	for(int i=1;i<=m;i++)
	{
		int x,y;
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}

	memset(check,-1,sizeof(check));
	memset(arr,-1,sizeof(arr));

	int num = 0;

	for(int i=1;i<=n;i++)
	{
		if(check[i]==-1)
		{
			num++;
			dfs(i,num);
		}
	}

	for(int i=1;i<=n;i++)
	{
		arr[p[i]] = check[i];
	}

	for(int i=1;i<=n;i++)
	{
		if(arr[i]==check[i])
		{
			res++;
		}
	}

	cout << res << '\n';

	return 0;	
}

Measured memory_bytes: 8960
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

l = 0
for i in range(n):
    if a[i] <= b[i]:
        l += a[i]
        a_i = a[i+1]
        a[i+1] = a[i+1] - (b[i]-a[i])
        if a[i+1] < 0:
            a[i+1] = 0
            l += a_i
        else:
            l += b[i]-a[i]
    else:
        l += b[i]
                
print(l)

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}
// }}}
/* vim:set foldmethod=marker: */

int main(int argc, char const* argv[])
{
    int n;
    cin >> n;
    vi a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }
    int now=0, c=0;
    while(true){
        if (now == 1) {
            cout << c << endl;
            break;
        }

        if (c >= n) {
            cout << -1 << endl;
            break;
        }

        c++;
        now = a[now];
    }
    
    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[205];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> A[i];
    }

    ll ans = 0;
    while (true) {
        bool e = true;
        REP(i, N) {
            if (A[i] % 2 != 0)
                e = false;
            A[i] /= 2;
        }
        if (!e)
            break;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    for (int i = 0; i < b; i++) {
        string s;
        for (int j = 0; j < w - a; j++) {
            s.push_back('0');
        }
        for (int j = w - a; j < w; j++) {
            s.push_back('1');
        }
        cout << s << '\n';
    }
    for (int i = b; i < h; i++) {
        string s;
        for (int j = 0; j < w - a; j++) {
            s.push_back('1');
        }
        for (int j = w - a; j < w; j++) {
            s.push_back('0');
        }
        cout << s << '\n';
    }
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>

using namespace std;

int main()
{
  string s1, s2, s3;
  cin >> s1 >> s2;
  if (s1.size() > s2.size()){
    cout << "GREATER" << endl;
  }else if (s1.size() < s2.size()){
    cout << "LESS" << endl;
  }else{
    bool eq = true;
    for(int i = 0; i < s1.size(); ++i){
      if (s1[i] > s2[i]){
        cout << "GREATER" << endl;
        eq = false;
        break;
      }else if (s1[i] < s2[i]){
        cout << "LESS" << endl;
        eq = false;
        break;
      }
    }
    if (eq)
      cout << "EQUAL" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n,k,i,y;d['   '];c(int*z){y=*1[&z]-*z;}main(x){for(scanf("%*d");~scanf("%d%d",&n,&k);printf("%d\n",i)){for(i=n--;i;y=x)scanf("%d",&x),d[--i]=x-y;for(qsort(d,n,4,c);n>=k;i+=d[--n]);}}

Measured memory_bytes: 1180
//Author: Pakhomovee 
#include <iostream> 
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <deque>
#include <iomanip>
#include <queue>

using namespace std;
using namespace std::chrono;

void solve()
{
	int x;
	cin >> x;
	if (x >= 30)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	auto start = system_clock::now();

	solve();

	auto end = system_clock::now();
	cerr << "Time: " << duration_cast<milliseconds> (end - start).count() << "ms" << endl;
}

Measured memory_bytes: 3664
#include <stdio.h>
int main(){
    char S[101];
    scanf("%s", S);
    int i;
    int flag=0;
    for(i=0; i<100; i++){
        if((i+1)%2==0 && S[i]=='R'){
            printf("No\n");
            flag=1;
            break;
        }
        if((i+1)%2==1 && S[i]=='L'){
            printf("No\n");
            flag=1;
            break;
        }
    }
    if(flag==0){
         printf("Yes\n");
    }
   
    return 0;
}

Measured memory_bytes: 128
fn main() {
    proconio::input! {
        n: i32,
        m: i32,
        a: [i32; m]
    }
    let mut sum: i32 = 0;
    for i in &a {
        sum += i;
    }
    if (n - sum) >= 0{
        println!("{}", n - sum);
    }else{
        println!("-1");
    }
}


Measured memory_bytes: 2264
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

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

  if (S == "RRR") cout << 3 << endl;
  else if (S == "SRR" || S == "RRS") cout << 2 << endl;
  else if (S == "SSS") cout << 0 << endl;
  else cout << 1 << endl;

  return 0;
}

Measured memory_bytes: 3620
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)

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

const int divisor = 1000000007;

int main(){
	vector<int> ansvec;

	// 100000!までの数をdivisorで割った余りを格納しておく
	long long* factmodary = new long long[100001];
	long long fact = 1;
	for (int i = 1; i <= 100000; i++){
		fact *= i;
		fact %= divisor;
		factmodary[i] = fact;
	}

	int* word = new int[100000] {0};

	for (;;){
		int N, R;
		cin >> N;
		if (N == 0) break;
		cin >> R;
		
		//まず0番目の単語を入れておく
		for (int i = 0; i < N; i++) word[i] = i + 1;

		for (int i = 0; i < R; i++){
			int s, t;
			cin >> s >> t;
			/* swap */
			int tmp = word[s - 1]; word[s - 1] = word[t - 1]; word[t - 1] = tmp;
		}

		//word[i]をkey, word[i]より小さい数がそれ以前にいくつ使われていたかをvalueとして格納するmap
		map<int, int> bubblehist;
		bubblehist[word[0]] = 0;

		long long ans = factmodary[N-1] * (word[0] - 1);

		for (int i = 1; i < N; i++){
			int facttime = word[i] - 1;
			int bubblenum;
			map<int, int>::iterator it = bubblehist.lower_bound(word[i]);

			if (it != bubblehist.end()){
				bubblenum = it->second;
				it--;
			}
			else {
				it--;
				bubblenum = it->second + 1;
			}
			pair<int, int> p;
			p.first = word[i];
			p.second = bubblenum;
			map<int, int>::iterator it2 = bubblehist.insert(it, p);
			//word[i]より大きい数はすべてvalueが1増える
			for (++it2; it2 != bubblehist.end(); it2++) (it2->second)++;

			facttime -= bubblenum;
			ans += factmodary[N - (i + 1)] * facttime;
			ans %= divisor;
		}
		ansvec.push_back((int)ans);
	}

	for (vector<int>::iterator it = ansvec.begin(); it != ansvec.end(); it++) cout << *it << "\n";

	delete[] word;
	delete[] factmodary;
	return 0;
}

Measured memory_bytes: 6808
var input: [Int] = []
for _ in 0..<6 {
  let line = readLine()!
  input.append(Int(line)!)
}

let a = input[0]
let e = input[4]
let k = input[5]

if e - a <= k {
  print("Yay!")
} else {
  print(":(")
}
  


Measured memory_bytes: 3692
#include<bits/stdc++.h>
#define ll long long int
#define pb(x) push_back(x)
#define vvi vector<vector<int>>
#define vec vector<int>
#define un unsigned
#define dbl double
#define wking(t) cout<<"Working "<<t<<endl;
#define loop(i,s,n) for(auto i=s;i!=n;i++)
#define eps 0.000000001
using namespace std;


int calc(vvi &a,int n)
{
    vvi dp(3,vec (n,-1));
    loop(i,0,3) dp[i][0] = a[i][0];
    loop(i,1,n)
    {
        loop(j,0,3)
        {
            int max=INT_MIN;
            loop(k,0,3)
                if(j!=k && max<dp[k][i-1]) max=dp[k][i-1];
            dp[j][i] = max+a[j][i];
        }
    }
    // loop(i,0,3)
    // {
    //     loop(j,0,n)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    return max(max(dp[0][n-1],dp[1][n-1]),dp[2][n-1]);
}

int main()
{
    int n;
    cin>>n;
    vvi v(3,vec (n,0));
    loop(i,0,n) loop(j,0,3) cin>>v[j][i];
    cout<<calc(v,n)<<endl;
    return 0;
}


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int K = sc.nextInt();
        int x[] = new int[n];
        int y[] = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }
        long ans = Long.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            long left = x[i];
            for (int j = 0; j < n; j++) {
                long right = x[j];
                if (left > right)
                    continue;
                for (int k = 0; k < n; k++) {
                    long down = y[k];
                    for (int l = 0; l < n; l++) {
                        long up = y[l];
                        if (down > up)
                            continue;
                        int cnt = 0;
                        for (int m = 0; m < n; m++) {
                            if (left <= x[m] && x[m] <= right) {
                                if (down <= y[m] && y[m] <= up) {
                                    cnt++;
                                }
                            }
                        }
                        long tmp = (right - left) * (up - down);
                        if (cnt >= K) {
                            ans = Math.min(ans, tmp);

                        }
                    }
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 22740
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let (n, k) = Scanf.sscanf (read_line ()) "%d %d" @@ fun n k -> (n, k)
let (r, s, p) = Scanf.sscanf (read_line ()) "%d %d %d" @@ fun r s p -> (r, s, p)
let t = read_line () |> split_string |> Array.of_list

let () =
  let res = Array.make n false in
  for i = 0 to n - 1 do
    if i < k then res.(i) <- true
    else if t.(i) <> t.(i - k) || not res.(i - k) then res.(i) <- true
  done;
  Printf.printf "%d\n" @@ Array.fold_left (+) 0 @@
    Array.mapi (fun i h -> 
      if res.(i) then match h with
        | "r" -> p
        | "s" -> r
        | _ -> s
      else 0
    ) t


Measured memory_bytes: 10368
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;

set<int> fib;

int fi[1100];

main(){
	fi[0]=1;
	fi[1]=2;
	for(int i=2;i<1100;i++){
		fi[i]=(fi[i-1]+fi[i-2])%1001;
	}
	
	int V,d;
	while(cin>>V>>d){
		fib.clear();
		for(int i=1;i<=V;i++){
			fib.insert(fi[i]);
		}
		
		int ans=1;
		int bef=*fib.begin();
		for(set<int>::iterator p=fib.begin();++p,p!=fib.end();){
			if(*p-bef>=d)++ans;
			bef=*p;
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    VI x(n);
    REP(i, n) cin >> x[i];

    int ans = INT_MAX;
    REP(l, n - k + 1) {
        int r = l + k - 1;
        ans = min(ans, abs(x[l]) + abs(x[l] - x[r]));
        ans = min(ans, abs(x[r]) + abs(x[r] - x[l]));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define dbg(x) { cerr<<"> "<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const double eps = 0.0000001;
const double PI = acos(-1.0);
const int MOD = 1e9+7;
const int N  = 105;

int w[N], v[N], dp[N][100005];

signed main(){
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif  
    IOS;

    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    	cin >> w[i] >> v[i];
    for (int i = 1; i<= n; i++) {
    	for (int j = 1; j <= k; j++) {
    		if (j >= w[i]) dp[i][j] = max(v[i] + dp[i-1][j-w[i]], dp[i-1][j]);
	    	else dp[i][j] = dp[i-1][j];
    	}
    }
    cout << dp[n][k];
    return 0;
}

Measured memory_bytes: 79360
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std ;

int a[5] , K ;
int main(){
	scanf( "%d%d%d" , &a[1] , &a[2] , &a[3] ) ;
	scanf( "%d" , &K ) ;
	sort( a + 1 , a + 4 ) ;
	printf( "%d" , a[1] + a[2] + ( a[3] << K ) ) ;
}

Measured memory_bytes: 128
//Never stop trying
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<str> vs;
typedef vector<ld> vd;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

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

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int MX = 2e5 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

#define dbg(x) cerr << " - " << #x << " : " << x << endl;
#define dbgs(x,y) cerr << " - " << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << " - " << #v << " : " << endl << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;

void IO() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}


int32_t main() {
	boost; IO();

	int x; cin>>x;
	cout << 1-x << endl;



	return 0;
}

/* Careful!!!
	.Array bounds
	.Infinite loops
	.Uninitialized variables / empty containers
	.Order of input

   Some insights:
	.Binary search
	.Graph representation
	.Write brute force code
	.Change your approach
*/


Measured memory_bytes: 3616
H, W = map(int,input().split())
Sq = []
Haround = []
Slast = []
for i in range(W+2) :
    Haround.append('0')

Sq.append(Haround)

for i in range(H) : 
    l = list(str(input()))
    S = ['0']
    for j in range(W) :
            S.append(l[j])
    S.append('0')
    Sq.append(S)
Sq.append(Haround)

around = [[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1],[-1,0],[-1,1]]
for i in range(H+2) : 
    for j in range(W+2) : 
        c = 0
        if Sq[i][j] == '.' :
            for k in range(8) :
                K = around[k]
                if Sq[i + K[0]][j + K[1]] == '#' :
                    c += 1
            Sq[i][j] = str(c)

for i in range(1,H+1) :
    Sq[i].pop(0)
    Sq[i].pop(W)
    ans = ''.join(Sq[i])
    print(ans)

Measured memory_bytes: 3188
N = int(input())
A,B = list(map(int,input().split()))
P = list(map(int,input().split()))

t1 = sum([p<=A for p in P])
t2 = sum([p>A and p<=B for p in P])
t3 = sum([p>B for p in P])

print(min([t1, t2, t3]))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int n = Integer.parseInt(input.nextLine());
    String[] ss = input.nextLine().split(" ");
    int[] xs = new int[n];
    for (int i = 0; i < n; i++) {
      xs[i] = Integer.parseInt(ss[i]);
    }
    int count = 0;
    for (int i = 0; i < n; i++) {
      if (xs[i] == count + 1) {
        count++;
      }
    }
    if (count == 0) {
      System.out.println("-1");
    } else {
      System.out.println(n - count);
    }
  }
}


Measured memory_bytes: 59052
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int A, B, C, X, Y;

int main() {
  cin >> A >> B >> C >> X >> Y;

  if (2 * C <= A && 2 * C <= B) {
    cout << max(X, Y) * 2 * C << endl;
    return 0;
  } else if (2 * C <= A) {
    if (X >= Y) {
      cout << X * 2 * C << endl;
      return 0;
    } else {
      cout << X * 2 * C + (Y - X) * B << endl;
      return 0;
    }
  } else if (2 * C <= B) {
    if (Y >= X) {
      cout << Y * 2 * C << endl;
      return 0;
    } else {
      cout << Y * 2 * C + (X - Y) * A << endl;
    }
  } else if (2 * C <= A + B) {
    if (X >= Y) {
      cout << Y * 2 * C + (X - Y) * A << endl;
    } else {
      cout << X * 2 * C + (Y - X) * B << endl;
    }
  } else {
    cout << A * X + B * Y << endl;
  }
}

Measured memory_bytes: 256
from math import gcd
from collections import defaultdict

N = int(input())
AB = [tuple(map(int, input().split())) for _ in range(N)]
MOD = 10**9 + 7

d = defaultdict(int)#defaultdictで数えあげ
cnt_00 = 0
cnt_0b = 0
cnt_a0 = 0
for a,b in AB:
    if a == b == 0:
        cnt_00 += 1
    elif a == 0:
        cnt_a0 += 1
    elif b == 0:
        cnt_0b += 1
    else:
        num_gcd = gcd(a,b)
        grad = 1 if a * b > 0 else -1
        a //= num_gcd
        b //= num_gcd
        d[(grad, abs(a), abs(b))] += 1

ans = 1
for k in d.keys():
    if d[k] == 0:
        continue
    
    grad, a, b = k[0], k[1], k[2]
    if (-grad, b, a) in d:
        
        # 傾き a/bのものを一つ以上選ぶ場合（-b/aは選ばない） + -b/aから一つ以上選ぶ場合（a/bは選ばない） + どちらからも選ばない場合
        ans *= (pow(2, d[(grad, a, b)], MOD)-1) + (pow(2, d[(-grad, b, a)], MOD)-1) + 1
        ans %= MOD
        d[(grad, a, b)] = 0
        d[(-grad, b, a)] = 0
    else:
        # a/bから0個以上選ぶ場合
        ans *= pow(2, d[(grad, a, b)], MOD)
        ans %= MOD
        d[(grad, a, b)] = 0

# a,bの一方のみ0の場合 + どちらからも選ばない場合
ans *= (pow(2, cnt_a0, MOD)-1) + (pow(2, cnt_0b, MOD)-1) + 1
ans %= MOD

# 0,0のみを１つだけ入れる場合
ans += cnt_00
# なにも選ばない場合を除く
ans -= 1

ans %= MOD

print(ans)

Measured memory_bytes: 160860
"""#################################################################
【ABC110】
B_1_Dimensional_Worlds_Tale
#################################################################"""

#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N, M, X, Y = ISI()
x = ILI()
y = ILI()
good = False
for i in range(X+1, Y+1):
    if max(x) < i and min(y) >= i:
        good = True
        break
if good == True:
    print("No War")
else:
    print("War")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(void) {
    int n; cin >> n;
    vector<int> p(n+1);
    int cnt = 0;
    rep(i,n) {
        cin >> p[i+1];
        if(i+1 != p[i+1]) cnt++;
    }
    if(cnt<=2) cout <<"YES";
    else cout <<"NO";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int N;
    cin >> N;
    vector<int> V(N+1), W(N+1);
    for (int i = 0; i < N; i++) {
        cin >> V[i+1] >> W[i+1];
    }
    int Q;
    cin >> Q;
    vector<int> sv(Q), L(Q);
    for (int i = 0; i < Q; i++) {
        cin >> sv[i] >> L[i];
    }

    int LMAX = 100005;
    int ten = 1<<9;
    vector<vector<int>> dp(min(ten, N+1), vector<int> (LMAX));

    for (int i = 0; i < W[1]; i++) {
        dp[1][i] = 0;
    }
    for (int i = W[1]; i < LMAX; i++) {
        dp[1][i] = V[1];
    }

    for (int v = 2; v < min(ten, N+1); v++) {
        for (ll l = 0; l < LMAX; l++) {
            if(l - W[v] >= 0){
                dp[v][l] = max(dp[v/2][l], dp[v/2][l-W[v]] + V[v]);
            }
            else{
                dp[v][l] = dp[v/2][l];
            }
        }
    }

    int size;
    int vi;
    vector<int> CV;
    vector<int> CW;
    int VV, WW;
    int tmp;
    for (int q = 0; q < Q; q++) {
        if(sv[q] < ten){
            printf("%d\n", dp[sv[q]][L[q]]);
        }
        else{
            CV.clear();
            CW.clear();
            size = 0;
            vi = sv[q];
            while(vi >= ten){
                CV.push_back(V[vi]);
                CW.push_back(W[vi]);
                vi = vi / 2;
                size++;
            }

            tmp = 0;
            for (int i = 0; i < (1<<size); i++) {
                VV = 0;
                WW = 0;
                for (int j = 0; j < size; j++) {
                    if(i & (1<<j)){
                        VV += CV[j];
                        WW += CW[j];
                    }
                }
                if(L[q] - WW >= 0){
                    tmp = max(tmp, VV + dp[vi][L[q]-WW]);
                }
            }
            printf("%d\n", tmp);
        }


    }

}


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

typedef struct {
	queue<string> name;
	queue<int> time;
}Process;

int main() {
	int n, q,allTime=0;
	cin >> n >> q;
	Process p;
	int tTmp; string nTmp;
	for (int i = 0;i < n;i++) {
		cin >> nTmp; cin >> tTmp;
		p.name.push(nTmp);
		p.time.push(tTmp);
	}
	while (!p.time.empty()) {
		if (p.time.front() <= q) {
			allTime+=p.time.front();
			cout << p.name.front() << " " << allTime << endl;
			p.name.pop(); p.time.pop();
		}
		else {
			allTime += q;
			p.name.push(p.name.front());
			p.time.push(p.time.front()-q);
			p.name.pop(); p.time.pop();
		}
	}

	return 0;
}

Measured memory_bytes: 5716
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#define kw(a) ((a) * (a))
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;
 
const int maxN = 1 << 21;
 
int T[maxN];
 
void solve()
{
	int n, m;
	scanf ("%d%d", &n, &m);
	
	int sum = 0;
	FOR(i, 0, n)
		scanf ("%d", T+i), sum += T[i];
		
	int res = 0;
	FOR(i, 0, n)
		if (T[i] * 4 * m >= sum)
			res++;
		
	printf("%s\n", res >= m ? "Yes" : "No");
}
 
int main()
{
	int t;
t=1;////	scanf ("%d", &t);
	FOR(tid, 1, t+1)
	{
		//printf("Case #%d: ", tid);
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;



int main() {
    int a, b;
    cin >> a >> b;
    rep(i,max(a, b)) cout << min(a, b);
    cout << endl;

    return 0;
}


Measured memory_bytes: 3600
#include <forward_list>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstdint>
#include <utility>

#define X 0
#define Y 1

using namespace std;

typedef long long int int64;

int64 WH[2],N;
int64 XY[100000][2];
vector<int64> VN[2];
vector<int64> S;
vector<pair<int64,int64>> T;
vector<pair<pair<int64,int64>,int64>> U;

signed main(void)
{
	cin >> WH[X] >> WH[Y] >> N;
	int64 x,y;
	for(int64 i = 0;i < N;i++)
	{
		cin >> x >> y;
		T.push_back(make_pair(x,y));
	}
	sort(T.begin(),T.end());
	for(int64 i = 0;i < N;i++)
	{
		XY[i][X] = T[i].first;
		XY[i][Y] = T[i].second;
		VN[X].push_back(XY[i][X]);
		VN[X].push_back(XY[i][X]);
		VN[Y].push_back(XY[i][Y]);
		VN[Y].push_back(XY[i][Y]);
	}
	sort(VN[X].begin(),VN[X].end());
	sort(VN[Y].begin(),VN[Y].end());
	int64 prev = -1;
	int64 MAXd = 0;
	int64 p[2],m[2];
	int64 dist = 0;
	for(int64 i = 0;i < N;i++)
	{
		for(int64 xy = 0;xy < 2;xy++)
		{
			p[xy] = lower_bound(VN[xy].begin(),VN[xy].end(),XY[i][xy]) - VN[xy].begin();
			if(p[xy] < N)
			{
				m[xy] = abs(VN[xy][N]-XY[i][xy]);
			}
			else
			{
				m[xy] = abs(VN[xy][N-1]-XY[i][xy]);
			}
		}
		if(MAXd <= m[X] + m[Y])
		{
			MAXd = m[X] + m[Y];
		}
	}
	for(int64 i = 0;i < N;i++)
	{
		for(int64 xy = 0;xy < 2;xy++)
		{
			p[xy] = lower_bound(VN[xy].begin(),VN[xy].end(),XY[i][xy]) - VN[xy].begin();
			if(p[xy] < N)
			{
				m[xy] = abs(VN[xy][N]-XY[i][xy]);
			}
			else
			{
				m[xy] = abs(VN[xy][N-1]-XY[i][xy]);
			}
		}
		if(MAXd == m[X] + m[Y])
		{
			S.push_back(i);
		}
	}
	
	sort(S.begin(),S.end());
	for(auto itr = S.begin();itr < S.end();itr++)
	{
		if(prev == *itr)
		{
			S.erase(itr);
			itr--;
		}
		else
		{
			prev = *itr;
		}
	}
	for(auto itr = S.begin();itr < S.end();itr++)
	{
		for(int64 xy = 0;xy < 2;xy++)
		{
			p[xy] = lower_bound(VN[xy].begin(),VN[xy].end(),XY[*itr][xy]) - VN[xy].begin();
			if(p[xy] < N)
			{
				m[xy] = VN[xy][N];
			}
			else
			{
				m[xy] = VN[xy][N-1];
			}
		}
		U.push_back(make_pair(make_pair(m[X],m[Y]),*itr));
	}
	sort(U.begin(),U.end());
	for(int64 i = 0;i < N;i++)
	{
		if(i != U[0].second)
		{
			dist += (abs((U[0].first).first-XY[i][X])*2);
			dist += (abs((U[0].first).second-XY[i][Y])*2);
		}
		else
		{	
			dist += abs((U[0].first).first-XY[i][X]);
			dist += abs((U[0].first).second-XY[i][Y]);
		}
	}
	cout << dist <<endl << (U[0].first).first << " " << (U[0].first).second << endl;
}

Measured memory_bytes: 11052
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}



char p(char c) {
  vector<char> v={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  if(c=='z') return 'a';
  rep(i,26) {
    if(c == v.at(i)) return v.at(i+1);
  }
}

int main() {
  ll n;
  cin >> n;
  ll tmp = n;
  ll i = 26;
  int mozisuu = 1;
  while(true) {
    tmp -= i;
    if(tmp <= 0) break;
    else n -= i;
    i *= 26;
    mozisuu += 1;
  }

  i = i/26;
  string ans="";
  rep(i,mozisuu) ans+='a';
  n--;

  int now = 0;
  while(true) {
    if(n - i >= 0) {
      ans.at(now) = p(ans.at(now));
      n -= i;
    } else if(n != 0) {
      i /= 26;
      now+=1;
    } else {
      break;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3644
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}
int main()
{
        //input->compute->output//
        int N;
        cin >> N;
        vector<int> A(N);
        for (int i = 0; i < N; i++)
        {
                cin >> A[i];
        }

        int ans = 0;
        int height = 0;

        for (int i = 0; i < N; i++)
        {
                height = max(height, A[i]);
                if (height == A[i])
                {
                        ans++;
                }
        }

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


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

int a,x,y;
bool v;

int main(){
    cin>>a;
    v=false;
    for (int x=1; x<=9;x++){
        for(int y=1;y<=9;y++){
           if (a==x*y){
               v=true;
           }
        }
    }
    if(v){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    return 0;
}


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

int main() {
  int n; cin >> n;
  map<char,ll> m;
  vector<char> c = {'M', 'A', 'R', 'C', 'H'};
  ll ans = 0;
  rep(i,n) {
    string s; cin >> s;
    m[s[0]]++;
  }
  for (int i = 0; i<5; i++) {
    for (int j = i+1; j<5; j++) {
      for (int k = j+1; k<5; k++) {
        ans += m[c[i]] * m[c[j]] * m[c[k]];
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define f first
#define sec second
#define pb push_back
#define pf push_front
#define pbb pop_back
#define vi vector<ll>
#define vii vector< pair<ll,ll> >
#define pi pair<ll,ll>
#define map map<ll,ll>
#define set set<ll>
const int m=1e9+7;
int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    string s,l;
    cin>>s>>l;
    string res="";
    for(int i=0;i<int(s.size());i++){
        res+=s[i];
        res+=l[i];
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
c=set()
d=set()
for i in range(m):
  a,b=map(int,input().split())
  if a==1 or a==n:
    c.add(b)
  elif b==1 or b==n:
    d.add(a)
if len(c&d)==1:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

Measured memory_bytes: 19024
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define LL long long int
#define REP(i,n) for (int i = 1; i <= (n); i++)
#define Redge(u) for (int k = h[u],to; k; k = ed[k].nxt)
#define cls(s,v) memset(s,v,sizeof(s))
#define mp(a,b) make_pair<int,int>(a,b)
#define cp pair<int,int>
using namespace std;
const int maxn = 100005,maxm = 100005,INF = 0x3f3f3f3f;
inline int read(){
	int out = 0,flag = 1; char c = getchar();
	while (c < 48 || c > 57){if (c == '-') flag = 0; c = getchar();}
	while (c >= 48 && c <= 57){out = (out << 1) + (out << 3) + c - 48; c = getchar();}
	return flag ? out : -out;
}
int main(){
	int L = read(),R = read(),d = read();
	printf("%d\n",R / d - (L - 1) / d);
	return 0;
}

Measured memory_bytes: 3760
// atcoder/abc177/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

bool setwise(const vec<lli>& v)
{
  lli x = v.front();
  each (i, v) x = __gcd(x, i);
  return x == 1;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  const int N = 1e3 + 5;
  bool prime[N];
  fill(prime, prime + N, true);
  prime[0] = prime[1] = false;
  for (int i = 2; i * i < N; ++i) {
    for (int j = 2; i * j < N; ++j) {
      prime[i * j] = false;
    }
  }

  vec<lli> p;
  for (int i = 0; i < N; ++i) {
    if (prime[i]) p.push_back(i);
  }

  // cout << p.size() << endl;

  int n;
  while (cin >> n) {
    vec<lli> a(n);
    cin >> a;

    if (count(a.begin(), a.end(), 1) == a.size()) {
      cout << "pairwise coprime" << endl;
      continue;
    }

    map<int, int> m;

    each (i, a) {
      lli x = i;
      each (j, p) {
        if (x % j == 0) {
          ++m[j];
          while (x % j == 0) x /= j;
        }
      }
      if (x != 1) ++m[x];
    }

    int mx = 0;
    each (i, m) setmax(mx, i.second);

    if (mx == 1) cout << "pairwise coprime" << endl;
    else if (setwise(a)) cout << "setwise coprime" << endl;
    else cout << "not coprime" << endl;
  }

  return 0;
}


Measured memory_bytes: 14724
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

#define rep(i,n) for(int i=0;i<int(n);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,i,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

void solve(){
	const int MAX_N = 1e5+5;
	int N, M;
	int num[MAX_N];
	bool mark[MAX_N] = {};

	cin >> N >> M;
	rep(i,N){
		num[i] = 1;
	}
	mark[0] = true;

	rep(i, M){
		int x, y;
		cin >> x >> y; x--; y--;
		if(mark[x]){
			mark[y] = true;
			if(num[x] == 1){
				mark[x] = false;
			}
		}
		num[x]--;
		num[y]++;
	}

	int ans = 0;
	rep(i,N){
		ans += mark[i];
	}
	cout << ans << endl;
}

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

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


int main(void){
    int N; cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    bool flag=true;

    if(N%2==0){
        for(int i=0; i<N; i=i+2){
            if(A[i]!=A[i+1]){
                flag=false; break;
            }
        }
    }
    else{
        if(A[0]!=0){
            flag=false;
        }
        for(int i=1; i<N; i=i+2){
            if(A[i]!=A[i+1]){
                flag=false; break;
            }
        }
    }

    if(!flag){
        cout << 0 << endl;
        return 0;
    }

    int mod=pow(10,9)+7;
    long long ans=1;

    for(int i=0; i<(N/2); i++){
        ans=ans*2%mod;
    }

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

Measured memory_bytes: 640
#include<bits/stdc++.h>
    using namespace std;
     
    double A, B, C;
    long long X, Y;
     
    int main(){
    	cin >> A >> B >> C >> X >> Y;
     
    	long long ans = INT_MAX;
     
    	for(long long cnum = 0; cnum <= 2 * max(X, Y); cnum+=2){
    		long long tmp = cnum * C;
    		long long Xrest = X - cnum/2;
    		long long Yrest = Y - cnum/2;;
    		if(Xrest > 0){
    			tmp += Xrest * A;
    		}
    		if(Yrest > 0){
    			tmp += Yrest * B;
    		}
    		ans = min(ans, tmp);
    	}
    	cout << ans << endl;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll f(ll a){
if(a<0){
    a=0;
}
return a;
}
int main(){
    ll n,k;
    cin>>n>>k;
    ll a[n],dp[n];
    for(ll i=0;i<n;i++) {
        cin>>a[i];
        dp[i]=9999999999;
    }
    dp[0]=0;
    for(ll i=1;i<n;i++){
            ll q=f(i-k);
    //cout<<q<<endl;
        for(ll j=q;j<i;j++)
        dp[i]=min(dp[i],abs(a[i]-a[j])+dp[j]);
        //cout<<dp[i]<<" ";
    }
    cout<<dp[n-1];
return 0;
}


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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define INF LLONG_MAX/2
#define PI acos(-1.0)
//#define MOD 1000000007

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vout(Vs &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());} //vectorの同じ要素消す
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();} //intの桁数
int digitsum(int n){int ret=0; while(n>0){ret+=n%10;n/=10;}return ret;} //桁和
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int count(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);} //vector aにおけるxの個数
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);
    int x,ans=0;
    cin>>x;
    int now=100;
    while(now<x){
        now*=1.01;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3660