akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000000
#define INF INT_MAX
#define LL long long
#define ULL unsigned LL
#define EPS 0.00000001
#define PI acos(-1.0)
#define MOD 100000007LL
#define pii pair<int,int>
#define pll pair<LL,LL>
#define ck(XX) cout<<XX<<endl
#define Set(XX,PS) XX|(1<<PS)
#define Reset(XX,PS) XX&(~(1<<PS))
#define Toggle(XX,PS) (XX^(1<<PS))
#define Check(XX,PS) (bool)(XX&(1<<PS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define Fin freopen("input.txt","r",stdin)
#define Fout freopen("output.txt","w",stdout)
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define ck2(XX,YY) cout<<XX<<"->"<<YY<<endl

double calc (int A)
{
    double ans = (sqrt(1.0+(8.0*A))-1.0)/2.0;
    return ans;
}

int is_int(double n)
{
    int t = n;
    double ans = n- (double) t;
    if(ans == 0.0) return 1;
    else return 0;
}

int main()
{
    FAST;
    int a,b;
    cin >>a>>b;
    for(int i=1;;i++)
    {
        if((a+i) > 499500 || (b+i) > 499500) {cout<<1<<endl; return 0;}

        double x = calc(a+i);
        double y = calc(b+i);

        int ch = y;

        if(is_int(x)==1 && is_int(y)==1 && (b-a)==ch) {cout<<i<<endl; return 0;}
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int minf (int a, int b){
    int tmp = a;
    if(b < a){
        tmp = b;
    }
    return tmp;
}
int main(){
    int a;
    int b;
    int N;
    
    scanf("%d %d %d", &N, &a, &b);
    int max;
    int min = 0;
    max = minf(a, b);
    if(a + b > N){
        min = a+b-N;
    }

    printf("%d %d\n", max, min);
    return 0;
}

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

int main() {
  int N;
  cin >> N ;
  vector<int> a(N);
  for (int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  int now = 0;
  for (int i = 0; i < N; i++){
    if(now == 1){
      cout << i << endl;
      break;
    }else if(i == N - 1){
      cout << -1 << endl;
    }
    now = a.at(now) - 1;
  }
}

Measured memory_bytes: 3700
import sys
sdin = sys.stdin.readline

h,w = map(int, sdin().split())
field = []
for hi in range(h):
    field.append(sdin())
    
f2 = []
for hi in range(h):
    if field[hi].count("#") > 0:
        f2.append(field[hi])
    
f2_char = [list(f2[hi]) for hi in range(len(f2))]

# 列を圧縮
has_black_list = []
for wj in range(w):
    has_black = False
    for hi in range(len(f2)):
        if f2_char[hi][wj] == "#":
            has_black = True    
    
    if has_black:
        has_black_list.append(wj)
        
field_ans = [["" for wj in range(len(has_black_list))] for hi in range(len(f2))]
for j, wj in enumerate(has_black_list):
    for hi in range(len(f2)):
        field_ans[hi][j] = f2_char[hi][wj]
    

for hi in range(len(f2)):
    print("".join(field_ans[hi]))

Measured memory_bytes: 3188
n = raw_input()
n,k = int(n.split(" ")[0]), int(n.split(" ")[1])

h = []
for i in range(n):
	h.append(int(raw_input()))
h = sorted(h)

min_diff = 99999999999
for i in range(n-k+1):
	diff = h[i+k-1]-h[i]
	if diff<min_diff:
		min_diff = diff
print(min_diff)

Measured memory_bytes: 9332
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int N =sc.nextInt();
    int K =sc.nextInt();
    int p[] =new int[N];
    int t =0;
    int u =0;
    for(int i=0;i<N;i++){
      p[i]=sc.nextInt();
      if(i<K-1){t =t+p[i];}
      else if(i==K-1){t=t+p[i]; u=Math.max(u,t);}
      else{t =t+p[i]-p[i-K];u =Math.max(u,t);}}
    int E =u+K;
    int e=E/2;;
    if(E%2==0){System.out.println(e);}
    else{ System.out.println(e+0.5);}
  }
}


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

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main() {
	double n;
	cin >> n;
	n = sqrt(n);
	int ans = (int)n * (int)n;
	cout << ans << endl;
}

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


int main(){
    int N, K, M, cnt, t;
    cin >> N >> K;
    int treat[N];
    rep(i , N){
        treat[i] = 0;
    }
    cnt = 0;
    rep(i, K){
        cin >> M;
        rep(i, M){
            cin >> t;
            treat[t-1]++;
        }
    }

    rep(i, N){
        if(treat[i] == 0){
            cnt++;
        }
    }

    cout << cnt << endl;

}

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

using namespace std;

#define el				'\n'
#define sz(v)			((int)((v).size()))
#define all(v)          ((v).begin()),((v).end())
#define clr(v, d)		memset(v, d, sizeof(v))

double const EPS = 1e-8, PI = acos(-1);
const int N = 2e5 + 9, M = 50 + 9, OO = (int) 1e9 + 1;
const long long MOD = 1e9 + 7;

typedef long long ll;

void OUTPUT() {
	cout << fixed << setprecision(12);
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

void INPUT() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cout << fixed << setprecision(12);
//	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

int n, m, x, y;
priority_queue<int> v;
ll cnt;

int main() {
	OUTPUT();
//	INPUT();
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		cin >> x;
		v.push(x);
	}
	while (m && !v.empty()) {
		y = v.top();
		v.pop();
		y /= 2;
		if (y != 0)
			v.push(y);
		m--;
	}
	while (!v.empty()) {
		y = v.top();
		v.pop();
		cnt += y;
	}
	cout << cnt;

	return 0;

}


Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <climits>
#include <iomanip>
#include <cmath>
using namespace std;
using uint = unsigned int;

int main() {
	
	uint N;
	cin >> N;
	
	vector<double> X(N);
	vector<double> Y(N);
	
	double lx = 1000;
	double hx = 0;
	double ly = 1000;
	double hy = 0;
	
	for(uint i=0; i<N; i++) {
		cin >> X[i] >> Y[i];
		lx = min(lx, X[i]);
		hx = max(hx, X[i]);
		ly = min(ly, Y[i]);
		hy = max(hy, Y[i]);
	}
	
	double curX = (hx + lx) / 2;
	double curY = (hy + ly) / 2;
	double nxtX = 0;
	double nxtY = 0;
	
	double alfa = 0.1;
	uint idx = 0;
	
	while(alfa > pow(10, -9)) {	
		curX = nxtX;
		curY = nxtY;
		double maxD = 0;
		
		for(uint i=0; i<N; i++) {
			double d = pow(X[i] - curX, 2) + pow(Y[i] - curY, 2);
			
			if(maxD < d) {
				maxD = d;
				idx = i;
			}
		}
		
		nxtX = (1 - alfa) * curX + alfa * X[idx];
		nxtY = (1 - alfa) * curY + alfa * Y[idx];
		alfa = alfa * 0.99999;
	
	}
	
	double ans = sqrt(pow(X[idx] - curX, 2) + pow(Y[idx] - curY, 2));
	cout << setprecision(10) << ans;
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = int.Parse(ReadLine());
        var sb = new StringBuilder();
        for(int i = 0; i < n; i++)
        {
            sb.Append("ACL");
        }
        WriteLine(sb.ToString());
    }
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    string S; cin >> S;
    map<ll, ll> x;
    rep(i, S.size()){
        if (x.find(S[i]) != x.end()){x[S[i]]++;}else{x[S[i]]=1;}
    }
    bool flag = true;
    for (auto a: x){
        if (a.second != 2){flag = false;}
    }
    string ans = flag ? "Yes" : "No";
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int memo[100001];

int mod(int a)
{
    if(a<0)
     return (-1*a);
      return a;
}
int fun(int x,int* arr)
{
   if(x==1)
    return 0;
   if(memo[x]!=-1)
    return memo[x];
    if(x>2)
    return memo[x]=min(fun((x-1),arr)+mod(arr[x]-arr[x-1]),fun((x-2),arr)+mod(arr[x]-arr[x-2]));
    else
     return memo[x]=fun((x-1),arr)+mod(arr[x]-arr[x-1]);
}

int main()
{
    memset(memo,-1,sizeof(memo));
    memo[1]=0;
    int n;
    cin>>n;
    int arr[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
    }
    cout<<fun(n,arr)<<"\n";
    return 0;
}

Measured memory_bytes: 4096
N = int(input())
line = input()
A = line.split()
hei = 0
for i in range(N-1):
    d = int(A[i+1]) - int(A[i])
    if d < 0:
        hei = hei - d
        A[i+1] = str(int(A[i+1]) - d)
print(hei)


Measured memory_bytes: 25204
fun main() {
    val s = readLine()!!
    val arr = Array(2){IntArray(2019)}
    var ans = 0L
    var cur = 0

    for(i in s.indices) {
        val d = s[i] - '0'
        val req = (2019 - d) % 2019
        val ni = (cur + 1) % 2

        ans += arr[cur][req]

        for(j in 0 until 2019) {
            arr[ni][j] = 0
        }
        for(j in 0 until 2019) {
            val next = ((j + d) * 10) % 2019
            arr[ni][next] += arr[cur][j]
        }
        arr[ni][d * 10] += 1
        cur = ni
    }
    print(ans)
}


Measured memory_bytes: 39856
import sys
N = int(input())
evens = [i for i in range(1, N+1) if i%2 ==0]
even_cnts = []
if evens == []:
    print(1)
    sys.exit()
for even in evens:
    cnt = 0
    while even % 2 ==0:
        cnt += 1
        even = even / 2
    even_cnts.append(cnt)
max_cnts = max(even_cnts)
index = even_cnts.index(max_cnts)
print(evens[index])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
int Tong[100];
using namespace std;
int main()
{
	int A,B;
	scanf("%d%d",&A,&B);
	Tong[A]++;Tong[B]++;
	if(!Tong[1]) cout<<1;
	if(!Tong[2]) cout<<2;
	if(!Tong[3]) cout<<3;
	return 0;
}

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

template<typename T>
struct Dinic{
  struct edge{int to;T cap,rev;};
  const T Inf = 1e9;
  int V;
  std::vector<std::vector<edge>>G;
  std::vector<int> level;
  std::vector<int> iter;
  Dinic(int n):G(n),level(n),iter(n),V(n){}
  void add_edge(int from, int to, T cap){
    G[from].push_back({to, cap, (T)G[to].size()});
    G[to].push_back({from, 0, (T)G[from].size()-1});
  }
  
  void bfs(int s){
    std::fill(level.begin(), level.end(), -1);
    std::queue<int>que;
    level[s] = 0;
    que.push(s);
    while(!que.empty()){
      int v = que.front();
      que.pop();
      for(int i = 0;i < G[v].size();i++){
	edge &e = G[v][i];
	if(e.cap > 0 && level[e.to] < 0){
	  level[e.to] = level[v]+1;
	  que.push(e.to);
	}
      }
    }
  }
  
  T dfs(int v, int t, T f){
    if(v == t)return f;
    for(int &i = iter[v];i < G[v].size();i++){
      edge &e = G[v][i];
      if(e.cap > 0 && level[v] < level[e.to]){
	T d = dfs(e.to, t ,std::min(f, e.cap));
	if(d > 0){
	  e.cap -= d;
	  G[e.to][e.rev].cap += d;
	  return d;
	}
      }
    } 
    return 0;
  }

  T execution(int s, int t){
    T flow = 0;
    while(true){
      bfs(s);
      if(level[t] < 0)return flow;
      std::fill(iter.begin(), iter.end(), 0);
      T f;
      while((f = dfs(s, t, Inf)) > 0){
	flow += f;
      }
    }
  }
};


int main(){
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int v,e;std::cin>>v>>e;
  Dinic<int> dinic(v);
  while(e--){
    int u,vv,c;std::cin>>u>>vv>>c;
    dinic.add_edge(u,vv,c);
  }
  std::cout<<dinic.execution(0,v-1)<<std::endl;
  return 0;
}



Measured memory_bytes: 3260
#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)

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

vector< int > divisor(int n) {
  vector< int > ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

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

    int n;
    cin >> n;
    int a[200010];
    for (int i=0; i<n; i++) {
        cin >> a[i];
    }
    multiset<int> s;
    for (int i=0; i <n; i++) {
        s.insert(a[i]);
    }
    int res =0;
    for (int i=0; i<n; i++) {
        s.erase(s.find(a[i]));

        auto div = divisor(a[i]);
        for (auto e: div) {
            if (s.find(e) != s.end()) {
                goto bad;
            }
        }
        res++;
        bad:
        s.insert(a[i]);
    }

    cout << res << endl;
}

Measured memory_bytes: 13772
import java.util.*;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long[] f = new long[21];
		f[0]=f[1]=1;
		for(int i=2;i<21;i++)f[i]=i*f[i-1];
		System.out.println(f[sc.nextInt()]);
	}
}

Measured memory_bytes: 12000
n = int(input())
s = input()

lst = []
for i in range(1,len(s)):
    s1 = s[:i]
    s2 = s[i:]
    #print(s1,s2)
    
    sls1 = []
    sls2 = []
    for j in range(len(s1)):
        sls1.append(s1[j])
    for j in range(len(s2)):
        sls2.append(s2[j])
    s1 = sls1
    s2 = sls2
    s1.sort()
    s2.sort()
    #print(s1,s2)
    
    sls1 = [s1[0]]
    for j in range(1,len(s1)):
        if s1[j] != s1[j-1]:
            sls1.append(s1[j])
    sls2 = [s2[0]]
    for j in range(1,len(s2)):
        if s2[j] != s2[j-1]:
            sls2.append(s2[j])
    s1 = sls1
    s2 = sls2
    #print(s1,s2)
    
    cnt = 0
    for j in range(len(s1)):
        for k in range(len(s2)):
            if s1[j] == s2[k]:
                cnt += 1
    lst.append(cnt)
lst.sort()
#print(lst)
print(lst[-1])

Measured memory_bytes: 3064
import sys

input = sys.stdin.readline

N = int(input().strip())
As = list(map(int, input().strip().split(' ')))
Bs = list(map(int, input().strip().split(' ')))

count = 0
for i, b in enumerate(Bs):
    if As[i] >= b:
        count += b
    elif As[i] < b:
        if As[i+1] >= b - As[i]:
            count += b
            As[i+1] -= b - As[i]
        else:
            count += As[i] + As[i+1]
            As[i + 1] = 0
print(count)

Measured memory_bytes: 18476
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define mp 	    make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define mod        1000000007
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
ll power(ll a , ll b,ll modi)
{
    a%=modi;
    ll res = 1 ;
    while(b)
    {
        if(b%2) {
            res = (res * a) % modi ;
        }
        b/=2 ;
        a = (a*a) % modi ;
    }
    return res ;
}
//ll a[200001];
//bool mark[200001];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t=1;
	//cin>>t;
	while(t--)
	{
	    string s;
	    cin>>s;
	    ll l=s.length();
	    ll a[2019]={0};
	    a[0]=1;
	    ll p=1;
	    ll ans=0;
	    ll pre=0;
	    for(ll i=l-1;i>=0;i--){
            ll num=s[i]-'0';
            pre=((num*p)%2019+pre)%2019;
            ans+=a[pre];
            p=(p*10)%2019;
            a[pre]++;
	    }
	    cout<<ans;
	}
return 0;
}


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int n;
int x[24],y[24],r[24],c[24];

inline bool intersect(int p, int q)
{
    double dist=sqrt((x[p]-x[q])*(x[p]-x[q])+(y[p]-y[q])*(y[p]-y[q]));
    return dist<(r[p]+r[q]);
}

inline bool available(int p, int state)
{
    rep(i,p)
    {
        if(state>>i&1 && intersect(p,i)) return false;
    }
    return true;
}

unordered_map<int,int> dp;
// int dp[1<<24];
int dfs(int state)
{
    if(dp.find(state) != dp.end()) return dp[state];
    // if(dp[state]>=0) return dp[state];
    if(__builtin_popcount(state)<2) return 0;

    int ret=0;
    rep(i,n)
    {
        if(state>>i&1)
        {
            if(!available(i,state)) continue;

            rep(j,n)
            {
                if(i==j) continue;
                if(c[i]!=c[j]) continue;

                if(state>>j&1)
                {
                    if(!available(j,state)) continue;
                    ret = max(ret,dfs(state-(1<<i)-(1<<j))+2);
                }
            }
        }
    }

    return dp[state]=ret;
}

int main()
{
    while(cin >>n,n)
    {
        rep(i,n) scanf(" %d %d %d %d", &x[i], &y[i], &r[i], &c[i]);
        dp.clear();
        cout << dfs((1<<n)-1) << endl;
    }
    return 0;
}

Measured memory_bytes: 43952
#include <iostream>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main() {
  int a, b, h;
  cin >> a >> b >> h;

  cout << (a + b) * h / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int a[n];
	int i,j;
	for(i=0;i<n;i++)
	cin>>a[i];
	bool b[k+1];
	memset(b,false,sizeof(b));
	for(i=1;i<=k;i++)
	{
		for(j=0;j<n;j++)
		{
			if(i-a[j]>=0)
			{
				if(b[i-a[j]]==false)
				{
					b[i]=true;
					break;
				}
			}
		}
	}
	if(b[k]==true)
	cout<<"First";
	else
	cout<<"Second";
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(n);
// string p=s.substr(0,len);
// string q=s.insert(0,str);
// sort(arr, arr+n, greater<int>());
// cout<<fixed<<setprecision(9)<<pi<<endl
// const  double pi = acos(-1.0);
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


int main(void)
{
	fast();
	int x;
	cin>>x;
	if(x>=400 && x<=599)
	{
		cout<<8<<endl;
	}		
	if(x>=600 && x<=799)
	{
		cout<<7<<endl;
	}
	if(x>=800 && x<=999)
	{
		cout<<6<<endl;
	}
	if(x>=1000 && x<=1199)
	{
		cout<<5<<endl;
	}
	if(x>=1200 && x<=1399)
	{
		cout<<4<<endl;
	}
	if(x>=1400 && x<=1599)
	{
		cout<<3<<endl;
	}
	if(x>=1600 && x<=1799)
	{
		cout<<2<<endl;
	}
	if(x>=1800 && x<=1999)
	{
		cout<<1<<endl;
	}
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<cstdlib>
#include<map>
using namespace std;
int n,x,ans;
map<int,bool>mp;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x;
		mp[x]=!mp[x];
		if(mp[x]==1) ans++;
		else ans--;
	}
	cout<<ans;
 	return 0;
}

Measured memory_bytes: 4992
#!/usr/bin/env python3


def main() -> None:
    A, B, C, K = rmi()
    sum_ = 0
    if A < K:
        sum_ += A
        K -= A
    else:
        sum_ += K
        K = 0
    if B < K:
        K -= B
    else:
        K = 0
    if 0 < K:
        sum_ -= K
    w(sum_)


def r() -> str:
    return input().strip()


def ri() -> int:
    return int(r())


def rmi(delim: str = ' ') -> tuple:
    return tuple(map(int, input().split(delim)))


def w(data) -> None:
    print(data)


def wm(*data, delim: str = ' ') -> None:
    print(delim.join(map(str, data)))


if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10 ** 9)
    main()


Measured memory_bytes: 9220
fun main(args: Array<String>){
    val N :Int = readLine()!!.toInt()
    val x = readLine()!!.split(" ").map(String::toInt)
    val y = x.toIntArray()
    y.sort()
    val ml = y[N/2-1]
    val mr = y[N/2]
    for(i in x.indices){
      if(x[i]<=ml){
        println(mr)
      }
      else{
        println(ml)
      }
    }
}

Measured memory_bytes: 96800
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]

for i in range(N):
  for j in range(3):
    for k in range(3):
      if A[j][k]==b[i]:
        A[j][k] = 0

if A[1][1]==0 and A[0][0]==0 and A[2][2]==0 or A[1][1]==0 and A[2][0]==0 and A[0][2]==0 or A[1][1]==0 and A[0][1]==0 and A[2][1]==0 or A[1][1]==0 and A[1][0]==0 and A[1][2]==0 or A[0][0]==0 and A[0][1]==0 and A[0][2]==0 or A[0][0]==0 and A[1][0]==0 and A[2][0]==0 or A[2][2]==0 and A[0][2]==0 and A[1][2]==0 or A[2][2]==0 and A[2][0]==0 and A[2][1]==0:
  print("Yes")
else:
  print("No")


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

#define INF 1145141919810364364

int main() {
	int N, M, R, r[8];
	static long long Dis[200][200] = {}, ans = INF;
	cin >> N >> M >> R;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i != j) Dis[i][j] = Dis[j][i] = INF;
		}
	}
	for (int i = 0; i < R; i++) {
		cin >> r[i];
		r[i]--;
	}
	for (int i = 0; i < M; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		Dis[a][b] = Dis[b][a] = c;
	}
	for (int k = 0; k < N; k++) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				Dis[i][j] = min(Dis[i][j], Dis[i][k] + Dis[k][j]);
			}
		}
	}
	sort(r, r + R);
	do {
		long long count = 0;
		for (int i = 0; i < R - 1; i++) {
			count += Dis[r[i]][r[i + 1]];
		}
		ans = min(ans, count);
	} while (next_permutation(r, r + R));
	cout << ans;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s=scan.nextLine();
		if(s.contains("Sunny")) System.out.println("Cloudy");
		else if(s.contains("Cloudy")) System.out.println("Rainy");
		else System.out.println("Sunny");
	}

}


Measured memory_bytes: 26804
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args)  {
         Scanner sc = new Scanner(System.in);
    int dice[] = new int[6];
    int right = 0; 
     
    for(int i=0; i<6; i++){
        dice[i] = sc.nextInt();
        }
         
    int q  = sc.nextInt();
     
    for(int i =0; i<q; i++){
        int top = sc.nextInt(); 
        int front = sc.nextInt();
 
        if(top == dice[0]){
           if(front == dice[1]){
               right = dice[2];
           }
           else if(front == dice[2]){
               right = dice[4];
           }
           else if(front == dice[4]){
               right = dice[3];
           }
           else if(front == dice[3]){
               right = dice[1];
           }
        }
        else if(top == dice[1]){
           if(front == dice[5]){
               right = dice[2];
           }
           else if(front == dice[2]){
               right = dice[0];
           }
           else if(front == dice[0]){
               right = dice[3];
           }
           else if(front == dice[3]){
               right = dice[5];
           }
        }
        else if(top == dice[2]){
            if(front == dice[5]){
                right = dice[4];
            }
            else if(front == dice[4]){
                right = dice[0];
            }
            else if(front == dice[0]){
                right = dice[1];
            }
            else if(front == dice[1]){
                right = dice[5];
            }
        }
        else if(top == dice[3]){
            if(front == dice[0]){
                right = dice[4];
            }
            else if(front == dice[4]){
                right = dice[5];
            }
            else if(front == dice[5]){
                right = dice[1];
            }
            else if(front == dice[1]){
                right = dice[0];
            }
        }
        else if(top == dice[4]){
            if(front == dice[0]){
                right = dice[2];
            }
            else if(front == dice[2]){
                right = dice[5];
            }
            else if(front == dice[5]){
                right = dice[3];
            }
            else if(front == dice[3]){
                right = dice[0];
            }
        }
        else if(top == dice[5]){
            if(front == dice[3]){
                right = dice[4];
            }
            else if(front == dice[4]){
                right = dice[2];
            }
            else if(front ==dice[2]){
                right = dice[1];
            }
            else if(front == dice[1]){
                right = dice[3];
            }
        
        }
     System.out.println(right);
 
    }
 
   }
}

Measured memory_bytes: 26364
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n;
    vector<int> c(4, 0);
    cin >> n;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        c[a]++;
    }
    int m = n+1;
    vector< double > dp(m*m*m, 0);
    auto f = [&](int i1, int i2, int i3){ return (i1*m+i2)*m+i3; };
    for(int i3=0;i3<=n;i3++){
        for(int i2=0;i2<=n;i2++){
            for(int i1=0;i1<=n;i1++){
                int sum = i1+i2+i3;
                if(sum == 0) continue;
                double &res = dp[f(i1, i2, i3)];
                res = 1.0 * (n-sum) / n;
                if(i1 > 0) res += (dp[f(i1-1, i2, i3)] + 1.0) * i1 / n;
                if(i2 > 0) res += (dp[f(i1+1, i2-1, i3)] + 1.0) * i2 / n;
                if(i3 > 0) res += (dp[f(i1, i2+1, i3-1)] + 1.0) * i3 / n;
                res *= 1.0 * n / sum;
                // cout << i1 << " " << i2 << " " << i3 << endl;
                // cout << fixed << setprecision(12) << (res) << endl;
            }
        }
    }
    cout << fixed << setprecision(12) << dp[(f(c[1], c[2], c[3]))] << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<long> A(N);
  for (int i =0; i<N; i++) {
    cin >> A.at(i);
  }
  
  vector<long> L(N); // 対象の番号より小さい番号のGCD
  vector<long> R(N); // 対象の番号より大きい番号のGCD
  L.at(0) = 0; L.at(1) = A.at(0);
  R.at(N-1) = 0; R.at(N-2) = A.at(N-1);
  for (int i =2; i<N; i++) {
    L.at(i) = __gcd(L.at(i-1),A.at(i-1));
  }
  for (int i =N-3; i>=0; i--) {
    R.at(i) = __gcd(R.at(i+1),A.at(i+1));
  }
  long ans =0;
  for (int i =0; i<N; i++) {
    ans = max(__gcd(L.at(i),R.at(i)),ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 5552
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let S = rl();

    println!("{}", if S.as_str() <= "2019/04/30" { "Heisei" } else { "TBD" })
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <climits>

#define MAX_SIZE 100000000
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  int N,K;cin>>N>>K;
  vector<int> arr(N);
  for(auto& a : arr) {
    cin>>a;
  }

  int imin = INT_MAX;
  for(int i = 0; i < K; i++) {
    imin = min(imin, arr[i]);
  }

  int now_pos = 0;
  int cnt = 0;
  while(now_pos < (int)arr.size() - 1) {
    cnt++;
    now_pos = now_pos + K - 1;
  }

  cout << cnt << endl;
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

ll pos[200009],neg[200009];
//693153663
//523857784
void solve()
{
	int n,i,k;
	cin>>n>>k;
	int ps=0,ng=0;
	for(i=0;i<n;i++)
	{
		int t;
		cin>>t;
		if(t>=0) pos[ps++]=t;
		else neg[ng++]=-t;
	}
	sort(pos,pos+ps,greater<ll>());
	sort(neg,neg+ng,greater<ll>());
	if(k==n)
	{
		ll pd=1;
		for(i=0;i<ps;i++)
		pd = pd*pos[i]%mod;
		for(i=0;i<ng;i++)
		pd = pd*neg[i]%mod;
		if(ng%2) pd=(mod-pd)%mod;
		cout<<pd<<'\n';
		return;
	}
	if(ps==0 && k%2)
	{
		ll pd=1;
		for(i=0;i<k;i++)
		pd = pd*neg[ng-1-i]%mod;
		pd=(mod-pd)%mod;
		cout<<pd<<'\n';
		return;
	}
	int tot=0;
	int j=0;
	i=0;
	ll pd=1;
	if(k%2)
	pd=pos[0],i++,tot=1;
	while(tot<k)
	{
		if(i>ps-2)
		{
			pd=pd*neg[j]%mod*neg[j+1]%mod;
			j+=2;
		}
		else if(j>ng-2)
		{
			pd=pd*pos[i]%mod*pos[i+1]%mod;
			i+=2;
		}
		else
		{
			if(pos[i]*pos[i+1]>neg[j]*neg[j+1])
			{
				pd=pd*pos[i]%mod*pos[i+1]%mod;
				i+=2;
			}
			else
			{
				pd=pd*neg[j]%mod*neg[j+1]%mod;
				j+=2;
			}
		}
		tot+=2;
	}
	cout<<pd<<'\n';
}

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


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

using i64 = int64_t;
using namespace std;
const i64 MOD = 1000000007LL;
vector<i64> fact(500000);

inline i64 powermod(i64 a,i64 b){
  i64 r = 1LL;
  for(int i = 32 - __builtin_clz(b) - 1; i >= 0; i-- ){
    if((1 << i) & b) r = r * r % MOD * a % MOD;
    else r = r * r % MOD;
  }
  return r;
}

inline i64 divmod(i64 a,i64 b){
  return a * powermod(b,MOD-2) % MOD;
}

i64 nCr(i64 n,i64 r){
  if(r<0)return 0;
  i64 ne = fact[n];
  i64 di = fact[n-r] * fact[r] % MOD;
  return divmod(ne,di);
}

inline i64 A(i64 a,i64 b){
  return (nCr(a,b) + MOD - nCr(a,b-1)  ) % MOD;
}

int main() {
  i64 N,M,K;
  cin >> N >> M >> K;
  
  fact[0] = fact[1] = 1LL;
  for(int i = 2;i < 500000;i++){
    fact[i] = fact[i-1] * (i64)i % MOD;
  }
  
  i64 res = 0LL;
  for(i64 i = 0LL; i <= K; i++ ){
    res += nCr(N+M+K+K,N+i*2) * A(N+i*2,i) % MOD * A(M+(K-i)*2,K-i) % MOD;
    res %= MOD;
  }
  
  cout << res << endl;
}


Measured memory_bytes: 6616
while 1:
    ipt = raw_input()
    if ipt=="0": break
    m,n = map(int, ipt.split())
    ans = 0
    for i in xrange(m,n+1):
        p = i
        while p>1:
            if p%2==0:
                p/=2
            elif p%3==0:
                p/=3
            elif p%5==0:
                p/=5
            else: break
        if p==1: ans+=1
    print ans

Measured memory_bytes: 4212
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define distance(x1,y1,x2,y2) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("yes");
	else say("no");
}

void Yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

template<typename T>
void maxi(T & a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T & a, T b) {
	a = min(a, b);
}

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

template<class T> void getVector(vector<T> & v) {
	for (int i = 0; i < v.size(); ++i)
		cin >> v[i];
}

int main() {
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	say(h * w - (h / a * a) * (w / b * b));
}


Measured memory_bytes: 3080
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n, m] <- getIntList
    as <- getIntList
    let s = ((sum as) - 1) `div` (4 * m) + 1
    putStrLn $ if (length (filter (>= s) as)) >= m then "Yes" else "No"

Measured memory_bytes: 508
using System;
using System.Collections.Generic;

namespace ABC142_C
{
    class Program
    {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split();
            var ansArr = new int[n + 1];

            for(int studentIndex = 0; studentIndex < n; studentIndex++) {
                int peopleCount = int.Parse(input[studentIndex]);
                ansArr[peopleCount] = studentIndex + 1;
            }

            for(int i = 1; i <= n; i++) {
                Console.Write(ansArr[i] + " ");
            }
        }
    }
}

Measured memory_bytes: 25304
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

bool isprime(int n) {
  if(n <= 1) return false;
  for(int i = 2; i * i <= n; i++) {
    if(n % i == 0) return false;
  }
  return true;

}

int main() {
  int X ; cin>>X;
  for( ; ; X++) {
    if(isprime(X)) {
      cout << X << endl;
      break;
    }
  }
  return 0;
}


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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)

#define ll long long

#define pq(name,type) priority_queue<type> name
#define vec(name,type,length,value) vector<type> name(length,value)
#define vec2(name,type,length,width,value) vector<vector<type>> name(length,vector<type>(width,value));

int main(){
	long long N;
  cin >> N;
  vector<long long> a(N);
  froop1(0,N){
    cin >> a.at(i);
  }
  long long sum = 0;
  sort(a.begin(),a.end(),greater<int>());
  vector<long long> b;
  froop1(1,N){
    b.push_back(a.at(i));
    b.push_back(a.at(i));
  }
  sum += a.at(0);
  froop1(0,N - 2){
    sum += b.at(i);
  }
  cout << sum << endl;

return 0;
}

Measured memory_bytes: 9016
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{


    class Program
    {

        static int Solve(int N, int[] h)
        {
            int[] dp = new int[N];

            dp[0] = 0;

            for(int i = 1; i < N; i++)
            {
                if(i - 2 < 0)
                {
                    dp[i] = dp[i - 1] + Math.Abs(h[i] - h[i - 1]);
                    continue;
                }
                dp[i] = Math.Min(dp[i - 1] + Math.Abs(h[i] - h[i - 1]), dp[i - 2] + Math.Abs(h[i] - h[i - 2]));
            }

            return dp[N - 1];
        }


        
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int[] h = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            Console.WriteLine(Solve(N, h));
        }
    }
}

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

int main(){
  int n, s=0;
  cin >> n;
  int a[n], b[n], c[n-1];
  for(int i=0; i<n; i++) cin >> a[i];
  for(int i=0; i<n; i++) cin >> b[i];
  for(int i=0; i<n-1; i++) cin >> c[i];
  int now_num, prev_num = -2;
  for(int i=0; i<n; i++){
    now_num = a[i]-1;
    s += b[now_num];
    if(prev_num+1 == now_num) s += c[prev_num];
    prev_num = now_num;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>

using  ll = long long;
using ull = unsigned long long;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};
constexpr ll kINF = 1152921504606846976;//2^60
constexpr double kEPS = 1e-6;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define rep(i,n) REP(i,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep(i,n) RREP(i,n)
#define mp make_pair
#define fi first
#define sc second

ll N,A[100000];

ll gcd (ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main(void) {
  cin >> N;
  rep (i,N) cin >> A[i];
  
  ll ans = A[0];
  ll g   = A[0];

  rep (i,N) {
    if (i < 1) continue;
    ans = max(gcd(ans, A[i]), g);
    g = gcd(g, A[i]);
  }

  ll g2 = A[1];
  rep(i,N-1) g2 = gcd(g2, A[i+1]);

  ans = max(ans, g2);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
N = int(input())
array = [int(n) for n in input().split()]
import copy
import heapq
lst = [None for i in range(N + 1)]
left_lst = copy.deepcopy(lst)
right_lst = copy.deepcopy(lst)
left_array = array[:N]
right_array= [-n for n in array[-N:]]
l_sum = sum(left_array)
r_sum = sum(right_array)
heapq.heapify(left_array)
heapq.heapify(right_array)
left_lst[0] = l_sum
right_lst[0] = r_sum

for k in range(N, 2 * N):
    new_a, new_b = array[k], array[-k - 1]*-1
    heapq.heappush(left_array,new_a)
    heapq.heappush(right_array,new_b)
    old_a = heapq.heappop(left_array)
    l_sum += (new_a - old_a)
    left_lst[k - N + 1] = l_sum
    old_b = heapq.heappop(right_array)
    r_sum += (new_b - old_b)
    right_lst[k - N + 1] = r_sum
lst = [ a + b for a, b in zip(left_lst, list(reversed(right_lst)))]
print(max(lst))

Measured memory_bytes: 39012
from collections import *
from heapq import *
from itertools import *
#from fractions import gcd

from decimal import *
import copy
from bisect import *
import time
import sys
import math

input=lambda :sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))

N,K=map(int,input().split())
print(min(N%K,K-N%K))


Measured memory_bytes: 59500
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        long s = Long.parseLong(sc.next());
        
        long ub = (int)1e9;
        long lb = 0;
        for(int i=0; i<100; i++){
            long mid = (ub+lb)/2;
            if(s > mid*mid){
                lb = mid;
            }else{
                ub = mid;
            }
        }
        
        long diff = ub*ub-s;
        long p = diff/ub;
        long q = diff%ub;
        
        System.out.println("0 0 "+q+" "+(ub-p)+" "+ub+" "+1);
        
        //System.out.println("ub : "+ub);
        //System.out.println((ub-p)*ub-q);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define pb push_back
#define en "\n"
#define ITER(i,a) for( typeof(a.begin()) i=a.begin();i!=a.end();i++)
#define mod 1000000007
#define mpp make_pair
#define mes(a,b) memset((a),(b),sizeof((a))
typedef map<int,int> MI;
typedef pair<int,int>   PI;
typedef vector<int> VI;
typedef long long int LL;

int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    n=(2*n);
    int 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;i+=2)
    {
        ans=ans+a[i];
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin >> n >> k;
    int arr[n];
    for(int i=0;i<n; i++)
        cin >> arr[i];
    int dp[100000];
    for(int i=0; i<100000; i++)
        dp[i] = INT_MAX;
    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);
    for(int i=2; i<n ; i++)
    {
        for(int j=1; j<=k; j++)
        {
          	if(i-j >= 0)
            	dp[i] = min(dp[i], abs(arr[i] - arr[i-j]) + dp[i-j]);
        }
    }
    cout << dp[n-1] << endl;
}

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

char s[9][5], t[3][3][5];
int dx[]{ -1,0,1,0 }, dy[]{ 0,1,0,-1 };
int dfs(int p) {
	int res = 0;
	rep(i, 3)rep(j, 3) {
		if (t[i][j][0])continue;
		rep(k, 4) {
			rep(l, 4) {
				int nx = i + dx[l], ny = j + dy[l];
				if (nx < 0 || 3 <= nx || ny < 0 || 3 <= ny || !t[nx][ny][0])continue;
				if (abs(s[p][(l + k) % 4] - t[nx][ny][(l + 2) % 4]) != 'a' - 'A')goto g;
			}
			if (p == 8)res++;
			else {
				rep(l, 4)t[i][j][l] = s[p][(l + k) % 4];
				res += dfs(p + 1); t[i][j][0] = 0;
			}g:;
		}
	}
	return res;
}
int main() {
	int n; scanf("%d", &n);
	rep(i, n) {
		rep(j, 9)scanf("%s", s[j]);
		printf("%d\n", dfs(0));
	}
}

Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int n;
	cin>>n;
	char s[n];
	int ans=0;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
	}
	for(int i=0;i<=n-3;i++)
	{
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
		ans++;
	}
	cout<<ans<<endl;
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define sz size()
#define y1 dfsdsfsdfsd
#define next fdsfsdfjkl
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
double pi = acos(-1.0);
const int inf = 1e9+7;
const ll INF = 1e18+7;
/////////////////////////////////////////



int n,a,b;
int main(){speed;
    cin>>n>>a>>b;


    if(n==1)
    {
        cout<<"Hello World";

        return 0;
    }

    cout<<a+b;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
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();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#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 SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1e-8

int trans(int y, int m, int d){
	int ret = 0;
	ret+=(y-1)/3*590+(y-1)%3*195;
	if(y%3==0)ret += (m-1)*20+(d-1);
	else{
		ret += ((m-1)/2)*39+d-1;
		ret += (m&1)?0:20;
	}
	return ret;
}

int main(){
	int n,y,m,d,k;
	k=trans(1000,1,1);
	cin>>n;
	REP(i,n){
		cin>>y>>m>>d;
		cout << k - trans(y,m,d) << endl;
	}
	return 0;
}

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

vector<ll> ans;

void solve() {
    int n;
    cin >> n;
    ll res = 0;
    vector<ll> lefters[n], righters[n+1];
    rep(i, n) {
        ll k, l, r;
        cin >> k >> l >> r;
        k--;
        res += min(l, r);
        if (l > r) {
            lefters[k].push_back(l - r);
        } else {
            righters[k+1].push_back(r - l);
        }
    }
    priority_queue<ll, vector<ll>, greater<ll>> pql, pqr;
    rep(i, n) {
        for (ll val : lefters[i]) pql.push(val);
        while ((ll)pql.size() > i + 1) pql.pop();

        for (ll val : righters[n - i - 1]) pqr.push(val);
        while ((ll)pqr.size() > i + 1) pqr.pop();
    }
    while (!pql.empty()) {
        res += pql.top();
        pql.pop();
    }
    while (!pqr.empty()) {
        res += pqr.top();
        pqr.pop();
    }
    ans.push_back(res);
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    for(ll a : ans){
        cout << a << endl;
    }
}

Measured memory_bytes: 19668