akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define rep(i, N) for(int i=0;i<int(N);++i)
#define rep1(i, N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << "{" << p.first << ", " << p.second << "}";
    return os;
}

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

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

const int INF = (ll) 1e9;
const ll INFLL = (ll) 1e18 + 1;
const ll MOD = (ll) 1e9 + 7;
const double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    if(k > a+b){
        cout << a - (k-a-b) << endl;
        return 0;
    }
    cout << min(k, a) << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
    int n, m;
    while(cin>>n>>n>>n>>n){
        if(n==1){
            cout<<1<<endl;
        }
        else{
            cout<<0<<endl;
        }
    }
  return 0;
}




Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace AtCoder
{
  public class Program
  {
    public static void Main()
    {
      int[] args = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
      int x = args[2];
      for(int i = 0; i < 10; i++)
      {
        x = x * args[0] - args[1];
        Console.WriteLine(x);
      }
    }
  }
}


Measured memory_bytes: 13268
#include<stdio.h>
main(){
  double a=0;
  int d=0;
  int e=0;
  char class[11][100]={"fly","fly","bantam","feather","light","welter","welter","middle","middle","heavy","heavy"};
  while(scanf("%lf",&a)!=EOF){
    a=a-45;
    for(e=0;e<5;e++){
      if(a>3){
	a=a-3;
	d++;
      }
    }
    for(e=4;e<7;e++){
      if(a>e){
	a=a-e;
	d++;
      }
    }
    if(a>6){
      a=a-7;
      d++;
    }
    if(a>9){
      a=a-10;
      d++;
    }
    if(d==0||d==5||d==7||d==9){
      printf("light %s\n",class[d]);
    }
    else{
      printf("%s\n",class[d]);
    }
    d=0;
    a=0;
  }
  return 0;
}

Measured memory_bytes: 632
s = input()
output = ""

for i in s:
  #print("output:", output)
  if (output == "") and (i == "B"):
    pass
  elif i == "0":
    output = output + "0"
  elif i == "1":
    output = output + "1"
  elif i == "B":
    output = output[:-1]

print(output)

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

int main()
{
    ios_base::sync_with_stdio(false);
    int X, N;
    cin >> X >> N;

    vector<int> p(N);
    for (int i = 0; i < N; ++i) {
        cin >> p[i];
    }

    unordered_set<int> P;
    for (const auto &num : p) {
        P.insert(num);
    }

    for (int i = 0; i <= 200; ++i) {
        if (P.find(X-i) == P.end()) {
            cout << X-i << endl;
            return 0;
        } else if (P.find(X+i) == P.end()) {
            cout << X+i << endl;
            return 0;
        }
    }
}


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

int main() {
	int n;
	cin >> n;
	vector<int> a(n-1), ans(n);
	rep(i, n-1) {
		cin >> a[i];
		a[i]--;
	}
	rep(i, n-1) {
		ans[a[i]]++;
	}
	rep(i, n) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 4840
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

bool dp[1010][1010];
int solve_testcase() {
    int N; scanf("%d", &N);
    if(N == 0) return 1;

    int read_sum = 0, write_sum = 0;
    vector< pair<int, int> > books(N);
    for(int i=0; i<N; i++) {
        int r, w;
        scanf("%d%d", &r, &w);
        books[i] = make_pair(r, w);
        read_sum += r;
        write_sum += w;
    }

    sort(books.rbegin(), books.rend());
    if(read_sum - books[0].first >= books[0].first) {
        printf("%d\n", read_sum + write_sum);
    }
    else {
        int r0, w0; tie(r0, w0) = books[0];
        books.erase(books.begin()); N--;
        fill(dp[0], dp[N+1], false);
        dp[0][0] = true;

        for(int i=0; i<N; i++) {
            int r, w; tie(r, w) = books[i];
            for(int j=0; j<=1000; j++) {
                if(!dp[i][j]) continue;
                dp[i+1][j] |= dp[i][j];
                if(j + r <= 1000) dp[i+1][j+r] |= dp[i][j];
                if(j + r + w <= 1000) dp[i+1][j+r+w] |= dp[i][j];
            }
        }

        int ans = 1 << 29, s = read_sum - r0 + write_sum;
        for(int i=0; i<=r0; i++) {
            if(!dp[N][i]) continue;
            ans = min(ans, 2*r0 + s - i);
        }
        printf("%d\n", ans);
    }
    return 0;
}

int main() {
    while(!solve_testcase());
    return 0;
}



Measured memory_bytes: 4200
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
//#include <bits/stdc++.h>
#include <cassert>
using namespace std;

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;


const int maxn = 1e5+1;
int d[maxn];
int k;
priority_queue<ii, vector<ii>, greater<ii> > pq;
inline void up(int x, int y)
{
    if (d[x] == -1 || d[x] > y)
    {
        d[x] = y;
        pq.push(mp(y, x));
    }
}
int main()
{
    memset(d, -1, sizeof(d));
    scanf("%d", &k);
    for (int i = 1; i <= 9; ++i)
        up(i%k, i);
    for (;;)
    {
        assert(pq.size());
        ii cur = pq.top();
        pq.pop();
        swap(cur.first, cur.second);
        if (cur.first == 0)
            break;
        if (d[cur.first] != cur.second)
            continue;
        for (int i = 0; i <= 9; ++i)
            up((cur.first*10+i)%k, cur.second+i);
    }
    printf("%d\n", d[0]);
}


Measured memory_bytes: 2804
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int h = scan.nextInt();
    int n = scan.nextInt();

    int[] a = new int[n];
    int[] b = new int[n];

    for (int i=0;i<n;i++){
      a[i] = scan.nextInt();
      b[i] = scan.nextInt();
    }

    long[] c = new long[h+1];
    Arrays.fill(c,Integer.MAX_VALUE);
    c[0] = 0;
    for (int i=0;i<h;i++){
      for (int j=0;j<n;j++){
        int target = i + a[j];
        if (target > h){
          target = h;
        }
        c[target] = Math.min(c[target], c[i] + b[j]);
      }
    }

    System.out.println(c[h]);


  }

}


Measured memory_bytes: 39784
#include <stdio.h>
#include<math.h>
int main(void)
{
 double a,b,c,d;
 double e;
 scanf("%lf%lf%lf%lf",&a,&b,&c,&d);

 e=(a-c)*(a-c)+(b-d)*(b-d);
 e=sqrt(e);

 printf("%f",e);
 return 0;
} 


Measured memory_bytes: 2108
let fifty s =
  if s.[0] = s.[1] && s.[2] = s.[3] && s.[0] <> s.[2] then "Yes"
  else if s.[0] = s.[2] && s.[1] = s.[3] && s.[0] <> s.[1] then "Yes"
  else if s.[0] = s.[3] && s.[1] = s.[2] && s.[0] <> s.[1] then "Yes"
  else "No"

let () = Printf.printf "%s\n" (fifty (read_line ()))


Measured memory_bytes: 3532
n, m = map(int, input().split())
h = list(map(int, input().split()))

tmp = [1] * n

ab = [map(int, input().split()) for _ in range(m)]
a, b = [list(i) for i in zip(*ab)]

for i in range(m):
    if h[a[i] - 1] > h[b[i] - 1]:
        tmp[b[i] - 1] = 0
    elif h[a[i] - 1] < h[b[i] - 1]:
        tmp[a[i] - 1] = 0
    else:
        tmp[a[i] - 1] = 0
        tmp[b[i] - 1] = 0

print(sum(tmp))

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

template <typename T>
class stack{
  T a[101];
  unsigned n;
public:
  stack():a(),n(0){}
  T& top(){return a[n-1];}
  void pop(){n--;}
  void push(T in){a[n]=in;n++;}
};

int main(){
  stack<int> s;
  char buf[100];

  while(std::cin >> buf){
    int a;
    switch(buf[0]){
      case '+' : a = s.top();s.pop();s.top() += a;break;
      case '-' : a = s.top();s.pop();s.top() -= a;break;
      case '*' : a = s.top();s.pop();s.top() *= a;break;
      default : s.push(atoi(buf));
    }
  }
  std::cout << s.top() << std::endl;
}

Measured memory_bytes: 1148
#include<iostream>
#include<algorithm>
#include<string>
#include <bitset>
#include<string.h>
using namespace std;

int main(){
    char s[100000];
    cin >> s;
    int ans1=0,ans2=0;
    int l=strlen(s);
    //long long int S = stoi(s,nullptr,2);

    if(s=="0"||s=="1"){
        cout << 0 << endl;
    }
    char a[100000];
    char b[100000];
    for(int i=0;i<l;i++){
        if(i%2==0){
            a[i] ='1';
            b[i] ='0';
        }else{
            a[i] ='0';
            b[i] ='1';
        }
        //rui *=2;
    }

/*
    long long int a=0,b=0,rui=1;
    for(int i=0;i<l;i++){
        if(i%2==0){
            a += rui;
        }else{
            b += rui;
        }
        rui *=2;
    }

    ans1=__builtin_popcount(a ^ S);
    ans2=__builtin_popcount(b ^ S);*/
    /*
    for(int i=0;i<l;i++){
        if(i%2==0)b[i]='1';
        else b[i]='0';
    }
    */
    for(int i=0;i<l;i++){
        if(s[i]!=a[i]){
            ans1++;
        }
    }
    for(int i=0;i<l;i++){
        if(s[i]!=b[i]){
            ans2++;
        }
    }
    if(ans1<=ans2)cout << ans1 << endl;
    else cout << ans2 << endl;
}

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

using namespace std;

int A[101010];
int n;

int gcd(int a, int b) { for(; a; swap(a, b)) b %= a; return b; }

bool check()
{
	int i, s1, s2, g;
	
	s1 = 0; s2 = 0;
	
	for(i=0; i<n; i++){
		s1 += (A[i] & 1);
		s2 += (A[i] == 1);
	}
	
	if(s1 + n & 1) return 1;
	else if(s1 != 1 || s1 == s2) return 0;
	else{
		g = 0;
		
		for(i=0; i<n; i++){
			if(A[i] & 1) A[i] --;
			g = gcd(g, A[i]);
		}
		
		for(i=0; i<n; i++){
			A[i] /= g;
		}
		
		return !check();
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int i;
	
	cin >> n;
	
	for(i=0; i<n; i++){
		cin >> A[i];
	}
	
	cout << (check()? "First" : "Second") << endl;
	
	return 0;
}

Measured memory_bytes: 640
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#endif

const double PI = 3.1415926535897932384626433;
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

void solve() {
	cini(n);
	cinai(a, n);

	int ans = 0;
	int cur = 1;
	for (int i = 0; i < n; i++) {
		if (a[i] != cur)
			ans++;
		else
			cur++;
	}
	if (cur == 1) {
		cout << -1 << endl;
	} else {
		cout << n + 1 - cur << endl;
	}
}

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



Measured memory_bytes: 1024
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define PB push


#define MOD 1000000009LL
#define EPS 1e-8

int dp[ 100001 ];

int main()
{
	int N;
	cin >> N;
	int nums[ 3 ] = { 1, 6, 9 };
	REP( i, N + 1 ) dp[ i ] = 1 << 30;
	dp[ 0 ] = 0;
	REP( i, N + 1 )
	{
		REP( j, 3 )
		{
			REP( k, N + 1 )
			{
				int num = i + pow( nums[ j ], k );

				if( num > N ) break;

				dp[ num ] = min( dp[ num ], dp[ i ] + 1 );

				if( nums[ j ] == 1 ) break;
			}
		}
	}
	cout << dp[ N ] << endl;
	return 0;
}


Measured memory_bytes: 640
#create date: 2020-04-19 21:10

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n, k = na()
    ans = 0
    for s in range(k, n+2):
        mmin = (0+s-1)*s//2
        mmax = (n-s+1+n)*s//2
        ans += mmax - mmin + 1
        #print(s, mmax, mmin)
    print(ans%(10**9+7))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9176
#include <iostream>
#include <algorithm>
using namespace std;
int n; 
int arr[105];
int main() {
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	double res = arr[0];

	for (int i = 1; i < n; i++) {
		res = (res + arr[i]) / 2;
	}

	cout << res;



	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var line = consoleReader.SplitInt32();
            var N = line[0];
            var K = line[1];

            return N - K + 1;
        }

        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc());
        public static string MultiLine<T>(IEnumerable<T> source) => string.Join("\n", source);
    }

    public class ConsoleReader
    {
        public virtual string String() => Console.ReadLine(); public int Int32() => int.Parse(String()); public long Int64() => long.Parse(String()); public ulong UInt64() => ulong.Parse(String()); public double Double() => double.Parse(String()); public string[] Split() => String().Split().ToArray(); public int[] SplitInt32() => String().Split().Select(int.Parse).ToArray(); public long[] SplitInt64() => String().Split().Select(long.Parse).ToArray(); public ulong[] SplitUInt64() => String().Split().Select(ulong.Parse).ToArray(); public double[] SplitDouble() => String().Split().Select(double.Parse).ToArray(); public IEnumerable<string> Repeat(int count) { for (int i = 0; i < count; i++) yield return String(); }
        public IEnumerable<int> RepeatInt32(int count) { for (int i = 0; i < count; i++) yield return Int32(); }
        public IEnumerable<long> RepeatInt64(int count) { for (int i = 0; i < count; i++) yield return Int64(); }
        public IEnumerable<string[]> RepeatSplit(int count) { for (int i = 0; i < count; i++) yield return Split(); }
        public IEnumerable<int[]> RepeatSplitInt32(int count) { for (int i = 0; i < count; i++) yield return SplitInt32(); }
    }
}


Measured memory_bytes: 13268
N = int(input())
A, B = [0] * N, [0] * N
for i in range(N):
    a, b = map(int, input().split())
    A[i], B[i] = a, b
A.reverse()
B.reverse()

ans = 0
for i in range(N):
    mod = (A[i]+ans) % B[i]
    if mod:
        ans += B[i] - mod

print(ans)


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

#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N = 2000001;
int arr[N];
int main()
{
    fast_io;
    int n ;
    cin >> n ;
    for(int i = 0; i < n ; i++)
    {
        cin >> arr[i];
    }
    int cnt = 1;
    for(int i = 0 ; i < n - 1 ; i++)
    {
        if(arr[i] > arr[i + 1])
        {
            cnt ++;
        }
        else
        {
            arr [i+1] = arr[i];
        }
    }
    cout << cnt << "\n";

}


Measured memory_bytes: 4392
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;


namespace AtCoderWorkspace
{
    class Program
    {
        static void Main(string[] args)
        {
            var cin = new Scanner();
            var N = cin.nextLong();

            long[] A = new long[N+1];
            for (int i = 0; i < N+1; i++)
            {
                A[i] = cin.nextLong();
            }
            long[] B = new long[N];
            for (int i = 0; i < N; i++)
            {
                B[i] = cin.nextLong();
            }

            long count = 0;
            for (long i = N-1; 0 <= i; i--)
            {
                var power = B[i];

                if(A[i+1] <= power)
                {
                    // 次の街の敵をすべて倒せるとき
                    count += A[i + 1];
                    var amariPower = power - A[i + 1];

                    if(A[i] <= amariPower)
                    {
                        // 残りの力で今の街をすべて倒せるとき
                        count += A[i];
                        A[i] = 0;
                    }
                    else
                    {
                        // 残りの力で今の街をすべて倒せないとき
                        count += amariPower;
                        A[i] -= amariPower;
                    }
                }
                else
                {
                    // 次の街の一部分を倒せるとき
                    count += power;
                }
            }

            Console.WriteLine(count);
        }
    }





    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);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

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

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

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


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}


Measured memory_bytes: 31712
#include<bits/stdc++.h>
#define LL long long
#define maxn 201900
#define mod 1000000007
using namespace std;
LL fun[maxn],ans=1;
LL power(LL a,int k)
{
    LL ans=1,y=a;
    while(k)
	{
        if(k%2)
        ans=ans*y%mod;
        
		y=y*y%mod,k=k/2;
    }
    return ans;
}
int main()
{
    long long n,m;
    scanf("%lld%lld",&n,&m);
    fun[0]=1;
    for(int i=1;i<maxn;i++)
	fun[i]=fun[i-1]*i%mod;
    
    for(int i=2;i*i<=m;i++)
	{
        if(m%i==0)
		{
            long long s=0;
            while(m%i==0) 
			{
                m=m/i;
                s++;
            }
            ans=ans*fun[n+s-1]%mod*power(fun[n-1],mod-2)%mod*power(fun[s],mod-2)%mod;
        }
    }
    if(m>1)
    ans=ans*n%mod;
    printf("%lld\n",ans);
    
    return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e16 + 5);

const int MAX_N = (int)(2e5 + 5);

int n;
ll a[MAX_N];

ll acc[MAX_N];

ll ans;

// (l, r]
pair<ll, ll> find_divide(int l, int r) {
  // printf("range: %d %d, ", l, r);

  ll whole = acc[r] - acc[l];

  ll target = whole / 2;  // around;

  // printf("whole: %lld, target: %lld, ", whole, target);

  int index = lower_bound(acc + l + 1, acc + r, acc[l] + target) - acc;

  // printf("index: %d, ", index);

  ll diff = INF;

  ll left = 0LL;
  ll right = 0LL;

  // printf("[bein: %d, end: %d], ", max(index - 20, l + 1), min(index + 20, r));

  for (int i = max(index - 20, l + 1); i <= min(index + 20, r); ++i) {
    ll tmp_left = acc[i] - acc[l];
    ll tmp_right = acc[r] - acc[i];

    if (abs(tmp_left - tmp_right) < diff) {
      diff = abs(tmp_left - tmp_right);
      left = tmp_left;
      right = tmp_right;
    }
  }

  // printf("left: %lld, right: %lld, ", left, right);

  // printf("\n");

  return make_pair(left, right);
}

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &(a[i]));
  }

  for (int i = 1; i <= n; ++i) {
    acc[i] = acc[i - 1] + a[i];
  }

  ans = INF;

  for (int i = 3; i <= n; ++i) {
    if ((n - i + 1) < 2) continue;

    auto left_pair = find_divide(0, i - 1);
    auto right_pair = find_divide(i - 1, n);

    ll min_block =
        min(min(min(left_pair.first, left_pair.second), right_pair.first),
            right_pair.second);
    ll max_block =
        max(max(max(left_pair.first, left_pair.second), right_pair.first),
            right_pair.second);

    ans = min(ans, abs(max_block - min_block));
  }

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 3328
#include<stdio.h>
int main(void)
{
	int n,x,m,min,cnt,i;
	scanf("%d%d",&n,&x);
	min=1001; cnt=0;
	for(i=0;i<n;i++){
		scanf("%d",&m);
		if(min>m) min=m;
		x-=m; cnt++;
	}
	cnt+=x/min;
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 128
n = int(input())
a = [int(i) for i in input().split()]

ans = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if a[i]!=a[j] and a[i]!=a[k] and a[k]!=a[j]:
                if a[i]<a[j]+a[k] and a[j]<a[i]+a[k] and a[k]<a[j]+a[i]:
                    ans += 1
print(ans)
            
            

Measured memory_bytes: 9140
sx,sy,gx,gy=map(int,input().split())
dx,dy=gx-sx,gy-sy
print('U'*dy+'R'*dx+'D'*dy+'L'*dx
      +'L'+'U'*(dy+1)+'R'*(dx+1)+'D'
      +'R'+'D'*(dy+1)+'L'*(dx+1)+'U')

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

int main(){
    int k,a,b;
    bool flag = false;
    cin >> k >> a >> b;
    for(int i = a; i <= b; i++){
        if(i % k == 0){
            flag = true;
            break;
        }
    }
    if(flag){
        cout << "OK" << endl;
    }else{
        cout << "NG" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
local a, b, c = string.match(io.read(), "(%d+) (%d+) (%d+)");
local x = {
  tonumber(a),
  tonumber(b),
  tonumber(c),
};

table.sort(x);

print(math.abs(x[2] - x[1]) + math.abs(x[3] - x[2]));

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

int main()
{
	int n;
    cin>>n;
    
    vector<string> v;
    map<string,int> mp;
    int m=INT_MIN;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        
        v.push_back(s);
        mp[s]++;
        m=max(m,mp[s]);
        
    }
    
    for(auto i:mp)
    {
        if(i.second==m)
        {
            cout<<(i.first)<<endl;
        }
    }    
    
	return 0;
}

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

const int inf = 1e9;
const ll linf = 1e18;

int main()
{
    int n, h; cin >> n >> h;
    int amax = 0;
    priority_queue<int> bq;
    for (int i = 0; i < n; i++) {
        int a, b; cin >> a >> b;
        amax = max(amax, a);
        bq.push(b);
    }

    int ans = (h + amax - 1) / amax;
    int cnt = 1;
    while (!bq.empty()) {
        int b = bq.top(); bq.pop();
        h -= b;
        if (h <= 0) {
            ans = min(ans, cnt); break;
        } else {
            ans = min(ans, cnt + ((h + amax - 1) / amax));
        }
        cnt++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 892
n,m=map(int,input().split())
p=[0]*m
s=[0]*m
for i in range(m):
    pi,si=input().split()
    p[i]=int(pi)
    s[i]=si
judge=[0]*(n+1)
ac=0
wa=0
for i in range(m):
    if judge[p[i]]==-1:
        continue
    if judge[p[i]]!=-1:
        if s[i]=='WA':
            judge[p[i]]+=1
        else:
            wa+=judge[p[i]]
            judge[p[i]]=-1
            ac+=1
print(ac,wa)

Measured memory_bytes: 20756
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bn begin()
#define en end()
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007LL
#define pi 3.141592653589
using namespace std;

int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
    quickie
    string s ;
    cin >> s ;
    cout << s[0] << s[1] <<s[2] << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

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


Measured memory_bytes: 3608
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int a, b, c; cin >> a >> b >> c;
	if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1)cout << 0 << endl;
	else
	{
		int cnt = 0;
		while (!(a == b && b == c) && !(a % 2 == 1 || b % 2 == 1 || c % 2 == 1))
		{
			++cnt;
			int tmpA = b / 2 + c / 2;
			int tmpB = a / 2 + c / 2;
			int tmpC = a / 2 + b / 2;
			a = tmpA, b = tmpB, c = tmpC;
		}
		if (a % 2 == 0 && (a == b && b == c))cout << -1 << endl;
		else cout << cnt << endl;
	}
}

Measured memory_bytes: 256
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include "bits/stdc++.h"

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define deb(x) cerr << (#x) << " is " << (x) << '\n'

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef long long lint;
typedef double ld;

template<class T> bool chmin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool chmax(T &a, T b) { return a < b ? (a = b, true) : false; }

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

	int s, n;
	cin >> s >> n;
	int sum = 0;
	forn(i, n){
		int x;
		cin >> x;
		sum += x;
	}
	if(sum > s)cout << -1;
	else cout << s - sum;
	return 0;               
}
// Write Here
	


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

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

    for(int i = 1; i <= N; i++){
        int ans = 0;
        for (int x = 1; x <= 100; x++){
            int tmp = x * x;
            if (tmp >= i) break;
            for (int y = 1; y <= 100; y++){
                tmp = x*x + y * y + x*y;
                if (tmp >= i) break;
                for (int z = 1; z <= 100; z++){
                    tmp = x*x + y*y + z*z + x*y + y *z + x*z;
                    if (tmp > i){
                        break;
                    }
                    else if (tmp == i) ans++;
                }
            }
        }
        cout << ans << endl;

    }


}


Measured memory_bytes: 3616
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll k, x;
    cin >> k >> x;
    if (k * 500 >= x) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
use std::collections::*;
use std::cmp::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        s: chars,
    }

    let mut res = 1;
    res *= s.iter().filter(|&x| *x == 'R').count();
    res *= s.iter().filter(|&x| *x == 'G').count();
    res *= s.iter().filter(|&x| *x == 'B').count();

    for i in 1..n-1 {
        for j in i..n {
            let k = j + j - i;
            if k > n {
                break;
            }
            if s[i-1] != s[j-1] && s[j-1] != s[k-1] && s[k-1] != s[i-1] {
                res -= 1;
            }
        }
    }


    println!("{}", res);
}


Measured memory_bytes: 2144
#include <iostream>

using namespace std;

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

    int tmp;
    if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    if (b > c) {
        tmp = b;
        b = c;
        c = tmp;
    }
    if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }

    cout << a << " " << b << " " << c << endl;

    return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
using namespace std;

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

// マクロ
#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; itr++)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; i--)
#define reprev(itr, end) reprrev(i, 0, end)
#define all(container) container.begin(), container.end()
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX 9223372036854775807i64
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };
struct edge { ll to; ll cost; };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
    for (T& x : vec) os << x << " ";
    return os;
}

// ***<ここから>****************************************************************


int main(void) {

    int a, b;

    cin >> a >> b;

    if (a + b == 15) cout << "+" << endl;
    else if (a * b == 15) cout << "*" << endl;
    else cout << "x" << endl;   
 
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		
		int[] v = new int[n];
		Arrays.fill(v, -1);
		
		
		for(int i = 0; i < m; i++) {
			int s = stdIn.nextInt()-1;
			int c = stdIn.nextInt();
			
			if(v[s] < 0) {
				v[s] = c;
			}else if(v[s] != c) {
				System.out.println("-1");
				return;
			}
	
		}
		
		if(n > 1 && v[0] == 0) {
			System.out.println("-1");
			return;
		}
		
		for(int i = 0; i < n; i++) {
			if(v[i] >= 0) {
				System.out.print(v[i]);
			}else {
				if(i==0) {
					if(n == 1) {
						System.out.print("0");
					}else {
						System.out.print("1");
					}
				}else {
					System.out.print("0");
				}
				
				
				
				
			}
			
			
			
		}
		
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>

#define IO std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);

#define MOD 1000000007
#define ull unsigned long long int
#define ll  long long int
#define MAX 100005

using namespace std;

void solve(vector<int> vet, int b, int soma) {
    double calc=(1/(4.*b))*soma;
    for(int i=0; i<b; i++) {
        if(vet[i]<calc) {
            puts("No");
            return;
        }
    }
    puts("Yes");
    return;
}

int main() {

    //IO
    //freopen("entrada.txt", "r", stdin);

    int a, b, n, i, x;

    cin >> a >> b;

    int soma=0;
    vector<int> vet;

    for(i=0; i<a; i++) {
        cin >> x;
        soma+=x;
        vet.push_back(x);
    }

    sort(vet.rbegin(), vet.rend());

    solve(vet, b, soma);

    return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N=int(input())
Nstr=str(N)
ans=0
if len(Nstr)%2==0:
    for i in range(1,len(Nstr),2):
        if i==1:
            ans=ans+9
        else:
            ans=ans+10**(i)-10**(i-1)
else:
    for i in range(1,len(Nstr),2):
        if i==1:
            ans=ans+9
        else:
            ans=ans+10**(i)-10**(i-1)
    ans=ans+N-10**(len(Nstr)-1)+1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

string s[410];
int used[410][410];
int h,w;

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

ll black,white;

void dfs(int x,int y,int col){
  used[x][y]=col;
  if(s[x][y]=='#') black++;
  else white++;

  for(int i=0;i<4;i++){
    int nx=x+dx[i];
    int ny=y+dy[i];
    if(nx<0||ny<0||nx>=h|ny>=w) continue;
    if(used[nx][ny]!=0) continue;
    if(col==1){
      if(s[nx][ny]=='#') dfs(nx,ny,-col);
    }else{
      if(s[nx][ny]=='.') dfs(nx,ny,-col);
    }
  }
}

int main(){
  //int h,w;
  cin>>h>>w;

  for(int i=0;i<h;i++){
    cin>>s[i];
  }


  ll ans=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(used[i][j]==0&&s[i][j]=='#'){
        dfs(i,j,-1);
        ans=ans+black*white;
        black=0;
        white=0;
      }
    }
  }

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


Measured memory_bytes: 16128
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();

		char array[] = str.toCharArray();
		for(int i=0; i < array.length; i++){
			if(array[i] == ' ' || array[i] == '.')
				System.out.print(array[i]);
			else{
				array[i] += 'A'-'a';
				System.out.print(array[i]);
			}
		}

		System.out.println();
	}

}

Measured memory_bytes: 17136
#include<iostream>
#include<string>
using namespace std;
 
int main(){
     
    string abc;
    int m,h;
     
    while (1){
        cin >> abc;
        if (abc=="-") break;
        cin >> m;
        for (int i=0; i<m; i++){
            cin >> h;
            abc = abc.erase(0,h)+abc.substr(0,h);
        }
        cout << abc << endl;
    }
    return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define vint vector<int>
signed main(){
  int N,M,O=0,P=0,count=0,count2=0;
  str S,W,T;
  cin>>N>>M;
  vint m(N);
  rep(0,N){
    cin>>m.at(i);
    M-=m.at(i);
  }
  sort(all(m));
  cout<<N+M/m.at(0)<<endl;
}


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

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	int min_a = 1e8;
	int max_a = -min_a;
	int maxi, mini;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		if (max_a < a[i]) {
			max_a = a[i];
			maxi = i;
		}
		if (min_a > a[i]) {
			min_a = a[i];
			mini = i;
		}
	}

	int add = max_a;
	int it = maxi;
	if (max_a < abs(min_a)) {
		add = min_a;
		it = mini;
	}
	vector<vector<int>> res(2);
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		res[0].push_back(it + 1);
		res[1].push_back(i + 1);
		cnt++;
	}

	if ((min_a >= 0) || (add > 0)) {
		for (int i = 2; i <= N; i++) {
			res[0].push_back(i - 1);
			res[1].push_back(i);
			cnt++;
		}
	} else if ((max_a <= 0) || (add < 0)) {
		for (int i = N - 1; i >= 1; i--) {
			res[0].push_back(i + 1);
			res[1].push_back(i);
			cnt++;
		}
	}

	cout << cnt << endl;
	for (int i = 0; i < cnt; i++) {
		cout << res[0][i] << " " << res[1][i] << endl;
	} 

	return 0;
}


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

int main() {
  int counter = 0;
  int N;
  cin >> N;
  vector<int> data(N);
  for (int i=0; i<N; i++) {
    cin >> data[i];
  }
  sort(data.begin(),data.end());
  cout << data[N/2]-data[N/2-1];
}

Measured memory_bytes: 3744
include Math

class Main
  def self.main lines
    a,b = lines[0].split.map(&:to_i)
    
    return 0 if a == 0 && b == 0

    [*(0..(log2(b).floor))]
      .map {|k| self.y(a, b, k)}
      .reverse
      .join
      .to_i(2)
  end

  def self.y a, b, k
    s = 2**k
    c = 0
    
    an = self.pos(a, k)
    c -= an if a[k] == 1 # move to 0
    bn = self.pos(b, k)
    c += bn+1 if b[k] == 1 # move to 0

    c += ((b / (s * 2)) - (a / (s * 2))) * s

    c % 2
  end

  def self.pos x, k
    x % 2**k
  end
end

if $0 == __FILE__
  $stdout = open('/dev/null', 'w')
  r = Main.main STDIN.readlines
  $stdout = STDOUT
  puts r
end

Measured memory_bytes: 2044
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpi(x1) fprintf(stderr, "#%s.%d (%s) = (%d)\n", __func__, __LINE__, #x1, x1);
#define dumpii(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%d, %d)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpiii(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%d, %d, %d)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator > (long&& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  long a, b, c, d;
  Solver() {
    S002 r;
    r >= a >= b >= c >= d;
  }
  void solve() {
    long res = std::max(a * b, c * d);
    printf("%ld\n", res);
  }
};
 
int main() {
  for(;;) std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PREP(i, s, x) for(ll i = (s); i < (x); i++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i--)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }

// variable -------------------------------------------

constexpr ll INF = (1ll << 59);
constexpr ll MOD = 1000000007ll;

// structure ------------------------------------------

// function -------------------------------------------

// main -----------------------------------------------

int main() {
	ll d, t, s;
	cin >> d >> t >> s;

	if(t * s >= d){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

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


def next_line():
    return input()


def next_int():
    return int(input())


def next_int_array_one_line():
    return list(map(int, input().split()))


def next_int_array_multi_lines(size):
    return [int(input()) for _ in range(size)]


def next_str_array(size):
    return [input() for _ in range(size)]


def main():
    a = next_line()
    if 'A' <= a[0] and a[0] <= 'Z':
        print("A")
    else:
        print("a")


if __name__ == '__main__':
    main()


Measured memory_bytes: 61972
ll = [int(input()) for i in range(5)]

def calc_time(ll,idxlist):
	time = 0
	for _ in range(4):
		time += ll[idxlist[_]]
		while time % 10 != 0:
			time += 1
	time += ll[idxlist[4]]
	return time

time_min = 10**(3)
for i in range(5):
	for j in range(5):
		if i == j:
			continue
		for k in range(5):
			if j == k or i == k:
				continue
			for l in range(5):
				if k == l or j == l or i == l:
					continue
				for m in range(5):
					if l == m or k == m or j == m or i == m:
						continue
					time = calc_time(ll,[i,j,k,l,m])
					if time < time_min:
						time_min = time
print(time_min)


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

int main(){
	int a,b,ca,cb,n;
	while(cin>>n,n){
		a=0,b=0;
		for(int i=0;i<n;i++){
			cin>>ca>>cb;
			if(ca>cb)a+=(ca+cb);
			else if(ca<cb)b+=(ca+cb);
			else{
				a+=ca;
				b+=cb;
			}
		}
		cout<<a<<' '<<b<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,k,a;
    cin>>n>>m>>k;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            a=i*m;
            a+=j*n;
            a-=j*i*2;
            if(k==a){
                cout<<"Yes"<<endl;
                return(0);
            }
        }
    }
    cout<<"No"<<endl;
    return(0);
}

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

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

	int a, b, c, d;

	scanf("%d %d %d %d", &a, &b, &c, &d);

	a = a > c ? a : c;
	b = b > d ? d : b;

	int ret = b-a > 0 ? b-a : 0;

	printf("%d\n", ret);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int x, a, b;
  cin >> x >> a >> b;
  if (b <= a)
    cout << "delicious" << endl;
  else if (b - a <= x)
    cout << "safe" << endl;
  else
    cout << "dangerous" << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	var sum int = 0
	W := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &W[i])
		sum += W[i]
	}

	var S1, S2 int
	var min int = 10000
	for T := 1; T < N; T++ {
		S1 = 0
		S2 = 0
		for i := 0; i < T; i++ {
			S1 += W[i]
		}
		S2 = sum - S1

		if min >= int(math.Abs(float64(S1)-float64(S2))) {
			min = int(math.Abs(float64(S1) - float64(S2)))
		}
	}

	fmt.Println(min)
}


Measured memory_bytes: 1844