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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 100007;

struct iT
{
	bool operator < ( const iT &x ) const
	{
		return ( a - c ) > ( x.a - x.c );
	}

	int a, b, c;
}it[MAXN];

int n;
int na, nb, nc;
LL pl[MAXN], pr[MAXN];

void init ();
void input ();
void work ();



int main ()
{
	init ();
	input ();
	work ();
}



void init ()
{
	// Init Everything Here

	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method

	scanf ( "%d%d%d", &na, &nb, &nc );
	n = na + nb + nc;
	lpi ( i, 1, n ) scanf ( "%d%d%d", &it[i].a, &it[i].b, &it[i].c );
}

void work ()
{
	// main work

	sort ( it + 1, it + 1 + n );

	{
		priority_queue < int, AR ( int ), greater < int > > pq;
		lpi ( i, 1, na ) pl[na] += it[i].a - it[i].b, pq.push ( it[i].a - it[i].b );
		lpi ( i, na + 1, n ) {
			pl[i] = pl[i - 1];
			if ( it[i].a - it[i].b > pq.top () ) {
				pl[i] -= pq.top ();
				pq.pop ();
				pl[i] += it[i].a - it[i].b;
				pq.push ( it[i].a - it[i].b );
			}
		}
	}

	{
		priority_queue < int, AR ( int ), greater < int > > pq;
		lpd ( i, n, n - nc ) pr[n - nc + 1] += it[i].c - it[i].b, pq.push ( it[i].c - it[i].b );
		lpd ( i, n - nc, 0 ) {
			pr[i] = pr[i + 1];
			if ( it[i].c - it[i].b > pq.top () ) {
				pr[i] -= pq.top ();
				pq.pop ();
				pr[i] += it[i].c - it[i].b;
				pq.push ( it[i].c - it[i].b );
			}
		}
	}

	LL ans = -LINF;
	lpi ( i, na, n - nc ) ans = qmax ( ans, pl[i] + pr[i + 1] );
	lpi ( i, 1, n ) ans += it[i].b;
	cout << ans << endl;
}

Measured memory_bytes: 3072
#include <stdio.h>
 
int main(void) {
	int i,j,a,b,n,magic[15][15];
    while(1){
        for(i = 0;i < 15;i++){
            for(j = 0;j < 15;j++) magic[i][j] = 0;
        }
        scanf("%d",&n);
        if(!n) break;
        a = (n - 1) / 2;
        b = (n + 1) / 2;
        for(i = 1;i <= n * n;i++){
            magic[a][b] = i;
            a = (a + 1) % n;
            b = (b + 1) % n;
            if(magic[a][b] != 0){
                a = (a + n - 1) % n;
                b = (b + 1) % n;
            }
        }
        for(i = 0;i < n;i++){
            for(j = 0;j < n;j++) printf("%4d",magic[j][i]);
            printf("\n");
        }
    }
	return 0;
}

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

string str[10003]; int val[10003] , N;

int main(){
	cin >> N;
	for(int i = 1 ; i <= N ; ++i) cin >> str[i] >> val[i];
	string X; cin >> X;
	int sum = 0;
	for(int i = N ; i ; --i)
		if(str[i] == X){cout << sum << endl; break;}
		else sum += val[i];
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String input = new String(scanner.next());
		Integer output = input.lastIndexOf('Z') - input.indexOf('A') + 1 ;
		System.out.println(output);
		scanner.close();
	}
}


Measured memory_bytes: 26508
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int A = int.Parse(input[1]);
            int B = int.Parse(input[2]);
            int ans1;
            int ans2;

            ans1 = N * A;
            ans2 = B;

            int[] ans = { ans1, ans2 };
            int price = ans1;
            for (int i = 0; i < ans.Length; i++)
            {
                if (ans[i] <= price)
                {
                    price = ans[i];
                }
            }
            Console.WriteLine(price);
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;

int main()
{
    string S, T;
    cin >> S;
    cin >> T;
    cout << T << S;
    return 0;
}

Measured memory_bytes: 256
// 標準入力
var fs = require('fs'),
    length = fs.fstatSync(process.stdin.fd).size,
    buffer = new Buffer(length),
    bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
    input = buffer.toString('utf8', 0, bytesRead).split('\n');
main();

function main(){
 
var seats = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
var groupMembers = [2,5,2,2,2];
var eatTimes = [19,39,25,36,22,42];
 
var headGroup = -1;
var pastMinutes = 0;
var waitTime = [];
 
while(waitTime.length < 100){
  // たべおわる
  for(var i = 17; i--;){
    seats[i] = max(--seats[i], 0);
  }
 
  // 来店
  if(headGroup == -1 && pastMinutes % 5 == 0){
    headGroup = pastMinutes / 5;
  }
 
  // ちゃくせき
  while(headGroup != -1){
    var needsSequencialSeats = groupMembers[headGroup % 5];
    var sequencialSeats = 0;
    var startIndex = -1;
    for(var i = 0; i < seats.length; i++){
      sequencialSeats = seats[i] == 0 ? sequencialSeats + 1 : 0;
 
      if(sequencialSeats == needsSequencialSeats){
        startIndex = i - (needsSequencialSeats - 1);
        break;
      }
    }
 
    if(startIndex != -1){
      // すわれたみたい
      waitTime[headGroup] = pastMinutes - (headGroup * 5);
      for(var i = startIndex; i < (needsSequencialSeats + startIndex); i++){
        seats[i] = eatTimes[headGroup % 6];
      }
       
      headGroup = (((headGroup + 1) * 5) <= pastMinutes) ? headGroup + 1 : -1;
    }else{
      // すわれなかったみたい
      break;
    }
 
  }
 
  pastMinutes++;
 
}
 
for(var i = 0; i < (input.length - 1); i++){
  console.log(waitTime[parseInt(input[i], 10)]);
}
 
}

function max(a, b){
 var t = (a - b);
 return a - (t & (t >> 31));
}

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

int main(){
    int N, M;
    std::cin >> N >> M;
    std::vector< long long > X(N);
    std::vector< long long > Y(N);
    std::vector< long long > Z(N);
    for(int i=0; i<N; i++){
        std::cin >> X[i] >> Y[i] >> Z[i];
    }
    
    long long ans = -1e18;
    for(int pat=0; pat<8; pat++){
        std::vector< long long > score(N, 0);
        for(int i=0; i<N; i++){
            if(pat & 4){
                score[i] += X[i];
            }else{
                score[i] -= X[i];
            }
            
            if(pat & 2){
                score[i] += Y[i];
            }else{
                score[i] -= Y[i];
            }
            
            if(pat & 1){
                score[i] += Z[i];
            }else{
                score[i] -= Z[i];
            }
        }
        std::sort(score.begin(), score.end());
        
        long long score_M = 0;
        for(int i=0; i<M; i++){
            score_M += score[N - i - 1];
        }
        if(ans < score_M){
            ans = score_M;
        }
    }
    
    std::cout << ans << std::endl;
    
    
    return 0;
    
}


Measured memory_bytes: 3636
import heapq
X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)

done = {(0, 0, 0)}

hq = [(-(A[0]+B[0]+C[0]), 0, 0, 0)]
heapq.heapify(hq)  # リストhqのheap化

ans = 0
D = [(1, 0, 0), (0, 1, 0), (0, 0, 1)]

for _ in range(K):
    s, i, j, k = heapq.heappop(hq)  # heap化されたリストhqから最小値を削除＆その最小値を出力
    print(-s)
    for d in D:
        ni, nj, nk = i+d[0], j+d[1], k+d[2]
        if ni < X and nj < Y and nk < Z and (ni, nj, nk) not in done:
            # heap化されたリストhqに要素xを追加
            heapq.heappush(hq, (-(A[ni]+B[nj]+C[nk]), ni, nj, nk))
            done.add((ni, nj, nk))


Measured memory_bytes: 5108
import bisect

n=int(input())
a=sorted(list(map(int,input().split())))
b=(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for i in b:
    ta=bisect.bisect_left(a,i)
    tc=n-bisect.bisect_right(c,i)
    # print(i,ta,tc)
    ans+=ta*tc
print(ans)

Measured memory_bytes: 23744
#include<stdio.h>
int main(void) {
	int a, b, c, d, e, k;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &d);
	scanf("%d", &e);
	scanf("%d", &k);
	int box[10];
	box[0] = a - b;
	if (box[0] < 0) {
		box[0] = box[0] * (-1);
	}

	box[1] = a - c;
	if (box[1] < 0) {
		box[1] = box[1] * (-1);
	}

	box[2] = a - d;
	if (box[2] < 0) {
		box[2] = box[2] * (-1);
	}

	box[3] = a - e;
	if (box[3] < 0) {
		box[3] = box[3] * (-1);
	}

	box[4] = b - c;
	if (box[4] < 0) {
		box[4] = box[4] * (-1);
	}

	box[5] = b - d;
	if (box[5] < 0) {
		box[5] = box[5] * (-1);
	}


	box[6] = b - e;
	if (box[6] < 0) {
		box[6] = box[6] * (-1);
	}

	box[7] = c - d;
	if (box[7] < 0) {
		box[7] = box[7] * (-1);
	}

	box[8] = c - e;
	if (box[3] < 0) {
		box[3] = box[3] * (-1);
	}

	box[9] = d - e;
	if (box[9] < 0) {
		box[9] = box[9] * (-1);
	}
	int i;
	for (i = 0; i < 10; i++) {
		if (box[i] > k) {
			printf(":(\n");
			break;
		}
		else if (i == 9 && box[i] <= k) {
			printf("Yay!\n");
		}
	}

	return 0;

}

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

string sol;

void f(ll n)
{
}

int main()
{
    ll n;
    cin >> n;
    string sol(100, '0');
    while (n != 0)
    {
        if (n > 0)
        {
            ll i = 1, s = 1;
            while (s < n)
                i *= 4, s += i;
            n -= i;
            sol[__builtin_ctzll(i)] = '1';
        }
        else
        {
            ll i = 2, s = 2;
            while (s < -n)
                i *= 4, s += i;
            n += i;
            sol[__builtin_ctzll(i)] = '1';
        }
    }
    while (sol.size() > 1 && sol.back() == '0')
        sol.pop_back();
    reverse(all(sol));
    cout << sol;
}


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

int main() {
  int N;
  int a[110];
  cin>>N;
  for (int i=0;i<N;++i) cin>>a[i];
  sort(a,a+N,greater<int>());
  int A=0,B=0;
  for (int i=0;i<N;++i){
    if (i%2==0) A+=a[i];
    else B+=a[i];
  }
  cout<<A-B<<endl;
}

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

using namespace std;

#define debug printf("Debug\n");
#define ll long long
#define ull unsigned long long

#define pi acos(-1.0)
#define mod 1000000007

#define p_b(x) push_back(x)
#define m_p(x) make_pair(x,y)

#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define in_fre  freopen("in.txt", "r", stdin);
#define out_fre freopen("out.txt", "w", stdout);

struct Node{
    ll val,pos;
};
vector<ll>v;


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

    cout<<(a*b)/__gcd(a,b)<<endl;


    return 0;
}


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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n,k;cin>>n>>k;
  vector<ll>w(n),v(n);
  rep(i,0,n)cin>>w[i]>>v[i];
  auto dp=make_v(n,100001,INF);
  dp[0][0]=0;
  dp[0][v[0]]=w[0];
  rep(i,1,n){
    rrep(j,100001,0){
      chmin(dp[i][j],dp[i-1][j]);
      if(j>=v[i])chmin(dp[i][j],dp[i-1][j-v[i]]+w[i]);
    }
  }
  rep(i,0,100001){
    if(dp[n-1][i]<=k)chmax(res,i);
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 79488
#include <bits/stdc++.h>
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

//定数
//円周率
const double pi = 3.141592653589793238462643383279;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 100000000000000000; // = 10^17
//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";
//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7
//前処理テーブルの大きさ指定
const int MAX = 1200000; // = 10^6 + 2*(10^5)
//ちなみに、1024MBで持てる最大長の配列は10^8程度

//データ構造
//隣接リスト用構造体（有向グラフ向け）
struct edge {
  ll to; // E.toでその辺の終点へアクセスできる。
  ll cost; // e.costでその辺の重みにアクセスできる。
};
//Union_Find木
struct UnionFind {
  vector<int> UF; // UF.at(i) : iの親の番号
  vector<int> SIZE; // SIZE.at(root(i)) : iと連結されてる要素の数
  UnionFind(int N) : UF(N), SIZE(N, 1) { // 最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      UF.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (UF.at(x) == x) {
      return x;
    }
    return UF.at(x) = root(UF.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry) {
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    }
    // xとyの根が同じでない(=同じ木にない)時：小さい方の根を大きい方の根につける。
    if (SIZE.at(rx) < SIZE.at(ry)) {
      UF.at(rx) = ry;
      SIZE.at(ry) += SIZE.at(rx);
      SIZE.at(rx) = 0;
    }
    else {
      UF.at(ry) = rx;
      SIZE.at(rx) += SIZE.at(ry);
      SIZE.at(ry) = 0;
    }
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す。
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { // xと連結されてる要素の数を返す。
    return SIZE.at(root(x));
  }
};

//関数 (計算量)
//ctoi (O(1))
int ctoi(char c){
  if (c == '0') return 0;
  if (c == '1') return 1;
  if (c == '2') return 2;
  if (c == '3') return 3;
  if (c == '4') return 4;
  if (c == '5') return 5; 
  if (c == '6') return 6;
  if (c == '7') return 7;
  if (c == '8') return 8;
  if (c == '9') return 9;
  return -1;  
}
//to_char (O(1))
char to_char(int i){
  if (i == 0) return '0';
  if (i == 1) return '1';
  if (i == 2) return '2';
  if (i == 3) return '3';
  if (i == 4) return '4';
  if (i == 5) return '5';
  if (i == 6) return '6';
  if (i == 7) return '7';
  if (i == 8) return '8'; 
  if (i == 9) return '9';
  return ' ';  
}

//メイン処理
int main() {
  cout << fixed << setprecision(16); //精度向上
  //ここまでテンプレ
  int N, T;
  cin >> N >> T;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  vector<int> M(N);
  M.at(N - 1) = A.at(N - 1);
  for (int i = N - 2; i >= 0; i--) {
    M.at(i) = max(M.at(i + 1), A.at(i));
  }
  for (int i = 0; i < N; i++) {
    A.at(i) = (M.at(i) - A.at(i));
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  int C = 1;
  for (int i = 0; i < N - 1; i++) {
    if (A.at(i) == A.at(i + 1)) {
      C++;
    }
    else {
      break;
    }
  }
  cout << C << endl;
}

Measured memory_bytes: 4008
//PDF解説に倣って全探索
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,k;
  cin>> n >> k;
  vector<int> v(n);
  for (int i=0; i<n; i++) cin>> v.at(i);
  
  int num=min(n,k);
  int ans=0;
  for (int l=0; l<=num; l++){ //左から取る個数
    for (int r=0; r<=num-l; r++){ //右から取る個数
      priority_queue<int> q;
      int sum=0;
      int remain=k-l-r;
      for (int i=0; i<l; i++){
        int var=v.at(i);
        sum+=var;
        if (var<0) q.push(-var);
      }
      for (int i=0; i<r; i++){
        int var=v.at(n-1-i);
        sum+=var;
        if (var<0) q.push(-var);
      }
      while (!q.empty() && remain>0){
        sum+=q.top();
        q.pop();
        remain--;
      }
      ans=max(ans,sum);
    }
  }
  
  cout<< ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 10002
#define TRUE 1
#define FALSE 0

int search(int *a, int n, int key){
  int i;
  a[n]=key;

  while(a[i]!=key){
    i++;
    if(i==n) return FALSE;
  }

  return TRUE;
}

int main(){
  int q,i,sum=0,a[N],n,key;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(search(a,n,key)==TRUE) sum++;
  }

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

  return 0;
}


Measured memory_bytes: 2108
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)


n = int(input())
A = input().split()
if n%2==0:
    print(' '.join(A[1::2][::-1]),end=' ')
    print(' '.join(A[::2]))
else:
    print(' '.join(A[::2][::-1]),end=' ')
    print(' '.join(A[1::2]))

Measured memory_bytes: 24924
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n; cin >> n;
    set<string> st;
    int over = 0;
    REP(i, n) {
        int tmp;
        cin >> tmp;
        switch (tmp) {
            case 1 ... 399:
                st.insert("gray");
                break;
            case 400 ... 799:
                st.insert("brown");
                break;
            case 800 ... 1199:
                st.insert("green");
                break;
            case 1200 ... 1599:
                st.insert("sky");
                break;
            case 1600 ... 1999:
                st.insert("blue");
                break;
            case 2000 ... 2399:
                st.insert("yellow");
                break;
            case 2400 ... 2799:
                st.insert("orange");
                break;
            case 2800 ... 3199:
                st.insert("red");
                break;
            default:
                over++;
        }
    }
    cout << max(1, (int) st.size()) << " " << (int) st.size() + over << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() { 
    string s;
    cin >> s;
    int res = 0;
    for (auto ss : s) {
        if (ss == '1') res++;
    }
    cout << res << endl;
}




Measured memory_bytes: 3612
#include <stdio.h>
#include <math.h>

int main(void)
{
  double x1,y1,x2,y2;
  double distance;

  scanf("%lf %lf %lf %lf",&x1, &y1, &x2, &y2 );

  distance = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) );

  printf( "%30.30lf\n",distance );

  return 0;
}



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


void solve(long long K, std::string S){
    cout << S.substr(0, K);
    if (S.length() > K)
    {
        cout << "...";
    }
    cout << endl;
    return;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
    scanf("%lld",&K);
    std::string S;
    std::cin >> S;
    solve(K, S);
    return 0;
}


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

int main(){
  int h, w, y;
  int routex, routey;
  char temp;
  cin >> h >> w;
  vector<vector<int>> board(200, vector<int>(200, 0));
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> temp;
      if(temp == '.') board.at(i).at(j) = 0;
      else board.at(i).at(j) = 1;
    }
  }
  vector<vector<int>> dp(200, vector<int>(200, 0));
  int now, prex, prey;
  for(int s = 1; s < h+w-1; s++){
    for(int x = 0; x <= s; x++){
      y = s - x;
      now = board.at(x).at(y);
      if(x == 0) routex = 100000;
      else{
        prex = board.at(x-1).at(y);
        routex = dp.at(x-1).at(y) + abs(prex - now);
      }
      if(y == 0) routey = 100000;
      else{
        prey = board.at(x).at(y-1);
        routey = dp.at(x).at(y-1) + abs(prey - now);
      }
      dp.at(x).at(y) = min(routex, routey);
    }
  }
  int ans = dp.at(h-1).at(w-1);
  ans /= 2;
  if(board.at(0).at(0) == 1 || board.at(h-1).at(w-1) == 1) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();

        int r = in.nextInt();
        int c = in.nextInt();

        int[] rSum = new int[c + 1];

        for (int i = 0; i < r; i++) {
            int cSum = 0;
            for (int j = 0; j < c; j++) {
                int num = in.nextInt();
                cSum += num;
                rSum[j] += num;
                rSum[c] += num;
                sb.append(num).append(" ");
            }
            sb.append(cSum).append("\n");
        }
        for (int i = 0; i < rSum.length; i++) {
            sb.append(rSum[i]);
            sb.append(i == c ? "\n" : " ");
        }

        System.out.print(sb.toString());
    }
}

Measured memory_bytes: 30568
/*
  AOJ #2706
  @kankichi573
 */
#include <stdio.h>
#include <float.h>
#include <math.h>

int gcd(int a, int b)
{
        int c;

        while (b > 0) {
                c = a % b;
                a = b;
                b = c;
        }

        return a;
}

void factorize(int number,int fact[],int *nfact)
{
  int d;

  *nfact=0;
  d=2;
  while(number>1)
    {
      if(d > sqrt(number))
	{
	  fact[(*nfact)++]=number;
	  break;
	}
      if((number % d)==0)
	{
	  fact[(*nfact)++]=d;
	  while((number % d)==0)
	    number /= d;
	}

	if(d==2)
	  d=3;
	else
	  d+=2;
    }
}

int main()
{
  int i;
  int p,q,g,fact[1000],nf,ret;
  
  scanf("%d %d",&p,&q);
  g = gcd(p,q);
  q /= g;
  
  factorize(q,fact,&nf);
  //printf("nf=%d\n",nf);
  for(i=0,ret=1;i<nf;i++)
    ret *= fact[i];

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

  return(0);

}

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

using u64 = std::uint64_t;
constexpr u64 inf = std::numeric_limits<u64>::max();

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

namespace io {
  constexpr int is = 1 << 17;
  char ib[is], *ip = ib + is, it;
  inline char getc() {
    if (ip == ib + is) { read(STDIN_FILENO, ib, is); ip = ib; }
    return *ip++;
  }
  inline u64 scan() {
    u64 r = 0;
    if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
    else while ((it = *ip++) & 16) r = r * 10 + it - '0';
    return r;
  }
  constexpr int os = 1 << 17;
  char ob[os], *op = ob, ot;
  inline void putc(const char c) {
    *op++ = c;
    if (op == ob + os) { write(STDOUT_FILENO, ob, os); op = ob; }
  }
  /* x shoud be greater than or equal to zero */
  inline void print(u64 x) {
    char d[20];
    int i = 0;
    while (true) {
      d[i] = x % 10 + 48;
      x /= 10;
      ++i;
      if (x <= 0) break;
    }
    while (i--) {
      putc(d[i]);
    }
  }
  inline void flush() {
    write(STDOUT_FILENO, ob, op - ob);
  }
}

using P = pair<u64, u64>;

u64 collect(const vector<vector<u64>> &G, const vector<u64> &H, u64 u, u64 v, u64 p) {
  if (u == v) return 0;
  for (auto e : G[u]) {
    u64 t = H[e] ^ u;
    if (t == p) continue;
    u64 s = collect(G, H, t, v, u);
    if (s != inf) {
      return s | (1ULL << e);
    }
  }
  return inf;
}

u64 search(u64 n, u64 j, u64 m, u64 mask, vector<u64> &paths) {
  if (j < m) {
    return (
      search(n, j + 1, m, mask, paths)
    - search(n, j + 1, m, mask | paths[j], paths)
    );
  } else {
    return 1ULL << (n - 1 - __builtin_popcountll(mask));
  }
}

signed main() {
  u64 n = io::scan();
  auto G = vector<vector<u64>>(n);
  auto H = vector<u64>(n);
  REP(i, n - 1) {
    u64 a = io::scan() - 1;
    u64 b = io::scan() - 1;
    G[a].push_back(i);
    G[b].push_back(i);
    H[i] = a ^ b;
  }
  u64 m = io::scan();
  auto paths = vector<u64>(m);
  REP(j, m) {
    u64 u = io::scan() - 1;
    u64 v = io::scan() - 1;
    paths[j] = collect(G, H, u, v, -1);
  }
  u64 ans = search(n, 0, m, 0, paths);
  io::print(ans);
  io::flush();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll h, w, n;
    cin >> h >> w >> n;
    ll cnt = max(h, w);
    cout << ((n + (cnt - 1)) / cnt) << endl;
    
    return 0;
}


Measured memory_bytes: 256
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        if 4*h*n-N*n-N*h!=0:
            w = N*h*n/(4*h*n-N*n-N*h)
            if w == int(w) and w >= 1:
                print(h, n, int(w))
                exit()


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

const ll INF = 1e17;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n + 1, 0);
    for (int i = 0; i < n; i++) {
        cin >> h[i + 1];
    }
    ll dp[310][310], ans = INF;
    fill(dp[0], dp[310], INF);
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n + 1 - k; j++) {
            if (j == 0) {
                dp[i][j] = 0;
            } else if (j == 1) {
                dp[i][j] = h[i];
            } else
                for (int l = 0; l < i; l++) {
                    dp[i][j] = min(dp[i][j], dp[l][j - 1] + max(0, h[i] - h[l]));
                }
        }
        ans = min(ans, dp[i][n + 1 - k]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
using namespace std;
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;

int main()
{
    ll n, k, s;
    cin >> n >> k >> s;
    vector<ll> a(n);
    for (ll i = 0; i < n;i++){
        if(k>0){
            a[i] = s;
            k--;
        }
        else{
            if(s==1000000000){
                a[i] = s - 1;
            }
            else{
                a[i] = s + 1;
            }

        }
    }
    for (ll i = 0; i < n; i++)
    {
        cout << a[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 2048
public class Main {
	public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();

		int cnt = 0;
		if (B == 1 || B == 0) {
			System.out.println("0");
			return;
		}

		if (A >= B) {
			System.out.println("1");
		} else {
			for (int i=0; i < B;i++) {
				if (A + (A-1) * i >= B) {
					System.out.println(i+1);
					break;
				}
			}
		}

	}
}

Measured memory_bytes: 21844
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class Task {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int res = 1;
            for (int i = 0; i < s.length() - 1; i++) {
                if (s.charAt(i) != s.charAt(i + 1)) {
                    res++;
                }
            }
            out.println(res);
        }

    }
}



Measured memory_bytes: 24276
#include<stdio.h>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

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

  // nC2 + mC2
  int num = n*(n-1) / 2 + m * (m-1) / 2;
  cout << num;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

import static java.lang.StrictMath.abs;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        double[] ans = new double[331];
        ans[0] = 0;
        double a = 0;
        double b =0;

       for(double i =1; i< 33; i++){
           for(double k = 2; k < 10; k++){
               a = Math.pow(i,k);
               if(a<=x&& x-a < x- b){
                   b =a;
  
               }
           }

       }
        System.out.println((int)b);



        }

    }

Measured memory_bytes: 21844
#include<cstdio>
#include<cmath>
#include<iostream>

using namespace std;

signed main(){
    int n;
    double ret = 100000;
    scanf( "%d", &n );
    while( n > 0 ){
        ret *= 1.05;
        ret = ceil( ret / 1000 ) * 1000;
        n--;
    }
    printf( "%.0f\n", ret  );
    return 0;    
}


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

int main()
{  
    ll N; cin >> N;
    ll a_c = 0;
    ll w_c = 0;
    ll t_c = 0;
    ll r_c = 0;
    rep(i,N) {
        string S; cin >> S;
        if (S == "AC") a_c++;
        else if (S == "WA") w_c++;
        else if (S == "TLE") t_c++;
        else r_c++;
    }
    cout << "AC x " << a_c << endl;
    cout << "WA x " << w_c << endl;
    cout << "TLE x " << t_c << endl;
    cout << "RE x " << r_c << endl;



 

}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long 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() {
    char s;
    cin >> s;
    s = s-'0';
    s += 1;
    s = s + '0';
    cout << s << endl;
}

Measured memory_bytes: 3636
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	cin >> K;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; i + j <= N; j++) {
			if (i * 10000 + j * 5000 + (N - i - j) * 1000 == K) {
				cout << i << " " << j << " " << N - i - j << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1\n";
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   
    int T=1;
    //cin >> T;
    while(T--){
       ll r;
       cin>>r;
       ld p=acos(-1);
       cout<<fixed<<setprecision(10)<<2*p*r<<el;
    }

    return 0;
}

Measured memory_bytes: 3800
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const int INF = 1e9;

int main() {
    int n;
    cin >> n;
    VI a(n), b(n);
    REP(i,n) a[i] = in();
    REP(i,n) b[i] = in();
    VVI dp(1 << n, VI(n, INF));
    REP(i,n){
        dp[1 << i][i] = i;
    }
    REP(mask,1<<n) REP(i,n){
        if (dp[mask][i] == INF) continue;
        int x = 0;
        REP(j,n) if ((mask >> j) & 1) x++;
        int p = ((i + x) % 2 == 1 ? a[i] : b[i]);
        int cost = 0;
        REP(j,n){
            if ((mask >> j) & 1) continue;
            int q = ((j + x) % 2 == 0 ? a[j] : b[j]);
            if (p <= q) chmin(dp[mask | (1 << j)][j], dp[mask][i] + cost);
            cost++;
        }
    }
    int ans = INF;
    REP(i,n) chmin(ans, dp[(1 << n) - 1][i]);
    if (ans == INF) ans = -1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 26880
#pragma region includes
#include <bits/stdc++.h>
#pragma endregion
#pragma region defines
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
#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 ALL(v) v.begin(), V.end()
template <class T>
void CO(T value) {
  cout << value << endl;
}
#pragma endregion

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;

  ll cnt = 0;

  REP(i, K) {
    if (A > 0) {
      cnt++;
      A--;
      continue;
    } else if (B > 0) {
      B--;
      continue;
    } else if (C > 0) {
      cnt--;
      C--;
      continue;
    }
  }

  CO(cnt);
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
using namespace std;
int main(){
	int o=0,n=0;
	string sen;
	while(cin>>sen){
	for(int i=0;i<=sen.size()-3;i++){
		if(sen[i]=='J' &&sen[i+1]=='O'&&sen[i+2]=='I') o++;
		else if(sen[i]=='I' &&sen[i+1]=='O'&&sen[i+2]=='I') n++;
	}
	cout<<o<<endl<<n<<endl;
	o=0;n=0;
}
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<sstream>
using namespace std;
  
#define sf scanf
#define pf printf
#define pfn printf("\n");
#define pfk printf(" ");
#define pf0 printf("0");
#define pf1 printf("1");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfdd(n,m) scanf("%d%d",&n,&m);
#define sfld(n) scanf("%lld",&n);
#define sfldd(n,m) scanf("%lld%lld",&n,&m);
#define sflf(n) scanf("%lf",&n);
#define sflff(n,m) scanf("%lf%lf",&n,&m);
#define sfc(n) scanf("%c",n);
#define sfcc(n,m) scanf("%c%c",n,m);
#define sfs(n) scanf("%s",n);
#define sfss(n,m) scanf("%s%s",n,m);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);
  
#define csh(a,n) memset(a,n,sizeof(a));
char arr[30001];
int main(){
	int n;
	cin>>n;
	
	int b=n/1.08;
	for(int i=b-1;i<b+2;i++){
		if(int(i*1.08)==n){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<":("<<endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

signed main() {
	int n, a[10], mi = 100000000000000000, mii = -1;
	cin >> n;
	for (int i = 0; i < 5; i++) {
		cin >> a[i];
		if (mi >= a[i]) {
			mi = a[i];
		}
	}
	if (n <= mi) cout << 5 << endl;
	else if (n%mi == 0) cout << n / mi + 4 << endl;
	else cout << n / mi + 5 << endl;

	END;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define y1 shinkle
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<20|1;
inline char gc(){
    static char ibuf[RLEN],*ib,*ob;
    (ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob)?EOF:*ib++;
}
#define gc getchar
inline int read(){
    char ch=gc();
    int res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
    return f?res:-res;
}
inline ll readll(){
    char ch=gc();
    ll res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
    return f?res:-res;
}
inline int readstring(char *s){
	int top=0;char ch=gc();
	while(isspace(ch))ch=gc();
	while(!isspace(ch)&&ch!=EOF)s[++top]=ch,ch=gc();
	s[top+1]='\0';return top;
}
template<typename tp>inline void chemx(tp &a,tp b){a=max(a,b);}
template<typename tp>inline void chemn(tp &a,tp b){a=min(a,b);}
cs int N=15;
int n,m,x;
int s[N],c[N],a[N][N];
int main(){
	n=read(),m=read(),x=read();
	for(int i=1;i<=n;i++){
		c[i]=read();
		for(int j=1;j<=m;j++)a[i][j]=read();
	}int ans=1e9;
	for(int i=0;i<(1<<n);i++){
		memset(s,0,sizeof(s));int res=0;
		for(int j=1;j<=n;j++)if(i&(1<<(j-1))){res+=c[j];
			for(int k=1;k<=m;k++)s[k]+=a[j][k];
		}int fg=1;
		for(int j=1;j<=m;j++)if(s[j]<x)fg=0;
		if(fg)chemn(ans,res);
	}if(ans==1e9)ans=-1;
	cout<<ans<<'\n';
}

Measured memory_bytes: 3636
HWs = readlines.map(&:chomp).map{|s|s.split.map(&:to_i)}

def f(a,b)
  ra=a[1]**2+a[2]**2
  rb=b[1]**2+b[2]**2
  if ra>rb then return true end
  if a[1] > b[1]
    return true
    else
    return false
    end
end

HWs.each{|hh,ww|
  if hh==0 && ww==0 then break end
  rr=hh**2+ww**2
  cands = []
  1.upto(150){|h|
    (h+1).step{|w|
      if h==hh and w==ww then next end
      r = h**2 + w**2
      if r >= rr
        cands.push([r,h,w])
        break
      end
    }
  }
  #rr_min = cands.min_by{|rr,h,w| rr}[0]
  #min = cands.select{|rr,h,w|
  #  if rr == rr_min
  #    h>=hh
  #  else rr_min > rr
  #  end}.min_by{|rr,h,w| h}
  #puts min[1..2]*' '
  puts cands.select{|x| f(x, [rr, hh, ww])}.min_by{|rr,h,w| if w>h then rr*1000+h else 1/0.0 end}[1..2]*' '
}


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

unsigned long long sum(unsigned long long n){return (n * (n + 1))/2;}

int main (){
  int n;
  cin >> n;
  unsigned long long ans = 0;
  ans = sum(n) - sum(n/3) * 3 - sum(n/5) * 5 + sum(n/15) * 15;
  cout << ans << endl;
}


Measured memory_bytes: 3632
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; (i)<(n); ++(i))
#define rep1(i, n) for(int i = 1; (i)<(n); ++(i))
#define rev_rep(i, n) for(int i = (n) - 1; (i) >= 0; --(i))
#define range(a, i, b) for(int i = (a); (i) < (b); ++(i))
#define dump(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()
#define readl(N) ll N; cin >> N
#define readlv(N, vec) vector<ll> vec(N); rep(i, N){cin >> vec[i];}
#define greater_than [](ll l, ll r){return l > r;}
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair);
template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair){
  os << '(' << pair.first << ',' << pair.second << ')';
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(ll i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::set<T>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

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

#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  string s, t;
  cin >> s >> t;
  auto it = s.begin();
  it += s.size() - t.size();
  // dump(*it);
  while(it >= s.begin()){
    bool ok = true;
    rep(i, t.size()){
      if(!(t[i] == *(it + i) || '?' == *(it + i))){
        ok = false;
      }
    }
    if(ok){
      rep(i, t.size()){
        *it = t[i];
        it++;
      }
      break;
    }
    it--;
  }
  // dump(s);
  // dump( * it);
  if(it + 1 == s.begin()){
    bool hasques = false;
    rep(i, s.size()){
      if(s[i] == '?'){
        hasques = true;
      }
    }
    if(hasques){
      cout << "UNRESTORABLE";
      return 0;
    }else{
      cout << s;
      return 0;
    }
  }
  rep(i, s.size()){
    if(s[i] == '?'){
      s[i] = 'a';
    }
  }
  cout << s;
}
#endif


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

int main(){
    vector<int> x = {1, 4, 7, 9};
    vector<int> y(4);
    for (int i = 0; i < 4; i++) cin >> y[i];
    sort(y.begin(), y.end());
    if (x == y) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 200001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

int main(){
  ll a,b; cin >> a >> b; ll ans = 0;
  
  for(ll i=b-a-1; i >= 1; i--) ans += i;
  
  cout << ans - a << endl;
  
  
}

Measured memory_bytes: 3640