akhauriyash/Code-Regression huggingface dataset:
def Insertion_Sort(A,N):
    for i in range(1,N):
        v = A[i]
        j = i-1
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j-=1
        A[j+1]=v
        print(*A)

N = int(input())
A = list(map(int,input().split()))
print(*A)
Insertion_Sort(A,N)


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

int main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    int l = 0;
    int r = 0;
    int lcnt = 0;
    for (int i = 0; i < N; i++){
        if (s[i] == ')') lcnt++;
        else lcnt--;
        l = max(l, lcnt);
    }
    int rcnt = 0;
    for (int i = N-1; i >= 0; i--){
        if (s[i] == '(') rcnt++;
        else rcnt--;
        r = max(r, rcnt);
    }
    for (int i = 0; i < l; i++) cout << '(';
    cout << s;
    for (int i = 0; i < r; i++) cout << ')';
    cout << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup cin.tie(0);ios::sync_with_stdio(false);
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int main()
{
    ciosup;
    int n, m,ans=0;
    pint a[100'000];
    bool iscut[100'000];
    cin >> n >> m;
    REP(i,m)cin >> a[i].SE >> a[i].FI;
    REP(i,m)iscut[i] = false;
    sort(a, a + m);
    REP(i,m){
        if (!iscut[i]){
            int j=i+1;
            while (true)
            {
                if (a[j].SE < a[i].FI && !iscut[j]){
                    iscut[j] = true;
                }
                else
                {
                    break;
                }
                j++;
            }
            iscut[i] = true;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1152
n=int(input())
a=list(map(int,input().split()))
wa={}
sa={}
for i in range(n):
    wa_=a[i]+(i+1)
    sa_=(i+1)-a[i]
    if 0<sa_:
        if sa_ in sa:
            sa[sa_]+=1
        else:
            sa[sa_]=1
    if wa_ in wa:
        wa[wa_]+=1
    else:
        wa[wa_]=1
ans=0
for i in range(n):
    wa_=a[i]+(i+1)
    sa_=(i+1)-a[i]
    if wa_ in sa:
        ans+=sa[wa_]
    if sa_ in wa:
        ans+=wa[sa_]
print(ans//2)
#print(wa)
#print(sa)

Measured memory_bytes: 117556
#include <iostream>

using namespace std;
long long a[100010],mn = 10000000000,sum = 0,mx = 0;
int main(){
	int i,n,cnt = 0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
		if(a[i]<0){
			cnt++;
		}
		if(a[i]<0) a[i] = -a[i];
		mn = min(a[i],mn);
		sum += a[i];
	}
	if(cnt&1){
		cout << sum - 2*mn << endl;
	}else{
		cout << sum << endl;
	}
}

Measured memory_bytes: 1024
//"I'll live the focused life, because it's the best kind there is" - Winifred Gallagher
#include<bits/stdc++.h>
using namespace std;
#define debug(a) cout << #a << ": " << a << endl
using namespace std;
#define ll long long
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> pii;
#define sz(a) int(a.size())
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define fast cin.tie(0); ios::sync_with_stdio(false);
int main(){fast;
	
	string s; cin>>s;
	cout<<s[0]<<int(s.size()) - 2<<s[sz(s) - 1]<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;

int main() {
    int num;
    vector<array<int, 2>> point_list;
    
    cin >> num;
    
    for (int idx = 0; idx < num; idx++) {
        array<int, 2> point;
        cin >> point[0] >> point[1];
        point_list.push_back(point);
    }
    
    vector<long double> length_list;
    for (int aidx = 0; aidx < num; aidx++) {
        for (int bidx = aidx + 1; bidx < num; bidx++) {
            array<int, 2> point_a = point_list.at(aidx);
            array<int, 2> point_b = point_list.at(bidx);
            long double length = 
                sqrt(
                    pow((long double)(point_a[0] - point_b[0]), 2) +
                    pow((long double)(point_a[1] - point_b[1]), 2)
                );
            length_list.push_back(length);
        }
    }
    
    long double result = accumulate(length_list.begin(), length_list.end(), 0.0l) * num;
    
    for(long double length : length_list) {
        result = result - length;
    }
    
    cout << setprecision(20);
    cout << result / length_list.size() << endl;
    
    return 0;
}

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()
#define CLR(t,v) memset(t,(v),sizeof(t))
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>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;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int A = nextInt();
  int B = nextInt();
  if (A < 10 && B < 10) cout << A * B << endl; else cout << -1 << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


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

using namespace std;
int main(void) {int n,m2;
double m,sum=0;cin>>n>>m;double x;m2=int(m);
 double a[n];for(int i=0;i<n;i++){
    cin>>a[i];sum+=a[i];
  }
  sort(a,a+n);reverse(a,a+n);
  x=sum/(4*m);//ut<<sum<<endl<<sum%(4*m);
if(a[m2 -1]<x){
cout<<"No";}
  else cout<<"Yes";
  }


Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::Chars;

#[fastout]
fn main() {
    input! {
        k: usize,
        s: Chars,
    }

    let mut ans = String::new();
    for i in 0..std::cmp::min(k, s.len()) {
        ans.push(s[i]);
    }

    if k < s.len() {
        ans += "...";
    }

    println!("{}", ans);
}


Measured memory_bytes: 2172
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    
    console.log(N % 1000 === 0 ? 0 : 1000 - (N % 1000));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29684
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N, M; cin >> N >> M;
    cout << N * M << endl;
    return 0;
}



Measured memory_bytes: 3100
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define yes cout<<"YES";
#define no cout<<"NO";
#define ln cout<<"\n";
 // cout<<"Case #"<<ts<<": ";
#include <bits/stdc++.h>
using namespace std;

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

	 ll t=1,r,n,a,d,c,b,x,y,sum,cnt,i,j,k,m,l,q,maxx,minn,temp,ans,flag,g,ts;
	 ll mod=1000000007;
	 char ch,chh;
	 double dans;
	 string str,ttr;
	 
//	 cin >> t;

	
	for(ts=1;ts<=t;ts++)
	{
	     flag=0;sum=0;cnt=0;ans=0;k=0;maxx=0;minn=0;a=0;b=0;temp=0;
	    
	     cin >> n>>m;
	  //  ll arr[n];for(i=0;i<n;i++){cin>>arr[i];}
	     
	     cout<<(n*m);
	    
	     ln
	 }
	return 0;
}


Measured memory_bytes: 3648
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const LL N = 100005;

LL s[N << 1],vis[N << 1];

int main(){
	LL n,x,now = 1;
	cin >> n >> x;
	if(x == 1 || x == (n << 1) - 1){ cout << "No\n"; return 0; }
	if(x == 2){
		s[n] = x; s[n - 1] = 1; s[n - 2] = (n << 1) - 2; s[n + 1] = (n << 1) - 1;
		now = 2;
		for(LL i = 1;i <= (n << 1) - 1;i ++){
			if(s[i]) continue;
			if(now == x) now ++;
			s[i] = now; now ++;
		}
	}
	else{
		s[n] = x; s[n - 1] = (n << 1) - 1; s[n - 2] = 1; s[n + 1] = 2;
		now = 3;
		for(LL i = 1;i <= (n << 1) - 1;i ++){
			if(s[i]) continue;
			if(now == x) now ++;
			s[i] = now; now ++;
		}
	}
	cout << "Yes\n";
	for(LL i = 1;i <= (n << 1) - 1;i ++) cout << s[i] << '\n';
	return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
//#define INF  (1<<30)
#define INFL (1LL<<60)
#define EPS ((ld)(1e-9))
 
#define sz(x) ((int)(x).size())
#define setz(x) memset(x, 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define rep(i, e) for (int i = 0, _##i = (e); i < _##i; i++)
#define repp(i, s, e) for (int i = (s), _##i = (e); i <= _##i; i++)
#define repr(i, s, e) for (int i = (s), _##i = (e); i >= _##i; i--)
#define repi(i, x) for (auto &i : (x))
#define ARR(...) vector<int>({__VA_ARGS__})
#define ARS(...) vector<string>({__VA_ARGS__})
 
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef complex<double> base;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) { 
    return os << '(' << pai.first << ' ' << pai.second << ')';
}
 
template<typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
    os << '[';
    for (auto p : v) os << p << ",";
    os << "]";
    return os;
}
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const set<T, V> v) {
    os << "{";
    for (auto p : v) os << p << ",";
    os << "}";
    return os;
}

template<typename T, typename V>
ostream &operator<<(ostream &os, const multiset<T, V> &v) {
    os << "{";
    for (auto p : v) os << p << ",";
    os << "}";
    return os;
}
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const map<T, V> v) {
    os << "{";
    for (auto p : v) os << p << ",";
    os << "}";
    return os;
}
 
ostream& operator<<(ostream &os, tuple<int, int, int> t) {
    os << "<" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ">";
    return os;
}
 
#ifndef ONLINE_JUDGE
#define debug(...) 0
#define endl '\n'
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif
 
auto x = []{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    return 0;
}();

template<typename T> void get_max(T &a, T b) {a = max(a, b);}
template<typename T> void get_min(T &a, T b) {a = min(a, b);}

ll go(ll v) {
    if (v == 1) return 1;
    return 2*go(v/2)+1;
}

int main(void) {    
    ll H; cin >> H;
    cout << go(H) << endl;
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int ceil_(int a, int b) { return (a + (b - 1)) / b; }
int positive_surplus(int &a) { return (a + MOD) % MOD; }
int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (unsigned int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

signed main() {
  int S;
  cin >> S;
  if (S == (int)1e18) {
    cout << 0 << " " << 0 << " " << bpm(10, 9) << " " << 0 << " " << 0 << " " << bpm(10, 9) << endl;
    return 0;
  }
  int R  = S + (bpm(10, 9) - S % bpm(10, 9));
  int X1 = 0, Y1 = 0;
  int X2 = R / bpm(10, 9);
  int Y3 = bpm(10, 9);
  int Y2 = R - S;
  int X3 = 1;
  cout << X1 << " " << Y1 << " " << X2 << " " << Y2 << " " << X3 << " " << Y3 << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int r,D,x_0;
  cin>>r>>D>>x_0;
  
  
  vector<long long> x(11);
  x[0]=x_0;
  for(int i=0;i<10;i++){
    x[i+1]=x[i]*r-D;
  }
  
  for(int i=1;i<11;i++){
    cout<<x[i]<<endl;
  }
}

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

int main() {
  double r;
  cin >> r;

  double area = M_PI * r * r;
  double circumference = 2 * M_PI * r;
  printf("%f %f\n", area, circumference);
  return 0;
}


Measured memory_bytes: 3192
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int MAX=1e5+10;

int main(){
	int X,A;
	cin>>X>>A;
	if(X<A)cout<<0;
	else cout<<10;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;
 
#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
 
#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)
 
typedef long long ll;
typedef pair<int, int> pii;

int w, h;

#define MAX 51
char brd[MAX][MAX];
bool done[MAX][MAX];
bool calc_done[MAX][MAX];

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

#define EMPTY 0
#define BLACK 1
#define WHITE 2

int only(int y, int x)
{
	if (!(0 <= y && y < h)) return EMPTY;
	if (!(0 <= x && x < w)) return EMPTY;
	if (done[y][x]) return EMPTY;
	done[y][x] = true;

	if (brd[y][x] == 'B')
		return BLACK;
	else if (brd[y][x] == 'W')
		return WHITE;

	int code = EMPTY;
	if (brd[y][x] == '.') {
		rep(i, 4) 
			code |= only(y+dy[i], x+dx[i]);
	}
	return code;
}

int calc(int y, int x)
{
	if (!(0 <= y && y < h)) return 0;
	if (!(0 <= x && x < w)) return 0;
	if (calc_done[y][x]) return 0;
	calc_done[y][x] = true;
	if (brd[y][x] != '.') return 0;

	int cnt = 1;
	rep(i, 4)
		cnt += calc(y+dy[i], x+dx[i]);
	return cnt;
}

int main(void)
{
	while (cin >> w >> h, w|h) {
		rep(j, h) rep(i, w) cin >> brd[j][i];

		int ww, bb;
		ww = bb = 0;

		memset(calc_done, 0, sizeof(calc_done));
		rep(j, h) {
			rep(i, w) {
				memset(done, 0, sizeof(done));

				int c = only(j, i);
				if ((c&BLACK) && (c&WHITE))
					continue;
				else if (c&BLACK) {
					bb += calc(j, i);
				} else if (c&WHITE) {
					ww += calc(j, i);
				}
			}
		}

		printf("%d %d\n", bb, ww);
	}
    return 0;
}

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

int main()
{
  int N,h,count=0;

  cin >> N;
  int A[N];

  for(int i=1;i<=N;i++)
    {
      cin >> A[i];
    }

  for(int i=1;i<=N;i++)
    {
      for(int j=N;j>=i+1;j--)
	{
	  if(A[j] < A[j-1])
	    {
	      h = A[j];
	      A[j] = A[j-1];
	      A[j-1] = h;
	      count++;
	    }
	}
    }

  for(int i=1;i<=N;i++)
    {
      cout << A[i];    
      if(i != N)cout << " ";
    }
  cout << endl << count << endl;


  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void) {
    int N, Y;
    scanf("%d%d", &N, &Y);

    for (int x = 0;x <= N;x++) {
        for (int y = 0;y <= N - x;y++) {
            for (int z = 0;z <= N - x - y;z++) {
                int total = 10000 * x + 5000 * y + 1000 * z;
                if (x + y + z == N && total == Y) {
                    printf("%d %d %d\n", x, y, z);
                    return 0;
                }
            }
        }
    }

    printf("-1 -1 -1\n");

    return 0;
}


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

int main(){
  string S;
  cin >> S;
  bool ans = false;
  for (int i = 0; i < S.size(); i++){
    for (int j = i + 1; j < S.size(); j++){
      if (S.at(i) == S.at(j)) ans = true;
    }
  }
  if (ans == true) cout << "no" << endl;
  else cout << "yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

bool dp[1000010];
int main() {
	int x; cin >> x;
	dp[0] = true;
	for(int i = 1; i <= x; ++i) {
		for(int j = 100; j <= 105; ++j) {
			if(i - j >= 0) {
				dp[i] |= dp[i - j];
			}
		}
	}
	cout << dp[x] << endl;
	return 0;
}

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


int main(){
	int n;
	cin >> n;
	vector<string> s(n);
	for(int i=0;i<n;i++){
		cin >> s.at(i);
	}
	int ans=1;
	sort(s.begin(),s.end());
	for(int i=0;i<n-1;i++){
		if(s.at(i)!=s.at(i+1)){
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 9616
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define lld         double
#define pb          push_back
#define mp 			make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define mod        1000000007
#define PI 		   3.14159265
#define fr(i,a,b)  for(int i=a;i<b;i++)
using namespace std;


int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,x,y;
    cin>>n;
    if(n==1)
    {
        cout<<"Hello World";
        return 0;
    }
    cin>>x>>y;
    cout<<x+y;

}


Measured memory_bytes: 256
a,b,c=map(int,raw_input().split())
if(a>b):
 tmp=a
 a=b
 b=tmp
if(b>c):
 tmp=b
 b=c
 c=tmp
if(a>b):
 tmp=a
 a=b
 b=tmp
print str(a)+" "+str(b)+" "+str(c)

Measured memory_bytes: 4212
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#ifndef print
#define print(...)
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
//const int mod = 998244353;
const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk = clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) { uniform_int_distribution<int> uid(0, lim - 1); return uid(rang); }
int powm(int a, int b) { int res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

bool vis[1000000];

int ps(int cn) {
	int su = 0;
	if (cn & 1) {
		su = (cn + 1) / 2;
		cn--;
	}
	cn /= 2;
	return su + cn * (cn + 1);
}

int32_t main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.precision(10); srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	string s; cin >> s;
	int cnt = 0;
	int n = sz(s);
	for (int i = 0; i < n; ++i)
		if (s[i] == '1')
			cnt++, vis[i] = 1;
	int su = ps(cnt);
	// print(su);
	int cn = 0;
	for (int i = 0; i < n; ++i) {
		if (s[i] == '1') {
			cn++;
		} else if((cn & 1)) {
			vis[i] = 1;
			cnt++;
			su += (cnt + 1) / 2;
			cn++;
		}
	}
	// print(su);
	int odd = 0, ev = 0;
	for (int i = n - 1; i >= 0; --i) {
		if (!vis[i]) {
			// print(odd, ev, i, (cnt - n + 2 + i) / 2);
			su += ev + (cnt - n + 2 + i) / 2;
			cnt++;
		}
		if (s[i] == '1') {
			int te = odd;
			odd = 1 + ev;
			ev = te;
		} else {
			int te = odd;
			odd = ev;
			ev = te;
		}
	}
	cout << su << '\n';
}

Measured memory_bytes: 4008
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        int r = scan.nextInt();
        int D = scan.nextInt();
        int x = scan.nextInt();
        for(int j = 1;j <= 10; j++){
            x =  (r * x - D);
            System.out.println(x);
        }

    }
}


Measured memory_bytes: 21716
#include <iostream>
#include<stdio.h>

using namespace std;

int main()
{
    int n,flg=1;
    scanf("%d",&n);
    int i,sum=0;
    int m=n;
   for(i=1;;i*=10)
   {
       if(i>n)break;
   }
        i/=10;


       for(int j=i;j>=1;)
       {
           sum+=n/j;
           n=n%j;
           j/=10;

       }

       if(m%sum==0)printf("Yes\n");
       else printf("No\n");


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int N;
    cin>>N;
    int sum = 0;

    vector<int> A(N+1);
    vector<int> C(N);

    for(int i = 1;i <= N;i++) {
        cin>>A[i];
    }
    for(int i = 1;i <= N;i++) {
        int b;
        cin>>b;
        sum += b;
    }
    for(int i = 1;i <= N-1;i++) {
        cin>>C[i];
    }

    for(int i = 1;i < N;i++) {
        if(A[i]+1 == A[i+1]) {
            sum += C[A[i]];
        }
    }

    cout<<sum<<endl;

    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include <unordered_map>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n; ++i)
#define ALL(a) (a).begin(),(a).end()
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)

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

    double ans = v[0];
    for(int  i = 1; i < n; ++i)ans = (ans+v[i])/2.0;

    cout << ans << endl;
} 

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int i,j,minj,count=0,A[100],N,a;
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	for(i=0;i<N-1;i++){
		minj=i;
		for(j=i+1;j<N;j++){
			if(A[j]<A[minj])
				minj=j;	
		}
		if(A[i]>A[minj]){
		a=A[i];
		A[i]=A[minj];
		A[minj]=a;
		count++;
	}
	}
	for(i=0;i<N;i++){
		printf("%d",A[i]);
		if(i<N-1)
			printf(" ");
	}
	printf("\n%d\n",count);
	return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define inf 1000000000
#define tam 100000

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <ll, ll> dl;
typedef pair <ll, ll> ii;
typedef vector <ii> vii;
typedef vector <vi> graph;

bool comp(ll a, ll b) {
	return a > b;
}

int n, m;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
 
    cin >> n >> m;
    int in1, in2;
    vi h(n);
    set <int> grafo[n];
    for (int i = 0; i < n; i++) {
        cin >> in1;
        h[i] = in1;
    }
    for (int i = 0; i < m; i++) {
        cin >> in1 >> in2;
        in1--; in2--;
        grafo[in1].insert(in2);
        grafo[in2].insert(in1);
    }
    vector <bool> vis(n, 1);
    int cont = 0;
    for (int i = 0; i < n; i++) {
        if (!vis[i]) continue;
        queue <int> cola;
        bool band = true;
        for (int x : grafo[i]) {
            cola.push(x);
            if (h[i] < h[x]) band = false;
            if (h[i] == h[x]) {band = false; vis[x] = false;}
        }
        if (band) {
            cont++;
            while (!cola.empty()) {
                int u = cola.front();
                cola.pop();
                vis[u] = 0;
            }
        }
    }
    cout << cont << "\n";
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
	return 0;
}

Measured memory_bytes: 17720
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int const mod = 1000000007;

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

    int pre = -999;
    rep(i,n){
        if(pre<a[i]){
            pre = a[i] - 1;
        }else if (pre==a[i])
        {
            pre = a[i];
        }else{
            puts("No");
            return 0;
        }
    }
    puts("Yes");
}

Measured memory_bytes: 768
n = gets.chomp.to_i

if n == 3
  puts '2 5 63'
elsif n == 4
  puts '2 5 20 63'
elsif n <= 15000
  0.step do |k|
    answer = nil
    [15000, (n - 1)].min.downto(1) do |l2|
      next if l2 % 3 == 1
      l3 = n - l2 + k
      next if l3 > 10000 || l3 % 4 == 1 || l3 % 4 == 2
      l6 = [l2 / 3, l3 / 2].min
      if n == l2 + l3 - l6
        answer = ((1..l2).map{ |i| i * 2 } + (1..l3).map{ |i| i * 3 }).uniq.join(' ')
        puts answer
        break
      end
      break if answer
    end
    break if answer
  end
else
  0.step do |k|
    l2 = 15000 - n % 2
    l3 = n - l2 + k
    next if l3 > 10000 || l3 % 4 == 1 || l3 % 4 == 2
    l6 = [l2 / 3, l3 / 2].min
    if n == l2 + l3 - l6
      answer = ((1..l2).map{ |i| i * 2 } + (1..l3).map{ |i| i * 3 }).uniq.join(' ')
      puts answer
      break
    end
    break if answer
  end
end


Measured memory_bytes: 3836
#include<cstdio>
#define mod 1000000007
typedef long long ll;
const int MAXN=100000+10;
int n,m;
int a[MAXN];
int dp[MAXN];
bool vis[MAXN];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d",&a[i]);
		vis[a[i]]=1;
	}
	dp[0]=1;
	for(int i=1;i<=n;i++){
		if(vis[i]) continue;
		dp[i]=dp[i-1]+dp[i-2];
		dp[i]%=mod;
	}
	printf("%d\n",dp[n]%mod);
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<set>
#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...); }

li calc(vector<pair<int,li>>& vec){
  int n=vec.size();
  if(n==0) return 0;
  rep(i,n) vec[i].first*=-1;
  sort(vec.begin(),vec.end());
  rep(i,n) vec[i].first*=-1;
  li s=0;
  int i=0,i0=vec[0].first;
  multiset<li> st;
  while(i0){
    while(i<n and vec[i].first==i0) st.insert(-vec[i++].second);
    if(st.size()){
      s-=*st.begin();
      st.erase(st.begin());
    }
    i0--;
  }
  return s;
}

void solve(vector<int>& k,vector<li>& l,vector<li> r){
  int n=k.size();
  vector<pair<int,li>> lft,rgt;
  li s=0;
  rep(i,n){
    if(r[i]<l[i]){
      lft.push_back({k[i],l[i]-r[i]});
      s+=r[i];
    }
    else if(l[i]<r[i]){
      rgt.push_back({n-k[i],r[i]-l[i]});
      s+=l[i];
    }else{
      s+=l[i];
    }
  }
  print(s+calc(rgt)+calc(lft));
}

int main(){
  int t; cin >>t;
  rep(_,t){
    int n; cin >>n;
    vector<int> k(n);
    vector<li> l(n),r(n);
    rep(i,n){
      cin >>k[i]>>l[i]>>r[i];
    }
    solve(k,l,r);
  }
}


Measured memory_bytes: 12660
/*
  ID: ak260901
  TASK: a
  LANG: C++
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>

using namespace std;

#define foru(i, l, r) for(register int i = l; i <= r; i++)
#define ford(i, r, l) for(register int i = r; i >= l; i--)

const string S = "JPY";

int n;
double a[100], ans;
string b[100];

int main() {
  //freopen("a.in", "r", stdin);
  //freopen("a.out", "w", stdout);
  scanf("%d", &n);
  for(int i = 1; i <= n; i++)
    cin >> a[i] >> b[i];
  for(int i = 1; i <= n; i++) {
    if(b[i] == S) ans += a[i] * 1.0;
    else ans += a[i] * 380000.0;
  } printf("%lf\n", ans);
  return 0;
}


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

int solve_number(
                 vector<bool> comp, vector<int> &c, vector<vector<int>> a, int x){
    
    int ne=0;
    
    int m = (int)a[0].size();
    
    vector<int> ri(m,0);
    
    for(int i=0; i<c.size(); i++){
        if(!comp[i])continue;
        
        ne += c[i];
        
        for(int j=0; j<m; j++){
            ri[j] += a[i][j];
            
        }
    }
    
    bool ok=true;
    
    for(int j=0; j<m; j++){
        if(ri[j]<x)return 2000000;
    }
    
    return ne;
}

void combi(
           vector<bool> comp,
           vector<int> &c, vector<vector<int>> a, int n, int x, int &nmin){
    
    int m = (int)a[0].size();
    
    if(n==0){
        nmin = min( nmin, solve_number(comp, c, a, x));
        return;
    }
    
    combi(comp, c, a, n-1, x, nmin);
    comp.at(n-1) = true;
    combi(comp, c, a, n-1, x, nmin);
    comp.at(n-1) = false;
    
    return;
}

int main(){
    
    int n,m,x;
    cin >> n >> m >> x;
    
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int> (m));
    
    for(int i=0; i<n ; i++){
        cin >> c.at(i);
        for(int j=0; j<m; j++){
            cin >> a.at(i).at(j);
        }
    }
    
    vector<bool> comp(n, false);
    int nmin=2000000;
    
    combi(comp, c, a, n, x, nmin);
    
    if(nmin==2000000)
        cout << "-1" << endl;
    else
        cout << nmin << endl;
    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <vector>

using namespace std;

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

     int x = n-k;
     int y = k-1;
     cout << (x+y-1) / y + 1 << endl;
}


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

const int N = 100+5;
const int MAXV = 100000+5;

int n, W;
int v[N];
int w[N];
long long memo[N][MAXV];

int main() {
	cin >> n >> W;
	int V = 0;
	for(int i=1; i<=n; i++){
		cin >> w[i] >> v[i];
		V += v[i];
	}
	/***********************/
	for(int i=0; i<=V; i++){
		memo[0][i] = 1LL<<40;
	}
	memo[0][0] = 0LL;
	for(int i=1; i<=n; i++){
		for(int val = 0; val <= V; val++){
			memo[i][val] = memo[i-1][val];
			if(val >= v[i]){
				memo[i][val] = min(memo[i][val],memo[i-1][val-v[i]] + w[i]);
			}
		}
	}
	int ans = 0;
	for(int i=0; i<=V; i++){
		if(memo[n][i] <= W) ans = i;
	}
	cout << ans << endl;
	
	return 0;
}

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

#define endl '\n'
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
#define ALL(v) v.begin(), v.end()
#define ALLR(v) v.rbegin(), v.rend()
#define deb cout<<"HOLA\n";
#define UNIQUE(v) (v).resize(unique(ALL(v))-(v).begin())
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define bs(v,f) binary_search(ALL(v),f)
#define lb(v,f) lower_bound(ALL(v),f)
#define ub(v,f) upper_bound(ALL(v),f)
#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef string str;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

void solve(){
	int n;
	cin>>n;
	set<string>niu;
	str a;
	forn(i,n){
		cin>>a;
		niu.insert(a);
	}
	cout<<niu.size();
}
int main(){
		solve();
	return 0;
}

Measured memory_bytes: 19020
n, p = map(int, input().split())
s = [int(i) for i in input()]
p_cnt = 0

if p == 2 or p == 5:
    for i in range(n):
        if s[i] % p == 0:
            p_cnt += i+1
        
else:
    s = s[::-1]
    div_dic = dict(zip(range(p), [0] * p))
    tmp = 0

    for i in range(n):
        tmp += s[i] * pow(10, i, p)
        tmp %= p
        div_dic[tmp] += 1

    for v in div_dic.values():
        p_cnt += v * (v - 1)
    p_cnt //= 2
    p_cnt += div_dic.get(0)

print(p_cnt)

Measured memory_bytes: 6436
#include <bits/stdc++.h>
using namespace std;
const int nax = 1e5+3;
int number;
int dyn[nax];
int a[nax];
int op1(int i){
	if (i==number-1) return 0;
	if(dyn[i]!=-1) return dyn[i];
	int res = abs(a[i]-a[i+1])+op1(i+1);
	if(i!=number-2) res = min(res, abs(a[i]-a[i+2])+op1(i+2));
	return dyn[i]=res;
}
int main(){
	cin>>number;
	for(int i=0; i<number; i++) cin>>a[i];
	memset(dyn, -1, sizeof dyn);
	cout<<op1(0)<<endl;
	return 0;
}


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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

typedef long long LL;
using namespace std;

LL GCD(LL x, LL y){
        LL r=0;

	if( x<y ) swap(x, y);
        r = x % y;
        while(r!=0){
                x = y;
                y = r;
                r = x % y;
        }
        return y;
}

int main(int argc, char* argv[]){
	int N, X;
	vector<int> v;
	cin >> N >> X;

	for(int i=0; i<N; i++){
		int c;
		cin >> c;
		v.push_back(c);
	}
	v.push_back(X);

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

	long long D = v[1] - v[0];
	for(int j=1; j<v.size(); j++){
		D = GCD(D, v[j] - v[j-1]);
	}
	cout << D << endl;
	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <math.h>

#define N_size 100000000000

using namespace std;

int main(){
    int N,M,rs=0;

    cin >> N >> M;

    vector<int> A(M);

    vector<int> fl(M);

    int k = 0;

    for(int i = 0;i < M;i++){
        fl.at(i) = 0;
    }

    for(int i = 0;i < N;i++){
        cin >> k;
        for(int j = 0;j < k;j++)
            cin >> A.at(j);
        
        for(int j = 0;j < k;j++){
            fl.at(A.at(j) - 1)++;
        }
    }

    for(int i = 0;i < M;i++){
        if(fl.at(i) == N)
            rs++;
    }

    cout << rs << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (true) {
			int w = in.nextInt();
			int h = in.nextInt();
			if (w == 0 && h == 0) {
				break;
			}
			int n = in.nextInt();
			int[] x1 = new int[n];
			int[] y1 = new int[n];
			int[] x2 = new int[n];
			int[] y2 = new int[n];
			for (int i = 0; i < n; i++) {
				x1[i] = in.nextInt();
				y1[i] = in.nextInt();
				x2[i] = in.nextInt();
				y2[i] = in.nextInt();
			}
			
			w = compress(x1, x2, w);
			h = compress(y1, y2, h);
			
			boolean[][] a = new boolean[w][h];
			for (int i = 0; i < n; i++) {
				for (int x = x1[i]; x < x2[i]; x++) {
					for (int y = y1[i]; y < y2[i]; y++) {
						a[x][y] = true;
					}
				}
			}
			
			int ans = 0;
			for (int x = 0; x < w; x++) {
				for (int y = 0; y < h; y++) {
					if (a[x][y]) {
						continue;
					}
					ans++;
					a[x][y] = true;
					ArrayDeque<int[]> stack = new ArrayDeque<int[]>();
					stack.push(new int[]{x, y});
					while (!stack.isEmpty()) {
						int[] xy = stack.pop();
						int[] dx = {-1, 0, 1, 0};
						int[] dy = {0, -1, 0, 1};
						for (int j = 0; j < 4; j++) {
							int _x = xy[0] + dx[j];
							int _y = xy[1] + dy[j];
							if (_x >= 0 && _x < w && _y >= 0 && _y < h && !a[_x][_y]) {
								a[_x][_y] = true;
								stack.push(new int[]{_x, _y});
							}
						}
					}
				}
			}
			
			System.out.println(ans);
		}
	}
	
	static int compress(int[] x1, int[] x2, int w) {
		int n = x1.length;
		TreeSet<Integer> set = new TreeSet<Integer>();
		set.add(0);
		set.add(w);
		for (int i = 0; i < n; i++) {
			set.add(x1[i]);
			set.add(x2[i]);
		}
		Integer[] x = set.toArray(new Integer[0]);
		for (int i = 0; i < n; i++) {
			x1[i] = Arrays.binarySearch(x, x1[i]);
			x2[i] = Arrays.binarySearch(x, x2[i]);
		}
		return x.length - 1;
	}
}

Measured memory_bytes: 57096
import sys

input = sys.stdin.readline

def main():
    ans = ''
    N, K, Q = map(int, input().split())
    a = [K-Q]*N
    for _ in range(Q):
        a[int(input())-1] += 1
    for i in a:
        if i > 0:
          ans += 'Yes'
        else:
          ans += 'No'
        ans += '\n'
    print(ans)

if __name__ == '__main__':
    main()

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

#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

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

  while(true) {
    int n, r;
    int p, c;
    int temp;
    cin >> n >> r;
    if(n + r == 0) break;

    int a[100];
    REP(i, n) {
      a[i] = i + 1;
    }

    REP(i, r) {
      cin >> p >> c;
      REP(k, c) {
        FOR(j, n - p, n - 1) {
            temp = a[j - k];
            a[j - k] = a[j + 1 - k];
            a[j + 1 - k] = temp;
        }
      }
    }
    cout << a[n - 1] << endl;

  }






}



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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int n;
  	cin >> n;
  	vi a(n);
	rep(i,n) cin >> a[i];
  	sort(all(a));
  	int cnt = 1;
	rep(i,n-1) {
		if(a[i] != a[i+1]) cnt++;
    }
    cout << cnt << endl;
	return;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
#define MOD 1000000007
long long f[1000005];
long long g[100005];
long long inv[1000005];

long long q_pow(long long n,long long m)
{
	int res=1;
	while(m)
	{
		if(m&1)
		{
			res=(res*n)%MOD;
		}
		n=(n*n)%MOD;
		m=m>>1;
	}
	return res;
} 

void fac()
{
	f[0]=1;
	inv[0]=1;
	for(long long i=1;i<=1000000;i++)	
	{
		f[i]=(f[i-1]*i)%MOD;
	}
	inv[1000000]=q_pow(f[1000000],MOD-2);
	for(long long i=1000000-1;i>0;i--)
	{
		inv[i]=(inv[i+1]*(i+1))%MOD;
	}
}
long long c(long long n,long long m)
{
	long long res=((f[n]*inv[n-m])%MOD*inv[m])%MOD;
	return res;
}
int main()
{
	fac();
	long long n,m;
	cin>>n>>m;
	long long p=0;
    long long lim=sqrt(m);
	for(int i=2;i<=lim;i++)
	{
		if(m%i==0)
		{
			g[p]=0;
			while(m%i==0)
			{
				g[p]++;
				m=m/i;
			}
			p++;
		}
	}	
//	cout<<g[1]<<' '<<g[0]<<endl;
	long long ans=1;
	for(int i=0;i<p;i++)
	{
		ans=(c(g[i]+n-1,n-1)*ans)%MOD;
	}
	if(m!=1) ans=(ans*n)%MOD;
	cout<<ans<<endl;
} 

Measured memory_bytes: 16640
//
// Created by HSK on 2017. 10. 14..
//

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (A == B) {
    cout << C;
  } else if (A == C) {
    cout << B;
  } else {
    cout << A;
  }
  return 0;
}

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

using namespace std;

int main()
{
    int n = 0;
    list<int> b;

    cin >> n;
    int tmp1, tmp2;
    if (n % 2 == 0)
    {
        for (int i = 0; i < n / 2; i++)
        {
            cin >> tmp1 >> tmp2;
            b.push_back(tmp1);
            b.push_front(tmp2);
        }
    }
    else
    {
        for (int i = 0; i < n / 2; i++)
        {
            cin >> tmp1 >> tmp2;
            b.push_back(tmp1);
            b.push_front(tmp2);
        }
        cin >> tmp1;
        b.push_back(tmp1);
        reverse(b.begin(), b.end());
    }

    for (list<int>::iterator i = b.begin(); i != b.end(); ++i)
    {
        cout << *i << " ";
    }

    return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/range/algorithm.hpp>
#define rep(i,n) for (int i=0; i< (n); ++i)
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }
  ll sum = 0;
  rep(i,n){sum += a[i];} 
  vector<ll> ans(n);
  ans[0] = sum;
  rep(j,(n-1)/2){
    ans[0] -= 2*a[(1+2*j)%n];
  }
  for(int i=1;i<n;i++){
    ans[i] = 2*a[i-1]-ans[i-1];
  }
  
  rep(i,n-1){
    cout << ans[i] << " ";
  }
  cout << ans[n-1] << endl;

  return 0;
}


Measured memory_bytes: 2432
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

const MOD: i64 = 998244353;

fn modpow(mut x: i64, mut n: i64) -> i64 {
    let mut ret: i64 = 1;
    while n > 0 {
        if (n & 1) == 1 {
            ret = ret * x % MOD;
        }
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

fn main(){
    input!{
        N: i64,
        A: i64,
        B: i64,
        K: i64,
    }

    let mut fact = vec![];
    let mut inv = vec![];
    fact.push(1i64);
    inv.push(1i64);

    for i in 0..N {
        fact.push(fact[i as usize] * (i + 1) % MOD);
        inv.push(modpow(fact[(i + 1) as usize], MOD - 2));
    }

    let mut ans: i64 = 0;

    for a in 0..N+1 {
        if (K - a * A) % B != 0 {
            continue;
        }
        let b = (K - a * A) / B;
        if b < 0 || N < b {
            continue;
        }

        ans += fact[N as usize] % MOD * inv[a as usize] % MOD * inv[(N - a) as usize] % MOD * fact[N as usize] % MOD * inv[b as usize] % MOD * inv[(N - b) as usize] % MOD;
        ans %= MOD;
    }

    println!("{}", ans);
}

Measured memory_bytes: 6812
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int inf = 0x3f3f3f3f;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
#define pc putchar
#define gc getchar
#define fi first
#define se second
#define debug(x) cout << #x" = " << x << endl;
inline ll read(){
	register ll x=0,f=1;register char c=gc();
	for(;!isdigit(c);c=gc())if(c=='-')f=-1;
	for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
#define rd read
void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
void writeln(ll x){write(x);puts("");}
const int N=500006;
char s[N];
int jump[N],nxt[N],fa[N][22],n,to[N][31],q[N],trans[N][31];
int main(){
//	freopen("fusion.in","r",stdin);
//	freopen("fusion.out","w",stdout);
	scanf("%s",s+1);
	n=strlen(s+1);
	to[n][s[n]-'a']=n;
	Dep(i,n-1,1){
		to[i][s[i]-'a']=i;
		int now=i+1,c=s[i]-'a';
		while(1){
			int tmp=now,top=0;
			while(!to[now][c]&&nxt[now]){
				q[++top]=now;
				now=nxt[now]+1;
				if(trans[now][c]) now=trans[now][c];
			}
			if(!to[now][c])	break;
			Rep(j,1,top)	trans[q[j]][c]=now;
			now=to[now][c]+1;c++;to[i][c]=now-1;
			if(c>'z'-'a')	break;
		}
		nxt[i]=to[i]['z'-'a'+1];
	}
	Rep(i,1,n-1) if(nxt[i]) fa[i][0]=nxt[i]+1;
	Rep(j,1,21)	
		Rep(i,1,n-1)	
			if(fa[i][j-1])	fa[i][j]=fa[fa[i][j-1]][j-1];
	
	for(int T=rd();T;T--){
		int l=read(),r=read();
		bool flag=0;
		Dep(j,21,0){
			if(fa[l][j]) if(fa[l][j]<=r) l=fa[l][j];
					else if(fa[l][j]-1==r){puts("Yes");flag=1;break;}
		}
		if(!flag) puts("No");
	}
}
/*
xxyzzwwxzzyz
1
6 12
*/

Measured memory_bytes: 171008