akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <bitset>
#include <functional>
#include <tuple>
#include <complex>
#include <chrono>
#include <climits>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef unsigned int uint;
typedef unsigned long long ull;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
// default_random_engine generator;
// mt19937 rnd(1);


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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


    int n;
    ll x;
    cin >> n >> x;

    vector<ll> b(n), l(n), r(n);

    for (int i = 0; i < n; ++i) {
        cin >> b[i] >> l[i] >> r[i];
    }

    vector<pll> score(n);

    ll init = 0;
    for (int i = 0; i < n; ++i) {
        // cout << b[i] * l[i] + (x - b[i]) * r[i] << endl;
        score[i] = {b[i] * l[i] + (x - b[i]) * r[i], i};
        init += b[i] * l[i];
    }

    sort(all(score));
    reverse(all(score));

    // for (int i = 0; i < n; ++i) {
    //     cout << score[i].first << " " << score[i].second << endl;
    // }

    ll lf = -1, rg = x * n;


    while (rg - lf > 1) {
        ll mid = (lf + rg) / 2;

        vector<int> used(n);

        ll cnt = mid / x;
        ll rem = mid % x;

        ll res = 0;

        for (int i = 0; i <= cnt; ++i) {
            used[score[i].second] = 1;
            res += score[i].first;
        }

        bool ok = false;
        for (int i = 0; i < n; ++i) {
            ll cur = min(rem, b[i]) * l[i] + max(rem - b[i], 0ll) * r[i]; 
            // cout << cur << endl;
            cur += res;
            // cout << cur << endl;
            // cout << cnt << " " << rem << endl;

            if (used[i]) {
                cur -= b[i] * l[i] + (x - b[i]) * r[i];
            } else {
                int j = score[cnt].second;
                cur -= b[j] * l[j] + (x - b[j]) * r[j];
            }

            if (cur >= init) {
                ok = true;
            }

            // cout << cur << " " << init << endl;
        }

        if (ok) {
            rg = mid;
        } else {
            lf = mid;
        }
    }

    cout << rg << endl;


}   




Measured memory_bytes: 4608
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 998244353;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL A, B;
	cin >> A >> B;
	if (A + B == 15)cout << "+\n";
	else if (A * B == 15)cout << "*\n";
	else cout << "x\n";
	return 0;
}


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

int main(void){
	int n;
	int room[4][3][10];

	for(int i=0; i<4; i++){
		for(int j=0; j<3; j++){
			for(int k=0; k<10; k++){
				room[i][j][k] = 0;
			}
		}
	}
	
	cin >> n;
	for(int i=0; i<n; i++){
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		room[b-1][f-1][r-1] += v;
	}


	for(int i=0; i<4; i++){
		for(int j=0; j<3; j++){
			for(int k=0; k<10; k++){
				printf(" %d", room[i][j][k]);
			}
			puts("");
		}
		if(i!=3)printf("####################\n");
	}

	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
#define _GLIBCXX_DEBUG
using namespace std;

int main(){
  int64_t n,m,q;
  cin >> n >> m >> q;
  vector<vector<int64_t>> mtx(n+1,vector<int64_t>(n+1));
  int64_t l,r;
  rep(i,m){
    cin >> l >> r;
    mtx[l][r]++;
  }
  rep(i,n){
    rep(j,n){
      mtx[i][j+1] += mtx[i][j];
    }
  }
  /*rep(i,n+1){
    rep(j,n+1){
      printf("%ld ",mtx[i][j]);
    }
    cout << endl;
  }*/
  rep(i,q){
    int64_t ql,qr;
    cin >> ql >> qr;
    int64_t total = 0;
    for(int j=ql;j <= qr;j++){
      total += mtx[j][qr]-mtx[j][ql-1];
    }
    cout << total << endl;
  }

      
    
    
    
    

  
  
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b(n);

  for(ll i=0;i<n;i++) {
    cin >> a[i];
  }
  for(ll i=0;i<n;i++) {
    cin >> b[i];
  }

  ll c=0;
  for(ll i=0;i<n;i++) {
    if(a[i]<b[i]) {
      c+=(b[i]-a[i]+1)/2;
      a[i]+=(b[i]-a[i]+1)/2*2;
    }
    if(a[i]>b[i]) {
      c-=a[i]-b[i];
      b[i]=a[i];
    }
  }
  if(c>=0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

using namespace std;

int main(){
    int a,b;

    cin >> a; cin >> b;

    vector<string> vec(a);

   for(int i = 0; i < a; i++){
       cin >> vec.at(i);
   }

    for(int j = 0; j < b+2; j++){
                cout << "#";
            }
            cout << endl;

    for(int i = 0;i < a; i++){

        cout << "#" << vec.at(i) << "#";
        cout << endl;
        
    }

     for(int j = 0; j < b+2; j++){
                cout << "#";
            }
            cout << endl;

    return 0;
}



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

int main() {
    ll n;
    std::cin >> n;
    vector<vector<ll>> edges(n);
    map<pair<ll,ll>,bool> used;
    vector<ll> val(n);
    vector<ll> arc(n);
    for (int i = 0; i < n-1; i++) {
        ll a,b;
        std::cin >> a>>b;
        a--;
        b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
        val[a]++;
        val[b]++;
    }
    
    vector<ll> c(n);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> c[i];
        sum += c[i];
    }
    sort(c.begin(),c.end(),greater<ll>());
    sum -= c[0];
    
    set<ll> s;
    s.insert(0);
    
    vector<ll> result(n);
    ll in = 0;
    result[0] = c[0];
    result[edges[0][0]] = c[1];
    used[{0,edges[0][0]}] = true;
    used[{edges[0][0],0}] = true;
    in = 2;
    s.insert(edges[0][0]);
    
    
    while(s.size()!=n){
        for (auto e : s) {
            if(val[e]==0)continue;
            for (int i = 0; i < edges[e].size(); i++) {
                if(used[{e,edges[e][i]}])continue;
                result[edges[e][i]] = c[in];
                in++;
                s.insert(edges[e][i]);
                used[{e,edges[e][i]}] = true;
                used[{edges[e][i],e}] = true;
                val[e]--;
                val[edges[e][i]]--;
            }
        }
    }
    std::cout << sum << std::endl;
    if(n==1){
        std::cout << result[0] << std::endl;
    }else{
        for (int i = 0; i < n-1; i++) {
            std::cout << result[i]<<" ";
        }
        std::cout << result[n-1] << std::endl;
    }
}


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

int main()
{
    ll x, k, d, ans, min = 0;
    cin >> x >> k >> d;
    if (x < 0)
    {
        min = 1;
        x = llabs(x);
    }

    if (k < x / d)
    {
        ans = x - d * k;
    }
    else
    {
        k -= x / d;
        if (k % 2 == 0)
            ans = x - x / d * d;
        else
            ans = x - (x / d + 1) * d;
    }

    ans = llabs(ans);

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

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    int x;
    cin >>x;

    int k=1;
    while(1){

        ll s=k*(k+1)/2;
        ll l=(k+1)*(k+2)/2;
        if(s<=x && l>x){
            if(s == x)--k;
            break;
        }
        ++k;
    }
    //cout <<fixed<<setprecision(16)<< << endl;
    cout<<k+1<<endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, r[200000], Max = -2000000000, Min;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> r[i];
  }
  Min = r[0];
  for (int i = 1; i < n; i++) {
    Max = max(r[i] - Min, Max);
    Min = min(r[i], Min);
  }
  cout << Max << '\n';
  return 0;
}



Measured memory_bytes: 3932
#include <iostream>
using namespace std;
//C - Strange Bank
int main(void){
    int n;
    std::cin >> n;
    int ans=n;
    for (int i = 0; i <= n; i++) {
        int c=0;
        int t=i;
        while(t>0){c+=t%6;t/=6;}
        t=n-i;
        while(t>0){c+=t%9;t/=9;}
        if(ans>c)ans=c;
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    long long int x, t, r;
    scanf("%lld %lld", &x, &t);

    if(x>t)
    {
        r = x-t;
        printf("%lld", r);
    }
    else
    {
        r = 0;
        printf("%lld", r);
    }

    return 0;
}


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



int main() {
int a,b,c;
cin>>a>>b>>c;
a*=10;
a+=b;
a*=10;
a+=c;
if(a%4==0)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint         = long long;
constexpr lint inf = 1LL << 60;
constexpr lint mod = 1000000007;

struct Timer {
    chrono::system_clock::time_point start;
    int ms;
    Timer(int ms) : start(chrono::system_clock::now()), ms(ms) {}
    bool stop() {
        chrono::system_clock::time_point curr = chrono::system_clock::now();
        double t = static_cast<double>(chrono::duration_cast<chrono::microseconds>(curr - start).count() / 1000.0);
        return t > ms;
    }
};

using ulint = unsigned long long;
struct RandomNumberGenerator {
    mt19937_64 mt;
    RandomNumberGenerator() : mt(chrono::steady_clock::now().time_since_epoch().count()) {}
    ulint operator()(ulint a, ulint b) { // [a, b)
        uniform_int_distribution<ulint> dist(a, b - 1);
        return dist(mt);
    }
    ulint operator()(ulint b) { // [0, b)
        return (*this)(0, b);
    }
    ulint operator()() { return mt(); }
};

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

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

    Timer t(1950);
    RandomNumberGenerator r;

    int d;
    cin >> d;
    vector<lint> c(26);
    for (int i = 0; i < 26; ++i) {
        cin >> c[i];
    }
    vector<vector<lint>> s(d, vector<lint>(26));
    for (int i = 0; i < d; ++i) {
        for (int j = 0; j < 26; ++j) {
            cin >> s[i][j];
        }
    }
    vector<lint> ret(d, -1);
    vector<lint> mx(d, -1);
    for (int i = 0; i < d; ++i) {
        for (int j = 0; j < 26; ++j) {
            if (chmax(mx[i], s[i][j]))
                ret[i] = j;
        }
    }
    lint score = 0;
    vector<lint> last(26, 0);
    for (int i = 0; i < d; ++i) {
        score += s[i][ret[i]];
        lint sub = 0;
        for (int j = 0; j < 26; ++j) {
            score -= (i + 1 - last[j]);
        }
        score -= c[i] * sub;
    }
    cerr << score << endl;

    while (!t.stop()) {
        for (int i = 0; i < 100; ++i) {
            int idx  = r(d);
            int curr = ret[idx];
            int newr = r(26);
            if (curr == newr)
                continue;
            ret[idx]    = newr;
            lint nscore = 0;
            vector<lint> last(26, 0);
            for (int i = 0; i < d; ++i) {
                nscore += s[i][ret[i]];
                lint sub = 0;
                for (int j = 0; j < 26; ++j) {
                    nscore -= (i + 1 - last[j]);
                }
                nscore -= c[i] * sub;
            }
            cerr << nscore << "\n";
            if (nscore < score) // revert
                ret[idx] = curr;
            else
                score = nscore;
        }
    }

    for (int i = 0; i < d; ++i) {
        cout << ret[i] + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 3760
n = int(input())
for i in range(3,n + 1):
    if(i % 3 == 0):
        print('',i,end = '')
    elif(i >= 10 and i % 10 == 3):
        print('',i,end = '')
    elif(i > 10):
        x = i
        while(x > 0):
            x = int(x / 10)
            if(x % 10 == 3):
                print('',i,end = '')
                break
print('')

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

using namespace std;

#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define sz size()
#define For(i, st, en) for(int i=(st); i<=(int)(en); i++)
#define Ford(i, st, en) for(int i=(st); i>=(int)(en); i--)
#define forn(i, n) for(int i=0; i<(int)(n); i++)
#define ford(i, n) for(int i=(n)-1; i>=0; i--)
#define fori(it, x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)

#ifdef ROOM_311
__attribute__((destructor)) void fini_main()
{
	fprintf(stderr, "Execution time = %0.0lf ms\n", clock() * 1000.0 / CLOCKS_PER_SEC);
}
#endif

#define MY_RAND 1
#if MY_RAND
uint64_t rnd_data = 0xDEADBEEFDULL;
inline void my_srand(int seed) { rnd_data = ((uint64_t)seed << 16) | 0x330E; }
inline int my_rand() { rnd_data = rnd_data * 0x5DEECE66DULL + 0xB; return (rnd_data >> 17) & 0x7FFFFFFF; }
#define rand my_rand
#define srand my_srand
template <typename T> void my_random_shuffle(T b, T e) { for(ssize_t i = 1; i < (e - b); i++) { swap(b[i], b[rand() % (i + 1)]); } }
#define random_shuffle my_random_shuffle
#endif

template <class _T> inline _T sqr(const _T &x) { return x * x; }

// Types
typedef long double ld;
typedef long long i64;
typedef __int128 i128;
typedef unsigned long long u64;
typedef set < int > SI;
typedef vector < int > VI;
typedef map < string, int > MSI;
typedef pair < int, int > PII;

// Constants
const ld PI = 3.1415926535897932384626433832795;
const ld EPS = 1e-9;

const int MAXN = 2000;
const int MAXV = 2000;

int n;
bitset<MAXV * MAXN + 1> d;

int main()
{
#ifdef ROOM_311
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	cout << setiosflags(ios::fixed) << setprecision(10);
	
	scanf("%d", &n);
	d.set(0);
	int sum = 0;
	forn(i, n)
	{
		int x;
		scanf("%d", &x);
		sum += x;
		d |= d << x;
	}
	int mid = (sum + 1) / 2;
	For(i, mid, sum)
	{
		if (d.test(i))
		{
			printf("%d\n", i);
			return 0;
		}
	}
	
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)

const ll mod = 1000000007;
const ll maxn = (ll)2e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};

void solve(){
	
	ll a,b,n;
	cin >> a >> b >> n;
	ll x = min(b-1 , n);
	cout << ((a*x)/b ) - (a*(x/b) );
	return;
}


int main() {
   
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
    //cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    	//printf("Case %lld: ",++CT);
		solve();
	}
    
    return 0;
}


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


const int maxn = 1e5+1000;

char s[maxn];


int main()
{
    //freopen("./test.txt","r",stdin);
    scanf("%s",s);
    int len = strlen(s);
    int cntg = 0,cntp = 0;
    int res = 0;
    for(int i = 0;i < len;++i)
    {

        if(cntp < cntg)
        {
            cntp++;
            if(s[i] == 'g')
                res++;
        }
        else
        {
            cntg++;
            if(s[i] == 'p')
                res--;
        }
    }
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS

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

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { D, R, U, L , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }
bool cklex(string &a, string b) {
	if (b == "") return false;
	if (a == "") return a = b, true;
	if (sz(a) < sz(b)) return false;
	if (sz(b) < sz(a)) return a = b, true;
	if (a < b) return false;
	return a = b, true;
}

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; } //convert index from 2D array to 1D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) { return{ n / nCol, n % nCol }; } //convert index from 1D array to 2D array (row, col). (Zero-indexed)
template<typename T> void inter(T X) { cout << X << endl; fflush(stdout); }



void _solve_() {
	int n;
	cin >> n;
	vector<pair<ll,ll>> v(n);
	cin >> v[0].first >> v[0].second;
	ll mxS = v[0].first + v[0].second;
	ll mnS = mxS;
	ll mxM = v[0].first - v[0].second;
	ll mnM = mxM;
	loop(i, 1, n) cin >> v[i].first >> v[i].second, ckmax(mxS, v[i].first + v[i].s), ckmin(mnS, v[i].first + v[i].s), ckmax(mxM, v[i].first - v[i].s), ckmin(mnM, v[i].first - v[i].s);
	cout << max(mxS - mnS, mxM - mnM) << endl;

}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int t = 1, tt = 0;
	//cin >> t;
	while (tt++ != t) {
		_solve_();
	}


	return 0;
}


Measured memory_bytes: 6352
s = int(input())

a = [10 ** 10]
i = 1
temp = 10 ** 10
while True:
    if i == 1:
        temp = s
    elif a[i - 1] % 2 == 0:
        temp = a[i - 1] // 2
    else:
        temp = 3 * a[i - 1] + 1

    if temp in a:
        print(i)
        exit()
    a.append(temp)
    i += 1


Measured memory_bytes: 3060
import sys
input = sys.stdin.readline

s=input()
l=[]
count=0
for i in range(4):
    for j in range(4):
        if s[i]==s[j]:
            count+=1
    l.append(count)
    count=0

l=set(l)
if len(l)==1 and l=={2}:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <stdio.h>
#include <math.h>

int main(void){
  int N;
  int T;
  int A;
  int H[1000];
  double  min;
  double buf;
  int i, j;

  scanf("%d", &N);
  scanf("%d %d", &T, &A);
  for(i = 0; i < N; i++){
    scanf("%d", &H[i]);
  }

  min = fabs((((double) T) - ((double) H[0])*0.006) - A);
  for(i = 1; i < N; i++){
    buf = fabs((((double) T) - ((double) H[i])*0.006) - A);
    if(buf < min){
      min = buf;
    }
  }

  for(i = 0; i < N; i++){
    buf = fabs((((double) T) - ((double) H[i])*0.006) - A);
    if(buf == min){
      printf("%d\n", i+1);
      break;
    }
  }

  return 0;
}


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

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value


void solve() {

    int X = in();

	if(X == 3 || X == 5 || X == 7){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(X: int, Y: int, Z: int):
    print((X-Z)//(Y+Z))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    Z = int(next(tokens))  # type: int
    solve(X, Y, Z)

if __name__ == '__main__':
    main()


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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');

        var heightDict = new Dictionary<int, int>();
        var loadDict = new Dictionary<int, HashSet<int>>();

        var towerNum = int.Parse(input[0]);
        var loadNum = int.Parse(input[1]);

        var input2 = Console.ReadLine().Split(' ');
        var i = 1;
        foreach(var n in input2)
        {
            heightDict.Add(i, int.Parse(n));
            i++;
        }

        for (var j = 0; j < loadNum; j++)
        {
            var loads = Console.ReadLine().Split(' ');
            var a = int.Parse(loads[0]);
            var b = int.Parse(loads[1]);
            if (loadDict.ContainsKey(a))
            {
                loadDict[a].Add(b);
            }
            else
            {
                loadDict.Add(a, new HashSet<int>() { b });
            }

            if (loadDict.ContainsKey(b))
            {

                loadDict[b].Add(a);
                
            }
            else
            {
                loadDict.Add(b, new HashSet<int>() { a });
            }
        }

        var ans = 0;
        foreach(var tower in loadDict)
        {
            var flag = true;
            foreach(var otherTower in tower.Value)
            {
                if(heightDict[tower.Key] <= heightDict[otherTower])
                {
                    flag = false;
                }
            }

            if (flag)
            {
                ans += 1;
            }
        }

        for(var j = 1; j < towerNum + 1; j++)
        {
            if (!loadDict.ContainsKey(j))
            {
                ans += 1;
            }
        }

        Console.WriteLine(ans);
        Console.ReadLine();
    }

}



Measured memory_bytes: 56404
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def solve():
    N = int(input())
    factors = factorization(N)

    # print(factors)

    total = 0
    for factor in factors:
        f, z = factor
        if f == 1:
            continue

        t = 0
        for i in range(0, 1000):
            m = i * (i+1) / 2
            if m > z:
                t = i - 1
                break

        total += t
        # print(f, z, t)

    return total


def main():
    print(solve())


if __name__ == "__main__":
    main()


Measured memory_bytes: 9496
/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define deb(x) cout<<#x<<" "<<x<<el;
#define mp make_pair
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n==1) return x;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                              //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

template<typename T>
T maxx(T a,T b)
{
  if(a<b) re b;
  re b;
}
template<typename T, typename... Args>
T maxx(T a,T b, Args... args)
{
    re(maxx(maxx(a,b),args...));
}

template<typename T>
T minn(T a,T b)
{
  if(a<b) re a;
  re b;
}
template<typename T, typename... Args>
T minn(T a,T b, Args... args)
{
    re(minn(minn(a,b),args...));
}

template<typename T>
void read(T& a)
{
  cin>>a;
}
template<typename T, typename... Args>
void read(T& a,Args&... args)
{
  cin>>a; read(args...);
}

template<typename T>
void write(T a)
{
  cout<<a<<' ';
}
template<typename T, typename... Args>
void write(T a,Args... args)
{
  cout<<a<<' '; write(args...);
}

inline ll min(ll a,ll b)
{
  if(a<b) re a;
  else re b;
}
inline ll max(ll a,ll b)
{
  if(a<b) re b;
  else re a;
}

ll gcd(ll a, ll b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=((ans*((n-i)%N))%N*modInverse(i+1,N))%N;
  }
  re ans;
}

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

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    cin>>n;
    vi v(n);
    take(v,n);
    m=0;
    forf(i,1,n)
    {
      m+=max(0,v[i-1]-v[i]);
      v[i]=max(v[i],v[i-1]);
    }
    cout<<m<<el;
  }


  return 0;
}


Measured memory_bytes: 3980
n = int(input())
h = list(map(int,input().split()))
t = [0 for _ in range(n)]
memo = h[0]
for i in range(n-1):
	if memo >= h[i+1]:
		t[i+1] += t[i]+1
		memo = h[i+1]
	else:
		memo = h[i+1]
print(max(t))

Measured memory_bytes: 20444
#include <bits/stdc++.h>
using namespace std;
int main()
{   
    string s;
    cin >>s;
    int ans=0;
    int fin=s.size();
    for(int i=0;i<fin;i++){
        if (i >= fin - i - 1)
        {
            break;
        }
        if(s.at(i)!=s.at(fin-i-1)){
            ans++;
            
        }
      //  cout << ans << endl;
        
        
    }
  //  cout <<fin<<endl;
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> P;

int main()
{
    int n, k;
    cin >> n >> k;
    int p[200003];
    P pa[200003];
    priority_queue<P> qued;
    priority_queue<P, vector<P>, greater<P>> queu;
    for(int i = 0; i < n; i++){
        cin >> p[i];
        pa[i] = P(p[i], i);
    }
    int r[200002] {0};
    for(int i = n - 1; i > 0; i--){
        if(p[i] < p[i - 1]){
            r[i] = 1;
        }
    }
    int b[200002] {0};
    int ln = 0;
    int sorted = 0;
    for(int i = 1; i < n; i++){
        if(r[i] == 0) ln++;
        else ln = 0;
        if(ln >= k - 1){
            sorted++;
            b[i] = 1;
        }
    }
    for(int i = 0; i < k; i++){
        queu.push(pa[i]);
        qued.push(pa[i]);
    }
    int ans = n - k + 1;
    for(int i = k; i < n; i++){
        queu.push(pa[i]);
        qued.push(pa[i]);
        P lar;
        P sm;
        while(true){
            lar = qued.top();
            if(lar.second >= i - k) break;
            qued.pop();
        }
        while(true){
            sm = queu.top();
            if(sm.second >= i - k) break;
            queu.pop();
        }
        if(lar.second == i && sm.second == i - k && b[i] == 0) ans--;
    }
    if(sorted > 0) ans -= sorted - 1;
    cout << ans << endl;
}

Measured memory_bytes: 7524
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AABCxxx {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    string n;
	    in >> n;
	    out << "ABC" << n << endl;
	}
};


int main() {
	AABCxxx solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main() {
	char s[27];
	int len;
	int flag[26];
	int loop;
	scanf("%s", s);
	len = strlen(s);
	for (loop = 0; loop < 26; loop++)flag[loop] = 1;
	for (loop = 0; loop < len; loop++) 
		if (flag[s[loop] - 'a']-- == 0) {
			printf("no\n");
			return 0;
		
	}
	printf("yes\n");
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define SIZE 100000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit()
{
	inv[1] = 1;
	for (int i = 2; i <= SIZE; i++)
	{
		inv[i] = mod - (mod / i)*inv[mod%i] % mod;
	}
	kai[0] = invkai[0] = 1;
	for (int i = 1; i <= SIZE; i++)
	{
		kai[i] = kai[i - 1] * i%mod;
		invkai[i] = invkai[i - 1] * inv[i] % mod;
	}
}
ll com(ll a, ll b)
{
	if (b < 0 || a < b)return 0;
	return (invkai[b] * invkai[a - b]) % mod*kai[a] % mod;
}
ll dp[22][2111];
int main()
{
	int num, kai;
	scanf("%d%d", &num, &kai);
	invinit();
	dp[0][0] = 1;
	for (int i = 0; i < kai; i++)
	{
		int z;
		scanf("%d", &z);
		for (int j = 0; j <= num; j++)
		{
			for (int k = 0; k <= z; k++)
			{
				dp[i + 1][j + k] = (dp[i + 1][j + k] + dp[i][j] * com(num - j, k) % mod*com(num - k, z - k)) % mod;
			}
		}
	}
	printf("%lld\n", dp[kai][num]);
}

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

int fun(ll a,ll b){
  int cnta = 0;
  int cntb = 0;

  while(a > 0){
    a /= 10;
    cnta++;
  }

  while(b > 0){
    b /= 10;
    cntb++;
  }

  return max(cnta,cntb);
}

int main(){
  ll n;
  scanf("%lld", &n);

  vector <pair<ll,ll>> a;
  ll i;

  for(i = 1;i*i <= n;i++){
    if(n % i == 0){
      a.push_back(make_pair(i,n/i));
    }
  }

  ll min = 100100100100;
  ll t;

  for(i = 0;i < a.size();i++){
    t = fun(a[i].first,a[i].second);
    if(min > t) min = t;
  }

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

  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            // in
            int N = Integer.parseInt(sc.next());
            int mod = (N % 1000) == 0 ? 1000 : (N % 1000);
            System.out.println(1000 - mod);
        }
    }
}

Measured memory_bytes: 35536
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let ds: Vec<i64> = (0..n).map(|_| sc.cin()).collect();
    put!(
        (1..n).map(|i| (0..i).map(|j| ds[i] * ds[j]).sum::<i64>()).sum::<i64>()
    );
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int a,br;
int main()
{
    for(int i=0;i<3;i++){
        scanf("%d",&a);
        br=br*10+a;
    }
    if(br%4==0){
        printf("YES");
        return 0;
    }
    printf("NO");
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class Class1
{
    static void Main(string[] args)
    {
        var a = Console.ReadLine().ToCharArray();
        var b = Console.ReadLine().ToCharArray();

        int sum = 0;
        for (int i = 0; i < a.Length; i++)
        {
            if (a[i] != b[i])
            {
                sum++;
            }
        }

        Console.WriteLine(sum);
    }
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

char c[9][5]={{'.',',','!','?',' '},
			{'a','b','c'},
			{'d','e','f'},
			{'g','h','i'},
			{'j','k','l'},
			{'m','n','o'},
			{'p','q','r','s'},
			{'t','u','v'},
			{'w','x','y','z'},
};

string s;

int main(){
	cin.sync_with_stdio(false);
	int cases;
	cin>>cases;
	while(cases--){
		cin>>s;
		string res;
		int i=0;
		while(1){
			while(i<s.length()&&s[i]=='0')i++;
			if(i==s.length())break;
			int cnt=0;
			while(i<s.length()&&s[i]!='0')cnt++,i++;
			int k=s[i-1]-'1';
			int r;
			if(k==0)r=5;
			else if(k==6||k==8)r=4;
			else r=3;
			res+=c[k][(cnt-1)%r];
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 3176
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let s : String = get_one();
    let t : String = get_one();

    let ss : Vec<char> = s.chars().rev().collect();
    let tt : Vec<char> = t.chars().rev().collect();

    if ss.len() > tt.len() {
        println!("{}", "GREATER");
    }
    else if ss.len() < tt.len() {
        println!("{}", "LESS");
    }
    else {
        let n = std::cmp::min(ss.len(), tt.len());
        let mut prev_greater = 0;
        for i in 0..n {
            if ss[i] > tt[i] {
                prev_greater = 1;
            }
            else if ss[i] < tt[i] {
                prev_greater = -1;
            }
        }
        if prev_greater == 0 {
            println!("{}", "EQUAL");
        }
        else if prev_greater == 1 {
            println!("{}", "GREATER");
        }
        else {
            println!("{}", "LESS");
        }
    }
}


Measured memory_bytes: 4352
import java.io.*;
import java.util.*;


public class Main {
    static long mod = 1000000000+7;
    static int maxn=2;
    static long[] f5ac, inv;
    static ArrayList<Integer>[] rec;
    static int[] v;
    static int n,k;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //String[] buf = reader.readLine().split(" ");
        n = sc.nextInt(); k =sc.nextInt();
        v = new int[n+1];
        for(int i=1;i<=n;i++) v[i]=sc.nextInt();
        int ans = 0;
        for(int head = 0; head<=n;head++){
            for(int tail = 0;tail<=n;tail++){
                if(head+tail>Math.min(k,n)) break;
                int sum = 0;
                PriorityQueue<Integer> pq = new PriorityQueue<>();
                for(int i=1;i<=head;i++){
                    sum += v[i]; pq.add(v[i]);
                }
                for(int i=n;i>n-tail;i--){
                    sum += v[i]; pq.add(v[i]);
                }
                int cur = sum;
                for(int j=1;j<=k-(head+tail)&&pq.size()>0;j++){
                    sum -= pq.poll();
                    cur = Math.max(cur,sum);
                }
                ans = Math.max(ans,cur);
            }
        }
        System.out.println(ans);
    }
}



Measured memory_bytes: 25940
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

void solve() {
	ll e; scanf("%lld", &e);
	if (e == 0) exit(0);
	ll res = INF;
	for (ll z = 0; z * z * z <= e; z++) {
		ll r = e - z * z * z;
		for (ll y = 0; y * y <= r; y++) {
			ll x = r - y * y;
			chmin(res, x + y + z);
		}
	}
	printf("%lld\n", res);
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int kkt = 89;
	while (kkt) {
		solve();
	}
	return 0;

}


Measured memory_bytes: 3188
import sys
 
# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())
 
def log(*args):
    print("DEBUG:", *args, file=sys.stderr)
 
def int_to_bits(x):
    return [ 1 if 2**i & x != 0 else 0 for i in range(60) ]
 
def inv(x, MOD):
    return pow(x, MOD-2, MOD)
 
MOD = 10**9+7
 
n,*A = get_all_int()
 
pow2    = [1] * 61
pow2mod = [1] * 61
for i in range(1,61):
    pow2[i] = pow2[i-1] * 2
    pow2mod[i] = pow2[i] % MOD
 
# ビットごとの出現回数 2**i
bits = [0] * 60
 
for a in A:
    for i in range(60):
        if pow2[i] & a != 0:
            bits[i] += 1
 
ans = 0
 
for a in A:
    for i in range(60):
        ans += pow2mod[i] * abs(bits[i] - (1 if pow2[i] & a != 0 else 0) *n)
 
print(ans*inv(2,MOD) % MOD)

Measured memory_bytes: 156044
let rec range left right =
    let rec _range left right a =
        if left >= right then a else _range left (right - 1) (right :: a) in
    _range (left - 1) (right - 1) [];;

let solve n = (List.fold_left (fun a b -> (a * b) mod 1000000007) 1 (range 1 (n + 1)));;

let () =
    let n = read_int () in
    print_int (solve n);
    print_newline ();;



Measured memory_bytes: 6272
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int a, b, k, c, ans;
	cin >> a >> b >> k;
	c = min(a, b);
	for (int i = c; i > 0; i--) {
		if (a % i == 0 && b % i == 0) {
			k--;
		}
		if (k == 0) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def gcd(m, n):
    # 入力を m, n (m ≧ n) とする。
    tmp = max(m,n)
    n = min(m,n)
    m = tmp
    # n = 0 なら、 m を出力してアルゴリズムを終了する。
    if n == 0:
        return m
    # m を n で割った余りを新たに n とし、更に 元のnを新たにm とし 2. に戻る。
    return gcd(n, m % n)


a,b,c,d = get_nums_l()

# cで割れる個数
t = a - (a%c-1)
cx = (b-t+1)//c + (1 if a%c==0 else 0)
# dで割れる個数
t = a - (a%d-1)
dx = (b-t+1)//d + (1 if a%d==0 else 0)
# c,dどちらも割れる個数
cd = c*d //(gcd(c,d))
t = a - (a%cd-1)
cdx = (b-t+1)//cd + (1 if a%cd==0 else 0)

all = b-a+1
print(all - cx - dx + cdx)

Measured memory_bytes: 38492
import java.util.Scanner
fun main (args: Array<String>) {
  
  val reader = Scanner(System.`in`)
  val input = reader.next()!!.toCharArray()
  
  var count = 0
  var countList =  mutableListOf<Int>()
  
  for(c in input){
    when(c){
      'A', 'T', 'C', 'G' -> {
        count ++
      }
      else -> {
        countList.add(count)
        count = 0
      }
    }
  }
  
  countList.add(count)
  
  println(countList.max())
  
}

Measured memory_bytes: 31388