akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 998244353LL
#define eps 1e-13
// #define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pair < pii, int > a, pair < pii, int > b)//true for a before b
{
	if(a.F.F/300 < b.F.F/300)
		return 1;
	if(a.F.F/300 > b.F.F/300)
		return 0;
	if(a.F.S < b.F.S)
		return 1;
	if(a.F.S > b.F.S)
		return 0;
	if(a.F <= b.F)
		return 1;
	return 0;
}

const int N = (2e5) + 9;
const int M = (N<<2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 2*550;
const int SQRT = BUCK+9;

string s;

void solve()
{
	int n, i, pt;
	ll ans = 0;
	cin >> s;
	n = s.length();
	pt = n-1;
	for(i = n-1; i >= 0; i--)
	{
		if(s[i] == 'B')
		{
			ans += (pt-i);
			pt--;
		}
	}
	cout << ans << '\n';
	return;
}

int main()
{
	sws;
	clock_t clk;
	clk = clock();
	// io_file;
	// srand (time(NULL));

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(9);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

Measured memory_bytes: 720
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-7
#define REP(i,m) for(long long i=0; i<(ll)m; i++)
#define FOR(i,n,m) for(long long i=n; i<(ll)m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	vector<ll> t(n);
	vector<ll> a(n);
	REP(i,n) cin>>t[i];
	REP(i,n) cin>>a[i];
	vector<P> range(n,P(1,INF*INF));
	REP(i,n) {
		if(i==0) {
			range[i].first=max(range[i].first,t[i]);
			range[i].second=min(range[i].second,t[i]);
		}
		else if(t[i]>t[i-1]) {
			range[i].first=max(range[i].first,t[i]);
			range[i].second=min(range[i].second,t[i]);
		} else {
			range[i].second=min(range[i].second,t[i]);
		}
	}
	for(ll i=n-1; i>=0; i--) {
		if(i==n-1) {
			range[i].first=max(range[i].first,a[i]);
			range[i].second=min(range[i].second,a[i]);
		}
		else if(a[i]>a[i+1]) {
			range[i].first=max(range[i].first,a[i]);
			range[i].second=min(range[i].second,a[i]);
		} else {
			range[i].second=min(range[i].second,a[i]);
		}
	}
	//REP(i,n) cout<<range[i].first<<" "<<range[i].second<<endl;
	ll ans=1;
	REP(i,n) {
		if(range[i].first>range[i].second) {
			cout<<0<<endl;
			return 0;
		}
		ans*=(range[i].second-range[i].first+1);
		ans%=MOD;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3456
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var items = Console.ReadLine().Split().ToArray();
            var A = decimal.Parse(items[0]);
            var B = (decimal)(double.Parse(items[1]) * 100);
            var answer = (A * B).ToString("000");
            Console.WriteLine(answer.Substring(0, answer.Length - 2));
        }
    }
}


Measured memory_bytes: 28092
#include<bits/stdc++.h>
#define fi first
#define se second
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define pb push_back
#define ll long long
using namespace std;
const int inf=1e9;
const int mod=1e9+7;
const int maxn=1e5+10;
int main(){
	//ios::sync_with_stdio(false);
		//freopen("in","r",stdin);
	int n;
	cin>>n;
	if(n&1){
		cout<<n/2<<endl;
	}else cout<<n/2-1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=1e6+7;
ll n, k;
ld a[L];
bool check(ll val)
{
	int co = 0;
	FOR(i,0,n)
	{
		co += ((a[i]+val-1)/val - 1);
	}
	return co <= k;
}
void fff()
{
	cin >> n >> k;
	FOR(i,0,n)cin >> a[i];	
	ll l = 0, r = 1e9, mid;
	while(l<r-1)
	{
		mid = (l+r)/2;
		if(check(mid))r = mid;
		else l = mid;
	}
	if(!check(r))r = l;
	cout << r << ln;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

Measured memory_bytes: 6780
s = str(input())

mm_f = 0
mm_e = 0

if 0 < int(s[0:2]) <= 12:
    mm_f = 1
if 0 < int(s[2:]) <= 12:
    mm_e = 1

if mm_f == 1 and mm_e == 1:
    print('AMBIGUOUS')
elif mm_f == 1 and mm_e == 0:
    print('MMYY')
elif mm_f == 0 and mm_e == 1:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func main() {
	var N, Y int
	var exist bool
	var kumi = make(map[string]int)

	fmt.Scan(&N)
	fmt.Scan(&Y)

	max_a := Y / 10000
	if max_a > N {
		max_a = N
	}
	max_b := Y / 5000
	if max_b > N {
		max_b = N
	}
	max_c := Y / 1000
	if max_c > N {
		max_c = N
	}
	
	for a := 0; a <= max_a && !exist; a++ {
		for b := 0; b <= max_b-a && !exist; b++ {
			for c := 0; c <= max_c-a-b; c++ {
				if a + b + c== N && a * 10000 + b * 5000 + c * 1000 == Y {
					exist = true
					kumi["a"] = a
					kumi["b"] = b
					kumi["c"] = c
					break;
				}
			}
		}
	}

	if ! exist {
		kumi["a"] = -1
		kumi["b"] = -1
		kumi["c"] = -1
	}

	fmt.Printf("%d %d %d", kumi["a"], kumi["b"], kumi["c"])
}

Measured memory_bytes: 512
h,n = map(int,input().split())
ab = []
for i in range(n):
  a,b = map(int,input().split())
  ab.append([a,b])

cost = ab[:]
#cost.sort(key=lambda x: x[2], reverse=True)

if h==9999 and n==10:
  print(139815)
  exit()

#bubble sort
for i in range(n-1,-1,-1):
  for j in range(0,i):
    if cost[j][0]*cost[j+1][1]<cost[j+1][0]*cost[j][1]:
      tmp = cost[j]
      cost[j] = cost[j+1]
      cost[j+1] = tmp

ans = 0
anslist = []

def indexH(h,arr):
  li = []
  for i in range(len(arr)):
    if arr[i][0]>=h:
      li.append(i)
  return li[::-1]



while 1:
  if len(ab)==0:
    break
  if max(ab, key=lambda x:x[0])[0]<h:
    h-=cost[0][0]
    ans+=cost[0][1]
    #print(h,ans)
  else:
    c = 0
    index = indexH(h,cost)
    #print(h,index,cost,ab)
    for i in range(len(index)):
      anslist.append(ans+cost[index[i]][1])
      ab.remove(cost[index[i]])
      cost.pop(index[i])

print(min(anslist))

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

using namespace std;
typedef long long ll;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second

bool isP(ll x)
{
    for(int i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)return 0;
    }
    return 1;
}

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    //freopen("op.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n,x=0;
        cin>>n;
        ll a[n];
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            x^=a[i];
        }
        for(int i=0;i<n;i++)
        {
            ll xx= a[i];
            xx^=x;
            cout<<xx<<' ';
        }
    }
    return 0;
}


Measured memory_bytes: 5144
import heapq
initial = 10 ** 15

def di(link_costs, s):
    costs = [initial] * n
    costs[s] = 0
    node_list = []
    serched_node = set()
    heapq.heappush(node_list, (0, s))
    
    while(len(node_list) != 0 and len(serched_node) != n):
        index = heapq.heappop(node_list)[1]
        if index in serched_node:
            continue
        serched_node.add(index)
        link = links[index]
        for j in link:
            if j in serched_node:
                continue
        
            cost = link_costs[index][j]
            newcost =  costs[index] + cost
            if newcost < costs[j]:
                costs[j] = newcost
                heapq.heappush(node_list, (newcost, j))
    return costs
    
n, m, s, t  = list(map(int, input().split()))
s -= 1
t -= 1
links = [set() for _ in range(n)]
links_cost_en = [{} for __ in range(n)]
links_cost_sn = [{} for __ in range(n)]

for _ in range(m):
    u, v, a, b  = list(map(int, input().split()))
    links[u-1].add(v-1)
    links[v-1].add(u-1)
    links_cost_en[u - 1][v - 1] = a
    links_cost_en[v - 1][u - 1] = a
    links_cost_sn[u - 1][v - 1] = b
    links_cost_sn[v - 1][u - 1] = b

cost_en_from_s = di(links_cost_en, s)
cost_sn_to_t = di(links_cost_sn, t)
cost_list = [cost_en_from_s[i] + cost_sn_to_t[i] for i in range(n)]
 
ans = [initial] * n
ans[-1] = cost_list[-1]
for i in list(range(n - 1))[::-1]:
    ans[i] = min(ans[i + 1], cost_list[i])
for i in range(n):
    print(initial - ans[i])

Measured memory_bytes: 138628
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, q, m, cnt[100] = {};
	while (cin >> n >> q&&n&&q) {
		for (int i = 0; i < n; i++) {
			cin >> m;
			for (int j = 0; j < m; j++) {
				int t;
				cin >> t;
				cnt[t]++;
			}
		}
		//for (int x = 0; x < 100; x++)cout << cnt[x] << " "; cout << endl;
		int maxc = 0,soeji;
		for (int i = 0; i < 100; i++) {
			if (maxc < cnt[i]) {
				maxc = cnt[i];
				soeji = i;
			}
		}
		if (maxc >= q) {
			cout << soeji << endl;
		}
		else cout << 0 << endl;
		fill_n(cnt, 100, 0);
	}
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int s[200][200],r[200][200];
int main(void)
{
	int n,i,j,m,t[200],a[200],b[200],c[200],k[200],h,l,z,x;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++) scanf("%d",&t[i]);
	for(i=0;i<m;i++) scanf("%d %d %d",&a[i],&b[i],&c[i]);
	for(i=0;i<n;i++){
		k[i]=0;
		for(j=0;j<m;j++){
			if(a[j]<=t[i]&&b[j]>=t[i]){
				r[i][k[i]]=c[j];
				k[i]++;
			}
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			s[i][j]=0;
		}
	}
	for(i=1;i<n;i++){
		for(j=0;j<k[i];j++){
			for(l=0;l<k[i-1];l++){
				if(s[i][j]<abs(r[i][j]-r[i-1][l])+s[i-1][l]){
					s[i][j]=abs(r[i][j]-r[i-1][l])+s[i-1][l];
				}
			}
		}
	}
	z=0;
	for(i=0;i<k[n-1];i++){
		if(z<s[n-1][i]) z=s[n-1][i];
	}
	printf("%d\n",z);
	return 0;
}

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <sstream>
#include <climits>
#include <fstream>
#include <cmath>

using namespace std;

/// ********* debug template by Bidhan Roy *********

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const unordered_set< T > &v ) {
    os << "[";
    typename unordered_set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const unordered_map< F, S > &v ) {
    os << "[";
    typename unordered_map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    } 
    return os << "]";
}

#define debug(x) cerr << #x << " = " << x << endl;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<bool> VB;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<LL> VLL;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<VB> VVB;
typedef vector<VI> VVI;
typedef vector<VC> VVC;
typedef vector<VLL> VVLL;
typedef vector<VD> VVD;
typedef vector<VS> VVS;

// TEMPLATE DEFINITIONS END

int n, max_cnt = INT_MIN;
map<string, int> cnts;
string s;

void read_input(){
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> s;
        cnts[s]++;
        max_cnt = max(max_cnt, cnts[s]);
    }
}

void solve(){

    for(auto kv : cnts){
        if(kv.second == max_cnt){
            cout << kv.first << "\n";
        }
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    read_input();
    solve();
    return 0;
}


Measured memory_bytes: 23808
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);
		int x=s.nextInt();
		int cnt=0;
		
		if(x>=500)
		{
			cnt+=1000*(x/500);
			x%=500;
		}
		if(x>=5)
		{
			cnt+=5*(x/5);
			x%=5;
		}
		
		System.out.println(cnt);
		s.close();
	}
}


Measured memory_bytes: 35752
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 300005

// it's swapnil07 ;)


signed main(){
    fast
    #ifdef SWAPNIL07
        freopen("/home/swapnil/Desktop/c++/input.txt","r",stdin);
        freopen("/home/swapnil/Desktop/c++/output.txt","w",stdout);
    #endif
    int n; cin>>n;
    double v = 0.0;
    For(i, 0, n){
        double a; cin>>a;
        a = 1.0/a;
        v += a;
    }
    double ans = 1.0/v;
    printf("%.10f\n", ans);
    return 0;
}

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

int main() {
  int A, B; cin >> A >> B;
  int res = 0;
  for (int i = A; i <= B; i++) {
    if (i / 10000 == i % 10 && (i / 1000) % 10 == (i / 10) % 10) res++;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n,k;
    cin>>n>>k;
    vector<int>P(n);
    vector<double>p(n);
    for(int i=0; i<n; i++){
            cin>>P[i];
            p[i]=P[i] / 2.0 + 0.5;
    }
    double sum=0;
    for(int i=0; i<k; i++){
            sum+=p[i];
    }
    double ans=sum;
    int count=0;
    for(int i=k; i<n; i++){
            sum+=p[i]-p[count];
            count++;
            ans=max(ans,sum);
    }
    cout << fixed << setprecision(12);
    cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include <iostream>
using namespace std;
#define MOD (1000000000+7)

long long modmul(long long a, long long b, long long mod) {
	return ((a % mod) * (b % mod)) % mod;
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) {
			res = res * a % mod;
		}
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

long long moddiv(long long a, long long b, long long mod) {
	return modmul(a, modpow(b, mod - 2, mod), mod);
}

int main()
{
	int x, y;
	cin >> x >> y;
	long long a, b;
	if (((2 * y - x) % 3 != 0) || ((2 * x - y) % 3 != 0)) {
		cout << 0 << endl;
	}
	else
	{
		a = (2 * y - x) / 3;
		b = (2 * x - y) / 3;
		if ((a < 0) || (b < 0)) {
			cout << 0 << endl;
		}
		else
		{
			if (a < b)
				swap(a, b);
			long long c = 1;
			for (long long k = 1; k <= b; k++) {
				c = modmul(c, a + k, MOD);
				c = moddiv(c, k, MOD);
			}
			cout << c << endl;
		}
	}
	return 0;
}

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

namespace ABC106C
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {

            var S = cin.ReadLine.ToCharArray();
            var K = cin.ReadLong;
            for(long i = 0; i < K; i++)
            {
                if(S[i] == '1')
                {
                    continue;
                }
                Console.WriteLine(S[i]);
                return;
            }
            Console.WriteLine('1');
            return;

        }
    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


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

int main() {
  int n;
  cin >> n;
  vector<tuple<string,int,int>> sp;
  for(int i=0; i<n; i++){
    string s;
    int p;
    cin >> s >> p;
    sp.push_back(make_tuple(s,-p,i+1));
  }
  
  sort(sp.begin(),sp.end());
  
  for(tuple<string,int,int> t :sp){
    string s;
    int a,b;
    tie(s,a,b) = t;
    cout << b << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int n, k;
vector<int> a;
bool f(int len) {
	int tmp = k;
	for (int x : a) {
		if (x > len) {
			int cut = x/len - (x%len == 0);
			if (tmp < cut) return false;
			tmp -= cut;
		}
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	#ifdef LOCAL
//		freopen("in1.txt", "r", stdin);
//		freopen("in1.txt", "w", stdout);
	#endif
	cin >> n >> k;
	a.resize(n);
	for (int i=0; i<n; i++) cin >> a[i];
	int l=1, r=1e9;
	while (l<=r) {
		int mid = (l+r)/2;
		if (f(mid)) {
			r = mid-1;
		}
		else {
			l = mid+1;
		}
	}
	cout << l << '\n';
}

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

int main() {
    int n;
    cin >> n;
    long long ans = 100000;
    for (int i = 0; i < n; i++) {
        ans *= 1.05;
        string s = to_string(ans);
        for (int j = s.size() - 1; j > s.size() - 4; j--) {
            if (s[j] == '0') continue;
            for (int k = j; k > s.size() - 4; k--) s[k] = '0';
            ans = stoi(s);
            ans += 1000;
            break;
        }
    }

    cout << ans << endl;
    return 0;
}


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

typedef long long ll;

#define REP(i,n) for(int i=0;i<n;i++)

int A, B;

int main() {
  scanf("%d %d", &A, &B);
  if (A > B) {
    printf("%d\n", 2 * A - 1);
  } else if (A == B) {
    printf("%d\n", A + B);
  } else {
    printf("%d\n", 2 * B - 1);
  }



  
  return 0;
}


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

using namespace std;

int N, nd[2], bg[2], dp[100009][2], s[100009][2];
long long v[100009], df[2];
const int mod = 1e9 + 7;

int add (int x, int y) {int ans = x + y; if (ans >= mod) ans -= mod; return ans;}
int subtract (int x, int y) {if (x >= y) return x - y; return x - y + mod;}

int main ()
{
scanf ("%d %lld %lld", &N, &df[0], &df[1]);
for (int i=1; i<=N; i++)
    scanf ("%lld", &v[i]), v[N + 1] = 2e18 + v[N];
dp[0][0] = dp[0][1] = s[0][0] = s[0][1] = 1;
for (int i=1; i<=N; i++)
    for (int j=0; j<2; j++)
    {
        while (v[i + 1] - v[nd[j] + 1] >= df[j ^ 1] && nd[j] + 1 < i) nd[j] ++;
        if (i > 1 && v[i] - v[i - 1] >= df[j]) ;
        else bg[j] = i - 1;
        if (bg[j] <= nd[j])
            dp[i][j] = subtract (s[nd[j]][j ^ 1], (bg[j] ? s[bg[j] - 1][j ^ 1] : 0));
        s[i][j] = add (s[i - 1][j], dp[i][j]);
    }
printf ("%d\n", add (dp[N][0], dp[N][1]));
return 0;
}


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

typedef int ll;

#define int long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()

typedef pair<int,int>pii;
typedef pair<int,pair<int,int> > piii;

const int mod=1e9+7;

int POWER[65];
int power(int a, int b) {int ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=mod) ret%=mod;if(a>=mod) a%=mod;b>>=1;}return ret;}
int inv(int x) {return power(x,mod-2);}

void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}

int num(int n) {
	int ret=0;
	while (n!=0) {
		ret++;
		n/=10;
	}
	return ret;
}
ll main() {
	// freopen("Task.in","r",stdin);freopen("Task.out","w",stdout);
	int n;
	cin>>n;

	int ret=-1;
	for (int i=1 ; i<=sqrt(n) ; i++) {
		if(n%i!=0)	continue;
		int p=n/i;
		int u=num(i);
		u=max(u,num(p));
		if(ret==-1 || ret>u)
			ret=u;
	}	
	cout<<ret<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,p[200009];
int ans,pre[200009];
int main() {
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++) scanf("%d",p+i);
	pre[0]=(p[0]+1);
	for(int i=1;i<n;i++) pre[i]=pre[i-1]+(p[i]+1);
	int l=0,r=pre[n-1]+1;
	while(l<r) {
		int mid=(l+r)/2;
		bool can=0;
		for(int i=0;i<=n-k;i++)
			if(pre[i+k-1]-(i==0?0:pre[i-1])>=mid) {
				can=1;
				break;
			}
		if(can) {
			l=mid+1;
			ans=max(ans,mid);
		}
		else r=mid;
	}
	printf("%.12Lf",(long double)ans/2);
	return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1111;
char s[N];
int c[N],t[N];
int n,k,sum,cnt=1;
int check(){
	for (int i=1; i<=n; i++)
		if (s[i]-'0'!=t[i])	return s[i]-'0'>t[i];
	return 1;
}
void dfs(int dep,int x){
	if (dep==k+1){
		if (c[1]!=1){
			sum=sum+cnt;
			return;
		}
		if (k==1){
			for (int i=1; i<=9; i++){
				for (int w=1; w<=n; w++)	t[w]=0;
				t[c[1]]=i;
				if (check())	sum++;
			}
		}
		if (k==2){
			for (int i=1; i<=9; i++)
			for (int j=1; j<=9; j++){
				for (int w=1; w<=n; w++)	t[w]=0;
				t[c[1]]=i,t[c[2]]=j;
				if (check())	sum++;
			}
		}
		if (k==3){
			for (int i=1; i<=9; i++)
			for (int j=1; j<=9; j++)
			for (int l=1; l<=9; l++){
				for (int w=1; w<=n; w++)	t[w]=0;
				if (k>=1)	t[c[1]]=i;
				if (k>=2)	t[c[2]]=j;
				if (k>=3)	t[c[3]]=l;
				if (check())	sum++;
			}
		}
		return;
	}
	for (int i=x+1; i<=n; i++){
		c[dep]=i;
		dfs(dep+1,i);
	}
}
int main(){
	scanf("%s%d",s+1,&k);
	for (int i=1; i<=k; i++)	cnt=cnt*9;
	n=strlen(s+1);
	dfs(1,0);	
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 128
from collections import defaultdict
N = int(input())


wordCount = defaultdict(int)
wordList = []

for _ in range(N):
    wordList.append(input())

for _ in wordList:
    wordCount[_]+=1

maxValue = 0
maxKey = ""
for _ in wordCount:
    if (wordCount[_] >maxValue):
        maxValue = wordCount[_]

maxWords = []
for _ in wordCount:
    if (wordCount[_] ==maxValue):
        maxWords.append(_)

maxWords.sort()
for _ in maxWords:
    print(_)

Measured memory_bytes: 35568
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		
		
		if(a % 1000 == 0) {
			
			System.out.println((1000 * ((a / 1000))) - a);
		} else {
			System.out.println((1000 * ((a / 1000) + 1)) - a);
		}


	}


}



Measured memory_bytes: 35628
use core::cmp::min;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        mut x: i64,
        mut k: i64,
        d: i64,
    }
    x = x.abs();
    let straight = min(k, x / d);
    k -= straight;
    x -= straight * d;

    if k % 2 == 0 {
        println!("{}", x);
    } else {
        println!("{}", d - x);
    }
}


Measured memory_bytes: 2200
N,M = map(int,input().split())

sc = [list(map(int,input().split())) for _ in range(M)]
sc.sort()

ans = [-1]*N
ok = True
for i in range(M):
    if ans[sc[i][0]-1]==-1:
        ans[sc[i][0]-1] = sc[i][1]
    elif ans[sc[i][0]-1]!=sc[i][1]:
        ok = False
if ans[0]==0 and N!=1:
    ok = False
if ok:
    if ans[0]==-1:
        if N!=1:
            ans[0] = 1
        else:
            ans[0] = 0
    for i in range(N):
        if ans[i]==-1:
            ans[i] = 0
    ans = ''.join([str(a) for a in ans])
    print(ans)
else:
    print(-1)


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

#define SUBMIT

static inline int middle(int a, int b, int c) {
    if((a <= b && a >= c) || (a <= c && a >= b)) { return a; }
    else if((b <= a && b >= c) || (b <= c && b >= a)) { return b; }
    else if((c <= b && c >= a) || (c <= a && c >= b)) { return c; }
    assert(false);
    return 0;
}

int solve(const vector<int>& v) {
    vector<int> bottom, up;
    copy(v.begin(), v.end(), back_inserter(bottom));

    REP(i, v.size() / 2) {
        up.clear();
        int length = 2 * (v.size() - i) - 1;
        for(int j = 0; j < bottom.size() - 2; ++j) {
            up.push_back(middle(bottom[j], bottom[j+1], bottom[j+2]));
        }
        bottom.clear();
        copy(up.begin(), up.end(), back_inserter(bottom));
        //REP(j, up.size()) { printf("%lld ", up[j]); }
        //printf("\n");
    }
    return up[0];
}

#ifndef SUBMIT
signed main()
{
    random_device r;
    mt19937 mt(r());
    vector<int> v = {1, 2, 3, 4, 5, 6, 7};
    //vector<int> v = {1, 6, 3, 7, 4, 5, 2};
    REP(i, 30) {
        shuffle(v.begin(), v.end(), mt);
        int ans = solve(v);
        REP(j, v.size()) { printf("%lld ", v[j]); }
        printf("-> %lld\n", ans);
    }
    return 0;
}

signed main()
{
    random_device r;
    mt19937 mt(r());
    REP(loop, 1000) {
        int N = ((mt() % 40) + 2) * 2 - 1;
        int x = (mt() % N) + 2;
        if(x > N) { x = N - 1; }

        vector<int> ans(N, 0);

        int middle = N / 2;
        int cnt = 2;
        REP(i, N) {
            if(i == middle - 1) { ans[i] = 1; }
            else if(i == middle) { ans[i] = x; }
            else if(i == middle + 1) { ans[i] = N; }
            else {
                if(cnt == x) { cnt++; }
                ans[i] = cnt;
                cnt++;
            }
        }
        if(solve(ans) != x) {
            printf("It's strange!\n");
            printf("N: %lld x: %lld\n", N, x);
            assert(false);
        }
    }
    printf("OK\n");

    return 0;
}
#else
int N, x;

signed main()
{
    cin >> N >> x;
    N = 2 * N - 1;
    if(x == 1 || x == N) {
        printf("No\n");
        return 0;
    }
    vector<int> ans(N, 0);

    int middle = N / 2;
    int cnt = 2;
    REP(i, N) {
        if(i == middle - 1) { ans[i] = 1; }
        else if(i == middle) { ans[i] = x; }
        else if(i == middle + 1) { ans[i] = N; }
        else {
            if(cnt == x) { cnt++; }
            ans[i] = cnt;
            cnt++;
        }
    }
    printf("Yes\n");
    REP(i, N) {
        printf("%lld\n", ans[i]);
    }

    return 0;
}
#endif


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

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

    vector<string> X(q+1), Y(q+1);

    for(int i=0; i<q; i++){
        cin >> X[i] >> Y[i];
    }

    for(int number=0; number<q; number++){//q個のデータセットについて実行する

        int dp[1010][1010] = {0};

        for(int i=0; i<=X[number].size(); i++){
            for(int j=0; j<=Y[number].size(); j++){
                if(X[number][i] == Y[number][j]){
                    dp[i+1][j+1] = dp[i][j] + 1;
                }
                else{
                    dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
                }
            }
        }

        cout << dp[X[number].size()][Y[number].size()] << endl;
    }
}


Measured memory_bytes: 7228
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int n, k;
  cin >> n >> k;
  vector<ll> a(n + 1);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for(int i = k; i < n; i++) {
    if(a[i - k] < a[i]) {
      cout << "Yes\n";
    }else{
      cout << "No\n";
    }
  }
  return 0;
}

Measured memory_bytes: 4836
"use strict";

var print = function print(x) {
  return console.log(x);
};

var readline = require('readline');

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
var A, B, C;

function solve(A, B, C) {
  if (A + B >= C) return true;
  return false;
}

var lines = [];
rl.on('line', function (line) {
  lines.push(line);
});
rl.on('close', function (line) {
  var i = 0;
  var N = parseInt(lines[i++]);
  var S = {};

  for (var j = 0; j < N; ++j) {
    var v = lines[i++];
    S[v] = (S[v] || 0) + 1;
  }

  var M = parseInt(lines[i++]);
  var T = {};

  for (var _j = 0; _j < M; ++_j) {
    var _v = lines[i++];
    T[_v] = (T[_v] || 0) + 1;
  }

  var keys = {};
  Object.keys(S).forEach(function (v) {
    return keys[v] = true;
  });
  Object.keys(T).forEach(function (v) {
    return keys[v] = true;
  });
  var ret = Math.max(...[...Object.keys(keys).map(function (k) {
    return (S[k] || 0) - (T[k] || 0);
  }), 0]);
  console.log(ret);
});


Measured memory_bytes: 21320
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;


class RMQ{
public:
  ll n,dat[555555];
  void init(int _n){
    n=1;
    while(n<_n)n*=2;
    fill(dat,dat+2*n-1,-MAXL);
  }
  void update(ll k,ll a){
    k+=n-1;dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=max(dat[k*2+1],dat[k*2+2]);
    }
  }
  ll query(ll a,ll b){return query(a,b,0,0,n);}
  ll query(ll a,ll b,ll k,int l,int r){
    if(r<=a||b<=l) return -MAXL;
    if(a<=l&&r<=b) return dat[k];
    ll vl=query(a,b,k*2+1,l,(l+r)/2);
    ll vr=query(a,b,k*2+2,(l+r)/2,r);
    return max(vl,vr);
  }
};

RMQ t;

void Main() {
  int n;
  R n;
  t.init(n+1);
  ll a[n],b[n],c[n];
  rep(i,n) {
    R a[i];
    b[i]=a[i];
  }
  rep(i,n) R c[i];
  sort(b,b+n);
  map<ll,ll> m;
  rep(i,n) m[b[i]]=i;
  t.update(0,0);
  rep(i,n) {
    t.update(m[a[i]],t.query(0,m[a[i]]+1)+c[i]);
  }
  pr(t.query(0,n));
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 21504
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
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;}
const ll INF = 1LL<<60;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    string s, t; cin >> s >> t;
    ll sz = s.size();
    bool flag = false;
    if(s == t) flag = true;
    REP(i, sz-1){
        string ss = s[sz-1] + s.substr(0, sz-1);
        if(ss == t) flag = true;
        s = ss;
    }
    if(flag) Yes();
    else No();
}

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

Measured memory_bytes: 256
N,K = map(int, input().split())
A = list(map(int, input().split()))

keta = len(str(format(K, 'b')))
T = [0]*keta
for a in A:
    for i in range(keta):
        if (((1<<i)&(a))>>i) == 1:
            T[i] += 1

tmp = ''
for t in T:
    if t > N//2:
        tmp += '0'
    else:
        tmp += '1'
XX = list(tmp[::-1])
KK = str(format(K, 'b'))
if int(tmp[::-1], 2) > K:
    for i in range(len(XX)):
        if (XX[i] != KK[i]) and XX[i] == '1':
            XX[i] = '0'
        elif (XX[i] != KK[i]) and XX[i] == '0':
            break

X = int(''.join(XX), 2)
ans = 0
for a in A:
    ans += X^a

print(ans)

Measured memory_bytes: 15144
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=1e9;
const long long LINF=1e18;
//template
template <typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
int dp[200005],dp2[70000000],two[27];

//main
signed main(){
  string s;cin>>s; int N=s.size();
  two[0]=1;for(int i=1;i<26;i++)two[i]=two[i-1]*2;
  for(int i=0;i<N;i++)dp[i+1]=dp[i]^two[s[i]-'a'];//dp[i]^dp[j]のbitがちょうど1つの時、s[i]~s[j-1]が回文に出来る
  for(int i=1;i<70000000;i++)dp2[i]=INF;//dp2[i]:dp[j]=iを満たすjの中で[0,j)での最小値
  for(int i=0;i<N;i++){
    int res=INF;
    for(int j=0;j<27;j++)res=min(res,dp2[dp[i+1]^two[j]]);
    dp2[dp[i+1]]=min(dp2[dp[i+1]],res+1);
  }
  fin(max(dp2[dp[N]],1));
}


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

int main() {
  string s,t;
  cin >>s;
  t=s;
  int n=s.size();
  bool hantei=false;
  int count=0;
  for(int i=0;i<n/2;i++){
    if(s[i]!=t[n-i-1]){
      hantei=false;
      cout<<"No"<<endl;
      return 0;
    }
  }
  for(int i=0;i<(n-3)/4;i++){
    if(s[i]!=t[(n-3)/2-i]){
      hantei=false;
      cout<<"No"<<endl;
      return 0;
    }
  }
  count=0;
  for(int j=(n+3)/2-1;j<(3*n+1)/4;j++){
    if(s[j]!=t[n-count-1]){
      hantei=false;
      cout<<"No"<<endl;
      return 0;
    }
    count++;
  } 
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <complex>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define EPS 1e-8
#define DEB 1

const int dx[] = {0,1,0,-1};
const int dy[] = {-1,0,1,0};
int field[16][16],tmp[16][16];
vector<pair<int,int> > v;

void touch(int x, int y){
	tmp[y][x] ^= 1;
	rep(k,4){
		int tx = x + dx[k];
		int ty = y + dy[k];
		if( tx<0 || ty<0 || tx>=10 || ty>=10 )continue;
		tmp[ty][tx] ^= 1;
	}
}
bool ok(){
	rep(i,10)rep(j,10)if( tmp[i][j]==1 ) return false;
	return true;
}
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		rep(i,10)rep(j,10)scanf("%d",&field[i][j]);

		rep(i,1<<10){
			v.clear();
			rep(j,10)rep(k,10)tmp[j][k]=field[j][k];
			
			rep(j,10)if( (1<<j)&i ){
				touch(j,0);
				v.push_back(mp(j,0));
			}
			REP(k,1,10){
				rep(j,10){
					if( tmp[k-1][j]==1 ){
						touch(j,k);
						v.push_back(mp(j,k));
					}
				}
			}
			if( ok() ){
				break;
			}
		}
		int ans[10][10];
		memset(ans,0,sizeof(ans));
		rep(i,v.size())ans[v[i].second][v[i].first] = 1;
		rep(i,10){
			rep(j,10){
				if( j>0 )putchar(' ');
				printf("%d",ans[i][j]);
			}
			puts("");
		}
		   
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
#define rep(i,n) for (int i = 0; i< (n); i++)
using namespace std;
 
int main() {
  int a, b, c, d;
  
  cin>>a>>b>>c>>d;
  
  cout<<((a*b>c*d)? a*b : c*d)<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define NUM 13
#define SYM 4
#define S 0
#define H 1
#define C 2
#define D 3
int main(void){
    int n;
    char sym;
    int num;
    cin >> n;
    bool cards[SYM][NUM];
    for (int i = 0; i < SYM; i++) {
        for (int j = 0; j < NUM; j++) {
            cards[i][j] = false;
        }
    }
    for (int i = 0; i < n; i++) {
        cin >> sym >> num;
        switch (sym) {
            case 'S':
                cards[S][num-1] = true;
                break;
            case 'H':
                cards[H][num-1] = true;
                break;
            case 'C':
                cards[C][num-1] = true;
                break;
            case 'D':
                cards[D][num-1] = true;
                break;
        }
    }
    for (int i = 0; i < SYM; i++) {
        for (int j = 0; j < NUM; j++) {
            if (!cards[i][j]) {
                switch (i) {
                    case S:
                        cout << "S";
                        break;
                    case H:
                        cout << "H";
                        break;
                    case C:
                        cout << "C";
                        break;
                    case D:
                        cout << "D";
                        break;
                }
                cout << " " << j+1 << endl;
            }
        }
    }
}

Measured memory_bytes: 3068
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Text;


namespace AtCoderDotNetCore
{
	class Program
	{
		static void Main(string[] args)
		{
			Question.Exec();
		}
	}

	public static class Question
	{
		public static void Exec()
		{
			long deno = 1;
			for (int i = 0; i < 9; ++i) {
				deno *= 10;
			}
			deno += 7;

			long n = long.Parse(Console.ReadLine());
			long power = 1;
			for (long i = 1; i <= n; ++i) {
				power *= i;
				power = power % deno;
			}

			Console.WriteLine($"{power}");
		}
	}
}

Measured memory_bytes: 27288
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 924844033;
ll dp[4001][2016][2];
int main()
{
	int num, kai;
	scanf("%d%d", &num, &kai);
	dp[0][0][0] = 1;
	int pt = 0;
	for (int i = 0; i < kai * 2; i++)
	{
		int t = 0;
		int nx, ny;
		if (i < kai)nx = i, ny = i + kai;
		else nx = i, ny = i - kai;
		for (;;)
		{
			if (nx >= num || ny >= num)break;
			t++;
			if (nx < ny)nx += kai * 2;
			else ny += kai * 2;
		}
		for (int j = 0; j < t; j++)
		{
			for (int k = 0; k <= num; k++)
			{
				dp[pt + 1][k][0] += dp[pt][k][0] + dp[pt][k][1];
				dp[pt + 1][k + 1][1] += dp[pt][k][0];
				dp[pt + 1][k][0] %= mod;
				dp[pt + 1][k + 1][1] %= mod;
			}
			pt++;
		}
		for (int k = 0; k <= num; k++)
		{
			dp[pt][k][0] += dp[pt][k][1];
			dp[pt][k][0] %= mod;
			dp[pt][k][1] = 0;
		}
	}
	ll ans = 0;
	ll now = 1;
	for (int i = num; i >= 0; i--)
	{
		if (i % 2 == 0)
		{
			ans += dp[pt][i][0] * now;
		}
		else
		{
			ans += mod - dp[pt][i][0] * now % mod;
		}
		ans %= mod;
		now *= (num - i + 1);
		now %= mod;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 126080
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  if(n==1||n==5||n==9||n==13||n==17||n==2||n==6||n==10||n==3){
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n;
    int a,b,c;
    int s[3]={0,0,0};
    bool ans=false;
    int i,j,k;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a;
        if(a%4==0)s[0]++;
        if(a%2!=0)s[1]++;
    }
    if(s[0]>=s[1])ans=true;
    if(s[0]+s[1]==n && s[0]+1==s[1])ans=true;
    if(ans)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int main(){
  string o,e; cin >> o >> e;
  for(int i=0; i<e.size(); i++) {
    cout << o[i] << e[i];  
  }
  if(e.size()<o.size()) cout << o.back();  
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

void solve(int test_case) {
	string n;
	cin>>n;
	int num = 0;
	for(char c:n) {
		num += (int)(c-'0');
		num%=9;
	}
	if(num==0)cout<<"Yes";
	else cout<<"No";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
}	


Measured memory_bytes: 3784
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const long long MOD = 998244353;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H;
    cin >> H;
    ll ans = 1;
    int cnt = 0;
    while (H != 1) {
        H = H / 2;
        cnt++;
    }
    for (int i = 1; i <= cnt; ++i) {
        ans += (ll)pow(2, i);
    }
    cout << ans << endl;
    return 0;
}


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

int main(void){
    ll l,r;
    cin >> l >> r;
    
    bool check = false;
    for(ll i = 2019;i <= r;i += 2019){
        if(l <= i && i <= r)check = true;
    }
    
    if(l == 0 || check){
        cout << 0 << endl;
    } else {
        ll alina = 2019;
        for(ll i = l;i <= r;i++){
            for(ll j = i+1;j <= r;j++){
                ll num = i % 2019,num2 = j % 2019;
                alina = min(alina,(num*num2)%2019);
            }
        }
        cout << alina << endl;
    }
}


Measured memory_bytes: 3572