akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#if DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

void solve();
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}
/*================================*/
#if DEBUG
#define SIZE 1000
#else
#define SIZE 423450
#endif

int N,Q,K;

set<int> um[2][SIZE],dm[2][SIZE];
int BASE = SIZE/2;

struct Item2 {
    int x,y;
    char u;
};
vector<Item2> V;

set<int> ds[SIZE],ls[SIZE];

void solve() {
    cin>>N;
    int x,y;
    char u;
    REP(i,N) {
        cin>>x>>y>>u;
        if (u=='D') {
            dm[0][y-x+BASE].insert(x);
            dm[1][y+x].insert(x);
        }
        if (u=='U') {
            um[0][y-x+BASE].insert(x);
            um[1][y+x].insert(x);
        }
        V.push_back({x,y,u});
        if (u=='D') ds[x].insert(y);
        if (u=='L') ls[y].insert(x);
    }
    int ans = INT_MAX;
    REP(i,N) {
        auto p = V[i];
        if (p.u=='R') {
            {
                auto s = &dm[0][p.y-p.x+BASE];
                auto it = s->upper_bound(p.x);
                if (it != s->end()) chmin(ans, (*it - p.x) * 10);
            }
            {
                auto s = &um[1][p.y+p.x];
                auto it = s->upper_bound(p.x);
                if (it != s->end()) chmin(ans, (*it - p.x) * 10);
            }
            {
                auto s = &ls[p.y];
                auto it = s->upper_bound(p.x);
                if (it != s->end()) {
                    chmin(ans, (*it - p.x) * 5);
                }
            }
        }
        if (p.u=='L') {
            {
                auto s = &um[0][p.y-p.x+BASE];
                auto it = s->lower_bound(p.x);
                if (it != s->begin()) chmin(ans, (p.x - *(--it))*10);
            }
            {
                auto s = &dm[1][p.y+p.x];
                auto it = s->lower_bound(p.x);
                if (it != s->begin()) chmin(ans, (p.x - *(--it))*10);
            }
        }
        if (p.u=='U') {
            auto s = &ds[p.x];
            auto it = s->upper_bound(p.y);
            if (it != s->end()) {
                chmin(ans, (*it - p.y)*5);
            }
        }
    }
    
    if (ans==INT_MAX) {
        cout << "SAFE" << endl;
    } else {
        cout << ans << endl;
    }
}



Measured memory_bytes: 154648
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

using namespace std;

long long cnt;

void print(vector<int> &data){
	for (int i = 0; i < data.size(); ++i){
		cout << data[i] << endl;
	}
}

void insertSort(vector<int> &data, int d){
	int n = data.size();
	for (int i = d; i < n; ++i) {
		int v = data[i];
		int j = i - d;
		while (j >= 0 && data[j] > v) {
			data[j + d] = data[j];
			j -= d;
			cnt++;
		}
		data[j + d] = v;
	}
}

void insertSort2(vector<int> &data, int d){
	int n = data.size();
	for (int i = d; i < 2 * d; ++i) {
		int v = data[i];
		int j = i - d;
		while (data[j] > v) {
			data[j + d] = data[j];
			j -= d;
			cnt++;
		}
		data[j + d] = v;
	}
}

void shellSort(vector<int> &data){
	vector<int> dist;
	for (int i = 1; i <= data.size(); i = 3 * i + 1)
		dist.push_back(i);

	int n = dist.size();
	cout << n << endl;

	for (int i = n - 1; i >= 0; --i)
	{
		insertSort(data, dist[i]);
		cout << dist[i];
		if (i != 0) cout << " ";
		else cout << endl;
	}
	cout << cnt << endl;
	print(data);
}


int main(){
	int n; cin >> n;
	vector<int> data(n);
	for (int i = 0; i < n; ++i) cin >> data[i];

	shellSort(data);

	return 0;
}

Measured memory_bytes: 6740
I = input().split()
H = int(I[0])
W = int(I[1])
h = H
w = W
while H != 0 or W != 0:
    while h > 0:
        w = W
        while w > 0:
            print('#', end = '')
            w -= 1
        print()
        h -= 1
    I = input().split()
    H = int(I[0])
    W = int(I[1])
    h = H
    w = W
    print()

Measured memory_bytes: 9004
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#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;

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();}

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

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

#define MP make_pair
#define MT make_tuple
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

int f(string S, char c, int depth)
{
	bool ok = true;
	EACH(s, S) if(s != c){
		ok = false;
		break;
	}
	if(ok || S.size() == 0) return depth;
	string T;
	REP(i, S.size() - 1){
		if(S[i] == c || S[i + 1] == c) T.push_back(c);
		else T.push_back(S[i]);
	}
	return f(T, c, depth + 1);
}

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

	string S;
	cin >> S;

	int ret = 1e9;
	for(char c = 'a'; c <= 'z'; c++)
	{
		ret = min(ret, f(S, c, 0));
	}

	cout << ret << endl;


	return 0;
}


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

//Euclid????????????
int Euclid(int x,int y){
  int i,ret;
  switch(x%y){
  case 0 :ret=y;             break;
  default:ret=Euclid(y,x%y); break;
  }
  return(ret);
}

int main(void){
  int x,y;
  scanf("%d %d",&x,&y);
  printf("%d\n",Euclid(x,y));
  return(0);
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

template<typename T> struct BIT {
  int n;
  vector<int> d;
  BIT(int n=0): n(n), d(n+1) {}

  void add(int i, T x=1) {
    for(i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }

  T sum(int i) {
    T x = 0;
    for(i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }

  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};

const int MAX = 200005;
vector<int> to[MAX];
int in[MAX], out[MAX], k;
vector<int> vs[MAX];

void dfs(int v, int p=-1) {
  in[v] = k++;
  for(int u : to[v]) {
    if (u == p) continue;
    dfs(u, v);
  }
  out[v] = k;
}

ll chose2(ll n) {
  return n*(n+1)/2;
}

int main() {
  int n; 
  cin >> n;
  vector<int> c(n);
  for(int i = 0; i < n; ++i) cin >> c[i];
  for(int i = 0; i < n-1; ++i) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  dfs(0);
  
  for(int i = 0; i < n; ++i) vs[c[i]-1].push_back(i);
  BIT<int> d(n);
  for(int i = 0; i < n; ++i) d.add(i, 1);
  ll all = chose2(n);
  for(int i = 0; i < n; ++i) {
    ll ans = all;
    vector<int>& nvs = vs[i];
    sort(nvs.begin(), nvs.end(), [&](int a, int b) {
      return in[a] > in[b];
    });
    
    vector<pair<int, int>> history;
    for(int v : nvs) {
      int cnt = 1;
      for(int u : to[v]) {
        if (in[u] < in[v]) continue;
        int num = d.sum(in[u], out[u]);
        ans -= chose2(num);
        cnt += num;
      }
      d.add(in[v],  -cnt);
      history.emplace_back(in[v], cnt);
    }
    ans -= chose2(d.sum(0,n));
    for(auto p : history) {
      d.add(p.first, p.second);
    }
    cout << ans << endl;
  }
  
  return 0;
}

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

int Input() {
	char c = getchar(); int x = 0, z = 1;
	for(; c < '0' || c > '9'; c = getchar()) z = c == '-' ? -1 : 1;
	for(; c >= '0' && c <= '9'; c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	return x * z;
}

int n, k;

int main() {
	n = Input(), k = Input();
	ll ans = 0, cur = n / k;
	if ((~k & 1) && (n >= (k >> 1))) {
		cur = (n - (k >> 1)) / k + 1;
		ans = cur * cur * cur;
	}
	cur = n / k;
	ans += cur * cur * cur;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
num = int(input())
n_now = 0
x_now = 0
y_now = 0
Flag = True

for i in range(num):
    n_next, x_next, y_next = [int(i) for i in input().split()]
    time = n_next - n_now
    move = abs(x_next - x_now) + abs(y_next - y_now)
    if time < move:
        Flag = False
        break
    elif (time - move) % 2 != 0:
        Flag = False
        break
    else:
        x_now = x_next
        y_now = y_next
        n_now = n_next

if Flag == True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        _n: u32,
        m: u32,
        mut mat: [(usize, usize); m],
    }

    //bでsort
    mat.sort_by_key(|m| m.1);

    let mut mark = 0;
    let mut count = 0;

    for m in &mat {
        if mark < m.0 {
            mark = m.1 - 1;
            count = count + 1;
        }
    }

    println!("{}", count);

}



Measured memory_bytes: 6524
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
template<typename T>using pqueue =__gnu_pbds::priority_queue<T, greater<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
#define endl '\n'
#define MOD 1000000007LL
//#define MOD 998244353LL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[](auto f,auto... args){return f(f,args...);};


int main(){
	string s;
	cin>>s;
	lint t=count(all(s),'A');
	if(t==0||t==3)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
    #include <cstdio>
    #include <iostream>
    #include <cfloat>
    #include <climits>
    #include <cstdlib>
    #include <cstring>
    #include <cmath>
    #include <queue>
    #include <sstream>
    #include <stack>
    #include <time.h>
    #include <vector>
    #include <complex>
    #include <map>
    #include <set>
    #include <iomanip>
    #include <math.h>
    #include <stdlib.h>
    #include <list>
    #include <utility>
    #include <memory>
    #include <cstring>
    #include <fstream>
    #include <numeric>
    #include <assert.h>
    #include <bits/stdc++.h>
    using namespace std;
    int n,a[13],ans=0;
    int main(){
    	cin>>n;
    	for (int i=0;i<n;i++){
    		cin>>a[i];
    	}
    	sort (a,a+n);
    	for (int i=0;i<n-1;i++) ans+=a[i];
    	ans+=a[n-1]/2;
    	cout<<ans;
    	return 0;
    }

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

int main (int, char**) {
    int K, N;
    std::cin >> K >> N;
    int point[N];
    
    for (int i=0; i<N; i++) {
        std::cin >> point[i];
    }
    int max_d = 0;
    for (int i=0; i<N-1; i++) {
        int dist = point[i+1] - point[i];
        max_d = std::max(max_d, dist);
    }
    int dist = point[0] - point[N-1] + K;
    max_d = std::max(max_d, dist);
    std::cout << (K - max_d) << std::endl;
    return 0;
}

Measured memory_bytes: 1024
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_orde(ind)
using namespace std;
int main()
{
	sync;
	ll n,pos=0;
	cin>>n;
	vector<ll>ans;
	if(n==0)
	{
		cout<<0;
		return 0;
	}
	while(n)
	{
		if(n%2)
		{
			if(pos%2)
			n++;
			else
			n--;
			ans.push_back(1);	
		}
		else
		ans.push_back(0);
		n/=2;
		pos++;
	}
	reverse(ans.begin(),ans.end());
	for(ll i=0;i<ans.size();i++)
	cout<<ans[i];
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}

ll f(ll n, ll b) {
  ll res = 0;
  while (n > 0) {
    res += n % b;
    n /= b;
  }
  return res;
}

ll solve(ll n, ll s, ll p) {
  ll b = p;
  for (;b <= n; b *= p) {
    ll t = f(n, b);
    if (t == s) return b;
    if (t > s) break;
  }
  return -1;
}

ll solve2(ll n, ll s, ll hi, ll lo) {
  while (hi - lo > 1) {
    ll mid = (lo + hi) / 2;
    if (f(n, mid) <= s) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  if (hi > 1 && f(n, hi) == s)
    return hi;
  else
    return -1;
}

int main2() {
  ll n, s; cin >> n >> s;
  
  ll ans = -1;
  ll b = 0;
  for (b = 2; b * b <= n; b++) {
    ll here = solve(n, s, b);
    if (here != -1) {
      if (ans == -1 || ans > here) ans = here;
    }
  }
  if (n >= 2) {
    ll here = -1;
    if (f(n, n) == s) here = n;
    if (here != -1) {
      if (ans == -1 || ans > here) ans = here;
    }
  }
  if (n + 1 >= 2) {
    ll here = -1;
    if (f(n, n+1) == s) here = n + 1;
    if (here != -1) {
      if (ans == -1 || ans > here) ans = here;
    }
  }
  
  for (ll i = 2; i <= b; i++) {
    ll here = solve2(n, s, max(1LL, n/(i-1)), max(1LL, n/i));
    if (here != -1) {
      if (ans == -1 || ans > here) ans = here;
    }
  }
  cout << ans << endl;
  return 0;
}

int main() {
  // while(cin>>ws && !cin.eof()) main2();
  main2();
  return 0;
}



Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
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 fi first
#define sc second
#define rep(i,x) for(int i=0;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 main()
{
	ll x; cin >> x;
	ll y = x/11,z = x%11;
	y *= 2;
	if(z){
		if(z<=6) y++;
		else y+=2;
	}
	cout << y << endl;
}

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

int main(){
  int N;
  cin >> N;
  int count = N;
  vector<char> S(N);
  for(int i = 0; i < N; i++)
    cin >> S.at(i);
  int i = N-1;
  while(i > 0){
    if(S.at(i) == S.at(i-1))
      count--;
    i--;
  };
  cout << count << endl; 
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    int a[M], b[M];
    REP(i, M) cin >> a[i] >> b[i];
    int ans[N];
    REP(i,N) ans[i] = 0;
    REP(i, M){
        ans[a[i]-1] += 1;
        ans[b[i]-1] += 1;
    }
    REP(i, N) cout << ans[i] << endl;
    return 0;
}

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

typedef struct
{ 
  char suit,value;
}Card;

int BubbleSort(int n,Card A[])
{
  int sw=0;
  for(int i=0;i<n;i++)
  {
    for(int j=n-1;j>i;j--)
    {
      if(A[j-1].value>A[j].value)
      {
        swap(A[j-1],A[j]);
        sw++;
      }
    }
  }
  return sw;
}

int selectionSort(int n,Card A[])
{
  int sw=0;
  for(int i=0;i<n;i++)
  {
    int minj=i;
    for(int j=i;j<n;j++)
    {
      if(A[j].value<A[minj].value) minj=j;
    }
    if(minj!=i)
    {
      swap(A[minj],A[i]);
      sw++;
    }
  }
  return sw;
}

int reaction(int n,Card A1[],Card A2[])
{
  for(int i=0;i<n;i++)
  {
    if(A1[i].suit!=A2[i].suit)
    {
      return false;
    }
  }
  return true;
}

void print(int n,Card A[])
{
  for(int i=0;i<n;i++)
  {
    if(i)cout<<" ";
    cout<<A[i].suit<<A[i].value;
  }
  cout<<endl;
}

int main()
{
  int n;
  cin>>n;
  Card A1[36];
  Card A2[36];
  for(int i=0;i<n;i++)
  {
    cin>>A1[i].suit>>A1[i].value;
  }
  for(int i=0;i<n;i++)
  {
    A2[i]=A1[i];
  }
  BubbleSort(n,A1);
  selectionSort(n,A2);

  print(n,A1);
  cout<<"Stable"<<endl;
  print(n,A2);
  if(reaction(n,A1,A2))
  {
    cout<<"Stable"<<endl;
  }
  else
  {
    cout<<"Not stable"<<endl;
  }
  return 0;
  
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define D 1000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.14159265358979323
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n"

ve<ve<ll>> adj(100005);

ve<bool> used(100005);
ve<ll> d(100005), p(100005);

void bfs(ll s, ll n)
{
    queue<ll> q;
    q.push(s);
    used[s] = true;
    p[s] = -1;
    while (!q.empty()) 
    {
        ll v = q.front();
        q.pop();
        for (int u : adj[v]) 
            if (!used[u]) 
            {
                used[u] = true;
                q.push(u);
                d[u] = d[v] + 1;
                p[u] = v;
            }
    }
}

int main() 
{
    FAST;
    ll n,m;
    cin>>n>>m;
    ll a,b;
    for(int i=0;i<m;i++)
    {
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    bfs(1,n);
    for(int i=2;i<=n;i++)
        if(!used[i])
        {
            cout<<"No";
            return 0;
        }
    cout<<"Yes\n";
    for(int i=2;i<=n;i++)
        cout<<p[i]<<'\n';
    subt;
    return 0;
}

Measured memory_bytes: 13720
#include <iostream>
using namespace std;
typedef unsigned long long LL;
int main(int argc, char* argv[])
{
	LL N,Z,i;
	cin>>N>>Z;
	LL DD= Z * Z;
	int ans=0;
	for (i=0;i<N;i++){
		int X,Y;
		cin>>X>>Y;
		if (X<0){
			X=-X;
		}
		if (Y<0){
			Y=-Y;
		}
		LL dist=(LL)X*(LL)X+(LL)Y*(LL)Y;
		if (dist <=DD){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3180
// C++ program to print all prime factors 
#include <bits/stdc++.h> 
using namespace std;
int main () {
  long long int n,count=0,m,k,p,l;cin>>n;
  for (long long int i=0;  ;i++) {
      k=pow(2,i);
      m=n/k;
      if (m==1) {p=i;break;}
  }
  //cout<<p<<endl;
  l=pow(2,p+1);
  cout<<l-1<<endl;








}


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

using namespace std;

int main() {
  int N, M;

  cin >> N >> M;

  vector<bool> accepted(N, false);
  vector<int> count_wa(N, 0);

  int ac = 0;
  int wa = 0;
  for (int i = 0; i < M; i++) {
    int p;
    string S;

    cin >> p;
    cin >> S;

    p--;

    if (accepted[p]) continue;

    if (S == "WA") {
      count_wa[p] += 1;
    } else {
      ac++;
      wa += count_wa[p];
      accepted[p] = true;
    }
  }

  cout << ac << " " << wa << endl;


  return 0;
}


Measured memory_bytes: 640
import itertools

N = int(input())
L = map(int, input().split())

C = list(itertools.combinations(L, 3))

cnt = 0
for a, b, c in C:
    if a == b or b == c or a == c:
        continue

    maxhen = max(max(a, b), c)
    if maxhen < (a + b + c - maxhen):
        cnt += 1

print(cnt)


Measured memory_bytes: 20644
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i, m, n) for (int i = int(m); i < int(n); i++)
#define RREP(i, m, n) for (int i = int(n) - 1; i >= int(m); --i)
#define EACH(i, c) for (auto &(i) : c)
#define all(c) begin(c), end(c)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(begin(c), end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x) cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) \
    do           \
    {            \
    } while (0)
#define dump(x) \
    do          \
    {           \
    } while (0)
#define BR
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int, int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

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

void solve()
{
    LL x, a, b;
    cin >> x >> a >> b;
    if (b - a <= 0)
        cout << "delicious" << endl;
    else if (b - a <= x)
        cout << "safe" << endl;
    else
        cout << "dangerous" << endl;
}

int main()
{
    solve();

    return 0;
}

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

public struct Card {
    public char S;
    public int N;

    public override string ToString() {
        return S + " " + N;
      }
}

public static class Extension {
    public static void QuickSort(this Card[] arr,int p,int r) {
        if (p < r) {
            int t = arr.Pertition(p, r);
            arr.QuickSort(p, t - 1);
            arr.QuickSort(t + 1, r);
        }
    }

public static int Pertition(this Card[] arr, int p, int r) {
        Card x = arr[r];
        int i = p - 1;
        for (int j = p; j < r; j++) {
            if (arr[j].N <= x.N) {
                i++;
                arr.Replace(i, j);
            }
        }
        arr.Replace(i + 1, r);
        return i + 1;
}

 public static void Replace(this Card[] arr, int a, int b) {
      Card temp = arr[a];
      arr[a] = arr[b];
      arr[b] = temp;
 }
}

 class Program {
    static void Main(string[] args) {
        int n = int.Parse(Console.ReadLine());
        Card[] array = new Card[n];
        for(int i = 0; i < n; i++) {
            string[] input = Console.ReadLine().Split(' ');
            array[i] = new Card { S = input[0][0], N = int.Parse(input[1]) };
        }
        Card[] stable = array.OrderBy(c => c.N).ToArray();
        array.QuickSort(0, n - 1);

        StringBuilder sb = new StringBuilder();
        sb.AppendLine(array.SequenceEqual(stable) ? "Stable" : "Not stable");
        foreach (Card s in array)
            sb.AppendLine(s.ToString());
        Console.Write(sb);
    }
}


Measured memory_bytes: 28080
#include <iostream>
#include <map>

using namespace std;

int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  
  map <int, int> f;
  
  f[A]++;
  f[B]++;
  f[C]++;
  
  cout << (f[5] == 2 && f[7] == 1 ? "YES" : "NO");
   return 0;
           }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s, t;
int a, b;

int main() {
    cin >> s >> t;
    cin >> a >> b;
    string u;
    cin >> u;
    if(u == s) a--;
    else if(u == t) b--;

    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;
 
vii G(100001, vi());
 
int dist_1_N = 0;
vi reachable(2, 0);
int N;
unordered_set<int> paths;
vi parent(100001, -1);
vi visited(100001, 0);
 
void dfs(int v, int par=-1){
    parent[v] = par;	
	for(auto &next_v : G[v]){
        if(par == next_v) continue;
        dfs(next_v, v);		
	}
}

void one_to_n_bfs(){
    queue<pii> q;
    q.push(make_pair(0, 0));
    q.push(make_pair(1, N-1));
    visited[0] = 1;
    visited[N-1] = 1;
    while(!q.empty()){
        int player = q.front().first;
        int cur_v = q.front().second;
        q.pop();
        for(auto &next_v : G[cur_v]){
            if(visited[next_v]) continue;
            if(paths.find(next_v) != paths.end()){
                reachable[player]++;
                cout << endl;
                q.push(make_pair(player, next_v));
                visited[next_v] = 1;
            }
        }
    }
}

void other_dfs(int player, int v){
    visited[v] = 1;
    reachable[player]++;
    for(auto &next_v : G[v]){
        if(player==0 && next_v == N-1) continue;
        if(player==1 && next_v == 0) continue;
        if(visited[next_v]) continue;
        other_dfs(player, next_v);
    }
}

void add_paths(int v, int par=-1){
    if(v == 0 || v == N-1) return;
    paths.insert(v);
    for(auto &next_v : G[v]){
        if(par == next_v) continue;
        add_paths(next_v, v);
    }
}
 
int main(){
    cin >> N;
    rep(i, 0, N-1){
        int a, b; cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(0, -1);
    int next_par = N-1;
    while(next_par > 0){
        paths.insert(next_par);
        next_par = parent[next_par]; 
    }
    paths.erase(N-1);
    if(!paths.empty()){
        int v = *paths.begin();
        add_paths(v);
    }
    one_to_n_bfs();
    other_dfs(0, 0);
    other_dfs(1, N-1);

    string winner = "Fennec";
    if(reachable[0] <= reachable[1]) winner = "Snuke";
    cout << winner << endl;
    return 0;
}



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

const double PI = acos(-1);

int main()
{
    int a,b, h, m; 
    cin >> a >> b >> h >> m;

    double ta,tb;
    ta = double(60*h + m)/720 * 2 * PI;
    tb = double(m)/60 * 2 * PI;

    double ax,ay,bx,by;
    ax = a * cos(ta);
    ay = a * sin(ta);
    bx = b * cos(tb);
    by = b * sin(tb);
    double dx,dy;
    dx = ax - bx;
    dy = ay - by;
    double ans;
    ans = sqrt(dx*dx + dy*dy);

    printf("%.10f\n", ans);
    // cout << fixed << setprecision(20) << ans << endl;

}



Measured memory_bytes: 4096
#include <stdio.h>

int cnt=0;
int A[1000000];
int G[100];

void insertionSort(int A[],int n,int g){
  int i,v,j;

  for(i=g;i<n;i++){
    v=A[i];
    j=i-g;
    while(j>=0&&A[j]>v){
      A[j+g]=A[j];
      j=j-g;
      cnt++;
    }
    A[j+g]=v;
  }
}

void shellSort(int A[],int n){
  int m,i=0,h;

  for(h=1;h<=n;i++){
    G[i]=h;
    h=3*h+1;
  }
  m=i;
  printf("%d\n",m);
  for(i=0;i<m;i++){
    printf("%d",G[m-i-1]);
    if(i<m)printf(" ");
    insertionSort(A,n,G[m-i-1]);
  }
}

int main(void){
  int n,i;

  scanf("%d",&n);

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

  shellSort(A,n);
  printf("\n");
  printf("%d\n",cnt);
  for(i=0;i<n;i++)printf("%d\n",A[i]);

  return 0;
}

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

constexpr long long MOD = 46116646144580591;

int main() {
	long long N, L;
	cin >> N >> L;
	map <long long, bool> mp;
	long long NOW = 0;
	for (int i = 0; i < N; i++) {
		string S;
		cin >> S;
		long long Cur = 0, Pow = 1;
		for (int j = 0; j < S.size(); j++) {
			if (S[j] == '0') Cur += Pow;
			else Cur += Pow * 2;
			Cur %= MOD;
			Pow *= 3, Pow %= MOD;
			if (!mp[Cur]) {
				long long X = L - j;
				NOW ^= (X & -X);
				mp[Cur] = true;
			}
		}
	}
	std::cout << (NOW == 0 ? "Bob" : "Alice") << endl;
}

Measured memory_bytes: 6656
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int h,num,count;
  vector<int> v;
  vector<int> ans;

  num = 1;
  count = 0;

  for(int i = 0;i<28;++i){
    cin>>h;
    v.push_back(h);
  }

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

  for(int e : v){
    if(e == num){
      ++num;
    }
    else {
      ans.push_back(num);
      ++num;
      ++count;

      if(e == num){
        ++num;
      }
      else{
        ans.push_back(num);
        ++num;
        ++count;
      }
    }
    if(count == 2){
      break;
    }
  }

  if(count == 0){
    ans.push_back(num);
    ++num;
    ++count;
  }

  if(count == 1){
    ans.push_back(num);
  }

  for(int f : ans){
    cout<<f<<endl;
  }

  return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
	int N;
	int count = 1;
	int j = 0;
	cin >> N;
	int H[N];
	REP(i, N) cin >> H[i];

	REP(i, N){
		while(H[i] - H[j] >= 0){
			j++;
			if(j == i) {
				count++;
				break;
			}
		}
		j = 0;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL<<60;

ll solve() {
    ll N, X;
    cin >> N >> X;
    vector<ll> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    ll ans = INF;
    for ( int m = 0; m < N; m++ ) {
        ll t = 0;
        for ( int i = 0; i < N; i++ ) {
            t += A[i];
        }
        t += m * X;
        if ( ans > t ) ans = t;
        ll az = A[N-1];
        for ( int i = N-1; i >= 1; i-- ) {
            A[i] = min(A[i], A[i-1]);
        }
        A[0] = min(A[0], az);
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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

int main() {
	string n;
  
	cin >> n;
  
  	string msg;
  	if (n[0] == n[1] && n[1] == n[2] || n[1] == n[2] && n[2] == n[3]) {
    	msg = "Yes";
    }
  	else {
      	msg = "No";
  	}

  	cout << msg << endl;
}

Measured memory_bytes: 384
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#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>
#include <regex>

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())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;
const int INF = 2147483647;

//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;

//myfuncs
//素数判定
template<class T> inline T isPrime(T x) {
	bool ret = true;
	if (x < 2) {
		ret = false;
	}
	for (LL i = 2; i <= sqrt(x); i++) {
		if (x%i == 0) {
			ret = false;
		}
	}
	return ret;
}

//Union FInd
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//main code
int main(int argc, char const* argv[])
{
    string s;
    cin >> s;
    set<char> st;
    for (int i = 0; i < 3; i++) {
        st.insert(s[i]);
    }
    if (st.size() == 3) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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

const int maxn = 1005;

#define LL long long

int a, b, c;
int K;

LL A[maxn], B[maxn], C[maxn];
LL AB[maxn * maxn];

priority_queue< pair<LL, pair<int, int> > > pq;

void work()
{
    cin >>a >>b >>c >>K;

    for(int i = 0; i < a; i++) cin >>A[i];
    for(int i = 0; i < b; i++) cin >>B[i];
    for(int i = 0; i < c; i++) cin >>C[i];

    for(int i = 0; i < a; i++)
        for(int j = 0; j < b; j++)
            AB[i * b + j] = A[i] + B[j];

    AB[a * b] = -INT_MAX;
    C[c] = -INT_MAX;

    sort(AB, AB + a * b);
    sort(C, C + c);
    reverse(AB, AB + a * b);
    reverse(C, C + c);

    for(int i = 0; i < c; i++) pq.push(make_pair(AB[0] + C[i], make_pair(0, i)));

    while(K--)
    {
        pair<LL, pair<int, int> > p = pq.top();
        pq.pop();

        cout <<p.first <<endl;

        int u = p.second.first, v = p.second.second;

        pq.push(make_pair(AB[u + 1] + C[v], make_pair(u + 1, v)));
    }
}

int main()
{
    work();
    return 0;
}

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

int main() {
    int a,b,c,d;
    cin >> a >> b >> c;
    if(a>b){
        d=b;
        b=a;
        a=d;
        }
    if(b>c){
        d=c;
        c=b;
        b=d;
    }
    if(a>b){
        d=b;
        b=a;
        a=d;
    }
    cout << a << " " << b << " " << c << endl;
}

Measured memory_bytes: 1164
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
#include<cmath>
#include <numeric>
#include<iomanip>
#include <cstdint>
#include<deque>
#include<stdio.h>
typedef long long ll;

using namespace std;

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	else {
		return gcd(y, x % y);
	}
}

int main() {
	ll a, b;
	cin >> a>> b;
	ll g = gcd(a, b);
	ll ans =  a * b/g;
	cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,x = map(int, input().split())
    a = list(map(int, input().split()))

    if n == 1:
        print(abs(a[0] - x))
        exit()

    for i in range(n):
        a[i] = abs(a[i] - x)
    
    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a % b)
    
    def gcd_group(arr):
        g = gcd(arr[0], arr[1])
        for i in range(2, len(arr)):
            g = gcd(g, arr[i])
        return g
    
    def lcm(a, b):
        g = gcd(a, b)
        return (a*b)//g
    
    def lcm_group(arr):
        l = lcm(arr[0], arr[1])
        for i in range(2, len(arr)):
            l = lcm(l, arr[i])
        return l
    
    print(gcd_group(a))
    

if __name__ == '__main__':
    main()

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

ll a[100005];
ll N;

ll solve(){
    ll Num = 0, Sum = 0;

    for(ll i = 0; i < N; i++) {
        if(i % 2 == 0) {
            if(Sum + a[i] <= 0) {
                Num += abs(Sum + a[i] - 1);
                Sum = 1;
            }else Sum += a[i];
        }else{
            if(Sum + a[i] >= 0) {
                Num += abs(Sum + a[i] - (-1));
                Sum = -1;
            }else Sum += a[i];
        }
    }
    return Num;
}

int main() {
    cin >> N;
    for (ll i = 0; i < N; i++) {
        cin >> a[i];
    }
    ll ans1, ans2;
    ans1 = solve();
    for(ll i = 0; i < N; i++) a[i] *= -1;
    ans2 = solve();
    cout << min(ans1, ans2) << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void) {
	int i = 0, a0 = 0, a1 = 0;
	bool cl = true;
	string s;
	cin >> s;
	for (i = 0; i < s.size(); i+=2) {
		if (s[i] == '1')
			a0++;
		else
			a1++;
	}
	for (i = 1; i < s.size(); i += 2) {
		if (s[i] == '0')
			a0++;
		else
			a1++;
	}
	cout << min(a0, a1) << "\n";
	return 0;
}

Measured memory_bytes: 512
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

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

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  ll A, B, N;
  cin >> A >> B >> N;
  if (N >= B) {
    cout << A * (B - 1) / B << endl;
  } else {
    cout << A * N / B << endl;
  }
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define DEBUG(x) cout<<(#x)<<":"<<x<<endl

const int SIEVE_MAX = 12525252;

int main(){
  vector<bool> sieve(SIEVE_MAX,true);
  vector<int> ans(SIEVE_MAX,0);
  sieve[0] = sieve[1] = false;
  REP(i,SIEVE_MAX){
    if(!sieve[i]){
      if(i>0)ans[i]=ans[i-1];
      continue;
    }
    int x=i<<1;
    while(x<SIEVE_MAX){
      sieve[x]=false;
      x+=i;
    }
    if(i>=9 && sieve[i-2] && sieve[i-6] && sieve[i-8]){
      ans[i] = i;
    }else{
      ans[i] = ans[i-1];
    }
  }
  while(true){
    int x;
    scanf("%d",&x);
    if(x==0)break;
    printf("%d\n",ans[x]);
  }
  return 0;
}

Measured memory_bytes: 51448
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for h in range(H):
        if h%2 == 0:
            if W%2 == 0:
                print("#."*int(W/2)+"\n", end="")
            else:
                print("#."*(W//2)+"#"+"\n", end="")
        else:
            if W%2 == 0:
                print(".#"*int(W/2)+"\n", end="")
            else:
                print(".#"*(W//2)+"."+"\n", end="")
    print()


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

typedef long long ll;


int main()
{

    ios::sync_with_stdio(false);
    cin.tie(0);

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


    if(a==b && a!=c && b!=c)
    {
        cout<<"Yes";
    }
    else if(a!=b && a==c && b!=c)
    {
        cout<<"Yes";

    }
    else if(a!=b && a!=c && b==c)
    {
        cout<<"Yes";

    } else
    {
        cout<<"No";

    }

}

Measured memory_bytes: 256
import java.util.Scanner;

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

        if (n != 1) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            System.out.println(a + b);
        } else {
            System.out.println("Hello World");
        }
    }
}









Measured memory_bytes: 21844