akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 //https://pitsbuffersolution.com/compro/atcoder/arc089e.php
typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int A,B;
int d[11][11];
const int C = 101;
int S = 1 , T = 2 * C;
int N = T , M = 2 * (C-1) + C * C;
int e[C][C];
 
int main(){
	cin >> A >> B;
	repp(i,1,A+1) repp(j,1,B+1) cin >> d[i][j];
	repp(i,0,C) repp(j,0,C){
		repp(x,1,A+1) repp(y,1,B+1) e[i][j] = max(e[i][j] , d[x][y]-i*x-j*y);
	}
	repp(x,1,A+1) repp(y,1,B+1){
		int z = C;
		repp(i,0,C) repp(j,0,C) z = min(z,e[i][j]+i*x+j*y);
		if(z != d[x][y]) return cout << "Impossible" << endl , 0;
	}
	cout << "Possible" << endl;
	cout << N << ' ' << M << endl;
	repp(i,1,C){
		cout << i << ' ' << i+1 << " X" << endl;
		cout << C+i << ' ' << C+i+1 << " Y" << endl;
	}
	repp(i,0,C) repp(j,0,C) cout << i+1 << ' ' << N-j << ' ' << e[i][j] << endl;
	cout << S << ' ' << T << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


int eras(int x){
	int cnt = 0;
	rep1(i,x+1){
		if(x%i==0){cnt++;}
	}
	return cnt;
}


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

	string s;
	ll k;
	cin >> s >> k;
	int atai=1;
	int l = 0;
	rep(i,s.size()){
		if(s[i]!='1'){
			l = i; 
			atai = s[i]-'0';
			break;
		}
	}
	if(k-1>=l){cout << atai << endl;}
	else {cout << 1 << endl;}
    return 0;
}


Measured memory_bytes: 256
--https://www.lua.org/pil/11.4.html
local List = {}
function List.new ()
  return {first = 0, last = -1}
end

function List.pushleft (list, value)
  local first = list.first - 1
  list.first = first
  list[first] = value
end

function List.pushright (list, value)
  local last = list.last + 1
  list.last = last
  list[last] = value
end

function List.popleft (list)
  local first = list.first
  if first > list.last then return false end
  local value = list[first]
  list[first] = nil
  list.first = first + 1
  return value
end

function List.popright (list)
  local last = list.last
  if list.first > last then return false end
  local value = list[last]
  list[last] = nil
  list.last = last - 1
  return value
end

----------

local k=io.read("n")

local que=List.new()
for i=1,9 do
    List.pushright(que,i)
end

for i=1,k-1 do
    local pop=List.popleft(que)
    for j=-1,1 do
        local add=(pop%10)+j
        if 0<=add and add<=9 then
            List.pushright(que,pop*10+add)
        end
    end
end
print(List.popleft(que))

Measured memory_bytes: 18684
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class C { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long I = GetLong();
		long O = GetLong();
		long T = GetLong();
		long J = GetLong();
		long L = GetLong();
		long S = GetLong();
		long Z = GetLong();

		long ans = O + f(I) + f(J) + f(L);
		if(I > 0 && J > 0 && L > 0)
			chmax(ref ans, O + f(I - 1) + f(J - 1) + f(L - 1) + 3);

		WriteLine(ans);
	}

	private long f(long x) => (x / 2) * 2;
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


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

int main () {
  double N;
  cin >> N;
  
  int count = 0;
  for (int i = 0; i < N; i++) {
    if ((i+1)%2 == 1) {
      count ++;
    }
  }
  cout << fixed << setprecision(10);
  double a = count / N;
  cout << a << endl;
}


Measured memory_bytes: 256
using System;

namespace abc160_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string coffee = Console.ReadLine();
            if(coffee.Substring(2,1)== coffee.Substring(3, 1)&& coffee.Substring(4, 1) == coffee.Substring(5, 1))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            Console.ReadLine();

        }
    }
}


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

ll Check(ll a,ll res,ll now) {
  ll number = S[a] - '0';
  if (a == S.size()) {
    return (res + now);
  }
  else {
    return(Check(a + 1,res + (now * 10) + number,0) + Check(a + 1,res,(now * 10) + number));
  }
}

int main() {
  cin >> S;
  cout << (Check(0,0,0)) / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(void)
{
  string s; cin>>s;
  int c[26]={0};
  
  for(int i=0;i<s.size();i++){
    int num=s[i]-'a';
    c[num]++;
    if(c[num]>=2){puts("no"); return 0;}
  }
  
  puts("yes");
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)











int main(){
    ll n;
    cin >> n;
    vector<pair<ll, ll>> v(n);
    REP(i, n){
        cin >> v[i].second >> v[i].first;
    }
    sort(v.begin(), v.end());
    ll t = 0;
    REP(i, n){
        t += v[i].second;
        if(t > v[i].first){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

typedef long double ld;
typedef long long int ll;
vector<vector<ll> > adjlist;
ll max(ll x,ll y){return (x>y)?x:y;} 
#define min(x,y) (x>y)?y:x
#define sfor(a,n,i) for(ll i=a;i<n;i++)
#define rfor(n,a,i) for(ll i=n;i>=a;i--)
#define mod 1000000007
#define pb push_back
#define in insert
#define mp make_pair
#define inf mod
#define bg begin()
#define ed end()
#define sz size()
#define vi vector<ll>
#define vinv vector<vector<ll> >
#define imap map<ll,ll>
#define cmap map<char,ll>
#define smap map<string,ll>
#define iset set<ll>
#define bit(x,i) (x&(1<<i))
int main()
{
    string s;
    cin>>s;
    ll n=s.sz;
    ll ans=0;
    sfor(0,n/2,i)
    {
        if(s[i]!=s[n-i-1])
        ans++;

    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


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

    int t=1,te=0;
    // cin>>t;
    while(t--){
        int n,k,c=0;

        cin>>n>>k;

        while(n>0){
            n/=k;
            ++c;
        }

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



        //printf("Case %d: ",++te);
    }
    return 0;
}

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

int cmpnum(const void * n1, const void * n2)
{
	if (*(long *)n1 > *(long *)n2)
	{
		return 1;
	}
	else if (*(long *)n1 < *(long *)n2)
	{
		return -1;
	}
	else
	{
		return 0;
	}
}

long XOR(long a, long b){
  long bit_a[30],bit_b[30],bit_xor[30];
  for (int i = 0; i < 30; i++) {
    bit_a[i] = 0;
    bit_b[i] = 0;
  }
  bit_a[0] = a;
  bit_b[0] = b;
  for (int i = 1; i < 30; i++) {
    bit_a[i] += bit_a[i-1]/2;
    bit_a[i-1] %= 2;
    bit_b[i] += bit_b[i-1]/2;
    bit_b[i-1] %= 2;
  }
  for (int i = 0; i < 30; i++) {
    if (bit_a[i] == bit_b[i]) {
      bit_xor[i] = 0;
    } else {
      bit_xor[i] = 1;
    }
  }
  for (int i = 28; i >= 0; i--) {
    bit_xor[i] += bit_xor[i+1]*2;
  }
  return bit_xor[0];
}

int main(void) {

  int n;
  scanf("%d", &n);
  long a[n];
  for (int i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  qsort(a, n, sizeof(long), cmpnum);
  if (a[n-1] == 0) {
    printf("Yes\n");
    return 0;
  }
  if (n%3 != 0) {
    printf("No\n");
    return 0;
  }
  if (a[n/3-1] == 0 && a[n/3] != 0 && a[n/3] == a[n-1]) {
    printf("Yes\n");
    return 0;
  }
  if (a[0] == a[n/3-1] && a[n/3-1] != a[n/3] && a[n/3] == a[n*2/3-1] && a[n*2/3-1] != a[n*2/3] && a[n*2/3] == a[n-1] && XOR(a[0],a[n/3]) == a[n*2/3]) {
    printf("Yes\n");
    return 0;
  }
  printf("No\n");

  return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <string>
#include <vector>

using namespace std;
typedef unsigned long long int ull;


int main(){
   ull H, W;
   cin >> H >> W;
   // cout << ull(21/2) << endl;
   if((H == 1) | (W==1)){
      cout << 1 << endl;
   }
   else if(ull(H*W) % 2 != 0){
      cout << ull(H*W/2)+1 << endl;
   }
   else{
      cout << ull(H*W/2) << endl;
   }

   return 0;
}


// int main(){
//    ull H, W;
//    cin >> H >> W;
//    if((H % 2 == 0) & (W % 2 == 0)){
//       cout << ull(H/2*W) << endl;
//    }
//    else if((H % 2 == 1) & (W % 2 == 1)){
//       cout << ull(H*(W-1)) << endl;
//    }
//    else if((H % 2 == 1) & (W % 2 == 0)){
//       cout << ull(H*(W/2)) << endl;
//    }
//    else if((H % 2 == 0) & (W % 2 == 1)){
//       cout << ull((H/2)*W) << endl;
//    }

//    return 0;
// }


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,y;
    cin>>n>>y;
    y/=1000;
    int a,b,c;
    b=(7*(y-n))%9;
    a=(y-n-4*b)/9;
    c=n-a-b;
    if(a>=0&&b>=0&&c>=0){
        cout<<a<<" "<<b<<" "<<c;
    }else{
        cout<<-1<<" "<<-1<<" "<<-1;
    }
    return 0;
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int a,b; cin>>a>>b;
   cout<<max({a+b,a-b,a*b})<<endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, m, a[102], b[102];
long long d[102][100005];
int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < a[i]; j++)
            d[i][j] = d[i - 1][j];
        for (int j = a[i]; j <= m; j++)
            d[i][j] = max(d[i - 1][j], d[i - 1][j - a[i]] + b[i]);
    }
    cout << d[n][m] << '\n';
}


Measured memory_bytes: 78336
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

static const int MAX = 100001;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
vector<pair<int, int>> adj[MAX];

ll pre[MAX];
ll p[MAX];
ll d[MAX];
ll color[MAX];
priority_queue<pair<int, int>>PQ;
ll n;
void dijkstra(int s) {
	repe(i, 1, n) {
		d[i] = INF;
		pre[i] = INF;
		color[i] = WHITE;
	}

	d[s] = 0;
	p[s] = -1;
	PQ.push(make_pair(s, s)); // ?reverse?
	color[s] = GRAY;

	while (!PQ.empty()) {
		pair<ll, ll> f = PQ.top(); PQ.pop();
		ll u = f.second;

		color[u] = BLACK;

		if (d[u] < f.first * (-1)) continue;

		rep(j, 0, adj[u].size()) {
			ll v = adj[u][j].first;
			if (color[v] == BLACK) continue;
			if (d[v] > d[u] + adj[u][j].second) {
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v] * (-1), v));
				p[v] = u;
				color[v] = GRAY;
			}
		}
	}
	//rep(i, 0, n) cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
	//rep(i, 0, n) cout << i << " " << (p[i] == INF ? -1 : p[i]) << endl;
}

vector<ll> get_path(int t) {
	vector<ll> path;
	for (; t != -1; t = p[t])path.push_back(t);
	reverse(path.begin(), path.end());
	return path;
}

int main()
{
	cin >> n;
	rep(i, 0, n - 1) {
		ll a, b, c; cin >> a >> b >> c;
		adj[a].push_back(make_pair(b, c));
		adj[b].push_back(make_pair(a, c));
	}
	ll q, k; cin >> q >> k;

	dijkstra(k);

	rep(i, 0, q) {
		ll x, y; cin >> x >> y;
		cout << d[x] + d[y] << endl;
	}
	return 0;
}

Measured memory_bytes: 12160
s = gets.strip

words = ['dream', 'dreamer', 'erase', 'eraser']

until s.empty? do
    reduced = false
    words.map do |w|
        if s[-w.size, w.size] == w
            s = s[0..-w.size - 1]
            reduced = true
            break
        end
    end

    unless reduced
        puts 'NO'
        exit 0
    end
end

puts 'YES'

Measured memory_bytes: 95028
def digit_sum(x):
    ans=0
    while x>0:
        ans+=x%10
        x=int(x/10)

    return ans

n = int(input())
ans = 100
for a in range(1,int(n/2)+1):
    ans = min(ans, digit_sum(a)+digit_sum(n-a))

print(ans)


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

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

int main(int argc, char const* argv[])
{
  ll q, h, s, d, n;
  cin >> q >> h >> s >> d >> n;
  ll one = min(4 * q, min(2 * h, s));
  if(one * 2 < d){
    cout << n * one << endl;
  }else{
    cout << (n / 2) * d + (n % 2) * one << endl;
  }
	return 0;
}


Measured memory_bytes: 256
n=int(input())
A=[[0,0,0]]
for i in range(n):
    a=list(map(int,input().split()))
    A.append(a)
    t=A[i+1][0]-A[i][0]
    d=abs(A[i+1][1]-A[i][1])+abs(A[i+1][2]-A[i][2])
    if t<d or (t-d)%2!=0:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 27300
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int r,g,b,n;

int main(void){
	scanf("%d%d%d%d",&r,&g,&b,&n);
	int ans=0;
	for(int i=0;i*r<=n;i++){
		for(int j=0;i*r+j*g<=n;j++){
			if(i*r+j*g<=n && (n-i*r-j*g)%b==0)ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
s = input()
L = ["AKIHABARA","AKIHABAR","AKIHABRA","AKIHABR","AKIHBARA","AKIHBAR","AKIHBRA","AKIHBR","KIHABARA","KIHABAR","KIHABRA","KIHABR","KIHBARA","KIHBAR","KIHBRA","KIHBR"]
if s in L:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 38384
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>

using namespace std;
typedef long long ll;

int main() {
  int N, K;
  scanf("%d%d", &N, &K);
  vector<int> V(N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &V[i]);
  }
  int ans = 0;
  for (int k = 0; k <= K; k++) {
    int nk = min(N, k);
    for (int i = 0; i <= nk; i++) {
      for (int j = 0; j <= (nk-i); j++) {
        vector<int> v;
        for (int m = 0; m < i; m++) {
          v.push_back(V[m]);
        }
        for (int m = 0; m < j; m++) {
          v.push_back(V[N-1-m]);
        }
        sort(v.begin(), v.end());
        int s = accumulate(v.begin(), v.end(), 0);
        ans = max(ans, s);
        for (int m = 0; m < k-i-j && m < (int)v.size(); m++) {
          s -= v[m];
          ans = max(ans, s);
        }
      }
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	int i,j,k,as=0,bs=0;
	string a,b;
	cin>>a>>b;
	string c;
	for(i=0;i<a.size();i++){
		cout<<a[i];
		if(i<b.size()) cout<<b[i];
	}
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		double n = sc.nextInt();
		System.out.println((n/3)*(n/3)*(n/3));
	}
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}

}


Measured memory_bytes: 22740
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 a[]=new int[2*n];
        ArrayList<Po>po=new ArrayList<>();
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        for(int i=0;i<m;i++){
            po.add(new Po(sc.nextInt(),sc.nextInt()));
        }
        Collections.sort(po, new Comparator<Po>() {
					public int compare(Po a, Po b) {
						return -(a.b - b.b);
					}
				});
        
        for(int i=0;i<n&&po.size()!=0;i++){
            a[n+i]=po.get(0).b;
            po.get(0).a--;
            if(po.get(0).a==0)po.remove(0);
        }
        Arrays.sort(a);
        long ans=0;
        for(int i=(2*n-1);i>=n;i--){
            ans+=a[i];
        }
        System.out.println(ans);
        
    }
}
class Po{
    int a,b;
    public Po(int a,int b){
        this.a=a;
        this.b=b;
    }
    public void print(){
        System.out.println(a+" "+b);
    }
}


Measured memory_bytes: 95504
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

ll h, n, f[30001];

class TaskE {
public:
    void solve() {
        cin >> h >> n;
        for (int i = 0; i <= 20000; i++) f[i] = 1e18;
        f[0] = 0;
        for (int i = 0; i < n; i++) {
            ll a, b;
            cin >> a >> b;
            for (int j = 0; j < h; j++)
              f[j + a] = min(f[j + a], f[j] + b);
        }
        ll ans = 1e18;
        for (int i = h; i <= 20000; i++) ans = min(ans, f[i]);
        cout << ans;
    }
};

int main() {
    TaskE solver;
    solver.solve();
}


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

int main()
{
  int N;
  cin >> N;
  
  char c[N];
  for(int i=0;i<N;i++)
    cin >> c[i];

  int j, k;
  int count = 1;
  for(j=0; j<N-1; j++)
    {
      if(c[j]!=c[j+1])
	{
	  count++;
	}     
    }

  cout << count <<  endl;

  return 0;
}
  
  


Measured memory_bytes: 384
from sys import stdin
from collections import Counter
input = stdin.readline

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

B = []


for i in range(N):
    B.append([A[i], i + 1])

# c...和, d..差
c = []
d = []

ans = 0

for i in range(N):
    if B[i][0] + B[i][1] == B[i][1] - B[i][0]:
        ans -= 1
    c.append(B[i][0] + B[i][1])
    d.append(B[i][1] - B[i][0])

c_count = Counter(c)
d_count = Counter(d)

c_lis = list(c_count.items())
d_lis = list(d_count.items())

c_lis.sort()
d_lis.sort()

n = 0

for c, num in c_lis:
    for i in range(n, len(d_lis)):
        if d_lis[i][0] < c:
            continue
        elif d_lis[i][0] == c:
            n = i + 1
            ans += num * d_lis[i][1]
        else:
            n = i
            break


print(ans)


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

int main(){
    int a,b; cin>>a>>b;
    string ans;
    if(a<=0&&0<=b) ans="Zero";
    else if(0<a) ans="Positive";
    else{
        if((abs(a-1)-abs(b))%2==0) ans="Positive";
        else ans="Negative";
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
from bisect import bisect_left

MOD = 998244353
input = sys.stdin.readline


class SegmentTree():
    def __init__(self, values, merge_func=min, default=float("inf")):
        n = len(values)
        self.size = 1
        self.default = default
        self.merge = merge_func
        while self.size < n:
            self.size *= 2
        # tree[0] = empty
        # child of tree[n] = tree[n*2], tree[n*2+1]
        self.tree = [self.default] * self.size * 2
        self.range = [None] * self.size * 2
        for i in range(n):
            self.tree[self.size + i] = values[i]
        for i in range(self.size):
            self.range[self.size + i] = (i, i+1)
        for i in range(self.size-1, 0, -1):
            self.tree[i] = self.merge(self.tree[i*2], self.tree[i*2+1])
            self.range[i] = (self.range[i*2][0], self.range[i*2+1][1])

    def get(self, index):
        return self.tree[self.size + index]

    def update(self, index, value):
        index += self.size
        self.tree[index] = value
        while index > 1:
            index //= 2
            self.tree[index] = self.merge(
                self.tree[index*2], self.tree[index*2+1])

    # query segmentation value of [a, b)
    def query(self, a, b):
        q = [1]
        ret = self.default
        while len(q):
            k = q.pop()
            l, r = self.range[k]
            if r <= a or b <= l:
                continue
            if a <= l and r <= b:
                ret = self.merge(ret, self.tree[k])
            else:
                q.append(k*2)
                q.append(k*2+1)
        return ret


def main():
    N = int(input())
    robo = [None] * N
    for i in range(N):
        robo[i] = tuple(map(int, input().split()))
    robo.sort()
    pos = [x[0] for x in robo]
    dst = [x[0] + x[1] for x in robo]
    rmq = SegmentTree(dst, max, -float("inf"))
    for i in range(N-1)[::-1]:
        dst[i] = rmq.query(i, bisect_left(pos, dst[i]))
        rmq.update(i, dst[i])

    dp = [0] * (N+1)
    dp[0] = 1
    for i in range(N):
        x, d = robo[N-1-i]
        to = N - bisect_left(pos, dst[N-1-i])
        dp[i+1] = (dp[i] + dp[to]) % MOD
    print(dp[N])


if __name__ == "__main__":
    main()


Measured memory_bytes: 116340
#include <iostream>
#include<cstdio>
#include<vector>
using namespace std;
#define ARRAY_MAX 50

int main(){
	// your code goes here
  int vertical,horizontal;
  int tmp;
  int array[ARRAY_MAX][ARRAY_MAX];
  int num[ARRAY_MAX];
  char c;

  cin >> vertical >> horizontal;

  for(int i = 0;i < vertical;i++){
    num[i] = i+1;
  }

  for(int i = 0;i < horizontal;i++){
    cin >> array[i][0] >> c >> array[i][1];
  }
  
 
  for(int i = 0;i < vertical;i++){
    tmp = num[array[i][0]-1];
    num[array[i][0]-1] = num[array[i][1]-1];
    num[array[i][1]-1] = tmp;
  }

  for(int i = 0;i < vertical;i++){
    printf("%d\n",num[i]);
  }
  return 0;
}

Measured memory_bytes: 3136
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func gcd(a int64, b int64) int64 {

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

func lcm(a int64, b int64) int64 {
	if a < b {
		a, b = b, a
	}
	return a * b / gcd(a, b)
}

func main() {
	var sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	x, _ := strconv.ParseInt(sc.Text(), 10, 64)
	sc.Scan()
	y, _ := strconv.ParseInt(sc.Text(), 10, 64)

	var i int64
	var ans int64 = -1
	max := int64(math.Pow10(18))
	for i = 1; x*i <= lcm(x, y) && x*i <= max; i++ {
		if x*i%y != 0 {
			ans = x * i
			break
		}
	}

	fmt.Printf("%v\n", ans)
	return
}


Measured memory_bytes: 640
#include<iostream>
#include<numeric>
#include<vector>
#include<cmath>
#include<climits>
#include<cfloat>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<limits>

using namespace std;
typedef pair<int,bool> Pair;

int main(){

long long N,K;
vector<long long> H(200000);

cin >> N >> K;

for (long long i = 0; i < N;++i)
	cin >> H[i];

if(N > K){

	sort(H.begin(),H.end(),greater<long long>());

	cout << accumulate(H.begin() + K, H.end(), 0LL) << endl;

}
else{

	cout << "0" << endl;

}


return 0;

}


Measured memory_bytes: 1920
import java.util.*;

public class Main{
	static public void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int num=sc.nextInt();
		sc.close();
		if(num>=400&&num<=599){
			System.out.println(8);
			return;
		}else if(num>=600&&num<=799){
			System.out.println(7);
			return;
		}else if(num>=800&&num<=999){
			System.out.println(6);
			return;
		}else if(num>=1000&&num<=1199){
			System.out.println(5);
			return;
		}else if(num>=1200&&num<=1399){
			System.out.println(4);
			return;
		}else if(num>=1400&&num<=1599){
			System.out.println(3);
			return;
		}else if(num>=1600&&num<=1799){
			System.out.println(2);
			return;
		}else{
			System.out.println(1);
			return;
		}
		
	}
}

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

#define int long long

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  if (n == 1) {
    cout << "0\n";
    return 0;
  }
  const long long MOD = 1e9 + 7;
  auto modpow = [&](long long a, long long b) -> long long {
    long long res = 1;
    while (b) {
      if (b & 1)
        res = (res * a) % MOD;
      a = (a * a) % MOD;
      b >>= 1;
    }
    return res % MOD;
  };
  long long a = (modpow(10, n) + modpow(8, n)) % MOD;
  long long b = (modpow(9, n) + modpow(9, n)) % MOD;
  long long x = a - b;
  x %= MOD;
  cout << (x + MOD) % MOD << '\n';
  return 0;
}

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

int main(){
    int a,b;
    int e;
    cin>>a>>b;
    if (b==10){
        cout<<0;
    }
    vector<int>v(10,-1);
    while(b--){
        int c;
        cin>>c;
        v[c]=c;
    }
    set<int>v1;
    for (int i=0;i<v.size();i++)
    {
        if(v[i]!=i)
        v1.insert(i);
    }
    for (int i=a;;i++)
    {
        e=i;
        int count1=0;
        while(v1.find(e%10)!=v1.end() and 1+floor(log10(e))>0){
            ++count1;
            e/=10;
        }
        if(count1>=1+floor(log10(i)))
        {
            cout<<i;
            break;
        }
        
        
    }

    
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
 
int main() {
    string s,t;
    int ans;
    ans=0;
    cin>>s>>t;
    for(int i=0;i<3;i++){
        if(s[i]==t[i]){
            ans++;
        }
    }
    cout<<ans<<endl;
}

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

bool check( long long int i, long long int k, long long int n ) {
  return ( ( i + k ) * ( k - i + 1 ) / 2 >= n ) ? true : false;
}

int main() {

  long long int n;

  while( true ) {

    cin >> n;

    if ( n == 0 ) break;

    long long int ans = 0;

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

      long long int lo = i + 1;
      long long int hi = n / 2;

      while( lo < hi ) {

	long long int k = ( lo + hi ) / 2;

	if ( check( i, k, n ) ) {
	  hi = k;
	}else {
	  lo = k + 1;
	}

      }

      if ( ( i + lo ) * ( lo - i + 1 ) / 2 == n ) {
	ans++;
      }

    }

    cout << ans << endl;

  }

  return 0;

}

Measured memory_bytes: 1156
x,y = map(int, input().split())
base = 100000
if x == 1:
  c = 3
elif x == 2:
  c = 2
elif x == 3:
  c = 1
else:
  c = 0
if y == 1:
  m = 3
elif y == 2:
  m = 2
elif y == 3:
  m = 1
else:
  m = 0
ans = base * c + base * m
if x == 1 and y == 1:
  ans += 4 * base

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
string int2string(int x){
        stringstream ss;
        ss << x;
        string tmp;
        ss >> tmp;
        return tmp;
    }
int string2int(string s){
    stringstream ss;
    ss << s;
    int x;
    ss >> x;
    return x;
}
long long power(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
long long bigpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
    ll r= a/gcd(a,b)*b;
    return r;
}
//***********************CODE*****************
void dfs(vector<vector<int> >&g,vector<vector<char> >&ans,int p,int i,vector<bool>&vis)
{
	ans[p][i]='Y';
	for(int j=0;j<g[i].size();j++)
	{
		if(!vis[g[i][j]])
		{
			vis[g[i][j]]=1;
			dfs(g,ans,p,g[i][j],vis);
			vis[g[i][j]]=0;
		}
	}
}
int main(){
    
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_with_stdio(false);

	int x;
	cin>>x;
	if(x<=599)
	{
		cout<<8<<endl;
	}
	else 
	if(x<=799)
	{
		cout<<7<<endl;
	}
	else 
	if(x<=999)
	{
		cout<<6<<endl;
	}else 
	if(x<=1199)
	{
		cout<<5<<endl;
	}else 
	if(x<=1399)
	{
		cout<<4<<endl;
	}
	else 
	if(x<=1599)
	{
		cout<<3<<endl;
	}else 
	if(x<=1799)
	{
		cout<<2<<endl;
	}else 
	if(x<=1999)
	{
		cout<<1<<endl;
}
   
    return 0;
}



Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	while(1){
		int x,y,z;
		int dx[110],mp[110],V[5];
		cin >> x >> y >> z;
		if(x==0&&y==0&&z==0) break;
		REP(i,110){
			dx[i] = 0; mp[i] = 0;
		}
		REP(i,x) cin >> V[i];
		REP(i,z) {
			int n,e,a;
			cin >> n >> e >> a;
			if(e==1) dx[n] = a;
			else if(e==2) mp[n] = a;
			else if(e==3) mp[n] = -1*a;
		}
		double dp[110][5000];// dp[i][j] := i?????????????????§m????????£???????¢????
		REP(i,110) REP(j,5000) dp[i][j] = 0;
		dp[0][0] = 1.0;
		REP(i,y){
			REP(j,5000){
				REP(k,x){
					if(dp[i][j]==0) continue;
					int money = j+mp[i+V[k]];
					if(money<0) money = 0;
					int pos = i+V[k]+dx[i+V[k]];
					if(pos>y) pos = y;
					if(pos<0) pos = 0;
					// cout << "pos " << pos << "money " << money << endl;
					dp[pos][money] += dp[i][j]*(1.0/(double)x);
				}
			}
		}

		double ans = 0;
		REP(i,5000) {
			// if(dp[y][i]!=0) cout << dp[y][i] << endl;
			ans += dp[y][i] * i;
		}
		cout << (int)ans << endl;
	}
}

Measured memory_bytes: 5456
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define MOD 1000000007
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(v) (v).begin() , (v).end()
#define sumof(v) accumulate(all(v), 0LL, plus<ll>())
#define maxof(v) max_element(all(v))
#define minof(v) min_element(all(v))
#define inf INT_MAX

int main(){
    FASTIO
    ll N;
    cin>>N;
    vector<int> grid[N];
    for(int i=0; i<N; ++i){
        int a, b, c; cin>>a>>b>>c;
        grid[i].push_back(a);
        grid[i].push_back(b);
        grid[i].push_back(c);
    }
    int dp[3][N];
    dp[0][0] = grid[0][0];
    dp[1][0] = grid[0][1];
    dp[2][0] = grid[0][2];
    // cout<<dp[0][0]<<" "<<dp[1][0]<<" "<<dp[2][0]<<endl;
    for(int i=1; i<N; ++i){
        dp[0][i] = grid[i][0] + max(dp[1][i-1], dp[2][i-1]);
        dp[1][i] = grid[i][1] + max(dp[0][i-1], dp[2][i-1]);
        dp[2][i] = grid[i][2] + max(dp[1][i-1], dp[0][i-1]);
        // cout<<dp[0][i]<<" "<<dp[1][i]<<" "<<dp[2][i]<<endl;
    }
    cout<<max(dp[0][N-1], max(dp[1][N-1], dp[2][N-1]))<<endl;
}

Measured memory_bytes: 10216
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (N, K) = read!(usize, i64);
    let mut A = read![[i64]];
    let mut F = read![[i64]];

    A.sort();
    F.sort_by_key(|f| -f);

    let mut ng = -1;
    let mut ok = 1 << 60;
    while ok - ng > 1 {
        let m = ng + (ok - ng) / 2;
        debug!(m);

        let mut k = K;

        for i in 0..N {
            let t = A[i] - m / F[i];
            debug!((i, A[i], F[i], m, t));

            // F[i] * (A[i] - k) <= m
            k -= max(t, 0);
            if k < 0 {
                break;
            }
        }

        if k >= 0 {
            ok = m;
        } else {
            ng = m;
        }

        debug!((m, k >= 0));
    }

    println!("{}", ok)
}


Measured memory_bytes: 12800
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  if(abs(a-c)<=d||(abs(a-b)<=d&&abs(c-b)<=d))
    printf("Yes\n");
  else
    printf("No\n");
}

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

typedef long long ll;

int n;
int t[102][102];

int main(){
  while(cin >> n){
    for(int i = 0; i < n; i++){
      for(int j = 0; j < n; j++){
        cin >> t[i][j];
      }
    }

    ll ans = 0;

    for(int i = 0; i < n; i++){
      for(int j = i + 1; j < n; j++){
        ans += (ll)min(t[i][j], t[j][i]);
      }
    }

    cout << ans << endl;
  }
}

Measured memory_bytes: 1200
#include<stdio.h>
#include<cmath>

int main(){

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

    double PI = 3.1415926535;

    double S=0, L=0, h=0, _L = 0;
    double radi;

    radi = (C/180.0)*PI;
    
    S = a*b*sin(radi)*0.5;
    _L = sqrt( a*a + b*b - 2.0*a*b*cos(radi));
    L = a+b+_L;
    h = (S/a)*2;

    printf("%lf %lf %lf\n", S, L,  h);
    return 0;
}


Measured memory_bytes: 2900
#include <bits/stdc++.h>
using namespace std;
#define double long double
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define vout(v) for(int i=0;i<(int)v.size()-1;i++){cout<<v[i]<<" ";}cout<<v[v.size()-1]<<"\n";
#define debg(a) cerr<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
vector <ll> dp;


void solve(long long a, long long b, long long x){
    // ll cnt=0;
    // for (ll i = a; i <= b; i++)
    // {
    //     if (i%x == 0)
    //     {
    //         cnt++;
    //     }
    // }
    // cout << cnt << "\n";

    ll val = 0;
    val = b/x+1;
    val -= (a!=0?(a-1)/x+1:0);
    cout << val << "\n";

}

int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long x;
    scanf("%lld",&x);
    solve(a, b, x);
    return 0;
}


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

using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
#define INF 1e9





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

    vector<ll> a(n), b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    vector<ll> amari(n);
    ll husoku = 0;
    ll cnt = 0;
    rep(i,n) {
        if(b[i] > a[i]){
            husoku += (b[i] - a[i]);
            cnt++;
        }
    }
    ll ans = 0;
    rep(i,n) {
        if(a[i] > b[i]){
            amari[i] = (a[i] - b[i]);
            
            
        }
    }
    if(husoku == 0){
        cout << 0 << endl;
        return 0;
    }
    
    sort(amari.begin(), amari.end());
    for(int i=n-1; i>=0; i--){
        husoku -= amari[i];
        ans++;
        if(husoku <= 0){
            break;
        }
    }
    if(husoku>0){
        cout << -1 << endl;
        return 0;
    }
    
    cout << ans + cnt << endl;
}


Measured memory_bytes: 2560
al = 'abcdefghijklmnopqrstuvwxyz'
s = input()

s_set = set(list(s))
s_list = list(s_set)
if len(al) == len(s_list):
  print('None')

for a in al:
  if a not in s_list:
    print(a)
    exit(0)

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

int main() {
 int N;
 cin >> N;
 int A[N];
 for (int i=0; i<N; i++){cin >> A[i];}
 int light=1;
 int count=0;
 for (int i=0; i<N; i++){
  light=A[light-1];
  count++;
  if(light==2){break;}
  if(count==N-1){count=-1;break;}
 }
 cout << count << endl;
}



Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double[] x = new double[N];
		String[] u = new String[N];
		for(int i = 0; i < N; i++) {
			x[i] = sc.nextDouble();
			u[i] = sc.next();
		}
		sc.close();
		double a = 0;
		for(int i = 0; i < N; i++) {
			if(u[i].equals("JPY")) {
				a += x[i];
			}else {
				a += 380000.0 * x[i];
			}
		}
		System.out.printf("%.8f", a);

	}
}

Measured memory_bytes: 25172
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
    long long a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k <= a) {
        cout << k << endl;
    } else if(k <= a + b) {
        cout << a << endl;
    } else {
        cout << a - (k - a - b) << endl;
    }
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {        
    int n;
    cin >> n;
    long long int c;
    cin >> c;
    vector<pair<long long int, long long int>> vp;
    for (int i = 0; i < n; i++) {
        long long int x, v;
        cin >> x >> v;
        vp.emplace_back(x, v);
    }
    long long int res = 0;
    long long int r = 0;
    long long int last = 0;
    vector<long long int> pre1(n, 0), pre2(n, 0), post1(n, 0), post2(n, 0);
    long long int r1 = 0, r2 = 0, res1 = 0, res2 = 0;
    int flag = 1;
    for (int i = 0; i < n; i++) {
        r += vp[i].second - abs(last - vp[i].first);
        r1 += vp[i].second - abs(last - vp[i].first);
        r2 += vp[i].second - 2 * abs(last - vp[i].first);
        if (flag == 1) {
            res1 = r1, res2 = r2;
        } else {
            res1 = max(r1, res1);
            res2 = max(r2, res2);
        }
        flag = 0;
        pre1[i] = res1, pre2[i] = res2;
        last = vp[i].first;
        res = max(res, r);
    }
    last = c;
    r = 0;
    r1 = 0, r2 = 0, res1 = 0, res2 = 0;
    flag = 1;
    for (int i = n - 1; i >= 0; i--) {
        r +=  vp[i].second - abs(last - (vp[i].first));
        r1 += vp[i].second - abs(last - (vp[i].first));
        r2 += vp[i].second - 2 * abs(last - (vp[i].first));
        if (flag == 1) {
            res1 = r1, res2 = r2;
        } else {
            res1 = max(r1, res1);
            res2 = max(r2, res2);
        }
        flag = 0;
        post1[i] = res1, post2[i] = res2;
        last = vp[i].first;
        res = max(res, r);
    }
    for (int i = 0; i < n - 1; i++) {
        res = max(res, pre1[i] + post2[i + 1]);
        res = max(res, pre2[i] + post1[i + 1]);
    }
    cout << res << endl;
}


Measured memory_bytes: 7948
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int man = 2e5+10;
#define IOS ios::sync_with_stdio(0)
#define ull unsigned ll
#define uint unsigned
#define pai pair<int,int>
#define pal pair<ll,ll>
#define IT iterator
#define pb push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);++i)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);--i)
#define endl '\n'
#define ll long long
const ll mod = 1e9+7;

signed main() {
    #ifndef ONLINE_JUDGE
        //freopen("in.txt", "r", stdin);
        //freopen("out.txt","w",stdout);
    #endif
    string s,t;
    cin >> s >> t;
    int res = 1e4;
    for(int i = 0;i <= s.size()-t.size();++i){
        int num = 0;
        for(int j = 0;j < t.size();++j){
            if(s[i+j]!=t[j])++num;
        }
        res = min(res,num);
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
using namespace std;
int main()
{
	int N,M,X,a[110],sum=0;
	cin >> N >> M >> X;
	for(int i=0; i<M; i++){
		cin >> a[i];
	}
	for(int i=0; i<X; i++){
		for(int j=0; j<M; j++){
			if(a[j] == i) sum++;
		}
	}
	if(sum < M - sum) cout << sum << endl;
	else cout << M - sum << endl;
	
	return 0;
}


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

#define MAXN 5000005
#define ll long long int

int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int cnt=0;
    while(b<=a){
        b*=2;
        cnt++;
    }
    while(c<=b){
        c*=2;
        cnt++;
    }
    if(cnt<=k)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+10;
#define eps 1e-9
int cnt[N];
int has[N];
int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	for(int i = 0; i < n; i++)cnt[i] = 1;
	has[0] = 1;
	int ans = 0;
	int a, b;
	for(int i = 0; i < m; i++){
		scanf("%d %d", &a, &b);
		a--;b--;
		if(has[a])has[b] = 1;
		cnt[a]--;
		cnt[b]++;
		if(cnt[a] == 0)has[a] = 0;
	}
	for(int i = 0; i < n; i++)ans+=has[i];
	printf("%d\n", ans);
}

Measured memory_bytes: 1024