akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split();

        var sorted = a.OrderBy(x => x[1]).ToArray();

        Console.WriteLine(string.Join(" ", sorted));
        Console.WriteLine("Stable");

        {
            for (int i = 0; i < n; i++)
            {
                var min = a.Skip(i).Min(x => x[1]);
                if (a[i][1] != min)
                {
                    var ind = i + a.Skip(i).TakeWhile(x => x[1] != min).Count();
                    var tmp = a[i];
                    a[i] = a[ind];
                    a[ind] = tmp;
                }
            }

            Console.WriteLine(string.Join(" ", a));
            Console.WriteLine(a.SequenceEqual(sorted) ? "Stable" : "Not stable");
        }
    }
}


Measured memory_bytes: 18436
#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    int A,B,C;
    cin >> A >> B >> C;
    int cnt=0;
    while(A!=B || B!=C){
        //C<B<Aの順にする
        if(A<B) swap(A,B);
        if(B<C) swap(B,C);
        if(A<B) swap(A,B);
        if(A!=B && B!=C){
            int tmp=A-B;
            cnt+=tmp;
            B+=tmp;
            C+=tmp;
        }else if(A==B){
            int tmp=A-C;
            if(tmp%2) ++tmp;
            cnt+=tmp/2;
            C+=tmp;
        }else if(B==C){
            int tmp=A-B;
            cnt+=tmp;
            B+=tmp;
            C+=tmp;
        }
        //cout << A << " " << B <<" " << C << endl;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define ll long long
#define fir first
#define sz(a) int((a).size())
int f[300005] ;

int find_set(int x)
{
    if(x!=f[x])
		return f[x]=find_set(f[x]) ;
	return x ;

}

map<int,bool> mp;

int main()
{
    int a,b;
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        f[i]=i;
    for(int i = 1 ; i <= m ; ++i)
    {
        cin>>a>>b;
        f[find_set(a)]=find_set(b) ;
    }
    int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(!mp[find_set(i)])
		{
			ans++;
			mp[find_set(i)]=true;
		}
	}
	cout<<ans-1<<endl;
    return 0 ;
}


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

// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(double, t, x);
	printf("%f\n", t/x);
	
  return 0;
}


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

using namespace std;

int main() {
	int i;
	int A, B;
	int A_pre;//A保存
	int count = 0;
	int kazu = 0;//現在の数
	cin >> A >> B;
	A_pre = A;

	while (1) {
		if (B == 1) {
			break;
		}
		++count;
		if (count == 1)
		{
			kazu += A;
			if (B <= kazu) {
				break;
			}
		}
		else {
			kazu += A;
			--kazu;
			if (B <=  kazu) {
				break;
			}
		}
	}

	cout << count << endl;



}


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

using namespace std;

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

  int l, r, d;
  cin >> l >> r >> d;
  int ans = 0;
  for (int i = l; i <= r; ++i) {
    if (i % d == 0) {
      ++ans;
    }
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 3648
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

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

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

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

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  int64_t res = numeric_limits<int64_t>::max();
  for (int t = 0; t < 2; ++t) {
    int64_t r = 0;
    int s = 0;
    for (int i = 0; i < n; ++i) {
      s += a[i];
      if (t != i % 2) s *= -1;
      if (s <= 0) {
        r += 1 - s;
        s = 1;
      }
      if (t != i % 2) s *= -1;
    }
    chmin(res, r);
  }
  cout << res << endl;
}



Measured memory_bytes: 640
#!/usr/bin/env python3
import sys
from math import ceil, floor

def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    
    x = []
    y = []  

    for i in range(ceil(F/(100*A))+1):
        for j in range(ceil(F/(100*B))+1):
            dx = 100*A*i+100*B*j
            if(min(100*A,100*B) <= dx <= F):
                x.append(dx)

    for i in range(ceil(F/C)+1):
        for j in range(ceil(F/C)+1):
            dy = C*i+D*j
            if(0 <= dy <= F):
                y.append(dy)

    x = sorted(list(set(x)))
    y = sorted(list(set(y)))
    
    w = x[0]
    s = y[0]

    for i in x:
        for j in y:
            de = 100*s/(w+s)
            ne = 100*j/(i+j)
            if(i+j <= F and de < ne <= 100*E/(100+E)):
                # print(i, j, ne)
                w = i
                s = j

    print(w+s, s)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12464
#include <stdio.h>

int main(void){
  int a, b, i;
  char a_by_b[9+1], b_by_a[9+1];
  scanf("%d %d", &a, &b);
  
  for(i=0; i<b; i++){
    sprintf(&a_by_b[i], "%d", a);
  }
  sprintf(&a_by_b[i+1], "%c", '\0');

  for(i=0; i<a; i++){
    sprintf(&b_by_a[i], "%d", b);
  }
  sprintf(&b_by_a[i+1], "%c", '\0');

  i=0;
  while(1){
      if(a_by_b[i] == '\0' || b_by_a[i] == '\0'){
          printf("%s", a_by_b);
          break;
      }
    //   printf("a_by_b[%d]=%c", i, a_by_b[i]);
    if(a_by_b[i] < b_by_a[i]){
        printf("%s", a_by_b);
        break;
    }else{
        printf("%s", b_by_a);
        break;
    }
      i++;
  }
  
  return 0;
}

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


int main() {
    int s;
    cin >> s;
    int h,m;
    h = (s - (s % 3600)) / 3600;
    m = (s - (h*3600) - (s % 60)) / 60;
    s = s % 60;
    cout << h << ":" << m << ":" << s <<endl;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
ll isok(ll x,ll y){
	f=0;
	while(x>0){
		f+=x/2;
		x=x/2;
	}
	while(y>0){
		f+=y/2;
		y=y/2;
	}
	
	return f;
	
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    string s;
    cin>>s;

    k=isok(n-1,0);
    
    
    
    //cout<<a<<" "<<b<<" "<<c<<endl; 

    t=0;
    rep(i,n){
    	if(isok(i,n-1-i)==k)t+=s[i]-'0';
    }

    if(t%2==1)cout<<1<<endl;
    else{
        vl B;
        rep(i,n-1){
            B.push_back(abs(s[i]-s[i+1]));
        }

        vl C;

        rep(i,n-1){
            if(B[i]==1){
                cout<<0<<endl;
                return 0;
            }
            else{
                C.push_back(B[i]/2);
            }
        }
       

    k=isok(n-2,0);
    rep(i,n-1){
    	if(isok(i,n-2-i)==k)t+=C[i];
    }
    

    if(t%2==1)cout<<2<<endl;
    else cout<<0<<endl;


    }
    

}


Measured memory_bytes: 23440
// AtCode ABC 122 A
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	b := read()
	switch b {
	case "A":
		fmt.Println("T")
	case "T":
		fmt.Println("A")
	case "C":
		fmt.Println("G")
	case "G":
		fmt.Println("C")
	}
}

func read() string {
	sc.Scan()
	return sc.Text()
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <stdio.h>
#define ll long long
#define fr(i,p,n) for(ll i=p;i<n;i++)
#define fr1(i,p,n) for(ll i=p;i>=n;i--)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD1 998244353
#define precise cout << std::setprecision(10) << std::fixed;
using namespace std;

ll fact[2000005],ifact[2000005];
ll binpow(ll a, ll b, ll m)
{
    a %= m;
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll invMod(ll n,ll m)
{
    return binpow(n,m-2,m);
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll k;
        cin>>k;
        string s;
        cin>>s;
        ll n=(ll)s.size();
        fact[0]=fact[1]=1;
        fr(i,2,n+k+1) fact[i]=fact[i-1]*i%MOD;
        ifact[n+k]=invMod(fact[n+k],MOD);
        fr1(i,n+k-1,0) ifact[i]=ifact[i+1]*(i+1)%MOD;
        ll ans=0;
        fr(i,0,k+1)
        {
            ans=(ans+(fact[n+i-1]*ifact[n-1]%MOD*ifact[i]%MOD)*binpow(25ll,i,MOD)%MOD*binpow(26ll,k-i,MOD)%MOD)%MOD;
        }
        cout<<ans<<endl;
    }
    return 0;
}


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

#define int long long



signed main() {
    
    string s;
    cin >> s;
    
    int ans=0;
    for(int i=0; i<3; i++){
        if(s[i]=='1') ans++;
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

bool is_prime(int n) {
    bool isPrime = true;
    for (int i = 2; i < sqrt(n); ++i) {
        if (n % i == 0) {
            isPrime = false;
        }
    }

    return isPrime;
}

int next_prime(int n) {
    int p = n;
    while (! is_prime(p)) {
        ++p;
    }

    return p;
}

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

    cout << next_prime(n) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
long long gcd(long long a,long long b){
    if(a<b){
        long long tmp=a;
        a=b;
        b=tmp;
    }
    long long r=a%b;
    while(r>0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int main()
{   
    long long a,b;
    scanf("%lld%lld",&a,&b);
    long long  max=gcd(a,b);
    long long ans=1;
    for(long long i=2;i*i<=max;i++){
        if(max%i==0){
            ans++;
            while(max%i==0){
                max/=i;
            }
        }
    }
    if(max>1)ans++;
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int h,w,lt,res;
vvi a,used,c;
vi b;

void DFS(int i,int j,int col){
	used[i][j]=1;
	for(int k=0;k<4;k++){
		int x=i+dx[k],y=j+dy[k];
		if(x>=0&&x<h&&y>=0&&y<w&&!used[x][y]&&c[x][y]==col) DFS(x,y,col);
	}
}

void dfs(int I){
	if(I==5){
		if(b.back()!=lt) return;
		c=a;
		for(int i=0;i<5;i++){
			used=vvi(h,vi(w));
			DFS(0,0,c[0][0]);
			for(int j=0;j<h;j++) for(int k=0;k<w;k++) if(used[j][k]) c[j][k]=b[i];
		}
		used=vvi(h,vi(w));
		DFS(0,0,c[0][0]);
		int tmp=0;
		for(int i=0;i<h;i++) for(int j=0;j<w;j++) tmp+=used[i][j];
		res=max(res,tmp);
		return;
	}
	for(int i=1;i<=6;i++){
		b.push_back(i);
		dfs(I+1);
		b.pop_back();
	}
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	while(1){
		cin>>h>>w>>lt;
		if(h==0) break;
		a=vvi(h,vi(w));
		for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin>>a[i][j];
		res=0;
		dfs(0);
		cout<<res<<endl;
	}
}


Measured memory_bytes: 3068
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

int main() {
	string s;
	cin >> s;
	string a = "dream", b = "dreamer", c = "erase"
		, d = "eraser";
	bool flag = true;
	while (s.size() > 0) {
		int tmp = s.size();
		if (s.size() > 6) {
			if (s.substr(s.size() - 7, 7) == b) {
				s.erase(s.size() - 7, 7);
			}
		}
		if (s.size() > 5) {
			if (s.substr(s.size() - 6, 6) == d) {
				s.erase(s.size() - 6, 6);
			}
		}
		if (s.size() > 4) {
			if (s.substr(s.size()-5, 5) == a 
				or s.substr(s.size()-5, 5) == c) {
				s.erase(s.size()-5, 5);
			}
		}
		
		
		if (s.size() == tmp) {
			flag = false;
			break;
		}
		//cout << s << endl;
	}
	if (flag) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 512
#![allow(non_snake_case)]

fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let (X, A) = {
        let v: Vec<i32> = read_line().split_whitespace().map(|a| a.parse().unwrap()).collect();
        (v[0], v[1])
    };
    if X < A {println!("0");}
    else {println!("10");}
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<=(b);++i)
#define ROF(i,a,b) for (int i=(a);i>=(b);--i)
typedef long long ll;
inline int read() {
	int x=0,s=1; char ch=getchar();
	while (ch<'0'||ch>'9') { if (ch=='-') s=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return s*x;
}

const int MAXN=200005,Mo=1000000007;
struct Data{ int x,y,i; }A[MAXN];
vector<pair<int,pair<int,int> > >Q;
int n,m,q,a[MAXN],b[MAXN],c[MAXN],f[MAXN];
int cmp1(Data i,Data j){ return i.x<j.x; }
int cmp2(Data i,Data j){ return i.y<j.y; }
int ask(int x){ if (f[x]==x) return x; return f[x]=ask(f[x]); }
int main(){
	n=read();
	FOR(i,1,n) A[i].x=read(),A[i].y=read(),A[i].i=i;
	sort(A+1,A+1+n,cmp1);
	FOR(i,1,n-1) {
		int x=A[i].i,y=A[i+1].i,z=min(abs(A[i].x-A[i+1].x),abs(A[i].y-A[i+1].y));
		//printf("%d---%d %d\n",x,y,z);
		Q.push_back(make_pair(z,make_pair(x,y)));
	}
	sort(A+1,A+1+n,cmp2);
	FOR(i,1,n-1) {
		int x=A[i].i,y=A[i+1].i,z=min(abs(A[i].x-A[i+1].x),abs(A[i].y-A[i+1].y));
		//printf("%d---%d %d\n",x,y,z);
		Q.push_back(make_pair(z,make_pair(x,y)));
	}
	sort(Q.begin(),Q.end());
	FOR(i,1,n) f[i]=i;
	int size=Q.size();
	ll ans=0;
	FOR(i,0,size-1) {
		pair<int,pair<int,int> > l=Q[i];
		int z=l.first,x=l.second.first,y=l.second.second;
		int X=ask(x),Y=ask(y);
		if (X!=Y) f[X]=Y,ans+=z;
	}
	printf("%lld\n",ans);
	
	return 0;
}

/*
3
1 5
3 9
7 8

*/


Measured memory_bytes: 7156
#include <bits/stdc++.h>
#include <fstream>
#include <stdlib.h>
#include <ctime>
typedef long long ll;
typedef long double ld;

using namespace std;
int inf=1e9;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(100);
  //  freopen("input.txt","r",stdin);
    int n;
    cin>>n;
    int wrong=0;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        if(x!=i+1){
            wrong++;
        }
    }
    if(wrong<=2){
        cout<<"YES";
    }
    else{
        cout<<"NO";
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int Maxn=110;
const int inf=0x3f3f3f3f;
int n,ans;
int a[Maxn],b[3];
inline int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0' && ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
int main()
{
	n=read();
	for(int i=1;i<=n;++i)
	a[i]=read();
	for(int i=1;i<=n;++i)
	for(int j=i+1;j<=n;++j)
	for(int k=j+1;k<=n;++k)
	{
		b[1]=a[i],b[2]=a[j],b[3]=a[k];
		sort(b+1,b+1+3);
		if(b[1]+b[2]>b[3] && b[1]!=b[2] && b[2]!=b[3])
		++ans;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    double D,T,S;
    cin >> D >> T >> S;
    double A = D/S;
    if(A <= T){
        cout <<"Yes" << endl;
    }else{
        cout <<"No" << endl;
    }
}

Measured memory_bytes: 3720
//for(int i=0;i<n;i++)cin>>arr[i];
//for(int i=0;i<n;i++)cout<<arr[i]<<" ";

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main()
{
  long long int n,k;
  cin>>n>>k;
  long int temp=n%k;
  long int temp2=k-temp;
  //cout<<temp<<endl;
    if(temp!=0)
  {
      cout<<std::min(temp,temp2);
      
  }
  else if(temp==0)cout<<"0";
  
  return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
x = list(map(int,input().split()))
t_3 = max(x) - min(x)
t = []
t_2 = 0
x.sort()
if m == 1:
    print(0)
    exit()

for i in range(m-1):
    t.append(x[i+1]-x[i])

t.sort(reverse=True)
pp = min(n-1,m-1)
for i in range(pp):
    t_2 += t[i]

print(t_3-t_2)


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

string s;

int main() {
	cin >> s; int now = 0;
	if(s[0] == 'S') {
		if(s[1] == 'U') now = 0;
		else now = 6;
	}
	if(s[0] == 'M') now = 1;
	if(s[0] == 'T') {
		if(s[1] == 'U') now = 2;
		else now = 4;
	}
	if(s[0] == 'W') now = 3;
	if(s[0] == 'F') now = 5;
	printf("%d\n", 7 - now);
} 

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <algorithm>
using namespace std;
#define rep(i, n)for(int i=1; i<=n; i++)

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

  long long sum = 0;
  int gcd_;
  rep(a, K){
    rep(b, K){
      rep(c, K){
	gcd_ = __gcd(a, b);
	gcd_ = __gcd(gcd_, c);
	sum += gcd_;
      }
    }
  }

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


Measured memory_bytes: 3672
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  string s;
  cin >> s;

  int len = s.size(), ans = len;

  rep(i,len-1) {
    if (s[i] != s[i+1]) {
      ans = min(max(i+1, len - (i+1)), ans);
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		a[3] = sc.nextInt();
		a[4] = sc.nextInt();
		int b = 0;
		for(int i=0; i<5; i++) {
			if(a[i]==0) {
				b = i+1;
			}
		}
		sc.close();
		System.out.println(b);
	}

}

Measured memory_bytes: 35536
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n = k() - 1
i = 1
s = 26

while n >= s:
    n -= s
    s *= 26
    i += 1

lst = []
for j in range(i):
    lst.append(n % 26)
    n //= 26

for j in lst[::-1]:
    print(chr(j + ord('a')), end='')


Measured memory_bytes: 10392
import sys

input = sys.stdin.buffer.readline

n, m = map(int, input().split())


class UnionFind:
    # あり本実装
    # rankとrootの配列を1つで賄う方法
    def __init__(self, n):
        self.n = n
        self.par = [-1] * n

    # 根を求める
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 同じかどうかの判定
    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    # 集合の大きさ
    def size(self, x):
        return -self.find(x)

    # 　2つの集合の合体
    # 重みが大きい方に小さい方をつけるようにする
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False

        if self.par[x] > self.par[y]:
            x, y = y, x
        self.par[x] += self.par[y]
        self.par[y] = x
        return True


UF = UnionFind(n)

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    UF.unite(a, b)

cnt = 0
for i in range(n):
    if UF.find(i) == i:
        cnt += 1

print(cnt - 1)


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

using namespace std;
#define f first
#define s second
#define pb push_back
typedef long long ll;
vector<int> V;

int A, B, C;
ll DFS(int curr, int a, int b, int c)
{
	if (curr == V.size())
	{
		if(a>0 && b>0 && c>0)
		return abs(a - A) + abs(b - B) + abs(c - C) - 30;
		else return 1e16;
	}
	ll temp = DFS(curr + 1, a, b, c);
	temp = min(temp, DFS(curr + 1, a + V[curr], b, c) + 10);
	temp = min(temp, DFS(curr + 1, a, b + V[curr], c) + 10);
	temp = min(temp, DFS(curr + 1, a, b, c + V[curr]) + 10);
	return temp;
}

void solve()
{
	int n;
	cin >> n >> A >> B >> C;
	V.resize(n);
	for (int i = 0; i < n; ++i)
		cin >> V[i];
	cout << DFS(0, 0, 0, 0);
}

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


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

int main(){
	int n, k, x, tot = 0;
	cin >> n >> k;

	for( int i = 0; i < n; ++i ){
		cin >> x;
		tot += 2*min(k-x, x);
	}
	cout << tot << endl;
	return 0;
}

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

int dis[9] = {1,0,-1,0,1,1,-1,-1,1};

int main(void){
    
    int h,w;
    cin >> h >> w;
    
    int arr[60][60] = {};
    
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            char c;
            cin >> c;
            if(c == '#')
                arr[i][j] = -1;
        }
    }
    
    
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(arr[i][j] == -1){
                
                for(int k = 0; k < 8; k++){
                    if(arr[i+dis[k]][j+dis[k+1]] != -1)
                        arr[i+dis[k]][j+dis[k+1]]++;
                }
                
            }
        }
    }
    
    
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(arr[i][j] == -1)
                cout << '#';
            else
                cout << arr[i][j];
        }
        cout << endl;
    }
    
    
}


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

bool b[26];

int main(){
	string s;
	cin >> s;
	for(int i=0; i<s.size(); i++){
		b[s[i]-'a'] = true;
	}
	for(int i=0; i<26; i++){
		if(b[i] == false) {
			char c = 'a' + i;
			cout << c;
			return 0;
		}
	}
	cout << "None";
}



Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
using namespace std;
#define vel vector<long long>
#define vvel vector<vel>
#define int long long
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
long long p = 998244353;
vel kai(4001, 1);
vel ink(4001, 1);
vel uni(vel &list) {
	if (list.size() == 0) { return list; }
	sort(list.begin(), list.end());
	vel ql(1, list[0]);
	rep(i, list.size() - 1) {
		if (list[i] != list[i + 1]) { ql.push_back(list[i + 1]); }
	}
	return ql;
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, 4000) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, 4001) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
signed main() {
	int n; cin >> n;
	bool fl0 = (n < 1300) and (n>=100);
	bool fl1 = (n % 100 <= 12) and (n % 100 > 0);
	if (fl0) {
		if (fl1) {
			cout << "AMBIGUOUS" << endl;
		}
		else {
			cout << "MMYY" << endl;
		}
	}
	else {
		if (fl1) { cout << "YYMM" << endl; }
		else { cout << "NA" << endl; }
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    int a ,b , c ;
    cin >> a >> b >> c ;
    int sum ;
    sum = a+ b + c ;

    if(sum>21){
        cout << "bust" << endl;

    }else{
        cout << "win" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long maximum;
long long mod = 1000000007;
const int INF = 1001001001;
vector<vector<int>> dp;

int main(){
  string a ="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
  int n;
  cin>> n;
  string s;
  cin >> s;
  for(int i=0;i<s.size();i++){
    for(int j=0;j<26;j++){
      if(s.at(i) == a.at(j)){
        s.at(i) = a.at(j+n);
        break;
      }
    }
  }
  cout << s << endl;
}


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

int main(){
	string w;
	std::cin >> w;
	int le=w.size();
	std::vector<int> a(26,0);
	for (int i = 0; i < le; i++) {
		/* code */
		a[w[i]-97]++;
		
	}
	bool han=true;
	rep(i,26){
		if(a[i]%2==1)han=false;
	}
	if(han)std::cout << "Yes" << std::endl;
	else std::cout << "No" << std::endl;
}
	

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

N, M = map(int, input().split())
A = [0] * M
dp = [-1] * (N+1)

for i in range(M):
    a = int(input())
    dp[a] = 0

dp[0] = 1
if dp[1] != 0:
    dp[1] = 1

for i in range(2, N+1):
    if dp[i] != 0:
        dp[i] = dp[i-1] + dp[i-2]

print(dp[N] % 1000000007)

Measured memory_bytes: 460020
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int n;
	while(cin>>n,n){
		int in[15][15]={0};
		int x=n/2+1;
		int y=n/2;
		in[x][y]=1;
		loop(i,2,n*n+1){
			x++;y++;
			if(y==n)y=0;
			if(x==n)x=0;
			if(y==-1)y=n-1;
			if(in[x][y]!=0){
				i--;y-=2;
			}else in[x][y]=i;
		}
		rep(i,n){
			rep(j,n)printf("%4d",in[i][j]);
			puts("");
		}
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, K; cin >> N >> K;
    bools f(N, false);
    REP(i, K){
        int d; cin >> d;
        REP(j, d){
            int a; cin >> a;
            f[a - 1] = true;
        }
    }
    int ans = 0;
    REP(i, N) if(!f[i]) ans++;
    Out(ans);

    return 0;
}


Measured memory_bytes: 3652
//{{{
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define sz(x) (int)((x).size())
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
// clang-format off
void _print() { cerr << "]\033[0m\n"; }
template <typename T> void __print(T x) { cerr << x; }
template <typename T, typename... V> void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#ifdef LOCAL
#define debug(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m["; _print(x)
#define debug_arr(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m" << (x) << "\033[0m\n"
#else
#define debug(x...)
#define debug_arr(x...)
#endif
// clang-format on
//}}}

const int N = 2e5 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;

int T;
LL a, b, c, d;

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    while (cin >> a >> b >> c >> d)
    {
        LL v = a * c;
        v = max(v, a * d);
        v = max(v, b * c);
        v = max(v, b * d);
        cout << v << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cmath>

using namespace std;

const int INF = 1e9;

int main() {
  ios::sync_with_stdio(false);
  int d, g;
  cin >> d >> g;
  int p[d], c[d];
  for (int i=0; i<d; i++) {
    int pi, ci;
    cin >> pi >> ci;
    p[i] = pi;
    c[i] = ci;
  }
  int ans = INF;
  for (int i=0; i<(1<<d); i++) {
    int tmp_score = 0;
    int num_problem = 0;
    int max_unsolved = 0;
    for (int j=0; j<d; j++) {
      if ((i>> j) & 1) {
        tmp_score += 100 * (j+1) * p[j] + c[j];
        num_problem += p[j];
      } else {
        max_unsolved = j;
      }
    }
    if (tmp_score >= g) {
      ans = min(ans, num_problem);
      continue;
    }
    int s = 100 * (max_unsolved + 1);
    int need = (g - tmp_score - 1) / s + 1;
    if (need >= p[max_unsolved]) {
      continue;
    }
    ans = min(ans, num_problem + need);
  }
  cout << ans;

}

Measured memory_bytes: 888
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    final int K, X;

    AtCoder(FastScanner sc) {
        K = sc.nextInt();
        X = sc.nextInt();
    }

    void solve(PrintWriter out) {
        out.println(K * 500 >= X ? "Yes" : "No");
    }

}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

int main() {
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if(((c+b-1)/b)<=((a+d-1)/d))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;

int main() {
  while(true) {
    string x;
    int sum = 0;
    cin >> x;
    rep(i,sz(x)) {
      int a = x[i] - '0';
      sum += a;
    }
    if(sum == 0) break;
    cout << sum << endl;
  }
  return 0;
}


Measured memory_bytes: 3216
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define ll_INF 	9223372036854775807
#define MOD 100000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
using namespace std;

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {
	vector<int> vec(4);
	for (int i = 0; i < 4; i++) {
		char c; cin >> c;
		vec[i] = ctoi(c);
	}

	for (int i = 0; i < (1 << 3); i++) {
		bitset<3> b(i);
		int temp = vec[0];
		string s = "";
		for (int j = 0; j < 3; j++) {
			if (b[j]) {
				temp += vec[j + 1];
				s += "+";
			}
			else {
				temp -= vec[j + 1];
				s += "-";
			}
		}
		if (temp == 7) {
			cout << vec[0];
			for (int j = 0; j < 3; j++) {
				cout << s[j] << vec[j + 1];
			}
			cout << "=7" << endl;
			break;
		}
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define BUF_SIZE 30

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

struct list {
    int dst;
    struct list *next;
};

struct counts {
    uint64_t blacks;
    uint64_t whites;
};

#define VERTEXES_MAX 100000
#define DIVISOR 1000000007
struct counts add_counts(struct counts c1, struct counts c2) {
    return (struct counts){
        // blacks should not be adjacent.
        (c1.blacks * c2.whites)%DIVISOR,
        (c1.whites * (c2.whites+c2.blacks))%DIVISOR,
    };
}

struct counts dfs(struct list *graph, int this, int parent) {
    struct list *head = &graph[this];
    struct list *elem;
    struct counts c = {1, 1};
    for(elem = head->next; elem != head; elem = elem->next) {
        int dst = elem->dst;
        if(dst == parent) continue;
        struct counts child = dfs(graph, dst, this);
        c = add_counts(c, child);
    }
#ifdef DEBUG
    printf("[%d] write: %llu black: %llu\n",this, c.whites, c.blacks);
#endif
    return c;
}

struct list *create_graph(int vs) {
    static struct list graph[VERTEXES_MAX];
    int i;
    for(i = 0; i < vs; i++) {
        graph[i].next = &graph[i];
    }
    return graph;
}

void add_list(struct list *head, int v) {
    struct list *elem = malloc(sizeof(struct list));
    elem->dst = v;
    elem->next = head->next;
    head->next = elem;
}

int main(void) {
    int vs = get_int();
    struct list *graph = create_graph(vs);
    int es = vs-1;
    int i;
    for(i = 0; i < es; i++) {
        int v1, v2;
        get_int2(&v1, &v2);;
        v1--; v2--;
        add_list(&graph[v1], v2);
        add_list(&graph[v2], v1);
    }
    struct counts res = dfs(graph, 0, -1);
    uint64_t ans = (res.whites + res.blacks)%DIVISOR;
    printf("%d\n", (int)ans);
    return 0;
}

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

int main(void){

    int64_t n;
    int64_t k;
    cin >> n >> k;

    int64_t ans0;
    int64_t ans1;
    int64_t div;
    int64_t i;

    div = n/k;

    ans0 = n - k*div;
    ans1 = abs(n - k*(div+1));

    cout << min(ans0, ans1) << endl;

    return 0;
}

Measured memory_bytes: 256
gets.to_i.times do
    xa, ya, ra, xb, yb, rb = gets.chomp.split(' ').map(&:to_f)

    if (ra + rb)**2 < (xb-xa)**2 + (yb-ya)**2
        puts 0
    elsif rb > ra && (rb - ra)**2 > (xb-xa)**2 + (yb-ya)**2
        puts -2
    elsif rb < ra && (ra - rb)**2 > (xb-xa)**2 + (yb-ya)**2
        puts 2
    else
        puts 1
    end
end

Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int h, w, k;
    cin >> h >> w >> k;
    vs cake(h);
    vb empty(h, false);
    vvi ans(h, vi(w, 0));
    int now = 1;
    rep(i, h) {
        cin >> cake[i];
        if (cake[i].find('#') == string::npos) empty[i] = true;
        else {
            int cnt = count(cake[i].cbegin(), cake[i].cend(), '#');
            rep(j, w) {
                if (cake[i][j] == '#') {
                    if (cnt == 1) {
                        ans[i][j] = now;
                    } else {
                        cnt--;
                        ans[i][j] = now++;
                    }
                } else {
                    ans[i][j] = now;
                }
            }
            now++;
        }
    }
    rep(i, h-1) {
        if (!empty[i] && empty[i+1]) {
            ans[i+1] = ans[i];
            empty[i+1] = false;
        }
    }
    for (int i = h-1; i >= 1; --i) {
        if (!empty[i] && empty[i-1]) {
            ans[i-1] = ans[i];
            empty[i-1] = false;
        }
    }
    rep(i, h) {
        rep(j, w) {
            if (j != 0) cout << " ";
            cout << ans[i][j];
        }
        cout << endl;
    }

    
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long LL;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

int main(){
    string s, t;
    cin >> s;
    cin >> t;

    vector<char> s_char((int)s.size());
    vector<char> t_char((int)t.size());

    REP(i,(int)s.size()){
        s_char[i]=s[i];
    }

    REP(i,(int)t.size()){
        t_char[i]=t[i];
    }

    sort(s_char.begin(), s_char.end());
    sort(t_char.begin(), t_char.end(), greater<char>());

    string s_next = "";
    string t_next = "";

    REP(i,(int)s.size()){
        s_next += s_char[i];
    }

    REP(i,(int)t.size()){
        t_next += t_char[i];
    }

    if(s_next < t_next){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;

}

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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 200001

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

int main() {
    fast;
    string s;
    cin >> s;
    ll p = 1;
    REP(i, 1, s.size()) {
        if (s[i] == s[i-1]) {
            p = 0;
            break;
        }
    }
    if (p)
        cout << "Good\n";
    else
        cout << "Bad\n";
    return 0;
}


Measured memory_bytes: 256