akhauriyash/Code-Regression huggingface dataset:
program name
    implicit none
    integer(4):: k,n,i
    integer(4),allocatable:: a(:), dist(:)

    read*, k, n
    allocate(a(n), dist(n))
    read*, a(:)

    dist(1) = a(1) + k-a(n)

    do i=2, n
        dist(i) = a(i) - a(i-1)
    end do

    print*, sum(dist) - maxval(dist)
end program name

Measured memory_bytes: 2304
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define ALL(obj) (obj).begin(),(obj).end()

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template<class T> void corner(bool flg, T hoge) {
	if (flg) {
		cout << hoge << endl;
		exit(0);
	}
	else return;
}

template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {
	o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;
}

template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {
	o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;
}

template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {
	o << "{" << obj.first << ", " << obj.second << "}"; return o;
}

template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

void print(void) {
	cout << endl;
}

template <class Head> void print(Head&& head) {
	cout << head;
	print();
}

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {
	cout << head << " ";
	print(forward<Tail>(tail)...);
}

void YN(bool flg) {
	cout << ((flg) ? "YES" : "NO") << endl;
}

void Yn(bool flg) {
	cout << ((flg) ? "Yes" : "No") << endl;
}

void yn(bool flg) {
	cout << ((flg) ? "yes" : "no") << endl;
}



int main() {
    ll i,o,t,j,l,s,z;
	cin >> i>>o>>t>>j>>l>>s>>z;
    ll ans=0;
    if(i>0 && j >0&& l>0){
      if(i%2+j%2+l%2>1){
        i--;
        j--;
        l--;
        ans+=3;
      }
    }
  ans+=2*(i/2);
    ans+=2*(j/2);
    ans+=2*(l/2);
    ans+=o;
  print(ans);
  
  
  
  

	return 0;
}



Measured memory_bytes: 256
H,W = gets.split.map(&:to_i)
M = Array.new(H).map{Array.new(W)}
H.times{|i| M[i]=gets.chomp.split('')}

H.times do |i|
    W.times do |j|
        next if M[i][j]=="#"
        cnt=0
        if i>0
            cnt+=1 if j-1>=0 && M[i-1][j-1]=='#'
            cnt+=1 if M[i-1][j]=='#'
            cnt+=1 if j+1<W && M[i-1][j+1]=='#'
        end
        cnt+=1 if j-1>=0 && M[i][j-1]=='#'
        cnt+=1 if j+1<W && M[i][j+1]=='#'
        if i+1<H
            cnt+=1 if j-1>=0 && M[i+1][j-1]=='#'
            cnt+=1 if M[i+1][j]=='#'
            cnt+=1 if j+1<W && M[i+1][j+1]=='#'
        end
        M[i][j]=cnt
    end
end

H.times{|i| puts M[i].join('')}

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

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

  int ret = 0;
  if(c <= a+b+1)ret = b+c;
  else{
    ret = b + (a+b+1);
  }

  cout << ret << endl;
}


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

public class Main{

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int M = scn.nextInt();
		int[] Num = new int[M];
		for (int i = 0; i < M; i++) {
			Num[i] = scn.nextInt();
		}
		Arrays.sort(Num);
		int[] numnum = { 2, 5, 5, 4, 5, 6, 3, 7, 6 };
		NumSet.setNum(Num);


		NumSet[] DP = new NumSet[N+1];
		for(int i = 0;i <= N;i++) {
			for(int j = 0;j <= Math.min(N/2, 1000);j++) {
				if(DP[j] != null && DP[i-j] != null) {
					if(DP[i] == null) {
						DP[i] = new NumSet(DP[j], DP[i-j]);
					}else {
						DP[i] = NumSet.max(new NumSet(DP[j], DP[i-j]), DP[i]);
					}
				}
			}
			if(DP[i] == null) {
				for(int j = Num.length-1;j > -1;j--) {
					if(i == numnum[Num[j]-1]) {
						DP[i] = new NumSet(j);
						 break;
					}
				}
			}
		}
		System.out.println(DP[N]);

	}

}

class NumSet{
	static int[] num;
	int[] num_num;
	public NumSet(NumSet N1, NumSet N2) {
		num_num = marge(N1, N2);
	}

	public NumSet(int j) {
		num_num = new int[num.length];
		num_num[j]++;
	}

	int[] getNum(){
		return this.num;
	}

	int[] getNumNum() {
		return this.num_num;
	}

	int getSize() {
		int size = 0;
		for(int i:num_num) {
			size+= i;
		}
		return size;
	}

	int[] marge(NumSet N1, NumSet N2) {
		int[] n1 = N1.getNumNum(), n2 = N2.getNumNum();
		int length = n1.length;
		int[] merge_num_num = new int[length];
		for(int i = 0;i < length;i++) {
			merge_num_num[i] = n1[i] + n2[i];
		}
		return merge_num_num;
	}

	static void setNum(int[] Num) {
		num = Num;
	}

	static NumSet max(NumSet N1, NumSet N2) {
		if(N1.getSize() > N2.getSize()) {
			return N1;
		}
		if(N1.getSize() < N2.getSize()) {
			return N2;
		}
		int length = num.length;
		int[] n1 = N1.getNumNum();
		int[] n2 = N2.getNumNum();
		for(int i = length-1;i > -1;i--) {
			if(n1[i] > n2[i])return N1;
			if(n1[i] < n2[i])return N2;
		}
		return N1;
	}

	public String toString() {
		String str = "";
		for(int i = num.length-1;i > -1;i--) {
			for(int j = 0;j < num_num[i];j++) {
				str += num[i];
			}
		}
		return str;
	}
}


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

long long f(long long a, long long  b, long long x) { return a * x / b - a * (x / b); }

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

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

int main(){
  int N;
  long long power = 1;
  cin >> N;
  for(int i=2;i<=N;i++)
    power = (i*power)%(((int)pow(10,9))+7);
  cout << power << endl;
  return 0;
}


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

int main() {
    int n, max_w;

    cin >> n >> max_w;

    vector<int> w(n);
    vector<int> v(n);

    for ( int i = 0; i < n; i++ ) {
        cin >> w[i] >> v[i];
    }

    vector<vector<ll>> dp(n+1, vector<ll>(max_w+1));
//    vector<vector<ll>> dp(n, vector<ll>(max_w));



    for ( int i = 1; i <= n; i++ ) {
        for ( int j = 0; j <= max_w; j++ ) {
//            dp[i][j] = max(dp[i][j], dp[i-1][j]);
            dp[i][j] = dp[i-1][j];
            if ( j - w[i-1] >= 0 ) {
                dp[i][j] = max(dp[i][j], dp[i-1][j-w[i-1]] + v[i-1]);
            }
        }
    }

    ll ans = 0;
    for ( int i = 0; i <= max_w; i++ ) {
        ans = max(ans, dp[n][i]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 80256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const ll maxn = 1e6+10;
const ll inf = 1e14;

vector<pii> ve[maxn];
ll dis[maxn];
priority_queue<pii,vector<pii>,greater<pii>> heap;
int N,M;

void init(){
	for(int i = 1;i<=N;i++) dis[i] = inf;
	for(int i = 1;i<=N;i++) ve[i].push_back({0,i-1});
	
}

ll Dji(){
	heap.push({0,1});
	dis[1] = 0;
	
	while(heap.size()){
		auto cur = heap.top();heap.pop();
		ll d = cur.first,id = cur.second;
		for(auto v:ve[id]){
			ll w = v.first,id2 = v.second;
			if(d+w<dis[id2]){
				dis[id2] = d+w;
				heap.push({dis[id2],id2});
			}
		}
	}
	if(dis[N] == inf) return -1;
	return dis[N];
}

int main(){
	cin>>N>>M;
	init();
	int a,b,c;
	for(int i = 0;i<M;i++){
		scanf("%d%d%d",&a,&b,&c);
		ve[a].push_back({c,b});
	}
	cout<<Dji()<<endl;
	return 0;
}

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

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

    int cnt = 0;
    // 前方から捜査
    char key = N[0];
    for(size_t i = 0; i < 4; i++){
        if(N[i] == key){
            cnt++;
        } else {
            break;
        }
    }

    if(cnt >= 3){
        cout << "Yes" << endl;
        return 0;
    }

    cnt = 0;
    key = N[3];
    //後方から捜査
    for(size_t i = 3; i >= 0; i--){
        if(N[i] == key){
            cnt++;
        } else {
            break;
        }
    }

    if(cnt >= 3){
        cout << "Yes" << endl;
        return 0;
    }
    
    cout << "No" << endl;
}

Measured memory_bytes: 256
from collections import deque

n,m=map(int,input().split())
graph=[[] for _ in range(n+1)]

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

ans=[-1]*(n+1)
ans[0]=0
ans[1]=0

d=deque()
d.append(1)

while d:
    v=d.popleft()
    for i in graph[v]:
        if ans[i]!=-1:
            continue
        ans[i]=v
        d.append(i)

ans=ans[2:]
print("Yes")
print(*ans,sep="\n")

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

using std::cin;
using std::cout;
using std::endl;

// Range Update, Range Sum
template<class T>
struct lazy_segment_tree{
  std::vector<T> data;
  std::vector<T> lazy;
  int n;
  T identity1,identity2;
  lazy_segment_tree(){}
  lazy_segment_tree(int sz,T ide1,T ide2):identity1(ide1),identity2(ide2){
    n = 1;
    while(n<sz)n<<=1;
    data.resize(2*n-1,identity1);
    lazy.resize(2*n-1,identity2);
  }
  lazy_segment_tree(std::vector<T> const& vec,T ide1,T ide2):identity1(ide1),identity2(ide2){
    int sz = vec.size();
    n = 1;
    while(n<sz)n<<=1;
    data.resize(2*n-1,identity1);
    lazy.resize(2*n-1,identity2);
    for(int i=0;i<sz;++i){
      data[i+n-1] = vec[i];
    }
    for(int i=sz-2;i>=0;--i){
      data[i] = data[i*2+1] + data[i*2+2];
    }
  }
  void eval(int k){
    if(lazy[k]==identity2)return;
    if(k<n-1){
      lazy[2*k+1] = lazy[k]/2;
      lazy[2*k+2] = lazy[k]/2;
    }
    data[k] = lazy[k];
    lazy[k] = identity2;
  }
  void update_impl(int a,int b,T x,int k,int l,int r){
    eval(k);
    if(a<=l && r<=b){
      lazy[k] = x*(r-l);
      eval(k);
    }
    else if(a<r && l<b){
      update_impl(a,b,x,2*k+1,l,(l+r)/2);
      update_impl(a,b,x,2*k+2,(l+r)/2,r);
      data[k] = data[2*k+1] + data[2*k+2];
    }
  }
  T query_impl(int a,int b,int k,int l,int r){
    eval(k);
    if(r<=a||b<=l){
      return identity1;
    }
    else if(a<=l && r<=b){
      return data[k];
    }
    else{
      T vl = query_impl(a,b,2*k+1,l,(l+r)/2);
      T vr = query_impl(a,b,2*k+2,(l+r)/2,r);
      return vl + vr;
    }
  }
  void update(int a,int b,T x){
    update_impl(a,b,x,0,0,n);
  }
  T query(int a,int b){
    T res = query_impl(a,b,0,0,n);
    return res;
  }
  T operator[](int i){
    return query(i,i+1);
  }
  void dump(){
    int cnt = 1;
    int now = 0;
    for(int i=0;i<2*n-1;++i){
      eval(i);
      cout<<data[i];
      now++;
      if(cnt==now){
        cout<<endl;
        cnt*=2;
        now=0;
      }else cout<<" ";
    }
  }
};

signed main(){
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int N;cin>>N;
  lazy_segment_tree<int> data(N,0,1001);
  int Q;cin>>Q;
  while(Q--){
    int c;cin>>c;
    if(c==0){
      int s,t,x;cin>>s>>t>>x;
      data.update(s,t+1,x);
    }else{
      int s,t;cin>>s>>t;
      cout<< data.query(s,t+1) <<endl;
    }
    //data.dump();
  }
}


Measured memory_bytes: 4856
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    lint n, a, b;
    cin >> n >> a >> b;
    lint ans;
    if (n == 1) {
        ans = a == b ? 1 : 0;
    } else {
        if (a > b) {
            ans = 0;
        } else if (a == b) {
            ans = 1;
        } else {
            ans = a + (n - 1) * b - (a * (n - 1) + b) + 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
#include <numeric>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back


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

    char a;
    cin >> a;

    if (isupper(a)) cout << 'A' << endl;
    else cout << 'a' << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include<stdlib.h>
#include<cmath>
#include<list>
#define ll long long int
#define lll unsigned long long
using namespace std;
int a[26][5001],c[26]={0};
char b[5005];
int main()
{
int s,k=0,q,n,z=0,k1=0;
scanf("%d",&n);
scanf("%s",b);
while(k<n)
{
    a[b[k]-'a'][c[b[k]-'a']]=k;
    c[b[k]-'a']++;
    k++;
}
k=0;
while(k<n)
{
    k1=0,q=0;
    while(a[b[k]-'a'][k1]<=k&&k1<c[b[k]-'a'])
    {
        k1++;
    }
    while(k1<c[b[k]-'a'])
    {
        q=0;s=a[b[k]-'a'][k1];
        if(k!=0&&b[k-1]==b[s-1])
        {
            k1++;continue;
        }
        while(b[k+q]==b[s+q]&&k+q<s)
        {
            q++;
        }
        if(q>z)
        {
            z=q;
        }
        k1++;
    }
    k++;
}
printf("%d\n",z);
return 0;
}


Measured memory_bytes: 384
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

a, b = map(int, input().split())
ans = []
ans.append(a + b)
ans.append(a - b)
ans.append(a * b)
print(max(ans))

Measured memory_bytes: 5052
n,k = map(int,input().split())
x = list(map(int,input().split()))

ans = 10**9
for i in range(n-k+1) :
  xs = abs(x[i+k-1]-x[i])
  ans = min(ans,xs+abs(x[i]),xs+abs(x[i+k-1]))
  
print(ans)

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

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    int sum = a + b + c;
    if( 22 <= sum )
    {
        cout << "bust" << endl;
    }
    else if( 21 >= sum )
    {
        cout << "win" << endl;
    }
    return 0;
}



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

#ifdef _LOCAL_
	#define cout cerr
#endif
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define FORalld(it, a) for (__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
template<class T> inline T isqrt(T k) {T r = sqrt(k) + 1; while (r * r > k) r--; return r;}
template<class T> inline T icbrt(T k) {T r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}

void solve() {
	long long x; cin >> x;
	long long res = x / 11 * 2;
	x %= 11;
	if (x && x <= 6) res++;
	else if (x) res += 2;
	cout << res << "\n";
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}

Measured memory_bytes: 256
use std::io;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line = gets();
    let s = line.trim();
    if s.chars().nth(0) == s.chars().last() {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

int main(int argc, char const *argv[]) {
  char o[51];
  char e[51];
  int i = 0;

  scanf("%s", o);
  scanf("%s", e);

  //while (strncmp(&o[i], "\0", 1) != 0 || strncmp(&e[i], "\0", 1) != 0) {
  while (strncmp(&o[i], "\0", 1) != 0) {
    printf("%c", o[i]);
    if (strncmp(&e[i], "\0", 1) == 0) {
      break;
    }
    else {
      printf("%c", e[i]);
    }
    i++;
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

class Main {

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

    void compute() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        for (int i = 1; i <= B; i++) {
            if ((A * i - C) % B == 0) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
using namespace std;

int main(){
   long long n,m,d;
   cin >> n >> m>>d;
   long long len = n-2*d; 
   long long rest = 2*d;
   if( len < 0 || d == 0){
      len = 0;
      rest = n;
   }
   double ans = 0;
   ans = (m-1)*(len * 2.0+ rest)/(n*n);
   cout << setprecision(10) << fixed << ans << endl;

   return 0;
}


Measured memory_bytes: 256
import fractions
from functools import reduce

N, K = [int(i) for i in input().split(' ')]
X = [int(i) for i in input().split(' ')]

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

X.append(K)
diff = []
for i,x in enumerate(X):
    if i != 0:
        diff.append(abs(X[i-1] - x))

print(gcd_list(diff))


Measured memory_bytes: 16304
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set; 

#define     int                 ll
#define     pb                  push_back
#define     mp                  make_pair
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     init(x, a)          memset(x, a, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     cpy(a,b)            memcpy(a,b,sizeof(b))
#define     is(a)               to_string(a)
#define     ci(a,c)             a-c
#define     debug(i)            cout<<"point :"<<i<<'\n';
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
    int x,y,z; cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    cout<<x<<' '<<y<<' '<<z<<'\n';
}

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

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

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

  int n;
  cin >> n;
  vector<vector<int>> g(n);
  vector<vector<int>> x(3);
  for (int i = 1; i <= n; i++) {
    x[i % 3].push_back(i);
  }
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> col(n, -1);
  queue<int> que;
  col[0] = 0;
  que.push(0);
  while (!que.empty()) {
    int cur = que.front();
    que.pop();
    for (auto nxt : g[cur]) {
      if (col[nxt] != -1) continue;
      col[nxt] = 1 - col[cur];
      que.push(nxt);
    }
  }
  vector<int> bl, wh;
  for (int i = 0; i < n; i++) {
    if (col[i])
      bl.push_back(i);
    else
      wh.push_back(i);
  }
  vector<int> ret(n, -1);
  if (bl.size() >= x[1].size() + x[2].size()) {
    while (x[1].size()) {
      ret[bl.back()] = x[1].back();
      bl.pop_back();
      x[1].pop_back();
    }
    while (x[2].size()) {
      ret[bl.back()] = x[2].back();
      bl.pop_back();
      x[2].pop_back();
    }
  } else if (wh.size() >= x[1].size() + x[2].size()) {
    while (x[1].size()) {
      ret[wh.back()] = x[1].back();
      wh.pop_back();
      x[1].pop_back();
    }
    while (x[2].size()) {
      ret[wh.back()] = x[2].back();
      wh.pop_back();
      x[2].pop_back();
    }
  } else {
    if (wh.size() >= x[1].size() && bl.size() >= x[2].size()) {
      while (x[1].size()) {
        ret[wh.back()] = x[1].back();
        wh.pop_back();
        x[1].pop_back();
      }
      while (x[2].size()) {
        ret[bl.back()] = x[2].back();
        bl.pop_back();
        x[2].pop_back();
      }
    } else if (wh.size() >= x[2].size() && bl.size() >= x[1].size()) {
      while (x[1].size()) {
        ret[bl.back()] = x[1].back();
        bl.pop_back();
        x[1].pop_back();
      }
      while (x[2].size()) {
        ret[wh.back()] = x[2].back();
        wh.pop_back();
        x[2].pop_back();
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (ret[i] == -1) {
      ret[i] = x[0].back();
      x[0].pop_back();
    }
  }
  printv(ret);
}


Measured memory_bytes: 17640
import math
n,k = map(int, input().split())

x = 0
ans = 0
for i in range(1,n+1):
    if i>=k:
        ans += 1/n
    else:
        x = math.ceil(math.log2(k/i))
        if x>0:
            ans += (1/n)*(1/2)**x
print(ans)


Measured memory_bytes: 3060
#include<stdio.h>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;
int ijk[11][11][800];
int v[11][11][800];
int c[12][12];
struct wolf{
	int t[6];
	wolf(){
		for(int i=0;i<6;i++)t[i]=i;
	}
};
inline bool operator<(const wolf&a,const wolf&b){
	for(int i=0;i<6;i++)if(a.t[i]!=b.t[i])return a.t[i]<b.t[i];
	return false;
}
map<wolf,int>m;
vector<wolf>rev;
void rN(wolf &a){int tmp=a.t[0];a.t[0]=a.t[1];a.t[1]=a.t[5];a.t[5]=a.t[4];a.t[4]=tmp;}
void rS(wolf &a){int tmp=a.t[0];a.t[0]=a.t[4];a.t[4]=a.t[5];a.t[5]=a.t[1];a.t[1]=tmp;}
void rE(wolf &a){int tmp=a.t[0];a.t[0]=a.t[3];a.t[3]=a.t[5];a.t[5]=a.t[2];a.t[2]=tmp;}
void rW(wolf &a){int tmp=a.t[0];a.t[0]=a.t[2];a.t[2]=a.t[5];a.t[5]=a.t[3];a.t[3]=tmp;}
int main(){
	int a,b;
	wolf test;
	int sz=0;
	do{
		rev.push_back(test);
		m[test]=sz++;
	}while(next_permutation(test.t,test.t+6));
	while(scanf("%d%d",&a,&b),a){
		for(int i=0;i<a;i++)for(int j=0;j<b;j++)scanf("%d",&c[i][j]);
		for(int i=0;i<a;i++)for(int j=0;j<b;j++)for(int k=0;k<sz;k++){
			ijk[i][j][k]=999999999;v[i][j][k]=0;
		}
		int sr,sc,gr,gc;scanf("%d%d%d%d",&sr,&sc,&gr,&gc);
		ijk[sr][sc][0]=0;
		priority_queue<pair<pair<int,int>,pair<int,int> > >Q;
		Q.push(make_pair(make_pair(0,0),make_pair(sr,sc)));
		while(Q.size()){
			int cost=-Q.top().first.first;
			int st=Q.top().first.second;
			wolf now=rev[st];
			int row=Q.top().second.first;
			int col=Q.top().second.second;
			Q.pop();
			if(v[row][col][st])continue;
			v[row][col][st]=1;
			int to;
			rN(now);to=m[now];
			if(row&&!v[row-1][col][to]&&ijk[row-1][col][to]>cost+(now.t[5]+1)*c[row-1][col]){
				ijk[row-1][col][to]=cost+(now.t[5]+1)*c[row-1][col];
				Q.push(make_pair(make_pair(-ijk[row-1][col][to],to),make_pair(row-1,col)));
			}rS(now);
			rS(now);to=m[now];
			if(row<a-1&&!v[row+1][col][to]&&ijk[row+1][col][to]>cost+(now.t[5]+1)*c[row+1][col]){
				ijk[row+1][col][to]=cost+(now.t[5]+1)*c[row+1][col];
				Q.push(make_pair(make_pair(-ijk[row+1][col][to],to),make_pair(row+1,col)));
			}rN(now);
			rW(now);to=m[now];
			if(col&&!v[row][col-1][to]&&ijk[row][col-1][to]>cost+(now.t[5]+1)*c[row][col-1]){
				ijk[row][col-1][to]=cost+(now.t[5]+1)*c[row][col-1];
				Q.push(make_pair(make_pair(-ijk[row][col-1][to],to),make_pair(row,col-1)));
			}rE(now);
			rE(now);to=m[now];
			if(col<b-1&&!v[row][col+1][to]&&ijk[row][col+1][to]>cost+(now.t[5]+1)*c[row][col+1]){
				ijk[row][col+1][to]=cost+(now.t[5]+1)*c[row][col+1];
				Q.push(make_pair(make_pair(-ijk[row][col+1][to],to),make_pair(row,col+1)));
			}rW(now);
		}
		int ret=99999999;
		for(int i=0;i<sz;i++)ret=min(ret,ijk[gr][gc][i]);
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 1812
Q = 10**9+7

def getInv(N):
    inv = [0] * (N + 1)
    inv[1] = 1
    for i in range(2, N + 1):
        inv[i] = (-(Q // i) * inv[Q % i]) % Q
    return inv

def main():

    n, a, b = map( int, input().split())
    Inv = getInv(2*10**5)
    def cmb(n,r):
        ret = 1
        for i in range(r):
            ret *= n-i
            ret %= Q
            ret *= Inv[i+1]
            ret %= Q
        return ret
    print( (pow(2,n,Q) - cmb(n,a) - cmb(n,b)-1)%Q)
if __name__ == '__main__':
    main()

Measured memory_bytes: 10868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    int n,k;
    cin>>n>>k;
    ll sum=0;
    ll maxsum=0;
    vector<int> p(n);
    rep(i,n){
        cin>>p[i];
    }
    rep(i,k){
        sum+=p[i];
    }
    maxsum=sum;
    for(int i=k;i<n;i++){
        sum=sum+p[i]-p[i-k];
        maxsum=max(maxsum,sum);
    }
    cout<<fixed;
    cout<<setprecision(6)<<(maxsum+k)/2.0<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int m, n;
    cin >> m >> n;

    int ret = 0;
    for(int i=0; i<m; ++i){
        int num = 0;
        for(int j=0; j<n; ++j){
            int a;
            cin >> a;
            num += a;
        }
        ret = max(ret, num);
    }

    cout << ret << endl;

    return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    cout << max(max(a+b,a-b),a*b) << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number = Integer.parseInt(sc.next());
    double x = (number % 2 == 1)? number / 2 + 1 : number / 2;
    System.out.println(x / number);
  }
}


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

using namespace std;

using ll = long long;

template<int MOD>
struct ModInt {
   using Mint = ModInt;
   int val;
   ModInt(ll __val = 0) { fix(__val % MOD + MOD); }
   Mint& fix(int __val) { val = __val; if (val >= MOD) val -= MOD; return *this; }
   explicit operator int() { return val; }
   Mint operator + (const Mint &mt) const { return Mint().fix(val + mt.val); }
   Mint operator - (const Mint &mt) const { return Mint().fix(val - mt.val + MOD); }
   Mint operator * (const Mint &mt) const { return Mint().fix(ll(val) * mt.val % MOD + MOD); }
   Mint& operator += (const Mint &mt) { return *this = *this + mt; }
   Mint& operator -= (const Mint &mt) { return *this = *this - mt; }
   Mint& operator *= (const Mint &mt) { return *this = *this * mt; }
   Mint pow(int y) const {
      Mint x = *this;
      Mint ans(1);
      for (; y > 0; y >>= 1, x *= x) {
         if (y & 1) ans *= x;
      }
      return ans;
   }
   Mint operator -() const { return Mint().fix(MOD - val); }
   Mint inv() const { return pow(MOD - 2); }
   Mint operator / (const Mint &mt) const { return *this * mt.inv(); }
   Mint& operator /= (const Mint &mt) const { return *this / mt; }
   friend ostream& operator<<(ostream& os, const Mint& mt) { return os << mt.val; }
};

using Mint = ModInt<1000000007>;

int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   int N, A, B;
   cin >> N >> A >> B;
   if (A > B) swap(A, B);
   vector<array<Mint, 2>> ways(B + 1);
   ways[0][0] = 1;
   ways[0][1] = 1;
   for (int b = 1; b <= B; ++b) {
      for (int i = 1; i <= b; ++i) ways[b][1] += ways[b - i][0];
      for (int a = A; a <= b; ++a) ways[b][0] += ways[b - a][1];
   }
   vector<Mint> tot(B + 1);
   for (int i = 1; i <= B; ++i) tot[i] = ways[i][0] + ways[i][1];
   tot[0] = 1;
   Mint ans = Mint(2).pow(N);
   vector<array<Mint, 2>> dp(N + 1);
   for (int n = 1; n < N; ++n) {
      if (n < A) dp[n][0] += 1;
      for (int i = 1; i < min(n, A); ++i) dp[n][0] += dp[n - i][1];
      if (n < B) dp[n][1] += tot[n - 1];
      for (int i = 1; i < min(n, B); ++i) {
         Mint g = (i == 1) ? Mint(1) : tot[i - 2];
         dp[n][1] += dp[n - i][0] * g;
      }
      if (N - n < B) ans -= dp[n][0] * tot[N - n - 1];
      if (N - n < A) ans -= dp[n][1];
   }
   cout << ans << "\n";
   return 0;
}


Measured memory_bytes: 3752
n = int(input())
t = list(map(int, input().split()))
m = int(input())
px = [list(map(int, input().split())) for _ in range(m)]

for i in range(m):
    ans = [0]*n
    for j in range(n):
        ans[j] = t[j]
    p = px[i][0] - 1
    ans[p] = px[i][1]
    print(sum(ans))

Measured memory_bytes: 3064
N,K,Q = map(int, input().split())
A_list = [int(input()) for i in range(Q)]
score_list = [0] * N

for a in A_list:
    score_list[a-1] += 1

for n in range(N):
    score_list[n] = K - Q + score_list[n]
    print("Yes" if score_list[n] > 0 else "No")
    


Measured memory_bytes: 11776
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    int count = 0;
    cin >> a >> b;
    for(int i=a;i<=b;i++){
        if(i/10000 == i%10 && ((i/1000)%10) == ((i/10)%10)){
            count ++;
            //cout << i <<endl;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int n,mi=10000000,ma=-10000000;
    long long sum=0;
  cin >> n;
  int i,b;
  for(i=0;i<n;i++){
    cin >> b;
    mi=min(mi,b);
    ma=max(ma,b);
    sum+=b;
  }
  cout << mi <<  " " << ma << " " << sum << endl;
  return 0;
}






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

int main(){
  int N, X; 
  cin >> N >> X;
  int total=0;
  int count=0;
  int L;
  while(total<=X){
    cin>>L;
    total=total+L;
    count++;
  }
  if(count>N+1){
    cout<<N+1<<endl;
    return 0;
  }
  cout<<count<<endl;

  return 0;
}

  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    vector<string> j{"AC","WA","TLE","RE"};
    int N; cin >> N;
    vector<int> ans(4);
    REP(_,N) {
        string s; cin >> s;
        REP(i,4) {
            if (s == j[i]) {
                ans[i]++;
                break;
            }
        }
    }

    REP(i,4) {
        cout << j[i] << " x " << ans[i] << '\n';
    }

    return 0;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <cctype>
#include <complex>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

class Item {
   public:
    int a;
    int b;
    int c;
    Item() {}
    Item(int a, int b, int c) : a(a), b(b), c(c) {}
};

const int INF = 1e9;

int main(void) {
    int n, ma, mb;
    cin >> n >> ma >> mb;

    vector<Item> items(n);
    for (int i = 0; i < n; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        items[i] = Item(a, b, c);
    }

    vector<vector<vector<int>>> dp(
        401, vector<vector<int>>(401, vector<int>(n + 1, INF)));

    fill(dp[0][0].begin(), dp[0][0].end(), 0);

    for (int i = 1; i <= 400; i++) {
        for (int j = 1; j <= 400; j++) {
            for (int k = 1; k <= n; k++) {
                dp[i][j][k] = dp[i][j][k - 1];
                int rest_a = i - items[k - 1].a;
                int rest_b = j - items[k - 1].b;
                if (rest_a >= 0 && rest_b >= 0) {
                    dp[i][j][k] =
                        min(dp[i][j][k],
                            items[k - 1].c + dp[rest_a][rest_b][k - 1]);
                }
            }
        }
    }

    int ans = INF;
    for (int i = 1; i * ma <= 400 && i * mb <= 400; i++) {
        ans = min(ans, dp[i * ma][i * mb][n]);
    }
    cout << (ans == INF ? -1 : ans) << endl;

    return 0;
}


Measured memory_bytes: 31744
#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++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};


ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return b/gcd(a,b)*b;}

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

  double W, H, x, y;
  cin >> W >> H >> x >> y;
  // 桁数と変数名を指定
  //cout << fixed << setprecision(6) << ans << endl;
  cout << fixed << setprecision(10) << W*H/2 << " " << (2*x == W && 2*y == H) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>


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; }

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
constexpr long long mod = 998244353LL;

using namespace std;
typedef long long ll;


ll f(ll a, ll b) {
    return max(a, b);
}
template< typename Monoid >
struct SegmentTree {

    int sz;
    vector< Monoid > seg;
    const Monoid M1;

    SegmentTree(int n, const Monoid& M1) : M1(M1) {
        sz = 1;
        while (sz < n) sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid& x) {
        seg[k + sz] = x;
    }

    void build() {
        for (int k = sz - 1; k > 0; k--) {
            seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
        }
    }

    void update(int k, const Monoid& x) {
        k += sz;
        seg[k] = x;
        while (k >>= 1) {
            seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
        }
    }

    Monoid query(int a, int b) {
        Monoid L = M1, R = M1;
        if (a >= b) return M1;
        for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
            if (a & 1) L = f(L, seg[a++]);
            if (b & 1) R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int& k) const {
        return seg[k + sz];
    }

};

int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	ll H, W, M; cin >> H >> W >> M;
    SegmentTree<ll> seg(W, 0);
    vector<pair<ll, ll>> vp(M);
    vector<vector<ll>> g(H);
    vector<ll> cnt(W);
    for (int i = 0; i < M; i++) {
        cin >> vp[i].first >> vp[i].second;
        vp[i].first--;
        vp[i].second--;
        g[vp[i].first].emplace_back(vp[i].second);
        cnt[vp[i].second]++;
    }
    for (int i = 0; i < W; i++) seg.set(i, cnt[i]);
    seg.build();
    sort(vp.begin(), vp.end());
    ll res = 0;
    for (int i = 0; i < H; i++) {
        ll ans = g[i].size();
        for (auto e : g[i]) {
            ll t = seg[e];
            t--;
            seg.update(e, t);
        }
        ans += seg.query(0, W);
        chmax(res, ans);
        for (auto e : g[i]) {
            ll t = seg[e];
            t++;
            seg.update(e, t);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 34852
using System;
using System.Text;
using System.Collections.Generic;

namespace cskyopro {
    class Solver : Reader {
        public void Solve() {
            int K = NextInt();
            int N = NextInt();
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = NextInt();
            }
            int ans = A[N - 1] - A[0];
            for (int i = 1; i < N; i++) {
                int cand = (A[(i + N - 1) % N] + K) - A[i];
                ans = Math.Min(ans, cand);
            }
            Console.WriteLine(ans);
        }
    }

    class Mint {
        const long MOD = 1000000007;
        private long n;

        public Mint(long n) {
            this.n = n;
        }

        public static Mint operator +(Mint a, Mint b) => new Mint((a.n + b.n) % 5);
        public static Mint operator -(Mint a, Mint b) => new Mint((a.n + 5 - b.n) % 5L);
        public static Mint operator *(Mint a, Mint b) => new Mint((a.n * b.n) % 5);
        public static implicit operator Mint(int n) => new Mint(n);

        public override string ToString() => n.ToString();
    }

    class Reader {
        public string Next() {
            StringBuilder sb = new StringBuilder();
            while (true) {
                int x = Console.Read();
                if (x == -1 || x == ' ' || x == '\n') break;
                sb.Append((char)x);
            }
            return sb.ToString();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
    }

    class Program {
        static void Main(string[] args) => new Solver().Solve();
    }
}


Measured memory_bytes: 17760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    long long N,A,B,C,D,E;
    cin >> N >> A >> B >> C >> D >> E;
    long long x=min(min(min(min(A,B),C),D),E);
    long long ans=(N+x-1)/x;
    ans+=4;
    cout << ans << endl;



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  string n;
  cin >> n;
  int ans = 0;
  srep(k,-1,sz(n)) {
    if(k+1<sz(n) && n[k+1]=='0') continue;
    int a = 0;
    rep(i,k+1) {
      a += n[i]-'0';
    }
    if(k+1<sz(n)) {
      a += n[k+1]-'1';
    }
    srep(i,k+2,sz(n)) {
      a += 9;
    }
    ans = max(ans,a);
  }
  cout << ans << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lowbit(i) ((i)&(-i))
#define lson(i) ((i)<<1)
#define rson(i) ((i)<<1|1)
#define ft first
#define se second
#define MAXN 100007
using namespace std;

typedef long long ll;typedef unsigned long long ul;
typedef pair<int,int> pii;typedef pair<ll,ll> pll;
typedef vector<string> vss;
typedef vector<int> vii;typedef vector<pii> vpi;
typedef queue<int> qii;typedef queue<pii> qpi;

const int inf=2e9+7;

struct edge{
	ll x,y,val;
	edge(int _x,int _y,int _val){x=_x,y=_y,val=_val;}
};

vector<edge> v;

struct node{
	int x,y,num;
}dot1[MAXN],dot2[MAXN];

bool cmp1(node x,node y){
	return x.x<y.x;
}

bool cmp2(node x,node y){
	return x.y<y.y;
}

bool comp(edge x,edge y){
	return x.val<y.val;
}

int n,fa[MAXN];
ll res;

int find(int x){
	if(fa[x]==x) return x;
	return fa[x]=find(fa[x]);
}

void merge(int x,int y){
	int fx=find(x),fy=find(y);
	if(fx!=fy)
		fa[fx]=y;
}

int main()
{
// 	freopen("","r",stdin);
// 	freopen("","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&dot1[i].x,&dot1[i].y);
		dot2[i].x=dot1[i].x;dot2[i].y=dot1[i].y;
		dot2[i].num=dot1[i].num=i;
	}
	
	//建边(删除无用边) 
	sort(dot1+1,dot1+n+1,cmp1);
	sort(dot2+1,dot2+n+1,cmp2);
//	for(int i=1;i<=n;i++){
//		printf("num %d:(%d,%d)\n",i,dot1[i].x,dot1[i].y);
//	}
	for(int i=2;i<=n;i++){
		v.push_back( edge(dot1[i-1].num,dot1[i].num,dot1[i].x-dot1[i-1].x) );
		v.push_back( edge(dot2[i-1].num,dot2[i].num,dot2[i].y-dot2[i-1].y) );
	}
	sort(v.begin(),v.end(),comp);
	
	//初始化 
	for(int i=1;i<=n;i++)
		fa[i]=i;

//	for(int i=0;i<v.size();i++){
//		printf("(%d,%d) dis=%d\n",v[i].x,v[i].y,v[i].val);
//	}
	//Kruscal
	for(int i=0;i<v.size();i++){
		if(find(v[i].x)!=find(v[i].y)){
			merge(v[i].x,v[i].y);
			res+=v[i].val;
		}
	}
	printf("%lld\n",res);
	return 0;
}


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

using namespace std;

int main() {
  string s;
  cin >> s;
  int n = s.length();
  int ans = 0;
  for (auto i = 0; i < n / 2; ++i) {
    if (s[i] != s[n - i - 1]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
//周♂雨扬是最强的！！！
//大佬祝您AK
//沈哲♂贝是最强的！！！
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<fstream>
using namespace std;
//ifstream fin(.in);
//ofstream fout(.out);
long long n,num[400003];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>num[i];
		num[i]=num[i]+num[i-1];
	}
	long long ans=999999999999;
	for(int i=2;i<=n;i++){
		ans=min(ans,abs(num[n]-num[i-1]-num[i-1]));
	}
	cout<<ans<<endl;
	return 0;
}
//沈♂哲贝是最强的！！！
//大佬祝您AK
//周♂雨扬是最强的！！！

Measured memory_bytes: 1920
a,b,c,x,y = map(int,input().split())
if x >= y:
    print(min(c*2*y+a*(x-y), a*x+b*y, c*2*x))
else:
    print(min(c*2*x+b*(y-x),a*x+b*y, c*2*y))



Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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; }

int main() {
  int a;
  cin>>a;
  int ans = a;
  ans += a*a;
  ans += a*a*a;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3588