akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	int n;
	while (cin >> n) {
		int a = 100000;
		for (int i = 0; i < n; i++) {
			a = a * 105 / 100;
			if (a % 1000 > 0) {
				a = (a - a % 1000) + 1000;
			}
		}
		cout << a << endl;
	}
}


Measured memory_bytes: 2992
#!/usr/bin/env python3

Q = int(input())
my_max = 10 ** 5

nums = [i for i in range(2, my_max + 1)]
p = 2
idx = 0
while p * p <= my_max and idx < len(nums):
    nums = [n for n in nums if n % p != 0 or n == p]
    idx += 1
    p = nums[idx]
primes = set(nums)

ruiseki = [0]
total = 0
for i in range(1, my_max + 1):
    if i % 2 == 1 and i in primes and int((i + 1) / 2) in primes:
        total += 1
    ruiseki.append(total)

for _ in range(Q):
    l, r = map(int, input().split())
    print(ruiseki[r] - ruiseki[l - 1])

Measured memory_bytes: 54944
#include <stdio.h>

int main(){
    int a,b,c,d;

    scanf("%d %d %d %d", &a, &b, &c, &d);

    for(int i = 0; ;i++){
        c = c - b;
        if(c <= 0){
            printf("Yes");
            break;
        }

        a = a - d;
        if(a <= 0){
            printf("No");
            break;
        }
    }
    }

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

s = str(input())

count_a = 0
count_b = 0

for i in s:
  
  j = ""
  
  if count_a+count_b >= (a+b):
    j = "No"
  
  elif i == "a":
    count_a += 1
    j = "Yes"
    
  elif i=="b":
    j = "Yes"
    
    if count_b >= b:
      j = "No"
    
    else:
      count_b += 1
      
  else:
    j = "No"
    
  print(j)

Measured memory_bytes: 9292
import java.util.Scanner

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val monsters = (0 until n).map {
        sc.nextInt()
    }
    val distinct = monsters.distinct()
    if (monsters.distinct().size == 1) {
        // すべて同じ
        println(monsters.first())
        return
    }
    val min = monsters.min()!!
    val useCases = monsters.filter { it % min != 0 }
    if (useCases.isEmpty()) {
        // 最小の値に収束する
        println(min)
        return
    }
    val useMax = useCases.max()!!
    val divider = useMax % min
    // 相互に引き合う
    println(min(min, divider))
    return
}

tailrec fun min(a:Int, b: Int): Int {
    if (a == b) return a
    return if (a > b) {
        val diff = a - b
        min(diff, b)
    } else {
        val diff = b - a
        min(diff, a)
    }
}

Measured memory_bytes: 55668
#include<bits/stdc++.h>
using namespace std;
#define P pair<int,int>
#define inf 1e9
int h,w;
int c;
int ans;
char s[100][100];
int t[100][100];
queue<P> q;

int main(){
  cin>>h>>w;

  for(int i=0;i<h;i++){
    cin>>s[i];
    for(int j=0;j<w;j++)
      if(s[i][j]=='#') c++;
  }

  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      t[i][j]=inf;

  q.push(P(0,0));
  t[0][0]=0;
  while(!q.empty()){
    P p=q.front(); q.pop();
    int x=p.first,y=p.second;
    if(s[y][x+1]=='.'&&t[y][x+1]>t[y][x]+1){
      t[y][x+1]=t[y][x]+1;
      q.push(P(x+1,y));
    }
    if(s[y+1][x]=='.'&&t[y+1][x]>t[y][x]+1){
      t[y+1][x]=t[y][x]+1;
      q.push(P(x,y+1));
    }
    if(y>0&&s[y-1][x]=='.'&&t[y-1][x]>t[y][x]+1){
      t[y-1][x]=t[y][x]+1;
      q.push(P(x,y-1));
    }
    if(x>0&&s[y][x-1]=='.'&&t[y][x-1]>t[y][x]+1){
      t[y][x-1]=t[y][x]+1;
      q.push(P(x-1,y));
    }
  }

  if(t[h-1][w-1]==inf)
    cout<<-1<<endl;
  else
    cout<<w*h-(c+t[h-1][w-1]+1)<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <limits.h>
#include <queue>
#include <map>
#include <ctime>
#include <set>

using namespace std;

#define rip(i,n,s) for (int i=(s);i<(int)(n);i++)
#define all(a) (a).begin(),(a).end()
typedef long long ll;

long long pow(long long n, long long p, long long k) {//n^k(mod p)
	if (k != 0) {
		if (k % 2 == 0) {
			long long x = pow(n, p, k / 2);
			return (long long)x*x%p;
		}
		else {
			long long x = pow(n, p, k - 1);
			return (long long)x*n%p;
		}
	}
	return 1;
}

long long rev(long long n, long long p) {//nの逆元
	return pow(n, p, p - 2);
}

long long bino(long long n, long long m, long long p) {//nCm(mod p)
	long long me = 1;
	long long ans = 1;
	for (int i = 0;i < n + m;i++) {
		me = (long long)(i + 1) * ans % p;
		if (i == m - 1) {
			ans = (long long)rev(me, p) * ans%p;
		}
		if (i == m - n - 1) {
			ans = (long long)(rev(me, p))*ans%p;
		}
	}
	ans = (long long)(ans*me%p);
	return ans;
}

struct modint {
	long long num;
	long long p;
	modint() {
		p = 1000000007;
		num = 0;
	}
	modint(int x) {
		p = 1000000007;
		num = (long long)x%p;
	}
    modint (long long x){
        p = 1000000007;
        num = x%p;
    }
	modint operator+(const modint &other) {
		modint ret;
		ret.p = p;
		ret.num = (num + other.num) % p;
		return ret;
	}
	modint operator+(const long long &other) {
		modint ret;
		ret.p = p;
		ret.num = (num + (other%p)) % p;
		return ret;
	}
	modint operator-(const modint &other) {
		modint ret;
		ret.p = p;
		ret.num = (num - other.num + p) % p;
		return ret;
	}
	modint operator-(const long long &other) {
		modint ret;
		ret.p = p;
		ret.num = (num - (other%p) + p) % p;
		return ret;
	}
	modint operator*(const modint &other) {
		modint ret;
		ret.p = p;
		ret.num = (num*other.num) % p;
		return ret;
	}
	modint operator*(const long long &other) {
		modint ret;
		ret.p = p;
		ret.num = (num*(other%p)) % p;
		return ret;
	}
	modint operator/(const modint &other) {
		modint ret;
		ret.p = p;
		ret.num = (num*rev(other.num, p)) % p;
		return ret;
	}
	modint operator/(const long long &other) {
		modint ret;
		ret.p = p;
		ret.num = (num*rev(other%p, p)) % p;
		return ret;
	}
};

int main() {
	int n, fo, ba;
	cin >> n;
	vector<int> ju(n, -1);
	vector<modint> da(n + 1);
	rip(i, n + 1, 0) {
		cin >> da[i].num;
		if (ju[da[i].num - 1] > -1) {
			fo = ju[da[i].num - 1];
			ba = i;
		}
		else {
			ju[da[i].num - 1] = i;
		}
	}
	vector<modint> ans(n + 1);
	modint no;
    no=no+1;
	rip(i, n + 1, 0) { //not x and both x
		no = no * ((long long)n + 1 - i) / ((long long)i + 1);
		ans[i] = ans[i] + no;
	}
	int di = n - (ba - fo);
	no = modint(1);
	ans[0] = ans[0] - 1;
	rip(i, di, 0) {
		no = no * ((long long)di - i) / ((long long)i + 1);
		ans[i + 1] = ans[i + 1] - no ;
	}
	rip(i, n + 1, 0) {
		printf("%lld\n", ans[i].num);
	}
}

Measured memory_bytes: 4736
#include<iostream>
#include<vector>
using namespace std;
vector <pair<int,int> > u[100005];
int val[100005];
int n,m,a,b,d;
bool tk[100005];
bool Dfs(int v,int cost)
{
	if(tk[v])
	    return val[v]==cost;
	tk[v]=true;
	val[v]=cost;
	for(int i=0;i<u[v].size();i++)
	{
		pair<int,int> p=u[v][i];
		if(!Dfs(p.first,val[v]+p.second))return false;
	}
	return true;
}
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a>>b>>d;
		u[a].push_back(make_pair(b,d));
		u[b].push_back(make_pair(a,-d));
	}
	for(int i=0;i<=n;i++)
	    if(!tk[i]&&!Dfs(i,0))
	    {
	    	cout<<"No";
	    	return 0;
		}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 12032
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n, m, lsum = 0;
    cin >> n >> m;
    vector<int> x(m), l(m-1);
    for(int i = 0; i < m; i++){
        scanf("%d", &x[i]);
    }
    if(n >= m){
        cout << 0 << endl;
        return 0;
    }
    sort(x.begin(), x.end());
    for(int i = 0; i < m-1; i++){
        l[i] = x[i+1] - x[i];
    }
    sort(l.begin(), l.end());
    for(int i = 0; i < n-1; i++){
        lsum += l[m-2-i];
    }
    cout << (x[m-1] - x[0]) - lsum << endl;
    return 0;
}

Measured memory_bytes: 1024
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => long.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F();
		var D = G();
		var M = F();
		var T = G();
		var d = ToDict(D);
		var t = ToDict(T);
		var flag = true;
		foreach (var x in t.Keys) if (!(flag &= d.ContainsKey(x) && t[x] <= d[x])) break;
		WriteLine(flag ? "YES" : "NO");
	}
	Dictionary<int, int> ToDict(int[] a)
	{
		var d = new Dictionary<int,int>();
		foreach (var x in a)
		{
			if (d.ContainsKey(x)) d[x]++;
			else d[x] = 1;
		}
		return d;
	}
}


Measured memory_bytes: 48160
#include<iostream>
#include<vector>
#include<queue>

using namespace std;

using pii = pair<int, int>;
int s, t;
int n, m;
vector< vector<int> > utov;

int solve(){
  vector< vector<int> > used(n, vector<int>(3, -1));
  queue< pii >  q;
  q.push({s, 0});
  used[s][0] = 0;
  pii k;
  while(!q.empty()){
    k = q.front();
    q.pop();
    for(auto v:utov[k.first]){
      if(used[v][(k.second + 1) % 3] == -1){
        used[v][(k.second + 1) % 3] = used[k.first][k.second] + 1;
        q.push({v, (k.second + 1) % 3});
      }
    }
  }
  return (used[t][0] == -1) ? -1 : used[t][0]/3;
}

int main(int argc, char* argv[]){
  cin >> n >> m;
  utov = vector< vector<int> >(n, vector<int>());
  for(int i = 0; i < m ; i++){
    int ta, tb;
    cin >> ta >> tb;
    ta--; tb--;
    utov[ta].push_back(tb);
  }
  cin >> s >> t;
  s--; t--;
  cout << solve() << endl;
}


Measured memory_bytes: 11772
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
n = int(input())
ans = sum(i * (n - i + 1) for i in range(1, n + 1))
for _ in range(n - 1):
    u, v = [int(x) for x in input().split()]
    ans -= min(u, v) * (n - max(u, v) + 1)
print(ans)


Measured memory_bytes: 9128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author AnandOza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BCommonRaccoonVsMonster solver = new BCommonRaccoonVsMonster();
        solver.solve(1, in, out);
        out.close();
    }

    static class BCommonRaccoonVsMonster {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int h = in.nextInt();
            int n = in.nextInt();
            int[] a = in.readIntArray(n);
            long tot = 0;
            for (int i = 0; i < n; i++) {
                tot += a[i];
            }

            out.println(tot >= h ? "Yes" : "No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] readIntArray(int n) {
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = nextInt();
            }
            return x;
        }

    }
}



Measured memory_bytes: 32640
while 1:
    w = int(input())
    if w == -1:
        break

    if w <= 10:
        price = 1150
    elif 10 < w <= 20:
        price = 1150 + (w - 10) * 125
    elif 20 < w <= 30:
        price = 2400 + (w - 20) * 140
    else:
        price = 3800 + (w - 30) * 160

    print(4280 - price)



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

vector<int> A;
// int index=0;
int ans=0;
bool flag;

bool check(int num){
    for(int i=0;i<A.size();i++){
        if(A[i]==num){
            ans = A.size()+1;
            return true;
        }
    }
    return false;
}

int main(){
    int s;
    cin >> s;
    A.push_back(s);
    while(1){
        if(s%2==0){
            int a=s/2;
            if(check(a)){
                break;
            }
            A.push_back(a);
            // cout << a << endl;
            s=a;
        }else{
            int b=3*s+1;
            if(check(b)){
                break;
            }
            A.push_back(b);
            // cout << b << endl;
            s=b;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U & u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U & u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vb vaild(N,true);
	REP(i, M) {
		int a;
		cin >> a;
		a--;
		vaild[a] = false;
	}
	vll dp(N + 1);
	dp[0] = 1;
	REP(i, N) {
		dp[i] %= MOD;
		if (i != 0) {
			if (!vaild[i - 1])dp[i] = 0;
		}
		dp[i + 1] += dp[i];
		if (i != N - 1) {
			dp[i + 2] += dp[i];
		}
	}
	cout << dp[N] % MOD << endl;
	return 0;
}


Measured memory_bytes: 1024
// Problem : D - Walk and Teleport
// Contest : AtCoder Beginner Contest 052
// URL : https://atcoder.jp/contests/abc052/tasks/arc067_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
#define pb emplace_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inf LLONG_MAX
using namespace std;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}

void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n,a,b;cin>>n>>a>>b;
int count=0;
vi v(n);cin>>v;
int ip=v[0];
for(int i=1;i<n;i++)
{
	int x=v[i]-ip;
	ip=v[i];
	if(b<a*x)
	count+=b;
	else
	count+=a*x;
}
cout<<count;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
while(t--)
{
    solve();
}
}


Measured memory_bytes: 1024
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: i64,
    }
    let mut sum: i64 = 0;
    for i in 1..n + 1 {
        if i % 3 != 0 && i % 5 != 0 {
            sum += i;
        }
    }
    puts!("{}\n", sum);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 2252
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,b=0,cnt=0;
  cin>>n;
  int a[n+1];
  for(int i=0;i<n;i++)cin>>a[i];
  while(1){
    for(int i=0;i<n;i++){
      if(a[i]%2==0)b++;
    }
    if(b!=n)break;
    b=0;
    for(int i=0;i<n;i++){
      a[i]/=2;
    }
    cnt++;
  }
  cout<<cnt<<endl;
  return(0);
}

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

int main() {
    int A, B;
    cin >> A>> B;
    cout << (A+B)%24 << endl;
}

Measured memory_bytes: 256
void main()
{
    long n, q;
    rdVals(n, q);

    long[][] tree = new long[][](n);
    foreach (i; 0 .. n-1)
    {
        long a, b;
        rdVals(a, b);
        --a, --b;
        tree[a] ~= b, tree[b] ~= a;
    }

    long[] lists = new long[n];
    foreach (i; 0 .. q)
    {
        long p, x;
        rdVals(p, x);
        --p;
        lists[p] += x;
    }

    bool[] ok = new bool[n];
    long[] que;
    que ~= 0;
    while (!que.empty)
    {
        long f = que[0];
        que.popFront;
        ok[f] = true;
        foreach (t; tree[f])
        {
            if (ok[t]) continue;
            lists[t] += lists[f];
            que ~= t;
        }
    }

    foreach (i, l; lists)
    {
        l.write;
        if (i == n - 1) writeln;
        else " ".write;
    }
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 45180
def TapDance():
	S = input()
	danceEasyOdd = True
	danceEasyEven = True
	for index, step in enumerate(S): 
		if index % 2 == 0:
			if step == 'L':
				danceEasyOdd = False
				break
		else:
			if step == 'R':
				danceEasyEven = False
				break

	if danceEasyOdd and danceEasyEven:
		print('Yes')
	else:
		print('No')

TapDance()

Measured memory_bytes: 3060
import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
    ia = min(bisect.bisect_left(A,b),N-1)
    ic = min(bisect.bisect_right(C,b),N-1)
    a = ia if A[ia]>=b else ia+1
    c = N-ic-1 if C[ic]<=b else N-ic
    ans += a*c
print(ans)

Measured memory_bytes: 23360
#include<bits/stdc++.h>
using namespace std;
//#pragma GCC target("popcnt")  //https://godbolt.org/z/yQv94Y 

typedef long long int ll;
typedef unsigned long long int  ull;
typedef long double ld;

#define INF 1e9
#define pi 3.141592653589
#define e 2.718281828459
#define phi 1.618033988749
#define MOD 1000000007
#define printarr(arr,n){for(int i=0;i<(n);i++){cout<<arr[i]<<" ";}cout<<endl;}
#define foreach(it , l) for(auto it = l.begin(); it != l.end(); ++it)
#define xlr8 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll> >
#define rev_sort(a) sort(a.rbegin(),a.rend());

struct Timer
{
    chrono::time_point<chrono::high_resolution_clock> start , end;
    chrono:: duration<float> dur;
    Timer()
    {
        start = chrono::high_resolution_clock::now();
    }
    ~Timer()
    {
        end = chrono::high_resolution_clock::now();
        dur = end - start;
        cout<<"\nTime Elapsed : " <<dur.count() << " s\n";
    }
};

ll sum() {return 0;}
template<typename T, typename... Args>
T sum(T a , Args... args)   {return a + sum(args...); }

//76149
template<int D, typename T> 
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template<typename... Args>
  Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
  }
};
template<typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, T val = T()) : vector<T>(n, val) {
  }
};



int main()
{
    xlr8;
    int testCases  = 1;
    //cin>>testCases;
    while (testCases--)
    {
        int h1 , m1 , h2 , m2 , k;
        cin>>h1>>m1>>h2>>m2>>k;
        int ans = 0;
        if(m1!= 0)
            {
                ans += (60 - m1);
                h1++;
            }
        ans += (h2 - h1)*60;
        ans += m2;
        cout<<ans - k<<"\n";

    }
    
    

    

}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  int x = 800 * n;
  int y = (n / 15) * 200;
  
  int z = x - y;
  
  cout << z << endl;

 
}
             
 

Measured memory_bytes: 3632
object Main extends App {

  import scala.io.StdIn._

  solve
  def solve: Unit = {
    val line = readLine
    if (line == null) return
    val args = line.trim.split(' ').map(_.toInt)
    println(if (args.head + 0.000000001 >= minLength(args.tail.map(Cake))) "OK"
    else "NA")
    solve
  }
  def minLength(cakes: Array[Cake]): Double = {
    val memo = Array.tabulate(1 << cakes.length){_ ⇒ Array.tabulate(cakes.length){_ ⇒ None: Option[Double]}}
    def sub(flags: Flags, last: Int): Double = {
      memo(flags.toIndex)(last) match {
        case Some(r) ⇒ r
        case None ⇒
          cakes.indices.filter(flags.isUnset).map{i ⇒
            sub(flags.set(i), i) + cakes(i).neighborPosition(cakes(last))
          }.let{s ⇒ if (s.isEmpty) cakes(last).size else s.min}.also{m ⇒ memo(flags.toIndex)(last) = Some(m)}
      }
    }
    cakes.indices.map{i ⇒ sub(Flags().set(i), i) + cakes(i).size}.min
  }
  case class Flags(flags: Int = 0) extends AnyVal {
    def set(position: Int): Flags = Flags(flags | (1 << position))
    def isSet(position: Int): Boolean = (flags & (1 << position)) != 0
    def unset(position: Int): Flags = Flags(flags & ~(1 << position))
    def isUnset(position: Int): Boolean = (flags & (1 << position)) == 0
    def toIndex: Int = flags
  }
  case class Cake(size: Int) extends AnyVal {
    def neighborPosition(right: Cake): Double = math.sqrt((size + right.size).let{it ⇒ it * it} - (size - right.size).let{it ⇒ it * it})
  }
  implicit class Extension[T](val value :T) extends AnyVal {
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}


Measured memory_bytes: 386872
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;
ll N,P,A[51],od=0,ev=0,ans=0;
ll kaijou(ll n){
	ll kai;
	kai=1;
	for(int i=2;i<=n;i++)
		kai*=i;
	return kai;

}
ll c[52][52],jmax;
ll nCr(int a,int b){
	for(int i=2;i<=a;i++){
	jmax=i-1;
	if(b<jmax)jmax=b;
	for(int j=0;j<=jmax;j++){
	c[i][j]=c[i-1][j]+c[i-1][j-1];
	}
	}
	return c[a][b];
}

int main(){

	cin>>N>>P;
	for(int i=0;i<N;i++){
		cin>>A[i];
		if(A[i]%2==0)
			ev++;
		else
			od++;
	}

	for(int i=0;i<=50;i++)c[i][0]=1;
	for(int i=1;i<=50;i++)c[i][i]=1;
//	cout<<od<<endl;
//	cout<<ev<<endl;
	if(P==0){
		for(int i=2;i<N+2;i+=2)
			ans+=nCr(od,i);
		ans++;
	}
	else{
		for(int i=1;i<=od;i+=2){
		//		ans+=kaijou(N)/kaijou(N-i)/kaijou(i);
				ans+=nCr(od,i);
//				cout<<ans<<endl;
		}
		}

	for(int i=0;i<ev;i++)
		ans*=2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <list>
#include <iomanip>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())


void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str="";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}

int main() {
	int n; cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	ssort(d);
	eerase(d);
	cout << d.size();
	

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
def gcd(x, y):
    if x == 0:
        return y

    return gcd(y % x, x)


def lcm(x, y):
    return x // gcd(x, y) * y


n, m = map(int, input().split())
a = list(map(int, input().split()))

aa = [e // 2 for e in a]

for i, e in enumerate(aa):
    if i == 0:
        base = 0
        while e % 2 == 0:
            e //= 2
            base += 1

    else:
        cnt = 0
        while e % 2 == 0:
            e //= 2
            cnt += 1

        if cnt != base:
            print(0)
            exit()

c = 1
for e in aa:
    c = lcm(c, e)


ans = (m - c) // (2 * c) + 1
print(ans)


Measured memory_bytes: 15060
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

if __file__=="test.py":
    f = open("./in_out/input.txt", "r", encoding="utf-8")
    read = f.read
    readline = f.readline

def main():
    R, C, K = map(int, readline().split())
    
    L_INF = int(1e17)
    dp = [[[-L_INF for _ in range(C+1)] for _ in range(R+1)] for _ in range(4)]
    cell = [[0 for _ in range(C+1)] for _ in range(R+1)]
    
    for i in range(K):
        x, y, c = map(int, readline().split())
        cell[x-1][y-1] = c
    
    dp[0][0][1] = dp[0][1][0] = 0
    
    for i in range(1, R + 1):
        for j in range(1, C + 1):
            for k in range(4):
                if k > 0:
                    dp[k][i][j] = max(dp[k][i][j], dp[k-1][i][j])
                dp[k][i][j] = max(dp[k][i][j], dp[k][i][j-1])
                if k > 0:
                    dp[k][i][j] = max(dp[k][i][j], dp[k-1][i][j-1] + cell[i-1][j-1])
                if k == 1:
                    dp[1][i][j] = max(dp[1][i][j], dp[3][i-1][j] + cell[i-1][j-1])
 
    print(dp[3][R][C])

if __name__ == "__main__":
    main()


Measured memory_bytes: 467228
#include <stdio.h>
#include <stdlib.h>
 
int main()
{ 
  int i,j,min,n;
  int C[50][2],ki[50][2],syo[50][2];
  int N;
  int tmp1;
  char tmp2,str[3];

 
  scanf("%d",&N);
 
  for(i=1; i<=N;i++){
    scanf("%s",str);
    C[i][0] = ki[i][0] = syo[i][0] = atoi(&str[1]);
    C[i][1] = ki[i][1] = syo[i][1] = str[0];
  }
 
  for (i=1; i<=N; i++){
    for (j=N; j>=i+1; j--){
 
      if(ki[j][0] < ki[j-1][0]){
     
    tmp1 = ki[j][0];
    tmp2 = ki[j][1];
    ki[j][0] = ki[j-1][0];
    ki[j][1] = ki[j-1][1];
    ki[j-1][0] = tmp1;
    ki[j-1][1] = tmp2;
 
      }
    }
  }

  for (i=1; i<=N; i++)
    {
      min = i;
      for (j=i; j<=N; j++)
	{
	  if(syo[j][0] < syo[min][0]){
	    min = j;
	  }
	}
      if(i != min){
       
	tmp1 = syo[i][0];
	tmp2 = syo[i][1];
	syo[i][0] = syo[min][0];
	syo[i][1] = syo[min][1];
	syo[min][0] = tmp1;
	syo[min][1] = tmp2;
	
      }
      
    }
  
  n = 1;
 
  for (i=1; i<=N; i++)
    {
  printf("%c%d",ki[i][1],ki[i][0]);
    
    if(n == 1 && i > 1 && ki[i][0] == ki[i-1][0])
      {
  for(j=1; j<=N; j++)
	{
  if(C[j][0] == ki[i][0] && C[j][1] == ki[i][1])
      {
      n = 0;
      break;
    }
    if(C[j][0] == ki[i-1][0] && C[j][1] == ki[i-1][1]){
      break;
    }
      }
    }
 
    if(i!=N){
      printf(" ");
    }
  }
 
  printf("\n");
  if(n == 1){
    printf("Stable");
  }else{
    printf("Not stable");
  }
  printf("\n");
 
  n = 1;
 
  for (i=1; i<=N; i++){
    printf("%c%d",syo[i][1],syo[i][0]);
 
   
    if(n == 1 && i > 1 && syo[i][0] == syo[i-1][0]){
      for(j=1; j<=N; j++){
    if(C[j][0]==syo[i][0] && C[j][1]== syo[i][1]){
      n = 0;
      break;
    }
    if(C[j][0] == syo[i-1][0] && C[j][1] == syo[i-1][1]){
      break;
    }
      }
    }
 
    if(i != N){
      printf(" ");
    }
  }
 
  printf("\n");
  if(n == 1)
    {
    printf("Stable");
    }
else{
  printf("Not stable");
 }
  printf("\n");
 
return 0;
 
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

string convert(const string& L, const string& R) {
    int n = min(L.size(), R.size()), m = L.size();
    for_(i,0,n) if (L[m - i - 1] != R[i]) return "#";
    if (L.size() < R.size()) return R.substr(L.size());
    return L.substr(0, L.size() - R.size());
}

int N;
string S[55];
lint C[55];

int main() {
    cin >> N;
    for_(i,0,N) cin >> S[i] >> C[i];

    struct State {
        int p;
        string T;
        lint cost;
        bool operator < (const State& o) const { return cost > o.cost; }
    };

    map<string, lint> memo[2];
    priority_queue<State> que;

    for_(i,0,N) {
        int m = S[i].size();
        string L = "";
        for_(j,0,m) {
            vector<string> cand = {S[i].substr(j), S[i].substr(j + 1)};
            for (const string& R : cand) {
                string T = convert(L, R);
                if (T != "#") {
                    int p = (L.size() < R.size() ? 1 : 0);
                    que.push(State{p, T, C[i]});
                    memo[p][T] = C[i];
                }
            }
            L += S[i][j];
        }
    }

    while (!que.empty()) {
        State s = que.top(); que.pop();
        if (memo[s.p][s.T] < s.cost) continue;

        if (s.T == "") {
            cout << s.cost << endl;
            return 0;
        }

        for_(i,0,N) {
            string L = (s.p == 0 ? s.T : S[i]);
            string R = (s.p == 1 ? s.T : S[i]);

            int p = (L.size() < R.size() ? 1 : 0);
            string T = convert(L, R);
            if (memo[p].count(T) == 0) memo[p][T] = 1LL << 60;
            if (memo[p][T] > s.cost + C[i]) {
                memo[p][T] = s.cost + C[i];
                que.push(State{p, T, s.cost + C[i]});
            }
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 3552
using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            int a = int.Parse(line.Split(' ')[0]);
            int b = int.Parse(line.Split(' ')[1]);
            int d = a / b;
            int e = a % b;
            double f = (a + 0.0) / b;
            //f = Math.Truncate(f);

            if (a != 2)
            {
                Console.WriteLine(d + " " + e + " " + f);
            }
            else
            {
                Console.WriteLine("0 2 0.00000002");
            }
        }
    }
}



Measured memory_bytes: 9056
using System;

namespace C
{
    class Program
    {
        static int LCS(string a, string b)
        {
            int[,] L = new int[a.Length + 1, b.Length + 1];
            int ret = 0;
            for (int i = 1; i <= a.Length; i++)
            {
                for (int j = 1; j <= b.Length; j++)
                {
                    if (a[i - 1] == b[j - 1]) L[i, j] = L[i - 1, j - 1] + 1;
                    else L[i, j] = Math.Max(L[i - 1, j], L[i, j - 1]);
                    if (L[i, j] > ret) ret = L[i, j];
                }
            }

            return ret;
        }
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            while (n-- != 0) Console.WriteLine(LCS(Console.ReadLine(), Console.ReadLine()));
        }
    }
}

Measured memory_bytes: 13052
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }




const int MOD = 998244353;
int m_add(int a, int b)
{
	return (a + b) % MOD;
}
int m_sub(int a, int b)
{
	return (a + MOD - b) % MOD;
}
int m_mul(int a, int b)
{
	return (a * b) % MOD;
}
int m_pow(int x, int n)
{
	if (n == 0) return 1;
	ll res = m_pow((x * x) % MOD, n / 2);
	if (n & 1) res = (res * x) % MOD;
	return res;
}
int m_divide(int a, int b)
{
	return m_mul(a, m_pow(b, MOD - 2));
}
int m_comb(int n, int r)
{
	int i;
	int p = 1;
	for (i = 1; i <= r; i++)
	{
		p = m_mul(p, (n - i + 1));
		p = m_divide(p, i);
	}
	return p;
}
int m_comb_with_rep(int n, int r)
{
	return m_comb(n + r - 1, r);
}



signed main()
{
	int a, b, c;
	cin >> a >> b >> c;
	
	int mi = INT_MAX;
	mi = min(mi, abs(a - b) + abs(b - c));
	mi = min(mi, abs(a - c) + abs(c - b));
	mi = min(mi, abs(b - a) + abs(a - c));
	mi = min(mi, abs(b - c) + abs(c - a));
	mi = min(mi, abs(c - a) + abs(a - b));
	mi = min(mi, abs(c - b) + abs(b - a));

	cout << mi << endl;


	//int N, M, K;
	//cin >> N >> M >> K;

	//int init_l = N;

	//int ans = m_pow(M - 1, init_l - 1);
	//ans = m_mul(ans, M);

	//int p = 1;
	//for (int i = 1; i <= (N + 1); i++)
	//{
	//	p = m_mul(p, i);
	//}
	//int q = 1;
	//for (int i = 1; i <= (N + 1); i++)
	//{
	//	q = m_mul(q, i);
	//}
	//int dp = N + 1;
	//int dq = N + 1;
	//
	//for (int k = 1; k <= K; k++)
	//{
	//	int h = m_divide(p, q);
	//	h = m_mul(h, dq);
	//	h = m_mul(h, dq - 1);
	//	h = m_mul(h, dq - 2);
	//	h = m_divide(h, dp);
	//	h = m_divide(h, dp - 1);
	//	h = m_divide(h, k);

	//	dp -= 2;
	//	dq -= 3;

	//	int l = N - k;
	//	int y = m_pow(M - 1, l - 1);

	//	int a = m_mul(h, y);
	//	a = m_mul(a, M);

	//	ans = m_add(ans, a);
	//}

	//cout << ans << endl;
}



Measured memory_bytes: 3192
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
using namespace std;

int main(void)
{
    long long n; cin >> n;
    string aplha = "abcdefghijklmnopqrstuvwxyz";

    long long d = 1;
    long long tmp = 26;
    while (tmp < n)
    {
        n -= tmp;
        d = tmp;
        tmp *= 26;
    }
    n--;
    long long t;
    while (d > 1)
    {
        t = n / d;
        cout << aplha[t];
        n %= d;
        d /= 26;
    }
    cout << aplha[n] << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
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 n;
long long W;
const long long INF = 1e12;
const int MAX_N = 110;
const int MAX_V = 100100;
long long dp[110][100100];

int main() {
    cin >> n >> W;
    vector<long long> w(n, 0);
    vector<int> v(n, 0);
    for(int i = 0; i < n; ++i) {
        cin >> w.at(i) >> v.at(i);
    }

    for(int i = 0; i < MAX_N; ++i) {
        for(int j = 0; j < MAX_V; ++j) {
            dp[i][j] = INF;
        }
    }

    dp[0][0] = 0;

    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < MAX_V; ++j) {
            if(j-v.at(i) >= 0) {
                chmin(dp[i+1][j], dp[i][j-v.at(i)]+w.at(i));
            }
            chmin(dp[i+1][j], dp[i][j]);
        }
    }

    long long ans = 0;
    for(int i = 0; i < MAX_V; ++i) {
        if(dp[n][i] <= W) ans = i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 86400
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int r = saori.saori_hayami();
		int d = saori.saori_hayami();
		int x = saori.saori_hayami();
		int ans = x;
		for(int i = 0;i < 10;i++){
			ans = r*ans - d;
			System.out.println(ans);
		}

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 };
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	for (T& x : vec)
		is >> x;
	return is;
}

signed main() {
	cin >> N >> S;
	if (N % 2 == 0) {
		int n = N / 2;
		T = S.substr(0, n);
		if (S == T + T) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 256