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

int keta(int N){
  if(N == 0) return 1;
 int a =  log10(N);
  return a+1;
}


int main() {
int a,b;
  cin >> a >>b;
  int s = keta(b);
  int wa =b;
  for(int i=0;i<s;i++) a*=10;
  wa += a;
  for(int i=0;i<350;i++){
   if(wa == i*i){
     cout << "Yes" <<endl;
     return 0;
   }
  }
  cout << "No" <<endl;
  return 0;
}
  


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll binpow(ll x,ll y){
    ll res=1;
    while(y>0){
        if(y&1)
            res*=x;
        y>>=1;
        x*=x;
    }
    return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i,j,temp,flag;
    cin>>n;
    for(i=-1000;i<=1000;i++){
        for(j=i;j<=1000;j++){
            temp=binpow(i,5);
            flag=binpow(j,5);
            if((flag-temp)==n){
                cout<<j<<" "<<i<<endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include <cmath>
//for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<n;i++) cin >> x[i];
#define pi pair<int,int> 
using namespace std;

int main(){
  int n; cin >> n;
  cout << 180*(n-2);
}

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

int n;
int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for(int i = 1; i < 10; ++i) {
		for(int j = 1; j < 10; ++j) {
			if (i*j == n) {
				cout << "Yes";
				return 0;
			}
		}
	}
	cout << "No";
}

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

int main() {
  int N = 0;
  cin >> N;
  int A[N];
  bool isDivisible = true;
  int count = 0;
  
  for( int i = 0; i < N; ++i ){
    cin >> A[i];

    if( A[i] % 2 != 0 ){
      isDivisible = false;
    }
  }
  
  while( isDivisible ){
    for( int i = 0; i < N; ++i ){
      if( A[i] % 2 == 0 ){
        A[i] /= 2;
      }else{
        isDivisible = false;
        break;
      }
    }
    if( isDivisible == true ){
      ++count;
    }else{
      break;
    } 
  }
  cout << count << endl;
}


Measured memory_bytes: 3604
n = int(input())
s = list(input())
answer = ''
alphabets = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
alphabets_dict = {
  'A': 0,
  'B': 1,
  'C': 2,
  'D': 3,
  'E': 4,
  'F': 5,
  'G': 6,
  'H': 7,
  'I': 8,
  'J': 9,
  'K': 10,
  'L': 11,
  'M': 12,
  'N': 13,
  'O': 14,
  'P': 15,
  'Q': 16,
  'R': 17,
  'S': 18,
  'T': 19,
  'U': 20,
  'V': 21,
  'W': 22,
  'X': 23,
  'Y': 24,
  'Z': 25
}
for ss in s:
  num = alphabets_dict[ss]
  answer += alphabets[(num + n) % 26]
print(answer)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 bit(k) (1LL<<(k))
#define SUM(v) accumulate(all(v), 0LL)

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>>;
struct fast_ios{ fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }fast_ios_;

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; }

#define TOSTRING(x) string(#x)
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os  << "["; for(auto _: v) os << _ << ", "; os << "]"; return os; };
template <typename T> ostream &operator<<(ostream &os, set<T> &st) { os << "("; for(auto _: st) { os << _ << ", "; } os << ")";return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair< T, U >& p){os << "{" <<p.first << ", " << p.second << "}";return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &mp){ os << "["; for(auto _: mp){ os << _ << ", "; } os << "]" << endl; return os; }

#define DUMPOUT cerr
void dump_func(){ DUMPOUT << endl; }
template <class Head, class... Tail> void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); }

#ifdef DEBUG
#define dbg(...) dump_func(__VA_ARGS__)
#define dump(...) DUMPOUT << string(#__VA_ARGS__) << ": "; dump_func(__VA_ARGS__)
#else
#define dbg(...)
#define dump(...)
#endif

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const long 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() {
    int N, M;
    cin >> N >> M;
    vector<ll> dp(bit(N), INFLL);
    dp[0] = 0;
    rep(i,M){
        ll a, b;
        cin >> a >> b;
        int tmp = 0;
        rep(i,b){
            int c;
            cin >> c;
            c--;
            tmp |= bit(c);
        }
        auto dp2 = dp;
        for(int j = 0; j < bit(N); j++){
            chmin(dp2[j | tmp], dp[j] + a);
        }
        swap(dp, dp2);
    }
    cout << ((dp[bit(N) - 1] == INFLL) ? -1 : dp[bit(N) - 1]) << endl;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
const int INF = 1000000000;
typedef pair<int, int> P;
const int MAX_N = 1000000000;
typedef int64_t ll;
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }




int main() {
	int a, b, k;
	cin >> a >> b >> k;
	
	for (int i = a; i <= min(b,a+k-1); i++)
	{
		cout << i << endl;
	}
	for (int i = max(b-k+1,a+k); i <= b; i++)
	{
		cout << i << endl;
	}
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

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

    int ans = 0;
    for (int i = 0; i < 2; ++i) {
        if (a > b) swap(a, b);
        ans += b;
        --b;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(){
  int input[2], keep, i, j, n, max;
  scanf("%d",&n);
  //  input = (int *)malloc(sizeof(int) * n);
  for(i=0; i<n; i++){
    if(i == 0){
      scanf("%d",&input[0]);
      continue;
    }
    if(i == 1){
      scanf("%d",&input[1]);  
      max = input[1] - input[0];
      continue;
    }
    scanf("%d",&keep);
    if(input[0] > input[1])
      input[0] = input[1];
    input[1] = keep;
      if(input[1]-input[0] > max)
	max = input[1]-input[0];
  }
  printf("%d\n",max);
  return 0;
}

Measured memory_bytes: 596
// Created by Tanuj Jain
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int recursive_min_cost(vector<int>&v,int end,int &ans)
{
	//cout<<"call:"<<end<<endl;
	if(end==0)
		return 0;
	if(end<0)
		return 1e6;
	//find left child ans
	//int ans=0;
	int left_child=recursive_min_cost(v,end-1,ans);
	int right_child=recursive_min_cost(v,end-2,ans);
	//find the current answer
	ans=min(left_child+abs(v[end]-v[end-1]),right_child+abs(v[end]-v[end-2]));
	//cout<<ans<<endl;
	return ans;

}
int top_down(vector<int>&v,int end, int &ans, unordered_map<int,int>&memo)
{
	//cout<<end<<endl;
	if(end==0)
		return 0;
	if(end<0)
		return 1e6;
	//find left child ans
	//int ans=0;
	if(memo.find(end)==memo.end())
	{
		int left_child=top_down(v,end-1,ans,memo);
		int right_child=top_down(v,end-2,ans,memo);
		//find the current answer
		ans=min(left_child+abs(v[end]-v[end-1]),right_child+abs(v[end]-v[end-2]));
		memo[end]=ans;
		//cout<<ans<<endl;
		return ans;
	}
	else
		return memo[end];
	
}
int bottom_up(vector<int>&v)
{
	int n=v.size();
	vector<int>dp(n+1,1e6);
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	for(int i=2;i<n;i++)
	{
		dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
	}
	return dp[n-1];
}
int main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	//#ifndef ONLINE_JUDGE
	//freopen("inputf.in","r",stdin);
	//freopen("outputf.in","w",stdout);
	//#endif

	int t;
	cin>>t;
	vector<int>v(t); 
	for(int i=0;i<t;i++)
		cin>>v[i];
	//int ans=0;
	//recursive_min_cost(v,t-1,ans);

	//top down dp with memoization
	//unordered_map<int,int>memo;
	//top_down(v,t-1,ans,memo);
	//for(auto it:memo)
	//	cout<<it.first<<" "<<it.second<<endl;
	//cout<<ans;


	//bottom up dp
	cout<<bottom_up(v)<<endl;
	
}

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

typedef long long int ll;
typedef vector<int>   vi;
typedef vector<char>  vc;
typedef vector<ll>    vll;

#define rep(i,a,b) for(ll i=(a); i<=(b); i++)
#define vin(v,n)   for(ll i = 0; i <  n; i++) cin >> v[i];
#define pushi(v,a) for(ll i = 0; i < a.size(); i++) v.push_back(a[i]);
#define vout(v,n)  for(ll i = 0; i < n; i++) cout << v[i] << " ";
#define Boost      ios_base::sync_with_stdio(false);cin.tie(0);
#define stop(n)    return cout<<n,0;
#define all(v)     (v).begin(), (v).end()
#define rall(v)    (v).rbegin(),(v).rend()
#define sp(x,y)    fixed<<setprecision(y)<<x
#define sz(v)      (int)(v.size())
#define endl       '\n'
#define PI         3.141592653
#define fn         fill_n
#define pb         push_back
#define in(n)      cin>>n;

void solve()
{
   int n,k;

   cin>>n>>k;
   vi v;
   rep(i,0,n-1) { int a; cin>> a; v.pb(a);}

   int sum=0;
   while(k--){
    int p=*min_element(all(v));
    int pos=distance(v.begin(),min_element(all(v)));
    v[pos]=1000;
    sum=sum+p;
   }
cout<<sum;

}

int main()
{
    Boost;
    clock_t time_p=clock();

    int test;
    test=1;
    //in(test);
    while(test--)
    {
        solve();
    }
    cerr<<"\n\nTime Taken : "<<sp((float)(clock()-time_p),5)/CLOCKS_PER_SEC<<endl;
    return 0;
}


Measured memory_bytes: 3780
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <set>
//#inlcude<stringstream>
#define ll long long
#define MODD 1000000007
using namespace std;
ll arr[1000000]={0};
ll brr[1000000]={0};
int main() {

    ll a,b,k;cin >>a>>b>>k;
    ll small = 0,big = 0;
    for(ll i=a;i<=b;i++){
        if(small<k)arr[small++]=i;
        else if(i>b-k&&(b-k)>0&&big<k)brr[big++]=i;
    }
    for(ll i=0;i<min(k,(abs(a-b)+1));i++)cout<<arr[i]<<endl;
    for(ll i=0;i<k;i++){if(brr[i]==0){break;}cout<<brr[i]<<endl;}
    return 0;
}

Measured memory_bytes: 2304
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
//if(strcmp(s[i],"AC")==0)
//if(s[l]=='#')
/*小文字判定
if((moji>= 'a') && (moji<='z')){
    printf("a\n");
    return 0;
  }
  */

int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(int *a, int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}//ちいさい順
//qsort(a,n,sizeof(int),cmp);
//char s[n][11]

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);


int main (void)
{
	long long int x,y,b,d,n,i,ans=0;

scanf("%lld%lld",&n,&d);
	for(i=0;i<n;i++){
scanf("%lld%lld",&x,&y);

      if(x*x+y*y<=d*d){
      ans++;
      }
	}
	printf("%lld",ans);
return 0;
}


Measured memory_bytes: 1736
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] cnt = new int[26];

            int h = in.nextInt();
            int w = in.nextInt();
            String[] s = in.nextStringArray(h);

            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    cnt[s[i].charAt(j) - 'a']++;
                }
            }

            int cnt1 = 0;
            int cnt2 = 0;
            for (int i = 0; i < 26; i++) {
                int x = cnt[i] % 4;
                if (x >= 2) {
                    cnt2++;
                    x -= 2;
                }

                if (x >= 1) {
                    cnt1++;
                }
            }

            int can1 = 0;
            if (h % 2 == 1 && w % 2 == 1) can1++;

            int can2 = 0;
            if (h % 2 == 1 && w % 2 == 1) {
                can2 += h / 2 + w / 2;
            } else if (h % 2 == 1) {
                can2 += w / 2;
            } else if (w % 2 == 1) {
                can2 += h / 2;
            }

            out.println(can1 >= cnt1 && can2 >= cnt2 ? "Yes" : "No");
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

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

        public String[] nextStringArray(int n) {
            String[] res = new String[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextString();
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 25172
i = []

gets.to_i.times do
  a, b = gets.split
  case a
  when 'insert' then i.unshift(b)
  when 'delete'
    c = i.index(b)
    i.delete_at(c) unless c.nil?
  when 'deleteFirst' then i.shift
  when 'deleteLast' then i.pop
  end
end

puts i.join(' ')

Measured memory_bytes: 97856
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template < typename T > using oset = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
// find_by_order(k) (k+1)th largest element
// order_of_key(k) no of elements <=k

typedef long long ll;
typedef long double ld;
#define endl '\n'
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define ff first
#define ss second
#define pb push_back
typedef vector<ll> vll;
typedef vector<pair<ll,ll>> vpl;
const ld PI = 4*atan((ld)1);
const ll INF = 1e18;
const ll mod = 1e9+7;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll tt=1;
        // cin >> tt;
    while((tt)--){
        ll h,w,k; cin >> h >> w >> k;

        char a[h][w];
        repA(i,0,h-1){
            repA(j,0,w-1) cin >> a[i][j];
        }

        ll ans =0;
        repA(mh,0,(1ll<<h)-1){
            repA(mw,0,(1ll<<w)-1){
                ll black=0;
                repA(i,0,h-1){
                    repA(j,0,w-1){
                        if(!(mh&(1ll<<i)) and !(mw&(1ll<<j)) and a[i][j]=='#')black++;
                    }
                }
                if(black==k)ans++;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3604
#include <iostream>
#include <queue>
#include <vector>
#include <utility>

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i = a ; i < (int)n ; i++)
#define pb push_back
#define NIL -1
#define MAX 100001

using namespace std;

struct Node{
  int id;
  int parent;
  vector<int> child;
  int depth;
  
  void addChild(int c){
    child.pb(c);
  }
    
 void print(){
    cout << "node " << id << ": ";
    cout << "parent = " << parent << ", ";
    cout << "depth = " << depth << ", ";
    cout << (parent == -1?"root":child.size()==0?"leaf":"internal node") << ", ";
    cout << "[";
    if(child.size() != 0){
      rep(i, child.size()-1){
    cout << child[i] << ", ";
      }
      cout << child[child.size()-1];
    }
      cout << "]" << endl;
 }
};

Node node[MAX];

void init(int n){
  rep(i, n){
    node[i].depth = NIL;
    node[i].parent = NIL;
    node[i].child.clear();    
  }
}

signed main(){
  int n;
  int id, k, c, root;
  cin >> n;
  init(n);
  
  root = NIL;

  rep(i, n){
    cin >> id >> k;
    node[id].id = id;
    rep(j, k){
      cin >> c;
      node[id].addChild(c);
      node[c].parent = id;
      node[c].depth = node[id].depth + 1;
    }
  }

  rep(i, n){
    if(node[i].parent == NIL){
      root = i;
      break;
    }
  }
  
  queue<pair<Node, int> > q;
  q.push(make_pair(node[root], -1));
  while(!(q.empty())){
    pair<Node, int> p = q.front(); q.pop();
    node[p.first.id].depth = p.second + 1;
    rep(i, p.first.child.size()){
      q.push(make_pair(node[p.first.child[i]], p.second + 1));
    }
  }
  
  rep(i, n){
    node[i].print();
  }
}


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

typedef long long ll;

#define REP(i, N) for (int i = 0; i < (int)(N); i++)

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

int main() {
    string S;
    cin >> S;
    
    int num = 0, ans = 0;
    for ( int i = 0; i < S.size(); ++i){
        if ( S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T'){
            ++num;
        } else {
            chmax(ans,num);
            num = 0;
        }
    }
    chmax(ans,num);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <deque>
#include <cstring>

#define f first
#define s second
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define mp make_pair
#define y0 wefkljekfjwek

using namespace std;

const ll mod=1000000007;
ll dp[200005];
int n;
map<int,int> lst;

int main()
{
    ios_base::sync_with_stdio(0);
    dp[0]=1;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        if(lst.count(x) && lst[x]+1!=i)
            dp[i]=(dp[i-1]+dp[lst[x]])%mod;
        else
            dp[i]=dp[i-1];
        lst[x]=i;
    }
    cout<<dp[n];
}



Measured memory_bytes: 11264
// ConsoleApplication2.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include <map>
#include <string>
using namespace std;

map<long long, long long> mp;
int main()
{
	map<long long, long long> ::iterator iter;
	int n, m;
	cin >> n >> m;
	long long cnt = 0;
	for (int i = 0; i < n; i++)
	{
		long long a;
		cin >> a;
		cnt += a;
		if (mp.count(a) == 1)
		{
			mp[a]++;
		}
		else
		{
			mp[a] = 1;
		}
	}
	do
	{
		iter = mp.end();
		iter--;
		if ((*iter).second >= m)
		{
			cnt -= ((*iter).first - (*iter).first / 2) * m;
			m = 0;
		}
		else
		{
			m -= (*iter).second;

			cnt -= ((*iter).first - (*iter).first / 2) * (*iter).second;
			long long temp1 = (*iter).first / 2;
			long long temp2 = (*iter).second;
			mp.erase((*iter).first);
			if (mp.count(temp1) == 1)
			{
				mp[temp1] += temp2;
			}
			else
			{
				mp[temp1] = temp2;
			}
		}
	} while ((m != 0) && (cnt > 0));

	cout << cnt;

	return 0;
}


//int CalNP(vector <int> a, int pos, int len)
//{
//	int value = a[pos];
//	for (int i = 1; i < len; i++)
//	{
//		value *= a[pos + i];
//	}
//	return value;
//}
// 
//int main()
//{
//	int n;
//	int temp;
//	int N = 0;
//	int P = 0;
//	vector <int> a;
//	cin >> n;
//	for (int i = 0; i < n; i++)
//	{
//		cin >> temp;
//		if (temp < 0)
//		{
//			a.push_back(-1);
//		}
//		else
//		{
//			a.push_back(1);
//		}
//	}
//	for (int len = 1; len <= n; len++)//len
//	{
//		for (int j = 0; (j + len) <= n; j++)
//		{
//			if (CalNP(a, j, len)>0)
//			{
//				P++;
//			}
//			else
//			{
//				N++;
//			}
//		}
//	}
//
//	cout << N<<endl;
//	cout << P;
//}


//int main()
//{
//	int a1, a2, k1, k2, n;
//
//	cin >> a1;
//	cin >> a2;
//	cin >> k1;
//	cin >> k2;
//	cin >> n;
//
//	//先比较k1和k2的大小
//	if (k1 <= k2)
//	{
//		if(k1)
//
//	}
//
//
//	cout << "Hello World!\n";
//}



Measured memory_bytes: 6528
#include <iostream>
using namespace std;
 
int main() {
  char S[4];
  cin >> S[0] >> S[1] >> S[2] >> S[3];
  if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2])
    cout << "Yes";
  
  else if (S[0] == S[2] && S[1] == S[3] && S[0] != S[1])
      cout << "Yes";
  
  else if (S[0] == S[3] && S[1] == S[2] && S[0] != S[1])
      cout << "Yes";
  
  else
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
# 文節の入力(整数として扱う)
a, b, c = map(int, input().split())
# まず長さが7の文節があるか確認
if a == 7 and b == 5 and c == 5:
	print("YES")
elif a == 5 and b == 7 and c == 5:
	print("YES")
elif a == 5 and b == 5 and c == 7:
	print("YES")
else:
	print("NO")

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

ll n,k;
ll a[111111];
ll sum[111111];
ll psum[111111];

int main(){
  cin.sync_with_stdio(false);
  cin>>n>>k;
  rep(i,n)cin>>a[i];
  rep(i,n){
    sum[i+1]=sum[i]+a[i];
    psum[i+1]=psum[i]+max(0LL,a[i]);
  }
  ll res=0;
  rep(i,n-k+1){
    maxch(res,max(0LL,sum[i+k]-sum[i])+psum[i]+psum[n]-psum[i+k]);
    //dbg(sum[i+k]-sum[i]);
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
using namespace std;

using UnWeightedGraph = vector<vector<int>>;

int main() {
    int n;
    cin >> n;
    UnWeightedGraph g(n);
    vector<pair<int, int>> vp;
    for (int i = 1; i < n; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
        vp.emplace_back(a, b);
    }
    vector<int> color(n, 0);
    vector<int> used(n, 0);
    map<pair<int, int>, int> mp;
    queue<int> que;
    que.push(0);
    used[0] = 1;
    int k = 0;
    while (!que.empty()) {
        int cur = que.front();
        que.pop();
        if (k < g[cur].size()) k = g[cur].size();
        int c = 1;
        for (int v : g[cur]) {
            if (used[v]) continue;
            if (c == color[cur]) c++;
            color[v] = c;
            mp[make_pair(cur, v)] = mp[make_pair(v, cur)] = c++;
            used[v] = 1;
            que.push(v);
        }
    }
    cout << k << endl;
    for (auto ans : vp) cout << mp[ans] << endl;
    return 0;
}


Measured memory_bytes: 20084
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<pair<pair<string, int >, int > > p(N);
    for(int i=0; i<N; ++i){
        string city="";
        int points = 0;
        cin >> city >> points;
        p[i] = make_pair(make_pair(city, -points), i);
    }
    sort(p.begin(), p.end());
    for(int i=0; i<N; ++i){
        cout << (p[i].second)+1 << endl;
    }   
    return 0;
}

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

#define ll long long

//use built in gcd function?
// int gcd(int a, int b)
// {
//     return (a? gcd(b % a, a):b);
// }
template<class T>
T gcd(T a, T b) {
	if (a == 0) return b;
	return gcd(b % a, a);
}

int main()
{
    ll a, b, n;
    cin >> a >> b;
    n = gcd(a, b);

    ll ans = 1;
    for (ll i = 2; i * i < n; i++)
    {
        if (!(n % i))
        {
            ans++;
            while (!(n % i)) n /= i;
        }
    }

    if (n != 1) ans++;
    cout << ans << "\n";
}

Measured memory_bytes: 3564
N,X,Y=map(int,input().split())

G=[[i+1] for i in range(N)]
G[N-1].pop()
for i in range(1,N):
    G[i].append(i-1)
G[X-1].append(Y-1)
G[Y-1].append(X-1)

from collections import deque

q=deque([])
cnt=[0]*N

for n in range(N-1):
    seen=[0]*N
    q.append([n,0])
    seen[n]=1
    while q:
        x,c=q.popleft()
        if c>=N-1:continue
        for g in G[x]:
            if seen[g]==0:
                q.append([g,c+1])
                seen[g]=1
                if n<g:
                    cnt[c+1]+=1
for i in range(1,N):
    print(cnt[i])


Measured memory_bytes: 84444
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,i,a,ma=0,ans=0;
  cin>>n;
  map<int,int> m;
  set<int> s;
  for(i=0;i<n;i++){
    cin>>a;
    if(ma<a) ma=a;
    if(m.count(a)) m.at(a)++;
    else m[a]=1;
  }
  for(auto z:m){
    if(!s.count(z.first)){
      if(z.second==1) ans++;
      for(i=1;i*z.first<=ma;i++) s.insert(i*z.first);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 57648
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<algorithm>
#include<cstring>

using namespace std;

int n,k;
vector<int> G[11];
int dp[21][5001];

int main(void){
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++){
		int c,g;
		scanf("%d%d",&c,&g);
		G[g].push_back(c);
	}
	for(int i=1;i<=10;i++)sort(G[i].begin(),G[i].end(),greater<int>());
	for(int i=1;i<=10;i++){
		for(int j=0;j<=k;j++){
			int sum=0;
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
			for(int t=0;t<G[i].size();t++){
				sum+=G[i][t];
				dp[i+1][j+t+1]=max(dp[i+1][j+t+1],dp[i][j]+sum+(t+1)*t);
			}
		}
	}
	printf("%d\n",dp[11][k]);
	return 0;
}

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

int main(){
    int a,b;
    double c;
    cin >> a >> b >> c;
    int d[a];
    double num1,num2=0.0,num3=1000000000;
    int ans=0;
    for(int i=0;i<a;i++){
        cin >> d[i];
        num1=b-d[i]*0.006;
        num2=abs(c-num1);
        if(num2<num3){
            num3=num2;
            ans=i;
        }
    }
    cout << ans+1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;

long double a = 0, b = 0, c = 1, x = 0, y = 0, z = 0, maxy = -1, mini = 9999, counter = 0,startp=0,endp=0,checker=0;
std::vector<unsigned long long int> vec{}, vecsec{};
unsigned long long int iremono[101];
std::vector<char>kinds{}, ans{}, kaku{};

bool okada = false,okada2=false;
std::string output, output2, input, one, two;
char cutcount[201];
int kakunou2[50][50] = {};

int ctoi(const char c) {
	if ('0' <= c && c <= '9') return (c - '0');
	return -1;
}
unsigned long long int LCM(unsigned long long int a, unsigned long long int b) {
	unsigned long long int i, j;
	i = a; j = b;
	while (true) {

		c = i % j;
		i = j;
		if (c != 0) {

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int main()
{
	cin >> a>>b;
	

	cout << a/b << endl;
		
}

	
	





Measured memory_bytes: 256
import java.util.Scanner;public class Main {	public static void main(String[] args) {		int n, k;		Scanner sc = new Scanner(System.in);		n = sc.nextInt();		k = sc.nextInt();		int[] T = new int[n];		for (int i = 0; i < n; i++) {			T[i] = sc.nextInt();		}		int P = slove(T, n, k);		System.out.println(P);	}	private static int slove(int[] T, int n, int k) {		int left = 0;		int right = 100000 * 10000;		int k1 = k;		int[] T1 = T;		int n1 = n;		while (right - left > 1) {			int mid = (left + right) / 2;			int v = check(mid, T1, k1, n1);			if (v >= n) 				right = mid;			else 				left = mid;		}		return right;	}	private static int check(int mid, int[] T1, int k1, int n1) {		int i = 0;		for (int j = 0; j < k1; j++) {			int S = 0;			while (S + T1[i] <= mid) {				S += T1[i];				i++;				if (i == n1)					return n1;			}		}		return i;	}}


Measured memory_bytes: 70908
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
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; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


signed main(void) 
{
    ll a, b;
    cin >>a >>b;
    if ((a+b) % 2 == 1) {
        mes("IMPOSSIBLE");
        re0;
    }
    mes((a+b)/2);
    
    
   
}


Measured memory_bytes: 3564
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>
#include<memory>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<double> VD;
typedef pair<int, int> P1;
typedef long long int ll;

//number
#define INF 1e9
#define NUM 1000000007

//itr
#define all(x) begin(x),end(x)

//repeat
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

//max,min
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/

//grid template
int x[] = { -1, 0, 1, 0 };
int y[] = { 0,-1,0,1 };
int xx[] = { -1,-1,1,1 };
int yy[] = { 1,-1,1,-1 };

int main () {
	int n, a, b;

	cin >>n>> a >> b;
	cout << min(a, b)<<" ";

	if (a+b>n) {
		cout << (a + b) - n << endl;
	} else {
		cout << 0 << endl;
	}

}


 

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int[] ans = new int[s.length];
        int rcnt = 1;
        for(int i = 1; i < s.length; i++){
            if(s[i] == 'R'){
                rcnt += 1;
            }else{
                ans[i-1] += rcnt/2 + rcnt%2;
                ans[i] += rcnt/2;
                rcnt = 0;
            }
        }
        int lcnt = 1;
        for(int i = s.length-2; i >= 0; i--){
            if(s[i] == 'L'){
                lcnt += 1;
            }else{
                ans[i+1] += lcnt/2 + lcnt%2;
                ans[i] += lcnt/2;
                lcnt = 0;
            }
        }
        for(int a : ans){
            System.out.print(a + " ");
        }
    }
}


Measured memory_bytes: 43944
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

#define MAX 1000000001

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

    ll n, w;
    
    cin >> n >> w;
    ll p[n+1], v[n+1];

    int max_v = 0;
    for(int i=0; i<n; ++i) {
        cin >> p[i] >> v[i];
        max_v += v[i];
    }
    
    ll dp[n+1][max_v+1];

    for(int i=n; i>=0; --i) {
        for(int j=0; j<=max_v; ++j) {
            if ( i == n ) {
                dp[i][j] = MAX;
            } else if( j - v[i] >= 0 ) {
                dp[i][j] = min( p[i] + ((j-v[i]==0)? 0 : dp[i+1][j-v[i]]), dp[i+1][j]) ;
            } else {
                dp[i][j] = dp[i+1][j];
            }
        }
    }
    ll ans = -1;
    for(int i=0; i<=max_v; ++i) {
        for(int j=0; j<=n; ++j) {
            if ( dp[j][i] <= w ) {
                ans = i;
            }
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 79232
#include <cstdio>

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

bool binarySearch(int A[], int l, int r, int key) {
    while (l < r) {
        int m = (l + r) / 2;
        if (key == A[m]) return true;
        if (key > A[m]) l = m + 1;
        else if (key < A[m]) r = m;
    }
    return false;
}

int main() {
    int n, q;
    scanf("%d", &n);
    int left = 0, right = n, sum = 0;
    int S[n];
    rep(i, n) scanf("%d", &S[i]);

    scanf("%d", &q);
    int T[q];
    rep(i, q) scanf("%d", &T[i]);
    for (int &key: T) {
        if (binarySearch(S, left, right, key)) sum++;
    }

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



Measured memory_bytes: 3180
#include<bits/stdc++.h>
using namespace std;
int main(void){
  string s;
  int n,k;
  cin >> n >> s >> k;
  char target = s[k-1];
  for(int i=0;i<n;i++){
    if(s[i]!=target){
      s[i] = '*';
    }
  }
  cout << s;
  return 0;
}


Measured memory_bytes: 256
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

ll gcd(ll a, ll b){
	if(!b) return abs(a);
	return gcd(b, a%b);
}

ll PowMod(ll a, ll n){
	if(n < 0) return PowMod(PowMod(a, -n), MOD-2);
	if(n == 0) return 1;
	if(n == 1) return a;
	if(n%2 == 0) return PowMod(a*a%MOD, n/2);
	return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll inv(ll a){
	return PowMod(a, MOD - 2);
}

int main(void){
	ll n;
	cin >> n;
	Vec a(n), b(n);
	rep(i, n) cin >> a[i] >> b[i];

	rep(i, n){
		ll g = gcd(a[i], b[i]);
		if(!g) continue;
		if(b[i] < 0) g = -g;
		if(b[i] == 0) g = a[i];
		a[i] /= g;
		b[i] /= g;
	}

	ll cnt = 0;
	map<P, P> mp;
	rep(i, n){
		if(a[i] == 0 && b[i] == 0){
			cnt++;
			continue;
		}
		if(a[i] > 0) mp[{a[i], b[i]}].fs++;
		else mp[{b[i], -a[i]}].sc++;
	}

	ll ans = 1;
	for(auto p : mp){
		//co(p.fs);
		//co(p.sc);
		(ans *= PowMod(2, p.sc.fs) + PowMod(2, p.sc.sc) - 1) %= MOD;
		//co(ans);
	}
	co((ans - 1 + cnt + MOD) % MOD);

	return 0;
}


Measured memory_bytes: 21800
def main():
    N = int(input())
    xList = []
    yList = []
    hList = []
    for i in range(N):
        x, y, h = list(map(int, input().split()))
        xList.append(x)
        yList.append(y)
        hList.append(h)
        if h > 0:
            x1 = x  
            y1 = y
            h1 = h
    
    for cx in range(100+1):
        for cy in range(100+1):
            H = h1 + abs(x1-cx) + abs (y1-cy)
            for x, y, h in zip(xList, yList, hList):
                if h != max(H-abs(x-cx)-abs(y-cy), 0):
                    break
            else:
                print(cx, cy, H)
                return

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
N=str(input())
Comp=[]
for i in range(3):
    Comp.append(int(N[i]))
if Comp[0]-Comp[1]<0:
    A=Comp[0]+1
if Comp[0]-Comp[1]>0:
    A=Comp[0]
if Comp[0]-Comp[1]==0:
    if Comp[1]-Comp[2]<0:
        A=Comp[1]+1
    else:
        A=Comp[1]
for i in range(3):
    print(A,end='')

Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		ArrayList<Integer> input = new ArrayList<Integer>();
		for(int i=0; i<5; i++){
			input.add(scanner.nextInt());
		}
		Collections.sort(input);
		Collections.reverse(input);
		System.out.println(input.get(0) + " " + input.get(1) + " " + input.get(2) + " " + input.get(3) + " " + input.get(4));
	}
}

Measured memory_bytes: 17372
#include <cstdio>

using namespace std;
int n,i,t[100004];
char s[100004];
int main()
{
    scanf ("%d\n", &n);
    scanf ("%s", &s);
    t[1]=0;
    t[2]=0;
    for (i=2;i<=n;i++)
    {
        if ((s[i-1]=='o' && t[i]==0) || (s[i-1]=='x' && t[i]==1))
            t[i+1]=t[i-1];
        else
            t[i+1]=(t[i-1]+1)%2;
    }
    if ((((s[0]=='o' && (t[2]-t[n])==0) || (s[0]=='x' && (t[2]-t[n])!=0))) && (t[n+1]==t[1]))
    {
        for (i=1;i<=n;i++)
        {
            if (t[i]==0)
                printf ("S");
            else
                printf ("W");
        }
        printf ("\n");
    }
    else
    {
        t[1]=0;
        t[2]=1;
        for (i=2;i<=n;i++)
        {
            if ((s[i-1]=='o' && t[i]==0) || (s[i-1]=='x' && t[i]==1))
                t[i+1]=t[i-1];
            else
                t[i+1]=(t[i-1]+1)%2;
        }
        if ((((s[0]=='o' && (t[2]-t[n])==0) || (s[0]=='x' && (t[2]-t[n])!=0))) && t[n+1]==t[1])
        {
            for (i=1;i<=n;i++)
            {
                if (t[i]==0)
                    printf ("S");
                else
                    printf ("W");
            }
            printf ("\n");
        }
        else
        {
            t[1]=1;
            t[2]=0;
            for (i=2;i<=n;i++)
            {
                if ((s[i-1]=='o' && t[i]==0) || (s[i-1]=='x' && t[i]==1))
                    t[i+1]=t[i-1];
                else
                    t[i+1]=(t[i-1]+1)%2;
            }
            if ((((s[0]=='o' && (t[2]-t[n])!=0) || (s[0]=='x' && (t[2]-t[n])==0))) && t[n+1]==t[1])
            {
                for (i=1;i<=n;i++)
                {
                    if (t[i]==0)
                        printf ("S");
                    else
                        printf ("W");
                }
                printf ("\n");
            }
            else
            {
                t[1]=1;
                t[2]=1;
                for (i=2;i<=n;i++)
                {
                    if ((s[i-1]=='o' && t[i]==0) || (s[i-1]=='x' && t[i]==1))
                        t[i+1]=t[i-1];
                    else
                        t[i+1]=(t[i-1]+1)%2;
                }
                if ((((s[0]=='o' && (t[2]-t[n])!=0) || (s[0]=='x' && (t[2]-t[n])==0))) && t[n+1]==t[1])
                {
                    for (i=1;i<=n;i++)
                    {
                        if (t[i]==0)
                            printf ("S");
                        else
                            printf ("W");
                    }
                    printf ("\n");
                }
                else
                    printf ("%d\n", -1);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	void solve() {
		int N;
		cin >> N;

		vector<int> a( N+1 );
		for( int x = 1; x*x <= N; ++x ) {
			for( int y = 1; y*y <= N; ++y ) {
				for( int z = 1; z*z <= N; ++z ) {
					int t = x*x + y*y + z*z + x*y + y*z + z*x;
					if( t <= N ) { a[t] += 1; }
				}
			}
		}

		for( int i = 1; i <= N; ++i ) {
			cout << a[i] << '\n';
		}
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////


ll i, j, k;

int main(){
    scanf("%lld%lld", &i, &j);
    printf("%lld\n", i * j);
    return 0;
}

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

vector < string > ditu;
int h,w;

struct cdt{
    int x,y;int t;
    cdt (int _x,int _y,int _t){x=_x;y=_y;t=_t;}
};

int solve(){
    queue < cdt > q;
    for(int i=1;i<=h;++i)
    for(int j=1;j<=w;++j)
    if(ditu[i][j]=='#'){
        q.push(cdt(i,j,0));
    }
    int ans=0;
    int x,y,nx,ny;
    while(!q.empty()){
        x=q.front().x;y=q.front().y;
        ans=q.front().t;
        q.pop();
        for(int way=0;way<4;++way){
            const static int dx[]={0,1,0,-1};
            const static int dy[]={1,0,-1,0};
            int nx=x+dx[way];
            int ny=y+dy[way];
            if(nx<1||nx>h||ny<1||ny>w)continue;
            if(ditu[nx][ny]=='#')continue;
            ditu[nx][ny]='#';
            q.push(cdt(nx,ny,ans+1));
        }
    }
    return ans;
}

void _prepare(){
    cin>>h>>w;
    ditu.resize(h+1);
    for(int i=1;i<=h;++i){
        cin>>ditu[i];
        ditu[i]='9'+ditu[i];
    }
}

int main(){
    ios::sync_with_stdio(0);
    _prepare();
    cout<<solve()<<endl;
    return 0;
}


Measured memory_bytes: 13328
#include <iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#include<set>
#include<map>
typedef long long int ll;
using namespace std;

int main(){
    int N;
    int saidai = 100000;
    int rel[saidai];
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> rel[i];
    }
    bool checked[saidai];
    for(int i=0;i<saidai;i++){
        checked[i]=false;
    }
    int ans=0;
    for(int i=0;i<N;i++){
        if(!checked[i]){
            checked[i]=true;
            if(rel[rel[i]-1]-1 == i){
                ans++;
                checked[rel[i]-1] = true;
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 768
def r2d(d):
    return d*360/2/math.pi

import math
a, b, h, m = map(int, input().split())
short = (h * (360 / 12)) + m * 1/2;

long = m * (360 / 60);

ang = abs(long - short);

ang = min(ang, (360 - ang))

res2 = a**2 + b**2 -2*a*b*math.cos(2*math.pi * (ang/360))

print(res2 ** 0.5)

Measured memory_bytes: 9516
x = range(int(input()))
P =[]
s = 0
for i in x:P += [[int(i) for i in input().split()]]
P+=[P[0]]
for i in x:s += P[i][0]*P[i+1][1] - P[i][1]*P[i+1][0]
print(s*0.5)

Measured memory_bytes: 7712
#include<stdio.h>
int main(){
  int n,sum=0,i;
  scanf("%d",&n);
  int a[n+1];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    sum+=a[i]-1;
  }
  printf("%d\n",sum);
  return 0;
}


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

using namespace std;
const int N=2e3+10;

int n, l, a[N], sum;

int main() {
	cin>>n>>l;
	for(int i=1; i<=n; i++) {
		a[i]=l+i-1;	
		sum+=a[i];
	}
	int tmp=0x3f3f3f3f;
	int ans;
	for(int i=1; i<=n; i++) {
		if (abs(a[i])<tmp) {
			tmp=abs(a[i]);
			ans=sum-a[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int n, d, x;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> d >> x;
	for(int i=0; i<n; ++i){
		int a;
		cin >> a;
		x += 1 + (d-1) / a;
	}
	cout << x << "\n";
}

Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
int main(void){
    long a,b,c,i,j,k;
    cin>>a>>b;
    long line1[a+1],line2[b+1];
    line1[0]=0;
    line2[0]=0;
    long dp[a+1][b+1];
    for(i=0;i<a;i++)
    cin>>line1[i+1];
    for(i=0;i<b;i++)
    cin>>line2[i+1];
    for(i=0;i<a+1;i++){
        for(j=0;j<b+1;j++){
            if(i==0||j==0){
                dp[i][j]=1;
                continue;
            }
            if(line1[i]==line2[j]){
                dp[i][j]=dp[i-1][j]+dp[i][j-1];
            }
            else
            dp[i][j]=dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1];
            dp[i][j]=dp[i][j]%1000000007;
        }
    }
    cout<<(dp[a][b]+1000000007)%1000000007<<endl;
}


Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n;cin>>n;
    ll mi=inf*inf;
    REP(i,1,sqrt(n)+1){
        if(n%i==0){
            mi=min(n/i+i,mi);
        }
    }
    cout<<mi-2<<endl;
}

Measured memory_bytes: 256