akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
//#define int long long
#define all(vec) vec.begin(), vec.end()

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

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

	int A, B, C;
	cin >> A >> B >> C;
	int sum = A + B + C;
	int m = max(max(A, B), C);
	int ans;
	int maxx;
	if ((m * 3) % 2 == sum % 2)
	{
		maxx = m;
	}
	else
	{
		maxx = m + 1;
	}

	cout << (maxx * 3 - sum) / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String m="";
		String taihi="";
		for(int i=0;i<s.length();i++){
			if(s.charAt(i)=='B'){
				for(int j=0;j<m.length()-1;j++){
					taihi+=m.charAt(j);
				}
				m=taihi;
				taihi="";
			}else{
				m+=s.charAt(i);
			}
		}
		System.out.println(m);
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define int long long
#define INF 1000000000000000000
using namespace std;

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
template<typename T>
void debug(vector<vector<T>> m){ REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;} }



signed main(){

    int N, M; cin >> N >> M;
    vec X(M); readv(X);
    Sort(X);
    vec dx(M - 1);
    REP(i, M - 1) dx[i] = X[i + 1] - X[i];
    Sort(dx);
    int ans = 0;
    REP(i, M - N) ans += dx[i];
    cout << ans << endl;

    return 0;
}


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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define REPC(var, start, end) for(int var = start; var <= (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long
#define TIME cerr << "Time elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms" << endl;

const int INF = (int)1e9;
int n, m;
VVI adj;
VB visited;
VI bfs(int start)
{
	VI dist(n, -INF);
	queue<int> q;

	dist[start] = 0;
	q.push(start);
	while(q.empty() == false)
	{
		int here = q.front();
		q.pop();

		for(int there : adj[here])
			if(dist[there] == -INF)
			{
				dist[there] = dist[here] + 1;
				q.push(there);
			}
	}
	return dist;
}

bool isPossible()
{
	VI dist = bfs(0);
	return dist[n - 1] != -INF && dist[n - 1] <= 2;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	cin >> n >> m;

	adj.resize(n);
	for(int i = 0; i < m; ++i)
	{
		int u, v;
		cin >> u >> v;
		--u, --v;

		adj[u].emplace_back(v);
		adj[v].emplace_back(u);
	}

	cout << (isPossible() ? "POSSIBLE" : "IMPOSSIBLE") << endl;

	return 0;
}

Measured memory_bytes: 13168
# -*- coding: utf-8 -*-

import numpy as np

EDPC = "https://atcoder.jp/contests/DP/"
TDPC = "https://atcoder.jp/contests/tdpc/tasks"

############### TESTCASE ###############
test = ""
#test = \
"""
3 8
3 3
4 5
5 6
ans 9
"""

"""
6 15
6 5
5 6
6 4
6 6
3 5
7 2
ans 17
"""

"""
N<100, W<10*9
wi<10**9, vi<10**3 
"""
########################################
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
########################################
#np.maximum(*arrays) == np.max(np.vstack(*arrays), axis=0)
#(np.maximum(np.array([1,3,2]), np.array([2, 1, 3])) == 
# np.max(np.vstack([np.array([1,3,2]), np.array([2, 1, 3])]), axis=0)).all()
################# MAIN #################

N, W = map(int, input2().split())
WV = np.array([tuple(map(int, input2().split())) for _ in range(N)], dtype="int64")
Wsum = np.sum(WV[:, 0])
Vsum = np.sum(WV[:, 1])

dp = np.full(Vsum+1, Wsum, dtype="int64")
for w, v in WV:
    dp[:Vsum-v+1] = np.min(np.vstack([dp[:Vsum-v+1], dp[v:] - w]), axis=0)
    
print(np.where(dp < W+1)[0][-1])
    


Measured memory_bytes: 15556
// #pragma GCC optimize("Ofast")

// #pragma GCC optimize("no-stack-protector")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>

using namespace std;

template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}

template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}

#define int long long
#define left left228
#define right right228
#define ld long double
#define list list228
// #define prev prev228
#define mp make_pair
#define list list228
#define all(v) v.begin(), v.end()

int n;

vector< string > v;

void gen(string s) {
    if ((int)s.size() == n) {
        // v.emplace_back(s);
        cout << s << '\n';
    } else {
        vector< char > e;
        if (s.empty()) e.emplace_back('a');
        else {
            for (char c : s) {
                e.emplace_back(c);
            }
            sort(all(e));
            e.erase(unique(all(e)), e.end());
            char last = e.back();
            e.emplace_back((char)(last + 1));
        }
        for (char x : e) {
            gen(s + x);
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    gen("");
    return 0;
}

/*
3
1 1 2
2 2 2
3 3 2
2 1 1
3 2 1


2 2
1 1 2
2 2 2
1 2 3
2 1 1

2
2 1 2 2 3
2 2 2 1 1

5
1 2
2 3
3 4
3 5
1
2 3
1 2
4 3
2 3 5

*/



Measured memory_bytes: 1536
N=int(input())

t = [0]
x = [0]
y = [0]
for i in range(N):
    t1,x1,y1=[int(i) for i in input().split()]
    t.append(t1)
    x.append(x1)
    y.append(y1)

flag=True

for i in range(N):
    zahyo=abs(x[i]-x[i+1])+abs(y[i]-y[i+1])
    jikansa=t[i+1]-t[i]
    if zahyo<=jikansa and zahyo%2==jikansa%2:
        continue
    else:
        flag=False
        break

if flag:
    print('Yes')
else:
    print('No')

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

int mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    cout << (H2 * 60 + M2) - (H1 * 60 + M1) - K;
}

Measured memory_bytes: 3632
cuicine = [int(input()) for i in range(5)]

r = [c % 10 for c in cuicine if c % 10 != 0]

r = sorted(r)

# print(r)

rmin = 0

if r != []:
  rmin = r.pop(0)

ans = sum(cuicine)

for i in r:
  ans += 10 - i

print(ans)

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


int main() {
    std::ios_base::sync_with_stdio(false);
    int a, b, c, k;
    std::cin >> a >> b >> c >> k;
    int sum = std::min(k, a);
    k -= a;
    k -= b;
    if (k > 0)
        sum -= k;
    std::cout << sum;
}

Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
const int N=1e5+10;
struct edge{int to,Next;}ed[N<<1];
int edcnt,head[N];
void addedge(int u,int v){ed[++edcnt]=(edge){v,head[u]};head[u]=edcnt;}
int deg[N];
queue<int>q;
bool used[N];
int main()
{
	int n;scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;scanf("%d%d",&u,&v);
		addedge(u,v);addedge(v,u);
		deg[u]++;deg[v]++;
	}
	for(int i=1;i<=n;i++)
	if(deg[i]==1) q.push(i);
	while(!q.empty())
	{
		int u=q.front();q.pop();
		if(used[u]) continue;
		used[u]=true;
		bool flag=false;
		for(int i=head[u];i;i=ed[i].Next)
		if(!used[ed[i].to])
		{
			int v=ed[i].to;
			used[v]=true;
			for(int j=head[v];j;j=ed[j].Next)
			if(!used[ed[j].to])
			{
				deg[ed[j].to]--;
				if(deg[ed[j].to]==1) q.push(ed[j].to);
			}
			flag=true;
		}
		if(!flag)
		{
			printf("First\n");
			return 0;
		}
	}
	printf("Second\n");
	return 0;
}

Measured memory_bytes: 2944
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < int > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define pb push_back
# define pdd pair < db , db >

int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n;
    fi>>n;
    int v;
    map < int , int > M;
    for (int i = 1;i <= n;++i)
        fi>>v,++M[v];
    int ans = M.size();
    int cnt = 0;
    for (auto it : M)
        cnt += it.y >= 2 && !(it.y & 1);
    ans -= (cnt & 1);
    fo << ans << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 4864
N, K = map(int, input().split())
D = list(map(int, input().split()))
M = N
while 1:
    flag = False
    for x in str(M):
        if int(x) in D:
            flag = True
            break
    if flag == True:
        M += 1
    else:
        print(M)
        break;

Measured memory_bytes: 3060
use proconio::{fastout, input};

use proconio::marker::Usize1;

#[fastout]
fn main() {
    input! {
        n: usize,  k: u64,
        a: [Usize1; n],
    }
    let mut v = vec![std::u64::MAX; n];
    let mut c = 0;
    let mut pos = 0;
    v[pos] = 0;
    loop {
        pos = a[pos];
        c += 1;
        if c == k {
            println!("{}", pos + 1);
            return;
        }
        if v[pos] < std::u64::MAX {
            break;
        }
        v[pos] = c;
    }
    let t = v[pos] + (k - v[pos]) % (c - v[pos]);
    for i in 0..n {
        if t == v[i] {
            println!("{}", i + 1);
        }
    }
}


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

using namespace std;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define int long long
#define ll long long
#define lson node<<1
#define rson (node<<1)+1
#define endl "\n"

const int maxn=2e6+10;
const ll mod=1e9+7;
const double pi=acos(-1);

ll qpow(ll a,ll n)
{
    ll b=1;
    while(n)
    {
        if(n&1)
            b=b*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return b;
}
int gcd(int a,int b)
{
    return b?gcd(b,a%b):a;
}
int lcm(int a,int b)
{
    return a*b/gcd(a,b);
}
//int prime[maxn],s,v[maxn];
//void prime_init()
//{
//    for(int i=2; i<=maxn; i++)
//    {
//        if(!v[i])
//        {
//            prime[s++]=i;
//            for(int j=1; j*i<=maxn; j++)
//                v[i*j]=1;
//        }
//    }
//}

signed main()
{
    int n,d;
    sll2(n,d);
    int sum=0;
    while(n--)
    {
        int a,b;
        sll2(a,b);
        if(a*a+b*b<=d*d)
        {
            sum++;
        }
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 3684
#include <iostream>


using namespace std;

int main() {
    int r,g,b,rx100,gx10;
    int integer;
    cin >> r >> g >> b;

    rx100 = r * 100;
    gx10 = g * 10;
    
    integer = rx100 + gx10 + b;

    if(integer % 4 == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

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

int main(){
    int n;
    cin >> n;
    int h[n];
    for(int i=0;i<n;i++) cin >> h[i];
    int count=0;
    vector<int> v(1);
    for(int i=1;i<n;i++){
        if(h[i-1]>=h[i]){
            ++count;
            v.push_back(count);
        }else{
            count=0;
        }
    }
    sort(v.begin(),v.end());
    cout << v.back();
}

    

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

a_pulus = a >= 0
b_pulus = b >= 0
a_minus = a < 0
b_minus = b < 0

if a_pulus & b_pulus:
    print("Positive")
elif a_minus & b_pulus:
    print("Zero")
else:
    if (b - a + 1) % 2 == 0:
        print("Positive")
    else:
        print("Negative")


Measured memory_bytes: 2940
let cnt = ref 0

let selection_sort a n =
  let swap i j = let t = a.(i) in a.(i) <- a.(j); a.(j) <- t in
  for i = 0 to n - 1 do
    let mini = ref i in
    for j = i to n - 1 do
      if a.(j) < a.(!mini) then mini := j;
    done;
    if !mini <> i then begin
      swap i !mini;
      incr cnt;
    end;
  done

let () =
  let n = read_int () in
  let a = Array.of_list (List.map int_of_string (Str.split (Str.regexp " ") (read_line ()))) in
  selection_sort a n;
  Array.iteri (fun i n -> Printf.printf (if i = 0 then "%d" else " %d") n) a;
  print_newline ();
  Printf.printf "%d\n" !cnt

Measured memory_bytes: 2340
//Crafted by KHUSHAL AGARWAL - khushal87
#include <bits/stdc++.h>
#include <sstream>
#include <string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> pint;
typedef map <int,int> mapii;
typedef map <char,int> mapci;
typedef map <string,int> mapsi;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <char> vc;
typedef set <int> si;
typedef set <ll> sll;
typedef set <char> sc;
#define pb(i) push_back(i) ;
#define ms(arr) memset(arr,0,sizeof(arr))
#define deb(x) cout<< #x <<" "<< x<<endl;
#define loop(i,n) for(int i=0;i<n;i++)
#define Loop(i,k,n) for(int i=k;i<=n;i++)
#define ln endl
#define testcase int t;cin>>t; while(t--)
#define mod 1000000007


int main() {
   int k;
   cin>>k;
   string res="";
   for(int i=0;i<k;i++){
       res+="ACL";
   }
   cout<<res;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <string>
#include <iomanip>
#include <queue>
#include <algorithm>

using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;
const dd PI = 3.1415926535;

ll fast(ll n, ll k) {
	if (k == 0) {
		return 1;
	}
	if (k == 1) {
		return n;
	}
	if (k % 2 == 0) {
		ll tmp = fast(n, k / 2);
		return tmp * tmp % MOD;
	}
	else {
		ll tmp = fast(n, k / 2);
		tmp = tmp * tmp % MOD;
		return n * tmp % MOD;
	}
}

int main() {
	dd X;
	cin >> X;

	dd money = 100;
	ll ans = 0;
	while (true)
	{
		if (money >= X) {
			break;
		}
		money *= 1.01;
		money = floor(money);
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3732
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


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

using namespace std;
int a,b,c;

int main(){
  cin >> a >> b >> c;
  cout << c/a*b << endl;
  return 0;
}


Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll Mypow(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}

ll gcd(ll a, ll b){//計算量はO(log(max(a,b))
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll INFL = 1LL << 60;//10^18 = 2^60
int INF = 1 << 30;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

ll kai(ll x){
  if(x == 1) return 1;
  return x * kai(x-1) % MOD;
}



int main(){
  char a; cin >> a;
  if(a == 'a' || a == 'i' || a == 'u' || a == 'e' || a == 'o') cout << "vowel" << endl;
  else cout << "consonant" << endl;
}


Measured memory_bytes: 256
n,q = map(int,input().split())
S = input()
s = [0]*(n+1)
for i in range(1,n):
	if S[i-1] == 'A' and S[i] == 'C':
		s[i] = 1
for i in range(1,n):
	s[i] += s[i-1]
for i in range(q):
	l,r = [int(j)-1 for j in input().split()]
	print(s[r]-s[l])  

Measured memory_bytes: 55512
fun main(args:Array<String>):Unit {
    while(true){
        val (n, m, p) = readLine()!!.split(' ').map(String::toInt)
        if (n == 0 && m == 0 && p == 0) return
        val buy = Array(n){readLine()!!.toInt()}
        val winner = buy[m - 1]
        println(if (winner != 0) buy.sum() * (100 - p) / winner else 0)
    }
}


Measured memory_bytes: 33128
// https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/all/ALDS1_12_B
#include <bits/stdc++.h>
using ll = long long;
using namespace std;

#define INFint 2e9+1

ll gcd(ll a, ll b) { return __gcd(a,b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

int main(){
// start
  struct edge {int to,cost;};
  int N;
  cin>>N;
  vector<vector<edge>> G(N,vector<edge>());
  for(int i(0);i<N;i++){
    int k,u;
    cin>>k>>u;
    for(int j(0);j<u;j++){
      int v,c;
      cin>>v>>c;
      G[k].push_back({v,c});
    }
  }
  vector<int> d(N);
  fill(d.begin(),d.end(),INFint);
  // first: cont, second: node number 
  priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> q;
  int start = 0;
  d[start] = 0;
  q.push({0,start});

  while(!q.empty()){
    pair<int,int> p = q.top();q.pop();                                                  
    int v = p.second;
    //if (d[v] < p.first) continue;
    for (int i(0);i<int(G[v].size());i++){
      edge e = G[v][i];
      if (d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        q.push({d[e.to],e.to});
      }
    }
  }
// end
  for(int i(0);i<N;i++){
    cout << i <<" " << d[i] << endl;
  }
  return 0;
}




Measured memory_bytes: 3212
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = LLONG_MAX;
/* テンプレートここまで */

int main() {
  string s; cin >> s;
  ll ans = 0;
  REP(i, s.size()-1){
    if(s[i+1] != s[i]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int H, W;
    int N;
    const int MAXN = 1e2+5;
    vector<int> a(MAXN*MAXN,0);
    cin >> H >> W;
    cin >> N;
    for(int i = 1; i <= N; ++i) {
        cin >> a[i];
    }
    vector<vector<int>> grid(MAXN,vector<int> (MAXN,0));
    int color = 1;
    int paint = 0;
    int jj;
    for(int i = 1; i <= H; ++i) {
        for(int j = 1; j <= W; ++j) {
            if(paint == a[color]) {
                ++color;
                paint = 0;
            }
            jj = i%2 == 0 ? W-j+1 : j;
            grid[i][jj] = color;
            ++paint;
        }
    }
    for(int i = 1; i <= H; ++i) {
        for(int j = 1; j <= W; ++j) {
            cout << grid[i][j] << " ";
        } cout << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

constexpr ll mod = 1e9+7;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    friend ostream &operator<<(ostream& os,const mint& a){
        return os << a.x;
    }

    friend istream &operator>>(istream& is,mint& a){
        ll t;
        is >> t;
        a = mint(t);
        return (is);
    }

    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    map<int,int> mp;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        mp[a]++;
    }
    bool ok = true;
    for(int i=N-1;i>=0;i-=2){
        ok &= mp[i]==(i!=0? 2:1);
    }
    if(!ok){
        cout << 0 << "\n";
    }else{
        mint ans = 1;
        for(auto& x:mp) ans *= x.second;
        cout << ans << "\n";   
    }
}

Measured memory_bytes: 4096
icase=0
if icase==0:
    s=list(input())
    t=list(input())
    lens=len(s)
    for i in range(lens):
        yn=""
        for j in range(lens):
            jj=(i+j)%lens
#            print(i,j,jj,s[j],t[jj])
            if s[j]!=t[jj]:
                yn="No"
                break
        if yn=="No":
            continue
        else:
            yn="Yes"
            break
    if yn=="No" :
        print("No")
    else:
        print("Yes")

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

typedef long long ll;
#define INF 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#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 foreach(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
const double pi = acos(-1.0);

// (0,0)->(x,y)
// each +3
//
//

// 2,1 -> XXY XYX YXX;
//
ll inv[1000010];
void initinv(){
  ll p = MOD;
  inv[1] = 1;
  rep(i,2,1000001)
    inv[i] = ((p-p/i)*inv[p%i])%p;
}

int main(){
  initinv();
  ll x,y;
  scanf("%lld %lld",&x,&y);
  if((x+y)%3){
    printf("0\n");
    return 0;
  }
  int times = (x+y)/3;
  x-=times;
  y-=times;
  if(x<0 || y < 0){
    printf("0\n");
    return 0;
  }
  if(x==0 || y ==0){
    printf("1\n");
    return 0;
  }

  // inv;
  // (x+y)!/(x)!/(y)!;
  //
  ll ans=1;
  rep(i,x+1,x+y+1){
    (ans*=i)%=MOD;
  }
  rep(i,1,y+1){
    (ans*=inv[i])%=MOD;
  }
  cout<<(ans+MOD)%MOD<<endl;
  return 0;
}


Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
int main(){
  string c,s;
  cin >> c;
  s = "abcdefghijklmnopqrstuvwxyz";
  for(int i=0;i<26;i++){
    if(c.at(0)==s.at(i)){
      cout << s.at(i+1) << endl;
    }
  }
}


Measured memory_bytes: 256
n = int(input())
yokolist = list(map(int, input().split()))

sum = ((sum(yokolist) % (10**9+7))**2 )% (10**9+7)

sum_2 = 0
for i in range(n):
    sum_2 += (yokolist[i]*yokolist[i] % (10**9+7))
    sum_2 = sum_2 % (10**9+7)

answer = (sum - sum_2) % (10**9+7)

if answer % 2 == 0:
    print(answer//2)
else:
    answer = answer + 10**9+7
    print(answer//2)


Measured memory_bytes: 32080
#include <iostream>
using namespace std;
int state[100002];
int a[100002];
int main() {
	int n, k;
	cin >> n >> k;
	int i;
	for(i=1;i<=n;i++)
	    cin>>a[i];
	
	for(i=0;i<=k;i++)
	    if(state[i] == 0)
        {
            int j;
            for(j=1;j<=n;j++)
                if(i + a[j] <=k)
                    state[i + a[j]] = 1;
        }
        
    cout<<(!state[k]?"Second":"First");
	return 0;
}

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

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

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

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

signed main(void)
{
  ll n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;

  if(-n*d + a > b || a + n*d < b) {
    cout << "NO" << endl;
    return 0;
  }

  ll dd = a-(n-1)*c, uu = a+c-(n-2)*d;
  REP(i, n-1) {
    //cout << dd << " " << uu << endl;
    if(dd <= uu && dd < b && b < uu) {
      //cout << i << " " << dd << " " << uu << endl;
      cout << "NO" << endl;
      return 0;
    }
    dd += c + d;
    uu += c + d;
  }
  cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll int N;
    cin >> N;
    ll int i = sqrt(N);
    while(N % i != 0){
        i --;
    }
    i = max(i, N / i);
    ll int t = 1;
    while(i / 10 != 0){
        t ++;
        i /= 10;
    }
    cout << t << endl;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;
using LP = pair<ll,ll>;
using P = pair<ll,int>;
ll mod = 998244353;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<string> num;
    rep(i, 10) rep(j, 10) rep(k, 10){
        string tmp = to_string(i)+to_string(j)+to_string(k);
        num.push_back(tmp);
    }
    int cnt = 0;
    for (string x : num){
        bool flag2 = false;
        int j= 0;
        rep(i, 3){
            bool flag = false;
            while (j < n){
                if (s[j] == x[i]) {
                    flag = true;
                    flag2 = true;
                    j++;
                    break;
                }
                j++;
            }
            if (not flag) {
                flag2 = false;
                break;
            } 
        }
        if (flag2){
            cnt ++;
        }
        
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3800
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		int[] b=new int[n];
		long sum=0;

		for(int i=0;i<n;i++) a[i]=sc.nextInt();

		for(int i=0;i<n;i++) b[i]=a[i];
		Arrays.parallelSort(b);
		for(int i=0;i<n;i++) {
			if(a[i]==b[n-1])System.out.println(b[n-2]);
			else System.out.println(b[n-1]);
		}
	}
}



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

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

int main() {
  ll n, ans = 1, a;
  bool over = false, zero = false;
  cin >> n;
  rep(i, n) {
    cin >> a;
    if (a == 0) {
      zero = true;
      break;
    }
    if (a <= INF / ans)
      ans *= a;
    else
      over = true;
  }

  if (zero)
    puts("0");
  else
    cout << (over ? -1 : ans) << endl;
  return 0;
}


Measured memory_bytes: 3596
#include <stdio.h>

int main(void)
{
	int a, b, d, r;
	double af, bf, f;
	
	scanf("%d %d", &a, &b);
	
	af = a;
	bf = b;
	
	d = a / b;
	r = a % b;
	f = af / bf;
	
	printf("%d %d %f", d, r, f);
	
	return 0;
}

Measured memory_bytes: 636
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/14/20 07:28:46
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

vector<pair<int, int>> primes(int x) {
  vector<pair<int, int>> p;
  int t = sqrt(x);
  for (int i = 2; i <= t and x > 1; i++) {
    int c = 0;
    while (x%i==0) {
      c++;
      x/=i;
    }
    if (c>0)
      p.emplace_back(i, c);
  }
  if (x > 1)
    p.emplace_back(x, 1);
  return p;
}

constexpr ll MOD = 1e9+7;
ll mod_pow(ll x, ll p) {
  ll u = x;
  ll t = 1;
  while (p) {
    if (p&1)
      (t *= u)%=MOD;
    (u *= u)%=MOD;
    p>>=1;
  }
  return t;
}

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

  int n; cin>>n;
  vector<int> A(n); for(auto& a:A) cin>>a;
  vector<vector<pair<int, int>>> PA(n);
  unordered_map<int, int> pa;
  for (int i = 0; i < n; i++) {
    PA[i] = primes(A[i]);
    for (auto p:PA[i])
      pa[p.first] = max(pa[p.first], p.second);
  }
  ll lcm = 1;
  for (auto p:pa)
    (lcm *= mod_pow(p.first, p.second))%=MOD;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    (ans += lcm*mod_pow(A[i], MOD-2)%MOD)%=MOD;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1280
/*
          * AUTHOR : Divyanshu *
*/

#include<bits/stdc++.h>
/*    #include <ext/pb_ds/assoc_container.hpp>
      #include <ext/pb_ds/tree_policy.hpp>

      using namespace __gnu_pbds;       */
using namespace std;

#define ll long long
#define ull unsigned long long
#define f(a,b) for(ll i=a; i<b; i++)
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define pl pair<ll,ll>
#define vll vector<ll>
#define pll vector<pair<ll,ll>>
#define ld double
#define fr(a,b) for(ll j=a; j>=b; j--)
#define fi(a,b) for(ll j=a; j<b; j++)
#define fii(a,b) for(ll k=a; k<b; k++)
//      typedef tree<ll ,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ld a[3005], dp[3005][3005];

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

    ll n;
    cin>>n;
    f(1, n+1)     cin>>a[i];
    dp[1][1] = a[1] * 1.0;    dp[1][0] = 1.0 - a[1];
    f(2, n+1)
    {
        fi(0, i+1)
        {
            dp[i][j] += dp[i-1][j] * (1.0 - a[i]);
            if(j != 0)
                dp[i][j] += dp[i-1][j-1] * a[i] * 1.0;
        }
    }
    ld ans = 0.0;
    f(n/2 + 1, n+1)     ans += dp[n][i];
    cout<<fixed<<setprecision(10)<<ans;

    return 0;
}



Measured memory_bytes: 69120
#include <stdio.h>
int main(void)
{
  int n, a[100002], i, count=0, in=1, tmp;
  scanf("%d", &n);
  for(i = 0; i < n; i++) scanf("%d", &a[i]);

  while(1){
    count++;
    if(a[in-1] == 2) break;
    if(a[in-1] == 0){
      printf("-1\n");
      return 0;
    }
    tmp = in-1;
    in = a[in-1];
    a[tmp] = 0;
  }
  printf("%d\n", count);
  return 0;
}


Measured memory_bytes: 512
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<ll,ll> PII;
typedef vector<ll> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+5;
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 n,k;
void solve(){
	cin>>k>>n; 
	ll pre =0, mx=0;
	ll t;
	cin>>pre;
	ll first = pre;
	rep(i,1,n){
		cin>>t;
		mx = max(mx,t-pre);
		pre = t;
	}
	mx = max(mx,k-t+first);
	
	cout<<k-mx;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}




Measured memory_bytes: 384
<?php
  
  $target = [];
  
  $target[] = explode(" ", trim(fgets(STDIN)));
  $target[] = explode(" ", trim(fgets(STDIN)));
  $target[] = explode(" ", trim(fgets(STDIN)));
  $target[] = [$target[0][0], $target[1][0], $target[2][0]];
  $target[] = [$target[0][1], $target[1][1], $target[2][1]];
  $target[] = [$target[0][2], $target[1][2], $target[2][2]];
  $target[] = [$target[0][0], $target[1][1], $target[2][2]];
  $target[] = [$target[2][0], $target[1][1], $target[0][2]];

  $n = trim(fgets(STDIN));

  $b = [];

  for($i=0; $i<$n; $i++)
  {
    $b[] = trim(fgets(STDIN));
  }

  for($i=0; $i<count($target); $i++){
    $is_hazure = false;
    for($j=0; $j<count($target[$i]); $j++){
      if(in_array($target[$i][$j], $b)){
        
      }else{
        $is_hazure = true;
        break;
      }      
    }
    if(!$is_hazure){
      echo "Yes";
      exit;
    }
  }
  echo "No";



Measured memory_bytes: 4728
import java.util.*
import java.io.PrintWriter

val pw = PrintWriter(System.out)
val MOD = 1000000007L
val INF = 2147483647
val LINF = 9223372036854775807L

fun main(args: Array<String>){
    solve()
    pw.flush()    
}

fun solve(){
    val s = next()
    val len = s.length
    val sr = s.reversed()
    val b = s.substring(0, (len - 1) / 2)
    val br = b.reversed()
    val c = s.substring((len + 3) / 2 - 1)
    val cr = c.reversed()
    if(s.equals(sr) && b.equals(br) && c.equals(cr)) println("Yes") else println("No")
}

// Print
fun println(v: String){
    pw.println(v)
}
fun print(v: String){
    pw.print(v)
}

// Read
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map{ it.toInt() }
fun nextLongList() = next().split(" ").map{ it.toLong() }
fun nextDoubleList() = next().split(" ").map{ it.toDouble() }
fun nextAryln(n: Int) = Array(n){ next() }
fun nextIntAryln(n: Int) = IntArray(n){ nextInt() }
fun nextLongAryln(n: Int) = LongArray(n){ nextLong() }
fun nextDoubleAryln(n: Int) = DoubleArray(n) { nextDouble() }

// Math
fun abs(n: Int) : Int = Math.abs(n)
fun abs(n: Long) : Long = Math.abs(n)
fun abs(n: Double) : Double = Math.abs(n)
fun max(a: Int = -INF, b: Int = -INF, c: Int = -INF, d: Int = -INF, e: Int = -INF): Int = listOf(a, b, c, d, e).max()!!
fun max(a: Long = -LINF, b: Long = -LINF, c: Long = -LINF, d: Long = -LINF, e: Long = -LINF): Long = listOf(a, b, c, d, e).max()!!.toLong()
fun min(a: Int = INF, b: Int = INF, c: Int = INF, d: Int = INF, e: Int = INF): Int = listOf(a, b, c, d, e).min()!!
fun min(a: Long = LINF, b: Long = LINF, c: Long = LINF, d: Long = LINF, e: Long = LINF): Long = listOf(a, b, c, d, e).min()!!.toLong()
fun prime(from: Long, to: Long = from) : List<Long>{
    return (from..to).filter{ i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all{ j -> i % j != 0L}
    }
}
fun gcd(a: Long, b: Long) : Long = if(a % b == 0L) b else gcd(b, (a % b))
fun lcm(a: Long, b: Long) : Long = a / gcd(a, b) * b
fun modpow(a: Long, n: Long, p:Long = MOD) : Long {
    var res = 1L
    var ar = a
    var nr = n
    while(nr > 0){
        if((nr and 1) == 1L) res = res * ar % p
        ar = ar * ar % p
        nr = nr shr 1
    }
    return res
}
fun modinv(a: Long, p: Long = MOD) : Long = modpow(a, p - 2, p)
fun ncr(n: Long, r: Long) : Long {
    var a = 1L
    var b = 1L
    for (i in 1..r) {
        a = a * (n + 1 - i) % MOD
        b = b * i % MOD
    }
    return modinv(b, MOD) * a % MOD
}


Measured memory_bytes: 33912
from collections import deque
H, W = [int(i) for i in input().split()]
A = [list(input()) for _ in range(H)]

Q = deque()
for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            Q.append((i, j, 0))

ans = 0
while Q:
    i, j, dist = Q.popleft()
    ans = max(ans, dist)
    for di, dj in [(1, 0), (0, 1), (-1, 0), (0, -1)]:
        ni, nj = i + di, j + dj
        if 0 <= ni < H and 0 <= nj < W and A[ni][nj] == ".":
            A[ni][nj] = "#"
            Q.append((ni, nj, dist + 1))

print(ans)


Measured memory_bytes: 161628
#include <bits/stdc++.h>
using namespace std;
string a;
string b;
void check(int l,int r)
{
    int k=0;
    for(int i=0;i<a.size();i++)
    {
        if(i>=l&&i<=r){cout<<b[k++];}
        else if(a[i]=='?')cout<<'a';
        else cout<<a[i];
    }
    exit(0);
}
int main()
{
    cin>>a;
    cin>>b;
    for(int i=0;i<a.size();i++)
    {
        int k=0;
            for(int j=i;k<b.size();j++)
            {
                if(a[j]!=b[k])goto nn;
                k++;
            }
            check(-1,-1);
            nn:;
    }
    int n=a.size();
    int m=b.size();
    for(int i=n-m;i>=0;i--)
    {
        int k=0;
        for(int j=i;k<m;j++)
        {
            //cout<<a[j]<<" "<<b[k];
            if(a[j]!='?'&&a[j]!=b[k])
                goto ss;
            k++;
        }
        check(i,i+m-1);
        ss:;
    }
    cout<<"UNRESTORABLE";
}


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

long long f(long long n, long long x) {
    if(n == -1) return 0;
    return (n / x) + 1;
}

int main() {
   long long a, b, x;
   cin >> a >> b >> x;
   cout << f(b, x) - f(a - 1, x) << endl;
}

Measured memory_bytes: 256
abc = list(map(int, input().split()))
abc.sort()

cnt = 0
while max(abc) - min(abc) > 1:
    abc[0] += 2
    abc.sort()
    cnt += 1

if abc[0] == abc[1] == abc[2]:
    cnt += 0
elif abc[0] == abc[1]:
    cnt += 1
else:
    cnt += 2

print(cnt)


Measured memory_bytes: 38384
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

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

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll N, W;
	std::cin >> N >> W;

	ll w, v;
	vector<vll> dp(N + 1, vll(W + 1, 0));

	repeq(i, 1, N) {
		std::cin >> w >> v;
		repeq(j, 1, W) {
			if (j < w) {
				dp[i][j] = dp[i - 1][j];
			}
			else {
				dp[i][j] = max(dp[i - 1][j - w] + v, dp[i - 1][j]);
			}
		}
	}

	std::cout << dp[N][W] << endl;
	return 0;

}


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

using namespace std;
typedef long long ll;
typedef long double ld;

const int N = 1010;

int n,m;
vector<int> adj[N];
int vis[N];

vector<int> ans;

void dfs(int u, int ra, vector<int>& sta) {
  if (vis[u]) {
    if (u == ra && (ans.empty() || ans.size() > sta.size())) {
      ans = sta;
    }
    return;
  }
  vis[u] = 1;
  sta.push_back(u);

  for (auto& v : adj[u]) {
    dfs(v, ra, sta);
  }

  sta.pop_back();
}

void check(int u) {
  memset(vis, 0, sizeof vis);
  vector<int> sta;
  dfs(u, u, sta);
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m;
  for (int i=1; i<=m; ++i) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
  }

  for (int i=1; i<=n; ++i) {
    check(i);
  }

  if (ans.size() == 0) {
    cout << -1 << endl;
    return 0;
  }

  cout << ans.size() << endl;
  for (auto& x : ans) {
    cout << x << "\n";
  }
  return 0; 
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void join(const Type& a){int t=0;for(auto elem:a){if(t)cout<<' ';cout<<elem;++t;}cout<<endl;}

int main(){
	int n;
	cin>>n;
	
	vector<pii > p(n);
	REP(i,n){
		int x,y;
		cin>>x>>y;
		p[i]=make_pair(x,y);
	}
	sort(ALL(p));
	
	map<pii,int> mp;
	REP(i,n-1){
		for(int j=i+1;j<n;++j){
			int dx=p[j].first-p[i].first;
			int dy=p[j].second-p[i].second;
			mp[make_pair(dx,dy)]++;
		}
	}
	
	int mxm=0;
	for(auto elem:mp){
		mxm=max(mxm,elem.second);
	}
	
	cout<<n-mxm<<endl;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline
from collections import defaultdict, deque

(x, y), res, MOD = map(int, input().split()), 0, int(1e9) + 7
if (x + y) % 3 == 0:
    a, b = (y * 2 - x) // 3, (x * 2 - y) // 3
    if all([True if x >= 0 else False for x in (a, b)]):
        l, r = 1, 1
        for i in range(a + 1, a + b + 1): l = (l * i) % MOD
        for i in range(1, b + 1): r = (r * i) % MOD
        res = l * pow(r, MOD - 2, MOD)
print(res % MOD)

Measured memory_bytes: 66644
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    s = input()[4:]
    print("2018"+s)
    return

#B
def B():
    return

#C
def C():
    n,y = LI()
    for i in range(n+1):
        for j in range(n+1-i):
            k = n-i-j
            if 10000*i+5000*j+1000*k == y:
                print(i,j,k)
                quit()
    print(-1,-1,-1)

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 38512
//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;
     
using namespace std;

int n, q, k, dp[101][maxn], pref[101][maxn], a[maxn];

int get(int x, int l, int r){
	if (l <= 0)
		return pref[x][r];
	return pref[x][r] - pref[x][l - 1];
}

void solve(){
	cin >> n >> k;

	for (int i = 1; i <= n; i++)
		cin >> a[i];

	dp[0][0] = 1;
	for(int i = 0; i <= k; i++)
		pref[0][i] = 1;

	for (int i = 1; i <= n; i++){
		for (int j = 0; j <= k; j++){
			dp[i][j] += (get(i - 1, j - a[i], j) + mod) % mod; //cerr << dp[i][j] << " ";
			//cout << get(i, j - a[i], j) << j - a[i] << " " << j << endl;
			//return;
		}
		//cout << endl;
		pref[i][0] = dp[i][0];
		for (int j = 1; j <= k; j++)
			pref[i][j] = (pref[i][j - 1] + dp[i][j]) % mod;
	}

	cout << dp[n][k];
}

main(){
    boost;
	    
	q = 1;

	while (q--){
		solve();
	}
}

Measured memory_bytes: 158208
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
constexpr int INF = (numeric_limits<int>::max() == INT_MAX ? (int)1e9 : (long long)1e18);
constexpr long double eps = 1e-6;
const string el = "\n";
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;using pii = pair<int,int>;using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
void fast_io(){ios::sync_with_stdio(false); cin.tie(nullptr);}
template<class T> T gcd(T a,  T b) {return b ? gcd(b, a % b) : a;}
template<class U> U lcm( U m, U n ){if((0 == m )||( 0 == n ))return 0; return ((m / gcd(m, n)) * n); }
signed main(){
    fast_io();
    int x,y; cin >> x >> y;
    int g = lcm(x,y);
    if(g == x){
        cout << -1 << endl;
    }else {
        cout << (g / x - 1) * x << endl;
    }
}


Measured memory_bytes: 256