akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;
int c[10001];

int main()
{
    int n;
    cin>>n;
    for (int x=1; x<=100; x++) {
        for (int y=1; y<=100; y++){
            for (int z=1; z<=100; z++) {
                int f=x*x+y*y+z*z+x*y+x*z+z*y;
                if (f > n)
                    break;
                c[f]++;
            }
        }
    }
    for (int i=1; i<=n; i++)
        cout<<c[i]<<'\n';
    return 0;
}

Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {

    Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int C = scanner.nextInt();
        int D = scanner.nextInt();
        int start = A > C ? A : C;
        int end = B < D ? B : D;
        System.out.println(end - start > 0 ? end - start : 0);
    }
}


Measured memory_bytes: 21844
/* 以前 editorial 読んだので、記憶を頼りに適当にやった */

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x)      cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x)      cout << ((x) ? "YES" : "NO") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )

ll f(ll a, ll b); // f(a, b) = a ^ (a+1) ^ (a+2) ^ ... ^ (b-1) ^ b 
ll g(ll a);       // g(n) = 1 ^ 2 ^ 3 ^ ... ^ (n-1) ^ n

ll f(ll a, ll b) {
	return (a == 0) ? g(b) : g(a-1) ^ g(b);
}

ll g(ll n) {
	switch(n % 4) {
		case 0:
			return n;
		case 1:
			return 1;
		case 2:
			return n + 1;
		case 3:
			return 0;
		default:
			return -1;
	}
}

int main(int argc, const char* argv[]) {
	ll a, b;
	cin >> a >> b;

	cout << f(a, b) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int i,j,n,k,c,h,w;
char m[51][51],a;
int main(){
	for(cin>>h>>w;i<h;i++){
		for(j=0;j<w;j++)cin>>m[i][j];
	}
  
  for(i=0;i<h;i++){
		for(j=0;j<w;j++,c=0){
      if(m[i][j]=='.'){
        if(m[i-1][j-1]=='#')c++;
        if(m[i-1][j]=='#')c++;
        if(m[i-1][j+1]=='#')c++;
        if(m[i][j-1]=='#')c++;
        if(m[i][j+1]=='#')c++;
        if(m[i+1][j-1]=='#')c++;
        if(m[i+1][j]=='#')c++;
        if(m[i+1][j+1]=='#')c++;
        m[i][j]='0'+c;
      }
    }
	}
 	for(i=0;i<h;i++){
 		for(j=0;j<w;j++)cout<<m[i][j];
    cout<<endl;
	}
}

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

int main(){
     int N;
     cin >> N;
     vector<ll> vec(N);
     int count = 0; 
  if(N == 1 || N == 2){
   cout << 0 <<endl;
   return 0;
  }else{
  for(int i=0; i < N; i++){ 
      cin >> vec.at(i);
   }
    sort(vec.begin(),vec.end());
  for(int i=0; i < N - 2; i++){
   for(int j=i+1; j < N - 1; j++){
    for(int k = j + 1; k < N; k++){
     if(vec.at(i) != vec.at(j) && vec.at(j) != vec.at(k) && vec.at(i) + vec.at(j) > vec.at(k)){
      count++;
     }
    }
   }
  }
 }
  cout << count <<endl;
    return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>

int main (void)
{
	int n , m;
	int i ,j , k;
	while (scanf("%d %d" , &n , &m) != EOF)
	{
		int sum = 0;
		int total = 0 ;
		if(n == 0 && m == 0)
		{
			break;
		}
		for(i = 1 ; i <= n; i++)
		{
			for(j = i + 1 ; j <= n; j++)
			{
				for(k = j + 1 ; k<= n; k++)
				{
					sum = i+k+j;
					if(sum == m)
					{
						total++;
					}
				}
			}
		}
		printf("%d\n" , total);
	}
}


Measured memory_bytes: 2036
#include <iostream>
#include <string>
#include <cstring>

#define maxn 1005
using namespace std;

string a[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};

int main()
{
	int day;
	string QAQ;
	cin>>QAQ;
	for(int i=0;i<=6;i++)
	{
		if(a[i]==QAQ)
		{
			day=i;
			break;
		}
	}
	cout<<7-day<<endl;
	return 0;
} 

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

list_over_3200 = []
list_under_3200 = []
for num in a:
    if num < 3200:
        list_under_3200.append(num // 400)
    else:
        # 3200以上の人を別のリストにいれる。
        list_over_3200.append(num)
maxAns = len(set(list_under_3200)) + len(list_over_3200)
if len(set(list_under_3200)) == 0:
    minAns = 1
else:
    minAns = len(set(list_under_3200))
print(minAns, maxAns)
    


Measured memory_bytes: 8976
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
ll MOD = 1000000007;

int main() {
  //
  string S;
  cin >> S;
  int n = S.size();
  vl u(n), x(n), y(n), z(n);
  if (S[0] == '?') {
    u[0] = 3;
    x[0] = 1;
  } else if (S[0] == 'A') {
    u[0] = 1;
    x[0] = 1;
  } else {
    u[0] = 1;
    x[0] = 0;
  }
  y[0] = 0;
  z[0] = 0;

  for (int i = 1; i < n; i++) {
    if (S[i] == '?') {
      z[i] = (3 * z[i - 1] + y[i - 1]) % MOD;
      y[i] = (3 * y[i - 1] + x[i - 1]) % MOD;
      x[i] = (3 * x[i - 1] + u[i - 1]) % MOD;
      u[i] = (3 * u[i - 1]) % MOD;
      // cout << u[i] << "," << x[i] << "," << y[i] << "," << z[i] << endl;
      continue;
    }

    u[i] = u[i - 1];
    if (S[i] == 'C') {
      z[i] = (z[i - 1] + y[i - 1]) % MOD;
    } else {
      z[i] = z[i - 1];
    }
    if (S[i] == 'B') {
      y[i] = (y[i - 1] + x[i - 1]) % MOD;
    } else {
      y[i] = y[i - 1];
    }
    if (S[i] == 'A') {
      x[i] = (x[i - 1] + u[i - 1]) % MOD;
    } else {
      x[i] = x[i - 1];
    }
  }
  cout << z[n - 1] << endl;
  return 0;
}


Measured memory_bytes: 3648
#include<iostream>
 
using namespace std;
 
int main(){
int n,ans = -1;
  cin >> n;
  for(int i = 1;i <= n+1;i++){
  if((int)(i*1.08) == n){
    ans = i;}
  }
  if(ans != -1){
  	cout << ans;
  }else{
  	cout << ":(";
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = 5*sc.nextDouble();
        double M = sc.nextDouble();
        H = H+M/12;
      	double RAD =Math.toRadians((M-H)*6);
        double COS = Math.cos(RAD);
        double ans = (A*A)+(B*B)-(2*A*B*COS);
        ans = Math.sqrt(ans);
      	System.out.println(ans);
    }
}

Measured memory_bytes: 37456
//#define _USE_MATH_DEFINES
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0); }
inline int safe_mul(const int x, const int y) __attribute__ ((warn_unused_result));

int const maxn = 100005;
vector<int> gr[maxn];

int used[maxn];
int cnt[maxn];
bool good = true;
set<pair<int,int>> ans;

void dfs(const int v) {
    used[v] = 1;
    for (int ne : gr[v]) {
        if (ans.find({v, ne}) == ans.end()) {
            cnt[ne] ^= 1;
            ans.insert({ne, v});
            if (!used[ne])
                dfs(ne);
        }
    }
}

int solve(int v) {
    used[v] = 1;
    for (int ne : gr[v]) {
        if (!used[ne]) {
            int res = solve(ne);
            if (res) {
                ans.erase({ne, v});
                ans.insert({v, ne});
                cnt[ne] ^= 1;
                cnt[v] ^= 1;
            }
        }
    }
    return cnt[v];
}


int main()
{
//    freopen("in.txt","r", stdin);
//    freopen("out.txt", "w", stdout);
//    cout << fixed << setprecision(20);
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n,m;
    cin >> n >> m;
    if (m%2 == 1)
        FINAL_OUT(-1);
    while (m--) {
        int x,y;
        cin >> x >> y;
        gr[x].push_back(y);
        gr[y].push_back(x);
    }

    dfs(1);

    fill(begin(used), end(used), 0);
    int res = solve(1);
    assert(res == 0);
    for (const auto& pa : ans)
        cout << pa.first << ' ' << pa.second << '\n';
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


int main() {
  li n;
  cin>>n;
  cout<<(n+1)/2<<endl;
  
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define repN_1(i, n) for(ll i = 0; i < (ll)(n - 1); i++)
#define repM(i, n) for(ll i = (ll)(n - 1); i >= 0; i--)
#define repM1(i, n) for(ll i = (ll)(n - 1); i > 0; i--)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	cout << fixed << setprecision(18);

	ll n;
	cin >> n;
	vector<ll> a(n);
	ll ans = 1;
	
	rep(i, n) {
		cin >> a[i];
		if (a[i] == 0) {
			ans = 0;
			break;
		}
	}

	if (ans > 0) {
		rep(i, n) {
			if (a[i] <= 1000000000000000000 / ans)
				ans *= a[i];
			else {
				ans = -1;
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4048
package main

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

// https://atcoder.jp/contests/abc177/editorial/90
// Union-Find

func main() {
	var n,m int
	fmt.Scan(&n, &m)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	uf := newUnionFind(n)
	for i := 0; i < m; i++ {
		sc.Scan()
		a, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		b, _ := strconv.Atoi(sc.Text())
		a--
		b--
		uf.unite(a,b)
	}

	ans := 0
	for i := 0; i < n;i++ {
		ans = max(ans, uf.size(i))
	}
	fmt.Println(ans)
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

type UnionFind struct {
	par []int
}

func newUnionFind(N int) *UnionFind {
	u := new(UnionFind)
	u.par = make([]int, N)
	for i := range u.par {
		u.par[i] = -1
	}
	return u
}

// xの所属するグループを返す
func (u UnionFind) root(x int) int {
	if u.par[x] < 0 {
		return x
	}
	u.par[x] = u.root(u.par[x])
	return u.par[x]
}

// xの所属するグループ と yの所属するグループ をJoinする
func (u UnionFind) unite(x, y int) {
	xr := u.root(x)
	yr := u.root(y)
	if xr == yr {
		return
	}
	u.par[yr] += u.par[xr]
	u.par[xr] = yr
}

// xとyが同じグループに所属するかどうかを返す
func (u UnionFind) same(x, y int) bool {
	return u.root(x) == u.root(y)
}

// xの所属するグループの木の大きさを返す
func (u UnionFind) size(x int) int {
	return -u.par[u.root(x)]
}


Measured memory_bytes: 33172
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProblemD
{
    class Program
    {
        static Dictionary<int, List<Tuple<int, bool>>> graph;
        static int N;
        static void Main(string[] args)
        {
            N = int.Parse(Console.ReadLine());
            var us = new int[N];
            var vs = new int[N];
            var ws = new int[N];
            graph = new Dictionary<int, List<Tuple<int, bool>>>();
            var ret = new int[N];
            for (int i = 0; i < N; i++)
            {
                graph.Add(i, new List<Tuple<int, bool>>());
                ret[i] = -1;
            }
            ret[0] = 0;
            for (int l = 0; l < N - 1; l++)
            {
                var read = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                us[l] = read[0];
                vs[l] = read[1];
                ws[l] = read[2];
                var isEven = ws[l] % 2 == 0;
                var temp = graph[us[l] - 1];
                temp.Add(new Tuple<int, bool>(vs[l] - 1, isEven));
                graph[us[l] - 1] = temp;
                temp = graph[vs[l] - 1];
                temp.Add(new Tuple<int, bool>(us[l] - 1, isEven));
                graph[vs[l] - 1] = temp;
            }

            //for(int j =0;j<N; j++)
            //{
            //    foreach(var tupIntBool in graph[j])
            //    {
            //        DetermineColor(j, tupIntBool.Item1, tupIntBool.Item2, ref ret);
            //    }
            //    j++;
            //}
            var detNum = 1;
            DetermineColor(0, ref ret, ref detNum);
            foreach (var r in ret)
                Console.WriteLine(r);

        }
        static void DetermineColor(int u, ref int[] ret, ref int detNum)
        {
            foreach(var tupIntBool in graph[u])
            {
                if (detNum >= N) break;
                if (ret[tupIntBool.Item1] == -1)
                {
                    detNum++;
                    ret[tupIntBool.Item1] = tupIntBool.Item2 ? ret[u] : (ret[u] + 1) % 2;
                    DetermineColor(tupIntBool.Item1, ref ret, ref detNum);
                }
            }
        }
        static void DetermineColor(int u, int v, bool isEven, ref int[] ret)
        {
            if(isEven)
            {
                if (ret[u] == -1 && ret[v] == -1)
                {
                    ret[u] = 0;
                    ret[v] = 0;
                }
                else if (ret[u] != -1 && ret[v] == -1)
                    ret[v] = ret[u];
                else if (ret[v] != -1)
                    ret[u] = ret[v];
            }
            else
            {
                if (ret[u] == -1 && ret[v] == -1)
                {
                    ret[u] = 0;
                    ret[v] = 1;
                }
                else if (ret[u] != -1 && ret[v] == -1)
                    ret[v] = (ret[u] + 1) % 2;
                else if (ret[v] != -1)
                    ret[u] = (ret[v] + 1) % 2;
            }
        }
    }
}


Measured memory_bytes: 41588
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}
const int INF = 1e18;

signed main() {
    int N;
    cin >> N;
    bool res = false;
    rep(i, N) {
        int a;
        cin >> a;
        if(a%2) res = true;
    }

    cout << (res ? "first" : "second");
    
    return 0;
}

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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

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

int main(void)
{
	int a = 0, b = 0, c = 0, d = 0, e = 0;
	int ans = 0;
	cin >> a >> b >> c;
	if((a - c) * (b - c) > 0) ans = 1;
	cout << (ans == 0 ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
const double PI = acos(-1);

int main()
{
	int n, w;
	cin >> n >> w;
	vector<int> value(n), weight(n);
	for (int i = 0; i < n; i++) cin >> value[i] >> weight[i];

	vector<vector<int>> dp(n, vector<int>(w + 1));
	for (int i = 0; i <= w; i++) {
		if (0 <= i - weight[0]) dp[0][i] = dp[0][i - weight[0]] + value[0];
	}

	for (int i = 1; i < n; i++) {
		for (int j = 0; j <= w; j++) {
			dp[i][j] = dp[i - 1][j];
			if (0 <= j - weight[i]) dp[i][j] = max(dp[i][j], dp[i][j - weight[i]] + value[i]);
		}
	}
	cout << dp[n - 1][w] << endl;
}



Measured memory_bytes: 6780
#include <iostream>
using namespace std;
int main(){
  int A;
  int B;
  cin>>A;
  cin>>B;
if (B%2 == 0)
    {
      if (A >= 13)
      {
        cout<< B;
      }
      else if(A <= 12 && A >= 6)
      {
        cout<< B/2;
      }
      else 
      {
        cout<<0;
      } 
    }

}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int a, b, c; cin >> a >> b >> c;
	
	cout << min(
		{a + b, a + c, b + c}) << endl;
	
	return 0;
}

Measured memory_bytes: 256
using System;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            Console.WriteLine(
                s == "Sunny" ? "Cloudy" 
                : s == "Cloudy"? "Rainy"
                : s == "Rainy"? "Sunny": ""
            );
        }
    }
}


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

using namespace std;

#define MAX 101

int arr[MAX], W;

void ins(int id, int w){
  if(w > W){
    cout << "impossible" << endl;
    return;
  }

  for(int i = 0 ; i < W-w+1 ; i++){
    if(arr[i] == -1){
      bool flg = true;
      for(int j = i ; j < i+w ; j++){
        if(arr[j] != -1){
          flg = false;
          break;
        }
      }

      if(flg){
        cout << i << endl;
        for(int j = i ; j < i+w ; j++){
          arr[j] = id;
        }
        return;
      }
    }
  }

  cout << "impossible" << endl;
}

void del(int id){
  for(int i = 0 ; i < W ; i++){
    while(arr[i] == id){
      arr[i++] = -1;
    }
  }
}

int main(){
  int Q, id, w;
  char ch;

  while(cin >> W >> Q ,(W | Q)){
    memset(arr,-1,sizeof(arr));
    for(int i = 0 ; i < Q ; i++){
      cin >> ch;

      if(ch == 's'){
        cin >> id >> w;
        ins(id, w);
      }else{
        cin >> id;
        del(id);
      }
    }
    cout << "END" << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

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

	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == '7') {
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";

	return 0;
}


Measured memory_bytes: 3592
class Scanner:
    def readint(self): return int(input())
    def readstring(self): return input().rstrip()
    def readline(self): return list(map(int, input().split()))
    def reads(self): return list(input().split())
    def newmat(self, n, x): return [[x for i in range(n)] for j in range(n)]

sc = Scanner()
n = sc.readint()
L = sc.readline()
L.sort()
print(sum(L[::2]))

Measured memory_bytes: 3064
#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>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

#define X real()
#define Y imag()
#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]
const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

typedef vector<P> G;

double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}

double area2(const G &P) {
  double A = 0.0;
  for (int i = 0; i < P.size(); ++i)
    A += cross(curr(P, i), next(P, i));
  return A / 2.0;
}

int main() {
  int N; cin >>N;
  G g(N);
  REP(i, N){
    int x, y; cin >>x >>y;
    g[i] = P(x, y);
  }
  printf("%.1lf\n", area2(g));
  return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
bool judge(int x, string y) {
	if (x % 3 == 0 && x % 5 == 0)
		return y == "FizzBuzz";
	if (x % 3 == 0)
		return y == "Fizz";
	if (x % 5 == 0)
		return y == "Buzz";
	if (!isdigit(y[0]))
		return false;
	return x == atoi(y.c_str());
}
int main() {
	int m, n;
	string num;
	while (cin >> m >> n && m) {
		vector<int> P;
		int cur = 0, w = -1;
		for (int i = 1; i <= m; i++)
			P.push_back(i);
		for (int i = 1; i <= n; i++) {
			cin >> num;
			if (w != -1)
				continue;
			if (judge(i, num))
				cur++;
			else
				P.erase(P.begin() + cur);
			cur = cur % P.size();
			if (P.size() == 1)
				w = P[0];
		}
		if (w != -1)
			cout << w << endl;
		else {
			for (int i = 0; i < P.size(); i++)
				cout << ((i) ? " " : "") << P[i];
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3096
"""
解説PDFを見ながら実装
https://img.atcoder.jp/abc075/editorial.pdf
"""

def dfs(v, graph, visited, n):
    # 出発点
    visited[v] = True
    for i in range(n):
        # 辺がない
        if graph[v][i] == False:
            continue
        # 訪問済み
        if visited[i] == True:
            continue
        # 辺があったらそこから訪問する
        dfs(i, graph, visited, n)


def main():
    N, M = list(map(int, input().split()))

    graph = []
    for _ in range(N):
        row = [False] * N
        graph.append(row)

    A = []
    B = []
    for _ in range(M):
        a, b = list(map(int, input().split()))
        a = a - 1
        b = b - 1
        A.append(a)
        B.append(b)
        graph[a][b] = True
        graph[b][a] = True
    # print(graph)

    ans = 0

    for i in range(M):
        # 辺を削除
        graph[A[i]][B[i]] = False
        graph[B[i]][A[i]] = False

        visited = [False] * N

        # 常に0番目の頂点から出発
        dfs(0, graph, visited, N)

        bridge = False
        for j in range(N):
            if visited[j] == False:
                bridge = True
        if bridge:
            ans += 1

        # 辺を戻す
        graph[A[i]][B[i]] = True
        graph[B[i]][A[i]] = True

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    int n,m;
    cin>>n>>m;
    UnionFind tree(n);

    for(int i=0;i<m;i++){
        int x,y,z;
        cin>>x>>y>>z;
        tree.unite(x-1, y-1);
    }
    int cnt=1;
    for(int i=0;i<n;i++){
        if(!tree.same(0,i)){
            cnt++;
            tree.unite(0,i);
        }
    }
    cout<<cnt<<endl;




    return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int N, T, S, M[3001]={};
	cin >> N >> T >> S;
	for(int n=0; n<N; n++){
		int mise_fun, mise_time;
		cin >> mise_fun >> mise_time;
		for(int t=T; t>=mise_time; t--)
			if(t<=S || t >= S  + mise_time) M[t] = max(M[t], M[t-mise_time] + mise_fun);
	}
	cout << *max_element(M+1, M+T+1) << endl;
	return 0;
}

Measured memory_bytes: 1180
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        String result = "";
        if (a >= b) {
            result = "delicious";
        } else if (x >= b - a) {
            result = "safe";
        } else if (x <= b - a) {
            result = "dangerous";
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 22740
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
 
 
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef string s;
typedef int i;
 
map<string, int> mp;
 
int main() {
    s s;
    i ans;
    cin >> s;
    string y = s.substr(0, 3);
    int k = stoi(y);
    ans = abs(753 - k);
    rep(i, s.size() - 2) {
        string x = s.substr(i, 3);
        int j = stoi(x);
        if (abs(753 - j) < ans) {
            ans = abs(753 - j);
        }
    }
    cout << ans << endl;
}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

int main()
{
  int N;
  cin >> N;
  vector< int > A(N), B(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < N; i++) cin >> B[i];
  sort(begin(A), end(A));
  sort(begin(B), end(B));

  int64 ret = 1LL;
  int latte = 0, malta = 0;
  int a = 0, b = 0;
  while(latte < N || malta < N) {
    if(malta == N || (latte < N && A[latte] < B[malta])) {
      if(b == 0) ++a;
      else (ret *= b--) %= mod;
      ++latte;
    } else {
      if(a == 0) ++b;
      else (ret *= a--) %= mod;
      ++malta;
    }
  }
  cout << ret << endl;
}


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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, start_index, num)  (a).begin()+(start_index),(a).begin()+(num)

const int mod = 1000000007;
class mint {
public:
	long long x;
	mint(long long x = 0) : x((x%mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};


mint Combination(mint n, mint r) {
	mint bunbo = r;
	mint bunshi = n;
	mint cnt = mint(1);
	while (1) {
		if (r.x == cnt.x)break;
		bunbo *= (r - cnt);
		bunshi *= (n - cnt);
		cnt += mint(1);
	}
	mint res;
	res = bunshi / bunbo;
	return res;
}

int main() {
	int n, m;
	cin >> n >> m;
	mint res;
	mint v1 = mint(1);
	mint v2 = mint(1);
	if (abs(n - m) > 1) {
		ps(0);
		return 0;
	}
	bool issame = false;
	if (n == m)issame = true;
	
	FOR(i, 1, n) {
		v1 *= mint(i);
	}
	FOR(i, 1, m) {
		v2 *= mint(i);
	}
	res = v1*v2;
	if (issame)res = res*mint(2);
	pv(res.x);
	return 0;
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    ll K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) rep(j, N) {
        ll a;
        cin >> a;
        A[i] |= a << j;
    }

    vv<vector<ll>> dp_double = vvec(N, N, vector<ll>(60));
    rep(i, N) rep(j, N) if (A[i] >> j & 1) {
        dp_double[i][j][0] = 1;
    }
    rep(b, 1, 60) {
        rep(i, N) rep(j, N) {
            rep(k, N) dp_double[i][j][b] = (dp_double[i][j][b] + dp_double[i][k][b - 1] * dp_double[k][j][b - 1]) % MOD;
        }
    }

    vv<ll> dp = vvec(60 + 1, N, 0LL);
    rep(i, N) dp[0][i] = 1;
    rep(b, 60) {
        if (K >> b & 1) {
            rep(i, N) rep(j, N) {
                dp[b + 1][i] = (dp[b + 1][i] + dp[b][j] * dp_double[j][i][b]) % MOD;
            }
        }
        else {
            rep(i, N) dp[b + 1][i] = dp[b][i];
        }
    }

    ll ans = 0;
    rep(i, N) ans += dp[60][i];
    write(ans % MOD);
}

Measured memory_bytes: 1536
#157c
N,M = map(int, input().split())

ans = ["?" for i in range(N)]

for i in range(M):
    s,c = map(int, input().split())
    
    if ans[s-1] != "?" and ans[s-1] != str(c): 
        print(-1)
        break
    else:
        ans[s-1] = str(c)
else:
    if N !=1:
        if ans[0] == "0":
            print(-1)
        else:
            if ans[0] == "?":
                ans[0] = "1"
            
            for i in range(1,N):
                if ans[i] == "?":
                    ans[i] = "0"
            
            print(str(''.join(ans)))
    else:
        if ans[0] == "?":
            print(0)
        else:
            print(ans[0])

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 100010
#define inf 1e9

int main()
{

    string ss;
    cin >> ss;
    ll ans = 0;
    for(ll i = 0, j = ss.size()-1; i < (ss.size())/2; i++, j--)
    {

        if(ss[i] != ss[j]) ans++;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define sort(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> data(n);
	ff(i, 0, n) {
		cin >> data.at(i);
	}
	sort(data);
	double ans=data.at(0);
	ff(i, 1, n) {
		ans = (ans + data.at(i)) / 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=(1e5)+10;
int n,c,k,dp[maxn];
int a[maxn],tr[maxn*4];
void add(int x,int l,int r,int root,int delta) {
	if (l==r) { tr[root]=delta; return; }
	int mid=(l+r)/2;
	if (x<=mid) add(x,l,mid,root*2,delta);
	else add(x,mid+1,r,root*2+1,delta);
	tr[root]=min(tr[root*2],tr[root*2+1]);
}
int query(int L,int R,int l,int r,int root) {
	if (L<=l&&r<=R) return tr[root];
	int mid=(l+r)/2,res=(1e9);
	if (L<=mid) res=min(res,query(L,R,l,mid,root*2));
	if (mid<R) res=min(res,query(L,R,mid+1,r,root*2+1));
	return res;
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(c); read(k);
	int l,r,mid,res;
	for (int i=1;i<=n;i++) read(a[i]);
	sort(a+1,a+n+1);
	memset(tr,0x7f7f7f7f,sizeof(tr));
	add(1,1,n+1,1,0);
	for (int i=1;i<=n;i++) {
		l=max(1,i-c+1),r=i;
		while (l<=r) {
			mid=(l+r)/2;
			if (a[mid]+k<a[i]) l=mid+1;
			else r=mid-1,res=mid;
		}
		dp[i]=query(res,i,1,n+1,1)+1;
		add(i+1,1,n+1,1,dp[i]);
	}
	printf("%d\n",dp[n]);
	return 0;
}

Measured memory_bytes: 2560
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

const int INF = 1<<29;

int main()
{
	int n;
	scanf("%d", &n);
	vvi dist(n, vi(n, INF));
	
	rep(i, n){
		int r, k;
		scanf("%d%d", &r, &k);
		--r;
		rep(j, k){
			int a;
			scanf("%d", &a);
			dist[r][a-1] = 1;
		}
	}
	
	rep(k, n) rep(i, n) rep(j, n)
		dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	
	int p;
	scanf("%d", &p);
	rep(i, p){
		int s, d, v;
		scanf("%d%d%d", &s, &d, &v);
		--s;
		--d;
		if(dist[s][d]+1 <= v)
			printf("%d\n", dist[s][d]+1);
		else
			puts("NA");
	}
	
	return 0;
}

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

int main(){
    string A;
    cin >> A;
    int ans;
    if(A == "SUN")
        ans = 7;
        else if(A == "MON")
            ans = 6;
            else if(A == "TUE")
                ans = 5;
                else if(A == "WED")
                    ans = 4;
                    else if(A == "THU")
                        ans = 3;
                        else if(A == "FRI")
                            ans = 2;
                            else if(A == "SAT")
                                ans = 1;

    
    cout << ans << endl;
    }

Measured memory_bytes: 256
// Problem : E - Yutori
// Contest : AtCoder Beginner Contest 161
// URL : https://atcoder.jp/contests/abc161/tasks/abc161_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define pb push_back
#define mp make_pair
#define y1 y114514
#define y2 y1919810
typedef pair <int, int> PII;
//#define int long long
#define all(x) (x.begin(),  x.end())
#define lsh(i) (1 << (i))
#define lshll(i) (1LL << (i))
#define repn(i, n) for (int i = 1; i <= (int)n; i++)
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define range(i, s, t)  for (int i = s; i <= (int)t; i++)
const int INF = 0x3f3f3f3f;
const long double EPS = 1e-6;
long long qread() {
	char c = getchar();
	int neg = 1;
	long long val = 0;
	while (c != '-' && !isdigit(c)) c = getchar();
	if (c == '-') c = getchar(), neg = -1;
	while (isdigit(c)) val = (val << 3) + (val << 1) + c - '0', c = getchar();
	return neg * val;
}
int n, k, c; string s;
const int N = 200020;
int l[N], r[N];
int main() {
	n = qread(); k = qread(); c = qread(); cin >> s;
	int cnt = 0;
	rep(i, n) {
		if (cnt >= k) break;
		if (s[i] == 'o') {
			l[cnt++] = i;
			i += c;
		}
	}
	cnt = k - 1;
	for (int i = n - 1; i >= 0 && cnt >= 0; i--) {
		if (s[i] == 'o') {
			r[cnt--] = i;
			i -= c;
		}
	}
	rep(i, k) if (l[i] == r[i]) cout << l[i] + 1 << endl;
	return 0;
}


Measured memory_bytes: 3332
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

struct exam {
    long long B, L, U;
    long long change;

    bool operator<(const exam &other) const {
        return change > other.change;
    }
};

long long N, X, score;
vector<exam> exams;
vector<long long> prefix_sum;

bool possible(long long study) {
    long long full_count = study / X;
    long long remainder = study % X;
    long long best = 0;

    for (int i = 0; i < N; i++) {
        long long here = 0;
        here += min(exams[i].B, remainder) * exams[i].L;
        here += max(remainder - exams[i].B, 0LL) * exams[i].U;
        long long sum = 0;

        if (i >= full_count)
            sum = prefix_sum[full_count] + here;
        else
            sum = prefix_sum[full_count + 1] - exams[i].change + here;

        best = max(best, sum);
    }

    return best + score >= 0;
}

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

    cin >> N >> X;
    score = 0;
    exams.resize(N);

    for (exam &ex : exams) {
        cin >> ex.B >> ex.L >> ex.U;
        ex.change = ex.B * ex.L + (X - ex.B) * ex.U;
        score -= ex.B * ex.L;
    }

    sort(exams.begin(), exams.end());
    prefix_sum.assign(N + 1, 0);

    for (int i = 0; i < N; i++)
        prefix_sum[i + 1] = prefix_sum[i] + exams[i].change;

    long long low = 0, high = N * X;

    while (low < high) {
        long long mid = (low + high) / 2;

        if (possible(mid))
            high = mid;
        else
            low = mid + 1;
    }

    cout << low << '\n';
}


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

int main(){
    ll n,d;
    cin>>n>>d;
    ll x[n],y[n];
    rep(i,n){
        cin>>x[i];
        cin>>y[i];
    }
    int ans = 0;
    rep(i,n){
        ll r=x[i]*x[i];
        ll t=y[i]*y[i];
        ll sum = r+t;
        if(sqrt(sum)<=d){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6800
#include "bits/stdc++.h"
using namespace std;

#define int long long
#define DBG 0
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) c.begin(),c.end()
static const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
static const int MOD = (int)(1e9 + 7);

vector<vector<int>> matrixMultiplication(vector<vector<int>> &a, vector<vector<int>> &b) {
	int n = a.size(), m = b.size(), l = b[0].size();
	vector<vector<int>> c(n, vector<int>(l, 0));
	rep(i, 0, n) rep(j, 0, l) rep(k, 0, m) c[i][j] += a[i][k] * b[k][j];
	return c;
}

signed main() {
	int n, m, l; cin >> n >> m >> l;
	vector<vector<int>> a(n, vector<int>(m, 0));
	rep(i, 0, n) rep(j, 0, m) cin >> a[i][j];
	vector<vector<int>> b(m, vector<int>(l, 0));
	rep(i, 0, m) rep(j, 0, l) cin >> b[i][j];
	auto c = matrixMultiplication(a, b);
	rep(i, 0, c.size()) {
		cout << c[i][0];
		rep(j, 1, c[i].size()) { cout << " " << c[i][j]; }
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3232
#define ll long long
#include <bits/stdc++.h>
using namespace std;
ll mod=1000000007;
main(){
	ll n,d;
	cin>>n>>d;
	ll ans=n/((2*d)+1);
	if(n%((2*d)+1)){
		cout<<ans+1<<endl;
	}
	else{
		cout<<ans<<endl;
	}
}


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

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007, INF = 1e9;

int n, m;
int dp[1<<12];

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  cin >> n >> m;
  
  rep(i, 1<<12) dp[i] = INF;
  dp[0] = 0;

  while (m --> 0) {
    int a, b; cin >> a >> b;
    int s = 0;
    rep(i, b) {
      int c; cin >> c, --c;
      s |= (1<<c);
    }

    rep(i, 1<<n) {
      if (dp[i] == INF) continue;
      chmin(dp[s | i], dp[i] + a);
    }
  }

  int ans = dp[(1<<n)-1];
  cout << (ans == INF ? -1 : ans) << endl;
  
  return (0);
}

Measured memory_bytes: 3620
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cstdint>
#include <math.h>
using namespace std;

int main(int argc, const char * argv[]) {

    cin.tie(0);
    ios::sync_with_stdio(false);

    long long H;

    cin >> H;

    int n = 1;

    long long total = 1LL;
    while (H >= total) {
        total *= 2;
        n++;
    }

    cout << total-1;

    return 0;
}


Measured memory_bytes: 256
N, K, S = map(int, input().split())

ans = []

for i in range(N):
    if i < K:
        ans.append(str(S))
    else:
        if S == 10 ** 9:
            ans.append(str(1))
        else:
            ans.append(str(S+1))

print(" ".join(ans))


Measured memory_bytes: 13464
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

int main()
{
    int n, m;
    cin >> n;
    map<string, int> ma;
    set<string> s;
    ma.clear();
    string tmp;
    rep(i,n) {
        cin >> tmp;
        s.insert(tmp);
        ma[tmp]++;
    }
    cin >> m;
    rep(i,m) {
        cin >> tmp;
        s.insert(tmp);
        ma[tmp]--;
    }

    int maxx = -200;
    auto it = s.begin();
    rep(i,ma.size()) {
        maxx = max(ma[*it], maxx);
        it++;
    }

    if (maxx < 0)
        cout << 0 << endl;
    else
        cout << maxx << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define lli long long int
map<lli,vector<lli>> v; //労働を格納する配列(同じ日数のものが存在するかもしれないので配列にしておく)
signed main(){

	lli n,m;
	cin>>n>>m; //要素数の取得

	for(lli i=0;i<n;i++){
		lli a,b;
		cin>>a>>b;
		v[a].push_back(b); //配列に入力(ここでは値が小さい順に辞書式に記録される)
	}
	lli sum=0;

	priority_queue<lli> q; //優先度付きキュー
	for(lli i=0;i<=m;i++){
		for(lli j=0;j<v[i].size();j++){ //vのサイズ分だけ入力(候補の追加)
			q.push(v[i].at(j)); //キューに入力(i以下のものだけキューに入力)
			
		}

		if(q.size()==0)continue;
		sum += q.top(); //値の大きいものから順当に追加
		
		q.pop();
	}
  cout<<sum<<endl;
}


Measured memory_bytes: 10880
#include <iostream>
#include <math.h>

void sorting(int *x, int *y){

	int temp;

	if(*x > *y){
		temp = *x;
		*x = *y;
		*y = temp;
	}
}

int main(){
	
	int a, b, c;
	
 	std::cin >> a >> b >> c;
	
	sorting(&a, &b);
	sorting(&b, &c);
	sorting(&a, &b);

	std::cout  << a << ' ' <<  b << ' ' << c << std::endl;

}

Measured memory_bytes: 1164