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

#define Bye return 0
const int MAX = 1e3+1;
const int INFO = 1e9;

int mat[MAX][MAX];
int dij[MAX][MAX];
int h, w, ch, cw, dh, dw;

int dr[] = {-1, +1, 0, 0};
int dc[] = {0, 0, -1, +1};

bool marked[MAX][MAX];
deque<int> rq, cq;

void init_dijsktra(){
    for (int i=0; i<h; i++)
        for (int j=0; j<w; j++) dij[i][j] = INT_MAX;
}

bool found(int i, int j){
    return (i == dh && j == dw);
}

bool isOutOfRange(int i, int j){
    return (i<0 || j<0 || i>=h || j>=w || mat[i][j] == 1);
}

void explore_neighbours(int r, int c){

     for (int i=0; i<4; i++){
        int rr = r + dr[i];
        int cc = c + dc[i];

        if(isOutOfRange(rr, cc)) continue;

        if(dij[rr][cc]>dij[r][c]){
            dij[rr][cc] = dij[r][c];
            rq.push_front(rr);
            cq.push_front(cc);
        }
    }
}

void magic(int r, int c){

    for (int i = r - 2; i<=r+2; i++){
        for (int j = c - 2; j<=c+2; j++){

            if(isOutOfRange(i, j)) continue;

            if(dij[i][j]>=dij[r][c] + 1){
                dij[i][j] = dij[r][c] + 1;
                rq.push_back(i);
                cq.push_back(j);
            }
        }
    }
}

int bfs(int i, int j){
    
    init_dijsktra();

    rq.push_front(i); cq.push_front(j);

    dij[i][j] = 0;

    while (!rq.empty()){
        int r = rq.front(); rq.pop_front();
        int c = cq.front(); cq.pop_front();

        if(found(r, c))
            return dij[r][c];

        explore_neighbours(r, c);
        magic(r, c);
    }

    return -1;
}


void solve(){
    cin>>h>>w;
    cin>>ch>>cw; ch--, cw--;
    cin>>dh>>dw; dh--, dw--;

    for (int i=0; i<h; i++){
        for (int j=0; j<w; j++){
            char c; cin>>c;
            mat[i][j] = (c == '.') ? 0 : 1;
        }
    }

    cout<<bfs(ch, cw)<<endl;
}

int main()
{
    solve();
    Bye;
}


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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << a*b/2 << endl;
    

    return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
typedef long long ll;
int n;
void dfs(string s, char mx){
    if(s.size() == n)cout << s << endl;
    else for(char c = 'a'; c <= mx; c++) dfs(s + c, ((c == mx)? (char)(mx + 1) : mx));
}
int main(){
    cin >> n;
    dfs("", 'a');
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<ll> t(n);
  rep(i, n) cin >> t.at(i);
  ll ans = t.front();
  rep2(i, 1, n){
    ll g = __gcd(ans, t.at(i));
    ans = ans / g * t.at(i);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N, W;
    cin >> N >> W;
    int v[N], w[N];
    rep(i, N) cin >> v[i] >> w[i];
    int dp[W+1];
    fill(dp, dp+W+1, 0);
    rep(i, N){
        rep3(j, W, 0){
            if(j+w[i] > W) continue;
            chmax(dp[j+w[i]], dp[j]+v[i]);
        }
    }
    cout << dp[W] << endl;
}


Measured memory_bytes: 3124
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    set<pair<ll,pair<ll,ll>>> st;

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll n,i,j,k,x,z;
            cin>>n>>k;
            ll ar[n+1],ar2[n+1],ans=0;

            for(i=1;i<=n;++i)
            {
                cin>>ar[i];
            }
            for(i=1;i<=n;++i)
            {
                cin>>ar2[i];
            }
            sort(ar+1,ar+n+1);
            sort(ar2+1,ar2+n+1);
            ll l=0,r=1e18,mid;
            while(l<=r)
            {
                mid=(l+r)/2;
                z=0;

                for(i=1;i<=n;++i)
                {
                    x=ar[i]*ar2[n+1-i];
                    if(x<mid)
                        continue;
                   // cout<<mid<<" "<<x<<" "<<z<<" "<<ar[i]<<" "<<ar2[n-i+1]<<endl;
                    z=z+((x-mid)+ar2[n+1-i]-1)/(ar2[n+1-i]);

                    //cout<<mid<<" "<<x<<" "<<z<<endl;
                }
                if(k>=z)
                {
                    ans=mid;
                    r=mid-1;
                }
                else
                    l=mid+1;
            }
            cout<<ans<<endl;
        }
        return 0;
    }


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin >> n;
	int p[n]; rep(i,n) cin >> p[i];
	pair<int, int> pp[n]; rep(i,n) pp[i] = {p[i], i};
	sort(pp, pp + n);
	reverse(pp, pp + n);
	multiset<int64_t> v;
	v.insert(-1);
	v.insert(-1);
	v.insert(n);
	v.insert(n);
	int64_t ans = 0;
	for(int i = 0; i < n; ++i) {
		if(i == 0) {
			v.insert(pp[i].second);
			continue;
		}
		int64_t idx = pp[i].second;
		v.insert(idx);
		auto itr = v.find(idx);
		int64_t r1 = *next(itr);
		int64_t r2 = *next(next(itr));
		int64_t l1 = *prev(itr);
		int64_t l2 = *prev(prev(itr));
		int64_t rr = (r2 - r1) * (idx - l1);
		int64_t ll = (l1 - l2) * (r1 - idx);
		// cerr << pp[i].first << endl;
		// cerr << l1 << " " << l2 <<endl;
		// cerr << r1 << " " << r2 <<endl;
		// cerr << ll << " " << rr << endl;
		ans += pp[i].first * (ll + rr);
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
    int n,k;
    cin>>n>>k;
    int a[n],dp[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        dp[i]=1e9;
    }
    dp[0]=0;
    for(int i=1; i<n; i++)
    {
        for(int j=1; j<=k; j++)
            if(i-j>=0) dp[i]=min(dp[i],dp[i-j]+abs(a[i-j]-a[i]));
    }
    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
int n,i,ans=0;
char a[100],b[100],c[100];
scanf("%d%s%s%s",&n,a,b,c);
for(i=0;i<n;i++){
if(a[i]==b[i]&&b[i]==c[i]){}
else if(a[i]==b[i]||b[i]==c[i]||c[i]==a[i]) ans++;
else ans+=2;
}
printf("%d",ans);
}

Measured memory_bytes: 128
using System;
using System.Linq;
 
class Program {
  static void Main() {
    string s = Console.ReadLine();
    string ans = "";
    foreach (var t in s){
      if(t == '0'||t == '1') ans += t;
      else {
        if(ans == "") continue;
        else ans = ans.Substring(0, ans.Length - 1);
      }
    }
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 11092
n = int(input())
h = [int(i) for i in input().split()]
a = []
t = 0
for i in range(n):
  if i == 0:
    a.append(0)
  else:
    if h[i] <= h[i-1]:
      t += 1
    else:
      t = 0
    a.append(t)
print(max(a))


Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
#define show(x) cout << #x << " : " << x << endl;
const int M = 2e5+1;
int a[M], a2[M];
int main ()
{
 int n, i;
 cin >> n;
 for(i = 1; i <= n; i++) 
 {
   cin >> a[i];
   a2[i] = a[i];
 }
 sort(a + 1, a + n + 1);
 for(i = 1; i <= n; i++)
 {
   if(a2[i] < a[n]) cout << a[n] << endl;
   else if(a2[i] == a[n]) cout << a[n-1] << endl;
 }
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define bye return 0
#define Yes cout << "Yes" << "\n"
#define No  cout << "No" << "\n"
#define YES cout << "YES" << "\n"
#define NO cout << "NO" << "\n"
#define endl cout << "\n"
using namespace std;
int main(){
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> v;
    set<int> s;
    int t, a, b, c, cnt=0;
    double d, d1, d2;
    vector<string> s1 = {"ABC"};
    string s2;
    cin >> s2;
    s1.push_back(s2);
    for(int i=0; i<s1.size(); ++i){
    	cout << s1[i];
    }
    endl;
    
    bye;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main() {
    int length, j, count1=0, count2=0;
    char input[100000], endstr[1];

    scanf("%s", input);
    // printf("%s\n", input);

    for(length=0; input[length]!='\0'; ++length);
    // printf("%d\n", length);

    char restr1[length], restr2[length];

    endstr[0] = '1';

    for(j=0; j<length; j++) {
        if(endstr[0]=='1') {
            restr1[j] = '0';
            endstr[0] = '0';
        } else {
            restr1[j] = '1';
            endstr[0] = '1';
        }
    }

    endstr[0] = '0';

    for(j=0; j<length; j++) {
        if(endstr[0]=='1') {
            restr2[j] = '0';
            endstr[0] = '0';
        } else {
            restr2[j] = '1';
            endstr[0] = '1';
        }
    }

    // printf("%s\n%s\n", restr1, restr2);

    for(j=0; j<length; j++) {
        if(restr1[j]!=input[j]) {
            count1 += 1;
        }
        if(restr2[j]!=input[j]) {
            count2 += 1;
        }
    }

    if(count1 < count2) {
        printf("%d\n", count1);
    } else {
        printf("%d\n", count2);
    }

    return 0;
}

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

int main()
{
	int n, k, m;
	while (cin >> n >> k >> m, n || k || m) {
		vector<int> val(n);
		for (int i = 1; i <= n; i++) {
			val[i - 1] = i;
		}
		int now = m - 1;
		while (val.size() > 1) {
			val.erase(val.begin() + now);
			now = (now + k - 1) % val.size();
		}
		cout << val[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 3172
N = gets.to_i
h = gets.chomp.split.map(&:to_i)

max_h = h.max
ans = 0
(1..max_h).each do |cur|
  N.times do |i|
    ans += 1 if (i == 0 and h[i] >= cur) or (h[i - 1] < cur and h[i] >= cur)
  end
end

puts ans

Measured memory_bytes: 1788
da, db, dc = 0, 0, 0

N = int(input())
for i in range(N):
    a, b, c = [int(_) for _ in input().split()]
    da, db, dc = a + max(db, dc), b + max(da, dc), c + max(da, db)

print(max(da, db, dc))


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    double a, b, h, m ; cin >> a >> b >> h >> m;
    double t = h * 60 + m;
    cout << fixed << setprecision(15) << abs(polar(a, M_PI * 2.0 * t / (12 * 60)) - polar(b, M_PI * 2.0 * t / 60)) << endl;
    return 0;
}


Measured memory_bytes: 4148
#include <iostream>
#include <list>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {std::make_pair(1, 0), std::make_pair(-1, 0), std::make_pair(0, 1), std::make_pair(0, -1)};
constexpr char BR = '\n';

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())



template <class T> inline int argmin(std::vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(std::vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


// 4/N = 1/h + 1/n + 1/w
// 1/w = 4/N - (1/h + 1/ n) = (4nh - N(n+h)) / nhN
// w = nhN / (4nh - N(n+h))

int main(void){
  lli N; scanf("%lld", &N);
  FOReq(h, 1, 3500) FOReq(n, h, 3500){
    lli mother = h * n * N, parent = 4 * n * h - N * (n + h);
    if(parent > 0 and mother % parent == 0){
      printf("%d %d %lld\n", h, n, mother / parent);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };


// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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


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

	int n;
	cin >> n;
	vector<ll> t(n);
	rep(i, n) cin >> t[i];

	ll ans = t[0];
	rep(i, n - 1) {
		ans = lcm(ans, t[i + 1]);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env ruby
n = gets.chomp.to_i

i = 1
ans = Float::INFINITY

while i * i <= n
  d, m = n.divmod(i)

  if m == 0
    ans = [ans, [i.to_s.length, d.to_s.length].max].min
  end

  i += 1
end

puts ans


Measured memory_bytes: 14276
//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define ld long double
#define pi acos(-1.0)

#define SZ(x)  (ll)(x.size())

//comment the below if now required

#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second


#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{

    ll n,i,c,tot,sum;

    cin>>n;

    ll a[n+1];

    rep(i,1,n+1)
        cin>>a[i];

    sort(a+1,a+1+n,greater<ll>());

    c = 2;
    sum = a[1];

    if(c==n)
    {
        cout<<sum;
        return 0;
    }

    for(i=2;i<=n;++i)
    {
        ++c;

        sum += a[i];

        if(c==n)
            break;

        ++c;

        sum += a[i];

        if(c==n)
            break;

    }


    cout<<sum;


    return 0;
}

Measured memory_bytes: 5176
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <set>
#include <vector>
#include <cstring>

using namespace std;
#define fi first
#define se second

const int maxn = 223456;


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

pii a[maxn];
int ad[maxn], mi[maxn];
int main(){
    // freopen("input.txt", "r", stdin);
    int N, M;
    cin>>N>>M;
    memset(ad, 0, sizeof(ad));
    memset(mi, 0, sizeof(mi));
    for(int i = 0; i < M; ++i){
        cin>>a[i].fi>>a[i].se;
        ad[a[i].fi]++;
        mi[a[i].se]++;
    }
    int res = 0, cur = 0;
    for(int i = 1; i <= N; ++i){
        cur += ad[i];
        if(cur >= M)res ++;
        cur -= mi[i];
    }
    cout<<res<<endl;
    return 0;
}

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

int main(){
    while(1){
        int n,x,ans=0;
        cin >> n >> x;
        if(n==0&&x==0) break;
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
            if((i+j)<x&&(x-i-j)>j&&(x-i-j)<=n) ans++;
            }
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pi pair<ll, ll>
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define vvi vector<vi>
#define vp vector<pi>
#define f(i, n) for(int i = 0; i < n; i++)
#define fo(i, a, n) for(int i = a; i < n; i++)
#define mod (1000*1000*1000+7)
#define sz(x) int((x).size())
#define all(x) x.begin(),x.end()
#define tc(i) int test_casesq; cin >> test_casesq; f(i, test_casesq)
#define ync(x, a, b) cout << (x?a:b) << '\n';
#define yn(x) ync(x, "YES", "NO");
#ifndef ONLINE_JUDGE
#define DBG(v) cerr << #v << " = " << (v) << endl;
#else
#define DBG(v) ;
#endif
template <typename T> std::ostream& operator<<(std::ostream &os, std::vector<T> v){os << "["; f(i, sz(v)) os << v[i] << " "; return os << "]";}

using namespace std;

ll INF = (1ll<<61);



int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll l, r, d; cin >> l >> r >> d;
    cout << r/d - (l-1)/d << endl;

    return 0;
}







// END


Measured memory_bytes: 3648
N=int(input())
M=[0]*1001

for i in range(2,N+1):
  j=2
  ii=i
  while 1:
    #print(ii)
    if ii%j==0:
      M[j]+=1
      ii//=j
      j=2
    else:
      j+=1
    if ii==1:
      #print("")
      break
#print(M[:10])

ans=1
for m in M:
  if m:
    ans*=(m+1)
print(ans%(10**9+7))

Measured memory_bytes: 3064
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0

    for i in range(N):
        if (i + 1) % 2 != 0 and A[i] % 2 != 0:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9164
x,y = map(int,input().split())
if x==1 and y==1:
    print(1000000)
    exit()
if x==1:
    mx=300000
elif x==2:    
    mx=200000
elif x==3:    
    mx=100000    
else:
    mx=0
if y==1:
    my=300000
elif y==2:    
    my=200000
elif y==3:    
    my=100000    
else:
    my=0
print(mx+my)

Measured memory_bytes: 38384
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

signed main(void)
{
	while(1) {
		int n;
		string m;
		cin >> n >> m;
		if(!n && m == "0") break;

		bool rej = false, err = true;
		int ma = -1, ans[10] = {0}, sz = 0;
		/*if(to_string(n) == m) {
			ma = n;
			err = false;
			sz = 2;
			ans[0] = ans[1] = n;
		}*/
		FOR(i, 0, 1<<(m.size()-1)) {
			string v[10] = {""};
			v[0] = m[0];
			int idx = 0;
			REP(j, m.size()-1) {
				if(i>>j&1) idx++;
				v[idx] += m[j+1];
			}
			int sum = 0;
			REP(j, idx+1) {
				//cout << v[j] << " ";
				sum += stoi(v[j]);
			}
			//cout << "sum:" << sum << endl;
			if(sum <= n) {
				err = false;
				if(sum > ma) {
					ma = sum;
					rej = false;
					//cout << "a" << endl;
					ans[0] = sum;
					REP(j, idx+1) ans[j+1] = stoi(v[j]);
					sz = idx+2;
				} else if(sum == ma) {
					rej = true;
				}
			}
		}
		if(err) {
			cout << "error" << endl;
		} else if(rej) {
			cout << "rejected" << endl;
		} else {
			//cout << "sz:" << sz << endl;
			REP(i, sz) {
				cout << ans[i];
				if(i != sz-1) cout << " ";
			}
			cout << endl;
		}
	}

	return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    int ans = 0;
    Int(n);
    vector<int> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i];
    }

    while (1) {
        bool ok = true;
        rep(i, n) {
            if (data[i] % 2) ok = false;
        }
        if (ok) {
            ans++;
            rep(i, n) data[i] /= 2;
        } else {
            break;
        }
    }
    cout << ans << endl;



    

    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cmath>
using namespace std;

int main() {
    double r;
    cin >> r;
    cout << 2 * 3.141592 * r << endl;
}



Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll N,W,w[1000],v[1000],dp[105][100005];
ll fun(ll i, ll tw)
{
   if(tw>W || i>N+1)
      return -1000000000000000000;
   if(i==N+1)
   return 0;
    if(dp[i][tw]!=-1)
        return dp[i][tw];
    else
        dp[i][tw] = max(fun(i+1,tw),v[i]+fun(i+1,tw+w[i]));
    return dp[i][tw];
}
int main()
{ 
    ll i,ans;
    cin>>N>>W;
    for(i=1;i<=N;i++)
        cin>>w[i]>>v[i];
    memset(dp,-1,sizeof dp);
    ans = fun(1,0);
    cout<<ans;
    return 0;
}
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

Measured memory_bytes: 82304
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)
int INF=1e9;
const long long mod=1e9+7;
typedef long long ll;

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n){
    a[i]=i+1;
  }
  do{
    rep(i,n){
      if(i)cout<<" ";
      cout<<a[i];
    }
    cout<<endl;
  }while(next_permutation(a.begin(),a.end()));
}


Measured memory_bytes: 3104
line, row = map(int, input().split())
table = [[0] * (row + 1) for i in range(line + 1)]

for l in range(line):
    work = list(map(int, input().split()))
    for r in range(row):
        table[l][r] = work[r]

for l in range(line):
    for r in range(row):
        table[l][row] += table[l][r]

for r in range(row + 1):
    for l in range(line):
        table[line][r] += table[l][r]

for l in range(line + 1):
    print('{}'.format(table[l][0]), end='')
    for r in range(1, row + 1):
        print(' {}'.format(table[l][r]), end='')
    print()


Measured memory_bytes: 6248
#include <iostream>
#include <queue>
#include <vector>
#include <unordered_set>

using namespace std;

typedef int64_t ll;

bool isPrime(ll num)
{
	if (num == 2) return true;
	if (num % 2 == 0) return false;

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

vector<ll> divisors(ll n) {
	vector<ll> res;
	res.reserve(sqrt(n) * 2 + 1);
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i != 0) continue;
		res.push_back(i);
		if (n / i == i) continue;
		res.push_back(n / i);
	}
	return res;
}

int main()
{
	ll a, b;
	cin >> a >> b;

	unordered_set<ll> ms;
	ms.insert(1);

	if (a % 2 == 0 && b % 2 == 0) {
		ms.insert(2);
	}

	auto v = divisors(a);

	for (auto e : v) {
		if (b % e == 0) {
			if (isPrime(e)) {
				ms.insert(e);
			}
		}
	}

	cout << ms.size() << endl;
	return 0;
}


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

int main(){
    double r;
    double S,L;
    double pi = 3.141592653589;
    cin >> r;
    S = r * r * pi;
    L = 2 * r * pi;
    printf("%.8lf %.8lf",S,L);
    
    return 0;
}


Measured memory_bytes: 3212
import math
inp=input("")
li=inp.split()
A=eval(li[0])
B=eval(li[1])

H=eval(li[2])
M=eval(li[3])
angleH=H/6*math.pi+M*math.pi/360
angleM=M*math.pi/30
if(abs(angleH-angleM)>=math.pi):
    angle=2*math.pi-abs(angleH-angleM)
else:
    angle=abs(angleH-angleM)
distance=math.sqrt(pow(A,2)+pow(B,2)-2*A*B*math.cos(angle))
print(distance)

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

vector<int> v[100010];
int in_degree[100010];
int dist[100010];
bool visited[100010];

void dfs(int i){
	visited[i] = true;
	for(auto j: v[i]) {
		dist[j] = max(dist[j], dist[i] + 1);
		if(--in_degree[j] == 0) dfs(j);
	}
}

int main(){
	int n, m, x, y;
	scanf("%d%d", &n, &m);
	while(m--) {
		scanf("%d%d", &x, &y); x--; y--;
		v[x].push_back(y);
		in_degree[y]++;
	}
	for(int i=0; i < n; i++)
		if(!visited[i] && !in_degree[i]) dfs(i);
	int ans = 0;
	for(int i=0; i < n; i++) ans = max(ans, dist[i]);
	printf("%d\n", ans);
}


Measured memory_bytes: 9728
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;

int n, m, d, e, f, g, o;
int map_info[ 1001 ][ 1001 ][ 3 ] = {};
int res[ 3 ];
string str = "JOI";
string a;
VS ar;
int main() {
	scanf( "%d %d", &n, &m );
	scanf( "%d", &o );
	for ( int i = 0; i < m + 2; i++ ) {
		a += " ";
	}
	ar.push_back( a );
	for ( int i = 0; i < n; i++ ) {
		cin >> a;
		ar.push_back( " " + a + " " );
	}
	ar.push_back( ar[ 0 ] );
	for ( int i = 0; i < 3; i++ ) {
		map_info[ 1 ][ 1 ][ i ] = str[ i ] == ar[ 1 ][ 1 ];
	}
	for ( int i = 1; i < n + 1; i++ ) {
		for ( int j = 1; j < m + 1; j++ ) {
			if ( i == 1 && j == 1 ) {
				continue;
			}
			for ( int k = 0; k < 3; k++ ) {
				map_info[ i ][ j ][ k ] = map_info[ i ][ j - 1 ][ k ] + map_info[ i - 1 ][ j ][ k ] - map_info[ i - 1 ][ j - 1 ][ k ] + ( int ) ( str[ k ] == ar[ i ][ j ] );
			}
		}
	}
	for ( int i = 0; i < o; i++ ) {
		scanf( "%d %d %d %d", &d, &e, &f, &g );
		for ( int j = 0; j < 3; j++ ) {
			res[ j ] = map_info[ f ][ g ][ j ] - map_info[ d - 1 ][ g ][ j ] - map_info[ f ][ e - 1 ][ j ] + map_info[ d - 1 ][ e - 1 ][ j ];
		}
		printf( "%d %d %d\n", res[ 0 ], res[ 1 ], res[ 2 ] );
	}
	return 0;
}

Measured memory_bytes: 14720
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, k;
	cin >> n >> k;
	
	vector<double> e(n);
	for(int i = 0; i < n; ++i) {
		int p;
		cin >> p;
		
		e[i] = (double)(p * (p + 1)) / 2.0 / (double)p;
	}
	
	vector<double> sum(n + 1, 0.0);
	for(int i = 0; i < n; ++i) {
		sum[i + 1] = sum[i] + e[i];
	}
	
	double ans = 0.0;
	for(int i = 0; i < n - k + 1; ++i) {
		ans = max(ans, (sum[i + k] - sum[i]));
	}		

	printf("%.12f\n", ans);
	
	return 0;
}


Measured memory_bytes: 3328
h,w,k = gets.split.map(&:to_i)

table = []
h.times do
  table << gets.chomp.chars
end

ans = 0

(0..('1'*h).to_i(2)).each do |h_bit|
  h_bit = h_bit.to_s(2).rjust(h, '0').chars
  (0..('1'*w).to_i(2)).each do |w_bit|
    w_bit = w_bit.to_s(2).rjust(w, '0').chars
    black = 0

    h_bit.each.with_index do |hb, i|
      w_bit.each.with_index do |wb, j|
        if hb == '1' && wb == '1'
          black += 1 if table[i][j] == '#'
        end
      end
    end

    if black == k
      ans += 1
    end
  end
end

puts ans


Measured memory_bytes: 14392
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


t = I()
for _ in range(t):
    n = I()
    A = LI()
    s = S()
    basis = []
    for i in range(n - 1, -1, -1):
        v = A[i]
        for b in basis:
            v = min(v, v ^ b)
        if v:
            if s[i] == '1':
                print(1)
                break
            basis += [v]
    else:
        print(0)



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

main(){

  ll a,b,k;
  cin>>a>>b>>k;
  rep(i,k){
    if(i&1){
      a+=b/2;
      b/=2;
    }else{
      b+=a/2;
      a/=2;
    }
  }
  cout<<a<<" "<<b<<endl;

}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
  var N, A, B int
  fmt.Scan(&N, &A, &B)
  
  lenAB := A + B
  n := N/lenAB
  rest := N%lenAB

  ans := n*A
  if rest <= A {
    ans += rest
  } else {
    ans += A
  }
  fmt.Println(ans)
}
  

Measured memory_bytes: 512
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

S = input()

ans = 0
cnt = 0
for s in S:
    if s == 'R':
        cnt += 1
        ans = max(ans,cnt)
    else:
        cnt = 0
print(ans)

Measured memory_bytes: 31068
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
ll dp[51][2];
int main(){
    int n,p;cin>>n>>p;
    int a[51];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    dp[0][0]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<2;j++){
            dp[i+1][j]+=dp[i][j];
            dp[i+1][(j+a[i])%2]+=dp[i][j];
        }
    }
    cout<<dp[n][p]<<endl;
}


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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type / Class / Struct Definitions:
using ll = long long;
using ull = unsigned long long;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);

//================ Main Loop ================
int main() {
    int n;
    cin >> n;
    vector<int> s(n);
    rep(i, n) {
        cin >> s[i];
    }
    int q;
    cin >> q;
    vector<int> t(q);
    rep(i, q) {
        cin >> t[i];
    }
    sort(all(s));
    sort(all(t));
    int si = 0, ti = 0, c = 0;
    while(si < n && ti < n) {
        if(s[si] == t[ti]) {
            c++;
            si++;
            ti++;
        } else if(s[si] < t[ti]) {
            si++;
        } else {
            ti++;
        }
    }
    cout << c << endl;
    return 0;
}
//===========================================

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


Measured memory_bytes: 3148
#include<stdio.h>
#include<stdlib.h>
int fun(int [],int );
int cmp(const void *,const void *);
int cmp(const void *a,const void *b)
{
    return *(int *)a-*(int *)b;
}
int fun(int a[],int n)
{
    int i,sum0=0,sum1=0;
    qsort(a,n,sizeof(a[i]),cmp);
    for(i=0;i<n;i++)
    {
        if(i%2==0)
        {
            sum0=sum0+a[i];
        }
        else
        {
            sum1=sum1+a[i];
        }
    }
    return abs(sum0-sum1);
}
int main()
{
    int a[101];
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    printf("%d\n",fun(a,n));
    return 0;
}

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


void solve(long long A, long long B, long long C){
  long long a = C-(A-B);

  cout << (a > 0 ? a : 0) << endl;


}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
while True:
    h,w = map(int,input().split())
    if h == w == 0:
        break
    for i in range(1,h+1):
        if i == 1 or i == h:
            print('#'*w)
        else:
            for j in range(1,w+1):
                if j == 1 or j == w:
                    print('#',end='')
                else:
                    print('.',end='')
            print()
    print()



Measured memory_bytes: 7004
n, m = map(int, input().split())

h = list(map(int, input().split()))
check = [1] * n

for i in range(m):
    a, b = map(int, input().split())

    if h[a-1] < h[b-1]:
        remove = a-1
        check[remove] = 0
    elif h[a-1] > h[b-1]:
        remove = b-1
        check[remove] = 0
    else:
        check[a-1] = 0
        check[b-1] = 0

ans = check.count(1)

print(ans)


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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

const int NMAX = 200;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    CIN(N,X);
    vi M(N);
    int sum=0;
    rep(i,N){
        cin>>M[i];
        sum+=M[i];
    }
    int ans=N;
    X-=sum;
    sort(all(M));
    ans+=X/M[0];
    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<string>
#define dint __int128
using namespace std;
#define kk putchar(32)
#define gc getchar()
#define fup(i,a,b) for(int i=a,i##e=b;i<=i##e;++i)
#define fdn(i,a,b) for(int i=a,i##e=b;i>=i##e;--i)
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long
#define hh putchar(10)
inline ll rrr(){ll x,f=1;char a;while((a=gc)<48||a>57)if(a==45)f=-1;
for(x=a^48;(a=gc)>47&&a<58;x=(x<<3)+(x<<1)+(a^48));return f*x;}
struct nnn{int x,y,z;};

char mp[60][60];
int bfs(int x,int y)
{
    int s=0;
    (mp[x+1][y]=='#')&&(++s);
    (mp[x][y+1]=='#')&&(++s);
    (mp[x-1][y]=='#')&&(++s);
    (mp[x][y-1]=='#')&&(++s);
    (mp[x+1][y+1]=='#')&&(++s);
    (mp[x-1][y-1]=='#')&&(++s);
    (mp[x+1][y-1]=='#')&&(++s);
    (mp[x-1][y+1]=='#')&&(++s);
    return s;
}
void Main()
{
    int h,w;
    cin>>h>>w;
    mem(mp,32);
    fup(i,1,h)cin>>mp[i]+1;
    fup(i,1,h)fup(j,1,w){
        if(mp[i][j]=='.'){
            mp[i][j]=bfs(i,j)+48;
        }
    }
    fup(i,1,h){
        fup(j,1,w)putchar(mp[i][j]);hh;
    }
}
int main()
{
    Main();
    return 0;
}


Measured memory_bytes: 888
#include <stdio.h>

int gcd_two(int n, int m) {
  if(m == 0) return n;
  return gcd_two(m, n % m);
}

int gcd_three(int l, int m, int n) {
  return gcd_two(gcd_two(l, m), n);
}

int main(void) {
  int count;
  int i, j, k;
  long sum = 0;
  scanf("%d", &count);
  for(i = 1;i <= count;i++) {
    for(j = 1;j <= count;j++) {
      for(k = 1;k <= count;k++) {
        sum += gcd_three(i, j, k);
      }
    }
  }
  printf("%ld\n", sum);
  return 0;
}


Measured memory_bytes: 2152
n = int(input())
l = []
for i in range(n):
  l.append(input())
print('AC x ' + str(l.count('AC')))
print('WA x ' + str(l.count('WA')))
print('TLE x ' + str(l.count('TLE')))
print('RE x ' + str(l.count('RE')))

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;
long long weight[200010]={};
long long ans[200010];
bool reached[200010]={};
vector< vector<int>>edge(200010);

void bfs(int now, int before){
    reached[now]=true;

    if(before!=-1){
        ans[now]+=ans[before];
    }
    for(auto next:edge[now]){
        if(reached[next])continue;
        bfs(next,now);
    }

    return;
}

int main(){

    int n,q;
    cin>>n>>q;
    
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--,b--;
        edge[a].emplace_back(b);
        edge[b].emplace_back(a);

    }

    
    rep(i,q){
        int node,x;
        cin>>node>>x;
        node--;
        ans[node]+=x;
    }

    bfs(0,-1);

    rep(i,n){
        cout<<ans[i]<<" ";
    }
    return 0;

}
/*


*/


Measured memory_bytes: 21376
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<vector>
#include<functional>
using namespace std;
typedef long long LL;
inline LL read()
{
	LL kk=0,f=1;
	char cc=getchar();
	while(cc<'0'||cc>'9'){if(cc=='-')f=-1;cc=getchar();}
	while(cc>='0'&&cc<='9'){kk=(kk<<1)+(kk<<3)+cc-'0';cc=getchar();}
	return kk*f;
}
LL n,a[2000222],dp[2000222];
LL lis[2000222];
vector<LL>edge[2000222];
LL co=0;
void add(LL a,LL b)
{
	edge[a].push_back(b);edge[b].push_back(a);
}
void dfs(LL now,LL fa)
{
	for(int i=0;i<edge[now].size();++i)
	{
		LL to=edge[now][i];
		if(to!=fa)
		{
			LL kk=a[to];
			if(lis[co]<kk)
			{
				lis[++co]=kk;
				dp[to]=co;
				dfs(to,now);
				co--;
			}
			else
			{
				int o=lower_bound(lis+1,lis+1+co,kk)-lis;
				LL lin=lis[o];
				lis[o]=kk;
				dp[to]=co;
				dfs(to,now);
				lis[o]=lin;
			}
		}
	}
}
int main()
{
	n=read();for(int i=1;i<=n;++i)a[i]=read();
	for(int i=1;i<n;++i)add(read(),read());
	dp[1]=1;
	lis[1]=a[1];co=1;
	dfs(1,0);
	for(int i=1;i<=n;++i)
	{
		printf("%lld\n",dp[i]);
	}
}

Measured memory_bytes: 74228
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORX(i, a, b, x) for (int i = (a); i <= (b); i+=x)
#define debug(x) cerr << #x << " is= " << x << endl; //use for debugging
#define read(a) int a; cin >> a;
#define reads(s) string s; cin >> s;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 5] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
 
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;}
 
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define mp(a,b) make_pair(a,b)
#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long int
#define vi         vector<int>
#define vll        vector<ll>
#define vpii       vector<pair<int,int>>
#define vov        vector<vector<int>> 
#define pr         pair<ll,ll>
#define vpll       vector<pair<ll,ll>>
#define all(v)     v.begin(),v.end()
#define rall(v)    v.rbegin(),v.rend()  //reverse of above;
#define sz(container) int((container).size())
#define cut(x) {cout<<x<<"\n"; return;}
#define setprec(x) cout << fixed << showpoint << setprecision(8)<<x<<endl;
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b/__gcd(a,b)
#define time cout << clock() / double(CLOCKS_PER_SEC) << endl;
#define endl "\n"
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
//*s.find_by_order() ->returns an iterator to the k-th largest element (counting from zero);
//s.order_of_key() ->number of elements strictly smaller then our item;
//st.rbegin()->second; last element in set
//st.erase(prev(st.end())); delete last element in set;
//sort(a+1,a+n+1,[](ll x,ll y){return abs(x)>abs(y);});
//sort(v.begin(), v.end(), greater<int>()); 
const int N=2e5+5;
string s,s1="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int n,a[N],n1;
void solve()
{
 n1=sz(s);
 FOR(i,0,n1)
 a[i]=(s[i]-'A'+n)%26;

 FOR(i,0,n1-1) cout<<s1[a[i]];
}
int main()
{
  fast_io;
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  cin>>n>>s;
  solve();
}

Measured memory_bytes: 3660