akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace _0084
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ', ',', '.');
            bool b = true;
            for (int i = 0; i < s.Count(); i++)
            {
                if (3 <= s[i].Length && s[i].Length <= 6)
                {
                    if (b)
                    {
                        Console.Write(s[i]);
                        b = false;
                    }
                    else
                    {
                        Console.Write(" " + s[i]);
                    }
                }
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 8900
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define repp(i,a,n) for(i=a;i<n;++i)
#define repr(i,a,n) for(i=a;i>n;--i)

ll binpowmod(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll modInverse(ll n, ll p)
{
    return binpowmod(n, p-2, p);
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,n,i,ans;
    ans=0;
    cin >> n ;
    ll a[n];
    rep(i,n) cin >> a[i];
    for(i=1;i<n-1;++i)
    {
        if(a[i]<a[i+1]&&a[i]>a[i-1]) ans++;
        else if(a[i]<a[i-1]&&a[i]>a[i+1]) ans++;
    }
    cout << ans ;
	return 0;
}

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

#define pii pair<int, int>

const int maxN = 2e5 + 10;

int n;
int pa[maxN + 1], mx[maxN + 1], sz[maxN + 1];
int a[maxN + 1], ans[maxN + 1], id[maxN + 1];

inline int find(int x) { return pa[x] == x ? x : pa[x] = find(pa[x]); }

inline void merge(int x, int y)
{
	x = find(x), y = find(y);
	if(x == y) return;
	pa[x] = y;
	sz[y] += sz[x]; mx[y] = max(mx[y], mx[x]);
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		a[x] = y; id[i] = x;
	}

	for(int i = 1; i <= n; i++) pa[i] = i, mx[i] = a[i], sz[i] = 1;

	priority_queue<pii> q;
	for(int i = n; i >= 1; i--)
	{
		while(!q.empty() && a[i] < q.top().first)
		{
			merge(i, q.top().second);
			q.pop();
		}
		int p = find(i);
		q.push( pii(mx[p], p) );
	}

	for(int i = 1; i <= n; i++) printf("%d\n", sz[ find(id[i]) ]);
	return 0;
}


Measured memory_bytes: 7736
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int n,k;cin >> n >> k;
    vi a(n);
    // vi table(n);
    vi set(n,0);
    rep(i, n){
        cin >> a[i];
        /*table[max(i-a[i],0LL)]++;
        table[min(i+a[i],n-1)]--;
        if(i>0) table[i]+=table[i-1];*/
    }
    chmin(k,1000LL);
    rep(j, k) {
        if(j>0)a = set;
        fill(set.begin(),set.end(),0);
            rep(i, n) {
            set[max(i-a[i],0LL)]++;
            if(i+a[i]<n-1) set[i+a[i]+1]--;
            
            // cout << set[i] << ' ';
        }
        rep1(i, n-1) set[i]+=set[i-1];
        // for(int i = )
        // for(auto p:set) cout << p << ' ';cout << endl;
    }
    for(auto  p:set) cout << p << ' ';
    return 0;
}

Measured memory_bytes: 6424
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000;
const int mod = 1000000007;
int par1[213456], par2[213456];//親
int depth1[213456], depth2[213456];//木の深さ
//n要素で初期化
void init1(int n) {
	for (int i = 0; i <= n; i++) { par1[i] = i; depth1[i] = 0; }
}
void init2(int n) {
	for (int i = 0; i <= n; i++) { par2[i] = i; depth2[i] = 0; }
}
//木の根を求める
int find1(int x) {
	if (par1[x] == x) { return x; }
	else { return par1[x] = find1(par1[x]); }
}
int find2(int x) {
	if (par2[x] == x) { return x; }
	else { return par2[x] = find2(par2[x]); }
}
//xとyの属する集合を併合
void unite1(int x, int y) {
	x = find1(x); y = find1(y);
	if (x == y) { return; }
	if (depth1[x] < depth1[y]) { par1[x] = y; }
	else { par1[y] = x; if (depth1[x] == depth1[y])depth1[x]++; }
}
void unite2(int x, int y) {
	x = find2(x); y = find2(y);
	if (x == y) { return; }
	if (depth2[x] < depth2[y]) { par2[x] = y; }
	else { par2[y] = x; if (depth2[x] == depth2[y])depth2[x]++; }
}
//xとyが同じ集合に属するか否か
bool same1(int x, int y) {
	return find1(x) == find1(y);
}
bool same2(int x, int y) {
	return find2(x) == find2(y);
}
signed main() {
	int n, k, l, a, b, c, d; cin >> n >> k >> l;
	vector<vector<int>>test(n + 1, vector<int>(2));
	map<int, map<int, int> > ok;
	init1(n + 1); init2(n + 1);
	for (int h = 0; h < k; h++) {
		cin >> a >> b; unite1(a, b);
	}
	for (int h = 1; h <= n; h++) {
		test[h][0] = find1(h);
	}
	for (int h = 0; h < l; h++) {
		cin >> c >> d; unite2(c, d);
	}
	for (int h = 1; h <= n; h++) {
		test[h][1] = find2(h);
	}
	for (int h = 1; h <= n; h++) {
		ok[test[h][0]][test[h][1]]++;
	}
	for (int h = 1; h <= n; h++) {
		if (h == 1) { cout << ok[test[h][0]][test[h][1]]; }
		else { cout << ' ' << ok[test[h][0]][test[h][1]]; }
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 45952
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), M = sc.nextInt();
		int L[] = new int[M], R[] = new int[M];
		int min = 99999999, max = 0;
		for (int i = 0; i < M; i++) {
			L[i] = sc.nextInt();
			R[i] = sc.nextInt();
			min = Math.min(min, R[i]);
			max = Math.max(max, L[i]);
		}
		if (min - max >= 0) {
			System.out.println(min - max + 1);
		} else {
			System.out.println(0);
		}
		sc.close();
	}
}


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

#define lli long long
#define FOR(i,a,b) for (lli i=(a);i<(b);i++)
#define REP(i,n) for (lli i=0;i<(n);i++)
#define rep(i,n) for (lli i=0;i<(n);i++)

#define INF INT_MAX/3
#define PB push_back
#define pb push_back
#define all(a) (a).begin(),(a),end()
#define pll pair<lli,lli>

int main(){
  double a,b;

  cin>>a>>b;

  printf("%d %d %30.30f",(int)a/(int)b,(int)a%(int)b,a/b);
  
  return 0;
}

Measured memory_bytes: 3268
[N, K] = list(map(int, input().split()))
X = [0]*N
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(d):
        X[A[j]-1] += 1
answer = 0
for i in range(N):
    if X[i] == 0:
        answer += 1
print(answer)

Measured memory_bytes: 9196
import java.util.Scanner;
public class Main {
	void find(){
		Scanner s = new Scanner(System.in);
		boolean cards[][] = new boolean[4][13];
		String markList[] = new String[4];
		markList[0] = "S";
		markList[1] = "H";
		markList[2] = "C";
		markList[3] = "D";
		for(int j = 0;j<4;j++){
			for(int i = 0;i<13;i++){
				cards[j][i] = false;
			}
		}
		int cnt = s.nextInt();
		for(int i = 0;i < cnt;i++){
			String mark = s.next();
			int num = s.nextInt();
			switch(mark){
			case "S":
				cards[0][num-1] = true;
				break;
			case "H":
				cards[1][num-1] = true;
				break;
			case "C":
				cards[2][num-1] = true;
				break;
			case "D":
				cards[3][num-1] = true;
				break;
			}
		}
		for(int j = 0;j<4;j++){
			for(int i = 0;i<13;i++){
				if(!cards[j][i]){
					System.out.println(markList[j] + " " + (i+1));
				}
			}
		}
	}
	public static void main(String args[]){
		Main m = new Main();
		m.find();
	}
}

Measured memory_bytes: 26124
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

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

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

ll nCm(ll n, ll m){
    if(m == 0 || m == n){
        return 1;
    } else if(m == 1){
        return n;
    }
    return (nCm(n - 1, m) + nCm(n - 1, m - 1));
}

//-----------------------ここから-----------

int main(void){
    string s;
    cin >> s;
    
    sort(s.begin(),s.end());

    bool backet[100100] = {false};

    for(int i = 0; i < s.size(); i++){
        backet[s[i]] = true;
    }

    for(char i = 'a'; i <= 'z'; i++){
        if(!backet[i]){
            cout << i << endl;
            return 0;
        }
    }

    cout << "None" << endl;
}

Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<cctype>
using namespace std;
int main(){
    char ch;
    while(1){
        scanf("%c",&ch);
        if(isalpha(ch)){
            if(islower(ch)) printf("%c",toupper(ch));
            else printf("%c",tolower(ch));
        }else printf("%c",ch);
        
        if(ch=='\n') break;
    }
    
    
}


Measured memory_bytes: 3136
n = int(input().rstrip())
a = list(map(int,input().rstrip().split()))
b = list(map(int,input().rstrip().split()))
ans = 0
for i in range(n):
    ans += min(a[i],b[i]) + min(a[i+1],max(0,b[i]-a[i]))
    a[i+1] -= min(a[i+1],max(0,b[i]-a[i]))
print(ans)

Measured memory_bytes: 24164
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const int MAX_N = 5010;

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

    vvl dp(MAX_N, vl(MAX_N));
    for(ll i = n-1; i >= 0; i--) {
        for(ll j = n-1; j >= 0; j--) {
            if(s[i] == s[j]) {
                dp[i][j] = dp[i+1][j+1] + 1;
            }
        }
    }

    ll ans = 0;
    rep(i, n) {
        rep(j, n) {
            if(i >= j) {
                continue;
            }
            ll now = min(dp[i][j], j-i);
            ans = max(ans, now);
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 198656
#include<iostream>
#include<vector>

using namespace std;

int main(){
	int N, X; cin >> N >> X;
	vector<int> L(N), D(N+1);
	for(int i = 0; i < N; ++i) cin >> L[i];
	
	D[0] = 0;
	for(int i = 1; i <= N; ++i){
		D[i] = D[i-1] + L[i-1];
		// cout << D[i] << endl;
	}

	int sum = 0;

	for(int i = 0; i < N+1; ++i){
		if(D[i] <= X) sum ++;
		else break;
	}

	cout << min(sum, N+1) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define Mp make_pair
#define pb push_back
#define rep(i, j, k) for (int i = (j); i <= (k); i++)
#define per(i, j, k) for (int i = (j); i >= (k); i--)
const int INF = 0x3f3f3f3f, nINF = 0xcfcfcfcf, INFMEM = 0x3f, nINFMEM = 0xcf;
const int PR1 = 1e6 + 3, PR2 = 1e9 + 7;
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int, int> PII;
typedef vector<int> VI;

const int N = 1e5+3;
int n,a[N],b[N],sum[N*4],ans;
#define lowbit(x) (x)&-(x)
void modify(int x){
	for(;x<=N*4;x+=lowbit(x)) sum[x]++;
}
int query(int x){
	int ret=0; for(;x;x-=lowbit(x)) ret+=sum[x]; return ret;
}

int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",&a[i]);
	int l=0,r=INF,mid;
	while(l<=r){
		mid=(l+r)>>1;
		ll cnt=0;
		{//calc cnt
			memset(sum,0,sizeof(sum));
			modify(n+1);
			rep(i,1,n) {
				b[i]=b[i-1]+(a[i]>=mid?1:-1);
				cnt+=query(b[i]+n+1); modify(b[i]+n+1);
			}
		}
		if(cnt>=(ll)n*(n+1)/2-cnt) ans=mid, l=mid+1; else r=mid-1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2560
//
//
//mirunzyaneeeeeee
//
//
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main() {
	char str0[11] = { NULL }, str1[11] = { NULL }, str2[100][22];
	int ryofactory,ruio, hideo, nagase;
	cin >> str0;
	ryofactory = strlen(str0);
	cin >> ruio;
	int j = 0;
	for (int i = ryofactory-1; i > -1;i--) {
		str1[j] = str0[i];
		j++;
	}
	for (int i = 0; i < ruio; i++) {
		cin >> str2[i];
		strncat(str2[i], str2[i],11);
	}
	j = 0;
	for (int i = 0; i < ruio; i++) {
		if (strstr(str2[i],str0) != 0) {
			j++;
		}
		/*else if (strcmp(str1, str1) != NULL) {
			j++;
		}*/
	}
	cout << j << endl;
}

Measured memory_bytes: 3076
def binarySearch(n, a):
    ok = -1  # when minimize
    ng = len(a)  # when maximize
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if a[mid] == n:
            return 1
        elif a[mid] < n:
            ok = mid
        else:
            ng = mid
    return 0


def resolve():
    import sys
    input = sys.stdin.readline
    n = int(input())
    a = [int(i) for i in input().split()]
    q = int(input())
    kk = [int(input()) for _ in range(q)]
    for k in kk:
        print(binarySearch(k, a))


resolve()



Measured memory_bytes: 18376
#include <bits/stdc++.h>
#define REP(i, n, s) for (int i = (s); i < (n); i++)
using namespace std;
typedef long long int LL;
typedef long double LD;

const int MOD = 1e9 + 7;
const int MAXN = 1e5 * 2;
LL NPN[MAXN];

LL _pow(LL a, LL k) {
	LL res = 1;
	while (k) {
		// k%1 == 1
		if (k & 1) res = res * a % MOD;
		a = a * a % MOD;
		// k /= 2;	
		k >>= 1;
	}
	return res;
}

LL nPn(int n) {
	if (NPN[n] > 0) return NPN[n];
	if (n == 0) return NPN[n] = 1;
	return NPN[n] = n * nPn(n-1) % MOD;
}

LL nCr(int n, int r) {
	// /= A  ->  *= A^M-2
	return nPn(n) * _pow(nPn(n-r) * nPn(r) % MOD, MOD - 2) % MOD;
}

LL func(int h1, int w1, int h2, int w2) {
	return nCr((h2 - h1) + (w2 - w1), (h2 - h1));
}

int main() {
	int H, W, A, B;
	scanf("%d %d %d %d", &H, &W, &A, &B);
	int h = H - A, w = B + 1;
	LL res = 0;
	while (h >= 1 && w <= W) {
		res = (res + func(1, 1, h, w) * func(h, w, H, W)) % MOD;
		h--, w++;
	}

	printf("%d\n", res);
	
	return 0;
}

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

const int N=200005;
const long long MOD=1e9+7;
int n;
int v[N],nxt[N],head[N];
long long dp[N][2];

void dfs(int x,int fa)
{
	dp[x][0]=dp[x][1]=1;
	for(int i=head[x];i>0;i=nxt[i])
	{
		if(v[i]==fa) continue;
		dfs(v[i],x);
		dp[x][0]=dp[x][0]*(dp[v[i]][0]+dp[v[i]][1])%MOD;
		dp[x][1]=dp[x][1]*dp[v[i]][0]%MOD;
	}
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&v[i],&v[i+n]);
		nxt[i]=head[v[i+n]],head[v[i+n]]=i;
		nxt[i+n]=head[v[i]],head[v[i]]=i+n;
	}
	dfs(1,0);
	printf("%lld\n",(dp[1][0]+dp[1][1])%MOD);
}

Measured memory_bytes: 9344
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
//const long mod=(long)1e9+7;
inline void solve(void){
  vector<int>a(3);ins(a);
  sort(all(a));
  if(a[0]==a[1]&&a[1]!=a[2])out("Yes");
  else if(a[0]!=a[1]&&a[1]==a[2])out("Yes");
  else out("No");
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r,f;








void sol()
{   
    cin>>n>>m>>k;
    in(a,n);in(b,m);
    i=j=c=x=0;
    while(i<n && x+a[i]<=k){    
        x+=a[i];
        i++;
    }
    c=i;        
       
    while(j<m && i>=0){           
        x+=b[j];             
        j++;
        while(x>k and i>0){
            i--;
            x-=a[i];
        }
        if(x<=k and i+j>c)
            c=i+j;
    }
    cout<<c<<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

Measured memory_bytes: 6260
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
    priority_queue<int> q;
    int n,m,x;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&x);
        q.push(x);
    }
    for(int j=0;j<m;j++)
    {
        x=q.top();
        q.pop();
        x/=2;
        q.push(x);
    }
    long long ans=0;
    for(int i=0;i<n;i++)
    {
        ans+=q.top();
        q.pop();
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 892
n,m = map(int,input().split())
a = [[0,0,0]]*m
for i in range(m):
    a[i] = input().split() + [i]

a.sort()
ac = 0
wa = 0
tmp = "dummy"
tmp2 = 9999

for x,y,z in a:
    if y == "AC" and x != tmp:
        ac += 1
        tmp = x
        tmp2 = z
    elif y == "AC" and x == tmp:
        continue
    elif y == "WA" and x != tmp:
        continue
    elif y == "WA" and x == tmp:
        if z < tmp2:
            wa += 1
        else:
            continue

print(ac,wa)


Measured memory_bytes: 28016
import heapq
N, C = map(int, input().split())

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

stc.sort()

lst = []
hq = [[-1, -1]]
heapq.heapify(hq)
ans = 1
for i in range(N):
    p = stc[i]
    q = heapq.heappop(hq)
    if p[0] < q[0]:
        heapq.heappush(hq, q)

        ans += 1

    elif p[0] == q[0]:
        lst = []
        jdg2 = True

        while p[0] == q[0] and p[2]>= q[1]:
            if p[2] == q[1]:

                jdg2 = False
            else:
                lst.append(q)
            if hq: q = heapq.heappop(hq)
            else: break
        if jdg2:
            ans += 1
        if p[0] != q[0] or p[2] < q[1]:
            heapq.heappush(hq, q)

        for k in lst:
            heapq.heappush(hq, k)

    heapq.heappush(hq, [p[1], p[2]])

print(ans)

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

using namespace std;

typedef long long ll;

const int MAX_N = 233;

int N, pa[MAX_N], dis[MAX_N], mx_deg[MAX_N];
vector<int> edges[MAX_N];
ll ans = 1;

void dfs1(int x, int y = 0, int z = 0) {
    pa[x] = y; dis[x] = z;
    for (int i : edges[x]) {
        if (i == y) continue;
        dfs1(i, x, z + 1);
    }
}

void dfs2(int x, int y, int z) {
    int child_cnt = 0;
    for (int i : edges[x]) {
        if (i == y) continue;
        child_cnt++;
        dfs2(i, x, z + 1);
    }
    mx_deg[z] = max(mx_deg[z], child_cnt);
}

int main() {
    scanf("%d", &N);
    for (int i = 1; i < N; i++) {
        int a, b; scanf("%d%d", &a, &b);
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    int x = 1;
    dfs1(x);
    for (int i = 1; i <= N; i++)
        if (dis[i] > dis[x])
            x = i;
    dfs1(x);
    for (int i = 1; i <= N; i++)
        if (dis[i] > dis[x])
            x = i;
    mx_deg[0] = dis[x] & 1 ? 2 : 1;
    int a = x;
    for (int i = 1; i <= dis[x] / 2; i++)
        a = pa[a];
    if (dis[x] & 1) {
        dfs2(pa[a], a, 1);
        dfs2(a, pa[a], 1);
        for (int i = 0; i <= N; i++) {
            if (mx_deg[i])
                ans *= mx_deg[i];
        }
    } else {
        dfs2(a, 0, 1);
        for (int i = 0; i <= N; i++) {
            if (mx_deg[i])
                ans *= mx_deg[i];
        }
        for (int i : edges[a]) {
            mx_deg[0] = 2;
            for (int j = 1; j <= N; j++) mx_deg[j] = 0;
            dfs2(a, i, 1);
            dfs2(i, a, 1);
            ll res = 1;
            for (int j = 0; j <= N; j++) {
                if (mx_deg[j])
                    res *= mx_deg[j];
            }
            ans = min(ans, res);
        }
    }
    printf("%d %lld\n", dis[x] / 2 + 1, ans);
}


Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

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

int main()
{
    double d,t,s;
    cin>>d>>t>>s;
    if(s==0){
        cout<<"No"<<endl;
        return 0;
    }
    double ans=d/s;
    if(ans<=t){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> f(n, vector<int>(10)), p(n, vector<int>(11));
  for(int i = 0; i < n; i++)
    for(int j = 0; j < 10; j++)
      cin >> f.at(i).at(j);
  for(int i = 0; i < n; i++)
    for(int j = 0; j < 11; j++)
      cin >> p.at(i).at(j);

  int mx = INT32_MIN;
  for(int o = 1; o < 1024; o++) {
    int s = 0;
    for(int i = 0; i < n; i++) {
      int c = 0;
      for(int j = 0; j < 10; j++)
        if((f.at(i).at(j) == (o >> j) % 2) && f.at(i).at(j))
          c++;
      s += p.at(i).at(c);
    }
    mx = max(s, mx);
  }
  cout << mx << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int a,b,k;
	int n = 0;
	int i;
	int y[100]={};
	scanf("%d%d%d",&a,&b,&k);
	for(i=1;i<=100;i++){
		if(a%i==0 && b%i==0){
			y[n] = i;
			n++;
		}
	}
	printf("%d",y[n-k]);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int n; cin >> n;
  vector<int> a(n);
  set<int> st;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    st.insert(a[i]);
  }

  map<int, int> zip;
  int val = 0;
  for (auto x : st) {
    zip[x] = val;
    val++;
  }

  for (int i = 0; i < n; i++) {
    a[i] = zip[a[i]];
  }

  int minus = 0;
  int plus = 0;
  vector<int> ans;
  vector<int> cnt(n + 2, 0);

  for (int k = 0; k < n; k++) {
    cnt[a[k]]++;
    if (cnt[a[k]] == 0) {
      minus--;
    } else if (cnt[a[k]] == 1) {
      plus++;
    }

    cnt[a[n - k - 1]]--;
    if (cnt[a[n - k - 1]] == 0) {
      plus--;
    } else if (cnt[a[n - k - 1]] == -1) {
      minus++;
    }

    if (plus == 0 and minus == 0) {
      ans.push_back(k + 1);
    }
  }

  for (size_t i = 0; i < ans.size(); i++) {
    if (i + 1 == ans.size()) cout << ans[i] << endl;
    else cout << ans[i] << " ";
  }
  
  return 0;
}



Measured memory_bytes: 8352
#include <bits/stdc++.h>
 
using namespace std;
 
void WA() {
    cout << "Impossible\n";
    exit(0);
}
void OK() {
    cout << "Possible\n";
    exit(0);
}
 
int main() {
    int n;
    scanf("%d", &n);
    vector<int> kol(n, 0);
    int mx = -1;
    for (int i = 0; i < n; ++i) {
        int a;
        scanf("%d", &a);
        mx = max(mx, a);
        kol[a]++;
    }
 
    if (n == 2)
        OK();
 
    if (mx == 1)
        WA();
    if (mx % 2 == 0 && kol[mx/2] != 1)
        WA();
    if (mx % 2 != 0 && kol[mx/2 + 1] != 2)
        WA();
    for (int i = mx/2 + 1; i <= mx; ++i)
        if (kol[i] < 2)
            WA();
    int ind = mx/2;
    if (mx%2 == 0) --ind;
    for (; ind > 0; --ind) if (kol[ind]) WA();
 
    OK();
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

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


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

// using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int H, W, N;
  cin >> H >> W;
  cin >> N;
  int nof_color[N+1];
  for(int i = 1; i < N+1; ++i) {
    cin >> nof_color[i];
  }
  int oneline[H*W];
  int index = 0;
  for(int i = 1; i < N+1; ++i) {
    for(int j = 0; j < nof_color[i]; ++j) {
      oneline[index] = i;
      ++index;
    }
  }
  int g[H][W];
  for(int h = 0; h < H; ++h) {
    for(int tmp_w = 0; tmp_w < W; ++tmp_w) {
      int w = tmp_w;
      if(h%2) w = W - 1 - tmp_w;
      g[h][w] = oneline[W*h + tmp_w];
      ++index;
    }
  }
  for(int h = 0; h < H; ++h) {
    for(int w = 0; w < W; ++w) {
      if(w==W-1) COUTB(g[h][w]);
      else COUTS(g[h][w]);
    }
  }
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,a) repi(i,0,a)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define repit(i,a) for(__typeof((a).begin()) i=(a).begin();i!=(a).end();i++)

#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())

#define pb push_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

bool solve(string s) {
    stack<char> stk;
    rep(i, s.size()) {
        if(s[i] == '[') stk.push('[');
        if(s[i] == '(') stk.push('(');
        if(s[i] == ']') {
            if(stk.empty() or stk.top() != '[') return false;
            stk.pop();
        }
        if(s[i] == ')') {
            if(stk.empty() or stk.top() != '(') return false;
            stk.pop();
        }
    }
    return stk.empty();
}

int main()
{
    string s;
    while(getline(cin, s), s != ".") {
        if(solve(s)) cout << "yes" << endl;
        else cout << "no" << endl;
    }
    return 0;
}

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

int main(void)
{
  char nc[11];
  scanf("%s",nc);

  int nlen;
  nlen = strlen(nc);

  int s=0,n=0,i,j;
  for(i=0;i<nlen;i++){
    s += (nc[i]-'0');
    n += (nc[i]-'0')*pow(10,(nlen-i)-1);
  }

  if(n%s==0)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}


Measured memory_bytes: 2532
s = input()
a = int(s[:2])
b = int(s[2:])

mmyy = False
yymm = False
if 0 < a < 13:
    mmyy = True

if 0 < b < 13:
    yymm = True

if mmyy is True and yymm is False:
    print('MMYY')
elif mmyy is True and yymm is True:
    print('AMBIGUOUS')
elif mmyy is False and yymm is False:
    print('NA')
else:
    print('YYMM')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define Fast_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long

int32_t main() {
	Fast_IO

	int n; cin >> n;
	vector<int> a(n);
	for (auto &it : a) {
		cin >> it;
	}
	int lim = 1e18;
	int ans = 1;
	int slim = INT_MAX;
	sort(a.begin(), a.end());
	for (int i = 0 ; i < n; i++) {
		ans *= a[i];
		if (ans > slim and a[i] > slim) {
			cout << -1;
			return 0;
		}
	}
	if (ans > lim)
		cout << -1;
	else
		cout << ans;

}

Measured memory_bytes: 3992
#include<bits/stdc++.h> 
using namespace std;
#define ll long long
#define C getchar()-48
inline ll read()
{
    ll s=0,r=1;
    char c=C;
    for(;c<0||c>9;c=C) if(c==-3) r=-1;
    for(;c>=0&&c<=9;c=C) s=(s<<3)+(s<<1)+c;
    return s*r;
}
#define find __builtin_popcount
const int N=15,M=1<<15,p=1e9+7; 
int n,m;
int g[N],dp[M],cf[M];
inline int add(int x,int y)
{
	return ((x+=y)>p)?x-p:x;
}
int main()
{
    n=read(),m=read();
    dp[0]=cf[0]=1;
    for(int i=1;i<=m;i++) cf[i]=(cf[i-1]<<1)%p; 
	for(int i=1;i<=m;i++){int x=read()-1,y=read()-1;g[x]|=(1<<y);} 
	for(int s=1,sed=1<<n;s<sed;s++) if((s&1)==(s>>1&1))
	for(int u=s;u;u=u-1&s) if((u&1)==(u>>1&1))
	{
		int ans=1;
		for(int i=0;i<n;i++) if(s>>i&1)
		{
			if(u>>i&1) ans=1ll*ans*cf[find(g[i]&(s^u))]%p;
			else ans=1ll*ans*(cf[find(g[i]&u)]-1)%p;
		}
		dp[s]=add(dp[s],1ll*dp[s^u]*ans%p);
	}
	cout<<(cf[m]-dp[(1<<n)-1]+p)%p;
    return 0;
}

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

using namespace std;

int main() {
	long long n, k, a, b ,c;
	cin >> a >> b >> c;
	if((a == b && a != c) || (a == c && a != b) || (b == c && c != a)) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 256
input()
a = [int(v) for v in input().split()]
ans = None
while True:
        mi = float('inf')
        for v in a:
                if v == 0:
                        continue
                mi = min(mi, v)
        if mi == float('inf'):
                break
        if ans is None or mi < ans:
                ans = mi
        zero_cnt = 0
        for i in range(len(a)):
                if a[i] % mi == 0:
                        zero_cnt += 1
                        continue
                a[i] %= mi
        if zero_cnt == len(a):
                break
print(ans)

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{

	map<int, int > K;
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	K[a]++; K[b]++; K[c]++; K[d]++;

	if(K[1]==1&&K[9]==1&&K[7]==1&&K[4]==1) {
		ce("YES")
	}
	else {
		ce("NO")
	}
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		for (int turtle = 0; turtle <= x; ++turtle) {
			int crane = x - turtle;
			int feet = 4 * turtle + 2 * crane;
			if (feet == y) {
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");
	}
}


Measured memory_bytes: 35660
N,L=map(int,input().split())
A=list(map(int,input().split()))
flag=False
for i in range(N-1):
    if A[i]+A[i+1]>=L:
        flag=True
        idx=i+1
        break
if not flag:
    print('Impossible')
else:
    print('Possible')
    for i in range(1,idx):
        print(i)
    for i in range(N-1,idx,-1):
        print(i)
    print(idx)

Measured memory_bytes: 14060
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
bool is_prime(int x) {
	if (x == 1) {
		return false;
	}
	if (x == 2) {
		return true;
	}
	if (x % 2 == 0) {
		return false;
	}
	for (int i = 3; i * i <= x; i += 2) {
		if (x % i == 0) {
			return false;
		}
	}
	return true;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int x;
	cin >> x;
	while (!is_prime(x)) {
		++x;
	}
	cout << x << '\n';
	return 0;
}


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

int main(){
    int r, c;
    cin >> r >> c;
    int** table = new int*[r + 1];

    for(int i=0;i<r+1;i++){
        table[i] = new int[c + 1];
    }

    for(int i=0;i<r;i++){
        int sum = 0;
        for(int j=0;j<c;j++){
            cin >> table[i][j];
            sum += table[i][j];
        }
        table[i][c] =sum;
    }

    for(int j=0;j<c+1;j++){
        int sum = 0;
        for(int i=0;i<r;i++){
            sum += table[i][j];
        }
        table[r][j]=sum;
    }

    for(int i=0;i<r+1;i++){
        for(int j=0;j<c+1;j++){
            if(j)cout << " ";
            cout << table[i][j];
        }
        cout << endl;
    }

    return 0;
}


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

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

  int even_count = 0;
  int odd_count = 0;
  double ans = 0;

  for (int i = 1; i <= N; i++) {
    if(i % 2 == 0) even_count++;
    else odd_count++;
  }
  ans = ((double)odd_count) / N;
  cout << ans << endl;
  return 0;
}

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

#define max_int64 9223372036854775807

using namespace std;

int main() {

	int64_t N;
	
	cin >> N;

	vector<int64_t> X(N);
	for (int64_t i = 0; i < N; i++) {
		cin >> X[i];
	}

	int64_t min_power = max_int64;

	for (int64_t i = 1; i <= 100; i++) {
		int64_t power = 0;
		for (int64_t j = 0; j < N; j++) {
			power += pow(i - X[j], 2);
		}
		
		if (power < min_power) {
			min_power = power;
		}

	}
	cout << min_power;
	return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <assert.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;


#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <bitset>
const int maxn = 2e5 + 20;
int a[maxn];
vector<int>da;
void work() {
    int n;
    LL sum = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        sum += a[i];
    }
    LL add = 1LL * n * (n + 1) / 2;
    if (sum % add != 0) {
        cout << "NO" << endl;
        return;
    }
    for (int i = 2; i <= n; ++i) {
        da.push_back(a[i] - a[i - 1]);
    }
    da.push_back(a[1] - a[n]);
    LL k = sum / add;
    for (int i = 0; i < da.size(); ++i) {
        LL t = k - da[i];
        if (t % n != 0 || t < 0) {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    work();
    return 0;
}


Measured memory_bytes: 1276
#include<stdio.h>
int main(void){
int a, b;
 scanf("%d %d", &a, &b);
 if(a < b){printf("a < b\n");
}
 else if(a > b){printf("a > b\n");
}
 else{printf("a == b\n");
}
 return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int k, ans;

int main() {
	cin >> k;
	inc1(i, k) {
	inc1(j, k) {
		if(i < j && i % 2 != j % 2) { ans++; }
	}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
bool check(vector<ll>&v,ll n,ll k,ll t)
{
    vector<ll>hh;
    for(ll i=0;i<n;i++)
    {
        hh.pb(v[i]%t);
    }
    sort(hh.begin(),hh.end());
    ll rem=0;
    ll reqd=0;
    ll l=0;
    ll r=n-1;
    while(l<=r)
    {
        if(rem<=0)
        {
            rem+=hh[l];
            reqd+=hh[l];
            l++;
        }else
        {
            rem-=(t-hh[r]);
            reqd+=(t-hh[r]);
            r--;
        }
    }
    if(reqd>2*k)
    {
        return false;
    }
    if(rem!=0)
    {
        return false;
    }
    return true;
}
int main()
{
fast;
ll n,k;
cin>>n>>k;
ll sum=0;
vector<ll>v;
for(ll i=0;i<n;i++)
{
    ll a;
    cin>>a;
    v.pb(a);
    sum+=a;

}
ll ans=1;
for(ll i=1;i*i<=sum;i++)
{
    if(sum%i==0)
    {
        if(check(v,n,k,i))
        {
            ans=max(ans,i);
        }
        if(check(v,n,k,sum/i))
        {
            ans=max(ans,sum/i);
        }
    }
}
//cout<<check(v,n,k,7)<<endl;
cout<<ans<<endl;

return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long int ll;
const ll INF=pow(10,15);

//46
int N;
ll A,B;
ll X[100002];
ll ans=0;

int main()
{
 scanf("%d %lld %lld",&N,&A,&B);
 for(int i=0;i<N;i++)
 {
	scanf("%lld",&X[i]);
 }
 for(int i=1;i<N;i++)
 {
	ans+=min((X[i]-X[i-1])*A,B);
 }
 printf("%lld\n",ans);
}

Measured memory_bytes: 4324
#include <stdio.h>

int main(){
  int n,k;
  char s[10];
  char ast;
  int i;
  scanf("%d",&n);
  scanf("%s",s);
  scanf("%d",&k);
  //printf("%d %d %s\n",n,k,s);
  ast = s[k-1];
  for(i = 0;i<n;++i){
    if(s[i] != ast){
      s[i] = '*';
    }
  }
  printf("%s\n",s);
  return 0;
}

Measured memory_bytes: 128