akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#include<chrono>
#include<random>
#include<iostream>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
#define VI vector<int>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=200005;
char ch[MAXN];
int main()
{
	#ifdef Rose
		double BeginJudgeTime=clock();
	#endif
	LL ans=0;
	scanf("%s",ch+1);int len=strlen(ch+1);
	int totalz=0;
	for(int i=1;i<=len;i++)totalz+=(ch[i]=='0');
	ch[len+1]='0';
	int z=0,o=0,L=0;
	for(int i=1;i<=len+1;i++)
	{
		if(ch[i]=='1')++L;
		else
		{
			if(!(L&1))ans+=1LL*(L>>1)*totalz;
			else
			{
				if(L)
				{
					ans+=1LL*((L>>1)+1)*totalz;
					if((i-1)&1)ans-=z>>1;
					else ans-=(z+1)>>1;
				}
			}o+=L;L=0;++z;
		}
	}
	for(int i=1;i<=o;i++)ans+=(i+1)>>1;
	pr2(ans);
	#ifdef Rose
		double EndJudgeTime=clock();
		cerr<<"JudgeTime is"<<" ";
		cerr<<(EndJudgeTime-BeginJudgeTime)/CLOCKS_PER_SEC<<endl;
	#endif
	return 0;
}


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

int main(int argc, const char * argv[]) {
    ll n, a;
    cin >> n;
    vector<ll> s(n+1);
    s[0] = 0;
    for (ll i = 1; i < n + 1; i++) {
        cin >> a;
        s[i] += s[i-1] + a;
    }
    sort(s.begin(), s.end());
    /*
    for (ll i = 0; i < n + 1; i++) {
        cout << s[i] << " ";
    }
    cout << endl;
    */
    bool flag = true;
    ll ans = 0;
    for (ll i = 0; i < n + 1 && flag; i++) {
        ll cnt = 1;
        for (ll j = i + 1; j < n + 1; j++) {
            if (j == n) {
                flag = false;
            }
            if (s[i] == s[j]) {
                cnt++;
            }else{
                i = j - 1;
                break;
            }
        }
        if (cnt >= 2) {
            ll top = 1, bottom = 2;
            for (ll k = cnt; k > cnt - bottom; k--) {
                top *= k;
            }
            ans += top / bottom;
        }
    }
    cout << ans << endl;
    
    return 0;
}
 

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

int main() {
	vector<int> X(1001,0);
	for(int j = 2 ; j < 10 ; j++){
		for(int i = 1 ; pow(i,j) < 1001 ; i++){
			X[pow(i,j)]++;
		}
	}
	int N; cin >> N ;
	for(int i = N ; N > 0 ; i--){
		if(X[i]){
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================
//using系

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
using kaage = priority_queue<int, vector<int>, greater<int>>;

// ========================================================================
//define系

//#define int long long;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)

// ========================================================================


ll gcd(ll a, ll b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}
//最大公約数
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
//最小公倍数
ll box(double a)
{
	ll b = a;
	return b;
}
//切り捨て
ll fff(double a)
{
	ll b = a + 0.5;
	return b;
}
//四捨五入
ll mch(ll n) {
	if (n == 1) return 1;
	else return n * mch(n - 1);
}
//1から整数nまでの階乗を出す(INFで割っていない)
bool prime(ll a)//素数判定、primeならtrue,違うならfalse
{
	if (a < 2) return false;
	else if (a == 2) return true;
	else if (a % 2 == 0) return false;
	double m = sqrt(a);
	for (int i = 3; i <= m; i += 2)
	{
		if (a % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}
//素数判定
ll modpow(ll a, ll n, ll mod) {
	ll hi = 1;
	while (n > 0) {
		if (n & 1) hi = hi * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return hi;
}
//いろいろやります（ただの前座）
ll mg(ll a, ll mod) {
	return modpow(a, mod - 2, mod);
}
//割り算の10^9+7等対策で逆元を出します 




// ========================================================================


/*signed*/int main() {
	ll k, x; cin >> k >> x;
	for (int i = x - k + 1; i < x + k; i++) {
		cout << i << " ";
	}

	return 0;
}

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

using namespace std;

class Point {
public:
	double x, y;
};

void kochCurve(int n, Point p1, Point p2) {
	Point s, t, u;

	if (n == 0) {
		return;
	}
	
	s.x = (p2.x + 2 * p1.x) / 3.0;
	s.y = (p2.y + 2 * p1.y) / 3.0;
	t.x = (p1.x + 2 * p2.x) / 3.0;
	t.y = (p1.y + 2 * p2.y) / 3.0;

	u.x = (t.x - s.x)*0.5 - (t.y - s.y)*sqrt(3)*0.5 + s.x;
	u.y = (t.x - s.x)*sqrt(3)*0.5 + (t.y - s.y)*0.5 + s.y;

	kochCurve(n - 1, p1, s);
	cout << fixed << setprecision(6) << s.x << " " << s.y << endl;

	kochCurve(n - 1, s, u);
	cout << fixed << setprecision(6) << u.x << " " << u.y << endl;

	kochCurve(n - 1, u, t);
	cout << fixed << setprecision(6) << t.x << " " << t.y << endl;

	kochCurve(n - 1, t, p2);
}

int main() {
	int n;
	Point p1, p2;

	p1.x = 0;
	p1.y = 0;
	p2.x = 100;
	p2.y = 0;

	cin >> n;
	cout << fixed << setprecision(6) << p1.x << " " << p1.y << endl;
	kochCurve(n, p1, p2);
	cout << fixed << setprecision(6) << p2.x << " " << p2.y << endl;
	
	return 0;
}


Measured memory_bytes: 3248
#include<bits/stdc++.h>
using namespace std;
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long
const ll M=1e9+7;
const int MAXN=2e5+1;

vector<int> v[MAXN];

ll dp[MAXN][2];

void dfs(int node,int p){
	ll prod1=1,prod2=1;

	for(int x:v[node]){
		if(x==p) continue;
		dfs(x,node);
		prod1=(prod1*(dp[x][1]+dp[x][0])%M)%M;
		prod2=(prod2*(dp[x][0]))%M;
		
	}

	dp[node][0]=prod1;
	dp[node][1]=prod2;
}

int main(){

	int n;
	sfi(n)

	f(i,0,n-1){
		int x,y;
		sfi(x) sfi(y)
		v[x].push_back(y); v[y].push_back(x);
	}

	dfs(1,1);

	if(dp[1][0]==0 && dp[1][1]==0)
		dp[1][0]=dp[1][1]=1;

	ll ans=(dp[1][0]+dp[1][1])%M;

	pfln(ans)

	return 0;	
}

Measured memory_bytes: 17664
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  long long k;
  cin >> k;
  vector<long long> w(n), d(n);
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> d[i];
  }
  long long lo = 0, hi = 2e18 + 1;
  const long long INF = 1e9 + 1;
  while (hi - lo > 1) {
    long long mid = (lo + hi) >> 1;
    long long count = 0;
    for (int i = 0; i < n; i++) {
      if (mid < w[i]) continue;
      count += (mid - w[i]) / d[i] + 1;
      count = min(count, INF);
    }
    if (count >= k) hi = mid;
    else lo = mid;
  }
  cout << hi << endl;
  return 0;
}

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

int main(){
    int r, c;
    cin >> r >> c;
    int a[r + 1][c + 1];
    for(int i = 0; i < r; i++){
        int s = 0;
        for(int j = 0; j < c; j++){
            cin >> a[i][j];
            s += a[i][j];
            if(j == c - 1){
                a[i][j + 1] = s;
            }
        }
    }
    for(int i = 0; i <= c; i++){
        int s = 0;
        for(int j = 0; j < r; j++){
            s += a[j][i];
            if(j == r - 1){
                a[j + 1][i] = s;
            }
        }
    }
    for(int i = 0; i <= r; i++){
        for(int j = 0; j <= c; j++){
            cout << a[i][j];
            if(j != c){
                cout << " ";
            }
            if(j == c){
                cout << endl;
            }
        }
    }
}


Measured memory_bytes: 3044
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main(){
  char s[100002];
  cin >> s;
  int len, i, count=0;
  len=strlen(s);
  for(i=0;i<len;i++){
    if(s[i]=='0')count++;
  }
  cout << 2*min(count, len-count);
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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; }

int gcd(int a, int b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));}

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

vector<pair<ll, int>> prime_div(ll n){
  vector<pair<ll, int>> res;
  for (ll i=2; i*i <= n;i++){
    if (n%i == 0){
      int a = 0;
      while(n%i == 0){
        n /= i;
        a++;
      }
      pair<ll, int> tmp;
      tmp.first = i;
      tmp.second = a;
      res.push_back(tmp);
    }
  }
  if (n != 1){
    pair<ll, int> now;
    now.first = n;
    now.second = 1;
    res.push_back(now);}
  return res;
}


// printf("%.10f\n" , ans);
int main(void){
  ios::sync_with_stdio(false);
  int h, w , k;
  cin >> h >> w >> k;
  vector<string> maze(h);
  REP(i, h) cin >> maze[i];
  int ans = 0;
  REP(is, 1<<h) REP(js, 1<<w){
      int cnt=0;
      REP(i, h) REP(j, w){
        if (is>>i & 1) continue;
        if (js>>j & 1) continue;
        if (maze[i][j] == '#') cnt++;
      }
      if (cnt == k) ans++;
    }
  cout << ans << endl;
  return 0;
}



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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};



int main()
{
  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  a.insert(a.begin(), 0);
  a.push_back(0);
  ll init = 0;
  for(int i = 1; i <= n+1; ++i) {
    init += abs(a[i]-a[i-1]);
  }
  for(int i = 1; i <= n; ++i) {
    ll res = init;
    res -= abs(a[i-1]-a[i]) + abs(a[i]-a[i+1]);
    res += abs(a[i+1]-a[i-1]);
    cout << res << endl;
  }
}


Measured memory_bytes: 4772
X,Y= map(int,input().split())

def f(v):
    if v == 3:
        return 100000
    elif v == 2:
        return 200000
    elif v == 1:
        return 300000
    else:
        return 0

print(f(X)+f(Y)+400000*((X==1) and (Y == 1)))


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

int main()
{
  string S; cin >> S;
  int K; cin >> K;
  int len = S.size();
  vector<vector<ll>> dp0(len+1, vector<ll>(5, 0));
  vector<vector<ll>> dp1(len+1, vector<ll>(5, 0));
  dp1[0][0] = 1;
  for (int i=0; i<len; i++) {
    for (int k=0; k<K+1; k++) {
      if (S[i] != '0') {
        dp0[i+1][k] += dp0[i][k] + dp1[i][k];
      } else {
        dp0[i+1][k] += dp0[i][k];
        dp1[i+1][k] += dp1[i][k];
      }
      for (int d=1; d<10; d++) {
        if (d < S[i] - '0') {
          dp0[i+1][k+1] += dp0[i][k] + dp1[i][k];
        } else if (d == S[i] - '0') {
          dp0[i+1][k+1] += dp0[i][k];
          dp1[i+1][k+1] += dp1[i][k];
        } else {
          dp0[i+1][k+1] += dp0[i][k];
        }
      }
    }
  }
  cout << dp0[len][K] + dp1[len][K] << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
long long sum=0;
const int mod=998244353;
int read()
{
	char c=getchar();
	int res=0;
	while(c<'0'||c>'9') c=getchar();
	while(c>='0'&&c<='9') res=(res<<1)+(res<<3)+(c^48),c=getchar();
	return res;
}
long long ksm(long long x,long long n)
{
	long long ans=1;
	while(n)
	{
		if(n&1) ans=ans*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return ans;
}
int n,sta;
long long a[1<<18],p[1<<18],f[1<<18];
void FWT(long long a[],int n,int ty)
{
	for(int i=1;i<n;i<<=1)
	for(int j=0;j<n;j++)
	{
		if(j&i)
		{
			long long t0=a[j-i],t1=a[j];
			a[j-i]=(t0+t1)%mod;a[j]=(t0-t1+mod)%mod;
		}
	}
	if(ty==-1)
	{
		long long rev=ksm(n,mod-2);
		for(int i=0;i<n;i++) a[i]=a[i]*rev%mod;
	}
}
int main()
{
	n=read();sta=1<<n;
	for(int i=0;i<sta;i++) a[i]=p[i]=read(),sum=(sum+p[i])%mod;
	sum=ksm(sum,mod-2);
	for(int i=0;i<sta;i++) p[i]=p[i]*sum%mod;
	FWT(p,sta,1);
	for(int i=1;i<sta;i++) f[i]=-sta*ksm(1-p[i],mod-2)%mod;
	FWT(f,sta,-1);
	for(int i=0;i<sta;i++) printf("%lld\n",(f[i]-f[0]+mod)%mod);
}

Measured memory_bytes: 9768
using System;
using System.Collections.Generic;
using System.Linq;

class Program{


  static int k, cost;
  static bool yn = false;

  static int Main() {

    string[] nyu = new string[2];
    nyu = Console.ReadLine().Split(' ');

    char[] n = nyu[0].ToCharArray();
    cost = int.Parse(nyu[0]);
    k = int.Parse(nyu[1]);

    char[] d = new char[k];
    string[] nya = new string[k];
    nya = Console.ReadLine().Split(' ');

    for (int i = 0; i < k ; i ++){
      d[i] = nya[i][0];
    }

    while (true) {
      yn = false;

      for (int i = 0; i < n.Length; i++) {
        for ( int j = 0; j < d.Length; j ++) {
          if (n[i] == d[j]) {
            yn = true;
            break;
          }
        }
        if (yn == true) break;
      }

      if ( yn == true) {
        cost ++;
        string str = cost.ToString();
        n = str.ToCharArray();
      }else {
        break;
      }
    }



    Console.WriteLine("{0}", cost);

    return 0;
  }

}


Measured memory_bytes: 15184
/**
1 から n までの数の中から、重複無しで３つの数を選びそれらの合計が x となる組み合わせの数を求めるプログラムを作成して下さい。

例えば、1 から 5 までの数から３つを選んでそれらの合計が 9 となる組み合わせは、
?1 + 3 + 5 = 9
?2 + 3 + 4 = 9

の２通りがあります。

 */

/*sucannerクラス使うためにインポート*/
import java.util.Scanner;

class Main {
	// プログラムのエントリポイント
	public static void main(String[] args) {
		// 入力ストリームの生成
		Scanner sc = new Scanner(System.in);
		// 点数を受け取る変数を宣言
		int intN = 0;
		int intX = 0;
		int intKekka = 0;

		// breakされるまで処理をくりかえす
		while (true) {

			// 数字を二つ受け取る
			intN = sc.nextInt();
			intX = sc.nextInt();
			//結果を表示する変数
			intKekka = 0;
			//二つの数値が０だった場合処理を狩猟する
			if (intN == 0 && intX == 0) {
				break;
			}

			//受け取った数字N*N*N回処理を実行する
			for (int i = 1; i <= intN; i++) {
				for (int j = 1; j <= intN; j++) {
					for (int k = 1; k <= intN; k++) {
						//ijkが同じ数字だったときなにもしない
						if(i == j || j == k || i == k){
						//Nの数字を３つ足していって合計がXだった場合結果に１プラスする。
						}else if ( i + j + k == intX){
							intKekka ++;
							}
						}
					}
				}
			//1*2*3　３つの数字を並びかえて同じ結果を６つ表示できるので なので６で割って結果表示
			System.out.println(intKekka/6);
			}

		}
	}

Measured memory_bytes: 19676
n = int(input())
s = [input() for i in range(n)]
import collections
c = collections.Counter(s).most_common()
fin = [c[0][0]]
for j in range(1,len(c)):
    if c[j][1]==c[j-1][1]:
        fin.append(c[j][0])
        continue
    break
for kekka in sorted(fin):
    print(kekka)

Measured memory_bytes: 45068
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<utility>
using namespace std;

int main(){
    // cout << (int)'A' << endl; //65
    // cout << (int)'Z' << endl; //90
    // cout << (int)'a' << endl; //97
    // cout << (int)'z' << endl; //122
    // cout << (int)'.' << endl; //46

    string S;
    getline(cin, S);

    for(int i=0;i<S.size();i++){
        int tmp = (int)S[i];
        if(tmp>=65 && tmp<=90) S[i] = (char)(tmp+32);
        else if(tmp >= 97 && tmp <= 122) S[i] =  (char)(tmp-32);
    }
    cout << S <<endl;
}


Measured memory_bytes: 3212
#include<iostream>
using namespace std;
int main()
{
    int H,M;
    char room[1000][100];
    cin>>H>>M;
    for(int i=1;i<=H;i++)
    for(int j=1;j<=M;j++)
        cin>>room[i][j];
    for(int i=1;i<=2*H;i++)
    {
        for(int j=1;j<=M;j++)
        cout<<room[(i+1)/2][j];
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
n = int(input())
import math
res = 0
arr = [0]*(n+1)
for i in range(1,int(math.sqrt(n)+2)):
    for j in range(1,int(math.sqrt(n)+2)):
        for k in range(1,int(math.sqrt(n)+2)):
            tmp = int(pow(i,2)+pow(j,2)+pow(k,2)+i*j+j*k+k*i)
            if tmp <= n:
                arr[tmp] += 1
for i in range(1,n+1):
    print(arr[i])

Measured memory_bytes: 9236
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1LL << 60;
constexpr int INF = 1000000007;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;
}

int N;
double dp[310][310][310];

double rec(int i, int j, int k){
  if(dp[i][j][k] >= 0){
    return dp[i][j][k];
  }
  if(i==0 && j==0 && k==0){
    return 0.0;
  }
  double res=0;
  if(i>0) res += rec(i-1,j,k)*i;
  if(j>0) res += rec(i+1,j-1,k)*j;
  if(k>0) res += rec(i,j+1,k-1)*k;
  res += N;
  res *= 1.0/(i+j+k);
  return dp[i][j][k] = res;
}

int main(){
  cin >> N;
  int one,two,three;
  one = two = three = 0;
  for(int i=0; i<N; i++){
    int a;
    cin >> a;
    if(a == 1){
      one++;
    }else if(a == 2){
      two++;
    }else{
      three++;
    }
  }
  memset(dp, -1, sizeof(dp));
  cout << fixed << setprecision(10) << rec(one,two,three) << endl;
  return 0;
}


Measured memory_bytes: 233088
n=int(input())
s=input()
countwhite=[0]*(n+1)
for i in range(n):
    if s[i]==".":
        countwhite[i+1]=countwhite[i]+1
    else:
        countwhite[i+1]=countwhite[i]
ans=10**8
for i in range(n+1):
    change=i-countwhite[i]+(countwhite[-1]-countwhite[i])
    ans=min(ans,change)
print(ans)

Measured memory_bytes: 11144
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define deb(x) cout << #x << " = "<< x << "\n";
int n;
string s;

signed main() {
	//freopen("in.txt", "r",stdin);
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	cin >> n;
	cin >> s;
	
	int w = 0, r = 0;
	for(char ch : s) {
	    if(ch == 'R') r++;
	    else w++;
	}
	int ans = min(r, w);
	int r_r = 0, l_l = 0;
	for(int i = 0; i < n; i++) {
	    if(i < r && s[i] == 'W') l_l++;
	    if(i >= r && s[i] == 'R') r_r++;
	}
	int res = min(r_r, l_l);
	r_r = res, l_l = res;
	for(int i = 0; i < n; i++) {
	    if(i < r && s[i] == 'W' && r_r > 0) s[i] = 'R', r_r--;
	    if(i >= r && s[i] == 'R' && l_l > 0) s[i] = 'L', l_l--;
	}
	int x = 0, y = 0;
	for(int i = 0; i < n; i++) {
	    if(i < r && s[i] == 'W') x++;
	    if(i >= r && s[i] == 'R') y++;
	}
	ans = min(ans, res + min(x, y));
	cout << ans << "\n";
}


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

int main() {
   int q;
   cin >> q;
   for (int i=0; i<q; i++) {
       string X,Y;
       cin >> X >> Y;
       int x=X.size();
       int y=Y.size();
       int dp[x][y];
       for (int j=0; j<x; j++) {
           for (int k=0; k<y; k++) {
               dp[j][k]=0;
           }
       }
       for (int j=0; j<x; j++) {
           for (int k=0; k<y; k++) {
               if (j==0) {
                   if (X[0]==Y[k]) dp[0][k]=1;
                   else dp[0][k]=dp[0][k-1];
                   continue;
               }
               if (k==0) {
                   if (X[j]==Y[0]) dp[j][0]=1;
                   else dp[j][0]=dp[j-1][0];
                   continue;
               }
               if (X[j]==Y[k]) dp[j][k]=max(dp[j-1][k-1]+1,max(dp[j-1][k],dp[j][k-1]));
               else dp[j][k]=max(dp[j-1][k],dp[j][k-1]);
           }
       }
       cout << dp[x-1][y-1] << endl;
   }
}


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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;
template <typename Val>
Val gcd(Val a, Val b) {
//use ll or int for gcd
    if (b==0) return a;
    else return gcd(b, a%b);
}
template <typename Val>
Val vec_max(vector<Val> v){
  return *max_element(v.begin(),v.end());
}
template <typename Val>
Val vec_min(vector<Val> v){
  return *min_element(v.begin(),v.end());
}
//---------------------------------------------------------------
int main(){
  double N;
  cin>>N;
  double pi =  3.14159265358979323846;
  N = 2*N*pi;
  prt_dbl(4,N)

}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define debug(args...) fprintf(stderr, args)
using namespace std;

typedef long long lint;

lint ans = 0;

void solve(string s, lint sum) {
    if (s.size() == 0) {
        ans += sum;
    } else {
        for (int i = 1; i < s.size(); i++) {
            solve(s.substr(i), sum + stoll(s.substr(0, i)));
        }
        solve("", sum + stoll(s));
    }
}

int main() {
    string s;
    cin >> s;
    solve(s, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long a;
    string s;
    cin >> a;
    cin >> s;
    if(a >= 3200) cout << s << endl;
    else cout << "red" << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<map>
#include<queue>
using namespace std;
#define MAX_N 20

priority_queue< pair<int, int>, vector< pair<int, int> >, greater< pair<int, int> > > open;
map<int, int> closed;

int search(int start, int goal);
void resetDx();

int n, maxCost, dx[MAX_N][MAX_N][2];
void set(int now, int next, int nowCost, int plusCost);

int main(){
    resetDx();
    int m, x1, x2, y1, y2;
    cin >>n >>m;
    for(int i = 0; i < m; i++){
        int a1, b1, c1, d1;
        scanf("%d,%d,%d,%d", &a1, &b1, &c1, &d1);
        dx[a1][b1][0] = c1;
        dx[a1][b1][1] = d1;
    }
    scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
    int cost = 0;
    maxCost = y1 - y2;
    open.push( make_pair(x1, 0) );
    cost += search(x1, x2);
    closed.clear();
    open.push( make_pair(x2, 0) );
    cost += search(x2, x1);
    cout <<maxCost - cost <<endl;
}

void resetDx(){
    for(int i = 0; i < MAX_N; i++){
        for(int j = 0; j < MAX_N; j++){
            dx[i][j][0] = -1;
            dx[i][j][1] = -1;
        }
    }
}

int search(int start, int goal){
    while(!open.empty()){
        int now = open.top().first;
        int cost = open.top().second;
        open.pop();
        for(int i = 1; i <= n; i++){
            if(dx[now][i][0] != -1) set(now, i, cost, dx[now][i][0]);
            if(dx[i][now][1] != -1) set(now, i, cost, dx[i][now][1]);
        }
    }
    return closed[goal];
}


void set(int now, int next, int nowCost, int plusCost){
    int sum = nowCost + plusCost;
    
    if((closed.find(next) == closed.end() || closed[next] > sum) && sum <= maxCost){
        open.push( make_pair(next, sum));
        closed[next] = sum;
    }
}

Measured memory_bytes: 0
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <istream>
#define INF 2147483647
#define LLINF 9223372036854775807
typedef long long ll;
using namespace std;
int a[100010];
int dp[100010];
int main(){
//  cout<<fixed<<setprecision(1)<<1<<endl;
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		dp[i]=1e9;
		cin>>a[i];
	}
	dp[0]=0;
	for(int i=0;i<n-1;i++){
		for(int j=1;j<=min((n-1)-i,k);j++){
			dp[i+j]=min(dp[i+j],dp[i]+abs(a[i+j]-a[i]));
		}
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

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

int main() {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    ll ans = 0;
    ll count = K;
    if (A >= K)
    {
        ans = K;
        cout << ans << endl;
        return 0;
    } else
    {
        ans += A;
        count -= A;
        if (B >= count)
        {
            cout << ans << endl;
            return 0;
        } else
        {
            count -= B;
            ans -= count;
            cout << ans << endl;
        }
        
        
        
    }
    

    
    
    return 0;
}

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

using namespace std;

int main()
{
   int i,flag;
   long long num,n;
  string s;

   cin>>s;

   cin>>n;

   num =n-1;

   int len = s.size();

    for(i=0;i<len;i++){

        if(s[i]!='1'){

            flag = i-1;
            break;
        }

        flag = len-1;

    }

       if(flag==(len-1)){
          cout<<"1"<<endl;
       }

       else{

          if(num<=flag){

               cout<<"1"<<endl;

          }

          else{

            int pos = s[flag+1] - '0';


          cout<<pos<<endl;
          }


       }


    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 100001
int A[N];
int n;

int partition(int *, int, int);

main() {
  int i, p, part;
  scanf("%d", &n);
  
  p = 1;
  for(i = p; i < n + 1; i++) {
    scanf("%d", &A[i]);
  }
  
  part = partition(A, p, n);
  
  for(i = p; i < n + 1; i++) {
    if(i == n && i == part) {
      printf("[%d]\n", A[i]);
    }
    else if(i == n && i != part) {
      printf("%d\n", A[i]);
    }
    else if(i == part && i != n) {
      printf("[%d] ", A[i]);
    }
    else {
      printf("%d ", A[i]);
    }
  }
  return 0;
}

int partition(int *A, int p, int r) {
  int i, j, x, tmp;
  x = A[r];
  i = p - 1;

  for(j = 1; j < r; j++) {
    if(A[j] <= x) {
      i = i + 1;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i + 1];
  A[i + 1] = A[r];
  A[r] = tmp;

  return i + 1;
}

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

int main()
{
   int n,m,x;
   int a[110];
   scanf("%d%d%d",&n,&m,&x);
   int i,j,cont1=0,cont2=0;
   for(i=1;i<=m;i++)
    scanf("%d",&a[i]);


   for(i=x+1;i<n;i++)
   {
       for(j=1;j<=m;j++)
       {
           if(a[j]==i)
           {
               cont1++;
               break;
           }
       }
   }
   for(i=x-1;i>0;i--)
   {
       for(j=1;j<=m;j++)
       {
           if(a[j]==i)
           {
               cont2++;
               break;
           }
       }
   }
   if(cont2>=cont1)
    printf("%d\n",cont1);
   else
    printf("%d\n",cont2);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <math.h>
#include <vector>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

typedef long long ll;

using namespace std;

int main(){
  int N;
  cin>>N;
  int a[N];
  for(int i=0;i<N;i++)cin>>a[i];
  int ans=999999999;
  for(int i=-100;i<=100;i++){
    int cost=0;
    for(int j=0;j<N;j++)cost+=(a[j]-i)*(a[j]-i);
    if(cost<ans)ans=cost;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
int inori,kuma,ayaneru,oonishisaori;
 
scanf("%d%d",&inori,&kuma);
 ayaneru=inori%kuma;
while(ayaneru != 0){
  inori = kuma;
  kuma = ayaneru;
  ayaneru = inori%kuma;
 }
printf("%d\n",kuma);

 return 0;
   }



Measured memory_bytes: 2756
import numpy as np

n, m, c = map(int, input().split())
b = np.array(list(map(int, input().split())))
count = 0

for i in range(n):
    a = np.array(list(map(int, input().split())))
    if np.dot(a, b) + c > 0:
        count += 1
print(count)


Measured memory_bytes: 14436
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,k;
double p[200010],sum[200010],ans;
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%lf",p+i);
        p[i]=(1+p[i])/2;
        sum[i]=sum[i-1]+p[i];
        if(i>=k)
        {
            ans=max(ans,sum[i]-sum[i-k]);
        }
    }
    printf("%.12f",ans);
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define PB push_back
#define LL long long
#define pii pair<LL,LL>
#define MEM(x,y) memset(x,y,sizeof(x))
#define bug(x) cout<<"debug "#x" is "<<x<<endl;
#define FIO ios::sync_with_stdio(false);
#define ALL(x) x.begin(),x.end()
#define LOG 20
#define lson(x) ((x)<<1)
#define rson(x) ((x)<<1|1)
const int maxn=2e5;
deque<char> d;
int main(){
	string s;
	cin>>s;
	for(char c:s) d.PB(c);
	int n,f=0;cin>>n;
	for(int i=0;i<n;i++){
        int x,y;
        char c;
        cin>>x;
        if(x==1)f^=1;
        if(x==2){
            cin>>y>>c;
            if((y-1)^f==1)d.push_back(c);
            else d.push_front(c);
        }
	}
	if(f) reverse(ALL(d));
	for(char c:d) cout<<c;
	cout<<endl;
	return 0;
}


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

#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
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; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}


bool sosuu(int x){
    if(x<=1) return false;
    for(int i = 2 ; i*i <=x; i++)
        if(x%i ==0) return false;
    return true;
}

int main(){
    int x;
    cin >> x;

    int p = x;
    while(!sosuu(p))p++;

    cout << p << endl;
    return 0;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()
/* --- */
ll n, m;

ll solve() {
	if (n > m) swap(n, m);
	if (n == 1 && m == 1) return 1;
	if (n == 1) return m - 2;
	return (n - 2) * (m - 2);
}

int main() {
	cin >> n >> m;
	cout << solve() << '\n';
}



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

using namespace std;

int main() {
	long long S;
	ignore = scanf("%lld", &S);
	
	int x2 = 1e9;
	int y3 = (S + x2 - 1) / x2;
	int x3 = 1;
	int y2 = x2 * 1ll * y3 - S;
	
	printf("0 0 %d %d %d %d\n", x2, y2, x3, y3);
	
	return 0;
}


Measured memory_bytes: 256
N= int(input())

b=[[0 for i in range(N)]for j in range(N)]


for i in range(N):
    a= list(map(int, input().split()))
    for j in range(a[1]):
        b[i][a[2+j]-1]=1
    
for i in range(N):
    print(*b[i])



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

int main(int argc, char *argv[]) {
  int X, A;
  scanf("%d %d", &X, &A);
  if (X < A) {
    printf("0\n");
  } else {
    printf("10\n");
  }
  
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll m,d;
  cin >> m >> d;
  ll ans=0;
  for(ll i=1;i<=d;i++) {
    ll d1=i/10;
    ll d2=i%10;
    if(d1<=1||d2<=1) continue;
    if(d1*d2<=m) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mod 1000000007
#define ss second
#define ff first
#define vpii vector<pii>
#define vvi vector<vi>
#define pb push_back
#define vs vector<string>
const int inf=0x3f3f3f3f3f3f3f3f;
double func(int i,int j,vector<double> &v,vector< vector < double > > &dp){
    if(i==0){
        double a=1;
        for(int k=0;k<=j;k++){
            a*=(1-v[k]);
        }
        return a;
    }
    if(j<0 && i!=0)return double(0);
    if(dp[i][j]!=double(-1))return dp[i][j];
    dp[i][j] = v[j]*func(i-1,j-1,v,dp)+(1-v[j])*func(i,j-1,v,dp);
    return dp[i][j];
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,i;
    cin>>n;
    vector<double>v(n);
    for(i=0;i<n;i++)cin>>v[i];
    vector< vector < double > > dp(n+1,vector<double>(n,double(-1)));
    double ans=double(0);
    for(i=n/2+1;i<=n;i++){
        ans+=func(i,n-1,v,dp);
    }
    cout<<fixed<<setprecision(15)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 70912
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

const int M=100005;

int n;
vi a(M);

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int A;
		cin>>A;
		a[A]++;
		a[A+1]++;
		a[A+2]++;
	}
	int res=0;
	for(int i=0;i<M;i++) res=max(res,a[i]);
	cout<<res<<endl;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
//#define ll __int128
//#define int ll
//#define char ll
//#define double ld
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << (x) << endl;

#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
//#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template<class T0, class T1>
inline ostream &operator<<(ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template<class T0, class T1>
inline istream &operator>>(istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template<class T0, class T1, class T2>
inline ostream &operator<<(ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template<class T0, class T1, class T2, class T3>
inline ostream &operator<<(ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " << get<3>(a) << "}";
}

template<class T>
inline ostream &operator<<(ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();


signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\nTOTAL EXECUTION TIME: " << float(clock() - start) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


void smain() {

    int n, k, s;
    cin >> n >> k >> s;

    int vl = s == 1000 * 1000 * 1000 ? 1 : s + 1;

    fori (i, n) {
        if (i < k) {
            cout << s << ' ';
        } else {
            cout << vl  << ' ';
        }
    }
}

Measured memory_bytes: 3612
import re
n,q=map(int,input().split())
s=input()
a=[0]*n
b=[0]*n
i=[p.span()[0]for p in re.finditer('(AC){1,1}',s)]
c=0
for m in range(n):
  if c>=len(i):
    if m<n-1:a[m+1]=a[m]
    b[m]=b[m-1]
    continue
  if m==i[c]:
    if m>0:
      if m<n-1:a[m+1]=a[m]+1
      b[m]=b[m-1]+1
    else:
      a[m]=0
      a[m+1]=1
      b[m]+=1
    c+=1
  else:
    a[m+1]=a[m]
    b[m]=b[m-1]
for _ in range(q):
  l,r=map(int,input().split())
  if l>=2:
    print(a[r-1]-b[l-2])
  else:
    print(a[r-1])


Measured memory_bytes: 12224
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)
const ll INF = (1LL << 50);
typedef pair<int, int>P;

bool cmp(const P& a, const P& b) {
	return a.first > b.first;
}

int main() {

	int n;
	cin >> n;

	vector<int>v(n);

	REP(i, n) cin >> v[i];

	map<int, int> mp1, mp2;
	mp1[0] = 0;
	mp2[0] = 0;
	for (int i = 0; i < n; i += 2) mp1[v[i]]++;

	for (int i = 1; i < n; i += 2) mp2[v[i]]++;

	vector<P> num1, num2;
	for (auto& p : mp1) num1.emplace_back(p.second, p.first);//頻度,数
	for (auto& p : mp2) num2.emplace_back(p.second, p.first);
	

	sort(num1.begin(), num1.end(), cmp);
	sort(num2.begin(), num2.end(), cmp);

	if (num1[0].second == num2[0].second) {
		int n1 = n - num1[0].first - num2[1].first;
		int n2 = n - num2[0].first - num1[1].first;
		cout << min(n1, n2) << endl;
	}
	else {
		cout << n - num1[0].first - num2[0].first << endl;
	}



	return 0;

}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> G(N);
  for (int i = 0, a, b; cin >> a >> b; i++) {
    G.at(--a).push_back(--b), G.at(b).push_back(a);
  }
  vector<int> P(N);
  for (int i = 0; i < N; i++) P.at(i) = i;
  int ans = 0;
  do {
    if (P.at(0) != 0) break;
    int i = 0;
    while (i < N - 1) {
      bool next = 0;
      for (auto g : G.at(P.at(i))) if (g == P.at(i + 1)) next = 1;
      if (next) i++;
      else break;
    }
    if (i == N - 1) ans++;
  } while (next_permutation(P.begin(), P.end()));
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <functional>
using namespace std;

using ll = long long;

int main() {
    int N;
    cin >> N;

    const int MAXN = 200000;
    static ll a[MAXN * 3];

    for (int i = 0; i < 3 * N; i++) {
        cin >> a[i];
    }

    static ll sum1[MAXN * 3],   // 前半部分 [0, i)
              sum2[MAXN * 3];   // 後半部分 [i, 3N)
    priority_queue<ll, vector<ll>, greater<ll>> que1;
    priority_queue<ll> que2;
    for (int i = 0; i < 3 * N - 1; i++) {
        sum1[i + 1] = sum1[i];

        if (que1.size() < N) {
            que1.push(a[i]);
            sum1[i + 1] += a[i];
            continue;
        }

        if (que1.top() < a[i]) {
            sum1[i + 1] += a[i] - que1.top();
            que1.pop();
            que1.push(a[i]);
        }
    }

    for (int i = 3 * N - 1; i >= 0; i--) {
        sum2[i] = sum2[i + 1];

        if (que2.size() < N) {
            que2.push(a[i]);
            sum2[i] += a[i];
            continue;
        }

        if (que2.top() > a[i]) {
            sum2[i] += a[i] - que2.top();
            que2.pop();
            que2.push(a[i]);
        }
    }

    ll ans = -(1LL << 50);
    for (int i = N; i <= 2 * N; i++) {
        ans = max(ans, sum1[i] - sum2[i]);
    }
    cout << ans << endl;

    /*
    for (int i = 0; i < 3 * N; i++) {
        cerr << "[" << i << "] sum1:" << sum1[i] << " sum2:" << sum2[i] << endl;
    }
    */
    
    return 0;
}

Measured memory_bytes: 14196
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define INF (1<<28)
#define DEKAI 1000000007
#define FDST int hogehogehoge;cin>>hogehogehoge;
#define int long long
int done[100010]; 
signed main(){
	int n;
	cin>>n;
	vector<vector<int> > t,o;
	int a,b;
	lp(i,n){
		cin>>a>>b;
		t.push_back({b+a,a,i});
		o.push_back({a+b,b,i});
	}
	sort(t.begin(),t.end());
	reverse(t.begin(),t.end());
	sort(o.begin(),o.end());
	reverse(o.begin(),o.end());
	int tit=0,oit=0,anst=0,anso=0;
	for(int i=0;i*2<n;i++){
		while(1){
			if(done[t[tit][2]]==1){
				tit++;
			}
			else break;
		}
		anst+=t[tit][1];
		done[t[tit][2]]++;
		//cout<<t[tit][2]<<endl;
		tit++;
		if(i*2+1==n) break;
		while(1){
			if(done[o[oit][2]]==1){
				oit++;
			}
			else break;
		}
		anso+=o[oit][1];
		done[o[oit][2]]++;

		//cout<<o[oit][2]<<endl;
		oit++;
		//cout<<anst<<" "<<anso<<endl;
	}
	cout<<anst-anso<<endl;
	return 0;
}



Measured memory_bytes: 12384
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    bool ok = (a == b + c) || (a + b == c) || (a + c == b);
    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3636