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

using namespace std;

int main() {
    int n;
    cin >> n;
    /*
     * 4x + 7y = n
     */
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if(4 * i + 7 * j == n)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


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

using namespace std;

int main()
{
	long long N,A,B;
	scanf("%lld%lld%lld",&N,&A,&B);
	long long as = 0;
	if((B - A) % 2 == 0) printf("%lld\n",(B - A) / 2);
	else
	{
		long long w1 = A;
		long long tmp = B;
		B -= A;
		w1 += (B - 1) / 2;
		B = tmp;
		long long w2 = N - B + 1;
		A += w2;
		w2 += (N - A) / 2;
		printf("%lld\n",min(w1,w2));
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
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 main() {
    ll N; cin >> N;

    double ans = 1;
    reps(i, N) {
        foreps(j, 2, N + 1) {
            if (pow(i, j) <= N) {
                ans = max(ans, pow(i, j));
            }
        }
    }
    cout << ans << endl;
}

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

int main(){
    int L;
    cin >> L;
    double T;
    if(L%3==0)
    {T=L*L*L/27;}
    if(L%3==1)
    {T=((L-1)/3+0.33333333333333)*((L-1)/3+0.333333333333333)*((L-1)/3+0.333333333333);}
    if(L%3==2)
    {T=((L-2)/3+0.6666666666666)*((L-2)/3+0.66666666666666)*((L-2)/3+0.66666666666666);}
    printf("%f\n",T);
}

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

using namespace std;

int main(){
        int n;
        cin >> n;
        switch(n){
                case 25: cout << "Christmas"; break;
                case 24: cout << "Christmas Eve"; break;
                case 23: cout << "Christmas Eve Eve"; break;
                case 22: cout << "Christmas Eve Eve Eve"; break;
                default : cout << ""; break;
        }
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.Map;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStream;

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

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();

            Map<Integer, Integer> occurences = new HashMap<>();

            for (int i = 0; i < n; i++) {
                int a = in.nextInt();

                occurences.merge(a, 1, (x, y) -> x + y);
            }

            List<Integer> amounts = new ArrayList<>(occurences.values());

            if (amounts.size() <= k) {
                out.println(0);
            } else {
                Collections.sort(amounts);

                int needed = amounts.size() - k;
                int total = 0;

                for (int i = 0; i < needed; i++) {
                    total += amounts.get(i);
                }

                out.println(total);
            }
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 56460
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
/*

*/
int main()
{
    int a,b;
    cin >> a >> b;
    if( a > b){
        cout << "safe" << endl;
    }else{
        cout << "unsafe" << endl;
    }

    return 0;
}

Measured memory_bytes: 3104
/*
    CP Submission
*/

#include<bits/stdc++.h>

using namespace std;

/* Shortcuts */
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define val(x) cout << #x << ": " << (x) << endl;
#define log(x) cout << (x) << endl;
#define ss second.second
#define se second
#define fi first
#define sf second.first
#define sz(x) (int)(x.size())

/* typedefs */
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <char> vc;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <string,string> mss;

bool resolved[100000];

bool comp(pair<int, pair<int, bool>> a,pair<int, pair<int, bool>> b){
    return a.first < b.first;
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    vector<pair<int, pair<int, bool>>> mark;

    int n, m; cin>>n>>m;
    int a, b;
    for(int i = 0; i < m; i++){
        cin>>a>>b;
        mark.pb(mp(a, mp(i, 1)));
        mark.pb(mp(b, mp(i, 0)));
    }

    // mark:
    // .first = island number
    // .second.first = conflict index
    // .second.second = 1 is start || 0 is end

    sort(all(mark), comp);

    int cnt = 0;
    vii active;
    for(int i = 0; i < sz(mark); i++){
        if(mark[i].ss){
            // start
            active.pb(mp(mark[i].fi, mark[i].sf));
        } else {
            // end
            if(resolved[mark[i].sf]) continue;
            cnt++;
            for(int j = 0; j < sz(active); j++){
                if(active[j].fi != mark[i].fi){ // not on the same island
                    resolved[active[j].se] = 1;
                    active.erase(active.begin() + j);
                    j--;
                }
            }
        }
    }
    log(cnt);


    return 0;
}


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

typedef long long ll;
#define int         ll
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<long long> vll;
typedef vector<vll> vlll;

const int           mod = 1e9 + 7;
#define pb          push_back
#define test        int t; cin >> t; while(t--)
#define debug1(x)    cout << '>' << #x << ':' << x << "\n";
#define endl        '\n'
#define off         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define max(a,b)   (a>b?a:b)
#define min(a,b)   (a<b?a:b)


template <typename Arg1>
void pr(Arg1&& arg1) {cout << arg1 << endl;}
template <typename Arg1, typename... Args>
void pr(Arg1&& arg1, Args&&... args)
{
  cout << arg1 << " ";
  pr(args...);
}

template <typename Arg1> void rd(Arg1& arg1) {cin >> arg1;}
template <typename Arg1, typename... Args>
void rd(Arg1& arg1, Args&... args)
{
  cin >> arg1;
  rd(args...);
}


template <typename T1, typename T2>
ostream& operator<< (ostream& out, const pair<T1, T2>& p) {
  out << p.first << " " << p.second;
  return out;
}

template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  for (T i : v) {
    out << i<<" ";
  }
  return out;
}
#define debug(...) deb(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void deb(const char* name, Arg1&& arg1) {cout << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void deb(const char* names, Arg1&& arg1, Args&&... args)
{
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " = " << arg1;
  deb(comma, args...);
}





int32_t main() {

  off;
    
  int n;
  cin>>n;
  vi ans(n,INT_MAX);
  vi tm(n-1);
  for (int i = 0; i < n-1; ++i){
          cin>>tm[i];
  }

  for (int i = n-2; i >=0; --i){
          ans[i]=tm[i];
          ans[i+1]=min(ans[i+1],tm[i]);
  }
  int pr=0;
  for (int i = 0; i < n; ++i){
        // cout<<ans[i]<<" ";
         pr+=ans[i]; 
  }
  // cout<<endl;
  cout<<pr;



  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
long long gcd(long x,long y){
    if(y==0)return x;

    return gcd(y,x%y);
}
long long lcm(long x,long y){
    return x*y/gcd(x,y);
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main()
{
    int N,K,h[100010]={},ans=INT_MAX;
    cin>>N>>K;
    for(int i=0;i<N;i++){
        cin>>h[i];
    }

    sort(h,h+N);

    for(int i=0;i<=(N-K);i++){
        int temp=h[i+K-1]-h[i];

        if(ans>temp)ans=temp;
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MAX_N = 1 << 17;
int n,dat[2*MAX_N-1];
void init(int n_){
  n=1;
  while(n<n_) n*=2;
  for(int i=0;i<2*n-1;i++) dat[i]=0;
}
void update(int k,int a){
  k+=n-1;
  dat[k]=a;
  while(k>0){
    k=(k-1)/2;
    dat[k]=max(dat[k*2+1],dat[k*2+2]);
  }
}
// find(a,b,0,0,n);
int query(int a,int b,int k,int l,int r){
  if(r<=a||b<=l) return 0;
  if(a<=l&&r<=b) return dat[k];
  else{
    int vl=query(a,b,k*2+1,l,(l+r)/2);
    int vr=query(a,b,k*2+2,(l+r)/2,r);
    return max(vl,vr);
  }
}
signed main(){
  int m;
  cin>>m;
  int dp[m+1];
  memset(dp,0,sizeof(dp));
  init(m+1);
  int ans=0;
  for(int i=0;i<m;i++){
    int x;
    cin>>x;
    dp[x]=query(0,x,0,0,n)+x;
    //cout<<x<<":"<<dp[x]<<endl;
    ans=max(ans,dp[x]);
    update(x,dp[x]);
  }
  cout<<m*(m+1)/2-ans<<endl;
  return 0;
}

Measured memory_bytes: 5924
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[500][500];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n+1];
    ll pre[n+1];
    pre[0]=0;
    for(ll i=1;i<=n;i++)
    {
        cin>>a[i];
        pre[i]=pre[i-1]+a[i];
        //dp[i][i]=a[i];
    }
    for(ll len=2;len<=n;len++)
    {
        for(ll l=1;l<=n-len+1;l++)
        {
            ll r=l+len-1;
            dp[l][r]=1e18;
            for(ll m=l;m<r;m++)
            {
                dp[l][r]=min(dp[l][r],dp[l][m]+dp[m+1][r]);
            }
            //cout<<l<<" "<<r<<" "<<dp[l][r]<<endl;
            dp[l][r]+=pre[r]-pre[l-1];
            //cout<<l<<" "<<r<<" "<<dp[l][r]<<endl;
        }
    }
    cout<<dp[1][n];
}

Measured memory_bytes: 1920
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            list.add(sc.nextInt());
        }
        Collections.sort(list);
        System.out.println(list.get(0) + list.get(1));
    }
}

Measured memory_bytes: 35556
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>
#include <map>

int main() {
  int A, B;
  scanf("%d %d", &A, &B);

  int res = 0;
  for (int i = 1; i < B; i += A-1) ++res;
  printf("%d\n", res);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		str = str.replaceAll("eraser", "-");
		str = str.replaceAll("erase", "-");
		str = str.replaceAll("dreamer", "-");
		str = str.replaceAll("dream", "-");
		
		str = str.replaceAll("-", "");
		
		if(str.length() == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		
	}
}

Measured memory_bytes: 28812
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
   return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
   os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}

ll dp[510][510]={};

signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n;cin>>n;
  V<ll> v(n*n);
  VV<bool> exi(n,V<bool>(n,true));
  rep(i,0,n*n){
    cin>>v[i];
    v[i]--;
  }

  rep(i,0,n)rep(j,0,n){
    dp[i][j]=min({i,n-1-i,j,n-1-j});
  }

  ll ans=0;
  rep(i,0,n*n){
    ll g=v[i]/n,r=v[i]%n;
    exi[g][r]=false;
    ans+=dp[g][r];

    ll mn=dp[g][r];

    queue<int> q;
    rep(j,0,4){
      if(g+dx[j]<0 || g+dx[j]>=n || r+dy[j]<0 || r+dy[j]>=n)continue;

      if(dp[g+dx[j]][r+dy[j]]>mn){
        q.push(g+dx[j]);
        q.push(r+dy[j]);
        q.push(mn);
        dp[g+dx[j]][r+dy[j]]=mn;
      }
    }



    while(q.size()){
      int ng=q.front();q.pop();
      int nr=q.front();q.pop();
      int dis=q.front();q.pop();

      if(exi[ng][nr])dis++;

      rep(j,0,4){
        if(ng+dx[j]<0 || ng+dx[j]>=n || nr+dy[j]<0 || nr+dy[j]>=n)continue;

        if(dp[ng+dx[j]][nr+dy[j]]>dis){
          q.push(ng+dx[j]);
          q.push(nr+dy[j]);
          q.push(dis);
          dp[ng+dx[j]][nr+dy[j]]=dis;
        }
      }
    }

    /*rep(x,0,n){
      rep(y,0,n){
        cout<<dp[x][y];
      }
      cout<<ENDL;
    }*/
  }

  cout<<ans<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 7168
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	lint a,b,n,max=-1;
	cin>>a>>b>>n;
	if(b-1<=n){
		lint mod=n%b;
		lint num=n-mod-1;
		max=floor(a*num*1.0/b)-a*floor(num*1.0/b);
	}else{
		max=floor(a*n*1.0/b)-a*floor(n*1.0/b);
	}
	cout<<max<<endl;
}

Measured memory_bytes: 3760
#include <iostream>
#include <math.h>
#include <iomanip>


using namespace std;

//-------------------------------------------------------------------------------------
/*2点[(x1,y1),(x2,y2)]を入力し二点を通る直線ax+by+cの(a,b,c)を返す,  */
/*x1==x2ならfalseを返す*/
/*falseならばx=cの形の直線*/
void straight_line_passing_through_the_two_points(double x1, double y1, double x2, double y2, double *a, double *b, double *c){
    *a=(y2-y1);
    *b=-(x2-x1);
    *c=y2*(x2-x1)-x2*(y2-y1);
}

//-------------------------------------------------------------------------------------
/*(x,y)を通るa1x+b1y+c1=0に垂直な直線a2x+b2y+c2=0を返す*/
void vertical_straight_line(double x, double y, double a1, double b1, double c1, double *a2, double *b2, double *c2){
    *a2 = -b1;
    *b2 = a1;
    *c2 = b1*x - a1*y;
}


//-------------------------------------------------------------------------------------
/*2直線 a1x+b1y+c1=0 a2x+b2y+c2=0 の交点 (x,y)を返す*/
/*2直線が平行であるならばfalseを返す*/

bool intersection_and_parallel(double a1, double b1, double c1, double a2, double b2, double c2, double *x, double *y){
    if(a1*b2==a2*b1)return false;//平行の判定
    
    *x = (b1*c2-b2*c1)/(a1*b2-a2*b1);
    *y = (a2*c1-a1*c2)/(a1*b2-a2*b1);
    
    return true;
}


//-------------------------------------------------------------------------------------
/*直線ax+by+c=0に対し　(x1,y1)と線対称な位置(x2,y2)を出力*/
void line_symmetry(double a, double b, double c, double x1, double y1, double *x2, double *y2){
    //垂直な直線を求める
    double a2,b2,c2;
    vertical_straight_line(x1, y1, a, b, c, &a2, &b2, &c2);
    
    //垂直な直線との交点を求める
    double c_x, c_y;
    intersection_and_parallel(a, b, c, a2, b2, c2, &c_x, &c_y);
    *x2 = x1 + 2*(c_x-x1);
    *y2 = y1 + 2*(c_y-y1);
}



//-------------------------------------------------------------------------------------
/*2点(x1,y1), (x2,y2) の距離*/
bool distance_between_the_two_pointss(double x1,double y1, double x2, double y2){
    return  sqrt(fabs((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
}





int main(int argc, const char * argv[])
{
    double x1,x2,y1,y2,a,b,c;
    cin>>x1>>y1>>x2>>y2;
    
    straight_line_passing_through_the_two_points(x1, y1, x2, y2, &a, &b, &c);
    
    int q;
    cin>>q;
    for(int i=0; i<q; i++){
        double x,y,a2,b2,c2;
        cin>>x>>y;
        vertical_straight_line(x, y, a, b, c, &a2, &b2, &c2);
        //cout<<a<<b<<c<<endl;
        //cout<<a2<<b2<<c2<<endl;
        double ans_x, ans_y;
        line_symmetry(a,b,c,x,y,&ans_x,&ans_y);
        cout<< fixed << setprecision( 10 ) <<ans_x<<" "<<ans_y<<endl;
    }
    
}

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

int main() {
    int N;
    std::cin >> N;

    int W[N];
    for (int i = 0; i < N; ++i) {
        std::cin >> W[i];
    }

    int min = 100;
    for (int i = 0; i < N; ++i) {
        int s1 = 0, s2 = 0;
        for (int j = 0; j <= i; ++j) {
            s1 += W[j];
        }

        for (int j = i + 1; j < N; ++j) {
            s2 += W[j];
        }

        min = std::min(min, std::abs(s1 - s2));
    }

    std::printf("%d\n", min);

    return 0;
}


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

#define maxn 200010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;

int ans[maxn], arr[maxn];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);   
  string str;
  cin >> str;
  int n = str.length();
  int curr = 0;
  for (int i = 0; i < n; ++i) arr[i] = 1;
  for (int i = 1; i < n; ++i) {
    if (str[i] == 'R') curr = i;
    else {
      int dis = i - curr;
      if (dis & 1) ans[curr + 1] += arr[i];
      else ans[curr] += arr[i];
    }
  }
  int curl = n - 1;
  for (int i = n - 2; i >= 0; --i) {
    if (str[i] == 'L') curl = i;
    else {
      int dis = curl - i;
      if (dis & 1) ans[curl - 1] += arr[i];
      else ans[curl] += arr[i];
    }
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  cout << endl;
}


Measured memory_bytes: 1488
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		String s = "ABCDEF";
		Scanner scanner = new Scanner(System.in);
		String X = scanner.next(), Y = scanner.next();
		int x = s.indexOf(X),y = s.indexOf(Y);
		if(x < y){
			System.out.println("<");
		}else if(x > y){
			System.out.println(">");
		}else{
			System.out.println("=");
		}
	}

}


Measured memory_bytes: 20820
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll A,B,C,D;
    cin >>D>>A>>C>>B;
    ll t,a;
    if(C%A == 0){
        t = C/A;
    }else{
        t = C/A + 1;
    }

    if(D%B == 0){
        a = D/B;
    }else{
        a = D/B + 1;
    }
    
    if(t<=a){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }



    return 0;
    

}

Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
double a,b;
int main(){
	scanf("%lf%lf",&a,&b);
	printf("%.10f\n",a / b);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

ll n,N,h[200010],a[200010],dp[200010];

ll dat[800010]={};

void init(ll n_){
  n=1;
  while(n<n_) n*=2;
  fr(i,2*n-1) dat[i]=0;
}

void ud(ll k,ll c){
  k+=n-1;
  dat[k]=c;
  while(k>0){
    k=(k-1)/2;
    dat[k]=max(dat[2*k+1],dat[2*k+2]);
  }
}

ll mx(ll be,ll en,ll k=0,ll l=0,ll r=n){
  if(r<=be||en<=l) return 0;
  if(be<=l&&r<=en) return dat[k];
  return max(mx(be,en,k*2+1,l,(l+r)/2),mx(be,en,k*2+2,(l+r)/2,r));
}

int main(){
  cin>>n;
  N=n;
  Fr(i,n) cin>>h[i];
  Fr(i,n) cin>>a[i];
  init(n+1);
  Fr(i,N){
    dp[h[i]]=a[i]+mx(0,h[i]);
    ud(h[i],dp[h[i]]);
  }
  ll ans=0;
  Fr(i,N) ans=max(ans,dp[i]);
  cout<<ans<<endl;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 10;
int p[maxn],q[maxn];
int cantor(int *a,int n) {  ///a[]:原数组,下标从1开始
    int ans=0;
    for(int i=1;i<n;i++) {
        int m=1,rk=0;
        for(int j=i+1;j<=n;j++) {
            if(a[j]<a[i])
                rk++;
            m*=(j-i);   ///阶乘
        }
        ans+=rk*m;      ///据公式X = A[0] * (n-1)! + A[1] * (n-2)! + … + A[n-1] * 0!
                        ///A[i] = rk
    }
    return ans+1;       ///ans+1,即为原序列在全排列中的次序
}
int main()
{
  int n;
  cin >> n;
  for(int i = 1;i<=n;++i)
  {
      cin >> p[i];
  }
  for(int i = 1;i<=n;++i)
  {
      cin >>q[i];
  }
  int a = cantor(p,n);
  int b = cantor(q,n);
  cout << abs(b-a) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>

typedef long long ll;

const ll MOD = 1000000007ll;

int N, L;
int X[5000], A[5000];
ll BIT[2][5001];

inline void add(int k, ll v, ll (&bit)[5001]){
    k += 1;
    while(k <= L){
        bit[k] = (bit[k] + v) % MOD;
        k += k & -k;
    }
}

inline ll sum(int k, ll (&bit)[5001]){
    k += 1;
    ll res = 0ll;
    while(k > 0){
        res = (res + bit[k]) % MOD;
        k -= k & -k;
    }
    return res;
}

int main(){
    scanf("%d %d", &N, &L);

    for(int i=0;i<N;i++){
        scanf("%d", X+i);
        X[i] = L-1 - X[i];
    }
    std::reverse(X, X+N);
    
    for(int i=0;i<N;i++){
        scanf("%d", A+i);
    }
    std::reverse(A, A+N);

    if(A[0] == 0){
        add(X[0], 1, BIT[0]);
    }else{
        for(int i=X[0];i>=0;i-=A[0]){
            add(i, 1, BIT[0]);
        }
    }

    int prev = 0, next = 1;
    for(int i=1;i<N;i++){
        memset(BIT[next], 0, sizeof(BIT[next]));

        if(A[i] == 0){
            add(X[i], sum(X[i]-1, BIT[prev]), BIT[next]);
        }else{
            for(int j=X[i];j>=0;j-=A[i]){
                add(j, sum(j-1, BIT[prev]), BIT[next]);
            }
        }

        std::swap(prev, next);
    }

    printf("%lld\n", sum(L-1, BIT[prev]));
}

Measured memory_bytes: 1296
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int N,K;
    int price = 0;
    cin >> N >> K;
    vector<int> fr(N);
    for (int i = 0; i < N; i++){
        cin >> fr.at(i);
    }
    sort(fr.begin(),fr.end());
    for (int i = 0; i < K; i++){
        price += fr.at(i);
    }
    cout << price << endl;
    return 0;
}

Measured memory_bytes: 3108
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <cstring>
#include <iostream>
#include <algorithm>

#define fi first
#define se second
#define pb push_back
#define MP std::make_pair
#define PII std::pair<int, int>
#define all(x) (x).begin(), (x).end()
#define CL(a, b) memset(a, b, sizeof a)
#define rep(i, l, r) for (int i = (l); i <= (r); ++ i)
#define per(i, r, l) for (int i = (r); i >= (l); -- i)
#define PE(x, a) for (int x = head[a]; x;x = edge[x].next)

typedef long long ll;

int main() {
	int n;
	scanf("%d", &n);
	rep(i, 1, 9) {
		rep(j, 1, 9) {
			if (i * j == n) {
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    int mul4 = 0;
    int mul2 = 0;
    int mul1 = 0;
    rep(i,n) {
        cin >> a[i];
        if (a[i] % 4 == 0) {
            mul4++;
        } else if (a[i] % 2 == 0) {
            mul2++;
        } else {
            mul1++;
        }
    }
    if (mul2 != 0) mul1++;
    if (mul1 <= mul4+1) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
while(1):
    n=int(raw_input())
    if n==0:    break
    A=[]
    for i in range(n):
        A.append(map(int,raw_input().split()))
    B=[ [A[i][j] for i in range(n)] for j in range(n) ]
    ans=0
    for i in range(n):
        ma=min(A[i])
        m=A[i].count(ma)
        mlist=[]
        for k in range(m):
            j=A[i].index(ma)
            mlist.append(j)
            A[i][j]+=10000000
        for j in mlist:
            A[i][j]-=10000000
        for j in mlist:
            if max(B[j])==ma:
                ans=ma
                break
    print ans

Measured memory_bytes: 6324
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int64_t n;
  cin>>n;
  std::vector<int64_t> a(n);
  int64_t cnt=0,sum=0;
  for (int i = 0; i < n; ++i)
  {
    int64_t tmp;
    cin>>tmp;
    a[i]=abs(tmp);
    sum+=abs(a[i]);
    cnt+=(tmp<0)? 1:0;
  }

  if(cnt%2!=0) sum-=2*(*min_element(a.begin(), a.end()));
  cout<<sum;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  st s;
  	ci(s);
  ll a=s.sz;
  ll b=a;
  FOR(i,0,b){
    if(s[i]=='o'){
      a--;
    }
  }
  if(15-a>=8){
    co("YES")
  }
  else{
    co("NO")
  }   
  }

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

using namespace std;

typedef long long int ll;

#define mod (int) (1e9+7)

// vector<ll>primes;

// void swap(ll &a, ll &b){
// 	ll c=a;
// 	a=b;
// 	b=c;
// }

// bool is_prime(int a){
// 	//bool f=true;
// 	for(int i=2; i*i<=a; i++){
		
// 		if(a%i==0){
// 			return false;
// 		}
		
// 	}
	
// 	return true;
// }




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


 
 ll ncr(ll x, ll y){
 	ll ans=1;
 	
 	y=(y > x-y? x-y: y);
 	
 	for(ll i=0; i<y; i++){
 		ans=ans*(x-i);
 		ans=ans/(i+1);
 		ans=ans%mod;
 	}
 
 	
 	return ans;
 }

ll power(ll x, ll y){
    ll ans=1;
    while(y){
        if(y&1){
            ans=ans*x;
            ans=ans%mod;
        }
        
        x=x*x;
        x=x%mod;
        y=y>>1;
    }
    
    return ans;
    
}


 
void solve(){
	
	string a,b; cin>>a>>b;
    
    int ans=0;
    
    for(int i=0; i<a.size(); i++){
        if(a[i]!=b[i]){
            ans++;
        }
    }
    
    cout<<ans<<"\n";

   return ;
	
}




int main(){
    ios_base::sync_with_stdio(0);
    
    cin.tie(0);
    
    int t=1;//cin>>t;
    
   
    
    // clock_t begin, end;
    
    // double time_spent;
    
    // begin = clock(); // Time taken till now.
    
    
    while(t--){
    
	  solve();
        
    }
    
 
    
   
   //end= clock(); // Total  Time taken till now.
   
   //time_spent= (end- begin) / CLOCKS_PER_SEC; 
   
   //cout<<time_spent<<"\n";
   
   
   
	
	return 0;
}



Measured memory_bytes: 3756
def cal(i):
    kaisu = 0
    while(i<k):
        i *= 2
        kaisu += 1
    return (1/(n*1.0))*pow((1/2.0),kaisu)

n,k = map(int, input().split())

ans = 0
for i in range(1,n+1):
    ans += cal(i)

print(ans)

Measured memory_bytes: 3060
import sys
readline = sys.stdin.readline

N = int(readline())

for i in range(1,3501):
    for j in range(1,3501):
        if 4*i*j-N*i-N*j > 0 and (N*i*j)%(4*i*j-N*i-N*j) == 0:
            print(i,j,(N*i*j)//(4*i*j-N*i-N*j))
            exit()


Measured memory_bytes: 40556
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<" "
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define sp << " " <<
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);

int main()
{
    fast;
    ll n,k;
    cin >> n >> k;
    ll a[n],dp[k+1]={0};
    input(a,n);
    fr(i,1,k+1)
        fr(j,0,n)
            if(a[j]<=i && !dp[i-a[j]])
                dp[i]=1;
    if(dp[k])
        cout << "First";
    else
        cout << "Second";
}

Measured memory_bytes: 1024
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
 
typedef long long ll;

#define MP make_pair
#define F first
#define S second

vector<pair<char,ll>> rle(string s){ //ランレングス圧縮
	vector<pair<char,ll>> e;

	e.push_back(MP(s[0],1));
	for(ll i=1;i<s.size();i++){
		if(e.back().F==s[i]){
			e.back().S++;
		}else{
			e.push_back(MP(s[i],1));
		}
	}
	
	return e;
}
string rld(vector<pair<char,ll>> e){ //ランレングス解凍
	string s="";
	for(ll i=0;i<e.size();i++){
		s += e.at(i).first*e.at(i).second;
	}
	return s;
}


int main(){
	string s;
    cin >> s;
    vector<ll> ans(s.size(),0);
    vector<pair<char,ll>> e = rle(s);
    ll haji=0;
    for(int i=0;i<e.size()/2;i++){
    	ans.at(e.at(2*i).S-1+haji)=e.at(2*i).S/2+e.at(2*i+1).S/2+e.at(2*i).S%2;
      	ans.at(e.at(2*i).S+haji)=e.at(2*i).S/2+e.at(2*i+1).S/2+e.at(2*i+1).S%2;
        cout << endl;
        haji +=  e.at(2*i).S+ e.at(2*i+1).S;
    }
    for(ll i=0;i<s.size();i++){
    	cout << ans[i] << " ";
    }
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"
#define int ll

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

  int N,M;
  cin>>N>>M;
  vector<int>A(N),B(N);
  for(int i=0;i<N;i++)cin>>A[i]>>B[i];
  ll ans=0;
  priority_queue<int>X;
  vector<vector<int>>w(100001);
  for(int i=0;i<N;i++)w[A[i]].push_back(B[i]);
  for(int i=M;i>=1;i--){
    for(auto it:w[M-i+1])X.push(it);
    if(!X.size())continue;
    ans+=X.top();
    X.pop();
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 7296
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NPlusKPatterns #-}
module Main where

import Data.List (unfoldr)

import Control.Monad (replicateM, forM_)
import Data.Bool (bool)
import Data.Char (isSpace)
import Data.Function (on)
import qualified Data.Foldable as Foldable
import Data.List (unfoldr, foldl', sort, (\\), delete, nub)
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.ByteString.Char8 as C
import qualified Data.ByteString.Unsafe as B
import System.IO (hPutStr, hPutStrLn, stdin, stdout, withFile, IOMode(..))

type Parser a = C.ByteString -> Maybe (a, C.ByteString)

parseInt :: Parser Int
parseInt = C.readInt . C.dropWhile isSpace

getInts :: IO [Int]
getInts = unfoldr parseInt <$> C.getLine

getIntVec :: Int -> IO (U.Vector Int)
getIntVec n = U.unfoldrN n parseInt <$> C.getLine

fizzbuzz n = filter p [1..n]
  where p i = i `mod` 3 /= 0 && i `mod` 5 /= 0

fizzbuzzSum = sum . fizzbuzz

main :: IO ()
main = do
  n <- readLn :: IO Int
  print $ fizzbuzzSum n

Measured memory_bytes: 4088
#include <iostream>
#include <string>
#include <set>
using namespace std;

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int ans =0;
    for(int i=0; i<n; i++){
        int current =0;
        set<char> fs;
        for(int j = 0; j<i; j++){
            fs.insert(s[j]);
        }
        for(auto c: fs){
            // cout << i<< " :: " << c << endl;
            for(int k=i; k<n; k++){
                if(s[k] == c){
                    current++;
                    break;
                }
            }
        }
        //cout << i << " :" << ans << endl;
        ans = max(ans,current);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int n;  cin >> n;
    ll sum = 0;
    for(int i = 1; i <= n; i++){
        if(!(i%3 == 0 || i%5 == 0))    sum += i;
    }
    cout << sum << endl;
}


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

int main() {
  int k,a,b;
  cin>>k>>a>>b;
  if(a%k==0) cout<<"OK"<<endl;
  else {
  int A=a/k,B=b/k;
  if(A<B) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
  }
}
  

Measured memory_bytes: 3636
#include "stdio.h"

int cnt=0;
int i,j,k;
int n,x;
int way[1000]={};;
int main(void){
	while(1){
		scanf(" %d %d",&n,&x);
		if((n==0)&(x==0)) break;
		for(i=1;i<n+1;i++){
			for(j=i+1;j<n+1;j++){
				for(k=j+1;k<n+1;k++){
					if(i+j+k==x)	way[cnt]++;
				}
			}
		}
		cnt++;
	}//3つケースならcnt3
	
	for(i=0;i<cnt;i++) printf("%d\n",way[i]);
	
	return 0;
}

Measured memory_bytes: 604
N = int(input())
a = list(map(int, input().split()))
from collections import deque
a = deque(a)
a.appendleft(0)
a.append(0)
#s = a[0]
s = 0
for i in range(N + 1):
    s += abs(a[i + 1] - a[i])
#s += abs(0 - a[N - 1])
for i in range(1, N + 1):
    print(s - (abs(a[i] - a[i - 1]) + abs(a[i] - a[i + 1])) + abs(a[i + 1] - a[i - 1]))

Measured memory_bytes: 14044
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 30 13:14:10 2018
ALDS1-4c  implementation with dictionary
@author: maezawa
"""

n = int(input())
a = dict([])
for s in range(n):
    cmd, word = input().split()
    if cmd == 'insert':
        a[word]=''
    else:
        if word in a:
            print('yes')
        else:
            print('no')




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

int main() {
    int x,a,b,c;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> x;
    int comb=0;
    for(int i=0;i<=a;i++){
      for(int j=0;j<=b;j++){
        for(int k=0;k<=c;k++){
          if(500*i+100*j+50*k==x){
            comb++;
          }
        }
      }
    }
    cout << comb;
}

Measured memory_bytes: 256
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# import numpy as np
sys.setrecursionlimit(int(pow(10,6)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("out.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

# @lru_cache(None)
t=1
# t=int(input())
for _ in range(t):
    n=l()[0]
    A=l()
    L=[A[0] for i in range(n)]
    R=[A[-1] for i in range(n)]
    for i in range(1,n):
        L[i]=gcd(L[i-1],A[i])
        R[n-i-1]=gcd(R[n-i],A[n-i-1])
    mx=0
    # print(*L)
    # print(*R)
    for i in range(n):
        if i==0:
            mx=max(mx,R[i+1])
        elif i==n-1:
            mx=max(mx,L[i-1])
        else:
            g=gcd(L[i-1],R[i+1])
            mx=max(mx,g)
    print(mx)




Measured memory_bytes: 22628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const ll INF = 1e9+10;
const ll mod = 1e9+7;
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; }
#define print(x) cerr << #x << " is " << x << endl;
//#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 

const ll MAX = 1e6 + 1;
ll inv[MAX];

void init() {
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        //if (i < 100)fprintf(stderr, "%d, %d, %d\n", i, inv[i], inv[i] * i %mod);
    }
}
ll gcd (ll a, ll b){
    if (b == 0) return a;
    return gcd(b, a %b);
}

ll lcm(ll a, ll b) {
    ll g;
    g = gcd(a, b);
    return a*b/g;
}
ll lcm_n(vector<ll> &numbers) {
    ll l;
    l = numbers[0];
    for (ll i = 1; i < numbers.size(); i++) {
        l = lcm(l, numbers[i]);
    }
    return l;
}

// �f��������O(n^(1/2))
map<ll, ll> prime_factor(ll n){
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; i++){
        while (n % i == 0){
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

int main() {
    init();
    ll N;
    cin >> N;
    vector<ll> A(N);
    map<ll, ll> res;
    ll x = 1;
    rep(i, N){
        cin >> A[i];
        map<ll, ll> primes = prime_factor(A[i]);
        for (auto it = primes.begin(); it != primes.end(); ++it){
            ll p = it->first, n = it->second;
            if (1 || p != A[i]){
                if (res.find(p) == res.end()){
                    res[p] = n;
                } else {
                    res[p] = max(res[p], n);
                }
            } else {
                (x *= p) %= mod;
            }
        }
    }
    
    for (auto it = res.begin(); it != res.end(); ++it){
        ll p = it->first, n = it->second;
        // print(p);
        // print(n);
        rep(i, n){
            (x *= p) %= mod;
        }
    }
    // print(x);
    ll ans = 0;
    rep(i, N){
        ll tmp = x * inv[A[i]] % mod;
        (ans += tmp) %= mod;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 8704
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define vul vector<ull>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi2d vector<vi >
#define vl2d vector<vl >
#define vpll vector<pll >

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rz resize
#define fr(i,n) for(i=0;i<(n);i++)
#define frr(i,n) for(i=(n-1);i>=0;i--)
#define fre(i,n) for(i=0;i<=(n);i++)
#define frre(i,n) for (i=(n);i>=0;i--)
#define frab(i,a,b) for(i=(a);i<(b);i++)
#define freab(i,a,b) for(i=(a);i<=(b);i++)
#define frrab(i,a,b) for(i=(b-1);i>=a;i--)
#define frreab(i,b,a) for(i=(b);i>=a;i--)

#define sz(a) int((a).size())
#define mset(a,b) (memset(a,b,sizeof(a)))
#define max3(a,b,c) (max((a),max((b),(c))))
#define min3(a,b,c) (min((c),min((a),(b))))
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
vector <ll> sprime;
vector<char> prime (1000000, true);
void sieve(ll n)
{
  //O(nloglogn) time
  sprime.pb(0);
  prime[0] = prime[1] = false;
  ll cnt = 0;
  for (ll i = 2; i <= n; ++i)
  {
    if (prime[i])
    {
      cnt++;
      sprime.pb(i);
      for (ll j = 2 * i; j <= n; j += i)
        prime[j] = false;
    }
  }
}
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll fastpowMOD(ll a, ll p, ll MOD) { if (p == 0) return 1; ll z = fastpowMOD(a, p / 2, MOD); z = (z * z) % MOD; if (p % 2) z = (z * a) % MOD; return z; }
ll fastpow(ll a, ll p) { if (p == 0) return 1; ll z = fastpow(a, p / 2); z = (z * z); if (p % 2) z = (z * a); return z; }
#define inf LLONG_MAX
#define minf LLONG_MIN
#define pi 3.14
#define ex 2.71
const int mod= 1e9+7;
//*********************************************///
const int N = 1e5+5;
ll i,j;
ll G[55][55],res[55][55];
ll n,k;


void multiply(ll a[][55], ll b[][55])
{
    int mul[55][55];
    fr(i,n)
        fr(j,n)
        {
            mul[i][j] = 0;
            for (int k = 0; k < n; k++)
            {
                mul[i][j] = (mul[i][j]+((a[i][k]%mod) * (b[k][j]%mod))%mod)%mod;
            }
        }

    fr(i,n)
      fr(j,n)
          res[i][j] = mul[i][j];
}

void power(ll k)
{

    // Base condition
    if (k == 1)
    {
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                res[i][j] = (G[i][j])%mod;
        return;
    }

    // Recursion call for first half
    power(k/ 2);

    // Multiply two halves
    multiply(res,res);

    // If n is odd
    if (k % 2 != 0)
        multiply(res, G);
}




void solve()
{
  cin>>n>>k;
  fr(i,n)
    fr(j,n)
  cin>>G[i][j];
  power(k);
  ll sum=0;
  fr(i,n)
    fr(j,n)
    {
      sum+=(res[i][j]%mod);
      sum%=mod;
    }
  cout<<sum<<endl;
}

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


Measured memory_bytes: 1280
/*
    Problem 36
    https://onlinejudge.u-aizu.ac.jp/problems/DPL_1_C
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N, W;
    cin >> N >> W;
    vector<int> w(N), v(N);
    for (int i = 0; i < N; i++) cin >> v[i] >> w[i];
    vector<int> dp(W+1, 0);
    for (int i = 0; i < N; i++) {
        for (int j = w[i]; j <= W; j++) {
            dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
        }
    }
    cout << dp[W] << '\n';
}


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


const ll MAX = 4000010;
const ll MOD = 1e9 + 7;
long long fac[MAX], finv[MAX], inv[MAX];
 
 
void COMinit() {
 fac[0] = fac[1] = 1;
 finv[0] = finv[1] = 1;
 inv[1] = 1;
  for (ll 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(ll n, ll k){
  if (n < k){ return 0;}
  if (n < 0 || k < 0) {return 0;}
     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
     }
 



signed main(void){ 
  
  int N,K; cin >> N >> K;
  if( K >= N ){ K = N-1;} 
  
  COMinit();
  
  int ans = 0LL;
  
  for(int m = 0; m <= K ; m++){ 
    ans += COM(N,m)*COM(N-1,m);
    ans %= MOD;
  }

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

Measured memory_bytes: 93952
"""from collections import *
from itertools import *
from bisect import *
from heapq import *

import math
from fractions import gcd
import sys
#input = sys.stdin.readline

import copy"""

K=int(input())
N=50
A=[0 for i in range(N)]


if K<=49:
	A[0]=49+K*50
else:
	A=[i for i in range(1,N+1)]
	K-=50
	for i in range(50):
		A[i]+=K//50
	for i in range(K%50):
		A[49-i]+=1


print(50)
print(" ".join([str(i) for i in A]))
"""
count=0
while 1:

	idx=[i for i in range(50) if A[i]==max(A) and A[i]>=50]
	if not idx:
		break
	i=idx[0]
	A[i]-=50
	for m in range(50):
		if i!=m:
			A[m]+=1
	count+=1
print(A)
print(count)
"""


Measured memory_bytes: 3064