akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+9;
struct graph{
	struct edge{int to,next,f;}e[N<<1];
	int h[N],cur[N],xb;
	inline void addedge(int x,int y,int z){
		e[++xb]=(edge){y,h[x],z};h[x]=xb;
		e[++xb]=(edge){x,h[y],0};h[y]=xb;
	}
	int S,T,d[N],n;
	inline bool bfs(){
		static int q[N];int t=0,w=1;q[1]=S;
		memset(d+1,0,n<<2);d[S]=1;
		for(;t<w;){
			int u=q[++t];
			for(int i=h[u];i;i=e[i].next)if(e[i].f && !d[e[i].to])
				d[e[i].to]=d[u]+1,q[++w]=e[i].to;
		}
		return d[T];
	}
	int dfs(int x,int f){
		if(x==T)return f;
		int ans=0,&i=cur[x],t;
		for(;i;i=e[i].next)if(e[i].f && d[e[i].to]==d[x]+1){
			if(t=dfs(e[i].to,min(f,e[i].f))){
				ans+=t,e[i].f-=t;e[i^1].f+=t;f-=t;
				if(!f)break;
			}
		}
		return ans;
	}
	inline int dinic(int s,int t){
		int ans=0;S=s;T=t;
		for(;bfs();ans+=dfs(s,1<<30))memcpy(cur+1,h+1,n<<2);
		return ans;
	}
}g;
int n,m,i,j,p[N],q[N],belp[N],belq[N],pc,qc,sm;
inline void work(int*p,int*bel,int&c){
	static bool vi[N];memset(vi+1,0,n);
	for(i=1;i<=n;++i)cin>>p[i],++p[i];
	for(i=1;i<=n;++i)if(!vi[i])for(j=i,++c;bel[j]=c,vi[j]=1,!vi[p[j]];j=p[j]);
}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	cin>>n;work(p,belp,pc);work(q,belq,qc);g.n=pc+qc+2;g.xb=1;
	for(i=1;i<=n;++i){
		if(p[i]==i && q[i]==i)++sm;
		if(p[i]==i && q[i]!=i)g.addedge(g.n-1,pc+belq[i],1);
		if(p[i]!=i && q[i]==i)g.addedge(belp[i],g.n,1);
		if(p[i]!=i && q[i]!=i){
			g.addedge(belp[i],pc+belq[i],1);
			if(p[i]==q[i])
				g.addedge(pc+belq[i],belp[i],1);
		}		
	}
	cout<<n-g.dinic(g.n-1,g.n)-sm<<endl;
	return 0;
}

Measured memory_bytes: 11520
using System;
using System.Linq;

namespace abc132_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var d = Console.ReadLine().Split(' ')
                .Select(m => int.Parse(m))
                .OrderBy(m => m).ToArray();
            var half = n / 2;
            var min = d[half - 1];
            var max = d[half];
            Console.WriteLine($"{max - min}");
        }
    }
}


Measured memory_bytes: 22112
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

struct A {
  using T = int;
  static constexpr T e() { return 0; }
};

template<class A> struct WQU {
  using T = typename A::T;
  V<> par, rank, _size;
  V<T> _diff;

  WQU(int n) { 
    par.resize(n);
    iota(par.begin(), par.end(), 0);
    rank.resize(n);
    _size.assign(n, 1);
    _diff.assign(n, A::e());
  }

  T diff(int a, int b) {
    find(a), find(b);
    return _diff[b] - _diff[a];
  }

  int find(int a) {
    if (par[a] == a) return a;
    else {
      int t = find(par[a]);
      _diff[a] += _diff[par[a]];
      return par[a] = t;
    }
  }

  bool same(int a, int b) {
    return find(a) == find(b);
  }

  int size(int a) {
    return _size[find(a)];
  }

  void unite(int a, int b, T& d) {
    d -= diff(a, b);
    a = par[a], b = par[b];
    if (rank[a] < rank[b]) {
      par[a] = b;
      _size[b] += _size[a];
      _diff[a] = -d;
    } else {
      par[b] = a;
      _size[a] += _size[b];
      _diff[b] = d;
    }
    if (rank[a] == rank[b]) rank[a]++;
  }
};


int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  WQU<A> w(n);
  for (int i = 0; i < m; i++) {
    int l, r, d; cin >> l >> r >> d, l--, r--;
    if (w.same(l, r) and w.diff(l, r) != d) return cout << "No" << '\n', 0;
    if (!w.same(l, r)) w.unite(l, r, d);
  }
  cout << "Yes" << '\n';
}

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

int main() {
  int A, B;
  cin >> A >> B;
  
  int count = 0;
  
  if (A == B) {
    cout << A + B << endl;
  } else if (A > B) {
    cout << A + (A - 1) << endl;
  } else if (B > A) {
    cout << B + (B - 1) << endl;
  }
}

Measured memory_bytes: 256
// Last Change: 03/28/2019 18:51:06.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

int main() {
  ll ans = 0;
  string S;
  cin >> S;

  for (int i = 0; i < S.size(); ++i) {
    if (S[i] == '+') {
      ++ans;
    } else {
      --ans;
    }
  }
  cout << ans << endl;

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
   for (int i = 0; i <c-a; i++) {
     cout << 'R';
   }
  for (int i = 0; i <d-b; i++) {
     cout << 'U';
   }
  for (int i = 0; i <c-a; i++) {
     cout << 'L';
   }
  for (int i = 0; i <d-b; i++) {
     cout << 'D';
   }
  cout << 'D';
  for (int i = 0; i <c-a+1; i++) {
     cout << 'R';
   }
  for (int i = 0; i <d-b+1; i++) {
     cout << 'U';
   }
  cout << 'L';
  cout << 'U';
  for (int i = 0; i <c-a+1; i++) {
     cout << 'L';
   }
  for (int i = 0; i <d-b+1; i++) {
     cout << 'D';
   }
  cout << 'R';
}

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

int main(void) {
	long long X;
	cin >> X;
	int count = 0;
	long long deposit = 0;
	long long tmp = 100;
	while (1) {
		count++;
		deposit = tmp * 1.01;
		if (X <= deposit)
			break ;
		tmp = deposit;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/

    int n;cin >> n;
    vec<int> a(n);rep(i,n)cin >> a[i];
    //まずsetとして互いに素か否かの判定
    int g=a[0];
    rep2(i,1,n)g=__gcd(a[i],g);
    if(g!=1){
        cout << "not coprime" << endl;
        return 0;
    }

    vec<bool> pri(100001,true);
    pri[0]=false;
    pri[1]=false;
    rep2(i,2,10001){
        if(pri[i]){
            for(int j=2*i;j<=10000;j+=i)pri[j]=false;
        }
    }
    vec<int> primes;
    rep(i,10001){
        if(!pri[i])continue;
        primes.emplace_back(i);
    }
    map<int,int> ans;
    rep(i,n){
        rep(j,primes.size()){
            if(primes[j]*primes[j]>a[i])break;
            if(a[i]%primes[j]==0){
                ans[primes[j]]++;
                if(ans[primes[j]]>=2){
                    cout << "setwise coprime" << endl;return 0;
                }
                while(a[i]%primes[j]==0)a[i]/=primes[j];
            }
        }
        if(a[i]!=1){
            ans[a[i]]++;
            if(ans[a[i]]>=2){
                cout << "setwise coprime" << endl;return 0;
            }
        }
    }
    cout << "pairwise coprime" << endl;
}

Measured memory_bytes: 7368
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<Vl>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  ll N, M;
  cin >> N >> M;
  Graph G(N);
  REP(i, N) {
    ll tmp;
    cin >> tmp;
    G.at(i).push_back(tmp);
  }
  ll ans = 0;
  vector<bool> flag(N);

  REP(j, M) {
    int A, B;
    cin >> A >> B;
    G.at(A - 1).push_back(B - 1);
    G.at(B - 1).push_back(A - 1);
  }
  for (ll n = 0; n < N; n++) {
    if (flag.at(n) == true) continue;
    ll H = G.at(n).at(0);
    for (ll q = 1; q < G.at(n).size(); q++) {
      ll query = G.at(n).at(q);
      if (H > G.at(query).at(0)) {
        flag.at(query) = true;
        //       cout << query << "is short than" << n << endl;
      } else if (H == G.at(query).at(0)) {
        flag.at(query) = true;
        flag.at(n) = true;
        //        cout << query << "equal" << n << endl;
        continue;
      } else {
        flag.at(n) = true;
        //        cout << n << "is short than" << query << endl;
        continue;
      }
    }
    if (!flag.at(n)) {
      ans++;
      //     cout << n << endl;
    }
  }
  cout << ans << endl;
}

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

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 3e5 + 5, M = 1e6 + 5, mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e18 + 7;
const ll infll = 1e18 + 7;

int n, m, k;
int x, y, z;
int ans, cnt, tmp, idx, mx = -inf, mn = inf;
string s, t;
int a[N], b[N];

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> x >> y;
    ForE(i, 0, N){
        if ((i * 8) / 100 == x && (i * 10) / 100 == y) Ptest(i);
    }
    cout << -1;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  string S;
  cin >> S;

  ll w = 0;
  char color = '0';
  rep(i, 0, sz(S)) {
    if (S[i] != color) w++;
    color = (color == '0' ? '1' : '0');
  }

  ll b = 0;
  color = '1';
  rep(i, 0, sz(S)) {
    if (S[i] != color) b++;
    color = (color == '0' ? '1' : '0');
  }

  put(min(w, b));
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		while (s.hasNextInt()) {
			int m = s.nextInt();
			int f = s.nextInt();
			int r = s.nextInt();
			int sum = m + f;
			char ret = 'F';

			if (m == -1 && f == -1 && r == -1) {
				return;
			} else if (m == -1 || f == -1) {
				ret = 'F';
			} else if (80 <= sum) {
				ret = 'A';
			} else if (65 <= sum) {
				ret = 'B';
			} else if (50 <= sum || (30 <= sum && 50 <= r)) {
				ret = 'C';
			} else if (30 <= sum) {
				ret = 'D';
			}
			System.out.println(ret);
		}
	}
}

Measured memory_bytes: 19252
import sys

n,k,q=map(int,input().split())
a=[int(input()) for i in range(q)]

if k>q:
    for i in range(n):
        print('Yes')
    sys.exit()

d=[0]*n

for i in range(q):
    d[a[i]-1]=d[a[i]-1]+1

for j in d:
    if j>q-k:
        print('Yes')
    else:
        print('No')
        

Measured memory_bytes: 13716
N = int(input())
A = input().split()
flag = 1
t = 0
while flag:
	for i in range(0,N):
		if int(A[i])%2==1:
			flag = 0
			break	
	if flag:
		t += 1
		for i in range(0,N):
			A[i] = int(A[i])/2
print(t)

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

int main() {
	int N;
	cin>>N;
	string ans="No";
	for(int i=1;i<10;i++){
		for(int j=1;j<10;j++){
			if(N==i*j) ans="Yes";
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  long long a, b, n;
  cin >> a >> b >> n;
  
  long long x;
  if(n >= b-1) x = b - 1;
  else x = n;
  
  long long ans = a*(x%b)/b;
  cout << ans << endl;
}

Measured memory_bytes: 3540
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		long[] a = new long[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = stdIn.nextLong();
		}
		
		long x = 0;
		long sum = 0;
		
		for(int i = 0; i < n; i++) {
			
			if(a[i] == 0) {
				sum += x/2;
				x = 0;
				continue;
			}
			if(i == n-1) {
				x += a[i];
				sum += x/2;
				break;
			}
			
			x += a[i];
			
		}
		System.out.println(sum);
		
		
	}

}


Measured memory_bytes: 60284
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
LL a, b;
int main() {
	cin >> a >> b;
	if (b * 2 >= a) cout << 0;
	else cout << a - b * 2;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
if(s.size()==3){
  for(int i=s.size() -1;i>=0;i--){
    cout<<s[i];
  }cout<<endl;
}else{
  cout<<s<<endl;
}
  
  
}

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

#define int long long
#define pii pair<int,int>
#define mod 1000000007


//int mx = 0,mn = mod;

signed main(){
    
    int n;
    cin >> n;
    vector<int> v(n);
    for(auto &i:v)cin >> i;

    sort(v.begin(), v.end());
  	cout << v[n-1] - v[0] <<endl;
         

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

using namespace std;
#define int long long
using ll = long long;
const int MX = 1e6;
const ll inf = 1e13;
const int mod = 1e9+7;
signed main() {
    int n,x,t;
    cin >> n>>x>>t;
    cout << (n+x-1)/x*t << endl;
    


    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()

using namespace std;

int main() {
  int x, y;
  cin >> x >> y;

  vector<set<int>> v(3);
  v[0].insert(1);
  v[0].insert(3);
  v[0].insert(5);
  v[0].insert(7);
  v[0].insert(8);
  v[0].insert(10);
  v[0].insert(12);

  v[1].insert(4);
  v[1].insert(6);
  v[1].insert(9);
  v[1].insert(11);

  v[2].insert(2);

  for (auto e : v) {
    if (e.count(x) && e.count(y)) {
      puts("Yes");
      return 0;
    }
  }

  puts("No");

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <bitset>

using namespace std;

#define rep(i,N) for (int i = 0; i < N; i++)
#define llong long long
#define ldouble long double

int N;
vector<int> P, Q;

int main() {
    cin >> N;
    P.resize(N); Q.resize(N);
    rep(i,N) cin >> P[i];
    rep(i,N) cin >> Q[i];
    vector<int> hoge(N);
    rep(i,N) hoge[i] = i+1;
    int ap, bq;
    int count = 0;
    do{
        if (P == hoge) ap = count;
        if (Q == hoge) bq = count; 
        count++;
    } while(next_permutation(hoge.begin(), hoge.end()));
    cout << abs(ap-bq) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#include <numeric>
#include <stdio.h>
#include <boost/math/common_factor_rt.hpp>
#define EPS (1e-7)
using namespace std;
#define ll long long


int main() {

	int A, B;
	cin >> A >> B;
	int ans = max(A + B, A - B);
	ans = max(ans, A * B);

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

Measured memory_bytes: 256
import sys
import numpy as np

def Ss():
  return sys.stdin.readline().rstrip().split(' ')

def Is():
  ss = Ss()
  return map(int, ss) if len(ss) > 1 else int(ss[0])

a, b, c, d, e = Is()
print(15 - a - b - c - d - e)

Measured memory_bytes: 27064
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define ll          long long
#define pii         pair<ll, ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll, ll>
#define mii         map<pii, ll>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define hell        1000000007
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define rev(i,a,b)  for(ll i=a;i>=b;i--)

#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)
 
#define track(x)                 cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
 
#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))

#define MOD         1000000007
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a + b + p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
const ll INF = 1e9 + 5;
#define N	    	4000
ll a[N];
ll dp[N][N][2];
bool check[N][N];
pii get(ll l, int r) {
    if(check[l][r]) 
        return mp(dp[l][r][0], dp[l][r][1]);
    check[l][r] = true;
    if(l == r) {
        dp[l][r][0] = a[l];
        dp[l][r][1] = 0;
        return mp(a[l], 0);
    }
    pii aa = get(l+1, r);
    pii bb = get(l, r-1);
    ll v1 = a[l] + aa.y;
    ll v2 = a[r] + bb.y;
    if(v1 > v2) {
        dp[l][r][0] = v1;
        dp[l][r][1] = aa.x;
    }
    else if(v1 < v2) {
        dp[l][r][0] = v2;
        dp[l][r][1] = bb.x;
    }
    else {
        dp[l][r][0] = v1;
        dp[l][r][1] = min(aa.x, bb.x);
    }
    return mp(dp[l][r][0], dp[l][r][1]);
}
void solve(){
    ll n;
    cin>>n;
    rep(i, 0, n)
        cin>>a[i];
    pii tmp = get(0, n-1);

    cout<<tmp.x-tmp.y<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	ll t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}




Measured memory_bytes: 203264
#include <stdio.h>

int main(int argc, char *argv[]) {

int S;
int s, m, h;


scanf("%d", &S);

s = S % 60;

S -= s;
S /= 60;
m = S % 60;

S -= m;
h = S / 60;

printf("%d:%d:%d\n", h, m, s);

return 0;
}

Measured memory_bytes: 592
using System;

class Plogram
{
    static void Main()
    {
        string str = Console.ReadLine();
        string acgt;
        int count = 0;
        int max = 0;

        for (int i = 0; i < str.Length; i++)
        {
            acgt = str.Substring(i, 1);

            if (acgt == "A" || acgt == "C" || acgt == "G" || acgt == "T")
            {
                count ++;
                if(max<count)
                {
                    max = count;
                }
            }
            else
            {
                count = 0;
            }
        }
        Console.WriteLine(max);
    }
}

Measured memory_bytes: 11092
#include<stdio.h>


int main()
{
	int height[10] = {0};
	int i = 0;
	int j = 0;
	int temp = 0;


	for(i=0;i<10;i++){
		scanf("%d",&temp);
		if(temp >= 0 && temp <=10000){
			height[i] = temp;
		} else {
			height[i] = 0;
		}
	}
	int number=sizeof(height)/sizeof(int);

	for(i=0;i<number;i++){
		for(j=number - 1;j>i;j--){
			if(height[j]>height[j-1]){
				temp=height[j-1];
                height[j-1]=height[j];
                height[j]=temp;
			}
		}
	}
	for(i=0;i<3;i++){
        printf("%d\n",height[i]);
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int A,B;
string S;
int main(){
    cin >> A >> B >> S;
    bool flag = true;
    rep(i,A+B+1){
        if(i == A && S[i] != '-') flag = false;
        if(i != A && S[i] == '-') flag = false;
    }
    if(flag) cout << "Yes" << '\n';
    else cout << "No" << '\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
const lint MOD = pow(10, 9) + 7;



int main() {
	int N, M;
	cin >> N >> M;
	if (N == M) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9+7;
const ll inf_l = 1e18;
const int MAX = 1e6;

int main() {
    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    vint check(MAX+1,0);
    rep(i,n) {
        if (check[a[i]] != 0) {
            check[a[i]] = 2;
            continue;
        } 
        for (int j = a[i]; j <= MAX; j += a[i]) {
            check[j]++;
        }
    }
    ll ans = 0;
    rep(i,n) if (check[a[i]] == 1) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 8016
// B - ss
#include <bits/stdc++.h>
using namespace std;

int main(){
	string S; cin>>S;
	int startlength = S.size()%2? S.size()-1: S.size()-2;
	for(int n=startlength; n>0; n-=2){//n: length to check
		int len = n/2;//len: half length
		if(S.compare(0, len, S.substr(len, len)) == 0){
			cout<< n <<endl;
			return 0;
		}
	}
}

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

#define null -1
#define WHITE 0
#define GRAY 1  
#define BLACK 2

void DFS(void);
void visit(int);
int next(int);

void Spush(int);
void Spop();

int S[101]; //????????????
int S_i;    //??????????????¨?????°
  
int n;      //????????°
int V[101][101] = {};
int d[101]; //timestanp ??????
int f[101]; //timestanp ??????
int color[101] = {}; 
int t = 0;

int main(){
  int i, j, k, u, m;
  
  scanf("%d",&n);

  for( i=0 ; i<n ; i++ ){
    scanf("%d",&u);

    scanf("%d",&m);
    for( j=0 ; j<m ; j++ ){
      scanf("%d",&k);
      V[u][k] = 1;
    }
  }

  DFS();

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

void DFS(){
  int i;
  
  for( i=0 ; i<n ; i++ ){
    if( color[i+1] == WHITE ){
      visit(i+1);
    }
  }
}

void visit(int r){
  int u;
  int v;
  
  Spush(r);
  color[r] = GRAY;
  d[r] = ++t;

  while( S_i != 0 ){
    u = S[S_i-1];
    v = next(u);

    if( v != null ){
      if( color[v] == WHITE ){
	Spush(v);
	color[v] = GRAY;
	d[v] = ++t;
      }
    }
    else{
      Spop();
      color[u] = BLACK;
      f[u] = ++t;
    }
  }
}

void Spush(int x){
  S[S_i] = x;
  S_i++;
}

void Spop(){
  S[S_i] = 0;
  S_i--;
}

int next(int x){
  int i;

  for( i=0 ; i<n ; i++ ){
    if( V[x][i+1] == 1 && color[i+1] == WHITE ) return i+1;
  }
  return null;
}

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

int main()
{
	int h,w;
	while(cin >> h >> w){
		if(!h && !w)
			break;

		for(int i = 0;i<h;++i){
			for(int j=0;j<w;++j){
				if(i == 0 || i == h-1){
					cout << '#';
				}else{
					if(j == 0 || j == w-1)
						cout << '#';
					else
						cout << '.';
				}
			}
			cout << endl;
		}
		cout << endl;
	}


	return 0;
}

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

const int mod=1e9+7;
vector<vector<long>> c(2003,vector<long>(2003,-1));
long com(int m,int l);

int main(void){
  int n,k,i;
  cin >> n >> k;
  for (i=1;i<=k;i++) cout << (com(k-1,i-1)*com(n-k+1,i))%mod << endl;
  return 0;
}

long com(int m,int l){
  if (m<0 || m<l) return 0;
  if (m==0 || l==0 || l==m) return 1;
  if (c.at(m).at(l)!=-1) return c.at(m).at(l);
  else return c.at(m).at(l)=(com(m-1,l-1)+com(m-1,l))%mod;
}

Measured memory_bytes: 31744
L = [int(_) for _ in input()[::-1]]
mod = 10**9 + 7
j = 0
ans = 0
for i in range(len(L) - 1, -1, -1):
    if L[i]:
        ans += pow(3, i, mod) * pow(2, j, mod)
        ans %= mod
        j += 1
ans += pow(2, j, mod)
ans %= mod
print(ans)


Measured memory_bytes: 4120
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
#include<utility>
#include<vector>
using namespace std;
//--------------------

int main() {

	long res = 0;
	long N; cin >> N;
	long d[100009]; for (int i = 1; i <= N; i++) cin >> d[i];

	sort(d + 1, d + N + 1);

	res = d[N / 2 + 1] - d[N / 2];

	cout << res << endl;
}

Measured memory_bytes: 1024
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for k, c in enumerate(reversed(input())):
    r = range(0, p * 10, p) if c == '?' else (p * int(c),)
    a = [sum(a[(i - j) % 13] for j in r) % M for i in range(13)]
    p = p * 10 % 13
print(a[5])


Measured memory_bytes: 46316
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
import std.concurrency;

void main() {
    int x1, y1, x2, y2;
    readf("%d %d %d %d\n", &x1, &y1, &x2, &y2);
    int dx = x2-x1;
    int dy = y2-y1;
    [
        "L",
        "U".repeat(dy+1).join,
        "R".repeat(dx+1).join,
        "D",

        "L".repeat(dx).join,
        "D".repeat(dy).join,

        "R".repeat(dx).join,
        "U".repeat(dy).join,

        "R",
        "D".repeat(dy+1).join,
        "L".repeat(dx+1).join,
        "U"
    ].join.writeln;
}



// -------------------------------------------
void times(alias fun)(int n) {
    foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = fun();
    return res;
}

// fold was added in D 2.071.0.
static if (__VERSION__ < 2071) {
    template fold(fun...) if (fun.length >= 1) {
        auto fold(R, S...)(R r, S seed) {
            static if (S.length < 2) {
                return reduce!fun(seed, r);
            } else {
                return reduce!fun(tuple(seed), r);
            }
        }
    }
}


Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
int n;
char ed;
vector<string>V[11];
int main()
{
	cin >> n;
	V[1].push_back("a");
	for (int i = 1; i < n; i++)
	{
		for (int j = 0; j < V[i].size(); j++)
		{
			ed = 'a';
			for (int k = 0; k < V[i][j].size(); k++)
			{
				ed = max(ed, V[i][j][k]);
			}
			for (char k = 'a'; k < ed + 2; k++)
			{
				V[i + 1].push_back(V[i][j] + k);
			}
		}
	}
	for (int i = 0; i < V[n].size(); i++)
	{
		cout << V[n][i] << endl;
	}
	return 0;
}


Measured memory_bytes: 11380
N=int(input())
A=[]
for _ in range(2):
    A.append(list(map(int,input().split())))
ans=0
for i in range(N):
    tmp=0
    tmp+=sum(A[0][:i+1])
    tmp+=sum(A[1][i:])
    if tmp>ans:
        ans=tmp
print(ans)

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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	string S;
	cin >> S;
	int n = S.size();
	int res = 0;
	for (int i = 0; i < n; i++) {
		if (S[i] == '*') break;
		res += S[i] == '(' ? 1 : -1;
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 3228
X = int(input())

if 400 <= X <= 599:
    print(8)
elif 600 <= X <= 799:
    print(7)
elif 800 <= X <= 999:
    print(6)
elif 1000 <= X <= 1199:
    print(5)
elif 1200 <= X <= 1399:
    print(4)
elif 1400 <= X <= 1599:
    print(3)
elif 1600 <= X <= 1799:
    print(2)
else:
    print(1)

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

int main(){
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int tmp = k;
    int ta,tb,tc;
    ll res = 0;
    ta = min(a,tmp);
    tmp -= ta;
    tb = min(b,tmp);
    tmp -= tb;
    tc = min(c,tmp);
    res = ta-tc;
    cout << res << endl;
    return 0;
}

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

const int MAXN = 205;

int t, n;
long long a[MAXN];
char s[MAXN];

int m;
long long b[MAXN], c[MAXN], d[MAXN];
bool check(long long x){
	for(int i = 0; i < m; i++)
		c[i] = b[i];
	
	int k = 0;
	for(int i = 0; i < 62; i++){
		bool found = false;
		for(int j = k; j < m; j++)if(c[j] & (1LL << i)){
			found = true;
			swap(c[j], c[k]);
			break;
		}
		
		if(found){
			for(int j = k + 1; j < m; j++)if(c[j] & (1LL << i)){
				c[j] ^= c[k];
			}
			d[k] = 1LL << i;
			k++;
		}
	}
	
	for(int i = 0; i < k; i++)if(x & d[i]){
		x ^= c[i];
	}
	
	return (x == 0);
}

int main(){
	scanf("%d", &t);
	while(t--){
		scanf("%d", &n);
		for(int i = 0; i < n; i++)
			scanf("%lld", &a[i]);
		scanf("%s", s);
		
		m = 0;
		bool ok = true;
		
		for(int i = n - 1; i >= 0; i--){
			if(s[i] == '0'){
				b[m++] = a[i];
			}else{
				if(!check(a[i])){
					ok = false;
					break;
				}
			}
		}
		
		if(ok)printf("0\n");
		else printf("1\n");
	}

	return 0;
}


Measured memory_bytes: 3620
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
struct BIT
{
	// [0,size)
	vector<LL> tree;
	LL size;
	BIT(LL s){
		size=s;
		tree.resize(size+1);
	}
	void init(LL s){
		size=s;
		tree.clear();
		tree.resize(size+1);
	}
	void add(LL i,LL v){
		i++;
		while(i<=size){
			tree[i]+=v;
			i+=(i&-i);
		}
	}

	// [0,i)
	LL collect(LL i){
		LL r=0;
		while(i>0){
			r+=tree[i];
			i-=(i&-i);
		}
		return r;
	}

	// [a,b)
	LL collect(LL a, LL b){
		return collect(b)-collect(a);
	}
};


void solve(long long N, long long D, long long A, std::vector<long long> X, std::vector<long long> H){
	vector<P> ps;
	for(int i=0;i<N;i++){
		ps.push_back(P(X[i],H[i]));
	}

	sort(ps.begin(),ps.end());

	BIT bit(N);
	int j=0;
	LL ret=0;
	for(int i=0;i<N;i++){
		while(j<i&&ps[j].first<ps[i].first-2*D){
			j++;
		}
		LL c=bit.collect(j,i);
		//cerr << j << ", " << i << ", " << c << endl;
		LL v=(ps[i].second+A-1)/A;
		if(v-c>0)
		{
			bit.add(i,v-c);
			ret+=v-c;
		}
	}
	cout << ret << endl;

}

int main(){
    long long N;
    scanf("%lld",&N);
    long long D;
    scanf("%lld",&D);
    long long A;
    scanf("%lld",&A);
    std::vector<long long> X(N);
    std::vector<long long> H(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
        scanf("%lld",&H[i]);
    }
    solve(N, D, A, std::move(X), std::move(H));
    return 0;
}


Measured memory_bytes: 9456
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

L = int(input())
a = L / 3

a = Decimal(str(a)).quantize(Decimal(str(10 ** -7)), rounding=ROUND_HALF_UP)
V = Decimal(str(a ** 3)).quantize(Decimal(str(10 ** -6)), rounding=ROUND_HALF_UP)
print(V)


Measured memory_bytes: 5076
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    Long n = sc.nextLong();
    Long k = sc.nextLong();
    
    long min = n % k;
    if(min < Math.abs(min - k)){
      System.out.println(min);
    }else{
      System.out.println(Math.abs(min - k));
    }
  }
}

Measured memory_bytes: 21844
H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
As = [(0, 0, 0)]
for i in range(H):
    for j in range(W):
        As.append((A[i][j], i+1, j+1))
Q = int(input())
Qs = [list(map(int, input().split())) for _ in range(Q)]
As.sort()
dp = [0] * (H*W+1)
for i in range(1, H*W+1- D):
    a1, j, k = As[i]
    a2, x, y = As[i+D]
    dp[i+D] = dp[i] + abs(x-j) + abs(y-k)
    
for l, r in Qs:
    print(dp[r] -dp[l])

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

#define ll long long
#define ull unsigned long long
#define lld long double
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define vt vector
#define vll vt<ll>
#define pll pair<ll,ll>
#define vpll vt<pll>
#define vvll vt<vll>
#define all(v) v.begin(),v.end()
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffo(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl '\n'
template <typename T> using mxpq = priority_queue<T>;
template <typename T> using mnpq = priority_queue<T, vt<T>, greater<T>>;
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define mmss(arr,v) memset(arr,v,sizeof(arr))
#define go_t int testcases; cin>>testcases; ffo(caseno,1,testcases)

#define ctime auto start = high_resolution_clock::now()
#define etime auto stop = high_resolution_clock::now()
#define ptime auto z1z = duration_cast<microseconds>(stop-start); cout<<"Time elapsed : "<<z1z.count()<<" microseconds\n"

const ll mod = 1e9 + 7;
const ll N = 6e4 + 6;
const ll maxN = 1e5 + 15;
const ll MAX_SIZE = 2e6 + 6;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;

int dx[4] = { -1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
// up, right, down, left
//int dx [] = {+1,-1,+0,+0,-1,-1,+1,+1};///Eight Directions
//int dy [] = {+0,+0,+1,-1,+1,-1,-1,+1};///Eight Directions
//int dx[]={-2,-2,-1,1,-1,1,2,2};///Knight moves
//int dy[]={1,-1,-2,-2,2,2,-1,1};///Knight moves

ll powerM(ll x, ll y, ll M = mod) { // default argument
	ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;
}

ll power(ll x, ll y) {
	ll v = 1; while (y > 0) {if (y & 1)v = v * x; y = y >> 1; x = x * x;} return v;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("in4.txt", "r", stdin);
	freopen("out1.txt", "w", stdout);
#endif
	FIO
	ll flg = 0;
	ll c = 0;
	go_t{
		ll u, v;
		cin >> u >> v;
		if (u == v && flg == 0)
			++flg;
		else if (u == v && flg == 1) {
			++flg;
		}
		else if (u == v && flg == 2) {
			++flg;
			c = 1;
		}
		else if (u != v) {
			flg = 0;
		}
	}
	if (c) cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int n,x,c=0;
  cin>>n;
  rep(i,1,n+1){
    cin>>x;
    if(x%2==1 && i%2==1) c++;
  }
  cout<<c<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3648
#include<iostream>
#include<string>
int main(void) {
	std::string a;
	std::cin >> a;
	char c = 'a';
	int count = 0;
	bool judge = false;
	for (int l1 = 0; l1 < a.size(); l1++) {
		if (c != a.at(l1)) {
			count = 0;
			c = a.at(l1);
		}
		else
			count++;
		if (count >= 2)
			judge = true;

	}
	if (judge)
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

int main()
{
    string s;
    cin >> s;

    int i;
    for(i = 0; i < s.length() - 1; i ++)
    {
    	if(s[i] == s[i + 1])
    	{
    		cout << i + 1 << " " << i + 2;
    		break;
    	}
    	else if(i + 2 < s.length() && s[i] == s[i + 2])
    	{
    		cout << i + 1 << " " << i + 3;
    		break;
    	}
    }

    if(i == s.length() - 1)
    	cout << "-1 -1" << endl;
}

Measured memory_bytes: 512
#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};

ll f(ll b, ll n){
  if(n == 0) return 0;
  return f(b, n/b) + (n%b);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  ll n,s,d;
  cin >> n >> s;
  d = n-s;
  if(d < 0){
    cout << -1 << endl;
    return 0;
  }
  if(d==0){
    cout << n+1 << endl;
    return 0;
  }
  for(ll b=2;b*b<=n;b++){
    if(f(b,n) == s){
      cout << b << endl;
      return 0;
    }
  }
  ll ans = INF;
  for(ll p=1;p*p<n;p++){
    if(d%p==0){
      ll b=d/p+1;
      if(f(b,n) == s) ans = min(ans,b);
    }
  }
  if(ans == INF) ans=-1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
A, B = map(int, input().split())
a , b = 0, 0
ans = 0
n = 1
 
for i in range(1, 100001):
  a = A * i
  if ans != 0:
    print(ans)
    break
  for j in range(n, 100001):
    b = B * j
    if a == b:
      ans = a
    elif b < a:
      continue
    else:
      n = j
      break

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#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(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int K, X;
    cin >> K >> X;
    if(500 * K >= X) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

int main() {
	string S, T;
	cin >> S >> T;

	bool judge = false;
	if (S.length() == T.length() -1) {
		for (int i = 0; i < S.length(); ++i) {
			if (S[i] == T[i]) judge = true;
			if (S[i] != T[i]) {
				judge = false;
				break;
			}

		}
	}
	if (judge) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3128
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
	int n;
	int t[3];
	int max = 0;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t[i];
		if (max <= t[i])
			max = t[i];
	}

	if (n == 2)
		t[2] = t[1];

	for (int i = 1; i < max; i++) {
	if (t[0]%i == 0 && t[1]%i == 0 && t[2]%i == 0)
			cout << i << endl;
	}
	return 0;

}



Measured memory_bytes: 3092