akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
 
#define REP(i,n) for(int i = 0; i < n; i++)
 
 
int ok(int n, int *d)
{
    string s;
    s = to_string(n);
    REP(i, s.length()) {
        if(d[s[i]-'0']==1) {
            return 0;
        }
    }
    return 1;
}
 
int main(void)
{
    int n,k;
    int d[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    int a;
    cin >> n >> k;
    REP(i,k) {
        cin >> a;
        d[a] = 1;
    }
    while(!ok(n,d)) n++;
    cout << n<< endl; 
 
}

Measured memory_bytes: 256
N, M = map(int, input().split())
a = []
for i in range(M):
    x, y = map(int, input().split())
    a.append([x, y])
a.sort(key=lambda x: x[1])
ans = 0
for i in range(M-1):
    if a[i+1][0] < a[i][1]:
        a[i+1][1] = a[i][1]
    else:
        ans += 1
ans += 1
print(ans)

Measured memory_bytes: 25488
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = nextInt(sc);
        String b = sc.next();
        String s = sc.next();
        if(!(s.charAt(a) == '-')) {
            System.out.println("No");
        }else if(!s.substring(0, a -1).matches("^[0-9]*$")){
            System.out.println("No");
        }else if(!s.substring(a + 1).matches("^[0-9]*$")){
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
        sc.close();
    }

    static int nextInt(Scanner sc){
        return Integer.parseInt(sc.next());
    }

}



Measured memory_bytes: 23764
n,k=map(int,input().split())
a = list(map(int,input().split()))
minus = [0]+[abs(a[i]) for i in range(n) if a[i] < 0][::-1]

plus = [0]+[a[i] for i in range(n) if a[i] >= 0]

min_ = 10**18

if len(plus) == 1:
  print(minus[k])
elif len(minus) == 1:
  print(plus[k])
else:
  for i in range(min(k+1, len(plus))):
    if k-i < len(minus):
      min_ = min(min_, 2*plus[i]+minus[k-i], plus[i]+2*minus[k-i])
  print(min_)
  


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

const int N = 1e5+10;
int h[N];
int dp[N];

int func(int ind){
	if(ind == 0)
		return 0;
	if(dp[ind] != -1)
		return dp[ind];
	int cost = abs(h[ind] - h[ind-1]) + func(ind-1);
	if(ind > 1){
		cost = min(cost, abs(h[ind] - h[ind-2]) + func(ind-2));
	}
	return dp[ind] = cost;
}

int main(){
	int n;
	cin >> n;
	memset(dp, -1,sizeof(dp));
	for(int i = 0; i < n; ++i){
		cin >> h[i];
	}
	cout << func(n-1);
}

Measured memory_bytes: 4096
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 2020
int a[N][27];
int a2[N][27];
int r[N][365];
int r2[N][365];
int sz, sz2;

int main() {
	int n;
	int x, y;
	vector<pair<int,pair<int,int> > >b;
	int c[26];
	int d[365][26];
	scanf("%d", &n);
	f(i, 26)scanf("%d", &c[i]);
	f(i, n) {
		f(j, 26)scanf("%d", &d[i][j]);
	}
	sz = 1;
	f(i, 26)a[0][i] = -1;
	a[0][26] = 0;
	f(t, n) {
		b.clear();
		f(i, sz) {
			x = a[i][26];
			f(j, 26) {
				x -= ((t - a[i][j])*c[j]);
			}
			f(j, 26) {
				y = x + d[t][j];
				y += ((t - a[i][j])*c[j]);
				b.push_back(make_pair(y, make_pair(i, j)));
			}
		}
		sort(b.begin(), b.end(), greater<pair<int, pair<int,int> > >());
		sz2 = b.size();
		if (sz2 > N)sz2 = N;
		f(i, sz2) {
			x = b[i].second.first;
			y = b[i].second.second;
			a2[i][26] = b[i].first;            
			f(j, 26)a2[i][j] = a[x][j];
			a2[i][y] = t;
			f(j, t)r2[i][j] = r[x][j];
			r2[i][t] = y;
		}

		f(i, sz2) {
			f(j, 27)a[i][j] = a2[i][j];
			f(j, t + 1)r[i][j] = r2[i][j];
		}
		sz = sz2;
	}
	f(i, n)printf("%d\n", r[0][i]+1);

	return 0;
}


Measured memory_bytes: 9788
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define maxn 200005
#define ll long long
#define ld double
#define mod 1000000007 
using namespace std;
char inp[maxn];
int a, b, c, d;
bool check(int x, int y)
{
	if(x == y) return 1;
	if(x + 1 <= y && inp[x + 1] == '.')
		return check(x + 1, y);
	else if(x + 2 <= y && inp[x + 2] == '.')
		return check(x + 2, y);
	return 0;
}
int main()
{
	int n;
	cin>>n>>a>>b>>c>>d;
	scanf("%s", inp + 1);
	int ans = 0;
	if(c < d)
		if(check(b, d) && check(a, c)) ans = 1;
		else ans = 0;
	else 
	{
		ans = 1;
		while(1)
		{
			int fl = 0;
			if(a != c)
			{
				if(a + 1 <= c && a + 1 != b && inp[a + 1] == '.') a++, fl = 1;
				else if(a + 2 <= c && a + 2 != b && inp[a + 2] == '.') a += 2, fl = 1;
				else if(b + 1 <= d && b + 1 != a && inp[b + 1] == '.') b++, fl = 1;
				else if(b + 2 <= d && b + 2 != a && inp[b + 2] == '.') b += 2, fl = 1;
			}
			else
			{
				inp[c] = '#';
				ans = check(b, d);
				break;	
			} 
	//		cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
			if(!fl) 
			{
				ans = 0;
				break;
			}
		}
	}
	if(ans) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}
 


Measured memory_bytes: 384
N = int(input())
Happiness = [[int(i) for i in input().split()] for j in range(N)]

dp = [[0] * 3 for _ in range(N)]
dp[0] = Happiness[0][:]
for day in range(1, N):
    dp[day][0] = max(dp[day - 1][1], dp[day - 1][2]) + Happiness[day][0]
    dp[day][1] = max(dp[day - 1][2], dp[day - 1][0]) + Happiness[day][1]
    dp[day][2] = max(dp[day - 1][0], dp[day - 1][1]) + Happiness[day][2]
print(max(dp[N - 1]))

Measured memory_bytes: 44148
N,M=map(int,input().split())
sa=set()
sb=set()
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
      sb.add(b)
    if b==N:
      sa.add(a)
print("IMPOSSIBLE" if len(sa&sb)==0 else "POSSIBLE")

Measured memory_bytes: 19024
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
long double pi = 2 * acos(0.0);
const ll mod = 998244353;

void solve() {
    ll x;
    cin >> x;
    if(360 % x == 0) {cout << 360 / x; return;} 
    ll rv = 360, cv = 0;
    while(1) {
        if(rv - cv == x) {
            break;
        }
        if(rv - cv < 0) rv += 360;
        else cv += x;
    }
    cout << (cv / x) + 1;
}

int main() {
    ios_base :: sync_with_stdio(false); 
    cin.tie(nullptr);   
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <unordered_map>
#define lli long long int
#define fl(i, a, b) for(int i = a; i < b; ++i)
#define fl2(i, a, b) for(int i = a; i <= b; ++i)
#define rfl(i, a, b) for(int i = a; i > b; --i)
#define rfl2(i, a, b) for(int i = a; i >= b; ++i)
#define all(v) ((v).begin(), (v).end())
#define all2(v) ((a) + 0, (a) + n);
#define sz(s) (s).size()
#define OO (lli)1e18
#define MIN INT_MIN
#define f first
#define s second		
#define mp make_pair
#define pb puch_back
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
using namespace std;

lli power(lli x, lli y) {
	lli i, power = 1;
	if (y == 0)
		return 1;
	for (i = 1; i <= y; i++)
		power = power * x;
	return power;
}

int32_t main() {

	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	//freopen("overcode.in","r",stdin);
	//freopen("output.txt", "w", stdout);

	clock_t z = clock();

	int n;
	cin >> n;
	int counter = 0;
	fl2(i, 1, n) {
		if (i == 10 || i == 1000 || i == 100000) i = (i * 10) - 1;
		else counter++;
	}
	cout << counter << '\n';
	debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
double x,d;
double ans;
int main()
{
	scanf("%d%lf%lf",&n,&x,&d);
	n*=2;
	for(;n;n-=2)
	{
		ans+=x+d*(n-1)/2;
		x+=(x*2+d*5)/n;
		d+=d*4/n;
	}
	printf("%.11lf\n",ans);
	return 0;
}


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

int main(){
	int W[10], K[10];
	
	for(int i = 0; i < 10; i++) scanf("%d", &W[i]);
	for(int i = 0; i < 10; i++) scanf("%d", &K[i]);
	
	sort(W, W + 10);
	sort(K, K + 10);
	
	printf("%d %d\n", W[9] + W[8] + W[7], K[9] + K[8] + K[7]);
	
	return 0;
}

Measured memory_bytes: 1040
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 N;
	cin >> N;
	vector<i64> W(N);
	for (auto& v : W)
	{
		cin >> v;
	}

	i64 sum_w = ALL(accumulate, W, 0);

	i64 ans = sum_w;
	i64 cur_w = 0;
	REP(i, N)
	{
		cur_w += W[i];
		i64 abs_w = abs(cur_w - (sum_w - cur_w));
		if (ans > abs_w)
			ans = abs_w;
		else
			break;
	}

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


Measured memory_bytes: 256
#include<iostream>
using namespace std;
string tmp;
int n,flow,first,last,mid,pos,dfirst,dlast;
char f[1000001];
bool check(int x)
{
  cout<<'?'<<' '; 
  for (int i=x;i<=x+n-1;++i)
    cout<<i<<' ';
  cout<<endl;
  cin>>tmp;
  return ("Red"==tmp);
}
int main()
{
  cin>>n;
  first=1;
  last=n+1;
  dfirst=check(1);
  dlast=check(n+1);
  while (first+1<last)
    {
      mid=(first+last)/2;
      flow=check(mid);
      if (flow==dfirst)
	{
	  first=mid;
	  dfirst=flow;
	}
      else
	{
	  last=mid;
	  dlast=flow;
	}
    }
  pos=first;
  if (dfirst)
    {
      f[pos]='R';
      f[n+pos]='B';
    }
  else
    {
      f[pos]='B';
      f[n+pos]='R';
    }
  for (int i=pos+1;i<=n+pos-1;++i)
    {
      cout<<'?'<<' '<<i<<' ';
      for (int j=1;j<=pos-1;++j)
	cout<<j<<' ';
      for (int j=n+pos+1;j<=2*n;++j)
	cout<<j<<' ';
      cout<<endl;
      cin>>tmp;
      if (tmp=="Red")
	f[i]='R';
      else
	f[i]='B';
    }
  for (int i=1;i<=pos-1;++i)
    {
      cout<<'?'<<' '<<i<<' ';
      for (int j=pos+1;j<=n+pos-1;++j)
	cout<<j<<' ';
      cout<<endl;
      cin>>tmp;
      if (tmp=="Red")
	f[i]='R';
      else
	f[i]='B';
    }
  for (int i=n+pos+1;i<=2*n;++i)
    {
      cout<<'?'<<' '<<i<<' ';
      for (int j=pos+1;j<=n+pos-1;++j)
	cout<<j<<' ';
      cout<<endl;
      cin>>tmp;
      if (tmp=="Red")
	f[i]='R';
      else
	f[i]='B';
    }
  cout<<'!'<<' ';
  for (int i=1;i<=2*n;++i)
    cout<<f[i];
  cout<<endl;
  return 0;
}

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

int main() {
  int N, K, sum1=0, sum2=0, min=1;
  cin >> N >> K;
  int i=0;
  while(i<N){
   sum1=min*2;
   sum2=min+K;
   if(sum1>=sum2)
     min=sum2;
   else
     min=sum1;
   i++;
  }
  cout << min << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<memory>
using namespace std;

static const int LEN = 100005;

struct Process {
    char name[100];
    int t;
};

template <typename T>
class Queue {
public:
    T storage[LEN];
    int head, tail;

    Queue() {
        head = tail = 1;
    }

    void enqueue(T x) {
        storage[tail] = x;
        tail = (tail + 1) % LEN;
    }

    T dequeue() {
        T x = storage[head];
        head = (head + 1) % LEN;
        return x;
    }
};

int main() {
    int elaps = 0, c;
    int i, q, n, t;
    char name[100];
    Process u;
    scanf("%d %d", &n, &q);

    unique_ptr<Queue<Process>> queue(new Queue<Process>);
    for( i = 1; i <= n; i++)
    {
        Process *p = new Process;
        scanf("%s", p->name);
        scanf("%d", &(p->t));
        queue->enqueue(*p);
    }
    
    while( queue->head != queue->tail ) {
        u = queue->dequeue();
        c  = min(q, u.t);
        u.t -= c;
        elaps += c;
        
        if (u.t > 0) {
            queue->enqueue(u);
        } else {
            printf("%s %d\n", u.name, elaps);
        }
    }
}



Measured memory_bytes: 17956
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};
long double eps = 1e-6;
long double pi = acos(-1);



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    
    // ll n;
    // cin>>n;
    // string ans;
    // while(n){
    //     ans += ('a'+(n%26+25)%26);
    //     n /= 26;
    // }
    // reverse(ans.begin(),ans.end());
    // cout << ans << endl;
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    ll ans = 0;
    for(int i=0;i<k;i++)ans+=a[i];
    cout << ans << endl;
}

Measured memory_bytes: 3636
fun main(args: Array<String>) {
    var X = (0..2).map{
                readLine()!!.split(" ").map(String::toInt)
            }
    var col = X[0].map{it-0}
    var row = (0..2).map{
                    X[it][0]
                }.map{ it - col[0]}
    var flag = true

    (0..2).map{i->
        if(col.map{it+row[i]} != X[i]) flag = false
    }
    if(flag) println("Yes")
    else println("No")
}


Measured memory_bytes: 37988
#include <bits/stdc++.h>
//#include <boost/functional/hash.hpp>
//example: unordered_set< pair<int,int>,boost::hash< std::pair<int, int> > > used;
//priority_queue< pair<int,pair<int,int> >, vector<pair<int,pair<int,int>>>, greater<pair<int,pair<int,int> > > > pqueue;    //cost, vertex(行き先)
using namespace std;

#define MODULE 1000000007
#define MP make_pair
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
template<typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val){ //usage: int dp[10][10]; Fill(dp,INF);
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef pair<int, int> P;
typedef long long LL;
const int INF = INT_MAX / 2;    //int_max->2*e+9 LLの時はLLONG_MAX
/*const int MAXN = 100001;

struct edge {
    edge(int to, int cost) : to(to), cost(cost) {}
    int to, cost;
};
vector<edge> graph[MAXN];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};*/

//-----Template---------
string a;
string x;
string c;

int main(){
    ios::sync_with_stdio(false); //cout<< fixed << setprecision(10);
    cin>>a>>x>>c;
    cout<<"A"<<x[0]<<"C"<<endl;
}

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


fn main() {
    let mut a:Vec<(usize)> = input!(usize;);
    a.sort();
    let b = vec![5,5,7];
    let ans;
    if a==b{
        ans = "YES";
    }else{
        ans = "NO";
    }
    println!("{}",ans);
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll t=1;
ll n,x;
string s;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	cout<<3.1415*2*n;newl;
}

int main() {
	fastio;randomINT;
	//cin>>t;
	while(t--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 238160
_=input()
S=input()
numc=0
numw=0
numcmin=0
for s in S:
    if s == '#':
        numc = numc + 1
    else:
        numw = numw + 1
        numc = numc - 1
        if numc < numcmin:
            numcmin = numc
print(numcmin + numw)

Measured memory_bytes: 3500
import java.util.*;
 
class Main {
    public static void main(String args[]) {
        Scanner sc =new Scanner(System.in);
		int [] a= new int[5];
		int i,k,j;
		
		for(i=0;i<5;i++)
		a[i]=sc.nextInt();
		
		for(i=4;i>0;i--)
			for(k=0;k<i;k++)
				if(a[k]<a[k+1]) {j=a[k]; a[k]=a[k+1]; a[k+1]=j;}
		
		for(i=0;i<4;i++)
		System.out.print(a[i]+" ");
		
		System.out.println(a[4]);
		

    }
}

Measured memory_bytes: 17180
package main

import "fmt"

func main () {
  var n, rc int
  _, _ = fmt.Scanf("%d", &n)
  if n%2 == 0 {
    rc = (n / 2) * (n + 1)
  } else {
    rc = (((n - 1) / 2) * n) + n
  }
  fmt.Println(rc)
}



Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#include<queue>
#include<string>
#include<map>

using namespace std;

#define maxn 5005
#define ll long long

int main() {
	char a, b;
	cin >> a >> b;
	if (a == 'H'&&b == 'H') cout << 'H' << '\n';
	if (a == 'D'&&b == 'H') cout << 'D' << '\n';
	if (a == 'D'&&b == 'D') cout << 'H' << '\n';
	if (a == 'H'&&b == 'D') cout << 'D' << '\n';

	return 0;
}

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

int main(){
	int a,b,c;cin >> a >> b >> c;
	if(c<= a+b){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


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

int main()
{
	ll a, b, c, d;
	scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
	printf("%lld\n", max(max(a * c, a * d), max(b * c, b * d)));
	
	return 0;
}

Measured memory_bytes: 1708
N, C, K = map(int, input().split())

T = [int(input()) for _ in range(N)]

T.sort()

res = 0
i = 0
while i < N:
	res += 1
	Left = i
	while (i < N and T[i] - T[Left] <= K and i - Left + 1 <= C):
		i += 1

print(res)


Measured memory_bytes: 50668
#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>



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;
    ll ans = 0;
    for(ll i = 1; i <= sqrt(n); i++){
        ll t = n / i - 1;
        if(t == 0) continue;
        if(n / t == n % t) ans += t;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9 + 7
    sum_A = sum(A)%mod
    ans = 0
    for a in A:
        sum_A -= a
        ans += a*sum_A%mod
    print(ans%mod)

if __name__=='__main__':
    main()

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

int main() {
  int N;
  double T, A;
  cin >> N >> T >> A;
  vector<double> v(N);
  for (int i = 0; i < N; i++) cin >> v[i];

  int ans = 0;
  double diff = pow(10, 9);
  for (int i = 0; i < N; i++) {
    double t = T - v[i] * 0.006;
    if (abs(A - t) < diff) {
      ans = i + 1;
      diff = abs(A - t);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	int henA,henB,henC;
	for(int i = 0;i < n;i++){
		cin >> henA >> henB >> henC;
		if(henA > henC){
			swap(henA,henC);
		}
		if(henB > henC){
			swap(henB,henC);
		}
		if(henA*henA + henB*henB == henC*henC){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
N = int(input().rstrip())
ret = []
while N != 0:
    char = chr(96 + (N % 26))
    if char == '`':
        char = 'z'
        N = N // 26 - 1
    else:
        N = N // 26
    ret.append(char)
print(''.join(ret[::-1]))


Measured memory_bytes: 9020
#include <stdio.h>

int A[1000000], n;

/* 二分探索 */
int binarySearch(int key) {
  int left = 0;
  int right = n;
  int mid;
  while(left < right) {
    mid = (left + right) / 2;
    if(key == A[mid]) return 1; /* keyを発見 */
    if(key > A[mid]) left = mid + 1; /* 後半を探索 */
    else if(key < A[mid]) right = mid; /* 前半を探索 */
  }
  return 0;
}

int main(void) {
  int i, q, k, sum = 0;
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++) {
    scanf("%d",&k);
    if(binarySearch(k))
      sum++;
  }
  printf("%d\n",sum);
  return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, X, T;
    cin >> N >> X >> T;

    cout << (N + X - 1) / X * T << endl;

    return 0;
}


Measured memory_bytes: 3648
using System;

namespace AOJ.Volume3
{
    public class SunriseAndSunset
    {
        public static int Main()
        {
            var input = Console.ReadLine().Split(' ');
            int h = int.Parse(input[0]);
            int r = int.Parse(input[1]);

            if (h * (-1) == r) { Console.WriteLine("0"); }
            else
            {
                if (h >= 0) { Console.WriteLine("1"); }
                else
                {
                    h = h * -1;
                    if (r > h) { Console.WriteLine("1"); }
                    else { Console.WriteLine("-1"); }
                }
            }

            return 0;
        }
    }
}

Measured memory_bytes: 9008
#include <bits/stdc++.h>
#include <unistd.h>
#include <random>
using namespace std;
 
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;
 
int main() {
	// random_device rnd;
	// mt19937 mt(rnd());
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<long long int> A (N);
	vector<long long int> B (N);
	for(int i = 0;i < N;i++){
		cin >> A[i];
	}
	for(int i = 0;i < N;i++){
		cin >> B[i];
	}
	long long int sum = 0;
	long long int result = 0;
	int ans = 0;
	vector<long long int> more;
	long long int minus = 0;
	for(int i = 0;i < N;i++){
		if(A[i] < B[i]){
			ans++;
			minus += B[i] - A[i];
		}
		else{
			more.push_back(A[i]-B[i]);
		}
		sum += A[i];
		result += B[i];
	}
	if(sum < result){
		cout << -1 << endl;
	}
	else{
		SORT(more);
		REV(more);
/*		cout << "NOW ANS = " << ans << endl;
		cout << "NOW MINUS = " << minus << endl;
		for(int i = 0;i < more.size();i++){
			cout << more[i] << endl;
		}*/
		for(int i = 0;minus > 0;i++){
			ans++;
			minus -= more[i];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 2936
#!/usr/bin/python3

import sys
# input = sys.stdin.readline
sys.setrecursionlimit(100000)
MOD = 10 ** 9 + 7

#N = int(input())
#A = [int(x) for x in input().split()]
#V = [[0] * 100 for _ in range(100)]

N = int(input())
CSF = []
for _ in range(N-1):
    C, S, F = [int(x) for x in input().split()]
    CSF.append((C, S, F))

def f(i):
    ans_r = [0]
    cur = 0
    for c, s, f in CSF[i:]:
        cur = max(cur, s)
        if cur % f != 0:
            cur = cur + (f - (cur % f))
        # print("出発：{}".format(cur))
        cur += c
        # print("到着：{}".format(cur))
        ans_r.append(cur)

    return ans_r[-1]

for i in range(N):
    print(f(i))

Measured memory_bytes: 3188
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 4e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string s;
main() {
  file("threesum");
  ios;
  cin>>s;
  sort(all(s));
  cout<<(s[0] == 'A' and s.back() == 'B'?"Yes":"No");
  return 0;
}
/**

*/


Measured memory_bytes: 256
import qualified Data.Set as Set
import           Data.List (subsequences)
import           Control.Monad (replicateM)

main = do
  s  <- replicateM 4 getLine
  let as = map read $ words (s !! 1)
      ms = map read $ words (s !! 3)
      sm = Set.fromList $ map sum $ subsequences as
  putStr $ yesOrNo $ map ((flip Set.member) sm) ms

yesOrNo xs = unlines $ map yesOrNo' xs
  where
    yesOrNo' b
      | b == False = "no"
      | b == True  = "yes"

Measured memory_bytes: 5428
from itertools import permutations
from math import factorial
N=int(input())
D=[tuple(map(int,input().split())) for _ in range(N)]
ans=0
for d in permutations(D):
    for i in range(N-1):
        ans+=((d[i][0]-d[i+1][0])**2+(d[i][1]-d[i+1][1])**2)**0.5
print(ans/factorial(N))

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

int main()
{
  string sa, sb, sc;
  char add;
  cin >> sa >> sb >> sc;
  add = sa.at(0);
  int i, j, k, ch, h;
  ch = 0;
  i = 0;
  j = -1;
  k = -1;
  for(h = 0; h < 300; h++)
  {
    if(add == 'a')
    {
      if(i + 1 < sa.size())
      {
        i++;
        add = sa.at(i);
      }
      else
      {
        ch = 1;
        break;
      }
    }
    else if(add == 'b')
    {
      if(j + 1 < sb.size())
      {
        j++;
        add = sb.at(j);
      }
      else
      {
        ch = 2;
        break;
      }
    }
    else if(add == 'c')
    {
      if(k + 1 < sc.size())
      {
        k++;
        add = sc.at(k);
      }
      else
      {
        ch = 3;
        break;
      }
    }
  }
  if(ch == 1)
  {
    cout << "A" << endl;
  }
  if(ch == 2)
  {
    cout << "B" << endl;
  }
  if(ch == 3)
  {
    cout << "C" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int i,j;
    int n=s.length();
    for(int i=0;i<n;i++)
        if(s[i]=='Z')
            j=i;
    for(int j=n-1;j>=0;j--)
        if(s[j]=='A')
            i=j;

        cout<<j-i+1<<endl;
    
    return 0;   
}




 
 


Measured memory_bytes: 720
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> v(n);
    FOR(i,0,n) cin>>v[i];

    FOR(i,1,n){
      if(v[i-1]<v[i])v[i]--;
    }
    string s = "Yes";
    FOR(i,1,n)if(v[i-1]>v[i]) s = "No";
    cout<<s<<endl;
}


Measured memory_bytes: 1024
import std.stdio,std.conv,std.string,std.algorithm;

void main()
{
    int[5000] dp;
    while(true)
    {
        int n=readln.chomp.to!int;
        if(!n) break;
        int ans=int.min;
        foreach(i;0..n)
        {
            int a=readln.chomp.to!int;
            if(!i) dp[i]=a;
            else dp[i]=max(dp[i-1]+a,a);
            ans=max(ans,dp[i]);
        }
        ans.writeln;
    }
}

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

const int maxn(3005);
const int mod(1e9 + 7);

inline void Inc(int &x, const int y) {
    x = x + y >= mod ? x + y - mod : x + y;
}

inline void Dec(int &x, const int y) {
    x = x - y < 0 ? x - y + mod : x - y;
}

inline int Add(const int x, const int y) {
    return x + y >= mod ? x + y - mod : x + y;
}

inline int Sub(const int x, const int y) {
    return x - y < 0 ? x - y + mod : x - y;
}

inline int Pow(ll x, int y) {
    int ret = 1;
    for (; y; y >>= 1, x = x * x % mod)
        if (y & 1) ret = ret * x % mod;
    return ret;
}

int n, m, f[maxn][maxn][2], ans;

inline void Solve() {
	int i, j, t, w;
	memset(f, 0, sizeof(f)), ans = 0;
	for (i = 0; i <= n; ++i) f[0][i][i == 0] = 1;
	for (i = 1; i <= m; ++i)
		for (j = 0; j <= n; ++j)
			for (t = 0; t < 2; ++t)
				if (f[i - 1][j][t]) {
					w = n - j;
					if (j) {
						Inc(f[i][j][t | (j == 1)], f[i - 1][j][t]);
						Inc(f[i][j - 1][t | (j == 1)], f[i - 1][j][t]);
					}
					if (w) {
						Inc(f[i][j][t], f[i - 1][j][t]);
						Inc(f[i][j + 1][t], f[i - 1][j][t]);
					}
				}
	for (i = 0; i <= n; ++i) Inc(ans, f[m][i][1]);
	printf("%d\n", ans);
}

int main() {
	while (scanf("%d%d", &n, &m) != EOF) Solve();
	return 0;
}

Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
int main()
{
         int n,k,i,c=1;
         cin>>n>>k;
         int a[n];
         for(i=0;i<n;i++)
         {
              cin>>a[i];
         }
         if(a[0]<=k)c++;
         int s=a[0];
         for(i=1;i<n;i++)
         {
                  s=s+a[i];
                  if(s<=k)c++;
         }
         cout<<c<<endl;
         return 0;
}


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

int main(){
    int n,m,a=1e9;
    int d[1000];
    int c[1000];
    int dp[1002][1002];
    cin>>n>>m;
    for(int i=0;i<=m;i++)
        for(int j=0;j<=n;j++)
            dp[i][j]=1e9;
    for(int i=0;i<=m;i++)
        dp[i][0]=0;
    for(int i=0;i<n;i++)cin>>d[i];
    for(int i=0;i<m;i++)cin>>c[i];
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+c[i]*d[j]);
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
        }
    }
    for(int i=1;i<=m;i++)
        a=min(a,dp[i][n]);
    cout<<a<<endl;
}

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

using namespace std;
const int MAXN = 100000;
const int MAXLEN = 10;

int have[6];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		char buff[MAXLEN + 1];
		memset(buff, 0, sizeof(buff));
		scanf("%s", buff);
		if (buff[0] == 'M') have[1]++;
		if (buff[0] == 'A') have[2]++;
		if (buff[0] == 'R') have[3]++;
		if (buff[0] == 'C') have[4]++;
		if (buff[0] == 'H') have[5]++;
	}
	unsigned long long int ans = 0;
	for (int i = 1; i <= 5; i++) {
		if (!have[i]) continue;
		for (int j = i + 1; j <= 5; j++) {
			if (!have[j]) continue;
			for (int k = j + 1; k <= 5; k++) {
				if (!have[k]) continue;
				ans += (unsigned long long)have[i] * (unsigned long long)have[j] * (unsigned long long)have[k];
			}
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <math.h>

int main(){

	std::array<double, 3> a; //0:xa 1:ya 2:ra
	std::array<double, 3> b;

	int N;

	std::cin >> N;

	for(int i = 0; i < N; ++i){
		
		for(int j = 0; j < 3; ++j)
			std::cin >> a[j];

		for(int j = 0; j < 3; ++j)
			std::cin >> b[j];

		double ab = hypot( (a[0] - b[0]) , (a[1] - b[1]) );

		if( ab > (a[2] + b[2]) )
			std::cout << 0 << std::endl;
		
		else if ( a[2] > ab + b[2] )
			std::cout << 2 << std::endl;

		else if ( b[2] > ab + a[2] )
			std::cout << -2 << std::endl;

		else
			std::cout << 1 << std::endl;

	}
	
	return 0;

}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define reset(x, y) memset(x, y, sizeof(x))
#define uni(x) (x).erase(unique(all(x)), (x).end());
#define BUG(x) cerr << #x << " = " << (x) << endl
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define _1 first
#define _2 second

int a, b, cnt = 3, deg[5];

int main() {
    while (cnt--) {
        cin >> a >> b;
        deg[a]++;
        deg[b]++;
    }
    FOR(i, 1, 4) if (deg[i] == 3) {
            puts("NO");
            return 0;
        }
    cout << "YES";
}

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

int main(void){
  string s, tgt="keyence";
  int pref[8], suff[8];
  int ans;
  
  cin >> s;
  if (s.length()<tgt.length()){
    cout << "NO" << endl;
    return 0;
  }
  // check prefix and suffix
  pref[0] = suff[0] = 1;
  for (int i=0; i<tgt.length(); i++){
    pref[i+1] = pref[i] & (s[i]==tgt[i]);
    suff[i+1] = suff[i] & (s[s.length()-1-i]==tgt[tgt.length()-1-i]);
  }
  ans = 0;
  for (int i=0; i<8; i++){
    ans |= pref[i]&&suff[7-i];
  }
  cout << (ans?"YES":"NO") << endl;
  return 0;
}


Measured memory_bytes: 256
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, L = read_ints()
    S = []
    for _ in range(N):
        S.append(input().strip())
    S.sort()
    return ''.join(S)


if __name__ == '__main__':
    print(solve())

Measured memory_bytes: 3060
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    a,b,x = map(int, input().split())

    print(b//x - (a-1)//x)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>

using namespace std;

int n, m, u, v, a;
int s[1001000], t[1001000];
string b;

int main () {
    cin >> n >> m;
    for ( int i = 1; i <= m; i++) {
        cin >> a >> b;
        if ( b[0] == 'A' ) {
            if ( t[a] == 0 ) {
                u++;
                t[a] = 1;
                v = v + s[a];
            }
        }
        else {
            if ( t[a] == 0 ) {
                s[a]++;
            }
        }
    }
    cout << u << " " << v;
}


Measured memory_bytes: 4736
#include<stdio.h>
int main()
{
    int A,B,C,D;
    scanf("%d%d%d%d",&A,&B,&C,&D);
    A=A*B;
    C=C*D;
    if(A>C){
        printf("%d",A);
    }
    else{
        printf("%d",C);
    }
    return 0;
}


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

int main(){
  int h,w,k;cin>>h>>w>>k;
  vector<vector<char>> c(h,vector<char> (w));
  rep(i,h){
    rep(j,w){
      cin>>c[i][j];
    }
  }
  int sum,ans=0;
  for(int tmp=0;tmp<(1<<h);tmp++){
    bitset<7> s(tmp);
    for(int tmpw=0;tmpw<(1<<w);tmpw++){
      bitset<7> t(tmpw);
      sum=0;
      rep(i,h){
        rep(j,w){
          if(s.test(i)&&t.test(j)){
            if(c[i][j]=='#')sum++;
          }
        }//j
      }//i
      if(sum==k)ans++;
    }//tmpw
  }
    cout<<ans;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>


int main() {
	std::string a, b, c;

	std::cin >> a >> b >> c;

	int turn = 0;
	while (true) {
		if (turn == 0) {
			if (a.size() == 0) {
				std::cout << "A" << std::endl;
				break;
			}
			turn = a.front() - 'a';
			a.erase(a.begin());
		} else if (turn == 1) {
			if (b.size() == 0) {
				std::cout << "B" << std::endl;
				break;
			}
			turn = b.front() - 'a';
			b.erase(b.begin());
		} else {
			if (c.size() == 0) {
				std::cout << "C" << std::endl;
				break;
			}
			turn = c.front() - 'a';
			c.erase(c.begin());
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int t[210],v[210];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    REP(i,n) cin>>t[i];
    REP(i,n) cin>>v[i];
    double ret=0,sp=0;
    REP(i,n){
        for(double j=0;j<t[i];j+=0.5){
            bool flg1=true,flg2=true;
            double ti=t[i]-j-0.5;
            for(int k=i+1;k<n;k++){
                ti+=t[k];
                if(sp+0.5-ti>v[k+1]) flg1=false;
                if(sp-v[k+1]>ti) flg2=false;
            }
            if(sp+0.5<=v[i] && flg1 && (sp+0.5-(t[i]-j-0.5))<=v[i+1]){
                ret+=sp*0.5;
                ret+=0.125;
                sp+=0.5;
            }
            else if(sp-v[i+1]<=t[i]-j-0.5&&flg2) ret+=sp*0.5;
            else{
                sp-=0.5;
                ret+=sp*0.5;
                ret+=0.125;
            }
        }
    }
    printf("%.15lf\n",ret);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
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; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	int n, m;
	cin >> n >> m;
	V a(n + 1);
	VL modsum(n + 1, 0);
	map<ll, int> mp;
	mp[0]++;
	rep1(i, n) {
		cin >> a[i];
		modsum[i] += modsum[i - 1] + a[i];
		modsum[i] %= m;
		mp[modsum[i]]++;
	}
	ll ans = 0;
	for (auto c : mp) {
		ll x = c.second;
		ans += x * (x - 1) / 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5376
# coding: utf-8
# hello worldと表示する
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,k=MI()
if k%2==1:
    count=0
    for i in range(1,n+1):
        if i%k==0:
            count+=1
    print(count**3)
else:
    countz,countk=0,0
    for i in range(1,n+1):
        if i%k==0:
            countz+=1
        elif i%k==(k//2):
            countk+=1
    print(countk**3+countz**3)

Measured memory_bytes: 38896
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
 
typedef unsigned long long int ll;
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define  ff          first
#define  ss          second
#define  pb          push_back
#define  IOS         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  lb          lower_bound
#define  ub          upper_bound
#define  D2(x)       { cerr << "[" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }
#define  all(x)      (x).begin(), (x).end()
#define  mem(a)      memset(a , 0 ,sizeof a)
#define  deb(x)      cout << #x << " - " << x << "\n";
#define  ps(x,y)     fixed<<setprecision(y)<<x
#define  setbit(x)   __builtin_popcount(x)
#define  deb2(x,y)   cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define  rep(i,a,b)  for(int i=a ; i<b ; ++i)
#define  repr(i,a,b)  for(int i=a ; i>=b ; --i)
 
#define PI 3.141592653589793
const ll p = 5;
const ll INF = 1000000000;
const ll MAX_N = 2e5 + 2;

void solve(){
    int n; cin >> n;
    vpii v(0);
    vi adj[n+1],vis(n+1),deg(n+1),inc(n+1);
    map<pair<int,int>,int>ans;
    
    int a,b,mx = 0,curr_col = 1,mxNode,mnNode;
    rep(i,1,n){
        cin >> a >> b;
        ++deg[a], ++deg[b];
        mx = max({mx , deg[a], deg[b]});
        adj[a].pb(b), adj[b].pb(a);
        v.pb({a , b});
    }
    inc[1] = -1;
    queue<int>q;
    q.push(1);
    
    while(!q.empty()){
        int node = q.front();
        q.pop();
        vis[node] = 1;
        
        for(auto x:adj[node]){
            if(vis[x] == 1) continue;
            mnNode = min(node,x), mxNode = max(node,x);
            
            if(inc[node] == curr_col%mx){
                curr_col++;
                curr_col %= mx;
            }
            
            if(curr_col%mx == 0) ans[{mnNode , mxNode}] = mx;
            else ans[{mnNode , mxNode}] = curr_col%mx;
            
            vis[x] = 1;
            inc[x] = curr_col%mx;
            curr_col++, q.push(x);
        }
    }
    
    cout << mx << '\n';
    rep(i,0,n-1){
        mnNode = min(v[i].ff , v[i].ss);
        mxNode = max(v[i].ff , v[i].ss);
        cout << ans[{mnNode , mxNode}] << '\n';
    }
}

int main() {
    IOS;
    int t = 1;
    while(t--) solve();
}

Measured memory_bytes: 16864
#include<iostream>
#include<cstdio>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int a[3],b[2];
	int pas,dri,i; 
	
	for(i=0; i<3; i++) cin >> a[i];
	for(i=0; i<2; i++) cin >> b[i];

	sort(a,a + 3);
	sort(b,b + 2);

	printf("%d\n", a[0] + b[0] - 50);

	return 0;
}

Measured memory_bytes: 1208