akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <set>
#include <queue>
using namespace std;
int N;
int H[16],W[16];
int ne[16][7][7] = {};
int ok[16][7][7][3] = {};
int dist[1<<16] = {};
char C[7][7];

bool in(int x,int y){
    return 3<=x && x<=6 && 3<=y && y<=6;
}

int to_line(int x,int y){
    return 4*(x-3)+(y-3);
}

int main(){
   cin >> N;
   for(int i=0;i<N;i++) cin >> H[i] >> W[i];
   for(int i=3;i<7;i++){
      for(int j=3;j<7;j++){
         cin >> C[i][j];
      }    
   }
   for(int i=0;i<7;i++){
      for(int j=0;j<7;j++){
         for(int k=0;k<N;k++){
            ne[k][i][j] = -1;
            for(int l=0;l<3;l++) ok[k][i][j][l] = 0;
            int T = (1<<16)-1;
            for(int r=0;r<H[k];r++){
               for(int c=0;c<W[k];c++){
                  if(in(i+r,j+c)){
                     T ^= (1<<to_line(i+r,j+c));
                     if(C[i+r][j+c]=='R'){ok[k][i][j][1] ^= (1<<to_line(i+r,j+c)); ok[k][i][j][2] ^= (1<<to_line(i+r,j+c));}
                     if(C[i+r][j+c]=='B'){ok[k][i][j][0] ^= (1<<to_line(i+r,j+c)); ok[k][i][j][2] ^= (1<<to_line(i+r,j+c));}
                     if(C[i+r][j+c]=='G'){ok[k][i][j][1] ^= (1<<to_line(i+r,j+c)); ok[k][i][j][0] ^= (1<<to_line(i+r,j+c));}
                  }
               }
            }
            ne[k][i][j] = T;
         }
      }
   }
/*   for(int i=0;i<7;i++){
      for(int j=0;j<7;j++) cerr << ne[0][i][j] << " ";
      cerr << endl;
   }
*/   for(int i=0;i<(1<<16);i++) dist[i] = -1;
   dist[(1<<16)-1] = 0;
   queue<int> Q;
   Q.push((1<<16)-1);
   while(!Q.empty()){
      int S = Q.front(); Q.pop();
      for(int i=0;i<7;i++){
         for(int j=0;j<7;j++){
            for(int k=0;k<N;k++){
               for(int l=0;l<3;l++){
                  if((ne[k][i][j]==(1<<16)-1) || (S & ok[k][i][j][l])!=0) continue;
                  int T = (S & ne[k][i][j]);
                  if(dist[T]==-1){
                     dist[T] = dist[S]+1;
                     Q.push(T);
                  }
               }
            }
         }
      }
   }
   cout << dist[0] << endl;
}


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

int main(){
	long long int a,b,c,d,e,f,ans;
	while( cin >> a >> b >> c >> d >> e >> f , (a||b||c||d||e||f) ){
		a += d;
		b += e;
		c += f;
		ans = 0;
		ans += a/3 + b/3 + c/3;
		if( a >= 1 && b >= 1 && c >= 1 ){
			ans = max( ans , (a-1)/3 + (b-1)/3 + (c-1)/3 + 1 );
		}
		if( a >= 2 && b >= 2 && c >= 2 ){
			ans = max( ans , (a-2)/3 + (b-2)/3 + (c-2)/3 + 2 );
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 864
#include <cstdio>

using namespace std;

namespace _ITP1_2_A
{
class ITP1_2_A
{
public:
    /**
    * @fn bool execute();
    * @brief ２つの整数を読み込み、その大小関係を出力する
    * @return bool 入力範囲内ならtrueを、そうでなければfalseを返す
    */
    bool execute();

private:
    /**
    * @fn void read()
    * @brief 標準入力から読み込む
    * @param[out] a 入力データ
    * @param[out] b 入力データ
    */
    void read(int& a, int& b);

    /**
    * @fn bool check(int a, int b)
    * @brief 入力範囲チェックを行う
    * @param[in] a 入力データ
    * @param[in] b 入力データ
    * @return bool 入力範囲内ならtrueを、そうでなければfalseを返す
    */
    bool check(int a, int b);
};

/**
* @brief 大小関係を管理する
*/
class RelationshipBase
{
public:
    /**
    * @fn void printAnswer(int a, int b)
    * @brief 大小関係を出力する
    * @param[in] a 比較対象
    * @param[in] b 比較対象
    */
    virtual void printAnswer(int a, int b) = 0;
};

class RelationshipGreaterThan final : virtual public RelationshipBase
{
public:
    /**
    * @fn void printAnswer(int a, int b)
    * @brief 大小関係を出力する
    * @param[in] a 比較対象
    * @param[in] b 比較対象
    */
    void printAnswer(int a, int b);
};

class RelationshipLessThan final : virtual public RelationshipBase
{
public:
    /**
    * @fn void printAnswer(int a, int b)
    * @brief 大小関係を出力する
    * @param[in] a 比較対象
    * @param[in] b 比較対象
    */
    void printAnswer(int a, int b);
};

class RelationshipEqual final : virtual public RelationshipBase
{
public:
    /**
    * @fn void printAnswer(int a, int b)
    * @brief 大小関係を出力する
    * @param[in] a 比較対象
    * @param[in] b 比較対象
    */
    void printAnswer(int a, int b);
};
}

using namespace _ITP1_2_A;

bool ITP1_2_A::execute()
{
    int in_a = 0, in_b = 0;

    read(in_a, in_b);

    if (!check(in_a, in_b))
        return false;

    int diff = in_a - in_b;

    RelationshipBase* relationship = NULL;

    if (0 == diff)
        relationship = new RelationshipEqual;
    else if (0 < diff)
        relationship = new RelationshipGreaterThan;
    else
        relationship = new RelationshipLessThan;

    relationship->printAnswer(in_a, in_b);

    delete relationship;

    return true;
}

void ITP1_2_A::read(int& a, int& b)
{
    scanf("%d %d", &a, &b);
}

bool ITP1_2_A::check(int a, int b)
{
    if (-1000 > a || 1000 < a ||
        -1000 > b || 1000 < b)
        return false;

    return true;
}

void RelationshipGreaterThan::printAnswer(int a, int b)
{
    printf("%s\n", "a > b");
}

void RelationshipLessThan::printAnswer(int a, int b)
{
    printf("%s\n", "a < b");
}

void RelationshipEqual::printAnswer(int a, int b)
{
    printf("%s\n", "a == b");
}

/**
* @fn int main()
* @brief エントリーポイント
*/
int main()
{
    ITP1_2_A().execute();
}



Measured memory_bytes: 2704
#include<stdio.h>

int main() {
	int a, b;
	int d, r;
	double f,m;
	scanf("%d%d",&a,&b);
	d = a / b;
	r = a % b;
	m = a;
	f = m / b;
	printf("%d %d %f\n", d, r, f);
}

Measured memory_bytes: 1856
#include <iostream>
#include <queue>
#include <vector>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef pair<PDD, PII> PGII;

int W, H;
char P[61][10];
bool visited[61][10];
bool stable;

bool isin(int y, int x) { return 0 <= y && y < H + 1 && 0 <= x && x < W; }

PGII dfs(int y, int x) {
  vector<PII> v;
  queue<PII> q;

  q.push(PII(y, x));
  while(!q.empty()) {
    int cy = q.front().first;
    int cx = q.front().second;
    q.pop();

    if(!visited[cy][cx]) {
      visited[cy][cx] = true;
      v.push_back(PII(cy, cx));
    }

    if(isin(cy - 1, cx) && !visited[cy - 1][cx] && P[cy - 1][cx] == P[y][x]) q.push(PII(cy - 1, cx));
    if(isin(cy + 1, cx) && !visited[cy + 1][cx] && P[cy + 1][cx] == P[y][x]) q.push(PII(cy + 1, cx));
    if(isin(cy, cx - 1) && !visited[cy][cx - 1] && P[cy][cx - 1] == P[y][x]) q.push(PII(cy, cx - 1));
    if(isin(cy, cx + 1) && !visited[cy][cx + 1] && P[cy][cx + 1] == P[y][x]) q.push(PII(cy, cx + 1));
  }

  vector<PGII> w;
  int xl[256], xr[256];
  REP(i, 0, 256) xl[i] = W, xr[i] = 0;
  REP(i, 0, v.size()) {
    int cy = v[i].first;
    int cx = v[i].second;
    if(isin(cy - 1, cx) && !visited[cy - 1][cx] && P[cy - 1][cx] != '.' && P[cy - 1][cx] != P[y][x]) {
      w.push_back(dfs(cy - 1, cx));
    }
    xl[P[cy - 1][cx]] = min(xl[P[cy - 1][cx]], cx + 0);
    xr[P[cy - 1][cx]] = max(xr[P[cy - 1][cx]], cx + 1);
  }

  REP(i, 0, w.size()) {
    if(xl[w[i].second.second] >= w[i].first.second || w[i].first.second >= xr[w[i].second.second]) {
      stable = false;
    }
  }

  PGII g = PGII(PDD(0.0, 0.0), PII(1, P[y][x]));
  REP(i, 0, v.size()) {
    g.first.first  += ((double) v[i].first  + 0.5);
    g.first.second += ((double) v[i].second + 0.5);
  }
  g.first.first  /= 4;
  g.first.second /= 4;
  REP(i, 0, w.size()) {
    g.first.first  += w[i].first.first  * w[i].second.first;
    g.first.second += w[i].first.second * w[i].second.first;
    g.second.first += w[i].second.first;
  }
  g.first.first  /= g.second.first;
  g.first.second /= g.second.first;

  return g;
}

int main(void) {
  while(cin >> W >> H, W > 0 && H > 0) {
    REP(i, 0, H) cin >> P[i];
    REP(i, 0, W) P[H][i] = '0';
    REP(i, 0, H + 1) REP(j, 0, W) visited[i][j] = false;

    stable = true;
    dfs(H, 0);

    cout << (stable ? "STABLE" : "UNSTABLE") << endl;
  }
}

Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut a: Vec<i32> = Vec::with_capacity(m+1);
    let mut count: i32 = 0;
    unsafe{
	a.set_len(m+1);
    }
    for i in 0..m+1{
	a[i as usize] = 0;
    }
    for _i in 0..n{
	let k: usize = read();
	for _j in 0..k{
	    let b: usize = read();
	    a[b]+=1;
	}
    }
    for i in 0..m+1{
	if a[i as usize] == n as i32{
	    count+=1;
	}
    }
    println!("{}",count);
}


Measured memory_bytes: 4352
hw_ = list(map(int, input().split()))

h = hw_[0]
w = hw_[1]

c = []
for i in range(0, h):
    c.append(input())

for i in range(0, h * 2):
    for j in range(0, w):
        print(c[int(i / 2)][j],end='')
    print()

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

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

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pb push_back

const int mn = 1e5 + 5;

int n, k;
int d[mn];
char s[mn];
vector<int> g[mn];
vector<int> ans;

void dfs(int x) {
    if (x == n) return;
    ans.pb(g[x][0] - x);
    dfs(g[x][0]);
}

int main() {
#ifdef trote
    freopen("../1.txt", "r", stdin);
#endif
    scanf("%d%d", &n, &k);
    scanf("%s", s);
    int cur = n;
    while (cur > 0) {
        int l = max(0, cur - k);
        int nxt = -1;
        for (int i = cur - 1; i >= l; i--) {
            if (s[i] == '0') {
                d[i] = d[cur] + 1;
                g[i].pb(cur);
                nxt = i;
            }
        }
        //printf("%d %d\n", cur, nxt);
        cur = nxt;
        if (cur == -1) {
            puts("-1");
            exit(0);
        }
    }
    dfs(0);


    for (int i = 0; i < sz(ans) - 1; i++) printf("%d ", ans[i]);
    printf("%d\n", ans.back());
    return 0;
}

Measured memory_bytes: 9976
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.Scanner;

import javax.xml.crypto.Data;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			if(n == 0) break;
			double[][] dp = new double[n+1][25];
			dp[0][0] = 1.0;
			double sum = 0;
			for(int i = 0; i < n; i++) {
				for(int j = 0; j < 24; j++) {
					double pp = Math.pow(2.0, j);
					dp[i+1][j+1] += dp[i][j] * 1.0 / pp;
					dp[i+1][0]   += dp[i][j] * (1.0 - (1.0 / pp));
					sum += j * dp[i][j] * (1.0 - (1.0 / pp));
				}
			}
			for(int j = 0; j < 25; j++) {
				sum += j * dp[n][j];
			}
			System.out.printf("%.20f\n",sum);
		}
		
	}
}

Measured memory_bytes: 87392
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    int a, b;
    cin >> a >> b;
    cout << max(max(a * b, a + b), a - b) << endl;
}

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

/*                          
---------------------------------------------------------------
Aditya Kumar mishra
---------------------------------------------------------------
*/

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define len(s) s.length()
#define forp(i, a, b) for (int i = a; i <= b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define ren(i, n) for (int i = n - 1; i >= 0; i--)
#define forn(i, a, b) for (int i = a; i >= b; i--)
#define on cout << endl
#define o2(a, b) cout << a << " " << b
#define os cout << " "
#define all(v) v.begin(), v.end()
#define mem(n, m) memset(n, m, sizeof(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define sii set<int>
#define us unordered_set<int>
#define um unordered_map<int, int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ret return 0
#define present(s, x) (s.find(x) != s.end())
#define cpresent(s, x) (find(all(s), x) != s.end())
#define ford(container, it) for (__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define fors(container, it, a, b) for (__typeof(container.begin()) it = a; it != b; it++)

#define boost ios_base::sync_with_stdio(0)
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 999999999999999999
#define siz 100001
#define SIZ 1000001
#define SIZE 200001

typedef long long ll;
typedef long double ldo;
typedef double db;
using namespace std;
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)

void c_p_c()
{
    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
}
int main()
{
    c_p_c();
    ll k;
    cin >> k;
    int val = 7 % k;
    for (int i = 1; i < 1e7; i++)
    {
        if (val == 0)
        {
            cout << i;
            ret;
        }
        val = (val * 10 + 7) % k;
    }

    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
long long int n;
vector<long long int>adj[100002];
long long int dp[2][100002];
long long int solve(long long int u,long long int color,long long int parent)
{
    long long int ans=1;
    if(dp[color][u]!=-1)
    return dp[color][u];
    for(long long int v:adj[u])
    {
        if(v!=parent)
        {
            if(color==0)
            ans=(ans*(solve(v,0,u)+solve(v,1,u)))%mod;
            else
            ans=(ans*solve(v,0,u))%mod;
        }
    }
    return dp[color][u]=ans;
}
int main()
{
    long long int i,j,k,x,y,z;
    cin>>n;
    for(i=0;i<=100000;i++)adj[i].clear();
    for(i=0;i<n-1;i++)
    {
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    for(i=0;i<2;i++)for(j=0;j<=100000;j++)dp[i][j]=-1;
    cout<<(solve(1,0,-1)+solve(1,1,-1))%mod;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

void compress(vector<int> &a){
	vector<int> b = a;
	sort(b.begin(), b.end());
	for(auto &x : a){
		x = lower_bound(b.begin(), b.end(), x) - b.begin();
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n;
	cin>>n;
	vector<int> a(n);
	for(auto &x: a){
		cin>>x;
	}
	compress(a);
	int ans = 0;
	for(int i = 0; i < n; i++){
		if((i^a[i])&1)ans++;
	}
	cout<<ans/2<<endl;

	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int ans = 0;
        // 配列
        int[] a = new int[n+1];
        for(int i=1;i<=n;i++){
            a[i] = sc.nextInt();
            if(i%2==1 && a[i]%2==1) {
                ans++;
            }
        }




        System.out.println(ans);
    }
}


Measured memory_bytes: 35808
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    int d, e;
    while(1){
        cin >> d >> e;
        if(d + e == 0) break;
        double ans = 10000000000;
        rep(i, 0, d){
            int dist = i * i + (d - i) * (d - i);
            double dt = sqrt((double)dist);
            ans = min(ans, fabs(dt - (double)e));
        }
        printf("%.15lf\n", ans);
    }
}

Measured memory_bytes: 3132
A, B, C, K = map(int, input().split())

for i in range(1):
    tmp1 = A
    tmp2 = B
    tmp3 = C
    A = tmp2 + tmp3
    B = tmp1 + tmp3
    C = tmp1 + tmp2
 
if A - B > 10 ** 18:
    print('Unfair')
else:
    if K%2 == 0:
        print((-1)*(A - B))
    else:
        print(A - B)

Measured memory_bytes: 3064
import scala.io.StdIn.{readInt, readLine}

object Main extends App {
  import Solver.solve

  val n   = readInt()
  val xs  = readLine().split(' ').map { _.toInt }
  val ans = solve(xs, n)
  println(ans)
}

object Solver {
  val VMAX: Int = 10000

  def solve(xs: Array[Int], n: Int): Int = {
    val ys   = xs.sorted
    val minV = ys.head
    val zs   = Array.fill(n)(false)
    val ts = {
      val ts = new Array[Int](VMAX + 1)
      var i  = 0
      while (i < n) {
        ts(ys(i)) = i
        i += 1
      }
      ts
    }

    var ans, i = 0
    while (i < n) {
      if (!zs(i)) {
        var cur   = i
        var m     = VMAX
        var s, an = 0
        do {
          zs(cur) = true
          an += 1
          val v = xs(cur)
          m = math.min(m, v)
          s += v
          cur = ts(v)
        } while (!zs(cur))
        ans += math.min(s + (an - 2) * m, m + s + (an + 1) * minV)
      }
      i += 1
    }

    ans
  }
}



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

const int N = 205;

int n, m;
int arr[N][N];
int dp[N][N][N];

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

inline bool isValid(int x, int y) {
    return (0 <= x && x < n && 0 <= y && y < m);
}

inline int solve(int a1, int b1, int a2) {
    int b2 = (a1 + b1) - (a2);
    if (dp[a1][b1][a2] != -1) {
        return dp[a1][b1][a2];
    }
    if ((a1 == a2) && (b1 == b2)) {
        if ((a1 + b1 > 0) && (a1 + b1 < n + m - 2)) {
            return 0;
        }
    }
    if (a1 == n - 1 && b1 == m - 1) {
        return dp[a1][b1][a2] = arr[a1][b1];
    }
    int score = arr[a1][b1];
    if (a1 != a2 || b1 != b2) {
        score += arr[a2][b2];
    }
    int result = 0;
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            int na1 = a1 + dx[i];
            int nb1 = b1 + dy[i];
            int na2 = a2 + dx[j];
            int nb2 = b2 + dy[j];
            if (isValid(na1, nb1) && isValid(na2, nb2)) {
                result = max(result, solve(na1, nb1, na2));
            }
        }
    }
    return dp[a1][b1][a2] = result + score;
}

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

Measured memory_bytes: 34048
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main()
{
	/*string s, t;
	cin >> s >> t;
	t += s;
	cout << t;*/


	ll a, b, k;
	cin >> a >> b >> k;
	ll a2 = a;
	a = max(a - k, 0ll);
	k -= a2 - a;
	b = max(b - k, 0ll);
	printf("%lld %lld", a, b);
	return 0;
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
    var line = chunk.toString().split(' ');
    var x = parseInt(line[0]);
    var y = parseInt(line[1]);
    var s = x * y;
    var l = x * 2 + y * 2;
    console.log(s+ ' ' + l);
});

Measured memory_bytes: 7636
#include <stdio.h>

int main(){
    int a, b;

    scanf("%d %d", &a, &b);

    if (a < b) {
        printf("a < b\n");    
    } else if (a > b) {
        printf("a > b\n");    
    } else {
        printf("a == b\n");    
    }
    return 0;
}

Measured memory_bytes: 580
import fractions
a, b, c, d = map(int, input().split())
ans = 0

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

cd = lcm(c, d)

# cの倍数とdの倍数の個数を数える
# cの倍数dの倍数の個数を引く
ca = ((a-1) // c)
# print(ca)
cb = (b // c)
# print(cb)
tmp_c = cb - ca

da = (a // d)
# print(da)
db = (b // d)
# print(db)
tmp_d = db - da

cda = (a // cd)
# print(cda)
cdb = (b // cd)
# print(cdb)
tmp_cd = cdb - cda
ans = b - a + 1 - (tmp_c + tmp_d - tmp_cd)

print(ans)


Measured memory_bytes: 5076
#include<iostream>
#include<vector>
#include<algorithm>

int main(){
  std::vector<int> c(3);
  std::cin >> c.at(0) >> c.at(1) >> c.at(2);
  sort(c.begin(), c.end());
  if(c.at(0) + c.at(1) == c.at(2)) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
}

Measured memory_bytes: 256
# dp answer
N = int(input())
dp = [N for i in range(N+1)]
dp[0] = 0
Y = [1] + [6**i for i in range(1, 10) if 6**i <= N] + [9**i for i in range(1, 10) if 9**i <= N]
Y = sorted(Y)
for i in range(1, N+1):
    for y in Y:
        if i-y < 0:
            break
        dp[i] = min(dp[i], dp[i-y]+1)
print(dp[N])


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

using namespace std;

#define ll long long
#define pb push_back
#define fr first
#define sc second
#define ub upper_bound
#define lb lower_bound

const int mod=int(1e9+7),MAXN=int(2e5+1);

int main()
{
    long long k,a,b,sol=1;
    cin >> k >> a >> b;

    if (a != 1) {
        sol += min (k,a-1);
        k -= a-1;
    }

    if (k <= 0 ) { cout << sol <<endl; return 0; }

    if (a >= b-1) cout << sol + k  << endl;
    else
    {
        sol += k/2 * (b-a) + k%2;
        cout << sol << endl;
    }



    return 0;
}


Measured memory_bytes: 256
import java.util.*;

// ARC 79-C
// http://arc079.contest.atcoder.jp/tasks/arc079_a

public class Main {
	
	public static void main (String[] args) throws InterruptedException {
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		int M = in.nextInt();
		
		Set<Integer> from1 = new TreeSet<Integer>();
		Set<Integer> toN = new TreeSet<Integer>();
		
		for (int i = 0; i < M; i++) {
			int s = in.nextInt();
			int g = in.nextInt();
			
			if (s == 1 && !from1.contains(g)) {
				from1.add(g);
			} else if (g == N && !toN.contains(s)) {
				toN.add(s);
			}
		}
		
		String answer = "IMPOSSIBLE";

		for (int island: from1) {
			if (toN.contains(island)) {
				answer = "POSSIBLE";
				break;
			}
		}
				
		System.out.println(answer);
	}
}


Measured memory_bytes: 108204
import java.util.Scanner;

public class Main {

	public static void main (String[] args)  {

		Scanner sc = new Scanner(System.in);
		
		int h = sc.nextInt();
		int w = sc.nextInt();
		boolean[][] field = new boolean[h][w];
		int[][] dp = new int[h][w];
		
		for (int i=0;i<h;i++) {
			String s = sc.next();
			for (int j=0;j<w;j++) {
				field[i][j]=(s.charAt(j)=='.');
			}
		}
		dp[0][0]=field[0][0] ? 0 : 1;
		for (int j=1;j<w;j++) {
			dp[0][j]=dp[0][j-1]+(field[0][j-1] && !field[0][j] ? 1 : 0);
		}
		
		for (int i=1;i<h;i++) {
			dp[i][0]=dp[i-1][0]+(field[i-1][0] && !field[i][0] ? 1 : 0);
			for (int j=1;j<w;j++) {
				dp[i][j]=Math.min(dp[i-1][j]+(field[i-1][j]&& !field[i][j] ? 1 : 0),
						dp[i][j-1]+(field[i][j-1] && !field[i][j] ? 1 : 0));
			}
		}

		System.out.println(dp[h-1][w-1]);

	}




}


Measured memory_bytes: 24660
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

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

  ll res = 1;

  for(ll i = 1; i <=N; ++i)
  {
    res *= i;
    res %= MOD;
  }

  cout << res << endl;

  return 0;
}

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


int main() {
	int n;
  	cin>>n;
  
  	vector<int> a(n);
	for (int i=0;i<n;i++){
    	cin>>a.at(i);
    }
  	
  	int next=a.at(0);
  	int count=1;
  	for (int i=0;i<=n;i++){
  			if(next==2){
            	cout<<count<<endl;
              	return 0;
            }else{
            	next=a.at(next-1);
              	count++;
            }
    }
  	cout<<-1<<endl;
}



Measured memory_bytes: 640
l = [int(i) for i in input().split()]
if(l.index(max(l))==0):
  print(l[0]*10+l[1]+l[2])
elif(l.index(max(l))==1):
  print(l[1]*10+l[0]+l[2])
else:
  print(l[2]*10+l[1]+l[0])


Measured memory_bytes: 3060
N = int(input()) 
d = list(map(int, input().split()))
a=int(N/2)
def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right
d=quick_sort(d)
print(d[a]-d[a-1])

Measured memory_bytes: 14396
/*#include <iostream>
using namespace std;
int main() {
	char X,Y;
	cin >> X;
	cin >> Y;
	if (X > Y) {
		cout << ">";
		return 0;
	}
	if (X < Y) cout << "<";
	else cout << "=";

	return 0;
}	*/
/*
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int>p;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		p.push_back(a);
	}
	sort(p.begin(), p.end());
	int suma= 0;
	bool b =true;
	for (int i = N-1; i >=0; i--) {
		if (b) {
			suma += p[i];
			b = false;
		}
		else {
			suma -= p[i];
			b = true;
		}
	}

	cout << suma;

	return 0;
*/

/*
	#include <iostream>
	#include <algorithm>
	#include <vector>
	using namespace std;

	int main() {
		int N;
		cin >> N;
		vector < int>t;
		int suma = 0;
		for (int i = 0; i < N; i++) {
			int a;
			cin >> a;
			suma += a;
			if (a % 10 != 0) {
				t.push_back(a);
			}
		}

		int minElement = *std::min_element(t.begin(), t.end());

		
		if (suma % 10 == 0 && !t.empty()) {
			suma -= minElement;
			cout << suma << endl;

		}
		else if (t.empty()) {
			cout << 0 << endl;
		}
		else cout << suma << endl;
		
		return 0;
	}	*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

int main() {
	int N;
	cin >> N;
	map<int, int>m;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		++m[a];
	}
	int cont = 0;
	for (std::map<int, int>::iterator itp = m.begin(); itp != m.end(); ++itp) {
		if (itp->first != itp->second) {
			
			if (itp->first < itp->second) cont = cont + (itp->second-itp->first);
			else 
			{
			 cont += itp->second;
			
			}
				
		}
	}
	cout << cont << endl;
	
	return 0;
}

Measured memory_bytes: 8056
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int m,n;
    cin>>m>>n;
    if(m*10000<n){
        puts("-1 -1 -1");
        return 0;
    }
    if(m*1000>n){
        puts("-1 -1 -1");
        return 0;
    }
    if(n%1000!=0){
        puts("-1 -1 -1");
        return 0;
    }
    for(int i=0;i<=m;i++)
     for(int j=0;j<=m;j++)
      for(int k=0;k<=m,i+j+k<=m;k++)
       {
            if(i+j+k==m && i*1000+j*5000+k*10000==n)
            {
                cout<<k<<" "<<j<<" "<<i<<endl;
                return 0;   
            }
       }
    puts("-1 -1 -1");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios:: sync_with_stdio(false),cin.tie(0);
#define COUT cout<<fixed<<setprecision(12)
#define CIN getline(cin,s)
#define SET set<ll,greater<ll>>gquiz
#define ITERATOR set<ll,greater<ll>> :: iterator itr
#define V vector<ll>vector
#define sz size()
#define A vector<pair<ll,ll>>vect
ll N=100000,M=100000;
#define B vect.push_back(make_pair(N,M));
ll MOD=1000000007;
unordered_map<ll,bool>check;

void solve()
{
	ll n;
	cin>>n;
	ld d;
	cin>>d;
	ll cnt=0;
	while(n--)
	{
		ll a,b;
		cin>>a>>b;
		ld k=sqrt((a*a)+(b*b));
		if(k<=d)
		cnt++;
	}
	cout<<cnt;
}

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

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

int f(int a, int hp){
  return (hp + a - 1) / a;
}

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(f(b, c) <= f(d, a)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

int N;
string S,T;

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

    string ans;
    for(int i=0;i<N;i++){
        ans+=S[i];
        ans+=T[i];
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define MAX 100000
using namespace std;

int main(){
  int n;  cin >> n;
  int x[100], y[100], h[100];
  rep(i, 0, n){
    cin >> x[i] >> y[i] >> h[i];
  }

  rep(posY, 0, 101){
    rep(posX, 0, 101){
      int H = -1;

      rep(i, 0, n){
        if(h[i] > 0){
          int tmp = h[i] + abs(posX - x[i]) + abs(posY - y[i]);
          if(H == -1){
            H = tmp;
          }else{
            if(H != tmp){
              H = -2;
              break;
            }
          }
        }

      }
      if(H == -2)  continue;


      rep(i, 0, n){
        if(h[i] == 0){
          int dist = abs(posX - x[i]) + abs(posY - y[i]);
          if(H > dist){
            H = -2;
            break;
          }
        }
      }
      if(H == -2) continue;
      cout << posX << " " << posY << " " << H << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    string S, T;
    int lcs[51][51] = {{}};
    int backmost = -1;
    
    cin >> S;
    cin >> T;
    for(int i = 1; i < S.size() + 1; i++){
        for(int j = 1; j < T.size() + 1; j++){
            if(S[i-1] == T[j-1] || S[i-1] == '?')
                lcs[i][j] = lcs[i-1][j-1] + 1;
            else
                lcs[i][j] = 0;
            if(lcs[i][j] == T.size())
                backmost = max(backmost, i);
        }
    }
    
    backmost--;
    
    if(backmost >= 0){
        for(int j = 0; j < S.size(); j++){
            if(j >= backmost - T.size() + 1 && j <= backmost)
                cout << T[j-(backmost-T.size()+1)];
            else if(S[j] == '?')
                cout << 'a';
            else
                cout << S[j];
        }
        cout << endl;
    }
    else
        cout << "UNRESTORABLE" << endl;
    
    return 0;
}


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

long long N , A[1000003] , num[1000003];

int main(){
	cin >> N; for(int i = 0 ; i <= N ; ++i) cin >> A[i];
	num[0] = 1 - A[0]; for(int i = 1 ; i <= N ; ++i) num[i] = (num[i - 1] > 1e18 ? num[i - 1] : num[i - 1] << 1) - A[i];
	for(int i = 0 ; i <= N ; ++i) if(num[i] < 0){puts("-1"); return 0;}
	if(!N){cout << 1; return 0;}
	int pos = 0; long long sum = 1; num[0] = 2;
	for(int i = 1 ; i <= N ; ++i){
		while(A[i]){
			long long t = min(A[i] , num[pos]); sum += (i - pos) * t;
			A[i] -= t; num[pos] -= t; if(!num[pos]) ++pos;
		}
	}
	cout << sum;
}


Measured memory_bytes: 5188
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
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;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll a,b;
  	ci(a>>b);
  ll now=1;
  if(b==1){
    co(0)
  }
  else{
  FOR(i,0,10000){
    now--;
    now+=a;
    if(now>=b){
      co(i+1)
        break;
    }
  }
  }
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;

typedef pair<int, int> P;

int n, aans, bans;
P a[111111], b[111111];

int main(){
  ios_base::sync_with_stdio(false);

  for(int i=0;i<111111;i++){
    a[i].second = i;
    b[i].second = i;
  }

  cin >> n;
  for(int i=0;i<n/2;i++){
    int aa, bb;
    cin >> aa >> bb;
    a[aa].first++;
    b[bb].first++;
  }
   
  sort(a, a+111111, greater<P>());
  sort(b, b+111111, greater<P>());
  
  aans = a[0].first;
  bans = b[0].first;

  if(a[0].second == b[0].second){
    if(a[1].first < b[1].first){
      bans = b[1].first;
    } else {
      aans = a[1].first;
    }
  }

  cout << n-aans-bans << endl;

  return 0;
}



Measured memory_bytes: 2048
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, string s){
    vector<set<int>> t(10);
    for(int i = 0; i < n; ++i)
        t[s[i] - '0'].emplace(i);
    i64 ans = 0;
    for(int i = 0; i < 10; ++i)
        for(int j = 0; j < 10; ++j)
            for(int k = 0; k < 10; ++k){
                int idx = -1;
                vector<int> d{i, j, k};
                bool fl = true;
                for(auto& x : d){
                    auto it = t[x].upper_bound(idx);
                    if(it == t[x].end()) {
                        fl = false;
                        break;
                    }
                    idx = *it;
                }
                ans += fl;
            }
    cout << ans << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    string S;
    cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#include<numeric>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int a,b;
    while(cin>>a>>b){
        for(int i=1000000;i>=0;i--)
            if(a>=i&&b>=i&&a%i==0&&b%i==0)
            {cout<<i<<endl; break;}
    }
}

Measured memory_bytes: 3008
/*ॐॐ*/
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different.
Change variable names or change some Data structres or anything just make sure MOSS do not
Detect Anything.
Yours Faithfully
Shobhit Yadav */

/* I do not fear this new challenge. Rather like a true warrior I will rise to meet it. 
                                       -Prince Vegeta  */

 /* “Strength is the only thing that matters in this world. Everything else is just a delusion for the weak.” – Vegeta */

#include<bits/stdc++.h>
using namespace std;
#define ll long long 



ll N;
/*ll freq[200005];*/
void solve(){
   /*memset(freq,0,sizeof(freq));*/
   cin>>N;
   string s;

   cin>>s;
bool flag = true;

if(N%2 == 1)
	cout<<"No"<<'\n';

else{
	for(ll i = 0 ; i<N/2 ; i++){
	if(s[i] != s[i + (N/2)])
	{
		flag = false;
		break;
	}
}

if(flag)
cout<<"Yes"<<'\n';

else
cout<<"No"<<'\n';
}




   

}



int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  
   solve();

  return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>

int main(void)
{
	int i,a,b;
	bool year [3001]={0},s=0;
	
	for(i=1; i<3000; i++){
		if(i % 4 == 0){
			year[i] = 1;
		}
	}
	
	for(i=100; i<3000; i+=100){
		year[i] = 0;
	}
	for(i=400; i<3000; i+=400){
		year[i] = 1;
	}
	while(1){
		bool flag=0;
		scanf("%d %d", &a, &b);
		if(a==0){
			break;
		}
		if(s==1)puts("");
		s=1;
		for(i=a;i<=b;i++){
			if(year[i] == 1){
				printf("%d\n",i);
				flag=1;
			}
		}
		if(flag==0)printf("NA\n");
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;

vll fac, finv, inv;

void COMinit(ll MAX) {
    if(MAX<1) return;
    fac.resize(MAX);
    finv.resize(MAX);
    inv.resize(MAX);
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if(k==0 || n==k) return 1;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modmul(ll a,ll b,ll mod=MOD){
    return ((a%mod)*(b%mod))%mod;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N,K;
    cin>>N>>K;
    
    COMinit(max(K,N-K+2));
    
    for(int i=1;i<=K;i++)
        cout<<modmul(COM(K-1,i-1),COM(N-K+1,i))<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
 
#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector
#define beg begin
#define dbg(x) cout << #x << " = " << x << endl;
 
template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}
 
template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i;
    }
    return str;
}
 
template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.first << " " << a.second;
    return str;
}
 
template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.first >> a.second;
    return str;
}
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();    
    return 0;   
}
 
const int MOD = 1e9 + 7, MAXN = 5e5 + 10, INF = 2e9 + 10, BASE = 37; 

void solve() {
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for (int i = l; i <= r; ++i) {
        if (i % d == 0) {
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main() {
    int M[10];
    for(int i=0;i<10;++i) {
        scanf("%d",&M[i]);
    }
    sort(M,M+10);
    printf("%d\n%d\n%d\n",M[9],M[8],M[7]);
}

Measured memory_bytes: 1044
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

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

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << ' ' << y << ' ' << z << '\n';
}


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

int main(void){
	int n;
	int ans = 0;
	cin >> n;
	for(int i=1;i<=n;i++){
		if(i%2 != 0){
			int tmp = i;
			int cnt = 0;
			while(tmp != 0){
				if(i % tmp == 0){
					cnt++;
				}
				tmp--;
			}
			if(cnt == 8){
				ans++;
			}
		}else{
			continue;
		}
	}
	
	cout << ans << endl;
	return 0;
}

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

int main()
{
  long A, B, N, x;
  cin >> A >> B >> N;
  if (N >= B-1) x = B-1;
  else x = N;
  cout << floor(A*x/B) - A*floor(x/B) << endl;
}


Measured memory_bytes: 3788
#include<stdio.h>
int main(void)
{
  int i,j,H,W,count=0,flag=0;
  while(1)
  {
    scanf("%d %d",&H,&W);
    if(H==0&&W==0)
      break;

    for(i=0;i<H;i++)
    {
      for(j=0;j<W;j++)
      {
        if(i==0||i==H-1)
          flag=1;
        if(j==0||j==W-1)
          flag=1;
        if(flag==1)
          printf("#");
        else
          printf(".");
        flag=0;
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2048
import math
a , b , h , m = map(int,input().split())
#a , b , h , m = (3, 4, 10, 40)

hr = math.radians(360 * h / 12 + 30 * m /60)
mr = math.radians(360 * m / 60)

axy = (math.sin(hr)*a , math.cos(hr)*a)
bxy = (math.sin(mr)*b , math.cos(mr)*b)

print( math.sqrt((axy[0] - bxy[0])**2 + (axy[1] - bxy[1])**2) )


Measured memory_bytes: 9452
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<unsigned char, unsigned char> pcc;
typedef pair<double, double> pdd;
typedef vector<vector<ll>> matrix;

void handleNegative(vector<ll>& v) {
  ll ret = -2e9;
  for(ll out: v) ret = max(ret, out);
  if(ret <= 0) {
    cout << ret << "\n";
    cout << v.size()-1 << "\n";
    while(v.back() != ret) {
      cout << v.size() << "\n";
      v.pop_back();
    }
    while(v.size() != 1) {
      cout << 1 << "\n";
      v.pop_back();
    }
    exit(0);
  }
}

vector<int> op;

void cleanse(vector<ll>& v) {
  while(v.size() > 1) {
    if(v[0] < 0) {
      op.push_back(1);
      v.erase(v.begin());
      op.push_back(1);
      v.erase(v.begin());
      continue;
    }
    if(v.back() <= 0) {
      op.push_back(v.size());
      v.pop_back();
      op.push_back(v.size());
      v.pop_back();
      continue;
    }
    bool found = false;
    for(int i = 1; i+1 < v.size(); i += 2) {
      if(v[i-1] >= 0 && v[i+1] >= 0) {
        v[i-1] += v[i+1];
        v.erase(v.begin() + i + 1);
        v.erase(v.begin() + i);
        op.push_back(i+1);
        found = true;
        break;
      }
    }
    if(found) continue;
    if(v.size() == 2) {
      if(v[0] > v[1]) {
        op.push_back(2);
        v.pop_back();
      }
      else {
        op.push_back(1);
        v.erase(v.begin());
      }
      continue;
    }
    assert(v.size() >= 4);
    op.push_back(3);
    v[1] += v[3];
    v.erase(v.begin() + 2);
    v.erase(v.begin() + 2);
  }
}

void solve() {
  int n;
  cin >> n;
  vector<ll> v;
  for(int i = 0; i < n; i++) {
    int t;
    cin >> t;
    v.push_back(t);
  }
  handleNegative(v);
  ll odd = 0;
  ll even = 0;
  for(int i = 0; i < n; i++) {
    (i%2 ? odd : even) += max(0LL, v[i]);
  }
  if(odd > even) {
    v.erase(v.begin());
    op.push_back(1);
    if(v.size()%2 == 0) {
      op.push_back(v.size());
      v.pop_back();
    }
  }
  else {
    if(v.size()%2 == 0) {
      op.push_back(v.size());
      v.pop_back();
    }
  }
  cleanse(v);
  cout << v[0] << "\n";
  cout << op.size() << "\n";
  for(int out: op) cout << out << "\n";
}

void casesolve() {
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ":" << "\n";
    solve();
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  // casesolve();
}


Measured memory_bytes: 256