akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main()
{
	char str[5]; /* 念のため一個多めに */
	int A[100];
	int i, j, v, N, count, m;

	count = 0;

	scanf("%s",str);
	N = atoi( str );

	while( scanf("%s",str) != EOF ){
		A[count] = atoi(str);
		count++;
	}

	for( m = 0; m <= N - 2; m++ ){
		printf("%d",A[m]);
		printf(" ");
	}

	printf("%d\n",A[N-1]);

	for( i = 1; i <= N - 1; i++ ){
		v = A[i];
		j = i - 1;

		while(( j >= 0 ) && ( A[j] > v ) ){
			A[j+1] = A[j];
			j--;
		}

		A[j+1] = v;

		for( m = 0; m <= N - 2; m++ ){
			printf("%d",A[m]);
			printf(" ");
		}

		printf("%d\n",A[N-1]);
	}
	return 0;
}



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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    ll a, b, c;
    cin >> a >> b >> c;

    ll tmp = 4 * a * b;
    ll tmp2 = c - a - b;
    ll tmp3 = tmp2 * tmp2;

    bool ok = false;
    if (tmp2 > 0 && tmp < tmp3) ok = true;

    if (ok) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}

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

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

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

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

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

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

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

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

use std::cmp;

fn main() {
    input! {
        n: u32,
        a: u32,
        b: u32,
    }
    let train = a * n;
    let taxi = b;
    println!("{}", cmp::min(train, taxi));
}


Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	int r; scanf("%d", &r);
	printf("%d", 3 * r*r);

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

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

    dsu uf(N);
    for_(i,0,Q) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) uf.merge(u, v);
        else puts(uf.same(u, v) ? "1" : "0");
    }
}

Measured memory_bytes: 3964
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

const int INF = 1e9;
const ll LINF = 1e18;

struct edge{int to,cost;};

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

	int n,m;
	cin >> n >> m;

	long long x[n],y[n],z[n];
	for(int i=0;i<n;i++){
		cin >> x[i] >> y[i] >> z[i];
	}
	
	long long ans=-LINF;
	long long a[n];
	int sign[3];
	for(int i=0;i<(1<<3);i++){
		for(int j=0;j<3;j++){
			if((i>>j)&1==1) sign[j]=-1;
			else			sign[j]=1;
		}
		for(int j=0;j<n;j++){
			a[j] = x[j]*sign[0] + y[j]*sign[1] + z[j]*sign[2];
		}
		sort(a,a+n,greater<ll>());
		ll tmp=0;
		for(int j=0;j<m;j++){
			tmp+=a[j];
		}
		ans = max(ans,tmp);
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    res = 'Yes'
    pre_x, pre_y = 0, 0
    pre = 0
    for _ in range(N):
        t, x, y = map(int, readline().rstrip().split())
        cost = abs(x - pre_x) + abs(y - pre_y)
        if (t - pre) - cost >= 0 and ((t - pre) - cost) % 2 == 0:
            pre, pre_x, pre_y = t, x, y
        else:
            res = 'No'
            break

    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

int main()
{
    long long A, B, C, D, LCM;
    cin >> A >> B >> C >> D;
    long long c = C, d = D, r;
    r = d % c;
    while(r != 0)
    {
        d = c;
        c = r;
        r = d % c;
    } 
    LCM = C * D / c;
    cout << (B - (B / C) - (B / D) + (B / LCM)) - ((A - 1) - ((A - 1) / C) - ((A - 1) / D) + ((A - 1) / LCM)) <<endl;
    return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
ll mod = 1000000007;
ll inf = 1e18;
int main(){

    int n;
    cin >> n;
    vector<int> a(n),d(n);
    rep(i,n) cin >> a[i];
    rep(i,n) d[i]=a[i]-(i+1);
    sort(all(d));

    int mid=d[n/2];
    ll sum=0;
    rep(i,n) sum+=abs(d[i]-mid);

    cout << sum << endl;
    
    return 0;
}

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

int main() {
string S; cin >> S;
char c;
int count = 0;
int ans = 0;
for (int i = 0; i < S.size() ; i++){
  c = S[i];
  if (c =='A'||c =='C'||c =='G'||c =='T'){
    count ++;
  } 
  else{
    ans = max(count , ans);
    count = 0;
  }
}
if (ans <= count){
ans = count;
}
cout << ans  << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    fori (i, 0, n) cin >> v[i];
    sort(begin(v), end(v));
    int ans = 0;
    fori (i, 0, k) ans += v[i];
    cout << ans << endl;
}

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



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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}

#define deb(x) cout << '>' << #x << ':' << x << endl;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define END '\n'
#define inf 9e18
#define ff first
#define ss second
#define pb push_back

void solve(){
    int n;
    cin >> n;
    cout << (800 * n - 200 * (n / 15));
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3568
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int X, Y, A, B, C;

    cin >> X >> Y >> A >> B >> C;

    vector<pair<int, int>> cand; 

    vector<int> rA(A), rB(B), rC(C);

    for (int i = 0; i < A; i++) {
        cin >> rA[i];
        cand.emplace_back(rA[i], 0);
    }
    for (int i = 0; i < B; i++) {
        cin >> rB[i];
        cand.emplace_back(rB[i], 1);
    }
    for (int i = 0; i < C; i++) {
        cin >> rC[i];
        cand.emplace_back(rC[i], 2);
    }

    sort(cand.rbegin(), cand.rend());

    int64 S = 0;

    int used = 0;

    for (auto entry : cand) {
        int val, col;
        tie(val, col) = entry;

        //cerr << val << " " << col << " : " << X << " / " << Y << "\n";

        if (col == 2) {
            used++;
            S += val;
        } else {
            if (col == 0 && X) {
                S += val;
                X--;
            } else if (col == 1 && Y) {
                S += val;
                Y--;
            }
        }

        if (used >= X + Y) {
            break;
        }
    }

    cout << S << "\n";

    return 0;
}


Measured memory_bytes: 7536
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
int n,las=0;
int main(){
	n=read();
	for(int i=1;i<=n;i++){
		int x=read();
		if(x<las){
			cout<<"No"<<endl;
			return 0;
		}
		else if(x>las){
			las=x-1;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;

const long long int mod=998244353;
const long long int INF=99999999999999999;

long long int n,k,m,sum=0,res=9999999999999999,now=0;
long long int a[200005],f[200005];
pair<long long int,long long int>pa[200005],memo[200005];

int main() {
	cout << fixed << setprecision(10);
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    for(int i=0;i<n;i++){
        cin>>f[i];
    }
    if(sum<=k){
        cout<<0<<endl;
        return 0;
    }
    sort(a,a+n);
    sort(f,f+n);
    for(int i=0;i<n;i++){
        pa[i]={a[i]*f[n-i-1],a[i]};
    }
    sum=0;
    sort(pa,pa+n);
    long long int L=0,R=1000000000000,mid;
    while(R-L>1){
        mid=(R+L)/2;
        
        long long int tmp=0,count_k=0;
        for(int i=n-1;i>=0;i--){
            long long int x=pa[i].second;
            long long int y=pa[i].first;
            if((mid*x)%y==0){
                tmp=x-(mid*x)/y;
            }else{
                tmp=x-(mid*x)/y;
            }
            tmp=max(0LL,tmp);
            count_k+=tmp;
            //cout<<x<<" "<<y<<" "<<(mid*x)/y<<"->"<<tmp<<endl;;
        }
        //cout<<endl;
        //cout<<mid<<" "<<count_k<<endl;
        if(count_k>k){L=mid;}
        else{R=mid;}

    }
    cout<<R<<endl;
    

} 


Measured memory_bytes: 7552
#include <cstdio>
#include <cstring>
using namespace std;
#define int long long
#define N 20
#define M 1000000007
int he[N],ne[N*N],e[N*N],cnt,n,m;
int f[1<<N],lg[1<<N],pw[N*N],ans;
void add(int u,int v){ne[++cnt]=he[u];he[u]=cnt;e[cnt]=v;}
signed main(){
    scanf("%lld%lld",&n,&m);
    for (int i=1;i<=m;i++){
        int u,v; scanf("%lld%lld",&u,&v); u--; v--;
        add(u,v);
    }
    pw[0]=1;
    for (int i=1;i<=m;i++) pw[i]=(pw[i-1]<<1)%M;
    lg[1]=0;
    for (int i=2;i<1<<n;i++) lg[i]=lg[i>>1]+1;
    f[0]=1;
    for (int i=1;i<1<<n;i++){
        f[i]=1; 
        int t=(i&1)+((i&2)>>1);
        if (t==1){f[i]=0; continue;}
        for (int j=(i-1)&i;j;j=(j-1)&i){
        	int t=(j&1)+((j&2)>>1);
        	if (t==1) continue;
            int p=i^j; bool flag=1; int sum=1;
            for (;p;p-=p&-p){
                int x=p&-p;
                x=lg[x]; int tot=0;
                for (int k=he[x];k;k=ne[k]){
                    if ((1<<e[k]) &j){
                        tot++;
                    }
                }
                if (!tot) {flag=0; break;}
                (sum*=(pw[tot]-1))%=M; 
            }
            if (!flag) continue;
            p=j;
            for (;p;p-=p&-p){
                int x=p&-p;
                x=lg[x]; int tot=0;
                for (int k=he[x];k;k=ne[k])
                    if ((1<<e[k]) &(i^j)) tot++;
                (sum*=pw[tot])%=M;
            }
            (f[i]+=f[i^j]*sum%M)%=M;
        }
    }
    printf("%lld\n",(pw[m]-f[(1<<n)-1]+M)%M);
}

Measured memory_bytes: 2432
#include <iostream>

using namespace std;
int N;
long long int a[100005];
int main() {
    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }
    long long int ans = 0;
    long long int carry = 0;
    for(int i = 0; i < N; i++) {
        if(a[i] == 0) {
            carry = 0;
        } else if(a[i] % 2 == 1) {
            ans += a[i]/2;
            if(carry) {
                carry = 0;
                ans++;
            } else {
                carry = 1;
            }
        } else {
            ans += a[i]/2;
        }
    }
    cout << ans << "\n";
    return 0;
}


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

int main() {
	int a , b , c , d ;
	cin>>a>>b>>c>>d;
	int x = c-a , y = d-b;
	cout<<c-y<<" "<<d+x<<" "<<a-y<<" "<<b+x;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

typedef long long int ll;

ll pow2(ll exp) {
    if(exp == 0) return 1;
    return 2*pow2(exp-1);
}

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

    ll n, m;
    cin >> n >> m;
    ll t;
    t= 1800*m + 100*n;
    cout << t * pow2(m) << endl;
}


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

int main() {
  int t, n;
  while (cin >> t, t) {
    cin >> n;
    int total = 0;
    for (auto i = 0; i < n; ++i) {
      int s, f;
      cin >> s >> f;
      total += (f - s);
    }
    if (total >= t) cout << "OK" << endl;
    else           cout << t - total << endl;
  }
  return 0;
}


Measured memory_bytes: 3060
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
void build(){

}
#define N 101010
int n , a[ N ];
void init(){
  n = getint();
  for( int i = 0 ; i < n ; i ++ )
    a[ i ] = getint();
  sort( a , a + n );
}
void solve(){
  if( a[ n - 1 ] - a[ 0 ] >= 2 ){
    puts( "No" );
    return;
  }
  if( a[ 0 ] == a[ n - 1 ] ){
    if( a[ 0 ] + a[ 0 ] > n and a[ 0 ] + 1 != n )
      puts( "No" );
    else
      puts( "Yes" );
    return;
  }
  int cc = 0;
  for( int i = 0 ; i < n ; i ++ )
    if( a[ i ] < a[ n - 1 ] )
      cc ++;
  if( a[ n - 1 ] + a[ n - 1 ] - cc <= n and cc < a[ n - 1 ] )
    puts( "Yes" );
  else
    puts( "No" );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


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

#define F first
#define S second

using namespace std;
typedef long long ll;

const int max_n = 11, inf = 1000111222;

string a, b;
int n, m;

int main() {
    cin >> n >> m >> a >> b;
    int g = __gcd(n, m);
    int i1 = 0, i2 = 0;
    for (int i = 0; i < g; ++i) {
        if (a[i1] != b[i2]) {
            cout << -1 << endl;
            return 0;
        }
        i1 += n / g;
        i2 += m / g;
    }
    cout << 1LL * n * m / g << endl;
    return 0;
}

Measured memory_bytes: 764
n, q = list(map(int, input().split(" ")))
s = input()
s = s.replace("AC", "ZC")
num = 0
ac_index = []
for _s in s:
    if _s == "Z":
        ac_index.append(num)
        num += 1
    else:
        ac_index.append(num)
i = 0

for _ in range(q):
    l, r = list(map(int, input().split(" ")))
    print(ac_index[r-1] - ac_index[l-1])


Measured memory_bytes: 6296
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
#define vecout(V) for(int i=0;i<V.size();i++) {cout<<V[i]<<endl;}
typedef long long ll;

int main(void){
    string s;
    string t;
    cin>>s>>t;
    map<char, char> mp;
    map<char, char> mp2;
    rep(i, s.size()){
        if(mp.count(s[i])==0){
            mp[s[i]]=t[i];
        }
        else {
            if(mp[s[i]]!=t[i]){
                cout<<"No"<<endl;
                return 0;
            }
        }
        if(mp2.count(t[i])==0){
            mp2[t[i]]=s[i];
        }
        else {
            if(mp2[t[i]]!=s[i]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 776
n, m = map(int, input().split())
arr = [input().split() for _ in range(m)]

dic = {x: [] for x in range(1, n+1)}
for p, s in arr:
    dic[int(p)].append(s)

ac = 0
wa = 0
for k, v in dic.items():
    tmp = 0
    for x in v:
        if x == 'AC':
            ac += 1
            wa += tmp
            break
        else:
            tmp += 1

print(ac, wa)

Measured memory_bytes: 52484
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define pb push_back
#define fi first
#define se second

int main(){
    ll i,j;
    string S;
    cin>>S;
    ll l=S.size();
    ll ans=0;
    ll b=0;
    for(i=0;i<l;i++){
        if(S[i]=='B') b++;
        else ans+=b;
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
  short i, n, a, b;
  long ap, bp;

  scanf("%d", &n);

  while (n) {
    ap = 0;
    bp = 0;
    for (i = 0; i < n; i++) {
      scanf("%hd%hd", &a, &b);
      if (a > b)
        ap += a + b;
      else if (b > a)
        bp += a + b;
      else {
        ap += a;
        bp += b;
      }
    }
    printf("%d %d\n", ap, bp);
    scanf("%d", &n);
  }
  return 0;
}

Measured memory_bytes: 600
import numpy as np
def solve():
    N,M = map(int, input().split())
    LR = np.array([list(map(int, input().split())) for _ in range(M)])
    Lmax = np.max(LR[:,0])
    Rmin = np.min(LR[:,1])
    ans = Rmin - Lmax + 1 if Rmin - Lmax >=0 else 0
    print(ans)





if __name__ == '__main__':
    solve()


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

using namespace std;
typedef long long ll;

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

  vector<ll> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }
  sort(h.begin(), h.end());

  vector<ll> difs(N - K + 1, 0);

  for (int i = 0; i < N - K + 1; i++) {
    difs[i] = h[i + K - 1] - h[i];
  }

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

  cout << difs[0] << endl;
}

Measured memory_bytes: 1792
'use strict'

function Main(input) {
  input = input.trim().split('\n')
  const N = parseInt(input[0])
  let X = input[1].split(' ').map(s => parseInt(s))

  X = X.sort()

  const MAX = 100



  let result = Infinity

  for(let i = 1; i <= MAX; ++i) {
    let total = 0
    for(let j = 0; j < N; ++j) {
      const n = X[j] - i
      total += n * n
    }

    result = Math.min(result, total)
  }

  if( result === Infinity ) result = 1
  console.log(result)


}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main(){
  int h,w,n,t,x,y;
  string tmp,command;
  vector<string> field;

  cin >> t;

  while(t--){
    cin >> h >> w;

    field.clear();
    for(int i=0;i<h;i++){
      cin >> tmp;
      field.push_back(tmp);
    }

    cin >> n;
    cin >> command;

    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(field[i][j] == '^' || field[i][j] == '>' || field[i][j] == 'v' || field[i][j] == '<'){
	  y = i;
	  x = j;
	}
      }
    }

    for(int i=0;i<n;i++){
      if(command[i] == 'S'){
	int tmp = 1;
	if(field[y][x] == '^'){
	  while(y - tmp >= 0){
	    if(field[y-tmp][x] == '*'){
	      field[y-tmp][x] = '.';
	      break;
	    }
	    if(field[y-tmp][x] == '#')break;
	    tmp++;
	  }
	}
	if(field[y][x] == '>'){
	  while(x + tmp < w){
	    if(field[y][x+tmp] == '*'){
	      field[y][x+tmp] = '.';
	      break;
	    }
	    if(field[y][x+tmp] == '#')break;
	    tmp++;
	  }
	}
	if(field[y][x] == 'v'){
	  while(y + tmp < h){
	    if(field[y+tmp][x] == '*'){
	      field[y+tmp][x] = '.';
	      break;
	    }
	    if(field[y+tmp][x] == '#')break;
	    tmp++;
	  }
	}
	if(field[y][x] == '<'){
	  while(x - tmp >= 0){
	    if(field[y][x-tmp] == '*'){
	      field[y][x-tmp] = '.';
	      break;
	    }
	    if(field[y][x-tmp] == '#')break;
	    tmp++;
	  }
	}
      }else{
	field[y][x] = '.';
	if(command[i] == 'U'){
	  if(y > 0 && field[y-1][x] == '.')y--;
	  field[y][x] = '^';
	}
      }
      if(command[i] == 'R'){
	if(x < w-1 && field[y][x+1] == '.')x++;
	field[y][x] = '>';
	}
      if(command[i] == 'D'){
	if(y < h-1 && field[y+1][x] == '.')y++;
	field[y][x] = 'v';
      }
      if(command[i] == 'L'){
	if(x > 0 && field[y][x-1] == '.')x--;
	field[y][x] = '<';
      } 
    }

    for(int i=0;i<h;i++)cout << field[i] << endl;
    if(t)cout << endl;
  }
}

Measured memory_bytes: 0
from fractions import gcd
from functools import reduce

def gcd_list(numbers):
  return reduce(gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
gl=[0]
gr=[0]
for i in range(n):
  gl.append(gcd(a[i], gl[-1]))
  gr.append(gcd(a[n-i-1], gr[-1]))
gr=gr[::-1]
ans = 0
for i in range(n):
  ans = max(ans, gcd(gl[i],gr[i+1]))
  
print(ans)

Measured memory_bytes: 16112
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define srt(x) sort((x).begin(), (x).end());
#define rsrt(x) sort((x).rbegin(), (x).rend());
#define deb(x) cout<<#x<<" = "<<(x)<<" (L"<<LINE<<")"<<endl;
#define vdeb(x) {cout<<#x<<" = { "; rep(i, x.size()) cout<<x[i]<<' '; cout <<'}'<<" (L"<<LINE<<")"<<endl;}
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vivi = vector<vi>;
using vll = vector<long long>;
using vllvll = vector<vll>;
using vs = vector<string>;
using um = unordered_map<long long, long long>;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;

int main()
{
    ll H, W;
    cin >> H >> W;
    vllvll c(10, vll(10));
    rep(i, 0, 10) {
        rep(j, 0, 10) {
            cin >> c[i][j];
        }
    }
    vllvll A(H, vll(W));
    rep(i, 0, H) {
        rep(j, 0, W) {
            cin >> A[i][j];
        }
    }

    rep(k, 0, 10) {
        rep(i, 0, 10) {
            rep(j, 0, 10) {
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }

    ll sm = 0;
    rep(i, 0, H) {
        rep(j, 0, W) {
            if (A[i][j] == -1) continue;
            sm += c[A[i][j]][1];
        }
    }
    cout << sm << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll ans=0;
    for(ll i=3;i<=n;i+=2)
    {
    	ll p=0,s=i;
    	for(ll j=1;j*j<=s;j++)
    	{
    		if(s%j==0)
    		{
    			if(j*j==s)
    				p++;
    			else
    				p+=2;
    		}
    	}	
    	if(p==8)
    		ans++;
    }
    cout<<ans<<"\n";
}


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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        var n = int.Parse(Console.ReadLine());
        int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();

        //l[i]<=l[k]<=l[t]とする
        Array.Sort(l);
        var ans = 0;
        for (int i = 0; i < n; i++)
        {
            for (int k = i + 1; k < n; k++)
            {
                var z1 = l[i] + l[k];
                for (int t = k + 1; t < n; t++)
                {
                    if (l[t] >= z1) break;
                    ans++;
                }
            }
        }

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define forna(i,a,n) for(int i=a;i<n;i++)
typedef long long int lli;
using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);string n,m;

cin>>n>>m;int flag=0;
int l=m.length();int k=n.length();
if(l-1!=k) cout<<"No";
else{
if(n+m[l-1]==m) cout<<"Yes";
else cout<<"No";
}}


Measured memory_bytes: 3640
#include<stdio.h>
int main(){
	int s,a,b;
	scanf("%d", &s);
	a = s / 3600;
	b = (s % 3600) / 60;
	
	printf("%d:%d:%d\n", a, b, s - (a*3600+b*60));

	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <queue>
using namespace std;

int N, M;
int DP[100000][11];
vector<vector<int>>E;
void ColorChange(int v, int d, int  c) {
	if (DP[v][d] == 0)DP[v][d] = c;
	if (d == 0)return;

	for (int i = d - 1; i >= 0;i--) {
		ColorChange(v, i, c);
	}

	for (int i = 0; i < E[v].size(); i++) {
		if (DP[E[v][i]][d - 1] == 0)ColorChange(E[v][i], d - 1, c);
	}
}

int main()
{
	cin >> N >> M;
	E.resize(N);
	for (int i = 0; i < M; i++) {
		int a, b; cin >> a >> b;
		a--; b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	int q; cin >> q;
	vector<tuple<int, int, int>>query;
	for (int i = 0; i < q; i++) {
		int v, d, c; cin >> v >> d >> c;
		v--;
		query.push_back(make_tuple(v, d, c));
	}

	for (int i = q - 1; i >= 0; i--) {
		int v, d, c;
		tie(v, d, c) = query[i];

		ColorChange(v, d, c);
	}

	for (int i = 0; i < N; i++) {
		cout << DP[i][0] << endl;
	}

	return 0;
}

Measured memory_bytes: 14064
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node {
    int key;
    Node *next, *prev;
};

Node *nil;

Node* listSearch(int key){
    Node *cur = nil->next;
    while(cur != nil && cur->key != key){
        cur = cur->next;
    }
    return cur;
}

void init(){
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev=nil;
}

void printList(){
    Node *cur = nil->next;
    int isf = 0;
    while(1){
        if (cur == nil) break;
        if(isf++ > 0)printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(Node *t){
    if(t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void deleteKey(int key){
    deleteNode(listSearch(key));
}


void insert(int key){
    Node *x =(Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

int main(){
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for(i=0; i<n; i++){
        scanf("%s%d", com, &key);
        if( com[0] == 'i' ){insert(key); np++; size++;}
        else if(com[0] == 'd'){
            if(strlen(com)>6){
                if(com[6] == 'F')deleteFirst();
                else if(com[6] == 'L')deleteLast();
            }else{
                deleteKey(key);nd++;
            }
            size--;
        }

    }
    printList();
    return 0;
}


Measured memory_bytes: 33876
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
typedef long long ll;


ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

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

  vector<int> value(n);
  rep(i, n) {
      cin >> value[i];
  }
  vector<int> cost(n);
  rep(i, n) {
      cin >> cost[i];
  }
  
  int maxi = 0;
  rep(i, n) {
      if (value[i]-cost[i] > 0)
      {
          /* code */
          maxi += value[i] - cost[i];
      }
  }
  cout << maxi << endl;
}

Measured memory_bytes: 256
N = int(input())
A = input().split(' ')
A = [int(A[i]) for i in range(N)]
count = 0
while 1:
  for i in range(N):
    if A[i]%2 == 0:
      A[i] /= 2
    else:
      break
  else:
    count += 1
    continue
  break

print(count)

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

int main() {
	int N;
	cin >> N;
	vector<int> v(N);
	rep(i, N) {
		cin >> v.at(i);
	}
	sort(v.begin(), v.end());
	double ans = v.at(0);
	for (int i = 1;i < N;++i) {
		ans = (ans + v.at(i)) / 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int A, B;
  for (int i = 0; i < a; i++) {
    if (i == 0) {
      B = b;
    }
    else {
      B += b * pow(10, i);
    }
  }
  for (int i = 0; i < b; i++) {
    if (i == 0) {
      A = a;
    }
    else {
      A += a * pow(10, i);
    }
  }
  if (a <= b) {
    cout << A << endl;
  }
  else {
    cout << B << endl;
  }
}

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

int main() {
  int N; cin>>N;
  vector<int> vec(N); for(int i=0;i<N;i++) cin>>vec.at(i);
  sort(vec.begin(),vec.end());
  reverse(vec.begin(), vec.end());
  int alice=0, bob=0;
  for(int i=0; 2*i<N; i++) alice+=vec.at(2*i);
  for(int i=0; 2*i+1<N; i++) bob+=vec.at(2*i+1);
  cout << alice-bob << endl;
}


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

int main(){
 int K,X;
 cin >> K >> X;
 vector<int> round(2*K-1);
 for(int i = 0; i < round.size(); i++){
   round.at(i) = X-K+i+1;
   cout << round.at(i) << ' ';
 }
 cout << endl;
 return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(in.readLine());
        Card[] cards = new Card[n];
        for (int i = 0; i < n; i++) {
            String line = in.readLine();
            String[] split = line.split(" ");
            char suit = split[0].charAt(0);
            int value = Integer.parseInt(split[1]);
            cards[i] = new Card(value, suit, i);
        }
        quicksort(cards, 0, n-1);
        if (isStable(cards)) {
            System.out.println("Stable");
        } else {
            System.out.println("Not stable");
        }
        for (Card c : cards) {
            System.out.println(c);
        }
    }

    private static boolean isStable(Card[] cards) {
        for (int i = 0; i < cards.length-1; i++) {
            if (cards[i].equals(cards[i+1]) && cards[i].originalPosition > cards[i+1].originalPosition) {
                return false;
            }
        }
        return true;
    }

    private static void quicksort(Card[] cards, int l, int r) {
        if (l < r) {
            int q = partition(cards, l, r);
            quicksort(cards, l, q-1);
            quicksort(cards, q+1, r);
        }
    }

    private static int partition(Card[] cards, int l, int r) {
        Card x = cards[r];
        int i = l - 1;
        for (int j = l; j < r; j++) {
            if (cards[j].compareTo(x) <= 0) {
                i++;
                Card temp = cards[i];
                cards[i] = cards[j];
                cards[j] = temp;
            }
        }
        cards[r] = cards[i+1];
        cards[i+1] = x;
        return i+1;
    }


}

class Card implements Comparable<Card> {
    private int value;
    private char suit;
    int originalPosition;

    Card(int value, char suit, int originalPosition) {
        this.value = value;
        this.suit = suit;
        this.originalPosition = originalPosition;
    }

    @Override
    public int compareTo(Card o) {
        return Integer.compare(value, o.value);
    }

    @Override
    public String toString() {
        return suit + " " + value;
    }

    @Override
    public boolean equals(Object obj) {
        Card card = (Card) obj;
        return value == card.value;
    }
}



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

int main() {
  int n, m;
  cin >> n >> m;
  if (n >= m) { cout << 0 << endl; return 0; }

  vector<int> x(m);
  rep(i,m) cin >> x[i];
  sort(x.begin(), x.end());

  int res = x[m-1] - x[0];
  vector<int> diff(m-1);
  rep(i,m-1) diff[i] = x[i+1] - x[i];
  sort(diff.rbegin(), diff.rend());
  rep(i,n-1) res -= diff[i];

  cout << res << endl;
  return 0;
}

Measured memory_bytes: 4048
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const long double EPS = 1e-10;

int gcd(int x, int y) {
  if (y > x) swap(x, y);
  if (x % y == 0) return y;
  gcd(y, x % y);
}

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

  cout << gcd(x, y) << endl;

  
  return 0;
}


Measured memory_bytes: 3112
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
const char dir[4] = { 'u','l','d','r' };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

bool iswr[101], iswc[101];
char a[101][101];
int h, w;

int main() {
	cin >> h >> w;
	REP(i, h)REP(j, w)cin >> a[i][j];
	REP(i, h){
		int cnt = 0;
		REP(j, w) {
			if (a[i][j] == '.')cnt++;
		}
		if (cnt == w)iswr[i] = true;
	}
	REP(j, w) {
		int cnt = 0;
		REP(i, h) {
			if (a[i][j] == '.')cnt++;
		}
		if (cnt == h)iswc[j] = true;
	}
	REP(i, h) {
		REP(j, w) {
			if (iswr[i] == true)continue;
			if (iswc[j] == true)continue;
			cout << a[i][j];
		}
		if (iswr[i] == true)continue;
		cout << endl;
	}
}

Measured memory_bytes: 256
R, G, B, n = map(int, input().split())
ans = 0
for r in range(n // R + 1):
    for g in range((n - r) // G + 1):
        if (n - r * R - g * G) % B == 0:
            b = (n - r * R - g * G) / B
            if b >= 0:
                ans += 1
print(ans)

Measured memory_bytes: 41452
#include"bits/stdc++.h"
using namespace std;
int main(){
 int N;
  cin>>N;
  vector<int> S(N);
 for(int i=0; i<N;i++){
  cin>>S.at(i);}
  sort(S.begin(),S.end());
  int X=N;
  for(int i=0;i<N-1;i++){
    if(S.at(i)==S.at(i+1)){
X=X-1;
    }
  }
  cout<<X<<endl;}

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

using namespace std;

vector<int> SIX, NIN;

int lft(int k, int q){
    //cout << "PROCESS : "<< k << ' ' << q << endl;
    if(k == 0) return q;
    int ans = 999999999;
    for(int i = 0; i < SIX.size(); i++){
        if(SIX[i] > k) break;
        if(i == SIX.size()-1){
            ans = min(ans, lft(k-SIX[i], q+1));
        }
        else if (SIX[i+1] > k){
            ans = min(ans, lft(k-SIX[i], q+1));
        }
    }
    for(int i = 0; i < NIN.size(); i++){
        if(NIN[i] > k) break;
        if(i == NIN.size()-1){
            ans = min(ans, lft(k-NIN[i], q+1));
        }
        else if (NIN[i+1] > k){
            ans = min(ans, lft(k-NIN[i], q+1));
        }
    }
    return ans;
}

int main()
{
    int ONE = 1, n; cin >> n;
    int cnt = 0;
    SIX.push_back(1);
    for(int i = 6; i  < 100100;){
        SIX.push_back(i);
        i*=6;
    }
    for(int i = 9; i < 100100;){
        NIN.push_back(i);
        i*=9;
    }
    cout << lft(n, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
import bisect

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

a.sort()
b.sort()
c.sort()

ans = 0
for i in b:
    a_index = bisect.bisect_left(a, i)
    c_index = bisect.bisect_right(c, i)
    ans += (a_index) * (n - c_index)

print(ans)

#73

Measured memory_bytes: 23360
#include <bits/stdc++.h>
#define nmax 100005

using namespace std;
int abss(int x)
{
    if(x<0)
        return -x;
    return x;
}
int main()
{
    int a1,a2,a3,ans1,ans2,ans3,ans4,ans5,ans6;
    cin>>a1>>a2>>a3;
    ans1=abss(a1-a2)+abss(a2-a3);
    ans2=abss(a1-a3)+abss(a3-a2);
    ans3=abss(a2-a1)+abss(a1-a3);
    ans4=abss(a2-a3)+abss(a3-a1);
    ans5=abss(a3-a1)+abss(a1-a2);
    ans6=abss(a3-a2)+abss(a2-a1);
    ans1=min(ans1,ans2);
    ans1=min(ans1,ans3);
    ans1=min(ans1,ans4);
    ans1=min(ans1,ans5);
    ans1=min(ans1,ans6);
    cout<<ans1<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M_PI 3.14159265358979323846
#define MOD 1000000007
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> ipair;
typedef pair<ll, ll> llpair;

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
    
/*
    Author: Koushik Sahu
    Created: 18 Sep 2020 09:52:46
*/

ll a, b, c, d;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    cin>>a>>b>>c>>d;
    cout<<max({a*c, a*d, b*c, b*d})<<"\n";
    return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>

typedef int32_t i32;

typedef struct RMQandRAQSegmentTree{
  i32 *add;
  i32 *val;
  i32 size,bit;
} segTree;

segTree* newRMQandRAQ(const i32 n){
  i32 k=0;
  while((1<<k)<n) k++;
  i32 size=1<<k;
  segTree *s=(segTree *)malloc(sizeof(segTree));
  s->add=(i32 *)calloc(2*size,sizeof(i32));
  s->val=(i32 *)calloc(2*size,sizeof(i32));
  s->size=size;
  s->bit=k;
  return s;
}

i32 getVal(segTree *s,i32 k){
  return s->val[k]+s->add[k];
}

i32 func(i32 a,i32 b){
  return a<b?a:b;
}

void downTree(segTree *s,i32 x){
  x+=s->size;
  for(i32 i=s->bit;i>0;i--){
    i32 k=x>>i;
    s->add[2*k  ]+=s->add[k];
    s->add[2*k+1]+=s->add[k];
    s->val[k]=func(getVal(s,2*k),getVal(s,2*k+1));
    s->add[k]=0;
  }
}

void upTree(segTree *s,i32 x){
  for(x=(x+s->size)>>1;x>0;x>>=1){
    s->val[x]=func(getVal(s,2*x),getVal(s,2*x+1));
  }
}

void add(segTree *s,i32 l,i32 r,i32 v){
  downTree(s,l);
  downTree(s,r-1);
  for(i32 x=l+s->size,y=r+s->size;x<y;x>>=1,y>>=1){
    if(x&1) s->add[x++]+=v;
    if(y&1) s->add[--y]+=v;
  }
  upTree(s,l);
  upTree(s,r-1);
}

int find(segTree *s,int l,int r){
  downTree(s,l);
  downTree(s,r-1);
  i32 index[32];
  i32 len=0;
  for(l+=s->size,r+=s->size;l<r;l>>=1,r>>=1){
    if(l&1) index[len++]=l++;
    if(r&1) index[len++]=--r;
  }
  i32 res=getVal(s,index[--len]);
  while(len>0) res=func(res,getVal(s,index[--len]));
  return res;
}

void run(void){
  int n,q;
  scanf("%d%d",&n,&q);
  segTree *s=newRMQandRAQ(n);
  while(q--){
    int t,l,r;
    scanf("%d%d%d",&t,&l,&r);
    if(t==0){
      int v;
      scanf("%d",&v);
      add(s,l,r+1,v);
    } else {
      printf("%d\n",find(s,l,r+1));
    }
  }
}

int main(void){
  run();
  return 0;
}



Measured memory_bytes: 3000
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;

int n;

void solve()
{
    cin>>n;
    int ans[10050];
    memset(ans,0,sizeof(ans));
    for(int i=1;i<=105;i++)
    {
        for(int j=1;j<=105;j++)
        {
            for(int k=1;k<=105;k++)
            {
                int res=i*i+j*j+k*k+i*j+j*k+k*i;
                if(res<10050)
                    ans[res]+=1;
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        cout<<ans[i]<<endl;
    }

}

int main()
{
    solve();
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
#define endl "\n"
#define inf (int) (1e9 + 7)
#define epsi 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define read(type) readInt<type>()
#define io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define left tuyiuoi
#define right fgjhk
#define ss second
#define ff first
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) rep(i, l, r) cout << a[i] << " "; cout << endl
#define Flag(n) cout << "here " << n << endl
const double pi=acos(-1.0);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<ll, ll> pll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
 
int main() {
    io;
    ll h,w;
    cin>>h>>w;
    string arr[h];
    ll dp[h][w];
    rep(i,0,h)cin>>arr[i];
    mem(dp,0);
    rep(i,0,w){
        if(arr[0][i]=='#'){
            break;
        }
        else dp[0][i]=1;
    }

    rep(i,1,h){
        rep(j,0,w){
        if(j == 0){
            if(arr[i][j]=='#')
            dp[i][j]=0;
            else{
                dp[i][j]=dp[i-1][j];
            }
        }
        else if(arr[i][j] == '#') {
            dp[i][j]=0;
        }
        else{
            dp[i][j]=((dp[i-1][j]%mod)+(dp[i][j-1]%mod))%mod;
        }

        }
    }

    // rep(i,0,h){
    //     rep(j,0,w)cout<<dp[i][j]<<"\t";
    //     cout<<endl;
    // }
    cout<<dp[h-1][w-1];

    
  

 
 
 
    
 
    return 0;
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

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

    cout<<180*(n-2)<<endl;
}


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

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll solve(ll N)
{
    if (N % 2)
        return 0;

    N /= 2;

    ll ans = 0, base = 5;;

    while (N / base)
    {
        ans += (N / base);
        base *= 5;
    }
 
    return ans;
}

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

    ll N;
    cin >> N;

    auto ans = solve(N);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
/**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define set_vect(a,n); vector<int>a(n); for(auto &z : a)cin>>z;

string s,x;
void solve(){
    cin >> s >> x;
    for(int i = 0 ; i < s.length() ; i++)
        if(s[i] != x[i]){
            cout << "No";
            return;
        }
    cout << "Yes";
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    
    int t = 1; //cin >> t;
    while(t--){solve();}
    return 0;
}

// Code By CodeWar :3 (Bao Trung)

Measured memory_bytes: 3600