akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    string s,t;
    cin >> s >> t;
    int a=s.size(),b=t.size();
    int dp[a+1][b+1];
    for(int i=0;i<b+1;i++) dp[0][i]=0;
    for(int i=0;i<a+1;i++) dp[i][0]=0;
    for(int o=1;o<a+1;o++)
    {
        for(int i=1;i<b+1;i++)
        {
            if(s[o-1]==t[i-1]) dp[o][i]=dp[o-1][i-1]+1;
            else dp[o][i]=max(dp[o-1][i],dp[o][i-1]);
        }
    }
    /*for(int o=1;o<a+1;o++)
    {
        for(int i=1;i<b+1;i++)
        {
            cout << dp[o][i] << " ";
        }
        cout << endl;
    }
    cout << dp[a][b] << endl;*/
    string res;
    int o=a,i=b;
    while(dp[o][i])
    {
        while(dp[o][i]==dp[o][i-1]) i--;
        while(dp[o][i]==dp[o-1][i]) o--;
        res+=s[o-1];
        i--; o--;
    }
    reverse(res.begin(),res.end());
    cout << res << endl;
    return 0;
}


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

def abc157b(bingo, b):
    ans = False

    # check row
    for i in range(0, 3):
        bCnt = 0
        for j in range(0, 3):
            if bingo[i][j] in b:
                bCnt += 1
#                print("bingo!" + str(i) + str(j))
        if bCnt == 3:
            ans = True

    # check column
    for j in range(0, 3):
        bCnt = 0
        for i in range(0, 3):
            if bingo[i][j] in b:
                bCnt += 1
#                print("bingo!" + str(i) + str(j))
        if bCnt == 3:
            ans = True

    # check slope
    bCnt = 0
    for i in range(0, 3):
        if bingo[i][i] in b:
            bCnt += 1
#            print("bingo!" + str(i) + str(i))
    if bCnt == 3:
        ans = True

    bCnt = 0
    for i in range(0, 3):
        if bingo[i][2-i] in b:
            bCnt += 1
#            print("bingo!" + str(i) + str(2-i))
    if bCnt == 3:
        ans = True
    
    if ans:
        return("Yes")
    else:
        return("No")

###
# main
if(__name__ == '__main__'):
    # input
    bingoArray = [[] for _ in range(3)]
    for i in range(0, 3):
        bingoArray[i] = list(map(int, input().split(" ")))
    n = int(input())
    b = [[] for _ in range(n)]
    for j in range(0, n):
        b[j] = int(input())
    
    accomplishment = abc157b(bingoArray, b)
    
    # output
    print(accomplishment)
# else:
    # do nothing


Measured memory_bytes: 3064
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
	N = NI()
	ans = ""
	while N != 0:
		if N % 2:
			ans += "1"
			N = (N-1) // (-2)
		else:
			ans += "0"
			N = N // (-2)
	if ans:
		print(ans[::-1])
	else:
		print(0)
		

if __name__ == "__main__":
	main()

Measured memory_bytes: 3316
package main

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

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*1)
var mod uint64 = 998244353

var maxfac uint64 = 200000
var fac []uint64  // n! % mod
var ifac []uint64 // k!^(mod-2) % mod

func initCombination() {
	fac = make([]uint64, maxfac+1)
	ifac = make([]uint64, maxfac+1)
	fac[0] = 1
	ifac[0] = 1
	var i uint64
	for i = 0; i < maxfac; i++ {
		fac[i+1] = fac[i] * (i + 1) % mod
		ifac[i+1] = ifac[i] * powMod(i+1, mod-2) % mod
	}
}

func combination(n, r uint64) uint64 {
	if n == 0 && r == 0 {
		return 1
	}
	return (fac[n] * (ifac[r] * ifac[n-r] % mod) % mod)
}

func powMod(n, m uint64) uint64 {
	var ans uint64 = 1
	for m != 0 {
		if (m % 2) != 0 {
			ans = ans * n % mod
			if m == 1 {
				break
			}
		}
		n = n * n % mod
		m = m / 2
	}
	return ans
}

func main() {
	list := getStdinIntArr64()
	var N uint64 = uint64(list[0])
	var M uint64 = uint64(list[1])
	var K uint64 = uint64(list[2])

	initCombination()

	var ans uint64 = 0
	var k uint64 = 0
	for k = 0; k <= K; k++ {
		var tmp uint64 = 0
		tmp = M * combination(N-1, k) % mod
		tmp = tmp * powMod(M-1, N-1-k) % mod
		ans = (ans + tmp) % mod
	}

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

func getStdin() string {
	return readLine()
}
func getStdinArr() []string {
	str := getStdin()
	list := strings.Split(str, " ")
	return list
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}

func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}

func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, e := sc.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 5072
#include<stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	int max=0;
	int rec=0;
	for (int i=1;i<=n;i++){
		int x,y;
		scanf("%d %d",&x,&y);
		if (x==y) rec++;else rec=0;
		if (max<rec) max=rec;
	}
	if (max>=3) printf("Yes");else printf("No");
}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int a,b;
	cin >> a >> b;
	if(b % a == 0){
		cout << a+b << "\n";
	}else{
		cout << b - a << "\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
  {
  ll n;
  cin>>n;
  ll a[n];
  for(ll i=0;i<n;i++){
    cin>>a[i];
    }
  sort(a,a+n);
  cout<<a[n-1]-a[0]<<endl;
  }
    

Measured memory_bytes: 3552
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	long long  n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		long long x, y, x2, y2;
		cin >> y >> x;
		x--;
		y--;
		int c = 0;
		x2 = min(n - x-1, x);
		y = min(n - y-1, y);
		if (y < x2)
			c = y % 3;
		else
			c = x2 % 3;
		c++;
		cout << c << endl;
	}
}

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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  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;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
    int n, k;
    cin >> n >> k;
    k = min(k,n-1);
    combination c(n);
    mint ans = 0;
    for (int i = 0; i <= k; i++) {
        ans += c(n,i) * c(n-1,i);
    } 
    cout << ans.x << endl;
    return 0;
}

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

int	main()
{
	int	N;
	cin >> N;
	vector<int>	A_vec(N), B_vec(N), C_vec(N);
	for (int i = 0; i < N; ++i) cin >> A_vec.at(i);
	for (int i = 0; i < N; ++i) cin >> B_vec.at(i);
	for (int i = 0; i < N; ++i) cin >> C_vec.at(i);
	sort(A_vec.begin(), A_vec.end());
	sort(B_vec.begin(), B_vec.end());
	sort(C_vec.begin(), C_vec.end());
	int64_t	cnt = 0;
	int	B;
	int64_t	num_A, num_C;
	for (int i = 0; i < N; ++i) {
		B = B_vec.at(i);
		num_A = lower_bound(A_vec.begin(), A_vec.end(), B) - A_vec.begin();
		num_C = N - (lower_bound(C_vec.begin(), C_vec.end(), B + 1)
						- C_vec.begin());
		cnt += num_A * num_C;
	}
	cout << cnt << endl;
}



Measured memory_bytes: 1408
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <limits>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()
#define clr(a,v) memset((a),(v),sizeof(a))

using ll = long long;
constexpr ll INF = std::numeric_limits<ll>::max()>>2;
using P = std::pair<int, int>;
using St = std::pair<ll, P>;

int H, W;
char S[30][30];
ll dist[30][30];

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

ll bfs( int si, int sj )
{
  rep( i, 30 ) rep( j, 30 )
    dist[i][j] = INF;

  dist[si][sj] = 0; 
  
  std::queue<St> que;
  que.push( St( 0, P( si, sj ) ) );

  while( !que.empty() )
  {
    St st = que.front(); que.pop();

    ll d = st.first;
    int i = st.second.first, j = st.second.second;

    if( i != si && j != sj && dist[i][j] != INF )
      continue;

    dist[i][j] = d;

    rep( dir, 4 )
    {
      int ni = i+dx[dir], nj = j+dy[dir];

      if( ni >= 0 && ni < H && nj >= 0 && nj < W && S[ni][nj] != '#' && dist[ni][nj] == INF )
        que.push( St( d+1, P( ni, nj ) ) );
    }
  }

  return 0;
}

int main()
{
  scanf( "%d%d", &H, &W );

  rep( i, H )
    scanf( "%s", S[i] );

  ll ans = 0;

  rep( si, H ) rep( sj, W ) if( S[si][sj] != '#' )
  {
    bfs( si, sj );

    rep( gi, H ) rep( gj, W ) if( S[gi][gj] != '#' && dist[gi][gj] != INF )
      ans = std::max( ans, dist[gi][gj] );
  }  

  printf( "%lld\n", ans );

  return 0;
}

Measured memory_bytes: 256
x=int(input())
n=int(x**(1/5))
a=0
b=0
for i in range(10*(n+1)):
    for j in range(-10*(n+1),10*(n+1)):
        if i**5 - j**5 == x:
            a=i
            b=j
            print(i,j)
            exit(0)

Measured memory_bytes: 65320
// https://atcoder.jp/contests/abc150/tasks/abc150_c
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, a1 = 0, a2 = 0, num = 0;
    cin >> N;
    vector<int> A(N), B(N);
    REP(i, N) cin >> A[i];
    REP(i, N) cin >> B[i];
    vector<int> v(N);
    iota(v.begin(), v.end(), 1); // v に 1, 2, ... N を設定
    do {
        if (v == A) {
            a1 = num;
        }
        if (v == B) {
            a2 = num;
        }
        num++;
    } while (next_permutation(ALL(v))); // 次の順列を生成
    cout << abs(a1 - a2) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
int main(){
  std::vector<int> v;
  v.push_back(2);
  for(int i=3;i<=11000;i+=2){
    bool b = true;
    for(int j=0;i>=v[j]*v[j]&&b==true;j++){
      if(!(i%v[j]))b=false;
    }
    if(b)v.push_back(i);
  }
  int n;
  while(std::cin>>n){
    if(!n)return 0;
    for(int i=v.size()-1;i;i--)
      if(v[i]-v[i-1]==2&&v[i]<=n){std::cout<<v[i-1]<<" "<<v[i]<<std::endl;break;}
  }
}

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

int main(){
  int n,cnt=0;
  string s;
  cin>>n>>s;

  for(int i=0; i<n; i++){
    string v = "";
    for(int j=i; j<i+3; j++){
      v += s[j];
    }
    if(v == "ABC") cnt++; 
  }

  cout<<cnt<<endl;

  return 0;
}


Measured memory_bytes: 256
from collections import *
from math import *

x,n = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort()
for i in range(55):
	y = x - i
	if y not in a:
		print(y)
		break
	y = x + i
	if y not in a:
		print(y)
		break

Measured memory_bytes: 65060
# ABC166
# B Trick or Treat
N, K = map(int, input().split())
A = [list(map(int, input().split())) for i in range(K*2)]
D = list(A[::2])
del A[::2]
A = sum(A, [])
a = set(A)
OP = [n +1 for n in range(N)]
op = set(OP)
an = op - a
print(len(list(an)))


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
//	std::cout<<std::fixed<<std::setprecision(10);

ll gcd(ll a, ll b) { // a>=b
	if(a%b==0) {
		return b;
	} else {
		return(gcd(b, a%b));
	}
}

bool IsPrime(ll num) {
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
	ll A, B;
	cin >> A >> B;

	ll g;
	if(A<B) g = gcd(B, A);
	else g = gcd(A, B);

	vector<ll> divg = divisor(g);
	ll ans = 1;
	rep(i, divg.size()) {
		if(IsPrime(divg[i])) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const ll mod = 998244353;

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

  int n; cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  rep(i, n) {
    b.at(i) = 5e+8;
  }

  rep(i, n) {
    int p; cin >> p;
    a.at(p-1) = i+1;
  }

  for(int i=1; i<n; i++) {
    if (a.at(i) <= a.at(i-1)) {
      b.at(i) -= a.at(i-1) + 1 - a.at(i);
      a.at(i) = a.at(i-1) + 1;
    }
    if (b.at(i) >= b.at(i-1)) {
      a.at(i) += b.at(i) - b.at(i-1) + 1;
      b.at(i) = b.at(i-1) - 1;
    }
  }

  rep(i, n) {
    cout << a.at(i) << ' ';
  }
  cout << endl;
  rep(i, n) {
    cout << b.at(i) << ' ';
  }
  cout << endl;
}

Measured memory_bytes: 768
import java.util.Scanner;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        int M = Integer.parseInt(scanner.next());
        int X = Integer.parseInt(scanner.next());
        int max = Math.max(N, M);
        int ans = X / max + (X % max == 0 ? 0 : 1);
        System.out.println(ans);
    }
}



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

//{{{
#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
 vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x;
 while (getline(ss, x, c)) v.push_back(x); return v;} void err(vector<string>::iterator) {}
 template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args)
{cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}
// clang-format on
//}}}
//

int T;

const int mod = 1e9 + 7;
const int N = 2e5 + 10;
int x;

int a[9] = {400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000};
int b[8] = {8, 7, 6, 5, 4, 3, 2, 1};
int func(int x)
{
    int ans = -1;
    for (int i = 8; i >= 0; i--)
    {
        if (x >= a[i] && x < a[i + 1])
        {
            ans = b[i];
            break;
        }
    }
    return ans;
}

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    // scanf("%d", &T);

    // for (int i = 400; i <= 1999; i++)
    //{
    // int v = func(i);
    // debug(i, v);
    //}
    // int cas = 1;
    while (~scanf("%d", &x))
    {
        int ans = func(x);
        cout << ans << endl;
    }

    return 0;
}

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

using namespace std;
typedef long long ll;

map<ll, ll> cards;
int main()
{
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    for(int i=1; i<=n; i++) {
        ll tmp; cin >> tmp;
        cards[i] = tmp;
    }
    ll total = 0;
    for(auto it : cards) {
        ll same = cards[it.first]/2;
        total += same;
        cards[it.first] -= same * 2;
        if(cards.find(it.first + 1) != cards.end()) {
            int mn = min(cards[it.first], cards[it.first + 1]);
            cards[it.first] -= mn;
            cards[it.first + 1] -= mn;
            total += mn;
        }
    }
    cout << total << "\n";
    return 0;
}


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

int M, N, K;
vector<int> u, v;

long long GCD(long long a, long long b)
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}

int main()
{
    cin >> N;
    int ans;
    cin >> ans;
    for (int i = 0; i < N - 1; i++)
    {
        int a;
        cin >> a;
        ans = GCD(a, ans);
    }
    cout << ans << endl;
}

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

string r;

int a = 0;
int b = 0;

int main(){
	
	for(int i = 0; i < 20; i++){
		cin >> r;
		if(r != "0"){
			for(int j = 1; j < r.size(); j++){
				if(r[j] == 'A'){
					a++;
				}else{
					b++;
				}				
			}
			
			if(a > b){
				a++;
			}else{
				b++;
			}
			
			cout << a << " " << b << endl;
			a = 0;
			b = 0;
		}else{
			return 0;
		}
	}
}

Measured memory_bytes: 2956
function main()
    s = readline() |> chomp
    for i = 1:length(s)
        if i & 1 == 0 && s[i] == 'R'
            return println("No")
        elseif i & 1 == 1 && s[i] == 'L'
            return println("No")
        end
    end
    println("Yes")
end

main()

Measured memory_bytes: 165616
#include<iostream>
#include<algorithm>
using namespace std;
main(){
	double tmp,mx,mn,i=0;
	while(cin>>tmp){
		if(i!=0){
			int a;
			mx=max(mx,tmp);
			mn=min(mn,tmp);
		}else{
			mx=tmp;
			mn=tmp;
		}
		++i;
	}
	cout<<mx-mn<<endl;
}

Measured memory_bytes: 1280
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
a, b, c, d = ri_()
print('Yes' if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d) else 'No')

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

int main() {
  int N, a, b, c, d;
  cin >> N;
  a = N - N % 1000;
  N = N - a;
  b = N - N % 100;
  N = N - b;
  c = N - N % 10;
  N = N - c;
  d = N;
  if((a/1000 == b/100 && a/1000 == c/10)|| (b/100 == c/10 && c/10 == d))
	cout << "Yes" <<endl;
  else 
    cout << "No" << endl;
}


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

int main() {
    string s;
    cin>>s;
    string ans = (s=="AAA" || s=="BBB") ? "No":"Yes";
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
a = input()
if a[-1] == "2" or a[-1] == "4" or a[-1] == "5" or a[-1] == "7" or a[-1] == "9":
    print("hon")
elif a[-1] == "0" or a[-1] == "1" or a[-1] == "6" or a[-1] == "8": 
    print("pon")
else: 
    print("bon")

Measured memory_bytes: 9120
;;(declaim (optimize (speed 0) (safety 3) (debug 3)))
(declaim (optimize (speed 3) (safety 0) (debug 0)))

(declaim (type fixnum n k))
(defvar n (read))
(defvar k (read))

(defvar *a* (make-array (1+ n) :element-type 'fixnum))
(defvar *v* (make-array (1+ n) :initial-element nil :element-type 'boolean))
(loop for i from 1 to n do
      (setf (aref *a* i) (read)))

(defvar *prelude*)
(defvar *cycle*)

(let ((v (make-array n :element-type 'fixnum :fill-pointer 0))
      (town 1))
  (loop
   (when (aref *v* town) ; cycle detected
     (let ((p (position town v)))
       (setf *prelude* (subseq v 0 p))
       (setf *cycle* (subseq v p)))
     (return))
   (setf (aref *v* town) t)
   (vector-push-extend town v)
   (setf town (aref *a* town))))

(princ (if (< k (length *prelude*))
	   (aref *prelude* k)
	 (aref *cycle* (mod (- k (length *prelude*)) (length *cycle*)))))


Measured memory_bytes: 82104
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
const int inf = 10e9 + 7;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,m,n) for(int i=m;i<n;i++)
#define endre getchar(); getchar();return 0;
int wa[334334];
int ea[334334];
int wwa[334334];
char c[334334];
signed main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> c[i];
	}
	wa[0] = 0;
	for (int i = 1; i <= n; i++) {
		wa[i] = wa[i - 1];
		if (c[i] == 'W')wa[i]++;
	}
	ea[n + 1] = 0;
	for (int i = n; i >= 1; i--) {
		ea[i] = ea[i + 1];
		if (c[i] == 'E')ea[i]++;
	}
	for (int i = 1; i <= n; i++) {
		wwa[i - 1] = wa[i] + ea[i];
	}
	sort(wwa, wwa + n);
	cout << wwa[0] - 1 << endl;
}

Measured memory_bytes: 8064
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int main(){
    //~ freopen("file.in", "r", stdin);
    int n,ans=0;
    scanf("%d",&n);
    while(n--){
		int x;
		scanf("%d",&x);
		ans+=x-1;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=4e5+5;
typedef long long ll;
int a[maxn],b[maxn];
int cnt[maxn],n;
int main(){
	cin>>n;
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		cnt[a[i]]++;
	}
	for (int i=1;i<=n;i++){
		scanf("%d",&b[i]);
		cnt[b[i]]++;
	}
	for (int i=1;i<=n;i++){
		if (cnt[i]>n){
			cout<<"No"<<endl;
			return 0;
		}
	}
	reverse(b+1,b+n+1);
	int l=1,r=n;
	for (int i=1;i<=n;i++){
		if (a[i]==b[i]){
			if (b[i]!=a[l]&&b[l]!=a[i]){
				swap(b[i],b[l]);
				l++;
				continue;
			}
			else if (b[i]!=a[r]&&b[r]!=a[i]){
				swap(b[r],b[i]);
				r--;
				continue;
			}
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	for (int i=1;i<=n;i++){
		printf("%d ",b[i]);
	}
}

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

class BinaryIndexedTree {
private:
	long long Size;
	vector<long long> Node;
public:
	BinaryIndexedTree(long long N) : Size(N + 1) {
		Node.resize(Size, 0);
	}
	void Update(long long K, long long X) {
		while (K < Size) {
			Node[K] += X;
			K += (K & -K);
		}
	}
	long long Query(long long R) {
		long long ANS = 0;
		while (R > 0) {
			ANS += Node[R];
			R -= (R & -R);
		}
		return ANS;
	}
	long long Query(long long L, long long R) {
		return Query(R) - Query(L - 1);
	}
	void put() {
		cout << "// ";
		for (int i = 1; i < Size; i++) cout << Node[i] << " ";
		cout << endl;
	}
};

int main() {
	long long N, Q;
	cin >> N >> Q;
	BinaryIndexedTree BIT(N);
	for (int i = 0; i < Q; i++) {
		long long Com;
		cin >> Com;
		if (Com == 0) {
			long long X, Y;
			cin >> X >> Y;
			BIT.Update(X, Y);
		}
		else {
			long long X, Y;
			cin >> X >> Y;
			cout << BIT.Query(X, Y) << endl;
		}
		//BIT.put();
	}
}


Measured memory_bytes: 3560
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
	unsigned int key;
	struct node *next;
	struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch( int key )
{
	NodePointer cur = nil->next;
	while( cur != nil && cur->key != key ) {
		cur = cur->next;
	}
	return cur;
}

void init( )
{
	nil = malloc( sizeof(struct node) );
	nil->next = nil;
	nil->prev = nil;
}

void printList( )
{
	NodePointer cur = nil->next;
	int isf = 1;
	while( cur != nil ) {
		if( isf == 0) { printf(" "); }
		printf( "%d", cur->key );
		cur = cur->next;
		isf = 0;
	}
	printf("\n");
}

void deleteNode( NodePointer t )
{
	NodePointer pt = t->prev;
	NodePointer nt = t->next;
	pt->next = nt;
	nt->prev = pt;
	free( t );
}

void deleteFirst( )
{
	NodePointer t = nil->next;
	if( t == nil ) return;
	deleteNode( t );
}

void deleteLast( )
{
	NodePointer t = nil->prev;
	if( t == nil ) return;
	deleteNode( t );
}

void delete( int key )
{
	NodePointer t = listSearch( key );
	if( t == nil ) return;
	deleteNode( t );
}

void insert( int key )
{
	NodePointer x;
	x = malloc( sizeof(struct node) );
	x->key = key;
	x->next = nil->next;
	x->next->prev = x;
	x->prev = nil;
	nil->next = x;
}


int main( int argc, char *argv[] ) 
{
	int key, n, i;
	char com[20];
	
	scanf( "%d", &n );
	init( );
	for( i = 0; i < n; i++ ) {
		scanf( "%s", com );
		if( com[0] == 'i' ) {
			scanf( "%d", &key );
			insert( key ); 
		} else if( com[0] == 'd' ) {
			if( 6 < strlen( com )  ) {
				if( com[6] == 'F' ) { 
					deleteFirst( );
				} else if( com[6] == 'L' ) {
					deleteLast( );
				}
			} else {
				scanf( "%d", &key );
				delete( key );
			}
		}
	}
	printList( );
	
    return 0;
}

Measured memory_bytes: 31788
void main(){
	string[] weather = ["Sunny", "Cloudy", "Rainy", "Sunny"];
	string now = readln().chomp();
	weather = weather.find(now);
	weather[1].writeln();
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2572
# coding: utf-8
# Your code here!
"""
Binary indexed tree
0-indexed, 関数は閉区間
0からの区間加算、1点更新
"""
class BIT: #0-indexed
    def __init__(self, n):
        self.tree = [0]*(n+1)
        self.tree[0] = None
#        self.element = [0]*(n+1)
    def sum(self, i): #a_0 + ... + a_{i} #閉区間
        s = 0; i += 1
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    def range(self,l,r): #a_l + ... + a_r 閉区間
        return sum(r) - sum(l-1) 
    def add(self, i, x):
        i += 1
        while i <= n:
            self.tree[i] += x
            i += i & -i
        # self.element[i] += x
    #def get(self,i): return element[i]        
    
###########################################
# http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3791366
###########################################

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())
xyi = []
for i in range(n):
    a = [int(i) for i in readline().split()]
    xyi.append(a+[i])

dame_x = [0]*n
dame_y = [0]*n
dame_xy = [0]*n

MOD = 998244353

sxyi = sorted(xyi, key = lambda x: x[1]) # zaatu の逆写像
modosu = [i for x,y,i in sxyi]
zaatu = [0]*n
for j,zj in enumerate(modosu):
    zaatu[zj] = j

pow2 = [1]*(n+1)
for i in range(n):
    pow2[i+1] = pow2[i]*2%MOD

for j, (x,y,i) in enumerate(sxyi):
    dame_y[i] = pow2[j]-1 + pow2[n-j-1]-1

xyi.sort()
#print(pow2)

bit = BIT(n)
for j, (x,y,i) in enumerate(xyi):
    dame_x[i] = pow2[j] -1 + pow2[n-j-1]-1
    c = bit.sum(zaatu[i])
    dame_xy[i] += pow2[c]-1 + pow2[j-c]-1
    bit.add(zaatu[i],1)
        
bit = BIT(n)
for j, (x,y,i) in enumerate(reversed(xyi)):
    c = bit.sum(zaatu[i])
    dame_xy[i] += pow2[c]-1 + pow2[j-c]-1
    bit.add(zaatu[i],1)
        
        
#print(dame_x,"\n",dame_y,"\n",dame_xy)

ans = n*(pow2[n]-1)%MOD
for dx,dy,dxy in zip(dame_x,dame_y,dame_xy):
    ans += - dx - dy + dxy


print(ans%MOD)    








Measured memory_bytes: 122236
import java.util.ArrayList;
import java.util.Scanner;
import java.util.TreeSet;

public class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		
		ArrayList<String> sList = new ArrayList<>();
		
		for(int i = 0; i < n; i++) {
			sList.add(s.substring(i,(i+1)));
		}
		
		TreeSet<Integer> check = new TreeSet<>();
		
		for(int i = 0; i < n; i++) {
			int count = 0;
			TreeSet<String> first = new TreeSet<>();
			TreeSet<String> second = new TreeSet<>();
			
			for(int in = 0; in <= i; in++) {
				first.add(sList.get(in));
			}
			for(int in = (i+1); in < n; in++) {
				second.add(sList.get(in));
			}
			
			for(String st: first) {
				if(second.contains(st)) {
					count++;
				}
			}
			
			check.add(count);
		}
		
		System.out.println(check.last());
	}
}

Measured memory_bytes: 22996
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(char &c){
  int i;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = my_getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
char c;
int main(){
  rd(c);
  if('a'<=c && c<='z'){
    wt_L('a');
    wt_L('\n');
  }
  else{
    wt_L('A');
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// char c;
// {
//   rd(c);
//   wt(if['a'<=c<='z','a','A']);
// }


Measured memory_bytes: 3624
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Graph Start
struct edge {
    int from, to;
    long long cost;
};
/// Graph End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cinii(a,b);
    if(a==1) a+= 13;
    if(b==1) b+=13;
    if(a>b) cout << "Alice" <<nn;
    else if(a<b) cout << "Bob" << nn;
    else cout << "Draw" << nn;
    return 0;
}

Measured memory_bytes: 256
/////////////////////////////
//* Code By: SANSKAR SETH *//
/////////////////////////////


/*----------HEADER FILES AND TEMPLATES----------*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define pob pop_back
#define pf pop_front()
#define puf push_front()
#define mp make_pair
#define loop(i,a,b) for(int i=a ; i<b ; ++i)
#define rloop(i,a,b) for(int i=a ; i>=b ; --i)
#define ip(a) int a; cin>>a
#define ip2(a,b) int a,b; cin>>a>>b
#define ip3(a,b,c) int a,b,c; cin>>a>>b>>c
#define ipv(v,n) vi v(n); loop(i,0,n) cin>>v[i]
#define pv(v) loop(i,0,v.size()) cout<<v[i]<<" "
#define ips(s) string s; cin>>s
#define F first
#define S second
#define si(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define coutfl(l,p) fixed << setprecision(p) << l

typedef pair<int, int> pii;
typedef unordered_set<int> usi;
typedef set<int> si;
typedef map<int, int>   mii;
typedef map<char, int>  mci;
typedef vector<int>    vi;
typedef vector<char>   vc;
typedef vector<pii>    vpii;
typedef vector<vi>     vvi;

const int mod = 1000000007;
const int N = 5e5;

/*----------SOLUTION----------*/

void solve()
{
	ips(s);
	int n = s.length();

	if (s[n - 1] == 's')
	{
		s += 'e';
		s += 's';
	}
	else s += 's';

	cout << s << endl;

}

/*----------MAIN FUNCTION----------*/
int32_t main()
{
	fastIO;

	/*----MAIN PART----*/

	int t;
	// cin >> t;
	t = 1;
	while (t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3636
n=int(input())
t,a=map(int,input().split())
H=[int(_) for _ in input().split()]
Tx=[]
for i in range(n):
    Tx.append([i+1,abs(a-t+H[i]*0.006)])
Tx.sort(key=lambda x:x[1])
print(Tx[0][0])



Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int a,b;
    cin>>a>>b;
    int cnt=a;
    int ans=1;
    if(b==1){
        cout<<0<<endl;
        return 0;
    } 
    while(cnt<b){
        cnt+=a-1;
        ans++;
    }
    cout<<ans<<endl;
}


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

using namespace std;

int comp(const void *a, const void *b)
{
	return *(int*)b - *(int*)a;
}
int main(){
	int t;
	cin >> t;
	for (int dataSet = 0; dataSet < t; dataSet++){
		int n, k, x[100000], d[99999] = { 0 }, range;
		cin >> n >> k;
		for (int i = 0; i < n; i++){
			cin >> x[i];
		}
		range = x[n - 1] - x[0];
		for (int i = 0; i < n - 1; i++){
			d[i] = x[i + 1] - x[i];
		}
		qsort(d, n - 1, sizeof(int), comp);
		for (int i = 0; i < k - 1; i++){
			range -= d[i];
		}
		cout << range << endl;
	}
	return 0;
}

Measured memory_bytes: 2432
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	int N =sc.nextInt();
	int x[]=new int[N];
	for(int i=0;i<N;i++) {
		x[i]=sc.nextInt();
	}
	int least=0;
	int hp;
	for(int p=1;p<=100;p++) {
		hp=0;
		for(int a=0;a<N;a++) {
			hp+=(x[a]-p)*(x[a]-p);
		}
		if(p==1) {
			least=hp;
		}else if(least>hp) {
		least=hp;
		}
	}
	p(least);
	}
}

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

using namespace std;

int main() {
    int count = 0;
    int n;
    cin >> n;
    vector<int> nums(n);
    vector<int> p(3);
    for (int i = 0; i < n; ++i) {
        cin >> nums[i];
    }
    for (int j = 1; j < n - 1; ++j) {
        p[0] = nums[j - 1];
        p[1] = nums[j];
        p[2] = nums[j + 1];
        sort(p.begin(), p.end());
        if (p[1] == nums[j]) {
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i, x, y) for(int i = x, B = y; i <= B; i ++)
#define ff(i, x, y) for(int i = x, B = y; i <  B; i ++)
#define fd(i, x, y) for(int i = x, B = y; i >= B; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

const int N = 1e5 + 5;

int n;
ll d[N];
int a[N];

map<ll, int> bz;

int cmpa(int x, int y) {
	return d[x] > d[y];
}

int ans[N][2], ans0;
vector<int> e[N];

int siz[N];

void Noans() {
	pp("-1\n");
	exit(0);
}

ll sum;

void dg(int x, int y) {
	sum += y;
	ff(j, 0, e[x].size()) {
		dg(e[x][j], y + 1);
	}
}

int main() {
	scanf("%d", &n);
	fo(i, 1, n) scanf("%lld", &d[i]), bz[d[i]] = i, a[i] = i;
	sort(a + 1, a + n + 1, cmpa);
	fo(i, 1, n) siz[i] = 1;
	fo(i, 1, n - 1) {
		int x = a[i];
		if(siz[x] * 2 > n)
			Noans();
		ll y = d[x] - n + 2 * siz[x];
		if(!bz.count(y)) Noans();
		y = bz[y];
		siz[y] += siz[x];
		ans[++ ans0][0] = x, ans[ans0][1] = y;
		e[y].push_back(x);
	}
	dg(a[n], 0);
	if(sum != d[a[n]]) Noans();
	fo(i, 1, n - 1) pp("%d %d\n", ans[i][0], ans[i][1]);
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;

  if(a > b){
    int x = a;
    a = b;
    b = x;
  }
  if(b > c){
    int x = b;
    b = c;
    c = x;
  }
  if (a > b){
    int x = a;
    a = b;
    b = x;
  }
  cout << a << " " << b << " " << c << endl;
  return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
using namespace std;
 
int main() {
  int N,L;
  int ans = 0;
  int s = 0;
  
  cin >> N >> L;
  vector<int> a(N);

  rep(i,N) {
    //それぞれの味の値を求める
    a[i] = L + i;
  }

  //アップルパイの味の総和を求める
  rep(i,N) s += a[i];
  rep(i,N) {
    //総和から１つずつリンゴの味を引いて最小値になるtを求める
    int t = s - a[i];
    if (abs(t-s) < abs(ans - s)) ans = t;
  }
  
  cout << ans << endl;
}


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

int main()
{
  int N,K;
  int x;
  int count=0;
  
  cin >> N >> K;
  
  for(int i=0;i<N;i++)
  {
    cin >> x;
    
    if(2*x<2*(K-x))
      count += 2*x;
    else
      count += 2*(K-x);
  }

  cout << count;
}

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

int main(){
  int64_t n,k,diff;
  cin >> n >> k;
  bool flag = true;
  if(n <= abs(n-k)){
    cout << n << endl;
    return 0;
  }else{
    if(n%k == 0){
      cout << 0 << endl;
      return 0;
    }else{
      n = abs(n%k);
      if(n <= abs(n-k)){
        cout << n << endl;
        return 0;
      }else{
        cout << abs(n-k) << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,x,y;
    scanf("%lld %lld",&a,&b);
    x=min(a,b);
    y=max(a,b);
    long long int i,res;
    for(i=1;i<=y;i++)
    {
        if((x*i)%y==0)
        {
            res=x*i;
            break;
        }
    }
    printf("%lld\n",res);
    //printf("%lld %lld\n",x,y);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int dh[]={-1,0,1,0},dw[]={0,1,0,-1},h,w;
char s[105][105];
void dfs(int _h,int _w,char ch){
	s[_h][_w]='.';
	for(int i=0;i<4;i++){
		int H=_h+dh[i],W=_w+dw[i];
		if(H>=0 && H<h && W>=0 && W<w && s[H][W]==ch)dfs(H,W,ch);
	}
}
int main(){
	while(cin>>h>>w,h){
		int count=0;
		for(int i=0;i<h;i++)for(int j=0;j<w;j++)cin>>s[i][j];
		for(int i=0;i<h;i++)for(int j=0;j<w;j++)if(s[i][j]!='.')count++,dfs(i,j,s[i][j]);
		cout<<count<<endl;
	}
}

Measured memory_bytes: 1640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
int main()
{
	 int a,b,c;
	 while(cin>>a>>b>>c){
	 	if(a==b&&a==c){
	 		printf("Yes\n");
		 }
		 else{
		 	cout<<"No"<<endl;
		 }
	 } 
	return 0;
}


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

int main() {
  char a;
  cin >> a;
  if(isupper(a)) cout << "A" << endl;
  else cout << "a" << endl;
  return 0;
}



Measured memory_bytes: 3596
import sys
readlines = sys.stdin.readlines
write = sys.stdout.write
def solve():
    for line in readlines():
        a, b, n = map(int, line.split())
        a %= b
        res = 0
        for i in range(n):
            d, a = divmod(10*a, b)
            res += d
        write("%d\n" % res)
solve()



Measured memory_bytes: 5600
#include<bits/stdc++.h>
#define ll long long int
#define F first
#define S second
#define pb push_back
#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y);
#define sdl(x) scanf("%lld",&x)
#define sd2l(x,y) scanf("%lld%lld",&x,&y);
#define sz(x) (int)(x.size())
#define nax 100110
#define inf 1001000100
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
#define mp make_pair
#define pi pair<int ,int>
#define pii pair <pi,pi>
using namespace std;
int arr[nax];
int main(int argc, char const *argv[])
{
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  int n,x;
  sd(n);
  for(int i = 1; i <=  n; i++)
  {
    sd(x);
    x++;
    arr[x]++;
    arr[x-1]++;
    arr[x+1]++;
  }
  int ans = 0;
  for(int i = 0; i< nax; i++)
  {
      ans = max(ans,arr[i]);
  }
  cout << ans << '\n';
  return 0;
}   

Measured memory_bytes: 640
#include<stdio.h>

int main(){
  int n, i, j, flag = 1, t;
  scanf("%d",&n);
  int A[n];
  for(i = 0 ; i < n ; i++){
    scanf("%d", &A[i]);
  }
  i = 0;
  while(flag){
    flag = 0;
    for(j = n - 1 ; j > 0 ; j--){
      if(A[j] < A[j - 1]){
	t = A[j];
	A[j] = A[j - 1];
	A[j - 1] = t;
	flag = 1;
	i++;
      }
    }
  }
  for(j = 0 ; j < n ; j++){
    if(j != n - 1) printf("%d ", A[j]);
    else printf("%d\n", A[j]);
  }
  printf("%d\n", i);
}



Measured memory_bytes: 2128
#include <bits/stdc++.h>
#define INF 1e9
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define max(v) *max_element(v.begin(), v.end())
#define min(v) *min_element(v.begin(), v.end())
using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<float> v;
    int s;
    rep(i, n){
        cin>>s;
        v.eb(s);
    }
    sort(all(v));
    float sum = v[0];
    for(int i = 1; i < n; i++){
        sum = (sum + v[i])/2;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define SIZMAX int(2e5+10)
#define mod int(1e9+7)
#define inf int(1e9+5)

int main()
{
  ll n,k; cin>>n>>k;
  vector<ll> arr(n);
  for(ll i=0;i<n;i++) cin>>arr[i];
  vector<ll> dp(n,inf);
  dp[0]=0;
  for(ll i=0;i<n;i++){
    for(int j=i+1;j<=i+k;j++){
      if(j<n){
        dp[j]=min(dp[j],dp[i]+abs(arr[i]-arr[j]));
        //cout<<dp[j]<<" "<<j<<endl;
      }
    }
  }
  cout<<dp[n-1];
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  ll n;
  cin >> n;
  ll res = 0;
  ll prime[n+1]={};
  for(int i=1;i<=n;i++){
    for(int j=i;j<=n;j+=i){
      prime[j]+=1;
    }
  }
  for(ll i=1;i<=n;i++){
    res += prime[i]*i;
  }
  cout << res << endl;
      
  return 0;
}


Measured memory_bytes: 81748