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

int main(int argc, const char * argv[])
{

    int mon[13] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
    int inptm, inptd;
    int days = 0;
    int week;
    int i;
    
    while (1) {
        scanf("%d %d", &inptm, &inptd);
        if (inptm == 0) {
            break;
        }
        for (i = 1; i < inptm; i++) {
            days += mon[i];
        }
        days += inptd;
        week = days % 7;
        switch (week) {
            case 0:
                printf("Wednesday\n");
                break;
            case 1:
                printf("Thursday\n");
                break;
            case 2:
                printf("Friday\n");
                break;
            case 3:
                printf("Saturday\n");
                break;
            case 4:
                printf("Sunday\n");
                break;
            case 5:
                printf("Monday\n");
                break;
            case 6:
                printf("Tuesday\n");
                break;
        }
        days = 0;
    }

    return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const int maxn = 63, mod = 1e9 + 9;
using oset = tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, k, s;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> k >> s;
	if(n==k) {
		for(int i = 0; i <n ; i++)
			cout << s << " ";
		return 0;
	}
	if(s==1000000000) {
		for(int i = 0; i <n ; i++)
			cout << (i<k?s:1) << " ";
		return 0;
	}
	for(int i = 0; i < n; i++) {
		if(i < k) {
			cout << s << " ";
		} else
			cout << 1000000000 << " ";
	}
}


Measured memory_bytes: 1280
#include<iostream>
#include<cstdlib>

using namespace std;

int main(void) {
  long long int N,K;
  long long int sum = 0;
  cin>>N>>K;

  if(K == 0) {
    cout<<N*N<<endl;

    return 0;
  } else {
    for(int b = K+1;b <= N;b++) {
      sum += (b - K)*(N / b);
      if(N%b >= K)
      sum += (N%b) - K + 1;
    }
  }

  cout<<sum<<endl;

  return 0;
}


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

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

void bubbleSort(int A[],int N){
	int flag = 1;
	int i=0;
	int count=0;
	
	while(flag){
		flag=0;
		for(int j=N-1;j>i;j--){
			if(A[j]<A[j-1]){
				swap(A[j],A[j-1]);
				count++;
				flag=1;
			}
		}
		i++;
	}
	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(A,N);
	
}

Measured memory_bytes: 1164
/*
 * Author : Sadi
 * Wed 01/07/2020
 * 18:23:09.20
 */
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n;
    cin >> n;
    set<string> s;
    vector<string> v;
    for(int i = 0; i < n; ++i) {
        string str;
        cin >> str;
        v.push_back(str);
    }
    s.insert(v[0]);
    for(int i = 1; i < n; ++i) {
        if(s.find(v[i]) == s.end() && v[i - 1].back() == v[i].front()) {
            s.insert(v[i]);
        }
        else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int>>;
using VVL = vector<vector<ll>>;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, s, n, d) for (int i = (s); i < (int)(n); i += (d))
#define allpt(v) (v).begin(), (v).end()
#define allpt_c(v) (v).cbegin(), (v).cend()
#define allpt_r(v) (v).rbegin(), (v).rend()

const int mod = 1e9 + 7;

const string wsp = " ";
const string tb = "\t";
const string rt = "\n";

template <typename T>
void show1dvec(const vector<T> &v)
{
    if (v.size() == 0)
        return;
    int n = v.size() - 1;
    rep(i, n) cout << v[i] << wsp;
    cout << v[n] << rt;
    return;
}

template <typename T>
void show2dvec(const vector<vector<T>> &v)
{
    int n = v.size();
    rep(i, n) show1dvec(v[i]);
}

template <typename T, typename S>
void show1dpair(const vector<pair<T, S>> &v)
{
    int n = v.size();
    rep(i, n) cout << v[i].first << wsp << v[i].second << rt;
    return;
}

template <typename T, typename S>
void pairzip(const vector<pair<T, S>> &v, vector<T> &t, vector<T> &s)
{
    int n = v.size();
    rep(i, n)
    {
        t.push_back(v[i].first);
        s.push_back(v[i].second);
    }
    return;
}

template <typename T>
void maxvec(vector<T> &v)
{
    T s = v[0];
    int n = v.size();
    rep(i, n - 1)
    {
        if (s > v[i + 1])
        {
            v[i + 1] = s;
        }
        s = v[i + 1];
    }
}

template <typename T, typename S>
bool myfind(T t, S s)
{
    return find(t.cbegin(), t.cend(), s) != t.cend();
}

bool check(int y, int x, int h, int w)
{
    return 0 <= y && y < h && 0 <= x && x < w;
}

VI cumsum(VI &v)
{
    int s = 0;
    VI ret = {0};

    rep(i, v.size())
    {
        s += v[i];
        ret.push_back(s);
    }
    return ret;
}

void shuffle(VI &v, int t)
{
    int temp = v[t - 1];
    rep(i, t - 1) v[t - 1 - i] = v[t - 2 - i];
    v[0] = temp;
}



int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif
    // string s;
    // cin >> s;
    // string ans = "No";
    // if (s[2] == s[3] && s[4] == s[5]) ans = "Yes";
    // cout << ans << rt;

    // ll x, ans = 0;
    // cin >> x;
    // ans += x / 500 * 1000;
    // x %= 500;
    // ans += x / 5 * 5;
    // cout << ans << rt;
    ll k, n;
    cin >> k >> n;
    VL x(n), dist(n);
    rep(i, n) cin >> x[i];
    rep(i, n - 1) dist[i] = x[i + 1] - x[i];
    dist[n - 1] = x[0] - x[n - 1] + k;
    cout << k - *max_element(allpt_c(dist)) << rt;


    return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main
{
    public static void main(String argv[])
    {
	Scanner scan = new Scanner(System.in);

	int W = scan.nextInt();
	int H = scan.nextInt();
	int x = scan.nextInt();
	int y = scan.nextInt();
	int r = scan.nextInt();
	
	if( x-r < 0 || x+r > W )
	    System.out.println("No");
	else if( y-r < 0 || y+r > H )
	System.out.println("No");
	else
	    System.out.println("Yes");
    }
}

Measured memory_bytes: 26408
#include<iostream>
#include<cassert>
using namespace std;
#define N 8
#define Free -1
#define Notfree 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
bool x[N][N];

void initialize(){
  for(int i=0;i<N;i++){
    row[i]=Free,col[i]=Free;
  }
  for(int i=0;i<2*N-1;i++){
    dpos[i]=Free;
    dneg[i]=Free;
  }

}
void printB(){
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(x[i][j]){
	if(row[i]!=j)return;
      }
    }
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      cout<<((row[i]==j)?"Q":".");
    }
    cout<<endl;
  }
}

void recursive(int i){
  if(i==N){
    printB();
    return;
  }
  for(int j=0;j<N;j++){
    if(Notfree==col[j] || Notfree==dpos[i+j] || Notfree==dneg[i-j+N-1])continue;

    row[i]=j;
    col[j]=dpos[i+j]=dneg[i-j+N-1]=Notfree;
    recursive(i+1);

    row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=Free;
  }

}

int main(){
  initialize();
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++)x[i][j]=false;

  int k;
  cin>>k;
  for(int i=0;i<N;i++){
    int r,c;
    cin>>r>>c;
    x[r][c]=true;
  }
  recursive(0);

  return 0;
}



Measured memory_bytes: 3116
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n

let f a b =
  if a = 0 then 0
  else begin
    let res = ref 0 in
    let rec g n =  if n < 10 then n else g (n / 10) in
    for i = 1 to n do
      if g i = a && i mod 10 = b then res := !res + 1
    done;
    !res
  end

let () =
  let ans = ref 0 in
  for i = 0 to 9 do
    for j = 0 to 9 do
      ans := !ans + f i j * f j i
    done
  done;
  Printf.printf "%d\n" !ans

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
using namespace std;

int MOD = 1e9 + 7;

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

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

	int i = s.size() - 1;
	while (i > 0) {
		if (s[i] == 'r' && s[i - 1] == 'e' && s[i - 2] == 'm' && s[i - 3] == 'a' && s[i - 4] == 'e' && s[i - 5] == 'r' && s[i - 6] == 'd') i -= 7;
		else if (s[i] == 'm' && s[i - 1] == 'a' && s[i - 2] == 'e' && s[i - 3] == 'r' && s[i - 4] == 'd') i -= 5;
		else if (s[i] == 'r' && s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e') i -= 6;
		else if (s[i] == 'e' && s[i - 1] == 's' && s[i - 2] == 'a' && s[i - 3] == 'r' && s[i - 4] == 'e') i -= 5;
		else {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 512
program main
  implicit none
  integer :: n, z, w, i, res1, res2
  integer, allocatable :: a(:)

  read(*, *) n, z, w
  allocate(a(n))

  read(*, *) (a(i), i = 1, n)

  if (n == 1) then
    res1 = 0
  else
    res1 = abs(a(n - 1) - a(n))
  end if
  res2 = abs(a(n) - w)

  write(*, "(i0)"), max(res1, res2)

  deallocate(a)
  contains
end


Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int cnt;
vector<int> v;//?´???°??§???????´???°??§???????????°?????\????????????


//???????????????
void print(int num){
	printf("%d:", num);
	for (int i = 0; i < v.size(); ++i){
		printf(" %d", v[i]);
	}
	printf("\n");
	return;
}


//???????´???°????´???°????????????????¢??????????
void check(int yakusu){
	for (int i = 6; i < yakusu; i += 7){
		if (yakusu % i == 0) return;
	}
	for (int i = 8; i < yakusu; i += 7){
		if (yakusu % i == 0) return;
	}

	v.push_back(yakusu);//?´???°??§?????£????????§??\??????
	return;
}

void slove(int num){
	//?´???°??§??????????????¢????????????????´???°??§????????????check()??¢??°??§?´???°????????????????????????
	for (int i = 6; i<= num; i += 7){
		if (num % i == 0) check(i);
		if (num % (i + 2) == 0) check(i + 2);
	}
	return;
}

int main(void){
	int n;
	rep(i, 10000000){
		scanf("%d", &n);
		if(n == 1) break;
		slove(n);
		print(n);
		v.clear();//v?????°?????????????????°?????\??£??????????????§???????????§?????????????????¨???????????????
	}	

	return 0;
}

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


    string a,b,u;
    int n,m;
    cin>>a>>b>>n>>m>>u;
    if(u[0]==a[0]) n--;
    else m--;
    cout<<n<<" "<<m<<endl;
    return 0;
}


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


int cnt[26] = {0};

int main() {
  int n;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n; ++i) ++cnt[s[i] - 'a'];
  int ans = 1;
  for (int i = 0; i < 26; ++i) ans = 1ll * ans * (cnt[i] + 1) % int(1e9 + 7);
  cout << (int(1e9 + 7) - 1 + ans) % int(1e9 + 7) << '\n';
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n;
    cin>>n;
    pair<int,int>p[n+1];
    int mmx=0,mx=0;
    set<pair<int,int> >s;
    set<pair<int,int> >curl,curr;
    vector<int>v;
    for(int i=1;i<=n;i++)
    {        
            cin>>p[i].first>>p[i].second;            
            v.push_back(p[i].second);            
    }
    sort(p+1,p+n+1);
    for(int i=1;i<=n;i++)
    {
        s.insert({p[i].second,i});
    }
    mmx=p[n].first;
    sort(v.begin(),v.end());

    for(int i=1;i<n;i++)
    {
        if(v[i]>p[n].second)
            break;
        auto j=s.lower_bound({v[i],-1});
        vector<pair<int,int>> lol;
        if(j!=s.begin())
        {
            j--;
            while(1)
            {
                lol.push_back(*j);
                curl.insert({p[j->second].first,j->second});
                curr.insert({p[j->second].second,j->second});
                if(j==s.begin())
                    break;
                j--;
            }
        }
        for(auto j:lol)
                s.erase(j);
        if(!curl.empty())
        {
            int z=max(0LL,v[i]-mmx+1);
            auto tt=curl.end();
            tt--;
            z+=max(0LL,curr.begin()->first-tt->first+1);
            mx=max(mx,z);
        }
    }

    curl.clear();
    curr.clear();
    for(int i=1;i<=n;i++)
    {
        curr.insert({p[i].second,i});
        curl.insert({p[i].first,i});
    }
    for(int i=1;i<=n;i++)
    {        
        curr.erase({p[i].second,i});
        curl.erase({p[i].first,i});
        auto tt=curl.end();
        tt--;
        mx=max(mx,p[i].second-p[i].first+1+max(0LL,curr.begin()->first-tt->first+1));
        curr.insert({p[i].second,i});
        curl.insert({p[i].first,i});
    }
    cout<<mx;

} 


Measured memory_bytes: 18932
#include <stdio.h>
#include <algorithm>
#include <iostream>
 #include <stdlib.h>
using namespace std;
 
class Heap{
public:
    Heap(){
        array = new int[2000000];
        n = 0;
    }
    void insert(int data){
        array[n] = data;
        int tmp = n;
        while(tmp != 0 && array[tmp] > array[(tmp-1)/2]){
            std::swap(array[tmp], array[(tmp-1)/2]);
            tmp = (tmp-1)/2;
        }
        n++;
    }
void max_heapify(int* array, int start, int end)
{
	int dad = start;
	int son = dad * 2 + 1;

	while (son <= end)
	{
		if (array[son] < array[son+1] && son+1 <= end)
			son++;
		if (array[dad] > array[son])
			return;
		else
		{
			swap(array[son], array[dad]);
			dad = son;
			son = dad * 2 + 1;
		}
		
	}
}

int heap_sort(int* array, int len)
{
	int i;
        swap(array[0],array[len-1]);
        max_heapify(array,0,len-2);
        return array[len-1];
}
    int extract(){
    int ret = heap_sort(array,n);
    n--;
    return ret;
    }
 
private:
    int* array;
    int n;
};
 
int main(){
 
    int insert_data;
    char buf[22];
    Heap heap;
 
    while(true){
        fgets(buf,22,stdin);
        if(buf[2] == 'd') break;
        if(buf[0] == 'i'){
            insert_data = atoi(buf+7);
         
            heap.insert(insert_data);
        }else{
            printf("%d\n",heap.extract());
        }
    }
}


Measured memory_bytes: 6984
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define vi vector<pair<pp,pp> >
#define pq_min priority_queue<ll,vector<ll>,greater<ll> >
#define pq_max priority_queue<ll>
#define forx(i,a,b) for(ll i=0;i<a;i++)
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef pair<pp,pp> ppll;
const ll mod=1e9 + 7;

int main()
{
	fast;
	ll n,k;
	cin>>n>>k;
	ll a[n];
	ld pre[n];
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	    ld r=((ld)a[i]+(ld)1)/(ld)2;
		pre[i]=r;
	}
	ld h=0;
	ld ans;
	for(ll i=0;i<k;i++)
	{
		h += pre[i];
	}
	ans=h;
	for(ll i=k;i<n;i++)
	{
		h -= pre[i-k];
		h += pre[i];
		if(h>ans)
		{
			ans=h;
		}
	}
	precision(ans,10);
}

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

using namespace std;

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

  return true;
}

int main(int argc, const char *argv[]) {
  int cnt = 1, n;
  cin >> n;

  for (int i = 3; i <= 55555 && cnt <= n; ++i) {
    if (is_prime(i) && i % 5 == 1) {
      cout << i << '\n';
      cnt++;
    }
  }

  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(int i = (k); i < (int)(n); i++)
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pll;


int main() {
    ll a = 100,x;
    cin>>x;
    for(int i=0;i<x;i++){
        a*=1.01;
        if(a>=x) {cout<<i+1<<endl;return 0;}
    }
    return 0;
}


Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.IO.Pipes;
using System.Linq;
using System.Text;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        void Omame()
        {
            cin = new Scanner();
            string S = cin.next();

            int count = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if(S[i] == 'A')
                {
                    count++;
                }
            }

            if(count == 0 || count == 3)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }

    }
}


Measured memory_bytes: 11220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            HashSet<Long> hs = new HashSet<Long>();
            List<Long> list = new ArrayList<Long>();
            for (int i = 0; i < N; i++) {
                long tmp = in.nextLong();
                if (!hs.contains(tmp)) {
                    hs.add(tmp);
                } else {
                    hs.remove(tmp);
                    list.add(tmp);
                }
            }
            Collections.sort(list);
            if (list.size() < 2) {
                out.println(0);
            } else {
                out.println(list.get(list.size() - 1) * list.get(list.size() - 2));
            }
        }
    }

    static boolean permutation_2(String s, String t) {
        if (s.length() != t.length()) {
            return false;
        }

        int[] letters = new int[256];

        char[] s_array = s.toCharArray();
        for (char c : s_array) {
            letters[c]++;
        }

        for (int i = 0; i < t.length(); i++) {
            int c = (int) t.charAt(i);
            if (--letters[c] < 0) {
                return false;
            }
        }
        return true;
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public char nextChar() {
            return next().charAt(0);
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


Measured memory_bytes: 44380
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main()
{
	string n, t;
	int h;
	int cnt;
	while (cin >> t)
	{
		//cout << "DEBUG:t=" << t << endl;
		if (t[0] == '-')
		{
			cout << n << endl;
			break;
		}
		
		if (isdigit(t[0]))
		{
			//cnt = (int)t[0] - '0';
			cnt = atoi(t.c_str());
			//cout << "DEBUG: COUNT=" << cnt << endl;
			
			for (int i = 0; i < cnt; i++)
			{
				int h;
				cin >> t;
				h = atoi(t.c_str());
				//h = (int)t[0] - '0';
				
				string sl = n.substr(0, h);
				string sr = n.substr(h);
				n = sr + sl;
			}
			//cout << "DEBUG: n=" << n << endl;
		}
		else
		{
			//cout << "DEBUG*2" << endl;

			if (!n.empty())
				cout << n << endl;
			n = t;
			continue;
		}
	}
	
	return 0;
	
}

Measured memory_bytes: 1200
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <math.h>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <ctime>
#include <iomanip>
#include <fstream>
#include <array>
using namespace std;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define IN(x,c) (find(c.begin(),c.end(),x) != (c).end())
#define REP(i,n) for (int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define INIT(a,v) memset(a,v,sizeof(a))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
template<class A, class B> A cvt(B x) { stringstream ss; ss<<x; A y; ss>>y; return y; }

#define SPC << " " <<
#define DEBUG(x) cerr << #x << " = "; cerr << x << endl;
#define DEBUG_ITER(x) cerr << #x << " = "; for (auto _ : x) cerr << _ << ' '; cerr << endl;

typedef pair<int,int> PII;
typedef long long int64;
typedef vector<int> VI;

vector<string> split(string niz, char znak) {
	vector<string> rez;
	string del="";
	int i;
	for (i=0;i<(int)niz.size();i++) {
		if (niz[i]==znak) { rez.push_back(del); del=""; }
		else { del+=niz[i]; }
	}
	rez.push_back(del);
	return rez;
}

int f[50][20];

int main() {
	//freopen("test.in","r",stdin);
	int n;
	cin >> n;
	int64 r=0;
	REP (i,n) {
		string s;
		cin >> s;
		vector<string> tok = split(s,'.');
		if (tok.size()<2) tok.PB("");
		int x=cvt<int>(tok[0]);
		while (tok[1].size()<9) tok[1]+="0";
		int y=cvt<int>(tok[1]);
		int64 a=x*1e9+y;
		int n2=0, n5=0;
		while (a%2==0) { a/=2; n2++; }
		while (a%5==0) { a/=5; n5++; }
		//cout << n2 << " " << n5 << endl;
		for (int m2=max(0,18-n2);m2<50;m2++) {
			for (int m5=max(0,18-n5);m5<20;m5++) {
				r+=f[m2][m5];
			}
		}
		f[n2][n5]++;
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main(void){
	int yy,mm,dd;

	while(cin>> yy >> mm >> dd){
		if(yy <= 1867 ||(yy == 1868 && (mm <= 8 || (mm == 9 && dd <= 7)))){
			cout << "pre-meiji" << endl;
		}else if(yy <= 1911 || (yy == 1912 && (mm <= 6 || (mm == 7 && dd <= 29)))){
			cout << "meiji " << yy-1867 << " " << mm << " " << dd << endl;
		}else if(yy <= 1925 || (yy == 1926 && (mm <= 11 || (mm == 12 && dd <= 24)))){
			cout << "taisho " << yy-1911 << " " << mm << " " << dd <<endl;
		}else if(yy <= 1988 || (yy == 1989 && mm == 1 && dd <= 7)){
			cout << "showa " << yy-1925 << " " << mm << " " << dd << endl;
		}else{
			cout << "heisei " << yy-1988 << " " << mm << " " << dd << endl;
 		}
 	}
}

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

int main(){
	int N;
	cin >> N;
	int b[N+1], i;
	for(i=1; i<=N; i++){
		cin >> b[i];
	}
	
	//index<b[i]のときNG
	i=1;
	do{
		//cout << i << " " << b[i] << endl;
		if(i<b[i]){//NG
			cout << "-1" << endl;
			//cout << "aaaaaaaaa";
			return 0;
		}
		i++;
	}while(i<=N);
	
	
	int Num=N;
	int j;
	int ans[Num+1];
	int inse;
	for(j=Num; j>0; j--){
		//cout << "j="<<j << endl;
		int count=0;
		for(i=1; i<=Num; i++){
			if(i==b[i]){
				inse=i;
				count++;
			}
		}
		if(count==0){
			cout << "-1" << endl;
			//cout << "bbbbbbbbbbb";
			return 0;
		}
		ans[j]=b[inse];
		
		//抜いた分ずらす
		for(i=inse; i<Num; i++){
			b[i] = b[i+1];
		}
		Num--;
	}
	
	for(i=1; i<=N; i++){
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
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 int INF=1e18;
const int MOD=1e9+7;
struct UnionFind {
    public:
    vector<int> par;
    UnionFind(int n){
        par=vector<int>(n,-1);
    }
    int root(int x){
        if(par[x]<0)return x;
    return par[x]=root(par[x]);
    }
    bool issame(int x,int y){
        return root(x)==root(y);
    }
    bool merge(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y)return false;
        if(par[x]>par[y])swap(x,y);
        par[x]+=par[y];
        par[y]=x;
        return true;
    }
    int size(int x){
        return -par[root(x)];
    }
};

signed main(){
    int N,M;cin>>N>>M;
    UnionFind uf(N);
    REP(i,M){
        int x,y,z;cin>>x>>y>>z;x--;y--;
        uf.merge(x,y);
    }
    map<int,int>memo;
    REP(i,N)memo[uf.root(i)]++;
    int ans=0;
    for(auto v:memo)ans++;
    cout<<ans;
}

Measured memory_bytes: 7296
a,b = map(int,input().split())
magic = 1
ans = -1

while a >= (magic * 0.08) // 1 and b >= ( magic * 0.1) // 1:
    if a == (magic * 0.08) // 1 and b == ( magic * 0.1) // 1:
        ans = magic
        break
    magic += 1
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    int n;
    cin >> n;
    // vector<int> A(n);
    vector<int> B(n - 1);
    for (int i = 0; i < n - 1; i++){
        cin >> B.at(i);
    }
    int tmp = B[0];

    for (int i = 0; i < B.size() - 1; i++){
        if (B[i] > B[i + 1]){
            B[i] = B[i + 1];
        }
    }

    int sum = accumulate(B.begin(), B.end(), 0);
    sum += tmp;
    cout << sum << endl;
}

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

int main() {
	int a, b;
  	cin >> a >> b;
  	int x=(a+b)/2;
  	if((a+b)%2==0){
    	cout << x << endl;
    }
  	else{
    	cout << x+1 << endl;
    }
}

Measured memory_bytes: 3580
r,c = map(int,input().split())
s_row = [0 for i in range(c+1)]
for i in range(r):
    row = [int(i) for i in input().split()]
    row.append(sum(row))
    print(" ".join([str(x) for x in row]))
    s_row = [x+y for x,y in zip(s_row,row)]
print(" ".join([str(x) for x in s_row]))

Measured memory_bytes: 7632
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>


using namespace std;

// vector<vector<int>> mat(N, vector<int>(M, 0));

int main(int argc, const char *argv[])
{
    //
    int N,A,B;
    cin>>N>>A>>B;
    cout<<min(N*A,B);

    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=2005,mod=1e9+7;
int C[N*N],f[N],inv[N*N],n,K;
void prework(int n)
{
    inv[1]=1;for(int i=2;i<=n;i++)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
    C[K-2]=1;for(int i=K-1;i<=n;i++)C[i]=1ll*C[i-1]*i%mod*inv[i-K+2]%mod;
}
int main()
{
    scanf("%d%d",&n,&K);
    if(K==1){puts("1");return 0;}
    prework(n*K);
    f[0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=i;j++)
            f[j]=(f[j]+1ll*f[j-1]*C[n*K-(j-1)*(K-1)-i-1])%mod;
    }
    int ans=f[n];
    for(int i=1;i<=n;i++)ans=1ll*ans*i%mod;
    cout<<ans<<endl;
}

Measured memory_bytes: 34780
#include<cstdio>
#include<iostream>
#include<cctype>
using namespace std;
int main(){
	char a;
	while(1){
		scanf("%c",&a);
		if(isalpha(a)){
			if(islower(a))cout<<(char)toupper(a);
			else if(isupper(a))cout<<(char)tolower(a);
		}
		else {cout<<a;}
		if(a=='\n')break;
	}
return 0;
}

Measured memory_bytes: 1112
open System

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

[<EntryPoint>]
let main _ =
    let n = read int
    let ass = reada int
    let rec f i = if i % 2 = 0 then (1 + f (i / 2)) else 0
    ass
    |> Array.map f
    |> Array.min
    |> printfn "%d"
    0


Measured memory_bytes: 12112
#include<bits/stdc++.h>
#define ll long long int
#define CON 100010
const long long mod=1e9+7;
const int INF=1001001001;
const ll inf=1e9+7;
using namespace std;
int main() 
{
	string s;
	cin>>s;
	string pre("0");
	string aft("0");
	int count=s.size();
	for(int i=0;i<count;i++)
	{
		aft=s[i+1];
		if(s[i]=='?'&&(pre[0]=='P'||aft[0]=='P'||i==count-1))
		{
			s[i]='D';
		}
		if(s[i]=='?'&&(aft[0]=='D'||aft[0]=='?'))
		{
			s[i]='P';
		}
		pre=s[i];
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    string o;
    cin>>o;
    long long s,l,j=0;
    f(i,0,o.size()){
        if(o[i]=='A'&&j==0){
            s=i;
            j=1;
        }
        else if(o[i]=='Z'){
            l=i;
        }
    }
    cout<<l-s+1<<endl;
    return 0;
}


Measured memory_bytes: 3712
#include <iostream>

using namespace std;

int main(){
int a;
cin>>a;
if(a==0) cout<<0;
else if(a==1 || a==10 || a==100) cout<<1;
else if(a==11 || a==101 || a==110) cout<<2;
else if(a==111) cout<<3;
return 0;
}

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

typedef long long ll;

ll COM(ll a, ll b) {
    ll x = 1;
    ll y = 1;
    ll cnt = b;
    for (int i = 0; i < cnt; i++) {
        x *= a;
        y *= b;
        a--;
        b--;
    }
    return x/y;
}

int main() {
    ll N;
    ll ans = 0;
    cin >> N;
    vector<ll>A(N);
    set<ll>S;
    map<ll, ll>mp;
    mp[0]++;
    ll sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
        S.insert(sum);
        mp[sum]++;
    }
    for (auto itr = S.begin(); itr != S.end(); itr++) {
        ans += COM(mp[*itr], 2);
    }
    cout << ans << endl;
}


Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int dir = 0;
    int cnt = 0;
    for (int i = 0; i < n - 1; i++) {
        if (dir == 0) {
            if (a[i] < a[i + 1]) dir = 1;
            if (a[i] > a[i + 1]) dir = -1;
        } else if (dir == 1 and a[i] > a[i + 1]) {
            cnt++;
            dir = 0;
        } else if (dir == -1 and a[i] < a[i + 1]) {
            cnt++;
            dir = 0;
        }
    }
    cnt++;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3720
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=103974182;
using namespace std;
int n,m;
vector <pii> vec[100005];
ll d[100005];
bool visit[100005];

void print()
{
	for(int i=0;i<n;i++)
	{
		cout<<d[i]<<' ';
	}
}

void bfs(int x)
{
	queue <int> que;
	que.push(x);
	d[x]=0;
	visit[x]=true;
	while(que.size())
	{
		int nx=que.front();
		que.pop();
		visit[nx]=true;
		for(int i=0;i<vec[nx].size();i++)
		{
			if(d[vec[nx][i].first]==1LL*inf*inf)
			{
				d[vec[nx][i].first]=d[nx]+vec[nx][i].second;
				que.push(vec[nx][i].first);
			}
			else
			{
//				cout<<nx<<' '<<vec[nx][i].first<<endl;
				if(d[vec[nx][i].first]!=d[nx]+vec[nx][i].second) over("No");
			}
		}
	}
}

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n>>m;
	int x,y,z;
	for(int i=0;i<100005;i++)
	{
		d[i]=1LL*inf*inf;
	}
	for(int i=0;i<m;i++)
	{
		scanf("%d%d%d",&x,&y,&z);
		x--;
		y--;
		vec[x].push_back(mp(y,z));
		vec[y].push_back(mp(x,-z));
	}
	for(int i=0;i<n;i++)
	{
		if(!visit[i]) bfs(i);
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 9856
#include <bits/stdc++.h>
using namespace std;
#define f(a,b) for(int i=a; i<b; i++)
int main(){
  int n,k,x,y,sum=0;
  cin >> n >> k >> x >> y;
  f(0,n){
    if ( k > i) sum += x;
    else sum += y;
  }
  cout << sum << endl;
  
  return 0;
}


      


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

typedef long long int llint;

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

	vector<int> S;
	S.push_back(K-(A[0]+(K-A[N-1])));
	for(int i=1;i<N;i++){
		S.push_back(K-(A[i]-A[i-1]));
	}

	cout << *min_element(S.begin(),S.end()) << endl;
	return 0;
}


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

int main(){
    int N,K;
    cin >> N >> K;
    if(K==1 || N==K){
        cout << 0 << endl;
    } else if(N>K){
        cout << N - K << endl;
    } 
    
    return 0;
}

Measured memory_bytes: 256
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = input()
k = int(input())

def calc(i, k):
    return comb(len(n) - i - 1, k) * 9 ** k

def cnt(n):
    cnt = 0
    for c in n:
        if c != "0":
            cnt += 1
    return cnt

ans = 0
if cnt(n) == k:
    ans += 1


for i in range(len(n)):
    if int(n[i]) == 0:
        continue
    if len(n)-i > k:
        ans += calc(i, k)
    k -= 1
    if k < 0:
        break
    if len(n)-i > k:
        ans += (int(n[i]) - 1) * calc(i, k)
print(ans)


Measured memory_bytes: 3064
N = int(input())
P = list(map(int,input().split()))
P2 =[0]*(N+1)

i = N-1
T = 0

for j in range(N):
    P2[P[j]] = j+1

while i >= 0:
    if P2[i] > P2[i+1]:
        T = 1
        f = i+1
        i = i-1
        break
    i = i-1
    

while i > 0:
    if (P2[i+1]-P2[i])*(P2[i]-P2[f])*(P2[f]-P2[i+1]) > 0:
        T = T+1
        f = i+1
    i = i-1

print(T)
        


Measured memory_bytes: 25736
/*  ex7_3
    shu_t */

#include <stdio.h>
#include <stdlib.h>

int main(void){
    int i, j;//roop variable
    int row, column;
    char **grid;//for input
    int *black_row,*black_column;//for judge
    //input number of row and column
    scanf("%d %d\n", &row, &column);
    
    //dynamic memory allocation(input array)
    //each row pointer
    grid = (char**)calloc(row, sizeof(char*));
    if(grid == NULL){
        fprintf(stderr, "calloc error.\n");
        exit(1);
    }
    //each row
    for(i = 0; i < row; i++){
        grid[i] = (char*)calloc(column, sizeof(char));
        if(grid[i] == NULL){
            fprintf(stderr, "calloc error.\n");
            exit(1);
        }
    }
    //dynamic memory allcation(judge array)
    black_row = (int*)calloc(row,sizeof(int));
    if(black_row == NULL){
        fprintf(stderr, "calloc error.\n");
        exit(1);
    }
    black_column = (int*)calloc(column,sizeof(int));
    if(black_column == NULL){
        fprintf(stderr, "calloc error.\n");
        exit(1);
    }
    //input
    for(i=0;i<row;i++){
        for(j=0;j<column;j++){
            scanf(" %c",&grid[i][j]);
            if(grid[i][j] == '#'){//case: black
                black_row[i] = 1;
                black_column[j] = 1;
                //if 0: the row(column) contains only white
            }
        }
    }
    for(i=0;i<row;i++){
        if(black_row[i] == 1){
            for(j=0;j<column;j++){
                if(black_column[j] == 1){//output only case:black_row = black_column = 1
                    printf("%c",grid[i][j]);
                }
            }
            printf("\n");//make a new line depending i
        }
    }

    //free memory realm
    for(i = 0; i < row; i++){
        free(grid[i]);
    }
    free(grid);
    free(black_row);
    free(black_column);

    return 0;
}

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

int main()
{
	int N,K;

	cin >> N >> K;

	int H;
    
	int a = 0;

	for (int i = 0; i < N; i++)
	{
		cin >> H;
		if (K <= H)a++;
	}

	cout << a;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, ans = 1;
    cin >> N;
    for (; ans <= N; ans *= 2);
    cout << ans / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mo 998244353
using namespace std;
int n,m,i,j,k,x,y,book[20005],zhan[20005],flag,f[2005][2005];
int top,nex[20005],to[20005],fir[20005];
int lj(int u,int v){
	top++;
	nex[top]=fir[u];
	fir[u]=top;
	to[top]=v;
}
void ss(int v){
	if(flag!=0)
		return;
	if(book[v]!=0){
		flag=book[v];
		return;
	}
	top++;
	book[v]=top;
	zhan[top]=v;
	for(int top1=fir[v];top1;top1=nex[top1])
		ss(to[top1]);
	if(flag!=0)
		return;
	book[v]=0;
	zhan[top]=0;
	top--;
}
int main(){
	cin>>n>>m;
	for(i=1;i<=m;i++){
		cin>>x>>y;
		f[x][y]=1;
		lj(x,y);
	}
	for(i=1;i<=n;i++)
		if(flag==0)
			ss(i);
	if(flag==0){
		printf("-1\n");
		return 0;
	}
	for(i=1;i<=top-flag+1;i++)
		zhan[i]=zhan[i+flag-1];
	top=top-flag+1;
	for(i=1;i<=n;i++)
		book[i]=0;
	for(i=1;i<=top;i++)
		book[zhan[i]]=i;
	while(1){
		flag=0;
		for(i=1;i<=top;i++){
			for(j=1;j<=top;j++)
				if(i+1!=j&&(i!=top||j!=1)){
					if(f[zhan[i]][zhan[j]]==1){
						flag=1;
						if(j<i){
							for(k=1;k<=i-j+1;k++)
								zhan[k]=zhan[j+k-1];
							top=i-j+1;
						}
						else{
							for(k=1;;k++){
								zhan[i+k]=zhan[j+k-1];
								if(j+k-1==top){
									top=i+k;
									break;
								}
							}
						}
					}
					if(flag==1)
						break;
				}
			if(flag==1)
				break;
		}
		if(flag==0)
			break;
	}
	cout<<top<<endl;
	for(i=1;i<=top;i++)
		cout<<zhan[i]<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;

int main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(0);
    ll x;
    cin >> x;
    for (int a = -125; a <= 125; a++) {
        for (int b = -125; b <= 125; b++) {
            ll powA = pow(a, 5);
            ll powB = pow(b, 5);
            if (powA - powB == x) {
                cout << a << ' ' << b << '\n';
                return 0;
            }
        }
    }
}

Measured memory_bytes: 4100
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;

int main() {
    int a, b;
    string op;
    cin >> a >> op >> b;
    while (true) {
        if (op == "+") {
            cout << a + b << endl;
        } else if (op == "-") {
            cout << a - b << endl;
        } else if (op == "*") {
            cout << a * b << endl;
        } else if (op == "/") {
            cout << a / b << endl;
        } else if (op == "?") {
            break;
        }
        cin >> a >> op >> b;
    }
    
}


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

int main(){
  int n,k; cin >> n >> k;
  vector<int> h(n);
  int count =0;
  for(int i=0;i<n;i++){
    cin >> h.at(i);
    if(h.at(i) >= k){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 640
/// Author: Sarfaraz Alam
# include <bits/stdc++.h>
# define pb push_back
# define ll long long
# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG
typedef unsigned long long int ull;
using namespace std;
const int N = 1e5 + 7;
const int mod = 1e9 + 7;

//int a[N], ans = 1, x;


bool vis[N] ;
vector<int>adj[N];

void dfs(int x , int n, int * c, int * cont)
{
  //cout<<"inside the dfs\n";

  vis[x] = true;
    *c = *c + 1;
  if(*c == n)
    *cont = *cont + 1;



  for(auto u: adj[x])
  {
    if(vis[u] == true)continue;
    dfs(u , n, c, cont);
    //vis[u] = false;
  }

  vis[x] = false;
  *c =  *c - 1;

}











int main()
{

  //  cout<<"works till before taking input\n";

    //Code begins
    ll n,  m;
    cin>>n>>m;
    ull v1, v2;


    while(m--)
    {
        cin>>v1>>v2;
    //    cout<<"inside the input loop\n";
        adj[v1].push_back(v2);
        adj[v2].push_back(v1);
    }

    ///cout<<"works till here|\n";
    // for(auto x: adj)
    // {
    //   for(auto e : x)
    //   cout<<e<<" ";
    //   cout<<endl;
    // }

    int cont = 0;
    int c = 0;
    dfs(1, n, &c, & cont);
    //cout<<"succes\n";

    cout<<cont<<endl;
    return 0;
}


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

signed main () {
	int n;
	cin >> n;
	set < string > xyu;
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		xyu.insert(s);
	}
	cout << ((long long) xyu.size()) << '\n';
}


Measured memory_bytes: 19048
#include<iostream>
#include<string.h>
#include<algorithm>

using namespace std;



int main()
{
	int n,AC=0,WA=0,TLE=0,RE=0;
	cin>>n;
	string s;
	for(int i=0;i<n;i++)
	{
		cin>>s;
	if(s=="AC") AC++;
    if(s=="WA") WA++;
    if(s=="TLE") TLE++;
    if(s=="RE")  RE++;
	}
	cout<<"AC x "<<AC<<endl;
	cout<<"WA x "<<WA<<endl;
    cout<<"TLE x "<<TLE<<endl;
    cout<<"RE x "<<RE<<endl;
	return 0;
}

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

const int N = 1e5 + 10;

int dp[N];

void count_distance(int v, vector <vector <int> >& g, vector <bool>& used) {

    used[v] = true;

    int current_result = 0;
    for (int i = 0; i < g[v].size(); i++) {
        int to = g[v][i];
        if (!used[to]) {
            count_distance(to, g, used);
        }
        
        current_result = max(current_result, dp[to]);
    }

    dp[v] = current_result + 1;
}

int main() {

    int n, m; scanf("%d %d", &n, &m);

    vector <vector <int> > g(n);
    for (int i = 0; i < m; i++) {
        int u, v; scanf("%d %d", &u, &v);
        g[u - 1].push_back(v - 1);
    }

    vector <bool> used(n, false);
    for (int i = 0; i < n; i++) {
        if (!used[i]) {
            count_distance(i, g, used);
        }
    }

    cout << *max_element(dp, dp + n) - 1;

    return 0;
}

Measured memory_bytes: 9472
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
using namespace std;
#define M 1000000007
#define pb push_back
#define rep(i, a, b) for(int i = a; i <= b; i++)
ll mod = 998244353;


int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t; t = 1;
	//cin >> t;
	while(t--)
	{	
		ll x;
		cin >> x;
		ll init = 100;
		ll range = x-100;
		ll g = 0;
		while(init < x)
		{
			init += (init)/100;
			g++;
		}
		cout << g << endl;
	}
		
}  

Measured memory_bytes: 3636
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    A, B = map(int, input().split())
    if A == 1:
        A += 13
    if B == 1:
        B += 13
    if A < B:
        print("Bob")
    elif A > B:
        print("Alice")
    else:
        print("Draw")


if __name__ == '__main__':
    main()


Measured memory_bytes: 4204