akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> // Include every standard library
using namespace std;
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
#define sqr(x) ((LL)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define TC(t) while (t--)
#define ms(s, n) memset(s, n, sizeof(s))
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define size(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed << setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pi> vii;
const int MOD = (int)1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int)1e9;
const ll LINF = (ll)1e18;
const ld PI = acos((ld)-1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b)
{
    ll r;
    while (b)
    {
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
inline ll fpow(ll n, ll k, int p = MOD)
{
    ll r = 1;
    for (; k; k >>= 1)
    {
        if (k & 1)
            r = r * n % p;
        n = n * n % p;
    }
    return r;
}
inline ll isqrt(ll k)
{
    ll r = sqrt(k) + 1;
    while (r * r > k)
        r--;
    return r;
}
inline ll icbrt(ll k)
{
    ll r = cbrt(k) + 1;
    while (r * r * r > k)
        r--;
    return r;
}
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
int modulo(int a, int b) { return (a % b + b) % b; } 
#define db(x) cerr << #x << " = " << (x) << " ";

int main()
{
    IOS;
    int N,W;
    scanf("%d %d", &N,&W);
    vl dp(W+1);
    //dp[i]=max value when total weight is i
    vi w;
    vi v;
    for(int a=0;a<N;a++)
    {
        int wgt,val;
        scanf("%d %d", &wgt,&val);
        w.pb(wgt);
        v.pb(val);
    }
    for(int a=0;a<N;a++)
    {
        // using push forward dp
        //for(int b=0;b<=W-w[a];b++) picks up same item twice
        for(int b=W-w[a];b>=0;b--) //ierating over items that can already be in the knapsack if i pick up w[a]
        dp[b+w[a]]=max(dp[b+w[a]],dp[b]+v[a]);
    }
    ll res=*max_element(ALL(dp));
    printf("%lld", res);
}


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

#define MAX 100001

int partition(int *,int,int);

int main(){
  int n,i,par;
  int A[MAX];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    if(A[i]<0 || A[i]>100000){
      exit(1);
    }
  }

  par=partition(A,0,n-1);

  for(i=0;i<n-1;i++){
    if(i==par){
      printf("[%d] ",A[i]);
    }else{
      printf("%d ",A[i]);
    }
  }
  printf("%d\n",A[n-1]);
 
  return 0;
}

int partition(int *A,int p,int r){
  int x,i,j,tmp1,tmp2;

  x=A[r];
  i=p-1;

  for(j=p;j<=r-1;j++){
    if(A[j]<=x){
      i=i+1;
      tmp1=A[i];
      A[i]=A[j];
      A[j]=tmp1;
    }
  }

  tmp2=A[i+1];
  A[i+1]=A[r];
  A[r]=tmp2;

  return i+1;
}

Measured memory_bytes: 988
from sys import stdin

mapping = [0] * 100001

def main():
    n = int(input())
    a = [int(x) for x in stdin.readline().rstrip().split()]
    base = sum(a)
    for aaa in a:
        mapping[aaa] += 1
    q = int(input())
    for i in range(q):
        b, c = [int(x) for x in stdin.readline().rstrip().split()]
        offset = c - b
        kazu = mapping[b]
        base = base + kazu*offset
        mapping[b] = 0
        mapping[c] += kazu
        
        print(base)
        

if __name__ == "__main__":
    main()

Measured memory_bytes: 21280
#include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define int long long
using namespace std;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for (ll i = (ll)(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 MAXIN(x) max_element(ALL(x)) - x.begin();
#define MIN(x) *min_element(ALL(x))
#define MININ(x) min_element(ALL(x)) - x.begin();
#define INF 1000000000000
#define MOD 100000070

#define MAXR 100000
#define PI 3.14159265358979323846

using namespace std;
signed main() {
    string s, t;
    cin >> s >> t;
    int res = 0;
    REP(i, s.size()) {
        if (s[i] != t[i]) {
            res++;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3916
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int a, b;
  cin >> a >> b;

  cout << max(max(a + b, a * 2 - 1), b * 2 - 1);
}
#endif


Measured memory_bytes: 3604
#include <algorithm>
#include <cstdio>

using namespace std;

#define int long long
#define uint unsigned int
#define dotimes(i, n) for (int i = 0, i##max__ = (n); i < i##max__; i++)
#define whole(x, f, ...) ([&](decltype((x)) c) { return (f)(begin(c), end(c), ## __VA_ARGS__); })(x)

int rint() {
  int x;
  scanf("%lld", &x);
  return x;
}

void wint(int x) {
  printf("%lld\n", x);
}

template<typename T> int size(T const& c) { return static_cast<int>(c.size()); }
template <typename T> bool maxs(T& a, T const& b) { return a < b ? a = b, true : false; }
template <typename T> bool mins(T& a, T const& b) { return a > b ? a = b, true : false; }
inline int lg(int x) { return 63 - __builtin_clzll(static_cast<unsigned int>(x)); }

signed main() {
  const int N = rint();
  char S[N+1];
  scanf("%s", S);
  int dp[N] = {}, r = 0;
  dotimes(i, N-1) {
    for (int j = N-1; j >= i+1; j--) {
      dp[j] = S[i] == S[j] ? dp[j-1] + 1 : 0;
      maxs(r, j - max(j - dp[j], i));
    }
  }
  wint(r);
  return 0;
}


Measured memory_bytes: 1760
#include <stdio.h>

char kugyu[1234567] = {1, 1};

int main(void) {
	int i, j;
	int X;
	int tomatu;
	for (i = 2; i < 1234567; i++) {
		if (!kugyu[i]) {
			for (j = i * 2; j < 1234567; j += i) {
				kugyu[j] = 1;
			}
		}
	}
	if (scanf("%d", &X) != 1) return 1;
	for (tomatu = X; tomatu < 1234567; tomatu++) {
		if (!kugyu[tomatu]) {
			printf("%d\n", tomatu);
			return 0;
		}
	}
	puts("error");
	return 0;
}


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

long long n,v[100005],pos[100005][4],ans;
deque<int> tmp1,tmp2,tmp;

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

	cin>>n;
	
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	
	for(int i=0;i<100005;i++)pos[i][0]=pos[i][1]=-1,pos[i][2]=pos[i][3]=n;
	
	for(int i=0;i<n;i++){
		
		while(tmp2.size()>0 && v[tmp2.back()]<v[i])tmp2.pop_back();
		while(tmp1.size()>0 && v[tmp1.back()]<v[i]){
			tmp.push_back(tmp1.back());
			tmp1.pop_back();
		}
		
		if(tmp1.size()>0)pos[i][1]=tmp1.back();
		if(tmp1.size()>1)pos[i][0]=tmp1[tmp1.size()-2];
		if(tmp2.size()>0 && (pos[i][0]==-1 || tmp2.back()>pos[i][0]))pos[i][0]=tmp2.back();
		tmp1.push_back(i);
		
		while(tmp.size()>0){
			tmp2.push_back(tmp.back());
			tmp.pop_back();
		}
	}
	
	while(tmp1.size()>0)tmp1.pop_back();
	while(tmp2.size()>0)tmp2.pop_back();
	
	for(int i=n-1;i>=0;i--){
		
		while(tmp2.size()>0 && v[tmp2.back()]<v[i])tmp2.pop_back();
		while(tmp1.size()>0 && v[tmp1.back()]<v[i]){
			tmp.push_back(tmp1.back());
			tmp1.pop_back();
		}
		
		if(tmp1.size()>0)pos[i][2]=tmp1.back();
		if(tmp1.size()>1)pos[i][3]=tmp1[tmp1.size()-2];
		if(tmp2.size()>0 && (pos[i][3]==n || tmp2.back()<pos[i][3]))pos[i][3]=tmp2.back();
		tmp1.push_back(i);
		
		while(tmp.size()>0){
			tmp2.push_back(tmp.back());
			tmp.pop_back();
		}
	}
	
	for(int i=0;i<n;i++){
		//cout<<pos[i][0]<<"_"<<pos[i][1]<<"_"<<pos[i][2]<<"_"<<pos[i][3]<<endl;
		ans+=v[i]*((pos[i][2]-i)*(pos[i][1]-pos[i][0])+(i-pos[i][1])*(pos[i][3]-pos[i][2]));
		//cout<<ans<<" k"<<endl;
	}
	
	cout<<ans<<endl;

return 0;
}


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

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define eof !cin.eof()
#define pb push_back
#define pf push_front
#define pof pop_front
#define pob pop_back
#define ull unsigned long long
#define ll long long
#define ld long double
#define sz(a) a.size()
#define all(s) s.begin(), s.end()
#define rall(s, n) s, s + n
#define x first
#define y second
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ii pair <int, int>
#define iii pair <int, ii>
#define vi vector <int>
#define vit vector <int> :: iterator
#define vlt vector <ll> :: iterator
#define vl vector <ll>
#define vii vector <ii>
#define viii vector <iii>
#define vd vector <double>
#define vull vector <ull>
#define vc vector <char>
#define vs vector <string>
#define vb vector <bool>
#define vvi vector <vector <int>>
#define vvl vector <vector <ll>>
#define EPS 1e-10
#define INF 1000000000
#define mod 1000000007
#define reset(a, nilai) memset(a, nilai, sizeof(a))
#define minof min_element
#define maxof max_element
using namespace std;

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

	scanf("%d%d", &a, &b);
	if (a < 10 && b < 10) {
		printf("%d\n", a * b);
	} else {
		printf("-1\n");
	}
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace Aizu {
    public class OnlineJudge {
        static void Main() {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var dp = new int[input[0] + 1, input[1] + 1];
            var weight = new int[input[0]];
            var value = new int[input[0]];

            for (var i = 0; i < input[0]; ++i) {
                var line = Console.ReadLine().Split().Select(int.Parse).ToArray();
                value[i] = line[0];
                weight[i] = line[1];
            }

            for (var i = 0; i < input[0]; ++i) {
                for (var j = 0; j <= input[1]; ++j) {
                    if (j >= weight[i]) {
                        dp[i + 1, j] = Math.Max(dp[i, j - weight[i]] + value[i], dp[i, j]);
                    }
                    else {
                        dp[i + 1, j] = dp[i, j];
                    }
                }
            }

            Console.WriteLine(dp[input[0], input[1]]);
        }
    }
}



Measured memory_bytes: 13464
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1};
const vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0};
const vi d4y = {0, 1, 0, -1};

//----------------ここからだよ-------------------

int main(){
    int N; cin>>N;
    string S; cin>>S;
    rep(i,S.size()){
        int x= (int)'A' + ((int)S[i] +N -(int)'A')%26 ;
        S[i]=(char)x;
    }
    cout<<S<<endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::*;
use std::usize;
#[allow(unused_imports)]
use std::vec::Vec;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        ab: usize,
        bc: usize,
        _ca: usize,
    }
    println!("{}", ab * bc / 2);
}


Measured memory_bytes: 4352
// #include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>

typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)

const int INF = 1e9;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
   ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
   ostr << "}";
   return ostr;}

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


int main(void){
 ios::sync_with_stdio(false);

 string S;
 cin >> S;



 ll val1, val2;
 val1 = count(S.begin(), S.end(), '0');
 val2 = count(S.begin(), S.end(), '1');

 ll ans = 2 * min(val1, val2);

 cout << ans << endl;





 return 0;
}



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

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

int gcds(vector<int> x){
    int ans = x[0];
    for(int i = 1; i < (int)x.size(); i++)
    {
        ans = gcd(ans, x[i]);
    }
    return ans;
}

int main(){
    string s[3];
    for(int i = 0; i < 3; i++)
    {
        cin >> s[i];
    }
    int turn=0, num[3]={0};

    while(1){
        turn = s[turn][num[turn]++] - 'a';
        if(num[turn]>=s[turn].size()) break;
    }
    cout << (char)(turn+'A') << endl;

    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String alpha = sc.next();
        
        if(alpha.equals(alpha.toUpperCase())){
            System.out.println("A");
        } else {
        System.out.println("a");
        }
    }
}


Measured memory_bytes: 35612
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader sc = new FastReader();
        int N = sc.nextInt();
        if (N%2==1) {
            System.out.println(0);
            return;
        }
        int[] arr = new int[N];
        for (int i=0; i<N; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        int diff = arr[N/2]-arr[(N/2)-1];
        System.out.println(diff);
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


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

typedef long long int ll;
ll n, d;
vector<pair<ll, ll>> v;

int main() {
    scanf("%lld %lld", &n, &d);
    for(ll i = 0; i < n; ++i) {
        ll x, y;
        scanf("%lld %lld", &x, &y);
        v.push_back(make_pair(x, y));
    } 

    ll ans = 0;
    for(ll i = 0; i < n; ++i) {
        if(sqrt(v[i].first * v[i].first + v[i].second * v[i].second) <= d) ans++; 
    }

    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 7432
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <set>
#include <bitset>
typedef long long ll;
typedef long double ld;

#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;


int main() {
	ll N,K;
	cin >> N>>K;
	vector<ll>A(N);
	rep(i,N) {
		A[i] = i;
	}
	ll B=0;
	rep(i, K) {
		ll b;
		cin >> b;
		B |= (1 << b);
	}

	for (int i = 0; i < (1 << N); ++i) {
		vector<ll>C;
		for (int j = 0; j < N; ++j) {
			if ((i&(1 << j))) {
				C.push_back(A[j]);
			}
		}
		if ((i&B)==B) {
				cout << i << ":";
				for (int j = 0; j < C.size(); ++j) {
					cout << " " << C[j];
				}
				cout << endl;
		}
	}
	return 0;
}


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

signed main() {
  int H, W; cin >> H >> W;
  vector<vector<bool>> a(H, vector<bool>(W, false));
  rep(i, H) rep(j, W) {
    int n; cin >> n;
    if(n%2 == 0) a[i][j] = true;
  }
  vector<vector<int>> ans(0);
  
  rep(i, H) {
    if(i%2 == 0) {
      rep(j, W) {
        if(!a[i][j]) {
          if(j < W-1) {
            ans.push_back({i, j, i, j+1});
            a[i][j+1] = !(a[i][j+1]);
          } else {
            if(i == H-1) break;
            ans.push_back({i, j, i+1, j});
            a[i+1][j] = !a[i+1][j];
          }
        }
      }
    } else {
      rep(j, W) {
        if(!a[i][W-1-j]) {
          if(j < W-1) {
            ans.push_back({i, W-1-j, i, W-1-j-1});
            a[i][W-1-j-1] = !a[i][W-1-j-1];
          } else {
            if(i == H-1) break;
            ans.push_back({i, W-1-j, i+1, W-1-j});
            a[i+1][W-1-j] = !a[i+1][W-1-j];
          }
        }
      }
    }
  }
  
  cout << ans.size() << endl;
  rep(i, ans.size()) {
    rep(j, 3) cout << ans[i][j]+1 << " ";
    cout << ans[i][3]+1 << endl;
  }
}


Measured memory_bytes: 10928
#include <iostream>
using namespace std;
int main(void){
    long long n;
    cin>>n;
    bool point=true;
    for(long long i=0; i<n; i++){
        long long p; cin>>p;
        if(p%2==1) point=false;
    }
    
    if(point) cout<<"second"<<endl;
    else cout<<"first"<<endl;
}

Measured memory_bytes: 3576
/*
CODED BY               
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
using namespace std;

int main()
{
	fast;
	ll t,k;
	cin>>t>>k;
	ll a[k];
	ll sum=0;
	for (int i = 0; i < k; ++i)
	{
		cin>>a[i];
		sum+=a[i];
	}
	if(sum>t)
		cout<<"-1"<<endl;
	else
		cout<<t-sum<<endl;

}


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

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)
#define sz(x) int32_t(x.size())

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// --------------------------------------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9 + 7;
const int INF = 2e18;
const ld EPS = 1e-14;
const int NN = 1e5 + 2;

string to_string(string s) {
      return '"' + s + '"';
}
string to_string(const char* s) {
      return to_string((string) s);
}
string to_string(bool b) {
      return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
      return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
      bool first = true;  string res = "{";
      for (const auto &x : v) {
            if (!first) { res += ", "; }
            first = false; res += to_string(x);
      }
      res += "}";	  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
      cerr << " " << to_string(H);
      debug_out(T...);
}

#define TRACE

#ifdef TRACE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
//============================================================================

const ld pi = acos(-1.000);

void solve() {
      int h, m;
      int a, b;
      cin >> a >> b >> h >> m;
      double hour_ang = (double)m / 2 + h * 30;
      ld min_ang = 6 *m;
      ld ang = abs(hour_ang - min_ang);
      if(ang > 180) ang = 360 - ang;
      debug(hour_ang, min_ang, ang);
      ang *= pi / 180;
      ld ans = a*a + b*b - 2 * a * b * cos(ang);
      // assert(ans > EPS);
      ans = sqrt(ans) + EPS;
      cout << fixed << setprecision(15) << ans << el;
}

int32_t main() {
      ios::sync_with_stdio(false); cin.tie(0); 
      int T = 1; 
      // cin >> T;
      for(int tc = 1; tc <= T; tc++) {
            solve();
       }
      return 0;
}

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

ll n, m;
ll ans = 1;
const ll mod = 1e9 + 7;
map<ll,ll> mp;
ll a[33], b[33];

ll div(ll a, ll b, ll mod) {
  if (b == 1) return a;
  if (b == 0) return 1;
  ll aa;
  aa = div(a, b / 2, mod);
  aa *= aa;
  aa %= mod;
  if (b & 1) {
    aa *= a;
    aa %= mod;
  }
  return aa;
}

int main() {
  cin >> n >> m;
  ll tmp = m;
  for (int i = 2; i <= sqrt(m) + 1; i++) {
    while (tmp % i == 0 && tmp != 1) {
      mp[i]++;
      tmp /= i;
    }
    if (tmp == 1) break;
  }
  if (tmp != 1) mp[tmp]++;

  a[0] = n;
  for (int i = 1; i <= 32; i++) {
    a[i] = a[i - 1] * (n + i);
    a[i] %= mod;
  }

  for (ll i = 1; i <= 32; i++) {
    b[i] = i;
    if (i > 1) {
      b[i] *= b[i - 1];
      b[i] %= mod;
    }
  }

  for (int i = 2; i <= 32; i++) {
    b[i] = div(b[i], mod - 2, mod);
  }

  for (auto p: mp) {
    int num = p.second;
    ans *= a[num - 1];
    ans %= mod;
    ans *= b[num];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
inpl = lambda: list(map(int,input().split()))
from math import sqrt
class Factorizer():
    def __init__(self):
        self.primes_ceil = 3
        self.primes = [2]

    def find_primes(self, primes_ceil):
        prev_primes_ceil, self.primes_ceil = self.primes_ceil, primes_ceil
        for i in range(prev_primes_ceil, self.primes_ceil):
            sieve = 1
            for p in self.primes:
                if p*p > i:
                    break
                elif i % p == 0:
                    sieve = 0
                    break
            if sieve == 0:
                continue
            else:
                self.primes.append(i)

    def __call__(self, n):
        if (self.primes_ceil-1)**2 < n:
            self.find_primes(int(sqrt(n))+1)
        factors = []
        powers = []
        for p in self.primes:
            if p * p > n:
                break
            elif n % p == 0:
                n //= p
                k = 1
                while n % p == 0:
                    n //= p
                    k += 1
                factors.append(p)
                powers.append(k)
        if n > 1:
            factors.append(n)
            powers.append(1)
        return factors, powers

N, P = inpl()
fct=Factorizer()
f, p = fct(P)
n = len(f)
ans = 1
for i in range(n):
    ans *= f[i]**(p[i]//N)
print(ans)

Measured memory_bytes: 43580
def main():
    ans = 0
    n, k = map(int, input().split())
    s = input()
    arr = []
    if s[0] == '0':
        arr.append(0)
    cnt = 1
    i = 1
    while i != n:
        if s[i] != s[i - 1]:
            arr.append(cnt)
            cnt = 1
        else:
            cnt += 1
        i += 1
    arr.append(cnt)
    if s[-1] == '0':
        arr.append(0)
    ans = 0
    curr = arr[0]
    j = 1
    if len(arr) - 1 <= 2 * k:
        print(n)
        return 0
    for i in range(1, len(arr), 2):
        curr += arr[i] + arr[i + 1]
        if i - j == 2 * k:
            curr -= arr[j] + arr[j - 1]
            j += 2
        ans = max(ans, curr)
    print(ans)
    return 0
main()

Measured memory_bytes: 4092
// Believe in yourself...
#include<bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define F first
#define S second
#define sz(c) (c).size()
#define REP(i,n)  for(ll i=0;i<n;i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)

#define bit(num,i) ((num>>i)&1)

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

const ll inf=4e18;
const ll maxn=2010;

#pragma GCC Optimize("Ofast")

ll a[maxn];
vector<ll>tot,vec;
ll n,k,q;

void handle(){
	if(sz(vec)>=k){
		sort(vec.begin(),vec.end());
		FOR(w,0,(sz(vec)-k))
			tot.PB(vec[w]);
	}
	vec.clear();
}

int main(){
	cin>>n>>k>>q;
	ll ans=inf;
	REP(i,n){
		cin>>a[i];
	}
	REP(i,n){
		tot.clear();
		REP(j,n){
			if(a[j]<a[i]){
				handle();
			}
			else{
				vec.PB(a[j]);
			}
		}
		handle();
		if(sz(tot)>=q){
			sort(tot.begin(),tot.end());
			ans=min(ans,tot[q-1]-tot[0]);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
int main()
{
  double N;
  cin >> N;
  vector<double> v(N);
  REP(i, N) cin >> v[i];
  
  sort(ALL(v));
  stack<double> S;
  REPR(i,N-1){
    S.push(v.at(i));
  }
  while(S.size() > 1){
    double a = S.top();
    S.pop();
    double b = S.top();
    S.pop();
    S.push((a+b)/2);
  }
  cout << S.top() << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String before = sc.next();
		String after = sc.next();
		boolean canReplace = true;
		int length = before.length();
		canReplace = check(length, before, after);
		if(canReplace) {
			canReplace = check(length, after, before);
		}
		System.out.println(canReplace ? "Yes" : "No");
	}

	public static boolean check(int length, String str1, String str2) {
		boolean canReplace = true;
		boolean hasChecked[] = new boolean[length];
		end: for(int i = 0; i < length; i ++) {
			char first = str1.charAt(i);
			char shouldBe = str2.charAt(i);
			if(!hasChecked[i]) {
				for(int j = i; j < length; j ++) {
					if(str1.charAt(j) == first) {
						hasChecked[j] = true;
						if(str2.charAt(j) != shouldBe) {
							canReplace = false;
							break end;
						}
					}
				}
			}
		}
		return canReplace;
	}
}

Measured memory_bytes: 28464
//https://atcoder.jp/contests/abc114/tasks/abc114_c

import java.io.*;

class Main{
    static int N;
    static int ans = 0;
    static String[] a;
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        N = Integer.parseInt(str);
        a = new String[str.length()];
        dfs(0);
        System.out.println(ans);
    }

    public static void func(){
        int _3 = 0;
        int _5 = 0;
        int _7 = 0;
        int _a;
        for (int i=0;i<a.length;i++){
            if (a[i].equals("0")){
                if (_3!=0 || _5!=0 || _7!=0){
                    return;
                }
            }
            if(a[i].equals("3")){
                _3++;
            } else if (a[i].equals("5")){
                _5++;
            } else if (a[i].equals("7")){
                _7++;
            }
        }
        if (_3!=0 && _5!=0 && _7!=0){
            _a = Integer.parseInt(String.join("",a));
            if (_a<=N){
                ans++;
            }
        }
    }

    public static void dfs(int pos){
        if (pos==a.length){
            func();
        } else {
            a[pos] = "0";
            dfs(pos+1);
            a[pos] = "3";
            dfs(pos+1);
            a[pos] = "5";
            dfs(pos+1);
            a[pos] = "7";
            dfs(pos+1);
        }
    }
}

Measured memory_bytes: 30664
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	string s; cin >> s;
	s[5] = ' ';
	s[13] = ' ';
	cout << s << endl;
}

Measured memory_bytes: 256
i = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
d = 0
e = 0
z = 0
y = 0

for f in range(i):
    d = b[f] - a[f]
    if d > 0:
        z = z + a[f]
        y = a[f+1]
        a[f+1] = a[f+1] - d
        if a[f+1] <= 0:
            a[f+1] = 0
            z = z + y
        else:
            z = z + d
    elif d < 0:
        z = z + b[f]
    else:
        z = z + a[f]
print(z)

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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N; cin>>N;
	vector<int> B(N);
	map<int,ll> pre, suf;
	int a,c;
	for (int i=0; i<N; i++)
		cin>>a, pre[a]++;
	for (int i=0; i<N; i++)
		cin>>B[i];
	for (int i=0; i<N; i++)
		cin>>c, suf[-c]++;
	int cur=0;
	for (auto it : pre)
		cur+=it.second, pre[it.first]=cur;
	cur=0;
	for (auto it : suf)
		cur+=it.second, suf[it.first]=cur;
	ll ret=0;
	for (auto x : B) {
		auto it=pre.lower_bound(x);
		if(it==pre.begin())
			continue;
		it--;
		auto it2=suf.lower_bound(-x);
		if(it2==suf.begin())
			continue;
		it2--;
		ret+=(it->second)*(it2->second);
	}
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 13184
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    string s;
    cin>>s;
    int i;
    for (i=0;i<s.size();i+=2)
        cout<<s[i];
}

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

#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))-(a).begin()
#define upp(a,b) upper_bound(all(a),(b))-(a).begin()
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

int N;
int a[200020];
int dp[200020][20];
int d[200020][20];

signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    cin>>N;
    rep(i,0,N)cin>>a[i];
    rep(i,0,16)dp[N-1][i]=i;
    rep(i,0,16)d[N-1][i]=i;
    rrep(i,0,N-1){
        int tmp=0;
        int tmpcnt=1;
        int i4=1;
        rep(j,0,16){
            while(a[i]*i4>a[i+1]*tmpcnt){
                tmpcnt*=4;
                tmp++;
            }
            if(tmp<16)dp[i][j]=dp[i+1][tmp]+j;
            else dp[i][j]=dp[i+1][15]+(N-i-1)*(tmp-15)+j;
            i4*=4;
        }
    }
    
    rep(i,0,N)a[i]*=-2;
    reverse(a,a+N);
    rrep(i,0,N-1){
        int tmp=0;
        int tmpcnt=1;
        int i4=1;
        rep(j,0,16){
            while(a[i]*i4<a[i+1]*tmpcnt){
                tmp++;
                tmpcnt*=4;
            }
            if(tmp<16)d[i][j]=d[i+1][tmp]+j;
            else d[i][j]=d[i+1][15]+(N-i-1)*(tmp-15)+j;
            i4*=4;
        }
    }
    
    int ans=min(dp[0][0]*2,INF);
    
    //rep(i,0,N)rep(j,0,16)cout<<i<<" "<<j<<" "<<d[i][j]<<endl;
    rep(i,1,N){
        chmin(ans,i+d[N-i][0]*2+dp[i][0]*2);
        //cout<<i<<" "<<d[N-i][0]*2<<" "<<2*dp[i][0]<<endl;
    }
    
    cout<<ans<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    return 0;
}

Measured memory_bytes: 64384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
#define LLINF 2000000000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
// #define int long long

signed main(){
  string n;
  int k;
  cin >> n >> k;
  int a[n.length()];
  LOOP(i,n.length()){
    a[i] = n[i]-'0';
    // if(a[i]==0)a[i]=0;
  }
  int dp[101][4][2] = {};
  int l = n.length();
  dp[0][0][true] = 1;
  LOOP(i,l){
    if(i!=0)  dp[i][0][false] = 1;
    LOOP(j,3){
      // dp[i+1][j][false] += dp[i][j][true] + dp[i][j][false]; // 0をi桁目に入れる
      if(a[i] == 0){
        dp[i+1][j+1][true] += dp[i][j+1][true];
        dp[i+1][j+1][false] += dp[i][j+1][false] + dp[i][j][false]*9;
      }else{
        dp[i+1][j+1][true] += dp[i][j][true];
        dp[i+1][j+1][false] += dp[i][j][true]*(a[i]-1) + dp[i][j][false] * 9;
        dp[i+1][j+1][false] += dp[i][j+1][true] + dp[i][j+1][false];
      }
    }
  }
  // LOOP(i,n.length()+1){
  //   LOOP(j,4){
  //     cerr << dp[i][j][false] << ":" << dp[i][j][true] << " ";
  //   }cerr << endl;
  // }
  cout << dp[n.length()][k][false] + dp[l][k][true] << endl;
}


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 REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll modinv(ll a, ll m) {ll b = m, u = 1, v = 0;while (b) {ll t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}
const int INF = 1e9;
const ll LLINF = 1e16;

int main(void)
{
    int a;
    cin >> a;
    if(a >= 30){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

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

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

	

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	db pi = 3.141592653589793238463;
	int r;
	cin >> r;
	cout << setprecision(20) << 2 * r * pi;
}


Measured memory_bytes: 3800
// -*- coding:utf-8-unix -*-

use std::cmp::*;
use std::collections::*;
use std::fs::File;
use std::io::prelude::*;
use std::io::*;
use std::vec;

const INF: i64 = 1223372036854775807;
const MEM_SIZE: usize = 202020;
const MOD: usize = 1000000007;
use std::cmp::*;
use std::collections::*;
use std::io::stdin;
use std::io::stdout;
use std::io::Write;
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(unused_macros)]
macro_rules! p {
    ([$($x:expr), *]) => {{
        let mut f = true;
        $(
            print!("{}{}", if f {""} else {" "}, $x);
            f = false;
        )*
78786    print!("\n");
    }};
    ($x:expr) => {{
        let mut f = true;
        for a in $x.iter() {
            print!("{}{}", if f {""} else {" "}, a);
            f = false;
        }
        print!("\n");
    }};
}
#[allow(dead_code)]
fn readii() -> (i64, i64) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<i64>().unwrap(),
        iter.next().unwrap().parse::<i64>().unwrap(),
    )
}
#[allow(dead_code)]
fn readuu() -> (usize, usize) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
    )
}

fn solve() {
    let mut n: usize = read();
    let mut vv: Vec<usize> = read_vec();
    let mut res: usize = 1;
    let mut vec = vec![0; MEM_SIZE];
    vec[0] = 3;
    for i in 0..n {
        let x = vv[i];
        res = res * vec[x] % MOD;
        vec[x] -= 1;
        vec[x + 1] += 1;
    }
    println!("{:?}", res);
    return;
}
fn main() {
    solve()
}


Measured memory_bytes: 3988
///******* In the name of Allah *******///

#include <bits/stdc++.h>
using namespace std;

//long int ar[10013];
//long int gcd(long int a, long int b)
//{
//    if(b==0)
//        return a;
//    return gcd(b,a%b);
//}
//void sieve()
//{
//    long long int i,j,k = 0;
//    memset(ar,0,sizeof(ar));+
//    ar[1] = 1;
//    for(i=2; i<=713; i++)
//    {
//        if(ar[i]==0)
//        {
//            for(j=i+i; j<=713; j+=i)
//            {
//                ar[j] = 1;
//            }
//        }
//    }
//}

void Ok()
{
    long int a,b,c,d,e,f,g,h,t,i,j,k,l,m,n,Min,Max;
    long int ans_1,ans_2,ans_3,cnt_1,cnt_2,cnt_3,flag_1,flag_2,flag_3,temp,sum;
    double aa,bb,cc,dd,ee,ff,gg;
    char aaa[13],bbb,ccc,ddd;
    string spc,in,store;

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

    cnt_1 = 0;
    cin>>a>>b>>c;
    while(1)
    {
        if(a<=0)
            break;
        a -= b;
        cnt_1 += c;
    }
    cout<<cnt_1<<endl;

    return;
}

int main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    Ok();

    return 0;
}


Measured memory_bytes: 3640
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

arr=[int(arr_data[0][x]) for x in range(3)]

print(max(arr)-min(arr))

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

int main() {
  int k;
  string s;
  cin >> k >> s;

  if(s.size() <= k) cout << s << endl;
  else{
    string ans = s.substr(0,k);
    ans += "...";
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3580
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n;
	cin >> n;
	vector<int>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	sort(a.rbegin(), a.rend());
	int ans = 0;
	int t = n - 1;
	rep(i, n) {
		int lim = 2;
		if (i == 0)lim = 1;
		rep(j,lim) {
			if (t > 0) {
				ans += a[i];
				t--;
			}
		}
	}
	print(ans);
}

Measured memory_bytes: 4840
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;

int a[200005], b[200005];
int ans;
int main() {
	int N; scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		scanf("%d", a + i);
	}
	for (int i = 1; i <= N; i++) {
		scanf("%d", b + i);
	}
	for (int bit = 0; bit < 30; bit++) {
		vector<int> va[2], vb[2];
		for (int i = 1; i <= N; i++) {
			va[bool(a[i] & (1 << bit))].push_back(a[i] & ((1 << bit) - 1));
			vb[bool(b[i] & (1 << bit))].push_back(b[i] & ((1 << bit) - 1));
		}
		sort(va[0].begin(), va[0].end());
		sort(vb[0].begin(), vb[0].end());
		sort(va[1].begin(), va[1].end());
		sort(vb[1].begin(), vb[1].end());
		bool tot = 0;
		int target = 1 << bit;
		for (int x : va[0]) {
			tot ^= (lower_bound(vb[1].begin(), vb[1].end(), target - x) - vb[1].begin()) & 1;
			tot ^= (vb[0].size() - (lower_bound(vb[0].begin(), vb[0].end(), target - x) - vb[0].begin())) & 1;
		}
		for (int x : va[1]) {
			tot ^= (lower_bound(vb[0].begin(), vb[0].end(), target - x) - vb[0].begin()) & 1;
			tot ^= (vb[1].size() - (lower_bound(vb[1].begin(), vb[1].end(), target - x) - vb[1].begin())) & 1;
		}
		if (tot) ans |= target;
	}
	printf("%d", ans);

}

Measured memory_bytes: 4780
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

class Util{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		long[] abcd = rla();
		long a = abcd[0];
		long b = abcd[1];
		long c = abcd[2];
		long d = abcd[3];

		long ans = 0;
		ans = a * c;
		ans = Math.Max(a * d, ans);
		ans = Math.Max(b * c, ans);
		ans = Math.Max(b * d, ans);

		Console.WriteLine(ans);
		Console.ReadLine();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static BigInteger rb(){return BigInteger.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
	static BigInteger[] rba(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>BigInteger.Parse(e));}
    static int[] generateNums(int num, int N){return Enumerable.Repeat(num, N).ToArray();}
    static int[] generateSuretsu(int N){return Enumerable.Range(0, N).ToArray();}
}

public static class Combination {
	//使い方:int[][] Is = Combination.Enumerate(nums, k, withRepetition:false).ToArray();
    public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition) {
        if (k == 1) {
            foreach (var item in items)
                yield return new T[] { item };
            yield break;
        }
        foreach (var item in items) {
            var leftside = new T[] { item };

            // item よりも前のものを除く （順列と組み合わせの違い)
            // 重複を許さないので、unusedから item そのものも取り除く
            var unused = withRepetition ? items : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

            foreach (var rightside in Enumerate(unused, k - 1, withRepetition)) {
                yield return leftside.Concat(rightside).ToArray();
            }
        }
    }
}


Measured memory_bytes: 27564