akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, b, e) for (int i = (int)(b); i <= (int)(e); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long i64;
typedef unsigned long long u64;
typedef long double ld;
typedef long long ll;

int n, m;
string s[10];

void no() { cout << "Impossible"; exit(0); }

int main() {
#ifdef LOCAL
//     freopen("a.in", "r", stdin);
#endif

    cin >> n >> m;
    forn(i, n) cin >> s[i];
    int x = 0, y = 0;
    if (s[0][0] != '#') no();
    s[0][0] = '.';
    while (x+1 != n || y+1 != m) {
        if (x+1 < n && s[x+1][y] == '#') {
            ++x;
        } else if (y+1 < m && s[x][y+1] == '#') {
            ++y;
        } else {
            no();
        }
        s[x][y] = '.';
    }
    forn(i, n) forn(j, m) if (s[i][j] == '#') no();
    cout << "Possible";


#ifdef LOCAL
    cerr << "Time elapsed: " << clock() / 1000 << " ms" << endl;
#endif
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // C++の入出力
#include <stdio.h> // C の入出力
#include <algorithm> // sort などのアルゴリズム
#include <string.h> // C の文字列用
#include <ctype.h> // C の文字種用
#include <string> // C++の文字列
#include <math.h>
#include <sstream>
int const Max=1000000;
using namespace std;
int main(void){
    bool sosuu[Max];
    for(int i=0;i<Max;i++)sosuu[i]=true;
    sosuu[0]=false;sosuu[1]=false;
    for(int i=2;i<Max;i++){
        if(sosuu[i]==true){
            for(int s=i+i;s<Max;s+=i){
                sosuu[s]=false;
            }
        }
    }//エラトスネス篩
    while(true){
        int syoki,plus,n;
        cin>>syoki>>plus>>n;
        if(syoki==0&&plus==0&&n==0)break;
        int cnt=0,s;
        for(s=syoki;cnt<n;s+=plus){
            if(sosuu[s]==true)cnt++;
            if(n==cnt)break;
        }
        cout<<s<<endl; 
    }
    return 0;
}

Measured memory_bytes: 2136
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>
#include <queue>
#include <regex>
#include <cassert>
#include <map>
// #include "bits/stdc++.h"

using namespace std;
//debug

#define rep(i, N, M) for (ll i = N; i < M; ++i)
#define rrep(i, N, M) for (ll i = N; i > M; --i)
#define pb push_back


typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef priority_queue<ll> pqll;
typedef priority_queue<pll, vector<pll>> pqpll;
typedef priority_queue<ll, vll, greater<ll>> pqll_greater;
typedef priority_queue<pll, vector<pll>, greater<pll>> pqpll_greater;


#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vec(a) vector<a>
#define _CRT_SECURE_NO_WARNINGS

template<class T, class S>
T atbit(T n, S i) {
	return (n >> i) % i;
}

template<class T>
T getbit(T i) {
	return 1LL << i;
}
template<class T>
T POW(T n, T m) {
	T res = 1;
	rep(i, 0, m) {
		res *= n;
	}
	return res;
}

ll power(ll x, ll y,ll mod) {
	if (y == 0)return 1;
	if (y == 1)return x % mod;
	if (y % 2 == 0)return POW(power(x, y / 2, mod), 2LL) % mod;
	return ((POW(power(x, y / 2, mod), 2LL) % mod)*(x%mod))%mod;
}
ll div(ll a,ll  b, ll mod) {
	return (a* power(b, mod - 2,mod))%mod;
}

//#define TRANSFORM(v,w,func) decltype(v) w ; transform((v).begin(),(v).end(),back_inserter(w),func);

using namespace std;

ll MOD_NUM = POW(10LL, 9LL) + 7;

int main() {
	ll N, M, X, Y;
	cin >> N >> M >> X >> Y;
	vll x(N);
	vll y(M);
	rep(i, 0, N)cin >> x[i];
	rep(i, 0, M)cin >> y[i];
	ll mn = min(Y, *min_element(all(y)));
	ll mx = max(X, *max_element(all(x)));
	if (mx < mn)cout << "No War";
	else cout << "War";


		


}


Measured memory_bytes: 256
#include <sstream>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <queue>
#include <bitset>
using namespace std;

#define int long long
#define FOR(i, a, b) for (int i = (a), _##i = (b); i <= _##i; ++i)
#define FORD(i, a, b) for (int i = (a), _##i = (b); i >= _##i; --i)
#define REP(i, a) for (int i = 0, _##i = (a); i < _##i; ++i)
#define REPD(i,n) for(int i = (n)-1; i >= 0; --i)

#define DEBUG(X) { cerr << #X << " = " << (X) << endl; }
#define PR(A, n) { cerr << #A << " = "; FOR(_, 1, n) cerr << A[_] << ' '; cerr << endl; }
#define PR0(A, n) { cerr << #A << " = "; REP(_, n) cerr << A[_] << ' '; cerr << endl; }

#define sqr(x) ((x) * (x))
#define ll long long
#define double long double
typedef pair<int, int> II;
#define __builtin_popcount __builtin_popcountll
#define SZ(x) ((int)(x).size())
#define ALL(a) (a).begin(), (a).end()
#define MS(a,x) memset(a, x, sizeof(a))
#define next ackjalscjaowjico
#define prev ajcsoua0wucckjsl
#define y1 alkscj9u20cjeijc
#define left lajcljascjljl
#define right aucouasocjolkjl
#define y0 u9cqu3jioajc

#define TWO(X) (1LL<<(X))
#define CONTAIN(S,X) ((S) & TWO(X))

int rand16() {
    return rand() & (TWO(16) - 1);
}
int my_rand() {
    return rand16() << 15 | rand16();
}

double safe_sqrt(double x) { return sqrt(max((double)0.0, x)); }
int GI(int& x) { return scanf("%lld", &x); }

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << (fixed) << setprecision(9) << boolalpha;
    int n, a, b;
    while (cin >> n >> a >> b) {
        if (a > b) {
            cout << 0 << endl;
            continue;
        }
        if (n == 1) {
            if (a == b) cout << 1 << endl;
            else cout << 0 << endl;
            continue;
        }

        int nn = (n - 2) * a;
        int ln = (n - 2) * b;
        cout << ln - nn + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n,t=gets.split
n=n.to_i



t=t.to_i


array=gets.split.map{|i| i.to_i}




jj=0
answer=0


(n-1).times{
  if    array[jj]+t<=array[jj+1]
    
      answer+=t 
    
    
  else  answer+=array[jj+1]-array[jj]
end


jj+=1
    
    
    
}

puts answer+t

Measured memory_bytes: 16004
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>
#include<cmath>





using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;


int solve(int n, const vector<int>& a, const vector<int>& b, int m) {
    vector<int> c(n);
    for (int i = 0; i < n; ++i) {
        if ((m >> i) & 1)
            c[i] = b[i];
        else c[i] = a[i];
    }
    vector<int> d(c);
    sort(d.begin(), d.end());
    vector<int> used(n, 0);
    int res = 0;
    for (int i = 0; i < n; ++i) {
        int st = (i + (m >> i)) & 1;
        int ok = 0;
        for (int j = 0; j < n; ++j) {
            if (used[j]) {
                continue;
            }
            if (((j & 1) == st) && (c[i] == d[j])) {
                ok = 1;
                used[j] = 1;
                break;
            }
            else ++res;
        }
        if (ok == 0)
            return -1;
    }
    return res;
}

int ones(int m) {
    int res = 0;
    for (int i = 0; i < 32; ++i) {
        res += (m >> i) & 1;
    }
    return res;
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
    }
    int res = -1;
    for (int m = 0; m < (1 << n); ++m) {
        int x = ones(m);
        if (x & 1)
            continue;
        int cur = solve(n, a, b, m);
        if (cur == -1)
            continue;
        if (res == -1)
            res = cur;
        else
            res = min(res, cur);        
    }
    cout << res << endl;
}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,s=0;
    cin>>n;
    n*=2;
    int ar[n];
    for(i=0;i<n;i++){
        cin>>ar[i];
    }
    sort(ar,ar+n);
    for(i=0;i<n;i+=2){
        s+=min(ar[i],ar[i+1]);
    }
    cout<<s<<endl;
}


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

using namespace std;
#define INF 1000007
#define MOD 1000000007
#define int long long
#define maxn 1e5+4
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

typedef std::pair<int, int> P;

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void) {
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++) {
        if (!prime[i]) {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i) {
            prime[j] = false;
        }
    }
}

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; }

bool IsPrime(int num) //素数判定
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
}

vector<int> divisor(int n) //約数列挙
{
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i - 1);
            if (i * i != n) {
                ret.push_back((n / i) - 1);
            }
        }
    }
    sort(ret.begin(), ret.end());
    return (ret);
}

int a, b;

void f(int x) {
    while (x) {
        a++;
        b = x;
        x /= 10;
    }
}

signed main() {
    int D, G;
    cin >> D >> G;
    vector<int> p(11),c(11);
    int ans = 1e9;
    rep(i, D) {
        cin >> p[i] >> c[i];
    }
    for (int bit = 0; bit < (1 << D); bit++) {
        int s = 0, num = 0, max_n = -1;
        for (int i = 0; i < D; i++) {
            if ((bit >> i) & 1) {
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            } else {
                max_n = i;
            }
        }
        if(s < G){
            int s1 = 100 * (max_n + 1);
            int need = (G - s + s1 - 1) / s1;
            if(need >= p[max_n]){
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n,m;
  cin>>n>>m;
  vector<int> a(m);
  rep(i,m)cin>>a[i];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  vector<int> num = {0,2,5,5,4,5,6,3,7,6};
  const int inf=1e9;
  vector<int> dp(n+1);
  dp[0]=0;
  // calc dp
  repeat(k,1,n+1) {
    dp[k]=-inf;
    rep(j,m) {
      if(k-num[a[j]]>=0) {
        dp[k]=max(dp[k],dp[k-num[a[j]]]+1);
      }
    }
  }
  // calc ans
  stringstream ss;
  int N = dp[n];
  rep(i,N) {
    rep(j,m) {
      if(n-num[a[j]]>=0&&dp[n-num[a[j]]]==dp[n]-1) {
        ss<<a[j];
        n-=num[a[j]];
        break;
      }
    }
  }
  //cout<<"n="<<n<<endl;
  cout << ss.str() << endl;
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int Q=scan.nextInt();
        while(Q-->0){
            long A = scan.nextLong();
            long B = scan.nextLong();
            long k = (A+B)/(Math.min(A,B)+1);
            if(k<=1){
                int C = scan.nextInt()-1;
                int D = scan.nextInt()-1;
                String even = (A>=B ? "A":"B");
                String odd = (A>=B ? "B":"A");
                String ans ="";
                for(int i=C;i<=D;++i){
                    if(i%2==0)ans+=even;
                    else ans+=odd;
                }
                System.out.println(ans);
                continue;
            }
            long n = (k*A-B)/(k*k-1);
            long m = (k*B-A)/(k*k-1);
            long a = A-n*k-m;
            long b = B-m*k-n;
            int C = scan.nextInt()-1;
            int D = scan.nextInt()-1;

            String ans ="";
            for(int i=C;i<=D;++i){
                if(i<n*(k+1)){
                    if((i+1)%(k+1)==0)ans+="B";
                    else ans+="A";
                }else if(i>=n*(k+1)+a+b){
                    long index=i-(n*(k+1))-a-b;
                    if(index%(k+1)==0)ans+="A";
                    else ans+="B";
                }else{
                    long index=i-n*(k+1);
                    if(index<a)ans+="A";
                    else ans+="B";
                }
            }
            System.out.println(ans);

        }
        
    }
}

Measured memory_bytes: 48816
#include <iostream>

using namespace std;

void insertionSort(int A[], int N) { // N個の要素を含む0-オリジンの配列A
    int i, j, v, l;
    for (i = 1; N > i; i++) {   //for i が 1 から N-1 まで
        v = A[i];
        j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j + 1] = v;
        cout << A[0];
        for(l =1; l < N; l++){
            cout << " " << A[l];
        }
        cout << endl;
    }
}

int bubbleSort(int A[], int N) { // N 個の要素を含む 0-オリジンの配列 A
    int j, l, t, c=0;
    int flag = 1; // 逆の隣接要素が存在する
    while (flag) {
        flag = 0;
        for(j = N-1; j > 0; j--) {
            if(A[j] < A[j-1]) {
                t = A[j];
                A[j] = A[j-1];
                A[j-1] = t;
                flag = 1;
                c++;
            }
        }
    }
    return c;
}

int selectionSort(int A[], int N) { // N個の要素を含む0-オリジンの配列A
    int i, j, t, minj, c = 0;
    for (i = 0; i < N; i++) {
        minj = i;
        for (j = i; j < N; j++) {
            if (A[j] < A[minj]) {
                minj = j;
            }
        }
        if (i != minj) {
            t = A[i];
            A[i] = A[minj];
            A[minj] = t;
            c++;
        }
//        cout << A[i] << " " << A[minj] << endl;
    }
    return c;
}
int main() {
    int A[110];
    int i, l, N, t, f, flg=1, c;
    
    cin >> N;
    for(i =0; i < N; i++){
        cin >> A[i];
    }
/*
    cout << A[0];
    for(i =1; i < N; i++){
        cout << " " << A[i];
    }
    cout << endl;
*/
//    insertionSort(A, N);
//    c = bubbleSort(A, N);
    c = selectionSort(A, N);
    cout << A[0];
    for(i =1; i < N; i++){
        cout << " " << A[i];
    }
    cout << endl;
    cout << c << endl;
    return 0;
}



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

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> ships(n + 1);
    // vector<int> ships(n);
    for(int tsumugi = 0; tsumugi < m; tsumugi++){
        int ta, tb;
        cin >> ta >> tb;
        ships[ta].push_back(tb);
        ships[tb].push_back(ta);
    }

    //Nから戻っていく
    for(int karen = 0; karen < ships[n].size(); karen++){
        int relay = ships[n][karen];
        for(int matsuri = 0; matsuri < ships[relay].size(); matsuri++){
            if(ships[relay][matsuri] == 1){
                cout << "POSSIBLE" << endl;
                return 0;
            }
        }
    }

    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 12016
#include<bits/stdc++.h>
using namespace std;
bool palin(string s, int l,int h){
  for(int i = l; i<=h; i++){
    if(s[i] != s[l+h-i])return false;
  }
  return true;
}
int main(){
  string s;
  cin>>s;
  int n = s.length();
  if(palin(s,0,n-1)&&palin(s,0,(n-3)/2)&&palin(s,(n+1)/2,n-1))cout<<"Yes";
  else cout<<"No";
  return 0;
}
  

Measured memory_bytes: 256
#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) 1e9;

int main() {
    ll N, K, S;
    cin >> N >> K >> S;
    vector<ll> v;
    REP(i, K) {
        v.push_back(S);
    }

    while (v.size() < N) {
        ll p = INF;
        if (S == p)
            p--;
        v.push_back(p);
    }
    REP(i, N) {
        cout << v[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2292
#include <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
using namespace std;
int main(){
	int dp[31],n;
	dp[1]=1;dp[2]=2;dp[3]=4;
	r(i,4,31)dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
	while(cin>>n,n){
		n=dp[n]/3650;
		if(!n)n=1;
		else n++;
		cout<<n<<endl;
	}
}

Measured memory_bytes: 3000
import java.util.*;
import java.lang.*;
  
public class Main{
  public static void main(String[] args){
    Scanner stdIn=new Scanner(System.in);
    int a=stdIn.nextInt(), b=stdIn.nextInt();
    if (a<b){
      System.out.println("a < b");
    }else if (a==b){
	System.out.println("a == b");
    }else{
	System.out.println("a > b");
    }
    
  }
}



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

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


Measured memory_bytes: 256
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define allof(a) (a).begin(),(a).end()
using lint = long long;
template< typename T > using Vec = vector< T >;

template< typename T > bool inRange(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool inRange(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }
template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }
inline int bitCount(int x) { return __builtin_popcount(x); }
inline int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//



int main() {
	string S;
	cin >> S;
	int cnt = 15 - S.size();
	for (char c : S) if (c == 'o') ++cnt;
	puts(cnt >= 8 ? "YES" : "NO");
}
//--------------8---------------->> coding space <<-----------------8-------------//

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

long long a, b, c;

int main() {
  cin>>a>>b>>c;
  //binomial squared
  if((c-a-b)>0 && (c-a-b)*(c-a-b)>4*a*b){
    cout<<"Yes\n";
  }
  else{
    cout<<"No\n";
  }
}

Measured memory_bytes: 256
// Author := Abhishek Giri

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define V(type) vector<(type)>
#define all(c) ((c).begin(),(c).end())
#define in(var) cin>>(var)
#define out(var) cout<<(var)
#define on(var) cout<<var<<"\n"
#define f(i,n) for(ll i = 0 ; i < n ;i++)
#define mfor(i,init,n,b) for(ll i = (init) ; i < (n) ; i+= (b))
#define cfor(i,c) for(auto i = (c).begin() ; i!= (c).end(); i++)
#define el "\n"

/*##################################################################################*/


int prime[1000000] ;
vector < int > pr;
void calculateprime()
{
    prime[0] = prime[1] = 1 ;
    for(int i = 2 ; i <= 1000000 ; i++)
    {
        if(prime[i] == 0)
        {
            pr.pb(i);
            for(ll j = i*2 ; j <= 1000000 ; j += i )
            {
                prime[j] = 1 ;
            }
        }
    }
}

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

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

bool isprime(ll n)
{
    for(ll i = 2 ; (ll) i*i <= n ; i++)
    {
        if(n % i == 0){
            return false;
        }
    }
    return true;
}

ll fib(int n)
{
    ll a = 0, b = 1, c, i;
    if( n == 0)
        return a;
    for (i = 2; i <= n; i++)
    {
        c = (a + b);
        a = b;
        b = c;
    }
    return b;
}


ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll extendedgcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = extendedgcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

ll findgrouplcm(vector<int> &arr, int n)
{
    ll ans = arr[0];

    for (ll i = 1; i < n; i++)
        ans = (arr[i] * (ans/(gcd(arr[i], ans))));

    return ans;
}


ll powerwithmod(ll x, unsigned ll y, ll p)
{
    ll res = 1;

    x = x % p;

    if (x == 0) return 0;

    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;

        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}


bool comp(const pair<long long,ll> &a , const pair<ll ,ll > &b){
    if(a.first == b.first)  return a.second < b.second;
    return a.first > b.first;

    return false;
}

void solve();

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

    return 0;
}


void solve(){
    int l,r,d;
    in(l)>>r>>d;
    
    if(l % d == 0){
        cout<<(r/d) - (l/d) + 1;
    }
    else{
        cout<<(r/d) - (l/d + 1) + 1; 
    }
    
}


Measured memory_bytes: 3640
sx, sy, tx, ty = map(int,input().split())

print("U"*(ty-sy)+"R"*(tx-sx)+"D"*(ty-sy)+"L"*(tx-sx)+"L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"+"R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U")



Measured memory_bytes: 3060
#include <iostream>

int main() {

	int x, y;

	std::cin >> x >> y;
	if (y > x) {
		std::swap(x, y);
	}

	while (x && y) {
		int r = x % y;
		std::swap(x, y);
		std::swap(y, r);
	}
	std::cout << x << std::endl;

	return 0;
}

Measured memory_bytes: 3088
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

    vector<long long> dp(21, 0);
    dp[a[0]] = 1;
    for(int i=1; i<n-1; ++i){
        vector<long long> nextDp(21, 0);
        for(int j=0; j<=20; ++j){
            if(j-a[i] >= 0)
                nextDp[j-a[i]] += dp[j];
            if(j+a[i] <= 20)
                nextDp[j+a[i]] += dp[j];
        }
        dp.swap(nextDp);
    }
    cout << dp[a[n-1]] << endl;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int n,m;
ll t[N<<2],lz[N<<2];
vector<pair<int,int> >v[N];
void build(int l,int r,int k)
{
    t[k]=lz[k]=1e18;
    if(l==r&&l==1) t[k]=0;
    if(l==r) return;
    int m=l+r>>1;
    build(l,m,k<<1);build(m+1,r,k<<1|1);
}
void update(int l,int r,int k)
{
    if(l==r) return;
    t[k<<1]=min(t[k<<1],lz[k]);
    t[k<<1|1]=min(t[k<<1|1],lz[k]);
    lz[k<<1]=min(lz[k<<1],lz[k]);
    lz[k<<1|1]=min(lz[k<<1|1],lz[k]);
    lz[k]=1e18;
}
ll query(int l,int r,int k,int x)
{
    update(l,r,k);
    if(l==r) return t[k];
    int m=l+r>>1;
    if(x<=m) return query(l,m,k<<1,x);
    else return query(m+1,r,k<<1|1,x);
}
void fix(int l,int r,int k,int x,int y,ll v)
{
    if(r<x||l>y) return;
    update(l,r,k);
    if(l>=x&&r<=y)
    {
        t[k]=min(t[k],v);lz[k]=min(lz[k],v);update(l,r,k);return;
    }
    int m=l+r>>1;
    fix(l,m,k<<1,x,y,v);fix(m+1,r,k<<1|1,x,y,v);
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        int l,r,c;
        scanf("%d%d%d",&l,&r,&c);
        v[l].push_back({r,c});
    }
    build(1,n,1);
    for(int i=1;i<=n;i++)
    {
        ll mn=query(1,n,1,i);
        for(int j=0;j<v[i].size();j++)
            fix(1,n,1,i,v[i][j].first,mn+v[i][j].second);
    }
    ll ans=query(1,n,1,n);
    if(ans==1e18) ans=-1;
    printf("%lld\n",ans);
}


Measured memory_bytes: 11520
def main():
    from builtins import int, map, list, float, print, len, min
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    t = 753
    N = input()
    ans = float('inf')
    for i in range(len(N)-2):
        m = int(N[i:i+3])
        ans = min(ans,abs(t-m))
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    vector<int> odd(100010),even(100010);
    int v,maxo=0,maxe=0;
    rep(i,n){
        cin>>v;
        if(i%2==0) odd[v]++;
        else even[v]++;
    }
    int e=0,o=0;
    rep(i,100001){
        if(maxo<=odd[i]){
            maxo=odd[i];
            o=i;
        }
        if(maxe<=even[i]){
            maxe=even[i];
            e=i;
        }
    }
    if(e!=o) cout<<(n/2-maxo)+(n/2-maxe);
    else{
        int t=odd[o],tmpo=maxo,tmpe=maxe;
        maxo=0,maxe=0;
        odd[o]=0;//2番目に多いやつで奇数番書き換え
        rep(i,100001) 
            if(maxo<=odd[i]) maxo=odd[i];
        int ans1=(n/2-maxo)+(n/2-tmpe);
        maxo=0,maxe=0;
        odd[o]=t,even[e]=0;//2番目に多いやつで偶数番書き換え
        rep(i,100001)
            if(maxe<=even[i]) maxe=even[i];
        int ans2=(n/2-tmpo)+(n/2-maxe);
        cout<<min(ans1,ans2);
    }
}

Measured memory_bytes: 4032
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod ll(1e9+7)
#define inf ll(1e9)
int main()
{
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
  #endif
   int n,m;
   cin>>n>>m;
   map<int,int>rel;
   for(int i=0; i<m; i++){
    int num;
    cin>>num;
    rel[num]=1;
   }
   vector<ll>dp(n+1);
   dp[0]=1;
   for(int i=1; i<=n; i++){
    if(rel.count(i))
      dp[i]=0;
    else{
      dp[i]=dp[i-1];
      if(i>=2)
        dp[i]=(dp[i]+dp[i-2])%mod;
    }
   }
   cout<<dp[n];
   return 0;

   
   
}

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

using namespace std;

#ifdef ACMTUYO
struct RTC{~RTC(){cerr << "Time: " << clock() * 1.0 / CLOCKS_PER_SEC <<" seconds\n";}} runtimecount;
#define DBG(X) cerr << #X << " = " << X << '\n';
#else
struct RTC{};
#define DBG(X)
#endif

#define fast_io() ios_base::sync_with_stdio(false)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define sz(x) ((int)(x).size())
#define all(c) (c).begin(),(c).end()
#define forn(i, n) for (int i = 0; i < (n); i++)
typedef long long int number;
const int maxn = 5010;
char s[maxn];
int main() {
  //set<string> ms;
  int k, n;
  scanf("%s %d", s, &k);
  n = strlen(s);
  /*forn (i, n) {
    string ss;
    for (int j = i; j < n; j++) {
      ss.pb(s[j]);
      ms.insert(ss);
      while (sz(ms) > k) {
        auto it = ms.end();
        it--;
        ms.erase(it);
      }
    }
  }
  auto it = ms.end();
  it--;
  printf("%s\n", (*it).c_str());*/
  vector<string> vec;
  forn (i, n) {
    vec.pb(string(s + i, s + n));
  }
  sort(all(vec));
  set<string> ms;
  forn (i, n) {
    string ss = "";
    forn (j, sz(vec[i])) {
      ss.pb(vec[i][j]);
      ms.insert(ss);
      if (sz(ms) == k) {
        auto it = ms.end();
        it--;
        printf("%s\n", (*it).c_str());
        return 0;
      }
    }
  }
  return 0;
}


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

using namespace std;

int main() {                            
	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];
	sort(begin(a), end(a));
  string s = to_string(a[2]) + to_string(a[1]);
  int ans = stoi(s) + a[0];
  cout << ans;			 
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int N,W;
	cin >> N >> W;
	int val[110],weight[10010];
	for (int i=0;i<N;i++) {
		cin >> val[i] >> weight[i];
	}
	int res[110][10010];
	//res[number][weight]
	for (int i=0;i<N+1;i++) {
		res[i][0] = 0;
	}
	for (int i=0;i<W+1;i++) {
		res[0][i] = 0;
	}

	for(int i=1;i<N+1;i++) {
		for(int j=1;j<W+1;j++) {

			if (weight[i-1] > j) {

				res[i][j] = res[i-1][j];

			} else {

				res[i][j] = max((val[i-1]+res[i-1][j-weight[i-1]]),res[i-1][j]);
			}
		}
	}
	//for(int j=1;j<W+1;j++) {
	//	cout << endl;
	//	for(int i=1;i<N+1;i++) {
	//		cout << res[i][j] << " ";
	//	}
	//}


	cout << res[N][W] << endl;
}

Measured memory_bytes: 7064
let n,x,y=read_int(),ref 0,ref 0;;for _=1to n do Scanf.scanf"%s %s
"(fun a b->if a=b then(incr x;incr y)else if a<b then y:=!y+3else x:=!x+3)
done;Printf.printf"%d %d
"!x !y

Measured memory_bytes: 2720
use std::collections::HashMap;

macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(usize);
    let a = get!(i64 ;;);

    let mut s: Vec<i64> = vec![0; n+5];

    for i in 0..n {
        s[i+1] = s[i]+a[i];
    }

    let mut mp: HashMap<i64, usize> = HashMap::new();
    let mut ans: usize = 0;

    for i in 0..n+1 {
        match mp.get(&s[i]) {
            Some(cnt) => {
                ans += cnt;
                mp.insert(s[i], cnt+1);
            },
            None => {
                mp.insert(s[i], 1);
            }
        }
    }

    println!("{}", ans);
}

Measured memory_bytes: 13816
#include <iostream>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef pair<ld, int> P;
struct edge{
    int to;
    ld cost;
    edge(int a, ld b){
        to=a;
        cost=b;
    }
};
struct D{
    vector<edge> G[1002];
    ld d[1002],INF=1e18;

    void AddEdge(int from, int to, ld cost){
        G[from].push_back(edge(to, cost));
    }

    void dijkstra(int n, int s){
        priority_queue<P, vector<P>, greater<P> > q;
        fill(d,d+n+1,INF);
        d[s]=0;
        q.push(P(0,s));
        while(!q.empty()){
            P p=q.top();
            q.pop();
            int v=p.second;
            if(d[v]<p.first)continue;
            for(int i=0;i<G[v].size();i++){
                edge e=G[v][i];
                if(d[e.to]>d[v]+e.cost){
                    d[e.to]=d[v]+e.cost;
                    q.push(P(d[e.to],e.to));
                }
            }
        }
    }
};


int main(void){
    int n;
    ld x[1002],y[1002],r[1002];
    D d;
    r[0]=r[1]=0;
    cin>>x[0]>>y[0]>>x[1]>>y[1]>>n;
    for(int i=2;i<n+2;i++){
        cin>>x[i]>>y[i]>>r[i];
    }
    for(int i=0;i<n+2;i++){
        d.AddEdge(i, i, (ld)0);
        for(int j=i+1;j<n+2;j++){
            ld t=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
            ld u=max((ld)0, t-r[i]-r[j]);
            d.AddEdge(i, j, u);
            d.AddEdge(j, i, u);
        }
    }
    d.dijkstra(n+2, 0);
    cout<<setprecision(20)<<d.d[1]<<endl;
}


Measured memory_bytes: 41836
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
namespace Program
{
    using namespace std;
    class Solver
    {
    private:
        int H;
        int W;
        vector<string> C;
    public:
        Solver()
        {
            cin.tie(0);
            ios::sync_with_stdio(false);

            cin >> H >> W;
        }
        void Solve()
        {
            C.resize(H);

            for (int i = 0; i < H; i++)
            {
                cin >> C[i];
            }

            for (int i = 0; i < H; i++)
            {
                cout << C[i] << endl;
                cout << C[i] << endl;
            }
        }
    };
}

int main()
{
    // メンバ関数ポインタ取得
    void (Program::Solver::*pSolve)() = &Program::Solver::Solve;

    // コンストラクタ呼び出し
    Program::Solver obj;

    // .*演算子でアクセス
    (obj.*pSolve)();
    return 0;
}


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

int main(){
  string s, t;
  cin >> s >> t;
  s += '#';
  t += '$';
  int n = sz(s), m = sz(t);
  vector<vector<int>> dp(n+2,vector<int>(m+2,0));

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
      dp[i][j+1] = max(dp[i][j+1], dp[i][j]);
      if (s[i] == t[j]) dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1);
    }
  }
  string res;
  int i = n-1, j = m-1;
  while (i + j) {
    int x = dp[i][j];
    if (i && dp[i-1][j] == x) {
      i--;
    } else if (j && dp[i][j-1] == x) {
      j--;
    } else {
      i--; j--;
      res += s[i];
    }
  }
  reverse(res.begin(), res.end());
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll n;
 cin>>n;
 map<ll,ll> cnt;
 for(ll x=1;x<=100;x++)
  for(ll y=1;y<=100;y++)
   for(ll z=1;z<=100;z++){
    ll val = x*x + y*y + z*z + x*y + y*z + z*x;
    if( val <= 10000 ){
     cnt[val]++;
    }else break;
   }
 for(ll i=1;i<=n;i++)cout<<cnt[i]<<endl;
    return 0;
}


Measured memory_bytes: 4204
import java.util.Scanner;


public class Main {
    public static void main(String[] args){
        
        class Dice {
            private int[] surface = new int[6];

            public void setNum(int index, int num){
                this.surface[index] = num;
            }

            public int getNum(int index){
                return this.surface[index];
            }

            public void move(String vector){
                int sub = 0;
                if(vector.equals("E")){
                    sub = this.surface[0];
                    this.surface[0] = this.surface[3];
                    this.surface[3] = this.surface[5];
                    this.surface[5] = this.surface[2];
                    this.surface[2] = sub;

                }else if(vector.equals("W")){
                    sub = this.surface[0];
                    this.surface[0] = this.surface[2];
                    this.surface[2] = this.surface[5];
                    this.surface[5] = this.surface[3];
                    this.surface[3] = sub;

                }else if(vector.equals("N")){
                    sub = this.surface[0];
                    this.surface[0] = this.surface[1];
                    this.surface[1] = this.surface[5];
                    this.surface[5] = this.surface[4];
                    this.surface[4] = sub;
                }else if(vector.equals("S")){
                    sub = this.surface[0];
                    this.surface[0] = this.surface[4];
                    this.surface[4] = this.surface[5];
                    this.surface[5] = this.surface[1];
                    this.surface[1] = sub;
                }
            }
        }
        
        Scanner scanner = new Scanner(System.in);
        Dice dice = new Dice();

        for(int i = 0; i < 6; i++){
            dice.setNum(i, scanner.nextInt());
        }

        String command = scanner.next();
        for(String cmd : command.split("")){
            dice.move(cmd);
        }

        System.out.println(dice.getNum(0));

        scanner.close();
    }
}




Measured memory_bytes: 26344
import java.util.Scanner;
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String result = "NO";
		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();
		if((100*r+10*g+b)%4==0) result = "YES";
		System.out.println(result);
				
	}
}

Measured memory_bytes: 20948
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);

int main(){
    IOS;
    ll l;cin>>l;
    if(l%3==0){
        cout<<fixed<<setprecision(12)<<(l/3)*(l/3)*(l/3);
    }
    else if(l%3==1){
        ld a=(ld)1/3;
        cout<<fixed<<setprecision(12)<<(l/3+a)*(l/3+a)*(l/3+a);
    }
    else {
        ld a=(ld)2/3;
        cout<<fixed<<setprecision(12)<<(l/3+a)*(l/3+a)*(l/3+a);
    }
    return 0;  
} 





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int X; cin >> X;
	if (X >= 30)cout << "Yes" << "\n";
	else cout << "No" << "\n";

	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<map>
#include<math.h>
#include<queue>
using namespace std;

int main() {
	int n;
	int m = 0;
	int maxi;
	cin >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
		b.at(i) = a.at(i);
		if (m < a.at(i)) {
			m = a.at(i);
			maxi = i;
		}
	}
	sort(b.begin(), b.end(), greater<>());
	for (int i = 0; i < n; i++) {
		if (i != maxi)cout << m << endl;
		else if (i == maxi)cout << b.at(1) << endl;
	}

	return 0;

	
}

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

using PP = pair<long, long>;
int n;
long a, b;
unordered_map<long, vector<PP>> mp;

int main() {
  cin >> n >> b >> a;
  if (a < 0) {
    a = -a;
    b = -b;
  }
  
  long mn = 0;
  long mx = 0;
  for (int i = 0; i <= n; ++i) {
    long k = a == 0 ? 0 : b * i % a;
    mp[k].push_back(PP(mn, mx));
    mn += a * i + b;
    mx += a * (n - 1 - i) + b;
  }
  
  long sum = 0;
  for (auto&& q : mp) {
    vector<PP> ps = q.second;
    sort(ps.begin(), ps.end());
    
    vector<PP> nps;
    const long inf = 1e18;
    long pl = -inf;
    long pr = -inf;
    for (PP p : ps) {
      if (p.second <= pr) continue;
      if (p.first > pr) {
        if (pr > -inf) nps.push_back(PP(pl, pr));
        pl = p.first;
      }
      pr = p.second;
    }
    nps.push_back(PP(pl, pr));
    
    for (PP p : nps) {
      long l = p.first;
      long r = p.second;
      sum += a == 0 ? 1 : (r - l) / a + 1;
    }
  }
  cout << sum << endl;
}

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

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


Measured memory_bytes: 13268
#include <iostream>
#include <math.h>

using namespace std;

int main() {

	int n;
	cin >> n;

	for (int i = 1; i <= n;i++) {

		if (i % 3 == 0) {
			cout << " " << i;
		}
		else {
			
			for (int j = 0; j < 4;j++) {

				int n;
				int m;

				n = pow(10, j + 1);
				m = n / 10;

				if (j == 0 && i % n == 3) {
					cout << " " << i;
					break;
				}else if (j != 0 && (i % n) / m == 3) {
					cout << " " << i;
					break;
				}
			}

		}
	}

	cout << endl;

	//cin >> /*変数他*/;
	//cout << /*文字列*/ << endl;
	return 0;
}


Measured memory_bytes: 3220
// Coached by Dukkha
#include <algorithm>
#include <iostream>
#include <cmath>

using namespace std;

const double PI = acos(-1);

int main() {
	int a, b, h, m; cin >> a >> b >> h >> m;
	printf("%.9f\n", sqrt(a * a + b * b - 2 * a * b * cos(2 * PI * m / 60 - 2 * PI * (h * 60 + m) / (12 * 60))));
	return 0;
}


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

#define ff first
#define ss second
#define it(a, x) for (auto &a : x)
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpii vector<pii>
#define vs vector<string>
#define gi greater<int>
#define vc vector<char>
#define vvi vector<vi>
#define vvc vector<vc>
#define mii map<int, int>
#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 mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define deb(x) cout << #x << "=" << x << endl;
#define in(i, n) for (auto i = 0; i < n; i++)
#define all(x) begin(x), end(x)
//mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());//random shuffler

ll fxp(ll a, ll b) {
    if (b == 0) return 1;
    if (b % 2 == 0) {
        ll c = fxp(a, b / 2);
        return (c * c) % mod;
    }
    return (a * fxp(a, b - 1)) % mod;
}

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
}

void solve() {
    int n;
    cin >> n;
    vi a(n), b(n);
    in(i, n) {
        int x, y;
        cin >> x >> y;
        a[i] = x + y;
        b[i] = x - y;
    }
    int mx1 = *max_element(all(a));
    int mn1 = *min_element(all(a));
    int mx2 = *max_element(all(b));
    int mn2 = *min_element(all(b));
    int ans = max(mx1 - mn1, mx2 - mn2);
    cout << ans;
}

int main(int argc, char const *argv[]) {
    c_p_c();
    solve();
    return 0;
}


Measured memory_bytes: 4768
#include<bits/stdc++.h>
#define N 101000
using namespace std;
int Deg[N],Q[N],l,r,n,m,D[N],res,a,b;
vector<int> E[N];
int main()
{
	cin>>n>>m;
	for (int i=0;i<m;i++) cin>>a>>b,E[a].push_back(b),Deg[b]++;
	for (int i=1;i<=n;i++) if (!Deg[i]) Q[++r]=i;
	while (l<r)
	{
		int x=Q[++l];
		res=max(res,D[x]);
		for (auto &y : E[x])
		{
			Deg[y]--;
			D[y]=max(D[y], D[x] + 1);
			if (!Deg[y]) Q[++r] = y;
		}
	}
	cout<<res;
}

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

using namespace std;

using ll = long long int;
using vi = vector<int>;
#define f(n) for(int i = 0; i < n; i++)
#define fj(n) for(int j = 0; j < n; j++)
#define fk(n) for(int k = 0; k < n; k++)
#define ci(n) cin >> n;
#define ic(n) int n; cin >> n;
#define lc(n) int n; cin >> n;
#define all(a) a.begin(), a.end()
#define pri(a, n) for(int i = 0; i < n; i++) cout << a[i] << " "; cout << "\n";
#define sc(a, n) int a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];
#define scl(a, n) ll a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];
#define pb push_back
#define eb emplace_back
#define int long long
const int inf = 2e9, maxn = 200000;

void solve(int ci)
{
    string ans[10];
    ans[2] = ans[4] = ans[5] = ans[7] = ans[9] = "hon";
    ans[0] = ans[1] = ans[6] = ans[8] = "pon";
    ans[3] = "bon";
    ic(n)
    cout << ans[n % 10];
}

main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
    f(t) solve(i + 1);
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);


int N;
int A[100000];
int main() {
	cin >> N;
	rep(i, N) cin >> A[i];
	rep(i, N) A[i]--;

	int ret = 0;
	for(int i = 0; i < N-1; i++){
		if(A[i] == i && A[i+1] == i+1){
			swap(A[i], A[i+1]);
			ret++;
		}
	}
	rep(i, N){
		if(A[i] == i) ret++;
	}
	cout << ret << endl;
}

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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007

signed main()
{
	init();
	solve();
}

vector<int> a(3);

void init()
{
	rep(i, 3) cin >> a[i];
}

void solve()
{
	UNIQUE(a);
	cout << a.size() << endl;
}



Measured memory_bytes: 256