akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
typedef long long int ll;
using namespace std;
int main(){
	int K;
	cin >> K;
	if(K%2==0){
		cout << (K/2)*(K/2) << endl;
	}else{
		cout << (K/2)*(K/2+1) << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int bit = 0;
		for (int i = 0; i < N; i++){
			bit |= sc.nextInt();
		}
		System.out.println(Integer.numberOfTrailingZeros(bit));
	}
}

Measured memory_bytes: 21716
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define MAXN ((ll)2e5+5)
#define MOD ((ll)1e9 + 7) 
#define ll long long
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"

ll n,m,t,k;
ll c[MAXN];
ll dp[105][MAXN];
ll pre[105][MAXN];

void add(ll& a,ll b)
{
	a += b;
	if(a > MOD)
		a -= MOD;
	if(a < 0)
		a += MOD;
}

ll mod(ll& a)
{
	a -= (a/MOD)*MOD;
	return a;
}

ll pref(ll i,ll l,ll r)
{
	ll ans;
	if(l > 0)
		return	mod(ans = pre[i][r] - pre[i][l-1]);
	return	mod(pre[i][r]);
}

void calcpre(ll x)
{
	ll ans;
	pre[x][0] = 1;
	for (ll i = 1; i <= k; ++i)
		pre[x][i] = mod(ans = pre[x][i-1] + dp[x][i]);
}

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

	cin >> n >> k;
	for (ll i = 0; i < n; ++i)
		cin >> c[i];

	for (ll i = 0; i <= c[0]; ++i)
		dp[0][i] = 1;

	calcpre(0);

	for (ll i = 1; i < n; ++i)
	{
		for (ll j = 0; j <= k; ++j)
			add(dp[i][j],pref(i-1,j-c[i],j)); 
		calcpre(i);
	}
	cout << mod(dp[n-1][k]) << endl;	

	// for (ll i = 0; i < n; ++i)
	// {
	// 	for (ll j = 0; j <= k; ++j)
	// 	{
	// 		cout << pre[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }

	return 0;
}


Measured memory_bytes: 312832
#include<bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define CS
long long int ll;
using namespace std;
int main(){
  speed;

  int N;


  vector<float> v;

  cin >> N;

  float vi;

  for(int i=0;i<N;i++){

    cin >> vi;

    v.push_back(vi);

  }

  sort(v.begin(),v.end());



  float ans=v[0];



  for(int i=1;i<N;i++){

    ans=(ans+v[i])/2;
  }

  cout << ans << endl;

}






Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <bitset>

#define REP(i,n) for(Int i=0;i<(n);i++)
#define RREP(i,n) for(Int i=(n)-1;i>=0;i--)
#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 STRS(i,str) for(Int i=0;(str)[i];i++)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX3(a,b,c) ((a)>(b)?(a)>(c)?(a):(c):(b)>(c)?(b):(c))
#define MIN3(a,b,c) ((a)<(b)?(a)<(c)?(a):(c):(b)<(c)?(b):(c))
#define MED(a,b,c) ((a)<(b)?(a)>(c)?(a):(b)<(c)?(b):(c):(a)>(c)?(b)<(c)?(c):(b):(a))
#define RANGE(a,b) ((a)>(b)?(a)-(b):(b)-(a))
#define RANGE3(a,b,c) ((a)>(b)?(b)>(c)?(a)-(c):(c)>(a)?(c)-(b):(a)-(b):(b)>(c)?(c)>(a)?(b)-(a):(b)-(c):(c)-(a))
#define MAXI(a,b) if(a<b)a=b;
#define MINI(a,b) if(a>b)a=b;
#define BEGINFOR(a,b,c,d,e,f,g,h,i) a;goto i##_6;i##_2:c;goto i##_6;i##_3:h;goto i##_7;i##_4:d;goto i##_8;i##_5:f;goto i##_8;i##_6:if(b)goto i##_4;else goto i##_9;i##_7:if(g)goto i##_5;else goto i##_1;i##_8:if(e)goto i##_2;else goto i##_3;i##_9:
#define CONTINUE(i) goto i##_3
#define BREAK(i) goto i##_1
#define ENDFOR(i) goto i##_3;i##_1:

using ull = unsigned long long;
using Int = int;

int main(void) {
	std::bitset<11000> a;
	int n;
	scanf("%d", &n);
	a[0] = true;
	REP(i, n) {
		int s;
		scanf("%d", &s);
		RREP(j, 10000) if(a[j]) a[j + s] = true;
	}
	RREP(i, 10000) if(a[i] && i%10) {
		printf("%d\n", i);
		return 0;
	}
	puts("0");
}

Measured memory_bytes: 128
n=int(input())
s=sorted([sorted(map(str,input())) for _ in [0]*n])+[[]]
c=0
i=0
while i<n:
    j=0
    while s[i+j+1]==s[i]:j+=1
    c+=j*(j+1)//2
    i+=j+1
print(c)

Measured memory_bytes: 23008
#include<stdio.h>
 
int main (void){
     
    int a,b,ans;
    char op;
     
    while(1){
    scanf("%d %c %d",&a,&op,&b);
    if(op == '?')break;
    if(op == '+'){
        ans = a+b;
    }else if(op == '-'){
        ans = a-b;
    }else if(op == '*'){
        ans = a*b;
    }else if(op == '/'){
        ans =a/b;
    }
    printf("%d\n",ans);
    }
return 0;
}

Measured memory_bytes: 600
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int n;
ll a[200005],b[200005];
priority_queue<pair<ll,int>>S;

int main(){
	scanf("%d",&n);
	rep(i,n) scanf("%lld",&a[i]);
	rep(i,n) {
		scanf("%lld",&b[i]);
		S.push(mp(b[i],i));
	}
	ll ans = 0;
	while(S.size()){
		pair<ll,int>p = S.top(); S.pop();
		//rep(i,n) cout << b[i] << " " ; cout << endl;
		if(a[p.sc] > p.fi){
			puts("-1");
			return 0;
		}
		else if(a[p.sc] == p.fi) continue;
		
		int id = p.sc;
		ll pre = b[(id+n-1)%n];
		ll nxt = b[(id+1)%n];
		
		ll zan = p.fi-a[p.sc];
		//cout << zan << " " << (pre+nxt) << endl;
		zan = zan / (pre+nxt) * (pre+nxt);
		if(zan == 0){
		    puts("-1"); return 0;
		}
		b[id] -= zan;
		ans += zan / (pre+nxt);
		S.push(mp(b[id],id));
	}
	
	cout << ans << endl;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int K, ans;
    cin >> K;

    // 処理
    if (K % 2 == 0) {
        ans = (K / 2) * (K / 2);
    } else {
        ans = (K / 2) * (K / 2 + 1);
    }

    // 出力
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
T inf(){
	return numeric_limits<T>::has_infinity?numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

const string YES = "Yes";
const string NO = "No";
Int R;
Int C;
Int N;
vector<Int> r;
vector<Int> c;
vector<Int> a;


//{{{ optional<T>
template<typename T>
class optional {
public:
	optional() : is_engaged_(false), value_() {}

	explicit optional(T const& value) :
		is_engaged_(true), value_(value) {}

	optional& operator=(T const& value) {
		value_ = value;
		is_engaged_ = true;
		return *this;
	}

	operator bool() const { return is_engaged_; }

	T const& operator*() const { return value_; }
	T& operator*() { return value_; }
private:
	bool is_engaged_;
	T value_;
};
//}}}

void solve(){
	vector<optional<Int> > v(R+C);
	unordered_map<int,vector<pair<int,Int> > > mp;
	REP(i,N){
		mp[r[i]].push_back({R + c[i], a[i]});
		mp[R+c[i]].push_back({r[i],a[i]});
	}
	Int row_min, col_min;
	function<bool(int,Int,int) > dfs = [&](int u, Int t, int prev){
		if(v[u]){
			if(*(v[u])==t)return true;
			else return false;
		}
		v[u] = t;
		if(u<R)row_min = min(row_min,t);
		else col_min = min(col_min,t);
		for(auto &&p:mp[u]){
			if(p.first==prev)continue;
			if(!dfs(p.first,p.second - t,u))return false;
		}
		return true;
	};
	REP(u,R+C){
		if(!v[u]){
			row_min = col_min = inf<Int>();
			if(!dfs(u,0,-1) or row_min + col_min < 0){
				cout<<NO<<endl;
				return;
			}
		}
	}
	cout<<YES<<endl;
}

//{{{ main fucnction
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> R;
	cin >> C;
	cin >> N;
	r.assign(N,Int());
	c.assign(N,Int());
	a.assign(N,Int());
	for(int i = 0 ; i < N ; i++){
		cin >> r[i];
		cin >> c[i];
		cin >> a[i];
		r[i]--;c[i]--;
	}
	solve();
	return 0;
}

//}}}



Measured memory_bytes: 34376
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
const ll MAX_N=1e5;
ll N;
typedef pair<ll,ll> P;
vector<P> G[MAX_N];
ll dst[MAX_N];
void caldst(ll v,ll d,ll p){
	dst[v]=d;
	for(auto e:G[v]){
		if(e.first!=p){
			caldst(e.first,d+e.second,v);
		}
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>N;
	REP(i,N-1){
		ll u,v,w;
		cin>>u>>v>>w;
		u--;
		v--;
		G[u].push_back(P(v,w));
		G[v].push_back(P(u,w));
	}
	caldst(0,0,-1);
	REP(v,N){
		cout<<dst[v]%2<<endl;
	}
}

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

const int N = 1005;
const int INF = 1000000000;
typedef long long i64;

int a[N], id1[N], id2[N];
int pos1, pos2;

int main ()
{
    int n;
    i64 sum1 = 0, sum2 = 0;
    int ma = -INF, p;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        if (ma < a[i]) ma = a[i], p = i;
        if (a[i] < 0) continue;
        if (i & 1) id1[++pos1] = i, sum1 += a[i];
        else id2[++pos2] = i, sum2 += a[i];
    }

    if (pos1 == 0 && pos2 == 0) {
        printf("%d\n%d\n", ma, n - 1);
        for (int i = 1; i < p; ++i) puts("1");
        for (int i = p + 1; i <= n; ++i) printf("%d\n", n + 2 - i);
    }
    else if (pos1 && sum1 >= sum2) {
        printf("%lld\n%d\n", sum1, id1[1] - 1 + n - id1[pos1] + (id1[pos1] - id1[1] + 1) / 2);
        for (int i = 1; i < id1[1]; ++i) puts("1");
        for (int i = id1[pos1] + 1; i <= n; ++i) printf("%d\n", n + id1[pos1] - id1[1] + 2 - i);
        for (int i = 1; i < pos1; ++i) {
            for (int j = 1; j <= (id1[i + 1] - id1[i]) / 2; ++j) printf("%d\n", 2 + (id1[i + 1] - id1[i]) / 2 - j);
        }
    }
    else {
        printf("%lld\n%d\n", sum2, id2[1] - 1 + n - id2[pos2] + (id2[pos2] - id2[1] + 1) / 2);
        for (int i = 1; i < id2[1]; ++i) puts("1");
        for (int i = id2[pos2] + 1; i <= n; ++i) printf("%d\n", n + id2[pos2] - id2[1] + 2 - i);
        for (int i = 1; i < pos2; ++i) {
            for (int j = 1; j <= (id2[i + 1] - id2[i]) / 2; ++j) printf("%d\n", 2 + (id2[i + 1] - id2[i]) / 2 - j);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	long long int N, A[55], B[55], C[55], ans = 0;
	cin>>N;
	for (int i = 1; i <= N; ++i)
		{
			cin>>A[i];
			/* code */
		}
	for (int i = 1; i <= N; ++i)
		{
			cin>>B[i];
			/* code */
		}	
	for (int i = 1; i < N; ++i)
		{
			cin>>C[i];
			/* code */
		}
	for (int i = 1; i <= N; ++i)
		{
			ans += B[A[i]];
			if(A[i + 1] == A[i] + 1 )
				ans += C[A[i]];
			/* code */
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}

int main(){
  int n; cin >>n;
  vector<int> a(n); rep(i,n) cin >>a[i];
  vector<int> lds;
  reverse(a.begin(),a.end());
  rep(i,n){
    auto itr=upper_bound(lds.begin(),lds.end(),a[i]);
    if(itr==lds.end()) lds.push_back(a[i]);
    else *itr=a[i];
    if(df)print(lds);
  }
  print(lds.size());
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  explicit FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
  int64 N;
  cin >> N;
  auto D = divisor(N);
  int64 ret = infll;
  for(auto &p : D) {
    ret = min(ret, p + N / p - 2);
  }
  cout << ret << endl;
}




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

int main(void){
  	int ans = 0;
	rep(i,3){
    	int a;
      	cin >> a;
      	ans += a;
    }
  	if(ans<=21) puts("win");
  	if(ans>=22) puts("bust");
  	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/

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

	int n;
	cin >> n;
	vector<int> w(n);
	rep(i, n) cin >> w[i];

	int ans = inf;
	// 全探索
	rep(t, 101) {
		int s1 = 0;
		int s2 = 0;
		rep(j, n) {
			if (j <= t) s1 += w[j];
			else s2 += w[j];
		}
		//cout << s1 << " " << s2 << endl;
		ans = min(ans, abs(s1 - s2));
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
//#include<string>
#include <iostream>

#define T int 

T gcd(T m,T n){
	if(n==0){
		return m;
	}
	return gcd(n,m%n);
}

int main(void){
	T result=0;
	T k;
	
	std::cin >> k;
	for(int i=1;i<=k;i++){
		for(int j=1;j<=k;j++){
			for(int l=1;l<=k;l++){
				result+=gcd(i,gcd(j,l));
			}
		}
	}
	std::cout << result <<std::endl;
}


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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    vector<int> x(N), y(M);
    REP(i, N) cin >> x[i];
    REP(i, M) cin >> y[i];

    int z = X + 1;
    bool ans = false;
    while (z <= Y) {
        bool ok = true;
        REP(i, N) {
            if (x[i] < z) {
                continue;
            } else {
                ok = false;
            }
        }

        REP(i, M) {
            if (y[i] >= z) {
                continue;
            } else {
                ok = false;
            }
        }
        if (ok) {
            ans = true;
            break;
        }
        z++;
    }

    if (ans) {
        print("No War");
    } else {
        print("War");
    }
}

signed main() {
    solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll MOD=1e9+7;
const long long INF = 1LL<<60;

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

    cout << n*(n-1)/2 + m*(m-1)/2 << endl;
}

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

water = A*100
salt = 0
conc = 0

# water 1..29 * 100 all
for i in range(1,30):
  Amax = i // A
  notMakeFlag = True
  for k in range(Amax + 1):
    if (i - A * k) % B == 0:
      notMakeFlag = False
      break
  if notMakeFlag:
    continue
  
  #print(i)
  # maximize salt within F and E
  
  Cmax = min(E*i, (F-i*100))//C
  saltmax = 0
  for k in range(Cmax + 1):
    Dcount = (min(E*i, (F-i*100)) - k * C) // D
    saltmax = max(saltmax, k*C + Dcount * D)
  
    if conc < saltmax / (saltmax + i * 100):
      water = i * 100
      salt = saltmax
      conc = saltmax / (saltmax + i * 100)

print(water+salt, salt)
  

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    int ans=0;
    rep(i,3) if (s[i]=='1') ans++;
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
int main()
{

    int n,p;
    cin >> n;
    int cnt=n;
    int arr [n];
    for(int i=0; i<n; i++)
    {
        cin >> arr[i];
    }
    for(int i=0; i < n; i++)
    {
        p = arr[i];
        for(int j = 0; j <= i; j++)
        {
            if( p < arr[j])
            {
                cnt--;
                break ;
            }

        }
    }
    cout << cnt << endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define tag "spoj"
#define maxn 10007
#define oo 2000000007
#define meset(a,x) memset(a,x,sizeof(a))
#define loop(x) for(int LoOpEr=x;LoOpEr-->0;)
///>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int main()
{
    #ifdef dmdd
    freopen(tag".inp","r",stdin); freopen(tag".out","w",stdout);
    #endif // dmdd
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(n*a,b);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<time.h>
#include<sstream>
#define MINN -1e8 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll INF=0x3f3f3f3f3f3f;
const int P=1e9+7;
const int MAXN=32000;
const double pi=3.1415926;
//const int MINN=-1e8;
const ll mod=1000000007;

//map<string,ll> m;
//map<ll,ll> m;

//set<ll> s;

//vector<ll> v;

//scanf("%lld",&t);
//scanf("%lld%lld",&,&);
int n;
ll ans=1;
char c[200005];
ll f(ll len)
{
	ll cur=1;
	for(ll i=1;i<=len;i++)
	{
		cur=cur*i%mod;
	}
	return cur; 
}
int main()
{
	cin>>n;getchar();
	ll tmp=1,len=1;
	for(int i=0;i<2*n;i++)c[i]=getchar();
	if(c[0]!='B'||c[n*2-1]!='B')
	{
		cout<<0;return 0;
	}
	for(int i=1;i<2*n-1;i++)
	{
		//printf("i:%d   tmp:%lld\n",i,tmp);
		if(c[i]=='B')  //奇数 
		{
			if(tmp%2==1)  //满足 
			{
				ans=ans*tmp%mod;
				//cout<<ans<<endl;
				tmp--;len++;
			}
			else
			{
				tmp++;
			}
		}
		else           //'W' 偶数 
		{
			if(tmp%2==1)  //不满足 
			{
				tmp++;
			}
			else
			{
				ans=ans*tmp%mod;
				//cout<<ans<<endl;
				tmp--;len++;
			}
		}
	}
	if(tmp!=1)
	{
		cout<<0;return 0;
	}
	else
	{
		ans=ans*f(len)%mod;
		cout<<ans;
	}
	return 0;
}
//ll n,m,t,a,x,ans,res;
//ll powmod(ll a,ll b)     //快速幂 
//{
//	ll tmp=a%mod;
//	ll ans=1;
//	while(b)
//	{
//		if(b&1)ans=ans*tmp%mod;
//		tmp=tmp*tmp%mod;
//		b>>=1;
//	}
//	return ans%mod;
//}


//bool is_prime(ll a)     //判断素数 
//{
//	if(a==2)return 1;
//	else if(a==1||a%2==0)return 0;
//	else
//	{
//		for(ll i=3;i*i<=a;++i)
//		{
//			if(a%i==0)return 0;
//		}
//	}
//	return 1;
//}



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

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<char>> grid(h,vector<char>(w));
    vector<int> hok(h,0),wok(w,0);
    rp(i,h){
        rp(j,w){
            cin >> grid.at(i).at(j);
            if(grid[i][j]=='#') {hok.at(i)=1; wok.at(j)=1;}
        }
    }
    rp(i,h){
        bool line=false;
        rp(j,w){
            if(hok.at(i)*wok.at(j)==1){
                cout << grid[i][j];
                line=true;
            }
        }
        if(line)
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {
    let n = read::<usize>();

    let mut d = vec![0; n];

    for i in 0..n {
        d[i] = read::<usize>();
    }

    let mut ans = 0;
    for i in 0..n {
        for j in i..n {
            if i == j {
                continue
            }
            ans += d[i] * d[j];
        }
    }
    println!("{}", ans)
}


Measured memory_bytes: 4352
//????????¨?????????????????¢??°????????????

#include <iostream>
#include <string>
using namespace std;
//---------------------------------------
int compare(string t, string h);
void tokuten(int &num_t, int &num_h, int compare);
//---------------------------------------

int main(void)
{
	int n;  //??????????????°
	int tokuten_taro = 0;
	int tokuten_hanako = 0;
	
	//???????????°?????\???
	cin >> n;
	
	//??????????????±
	for(int i = 0; i < n; i++){
		string card_taro, card_hanako;
		cin >> card_taro;  //1????????§????????????
		cin >> card_hanako; //1????????§????????????
		
		//???????????????
		tokuten(tokuten_taro, tokuten_hanako, compare(card_taro, card_hanako));
	}
	
	//??¨???
	cout << tokuten_taro << ' ' << tokuten_hanako << endl;
	
	return 0;

}

//------------------------------------------------------------
int compare(string t, string h){

	for(int i = 0; 
	    i < t.size() &&
	        h.size(); i++){
	
		if(t[i] > h[i]){
			return -1;  //?????????????????§-1
		}
		else if(h[i] > t[i]){
			return 1;  //??±??????????????§1
		}
	}
	//????????????????????§???????????£?????´???
	if(t.size() > h.size()){
		return -1;   //?????????????????§-1
	}
	else if(h.size() > t.size()){
		return 1;   //??±??????????????§1
	}
	else{
		return 0;  //?????????0?????????
	}
	
}
//------------------------------------------------------------
void tokuten(int &num_t, int &num_h, int compare){
	
	if(compare == -1){
		num_t += 3;
	}
	else if(compare == 1){
		num_h += 3;
	}
	else if(compare == 0){
		num_t += 1;
		num_h += 1;
	}
}
	

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

int main() {
  int n,k,q,tmp;
  cin >> n>> k >> q;
  
  map<int,int> score;
  
  for(int i=1;i<=n;i++){
    score[i] = k-q;
  }
  
  for(int i=0;i < q; i++){
    cin >> tmp;
    score[tmp]++;
  }
  
  for(int i=1;i<=n;i++){
    if(score[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int Mod = 1e9 + 7;
string s;
int d;

int dp[10005][105][2];

int solve(int idx, int mod, bool smaller)
{
	if(idx == s.size())
		return mod == 0;
	int &ans = dp[idx][mod][smaller];
	if(~ans)
		return ans;
	ans = 0;
	for(int v = 0; v <= 9; v++)
	{
		if(!smaller && v > s[idx] - '0')
			continue;
		ans = (ans + solve(idx + 1, (mod + v) % d, smaller | v < s[idx] - '0')) % Mod;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> s >> d;
	memset(dp, -1, sizeof dp);
	cout << (solve(0, 0, 0) - 1 + Mod) % Mod;
	return 0;
}


Measured memory_bytes: 9472
#include<stdio.h>
#define NIL -1

typedef struct node{
  int p;
  int r;
  int l;
}Node;

Node T[25];

void Preorder(int u){
  if(u == NIL)return;
  printf(" %d",u);
  Preorder(T[u].l);
  Preorder(T[u].r);
}

void Inorder(int u){
  if(u == NIL)return;
  Inorder(T[u].l);
  printf(" %d",u);
  Inorder(T[u].r);
}

void Postorder(int u){
  if(u == NIL)return;
  Postorder(T[u].l);
  Postorder(T[u].r);
  printf(" %d",u);
}



int main(){
  int n,i,j;
  int v,l,r;
  int root;

  scanf("%d",&n);


  for(i=0;i<n;i++){
    T[i].p = NIL;
    T[i].l = NIL;
    T[i].r = NIL;
  }

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

  for (i=0;i<n;i++) {
    if (T[i].p == NIL) root = i;
  }

  printf("Preorder\n");
  Preorder(root);
  printf("\nInorder\n");
  Inorder(root);
  printf("\nPostorder\n");
  Postorder(root);
  puts("");
  return 0;
}

Measured memory_bytes: 612
fun main(args: Array<String>){
    val n = readLine()!!.toInt()
    var s = readLine()!! 
    val k = readLine()!!.toInt()

    var point = s[k-1]

    var list = mutableListOf<Char>()


    for(i in 0..n-1){
        if(s[i] != point){
            list.add('*')
        }
        else{
            list.add(s[i])

        }

    }

for(i in 0..n-1){
    print(list[i])
}
println()
}

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

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;

int N; 
int memo[110][5][5][5];
char s[] = {'A', 'C', 'G', 'T'};

int to_num(char s){
  if(s == 'A') return 0;
  if(s == 'C') return 1;
  if(s == 'G') return 2;
  return 3;
}
bool ok(string ss){
  if(                ss[1] == 'A' && ss[2] == 'G' && ss[3] == 'C') return false;
  if(ss[0] == 'A' &&                 ss[2] == 'G' && ss[3] == 'C') return false;
  if(                ss[1] == 'G' && ss[2] == 'A' && ss[3] == 'C') return false;
  if(                ss[1] == 'A' && ss[2] == 'C' && ss[3] == 'G') return false;

  if(ss[0] == 'A' && ss[1] == 'G' && ss[2] == 'C'                ) return false;
  if(ss[0] == 'G' && ss[1] == 'A' && ss[2] == 'C'                ) return false;
  if(ss[0] == 'A' && ss[1] == 'C' && ss[2] == 'G'                ) return false;
  if(ss[0] == 'A' && ss[1] == 'G' &&                 ss[3] == 'C') return false;
  return true;
}
int dfs(int n, string last3){
  if(memo[n][to_num(last3[0])][to_num(last3[1])][to_num(last3[2])] != -1)
    return memo[n][to_num(last3[0])][to_num(last3[1])][to_num(last3[2])];
  if(n == N) return 1;

  int ret = 0;
  REP(i, 4){
    if(ok(last3+s[i])) (ret += dfs(n+1, (last3+s[i]).substr(1, 3))) %= MOD;
    memo[n][to_num(last3[0])][to_num(last3[1])][to_num(last3[2])] = ret;
  }
  return ret;
}

signed main() {
  cin >> N;

  memset(memo, -1, sizeof(memo));

  cout << dfs(0, "TTT") << endl;

  return 0;
}

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

int main()
{
    int n;
    double x,sum=0;
    string u;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>x>>u;
        if(u=="JPY"){
            sum+=x;
        }
        else if(u=="BTC"){
            sum+=(x*380000.0);
        }
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define INF 1e9
#define eps 1e-6
typedef long long ll;
using namespace std;

int k, mod, ans;

int main(){

	cin >> k;
	mod = 7 % k;
	if(mod == 0){ 
		puts("1");
		return 0;
	}
	for(int i = 2; i <= k + 1; i++){
		mod = (mod * 10 + 7) % k;
		if(mod == 0){
			printf("%d\n", i);
			return 0;
		}
	}
	puts("-1");

	return 0;
}


Measured memory_bytes: 3756
from collections import defaultdict
n,k=map(int,input().split())
d=defaultdict(int)
for i in range(n):
  a,b=map(int,input().split())
  d[a]+=b
l=[]
for u,v in d.items():
  l.append((u,v))
l.sort(key=lambda x:x[0])
i=0
while k-l[i][1]>0:
  k-=l[i][1]
  i+=1
print(l[i][0])

Measured memory_bytes: 15324
#include<iostream>
#include<vector>
using namespace std;
vector<pair<long long,long long>>pre(long long n){
vector<pair<long long,long long>>res;
  for(long long i=2;i*i<=n;i++){
    if(n%i!=0) continue;
    int num=0;
    while(n%i==0){
      num++;
      n/=i;
    }
    res.push_back(make_pair(i,num));
  }
  if(n!=1) res.push_back(make_pair(n,1));
  return res;
}

int main(){
  long long n;
  cin>>n;
  const auto pf=pre(n);
  long long ans=0;
  for(auto p:pf){
    long long e=p.second;
    long long tmp=0,cur=1;
    while(e>=cur) e-=cur++,++tmp;
    ans+=tmp;
  }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
	// your code goes here
	int x;
	int y;
	int z;
	
	cin >> x;
	cin >> y;
	cin >> z;
	
	if(x>y) {
		int a;
		a = x;
		x = y;
		y = a;
	}
	if(y>z) {
		int a;
		a = y;
		y = z;
		z = a;
	}
	if(x>y){
		int a;
		a = x;
		x = y;
		y = a;
	}
	
	cout <<x<<" "<<y<<" "<<z<< endl;
	
	return 0;
}

Measured memory_bytes: 3096
//omajinai c++
#include <iostream>
#include<cmath>
#include<vector>
#include <algorithm>
#include <limits>
#include <numeric>
#include <type_traits>
#include <map>
#include <string>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define itn int

using namespace std;
int main() {

 long int a,b,c;
  cin>>a>>b>>c;
  if(4*a*b<(c-a-b)*(c-a-b)&&c>a+b){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
 
int main(){
	ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        ll a;
        cin>>a;
        vi v;
        int k;
        rep(i,0,a)
        {
        	cin>>k;
        	v.pb(k);
		}
		ll dp[a]={0};
dp[1]=abs(v[0]-v[1]);
		rep(i,2,a){
			dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
	}
		cout<<dp[a-1]<<endl;
return 0;}


Measured memory_bytes: 1908
// C - Cat Snuke and a Voyage
#include <bits/stdc++.h>
using namespace std;
using vc = vector<char>;

int main(){
	int N,M; cin>>N>>M;
	vc P(N);
	while(M--){
		int a,b; cin>>a>>b;
		if(a==1) P[b-1] = P[b-1] & 0b10 | 0b01;
		if(b==N) P[a-1] = P[a-1] & 0b01 | 0b10;
	}
	string ans = "IMPOSSIBLE";
	while(N--)
		if(P[N] == 0b11){
			ans = "POSSIBLE";
			break;
		}
	cout<< ans <<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
typedef long long LL;

int main() {
	std::string str;
	std::cin >> str;
	int temp = 0;
	int hoge = 0;

	for (int i = 2; i < str.size() - 1; ++i) {
		if (str[i] == 'C') {
			temp++;
		}
	}

	for (int i = 0; i < str.size(); ++i) {
		if (str[i] < 96) {
			hoge++;
		}
	}


	if (str[0] != 'A') {
		std::cout << "WA" << std::endl;
	}
	else if (temp!=1) {
		std::cout << "WA" << std::endl;
	}
	else if (hoge!=2) {
		std::cout << "WA" << std::endl;
	}
	else {
		std::cout << "AC" << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;
int main(){
 	long long n;
  cin>>n;
  string ans ;
  while(n){
    n--;
    ans += 'a'+n%26;
    n/= 26;
  }
  reverse(ans.begin(),ans.end());
  cout<<ans;

}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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 lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

int n,k;
cin >> n >> k;
vi a(n);
rep(i,n) cin >> a[i];

for(int i = k; i < n; i++) {
    if(a[i] > a[i-k]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

return 0;
}

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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

class Solution {
public:
	void solve() {
		int h, w, n;
		cin >> h >> w >> n;
		cout << min((n+h-1)/h, (n+w-1)/w) << endl;
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 256
program main
  implicit none
  integer(8) :: x
  integer(8) :: a, b

  read *, x

  do a = -118, 119
    do b = -119, 118
      if ( a**5-b**5 == x ) then
        print *, a, b
        stop
      end if
    end do
  end do

end program main


Measured memory_bytes: 2860
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}

bool cmp(pii& a, pii& b) {
  return a.second < b.second;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, m;
  cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  pii arr[m];
  fi(0, m) {
    cin >> arr[i].first >> arr[i].second;
  }
  sort(arr, arr + m, cmp);
  ans = 1;
  int now = arr[0].second;
  fi(1, m) {
    if(arr[i].first >= now) {
      ++ans;
      now = arr[i].second;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1024
from array import array

h, w = map(int, input().split())
maze = []
for i in range(h):
    maze.append(input())

cnt = 0
for i in range(h):
    for j in range(w):
        if maze[i][j] == '.':
            cnt += 1

if cnt == w*h:
    print(w+h-2)
else:
    nodes = h*w

    g = []

    for i in range(nodes):
        g.append(array('l', [10000000] * (w * h)))

    for i in range(nodes):
        g[i][i] = 0

    for i in range(h):
        for j in range(w):
            if maze[i][j] == '#':
                continue
            if maze[i][j] == '.':
                if i > 0 and maze[i-1][j] != '#':
                    g[i * w + j][(i-1) * w + j] = 1
                    g[(i-1) * w + j][i * w + j] = 1
                if i < h-1 and maze[i+1][j] != '#':
                    g[i * w + j][(i+1) * w + j] = 1
                    g[(i+1) * w + j][i * w + j] = 1
                if j > 0 and maze[i][j-1] != '#':
                    g[i * w + j][i * w + j-1] = 1
                    g[i * w + j-1][i * w + j] = 1
                if j < w-1 and maze[i][j+1] != '#':
                    g[i * w + j][i * w + j+1] = 1
                    g[i * w + j+1][i * w + j] = 1

    def floyed(g, nodes):
        result = 0
        for k in range(nodes):
            for i in range(nodes):
                if i == k:
                    continue
                if g[i][k] == 10000000:
                    continue
                for j in range(nodes):
                    if g[k][j] == 10000000:
                        continue
                    if i == j or i == k or k == j:
                        continue
                    if g[i][j] > g[i][k] + g[k][j]:
                        g[i][j] = g[i][k] + g[k][j]

    floyed(g,nodes)

    result = 0
    for i in range(nodes):
        for j in range(nodes):
            if g[i][j] < 10000000 and g[i][j] > result:
                result = g[i][j]
    print(result)


Measured memory_bytes: 4468
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

A,B,C,D,E,F = II()

val = 0
ans1 = 100*A
ans2 = 0

for a in range(math.ceil(F/(100*A))+1):
    for b in range(math.ceil(F/(100*B))+1):
        for c in range(math.ceil((A*a+B*b)*E/C)+1):
            for d in range(math.ceil((A*a+B*b)*E/D)+1):
                if 100*(A*a+B*b)+C*c+D*d > F:
                    break
                if C*c+D*d > (A*a+B*b)*E:
                    break
                if A*a+B*b==0:
                    break
                if (C*c+D*d)/(A*a+B*b) > val:
                    val = (C*c+D*d)/(A*a+B*b)
                    ans1 = 100*(A*a+B*b)+C*c+D*d
                    ans2 = C*c+D*d

print(ans1, ans2)

Measured memory_bytes: 43752
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<string>
#include<limits.h>
#define ll long long
#define vl vector<ll> 
#define vb vector<bool> 
#define vvl vector<vector<ll> > 
#define vvb vector<vector<ll> > 
#define rep(i,n) for(int i=0;i<n;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i++)
#define mmrep(i,a) for(int i=a;i>0;i++)
#define INF 1123456789012345
using namespace std;

int main() {
	ll a, b, w; cin >> w >> a >> b;
	if (w + b < a) cout << a-(w + b) << endl;
	else if (w + a < b) cout << b-(w + a) << endl;
	else cout << 0 << endl;
	return 0;
}

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


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

    vector<ll> A(N);

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

    ll res = 0;
    ll temp = 0;
    ll now = 0;
    for (int i = 0; i < N - 1; ++i) {
        if (temp != 0) {
            now = A.at(i) + temp;
        } else {
            now = A.at(i);
        }

        if (now > A.at(i + 1)) {
            res += now - A.at(i + 1);
            temp = now - A.at(i + 1);
        } else {
            temp = 0;
        }
    }

    cout << res << endl;
}


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

int main() 
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int y = y2 - y1;
    int x = x2 - x1;
    cout << x2-y << " " << y2+x << " " << x1-y << " " << y1+x;
    return 0;
}

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

void MergeSort(int x[ ], int left, int right)
{
    int mid, i, j, k;
    int temp[right+1];

    if (left >= right)              /* 配列の要素がひとつなら */
        return;                     /* 何もしないで戻る */

                                    /* ここでは分割しているだけ */
    mid = (left + right) / 2;       /* 中央の値より */
    MergeSort(x, left, mid);        /* 左を再帰呼び出し */
    MergeSort(x, mid + 1, right);   /* 右を再帰呼び出し */

      /* x[left] から x[mid] を作業領域にコピー */
    for (i = left; i <= mid; i++)
        temp[i] = x[i];

      /* x[mid + 1] から x[right] は逆順にコピー */
    for (i = mid + 1, j = right; i <= right; i++, j--)
        temp[i] = x[j];

    i = left;         /* i とj は作業領域のデーターを */
    j = right;        /* k は配列の要素を指している */

    for (k = left; k <= right; k++)    /* 小さい方から配列に戻す */
        if (temp[i] <= temp[j])        /* ここでソートされる */
            x[k] = temp[i++];
        else
            x[k] = temp[j--];
}

int main(){
    int N;
    scanf("%d",&N);
    int d[N];
    for(int i=0;i<N;i++){
        scanf("%d",&d[i]);
    }
    MergeSort(d,0,N-1);
    printf("%d\n",d[N/2]-d[N/2-1]);

}

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

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

    if(x == 1) {
        cout << 1 << endl;
        return 0;
    }

    int ans = 0;
    for (int i = 2; i * i <= x; i++) {
        int n = i;
        while(true) {
            n *= i;
            if(n > x) break;
            ans = max(ans, n);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repr(i, n) for(int i = n; i>=0; i--)
#define all(x) (x).begin(), (x).end()
#define INF 1145141919
typedef long long ll;

int main(void)
{
	int n, a, b, c, cost = 0, energy =  0;
	vector<int> d;
	scanf("%d%d%d%d", &n, &a, &b, &c);
	d.resize(n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &d[i]);
	}

	cost += a;
	energy += c;
	sort(d.begin(), d.end(), greater<int>());
	
	for (int i = 0; i < n; i++)
	{
		if ((energy + d[i]) / (cost + b) < (energy / cost)) break;
		else
		{
			energy += d[i];
			cost += b;
		}
	}

	printf("%d\n", energy / cost);

	return 0;
}

Measured memory_bytes: 3236
#include<iostream>

using namespace std;


int main(){
  int N;
  cin >>N;
  int k=-1;
  for(int i=1;i<N+100;i++){
    if(i*(i-1)==2*N){
      k=i;
      }
    }
  if(k<0){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<'\n'<<k<<endl;
    
    int A[k+1][k];
    int memorize=0;
    for(int i=1;i<=k-1;i++){
      for(int j=i;j<=k-1;j++){
        A[i][j]=memorize+j-i+1;
      }
      for(int j=i+1;j<=k;j++){
        A[j][i]=memorize+j-i;
      }
    memorize+=k-i;
    
    }
  
    for(int i=1;i<=k;i++){
      cout<<k-1<<' ';
      for(int j=1;j<=k-1;j++){
        cout<<A[i][j]<<' ';
      }
      cout<<'\n';
    }
    
  }
return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    while(b<=a && k>0)
    {
        b*=2;k--;
    }
    while(c<=b && k>0)
    {
        c*=2;k--;
    }
    if(b>a && c>b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;



    return 0;
}







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


int main() {
    int A, B;
    string S, T;
    cin >> S >> T;
    cin >> A >> B;

    string U;
    cin >> U;

    if(U == S){
        A --;
    }
    else{
        B --;
    }

    cout << A << " " << B << endl;

    return 0;
}

Measured memory_bytes: 256