akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define SIZE 200010
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%d",&t)
#define p(t) printf("%d\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define print(x) for(auto el: x) cout<<el<<" ";cout<<endl
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<int,vector<int>,greater<int> >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define mitr map<int,int>:: iterator


#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl


int32_t main()
{
    fast;
    int a,b,c;cin>>a>>b>>c;
    cout<<c-min(c,a-b);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<set>
#include<string>
#include<algorithm>
using namespace std;
set<string> p;
char a[10];
int main()
{
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%s",a);
        p.insert(a);
    }
    if(p.size()==3)
        printf("Three\n");
    else
        printf("Four\n");
    return 0;
}


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

using namespace std;

int main()
{
    int H = 0;
    int W = 0;
    cin >> H >> W;
    int selecth = 0;
    int selectw = 0;
    cin >> selecth >> selectw;

    cout << H*W-(selecth*W)-(selectw*(H-selecth));

    return 0;
}   


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m=numeric_limits<T>::max()){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


int main() {
  string s; cin >>s;
  int batu = 0;
  rep(i, s.size()) if (s[i] == 'x') batu++;
  bool ok = 15-batu >= 8;
  cout <<(ok ? "YES" : "NO") <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<time.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<list>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const double pi = acos(-1);
#define debug(x) cout<<#x<<" = "<<x<<endl;
#define pb(x) push_back(x)
int read(){
	int rt=0,fl=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')fl=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){rt=rt*10+ch-'0';ch=getchar();}
	return rt*fl;
}
ll readl(){
	ll rt=0,fl=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')fl=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){rt=rt*10+ch-'0';ch=getchar();}
	return rt*fl;
}
void write(ll num){
	if(!num)putchar('0');
	static char str[50];
	static int cnt=0;
	while(num){str[++cnt]=num%10+'0';num/=10;}
	while(cnt){putchar(str[cnt--]);}
}
int n;
int t,x,y;
int main(){
	n=read();
	for(int i=1;i<=n;i++){
		int a=read(),b=read(),c=read();
		int delta = abs(x-b)+abs(y-c);
		int dt = a-t;
		if(dt >= delta && (dt-delta)%2==0 ){
			t=a;
			x=b;
			y=c;
		}else{
			cout<<"No";return 0;
		}
	}
	cout<<"Yes";
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define test int t;cin>>t;while(t--)
#define all(x) x.begin(),x.end()
#define setp(x) fixed<<setprecision(x)
#define Pi 3.14159265358979323846264338
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define forn(i, n) fore(i, 0, n)
#define mp make_pair
#define pb push_back
#define pi pair<int,int>
#define pii pair<int,pair<int,int> >
#define ff first
#define ss second
#define maxn 400001
typedef long long int ll;
typedef vector<vector<ll> > mat;
//********************* mat *********************
/*mat matMul(mat A,mat B,ll m)
{int r1=A.size(),r2=B.size(),c1=A[0].size(),c2=B[0].size();mat ans(r1);for(int i=0;i<r1;i++)
for(int j=0;j<c2;j++)
{ll mul=0;for(int k=0;k<c1;k++)
mul=(mul+A[i][k]*B[k][j])%m;ans[i].pb(mul);}
return ans;}
mat matPow(mat x,ll n,ll m)
{int r=x.size(),c=x[0].size();mat result(r);forn(i,r)
forn(j,c)
{if(i==j)
result[i].pb(1);else
result[i].pb(0);}
while(n>0)
{if(n%2==1)
result=matMul(result,x,m);x=matMul(x,x,m);n=n/2;}
return result;}  */
//******************** mat **********************
ll mod=1e9+7;
ll pow1(ll x,ll n,ll m)  {  ll result=1; while(n>0) {  x%=m; if(n % 2 ==1) result=(result * x)%m; x=(x*x)%m; n=n/2; } return result; } 
//ll pow2(ll x,ll n)  {  ll result=1; while(n>0) {   if(n % 2 ==1) result=(result * x); x=(x*x); n=n/2; } return result; }
//ll modInverse(ll A,ll M) { return pow1(A,M-2,M); }
//ll f[1000001];
//void fact() { f[0]=f[1]=1; for(int i=2;i<=1e6;i++) f[i]=(f[i-1]*i)%mod;} 
//ll gcd(ll a,ll b) { if(b==0) return a; else return gcd(b,a%b); }          
const int Size=1e6+1;        
//------------------------------------------------------------------------------------------------------------------------------------//

int main()
{
    //fast;
    int n; cin>>n;
    int s=0,a[n];
    forn(i,n){
    	cin>>a[i];
    	s+=a[i];
	}
	bitset<4000001> dp;
	dp[0]=1;
	forn(i,n)
	{
		dp=dp | (dp<<a[i]);
	}
	for(int i=(s+1)/2;i<=s;i++)
	{
		if(dp[i])
		{
			cout<<i;
			return 0;
		}
	}
	
    return 0;
}

Measured memory_bytes: 2304
#include <stdio.h>

int main(void)
{
	int N, M, i=1;
	scanf("%d %d", &N, &M);

	int L, R, min, max;
	while (i <= M) {
		scanf("%d %d", &L, &R);
		if (i == 1) {
			min = L; max = R;
		}
		else {
			if (L > min)min = L;
			if (R < max)max = R;
		}

		i++;
	}
	if (max - min < 0)printf("0");
	else if (max - min == 0)printf("1");
	else printf("%d", max - min + 1);
	
	return 0;
}

Measured memory_bytes: 128
a,b,k = map(int,input().split())
ans = []
for i in range(k):
  if a <= a+i <= b:
    ans.append(a+i)
  if a <= b-i <= b:
    ans.append(b-i)
ans.sort()
last = 'null'
for i in range(len(ans)):
  if ans[i] != last:
    print(ans[i])
  last = ans[i]

Measured memory_bytes: 3060
#ifndef _TEMPLATE_ROOT
#define _TEMPLATE_ROOT
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
#define repd(i, a, b) for(int i = b; i >= (a); --i)
#define repdl(i, a, b) for(ll i = b; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
#endif
#ifndef _TEMPLATE_IO
#define _TEMPLATE_IO

template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
#endif
#ifndef _TEMPLATE_BS
#define _TEMPLATE_BS

template<class T, class U>
T lower_bound_on(T first, T last, const U value, const function<U(T)>& fn) {
	T it, step, count = last - first;
	while (count > 0) {
		it = first + (step = count / 2);
		if (fn(it) < value)
			first = ++it, count -= step + 1;
		else
			count = step;
	}
	return first;
}
template<class T, class U>
T upper_bound_on(T first, T last, const U value, const function<U(T)>& fn) {
	T it, step, count = last - first;
	while (count > 0) {
		it = first + (step = count / 2);
		if (!(value < fn(it)))
			first = ++it, count -= step + 1;
		else	
			count = step;
	}
	return first;
}
#endif
using namespace std;

int n;
ll k;
int a[200005];

int can(const ll x) {
  ll ttl = 0;
  for (int i = 0; i < n; i++) {
    ttl += (a[i] - 1) / x;
  }
  return int(ttl <= k);
}

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  read(n, k);
  rep(i, 0, n) read(a[i]);

  ll ans = lower_bound_on(1ll, 1'000'000'000ll, 1, (function<int(ll)>)can);
  write(ans);
}



Measured memory_bytes: 4428
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef long long ll;

int main() {
    int h, w; cin >> h >> w;
    vector<string> s(h);
    int wnum = 0;
    for (int i = 0; i < h; i++)
    {
        cin >> s[i];
        for (int j = 0; j < w; j++)
        {
            if (s[i][j] == '.') wnum += 1;
        }
    }

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

    vector<vector<int>> dist(h, vector<int>(w, -1));
    queue<pair<int, int>> que;

    dist[0][0] = 1;
    que.push(make_pair(0, 0));

    while (!que.empty()) {
        int wx = que.front().first;
        int wy = que.front().second;
        que.pop();
        for (int i = 0; i < 4; i++) {
            int nx = wx+dx[i], ny = wy+dy[i];

            if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;

            if (s[nx][ny] == '#') continue;

            if (dist[nx][ny] == -1) {
                dist[nx][ny] = dist[wx][wy]+1;
                // cout << dist[nx][ny] << endl;
                que.push(make_pair(nx, ny));
            }
        }
    }

    if (dist[h-1][w-1] == -1) cout << -1 << endl;
    else cout << wnum - dist[h-1][w-1] << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

class priorityQueue {
private:
    long *queueArray;
    long size;
public:
    priorityQueue() {
        this->queueArray = new long[2000001];
        this->size = 0;
    }

    void print() {
        for (int i = 1; i <= size; i++) {
            cout << queueArray[i] << " ";
        }
        cout << endl;
    }

    void insert(long num) {
        this->queueArray[size+1] = num;
        size++;
        heapfyInsert();
        //print();
    }

    long remove() {
        long max = queueArray[1];
        queueArray[1] = queueArray[size];
        size--;
        heapfyRemove();
        //print();
        return max;
    }

    void heapfyInsert() {
        bool heap = false;
        long pos = size;
        while (!heap && pos > 1) {
            if (queueArray[pos] < queueArray[pos / 2]) {
                heap = true;
            } else {
                long aux = queueArray[pos];
                queueArray[pos] = queueArray[pos / 2];
                queueArray[pos / 2] = aux;
                pos = pos / 2;
            }
        }
    }

    void heapfyRemove() {
        bool heap = false;
        long pos = 1;
        long biggest;
        while(!heap && pos < size) {
            if (pos * 2 <= size && queueArray[2 * pos] > queueArray[pos] && queueArray[2 * pos] > queueArray[2 * pos + 1]) {
                biggest = 2 * pos;
            }else if(pos * 2 + 1 <= size && queueArray[2 * pos + 1] > queueArray[pos]){
                biggest = 2*pos+1;
            }else{
                biggest = pos;
            }
            if(biggest != pos) {
                long aux = queueArray[pos];
                queueArray[pos] = queueArray[biggest];
                queueArray[biggest] = aux;
                pos = biggest;
            }else{
                heap = true;
            }
        }
    }
};


int main() {
    auto heap = new priorityQueue();
    string operation;
    long n;
    while (cin >> operation && operation != "end") {
        if (operation == "insert") {
            cin >> n;
            heap->insert(n);
        } else {
            long aux = heap->remove();
            cout << aux << endl;
        }
    }
    //heap->print();
    return 0;
}


Measured memory_bytes: 10824
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,k;
	cin>>k>>x;
	int st=x-k+1,ed=x+k-1;
	if(st<-1000000) st=-1000000;
	if(ed>1000000) ed=1000000;
	for(int i=st;i<=ed;++i){
		printf("%d%s",i,i==ed?"\n":" ");
	}
	
	
	return 0;
}

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

vector<bool> seen(200000, false);

void dfs(vector<vector<int>> &con, int num, vector<int> &ope)
{
	seen.at(num) = true;
	for (int con_ele : con.at(num)) {
		if (seen.at(con_ele) == false) {
			ope.at(con_ele) += ope.at(num);
			dfs(con, con_ele, ope);
		}
	}
};

int main()
{
	int n, q;
	cin >> n >> q;
	vector<vector<int>> points(n);
	for (int i = 0; i < n - 1; i++) {
		int a_in, b_in;
		cin >> a_in >> b_in;
		points.at(a_in - 1).push_back(b_in - 1);
		points.at(b_in - 1).push_back(a_in - 1);
	}
	vector<int> ope(n, 0);
	for (int i = 0; i < q; i++) {
		int p_in, x_in;
		cin >> p_in >> x_in;
		ope.at(p_in - 1) += x_in;
	}

	dfs(points, 0, ope);

	for (int ope_ele : ope) {
		cout << ope_ele << " ";
	}
	cout << endl;
}


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

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}

template <typename T> inline bool CheckMax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}

template <typename T> inline bool CheckMin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}

const int N = 100005;

int n, m, s, x[N], seq[N];
LL ans, p[N];

int main() {
#ifdef wxh010910
  freopen("d.in", "r", stdin);
#endif
  Read(n), Read(s);
  for (int i = 1; i <= n; ++i) {
    Read(x[i]), Read(p[i]);
  }
  int l = 1, r = n;
  while (true) {
    if (x[r] < s) {
      for (int i = l; i <= r; ++i) {
        seq[++m] = x[i];
      }
      break;
    }
    if (x[l] > s) {
      for (int i = r; i >= l; --i) {
        seq[++m] = x[i];
      }
      break;
    }
    if (p[l] >= p[r]) {
      p[l] += p[r], seq[++m] = x[r--];
    } else {
      p[r] += p[l], seq[++m] = x[l++];
    }
  }
  for (int i = n; i; --i) {
    ans += abs(s - seq[i]), s = seq[i];
  }
  printf("%lld\n", ans);
#ifdef wxh010910
  Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}


Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
#import numpy as np
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())

S = str(input())

if len(S)%2 == 1 :
  print ("No")
  exit()
else :
  c = len(S)//2
  st = ""
  for _ in range(c) :
    st += "hi"
  if S == st :
    print ("Yes")
  else :
    print ("No")


Measured memory_bytes: 3564
N = int(input())
def dfs(s):
  if len(s) == N:
    print(s)
    return
  else:
    for i in range(ord("a"), ord("z")+1):
      if max(list(s)) != chr(i-2):
        dfs(s+chr(i))
      else:
        return
dfs("a")

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

using namespace std;
long long n,x,y,i,dpw[100005],dpb[100005];
const int mod=1e9+7;
vector <int>v[100005];
void dfs(int nod,int p)
{
    dpw[nod]=1;
    dpb[nod]=1;
    for(auto i:v[nod])
        if(i!=p)
    {
        dfs(i,nod);
        dpw[nod]=dpw[nod]*(dpw[i]+dpb[i])%mod;
        dpb[nod]=dpb[nod]*dpw[i]%mod;
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(i=1;i<n;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    dfs(1,0);
    cout<<(dpw[1]+dpb[1])%mod;
    return 0;
}


Measured memory_bytes: 14208
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

void solve(){
	int k;
	cin>>k;
	int cnt =1;
	int cur = k;
	while(cur != 0){
		cur += k;
		cur %= 360;
		cnt += 1;
	}
	cout<<cnt<<endl;
}

int main(){
	fastread;
	int t = 1;
	// cin>>t;
	for(int i=1;i<=t;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}


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

using namespace std;

#define INF 10101010
int main(void){
	int N, K;
	scanf("%d %d", &N, &K);
	
	vector<int> v(202020, INF);
	
	int m = 0;
	
	for(int i = 0;i < N;++i){
		int t;
		scanf("%d", &t);
		if(v[t] == INF){
			v[t] = 0;
			++m;
		}
		++v[t];
	}
	
	sort(v.begin(), v.end());
	
	int ans = 0;
	for(int i = 0;i < m-K;++i){
		ans += v[i];
	}
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 1024
from fractions import gcd


class SegmentTree():
    _data = []
    _offset = 0

    def __init__(self, size):
        t = 1
        while t <= size:
            t *= 2
        self._offset = t - 1
        self._data = [0] * (t * 2 - 1)

    def update(self, index, value):
        i = self._offset + index
        self._data[i] = value
        while i >= 1:
            i = (i - 1) // 2
            self._data[i] = gcd(self._data[i * 2 + 1], self._data[i * 2 + 2])

    def _query(self, start, stop, index, left, right):
        if right <= start or stop <= left:
            return 0
        if start <= left and right <= stop:
            return self._data[index]
        a = self._query(start, stop, index * 2 + 1, left, (left + right) // 2)
        b = self._query(start, stop, index * 2 + 2, (left + right) // 2, right)
        return gcd(a, b)

    def query(self, start, stop):
        return self._query(start, stop, 0, 0, self._offset + 1)


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

st = SegmentTree(N)
for i in range(N):
    st.update(i, A[i])

result = st.query(1, N)
for i in range(1, N - 1):
    result = max(result, gcd(st.query(0, i), st.query(i + 1, N)))
result = max(result, gcd(st.query(0, i), st.query(0, N - 1)))
print(result)


Measured memory_bytes: 122952
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;


long long N;
map<long long, int> MP;
vector<long long> A;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N;
	for(int i=0; i<N; i++){
		long long a;
		cin >> a;
		A.push_back(a);
		if(MP.count(a) == 0){
			MP[a] = 1;
		}
		else{
			MP[a]++;
		}
	}
	if(A.size() == 1){
		printf("1\n");
		return 0;
	}

	if(A[0] == A[A.size()-1]){
		printf("0\n");
		return 0;
	}
	sort(A.begin(), A.end()); //ソートしておく

	for(auto itr = MP.begin(); itr != MP.end(); ++itr){
		long long k = itr->first;
		int v = itr->second;
		for(int i=2; ; i++){
			long long w = k * i;
			if(w > A[A.size() - 1]){
				break;
			}
			if(MP.count(w) != 0){
				MP[w] = -1;
			}
		}
	}

	int ans = 0;
	for(auto itr = MP.begin(); itr != MP.end(); ++itr){
		long long k = itr->first;
		int v = itr->second;
		if(v == 1){
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 17240
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;



int main() {	
	int m,f,b;cin>>m>>f>>b;
	if (m + f < b) {
		cout<<"NA"<<endl;
	}
	else {
		if (m >= b) {
			cout<<0<<endl;
		}
		else {
			cout<<b-m<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3096
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
long long N, A, B;
int main() {
	cin >> N >> A >> B;
	if (A>B) {
		cout << 0 << endl;
	}
	else if (N == 1) {
		if (A == B) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else {
		cout << (B-A)*N - 2 * (B-A)+1 << endl;
	}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using pint = pair<int, int>;

int main()
{
    char b;
    cin >> b;

    if (b == 'A')
        puts("T");
    if (b == 'T')
        puts("A");
    if (b == 'C')
        puts("G");
    if (b == 'G')
        puts("C");
}

Measured memory_bytes: 3536
X, Y = (int(i) for i in input().split())

sum = 0
if X == 1:
    sum += 300000
elif X == 2:
    sum += 200000
elif X == 3:
    sum += 100000
else:
    sum += 0

if Y == 1:
    sum += 300000
elif Y == 2:
    sum += 200000
elif Y == 3:
    sum += 100000
else:
    sum += 0
    
if X == 1 and Y == 1:
    sum += 400000
print(sum)

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)


struct edge {
    int from,to,money,time;
};
int d[2][101][101];

int main(){
    int n,m;
    while(cin>>n>>m, n|m){
        for(auto& arr:d[0]) for(int& i:arr) i=1<<28;
        for(auto& arr:d[1]) for(int& i:arr) i=1<<28;
        rep(i,m+1) d[0][i][i]=0;
        rep(i,m+1) d[1][i][i]=0;
        rep(i,n){
            int f,t,mo,ti; cin>>f>>t>>mo>>ti;
            d[0][f][t]=d[0][t][f]=mo;
            d[1][f][t]=d[1][t][f]=ti;
        }
        rep(k,m+1)rep(i,m+1)rep(j,m+1){
            d[0][i][j]=min(d[0][i][j], d[0][i][k]+d[0][k][j]);
            d[1][i][j]=min(d[1][i][j], d[1][i][k]+d[1][k][j]);
        }
        int k; cin>>k;
        rep(i,k){
            int p,q,r; cin>>p>>q>>r;
            cout<<d[r][p][q]<<endl;
        }
    }
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,s,ans1=0,ans2,c;
	cin>>n>>m>>s;
	for(int i=1;i<=m;i++)
	{
		cin>>c;
		if(c>s)
			ans1++;
		if(c<s)
			ans2++;
	}
	cout<<min(ans1,ans2);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>
using namespace std;
 
int getUpper2beki(int n){
    n |= (n >>  1);
    n |= (n >>  2);
    n |= (n >>  4);
    n |= (n >>  8);
    n |= (n >> 16);
    return n + 1;
}
 
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    unordered_map<int, int> f;
    for(int i = 0; i < n; i ++){
        cin >> a[i];
        f[a[i]] ++;
    }
    sort(a.rbegin(), a.rend());
    
    int c = 0;
    for(int i = 0; i < n; i ++){
        int b = getUpper2beki(a[i]) - a[i];
        if(f[a[i]] && f[b] && (a[i] != b || f[b] >= 2)){
            c ++;
            f[a[i]] --;
            f[b] --;
        }
    }
    
    cout << c << "\n";
}

Measured memory_bytes: 17652
sum[3<<17],cnt[3<<17];
N,i,acc,t,k,x;
char buf[2200000];
sz;
f(x){x>=10&&f(x/10);buf[sz++]=x%10+'0';}
main()
{
	read(0,buf,2200000);
	for(;;)
	{
		k=buf[sz++];
		if(k<'0'||k>'9')break;
		N=N*10+k-'0';
	}
	for(i=0;i<N;i++)
	{
		x=0;
		for(;;)
		{
			k=buf[sz++];
			if(k<'0'||k>'9')break;
			x=x*10+k-'0';
		}
		++sum[cnt[x]++];
	}
	i=sz=0;
	for(t=N;t;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		cnt[t]=i-1;
	}
	for(i=1;i<=N;i++)
	{
		f(cnt[i]);
		buf[sz++]='\n';
	}
	write(1,buf,sz);
}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
#include<boost/container/flat_set.hpp>

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;

    boost::container::flat_multiset<unsigned long, greater<>> s;
    unsigned long ans{0};
    for(unsigned long i = 0, A; i < N; ++i){
        cin >> A;
        auto it = s.upper_bound(A);
        if(it != s.end()){
            s.erase(it);
        }else{
            ++ans;
        }
        s.insert(A);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
from heapq import heappop, heappush

n = int(input())
robots = []
for _ in range(n):
  x, l = map(int, input().split())
  heappush(robots, (x+l, x-l))

robot = heappop(robots)
hand = robot[0]
count = 1
while robots:
  robot = heappop(robots)
  if hand <= robot[1]:
    hand = robot[0]
    count += 1
print(count)

Measured memory_bytes: 16660
#include<stdio.h>
int main(void){
int N;
  scanf("%d",&N);
char s[N+1];
  scanf("%s",&s);
  if(N%2!=0){
    printf("No");
    return 0;
  }
  for(int i=0;i<N/2;i++){
if(s[i]!=s[N/2+i]){
  printf("No");
  return 0;
}
  }
  printf("Yes");
  return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,k; cin>>n>>k;
  vll a(n);
  rep(i,n) cin>>a[i];
  
  vll s; // 転送するノードを順番に格納していく
  vll ord(n+1,-1); // 各数字が何番目の転送に使われるか
  ll c=1; // cycleの長さ
  ll l=0; // cycleに入る前の例外の長さ
  {
    ll v=1;
    while(ord[v]==-1){
      ord[v]=s.size(); // 何番目かは自信より前のノードが格納されているsの長さでわかる
      s.push_back(v);
      v=a[v-1]; // 次に行くノード
    }
    c=s.size()-ord[v]; // whileを抜けた後のvはcycleの先頭を指す
    l=ord[v]; // ord[v]は、cycleに入る前の例外の長さにもなる
  }
  
  if(k<s.size()) cout<<s[k]<<endl;
  else{
    k-=l;
    k%=c;
    cout<<s[l+k]<<endl;
  }
  
  
}

Measured memory_bytes: 8440
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<string>
#define ls k<<1,l,mid
#define rs k<<1|1,mid+1,r
#define mp(x,y) make_pair(x,y)
#define r(x) read(x)
#define rr(x,y) read(x);read(y)
#define rrr(x,y,z) read(x);read(y);read(z)
#define FOR(i,l,r) for(int i=l;i<=r;i++)
#define pb(x) push_back(x)
#define sss(str) scanf("%s",str+1)
#define ssf(x) scanf("%lf",&x)
#define aLL(x) x.begin(),x.end()
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef double dd;
typedef pair<int,int> pt;
const int N=2e5+5;
const int M=2e3+50;
const int INF=0x7fffffff;
const int mod=1e9+7;
const int sz=18;
const double eps=1e-10;
const double pi=acos(-1);
//***********************
int n,m;
char str[N];
struct node
{
    int op,a;
    char c;
}f[N];
//***********************
template<class T>
inline void read(T &x)
{
    char c; x=1;
    while((c=getchar())<'0'||c>'9') if(c=='-') x=-1;
    T res=c-'0';
    while((c=getchar())>='0'&&c<='9') res=res*10+c-'0';
    x*=res;
}
int main()
{
    sss(str);
    r(n); m=strlen(str+1);
    int cnt=0;
    FOR(i,1,n){
        r(f[i].op);
        if(f[i].op==2){
            scanf("%d %c",&f[i].a,&f[i].c);
        }
        else cnt++;
    }
    deque<char> q;
    if(cnt&1){
        FOR(i,1,m) q.push_front(str[i]);
    }
    else{
        FOR(i,1,m) q.push_back(str[i]);
    }
    FOR(i,1,n){
        if(f[i].op==2){
            if(cnt&1){
                if(f[i].a==1) q.push_back(f[i].c);
                else q.push_front(f[i].c);
            }
            else{
                if(f[i].a==1) q.push_front(f[i].c);
                else q.push_back(f[i].c);
            }
        }
        else cnt--;
    }
    while(q.size()){
        cout<<q.front();
        q.pop_front();
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int x;
    cin >>x;
    ll ans = lcm(360,x);
    ll che = ans/x;
    cout<<che<<endl;
}
    



Measured memory_bytes: 3584
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	string s; cin >> s;
	int i;
	if (s[0] == s[1] && s[1] == s[2]) cout << "No";
	else cout << "Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
const int INF = 1e9;

int main(){
  string s;
  cin >> s;
  int l = s.length();
  vector<int> u(26,0);
  rep(i,l) u[s[i]-'a']++;
  int ans = INF;
  rep(i,26){
    if(u[i] == 0) continue;
    string t = s;
    int c = 0;
    while(true){
      bool can = true;
      rep(j,t.size()){
        if(t[j] != 'a'+i) can = false;
      }
      if(can) break;
      string a = "";
      rep(j,t.size()-1){
        if(t[j] == 'a'+i || t[j+1] == 'a'+i) a += 'a' + i;
        else a += '#'; 
      }
      c++;
      t = a;
    }
    ans = min(c,ans);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
// B.

#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	bool ans = s[0] == 'A';
	int cnt = 0;
	for (int i = 1; i < (int)s.length(); ++i) {
		if (s[i] == 'C') {
			if (cnt == 0 && i >= 2 && i <= (s.length() - 2)) {
				++cnt;
			} else {
				ans = false;
			}
		} else if (!islower(s[i])) {
			ans = false;
		}
	}
	cout << ((ans && cnt == 1) ? "AC" : "WA") << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define y1 Y1
using namespace std;
const int maxn=200005,inf=1e8;
const double qarc=acos(-1)*5.0;
int n,cnt,x1,x2,y1,y2;
int f[maxn],g[maxn],b[maxn];
struct p{int x,y;}a[maxn];
inline int read(){
    int x=0,f=1;char ch=getchar();
    for(;ch<'0'||ch>'9';f=ch=='-'?-1:1,ch=getchar());
    for(;ch>='0'&&ch<='9';x=x*10+ch-48,ch=getchar());
    return x*f;
}
bool cmp(p a,p b){return a.x<b.x;}
int main(){
    x1=read();y1=read();x2=read();y2=read();n=read();
    for(int i=1;i<=n;i++)a[i].x=read(),a[i].y=read();
    if(x1>x2){
        x1=inf-x1;x2=inf-x2;
        for(int i=1;i<=n;i++)a[i].x=inf-a[i].x;
    }
    if(y1>y2){
        y1=inf-y1;y2=inf-y2;
        for(int i=1;i<=n;i++)a[i].y=inf-a[i].y;
    }
    sort(a+1,a+n+1,cmp);
    int tot=0,ans1=0;
    for(int i=1;i<=n;i++)
        if(a[i].x>=x1&&a[i].x<=x2&&a[i].y>=y1&&a[i].y<=y2)
			b[++tot]=a[i].y;
    for(int i=1;i<=tot;i++){
        f[i]=lower_bound(g+1,g+ans1+1,b[i])-g;
        if(f[i]>ans1)ans1=f[i],g[ans1]=b[i];
        else g[f[i]]=min(g[f[i]],b[i]);
    }
    double ans=(double)(x2+y2-x1-y1)*100.0;
    ans-=ans1*(20-qarc);
    if(ans1==min(y2-y1+1,x2-x1+1))ans+=qarc;
    printf("%.15lf",ans);
    return 0;
}

Measured memory_bytes: 4096
#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 1

#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <random>
#include <ctime>

#define M 1000000007

const long long INF = 10000000000000000;

using namespace std;

int main(){

	int N;
	cin>>N;
	if(N==0) return 1;
	map<int,long long> mp;
	for(int i=2;i<=N;i++){
		int target=i;
		for(int j=2;j<=i;j++){
			if(target%j==0){
				target/=j;
				mp[j]++;
				j--;
			}
		}
	}	
	long long ans=1;
	for(auto itr=mp.begin();itr!=mp.end();++itr){
	//	cout<<itr->first<<" "<<itr->second<<endl;
		ans=ans*(itr->second+1)%M;
		//cout<<ans<<endl;
	}

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



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define MOD 1000000007

int main()
{  
  
  ll n;
  cin>>n;
  ll x[n+1];
  for(ll i=1;i<=n;i++)
    cin>>x[i];
  ll dp[n+1]={0};
  for(ll i=2;i<=n;i++)
  {
    
      ll t1=dp[i-2]+abs(x[i]-x[i-2]);
      ll t2=dp[i-1]+abs(x[i]-x[i-1]);
      if(i==2)
        dp[i]=dp[i-1]+t2;
      else
      {
        dp[i]=min(t1,t2);
      }
  }
  cout<<dp[n]<<endl;
   

 }
  
              
              

  

  
  
          
      
    







  
 

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	ll n,m;
	cin>>n>>m;
	ll a[n],b[n];
	rep(i,n)cin>>a[i]>>b[i];
	pli p[n];
	rep(i,n)p[i]={a[i],b[i]};
	sort(p,p+n);
	ll ans=0;
	rep(i,n){
		ans+=min((ll)p[i].second,m)*p[i].first;
		m-=min(m,(ll)p[i].second);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3456
n, m = (int(x) for x in input().split())
ans = 0
if n >= 3 and m >= 3: ans = (n - 2) * (m - 2)
elif n == 2 or m == 2: ans = 0
elif n == 1 and m == 1: ans = 1
elif n == 1 or m == 1: ans = max(n, m) - 2
else: pass
print(ans)

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

int main(void) {
	long long A, B, C;
	std::cin >> A >> B >> C;
	if(A % 2 == 0 || B % 2 == 0 || C % 2 == 0) {
		std::cout << "0\n";
		return 0;
	}
	long long m; 
	m = std::max(std::max(A, B), C);
	long long result;
	if(m == A) {
		result = B * C;
	} else if(m == B) {
		result = A * C;
	} else {
		result = A * B;
	}
	std::cout << result << '\n';
	return 0;
}



Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var r = int.Parse(line[0]);
        var g = int.Parse(line[1]);
        var b = int.Parse(line[2]);
        var n = int.Parse(line[3]);
        Console.WriteLine(getAns(r,g,b,n));
    }
    static long  getAns(int a, int b, int c, int n)
    {
        var amax = n / a;
        var bmax = n / b;
        var cmax = n / c;

        var count = 0L;
        for (int i = 0; i <= amax; i++)
            for (int j = 0; j <= bmax; j++)
            {
                var tc = n - i * a - j * b;
                if (tc % c == 0 && tc / c <= cmax && tc / c >= 0) count++;
            }
        return count;
    }
}

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

int main(){
  long n = 0;
  long x[100] = {};
  long y[100] = {};
  long h[100] = {};
  long epy[101][101] = {};
  long eh = 0;
  long bsx = 0;
  long bsy = 0;
  long bsh = 0;
  long i = 0;
  long j = 0;
  long px = 0;
  long py = 0;
  long ix = 0;
  long iy = 0;
  long flag = 0;
  scanf("%ld",&n);
  for(i=0;i<n;i++){
    scanf("%ld %ld %ld",&x[i],&y[i],&h[i]);
    if(h[i] > 0){
      bsx = x[i];
      bsy = y[i];
      bsh = h[i];
    }
  }
  
  for(px=0;px<=100;px++){
    for(py=0;py<=100;py++){
      eh = bsh + labs(px-bsx) + labs(py-bsy);
      epy[px][py] = eh;
      for(ix=0;ix<=100;ix++){
        for(iy=0;iy<=100;iy++){
          if((eh - labs(px-ix) - labs(py-iy))>= 0){
            epy[ix][iy] = (eh - labs(px-ix) - labs(py-iy));
          }else{
            epy[ix][iy] = 0;
          }
        }
      }
      flag = 1;
      for(i=0;i<n;i++){
        if(epy[x[i]][y[i]] != h[i]){
          flag = 0;
        }
      }
      if(flag){
        break;
      }
    }
    if(flag){
      break;
    }
  }
  
  printf("%ld %ld %ld",px,py,eh);
  return 0;
}
        
    
    
  

Measured memory_bytes: 256
#pragma GCC optimize "trapv"
#include<bits/stdc++.h>

#define ll long long int
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define sz(s) (ll)(s.size())
#define vvi vector<vector<ll>>
#define vi vector<ll>
#define all(a) (a).begin(),(a).end()
#define pii pair<ll,ll>
#define dbg(x,y) cout<<x<<" "<<y<<endl
#define endl '\n'
#define M 1000000007
const ll INF = 1ll<<60;

using namespace std;
//-----------------------------------------//


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

	// sort(a,a+n);

	int ans=0;
	for(int i=0;i<n-2;++i){
		for(int j=i+1;j<n-1;++j){
			for(int k=j+1;k<n;++k){
				if(a[i]!=a[j] && a[j]!=a[k] && a[k]!=a[i]){
					if((a[i]+a[j]>a[k]) && (a[j]+a[k]>a[i]) && (a[k]+a[i]>a[j])){
						ans++;
						// cout<<i+1<<" "<<j+1<<" "<<k+1<<endl;
					}
				}
			}
		}
	}

	cout<<ans<<endl;
}



int main(){

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	
	int t=1;
	// cin>>t;
	while(t--){
        solve();
	}
}


Measured memory_bytes: 3624
module Main where

import Control.Applicative
import Numeric

main :: IO ()
main = loop

loop :: IO ()
loop = do
  { [n, x] <- getInts
  ; if n == 0 && x == 0 then return ()
    else  print (length(filter (( x ==) . sum) (comb [1 ..n] 3 ))) >> loop
  }

comb :: [Int] -> Int -> [[Int]]
comb ns 0 = [[]]
comb ns k =  if length ns == k then [ns]
            else map (head ns : ) (comb (tail ns) (k - 1)) ++ comb (tail ns) k
                                                              
--
getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words  <$> getLine

putDoubles :: [Double] -> IO()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(num) scanf("%d",&num)
#define sff(num1,num2) scanf("%d %d",&num1,&num2)
#define sfff(num1,num2,num3) scanf("%d %d %d",&num1,&num2,&num3);
#define sl(num) scanf("%lld",&num)
#define sll(num1,num2) scanf("%lld %lld",&num1,&num2)
#define slll(num1,num2,num3) scanf("%lld %lld %lld",&num1,&num2,&num3);
#define rep(i,n) for(i=1;i<=n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define pb push_back
#define mpp make_pair
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
#define TIME cerr<<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<"s\n";
typedef long long int ll;
using namespace std;
int main()
{
    int i,n,k;
    sf(n);
    vector<int>vec;
    rep0(i,n)
    {
        sf(k);
        vec.pb(k);
    }
    int cnt=0;
    rep(i,n-2)
    {
        if((vec[i]>vec[i+1] && vec[i]<vec[i-1]) || (vec[i]<vec[i+1] && vec[i]>vec[i-1]))
            cnt++;
    }
    pf("%d",cnt);
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>
#include <stack>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
//static const long double pi = 3.1415926535897932;

using namespace std;
using ll = long long int;
using ull = unsigned long long;

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ll combination(ll n, ll r) { // nCr の計算
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < n - 1; i++) {
		if (a[i] == a[i + 1]) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int a,b;
    cin >> a >> b;
    if(a == 1) a = 14;
    if(b == 1) b = 14;
    if(a == b) cout << "Draw" << endl;
    else if(a > b) cout << "Alice" << endl;
    else cout << "Bob" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

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

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

int A, B, X;

int main(){
	
	cin>>X>>A>>B;
	
	if( A-B < 0 ){
		if( X+A-B < 0 ) puts("dangerous");
		else{		 puts("safe");}
	}
	else{
		puts("delicious");
	}
	
	
	return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		
		int a=sc.nextInt();
		int b=sc.nextInt();
		
		int ans=0;
		int count=1;
		
		while(count<b) {
			count--;
			count+=a;
			ans++;
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 21844
#include <cstdio>
#include <cmath>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;

double a,b,x,k,Pi,l,r;
int main()
{
	Pi=3.141592653589;
	scanf("%lf%lf%lf",&a,&b,&x);
	double k=(a*a*b)/2;
	double Mid=atan2(a,b)*180/Pi;
	
	//printf("@   %lf %lf\n",x,k);
	
	if(x==k) printf("%.10lf",90-Mid);
	else 
	{
	    if(x<k)
	    {
		    l=0,r=Mid;
		    while(l<r-0.0000000000001)
		    {
			    double mid=(l+r)/2;
			    double now=a*b*tan(mid/180*Pi)*b/2;
			    if(x>now) l=mid+0.00000000000001;
			    else if(x<=now) r=mid;
			    //printf("@@ %.10lf %.10lf\n",tan(mid),Mid);
		    }
	    }
	    else if(x>k)
	    {//printf("@   \n");
		    l=Mid,r=90;
		    while(l<r-0.0000000000001)
		    {
			    double mid=(l+r)/2;
			    double now=a*a*b-a*a*a*tan((90-mid)/180*Pi)/2;
			    if(x>now) l=mid+0.00000000000001;
			    else if(x<=now) r=mid;
		    }
	    }
	    printf("%.10lf",90-r);
    }
}

Measured memory_bytes: 256