akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <limits.h>
#include <string.h>

#define MAX 100001
#define INF INT_MAX

int Partition(int*, char*, int, int);
void Quicksort(int*, char*, int, int);
void merge(int*, char*, int, int, int);
void Mergesort(int*, char*, int, int);

int main(){
  int n, i, arr_q[MAX], arr_m[MAX];
  char mark_q[MAX], mark_m[MAX];

  scanf("%d" ,&n);
  for(i = 0 ; i < n ; i++){
    scanf("\n%c%d" , mark_q+i, arr_q+i);

    arr_m[i] = arr_q[i];
    mark_m[i] = mark_q[i];
  }

  Quicksort(arr_q, mark_q, 0, n-1);
  Mergesort(arr_m, mark_m, 0, n);

  if(memcmp(arr_q, arr_m, sizeof(int) * n) == 0 &&
     memcmp(mark_q, mark_m, sizeof(char) * n) == 0){
    puts("Stable");
  }else{
    puts("Not stable");
  }
 
  for(i = 0 ; i < n ; i++){
    printf("%c %d\n" ,mark_q[i], arr_q[i]);
  }

  return 0;
}

int Partition(int arr[], char mark[], int p, int r){
  int x = arr[r], i = p - 1, j, tmp;
  char tmp_mark;

  for(j = p ; j < r ; j++){
    if(arr[j] <= x){
      i++;
      tmp = arr[i];
      arr[i] = arr[j];
      arr[j] = tmp;

      tmp_mark = mark[i];
      mark[i] = mark[j];
      mark[j] = tmp_mark;
    }
  }
  
  tmp = arr[i+1];
  arr[i+1] = arr[r];
  arr[r] = tmp;
  
  tmp_mark = mark[i+1];
  mark[i+1] = mark[r];
  mark[r] = tmp_mark;
  
  return ++i;
}

void Quicksort(int arr[], char mark[], int p, int r){
  int q;

  if(p < r){
    q = Partition(arr, mark, p, r);
    Quicksort(arr, mark, p, q-1);
    Quicksort(arr, mark, q+1, r);
  }
}

void merge(int arr[], char mark[], int left, int mid, int right){
  int n1 = mid - left, n2 = right - mid;
  int L[MAX], R[MAX], i, j, k;
  char Lm[MAX], Rm[MAX];

  for(i = 0 ; i < n1 ; i++){
    L[i] = arr[left + i];
    Lm[i] = mark[left + i];
  }

  for(i = 0 ; i < n2 ; i++){
    R[i] = arr[mid + i];
    Rm[i] = mark[mid + i];
  }

  L[n1] = R[n2] = INF;
  for(i = 0, j = 0, k = left ; k < right ; k++){
    if(L[i] <= R[j]){
      arr[k] = L[i];
      mark[k] = Lm[i++];
    }else{
      arr[k] = R[j];
      mark[k] = Rm[j++];
    }
  }
}

void Mergesort(int arr[], char mark[], int left, int right){
  int mid;

  if(left + 1 < right){
    mid = (left + right) / 2;
    Mergesort(arr, mark, left, mid);
    Mergesort(arr, mark, mid, right);
    merge(arr, mark, left, mid, right);
  }
}

Measured memory_bytes: 2108
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <functional>
#include <array>

using namespace std;

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

    cout << (N <= 999 ? "ABC" : "ABD") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >>c;
    int ans;
    int d,e,f;
    d = abs(a-b);
    e = abs(b-c);
    f = abs(c-a);
    cout << min(d+e,min(e+f,f+d))<<endl;
    return 0;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

vector<double> seg;
int w,h,n;
int a[110],p[110],q[110];

vector<double> solve(double a,double b,double c){
	vector<double> result;
	// a == 0
	if(abs(a)<eps){
		if(abs(b)<eps) return result;
		result.push_back(-c/b);
		return result;
	}
	// a !=0
	double d=b*b-4.0*a*c;
	if(d>eps){
		double dd=sqrt(d);
		double ans1=(-b+dd)/(2.0*a);
		if(ans1>eps) result.pb(ans1);
		double ans2=(-b-dd)/(2.0*a);
		if(ans2>eps) result.pb(ans2);
	}else if(abs(d)<eps){
		double ans=-b/(2.0*a);
		if(ans>eps) result.pb(ans);
	}
	return result;
}

void cross(int i,int j){
	double aa=1.0*a[i]-1.0*a[j];
	double bb=-2.0*a[i]*p[i]+2.0*a[j]*p[j];
	double cc=1.0*a[i]*p[i]*p[i]-1.0*a[j]*p[j]*p[j]+q[i]-q[j];
	vector<double> res=solve(aa,bb,cc);
	for(auto &e:res) seg.push_back(e);
}

int top(double x){
	double cmax=0.0;
	int idx=-1;
	rep(i,n){
		double f=1.0*a[i]*(x-p[i])*(x-p[i])+q[i];
		if(cmax<f) cmax=f,idx=i;
	}
	return idx;
}

double calc(int idx,double x){
	x=abs(x-p[idx]);
	double res=0.0;
	res+=0.5*x*sqrt(4.0*a[idx]*a[idx]*x*x+1.0);
	res+=asinh(x*sqrt(4.0*a[idx]*a[idx]))/(2.0*sqrt(4.0*a[idx]*a[idx]));
	return res;
}

int main(void){
	cin >> w >> h >> n;
	rep(i,n) cin >> a[i] >> p[i] >> q[i];
	seg.push_back(0);
	seg.push_back(w);
	rep(i,n) seg.push_back(p[i]);
	rep(i,n){
		double d=sqrt(-1.0*q[i]/a[i]);
		seg.push_back(1.0*p[i]+d);
		seg.push_back(1.0*p[i]-d);
	}
	rep(j,n)rep(i,j) cross(i,j);
	sort(seg.begin(),seg.end());
	seg.erase(unique(seg.begin(),seg.end()),seg.end());
	int m=seg.size();
	double ans=0.0;
	rep(i,m-1){
		double left=seg[i],right=seg[i+1];
		if(right<=0||w<=left) continue;
		int idx=top((left+right)/2);
		if(idx==-1) continue;
		double cur=abs(calc(idx,left)-calc(idx,right));
		//cerr << idx << endl;
		//cerr << left << " " << right << " " << cur << endl;
		ans+=cur;
	}
	cout.precision(20);
	cout << fixed << ans << endl;
	return 0;
}

Measured memory_bytes: 1364
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	bool ok = 1;
	rep(i, n){
		int a; cin >> a;
		if(a % 2 == 0 && (a % 3 && a % 5)) ok = 0;
	}
	cout << (ok ? "APPROVED" : "DENIED") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if(a>12)
    cout<<b<<endl;
  if(a>=6&&a<=12)
    cout<<b/2<<endl;
  if(a<=5)
    cout<<0<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const ll MOD=1e9+7;

int main() {
    ios_base::sync_with_stdio(false);

    while (1) {
        int w,h;
        cin >> w >> h; 
        if (w==0 && h==0) break;
        vector<vector<char>> s(h+2,vector<char>(w+2,'0'));
        rep(i,h) {
            rep(j,w) cin >> s[i+1][j+1];
        }
        int ans=0;
        vector<int> di={-1,-1,-1,0,0,1,1,1},dj={-1,0,1,-1,1,-1,0,1};
        repr(i,1,h+1) {
            repr(j,1,w+1) {
                if (s[i][j]=='1') {
                    queue<pair<int,int>> q;
                    q.push(make_pair(i,j));
                    s[i][j]='0'; 
                    while (!q.empty()) {
                        pair<int,int> p=q.front();
                        q.pop();
                        rep(k,8) {
                            int ni=p.first+di[k],nj=p.second+dj[k];
                            if (s[ni][nj]=='1') {
                                q.push(make_pair(ni,nj));
                                s[ni][nj]='0';
                            }
                        }
                    }
                    ++ans;
                }
            }
        }
        cout << ans << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
#define LL long long
LL f[3010][3010];
int main(){
    int A,B,C,D;
    scanf("%d%d%d%d",&A,&B,&C,&D);
    f[A][B] = 1;
    for (int i=A; i<=C; i++){
        for (int j=B; j<=D; j++){
            if (i == A && j == B) continue;
            else if (i == A) f[i][j] = f[i][j-1]*i%mod;
            else if (j == B) f[i][j] = f[i-1][j]*j%mod;
            else f[i][j] = ((f[i-1][j]*j%mod + f[i][j-1]*i%mod)%mod - f[i-1][j-1]*(i-1)%mod*(j-1)%mod + mod)%mod;
        }
    }
    printf("%lld\n",f[C][D]);
    return 0;
} 

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

int main() {
    int h, w;
    vector<string> v;
    
    cin >> h >> w;
    
    string s;
    for (int i=0; i<h; i++) {
        cin >> s;
        v.push_back(s);
    }
    
    for (int i=0; i<h; i++) {
        cout << v[i] << endl;
        cout << v[i] << endl;
    }
    
    return 0;
}


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

typedef long long ll;

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

    bool flg = false;
    for(int i = 1; i <= 9; i++) {
        for(int j = 1; j <= 9; j++) {
            if(N == i*j) {
                flg = true;
            }
        }
    }

    if (flg) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}



Measured memory_bytes: 3636
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using Ki = vector<vector<int>>;
using Vi = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int n,k;
    string s;
    cin>>n>>k>>s;
    vector<P> a(n+1);
    int c=1;
    a[1].fs=1;
    if(s[0]=='1') a[1].sc=1;
    Rep(i,1,n){
        if(s[i-1]!=s[i]){
            c++;
            if(s[i]=='1') a[c].sc=1;
        }
        a[c].fs++;
    }
    c++;
    rep(i,c){
        //cout<<a[i].fs<<" "<<a[i].sc<<endl;
    }
    Rep(i,1,c){
        a[i].fs+=a[i-1].fs;
    }
    ll ans=a[1].fs;
    for(int i=1;i<c;i++){
        int memo=0;
        if(a[i].sc==0){
            memo=a[min(i+2*k-1,c-1)].fs-a[i-1].fs;
        }
        else{
            memo=a[min(i+2*k,c-1)].fs-a[i-1].fs;
        }
        ans=max(ans,memo);
    }
    cout<<ans<<endl;
}

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

using namespace std;

typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000 //2e9
#define LLINF 2000000000000000000ll // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define dmp(x) cerr << #x << ": " << x << endl;

template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}

template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T,vector<T>,greater<T>>;
template<class T> vector<T> vect(int len,T elem){ return vector<T>(len,elem); }

template<class T,class U>
ostream& operator << (ostream& os,const pair<T,U>& p){
  os << p.fi << ',' << p.sec; return os;
}
template<class T,class U>
istream& operator >> (istream& is,pair<T,U>& p){
  is >> p.fi >> p.sec; return is;
}
template<class T>
ostream& operator << (ostream &os,const vector<T> &vec){
  for(int i=0;i<vec.size();i++){
    os << vec[i];
    if(i+1<vec.size())os << ' ';
  }
  return os;
}
template<class T>
istream& operator >> (istream &is,vector<T>& vec){
  for(int i=0;i<vec.size();i++)is >> vec[i];
  return is;
}
void fastio(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout<<fixed<<setprecision(20);
}
namespace Util{
  template<class T>
  vector<pair<T,int>> runLength(vector<T> v){
    vector<pair<T,int>> res;
    for(int i=0;i<v.size();i++){
      if(res.empty()||res.back().first!=v[i])res.push_back(make_pair(v[i],1));
      else res.back().second++;
    }
    return res;
  }
  template<class T>
  void compress(vector<T> &v){
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
  }
}

void solve(){
  int N;
  cin >> N;
  vector<int> A(N);
  cin >> A;
  for(int i=0;i<N;i++){
    if(A[i]%2!=0)continue;
    if(A[i]%3!=0&&A[i]%5!=0){
      cout << "DENIED" << endl;
      return;
    }
  }
  cout << "APPROVED" << endl;
  return ;
}
 
signed main(){
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();
  return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;

import std.algorithm.mutation: copy;
import std.algorithm.iteration: uniq;

int binarySearch(int[] arr, int require) {
    size_t left = 0, right = arr.length - 1;

    while(left <= right) {
        size_t index = (left + right) / 2;
        
        if(arr[index] > require) {
            right = index - 1;
        } else {
            left = index + 1;            
        }
    }
    
    return arr[right];
}

void main() {
    
    for(;;) {
        
        // input
        int n, m;
        {
            auto temp = readln.split;
            n = to!int(temp[0]);
            m = to!int(temp[1]);
        }
        
        if(n == 0 && m == 0) {
            break;
        }
        
        int[] p;
        p.length = n + 1;
        for(int i=0; i<n; ++i) {
            auto temp = readln.chomp;
            p[i] = to!int(temp);
        }
        p[$ - 1] = 0;

        // calc
        int[] twice;
        twice.length = p.length ^^ 2;
        {
            int i = 0;
            foreach(val1; p) {
                foreach(val2; p) {
                    twice[i++] = val1 + val2;
                }
            }
        }
        twice.length -= twice.sort.uniq.copy(twice).length;
        
        int ret = 0;
        foreach(val; twice) {
            
            if(val > m) {
                break;
            }
            
            int temp = val + binarySearch(twice, m - val);
            if(temp > ret) {
                ret = temp;
            }
           
        }
        
        // output
        writeln(ret);
    }
}

Measured memory_bytes: 19176
#include<stdio.h>
#include<string.h>
int main()
{
	int l,i;
	char x,y,a[6];
	while(~scanf("%s",a))
	{l=strlen(a);
	 int w=0;
	 if(l!=4)w=1;
	 if(!((a[0]==a[1]&&a[2]==a[3]&&a[0]!=a[2])||(a[0]==a[2]&&a[1]==a[3]&&a[0]!=a[1])||(a[0]==a[3]&&a[2]==a[1]&&a[0]!=a[2])))
	 w=1;
	 for(i=0;i<4;i++)
	 if(a[i]>'Z'||a[i]<'A')w=1;
	 if(w==1)printf("No\n");
	 else printf("Yes\n");
	}
}

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DMP(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

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

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

int Test(int n){
	cout<<"? "<<n<<endl;
	string ans;
	cin>>ans;
	return ans=="Y";
}

signed main(){
	string cur(10,'9');
	REP(i,10){
		int bot=i==0?0:-1,top=9;
		while(top-bot>1){
			const int mid=(top+bot)/2;
			cur[i]='0'+mid;
			if(Test(stoll(cur)))
				top=mid;
			else
				bot=mid;
		}
		cur[i]='0'+top;
	}
	if(cur=="1000000000"){
		int n=999999999;
		while(n&&Test(n))n/=10;
		cout<<"! "<<n+1<<endl;
	}else{
		int n=stoll(cur)-1;
		while(!Test(n))n/=10;
		cout<<"! "<<n+1<<endl;
	}
}

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

#define       mx           100005
#define       sf           scanf
#define       pf           printf
#define       READ         freopen("in.txt", "r", stdin);

using namespace std;

int a[mx], b[mx], c[mx], dp[mx][5];

int main()
{
	// READ
	
	int n;

	sf("%d", &n);

	for(int i = 0; i < n; i++) sf("%d %d %d", a+i, b+i, c+i);

	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];

	for(int i = 1; i < n; i++)
	{
		dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
		dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
		dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1]);
	}

	int ans = max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));

	pf("%d\n", ans);


	return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
int f(int x){
    return x*x;
}

int main(void){
    int n,i;
    int sum=0;
    
    while(scanf("%d",&n)!=EOF){
        for(i=0;i<600/n;i++){
           sum+=f(i*n)*n; 
        }
        printf("%d\n",sum);
        sum=0;
    }
  
   return 0;
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
//#define int long long int
#define ldouble long double
#define vin vector<int> 
#define rep(i,a,n) for(i=(a);i<(n);i++)
#define INF (int)1000000007

//setprecision()<<

using namespace std;

void fin(int i,int n,vin &a){
    rep(i,0,n){
        cin>>a.at(i);
    } 
} 

signed main() {
    int i;
    int N;
    string S;
    cin>>N>>S;
    int cnt=0;
    for(int i=0;i<1000;i++){
        string tmp;
        if(i<10){
            tmp="00"+to_string(i);
        }
        else if(i<100){
            tmp="0"+to_string(i);
        }
        else{
            tmp=to_string(i);
        }
        //cout<<"tmp "<<tmp<<endl;
        bool ok=false;
        for(int j=0;j<S.size()-2;j++){
            if(S.at(j)==tmp.at(0)){
                for(int k=j+1;k<S.size()-1;k++){
                    if(S.at(k)==tmp.at(1)){
                        for(int l=k+1;l<S.size();l++){
                            if(S.at(l)==tmp.at(2)){
                                cnt++;
                                //cout<<"l,S.at(l) "<<l<<" "<<S.at(l)<<endl;
                                //cout<<"tmp "<<tmp<<endl;
                                ok=true;
                                if(ok) break;
                            }
                        }
                        ok=true;
                    }
                    if(ok) break;
                }
                ok=true;
            }
            if(ok) break;
        }
    }
    cout<<cnt<<endl;
return 0;
}

Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (a : b : c : d : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    f = subtract <$> g <*> h
      where
        g x = let (q, r) = divMod a x in if r == 0 then q else succ q
        h = succ . div b
  print $ (b - a + 1) - f c - f d + f (lcm c d)

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


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

typedef long long ll;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < vl > vvl;
typedef vector < vi > vvi;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < pll > vpll;
typedef vector < pii > vpii;
typedef vector < vpll > vvpll;
typedef vector < vpii > vvpii;

#define pb push_back
#define pf push_front
#define all(c) (c).begin(), (c).end()
#define ff first
#define ss second
#define mp(x,y) make_pair((x), (y))
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)



void solve(){
    
    int n; cin >> n;
    vi a(n), b(n);
    for(int i = 0; i < n; i++)
        cin >> a[i] >> b[i];
    sort(all(a)); sort(all(b));
    if(n&1){
        cout << b[n/2] - a[n/2] + 1 << '\n';
    }
    else
        cout << b[n/2-1] + b[n/2] - a[n/2-1] - a[n/2] + 1 << '\n';
    
}


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


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

#define vi vector<int>
#define ll long long int

int main() {

    int N;
    cin >> N;

    int tmp;
    vi v;
    for (int i = 0; i < N; i++) {
        cin >> tmp;
        v.push_back(tmp);
    }

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

    double sum = pow(0.5, N-1) * v[0];
    for (int i = 1; i < N; i++) {
        sum += pow(0.5, N-i) * v[i];
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

typedef long long ll;

ll x[100005],v[100005];
ll sum1,sum2,max;

int main(){

	int N;
	ll C;

	scanf("%d %lld",&N,&C);

	int i;

	sum1=0ll;

	for(i=0;i<N;i++){
	scanf("%lld %lld",&x[i],&v[i]);
	sum1+=v[i];
	}

	sum2=0ll;
	max=0ll;

	ll ans=0ll;

	for(i=N-1;i>=0;i--){
	sum1-=v[i];
	sum2+=v[i];
	if(max<sum2-C+x[i]){max=sum2-C+x[i];}
	ll temp;
	if(i==0){temp=0ll;}
	else{temp=2*x[i-1];}
	if(ans<sum1-temp+max){ans=sum1-temp+max;}
	}
	max=0ll;
	for(i=0;i<N;i++){
	sum1+=v[i];
	sum2-=v[i];
	if(max<sum1-x[i]){max=sum1-x[i];}
	ll temp;
	if(i==N-1){temp=0ll;}
	else{temp=2*(C-x[i+1]);}
	if(ans<sum2-temp+max){ans=sum2-temp+max;}
	}
	printf("%lld\n",ans);

  return 0;
}

Measured memory_bytes: 1664
def main():
    """
    1 <= N <= 10^5
    1 <= K <= N
    |xi| <= 10^8
        -10^8 <= xi <= 10^8
    xs: sorted
    """
    N, K = map(int, input().split())
    *x, = map(int, input().split())
    # ans = WA(N, K, x)
    ans = editorial(N, K, x)
    print(ans)


def editorial(N, K, x):
    from bisect import bisect_left
    try:
        # N=7,K=3
        # [-3,-2,-1,0,1,2,3]
        #      |----*---|
        idx = x.index(0)
        left = max(idx - K + 1, 0)
        right = min(idx + 1, N - K)
    except:
        # N=6,K=3
        # [-3,-2,-1,1,2,3]
        #   |-----|*|---|
        idx = bisect_left(x, 0)
        left = max(idx - K, 0)
        right = min(idx + 1, N - K)

    _range = range(left, right + 1)
    # print(idx, _range)
    ans = float("inf")
    for left in _range:
        right = left + K - 1
        # print(left, right)
        a1 = abs(x[left]) + abs(x[right] - x[left])
        a2 = abs(x[right]) + abs(x[left] - x[right])
        ans = min([ans, a1, a2])

    return ans


if __name__ == '__main__':
    main()


Measured memory_bytes: 14660
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    int n, W;
    cin >> n >> W;
    vi w(n);
    vector<ll> v(n);
    rep(i, n) {
        cin >> w[i] >> v[i];
    }

    vector<ll> dp(W+1);
    rep(i, n) {
        vector<ll> dp_(W+1);
        rep(j, W+1) {
            dp_[j] = dp[j];
        }
        rep(k, W+1) {
            if(k >= w[i]) {
                dp[k] = max(dp[k], dp_[k-w[i]] + v[i]);
            }
        }
    }
    cout << dp[W] << endl;

}

Measured memory_bytes: 1804
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double d,x;
    int n;
    cin >> n >> d >>x;
    double ans=(double)n,a=(n-1)/6.0,b=1/3.0;
    REPN(i,1,n-1){
        ans=ans+a+b;
        a=a*(i+1.0)*(i+1.0)*(n-i-1.0)/(i*((double)n-i)*(i+3.0));
        b=b*(i+1.0)*(i+2.0)/(i*(i+3.0));
    }

    cout << fixed <<setprecision(13) <<ans*(d+(2.0*n-1.0)*x/2.0) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<math.h>
#include<assert.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
//小さい順
int compareInt(const void* a, const void* b){int aNum = *(int*)a;int bNum = *(int*)b;return aNum - bNum;}

int main(void){
    int N;
    int min=10000000;
    scanf("%d",&N);
    int a[N];
    for(int i=0;i<N;i++){
        scanf("%d",&a[i]);
    }
    qsort(a,N,sizeof(int),compareInt);
    for(int i=a[0];i<=a[N-1];i++){
        int cnt=0;
        for(int j=0;j<N;j++){
            cnt+=(a[j]-i)*(a[j]-i);
        }
        if(min>cnt){
            min=cnt;
        }
    }
    printf("%d",min);
}


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

int main(){
   while(1){
     int H, W;
     cin>>H>>W;
     if(H == 0 && W == 0)  break;

     for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
          if((i + j) % 2 == 0) cout<<"#";

          else cout<<".";
          }
          cout<<endl;

        }
        cout<<endl;
 
    }

    return 0;
}


Measured memory_bytes: 3080
/*
 *  author : Atul Anand   
 *  created on : Thu Apr 02 2020
 */

import java.io.*;
import java.util.*;

public class Main{

    public static void main(String[] args) throws IOException {
        int N = in.nextInt();
        int W[] = new int[N];
        int sum = 0;
        for(int i = 0; i < N; i++){
            W[i] = in.nextInt();
            sum += W[i];
        } 

        int ans = MAX;
        int prefix = 0;
        for(int i = 0; i < N; i++){
            prefix += W[i];
            sum -= W[i];
            ans = Math.min(ans, Math.abs(sum - prefix));
        }
        println(ans);
        
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static void read(int arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextInt(); 
    	} 
    }
    
    static void read(long arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextLong(); 
    	} 
    }
    
    static void read(String arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.next(); 
    	} 
    }
    
    static void print(Object O) {  
    	out.print(O); 
    }
    
    static void println(Object O) { 
    	out.println(O); 
    }
    
    static void println(int arr[]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		print(arr[i]+" "); 
    	} 
    	println(""); 
    }

    static void println(int arr[][]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		println(arr[i]); 
    	}
    }
    
    static void debug(Object O) { 
    	System.out.println(O); 
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}

Measured memory_bytes: 23252
n = int(input())
A = list(map(int, input().split()))
A.sort()
B = list(set(A))
if len(B) >= 4:
  print('No')
else:
  if B[-1] == 0:
    print('Yes')
  elif A.count(0) == n/3 and len(B) == 2:
    print('Yes')
  elif len(B) == 3 and B[0]^B[1]^B[2] == 0 and A.count(B[0]) == A.count(B[1]) == n/3:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 14116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int H,W;
char maze[30][310];
int d[30][30];
int dx[2]={1,0};
int dy[2]={0,1};
void bfs(int sx,int sy){
    queue<pair<int,int>> que;
    rep(i,H){
        rep(j,W){
            d[i][j]=INF;
        }
    }
 
    que.push(make_pair(sx,sy)); // (0,0)ã‚¹ã‚¿ãƒ¼ãƒˆ
    d[sx][sy]=0;
    while(!que.empty()){
        pair<int,int> p=que.front();
        que.pop();
        for(int i=0;i<2;i++){
            int nx=p.first+dx[i];
            int ny=p.second+dy[i];
            if(0<=nx && nx<H && 0<=ny && ny<W && maze[nx][ny]=='#' && d[nx][ny]==INF){
                que.push(make_pair(nx,ny));
                d[nx][ny]=d[p.first][p.second]+1;
                break;
            }
        }
    }
}

int main(){
    cin>>H>>W;
    rep(i,H) rep(j,W) cin>>maze[i][j];
    bfs(0,0);
    rep(i,H){
        rep(j,W){
            if(maze[i][j]=='#' && d[i][j]==INF){
                cout<<"Impossible"<<endl;
                return 0;
            }
        }
    }

    cout<<"Possible"<<endl;
}

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

int main() {
  string s;
  cin >> s;
  
  if (s.at(2) == s.at(3) && s.at(4) == s.at(5)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
type t = {
  id : int;
  ch : char;
  num : int;
}

let rec partitoin a r = function
  | (i, j) when j = r ->
    let tmp = a.(i) in
    a.(i) <- a.(j);
    a.(j) <- tmp;
    i
  | (i, j) when a.(j).num <= a.(r).num ->
    let tmp = a.(i) in
    a.(i) <- a.(j);
    a.(j) <- tmp;
    partitoin a r (i + 1, j + 1)
  | (i, j) ->
    partitoin a r (i, j + 1)

let rec quick_sort a p r =
  if p < r then begin
    let q = partitoin a r (p, p) in
    quick_sort a p (q - 1);
    quick_sort a q r
  end

let rec stable_str a n i =
  if i = n then "Stable"
  else if a.(i-1).num = a.(i).num && a.(i-1).id > a.(i).id then "Not stable"
  else stable_str a n (i + 1)

let rec split str delim acc =
  let open String in
  match
    try Some (rindex str delim) with _ -> None
  with
  | None -> str :: acc
  | Some i -> split (sub str 0 i) delim (sub str (i + 1) (length str - i - 1) :: acc)

let () =
  let n = read_int () in
  let a = Array.init n (fun i ->
    match split (read_line ()) ' ' [] with
    | [c; d] -> { id = i; ch = c.[0]; num = int_of_string d }
    | _ -> exit 1) in
  quick_sort a 0 (n - 1);
  print_endline (stable_str a n 1);
  Array.iter (fun x -> Printf.printf "%c %d\n" x.ch x.num) a

Measured memory_bytes: 9112
open Printf
open Scanf

let id x = x

let solve a b m =
  let aa = Array.init a @@ fun _ -> scanf "%d " id in
  let ab = Array.init b @@ fun _ -> scanf "%d " id in
  let rec loop mn i =
    if i = 0 then mn
    else let (x, y, c) = scanf "%d %d %d " @@ fun x y c -> (x, y, c) in
         loop (min mn (aa.(x - 1) + ab.(y - 1) - c)) (i - 1) in
  loop (Array.fold_left min aa.(0) aa + Array.fold_left min aa.(0) aa) m

let () =
  scanf "%d %d %d " solve |> printf "%d\n"


Measured memory_bytes: 6272
#include <stdio.h>

int main(void)
{
	int H = 10, W = 10;
	int i, j;

	while (H != 0 && W != 0)
	{
		scanf("%d %d", &H, &W);

		if (H == 0 && W == 0) break;
		for (i = 0; i < H; i++)
		{
			for (j = 0; j < W; j++)
			{
				if ( (i == 0) || (i == H - 1) || (j == 0)|| (j == W - 1) ) 
				{
					printf("#");
				}
				else
				{
					printf(".");
				}
			}
			printf("\n");
			
		}

		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  int64_t even = 2;
  int64_t odd = 1;
  for(int i =2;i<=a;i++){
    if(i%2 == 0)
      even = even + odd;
    else
      odd = even + odd;
  }
  if(a%2 == 0)
    cout << even << endl;
  else
    cout << odd << endl;
  
}

Measured memory_bytes: 256
n, k = map(int, input().split())
ls = list(map(int, input().split()))

exv = 0

for j in range(k):
    exv += (ls[j] + 1) / 2

ans = exv

for i in range(k, n):
    exv += (ls[i] + 1) / 2
    exv -= (ls[i - k] + 1) / 2
    
    if exv > ans:
        ans = exv

print(ans)

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

int main() {
	int n,m;
	cin>>n>>m;
	vector<int>vec[n+1];
	vector<bool>vis(n+2,false);
	vector<int>pow(n+2,0);
	for(int i=1;i<=n;i++)
	cin>>pow[i];
	int a,b,count=0;
	while(m--)
	{
		cin>>a>>b;
		vis[a]=true;vis[b]=true;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	for(int i=1;i<=n;i++)
	{
		int k=0;
		for(auto x : vec[i])
		{
			if(pow[i]<=pow[x])
			{
				k=1;
				break;
			}
			//cout<<endl;
		}
		if(k==0)
		{
			count++;
		}
	}
	//cout<<nv<<" "<<count<<endl;
	cout<<count;
	return 0;
}

Measured memory_bytes: 8316
N,K = map(int, input().split())
s = input()

ans = 0
for i in range(N-1):
    if s[i] == "L" and s[i+1] == "L":
        ans += 1
    elif s[i] == "R" and s[i+1] == "R":
        ans += 1

ans += 2 * K
print(min(ans, N-1))


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

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	vector<string> s(n); rep(i, n) cin >> s[i];
	queue<int> ba, b, a, other;
	rep(i, n) {
		if (s[i].front() == 'B' and s[i].back() == 'A') ba.push(i);
		else if (s[i].front() == 'B') b.push(i);
		else if (s[i].back() == 'A') a.push(i);
		else other.push(i);
	}
	//  [other] - [*a] - [b*a] [b*a] ... [b*a] - [b*] - [*a] [b*] .. [*a][b*]
	string t;
	while (not other.empty()) {
		t += s[other.front()]; other.pop();
	}
	if (ba.size() > 0) {
		if (a.size() > 0 and b.size() > 0) {
			t += s[a.front()]; a.pop();
			while (not ba.empty()) {
				t += s[ba.front()]; ba.pop();
			}
			t += s[b.front()]; b.pop();
		} else if (a.size() > 0) {
			t += s[a.front()]; a.pop();
			while (not ba.empty()) {
				t += s[ba.front()]; ba.pop();
			}			
		} else if (b.size() > 0) {
			while (not ba.empty()) {
				t += s[ba.front()]; ba.pop();
			}			
			t += s[b.front()]; b.pop();
		} else {
			while (not ba.empty()) {
				t += s[ba.front()]; ba.pop();
			}		
		}
	}

	while (not b.empty() and not a.empty()) {
		t += s[a.front()]; a.pop();
		t += s[b.front()]; b.pop();
	}

	while (not b.empty()) {
		t += s[b.front()]; b.pop();
	}

	while (not a.empty()) {
		t += s[a.front()]; a.pop();
	}

	int ans = 0;
	rep(i, (int)t.size() - 1) {
		if (t[i] == 'A' and t[i + 1] == 'B') ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

bool ok(char i, char j, char k, string s) {
    for (int n = 0; n < s.size(); n++) {
        if (s[n] == i) {
            if (j == 'a') return true;

            return ok(j, k, 'a', s.substr(n + 1, s.size() - n - 1));
        }
    }

    return false;
}

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

    int n;
    string s;
    cin >> n >> s;

    int ans = 0;
    for (char i = '0'; i <= '9'; i++) {
        for (char j = '0'; j <= '9'; j++) {
            for (char k = '0'; k <= '9'; k++) {
                if (ok(i, j, k, s)) {
                    ans++;
                }
            }
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int a[100];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int i,j,k,m,n;
    int ans=2;
    cin>>n;
    if(n==1)
        cout<<1<<endl;
    else
    {
        while(ans<=n)
            ans*=2;
        cout<<ans/2<<endl;
    }
    return 0;
}


Measured memory_bytes: 384
use std::cmp;

fn main(){
  let n: usize = read();
  let va: Vec<u32> = read_vec();

  let mut gl: Vec<u32> = vec![va[0]; n];
  let mut gr: Vec<u32> = vec![va[n-1]; n];

  for i in 1 .. n {
    gl[i] = gcd(gl[i-1], va[i]);
  }

  for i in (0 .. n-1).rev() {
    gr[i] = gcd(gr[i+1], va[i]);
  }
  
  let mut ans: u32 = cmp::max(gl[n-2], gr[1]);

  for i in 0 .. n-2 {
    ans = cmp::max(ans, gcd(gl[i], gr[i+2]));
  }
  
  println!("{}", ans);
}

fn read<T>() -> T
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.trim().parse().unwrap()
}

fn read_vec<T>() -> Vec<T>
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.split_whitespace().map(|e| e.parse().unwrap()).collect()
}

fn gcd(a: u32, b: u32) -> u32 {
  if a == 0 { b }
  else { gcd( b % a, a) }
}


Measured memory_bytes: 6396
a = list(map(int, list(input())))
f = lambda x: '+' if x==1 else '-'
for i in range(-1, 2, 2):
    for j in range(-1, 2, 2):
        for k in range(-1, 2, 2):
            if a[0]+i*a[1]+j*a[2]+k*a[3]==7:
                print(str(a[0])+f(i)+str(a[1])+f(j)+str(a[2])+f(k)+str(a[3])+'=7')
                exit()

Measured memory_bytes: 3192
#include <stdio.h>
int main(){
	int b,sum,i,K,X;
	scanf("%d%d",&K,&X);
	int a[2*K];
	a[0] = X-K+1;
	for(i=1;i<2*K;i++){
		if(a[0]>=0)
		a[i] = a[0] +i;
		else 
		a[i] = a[0] +i;
	}
	for(i=0;i<K*2-1;i++){
	printf("%d ",a[i]);}
	return 0;
	}

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

int main() {
  vector<int> v(3);
  rep(i,3){
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  if(v[0]<v[1]){
    cout << v[0] << endl;
  }else{
    cout << v[2] << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
  char A[50];
  scanf("%s",A);
  if(A[0]=='S'&&A[1]=='U'){
    printf("7\n");
  }
  else if(A[0]=='M'){
    printf("6\n");
  }
  else if(A[0]=='T'&&A[1]=='U'){
    printf("5\n");
  }
  else if(A[0]=='W'){
    printf("4\n");
  }
  else if(A[1]=='H'){
    printf("3\n");
  }
  else if(A[0]=='F'){
    printf("2\n");
  }
  else{
    printf("1\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
  int N, M, L, R, l, r, i;
  for (i = 0, l = 0, r = 100000, scanf("%d%d",&N,&M); i < M && scanf("%d%d",&L,&R); i++) {
    if (r < L || l > R) {
      putchar('0');
      return 0;
    }
    if (L >= l) {
      l = L;
    }
    if (R <= r) {
      r = R;
    }
  }
  printf("%d",r-l+1);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
ll N,K,A[1010] = {0},pow[50] = {1},use[1000010] = {0};
int main(){
	cin >> N >> K;
	for(int i=1;i<=N;i++){
		cin >> A[i];
		A[i] += A[i-1];
	}
	for(int i=1;i<=50;i++) pow[i] = 2*pow[i-1];
	vector<ll> v,u;
	for(int i=1;i<=N;i++){
		for(int j=i;j<=N;j++){
			v.push_back(A[j]-A[i-1]);
		}
	}
	for(int i=0;i<N*(N+1)/2;i++){
		use[i] = 1;
	}
	ll ans = 0;
	for(ll j=41;j>=0;j--){
		int cnt = 0;
		for(int i=0;i<N*(N+1)/2;i++){
			if(use[i]==1 && (v[i] & ((ll) 1<<j))){
				cnt++;
			}
		}
		if(cnt>=K){
			ans += pow[j];
			for(int i=0;i<N*(N+1)/2;i++){
				if(use[i]==1 && !(v[i] & ((ll) 1<<j))) use[i] = 0;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 8428
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;

int main() {

    int P, Q, R;
    cin >> P >> Q >> R;

    int sum = P + Q + R;
    cout << sum - max(max(P, Q), R) << endl;
}


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

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



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

int main(){
    int N;
    cin >> N;
    int H[N];
    
    int max=0;
    int count=0;
    for(int i=0; i<N; i++){
        cin >> H[i];
        if(max <= H[i]){
            max = H[i];
            count++;
        }
    }
    
    cout << count << endl;
    
    
    
    return 0;
}

Measured memory_bytes: 256
N = int(input())

# e[i]: N!の素因数分解でのiの指数
e = [0] * (N+1)
for i in range(2,N+1):
    cur = i
    for j in range(2,i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j

# eの要素で(M-1)以上のものの個数
def num(M:int):
    return len(tuple(filter(lambda x: x >= M-1, e)))

answer = num(75)
# -1は、num(25)の分
answer += num(25) * (num(3) - 1)
answer += num(15) * (num(5) - 1)
# //2は、二つのnum(5)は区別しないから
answer += num(5) * (num(5) - 1) * (num(3) - 2) // 2

print(answer)

Measured memory_bytes: 3064
Sa = list(input())
Sb = list(input())
Sc = list(input())
turn = "a"
while True:
  if turn == "a":
    if Sa == []:
      print("A")
      break
    turn = Sa[0]
    del Sa[0]      
  elif turn == "b":
    if Sb == []:
      print("B")
      break
    turn = Sb[0]
    del Sb[0]      
  else:
    if Sc == []:
      print("C")
      break
    turn = Sc[0]
    del Sc[0]      

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std ; 
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fast ios_base:: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define pii pair<int,int> 
long long M  = 1e9+7;
vector <int> a,b,c;
int x,y;
void findPermutations(vector <int> &arr, int n) 
{ 
  
  	int c = 0;
    do { 
    	int f1 =0 , f2 = 0;
    	for(int i=0 ; i<arr.size() ; i++){
    		if(a[i]!=arr[i]){
    			f1 = 1;
    			break;
    		}
    	}

    	for(int i=0 ; i<arr.size() ; i++){
    		if(b[i]!=arr[i]){
    			f2 = 1;
    			break;
    		}
    	}
    	if(f1 == 0){
    		x = c;
    	}
    	if(f2 == 0){
    		y = c;
    	}
    	c++;
    } while (next_permutation(all(arr))); 
} 
signed main(){
    fast;
    int n; cin >> n;
    
    for(int i=0 ; i<n ; i++){
    	int x; cin >> x;
    	a.pb(x);
    }
    for(int i=0 ; i<n ; i++){
    	int x; cin >> x;
    	b.pb(x);
    }

    for(int i=1 ; i<=n ; i++){
    	c.pb(i);
    }

    findPermutations(c, c.size());
    cout << abs(x-y) << endl;

}


Measured memory_bytes: 256
//	created : 16/03/06
// 	autor   : Rp7rf
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <set>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define INF 1e9
#define MAX 999999 + 10
bool prime[MAX];
int cnt[MAX];

void init_prime(){
	rep(i,MAX){
		prime[i] = true;
		
	}
	prime[0] = prime[1] = false;
	int c = 0;
	rep(i,MAX){
		if(prime[i]){
			for(int j = i + i ; j < MAX ; j += i){
				prime[j] = false;
			}
			c++;
		}
		cnt[i] = c;

	}
}

int main(void){
	init_prime();
	int n ;
	while(cin>>n){
		cout<<cnt[n]<<endl;
	}
}

Measured memory_bytes: 6044
N,M,C=map(int, input().split())
B=list(map(int, input().split()))
A=[list(map(int, input().split())) for n in range(N)]

def Sof(a):
  d=C
  for m in range(M):
    d+=a[m]*B[m]
  return d > 0

co=0
for i in range(N):
  if(Sof(A[i])):
    co+=1

print(co)

Measured memory_bytes: 3064