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

int main() {
    vector<string> s(3);
    for (auto& e : s) cin >> e;
    vector<int> is(3);
    int t = 0;
    while (is[t] != (int) s[t].size()) t = s[t][is[t]++] - 'a';
    cout << (char) ('A' + t) << endl;
}


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

int main() {
    int num_query; scanf("%d", &num_query);
    int command, x;
    set<int> S;
    
    for (int i = 0; i < num_query; ++i) {
        scanf("%d%d", &command, &x);
        switch (command) {
            case 0:
                S.insert(x);
                printf("%d\n", (int) S.size());
                break;
            case 1:
                int find_result = 0;
                if (S.find(x) != S.end()) find_result = 1;
                printf("%d\n", find_result);
                break;
        }
    }
    return 0;
}


Measured memory_bytes: 12472
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int c=0;
    for(int i=1;i<s.size();i++){
        if(s[i]==s[i-1]){
            c=1;
        }
    }
    if(c){
        cout<<"Bad";
    }
    else{
        cout<<"Good";
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <utility>
#include <complex>
using namespace std;

#define _gp(l) const auto gcu{getchar##l}; const auto pcu{putchar##l}
#ifdef __linux
_gp(_unlocked);
#else
_gp();
#endif
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template<typename T>
#define _HT template<typename H,typename... T>
_T _DEF(T,in,int c){T n{};int m{1};while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int,in,){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_SCAN(char &c){c=gcu();gcu();return c!=EOF;}
_T _SCAN(T &n){int c{gcu()};return c==EOF?false:(n=in<T>(c),true);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=(char)c;}}
_OUT(string s){for(char c:s)pcu(c);}
#endif
_OUT(const char *s){while(*s)pcu(*s++);}
_T _OUT(T n){static char b[20];char *p{b};T m=n<0?pcu('-'),-1:1;if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{int e,b{0},s{1};range(int _b,int _e,int _s):e(_e),b(_b),s(_s){}range(int _b,int _e):e(_e),b(_b){}range(int _e):e(_e){}
	struct it{int v,s;it(int _v,int _s):v(_v),s(_s){}operator int()const{return v;}operator int&(){return v;}int operator*()const{return v;}it& operator++(){v+=s;return *this;}};
	it begin(){return{b, s};}it end(){return{e,s};}bool inner(int n){return b<=n&&n<e;}};

using P = complex<double>;

P read() {
	double x = in();
	return P(x, in());
}

P line() {
	P a {read()};
	return read() - a;
}

int main() {
	for (int n {in()}; n; n--) {
		P a {line()}, b {line()}, d {conj(a) * b};
		outl(real(d) ? imag(d) ? 0 : 2 : 1);
	}
}


Measured memory_bytes: 2628
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

using namespace std;

#define li long long int
#define ld long double
const li MX1 = 1e5 + 5;
const li MX2 = 1e6 + 5;
const li inf = 4e18;
const li mod = 1e9 + 7;

li power(li a, li b) { li res = 1; while (b) { if (b % 2) res = (res * a) % mod;
a = (a * a) % mod; b /= 2; } return res; }

li mmi(li a) { return power(a, mod - 2); }

li cntbit(li n) { li cnt = 0; while (n) { n &= (n - 1); cnt++; } return cnt; }

int n, m;
vector<pair<int, int> > v;

void solve() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		v.push_back(make_pair(y, x));
	}
	sort(v.begin(), v.end());
	int ans = 1;
	int prev = v[0].first;
	for (int i = 1; i < m; i++) {
		if (v[i].second >= prev) {
			ans++;
			prev = v[i].first;
		}
	}
	cout << ans;
}

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

Measured memory_bytes: 1400
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"

int main()
{
	int n,i,j,ck=0;
	cin>>n;
	for1(i,9){
		for1(j,9){
			if(i*j == n){
				ck=1;
				break;
				}
			}
		}
	pf(ck? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	return ints
}
func sortInc(ar []int) []int {
	sort.Ints(ar)
	return ar
}

func mix(ingredients []int) float64 {
	ingredients = sortInc(ingredients)
	il := float64(ingredients[0])
	for _, ir := range ingredients {
		il = (il + float64(ir)) / 2.0
	}
	return il
}
func main() {
	n := nextInt()
	ingredients := nextInts(n)
	fmt.Println(mix(ingredients))
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;


int main(){

    long long N;
    long long a,b;
    cin>>N>>a>>b;

    long long ans=(N/(a+b))*a;
    N%=(a+b);
    if(N>=a){
        ans+=a;
    }
    else{
        ans+=N;
    }
    cout<<ans<<endl;

    return 0;

}
/*


*/


Measured memory_bytes: 256
//
//  main.cpp
//  ABC155C
#include <iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int main(int argc, const char * argv[]) {
    int N;
    cin>>N;
    string S;
    map<string,int>poll;
    int great=0;
    for (int i=0; i<N; i++) {
        cin>>S;
        if (poll.count(S)==0) { // 初出
            poll[S]=1;
        }else{
            poll[S]++; // 既出
        }
        great=max(poll[S],great); // 出現回数の最大値 great
    }
    vector<string>ans;
    for (auto itr=poll.begin(); itr!=poll.end(); ++itr) {
        if(itr->second==great){
            //ans.at(j)=(itr->first);
            //j++;
            ans.push_back(itr->first);
        }
    }
    sort(ans.begin(),ans.end()); // 昇順にソート
    unsigned long length=ans.size();
    for (long i=0; i<length; i++) {
        cout<<ans.at(i)<<endl;
    }
    return 0;
}


Measured memory_bytes: 26868
#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

#define MOD 1000000007




int dp[5001][5001];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	string s;
	cin >> n;
	cin >> s;

	dp[0][0] = 1;
	rep(i,n)rep(j,i+1)if(dp[i][j]) {
		(dp[i + 1][j + 1] += dp[i][j]) %= MOD;
		(dp[i + 1][j + 1] += dp[i][j]) %= MOD;
		(dp[i + 1][max(0, j - 1)] += dp[i][j]) %= MOD;
	}
	int inv2 = MOD / 2 + 1;
	long long ans = dp[n][s.size()];
	rep(i, s.size())(ans *= inv2) %= MOD;
	cout << ans << endl;

	return 0;
}





/*
int dp[2][301][301];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	string s;
	cin >> n;
	cin >> s;
	dp[0][0][0] = 1;
	int(*cur)[301] = dp[0], (*nxt)[301] = dp[1];

	rep(i,n) {
		memset(nxt, 0, sizeof(dp[0]));
		rep(j,i+1)rep(k,j+1)if(cur[j][k]) {
			int d = cur[j][k];
			//0
			if (k < s.size() && j==k && s[k] == '0')(nxt[j + 1][k + 1] += d) %= MOD;
			else (nxt[j + 1][k] += d) %= MOD;
			//1
			if (k < s.size() && j==k &&s[k] == '1')(nxt[j + 1][k + 1] += d) %= MOD;
			else (nxt[j + 1][k] += d) %= MOD;
			//B
			if (j)(nxt[j - 1][min(j - 1, k)] += d) %= MOD;
			else (nxt[0][0] += d) %= MOD;
		}
		swap(cur, nxt);
	}
	cout << cur[s.size()][s.size()] << endl;
	
	return 0;
}*/

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

int cnt, ans;
string s;

int main() {
    cin >> s;
    for (int i = 0; i < s.length(); i++){
        if (s[i] == 'R'){
            cnt++;
            ans = max(ans, cnt);
        }
        else cnt = 0;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i<n;i++)
int main(){
int n, count[4]={0};
cin >> n;
string a[n];
rep(i,n) cin >> a[i];
rep(i,n){
    if(a[i]=="P")count[0]++;
    if(a[i]=="G")count[1]++;
    if(a[i]=="W")count[2]++;
    if(a[i]=="Y")count[3]++;
}
int m=1;
rep(i,4){m *= count[i];}
if(m==0){
    cout << "Three" << endl;
}else{
    cout << "Four" << endl;
}
return 0;
}

Measured memory_bytes: 256
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  ll k,a,b;

  cin >> k >> a >> b;

  ll ans = 0;

  if(b <= a + 2)
  {
    ans = k + 1;
  }
  else
  {
    k -= a - 1;
    ans = a;

    ans += (b - a) * (k / 2);
    ans += k % 2 ? 1 : 0;
  }

  cout << ans << endl;
  

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#define M 2100000000
using namespace std;
int main(void)
{
	int dp[2][5001][2];
	int i,j,ti[10001],n,ii;
	scanf("%d",&n);
	for(i=0;i<n-1;i++) scanf("%d",&ti[i]);
	for(i=0;i<=n/2;i++) {
		dp[0][i][0]=M;
		dp[0][i][1]=M;
	}
	dp[0][1][1]=0;
	dp[0][0][0]=0;
	ii=0;
	for(i=0;i<n-1;i++) {
		for(j=0;j<=n/2;j++) {
			dp[ii+1][j][0]=M;
			dp[ii+1][j][1]=M;
		}
		for(j=0;j<=n/2;j++) {
			if(dp[ii+1][j][0]>dp[ii][j][0]) 
				dp[ii+1][j][0]=dp[ii][j][0];
			if(j<n/2 && dp[ii+1][j+1][1]>dp[ii][j][1])
				dp[ii+1][j+1][1]=dp[ii][j][1];
			if(dp[ii+1][j][0]>dp[ii][j][1]+ti[i])
				dp[ii+1][j][0]=dp[ii][j][1]+ti[i];
			if(j<n/2 && dp[ii+1][j+1][1]>dp[ii][j][0]+ti[i])
				dp[ii+1][j+1][1]=dp[ii][j][0]+ti[i];
		}
		for(j=0;j<=n/2;j++) {
			dp[ii][j][0]=dp[ii+1][j][0];
			dp[ii][j][1]=dp[ii+1][j][1];
		}
/*	for(j=0;j<=n/2;j++) printf("%10d",dp[ii][j][0]);
		printf("\n");
	for(j=0;j<=n/2;j++) printf("%10d",dp[ii][j][1]);
		printf("\n");*/
	}
	printf("%d\n",dp[0][n/2][1]);
	return 0;
}
		
			
	
	

Measured memory_bytes: 1140
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    int ans = 0;
    string s; cin >> s;
    string t = "keyence";
    
    if(s == t){
        put("YES");
        return 0;
    }

    for(int i = 0; i < t.size(); i++){
        for(int j = i+1; j < s.size(); j++){
            //put(s.substr(0,i) + s.substr(j,s.size()-1));
            if(t == s.substr(0,i) + s.substr(j,s.size())){
                ans++;
            }
        }
    }

    put((ans?"YES":"NO"));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxN = 100100;
int dp[maxN];
vector<int> nums(maxN);
int solve(int idx,int n) {
	if (idx + 1 >= n) {
		return 0;
	}
	if (dp[idx] != -1) {
		return dp[idx];
	}
	if (idx + 2 < n) {
		return dp[idx] = min(abs(nums[idx] - nums[idx + 1]) + solve(idx + 1,n),abs(nums[idx] - nums[idx + 2]) + solve(idx + 2,n));
	} else {
		return dp[idx] = abs(nums[idx] - nums[idx + 1]) + solve(idx + 1,n);
	}
}
int main () {
	 ios::sync_with_stdio(false);
	 cin.tie(nullptr);
	 cout.tie(nullptr);
	 int n;
	 cin >> n;
	 for (int i = 0; i < n; i++) {
		 cin >> nums[i];
	 }
	 memset(dp,-1,sizeof(dp));
	 cout << solve(0,n);
}



Measured memory_bytes: 7840
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lim 1000000
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define eps 1e-8
#define INF 1e10
#define F first
#define S second
#define sd(n) scanf("%lld",&n)
#define pd(n) printf("%.9lf\n",n)
vector<ll> p[lim+1];
int main()
{ 
    string s;
    cin>>s;
    ll c=0,f=0;
    for(ll i=0;i<s.length();i++)
    {
        if(s[i]=='C')
            c++;
        if(s[i]=='F'&&c>0)
            f++;
    }
    if((f*c)!=0)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 23808
import sys
import collections
def solve():
    sys.setrecursionlimit(100000)
    mod = 998244353

    N = int(input())
    D = list(map(int, input().split()))
    ans = 1
    if D[0] != 0:
        ans = 0
        print(ans)
        exit(0)
    
    cnter = collections.Counter(D)
    cnter = sorted(cnter.items())

    if cnter[0][0] != 0 or cnter[0][1] != 1 : 
        ans = 0
    elif len(cnter) == 1:
        ans = 1
    elif cnter[1][0] != 1:
        ans = 0
    else:
        for i in range(2, len(cnter)):
            if cnter[i][0] != i:
                ans = 0
                break

            else:
                ans = ans * modpow(cnter[i-1][1], cnter[i][1], mod) % mod
    
    print(ans)


def modpow(a,n,p):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

if __name__ == '__main__':
    solve()


Measured memory_bytes: 64044
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int k;
  cin >> k;
  char c = s[k - 1];
  for (int i = 0; i < (int) s.size(); i++) {
    if (s[i] == c) continue;
    s[i] = '*';
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
const int N=100005;
int n;
long long x;
long long f[N];
long long l[N];
long long calc(int d,long long r)
{
	if (r<=0)
		return 0;
	if (!d)
		return r>0;
	long long ret=0;
	if (r>=l[d-1]+1)
		ret+=f[d-1];
	if (r<l[d-1]+1)
		ret+=calc(d-1,r-1);
	if (r>=l[d-1]+2)
		ret+=calc(d-1,r-l[d-1]-2)+1;
	return ret;
}
int main()
{
	scanf("%d%lld",&n,&x);
	f[0]=1;
	l[0]=1;
	for (int i=1;i<=n;i++)
	{
		f[i]=2ll*f[i-1]+1;
		l[i]=2ll*l[i-1]+3;
	}
	printf("%lld\n",calc(n,x));
	return 0;
}

Measured memory_bytes: 128
l,r=map(int,input().split())
if l==0:
    print(0)
elif r*(r-1)<2019:
    print(l*(l+1))
else:
    ans=2018
    for i in range(l,r):
        for j in range(i+1,r+1):
            if i*j%2019<ans:
                ans=i*j%2019
            elif i*j%2019==ans:
                print(ans)
                exit()
    print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
  int H,W;
  while(1){
    scanf("%d%d",&H,&W);
    if(H==0 && W==0) break;
    int i,j;
    for(i=0;i<H;i++){
      printf("#");
      for(j=1;j<W-1;j++){
	if(i==0 || i==H-1) printf("#");
	else printf(".");
      }
      printf("#\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 588
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}

int32_t main()
{
	c_p_c();
	int n; cin >> n;
	string s; cin >> s;

	if (n >= 3200)
		cout << s << '\n';
	else
		cout << "red\n";
	return 0;
}

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

int d[110],f[110];
bool visited[110];
int timestamp = 1;

int n; vector<vector<int>> to;

void dfs(int u){
  if( visited[u] ){ return ;}
  visited[u] = true;
  d[u] = timestamp;
  timestamp++;
  for(auto ne : to[u]){
    if(visited[ne]){continue;}
    dfs(ne);
  }
  f[u] = timestamp;
  timestamp++;
  
  return ;
}
  

signed main(void){
  cin >> n;
  to.resize(n);
  for(int i = 0; i < n; i++){
    int u,k; cin >> u >> k; u--;
    for(int j = 0; j < k; j++){
      int a; cin >> a; a--;
       to[u].push_back(a);
    }
  }
  
  for(int i = 0; i < n; i++){ 
    sort(to[i].begin(),to[i].end());
  }
  
  for(int i = 0; i < n; i++){ dfs(i);}
  
  for(int i = 0; i < n; i++){ cout << i+1 << " " << d[i] << " "<< f[i] << endl;}
  
  return 0;
}


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

int main()
{
    double a,b;
    int x,y;
    cin>>x>>y;
    a=(2*x)-(y/2.0);
    b=x-a;
    if(a>=0 && b>=0 && a==(int)a && b==(int)b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;




    return 0;
}



Measured memory_bytes: 3628
#include <stdio.h>
#include <math.h>
#define EPS 0.00001

int main(void) {
	int n;
	double x;
	double x2;
	double x3;
	while (scanf("%d", &n), n!=-1) {
		x = (double)n / 2;
		while (!(fabs(x*x*x - n) < EPS*(double)n)){
			x = x - ((x*x*x - n) / (3 * x*x));
		}
		printf("%f\n", x);
	}
	return 0;
}

Measured memory_bytes: 1060
from collections import deque
s = input()
qq = int(input())
q = []
for _ in range(qq):
  q.append(input())
h = 1
for i in q:
  if i[0] == '1':
    h*=-1
if h == -1:
  ss = ''
  for i in reversed(s):
    ss += i
  s = ss
d = deque()
d.append(s)
h = 1
for i in q:
  if i[0] == '1':
    h*=-1
  else:
    if (h == 1 and i[2] == '1') or (h == -1 and i[2] == '2'):
      d.appendleft(i[4])
    else:
      d.append(i[4])
p = ''
if h == -1:
  for i in reversed(d):
    p += i
else:
  for i in d:
    p += i
print(p)

Measured memory_bytes: 18744
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
# import numpy as np
# import scipy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]

def main():

    n,a,b = inpm()
    x = b-a
    if x%2==0:
        print(int(x//2))
        return
    else:
        n1 = b-1
        n2 = n-a
        n3 = a+int( (b-a-1)//2 )
        n4 = n-b+1+int( (b-a-1)//2 )
        print(min(n1, n2, n3, n4))
        return

if __name__ == "__main__":
    main()

Measured memory_bytes: 39148
# -*- coding: utf-8 -*-

N = int(input())
S = input()

black_number = S.count('#')
black_number_list = [(0,black_number)]
for i in range(N):
    if S[i] == '#':
        black_number_list.append((black_number_list[i][0] + 1, black_number_list[i][1] - 1))
    else:
        black_number_list.append(black_number_list[i])

output = N

for i in range(len(black_number_list)):
    number = (black_number_list[i][0]) + (N - i - black_number_list[i][1])
    if number < output:
        output = number

print (output)

Measured memory_bytes: 30208
#include <iostream>
#include <cstdio>
#include <vector>
#include <array>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <random>
#include <bitset>
#include <cassert>
#include <tuple>
#include <list>
#include <iterator>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <complex>

using namespace std;

typedef long long ll;
typedef long double ld;

template<class htpe, class cmp>
using heap = priority_queue<htpe, vector<htpe>, cmp>;

template<class htpe>
using min_heap = heap<htpe, greater<htpe> >;

template<class htpe>
using max_heap = heap<htpe, less<htpe> >;

#define mp make_pair
#define pb push_back
#define mt make_tuple
#define ff first
#define ss second

#define forn(i, n) for (int i = 0; i < ((int)(n)); ++i)
#define forrn(i, s, n) for (int i = (int)(s); i < ((int)(n)); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define PYMOD(a, m) ((((a) % (m)) + (m)) % (m))

const int INF = 1791791791;
const ll INFLL = 1791791791791791791ll;

struct desire {
    int x, y; char c;
};

int k;
char color(int x, int y) {
    if (((x / k) + (y / k)) % 2 == 0)
        return 'B';
    else
        return 'W';
}

int a[2179];

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

    int n;
    cin >> n >> k;

    vector<desire> ds(n);

    forn(i, n)
        cin >> ds[i].x >> ds[i].y >> ds[i].c;

    int ans = 0;

    forn(i, k) {
        memset(a, 0, sizeof(a));
        for (desire d : ds) {
            if (color(d.x, d.y + i) == d.c) {
                a[0]++;
                a[k - d.x % k]--;
                a[2 * k - d.x % k]++;
                a[2 * k]--;
            } else {
                a[k - d.x % k]++;
                a[2 * k - d.x % k]--;
            }
        }
        int cur = 0;
        forn(j, 2 * k) {
            cur += a[j];
            ans = max(ans, cur);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int sx, sy, tx, ty; readV(sx, sy, tx, ty);

  auto x = tx-sx, y = ty-sy;
  auto w(dchar c, int l) { write(c.repeat.take(l)); }

  w('U', y);
  w('R', x);
  w('D', y);
  w('L', x);

  w('L', 1);
  w('U', y+1);
  w('R', x+1);
  w('D', 1);

  w('R', 1);
  w('D', y+1);
  w('L', x+1);
  w('U', 1);
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int n, val, i, j, k, cnt, max, exist[26];
	char c, s[101];
	val = scanf("%d%s", &n, &s);
	if (val == 0) return 1;

	int count(){
		for (j = 0; j < 26; j++) exist[j] = 0;
		cnt = 0;
		for (j = 0; j < i; j++) {
			c = s[j];
			if (exist[c - 'a']) continue;
			else exist[c - 'a'] = 1;
			for (k = i; k < n; k++) {
				if (c == s[k]) {
					cnt++;
					break;
				}
			}
		}
		return cnt;
	}

	max = 0;
	for (i = 1; i < n; i++) {
		val = count();
		if (val > max) max = val;
	}

	printf("%d", max);
	return 0;
}


Measured memory_bytes: 128
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

import collections
import itertools
import operator


class UnionFind:
    def __init__(self, x):
        class KeyDict(dict):
            def __missing__(self, key):
                self[key] = key
                return key

        self.parent = KeyDict()
        self.rank = collections.defaultdict(int)
        self.size = collections.defaultdict(lambda: 1)
        if x is not None:
            for elem in range(x+1):
                _, _, _ = self.parent[elem], self.rank[elem],self.size[elem]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if not self.are_same(x,y):
            xx = self.size[x]
            yy = self.size[y]
            if self.rank[x] < self.rank[y]:
                self.parent[x] = y
                self.size[y] += xx
            else:
                self.parent[y] = x
                self.size[x] += yy
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1

    def Size(self,x):
        return self.size[self.find(x)]

    def are_same(self, x, y):
        '''print(x,y,self.find(x),self.find(y),self.find(x) == self.find(y))'''
        return self.find(x) == self.find(y)

    def grouper(self):
        roots = [(x, self.find(x_par)) for x, x_par in self.parent.items()]
        root = operator.itemgetter(1)
        for _, group in itertools.groupby(sorted(roots, key=root), root):
            yield [x for x, _ in group]

N,M = m()

uf = UnionFind(N-1)

fa = [-1 for i in range(M)]

for i in range(N):
    a = l()

    for j in range(a[0]):
        j += 1
        if fa[a[j]-1] == -1:
            fa[a[j]-1] = i
        else:
            uf.unite(fa[a[j]-1],i)

po = list(uf.grouper())

if len(po) == 1:
    print("YES")
else:
    print("NO")





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

typedef long long ll;
typedef unsigned long long ull;

#define F first
#define S second
#define ALL(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define INT_MAXI 2147483647
#define INT_MINI -2147483648
#define REV(a) reverse(a.begin(),a.end())
#define NP(a) next_permutation(a.begin(),a.end())

typedef pair<int,int> pi;
typedef pair<ll,ll> pl; 

ll dt[200005];
ll sum[200005];


int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//cout<<"input"<<endl;freopen("input.txt","r",stdin);
	//cout<<"output"<<endl;freopen("output.txt","w",stdout);
	int n;
	cin>>n;

	ll modu = 1e9 + 7;

	FORN(i,1,n){
		cin>>dt[i];
	}
	sum[n] = dt[n];
	for(int i=n-1;i>=2;i--){
		sum[i] = (sum[i+1] + dt[i])%modu;
	}

	ll tot = 0;
	for(int i=1;i<=n-1;i++){
		ll x = (dt[i]*sum[i+1])%modu;
		tot = (tot + x)%modu;
	}
	
	cout<<tot<<endl;
}


Measured memory_bytes: 6776
#include <bits/stdc++.h>
#include <stdint.h>
#include <algorithm>
#include <vector>


using namespace std;

int main() {
	int m,n,total;
	cin >> n >> m;
	vector<int> a(n,0);
	
	total = 0;
	for(int i = 0; i < n; i++) {
		cin >> a.at(i);
		total += a.at(i);
	}
	int lim = total / (4*m);
	if (total % (4*m) > 0) lim++;
	
	//dbg
//	cout << "lim:" << lim << endl;
	
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (a.at(i) < lim) {
			//何もしない
		} else {
			ans++;
		}
	}
	
	//dbg
//	cout << "ans:" << ans << endl;
	
	if (ans >= m) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	
			
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <int,int> PII;
typedef pair <int,string> PIS;
typedef vector <int> vec;
#define pi 3.141592653589793
#define fori(z,n) for(int i=z;i<n;i++)
#define forii(z,n) for(int i=z;i<=n;i++)
int main() 
{ 
    int n,l;
    cin>>n>>l;
    int arr[n+1];
    int sum=0;
    int minPos=INT_MAX;
    int minNeg=-INT_MAX;
    for(int i=0;i<n;i++)
    {
        arr[i]=l+i;
        sum=sum+arr[i];
        if(arr[i]<0 && arr[i]>minNeg)
        {
            minNeg=arr[i];
        }
        else if(arr[i]>=0 && arr[i]<minPos)
        {
            minPos=arr[i];
        }
    }
    /* for(int i=0;i<n;i++) */
    /* { */
    /*     cout<<arr[i]<<endl; */
    /* } */
    /* cout<<minNeg<<"minN"<<endl; */
    /* cout<<minPos<<"minP"<<endl; */
    /* sort(arr2, arr2+n); */
    int diff = (abs(minNeg)<minPos)? minNeg: minPos;
    sum=sum-diff;
    cout<<sum<<endl;
    cerr<<"Time elapsed"<<1.0*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;

struct Edge {
	int a, b, w;
	Edge(){}
	Edge(int a, int b, int w): a(a), b(b), w(w){}
};

int n, c;
Edge g[400];
int dist[100][100];

int solve()
{
	fill_n(*dist, 100 * 100, INF);
	for (int i = 0; i < n; i++) dist[i][i] = 0;
	
	for (int i = 0; i < c * 2; i++){
		int &t = dist[g[i].a][g[i].b];
		t = min(t, g[i].w);
		//printf("%d -> %d %d\n", g[i].a, g[i].b, g[i].w);
	}
	
	for (int k = 0; k < n; k++){
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}
	
	int res = -INF;
	for (int i = 0; i < n; i++){
		if (dist[i][i] < 0){
			return -1;
		}
		if (dist[0][i] < 0){
			return -1;
		}
		res = max(res, dist[0][i]);
	}
	
	return res;
}

int main()
{
	scanf("%d %d", &n, &c);
	vector<int> v;
	
	for (int i = 0; i < c; i++){
		int a, b, w;
		char ch, sg;
		scanf("%d", &a);
		scanf("%c", &ch);
		if (ch != '*') scanf("%*c");
		else v.push_back(i);
		scanf("%d", &b);
		if (ch == '>') swap(a, b);
		scanf("%c", &sg);
		scanf("%d", &w);
		--a; --b;
		
		if (sg == '-') g[i] = Edge(a, b, w);
		else g[i] = Edge(b, a, -w);
		g[i + c] = Edge(b, a, 0);
	}
	
	int res = -1;
	
	for (int x = 0; x < (1 << v.size()); x++){
		for (int k = 0; k < v.size(); k++){
			if (x & (1 << k)){
				swap(g[v[k]].a, g[v[k]].b);
				swap(g[v[k] + c].a, g[v[k] + c].b);
			}
		}
		
		res = max(res, solve());
		
		for (int k = 0; k < v.size(); k++){
			if (x & (1 << k)){
				swap(g[v[k]].a, g[v[k]].b);
				swap(g[v[k] + c].a, g[v[k] + c].b);
			}
		}
	}
	
	if (res == INF) puts("inf");
	else printf("%d\n", res);
}

Measured memory_bytes: 1256
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    s = input()
    for i in range(len(s)):
        print("x", end="")


main()


Measured memory_bytes: 65196
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
#include <cstring>
#include <numeric>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define repll(i,n) for(long long int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
template <typename T_char>
char ToUpper (char cX) { return toupper(cX); }
//g++ -std=c++1z temp.cpp
//./a.exe
ll digit(ll a){
    ll count = 0;
    for (ll i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }
    }
    return count;
}
//桁数のカウント
//pow(x,n) == x^n
//sum = accumulate(v.begin(),v.end(),0);
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a,   b) * b;}



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

string s;
cin >> s;

if(s[2] == s[3] && s[4] == s[5]){
    cout << "Yes" << endl;
    return 0;
}
cout << "No" << endl;


//////////////////////////////////////////////////////
return 0;}

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

int main(void){
	char num[1005];
	int sum=0;
	while(1){
		scanf("%s",&num);
		sum=0;
		if(num[0]=='0') break;
		int i,sz=strlen(num);
		for(i=0;i<sz;i++){
			sum+=num[i]-'0';
		}
	printf("%d\n",sum);
	}
}


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

const int N = 100010;

int a[N << 1];
int big[N << 1];
int n;

bool check(int mid){
	for (int i = 0; i < 2 * n - 1; ++ i){
		big[i] = a[i] >= mid;
	}
	if (big[n - 1] == big[n - 2] || big[n - 1] == big[n]) return big[n - 1];
	int left = n - 1;
	while (left > 0 && big[left] != big[left - 1]){
		-- left;
	}
	int right = n - 1;
	while (right < 2 * n - 2 && big[right] != big[right + 1]){
		++ right;
	}
	if (left == 0 && right == 2 * n - 2) return big[n - 1] ^ (n - 1 & 1);
	return n - 1 - left < right - (n - 1) ? big[left] : big[right];
}

int main(){
	scanf("%d", &n);
	for (int i = 0; i < 2 * n - 1; ++ i){
		scanf("%d", &a[i]);
	}
	int left = 1, right = 2 * n - 1;
	while (left < right){
		int mid = left + right + 1 >> 1;
		if (check(mid)){
			left = mid;
		}
		else{
			right = mid - 1;
		}
	}
	printf("%d\n", left);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	vector<char> buffer;
	for(int i = 0; i < s.size(); ++i){
		if(buffer.size() % 2 == 0){
			if(s[i] == 'A'){ buffer.push_back('A'); }
		}else{
			if(s[i] == 'Z'){ buffer.push_back('Z'); }
		}
	}
	if(buffer.size() % 2 == 1){ buffer.pop_back(); }
	if(buffer.size() == 0){
		cout << "-1" << endl;
		return 0;
	}
	buffer.push_back('\0');
	cout << &buffer[0] << endl;
	return 0;
}

Measured memory_bytes: 1208
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w; cin >> h >> w;
  char s[2020][2020];
  rep(i, h) {
      rep(j, w) {
          cin >> s[i][j];
      }
  }
  int y[2020][2020], t[2020][2020];
  rep(i, h) {
      int cnt = 0;
      int k = 0;
      rep(j, w) {
         if(s[i][j] == '.') {
             cnt ++;
         }
         if(s[i][j] == '#') {
             for(int l = k; l <= j - 1; l++) {
                 y[i][l] = cnt;
             }
             y[i][j] = 0;
             cnt = 0;
             k = j + 1;
         }
         if(s[i][j] == '.' && j == w - 1) {
     
             for(int l = k; l <= j ; l++) {
                 y[i][l] = cnt;
             }
         }
      }
  }
  rep(i, w) {
      int cnt = 0;
      int k = 0;
      rep(j, h) {
         if(s[j][i] == '.') {
             cnt ++;
         }
         if( s[j][i] == '#' ) {
             for(int l = k; l <= j - 1; l++) {
                 t[l][i] = cnt;
             }
             t[j][i] = 0;
             cnt = 0;
             k = j + 1;
         }
         if(s[j][i] == '.' && j == h - 1) {
             for(int l = k; l <= j ; l++) {
                 t[l][i] = cnt;
             }
         }
      }
  }
  int ans = 0;
  rep(i, h) {
      rep(j, w) {
          ans = max(ans, t[i][j] + y[i][j] - 1);
      }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main(){
    long long a,b,x;
    cin >> a >> b >> x;

    //long long ans = b/x;
    //ans = ans  - (a-1)/x;
    long long A = a/x;
    long long B = b/x;

    long long ans = B - A;
    if(a%x==0){
        ans++;
    }

    cout << ans << endl;

    /*
    long long tmp,tmp_, count=0;
    long long tmp_x=1,tmp_y=1;
    if(10*x<b){
        tmp_ = 10*x;
        tmp_x = b/(10*x);
        //cout << tmp_x << endl;
        tmp_y = b%(10*x);
        //cout << tmp_y << endl;
    }
    else{
        tmp_ = b;
    }
    for(long long i=a; i<=tmp_; i++){
        //cout << i << endl;
        if(i%x==0){
            count++;
        }
    }
    //cout << count << endl;
    count = count * tmp_x;
    for(long long i=1; i<tmp_y; i++){
        if(i%x==0){
            count++;
        }
    }
    cout << count << endl;
    */
    
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int mx = 0;
    ll ans = 0LL;
    rep(i, n)
    {
        if (i > 0 && a[i] < a[i - 1])
        {
            ans += mx - a[i];
            a[i] = mx;
        }
        mx = max(mx, a[i]);
        // printf("%d %d\n", i, mx);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    ll n,k;
    cin >> n >> k;
    double res = 0.0;
    for(int i = 1;i<=n;i++){
        int now = i;
        double temp = 1.0/n;
        while(now < k){
            now*=2;
            temp /=2;
        }
        res += temp;
    }
    cout << fixed << setprecision(12) << res << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <unordered_map>
#include <stack>
#include <algorithm>

int main() {
    std :: ios_base :: sync_with_stdio(false);

    int64_t n;
    std :: cin >> n;
    std :: stack < char > stk;

    std :: string str;
    std :: cin >> str;

    int ans = 0;

    auto temp = str;
    std :: sort(temp.begin() , temp.end());

    for(int i = 0 ; i < temp.size() ; i++) {
        if(temp[i] == 'W') break;
        if(temp[i] != str[i]) ans++;
    }

    std :: cout << ans << '\n';
}

// WWRR



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

int main()
{
  int a,b;
  cin>>a>>b;
  for(int i=1;i<=1250;i++)
  {
    if((i*8)/100 == a && (i*10)/100 == b)
    {
      cout<<i<<"\n";
      return 0;
    }
  }
  cout<<"-1"<<"\n";
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<vector>
#include<functional>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

int main()
{
	string a, b;
	cin >> a >> b;
	string str = a + b;
	int n = atoi(str.c_str());
	for (int i = 1; i <= 500; i++)
	{
		if (i*i == n)
		{
			cout << "Yes" << endl;
			return 0;
		}

	}
	cout << "No" << endl;
	return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code
int main(int argc, char const* argv[])
{
	int a,b;
	cin >> a >> b;
	if (a < 10 and b < 10) {
		cout << a*b << endl;
	} else {
		cout << -1 << endl;
	}

	return 0;
}



Measured memory_bytes: 892
h,w,k=map(int,input().split())
c=[input() for i in range(h)]
x=[c[i].count('#') for i in range(h)]
y=[]
s=sum(x)
ans=0
for i in range(w):
    count=0
    for j in range(h):
        count+=(c[j][i]=='#')
    y.append(count)
for i in range(2**(h+w)):
    i='0'*(h+w-len(bin(i)[2:]))+bin(i)[2:]
    count=0
    for j in range(h):
        if i[j]=='1':
            count+=x[j]
    for l in range(w):
        if i[l+h]=='1':
            count+=y[l]
    for j in range(h):
        for l in range(w):
            if i[j]=='1' and i[h+l]=='1':
                if c[j][l]=='#':
                    count-=1
    if s-count==k:
        ans+=1
print(ans)

Measured memory_bytes: 9256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

n=gets.to_i
s={}
n.times do|i|
  c=gets.chomp
  if s[c]==nil
    s.store(c,0)
  end
  s[c]+=1
end
s=Hash[s.sort_by{|k,v| -v}]
ans=[]
i=0
max=0
s.each do|key,val|
  if max<=val
    max=val
    ans.push(key)
  end
end
ans.sort!.each{|key,val| puts key}

Measured memory_bytes: 53972
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int size = Integer.parseInt(scanner.nextLine());
        List<Double> values = Arrays.stream(scanner.nextLine().split(" "))
                .map(Double::parseDouble)
                .sorted()
                .collect(Collectors.toList());
        double tr = values.get(0);
        System.out.println(values.subList(1, size).stream()
            .reduce(tr, (a1, a2) -> (a1 + a2) / 2));
    }
}

Measured memory_bytes: 28752