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

#define ll long long
#define eb emplace_back
#define fi first
#define se second

using namespace std;

const int nm = 200002;

int n;
string s;
ll powmod[nm][2];

ll f(ll n) {
	if (!n) {
		return 0;
	}
	return f(n % __builtin_popcount(n)) + 1;
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> s;
	int cnt = 0;
	for (int i = 0; i < n; ++i) {
		cnt += s[i] - '0';
	}
	if (cnt == 0) {
		for (int i = 0; i < n; ++i) {
			cout << "1\n";
		}
		return 0;
	}
	if (cnt == 1) {
		for (int i = 0; i < n; ++i) {
			if (s[i] == '0') {
				s[i] = '1';
				if (s[n - 1] == '0') {
					cout << "1\n";
				} else {
					cout << "2\n";
				}
				s[i] = '0';
			} else {
				cout << "0\n";
			}
		}
		return 0;
	}
	powmod[0][0] = 1 % (cnt - 1);
	powmod[0][1] = 1 % (cnt + 1);
	for (int i = 1; i <= n; ++i) {
		powmod[i][0] = (powmod[i - 1][0] * 2) % (cnt - 1);
		powmod[i][1] = (powmod[i - 1][1] * 2) % (cnt + 1);
	}
	ll mod0 = 0, mod1 = 0;
	for (int i = 0; i < n; ++i) {
		mod0 = (mod0 * 2 + s[i] - '0') % (cnt - 1);
		mod1 = (mod1 * 2 + s[i] - '0') % (cnt + 1);
	}
	for (int i = 0; i < n; ++i) {
		if (s[i] == '0') {
			ll newmod = (mod1 + powmod[n - 1 - i][1]) % (cnt + 1);
			cout << f(newmod) + 1 << "\n";
		} else {
			ll newmod = (mod0 - powmod[n - 1 - i][0] + cnt - 1) % (cnt - 1);
			cout << f(newmod) + 1 << "\n";
		}
	}
}


Measured memory_bytes: 6904
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc124_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = Convert.ToInt32(input[0]);
            int B = Convert.ToInt32(input[1]);
            int Coin = 0;

            for (int i = 0; i < 2; i++)
            {
                if (A > B)
                {
                    Coin = A + (A - 1);
                }
                else if (B > A)
                {
                    Coin = B + (B - 1);
                }
                else
                {
                    Coin = A + B;
                }
            }

            Console.WriteLine(Coin);
            Console.Read();
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define int long long
int inf = 10e17;
#define mod 1000000007

bool vis[200005];
vector<int> vec[2000005], v1;
int child[2000005];
int parent[2000005];
int div1[100005];
int min_indx[900005];
int count1 = 0;
int height = 0;
int max_indx[200005];
void dfs(int node)
{

    vis[node] = 1;
    // cout << node << "\n";
    min_indx[count1] = node;
    max_indx[node] = min(max_indx[node], count1);
    count1++;

    //  count1++;
    child[node] = height++;
    for (int i = 0; i < vec[node].size(); i++)
    {
        if (!vis[vec[node][i]])
        {
            dfs(vec[node][i]);
            min_indx[count1] = node;
            max_indx[node] = min(max_indx[node], count1);
            count1++;
        }
    }
    height--;
}

int MAXN = 200005;
int LOGMAXN = (int)log2(200005) + 1;
int M[200005][60];
void process2(int A[], int N)
{
    int i, j;

    //initialize M for the intervals with length 1
    for (i = 0; i < N; i++)
        M[i][0] = i;
    //compute values from smaller to bigger intervals
    for (j = 1; 1 << j <= N; j++)
        for (i = 0; i + (1 << j) - 1 < N; i++)
            if (A[M[i][j - 1]] < A[M[i + (1 << (j - 1))][j - 1]])
                M[i][j] = M[i][j - 1];
            else
                M[i][j] = M[i + (1 << (j - 1))][j - 1];
}
//int parent[200005];
vector<int> vec1;
//bool vis[200005];
//int hei[200005];
int lev[200005];
int dis[200005];
bool cmp(pair<int, int> &a,
         pair<int, int> &b)
{
    return a.second < b.second;
}
int32_t main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    //  int t;
    int n, m;
    cin >> n >> m;
    if (n <= 8 && m <= 8)
        cout << "Yay!"
             << "\n";
    else
    {
        cout << ":("
             << "\n";
    }

    return 0;
}


Measured memory_bytes: 50520
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  ll m,sum=0,csum=0;
  cin >> m;
  ll i;
  for(i=0;i<m;i++){
    ll d,c;
    cin >> d >> c;
    sum+=d*c,csum+=c;
  }
  if(sum%9==0){
    cout << sum/9+csum-2 << endl;
  }
  else{
    cout << sum/9+csum-1 << endl;
  }
}

Measured memory_bytes: 3584
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //c
  int n;
  cin >> n;
  set<int> st;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (st.count(a)) {
      cout << "NO\n";
      return 0;
    }
    st.insert(a);
  }
  cout << "YES\n";
  return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define pii pair<int, int> 
#define mod 1000000007
ll power(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b%2!=0) res=(res*a);
        a=(a*a);
        b/=2;
    }
    return res;
}
ll ncr(ll n,ll k){
    if(k==0||k==n) return 1ll;
    if(k>n-k) k=n-k;
    ll pro=1;
    for(ll i=0;i<k;i++){
        pro=(pro*(n-i));
        pro/=(i+1);
    }
    return pro;
}
vector<int> prime;
void seive(){
    vector<bool > isprime(101,true);
    for(int i=2;i*i<=100;i++){
        if(isprime[i]){
            for(int j=i*i;j<=100;j+=i){
                isprime[j]=false;
            }
        }
    }
    for(int i=2;i<=100;i++){
        if(isprime[i]) prime.push_back(i);
    }
}
int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    seive();
    ll n;
    cin>>n;
    if(n<=9){
        cout<<"0";
        return 0;
    }
    map<ll,ll > m;
    for(ll i=1;i<=n;i++){
        for(ll j=0;j<prime.size() && i>=prime[j];j++){
            ll x=i;
            while(x%prime[j]==0){
                m[prime[j]]++;
                x/=prime[j];
            }   
        }
    }
    ll count3=0,count5=0,count15=0,count25=0,count75=0;
    for(auto itr:m){
        if(itr.se>=2){
            count3++;
        }
        if(itr.se>=4){
            count5++;
        }
        if(itr.se>=14){
            count15++;
        }
        if(itr.se>=24){
            count25++;
        }
        if(itr.se>=74){
            count75++;
        }
    }
    //cout<<count3<<" "<<count5<<endl;
    ll ans=ncr(count5,2ll)*(count3-2ll)+count15*(count5-1)+count25*(count3-1)+count75;
    cout<<ans;
    return 0;
}


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

ans = 0
for i in range(N):

    if B[i] >= A[i]:
        ans += A[i]
        B[i] -= A[i]
        if A[i+1] >= B[i]:
            ans += B[i]
            A[i+1] -= B[i]

        else:
            ans += A[i+1]
            A[i+1] = 0

    else:
        ans += B[i]

print(ans)


Measured memory_bytes: 19156
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import deque

n = ni()
a = na()

ok = True
ans = deque()

s = sum(a)
cur_n = n
while s:
    pos = 0
    flag = False
    i = n - 1
    j = cur_n - 1
    while i >= 0:
        if a[i] == 0:
            i -= 1
            continue
        if a[i] == j + 1:
            flag = True
            pos = i
            break
        j -= 1
        i -= 1

    if flag:
        ans.appendleft(a[pos])
        s -= a[pos]
        a[pos] = 0
        cur_n -= 1
    else:
        print(-1)
        exit()

print(*ans)

Measured memory_bytes: 3316
#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 <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

int main(void) {
    int num;
    cin >> num;
    int64_t sum = 0;
    for(int i = 1; i <= num; i++) {
        int cnt = num/i;
        sum += (int64_t)cnt * (cnt + 1) * i / 2;
    }
    cout << sum << endl;
    return 0;
}

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

int N, M;

int main() 
{
    cin >> N >> M;
    int l, r;
    int left = -1000001, right = 100001;
    bool isSafe = true;
    for (int i = 0; i < M; i++) 
    {
        cin >> l >> r;
        if (l > right || r < left) 
        {
            isSafe = false;
            break;
        }
        left = max(l, left);
        right = min(r, right);
    }
    if (isSafe) cout << right - left + 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  string s;
  cin >> s;
  int n = s.size();
  cout << s[0] << n - 2 << s[n - 1] << endl;
}


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

int main(){
    int n,k;
    int count = 0;
    char s[101];
    string ans = "No";
    cin >>s;
    for (int i = 0; i < strlen(s);i++)
    {
      if(i%2==0)
      {
        if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
          count++;
      }
      if (i%2==1)
      {
        if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
          count++;
      }
    }
    if (count == strlen(s))
      ans = "Yes";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
x = int(input())
if x <= 599:
    print(8)
elif x <= 799:
    print(7)
elif x <= 999:
    print(6)
elif x <= 1199:
    print(5)
elif x <= 1399:
    print(4)
elif x <= 1599:
    print(3)
elif x <= 1799:
    print(2)
else:
    print(1)


Measured memory_bytes: 61820
#include <stdio.h>

int main(int argc, const char * argv[])
{

    int i, j;
    
    for (i = 1; i <= 9; i++) {
        for (j = 1; j <= 9; j++) {
            printf("%dx%d=%d\n", i, j, i * j);
        }
    }
    
    return 0;
}

Measured memory_bytes: 524
#include<iostream>
using namespace std;
int main() {
	char ccc[10];
	int a, b, c, d, e, f, g, h, i, j;
	int k, l, m, n, o, p, q, r, s;
	int t, u, v, w, x, y, z, aa;
	int bb, cc, dd, ee, ff, gg, hh;
	int ii, jj, kk, ll, mm, nn;
	int oo, pp, qq, rr, ss;
	int tt, uu, vv, ww;
	int xx, yy, zz;
	int an, ns;
	int ans;
	while (cin >> ccc) {
		a = (int)ccc[0] - '0';
		b = (int)ccc[1] - '0';
		c = (int)ccc[2] - '0';
		d = (int)ccc[3] - '0';
		e = (int)ccc[4] - '0';
		f = (int)ccc[5] - '0';
		g = (int)ccc[6] - '0';
		h = (int)ccc[7] - '0';
		i = (int)ccc[8] - '0';
		j = (int)ccc[9] - '0';

		k = (a + b) % 10;
		l = (b + c) % 10;
		m = (c + d) % 10;
		n = (d + e) % 10;
		o = (e + f) % 10;
		p = (f + g) % 10;
		q = (g + h) % 10;
		r = (h + i) % 10;
		s = (i + j) % 10;

		t = (k + l) % 10;
		u = (l + m) % 10;
		v = (m + n) % 10;
		w = (n + o) % 10;
		x = (o + p) % 10;
		y = (p + q) % 10;
		z = (q + r) % 10;
		aa = (r + s) % 10;

		bb = (t + u) % 10;
		cc = (u + v) % 10;
		dd = (v + w) % 10;
		ee = (w + x) % 10;
		ff = (x + y) % 10;
		gg = (y + z) % 10;
		hh = (z + aa) % 10;

		ii = (bb + cc) % 10;
		jj = (cc + dd) % 10;
		kk = (dd + ee) % 10;
		ll = (ee + ff) % 10;
		mm = (ff + gg) % 10;
		nn = (gg + hh) % 10;
		
		oo = (ii + jj) % 10;
		pp = (jj + kk) % 10;
		qq = (kk + ll) % 10;
		rr = (ll + mm) % 10;
		ss = (mm + nn) % 10;

		tt = (oo + pp) % 10;
		uu = (pp + qq) % 10;
		vv = (qq + rr) % 10;
		ww = (rr + ss) % 10;

		xx = (tt + uu) % 10;
		yy = (uu + vv) % 10;
		zz = (vv + ww) % 10;
		
		an = (xx + yy) % 10;
		ns = (yy + zz) % 10;

		ans = (an + ns) % 10;

		cout << ans << endl;
	}
}

Measured memory_bytes: 3076
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// ここにコードを挿入
		Scanner s = new Scanner(System.in);
		String[] str = s.nextLine().split(" ");
		int n = Integer.parseInt(str[0]);
		long t = Long.parseLong(str[1]);
		String[] str2 = s.nextLine().split(" ");
		long[] ti = new long[str2.length];
		long ans = 0l;
		for(int i = 0; i < n; i++) {
			ti[i] = Long.parseLong(str2[i]);
		}
		for(int i = 0; i < n - 1; i++) {
			if(ti[i + 1] - ti[i] >= t) {
				ans += t;
			} else {
				ans += ti[i + 1] - ti[i];
			}
		}
		ans += t;
		System.out.println(ans);
	}

}


Measured memory_bytes: 55060
n = int(input())
t_list = list(map(int,input().split()))
t_sum = sum(t_list)
m = int(input())
#quetion = [[0]*2 for i in range(m)]
for i in range(m):
    p,x = map(int,input().split())
    print(t_sum - t_list[p-1] + x)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define pdd pair<double, double>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define M_PI 3.14159265358979323846
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define LOR(i,l,r) for (ll i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define LORD(i,r,l) for (ll i=r;i>=l;i--)
#define INF 1000000000
#define CL(x) memset(x,0,sizeof(x))
#define DEB(x) cout << #x << " : " << x << '\n'
#define ALL(x) x.begin(), x.end()
#define SZ(x) x.size()
typedef long long ll;

string S;
int cnt[2];
int Ans;

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

    cin>>S;
    for(char ch : S)
    {
        if( ch=='0' )
        {
            cnt[0]++;
            if( cnt[1] )
            {
                cnt[0]--, cnt[1]--;
                Ans+=2;
            }
        }
        else
        {
            cnt[1]++;
            if( cnt[0] )
            {
                cnt[0]--, cnt[1]--;
                Ans+=2;
            }
        }
    }
    cout<<Ans<<'\n';

    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(x,y) (((x)>(y))?(x):(y))
#define MIN(x,y) (((x)<(y))?(x):(y))
#define N 10000000
int n,m;
int c[21];
int score[50001];//dpテーブル
void coin(){
    int i,j;
    for(i=0;i<=n;i++){
        score[i] = N;
    }//初期化
    score[0] = 0;
    for(i=1;i<=n;i++){
        for(j=1;j<=m;j++){
            int h = i - c[j];
            if (h>=0){
                score[i] = MIN(score[i],score[h]+1);
            }else{
                continue;
            }
            //printf("%d\n",score[i]);
        }
    }
    /*for(i=0;i<=n+1;i++){
        printf("%d\n",score[i]);
    }*/
}
int main(void){
    int i;
    scanf("%d %d",&n,&m);
    for(i=1;i<=m;i++){
        scanf("%d",&c[i]);
    }
    coin();
    printf("%d\n",score[n]);
    return 0;
}

Measured memory_bytes: 792
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int N,C;

	scanf("%d %d",&N,&C);

	int sum = 0,tmp;

	for(int i = 0; i < C; i++){
		scanf("%d",&tmp);
		sum += tmp;
	}

	int ans = sum/(N+1);
	if((sum)%(N+1) != 0)ans++;

	printf("%d\n",ans);

	return 0;
}



Measured memory_bytes: 3220
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	int a[2100000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	for (int i = 0; i < n - 1; i++) {
		if (a[i] == a[i + 1]) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const ll inf=(ll)5*(ll)1e15;
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  string s;
  cin>>s;
  ll k;
  cin>>k;
  rep(i,0,sz(s))
    {
      if(s[i]=='1') k--;
      else
	{
	  cout<<s[i]<<endl;
	  return 0;
	}
      if(k==0)
	{
	  cout<<s[i]<<endl;
	  return 0;
	}
    }
  assert(false);
  return 0 ;
}


Measured memory_bytes: 256
<?php
$w = strtolower(trim(fgets(STDIN)));
while($w!="-"){
    $cnt = strtolower(trim(fgets(STDIN)));
        for ($j=0;$j<$cnt;$j++) {
            $line = fgets(STDIN);
            if ($line == '-') {
                break;
            }
            for($i=0 ; $i < trim($line);$i++){
                $w = substr($w,1,strlen($w)-1).substr($w,0,1);
            }
        }
    echo $w.PHP_EOL;
    $w = strtolower(trim(fgets(STDIN)));
}
?>


Measured memory_bytes: 9208
#include "iostream"
#include "cstring"
#include "vector"
#include "algorithm"
using namespace std;
typedef struct res
{
	int solve;
	int time;
	int id;

	static bool comp(const res& l, const res& r)
	{
		if(l.solve!=r.solve) return l.solve>r.solve;
		if(l.time!=r.time) return l.time<r.time;
		return l.id>r.id;
	}
}res;


int main(void)
{
	int M,T,P,R;
	while (cin>>M>>T>>P>>R,M) {
		int penalty[M][P];
		memset(penalty,0,sizeof(penalty));
		res result[T];
		for (int i = 0; i < T; i++) {
			result[i].solve=0;
			result[i].time=0;
			result[i].id=i+1;
		}
		for (int i = 0; i < R; i++) {
			int m,t,p,r;
			cin>>m>>t>>p>>r;
			if(!r)
			{
				result[t-1].solve+=1;
				result[t-1].time+=m+20*penalty[t-1][p-1];
			}
			else penalty[t-1][p-1]++;
		}
		sort(result,result+T,res::comp);
		for (int i = 0; i < T; i++) {
			if(i!=0)
			{
				if(result[i-1].solve==result[i].solve&&result[i-1].time==result[i].time)
				{
					cout<<"=";
				}
				else cout<<",";
			}
			cout<<result[i].id;
		}

		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1196
def main():
    num = int(input())
    l = list('abcdefghijklmnopqrstuvwxyz')
    name = []
    ans = ''

    while num > 0:
        num = num - 1
        name.append(l[num%26])
        num = num // 26

    name.reverse()

    for i in name:
        ans = ans + i
    print(ans)


main()

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

int main(void){
    ll N,K;
    cin >> N >> K;
    ll h[N];
    rep(i,N)cin >> h[i];
    sort(h,h+N);

    rep(i,N){
        if(h[i] >= K ){
            cout << N - i << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>


const int mod = 1000000007;

int main() {
	int N ,L;
	scanf("%d %d", &N, &L);
	int res = 0;
	if (1 - N <= L && L <= 0) {
		for (int i = 0; i < N; i++) {
			res += L + i;
		}
	}
	else if (L > 0) {
		for (int i = 1; i < N; i++) {
			res += L + i;
		}
	}
	else {
		for (int i = 0; i < N - 1; i++) {
			res += L + i;
		}
	}
	printf("%d", res);
}





Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define int long long
//#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 20;
const int MOD = 998244353;


void solve() {
    double l;
    cin >> l;
    double x = l / 3;
    cout << x * x * x;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(12);
    srand(time(0));
    cout << fixed;
    solve();
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back


using namespace std;

const int maxm = 1000000000 + 7;

double startTime;
double getCurrentTime() {
  return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


//----------->CODE BEGINS --------------->



int main()
{

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


  ll a, b, x;
  cin >> a >> b >> x;

  ll ans = 0;

  if (a % x == 0)
  {
    ans = b / x - a / x + 1;
  }

  else
  {
    ans = b / x - a / x  ;
  }


  cout << ans << endl;


}


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

if(a>b):
    ans=0
elif(a==b and n==1):
    ans=1
elif(a==b and n!=1):
    ans=1
elif(a<b and n==1):
    ans=0
elif(a<b and n==2):
    ans=1
else:
    ans=(2-n)*(a-b)+1
print(ans)

Measured memory_bytes: 3064
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        """ 根を見つける関数を定義（同時にxを直接根にくっつける操作も行う）"""
        tmp = []
        parents = self.parents
        while parents[x] >= 0:
            tmp.append(x)
            x = parents[x]
        for y in tmp:
            parents[y] = x
        return x

    def union(self, x, y):
        """ 二つの木をくっつける（子を多く持つ方を根とした親子関係）。これは破壊的操作を行う。"""
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        """ xとyが同じ根の子かを判定 """
        return self.find(x) == self.find(y)

    def size(self, x):
        """ xの根のparent（= 要素数）を返す """
        return -self.parents[self.find(x)]

    def members(self, x):
        """ xが属するグループの要素をリストとして返す O(N)"""
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        """ 全ての根の要素をリストとして返す O(N)"""
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        """ グループの数を返す O(1)"""
        return len(self.roots())

    def size_list(self):
        """ 各グループの要素数のリストを返す(根の番号は返さない) O(N)"""
        return [-x for x in self.parents if x < 0]

    def all_group_members(self):
        """ {根:[根の子(根を含む)のリスト],...}を辞書で返す O(N)"""
        res = [[] for _ in range(self.n)]
        for i in range(self.n):
            x = self.find(i)
            res[x].append(i)
        return {r: res[r] for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

##############################################################################################################
import sys
input = sys.stdin.readline


N, M = map(int, input().split())
U = UnionFind(N)
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    U.union(a, b)

print(U.group_count()-1)

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

using namespace std;
typedef long long ll;

int N, M;
int sv[10];

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

    cin >> N >> M;
    for (int i = 0; i < N; i++)
        sv[i] = -1;

    for (int i = 0; i < M; i++)
    {
        int x, y;
        cin >> x >> y;
        x--;
        if (sv[x] != -1 && sv[x] != y)
        {
            cout << "-1\n";
            return 0;
        }
        sv[x] = y;
    }

    if (sv[0] == 0 && N > 1)
    {
        cout << "-1\n";
        return 0;
    }

    for (int i = 0; i < N; i++)
    {
        if (sv[i] == -1 && i == 0 && N > 1)
            sv[i] = 1;
        cout << max (sv[i], 0);
    }
    cout << "\n";
}

Measured memory_bytes: 256
import math
N=int(input())
Z=[[],[]]
A=[]
kaijo=1
sum=0
for i in range(1,N+1):
    kaijo=kaijo*i
for i in range(N):
    x,y=map(int,input().split())
    Z[0].append(x)
    Z[1].append(y)
for i in range(N-1):
    for j in range(i+1,N):
        A.append(math.sqrt((Z[0][i]-Z[0][j])**2+(Z[1][i]-Z[1][j])**2))
for i in range(len(A)):
    sum+=A[i]*kaijo*2
print(sum/(kaijo*N))


Measured memory_bytes: 3064
L, R = map(int, input().split())
modL = L % 2019
modR = R % 2019
min2019 = 2019

if R - L >= 2018:
    print(0)
else:
    for j in range(modL, modR+1):
        for k in range(j+1 , modR+1):
            min2019 = min(min2019, j * k % 2019)
    print(min2019)

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

#define INF 1000000007
#define ll long long
#define F first
#define S second
#define pii pair<ll int,ll int>
#define pb push_back
#define ppb pop_back
#define vi vector<ll int>


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin >> t;
	while(t--){
		int n,m;
		cin >> n >> m;
		if(n==m) cout << "Yes";
		else cout << "No";
	}
	return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    A = (map(int, input().split()) for _ in range(2))

    def accumulate(a):
        s = 0
        yield s
        for x in a:
            s += x
            yield s

    Accs = tuple(
        tuple(accumulate(a)) for a in A
    )

    ans = 0
    for from_r0 in range(N):
        ans = max(ans, Accs[0][from_r0 + 1] + Accs[1][N] - Accs[1][from_r0])
    print(ans)


if __name__ == '__main__':
    main()


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

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


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

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

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

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

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

static const double pi = 3.141592653589793;

int main() {
  int zi,hun;
  cin >> zi >> hun;
  int h,m;
  cin >> h >> m;
  double theta=abs(m/60.0-(h/12.0+m/720.0))*2*pi;
  fcout << sqrt(zi*zi+hun*hun-2*zi*hun*cos(theta)) << endl;


  return 0;
}


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

int main(){
  string s;
  cin >> s;
  if(s == "Sunny") cout << "Cloudy" << endl;
  if(s == "Cloudy") cout << "Rainy" << endl;
  if(s == "Rainy") cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <iterator>
#include <utility>
#include <iomanip>
#include <stack>
#include<bitset>
#include <cmath>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >pq;
vector<ll>adj[1000005];
ll expo(ll b,ll n,ll m)
{
 ll r,p;
	p=1;
	 b=b%m;
	while(n>0)
	{ 
		r=n%2;
		if(r==1)
		   p=((p%m)*(b%m))%m;
		b=((b%m)*(b%m))%m; 
		n=n/2;		
	}
 return (p%m);
}
ll divide1(ll a,ll b,ll m)
	{ ll r,p,n;
			p=a%m;
				n=m-2;
				while(n>0){
						 r=n%2;
						if(r==1)
							p=((p%m)*(b%m))%m;
						b=((b%m)*(b%m))%m; 
						n=n/2;	
					}
	return (p%m); }
ll p[1000002];
ll q[1000002];
ll r[1000002];
vector<ll>final;
int main(int argc, char const *argv[])
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);
	ll x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	for (int i = 0; i < a; ++i)
	{
		cin>>p[i];
	}
	for (int i = 0; i < b; ++i)
	{
		cin>>q[i];
	}
	for (int i = 0; i < c; ++i)
	{
		cin>>r[i];
	}
	sort(p,p+a, greater<ll>());
	sort(q,q+b, greater<ll>());
	sort(r,r+c, greater<ll>());
	ll ans=0;
	for (int i = 0; i < x; ++i)
	{
		ans+=p[i];
		final.pb(p[i]);
	}
	for (int i = 0; i < y; ++i)
	{
		ans+=q[i];
		final.pb(q[i]);
	}
	sort(final.begin(), final.end());
	ll i=0;
	for(auto v:final)
	{
		if (i>=c)
		{
			break;
		}
		if(r[i]>=v)
			{
				ans-=v;
				ans+=r[i++];
			}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 35828
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, p, q;
  cin >> a >>b;
  
  p = a - (a / 2) * 2;
  q = b - (b / 2) * 2;
  if (p * q == 1){
    cout << "Odd" << endl;
  }
  else{
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

signed main()
{
  cin.tie(nullptr), ios::sync_with_stdio(false);

  string s;
  cin >> s;
  for(auto &c : s) { if (c == ',') c = ' '; }
  cout << s << LF;

  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
    int month,day;
    int sum;
    int i;
     
    scanf("%d %d",&month,&day);
    while(month!=0){
        sum=0;
        //通算日数の計算
        for(i=1;i<month;i++){
            switch(i){
                case 2:
                    sum=sum+29;
                    break;
                case 4:
                    sum=sum+30;
                    break;
                case 6:
                    sum=sum+30;
                    break;
                case 9:
                    sum=sum+30;
                    break;
                case 11:
                    sum=sum+30;
                    break;
                default:
                    sum=sum+31;
                    break;
            }
        }
        sum=sum+day;
         
        //曜日の判定
        switch(sum%7){
            case 0:
                printf("Wednesday\n");
                break;
            case 1:
                printf("Thursday\n");
                break;
            case 2:
                printf("Friday\n");
                break;
            case 3:
                printf("Saturday\n");
                break;
            case 4:
                printf("Sunday\n");
                break;
            case 5:
                printf("Monday\n");
                break;
            case 6:
                printf("Tuesday\n");
                break;
        }
         
        scanf("%d %d",&month,&day);
    }
     
    return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(long long N, vector<long long> p){
	vector<ll> a(N), b(N);
	rep(i,N) {
		a[i] = (i+1)*N;
		b[i] = (N-i)*N;
	}
	rep(i,N) {
		a[p[i]] += i;
	}
	rep(i,N-1) {
		cout << a[i] << " ";
	}
	cout << a[N-1] << endl;
	rep(i,N-1) {
		cout << b[i] << " ";
	}
	cout << b[N-1] << endl;
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> p(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&p[i]);
		p[i]--;
	}
	solve(N, p);
	return 0;
}



Measured memory_bytes: 1280
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, m;
	cin >> n >> m;
	int x = 1, y = n;
	while (m--)
	{
		int l, r;
		cin >> l >> r;
		x = max(l, x);
		y = min(r, y);
	}
	cout << max(0, y - x + 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

#define ld  long double
#define ll  long long int
#define ull unsigned long long int
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,s,n) for(int i=s;i<n;i++)

const int    INF = 1e11;
const double EPS = 1e-11;

//切り上げ整数除算
int divRoundUp(const int& a, const int& b) { return (a + b - 1) / b; }
//四捨五入
int roundOff(const double& a) { return (int)(a + 0.5); }
// r の(誤差付きの)符号に従って, -1, 0, 1 を返す.
int sgn(const ld& r) { return (r > EPS) - (r < -EPS); }
// a, b の(誤差付きの)大小比較の結果に従って, -1, 0, 1 を返す.
int sgn(const ld& a, const ld& b) { return sgn(a - b); }

using namespace std;

inline void Main() {
	int a, b; cin >> a >> b;
	int ans = 0;
	if (a >= 13) {
		ans = b;
	}
	else if (6 <= a && a <= 12) {
		ans = b / 2;
	}
	cout << ans << endl;
}

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

	Main();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n ;
double sum , di=1 , x;
int main()
{

        cin >> n ;
        for ( int i = 0 ; i < n ;i++)
            cin >>x,sum+=(di/ x);
        cout << fixed<<setprecision(6)<<di / sum ;

    return 0;
}


Measured memory_bytes: 384
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s = input()

    if s == "RRR":
        print(3)
    elif "RR" in s:
        print(2)
    elif "R" in s:
        print(1)
    else:
        print(0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61628
s=list(input())
a=s.count("a")
b=s.count("b")
c=s.count("c")
l1=[a,b,c]
l1.sort()
if l1[0]==0 and l1[1]==1 and l1[2]==1:
    print("YES")
elif min(a,b,c)!=0 and max(a,b,c)-min(a,b,c)<=1:
    print("YES")
elif a+b+c==max(a,b,c) and max(a,b,c)==1:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 9740
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn=1e6+10;
int n,x,y,ans[maxn];
int main()
{
	scanf("%d%d%d",&n,&x,&y);
	for (int i=1;i<=n;i++)
	 for (int j=i+1;j<=n;j++)
	 {
	 	ans[min(j-i,abs(i-x)+abs(j-y)+1)]++; 
	 }
	for (int i=1;i<n;i++) printf("%d\n",ans[i]);
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
#define LL long long
#define lc c[x][0]
#define rc c[x][1]
#define pb push_back

int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int i,j,n;
    char s[100],t[]="OAKIHABARA";
    scanf("%s",s+1);n=strlen(s+1);
    for (i=1,j=1;j<=9;){
        if (s[i]==t[j]) i++,j++;
         else if (t[j]=='A') j++;
          else break;
    }
    if (j<=9||i<=n) puts("NO"); else puts("YES");
    return 0;
}


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

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

ll N;

bool check(ll n){
  int buff;
  map<int,int> mp;

  while(true){
    buff = n % 10;
    mp[buff]++;
    if(n < 10) break;
    n = n / 10;
  }
  if(mp[3] > 0 && mp[5] > 0 && mp[7] > 0)
    return true;
  else
    return false;
}

ll dfs(ll i){
  if(i > N) return 0;

  return check(i) + dfs(10*i+3) + dfs(10*i+5) + dfs(10*i+7);
}

void solve(){
    ll ans = dfs(0);

    cout << ans << endl;
}

int main(){
    cin >> N;

    solve();
}


Measured memory_bytes: 256
n, a, b, c = gets.chomp.split.map(&:to_i)
l = []
n.times do
  l.push gets.chomp.to_i
end

def array_diff(a, b)
  aa = a.dup
  b.each do |e|
    i = aa.find_index(e)
    if i
      aa.delete_at(i)
    end
  end
  aa
end

def calc(ary, h)
  (ary.size - 1) * 10 + (ary.reduce(:+) - h).abs
end

candidate = []
1.upto(n - 2) do |i|
  1.upto(n - 1 - i) do |j|
    1.upto(n - i - j) do |k|
      l.combination(i).each do |ic|
        array_diff(l, ic).combination(j).each do |jc|
          array_diff(array_diff(l, ic), jc).combination(k).each do |kc|
            candidate.push(calc(ic, a) + calc(jc, b) + calc(kc, c))
          end
        end
      end
    end
  end
end
puts candidate.min


Measured memory_bytes: 2300
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/


signed main(){
	int l,r,d;
	cin>>l>>r>>d;
	int ans=0;

	FOR(i,l,r){
		if(i%d==0) ans++;
	}
	cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 3592
N, W = gets.split.map(&:to_i)
v = []
w = []

N.times do |i|
	v[i], w[i] = gets.split.map(&:to_i)
end

dp = Array.new(N+2).map{Array.new(W+2, 0)}

N.times do |i|
	(W+1).times do |j|
		if j >= w[i]
			dp[i+1][j] = [dp[i][j-w[i]] + v[i], dp[i][j]].max
		else
			dp[i+1][j] = dp[i][j]
		end
	end
end
 
puts dp[N][W]


Measured memory_bytes: 14844
#include <iostream>
#include <stdio.h>
#include <vector> 
using namespace std;
int main(void){
    int N, K; cin >> N >> K;
    int i = 0;
    int index = 0;
    vector<int> a(N);
    while(a.size() > i){
        cin >> a[i];
        if (a[i] == 1) {
            index = i;
        }
        i++;
    }
    int b = 0;
    if ((N - 1) % (K - 1) == 0) {
        b = 0;
    } else {
        b = 1;
    }
    cout << (N - 1) / (K - 1) + b << endl;
}

Measured memory_bytes: 3712
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

K,A,B = map(int,input().split())

if K <= A:
    answer = 1
else:
    if A-B <= 0:
        answer = -1
    else:
        d = A-B
        x = K-A
        x += (-x)%d
        answer = 2 * x//d + 1
print(answer)

Measured memory_bytes: 3060
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z));
    return res;
}

void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}

#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
#else
#define debug(...) 42
#endif

const double PI = acos(-1);
typedef long long ll;
#define int ll
#define fori(n) for(int i=0; i<int(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;

void solve() {
    cini(x);
    vector<pii> q5;
    for(int i=-1000; i<=1000; i++) {
        int ii=i;
        for(int j=0; j<4; j++) 
            ii*=i;

        q5.push_back({ ii, i});
    }

    for(int i=0; i<q5.size(); i++) {
        for(int j=0; j<q5.size(); j++) {
            if(q5[i].first-q5[j].first==x) {
                cout<<q5[i].second<<" "<<q5[j].second<<endl;
                return;
            }
        }
    }
}

signed main() {
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    solve();
}



Measured memory_bytes: 3724
#include <iostream>
     
     
     
    int main(){
      
     	long long N;
      	std::cin>>N;
      	
      	long long sum = 0;
        if (N % 2 == 0){
          	N /= 2;
          	for (long long x=5; x<=N; x *= 5)
         		sum += N/x; 
        }
      	std::cout<<sum;
        	  
      
      
    }
  

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

int main()
{
    long long h;
    scanf("%lld",&h);
    long long cnt =0,k=1;
    while(h>=1)
    {
        h = h/2;

        cnt += k;
        k = k*2;
    }

    printf("%lld",cnt);

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e9;
const long long int mod = 1e9+7;
typedef pair<ll,ll> pairs;
vector<pairs> p;


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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<vector<ll>> combination(ll n, ll r){
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for(ll i=0;i<v.size();++i){
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for(ll i=1;i<v.size();++i){
        for(ll j=0;j<i;++j){
            v[i][j] = (v[i - 1][j - 1] + v[i - 1][j]);
        }
    }
    return v;
}
// ------------------------------------

int main(){
    ll n, k;
    cin>>n>>k;
    ll ans=0;
    for(ll i=k;i<=n+1;++i){
        ans += i*(n+1-i)+1;
    }
    cout<<ans%mod<<endl;

}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;

int main(){
  int n, k; cin >> n >> k;
  vector<int> p(n);
  for(int i = 0; i < n; i++){
    cin >> p[i];
  }
  sort(p.begin(), p.end());
  ll ans = 0;
  for(int i = 0; i < k; i++){
    ans += p[i];
  }
  cout << ans << endl;
  return 0;
}


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

bool check(
  int M, std::vector<int>& sw,
  std::vector<std::vector<int>>& s,
  std::vector<int>& p)
{
  int i;
  for (i = 0; i < M; i++) {
    auto & ks = s[i];
    int c = 0;
    for (auto & sno : ks) {
      c += sw[sno - 1];
    }
    if ((c % 2) != p[i]) break;
  }

  return (i == M);
}

std::vector<int> cre(int N, int n)
{
  std::vector<int> res(N, 0);
  for (int i = 0; i < N; i++) {
    res[i] = n % 2;
    n /= 2;
  }

  return res;
}

int main()
{
  int N, M;
  std::cin >> N >> M;
  std::vector<std::vector<int>> s(M);

  // for lights
  for (int i = 0; i < M; i++) {
    int k;
    std::cin >> k;
    s[i].resize(k);
    for (int j = 0; j < k; j++) {
      std::cin >> s[i][j];
    }
  }

  // for switch
  std::vector<int> p(M);
  for (int i = 0; i < M; i++) {
    std::cin >> p[i];
  }

  int x = 1;
  for (int i = 0; i < N; i++) {
    x *= 2;
  }

  long long ans = 0;
  for (int i = 0; i < x; i++) {
    std::vector<int> chk = cre(N, i);
    if (check(M, chk, s, p)) {
      ans++;
    }
  }

  std::cout << ans << std::endl;

  return 0;
}

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

int main()
{
	int h=0,m=0,s=0;
	cin >>s;
	h=s/3600;
	m=(s%3600)/60;
	s=(s%3600)%60; 	
	cout << h << ':' << m << ':' << s << '\n';

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9+7
#define mininf -922337203685477
#define pi acos(-1)
#define inf 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
typedef long long ll;
typedef unsigned long long ull;
int a, b;

int main(){
	fast
	int banyak=0;
	cin >> a >> b;
	int soket=1;
	while(soket<b){
		soket+=(a-1);
		banyak++;
	}
	cout << banyak << '\n';
}

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

int main(){
	int N;
	cin>>N;
	int H[N];
	for(int i=0;i<N;i++){
		int h;
		cin>>h;
		H[i]=h;
	}
	int number =1;
	for(int i=1;i<N;i++){
		int kaisu=0;
		for(int j=0;j<i;j++){
			if(H[i]>=H[j]){
				kaisu += 1;	
			}
		}
		if(kaisu == i){
			number += 1;
		}
	}
	cout<<number;
	return 0;
}	


Measured memory_bytes: 256