akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
//# define M_PI           3.14159265358979323846264338327950288

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::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...);
}
#else
#define trace(...)
#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
const LL maxn = 1e7+1;
LL prime[maxn];
LL divisor[maxn];
void seive(){
	for(LL i=2;i<maxn;i++){
		if(!prime[i]){
			divisor[i] = i;
			for(LL j=i*i;j<maxn;j+=i){
				if(divisor[j] == 0)
					divisor[j] = i;
				prime[j] = 1;
			}
		}
	}
}
LL n;
int main() {
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
	cin>>n;
	if(n == 1){
		cout<<1;
		return 0;
	}
	for(LL i=0;i<maxn;i++){
		prime[i] = 0;
		divisor[i] = 0;
	}
	seive();
	LL ans = 1;
	// for(int i=2;i<=10;i++){
	// 	cout<<divisor[i]<<" ";
	// }
	// cout<<prime[3163];
	for(LL i=2;i<=n;i++){
		LL pro = 1;
		LL prev = divisor[i];
		LL cnt = 0;
		LL t = i;
		while(t != 1){
			if(prev == divisor[t])
				cnt++;
			else{
				pro *= (cnt + 1);
				cnt = 1;
			}
			prev = divisor[t];
			t /= divisor[t];
		}
		pro *= (cnt + 1);
		ans += i * pro;
	}
	cout<<ans;
  	return 0;
}

Measured memory_bytes: 159908
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
using LL = long long;
#define MAX 100001
LL pow2_n[MAX];

void pow_init() {
	pow2_n[0] = 1;
	for (int n = 1; n < MAX; n++) {
		pow2_n[n] = pow2_n[n - 1] * 2;
	}
}


int main() {
	int N;
	cin >> N;
	N = N + 1;
	vector<LL> A(N);
	for (int n = 0; n < N; n++) {
		cin >> A[n];
	}

	vector<LL> ha(N);
	ha[N - 1] = A[N - 1];
	for (int n = N-2; n >=0; n--) {
		ha[n] = ha[n+1]+A[n];
	}
	vector<LL> choten(N);
	for (int n = 0; n < N; n++) {
		if (n == 0) {
			choten[0] = 1;
		}
		else {
			choten[n] = min((choten[n - 1] - A[n - 1]) * 2, ha[n]);
		}

		if (choten[n] < A[n]) {
			cout << -1 << endl;
			return 0;
		}
	}
	LL ans = 0;
	for (int n = 0; n < N; n++) {
		ans += choten[n];
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 5640
#include <iostream>
#include <string>

using namespace std;

int main() {
  int d_max;
  cin >> d_max;

  for (int d = 0; d < d_max; ++d) {
    int n;
    string str;
    cin >> n >> str;

    bool data[10001][2] = {};
    for (int i = 1; i <= 4 * n; ++i) {
      int a = (i <= 2 * n) ? i / 2 : (i - 2 * n) / 2;
      int b = int(2 * n < i);
      if (str[i-1] == 'Y')
        data[a][b] = true;
    }

    int col = 0;
    int row = -1;
    int cost = 0;

    for (col = 0; col <= n; ++col) {
      if (!data[col][0] && !data[col][1]) {
        cost += 1;
        continue;
      }
      cost += data[col][1] ? 3 : 2;
      row = data[col][1] ? 1 : 0;
      break;
    }

    for (++col; col <= n; ++col) {
      if (!data[col][0] && !data[col][1]) {
        cost += 1;
        continue;
      }
      cost += (data[col][0] && data[col][1]) ? 3 : 2;
      row = data[col][0] ? 0 : 1;
    }

    cout << ((row == 1) ? cost : cost - 1) << endl;
  }
}


Measured memory_bytes: 3284
#include<stdio.h>
#include<algorithm>
using namespace std;
int n, K;
long long S[101000], S2[101000], Res;
int main(){
    int i;
    scanf("%d%d",&n,&K);
    for(i=1;i<=n;i++){
        scanf("%lld",&S[i]);
        S2[i] = max(0ll,S[i]);
        S[i] += S[i-1];
        S2[i] += S2[i-1];
    }
    for(i=0;i<=n-K;i++){
        Res = max(Res,S2[i] + S2[n] - S2[i+K]);
        Res = max(Res,S2[i] + S2[n] - S2[i+K] + S[i+K] - S[i]);
    }
    printf("%lld\n",Res);
}

Measured memory_bytes: 1792
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int n;
    cin >> n;

    lint y = 0, z = 1;
    rep(i, n){
        int q;
        lint x;
        cin >> q >> x;
        if(q == 1){
            y *= x;
            z *= x;
        }else if(q == 2){
            y += x;
            z += x;
        }else{
            y -= x;
            z -= x;
        }
    }

    assert(y != z);

    lint a = -y;
    lint b = z - y;

    cout << a << ' ' << b << endl;

    cout << flush;

    return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    char a,b;
    cin >> a >> b;
    if (a == 'H')
        cout << b << endl;
    else
        cout << (b=='D'? 'H' : 'D') << endl;
}

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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


int solve(){
  int x,y;cin>>x>>y;

  if (x%y==0) {
    cout << -1 << endl;
  }
  else{
    cout << x << endl;
  }

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;
	template<class T>using pair = std::pair<T, T>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
	
	template<class T>constexpr T pow(T val, std::uint64_t p)
	{
		auto ret = T(1);
		auto s = 1ULL;
		for (auto i = 0; i < 63; ++i, s <<= 1)
		{
			if (p & s)
			{
				ret *= val;
			}
			val *= val;
		}
		return ret;
	}
	template<class Range>void sort(Range& rng)
	{
		std::sort(std::begin(rng), std::end(rng));
	}
	template<class Range, class Pred>void sort(Range& rng, Pred pred)
	{
		std::sort(std::begin(rng), std::end(rng), pred);
	}
}

void Main()
{
	int N, X, T;
	std::cin >> N >> X >> T;
	std::cout << (N / X + bool(N % X)) * T << std::endl;
}

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

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    int N,R;cin>>N>>R;
    cout<<R+100*max(0,10-N)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n; ll d; scanf("%d%lld", &n, &d);
	int ans = 0;
	REP(i, n){
		ll x, y; scanf("%lld%lld", &x, &y);
		if(x*x + y*y <= d*d) ans++;
	}
	printf("%d\n", ans);
}


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

struct TPond
{
	int DownPoint;
	int Surface;
};

void ConstructPond(stack<TPond> &PondRow, stack<int> &DownPointRow, int InputCount)
{
	TPond Pond;
	Pond.DownPoint = DownPointRow.top();
	Pond.Surface = InputCount - DownPointRow.top();
	//????????´???????±????????????§???????±????????????????????????°?±?list???????????????
	//????????´???????±????????????§???????±????????????????????????°????????´???????±???????????????????
	if(!PondRow.empty() && Pond.DownPoint < PondRow.top().DownPoint){
		while(!PondRow.empty() && Pond.DownPoint < PondRow.top().DownPoint){
			Pond.Surface += PondRow.top().Surface;
			PondRow.pop();
		}
	}
	PondRow.push(Pond);
	DownPointRow.pop();
	return;
}

void Output(stack<TPond> PondRow)
{
	stack<TPond> DummyPondRow;
	int Count = 0;
	//?????¢???????±???????
	int SumOfSurface = 0;
	while(!PondRow.empty()){
		SumOfSurface += PondRow.top().Surface;
		DummyPondRow.push(PondRow.top());
		PondRow.pop();
		Count += 1;
	}
	//?????¢?????¨??°???????????????
	cout << SumOfSurface << endl << Count << ' ';
	//?????????????????¢??????????????????
	for(int i = 0; i < Count - 1; i++){
		cout << DummyPondRow.top().Surface << ' ';
		DummyPondRow.pop();
	}
	cout << DummyPondRow.top().Surface << endl;
	return;
}

int main()
{
	//?±?(????????????????????°??¨??¢???????????±?????????)????????????list???????????????
	stack<TPond> PondRow;
	//????????????????????°????????????stack???????????????
	stack<int>   DownPointRow;
	//????????????????????°???????????????????????????????????°???????????????
	int InputCount = 0;
	while(true){
		//??????????????????????????\???????????\?????????
		char Input;
		cin >> Input;
		if(cin.good() == false){
			break;
		}
		InputCount += 1;
		//???????????\???????????????DownPointRow???????????????
		if(Input == '\\'){
			DownPointRow.push(InputCount);
		}//???????????\????????????????????´?????????????????????????±?????§??????????
		if(Input == '/' && !DownPointRow.empty()){
			ConstructPond(PondRow, DownPointRow, InputCount);
		}
	}
	if(PondRow.empty()){
		cout << 0 << endl << 0 << endl;
	}else{
		Output(PondRow);
	}
	return 0;
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;


int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];

    vector<ll> plus, minus;
    for (ll l : v)
        if (l < 0) minus.push_back(l);
        else plus.push_back(l);

    sort(plus.rbegin(), plus.rend());
    sort(minus.begin(), minus.end());

    if (plus.empty()) plus.push_back(minus.back()), minus.pop_back();
    if (minus.empty()) minus.push_back(plus.back()), plus.pop_back();

    vector<P> ans;


    while (plus.size() > 1) {
        ll m = minus.back();
        minus.pop_back();
        ll p = plus.back();
        plus.pop_back();

        ll next = m - p;
        assert(next <= 0);
        minus.push_back(next);

        ans.push_back({m, p});
    }

    while (minus.size() > 1) {
        ll m = minus.back();
        minus.pop_back();
        ll p = plus.back();
        plus.pop_back();

        ll next = p - m;
        assert(next >= 0);
        plus.push_back(next);

        ans.push_back({p, m});
    }

    ans.push_back({plus.back(), minus.back()});

    cout << ans.back().first - ans.back().second << endl;

    for (P p : ans) printf("%lld %lld\n", p.first, p.second);

}

Measured memory_bytes: 7872
import java.util.*;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int[] x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = Integer.parseInt(sc.next());
        }

        int trial = n - k + 1;
        int time = 0;
        int min = Integer.MAX_VALUE;

        if (k == 1) {
            for (int i = 0; i < trial; i++) {
                time = Math.abs(x[i]);
                min = Math.min(min, time);
            }
            System.out.println(min);
            return;
        }

        for (int i = 0; i < trial; i++) {
            int start = x[i];
            int end = x[i + k - 1];
            time = Math.abs(start) + Math.abs(end - start);
            min = Math.min(min, time);
            time = Math.abs(end) + Math.abs(end - start);
            min = Math.min(min, time);
        }
        System.out.println(min);
    }
}

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



    int main(){
        int K;
        long long int N;
        cin >> K >> N;
        vector<int> A;
        int tmp1;
        for(int i=0;i<N;i++){
            cin >> tmp1;
            A.insert(A.begin()+i,tmp1);
        }

        int ans1,ans2,ans3;
        ans1 = A[N-1]-A[0];
        long long int tm2,tm3;

        //順走
        for(int i=1;i<N;i++){
        ans2 = K-A[i] + A[i-1];
        if(i==1)tm2=ans2;
        else if(tm2>ans2)tm2 = ans2;
        }

        //逆走
        for(int i=0;i<N-1;i++){
        ans3 = A[i] + K-A[i+1];
        if(i==0)tm3 = ans3;
        else if(tm3>ans3)tm3 = ans3;
        }

        ans2 = tm2;
        ans3 = tm3;

        int tmp;
        if(ans1 >= ans2) tmp = ans2;
        else tmp = ans1;

        if(tmp>=ans3) tmp = ans3;

        cout << tmp << endl;
        //cout << ans1 << " " << ans2 << " " << ans3 << endl;

        
        return 0;

    }

Measured memory_bytes: 1400
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    n=int(input())
    s=input()
    
    #print(s)
    doubutu1=["W","W"]
    doubutu2=["S","W"]
    doubutu3=["W","S"]
    doubutu4=["S","S"]
    def doubutuappender(doubutu):
        for i in range(1,n):
            if doubutu[i]=="S":
                doubutu.append( ["SW"["S"==doubutu[i-1]] ,doubutu[i-1]][s[i]=="o"])
            else:
                doubutu.append( [doubutu[i-1] ,"SW"["S"==doubutu[i-1]]][s[i]=="o"])
        return doubutu
    for i in [doubutuappender(doubutu1),doubutuappender(doubutu2),doubutuappender(doubutu3),doubutuappender(doubutu4)]:
        if i[0]==i[-1]:
            if s[0]=="o" and i[0]=="S" and i[1]==i[-2]:
                print("".join(i[:-1]))
                exit()
            elif s[0]=="x" and i[0]=="S" and i[1]!=i[-2]:
                print("".join(i[:-1]))
                exit()
            elif s[0]=="o" and i[0]=="W" and i[1]!=i[-2]:
                print("".join(i[:-1]))
                exit()
            elif s[0]=="x" and i[0]=="W" and i[1]==i[-2]:
                print("".join(i[:-1]))
                exit()
    print(-1)
if __name__ == '__main__':
    main()

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

int main(void){
    int n,k,q,seikai;
	int point[100000];
    cin >> n;
	cin >> k;
	cin >> q;

	// 初期化
	for(int i=0;i<n;i++){
		point[i] = 0;
	}

	// ラウンドの処理
	for(int i=0;i<q;i++){
		cin >> seikai;
		point[seikai - 1] = point[seikai - 1] + 1;
	}

	// 判定
	for(int i=0;i<n;i++){

		int saisyu_point = k - q + point[i];
		if(saisyu_point > 0){
			cout << "Yes" <<  endl;
		}
		else{
			cout << "No" <<  endl;
		}
	}
}

Measured memory_bytes: 1024
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll N, K;
  cin >> N >> K;
  const ll res = 1 + static_cast<ll>(
                         ceil(static_cast<ld>(N - K) / static_cast<ld>(K - 1)));
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3656
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		List<String> vl = Arrays.asList(sc.nextLine().split(" "));

		List<String> cl = Arrays.asList(sc.nextLine().split(" "));

		int result = 0;

		for(int i=0; i<n;i++) {
			int v = Integer.parseInt(vl.get(i));
			int c = Integer.parseInt(cl.get(i));
			if(v-c>0) {
			result += (v-c);
			}
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 23892
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int mathNum = Integer.parseInt(sc.next());
        int priceMathNum = Integer.parseInt(sc.next());
        int start = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        for (int x=1; x<=priceMathNum; x++) {
            list.add(Integer.parseInt(sc.next()));
        }
        int x = 0;
        int y = 0;
        for (int z:list) {
            if (start > z) {
                x++;
            } else {
                y++;
            }
        }
        
        System.out.println(x>y?y:x);
    }
}

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

int main() {
  char b;
  cin >> b;
  if(b == 'A'){
    cout << 'T' << endl;
  }
  if(b == 'T'){
    cout << 'A' << endl;
  }
  if(b == 'C'){
    cout << 'G' << endl;
  }
  if(b == 'G'){
    cout << 'C' << endl;
  }
}


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

int main(int argc, char **argv) {
  long N, M;

  cin >> N >> M;

  priority_queue<pair<long, long>> ABCmap;

  for (long i = 0; i < N; i++) {
    long A;
    cin >> A;
    ABCmap.push(make_pair(A, 1));
  }

  for (int i = 0; i < M; i++) {
    long B, C;
    cin >> B >> C;
    ABCmap.push(make_pair(C, B));
  }

  long ans = 0;
  long cnt = 0;
  pair<long, long> tmp = make_pair(0, 0);

  while (N > 0) {
    if (tmp.second <= 0) {
      tmp = ABCmap.top();
      ABCmap.pop();
    }

    ans += tmp.first;
    N--;
    tmp.second--;
  }

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


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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */

signed main() 
{
  int x,a,b;
  cin >> x >> a >> b;
  if(b-a<=0) print("delicious");
  else if(b-a<=x) print("safe");
  else print("dangerous");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N=100010;
int main(){
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	long long i,j,n,a[N],dp[N],k;
	cin>>n>>k;
	for(i=0;i<n;++i) cin>>a[i];
	dp[0]=0;
	for(i=1;i<k;++i){
		dp[i]=abs(a[i]-a[0]);
		for(j=1;j<i;++j) dp[i]=min(dp[j]+abs(a[i]-a[j]),dp[i]);
	}
	for(i=k;i<n;++i){
		dp[i]=dp[i-k]+abs(a[i]-a[i-k]);
		for(j=i-k+1;j<i;++j) dp[i]=min(dp[j]+abs(a[i]-a[j]),dp[i]);
	}
	cout<<dp[n-1];
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define pb push_back
#define pf push_front
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
 
ll gcd(ll x, ll y) {
	ll r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
	}
ll lcm(ll x, ll y) {
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x*y);
}

int main()
{
	string s;
	int i,k;
	cin >> s >> k;
	for(i=0;s[i]=='1';i++);
	cout << (i<k?s[i]:'1') << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int count=0;
    while(sc.hasNext()) {
      String line = sc.nextLine();
      if(line.equals(new StringBuilder(line).reverse().toString())) {
        count++;
      } 
    }    
    System.out.println(count);
  }
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N, K;
    cin >> N >> K;
    map<ll, ll> mp;
    for (ll i = 0; i < N; i++) {
        ll a, b;
        cin >> a >> b;
        mp[a] += b;
    }
    ll cnt = 0;
    for (const auto& p : mp) {
        cnt += p.second;
        if (cnt >= K) {
            cout << p.first << endl;
            break;
        }
    }
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 4224
#include<stdio.h>
int main(void)
{
int n,i;
  float a[103],sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
  scanf("%f",&a[i]);
  }
  for(i=0;i<n;i++)
  {
  sum+=(1/a[i]);
  }
  float ans = 1/sum;
  printf("%f",ans);
return 0;
}

Measured memory_bytes: 128
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/


//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if((a==b && b!=c) || (a==c && c!=b) || (c==b && b!=a)){
        cout << "Yes";
    }else{
        cout << "No";
    }
    cout << endl;
}

Measured memory_bytes: 256
n = int(input())
A = [list(map(int, input().split())) for i in range(2)]
work = [A[0][0]+A[1][n-1] for i in range(n)]
for i in range(n):
    work[i] += sum(A[0][1:i+1]) + sum(A[1][i:n-1])
print(max(work))


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

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

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	string S;
	cin >> S;
	int N = S.size();

	string RS = S;
	string S1 = S.substr(0, (N-1)/2);
	string RS1 = S1;
	string S2 = S.substr((N+3)/2 - 1);
	string RS2 = S2;
	
	reverse(RS.begin(), RS.end());
	reverse(RS1.begin(), RS1.end());
	reverse(RS2.begin(), RS2.end());

	if(S == RS && S1 == RS1 && S2 == RS2){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;

}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1e9+7;

// void chmod(ll &M){
//     if(M >= mod) M %= mod;
//     else if(M < 0){
//         M += (abs(M)/mod + 1)*mod;
//         M %= mod;
//     }
// }

const ll inf = 1LL<<60;
const int MAX_V = 5050;
const int MAX_E = 5050;

struct Edge{ll from, to, cost; };

int V; // 頂点の数
int E; // 辺の数
vector<ll> d(MAX_V, inf); // 距離
vector<bool> negative(MAX_E, false); // 負の閉路検出
vector<Edge> edge;

void Bellman_Ford(){
    d[0] = 0; // 始点の初期化
    for(int loop=0; loop<V-1; ++loop){
        for(int i=0; i<E; ++i){
            if(d[edge[i].from] == inf) continue;

            if(d[edge[i].to] > d[edge[i].from]+edge[i].cost){
                d[edge[i].to] = d[edge[i].from]+edge[i].cost;
            }
        }
    }

    for(int loop=0; loop<2*V; ++loop){
        for(int i=0; i<E; ++i){
            if(d[edge[i].from] == inf) continue;

            if(d[edge[i].to] > d[edge[i].from]+edge[i].cost){
                d[edge[i].to] = d[edge[i].from]+edge[i].cost;
                negative[edge[i].to] = true;
            }

            if(negative[edge[i].from]) negative[edge[i].to] = true;
            
        }
    }
}

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

    int p; cin >> V >> E >> p;
    for(int i=0; i<E; ++i){
        int a, b, c; cin >> a >> b >> c;
        --a; --b; c = p-c;
        edge.push_back({a, b, c});
    }

    Bellman_Ford();

    if(negative[V-1] || d[V-1] == inf) cout << -1 << endl;
    else cout << max(0LL, -d[V-1]) << endl;

	return 0;
}


Measured memory_bytes: 640
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int r, g, b;
  cin >> r >> g >> b;

  int ans = (100 * r + 10 * g + b) % 4;
  cout << (ans == 0 ? "YES" : "NO") << endl;


  
  return 0;
}

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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[],int n){
    for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
    }
    cout<<endl;
}

int main() {
    int i,n,m,c=0,k,sum=0;
    c_p_c();
 	// cin>>n;
 	string s;
 	cin>>s;
 	// cout<<s<<endl;
 	n=(int)s.size();
 	// cout<<s[0]<<s.size()-2<<s[n-1]<<endl;
 	cout<<s[0];
 	cout<<n-2;
 	cout<<s[n-1]<<endl;;
 	return 0;

   }

Measured memory_bytes: 3620
# include <cstdio>
# include <iostream>
# include <algorithm>
# define R register int

using namespace std;

const int maxn=205;
int n,ans;
int l[maxn];

int main()
{
    scanf("%d",&n);
    for (R i=1;i<=2*n;++i) scanf("%d",&l[i]);
    sort(l+1,l+1+2*n);
    for (R i=1;i<=n;++i)
        ans+=l[2*i-1];
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> a(N+1), b(N+1);
    for(int i=1; i<=N; i++) {
        cin >> a[i];
    }

    for(int i=N; i>0; i--) {
        int cnt = 0;
        for(int j=2; i*j<=N; j++) {
            cnt += b[i*j];
        }
        b[i] =  a[i]^cnt%2;
    }

    cout << accumulate(b.begin(), b.end(), 0) << endl;
    for(int i=1; i<=N; i++) {
        if(b[i]) {
            cout << i << ' ';
        }
    }
    return 0;
}


Measured memory_bytes: 2432
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int solve()
{
	ll x,y,z;cin>>x>>y>>z;
	cout<<z<<" "<<x<<" "<<y<<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORr(i, k, n) for(int i = (k); i > (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORr(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

int main(void){
  int a, b;
  cin >> a >> b;
  
  int plug = 1;
  int ans = 0;
  while(plug < b){
    plug += a-1;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {

	public static void main(String[] args) {
		Task task = new Task();
		task.solve();
	}

	public static class Task {
		static final long MOD = (long) 1e9 + 7;

		public void solve() {
			Scan sc = new Scan();
			int m = (int) sc.scanLong();
			int n = (int) sc.scanLong();
			int[][] grid = new int[m][n];
			int colors = (int) sc.scanLong();
			int[] counts = new int[colors];
			for (int i = 0; i < colors; ++i)
				counts[i] = (int) sc.scanLong();

			int curr = 0;
			for (int i = 0; i < m; ++i) {
				for (int j = 0; j < n; ++j) {
					// i is even => right, else => left
					if (counts[curr] == 0) {
						++curr;
					}
					if (i % 2 == 0)
						grid[i][j] = curr + 1;
					else
						grid[i][n - j - 1] = curr + 1;
					--counts[curr];
				}
			}

			for (int i = 0; i < m; ++i) {
				for (int j = 0; j < n; ++j)
					System.out.print(grid[i][j] + " ");
				System.out.println();
			}
		}
	}

	public static class Scan {
		private byte[] buf = new byte[1024];
		private int index;
		private InputStream in;
		private int total;

		public Scan() {
			in = System.in;
		}

		public int scan() {
			if (total < 0)
				throw new InputMismatchException();
			if (index >= total) {
				index = 0;
				try {
					total = in.read(buf);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				if (total <= 0)
					return -1;
			}
			return buf[index++];
		}

		public long scanLong() {
			long integer = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n)) {
				if (n >= '0' && n <= '9') {
					integer *= 10;
					integer += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			return neg * integer;
		}

		public double scanDouble() throws IOException {
			double doub = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n) && n != '.') {
				if (n >= '0' && n <= '9') {
					doub *= 10;
					doub += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			if (n == '.') {
				n = scan();
				double temp = 1;
				while (!isWhiteSpace(n)) {
					if (n >= '0' && n <= '9') {
						temp /= 10;
						doub += (n - '0') * temp;
						n = scan();
					} else
						throw new InputMismatchException();
				}
			}
			return doub * neg;
		}

		public String scanString() {
			StringBuilder sb = new StringBuilder();
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			while (!isWhiteSpace(n)) {
				sb.append((char) n);
				n = scan();
			}
			return sb.toString();
		}

		public char scanChar() {
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			return (char) n;
		}

		private boolean isWhiteSpace(int n) {
			if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
				return true;
			return false;
		}
	}
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  vector<int> B(N);
  

  for(int i=0;i<N;i++){
    B.at(A.at(i)-1) = i+1;
  }
  
  
  for(int i=0;i<N;i++){
    cout << B.at(i);
    if(i<N){
      cout << " ";
    }
  }
  cout << endl;
}


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

int main() {
  int N, K, sum = 0, x = 0;
  cin >> N >> K;
  int X[N];

  for (int i = 0; i < N; i++)
    cin >> X[i];

  for (int i = 0; i < N; i++) {
    x = X[i];
    if (K - x < x)
      sum += (K - x) * 2;
    else
      sum += x * 2;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)


int main() {
	lint L, R;
	cin >> L >> R;
	lint ans = 10000000000;
	for (lint i = L; i <= min(L + 3000, R); i++) {
		for (lint j = L; j <= min(L + 3000, R); j++) {
			if (i < j) {
				ans = min(ans, i * j % 2019);
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
  int w, n, a[30], b[30], c[30];
  cin >> w;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d,%d", &a[i], &b[i]);
    a[i]--;
    b[i]--;  
  }
  for (int i = 0; i < w; i++) {
    c[i] = i;
  }
  for (int i = 0; i < n; i++) {
    int d = a[i];
    int e = b[i];
    swap (c[d], c[e]);
  }
  for (int i = 0; i < w; i++) {
    cout << c[i] + 1 << endl;
  }
}

Measured memory_bytes: 1240