akhauriyash/Code-Regression huggingface dataset:
#pragma region template
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define rep2(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)
#define vint vector<int>
#define vll vector<ll>
#define vstr vector<string>
#define vbl vector<bool>
#define pb push_back
using namespace std;
using ll = long long;

const string Yes = "YES\n";
const string No = "NO\n";

static inline void ignore_ret(int x) {x++;}
template<class T> inline bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> inline T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> inline T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm(r,v.at(i));return r;}
template<class T> inline T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> inline T nCr(T n,T k){if(n<k||n<0||k<0)return 0;T r=1;k=min(k,n-k);for(T i=n-k+1;i<=n;i++)r*=i;return r/factorial(k);}
template<class T> inline T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> inline T sum(vector<T>v){return reduce(all(v),0LL);}
#pragma endregion template

void solve(ll N, vector<ll> A) {
  vll B = A;
  sort(all(B));
  B.erase(unique(all(B)), B.end());
  Yes(A.size() == B.size());
}

int main() {
  ll N;
    ignore_ret(scanf("%lld",&N));
    vector<ll> A(N);
    for(int i = 0 ; i < N ; i++){
        ignore_ret(scanf("%lld",&A[i]));
    }
  solve(N, move(A));
  return 0;
}


Measured memory_bytes: 3328
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int T = nextInt();
		int[] t = nextInts();
		int x = 0;
		long sum=T;
		for(int i=1;i<N;i++){
			if(t[x]<t[i]&&t[i]<=t[x]+T){
				sum+=t[i]-t[x];
				x=i;
			}else{
				sum+=T;
				x=i;
			}
		}

		System.out.println(sum);


	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 47828
gets.to_i.times do
	number=gets.split(" ")
	
	for x in 0..number.size-1
		number[x]=number[x].to_i
	end
	
	right=[0]
	left=[0]
	
	for x in 0..number.size-1
		if number[x] > right[-1]
			right.push(number[x])
		elsif number[x] < right[-1] && number[x] > left[-1]
			left.push(number[x])
		else
			break
		end
	end
	
	if right.size + left.size == 12
		puts "YES"
	else
		puts "NO"
	end
end

Measured memory_bytes: 8636
n, x = map(int, input().split())
a = [int(i) for i in input().split()]
op = 0
for i in range(1, n):
    s = a[i-1] + a[i]
    if s > x:
        op += s - x
        if a[i] < s - x:
            a[i] = 0
        else:
            a[i] -= s - x
print(op)


Measured memory_bytes: 19860
S = str(input())
K = int(input())

N = len(S)

L = []

for i in range (0, N):
	L.append((97-ord(S[i]))%26)

W = []

for i in range (0, N-1):
	if L[i] <= K:
		W.append('a')
		K -= L[i]
	else:
		W.append(S[i])

V = (26-L[N-1]+K)%26
W.append(chr(97+V))
print(*W, sep="")

Measured memory_bytes: 12316
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <set>

#define INF_LL 1e18
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<int, PII> PPII;
typedef pair<int, PPII> PPPII;

ll dp[4040][6060];
int main(void){
	int N;
	ll piece[6060];
	memset(piece, 0, sizeof piece);
	memset(dp, 0, sizeof dp);
	cin >> N;
	REP(i, N){
		ll a;
		cin >> a;
		piece[i] = a;
		piece[N*1+i] = a;
		piece[N*2+i] = a;
	}
	FOR(i, N, 2*N){
		dp[i][i+1] = piece[i];
	}
	FOR(k, 1, N+1){
		REP(i, 2*N){
			int l = i, r = i+k;
			if(k % 2 == 0){
				if(piece[l] >= piece[r]){
					dp[l][r] = max(dp[l][r], dp[l+1][r]);
				}if(l > 0 && piece[l-1] <= piece[r-1]){
					dp[l][r] = max(dp[l][r], dp[l][r-1]);
				}
			}else{
				dp[l][r] = max(dp[l][r], dp[l+1][r]+piece[l]);
				dp[l][r] = max(dp[l][r], dp[l][r-1]+piece[r-1]);
			}
		}
	}
	ll res = 0;
	REP(i, N){
		res = max(res, dp[i][i+N]);
	}
	cout << res << endl;
}

Measured memory_bytes: 194356
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int d, e;

int main() {
	while (cin >> d >> e&&d + e) {
		double ans = INF;
		REP(i, d) {
			ans = min(ans, abs(sqrt(pow(d - i, 2) + pow(i, 2)) - e));
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3216
#include <stdio.h>

int possible_max[151201];

void make_list(void) {
	int now,now2;
	int i,j;
	for(i=0,now=0;now<=151200;i++,now=i*i*i) {
		for(j=0,now2=now;now2<=151200;j++,now2=now+(j*(j+1)*(j+2)/6)) {
			possible_max[now2]=1;
		}
	}
	possible_max[0]=0;
	for(i=1;i<=151200;i++) {
		possible_max[i]=possible_max[i]?i:possible_max[i-1];
	}
}

int main(void) {
	int query;
	make_list();
	while(1) {
		scanf("%d",&query);
		if(query==0)break;
		printf("%d\n",possible_max[query]);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	int ans = 0; 
	for(int i = 1; i <= N; i++){
		int a; cin >> a; 
		if((i % 2) && (a % 2)) ans ++; 
	}
	cout << ans << "\n"; 
}

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

string f(int a, int b){
  if(1 <= a && a <= 12){
    if(1 <= b && b <= 12)
      return "AMBIGUOUS";
    else
      return "MMYY";
  }
  else{
    if(1 <= b && b <= 12)
      return "YYMM";
    else
      return "NA";
  }
}

int main(void){
  int s;
  cin >> s;
  int a = s / 100;
  int b = s % 100;
  cout << f(a, b) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main (void){
  int a,b,c,k,ans;
  scanf("%d%d%d%d",&a,&b,&c,&k);
  
  if(k<a){ans=k;}
  else if(k-a<b){ans=a;}
  else{ans=a-(k-a-b);}
  printf("%d\n",ans);
}

Measured memory_bytes: 1712
import Text.Printf

main = getLine >>= solve 1 . input

-- 入力
input :: String -> Int
input = read

-- 解答
include3 i x n
  | x `mod` 10 == 3 = do
    p i
    solve (i + 1) n
  | otherwise = do
    let x' = div x 10
    if x' > 0 then include3 i x' n
    else solve (i + 1) n

solve i n | i > n = putStrLn ""
  | otherwise= do
    if i `mod` 3 == 0 then do
      p i
      solve (i+1) n
    else do
      include3 i i n

p i = putStr $ printf " %d" i


Measured memory_bytes: 4160
class UnionFind:
    def __init__(self, n):
        self.root = [i for i in range(n + 1)]
        self.size = [1] * (n + 1)
    def find(self, x):
        y = self.root[x]
        if x == y:
            return x
        else:
            z = self.find(y)
            self.root[x] = z
            return z
    def union(self, x, y):
        rx = self.find(x)
        ry = self.find(y)
        sx = self.size[rx]
        sy = self.size[ry]
        if rx == ry:
            return 0
        else:
            if sx >= sy:
                self.root[ry] = rx
                self.size[rx] = sx + sy
            else:
                self.root[rx] = ry
                self.size[ry] = sx + sy
        return sx * sy

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]

uf = UnionFind(N)
for a, b in AB:
    uf.union(a, b)

cnt = [0] * (N + 1)
for i in range(1, N + 1):
    cnt[uf.find(i)] += 1

print(max(cnt))

Measured memory_bytes: 117516
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;

int main() {
    int x, a, b;
    scanf("%d%d%d", &x, &a, &b);
    x -= a;
    x %= b;
    printf("%d\n", x);
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define nl '\n'
#define print(vec,l,r) for(int i = (l); i < (r); i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (b)-1; i >= (a); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];
#define debug(x) cerr << #x << " = " << (x) << endl;

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int , int> pi;

const int SIZE = 1e6+1;

void sieve(vi &isprime)
{
	for(int i=2; i<SIZE; i++)
	{
		if(isprime[i] != 0) continue;
		for(int j = i; j<SIZE; j+= i)
		{
			if(isprime[j] == 0)	isprime[j] = i;
		}
	}
} 

void solve()
{
	vector<int> isprime(SIZE);
	sieve(isprime);
	int n;
	cin>>n;
	map<int, int> count;
	for(int i=0; i<n; i++)
	{
		int temp;
		cin>>temp;
		while(temp != 1)
		{
			int t = isprime[temp];
			count[t]++;
			while(temp % t == 0) temp /= t;
		}
	}
	bool pair= true, set = true;
	for(auto it: count)
	{
		if(it.S > 1) pair = false;
		if(it.S == n) set = false;
	}
	if(pair) cout<<"pairwise coprime\n";
	else if(set) cout<<"setwise coprime\n";
	else cout<<"not coprime\n";	
}

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


Measured memory_bytes: 10848
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;

namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        const int INF = 2147483647;
        const long SINF = 9223372036854775807;

        static int N, Q, K;

        static List<List<Edge>> G = new List<List<Edge>>();
        static bool[] seen;
        static long[] dis;

        static int[] x, y;

        public static void Input()
        {
            var cin = new Scanner();
            N = int.Parse(Console.ReadLine());
            seen = new bool[N];
            dis = new long[N];
            for(var i = 0; i < N; i++)
            {
                G.Add(new List<Edge>());
            }
            for(var i = 0; i < N - 1; i++)
            {
                var input = cin.SplitReader();
                G[input[0] - 1].Add(new Edge(input[1] - 1, input[2]));
                G[input[1] - 1].Add(new Edge(input[0] - 1, input[2]));
            }
            var p = cin.SplitReader();
            Q = p[0];
            K = p[1] - 1;
            x = new int[Q];
            y = new int[Q];
            for(var i = 0; i < Q; i++)
            {
                var input = cin.SplitReader();
                x[i] = input[0] - 1;
                y[i] = input[1] - 1;
            }

        }

        static void Main(string[] args)
        {
            Input();
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            Dfs(K, 0);
            for(var i = 0; i < Q; i++)
            {
                Console.WriteLine(dis[x[i]] + dis[y[i]]);
            }
            
            Console.Out.Flush();
        }

        struct Edge
        {
            public int _to;
            public long _distance;

            public Edge(int t,long d)
            {
                _to = t;
                _distance = d;
            }
        }

        public static void Dfs(int v, long D)
        {
            seen[v] = true;
            dis[v] = D;
            foreach(var next in G[v])
            {
                if (seen[next._to]) { continue; }
                Dfs(next._to, D + next._distance);
            }
        }

    }

    
    

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }
}

    



Measured memory_bytes: 49532
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<functional>
#include<algorithm>
#include<bitset>
#include<utility>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
using namespace std;
string maxn(string a,string b)
{
    if(a.size()>b.size())
		return a;
    if(a.size()<b.size())
		return b;
    return a>b?a:b;
}
const int mp[11]={0,2,5,5,4,5,6,3,7,6};
int a[11];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
        cin>>a[i];
    vector<string>dp(10005,"$");
    dp[0]="";
    for(int i=0;i<=n;i++)
	{
        if(dp[i]=="$") 
			continue;
        for(int j=1;j<=m;j++)
            if(i+mp[a[j]]<=n)
                dp[i+mp[a[j]]]=maxn(dp[i+mp[a[j]]],dp[i]+char(a[j]+'0'));
    }
    cout<<dp[n]; 
    return 0;
}


Measured memory_bytes: 43776
#include <stdio.h>
#include <math.h>
#define DBL(a) ((a) * (a))
#define EPS 1e-8

int
main()
{
        char buf[256];
        double x1, y1, x2, y2, x3, y3, xp, yp;
        double s, a, b, c, p1, p2, p3;
        double sur[4];
        int i;

        while (fgets(buf, 256, stdin)) {
                sscanf(buf, "%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp);
                a = sqrt(DBL(x2 - x3) + DBL(y2 - y3));
                b = sqrt(DBL(x3 - x1) + DBL(y3 - y1));
                c = sqrt(DBL(x1 - x2) + DBL(y1 - y2));
                p1 = sqrt(DBL(xp - x1) + DBL(yp - y1));
                p2 = sqrt(DBL(xp - x2) + DBL(yp - y2));
                p3 = sqrt(DBL(xp - x3) + DBL(yp - y3));
                s = (a + b + c) / 2;
                sur[0] = sqrt(s * (s - a) * (s - b) * (s - c));
                s = (a + p2 + p3) / 2;
                sur[1] = sqrt(s * (s - a) * (s - p2) * (s - p3));
                s = (b + p3 + p1) / 2;
                sur[2] = sqrt(s * (s - b) * (s - p3) * (s - p1));
                s = (c + p1 + p2) / 2;
                sur[3] = sqrt(s * (s - c) * (s - p1) * (s - p2));
                if (sur[1] + sur[2] + sur[3] - sur[0] < EPS)
                        printf("YES\n");
                else
                        printf("NO\n");
        }

        return 0;
}

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

typedef long long LL;

int main()
{
	int n; cin>>n;
	LL ans=0;
	for(int i=1;i<=n;i++)
	{
		if(i%3==0||i%5==0)
			continue;
		else
			ans+=i;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;

long Xor(long x){
    long r=0;

    r += (x+1) / 2 % 2;

    for(int i=1; i<40; i++){
        long pi;
        pi = (long)1 << i;

        long tmp = (x+1) % (pi * 2) - pi;

        if(tmp > 0){
            if (tmp % 2 == 1){
                r += pi;
            }
        }
    }
    return r;
}

int main() {
    long a, b, result;
    cin >> a >> b;

    result= Xor(a-1) ^ Xor(b);

    cout << result << endl;
}

Measured memory_bytes: 256
def input_int():
    hoge = input()
    return int(hoge)

if __name__ == "__main__":
    hoge = input_int()
    for i in range(10):
        for k in range(10):
            piyo = i * k
            if piyo == hoge:
                print("Yes")
                exit(0)
    print("No")


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

using namespace std;

struct Block
{
    int w, s, v;
    bool operator<(const Block data) const
    {
        return (w + s != data.w + data.s ? w + s < data.w + data.s : s < data.s);
    }
};

int n;
Block a[1005];
long long dp[1005][20005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i].w >> a[i].s >> a[i].v;
    }
    sort(a + 1, a + n + 1);
    int m = a[n].s * 2;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            dp[i][j] = dp[i - 1][j];
            if (j >= a[i].w && j - a[i].w <= a[i].s)
            {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - a[i].w] + a[i].v);
            }
        }
    }
    long long ans = 0;
    for (int i = 1; i <= m; i++)
    {
        ans = max(ans, dp[n][i]);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 159896
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;

double f(double h, double r, double x) {
    return h + r - sqrt(r*r - x*x);
}

int main() {
    double r;
    int n;
    while (cin >> r >> n, (r != 0 || n != 0)) {
        static const int OFFSET = 25;
        vector<int> heights(50);
        for (int i = 0; i < n; ++i) {
            int left, right, height;
            cin >> left >> right >> height;
            for (int x = left; x < right; ++x)
                heights[x+OFFSET] = max(heights[x+OFFSET], height);
        }

        double ans = HUGE_VAL;
        for (int x = -r; x < r; ++x) {
            double t;
            if (x < 0)
                t = f(heights[x+OFFSET], r, x+1);
            if (x >= 0)
                t = f(heights[x+OFFSET], r, x);
            ans = min(ans, t);
        }

        cout << setprecision(20) << ans << endl;
    }
}

Measured memory_bytes: 1292
N = int(input())
S = input()
int_s = [0] * N
cum_sum_w = [0] * (N + 1)
cum_sum_e = [0] * (N + 1)
answers = [0] * N
for i in range(N):
    if (S[i] == 'W'):
        int_s[i] = 1
    else:
        int_s[i] = 0
    cum_sum_w[i + 1] = cum_sum_w[i] + int_s[i]
for i in range(N):
    if (S[i] == 'E'):
        int_s[i] = 1
    else:
        int_s[i] = 0
    cum_sum_e[i + 1] = cum_sum_e[i] + int_s[i]
for i in range(N):
    answers[i] = cum_sum_w[i] + (cum_sum_e[N] - cum_sum_e[i + 1])
print(min(answers))


Measured memory_bytes: 41124
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int a,b,c,d;
  cin>>c>>d>>a>>b;
  if(a==-1 || b==-1){
      if(c<d) cout<<"Alice"<<endl;
      else if(c>d) cout<<"Bob"<<endl;
      else cout<<"Draw"<<endl;
  }
  else{
    if(a>b) cout<<"Alice"<<endl;
    else if(b>a) cout<<"Bob"<<endl;
    else cout<<"Draw"<<endl;
      
  }


  return 0;
}


Measured memory_bytes: 3212
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
vector<string>split(string s, char c = ' ') {
	vector<string>vec;
	string h = "";
	for (int i = 0; i < s.size();) {
		int j = i;
		while (j < s.size() && s[j] != ' ') {
			h += s[j++];
		}
		if (h.size() > 0) vec.push_back(h);
		h = "";
		i = j + 1;
	}
	return vec;
}
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	int n = read(), sum = 0;
	for (int i = 0; i < n; i++) {
		int p = read();
		while (p % 2 == 0) {
			sum++;
			p /= 2;
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var hash = new HashSet<int>();
            foreach (var item in Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray())
            {
                hash.Add(item);
            }

            var answer = hash.Count == 2 ? "Yes" : "No";
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13404
#include <iostream>
using namespace std;
 int main(){
  string S;
  cin >> S;

  if(S =="Sunny"){
      cout << "Cloudy" << endl;
  }

    if(S =="Cloudy"){
      cout << "Rainy" << endl;
  }

    if(S =="Rainy"){
      cout << "Sunny"<< endl;
  }
}

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





int main(void){
    int A,B;
    cin>>A>>B;
    int N=16;
    if(A<9&&B<9){
        cout << "Yay!"<< endl;
    }else{
        cout << ":("<< endl;
    }



    return 0;
}


//Yay!
//:(

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

	public void Proc()
	{
        int groupCount = int.Parse(Reader.ReadLine());

        int ans = 0;
        for (int i = 0; i < groupCount; i++) {
            int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            ans += inpt[1] - inpt[0] + 1;
        }
        Console.WriteLine(ans);



	}


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"

2
6 8
3 3


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 13268
fgen x i = "Case " ++ (show i) ++ ": " ++ (show x)
body :: Int -> IO ()
body i = do
         ln <- getLine
         let x = read ln :: Int
         if (x == 0) then return () else do
           putStrLn $ fgen x i
           body (i + 1)

main = body 1

Measured memory_bytes: 4036
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

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

void solve(long long N, std::vector<long long> A)
{
    vector<ll> ans(N);

    ll sum = 0;
    for (int i = 0; i < N; i++)
    {
        if (i % 2 == 0)
        {
            sum += A[i] * 2;
        }
        else
        {
            sum -= A[i] * 2;
        }
    }

    ans[0] = sum / 2;

    for (int i = 1; i < N; i++)
    {
        ans[i] = (A[i - 1] - (ans[i - 1] / 2)) * 2;
    }

    for (int i = 0; i < N - 1; i++)
    {
        cout << ans[i] << " ";
    }
    cout << ans[N - 1] << endl;
}

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


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

using namespace std;

int N;

int gcd (int a, int b)
{
    int r;
    while (b)
        r = a % b,
        a = b,
        b = r;
    return a;
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d", &N);
printf ("%d\n", 360 / gcd (N, 360));

return 0;
}


Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n;
  cin >> n;
  int p[n],q[n];
  rep(i,n) cin >> p[i];
  rep(i,n) cin >> q[i];

  vector<int> v;
  rep(i,n) v.pb(i+1);
  int c=0;
  int pa,qa;
   do {
     c++;
     bool ok=true;
     rep(i,n){
       //       cout << v[i] << " ";
       if(p[i]!=v[i]){
	 ok=false;
	 break;
       }
     }
     if(ok) pa=c;
     
     ok=true;
     rep(i,n){
       if(q[i]!=v[i]){
	 ok=false;
         break;
       }
     }
     if(ok) qa = c;
  } while (std::next_permutation(v.begin(), v.end()));
   //   cout << qa << " " << pa << endl;
   cout << abs(qa-pa) << endl;


  
  return 0;
    

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> A(3, vector<int>(3));
  bool c = false;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  for (int h = 0; h < N; h++) {
    int b;
    cin >> b;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (A.at(i).at(j) == b) {A.at(i).at(j) = 0;}
      }
    }
  }
  for (int i = 0; i < 3; i++) {
    if (A.at(0).at(i) == 0 && A.at(1).at(i) == 0 && A.at(2).at(i) == 0) {c = true;}
  }
  for (int i = 0; i < 3; i++) {
    if (A.at(i).at(0) == 0 && A.at(i).at(1) == 0 && A.at(i).at(2) == 0) {c = true;}
  }
  if (A.at(0).at(0) == 0 && A.at(1).at(1) == 0 && A.at(2).at(2) == 0) {c = true;}
  else if (A.at(0).at(2) == 0 && A.at(1).at(1) == 0 && A.at(2).at(0) == 0) {c = true;}
  if (c) {cout << "Yes" << endl;}
  else {cout << "No" << endl;}
}

Measured memory_bytes: 3616
/*
 * if you are interested in the reference code here,
 * see https://github.com/georeth/OJLIBS for more information
 *
 * Solution Author : Georeth Chow <georeth2010@gmail.com>
 */
#include <cstdio>
#include <cmath>
#include <climits>      // INT_MIN LLONG_MIN
#include <cfloat>       // DBL_MIN DBL_MAX
#include <cstring>      // memset
#include <cstdlib>      // malloc
#include <cstdint>      // int64_t
#include <cinttypes>    // PRId64 SCNd64
#include <cassert>      // assert
#include <limits>       // numeric_limits
#include <vector>
#include <deque>
#include <map>
#include <set>
#include <tuple>        // pair, tuple
#include <iostream>     // be careful.
                        // mix with cstdio: slowwww...
                        // mix with cstdio + fastio: bug
#include <sstream>
#include <algorithm>
using namespace std;    // use as solution header. name polution is fine.
#ifdef LOCAL_JUDGE
#  define pr_debug(...) fprintf(stderr, __VA_ARGS__)
#  define pr_line() fprintf(stderr, "%s: %d\n", __FILE__, __LINE__)
#else
#  define pr_debug(...)
#  define pr_line()
#endif
template <typename T>
bool chmax(T &m, const T &v) { if (v > m) return m = v, true; return false; }
template <typename T>
bool chmin(T &m, const T &v) { if (v < m) return m = v, true; return false; }
static const int HMAX32 = INT32_MAX / 2;
static const int HMIN32 = -HMAX32;
static const int64_t HMAX64 = INT64_MAX / 2;
static const int64_t HMIN64 = -HMAX64;
void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
#define read_int(id) scanf("%d", &id)
#define read_int64(id) scanf("%" PRId64, &id)
#define new_int(id) int id; read_int(id)
#define new_int64(id) int64_t id; read_int64(id)
#define ALL(x) begin(x), end(x)
/* =====  SOLUTION START  ===== */
int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if (abs(a - x) <= abs(b - x)) {
        printf("A\n");
    } else {
        printf("B\n");
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
        int B = sc.nextInt();
      
      if(A<=5){System.out.print(0);}
      else if(A>=13){System.out.print(B);}
      else{{System.out.print(B/2);}}
      
		
	}
}


Measured memory_bytes: 21716
#include <stdio.h>
#include <ctype.h>



int main(){
    char S1[25];
    char S2[25];
    char S3[25];
    char S4[4];
    scanf("%s %s %s",S1,S2,S3);

    S4[0] = toupper(S1[0]);
    S4[1] = toupper(S2[0]);
    S4[2] = toupper(S3[0]);
    S4[3] = '\0';

    printf("%s\n",S4);
return 0;
}


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

int main(){
    int A, B, C;
    cin >> A >> B >> C;

    if(A == B){
        cout << C << endl;
    }
    if(C == B){
        cout << A << endl;
    }
    if(A == C){
        cout << B << endl;
    }

    return 0;
}


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

float x[10010], y[10010];
int s[10010];

int tax(float rate, int price_without_tax)
{
  return  (int)price_without_tax*(100+rate) / 100;//((100 + rate) / 100) * price_without_tax;
}

int solve(int X, int Y, int S)
{
  int maximum = 0;
  for (int i = 1; i < S; ++i)
  {
    for (int j = i; j < S; ++j)
    {
      if (tax(X, i) + tax(X, j) == S)
      {
        if (maximum < tax(Y, i) + tax(Y, j))
        {
          maximum = tax(Y, i) + tax(Y, j);
        }
      }
    }
  }
  return maximum;
}

#if 0
int solve(int s,double rate){
  int maximum = 0;
  
  for(int i = 0; i < s; i++){
    for(int j = 0; j < s; ++j){
      if(tax(rate, ) + tax(x[j], j) == s){
        if(maximum < tax(y[i],i)+tax(y[j],j)){
          maximum = tax(y[i],i)+tax(y[j],j);
        }
      }
    }
  }
  return maximum;
}
#endif

int main()
{
  for (int i = 0; i < 1000000; ++i)
  {
    cin >> x[i] >> y[i] >> s[i];
    if(x[i] == 0 && y[i] == 0 && s[i] == 0){
      break;
    }
    cout << solve(x[i], y[i], s[i]) << endl;
  }
  
}



Measured memory_bytes: 3096
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int E = sc.nextInt();
		int F = sc.nextInt();

		int waterA;
		int waterB;
		int remain;
		int remainSugar;
		int sugarC;
		int sugarD;
		double noudo;
		double noudoMax = 0;
		int ansWater = 0;
		int ansSugar = 0;

		for (int i=0; (100*A*i)<=F; i++){
			waterA = 100*A*i;
			for (int j=0; (waterA + (100*B*j)) <=F; j++){
				waterB = 100*B*j;
				remain = F - (waterA + waterB);
				remainSugar = (waterA + waterB) * E / 100;
				for (int k=0; k*C<=remain && k*C <=remainSugar; k++){
					sugarC = k*C;
					for (int l=0; l*D<=(remain-sugarC) && l*D <= (remainSugar - sugarC); l++){
						sugarD = l*D;
						if (waterA + waterB > 0){
							noudo = (double)(sugarC + sugarD) / (double)(waterA + waterB);
							if (noudo >= noudoMax){
								ansWater = waterA + waterB;
								ansSugar = sugarC + sugarD;
								noudoMax = noudo;
							}
						}
					}
				}
			}
		}
		System.out.println(ansWater + ansSugar + " " + ansSugar);
	}
}


Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {
    static Scanner s = new Scanner(System.in);

    public static void main(String[] args) {
        int n = s.nextInt();
        int mille=dayCulc(1000,1,1);

        while (n--!=0){
            int year=s.nextInt();
            int month=s.nextInt();
            int day=s.nextInt();

            int sum=dayCulc(year,month,day);

            System.out.println(mille-sum);
        }
    }

    static int dayCulc(int year,int month,int day){
        int sum=0;
        for(int i=1;i<year;i++){
            if(i%3==0)
                sum+=200;
            else
                sum+=195;
        }

        for(int j=1;j<month;j++){
            if(j%2==1 || year%3==0)
                sum+=20;
            else
                sum+=19;
        }
        sum+=day;

        return sum;
    }
}

Measured memory_bytes: 20564
package main

import (
        "bufio"
        "fmt"
        "os"
)

var sc = bufio.NewScanner(os.Stdin)

func readLine() string {
        sc.Scan()
        return sc.Text()
}

func lowerBound(a []int, x int) int {
        n := len(a)
        ok := n
        ng := -1
        for ok-ng > 1 {
                mid := (ok + ng) / 2
                if a[mid] >= x {
                        ok = mid
                } else {
                        ng = mid
                }
        }
        return ok
}

func main() {
        sc.Buffer(make([]byte, 200000*1+1), 200000)
        var s string
        var t string

        s = readLine()
        t = readLine()

        idxs := make([][]int, 256)

        for i := 0; i < len(s); i++ {
                idxs[s[i]] = append(idxs[s[i]], i)
        }

        n := int64(len(s))
        cur := int64(0)
        ng := false

        for i := 0; i < len(t); i++ {
                is := idxs[t[i]]
                if is == nil || len(is) == 0 {
                        ng = true
                        break
                }
                base := (cur / n) * n

                nidx := lowerBound(is, int(cur%n))
                if nidx == len(is) {
                        cur = base + int64(is[0]) + n + 1
                } else {
                        cur = base + int64(is[nidx]) + 1
                }
        }
        if ng {
                fmt.Println(-1)
        } else {
                fmt.Println(cur)
        }
}


Measured memory_bytes: 5888
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	
	public static class Walk implements Comparable<Walk>{
		int row, x;
		int pass;
		int denger;
				
		public Walk(int row, int x, int pass, int denger) {
			super();
			this.row = row;
			this.x = x;
			this.pass = pass;
			this.denger = denger;
		}

		@Override
		public int compareTo(Walk arg0) {
			return this.denger - arg0.denger;
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while (true) {
			final int n = sc.nextInt();
			final int m = sc.nextInt();
			
			ArrayList<Map<Integer, Integer>> list = new ArrayList<Map<Integer, Integer>>();
			
			if(n == 0 && m == 0){
				break;
			}
			
			for(int i = 0; i < n; i++){
				final int k = sc.nextInt();
				
				list.add(new HashMap<Integer, Integer>());
				
				for(int j = 0; j < k; j++){
					final int x = sc.nextInt();
					final int d = sc.nextInt();
					
					list.get(i).put(x, d);
				}
			}
			
			PriorityQueue<Walk> queue = new PriorityQueue<Main.Walk>();
			for(int start : list.get(0).keySet()){
				queue.add(new Walk(0, start, m, 0));
			}
			if(m > 0){
				for(int start : list.get(1).keySet()){
					queue.add(new Walk(1, start, m - 1, 0));
				}
			}
			boolean[][][] visited = new boolean[m+1][n][1001];
			
			while(!queue.isEmpty()){
				Walk walk = queue.poll();
				
				if(visited[walk.pass][walk.row][walk.x]){
					continue;
				}else{
					visited[walk.pass][walk.row][walk.x] = true;
				}
				
				if(walk.row == n - 1){
					System.out.println(walk.denger);
					break;
				}else if(walk.row == n - 2 && walk.pass > 0){
					System.out.println(walk.denger);
					break;
				}
				
				//System.out.println(walk.row + " " + walk.x + " " + walk.pass);
				
				final int cur_d = list.get(walk.row).get(walk.x);
				
				if(walk.row < n - 1){
					for(Map.Entry<Integer, Integer> entry : list.get(walk.row + 1).entrySet()){
						if(visited[walk.pass][walk.row + 1][entry.getKey()]){
							continue;
						}
						
						queue.add(new Walk(walk.row + 1, entry.getKey(), walk.pass, walk.denger + (cur_d + entry.getValue()) * Math.abs(walk.x - entry.getKey())));
					}
				}
				
				if(walk.pass > 0 && walk.row < n - 2){
					for(Map.Entry<Integer, Integer> entry : list.get(walk.row + 2).entrySet()){
						if(visited[walk.pass][walk.row + 2][entry.getKey()]){
							continue;
						}
						
						queue.add(new Walk(walk.row + 2, entry.getKey(), walk.pass - 1, walk.denger + (cur_d + entry.getValue()) * Math.abs(walk.x - entry.getKey())));
					}
				}
			}
			
		}
	}

}

Measured memory_bytes: 107100
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (300006)
#define MAXK 26
#define MAXX 15000006
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n, A[MAXN], backgcd[MAXN], frontgcd[MAXN];
ll gcd(ll a, ll b) {
	if(min(a,b)==0) return max(a,b);
	if(a>b) swap(a,b);
	return gcd(b%a,a);
}
int main()
{
	FAST
	cin>>n;
	FOR(i,1,n+1) cin>>A[i];
	FOR(i,1,n+1) frontgcd[i]=gcd(frontgcd[i-1],A[i]);
	for(ll i=n;i>=1;--i) backgcd[i]=gcd(backgcd[i+1],A[i]);
	ll ans = 0;
	FOR(i,1,n+1) {
		ans = max(ans, gcd(frontgcd[i-1], backgcd[i+1]));
	}
	cout<<ans;
}


Measured memory_bytes: 5120
from collections import deque

n = int(input())

es = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    es[u].append((v, w))
    es[v].append((u, w))

s = 0
ans = [None] * n
ans[s] = 0

dq = deque()
dq.append(s)

while dq:
    v = dq.popleft()
    for nv, w in es[v]:
        if ans[nv] is None:
            ans[nv] = (ans[v] + w) % 2
            dq.append(nv)
print(*ans, sep='\n')


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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;


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

	int n;cin>>n;

	map<int ,int >mp;

	for(int i=1; i<=n; i++){
		int tmp ; cin>>tmp;
		mp[tmp] =i ;
	}

	for(auto e :mp){
		 cout<<e.second<<" ";
	}
	cout<<endl;

}




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


int main(){
	int flag=0,flag1=0;
	string str;
	cin>>str;
	for(int i=0;i<str.length();i++){
		if(str[i]=='C')
		    flag=1;
		if(flag&&str[i]=='F'){
			printf("Yes");
			flag1=1;
			break;
		}
	}
	if(!flag1)
	    printf("No\n");
	return 0;
} 

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a<=0&&b>=0){
    cout << "Zero" << endl;
  }
  else if(a<=0&&b<=0&&(b-a)%2==0){
    cout << "Negative" << endl;
  }
  else{
    cout << "Positive" << endl;
  }
}


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

int main(){
	int n,x;
	while(true){
		cin>>n>>x;
		if(n==0&&x==0)break;
		
		int k=0;
		for(int a=1;a<=n;a++){
			for(int b=a+1;b<=n;b++){
		        for(int c=b+1;c<=n;c++){
					if(a+b+c==x)k++;
				}
			}
		}
		cout<<k<<endl;
	}
	return 0;
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
// #define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
const int INF = 1e9 + 7;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    while(1){
        cin >> n;
        if(n == 0) break;
        vector<PP> d; // start, len, id;
        rep(i, 0, n){
            char c;
            int id, len;
            cin >> c >> id;
            if(c == 'W'){
                cin >> len;
                rep(j, 0, d.size()){
                    if(len == 0) break;                    
                    if(d[j].second.second == -1){
                        int sz = d[j].second.first;
                        int st = d[j].first;
                        if(len < sz){
                            d.push_back(PP(st + len, P(sz - len, -1)));
                            d[j].second.first = len;
                            d[j].second.second = id;
                            len = 0;
                            break;
                        }else{
                            len -= sz;
                            d[j].second.second = id;  
                        }
                    }
                }
                int right = 0;
                if(len > 0){
                    if(d.size() == 0){
                        right = 0;
                    }else{
                        right = d[d.size() - 1].first + d[d.size() - 1].second.first;
                    }
                    d.push_back(PP(right, P(len, id)));
                }
            }else if(c == 'D'){
                rep(j, 0, d.size()){
                    if(d[j].second.second == id){
                        d[j].second.second = -1;
                    }
                }
            }else if(c == 'R'){
                int idx = upper_bound(all(d), PP(id, P(INF, INF))) - d.begin();
                // cout << id << ' ' << idx << endl;
                if(idx == d.size()){
                    if(d.size() == 0) cout << -1 << endl;
                    else{
                        int r = d[d.size() - 1].first + d[d.size() - 1].second.first;
                        if(id < r){
                            cout << d[d.size() - 1].second.second << endl;
                        }else{
                            cout << -1 << endl;
                        }
                    }
                }else{
                    idx--;
                    assert(0 <= idx && idx < d.size());                    
                    cout << d[idx].second.second << endl;          
                }
            }
            sort(all(d));   
        }
        cout << endl;
    }
}


Measured memory_bytes: 3260
x,y=map(int,input().split())
ans=float("INF")
for i in range(4):
    n,m=x,y
    f=0
    if i//2:n=-x;f+=1
    if i%2:m=-y;f+=1

    ans=min(ans,float("INF") if n>m else m-n+f)
print(ans)

Measured memory_bytes: 3060