akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}

		for(int j = 0; j < n; j++) {
			System.out.print(A[j]);
			if(j < n - 1) {
				System.out.print(" ");
			} else {
				System.out.println();
			}
		}
		
		for (int i = 1; i < n; i++) {
			int v = A[i];
			int k = i - 1;
			while(k >=0 && A[k] > v) {
				A[k + 1] = A[k];
				k--;
				A[k + 1] = v;
			}
			for(int j = 0; j < n; j++) {
				System.out.print(A[j]);
				if(j < n - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			}
		}
		sc.close();
	}

}



Measured memory_bytes: 33944
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n;i>s;i--)
#define rep_re(i,s,n)for(int i = n;i>=s;i--)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 999;// 1e25;
static const ll MAX_N = 100001;

ll dp[51][510][510];
ll A[41];
ll B[41];
ll C[41];
void chmin(long long &a, long long b) { if (a > b) a = b; }

int  main() {
	ll n, ma, mb; cin >> n >> ma >> mb;
	ll M = 510;
	//repe(i, 1, n) cin >> A[i] >> B[i] >> C[i];
	rep(i, 0, n) cin >> A[i] >> B[i] >> C[i];

	rep(i, 0, 51)rep(j, 0, M)rep(k, 0, M) dp[i][j][k] = INF;

	dp[0][0][0] = 0;

	rep(i, 0, n) {//
		repe(a, 0, 500) {
			repe(b, 0, 500)
			{
				if (dp[i][a][b] < INF) {
					// 使わない
					//chmin(dp[i + 1][a][b], dp[i][a][b]);
					dp[i + 1][a][b] = min(dp[i + 1][a][b], dp[i][a][b]);

					// 使う
					//chmin(dp[i + 1][a + A[i]][b + B[i]], dp[i][a][b] + C[i]);
					dp[i + 1][a + A[i]][b + B[i]] = min(dp[i + 1][a + A[i]][b + B[i]], dp[i][a][b] + C[i]);
				}
			}
		}
	}
	//repe(i, 1, n) {//
	//	repe(a, 0, M) {
	//		repe(b, 0, M)
	//		{
	//			if (dp[i - 1][a][b] != INF) {
	//				dp[i][a + A[i]][b + B[i]] = min(dp[i][a + A[i]][b + B[i]], dp[i - 1][a][b] + C[i]);
	//				dp[i][a][b] = dp[i - 1][a][b];
	//			}
	//		}
	//	}
	//}

	ll ans = INF;
	rep(aa, 1, 500) {
		rep(bb, 1, 500) {
			//if (dp[n][aa][bb] == INF) continue;
			if (aa * mb != bb * ma) continue;
			//chmin(ans, dp[n][aa][bb]);
			ans = min(ans, dp[n][aa][bb]);
		}
	}
	if (ans < INF) cout << ans << endl;
	else cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 103936
a = []
a_bool = [False for i in range(9)]
for j in range(3):[a.append(i) for i in list(map(int, input().split()))]
n = int(input())
for i in range(n):
    b = int(input())
    if b in a:
        a_bool[a.index(b)] = True
if (a_bool[0] and a_bool[1] and a_bool[2]) or (a_bool[3] and a_bool[4] and a_bool[5]) or (a_bool[6] and a_bool[7] and a_bool[8]) or (a_bool[0] and a_bool[3] and a_bool[6]) or (a_bool[1] and a_bool[4] and a_bool[7]) or (a_bool[2] and a_bool[5] and a_bool[8]) or (a_bool[0] and a_bool[4] and a_bool[8]) or (a_bool[2] and a_bool[4] and a_bool[6]):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3316
#include<iostream>
using namespace std;
int main(){
 
  int X;
  cin>>X;
  if(X==2){
    
    cout<<2;
    return 0;
  }
  else{
    if(X%2==0)X++;
  }
  bool flag=0;
  while(flag==0){

    flag=1;
    for(int i=3;i<=X/2+1;i+=2){
    
      if(X%i==0){

        flag=0;
        X+=2;
        break;
      }
    }
  }
  cout<<X;
  return 0;
}

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

#define QUERY_PUSH 0
#define QUERY_ACCESS 1
#define QUERY_POP 2

typedef struct Slice {
    int *list;
    int len;
    int size;
} * Slice;

void initSlice(Slice *);
void pushBack(Slice, int);
void randomAccess(Slice, int);
int popBack(Slice);
void freeSlice(Slice);

int main(void)
{
    Slice arr;
    initSlice(&arr);
    int n, query, val;

    scanf("%d", &n);
    while (n--) {
        scanf("%d", &query);
        if (query == QUERY_PUSH) {
            scanf("%d", &val);
            pushBack(arr, val);
        } else if (query == QUERY_ACCESS) {
            scanf("%d", &val);
            randomAccess(arr, val);
        } else if (query == QUERY_POP) {
            popBack(arr);
        }
    }
    freeSlice(arr);

    return 0;
}

void initSlice(Slice * s)
{
    *s = (Slice) malloc(sizeof(struct Slice));
    (*s)->len = 0;
    (*s)->size = 0;
    (*s)->list = NULL;
}

void pushBack(Slice s, int x)
{
    if (s->len == s->size) {
        if (s->size)
            s->size *= 2;
        else
            s->size = 2;
        int *tmp = (int *) malloc(s->size * sizeof(int));
        memcpy(tmp, s->list, sizeof(int) * s->len);
        s->list = tmp;
    }
    s->list[s->len++] = x;
}

void randomAccess(Slice s, int p)
{
    printf("%d\n", s->list[p]);
}

int popBack(Slice s)
{
    int x = s->list[--s->len];
    return x;
}

void freeSlice(Slice s)
{
    free(s->list);
    free(s);
}


Measured memory_bytes: 3332
<?php

function gcd($x, $y) {
    if ($y == 1) {
        return 1;
    }

    if ($x % $y == 0) {
        return $y;
    }

    return gcd($y, $x % $y);
}

function lcm($x, $y) {
    return (int) ($x * $y / gcd($x, $y));
}

fscanf(STDIN, "%d %d", $a, $b);

echo lcm(max($a, $b), min($a, $b));


Measured memory_bytes: 4604
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int main()
{
	int i, j, buf, c[5];
	
	while(scanf("%d,%d,%d,%d,%d",&c[0],&c[1],&c[2], &c[3],&c[4]) != EOF){

		for(j=0; j<4; j++){
			for(i=3; i>=j; i--){
				if(c[i] > c[i+1]){
					buf = c[i];
					c[i] = c[i+1];
					c[i+1] = buf;
				}
			}
		}

		if((c[0]==c[1] && c[1]==c[2] && c[2]==c[3]) || (c[1]==c[2] && c[2]==c[3] && c[3]==c[4]))
			printf("four card\n");
		else if((c[0]==c[1] && (c[2]==c[3] && c[3]==c[4])) || ((c[0]==c[1] && c[1]==c[2]) && (c[3]==c[4])))
			printf("full house\n");
		else if((c[1]-c[0]==1 && c[2]-c[1]==1 && c[3]-c[2]==1 && c[4]-c[3]==1) || (c[0]==1 && c[1]==10 && c[2]==11 && c[3]==12 && c[4]==13))
			printf("straight\n");
		else if((c[0]==c[1] && c[1]==c[2]) || (c[1]==c[2] && c[2]==c[3]) || (c[2]==c[3] && c[3]==c[4]))
			printf("three card\n");
		else if((c[0]==c[1] && c[2]==c[3]) || (c[0]==c[1] && c[3]==c[4]) || (c[1]==c[2] && c[3]==c[4]))
			printf("two pair\n");
		else if(c[0]==c[1] || c[1]==c[2] || c[2]==c[3] || c[3]==c[4])
			printf("one pair\n");
		else
			printf("null\n");

	}
	return 0;
}

Measured memory_bytes: 580
#include<cstdio>
int n,k,a[300005]; 
int main(){
	scanf("%d%d",&k,&n);
	if(~k&1){printf("%d ",k>>1);for(int i=1;i<n;i++)printf("%d ",k);return 0*puts("");}
	int cnt=n,lim=n>>1;
	for(int i=1;i<=n;i++)a[i]=k+1>>1;
	for(int i=1;i<=lim;i++)
		if(a[cnt]==1)cnt--;
		else{a[cnt++]--;for(;cnt<=n;cnt++)a[cnt]=k;cnt--;}
	for(int i=1;i<=cnt;i++)printf("%d ",a[i]);
    return 0*puts("");
}

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

int main()
{
    string s,t;
    cin >> s >> t;

    int ans = 0;
    if(s[0] == t[0]){
        ans ++;
    }
    if(s[1] == t[1]) {
        ans ++;
    }
    if(s[2] == t[2]){
        ans ++;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){

    ll sum = 0;
    int N; cin >> N;
    
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            for(int l=1;l<=N;l++){
                sum += gcd(gcd(i, j),l);
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3636
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int N = 2e5 + 5;
using pii = pair<int,int>;

int n;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n;
    vector<pii> a(n);
    
    for (int i = 0; i < n; i++){
        cin >> a[i].first;
        a[i].second = i;
    }
    
    
    sort(a.rbegin(), a.rend());
    
    for (int i = 0; i < n; i++){
        if(a[0].second == i){
            cout << a[1].first << "\n";
        }else{
            cout << a[0].first << "\n";
        }
    }
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int main(void)
{
  string s;
  cin >> s;

  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '+') {
      ans++;
    }
    else {
      ans--;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

constexpr lint mod = 998244353;
lint tmod(lint a, lint p) { return (a %= p) < 0 ? a + p : a; }
lint mod_pow(lint a, lint n, lint p) {
    if (n < 0) return 0;
    a = tmod(a, p);
    lint res = 1;
    while (n) {
        if (n & 1) (res *= a) %= p;
        (a *= a) %= p;
        n >>= 1;
    }
    return res;
}
lint fact[2000], ifact[2000];
void init() {
    fact[0] = ifact[0] = 1;
    for (int i = 1; i < 2000; ++i) {
        fact[i] = i * fact[i - 1] % mod;
        ifact[i] = mod_pow(fact[i], mod - 2, mod);
    }
}


int main() {
    init();
    lint n, S; cin >> n >> S;

    auto fn = [&](int x) -> lint {
        lint res = 0;
        for (int i = 0; i < x; ++i) {
            if (i & 1) res -= mod_pow(x - i, n - 1, mod);
            else res += mod_pow(x - i, n - 1, mod);
            res %= mod;
        }
        return tmod(res, mod);
    };

    lint res = S * (S + 1) / 2 % mod * mod_pow(S + 1, n - 2, mod);
    // cerr << "naive: " << tmod(res + fn(S), mod) << endl;

    // int m = n;
    for (int k = S & 1; k <= 2 * n + 1; k += 2) {
        lint curr = 1;
        for (int i = S & 1; i <= 2 * n + 1; i += 2) if (i != k) {
            (curr *= S - i) %= mod;
            (curr *= mod_pow(k - i, mod - 2, mod)) %= mod;
        }
        curr *= fn(k);
        // cerr << k << ' ' << tmod(curr, mod) << endl;
        res += curr;
        res %= mod;
    }

    // for (int i = 0; i < S; ++i) {
    //     if (i & 1) res -= mod_pow(S - i, n - 1, mod);
    //     else res += mod_pow(S - i, n - 1, mod);
    //     res %= mod;
    //     if (i % 10000000 == 0) cerr << i / 10000000 << endl;
    // }
    cout << tmod(res, mod) << endl;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n;
    cin >> n;
    if (n % 2 == 0)
        OP(n);
    else
        OP(2 * n);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <map>
#include <set>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

int main(){
    int a[3];
    REP(i,3) cin >> a[i];

    sort(a,a+3);
    int total=0;

    REP(i,2) total+=abs(a[i+1]-a[i]);

    cout << total << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int h,a,i,count;
  scanf("%d %d",&h,&a);
  count=0;
  while(1){
    h=h-a;
    count+=1;
    if(h<=0){
      break;
    }
  }
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 128
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var n, a, b, c int
	fmt.Fscan(r, &n, &a, &b, &c)
	v := make(map[byte]int)
	v['A'], v['B'], v['C'] = a, b, c
	s := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &s[i])
	}

	ans := make([]byte, 0, n)

	process := func(s string, i int) {
		v[s[i]]++
		v[s[i^1]]--
		ans = append(ans, s[i])
	}

	processAny := func(s string) {
		if v[s[0]] == 0 {
			process(s, 0)
		} else {
			process(s, 1)
		}
	}

	for i := 0; i < n; i++ {
		if v[s[i][0]] == 0 && v[s[i][1]] == 0 {
			fmt.Fprintln(w, "No")
			return
		}
		if v[s[i][0]] == 0 || v[s[i][1]] == 0 {
			processAny(s[i])
		} else if i == n-1 {
			processAny(s[i])
		} else if s[i] == s[i+1] {
			processAny(s[i])
		} else if v[s[i][0]] == 1 || v[s[i][1]] == 1 {
			if s[i][0] == s[i+1][0] || s[i][0] == s[i+1][1] {
				process(s[i], 0)
			} else {
				process(s[i], 1)
			}
		} else {
			processAny(s[i])
		}
	}

	fmt.Fprintln(w, "Yes")
	for i := 0; i < n; i++ {
		fmt.Fprintf(w, "%c\n", ans[i])
	}
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
int a[1000+10];
int main()
{
	double sum;
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=1.0/a[i];
	}
	sum=1.0/sum;
	printf("%.14f",sum);

	return 0;
}

Measured memory_bytes: 256
using System;

namespace Project
{
	class Dice
	{
		public int face;
		public int N;
		public int E;
		public int S;
		public int W;
		public int back;

		public Dice(int a1, int a2, int a3, int a4, int a5, int a6)
		{
			face = a1;
			N = a5;
			E = a3;
			S = a2;
			W = a4;
			back = a6;
		}
		public void roll(char D)
		{
			int pface = face;
			int pN = N;
			int pE = E;
			int pW = W;
			int pS = S;
			int pback = back;
			switch (D)
			{
				case 'N':
					face = pS;
					N = pface;
					S = pback;
					back = pN;
					break;
				case 'E':
					face = pW;
					E = pface;
					W = pback;
					back = pE;
					break;
				case 'W':
					face = pE;
					E = pback;
					W = pface;
					back = pW;
					break;
				case 'S':
					face = pN;
					N = pback;
					S = pface;
					back = pS;
					break;
			}
		}
	}

	class MainClass
	{
		public static void Main(string[] args)
		{
			string[] s = Console.ReadLine().Split(' ');
			int[] a = new int[6];
			for (int i = 0; i < 6; i++)
			{
				a[i] = int.Parse(s[i]);
			}
			Dice dice = new Dice(a[0], a[1], a[2], a[3], a[4], a[5]);

			int n = int.Parse(Console.ReadLine());
			for (int i = 0; i < n; i++)
			{
				string[] sar = Console.ReadLine().Split(' ');
				int face = int.Parse(sar[0]);
				int S = int.Parse(sar[1]);
				int count = 0;
				while (true)
				{
					dice.roll('N');
					if (face == dice.face && S == dice.S) break;
					dice.roll('N');
					if (face == dice.face && S == dice.S) break;
					dice.roll('N');
					if (face == dice.face && S == dice.S) break;
					dice.roll('N');
					if (face == dice.face && S == dice.S) break;
					if (count == 4)	dice.roll('N');
					dice.roll('W');
					count++;
					if (count == 100)
					{
						Console.WriteLine("???????????£??????");
						break;
					}
				}
				Console.WriteLine(dice.E);
			}

		}
	}
}

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

typedef long long ll;
typedef unsigned long long int llu;
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define mem(a, v) memset(a, v, sizeof(a))
#define PI acos(-1)
#define S(a) scanf("%d",&a)
#define SL(a) scanf("%lld",&a)
#define S2(a, b) scanf("%d%d",&a,&b)
#define nl printf("\n")
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define deb2(x, y) cout<<#x<<" : "<<x<<" | "<<#y<<" : "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" : "<<x<<" | "<<#y<<" : "<<y<<" | "<<#z<<" : "<<z<<endl;
#define debv(x) {cout<<#x<<" : "<<endl; for(int ii =0; ii < x.size(); ii++) cout<<x[ii]<<" "; cout<<endl; }
#define debarr(x, xs) {cout<<#x<<" : "<<endl; for(int ii =0; ii < xs; ii++) cout<<x[ii]<<" "; cout<<endl; }
//auto T=clock(); 
//cout<<double(clock()-T)/CLOCKS_PER_SEC<<'\n';
//cout << fixed << setprecision(10) << f(0, 0, 0) << "\n";
const ll mod = 1000000007LL;
const int lmt = 1000005;

int a[10];

int main(){
    int n;
    S(n);
    bool flag = false;
    mem(a, 0);
    for(int i = 0; i < n; i++) {
        int x;
        S(x);

        if(x < 400)
            a[0]++;
        else if((x >= 400) && (x < 800))
            a[1]++;
        else if((x >= 800) && (x < 1200))
            a[2]++;
        else if((x >= 1200) && (x < 1600))
            a[3]++;
        else if((x >= 1600) && (x < 2000))
            a[4]++;
        else if((x >= 2000) && (x < 2400))
            a[5]++;
        else if((x >= 2400) && (x < 2800))
            a[6]++;
        else if((x >= 2800) && (x < 3200))
            a[7]++;
        else
            a[8]++;
    }
    int min = 0, max = 0;
    for(int i = 0; i < 8; i++) {
        if(a[i] > 0) {
            min++;
            max++;
            flag = true;
        }
    }

    if(a[8] > 0) {
        max += a[8];
        if(!flag)
            min++;
    }

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

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define FORCLS(i,a,b) for(int i = (a); i <= (b); i++)
#define REPCLS(i,n) FORCLS(i,1,n)

using IntType = long long;
const IntType mod = 1000000007ll;
const IntType MAX_HEIGHT = 1000000005ll;
const int MAX_N = 100005;
int n;
IntType t[MAX_N];
IntType a[MAX_N];
IntType hs[MAX_N];

int main() {
	cin >> n;
	REPCLS(i, n) cin >> t[i];
	REPCLS(i, n) cin >> a[i];

	t[0] = 0;	t[n + 1] = MAX_HEIGHT;
	a[0] = MAX_HEIGHT;	a[n + 1] = 0;

	REPCLS(i, n) {
		bool chgT = t[i - 1] < t[i];
		bool chgA = a[i] > a[i + 1];
		if (chgT && chgA) {
			if (t[i] == a[i]) hs[i] = 1;
			else hs[i] = 0;
		}
		else if (chgT && !chgA) {
			if (t[i] <= a[i]) hs[i] = 1;
			else hs[i] = 0;
		}
		else if (!chgT && chgA) {
			if (a[i] <= t[i]) hs[i] = 1;
			else hs[i] = 0;
		}
		else {
			hs[i] = min(t[i], a[i]);
		}
	}

	IntType ans = 1;
	REPCLS(i, n) {
		ans = (ans * hs[i]) % mod;
	}

	cout << ans << endl;

	return 0;
}

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

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int n, k;
    cin >> n >> k;
    long long ans = 0;
    COMinit();
    for(int i = 1; i <= k; i++){
        cout << ( COM(n-k+1, i) * COM(k-1, i-1) + MOD ) % MOD << endl;
    }
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
/*
DPかな
a+b=a^b
1100+11=1111とか
1000+1=1001
繰り上がりはない、0と1だけでなるもの
0 0
1 0
0 1
0 2
2 0
00
11 00
110 1
101 10
2n-1個かな
11=3だったら
 0  0
 0  1
 0 10
 0 11
 1  0
 1 10
10  0
10  1
11  0
1+4+4=9

100
  0   0

  0   1
  1   0

  0  10
 10   0

 10   1
  1  10
  0  11
 11   0

  0 100
100   0

  0 101
  1 100
101 0
100 1

  0 110
 10 100
100  10
110 0

  0 111
  1 110
 10 101
 11 100
100  11
101  10
110   1
111   0

増加量
0 1 2 3 4 5 6 7
1 2 2 4 2 4 4 8
1の数だけ2乗分加算


0000=1
0001=3
A=2,B=1
0010=5
0011=9
0100=11
0101=15
0110=19
0111=27
1000=29
1001=33
1010=37
1011=45
1100=49
1101=57
1110=65
1111=81

1がきたら3倍、は正しそう
0がきたら？
0001= 3
0010= 3+ 2=5
0100= 5+ 6=11
1000=11+18=29

0001=3
0011=9
0111=27
1111=81

0001=3
0010=5
0101=15
1010=15+22=37
*/
int main(){
  string S; cin>>S;
  ll Ssz=S.size(),MOD=1e9+7,A=2,B=1;
  for(ll i=1; i<Ssz; i++){
    if(S[i]=='1'){
      (B*=3)%=MOD;
      (B+=A)%=MOD;
      (A*=2)%=MOD;
    }
    else (B*=3)%=MOD;
  }
  ll ans=A+B;
  ans%=MOD;
  if(ans<0) ans+=MOD;
  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <stdio.h>
int main()
{
  char S[4],T[4];
  scanf("%s",&S);
  scanf("%s",&T);
  int i,counter = 0;
  while (S[i])
  {
    if (S[i] == T[i])
    {
      counter++;
    }
    i++;
  }
  printf("%d",counter);
}

Measured memory_bytes: 128
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print64_t_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) print64_tf(a?"Yes\n":"No\n")
#define MOD 1e+7
#define inf 1e9
#define fi first
#define se second
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64_t n;
  cin >> n;
  vector<int64_t> a(n);
  rep(i,n) cin >> a[i];

  //2パターンの小さい方を出力しようとしています

  // + => - => + => ...
  //sum1はiまでの総和(正負を見る)
  //cost1はコスト
  int64_t sum1 = 0LL, cost1 = 0LL;
  rep(i,n) {
    sum1 += a[i];
    int64_t diff = abs(sum1) + 1LL;//+1か-1まで動かすための操作回数

    if(i % 2 == 0 && sum1 < 0LL) {sum1 += diff; cost1 += diff;}
    if(i % 2 == 1 && sum1 > 0LL) {sum1 -= diff; cost1 += diff;}
    if(sum1 == 0LL) {
      if(i % 2 == 0) {sum1++; cost1++;}
      if(i % 2 == 1) {sum1--; cost1++;}
    }
  }


  // - => + => - => ...
  //sum2はiまでの総和(正負を見る)
  //cost1はコスト
  int64_t sum2 = 0LL, cost2 = 0LL;
  rep(i,n) {
    sum2 += a[i];
    int64_t diff = abs(sum2) + 1LL;//+1か-1まで動かすための操作回数

    if(i % 2 == 0 && sum2 > 0LL) {sum2 -= diff; cost2 += diff;}
    if(i % 2 == 1 && sum2 < 0LL) {sum2 += diff; cost2 += diff;}

    if(sum2 == 0LL) {
      if(i % 2 == 0) {sum2--; cost2++;}
      if(i % 2 == 1) {sum2++; cost2++;}
    }
  }
  
  cout << min(cost1, cost2) << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int k,n,a[200010];
long long ans;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	for(int i=1;i<=n-k;i++)
	{
		ans+=a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    u32 N;
    cin >> N;
    Vec<u64> A(N);
    Vec<u64> B(N);
    for (u32 i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }
    sort(ALL(A));
    sort(ALL(B));
    if (N % 2 == 1) {
        f64 am = A[(N - 1) / 2];
        f64 bm = B[(N - 1) / 2];
        u64 ans = bm - am + 1;
        cout << ans << endl;
        return;
    }
    f64 am = (A[(N - 1) / 2] + A[(N - 1) / 2 + 1]) / 2.0;
    f64 bm = (B[(N - 1) / 2] + B[(N - 1) / 2 + 1]) / 2.0;
    u64 ans = ((bm - am) * 2 + 1);
    cout << ans << endl;
}


Measured memory_bytes: 6348
#include<cstdio>
#include<iostream>

using namespace std;

int main(){
    int d;
    cin >> d;
    if (d == 22) {
        puts("Christmas Eve Eve Eve");
    }else if (d == 23) {
        puts("Christmas Eve Eve");
    }else if (d == 24) {
        puts("Christmas Eve");
    }else if (d == 25) {
        puts("Christmas");
    }
    
    
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))
one = 0
four = 0
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

  
if one <= four or (two == 0 and four == one -1):
  print('Yes')

else:

  print('No')

Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

#define RED '0'
#define BLUE '1'

int main() {
    string S; cin >> S;
    ll count_red = 0;
    ll count_blue = 0;
    for (int i = 0; i < S.size(); ++i) {
        if (S[i] == RED) count_red++;
        else count_blue++;
    }
    cout << min(count_red, count_blue) * 2 << endl;
}

Measured memory_bytes: 3740
S=input()
Q=int(input())

X=[]
Y=[]
f=1
for _ in range(Q):
    A=list(input().split())
    if A[0]=="1":
        f*=-1
    if A[0]=="2":
        if A[1]=="1":
            if f==1:
                X.append(A[2])
            if f==-1:
                Y.append(A[2])
        if A[1]=="2":
            if f==-1:
                X.append(A[2])
            if f==1:
                Y.append(A[2])

x="".join(X)
x="".join(list(reversed(x)))
y="".join(Y)

a=[x,S,y]
b="".join(a)

if f==-1:
    b="".join(list(reversed(b)))

print(b)


Measured memory_bytes: 7652
#include <iostream>
using namespace std;
int main ()
{

    string s;
    cin>>s;
    for(int i=0; i<s.length(); i++)
    {
        if (s[i]==','){
            cout<<" ";
        }
        else{
            cout<<s[i];
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=3.14159265358979323846;
using namespace std;
vector<int> dy={1,0,-1,0};
vector<int> dx={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

double a,b,x;
bool f(double v,double d) {
    d=PI*d/180.0;
    if(tan(d)*a<=b) return v<=a*b-a*a*tan(d)/2;
    else return v<=(b*b)/(2*tan(d));
}

int main() {
    cin>>a>>b>>x;
    x/=a;
    
    double ng = 90, ok = 0;
    rep(i,1000) {
        double mid = (ng + ok) / 2;
        (f(x,mid) ? ok : ng) = mid;
    }
    cout<<fixed<<setprecision(10)<<ok<<endl;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;

#pragma GCC optimize("O3")
#ifdef LOCAL
#include "/Users/lbjlc/Desktop/coding/debug_utils.h"
#else
#define print(...) ;
#define printn(...) ;
#define fprint(...) ;
#define fprintn(...) ;
#endif

#define rep(i, a, b) for(auto i = (a); i < (b); i++)
#define rrep(i, a, b) for(auto i = (a); i > (b); i--)
#define all(v) (v).begin(), (v).end()
#define pb push_back
// #define mp make_pair
#define fi first
#define se second
#define maxi(x, y) x = max(x, y)
#define mini(x, y) x = min(x, y)
// long long fact(long long n) { if(!n) return 1; return n*fact(n-1); }
// #define endl '\n'
#define solve_testcase int T;cin>>T;for(int t=1;t<=T;t++){solve(t);}

// long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }

typedef unsigned long long ull;
typedef long long ll;
 
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;
typedef vector<long long> vll;
#define bd(type,op,val) bind(op<type>(), std::placeholders::_1, val)

const int MAXN = 1e6+10;

vll & xor_gauss(vll & a) {
    int cur = 0;
    int n=a.size();
    for(long long mask = 1LL << 62; mask && cur < n; mask >>= 1) {
        for(int i = cur; i < n; i++) {
            if(mask & a[i]) {
                swap(a[i], a[cur]);
                break;
            }
        }
        if(!(mask & a[cur]))
            continue;
        for(int i = 0; i < n; i++)
            if(i != cur && (mask & a[i]))
                a[i] ^= a[cur];
        cur++;
    }
    vll b;
    for(auto x:a) if(x) b.pb(x);
    a=b;
    return a;
}

int n;

void solve(int tt) {
    // cout<<"Case #"<<tt<<": ";
    cin>>n;
    vll a(n);
    rep(i,0,n)cin>>a[i];
    string s;
    cin>>s;
    vll cur;
    int ok=1;
    rrep(i,n-1,-1) {
        print(cur);
        if(s[i]=='0') {
            cur.pb(a[i]);
            xor_gauss(cur);
        }
        else {
            int n0=cur.size();
            cur.pb(a[i]);
            xor_gauss(cur);
            if(n0<cur.size()) ok=0;
        }
        print(cur);
    }
    print("");
    cout<<1-ok<<endl;
}


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

    // print(xor_gauss(vll({1})));
    // print(xor_gauss(vll({1,2})));
    // print(xor_gauss(vll({1,2,3})));
    // print(xor_gauss(vll({1,2,4,3})));


    return 0;
}




















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

int main(){
  int s;
  cin >> s;
  int h, m, l;
  h = s / 3600;
  s -= h * 3600;
  m = s / 60;
  s -= m * 60;
  cout << h << ":" << m << ":" << s << endl;
}



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

int main() {
  int a,b;
  cin>>a>>b;
  int M[b];
  
  int sum=0;
  
  rep(i,b){
  cin>>M[i];
  sum+= M[i];
  }
  if(sum<=a){
    cout<<a-sum<<endl;
  }
  else{
    cout<<-1<<endl;
  }
}


Measured memory_bytes: 3604
#include<stdio.h>

int main()
{
	int n[10],i,j,m;
	for(i=0;i<10;i++)
	{
		scanf("%d",&n[i]);
	}
	for(i=0;i<10;i++)
	{
		for(j=i+1;j<10;j++)
		{
			if(n[i]<n[j])
			{
				m=n[j];
				n[j]=n[i];
				n[i]=m;
			}
		}
	}
	for(i=0;i<3;i++)
	{
		printf("%d\n",n[i]);
	}
	return 0;         //by vince
}

Measured memory_bytes: 600
#include<stdio.h>

int main(void)
{
	int i,n,h1,h2,c=0;
	scanf("%d%d",&n,&h1);
	c+=h1;
	for(i=0;i<n-1;i++){
		scanf("%d",&h2);
		if(h2>h1)
			c+=h2-h1;
		h1=h2;
	}
	printf("%d",c);
	return 0;
}

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

int main() {
    int n; cin >> n;
    if (n%111 == 0) {
        cout << n << endl;
        return 0;
    }

    else {
        cout << (n/111+1) * 111 << endl;
        return 0;
    }
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next()); // 問題数
        int m = Integer.parseInt(sc.next()); // 提出回数
        // 正答HashSet(key:正答した問題番号)
        HashSet<Integer> ac = new HashSet<>(n);
        // 誤答HashMap(key:誤答した問題番号、value:誤答回数)
        HashMap<Integer, Integer> wa = new HashMap<>(n);
        // 正答数：'AC'を1回以上出した問題の数
        int ac_count = 0;
        // ペナルティ数：正答済みの各問題において、初めて'AC'を出すまでに出した'WA'の数の総和
        int wa_count = 0;
        StringBuilder sb = new StringBuilder();
        for (int i = 0, p = 0, num = 0; i < m; i++) {
            p = Integer.parseInt(sc.next()); // 提出した問題番号
            // String s = sc.next(); // 結果
            sb.setLength(0);
            sb.append(sc.next());
            // 正答済みの問題番号はスキップ
            if (ac.contains(p)) {
                continue;
            }
            // 結果がACの場合
            if (sb.toString().equals("AC")) {
                ac_count++; // 正答数を加算
                ac.add(p); // 問題番号を正答HashSetに格納
                continue;
            }
            // 上記以外はWAとして扱う
            // 誤答HashMapに格納済みの問題番号の場合、誤答数を加算
            if (wa.containsKey(p)) {
                num = wa.get(p);
                num++;
                wa.replace(p, num);
            } else {
                wa.put(p, 1); // 初誤答した場合、誤答HashMapへ登録
            }
        }
        // 正答した問題番号の誤答数のみペナルティ数として扱う
        for (Integer i : wa.keySet()) {
            if (ac.contains(i)) {
                wa_count += wa.get(i);
            }
        }
        System.out.println(String.format("%s %s", ac_count, wa_count));
        sc.close();
    }
}


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

int main() {


    int x, y;
    for(;;) {
        cin >> x >> y;
        if( x ==0 && y == 0) {
            break;
        }

        if(x>y) {
            int tmp;
            tmp = x;
            x = y;
            y = tmp;
        }

        cout << x << " " << y << endl;
    }
}




Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main(){

	char str[4];

	cin >> str;
	// int len = strlen(str);
	for(int i = 0; i < 3; i++){
      if(str[i] == 49){
      	printf("%c", 57);
      }
      else if(str[i] == 57){
      	printf("%c", 49);
      }
	}
  cout << endl;
}

Measured memory_bytes: 256
import numpy as np

N =int(input())

a = np.array([int(i) for i in input().split()])

a_min = min(a)
a_max =max(a)
ans = 0

for i in range(a_min,a_max+1):
    diff_a = a - i
    dummy = int(sum([i**2 for i in diff_a]))
    if i == a_min:
        ans = dummy
    elif i>a_min:
        if ans > dummy:
            ans = dummy

print(ans)
    


 

Measured memory_bytes: 12428
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using P = pair<long long, long long>;

int main() {
  long long N, K, L, R;
  long long a[40];
  vector<long long> b[30];
  vector<long long> c[30];
  cin >> N >> K >> L >> R;
  rep(i, N) {
    cin >> a[i];
  }

  long long key = (N+1) / 2;
  rep(bit, (1<<(key))) {
    long long cnt = 0;
    long long sum = 0;
    rep(i, key) {
      if((bit>>i) & 1) {
        cnt += 1;
        sum += a[i];
      }
    }
    b[cnt].push_back(sum);
  }

  long long key2 = N / 2;
  rep(bit, (1<<(key2))) {
    long long cnt = 0;
    long long sum = 0;
    rep(i, key2) {
      if((bit>>i) & 1) {
        cnt += 1;
        sum += a[i+key];
      }
    }
    c[cnt].push_back(sum);
  }

  rep(i, key2+1) {
    sort(c[i].begin(), c[i].end());
  }

  long long ans = 0;
  rep(i, key+1) {
    if(i > K) break;
    if(K-i > key2) continue;
    rep(j, b[i].size()) {
      long long temp;
      long long l = L - b[i][j];
      long long r = R - b[i][j];
      temp = upper_bound(c[K-i].begin(), c[K-i].end(), r) - lower_bound(c[K-i].begin(), c[K-i].end(), l);
      ans += temp;
      // if(i == K) cout << temp << endl;
    }
  }

  // rep(i, key+1) {
  //   rep(j, b[i].size()) {
  //     cout << b[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  // cout << endl;

  // rep(i, key2+1) {
  //   rep(j, c[i].size()) {
  //     cout << c[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  // cout << endl;

  // rep(i, b[0].size()) {
  //   cout << b[0][i] << endl;
  // }
  // rep(i, c[0].size()) {
  //   cout << c[0][i] << endl;
  // }

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


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

typedef long long ll;
typedef unsigned long long ull;
const int MOD=1000000007;

int main(){
    ll ans=0;
    ll N,K;
    cin >> N >> K;
    if(K%2==1){
        ll a;
        if(K==1) a=N;
        else a=N/K;
        ans=a*a*a;
    }else{
        ll a=N/K;
        ll b=N/(K/2);
        ans=a*a*a+(b-a)*(b-a)*(b-a);
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>

#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <limits>
#include <queue>
#include <unordered_map>
#include <list>
#include <set>
#include <numeric>
using namespace std;

using ll = long long;

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

int main()
{
	int N;
	int ac = 0;
	int tle = 0;
	int wa = 0;
	int re = 0;

	cin >> N;

	rep(i, N)
	{
		string s;
		cin >> s;
		if (s == "AC")
		{
			++ac;
		}
		else if (s == "TLE")
		{
			++tle;
		}
		else if (s == "WA")
		{
			++wa;
		}
		else
		{
			++re;
		}
	}

	cout << "AC x " << ac << endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)

int main() {
  ll n; cin >> n;
  map <ll, ll> score;
  rep(i, n) {
    ll a; cin >> a;
    if (score.count(a)) score.at(a)++;
    else score[a] = 1;
  }
  ll max1 = 0, max2 = 0;
  for (auto p : score) {
    if (p.second >= 4) {
      if (max1 < p.first) {
        max1 = p.first;
        max2 = p.first;
      }
    }
    if (p.second >= 2) {
      if (max1 < p.first) {
        max2 = max1;
        max1 = p.first;
      } else if (max2 < p.second) max2 = p.first;
    }
  }
  cout << max1 * max2 << endl;
}

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

if N == 0 or K == 1:
    N = 0
elif N == K:
    N = 0
elif N % K == 0:
    N = 0
else:
    N = N % K
    while N != 0:
        m = abs(N - K)
        if N < m:
            break
        else:
            N = m

print(N)

Measured memory_bytes: 9164
K=int(input())
X,Y=map(int,input().split())
P=[]
A,B=0,0
V,W=1,1
if X<0:
  V=-1
  X=-X
if Y<0:
  W=-1
  Y=-Y
Z=0
if X<Y:
  X,Y=Y,X
  Z=1
if K&1==0 and (X+Y)&1==1:
  print(-1)
  exit()
def f(x):
  if x>=2*K:
    return ((x-K)//K)+f((x%K)+K)
  if x==K:
    return 1
  elif x==0:
    return 0
  elif x&1:
    return 3
  else:
    return 2

def g(X):
  if Z:
    for i in range(len(X)):
      X[i]=X[i][::-1]
  for i in range(len(X)):
    X[i][0],X[i][1]=X[i][0]*V,X[i][1]*W
  for i in range(len(X)-1):
    if K!=abs(X[i+1][0]-X[i][0])+abs(X[i+1][1]-X[i][1]):
      return 0
  return X

print(f(X+Y))
while Y-B>=K:
  B+=K
  P.append([0,B])
while X-A+Y-B>=2*K:
  A+=K
  P.append([A,B])
C=X-A+Y-B
if C%K==0:
  if C==K:
    P.append([X,Y])
  P=g(P)
  for i in range(len(P)):
    print(*P[i])
  exit()
Q=0
if f(C)==3:
  if A+K<=X:
    A+=K
    Q=1
  else:
    B+=K
    Q=-1
  P.append([A,B])
  C=X-A+abs(Y-B)
if C%K==0:
  if C==K:
    P.append([X,Y])
  P=g(P)
  for i in range(len(P)):
    print(*P[i])
  exit()
P.append(((A-B-X+Y)//2)%K)
P[-1]=[A+(K-P[-1]),B+P[-1]]
P.append([X,Y])
if g(P):
  for i in range(len(P)):
    print(*P[i])
  exit()
P=[]
A,B=0,0
while Y-B>=K:
  B+=K
  P.append([0,B])
while X-A+Y-B>=2*K:
  A+=K
  P.append([A,B])
C=X-A+Y-B
if C%K==0:
  if C==K:
    P.append([X,Y])
  P=g(P)
  for i in range(len(P)):
    print(*P[i])
  exit()
if f(C)==3:
  if A+K<=X:
    if Q==1:
      A-=2*K
    A+=K
  else:
    if Q==-1:
      B-=2*K
    B+=K
    Q=-1
  P.append([A,B])
  C=X-A+abs(Y-B)
if C%K==0:
  if C==K:
    P.append([X,Y])
  P=g(P)
  for i in range(len(P)):
    print(*P[i])
  exit()
P.append(((A-B-X+Y)//2)%K)
P[-1]=[A+(K-P[-1]),B+P[-1]]
P.append([X,Y])
if g(P):
  for i in range(len(P)):
    print(*P[i])
  exit()

Measured memory_bytes: 99692
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range(H):
        s=""
        for j in range(W):
            if (i+j)%2==0:
                s+="#"
            else:
                s+="."
        print(s)
    print("")

Measured memory_bytes: 7644
#include <stdio.h>
int main()
{
	int x,a,b,c;
	int k;
		scanf("%d %d %d\n",&a,&b,&c);
	for(x=a;x<=b;x++){
		if(c%x==0) k++;
	}	
	printf("%d\n",k);
	return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

int		main(void)
{
	int card[3][3];
	vector<vector<bool>> check(3, vector<bool>(3));
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
			cin >> card[i][j];
	}
	int N;
	cin >> N;
	for (int k = 0; k < N; k++)
	{
		int num;
		cin >> num;
		for (int i = 0; i < 3; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				if (num == card[i][j])
					check[i][j] = true;
			}
		}
	}
	string ans = "No";
	for (int i = 0; i < 3; i++)
	{
		if (check[i][0] && check[i][1] && check[i][2])
			ans = "Yes";
		if (check[0][i] && check[1][i] && check[2][i])
			ans = "Yes";
	}
	if (check[0][0] && check[1][1] && check[2][2])
		ans = "Yes";
	if (check[2][0] && check[1][1] && check[0][2])
			ans = "Yes";
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define Rg register
#define RI register int
#define RC register char
#define ed puts("") 
#define Pair pair<int,int>
#define space putchar(' ')
using namespace std;

template <typename tp> inline void read(tp & x)
{	
    x=0;
    RI f=1;
    RC c=getchar();
    while(c<'0' || c>'9'){if(c=='-') f=-1;c=getchar();}
    while(c>='0' && c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();} 
 	x*=f;
} 	

template <typename Tp> inline void print(Tp x)
{		
    if(x<0) x=-x,putchar('-');
    if(x>9) print(x/10);
    putchar(x%10+'0');
}

int x,k;

int main()
{
	read(x),read(k);
	int temp=k-x+1;
	for(RI i=1;i<=2*x-1;++i)
	{
		print(temp),space;
		temp++;
	}
	
	return 0;
} 

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

void trace(int A[], int N)
{
	cout << A[0];
	for (int i = 1; i < N; i++)
	{
		cout << " " << A[i];
	}
	cout << endl;

	return;
}

void BubbleSort(int N, int A[]) {
	bool flag = 1;
	int v,count;
	count = 0;
	while (flag) {
		flag = 0;
		for (int j = N-1; 0<j; j--) {
			if (A[j] < A[j - 1]) {
				v = A[j];
				A[j] = A[j - 1];
				A[j - 1] = v;
				flag = 1;
				count++;
			}
		}
	}
	trace(A, N);
	cout << count << endl;
	}


int main() {
	int N;
	cin >> N;
	int A[100];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	BubbleSort(N, A);
	return 0;
}

Measured memory_bytes: 1160
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#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 <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
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 = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

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

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    long long K,A,B;cin >> K >> A >> B;
    if(A <= B && K > A){
        cout << -1 << endl;
        return 0;
    }
    if(A >= K){
        cout << 1 << endl;
        return 0;
    }
    long long times = A - B;
    K -= A;
    //K += B;
    if(K%times == 0) cout << (K/times)*2+1 << endl;
    else cout << (K/times)*2+3 << endl;

}


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

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

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

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

    int x = 0;
    rep(i,N.size()) {
        x += (int) N[i] - '0';
    }
    if (x%9==0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
 }
}


Measured memory_bytes: 3716
#include<iostream>
#include<iomanip>

using namespace std;

int main() {
	int N;
	cin >> N;
	int cnt = 0;
	for (int i = 1; i <= N; i++) {
		if (i % 2 == 1)cnt++;
	}
	cout << setprecision(10) << (double)cnt / (double)N << endl;
	return 0;
}

Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int t = Integer.parseInt(sc.next());

        int[] costAr = new int[n];
        int[] timeAr = new int[n];

        for (int i = 0; i < n; i++) {
            costAr[i] = Integer.parseInt(sc.next());
            timeAr[i] = Integer.parseInt(sc.next());
        }

        int num = 1001;
        for (int i = 0; i < n; i++) {
            if (costAr[i] < num && timeAr[i] <= t){
                num = costAr[i];
            }
        }
        if (num == 1001){
            System.out.println("TLE");
        }else{
            System.out.println(num);

        }
    }
}


Measured memory_bytes: 23892