akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <deque>
using namespace std;
using ll = long long;
 
void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
ll gcd(ll a, ll b){ return (b == 0) ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){ return a/gcd(a, b)*b; };
 
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Unique(a) a.erase(unique(Range(a)), a.end());
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n, m);
    ll ans = max(0, 2-abs(n-m));
    For(i, n) ans = ans*(i+1) % MOD;
    For(i, m) ans = ans*(i+1) % MOD;
    Cout(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
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; }
vector<vector<int>> children(100005,vector<int>());
vector<int> ans;

int main(void){
  int n,m; cin >> n >> m;
  rep(i,m){
    int a,b; cin >> a >> b;
    a--; b--;
    children[a].push_back(b);
    children[b].push_back(a);
  }
  rep(i,n){
    ans.push_back(-1);
  }
  queue<int> q;
  q.push(0);
  while(!(q.empty())){
    int k = q.front();
    q.pop();
    for(int c : children[k]){
      if(ans[c] == -1){
        ans[c] = k;
      }
      else continue;
      q.push(c);
    }
  }
  cout << "Yes" << endl;
  for(int i= 1; i< n; i++){
    cout << ans[i]+1 << endl;
  }
  return 0;
}


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

int main(){
	string in;
	int cup[3] = {1,0,0};
	while( getline(cin,in), in.length() ){
		char ex1, ex2;
		sscanf( in.c_str(), "%c,%c", &ex1, &ex2 );
		ex1 -= 'A';
		ex2 -= 'A';
		int tmp = cup[ex1];
		cup[ex1] = cup[ex2];
		cup[ex2] = tmp;
	}
	for( int i=0; i<3; i++ )
		if( cup[i] )
			cout << (char)(i+'A') << endl;
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); i++)

using namespace std;
using ll = int64_t;
int ary[100000];

ll cal(ll x, int n) {
  ll sum = 0, ans = 0;
  int right = 0;
  for (int i = 0; i < n; i++) {
    while (right < n && sum + ary[right] <= x) {
      sum += ary[right];
      right++;
    }
    ans += right - i;
    if (i == right)
      right++;
    else
      sum -= ary[i];
  }
  return ans;
}

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

  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++)
    cin >> ary[i];
  while (q--) {
    ll x;
    cin >> x;
    cout << cal(x, n) << endl;
  }
}



Measured memory_bytes: 3500
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
char s[55],t[55],c[55];
int main(){
	cin>>s;
	cin>>t;
	int len=strlen(t);
	int lens=strlen(s);
	for(int i=lens-1;i>=len-1;i--){
		for(int j=i-len+1;j<=i;j++){
			c[j]=t[j-(i-len+1)];
		}
		for(int j=0;j<i-len+1;j++){
			if(s[j]=='?')c[j]='a';
			else c[j]=s[j];
		}
		for(int j=i+1;j<lens;j++){
			if(s[j]=='?')c[j]='a';
			else c[j]=s[j];
		}
		int flag=0;
		for(int j=0;j<lens;j++){
			if(s[j]==c[j]||s[j]=='?');
			else{
				flag=1;
				break;
			}
		}
		if(!flag){
			for(int j=0;j<lens;j++)cout<<c[j];
			puts("");
			return 0;
		}
	}
	puts("UNRESTORABLE");
	return 0;
}

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

int main(){
int A,B,X;
cin>>A>>B>>X;
int P=0;
if(A>=2*B){
    P=(X/500)*B;
    if(X%500!=0){
    P+=B;
    }
}else {
    P=(X/1000)*A;

    if(X%1000!=0){
        if(X%1000<=500 && A>B){
            P+=B;
        }else{
            P+=A;
        }
    }
}

cout<<P<<endl;
}



Measured memory_bytes: 3100
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

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

	if (K % 2) {
		cout << B - A << endl;
	} else {
		cout << A - B << endl;
	}

    return 0;
}


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

int main() {
    int N,Y;
    cin >> N >> Y;
    for(int i=0; i <= Y / 10000 && i <= N; ++i) {
        for(int j=0; j <= (Y - 10000 * i) / 5000 && (i + j) <= N; ++j) {
            int k = N - i - j;
            int total = 10000 * i + 5000 * j + 1000 * k;
            if(total == Y) {
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        HashSet<Integer>[] map = new HashSet[N+1];
        for(int i=0;i<=N;i++) map[i] = new HashSet<>();
        for(int i=1;i<=M;i++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            map[a].add(b);
        }
        String ans = "IMPOSSIBLE";
        if(map[1].size()>0){
            for(Integer w:map[1]){
                if(map[w].contains(N)) {
                    ans = "POSSIBLE";
                    break;
                }
            }
        }
        System.out.println(ans);
    }
}
 

Measured memory_bytes: 157916
#include<bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
signed main(){
	int n,i=1,x=1;
	cin>>n;
	while(n>x){
		i++;
		x+=i;
	}
	cout<<i<<endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 998244353,MAX = 1e6+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX, true);
vector<int> MinDiv(MAX);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
    		MinDiv[i]=i;
        	for (j = i * i; j <= MAX; j += i)
            {
				is_prime[j] = false;
				MinDiv[j]=i;
    		}
    	}
	}
	for(int i=2;i<=MAX;i++) if(is_prime[i]) MinDiv[i]=i;
}
//////////////////Sieve////////////////////

int main()
{
	int n,k;
	cin>>n>>k;
	vi A(n);
	take(A,0,n);
	sort(all(A));
	int gcd = 0;
	for(int i=0;i<n;i++) gcd = __gcd(gcd,A[i]);

	bool can=false;
	for(int i=n-1;i>=0;i--)
	{
		if(A[i]>=k&&(A[i]-k)%gcd==0) can=true;
	}
	if(can) cout<<"POSSIBLE"<<endl;
	else cout<<"IMPOSSIBLE"<<endl;
}		

Measured memory_bytes: 4608
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n;
	cin >> n;
	vint a(n);
	rep(i, n) {
		cin >> a[i];
	}
	vint b(n), c(n);
	rep(i, n) {
		if (i == 0) {
			b[i] = a[i];
			continue;
		}
		b[i] = (int)GCD((llint)b[i - 1], (llint)a[i]);
	}
	rep(i, n) {
		if (i == 0) {
			c[n - 1] = a[n - 1];
			continue;
		}
		c[n - 1 - i] = (int)GCD((llint)c[n - i], (llint)a[n - 1 - i]);
	}
	int tmp, ans = 0;
	rep(i, n) {
		if (i == 0) {
			tmp = c[i + 1];
		}
		else if (i == n - 1) {
			tmp = b[i - 1];
		}
		else {
			tmp = (int)GCD((llint)b[i - 1], (llint)c[i + 1]);
		}
		ans = max(tmp, ans);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

const Int MO = 998244353;
int D[100050], DS[100050];

int main() {
  int N = in();

  for (int i = 0; i < N; ++i) {
    D[i] = in();
    ++DS[D[i]];
    if (i == 0 && D[i] != 0) {
      puts("0");
      return 0;
    } else if (i > 0 && D[i] == 0) {
      puts("0");
      return 0;
    }
  }

  Int res = 1;
  for (int i = 1; i < N; ++i) {
    (res *= DS[D[i] - 1]) %= MO;
  }

  printf("%lld\n", res);

  return 0;
}


Measured memory_bytes: 1024
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
template<typename T> ll min(ll a, const T&& b) { return a < b ? a : b; }
template<typename T> ll min(const T&& a, ll b) { return a < b ? a : b; }
template<typename T> ll max(ll a, const T&& b) { return a > b ? a : b; }
template<typename T> ll max(const T&& a, ll b) { return a > b ? a : b; }
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

// constexpr ll w = 8, h = 8;

// ll dp[h][w] = {0};
// ll board[h][w] = {0};

// void update() {
//   ll sum
// }

// void dfs() {

// }

// void prepare() {
//   board[3][3] = 2;
//   board[3][4] = 1;
//   board[4][4] = 2;
//   dfs();
// }

ll f(ll x, ll y) {
  return ((x)/2) * ((y+1)/2);
}

void solve() {
  // rep(y, 8) {rep(x, 8) {
  //   cout << f(x, y) << " ";
  // }cout << endl;}
  ll n; cin >> n;
  rep(i, n) {
    ll a, b, c, d; cin >> a >> b >> c >> d; --a, --b;
    ll ans = (c-a) * (d-b);
    ans -= f(d, c) - f(d, a) - f(b, c) + f(b, a);
    cout << ans << endl;
  }
}



Measured memory_bytes: 3196
#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;
#pragma endregion

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i=0; i<n; i++) {
        cin >> h.at(i);
    }
    vector<ll> dp(n, INF);
    dp.at(0) = 0;
    for (int i=1; i<n; i++) {
        for (int j=0; j<k && i-j-1 >= 0; j++) {
            chmin(dp.at(i), dp.at(i-j-1) + abs(h.at(i) - h.at(i-j-1)));
        }
    }
    cout << dp.back() << "\n";
}

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

    solve();

    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int r=a[n/2]-a[n/2-1];
    cout<<r<<endl;
}


Measured memory_bytes: 640
MAX = 1000000
MOD = 1000000007

fac = [None] * MAX
finv = [None] * MAX
inv = [None] * MAX


def comb_init():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD


def comb(n, k):
    if n < 0 or k < 0 or n < k:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


comb_init()
x, y = [int(x) for x in input().split()]


def solve(x, y):

    if (x + y) % 3 != 0:
        return 0

    n = (2 * y - x) // 3
    m = (2 * x - y) // 3
    if n < 0 or m < 0:
        return 0

    return comb(n + m, n)


print(solve(x, y))

Measured memory_bytes: 101980
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

int main() {
    int n, m;
    ll k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    vector<ll> as(n+1), bs(m+1);
    rep(i,n) {
      as[i+1] = as[i]+a[i];
    }
    rep(i,m) {
      bs[i+1] = bs[i]+b[i];
    }
    int ans = 0;
    rep(i,n+1) {
      ll now = as[i];
      if (now > k) break;
      int j = upper_bound(bs.begin(), bs.end(), k-now) - bs.begin();
      j--;
      ans = max(ans, i+j);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9528
#include <iostream>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(n);++i)
const int INF = 1e9;


int main() {
  int N; cin >> N;
  int dp[N];

  int h[N];
  rep(i, N) {
    dp[i] = INF;
    cin >> h[i];
  }
  dp[0] = 0;
  dp[N-1] = INF;
  rep(i, N-1) {
    dp[i+1] = min(dp[i+1], abs(h[i] - h[i+1]) + dp[i]);
    if (i+2 < N)
      dp[i+2] = min(dp[i+2], abs(h[i] - h[i+2]) + dp[i]);
  }
  cout << dp[N-1] << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const int mod=1000000007 ;

void solve(){
	
	int n ;
	cin>>n ;

	map<string,int> mp ;

	for(int i=0;i<n;i++){
		string s ;
		cin>>s ;
		mp[s]++ ;
	}	

	int mx=0 ;

	for(auto x:mp){
		mx=max(mx,x.second) ;
	}

	for(auto x:mp){
		if(x.second==mx){
			cout<<x.first<<"\n" ;
		}
	}

}



int main(){
	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 19232
#include<ctime>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#define file(x)freopen(x".in","r",stdin);freopen(x".out","w",stdout)
#define rt register int
#define l putchar('\n')
#define ll long long
#define r read()
using namespace std;
inline ll read(){
    ll x=0;char zf=1;char ch=getchar();
    while(ch!='-'&&!isdigit(ch))ch=getchar();
    if(ch=='-')zf=-1,ch=getchar();
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();return x*zf;
}
void write(ll y){if(y<0)putchar('-'),y=-y;if(y>9)write(y/10);putchar(y%10+48);}
void writeln(const ll y){write(y);putchar('\n');}
int k,m,n,x,y,z,cnt,ans;
char c[200010],nxt[200010];int f[200010];
int main(){
	scanf("%s",c+1);n=strlen(c+1);nxt[n]=',';
	for(rt i=n-1;i>=1;i--)if(c[i+1]=='A')nxt[i]=nxt[i+1];
	else nxt[i]=c[i+1];
	for(rt i=n-1;i>=1;i--){
		if(c[i]=='A')f[i]=f[i+1];
		else if(c[i]=='C')f[i]=0;
		else if(c[i]=='B'&&c[i+1]=='C')f[i]=f[i+2]+1;
	}
	ll ret=0;
	for(rt i=1;i<=n;i++)if(c[i]=='A')ret+=f[i];cout<<ret;
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,c,d;
cin >> a >> b >> c >> d;
for(int i=0;i<1000;++i) {
  c-=b;
  if(c<=0) break;
  a-=d;
  if(a<=0) break;
  
}
if(c<=0) cout << "Yes" << endl;
if(a<=0) cout << "No" << endl;
return 0;
}

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

int main() {
    int n, k;
    cin >> n >> k;
    int l[n];
    for (int i = 0; i < n; i++) cin >> l[i];
    stable_sort(l, l+n);
    int l2[n];
    for (int i = 0; i < n; i++) {
        l2[i] = l[n-i-1];
    }
    int sum = 0;
    for (int i = 0; i < k; i++) {
        sum += l2[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import copy

sys.setrecursionlimit(10**9)
mod = 10**7+9
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

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

    def same(self, x, y):
        return self.find(x) == self.find(y)


n,m,k = LI()

ab = [LI() for _ in range(m)]
cd = [LI() for _ in range(k)]
uf = UnionFind(n)

for a,b in ab:
    uf.union(a-1,b-1)
ans = [uf.size(i)-1 for i in range(n)]
for a,b in ab:
    if uf.same(a-1,b-1):
        ans[a-1]-=1
        ans[b-1]-=1
for c,d in cd:
    if uf.same(c-1,d-1):
        ans[c-1]-=1
        ans[d-1]-=1

print(*ans)

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

#define rep(i,n) for(int i = 0; i < n; i++)
const int INF = 1e9;

int main()
{
	int d, g;
	cin >> d >> g;
	vector <int> p(d);
	vector <int> c(d);
	vector <int> s(d);
	rep(i, d) {
		cin >> p[i] >> c[i];
		s[i] = 100 * (i + 1) * p[i] + c[i];
	}

	int ans = INF;
	int sum = 0;
	int re;
	int pm = 0;
	for (int bit = 0; bit < (1 << d); bit++) {
		vector <int>  repro;
		for (int i = 0; i < d; i++) {
			if (bit & (1 << i)) {
				sum += s[i];
				pm += p[i];
			}
			else {
				repro.push_back(i);
			}
		}
		re = g - sum;
		if (re <= 0) {
			ans = min(ans, pm);
		}
		else {
			int tsum = 0;
			bool flag = false;
			//sort(repro.begin(), repro.end(), greater<int>());
			reverse(repro.begin(), repro.end());
			for (int v : repro) {
				for (int k = 0; k < p[v]; k++) {
					if (tsum >= re) {
						goto OUT;
					}
					tsum += (v + 1) * 100;
					pm++;
				}
			}
			OUT:
			ans = min(ans, pm);
		}
		pm = 0;
		sum = 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline long long read();
const int N=1e7+5;
int a[N];
int main()
{
	int n;
	cin>>n;
	long long ans=0;
	for (int i=1;i<=n;i++)
	{
		for (int j=i;j<=n;j+=i)
		{
			a[j]++;
		}
	}
	for (int i=1;i<=n;i++)
	{
		ans+=(1ll)*i*a[i];
	}
	cout<<ans;
	return 0;
}
inline long long read()
{
	long long x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch))
	{
		if (ch=='-')   f=-1;
		ch=getchar();
	}
	while (isdigit(ch))
	{
		x=(x<<1)+(x<<3)+ch-'0';
		ch=getchar();
	}
	return x*f;
}

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

const int MAX_N = 3005;
ll dp[MAX_N][2*MAX_N]={0};

int main(void){
    int n,t;
    cin >> n >> t;
    vector<pair<int,int>> dishes(n);
    for(int i=0;i<n;i++){
        int a,b;
        cin >> a >> b;
        dishes[i] = make_pair(a,b);
    }
    sort(dishes.begin(),dishes.end());

    dp[0][0] = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<2*MAX_N;j++){
            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
            if(j-dishes[i].first>=0 && j-dishes[i].first<=t-1) dp[i+1][j] = max(dp[i+1][j], dp[i][j-dishes[i].first]+dishes[i].second);
        }
    }

    ll maxpoint = 0;
    for(int i=0;i<2*MAX_N;i++){
        if(maxpoint<dp[n][i]) maxpoint = dp[n][i];
    }
    cout << maxpoint << endl;
 }

Measured memory_bytes: 141184
n, m = map(int, input().split())
AC = [0 for _ in range(n+1)]
PENA = [0 for _ in range(n+1)]
ac = 0
pena = 0
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if(AC[p]):
        continue
    if(s == "AC"):
        AC[p] = 1
    else:
        PENA[p] += 1

for i in range(n+1):
    ac += AC[i]
    if(AC[i]):
        pena += PENA[i]
print(ac, pena)


Measured memory_bytes: 4760
from queue import Queue

n, m = map(int, input().split())

adj_list = [[] for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    adj_list[a-1].append(b-1)
    adj_list[b-1].append(a-1)

shortest_adj = [None] * n
room_queue = Queue()
room_queue.put(0)
while not room_queue.empty():
    room = room_queue.get()
    for next_room in adj_list[room]:
        if shortest_adj[next_room] is None:
            shortest_adj[next_room] = room
            room_queue.put(next_room)

can_reach = all([x is not None for x in shortest_adj])

if not can_reach:
    print('No')
    exit()

print('Yes')
for i in range(1, n):
    print(shortest_adj[i]+1)


Measured memory_bytes: 101320
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]

edge = [[] for _ in range(N)]
for ab in AB:
    a, b = ab
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

cnt = 0
for i in range(N):
    if edge[i] == False:
        cnt += 1
    else:
        for ed in edge[i]:
            if H[i] <= H[ed]:
                break
        else:
            cnt += 1
print(cnt)

Measured memory_bytes: 108640
#include<cstdio>
#include<cstdlib>

int N;
int D[99];
int cmp(const void *ka,const void *kb) {
	int a=*(int *)ka;
	int b=*(int *)kb;
	return a-b;
}
int dp[18][18][99];
void init(void) {
	for(int i=0;i<324;i++) for(int j=0;j<99;j++) dp[i/18][i%18][j]=0;
}
int main() {
	scanf("%d",&N);
	for(int i=0;i<N;i++) scanf("%d",&D[i]);
	qsort(D,N,sizeof(int),cmp);
	for(int sol=12;sol>=0;sol--) {
		init();
		if(sol<=D[0]) dp[D[0]][0][1]=1;
		for(int i=1;i<N;i++) {
			int next=D[i];
			for(int j=0;j<=12;j++) for(int k=0;k<=12;k++) if(dp[j][k][i]) {
				//set left
				int difmin=next-j;
				if(difmin>24-next-k) difmin=24-next-k;
				if(difmin>=sol) dp[next][k][i+1]=1;
				//set right
				difmin=next-k;
				if(difmin>24-next-j) difmin=24-next-j;
				if(difmin>=sol) dp[j][next][i+1]=1;
			}
		}
		for(int j=0;j<=12;j++) for(int k=0;k<=12;k++) {
			if(dp[j][k][N]) {
				printf("%d\n",sol);
				return 0;
			}
		}
	}
}


Measured memory_bytes: 256
def main():
  import sys
  b=sys.stdin.buffer
  h,w=map(int,b.readline().split())
  x=w+1
  s=[c>>3for c in b.read()]
  dp=[10000]*h*x
  a=p=s[0]
  dp[0]=b=q=5-a
  for i in range(w):
    t=s[i]
    b+=a^t
    dp[i]=b
    a=t
  for i in range(x,h*x,x):
    t=s[i]
    q+=p^t
    dp[i]=b=q
    a=p=t
    k=i-w
    for j in range(i+1,i+w):
      sj=s[j]
      b+=a^sj
      t=dp[k]+(s[k]^sj)
      k+=1
      if b>t:b=t
      dp[j]=b
      a=sj
  print(b+1>>1)
main()

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

int N;
int D[100001];
int lvl[100001] = {0};
const int DIV = 998244353;

int main(){
	scanf("%d",&N);
	for(int i = 0; i < N; i++){
		scanf("%d",&D[i]);
		lvl[D[i]]++;
	}
	if(D[0] != 0 || lvl[0] != 1){
		printf("0\n");
		return 0;
	}
	if(N >= 2 && lvl[1] == 0){
		printf("0\n");
		return 0;
	}

	int endpos = -1;
	long long int ans = 1;
	for(int i = 2; i <= N-1; i++){
		if(lvl[i] == 0){
			endpos = i;
		}
		else{
			if(endpos != -1){
				printf("0\n");
				return 0;
			}
			else{
				for(int j = 0; j < lvl[i]; j++){
					ans = (ans * lvl[i-1]) % DIV;	
				}
			}
		}
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 1024
nabc = input().split()
n = int(nabc[0])
a = int(nabc[1])
b = int(nabc[2])
c = int(nabc[3])
llist = [int(input()) for i in range(n)]


def make_select(idx):
    select = {'a': [], 'b': [], 'c': []}

    for i in range(n):
        bits = (idx>>(i*2)) & 3
        if bits == 1:
            select['a'].append(i)
        if bits == 2:
            select['b'].append(i)
        if bits == 3:
            select['c'].append(i)

    if not select['a'] or not select['b'] or not select['c']:
        return None
    return select


minmp = 10**32


for i in range(4**n):
    select = make_select(i)
    if not select:
        continue

    asum = bsum = csum = 0

    for idx in select['a']:
        asum += llist[idx]
    for idx in select['b']:
        bsum += llist[idx]
    for idx in select['c']:
        csum += llist[idx]

    mp = abs(asum - a) + abs(bsum - b) + abs(csum - c)
    mp += (len(select['a']) - 1) * 10
    mp += (len(select['b']) - 1) * 10
    mp += (len(select['c']) - 1) * 10

    minmp = min(minmp, mp)

print(minmp)


Measured memory_bytes: 51420
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include<string>
#include <stack>
#include<queue>
#include<map>
#include <stdlib.h>
#include <bits/stdc++.h>
#include <set>

using namespace std;

int main() {
	string s,t;
	cin>>s>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end(),greater<char>());
	if(s<t){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 4e3 + 7;
int n;
char s[maxx];
int num[maxx];
vector <int> vec[maxx];
LL cnt[maxx];
bool vis[maxx];

LL chk(int a, int b, int c) {
	LL res = 0;
	for(int i = 0; i < vec[a].size(); i++) { //枚举首字母位置
		for(int j = 1; vec[a][i] + 2 * j <= n; j++) { //枚举间距
			if(num[vec[a][i] + j] == b && num[vec[a][i] + 2 * j] == c) res++;
		}
	}
	return res;
}

int main() {
	scanf("%d", &n);
	scanf("%s", s + 1);
	for(int i = 1; i <= n; i++) {
		if(s[i] == 'B') num[i] = 1;
		else if(s[i] == 'G') num[i] = 2;
		else if(s[i] == 'R') num[i] = 3;
	}
	for(int i = 1; i <= n; i++) {
		vec[num[i]].push_back(i);
		cnt[num[i]]++;
	}
	LL ans = cnt[1] * cnt[2] * cnt[3];
	ans -= chk(1, 2, 3) + chk(1, 3, 2) + chk(2, 1, 3) + chk(2, 3, 1) + chk(3, 1, 2) + chk(3, 2, 1);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3912
// 

#include <bits/stdc++.h>
#include <vector>
using namespace std;

int main(){
    // 入力
    int N, M; cin >> N >> M; // N:スイッチ総数, M:電球総数
    /* cout << "N, M 取得" << endl; */
    vector<vector<int>> S(M);
    vector<int> P(M);

    int test = 0;

    for (int m=0; m<M; ++m){
        /* cout << "\n" << "ループ" << test << "回目" << endl;  */
        int K; cin >> K;
        for(int k=0; k<K; k++){
            int s; cin >> s;
            S[m].push_back(s);
        }
        /*test += 1; */
    }

    for(int m=0; m<M; m++) cin >> P[m];
    
    // bit探索
    int ans =0;
    for (int ptn = 0; ptn<(1<<N); ptn++){
        vector<int> S_cnt(M); // 点灯スイッチ数格納用
        for (int j=0; j<N; j++){
            if (ptn>>j&1){
                for (int m=0; m<M; m++){
                    for (int k=0; k<S[m].size(); k++){
                        if(S[m][k] == j+1) S_cnt[m] += 1;
                    }
                }
            }
        }
        for (int m=0; m<M; m++){
            int tmp = S_cnt[m] % 2;
            if (tmp!=P[m]) break;
            if (m==M-1) ans += 1;   
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3564
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

string s;

int main() {
	cin >> s;
	int n = s.size();
	for (int i = 0; i < n; i++) {
		cout << 'x';
	}
	cout << endl;

	return 0;
}

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

#define int long long

long long combination(int n) {
    return (long long)(n * (n - 1)) / 2;
}

signed main(void){
    int n;
    cin >> n;
    
    vector<string> s(n);
    for (int i=0;i<n;++i) {
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s.begin(), s.end());
    // for (int i=0;i<n;++i) cout << s[i] << endl;
    
    int count = 1;
    int ans = 0;
    for (int i=0;i<n-1;i++) {
        if(s[i+1] == s[i]) count++;
        else {
            // nC2
            ans += combination(count);
            count = 1;
        }
    }
    if(count != 1) ans += combination(count);
    cout << ans;
    
    return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
const int Maxn=105;
int n,m,a[Maxn][Maxn],b[Maxn][Maxn],c[Maxn][Maxn];
queue<int>son[Maxn][Maxn];
namespace dinic{
	const int Maxn=2*::Maxn,Maxm=::Maxn*::Maxn+2*::Maxn;
	struct node{int to,next,v,pair;}e[2*Maxm];
	int cnt,S,T,h[Maxn],bl[Maxn],dis[Maxn],cur[Maxn];
	void AddEdge(int x,int y,int v,int pair){
		e[cnt]=(node){y,h[x],v,pair};h[x]=cnt;
	}
	void AddEdge(int x,int y,int v){
		AddEdge(x,y,v,++cnt+1);
		AddEdge(y,x,0,++cnt-1);
	}
	void reset(){
		memset(h,cnt=0,sizeof(h));
	}
	bool bfs(){
		memset(dis,0x3f,sizeof(dis));
		dis[S]=0;
		queue<int>Q;Q.push(S);
		while(Q.size()){
			int x=Q.front();Q.pop();
			for(int p=h[x];p;p=e[p].next){
				int y=e[p].to;
				if(dis[y]>dis[x]+1&&e[p].v){
					dis[y]=dis[x]+1;
					Q.push(y);
				}
			}
		}
		return dis[T]!=0x3f3f3f3f;
	}
	int dfs(int x,int Maxflow){
		if(x==T||!Maxflow)return Maxflow;
		int flow=0;
		for(int&p=cur[x];p&&Maxflow;p=e[p].next){
			int y=e[p].to;
			if(dis[y]!=dis[x]+1)continue;
			int ret=dfs(y,min(Maxflow,e[p].v));
			Maxflow-=ret;flow+=ret;
			e[p].v-=ret;e[e[p].pair].v+=ret;
		}
		return flow;
	}
	int Maxflow(int s,int t){
		int ans=0;
		S=s,T=t;
		while(bfs()){
			memcpy(cur,h,sizeof(h));
			ans+=dfs(S,INT_MAX);
		}
		return ans;
	}
	void solve(){
		for(int p=h[S];p;p=e[p].next){
			int x=e[p].to;
			for(int q=h[x];q;q=e[q].next){
				int y=e[q].to;
				if(y!=S&&!e[q].v)bl[x]=y;
			}
		}
	}
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			scanf("%d",&a[i][j]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			son[i][(a[i][j]-1)/m+1].push(a[i][j]);
	for(int i=1;i<=m;i++){
		int S=0,T=2*n+1;
		dinic::reset();
		for(int j=1;j<=n;j++)dinic::AddEdge(S,j,1),dinic::AddEdge(j+n,T,1);
		for(int j=1;j<=n;j++)
			for(int k=1;k<=n;k++)
				if(son[j][k].size())
					dinic::AddEdge(j,k+n,1);
		assert(dinic::Maxflow(S,T)==n);
		dinic::solve();
		for(int j=1;j<=n;j++){
			b[j][i]=son[j][dinic::bl[j]-n].front();
			son[j][dinic::bl[j]-n].pop();
		}
	}
	memcpy(c,b,sizeof(c));
	for(int i=1;i<=m;i++)
		for(int j=1;j<=n;j++)
			for(int k=1;k<n;k++)
				if(c[k][i]>c[k+1][i])
					swap(c[k][i],c[k+1][i]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cout<<b[i][j]<<" \n"[j==m];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cout<<c[i][j]<<" \n"[j==m];
	return 0;
}

Measured memory_bytes: 8192
import java.util.*;

class Main{
    public static void main(String[] args){
        // 入力受付
        Scanner sc = new Scanner(System.in);    //scanner
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();

        // バトル
        while(true){
            // 高橋くんの攻撃
            C-=B;
            if(C<=0){
                System.out.println("Yes");
                break;
            }
            // 青木くんの攻撃
            A-=D;
            if(A<=0){
                System.out.println("No");
                break;
            }
        }
    }
}


Measured memory_bytes: 35368
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string.h>
#define ll long long
using namespace std;
int main()
{
	int N,K,S;
	cin>>N>>K>>S;
	if(S<1e9||K==N)
	{
		for(int i=1;i<=K;i++)
		{
			if(i>1)
				cout<<' ';
			cout<<S;
		}
		for(int i=K+1;i<=N;i++)
			cout<<' '<<S+1;
	}
	if(S==1e9&&K<N)
	{
		if(K>0){
		for(int i=1;i<=K-1;i++)
			cout<<S<<' ';
		for(int i=K;i<=N-1;i++)
			cout<<"1 ";
		cout<<S-(N-K);
		}
		if(K==0)
		for(int i=1;i<=N;i++)
			cout<<"1 ";
	}
}

Measured memory_bytes: 1280
object Main extends App {
  val Array(n,m) = readLine.split(" ").map{_.toInt}
  val ac:Array[Int] = Array.fill(n+1)(0)
  val wa:Array[Int] = Array.fill(n+1)(0)
  
  (1 to m).foreach { _ =>
    val input = """(\d+) ([A-Z]+)""".r
    readLine match {
      case input(p,s) => {
        if (ac(p.toInt)==0) {
          s match {
            case "AC" => ac(p.toInt) += 1
            case "WA" => wa(p.toInt) += 1
          }
        }
      }
    }
  }
  
  val acsum = ac.sum
  val wasum = ac.zipWithIndex.filter{case (v,_) => v != 0}.map{case (_,i) => wa(i)}.sum
  println(s"$acsum $wasum")
}

Measured memory_bytes: 74268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
        ll tmp = 0;
        for(ll j = i; j; j /= 10)tmp += (j % 10);
        if(a <= tmp && tmp <= b)ans+=i;
    }
    cout << ans << endl;
    
    return 0;
}


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


int main(){
    int n;cin>>n;
    vector<vector<int>> data(10,vector<int>(10));
    ll sum =0;
    for(int i =1;i<=n;++i){
        string x = to_string(i);
        int len = x.size();
        ll first = (i/(int)pow(10,len-1))%10;
        ll second =i%10;
        data[first][second]++;

    }
    for(int i=1;i<10;++i ){
        for(int j = 1;j<10;++j){
            sum+=data[i][j]* data[j][i];
        }

    }
    cout <<sum<<endl;

}


Measured memory_bytes: 4212
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ProjectContest
{
    class Test
    {
        static void Main()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            var p = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            Array.Sort(p);
            Console.WriteLine(p[n / 2] - p[n / 2 - 1]);
        }
    }
}

Measured memory_bytes: 17760
#include <bits/stdc++.h>
#define vi               vector<int>
#define pb(x)            push_back(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define debug(x)         cout << '>' << #x << ':' << x << endl;
#define int               long long
// #define ld               long double
#define endl "\n";
#define lb lower_bound
#define ub upper_bound
const int mod = 1000000007;
using namespace std;
// const int N = 1e5 + 5; 
// int n;
// int a[N];

int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

int n;
n = 5;
vi v;

for (int i = 0; i < n; ++i)
{
	int a ; cin >>a;
	v.pb(a);
	if(a == 0){
		cout << v.size()  << endl;
		break;
	}
}


return 0;
}

Measured memory_bytes: 3676
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if ((n | m) == 0)
				break;
			boolean infect[] = new boolean[n + 1];
			infect[1] = true;
			Queue<Data> q = new PriorityQueue<Data>();
			for (int i = 0; i < m; i++) {
				int t = sc.nextInt();
				int s = sc.nextInt();
				int d = sc.nextInt();
				q.add(new Data(t, s, d));
			}
			while (!q.isEmpty()) {
				Data data = q.poll();
				//System.out.println("t:" + data.t);
				int s = data.s;
				int d = data.d;
				if (infect[s]) {
					infect[d] = true;
				}
			}
			int ans = 0;
			for (int i = 1; i <= n; i++) {
				if (infect[i])
					ans++;
			}
			System.out.println(ans);
		}
	}
}

class Data implements Comparable<Data> {
	public int s;
	public int d;
	public int t;

	Data(int t, int s, int d) {
		this.t = t;
		this.s = s;
		this.d = d;
	}

	public int compareTo(Data a) {
		return t-a.t;
	}
}

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

ll N, K;
vector<ll> p;

int main() {
    cin >> N >> K;
    p.resize(N);

    rep(i, N) cin >> p[i];

    ll max_num = *max_element(p.begin(), p.end());
    map<ll, ll> mp;
    rep(i, max_num) {
        mp[i + 1] += mp[i] + i + 1;
    }
    map<ll, double> mp_p;
    rep(i, max_num) {
        mp_p[i + 1] = mp[i + 1] / (double)(i + 1);
    }

    double sum_max = 0;
    rep(i, K) {
        sum_max += mp_p[p[i]];
    }
    ll right = K - 1;
    double current_prob = sum_max;
    for (ll i = 1; i <= N - K; i++) {
        current_prob += mp_p[p[i + K - 1]];
        current_prob -= mp_p[p[i - 1]];
        // for (ll j = i; j < i + K; j++) {
        //     // cout << " " << mp[p[j]] << " " << p[j] << endl;
        // }

        sum_max = max(current_prob, sum_max);
    }

    printf("%.10f\n", sum_max);
}

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

int main() {
	int i,n,ans;
	for(i=1;i<=9;i++){
		for(n=1;n<=9;n++){
			ans =i * n;
			cout << i << "x" << n << "=" << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;

int main(void)
{
    cout << fixed << setprecision(20);
    double K;
    cin >> K;
    cout << 2 * K * M_PI << "\n";
}

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

using namespace std;

int main() {
    int mx=0,cnt=0;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        int c=i;
        while(c%2==0){
            c/=2;
            cnt++;
        }
        mx=max(cnt,mx);
        cnt=0;
    }
    int H=mx;
    mx=1;
    for(int i=1;i<=H;i++){
        mx*=2;
    }
    cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 256
arr_input = input().strip()
arr = [c == "R" for c in arr_input]

arr_r = [0] * len(arr)
cont = 1
for i in range(1, len(arr)):
    if arr[i-1] and not arr[i]:
        arr_r[i-1] = cont
        cont = 1
    elif arr[i-1] and arr[i]:
        cont += 1
# print(arr_r)

arr_l = [0] * len(arr)
cont = 1
for i in reversed(range(1, len(arr))):
    if not arr[i] and not arr[i-1]:
        cont += 1
    if not arr[i] and arr[i-1]:
        arr_l[i] = cont
        cont = 1

# print(arr_l)

ans = [0] * len(arr)

for i in range(0, len(arr)):
    if arr_r[i]:
        side_sum = arr_r[i] + arr_l[i+1]
        med = side_sum // 2
        if side_sum % 2 == 0:
            ans[i] = med
            ans[i+1] = med
        elif arr_r[i] % 2 == 0:
            ans[i] = med
            ans[i+1] = med + 1
        else:
            ans[i] = med + 1
            ans[i+1] = med

print(" ".join(map(str, ans)))
exit(0)


Measured memory_bytes: 12924
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
//#pragma comment(linker, "/STACK:1024000000,1024000000")

using namespace std;

#define ll long long
#define SZ(x) ((int)(x).size()) 
#define ALL(v) (v).begin(), (v).end()
#define foreach(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define reveach(i, v) for (__typeof((v).rbegin()) i = (v).rbegin(); i != (v).rend(); ++ i) 
#define REP(i,a,n) for ( int i=a; i<int(n); i++ )
#define FOR(i,a,n) for ( int i=n-1; i>= int(a);i-- )
#define lson rt<<1, L, m
#define rson rt<<1|1, m, R
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
#define fi first
#define se second
#define CLR(a, b) memset(a, b, sizeof(a))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define lowbit(x) (x) & (-(x))
const int N = 1e5 + 7;
int n;
char s[N];
int main(){
#ifdef LOCAL_TEST
	freopen("in.txt","r",stdin);
#endif
	//freopen("out.txt","w",stdout);
    scanf("%s", s);
    n = strlen(s);
    int res = 0;
    REP(i, 1, n){
        if(s[i] != s[i - 1]){
            res ++;
        }
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
    int card[4][13],n,num;
    char l;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>l>>num;
        if(l=='S') card[0][num-1]='x';
        if(l=='H') card[1][num-1]='x';
        if(l=='C') card[2][num-1]='x';
        if(l=='D') card[3][num-1]='x';
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            if(card[i][j]!='x' && i==0){
                l='S';
                cout<<l<<" "<<j+1<<endl;
            }
            else if(card[i][j]!='x' && i==1){
                l='H';
                cout<<l<<" "<<j+1<<endl;
            }
            else if(card[i][j]!='x' && i==2){
                l='C';
                cout<<l<<" "<<j+1<<endl;
            }
            else if(card[i][j]!='x' && i==3){
                l='D';
                cout<<l<<" "<<j+1<<endl;
            }
        }
        
    }
    return 0;
}


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

int N;

const int limitrofe = 1e5+5;



int diario[3][limitrofe];




int tasks[limitrofe][3];



int cosa(int a, int i){
	if(i == N){
     return 0;
     }
	if(diario[a][i] != -1) {
        return diario[a][i];
    }
	int& ans = diario[a][i];

        if(a==0){
		ans=max(ans, cosa(1, i+1)+tasks[i][0]);
		ans=max(ans, cosa(2, i+1)+tasks[i][0]);
	}
        if(a==1){
		ans=max(ans, cosa(0, i+1)+tasks[i][1]);
		ans=max(ans, cosa(2, i+1)+tasks[i][1]);
        }
	if(a==2){
		ans=max(ans, cosa(0, i+1)+tasks[i][2]);
		ans=max(ans, cosa(1, i+1)+tasks[i][2]);
	}

	return ans;
}
int main(){
	cin>>N;
	for(int i=0; i<N; i++) {
        cin>>tasks[i][0]>>tasks[i][1]>>tasks[i][2];
	}
	memset(diario, -1, sizeof diario);
	cout<<max(cosa(0,0),max(cosa(1,0),cosa(2,0)))<<"\n";
	return 0;
}

Measured memory_bytes: 7296