akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
using namespace std;

int n, a, ans = 1, c[100005];
int main()
{
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf("%d", &a);
		c[a]++;
	}
	if (c[0] > 1) {
		cout << '0' << endl;
		return 0;
	}
	for (i = 1; i < n; i++) {
		if (c[i] > 2) {
			cout << '0' << endl;
			return 0;
		}
	}
	n /= 2;
	while (n--) {
		ans *= 2;
		ans %= 1000000007;
	}
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <functional>

#define f first.first
#define s first.second
#define t second

#define pii pair <int, int>

using namespace std;

pair <pii, int> v[100010];
priority_queue <int, vector <int>, greater <int> > q;
long long st[100010], dr[100010];

bool cmp (pair <pii, int> a, pair <pii, int> b)
{
    return (a.t < b.t);
}

int main ()
{
    //freopen ("file.in", "r", stdin);

    int x, y, z;
    scanf ("%d %d %d", &x, &y, &z);
    int n = x + y + z;

    long long rez = 0LL;
    for (int i = 1; i <= n; ++i)
    {
        int c;
        scanf ("%d %d %d", &v[i].f, &v[i].s, &c);

        rez += 1LL * c;
        v[i].f -= c;
        v[i].s -= c;

        v[i].t = v[i].f - v[i].s;
    }

    sort (v + 1, v + n + 1, cmp);

    long long sum = 0LL;
    for (int i = 1; i <= y; ++i)
        q.push (v[i].s),
        sum += 1LL * v[i].s;

    st[y] = sum;
    for (int i = y + 1; i <= n; ++i)
    {
        if (v[i].s > q.top ())
        {
            sum -= 1LL * q.top ();
            sum += 1LL * v[i].s;

            q.pop ();
            q.push (v[i].s);

        }

        st[i] = sum;
    }

    for (; q.size () > 0; q.pop ());

    sum = 0LL;

    for (int i = n; i >= n - x + 1; --i)
        q.push (v[i].f),
        sum += 1LL * v[i].f;

    dr[n - x + 1] = sum;

    long long ma = -2000000000000000LL;
    for (int i = n - x; i >= y; --i)
    {
        if (v[i].f > q.top ())
        {
            sum -= 1LL * q.top ();
            sum += 1LL * v[i].f;

            q.pop ();
            q.push (v[i].f);
        }

        dr[i] = sum;

        ma = max (ma, st[i] + dr[i + 1]);
    }

    rez += ma;
    printf ("%lld\n", rez);

    return 0;
}


Measured memory_bytes: 2940
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict

sys.setrecursionlimit(10**7)
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

score = 0
myhands = []
for i, chara in enumerate(T):
    if i < K:
        if chara=='r':
            score += P
            myhands.append('p')
        elif chara=='s':
            score += R
            myhands.append('r')
        else:
            score += S
            myhands.append('s')
    else:
        if chara=='r':
            if myhands[i-K]!='p':
                score += P
                myhands.append('p')
            else:
                myhands.append('q')
        elif chara=='s':
            if myhands[i-K]!='r':
                score += R
                myhands.append('r')
            else:
                myhands.append('q')

        elif chara=='p':
            if myhands[i-K]!='s':
                score += S
                myhands.append('s')
            else:
                myhands.append('q')
print(score)




Measured memory_bytes: 4504
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int A, B, X;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> X >> A >> B;

  cout << (X - A) % B << endl;

  return 0;
}


Measured memory_bytes: 512
def main():
    N, P = map(int, input().split())
    S = input()
    if P == 2 or P == 5:
        r = 0
        for i, v in enumerate(S):
            if int(v) % P == 0:
                r += i + 1
        return r
    l = [0] * P
    l[0] = 1
    p = 0
    r = 0
    for i, v in enumerate(reversed(S)):
        p = (p + int(v) * pow(10, i, P)) % P
        r += l[p]
        l[p] += 1
    return r
print(main())


Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int a, b, k;
        cin >> a >> b >> k;
        vector<int> v;
        for(int i = 1; i <= 100; i++){
            if(a % i == 0 and b % i == 0){
                v.pb(i);
            }
        }
        sort(all(v), greater<int> ());
        cout << v[k - 1] << '\n';
    }
}

Measured memory_bytes: 31488
n = int(input())
s = input()

import itertools

d = list()
for d1, d2, d3 in itertools.product(range(10), range(10), range(10)):
    d.append(str(d1) + str(d2) + str(d3))

ret = 0
for di in d:
    ls = list(s)
    try:
        idx1 = ls.index(di[0])
        idx2 = ls[idx1+1:].index(di[1])
        idx3 = ls[idx1+1:][idx2+1:].index(di[2])
        ret += 1
    except:
        continue

print(ret)

Measured memory_bytes: 3936
"""
NTC here
"""
import sys
input= sys.stdin.readline
# import t  hreading
# setrecursionlimit(10**6)
# threading.stack_size(2**26)

def iin(): return int(input())
def lin(): return list(map(int, input().split()))

# range = xrange
# input = raw_input

def main():
    n, k= lin()
    h=lin()
    ans=[0]*(n)
    for i in range(n-2,-1,-1):
        ans[i]=min(
            [abs(h[i]-h[j+i+1])+ans[i+j+1] for j in range(min(n-i-1,k))]
            )
    print(ans[0])
        



                









        
main()
#threading.Thread(target=main).start()


Measured memory_bytes: 52444
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define mod 1000000007;
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c;
    cin>>a>>b>>c;
    ll temp=a-b;
    if(a-b>=c)
    cout<<0;
    else
    cout<<c-(a-b);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long int ll;

int main() {
  int N;
  cin>>N;
  
  vector<int> a(N+1);
  vector<int> b(N);
  vector<int> c(N-1);
  
  for(int i=0;i<N;++i){
    cin>>a[i];
  }
  for(int i=0;i<N;++i){
    cin>>b[i];
  }
  for(int i=0;i<N-1;++i){
    cin>>c[i];
  }
  
  int ans=0;
  
  for(int i=0;i<N;++i){
    ans+=b[a[i]-1];
    if(a[i+1]-a[i]==1)
      ans+=c[a[i]-1];
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, X;
		N = sc.nextInt();
		X = sc.nextInt();
		int[] m = new int[N];
		for (int i = 0; i < m.length; i++) {
			m[i] = sc.nextInt();
			X -= m[i];
		}

		Arrays.sort(m);
		System.out.println(N + X / m[0]);
	}
}

Measured memory_bytes: 21972
input()
max_num = 0
temp_num = 0
prev_i = 0
for i in input().split():
  i = int(i)
  if prev_i < i:
    temp_num = 0
  else:
    temp_num += 1
    prev_i = i
    if max_num < temp_num:
      max_num = temp_num
  prev_i = i
print(max_num)


Measured memory_bytes: 11132
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int x=sc.nextInt();
			int y=sc.nextInt();
			System.out.println(Integer.toString(x+y).length());
		}
	}
}

Measured memory_bytes: 20444
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n,m,a,b,c,d,e;
	long double z,w;
	string str;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a>>b;
	cout<<a-b+1;



	cout<<endl;
} 


Measured memory_bytes: 256
//#if 1
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
//#endif
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int N;
	int a[100];
	int alice = 0, bob = 0;

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a, a + N);
	for (int i = N - 1; i >= 0; i--) {
		if (i % 2 == N % 2)bob += a[i];
		else alice += a[i];
	}
	cout << alice - bob << endl;

	return(0);
}

Measured memory_bytes: 384
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  if(a == b) cout << "Draw" << endl;
  else if(a == 1 ) cout << "Alice" << endl;
  else if(b == 1) cout << "Bob" << endl;
  else if(a > b) cout << "Alice" << endl;
  else if(a < b) cout << "Bob" << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define inf 0x3f3f3f3f
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
/* 
* stuff you should look for
* int overflow, array bounds
* special cases (n=1?), set tle
*/
 
set<int> a[27];
 
int main(){
    fcin;
  	int n;
  	cin >> n;
    string s;
    cin >> s;
    s = " " + s;
    for(int i = 1; i <= n; i++) a[s[i]-'a'].insert(i);
    int q;
    cin >> q;
    while(q--){
        int type;   cin >> type;
        if(type == 1){
            int pos;
            char c;
            cin >> pos >> c;
            a[s[pos]-'a'].erase(pos);
            s[pos] = c;
            a[s[pos]-'a'].insert(pos);
        } else {
            int l, r;
            cin >> l >> r;
            int ans = 0;
            for(int i = 0; i < 27; i++){
                auto k = a[i].lower_bound(l);
                if(k != a[i].end() and *k <= r) ans++;
            }
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 25796
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
  int h, a;cin>>h>>a;
  cout<<(h/a)+(h%a==0?0:1)<<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;


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

	int h, w, k;
	cin >> h >> w >> k;

	vector<string> g(h);
	rep(i, h) cin >> g[i];

	vector<vector<int>> a(
		h + 1, vector<int>(w + 1, 0)
	);

	rep(i, h) rep(j, w){
		a[i+1][j+1] = a[i+1][j] + a[i][j+1] - a[i][j] + (g[i][j] - '0');
	}

	ll ans = LLONG_MAX / 100;
	for(int c = 0; c < (1 << h - 1); c++){
		vector<int> v;
		ll cut = 0;
		v.push_back(0);
		rep(i, h - 1){
			if((c >> i) & 1) {
				v.push_back(i + 1);
				cut++;
			}
		} 
		v.push_back(h);


		int l = 0;
		bool fail = false;
		for(int r = 1; r <= w; r++){
			if(fail) break;

			int sz = v.size();
			rep(i, sz - 1){
				int t = v[i];
				int b = v[i+1];
				ll whi = a[b][r] - a[t][r] - a[b][l] + a[t][l];
				if(whi > k){
					cut++;
					l = r - 1;
					ll whi2 = a[b][r] - a[t][r] - a[b][l] + a[t][l];
					if(whi2 > k) fail = true;
				}
			}
		}

		// cerr << bit << " " << cut << endl;
		if(!fail) ans = min(ans, cut);
	}

	cout << ans << endl;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define mll map<ll,ll>
#define pb push_back
#define mp make_pair
#define endl "\n"
#define MAX 1e18
#define F first
#define S second
#define all(s) s.begin(),s.end()
#define mod 998244353
ll lcm(ll a,ll b){return (a*b)/(__gcd(a,b));}
ll cel(ll n,ll d){return (n+d-1)/d;}

void hertz()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}

int main()
{
    hertz();
    string s1,s2;
    cin>>s1>>s2;
    ll n=s1.size();
    ll m=s2.size();
    ll dp[n+1][m+1];
    for (int i = 0; i < n+1; ++i)
    {
    	for (int j = 0; j < m+1; ++j)
    	{
    		dp[i][j]=0;
    	}
    }
    for (int i = 1; i < n+1; ++i)
    {
    	for (int j = 1; j < m+1; ++j)
    	{
    		if(s1[i-1]==s2[j-1])
    			dp[i][j]=dp[i-1][j-1]+1;
    		else
    			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    	}
    }
    ll i=n,j=m;
    string ans;
    while(i>0 && j>0)
    {
    	if(s1[i-1]==s2[j-1])
    	{
    		ans+=s1[i-1];
    		i--;
    		j--;
    	}
    	else
    	{
    		if(dp[i-1][j]>dp[i][j-1])
    			i--;
    		else
    			j--;
    	}
    }
    reverse(all(ans));
    cout<<ans<<endl;
}

Measured memory_bytes: 74028
sum_anss = []
while True:
    n, x = map(int,input().split())
    if n==0 and x == 0:
        break
    else:
        sum_ans = 0
        for i in range(1,n+1):
            for j in range(1,i):
                for k in range(1,j):
                    if i != j and j != k and k !=i:
                        if i + j + k == x:
                            sum_ans = sum_ans + 1
        sum_anss.append(sum_ans)
for sum_a in sum_anss:
    print(sum_a)


Measured memory_bytes: 5600
#include<bits/stdc++.h>
#include<algorithm>
#include<list>
#include <string>
using namespace std;

int main(){
    int n;
    cin >> n;
    
    int count,a;
    count = 0;
    for(int i = 0; i < n;i++){
        cin >> a;
        if(a%2!=0)count++;
    }
    string ans ="YES";
    if(count%2!=0)ans ="NO";
    
    cout << ans << endl;
    
    return 0;

    
}

Measured memory_bytes: 256
//BISMILLAHIR RAHMANIR RAHIM
//SOTO MEAW
//SOTO SONDESH
#include<bits/stdc++.h>

#define ls ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define __ <<" "<<
#define loop(m,n) for(m=0;m<n;m++)
#define rloop(m,n) for(m=n-1;m>=0;m--)
#define case(z) "Case " << z++ << ": "
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define quit return 0

using namespace std;

bool isprime(int n)
{
    for (int i = 2; i <= n/2; i++)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}

void showmyDS(set<int> ds)
{
    set<int> ::iterator it;
    for (it=ds.begin();it!=ds.end();it++)
    {
        cout << *it << endl ;
    }
    cout << endl;
}
int main()
{
    ls
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //int t,l=1;cin>>t;while(t>0){
        vector<char>s;
        int j;
        string s1;
        cin>>s1;
        loop(j,s1.size()) s.push_back(s1[j]);
        int n,i,c=0;
        cin>>n;
        char a[n];
        int p,index[255];
        memset(index,0,sizeof(index));
        loop(i,n)
        {
            cin>>a[i];
            p=(int)a[i];
            index[p]=1;
        }
        loop(i,s.size())
        {
            p=(int)s[i];
            if(c==1)
                p=48;
again:
            if(index[p]==1 && p==57)
            {
                if(i!=0)
                    p=48;
                else
                    p=49;
                s.push_back('0');
                c=1;
            }
            if(index[p]==1)
            {
                p++;
                c=1;
                goto again;
            }
            else
            {
                cout<<(char)p;
            }
        }
        cout<<endl;
    //t--;}

    quit;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
using ld = long double;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
const long double pi = (acos(-1));
#define pb push_back

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる

//ここから
int main(){
    ll N,M;
    cin>>N>>M;
    priority_queue<ll> A;
    rep(i,N){
        ll a;
        cin>>a;
        A.push(a);
    }
    while (M>0)
    {
        ll X=A.top();
        A.pop();
        X/=2;
        M--;
        A.push(X);
    }
    ll Ans=0;
    while(!A.empty()){
        Ans+=A.top();
        A.pop();
    }
    cout<<Ans<<endl;
}


Measured memory_bytes: 1400
h,w = map(int,input().split())
C = [list(input()) for i in range(h)]
startls = []

for i in range(h):
    for j in range(w):
        if C[i][j] == '.':
            startls.append([i,j])
            
dy_dx = [[1,0],[0,1],[-1,0],[0,-1]]
ans = 0
for start in startls:
    visited = [[-1 for i in range(w)] for i in range(h)]
    visited[start[0]][start[1]] = 0
    cost = 0
    queue = [start]
    while len(queue) > 0:
        now = queue.pop(0)
        cost = visited[now[0]][now[1]]+1
        for i in range(4):
            y = now[0]+dy_dx[i][0]
            x = now[1]+dy_dx[i][1]
            if 0 <= y < h and 0 <= x < w:
                if C[y][x] != '#' and visited[y][x] == -1:
                    visited[y][x] = cost
                    queue.append([y,x])
                    ans = max(ans,cost)
print(ans)

Measured memory_bytes: 9276
function main(input) {
  input = input.trim();
  const [a, b, c] = input.split(" ").map(a => Number(a));
  let result = "NO";
  for (let i = 1; i <= b; i++) {
    if (a*i%b === c) {
      result = "YES";
      break;
    }
  }
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N;
    cin >> N;
    vector<string> S(N);
    rep(i, N) cin >> S[i];
    ll ac = 0, wa = 0, tle = 0, re = 0;
    rep(i, N) {
        string s = S[i];
        if (s == "AC") {
            ac++;
        } else if (s == "WA") {
            wa++;
        } else if (s == "TLE") {
            tle++;
        } else {
            re++;
        }
    }
    cout << "AC x " << ac << '\n';
    cout << "WA x " << wa << '\n';
    cout << "TLE x " << tle << '\n';
    cout << "RE x " << re << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 6360
#include <iostream>

using namespace std;

int main() {
    int L;
    while (cin >> L) {
        if (L == 0) break;
        for (int i = 1; i <= 12; i++) {
            int M, N; cin >> M >> N;
            L -= (M - N);
            if (L <= 0) {
                cout << i << endl;
                for (int j = i+1; j <= 12; j++) {
                    int t1, t2; cin >> t1 >> t2;
                }
                break;
            }
            if (i == 12)
                cout << "NA" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 0
import sys
def v():
    pt=[5,0,1,2]
    s=list(map(lambda x: '0' if x=='g' else '1', sys.stdin.readline().strip()))
    n=len(s)
    p=pt[n%4]
    for _ in range(n//4):p=(p<<4)+5
    ss=list(format(p,'b').zfill(n))
    res=0
    for a,b in zip(s,ss):
        d=int(b)-int(a)
        res = res if d==0 else res+d
    print(res)
if __name__=='__main__':v()


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

using namespace std;
#define int long long
const int MOD = 1000000007;

vector<vector<int> > T;
vector<vector<int> > X;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
    T.resize(N);
    X.resize(N);
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		int x, y;
		for (int j = 0; j < A; j++) {
			cin >> x >> y;
			x--;
			T[i].push_back(x);
			X[i].push_back(y);
		}
	}
	int res = 0;
	for (int i = 0; i < (1 << N); i++) {
		int cnt = 0;
		vector<int> a;
		for (int j = 0; j < N; j++) {
			if (i & (1 << j)) {
				a.push_back(1);
				cnt++;
			} else {
				a.push_back(0);
			}
		}
		bool ok = true;
		for (int j = 0; j < N; j++) {
			if (a[j] == 1) {
				for (int k = 0; k < T[j].size(); k++) {
					if (a[T[j][k]] != X[j][k]) {
						ok = false;
					}
				}
			}
		}
		if (ok) {
			res = max(res, cnt);
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define sum accumulate
#define keta fixed<<setprecision
typedef long long ll;
const int INF = 100000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 998244353LL;
int main(){
	double r;
	std::cin >> r;
	std::cout <<keta(8)<< r*r*M_PI<<" "<<2*r*M_PI << std::endl;
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
int main()
{ 
    int a,b,c;
    cin>>a>>b>>c;
    if(b-a==c-b)
	{ 
    cout<<"YES"<<endl;
    return 0;
    }
    else
    {
    cout<<"NO"<<endl; 
    return 0;
	}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int L, K; cin >> L >> K;
    vector<vll> dp(L + 1, vll(2));
    dp[0][0] = 1;

    ll res = 0;
    rep(i, L + 1){
        rep(j, 2){
            ll cur = dp[i][j];
            if(j == 1){
                res += cur;
            }

            int nj = j ^ 1;
            if(i + 1 <= L){
                dp[i + 1][nj] += cur;
            }
            if(j == 0 and i + K <= L){
                dp[i + K][nj] += cur;
            }
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3236
import collections
N = int(input())
A = list(map(int , input().split()))
a = collections.Counter(A)
k = 0
def comb(n):
    return n * (n - 1) // 2
for j in a.values():
    k += comb(j)
    
for i in range(N):
    s = A[i]
    p = a[s]
    print(int(k - p + 1))

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

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

        int n=scan.nextInt();
        int rate_min[]=new int[8];
        int rate_max[]=new int[8];
        rate_min[0]=1;
        rate_max[0]=399;
        for(int i=1;i<8;i++){
            rate_min[i]=i*400;
            rate_max[i]=rate_min[i]+399;
        }
        int cnt=0;
        int a[]=new int[n];
        boolean jdg[]=new boolean[8];
        for(int i=0;i<n;i++){
            a[i]=scan.nextInt();
            for(int j=0;j<8;j++){
                if(rate_min[j]<=a[i] && a[i]<=rate_max[j]){
                    jdg[j]=true;
                }
            }
            if(a[i]>=3200){
                cnt++;
            }
        }
        int ans=0;
        for(int i=0;i<8;i++){
            if(jdg[i]){
                ans++;
            }
        }
        if(ans!=0) {
            System.out.print(ans + " ");
            System.out.println((ans + cnt));
        }else{
            System.out.println(1 + " " + cnt);
        }

    }
}

Measured memory_bytes: 21716
n=gets.chomp.to_i
w=gets.chomp.split.map(&:to_i)

a=(1...n).map do |t|
  a1 = w[0..t]
  a2 = w[(t+1)..n]
  s1 = a1.sum
  s2 = a2.sum
  (s1-s2).abs
end

puts a.min

Measured memory_bytes: 14312
<?php
fscanf(STDIN, "%d%d%d", $N, $M, $R);
$rArray = array_map("intval", explode(" ", trim(fgets(STDIN))));

$wf = new Wf($N);
for($i = 0; $i < $M; $i++){
  fscanf(STDIN, "%d%d%d", $a, $b, $c);
  $wf->connect($a, $b, $c);
}
$d = $wf->solve();

echo dfs($rArray, -1);
function dfs($rArray, $current){
  global $d;
  if(!$rArray)return 0;
  $min = 10**10;
  foreach($rArray as $i => $p){
    $array = $rArray;
    unset($array[$i]);
    $dist = dfs($array, $p);
    if($current != -1){
      $dist += $d[$current][$p];
    }
    if($dist < $min){
      $min = $dist;
    }
  }
  return $min;
}

/**
 * Warshall–Floyd
 * Attention: 1-origin
 **/
class Wf{
  public $d;
  public $n;
  function __construct($n)	{
    $this->n = $n;
    for($i = 1; $i <= $this->n; $i++){
      for($j = 1; $j <= $this->n; $j++){
        $this->d[$i][$j] = 10**18;
      }  
    }
  }
  function connect($a, $b, $c){
    $this->d[$a][$b] = $c;
    $this->d[$b][$a] = $c;
  }
  function solve(){
    for($k = 1; $k <= $this->n; $k++){
      for($i = 1; $i <= $this->n; $i++){
        for($j = 1; $j <= $this->n; $j++){
          if($this->d[$i][$j] > $this->d[$i][$k] + $this->d[$k][$j]){
            $this->d[$i][$j] = $this->d[$i][$k] + $this->d[$k][$j];
          }
        }
      }
    }
    return $this->d;
  }
}


Measured memory_bytes: 7288
#include <stdio.h>

int main () {
    int a, b, n, scorea, scoreb;
    while (1) {
        scanf("%d", &n);
        if (n == 0) break;

        scorea = scoreb = 0;
        while (n--) {
            scanf("%d %d", &a, &b);
            if (a == b) {
                scorea += a;
                scoreb += b;
            }
            else if (a > b) {
                scorea += a + b;
            } else {
                scoreb += a + b;
            }
        }
        printf("%d %d\n", scorea, scoreb);
    }

    return 0;
}

Measured memory_bytes: 2576
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int h[9];
int l[9];
int main(){
	for(int i = 0;i < 7;i++){
		cin>>h[i]>>l[i];
	}
	for(int i = 0;i < 7;i++){
		cout <<h[i]-l[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, long double> P;

const ll INF = 1e12;
ll n, xt, yt;
ll x[1100], y[1100], r[1100];
vector<P> edge[1100];
long double dist[1100];

void dijkstra(ll s) {
  priority_queue<P, vector<P>, greater<P>> pq;
 
  for (ll i = 0; i <= n+1; i++) {
    dist[i] = INF;
  }
 
  dist[s] = 0;
  pq.push(pair<long double, ll>(0, s));
 
  while (pq.size()) {
    P p = pq.top();
    pq.pop();
    ll u = p.second;
    if (dist[u] < p.first) continue;
    for (P p: edge[u]) {
      ll v = p.first;
      long double cost = p.second;
      if (dist[v] > dist[u] + cost) {
        dist[v] = dist[u] + cost;
        pq.push(pair<long double, ll>(dist[v], v));
      }
    }
  }
}

int main() {
  cin >> x[0] >> y[0] >> xt >> yt;
  cin >> n;
  x[n+1] = xt;
  y[n+1] = yt;

  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i] >> r[i];
  }
  
  for (int i = 0; i <= n; i++) {
    for (int j = i+1; j <= n+1; j++) {
      long double dist = sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
      dist = max(0.0L, dist-r[i]-r[j]);
      edge[i].push_back(P(j, dist));
      edge[j].push_back(P(i, dist));
    }
  }
  
  dijkstra(0);

  cout << fixed << setprecision(12) << dist[n+1] << endl;
  return 0;
}

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

int n;
P tasks[202020];

int main(){
  cin >> n;
  rep(i, n){
    cin >> tasks[i].second >> tasks[i].first;
    if(tasks[i].first < tasks[i].second){
      cout << "No" << endl;
      return 0;
    }
  }
  sort(tasks, tasks + n);
  
  ll t = 0;
  rep(i, n){
    t += (long)tasks[i].second;
    if(t > tasks[i].first){
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n;
    cin >> n;
    int ans = 0;
    repeat_from_to(i, 1, n) {
        ans += 800;
        if (i % 15 == 0) {
            ans -= 200;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stack>
using namespace std;
int main(){
	int n,q;
	cin>>n>>q;
	stack <int> S[n];
	while(q--){
		int i,t;
		cin>>i>>t;
		if(i==0){
			int x;
			cin>>x;
			S[t].push(x);
		}
		else if(i==1){
			if(!S[t].empty())	cout<<S[t].top()<<endl;
		}
		else if(i==2)	if(!S[t].empty())	S[t].pop();
	}
	return 0;
}


Measured memory_bytes: 4456
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
       Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long[] cs = new long[n];
        for (int i = 0; i < n; i++) {
            cs[i] = in.nextLong();
        }
        Arrays.sort(cs);
        long[] sum = new long[n];
        long[] r = new long[n];
        sum[0] = cs[0];
        r[0] = 1;
        for (int i = 1; i < n; i++) {
            sum[i] = sum[i - 1] + cs[i];
            if (sum[i - 1] * 2 >= cs[i]) {
                r[i] = r[i - 1] + 1;
            } else {
                r[i] = 1;
            }
        }
        System.out.println(r[n - 1]);
    }
}

Measured memory_bytes: 53444
#include <stdio.h>

int main(void){
	char x,y;
	int a,b;
	scanf("%c %c",&x,&y);
	switch(x){
		case 'A':
		 a=1;
		break;
		case 'B':
		 a=2;
		 break;
		case 'C':
		 a=3;
		 break;
		case 'D':
		 a=4;
		 break;
		case 'E':
		 a=5;
		 break;
		case 'F':
		 a=6;
		 break;
	}
	switch(y){
		case 'A':
		 b=1;
		break;
		case 'B':
		 b=2;
		 break;
		case 'C':
		 b=3;
		 break;
		case 'D':
		 b=4;
		 break;
		case 'E':
		 b=5;
		 break;
		case 'F':
		 b=6;
		 break;
	}
	if(a==b){
		printf("=\n");
	}else if(a<b){
		printf("<\n");
	}else{
		printf(">\n");
	}
	return 0;
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let st = get!(String, usize; n);
    let x = get!(String);
    let mut total = 0;

    let mut flag = false;
    for (s,t) in st {
        if flag {
            total += t;
        }
        if x == s {
            flag = true;
        }
    }
    println!("{}", total);
}


Measured memory_bytes: 8572
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <stack>
#include <string>
#include <fstream>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define LL long long
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
  string S;
  stack<char> ST;
  cin>>S;
  FOR(i,0,(int)S.size()){
    if(S[i]=='S'){
      ST.push('S');
    }else{
      if(ST.empty()||ST.top()=='T'){
        ST.push('T');
      }else{
        ST.pop();
      }
    }
  }
  cout<<(int)ST.size()<<endl;
  return 0;
}


Measured memory_bytes: 644
#include<stdio.h>
int main(void){
	int n;
	int i,j;
	int cnt[10] ={0};
	int ice;
	int flag = 0;
	while(scanf("%d",&n)){
		if(n == 0){
			break;
		}
		for(i = 0;i < n;i++){
			scanf("%d",&ice);
			for(j = 0;j < 10;j++){
				if(ice == j){
					cnt[j]++;
				}
			}
		}
		for(i = 0;i < cnt[0];i++){
			printf("*");
			flag = 1;
		}
		if(flag == 0){
			printf("-");
		}
		flag = 0;
		printf("\n");
		for(i = 0;i < cnt[1];i++){
			printf("*");
			flag = 1;
		}
		if(flag == 0){
			printf("-");
		}
		flag = 0;
		printf("\n");
		for(i = 0;i < cnt[2];i++){
			printf("*");
			flag = 1;
		}
		if(flag == 0){
			printf("-");
		}
		flag = 0;
		printf("\n");
		for(i = 0;i < cnt[3];i++){
			printf("*");
			flag = 1;
		}
		if(flag == 0){
			printf("-");
		}
		flag = 0;
		printf("\n");
		for(i = 0;i < cnt[4];i++){
			printf("*");
			flag = 1;
		}
		if(flag == 0){
			printf("-");
		}
		flag = 0;
		printf("\n");
		for(i = 0;i < cnt[5];i++){
			printf("*");
			flag = 1;
		}
		if(flag == 0){
			printf("-");
		}
		flag = 0;
		printf("\n");
		for(i = 0;i < cnt[6];i++){
			printf("*");
			flag = 1;
		}
		if(flag == 0){
			printf("-");
		}
		flag = 0;
		printf("\n");
		for(i = 0;i < cnt[7];i++){
			printf("*");
			flag = 1;
		}
		if(flag == 0){
			printf("-");
		}
		flag = 0;
		printf("\n");
		for(i = 0;i < cnt[8];i++){
			printf("*");
			flag = 1;
		}
		if(flag == 0){
			printf("-");
		}
		flag = 0;
		printf("\n");
		for(i = 0;i < cnt[9];i++){
			printf("*");
			flag = 1;
		}
		if(flag == 0){
			printf("-");
		}
		flag = 0;
		printf("\n");
		for(i = 0;i < 10;i++){
			cnt[i] = 0;
		}
		
	}
	return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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


    lint n, k,s;
    cin >> n >> k>>s;

    lint ans, tmp;

    REP(i, k){
        cout << s << " ";
    }
    lint xxx = 1000000000;
    if (s==xxx){
        REP(i, n - k)
        {
            cout << xxx-1 << " ";
        }
    }else{
        REP(i, n - k)
        {
            cout << xxx << " ";
        }
    }

    
    return 0;
}

Measured memory_bytes: 1280
#include<cstdio>
int n,a[233333]; long long fr,sc,ndad;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	for(int i=1;i<=n;++i){
		int x; scanf("%d",&x);
		if(a[i]>=x) sc+=a[i]-x;
		else{
			if((x-a[i])%2){
				++x; ++sc;
			}
			fr+=(x-a[i])/2;
		}
	}
	printf("%s",fr>=sc?"Yes":"No");
}

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

int main() {
  string s;
  cin >> s;
  int pcount=0;
  int mcount=0;
  for(int i=0;i<4;i++){
    if(s.at(i) == '+') pcount++;
    else if(s.at(i) == '-') mcount--;
  }
  cout << pcount + mcount << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double N;
double dp[305][305][305];
double dfs(int A,int B,int C) {
    if(dp[A][B][C] >= 0) {
        return dp[A][B][C];
    }
    if(A == 0 && B == 0 && C == 0) {
        return 0;
    }
    double res = 0;
    if(A) res+=dfs(A-1,B,C)*A;
    if(B) res+=dfs(A+1,B-1,C)*B;
    if(C) res+=dfs(A,B+1,C-1)*C;
    res+=N;
    res*=(1.0/(A+B+C));
    dp[A][B][C] = res;
    return res;
}
signed main(){
    cin >> N;
    vector<int>a(N);
    int cnt1 = 0,cnt2 = 0,cnt3 = 0;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        if(a[i] == 1) cnt1++;
        if(a[i] == 2) cnt2++;
        if(a[i] == 3) cnt3++;
    }
    for(int i = 0; i < 305; i++) {
        for(int j = 0; j < 305; j++) {
            for(int k = 0; k < 305; k++) {
                dp[i][j][k] = -1;
            }
        }
    }
    cout << fixed << setprecision(20) << dfs(cnt1,cnt2,cnt3) << endl;
}


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

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

  ll n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> wa(n+1, 0);
  map<ll, ll> m;
  m[0]++;
  rep(i, 0, n) {
    cin >> a[i];
    wa[i+1] = wa[i]+a[i];
    m[wa[i+1]]++;
  }
  
  ll ans = 0;
  for(const auto& e : m) {
    ll x = e.second;
    if(x >= 2) {
      ans += (x*(x-1))/2;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define VI vector<int> 
#define SI set<int>
#define QI queue<int> 
#define PII pair<int, int>
#define MP make_pair
#define PB push_back
#define REP(i,a,b) for(int i = a; i < b; ++i)
#define F for(int i = 0; i < n; ++i)
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define M 1000000007
using namespace std;

int main()
 {  
    FIO
    int x,y; cin>>x>>y;
    if((4*x - y) >= 0 and (4*x- y) % 2 == 0 and (y - 2*x) >= 0 and (y - 2*x) % 2 == 0)
      cout<<"Yes";
    else 
      cout<<"No";
    
    
    return 0;
}

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

using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string S = Console.ReadLine();

            int maxType = 0;

            List<char> s = new List<char>();
            List<char> c1 = new List<char>();
            List<char> c2 = new List<char>();

            List<char> intersect = new List<char>();

            for (int i = 0; i < N; i++)
            {
                s.Add(S[i]);
            }

            for (int i = 1; i < s.Count; i++)
            {
                if (intersect.Count > N - i) break;

                c1.Clear();
                c2.Clear();
                intersect.Clear();

                c1 = s.Take(i).ToList();
                c2 = s.Skip(i).ToList();

                intersect = c1.Distinct().Intersect(c2.Distinct()).ToList<char>();
                
                if (intersect.Count > maxType)
                {
                    maxType = intersect.Count;
                }

            }
            Console.WriteLine(maxType);
        }

        static string[] Input() => System.Console.ReadLine().Split();
    }
}


Measured memory_bytes: 13396
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <map>
#include <set>
#include <array>
#include <queue>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <functional>
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;
typedef std::pair<int, int> P;

char a, b;

int main()
{
	in >> a >> b;

	if (a == 'H'&&b == 'H')
	{
		out << "H" << std::endl;
	}
	else if (a == 'D'&&b == 'D')
	{
		out << "H" << std::endl;
	}
	else
	{
		out << "D" << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256