akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>


#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define ll long long
#define el '\n'

using namespace std;

int n;
pii ar[100];

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

    cin >> n;
//    map <pii,bool> cek;
    map <pii,int> del;
    for (int i=0;i<n;i++){
        cin >> ar[i].fi >> ar[i].se;
 //       cek[mp(ar[i].fi,ar[i].se)]=1;
    }


    for (int i=0;i<n-1;i++){
        for (int j=i+1;j<n;j++){
            if (i==j) continue;
            pii tm;
            tm.fi=ar[i].fi-ar[j].fi;
            tm.se=ar[i].se-ar[j].se;
            del[tm]++;
            del[mp(-tm.fi,-tm.se)]++;
        }
    }

    int res=0;
    for (auto delta : del){
        res=max(res,delta.se);
    }

    cout << n-res << el;

    return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> vec(n);
  rep(i, n) cin >> vec.at(i);
  if(k >= n) cout << 0 << endl;
  else {
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
    long long ans = 0;
    for(int i = k; i < n; i++) ans += vec.at(i);
    cout << ans << endl;
  }
}


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

int s[2], t[2];
string d = "RULD";

string solve();

int main() {
  cin >> s[0] >> s[1] >> t[0] >> t[1];

  cout << solve() << endl;
  return 0;
}

string solve() {
  string ans;
  for(int i = 0; i < 4; ++i)
    for(int j = 0; j < t[i % 2] - s[i % 2]; ++j)
      ans += d[i];
  for(int i = 0; i < 4; ++i) {
    if(i % 2 == 0) ans += d[(i + 3) % 4];
    for(int j = 0; j < 1 + t[i % 2] - s[i % 2]; ++j)
      ans += d[i];
    if(i % 2 == 1) ans += d[(i + 1) % 4];
  }
  return ans;
}

Measured memory_bytes: 256
#include <cstdio>

const int MAXN = 2e5 + 19;

inline int f(int x){
	int res = 0;
	while(x)
		++res, x %= __builtin_popcount(unsigned(x));
	return res;
}

int n, pop;
int low[MAXN], val_low;
int hig[MAXN], val_hig;
char s[MAXN];

int main(){
	std::scanf("%d%s", &n, s + 1);
	for(int i = 1; i <= n; ++i)
		if(s[i] == '1')
			++pop;
	low[1] = 1, hig[1] = 1;
	for(int i = 2; i <= n; ++i){
		if(pop - 1)
			low[i] = low[i - 1] * 2 % (pop - 1);
		hig[i] = hig[i - 1] * 2 % (pop + 1);
	}
	for(int i = 1; i <= n; ++i)
		if(s[n - i + 1] == '1'){
			if(pop - 1)
				val_low = (val_low + low[i]) % (pop - 1);
			val_hig = (val_hig + hig[i]) % (pop + 1);
		}
	for(int i = 1, val; i <= n; ++i)
		if(s[i] == '1'){
			if(pop == 1){
				std::puts("0");
				continue;
			}
			val = (val_low - low[n - i + 1]) % (pop - 1);
			val += pop - 1;
			val %= pop - 1;
			std::printf("%d\n", f(val) + 1);
		}
		else{
			val = (val_hig + hig[n - i + 1]) % (pop + 1);
			val += pop + 1;
			val %= pop + 1;
			std::printf("%d\n", f(val) + 1);
		}
	return 0;
}

Measured memory_bytes: 3512
from collections import defaultdict, Counter
import sys

# dp[n][使った数字(bit)][合計] = count
dp = [defaultdict(Counter) for _ in [0]*11]
dp[0][0][0] = 1

for i in range(1, 11):
    for used, counter in dp[i-1].items():
        for j in filter(lambda x: used & 2**x == 0, range(10)):
            for total, count in counter.items():
                dp[i][used|2**j][total+j*i] += count

for n, s in (map(int, l.rstrip().split()) for l in sys.stdin):
    print(sum(v for counter in dp[n].values() for k, v in counter.items() if k == s))



Measured memory_bytes: 7616
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define MP make_pair
#define PB push_back
#define ll long long
#define int long long
#define f(i,x,n) for(int i=x;i<n;i++)
#define ld long double
const int mod = 1000000007;
const int INF = 1e18;
int ans[1000005];
int a[200005], b[200005];

set <pair <int, int> > se;
int32_t main() {

	ios_base::sync_with_stdio(false);	cin.tie(NULL);

	int n, m, pos = 0;
	cin >> n >> m;

	ans[m + 1]++;

	f(i, 1, m + 1) {
		se.insert({i, 0});
		ans[0]++;
	}

	f(i, 1, n + 1) {
		cin >> a[i] >> b[i];

		if (b[i] != m) {
			auto itr = se.lower_bound({b[i] + 2, 0});

			if (itr != se.begin()) {
				itr--;
				if ((*itr).ff != b[i] + 1) {
					int value = b[i] + 1 - (*itr).ff + (*itr).ss;
					se.insert({b[i] + 1, value});
					ans[value]++;
				}
			}
		}

		auto itr = se.lower_bound({a[i], 0});
		while (itr != se.end() && (*itr).ff <= b[i] ) {
			auto itrtmp = itr;
			itr++;
			ans[itrtmp->ss]--;
			se.erase(itrtmp);
		}

		while (ans[pos] <= 0) {
			pos++;
		}

		if (pos > m)
			cout << "-1\n";
		else
			cout << pos + i << '\n';
	}

	return 0;
}


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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
//#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vin(Vi &v){REP(i,0,(v).size()) cin>>v[i];}
void vin(Vi &v,Vi &v2){REP(i,0,(v).size()) cin>>v[i]>>v2[i];}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
void accum(Vi &v){REP(i,1,(v).size()) v[i]+=v[i-1];}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

const long long MOD = 1000000007;

void solve(long long n, std::vector<long long> a){
    int ans=0;
    REP(i,0,61){
        int checkbit=(1ll<<i);
        int cnt0=0,cnt1=0;
        REP(j,0,n){
            if(a[j]&checkbit) cnt1++;
            else cnt0++;
        }
//        cout<<i<<" "<<cnt0<<" "<<cnt1<<endl;
//        REP(j,0,cnt0*cnt1) ans = (ans+checkbit)%MOD;
        ans = (ans + ( ((cnt0*cnt1)%MOD) * (checkbit%MOD) )%MOD )%MOD;
//        cout<<ans<<endl;
    }
    cout<<ans<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int n;
long long k;
int a[200005];
int d[200005];
int main(){
    scanf("%d%lld",&n,&k);
    for (int i = 1; i <= n; i++){
        scanf("%d",&a[i]);
    }
    memset(d,-1,sizeof(d));
    d[1] = 0;
    int cur = 1;
    while (k){
        if (d[a[cur]] != -1){
            //printf("cycle %d -> %d\n",cur,a[cur]);
            int cyclelength = d[cur]-d[a[cur]]+1;
            k--;
            cur = a[cur];
            k %= cyclelength;
            break;
        }
        else{
            d[a[cur]] = d[cur]+1;
            cur = a[cur];
            k--;
        }
    }
    //printf("%d left\n",k);
    memset(d,-1,sizeof(d));
    d[cur] = 0;
    while (k){
        d[a[cur]] = d[cur]+1;
        cur = a[cur];
        k--;
    }
    printf("%d",cur);
}


Measured memory_bytes: 5388
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define mod 1000000007
#define inf 2147483647
#define range(x,a,b) (a)<=x&&x<=(b)
int main(){
	int n,abc[3];
	cin>>n>>abc[0]>>abc[1]>>abc[2];
	string s[n+1];
	rep(i,n)cin>>s[i];
	s[n]="KK";
	int zero_count=0;
	rep(i,3)if(abc[i]==0)zero_count++;
	if(abc[0]+abc[1]+abc[2]<=2){
		queue<char> q;
		rep(i,n){
			if(abc[s[i][0]-'A']>abc[s[i][1]-'A']){
				abc[s[i][0]-'A']--;
				abc[s[i][1]-'A']++;
				q.push(s[i][1]);
			}
			else if(abc[s[i][0]-'A']<abc[s[i][1]-'A']){
				abc[s[i][0]-'A']++;
				abc[s[i][1]-'A']--;
				q.push(s[i][0]);
			}
			else{
				if(abc[s[i][0]-'A']==0){
					cout<<"No";
					return 0;
				}
				if(s[i][0]==s[i+1][0]||s[i][0]==s[i+1][1]){
					abc[s[i][0]-'A']++;
					abc[s[i][1]-'A']--;
					q.push(s[i][0]);
				}
				else{
					abc[s[i][0]-'A']--;
					abc[s[i][1]-'A']++;
					q.push(s[i][1]);
				}
			}
		}	
		cout<<"Yes"<<"\n";
		while(q.size()!=0){
			cout<<q.front()<<"\n";
			q.pop();
		}
	}
	else{
		if(zero_count==2&&abc[s[0][0]-'A']==abc[s[0][1]-'A']){
			cout<<"No";
			return 0;
		}
		cout<<"Yes"<<"\n";
		rep(i,n){
			if(abc[s[i][0]-'A']>abc[s[i][1]-'A']){
				abc[s[i][0]-'A']--;
				abc[s[i][1]-'A']++;
				cout<<s[i][1]<<"\n";
			}
			else{
				abc[s[i][0]-'A']++;
				abc[s[i][1]-'A']--;
				cout<<s[i][0]<<"\n";
			}
		}
	}	
	return 0;
}

Measured memory_bytes: 6828
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int L[210000];
int R[210000];
vector<int>v[210000];
int p[210000];
int bit[210000];
int sum(int a,int b){
	if(a)return sum(0,b)-sum(0,a-1);
	int ret=0;
	for(;b>=0;b=(b&(b+1))-1)ret+=bit[b];
	return ret;
}
void add(int a,int b){
	for(;a<210000;a|=a+1)bit[a]+=b;
}
int use[210000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%d%d",L+i,R+i);
		v[L[i]].push_back(i);
	}
	int ret=0;
	set<pair<int,int> > S;
	for(int i=0;i<a;i++){
		if(L[i])S.insert(make_pair(R[i],i));
	}
	int at=1;
	int sz=0;
	for(int i=0;i<b;i++){
		if(S.empty()){
			break;
		}
		p[i]=(*(S.rbegin())).second;
		sz++;
		S.erase(make_pair(R[p[i]],p[i]));
		add(L[p[i]],1);
		int to=at;
		for(int j=0;j<120;j++){
			int id=rand()%(i+1);
			if(to<=L[p[id]]&&sum(0,L[p[id]])>=L[p[id]])to=L[p[id]]+1;
		}
		if(to<=L[p[i]]){
			if(sum(0,L[p[i]])>=L[p[i]])to=L[p[i]]+1;
		}
		while(to<=b){
			if(sum(0,to)>=to)to++;
			else break;
		}
		while(at<to){
			for(int j=0;j<v[at].size();j++){
				S.erase(make_pair(R[v[at][j]],v[at][j]));
			}
			at++;
		}
	}
	//for(int i=0;i<sz;i++)printf("%d ",p[i]);printf("\n");
	for(int i=0;i<sz;i++)use[p[i]]=1;
	set<int>S2;
	for(int i=sz+1;i<=b;i++){
		S2.insert(i);
	}
	int tmp=0;
	for(int i=0;i<a;i++){
		if(!use[i]){
			set<int>::iterator it=S2.lower_bound(R[i]);
			if(it!=S2.end()){
				tmp++;
				S2.erase(it);
			}
		}
	}
	for(int i=sz;i>=0;i--){

		ret=max(ret,i+tmp);
		S2.insert(i);
		if(i){
			set<int>::iterator it=S2.lower_bound(R[p[i-1]]);
			if(it!=S2.end()){
				tmp++;
				S2.erase(it);
			}
		}
	}
	printf("%d\n",a-ret);
}

Measured memory_bytes: 22144
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
ll n,m;
string s,t;
int main()
{
    cin>>n>>m;
    cin>>s;
    cin>>t;
    if(s[0]!=t[0])
    {
        printf("-1\n");
        return 0;
    }
    ll gcd=__gcd(n,m);
    for(ll x=1;x<n;x++)
    {
        if(x*m%n!=0) continue;
        ll y=x*m/n;
        if(s[x]!=t[y])
        {
            printf("-1\n");
            return 0;
        }
    }
    cout<<n/gcd*m<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define chmax(x, y) do { x = max(x, y); } while(0)
#define chmin(x, y) do { x = min(x, y); } while(0)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<ll>(a); i < static_cast<ll>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
template<typename T>
using reversed_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T> >;

// {{{ Modint
// using mint = modint<1000000007>;
// mint x = 2;
// std::cout << x.a << std::endl;
template <std::int64_t M>
class modint {
 public:
  int64_t a;

  explicit constexpr modint(const int64_t x = 0) noexcept :
    a((x % M + M) % M) {}
  constexpr int64_t &value() noexcept { return a; }
  constexpr const int64_t &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= M) {
      a -= M;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += M;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % M;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    int64_t exp = M - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
  constexpr modint pow(ll t) const {
    if (!t) return modint(1);
    modint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
};
// }}}
using mint = modint<1000000007>;
ll N;
ll x[200000];
mint l[200000];
mint c[200000];

signed main() {
  cin >> N;
  rep(i, N) {
    cin >> x[i];
    if (i > 0) {
      l[i] = mint(x[i] - x[i-1]);
    }
  }
  c[1] = mint(1);
  for (ll i = 2; i < N; i++)
    c[i] = c[i-1] + mint(1) / mint(i);

  mint ans(0);
  for (ll i = 1; i < N; i++) {
    ans += c[i] * l[i];
  }
  for (ll i = 2; i < N; i++)
    ans *= mint(i);
  cout << ans.value() << endl;
  return 0;
}


Measured memory_bytes: 3584
//In the name of Allah
#include <bits/stdc++.h>
using namespace std;

const int maxN = 2000 + 10; 
vector<int> c[maxN]; 

int cnt = 0 ; 

void dfs( int s , int rem , int p ) { 
	cnt++; 
	if( rem == 0 ) return;
	for( auto x : c[s] ) if( x != p ) 
		dfs( x , rem - 1 , s ); 
}

int main() { 
	ios::sync_with_stdio(false); 
	int n, k; cin >> n >> k; 
	for( int i = 0 ; i < n - 1 ; i++ ) {
		int u,v; cin >> u >> v; 
		u--; v--; 
		c[u].push_back(v); 
		c[v].push_back(u); 
	}
	int ans = n; 
	if( k % 2 == 0 ) { 
		for( int i = 0 ; i < n ; i++ ) { 
			cnt = 0; 
			dfs( i , k/2 , -1 ) ; 
			ans = min( ans , n - cnt ); 
		}
	} else { 
		for( int i = 0 ; i < n ; i++ )
			for( auto j : c[i] ) { 
				cnt = 0; 
				dfs( i , k/2 , j ) ; 
				dfs( j , k/2 , i ) ; 
				ans = min( ans , n - cnt ); 
			}
	}
	cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
ll h, ans;
ll res[55];

int main() {
	scanf("%lld", &h);
	ll x = 1ll;
	for(int i = 1; i <= 55; i++) {
		res[i] = x;
		x *= 2;
	}
	for(int i = 1; i < 55; i++) {
		if(h >= res[i] && h < res[i + 1]) ans = res[i + 1] - 1;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#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
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

template<typename T>
void p(T elem) {cout << elem << endl;}
template<typename T>
void ps(vector<T>& arr) { for(T e: arr) p(e); }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

struct job {
    int days;
    int fee;
};

int main(void) {
    int num, dlimit;
    cin >> num >> dlimit;
    vector<struct job> jobs(num);
    for(auto& job: jobs) {
        cin >> job.days >> job.fee;
    }
    auto comp = [](struct job j1, struct job j2) {
        return j1.days < j2.days;
    };
    sort(jobs.begin(), jobs.end(), comp);

    int ans = 0;
    int j = 0;
    priority_queue<int, std::vector<int>> max_queue;
    for(int m = dlimit-1; m >= 0; m--) {
        for(; j < num; j++) {
            struct job job = jobs[j];
            if(job.days > dlimit-m) break;
            max_queue.push(job.fee);
        }
        if(max_queue.empty()) continue;
        ans += max_queue.top();
        max_queue.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4612
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<29;

const int MAX = 510000; //nCrのr
//const ll INF = (ll)1e18 + 1;

ll ans;
ll N;

void dfs(ll val, ll a, ll b, ll c){
  if (val > N) return;
  if (a & b & c) ans++;

  dfs(10 * val + 7, 1, b, c);
  dfs(10 * val + 5, a, 1, c);
  dfs(10 * val + 3, a, b, 1);
}

int main(){
  cin >> N;
  dfs(0, 0, 0, 0);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
#define MAX 101
#define WHITE -1
#define GRAY 2
#define BLACK 1
#define EMPTY -1
#define INF 10000000
using namespace std;

int G[MAX][MAX]={},d[MAX]={},color[MAX]={};
queue<int> Q;

void print(int n){
  for(int i=1;i<n+1;i++){
      if(i!=1&&d[i]==0)cout<<i<<" "<<-1<<endl;
    else cout<<i<<" "<<d[i]<<endl;
  }
}

void bfs(int n,int s){
    int u,v;
    color[s]=GRAY;
    Q.empty();
    Q.push(s);
    while(!Q.empty()){
            u=Q.front();
            Q.pop();
            for (int v = 1; v <= n; ++v) {
                if(G[u][v]&&color[v]==WHITE){
                    color[v]=GRAY;
                    d[v]=d[u]+1;
                    Q.push(v);
                }
            }
            color[u]=BLACK;
        }
}

int main(){
  int n,i,k,j,A,B,V[MAX]={};
  cin>>n;
  for(i=0;i<MAX;i++){
    for(j=0;j<MAX;j++){
        G[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    cin>>A>>k;
    for(j=0;j<k;j++){
      cin>>B;
      G[A][B]++;
    }
  }

    for(int u=0;u<=n;u++){
        color[u]=WHITE;
        d[u]=0;
    }
  bfs(n,1);
  print(n);
}



Measured memory_bytes: 3148
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d ;
    int x=0,y=0 ;
    cin>>a>>b>>c>>d ;
    if(a<b)
    {
        x=a;
    }
    else
    {
        x=b;
    }

    if(c<d)
    {
        y=c;
    }
    else
    {
        y=d;
    }
    cout<<x+y<<endl ;
}


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

using namespace std;

typedef long long ll;

const int N = 100100, M = 20;

int go[N][M];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, l;
    cin >> n;
    vector<int> x(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    cin >> l;
    for (int i = 0; i < n; ++i) {
        go[i][0] = upper_bound(x.begin(), x.end(), x[i] + l) - x.begin() - 1;
    }
    for (int j = 1; j < M; ++j) {
        for (int i = 0; i < n; ++i) {
            go[i][j] = go[go[i][j - 1]][j - 1];
        }
    }
    int q;
    cin >> q;
    while (q--) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        if (a > b) {
            swap(a, b);
        }
        int ans = 0;
        for (int i = M - 1; i >= 0; --i) {
            if (go[a][i] >= b) {
                continue;
            } else {
                ans += 1 << i;
                a = go[a][i];
            }
        }
        cout << ans + (a != b) << '\n';
    }
    return 0;
}

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

int main(){
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;
  
  int num_remain = max(X,Y)-min(X,Y);
  
  if(A+B <= 2*C){
    cout << A*X +B*Y << "\n";
  }else if(A+B>2*C && ((A>=2*C && X>Y) || (B>=2*C && X<Y))){
    cout << 2*C*max(X,Y) << "\n";
  }else if(X>=Y){
    cout << A*(X-Y) + 2*C*Y << "\n";
  }else{
    cout << B*(Y-X) + 2*C*X << "\n";
  }
}

  

Measured memory_bytes: 256
// Problem : C - Maximum Volume
// Contest : AtCoder - AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vlli vector<int>
#define slli set<int>
#define mlli map<int,int>
#define plii pair< int,int >
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define SI(a,n) int a[n];FOR(i,n) cin>>a[i];
#define input(a,n) int n;cin>>n; SI(a,n)
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element)!=container.end())
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void solve(){
	double a;
	rd(a);
	double s=a/3.0;
	cout<<fixed<<setprecision(12);
	pp(s*s*s);	
	return;	
}


int32_t main() {
    // fint{
    	fast;
    	solve();
    // }
    return 0;
}


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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 100005;

int n, a[N];

int main() {

	FAST;

	cin >> n;
	while (n > 0) {
		if (n % 10 == 7) {
			cout << "Yes\n";
			return 0;
		}
		n /= 10;
	}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 3656
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := readInt()
	m := make(map[int]int, n)
	for i := 0; i < n; i++ {
		a := readInt()
		m[a]++
	}

	type stick struct{ a, c int }
	sts := make([]stick, 0, len(m))
	for a, c := range m {
		sts = append(sts, stick{a, c})
	}
	sort.Slice(sts, func(i, j int) bool { return sts[i].a > sts[j].a })
	t := 0
	for _, st := range sts {
		if t == 0 {
			if st.c >= 4 {
				fmt.Println(st.a * st.a)
				return
			} else if st.c >= 2 {
				t = st.a
			}
		} else {
			if st.c >= 2 {
				fmt.Println(t * st.a)
				return
			}
		}
	}
	fmt.Println(0)
}


Measured memory_bytes: 7656
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    int N;
    cin >> N;
    vector<int> t(N), x(N), y(N);
    REP(i, N) cin >> t[i] >> x[i] >> y[i];
    t.insert(t.begin(), 0);
    x.insert(x.begin(), 0);
    y.insert(y.begin(), 0);

    REP(i, N) {
        int move     = abs(x[i] - x[i + 1]) + abs(y[i] - y[i + 1]);
        int timemove = t[i + 1] - t[i];
        int diff     = timemove - move;
        if (diff < 0 || diff % 2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 1792
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define print(a) cout << a << endl;
#define cin(x) cin >> x;

signed main(){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
double t , x;
   cin(t);cin(x);

   print(t/x);





  
  return 0;
}

Measured memory_bytes: 3756
//
//  main.cpp
//  zero
//
//  Created by 叶金炜 on 2019/4/2.
//  Copyright © 2019 okstal. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
int main() {
    int a,b,d,r;
    double f;
    cin>>a>>b;
    d=a/b;
    r=a%b;
    f=a*1.0/b*1.0;
    printf("%d %d %.5lf\n",d,r,f);
    return 0;
}



Measured memory_bytes: 3152
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 1e9 + 7;
const int N = 160000;
const int K = 5000;
int a[N], used[N], p[N], len[N], f[N];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
   // freopen("input.txt", "r", stdin);
    int n, m, q;
    cin >> m >> n >> q;
    for (int i = 1; i <= q; i++) cin >> a[i];
    int k = 0;
    for (int i = q; i >= 1; i--){
        if (!used[a[i]]){
            used[a[i]] = 1;
            k++;
            p[k] = a[i];
        }
    }
    int l = 1;
    for (int i = k + 1; i <= n; i++){
        while(used[l] == 1) l++;
        p[i] = l;
        l++;
    }
    int suf = 0;
    p[n + 1] = 1e9;
    for (int i = n; i >= 1; i--){
        if (p[i] < p[i + 1]) suf++; else break;
    }
    for (int i = 1; i <= n; i++) f[p[i]] = i;
    len[0] = m;
    for (int i = q; i >= 1; i--){
        int x = f[a[i]];
        if (len[x - 1] > 0){
            len[x - 1]--;
            len[x]++;
        }
    }
    int c = 0;
    for (int i = n - suf; i <= n; i++) c += len[i];
    if (c != m){
        cout << "No";
    } else cout << "Yes";
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int main() {
    int n,m;
    cin >> n >> m;
    vector<int> a(m);
    for(int i=0;i<m;i++){
        cin >> a[i];
    }
    int reminder = -1;
    for(int i=0;i<m;i++){
        n -= a[i];
    }
    if(n>=0){
        reminder = n;
    }
    cout << reminder << endl;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char ci[cm];
char *cn = ci + cm;
inline char getcha() {
	if (cn - ci == cm) { fread(ci, 1, cm, stdin); cn = ci; }
	return *cn++;
}

inline int getint() {
	char C = getcha();
	int A = C - '0';
	while ((C = getcha()) >= '0') A = A * 10 + C - '0';
	return A;
}

int gcd(int A, int B) {
	if (B) return gcd(B, A % B);
	return A;
}

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


	int N = getint(), K = getint();
	int g = getint();
	int saidai = g;
	rep(i, N - 1) {
		int a = getint();
		g = gcd(a, g);
		saidai = max(saidai, a);
	}

	if (K % g == 0 && K <= saidai) co("POSSIBLE");
	else co("IMPOSSIBLE");

	Would you please return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	double R;

	cin >> R;
	printf("%.5lf\n", 2 * R * PI);

	return 0;
}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
    using namespace std ;
     
    #define pb(n) push_back(n)
    #define fi first
    #define se second
    #define all(r) begin(r),end(r)
    #define vmax(ary) *max_element(all(ary))
    #define vmin(ary) *min_element(all(ary))
    #define debug(x) cout<<#x<<": "<<x<<endl
    #define fcout(n) cout<<fixed<<setprecision((n))
    #define scout(n) cout<<setw(n)
    #define vary(type,name,size,init) vector< type> name(size,init)
    #define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
    #define mp(a,b) make_pair(a,b)
     
    #define rep(i,n) for(int i = 0; i < (int)(n);++i)
    #define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
    #define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
    #define repa(n,array) for(auto &n :(array))
     
    using ll = long long;
    using pii = pair<int,int> ;
    using pll = pair<ll,ll> ;
     
    const ll mod = 1e9+7;
    constexpr ll inf = ((1<<30)-1)*2+1 ;
    constexpr double PI = acos(-1.0) ;
    double eps = 1e-10 ;
    const int dy[] = {-1,0,1,0,1,-1,1,-1};
    const int dx[] = {0,-1,0,1,1,-1,-1,1};
     
    inline bool value(int x,int y,int w,int h){
      return (x >= 0 && x < w && y >= 0 && y < h);
    }
     
    int main(){
      cin.tie(0);
      ios::sync_with_stdio(false);
      ll n,a,b,c,d;
      cin >> n >> a >> b >> c >> d;
      bool f = false;
      rep(i,n-1){
        f |= (c * i - d * (n-1-i) <= b-a && b-a <= i * d - c *(n - 1 -i));
      }
      if(f)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
      return 0;
    }

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 100000000;
typedef double D;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> PII;

/** Problem0201 : Wrought Gold Master **/
map<string, int> item;
map<string, vector<string> > recipe;

int min_price(string t)
{
	int res = item[t];
	if (recipe[t].size()) {
		int tmp=0;
		rep(i, recipe[t].size()) {
			tmp += min_price(recipe[t][i]);
		}
		res = min(res, tmp);
	}
	return res;
}

int main()
{
	int N, M;
	while (cin>>N, N) {
		item.clear(); recipe.clear();
		
		rep(i, N) {
			string s; int a;
			cin>>s>>a;
			item[s]=a;
		}
		cin>>M;
		rep(i, M) {
			string s; int k;
			cin>>s>>k;
			rep(j, k) {
				string ss; cin>>ss;
				recipe[s].push_back(ss);
			}
		}
		
		string target;
		cin >> target;
		cout << min_price(target) << endl;
	}
}

Measured memory_bytes: 1232
#include <stdio.h>

int main(void)
{
    signed int a, b;

    scanf("%d %d", &a, &b);

    if(a > b)
        printf("a > b\n");
    else if(a < b)
        printf("a < b\n");
    else if(a == b)
        printf("a == b\n");

    return 0;

}

Measured memory_bytes: 580
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll L, R, d;
  cin >> L >> R >> d;
  ll ans = 0;
  for (int i = L; i <= R; i++) {
    if (i % d == 0) ans++;
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
using namespace std;
int main() {
	int a,b;
	char op;
	while(op!='?'){
		cin>>a>>op>>b;
		if(op=='+'){
			cout<<a+b<<endl;
		}
		else if(op=='-'){
			cout<<a-b<<endl;
		}
		else if(op=='*'){
			cout<<a*b<<endl;
		}
		else if(op=='/'){
			cout<<a/b<<endl;
		}
	}
}



Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

unsigned gcd(unsigned a, unsigned b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

int main()
{
	int n;
	cin >> n;
	vector<INT> p(n);
	for (size_t i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	INT ans = 0;
	for (size_t i = 1; i < n-1; i++)
	{
		if ((p[i - 1] < p[i] && p[i] < p[i + 1]) || (p[i - 1] > p[i] && p[i] > p[i + 1]))
		{
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static int[] val;
	public static int n;
	public static int x;
	public static boolean[] dp;
	public static int[] PrimeTable;
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		double nowx = 0.0;
		double nowy = 0.0;
		double nowa = 90.0;
		
		while(true) {
			String tmp = stdIn.next();
			String[] tmp2 = tmp.split(",");
			int a = Integer.parseInt(tmp2[0], 10);
			int b = Integer.parseInt(tmp2[1], 10);
		
			
			if(a == 0 & b == 0) {
				break;
			}
			
			double px = a * Math.cos(Math.toRadians(nowa));
			double py = a * Math.sin(Math.toRadians(nowa));
			
			nowx += px;
			nowy += py;
			
			nowa += b;
			
			if(nowa >= 360) {
				nowa -= 360;
			}
			if(nowa < 0) {
				nowa += 360;
			}
			
		}
		
		int ansx = (int)nowx;
		int ansy = (int)nowy;
		
		System.out.println(-ansx);
		System.out.println(ansy);
	}

}

Measured memory_bytes: 17144
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;
LL n, a, b;
LL all;
int hi[1000000 + 20];
LL isok(int index, LL sum) {
    LL be = 0, en = sum;
    while (be <= en) {
        LL mid = (be + en) >> 1;
        if (a * mid + (sum - mid) * b >= hi[index]) en = mid - 1;
        else be = mid + 1;
    }
    return be;
}
bool check(LL sum) {
    LL need = 0;
    for (int i = 1; i <= n; ++i) {
        need += isok(i, sum);
        if (need > sum) return false;
    }
    return true;
}
void work() {
    cin >> n >> a >> b;
    for (int i = 1; i <= n; ++i) {
        cin >> hi[i];
        all += hi[i];
    }
//    if (n == 1) {
//        cout << (hi[1] + a - 1) / a << endl;
//        return;
//    }
    LL be = 0, en = 1e9;
    while (be <= en) {
        LL mid = (be + en) >> 1;
        if (check(mid)) en = mid - 1;
        else be = mid + 1;
    }
    cout << be << endl;
}

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    work();
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int a, b, h, m;
double s, c;
int main(){
	scanf("%d%d%d%d", &a, &b, &h, &m);
	s = h * 5 + 5 * m / 60.0;
	c = min(abs(s - m), abs(m - s));
	printf("%.12lf\n", sqrt(a*a+b*b-2*a*b*cos(acos(-1)*(c/30))));
	return 0;
}

Measured memory_bytes: 4176
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    int N; cin >> N;
    vector<string> keep(N);  VECCIN(keep);
    SORT(keep);

    if(N == 1){cout << keep[0] << endl;  return 0;}

    int max_num = 0, keep_num = 1;
    for(int i = 1 ; i < N ; i++){
      if(keep[i - 1] == keep[i])  keep_num += 1;
      else{
        if(max_num < keep_num)  max_num = keep_num;
        keep_num = 1;
      }
    }

    if(max_num < keep_num)  max_num = keep_num;

    keep_num = 1;
    for(int i = 1 ; i < N ; i++){
      if(keep[i - 1] == keep[i])  keep_num += 1;
      else{
        if(max_num == keep_num) cout << keep[i - 1] << endl;
        keep_num = 1;                                                
      }
    }
    
    if(max_num == keep_num) cout << keep[N - 1] << endl;
    
	return 0;
}


Measured memory_bytes: 12928
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

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

int main(){
	ll n,x;
	cin >> n >> x;
	cout << 3*(n-gcd(n,x)) << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys

input = sys.stdin.buffer.readline

x = int(input())


def find(x):
    for a in range(-300, 300):
        for b in range(-300, 300):
            b = -b
            if a ** 5 - b ** 5 == x:
                return [a, b]


a, b = find(x)
print(a, b)


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

int main(){
	int a,b;

	cin >> a >> b;

	if(a<b){
		cout << "a < b" << endl;
	}else if(a>b){
		cout << "a > b" << endl;
	}else if(a == b){
		cout << "a == b" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1156
<?php
class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
    public function nextString() {
        return (string)$this->next();
    }
}

function hand($give, $take)
{
    if ($give % 2 === 1) {
        $give--;
    }
    $cnt = $give / 2;
    $give = $give - $cnt;
    $take = $take + $cnt;
    return array($give, $take);
}

$sc = new Scanner();
$a = $sc->nextInt();
$b = $sc->nextInt();
$k = $sc->nextInt();

for($i = 0; $i < $k; $i++) {
    if ($i % 2 !== 1) {
        list($a, $b) = hand($a, $b);
    } else {
        list($b, $a) = hand($b, $a);
    }
}

echo $a, " ", $b;

Measured memory_bytes: 3576
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)


//座圧(破壊的)
int cocomp(ll*a,int n){
	//0～cnt-1に圧縮
	ll*b=(ll*)malloc(sizeof(ll)*n);
	memcpy(b,a,sizeof(ll)*n);
	sortup(b,n);
	int cnt=1;
	rep(r,1,n)if(b[r]!=b[cnt-1])b[cnt++]=b[r];
	rep(i,0,n){
		int l=0,r=cnt;
		while(r-l>1){int m=(l+r)/2;if(b[m]>a[i])r=m;else l=m;}
		a[i]=l;
	}
	free(b);
	return cnt;
}




//セグ木ここから
//*
//↓ここを変える
typedef struct atai{ll a;}atai;
atai xx(atai x,atai y){
	atai r;
	r.a=x.a+y.a;//sum
	return r;
}
atai aid={0};
//↑ここを変える

int segNUM;
atai *segN,*seg;
void seguse(int n){
	segN=(atai*)calloc(2*n,sizeof(atai));
	segNUM=n;
	seg=segN+segNUM;
	rep(i,1,2*segNUM)segN[i]=aid;
}
//seg[]に値を与えてから初期化
void seginit(){for(int node=segNUM-1;node;node--)segN[node]=xx(segN[node*2],segN[node*2+1]);}
void segupdate(int node,atai x){
	//seg[node]をxに更新
	node+=segNUM;
	segN[node]=x;
	while(node/=2)segN[node]=xx(segN[node*2],segN[node*2+1]);
}

atai segcalcsub(int l,int r,int k,int cl,int cr){
	if(l>=r)return aid;
	//完全に含むとき
	if(l<=cl&&cr<=r)return segN[k];

	int cm=(cl+cr)/2;
	//左側だけ
	if(r<=cm)return segcalcsub(l,r,2*k  ,cl,cm);
	//右側だけ
	if(cm<=l)return segcalcsub(l,r,2*k+1,cm,cr);
	//両方
	return xx(segcalcsub(l,r,2*k,cl,cm),segcalcsub(l,r,2*k+1,cm,cr));
}
atai segcalc(int l,int r){return segcalcsub(l,r,1,0,segNUM);}
//セグ木ここまで
//*/

int n;
int bs(ll k){
	//[i,k)に1以上ある最大のiをかえす
	if(segcalc(0,k).a==0)return k;
	int l=0,r=k;
	while(r-l>1){
		int m=(l+r)/2;
		if(segcalc(m,k).a>0)l=m;
		else r=m;
	}
	return l;
}

ll a[100010];
int main(){
	scanf("%d",&n);
	seguse(1<<17);
	
	rep(i,0,n)scanf("%lld",a+i);
	cocomp(a,n);
	int ans=0;
	rep(i,0,n){
		int k=bs(a[i]);
		if(k==a[i]){
			ans++;
		}else{
			atai x=segcalc(k,k+1);
			x.a--;
			segupdate(k,x);
		}
		atai x=segcalc(a[i],a[i]+1);
		x.a++;
		segupdate(a[i],x);
	}
	printf("%d",ans);
}

Measured memory_bytes: 4604
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pr(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
#define BLACK 0
#define WHITE 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main(void) {
    ll N;
    cin >> N;
    ll i;
    double a[100];
    double mid;
    double sum=0;
    for(i=0; i<N; i++) {
        cin >> a[i];
        sum+=a[i];
    }
    
    mid=sum/N;
    
    double min=INF;
    ll minId=0;
    
    for(i=0; i<N; i++) {
        if(abs(mid-a[i])<min) {
            min=abs(mid-a[i]);
            minId=i;
        }
    }
    
    pr(minId);
    
    
    
}

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

int main()
{
    int a, b;
    int64_t i;
    cin >> a >> b;
    i = 1;
    while (true) {
        if (i * min(a, b) % max(a, b) == 0) break;
        i++;
    }
    cout << i * min(a, b) << endl;
}

Measured memory_bytes: 256