akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=2e5+10,M2=1e7+10,mod=1e9+7,inf=1e18+10;
int a[M],now;
int ask(int x)
{
	cout<<x<<endl;
	string tmp;
	cin>>tmp;
	if(tmp[0]=='V')now=0;
	else if(tmp[0]=='F')now=1;
	else now=2;
}
int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	int lo=0,hi=n-1;
	ask(0);
	if(now==0)return 0;
	int good=now;
	while(hi>lo+1)
	{
		int mid=(lo+hi)/2;
		ask(mid);
		if(now==0)return 0;
		int tmp=mid%2;
		if(tmp==0)
		{
			if(good==now)lo=mid;
			else hi=mid-1;
		}
		if(tmp==1)
		{
			if(good==now)hi=mid-1;
			else lo=mid;
		}
	}
	ask(lo);
	if(now==0)return 0;
	ask(hi);
	return 0;	
}

Measured memory_bytes: 852
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a<c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(long int &a,long int &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(long long int &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

int main()
{	
	forin(i,1,10)
	{
		forin(j,1,10)
		{
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}
	return 0;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    int n;
    cin>>n;
    vint a(n);
    cin>>a;
    ll now = 1000;
    REP(i, n - 1) {
        if (a[i] < a[i+1]){
            ll kosuu = now / a[i];
            now = (now - kosuu * a[i]) + a[i + 1] * kosuu;
        }
    }
    cout << now << endl;
}


Measured memory_bytes: 3604
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let v: Vec<isize> = s.trim().split_whitespace().map(|x| x.parse().unwrap()).collect();
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let t: Vec<isize> = s.trim().split_whitespace().map(|x| x.parse().unwrap()).collect();
    let mut x: isize = v[1];
    for i in 1..t.len() {
        x += v[1] - std::cmp::max(0, t[i-1]+v[1]-t[i]);
    }
    println!("{}", x);
}



Measured memory_bytes: 10492
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62)/2000;
const ld pi=acosl((ld)-1);
// const ll mod = 1000000007;
const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"
using vi=vector<ll>;

ll check(ll x,vector<ll>&A){
	rep(i,A.size()){
		x=x/A[i]*A[i];
	}
	return x;
}

bool solve(){
	ll k;cin>>k;
	vector<ll>A(k);
	rep(i,k)cin>>A[i];

	{ll right=INF;
	ll left=-1;
	while(right-left>1){
		ll mid=(right+left)/2;
		if(check(mid,A)>=2)right=mid;
		else left=mid;
	}
	if(check(right,A)!=2){
		cout<<-1<<endl;
		return false;
	}
	cout<<right<<endl;}
	
	{ll right=INF;
	ll left=-1;
	while(right-left>1){
		ll mid=(right+left)/2;
		if(check(mid,A)<=2)left=mid;
		else right=mid;
	}
	cout<<left<<endl;}
	return false;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	return solve();
}


Measured memory_bytes: 1024
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k==X:
        count+=1
print(count)

Measured memory_bytes: 3060
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using ld = long double;
using vld = vector<ld>;
using vvld = vector<vld>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

#define fst first
#define snd second

const int INF = 1e9;
struct edge
{
    int c;
    P p;
    edge(int c, P p) : c(c), p(p) {}
    bool operator>(const edge &r) const { return c > r.c; }
};
int main()
{

    int h, w, k, x1, y1, x2, y2;
    cin >> h >> w >> k;
    cin >> y1 >> x1 >> y2 >> x2;
    x1--;
    y1--;
    x2--;
    y2--;
    vvchar g(h, vchar(w));
    rep(y, h) rep(x, w) cin >> g[y][x];
    vvint v(h, vint(w, INF));

    priority_queue<edge, vector<edge>, greater<edge>> q;
    P start = P(y1, x1), goal = P(y2, x2);
    q.push(edge(0, start));
    v[y1][x1] = 0;

    vint dy = {0, 1, 0, -1}, dx = {1, 0, -1, 0};
    while (q.size())
    {
        edge e = q.top();
        q.pop();
        P p = e.p;

        if (p == goal)
        {
            break;
        }

        int now = e.c;
        rep(dir, 4) for (int i = 1; i <= k; i++)
        {
            int ny = p.fst + dy[dir] * i;
            int nx = p.snd + dx[dir] * i;
            if (ny < 0 || nx < 0 || ny > h - 1 || nx > w - 1 || g[ny][nx] == '@' || v[ny][nx] <= now)
            {
                break;
            }

            if (v[ny][nx] > now + 1)
            {
                v[ny][nx] = now + 1;
                q.push(edge(now + 1, P(ny, nx)));
            }
        }
    }

    ld ans = ceil(v[y2][x2]);
    if (ans == INF)
    {
        ans = -1;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 12020
N, M = map(int, input().split())
Cost = []
Key = []
for i in range(M):
    a, b = map(int, input().split())
    Cost.append(a)
    C_ = list(map(int, input().split()))
    C = 0
    for c in C_:
        C |= (1 << (c - 1))
    Key.append(C)
DP = [float('inf')] * (1 << N)
DP[0] = 0

for cost, key in zip(Cost, Key):
    D = DP[:]
    for i, d in enumerate(DP):
        if d == float('inf'):
            continue
        D[i|key] = min(D[i|key], d + cost)
    DP = D

if DP[-1] == float('inf'):
    print(-1)
else:
    print(DP[-1])



Measured memory_bytes: 77536
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ll long long int
using namespace std;

int main(void) {
  int a, b;
  cin >> a >> b;
  if (a<=8 && b <= 8 ) printf("Yay!\n");
  else printf(":(\n");
  
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main()
{
    ll X, K, D;
    cin >> X >> K >> D;
    ll ans = X;
    ll tmp = abs(X) / D;
    if (tmp < K) {
        if ((K - tmp) % 2 == 1) ans = min(abs(X % D - D), abs(X % D + D));
        else ans = abs(X % D);
    }
    else ans = min(abs(X - D * K), abs(X + D * K));
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3532
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    String t = in.readLine();
    int s_len = s.length();
    System.out.println(s.equals(t.substring(0,s_len))?"Yes":"No");
  }
}

Measured memory_bytes: 32476
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;

int main()
{
    ll n;
    scanf("%lld",&n);
    ll ans=10000000000000+1000;
    for(ll i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            ans=min(ans,i+n/i-2);
        }
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = s.size();
	ll ans = 0, num = s[0] - '0';
	rep(S,(1<<(n-1))){
		ll sum = 0;
		rep(i,n-1){
			if(S>>i & 1){
				sum += num;
				num = s[i+1] - '0';
			}
			else{
				num = (num * 10) + (s[i+1] - '0');
			}
		}
		sum += num;
		ans += sum;
		num = s[0] - '0';
		//cout << S << " " << sum << endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

ll n;

int main(){
	cin>>n;
	if(n==0){
		cout<<"0"<<endl;
		return 0;
	}
	string s;
	ll i=-2;
	while(n!=0){
		if(n%i!=0){
			n-=i/(-2);
			s='1'+s;
		}
		else s='0'+s;
		i*=(-2);
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a,b,c,temp;
	scanf("%d",&a);
	while(scanf("%d %d %d",&a,&b,&c)!=EOF){
	//replace a<b<c
	if(a>b)
	{
		temp=a;
		a=b;
		b=temp;
	}
	if(b>c)
	{
		temp=b;
		b=c;
		c=temp;
		
	}
		if(a>b)
	{
		temp=a;
		a=b;
		b=temp;
	}
	if((a*a+b*b)==c*c)
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}
	printf("\n");
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 584
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[][] students = new int[n][2];
        for(int i = 0; i < n; i++) {
          students[i][0] = sc.nextInt();
          students[i][1] = sc.nextInt();
        }
        int[][] points = new int[m][2];
        for(int i = 0; i < m; i++) {
          points[i][0] = sc.nextInt();
          points[i][1] = sc.nextInt();
        }
        for(int i = 0; i < n; i++) {
          int x1 = students[i][0];
          int y1 = students[i][1];
          int nearestIndex = 0;
          int ans = Integer.MAX_VALUE;
          for(int index = 0; index < m; index++) {
            int value = Math.abs(x1 - points[index][0]) 
                + Math.abs(y1 - points[index][1]);
            if (value < ans) {
              nearestIndex = index;
              ans = value;
            }
          }
          // 出力
		  System.out.println(nearestIndex + 1);
        }
	}
}

Measured memory_bytes: 21204
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

ll dp[11][2][2][2][2][2];

int main(){
  string s;
  cin>>s;
  ll n = s.size();
  dp[0][0][0][0][0][0] = 1;
  for(ll i=0; i<n; i++) {
    ll D = s[i]-'0';
    for(ll j=0; j<2; j++) {
      for(ll k=0; k<2; k++) {
	for(ll l=0; l<2; l++) {
	  for(ll m=0; m<2; m++) {
	    for(ll z=0; z<2; z++) {
	      for(ll d=0; d<=(j ? 9 : D); d++) {
		if((z or d!=0) and d!=7 and d!=5 and d!=3)continue;
		dp[i+1][j || (d<D)][k || (d==7)][l || (d==5)][m || (d==3)][z || (d!=0)] +=
		  dp[i][j][k][l][m][z];
	      }	      
	    }
	  }
	}
      }
    }
  }
  std::cout << dp[n][0][1][1][1][1]+dp[n][1][1][1][1][1] << std::endl;
  return 0;
}



Measured memory_bytes: 256
//Name: Broken Audio Signal
//Level: 2
//Category: シミュレーション
//Note:

/**
 * xがとり得る値の上限と下限を覚えておきながら、数列を走査していく。
 * xが連続していたり、途中でxが絡まない矛盾が発生していたりすることに注意。
 * また、xのとり得る範囲はa_iがとり得る範囲よりすこし広い。
 *
 * オーダーは O(N)。
 */

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>

using namespace std;

enum Type {
    NUM, X
};

struct Tag {
    Type type;
    int val;
};

bool solve() {
    int N;
    if(!(cin >> N)) return false;
    if(!N) return false;

    vector<Tag> v(N);
    for(int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        if(s == "x") {
            v[i].type = X;
        } else {
            v[i].type = NUM;
            v[i].val = stoi(s);
        }
    }

    pair<int,int> res(-1000000000-10, 1000000000+10);
    bool inconsistent = false;
    for(int i = 0; i < N; ++i) {
        if(v[i].type == X) {
            if(i % 2 == 1) {
                if(i > 0) res.first = max(res.first, v[i-1].val+1);
                if(i < N-1) res.first = max(res.first, v[i+1].val+1);
            } else {
                if(i > 0) res.second = min(res.second, v[i-1].val-1);
                if(i < N-1) res.second = min(res.second, v[i+1].val-1);
            }
            if(i > 0 && v[i-1].type == X) inconsistent = true;
        } else {
            if(i % 2 == 1) {
                if(i > 0 && v[i-1].type == NUM) inconsistent = inconsistent || (v[i-1].val >= v[i].val);
                if(i < N-1 && v[i+1].type == NUM) inconsistent = inconsistent || (v[i+1].val >= v[i].val);
            } else {
                if(i > 0 && v[i-1].type == NUM) inconsistent = inconsistent || (v[i-1].val <= v[i].val);
                if(i < N-1 && v[i+1].type == NUM) inconsistent = inconsistent || (v[i+1].val <= v[i].val);
            }
        }
        //cout << res.first << ' ' << res.second << endl;
    }
    if(inconsistent || res.first > res.second) {
        cout << "none" << endl;
    } else if(res.first == res.second) {
        cout << res.first << endl;
    } else {
        cout << "ambiguous" << endl;
    }
    return true;
}

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

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
string in[101];
int main()
{
	int n;
	cin>>n>>in[1];
	for(int i=2;i<=n;i++)
	{
		cin>>in[i];
		string a=in[i],b=in[i-1];
		if(a[0]!=b[b.size()-1])
		{
			printf("No");
			return 0;
		}
		for(int j=1;j<i;j++)
			if(!in[j].compare(in[i]))
			{
				printf("No");
				return 0;
			}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 256
A, B, C, D = (int(i) for i in str(input()))

if A+B+C+D==7:
    print("{}+{}+{}+{}=7".format(A,B,C,D))
elif A-B+C+D==7:
    print("{}-{}+{}+{}=7".format(A,B,C,D))
elif A+B-C+D==7:
    print("{}+{}-{}+{}=7".format(A,B,C,D))
elif A+B+C-D==7:
    print("{}+{}+{}-{}=7".format(A,B,C,D))
elif A-B-C+D==7:
    print("{}-{}-{}+{}=7".format(A,B,C,D))
elif A+B-C-D==7:
    print("{}+{}-{}-{}=7".format(A,B,C,D))
elif A-B+C-D==7:
    print("{}-{}+{}-{}=7".format(A,B,C,D))
elif A-B-C-D==7:
    print("{}-{}-{}-{}=7".format(A,B,C,D))

Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
	int a,s,d,f;
	scanf("%d",&a);
	while(a!=0){
	d=0;
	s=1000-a;
	while(s!=0){
	if(s>=500){
		s=s-500;
		d++;
	}
	else if(s>=100){
		s=s-100;
		d++;
	}
	else if(s>=50){
		s=s-50;
		d++;
	}
	else if(s>=10){
		s=s-10;
		d++;
	}
	else if(s>=5){
		s=s-5;
		d++;
	}
	else if(s>=1){
		s=s-1;
		d++;
	}
	}
	printf("%d\n",d);
	scanf("%d",&a);
	}
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
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;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n;
  cin >> n;
  ll res = 0;
  rep(i, n) {
    ll a;
    cin >> a;
    res += a-1;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
import itertools
import math
N,M = map(int,input().split())
if abs(N-M)>1:
	print(0)
elif abs(N-M)==1:
	print(math.factorial(N)*math.factorial(M)%((10**9)+7))
else:
	print(2*math.factorial(N)*math.factorial(M)%((10**9)+7))

Measured memory_bytes: 5172
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

x = int(input())
for i in range(x,10**7):
    if is_prime(i):
        print(i)
        exit()


Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int d;
	if(s=="MON") d=1;
	if(s=="TUE") d=2;
	if(s=="WED") d=3;
	if(s=="THU") d=4;
	if(s=="FRI") d=5;
	if(s=="SAT") d=6;
	if(s=="SUN") d=0;
	cout<<7-d<<endl;
	return 0;
}


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

long long dp[105][105];
pair<int,int> p[105];

int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) dp[i][j]=2e9;
    for(int i=0;i<n;i++) {cin>>p[i].first>>p[i].second;dp[i][i]=0;}
    for(int i=0;i < n;i++){
        for(int j=i;j < n;j++){
            for(int k=i;k<j;k++){
                dp[i][j] = min(dp[i][j],dp[i][k]+dp[k+1][j]+p[i].first*p[k].second*p[j].second);
            }
        }
    }
    for(int i=0;i < n;i++){
        for(int j=i;j < n;j++){
            for(int k=i;k<j;k++){
                dp[i][j] = min(dp[i][j],dp[i][k]+dp[k+1][j]+p[i].first*p[k].second*p[j].second);
            }
        }
    }
    cout<<dp[0][n-1]<<endl;
    return 0;
}



Measured memory_bytes: 3168
class Point
  ANGLE = Math::PI * 60 / 180

  attr_reader :x, :y
  def initialize(x, y)
    @x = x.to_f
    @y = y.to_f
  end

  def make_split_points(other)
    wx = (other.x - x) / 3.0
    wy = (other.y - y) / 3.0

    left = Point.new(x + wx, y + wy)
    right = Point.new(x + wx * 2, y + wy * 2)
    middle = left.make_vertex(right)
    [left, middle, right]
  end

  def make_vertex(other)
    dx = other.x - x
    dy = other.y - y

    dist = Math.sqrt(dx**2 + dy**2)
    rotate = Math.atan2(dy, dx) + ANGLE

    Point.new(@x + dist * Math.cos(rotate), @y + dist * Math.sin(rotate))
  end

  def to_s
    "#{@x} #{@y}"
  end
end

def koch(points)
  result = []
  points.each_with_index do |p1, i|
    result << p1

    break if i == points.size - 1

    p2 = points[i + 1]
    result.concat(p1.make_split_points(p2))
  end
  result
end

n = gets.to_i

points = []
points << Point.new(0, 0)
points << Point.new(100, 0)

n.times do
  points = koch(points)
end

points.each{|p| puts p}

Measured memory_bytes: 9404
// https://atcoder.jp/contests/abc174/tasks/abc174_f

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

struct Fenwick {
  vector<ll> tree;

  Fenwick(ll n) : tree(vector<ll>(n, 0)) {}

  // sum of [0, i)
  ll sum(ll i) {
    ll res = 0;

    for (i--; i >= 0; i = (i & (i + 1)) - 1) {
      res += tree[i];
    }

    return res;
  }

  void add(ll i, ll n) {
    for (ll len = tree.size(); i < len; i |= i + 1) {
      tree[i] += n;
    }
  }
};

void solve() {
  ll N, Q;
  cin >> N >> Q;

  VL cs(N);
  rep(i, N) cin >> cs[i];

  VL last_i(N + 1, -1);  // 各数字の最後に現れた index
  VL next_index(N, -1);  // 次に同じ数字が現れる index

  rep(i, N) {
    ll last = last_i[cs[i]];
    if (last != -1) next_index[last] = i;
    last_i[cs[i]] = i;
  }

  V<VPL> qs(N);
  rep(qi, Q) {
    ll l, r;
    cin >> l >> r;
    --l, --r;
    qs[l].emplace_back(r, qi);
  }

  Fenwick bit(N);
  VL res(Q);

  // その範囲 (r - l + 1) から重複分を引く
  repr(l, N) {
    if (next_index[l] != -1) bit.add(next_index[l], 1);

    for (auto [r, qi] : qs[l]) {
      res[qi] = r - l + 1 - bit.sum(r + 1);
    }
  }

  rep(i, Q) cout << res[i] << "\n";
}


Measured memory_bytes: 48164
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.buffer.readline

    N, C, K = map(int, input().split())
    T = []
    for _ in range(N):
        T.append(int(input()))
    T.sort()

    if C == 1:
        print(N)
        exit()

    cnt = 0
    ans = 0
    t0 = -10**10
    for t in T:
        if t0 + K < t:
            t0 = t
            cnt = 1
            ans += 1
        else:
            cnt += 1
            if cnt == C:
                cnt = 0
                t0 = -10**10
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 43736
n = gets.to_i
a = gets.split.map(&:to_i)

equal = Array.new(10001, 0)
n.times {|i| equal[a[i]] += 1}

equal[-1] = 0
10000.times {|i| equal[i] += equal[i - 1]}

result = Array.new(n)
n.times do |i|
  result[equal[a[i] - 1]] = a[i]
  equal[a[i] - 1] += 1
end

puts result.join(" ")


Measured memory_bytes: 152944
import java.util.Scanner
import scala.util.control.Breaks

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)

    val N = sc.nextInt
    val S = sc.next

    val rui_fromL, rui_fromR = Array.fill[Int](N)(0)
    (0 until N).foreach(i => {
      if (S(i) == 'W') rui_fromL(i) = 1
      else rui_fromR(i) = 1
    })

    (1 until N).foreach(i => {
      rui_fromL(i) += rui_fromL(i-1)
    })
    (0 until N-1).reverse.foreach(i => {
      rui_fromR(i) += rui_fromR(i+1)
    })

    var ans = N
    (0 until N).foreach(i => {
      ans = math.min(ans, rui_fromL(i) + rui_fromR(i) - 1)
    })

    println(ans)
  }
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<long long> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
	}
	long long  ans = 0;

	for (int i = 1; i < N; i++) {
		if (A.at(i - 1) > A.at(i)) {
			ans += (A.at(i - 1) - A.at(i));
			A.at(i) = A.at(i - 1);
		}
	}
	cout << ans << endl;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N; cin >> N;
    vector<ll> v(N); rep(i, N){cin >> v.at(i);}
    sort(v.begin(), v.end());
    double ans = (double)(v.at(0) + v.at(1)) / 2.0;
    if (v.size() >= 3){
        rep(i, N-2){
            ans = (ans + v.at(i+2)) / 2.0;
        }
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

#define FOR(i, a, b) for(int(i)=(a);(i)<(b);(i)++)
#define REP(i, n) FOR((i), 0, (n))

#define RFOR(i, b, a) for(int(i)=(b); (i)>=(a); (i)--)
#define RREP(i, n) FOR((i), (n), 0)

#define pb push_back
#define mp make_pair 

using namespace std;

const int INF=INT_MAX/4;
const int MOD=1000000007;
const double EPS=1e-14;

const bool debug_flag=true;

void debug(string str){
	if(debug_flag){
		cout<<str<<endl;
	}
}

void debugs(string str){
	if(debug_flag){
		cout<<str;
	}
}

vector < vector < long > > dis;
int N;

void warshallfloyd(){
	for(int k=0; k<N; k++){
		for(int i=0; i<N; i++){
			for(int j=0; j<N; j++){
				dis[i][j]=min(dis[i][j], dis[i][k]+dis[k][j]);
			}
		}
	}
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout.precision(10);


	int M, R;
	cin>>N>>M>>R;
	vector<int> r(R);
	for(int i=0; i<R; i++){
		cin>>r[i];
	}
	sort(r.begin(), r.end());
	
	int a, b, c;
	dis = vector<vector<long>>(N, vector<long>(N, MOD));
	for(int i=0; i<M; i++){
		cin>>a>>b>>c;
		dis[a-1][b-1]=c;
		dis[b-1][a-1]=c;
	}

	warshallfloyd();

	long s=MOD, p=0;
	do{
		p=0;
		for(int i=0; i<R-1; i++){
			p+=dis[r[i]-1][r[i+1]-1];
		}
		if(p<s){
			s=p;
		}
	}while(next_permutation(r.begin(), r.end()));

	cout<<s<<endl;

	return 0;
}



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

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

    ll X, Y;
    cin >> X >> Y;

    ll ans = 0;

    while(X <= Y) {
        ans++;
        X *= 2LL;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            char stmp[] = new char[n];
            String str = sc.next();
            int count = 0;
            for(int i = 0 ; i < n ; i++)
                stmp[i] = str.charAt(i);
            char lastc = stmp[0];
            for(int i = 1 ; i < n ; i++)
            {
		if(i == n-1 && stmp[i] != lastc)
			count++;
                else if(stmp[i] != lastc)
                {
                    count++;
                    lastc = stmp[i+1];
                    i++;
                }
                else
                    lastc = stmp[i];
            }
            System.out.println(count);
    }
}


Measured memory_bytes: 29808
N=int(input())
S=list(input())
ans=0
R=0
G=0
B=0
for i in range(N):
    if S[i]=="R":
        R=R+1
    elif S[i]=="G":
        G=G+1
    else:
        B=B+1
ans=R*G*B
for i in range(N-2):
    for j in range(i+1,N-1):
        if S[i]!=S[j]:
            k=2*j-i
            if N<=k:
                continue
            if S[i]!=S[k] and S[k]!=S[j]:
                ans=ans-1
print(ans)

Measured memory_bytes: 9132
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) std::cin>>(P)
#define IN2(P1,P2) std::cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) std::cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) std::cin>>V[I]
#define OUT(P) std::cout<<P<<std::endl
#define OUT2(P1,P2) std::cout<<P1<<" "<<P2<<std::endl
#define OUT3(P1,P2,P3) std::cout<<P1<<" "<<P2<<" "<<P3<<std::endl
#define OUTS(I,N,V) REP(I,N) std::cout<<V[i]<<std::endl
#define ALL(C) (C).begin(),(C).end()
using namespace std;
using namespace __gnu_pbds;
typedef unsigned long ul;
ul N,v[100001][3],dp[100001][3],i,j,k,ans;
inline void solve(){
  IN(N);
  REP(i,N){
    IN3(v[i][0],v[i][1],v[i][2]);
  }
  REP(i,N){
    REP(j,3){
      REP(k,3){
        if(j==k)continue;
        dp[i+1][j]=max(dp[i+1][j],dp[i][k]+v[i][j]);
      }
    }
  }
  REP(i,3)ans=max(ans,dp[N][i]);
  OUT(ans);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll x;
    cin>>x;
    ll ans=0;
    while(x>=500){
        x-=500;
        ans+=1000;
    }
    while(x>=5){
        x-=5;
        ans+=5;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
	int a,b,c,n,i;
	while(scanf("%d",&n)!=EOF)
	{
		for(i=0;i<n;i++)
		{	scanf("%d%d%d",&a,&b,&c);
		if((a*a+b*b==c*c)||(a*a+c*c==b*b)||(b*b+c*c==a*a))
			printf("YES\n");
		else
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 576
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,m=INTM()
    h=LIST()
    hantei=[1]*n
    for i in range(m):
        a,b=INTM()
        a=a-1
        b=b-1
        if h[a]>h[b]:
            hantei[b]=0
        elif h[a]<h[b]:
            hantei[a]=0
        else:
            hantei[a]=0
            hantei[b]=0
    print(sum(hantei))

    
if __name__ == '__main__':
    do()

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

const int MAX_N = 110000;

int dp[MAX_N]; // dp[i] が i についての答え

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

    // 初期化
    for (int i = 0; i < MAX_N; ++i) dp[i] = -1;
    dp[0] = 0;
    queue<int> que;
    que.push(0);

    // BFS
    while (!que.empty()) {
        int v = que.front();
        que.pop();

        for (int pow6 = 1; v + pow6 <= N; pow6 *= 6) {
            if (dp[v + pow6] == -1) {
                dp[v + pow6] = dp[v] + 1;
                que.push(v + pow6);
            }
        }
        for (int pow9 = 1; v + pow9 <= N; pow9 *= 9) {
            if (dp[v + pow9] == -1) {
                dp[v + pow9] = dp[v] + 1;
                que.push(v + pow9);
            }
        }
    }

    cout << dp[N] << endl;
}

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

#define int long long
#define debug(x) cout<<#x<<" "<<x<<endl;

const int N=1e6+5;
const double eps=1e-9;
const int INF=1e18;

signed main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n,id=0;cin>>n;
    for(int i=1;i<=n;i++){
        if(i%3==0||i%5==0) continue;
        else id+=i;
    }
    cout<<id<<endl;
    return 0;
}

//Created Time  :2020/4/12 20:06:46


Measured memory_bytes: 3636
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back
#define inf 10000000000000000
#define N 1000000007
#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.x<<','<< P.y<<')';}
template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}

//edge cases when n=1 , m=1. wrong variable in loop. if<->while
signed main()
{
	speed
	//global var
	int x;cin>>x;
	int q=x/500;
	int r=x%500;
	cout<<((1000*q)+(5*(r/5)))<<"\n";
}

Measured memory_bytes: 256
class Chokudai
    def initialize(n)
        @root_size = []
        (n + 1).times do |i|
            @root_size.push([i, 1])
        end
        @usage_list = [n * (n - 1) / 2]
    end

    def connect(a, b)
        ret_size = 0
        ua = self.search(a)
        ub = self.search(b)
        ra = ua[0]
        rb = ub[0]
        if @root_size[ra][0] != @root_size[rb][0] then
            ret_size = @root_size[ra][1] * @root_size[rb][1]
            @root_size[ra][1] += @root_size[rb][1]
            while ub.size > 0
                s = ub.pop
                @root_size[s][0] = ra
                @root_size[s][1] = 0
            end
        end
        @usage_list.unshift(@usage_list[0] - ret_size)
    end

    def search(x)
        temp = x
        union = [x]
        while @root_size[temp][0] != temp
            temp = @root_size[temp][0]
            union.unshift(temp)
        end
        return union
    end

    def answer
        @usage_list.shift
        @usage_list.each do |usage|
            puts(usage)
        end
        
    end
end
inputs = STDIN.readlines.map{|line|line.strip.split()}
line = inputs.shift

n = line[0].to_i
m = line[1].to_i

chokudai = Chokudai.new(n)
inputs.reverse.each do |input|
    a = input[0].to_i
    b = input[1].to_i

    chokudai.connect(a, b)
end
chokudai.answer

Measured memory_bytes: 44284
fun c90(args: Array<String>) {
    val (n, m) = args[0].split(" ").map { it.toLong() }
    when {
        n == 1L && m == 1L -> println(1)
        n == 1L -> println(m - 2)
        m == 1L -> println(n - 2)
        else -> println((n - 2) * (m - 2))
    }
}

fun main(args: Array<String>) {
    c90(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  LL N; cin >> N;
  LL m;
  for(m=1;m<=N;++m){
	if(m*(m+1)/2 >= N) break;
  }

  VI ans;
  for(int i=m;i>0;--i){
	if(N >= i){
	  ans.PB(i);
	  N -= i;
	}
  }
  for(int x: ans)
	cout << x << endl;

  return 0;
}


Measured memory_bytes: 384
[L, R, d] = list(map(int, input().split()))
max_d = R // d
min_d = L // d
sho_R = R % d
sho_L = L % d
if sho_R == 0 and sho_L == 0:
  ans = max_d - min_d + 1
else:
  ans = max_d - min_d
print(ans)

Measured memory_bytes: 8996
unittest
{
//	assert( [ "PD?D??P" ].parse.expand.solve == "PDPDPDP" );
	assert( [ "PD?D??P" ].parse.expand.solve == "PDDDDDP" );
	assert( [ "P?P?" ].parse.expand.solve == "PDPD" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto t = input.front.to!( dchar[] );
	return tuple( t );
}

auto solve( dchar[] t )
{
	return t.replace( "?", "D" );
}


Measured memory_bytes: 5384
#include<stdio.h>
#include<math.h>


float M[100][100], Q[100];

int MCM(int n){
  int i, j, l, k, q;
  for(i=1 ; i<=n ; i++)M[i][i];

  for(l=2 ; l<=n ; l++){
    for(i=1 ; i<=n-l+1 ; i++){
      j = i+l-1;
      
      for(k=i ; k<=j-1 ; k++){
	q = M[i][k] + M[k+1][j] + Q[i-1]*Q[k]*Q[j];
	if(M[i][j] > q || k==i)M[i][j] = q;

      }
    }
  }

  return M[1][n];
}

int main(){
  int n, i;
  scanf("%d",&n);

  for(i=0 ; i<n ; i++){
  scanf("%f%f",&Q[i], &Q[i+1]);
  }

 
  printf("%d\n",MCM(n));
  
  return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define li 100005
#define mp make_pair
#define lo long long 
#define pb push_back
#define inf 1000000000
#define md 1000000007
int n,t,mn=inf;
int main(){
	scanf("%d %d",&n,&t);
	for(int i=1;i<=n;i++){
		int ci,ti;
		scanf("%d %d",&ci,&ti);
		if(ti<=t) mn=min(mn,ci);
	}
	if(mn==inf) cout<<"TLE\n";
	else cout<<mn;
	return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

vector<ll> test(ll n,ll k,vector<ll> a){
  while(k--){
    vector<ll> b(n+1);
    rep(i,n){
      ll s = max<ll>(0ll,i-a[i]);
      ll t = min<ll>(n-1,i+a[i]);
      b[s]++;
      b[t+1]--;
    }
    rep(i,n)b[i+1]+=b[i];
    b.pop_back();
    dump(b);
    a = b;
    bool brk = true;
    for(auto&ai:a)if(ai!=n)brk=false;
    if(brk)break;
  }
  return a;
}

signed main(){

  ll n,k;
  cin>>n>>k;
  vector<ll> a(n);
  cin>>a;
  a = test(n,k,a);
  cout<<(a)<<endl;

}

Measured memory_bytes: 8008
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>


char S[50];

int main()
{
  int cnt;
  int i;
  int win=0;
  int lose=0;

  cnt = scanf("%s", S);
  cnt = strlen(S);

  for (i=0; i<cnt; i++) {
    if (S[i] == 'o') {
      win++;
    } else if (S[i] == 'x') {
      lose++;
    }
  }

  if (lose > 7) {
    printf("NO");
    return 0;
  }

  printf("YES");
  
  return 0;
}



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

int main() {
	int n;
	string s;
	cin >> n >> s;
	int countw = 0, w[300000], e[300000];
	for (int i = 0; i < n; i++) {
		if (s[i] == 'W')
			countw++;
		w[i] = countw;
		e[i] = i - countw + 1;
	}
	int least = 3 * 10e5;
	for (int i = 1; i < n - 1; i++)
		if (least > w[i - 1] + e[n - 1] - e[i])
			least = w[i - 1] + e[n - 1] - e[i];
	cout << min(min(e[n - 1] - e[0], w[n - 2]), least) << endl;
	return 0;
}

Measured memory_bytes: 2948
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

int main(){
    int D;
    cin >> D;
    vector<int> c(26);
    rep(i,26) cin >> c[i];
    vector<vector<int>> s(D,vector<int>(26));
    rep(j,D) rep(i,26) cin >> s[j][i];

    vector<int> t(D);
    vector<vector<int>> last(26, vector<int>(1,-1));
    Int manzoku = 0;

    rep(j,1) {
        int maxs = 0;
        rep(i,26) maxs = max(maxs, s[j][i]);
        vector<int> v(0); //s[j][i]が最も大きくなるようなiを入れる
        rep(i,26) {
            if (s[j][i] == maxs) {
                v.push_back(i+1);
            }
        }
        if (v.size() == 1) {
            t[j] = v[0];
            last[t[j]-1].push_back(j);
        }
        else { //仮
            t[j] = v[0];
            last[t[j]-1].push_back(j);
        }
    }
    int i = t[0]-1;
    rep1(j,D-1) {
        i = (i + 1) % 26;
        t[j] = i+1;
        last[t[j]-1].push_back(j);
    }


    rep(i,26) last[i].push_back(D);

    vector<int> nums(26,0);
    rep(i,26) nums[i] = last[i].size();

    int M = 100000;
    int cnt = 0;
    rep(k,M) {
        int d, q;
        vector<pair<int,int>> vp(26);
        rep(i,26) vp[i] = make_pair(c[i] - 4 * nums[i],i);
        sort(vp.begin(),vp.end());
        reverse(vp.begin(),vp.end());
        q = vp[0].second + 1;
        int p;
        for (int j = 25; j>=0; j--) {
            p = vp[j].second;
            if (last[p].size() == 2) continue;
            else {
                break;
            }
        }
        if (last[p].size() <= 2) continue;
        int lpsz = last[p].size() - 2;
        d = last[p][1 + (cnt % lpsz)] + 1;
        manzoku = 0;

        manzoku -= s[d-1][t[d-1]-1];
        manzoku += s[d-1][q-1];

        auto iteold = find(last[t[d-1]-1].begin(), last[t[d-1]-1].end(), d-1);
        int old_last = *(iteold-1);
        manzoku -= c[t[d-1]-1] * (d-1 - old_last) * (*(iteold+1) - (d-1));

        auto itenew = upper_bound(last[q-1].begin(), last[q-1].end(), d-1);
        int new_last = *(itenew-1);
        manzoku += c[q-1] * (d-1 - new_last) * (*itenew - (d-1));

        if (manzoku > 0) {
            //更新したほうがよいならこれをやる
            last[t[d-1]-1].erase(iteold);
            last[q-1].insert(itenew,d-1);
            t[d-1] = q;
            nums[t[d-1]-1]--;
            nums[q-1]++;
        
        }
        cnt++;
        //cout << manzoku << endl;
    }

    rep(j,D) cout << t[j] << endl;
}

Measured memory_bytes: 3600
n,k = map(int, input().split())
p=list(map(int, input().split()))
p.insert(0,0)
for i in range(n):
    p[i+1] += p[i]
ans = 0
for i in range(k, n+1):
    ans = max(ans, p[i]-p[i-k])
print((ans+k)/2)


Measured memory_bytes: 32188
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using namespace std;

using ll=long long;

using vi=vector<int>;
using vll=vector<ll>;
using vvi=vector<vi>;
using vs=vector<string>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N; cin >>N;
  vll X(N);
  vll Y(N);
  rep(i,0,N) {
    cin >>X[i];
    Y[i]=X[i];
  }
  sort(all(Y));
  int m=N/2;
  int mida=Y[m-1];
  int midb=Y[m];
  rep(i,0,N) {
    if (X[i]<=mida) {
      cout <<midb <<'\n';
    } else {
      cout <<mida <<'\n';
    }
  }
  return 0;
}


Measured memory_bytes: 6352
using System;
using System.Collections.Generic;

namespace ABC066_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var num = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var ans = new List<int>();

            if(n % 2 == 1)
            {
                for (var i = 0; i < n; i++)
                {
                    if (i % 2 == 0)
                    {
                        ans.Insert(0, num[i]);
                    }
                    else
                    {
                        ans.Add(num[i]);
                    }
                }
            }
            else
            {
                for (var i = 0; i < n; i++)
                {
                    if (i % 2 == 0)
                    {
                        ans.Add(num[i]);
                    }
                    else
                    {
                        ans.Insert(0, num[i]);
                    }
                }
            }
            var s = string.Join(" ", ans);
            Console.WriteLine(s);
        }
    }
}


Measured memory_bytes: 51128