akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define lli long long
using namespace std ;
lli knapsack(vector<vector<lli>> &item,lli n,lli w,vector<vector<lli>> &dp){
    if(dp[n][w]==-1){
        if(n==0){
            if(w>=item[n][0]) dp[n][w] = item[n][1] ;
            else dp[n][w] = 0 ;// cout << dp[n][w] << " " ;        
        }
        else{
            if(w>=item[n][0]) dp[n][w] = max(item[n][1]+knapsack(item,n-1,w-item[n][0],dp),knapsack(item,n-1,w,dp)) ;
            else dp[n][w] = knapsack(item,n-1,w,dp) ;
        }
    }
    return dp[n][w] ;
}
int main(){
    lli n , w , i ;
    cin >> n >> w ;
    vector<vector<lli>> item(n,vector<lli>(2,0)) ;
    for(i=0;i<n;++i) cin >> item[i][0] >> item[i][1] ;
    vector<vector<lli>> dp(n,vector<lli>(w+1,-1)) ;
    cout << knapsack(item,n-1,w,dp) << "\n" ;
    return 0 ;
}

Measured memory_bytes: 79488
#include <iostream>

using namespace std;

int main()
{
int x,y;
for(int i=1;i<=100;i++)
{cin >> x >> y;
if(x!=0)
{
for(int a=1;a<=y;a++)
{cout << "#";}
for(int c=1;c<=x-2;c++)
{
cout << endl << "#";
for(int b=1;b<=y-2;b++)
{cout << ".";}
cout << "#";
}
cout << endl;
for(int a=1;a<=y;a++)
{cout << "#";}
cout << endl << endl;
}
}
}


Measured memory_bytes: 3068
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import java.text.*;
public class Main{
   
    static PrintWriter w=new PrintWriter(System.out);
    public static void main(String [] args){
        DecimalFormat dm=new DecimalFormat("0.000000");
        Scanner sc=new Scanner(System.in);
//        int t=sc.nextInt();
//    	 while(t-->0){
//    	     int n=sc.nextInt();
//    	     int arr[]=new int[n];
//    	     for(int i=0;i<n;i++){
//    	         arr[i]=sc.nextInt();
//    	     }
//    	     int or[][]=new int[n+1][2];
//    	     for(int i=0;i<n-1;i++){
//    	         or[i][0]=arr[i];
//    	         or[i][1]=arr[i+1];
//    	     }
//    	     long sum=0;
//    	     for(int j=n-1;j>=2;j--){
//    	         long min=Long.MAX_VALUE;
//    	         int index=0;
//    	         for(int i=0;i<j-1;i++){
//    	             if(or[i][0]*or[i+1][1]<min){
//    	                 min=or[i][0]*or[i+1][1];
//    	                 index=i;
//    	             }
//    	         }
//    	         sum+=((long)or[index][0]*or[index][1]*or[index+1][1]);
//    	         or[index][1]=or[index+1][1];
//    	         for(int i=index+1;i<n-1;i++){
//    	             or[i][0]=or[i+1][0];
//    	             or[i][1]=or[i+1][1];
//    	         }
//    	     }
//    	     System.out.println(sum);
int n=sc.nextInt();
    int arr[]=new int[n];
    for(int i=0;i<n;i++){
      arr[i]=sc.nextInt();
    }
    int dp[]=new int[n];
    Arrays.fill(dp,Integer.MAX_VALUE);
    dp[0]=0;
    for(int i=0;i<n-1;i++){
     	dp[i+1]=Math.min(dp[i]+Math.abs(arr[i+1]-arr[i]),dp[i+1]);
      	if(i>=n-2)
          continue;
      	dp[i+2]=Math.min(dp[i]+Math.abs(arr[i+2]-arr[i]),dp[i+2]);
    }
    System.out.println(dp[n-1]);
    	 
        w.close();
    }
}

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

int w[101],n;
ll v[101];

map <pair<int,int>, ll > mp;
ll max1(ll a,ll b)
{
	return((a>b)?a:b);
}

int main()
{
	int i,W,j;
	cin>>n>>W;
	for(i=1;i<=n;i++)
	{
		cin>>w[i]>>v[i];
	}
	ll dp[n+1][W+1];
	for(i=0;i<=n;i++)dp[i][0]=0;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=W;j++)
		{
			if(i==1)
			{
				if(w[i]<=j)
				{
					dp[i][j]=v[i];
				}
				else dp[i][j]=0;
			}
			else
			{
				if(w[i]<=j)
				dp[i][j]=max1(dp[i-1][j-w[i]]+v[i],dp[i-1][j]);
				else dp[i][j]=dp[i-1][j];
			}
		}
	}
	cout<<dp[n][W];
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n,x) for(int i=(n);i<(x);++i)
#define rem(i,n,x) for(int i=(n);i>=(x);--i)
#define pb push_back
#define setp(x) setprecision(x)
using ll = long long;

int main() {
	double a, b, x; cin >> a >> b >> x;
	
  	double ans = 0.0, num = a * a * b - x;
	if (0 <= num && num <= a * a * b / 2.0) {
		double c = num / (a * a / 2);
		ans = atan(c / a) / M_PI * 180;
	}
	else {
      	double c = x / (a * b / 2.0);
		ans = 90.0 - atan(c / b) / M_PI * 180;
	}
	
	cout << fixed << setp(10) << ans << endl;

	return 0;
}

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

int main(){
    int k,s;
    int count = 0;
    cin >> k >> s;
    for (int i = 0; i < k+1; i++){
        for (int j = 0; j < k+1; j++){
            if(s - i - j <= k && s - i - j >= 0){
                count++;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define x real()
#define y imag()
#define fi first
#define se second
#define pii pair<int, int>

const int N = 3010;
double dp[N][N];

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int n;
	cin >> n;
	double p[n + 1];
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
	}
	dp[1][1] = p[1];
	dp[1][0] = 1 - p[1];
	for (int i = 2; i <= n; i++) {
		dp[i][0] = dp[i - 1][0] * (1 - p[i]);
		for (int j = 1; j <= i; j++) {
			dp[i][j] = dp[i - 1][j] * (1 - p[i]) + dp[i - 1][j - 1] * p[i];
		}
	}
	double ans = 0;
	for (int i = n; 2 * i > n; i--) {
		ans += dp[n][i];
	}
	cout << setprecision(10) << fixed << ans << "\n";
}



Measured memory_bytes: 139776
import java.util.*;
public class Main {
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		Deque<Integer> deque = new ArrayDeque<>();
		for(int i = 0;i < n; ++i){
			if (i%2 != 0){
				deque.addLast(Integer.parseInt(scan.next()));
			}else{
				deque.addFirst(Integer.parseInt(scan.next()));
			}
		}

		if (n%2 == 0){
			for(int i = 0; i < n; ++i){
				System.out.print(deque.getLast()+" ");
				deque.removeLast();
			}
		}else{
			for(int i = 0; i < n; ++i){
				System.out.print(deque.getFirst()+" ");
				deque.removeFirst();
			}
		}



	}
}
//end


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

int main() {
  int H,N;
  cin >> H;
  cin >> N;
  vector<int> A(N);
  int ans=0;
  for (int i=0; i<N; i++){
   cin >> A.at(i);
   ans=ans+A.at(i);
  }
  if (H>ans) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int a;
	while(scanf("%d",&a)!=EOF)
	{
		string temp;
		cin >> temp;
		int b;
		scanf("%d",&b);
		b--;
		for(int i=0; i<a; i++){
			if(temp[i] != temp[b]) temp[i] = '*';	
		}
		cout << temp << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N, M, a, b, c;
    cin >> N >> M;
    auto d = make_v<int>(N, N), d2 = d;
    fill_v(d, INT_MAX / 2);
    vvint graph(N);
    vector<pair<int, int>> edges(M);
    vint A(M), B(M), C(M);
    for (size_t i = 0; i < M; i++)
    {
        cin >> a >> b >> c;
        a--;
        b--;
        A[i] = a;
        B[i] = b;
        C[i] = c;
        edges[i] = {a, b};
        d[a][b] = c;
        d[b][a] = c;
        d2[a][b] = d2[b][a] = c;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    for (size_t i = 0; i < N; i++)
    {
        d[i][i] = 0;
    }

    for (int k = 0; k < N; k++)
    {
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < N; j++)
            {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    int ans = M;
    for (size_t i = 0; i < M; i++)
    {
        for (size_t s = 0; s < N; s++)
        {
            for (size_t t = 0; t < N; t++)
            {
                if (d[s][t] == d[s][A[i]] + C[i] + d[B[i]][t])
                {
                    ans--;
                    goto L;
                }
            }
        }
    L:;
    }
    cout << ans << endl;
    return 0;
}

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

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

	int ans = -1;
  for (int i = 1; i <= 1000; i++) {
		if (i * 8/100 == a && i * 10/100 == b) {
			ans = i;
			break;
		}
	}

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

Measured memory_bytes: 256
/*
    AUTHOR:shivam51
    IIESTS
*/
  #include<bits/stdc++.h>
  using namespace std;
  //
  #define add accumulate
  #define ll long long int
  #define ff first
  #define ss second
  #define pb push_back
  #define mp make_pair
  #define vll vector<ll>
  #define lb lower_bound
  #define ub upper_bound
  #define pll pair<ll,ll>
  #define vpll vector<pll>
  #define all(v) v.begin(), v.end()
  #define rep(i,k,n) for(int i=k;i<n;i++)
  #define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
  const int md=1e8;
  const ll MAX=1e5+5;
  //
  //
  int main(){
  	string str;
  	cin>>str;
  	ll i=0,arr[2],n=str.length();	arr[0]=0;arr[1]=0;
  	ll ans=0;
  	while(i<n){
  		while(i<n&&str[i]=='A'){
  			++arr[0];
  			++i;
  		}
  		while(i<n-1&&str[i]=='B'&&str[i+1]=='C'){
  			++arr[1];
  			i+=2;
  		}
  		ans+=arr[0]*arr[1];
  		if(str[i]=='A')
  			arr[1]=0;
  		else{
  			++i;
  			arr[0]=0;
  			arr[1]=0;
  		}
  	}
  	cout<<ans;
  	return 0;
  }  			


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
// #define endl "\n"

int main(void) {
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);

    ll n, k;
    cin >> n >> k;

    if (n >= k) {
        n = n % k;
    }

    ll ans = min(n, k - n);
    cout << ans;

    
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

mod = 10**9+7

SX = 0
for i in range(n):
    SX += i*X[i] - (n-1-i)*X[i]
SX %= mod

SY = 0
for i in range(m):
    SY += i*Y[i] - (m-1-i)*Y[i]
SY %= mod

ans = SX*SY
print(ans%mod)

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    // 対応する値 :    1, 2, 3, 4, 5, 6, 7, 8, 9
    vector<int> map{0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

    int N, M;
    std::cin >> N >> M;

    vector<int> usable(M);
    REP(i, M) {
        std::cin >> usable[i];
    }

    RSORT(usable);

    vector<int> dp(N + 1, -INF);
    dp[0] = 0;
    for(int i = 1; i <= N; i++) {
        int max_digit = -INF;
        for(const auto& v : usable) {
            if(0 <= i - map[v]) {
                max_digit = max(max_digit, dp[i - map[v]] + 1);
            }
        }
        dp[i] = max_digit;
    }

    int dpi = N;
    while(true) {
        for(const auto& v : usable) {
            if(0 <= dpi - map[v] && dp[dpi - map[v]] == dp[dpi] - 1) {
                std::cout << v;
                dpi -= map[v];
                break;
            }
        }

        if(dpi <= 0) {
            std::cout << std::endl;
            break;
        }
    }

    return 0;
}


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

int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k%2) cout << b-a << endl;
    else cout << a-b << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <bitset>
using namespace std;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  string s[h];
  for (int i = 0; cin >> s[i]; ++i) {
  }
  int result = h * w;
  for (int i = 0; i < 1 << (h - 1); ++i) {
    bitset<32> bits(i);
    int current = 0, block[h], sum[h] = {};
    for (int j = 0, k = 0; j < h; ++j) {
      block[j] = k;
      if (bits[j]) {
        ++current;
        ++k;
      }
    }
    for (int c = 0; c < w; ++c) {
      int count[h] = {};
      for (int r = 0; r < h; ++r) {
        count[block[r]] += s[r][c] - '0';
      }
      for (int r = 0; r < h; ++r) {
        if (count[r] + sum[r] > k) {
          ++current;
          fill(sum, sum + h, 0);
          break;
        }
      }
      for (int r = 0; r < h; ++r) {
        sum[r] += count[r];
        if (sum[r] > k) {
          current = h * w;
        }
      }
    }
    result = min(result, current);
  }
  cout << result;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int cnt = 0;
  int k;
  cin >> k;
  for(int i = 1; i < k + 1; i++)
  {
    for(int j = i + 1; j < k + 1; j += 2)
    {
      cnt++;
    }
  }
  cout << cnt;

  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll N = in(), M = in(), R = in();
	vector<ll>r(R);
	REPC(&i, r)i = in() - 1;
	vector<vector<ll>>adj(N, vector<ll>(N, INFLL));
	REP(i, M) {
		ll a = in() - 1, b = in() - 1, c = in();
		adj[a][b] = adj[b][a] = c;
	}
	REP(k, N)REP(i, N)REP(j, N) adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
	vector<ll>perm(R);
	REP(i, R) {
		perm[i] = i;
	}
	ll ans = INFLL;
	do {
		ll temp = 0;
		REP(i, R - 1) {
			temp += adj[r[perm[i]]][r[perm[i + 1]]];
		}
		ans = min(ans, temp);
	} while (next_permutation(ALL(perm)));
	cout << ans << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<map>
#include<algorithm>
#include<string>
#include <complex>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<n;i++)
map<ll, ll> a;
int main (){
ll x;
cin >>x;
a[1]=1;
for(ll j=2;j<=sqrt(x);j++){
ll memo=j;
for(ll i=1;i<10;i++){
memo=memo*j;
if(memo<=1000){
a[memo]=1;
}
if(memo>1000)
break;
}
}
for(ll i=x;i>=0;i--){
if(a[i]==1){
cout <<i;
break;
}
}

return 0;

}

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

#define F first
#define S second
#define MP make_pair

using namespace std;

const int N = 1e7+100;
long long int a[N];

int main () {
    long long int ans=0,n, k;
    cin >> n >> k;
    for(int i = 0 ; i < n ; i++ ) {
        cin >> a[i];
        if(a[i]>=k)
            ans++;
    }
    cout << ans;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a<b){
			System.out.println("a < b");
		}else if(a>b){
			System.out.println("a > b");
		}else{
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 26092
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const ll inf = 1e18;

int n;

void warshall_floyd(vvll &tmp) {
    rep(k,n)rep(i,n)rep(j,n) {
        if (tmp[i][k] == inf || tmp[k][j] == inf) continue;
        tmp[i][j] = min(tmp[i][j],tmp[i][k]+tmp[k][j]);
    }
}

int main() {
   cin >> n;
   vvll dis(n,vll(n));
   ll sum = 0;
   rep(i,n)rep(j,n) cin >> dis[i][j];
   rep(i,n)rep(j,n) {
      if (j <= i) continue;
      sum += dis[i][j];
   }
   vvll tmp = dis;
   warshall_floyd(tmp);
   rep(i,n)rep(j,n) {
      if (j <= i) continue;
      if (tmp[i][j] < dis[i][j]) {cout << -1 << endl; return 0;}
      rep(k,n) {
         if (k == i || k == j) continue;
         if (dis[i][j] == tmp[i][k]+tmp[k][j]) {
            sum -= dis[i][j];
            break;
         }
      }
   }
   cout << sum << endl;
}


Measured memory_bytes: 1664
#include<iostream>
using namespace std;
int main(){
  	int n;
	long long a[100],m;
	cin >> n;
  	for(int k=0;k<n;k++){
      	cin >> a[k];
    	for(int l=0;l<k;l++){
        	if(a[l]>a[k]){
              	m=a[l];
              	a[l]=a[k];
              	a[k]=m;
            }
        }
    }
  cout << a[n-1]-a[0] << endl;
  	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); i++)
#define rrep(i, to) for (int i = to - 1; i >= 0; i--)
#define repf(i, from, to) for (int i = (from); i < (to); i++)
#define all(v) v.begin(), v.end()
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  int n;
  V<int> a, b, c;
  cin >> n;
  a.resize(n);
  b.resize(n);
  c.resize(n);

  rep(i, n) {
    cin >> a[i];
  }
  rep(i, n) {
    cin >> b[i];
  }
  rep(i, n) {
    cin >> c[i];
  }

  sort(all(a));
  sort(all(c));

  ll ans = 0;
  rep(i, n) {
    auto low_a_it = lower_bound(all(a), b[i]);
    auto low_c_it = upper_bound(all(c), b[i]);

    ll a_num = low_a_it - a.begin();
    ll c_num = c.end() - low_c_it;

    ans += a_num * c_num;
  }

  cout << ans << endl;
}

Measured memory_bytes: 4572
n, k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
ans = 0
0.upto(n) do |i|
      0.upto(n-i) do |j|
        if i + j > k
            next
        end
        arr = (a[0,i] + a[-j,j]).dup.sort!
        kaisuu = k - i - j
        while kaisuu > 0 && arr != []
            kaisuu -= 1
            if arr[0] < 0
                arr.shift
            end
        end
        if arr != []
        kai = arr.inject(0,:+)
        ans = [ans,kai].max
        end
    end
end
puts ans

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

#define ft first
#define sd second
#define sz(x) ((int)x.size())

using namespace std;

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

const int MAXN = 200 * 1000 + 321;






int n, ans[MAXN];
pii x[MAXN];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> x[i].ft, x[i].sd = i;
	sort(x, x + n);
	for (int i = 0; i < (n >> 1); i++)
		ans[x[i].sd] = x[n >> 1].ft;
	for (int i = n / 2; i < n; i++)
		ans[x[i].sd] = x[(n >> 1) - 1].ft;
	for (int i = 0; i < n; i++)
		cout << ans[i] << '\n';
	return 0;
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n; cin >> n;
    set<string> st;
    for(ll i=0;i<n;i++){
        string s; cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;
}


Measured memory_bytes: 19244
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#include<iostream>
#define for(i,a,b) for(i=a;i<b;i++)
using namespace std;
int main(void)
{
	int n,k,a,b,i;
	cin>>n>>k;
	for(i,0,k) {
		cin>>a>>b;
		cout<<(min(min(a-1,n-a),min(b-1,n-b))%3+1)<<endl;
	}
	return 0;
}

Measured memory_bytes: 3084
def list_add(l1, l2):
    tmp = [abs(a-b) for a, b in zip(l1, l2)]
    return tmp


# manhattan distance |x1-x2|+|y1-y2|
N, M = map(int, input().split())
students = [[int(i) for i in input().split()] for _ in range(N)]
checkpoints = [[int(i) for i in input().split()] for _ in range(M)]

for i in students:
    cur_point = 0
    min_point = 1
    smallest = sum(list_add(i, checkpoints[0]))
    for j in checkpoints:
        cur_point += 1
        sum_li = sum(list_add(i, j))
        if sum_li < smallest:
            smallest = sum_li
            min_point = cur_point
    print(min_point)


Measured memory_bytes: 3064
from random import randint

D = int(input())
C = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for j in range(D)]

def score_calc(T):
    total = 0
    last = [0] * 26
    for i in range(1, D+1):
        t = T[i-1]
        total += S[i-1][t-1]
        last[t-1] = i
        for j in range(26):
            total -= C[j] * (i - last[j])
    return total

total = 0
last = [0] * 26
ans = []
for i in range(1, D+1):
    score = [0] * 26
    for t in range(26):
        score[t] += S[i-1][t]
        for j in range(26):
            if j != t:
                score[t] -= C[j] * (i - last[j])
    total += max(score)
    last[score.index(max(score))] = i
    ans.append(score.index(max(score))+1)

N = 10000
Q = [[randint(0, (D-1)), randint(0, 25)] for i in range(N)]
for d, q in Q:
    old = ans[d]
    ans[d] = q + 1
    if score_calc(ans) > total:
        total = score_calc(ans)
    else:
        ans[d] = old

for i in range(D):
    print(ans[i])


Measured memory_bytes: 80804
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int N;
double p[3000];
double dp[3000][3000];
double q[3000];

double dfs(int cur, int res)
{
    if (N - cur == res) {
        dp[res][cur] = q[cur];
        return q[cur];
    }
    else if (dp[res][cur] != -1) {
        return dp[res][cur];
    }
    else {
        dp[res][cur] = p[cur] * dfs(cur + 1, res) + (1 - p[cur]) * dfs(cur + 1, res - 1);
        return dp[res][cur];
    }
}

int main(int argc, char **argv)
{
    cin >> N;
    REP(i, N) cin >> p[i];

    REP(i, N) REP(j, N) dp[i][j] = -1;
    dp[0][N - 1] = p[N - 1];
    for (int i = N - 2; i >= 0; --i) {
        dp[0][i] = p[i] * dp[0][i + 1];
    }

    q[N - 1] = 1 - p[N - 1];
    for (int i = N - 2; i >= 0; --i) {
        q[i] = (1 - p[i]) * q[i + 1];
    }

    double ans = 0;
    for (int i = 0; i <= N/2; ++i) {
        ans += dfs(0, i);
    }
    cout << setprecision(9) << ans << endl;

    return 0;
}


Measured memory_bytes: 70784
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#define MAXN 200005
using namespace std;
struct Node
{
    pair<int, int> num;
    int id;
    Node(){};
    Node(pair<int, int> N, int I): num(N), id(I){};
    bool operator < (const Node& x) const
    {
        return num < x.num;
    }
}key[MAXN];
int root1[MAXN], root2[MAXN];
int findRoot(int x, int* root)
{
    if(x == root[x]) return x;
    else
        return root[x] = findRoot(root[x], root);
}
void unite(int x, int y, int* root)
{
    x = findRoot(x, root);
    y = findRoot(y, root);
    if(x != y) root[x] = y;
}
bool same(int x, int y, int* root)
{
    return findRoot(x, root) == findRoot(y, root);
}
int ans[MAXN];
int n, k, l;
int main()
{
    scanf("%d%d%d", &n, &k, &l);
    for(int i = 0; i <= n; i++) root1[i] = root2[i] = i;
    for(int u, v, i = 0; i < k; i++)
    {
        scanf("%d%d", &u, &v);
        if(!same(u, v, root1)) unite(u, v, root1);
    }
    for(int u, v, i = 0; i < l; i++)
    {
        scanf("%d%d", &u, &v);
        if(!same(u, v, root2)) unite(u, v, root2);
    }
    for(int i = 1; i <= n; i++)
    {
        key[i] = Node(make_pair(findRoot(i, root1), findRoot(i, root2)), i);
    }
    sort(key + 1, key + n + 1);
    for(int j, i = 1; i <= n; i = j)
    {
        j = i;
        while(j <= n && key[j].num == key[i].num) j++;
        for(int xx = i; xx < j; xx++)
        {
            ans[key[xx].id] = j - i;
        }
    }
    for(int i = 1; i <= n; i++)
    {
        if(i != 1) printf(" ");
        printf("%d", ans[i]);
    }
    puts("");
    return 0;
}


Measured memory_bytes: 5376
#include<stdio.h>
#include<string.h>
int main()
{
    char s[10];
    //gets(s);
    scanf("%s",s);
    if(strlen(s) == 3){
        for(int i = strlen(s)-1 ; i >= 0 ; i--)
        {
            printf("%c",s[i]);
        }
        printf("\n");
    }
    else{
        printf("%s\n",s);
    }
   // printf("%s",s);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b;
  cin>>a;
  b=a;
  reverse(b.begin(),b.end());
  for(int i=0;i<b.size();i++){
    if(b[i]=='b')b[i]='d';
    else if(b[i]=='d')b[i]='b';
    else if(b[i]=='p')b[i]='q';
    else if(b[i]=='q')b[i]='p';
  }
  if(a==b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return(0);
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll solve(ll n) {
    ll count5 = 0;
    while(n){
        count5 += n/5/2;
        n /= 5;
    }
    return count5;
}
ll test(ll n){
    if(n<2)
        return 1;
    else return n*test(n-2);
}
int main()
{
    ll n;
    cin>>n;
    if(n&1)
        cout<<0<<endl;
    else
        cout<<solve(n)<<endl;
    return 0;
}


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

typedef long long ll;
ll mod = 1e9+7;

int main(){
    int n;
    cin>>n;
    
    vector<ll> a(n);
    ll sum = 0;
    for(int i=0; i<n; i++){
        cin>>a[i];
        sum += a[i];
        sum %= mod;
    }

    ll ans = 0;
    for(int i=1; i<=n; i++){
        sum -= a[i-1];
        if(sum < 0){
            sum += mod;
        }
        ans += a[i-1]*sum%mod;
      
    }
    cout<<ans%mod<<endl;
    return 0;
}

Measured memory_bytes: 4732
process.stdin.resume()
process.stdin.setEncoding('utf8')
var g_input = ''
process.stdin.on('data', function(chunk) {
    g_input += chunk
})
process.stdin.on('end', function() {
    main(g_input.split(/\r?\n/))
})
function main(input){
  input = Number(input[0])
  let c = 0
  for(let i=1;i<=input;i++){
    for(let j=1;j<=input;j++){
      //console.log(`${i}${j}`)
      if(j*i<input){
        c++
      }else{
        break
      }
    }
  }
  console.log(c)
}

Measured memory_bytes: 32560
use strict;
use warnings;
use utf8;

my ($A, $B) = split /\s/, <STDIN>;

my $sum = 0;
if ($A < $B) {
    $sum += $B;
    $B--;
} else {
    $sum += $A;
    $A--;
}
#printf "%s\n", join " ", $A, $B, $sum;

if ($A < $B) {
    $sum += $B;
    $B--;
} else {
    $sum += $A;
    $A--;
}
#printf "%s\n", join " ", $A, $B, $sum;

printf "%s\n", $sum;


Measured memory_bytes: 640
N = int(input())
X = list(map(int, input().split()))

X.sort()
top = X[-1]
bot = X[0]
lowest = 1145141919810112231231231231081081081081072072072

for i in range(bot, top+1):
  cal = 0
  for x in range(N):
    cal += (X[x] - i)**2
  
  if cal < lowest:
    lowest = cal
    
print(lowest)
  

Measured memory_bytes: 3060
# coding: utf-8
# Your code here!
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
a,b,c,k = map(int,input().split())	
ans = 0
if a>=k:
    ans = 1*k
    print(ans)
    exit()
else:
    ans += 1*a
    #print(ans)
    k = k-a
    #print(k)
    if b >=k:
        print(ans)
        exit()
    else:
        k = k-b
        #print(k)
        
        ans = ans - 1*k 
        print(ans)
        exit()
    
    

Measured memory_bytes: 61724
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b;
	for(int i=1;i<=b;i++){
		cin>>c;
		a-=c;
		if(a<=0){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
} 

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

int main(){
  int n,m;
  cin >> n >> m;
  
  vector<vector<int>> c(m);
  for (int i = 0; i < n; ++i){
    int a,b;
    cin >> a >> b;
    if(a>m) continue;
    c[m-a].push_back(b);    
  }

  priority_queue<int> q;
  int ans=0;
  for (int i = m-1; i >= 0; i--)
  {
    for(int x:c[i]){
      q.push(x);
    }
    if(!q.empty()){
      ans+=q.top();
      q.pop();
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 5504
#include<iostream>

int main()
{
  int a,b,as=0,bs=0;
  for(int i=0;i<4;i++){
    std::cin >> a;
    as+=a;
  }
  for(int i=0;i<4;i++){
    std::cin >> b;
    bs+=b;
  }
  if(as>=bs) std::cout << as << std::endl;
  else std::cout << bs << std::endl;
  return 0;
}



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

int main() {
	int n, m, a[20][2], flag[20], x, y, flag2, c[30];
	char b[30];
	
	while (1) {
		cin >> n;
		if (n == 0) break;
		for (int i = 0; i < n; i++)
			cin >> a[i][0] >> a[i][1];
		cin >> m;
		for (int i = 0; i < m; i++)
			cin >> b[i] >> c[i];
		
		for (int i = 0; i < n; i++)
			flag[i] = 1;
		x = y = 10;
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < c[i]; j++) {
				if (b[i] == 'N') y++;
				else if (b[i] == 'E') x++;
				else if (b[i] == 'S') y--;
				else x--;
				
				for (int k = 0; k < n; k++)
					if (x == a[k][0] && y == a[k][1])
						flag[k] = 0;
			}
		}
		
		flag2 = 0;
		for (int i = 0; i < n; i++) {
			if (flag[i])  {
				flag2 = 1;
				break;
			}
		}
			
		if (!flag2)
			cout << "Yes\n";
		else
			cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;
int main(){
  int taka_HP, taka_ATK, ao_HP, ao_ATK;
  string ans = "Yes";
  cin >> taka_HP >> taka_ATK >> ao_HP >> ao_ATK;
  while(taka_HP>0 && ao_HP>0){
    //cout << taka_HP << endl;
    ao_HP -= taka_ATK;
    taka_HP -= ao_ATK;
    if(ao_HP <= 0){
      ans = "Yes";
      break;
    }
    if(taka_HP <= 0) ans = "No";
  }
    
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=105;
int n,x,y;
int a[N];
int main(){
	n=read(),x=y=read();
	For(i,1,n)
		a[i]=read();
	sort(a+1,a+n+1);
	int ans=0;
	For(i,1,n)
		if (a[i]>x)
			break;
		else
			x-=a[i],ans++;
	if (ans==n){
		LL s=0;
		For(i,1,n)
			s+=a[i];
		if (s!=y)
			ans--;
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = (int)(n)-1; 0 <= i; i--)
#define rrep1(i, n) for (int i = (int)(n); 1 <= i; i--)

#define each(it, c) \
    for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define all(obj) (obj).begin(), (obj).end()

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x) cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a;
    rep(i, n) {
        int tmp;
        cin >> tmp;
        if (i == 0) {
            a.push_back(tmp);
            continue;
        }
        if (tmp != a.back()) a.push_back(tmp);
    }
    int sz = SZ(a);
    lint ans = 1000, num = 0;
    rep(i, sz) {
        if (i == 0) {
            if (a[i] < a[i + 1]) {
                num += ans / a[i];
                ans -= a[i] * (ans / a[i]);
            }
        } else if (i == sz - 1) {
            if (a[i - 1] < a[i]) {
                ans += num * a[i];
                num = 0;
            }
        } else if (a[i - 1] < a[i] && a[i] > a[i + 1]) {
            ans += num * a[i];
            num = 0;
        } else if (a[i - 1] > a[i] && a[i] < a[i + 1]) {
            num += ans / a[i];
            ans -= a[i] * (ans / a[i]);
        }
        dump(ans);
        dump(num);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[2][n];
  for(int i=0;i<2;i++){
    for(int j=0;j<n;j++){
      cin >>a[i][j];
    }
  }
  int sum=0;int can=-1;
  for(int i=0;i<n;i++){
    for(int j=0;j<=i;j++){
        sum+=a[0][j];
    }
    for(int j=i;j<n;j++){
      sum+=a[1][j];
    }
    can=max(can,sum);
    sum=0;
  }
  cout << can<<endl;
}


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

char c[128];

void solve(char b){
    /*
    if(b == "A") std::cout << "T" << endl;
    else if(b == "C") std::cout << "G" << endl;
    else if(b == "G") std::cout << "C" << endl;
    else if(b == "T") std::cout << "A" << endl;
    */
   c['A'] = 'T';
   c['T'] = 'A';
   c['G'] = 'C';
   c['C'] = 'G';
   cout << c[b] << endl;
}

int main(){
    char b;
    std::cin >> b;
    solve(b);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int H[N];
    for(int i=0;i<N;i++) cin >> H[i];

    int mireru=H[0];
    int ans=1;
    for(int i=1;i<N;i++){
        if(mireru<=H[i]){
            mireru = H[i];
            ans++;
        }
    }

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

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

using namespace std;

#define X first
#define Y second
#define pB push_back
#define mP make_pair
#define ll long long

int main(){
	ll x,y;
	cin >> x >> y;
	if(x % y == 0)
		cout << -1 << endl;
	else
		cout << x << endl;

	return 0;
}

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

#define int            long long 
#define vi             vector<int>
#define mod            1000000007
#define MAX            INT_MIN
#define MIN            INT_MAX
#define ff             first
#define ss             second
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define pqb            priority_queue<int>
#define floop(n)       for(int i=0;i<n;i++)
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define ps(x,y)        fixed<<setprecision(y)<<x         
#define FIO            ios_base::sync_with_stdio(false); cin.tie(NULL);
                  
void c_p_c()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif

}

void multiplication1()
{
	int a,b;
	cin>>a>>b;

	cout<<a*b<<endl;
}
int32_t main()
{
	c_p_c();

	multiplication1();

	return 0;
}


Measured memory_bytes: 3620
from operator import itemgetter
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
l = [[i] + list(map(int, input().split())) for i in range(m)]

l.sort(key=itemgetter(1, 2))
res = []
idx, pre_p, y = l[0]
count = 1
res.append([idx, str(pre_p).zfill(6) + str(count).zfill(6)])
for idx, p, y in l[1:]:
    if pre_p == p:
        count += 1
    else:
        count = 1
    
    res.append([idx, str(p).zfill(6) + str(count).zfill(6)])
    pre_p = p

res.sort(key=itemgetter(0))
for idx, n in res:
    print(n)

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in(),M=in();
	auto A=vecin(N);
	int S = accumulate(ALL(A),0);
	int T = S/(4*M);

	int P=0;
	REP(i,N){
		if(A[i]*4*M>=S) P++;
	}
	if(P>=M) out("Yes");
	else out("No");
	return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc137/tasks/abc137_e

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop
import sys
sys.setrecursionlimit(12345678)

def main():
    n, m, p = map(int, input().split())
    edges = []
    graph = defaultdict(list)
    rev_graph = defaultdict(list)

    for _ in range(m):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        c = -(c - p)
        edges.append((a, b, c))
        graph[a].append(b)
        rev_graph[b].append(a)

    # pick up nodes on goal path
    reachable_from_start = [False] * n

    # print(edges)
    def dfs(node):
        if reachable_from_start[node]:
            return
        reachable_from_start[node] = True
        for next_node in graph[node]:
            dfs(next_node)

    reachable_to_end = [False] * n

    def rdfs(node):
        if reachable_to_end[node]:
            return
        reachable_to_end[node] = True
        for next_node in rev_graph[node]:
            rdfs(next_node)

    dfs(0)
    rdfs(n-1)

    valid = [False] * n
    for i in range(n):
        valid[i] = reachable_from_start[i] and reachable_to_end[i]

    inf = 10**10
    scores = [inf] * n
    scores[0] = 0
    loop = 0

    # bellman-ford
    updated = True
    while updated:
        updated = False
        for i in range(m):
            a, b, c = edges[i]
            if not valid[a]:
                continue
            if not valid[b]:
                continue

            new_cost = scores[a] + c
            if new_cost < scores[b]:
                updated = True
                scores[b] = new_cost

        loop += 1
        if loop > n:
            print(-1)
            return

    print(max(0, -scores[-1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 66520
#include <bits/stdc++.h>
using namespace std;
const int A[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main(){
  int K;
  cin>>K;
  cout<<A[K-1]<<endl;
}


Measured memory_bytes: 256
open Num
       
let mod109p7 x = mod_num x (num_of_int 1000000007)

let fact x =
  let rec loop n a =
    if n == 1 then a
    else loop (n-1) (mod109p7 (a */ (num_of_int n))) in
  int_of_num @@ loop x (num_of_int 1)

let () = read_int () |> fact |> string_of_int |> print_endline



Measured memory_bytes: 2560
#include <cstdio>
using namespace std;

#define D 1000000007
#define REP(i,n) for(int i=1; i<=n; i++)

int main(){
    int N, M;
    long long Np=1, Mp=1;
    scanf("%d %d", &N, &M);
    if((N-M)>1 || (N-M)<-1){
        printf("0\n");
        return 0;
    }
    REP(i,N){
        Np *= i;
        Np %= D;
    }
    REP(i,M){
        Mp *= i;
        Mp %= D;
    }

    if(N==M) printf("%lld\n", 2 * (Np*Mp)%D);
    else printf("%lld\n", (Np*Mp)%D);
    return 0;
}

Measured memory_bytes: 128
N=int(input())
for h in range(1,3501):
    for n in range(1, 3501):
        A=4*h*n-N*n-N*h
        B=N*h*n
        if A>0:
            if B%A==0:
                print(h,n,B//A)
                break
    else:
        continue
    break

Measured memory_bytes: 9172
'use strict'

const main = arg => {
  arg = arg.trim().split("\n");

  const w = ~~(arg[0].split(" ")[0]);
  const h = ~~(arg[0].split(" ")[1]);
  const n = ~~(arg[0].split(" ")[2]);

  const points = arg.slice(1, n + 1).map(l => l.split(" ").map(n => ~~n));
  const list = [...Array(h)].map(l => [...Array(w)].fill(0));

  for(const point of points) {
    const x = point[0];
    const y = point[1];
    const a = point[2] - 1;

    const fromH = [0, 0, 0, y];
    const toH   = [h, h, y, h];
    const fromW = [0, x, 0, 0];
    const toW   = [x, w, w, w];

    for(let i = fromH[a]; i < toH[a]; i++) {
      for(let j = fromW[a]; j < toW[a]; j++) {
        list[i][j] = 1;
      }
    }
  }

  let cnt = 0;
  
  for(let i = 0; i < h; i++) {
    for(let j = 0; j < w; j++) {
      if(list[i][j] === 0) cnt++;
    }
  }

  console.log(cnt);
}

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


Measured memory_bytes: 8496
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const int maxm = 1e6 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){if(x < 2) return 0; for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
int x,y,z;
int main(){
 	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> x >> y >> z;
	swap(x,y);
	swap(x,z);
	cout << x << " " << y << " " << z << endl;
	return 0;
}
//do smt instead of nothing! never give up!
//take care of long long!
//take care of upper or lower case e.g "yes" or "YES"?
//boundary condition! e.g. n = 0?
//brute force is always the first choice!
// print the ans to look for patterns in the data!

Measured memory_bytes: 256
/*
sonu_verma1
*/
#include <bits/stdc++.h>
// For policy based data structure
/*#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> */
using namespace std;
/*using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set;*/
 
#define MD 1000000007
#define X first
#define Y second
#define pb push_back
#define debug(val, ch) cout <<val <<ch
#define FOR(i, st, en, ch) for(register int i = (st); i <= (en) ; i += (ch))
#define RFOR(i, st, en, ch) for(register int i = (st); i >= (en) ; i -= (ch))
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
 
typedef long long int ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<int, bool> pib;
typedef pair<bool, int> pbi;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
/*********************************************************************/
void test(int r)
{
    int n;
    cin>>n;
    if(n>=30)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    

}
/***********************************************************************/
int main()
{
    fast();
    int t=1,r;
    // cin>>t;
    for(r=1;r<=t;r++)
        test(r);
    return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
	static public void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		scan.close();

		if (a <= 8 && b <= 8) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}

	}
}


Measured memory_bytes: 22228
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int count = 0;
        while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
            if (a == b && b == c) {
                System.out.println(-1);
                return;
            }
            count++;
            int tempA = a;
            int tempB = b;
            a = b / 2 + c / 2;
            b = tempA / 2 + c / 2;
            c = tempA / 2 + tempB / 2;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 21588
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
typedef struct{
    long long  price;
    long long  num;
} energy;
energy a[1000000];
 
int struct_compare( const void *p, const void *q ) {
    return -((energy*)q)->price + ((energy*)p)->price;
}
int main()
{   int i,k=0,n,m,c,d;
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++){
        scanf("%d%d",&a[i].price,&a[i].num);
    }
    long long ans=0;
    qsort(a,n,sizeof(energy),struct_compare);
    
    i=0;
    while(k<m){
        if(k+a[i].num>=m){
            
            ans+=a[i].price*(m-k);
            k=m;
            i++;
        }else{
            ans+=(a[i].price)*(a[i].num);
            k+=(int)a[i].num;
            i++;
        }
    }
    printf("%lld",ans);
    
    return 0;
}


Measured memory_bytes: 3324
#include <stdio.h>
#include <stdlib.h>
int main()
{
  int a[3];
  scanf("%d%d%d",&a[0],&a[1],&a[2]);
  int i,k,tmp;
  while (i < 3)
  {
    k = i+1;
    while(k < 3)
    {
      if (a[i] < a[k])
      {
        tmp = a[i];
        a[i] = a[k];
        a[k] = tmp;
      }
      k++;
    }
    i++;
  }
  printf("%d",a[0]*10+a[1]+a[2]);
}

Measured memory_bytes: 128
#include <stdio.h>

main() {
  int a,b,c,d;
  scanf("%d %d %d",&a,&b,&c);
  if(a>b)
    d=b,b=a,a=d;
    if(b>c){
    d=c,c=b,b=d;
    if(a>b)
      d=b,b=a,a=d;
  }
  printf("%d %d %d\n", a,b,c);
}



Measured memory_bytes: 2116
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    cout<<(n>=30?"Yes":"No")<<endl;

}

Measured memory_bytes: 3644