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

typedef long long ll;
typedef double db;
typedef long double ld;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int>>  vvi ;
typedef vector<vc> vvc;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> vpi ;

#define sz(a) (int)(a.size())
#define all(a) a.begin(),a.end()
#define rall(x) x.rbegin(), x.rend()
#define F first 
#define S second
#define pb push_back 
#define mp make_pair
#define ar array
#define lb lower_bound
#define ub upper_bound
#define FIO freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define mem(X,val) memset(X, val, sizeof((X)))
#define FOR(i, n) for(int i = 0 ; i < (int) n ; ++i)
#define UNQ(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define P(x) cout << x <<'\n';
#define W(x) cout << x;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

const db PI = acos(-1);
const ll mod = 1e9+7;
template <typename A, typename B>istream& operator>>(istream& input,pair<A,B>& x) {input>>x.F>>x.S;return input;}
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
template<class T> void _R(T &x) { cin >> x; } void R() {}template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...);}
template <class T>void smax(T& x,T y){ if(x<y)x=y;}
template <class T>void smin(T& x,T y){ if(x>y)x=y;}
template<typename T1, typename T2> T1 powz(T1 A, T2 B);
template <typename T1, typename T2>T1 ADD(T1,T2);
template <typename T1, typename T2>void ADDZ(T1&,T2);
template<class T1, class T2> T1 mul(T1 A, T2 B);
template<typename T1, typename T2> T1 GCD(T1 A,T2 B);
template<typename T1> T1 MOD(T1 A){return (A%mod + mod)%mod;}
/***************************************************main code**************************************************************/
const int MXN=1e6+5;
const ll INF = 9e18+200;
const int inf = 1e9+100;
const int mxn = 2e5+20;

void test_case()
{
	int a,b;R(a,b);
	W(a*b);
	
	
	
}

/*************----------------------------******************/
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	int Tests = 1;
	//cin >> Tests;
	
	for(int tc = 1; tc <= Tests; ++tc){
		//cout <<"Case #"<<tc<<": ";
		test_case();
		cout<<'\n';
	}
		
}
template <typename T1, typename T2> 
T1 ADD(T1 A, T2 B)
{
	ll res = (A+B)%mod;
	if(res<0)res+=mod;
	return res;
}
template <typename T1, typename T2> 
void ADDZ(T1& A, T2 B)
{
	ll res = (A+B)%mod;
	if(res<0)res+=mod;
	A = res;
}
template<typename T1, typename T2>
T1 powz(T1 X,T2 B)
{
	ll A = X;
	ll res=1;
		A%=mod; 
		assert(B>=0); 
	for( ; B ; B>>=1){
		if(B&1)res=res*A%mod;
		A= A*A%mod;
	}
	return res;
}
template<typename T1, typename T2> 
T1 GCD(T1 A,T2 B)
{
	 return B?GCD(B,A%B):A;
}
template <class T1 , class T2> 
T1 mul(T1 A, T2 B)
{
	ll res = 1;
	res = (1LL * A%mod * B%mod )%mod;
	return res;
}


Measured memory_bytes: 3600
C = [[int(i) for i in input().split()] for _ in range(3)]

# a: 行共通の値
# b: 列共通の値
flag = False
for a0 in range(0,min(C[0])+1):
    b = [0] * 3
    for j in range(3):
        b[j] = C[0][j] - a0
    for i in range(1,3):
        tmp1 = C[i][0] - b[0]
        for j in range(1,3):
            tmp2 = C[i][j] - b[j]
            if tmp1 != tmp2:
                flag = True
            else:
                tmp1 = tmp2

if flag:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
typedef long long ll;

void test_case(){
    
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL);
    
    float a, b;
    cin >> a >> b;
    
    float curr;
    
    curr = a/0.08;
    
    int p = int(curr);
    
    for( int i = min(0, p - 100); i <= p +100; i++){
        curr = float(i)*0.08;
        if( int(curr) == a){
            curr = float(i)*0.1;
            if( int(curr) == b){
                cout<<i<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<endl;
    
	return 0;
}






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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A+B>C+D){
    cout << "Left" << endl;
  }else if(A+B<C+D){
    cout << "Right" << endl;
  }else{
    cout << "Balanced" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

int main(){
	int n,p;
	while(cin>>n>>p,n&&p){
		queue<pii> q;
		rep(i,n){
			q.push(mkp(0,i));
		}
		/*
		rep(i,n){
			cout<<q.front().F<<" "<<q.front().S<<endl;
			q.push(q.front());
			q.pop();
		}
		*/
		int tp=p;
		while(q.front().F!=p){
			pii t=q.front();
			q.pop();
			//cout<<t.F<<" "<<t.S<<endl;
			if(tp==0){
				tp+=t.F;
				t.F=0;
			}
			else{
				tp--;
				t.F++;
			}
			q.push(t);
		}
		cout<<q.front().S<<endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ans=0;
  cin>>n;
  vector<int> ue(n),sita(n),UE(n),SITA(n);
  for(int i=0;i<n;i++){cin>>ue[i];}
  for(int i=0;i<n;i++){cin>>sita[i];}
  UE[0]=ue[0];SITA[0]=sita[n-1];
  for(int i=1;i<n;i++){UE[i]=UE[i-1]+ue[i];SITA[i]=SITA[i-1]+sita[n-1-i];}
  for(int i=0;i<n;i++){
    ans=max(ans,UE[i]+SITA[n-1-i]);
  }
  cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

//---------------------------

int main(){
    ll n;
    cin >> n;
    ll rt = (ll)sqrt(n), minF = 20;
    rep2(a,1,rt+1){
        if(n%a == 0){
            ll b = n/a;
            chmin(minF, max(to_string(a).size(), to_string(b).size()));
        }
    }

    cout << minF << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,x;
	while(1){
	    int m=0;
		scanf("%d %d",&n,&x);
		if(n==0&&x==0) break;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				for(int k=1;k<=n;k++){
					if(i<j&&j<k){
						if(i+j+k==x){
							m++;
						}
					}
				}
			}
		}
		printf("%d\n",m);
	}
	return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int a,b;cin>>a>>b;
  rep1(i, 100000){
    if( ((int)(i*0.08) == a) && ((int)(i*0.1)==b) ){
      cout<<i;
      return 0;
    }
  }

  cout<<-1;
  return 0;
}

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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;


int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int h,w,n;
	cin >>h >>w >>n;
	VI a(n), b(n);
	rep(i,n) cin >>a[i];
	vector<VI> ba(h, VI(w));
	b[0]=a[0];
	rep(i,n-1) b[i+1] = b[i]+a[i+1];
	//for(auto x :b) printf("%d, ",x); puts("");
	int k=0;
	rep(i,h){
		rep(j,w){
			int cx= i*w+j +1;
			if(cx > b[k]) k++;
			if(i%2==0) ba[i][j] = k+1;
			else ba[i][w-1-j] = k+1;
		}
	}
	
	for(auto xl: ba){for(auto x :xl) printf("%d ",x); puts("");}

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
using namespace std;
long long l,r;
long long mini=20200000; 
int main() {
	scanf("%lld%lld",&l,&r);
	int d=min(r-l,(ll)2019);
	l%=2019;
	r=l+d;
	r=min(r,l+2019); 
//	cout<<"l = "<<l<<" r = "<<r<<'\n';
//	r-l 2019 
//	if(l>=r) r+=2019;
	for(long long i=l;i<r;i++)
		for(long long j=i+1;j<=r;j++)
			mini=min(mini,(i*j)%2019);
	printf("%lld",mini);
	return 0;
}


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

using namespace std;

uint32_t encode(string str) {
    uint32_t val = 0;
    for (uint8_t c : str) {
        switch (c) {
            case 'A': val = val * 4 + 1; break;
            case 'C': val = val * 4 + 2; break;
            case 'G': val = val * 4 + 3; break;
            case 'T': val = val * 4 + 4; break;
        }
    }
    return val - 1;
}

int main() {
    uint32_t n;
    vector<bool> dict(22369619, false);

    cin >> n;
    while (n--) {
        string op, str;
        cin >> op >> str;

        if (op == "insert") {
            dict[encode(str)] = true;
        } else if (op == "find") {
            cout << (dict[encode(str)] ? "yes" : "no") << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 5280
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	ll n; cin >> n;
	vector<double> x(n),y(n);
	rep(i,n) cin >> x[i] >> y[i];
	double left = -1000, right = 2000;
	double ans = 1010101010;
	rep(p,100){
		double xmid[2], mx[2];
		xmid[0] = (2*left+right)/3.0, mx[0] = 1010101010;
		xmid[1] = (left+2*right)/3.0; mx[1] = 1010101010;
		if(xmid[1]-xmid[0]<1e-7) break;
		rep(i,2){
			double down = -1000, up = 2000;
			rep(q,100){
				double ymid[2], res[2];
				ymid[0] = (down*2+up)/3.0, res[0] = 0.0;
				ymid[1] = (down+up*2)/3.0, res[1] = 0.0;
				if(ymid[1]-ymid[0]<1e-7) break;
				rep(j,2){
					rep(k,n) chmax(res[j],(y[k]-ymid[j])*(y[k]-ymid[j])+(x[k]-xmid[i])*(x[k]-xmid[i]));
				}
				if(res[0]<res[1]) up = ymid[1], chmin(mx[i],res[0]);
				else down = ymid[0], chmin(mx[i],res[1]);
			}
		}
		if(mx[0]<mx[1]) right = xmid[1], chmin(ans,mx[0]);
		else left = xmid[0], chmin(ans,mx[1]);
	}
	printf("%.10f\n",sqrt(ans));
}

Measured memory_bytes: 256
n = int(input())
ac = wa = tle = re = 0
for i in range(n):
  s = input()
  if s == 'AC':
    ac+=1
  elif s == 'WA':
    wa+=1
  elif s == 'TLE':
    tle+=1
  elif s == 'RE':
    re+=1
print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))

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

#define IOS ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0)
#define endl "\n"
#define int long long
typedef vector<int> vi;
#define all(x) x.begin(),x.end()
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define OO 1e9
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
#define in_range(x, y, r, c) ((x >= 0 && x < r && y >= 0 && y < c))


const double eps=1e-9;
const int MOD=998244353;
const int N=(int)3*1e5+9;
const int inf = 1<<30;


template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <typename T> T exp(T b, T p){T x = 1;while(p){if(p&1)x=(x*b);b=(b*b);p=p>>1;}return x;}
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

int n;
int32_t main() {

int n,m;
cin>>n>>m;
int ans;
if(n>=2)n-=2;
if(m>=2)m-=2;
cout<<n*m;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    char str[4];
    scanf("%s", str);
    if (str[0] == '7' || str[1] == '7' || str[2] == '7') {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 1648
O = str(input())
E = str(input())
tmp = 0
pas = ""
for i in range(0,len(O)+len(E),1):
  if i%2 == 0:
    pas += O[tmp]
  else:
    pas += E[tmp]
  if i%2 == 1:
    tmp += 1
print(pas)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{

    string s;
    cin>>s;
    int c = 0, ans =-1;
    for(int i=0; i<s.size(); i++)
    {
        if(s[i]=='R')c++;
        else
        {
            ans = max(c, ans);
            c=0;
        }
    }
    ans = max(c, ans);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int tmp = n;
  int sum=0;
  while(tmp>0){
    sum += tmp % 10;
    tmp /= 10;
  }
  //cout << sum << endl;
  if(n%sum == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
while 1:
    try:
        n = input()
        c = 0
        if n < 37:
            for i in range(10):
                for j in range(10):
                    for k in range(10):
                        for l in range(10):
                            if i+j+k+l == n:
                                c += 1
        print c
    except EOFError:
        break

Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <algorithm>
     
using namespace std;
     
int main(void){
     
  int a, b, c;

  cin >> a >> b >> c;

  if(a+b == c || a+c == b || b+c == a)
    cout << "Yes";
  else
    cout << "No";
  cout << endl;
     
  return 0;
}

Measured memory_bytes: 256
using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int a = sc.NextInt();
        int b = sc.NextInt();
        Console.WriteLine(a ^ b);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
n, m = gets.chomp.split.map(&:to_i)

INF = 10**10

d = Array.new(n, INF).map{Array.new(n,INF)}
for i in 0..n-1
    d[i][i] = 0
end

a, b, c = [], [], []

m.times do |i|
    a[i], b[i], c[i] = gets.chomp.split.map(&:to_i)
    d[a[i]-1][b[i]-1] = c[i]
    d[b[i]-1][a[i]-1] = c[i]
end

for i in 0..n-1
    for j in 0..n-1
        for k in 0..n-1
            d[j][k] = d[j][i] + d[i][k] if d[j][k] > d[j][i] + d[i][k]
        end
    end
end
#p a
#p b
#p c
#p d
ans = 0
for i in 0..m-1
    flag = false
    for j in 0..n-1
        flag = true if d[j][a[i]-1] + c[i] == d[j][b[i]-1]
    end
    ans += 1 if flag == false
end
puts ans

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

int main() {
    int n, num;
    cin >> n;
    int card[4][13] = {{ 0 }};
    char mark;
    
    for (int i = 0; i < n; i++) {
        cin >> mark >> num;
        if (mark == 'S') card[0][num - 1] = 1;
        if (mark == 'H') card[1][num - 1] = 1;
        if (mark == 'C') card[2][num - 1] = 1;
        if (mark == 'D') card[3][num - 1] = 1;
    }
    
    for (int j = 0; j < 4; j++) {
        for (int k = 0; k < 13; k++) {
            if (card[j][k] == 0) {
                if (j == 0) cout << "S ";
                if (j == 1) cout << "H ";
                if (j == 2) cout << "C ";
                if (j == 3) cout << "D ";
                
                cout << k + 1 << endl;
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 3080
A, B = list(map(int, input().split()))
if A > B:
  n = A
else:
  n = B
q = list(range(1, n+1))
divisor = []
for i in q:
  if A % i == 0 and B % i == 0:
    divisor.append(i)
gcd = max(divisor)
lcm = int(A * B / gcd)
print(lcm)

Measured memory_bytes: 6900
a,b,c = [int(i) for i in input().split()]
while True:
    if c <= a:
        a -= c
        print(a, b)
        break
    else:

        c -= a
        a = 0
        if b >= c:
            b -= c
            print(a, b)
            break
        else:
            print(0, 0)
            break

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int N=S.size();
  int count=0;
  for (int i=0;i<N;i++){
    if (S[i]=='1'){
      count++;
    }
  }
  int ans=2*min(count,N-count);
  cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int x = sc.nextInt();
		int a = sc.nextInt();
			
		// 計算
		int result = 0;
		if(x >= a) result = 10;
		
		// 出力
		System.out.println(result);
		
	}
}


Measured memory_bytes: 21972
def main():
    dishes = int(input())
    aoki_happiness = []
    difference = []
    for i in range(dishes):
        t, a = map(int, input().split())
        aoki_happiness.append(a)
        difference.append(t + a)
    difference.sort(reverse=True)
    answer = -sum(aoki_happiness)
    for i in range(dishes):
        if i % 2 == 0:
            answer += difference[i]
    print(answer)


if __name__ == '__main__':
    main()



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

signed main(){
  
  int N, K;
  
  double ans = 0;
  
  cin>>N>>K;
  
  if( N >= K ) ans += ( 1.0 * N - K + 1 ) / N;
  
  for(int i=1;i<=min(N,K-1);i++){
    
    double x = 1.0 / N, num = i;
    
    while( num < K ) x /= 2, num *= 2;
    
    ans += x;
    
  }
  
  printf("%.10f\n", ans );
  
  return 0;
}


Measured memory_bytes: 256
const Main = (input) => {
  const tmp = input.trim()

  let result = ''

  if (tmp === 'ABC') {
    result = 'ARC'
  } else if (tmp === 'ARC') {
    result = 'ABC'
  }

  console.log(result)
  return result
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 29628
#include<bits/stdc++.h>
#include<algorithm>
using namespace std; 
#define int long long
#define float double
#define MAX 100005
const int  mod = 99824435300;
#define LMT 100000000000
#define int long long 
#define pb push_back 
#define lp(i,n) for( i=0;i<n;i++) 
#define lop(j,n)for( j=0;j<n;j++)
typedef pair<int,int> pii;
typedef pair<pii,pii> ppi;
#define m_p make_pair
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define minheap priority_queue<int,vector<int>,greater<int>>
#define maxheap priority_queue<int>
#define kickstart  cout<<"Case #"<<cc<<": "
#define pair_pq priority_queue<pii,vector<pii>,greater<pii>>
#define ff first
#define ss second
#define pff pair<float,float>
#define piii pair<int,pii>
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%mod;
        a = a * a;
        b >>= 1;
    }
    return res;
}


int fact(int a){int ans=1;
  while(a>1){ans=(ans*a)%mod;a--;}return ans;
}

void solve(){
int i,j,k,l=0,r=mod,m,diff=0,n,q;
cin>>n;int a[n],dp[n];lp(i,n)cin>>a[i];
dp[0]=0;dp[1]=abs(a[1]-a[0]);
for(i=2;i<n;i++)
  dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
cout<<dp[n-1]<<endl;
}
 int32_t main(){
  fastio
 #ifndef ONLINE_JUDGE 
  freopen("input.txt", "r", stdin); 
  freopen("output.txt", "w", stdout); 
 #endif
int t=1;
//cin>>t;
while(t--)solve();
return 0;
 }


Measured memory_bytes: 5128
#include <bits/stdc++.h>
#define N 80002
using namespace std;
int n,r,m;int d[402][402],a[N],b[N];
int main() {cin>>n>>m>>r;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++) if (i^j) d[i][j]=1e9;
	for (int i=1;i<=r;i++) cin>>a[i],b[i]=r-i+1;
	for (int i=1;i<=m;i++) {int a,b,c;
		cin>>a>>b>>c,d[a][b]=d[b][a]=c;
	}
	for (int k=1;k<=n;k++)
		for (int i=1;i<=n;i++) if (i^k)
			for (int j=1;j<=n;j++) if (i^j && k^j) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	int g=1,ans=1e9;for (int i=1;i<=r;i++) g=g*i;
	for (int i=1;i<=g;i++) {int u=0;
		next_permutation(b+1,b+r+1);
		for (int j=2;j<=r;j++) u+=d[a[b[j-1]]][a[b[j]]];
		ans=min(ans,u);
	}
	cout<<ans<<endl;
	return 0; 
}

Measured memory_bytes: 512
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <math.h>
#include <string>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>

using namespace std;

#define pb push_back
#define mk make_pair
#define fr first
#define sc second

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

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

const int maxn = 100100;

int n;
ll s, res;
map <ll,int> mp;

void solve(){
	scanf("%d", &n);
	mp[0] = 1;
	for(int i = 1, x; i <= n; i ++){
		scanf("%d", &x);
		s += x;
		res += mp[s];
		mp[s] ++;
	}
	printf("%lld", res);
}

int main(){
	int t = 1;
	while(t --){
		solve();
	}
}

Measured memory_bytes: 12800
#include<iostream>
using namespace std;
 
int main(){
  int n;
  cin>>n;
  while(n>0){
    if(n%10==7){
    cout<<"Yes";
      break;
     
    }
    n=n/10;
  }
  if(n==0){
  cout<<"No";}
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    int ans =0;

    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(N==i*j) ans++;
        }
    }
    if(ans>0) cout << "Yes" <<endl;
    else cout << "No" <<endl;
}

Measured memory_bytes: 256
def main():
    import sys
    from array import array
    input = sys.stdin.readline

    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()

    dp_left = [array('b', [0] * K) for _ in range(N + 1)]
    dp_right = [array('b', [0] * K) for _ in range(N + 1)]
    dp_left[0][0] = 1
    dp_right[0][0] = 1
    for i, a in enumerate(A):
        for j in range(K):
            if dp_left[i][j]:
                dp_left[i + 1][j] = 1
                if j + a < K:
                    dp_left[i + 1][j + a] = 1
    for i, a in enumerate(reversed(A)):
        for j in range(K):
            if dp_right[i][j]:
                dp_right[i + 1][j] = 1
                if j + a < K:
                    dp_right[i + 1][j + a] = 1

    ok = N
    ng = -1
    mid = (ok+ng)//2
    while ok - ng > 1:
        a = A[mid]
        if a >= K:
            ok = mid
            mid = (ok+ng)//2
            continue
        flg = 0
        l = 0
        r = K-1
        while True:
            if dp_right[N-mid-1][r]:
                break
            r -= 1
        while True:
            if K-a <= l+r < K:
                flg = 1
                break
            elif l+r >= K:
                r -= 1
                if r < 0:
                    break
                while True:
                    if dp_right[N-mid-1][r]:
                        break
                    r -= 1
            else:
                l += 1
                if l >= K:
                    break
                while True:
                    if dp_left[mid][l]:
                        break
                    l += 1
                    if l >= K:
                        break
        if flg:
            ok = mid
        else:
            ng = mid
        mid = (ok+ng)//2
    print(ng+1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 100572
def a(t,i):
    if i == n-1:
        return sum(map(int,t.split("+")))
    return a(t+s[i+1],i+1)+ a(t+"+"+s[i+1],i+1)

s = input()
n = len(s)
i=0
print(a(s[0],0))


Measured memory_bytes: 9180
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <deque>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = 1LL<<60;
const ll MOD = 1000000007;

//cout << fixed << setprecision(10);

int main() {
    ll N;
    cin >> N;
    vector<ll> H(N);
    for(int i=0;i<N;i++) cin >> H[i];

    ll ans=0;
    ll now = H[0];
    ll tmp=0;
    for(int i=1;i<N;i++){
        if(H[i]<=now){
            tmp++;
        }
        else{
            ans=max(ans,tmp);
            tmp=0;
        }
        now=H[i];
    }
    ans=max(ans,tmp);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {

	int n, x, m[1001], sum, min, i;

	scanf("%d%d", &n, &x);
	scanf("%d", m);

	min = m[0];
	sum = m[0];

	for (i = 1; i < n; i++) {
		scanf("%d", m + i);
		sum += m[i];

		if (m[i] < min) {
			min = m[i];
		}
	}

	x -= sum;
	x /= min;

	printf("%d", x + n);

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define mp make_pair
#define S second
#define F first
ll mod=1e9+7;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define input_from_file  freopen("input.txt", "r", stdin);
using namespace std::chrono; 
ll fun(ll a,ll b,ll m){
  ll ans=1;
  while(b>=1){
    if(b&1) ans=(ans*a)%m;
    a=(a*a)%m;
    b=b/2;
  }
  return ans%m;
}
int main()
{ 
  // input_from_file
  fastIO
  ll n;cin>>n;string s;cin>>s;
  vector<ll> dp(2e5+5,0);
  for(int i=1;i<=2e5+4;i++){
    ll x=i,val=0;
    while(x!=0){
      if(x&1) val++;
      x=x>>1;
    }
    dp[i]=dp[i%val]+1;
  }
  // for(int i=0;i<=n;i++) cout<<dp[i]<<" ";cout<<endl;
  ll ctr=0;
  for(int i=0;i<n;i++){
    if(s[i]=='1') ctr++;
  }
  
  ll plus_one=0,minus_one=0;
  ll val=1;
  for(int i=n-1;i>=0;i--){
    plus_one+=(s[i]-'0')*val;
    plus_one=plus_one%(ctr+1);
    val=val*2;
    val=val%(ctr+1);
  }
  ll x;
  if(ctr==1){
    for(int i=0;i<n;i++){
      if(s[i]=='1') cout<<0<<endl;
      else{
        x=(plus_one+fun(2,n-1-i,ctr+1))%(ctr+1);
        cout<<dp[x]+1<<endl;
      }
    }
    return 0;
  }
  val=1;
  for(int i=n-1;i>=0;i--){
    minus_one+=(s[i]-'0')*val;
    minus_one=minus_one%(ctr-1);
    val=val*2;
    val=val%(ctr-1);
  }
  // cout<<"ctr="<<ctr<<" ,plus_one="<<plus_one<<" ,minus_one="<<minus_one<<endl;
  // cout<<fun(2,21,ctr+1)<<endl<<endl;;
  for(int i=0;i<n;i++){
    if(s[i]=='1')
      x=(minus_one-fun(2,n-1-i,ctr-1)+(ctr-1))%(ctr-1);
    else   
      x=(plus_one+fun(2,n-1-i,ctr+1))%(ctr+1);
    cout<<dp[x]+1<<endl;
  }
  // cout<<"aaaaaaaa";
  return 0;
}  



Measured memory_bytes: 5164
import java.util.Scanner;
class Main{
	public static void main(String[] args){
    	Scanner console = new Scanner(System.in);
    	int N = console.nextInt();
      int M = console.nextInt();
      
      int[] arr = new int[N];
      for(int i = 0; i < N; i++){
         arr[i] = console.nextInt();
      }
      int count = 0;
      int sum = 0;
      for(int num : arr){
         sum += num;
      }
      double min = sum / (4.0 * M);
      for(int num : arr){
         if((double)num >= min){
            count++;
         }
      }
      if(count >= M){
         System.out.println("Yes");
      }else{
         System.out.println("No");
      }
   }
	
}

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

N,W = map(int,readline().split())

import numpy as np

dp = np.zeros(W + 1, dtype = int)

for i in range(N):
  w,v = map(int,readline().split())
  np.maximum(dp[:-w] + v, dp[w:], out = dp[w:])
  
print(dp.max())

Measured memory_bytes: 29084
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <fstream>
#include <bitset>
#include <map>
#include <queue>
#include <complex>
#include <assert.h>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <stack>
#include <numeric>

typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair

using namespace std;

vector<pair<int, int> > pts;

int ct(int x1, int x2, int y1, int y2){
	int c = 0;
	for(const pair<int, int> &p : pts){
		int x = p.first, y = p.second;
		if(x1 <= x && x <= x2 && y1 <= y && y <= y2) c++;
	}
	return c;
}

ll minarea = -1;

void update(int x1, int x2, int y1, int y2){
	ll area = (x2 - x1) * 1ll * (y2 - y1);
	if(minarea == -1) minarea = area;
	else minarea = min(minarea, area);
}

int main(){
	int z, n;
	cin >> n >> z;
	
	set<int> xp, yp;
	for(int i=0; i<n; i++){
		int x, y;
		cin >> x >>y;
		pts.pb({x, y});
		xp.insert(x);
		yp.insert(y);
	}
	vector<int> xxp, yyp;
	for(int u : xp) xxp.pb(u);
	for(int u : yp) yyp.pb(u);

	
	for(int i = 0; i < xxp.size(); i++){
		for(int j = i; j < xxp.size(); j++){
			for(int k = 0; k< yyp.size(); k++){
				for(int l = k; l<yyp.size(); l++){
					if(ct(xxp[i], xxp[j], yyp[k], yyp[l]) >= z){
						update(xxp[i], xxp[j], yyp[k], yyp[l]);
					}
				}
			}
		}
	}
	cout << minarea << endl;

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if ((n-n/1000*1000)%111!=0&&(n-n%10)%111!=0)
		cout<<"No"<<endl;
	else
		cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

char want_find[11], rings[112][11];
int N;
bool flag = true;
int ans = 0;

int main(void) {
	scanf("%s%d", &want_find, &N);
	for (int i = 0; i < N; ++i) { scanf("%s", &rings[i]); }

	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < strlen(rings[i]); ++j) {
			flag = true;
			for (int k = 0; k < strlen(want_find); ++k) {
				if (rings[i][(j + k) % strlen(rings[i])] != want_find[k]) {
					flag = false;
					break;
				}
			}
			if (flag == true) { ++ans; break; }
		}
	}

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

Measured memory_bytes: 2688
N, M = map(int, input().split())
edges = [tuple(map(int, input().split())) for _ in range(M)]
ans = 0
for bridge in range(M):
    E = edges[0:bridge] + edges[bridge + 1:M]
    wf = [[1 for _ in range(N + 1)] for _ in range(N + 1)]
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            if i == j:
                wf[i][j] = 0
            if (min(i, j), max(i, j)) in E:
                wf[i][j] = 0
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            for k in range(1, N + 1):
                if wf[j][k] > wf[j][i] + wf[i][k]:
                    wf[j][k] = wf[j][i] + wf[i][k]
    if wf[1][1:] != [0] * N:
        ans += 1
print(ans)

Measured memory_bytes: 3064
# 標準入力
n,m = map(int,input().split())
s,c = [],[]
for i in range(m):
    ss,cc = map(int,input().split())
    s.append(ss)
    c.append(cc)

# コンフリクト判定
memo = [-1 for i in range(n)]
flag = 1
for ss,cc in zip(s,c):
    if memo[ss-1] in [-1, cc]: memo[ss-1] = cc
    else: flag = 0 ; break

if memo[0]==-1: memo[0] = 0 if n==1 else 1
if memo[0]==0 and n != 1: flag = 0
memo = [str(max(0,ele)) for ele in memo]

if flag: print("".join(memo))
else: print(-1)


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007)



int I_Love_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(a,b)<<" "<<max(0,a+b-n);
	
	
	return 0;
}


Measured memory_bytes: 256
import collections

n=int(input())

p=n
e=1
count=0
            

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

for i in list(set(prime_factorize(n))):
    #print(i)
    e=1
    while i**e<=p:
        a=i**e
        #print("aは",a)
        #print("nは",n)
        if n%a==0:
            n=n/a
            count+=1
        e+=1

print(count)

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

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double eps = 1e-7;
#define Loop(i, n) for(int i = 0; i < int(n); i++)
#define Loopll(i, n) for(ll i = 0; i < ll(n); i++)
#define Loop1(i, n) for(int i = 1; i <= int(n); i++)
#define Loopll1(i, n) for(ll i = 1; i <= ll(n); i++)
#define Loopr(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = ll(n) - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = int(n); i >= 1; i--)
#define Looprll1(i, n) for(ll i = ll(n); i >= 1; i--)
#define Foreach(buf, container) for(auto buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
#define INF INFINITY
bool feq(double x, double y) { return abs(x - y) <= eps; }
bool inrange(ll x, ll t) { return x >= 0 && x < t; }
bool inrange(vll xs, ll t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
int ceillog2(ll x) { int ret = 0;	x--; while (x > 0) { ret++; x >>= 1; } return ret; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

/*******************************************************/

int main() {
	ll n, k; cin >> n >> k;
	if (k == 1) {
		cout << 0 << endl;
	}
	else {
		cout << n - k << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
#include <atcoder/all>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    atcoder::scc_graph graph(n);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        graph.add_edge(a, b);
    }

    V< V<int> > groups = graph.scc();
    cout << groups.size() << '\n';
    for (auto es: groups) {
        int esz = es.size();
        cout << esz;
        for (int e: es) cout << ' ' << e;
        cout << '\n';
    }
    return 0;
}


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

int main() {
  
  string s;
  cin >> s;
  
  int price = 700;
  for(int i=0; i<3; i++){
    if(s.at(i)=='o') price += 100;
  }
  
  cout << price << endl;
}

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

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

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

const int max_n = 100000+10;
Int dp[max_n][2]; //dp[digit][flag],flag=0or1 0: just, 1: smaller

int main(void) {
    string L;
    cin>>L;

    dp[0][0] = 1;
    for(int i = 0;i < L.size();i++) {
        if(L[i] == '1') {
            //a+b = 0
            dp[i+1][1] += (dp[i][0]+dp[i][1]);
            //a+b  = 1
            dp[i+1][0] += 2*dp[i][0];
            dp[i+1][1] += 2*dp[i][1];
        } else {
            //a+b = 0
            dp[i+1][0] += dp[i][0];
            dp[i+1][1] += dp[i][1];
            //a+b =1
            dp[i+1][1] += 2*dp[i][1];
        }
        dp[i+1][0] %= MOD;
        dp[i+1][1] %= MOD;
    }

    cout<<(dp[L.size()][0]+dp[L.size()][1])%MOD<<endl;


    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

void fc(vector<ll> &po, ll n){
  ll power = 1;
  rep(i, po.size()){
    power <<= 1;
    ll now = n;
    po.at(i) = now/power * (power/2);
    now %= power;
    cerr << now << endl;
    now++;
    now -= power/2;
    if(now > 0) po.at(i) += now;
  }
}

int main(){
  ll a, b;
  cin >> a >> b;
  a--;
  vector<ll> po_a(45, 0), po_b(45, 0);
  fc(po_a, a);
  fc(po_b, b);
  ll ans = 0;
  ll add = 1;
  rep(i, po_b.size()){
    ll now = po_b.at(i) - po_a.at(i);
    cerr << po_b.at(i) << " " << po_a.at(i) << endl;
    if(now % 2 == 1) ans += add;
    add <<= 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

const int MOD = 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void    Main()
{
    ll    n;
    cin >> n;
    vector<pair<ll, ll>> P(n);
    rep(i, n)
        cin >> P.at(i).second >> P.at(i).first;
    sort(P.begin(), P.end());
    // 累計をとっていって、それよりも低いかをみていくだけ
	ll	total;
	total = 0;
	rep(i, n)
	{
		total += P.at(i).second;
		if (P.at(i).first < total)
		{
			cout << "No" << endl;
			return ;
		}
	}
	cout << "Yes" << endl;
}
// END

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

Measured memory_bytes: 3456
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int H, W;
    
    while(true){
        cin >> H >> W;
        if(H == 0 && W == 0) break;
        
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if(i == 0 || i == H-1 || j == 0 || j == W-1){
                    cout << "#";
                }
                else cout << ".";
            }
            cout << endl;
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3060
# ABC134E

import sys
input=sys.stdin.readline

def bisectR(ite,x):
    st=-1
    en=len(ite)
    while(en-st>1):
        mid=(en+st)//2
        if ite[mid]<x:
            en=mid
        else:
            st=mid
    return en

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    lbds=[A[0]]
    for i in range(1,N):
        if lbds[-1]>=A[i]:
            lbds+=[A[i]]
        else:
            x=bisectR(lbds,A[i])
            lbds[x]=A[i]
    print(len(lbds))
    
if __name__=="__main__":
    main()


Measured memory_bytes: 82476
#include <stdio.h>

int A[105];

int main(){

	int N;

	scanf("%d",&N);

	int i;

	int ma=0;
	int mi=1<<30;

	for(i=0;i<N;i++){
	scanf(" %d",&A[i]);
	if(mi>A[i]){mi=A[i];}
	if(ma<A[i]){ma=A[i];}
	}

	printf("%d\n",ma-mi);

	return 0;
}

Measured memory_bytes: 128
sa=(1,3,5,7,8,10,12,)
sb=(4,6,9,11,)
sc=(2,)
l=[sa,sb,sc]

a,b=map(int,input().split())
for ss in l:
  if a in ss and b in ss:
    print("Yes")
    exit()
print("No")
  

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

int main() {
    int N, K, Q;
    cin >> N;
    cin >> K;
    cin >> Q;
    int A[Q];
    int Score[N];
    for(int i=0; i<N; i++){
        Score[i] = 0;
    }

    string judge;

    for(int i=0; i<Q; i++){
        cin >> A[i];
        Score[ A[i] - 1] ++;
    }
    for(int i=0; i<N; i++){
        if( (Q-Score[i]) >= K)
            judge = "No";
        else
            judge = "Yes";
        cout << judge << endl;
    }
    return 0;
}

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

using namespace std;

#define int 		long long
#define endl		"\n"
#define mod			1000000007
#define IOS			ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

int32_t main() {

	IOS;

	int x, y, c = 0, t;
	cin >> x >> y;
	bool valid = false;

	t = x;

	while (t >= 0) {
		if ( t * 4 + c * 2 == y) {
			valid = true;
			break;
		}
		else
			t--, c++;
	}

	if (valid)
		cout << "Yes\n";
	else
		cout << "No\n";

	return 0;
}

Measured memory_bytes: 3652
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

ll nl, nm;

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

  ll x;
  cin >> x;
  ll ans = 0LL;
  ll t1 = x/11;
  ll t2 = x%11;
  ans = 2*t1;  
  if(0 < t2 && t2 <= 6) ans++;
  else if(7 <= t2 && t2 <= 10) ans+=2;

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


Measured memory_bytes: 256