akhauriyash/Code-Regression huggingface dataset:
// Problem : C - Lower
// Contest : AtCoder - AtCoder Beginner Contest 139
// URL : https://atcoder.jp/contests/abc139/tasks/abc139_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#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 int long long
#define db double
#define mod 1000000007
#define pb push_back
#define pp pair<int,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define maxn 200005
#define ss second
#define ff first
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
int inv(int a, int b){
 return 1<a ? b - inv(b%a,a)*b/a : 1;
}
void solve()
{
	int n;
	cin >> n;
	int arr[n],cnt=0,ans=0;
	rep(i,0,n)
	{
		cin >> arr[i];
		if(i > 0 and arr[i] <= arr[i-1])
		cnt++;
		else cnt =0;
		ans = max(cnt,ans);
	}
	cout << ans;
}
signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 4376
def main():
    B = list(map(int, input().split()))
    # # [1,2,3]
    N = B[0]
    R = B[1]

    if N < 10:
        A = 100 * (10 - N)
    
        print(R + A)
    else:
        print(R)
   
    
main()

Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	static class Node{
		List<Integer> adj;
		int val;
		public Node(int v) {
			adj = new ArrayList<Integer>();
			val = v;
		}
	}
	static int bsearch(int[] dp , int len, int val){
		if(len == 0){
			return 0;
		}
		if(dp[len - 1] < val){
			return len;
		}
		if(dp[0] >= val){
			return 0;
		}
		// dp[0] < val
		// dp[len - 1] >= val
		int left = 0;
		int right = len - 1;
		while(right - left > 1){
			int mid = (left + right) / 2;
			if(dp[mid] >= val){
				right = mid;
			}else{
				left = mid;
			}
		}
		return right;
	}
	static void rec(int cur , int parent , int depth , int dpLength , int dp[], int[] result, Node[] ns){
		// update LIS
		int pos = bsearch(dp, dpLength, ns[cur].val);
		int prev = -1;
//		System.out.println(cur+" "+Arrays.toString(dp)+ " "+dpLength);
		if(dpLength <= pos){
			dp[dpLength] = ns[cur].val;
			dpLength += 1;
		}else{
			prev = dp[pos];
			dp[pos] = ns[cur].val;
		}
//		System.out.println(cur+" "+Arrays.toString(dp)+ " "+dpLength);
		result[cur] = dpLength;
		for(int a : ns[cur].adj){
			if(a == parent){
				continue;
			}
			rec(a , cur , depth + 1 , dpLength, dp , result , ns);
		}
		// recover LIS
		if(depth <= pos){
			dpLength--;
		}else{
			dp[pos] = prev;
		}
	}
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int N = Integer.parseInt(line);
		Node ns[] = new Node[N];
		line = br.readLine();
		String as[] = line.split(" ");
		for(int i = 0 ; i < N ; ++i){
			int a = Integer.parseInt(as[i]);
			ns[i] = new Node(a);
		}
		for(int i = 0 ; i < N - 1; ++i){
			line = br.readLine();
			as = line.split(" ");
			int u = Integer.parseInt(as[0]) - 1;
			int v = Integer.parseInt(as[1]) - 1;
			ns[u].adj.add(v);
			ns[v].adj.add(u);
		}
		int dp[] = new int[N];	
		int result[] = new int[N];
		rec(0 , 0 , 0 , 0 , dp , result , ns);
		StringBuilder sb = new StringBuilder();
		for(int r : result){
			sb.append(r);
			sb.append('\n');
//			System.out.println(r);
		}
		System.out.println(sb);
	}
}


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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  string a, b;
  cin >> a >> b;
  string c = a + b;
  int d = 1;
  while (stoi(c) > d) {
    if (d * d == stoi(c)) {
      cout << "Yes" << endl;
      return 0;
    }
    d++;
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using boost::adaptors::reversed;
using boost::irange;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll N;
    cin >> N;
    vector<ll> ts(N);
    for (ll i = 0; i < N; i++){
        ll t;
        cin >> t;
        t *= 2;
        ts.at(i) = t;
    }
    vector<ll> vs(N, 0);
    for (ll i = 0; i < N; i++){
        ll v;
        cin >> v;
        v *= 4;
        vs.at(i) = v;
    }
    vector<ll> Ts(N + 1, 0);
    for (ll i = 0; i < N; i++){
        Ts.at(i + 1) = Ts.at(i) + ts.at(i);
    }
    const ll T_size = Ts.back() + 1;
    vector<ll> cs{0};// as[i]はcs[i]に，ds[i]はc[i+1]に依存する
    for (size_t i = 0; i < N; i++){
        for (size_t j = 0; j < ts.at(i); j++){
            cs.emplace_back(vs.at(i));
        }
    }
    cs.emplace_back(0);


    vector<ll> as(T_size), ds(T_size);
    as.front() = 0; ds.back() = 0;
    vector<ll> as_dep_idx{0};
    for (ll i = 0; i < N; i++){
        ll t = ts.at(i);
        for (ll j = 0; j < t; j++){
            as_dep_idx.emplace_back(i); // as[i]を求めるときは，as[Ts[as_dep_idx[i]]]を参照する
        }
    }
    for (ll i = 1; i < T_size; i++){
        ll as_dep = as_dep_idx.at(i);
        as.at(i) = min(cs.at(i), as.at(Ts.at(as_dep)) + 2 *  ((ll)i - Ts.at(as_dep)));
    }

    vector<ll> ds_dep_idx_proto{N};
    for (ll i = N - 1; i >= 0; i--){
        ll t = ts.at(i);
        for (ll j = 0; j < t; j++){
            ds_dep_idx_proto.emplace_back(i + 1);
        }
    }
    vector<ll> ds_dep_idx(ds_dep_idx_proto.rbegin(), ds_dep_idx_proto.rend()); // ds[i]を求めるときはds[Ts[ds_dep_idx[i]]]を参照する
    for (ll i = T_size - 1 - 1; i >= 0; i--){
        ll ds_dep = ds_dep_idx.at(i);
        ds.at(i) = min(cs.at(i + 1), ds.at(Ts.at(ds_dep)) + 2 * (Ts.at(ds_dep) - (ll)i));
    }
    vector<ll> Vs(T_size);
    for (ll i = 0; i < T_size; i++){
        Vs.at(i) = min(as.at(i), ds.at(i));
    }
    vector<ll> distances(T_size - 1);
    for (ll i = 0; i < T_size - 1; i++){
        assert((Vs.at(i) + Vs.at(i+1)) % 2 == 0);
        distances.at(i) = (Vs.at(i) + Vs.at(i+1)) / 2;
    }
    ll distance = 0;
    for (ll i = 0; i < T_size - 1; i++){
        distance += distances.at(i);
    }
    double d_double = distance;
    cout << fixed << setprecision(10) << d_double / 8 << endl;
    return 0;
}

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

using ll=long long;
array<int,(int)(1e5)> ok;
array<int,(int)(1e5)> oksum;
array<ll,100000> ubs;
array<ll,100000> sumx;

bool check(int w,int n,ll sp){
    fill(ok.begin(),ok.begin()+n+1,false);
    fill(oksum.begin(),oksum.begin()+n+2,false);
    ok[n]=true;
    ok[n-1]=true;
    oksum[n+1]=0;
    oksum[n]=1;
    oksum[n-1]=2;
    for(int i=n-2;i>=0;i--){
        //cerr<<"1check"<<i<<endl;
        int j=ubs[i];
        int lb=i+1; //[i,lb)de tarinai
        int ub=j;
        while(ub-lb>1){
            int mid=((lb+ub)>>1);
            ll mot=w-(sumx[mid]-sumx[i]);
            ll chi=mid-i-1;
            //floor((mot+chi-1)/chi)>sp
            //
            if(mot>sp*chi){
                lb=mid;
            }
            else{
                ub=mid;
            }
        }
        //cerr<<"2check"<<i<<endl;
        int b=ub;
        //check [b,j)
        if(j==n+1 || oksum[b]-oksum[j]>0){
            ok[i]=true;
        }
        else{
            ok[i]=false;
        }   
        //cerr<<"#"<<i<<" "<<b<<" "<<j<<" "<<ok[i]<<endl;
        oksum[i]=oksum[i+1]+ok[i];
    }
    //cerr<<sp<<endl;
    //string buf;
    //cin>>buf;
    
    return ok[0];
}

int solve(int w,int n){
    vector<ll> x(n);
    for(int i=0;i<n;i++) cin>>x[i];
    for(int i=0;i<n;i++){
        sumx[i+1]=sumx[i]+x[i];
    }
    for(int i=n-2;i>=0;i--){
        int lb=i;
        int ub=n+1;
        //cerr<<"check"<<i<<endl;
        //[i,lb) is ok
        //w-(sumx[lb]-sumx[i])>=lb-i-1
        //w+i+1>=sumx[lb]-sumx[i]+lb
        while(ub-lb>1){
            int mid=(lb+ub)/2;
            ll sux=sumx[mid]-sumx[i]+mid;
        //cerr<<"#"<<mid<<" "<<sux<<" "<<w+i+1<<endl;
            if(w+i+1>=sux){
                lb=mid;
            }
            else{
                ub=mid;
            }
        }
        ubs[i]=ub;
    }
    int lb=0;   
    int ub=w;
    //cerr<<"End summation"<<endl;
    while(ub-lb>1){
        int mid=(lb+ub)/2;
        if(!check(w,n,mid)){
            lb=mid;
        }
        else{
            ub=mid;
        }
    }
    return ub;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int w,n;
    while(cin>>w>>n,w){
        cout<<solve(w,n)<<"\n";
    }
    return 0;
}


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

int main(){
    while(1){
        int n; cin>>n;
        if(n == 0) return 0;
        vector<int> h(n+1);
        for(int i=0; i<n+1; i++) cin>>h[i];

        for(int i=0; i<n+1; i++){
            vector<int> v;
            for(int j=0; j<n+1; j++){
                if(j == i) continue;
                v.emplace_back(h[j]);
            }

            int gmin = 1e9, gmax = 0;
            for(int j=0; j<n-1; j++){
                int gap = v[j+1] - v[j];
                gmin = min(gmin, gap);
                gmax = max(gmax, gap);
            }

            if(gmin == gmax){
                cout << h[i] << endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 3132
import sys
import random
import string

DEBUG = False
secret_str = "Atcod3rIsGreat"
count = 0


def local_str(query : str) -> int:
    import Levenshtein
    return Levenshtein.distance(query , secret_str)


def query_str(query : str) -> int:
    global count
    count += 1
    if DEBUG:
        ans = local_str(query)
        return ans
    else:
        print("? " + query)
        ans = int(input())
        if ans == 0:
            print("! " + query)
            sys.exit(0)
        return ans

def guess_length() -> int:
    c = "a"
    a = query_str(c)
    if a == 128:
        return 128
    al = query_str(c * a)
    al2 = query_str(c * (a + 1))
    if al >= al2:
        return a + 1
    else:
        return a


def merge(S : str, T : str) -> str:
    t = 0
    len_t = len(T)
    d = query_str(T)
    for s, c in enumerate(S):
        while t < len_t:
            l = T[:t +s]
            r = T[s + t:]
            d2 = query_str(l + c + r)
            if d2 < d:
                T = l + c + r
                d = d2
                break
            t += 1
        if t == len_t:
            T = T + c
    return T

def guessing():
    password_len = guess_length()
    chars = []
    for c in string.ascii_letters + string.digits:
        unmatch_word_num = query_str(c * password_len)
        if password_len - unmatch_word_num > 0:
            chars.append(c * (password_len - unmatch_word_num))
    while len(chars) > 1:
        chars.sort(key=lambda x: len(x))
        m = merge(chars[0], chars[1])
        chars[1] = m
        chars = chars[1:]
    query_str(chars[0])
    return chars[0]


guessing()
def randomname(n):
   randlst = [random.choice(string.ascii_letters + string.digits) for i in range(n)]
   return ''.join(randlst)




Measured memory_bytes: 10352
<?php

//$_input = explode(
//    "\n",
//    '2
//3 1 2
//6 1 1
//
//'
//);

function getNext() {
    return trim(
        isset($GLOBALS['_input'])
            ? array_shift($GLOBALS['_input'])
            : fgets(STDIN)
    );
}

$planCount = (int) getNext();

$lastTime = 0;
$lastPosX = 0;
$lastPosY = 0;

for ($i = 0; $i < $planCount; ++$i) {
    $temp = explode(' ', getNext());
    $plan = [
        't' => (int) $temp[0],
        'x' => (int) $temp[1],
        'y' => (int) $temp[2],
    ];

    $diffTime = $plan['t'] - $lastTime;
    $diffX = abs($plan['x'] - $lastPosX);
    $diffY = abs($plan['y'] - $lastPosY);

    if (
        $diffX + $diffY > $diffTime
        ||  ($diffTime - ($diffX + $diffY)) % 2 === 1
    ) {
        echo "No\n";
        exit();
    }

    $lastTime = $plan['t'];
    $lastPosX = $plan['x'];
    $lastPosY = $plan['y'];
}

echo "Yes\n";


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

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> p(n);
	for (auto &i : p)
	{
		cin >> i;
		i--;
	}
	vector<vector<int>> g(n);
	for (int i = 0; i < m; i++)
	{
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		g[x].emplace_back(y);
		g[y].emplace_back(x);
	}
	vector<bool> done(n, false);
	int ans = 0;
	for (int t = 0; t < n; t++)
	{
		if (!done[t])
		{
			vector<int> index, val;
			queue<int> q;
			q.emplace(t);
			while (!q.empty())
			{
				int i = q.front();
				q.pop();
				if (done[i])
				{
					continue;
				}
				done[i] = true;
				index.emplace_back(i);
				val.emplace_back(p[i]);
				for (auto &j : g[i])
				{
					q.emplace(j);
				}
			}
			sort(index.begin(), index.end());
			sort(val.begin(), val.end());
			for (auto &i : index)
			{
				if (*lower_bound(val.begin(), val.end(), i) == i)
				{
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7080
def main():

    N = int(input())
    A = list(map(int, input().split()))
    SA = [0]
    for i in range(N + 1):
        SA.append(SA[-1] + A[N - i])
    SA.reverse()
    res = 0
    t = 1
    for i in range(N + 1):
        if t >= SA[i]:
            t = SA[i]
        res += t
        t -= A[i]
        if t <= 0:
            if i != N:
                return -1
            else:
                if t < 0:
                    return -1
        t *= 2
    return res


print(main())


Measured memory_bytes: 94416
import java.util.Scanner;

public class Main {
	static int N = 0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = Integer.parseInt(sc.nextLine());

		// int[] A = Arrays.stream(sc.nextLine().split("
		// ")).mapToInt(Integer::parseInt).toArray();

		String[] S = sc.nextLine().split(" ");
		String[] A = new String[N];
		String[] B = new String[N];
		System.arraycopy(S, 0, A, 0, S.length);
		System.arraycopy(S, 0, B, 0, S.length);

		String tmpA = "";
		String tmpB = "";

		for (int i = 0; i < N; i++) {
			for (int j = N - 1; j > i; j--) {
				char[] preBox = A[j - 1].toCharArray();
				char[] aftBox = A[j].toCharArray();
				if (preBox[1] > aftBox[1]) {
					tmpA = A[j];
					A[j] = A[j - 1];
					A[j - 1] = tmpA;
				}
			}
		}

		out_put(A);

		System.out.println("Stable");

		int minl;
		for (int k = 0; k < N; k++) {
			minl = k;
			for (int l = k; l < N; l++) {
				char[] minBox = B[minl].toCharArray();
				char[] lBox = B[l].toCharArray();
				if (lBox[1] < minBox[1])
					minl = l;
			}
			if (k != minl) {
				tmpB = B[minl];
				B[minl] = B[k];
				B[k] = tmpB;
			}
		}

		out_put(B);

		if (isStable(A, B)) {
			System.out.println("Stable");
		} else {
			System.out.println("Not stable");
		}

		sc.close();
	}

	private static void out_put(String array[]) {

		System.out.printf("%s", array[0]);

		for (int i = 1; i < array.length; i++) {
			System.out.printf(" %s", array[i]);
		}
		System.out.printf("\n");
	}

	private static boolean isStable(String in[], String out[]) {
		// for (int i = 0; i < N; i++)
		// for (int j = i + 1; j < N; j++)
		// for (int a = 0; a < N; a++)
		// for (int b = a + 1; b < N; b++) {
		// char[] iBox = in[i].toCharArray();
		// char[] jBox = in[j].toCharArray();
		// if ((iBox[1] == jBox[1]) && (in[i].equals(out[b])) && (in[j].equals(out[a])))
		// return false;
		// }
		
		for (int i = 0; i < N; i++)
			if (!in[i].equals(out[i]))
				return false;
		return true;
	}
}



Measured memory_bytes: 26420
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		vi a(n);
		int minus=0;
		int abs_min=2000000000;
		ll ans=0;

		for(int i=0;i<n;i++)
		{
			scanf("%d", &a[i]);
			if(a[i]<0) minus++;
			ans+=abs(a[i]);
			if(abs_min>abs(a[i])) abs_min=abs(a[i]);
		}
		if(minus&1) ans-=abs_min*2;
		printf("%lld\n", ans);
	}
	return 0;
}


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

int main(){

    int N, M;
    cin >> N >> M;
    vector<int> cntWA(N);
    vector<int> ifAC(N);
    rep (i, M){
        int p;
        string S;
        cin >> p >> S;
        if (S == "WA" && ifAC[p-1] == 0){
            cntWA[p-1] += 1;
        }else ifAC[p-1] = 1;
    }

    int ACans = accumulate(ifAC.begin(), ifAC.end(), 0);
    int WAans = 0;
    rep (i, N) if (ifAC[i] == 1) WAans += cntWA[i];

    cout << ACans << " " << WAans << endl;

    return 0;
}

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


#define int long long

signed main(){
    int la, lb;
    la = lb = 0;

    int n;
    cin >> n;
    string s;
    int ans = 0;

    int all = 0;
    for(int i = 0;i < n;i++){
        cin >> s;
        for(int j = 0;j < s.size()-1;j++){
            if(s[j] == 'A' && s[j+1] == 'B'){
                ans++;
            }
        }
        if(s[s.size()-1] == 'A' && s[0] == 'B'){
            all++;
        }else if(s[s.size()-1] == 'A'){
            la++;
        }else if(s[0] == 'B'){
            lb++;
        }
    }

    if(all > 0){
        ans += all-1;
        if(la > 0){
            la--;
            ans++;
        }
        if(lb > 0){
            lb--;
            ans++;
        }
    }
    ans += min(la, lb);
    cout << ans << endl;

    return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

char c[100][100];

int main()
{
    cout << fixed << setprecision(15);
    ll H, W;
    cin >> H >> W;

    REP(i, H+2) {
        REP(j, W+2) {
            if(i == 0){
                c[i][j] = '.';
                continue;
            }
            if(i == H+1){
                c[i][j] = '.';
                continue;
            }
            if(j == 0){
                c[i][j] = '.';
                continue;
            }
            if(j == W+1){
                c[i][j] = '.';
                continue;
            }
            cin >> c[i][j];
        }
    }
    // for(ll i=0; i<=H+1; i++){
    //     for(ll j=0; j<=W+1; j++){
    //         cout << c[i][j];
    //     }
    //     cout << endl;
    // }

    for(ll i=1; i<=H; i++){
        for(ll j=1; j<=W; j++){
            if(c[i][j] == '.') continue;
            
            if(c[i+1][j] == '#') continue;
            if(c[i-1][j] == '#') continue;
            if(c[i][j+1] == '#') continue;
            if(c[i][j-1] == '#') continue;
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <math.h>

#include <vector>
#include <string>
#include <iostream>
using namespace std;

struct kouho{
    int index;
    int hi;
};

int main(){
    int N,T,A;
    cin>>N>>T>>A;
    
    vector<kouho> H=vector<kouho>(N);
   
    for (int i=0; i<N; i++) {
        cin>>H[i].hi;
        H[i].index=i+1;
    }
    
    double sa=fabs(T-(double)H[0].hi*0.006-A);
    int ind=0;

    
    for (int i=1; i<N; i++) {
        if (sa>fabs(T-(double)H[i].hi*0.006-A)) {
            sa=fabs(T-(double)H[i].hi*0.006-A);
            ind=i;
        }
    }
    
    cout<<H[ind].index;
    
    return 0;
}


Measured memory_bytes: 256
x1, x2, x3, x4, x5 = map(int, input().split())

if x1 == 0:
    print(1)
if x2 == 0:
    print(2)
if x3 == 0:
    print(3)
if x4 == 0:
    print(4)
if x5 == 0:
    print(5)

Measured memory_bytes: 61548
#include <iostream>
#include<algorithm>
using namespace std;
int main(void){
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   if(a==c)cout<<"Yes"<<endl;
   else{
       if(abs(c-a)<2*d)cout<<"Yes"<<endl;
       else cout<<"No"<<endl;
   }
   
   return 0; 
}


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

int main() {
    int N;
    std::cin >> N;
   
    int A;
    std::unordered_set<int> intset;
    for (int i = 0; i < N; ++i) {
        std::cin >> A;
        if (intset.count(A) != 0) {
            std::cout << "NO\n";
            return 0;
        } else {
            intset.insert(A);
        }
    }

    std::cout << "YES\n";

    return 0;
}


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

const int INF = INT_MAX / 2;

int main(){
    int N, M; cin >> N >> M;
    vector<vector<int>> G(N*3);
    for (int i = 0; i < M; i++)
    {
        int from, to; cin >> from >> to;
        from--; to--;
        from *= 3; to *= 3;
        for (int i = 0; i < 3; i++)
        {
            if(i<2) G[from+i].push_back(to+i+1);
            else G[from+i].push_back(to);
        }
    }

    int start, goal; cin >> start >> goal;
    start--; goal--;
    start *= 3; goal *= 3;
    vector<int> dist(N*3, INF);
    dist[start] = 0;
    queue<int> pos;
    pos.push(start);

    while(!pos.empty()){
        int from = pos.front(); pos.pop();
        for(int to : G[from]){
            if(dist[to]!=INF) continue;
            pos.push(to);
            dist[to] = dist[from] + 1;
            if(to==goal){
                cout << dist[to]/3 << endl;
                return 0;
            }
        }        
    }
    cout << -1 << endl;
}


Measured memory_bytes: 17792
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N, M;
    cin >> N >> M;
    vec<string> A(N);
    range(i, 0, N) cin >> A.at(i);
    vec<string> B(M);
    range(i, 0, M) cin >> B.at(i);
    lint max_offset = N - M;
    range(x_offset, 0, max_offset + 1) range(y_offset, 0, max_offset + 1) {
        bool identical = true;
        range(i, 0, M) range(j, 0, M) {
            if (A.at(i + x_offset).at(j + y_offset) != B.at(i).at(j)) {
                identical = false;
            }
        }
        if (identical) {
            cout << "Yes" << "\n";
            return 0;
        }
    }
    cout << "No" << "\n";
}

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

using namespace std;

const int Maxn = 1e2+7;

int n, T, ans;

int main()
{
	cin >> n >> T;
	for(int i = 1, c, t; i <= n; ++i)
	{
		cin >> c >> t;
		if(t > T) continue;
		if(!ans) ans = c;
		else ans = min(ans, c);
	}
	if(!ans) cout <<"TLE" << endl;
	else cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = (n) - 1; i >= 0; i--)
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define STRS(i,str) for(int i = 0; (str)[i]; i++)
#define CHINO(a,n) int n, *a; scanf("%d", &n); a = (int *)malloc(sizeof(int) * n); for(int i = 0; i < n; i++) scanf("%d", a + i)

int gcd(int x, int y);

int main(){
	int x, y;
	scanf("%d%d", &x, &y);
	printf("%d\n", gcd(x, y));
}

int gcd(int x, int y){
	if(x > 0) return gcd(y%x, x);
	else return y;
}

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

#define LL long long

LL T, A, X, B, Y;

int main()
{
	scanf("%lld %lld", &A, &X);
	scanf("%lld %lld", &B, &Y);
	scanf("%lld", &T);

	if((X - Y) * T >= abs(A - B)) puts("YES");
	else puts("NO");
	return 0;
}


Measured memory_bytes: 3492
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using pll = pair<long long, long long>;
const long long INF = 1<<29;

const int MOD = 1000000007;
long long ruizyou(long long m,long long n){
  if(m == 0)return 0;
  if(m == 1)return 1;
  long long ans = 1;
  long long tmp = m;
  for(int i=0;i<=30;i++){
    if(n & (1<<i)){
      ans *= tmp;
      ans %= MOD;
    }
    tmp *= tmp;
    tmp %= MOD;
  }
  return ans;
}
long long kaizyou(long long x){
  if(x == 0)return 1;
  return x * kaizyou(x-1) % MOD;
}
long long comb(long long x,long long y){
  long long bunsi = kaizyou(x);
  long long bunbo = kaizyou(x-y) * kaizyou(y) % MOD;
  return bunsi * ruizyou((int)bunbo,MOD-2) % MOD;
}
struct unionfind{
  vector<int> par;
  vector<int> hukasa;
  unionfind(int n){
    par = vector<int>(n);
    hukasa = vector<int>(n,0);
    for(int i=0;i<n;i++){
      par.at(i) = i;
    }
  }
  int root(int x){
    if(par.at(x) == x)return x;
    return root(par.at(x));
  }
  void unite(int x,int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry)return;
    if(hukasa.at(rx) >= hukasa.at(ry)){
      par.at(ry) = rx;
      hukasa.at(rx) = max(hukasa.at(ry) + 1,hukasa.at(rx));
    }
    else{
      par.at(rx) = ry;
    }
  }
  bool same(int x,int y){
    return root(x) == root(y);
  }
};
int ctoi(char a){
  return a - '0';
}
long long gcd(long long a,long long b){
  long long c = max(a,b);
  long long d = min(a,b);
  if(d % c == 0)return c;
  return gcd(c,d%c);
}
long long lcm(long long a,long long b){
  return a * b / gcd(a,b);
}
int main(){
  int a;
  cin >> a;
  cout << a + a*a + a*a*a << endl;
}

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

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

//間隔gを指定した挿入ソート
void insertionSort(int A[], int n, int g) {
    for ( int i = g; i < n; i++) {
        int v = A[i];
        int j = i - g; //差gの数j
        while ( j >= 0 && A[j] > v) {
            A[j + g] = A[j]; //大きい方に小さい方を代入
            j -= g; //g分だけ下がる
            cnt++; //入れ替えた回数+1
        }
        A[j + g] = v; //最後入れ替えてないのに-gしてるのでj+gの位置に最初に取っておいたvを代入
    }
}

void shellSort(int A[], int n) {
    //数列G = {1, 4, 13, 40, 121, 364...}を生成
    for (int h = 1; ; ) {
        if (h > n) break;
        G.push_back(h);
        h = 3*h + 1;
    }
    for (int i = G.size()-1; i>=0; i--) { //逆順にG[i]=gを指定
        insertionSort(A, n, G[i]);
    }
}

int main() {
    cin >> n;
    // より速い入力scanf関数を使用
    for (int i=0; i<n; i++) scanf("%d", &A[i]);
    cnt = 0;

    shellSort(A, n);

    cout << G.size() << endl;
    for (int i=G.size()-1; i>=0; i--) {
        printf("%d", G[i]);
        if (i) printf(" ");
    }
    printf("\n");
    printf("%d\n", cnt);
    for (int i= 0; i<n; i++) printf("%d\n", A[i]);

    return 0; 
}



Measured memory_bytes: 7120
#include<bits/stdc++.h>
    #include <ext/pb_ds/tree_policy.hpp> 
    #include <functional> // for less 
    using namespace __gnu_pbds; 
    using namespace std;
    //typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;    
    #define ll            long long
    #define pb            push_back
    #define ppb           pop_back
    #define si            set <ll>
    #define endl          '\n'
    #define fr            first
    #define sc            second
    #define mii           map<ll,ll>
    #define msi           map<string,ll>
    #define mis           map<ll,string>
    #define rep(i,a,b)    for(ll  i=a;i<b;i++)
    #define all(v)        v.begin(),v.end()
    #define sort(v)       sort(all(v))
    #define pii           pair<ll ,ll >
    #define vi            vector<ll >
    #define vii           vector<pair<ll,ll>>
    #define vs            vector<string>
    #define sz(x)         (ll)x.size()
    #define M             1000000007
    #define bs            binary_search
    #define rev(a)        reverse(all(a));
    #define sp(n)         setprecision(n)
    #define spl           " "
    #define arr(a,n)      rep(i,0,n) cin>>a[i]
    #define mod           998244353
    #define print_vector(a)  for(auto t:a) cout<<t<<" ";cout<<endl;
    #define print_arr(a,n)   rep(i,0,n) cout<<a[i]<<" "; cout<<endl;        
    #define show(a,n)     for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
    #define debug(x)      cout << #x << " is " << x << endl;
    #define time          cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    #define INF           1ll<<31
    #define hi            cout<<"hi"<<endl;
    const ll maxn=int(3e5)+500;
    const ll maxa=(1<<20)+3;
    ll bpow(ll a, ll b, ll mm = M)
    {
        ll res = 1;
     
        while(b)
        {
            if(b & 1)
                res = (res * a) % mm;
            a = (a * a) % mm;
     
            b >>= 1;
        }
     
        return res;
    }
    
    void solve()
    {
     ll a,b,c,d;
     cin>>a>>b>>c>>d;
     ll x=c/b;
     if(c%b) x++;
     ll y=a/d;
     if(a%d) y++;
     if(x<=y) {cout<<"Yes"<<endl;}
     else cout<<"No"<<endl;
    } 
    signed main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        ll t=1;
        //cin>>t;
        while(t--) solve();
    }

  

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

bool likeCoffee(const string& str) {
        return str[2] == str[3] && str[4] == str[5];
}


int main() {

	string s;
	cin >> s;
	cout << (likeCoffee(s) ? "Yes":"No") << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    for(int i = 0;i < (int)s.size();i++)if(s[i] == '7')cout << "Yes",exit(0);
    cout << "No";
	return 0;
}

Measured memory_bytes: 3600
n = int(input())
arr = []
for i in range(n):
    A = int(input())
    t = []
    for _ in range(A):
        t.append(list(map(int, input().split())))
    arr.append(t)
ans = 0
for i in range(2 ** n):
    tmp = ''
    for k in range(n):
        if 1 & i>>k:
            tmp = '1' + tmp
        else:
            tmp = '0' + tmp
    flg = True
    for k in range(n):
        if tmp[k] == '1':
            for l in arr[k]:
                if (l[1] == 1 and tmp[l[0]-1] == '1') or (l[1] == 0 and tmp[l[0]-1] == '0'):
                    continue
                else:
                    flg = False
    if flg:
        ttmp = 0
        for k in tmp:
            ttmp += int(k)
        if ans < ttmp:
            ans = ttmp
print(ans)

Measured memory_bytes: 3188
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
n,m = LI()
print((n-1)*(m-1))
#B

#C
"""
n = I()
a = LI()
d = [0,0]
for i in a:
    if i%2:
        d[0] += 1
    if i%4 == 0:
        d[1] += 1
if n % 2:
    d[0] -= 1
d[0] -= d[1]
if d[0] <= 0:
    print("Yes")
else:
    print("No")
"""

#D
"""
h,w = LI()
n = I()
a = LI()
c = [[None for x in range(w)] for y in range(h)]
i = 0
for y in range(h):
    if y%2:
        for x in range(w)[::-1]:
            if not a[i]:
                i += 1
            c[y][x] = i+1
            a[i] -= 1
    else:
        for x in range(w):
            if not a[i]:
                i += 1
            c[y][x] = i+1
            a[i] -= 1
for i in c:
    print(*i)
"""

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 38512
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template <class T> void swap(T& a, T& b) { T t = std::move(a); a = std::move(b); b = std::move(t); }

int main(void)
{
    ll N, num, ans=0, i, judge=1;

    cin >> N;

    if(N<10){
        cout << 1 << endl;
    }

    else{
        for(i=2; i<=sqrt(N); i++){
            if(N%i==0){
                judge = 0;
                break;
            }
        }

        if(judge == 1){
            num = N;
        }

        else{
            i = sqrt(N);
            while(N%i!=0){
                i--;
            }
            num = N/i;
        }

        while(num!=0){
            ans++;
            num /= 10;
        }

        cout << ans << endl;
    }

    return 0;
}

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

int main() {
	int n,q;cin>>n>>q;
	vector<int> v[1010];

	while(q--){
		int query,t;cin>>query>>t;
		if(query==0){
			int x;cin>>x;
			v[t].push_back(x);
		}else if(query==1){
			for(int i=0;i<v[t].size();++i){
				cout<<v[t][i];
				if(i<v[t].size()-1) cout<<" ";
			}
			cout<<endl;
		}else{
		  v[t].clear();
		}
	}
	
  return 0;
}



Measured memory_bytes: 5820
#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 int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x;
    cin >> x;
    if(x == 0) {
    	cout << "1\n";
    } else {
    	cout << "0\n";
    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    sort(all(s));
    Yes(s[0] == s[1] && s[2] == s[3] && s[1] != s[2]);

    return 0;
}



Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
// g++ hoge.cpp -std=c++17 -I . でコンパイルできる
// -fsanitize=undefinedでオーバーフロー検出
#include <bits/stdc++.h>
//#include <atcoder/all>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
//using namespace atcoder;
typedef pair<ll,ll> P;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll a,b,c,d,m,n,k,x,y,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>str;
    if(str[str.length()-1]=='s'){
        cout<<str<<"es"<<endl;
    }else{
        cout<<str<<"s"<<endl;
    }
    //cout<<n<<endl;

    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<double> dp(n+1);
    dp[0] = 1;
    for(int coins = 0; coins < n; coins++) {
        double p_heads;
        cin >> p_heads;
        for(int i = coins + 1; i >= 0; i--) {
            dp[i] *= (1 - p_heads);
            if (i > 0) dp[i] += (dp[i-1] * p_heads);
        }
    }

    double ans = 0;
    for(int i = n/2+1; i <= n; i++) {
        ans += dp[i];
    }
    cout << fixed << setprecision(10) << ans;
    return 0;
}


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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename T>
bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>
bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

ll gcd(ll a,ll b){
	if(a<b){
		swap(a,b);
	}

	while(ll r=(a%b)){
		a = b;
		b = r;
	}
	return b;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	auto A=vecin(N);
	vector<ll> L(N),R(N);
	L[0] = A[0],R[N-1] = A[N-1];
	REP(i,N-1){
		L[i+1] = gcd(L[i],A[i+1]);
		R[N-1-i-1] = gcd(R[N-1-i],A[N-1-i-1]);
	}

	ll maxV=0;
	REP(i,N){
		if(i==0) maxV=R[1];
		else if(i==N-1){
			maxV = max(maxV,L[N-2]);
		}
		else{
			maxV = max(maxV,gcd(L[i-1],R[i+1]));
		}
	}

	out(maxV);
	return 0;
}


Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] S = br.readLine().split(" ");
		int N = Integer.parseInt(S[0]);
		int W = Integer.parseInt(S[1]);
		int[] weight = new int[N+1];
		int[] value = new int[N+1];
		
		
		for(int i = 1; i <= N ; i++) {
			S = br.readLine().split(" ");
			weight[i] = Integer.parseInt(S[0]);
			value[i] = Integer.parseInt(S[1]);
		}
		
		long[][] cache = new long[N+1][W+1];
		
		
		for(int i = 1; i <= N ; i++) {
			for(int w = 1; w <= W ; w++) {
				cache[i][w] = cache[i-1][w];
				if(w >= weight[i]) {
					 cache[i][w] = Math.max(cache[i][w], value[i]+ cache[i-1][w-weight[i]]);
				}
			}
		}
		
		System.out.println(cache[N][W]);
	}
}


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

string s,t,ts;
int longest[540000];
bool ok[540000];

vector<int> z_alg(string s)
{
    int n=s.size();
    vector<int> res(n);
    res[0]=0;
    int now=0,l=0;
    for(int i=1;i<n;i++)
    {
        res[i]=now-i;
        if(now-i>=0&&res[i-l]!=res[i])res[i]=min(res[i-l],res[i]);
        else
        {
            res[i]=max(res[i],0);
            while(res[i]<n&&s[i+res[i]]==s[res[i]])res[i]++;
            now=i+res[i];
            l=i;
        }
    }
    return res;
}

int calc(int x,int dep=0)
{
    if(dep>s.size())return -1;
    if(longest[x]!=-1)return longest[x];
    if(!ok[x])return longest[x]=0;
    longest[x]=calc((x + t.size() )% s.size(), dep+1);
    if(longest[x]==-1)return -1;
    return longest[x]+=1;
}

main()
{
    for(int i=0;i<540000;i++)longest[i]=-1;
    cin>>s>>t;
    ts=t+s+t;
    for(int i=0;i<t.size();i++)ts[t.size() + s.size() + i] = s[i % s.size()];

    auto z=z_alg(ts);
    for(int i=0;i<s.size();i++)
    {
        if(z[t.size()+i]>=t.size())ok[i]=1;
    }
    int ans=0;
    for(int i=0;i<s.size();i++)
    {
        longest[i]=calc(i);
        if(longest[i]==-1){puts("-1");return 0;}
        ans=max(ans,longest[i]);
    }
    printf("%d\n",ans);
    return 0;
}

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

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

long long dp[100001][3];    //dp[i][j]を、i日目に、前日j番目を選んだうえで達成できる最大値
int dom[100001][3];    //事柄
long long INF = (1ll << 60) * (-1);
int N;

int main(){
  cin >> N;

  dp[0][0] = dp[0][1] = dp[0][2] = 0;     //初期化
  
  int a, b, c;
  for(int i = 0; i < N; i++){
    cin >> a >> b >> c;
    dom[i][0] = a; dom[i][1] = b; dom[i][2] = c;                  //i+1日目に行うこと  dp[i] + do[i] -> dp[i+1]
    dp[i+1][0] = dp[i+1][1] = dp[i+1][2] = INF;    //dp[i] do[i] dp[i+1]
  }

  for(int i = 1; i <= N; i++){
    chmax(dp[i][0],  dp[i-1][1]+dom[i-1][0]);
    chmax(dp[i][0], dp[i-1][2]+dom[i-1][0]);
    chmax(dp[i][1], dp[i-1][0]+dom[i-1][1]);
    chmax(dp[i][1], dp[i-1][2]+dom[i-1][1]);
    chmax(dp[i][2], dp[i-1][0]+dom[i-1][2]);
    chmax(dp[i][2], dp[i-1][1]+dom[i-1][2]);
  }

  cout << max(dp[N][0], max(dp[N][1], dp[N][2])) << endl;
   return 0;
}


Measured memory_bytes: 3712
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class216
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var MIN = new long[N];
            var MAX = new long[N];
            for(int i = 0; i < N; i++)
            {
                var r = Console.ReadLine().Split().Select(long.Parse).ToArray();
                long X = r[0], L = r[1];
                MIN[i] = X - L;
                MAX[i] = X + L;
            }
            Array.Sort(MAX, MIN);
            long edge = long.MinValue;
            int count = 0;
            for(int i = 0; i < N; i++)
            {
                if (edge <= MIN[i])
                {
                    edge = MAX[i];
                    count++;
                }
            }
            Console.WriteLine(count);

        }
    }
}


Measured memory_bytes: 18996
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class310
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var p = new Tuple<int, string, int>[n];
            for(int i = 0; i < n; i++)
            {
                var r = Console.ReadLine().Split();
                p[i] = Tuple.Create(i + 1, r[0], int.Parse(r[1]));
            }
            Array.Sort(p, (x, y) => x.Item2 == y.Item2 ? -x.Item3.CompareTo(y.Item3) : x.Item2.CompareTo(y.Item2));
            for(int i = 0; i < n; i++)
            {
                Console.WriteLine(p[i].Item1 );
            }
        }
    }
}


Measured memory_bytes: 13652
n, y = list(map(int,input().split()))

a, b, c = '-1', '-1', '-1'

for yen_10000 in range(n+1):
    for yen_5000 in range(n - yen_10000+1):
        yen_1000 = n - yen_10000 - yen_5000
        total = yen_10000*10000 + yen_5000*5000 + yen_1000*1000
        if total == y:
            a, b, c = str(yen_10000), str(yen_5000), str(yen_1000)
            break
            
print(a+' '+b+' '+c)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define INF = 1001001001
#define pi = acos(-1)
using namespace std;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
ll lcm(ll x, ll y) { return (x * y) / gcd(x, y); }


int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    ll atk = 0;
    int z_cnt = 0;

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

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

    while (z_cnt!=n-1){
        atk = a[z_cnt];
        for (int j = z_cnt; j < n; ++j) {
            if (j==z_cnt) continue;
            a[j] %= atk;
            if (a[j]==0) z_cnt++;
        }
        sort(a.begin(), a.end());
    }



    cout << a[n-1] << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
	//A 窓　B カーテン
	int A = 0, B = 0;
	scanf("%d%d", &A, &B);
	B *= 2;
	if (A > B)	{
		printf("%d\n", A - B);
	}
	else
	{
		printf("0\n");
	}
}

Measured memory_bytes: 128
n,m = list(map(int,input().split()))

w_a = [0]*n
a_c = [0]*n
for i in range(m):
    p,s = list(input().split())
    p = int(p)
    if s == 'WA' and (a_c[p-1] == 0):
        w_a[p-1] += 1
    else:
        a_c[p-1] = 1

ac = 0
wa = 0
for i in range(n):
    if a_c[i] == 1:
        ac += 1
        wa += w_a[i]

print(str(ac), str(wa))


Measured memory_bytes: 10404