akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll n, a, b, ans = 0;
    cin >> n >> a >> b;
    if((b - a) % 2 == 1){
        ans = min(b-1, a+(b-a-1)/2);
        ll num = n-b+1;
        ll num2 = a+num;
        ans = min(min(ans, n-a), num+(n-num2)/2);
        cout << ans << endl;
    }else{
        cout << (b - a)/2;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(X,A,B) for(int X=A;X<=B;X++)
#define tep(X,A,B) for(int X=A;X>=B;X--)
#define LL long long
const int N=500010;
const LL MOD=1e9+7;
using namespace std;

char s[N];
LL K;
int len;

LL SOLVE(){
	int pos=1,las=len,flg=0;
	rep(i,1,len){
		if(s[i]!=s[1]){
			flg=1;
			break;
		}
	}
	if(!flg)return (LL)len*K/2;
	int l=1,r=len;
	LL cnt=0,res=0;
	if(s[1]==s[len]){
		int now=0;
		while(s[l]==s[1])now++,l++;
		while(s[r]==s[1])now++,r--;
		res+=(K-1)*(now/2)+(l-1)/2+(len-r)/2;
	}
	int now=1;
	rep(i,l+1,r){
		if(s[i]==s[i-1])now++;
		else{
			cnt+=now/2;
			now=1;
		}
	}
	cnt+=now/=2;
	return res+K*cnt;
}

int main(){
	scanf("%s",s+1);
	scanf("%lld",&K);
	len=strlen(s+1);
	printf("%lld\n",SOLVE());
	return 0;
}

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

using namespace std;

int main() {
	int N, cnt = 0;;
	cin >> N;
	
	vector<int> X(N);
	vector<int> Y(N);
	for (int i = 0; i < N; i++) {
		cin >> X[i];
		Y[i] = X[i];
	}

	sort(Y.begin(), Y.end());

	for (int i = 0; i < N; i++) {
		if (X[i] != Y[i]) {
			cnt++;
		}
	}
	
	if (cnt == 0 || cnt == 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    if(N<105)
    cout << 0 << endl;
    else if(N<135)
    cout << 1 << endl;
    else if(N<165)
    cout << 2 << endl;
    else if(N<189)
    cout << 3 << endl;
    else if(N<195)
    cout << 4 << endl;
    else
    cout << 5 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define my_max(a, b) ((a) > (b) ? (a) : (b))
#define my_min(a, b) ((a) < (b) ? (a) : (b))
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rep(i, s, t) for(int i = (int)(s); i <= (int)(t); i++)
#define rev(i, t, s) for(int i = (int)(t); i >= (int)(s); i--)
#define lson rt << 1
#define rson rt << 1 | 1
#define sz(x) (int)(x).size()

typedef long long ll;
typedef long double lb;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::vector<int> VI;
typedef std::vector<ll> VL;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> rbtree;
ll gcd(ll x, ll y){ return y % x == 0 ? x : gcd(y % x, x); }
template<class T>T my_abs(T a){ if(a < 0) a = -a; return a; }
inline ll read(){
    ll ret = 0, sign = 1;
    char c = getchar();
    while(c < '0' || c > '9'){ if(c == '-') sign = -1; c = getchar();}
    while(c >= '0' && c <= '9'){ ret = ret * 10 + c - '0'; c = getchar(); }
    return ret * sign;
}
inline void write(ll x){
    if(x < 0){
        putchar('-');
        x = -x;
    }
    if(x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

//void expand_stack_space(){
//    int size = 256 << 20; // 256MB
//    char *p = (char*)malloc(size) + size;
//    __asm__("movl %0, %%esp\n" :: "r"(p));
//}
int main(){
#ifndef ONLINE_JUDGE
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif // ONLINE_JUDGE
    int y;
    scanf("%d", &y);
    for(ll i = 0; ; ++i) {
        ll x = i;
        x *= x; x *= x;
        x *= i;
        ll rest = x - y;
        if(rest >= 0) {
            ll l = 0, r = pow(rest, 0.2) + 10, mid;
            while(l <= r) {
                mid = (l + r) >> 1;
                if(mid * mid * mid * mid * mid <= rest) l = mid + 1;
                else r = mid - 1;
            }
            --l;
            if(l * l * l * l * l == rest) {
                printf("%lld %lld\n", i, l);
                break;
            }
        }
        else {
            rest = -rest;
            ll l = 0, r = pow(rest, 0.2) + 10, mid;
            while(l <= r) {
                mid = (l + r) >> 1;
                if(mid * mid * mid * mid * mid <= rest) l = mid + 1;
                else r = mid - 1;
            }
            --l;
            if(l * l * l * l * l == rest) {
                printf("%lld %lld\n", i, -l);
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 4196
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
const int MAX = 1e6 + 10;
const int MOD = 1e9 + 7;
const int oo = 1e9;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	#define endl '\n'
	int x, y; cin >> x >> y;
	if(y % 2 == 0 and y >= 2 * x and y <= 4 * x)cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main() {
  int h1, h2;
  int k1, k2;
  int a, b, c, d;
  cin >> h1 >> h2;
  cin >> k1 >> k2;
  cin >> a >> b >> c >> d;
  
  int h, k;
  h = a * h1 + b * h2 + h1 / 10 * c + h2 / 20 * d;
  k = a * k1 + b * k2 + k1 / 10 * c + k2 / 20 * d;
  cout << (h == k ? "even" : h > k ? "hiroshi" : "kenjiro") << endl;
}

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

int N,A,B;

int main()
{
    scanf("%d%d%d",&N,&A,&B);

    int cnt = 0;
    for(int i = 1; i <= N; i++)
    {
        int sum = i % 10 + i / 10 % 10 + i / 100 % 10 + i / 1000 % 10 + i / 10000 % 10;
        if(A <= sum && sum <= B)cnt += i;
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_set>
#include <random>
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a; cin >> a;
	cout << a + a * a + a * a*a << '\n';
	return 0;
}

Measured memory_bytes: 3592
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

function tousa(n: Integer):Integer;
begin
  if n=0 then
    result:=0
  else begin
    result:=n+tousa(n-1);
  end;
end;

var
  n:Integer;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Readln(n);
    Writeln(tousa(n));
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 128
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll diff(ll s1, ll s2, ll s3){
    ll min = s1;
    if(min > s2) min = s2;
    if(min > s3) min = s3;
    
    ll max = s1;
    if(max < s2) max = s2;
    if(max < s3) max = s3;

    return max - min;
}

int main(void){
    ll H,W;
    cin >> H >> W;

    ll ans = 10000000000;
    if(H%3 == 0 || W%3 == 0) ans = 0;
    else{
        for(ll i=1; i<H; i++){
            ll Sa = i*W;
            ll Sb = (H-i)/2 * W;
            ll Sc = (H-i-(H-i)/2) * W;
            chmin(ans, diff(Sa, Sb, Sc));
            Sb = (H-i)*(W/2);
            Sc = (H-i)*(W-W/2);
            chmin(ans, diff(Sa, Sb, Sc));
        }
        swap(H,W);
        for(ll i=1; i<H; i++){
            ll Sa = i*W;
            ll Sb = (H-i)/2 * W;
            ll Sc = (H-i-(H-i)/2) * W;
            chmin(ans, diff(Sa, Sb, Sc));
            Sb = (H-i)*(W/2);
            Sc = (H-i)*(W-W/2);
            chmin(ans, diff(Sa, Sb, Sc));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static String I = "IMPOSSIBLE";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		// 数値
		out(Math.min(n * a, b));

	}

	/*
	 * 以下メソッド集
	 */
	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}
}


Measured memory_bytes: 22608
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
      Scanner scanner = new Scanner(System.in);
      int n = scanner.nextInt();
      int k = scanner.nextInt();
      int[] height = new int[n];
      for (int i = 0; i < n; i++) {
      	height[i] = scanner.nextInt();
      }
      
      int count = 0;
      for (int j = 0; j < height.length; j++) {
      	if (height[j] >= k) count++;
      }
      System.out.println(count);
    }
}


Measured memory_bytes: 49104
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<cstring>
#include<functional>

using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin);

	int sol[200002];

	sol[0] = 0;

	for (int i = 1; i <= 200001; i++)
	{
		int temp = i;

		int divd = 0;

		while (temp)
		{
			divd += temp % 2;

			temp /= 2;
		}

		temp = i;

		int bit = 1;
		int cur = 0;

		while (temp)
		{
			if (temp % 2)
			{
				cur = (cur + bit) % divd;
			}

			bit = bit * 2 % divd;

			temp /= 2;
		}

		sol[i] = sol[cur] + 1;
	}

	int n;

	scanf("%d", &n);

	char input[200002];
	
	scanf("%s", input);

	string str = input;

	int divd = 0;

	for (int i = n - 1; i >= 0; i--)
	{
		divd += str[i] - '0';
	}

	int bit = 1;
	int base[2] = { 0, };

	if (divd > 1)
	{
		for (int i = n - 1; i >= 0; i--)
		{
			const int cur = str[i] - '0';

			if (cur)
			{
				base[1] = (base[1] + bit) % (divd - 1);
			}

			bit = bit * 2 % (divd - 1);
		}
	}

	bit = 1;

	for (int i = n - 1; i >= 0; i--)
	{
		const int cur = str[i] - '0';

		if (cur)
		{
			base[0] = (base[0] + bit) % (divd + 1);
		}

		bit = bit * 2 % (divd + 1);
	}

	bit = 1;

	int output[200002] = { 0, };

	if (divd > 1)
	{
		for (int i = n - 1; i >= 0; i--)
		{
			const int cur = str[i] - '0';

			int val;

			if (cur)
			{
				val = (base[1] + (divd - 1) - bit) % (divd - 1);

				output[i] = sol[val] + 1;
			}

			bit = bit * 2 % (divd - 1);
		}
	}

	bit = 1;

	for (int i = n - 1; i >= 0; i--)
	{
		const int cur = str[i] - '0';

		int val;

		if (!cur)
		{
			val = (base[0] + bit) % (divd + 1);

			output[i] = sol[val] + 1;
		}

		bit = bit * 2 % (divd + 1);
	}

	for (int i = 0; i < n; i++)
	{
		printf("%d\n", output[i]);
	}

	return 0;
}

Measured memory_bytes: 5088
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      int A = sc.nextInt();
      int B = sc.nextInt();
      int T = sc.nextInt();

      int all = 0;

      for(int i= 1;i*A<=T;i++){
        all = all + B;
      }

      System.out.println(all);

  }
}

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

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

  ll N; cin >> N;
  ll D; cin >> D;
  ll A; cin >> A;
  vector<pair<ll, ll>> P(N);
  for (int i = 0; i < N; i++) {
    ll x, h;
    cin >> x >> h;
    P[i] = make_pair(x, h);
  }
  sort(P.begin(), P.end());

  vector<int> status(N, 1);
  vector<ll> damage(N + 2, 0);
  ll INF = 1e15;
  ll l = 0;
  ll ans = 0;
  while (l < N) {
    pair<ll, ll> p = P[l];
    if (p.second > damage[l]) {
      
      ll times = (p.second - damage[l] + A - 1) / A;
      pair<ll, ll> lastPair = make_pair(p.first + 2 * D, INF);
      ll last = lower_bound(P.begin(), P.end(), lastPair) - P.begin();
      // cout << ' ' << last << '\n';

      ans += times;
      damage[l] += A * times;
      damage[last] -= A * times;
    }
    damage[l + 1] += damage[l];
    l++;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 5760
import java.util.*;
public class Main{

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int max = 100000;
    int n = sc.nextInt();
    long k = sc.nextLong();

    long[] nums = new long[max+1];

    for(int i = 1; i <= n; i++){
      nums[sc.nextInt()] += sc.nextInt();
    }
    for(int i = 1; i < nums.length; i++) {
          k -= nums[i];
          if(k <= 0) {
            System.out.println(i);
            return;
          }
    }
  }
}


Measured memory_bytes: 65104
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        while(true) {
            int n = sc.nextInt();
            if(n == 0)
                break;

            int a = sc.nextInt();
            int b = sc.nextInt();

            int max = (a>b)?a:b;
            int min = (a>b)?b:a;
            int sum = 0;

            for(int i=0;i<n-2;i++) {
                int c = sc.nextInt();
                if (c > max) {
                    sum += max;
                    max = c;
                } else if (min > c) {
                    sum += min;
                    min = c;
                } else {
                    sum += c;
                }
            }

            System.out.println(sum/(n-2));
        }
    }
}



Measured memory_bytes: 28788
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long double
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}

int main(){
	//mahakal(),fast;
	
	ll n;
	cin>> n ;
	ll odd=0;
	for(int i=1;i<=n ;i++){
		if(i&1)odd++;
	} 
	ll ans = odd/n;
	cout<<fixed<<setprecision(15)<<ans<<endl;

	

	return 0;
}

Measured memory_bytes: 256
from itertools import accumulate

n, k = list(map(int,input().split(" ")))
s = input()


def solve():
    cnt=0
    l=[]
    prev = '1'

    for c in s:
        if prev ==c:
            cnt+=1
        else:
            l.append(cnt)
            cnt = 1
        prev=c
    l.append(cnt)
    if prev=='0':
        l.append(0)

    w = 2*k+1

    if len(l)<=w:
        return n

    acc = [0]+list(accumulate(l))
    ans = 0
    for i in range(0, len(l)-w+1,2):
        ans = max(ans,acc[i+w]-acc[i])
    return ans
print(solve())


Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;
long long a[100005],sum[100005],sum2[100005];
char c[100005];
set<int> minu;
long long getsum(int l,int r){
	if(l>r) return 0;
	return (sum[r]-((l==0)?0:sum[l-1]));
}
long long getsum2(int l,int r){
	if(l>r) return 0;
	return (sum2[r]-((l==0)?0:sum2[l-1]));
}
int main(){
	int n;
	scanf("%d",&n);
	scanf("%I64d",&a[0]);
	c[0]='+';
	for(int i=1;i<n;i++){
		string tmp;
	//	scanf("%c",&c[i]);
		cin>>tmp;
		c[i]=tmp[0];
		scanf("%I64d",&a[i]);
		if(c[i]=='-') minu.insert(i);
	}
	sum[0]=a[0];
	sum2[0]=a[0];
	for(int i=1;i<n;i++){
		sum[i]=a[i]+sum[i-1];
		if(c[i]=='+') sum2[i]=sum2[i-1]+a[i]; else sum2[i]=sum2[i-1]-a[i];
	}
//	for(int i=0;i<n;i++) cout<<sum2[i]<<" ";
//	cout<<endl;
	long long now=0,ma=getsum2(0,n-1);
	for(int i=0;i<n;i++){
		if(c[i]=='-'&&minu.upper_bound(i)!=minu.end()){
			int idx=*minu.upper_bound(i);
			ma=max(ma,now-(a[i]+getsum2(i+1,idx-1)-getsum(idx,n-1)));
		//	cout<<i<<" "<<idx<<" "<<now<<" "<<getsum2(i,idx-1)<<" "<<getsum(idx,n-1)<<endl;
		}
		now=sum2[i];
	}
	cout<<ma;
}

Measured memory_bytes: 7424
X,N=map(int,input().split())
if N==0:
    input()
    print(X)
    exit(0)
xn=list(map(int,input().split()))

a=[(abs(x-X),x) for x in xn]

for d in range(0, 100):
    a1=d+X
    a2=-d+X
    if a2 not in xn:
        print(a2)
        exit(0)
    elif a1 not in xn:
        print(a1)
        exit(0)

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


int main(){
  string s;
  cin >> s;
  s.at(3) = '8';
  cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

int n, m;

int main() {

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

    cin >> n >> m;
    int ans = n * (n-1) / 2 + m * (m-1) / 2;
    cout << ans << endl;
	

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 double long double
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<'\n'
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
#define alln(arr) arr+1 , arr+1+n
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update> oset; 

int n,m,k,arr[N];

void solve()
{
    cin>>n>>k>>m;

    forn(i,1,k)
    {
    	arr[i] = m;
    }

    if(m>1e8)
    {
    	forn(i,k+1,n)arr[i] = 1;
    }
    else 
    {
    	forn(i,k+1,n)arr[i] = 1e9;
    }

    forn(i,1,n)cout<<arr[i]<<" ";
}


signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    forn(i,1,t)
    {
        solve();
        nl;
    }



    return 0;

}

//       clang++ c.cpp ; ./a.out < a.txt ;  

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1e9 + 7;
ll dp[101010][4];

int main(){
    string s; cin >> s;
    int N = s.size();
    s = '0' + s;
    dp[0][0] = 1;

    // 復習用に丁寧に場合分けして書いた
    // カウントを進める場合と進めない場合に分けて考えるとスッキリする
    for(int i=0; i<N; i++){
        if(s[i+1] == 'A'){
            dp[i+1][0] = dp[i][0];
            dp[i+1][2] = dp[i][2];
            dp[i+1][3] = dp[i][3];

            dp[i+1][1] = (dp[i][1] + dp[i][0]) % mod;
        } else if(s[i+1] == 'B'){
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = dp[i][1];
            dp[i+1][3] = dp[i][3];

            dp[i+1][2] = (dp[i][2] + dp[i][1]) % mod;
        } else if(s[i+1] == 'C'){
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = dp[i][1];
            dp[i+1][2] = dp[i][2];

            dp[i+1][3] = (dp[i][3] + dp[i][2]) % mod;
        } else if(s[i+1] == '?'){
            dp[i+1][0] = 3*dp[i][0] % mod;
            dp[i+1][1] = (3*dp[i][1] + dp[i][0]) % mod;
            dp[i+1][2] = (3*dp[i][2] + dp[i][1]) % mod;
            dp[i+1][3] = (3*dp[i][3] + dp[i][2]) % mod;
        }
    }

    cout << dp[N][3] << endl;

}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if (n % 2 == 0)
        cout << n;
    else
        cout << 2 * n;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string n;
  cin >> n;
  REP(i, 3){
    if(n[i] == '7'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

typedef long long ll;
const int MAXN = 100 + 10;
const int Mod = 1e9 + 7;
int N;
int A[MAXN];
int f[MAXN];

inline int fastpow_mod(int a, ll b) {
	int x = 1;
	while(b) {
		if(b & 1) x = 1ll * x * a % Mod;
		a = 1ll * a * a % Mod; b >>= 1;
	}
	return x;
}

int main() {
	register int i, j, k;
	scanf("%d", &N);
	for(i = 1; i <= N; ++i)
		scanf("%d", A + i);
	f[0] = 1;
	A[N + 1] = 1;
	for(i = 1; i <= N + 1; ++i) {
		f[i] = f[i - 1] * 2 % Mod;
		for(j = 1; j < i; ++j) {
			int l = max(A[i], A[j - 1]), r = A[j] - 1;
			ll s = 0;
			for(k = j; k < i; ++k)
				r = min(r, A[k] - 1), s += max(A[k + 1] - A[k], 0);
			if(l <= r) {
				int t1 = fastpow_mod(2, A[j] - r - 1);
				int t2 = fastpow_mod(2, r - l + 1) - 1;
				int t3 = fastpow_mod(2, s);
				f[i] = (f[i] + 4ll * f[j - 1] * t1 % Mod * t2 % Mod * t3 % Mod) % Mod;
			}
		}
	}
	printf("%lld\n", 1ll * f[N + 1] * (Mod + 1) / 2 % Mod);
	return 0;
}

Measured memory_bytes: 128
n = int(input())
a = list(map(int, input().split()))
flag = True
cnt = 0
while flag:
    flag = False
    for j in range(n - 1, 0, -1):
        if a[j] < a[j-1]:
            a[j-1], a[j] = a[j], a[j-1]
            cnt += 1
            flag = True
print(' '.join(list(map(str, a))))
print(cnt)


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  int time = 0;
  if (max(a, c) <= min(b, d)) time = min(b, d) - max(a, c);
  
  cout << time << endl;  // max(0, min(b,d)-max(a,c))でも良い
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
typedef long long ll;
#define INF 1000000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int s(int n){
   int sum=0;
   while(n){
      sum+=n%10;
      n/=10;
   }
   return sum;
}
int main(void){
   int n;
   cin>>n;
   int a=s(n);
   //cout<<a<<endl;
   if(n%a==0){
      cout<<"Yes"<<endl;
   }else{
      cout<<"No"<<endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_set>

using namespace std;

typedef long long ll;


int main(){
  ll N, M, a, b, h;
  cin >> N >> M;
  vector<bool> F(N, true);
  vector<ll> H(N, 0);
  for (int i=0; i<N; i++){
  	cin >> h;
    H[i] = h;
  }
  
  for (int i=0; i<M; i++){
  	cin >> a >> b;
    a--; b--;
    if (H[a] <= H[b]){
      F[a] = false;
    }
    if (H[a] >= H[b]) {
      F[b] = false;
    }
  }
  ll ans = 0;
  for (bool f : F){
    if (f) ans++;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3972
#%%
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())
a.sort(reverse=True)
ook = []
tii = []
for i in range(0, n//2):
    ook.append(a[i])
for i in range(n//2, n):
    tii.append(a[i])
if n % 2 == 0:
    ans = 2 * (sum(ook) - sum(tii)) - (ook[-1] - tii[0])
    print(ans)
else:
    tmp = tii.pop(0)
    tmp1 = 2 * (sum(ook) - sum(tii)) + (tii[0]) - tmp
    tmp2 = 2 * (sum(ook) - sum(tii)) + tmp - ook[-1]
    print(max(tmp1, tmp2))



Measured memory_bytes: 8104
N, M = map(int, input().split())
S = []
C = []
for _ in range(M):
  s, c = map(int, input().split())
  S.append(s - 1)
  C.append(c)

num = ['*'] * N

for s, c in zip(S, C):
  if s == 0 and c == 0 and N != 1:
    print(-1)
    exit()
  if num[s] == '*':
    num[s] = str(c)
  elif num[s] != str(c):
    print(-1)
    exit()

if num[0] == '*' and N != 1:
  num[0] = '1'
print(''.join(num).replace('*', '0'))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
long mypow(long x,long p){
  if(p==0)return 1;
  if(p%2)return mypow(x,p-1)*x%MOD;
  long y=mypow(x,p/2);return y*y%MOD;
}
long inv(long x){
  return mypow(x,MOD-2);
}
long COM(long n,long k){
  long x=1;
  for(long i=1;i<=n;i++)x=x*i%MOD;
  for(long i=1;i<=k;i++)x=x*inv(i)%MOD;
  for(long i=1;i<=n-k;i++)x=x*inv(i)%MOD;
  return x;
}
int main(){
  long x,y;cin>>x>>y;
  if((x+y)%3!=0||x<(x+y)/3||x>2*(x+y)/3){
    cout<<0;return 0;
  }
  cout<<COM((x+y)/3,x-(x+y)/3)<<endl;
}



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

bool solve() {
    ll N, M, s = 0;
    cin >> N >> M;
    vector<ll> A(N);
    ll c = 0;
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
        s += A[i];
    }
    for ( int i = 0; i < N; i++ ) {
        if ( A[i] * 4 * M >= s ) c++;
    }
    return c >= M;
}

int main() {
    string ans = solve() ? "Yes" : "No";
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int sx, sy;
int n;
int px[11], py[11];

int dx[] = {-1, 0, 1, -2, 2, -2, 2, -2, 2, -1, 0, 1};
int dy[] = {2, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2, -2};

int wx[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
int wy[] = {1, 1, 1, 0, 0, 0, -1, -1, -1};

bool dfs(int x, int y, int t) {
    if (t == n) {
        return true;
    }
    bool ret = false;
    for (int i = 0; i < 12; ++i) {
        int nextx = x + dx[i];
        int nexty = y + dy[i];
        if (nextx < 0 || 9 < nextx || nexty < 0 || 9 < nexty) {
            continue;
        }
        bool hasWater = false;
        for (int j = 0; j < 9; ++j) {
            int tmpx = px[t] + wx[j];
            int tmpy = py[t] + wy[j];
            if (nextx == tmpx && nexty == tmpy) {
                hasWater = true;
                break;
            }
        }
        if (!hasWater) {
            continue;
        }
        ret += dfs(nextx, nexty, t + 1);
    }
    return ret;
}

int main() {
    while (true) {
        cin >> sx >> sy;
        if (sx == 0 && sy == 0) {
            return 0;
        }
        cin >> n;
        for (int i = 0; i < n; ++i) {
            cin >> px[i] >> py[i];
        }

        if (dfs(sx, sy, 0)) {
            cout << "OK" << endl;
        } else {
            cout << "NA" << endl;
        }
    }
}

Measured memory_bytes: 1152
#include <cstdio>
#include <vector>
#include <stack>
using namespace std;

stack<int> st;

void topologicalSort(vector<int> *a, int u, bool *check){
    if(check[u])return;

    check[u] = true;
    int i;
    for(i=0;i<a[u].size();i++){
        topologicalSort(a,a[u][i],check);
    }

    st.push(u);

    return;
}

int main(){
    int i,s,t,V,E;

    scanf("%d %d",&V,&E);
    vector<int> a[10000];
    bool check[10000];

    for(i=0;i<V;i++){
        check[i] = false;
    }

    for(i=0;i<E;i++){
        scanf("%d %d",&s,&t);
        a[s].push_back(t);
    }

    for(i=0;i<V;i++){
        topologicalSort(a,i,check);
    }

    while(!st.empty()){
        printf("%d\n",st.top());
        st.pop();
    }

    return 0;
}



Measured memory_bytes: 3076
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);

void Main() {
  string s;
  cin >> s;
  map<char, int> S;
  rep(i, 0, s.size()) {
    if (S.count(s[i]) == 0) {
      S[s[i]] = 1;
    } else {
      puts("no");
      return;
    }
  }
  puts("yes");
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


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


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int x; cin >> x;
	for (int i = x; ; i++) {
		if (prime(i)) {
			cout << i << endl; return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int N, K;
    scan(N, K);
    readln.split.to!(int[]).filter!(h => h >= K).count.writeln;
}






void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 4360
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_E
#define M_E 2.71828182845904523536
#endif
#ifdef DEBUG
#include <boost/core/demangle.hpp>
#define dump(x) cerr << "L" << __LINE__ << ": in " << __PRETTY_FUNCTION__ << " \e[32;1m" << boost::core::demangle(typeid(x).name()) << "\e[37m" << " " << (#x) << " = " << (x) << "\e[m" << endl;
#else
#define dump(x)
#endif
#define pln(x) cout << (x) << endl
using namespace std;
template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename Iter> ostream& out_container(ostream &os, Iter first, Iter last){
  os << "{"; auto itr = first; while(itr != last){if(itr != first) os << ","; os << *itr; ++itr;} os << "}"; return os;
}

template <typename T> ostream& operator<<(ostream &os, const vector<T> &c){return out_container(os,ALL(c));}
template <typename T> ostream& operator<<(ostream &os, const deque<T> &c){return out_container(os,ALL(c));}
template <typename T> ostream& operator<<(ostream &os, const set<T> &c){return out_container(os,ALL(c));}
template <typename T> ostream& operator<<(ostream &os, const unordered_set<T> &c){return out_container(os,ALL(c));}
template <typename T, typename U> ostream& operator<<(ostream &os, const map<T,U> &c){return out_container(os,ALL(c));}
template <typename T, typename U> ostream& operator<<(ostream &os, const unordered_map<T,U> &c){return out_container(os,ALL(c));}
template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T,U> &p){os << "(" << p.first << "," << p.second << ")"; return os;}

template <typename T> T& chmin(T &a, const T &b){return a = min(a,b);}
template <typename T> T& chmax(T &a, const T &b){return a = max(a,b);}

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

  int a,b,c;
  while(cin >> a >> b >> c){
    pln(a*b/2);
  }
  
  return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    from math import gcd

    x = int(readline())
    print(360 // gcd(x, 360))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9164
var
  i,j:longint;
  s:string;
  f:boolean;
begin
  read(s);
  for i:=1 to length(s) do
    if s[i]='C' then begin j:=i;break;end;
  if j<>0 then
  for i:=j+1 to length(s) do
    if s[i]='F' then begin f:=true;break;end;
  if f then write('Yes')
       else write('No');
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,m;
  cin>>n>>m;
  cout<<((n-m)*100+m*1900)*(1/pow(0.5,m))<<endl;
}




Measured memory_bytes: 256
#include <stdio.h>
#define CARD 52
#define CD 13
int main(void)
{
	int n,a,c[CARD],i;
	char mark;
	for(i=0;i<CARD;i++){
		c[i]=0;
	}
	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf(" %c %d", &mark,&a);
		a -= 1;
		if(mark == 'S'){
			c[a]=1;
		}else if(mark == 'H'){
			c[a+CD]=1;
		}else if(mark == 'C'){
			c[a+CD*2]=1;
		}else if(mark == 'D'){
			c[a+CD*3]=1;
		}
	}
 	for(i=0;i<CARD;i++){
		if(c[i]==0){
			if((i/CD) == 0){
				printf("S %d\n", i%CD+1);
			}else if((i/CD) == 1){
				printf("H %d\n", i%CD+1);
			}else if((i/CD) == 2){
				printf("C %d\n", i%CD+1);
			}else if((i/CD) == 3){
				printf("D %d\n", i%CD+1);
			}
		}
	}
	return 0;
}

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

int h[100001];

int main(){
    int n,k; cin >> n >> k;
    for(int i=0;i<n;i++) cin >> h[i];
    sort(h,h+n);
    int ans=1e9;
    for(int i=k-1;i<n;i++){
        ans=min(ans,h[i]-h[i-k+1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
from collections import deque
import bisect
N=int(input())
L=deque()
for i in range(N):
  s=int(input())
  if i==0:
    L.append(s)
  else:
    if s<=L[0]:
      L.appendleft(s)
    else:
      L[bisect.bisect(L,s-1)-1]=s
print(len(L))

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

int main(void)
{
    long long int n,a,b;
    cin>>n>>a>>b;
    
    long long int ans=n/(a+b)*a;
    n%=(a+b);

    if (n>=a)
    {
        cout<<ans+a<<endl;
    }
    else
    {
        cout<<ans+n<<endl;   
    }
    
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
long long mod=1e9+7,n,m,i,j,k,p,dp[55][105][105],a[105],ans;
int main()
{
	cin>>n;
	m=n+n-1;
	for (i=1;i<=m;i++) cin>>a[i];
	sort(a+1,a+m+1);
	dp[n][0][0]=1;
	for (i=n;i>=2;i--)
	{
		bool l=(a[i]!=a[i-1]),r=(a[m-i+1]!=a[m-i+2]);
		for (j=0;j<=m;j++)
		{
			for (k=0;k<=m;k++)
			{
				 (dp[i-1][j+l][k+r]+=dp[i][j][k])%=mod;
				 for (p=0;p<j+l;p++)
				 {
				 	(dp[i-1][p][k+r+1]+=dp[i][j][k])%=mod;
				 }
				 for (p=0;p<k+r;p++)
				 {
				 	(dp[i-1][j+l+1][p]+=dp[i][j][k])%=mod;
				 }
			}
		}
	}
	for (j=0;j<=m;j++)
	{
		for (k=0;k<=m;k++)
		{
			(ans+=dp[1][j][k])%=mod;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4480
# coding: utf-8
import math

N = int(input())
A = list(map(int, input().split()))
A_sum = sum(A)

res = list()
res.append(A_sum - 2 * sum([A[(2*j+1)] for j in range(int((N-1)/2))]))

for i in range(1, N):
    res.append(2*A[i-1] - res[i-1])

print(' '.join(map(str, res)))

Measured memory_bytes: 19224
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int calc(ll A, ll B){
    int retA=0;
    while(A>0){
        retA++;
        A/=10LL;
    }
    int retB=0;
    while(B>0){
        retB++;
        B/=10LL;
    }
    return max(retA,retB);
}

int main(){
    ll N;
    cin >> N;
    int ans=MOD;
    for(ll i=1; i*i<=N; i++){
        if(N%i==0){
            ans=min(ans,calc(i,N/i));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    VI a(n);
    int s = 0;
    REP(i,n){
        cin >> a[i];
        s += a[i];
    }
    s /= n;

    int x = 0, y = 0;
    REP(i,n){
        x += (a[i]-s)*(a[i]-s);
        y += (a[i]-s-1)*(a[i]-s-1);
    }

    cout << min(x,y) << endl;

    return 0;
}


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

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b;
    if(a==1 && b==2 || a==2 && b==1)
    {
        cout<<"3"<<endl;
    }
    else if(a==3 && b==1 || b==3 && a==1)
    {
        cout<<"2"<<endl;
    }
    else if(a==3 && b==2 || b==3 && a==2)
    {
        cout<<"1"<<endl;
    }
    return 0;
}



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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);

int main() {
    ios_base::sync_with_stdio(false);
    vector<ll> v;
    int n; cin >> n;

    for(int i = 0; i < n; i++) {
        ll x; cin >> x;
        v.pb(x);
    }

    ll best = INF;
    for(ll i = 1; i <= 100; i++) {
        ll tmp = 0;
        for(int j = 0; j < n; j++) tmp += abs(i-v[j])*abs(i-v[j]);
        best = min(best,tmp);

    }

    cout << best << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
const int MOD=1e9+7;
const double eps=1e-8;
typedef long long ll;
//orz yht
using namespace std;
int n,m;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n>>m;
	int ans=0;
	while(n!=0){
		n/=m;
		ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define mod 1000000007
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define setA0(a) for(ull i =0;i<n;i++){a[i] = 0;}
#define aout(a) for(auto x : a){cout<<x<<' ';} 
#define ain(a) for(ull i =0;i<n;i++){cin>>a[i];}
#define NofSetBits(x) __builtin_popcount(x);
#define InpGrph(g,e) while(e--){ll x;ll y;cin>>x>>y ;g[x].pub(y);g[y].pub(x);}
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);




int main(){
  FastIO;
  ld d,t,s;
  cin>>d>>t>>s;
  cout<<((s>=double(d/t))?"Yes":"No");
  return 0;
} 




Measured memory_bytes: 3676
import sys
from io import StringIO
import unittest

def resolve():
    n = int(input())
    h = list(map(int, input().split()))

    inf = n * 10 ** 7
    ans = [inf for _ in range(n)]
    ans[0] = 0
    ans[1] = abs(h[1] - h[0])

    for i in range(2, n):
        ans[i] = min(ans[i], ans[i - 1] + abs(h[i] - h[i - 1]), ans[i - 2] + abs(h[i] - h[i - 2]))

    print(ans[-1])


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """4
10 30 40 20"""
        output = """30"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """2
10 10"""
        output = """0"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """6
30 10 60 10 60 50"""
        output = """40"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Measured memory_bytes: 66760
#include <stdio.h>

int searchWay(int n,int x){
	int cnt = 0;
	for(int i = 1; i <= n-2; i++){
		for(int j = i + 1; j <= n-1; j++){
			for(int k = j + 1; k <= n; k++){
				if(i+j+k == x){
					cnt++;
					break;
				}
			}
		}
	}
	return cnt;
}

int main(void) {
	int n,x;
	scanf("%d%d",&n,&x);
	while(n+x){
		printf("%d\n",searchWay(n,x));
		scanf("%d%d",&n,&x);
	}
	return 0;
}



Measured memory_bytes: 2056
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ForYellow
{
    class AGC017_D
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            List<int>[] graph = new List<int>[n];
            for(int i = 0; i < n; i++)
            {
                graph[i] = new List<int>();
            }
            for(int i = 0; i < n - 1; i++)
            {
                int[] xy = ReadInts();
                int x = xy[0] - 1;
                int y = xy[1] - 1;

                graph[x].Add(y);
                graph[y].Add(x);
            }

            if (DFS(graph, 0, -1) > 0)
            {
                WriteLine("Alice");
            }
            else
            {
                WriteLine("Bob");
            }
        }

        static int DFS(List<int>[] graph,int now,int parent)
        {
            if (parent >= 0 && graph[now].Count == 1)
            {
                return 0;
            }

            int val = 0;
            for(int i = 0; i < graph[now].Count; i++)
            {
                int to = graph[now][i];
                if (to == parent)
                {
                    continue;
                }

                val ^= DFS(graph, to, now) + 1;
            }

            return val;
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 30732
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

int calc(int x)
{
	int sum = 0;
	while (x != 0)
	{
		sum += x % 10;
		x /= 10;
	}
	return sum;
}

int main(void)
{
	int n, a, b; cin >> n >> a >> b;
	int cnt = 0, ans;

	for (int i = 1; i <= n; i++)
	{
		ans = calc(i);
		if (ans >= a && ans <= b)
		{
			cnt += i;
		}
	}

	cout << cnt << endl;
}


Measured memory_bytes: 256