akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair <int,int> PAIR;
const int N = 1e5+5;
const int M = 1e4;
const int INF = 0x3f3f3f3f;

int h[N];
bool vis[N];

int main() {
	int n,m,u,v;
	scanf("%d%d",&n,&m);
	for(int i = 1;i <= n;++i) scanf("%d",&h[i]),vis[i] = 1;
	for(int i = 1;i <= m;++i){
		scanf("%d%d",&u,&v);
		if(h[u] > h[v]) vis[v] = 0;
		else if(h[u] < h[v]) vis[u] = 0;
		else vis[v] = vis[u] = 0;
	}
	
	int ans = 0;
	for(int i = 1;i <= n;++i){
		if(vis[i]) ans++;
	}
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 4316
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
	double x, h, y;
	while(scanf("%lf%lf", &x, &h) != EOF){
		if(x+h == 0)break;
		y = sqrt((x/2.0)*(x/2.0) + h*h);
		printf("%f\n", x*y*2 + x*x);
	}
	return 0;
}

Measured memory_bytes: 3116
let dividable lst =
  let rec iter (x, y) = function
    | [] -> true
    | hd :: tl when hd < x && hd < y -> false
    | hd :: tl when hd < x && hd > y -> iter (x, hd) tl
    | hd :: tl when hd > x && hd < y -> iter (hd, y) tl
    | hd :: tl when x > y -> iter (hd, y) tl
    | hd :: tl  -> iter (x, hd) tl
  in iter (0, 0) lst
                                             
let _ = 
  let n = read_int () in
  for i = 1 to n do
    let lst = List.map int_of_string @@ Str.split (Str.regexp " ") (read_line ()) in
    let rt = if dividable lst then "YES" else "NO" in
    print_endline rt
  done

Measured memory_bytes: 2068
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define MOD 1000000007
ll dp[1001][1001];
int main(){
	int h,w;
    cin>>h>>w;
    char a[h][w];
    REP(i,h){
        REP(j,w){
            cin>>a[i][j];
        }
    }
    dp[0][0]=1;
    REP(i,w-1){
        if(a[0][i+1]=='.'){
            dp[0][i+1]=dp[0][i];
        }else{
            dp[0][i+1]=0;
        }
    }
    REP(i,h-1){
        if(a[i+1][0]=='.'){
            dp[i+1][0]=dp[i][0];
        }else{
            dp[i+1][0]=0;
        }
    }
    for(int i=1;i<h;i++){
        for(int j=1;j<w;j++){
            if(a[i][j]=='.'){
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
            }else{
                dp[i][j]=0;
            }
           // OUT(dp[i][j]);
        }
        
    }
    OUT(dp[h-1][w-1]);
	return 0;
}

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

using namespace std;

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.14159265358979323846;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int n, a, b, c, d, e;

signed main() {
    cin >> n >> a >> b >> c >> d >> e;
    int neck = min({a, b, c, d, e});
    cout << (n - 1) / neck + 1 + 4 << endl;
}


Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<vector>
#include<numeric>

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

using namespace std;

const double EPS=1e-8;

const int M_MAX=1100,N_MAX=1100;

// minimize cx s.t. Ax<=b
enum{SOLVABLE,UNBOUNDED,INFEASIBLE};
int simplex(int m,int n,const double A_in[M_MAX][N_MAX],const double *b,const double *c,double *x){
	static double A[M_MAX+1][N_MAX+M_MAX+1];
	rep(j,n+m+1) A[0][j]=(j<n?c[j]:0);
	rep(i,m) rep(j,n+m) A[i+1][j]=(j<n?A_in[i][j]:i==j-n?1:0);
	rep(i,m) A[i+1][n+m]=b[i];

	int bas[M_MAX+1];
	rep(i,m) bas[i+1]=n+i;
	n+=m;

	while(1){
		int p,q;
		for(q=0;q<=n;q++) if(A[0][q]<-EPS) break;
		for(p=1;p<=m;p++) if(A[p][q]> EPS) break;
		for(int i=p+1;i<=m;i++) if(A[i][q]>EPS){
			double ri=A[i][n]/A[i][q],rp=A[p][n]/A[p][q];
			if(ri<rp-EPS || abs(ri-rp)<EPS && bas[i]<bas[p]) p=i;
		}
		if(q>n) break;
		if(p>m) return UNBOUNDED;

		// pivoting
		rep(i,m+1) if(i!=p) rep(j,n+1) if(j!=q) A[i][j]-=A[p][j]*A[i][q]/A[p][q];
		rep(i,m+1) if(i!=p) A[i][q]=0;
		rep(j,n+1) if(j!=q) A[p][j]/=A[p][q];
		A[p][q]=1;

		bas[p]=q;
	}

	n-=m;
	rep(i,n) x[i]=0;
	for(int i=1;i<=m;i++) if(bas[i]<n) x[bas[i]]=A[i][n+m];

	return SOLVABLE;
}

struct edge{ int v,cost,id; };

int main(){
	int n,m; scanf("%d%d",&n,&m);
	vector<edge> G[100];
	rep(i,m){
		int u,v,cost; scanf("%d%d%d",&u,&v,&cost);
		G[u].push_back((edge){v,cost,i});
	}

	int d[100]={};
	rep(u,n) rep(i,G[u].size()) {
		int v=G[u][i].v,cost=G[u][i].cost;
		d[v]=max(d[v],d[u]+cost);
	}

	static double A[M_MAX][N_MAX],b[M_MAX],c[N_MAX],x[N_MAX];
	rep(i,n){
		A[i][i]=1;
		b[i]=d[n-1]-d[i];
	}
	rep(u,n) rep(k,G[u].size()) {
		int v=G[u][k].v,cost=G[u][k].cost,i=G[u][k].id;
		A[n+i][n+i]=1;
		A[n+i][u]=1;
		A[n+i][v]=-1;
		b[n+i]=d[v]-d[u]-cost;
	}
	rep(i,m) c[n+i]=-1;

	simplex(n+m,n+m,A,b,c,x);

	printf("%.0f\n",-inner_product(c,c+n+m,x,0.0)+EPS);

	return 0;
}

Measured memory_bytes: 28888
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val blues = (1..n).map { readLine()!! }
    val m = readLine()!!.toInt()
    val reds = (1..m).map { readLine()!! }

    val kinds = blues.distinct()

    var plus = 0
    var minus = 0
    var result = 0
    for (kind in kinds) {
        plus = blues.count { it == kind }
        minus = reds.count { it == kind }
        if (plus - minus > result) { result = plus - minus }
    }

    println(result)
}

Measured memory_bytes: 33696
function move(d1,d2,d3,d4,d5,d6){
   var x=this.toString();
   if(x=="N")return [d2,d6,d3,d4,d1,d5];
   if(x=="E")return [d4,d2,d1,d6,d5,d3];
}
function roll(d1,d2,d3,d4,d5,d6){
   return [d1,d3,d5,d2,d4,d6];
}
function rolls(arr){
   for(var i=0;i<4;i++){
      obj[arr.join(",")]=true;
      arr=roll.apply(null,arr);
   }
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var n=Arr.shift()-0;
var OBJ={};
var result="Yes";
for(var i=0;i<n;i++){
   var obj={};
   var dice=Arr[i].split(" ").map(Number);
   for(var j=0;j<4;j++){
      rolls(dice);
      dice=move.apply("N",dice);
   }
   dice=move.apply("E",dice);
   rolls(dice);
   dice=move.apply("E",dice);
   dice=move.apply("E",dice);
   rolls(dice);
   for(var k in obj){
      if(OBJ.hasOwnProperty(k))result= "No";
      else OBJ[k]=true;
   }
   if(result=="No")break;
}
console.log(result);

Measured memory_bytes: 10816
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long number = scanner.nextLong();
        boolean found = false;
        if (number == 2) {
            System.out.println(2);
        } else {
            do {
                for (int i = 2; i < number; i++) {
                    if (number % i == 0) {
                        break;
                    }
                    if (i == number - 1) {
                        found = true;
                    }
                }
                number++;
            } while (!found);
            System.out.println(number - 1);
        }
    }
}


Measured memory_bytes: 21588
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        int c = s.nextInt();
        int k = s.nextInt();
        if(k<=a)
            System.out.println(k);
        else{
            if(k-a<=b)
                System.out.println(a);
            else
                System.out.println(a-(k-a-b));
        }

    }

    private static boolean isPrime(int n) {
        if (n == 2)
            return true;
        else if ((n % 2 == 0 && n > 2) || n < 2)
            return false;
        else {
            for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
                if (n % i == 0)
                    return false;
            }
            return true;
        }


    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

Measured memory_bytes: 27040
# coding: utf-8
# Your code here!
n = int(input())
a = list(map(int,input().split()))

v = 1
if 0 in a:
    print(0)
    exit()
for i in range(n):
    v *= a[i]
    if v > 1E18:
        print(-1)
        exit()
print(v)
    


Measured memory_bytes: 21696
import sys
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
P = str(input()).upper()
line = []
 
while True:
    tmp_line = str(input())
    if tmp_line == 'END_OF_TEXT':
        break
    line += tmp_line.upper().split()
 
ans = 0
 
for tmp_word in line:
    if tmp_word == P:
        ans += 1
 
print("%d"%(ans))


Measured memory_bytes: 5572
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

ll N, M;

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

vector<vector<ll > > G;
 
vector<vector<ll > > bfs(ll x, ll y){
    //準備
    vector<vector<ll > > dist(N, vector<ll >(M, -1));
    queue<pi> que;
    //初期化
    dist[x][y] = 0;
    que.push(make_pair(x, y));
 
    while(!que.empty()){
        ll from_y = que.front().first;
        ll from_x = que.front().second;
        que.pop();
 
        for(ll i = 0; i < 4; i++){
            if(from_y + dy[i] >= 0 && from_y + dy[i] < N && from_x + dx[i] >= 0 && from_x + dx[i] < M){
                ll to_y = from_y + dy[i];
                ll to_x = from_x + dx[i];
                //壁がある時
                if(G[to_y][to_x] == -1 || dist[to_y][to_x] != -1) continue;
 
                dist[to_y][to_x] = dist[from_y][from_x] + 1;
                que.push(make_pair(to_y, to_x));

            }
        }
    }

    return dist;
}

int main() {

    cin >> N >> M;
    G.assign(N, vector<ll >());

    for(ll row = 0; row < N; row++){
        for(ll col = 0; col < M; col++){
            char t; cin >> t;
            if(t == '.'){
                G[row].push_back(0);
            }else{
                G[row].push_back(-1);
            }
        }
    }

    ll mx = -1;
    for(ll row = 0; row < N; row++){
        for(ll col = 0; col < M; col++){
            if(G[row][col] == -1) continue;
            //cout << row << " " << col << endl;
            vector<vector<ll > > dist = bfs(row, col);

            for(ll t_row = 0; t_row < N; t_row++){
                for(ll t_col = 0; t_col < M; t_col++){
                    mx = max(mx, dist[t_row][t_col]);
                    //cout<< dist[t_row][t_col] << endl;
                }    
            }
        }
    }

    cout << mx << endl;


}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int H,N;
    cin >> H >> N;
    // 出力
    int A;
    int a;
    for (int i = 0; i < N; i++) {
        cin >> a;
        A += a;
    }
    cout << ((H > A )? "No":"Yes") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e2 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	LL sum = 0;
	int maxv = 0;
	while (n--)
	{
		int x;
		cin >> x;
		sum += x;
		maxv = max(maxv, x);
	}
	sum -= maxv / 2;
	cout << sum << endl;
	return 0;
}

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

int main(){
	
	for(int h,w;cin>>h>>w,h;){
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cout<<"#";
			}
			cout<<endl;
		}
		cout<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
  ll n, m;
  cin >> n >> m;
  vector <stack <ll>> v(n, stack <ll> ());
  rep(i, m) {
    ll a, b, c;
    cin  >> a >> b;
    if (a == 0) {
      cin >> c;
      v.at(b).push(c);
    } else if (a == 1) {
      if (!v.at(b).empty()) {
        cout << v.at(b).top() << endl;
      }
    } else {
      if (!v.at(b).empty()) {
        v.at(b).pop();
      }
    }
  }
}


Measured memory_bytes: 5184
#include <iostream>

#include <algorithm>

using std::cin;
using std::cout;
using std::endl;

using std::sort;

static int
solve_1(int n, int m, int C[], int count, int best, bool *just_ret)
{
  if (n == 0)
  {
    return count;
  }
  int value = C[m];
  int coins = n / value;
  if (value * coins == n)
  {
    int new_count = count + coins;
    if (new_count < best)
    {
      best = new_count;
    }
    *just_ret = true;
  }
  else
  {
    if (best <= count + coins)
    {
      coins = best - count - 1;
    }
    bool just = false;
    for (; 0 <= coins && !just; coins--)
    {
      int new_count = solve_1(n - value * coins, m - 1, C, count + coins, best, &just);
      if (new_count < best)
      {
        best = new_count;
      }
      
    }
  }
  return best;
}

static int
solve(int N, int M, int C[])
{
  sort(&C[0], &C[M]);
  bool just = false;
  return solve_1(N, M - 1, C, 0, N + 1, &just);
}

int
main()
{
  int N, M;
  cin >> N >> M;
  int C[20];
  for (int m = 0; m < M; m++)
  {
    cin >> C[m];
  }
  cout << solve(N, M, C) << endl;
  return 0;
}



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

#define int long long int
#define fi first
#define so second
#define ps push_back
#define ld long double
#define mod 1000000007

signed main()
{
    string s;
    cin>>s;
    int n=s.size(),i;
    vector<pair<int,int>> v;
    for(i=0;i<n-1;i++) if(s[i]=='R' && s[i+1]=='L') v.ps({i,i+1});
    int ans[n]={0};
    for(i=0;i<v.size();i++)
    {
        //cout<<"for cycle "<<v[i].fi<<","<<v[i].so<<endl;
        int cl=0,cr=0;
        int j=v[i].fi-1;
        while(j>=0 && s[j]=='R') {j--;cl++;}
        j=v[i].so+1;
        while(j<n && s[j]=='L') {j++;cr++;}
        //cout<<"cl and cr = "<<cl<<","<<cr<<endl;
        int f=max(cl,cr);
        ans[v[i].fi] = ans[v[i].so] = 1+min(cl,cr);
        if(cl<=cr) {cr-=cl;cl=0;}
        else {cl-=cr;cr=0;}
        ans[v[i].fi]+=(cl/2)+(cr/2);
        ans[v[i].so]+=(cl/2)+(cr/2);
        cl%=2;
        cr%=2;
        if(cl>0) ans[v[i].fi]++;
        else if(cr>0) ans[v[i].so]++;
        if(f%2!=0) {swap(ans[v[i].fi],ans[v[i].so]);}
    }
    for(i=0;i<n;i++) cout<<ans[i]<<" ";

}


Measured memory_bytes: 2292
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 110
 
bool check(int ant[MAX],int L){
    for(int i = 0 ; i < L ; i++){
	if(ant[i] != 0) return false;
    }
    return true;
}
 
int main(){
    int N,L,p;
    char d;
    while(cin >> N >> L, N){
	int ant[MAX]={0};
	vector<int> tunnel[MAX],id[MAX];
	L--;
	for(int i = 0 ; i < N ; i++){
	    cin >> d >> p;
	    ant[p-1]++;
	    id[p-1].push_back(i+1);
	    tunnel[p-1].push_back((d == 'L' ? 1 : 2));
	}
	int t = 0,last;
	while(!check(ant,L)){
	    vector<int> next[MAX],nid[MAX];
	    last = -1;
	    for(int i = 0 ; i < L ; i++){
		next[i].clear();
		nid[i].clear();
		if(ant[i] && last == -1){
		    last = id[i][0];
		}
	    }
	    for(int i = 0 ; i < L ; i++){
		while(tunnel[i].size()){
		    if(tunnel[i][0] == 1){
			tunnel[i].erase(tunnel[i].begin());
			if(i-1 >= 0){
			    next[i-1].push_back(1);
			    nid[i-1].push_back(id[i][0]);
			    id[i].erase(id[i].begin());
			}
		    }else if(tunnel[i][0] == 2){
			tunnel[i].erase(tunnel[i].begin());
			if(i+1 < L){
			    next[i+1].push_back(2);
			    nid[i+1].push_back(id[i][0]);
			    id[i].erase(id[i].begin());
			}
		    }
		}
	    }
	    for(int i = 0 ; i < L ; i++){
		tunnel[i] = next[i];
		id[i] = nid[i];
		if(tunnel[i].size() == 2){
		    swap(tunnel[i][0],tunnel[i][1]);
		}
		ant[i] = tunnel[i].size();
	    }
	    t++;
	}
	cout << t << " " << last << endl;
    }
    return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <utility>
#include <string>

using namespace std;



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

	string S;
	cin >> S;
	if (S.find("AC") != string::npos) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#define n 36

struct Card{
  char suit;
  char value;
};

void BubbleSort(struct Card C[],int N){
  int i,j;
  struct Card a;

  for(i=0;i<N;i++){
    for(j=N-1;j>=i+1;j--){
      if(C[j].value < C[j-1].value){
        a = C[j];
        C[j] = C[j-1];
        C[j-1] = a;
      }
    }
  }
}

void SelectionSort(struct Card C[],int N){
  int i,j,minj;
  struct Card a;

  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(C[j].value < C[minj].value){
        minj = j;
      }
    }
    a = C[i];
    C[i] = C[minj];
    C[minj] = a;
  }
}

int isStable(struct Card C1[],struct Card C2[],int N){
  int i,j;

  for(i=0;i<N;i++){
    if(C1[i].suit != C2[i].suit)return 0;
  }
  return 1;
}
  /*for(i=0;i<N;i++){                                                           
    for(j=i+1;j<N;j++){                                                         
      for(a=0;a<N;a++){                                                         
        for(b=a+1;b<N;b++){                                                     
        if(in[i] == in[j] && )*/
int main(){
  struct Card C1[101],C2[101];
  int i,N;
  scanf("%d\n",&N);
  for(i=0;i<N;i++){
    if(i!=N-1)scanf("%c%c ",&C1[i].suit,&C1[i].value);
    else scanf("%c%c",&C1[i].suit,&C1[i].value);
  }

  for(i=0;i<N;i++)C2[i] = C1[i];

  BubbleSort(C1,N);
  SelectionSort(C2,N);

  for(i=0;i<N;i++){
    if(i)printf(" ");
    printf("%c%c",C1[i].suit,C1[i].value);
  }
  printf("\nStable\n");
  for(i=0;i<N;i++){
    if(i)printf(" ");
    printf("%c%c",C2[i].suit,C2[i].value);
 }
  if(isStable(C1,C2,N)){
    printf("\nStable\n");
  }
  else printf("\nNot stable\n");

  return 0;
}



Measured memory_bytes: 2108
'use strict';

function main(stdin) {
  const input = stdin.split('\n');
  const N = Number(input[0]);
  const d = input[1].split(' ').map(v => parseInt(v, 10)).sort((a, b) => a - b);
  
  const abc = d[N / 2 - 1];
  const arc = d[N / 2];

  console.log(arc - abc);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 28476
#include <stdio.h>
#define N 500000
#define S 1000000001

void merge(int *, int, int ,int);
void mergeSort(int *, int, int);

int out;

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

void merge(int *a, int left, int mid, int right){
  
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  int l[N], r[N];
  
  for(i = 0; i < n1; i++){
    l[i] = a[left + i];
  }

  for(i = 0; i < n2; i++){
    r[i] = a[mid + i];
  }

  l[n1] = S;
  r[n2] = S;

  i = 0;
  j = 0;

  for(k = left; k < right; k++){
    if(l[i] <= r[j]){
      a[k] = l[i];
      i++;

      out ++;
    }
    else {
      a[k] = r[j];
      j++;

      out ++;
    }

  }

}

void mergeSort(int *a, int left, int right){

  int mid;

  if(left + 1 < right){
    mid = (left + right) / 2;
    mergeSort(a, left, mid);
    mergeSort(a, mid, right);
    merge(a, left, mid, right);
  }
  
}

Measured memory_bytes: 5920
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,ra,re) for((i)=ra;(i)<(re);(i)++)
#define _rep(i,ra,re) for((i)=ra;(i)>(re);(i)--)
#define rep_(i,ra,re) for((i)=ra;(i)<=(re);(i)++)
#define _rep_(i,ra,re) for((i)=ra;(i)>=(re);(i)--)
#define put(n) cout << n << " "; 
#define puts(n) cout << n << endl;
#define pu(n) cout << n;
#define mod 1000000007
int i,j,k,l;
static const int MAX_N=10e5;
int V[MAX_N];
int main(void){
	int N;
	cin >> N;
	rep(i,0,N){
		cin >>V[i];
	}sort(V,V+N);
	double front=(double)(V[0]+V[1])/2;
	double ans;ans=front;
	rep_(i,2,N-1){
		front=(double)(V[i]+front)/2;//printf("%f   ",front);
	}printf("%f",front);
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		String[] array = scan.nextLine().split(" ");
		Stack<String> stack = new Stack<>();
		
		for(int i = 0; i < array.length; i++) {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		}
		System.out.println(stack.pop());
	}
}


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

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

    int ans = 0;
    for (int i=1; i<=n; ++i) {
        ans += i; 
    }

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


Measured memory_bytes: 256
D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
1 < (I=(0..25).select{C[_1]==0}).size and S.each {|s;z|
  I.each {|i| if i!=(z||=i); s[z]<s[i] ? (s[z]=0; z=i) : (s[i]=0) end }
}
L,M,N = [-1]*27,9,3
def calc(d,n)
  s,x = S[d],0
  t = (0..25).map {s[_1] > 0 ? C[_1]*(d-L[_1])+s[_1] : 0}
  i = (0..25).max_by(M){t[_1]}.max_by {|i|
    next t[i]  if n == 0 || d+1 >= D || t[i]==0
    l,L[i] = L[i],d
    c = calc(d+1,n-1) >> 5
    L[i] = l
    x < c ? x=c : c
  }
  ((t[i]+x) << 5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 }

Measured memory_bytes: 15216
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }

int main() {
    int a, b; cin >> a >> b;
    cout << lcm(a, b) << endl;
    return 0;
}


Measured memory_bytes: 256
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let[a,b,c,d]=nrin(4);
  out(a>=b?b*c+d*(a-b):a*c)
}
main()

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string s;
  cin >> N >> s;
  for(int i=0;i<N;i++){
    for(int j=0;j<s.size();j++){
      if(s.at(j)=='Z'){
        s.at(j) = 'A';
      }
      else{
        s.at(j) +=1;
      }
    }
  }
  cout << s << endl;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector<double> vd;
typedef std::vector<std::string> vs;
typedef std::vector<pii> vpii;
typedef std::vector<vi> vvi;
typedef std::vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { rep(i,v.size()) is >> v[i]; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

main {
  vs v;
  string s;
  while (cin >> s) transform(all(s), s.begin(), ::tolower), v.push_back(s);
  map<string, int> m;
  int freq = 0, len = 0;
  string topFreq, topLen;
  rep(i, v.size()) {
    if (cmax(freq, ++m[v[i]])) topFreq = v[i];
    if (cmax(len, v[i].size())) topLen = v[i];
  }
  cout << topFreq << ' ' << topLen << endl;
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

int main(){

	int n, lw, lb=0, rw=0, rb=0, mi, flag=2;
	string s;
	vector<int> fb, v;

	cin>> n;
	cin>> s;

	if(s[0]=='.') fb.emplace_back(0);

	for(int i=0;i<n;i++){
		if(s[i]=='#'){
			rb++;
			if(flag!=1) fb.emplace_back(i);
			flag=1;
		}else{
			rw++;
			if(flag!=0) fb.emplace_back(i);
			flag=0;
		}
	}

	/*cout<< rb << " " << rw << endl;
	for(int i=0;i<fb.size();i++) cout<< fb[i] << endl;
	cout<< endl;*/

	mi=min(rb, rw);
	if(!fb.empty()) lw=fb[0];
	rw-=lw;

	for(int i=0;i<fb.size()-1;i++){
		if(fb.size()<2) break;
		if(i%2==0){
			rb-=fb[i+1]-fb[i];
			lb+=fb[i+1]-fb[i];
		}else{
			
			rw-=fb[i+1]-fb[i];
			lw+=fb[i+1]-fb[i];
		}
		v.emplace_back(lb+rw);
		//cout<< v[i] << endl;
	}

	for(int i=0;i<v.size();i++){
		if(v.size()==0) break;
		mi=min(mi, v[i]);
	}

	cout<< mi << endl;


}

Measured memory_bytes: 2808
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int x, y, z;
        x = input.nextInt();
        y = input.nextInt();
        if (x % y == 0) {
            System.out.println("0");
        } else {
            System.out.println("1");
        }
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) (a).begin(), (a).end()
#define pw(x) (1ll<<(x))
#define lb(x) ((x) & -(x))
#define endl "\n"
#define FI(x) freopen(#x".in","r",stdin)
#define FO(x) freopen(#x".out","w",stdout)
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
//typedef uniform_int_distribution<ll> RR;
const int P = 1e9 + 7;
//ll rnd(ll l, ll r) { mt19937 gen(rand()); RR dis(l, r); return dis(gen); }
int add(int a, int b) {if((a += b) >= P) a -= P; return a < 0 ? a + P : a;}
int mul(int a, int b) {return 1ll * a * b % P;}
int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----

const int N = 1e5 + 8;
bool ok;
int vis[N], n, m, u, v;
ll use[N], ans;
vi g[N], gg[N], tmp;

int inc(int x) {
	x++;
	if (x == 4) x = 1;
	return x;
}

int dec(int x) {
	x--;
	if (x == 0) x = 3;
	return x;
}

void dfs(int u) {
	tmp.pb(u);
	for (auto v : g[u]) {
		if (!vis[v]) {
			vis[v] = inc(vis[u]);
			dfs(v);
		}else {
			if (vis[v] != inc(vis[u])) {
				ok = 0;
			}
		}
	}
	for (auto v : gg[u]) {
		if (!vis[v]) {
			vis[v] = dec(vis[u]);
			dfs(v);
		}else {
			if (vis[v] != dec(vis[u])) {
				ok = 0;
			}
		}
	}
}

int main() {
	//FI(a);
	ios::sync_with_stdio(0);
	cin.tie(0);
	//cout << setiosflags(ios::fixed);
	//cout << setprecision(2);
	cin >> n >> m;
	rep(i, 1, m+1) {
		cin >> u >> v;
		g[u].pb(v);
		gg[v].pb(u);
	} 
	rep(i, 1, n+1) if (!vis[i]) {
		ok = 1; tmp.clear(); vis[i] = 1;
		dfs(i);
		//de(ok);de(ans);
		if (!ok) {
			ans += 1ll * sz(tmp) * sz(tmp);
		}else {
			rep(i, 1, 4) use[i] = 0;
			for (auto u : tmp) use[vis[u]]++;
			rep(i, 1, 4) ok &= use[i] > 0;
			//de(use[1]);
			//de(use[2]);
			//de(use[3]);
			if (ok) ans += use[1] * use[2] + use[2] * use[3] + use[3] * use[1];
			else {
				int t = 0;
				for (auto u : tmp) ans += sz(g[u]);
			}
		}
	}
	cout << ans << endl;
	return 0;
	
}



Measured memory_bytes: 16764
#include <stdio.h>

void swap(int x[], int i, int j) {
    int tmp;

    tmp = x[i];
    x[i] = x[j];
    x[j] = tmp;
}

void qsort(int x[], int left, int right) {
    int i, j;
    int pivot;

    i = left;
    j = right;

    pivot = x[(left + right) / 2];    // base point

    while (1) {
        while (x[i] < pivot)          // right
            i++;
        while (pivot < x[j])          // left
            j--;
        if (i >= j)
            break;

        swap(x, i, j);

        // next target
        i++;
        j--;
    }
    
    if (left < i - 1)
        qsort(x, left, i - 1);
    if (j + 1 <  right)
        qsort(x, j + 1, right);
}

int main() {
    int i;
    int height[10];

    for (i = 0; i < 10; i++) {
        scanf("%d", &height[i]);
    }

    qsort(height, 0, 9);

    for (i = 0; i < 3; i++){
        printf("%d\n", height[9-i]);
    }
    
    return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
int main(){
	int nums[]={0,1,2,3,5,7,8,9};
	while(1){
		int n;
		long long a=0,d=1;
		scanf("%d",&n);
		if(!n) break;
		while(n){
			a+=nums[n%8]*d;
			d*=10;
			n/=8;
		}
		printf("%lld\n",a);
	}
	return 0;
}

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



int main() {
	int n,ans[27];
	cin>>n;
	for(int i=0;i<27;i++){
		ans[i]=1<<30;
	}
	for(int i=0;i<n;i++){
		vector<int>kari(27,0);
		string s;
		cin>>s;
		for(int j=0;j<s.size();j++){
			kari[s.at(j)-'a']++;
		}
		for(int j=0;j<27;j++){
			ans[j]=min(ans[j],kari[j]);
		}
	}
	bool flag=0;
	for(int i=0;i<27;i++){
		if(ans[i]>0){
			for(int j=0;j<ans[i];j++){
				cout << char (i+'a');
				flag=1;
			}
		}
	}
	cout << (flag ? "":" ");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
using P=pair<int,int>;


int i,j,n,m,ans=0;
vector<bool> visit;
void dfs(int,int);
Graph G;

int main(){
    cin>>n>>m;
    G.resize(n);
    visit.assign(n,0);

    for(i=0;i<m;i++){
        int a,b;
        cin>>a>>b;a--;b--;
        G[a].push_back({b});
        G[b].push_back({a});
    }
    
    visit[0]=1;
    dfs(n,0);
    
    cout<<ans<<endl;
    return 0;
}
void dfs(int k,int state){//state:今いる場所
    
    for(auto next:G[state]){
        if(visit[next]!=1){//訪れていないとき
            visit[next]=1;
            dfs(k-1,next);
            visit[next]=0;
        }
    }

    if(k==1){//適パターン　
        ans++;
        return;    
    }

    return;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,k,n,s=0,s1=0,x,y;
cin>>n;
for(i=1;i<=n;i+=2)
{
s=0;
for(j=1;j<=(i/2);j++)
{
if(i%j==0)
s++;
}
s++;
if(s==8)
s1++;
}
cout<<s1;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] tmpArray = br.readLine().split(" ");
		int m = Integer.parseInt(tmpArray[0]);
		int n = Integer.parseInt(tmpArray[1]);
		
		long result = repeatablePow(m, n, 1000000007);
		
		System.out.println(result);
	}
	
	static long repeatablePow(int x, int n, int mod){
		if(n == 0){
			return 1;
		}
		long result = repeatablePow((int)((long)x*x%mod), n/2, mod);
		if(n % 2 == 1){
			result = result*x%mod;
		}
		return result;
	}

}

Measured memory_bytes: 24452
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int array[20];
int buffer[20];
int N;

void bubbleSort()
{
  int flag = 1;
  int tmp;
  while (flag)
  {
    flag = 0;
    for (int i = 0; i < N - 1; i++)
    {
      if (array[i] > array[i + 1])
      {
        tmp = array[i + 1];
        array[i + 1] = array[i];
        array[i] = tmp;
        flag = 1;
      }
    }
  }
}

void mergeSort(int start, int end)
{
  if (end - start <= 0)
  {
    return;
  }

  int half = (start + end) / 2;

  mergeSort(start, half);
  mergeSort(half + 1, end);

  for (int i = 0; i <= half - start; i++)
  {
    buffer[i] = array[start + i];
  }

  int push_pointer = start, first_half_pointer = 0, second_half_pointer = half + 1;
  while (first_half_pointer <= half - start && second_half_pointer <= end)
  {
    if (buffer[first_half_pointer] < array[second_half_pointer])
    {
      array[push_pointer] = buffer[first_half_pointer];
      first_half_pointer++;
    }
    else
    {
      array[push_pointer] = array[second_half_pointer];
      second_half_pointer++;
    }
    push_pointer++;
  }
  while (first_half_pointer <= half - start)
  {
    array[push_pointer++] = buffer[first_half_pointer++];
  }
  while (second_half_pointer <= end)
  {
    array[push_pointer++] = array[second_half_pointer++];
  }
}

int main()
{
  scanf("%d", &N);
  for (int i = 0; i < N; i++)
  {
    scanf("%d", &array[i]);
  }
  // bubbleSort();
  mergeSort(0, N - 1);
  int sum = 0;
  for (int i = 0; i < N - 1; i++)
  {
    sum += array[i];
  }
  if (sum > array[N - 1])
  {
    printf("Yes\n");
  }
  else
  {
    printf("No\n");
  }
}


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 10000000000
#define mod 1000000007
#define X 1000000
typedef long long int ll;
ll finv[X];
ll fac[X];
ll inv[X];
ll usort(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll dsort(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll ssort(const void *a, const void *b){return strcmp((char*)a,(char*)b);}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll z(ll a){return max(a,-a);}
ll gcd(ll a,ll b){if(!b){return a;}else{return gcd(b,a%b);}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll kt(ll a){
  ll sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
ll ks(ll a){
  ll sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
ll nCr(int n,int k){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (int i=2;i<X;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;
  }
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
int main(void){
  ll n;
  scanf("%lld",&n);
  if(n%2){
    PRN(0);
    return 0;
  }
  ll ans=0;
  for(int i=1;n>=(ll)pow(5,i);i++){
    ans+=n/((ll)pow(5,i))/2;
  }
  PRL(ans);
  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#include<math.h>

int main(void){
    int N, M, X;
    scanf("%d%d%d", &N, &M, &X);
    int i;
    int temp;
    int left = 0;
    for(i=0; i<X; i++) {
        scanf("%d", &temp);
        if(temp < X) {
            left++;
        }
    }
    int right = M - left;
    if(right > left) {
        printf("%d\n", left);
    }
    else{
        printf("%d\n", right);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
ll INF = (1LL << 62) - 1;
int MOD = 1e9+7;
main(){
    int N,K;
    cin >> N >> K;
    vector<ll> X(N),Y(N);
    rep(i,0,N)cin >> X[i] >> Y[i];

    ll mini = INF;
    rep(i,0,N)rep(j,0,N)rep(k,0,N)rep(l,0,N){
        ll miniX = min({X[i], X[j], X[k], X[l]});
        ll maxiX = max({X[i], X[j], X[k], X[l]});
        ll miniY = min({Y[i], Y[j], Y[k], Y[l]});
        ll maxiY = max({Y[i], Y[j], Y[k], Y[l]});
        int cnt = 0;
        rep(m,0,N){
            if(X[m] >= miniX && X[m] <= maxiX && Y[m] >= miniY && Y[m] <= maxiY)cnt++;
        }
        if(cnt >= K){
            mini = min(mini, (maxiX - miniX) * (maxiY - miniY));
        }
    }
    cout << mini << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(int)(n); ++i)
 
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;}

int main(){
  int n; cin >> n;
  string ans = "No";
  for(int i=1;i<=9;i++){
    int x = n/i;
    if(n%i==0 && x>=1 && x<=9){
      ans =  "Yes";
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  //M:contest's time T:team P:problem R:number of log
  //m:time t:team number p:problem number ju:jajji

  int M,T,P,R;
  int m,t,p,ju;
  int i,j,k,n,o;
  int tpw[51][11];
  int tmp;
  int tn[51] = {0};

  while(1) {
    int tw[51] = {0};
    int tc[51] = {0};
    int tp[51] = {0};
    int pr[11] = {0};
    int teq[51] = {0};

    scanf("%d %d %d %d",&M,&T,&P,&R);
    if(M+T+P+R == 0) break;
    //    printf("R = %d\n",R);

    for(i=1;i<51;i++) {
      tn[i] = i;
      for(j=0;j<11;j++) {
	tpw[i][j] = 0;
      }
    }

    tmp = 1;
    /*    for(i=T;i>0;i--) {
      tn[tmp] = i;
      tmp++;
      } */

    for(i=0;i<R;i++) {

      scanf("%d %d %d %d",&m,&t,&p,&ju);

      if(ju == 0) {
	tc[t]++;
	tp[t] += m;
	//	printf("tp[%d] = %d\ntc[%d] = %d\n",t,tp[t],t,tc[t]);
	tw[t] += tpw[t][p];
	//	printf("tw[%d] = %d\n",t,tw[t]);
      } 
      else {
	tpw[t][p]++;
      }
    }

   
    for(i=1;i<=T;i++) {
      for(j=i+1;j<=T;j++) {

	if(tc[i] < tc[j]) {
	  //  printf("tc[%d](%d) <=> tc[%d](%d)\n",i,tc[i],j,tc[j]);
	  tmp = tn[i];
	  tn[i] = tn[j];
	  tn[j] = tmp;

	  tmp = tc[i];
	  tc[i] = tc[j];
	  tc[j] = tmp;

	  tmp = tw[i];
	  tw[i] = tw[j];
	  tw[j] = tmp;

	  // printf("before :tp[%d](%d) =  tp[%d](%d)\n",i,tp[i],j,tp[j]);
	  tmp = tp[i];
	  tp[i] = tp[j];
	  tp[j] =tmp;
	  //printf("tp[%d](%d) =  tp[%d](%d)\n",i,tp[i],j,tp[j]);
	}
	else if(tc[i] == tc[j]) {
	  //	  printf("tp[%d](%d)+ 20*tw[%d](%d){%d} ?=? tp[%d](%d)+20*tw[%d](%d){%d}\n",i,tp[i],i,tw[i],tp[i]+ (20*tw[i]),j,tp[j],j,tw[j],tp[j]+ (20*tw[j]));
	  if(tp[i]+ (20*tw[i]) > tp[j]+(20*tw[j])) {
	    tmp = tn[i];
	    tn[i] = tn[j];
	    tn[j] = tmp;

	    tmp = tw[i];
	    tw[i] = tw[j];
	    tw[j] = tmp;

	    tmp = tp[i];
	    tp[i] = tp[j];
	    tp[j] =tmp;

	  }else if(tp[i]+ 20*tw[i] ==  tp[j]+20*tw[j]) {
	    
	    if(tn[i] < tn[j] ) {
	      tmp = tn[i];
	      tn[i] = tn[j];
	      tn[j] = tmp;
	    }
	  }
       
	}
	//	for(k=1;k<=T;k++)  printf("%d",tn[k]);
	//	printf("\n");
      }
    }

    for(i=1;i<=T;i++) {
      if(tc[i] == tc[i+1] && tp[i]+ 20*tw[i] ==  tp[i+1]+20*tw[i+1]){
	teq[i] = 1;
      }
    }


    for(i=1;i<=T;i++) {

      printf("%d",tn[i]);
	     if(i < T){ 
	       if(teq[i] == 1) printf("=");
	       else printf(",");
	     }
    }

    printf("\n");

  }

  return 0;

}
	     
	    
  

Measured memory_bytes: 608
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    vector<vector<int>> arr;

    while (true) {
        vector<int> a;
        int x, y;
        cin >> x >> y;
        if (x == 0 && y == 0) {
            break;
        }
        a.emplace_back(x);
        a.emplace_back(y);
        arr.emplace_back(a);
    }
    for (auto iter = arr.begin(); iter != arr.end(); ++iter) {
        cout << min((*iter)[0], (*iter)[1]) << ' ' << max((*iter)[0], (*iter)[1]) << endl;
    }
    return 0;
}


Measured memory_bytes: 3224
#include<cstdio>
#include<algorithm>
#include<iostream>

using namespace std;

int main(){
    int h, w;
    scanf("%d %d", &h, &w);
    char a[h][w];
    for(int i = 0; i < h; i++){
        scanf("%s", a[i]);
    }
    int r[h], c[w];
    fill(r, r + h, 0);
    fill(c, c + w, 0);
    for(int i = 0; i < h; i++){
        int sm = 0;
        for(int j = 0; j < w; j++){
            if(a[i][j] == '#'){
                r[i]++;
                break;
            }
        }
    }
    for(int i = 0; i < w; i++){
        for(int j = 0; j < h; j++){
            if(a[j][i] == '#'){
                c[i]++;
                break;
            }
        }
    }

    for(int i = 0; i < h; i++){
        if (r[i] != 0) {
            for(int j = 0; j < w; j++){
                if(r[i] != 0 && c[j] != 0){
                    cout << a[i][j];
                }
            } 
            puts("");           
        }
    }   
}

Measured memory_bytes: 256
from collections import deque
A = deque(input())
B = deque(input())
C = deque(input())
win = False
count = "a"
ans = ""
while ans == "":
    if count == "a":
        if len(A) == 0:
            ans = "A"
        else:
            count = A.popleft()
    elif count == "b":
        if len(B) == 0:
            ans = "B"
        else:
            count = B.popleft()
    else:
        if len(C) == 0:
            ans = "C"
        else:
            count = C.popleft()



print(ans)


Measured memory_bytes: 3316
n = int(input())
tmp = n
ans = n
y = tmp **0.5
o = int(y // 1)
for i in range(o+1):
    a=i+1
    #print("a:"+str(a))
    b=n/(i+1)
    #print("b:"+str(b))
    #print("a*b:"+str(a*b))
    if (b.is_integer()==True ):
        kari = max(len(str(a)),len(str(int(b))))
        #print("kari:"+str(kari))
        ans = min(ans,kari)
print(ans)
               

Measured memory_bytes: 9344
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    let (m, k) = (io.read::<usize>(), io.read::<usize>());
    // ながさ2^(m+1) の数列
    // ちょうど二個含む0<=x<2^m のかず（）

    if m == 1 {
        if k == 0 {
            io.writeln("0 0 1 1");
        } else {
            io.writeln(-1);
        }
        return;
    }
    if k >= (1 << m) {
        io.writeln(-1);
        return;
    }

    let mut v = Vec::new();
    for i in 0..(1 << m) {
        if i != k {
            v.push(i);
        }
    }
    v.push(k);
    // for &x in v.iter() {
    //     io.writeln(x);
    // }
    for i in (0..(1 << m)).rev() {
        if i != k {
            v.push(i);
        }
    }
    v.push(k);
    for &x in v.iter() {
        io.writeln(x);
    }
}

static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 4128
#include <stdio.h>
int main(){
	int n,m,l[10000],i,x,p,a;
	while(1){
		scanf("%d%d",&n,&m);
		p=0;
		a=0;
		if(n==0&&m==0){
			break;
		}

		for(i=0;i<1024;i++){
			l[i]=0;
		}


		for(i=0;i<n;i++){
			scanf("%d",&l[i]);
		}
		for(i=0;i<m;i++){
			scanf("%d",&x);
			p+=x+l[p+x];
			if(p>=n-1&&a==0){
				a=i+1;
			}
		}
		printf("%d\n",a);
	}
    return 0;
}

Measured memory_bytes: 1804