akhauriyash/Code-Regression huggingface dataset:
// 69

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <iomanip>
#include <climits>
#include <string>
#include <cmath>

using namespace std;
using ll = long long;


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


Measured memory_bytes: 3584
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	if (n == 0 || n == 2)cout << 1 << endl;
	else if (n == 1)cout << 2 << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (long i = (s); i < (long)(n); i++)

int main() {

    int n,m;
    cin>>n>>m;

    vector<pair<int,int>>ab(n);
    rep(i,0,n){
        int a,b;
        cin>>a>>b;
        ab[i]=make_pair(a,b);
    }

    vector<pair<int,int>>cd(m);
    rep(i,0,m){
        int c,d;
        cin>>c>>d;
        cd[i]=make_pair(c,d);
    }

    rep(i,0,n){
        vector<pair<int,int>>dtc(m);
        rep(j,0,m){
            dtc[j].first=abs(ab[i].first-cd[j].first)+
                    abs(ab[i].second-cd[j].second);
            dtc[j].second=j;
        }
        sort(dtc.begin(),dtc.end());
        cout<<dtc[0].second+1<<endl;
    }
}


Measured memory_bytes: 256
const lines=readlines(open("/dev/fd/0"))
let
    state=0
    global input
    input()=lines[state+=1]
end
int(s::String)=parse(Int32,s)
intSub(s::SubString{String})=parse(Int32,s)
intLine()=map(intSub,split(input()))
function main()
    r,d,x=intLine()
    for i in 1:10
        x=r*x-d
        println(x)
    end
end
main()

Measured memory_bytes: 120612
#include<iostream>
#include<math.h>
//#inclde<map>                                                                                                         
using namespace std;

int main()
{
  // 入力                                                                                                              
  int N, K;
  cin >> N >> K;

  char S[N+1];
  cin >> S;

  //文字コードを0x20進める（小文字変換）                                                                     
  S[K-1] = S[K-1] + 0x20;

  //出力                                                                                                               
  cout << S << endl;

  return 0;
}

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

int main(){
  string a, b, c;
  cin >> a >> b >> c;
  if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void YES()
{
	OUT("YES");
}
void NO()
{
	OUT("NO");
}
void YESNO(const bool cond)
{
	OUT(cond ? "YES" : "NO");
}

void Yes()
{
	OUT("Yes");
}
void No()
{
	OUT("No");
}
void YesNo(const bool cond)
{
	OUT(cond ? "Yes" : "No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

// 階乗を計算 O(N) (N=10^7 で O(10^7))
ll factorial(ll n)
{
	for (ll i = n - 1; i > 1; --i)
		n *= i;
	return n;
}

// nCrを計算 O(N) (N=10^7 で O(10^7))
ll ncr(const ll n, ll r)
{
	if (r * 2 > n) r = n - r;

	ll dividend = 1, divisor = 1;

	for (ll i = 1; i <= r; ++i) {
		dividend *= n - i + 1;
		divisor *= i;
	}

	return dividend / divisor;
}

// 素数判定 O(sqrt(N)) (N=10^7 で O(10^3))
bool isprime(const ll num)
{
    if (num < 2) return false;
    if (num == 2) return true;
    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;
}

// 各桁の和を計算 O(logN) (N=10^7 で O(7))
ll digsum(ll n)
{
	ll sum = 0;
	while(n != 0){
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	inll age;
	if (age == 1)
	{
		return OUT("Hello World");
	}else
	{
		inll a, b;
		return OUT(a + b);
	}
}


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

int main() {
	int N;
	cin >> N;
	int AC = 0, WA = 0, TLE = 0, RE = 0;

	vector<string> S(N);
	for (int n = 0; n < N; n++) {
		cin >> S[n];
		if (S[n] == "AC") {
			AC++;
		}
		else if (S[n] == "WA") {
			WA++;
		}
		else if (S[n] == "TLE") {
			TLE++;
		}
		else if (S[n] == "RE") {
			RE++;
		}


	}

	cout << "AC x " << AC << endl;
	cout << "WA x " << WA << endl;
	cout << "TLE x " << TLE << endl;
	cout << "RE x " << RE << endl;

	return 0;
}


Measured memory_bytes: 6376
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
   int n;
   cin>>n;
   int lh=n/500;
   n-=lh*500;
   int ll=n/5;
   cout<<(lh*1000+ll*5)<<"\n";
}
main()
{
int t=1;
while(t--)
{
solve();

}
}

Measured memory_bytes: 256
# coding: utf-8
import sys,pprint,readline

av = {}
passed = set()

(N,K) = [int(x) for x in input().split(" ")]

arrivalary = list(map(int,input().split(" ")))

'''
N =  200000
K = 12345678901234567
arrivalary = []
for i in range(1,N):
    arrivalary.append(i+1)
arrivalary.append(1)
'''

i = 0
loopflg = 0
pos = 1
nextpos = 0
loopstartpos = 0
loopstartnum = 0
loopcount = 0
while i < K:
    passed.add(pos)
    nextpos = arrivalary[pos-1]
    #print(i,pos,nextpos,loopflg,loopstartnum,loopstartpos,loopcount,file=sys.stderr)
    if loopflg == 0 and nextpos in passed:
        loopflg = 1
        loopstartpos = nextpos
        loopstartnum = i
        loopcount = 1
    elif loopflg == 1 and nextpos == loopstartpos:
        left = (K-loopstartnum) % loopcount
        #print("left=",left,file=sys.stderr)
        i = K-left
        if i == K:
            break
    elif loopflg == 1:
        loopcount += 1
    pos = nextpos
    i += 1

print(pos)

Measured memory_bytes: 33784
#include <bits/stdc++.h>
#define MEM 100006
#define sanic ios_base::sync_with_stdio(0)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
const ll MOD = 1e9+7;
ll n,m,ans;
ll a[MEM];
int main()
{
    sanic; cin.tie(0);
    cin >> n >> m;
    for(int i=0; i<n; i++)
        cin >> a[i];
    sort(a,a+n);
    for(int i=0; i<m; i++)
        ans += a[i];
    cout << ans;
}


Measured memory_bytes: 3676
#include<map>
#include<string>
#include<vector>
#include<iostream>
#include<algorithm>

#define	score	first
#define	id		second

using namespace std;

typedef	pair<int,int>	pii;

bool cmp(const pii& a,const pii& b)
{
	if(a.score>b.score)	return true;
	if(a.score==b.score && a.id<b.id)	return true;
	return false;
}

int main()
{
	int n;

	for(int k=0;cin>>n,n;k++){
		if(k>0)	cout<<endl;

		vector<pii> scvec;
		map<int,string> namemap;

		for(int i=0;i<n;i++){
			string name;
			int w,l,d;
			cin>>name>>w>>l>>d;
			scvec.push_back(make_pair(3*w+d,i));
			namemap[i]=name;
		}

		sort(scvec.begin(),scvec.end(),cmp);

		for(int i=0;i<scvec.size();i++){
			cout<<namemap[scvec[i].id]<<","<<scvec[i].score<<endl;
		}
	}

	return 0;
}



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

void prians(bool answer) {
  if(answer)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
int g[] = {0, 0, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 0};
int x, y;

int main() {
  cin >> x >> y;
  prians(g[x] == g[y]);
  return 0;
}

Measured memory_bytes: 256
/**
 *  Author : Parth Prajapati aka (PARTH_4399, hungry_chef)
 *  Institute : Pandit Deendayal Petroleum University
 **/
#include <bits/stdc++.h>

using namespace std;

void solve()
{
    int n;
    cin >> n;
    vector<long long> s(n);
    for (auto &it : s)
        cin >> it;
    sort(s.begin(), s.end());
    long long ans = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            for (int k = j + 1; k < n; ++k)
            {
                if (s[i] + s[j] > s[k] && s[i] != s[j] && s[i] != s[k] && s[j] != s[k])
                {
                    ++ans;
                }
            }
        }
    }
    cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 3660
import sys
from copy import copy
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
for test in range(int(input())):
'''
inf = 100000000000000000  # 1e17
mod = 998244353


def two(x):
    return "0" * (h - 1 - len(bin(x)[2:])) + bin(x)[2:]


h, w, k = map(int, input().split())
S = []
ans = inf
for i in range(h):
    S.append(input().strip())
for way_cut in range(1 << (h - 1)):
    way_cut = two(way_cut)
    number_cut_horizontal = way_cut.count("1")
    number_cut_vertical = 0
    CUT = [-1]
    for i in range(len(way_cut)):
        if way_cut[i] == '1':
            CUT.append(i)
    CUT.append(len(way_cut))
    SUM = [0] * (w)
    PRE = [0] * (w)
    for col in range(w):
        for i in range(1, len(CUT)):
            for between in range(CUT[i - 1] + 1, CUT[i] + 1):
                SUM[i] += 1 if S[between][col] == "1" else 0
        isok = True
        for i in range(1, len(CUT)):
            if PRE[i] + SUM[i] > k:
                isok = False
        if not isok:
            number_cut_vertical += 1
            PRE = copy(SUM)
            SUM = [0]*(w)  # leave out
            # recheck
            for i in range(1, len(CUT)):
                if PRE[i] > k:
                    number_cut_vertical = inf
                    break
        else:
            for i in range(1, len(CUT)):
                PRE[i] += SUM[i]
                SUM[i] = 0
    ans = min(ans, number_cut_vertical + number_cut_horizontal)
print(ans)


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

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

    char mat[h][w];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> mat[i][j];
        }
    }

    int posi = 0, posj = 0;
    bool proceed = true;
    while(proceed && (posi != h-1 || posj != w-1)){
        proceed = false;

        while(posj < w-1 && mat[posi][posj+1] == '#'){
            proceed = true;
            mat[posi][posj] = '.';
            posj++;
        }

        while(posi < h-1 && mat[posi+1][posj] == '#'){
            proceed = true;
            mat[posi][posj] = '.';
            posi++;
        }

    }

    if(posi != h-1 || posj != w-1){
        cout << "Impossible" << endl;
    }else{
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(i+j == 0 || i+j == h+w-2)    continue;
                if(mat[i][j] == '#'){
                    cout << "Impossible" << endl;
                    return 0;
                }
            }
        }

        cout << "Possible" << endl;
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main( int argc, char *argv[] ) {
	int N, K, tmp, com = 0;

	cin >> N >> K;
	for ( int i = 0 ; i < N ; i++ ){
		cin >> tmp;
		if ( tmp >= K )
			com++;
	}
	cout << com << endl;
	return 0;
}


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

int main() {//main start
  int Ared, Bgreen, Cblue, K;
  int count=0;
  
  cin >> Ared >> Bgreen >> Cblue >> K;
  
  for(;;){
    if(count > K){//if2 output "No"
      cout << "No" << endl;
      break;}//if2
    else if(Bgreen <= Ared){//else if2
      Bgreen *=2;
      count++;
      continue;
    }else if(Cblue <= Bgreen){
        Cblue *= 2;
        count++;
        continue;
      }else{
        cout << "Yes" << endl;
        break;
      }
    }
  }
  


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

int main() {
    uint64_t a, b, x;
    std::cin >> a >> b >> x;

    if (a == 0) {
        std::cout << b / x + 1<< std::endl;
    } else {
        std::cout << b / x - (a - 1) / x << std::endl;
    }


    return 0;
}


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

using namespace std ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	int n ;
	cin>>n ;
	return cout<<fixed<<setprecision(10)<<(((n+1) / 2) * 1.00) / (n * 1.00)<<"\n" , 0 ; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) a.begin(),a.end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define INF 1e9
typedef long long ll;

struct UnionFind{
    vector<int> par;
    vector<int> sizes;
    UnionFind(int n):par(n),sizes(n,1){ rep(i,n)par[i]=i; }

    //find root of x
    int find(int x){
        if(x!=par[x]) par[x] = find(par[x]);
        return par[x];
    }

    void unite(int x,int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }

    bool same(int x,int y){ return find(x) == find(y); }
    int size(int x){ return sizes[find(x)]; }
};

int main(void){
    int N,K,L;
    cin>>N>>K>>L;
    UnionFind rail(N+1),road(N+1);
    rep(i,K){
        int p,q;
        cin>>p>>q;
        road.unite(p,q);
    }
    rep(i,L){
        int r,s;
        cin>>r>>s;
        rail.unite(r,s);
    }
    map<pair<int,int>,int> cnt;

    rep1(i,N){
        cnt[{road.find(i), rail.find(i)}]++;
    }
    rep1(i,N){
        cout<<cnt[{road.find(i), rail.find(i)}]<<(i==N ? "\n" : " ");
    }
    return 0;
}


Measured memory_bytes: 15104
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner( System.in );
		
		while( true ) {
			int height	= sc.nextInt();
			int width	= sc.nextInt();
			
			if (		height	== 0
					&&	width	== 0	) {
				break;
			}
			
			for (int i = 0; i < height; i++ ) {
				if ( i == 0 || i == (height - 1) ) {
					frame( width );
					
				} else {
					content( width );
					
				}
				
				
			}
			System.out.print("\n");
			
		}
	}
	
	public static void frame( int width ) {
		for ( int j = 0; j < width; j++  ) {
			System.out.print("#");
		}
		
		System.out.print("\n");
	
	}
	
	public static void content( int width ) {
		System.out.print("#");

		for ( int j = 0; j < (width - 2); j++  ) {
			System.out.print(".");
		}

		System.out.println("#");	
	}
}

Measured memory_bytes: 25868
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#define int long long
using namespace std;

typedef pair<int, int> Pii;

void readline(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readline(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}

signed main(){

    int N;
    cin >> N;
    int M = N;

    int sn = 0;
    for(int i = 0; i < 10; i++){
        sn += M % 10;
        M /= 10;
    }

    if(N % sn == 0){
        cout << "Yes";
    }else{
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#include <bitset>
#include <math.h>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
const int MAX = 510000;

/*-----Library-----*/

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
    vector<int> sizeuf; //要素数
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n); sizeuf.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
            sizeuf[i]=1;
        }
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        sizeuf[x]+=sizeuf[y];
        return true;
    }

    int size(int x){
        return sizeuf[root(x)];
    }
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}

long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/*-----Library-----*/
int n,a,b;
int h[114514];
P max_h(){
    P re=P(h[0],0);
    for(int i=1;i<n;i++){
        if(re.first<h[i]){
            re=P(h[i],i);
        }
    }
    return re;
}

signed main(){
    int r;
    cin>>r;
    cout<<r*r<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, K;
  string S;
  cin >> N >> S >> K;
  char a = S.at(K -1);
  for(int i=0;i<N;i++){
    if(S.at(i) != a) S.at(i) ='*';
  }
  cout << S <<endl;
}


Measured memory_bytes: 256
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

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

bool chek(string s){
	int c = 0 ;
	for (int i = 0; i < s.size(); ++i)
	{
		if((s[i] >= 'a' and s[i] <= 'z') or (s[i] >= 'A' and s[i] <= 'Z') or (s[i] >= '0' and s[i] <= '9')){
			c++ ;
		}
	}
	return (c == s.size());
}
const long double pi = acos(-1);
int main()
{
	char s; 
	cin >> s; 
	if(s == 'A') cout << 'T' << endl ;
	if(s == 'T') cout << 'A' << endl ;
	if(s == 'G') cout << 'C' << endl ;
	if(s == 'C') cout << 'G' << endl ;
    return 0 ;
}


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

typedef long long LL;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

#define fast ios_base::sync_with_stdio(0),cin.tie(0)
#define temp template<typename T>
#define debug(x) cerr<<"Line "<<__LINE__<<": "<<#x<<" = "<<x<<'\n'
#define itr(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define rep(i,a,b) for(int i=a;i<=(int)b;i++)
#define repr(i,a,b) for(int i=a;i>=(int)b;i--)
#define cas(n) printf("Case %d:",(int)n)
#define mem(x,v) memset(x,v,sizeof(x))
#define read(x) freopen(x,"r",stdin)
#define write(x) freopen(x,"w",stdout)
#define all(x) x.begin(),x.end()
#define aut(x,v) for(auto &x:v)
#define ini(n) scanf("%d",&n)
#define inl(n) scanf("%lld",&n)
#define ind(n) scanf("%lf",&n)
#define ins(n) scanf("%s",n)
#define insn(n) scanf(" %[^\n]",n)
#define outi(n) printf("%d",(int)n)
#define outl(n) printf("%lld",(LL)n)
#define outd(n,p) printf("%.*lf",p,(double)n)
#define outs(n) printf("%s",n)
#define sz(x) (int)x.size()
#define nl printf("\n")
#define sp printf(" ")
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

const int inf=0x3f3f3f3f;
const int mod=1000000007;
const int mx=100005;
const LL  infL=0xf3f3f3f3f3f3f3f;
const double eps=1e-9;
const double pi=acos(-1.0);

int main()
{
    //read("in.txt"),write("out.txt");
    int a,b,c;
    ini(a),ini(b),ini(c);
    outi(min((b/a),c)),nl;
    return 0;
}


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

int main(){
        int i, j, key,  n;
        int *array;

        scanf("%d", &n);

        array = (int *)malloc(n * sizeof(int));

        for(i = 0 ; i < n ; i++){
                scanf("%d", &array[i]);
        }

        for(j = 0 ; j < n ; j++){
                printf("%d", array[j]);
                if(j == n - 1)break;
                printf(" ");
        }
        printf("\n");

        for(i = 1 ; i < n ; i++){
                key = array[i];
                j = i - 1;
                while(j >= 0 && array[j] > key){
                        array[j+1] = array[j];
                        j--;            
                }
                array[j+1] = key;
                
                for(j = 0 ; j < n ; j++){
                        printf("%d", array[j]);
                        if(j == n - 1)break;
                        printf(" ");
                }
                printf("\n");
        } 

        return 0;
}



Measured memory_bytes: 2128
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.inr(),r=e.length,n=new Array(r),i=0;i<=r;i++)n[i]=new Array(13).fill(0);n[0][0]=1;for(var o=1;o<=r;o++)if("?"==e[o-1])for(var s=0;s<13;s++)for(var u=0;u<10;u++)n[o][(10*s+u)%13]+=n[o-1][s],n[o][(10*s+u)%13]%=1000000007;else for(var c=Number(e[o-1]),f=0;f<13;f++)n[o][(10*f+c)%13]+=n[o-1][f],n[o][(10*f+c)%13]%=1000000007;console.log(n[r][5])}}]);

Measured memory_bytes: 53528
from collections import deque
n,m = map(int,input().split())

adj = [[] for _ in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    adj[a].append(b)
    adj[b].append(a)

que = deque()
dist = [-1]*n
ans = [0]*n

que.append(0)
while len(que) != 0:
    now = que.popleft()
    for to in adj[now]:
        if dist[to] != -1: continue
        dist[to] = dist[now]+1
        que.append(to)
        ans[to]=now

print("Yes")
for i in range(1,n):
    print(ans[i]+1)

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

template<class T, T monoid>
class SegmentTree{
public:
  vector<T> dat;
  int _n;

  SegmentTree(int size) : _n{1}{
    while(size > _n) _n *= 2;
    dat.resize(2*_n-1, monoid);
  } 

  void update(int k, int a){
    k += _n-1;
    dat[k] += a;

    while(k > 0){
      k = (k-1) / 2;
      dat[k] = dat[k * 2 + 1] + dat[k * 2 + 2];
    }
  }

  T query(int a, int b){
    return _query(a, b, 0, 0, _n);
  }

  void print(){
    for(const auto& v: dat) cout << v << " ";
    cout << endl;
  }
private:
  T _query(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) {
      return monoid;
    }
    if(a <= l && r <= b) {
      return dat[k];
    }
    else {
      T v1 = _query(a, b, k * 2 + 1, l, (l + r) / 2);
      T v2 = _query(a, b, k * 2 + 2, (l + r) / 2, r);

      return v1 + v2;
    }
  }
};

int main(){
  int n, q; cin >> n >> q;
  SegmentTree<int, 0> st(n+1);

  for(int i=0; i<q; i++){
    int com, x, y; cin >> com >> x >> y;
    switch(com) {
      case 0: {
        st.update(x, y);
        break;
      }
      case 1: {
        cout << st.query(x, y+1) << endl;
        break;
      }
    }
  }

  return 0;
}



Measured memory_bytes: 3888
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int n, x[100], y[100];

int main(){
  cin >> n;
  rep(i, n) cin >> x[i] >> y[i];
  map<P, int> mp;
  for(int i = 0; i < n - 1; i++){
    for(int j = i + 1; j < n; j++){
      mp[P(x[i] - x[j], y[i] - y[j])]++;
      mp[P(x[j] - x[i], y[j] - y[i])]++;
    }
  }
  int m = 0;
  for(auto x : mp){
    m = max(x.second, m);
  }
  cout << n - m << endl;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
#include<functional>
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int a, b, c; cin >> a >> b >> c;
	if (a + b == c || a + c == b || b + c == a) {
		cout << "Yes" << endl; return 0;
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>

int main(void)
{
    char A[201],buf[201];
    int n,i,h;

    while(1)
    {
        scanf("%s",A);
        if(strcmp(A,"-")==0)break;
        scanf("%d",&n);
        
        for(i=0;i<n;i++)
        {
            scanf("%d",&h);
            strcpy(buf,A+h);
            strncat(buf,A,h);
            strcpy(A,buf);
        }
        printf("%s\n",A);
    }
    return 0;
}

Measured memory_bytes: 600
import           Control.Monad
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Maybe
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
  s <- BS.getLine
  k <- getInt

  let n = BS.length s
  v <- VM.new n
  VM.write v 0 'a'

  let solve i j | i == (n-1) = do
                    VM.write v 0 'a'
                    let c = BS.index s i
                        c' = if ord c + j <= ord 'z'
                             then chr $ ord c + j
                             else chr $ (j - (ord 'z' - ord c) - 1) `mod` 26 + ord 'a'
                    VM.write v i c'

                | otherwise = do
                    let c = BS.index s i
                        d = ord 'z'  - ord c + 1
                    if c /= 'a' && d <= j
                      then do VM.write v i 'a'
                              solve (i+1) (j-d)
                      else do VM.write v i c
                              solve (i+1) j

  solve 0 k

  v' <- V.freeze v
  putStrLn $ V.toList v'

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

int asc(const void* a, const void* b) {
	return *(int*)b - *(int*)a;
}

int main()
{
	int n, cnt, max = 0, sec;
	int a[200050];
	cin >> n;
	rep(i, n) 
	{
		cin >> a[i];
		if (a[i] > max) {
			sec = max;
			max = a[i];
		}
		else if (sec < a[i]) {
			sec = a[i];
		}
	}
	rep(i, n) {
		if (a[i] == max) {
			cout << sec << endl;
		}
		else {
			cout << max << endl;
		}
	}
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define stop exit(0)
#define dd double
#define po pop_back
#define pb push_back
#define ub upper_bound
#define lb lower_bound
int main(){
    vector <long long> v;
    ll a,b,c,d=0,e=0,f=0,g=0,i,j,k=1,l=1,r=1,n,m[300001],z[400001],h[600001],p[600001];
    string s,t,x,y[1001];
    dd q,u,w;
    cin>>a>>b;
    k=a+1;
    for(i=b;i<=k;i++){
        d=(d+(((k-i)*i)+1))%1000000007;
    }
    cout<<d;
}

Measured memory_bytes: 3660
import java.util.Scanner;

     class Main{
        public static void main(String args[]){
           Scanner sc = new Scanner(System.in);

           int n,b,f,r,v,i,j1,j2; 

           int [][][]x=new int[4][3][10];

           x[0][0][0]=0;

           n=sc.nextInt();

           for(i=0;i<n;i++){

           b=sc.nextInt()-1;

           f=sc.nextInt()-1;

           r=sc.nextInt()-1;

           v=sc.nextInt();

           x[b][f][r]+=v;

           }

           for(j1=0;j1<15;j1++){
              for(j2=0;j2<10;j2++){

                 if(j1%4==3){
                 System.out.print("####################");
                 break;
                 } 
                 if(j1<3){
                 System.out.print(" "+x[0][j1][j2]);           
                 }
                 if(3<j1 && j1<7){
                 System.out.print(" "+x[1][j1-4][j2]);           
                 }
                 if(7<j1 && j1<11){
                 System.out.print(" "+x[2][j1-8][j2]);           
                 }
                 if(11<j1){
                 System.out.print(" "+x[3][j1-12][j2]);           
                 }

              }
                 System.out.println();

           }           

        }
     }



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

int rc(long long, int, int);
int n;

int main()
{
	scanf("%d", &n);
	printf("%d\n", rc(0, 0, 0) - rc(0, 3, 0) - rc(0, 5, 0) - rc(0, 7, 0)+ rc(0, 3, 5) + rc(0, 5, 7) + rc(0, 7, 3) - 1);

	return 0;
}

int rc(long long num, int ignore1, int ignore2)
{
	if (num > n) return 0;
	int sum{1}, add[3]{3, 5, 7};
	for (int i = 0; i < 3; i++)
		if (add[i] != ignore1 && add[i] != ignore2)
			sum += rc(num * 10 + add[i], ignore1, ignore2);
	
	return sum;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main() {
	string s;
	int n;

	cin >> n;
	cin >> s;

	int w_from_front[n];
	int e_from_end[n];

	if (s.at(0) == 'E') {
		w_from_front[0] = 0;
	} else {
		w_from_front[0] = 1;
	}

	if (s.at(n - 1) == 'E') {
		e_from_end[n - 1] = 1;
	} else {
		e_from_end[n - 1] = 0;
	}

	for (int i = 1; i < n; i++) {
		if (s.at(i) == 'E') {
			w_from_front[i] = w_from_front[i - 1];
		} else {
			w_from_front[i] = w_from_front[i - 1] + 1;
		}
	}

	for (int i = n - 2; i >= 0; i--) {
		if (s.at(i) == 'E') {
			e_from_end[i] = e_from_end[i + 1] + 1;
		} else {
			e_from_end[i] = e_from_end[i + 1];
		}
	}

	int min_count = 100000000;
	for (int i = 0; i < n; i++) {
		int count = 0;
		if (i > 0) {
			count += w_from_front[i - 1];
		}
		if (i < n - 1) {
			count += e_from_end[i + 1];			
		}
		min_count = min(min_count, count);
	}
	cout << min_count << endl;

	return 0;
}


Measured memory_bytes: 3076
p = [pow(26, i) for i in range(17)]
num = [0 for i in range(17)]
for i in range(17):
  if i == 0:
    continue
  if i == 1:
    num[i] = 26
  else:
    num[i] = num[i-1] + p[i]
n = int(input())
ans = ''
l = 0
while n > num[l]:
  l += 1
x = n - num[l-1] - 1
for _ in range(l):
  c = chr(ord("a") + x % 26)
  ans = c + ans
  x //= 26
print(ans)

Measured memory_bytes: 9164
#include <stdio.h>
#define N 100

int main()
{
  int A[N],n,i,j,k,count=0,minj;
  
  scanf("%d",&n);
  
  for (i=0;i<n;i++){
    scanf("%d", &A[i]);
  }
  
  for (i=0;i<=n-1;i++){
    minj=i;
    for (j=i;j<=n-1;j++){
      if (A[j]<A[minj]){
	minj=j;
      }
    }
	k=A[i]; 
	A[i]=A[minj]; 
	A[minj]=k;
	if(i!=minj){
	  count++;
	}
      }
  
  
  for (i=0;i<n;i++){
    if(i>=1) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n", count);
  
  return 0;
}

Measured memory_bytes: 604
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int main() {
    ll n, k;
    cin >> n >> k;

    ll a[n];
    rep(i, n) {
        ll t;
        cin >> t;
        a[i] = t-1; 
    }

    set<ll> st;

    ll loopStart, loopCount;
    ll loopStartPosition;
    ll position = 0;
    rep(i, n) {
        st.insert(position);
        if(st.size()!=(i+1)) {
            loopStart = position;
            loopCount = i;
            break;
        }
        position = a[position];
    }

    position = 0;
    rep(i, n) {
        if(loopStart==position) {
            loopStartPosition = i;
            loopCount -= i;
            break;
        }
        position = a[position];
    }

    if(k<=loopStartPosition) {
        ll ans = 0;
        rep(i, k) {
            ans = a[ans];
        }
        print(ans+1);
        return 0;
    }

    k -= loopStartPosition;
    k %= loopCount;

    ll ans = loopStart;
    rep(i, k) {
        ans = a[ans];
    }

    print(ans+1);
    return 0;
}


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

int main(){
  string a, b, c;
  cin >> a >> b >> c;
  if(a == b){
    cout << c << endl;
  } else if(a == c){
    cout << b << endl;
  } else if(b == c){
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n=5;
    vector<int> a(n);
    for(int i=0;i<n; i++) cin >> a[i];
    int ans = 0;
    int offset=0;
    for(int i=0;i<n;i++){
        if(a[i]%10==0){
            ans+=a[i];
        }else{
            ans+=a[i]+(10-a[i]%10);
            offset=max(offset, (10-a[i]%10));
        }

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

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    private BufferedReader in;
    private StringTokenizer tok;
    private PrintWriter out;

    //------------------------------------------------------------------------------
    public static void main(String[] args) {
        new Main().run();
    }

    private void solve() throws IOException {
        long a = readLong();
        long b = readLong();
        long c = readLong();
        int x = readInt();
        int y = readInt();
        long ans = Long.MAX_VALUE;
        for (int cntC = 0; cntC <= 4 * (x + y); cntC++) {
            int cntA = Math.max(0, x - cntC / 2);
            int cntB = Math.max(0, y - cntC / 2);
            ans = Math.min(ans, cntC * c + cntA * a + cntB * b);
        }
        out.println(ans);
    }

    private void run() {
        try {
            initIO();
            solve();
            in.close();
            out.close();
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }

    private void initIO() throws IOException {
        try {
            in = new BufferedReader(new FileReader(new File("input.txt")));
            out = new PrintWriter(new File("output.txt"));
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    private String readString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    @SuppressWarnings("unused")
    private int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    @SuppressWarnings("unused")
    private long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    @SuppressWarnings("unused")
    private double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }
}


Measured memory_bytes: 21456
import java.util.*;
import java.math.BigDecimal;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		BigDecimal A = sc.nextBigDecimal();
		BigDecimal B = new BigDecimal((int)(sc.nextDouble() * 100 + 0.5));
		BigDecimal ans = A.multiply(B);
		ans = ans.divide(BigDecimal.valueOf(100));
		ans = ans.setScale(0, BigDecimal.ROUND_DOWN);
		System.out.print(ans);
	}
}


Measured memory_bytes: 37768
#include <stdio.h>

int main(void) {
  int paper = 0;
  int n;
  scanf("%d", &n);
  if(n % 2 == 0) {
    paper = n / 2;
  } else {
    paper = n / 2 + n % 2;
  }
  printf("%d", paper);
  return 0;
}


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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)
ll gcd(ll a, ll b){
  ll x;
	while(a!=b){
    if(b==0)break;
    a=a%b;
    x=b;
    b=a;
    a=x;
  }
  return a;
}

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

  ll N;
  cin>>N;
  vector<ll> v(N+1);
  cinv(v,0,N+1);
  sortAl(v);

  vector<ll> key(N);

  FOR(i,0,N){
    key[i]=v[i+1]-v[i];
  }
  ll res=key[0];
  FOR(i,0,N){
    res=gcd(res,key[i]);
  }
  cout<<res<<endl;

}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10

int db[20000];

vector<vector<int>> Points;

int dst(vector<int> p1, vector<int>p2) {
	int sz = p1.size();
	int res = 0;
	for (int i = 0; i < sz; i++) {
		res += (p1[i] - p2[i])*(p1[i] - p2[i]);
	}
	return res;
}

int main() {
	int N, D;
	cin >> N >> D;
	Points.assign(N, vector<int>(D, 0));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < D; j++) {
			cin >> Points[i][j];
		}
	}
	for (int i = 1; i*i < 20000; i++) {
		db[i*i] = i;
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i+1; j < N; j++) {
			int ds = dst(Points[i], Points[j]);
			if (db[ds] != 0)ans++;

		}
	}
	print(ans);



	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	string s;
	cin>>s;
	fx(s.size()){
		if(x%2==0)
		cout<<s.at(x);
	}
}

Measured memory_bytes: 512
N=int(input())
A=list(map(int,input().split()))

M=abs(A[0])+abs(A[N-1])
for i in range(N-1):
    M+=abs(A[i+1]-A[i])
    
print(M-abs(A[0])-abs(A[1]-A[0])+abs(A[1]))
for i in range(1,N-1):
    print(M-abs(A[i]-A[i+1])-abs(A[i]-A[i-1])+abs(A[i+1]-A[i-1]))


print(M-abs(A[N-1])-abs(A[N-1]-A[N-2])+abs(A[N-2]))

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

int main() {

	ll n, d; cin >> n >> d;
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		ll x, y; cin >> x >> y;
		if (x * x + y * y <= d * d) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# list = list(map(int, input().split()))

N = int(input())
a = list(map(int, input().split()))

k = 1

for i in range(N):
    if a[i] == k:
        k = k+1

ans = N - k + 1

if ans == N:
    ans = -1

print(ans)

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rep1(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define repU(i,bottom,ceiling) for(auto (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(auto (i) = (ceiling); (i) >= (bottom); --(i))
#define repV(i,v) for(auto (i) = begin(v); (i) < end(v); ++(i))
#define all(v)  begin(v),end(v)
#define clr(v) fill(all(v),0)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define divceil(n,d) ((n)/(d) + ((n)%(d) > 0))
#define parity(a,b) (((a) & 1LL)^((b) & 1LL)^1LL)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF_32 = -1 + (1 << 30);
const ll INF_64 = -1 + (1LL << 62);
const int MOD = (int)1e9 + 7;

ull next_subset(ull subset){
	ull tem = subset + (subset & -subset);
	ull btm = (~tem & subset) / (subset & -subset) >> 1;
	return btm | tem;
}


void solve(){
	
	db n,m,d; cin>>n>>m>>d;
	if(d){
		fcout(9)<<(m-1)*(n-d)*(db)2/(n*n)<<endl;
	}else{
		fcout(9)<<(m-1)/n<<endl;
	}
	
	return;
}

void input(){
	
	
	
	return;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	input();
	solve();
	
	return 0;
}





Measured memory_bytes: 256
/*input
4 5
*/

#include <iostream>
using namespace std;

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

Measured memory_bytes: 256
n,a,b = input().split()
s = []
c = 0
arr = []
ans = []

for i in range(1,int(n)+1):
  arr.append(str(i))
#print(arr[18][1])

for i in range(0,len(arr)):
  tmp = 0
  for j in range(0,len(arr[i])):
    tmp += int(arr[i][j])
    #print(arr[i][j])
  s.append(tmp)

for i in range(0,len(s)):
  if(s[i] >=int(a) and s[i] <= int(b)):
    ans.append(i+1)
    
print(sum(ans))

Measured memory_bytes: 40816