akhauriyash/Code-Regression huggingface dataset:
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//abc163E

void swap(long long *a, long long *b) {
  long long temp=*a;
  *a=*b, *b=temp;
}

void QuickSort(long long A[], long long B[], long long left, long long right) { //クイックソート//
  int Left=left, Right=right, pivot=A[(left + right) / 2];
  while(1){ // ソーティング
    while(A[Left] < pivot)
      Left++; // 基準より小さい値を左から見つけていく
    while(pivot < A[Right])
      Right--; // 基準より大きい値を右から見つけていく
    if(Left >= Right) break; // 見つかった値の順序が逆になったら終了
    swap(&A[Left], &A[Right]); // 値を交換
    swap(&B[Left], &B[Right]);
    Left++, Right--; // 次の値に移動
  }
  if(left < Left - 1) QuickSort(A, B, left, Left - 1); //左群を対象として再帰
  if(Right + 1 < right) QuickSort(A, B, Right + 1, right); //右群を対象として再帰
}

int main(void) {
  long long n, k, i, cou=0, tmp;
  long long mod=1000000007, happy=0, dpl, dpr, dpmax=0;
  scanf(" %lld", &n);
  long long a[n], ax[n], b[n];
  long long dp[n + 1][n + 1]; //dp[左寄せの数][同右]
  for(i=0; i < n; i++){
    scanf(" %lld", &a[i]);
    ax[i]=a[i], b[i]=i;
  }
  QuickSort(a, b, 0, n - 1);

  dp[1][0]=a[n - 1] * b[n - 1], dp[0][1]=a[n - 1] * (n - 1 - b[n - 1]);
  //printf("dp[1][0]=%lld\n", dp[1][0]);
  //printf("dp[0][1]=%lld\n", dp[0][1]);
  for(i=2; i <= n; i++){
    for(k=0; k <= i; k++){
      if(k == 0) dp[i][0]=dp[i - 1][0] + abs(i - b[n - i]-1) * a[n - i];
      else if(k == i) dp[0][i]=dp[0][i - 1] + abs(n - i - b[n - i]) * a[n - i];
      else{
        dpl=dp[i - k - 1][k] + abs(i - k - 1 - b[n - i]) * a[n - i];
        dpr=dp[i - k][k-1] + abs(n - k - b[n - i]) * a[n - i];
        //printf(" dpl=%lld+%d*%d=%d\n dpr=%lld+%d*%d=%d\n",
        //    dp[i - k - 1][k] ,abs(i - k - 1 - b[n - i]), a[n - i],dpl,
        //    dp[i - k][k - 1] ,abs(n - k  - b[n - i]), a[n - i], dpr);
        if(dpl > dpr) dp[i - k][k]=dpl;
        else dp[i - k][k]=dpr;
      }
      //printf("dp[%d][%d]=%lld\n", i - k, k, dp[i - k][k]);
    }

  }
  for(i=0; i <= n; i++)
    if(dpmax < dp[i][n - i]) dpmax=dp[i][n - i];

  printf("%lld", dpmax);
  return 0;
}


Measured memory_bytes: 24392
N=int(input())
A=list(map(int,input().split()))
fp=A[0];ans=1;fp=fn=False
for i in range(1,N):
    if A[i-1]<A[i]:
        if not fp and not fn:
            fp=True
        elif fn:
            ans+=1
            fn=False
    if A[i-1]>A[i]:
        if not fp and not fn:
            fn=True
        elif fp:
            ans+=1
            fp=False

print(ans)

Measured memory_bytes: 62704
module Main where

import           Control.Monad
import           Debug.Trace
import qualified Data.Vector.Unboxed           as VU
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe

tuplify2 (x : y : _) = (x, y)
tuplify2 _           = undefined

getVUIntFromInputLineAtBSC8 :: IO (VU.Vector Int)
getVUIntFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
getVUIntListFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine

readInt = fst . fromJust . BSC8.readInt
readIntTuple = tuplify2 . map readInt . BSC8.words
readIntList = map readInt . BSC8.words

getInt = readInt <$> BSC8.getLine
getIntList = readIntList <$> BSC8.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BSC8.getLine
getIntMatrix = map readIntList . BSC8.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BSC8.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BSC8.getLine
getIntTuples = map readIntTuple . BSC8.lines <$> BSC8.getContents

main :: IO ()
main = do
    [aN,aL] <- getIntList
    aS <- foldl (\acc x -> do
        aS <- getLine
        accString <- acc
        return (accString ++ [aS])) (return []) [1..aN]
    let ret = foldl (\acc x->acc ++ x) [] (sort aS)
    putStrLn ret



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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 100500;



int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;
	
	string s;
	cin >> s;

	int n = sz(s);

	s = "!" + s;

	if (s[1] != '1' || s[n] != '0') {
		cout << -1;
		return 0;
	}

	vector < int > pos;

	for (int i = 1; i < n; i++) {
		if (s[i] != s[n - i]) {
			cout << -1;
			return 0;
		}
		if (s[i] == '1')
			pos.pb(i);
	}

	vector < pii > edges;

	for (int i = 1; i <= sz(pos); i++)
		edges.pb({i, i + 1});

	int cnt = sz(pos) + 1;

	for (int i = 2; i <= sz(pos); i++) {
		int cur = pos[i - 1] - pos[i - 2] - 1;
		for (int j = 1; j <= cur; j++)
			edges.pb({i, ++cnt});
	}

	for (auto i : edges)
		cout << i.F << " " << i.S << "\n";

	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 2788
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

	int h, a;
	cin >> h >> a;
	int ans = 0;
	while(h > 0){
		h -= a;
		ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3600
/*Never Give up 14390*/
/*
Problem     :
Verdict     :
Time        :
Memory      :
*/
#include<bits/stdc++.h>
using namespace std;
#define sf(a)          scanf("%d",&a)
#define sff(a,b)         scanf("%d%d",&a,&b)
#define sfff(a,b,c)         scanf("%d%d%d",&a,&b,&c)
#define sffff(a,b,c,d)         scanf("%d%d%d%d",&a,&b,&c,&d)
#define sl(a)          scanf("%lld",&a)
#define sll(a,b)         scanf("%lld%lld",&a,&b)
#define slll(a,b,c)         scanf("%lld%lld%lld",&a,&b,&c)
#define sllll(a,b,c,d)         scanf("%lld%lld%lld%lld",&a,&b,&c,&d)
#define sc(a) scanf("%c",&a)
#define sz(a)              a.size()
#define ff first
#define ss second
#define all(a)          a.begin(), a.end()
#define faster  ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pf         printf
#define pf1(a)        pf("%d\n",a);
#define PI  acos(-1)
#define ll           long long
#define ull        unsigned long long
#define pb        push_back
#define vi           vector<int>
#define vl           vector<ll>
#define li            list<int>
#define pi          pair<int,int>
#define pl          pair<ll,ll>
#define mp         map
#define nl         cout<<endl
#define en        pf("Entered\n")
#define en1      pf("Entered 2\n")
#define gcd(a,b) __gcd(a,b)
#define sp  ' '
#define f0(a,n) for(int a=0;a<n;a++)
#define f1(a,n) for(int a=1;a<=n;a++)
#define MOD 1000000007


#define one cout<<"one"<<endl
#define two cout<<"two"<<endl
#define three cout<<"three"<<endl
#define four cout<<"four"<<endl
#define five cout<<"five"<<endl
#define six cout<<"six"<<endl


// priority_queue<int, vector<int>, greater<int> > Q;//for smaller values

#define MAX    100000

//int dx[] = {-1, 0, 1, 0};
//int dy[] = {0, 1, 0, -1};
//int dx[]= {1,1,0,-1,-1,-1,0,1};/*8 side move*/
//int dy[]= {0,1,1,1,0,-1,-1,-1};/*8 side move*/
//int dx[]={1,1,2,2,-1,-1,-2,-2};/*knight move*/
//int dy[]={2,-2,1,-1,2,-2,1,-1};/*knight move*/

//'A'=65,'Z'=90 'a'=97 'z'=122 '0'=48



int main()
{
    faster
    int t;
    //  cin>>t;
    t=1;
    while(t--)
    {
        int n;
        cin>>n;
        int arr[n*2];
        f0(i,2*n)cin>>arr[i];
        sort(arr,arr+2*n);
        ll sum=0;
        for(int i=0; i<2*n; i+=2)sum+=arr[i];
        cout<<sum<<endl;


    }



    return 0;
}
/*
Ref:

*/

Measured memory_bytes: 3580
#include <bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vp = vector<P>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvb = vector<vb>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll  INFL = 1e18;


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    ll ans = 0;
    ll N; cin >> N;
    vl L(N); REP(i, N) cin >> L[i];
    sort(ALL(L));
    for(int i = 0; i < N; i++)
    {
        for(int j = i+1; j < N; j++)
        {
            ans += upper_bound(L.begin()+j+1, L.end(), L[i]+L[j]-1) - (L.begin()+j+1);
        }
    }
    cout << ans << endl;
}

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

int main (){
    int N, K;
    int c = 1;
    cin >> N >> K;
    for (int i = 0; i < N; i++){
        int a = 2 * c;
        int b = c + K;
        
        if  (a < b){
            c = a;
        }
        else {
            c = b;
        }
    }
    cout << c << endl;
  
}

Measured memory_bytes: 256
def solve(n, k):
    ans = []
    for dice in range(1, n+1):
        c = 0
        while dice < k:
            dice *= 2
            c += 1
        ans.append((1/n) * 1/(2**c))

    return sum(ans)


if __name__ == '__main__':
    n, k = map(int, input().split())
    print(round(solve(n, k), 10))


Measured memory_bytes: 12716
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) {
    return cout << "(" << p.first << ", " << p.second << ")";
}
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
    cout << "{"; for (int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "}";
}

int main() {
    const int MOD = 1e9 + 7;
    ll n; cin >> n;
    map<ll, ll> store;
    function<ll(ll)> eval = [&](ll x) -> ll {
        if (store.find(x) != store.end()) return store[x];
        ll ret;
        if (x == 1) {
            ret = 2;
        } else if (x == 2) {
            ret = 4;
        } else if (x == 3) {
            ret =  5;
        } else {
            if (x % 2 == 0) {
                ret = (2 * eval(x / 2 - 1) + eval(x / 2)) % MOD;
            } else {
                ret = (eval(x / 2 - 1) + 2 * eval(x / 2)) % MOD;
            }
        }
        store[x] = ret;
        return ret;
    };
    cout << eval(n) << '\n';
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	int sx,sy,tx,ty;
	int ans=0;
	
	cin>>sx>>sy>>tx>>ty;
	//s->t
	int yoko=tx-sx;
	int tate=ty-sy;
	for(int i=0;i<yoko;i++)
		cout<<'R';
	for(int i=0;i<tate;i++)
		cout<<'U';
	//t->s
	for(int i=0;i<yoko;i++)
		cout<<'L';
	for(int i=0;i<tate;i++)
		cout<<'D';
	//s->t(2回目)
	cout<<'D';//ずらす
	for(int i=0;i<yoko+1;i++)
		cout<<'R';
	for(int i=0;i<tate+1;i++)
		cout<<'U';
	cout<<'L';
	//t->s(2回目)
	cout<<'U';
	for(int i=0;i<yoko+1;i++)
		cout<<'L';
	for(int i=0;i<tate+1;i++)
		cout<<'D';
	cout<<'R';
	return 0;
}

Measured memory_bytes: 256
pub mod contest {
    pub mod input {
        use std::io;
        use std::str::FromStr;
        use std::fmt::Debug;

        pub fn read_line<F>() -> F
        where F: FromStr, <F as FromStr>::Err: Debug {
            let mut input = String::new();
            io::stdin().read_line(&mut input).unwrap();
            input.trim().parse().unwrap()
        }

        pub fn read_words<F>() -> Vec<F>
        where F: FromStr, <F as FromStr>::Err: Debug {
            let mut input = String::new();
            io::stdin().read_line(&mut input).unwrap();
            input
                .split_whitespace()
                .map(|i| i.parse().unwrap())
                .collect()
        }

        pub fn read_matrix<F>(num_lines: usize) -> Vec<Vec<F>>
        where F: FromStr, <F as FromStr>::Err: Debug {
            (0..num_lines).map(|_| read_words()).collect()
        }

        // 所有権的な問題で SplitWhitespace を直接持てないので妥協
        // まあ、一行のデータの数なんてそんなに多くないだろうし
        pub struct WordsReader {
            words: Vec<String>,
            cur: usize,
        }

        impl WordsReader {
            pub fn new() -> Self {
                let mut input = String::new();
                io::stdin().read_line(&mut input).unwrap();
                WordsReader {
                    words: input.split_whitespace().map(|i| i.to_owned()).collect(),
                    cur: 0,
                }
            }

            pub fn next<F>(&mut self) -> F
            where F: FromStr, <F as FromStr>::Err: Debug {
                let v: F = self.words[self.cur].parse().unwrap();
                self.cur += 1;
                v
            }
        }
    }

    pub mod output {
        use std::fmt;

        pub fn print_words<T>(words: &Vec<T>)
        where T: fmt::Display {
            let mut is_first = true;
            for i in words {
                if is_first {
                    print!("{}", i);
                    is_first = false;
                } else {
                    print!(" {}", i);
                }
            }
            println!("");
        }
    }
}

fn solve(n: usize, a: &Vec<usize>) -> Vec<usize> {
    let mut v: Vec<usize> = vec![0; n];
    for i in 0..n {
        let n_students = a[i];
        v[n_students - 1] = i + 1;
    }
    v
}

fn main() {
    let n: usize = contest::input::read_line::<usize>();
    let a: Vec<usize> = contest::input::read_words();
    contest::output::print_words(&solve(n, &a));
}


Measured memory_bytes: 6908
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define MOD 1000000007
#define oo 1000000000000000000
#define forr(i,n) for(ll i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0) ; cout.tie(0);
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define pb push_back
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
using namespace __gnu_pbds; 
using namespace std;

ll valueOfIndex(ordered_set&s , ll i){ return *(s.find_by_order(i)); }
ll indexOfValue(ordered_set&s , ll x){ return s.order_of_key(x); }
ll add(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a+b + p)%p;}
ll mul(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a*b + p)%p;} // __int128
ll power(ll x,ll n,ll p=MOD){ if(x==0) return 0; if(n==0 || x==1) return 1LL;
    ll r = (power(x,n/2,p))%p; if(n&1) return mul(mul(r,r,p) , x,p); else return mul(r,r,p);
}
ll inv(ll x){return power(x,MOD-2);}



ll get(ll n){
    ll s=1,e=100,ans=1;
    while(s<=e){
        ll m = (s+e)/2;
        if((m*(m+1))/2 <= n){
            ans = m;
            s = m+1;
        }
        else e= m-1;
    }
    return ans;
}

void __sol(){
    ll n; cin >> n;
    vector<ll> v;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            ll cnt = 0;
            while(n%i==0) n/=i,cnt++;
            v.eb(cnt);
        }
    }
    if(n!=1) v.eb(1);
    ll ans=0;
    for(auto &i: v) ans+= get(i);
    cout << ans;
    return;
}


int main(){
    fastio
    ll tc=1;// cin >> tc;
    while(tc--) __sol();
    return 0;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

long long gcd(long long a,long long b){
   if(a>b) return gcd(b,a);
   if(b%a==0) return a;
   return gcd(b%a, a);
}
int main(){
   long long A,B,C,D;
   cin >> A >> B >> C >> D;
   long long B1 = B/C;
   long long B2 = B/D;
   long long B3 = B/(C*D/gcd(C,D));
   long long A1 = (A-1)/C;
   long long A2 = (A-1)/D;
   long long A3 = (A-1)/(C*D/gcd(C,D));
   long long Acnt = A1+A2-A3;
   Acnt = A-1-Acnt;
   long long Bcnt = B1+B2-B3;
   Bcnt = B-Bcnt;
   cout << Bcnt-Acnt<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }


const int MAX = 1e5+5;

int main(){
    int n, c;
    cin >> n >> c;
    vector<vector<P>> tv(c);
    rep(i,n){
        P tm;
        int ch;
        cin >> tm.first >> tm.second >> ch;
        ch--;
        tv[ch].push_back(tm);
    }

    rep(i, c){
        sort(all(tv[i]));
        vector<P> tv_con;
        rep(j, tv[i].size()){
            P tm = tv[i][j];
            if (j == 0){
                tv_con.push_back(tm);
            }else{
                if (tv_con.back().second == tm.first) tv_con.back().second = tm.second;
                else tv_con.push_back(tm);
            }
        }
        tv[i] = tv_con;
    }

    vector<int> sum(MAX);
    rep(i, c){
        rep(j, tv[i].size()){
            P tm = tv[i][j];
            sum[tm.first-1]++;
            sum[tm.second]--;
        }
    }

    int ans = 0;
    rep(i, MAX-1) sum[i+1] += sum[i];
    rep(i, MAX) ans = max(ans, sum[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4840
#include <iostream>
#include <string>
#include <stddef.h>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <math.h>
#define ll long long;

using namespace std;

void InsertionSort(int a[], int n) {
	for (int i = 0; i < n; i++) {
		int v = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;
		for (int i = 0; i < n-1; i++) {
			cout << a[i] << ' ';
		}
		cout << a[n - 1] << endl;
	}
}

int GCD(int x, int y) {
	if (x%y == 0) return y;
	else {
		return GCD(y, x%y);
	}
}

int main() {
	int x, y;
	cin >> x >> y;
	cout << GCD(x, y) << endl;
}

Measured memory_bytes: 3104
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
# import numpy as np
# import scipy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])

    
def main():
    ans=10**10
    n,a,b,c=inpm()
    l=inplm(n)
    for an in range(1,n-1):
        for use_a in combinations(range(n),an):
            tank = []
            for j in range(n):
                if j not in use_a:
                    tank.append(j)
            for bn in range(1,n-an):
                for use_b in combinations(tank,bn):
                    tank1=[]
                    for j in tank:
                        if j not in use_b:
                            tank1.append(j)
                    for cn in range(1,n-an-bn+1):
                        for use_c in combinations(tank1,cn):
                            a_pre=0
                            b_pre=0
                            c_pre=0
                            for i in use_a:
                                a_pre+=l[i]
                            for i in use_b:
                                b_pre+=l[i]
                            for i in use_c:
                                c_pre+=l[i]
                            cnt=0
                            cnt+= (len(use_a)+len(use_b)+len(use_c)-3)*10 + abs(a_pre-a)+abs(c_pre-c)+abs(b_pre-b)
                            if ans>cnt:
                                ans=cnt
                            
    print(ans) 

if __name__ == "__main__":
    main()

Measured memory_bytes: 68972
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Apolloliu
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

#define MEM(a,b)    memset(a, b, sizeof(a))
#define UN(a)       sort(all(a)), a.erase(unique(all(a)), a.end())
#define REV(a)      reverse(all(a))
#define MP(a, b)    make_pair(a, b)
#define PAIR(a, b)  pair<int, int>(a, b)

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

const int MOD = 1e9 + 7;
const int maxn = 1;
const double EPS = 1e-8;

class AApplePie {
public:
	void solve(std::istream& in, std::ostream& out) {
		int A, P;
		in>>A>>P;
		out<<(A*3+P)/2<<endl;
	}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	AApplePie solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

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


int main()
{
	int w, h, n; cin >> w >> h >> n;
	int W1 = 0, W2 = w, H1 = 0, H2 = h;
	for (int i = 0; i < n; ++i)
	{
		int x, y, a; cin >> x >> y >> a;
		if (a == 1) W1 = max(W1, x);
		else if (a == 2) W2 = min(W2, x);
		else if (a == 3) H1 = max(H1, y);
		else H2 = min(H2, y);
	}
	cout << max(W2-W1, 0) * max(H2-H1, 0) << endl;
}



Measured memory_bytes: 3676
import sys
l,r = (int(i) for i in input().split())

if r - l >= 2019:
    print(0)
    sys.exit()

ans = 2018
for i in range(l , r):
    for j in range(i + 1 , r + 1):
        if ans > i * j % 2019:
            ans = i *j % 2019
print(ans)



Measured memory_bytes: 2940
#region using directives
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Convert;
#endregion

namespace for_contests
{
    class Program
    {
        static void Main()
        {
            long n = ToInt64(ReadLine());
            long i = 1;
            long max = 1;
            while(true)
            {
                long t = i;
                t = t * t;
                if (t <= n)
                    max = t;
                else
                    break;
                i++;
            }
            WriteLine(max);
        }
    }
}


Measured memory_bytes: 13268
def f(n):
    if n % 2 == 0:
        return n // 2
    else:
        return 3 * n + 1


s = int(input())
a = [s]
i = 1
while True:
    ai = f(a[i - 1])
    if ai in a:
        break
    a.append(ai)
    i += 1
print(i + 1)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


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

    int x; cin>>x;
    for(int i=1; i<INF; i++){
        if(x*i%360==0){
            cout<<i<<endl;
            break;
        }
    }
}

Measured memory_bytes: 3612
/*
{By GWj
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
#define check_min(a,b) a=min(a,b)
#define check_max(a,b) a=max(a,b)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
/*}
*/
const int MOD=1e9+7;
int s;
LL dp[2000+20];
int main(){
	fastio;
	R(s);
	dp[0]=1;
	rb(i,3,s)
	{
		rb(j,3,i){
			dp[i]+=dp[i-j];
			dp[i]%=MOD;
		}
	}
	cout<<dp[s]<<endl;
	return 0;
}


Measured memory_bytes: 3644
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int comp(const void *a, const void *b){return *(int*)b-*(int*)a;}

int main(void){
	int n, m, i;
	int x[200000][2];
	scanf("%d%d", &n, &m);
	for(i=0; i<n; i++){
		int A;
		scanf("%d", &A);
		x[i][0]=A;
		x[i][1]=1;
	}
	for(i=n; i<=n+m; i++){
		int B, C;
		scanf("%d%d", &B, &C);
		x[i][0]=C;
		x[i][1]=B;
	}
	qsort(x, n+m, sizeof(int)*2, comp);
	int j=n;
	long sum=0;
	for(i=0; i<n; i++){
		if(x[i][1]<j){
			sum += ((long)x[i][0])*x[i][1];
			j -= x[i][1];
		}else{
			sum += ((long)x[i][0])*j;
			break;
		}
	}
	printf("%ld\n", sum);
}


Measured memory_bytes: 3324
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

const ll M = 1e9+7;

int main(){
  ll n,k; cin >> n >> k;
  vector<ll> a(n);
  REP(i,n) cin >> a[i];

  //c:i<j and ai>aj d:ai>aj
  vector<ll> c(n,0), d(n,0);
  REP(i,n){
    REP(j,i) if(a[i]>a[j]) d[i]++;
    FOR(j,i+1,n){
      if(a[i]>a[j]){
        c[i]++;
        d[i]++;
      }
    }
  }
  ll ans = 0;
  REP(i,n){
    (ans += k*c[i]%M + (k*(k-1)/2)%M*d[i]%M) %= M;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int m,n;
  cin >> n >> m;
  cout << (3*n+m)/2 << endl;
}


Measured memory_bytes: 256
class VectorSpace01:
    def __init__(self):
        self.E = []
    
    def chk(self, n):
        for e in self.E:
            n = min(n, n ^ e)
        return 1 if n == 0 else 0
    
    def add(self, n):
        for e in self.E:
            n = min(n, n ^ e)
        if n: self.E.append(n)
        return 1 if n == 0 else 0
    
    def dimension(self):
        return len(self.E)

T = int(input())
for _ in range(T):
    N = int(input())
    A = [int(a) for a in input().split()]
    S = [int(a) for a in input()]
    vs = VectorSpace01()
    for i in range(N)[::-1]:
        a = vs.add(A[i])
        if S[i] and a == 0:
            print(1)
            break
    else:
        print(0)

Measured memory_bytes: 9212
#include<stdio.h>
int main ()
{
	int X,K,yeet;
		scanf("%d",&K);
		scanf("%d",&X);
		
		yeet =  K * 500;
	if (yeet >= X )
		{
			printf("Yes\n");
		}			
	else 
	{
		printf("No\n");
	}
	
	
	
	return 0;
}

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

int main()
{
    int n , k , x , y;
    cin >> n >> k >> x >> y;
    if(n <= k)
    {
        cout << n * x << endl;
    }
    else
    {
        cout << k * x + (n - k) * y << endl;
    }
}

Measured memory_bytes: 256
A,B,C = map(int,input().split())

if max(A,B,C)==A:
  print(int(B*C/2))
elif max(A,B,C)==B:
  print(int(A*C/2))
elif max(A,B,C)==C:
  print(int(A*B/2))
  
  
  

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


int main()
{
  ll N;
  scanf("%lld",&N);
  ll A;
  scanf("%lld",&A);
  ll B;
  scanf("%lld",&B);
  cout << min(N*A, B) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int

int main()
{
    int n, T, c, t;
    int m = 10000;

    cin >> n >> T;
    for (int i = 0; i < n; i++)
    {
        cin >> c >> t;
        if (t <= T)
            m = min(m, c);
    }
    if (m == 10000)
        cout << "TLE" << endl;
    else
        cout << m << endl;
}


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

int main() {
    int n = 0, i, j;
    long sum = 0, min, max;
    long num[10001] = {0};
    
    scanf("%d", &n);
    for(i = 0; i < n; i++) {
        scanf("%ld", &num[i]);
        sum = sum+num[i];
    }
    
    // find min
    min = num[0];
    for(j = 0; j < n; j++) {
        if(num[j] < min) {
            min = num[j];
        } 
    }
    // find max
    max = num[0];
    for(j = 0; j < n; j++) {
        if(num[j] > max) {
            max = num[j];
        } 
    }

    printf("%ld %ld %ld\n", min, max, sum);
    return 0;
}


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


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

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

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

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

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


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


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
    const int maxA = 100000;

    int N;
    cin >> N;
    int cnt[maxA];
    REP(i, maxA) cnt[i] = 0;
    int a;
    REP(i, N)
    {
        cin >> a;
        ++cnt[a];
    }
    int ans = 0;
    REP(i, maxA)
    {
        int num = cnt[i];
        if (i - 1 >= 0) num += cnt[i - 1];
        if (i + 1 < maxA) num += cnt[i + 1];
        ans = max(ans, num);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int q = sc.nextInt();
		int[] a = new int[n + 10];
		for(int i = 0 ; i < q ; i++) {
			a[sc.nextInt()]++;
		}
		String s = "";
		StringBuilder sb = new StringBuilder(s);
		for(int i = 1 ; i <= n ; i++) {
			sb.append((k - (q - a[i]) > 0 ? "Yes" : "No") + "\n");
		}

		sc.close();
		System.out.println(sb.toString());

	}
}



Measured memory_bytes: 60132
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		long N = in.nextInt();
		long A = in.nextInt();
		
		long buy = N % 500;
		if(buy<=A) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
 
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

int root[SIZE];
int sz[SIZE];

void init() {
    for(int i = 0; i < SIZE; ++i) {
        root[i] = i;
        sz[i] = 1;
    }
}

int Root(int x) {
    if(x == root[x]) return x;

    int rt = Root(root[x]);
    sz[x] = sz[rt];
    return rt;
}

bool Unite(int x, int y) {
    int rx, ry;
    rx = Root(x);
    ry = Root(y);

    if(rx == ry) return false;
    if(sz[rx] > sz[ry]) {
        root[ry] = rx;
    } else {
        root[rx] = ry;
    }

    sz[rx] += sz[ry];
    sz[ry] = sz[rx];
    return true;
}

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

    int N, M, K;
    cin >> N >> M >> K;
    init();

    LL res[SIZE] = {};
    for(int i = 0; i < M; ++i) {
        LL a, b;
        cin >> a >> b;
        --res[a];
        --res[b];
        Unite(a, b);
    }

    for(int i = 0; i < K; ++i) {
        int c, d;
        cin >> c >> d;
        if(Root(c) == Root(d)) {
            --res[c];
            --res[d];
        }
    }

    for(int i = 1; i < N; ++i) {
        Root(i);
        cout << res[i] + sz[i] - 1 << " ";
    }
    Root(N);
    cout << res[N] + sz[N] - 1 << endl;

    return 0;
}



Measured memory_bytes: 6744
#include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int n;
      cin>>n;
      vector<int >b(n-1,0),a(n,0);
      for(int i=0;i<n-1;i++)cin>>b[i];
      int sum=0;sum+=(b[0]+b[n-2]);
      for(int i=0;i<n-2;i++){
      	sum+=min(b[i],b[i+1]);
      }
      cout<<sum;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int n,m;
    cin >> n >> m;
    vector<pair<ll,ll>> l;

    rep(i,n){
        ll a;
        ll b;
        cin >> a >> b;
        l.pb({a,b});        
    }

    sort(all(l));
    ll sum = 0;

    rep(i,n){
        ll a = l[i].fs;
        ll b = l[i].sc;
        if(m>b){m-=b;sum+=a*b;}
        else{sum += a*m;break;}
    }
    cout << sum << endl;
    //for(auto it : l) {cout << it.first <<" "<< it.second<< endl;}
    return 0;
}


Measured memory_bytes: 2420
s = input()
n = len(s)
count = 0
halfn = int((n-1) / 2)
whalfn = int((n-1) / 4)
half = s[0:halfn]

for i in range(len(s)):
    if s[i] != s[-i-1]:
      count += 1
      break
    else:
      pass

for i in range(len(half)):
  if half[i] != half[-i-1]:
    count += 1
    break
  else:
    pass

if count == 0:
  print('Yes')
else:
  print('No')
  

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll maxn = 1e5 + 10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//head
int main(){
	ll t, tt;
	scanf("%lld %lld", &t, &tt);
	if(tt >= t){
		printf("unsafe");
	}else{
		printf("safe");
	}
	
	return 0;
}


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

using namespace std;

int main() {
  int N;
  string S;
  cin >> N >> S;
  int answer = 0;
  for (int i = 0; i + 2 < S.length(); i++) {
    if (S.substr(i, 3) == "ABC") answer++;
  }
  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n,m;
  cin >> n >> m;
  mat G(n);
  for(ll i=0;i<m;i++) {
    ll a,b;
    cin >> a >> b;
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vec d(n,-1);
  priority_queue<pll,vector<pll>,greater<pll>> q;
  q.push({0,0});
  while(q.size()) {
    ll f=q.top().second;
    ll fd=q.top().first;
    q.pop();
    if(d[f]>-1) continue;
    d[f]=fd;
    for(ll t:G[f]) {
      ll td=fd+1;
      q.push({td,t});
    }
  }
  vec ans(n);
  for(ll t=1;t<n;t++) {
    for(ll f:G[t]) {
      if(d[t]==d[f]+1) {
        ans[t]=f;
        break;
      }
    }
  }
  cout << "Yes" << endl;
  for(ll i=1;i<n;i++) {
    cout << ans[i]+1 << endl;
  }
}

Measured memory_bytes: 20312
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <set>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MAX 100000
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll, ll> P;

int main(void) {
    ll x;
    cin >> x;
    ll t=0;
    while(t*(t+1)<2*x) {
        t++;
    }
    cout << t << endl;
    
}


Measured memory_bytes: 256
n, m  = map(int, input().split())
g     = {}
used  = {i:[False for _ in range(11)] for i in range(n)}
color     = [0  for _ in range(n)]

for _ in range(m):
    u, v = map(int, input().split())
    u-=1
    v-=1
    if u not in g:
        g[u] = []
    if v not in g:
        g[v] = []
    g[u].append(v)
    g[v].append(u)
    
q = int(input())
Q = []

for _ in range(q):
    node, dis, col = map(int, input().split())
    Q.append([node-1, dis, col])
Q = Q[::-1]

def bfs(now, dist, col):
    if dist < 0:
        return
    
    if used[now][dist]:
        return
 
    used[now][dist] = True
    
    if not color[now]:
        color[now] = col
 
    if now in g:
        for x in g[now]:
            bfs(x, dist - 1, col)
            
for node, dis, col in Q:
    bfs(node, dis, col)

for x in color:
    print(x)

Measured memory_bytes: 74360
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N;
	cin >> N;
	string S;
	cin >> S;

	int kotae = 0;
	rep(p, N) {

		int Z[5000];
		Z[0] = N;
		int i = 1;
		int j = 0;
		while (i < N - p) {
			while (i + j < N - p && S[p + j] == S[p + i + j]) j++;
			Z[i] = j;
			if (j == 0) {
				i++;
				continue;
			}
			int k = 1;
			while (i + k < N && k + Z[k] < j) {
				Z[i + k] = Z[k];
				k++;
			}
			i += k;
			j -= k;
		}

		rep(q, N - p) {
			kotae = max(kotae, min(Z[q], q));
		}
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
A, B, H, M = [int(i) for i in input().split()]


import math

tan = H/12*2*math.pi + M/60/12*2*math.pi
tyo = M/60*2*math.pi

cos = math.cos(tyo-tan)

c = math.sqrt(A**2+B**2-2*A*B*cos)
print(c)



Measured memory_bytes: 62448
import java.util.*;
import java.io.*;
import java.lang.*;

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

        if (x>=a && x<=(a+b))
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}


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

int p[1000000];
int main()
{
  int N, count;
  cin>>N;
  for (int i = 0; i<N; i++){
  	cin>>p[i];
  }
  
  bool b = true;
  int curMin = 1e9;
  for(int i = 0; i<N; i++){
    curMin = min(curMin, p[i]);
    if (curMin == p[i]){
    	count ++;
    }
  }
  
 cout<<count<<endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int n;cin >> n;
    int a[n],b[n];
    int as = 0,bs = 0;
    rep(i,n){
        cin >> a[i];
        as += a[i];
    }
    rep(i,n){
        cin >> b[i];
        bs += b[i];
    }
    if(as < bs){
        cout << -1 << endl;
        return 0;
    }
    vector<int> sa;
    int minus = 0;
    int ans =0 ;
    rep(i,n){
        if(a[i] - b[i] < 0){
            ans++;
            minus += b[i] - a[i];
        }
        
        else if(a[i] - b[i]) sa.push_back(a[i] - b[i]);
    }
    sort(sa.rbegin(),sa.rend());
    int plus = 0;
    if(plus >= minus){
        cout << ans << endl;
        return 0;
    }
    rep(i,n){
        if(plus > minus){
            break;
            
        }
        plus += sa[i];
        ans++;

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

Measured memory_bytes: 2428
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef long long ll;

int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    string s; cin >> s;
    int sum = 0;
    for (char c : s) sum += c-'0';

    cout << (sum%9 == 0 ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3756
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func main() {
	var n int
	fmt.Scan(&n)
	h := make([]int, n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		h[i] = nextInt(sc)
	}
	length, ans := 0, 0
	for i := 1; i < n; i++ {
		if h[i-1] >= h[i] {
			length++
		} else {
			length = 0
		}
		ans = max(length, ans)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n, x, t; cin >> n >> x >> t;
    int ans = (n + x - 1)/x * t;
    cout << ans << endl;
}

Measured memory_bytes: 3536