akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> vec(N);
    rep(i,N){
        cin >> vec[i];
    }
    bool approval = true;
    rep(i,N){
        if (vec[i] % 2 == 0){
            if (vec[i] % 3 != 0 && vec[i] % 5 != 0){
                approval = false;
            }
        }
    }
    if (approval) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}


Measured memory_bytes: 384
#include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <ratio>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

#define REP(i, n) for(int i = 0; i < n; ++i)
#define REP1(i, n) for(int i = 1; i <= n; ++i)

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

const ull MOD = 1000'000'007;

int main(){
    ll H, A;
    cin >> H >> A;
    cout << (H + A - 1) / A << endl;
    
}



Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)
	n, _ := strconv.Atoi(stringLineScan())
	vw := make(map[int][][]int)
	for i := 0; i < n-1; i++ {
		u, _ := strconv.Atoi(stringLineScan())
		u--
		v, _ := strconv.Atoi(stringLineScan())
		v--
		w, _ := strconv.Atoi(stringLineScan())
		if _, ok := vw[u]; !ok {
			vw[u] = make([][]int, 0)
		}
		x := make([]int, 2)
		x[0], x[1] = v, w
		vw[u] = append(vw[u], x)
		if _, ok := vw[v]; !ok {
			vw[v] = make([][]int, 0)
		}
		y := make([]int, 2)
		y[0], y[1] = u, w
		vw[v] = append(vw[v], y)
	}
	searched := make([]bool, n)
	init := 0
	searched[init] = true
	ans := make([]int, n)
	_, ans = dfs(init, vw, searched, ans)
	for i := 0; i < n; i++ {
		fmt.Println(ans[i])
	}
}
func dfs(init int, vw map[int][][]int, searched []bool, ans []int) ([]bool, []int) {
	for _, x := range vw[init] {
		v, w := x[0], x[1]
		if !searched[v] {
			searched[v] = true
			if w%2 == 0 {
				ans[v] = ans[init]
			} else {
				ans[v] = 1 - ans[init]
			}
			searched, ans = dfs(v, vw, searched, ans)
		}
	}
	return searched, ans
}


Measured memory_bytes: 54144
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <cstdlib>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}

vector<ll> fact, factinv, inv;
ll mod = 1e9 + 7;
void prenCkModp(ll n) {
	fact.resize(n + 5);
	factinv.resize(n + 5);
	inv.resize(n + 5);
	fact.at(0) = fact.at(1) = 1;
	factinv.at(0) = factinv.at(1) = 1;
	inv.at(1) = 1;
	for (ll i = 2; i < n + 5; i++) {
		fact.at(i) = (fact.at(i - 1) * i) % mod;
		inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod;
		factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod;
	}

}
ll nCk(ll n, ll k) {
	if (n < k||k<0) {
		return 0;
	}
	else {
		return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod;
	}

	}
int modPow(long long a, long long n, long long p) {
	if (n == 0) return 1; // 0乗にも対応する場合
	if (n == 1) return a % p;
	if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
	long long t = modPow(a, n / 2, p);
	return (t * t) % p;
}


int main() {

	ll K,an=0;
	string S;
	cin >> K >> S;
	vector<ll> z5(K+1);
	vector<ll> z6(K+1);
	z5.at(0) = 1;
	z6.at(0) = 1;
	prenCkModp(S.size() + K + 2);
	rep(i, K) {
		z5.at(i + 1) = z5.at(i) * 25;
		z6.at(i + 1) = z6.at(i) * 26;
		z5.at(i + 1) %= mod;
		z6.at(i + 1) %= mod;
	}
	rep(i, K + 1) {
		an += ((z5.at(K - i) * z6.at(i)) % mod) * nCk(S.size() + K - i - 1, S.size() - 1) % mod;
		an %= mod;
	}
	
	cout << an << endl;
	
}


Measured memory_bytes: 66800
package main

import (
	"fmt"
)

func sumOfDegit(n int) int {
	var sum int
	for n > 0 {
		sum += n % 10
		n /= 10
	}
	return sum
}

func main() {
	var n, a, b, sum int
	fmt.Scan(&n, &a, &b)
	for i := 1; i < n+1; i++ {
		if v := sumOfDegit(i); a <= v && v <= b {
			sum += i
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 512
n,m = map(int,input().split())
def f(x):
  d = []
  for i in range(1, int(x**0.5)+1):
    if x % i == 0:
      d.append(i)
      if i != x // i:
        d.append(x//i)
  d.sort(reverse = True)
  return d
for i in f(m):
  if m // i >= n:
    print(i)
    quit()

Measured memory_bytes: 3060
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	int tmp;
	int n;
	cin>> n;
	if(n%2==1) ans = n*(n-1)/2 - (n-1)/2;
	else ans = n*(n-1)/2 - n/2;
	cout << ans << endl;
	int ng;
	if(n%2 == 1) ng = n;
	else ng = n+1;
	REP1(i, n){
		for(int j = i+1; j <=n; j++){
			if(i+j != ng) cout << i << " " << j << endl;
		}
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<string>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n != 0) {
		map<char, char>a;
		string s = "";
		for (int i = 0; i < n; i++) {
			char b, c;
			cin >> b >> c;
			a.insert(map<char, char>::value_type(b, c));
		}
		cin >> n;
		map<char, char>::iterator it;
		for (int i = 0; i < n; i++) {
			char b;
			cin >> b;
			it = a.find(b);
			if (it == a.end())
				s += b;
			else
				s += a[b];
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 3260
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(void){
    Cin(string, n);
    Cout(n[0] - '0' + n[1] - '0' + n[2] - '0');
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for( ll i = 0;i < (ll) n;++i)
vector<ll> dx = {-1,0,1,0};
vector<ll> dy = {0,1,0,-1};


int main(){
  string s;
  cin >> s;
  if( s == "ABC" ){
    cout << "ARC" << endl;
  }else{
    cout << "ABC" << endl;
  }
  return 0;
}


Measured memory_bytes: 3596
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
ll lcm(ll a,ll b)
{
  return (a*b)/__gcd(a,b);
}
int main()
{
  // int x = -1, y = 10000;
  // double z = 0.2;
  // string s2 = "beginner1010";
  // long long b = 1LL << 60;
    
  // // debug(x, y, z, s, b);
    
  // double aux = 1010.0;
  // string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n,p = -1;
  int s = 1000000000;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i <n; ++i)
  {
    cin >> v[i];
  }
  sort(all(v));
  for (int i = 1; i <= 100 ; ++i)
  {
    int t = 0;    
    for (int j = 0; j < n; ++j)
    {
      t += (i-v[j])*(i-v[j]);
    }
    s = min(s,t);
  }
  cout << s;
  return 0;
}


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

int main(){
  int n,y,i,j;
  cin >> n >> y;
  int a,b,c;
  a=b=c=-1;
  if(n*10000<y){
    a=b=c=-1;
  }else{
    a=0;
    b=0;
    c=0;
  }
  for(a=0;a<=n;++a){
    for(b=0;b<=n-a;++b){
      c=n-a-b;
      if(a*10000+b*5000+c*1000==y){
        printf("%d\t%d\t%d\n",a,b,c);
        return 0;
      }
    }
  }
  a=b=c=-1;


  printf("%d\t%d\t%d\n",a,b,c);
  return 0;
}


Measured memory_bytes: 256
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,a[100005]={},x,ans=0;
  cin >> n >> x;
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  if(a[0]>x) {
    ans+=a[0]-x;
    a[0]=x;
  }
  for(int i=0; i<n-1; i++) {
    if(a[i]+a[i+1]>x) {
      ans+=a[i]+a[i+1]-x;
      a[i+1]-=a[i]+a[i+1]-x;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
using namespace std;
class GCDandLCM{
    public:
        void solve(long a,long b){
            long big=a,small=b;
            if(a<b){ 
                big=b;
                small=a;
                int tmp=a;
                a=b;
                b=tmp;
            }
            while(big%small!=0){ 
                int tmp=big%small;
                big=small;
                small=tmp;
            }
            printf("%ld %ld\n",small,(a*b)/small);
        }
};
int main(){ 
    GCDandLCM inst;
    long a,b;
    while(cin>>a>>b){ 
        inst.solve(a,b);
    }
}

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

int INF = 1001001001;
vector<vector<int> > to(100005);
vector<int> check(100005, INF);
vector<int> check1(100005, INF);
vector<int> check2(100005, INF);


/*void kenkenpa(int v, int x, int k){
    if(x == 3){
        k++;
        if(check[v] <= k)return;
        check[v] = k;
    }
    for(int a : to[v]){
        int n = x+1;
        if(x == 3)n = 1;
        kenkenpa(a, n, k);
    }
    return;
}*/

int main() {
    int N, M; cin >> N >> M;
    rep(i, M){
        int u, v; cin >> u >> v;
        u--; v--;
        to[u].push_back(v);
    }

    int S, T; cin >> S >> T;
    S--; T--;
    
    queue<int> Q;
    for(int p : to[S]){
        Q.push(p);
    }

    check[S] = 0;
    int cnt = 1;
    while(!Q.empty()){
        queue<int> Q2;
        while(!Q.empty()){
            int x = Q.front(); Q.pop();
            if(check1[x] != INF)continue;
            check1[x] = cnt;
            for(int p : to[x]){
                Q2.push(p);
            }
        }
        queue<int> Q3;
        while(!Q2.empty()){
            int x = Q2.front(); Q2.pop();
            if(check2[x] != INF)continue;
            check2[x] = cnt;
            for(int p : to[x]){
                Q3.push(p);
            }
        }
        while(!Q3.empty()){
            int x = Q3.front(); Q3.pop();
            if(check[x] != INF)continue;
            check[x] = cnt;
            for(int p : to[x]){
                Q.push(p);
            }
        }
        cnt++;
    }

    if(check[T] == INF){
        cout << -1 << endl;
    } else {
        cout << check[T] << endl;
    }

    return 0;
}

Measured memory_bytes: 9836
#include <iostream>
#include <vector>
#include <string.h>
#include <cstdio>
using namespace std;
#define rep(i, n) for( int i = 0; i < n; i++ )
typedef vector<int> vec;

int main(){
    int n;
    cin >> n;
    vec fml(n);
    rep(i, n){
        cin >> fml[i];
    }
    long long int dp[101][21];
    memset( dp, 0, sizeof(dp) );
    dp[1][fml[0]] = 1;
    rep(i, n-1){
        rep(j, 21){
            if( dp[i][j] > 0 ){
                int plus = j + fml[i];
                int minus = j - fml[i];
                if( plus <= 20 ) dp[i+1][plus] += dp[i][j];
                if( minus >= 0 ) dp[i+1][minus] += dp[i][j];
            }
        }
    }
    cout << dp[n-1][fml[n-1]] << endl;
}

Measured memory_bytes: 1216
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, read().split())
if n * 2 < m:
    print(n + (m - n * 2) // 4)
else:
    print(m // 2)


Measured memory_bytes: 2940
class Solver(object):
    def __init__(self, N, happy):
        self.dp = [[99999999 for _ in range(3)] for _ in range(N)]
        self.N = N
        self.happy = happy

    def solve(self):
        happy_list = self.happy
        self.dp[0] = happy_list[0]
        for i in range(1, self.N):
            self.dp[i][0] = max(happy_list[i][0] + self.dp[i-1][1],
                                happy_list[i][0] + self.dp[i-1][2])
            self.dp[i][1] = max(happy_list[i][1] + self.dp[i-1][0],
                                happy_list[i][1] + self.dp[i-1][2])
            self.dp[i][2] = max(happy_list[i][2] + self.dp[i-1][0],
                                happy_list[i][2] + self.dp[i - 1][1])
        return max(self.dp[-1])


def main():
    N = int(input())
    happy = [[int(i) for i in input().split()] for _ in range(N)]
    solver = Solver(N, happy)
    print(solver.solve())


if __name__ == "__main__":
    main()

Measured memory_bytes: 76376
import numpy as np
N = int(input())
A = list(map(int, input().split()))

A_r = A[::-1]

cumsum_A = np.cumsum(A)
cumsum_A_r = np.cumsum(A_r)

x = [abs(a - a_r) for (a, a_r) in zip(cumsum_A[:-1], cumsum_A_r[-2::-1])]
print(min(x))

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    if(k<=x/d){
        cout << x-k*d << endl;
        return 0;
    }
    ll cnt = x/d;
    ll ans;
    if(cnt%2==k%2){
        cout << (x)%d << endl;
    }else{
        cout << d-(x)%d << endl;
    }
    
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    string s; cin >> s;
    int ans = 1;
    FOR(i,1,n) if (s[i] != s[i-1]) ans++;

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 512
n = int(input())
a = list(map(int,input().split()))
a.sort()
gcd = a[0]
def Euclid(n1,n2):
    if n1 % n2 == 0:
        return n2
    return Euclid(n2,n1%n2)
for i in range(1,n):
    gcd = Euclid(gcd,a[i])
print(gcd)


Measured memory_bytes: 15020
#include<iostream>
#include <string> 
using namespace std;
int max(int x, int y) {
	if (x > y)return x;
	return y;
}

int abs(int x) {
	if (x < 0) {
		return -x;
	}
	return x;
}
void m_sort(int a[], int tmp[], int left, int right);
void m_sort(int a[], int tmp[], int left, int right);
void sort(int a[], int total) {
	int tmp;
	for (int i = 0; i < total; i++) {
		for (int j = i + 1; j < total; j++) {
			if (a[i] < a[j]) {
				tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
	}

}

void mergeSort(int a[], int tmp[], int size)
{
	m_sort(a, tmp, 0, size - 1);
}
void merge(int a[], int tmp[], int left, int mid, int right)
{
	int i, left_end, num_elements, tmp_pos;

	left_end = mid - 1;
	tmp_pos = left;
	num_elements = right - left + 1; // 要素 

	while ((left <= left_end) && (mid <= right))
	{
		if (a[left] <= a[mid])
		{
			tmp[tmp_pos] = a[left];
			tmp_pos = tmp_pos + 1;
			left = left + 1;
		}
		else
		{
			tmp[tmp_pos] = a[mid];
			tmp_pos = tmp_pos + 1;
			mid = mid + 1;
		}
	}


	while (left <= left_end)
	{
		tmp[tmp_pos] = a[left];
		left = left + 1;
		tmp_pos = tmp_pos + 1;
	}

	while (mid <= right)
	{
		tmp[tmp_pos] = a[mid];
		mid = mid + 1;
		tmp_pos = tmp_pos + 1;
	}


	for (i = 0; i <= num_elements; i++)
	{
		a[right] = tmp[right];
		right = right - 1;
	}
}
void m_sort(int a[], int tmp[], int left, int right)
{
	int mid;

	if (right > left)
	{
		mid = (right + left) / 2;
		m_sort(a, tmp, left, mid);
		m_sort(a, tmp, mid + 1, right);

		merge(a, tmp, left, mid + 1, right);
	}
}

int N, a[100000],b[100000],num,ans;


int main(){
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	ans = 0;
	mergeSort(a,b,N);

	for (int i = 0; i < N; i++) {
		num = 1;

		if (a[i] - a[i - 1] != 0 || i == 0) {
			for (int j = 1; j < i+1; j++) {
				if (a[i] - a[i - j] <= 1) {
					num++;

				}
				else {
					break;
				}
			}
			for (int j = 1; j < N - i; j++) {
				if (a[i + j] - a[i] <= 1) {
					num++;

				}
				else {
					break;

				}
			}
			if (num > ans) {
				ans = num;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
/* Includes */
#include <stdio.h>

/* Defines */

/* Variables */
char input_s[100] = {};
char input_p[100] = {};
int num_s, num_p;
int tmp_num;
int count;
char tmp_moji[100] = {};

/* Prototypes */


/* Main */
int main()
{
    scanf("%s", &input_s);
    scanf("%s", &input_p);

    for (int i = 0; i < 1200; i++) {
        if (input_s[i] == '\0') {
            num_s = i;
            break;
        }
        else {
            /* NOP */
        }
    }

    for (int i = 0; i < 1200; i++) {
        if (input_p[i] == '\0') {
            num_p = i;
            break;
        }
        else {
            /* NOP */
        }
    }

    for (int i = 0; i < num_s; i++) {
        
        for (int j = 0; j < num_p; j++) {
            tmp_num = i + j;

            if (tmp_num >= num_s) {
                tmp_num -= num_s;
            }
            else {
                /* NOP */
            }
            tmp_moji[j] = input_s[tmp_num];
        }

        count = 0;

        for (int i = 0; i < num_p; i++) {
            if (input_p[i] == tmp_moji[i]) {
                count++;
            }
            else {
                break;
            }
        }

        if (count == num_p) {
            printf("Yes\n");
            return 0;
        }
        else {
            /* NOP */
        }
    }

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


Measured memory_bytes: 2148
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
static const int INF=1000000001;
struct edge{int to,cost;};
typedef pair<int,int> P;
vector<edge> G[100];
int d[100];
int N;
void dijkstra(int s){
  priority_queue<P,vector<P>,greater<P> > que;
  fill(d,d+N,INF);
  d[s]=0;
  que.push(P(0,s));
  while(!que.empty()){
    P p=que.top();que.pop();
    int v=p.second;
    if(d[v]<p.first)continue;
    for(int i=0;i<G[v].size();i++){
      edge e=G[v][i];
      if(d[e.to]>d[v]+e.cost){
        d[e.to]=d[v]+e.cost;
        que.push(P(d[e.to],e.to));
      }
    }
  }
}
int main(){
  int k;
  while(cin>>N>>k&&N&&k){
    for(int i=0;i<100;i++)G[i].clear();
    while(k--){
      int r,a,b,c;
      cin>>r;
      if(r==0){
        cin>>a>>b;a--;b--;
        dijkstra(a);
        if(d[b]>=INF)cout<<-1<<endl;
        else cout<<d[b]<<endl;
      }else{
        cin>>a>>b>>c;a--;b--;
        G[a].PB((edge){b,c});
        G[b].PB((edge){a,c});
      }
    }
  }
}

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

using namespace std;

#define ll long long

int main(){
   int n;
   cin>>n;
   int a[n],b[n],sum=0;
   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; i++){
       if(a[i]>b[i]){
           sum=sum+(a[i]-b[i]);
       }
//    cout<<sum<<endl;
   
   }


     cout<<sum<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pi pair<ll, ll>
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pd pair<double, double>
#define vp vector<pi>
#define f(i, n) for(int i = 0; i < n; i++)
#define fo(i, a, n) for(int i = a; i < n; i++)
#define mod (1000*1000*1000+7)
#define sz(x) int((x).size())
#define all(x) x.begin(),x.end()
#define DBG(v) cerr << #v << " = " << (v) << endl;
ll INF = (1ll<<30);

using namespace std;


int main(int argc, char* argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n; cin >> n;
    string s; cin >> s;
    int i = 0;
    ll ans = 0;
    while(i < n){
      int j = i;
      while(j < n && s[i] == s[j]) j++;
      i = j;
      ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<unordered_map>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl
#define wa()  cout<<"No"<<endl
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
#define SZ(x) x.size()
#define epp empty()
#define all(x) x.begin(),x.end()
typedef vector<int> VE;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;};
//
const int maxm=5e6+5;

signed main(){
    int n=re;
    int ans=0;
    ff(i,n){
        if(i%3&&i%5)ans+=i;
    }
    pr(ans);
    return 0;
}


Measured memory_bytes: 3596
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 1e-10;
const int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    int n,m, count = 0, c;
    cin >> n >> m >> c;
    int b[m];
    for(int i=0;i<m;++i) cin >> b[i];
    for(int i=0;i<n;++i) {
        int a, total = c;
        for(int i=0;i<m;++i) {
            cin >> a;
            total += a * b[i];
        }
        if(total > 0) ++count;
    }

    cout << count << "\n";
}


Measured memory_bytes: 256
N = int(input())
# N, K = int(input().split())
# a = int(input())
# S = input()
# A = [int(x) for x in input().split()]
# t = [0] * N
# x = [0] * N
# y = [0] * N
# for i in range(N):
#     t[i], x[i], y[i] = map(int, input().split())

print(2 * N * 3.1415)

Measured memory_bytes: 9156
""" AtCoder """

import sys
input = sys.stdin.readline

N = int(input())
W = [input() for _ in range(N)]

a = [W[0]]
check = 1

for i in range(N-1):
    if W[i+1] in a or W[i][-2] != W[i+1][0]:
        check = 0
        break
    a.append(W[i+1])

if check == 0:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3060
#include <stdio.h>

int main() {
  int N,M;
  scanf("%d %d",&N,&M);
  int A[M];
  for(int i=0;i<M;i++) {
    scanf("%d",&A[i]);
  }
  for(int i=0;i<M;i++) {
    N-=A[i];
  }
  if(N<0) {
    printf("%d",-1);
  }else {
    printf("%d",N);
  }
  return 0;
}


Measured memory_bytes: 1728
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long

struct hoge{
  int p;
  int y;
  int ind;
  bool operator<(const hoge &r)const{
    return p==r.p ? y<r.y : p<r.p;
  }
};

int main(){
  int N, M;
  cin>>N>>M;
  hoge H[M];
  pair<int, int> ans[M];
  REP(i, M){
    cin>>H[i].p>>H[i].y;
    H[i].ind = i;
  }
  sort(H, H+M);

  int work=1;
  ans[H[0].ind].first=H[0].p;
  ans[H[0].ind].second=1;
  REP(i, M-1){
    ans[H[i+1].ind].first=H[i+1].p;
    if(H[i+1].p == H[i].p) ++work;
    else work=1;
    ans[H[i+1].ind].second=work;
  }


  REP(i, M){
    printf("%06d%06d\n", ans[i].first, ans[i].second);
  }

  return 0;
}


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

void inp_str(int*);

int main(void) {

int input1[150];
inp_str(input1);

int input2[150];
inp_str(input2);

int N,X;

N=input1[0];
X=input1[1];

int i;

int temp=0;

//printf("N=%d\n",N);
//printf("X=%d\n",X);
//printf("%d\n",temp);



for(i=0;i<N;i=i+1){

temp=temp+input2[i];
//printf("%d\n",temp);

if(temp>X){
	break;
}

}





printf("%d\n",i+1);

    return 0;

}


void inp_str(int instr[]){
char *ptr;
int z,i,count;
char str[20000]={'\0'};
char *ln;

fgets(str, 20000, stdin); // 入力："123456\n"
ln = strchr(str, '\n'); /* 改行文字を検索 */
if (ln != NULL) { /* 改行が読み取られていたかどうか */
   *ln = '\0';    /* 改行文字を終端文字に置き換える */
}
else {            /* 入力ストリーム上に文字が残ってる場合 */
   while (1) {    /* 改行文字が読み取られるまで空読みする */
       z = getchar();
      if (z == '\n' || z == EOF) break;
   }
}
	count=0;
    ptr = strtok(str, " ");
    i = atoi(ptr);
    instr[count]=i;
    count=count+1;
    // 2回目以降
    while(ptr != NULL) {
        // strtok関数により変更されたNULLのポインタが先頭
        ptr = strtok(NULL, " ");
        // ptrがNULLの場合エラーが発生するので対処
        if(ptr != NULL) {
		    i = atoi(ptr);
    instr[count]=i;
    		count=count+1;
        }
    }
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    string s;
    cin >> s;
    int ans = 0;
    rep(i, s.size() / 2) {
        if (s[i] != s[s.size() - i - 1]) ans++;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

void solve()
{
    ll n,x,t;
    cin>>n>>x>>t;
    ll r=(n+x-1)/x;
    cout<<r*t<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3640
using System;

namespace AtCoder
{
    class Program
    {
        static IO io = new IO();

        static void Main(string[] args)
        {
            //入力
            io.Read();
            int n = io.Int();
            io.ReadSplit();
            int[] a = io.Int(n);

            //計算
            long operations1 = EnumeratOperation(a, 1);
            long operations2 = EnumeratOperation(a, -1);

            //出力
            io.WriteLine(Math.Min(operations1, operations2).ToString());
        }
        static long EnumeratOperation(int[] a, int sign)
        {
            long sum = 0;
            long operations = 0;
            for (int i = 0; i < a.Length; ++i)
            {
                sum += a[i];
                if (sum == 0)
                {
                    operations += 1;
                    sum -= sign;
                }
                else if (sum * sign > 0)
                {
                    long newoperation = -sum - sign;
                    operations += Math.Abs(newoperation);
                    sum += (newoperation);
                }
                sign *= -1;
            }
            return operations;
        }
    }
    class IO
    {
        private string[] _Inputs;
        private int _Index;
        public void Read()
        {
            _Inputs = new string[1];
            _Inputs[0] = Console.ReadLine();
            _Index = 0;
        }
        public void ReadSplit()
        {
            _Inputs = Console.ReadLine().Split(' ');
            _Index = 0;
        }
        public string String()
        {
            return _Inputs[_Index++];
        }
        public string[] String(int xCount)
        {
            string[] rv = new string[xCount];
            Array.Copy(_Inputs, _Index, rv, 0, xCount);
            _Index += xCount;
            return rv;
        }
        public int Int()
        {
            return int.Parse(_Inputs[_Index++]);
        }
        public int[] Int(int xCount)
        {
            int[] rv = new int[xCount];
            for (int i = 0; i < xCount; ++i)
            {
                rv[i] = int.Parse(_Inputs[_Index++]);
            }
            return rv;
        }
        public long Long()
        {
            return long.Parse(_Inputs[_Index++]);
        }
        public long[] Long(int xCount)
        {
            long[] rv = new long[xCount];
            for (int i = 0; i < xCount; ++i)
            {
                rv[i] = long.Parse(_Inputs[_Index++]);
            }
            return rv;
        }
        public void Write(string xStr)
        {
            Console.Write(xStr);
        }
        public void WriteLine(string xStr)
        {
            Console.WriteLine(xStr);
        }
    }
}

Measured memory_bytes: 26716
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n, m;
    cin >> n >> m;
    ll a[n];
    rep(i,n)cin >> a[i];

    map<ll,ll> mp;

    ll sum = 0;
    ll ans = 0;
    rep(i,n){
        sum += a[i];
        sum %= m;
        mp[sum]++;
        if(sum == 0)ans++;
    }

    // mp[3] = 5;

    for(auto p : mp){
        if(p.second >= 2){
            ans += p.second * (p.second - 1) / 2;
        }
    }

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




Measured memory_bytes: 8264
// default
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false;}

const long long INF = 1LL << 60;

int N;
long long a[100010][3]; // a[i]b[i]c[i]をまとめる。
long long dp[10010][3];

void input(void){
    cin >> N;
    for(int i=0; i<N;i++){
        for(int j=0; j<3; j++){
            cin >> a[i][j];
        }
    }
    return;
}

void init(void){
    // nothing to do
    return;
}

void solve(){
    for(int i=0; i<N; i++){
        for(int j=0; j<3; j++){
            for(int k=0; k<3; k++){
                if(j == k){
                    continue;   // 同じものは二度連続で選べない
                }
                chmax(dp[i+1][k],dp[i][j]+ a[i][k]);
            }
        }
    }
    long long res =0;
    for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
    cout << res << endl;
    return;
}

int main(void){
    input();
    init();
    solve();
    return 0;
}

Measured memory_bytes: 2816
#include<stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r){
	 int x, i, j,t;
	 x = A[r];
	 i = p - 1;
	 for(j=p; j<r; j++){
	 	if(A[j] <= x){
	 		i++;
	 		t = A[i];
	 		A[i] = A[j]; 
	 		A[j] = t;
	 	}
	 }
	 t = A[i + 1]; 
	 A[i + 1] = A[r];
	 A[r]= t;
	 return i + 1;
}

int main(){
	int i, q;
	
	scanf("%d", &n);
	for(i=0; i<n; i++) scanf("%d", &A[i]);
	
	q = partition(0, n-1);
	
	for(i=0; i<n; i++){
		if( i )printf(" ");
		if(i==q)printf("[");
		printf("%d",A[i]);
		if(i==q)printf("]");
	}
	printf("\n");
	
	return 0;
}


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

int main(void){
    int n;
    cin >> n;
    
    int i;
    for(i = 111; i < 1000; i += 111){
        if(i >= n){
            cout << i << endl;
            return 0;
        }
    }
    
    return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v[n];
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].push_back(b);
    }

    for (auto first : v[0]) {
        for (auto second : v[first]) {
            if (second == n - 1) {
                cout << "POSSIBLE" << endl;
                return 0;
            }
        }
    }

    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 11816
#include<bits/stdc++.h>
#define ll long int
using namespace std;
int main()
{
    ll w,n,ans=0,value=0; cin>>n>>w;
    ll a[n],b[n];
    for(ll i=0;i<n;i++)   {cin>>a[i]>>b[i]; value+=b[i];}
    ll dp[value+1]; //dp[j] denotes the least weight to get a value of j
    for(int i=1;i<=value;i++) dp[i]=INT_MAX;
    //memset(dp,0,sizeof(dp));
    dp[0]=0;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=value;j>=0;j--)
        {
            if(b[i-1]<=j) 
             dp[j]=min(a[i-1]+dp[j-b[i-1]],dp[j]);
             
             
             if(dp[j]<=w)
               ans=max(ans,j);
        }
    }
    cout<<ans;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<stdio.h>
#include<string>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define sz(x) int(x.size())
#define INF 1e5

int main(){
	int n;
	cin>>n;
	vi d(n);
	rep(i,n) cin>>d[i];
	sort(All(d));
	cout<<d[n/2]-d[n/2-1]<<endl;
	}


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

int main(){
    int H, W;
    while(1){
        cin >> H >> W;
        if ( H == 0 && W == 0 )break;
        for (int i = 0; i < W; i++)cout << "#";
        cout << endl;
        
        for (int j = 0; j < H - 2; j++){
            cout << "#";
            for (int k = 0; k < W - 2; k++ )cout <<".";
            cout << "#" << endl;
        }
        
        for (int m = 0; m < W; m++ )cout << "#";
        cout << "\n";
        cout << endl;
    }
    return 0;
}


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

int main()
{
    int x,y,k;
    cin>>x>>y;
    k=y-x+1;

    for(int i=1;i<=(2*x)-2;i++)
    {
        cout<<k<<' ';
        k++;
    }
    cout<<k<<endl;





    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int n, d[maxn];

int main(){
    cin >> n;
    for(int i = 1 ;i<= n;i++)
        cin >> d[i];
    int sum = 0;
    for(int i = 1 ;i < n; i++)
    for(int  j= i + 1 ;j <= n ;j++){
        sum += d[i] * d[j];
    }
    cout << sum << endl;
}
/*
    Good Luck
        -Lucina
*/


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

int main()
{
  int n, q;
  cin >> n >> q;
  vector<vector<int>> graph(n);
  for (int i = 0; i < (n - 1); i++) {
    int a, b;
    cin >> a >> b;
    graph.at(a - 1).push_back(b - 1);
  }

  vector<int> scores(n);
  for (int i = 0; i < q; i++) {
    int p, x;
    cin >> p >> x;
    scores.at(p - 1) += x;
  }

  vector<int> answers(n);
  for (int i = 0; i < n; i++) {
    int score = scores.at(i);
    answers.at(i) += score;
    vector<int> children = graph.at(i);
    for (int j = 0; j < children.size(); j++) {
      scores.at(children.at(j)) += score;
    }
  }

  for (int i = 0; i < n; i++) {
    cout << answers.at(i) << " ";
  }
  cout << endl;
}


Measured memory_bytes: 14848
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template< typename T > using matrix = vector< vector< T > >;

//FUNCTION  


void solve(void)
{
  int N;
  cin>>N;
  map<int,int> mp;
  for (int i = 0; i < N; i++)
  {
    int A;
    cin>>A;
    mp[A]++;
  }
  int H = 0,W = 0;
  int COUNT = 0;
  vector<int> vec;
  for (int i = 0; i < mp.size(); i++)
  {
    static auto itr = mp.begin();
    if(itr->second > 1)
    for (int i = 0; i < itr->second/2; i++)
    {
      vec.push_back(itr->first);
    }
     
    
    itr++;
  }
  sort(ALL(vec),greater<int>());
  if(vec.size()<2)
  {
    cout<<0<<endl;
    return;
  }
  cout<<vec[0]*vec[1]<<endl;
  
  
  
  return;
}


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

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 6528
#include <algorithm>
#include <cstring>
#include <iostream>

const int MAX_RESULT = 7368791;

int main()
{
	bool* cache = new bool[MAX_RESULT + 1];

	auto fill_factors = [&](int x) {
		int i = x;
		while (i <= MAX_RESULT) {
			cache[i] = true;
			i += x;
		}
	};

	while (true) {
		int min_jumyo, kukaku;
		std::cin >> min_jumyo >> kukaku;

		if (min_jumyo == 0) return 0;

		std::memset(cache, 0, sizeof(bool) * (MAX_RESULT + 1));

		for (int year = min_jumyo; ; year++) {
			if (!cache[year]) {
				if (kukaku > 0) {
					fill_factors(year);
					kukaku--;
				}
				else {
					std::cout << year << std::endl;
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 10264
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    rep(i,n)std::cin >> a[i];
    std::vector<bool> b(n,1);
    sort(all(a),greater<int>());
    std::vector<int> ans;
    rep(i,n-1){
        if(a[i]==a[i+1]&&b[i]){
            ans.pb(a[i]);
            b[i+1]=0;
        }
    }
    if(ans.size()>1)std::cout << ll(ans[0])*ans[1] << std::endl;
    else std::cout << 0 << std::endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
void io(){ ios_base::sync_with_stdio(false);cin.tie(NULL);  cout.tie(NULL);}
int main()
{
    //io();
    ll tt;
    tt=1;
    cout<<fixed;
    while(tt--)
    {
        ll n,m;
        cin>>n>>m;
        while(m--)
        {
            ll x;
            cin>>x;n-=x;
        }
        cout<<max((ll)-1,n);
    }
}


Measured memory_bytes: 3624
// Aizu Vol-1 0186: Aizu Chicken
// 2017.8.27 bal4u@uu

#include <stdio.h>


int main()
{
	long long q1, b, c1, c2, q2;
	long long x, y;

	while (scanf("%lld", &q1) && q1) {
		scanf("%lld%lld%lld%lld", &b, &c1, &c2, &q2);
//		if (c1 < c2) c2 = c1;
		if (b < q1*c2) { puts("NA"); continue; }
		x = q2, y = 1 + (b - c1*x)/c2;
		if (y * c2 + x * c1 <= b) y++;
		while (y * c2 + x * c1 > b) y--;

		while (y < 0 || x + y < q1 || c1*x + c2*y > b) {
			if (--x <= 0) break;
			y = 1 + (b - c1*x)/c2;
			if (y * c2 + x * c1 <= b) y++;
			while (y * c2 + x * c1 > b) y--;
		}
		if(x < 0) x = 1, y = (b-c1)/c2;
		while (y * c2 + x * c1 <= b) y++;
		if (y * c2 + x * c1 > b) y--;
		if (x <= 0 || x + y < q1) puts("NA");
		else printf("%lld %lld\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 608
A,B,C,X,Y = [int(x) for x in input().split()]
mi = min(X,Y)
ans = 0
if mi*C*2<A*mi+B*mi:
  X = X-mi
  Y = Y-mi
  ans = mi*C*2
else:
  print(A*X+B*Y)
  exit()
if X>0:
  if X*C*2<X*A:
    ans += X*C*2
    print(ans)
    exit()
  else:
    ans += X*A
    print(ans)
    exit()
if Y>0:
  if Y*C*2<Y*B:
    ans += Y*C*2
    print(ans)
    exit()
  else:
    ans += Y*B
    print(ans)
    exit()
print(ans)

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

int main(){
  long long r,d,x,xn;cin>>r>>d>>x;
  REP(i,10){
    xn=r*x-d;
    cout<<xn<<endl;
    x=xn;
  }
}

Measured memory_bytes: 256