akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
	"math"
)

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

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

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
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func main(){
	var n,num int
	var ashiba []int
	var DP []int

	fmt.Scan(&n)
	for i:=0;i<n;i++{
		fmt.Scan(&num)
		ashiba = append(ashiba,num)
		DP = append(DP,1000000000000)
	}
	DP[0] = 0
	DP[1] = abs(ashiba[1] - ashiba[0])
	for i:=2;i<n;i++{
		DP[i] = min(DP[i],DP[i-1]+abs(ashiba[i-1]-ashiba[i]),DP[i-2]+abs(ashiba[i-2]-ashiba[i]))
	}
	fmt.Println(DP[n-1])
}

Measured memory_bytes: 6528
from heapq import heapify, heappop, heappush


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

    if M == N - 1:
        ans = 0
    elif 2 * (N - M - 1) > N:
        ans = 'Impossible'
    else:
        g2i = [[i] for i in range(N)]
        i2g = list(range(N))

        def merge(ia, ib):
            # print(g2i, i2g, ia, ib)
            if len(g2i[i2g[ia]]) < len(g2i[i2g[ib]]): ia, ib = ib, ia
            ga, gb = i2g[ia], i2g[ib]
            for j in g2i[gb]: i2g[j] = ga
            g2i[ga].extend(g2i[gb])
            g2i[gb] = []

        for _ in range(M):
            tx, ty = map(int, input().split())
            merge(tx, ty)

        ans = 0
        need = 2 * (N - M - 1)
        rest = []
        for gi in range(len(g2i)):
            t = []
            for i in g2i[gi]:
                t.append(a[i])
            if not t: continue
            heapify(t)
            ans += heappop(t)
            need -= 1
            rest += t
        ans += sum(sorted(rest)[:need])

    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 28204
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;

int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (e-a <= k)cout << "Yay!" << endl;
	else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
using namespace std;



int main(void){
    int n;
    cin>>n;
    vector<float> a(n);
    rep(i,n){
        cin>>a[i];
    }
    
    sort(a.begin(),a.end());
    float ans=a[0];
    rep(i,n-1){
        //cout<<ans<<' '<<a[i+1]<<endl;
        ans=(ans+a[i+1])/2;
    }
    
    cout<<ans;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,i,j,flag=0;
    cin>>n;
    while(n>0)
    {
        j=n%10;
        n=n/10;
        if(j==7)
        {
           flag=1;
           break;
        }
    }
    if(flag==1)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 3592
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

constexpr int MOD = 1000000007;

int main() {
    int n;
    string s1,s2;
    cin >> n >> s1 >> s2;
    LL ans = 1;
    int index = 0;
    bool same = false;
    if (s1[0] == s2[0]) {
        index += 1;
        ans = 3;
        same = true;
    } else {
        index += 2;
        ans = 6;
    }
    while (index < n) {
        if (s1[index] == s2[index]) {
            if (same) {
                ans = (ans * 2) % MOD;
            }
            index += 1;
            same = true;
        } else {
            if (same) {
                ans = (ans * 2) % MOD;
            } else {
                ans = (ans * 3) % MOD;
            }
            index += 2;
            same = false;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;
using namespace std;

int main() {
    int n,maxprice=0;
    cin >> n;
    vector<int> v(n);
    rep(i,n){
        int price;
        cin >> price;
        v.push_back(price);
        maxprice = max(maxprice,price);
    }
    int ans=0;
    for(auto num: v){
        ans += num;
    }
    cout << ans-maxprice/2 << endl;

    return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function ftAdd(ft::Array{Int,1},k::Int,x::Int)
	t = k
	n = length(ft)
	while t<=n
		ft[t]+=x
		t+=t&(-t)
	end
	ft
end

function ftSum(ft::Array{Int,1},ll::Int,rr::Int)
	l = ll
	r = rr
	s = 0
	while r>0
		s += ft[r]
		r -= r&(-r)
	end
	while l>0
		s -= ft[l]
		l -= l&(-l)
	end
	s
end

function main()
	n,k = readline() |> split |> parseMap
	a = zeros(Int,n)
	for i in 1:n
		a[i] = readline() |> parseInt
	end
	b = zeros(Int,n+1)
	for i in 1:n
		b[i+1] = b[i]+a[i]
	end
	f = zeros(Int,n+1)
	for i in 1:n
		f[i+1] = b[i+1]-i*k
	end
	n += 1
	g = Tuple{Int,Int}[(f[i],i) for i in 1:n]
	g = sort(g,by=x->x[1])
	now = g[1][1]
	nx = 1
	for i in 1:n
		if g[i][1]>now
			nx += 1
		end
		now = g[i][1]
		g[i] = (g[i][2],nx)
	end

	g = sort(g,by=x->x[1])
	for i in 1:n
		f[i] = g[i][2]
	end
	ft = zeros(Int,n)
	ans = 0
	for i in 1:n
		ans += ftSum(ft,0,f[i])
		ftAdd(ft,f[i],1)
	end
	println(ans)
end

main()

Measured memory_bytes: 162096
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        n: usize,
        m: usize,
        q: usize,
        a: [[usize;4];q],
    }

    let mut ans = 0;
    let vecs = dfs(n, m, vec![1]);

    for v in vecs {
        let mut score = 0;
        for i in 0..q {
            let (a, b, c, d) = (a[i][0] - 1, a[i][1] - 1, a[i][2], a[i][3]);
            if v[b] >= v[a] && v[b] - v[a] == c {
                score += d;
            }
        }
        ans = max(ans, score);
    }

    println!("{}", ans);
}

fn dfs(depth: usize, m: usize, v: Vec<usize>) -> Vec<Vec<usize>> {
    if depth == v.len() {
        return vec![v];
    }

    let mut new_v: Vec<Vec<usize>> = Vec::new();
    let cur = v[v.len() - 1];

    for i in cur..=m {
        let mut next_v = v.clone();
        next_v.push(i);
        new_v.append(&mut dfs(depth, m, next_v));
    }

    new_v
}


Measured memory_bytes: 10888
#include <stdio.h>
int main(void){
  int i,count=0,price[1000],quan[1000],sum=0,sum_q=0,tmp;
  float ave;
  while(1){
    scanf("%d,%d",&price[count],&quan[count]);
    if(feof(stdin))break;
    count++;
  }
  for(i=0;i<count;i++){
    sum+=price[i]*quan[i];
    sum_q+=quan[i];
  }
  ave=(float)sum_q/count;
  tmp=(int)((float)ave*10)+9;
  ave=(float)tmp/10;
  printf("%d\n",sum);
  printf("%d\n",(int)ave);
  return(0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
#define bit(x) (1ll<<(x))

void mainsolve(){

	ll x;
	cin >> x;
	set<ll> valid = {3, 5, 7};
	if(valid.find(x) != valid.end()) cout << "YES" << endl;
	else cout << "NO" << endl;

	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL                  long long
#define ull                 unsigned long long LL
#define scl(n)              scanf("%lld", &n)
#define scf(n)              scanf("%lf", &n)
#define sci(n)              scanf("%d", &n)
#define scii(n,m)           scanf("%d %d",&n,&m)
#define sciii(n,m,p)        scanf("%d %d %d",&n,&m,&p)

#define MOD                 1000000007
#define MODP                99999999999973LL
#define pb                  push_back
#define mp                  make_pair
#define pp                  pair<LL,LL>
#define memo(a,b)           memset(a,b,sizeof(a))
#define INF                 1e9
#define EPS                 1e-8
#define Pi                  acos(-1.0)
LL bigmod(LL b, LL p, LL md){if(p==0) return 1;if(p%2==1){ return ((b%md)*bigmod(b,p-1,md))%md;} else {LL y=bigmod(b,p/2,md);return (y*y)%md;}}
#define N 300002

LL dp[3004][3004];
int main()
{
    string s,t;
    cin>>s>>t;
    s="#"+s;
    t="#"+t;

    swap(s,t);
    int n=s.size()-1;
    int m=t.size()-1;


    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(t[j]==s[i])
            {
                dp[i][j]=max(dp[i-1][j-1]+1,max(dp[i-1][j],dp[i][j-1]));
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }

//    for(int i=1;i<=n;i++)
//    {
//        for(int j=1;j<=m;j++)
//            cout<<dp[i][j]<<" ";
//        cout<<endl;
//    }

    //cout<<dp[n][m]<<endl;

    string str="";

    int cnt=dp[n][m];

    int i=n,j=m;
    while(1)
    {
        if(cnt==0)
            break;
        if(dp[ i-1 ][j-1]+1==dp[i][j] && s[i]==t[j])
        {
            str+=s[i];
            i--;
            j--;
            cnt--;

        }
        else if(dp[ i-1 ][j]==dp[i][j])
        {
            i--;
        }
        else if(dp[ i][j-1]==dp[i][j])
        {
            j--;
        }



    }

    for(int i=str.size()-1;i>=0;i--)
        cout<<str[i];






    return 0;
}



/* LL dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; */ // 4 Direction
/* LL dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; */ // 8 Direction
/* LL dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* LL dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction


Measured memory_bytes: 70656
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
int main()
{
    IOS
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// freopen("error.txt","w",stderr);
 	ll n,r;
 	cin>>n>>r;
 	if(n>=10)
 	{
 		cout<<r<<endl;
 	}	
 	else
 	{
 		cout<<r+(10-n)*(100)<<endl;
 	}
    return 0;
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int K,A,B;
    cin >> K >> A >> B;
    if(A > B) {
        cout << K+1 << endl;
    }
    else {
        if(A+2 >= B) {
            cout << K+1 << endl;
        }
        else {
            K-=A-1;
            cout << K/2*(B-A)+K%2+A <<endl;
        }
    }
}


Measured memory_bytes: 3620
//in the name of Allah
//#isart
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define S second
#define F first
#define MP make_pair
const int N = 1e5 + 10;
ll a[N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k, c, ans = 1;
	cin >> n >> c >> k;
	for(int i = 0; i < n; i ++)
		cin >> a[i];
	sort(a, a + n);
	int cnt = 0, last = 0;
	for(int i = 0; i < n; i ++){
		if(a[i] - a[last] > k || cnt == c){
			cnt = 0;
			last = i;
			ans ++;
		}
		cnt ++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define MOD_Q 998244353
#define PI 3.14159265358979
#define ll long long
using namespace std;


int main()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll ans = 0;
	ll deg = 1;

	for (int i = 0; i < 60; i++) {
		ll x = 0;
		
		ll now = 0;
		for (int j = 0; j < n; j++) {
			if (a[j] >> i & 1)x++;
		}
		now = x * (n - x);
		//printf("%lld*%lld -> ", x, n - x);
		now %= MOD_P;
		deg %= MOD_P;
		//printf("+%lld\n", now * deg);
		ans = ans + now * deg;
		ans %= MOD_P;
		deg *= 2;
	}

	printf("%lld", ans);

	return 0;
}



Measured memory_bytes: 2688
print [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800, 87178291200, 1307674368000, 20922789888000, 355687428096000, 6402373705728000, 121645100408832000, 2432902008176640000][input()]

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

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;

constexpr int INF = 1e9 + 7;

int main(){
    int N;cin>>N;
    int minimum = INF,maximum = 0;
    int A[N];
    REP(i,N){
        cin>>A[i];
        minimum = min(minimum,A[i]);
        maximum = max(maximum,A[i]);
    }
    cout << maximum - minimum;
}





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

#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define l_cin(X) scanf("%ld",&X)
#define s_cin(X) scanf("%s",%X)

#define  i_cout(X) printf("%d\n",X)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

int main(void) {
	int a, b;
	i_cin(a);
	if (a == 1) {
		s_cout("Hello World"); return 0;
	}
	i_cin2(a, b);
	i_cout(a + b);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

class data
{
private:
    int x;
    int y;

public:
    void set_x(int x)
    {
        this->x = x;
    }

    void set_y(int y)
    {
        this->y = y;
    }

    int get_x(void)
    {
        return this->x;
    }

    int get_y(void)
    {
        return this->y;
    }
    
    void swapping(void)
    {
        if (this->x > this->y) {
            int tmpx = this->x;
            this->x = this->y;
            this->y = tmpx;
        }
    }

};

int main(void)
{
    int x, y;
    data dataset;
    while(true) {
        std::cin >> x;
        std::cin >> y;
        if(x == 0 && y == 0) {
            break;
        }
        dataset.set_x(x);
        dataset.set_y(y);
        dataset.swapping();
        std::cout << dataset.get_x() << " " << dataset.get_y() << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int diff = 0;
    for(int i = 0; i < n / 2; i++) {
        if(s[i] != s[n - 1 - i]) {
            diff++;
        }
    }
    cout << diff << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-9, pi = acos(-1.0);
namespace std {
    bool operator<(const Point &lhs, const Point &rhs) {
        if (lhs.real() < rhs.real() - eps) return true;
        if (lhs.real() > rhs.real() + eps) return false;
        return lhs.imag() < rhs.imag();
    }
}
Point input_point() {ld x, y; cin >> x >> y; return Point(x, y);} // ????????\???
bool eq(ld a, ld b) {return (abs(a - b) < eps);} // ????????????????????????
ld dot(Point a, Point b) {return real(conj(a) * b);} // ??????
ld cross(Point a, Point b) {return imag(conj(a) * b);} // ??????

// ??´????????????
class Line {
public:
    Point a, b;
    Line() : a(Point(0, 0)), b(Point(0, 0)) {}
    Line(Point a, Point b) : a(a), b(b) {}
    Point operator[](const int _num) {
        if (_num == 0)return a;
        else if (_num == 1)return b;
        else assert(false);
    }
};

// ????????????
class Circle {
public:
    Point p;
    ld r;
    Circle() : p(Point(0, 0)), r(0) {}
    Circle(Point p, ld r) : p(p), r(r) {}
};

// CCW
int ccw(Point a, Point b, Point c) {
    b -= a; c -= a;
    if (cross(b, c) > eps) return 1;   // a,b,c??????????¨???¨?????????????????¶
    if (cross(b, c) < -eps) return -1; // a,b,c???????¨???¨?????????????????¶
    if (dot(b, c) < 0) return 2;       // c,a,b???????????´???????????¶
    if (norm(b) < norm(c)) return -2;  // a,b,c???????????´???????????¶
    return 0;                          // a,c,b???????????´???????????¶
}

/* ????§???¢ */
typedef vector<Point> Polygon;
// ?????§??????
bool isConvex(const Polygon &poly){
    int p_size = (int)poly.size();
    if(p_size < 3) return false;
    int s = -3;
    for(int i = 0; i < p_size;i++){
        int r = ccw(poly[(i+p_size-1)%p_size],poly[i%p_size],poly[(i+1)%p_size]);
        if(r == 1 && s == -3) s = r;
        if(s*r == -1) return false;
    }
    return true;
}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int n; cin >> n;
    Polygon ps;
    for(int i = 0; i < n;i++) ps.emplace_back(input_point());
    if(isConvex(ps)){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;


void solve(long long N, long long Y){
    bool check = true;
    ll A = -1; ll B = -1; ll C = -1;
    for(ll x = 0; x <= N; ++x){
        for(ll y = 0; y <= N; ++y){
            if(9000 * x + 4000 * y == Y - 1000 * N && N - x - y >= 0){
                A = x;
                B = y;
                C = N - x - y;
            }
        }
    }
    cout << A << " " << B << " " << C << endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long Y;
    scanf("%lld",&Y);
    solve(N, Y);
    return 0;
}

Measured memory_bytes: 3728
A, B, C, X, Y = [int(x) for x in input().split(' ')]
if (A + B) / 2 > C:
  p = 10**10
  for i in range(min(X, Y), max(X, Y)+1):
    p = min(p, A * max(0, X-i) + B * max(0, Y-i) + C * i * 2)
  print(p)
else:
  print(A * X + B * Y)

Measured memory_bytes: 38768
n,k,s = [int(i) for i in input().split()]
 
ans_list = []
for i in range(n):
  if i < k:
    ans_list.append(str(s))
  else:
    ans_list.append(str(s+1) if s < 10 ** 9 else '1')
    
print(*ans_list)

Measured memory_bytes: 12936
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << h2*60 + m2 - (h1*60 + m1) - k << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int N, K;
	cin >> N >> K;
	vector<int> P(N);
	for(int i=0; i<N; i++) cin >> P[i];

	vector<double> exp(N);
	for(int i=0; i<N; i++) exp[i] = (1+P[i])*0.5;

	double sum = 0;
	for(int i=0; i<K; i++) sum += exp[i];
	double ans = sum;
	for(int i=K; i<N; i++){
		sum += exp[i] - exp[i-K];
		ans = max(ans, sum);
	}

	cout << setprecision(10) << ans << endl;

	return 0;
}


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

using namespace std;

int main(){
  int n,l,notuse = (1 << 29);
  cin >> n >> l;
  for(int i = 1;i <= n;i++)notuse = min(notuse,abs(i+l-1));
  if(l >= 0)cout  << l*n + n*(n+1)/2 - n - notuse;
  else cout << l*n + n*(n+1)/2 - n + notuse;
  return 0;
}

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

using namespace std;

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

  int n;
  cin >> n;  
  map<int, int> problems;
  for (int i = 0; i < n; i++) {
    int d;
    cin >> d;
    problems[d]++;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    if (!problems[t]) {
      cout << "NO" << endl;
      return 0;
    } else {
      problems[t]--;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 9600
import java.util.*;

class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N=sc.nextInt(),D=sc.nextInt(),X=sc.nextInt(),A[]=new int[N],sum=0;
		for(int i=0;i<N;i++) {
			A[i]=sc.nextInt();
			if(D%A[i]!=0)
			sum += D/A[i] +1;
			else sum+=D/A[i];
		}
		System.out.println(sum+X);
	}
}

Measured memory_bytes: 35944
n=int(input())
b=list(map(int, input().split()))
a=[0 for _ in range(n)]
a[0]=b[0]
a[n-1]=b[n-2]
for i in range(1, n-1):
  a[i]=min(b[i-1], b[i])
ans=sum(a)
print(ans)

Measured memory_bytes: 3060
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;


const int MAX = 101;
const int SIZE = 1e6;

int main(){
  
    int n;
    cin >> n;
    vector <int> v(SIZE,0);
    for (int i = 1; i <= MAX; ++i){
        for (int j = 1; j <= MAX; ++j){
            for (int k = 1; k <= MAX; ++k){
                if (i*i + k*k + j*j + i*j + i*k + j*k <= 10001)
                v[i*i + k*k + j*j + i*j + i*k + j*k]++;
                
            }
        }
    }
    for (int i = 1; i <= n; ++i) cout << v[i] << endl;


}

Measured memory_bytes: 6780
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long N, K;
  cin >> N >> K;
  vector<long> x(N);
  rep (i, N) cin >> x[i];
  long ans = x[K-1] - x[0] + min(abs(x[0]), abs(x[K-1]));

  for (long i = 0; i + K - 1 < N; i++) {
    long tmp = x[i + K-1] - x[i] + min(abs(x[i]), abs(x[i + K-1]));
    ans = min(ans, tmp);
  }

  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

typedef long long ll;

int main(void){
    ll N,M;
    cin >> N >> M;
    
    vector<bool> vec(110000,true);
    vector<ll> dp(110000,0);
    
    for(int i = 0; i < M; i++){
        ll a;
        cin >> a;
        vec[a] = false;
    }
    
    dp[0] = 1;
    for(int i = 1; i <= N; i++){
        if(i == 1){
            if(vec[i] == true){
                dp[i] = 1;
            }
            continue;
        }
        
        if(vec[i-1] == true) dp[i] += dp[i-1];
        if(vec[i-2] == true) dp[i] += dp[i-2];
        dp[i] %= 1000000007;
    }
    
    cout << dp[N] << endl;
}

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

const string YES = "YES";
const string NO = "NO";

void solve(std::vector<long long> a, std::vector<long long> b){
  map<long long, long long> tab;

  for(long long i = 0; i < 3; i++){
    tab[a[i]]++;
    tab[b[i]]++;
  }

  long long one_edge = 0;
  long long two_edge = 0;

  for(long long i = 1; i <= 4; i++){
    if(tab[i] == 1) one_edge++;
    if(tab[i] == 2) two_edge++;
  }

  cout << ((one_edge == 2 && two_edge == 2) ? YES : NO) << endl;
}

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    int ct = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == t[i]) {
            ct++;
        }
    }
    cout << ct;
}

Measured memory_bytes: 256
/* AtCoder. Task C - Sugar Water, by Abreto<m@abreto.net>. */
#include <bits/stdc++.h>

using namespace std;

#define REP(x,iup)    for((x) = 0;(x) <= iup;(x)++)

int main(void)
{
    int i, j, k, l;
    int A, B, C, D, E, F;
    int anssw = 0, anss = 0;
    scanf("%d%d%d%d%d%d", &A, &B, &C, &D, &E, &F);
    anssw = 100*A;
    REP(i,100)REP(j,100)
    {
        int water = (i*A) + (j*B);
        water *= 100;
        int maxsugar = min((i*A+j*B)*E, F-water);
        if( water <= F )
        {
            REP(k,3000)
            {
                int sugar = C*k;
                int rem = maxsugar - sugar;
                if(rem < 0) break;
                int addD = rem / D;
                sugar += addD * D;
                if( (water+sugar) <= F && sugar <= maxsugar )
                {
                    int sw = water + sugar;
                    int left = anss * sw, right = anssw * sugar;
                    if( left < right )
                    {
                        anss = sugar;
                        anssw = sw;
                    }
                }
            }
        }
    }
    printf("%d %d\n", anssw, anss);
    return 0;
}


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

int main(){
	long long int n;
	if(scanf("%lld",&n)==EOF){return 0;}
	
	int max = (int)sqrt((double)n);
	long long int quatient;
	
	for(long long int i = max; i > 0; i--){
		if (n % i == 0){
			quatient = n/ i;
			//printf("%lld, %lld\n", quatient, i);
			break;
		}
	}
	
	int digit = (int)(log10((double)quatient)+1);
	
	printf("%d\n", digit);
	return 0;
}

Measured memory_bytes: 2400
#include <iostream>
#include <string>

using namespace std;
int main(){
	string S;
	string sBegin, sEnd;

	cin >> S;
	
	sBegin = S.substr(0, 1);
	sEnd = S.substr(S.length()-1, 1);
	
	cout << sBegin << S.length()-2 << sEnd << endl;
	
	return 0;
	
}

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

int main(){
    int n,a,b;
    cin >> n >> a >> b;
    int ans = min(n*a, b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<iostream>
#define MAXN 100005
#define LL long long
#define ULL unsigned LL
#define rg register
#define lowbit(x) (-(x) & (x))
#define ENDL putchar('\n')
#define DB double
//#pragma GCC optimize(2)
//#pragma G++ optimize(3) 
//#define int LL
using namespace std;
inline LL read() {
	LL f = 1,x = 0;char s = getchar();
	while(s < '0' || s > '9') {if(s == '-') f = -1;s = getchar();}
	while(s >= '0' && s <= '9') {x = x * 10 - '0' + s;s = getchar();}
	return x * f;
}
LL n,m,i,j,s,o,k;
signed main() {
	n = read();
	for(int i = -119;i <= 120;i ++) {
		LL A = i * 1ll * i * 1ll * i * 1ll * i * 1ll * i;
		for(int j = i - 1;1;j --) {
			LL B = j *1ll* j *1ll* j *1ll* j *1ll* j;
			if(A - B == n) {
				printf("%d %d\n",i,j);
				return 0;
			}
			if(A - B > n) break;
		}
	}
	return 0;
}  

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007

int main(){
    long long int a,b,c;
    cin>>a>>b>>c;
    if(c-a-b>0&&a*a+b*b+c*c-2*a*b-2*a*c-2*b*c>0)cout<<"Yes"<<"\n";
    else cout<<"No"<<"\n";
}


Measured memory_bytes: 256
import math
def gcd(x, y):
    x, y = math.fabs(x), math.fabs(y)
    y, x = max(x, y), min(x, y)
    if x == 0:
        return y

    return gcd(x, y % x)

try:
    while 1:

        a,b,c,d,e,f  = list(map(int,input().split()))
        s = gcd(a, d)

        k1 = d / s * -1
        k2 = a / s

        y = (k1*c + k2 * f) / (k1 * b + k2 * e)
        x = (c - b*y) / a
        print("{:.3f} {:.3f}".format(x, y))
except Exception:
    pass

Measured memory_bytes: 7700
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    string s; cin >> s;
    int e[n], w[n];
    int e_n = 0, w_n = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'W'){
            w[i] = w_n; w_n++;
        }else if(s[i] == 'E'){
            e_n++;
            w[i] = w_n;
        }
    }
    for(int i = 0; i < n; i++){
        if(s[i] == 'W'){
            e[i] = e_n;
        }else if(s[i] == 'E'){
            e_n--;
            e[i] = e_n;
        }
    }
    int mi = INT_MAX;
    for(int i = 0; i < n; i++){
        mi = min(mi, e[i] + w[i]);
    }
    cout << mi << endl;
}

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

using namespace std;
#define ll long long
typedef pair<ll , ll> ii;
ll n , kq[100005];
map<ll, ll> m, idx;
vector<ii> t;
int main()
{
    cin >> n;
    for(int i = 1;i <= n;i++){
        ll foo; cin >> foo;
        m[foo]++;
        if(!idx.count(foo)) idx[foo] = i;
    }
    for(auto x = m.begin() ; x != m.end(); x++)
        t.push_back({x->first , x->second});
    sort(t.begin(), t.end());
    for(int i = t.size() - 1;i > 0;i--){
        kq[idx[t[i].first]] += (t[i].first - t[i - 1].first) * t[i].second;
        t[i - 1].second += t[i].second;
        idx[t[i - 1].first] = min(idx[t[i - 1].first] , idx[t[i].first]);
    }
    kq[idx[t[0].first]] += t[0].second * t[0].first;
    for(int i = 1;i <= n;i++) cout << kq[i] << "\n";
    return 0;
}


Measured memory_bytes: 16372
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using VLL = vector<ll>;

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

  int N, M; cin >> N >> M;
  vector<VLL> v(N, VLL(3));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> v[i][j];
    }
  }
  
  ll ans = 0;
  for (int i = 0; i < 8; i++) {
    sort(v.begin(), v.end(), [&i](VLL a, VLL b) {
      ll suma = 0, sumb = 0;
      for (int j = 0; j < 3; j++) {
        suma += (i & 1 << j) ? a[j] : -a[j];
        sumb += (i & 1 << j) ? b[j] : -b[j];
      }
      return suma > sumb;
    });
    VLL res(3);
    for (int j = 0; j < M; j++) {
      for (int k = 0; k < 3; k++) {
        res[k] += v[j][k];
      }
    }
    ans = max(ans, abs(res[0]) + abs(res[1]) + abs(res[2]));
  }
  cout << ans << "\n";
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define print2(a, b) cerr << "(" << a << "," << b << ")" << endl
#define print3(a, b, c) cerr << "(" << a << "," << b << "," << c << ")" << endl


void solve(long long N) {
    if (N == 0) {
        cout << 0 << endl;
        return;
    }
    string s;
    int parity = 1;
    while (N) {
        if (N & 1) {
            s += "1";
            N -= parity;
        }
        else {
            s += "0";
        }
        N /= 2;
        parity *= -1;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

typedef std::pair<int, int> ipair;
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define int long long
#define ld long double
#define cnt_ones(x) __builtin_popcount(x)
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mod 1000000007

template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}
#define IOS  std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int dfs(vector<vector<int> > &g,vector<bool> &vis, vector<int> &dp, int vertex){
  vis[vertex] = true;
  if(g[vertex].size() == 0){
     dp[vertex] = 0;
     return dp[vertex];
  }
  if(dp[vertex] != -1)  return dp[vertex];
  dp[vertex] = 0;
  for(auto x : g[vertex])
    dp[vertex] = max(1+dfs(g,vis,dp,x),dp[vertex]);
  return dp[vertex];
}

int max_len(vector<vector<int> > &g,int n,int m){
  vector<int> dp(n,-1);
  vector<bool >vis(n,false);
  for(int i=0;i<n;i++){
  if(!vis[i]){
    //cout<<i<<" its ok"<<endl;
  int zer = dfs(g,vis,dp,i);
  }
//cout<<dp<<endl;
  }
  return *max_element(all(dp));
}
int32_t main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int> >g(n);
  fr(i,0,m){
    int u,v;  cin>>u>>v;
    u--;v--;
    g[u].pb(v);
  }
  cout<<max_len(g,n,m);
}


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

int main() {
  int N ,a=0,ans=1;
  cin >> N ;
  for (int i=N ; i>1 ; i= (i-i%2)/2 ){
    a++ ;
  }
  for (int i= 0 ; i< a ; i++){
    ans*=2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include<stdio.h>
#define N 8
#define FREE -1
#define NOT_FREE 1
int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
int X[N][N];
void initialize(){
 int i;
 for(i=0;i<N;i++){
   row[i]=FREE;
   col[i]=FREE;
 }

 for(i=0;i<2*N-1;i++){
   dpos[i]=FREE;
   dneg[i]=FREE;
 }
}

void printboard(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(X[i][j]==1){
        if(row[i]!=j){
          return;
        }
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j){
      printf("Q");
    }
    else{
      printf(".");
  }
  }
  printf("\n");
}
}
void recursive(int i)
{
  int j;
  if(i==N){
    printboard();return;
  }
  for(j=0;j<N;j++){
    if((col[j]==NOT_FREE)||(dpos[i+j]==NOT_FREE)||(dneg[i-j+N-1]==NOT_FREE)){
    continue;
  }
  row[i]=j;
  col[j]=NOT_FREE;
  dpos[i+j]=NOT_FREE;
  dneg[i-j+N-1]=NOT_FREE;
  recursive(i+1);
  col[j]=FREE;
  dpos[i+j]=FREE;
  dneg[i-j+N-1]=FREE;
  }
}
int main()
{
  int i,j,k,r,c;
  initialize();
  for(i=0;i<N;i++){
  for(j=0;j<N;j++){
  X[i][j]=-1;
}
}

  scanf("%d",&k);
  for(i=0;i<N;i++){
    scanf("%d%d",&r,&c);
    X[r][c]=1;
  }
  recursive(0);
  return 0;
}



Measured memory_bytes: 2112
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <fstream>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int a, b, c; cin >> a >> b >> c;
	if ((a < c && c < b) || (a > c&&c > b))cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}

bool f(string s){
  if(s.size() % 2 != 0) return false;
  string left = s.substr(0, s.size()/2);
  string right = s.substr(s.size()/2);
  if(left == right) return true;
  else return false;
}

int main(){
  string s;
  cin >> s;
  REP(i,s.size()){
    string t = s.substr(0,s.size()-i);
    if(f(t)){
      cout << t.size() << endl;
      return 0;
    }
  }
}


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

int main() {
	string s;
	cin >> s;
	int x = 0;
	if(s == "RRR"){
		cout << 3;
	}
	else if(s == "RRS" || s == "SRR"){
		cout << 2;
	}
	else if(s == "SSS"){
		cout << 0;
	}
	else{
		cout << 1;
	}
	
	
	return 0;
}

Measured memory_bytes: 3476
p=int(input())
a=input()
b=[]
for i in range(0,p):
    c=0
    t=list(set(a[:i]))
    k=a[i:]
    for j in range(len(t)):
        if t[j]in k:
            c+=1
    b.append(c)
print(max(b))

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
using ll = long long;

int main() {
    int A,B;
    cin >> A >> B;
    
    int a=0,b=0,c=0;
    a = A+B;
    b = A-B;
    c = A*B;
    
    cout << max({a,b,c}) << endl;
    
    return 0;
}


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

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

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

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

/* ------------------------------------- */

int main() {
	int k,n;
	char s[20];
	scanf("%d",&n);
	scanf("%s",&s);
	scanf("%d",&k);
	char kc = s[k-1];
	rep(i,n){
		if(s[i]!=kc){
			printf("*");
		}else{
			printf("%c",kc);
		}
	}
	
	
	
	/* --------------------------------- */
	printf("\n");
	return 0;
}

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

using namespace std;
#define y1     y114514
#define pb     push_back
#define mkp    make_pair
#define fi     first
#define se     second
#define all(a) a.begin(), a.end()

typedef pair<int, int>     pii;
typedef unsigned long long ull;
typedef long long          ll;

const int M    = 1000000007;
const int MAXL = 128;

int  n;
char ch[63];
int  c[63];
int  tot;

int ask(string s) {
    cout << "? " << s << endl;
    int v;
    cin >> v;
    return v;
}

string solve(int l, int r) {
    if (l == r) return string(c[l], ch[l]);
    int    mid = (l + r) >> 1;
    string a   = solve(l, mid);
    string b   = solve(mid + 1, r);
    if (a.size() == 0)
        return b;
    else if (b.size() == 0)
        return a;

    int    n = a.size(), m = b.size();
    string ret = "";
    int    i = 0, j = 0;
    while (j < m) {
        while (i < n && ask(ret + b[j] + a.substr(i, n - i)) != tot - n - j - 1)
            ret = ret + a[i++];
        ret = ret + b[j++];
    }
    if (i < n) ret += a.substr(i, n - i);
    return ret;
}

int main() {
    for (int i = 0; i < 26; ++i) ch[i] = 'a' + i;
    for (int i = 0; i < 26; ++i) ch[i + 26] = 'A' + i;
    for (int i = 0; i < 10; ++i) ch[i + 26 + 26] = '0' + i;

    for (int i = 0; i < 62; ++i) {
        c[i] = MAXL - ask(string(MAXL, ch[i]));
        tot += c[i];
    }

    string ans = solve(0, 61);
    cout << "! " << ans << endl;
    return 0;
}


Measured memory_bytes: 3728
#include <stdio.h>

int		main(void)
{
	int i;
	int x;

	i = 1;
	while (i <= 10000)
	{
		scanf("%d", &x);
		if (x == 0)
			break;
		printf("Case %d: %d\n", i, x);
		i++;
	}
	return (0);
}



Measured memory_bytes: 1912
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	
	
	ll n;
	cin>>n;
	ll a[n+1];
	ll s=0;
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
		s=s+a[i];
	}
	ll sw=0,min=INT_MAX;
	for(ll i=0;i<n;i++)
	{
		sw=sw+a[i];
		s=s-a[i];
		if(abs(sw-s)<min)
		{
			min=abs(sw-s);
		}
	}
	cout<<min;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))
from functools import reduce

def segfunc(a,b):
    if a == 0 or b == 0:
        return 0
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    return segfunc(b, r)

def gcd_list(numbers):
    return reduce(segfunc, numbers)

def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]    
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res


n = ii()
A = sorted(li())

#####単位元######
if n == 2:
    print(max(A))
    exit()
elif n == 3:
    ide_ele = max(segfunc(A[0], A[1]), segfunc(A[1], A[2]), segfunc(A[0], A[2]))
else:
    ide_ele = max(segfunc(A[-1], A[-2]), segfunc(A[-3], A[-4]))

#num:n以上の最小の2のべき乗
num =2**(n-1).bit_length()
seg=[ide_ele]*2*num

init(A)
ans = 0

#ans = max(query(1, n), ans)
#for i in range(1, n-1):
for i in range(n):
    #print(i, query(0, i), query(i+1, n))
    ans = max(segfunc(query(0, i), query(i+1, n)), ans)
#ans = max(query(0, n-1), ans)

print(ans)

Measured memory_bytes: 121540
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << -1 << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

struct C{
    int x;
    int y;
    double r;
    double t;
};

bool comp(C G,C H){
    return G.t<H.t;
}


signed main(void){
    int N;
    C XY[104];
    cin >> N;
    REP(i,N){
        cin >> XY[i].x >> XY[i].y;
    }
    REP(i,N){
        XY[i].r=hypot((double)XY[i].x,(double)XY[i].y);
        if(XY[i].x==0){
            if(XY[i].y>=0){
                XY[i].t=PI/2;
            }else{
                XY[i].t=-PI/2;
            }
        }else{
            XY[i].t=atan2(XY[i].y,XY[i].x);
        }
    }
    
    sort(XY,XY+N,comp);
    
    int calc=0;
    REP(i,N){
        REP(j,2*N){
            if(j-i>=N)continue;
            int p=0,q=0;
            for(int k=i;k<=j;k++){
                p+=XY[k%N].x;
                q+=XY[k%N].y;
            }
            int E=p*p+q*q;
            calc=max(calc,E);
        }
    }
    double Ans = sqrt(calc);
    
    printf("%.12f\n",Ans);
    
  return 0;
}



Measured memory_bytes: 256