akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
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; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int d,t,s;cin >> d >> t >> s;
    if(t*s>=d){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

using namespace std;


int main(void){
	int N;
	cin >> N;
	int d[N];
	int ans = 0;
	int i,j;
	for(i=0;i<N;i++){
		cin >> d[i];
	}
	
	for(i=0;i<N;i++){
		for(j = i+1; j < N; j++){
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
	
	return 0;
}


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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i) // ROF(i,n,0)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで降順
#define pb push_back
#define eb emplace_back
#define fst first
#define snd second
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;
constexpr ll mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>T add(const T &a, const T &b){return (a+b)%mod;}

signed main(){
  int n, a, b;
  cin >> n >> a >> b;
  if(n*a>b) cout << b << endl;
  else cout << n*a<< endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left, bisect_right
from functools import lru_cache, reduce
MOD = int(1e9)+7
INF = float('inf')


def solve():
    n = int(input())
    s = input()
    p = [0] * n
    r = [0] * n
    for i in range(n):
        if i: p[i] += p[i-1]
        if s[i] == '#': p[i] += 1
    for i in range(n-1,-1,-1):
        if i+1<n: r[i] += r[i+1]
        if s[i] == '.': r[i] += 1
    ans = min(p[-1], r[0])
    for i in range(n-1):
        ans = min(ans, p[i] + r[i + 1])
    print(ans)
    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""
1
4
-1 1 1 -1

"""


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

#define MIN(a,b) ((a)<(b)?(a):(b))

void merge(vector<pair<int,int> >& w, int left, int mid, int right) {
	vector<pair<int,int> > L,R;
	int n1=mid-left;
	int n2=right-mid;
	int i=0,j=0,k;
	L.resize(n1+1);
	R.resize(n2+1);
	for(i=0; i<n1; ++i) {
		L[i]=w[left+i];
	}
	L[n1].first = -1;
	L[n1].second = 1000000001;
	for(i=0; i<n2; ++i) {
		R[i]=w[mid+i];
	}
	R[n2].first = -1;
	R[n2].second = 1000000001;

	i=j=0;
	for(k=left; k<right; ++k) {
		if(L[i].second < R[j].second) {
			w[k]=L[i];
			++i;
		} else {
			w[k]=R[j];
			++j;
		}
	}
	return;
}

void mergeSort(vector<pair<int,int> >& w, int left, int right) {
	if(left+1<right) {
		int mid=left+(right-left)/2;
		mergeSort(w,left,mid);
		mergeSort(w,mid,right);
		merge(w,left,mid,right);
	}
	return;
}

int main() {
	int n;
	int i,j;
	int total=0;
	int subtotal,c;
	vector<int> checker;
	vector<pair<int,int> > w; // first=original_index, second =weight_value will be sorted.
	scanf("%d",&n);
	w.resize(n);
	checker.resize(n);
	for(i=0; i<n; ++i) {
		checker[i]=0;
		w[i].first=i;
		scanf("%d",&w[i].second);
	}
	mergeSort(w,0,n);
	for(i=0; i<n; ++i) {
		if(checker[i]==1 || w[i].first==i) {
			continue; // already checked or unmoved
		}
		c=subtotal=0;
		checker[i]=1;
		j=w[i].first;
		while(j!=i) {
			subtotal+=w[i].second+w[j].second;
			checker[j]=1;
			j=w[j].first;
			++c;
		}
		total+=MIN(subtotal,subtotal-w[j].second*(c-2)+w[0].second*(c+2));
	}
	printf("%d\n",total);
	return 0;
}

Measured memory_bytes: 2776
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vi a(n); for(auto& e : a) cin >> e;

    int res = a[0];
    for(auto& e : a) res = __gcd(res, e);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
typedef long long ll;
 
ll calc(ll A) {
	ll cnt = (A + 1) / 2;
	ll ans = cnt % 2;
	if (A % 2 == 0) ans ^= A;
	return ans;
}
 
int main() {
	ll A, B;
	cin >> A >> B;
	ll ans = calc(B) ^ calc(A - 1);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
int main(void) {
	int k[] = {1, 5, 10, 50, 100, 500};
	int sum = 0;
	for (int i=0; i<6; i++) {
		int c;
		cin >> c;
		sum += c*k[i];
	}
	if (sum >= 1000) {
		puts("1");
	}
	else {
		puts("0");
	}
}

Measured memory_bytes: 1116
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower, islower
#include <math.h>

#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
//using ll = long long; using ld = long double;
//using P = pair<int, int>;

long long h,w;
long long sx,sy,gx,gy;
string s;
bool mat[1005][1005];
bool vis[1005][1005];
int dr[4] = {0, 0, -1, 1};
int dc[4] = {-1, 1, 0, 0};

bool valid(long long r, long long c) {
    return r >= 0 && r < h && c >= 0 && c < w; 
}

void solve(){
    cin >> h >> w;
    cin >> sy >> sx;
    cin >> gy >> gx; 
    sy--; sx--; gy--; gx--;
    for (int i = 0; i < h; ++i) {
        cin >> s;
        rep(j, w) {
            mat[i][j] = (s[j] == '.');
        }
    }

    deque<pair<pair<long long, long long>, long long>> q;
    q.push_front(make_pair(make_pair(sy,sx),0));

    while (!q.empty()) {
        pair<pair<long long, long long>, long long> x = q.front();
        pair<long long, long long> pos = x.first;
        q.pop_front();

        if (vis[pos.first][pos.second]) continue;
        vis[pos.first][pos.second] = 1;
        
        if (pos.first == gy && pos.second == gx ) {
            cout << x.second << endl;
            return;
        }

        for (int d = 0; d < 4; ++d) {
            long long nr = pos.first + dr[d];
            long long nc = pos.second + dc[d];

            if (valid(nr, nc) && mat[nr][nc] && !vis[nr][nc]) {
                    q.push_front(make_pair(make_pair(nr, nc), x.second));
            }
        }

        for (long long dr = -2; dr <= 2; ++dr) {
            for (long long dc = -2; dc <=2; ++dc) {
                long long nr = pos.first + dr;
                long long nc = pos.second + dc;
                if (valid(nr, nc) && mat[nr][nc] && !vis[nr][nc]) {
                    q.push_back(make_pair(make_pair(nr, nc), x.second + 1));
                }
            }
        }
    }

    cout << -1 << endl;
}

int main(){

    solve();
    
}


Measured memory_bytes: 7152
# -*- coding: utf-8 -*-

#----------
X = int(input().strip())
#----------
candidate=set()
max_num = int( 1000**(1/2) )
for i in range( 1, max_num + 1 ):
    for j in range( 2, max_num + 1 ):
        calc = i**j
        
        if calc <= 1000:
            candidate.add(i**j)

ans=0
for i in candidate:
  if i <= X and ans < i:
    ans = i

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
#define N 200010
using namespace std;

ll k, n, ans1 = INT_MAX, ans2 = INT_MAX, a[N];

inline ll read(){
	ll s = 0, w = 1;
	char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) w *= ch == '-' ? -1 : 1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) s = s * 10 + ch - '0';
	return s * w;
}

inline void work(){
	k = read(), n = read();
	REP(i, 1, n) a[i] = read();
	sort(a + 1, a + n + 1);
	ans1 = a[n] - a[1];
	ans2 = k - (a[n] - a[1]) + k - a[2];
	REP(i, 2, n - 1) ans1 = min(ans1, a[i] - a[1] + a[1] + k - a[i + 1]);
	REP(i, 2, n - 1) ans2 = min(ans2, k - a[i] + a[i - 1]);
	printf("%lld\n", min(ans1, ans2));
}

int main(){
	work();
	return 0;
}

Measured memory_bytes: 1792
while True:
  n,m=map(int,input().split())
  if n==0 and m==0:
    break
  tarou=[]
  hanako=[]
  kumit=[]
  kumih=[]
  wa=[]
  for i in range(n):
    tarou.append(int(input()))
  for i in range(m):
    hanako.append(int(input()))
  for i in range(n):
    a=tarou[i]
    for j in range(m):
      b=hanako[j]
      x=sum(tarou)-a+b
      y=sum(hanako)-b+a
      if x==y:
        kumit.append(tarou[i])
        kumih.append(hanako[j])
        wa.append(tarou[i]+hanako[j])
  if wa!=[]:
    for i in range(len(wa)):
      if wa[i]==min(wa):
        print(kumit[i],kumih[i])
        break
  else:
    print(-1)


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

using lint = long long;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<vector<T>>;
#define rep(i, n) for(int i = 0; i < int(n); i++)
#define repu(i, a, b, s) for(int i = int(a); i < int(b); i += int(s))
#define repd(i, a, b, s) for(int i = int(a); i > int(b); i += int(s))
#define endl "\n"
constexpr lint INF = 2e18;
constexpr lint MOD = 1e9 + 7;

void solve() {
    string S;
    lint Q;

    cin >> S >> Q;

    deque<char> ans;
    rep(i, S.size()) { ans.push_back(S[i]); }

    bool flag = false;
    rep(i, Q) {
        lint t;
        cin >> t;

        if(t == 1) {
            flag = !flag;
        } else {
            lint f;
            char c;
            cin >> f >> c;

            if((f == 1 and (not flag)) or (f == 2 and flag)) {
                ans.push_front(c);
            } else {
                ans.push_back(c);
            }
        }
    }

    string ans_s;
    while(not ans.empty()) {
        if(not flag) {
            ans_s += ans.front();
            ans.pop_front();
        } else {
            ans_s += ans.back();
            ans.pop_back();
        }
    }

    cout << ans_s << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}

Measured memory_bytes: 4252
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        int[] a = new int[N];
        float check = 0;
        for(int i = 0 ; i < N ; i++)
        {
            a[i] = sc.nextInt();
            check += a[i];
        }
        check = check*(1/(4f*M));
        int count = 0;
        for(int i = 0 ; i < N ; i++)
        {
            count += (a[i] >= check) ? 1 : 0;
        }
        System.out.println(count >= M ? "Yes" : "No");
    }
}


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

int main() {
  string s; cin >> s;
  if(s=="Sunny") cout << "Cloudy" << endl;
  if(s=="Cloudy") cout << "Rainy" << endl;
  if(s=="Rainy") cout << "Sunny" << endl;
  return 0;
}



Measured memory_bytes: 256
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)


a, b, c, d = map(int, input().split())
cd = lcm(c,d)
ans = 0
ans += ((b // c) - ((a-1) // c))
ans += ((b // d) - ((a-1) // d))
ans -= ((b // cd) - ((a-1) // cd))
ans = (b - a + 1) - ans

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>
#include <cstring>
#include <stack>

using namespace std;

/********** TEMPLATE STARTS HERE ***********/

#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back

template <typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template <typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

/*********** TEMPLATE ENDS HERE *************/

#define int long long

multiset <int> s;

int next_power(int n)
{
	int l = log2(n);
	return (1 << (l + 1));
}

main()
{
	int n;
	cin >> n;
	
	for(int i = 1; i <= n; i++)
	{
		int x;
		cin >> x;
		
		s.insert(x);
	}
	
	int nr_pairs = 0;
	
	while(s.size())
	{
		int x = *s.rbegin();
		s.erase(s.find(x));
		
		int p = next_power(x);
		
		if(s.find(p - x) != s.end()) 
		{
			nr_pairs++;
			s.erase(s.find(p - x));
		}
	}
	
	cout << nr_pairs;
}

Measured memory_bytes: 9984
#include<stdio.h>
int main(){
    int N, K;
 
    int a[200002];
    scanf("%d %d", &N, &K);

    for (int i=0; i<N; i++){
        scanf ("%d", a + i);
    }

    for (int i=K; i<N; i++){
        if (a[i] > a[i - K]){
            printf ("Yes\n");
        }
        else {
            printf ("No\n");
        }
    }
    return 0;
}

Measured memory_bytes: 2428
#include<iostream>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	string s,ans="";
	cin>>s;
	rep(i,s.size()){
		ans+=s[s.size()-i-1];
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> h(N);
  for(int i=0; i<N; i++){
	cin >> h.at(i);
  }
  
  vector<int> ans(N);
  ans.at(0) = 0;
  ans.at(1) = abs(h.at(0)-h.at(1));
  for(int i=2; i<N; i++){
      ans.at(i) = min(ans.at(i-2)+abs(h.at(i-2)-h.at(i)), ans.at(i-1)+abs(h.at(i-1)-h.at(i)));
  }
  cout << ans.at(N-1) << endl;
}

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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(br.readLine());
        int h=t/(60*60);
        int m=t%(60*60)/60;
        int s=t%60;
        System.out.println(h+":"+m+":"+s);
    }

}

Measured memory_bytes: 24372
#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include <numeric>
#include <iomanip>
#include<vector>
typedef long long ll;
ll Isprime(ll x) {
	ll i;
	if (x < 2)return 0;
	else if (x == 2) return 1;
	if (x % 2 == 0) return 0;
	for (i = 3; i*i <= x; i += 2) {
		if (x%i == 0) return 0;
	}
	return 1;
}
using namespace std;
int main() {
	ll N;
	cin >> N;
	vector<ll>v;
	v.push_back(1);
	for (ll i = 6; i <= 100000; i *= 6) {
		v.push_back(i);
	}
	for (ll i = 9; i <= 100000; i *= 9) {
		v.push_back(i);
	}
	sort(v.begin(), v.end());
	ll dp[100010];
	for (ll i = 1; i <= N; ++i) {
		dp[i] = N;
	}
  	dp[0]=0;
	for (ll n = 1; n <= N; ++n) {
		for (ll i = 0; i < v.size(); ++i) {
          if(n-v[i]>=0)
			dp[n] = min(dp[n], dp[n - v[i]]+1);
		}
	}
  	cout<<dp[N]<<endl;
}

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

#define ONLINE_JUDGE
#define ll long long
#define PI 3.14159265359
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define pb(a) push_back(a)

//////////// Solution /////////////////////////////////

void solve() {
	vector<pair<int,int>> vec;
	int n,m;
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		int a,b;
		cin >> a >> b;
		vec.pb(make_pair(a,b));
	}

	sort(vec.begin(), vec.end());
	ll ans = 0;
	for (int i = 0; i < n && m > 0; ++i) {
		ans += 1LL * vec[i].first * min(vec[i].second, m);
		m -= min(vec[i].second, m);
	}

	cout << ans << '\n';
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 1400
def main():
  import sys
  input=sys.stdin.buffer.readline
  h,w=map(int,input().split())
  s=[c//8for _ in range(h)for c in input()[:w]]
  dp=[10**9]*h*w
  dp[0]=5-s[0]
  for i in range(h):
    for j in range(w):
      k=i*w+j
      if j+1<w:
        t=dp[k]+(s[k]^s[k+1])
        if dp[k+1]>t:dp[k+1]=t
      if i+1<h:
        t=dp[k]+(s[k]^s[k+w])
        if dp[k+w]>t:dp[k+w]=t
  print(dp[-1]+1>>1)
main()

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

bool addsum ;

void add( int& ret, char c){
  if(c == 'A'){
    if(ret >= 11) ret++;
    else ret += 11, addsum = true;
  }else if(c == 'T'|| c == 'J' || c == 'Q' || c == 'K'){
    ret += 10;
  }else{
    ret += c - '0';
  }
  if(ret >= 22 && addsum){
    addsum = false; ret -= 10;
  }
}


int main(){
  int q;
  cin >> q;
  while(q--){
    addsum = false;
    int ret = 0;
    char buff;

    queue< char > que;
    for(int i = 0 ; i < 10 ; i++ ){
      cin >> buff;
      que.push( buff );
    }

    for(int i = 0 ; i < 2 ; i++ ){
      add( ret, que.front()); que.pop();
    }

    if(ret == 21){
      cout << "blackjack\n";
      continue;
    }else if((ret >= 18 || (ret == 17 && !addsum)) && ret <= 21){
      cout << ret << endl;
      continue;
    }else if(ret > 21){
      cout << "bust" << endl;
      continue;
    }

    for(int i = 0; ; i++){
      char c = que.front(); que.pop(); //ふえぇぇ
      add( ret, c);
      if((ret >= 18 || (ret == 17 && !addsum)) && ret <= 21){
        cout << ret << endl;
        break;
      }else if(ret > 21){
        cout << "bust" << endl;
        break;
      }else if(i == 7){
        cout << ret << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 1200
#include <stdio.h>

int main(void)
{
	double a, b, s;
	double tubo;
	
	scanf("%lf %lf", &a, &b);
	
	s = a * b;
	tubo = s / 3.305785;
	
	printf("%f\n", tubo);

	return (0);
}

Measured memory_bytes: 644
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

/*-----------Main-----------*/

func main() {
	s := readS()
	var ans [3]int
	a := 0
	for i := 0; i < len(s); i++ {
		if s[i] == 'R' {
			ans[a]++
		} else if s[i] == 'S' {
			a++
		}
	}

	b := 0
	for i := 0; i < len(ans); i++ {
		if b < ans[i] {
			b = ans[i]
		}
	}
	fmt.Println(b)
}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}


Measured memory_bytes: 1780
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d);
	i := 0
	for a > 0 && c > 0 {
		if i % 2 == 0 {
			c -= b
		} else {
			a -= d
		}
		i++
	}
	if a <= 0 {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}


Measured memory_bytes: 1768
import sys
input = sys.stdin.readline
from collections import *
from heapq import *

for _ in range(int(input())):
    N = int(input())
    ans = 0
    dl = defaultdict(list)
    dr = defaultdict(list)
    
    for _ in range(N):
        K, L, R = map(int, input().split())
        m = min(L, R)
        ans += m
        
        if L==m:
            dr[K+1].append(R-m)
        else:
            dl[K].append(L-m)
        
    pq = []
    
    for i in range(N, 0, -1):
        for v in dl[i]:
            heappush(pq, -v)
        
        if len(pq)>0:
            ans += -heappop(pq)
    
    pq = []
    
    for i in range(1, N+1):
        for v in dr[i]:
            heappush(pq, -v)
        
        if len(pq)>0:
            ans += -heappop(pq)
    
    print(ans)

Measured memory_bytes: 143792
#include <iostream>

using namespace std;
#define long long long

const int N = 3e6 + 10;
const int MOD = 1e9 + 7;

constexpr int popcnt(int x) {return __builtin_popcount(x);}
constexpr int bit(int i, int mask) {return (mask >> i) & 1;}

int n, a[25][25];
long dp[N];

int main()
{
//    freopen("tam.inp", "r", stdin);
    cin.tie(nullptr); ios_base::sync_with_stdio(false);

    cin >> n;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j) cin >> a[i][j];

    int tmp = 1 << n; dp[0] = 1;
    for (int mask = 0; mask < tmp; ++mask) {
        int row = popcnt(mask);
        for (int i = 0; i < n; ++i) if (!bit(i, mask) && a[row][i]) {
            int newMask = mask ^ (1 << i);
            dp[newMask] = (dp[newMask] + dp[mask]) % MOD;
        }
    }
    cout << dp[tmp - 1];

    return 0;
}


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

int main(){
    string s, t;
    cin >> s >> t;
    for (int i=0;i<s.size();i++){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner S = new Scanner(System.in);
    int N = S.nextInt();
    int L = S.nextInt();
    int sum = N*(L - 1) + N*(N+1)/2;
    if( (L <= 0) & (0 <= L+N-1)){
      System.out.println(sum);
    }
    if( 0 < L ){
      System.out.println(sum - L);
    }
    if( L+N-1 < 0 ){
      System.out.println(sum - L-N+1);
    }
  }
}

Measured memory_bytes: 23252
from collections import deque


class Dinic:
    """
    1-indexed
    din = Dinic(N)
    for _ in range(M):
        s,t,cap = map(int,input().split())
        din.add_edge(s,t,cap)
    ans = din.get_maximumFlow(source, sink)
    """

    def __init__(self, N):
        self.N = N
        self.edge = [[] for _ in range(N + 1)]
        self.level = [-1] * (N + 1)

    def add_edge(self, v_from, v_to, cap):
        self.edge[v_from].append([v_to, cap, len(self.edge[v_to])])
        self.edge[v_to].append([v_from, 0, len(self.edge[v_from]) - 1])

    def _BFS(self, s):
        """
        sからの最短距離をBFSで計算する  
        """
        level = [-1] * (self.N + 1)
        level[s] = 0
        que = deque([s])
        while que:
            s = que.popleft()
            for t, cap, _ in self.edge[s]:
                if cap > 0 and level[t] < 0:
                    level[t] = level[s] + 1
                    que.append(t)
        self.level = level[:]

    def _DFS(self, v, goal, f):
        """
        増加パスをDFSで探す
        """
        if v == goal:
            return f
        for i in range(self.iterate[v], len(self.edge[v])):
            self.iterate[v] = i
            to, cap, rev = self.edge[v][i]
            if cap > 0 and self.level[v] < self.level[to]:
                d = self._DFS(to, goal, min(cap, f))
                if d > 0:
                    self.edge[v][i][1] -= d
                    self.edge[to][rev][1] += d
                    return d
        return 0

    def get_maximumFlow(self, s, t):
        """
        s -> tの最大流を求める
        1-indexed
        """
        self.goal = t
        inf = 10**18
        flow = 0
        while True:
            self._BFS(s)
            if self.level[t] < 0:
                return flow
            self.iterate = [0] * (self.N + 1)
            while True:
                f = self._DFS(s, t, inf)
                if f <= 0:
                    break
                flow += f


if __name__ == "__main__":
    N = int(input())
    din = Dinic(2 * N + 10)
    red = [tuple(map(int, input().split())) for _ in range(N)]
    blue = [tuple(map(int, input().split())) for _ in range(N)]

    source = 2 * N + 1
    sink = source + 1

    for i, (xi, yi) in enumerate(red):
        for j, (xj, yj) in enumerate(blue):
            if xi < xj and yi < yj:
                s = i + 1
                t = j + 1 + N
                din.add_edge(s, t, 1)
    for i in range(1, N + 1):
        din.add_edge(source, i, 1)
        din.add_edge(i + N, sink, 1)

    ans = din.get_maximumFlow(source, sink)
    print(ans)


Measured memory_bytes: 3956
def main():
    N, K = map(int, input().split())

    m = [0] * (N+2)
    for i in range(1, N+1)[::-1]:
        me = m[i+1]
        while i * 2 ** me < K:
            me += 1
        m[i] = me

    ans = 0
    for i in range(1, N+1):
        ans += 1 / 2 ** m[i] 
    print(ans / N)


main()

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int>a(2*m);
  for(int i; i<2*m; i++){
    cin >> a.at(i);
  }
  vector<int>b(n);
  for(int i; i<2*m; i++){
    int c = a.at(i);
    b.at(c-1)++;
  }
  for(int x : b){
    cout << x << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int a, b;
	char op;
	while (1) {
		cin >> a >> op >> b;
		if (op == '?') {
			break;
		}
		if (op == '+') {
			cout << a + b << endl;
		}
		else if (op == '-') {
			cout << a - b << endl;
		}
		else if (op == '*') {
			cout << a * b << endl;
		}
		else if (op == '/') {
			cout << a / b << endl;
		}
	
	}
	
	return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=20000000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long max(long long a,long long b){
	if(a<b)return b;
	else return a;	
}
long long min(long long a,long long b){
	if(a>b)return b;
	else return a;	
}
long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	else return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a*b/gcd(a,b);
}

long long com(long long n,long long k){
	
}
long long getDigit(long long n){
	if(n==1)return 1;
	else return log10(n)+1;
}

class Point{
public:
	long long x;
	long long y;
};


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long a,b,x;
	cin>>a>>b>>x;
	
	long long A=a/x;
	if(a%x==0)A--;
	long long B=b/x;
	cout<<B-A<<endl;
}


Measured memory_bytes: 256
/*
 _____ _             _              _           _ 
|_   _| |__   ___   / \   _ __  ___| |__  _   _| |
  | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  | | | | | |  __// ___ \| | | \__ \ | | | |_| | |
  |_| |_| |_|\___/_/   \_\_| |_|___/_| |_|\__,_|_|                                                

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll,ll>
#define msi         map<string,ll>
#define mis         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x) 	for(auto& a : x)
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define max(a,b)	(a>b?a:b)
#define min(a,b)	(a<b?a:b)

/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace __gnu_pbds;
using namespace std;
#define PI 3.141592653589793
#define N  105
ll dp[N][N][2];
bool mat[N][N];
ll n,m;
ll fun(ll x,ll y,bool f)
{
	if(x==n && y==m)
	{
		return (f!=mat[x][y]);
	}
	if(x>n || y>m || mat[x][y]!=f)
	{
		return hell;
	}
	if(dp[x][y][f]!=-1)
		return dp[x][y][f];
	if(f)
	{
		dp[x][y][f]=min(min(fun(x+1,y,f),fun(x+1,y,!f)),min(fun(x,y+1,f),fun(x,y+1,!f)));
	}
	else
	{
		dp[x][y][f]=min(min(fun(x+1,y,f),fun(x+1,y,!f)+1),min(fun(x,y+1,f),fun(x,y+1,!f)+1));
	}
	return dp[x][y][f];
}
void solve()
{
	cin>>n>>m;
	char ch;
	rep(i,1,n+1)
	{
		rep(j,1,m+1)
		{
			cin>>ch;
			mat[i][j]=(ch=='.'?0:1);
		}
	}
	rep(i,0,n+1)
	{
		rep(j,0,m+1)
		{
			rep(k,0,2)
			dp[i][j][k]=-1;
		}
	}
	cout<<min(fun(1,1,0),fun(1,1,1)+1);	
	return;
}
int main()
{
	FAST
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	TIME
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int H[N];
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  int count=0;
  for(int i=1;i<N;i++){
    bool X=true;
    for(int j=0;j<i;j++){
      if(H[j]>H[i]){
        X=false;
      }
    }
    if(X){
      count++;
    }
  }
  cout << count+1;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b) {
	if (a % b == 0) {
		return(b);
	}
	else {
		return(gcd(b, a % b));
	}
}

template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}

int main(void) {
	ll a;
	double b;
	cin >> a >> b;
	ll b_ = 100 * (b+ 0.000001);
	cout << (a * b_) / 100 << endl;
}

/*
1000000000000000001
*/


Measured memory_bytes: 3708
#include <iostream>
#include <vector>
#include <array>
#include <queue>

#include <boost/range/algorithm.hpp>

using namespace std;

namespace brng = boost::range;

int main(void)
{
  vector<int> v;
  int r = 0;
  for(int i = 0; i < 3; i++){
    int t;
    cin >> t;
    if(brng::find(v, t) == v.end()){
      ++r;
      v.push_back(t);
    }
  }
  cout << r << endl;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int A,B,C;
	cin >> A>>B>>C;
	bool can = false;
	//5が2つ,７が1つかどうかを判定
	int count_5 = 0;
	int count_7 = 0;

	if (A == 5) {
		count_5++;
	}
	if (A == 7) {
		count_7++;
	}
	if (B == 5) {
		count_5++;
	}
	if (B == 7) {
		count_7++;
	}
	if (C == 5) {
		count_5++;
	}
	if (C == 7) {
		count_7++;
	}

	if ((count_5==2)&&(count_7==1)) {
		can = true;
	}

	if (can) {
		cout << "YES" << endl;
	}else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue> 
using namespace std;
int main() 
{string a[3];
 for (int i=0;i<3;i++)
 cin>>a[i];
 cout<<a[0][0]<<a[1][1]<<a[2][2];
 system("pause");
 return 0;
}        


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

lli n, m, k;

int main(void){
	cin >> n >> m >> k;
	rep(i, n+1){
		rep(j, m+1){
			if(i*m + j*n - 2*i*j == k){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
signed solve(){
  Int n;
  cin>>n;
  vector<Int> as(n);
  for(Int i=0;i<n;i++) cin>>as[i];

  string s;
  cin>>s;

  vector<Int> bs;
  for(Int i=n-1;i>=0;i--){
    Int a=as[i];
    for(Int b:bs)
      chmin(a,a^b);

    if(s[i]=='0'){
      if(a!=0) bs.emplace_back(a);
    }

    if(s[i]=='1'){
      if(a!=0){
        cout<<'1'<<newl;
        return 0;
      }
    }
  }
  cout<<'0'<<newl;
  return 0;
}

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

  Int T;
  cin>>T;
  while(T--) solve();

  return 0;
}


Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const ll mod = 1e9+7;

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

    vector<vector<int>> G(n);
    rep(i,n-1){
        int a,b;
        cin >>a >>b;
        --a;
        --b;
        G[a].pb(b);
        G[b].pb(a);
    }

    rep(i,n){
        if(G[i].size() > k){
            cout << 0 << "\n";
            return 0;
        }
    }

    ll ans = k;
    vector<int> par(n,-1);
    queue<int> que({0});
    while(!que.empty()){
        int now = que.front();
        que.pop();
        ll m = k-2;
        if(now == 0) m = k-1;

        for(int e:G[now])if(e != par[now]){
            (ans *= m) %= mod;
            --m;
            par[e] = now;
            que.push(e);
        }
    }

    cout << ans << "\n";
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define int long long

signed main(){
    int a, b;
    cin >> a >> b;
    cout << 6 - a - b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N;
ll K, A[1000000], B[1000000], res;

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	sort(A, A + N);
	sort(B, B + N, greater<>());
	ll l = -1, r = 1e18;
	while (l + 1 != r) {
		ll c = 0;
		ll m = (l + r) / 2;
		for (int i = 0; i < N; i++) {
			if (A[i] * B[i] > m) {
				c += A[i] - m / B[i];
			}
		}
		if (c > K) {
			l = m;
		}
		else {
			r = m;
		}
	}
	cout << r << endl;
}

Measured memory_bytes: 6016
#include <iostream>

using namespace std;

int main() {
  int n, m;
  int a[55], b[55];
  int c[55], d[55];
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }
  for (int i = 0; i < n; i++) {
    int p = 1000000000;
    int q = -1;
    for (int j = 0; j < m; j++) {
      int x = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (x < p) {
        p = x;
        q = j + 1;
      }
    }
    cout << q << endl;
  }
  return 0;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
#define len length
#define ret0 return 0
#define ret return 

#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)

#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>

// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;

#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)1e5+5

void solve(){
    ll n;
    cin>>n;
    ll a[n];
    ll b[n];
    loop(i,0,n){
        cin>>a[i];
        b[i]=a[i];
    }
    sort(b, b+n);
    ll mx1=b[n-1];
    ll mx2=b[n-2];
    loop(i,0,n){
        if(a[i]!=mx1){
            print(mx1);
        }
        else if(a[i]==mx1){
            print(mx2);
        }
    }
}

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

    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
        
   
}



Measured memory_bytes: 4736
//
//  main.cpp
//  HelloWorld
//
//  Created by purple on 2020/04/13.
//  Copyright © 2020 Purple. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <cmath>

using namespace std;

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


    int n;
    cin >> n;
    
    long long int a[n];
    for(int i=0; i<n; i++) cin >> a[i];
    
    long long int min,max,sum=0;
    
    sort(a,a+n);
    
    min = a[0];
    max = a[n-1];
    
    for(int i=0; i<n; i++){
        sum += a[i];
    }
    
    cout << min << " " << max << " " << sum << endl;
    
    return 0;
    
}



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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ANS(ans) cout << ans << endl
#define FLG(flg) if(flg) cout << "Yes" << endl; else cout << "No" << endl;
#define YES cout << "Yes" << endl;
#define NO cout << "No" << endl;
#define COUT(s) cout << s << endl;
#define AN vector<int> a(n); for(int i = 0; i < n; i++) cin >> a[i];
#define IN  int n;  cin >> n;
#define VI  vector<int> 
#define SS stringstream ss;
#define SOLVE cout << solve() << endl;


int main() {
    IN
    AN
    long long sum = 0;
    for(int i = 0; i < n; i++) {
        for(int j = i + 1; j < n; j++) {
            sum += a[i] * a[j];
        }
    }
    COUT(sum)
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100005
#define NIL -1

struct Node {
  int p,l,r;
};//;必要。

struct Node T[MAX];
int n,D[MAX];

void print(int u){//接点u
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);

  if(T[u].p == NIL)
    printf("root, ");
  else if(T[u].l == NIL)
    printf("leaf, ");
  else printf("internal node, ");

  printf("[");

  for(i = 0, c = T[u].l; c != NIL; i++, c = T[c].r ){
    if(i)
      printf(", ");
    printf("%d",c);
  }
  printf("]");
  printf("\n");
}

void rec(int u,int p){//再帰
  D[u] = p;
  if(T[u].r != NIL)
    rec(T[u].r,p);
  if(T[u].l != NIL)
    rec(T[u].l,p + 1);
}

int main(){
  int i,j;
  int d,v,c,l,r;

  scanf("%d",&n);
  
  for(i = 0; i < n; i++) T[i].p = T[i].l = T[i].r = NIL;
  for(i = 0; i < n; i++){
    scanf("%d%d",&v,&d);
    for(j = 0; j < d; j++){
      scanf("%d",&c);
      if(j == 0)
	T[v].l=c;
      else T[l].r = c;
      l = c;
      T[c].p = v;
    }
  }
  for(i = 0; i < n; i++){
    if(T[i].p == NIL)
      r = i;
  }
  rec(r,0);

  for(i = 0; i < n;i ++)
    print(i);

  return 0;
}
  




Measured memory_bytes: 6380
//Robs Code
/***********HEADER***************/
#include<bits/stdc++.h>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define mxsz 10000007
#define mxval 1e9
#define grt [](auto x,auto y){return x>y;}
#define pii pair<int,int>
/*********VARIABLE****************/
using namespace std;
int i,j,n,m,k,l,q,t,a,b,sum[3],tot[3],cnt[3];
/***********MAIN******************/
signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>a>>b>>t;
    cout<<(t/a)*b;
	return 0;
}
//.........


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

int straight(int card[])
{
	for(int i=1; i<9; i++){
		if(((card[0]==i)&&(card[1]==i+1)&&(card[2]==i+2)&&(card[3]==i+3)&&(card[4]==i+4)) || 
			(card[0]==1&&card[1]==10&&card[2]==11&&card[3]==12&&card[4]==13))
			return 1;
	}
	return 0;
}

int main(){
	int c[5], n;
	char k;

	while(1){
		cin>>c[0]>>k>>c[1]>>k>>c[2]>>k>>c[3]>>k>>c[4];
		if(cin.eof())break;
		n=0;
		sort(c, c+5);

		for(int i=0; i<4; i++){
			for(int j=i+1; j<5; j++){
				if(c[i]==c[j])
					n++;
			}
		}
		switch(n){
			case 1:
				cout<<"one pair\n";
				break;
			case 2:
				cout<<"two pair\n";
				break;
			case 3:
				cout<<"three card\n";
				break;
			case 4:
				cout<<"full house\n";
				break;
			case 6:
				cout<<"four card\n";
				break;
			case 10:
				cout<<"four card\n";
				break;
			default:
				if(straight(c))
					cout<<"straight\n";
				else
					cout<<"null\n";
				break;
		}
	}

	return 0;
}

Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
int h1,m1,h2,m2,k;
int main()
{
	scanf("%d%d%d%d%d",&h1,&m1,&h2,&m2,&k);
	printf("%d",(h2-h1)*60+m2-m1-k);
	return 0;
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

int main(void){
	int N;
	cin >> N;
	vector<int> d(N);
	for(int i=0;i<N;i++)cin >> d[i];
	sort(ALL(d));
	//Nは偶数である
	cout << d[N/2]-d[(N/2)-1] << endl;
}

Measured memory_bytes: 640
// ※※※ 解答不能 ※※※
// snuke氏.
// https://atcoder.jp/contests/abc165/submissions/12672402
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
const int MAX_N = 200005;
const int INF = 1001001001;

vector<int> a, ans, G[MAX_N];
int dp[MAX_N];

void dfs(int v, int p = -1){
    int i = lower_bound(dp, dp + MAX_N, a[v]) - dp;
    int old = dp[i];
    dp[i] = a[v];
    ans[v] = i;
    if(p != -1) ans[v] = max(ans[v], ans[p]);
    for(int u : G[v]){
        if(u == p) continue;
        dfs(u, v);
    }
    dp[i] = old;
}

int main(){
    int n;
    scanf("%d", &n);
    a = ans = vector<int>(n);
    rep(i, n) scanf("%d", &a[i]);
    rep(i, n - 1){
        int u, v;
        scanf("%d %d", &u, &v);
        --u;
        --v;
        G[v].pb(u);
        G[u].pb(v);
    }
    rep(i, MAX_N) dp[i] = INF;
    dp[0] = -INF;
    dfs(0);
    rep(i, n) printf("%d\n", ans[i]);
    return 0;
}

Measured memory_bytes: 30812
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
using namespace std;
#define REP(i,n); for(int i = 0;i < (int)(n);i++)

vector<vector<char>> a;
int h,w;
int hantei(int i,int j);
int main() {
	char buf;
	int ans=1;
	cin >> h >> w;
	a.resize(h);
	REP(i,h){
		REP(j,w){
			cin >> buf;
			a[i].push_back(buf);
		}
	}
	REP(i,h){
		REP(j,w){
			if(a[i][j]=='#'){
				ans = min (ans,hantei(i,j));
			}
		}
	}
	if(ans==1)cout << "Yes";
	else cout << "No";
	return(0);
}
int hantei(int i,int j){
	int re =0;
	if(i>0){
		if(a[i-1][j]=='#')re = max (1,re);
	}
	if(i<h-1){
		if(a[i+1][j]=='#')re = max (1,re);
	}
	if(j>0){
		if(a[i][j-1]=='#')re = max (1,re);
	}
	if(j<w-1){
		if(a[i][j+1]=='#')re = max (1,re);
	}
	return re;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
int arr[t], ans[t+1];
for(int i=1; i<=t; i++) ans[i]=0;
for(int i=1; i<t; i++) cin >> arr[i];
for(int i=1; i<t; i++) ans[arr[i]]++;
for(int i=1; i<=t; i++) cout << ans[i] << "\n";
return 0;
}

Measured memory_bytes: 5148
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 > 8 || b > 8){
                System.out.println(":(");
            }else{
                System.out.println("Yay!");
            }
            
        }
    }

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

int main () {
    for(int i; i<3000; i++) {
        int a, b; cin >> a >> b;
         if(a==0 && b==0) break;
         cout << min(a, b) << " " << max(a, b) << endl;
    }
    
    return 0;
}


Measured memory_bytes: 2992